Interface: NodeExtensionContext
Makaio Framework / contracts / NodeExtensionContext
Interface: NodeExtensionContext
Section titled “Interface: NodeExtensionContext”Defined in: ../../../packages/contracts/src/extension/extension-context.ts:85
Node.js host extension context.
Adds the OS and filesystem fields supplied by Node-based composition roots. Extensions that need these fields should opt into this context explicitly; host-agnostic extensions can type themselves against ExtensionContext.
Extends
Section titled “Extends”Properties
Section titled “Properties”
readonlybus:IMakaioBus
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:15
Bus instance for registering handlers and emitting events.
Inherited from
Section titled “Inherited from”config?
Section titled “config?”
readonlyoptionalconfig?:unknown
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:42
Resolved configuration for this extension, merged from stored values and
descriptor defaults. Present only when the extension declared a
configSchema on its MakaioExtension.
Extensions should parse this with their Zod schema to get typed config:
const config = parseExtensionConfig(MyConfigSchema, ctx.config);Inherited from
Section titled “Inherited from”dataDir
Section titled “dataDir”
readonlydataDir:string
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:23
Per-extension writable data directory resolved by the host runtime.
Use this for extension-local persistence (caches, state files, etc.).
Inherited from
Section titled “Inherited from”hasExtension
Section titled “hasExtension”
readonlyhasExtension: (name) =>boolean
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:75
Check whether an extension with the given name is active.
Returns true when the named extension has been loaded and reached
active state. Use this for optional integration checks without
requiring an ExtensionToken.
Parameters
Section titled “Parameters”string
Extension name to check.
Returns
Section titled “Returns”boolean
true when the extension is active.
Inherited from
Section titled “Inherited from”homedir
Section titled “homedir”
readonlyhomedir:string
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:89
User’s home directory path.
identity
Section titled “identity”
readonlyidentity:ExtensionIdentity
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:17
Coordinator-minted identity for the extension being created.
Inherited from
Section titled “Inherited from”machineId
Section titled “machineId”
readonlymachineId:string
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:31
Stable machine identifier used for machine-scoped persistence and encryption key derivation.
Resolved by the composition root (e.g., node-machine-id) before
extensions are started.
Inherited from
Section titled “Inherited from”makaioHome
Section titled “makaioHome”
readonlymakaioHome:string
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:91
Resolved .makaio directory root (e.g., ~/.makaio).
platform
Section titled “platform”
readonlyplatform:Platform
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:87
Current platform identifier (e.g., 'darwin', 'linux', 'win32').
signal
Section titled “signal”
readonlysignal:AbortSignal
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:65
Abort signal triggered during graceful shutdown.
Extensions can pass this to long-running operations (fetch, timers, streams) so they cancel promptly when the runtime is stopping.
Inherited from
Section titled “Inherited from”tryImport
Section titled “tryImport”
readonlytryImport: <T>(specifier) =>Promise<T|null>
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:58
Attempt a dynamic import, returning null when the package is not installed.
Only swallows errors caused by the package itself being absent. Transitive dependency failures and module evaluation errors are re-thrown.
Type Parameters
Section titled “Type Parameters”T
Expected module shape (caller-asserted, not runtime-verified).
Parameters
Section titled “Parameters”specifier
Section titled “specifier”string
Package specifier to import.
Returns
Section titled “Returns”Promise<T | null>
The imported module cast to T, or null when the package is not installed.
Inherited from
Section titled “Inherited from”username
Section titled “username”
readonlyusername:string
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:93
Current OS username.
Methods
Section titled “Methods”getService()
Section titled “getService()”getService<
T>(token):T|undefined
Defined in: ../../../packages/contracts/src/extension/extension-context.ts:48
Retrieve a service exposed by another active extension.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”Extension-owned token identifying the desired service.
Returns
Section titled “Returns”T | undefined
The active service instance, or undefined when unavailable.