Skip to content

API documentation of Agoric SDK / Exports / @agoric/swingset-vat

Module: @agoric/swingset-vat ​

Table of contents ​

Namespaces ​

Interfaces ​

Type Aliases ​

Functions ​

Type Aliases ​

Bundle ​

Ƭ Bundle: EndoZipBase64Bundle | GetExportBundle | NestedEvaluateBundle

Defined in ​

packages/SwingSet/src/types-external.js:20


BundleCap ​

Ƭ BundleCap: any

Defined in ​

packages/SwingSet/src/types-external.js:238


BundleFormat ​

Ƭ BundleFormat: "getExport" | "nestedEvaluate" | "endoZipBase64"

Defined in ​

packages/SwingSet/src/types-external.js:10


BundleID ​

Ƭ BundleID: string

Defined in ​

packages/SwingSet/src/types-external.js:237


BundleName ​

Ƭ BundleName: Object

Type declaration ​

NameType
bundleNamestring

Defined in ​

packages/SwingSet/src/types-external.js:163


BundleRef ​

Ƭ BundleRef: Object

Type declaration ​

NameType
bundleBundle

Defined in ​

packages/SwingSet/src/types-external.js:160


BundleSpec ​

Ƭ BundleSpec: Object

Type declaration ​

NameType
bundleSpecstring

Defined in ​

packages/SwingSet/src/types-external.js:157


DeviceInvocation ​

Ƭ DeviceInvocation: [string, string, SwingSetCapData]

Defined in ​

packages/SwingSet/src/types-external.js:111


DeviceInvocationResult ​

Ƭ DeviceInvocationResult: DeviceInvocationResultOk | DeviceInvocationResultError

Defined in ​

packages/SwingSet/src/types-external.js:118


DeviceInvocationResultError ​

Ƭ DeviceInvocationResultError: [tag: "error", problem: string]

Defined in ​

packages/SwingSet/src/types-external.js:117


DeviceInvocationResultOk ​

Ƭ DeviceInvocationResultOk: [tag: "ok", data: SwingSetCapData]

Defined in ​

packages/SwingSet/src/types-external.js:116


DynamicVatOptions ​

Ƭ DynamicVatOptions: BaseVatOptions & OptMeter & OptManagerType

config.vats[name].creationOptions: StaticVatOptions

Defined in ​

packages/SwingSet/src/types-external.js:312


EndoZipBase64Bundle ​

Ƭ EndoZipBase64Bundle: Object

Type declaration ​

NameType
endoZipBase64string
endoZipBase64Sha512string
moduleFormat"endoZipBase64"

Defined in ​

packages/SwingSet/src/types-external.js:239


GetExportBundle ​

Ƭ GetExportBundle: Object

Type declaration ​

NameType
moduleFormat"getExport"
sourcestring
sourceMap?string

Defined in ​

packages/SwingSet/src/types-external.js:18


KVStore ​

Ƭ KVStore: KVStore

Defined in ​

packages/SwingSet/src/types-external.js:206


KernelDeliveryBringOutYourDead ​

Ƭ KernelDeliveryBringOutYourDead: [tag: "bringOutYourDead"]

Defined in ​

packages/SwingSet/src/types-external.js:80


KernelDeliveryChangeVatOptions ​

Ƭ KernelDeliveryChangeVatOptions: [tag: "changeVatOptions", options: Record<string, unknown>]

Defined in ​

packages/SwingSet/src/types-external.js:77


KernelDeliveryDropExports ​

Ƭ KernelDeliveryDropExports: [tag: "dropExports", krefs: string[]]

Defined in ​

packages/SwingSet/src/types-external.js:74


KernelDeliveryMessage ​

Ƭ KernelDeliveryMessage: [tag: "message", target: string, msg: Message]

Defined in ​

packages/SwingSet/src/types-external.js:71


KernelDeliveryNotify ​

Ƭ KernelDeliveryNotify: [tag: "notify", resolutions: KernelDeliveryOneNotify[]]

Defined in ​

packages/SwingSet/src/types-external.js:73


KernelDeliveryObject ​

Ƭ KernelDeliveryObject: KernelDeliveryMessage | KernelDeliveryNotify | KernelDeliveryDropExports | KernelDeliveryRetireExports | KernelDeliveryRetireImports | KernelDeliveryChangeVatOptions | KernelDeliveryStartVat | KernelDeliveryStopVat | KernelDeliveryBringOutYourDead

Defined in ​

packages/SwingSet/src/types-external.js:84


KernelDeliveryOneNotify ​

Ƭ KernelDeliveryOneNotify: [kpid: string, kp: Object]

Defined in ​

packages/SwingSet/src/types-external.js:72


KernelDeliveryRetireExports ​

Ƭ KernelDeliveryRetireExports: [tag: "retireExports", krefs: string[]]

Defined in ​

packages/SwingSet/src/types-external.js:75


KernelDeliveryRetireImports ​

Ƭ KernelDeliveryRetireImports: [tag: "retireImports", krefs: string[]]

Defined in ​

packages/SwingSet/src/types-external.js:76


KernelDeliveryStartVat ​

Ƭ KernelDeliveryStartVat: [tag: "startVat", vatParameters: SwingSetCapData]

Defined in ​

packages/SwingSet/src/types-external.js:78


KernelDeliveryStopVat ​

Ƭ KernelDeliveryStopVat: [tag: "stopVat", disconnectObject: SwingSetCapData]

Defined in ​

packages/SwingSet/src/types-external.js:79


KernelKeeper ​

Ƭ KernelKeeper: ReturnType<default>

Defined in ​

packages/SwingSet/src/types-external.js:122


KernelOneResolution ​

Ƭ KernelOneResolution: [kpid: string, rejected: boolean, data: SwingSetCapData]

Defined in ​

packages/SwingSet/src/types-external.js:88


KernelOptions ​

Ƭ KernelOptions: Object

Type declaration ​

NameType
defaultManagerType?ManagerType
defaultReapInterval?number | "never"
pinBootstrapRoot?boolean
relaxDurabilityRules?boolean
snapshotInitial?number
snapshotInterval?number

Defined in ​

packages/SwingSet/src/types-external.js:33


KernelSlog ​

Ƭ KernelSlog: Object

Type declaration ​

NameType
delivery(vatID: string, newCrankNum: BigInt, newDeliveryNum: BigInt, kd: KernelDeliveryObject, vd: VatDeliveryObject, replay?: boolean) => SlogFinishDelivery
provideVatSlogger(vatID: string, dynamic?: boolean, description?: string, name?: string, vatSourceBundle?: unknown, managerType?: string, vatParameters?: unknown) => { vatSlog: VatSlog }
syscall(vatID: string, ksc: KernelSyscallObject | undefined, vsc: VatSyscallObject) => SlogFinishSyscall
terminateVat(vatID: string, shouldReject: boolean, info: SwingSetCapData) => void
vatConsole(vatID: string, origConsole: {}) => {}
write({}: any) => void

Defined in ​

packages/SwingSet/src/types-external.js:143


KernelSyscallAbandonExports ​

Ƭ KernelSyscallAbandonExports: [tag: "abandonExports", vatID: string, krefs: string[]]

Defined in ​

packages/SwingSet/src/types-external.js:98


KernelSyscallCallKernelHook ​

Ƭ KernelSyscallCallKernelHook: [tag: "callKernelHook", hookName: string, args: SwingSetCapData]

Defined in ​

packages/SwingSet/src/types-external.js:99


KernelSyscallDropImports ​

Ƭ KernelSyscallDropImports: [tag: "dropImports", krefs: string[]]

Defined in ​

packages/SwingSet/src/types-external.js:95


KernelSyscallExit ​

Ƭ KernelSyscallExit: [tag: "exit", vatID: string, isFailure: boolean, info: SwingSetCapData]

Defined in ​

packages/SwingSet/src/types-external.js:90


KernelSyscallInvoke ​

Ƭ KernelSyscallInvoke: [tag: "invoke", target: string, method: string, args: SwingSetCapData]

Defined in ​

packages/SwingSet/src/types-external.js:86


KernelSyscallObject ​

Ƭ KernelSyscallObject: KernelSyscallSend | KernelSyscallInvoke | KernelSyscallSubscribe | KernelSyscallResolve | KernelSyscallExit | KernelSyscallVatstoreGet | KernelSyscallVatstoreGetNextKey | KernelSyscallVatstoreSet | KernelSyscallVatstoreDelete | KernelSyscallDropImports | KernelSyscallRetireImports | KernelSyscallRetireExports | KernelSyscallAbandonExports | KernelSyscallCallKernelHook

Defined in ​

packages/SwingSet/src/types-external.js:106


KernelSyscallResolve ​

Ƭ KernelSyscallResolve: [tag: "resolve", vatID: string, resolutions: KernelOneResolution[]]

Defined in ​

packages/SwingSet/src/types-external.js:89


KernelSyscallResult ​

Ƭ KernelSyscallResult: KernelSyscallResultOk | KernelSyscallResultError

Defined in ​

packages/SwingSet/src/types-external.js:109


KernelSyscallResultError ​

Ƭ KernelSyscallResultError: [tag: "error", err: string]

Defined in ​

packages/SwingSet/src/types-external.js:108


KernelSyscallResultOk ​

Ƭ KernelSyscallResultOk: [tag: "ok", data: SwingSetCapData | string | string[] | undefined[] | null]

Defined in ​

packages/SwingSet/src/types-external.js:107


KernelSyscallRetireExports ​

Ƭ KernelSyscallRetireExports: [tag: "retireExports", krefs: string[]]

Defined in ​

packages/SwingSet/src/types-external.js:97


KernelSyscallRetireImports ​

Ƭ KernelSyscallRetireImports: [tag: "retireImports", krefs: string[]]

Defined in ​

packages/SwingSet/src/types-external.js:96


KernelSyscallSend ​

Ƭ KernelSyscallSend: [tag: "send", target: string, msg: Message]

Defined in ​

packages/SwingSet/src/types-external.js:85


KernelSyscallSubscribe ​

Ƭ KernelSyscallSubscribe: [tag: "subscribe", vatID: string, kpid: string]

Defined in ​

packages/SwingSet/src/types-external.js:87


KernelSyscallVatstoreDelete ​

Ƭ KernelSyscallVatstoreDelete: [tag: "vatstoreDelete", vatID: string, key: string]

Defined in ​

packages/SwingSet/src/types-external.js:94


KernelSyscallVatstoreGet ​

Ƭ KernelSyscallVatstoreGet: [tag: "vatstoreGet", vatID: string, key: string]

Defined in ​

packages/SwingSet/src/types-external.js:91


KernelSyscallVatstoreGetNextKey ​

Ƭ KernelSyscallVatstoreGetNextKey: [tag: "vatstoreGetNextKey", vatID: string, priorKey: string]

Defined in ​

packages/SwingSet/src/types-external.js:92


KernelSyscallVatstoreSet ​

Ƭ KernelSyscallVatstoreSet: [tag: "vatstoreSet", vatID: string, key: string, data: string]

Defined in ​

packages/SwingSet/src/types-external.js:93


ManagerType ​

Ƭ ManagerType: "local" | "node-subprocess" | "xsnap" | "xs-worker"

Defined in ​

packages/SwingSet/src/types-external.js:22


Message ​

Ƭ Message: Object

Type declaration ​

NameType
methargsSwingSetCapData
resultstring | undefined | null

Defined in ​

packages/swingset-liveslots/src/types.js:36


Meter ​

Ƭ Meter: unknown

E(vatAdminService).createVat(bundle, options: DynamicVatOptions)

Defined in ​

packages/SwingSet/src/types-external.js:241


MeteringVatPowers ​

Ƭ MeteringVatPowers: Object

Type declaration ​

NameType
makeGetMeterunknown
transformMeteringunknown

Defined in ​

packages/SwingSet/src/types-external.js:46


NestedEvaluateBundle ​

Ƭ NestedEvaluateBundle: Object

Type declaration ​

NameType
moduleFormat"nestedEvaluate"
sourcestring
sourceMap?string

Defined in ​

packages/SwingSet/src/types-external.js:19


OptEnableDisavow ​

Ƭ OptEnableDisavow: Object

Type declaration ​

NameType
enableDisavow?boolean

Defined in ​

packages/SwingSet/src/types-external.js:316


OptManagerType ​

Ƭ OptManagerType: Object

Type declaration ​

NameType
managerType?ManagerType

Defined in ​

packages/SwingSet/src/types-external.js:311


OptMeter ​

Ƭ OptMeter: Object

If a meter is provided, the new dynamic vat is limited to a fixed amount of computation and allocation that can occur during any given crank. Peak stack frames are limited as well. In addition, the given meter's "remaining" value will be reduced by the amount of computation used by each crank. The meter will eventually underflow unless it is topped up, at which point the vat is terminated. If undefined, the vat is unmetered. Static vats cannot be metered.

Type declaration ​

NameType
meter?Meter

Defined in ​

packages/SwingSet/src/types-external.js:301


OptNodeOptions ​

Ƭ OptNodeOptions: Object

Type declaration ​

NameType
nodeOptions?string[]

Defined in ​

packages/SwingSet/src/types-external.js:317


PolicyInput ​

Ƭ PolicyInput: PolicyInputNone | PolicyInputCreateVat | PolicyInputCrankComplete | PolicyInputCrankFailed

Defined in ​

packages/SwingSet/src/types-external.js:221


PolicyInputCrankComplete ​

Ƭ PolicyInputCrankComplete: [tag: "crank", details: PolicyInputDetails]

Defined in ​

packages/SwingSet/src/types-external.js:219


PolicyInputCrankFailed ​

Ƭ PolicyInputCrankFailed: [tag: "crank-failed", details: PolicyInputDetails]

Defined in ​

packages/SwingSet/src/types-external.js:220


PolicyInputCreateVat ​

Ƭ PolicyInputCreateVat: [tag: "create-vat", details: PolicyInputDetails]

Defined in ​

packages/SwingSet/src/types-external.js:218


PolicyInputDetails ​

Ƭ PolicyInputDetails: Object

Type declaration ​

NameType
computrons?bigint

Defined in ​

packages/SwingSet/src/types-external.js:216


PolicyInputNone ​

Ƭ PolicyInputNone: [tag: "none", details: PolicyInputDetails]

Defined in ​

packages/SwingSet/src/types-external.js:217


PolicyOutput ​

Ƭ PolicyOutput: boolean

Defined in ​

packages/SwingSet/src/types-external.js:222


ResolutionPolicy ​

Ƭ ResolutionPolicy: "none" | "ignore" | "logAlways" | "logFailure" | "panic"

Defined in ​

packages/SwingSet/src/types-external.js:64


RunPolicy ​

Ƭ RunPolicy: Object

Type declaration ​

NameType
crankComplete(details: { computrons?: bigint }) => PolicyOutput
crankFailed(details: {}) => PolicyOutput
emptyCrank() => PolicyOutput
vatCreated(details: {}) => PolicyOutput

Defined in ​

packages/SwingSet/src/types-external.js:227


ShutdownWithFailure ​

Ƭ ShutdownWithFailure: (reason: Error) => void

Called to shut something down because something went wrong, where the reason is supposed to be an Error that describes what went wrong. Some valid implementations of ShutdownWithFailure will never return, either because they throw or because they immediately shutdown the enclosing unit of computation. However, they also might return, so the caller should follow this call by their own defensive throw reason; if appropriate.

Type declaration ​

▸ (reason): void

Parameters ​
NameType
reasonError
Returns ​

void

Defined in ​

packages/SwingSet/src/types-external.js:323


SlogFinishDelivery ​

Ƭ SlogFinishDelivery: (dr: VatDeliveryResult) => void

Type declaration ​

▸ (dr): void

Parameters ​
NameType
drVatDeliveryResult
Returns ​

void

Defined in ​

packages/SwingSet/src/types-external.js:124


SlogFinishSyscall ​

Ƭ SlogFinishSyscall: (ksr: KernelSyscallResult, vsr: VatSyscallResult) => void

Type declaration ​

▸ (ksr, vsr): void

Parameters ​
NameType
ksrKernelSyscallResult
vsrVatSyscallResult
Returns ​

void

Defined in ​

packages/SwingSet/src/types-external.js:125


SnapStore ​

Ƭ SnapStore: SnapStore

Defined in ​

packages/SwingSet/src/types-external.js:207


SnapshotResult ​

Ƭ SnapshotResult: SnapshotResult

Defined in ​

packages/SwingSet/src/types-external.js:208


SourceOfBundle ​

Ƭ SourceOfBundle: { bundleName: string } | { bundle: Bundle } | { bundleID: BundleID }

Defined in ​

packages/SwingSet/src/types-external.js:203


SourceSpec ​

Ƭ SourceSpec: Object

Type declaration ​

NameType
sourceSpecstring

Defined in ​

packages/SwingSet/src/types-external.js:154


StaticVatOptions ​

Ƭ StaticVatOptions: BaseVatOptions & OptManagerType & OptEnableDisavow & OptNodeOptions

Defined in ​

packages/SwingSet/src/types-external.js:318


StaticVatPowers ​

Ƭ StaticVatPowers: VatPowers & MeteringVatPowers

Defined in ​

packages/SwingSet/src/types-external.js:41


SwingSetCapData ​

Ƭ SwingSetCapData: CapData

Defined in ​

packages/SwingSet/src/types-external.js:14


SwingSetConfig ​

Ƭ SwingSetConfig: KernelOptions & SwingSetOptions

a swingset config object

Defined in ​

packages/SwingSet/src/types-external.js:192


SwingSetConfigDescriptor ​

Ƭ SwingSetConfigDescriptor: Record<string, SwingSetConfigProperties>

Where the property name is the name of the vat. Note that the bootstrap property names the vat that should be used as the bootstrap vat. Although a swingset configuration can designate any vat as its bootstrap vat, loadBasedir will always look for a file named 'bootstrap.js' and use that (note that if there is no 'bootstrap.js', there will be no bootstrap vat).

Defined in ​

packages/SwingSet/src/types-external.js:171


SwingSetConfigProperties ​

Ƭ SwingSetConfigProperties: SourceSpec | BundleSpec | BundleRef | BundleName & { creationOptions?: Record<string, any> ; parameters?: Record<string, any> }

Defined in ​

packages/SwingSet/src/types-external.js:167


SwingSetKernelConfig ​

Ƭ SwingSetKernelConfig: SwingSetConfig & { idToBundle: Record<BundleID, Bundle> ; namedBundleIDs: Record<string, BundleID> }

the config object passed to initializeKernel

Defined in ​

packages/SwingSet/src/types-external.js:199


SwingStore ​

Ƭ SwingStore: SwingStore

Defined in ​

packages/SwingSet/src/types-external.js:210


SwingStoreHostStorage ​

Ƭ SwingStoreHostStorage: SwingStoreHostStorage

Defined in ​

packages/SwingSet/src/types-external.js:212


SwingStoreKernelStorage ​

Ƭ SwingStoreKernelStorage: SwingStoreKernelStorage

Defined in ​

packages/SwingSet/src/types-external.js:211


TerminationVatPowers ​

Ƭ TerminationVatPowers: Object

Type declaration ​

NameType
exitVat(unknown: any) => void
exitVatWithFailure(reason: Error) => void

Defined in ​

packages/SwingSet/src/types-external.js:51


TranscriptStore ​

Ƭ TranscriptStore: TranscriptStore

Defined in ​

packages/SwingSet/src/types-external.js:209


VatDeliveryObject ​

Ƭ VatDeliveryObject: VatDeliveryMessage | VatDeliveryNotify | VatDeliveryDropExports | VatDeliveryRetireExports | VatDeliveryRetireImports | VatDeliveryChangeVatOptions | VatDeliveryStartVat | VatDeliveryStopVat | VatDeliveryBringOutYourDead

Defined in ​

packages/swingset-liveslots/src/types.js:50


VatDeliveryResult ​

Ƭ VatDeliveryResult: [tag: "ok", results: any, usage: MeterConsumption | null] | [tag: "error", message: string, usage: MeterConsumption | null]

Defined in ​

packages/swingset-liveslots/src/types.js:54


VatKeeper ​

Ƭ VatKeeper: ReturnType<makeVatKeeper>

Defined in ​

packages/SwingSet/src/types-external.js:121


VatPowers ​

Ƭ VatPowers: TerminationVatPowers

Defined in ​

packages/SwingSet/src/types-external.js:39


VatSlog ​

Ƭ VatSlog: Object

Type declaration ​

NameType
delivery(crankNum: bigint, deliveryNum: bigint, kd: KernelDeliveryObject, vd: VatDeliveryObject) => SlogFinishDelivery

Defined in ​

packages/SwingSet/src/types-external.js:146


VatStats ​

Ƭ VatStats: Object

Type declaration ​

NameType
transcriptCountnumber

Defined in ​

packages/SwingSet/src/types-external.js:120


VatSyscallObject ​

Ƭ VatSyscallObject: VatSyscallSend | VatSyscallCallNow | VatSyscallSubscribe | VatSyscallResolve | VatSyscallExit | VatSyscallVatstoreGet | VatSyscallVatstoreGetNextKey | VatSyscallVatstoreSet | VatSyscallVatstoreDelete | VatSyscallDropImports | VatSyscallRetireImports | VatSyscallRetireExports | VatSyscallAbandonExports

Defined in ​

packages/swingset-liveslots/src/types.js:75


VatSyscallResult ​

Ƭ VatSyscallResult: VatSyscallResultOk | VatSyscallResultError

Defined in ​

packages/swingset-liveslots/src/types.js:79


VatUpgradeOptions ​

Ƭ VatUpgradeOptions: Object

Type declaration ​

NameType
upgradeMessage?string
vatParameters?object

Defined in ​

packages/SwingSet/src/types-external.js:320


VatUpgradeResults ​

Ƭ VatUpgradeResults: Object

Type declaration ​

NameType
incarnationNumbernumber

Defined in ​

packages/SwingSet/src/types-external.js:321


WaitUntilQuiescent ​

Ƭ WaitUntilQuiescent: () => Promise<void>

Type declaration ​

▸ (): Promise<void>

Returns ​

Promise<void>

Defined in ​

packages/SwingSet/src/types-external.js:148


XSnap ​

Ƭ XSnap: Awaited<ReturnType<xsnap>>

Defined in ​

packages/SwingSet/src/types-external.js:123

Functions ​

buildBridge ​

▸ buildBridge(outboundCallback): Object

Parameters ​

NameType
outboundCallbackany

Returns ​

Object

NameType
deliverInbound(...args: any[]) => void
endowments{ callOutbound: (...args: any[]) => any ; registerInboundCallback: (inbound: any) => void }
endowments.callOutbound(...args: any[]) => any
endowments.registerInboundCallback(inbound: any) => void
srcPathstring

Defined in ​

packages/SwingSet/src/devices/bridge/bridge.js:97


buildCommand ​

▸ buildCommand(broadcastCallback): Object

Parameters ​

NameType
broadcastCallbackany

Returns ​

Object

NameType
endowments{ deliverResponse: (kCount: any, kIsReject: any, kResponseString: any) => void ; registerInboundCallback: (cb: any) => void ; sendBroadcast: (kBodyString: any) => void }
endowments.deliverResponse(kCount: any, kIsReject: any, kResponseString: any) => void
endowments.registerInboundCallback(cb: any) => void
endowments.sendBroadcast(kBodyString: any) => void
inboundCommand(obj: any) => Promise<any>
srcPathstring

Defined in ​

packages/SwingSet/src/devices/command/command.js:6


buildKernelBundles ​

▸ buildKernelBundles(): Promise<{ kernel: any = kernelBundle }>

Returns ​

Promise<{ kernel: any = kernelBundle }>

Defined in ​

packages/SwingSet/src/controller/initializeSwingset.js:81


buildMailbox ​

▸ buildMailbox(state): Object

Parameters ​

NameType
stateany

Returns ​

Object

NameType
deliverInbound(peer: any, messages: any, ack: any) => boolean
endowments{ add: (peer: any, msgnum: any, body: any) => void ; registerInboundCallback: (cb: any) => void ; remove: (peer: any, msgnum: any) => void ; setAcknum: (peer: any, msgnum: any) => void }
endowments.add(peer: any, msgnum: any, body: any) => void
endowments.registerInboundCallback(cb: any) => void
endowments.remove(peer: any, msgnum: any) => void
endowments.setAcknum(peer: any, msgnum: any) => void
srcPathstring

Defined in ​

packages/SwingSet/src/devices/mailbox/mailbox.js:158


buildMailboxStateMap ​

▸ buildMailboxStateMap(state?): Object

Parameters ​

NameType
stateMap<any, any>

Returns ​

Object

NameType
add(peer: any, msgnum: any, body: any) => void
exportToData() => {}
populateFromData(data: any) => void
remove(peer: any, msgnum: any) => void
setAcknum(peer: any, msgnum: any) => void

Defined in ​

packages/SwingSet/src/devices/mailbox/mailbox.js:97


buildPlugin ​

▸ buildPlugin(pluginDir, importPlugin, queueThunkForKernel): Object

Parameters ​

NameType
pluginDirany
importPluginany
queueThunkForKernelany

Returns ​

Object

NameType
endowments{ getPluginDir: () => any ; import: any = importPlugin; queueThunkForKernel: any ; registerResetter: (init: any) => void }
endowments.getPluginDir() => any
endowments.importany
endowments.queueThunkForKernelany
endowments.registerResetter(init: any) => void
reset() => void
srcPathstring

Defined in ​

packages/SwingSet/src/devices/plugin/plugin.js:1


buildTimer ​

▸ buildTimer(): Object

Endowments for a Timer device that can be made available to SwingSet vats.

This is code that runs in the outer half of the device, which is in the primal realm. We provide a poll() function, which calls a device-level function that will be provided later when the device root node is created.

The host loop should call poll on a regular basis, and then call controller.run() when it returns true.

Returns ​

Object

NameType
endowments{ registerDevicePollFunction: (pollFn: any) => void }
endowments.registerDevicePollFunction(pollFn: any) => void
poll(time: number | bigint) => boolean
srcPathstring

Defined in ​

packages/SwingSet/src/devices/timer/timer.js:15


buildVatController ​

▸ buildVatController(config, argv?, runtimeOptions?, deviceEndowments?): Promise<{ bootstrapResult: undefined | string ; debug: { addDeviceHook: (deviceName: any, hookName: any, hook: any) => void = kernel.addDeviceHook } ; shutdown: () => Promise<void> ; validateAndInstallBundle: (bundle: EndoZipBase64Bundle, allegedBundleID?: string) => Promise<string> ; writeSlogObject: (obj: any) => void ; changeKernelOptions: (options: any) => void ; deviceNameToID: (deviceName: any) => undefined | string ; dump: () => { acceptanceQueue: any[] ; gcActions: any[] ; kernelTable: any[] ; log: string[] = ephemeral.log; objects: any[][] ; promises: { id: string = kpid; state: string }[] ; reapQueue: any ; runQueue: any[] ; vatTables: { state: { transcript: [number, TranscriptEntry][] } ; vatID: string }[] } ; getActivityhash: () => string ; getStats: () => {} ; getStatus: () => { activeVats: { id: string ; options: RecordedVatOptions }[] } ; kpResolution: (kpid: any, options: any) => any ; kpStatus: (kpid: any) => string ; log: (str: any) => void ; pinVatRoot: (vatName: any) => string ; queueToVatObject: (target: any, method: string | symbol, args: unknown[], resultPolicy: ResolutionPolicy) => undefined | string ; queueToVatRoot: (vatName: string, method: string | symbol, args: unknown[], resultPolicy: ResolutionPolicy) => undefined | string ; reapAllVats: () => void ; run: (policy?: RunPolicy) => Promise<number> ; step: () => Promise<0 | 1> ; upgradeStaticVat: (vatName: any, shouldPauseFirst: any, bundleID: any, options: {}) => undefined | string ; vatNameToID: (vatName: any) => string ; verboseDebugMode: (flag: any) => void }>

NB: To be used only in tests. An app with this may not survive a reboot.

This helper makes Swingset controllers and automatically initializes the SwingSet if it isn't already. It will not work for use cases that need to configure devices.

The official API does these as two separate steps because the two sometimes need to happen at different times. In particular, sometimes you need the host to be able to control whether or not to initialize independent of the SwingSet's history. Also sometimes you want different runtime options for the two stages; this can happen, for example, in some debugging cases.

Parameters ​

NameTypeDefault value
configSwingSetConfigundefined
argvstring[][]
runtimeOptionsObject{}
runtimeOptions.debugPrefix?stringundefined
runtimeOptions.env?Record<string, string>undefined
runtimeOptions.kernelBundles?Record<string, Bundle>undefined
runtimeOptions.kernelStorage?SwingStoreKernelStorageundefined
runtimeOptions.slogCallbacks?unknownundefined
runtimeOptions.slogSender?SlogSenderundefined
runtimeOptions.testTrackDecref?unknownundefined
runtimeOptions.verbose?booleanundefined
runtimeOptions.warehousePolicy?VatWarehousePolicyundefined
deviceEndowmentsRecord<string, unknown>{}

Returns ​

Promise<{ bootstrapResult: undefined | string ; debug: { addDeviceHook: (deviceName: any, hookName: any, hook: any) => void = kernel.addDeviceHook } ; shutdown: () => Promise<void> ; validateAndInstallBundle: (bundle: EndoZipBase64Bundle, allegedBundleID?: string) => Promise<string> ; writeSlogObject: (obj: any) => void ; changeKernelOptions: (options: any) => void ; deviceNameToID: (deviceName: any) => undefined | string ; dump: () => { acceptanceQueue: any[] ; gcActions: any[] ; kernelTable: any[] ; log: string[] = ephemeral.log; objects: any[][] ; promises: { id: string = kpid; state: string }[] ; reapQueue: any ; runQueue: any[] ; vatTables: { state: { transcript: [number, TranscriptEntry][] } ; vatID: string }[] } ; getActivityhash: () => string ; getStats: () => {} ; getStatus: () => { activeVats: { id: string ; options: RecordedVatOptions }[] } ; kpResolution: (kpid: any, options: any) => any ; kpStatus: (kpid: any) => string ; log: (str: any) => void ; pinVatRoot: (vatName: any) => string ; queueToVatObject: (target: any, method: string | symbol, args: unknown[], resultPolicy: ResolutionPolicy) => undefined | string ; queueToVatRoot: (vatName: string, method: string | symbol, args: unknown[], resultPolicy: ResolutionPolicy) => undefined | string ; reapAllVats: () => void ; run: (policy?: RunPolicy) => Promise<number> ; step: () => Promise<0 | 1> ; upgradeStaticVat: (vatName: any, shouldPauseFirst: any, bundleID: any, options: {}) => undefined | string ; vatNameToID: (vatName: any) => string ; verboseDebugMode: (flag: any) => void }>

Defined in ​

packages/SwingSet/src/controller/controller.js:480


initializeSwingset ​

▸ initializeSwingset(config, bootstrapArgs, kernelStorage, initializationOptions?, runtimeOptions?): Promise<undefined | string>

Parameters ​

NameType
configSwingSetConfig
bootstrapArgsunknown
kernelStorageSwingStoreKernelStorage
initializationOptionsInitializationOptions
runtimeOptionsObject
runtimeOptions.bundleHandler?BundleHandler
runtimeOptions.env?Record<string, undefined | string>

Returns ​

Promise<undefined | string>

KPID of the bootstrap message result promise

Defined in ​

packages/SwingSet/src/controller/initializeSwingset.js:295


loadBasedir ​

▸ loadBasedir(basedir, options?): SwingSetConfig

Scan a directory for files defining the vats to bootstrap for a swingset, and produce a swingset config object for what was found there. Looks for files with names of the pattern vat-NAME.js as well as a file named 'bootstrap.js'.

Parameters ​

NameTypeDescription
basedirstringThe directory to scan
options?Object-
options.bundleFormatundefined | BundleFormatthe bundle format to use
options.includeDevDependenciesundefined | booleanwhether to include devDependencies

Returns ​

SwingSetConfig

a swingset config object: { bootstrap: "bootstrap", vats: { NAME: { sourceSpec: PATHSTRING } } }

Where NAME is the name of the vat; sourceSpec contains the path to the vat with that name. Note that the bootstrap property names the vat that should be used as the bootstrap vat. Although a swingset configuration can designate any vat as its bootstrap vat, loadBasedir will always look for a file named 'bootstrap.js' and use that (note that if there is no 'bootstrap.js', there will be no bootstrap vat).

Swingsets defined by scanning a directory in this manner define no devices.

Defined in ​

packages/SwingSet/src/controller/initializeSwingset.js:125


loadSwingsetConfigFile ​

▸ loadSwingsetConfigFile(configPath): Promise<null | SwingSetConfig>

Read and parse a swingset config file and return it in normalized form.

Parameters ​

NameTypeDescription
configPathstringPath to the config file to be processed

Returns ​

Promise<null | SwingSetConfig>

the contained config object, in normalized form, or null if the requested config file did not exist.

Throws

if the file existed but was inaccessible, malformed, or otherwise invalid.

Defined in ​

packages/SwingSet/src/controller/initializeSwingset.js:236


makeSwingsetController ​

▸ makeSwingsetController(kernelStorage?, deviceEndowments?, runtimeOptions?): Promise<{ debug: { addDeviceHook: (deviceName: any, hookName: any, hook: any) => void = kernel.addDeviceHook } ; validateAndInstallBundle: (bundle: EndoZipBase64Bundle, allegedBundleID?: string) => Promise<string> ; writeSlogObject: (obj: any) => void ; changeKernelOptions: (options: any) => void ; deviceNameToID: (deviceName: any) => undefined | string ; dump: () => { acceptanceQueue: any[] ; gcActions: any[] ; kernelTable: any[] ; log: string[] = ephemeral.log; objects: any[][] ; promises: { id: string = kpid; state: string }[] ; reapQueue: any ; runQueue: any[] ; vatTables: { state: { transcript: [number, TranscriptEntry][] } ; vatID: string }[] } ; getActivityhash: () => string ; getStats: () => {} ; getStatus: () => { activeVats: { id: string ; options: RecordedVatOptions }[] } ; kpResolution: (kpid: any, options: any) => any ; kpStatus: (kpid: any) => string ; log: (str: any) => void ; pinVatRoot: (vatName: any) => string ; queueToVatObject: (target: any, method: string | symbol, args: unknown[], resultPolicy: ResolutionPolicy) => undefined | string ; queueToVatRoot: (vatName: string, method: string | symbol, args: unknown[], resultPolicy: ResolutionPolicy) => undefined | string ; reapAllVats: () => void ; run: (policy?: RunPolicy) => Promise<number> ; shutdown: () => Promise<void> ; step: () => Promise<0 | 1> ; upgradeStaticVat: (vatName: any, shouldPauseFirst: any, bundleID: any, options: {}) => undefined | string ; vatNameToID: (vatName: any) => string ; verboseDebugMode: (flag: any) => void }>

Parameters ​

NameType
kernelStorageSwingStoreKernelStorage
deviceEndowmentsRecord<string, unknown>
runtimeOptionsObject
runtimeOptions.bundleHandler?BundleHandler
runtimeOptions.debugPrefix?string
runtimeOptions.debugVats?string[]
runtimeOptions.env?Record<string, undefined | string>
runtimeOptions.kernelBundle?Bundle
runtimeOptions.overrideVatManagerOptions?unknown
runtimeOptions.profileVats?string[]
runtimeOptions.slogCallbacks?unknown
runtimeOptions.slogSender?SlogSender
runtimeOptions.spawn?(command: string, options?: SpawnOptionsWithoutStdio) => ChildProcessWithoutNullStreams(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>) => ChildProcessByStdio<Writable, Readable, Readable>(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>) => ChildProcessByStdio<Writable, Readable, null>(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>) => ChildProcessByStdio<Writable, null, Readable>(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>) => ChildProcessByStdio<null, Readable, Readable>(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>) => ChildProcessByStdio<Writable, null, null>(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>) => ChildProcessByStdio<null, Readable, null>(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>) => ChildProcessByStdio<null, null, Readable>(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>) => ChildProcessByStdio<null, null, null>(command: string, options: SpawnOptions) => ChildProcess(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio) => ChildProcessWithoutNullStreams(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>) => ChildProcessByStdio<Writable, Readable, Readable>(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>) => ChildProcessByStdio<Writable, Readable, null>(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>) => ChildProcessByStdio<Writable, null, Readable>(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>) => ChildProcessByStdio<null, Readable, Readable>(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>) => ChildProcessByStdio<Writable, null, null>(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>) => ChildProcessByStdio<null, Readable, null>(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>) => ChildProcessByStdio<null, null, Readable>(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>) => ChildProcessByStdio<null, null, null>(command: string, args: readonly string[], options: SpawnOptions) => ChildProcess
runtimeOptions.testTrackDecref?unknown
runtimeOptions.verbose?boolean
runtimeOptions.warehousePolicy?VatWarehousePolicy
runtimeOptions.xsnapBundleData?Object
runtimeOptions.xsnapBundleData.getLockdownBundle() => Promise<Bundle>
runtimeOptions.xsnapBundleData.getLockdownBundleSHA256() => Promise<string>
runtimeOptions.xsnapBundleData.getSupervisorBundle() => Promise<Bundle>
runtimeOptions.xsnapBundleData.getSupervisorBundleSHA256() => Promise<string>

Returns ​

Promise<{ debug: { addDeviceHook: (deviceName: any, hookName: any, hook: any) => void = kernel.addDeviceHook } ; validateAndInstallBundle: (bundle: EndoZipBase64Bundle, allegedBundleID?: string) => Promise<string> ; writeSlogObject: (obj: any) => void ; changeKernelOptions: (options: any) => void ; deviceNameToID: (deviceName: any) => undefined | string ; dump: () => { acceptanceQueue: any[] ; gcActions: any[] ; kernelTable: any[] ; log: string[] = ephemeral.log; objects: any[][] ; promises: { id: string = kpid; state: string }[] ; reapQueue: any ; runQueue: any[] ; vatTables: { state: { transcript: [number, TranscriptEntry][] } ; vatID: string }[] } ; getActivityhash: () => string ; getStats: () => {} ; getStatus: () => { activeVats: { id: string ; options: RecordedVatOptions }[] } ; kpResolution: (kpid: any, options: any) => any ; kpStatus: (kpid: any) => string ; log: (str: any) => void ; pinVatRoot: (vatName: any) => string ; queueToVatObject: (target: any, method: string | symbol, args: unknown[], resultPolicy: ResolutionPolicy) => undefined | string ; queueToVatRoot: (vatName: string, method: string | symbol, args: unknown[], resultPolicy: ResolutionPolicy) => undefined | string ; reapAllVats: () => void ; run: (policy?: RunPolicy) => Promise<number> ; shutdown: () => Promise<void> ; step: () => Promise<0 | 1> ; upgradeStaticVat: (vatName: any, shouldPauseFirst: any, bundleID: any, options: {}) => undefined | string ; vatNameToID: (vatName: any) => string ; verboseDebugMode: (flag: any) => void }>

Defined in ​

packages/SwingSet/src/controller/controller.js:109


swingsetIsInitialized ​

▸ swingsetIsInitialized(kernelStorage): boolean

Parameters ​

NameType
kernelStorageany

Returns ​

boolean

Defined in ​

packages/SwingSet/src/controller/initializeSwingset.js:258