@agent-assembly/sdk 0.0.1-beta.3 → 0.0.1-beta.5
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 +36 -23
- package/dist/cjs/core/gateway-resolver.js +73 -3
- package/dist/cjs/core/init-assembly.js +155 -33
- package/dist/cjs/core/redact.js +63 -0
- package/dist/cjs/gateway/client.js +63 -1
- package/dist/cjs/gateway/index.js +2 -1
- package/dist/cjs/hooks/ai-sdk.js +46 -10
- 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/index.js +9 -1
- package/dist/cjs/native/client.js +94 -25
- package/dist/cjs/op-control.js +159 -17
- package/dist/cjs/runtime.js +73 -7
- package/dist/cjs/wrappers/with-assembly.js +89 -32
- 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 +154 -32
- package/dist/esm/core/init-assembly.js.map +1 -1
- package/dist/esm/core/redact.js +59 -0
- package/dist/esm/core/redact.js.map +1 -0
- 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 +46 -10
- 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/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/native/client.js +91 -24
- package/dist/esm/native/client.js.map +1 -1
- package/dist/esm/op-control.js +124 -17
- 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/esm/wrappers/with-assembly.js +89 -32
- package/dist/esm/wrappers/with-assembly.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/core/redact.d.ts +28 -0
- package/dist/types/core/redact.d.ts.map +1 -0
- 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 +13 -0
- 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/index.d.ts +4 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/native/client.d.ts +44 -0
- package/dist/types/native/client.d.ts.map +1 -1
- package/dist/types/op-control.d.ts +71 -7
- 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/dist/types/wrappers/index.d.ts +1 -1
- package/dist/types/wrappers/index.d.ts.map +1 -1
- package/dist/types/wrappers/with-assembly.d.ts +25 -0
- package/dist/types/wrappers/with-assembly.d.ts.map +1 -1
- package/native/aa-ffi-node/index.d.ts +82 -1
- package/package.json +18 -5
package/dist/esm/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;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K,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;QACjE,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;KAC1B,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAiB,EACjB,OAAe,YAAY;IAE3B,IAAI,MAAM,SAAS,CAAC,IAAI,CAAC;QAAE,OAAO;IAClC,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,mCAAmC,IAAI,+BAA+B;YACpE,oCAAoC,IAAI,aAAa,cAAc,KAAK;YACxE,oCAAoC,CACvC,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;IACD,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,oDAAoD,MAAM,EAAE,CAAC,CAAC;IAC3E,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { OpTerminatedError } from "../errors/op-terminated-error.js";
|
|
2
3
|
import { PolicyViolationError } from "../errors/policy-violation-error.js";
|
|
3
4
|
const DEFAULT_APPROVAL_TIMEOUT_MS = 30_000;
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the op id (`"{traceId}:{spanId}"`) for a wrapped tool call.
|
|
7
|
+
*
|
|
8
|
+
* Prefers an explicit `opId` on the call's first argument; otherwise composes
|
|
9
|
+
* it from `traceId` / `spanId` when an adapter threads them through. Returns
|
|
10
|
+
* `undefined` when no trace identity is present — the call is not part of a
|
|
11
|
+
* tracked op, so there is nothing for the kill switch to address and op control
|
|
12
|
+
* is skipped. Mirrors the Python companion's `_extract_op_id`.
|
|
13
|
+
*/
|
|
14
|
+
function extractOpId(args) {
|
|
15
|
+
const first = args[0];
|
|
16
|
+
if (typeof first !== "object" || first === null) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const fields = first;
|
|
20
|
+
const opId = fields.opId;
|
|
21
|
+
if (typeof opId === "string" && opId.length > 0) {
|
|
22
|
+
return opId;
|
|
23
|
+
}
|
|
24
|
+
const traceId = fields.traceId;
|
|
25
|
+
if (typeof traceId === "string" && traceId.length > 0) {
|
|
26
|
+
const spanId = fields.spanId;
|
|
27
|
+
const span = typeof spanId === "string" ? spanId : "";
|
|
28
|
+
return `${traceId}:${span}`;
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Consult the live op-control kill switch before the gateway is queried.
|
|
34
|
+
*
|
|
35
|
+
* A terminated op throws {@link PolicyViolationError} so the tool is blocked
|
|
36
|
+
* (and the gateway is never reached — the kill switch short-circuits). A paused
|
|
37
|
+
* op blocks here in `waitForOp` until the gateway resumes (or terminates) it.
|
|
38
|
+
* A no-op when no subscriber is wired or the call carries no `opId`.
|
|
39
|
+
*
|
|
40
|
+
* @throws {PolicyViolationError} when the op has been terminated by the gateway.
|
|
41
|
+
*/
|
|
42
|
+
async function enforceOpControl(opControl, name, args) {
|
|
43
|
+
if (!opControl) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const opId = extractOpId(args);
|
|
47
|
+
if (!opId) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
await opControl.waitForOp(opId);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (error instanceof OpTerminatedError) {
|
|
55
|
+
throw new PolicyViolationError(`Tool '${name}' terminated: ${error.message}`);
|
|
56
|
+
}
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
4
60
|
async function waitForApprovalWithTimeout(gateway, toolName, runId, timeoutMs) {
|
|
5
61
|
let timeoutId;
|
|
6
62
|
const timeoutPromise = new Promise((resolve) => {
|
|
@@ -24,49 +80,50 @@ function hasExecute(tool) {
|
|
|
24
80
|
function hasInvoke(tool) {
|
|
25
81
|
return typeof tool.invoke === "function";
|
|
26
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Run the full pre-execution governance chain for one wrapped tool call.
|
|
85
|
+
*
|
|
86
|
+
* Order is load-bearing: the live op-control kill switch (AAASM-3491) runs
|
|
87
|
+
* first so an operator terminate short-circuits *before* the gateway is queried
|
|
88
|
+
* and a pause blocks here until resume; only then does the pre-exec gateway
|
|
89
|
+
* check + approval flow run.
|
|
90
|
+
*
|
|
91
|
+
* @throws {PolicyViolationError} when the op is terminated, the gateway denies,
|
|
92
|
+
* or an approval is rejected / times out.
|
|
93
|
+
*/
|
|
94
|
+
async function enforceGovernance(name, args, gateway, opControl, approvalTimeoutMs) {
|
|
95
|
+
await enforceOpControl(opControl, name, args);
|
|
96
|
+
const runId = `run_${randomUUID()}`;
|
|
97
|
+
const decision = await gateway.check({
|
|
98
|
+
action: "tool_call",
|
|
99
|
+
toolName: name,
|
|
100
|
+
args,
|
|
101
|
+
runId
|
|
102
|
+
});
|
|
103
|
+
if (decision.denied) {
|
|
104
|
+
throw new PolicyViolationError(`Tool '${name}' blocked: ${decision.reason ?? "Denied"}`);
|
|
105
|
+
}
|
|
106
|
+
if (decision.pending) {
|
|
107
|
+
const finalDecision = await waitForApprovalWithTimeout(gateway, name, runId, approvalTimeoutMs);
|
|
108
|
+
if (finalDecision.denied) {
|
|
109
|
+
throw new PolicyViolationError(`Approval rejected for '${name}': ${finalDecision.reason ?? "Rejected"}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
27
113
|
function wrapSingleTool(name, tool, gateway, options) {
|
|
28
114
|
const approvalTimeoutMs = options.approvalTimeoutMs ?? DEFAULT_APPROVAL_TIMEOUT_MS;
|
|
115
|
+
const opControl = options.opControl;
|
|
29
116
|
if (hasExecute(tool)) {
|
|
30
117
|
const originalExecute = tool.execute;
|
|
31
118
|
tool.execute = async (...args) => {
|
|
32
|
-
|
|
33
|
-
const decision = await gateway.check({
|
|
34
|
-
action: "tool_call",
|
|
35
|
-
toolName: name,
|
|
36
|
-
args,
|
|
37
|
-
runId
|
|
38
|
-
});
|
|
39
|
-
if (decision.denied) {
|
|
40
|
-
throw new PolicyViolationError(`Tool '${name}' blocked: ${decision.reason ?? "Denied"}`);
|
|
41
|
-
}
|
|
42
|
-
if (decision.pending) {
|
|
43
|
-
const finalDecision = await waitForApprovalWithTimeout(gateway, name, runId, approvalTimeoutMs);
|
|
44
|
-
if (finalDecision.denied) {
|
|
45
|
-
throw new PolicyViolationError(`Approval rejected for '${name}': ${finalDecision.reason ?? "Rejected"}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
119
|
+
await enforceGovernance(name, args, gateway, opControl, approvalTimeoutMs);
|
|
48
120
|
return originalExecute(...args);
|
|
49
121
|
};
|
|
50
122
|
}
|
|
51
123
|
else if (hasInvoke(tool)) {
|
|
52
124
|
const originalInvoke = tool.invoke;
|
|
53
125
|
tool.invoke = async (...args) => {
|
|
54
|
-
|
|
55
|
-
const decision = await gateway.check({
|
|
56
|
-
action: "tool_call",
|
|
57
|
-
toolName: name,
|
|
58
|
-
args,
|
|
59
|
-
runId
|
|
60
|
-
});
|
|
61
|
-
if (decision.denied) {
|
|
62
|
-
throw new PolicyViolationError(`Tool '${name}' blocked: ${decision.reason ?? "Denied"}`);
|
|
63
|
-
}
|
|
64
|
-
if (decision.pending) {
|
|
65
|
-
const finalDecision = await waitForApprovalWithTimeout(gateway, name, runId, approvalTimeoutMs);
|
|
66
|
-
if (finalDecision.denied) {
|
|
67
|
-
throw new PolicyViolationError(`Approval rejected for '${name}': ${finalDecision.reason ?? "Rejected"}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
126
|
+
await enforceGovernance(name, args, gateway, opControl, approvalTimeoutMs);
|
|
70
127
|
return originalInvoke(...args);
|
|
71
128
|
};
|
|
72
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-assembly.js","sourceRoot":"","sources":["../../../src/wrappers/with-assembly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"with-assembly.js","sourceRoot":"","sources":["../../../src/wrappers/with-assembly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAkC3E,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAE3C;;;;;;;;GAQG;AACH,SAAS,WAAW,CAAC,IAAe;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CA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C;IACxF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* as deprecated aliases (a one-time warning is logged when a legacy name
|
|
15
15
|
* supplies the value)
|
|
16
16
|
* 3. Config file (~/.aasm/config.yaml, optional js-yaml soft dep)
|
|
17
|
-
* 4. Local default: probe http://localhost:7391, auto-start
|
|
17
|
+
* 4. Local default: probe http://localhost:7391; when absent, auto-start the
|
|
18
|
+
* local `aasm` gateway ONLY if `AA_AUTO_START` is opted in and the binary
|
|
19
|
+
* resolves to an allow-listed install dir — otherwise raise an error.
|
|
18
20
|
*/
|
|
19
21
|
export declare const DEFAULT_GATEWAY_URL = "http://localhost:7391";
|
|
20
22
|
export declare const DEFAULT_HEALTHZ_PATH = "/healthz";
|
|
@@ -23,6 +25,21 @@ export declare const DEFAULT_AUTO_START_TIMEOUT_MS = 5000;
|
|
|
23
25
|
export declare const DEFAULT_CONFIG_FILE_PATH = "~/.aasm/config.yaml";
|
|
24
26
|
export declare const ENV_GATEWAY_URL = "AA_GATEWAY_URL";
|
|
25
27
|
export declare const ENV_API_KEY = "AA_API_KEY";
|
|
28
|
+
/**
|
|
29
|
+
* Opt-in gate for auto-starting a local gateway. Auto-start spawns the `aasm`
|
|
30
|
+
* binary resolved from `$PATH`, so it is gated behind an explicit opt-in rather
|
|
31
|
+
* than running silently: a `$PATH` entry an attacker can write to would
|
|
32
|
+
* otherwise be executed by any process that calls `initAssembly()`. Set to
|
|
33
|
+
* `1`/`true`/`yes` to permit auto-start.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ENV_AUTO_START = "AA_AUTO_START";
|
|
36
|
+
/**
|
|
37
|
+
* Throw {@link ConfigurationError} unless `aasmPath` is an absolute path inside
|
|
38
|
+
* an allow-listed install directory (see {@link allowedInstallDirs}). This is
|
|
39
|
+
* the integrity gate for the auto-start subprocess — without it the SDK would
|
|
40
|
+
* execute whatever `aasm` happened to be first on `$PATH`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function assertAllowedAasmPath(aasmPath: string): void;
|
|
26
43
|
/**
|
|
27
44
|
* Deprecated environment-variable names, kept as backwards-compatible aliases.
|
|
28
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/gateway-resolver.ts"],"names":[],"mappings":"AAOA
|
|
1
|
+
{"version":3,"file":"gateway-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/gateway-resolver.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAC3D,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAClD,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAChD,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,kBAAkB,CAAC;AA2B9C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAgB5D;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAC1D,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAoClD,eAAO,MAAM,oBAAoB,uDAAwD,CAAC;AAE1F;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAiC,GAC3C,OAAO,CAAC,OAAO,CAAC,CAgBlB;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAsC,EACjD,cAAc,GAAE,MAAY,GAC3B,OAAO,CAAC,OAAO,CAAC,CASlB;AAUD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,UAAU,GAAE,MAAiC,GAC5C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAwBlC;AAED,iBAAS,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAY9C;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAMhD;AAeD,eAAO,MAAM,SAAS;;;;;;;;kCAEQ,IAAI;CAGjC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,MAA4B,EACrC,SAAS,GAAE,MAAsC,GAChD,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8B1E;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CActE"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Adapter } from "../adapters/adapter.js";
|
|
2
2
|
import { type GatewayClient } from "../gateway/client.js";
|
|
3
|
+
import { type NativeClient } from "../native/client.js";
|
|
3
4
|
import type { AssemblyConfig } from "../types/assembly-config.js";
|
|
4
5
|
import type { AssemblyContext } from "../types/assembly-context.js";
|
|
5
6
|
/** Env-var fallback for ``gatewayUrl`` read at ``initAssembly`` entry. */
|
|
6
7
|
export declare const ENV_GATEWAY_URL = "AA_GATEWAY_URL";
|
|
7
8
|
/** Env-var fallback for ``controlPlaneUrl`` read at ``initAssembly`` entry. */
|
|
8
9
|
export declare const ENV_CONTROL_PLANE_URL = "AA_CONTROL_PLANE_URL";
|
|
9
|
-
export declare function createClient(config: AssemblyConfig): GatewayClient;
|
|
10
|
+
export declare function createClient(config: AssemblyConfig, nativeClientOverride?: NativeClient): GatewayClient;
|
|
10
11
|
export declare function detectFrameworks(): string[];
|
|
11
12
|
export declare function registerAdapters(frameworks: readonly string[]): Promise<Adapter[]>;
|
|
12
13
|
export declare function startNetworkLayerIfNeeded(client: GatewayClient, config: AssemblyConfig): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-assembly.d.ts","sourceRoot":"","sources":["../../../src/core/init-assembly.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD,OAAO,
|
|
1
|
+
{"version":3,"file":"init-assembly.d.ts","sourceRoot":"","sources":["../../../src/core/init-assembly.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAqBpE,0EAA0E;AAC1E,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAChD,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,yBAAyB,CAAC;AAiD5D,wBAAgB,YAAY,CAC1B,MAAM,EAAE,cAAc,EACtB,oBAAoB,CAAC,EAAE,YAAY,GAClC,aAAa,CA+Cf;AAWD,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAoB3C;AASD,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAMxF;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAMf;AAsLD,wBAAsB,YAAY,CAAC,MAAM,GAAE,cAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAqFxF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret-redaction helpers for diagnostic / log output (AAASM-3645).
|
|
3
|
+
*
|
|
4
|
+
* The resolved `apiKey` and the proto `credentialToken` must never reach
|
|
5
|
+
* `console.*` or an accidental `JSON.stringify` dump. These helpers give the
|
|
6
|
+
* SDK a single, audited way to render config/diagnostics for logging with the
|
|
7
|
+
* credential fields stripped.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: the generated `CheckActionRequest.toJSON()` (src/proto/generated) is
|
|
10
|
+
* wire-only — it serializes `credentialToken` for transport and must never be
|
|
11
|
+
* passed to a logger. Use {@link redactSecrets} on any object you intend to log.
|
|
12
|
+
*/
|
|
13
|
+
/** Placeholder substituted for any redacted credential value. */
|
|
14
|
+
export declare const REDACTED = "<redacted>";
|
|
15
|
+
/**
|
|
16
|
+
* Return a deep copy of `value` with every credential-bearing field replaced by
|
|
17
|
+
* {@link REDACTED}, safe to pass to `console.*` / `JSON.stringify`. Matching is
|
|
18
|
+
* case-insensitive on the key name. Non-object inputs are returned unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export declare function redactSecrets(value: unknown): unknown;
|
|
21
|
+
/**
|
|
22
|
+
* Render an unknown error for a log message with any `Bearer <token>` / API-key
|
|
23
|
+
* substring scrubbed. Defends the registration-failure warning path: a wrapped
|
|
24
|
+
* transport error could in principle carry an auth header in its message, so we
|
|
25
|
+
* strip the bearer credential before it reaches `console.*` (AAASM-3645).
|
|
26
|
+
*/
|
|
27
|
+
export declare function redactErrorMessage(error: unknown): string;
|
|
28
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../../src/core/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgBH,iEAAiE;AACjE,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAYrD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMzD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GatewayApprovalResult, GatewayCheckRequest, GatewayDecision, GatewayPromptScan, GatewayRecordEvent, GatewayResultRecord } from "../types/gateway-governance.js";
|
|
2
2
|
import type { AssemblyMode } from "../types/assembly-mode.js";
|
|
3
|
+
import type { NativeClient } from "../native/client.js";
|
|
3
4
|
export interface GatewayClient {
|
|
4
5
|
readonly mode: AssemblyMode;
|
|
5
6
|
/**
|
|
@@ -17,4 +18,20 @@ export interface GatewayClient {
|
|
|
17
18
|
scanPrompts: (scan: GatewayPromptScan) => Promise<void>;
|
|
18
19
|
}
|
|
19
20
|
export declare function createNoopGatewayClient(mode: AssemblyMode, httpBaseUrl?: string): GatewayClient;
|
|
21
|
+
/**
|
|
22
|
+
* Gateway client backed by the in-process native runtime (AAASM-3050).
|
|
23
|
+
*
|
|
24
|
+
* `check()` asks a reachable `aa-runtime` for an authoritative verdict via the
|
|
25
|
+
* native `queryPolicy` primitive and maps it onto a `GatewayDecision`:
|
|
26
|
+
* - `deny` → `{ denied: true }` (the wrapper throws `PolicyViolationError`)
|
|
27
|
+
* - `pending` → `{ pending: true }` (routes to the approval path)
|
|
28
|
+
* - allow / redact / unspecified → `{ denied: false }`
|
|
29
|
+
*
|
|
30
|
+
* **Fail-open (security-critical):** the SDK is advisory, not a security
|
|
31
|
+
* boundary. The native primitive already returns `allow` when the runtime is
|
|
32
|
+
* unreachable or too slow; on top of that, any local fault while querying is
|
|
33
|
+
* swallowed here and resolves neutral, so a missing or degraded runtime never
|
|
34
|
+
* blocks the agent. The proxy / eBPF layers remain authoritative.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createNativeGatewayClient(mode: AssemblyMode, nativeClient: NativeClient, agentId?: string, httpBaseUrl?: string): GatewayClient;
|
|
20
37
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/gateway/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/gateway/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAClE,eAAe,EAAE,CACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC,MAAM,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,YAAY,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,WAAW,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa,CAY/F;AAwBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GACnB,aAAa,CA0Bf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gateway/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gateway/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACjF,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -6,7 +6,20 @@ export interface VercelAiSdkModule {
|
|
|
6
6
|
export interface VercelAiSdkPatchState {
|
|
7
7
|
isPatched: boolean;
|
|
8
8
|
originalToolFactory: VercelAiToolFactory | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The module object whose `tool` factory is governed. When the loaded `ai`
|
|
11
|
+
* package is a real ES module its namespace is frozen (assignment to a named
|
|
12
|
+
* export throws), so this is a mutable **shim copy** (`{ ...module, tool:
|
|
13
|
+
* governed }`) rather than the frozen original — see `applyGovernedToolFactory`.
|
|
14
|
+
*/
|
|
9
15
|
patchedModule: VercelAiSdkModule | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* True only when `tool` was assigned back onto the loaded module object (a
|
|
18
|
+
* writable plain object); false when a frozen ESM namespace forced a shim copy.
|
|
19
|
+
* Governs whether `unpatchVercelAiSdk` writes the original factory back —
|
|
20
|
+
* there is nothing to restore on the frozen original in the shim case.
|
|
21
|
+
*/
|
|
22
|
+
mutatedOriginal: boolean;
|
|
10
23
|
}
|
|
11
24
|
export declare const vercelAiSdkPatchState: VercelAiSdkPatchState;
|
|
12
25
|
export declare function captureOriginalToolFactory(module: VercelAiSdkModule): VercelAiToolFactory | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-sdk.d.ts","sourceRoot":"","sources":["../../../src/hooks/ai-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,4BAA4B,EAC5B,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACrD,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-sdk.d.ts","sourceRoot":"","sources":["../../../src/hooks/ai-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,4BAA4B,EAC5B,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACrD;;;;;OAKG;IACH,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C;;;;;OAKG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,qBAAqB,EAAE,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AC/B,OAAO,CAAC,OAAO,CAAC,CAmClB;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAsB5C"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import type { NativeClient } from "../native/client.js";
|
|
2
|
+
/**
|
|
3
|
+
* Intentional no-op stub: native-transport LangChain patching is not
|
|
4
|
+
* implemented. LangChain enforcement is performed in the SDK's callback layer
|
|
5
|
+
* (post-execution redaction) and wrapper layer (pre-execution deny) wired by
|
|
6
|
+
* `initAssembly`, not through this native hook — so there is nothing to patch
|
|
7
|
+
* here yet. Returns `false` (nothing patched) for every mode.
|
|
8
|
+
*
|
|
9
|
+
* The `client` parameter is retained to keep the adapter-registry hook
|
|
10
|
+
* signature (and the public `patchLangChain` export) uniform with the other
|
|
11
|
+
* `patch*` hooks; it is deliberately unused until native patching lands.
|
|
12
|
+
*/
|
|
2
13
|
export declare function patchLangChain(client: NativeClient): Promise<boolean>;
|
|
3
14
|
//# sourceMappingURL=langchain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../../../src/hooks/langchain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,wBAAsB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../../../src/hooks/langchain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;;;;;GAUG;AAEH,wBAAsB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAE3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mastra.d.ts","sourceRoot":"","sources":["../../../src/hooks/mastra.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAA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appers/index.js";
|
|
3
|
-
export type { WithAssemblyOptions } from "./wrappers/index.js";
|
|
3
|
+
export type { OpControl, WithAssemblyOptions } from "./wrappers/index.js";
|
|
4
|
+
export { OpControlSubscriber } from "./op-control.js";
|
|
5
|
+
export type { OpControlClient, OpControlSubscriberOptions } from "./op-control.js";
|
|
6
|
+
export { OpTerminatedError } from "./errors/op-terminated-error.js";
|
|
4
7
|
export type { AssemblyConfig, AssemblyContext, AssemblyMode, AuditEvent, CallStackNode, CallStackNodeKind, EnforcementMode, ToolMap } from "./types/index.js";
|
|
5
8
|
export { ENFORCEMENT_MODES } from "./types/index.js";
|
|
6
9
|
export { decodeAuditEvent, decodeCallStackNode, encodeAuditEvent, encodeCallStackNode } from "./audit/index.js";
|
|
@@ -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;
|
|
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,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EACV,eAAe,EACf,0BAA0B,EAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,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;AAKzD,cAAc,kBAAkB,CAAC"}
|
|
@@ -4,6 +4,35 @@ export interface PolicyResult {
|
|
|
4
4
|
pending?: boolean;
|
|
5
5
|
reason?: string;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Options for the native `register` primitive (AAASM-3400). `agentId` is the
|
|
9
|
+
* identity the gateway registers; `name` / `framework` are descriptive
|
|
10
|
+
* metadata; `gatewayEndpoint` overrides the gateway gRPC endpoint.
|
|
11
|
+
*
|
|
12
|
+
* `teamId` and `parentAgentId` carry the agent's lineage/team scoping to the
|
|
13
|
+
* gateway on register (AAASM-3415): `teamId` drives team-budget attribution and
|
|
14
|
+
* `parentAgentId` the topology graph. Both optional — omit for a team-unscoped
|
|
15
|
+
* / root agent.
|
|
16
|
+
*/
|
|
17
|
+
export interface RegisterOptions {
|
|
18
|
+
agentId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
framework: string;
|
|
21
|
+
gatewayEndpoint?: string;
|
|
22
|
+
teamId?: string;
|
|
23
|
+
parentAgentId?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the installed `@agent-assembly/sdk` package version, or `undefined`.
|
|
27
|
+
*
|
|
28
|
+
* Forwarded into the native `connect` so the user-facing npm package version —
|
|
29
|
+
* not the shared `aa-sdk-client` crate version — is what gets signed into the
|
|
30
|
+
* runtime handshake, giving accurate downgrade detection (AAASM-3683).
|
|
31
|
+
* `undefined` lets the native shim fall back to the crate version (no
|
|
32
|
+
* regression vs AAASM-3666). Uses `createRequire(<cwd>/package.json)`, the same
|
|
33
|
+
* ESM/CJS-safe pattern as the native-binding and runtime-binary resolvers.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveSdkVersion(): string | undefined;
|
|
7
36
|
export declare class NativeConnectError extends Error {
|
|
8
37
|
readonly code = "AA_ERR_CONNECT";
|
|
9
38
|
}
|
|
@@ -13,6 +42,9 @@ export declare class NativeSendEventError extends Error {
|
|
|
13
42
|
export declare class NativeQueryPolicyError extends Error {
|
|
14
43
|
readonly code = "AA_ERR_QUERY_POLICY";
|
|
15
44
|
}
|
|
45
|
+
export declare class NativeRegisterError extends Error {
|
|
46
|
+
readonly code = "AA_ERR_REGISTER";
|
|
47
|
+
}
|
|
16
48
|
export declare class NativeDisconnectError extends Error {
|
|
17
49
|
readonly code = "AA_ERR_DISCONNECT";
|
|
18
50
|
}
|
|
@@ -21,6 +53,18 @@ export interface NativeClient {
|
|
|
21
53
|
close: () => Promise<void>;
|
|
22
54
|
sendEvent: (event: unknown) => void;
|
|
23
55
|
queryPolicy: (action: unknown) => Promise<PolicyResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Register this agent with the governance gateway over the native
|
|
58
|
+
* SDK→gateway gRPC call (AAASM-3400). The token the gateway issues is stored
|
|
59
|
+
* on the underlying session and attached to every subsequent
|
|
60
|
+
* {@link queryPolicy} request, so the gateway does not deny a registered
|
|
61
|
+
* agent. Returns the assigned policy id.
|
|
62
|
+
*
|
|
63
|
+
* **Advisory:** like the rest of the SDK this is not a security boundary. A
|
|
64
|
+
* failed registration surfaces as a typed error; callers may proceed
|
|
65
|
+
* unregistered (the proxy / eBPF layers remain authoritative).
|
|
66
|
+
*/
|
|
67
|
+
register: (options: RegisterOptions) => Promise<string>;
|
|
24
68
|
}
|
|
25
69
|
export declare function createNativeClient(options: InitAssemblyOptions): NativeClient;
|
|
26
70
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -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;AAUD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAQtD;AAcD,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,CAiH7E"}
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
* - Auto-wiring into the existing `GatewayClient` / adapter hooks
|
|
20
20
|
* (separate sub-task when the adapter surface is stable).
|
|
21
21
|
*/
|
|
22
|
-
import {
|
|
22
|
+
import type { ChannelCredentials, ClientReadableStream } from "@grpc/grpc-js";
|
|
23
23
|
import type { AgentId } from "./proto/generated/common.js";
|
|
24
|
-
import { OpControlMessage } from "./proto/generated/policy.js";
|
|
24
|
+
import type { OpControlMessage } from "./proto/generated/policy.js";
|
|
25
25
|
/** Strip of the gRPC stub method the subscriber actually needs. Lets tests
|
|
26
26
|
* mock the gRPC layer without standing up a server.
|
|
27
27
|
*/
|
|
@@ -36,24 +36,86 @@ 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
|
+
* The slice of `@grpc/grpc-js`'s `credentials` namespace this module needs.
|
|
67
|
+
* Injected into {@link resolveOpControlCredentials} so that module stays free of
|
|
68
|
+
* a top-level grpc import — the real namespace is `await import`ed on connect.
|
|
69
|
+
*/
|
|
70
|
+
export interface GrpcCredentialsFactory {
|
|
71
|
+
createInsecure: () => ChannelCredentials;
|
|
72
|
+
createSsl: () => ChannelCredentials;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Pick channel credentials for the op-control stream, secure by default.
|
|
76
|
+
*
|
|
77
|
+
* Precedence: an explicit `credentials` override wins; otherwise a loopback
|
|
78
|
+
* target gets plaintext (local dev gateway), a remote target gets TLS, and a
|
|
79
|
+
* remote target is only allowed plaintext when the caller sets `allowInsecure`.
|
|
80
|
+
*
|
|
81
|
+
* `grpcCredentials` is injected (rather than imported at module scope) so this
|
|
82
|
+
* module does not eagerly load `@grpc/grpc-js` — see the module header. The
|
|
83
|
+
* real-connect path passes the lazily-imported `credentials` namespace.
|
|
84
|
+
*
|
|
85
|
+
* @throws never — returns the chosen {@link ChannelCredentials}.
|
|
86
|
+
*/
|
|
87
|
+
export declare function resolveOpControlCredentials(gatewayUrl: string, opts: Pick<OpControlSubscriberOptions, "credentials" | "allowInsecure">, grpcCredentials: GrpcCredentialsFactory): ChannelCredentials;
|
|
48
88
|
export declare class OpControlSubscriber {
|
|
49
|
-
|
|
89
|
+
/**
|
|
90
|
+
* `null` until the channel is opened. On the test-seam (`clientFactory`) path
|
|
91
|
+
* it is set synchronously in {@link connect}; on the real-connect path it is
|
|
92
|
+
* set asynchronously once `@grpc/grpc-js` + `PolicyServiceClient` have been
|
|
93
|
+
* lazily imported (see {@link openRealChannel}).
|
|
94
|
+
*/
|
|
95
|
+
private client;
|
|
50
96
|
private readonly agent;
|
|
51
97
|
private readonly ops;
|
|
52
98
|
private call;
|
|
53
99
|
private alive;
|
|
100
|
+
/** Set once {@link close} is called before the async channel finishes opening. */
|
|
101
|
+
private closed;
|
|
54
102
|
private constructor();
|
|
55
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Open the gRPC channel + subscription stream and start the reader.
|
|
105
|
+
*
|
|
106
|
+
* Returns synchronously. On the real-connect path the channel is opened
|
|
107
|
+
* asynchronously — `@grpc/grpc-js` and `PolicyServiceClient` are loaded lazily
|
|
108
|
+
* (`await import`) so that importing this module never eagerly pulls grpc (see
|
|
109
|
+
* the module header). The test seam (`clientFactory`) opens synchronously and
|
|
110
|
+
* never touches grpc.
|
|
111
|
+
*/
|
|
56
112
|
static connect(gatewayUrl: string, opts: OpControlSubscriberOptions): OpControlSubscriber;
|
|
113
|
+
/**
|
|
114
|
+
* Lazily import grpc + the policy client, build the real client, and start the
|
|
115
|
+
* reader. Kept off the module's import graph so `import '@agent-assembly/sdk'`
|
|
116
|
+
* stays grpc-free until a subscriber actually opens a live channel.
|
|
117
|
+
*/
|
|
118
|
+
private openRealChannel;
|
|
57
119
|
/** Open the stream and wire reader handlers. Public so tests can call
|
|
58
120
|
* directly after constructing with a hand-rolled client.
|
|
59
121
|
*/
|
|
@@ -79,7 +141,9 @@ export declare class OpControlSubscriber {
|
|
|
79
141
|
isPaused(opId: string): boolean;
|
|
80
142
|
isTerminated(opId: string): boolean;
|
|
81
143
|
streamAlive(): boolean;
|
|
82
|
-
/** Cancel the stream and clean up.
|
|
144
|
+
/** Cancel the stream and clean up. Safe to call before the async real-channel
|
|
145
|
+
* open has completed — it flags `closed` so the pending open bails out.
|
|
146
|
+
*/
|
|
83
147
|
close(): void;
|
|
84
148
|
}
|
|
85
149
|
//# sourceMappingURL=op-control.d.ts.map
|