Skip to main content
Version: latest (main)

Interface: AssemblyContext

Defined in: src/types/assembly-context.ts:4

Properties​

activeAdapters​

readonly activeAdapters: readonly string[]

Defined in: src/types/assembly-context.ts:43

Frameworks whose patch was applied and is reachable by the caller this run.

This is a statement about mechanism, not a guarantee of enforcement. What an applied patch buys differs per framework and per mode, so membership here is necessary but not sufficient for a policy DENY to block a call:

  • langgraph-js, mastra — lineage tagging only (NON_ENFORCING_MODULES, AAASM-4830). These earn no ADR 0033 §6 term of their own: the patch wraps the call in an AsyncLocalStorage binding of the agent id and nothing else — it emits no event, requests no decision, and runs no check. What it provides is attribution: any evidence produced by another layer during the call carries this agent's id. Judged on its own, an in-process LangGraph or Mastra tool call is §6 Unmeasured, and a DENY never blocks it in-process.
  • langchain-js — two layers with different powers (AAASM-4799). Only tools passed through langchain.tools and wrapped by wrapToolWithAssembly reach Denied before execution. The callback handler is audit-only and cannot block, and it does not reach Observed on any path this SDK ships: the napi-inprocess client hands what it records to the runtime's event channel, but a handoff is not a durable event attributed to the action (AAASM-5750). The default no-op client holds no transport and drops it.
  • vercel-ai-sdk, openai-agents — the governed tool factory is installed and the refusal precedes the effect, so these reach Denied before execution.

Independently of the above, an enforcing path only reaches Denied before execution in a check-capable run — napi-inprocess, or a caller-supplied gatewayClient. Otherwise check() is the allow-all no-op stub, which produces no control-plane decision record: the call is then not even Evaluated, it is §6 Unmeasured in-process. initAssembly warns on stderr when that applies.

All of the above is scoped to what this SDK does in-process. Per §6, Unmeasured here does not mean the activity was unobserved elsewhere — the proxy and eBPF layers are independent and may still see the same traffic.

A framework that was detected but whose patch failed, was inert, or was unreachable is not listed here (AAASM-5664) — see AssemblyContext.unpatchedAdapters.


auditSink?​

readonly optional auditSink?: AuditSinkDisposition

Defined in: src/types/assembly-context.ts:116

What the resolved gateway client does with hook-layer audit events — record / recordResult / scanPrompts (AAASM-5681).

"forwarded" means the resolved client hands those events to the runtime over the native event channel. It does not mean they were retained: the send is fire-and-forget and unacknowledged, so this SDK cannot report arrival and does not (AAASM-5750); AAASM-5783 is open on the downstream half and must land before any of this could support an Observed claim. "discarded" means the client holds no such channel — the no-op client auto resolves: governed actions are enforced but produce no audit evidence, so nothing on that path supports a claim of attributability or after-the-fact review. A matching stderr warning is emitted once at init for the second case only; this field is the programmatic counterpart, so which case a run is in is detectable in code rather than only by reading stderr — and without setting AA_DEBUG=1, which once was the only way to learn of it.

"caller-supplied" means the caller passed their own gatewayClient, so this SDK makes no claim either way. It is the absence of a claim, not an assurance that events are retained.

Optional only because AssemblyContext is part of this package's public export surface (exports["."].types), so a consumer can construct one in a test fixture or a custom integration; requiring the field would be a compile break for them, introduced by a diagnostic. initAssembly always populates it. The guarantee this ticket adds does not rest here — it rests on every shipped client declaring its disposition, which is enforced by tests/audit-sink-disposition.test.ts.


delegationReason?​

readonly optional delegationReason?: string

Defined in: src/types/assembly-context.ts:119


detectedAdapters​

readonly detectedAdapters: readonly string[]

Defined in: src/types/assembly-context.ts:62

Frameworks found installed in the environment, whether or not their patch was applied. Lets a caller distinguish "the framework is not installed" from "the framework is installed but this SDK is not attached to it" — an omission from AssemblyContext.activeAdapters alone cannot tell those apart.

This is not a superset of activeAdapters. A framework configured explicitly rather than auto-detected is active without being detected: today that is langchain-js only, which an explicit langchain config wires up even when @langchain/core does not resolve. The invariants that do hold are:

  • unpatchedAdapters === detectedAdapters \ activeAdapters
  • detectedAdapters === activeAdapters ∪ unpatchedAdapters minus any explicitly-configured id, which appears only in activeAdapters

So detected.filter(d => active.includes(d)) is not "the governed frameworks"; read activeAdapters directly for that.


enforcementMode?​

readonly optional enforcementMode?: EnforcementMode

Defined in: src/types/assembly-context.ts:122

Echo of the per-agent governance posture sent at registration, when set.


parentAgentId?​

readonly optional parentAgentId?: string

Defined in: src/types/assembly-context.ts:117


registered​

readonly registered: boolean

Defined in: src/types/assembly-context.ts:86

Whether this SDK actually registered the agent with the governance gateway during initAssembly. false means the agent will not appear in the dashboard / /api/v1/agents unless an external registrar (e.g. a sidecar) performs it out-of-band. It is false for the default grpc-sidecar mode, whose in-SDK registration is a no-op stub pending AAASM-4467, and for sdk-only mode (no network layer); a matching stderr warning is emitted at init time. Exposed so callers can detect the unregistered state programmatically rather than relying on the warning alone (AAASM-4468).


shutdown​

shutdown: () => Promise<void>

Defined in: src/types/assembly-context.ts:123

Returns​

Promise<void>


spawnedByTool?​

readonly optional spawnedByTool?: string

Defined in: src/types/assembly-context.ts:120


teamId?​

readonly optional teamId?: string

Defined in: src/types/assembly-context.ts:118


unpatchedAdapters​

readonly unpatchedAdapters: readonly string[]

Defined in: src/types/assembly-context.ts:75

Detected frameworks whose patch was not applied — it failed, was inert (the frozen-ESM Vercel shape, AAASM-4842), was skipped for a missing prerequisite such as agentId, or landed somewhere the caller cannot reach (@langchain/core installed with no langchain config, AAASM-5664). This SDK does not observe or govern these frameworks at all, so a non-empty value is the programmatic counterpart to the init-time stderr warning.

An empty value means nothing detected was left unattached. It is not an all-clear that everything active is enforcing — see activeAdapters for why membership there is not an enforcement guarantee.