@agent-assembly/sdk 0.0.1-beta.3 → 0.0.1-beta.4
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/dist/cjs/core/gateway-resolver.js +73 -3
- package/dist/cjs/core/init-assembly.js +151 -33
- package/dist/cjs/gateway/client.js +63 -1
- package/dist/cjs/gateway/index.js +2 -1
- package/dist/cjs/hooks/ai-sdk.js +3 -5
- package/dist/cjs/hooks/langchain.js +12 -3
- package/dist/cjs/hooks/mastra.js +10 -6
- package/dist/cjs/hooks/openai-agents.js +1 -3
- package/dist/cjs/native/client.js +70 -25
- package/dist/cjs/op-control.js +55 -1
- package/dist/cjs/runtime.js +73 -7
- package/dist/esm/core/gateway-resolver.js +72 -3
- package/dist/esm/core/gateway-resolver.js.map +1 -1
- package/dist/esm/core/init-assembly.js +150 -32
- package/dist/esm/core/init-assembly.js.map +1 -1
- package/dist/esm/gateway/client.js +62 -1
- package/dist/esm/gateway/client.js.map +1 -1
- package/dist/esm/gateway/index.js +1 -1
- package/dist/esm/gateway/index.js.map +1 -1
- package/dist/esm/hooks/ai-sdk.js +3 -5
- package/dist/esm/hooks/ai-sdk.js.map +1 -1
- package/dist/esm/hooks/langchain.js +12 -3
- package/dist/esm/hooks/langchain.js.map +1 -1
- package/dist/esm/hooks/mastra.js +10 -6
- package/dist/esm/hooks/mastra.js.map +1 -1
- package/dist/esm/hooks/openai-agents.js +1 -3
- package/dist/esm/hooks/openai-agents.js.map +1 -1
- package/dist/esm/native/client.js +68 -24
- package/dist/esm/native/client.js.map +1 -1
- package/dist/esm/op-control.js +53 -1
- package/dist/esm/op-control.js.map +1 -1
- package/dist/esm/runtime.js +72 -7
- package/dist/esm/runtime.js.map +1 -1
- package/dist/types/core/gateway-resolver.d.ts +18 -1
- package/dist/types/core/gateway-resolver.d.ts.map +1 -1
- package/dist/types/core/init-assembly.d.ts +2 -1
- package/dist/types/core/init-assembly.d.ts.map +1 -1
- package/dist/types/gateway/client.d.ts +17 -0
- package/dist/types/gateway/client.d.ts.map +1 -1
- package/dist/types/gateway/index.d.ts +1 -1
- package/dist/types/gateway/index.d.ts.map +1 -1
- package/dist/types/hooks/ai-sdk.d.ts.map +1 -1
- package/dist/types/hooks/langchain.d.ts +11 -0
- package/dist/types/hooks/langchain.d.ts.map +1 -1
- package/dist/types/hooks/mastra.d.ts.map +1 -1
- package/dist/types/hooks/openai-agents.d.ts.map +1 -1
- package/dist/types/native/client.d.ts +33 -0
- package/dist/types/native/client.d.ts.map +1 -1
- package/dist/types/op-control.d.ts +29 -2
- package/dist/types/op-control.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +27 -5
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/types/assembly-config.d.ts +6 -0
- package/dist/types/types/assembly-config.d.ts.map +1 -1
- package/native/aa-ffi-node/index.d.ts +74 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/native/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/native/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAaD;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAsBD,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,oBAAiB;CAC/B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,uBAAoB;CAClC;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,yBAAsB;CACpC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,qBAAkB;CAChC;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,uBAAoB;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,CAAC;IACjD,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IACxD;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACzD;AAmFD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CA6G7E"}
|
|
@@ -36,15 +36,42 @@ export interface OpControlSubscriberOptions {
|
|
|
36
36
|
orgId: string;
|
|
37
37
|
teamId: string;
|
|
38
38
|
agentId: string;
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
39
|
+
/** Explicit credentials override. When supplied it is used verbatim and the
|
|
40
|
+
* loopback / `allowInsecure` defaulting below is bypassed — the caller has
|
|
41
|
+
* taken full responsibility for the transport (e.g. `createSsl(...)` with a
|
|
42
|
+
* custom CA, or `createInsecure()` for an in-cluster sidecar).
|
|
41
43
|
*/
|
|
42
44
|
credentials?: ChannelCredentials;
|
|
45
|
+
/**
|
|
46
|
+
* Permit a plaintext (`createInsecure`) channel to a **non-loopback**
|
|
47
|
+
* gateway. Off by default: control-plane signals (pause / terminate) and the
|
|
48
|
+
* agent identity triple travel this stream, so an unencrypted channel to a
|
|
49
|
+
* remote host is opt-in only. Loopback targets stay plaintext without this
|
|
50
|
+
* flag (local dev-mode gateway). Ignored when `credentials` is set.
|
|
51
|
+
*/
|
|
52
|
+
allowInsecure?: boolean;
|
|
43
53
|
/** Test seam — when supplied, skips opening a real gRPC channel and uses
|
|
44
54
|
* this client directly. Used by the vitest tests.
|
|
45
55
|
*/
|
|
46
56
|
clientFactory?: () => OpControlClient;
|
|
47
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Extract the bare host from a gRPC target (`host:port`, a bare host, or a
|
|
60
|
+
* URL-style `scheme://host:port`). Returns the lowercased host with any
|
|
61
|
+
* surrounding IPv6 brackets preserved so it can be matched against
|
|
62
|
+
* {@link LOOPBACK_HOSTS}.
|
|
63
|
+
*/
|
|
64
|
+
export declare function gatewayHostOf(gatewayUrl: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Pick channel credentials for the op-control stream, secure by default.
|
|
67
|
+
*
|
|
68
|
+
* Precedence: an explicit `credentials` override wins; otherwise a loopback
|
|
69
|
+
* target gets plaintext (local dev gateway), a remote target gets TLS, and a
|
|
70
|
+
* remote target is only allowed plaintext when the caller sets `allowInsecure`.
|
|
71
|
+
*
|
|
72
|
+
* @throws never — returns the chosen {@link ChannelCredentials}.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveOpControlCredentials(gatewayUrl: string, opts: Pick<OpControlSubscriberOptions, "credentials" | "allowInsecure">): ChannelCredentials;
|
|
48
75
|
export declare class OpControlSubscriber {
|
|
49
76
|
private readonly client;
|
|
50
77
|
private readonly agent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"op-control.d.ts","sourceRoot":"","sources":["../../src/op-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAE1B,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAIjB,MAAM,6BAA6B,CAAC;AAUrC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,CACf,OAAO,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,KAC3B,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB
|
|
1
|
+
{"version":3,"file":"op-control.d.ts","sourceRoot":"","sources":["../../src/op-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAE1B,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAIjB,MAAM,6BAA6B,CAAC;AAUrC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,CACf,OAAO,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,KAC3B,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,mDAAmD;IACnD,KAAK,EA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KAAK,IAAI,IAAI;CAKrB"}
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ import { type ChildProcess } from "node:child_process";
|
|
|
11
11
|
export declare const BINARY_NAME = "aasm";
|
|
12
12
|
export declare const DEFAULT_PORT = 7878;
|
|
13
13
|
export declare const DEFAULT_RUNTIME_HOST = "127.0.0.1";
|
|
14
|
+
/**
|
|
15
|
+
* Opt-in gate for spawning the `aasm` sidecar. Auto-start runs a binary
|
|
16
|
+
* discovered from `$PATH` / the filesystem, so it is a privileged side effect
|
|
17
|
+
* that must be explicitly enabled rather than triggered silently by every
|
|
18
|
+
* `initAssembly()` call. Set to `1`/`true`/`yes` to permit auto-start.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ENV_AUTO_START = "AA_AUTO_START";
|
|
14
21
|
export declare const USER_LOCAL_BIN: string;
|
|
15
22
|
export declare const DOCKER_BASE_BIN = "/usr/local/bin";
|
|
16
23
|
export declare const RUNTIME_LOG_FILENAME = ".aasm-runtime.log";
|
|
@@ -32,6 +39,14 @@ export declare function findAasmBinary(): string | null;
|
|
|
32
39
|
* unreachable) resolves to `false` and is treated as no sidecar.
|
|
33
40
|
*/
|
|
34
41
|
export declare function isRunning(port?: number, host?: string): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Throw `Error` unless `binaryPath` is safe to spawn: it must be absolute and
|
|
44
|
+
* either resolve inside an allow-listed install dir (see
|
|
45
|
+
* {@link allowedInstallDirs}) or be the npm-bundled runtime binary. This is the
|
|
46
|
+
* integrity gate for the auto-start subprocess — without it the SDK would
|
|
47
|
+
* execute whatever `aasm` happened to be first on `$PATH`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function assertSafeBinaryPath(binaryPath: string): void;
|
|
35
50
|
/**
|
|
36
51
|
* Spawn `aasm serve --port <port>` as a detached background subprocess.
|
|
37
52
|
*
|
|
@@ -49,11 +64,18 @@ export declare function startRuntime(binaryPath: string, port?: number, logDir?:
|
|
|
49
64
|
* 2. Resolve the binary via {@link findAasmBinary}.
|
|
50
65
|
* 3. Spawn the sidecar via {@link startRuntime}.
|
|
51
66
|
*
|
|
52
|
-
* `
|
|
53
|
-
*
|
|
54
|
-
* `@agent-assembly/sdk` `initAssembly`
|
|
67
|
+
* `_agentId` is accepted to keep the ticket-specified signature stable but is
|
|
68
|
+
* intentionally not consumed at this lifecycle layer; actual register-and-connect
|
|
69
|
+
* is performed by the existing gateway-aware `@agent-assembly/sdk` `initAssembly`
|
|
70
|
+
* once the sidecar is reachable.
|
|
71
|
+
*
|
|
72
|
+
* Auto-start is **opt-in**: when the sidecar is not already running, this
|
|
73
|
+
* throws unless `AA_AUTO_START` is enabled. When it does spawn, the resolved
|
|
74
|
+
* binary path is logged and integrity-checked via {@link assertSafeBinaryPath}.
|
|
55
75
|
*
|
|
56
|
-
* Throws `Error` with {@link INSTALL_HINT} when no binary is found
|
|
76
|
+
* Throws `Error` with {@link INSTALL_HINT} when no binary is found, and a
|
|
77
|
+
* descriptive `Error` when auto-start is not opted in or the resolved binary
|
|
78
|
+
* fails the integrity check.
|
|
57
79
|
*/
|
|
58
|
-
export declare function initAssembly(
|
|
80
|
+
export declare function initAssembly(_agentId?: string, port?: number): Promise<void>;
|
|
59
81
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAQ9D,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,MAAyC,CAAC;AACvE,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAChD,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAExD,8EAA8E;AAC9E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AI,CAc7D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,MAAqB,EAC3B,MAAM,GAAE,MAAc,GACrB,YAAY,CASd;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,QAAQ,CAAC,EAAE,MAAM,EACjB,IAAI,GAAE,MAAqB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
|
@@ -25,6 +25,12 @@ export interface AssemblyConfig {
|
|
|
25
25
|
*/
|
|
26
26
|
apiKey?: string;
|
|
27
27
|
agentId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Human-readable agent name recorded by the gateway at registration
|
|
30
|
+
* (AAASM-3400). Descriptive metadata only; when omitted it falls back to
|
|
31
|
+
* ``agentId``.
|
|
32
|
+
*/
|
|
33
|
+
name?: string;
|
|
28
34
|
mode?: AssemblyMode;
|
|
29
35
|
gatewayClient?: GatewayClient;
|
|
30
36
|
langchain?: LangChainAdapterConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assembly-config.d.ts","sourceRoot":"","sources":["../../../src/types/assembly-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,YAAY,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AAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC"}
|
|
@@ -27,6 +27,80 @@ export declare function connect(socketPath: string): Promise<ClientHandle>
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function disconnect(handle: ClientHandle): Promise<void>
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* A policy verdict returned to JS.
|
|
32
|
+
*
|
|
33
|
+
* `decision` is one of `"allow"`, `"deny"`, `"pending"`, `"redact"`; `reason`
|
|
34
|
+
* is the human-readable explanation from the policy engine (or the fail-open
|
|
35
|
+
* note when the runtime did not answer).
|
|
36
|
+
*/
|
|
37
|
+
export interface PolicyDecision {
|
|
38
|
+
decision: string
|
|
39
|
+
reason: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Query the runtime for a policy decision on an action.
|
|
44
|
+
*
|
|
45
|
+
* The JS query object is translated into a `CheckActionRequest` (agent id,
|
|
46
|
+
* action type, and — for tool calls — tool name / source / args) and handed
|
|
47
|
+
* to [`AssemblyClient::query_policy`], which blocks its calling thread for up
|
|
48
|
+
* to 5s waiting on the runtime's `CheckActionResponse`. That blocking call is
|
|
49
|
+
* run on a `spawn_blocking` task — exactly like [`disconnect`] — so the napi
|
|
50
|
+
* async runtime stays free and the **Node event loop is never blocked** while
|
|
51
|
+
* a slow runtime is answering.
|
|
52
|
+
*
|
|
53
|
+
* **Fail-open:** the SDK is advisory, not a security boundary. When the
|
|
54
|
+
* runtime does not return a decision — it is too slow or the connection
|
|
55
|
+
* closed ([`SdkClientError::QueryFailed`]), or it was never reachable so the
|
|
56
|
+
* IPC channel is closed / the session is shut down — this returns a non-deny
|
|
57
|
+
* `"allow"` so a missing or degraded runtime never blocks the agent (the
|
|
58
|
+
* proxy / eBPF layers remain authoritative). Only a genuine local fault
|
|
59
|
+
* (a poisoned lock) surfaces as a typed error.
|
|
60
|
+
*/
|
|
61
|
+
export declare function queryPolicy(handle: ClientHandle, query: any): Promise<PolicyDecision>
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Register this agent with the governance gateway and store the issued
|
|
65
|
+
* credential token on the session.
|
|
66
|
+
*
|
|
67
|
+
* This is the **only** direct SDK→gateway gRPC call (per ADR 0004);
|
|
68
|
+
* `CheckAction` still flows through `aa-runtime`. The token the gateway issues
|
|
69
|
+
* is stored inside the shared [`AssemblyClient`] and then attached to every
|
|
70
|
+
* subsequent [`query_policy`] request so the gateway's
|
|
71
|
+
* `validate_credential_token` does not deny a registered agent.
|
|
72
|
+
*
|
|
73
|
+
* Delegates to [`AssemblyClient::register`], an async tonic call, so this napi
|
|
74
|
+
* function is itself `async` and awaits it without blocking the Node event
|
|
75
|
+
* loop. Returns the assigned policy id reported by the gateway. A failed
|
|
76
|
+
* registration — gateway unreachable, identity rejected — surfaces as a typed
|
|
77
|
+
* error so the caller can decide whether to proceed unregistered.
|
|
78
|
+
*/
|
|
79
|
+
export declare function register(handle: ClientHandle, options: RegisterOptions): Promise<string>
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Parameters for [`register`].
|
|
83
|
+
*
|
|
84
|
+
* `agentId` is the agent identity the gateway registers (derived into a
|
|
85
|
+
* `did:key` + Ed25519 public key by the shared client). `name` and `framework`
|
|
86
|
+
* are descriptive metadata the gateway records. `gatewayEndpoint` overrides the
|
|
87
|
+
* gateway gRPC endpoint (default resolved from `AA_GATEWAY_ENDPOINT` or
|
|
88
|
+
* `http://127.0.0.1:50051`).
|
|
89
|
+
*
|
|
90
|
+
* `teamId` and `parentAgentId` carry the agent's lineage/team scoping to the
|
|
91
|
+
* gateway on register (AAASM-3415): `teamId` drives team-budget attribution
|
|
92
|
+
* and `parentAgentId` the topology graph. Both are optional — omit for a
|
|
93
|
+
* team-unscoped / root agent.
|
|
94
|
+
*/
|
|
95
|
+
export interface RegisterOptions {
|
|
96
|
+
agentId: string
|
|
97
|
+
name: string
|
|
98
|
+
framework: string
|
|
99
|
+
gatewayEndpoint?: string
|
|
100
|
+
teamId?: string
|
|
101
|
+
parentAgentId?: string
|
|
102
|
+
}
|
|
103
|
+
|
|
30
104
|
/**
|
|
31
105
|
* Ship a captured event to the runtime.
|
|
32
106
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-assembly/sdk",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.4",
|
|
4
4
|
"description": "TypeScript SDK for Agent Assembly",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"nodejs"
|
|
65
65
|
],
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@agent-assembly/runtime-darwin-arm64": "0.0.1-beta.
|
|
68
|
-
"@agent-assembly/runtime-darwin-x64": "0.0.1-beta.
|
|
69
|
-
"@agent-assembly/runtime-linux-arm64": "0.0.1-beta.
|
|
70
|
-
"@agent-assembly/runtime-linux-x64": "0.0.1-beta.
|
|
67
|
+
"@agent-assembly/runtime-darwin-arm64": "0.0.1-beta.4",
|
|
68
|
+
"@agent-assembly/runtime-darwin-x64": "0.0.1-beta.4",
|
|
69
|
+
"@agent-assembly/runtime-linux-arm64": "0.0.1-beta.4",
|
|
70
|
+
"@agent-assembly/runtime-linux-x64": "0.0.1-beta.4"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"dist/",
|