@agent-assembly/sdk 0.0.1-alpha.3
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/LICENSE +176 -0
- package/README.md +182 -0
- package/dist/cjs/adapters/adapter-registry.js +2 -0
- package/dist/cjs/adapters/adapter.js +2 -0
- package/dist/cjs/adapters/index.js +2 -0
- package/dist/cjs/adapters/langchain/assembly-callback-handler.js +93 -0
- package/dist/cjs/adapters/langchain/index.js +8 -0
- package/dist/cjs/adapters/langchain/wrap-tool-with-assembly.js +55 -0
- package/dist/cjs/audit/encode.js +176 -0
- package/dist/cjs/audit/index.js +8 -0
- package/dist/cjs/core/gateway-resolver.js +254 -0
- package/dist/cjs/core/index.js +9 -0
- package/dist/cjs/core/init-assembly.js +224 -0
- package/dist/cjs/errors/configuration-error.js +17 -0
- package/dist/cjs/errors/gateway-error.js +17 -0
- package/dist/cjs/errors/index.js +11 -0
- package/dist/cjs/errors/op-terminated-error.js +20 -0
- package/dist/cjs/errors/policy-violation-error.js +10 -0
- package/dist/cjs/gateway/client.js +15 -0
- package/dist/cjs/gateway/index.js +5 -0
- package/dist/cjs/hooks/adapter-registry.js +7 -0
- package/dist/cjs/hooks/ai-sdk-detection.js +14 -0
- package/dist/cjs/hooks/ai-sdk.js +164 -0
- package/dist/cjs/hooks/langchain.js +9 -0
- package/dist/cjs/hooks/langgraph-detection.js +14 -0
- package/dist/cjs/hooks/langgraph.js +107 -0
- package/dist/cjs/hooks/mastra-detection.js +14 -0
- package/dist/cjs/hooks/mastra.js +120 -0
- package/dist/cjs/hooks/openai-agents-detection.js +14 -0
- package/dist/cjs/hooks/openai-agents.js +189 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/lineage/agent-context-store.js +20 -0
- package/dist/cjs/lineage/index.js +7 -0
- package/dist/cjs/native/client.js +160 -0
- package/dist/cjs/op-control.js +150 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/proto/generated/common.js +365 -0
- package/dist/cjs/proto/generated/policy.js +1418 -0
- package/dist/cjs/runtime.js +144 -0
- package/dist/cjs/types/assembly-config.js +2 -0
- package/dist/cjs/types/assembly-context.js +2 -0
- package/dist/cjs/types/assembly-mode.js +2 -0
- package/dist/cjs/types/audit.js +5 -0
- package/dist/cjs/types/enforcement-mode.js +9 -0
- package/dist/cjs/types/gateway-governance.js +2 -0
- package/dist/cjs/types/index.js +5 -0
- package/dist/cjs/types/langchain-adapter.js +2 -0
- package/dist/cjs/types/openai-agents-adapter.js +2 -0
- package/dist/cjs/types/policy.js +2 -0
- package/dist/cjs/types/tool-map.js +2 -0
- package/dist/cjs/types/vercel-ai-adapter.js +2 -0
- package/dist/cjs/wrappers/index.js +5 -0
- package/dist/cjs/wrappers/with-assembly.js +82 -0
- package/dist/esm/adapters/adapter-registry.js +2 -0
- package/dist/esm/adapters/adapter-registry.js.map +1 -0
- package/dist/esm/adapters/adapter.js +2 -0
- package/dist/esm/adapters/adapter.js.map +1 -0
- package/dist/esm/adapters/index.js +2 -0
- package/dist/esm/adapters/index.js.map +1 -0
- package/dist/esm/adapters/langchain/assembly-callback-handler.js +90 -0
- package/dist/esm/adapters/langchain/assembly-callback-handler.js.map +1 -0
- package/dist/esm/adapters/langchain/index.js +3 -0
- package/dist/esm/adapters/langchain/index.js.map +1 -0
- package/dist/esm/adapters/langchain/wrap-tool-with-assembly.js +52 -0
- package/dist/esm/adapters/langchain/wrap-tool-with-assembly.js.map +1 -0
- package/dist/esm/audit/encode.js +171 -0
- package/dist/esm/audit/encode.js.map +1 -0
- package/dist/esm/audit/index.js +2 -0
- package/dist/esm/audit/index.js.map +1 -0
- package/dist/esm/core/gateway-resolver.js +213 -0
- package/dist/esm/core/gateway-resolver.js.map +1 -0
- package/dist/esm/core/index.js +2 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/init-assembly.js +218 -0
- package/dist/esm/core/init-assembly.js.map +1 -0
- package/dist/esm/errors/configuration-error.js +14 -0
- package/dist/esm/errors/configuration-error.js.map +1 -0
- package/dist/esm/errors/gateway-error.js +14 -0
- package/dist/esm/errors/gateway-error.js.map +1 -0
- package/dist/esm/errors/index.js +5 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/errors/op-terminated-error.js +17 -0
- package/dist/esm/errors/op-terminated-error.js.map +1 -0
- package/dist/esm/errors/policy-violation-error.js +7 -0
- package/dist/esm/errors/policy-violation-error.js.map +1 -0
- package/dist/esm/gateway/client.js +13 -0
- package/dist/esm/gateway/client.js.map +1 -0
- package/dist/esm/gateway/index.js +2 -0
- package/dist/esm/gateway/index.js.map +1 -0
- package/dist/esm/hooks/adapter-registry.js +5 -0
- package/dist/esm/hooks/adapter-registry.js.map +1 -0
- package/dist/esm/hooks/ai-sdk-detection.js +12 -0
- package/dist/esm/hooks/ai-sdk-detection.js.map +1 -0
- package/dist/esm/hooks/ai-sdk.js +123 -0
- package/dist/esm/hooks/ai-sdk.js.map +1 -0
- package/dist/esm/hooks/langchain.js +7 -0
- package/dist/esm/hooks/langchain.js.map +1 -0
- package/dist/esm/hooks/langgraph-detection.js +12 -0
- package/dist/esm/hooks/langgraph-detection.js.map +1 -0
- package/dist/esm/hooks/langgraph.js +69 -0
- package/dist/esm/hooks/langgraph.js.map +1 -0
- package/dist/esm/hooks/mastra-detection.js +12 -0
- package/dist/esm/hooks/mastra-detection.js.map +1 -0
- package/dist/esm/hooks/mastra.js +83 -0
- package/dist/esm/hooks/mastra.js.map +1 -0
- package/dist/esm/hooks/openai-agents-detection.js +12 -0
- package/dist/esm/hooks/openai-agents-detection.js.map +1 -0
- package/dist/esm/hooks/openai-agents.js +145 -0
- package/dist/esm/hooks/openai-agents.js.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lineage/agent-context-store.js +16 -0
- package/dist/esm/lineage/agent-context-store.js.map +1 -0
- package/dist/esm/lineage/index.js +2 -0
- package/dist/esm/lineage/index.js.map +1 -0
- package/dist/esm/native/client.js +150 -0
- package/dist/esm/native/client.js.map +1 -0
- package/dist/esm/op-control.js +147 -0
- package/dist/esm/op-control.js.map +1 -0
- package/dist/esm/proto/generated/common.js +357 -0
- package/dist/esm/proto/generated/common.js.map +1 -0
- package/dist/esm/proto/generated/policy.js +1414 -0
- package/dist/esm/proto/generated/policy.js.map +1 -0
- package/dist/esm/runtime.js +138 -0
- package/dist/esm/runtime.js.map +1 -0
- package/dist/esm/types/assembly-config.js +2 -0
- package/dist/esm/types/assembly-config.js.map +1 -0
- package/dist/esm/types/assembly-context.js +2 -0
- package/dist/esm/types/assembly-context.js.map +1 -0
- package/dist/esm/types/assembly-mode.js +2 -0
- package/dist/esm/types/assembly-mode.js.map +1 -0
- package/dist/esm/types/audit.js +5 -0
- package/dist/esm/types/audit.js.map +1 -0
- package/dist/esm/types/enforcement-mode.js +7 -0
- package/dist/esm/types/enforcement-mode.js.map +1 -0
- package/dist/esm/types/gateway-governance.js +2 -0
- package/dist/esm/types/gateway-governance.js.map +1 -0
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/langchain-adapter.js +2 -0
- package/dist/esm/types/langchain-adapter.js.map +1 -0
- package/dist/esm/types/openai-agents-adapter.js +2 -0
- package/dist/esm/types/openai-agents-adapter.js.map +1 -0
- package/dist/esm/types/policy.js +2 -0
- package/dist/esm/types/policy.js.map +1 -0
- package/dist/esm/types/tool-map.js +2 -0
- package/dist/esm/types/tool-map.js.map +1 -0
- package/dist/esm/types/vercel-ai-adapter.js +2 -0
- package/dist/esm/types/vercel-ai-adapter.js.map +1 -0
- package/dist/esm/wrappers/index.js +2 -0
- package/dist/esm/wrappers/index.js.map +1 -0
- package/dist/esm/wrappers/with-assembly.js +80 -0
- package/dist/esm/wrappers/with-assembly.js.map +1 -0
- package/dist/types/adapters/adapter-registry.d.ts +7 -0
- package/dist/types/adapters/adapter-registry.d.ts.map +1 -0
- package/dist/types/adapters/adapter.d.ts +6 -0
- package/dist/types/adapters/adapter.d.ts.map +1 -0
- package/dist/types/adapters/index.d.ts +3 -0
- package/dist/types/adapters/index.d.ts.map +1 -0
- package/dist/types/adapters/langchain/assembly-callback-handler.d.ts +21 -0
- package/dist/types/adapters/langchain/assembly-callback-handler.d.ts.map +1 -0
- package/dist/types/adapters/langchain/index.d.ts +4 -0
- package/dist/types/adapters/langchain/index.d.ts.map +1 -0
- package/dist/types/adapters/langchain/wrap-tool-with-assembly.d.ts +9 -0
- package/dist/types/adapters/langchain/wrap-tool-with-assembly.d.ts.map +1 -0
- package/dist/types/audit/encode.d.ts +77 -0
- package/dist/types/audit/encode.d.ts.map +1 -0
- package/dist/types/audit/index.d.ts +3 -0
- package/dist/types/audit/index.d.ts.map +1 -0
- package/dist/types/core/gateway-resolver.d.ts +92 -0
- package/dist/types/core/gateway-resolver.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/init-assembly.d.ts +10 -0
- package/dist/types/core/init-assembly.d.ts.map +1 -0
- package/dist/types/errors/configuration-error.d.ts +11 -0
- package/dist/types/errors/configuration-error.d.ts.map +1 -0
- package/dist/types/errors/gateway-error.d.ts +11 -0
- package/dist/types/errors/gateway-error.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +5 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/errors/op-terminated-error.d.ts +13 -0
- package/dist/types/errors/op-terminated-error.d.ts.map +1 -0
- package/dist/types/errors/policy-violation-error.d.ts +4 -0
- package/dist/types/errors/policy-violation-error.d.ts.map +1 -0
- package/dist/types/gateway/client.d.ts +14 -0
- package/dist/types/gateway/client.d.ts.map +1 -0
- package/dist/types/gateway/index.d.ts +3 -0
- package/dist/types/gateway/index.d.ts.map +1 -0
- package/dist/types/hooks/adapter-registry.d.ts +3 -0
- package/dist/types/hooks/adapter-registry.d.ts.map +1 -0
- package/dist/types/hooks/ai-sdk-detection.d.ts +2 -0
- package/dist/types/hooks/ai-sdk-detection.d.ts.map +1 -0
- package/dist/types/hooks/ai-sdk.d.ts +36 -0
- package/dist/types/hooks/ai-sdk.d.ts.map +1 -0
- package/dist/types/hooks/langchain.d.ts +3 -0
- package/dist/types/hooks/langchain.d.ts.map +1 -0
- package/dist/types/hooks/langgraph-detection.d.ts +2 -0
- package/dist/types/hooks/langgraph-detection.d.ts.map +1 -0
- package/dist/types/hooks/langgraph.d.ts +26 -0
- package/dist/types/hooks/langgraph.d.ts.map +1 -0
- package/dist/types/hooks/mastra-detection.d.ts +2 -0
- package/dist/types/hooks/mastra-detection.d.ts.map +1 -0
- package/dist/types/hooks/mastra.d.ts +29 -0
- package/dist/types/hooks/mastra.d.ts.map +1 -0
- package/dist/types/hooks/openai-agents-detection.d.ts +2 -0
- package/dist/types/hooks/openai-agents-detection.d.ts.map +1 -0
- package/dist/types/hooks/openai-agents.d.ts +42 -0
- package/dist/types/hooks/openai-agents.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lineage/agent-context-store.d.ts +12 -0
- package/dist/types/lineage/agent-context-store.d.ts.map +1 -0
- package/dist/types/lineage/index.d.ts +2 -0
- package/dist/types/lineage/index.d.ts.map +1 -0
- package/dist/types/native/client.d.ts +26 -0
- package/dist/types/native/client.d.ts.map +1 -0
- package/dist/types/op-control.d.ts +85 -0
- package/dist/types/op-control.d.ts.map +1 -0
- package/dist/types/proto/generated/common.d.ts +90 -0
- package/dist/types/proto/generated/common.d.ts.map +1 -0
- package/dist/types/proto/generated/policy.d.ts +298 -0
- package/dist/types/proto/generated/policy.d.ts.map +1 -0
- package/dist/types/runtime.d.ts +59 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/types/assembly-config.d.ts +47 -0
- package/dist/types/types/assembly-config.d.ts.map +1 -0
- package/dist/types/types/assembly-context.d.ts +12 -0
- package/dist/types/types/assembly-context.d.ts.map +1 -0
- package/dist/types/types/assembly-mode.d.ts +2 -0
- package/dist/types/types/assembly-mode.d.ts.map +1 -0
- package/dist/types/types/audit.d.ts +76 -0
- package/dist/types/types/audit.d.ts.map +1 -0
- package/dist/types/types/enforcement-mode.d.ts +20 -0
- package/dist/types/types/enforcement-mode.d.ts.map +1 -0
- package/dist/types/types/gateway-governance.d.ts +31 -0
- package/dist/types/types/gateway-governance.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +12 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/langchain-adapter.d.ts +25 -0
- package/dist/types/types/langchain-adapter.d.ts.map +1 -0
- package/dist/types/types/openai-agents-adapter.d.ts +17 -0
- package/dist/types/types/openai-agents-adapter.d.ts.map +1 -0
- package/dist/types/types/policy.d.ts +10 -0
- package/dist/types/types/policy.d.ts.map +1 -0
- package/dist/types/types/tool-map.d.ts +2 -0
- package/dist/types/types/tool-map.d.ts.map +1 -0
- package/dist/types/types/vercel-ai-adapter.d.ts +12 -0
- package/dist/types/types/vercel-ai-adapter.d.ts.map +1 -0
- package/dist/types/wrappers/index.d.ts +3 -0
- package/dist/types/wrappers/index.d.ts.map +1 -0
- package/dist/types/wrappers/with-assembly.d.ts +9 -0
- package/dist/types/wrappers/with-assembly.d.ts.map +1 -0
- package/native/aa-ffi-node/index.cjs +20 -0
- package/native/aa-ffi-node/index.d.ts +23 -0
- package/package.json +95 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.openAIAgentsPatchState = void 0;
|
|
37
|
+
exports.captureOriginalRunTool = captureOriginalRunTool;
|
|
38
|
+
exports.parseToolCallArguments = parseToolCallArguments;
|
|
39
|
+
exports.extractToolCallContextMetadata = extractToolCallContextMetadata;
|
|
40
|
+
exports.formatDeniedToolCallOutput = formatDeniedToolCallOutput;
|
|
41
|
+
exports.handlePendingApproval = handlePendingApproval;
|
|
42
|
+
exports.recordToolResultNonBlocking = recordToolResultNonBlocking;
|
|
43
|
+
exports.createPatchedRunTool = createPatchedRunTool;
|
|
44
|
+
exports.patchOpenAIAgents = patchOpenAIAgents;
|
|
45
|
+
exports.unpatchOpenAIAgents = unpatchOpenAIAgents;
|
|
46
|
+
const openai_agents_detection_js_1 = require("./openai-agents-detection.js");
|
|
47
|
+
exports.openAIAgentsPatchState = {
|
|
48
|
+
isPatched: false,
|
|
49
|
+
originalRunTool: undefined,
|
|
50
|
+
patchedAgentClass: undefined
|
|
51
|
+
};
|
|
52
|
+
function captureOriginalRunTool(agentClass) {
|
|
53
|
+
const candidate = agentClass.prototype._runTool;
|
|
54
|
+
if (!candidate) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (!exports.openAIAgentsPatchState.originalRunTool) {
|
|
58
|
+
exports.openAIAgentsPatchState.originalRunTool = candidate;
|
|
59
|
+
}
|
|
60
|
+
return exports.openAIAgentsPatchState.originalRunTool;
|
|
61
|
+
}
|
|
62
|
+
function parseToolCallArguments(toolCall) {
|
|
63
|
+
try {
|
|
64
|
+
return JSON.parse(toolCall.function.arguments);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return toolCall.function.arguments;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function extractToolCallContextMetadata(context) {
|
|
71
|
+
return {
|
|
72
|
+
agentId: context?.agentId ?? undefined,
|
|
73
|
+
runId: context?.runId ?? undefined
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function formatDeniedToolCallOutput(reason, prefix) {
|
|
77
|
+
const detail = reason?.trim() ? reason : "denied";
|
|
78
|
+
return { error: `${prefix}: ${detail}` };
|
|
79
|
+
}
|
|
80
|
+
async function handlePendingApproval(gatewayClient, options) {
|
|
81
|
+
const approval = await gatewayClient.waitForApproval(options.toolName, options.runId, options.timeoutMs);
|
|
82
|
+
if (!approval.denied) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return formatDeniedToolCallOutput(approval.reason, "Approval denied");
|
|
86
|
+
}
|
|
87
|
+
function recordToolResultNonBlocking(gatewayClient, runId, output) {
|
|
88
|
+
void gatewayClient.recordResult({ runId, output }).catch(() => undefined);
|
|
89
|
+
}
|
|
90
|
+
function createPatchedRunTool(originalRunTool, gatewayClient, options) {
|
|
91
|
+
return async function patchedRunTool(toolCall, context) {
|
|
92
|
+
const toolName = toolCall.function.name;
|
|
93
|
+
const args = parseToolCallArguments(toolCall);
|
|
94
|
+
const metadata = extractToolCallContextMetadata(context);
|
|
95
|
+
const runId = metadata.runId ?? options.fallbackRunId;
|
|
96
|
+
const executeOriginal = async () => {
|
|
97
|
+
const result = await originalRunTool.call(this, toolCall, context);
|
|
98
|
+
recordToolResultNonBlocking(gatewayClient, runId, {
|
|
99
|
+
toolName,
|
|
100
|
+
args,
|
|
101
|
+
result,
|
|
102
|
+
agentId: metadata.agentId
|
|
103
|
+
});
|
|
104
|
+
return result;
|
|
105
|
+
};
|
|
106
|
+
let decision;
|
|
107
|
+
try {
|
|
108
|
+
decision = await gatewayClient.check({
|
|
109
|
+
action: "tool_call",
|
|
110
|
+
toolName,
|
|
111
|
+
args,
|
|
112
|
+
runId
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return executeOriginal();
|
|
117
|
+
}
|
|
118
|
+
if (decision.denied) {
|
|
119
|
+
return formatDeniedToolCallOutput(decision.reason, "Blocked by governance policy");
|
|
120
|
+
}
|
|
121
|
+
if (decision.pending) {
|
|
122
|
+
let pendingOutput;
|
|
123
|
+
try {
|
|
124
|
+
pendingOutput = await handlePendingApproval(gatewayClient, {
|
|
125
|
+
toolName,
|
|
126
|
+
runId,
|
|
127
|
+
timeoutMs: options.approvalTimeoutMs
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return executeOriginal();
|
|
132
|
+
}
|
|
133
|
+
if (pendingOutput) {
|
|
134
|
+
return pendingOutput;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return executeOriginal();
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
async function loadAgentClassFromSdk() {
|
|
141
|
+
if (!(0, openai_agents_detection_js_1.hasOpenAIAgentsSDK)()) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const moduleName = "@openai/agents";
|
|
146
|
+
const module = (await Promise.resolve(`${moduleName}`).then(s => __importStar(require(s))));
|
|
147
|
+
return module.Agent;
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async function patchOpenAIAgents(options) {
|
|
154
|
+
if (exports.openAIAgentsPatchState.isPatched) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
const loadAgentClass = options.loadAgentClass ?? loadAgentClassFromSdk;
|
|
158
|
+
const agentClass = await loadAgentClass();
|
|
159
|
+
if (!agentClass) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
const originalRunTool = captureOriginalRunTool(agentClass);
|
|
163
|
+
if (!originalRunTool) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
agentClass.prototype._runTool = createPatchedRunTool(originalRunTool, options.gatewayClient, {
|
|
167
|
+
approvalTimeoutMs: options.approvalTimeoutMs ?? 30_000,
|
|
168
|
+
fallbackRunId: options.fallbackRunId ?? "openai-agents"
|
|
169
|
+
});
|
|
170
|
+
exports.openAIAgentsPatchState.isPatched = true;
|
|
171
|
+
exports.openAIAgentsPatchState.patchedAgentClass = agentClass;
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
function unpatchOpenAIAgents() {
|
|
175
|
+
if (!exports.openAIAgentsPatchState.isPatched) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
if (!exports.openAIAgentsPatchState.patchedAgentClass) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
if (!exports.openAIAgentsPatchState.originalRunTool) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
exports.openAIAgentsPatchState.patchedAgentClass.prototype._runTool =
|
|
185
|
+
exports.openAIAgentsPatchState.originalRunTool;
|
|
186
|
+
exports.openAIAgentsPatchState.isPatched = false;
|
|
187
|
+
exports.openAIAgentsPatchState.patchedAgentClass = undefined;
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
4
|
+
var init_assembly_js_1 = require("./core/init-assembly.js");
|
|
5
|
+
Object.defineProperty(exports, "initAssembly", { enumerable: true, get: function () { return init_assembly_js_1.initAssembly; } });
|
|
6
|
+
var index_js_1 = require("./wrappers/index.js");
|
|
7
|
+
Object.defineProperty(exports, "withAssembly", { enumerable: true, get: function () { return index_js_1.withAssembly; } });
|
|
8
|
+
var index_js_2 = require("./types/index.js");
|
|
9
|
+
Object.defineProperty(exports, "ENFORCEMENT_MODES", { enumerable: true, get: function () { return index_js_2.ENFORCEMENT_MODES; } });
|
|
10
|
+
var index_js_3 = require("./audit/index.js");
|
|
11
|
+
Object.defineProperty(exports, "decodeAuditEvent", { enumerable: true, get: function () { return index_js_3.decodeAuditEvent; } });
|
|
12
|
+
Object.defineProperty(exports, "decodeCallStackNode", { enumerable: true, get: function () { return index_js_3.decodeCallStackNode; } });
|
|
13
|
+
Object.defineProperty(exports, "encodeAuditEvent", { enumerable: true, get: function () { return index_js_3.encodeAuditEvent; } });
|
|
14
|
+
Object.defineProperty(exports, "encodeCallStackNode", { enumerable: true, get: function () { return index_js_3.encodeCallStackNode; } });
|
|
15
|
+
var index_js_4 = require("./lineage/index.js");
|
|
16
|
+
Object.defineProperty(exports, "currentAgentId", { enumerable: true, get: function () { return index_js_4.currentAgentId; } });
|
|
17
|
+
Object.defineProperty(exports, "runWithAgentId", { enumerable: true, get: function () { return index_js_4.runWithAgentId; } });
|
|
18
|
+
// Runtime binary resolution helpers (F113 / AAASM-1221). Re-export the
|
|
19
|
+
// discovery + error-message surfaces from src/runtime.ts; the lifecycle
|
|
20
|
+
// `initAssembly` from runtime.ts intentionally stays scoped to the
|
|
21
|
+
// `@agent-assembly/sdk/runtime` subpath export to avoid colliding with
|
|
22
|
+
// the gateway-based `initAssembly` re-exported above.
|
|
23
|
+
var runtime_js_1 = require("./runtime.js");
|
|
24
|
+
Object.defineProperty(exports, "INSTALL_HINT", { enumerable: true, get: function () { return runtime_js_1.INSTALL_HINT; } });
|
|
25
|
+
Object.defineProperty(exports, "findAasmBinary", { enumerable: true, get: function () { return runtime_js_1.findAasmBinary; } });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentContextStore = void 0;
|
|
4
|
+
exports.runWithAgentId = runWithAgentId;
|
|
5
|
+
exports.currentAgentId = currentAgentId;
|
|
6
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
7
|
+
/**
|
|
8
|
+
* Holds the current agent's ID for automatic lineage propagation.
|
|
9
|
+
* When a framework spawns a child agent, the child's initAssembly reads
|
|
10
|
+
* this store to auto-populate parentAgentId without manual threading.
|
|
11
|
+
*/
|
|
12
|
+
exports.agentContextStore = new node_async_hooks_1.AsyncLocalStorage();
|
|
13
|
+
/** Run fn within a context where the current agent ID is set. */
|
|
14
|
+
function runWithAgentId(agentId, fn) {
|
|
15
|
+
return exports.agentContextStore.run(agentId, fn);
|
|
16
|
+
}
|
|
17
|
+
/** Return the current agent ID from the async context, or undefined if absent. */
|
|
18
|
+
function currentAgentId() {
|
|
19
|
+
return exports.agentContextStore.getStore();
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runWithAgentId = exports.currentAgentId = exports.agentContextStore = void 0;
|
|
4
|
+
var agent_context_store_js_1 = require("./agent-context-store.js");
|
|
5
|
+
Object.defineProperty(exports, "agentContextStore", { enumerable: true, get: function () { return agent_context_store_js_1.agentContextStore; } });
|
|
6
|
+
Object.defineProperty(exports, "currentAgentId", { enumerable: true, get: function () { return agent_context_store_js_1.currentAgentId; } });
|
|
7
|
+
Object.defineProperty(exports, "runWithAgentId", { enumerable: true, get: function () { return agent_context_store_js_1.runWithAgentId; } });
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NativeDisconnectError = exports.NativeQueryPolicyError = exports.NativeSendEventError = exports.NativeConnectError = void 0;
|
|
7
|
+
exports.createNativeClient = createNativeClient;
|
|
8
|
+
const node_module_1 = require("node:module");
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const NATIVE_BINDING_SINGLETON_KEY = Symbol.for("@agent-assembly/sdk/native-binding");
|
|
11
|
+
const ERROR_CONNECT = "AA_ERR_CONNECT";
|
|
12
|
+
const ERROR_SEND_EVENT = "AA_ERR_SEND_EVENT";
|
|
13
|
+
const ERROR_QUERY_POLICY = "AA_ERR_QUERY_POLICY";
|
|
14
|
+
const ERROR_DISCONNECT = "AA_ERR_DISCONNECT";
|
|
15
|
+
class NativeConnectError extends Error {
|
|
16
|
+
code = ERROR_CONNECT;
|
|
17
|
+
}
|
|
18
|
+
exports.NativeConnectError = NativeConnectError;
|
|
19
|
+
class NativeSendEventError extends Error {
|
|
20
|
+
code = ERROR_SEND_EVENT;
|
|
21
|
+
}
|
|
22
|
+
exports.NativeSendEventError = NativeSendEventError;
|
|
23
|
+
class NativeQueryPolicyError extends Error {
|
|
24
|
+
code = ERROR_QUERY_POLICY;
|
|
25
|
+
}
|
|
26
|
+
exports.NativeQueryPolicyError = NativeQueryPolicyError;
|
|
27
|
+
class NativeDisconnectError extends Error {
|
|
28
|
+
code = ERROR_DISCONNECT;
|
|
29
|
+
}
|
|
30
|
+
exports.NativeDisconnectError = NativeDisconnectError;
|
|
31
|
+
function mapNativeError(error) {
|
|
32
|
+
if (!(error instanceof Error)) {
|
|
33
|
+
return new Error(String(error));
|
|
34
|
+
}
|
|
35
|
+
const [code, ...rest] = error.message.split(":");
|
|
36
|
+
const detail = rest.join(":").trim() || error.message;
|
|
37
|
+
if (code === ERROR_CONNECT) {
|
|
38
|
+
return new NativeConnectError(detail);
|
|
39
|
+
}
|
|
40
|
+
if (code === ERROR_SEND_EVENT) {
|
|
41
|
+
return new NativeSendEventError(detail);
|
|
42
|
+
}
|
|
43
|
+
if (code === ERROR_QUERY_POLICY) {
|
|
44
|
+
return new NativeQueryPolicyError(detail);
|
|
45
|
+
}
|
|
46
|
+
if (code === ERROR_DISCONNECT) {
|
|
47
|
+
return new NativeDisconnectError(detail);
|
|
48
|
+
}
|
|
49
|
+
return error;
|
|
50
|
+
}
|
|
51
|
+
function loadNativeBinding() {
|
|
52
|
+
const shouldUseCache = process.env.VITEST !== "true";
|
|
53
|
+
const globalObject = globalThis;
|
|
54
|
+
const cachedBinding = shouldUseCache
|
|
55
|
+
? globalObject[NATIVE_BINDING_SINGLETON_KEY]
|
|
56
|
+
: undefined;
|
|
57
|
+
if (cachedBinding) {
|
|
58
|
+
return cachedBinding;
|
|
59
|
+
}
|
|
60
|
+
const requireFromHere = (0, node_module_1.createRequire)(node_path_1.default.resolve(process.cwd(), "package.json"));
|
|
61
|
+
const candidates = [
|
|
62
|
+
"../../native/aa-ffi-node/index.cjs",
|
|
63
|
+
"../../../native/aa-ffi-node/index.cjs",
|
|
64
|
+
`${process.cwd()}/native/aa-ffi-node/index.cjs`
|
|
65
|
+
];
|
|
66
|
+
let lastError;
|
|
67
|
+
for (const candidate of candidates) {
|
|
68
|
+
try {
|
|
69
|
+
const binding = requireFromHere(candidate);
|
|
70
|
+
if (shouldUseCache) {
|
|
71
|
+
globalObject[NATIVE_BINDING_SINGLETON_KEY] = binding;
|
|
72
|
+
}
|
|
73
|
+
return binding;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
lastError = error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
throw new NativeConnectError(`Failed to load native binding from known paths: ${String(lastError)}`);
|
|
80
|
+
}
|
|
81
|
+
function createNativeClient(options) {
|
|
82
|
+
const mode = options.mode ?? "grpc-sidecar";
|
|
83
|
+
if (mode !== "napi-inprocess") {
|
|
84
|
+
return {
|
|
85
|
+
mode,
|
|
86
|
+
close: async () => undefined,
|
|
87
|
+
sendEvent: () => undefined,
|
|
88
|
+
queryPolicy: async () => ({ denied: false, pending: false })
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const binding = loadNativeBinding();
|
|
92
|
+
const socketPath = options.gateway;
|
|
93
|
+
let handlePromise;
|
|
94
|
+
let activeHandle;
|
|
95
|
+
let pendingSendError;
|
|
96
|
+
const getHandle = async () => {
|
|
97
|
+
if (!handlePromise) {
|
|
98
|
+
handlePromise = binding
|
|
99
|
+
.connect(socketPath)
|
|
100
|
+
.then((handle) => {
|
|
101
|
+
activeHandle = handle;
|
|
102
|
+
return handle;
|
|
103
|
+
})
|
|
104
|
+
.catch((error) => {
|
|
105
|
+
handlePromise = undefined;
|
|
106
|
+
activeHandle = undefined;
|
|
107
|
+
throw mapNativeError(error);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return handlePromise;
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
mode,
|
|
114
|
+
close: async () => {
|
|
115
|
+
if (pendingSendError) {
|
|
116
|
+
const error = pendingSendError;
|
|
117
|
+
pendingSendError = undefined;
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
if (!handlePromise) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const handle = await getHandle();
|
|
124
|
+
await binding.disconnect(handle).catch((error) => {
|
|
125
|
+
throw mapNativeError(error);
|
|
126
|
+
});
|
|
127
|
+
handlePromise = undefined;
|
|
128
|
+
activeHandle = undefined;
|
|
129
|
+
},
|
|
130
|
+
sendEvent: (event) => {
|
|
131
|
+
if (activeHandle) {
|
|
132
|
+
try {
|
|
133
|
+
binding.sendEvent(activeHandle, event);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
pendingSendError = mapNativeError(error);
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
void getHandle()
|
|
141
|
+
.then((handle) => {
|
|
142
|
+
binding.sendEvent(handle, event);
|
|
143
|
+
})
|
|
144
|
+
.catch((error) => {
|
|
145
|
+
pendingSendError = mapNativeError(error);
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
queryPolicy: async (action) => {
|
|
149
|
+
if (pendingSendError) {
|
|
150
|
+
const error = pendingSendError;
|
|
151
|
+
pendingSendError = undefined;
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
const handle = await getHandle();
|
|
155
|
+
return binding.queryPolicy(handle, action).catch((error) => {
|
|
156
|
+
throw mapNativeError(error);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Gateway → SDK op-control consumer (AAASM-1422 PR-F / AAASM-1655).
|
|
4
|
+
*
|
|
5
|
+
* Subscribes to `PolicyService.OpControlStream` and exposes a per-`op_id`
|
|
6
|
+
* cooperative-pause / fast-fail-terminate state machine through
|
|
7
|
+
* {@link OpControlSubscriber.waitForOp}.
|
|
8
|
+
*
|
|
9
|
+
* State machine per op_id:
|
|
10
|
+
* - `OP_CONTROL_SIGNAL_PAUSE` → `waitForOp` blocks until RESUME arrives.
|
|
11
|
+
* - `OP_CONTROL_SIGNAL_RESUME` → `waitForOp` resolves immediately.
|
|
12
|
+
* - `OP_CONTROL_SIGNAL_TERMINATE` → `waitForOp` rejects with `OpTerminatedError`.
|
|
13
|
+
*
|
|
14
|
+
* Signals that arrive for an `op_id` no one is currently awaiting are
|
|
15
|
+
* buffered into the per-op slot so the next `waitForOp` sees them.
|
|
16
|
+
*
|
|
17
|
+
* Out of scope for PR-F (deferred):
|
|
18
|
+
* - Reconnection / heartbeat on stream close (caller observes
|
|
19
|
+
* `streamAlive` and re-instantiates if desired).
|
|
20
|
+
* - Auto-wiring into the existing `GatewayClient` / adapter hooks
|
|
21
|
+
* (separate sub-task when the adapter surface is stable).
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.OpControlSubscriber = void 0;
|
|
25
|
+
const grpc_js_1 = require("@grpc/grpc-js");
|
|
26
|
+
const op_terminated_error_js_1 = require("./errors/op-terminated-error.js");
|
|
27
|
+
const policy_js_1 = require("./proto/generated/policy.js");
|
|
28
|
+
class OpControlSubscriber {
|
|
29
|
+
client;
|
|
30
|
+
agent;
|
|
31
|
+
ops = new Map();
|
|
32
|
+
call = null;
|
|
33
|
+
alive = true;
|
|
34
|
+
constructor(client, agent) {
|
|
35
|
+
this.client = client;
|
|
36
|
+
this.agent = agent;
|
|
37
|
+
}
|
|
38
|
+
/** Open the gRPC channel + subscription stream and start the reader. */
|
|
39
|
+
static connect(gatewayUrl, opts) {
|
|
40
|
+
const agent = {
|
|
41
|
+
orgId: opts.orgId,
|
|
42
|
+
teamId: opts.teamId,
|
|
43
|
+
agentId: opts.agentId,
|
|
44
|
+
};
|
|
45
|
+
const client = opts.clientFactory
|
|
46
|
+
? opts.clientFactory()
|
|
47
|
+
: new policy_js_1.PolicyServiceClient(gatewayUrl, opts.credentials ?? grpc_js_1.credentials.createInsecure());
|
|
48
|
+
const subscriber = new OpControlSubscriber(client, agent);
|
|
49
|
+
subscriber.start();
|
|
50
|
+
return subscriber;
|
|
51
|
+
}
|
|
52
|
+
/** Open the stream and wire reader handlers. Public so tests can call
|
|
53
|
+
* directly after constructing with a hand-rolled client.
|
|
54
|
+
*/
|
|
55
|
+
start() {
|
|
56
|
+
this.call = this.client.opControlStream({ agentId: this.agent });
|
|
57
|
+
this.call.on("data", (msg) => this.dispatch(msg));
|
|
58
|
+
this.call.on("error", () => this.markStreamDead());
|
|
59
|
+
this.call.on("end", () => this.markStreamDead());
|
|
60
|
+
}
|
|
61
|
+
dispatch(msg) {
|
|
62
|
+
const state = this.slot(msg.opId);
|
|
63
|
+
switch (msg.signal) {
|
|
64
|
+
case policy_js_1.OpControlSignal.OP_CONTROL_SIGNAL_PAUSE:
|
|
65
|
+
state.paused = true;
|
|
66
|
+
break;
|
|
67
|
+
case policy_js_1.OpControlSignal.OP_CONTROL_SIGNAL_RESUME:
|
|
68
|
+
state.paused = false;
|
|
69
|
+
this.flushResolvers(state);
|
|
70
|
+
break;
|
|
71
|
+
case policy_js_1.OpControlSignal.OP_CONTROL_SIGNAL_TERMINATE:
|
|
72
|
+
state.terminated = true;
|
|
73
|
+
this.flushResolvers(state);
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
// UNSPECIFIED / UNRECOGNIZED — drop on the floor.
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
slot(opId) {
|
|
81
|
+
let state = this.ops.get(opId);
|
|
82
|
+
if (!state) {
|
|
83
|
+
state = { paused: false, terminated: false, resolvers: [] };
|
|
84
|
+
this.ops.set(opId, state);
|
|
85
|
+
}
|
|
86
|
+
return state;
|
|
87
|
+
}
|
|
88
|
+
flushResolvers(state) {
|
|
89
|
+
const pending = state.resolvers;
|
|
90
|
+
state.resolvers = [];
|
|
91
|
+
for (const resolve of pending)
|
|
92
|
+
resolve();
|
|
93
|
+
}
|
|
94
|
+
markStreamDead() {
|
|
95
|
+
this.alive = false;
|
|
96
|
+
// Wake any blocked waiters so they can re-check state.
|
|
97
|
+
for (const state of this.ops.values())
|
|
98
|
+
this.flushResolvers(state);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Block until `opId` is runnable, or reject on terminate.
|
|
102
|
+
*
|
|
103
|
+
* Resolves immediately when the op is not currently paused. When paused,
|
|
104
|
+
* waits up to `timeoutMs` for a resume signal. Rejects with
|
|
105
|
+
* {@link OpTerminatedError} if the op has been (or becomes) terminated.
|
|
106
|
+
*
|
|
107
|
+
* A timeout resolves normally — the caller can inspect {@link isPaused}
|
|
108
|
+
* or retry. Matches the cooperative-pause expectation in the architecture
|
|
109
|
+
* doc (the SDK yields, it doesn't deadline-enforce).
|
|
110
|
+
*/
|
|
111
|
+
async waitForOp(opId, opts = {}) {
|
|
112
|
+
const state = this.slot(opId);
|
|
113
|
+
if (state.terminated) {
|
|
114
|
+
throw new op_terminated_error_js_1.OpTerminatedError(`op ${opId} was terminated by the gateway`, opId);
|
|
115
|
+
}
|
|
116
|
+
if (!state.paused)
|
|
117
|
+
return;
|
|
118
|
+
await new Promise((resolve) => {
|
|
119
|
+
state.resolvers.push(resolve);
|
|
120
|
+
if (opts.timeoutMs !== undefined) {
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
// Remove this resolver from the queue + resolve so the await unblocks.
|
|
123
|
+
const idx = state.resolvers.indexOf(resolve);
|
|
124
|
+
if (idx !== -1)
|
|
125
|
+
state.resolvers.splice(idx, 1);
|
|
126
|
+
resolve();
|
|
127
|
+
}, opts.timeoutMs);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (state.terminated) {
|
|
131
|
+
throw new op_terminated_error_js_1.OpTerminatedError(`op ${opId} was terminated by the gateway`, opId);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
isPaused(opId) {
|
|
135
|
+
return this.ops.get(opId)?.paused ?? false;
|
|
136
|
+
}
|
|
137
|
+
isTerminated(opId) {
|
|
138
|
+
return this.ops.get(opId)?.terminated ?? false;
|
|
139
|
+
}
|
|
140
|
+
streamAlive() {
|
|
141
|
+
return this.alive;
|
|
142
|
+
}
|
|
143
|
+
/** Cancel the stream and clean up. */
|
|
144
|
+
close() {
|
|
145
|
+
this.call?.cancel();
|
|
146
|
+
this.client.close?.();
|
|
147
|
+
this.markStreamDead();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.OpControlSubscriber = OpControlSubscriber;
|