@spine-event-engine/server 2.0.0-snapshot.21 → 2.0.0-snapshot.23
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 +104 -7
- package/REFERENCE.md +199 -19
- package/dist/agent/agent-admission.d.ts +80 -0
- package/dist/agent/agent-admission.d.ts.map +1 -0
- package/dist/agent/agent-admission.js +127 -0
- package/dist/agent/agent-admission.js.map +1 -0
- package/dist/agent/agent-ai-binding.d.ts +24 -0
- package/dist/agent/agent-ai-binding.d.ts.map +1 -0
- package/dist/agent/agent-ai-binding.js +48 -0
- package/dist/agent/agent-ai-binding.js.map +1 -0
- package/dist/agent/agent-ai-runtime.d.ts +76 -0
- package/dist/agent/agent-ai-runtime.d.ts.map +1 -0
- package/dist/agent/agent-ai-runtime.js +1269 -0
- package/dist/agent/agent-ai-runtime.js.map +1 -0
- package/dist/agent/agent-execution-capacity.d.ts +43 -0
- package/dist/agent/agent-execution-capacity.d.ts.map +1 -0
- package/dist/agent/agent-execution-capacity.js +147 -0
- package/dist/agent/agent-execution-capacity.js.map +1 -0
- package/dist/agent/agent-execution-fault.d.ts +18 -0
- package/dist/agent/agent-execution-fault.d.ts.map +1 -0
- package/dist/agent/agent-execution-fault.js +31 -0
- package/dist/agent/agent-execution-fault.js.map +1 -0
- package/dist/agent/agent-execution-session.d.ts +103 -0
- package/dist/agent/agent-execution-session.d.ts.map +1 -0
- package/dist/agent/agent-execution-session.js +238 -0
- package/dist/agent/agent-execution-session.js.map +1 -0
- package/dist/agent/agent-history.d.ts +148 -0
- package/dist/agent/agent-history.d.ts.map +1 -0
- package/dist/agent/agent-history.js +340 -0
- package/dist/agent/agent-history.js.map +1 -0
- package/dist/agent/agent-interaction-audit.d.ts +58 -0
- package/dist/agent/agent-interaction-audit.d.ts.map +1 -0
- package/dist/agent/agent-interaction-audit.js +114 -0
- package/dist/agent/agent-interaction-audit.js.map +1 -0
- package/dist/agent/agent-interaction-events.d.ts +40 -0
- package/dist/agent/agent-interaction-events.d.ts.map +1 -0
- package/dist/agent/agent-interaction-events.js +129 -0
- package/dist/agent/agent-interaction-events.js.map +1 -0
- package/dist/agent/agent-mcp-budget.d.ts +125 -0
- package/dist/agent/agent-mcp-budget.d.ts.map +1 -0
- package/dist/agent/agent-mcp-budget.js +566 -0
- package/dist/agent/agent-mcp-budget.js.map +1 -0
- package/dist/agent/agent-mcp-host.d.ts +125 -0
- package/dist/agent/agent-mcp-host.d.ts.map +1 -0
- package/dist/agent/agent-mcp-host.js +15 -0
- package/dist/agent/agent-mcp-host.js.map +1 -0
- package/dist/agent/agent-mcp-runtime.d.ts +199 -0
- package/dist/agent/agent-mcp-runtime.d.ts.map +1 -0
- package/dist/agent/agent-mcp-runtime.js +621 -0
- package/dist/agent/agent-mcp-runtime.js.map +1 -0
- package/dist/agent/agent-model-selection.d.ts +129 -0
- package/dist/agent/agent-model-selection.d.ts.map +1 -0
- package/dist/agent/agent-model-selection.js +342 -0
- package/dist/agent/agent-model-selection.js.map +1 -0
- package/dist/agent/agent-read-runtime.d.ts +70 -0
- package/dist/agent/agent-read-runtime.d.ts.map +1 -0
- package/dist/agent/agent-read-runtime.js +320 -0
- package/dist/agent/agent-read-runtime.js.map +1 -0
- package/dist/agent/agent-revisions.d.ts +35 -0
- package/dist/agent/agent-revisions.d.ts.map +1 -0
- package/dist/agent/agent-revisions.js +133 -0
- package/dist/agent/agent-revisions.js.map +1 -0
- package/dist/agent/agent-scheduler.d.ts +99 -0
- package/dist/agent/agent-scheduler.d.ts.map +1 -0
- package/dist/agent/agent-scheduler.js +398 -0
- package/dist/agent/agent-scheduler.js.map +1 -0
- package/dist/bus/command-bus.d.ts +62 -0
- package/dist/bus/command-bus.d.ts.map +1 -1
- package/dist/bus/command-bus.js +51 -2
- package/dist/bus/command-bus.js.map +1 -1
- package/dist/bus/event-bus.d.ts +137 -3
- package/dist/bus/event-bus.d.ts.map +1 -1
- package/dist/bus/event-bus.js +133 -2
- package/dist/bus/event-bus.js.map +1 -1
- package/dist/bus/saved-dispatcher-binding.d.ts +96 -0
- package/dist/bus/saved-dispatcher-binding.d.ts.map +1 -0
- package/dist/bus/saved-dispatcher-binding.js +35 -0
- package/dist/bus/saved-dispatcher-binding.js.map +1 -0
- package/dist/context/bounded-context.d.ts +36 -2
- package/dist/context/bounded-context.d.ts.map +1 -1
- package/dist/context/bounded-context.js +253 -54
- package/dist/context/bounded-context.js.map +1 -1
- package/dist/context/entity-inbox.d.ts.map +1 -1
- package/dist/context/entity-inbox.js +5 -5
- package/dist/context/entity-inbox.js.map +1 -1
- package/dist/context/projection-handoff.d.ts.map +1 -1
- package/dist/context/projection-handoff.js +2 -1
- package/dist/context/projection-handoff.js.map +1 -1
- package/dist/context/tenant-index.d.ts +25 -0
- package/dist/context/tenant-index.d.ts.map +1 -1
- package/dist/context/tenant-index.js +45 -1
- package/dist/context/tenant-index.js.map +1 -1
- package/dist/delivery/delivery.d.ts.map +1 -1
- package/dist/delivery/delivery.js +4 -3
- package/dist/delivery/delivery.js.map +1 -1
- package/dist/delivery/inbox-records.d.ts +13 -0
- package/dist/delivery/inbox-records.d.ts.map +1 -1
- package/dist/delivery/inbox-records.js +204 -30
- package/dist/delivery/inbox-records.js.map +1 -1
- package/dist/delivery/inbox-storage.d.ts.map +1 -1
- package/dist/delivery/inbox-storage.js +26 -5
- package/dist/delivery/inbox-storage.js.map +1 -1
- package/dist/delivery/inbox.d.ts +7 -7
- package/dist/delivery/inbox.d.ts.map +1 -1
- package/dist/delivery/inbox.js +1 -2
- package/dist/delivery/inbox.js.map +1 -1
- package/dist/delivery/sharded-work-registry.d.ts +1 -0
- package/dist/delivery/sharded-work-registry.d.ts.map +1 -1
- package/dist/delivery/sharded-work-registry.js +3 -1
- package/dist/delivery/sharded-work-registry.js.map +1 -1
- package/dist/entity/entity-transaction.d.ts.map +1 -1
- package/dist/entity/entity-transaction.js +2 -6
- package/dist/entity/entity-transaction.js.map +1 -1
- package/dist/entity/entity.d.ts +82 -3
- package/dist/entity/entity.d.ts.map +1 -1
- package/dist/entity/entity.js +121 -22
- package/dist/entity/entity.js.map +1 -1
- package/dist/handler/generated-handler-registry.js +8 -3
- package/dist/handler/generated-handler-registry.js.map +1 -1
- package/dist/handler/handler-metadata.d.ts +17 -1
- package/dist/handler/handler-metadata.d.ts.map +1 -1
- package/dist/handler/handler-metadata.js +10 -4
- package/dist/handler/handler-metadata.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/integration/third-party-context.d.ts +5 -0
- package/dist/integration/third-party-context.d.ts.map +1 -1
- package/dist/integration/third-party-context.js +7 -6
- package/dist/integration/third-party-context.js.map +1 -1
- package/dist/repository/commit-fence.d.ts +11 -0
- package/dist/repository/commit-fence.d.ts.map +1 -1
- package/dist/repository/commit-fence.js +13 -0
- package/dist/repository/commit-fence.js.map +1 -1
- package/dist/repository/repository.d.ts +222 -13
- package/dist/repository/repository.d.ts.map +1 -1
- package/dist/repository/repository.js +2329 -137
- package/dist/repository/repository.js.map +1 -1
- package/dist/runtime/signal-metadata.d.ts +7 -47
- package/dist/runtime/signal-metadata.d.ts.map +1 -1
- package/dist/runtime/signal-metadata.js +8 -62
- package/dist/runtime/signal-metadata.js.map +1 -1
- package/dist/runtime/signal-publisher.d.ts +6 -0
- package/dist/runtime/signal-publisher.d.ts.map +1 -1
- package/dist/runtime/signal-publisher.js +13 -0
- package/dist/runtime/signal-publisher.js.map +1 -1
- package/dist/runtime/standalone-handler-runtime.d.ts +7 -0
- package/dist/runtime/standalone-handler-runtime.d.ts.map +1 -1
- package/dist/runtime/standalone-handler-runtime.js +148 -11
- package/dist/runtime/standalone-handler-runtime.js.map +1 -1
- package/dist/server/managed-server-application.d.ts +36 -6
- package/dist/server/managed-server-application.d.ts.map +1 -1
- package/dist/server/managed-server-application.js +257 -4
- package/dist/server/managed-server-application.js.map +1 -1
- package/dist/server/server.d.ts +9 -0
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +13 -1
- package/dist/server/server.js.map +1 -1
- package/dist/stand/subscription-registry.d.ts.map +1 -1
- package/dist/stand/subscription-registry.js +9 -8
- package/dist/stand/subscription-registry.js.map +1 -1
- package/dist/testing/index.d.ts +57 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +87 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -12
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { AiFailure, AiRegistry, AiScope } from "@spine-event-engine/ai";
|
|
2
|
+
import type { AiBackendDefinition, AiMcpMessageRequest, AiMcpMessageTicket, AiToolInvocation } from "@spine-event-engine/ai/spi/adapter";
|
|
3
|
+
import type { AgentHistoryEntry, ToolRequest, ToolResponse } from "@spine-event-engine/proto/agent";
|
|
4
|
+
import type { AgentNamedOperation } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
5
|
+
import type { AgentExecutionSession } from "./agent-execution-session.js";
|
|
6
|
+
/**
|
|
7
|
+
* Result of checking a persisted tool intent before any physical send.
|
|
8
|
+
*/
|
|
9
|
+
export type AgentMcpIntent = {
|
|
10
|
+
/**
|
|
11
|
+
* Identifies an admitted intent that has not dispatched.
|
|
12
|
+
*/
|
|
13
|
+
readonly kind: "new";
|
|
14
|
+
/**
|
|
15
|
+
* Durable logical call identity.
|
|
16
|
+
*/
|
|
17
|
+
readonly callId: string;
|
|
18
|
+
} | {
|
|
19
|
+
/**
|
|
20
|
+
* Identifies a saved completed call.
|
|
21
|
+
*/
|
|
22
|
+
readonly kind: "replay";
|
|
23
|
+
/**
|
|
24
|
+
* Original saved tool response.
|
|
25
|
+
*/
|
|
26
|
+
readonly response: ToolResponse;
|
|
27
|
+
} | {
|
|
28
|
+
/**
|
|
29
|
+
* Identifies a write whose physical outcome cannot be proven.
|
|
30
|
+
*/
|
|
31
|
+
readonly kind: "unknown";
|
|
32
|
+
/**
|
|
33
|
+
* Safe refusal to resend the original write.
|
|
34
|
+
*/
|
|
35
|
+
readonly response: ToolResponse;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Single budget and fenced journal authority supplied to the MCP runtime.
|
|
39
|
+
*/
|
|
40
|
+
export interface AgentMcpHost {
|
|
41
|
+
/**
|
|
42
|
+
* Accepted actor, source, Bounded Context, and tenant.
|
|
43
|
+
*/
|
|
44
|
+
readonly scope: AiScope;
|
|
45
|
+
/**
|
|
46
|
+
* Registered MCP server definitions.
|
|
47
|
+
*/
|
|
48
|
+
readonly registry: AiRegistry;
|
|
49
|
+
/**
|
|
50
|
+
* Selected backend with an optional MCP protocol factory.
|
|
51
|
+
*/
|
|
52
|
+
readonly backend: AiBackendDefinition;
|
|
53
|
+
/**
|
|
54
|
+
* Saved named operation for this tool chain.
|
|
55
|
+
*/
|
|
56
|
+
readonly operation: AgentNamedOperation;
|
|
57
|
+
/**
|
|
58
|
+
* Fenced invocation journal.
|
|
59
|
+
*/
|
|
60
|
+
readonly session: AgentExecutionSession;
|
|
61
|
+
/**
|
|
62
|
+
* Cancellation signal for the active claim.
|
|
63
|
+
*/
|
|
64
|
+
readonly signal: AbortSignal;
|
|
65
|
+
/**
|
|
66
|
+
* Original absolute operation deadline.
|
|
67
|
+
*/
|
|
68
|
+
readonly deadlineEpochMs?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Persists full shared input/output credit before an MCP physical send.
|
|
71
|
+
*
|
|
72
|
+
* @param server Configured MCP server identifier.
|
|
73
|
+
* @param request Physical protocol message and byte bounds.
|
|
74
|
+
* @returns Fenced ticket for the physical send.
|
|
75
|
+
*/
|
|
76
|
+
reserveMessage(server: string, request: AiMcpMessageRequest): Promise<AiMcpMessageTicket>;
|
|
77
|
+
/**
|
|
78
|
+
* Checks a received chunk synchronously against its persisted credit.
|
|
79
|
+
*
|
|
80
|
+
* @param ticketId Saved physical-message ticket.
|
|
81
|
+
* @param bytes Newly decoded response bytes.
|
|
82
|
+
*/
|
|
83
|
+
onReceived(ticketId: string, bytes: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* Persists known receipt; uncertain credits remain charged.
|
|
86
|
+
*
|
|
87
|
+
* @param ticketId Saved physical-message ticket.
|
|
88
|
+
* @param receivedBytes Complete decoded response size, when known.
|
|
89
|
+
* @returns When the receipt is persisted.
|
|
90
|
+
*/
|
|
91
|
+
finishMessage(ticketId: string, receivedBytes?: number): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Checks shared tool count and persists intent before a write dispatch.
|
|
94
|
+
*
|
|
95
|
+
* @param invocation Model proposal and provider call identity.
|
|
96
|
+
* @param request Vetted server, tool, arguments, and effect.
|
|
97
|
+
* @returns Saved or newly allocated tool intent.
|
|
98
|
+
*/
|
|
99
|
+
journalToolIntent(invocation: AiToolInvocation, request: Pick<ToolRequest, "server" | "tool" | "argumentsJson" | "effect">): Promise<AgentMcpIntent>;
|
|
100
|
+
/**
|
|
101
|
+
* Persists the physical-dispatch boundary under the current claim.
|
|
102
|
+
*
|
|
103
|
+
* @param callId Saved logical tool-call identity.
|
|
104
|
+
* @returns When the dispatch marker is persisted.
|
|
105
|
+
*/
|
|
106
|
+
markToolDispatched(callId: string): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Persists a complete tool response before model continuation.
|
|
109
|
+
*
|
|
110
|
+
* @param callId Saved logical tool-call identity.
|
|
111
|
+
* @param response Bounded tool result.
|
|
112
|
+
* @param history Typed conversation row retained with the result.
|
|
113
|
+
* @returns When the fenced result and history are persisted.
|
|
114
|
+
*/
|
|
115
|
+
finishTool(callId: string, response: ToolResponse, history: AgentHistoryEntry): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Persists a safe nonterminal diagnostic before returning it to an adapter.
|
|
118
|
+
*
|
|
119
|
+
* @param code Safe failure category.
|
|
120
|
+
* @param retryableByNewSignal Whether a later signal may retry the logical work.
|
|
121
|
+
* @returns Persisted diagnostic identity and category.
|
|
122
|
+
*/
|
|
123
|
+
recordFailure(code: AiFailure["code"], retryableByNewSignal: boolean): Promise<AiFailure>;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=agent-mcp-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-mcp-host.d.ts","sourceRoot":"","sources":["../../src/agent/agent-mcp-host.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpG,OAAO,KAAK,EACV,mBAAmB,EACpB,MAAM,+EAA+E,CAAC;AACvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB;IACE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IACE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;CACjC,GACD;IACE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;CACjC,CAAC;AAEN;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,OAA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rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=agent-mcp-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-mcp-host.js","sourceRoot":"","sources":["../../src/agent/agent-mcp-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { AiToolRef } from "@spine-event-engine/ai";
|
|
2
|
+
import type { AiMcpAdvertisedTool, AiToolInvocation } from "@spine-event-engine/ai/spi/adapter";
|
|
3
|
+
import { type ToolResponse } from "@spine-event-engine/proto/agent";
|
|
4
|
+
import type { AgentMcpHost } from "./agent-mcp-host.js";
|
|
5
|
+
/**
|
|
6
|
+
* Executes one selected MCP catalog and its calls under the shared Agent journal.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AgentMcpRuntime {
|
|
9
|
+
private readonly host;
|
|
10
|
+
private readonly allowedTools;
|
|
11
|
+
/**
|
|
12
|
+
* Connected protocol sessions indexed by registered server ID.
|
|
13
|
+
*/
|
|
14
|
+
private readonly sessions;
|
|
15
|
+
/**
|
|
16
|
+
* Cancellation for all callbacks and protocol sessions in this invocation.
|
|
17
|
+
*/
|
|
18
|
+
private readonly closed;
|
|
19
|
+
/**
|
|
20
|
+
* Shared discovery result for concurrent prepare callers.
|
|
21
|
+
*/
|
|
22
|
+
private prepared?;
|
|
23
|
+
/**
|
|
24
|
+
* Shared completion for all callers closing this invocation.
|
|
25
|
+
*/
|
|
26
|
+
private closing?;
|
|
27
|
+
/**
|
|
28
|
+
* Binds one accepted capability tool list to the active fenced operation.
|
|
29
|
+
*
|
|
30
|
+
* @param host Shared budget, session and diagnostic authority.
|
|
31
|
+
* @param allowedTools Capability tools in declared order.
|
|
32
|
+
*/
|
|
33
|
+
constructor(host: AgentMcpHost, allowedTools: readonly AiToolRef[]);
|
|
34
|
+
/**
|
|
35
|
+
* Prepares the exact configured catalog before a model request is prepared.
|
|
36
|
+
*
|
|
37
|
+
* @returns Immutable descriptions and schemas in capability order.
|
|
38
|
+
*/
|
|
39
|
+
prepare(): Promise<readonly AiMcpAdvertisedTool[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Validates and executes one model-proposed call through persisted intent.
|
|
42
|
+
*
|
|
43
|
+
* @param invocation Correlated model proposal with canonical arguments.
|
|
44
|
+
* @returns Saved or newly journaled bounded tool response.
|
|
45
|
+
*/
|
|
46
|
+
call(invocation: AiToolInvocation): Promise<ToolResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Checks one registered tool authorization callback before intent is saved.
|
|
49
|
+
*
|
|
50
|
+
* @param call Model-proposed tool call.
|
|
51
|
+
* @param policy Registered tool policy.
|
|
52
|
+
* @param argumentsObject Parsed JSON object arguments.
|
|
53
|
+
* @returns Allowed, denied or unavailable authorization state.
|
|
54
|
+
*/
|
|
55
|
+
private authorize;
|
|
56
|
+
/**
|
|
57
|
+
* Cancels pending work and attempts bounded cleanup of connected protocol sessions.
|
|
58
|
+
*
|
|
59
|
+
* @returns Shared completion, rejecting if cleanup fails or exceeds the deadline.
|
|
60
|
+
*/
|
|
61
|
+
close(): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Cancels callbacks and bounds the wait for connected protocol sessions.
|
|
64
|
+
*
|
|
65
|
+
* @returns Shared cleanup completion or a safe rejection.
|
|
66
|
+
*/
|
|
67
|
+
private closeSessions;
|
|
68
|
+
/**
|
|
69
|
+
* Lists registry-approved servers without making a connection.
|
|
70
|
+
*
|
|
71
|
+
* @returns Exact servers and configured tools.
|
|
72
|
+
*/
|
|
73
|
+
private selected;
|
|
74
|
+
/**
|
|
75
|
+
* Prepares every selected server under bounded authorization.
|
|
76
|
+
*
|
|
77
|
+
* @returns Catalog in capability order.
|
|
78
|
+
*/
|
|
79
|
+
private prepareAll;
|
|
80
|
+
/**
|
|
81
|
+
* Checks discovered definitions against configured names without advertising extras.
|
|
82
|
+
*
|
|
83
|
+
* @param id Registered server ID.
|
|
84
|
+
* @param allowed Configured tool names.
|
|
85
|
+
* @param found Bounded discovery result.
|
|
86
|
+
* @param definitions Accumulated exact catalog.
|
|
87
|
+
*/
|
|
88
|
+
private collectDefinitions;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the exact discovered catalog in capability order.
|
|
91
|
+
*
|
|
92
|
+
* @param definitions Checked descriptions and schemas by configured reference.
|
|
93
|
+
* @returns Immutable catalog in capability order.
|
|
94
|
+
*/
|
|
95
|
+
private orderedCatalog;
|
|
96
|
+
/**
|
|
97
|
+
* Connects one authorized server and checks its credential-free identity.
|
|
98
|
+
*
|
|
99
|
+
* @param server Registered server configuration.
|
|
100
|
+
* @returns Scoped protocol session.
|
|
101
|
+
*/
|
|
102
|
+
private connect;
|
|
103
|
+
/**
|
|
104
|
+
* Rejects identity drift after attempting bounded cleanup of the session.
|
|
105
|
+
*
|
|
106
|
+
* @param server Registered server configuration.
|
|
107
|
+
* @param session Newly connected protocol session.
|
|
108
|
+
* @param timeout Local callback timeout in milliseconds.
|
|
109
|
+
* @returns Completion after identity verification.
|
|
110
|
+
*/
|
|
111
|
+
private checkConnectionIdentity;
|
|
112
|
+
/**
|
|
113
|
+
* Resolves scoped credentials without adding them to recorded identity.
|
|
114
|
+
*
|
|
115
|
+
* @param server Registered server configuration.
|
|
116
|
+
* @returns Headers or child environment for connection construction.
|
|
117
|
+
*/
|
|
118
|
+
private resolve;
|
|
119
|
+
/**
|
|
120
|
+
* Reads the finite callback bound from application registration.
|
|
121
|
+
*
|
|
122
|
+
* @returns Callback timeout in milliseconds.
|
|
123
|
+
*/
|
|
124
|
+
private hookTimeout;
|
|
125
|
+
/**
|
|
126
|
+
* Binds protocol reservations and receipts to the shared budget.
|
|
127
|
+
*
|
|
128
|
+
* @param server Registered server ID.
|
|
129
|
+
* @param control Bounded connection control.
|
|
130
|
+
* @returns Protocol controls scoped to this operation.
|
|
131
|
+
*/
|
|
132
|
+
private protocol;
|
|
133
|
+
/**
|
|
134
|
+
* Checks whether the capability listed this exact tool reference.
|
|
135
|
+
*
|
|
136
|
+
* @param call Model-proposed tool reference.
|
|
137
|
+
* @returns Whether the tool is in the configured allowlist.
|
|
138
|
+
*/
|
|
139
|
+
private isAllowed;
|
|
140
|
+
/**
|
|
141
|
+
* Finds a registered server by ID.
|
|
142
|
+
*
|
|
143
|
+
* @param id Registered server ID.
|
|
144
|
+
* @returns Server definition, or absence for an unknown ID.
|
|
145
|
+
*/
|
|
146
|
+
private serverFor;
|
|
147
|
+
/**
|
|
148
|
+
* Records intent, dispatches once and persists the resulting response.
|
|
149
|
+
*
|
|
150
|
+
* @param call Correlated model proposal.
|
|
151
|
+
* @param session Checked protocol session.
|
|
152
|
+
* @param policy Registered tool policy.
|
|
153
|
+
* @returns Saved or newly persisted response.
|
|
154
|
+
*/
|
|
155
|
+
private dispatch;
|
|
156
|
+
/**
|
|
157
|
+
* Performs a bounded call and preserves uncertainty for failed writes.
|
|
158
|
+
*
|
|
159
|
+
* @param call Correlated model proposal.
|
|
160
|
+
* @param session Checked protocol session.
|
|
161
|
+
* @param policy Registered tool policy.
|
|
162
|
+
* @param callId Runtime-allocated tool call ID.
|
|
163
|
+
* @returns Supported result or recorded safe failure.
|
|
164
|
+
*/
|
|
165
|
+
private perform;
|
|
166
|
+
/**
|
|
167
|
+
* Converts supported text and structured JSON with the MCP error flag.
|
|
168
|
+
*
|
|
169
|
+
* @param callId Runtime-allocated tool call ID.
|
|
170
|
+
* @param result Bounded protocol result.
|
|
171
|
+
* @returns Domain tool response.
|
|
172
|
+
*/
|
|
173
|
+
private response;
|
|
174
|
+
/**
|
|
175
|
+
* Records a failed proposal without fabricating an authorized request.
|
|
176
|
+
*
|
|
177
|
+
* @param code Safe failure category.
|
|
178
|
+
* @returns Failed response with a persisted diagnostic reference.
|
|
179
|
+
*/
|
|
180
|
+
private rejected;
|
|
181
|
+
/**
|
|
182
|
+
* Creates response history for one completed tool intent.
|
|
183
|
+
*
|
|
184
|
+
* @param response Persisted tool response.
|
|
185
|
+
* @returns Conversation record wrapped as an Agent history entry.
|
|
186
|
+
*/
|
|
187
|
+
private history;
|
|
188
|
+
/**
|
|
189
|
+
* Executes one callback within the operation and local deadline.
|
|
190
|
+
*
|
|
191
|
+
* @typeParam T Callback result type.
|
|
192
|
+
* @param run Callback with a child cancellation control.
|
|
193
|
+
* @param limitMs Configured local timeout in milliseconds.
|
|
194
|
+
* @param onLate Cleanup for a resource created after cancellation.
|
|
195
|
+
* @returns Callback result before the deadline.
|
|
196
|
+
*/
|
|
197
|
+
private bounded;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=agent-mcp-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-mcp-runtime.d.ts","sourceRoot":"","sources":["../../src/agent/agent-mcp-runtime.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAqB,SAAS,EAAuB,MAAM,wBAAwB,CAAC;AAMhG,OAAO,KAAK,EACV,mBAAmB,EAInB,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAYL,KAAK,YAAY,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA6BxD;;GAEG;AACH,qBAAa,eAAe;IA4BxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,Y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