@agent-assembly/sdk 0.0.1-alpha.8 → 0.0.1-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,6 +3,9 @@
3
3
  [![CI](https://github.com/ai-agent-assembly/node-sdk/actions/workflows/test-matrix.yml/badge.svg?branch=master&logo=githubactions)](https://github.com/ai-agent-assembly/node-sdk/actions/workflows/test-matrix.yml)
4
4
  [![Docs](https://github.com/ai-agent-assembly/node-sdk/actions/workflows/publish-docs.yml/badge.svg?branch=master&logo=githubactions)](https://github.com/ai-agent-assembly/node-sdk/actions/workflows/publish-docs.yml)
5
5
  [![npm version](https://img.shields.io/npm/v/@agent-assembly/sdk/alpha?logo=npm)](https://www.npmjs.com/package/@agent-assembly/sdk/v/alpha)
6
+ [![TypeScript types](https://img.shields.io/npm/types/@agent-assembly/sdk?logo=typescript)](https://www.npmjs.com/package/@agent-assembly/sdk)
7
+ [![Bundle size](https://img.shields.io/bundlephobia/min/@agent-assembly/sdk?logo=webpack&label=min)](https://bundlephobia.com/package/@agent-assembly/sdk)
8
+ [![Downloads](https://img.shields.io/npm/dm/@agent-assembly/sdk?logo=npm&label=downloads%2Fmo)](https://www.npmjs.com/package/@agent-assembly/sdk)
6
9
  [![Coverage](https://img.shields.io/codecov/c/github/ai-agent-assembly/node-sdk?logo=codecov)](https://codecov.io/gh/ai-agent-assembly/node-sdk)
7
10
  [![Quality Gate](https://img.shields.io/sonar/quality_gate/AI-agent-assembly_node-sdk?server=https%3A%2F%2Fsonarcloud.io&logo=sonarcloud)](https://sonarcloud.io/summary/new_code?id=AI-agent-assembly_node-sdk)
8
11
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue?logo=apache)](./LICENSE)
@@ -21,8 +24,9 @@ TypeScript/Node.js SDK for Agent Assembly, licensed under Apache 2.0.
21
24
  > Production deployments should track the first `0.1.0` release.
22
25
 
23
26
  ```bash
24
- pnpm add @agent-assembly/sdk@alpha # latest alpha
25
- pnpm add @agent-assembly/sdk@0.0.1-alpha.3 # pin exact
27
+ pnpm add @agent-assembly/sdk@alpha # latest alpha (tracks @alpha dist-tag)
28
+ pnpm add @agent-assembly/sdk@<X.Y.Z-alpha.N> # pin exact — replace the placeholder with the
29
+ # desired version from npmjs.com/package/@agent-assembly/sdk
26
30
  ```
27
31
 
28
32
  ## Prerequisites
@@ -134,14 +138,51 @@ call is checked against policy before it runs.
134
138
  | ------ | ------- |
135
139
  | `initAssembly(config)` | Set up governance and auto-wire detected frameworks. The main entrypoint. |
136
140
  | `withAssembly(tools, options)` | Lower-level wrapper to govern a tool map when you manage the gateway client yourself. |
141
+ | `createNoopGatewayClient(mode)` | Build an allow-all `GatewayClient` for offline demos and tests, or as a base to wrap. |
142
+ | `PolicyViolationError` | Thrown by a governed tool when the gateway client denies the call. |
137
143
  | `currentAgentId()`, `runWithAgentId()` | Read and set the active agent id in the async-context lineage store. |
138
144
  | `encodeAuditEvent()` / `decodeAuditEvent()` (and the call-stack codecs) | Encode and decode audit events to and from their wire shape. |
139
145
  | `findAasmBinary()`, `INSTALL_HINT` | Locate the bundled `aasm` runtime binary and the install hint shown when it is missing. |
140
146
  | `ENFORCEMENT_MODES` | The allowed `enforcementMode` values. |
141
147
 
142
148
  Type-only exports (`AssemblyConfig`, `AssemblyContext`, `AssemblyMode`, `EnforcementMode`,
143
- `ToolMap`, and friends) are documented in the
144
- [API reference](https://ai-agent-assembly.github.io/node-sdk/api-reference).
149
+ `ToolMap`, `GatewayClient`, the `Gateway*` governance types, and friends) are documented in
150
+ the [API reference](https://ai-agent-assembly.github.io/node-sdk/api-reference).
151
+
152
+ ## Governing tools offline
153
+
154
+ `withAssembly(tools, options)` needs a `GatewayClient`. For offline demos, tests, or custom
155
+ in-process policies you can build one yourself — no running gateway required:
156
+
157
+ ```ts
158
+ import {
159
+ createNoopGatewayClient,
160
+ withAssembly,
161
+ type GatewayClient
162
+ } from "@agent-assembly/sdk";
163
+
164
+ // Allow-all client — handy for offline smoke tests:
165
+ withAssembly(
166
+ { search: { description: "Search", execute: async (q: string) => `result:${q}` } },
167
+ { gatewayClient: createNoopGatewayClient("sdk-only") }
168
+ );
169
+
170
+ // Or enforce your own in-process policy by implementing the GatewayClient interface:
171
+ const policyClient: GatewayClient = {
172
+ mode: "sdk-only",
173
+ start: async () => undefined,
174
+ close: async () => undefined,
175
+ check: async (request) =>
176
+ request.toolName === "delete_file"
177
+ ? { denied: true, reason: "blocked by local policy" }
178
+ : { denied: false },
179
+ waitForApproval: async () => ({ denied: false }),
180
+ record: async () => undefined,
181
+ recordResult: async () => undefined,
182
+ scanPrompts: async () => undefined
183
+ };
184
+ // A governed tool throws `PolicyViolationError` when `check` denies it.
185
+ ```
145
186
 
146
187
  ## How LangChain tools are blocked
147
188
 
@@ -248,6 +289,7 @@ across all SDKs.
248
289
  | [Documentation site](https://ai-agent-assembly.github.io/agent-assembly-docs/) | Canonical, cross-repo documentation for the whole platform. |
249
290
  | [python-sdk](https://github.com/ai-agent-assembly/python-sdk) | Sibling SDK for Python. |
250
291
  | [go-sdk](https://github.com/ai-agent-assembly/go-sdk) | Sibling SDK for Go. |
292
+ | [agent-assembly-examples](https://github.com/ai-agent-assembly/agent-assembly-examples) | Runnable examples — learn by running small, framework-specific Node.js/TypeScript (and Python/Go) samples for policy enforcement, approvals, audit, trace, and runtime workflows. |
251
293
  | [Release notes](https://github.com/ai-agent-assembly/node-sdk/releases) | Per-version changelog for this package. |
252
294
  | [Organization profile](https://github.com/ai-agent-assembly) | Index of every Agent Assembly repository and its status. |
253
295
 
package/dist/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findAasmBinary = exports.INSTALL_HINT = exports.runWithAgentId = exports.currentAgentId = exports.encodeCallStackNode = exports.encodeAuditEvent = exports.decodeCallStackNode = exports.decodeAuditEvent = exports.ENFORCEMENT_MODES = exports.withAssembly = exports.initAssembly = void 0;
3
+ exports.PolicyViolationError = exports.createNoopGatewayClient = exports.findAasmBinary = exports.INSTALL_HINT = exports.runWithAgentId = exports.currentAgentId = exports.encodeCallStackNode = exports.encodeAuditEvent = exports.decodeCallStackNode = exports.decodeAuditEvent = exports.ENFORCEMENT_MODES = exports.withAssembly = exports.initAssembly = void 0;
4
4
  var init_assembly_js_1 = require("./core/init-assembly.js");
5
5
  Object.defineProperty(exports, "initAssembly", { enumerable: true, get: function () { return init_assembly_js_1.initAssembly; } });
6
6
  var index_js_1 = require("./wrappers/index.js");
@@ -23,3 +23,7 @@ Object.defineProperty(exports, "runWithAgentId", { enumerable: true, get: functi
23
23
  var runtime_js_1 = require("./runtime.js");
24
24
  Object.defineProperty(exports, "INSTALL_HINT", { enumerable: true, get: function () { return runtime_js_1.INSTALL_HINT; } });
25
25
  Object.defineProperty(exports, "findAasmBinary", { enumerable: true, get: function () { return runtime_js_1.findAasmBinary; } });
26
+ var index_js_5 = require("./gateway/index.js");
27
+ Object.defineProperty(exports, "createNoopGatewayClient", { enumerable: true, get: function () { return index_js_5.createNoopGatewayClient; } });
28
+ var index_js_6 = require("./errors/index.js");
29
+ Object.defineProperty(exports, "PolicyViolationError", { enumerable: true, get: function () { return index_js_6.PolicyViolationError; } });
package/dist/esm/index.js CHANGED
@@ -9,4 +9,6 @@ export { currentAgentId, runWithAgentId } from "./lineage/index.js";
9
9
  // `@agent-assembly/sdk/runtime` subpath export to avoid colliding with
10
10
  // the gateway-based `initAssembly` re-exported above.
11
11
  export { INSTALL_HINT, findAasmBinary } from "./runtime.js";
12
+ export { createNoopGatewayClient } from "./gateway/index.js";
13
+ export { PolicyViolationError } from "./errors/index.js";
12
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAYnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpE,uEAAuE;AACvE,wEAAwE;AACxE,mEAAmE;AACnE,uEAAuE;AACvE,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAYnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpE,uEAAuE;AACvE,wEAAwE;AACxE,mEAAmE;AACnE,uEAAuE;AACvE,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAU5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -7,4 +7,8 @@ export { decodeAuditEvent, decodeCallStackNode, encodeAuditEvent, encodeCallStac
7
7
  export type { WireAuditEvent, WireCallStackNode } from "./audit/index.js";
8
8
  export { currentAgentId, runWithAgentId } from "./lineage/index.js";
9
9
  export { INSTALL_HINT, findAasmBinary } from "./runtime.js";
10
+ export type { GatewayClient } from "./gateway/index.js";
11
+ export type { GatewayApprovalResult, GatewayCheckRequest, GatewayDecision, GatewayPromptScan, GatewayRecordEvent, GatewayResultRecord } from "./types/index.js";
12
+ export { createNoopGatewayClient } from "./gateway/index.js";
13
+ export { PolicyViolationError } from "./errors/index.js";
10
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,OAAO,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMpE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,OAAO,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMpE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-assembly/sdk",
3
- "version": "0.0.1-alpha.8",
3
+ "version": "0.0.1-alpha.9",
4
4
  "description": "TypeScript SDK for Agent Assembly",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -59,10 +59,10 @@
59
59
  "nodejs"
60
60
  ],
61
61
  "optionalDependencies": {
62
- "@agent-assembly/runtime-darwin-arm64": "0.0.1-alpha.8",
63
- "@agent-assembly/runtime-darwin-x64": "0.0.1-alpha.8",
64
- "@agent-assembly/runtime-linux-arm64": "0.0.1-alpha.8",
65
- "@agent-assembly/runtime-linux-x64": "0.0.1-alpha.8"
62
+ "@agent-assembly/runtime-darwin-arm64": "0.0.1-alpha.9",
63
+ "@agent-assembly/runtime-darwin-x64": "0.0.1-alpha.9",
64
+ "@agent-assembly/runtime-linux-arm64": "0.0.1-alpha.9",
65
+ "@agent-assembly/runtime-linux-x64": "0.0.1-alpha.9"
66
66
  },
67
67
  "files": [
68
68
  "dist/",