@aria-cli/tools 1.0.9 → 1.0.11
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/package.json +9 -5
- package/src/__tests__/web-fetch-download.test.ts +0 -433
- package/src/__tests__/web-tools.test.ts +0 -619
- package/src/ask-user-interaction.ts +0 -33
- package/src/cache/web-cache.ts +0 -110
- package/src/definitions/arion.ts +0 -118
- package/src/definitions/browser/browser.ts +0 -502
- package/src/definitions/browser/index.ts +0 -5
- package/src/definitions/browser/pw-downloads.ts +0 -142
- package/src/definitions/browser/pw-interactions.ts +0 -282
- package/src/definitions/browser/pw-responses.ts +0 -98
- package/src/definitions/browser/pw-session.ts +0 -405
- package/src/definitions/browser/pw-shared.ts +0 -85
- package/src/definitions/browser/pw-snapshot.ts +0 -383
- package/src/definitions/browser/pw-state.ts +0 -101
- package/src/definitions/browser/types.ts +0 -203
- package/src/definitions/code-intelligence.ts +0 -526
- package/src/definitions/core.ts +0 -118
- package/src/definitions/delegation.ts +0 -567
- package/src/definitions/deploy.ts +0 -73
- package/src/definitions/filesystem.ts +0 -217
- package/src/definitions/frg.ts +0 -67
- package/src/definitions/index.ts +0 -28
- package/src/definitions/memory.ts +0 -150
- package/src/definitions/messaging.ts +0 -734
- package/src/definitions/meta.ts +0 -392
- package/src/definitions/network.ts +0 -179
- package/src/definitions/outlook.ts +0 -318
- package/src/definitions/patch/apply-patch.ts +0 -235
- package/src/definitions/patch/fuzzy-match.ts +0 -217
- package/src/definitions/patch/index.ts +0 -1
- package/src/definitions/patch/patch-parser.ts +0 -297
- package/src/definitions/patch/sandbox-paths.ts +0 -129
- package/src/definitions/process/index.ts +0 -5
- package/src/definitions/process/process-registry.ts +0 -303
- package/src/definitions/process/process.ts +0 -456
- package/src/definitions/process/pty-keys.ts +0 -298
- package/src/definitions/process/session-slug.ts +0 -147
- package/src/definitions/quip.ts +0 -225
- package/src/definitions/search.ts +0 -67
- package/src/definitions/session-history.ts +0 -79
- package/src/definitions/shell.ts +0 -202
- package/src/definitions/slack.ts +0 -211
- package/src/definitions/web.ts +0 -119
- package/src/executors/apply-patch.ts +0 -1035
- package/src/executors/arion.ts +0 -199
- package/src/executors/code-intelligence.ts +0 -1179
- package/src/executors/deploy.ts +0 -1066
- package/src/executors/filesystem.ts +0 -1428
- package/src/executors/frg-freshness.ts +0 -743
- package/src/executors/frg.ts +0 -394
- package/src/executors/index.ts +0 -280
- package/src/executors/learning-meta.ts +0 -1367
- package/src/executors/lsp-client.ts +0 -355
- package/src/executors/memory.ts +0 -978
- package/src/executors/meta.ts +0 -293
- package/src/executors/process-registry.ts +0 -570
- package/src/executors/pty-session-store.ts +0 -43
- package/src/executors/pty.ts +0 -342
- package/src/executors/restart.ts +0 -133
- package/src/executors/search-freshness.ts +0 -249
- package/src/executors/search-types.ts +0 -98
- package/src/executors/search.ts +0 -89
- package/src/executors/self-diagnose.ts +0 -552
- package/src/executors/session-history.ts +0 -435
- package/src/executors/shell-safety.ts +0 -519
- package/src/executors/shell.ts +0 -1243
- package/src/executors/utils.ts +0 -40
- package/src/executors/web.ts +0 -786
- package/src/extraction/content-extraction.ts +0 -281
- package/src/extraction/index.ts +0 -5
- package/src/headless-control-contract.ts +0 -1149
- package/src/index.ts +0 -788
- package/src/local-control-http-auth.ts +0 -2
- package/src/mcp/client.ts +0 -218
- package/src/mcp/connection.ts +0 -568
- package/src/mcp/index.ts +0 -11
- package/src/mcp/jsonrpc.ts +0 -195
- package/src/mcp/types.ts +0 -199
- package/src/network-control-adapter.ts +0 -88
- package/src/network-runtime/address-types.ts +0 -218
- package/src/network-runtime/db-owner-fencing.ts +0 -91
- package/src/network-runtime/delivery-receipts.ts +0 -372
- package/src/network-runtime/direct-endpoint-authority.ts +0 -35
- package/src/network-runtime/index.ts +0 -316
- package/src/network-runtime/local-control-contract.ts +0 -784
- package/src/network-runtime/node-store-contract.ts +0 -46
- package/src/network-runtime/pair-route-contract.ts +0 -97
- package/src/network-runtime/peer-capabilities.ts +0 -48
- package/src/network-runtime/peer-principal-ref.ts +0 -20
- package/src/network-runtime/peer-state-machine.ts +0 -160
- package/src/network-runtime/protocol-schemas.ts +0 -265
- package/src/network-runtime/runtime-bootstrap-contract.ts +0 -83
- package/src/outlook/desktop-session.ts +0 -409
- package/src/policy.ts +0 -171
- package/src/providers/brave.ts +0 -80
- package/src/providers/duckduckgo.ts +0 -199
- package/src/providers/exa.ts +0 -85
- package/src/providers/firecrawl.ts +0 -77
- package/src/providers/index.ts +0 -8
- package/src/providers/jina.ts +0 -70
- package/src/providers/router.ts +0 -121
- package/src/providers/search-provider.ts +0 -74
- package/src/providers/tavily.ts +0 -74
- package/src/quip/desktop-session.ts +0 -435
- package/src/registry/index.ts +0 -1
- package/src/registry/registry.ts +0 -905
- package/src/runtime-socket-local-control-client.ts +0 -632
- package/src/security/dns-normalization.ts +0 -34
- package/src/security/dns-pinning.ts +0 -138
- package/src/security/external-content.ts +0 -129
- package/src/security/ssrf.ts +0 -207
- package/src/slack/desktop-session.ts +0 -493
- package/src/tool-factory.ts +0 -91
- package/src/types.ts +0 -1341
- package/src/utils/retry.ts +0 -163
- package/src/utils/safe-parse-json.ts +0 -176
- package/src/utils/url.ts +0 -20
- package/tests/benchmarks/registry.bench.ts +0 -57
- package/tests/cache/web-cache.test.ts +0 -147
- package/tests/critical-integration.test.ts +0 -1465
- package/tests/definitions/apply-patch.test.ts +0 -586
- package/tests/definitions/browser.test.ts +0 -495
- package/tests/definitions/delegation-pause-resume.test.ts +0 -758
- package/tests/definitions/execution.test.ts +0 -671
- package/tests/definitions/messaging-inbox-scope.test.ts +0 -229
- package/tests/definitions/messaging.test.ts +0 -1468
- package/tests/definitions/outlook.test.ts +0 -30
- package/tests/definitions/process.test.ts +0 -469
- package/tests/definitions/slack.test.ts +0 -28
- package/tests/definitions/tool-inventory.test.ts +0 -218
- package/tests/e2e/delegation-quest-orchestration.e2e.test.ts +0 -433
- package/tests/e2e/memory-tool-discovery-contract.e2e.test.ts +0 -81
- package/tests/executors/apply-patch.test.ts +0 -538
- package/tests/executors/arion.test.ts +0 -309
- package/tests/executors/conversation-primitives.test.ts +0 -250
- package/tests/executors/deploy.test.ts +0 -746
- package/tests/executors/filesystem-tools.test.ts +0 -357
- package/tests/executors/filesystem.test.ts +0 -959
- package/tests/executors/frg-freshness.test.ts +0 -136
- package/tests/executors/frg-merge.test.ts +0 -70
- package/tests/executors/frg-session-content.test.ts +0 -40
- package/tests/executors/frg.test.ts +0 -56
- package/tests/executors/memory-bugfixes.test.ts +0 -257
- package/tests/executors/memory-real-memoria.integration.test.ts +0 -316
- package/tests/executors/memory.test.ts +0 -853
- package/tests/executors/meta-tools.test.ts +0 -411
- package/tests/executors/meta.test.ts +0 -683
- package/tests/executors/path-containment.test.ts +0 -51
- package/tests/executors/process-registry.test.ts +0 -505
- package/tests/executors/pty.test.ts +0 -664
- package/tests/executors/quest-security.test.ts +0 -249
- package/tests/executors/read-file-media.test.ts +0 -230
- package/tests/executors/recall-knowledge-schema.test.ts +0 -209
- package/tests/executors/recall-tags.test.ts +0 -278
- package/tests/executors/remember-null-safety.contract.test.ts +0 -41
- package/tests/executors/restart.test.ts +0 -67
- package/tests/executors/search-unified.test.ts +0 -381
- package/tests/executors/session-history.test.ts +0 -340
- package/tests/executors/session-transcript.test.ts +0 -561
- package/tests/executors/shell-abort.test.ts +0 -416
- package/tests/executors/shell-env-blocklist.test.ts +0 -648
- package/tests/executors/shell-env-process.test.ts +0 -245
- package/tests/executors/shell-process-registry.test.ts +0 -334
- package/tests/executors/shell-tools.test.ts +0 -393
- package/tests/executors/shell.test.ts +0 -690
- package/tests/executors/web-abort-vs-timeout.test.ts +0 -213
- package/tests/executors/web-integration.test.ts +0 -633
- package/tests/executors/web-symlink.test.ts +0 -18
- package/tests/executors/web.test.ts +0 -1400
- package/tests/executors/write-stdin.test.ts +0 -145
- package/tests/extraction/content-extraction.test.ts +0 -153
- package/tests/guards/tools-default-test-lane.integration.test.ts +0 -21
- package/tests/guards/tools-package-test-commands.e2e.test.ts +0 -43
- package/tests/guards/tools-test-lane-manifest.contract.test.ts +0 -76
- package/tests/guards/tools-vitest-workspace-alias.contract.test.ts +0 -63
- package/tests/helpers/async-waits.ts +0 -53
- package/tests/integration/headless-control-contract.integration.test.ts +0 -153
- package/tests/integration/memory-tool-schema-parity.integration.test.ts +0 -67
- package/tests/integration/meta-tools-round-trip.integration.test.ts +0 -506
- package/tests/integration/quest-round-trip.test.ts +0 -303
- package/tests/integration/registry-executor-flow.test.ts +0 -85
- package/tests/integration.test.ts +0 -177
- package/tests/loading-tier.test.ts +0 -126
- package/tests/mcp/client-reconnect.test.ts +0 -267
- package/tests/mcp/connection.test.ts +0 -846
- package/tests/mcp/injectable-logger.test.ts +0 -83
- package/tests/mcp/jsonrpc.test.ts +0 -109
- package/tests/mcp/lifecycle.test.ts +0 -879
- package/tests/network-runtime/address-types.contract.test.ts +0 -143
- package/tests/network-runtime/continuity-bind-schema.contract.test.ts +0 -203
- package/tests/network-runtime/local-control-contract.test.ts +0 -869
- package/tests/network-runtime/local-control-invite-token.contract.test.ts +0 -146
- package/tests/network-runtime/node-store-contract.test.ts +0 -11
- package/tests/network-runtime/pair-protocol-nodeid.contract.test.ts +0 -15
- package/tests/network-runtime/peer-state-machine.contract.test.ts +0 -148
- package/tests/network-runtime/protocol-schemas.contract.test.ts +0 -512
- package/tests/network-runtime/relay-pending-nodeid.contract.test.ts +0 -62
- package/tests/network-runtime/runtime-bootstrap-contract.test.ts +0 -227
- package/tests/network-runtime/runtime-socket-local-control-client.test.ts +0 -621
- package/tests/network-runtime/wait-for-message-script.test.ts +0 -288
- package/tests/parallel.test.ts +0 -71
- package/tests/policy.test.ts +0 -184
- package/tests/print-default-test-lane.ts +0 -14
- package/tests/print-test-lane-manifest.ts +0 -22
- package/tests/providers/brave.test.ts +0 -159
- package/tests/providers/duckduckgo.test.ts +0 -207
- package/tests/providers/exa.test.ts +0 -175
- package/tests/providers/firecrawl.test.ts +0 -168
- package/tests/providers/jina.test.ts +0 -144
- package/tests/providers/router.test.ts +0 -328
- package/tests/providers/tavily.test.ts +0 -165
- package/tests/registry/discovery.test.ts +0 -154
- package/tests/registry/injectable-logger.test.ts +0 -230
- package/tests/registry/input-validation.test.ts +0 -361
- package/tests/registry/interface-completeness.test.ts +0 -85
- package/tests/registry/mcp-integration.test.ts +0 -103
- package/tests/registry/mcp-read-only-hint.test.ts +0 -60
- package/tests/registry/memoria-discovery.test.ts +0 -390
- package/tests/registry/nested-validation.test.ts +0 -283
- package/tests/registry/pseudo-tool-filtering.test.ts +0 -258
- package/tests/registry/registration-lifecycle.test.ts +0 -133
- package/tests/registry-validation.test.ts +0 -424
- package/tests/registry.test.ts +0 -460
- package/tests/security/dns-pinning.test.ts +0 -162
- package/tests/security/external-content.test.ts +0 -144
- package/tests/security/ssrf.test.ts +0 -118
- package/tests/shell-safety-integration.test.ts +0 -32
- package/tests/shell-safety.test.ts +0 -365
- package/tests/slack/desktop-session.test.ts +0 -50
- package/tests/test-lane-manifest.ts +0 -440
- package/tests/test-utils.ts +0 -27
- package/tests/tool-factory.test.ts +0 -188
- package/tests/utils/retry.test.ts +0 -231
- package/tests/utils/url.test.ts +0 -63
- package/tsconfig.cjs.json +0 -24
- package/tsconfig.json +0 -12
- package/vitest.config.ts +0 -55
- package/vitest.e2e.config.ts +0 -24
- package/vitest.integration.config.ts +0 -24
- package/vitest.native.config.ts +0 -24
package/src/mcp/jsonrpc.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON-RPC 2.0 Client for MCP
|
|
3
|
-
*
|
|
4
|
-
* Handles newline-delimited JSON over stdio streams.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { Readable, Writable } from "stream";
|
|
8
|
-
import { EventEmitter } from "events";
|
|
9
|
-
import { randomUUID } from "crypto";
|
|
10
|
-
|
|
11
|
-
interface JSONRPCRequest {
|
|
12
|
-
jsonrpc: "2.0";
|
|
13
|
-
id: string | number;
|
|
14
|
-
method: string;
|
|
15
|
-
params?: unknown;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface JSONRPCResponse {
|
|
19
|
-
jsonrpc: "2.0";
|
|
20
|
-
id: string | number;
|
|
21
|
-
result?: unknown;
|
|
22
|
-
error?: { code: number; message: string; data?: unknown };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface JSONRPCNotification {
|
|
26
|
-
jsonrpc: "2.0";
|
|
27
|
-
method: string;
|
|
28
|
-
params?: unknown;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type PendingRequest = {
|
|
32
|
-
resolve: (value: unknown) => void;
|
|
33
|
-
reject: (error: Error) => void;
|
|
34
|
-
timeout: NodeJS.Timeout;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export class JSONRPCClient extends EventEmitter {
|
|
38
|
-
private stdin?: Writable;
|
|
39
|
-
private stdout?: Readable;
|
|
40
|
-
private pending: Map<string, PendingRequest> = new Map();
|
|
41
|
-
private buffer = "";
|
|
42
|
-
private requestTimeout: number;
|
|
43
|
-
|
|
44
|
-
constructor(options: { timeout?: number } = {}) {
|
|
45
|
-
super();
|
|
46
|
-
this.requestTimeout = options.timeout ?? 30000;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Connect to a process via stdio streams
|
|
51
|
-
*/
|
|
52
|
-
connect(stdin: Writable, stdout: Readable): void {
|
|
53
|
-
this.stdin = stdin;
|
|
54
|
-
this.stdout = stdout;
|
|
55
|
-
|
|
56
|
-
stdout.on("data", (chunk: Buffer) => {
|
|
57
|
-
this.buffer += chunk.toString();
|
|
58
|
-
this.processBuffer();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
stdout.on("error", (error) => {
|
|
62
|
-
this.emit("error", error);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
stdout.on("end", () => {
|
|
66
|
-
this.emit("close");
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
private processBuffer(): void {
|
|
71
|
-
let newlineIdx: number;
|
|
72
|
-
while ((newlineIdx = this.buffer.indexOf("\n")) !== -1) {
|
|
73
|
-
const line = this.buffer.slice(0, newlineIdx).trim();
|
|
74
|
-
this.buffer = this.buffer.slice(newlineIdx + 1);
|
|
75
|
-
|
|
76
|
-
if (line) {
|
|
77
|
-
try {
|
|
78
|
-
this.handleMessage(JSON.parse(line));
|
|
79
|
-
} catch (e) {
|
|
80
|
-
this.emit("error", new Error(`Invalid JSON: ${line}`));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
private handleMessage(msg: unknown): void {
|
|
87
|
-
// Ignore messages that aren't valid JSON-RPC 2.0
|
|
88
|
-
if (
|
|
89
|
-
typeof msg !== "object" ||
|
|
90
|
-
msg === null ||
|
|
91
|
-
!("jsonrpc" in msg) ||
|
|
92
|
-
(msg as { jsonrpc: unknown }).jsonrpc !== "2.0"
|
|
93
|
-
)
|
|
94
|
-
return;
|
|
95
|
-
|
|
96
|
-
const rpcMsg = msg as JSONRPCResponse | JSONRPCNotification;
|
|
97
|
-
|
|
98
|
-
// Response to our request
|
|
99
|
-
if ("id" in rpcMsg && (rpcMsg as JSONRPCResponse).id !== undefined) {
|
|
100
|
-
const response = rpcMsg as JSONRPCResponse;
|
|
101
|
-
const pending = this.pending.get(String(response.id));
|
|
102
|
-
if (pending) {
|
|
103
|
-
this.pending.delete(String(response.id));
|
|
104
|
-
clearTimeout(pending.timeout);
|
|
105
|
-
|
|
106
|
-
if (response.error) {
|
|
107
|
-
pending.reject(
|
|
108
|
-
new Error(`${response.error.code}: ${response.error.message}`),
|
|
109
|
-
);
|
|
110
|
-
} else {
|
|
111
|
-
pending.resolve(response.result);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Notification from server
|
|
118
|
-
if ("method" in rpcMsg) {
|
|
119
|
-
const notification = rpcMsg as JSONRPCNotification;
|
|
120
|
-
this.emit(notification.method, notification.params);
|
|
121
|
-
this.emit("notification", {
|
|
122
|
-
method: notification.method,
|
|
123
|
-
params: notification.params,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Send a request and wait for response
|
|
130
|
-
*/
|
|
131
|
-
async request<T = unknown>(method: string, params?: unknown): Promise<T> {
|
|
132
|
-
if (!this.stdin) {
|
|
133
|
-
throw new Error("Not connected");
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const id = randomUUID();
|
|
137
|
-
|
|
138
|
-
const message: JSONRPCRequest = {
|
|
139
|
-
jsonrpc: "2.0",
|
|
140
|
-
id,
|
|
141
|
-
method,
|
|
142
|
-
params,
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
return new Promise((resolve, reject) => {
|
|
146
|
-
const timeout = setTimeout(() => {
|
|
147
|
-
if (this.pending.has(id)) {
|
|
148
|
-
this.pending.delete(id);
|
|
149
|
-
reject(new Error(`Request timeout: ${method}`));
|
|
150
|
-
}
|
|
151
|
-
}, this.requestTimeout);
|
|
152
|
-
|
|
153
|
-
this.pending.set(id, {
|
|
154
|
-
resolve: resolve as (v: unknown) => void,
|
|
155
|
-
reject,
|
|
156
|
-
timeout,
|
|
157
|
-
});
|
|
158
|
-
this.send(message);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Send a notification (no response expected)
|
|
164
|
-
*/
|
|
165
|
-
notify(method: string, params?: unknown): void {
|
|
166
|
-
const message: JSONRPCNotification = {
|
|
167
|
-
jsonrpc: "2.0",
|
|
168
|
-
method,
|
|
169
|
-
params,
|
|
170
|
-
};
|
|
171
|
-
this.send(message);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private send(message: JSONRPCRequest | JSONRPCNotification): void {
|
|
175
|
-
if (!this.stdin) {
|
|
176
|
-
throw new Error("Not connected");
|
|
177
|
-
}
|
|
178
|
-
this.stdin.write(JSON.stringify(message) + "\n");
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Close and cleanup
|
|
183
|
-
*/
|
|
184
|
-
close(): void {
|
|
185
|
-
for (const [, pending] of this.pending) {
|
|
186
|
-
clearTimeout(pending.timeout);
|
|
187
|
-
pending.reject(new Error("Connection closed"));
|
|
188
|
-
}
|
|
189
|
-
this.pending.clear();
|
|
190
|
-
this.buffer = "";
|
|
191
|
-
this.stdin = undefined;
|
|
192
|
-
this.stdout?.removeAllListeners();
|
|
193
|
-
this.stdout = undefined;
|
|
194
|
-
}
|
|
195
|
-
}
|
package/src/mcp/types.ts
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP (Model Context Protocol) Types
|
|
3
|
-
*
|
|
4
|
-
* Protocol version: 2024-11-05
|
|
5
|
-
* https://modelcontextprotocol.io
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { JSONSchema7 } from "json-schema";
|
|
9
|
-
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// Configuration
|
|
12
|
-
// ============================================================================
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* MCP server configuration
|
|
16
|
-
*/
|
|
17
|
-
export interface MCPServerConfig {
|
|
18
|
-
/** Unique server identifier */
|
|
19
|
-
name: string;
|
|
20
|
-
/** Transport type (defaults to 'stdio' if omitted) */
|
|
21
|
-
transport?: "stdio" | "sse";
|
|
22
|
-
/** Command to spawn (stdio transport) */
|
|
23
|
-
command?: string;
|
|
24
|
-
/** Command arguments */
|
|
25
|
-
args?: string[];
|
|
26
|
-
/** SSE endpoint URL */
|
|
27
|
-
url?: string;
|
|
28
|
-
/** Environment variables for server process */
|
|
29
|
-
env?: Record<string, string>;
|
|
30
|
-
/** Configuration scope */
|
|
31
|
-
scope?: "project" | "global";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// ============================================================================
|
|
35
|
-
// Protocol Messages
|
|
36
|
-
// ============================================================================
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Server capabilities from initialize response
|
|
40
|
-
*/
|
|
41
|
-
export interface MCPCapabilities {
|
|
42
|
-
tools?: { listChanged?: boolean };
|
|
43
|
-
resources?: { subscribe?: boolean; listChanged?: boolean };
|
|
44
|
-
prompts?: { listChanged?: boolean };
|
|
45
|
-
logging?: Record<string, never>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Initialize request params
|
|
50
|
-
*/
|
|
51
|
-
export interface MCPInitializeParams {
|
|
52
|
-
protocolVersion: string;
|
|
53
|
-
capabilities: {
|
|
54
|
-
roots?: { listChanged?: boolean };
|
|
55
|
-
sampling?: Record<string, never>;
|
|
56
|
-
};
|
|
57
|
-
clientInfo: {
|
|
58
|
-
name: string;
|
|
59
|
-
version: string;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Initialize response
|
|
65
|
-
*/
|
|
66
|
-
export interface MCPInitializeResult {
|
|
67
|
-
protocolVersion: string;
|
|
68
|
-
capabilities: MCPCapabilities;
|
|
69
|
-
serverInfo: {
|
|
70
|
-
name: string;
|
|
71
|
-
version: string;
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// ============================================================================
|
|
76
|
-
// Tools
|
|
77
|
-
// ============================================================================
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Tool definition from tools/list
|
|
81
|
-
*/
|
|
82
|
-
export interface MCPTool {
|
|
83
|
-
name: string;
|
|
84
|
-
description?: string;
|
|
85
|
-
inputSchema: JSONSchema7;
|
|
86
|
-
annotations?: {
|
|
87
|
-
readOnlyHint?: boolean;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Tool call request params
|
|
93
|
-
*/
|
|
94
|
-
export interface MCPToolCallParams {
|
|
95
|
-
name: string;
|
|
96
|
-
arguments?: Record<string, unknown>;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Content types in tool results
|
|
101
|
-
*/
|
|
102
|
-
export type MCPContent =
|
|
103
|
-
| { type: "text"; text: string }
|
|
104
|
-
| { type: "image"; data: string; mimeType: string }
|
|
105
|
-
| { type: "resource"; resource: { uri: string; mimeType?: string; text?: string } };
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Tool call result
|
|
109
|
-
*/
|
|
110
|
-
export interface MCPToolCallResult {
|
|
111
|
-
content: MCPContent[];
|
|
112
|
-
isError?: boolean;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// ============================================================================
|
|
116
|
-
// Resources
|
|
117
|
-
// ============================================================================
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Resource definition from resources/list
|
|
121
|
-
*/
|
|
122
|
-
export interface MCPResource {
|
|
123
|
-
uri: string;
|
|
124
|
-
name: string;
|
|
125
|
-
description?: string;
|
|
126
|
-
mimeType?: string;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Resource content from resources/read
|
|
131
|
-
*/
|
|
132
|
-
export interface MCPResourceContent {
|
|
133
|
-
uri: string;
|
|
134
|
-
mimeType?: string;
|
|
135
|
-
text?: string;
|
|
136
|
-
blob?: string;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Resources read result
|
|
141
|
-
*/
|
|
142
|
-
export interface MCPResourceReadResult {
|
|
143
|
-
contents: MCPResourceContent[];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// ============================================================================
|
|
147
|
-
// Prompts
|
|
148
|
-
// ============================================================================
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Prompt definition from prompts/list
|
|
152
|
-
*/
|
|
153
|
-
export interface MCPPrompt {
|
|
154
|
-
name: string;
|
|
155
|
-
description?: string;
|
|
156
|
-
arguments?: Array<{
|
|
157
|
-
name: string;
|
|
158
|
-
description?: string;
|
|
159
|
-
required?: boolean;
|
|
160
|
-
}>;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Prompt message from prompts/get
|
|
165
|
-
*/
|
|
166
|
-
export interface MCPPromptMessage {
|
|
167
|
-
role: "user" | "assistant";
|
|
168
|
-
content: MCPContent;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Prompts get result
|
|
173
|
-
*/
|
|
174
|
-
export interface MCPPromptGetResult {
|
|
175
|
-
description?: string;
|
|
176
|
-
messages: MCPPromptMessage[];
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// ============================================================================
|
|
180
|
-
// Notifications
|
|
181
|
-
// ============================================================================
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Log message from server
|
|
185
|
-
*/
|
|
186
|
-
export interface MCPLogMessage {
|
|
187
|
-
level: "debug" | "info" | "warning" | "error";
|
|
188
|
-
logger?: string;
|
|
189
|
-
data?: unknown;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Progress notification
|
|
194
|
-
*/
|
|
195
|
-
export interface MCPProgress {
|
|
196
|
-
progressToken: string | number;
|
|
197
|
-
progress: number;
|
|
198
|
-
total?: number;
|
|
199
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { SigningPublicKeySchema, type SigningPublicKey } from "./network-runtime/index.js";
|
|
2
|
-
import type {
|
|
3
|
-
NetworkControlRef,
|
|
4
|
-
NetworkManagerPeerInfo,
|
|
5
|
-
NetworkManagerRef,
|
|
6
|
-
NetworkManagerStatusView,
|
|
7
|
-
NetworkPeerView,
|
|
8
|
-
NetworkStatusView,
|
|
9
|
-
} from "./types.js";
|
|
10
|
-
|
|
11
|
-
export function toNetworkPeerView(peer: NetworkManagerPeerInfo): NetworkPeerView | null {
|
|
12
|
-
const parsedSigningPublicKey = SigningPublicKeySchema.safeParse(peer.signingPublicKey?.trim());
|
|
13
|
-
if (
|
|
14
|
-
!parsedSigningPublicKey.success ||
|
|
15
|
-
typeof peer.nodeId !== "string" ||
|
|
16
|
-
peer.nodeId.length === 0
|
|
17
|
-
) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const signingPublicKey = parsedSigningPublicKey.data;
|
|
21
|
-
return {
|
|
22
|
-
nodeId: peer.nodeId,
|
|
23
|
-
transportPublicKey: peer.publicKey,
|
|
24
|
-
displayNameSnapshot: peer.name,
|
|
25
|
-
endpointHost: peer.endpointHost,
|
|
26
|
-
endpointPort: peer.endpointPort,
|
|
27
|
-
controlEndpoint: peer.controlEndpoint ?? null,
|
|
28
|
-
signingPublicKey,
|
|
29
|
-
status: peer.status,
|
|
30
|
-
membershipStatus: peer.membershipStatus ?? peer.status,
|
|
31
|
-
routeOwnership: peer.routeOwnership,
|
|
32
|
-
routeOwnerNodeId: peer.routeOwnerNodeId ?? null,
|
|
33
|
-
sessionState: peer.sessionState,
|
|
34
|
-
deliveryReadiness: peer.deliveryReadiness,
|
|
35
|
-
lastHandshake: peer.lastHandshake,
|
|
36
|
-
createdAt: peer.createdAt,
|
|
37
|
-
endpointRevision: peer.endpointRevision ?? 0,
|
|
38
|
-
updatedAt: peer.updatedAt ?? peer.createdAt,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function toNetworkStatusView(status: NetworkManagerStatusView): NetworkStatusView {
|
|
43
|
-
const parsedSigningPublicKey = SigningPublicKeySchema.safeParse(status.signingPublicKey?.trim());
|
|
44
|
-
const signingPublicKey: SigningPublicKey | null = parsedSigningPublicKey.success
|
|
45
|
-
? parsedSigningPublicKey.data
|
|
46
|
-
: null;
|
|
47
|
-
return {
|
|
48
|
-
configured: status.configured,
|
|
49
|
-
nodeId: status.nodeId,
|
|
50
|
-
principalFingerprint: status.principalFingerprint,
|
|
51
|
-
transportPublicKey: status.publicKey,
|
|
52
|
-
listenPort: status.listenPort,
|
|
53
|
-
externalEndpoint: status.externalEndpoint,
|
|
54
|
-
activePeers: status.activePeers,
|
|
55
|
-
totalPeers: status.totalPeers,
|
|
56
|
-
connectedPeers: status.connectedPeers,
|
|
57
|
-
handshakingPeers: status.handshakingPeers,
|
|
58
|
-
queueOnlyPeers: status.queueOnlyPeers,
|
|
59
|
-
supersededPeers: status.supersededPeers,
|
|
60
|
-
signingPublicKey,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function toNetworkControlRef(
|
|
65
|
-
networkManager?: NetworkManagerRef,
|
|
66
|
-
): NetworkControlRef | undefined {
|
|
67
|
-
if (!networkManager) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
invite(displayName, options) {
|
|
73
|
-
return networkManager.invite(displayName, options);
|
|
74
|
-
},
|
|
75
|
-
revokePeer(nodeId) {
|
|
76
|
-
return networkManager.revokePeer(nodeId);
|
|
77
|
-
},
|
|
78
|
-
listPeers() {
|
|
79
|
-
return networkManager.listPeers().flatMap((peer) => {
|
|
80
|
-
const projected = toNetworkPeerView(peer);
|
|
81
|
-
return projected ? [projected] : [];
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
status() {
|
|
85
|
-
return toNetworkStatusView(networkManager.status());
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
const NonEmptyStringSchema = z.string().trim().min(1);
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Stable durable identity for a node.
|
|
7
|
-
* Semantic rules are enforced by the runtime cutover plan; the contract layer
|
|
8
|
-
* starts by making the shape canonical everywhere.
|
|
9
|
-
*/
|
|
10
|
-
export const NodeIdSchema = NonEmptyStringSchema.brand<"NodeId">();
|
|
11
|
-
export type NodeId = z.infer<typeof NodeIdSchema>;
|
|
12
|
-
|
|
13
|
-
/** One boot of a given node runtime. */
|
|
14
|
-
export const RuntimeIdSchema = NonEmptyStringSchema.brand<"RuntimeId">();
|
|
15
|
-
export type RuntimeId = z.infer<typeof RuntimeIdSchema>;
|
|
16
|
-
|
|
17
|
-
export const NodeMetadataSchema = z.object({
|
|
18
|
-
nodeId: NodeIdSchema,
|
|
19
|
-
createdAt: NonEmptyStringSchema,
|
|
20
|
-
schemaVersion: z.number().int().positive(),
|
|
21
|
-
migratedFromLegacy: z.boolean(),
|
|
22
|
-
});
|
|
23
|
-
export type NodeMetadata = z.infer<typeof NodeMetadataSchema>;
|
|
24
|
-
|
|
25
|
-
/** Monotonic publication revision for externally visible runtime advertisements. */
|
|
26
|
-
export const PublicationRevisionSchema = z.number().int().nonnegative();
|
|
27
|
-
export type PublicationRevision = z.infer<typeof PublicationRevisionSchema>;
|
|
28
|
-
|
|
29
|
-
/** Monotonic endpoint revision for register/discovery refreshes. */
|
|
30
|
-
export const EndpointRevisionSchema = z.number().int().nonnegative();
|
|
31
|
-
export type EndpointRevision = z.infer<typeof EndpointRevisionSchema>;
|
|
32
|
-
|
|
33
|
-
/** Monotonic generation for peer-binding continuity transitions. */
|
|
34
|
-
export const BindingGenerationSchema = z.number().int().nonnegative();
|
|
35
|
-
export type BindingGeneration = z.infer<typeof BindingGenerationSchema>;
|
|
36
|
-
|
|
37
|
-
/** Monotonic generation for revocation precedence and continuity conflict checks. */
|
|
38
|
-
export const RevocationGenerationSchema = z.number().int().nonnegative();
|
|
39
|
-
export type RevocationGeneration = z.infer<typeof RevocationGenerationSchema>;
|
|
40
|
-
|
|
41
|
-
/** How a local operator confirmed a revocation decision. */
|
|
42
|
-
export const RevocationOperatorConfirmationSchema = z.enum([
|
|
43
|
-
"local_operator_confirmed",
|
|
44
|
-
"remote_capability_authenticated",
|
|
45
|
-
]);
|
|
46
|
-
export type RevocationOperatorConfirmation = z.infer<typeof RevocationOperatorConfirmationSchema>;
|
|
47
|
-
|
|
48
|
-
/** Structured local authority record for a peer revocation decision. */
|
|
49
|
-
export const RevocationDecisionSchema = z.object({
|
|
50
|
-
localNodeId: NodeIdSchema,
|
|
51
|
-
targetNodeId: NodeIdSchema,
|
|
52
|
-
revocationGeneration: RevocationGenerationSchema,
|
|
53
|
-
operatorConfirmation: RevocationOperatorConfirmationSchema,
|
|
54
|
-
});
|
|
55
|
-
export type RevocationDecision = z.infer<typeof RevocationDecisionSchema>;
|
|
56
|
-
|
|
57
|
-
/** Monotonic owner generation for runtime ownership records. */
|
|
58
|
-
export const OwnerGenerationSchema = z.number().int().positive();
|
|
59
|
-
export type OwnerGeneration = z.infer<typeof OwnerGenerationSchema>;
|
|
60
|
-
|
|
61
|
-
/** Monotonic revision for durable delivery lifecycle state transitions. */
|
|
62
|
-
export const DeliveryLifecycleRevisionSchema = z.number().int().nonnegative();
|
|
63
|
-
export type DeliveryLifecycleRevision = z.infer<typeof DeliveryLifecycleRevisionSchema>;
|
|
64
|
-
|
|
65
|
-
export const RuntimeOwnerRecordSchema = z
|
|
66
|
-
.object({
|
|
67
|
-
schemaVersion: z.number().int().positive(),
|
|
68
|
-
nodeId: NodeIdSchema,
|
|
69
|
-
ariaHome: NonEmptyStringSchema,
|
|
70
|
-
runtimePid: z.number().int().positive(),
|
|
71
|
-
runtimeId: RuntimeIdSchema,
|
|
72
|
-
displayNameSnapshot: NonEmptyStringSchema.optional(),
|
|
73
|
-
runtimeSocket: NonEmptyStringSchema,
|
|
74
|
-
startedAt: NonEmptyStringSchema,
|
|
75
|
-
lastHeartbeat: NonEmptyStringSchema,
|
|
76
|
-
ownerGeneration: OwnerGenerationSchema,
|
|
77
|
-
})
|
|
78
|
-
.strict();
|
|
79
|
-
export type RuntimeOwnerRecord = z.infer<typeof RuntimeOwnerRecordSchema>;
|
|
80
|
-
|
|
81
|
-
/** One attached local client of the runtime. */
|
|
82
|
-
export const ClientIdSchema = NonEmptyStringSchema.brand<"ClientId">();
|
|
83
|
-
export type ClientId = z.infer<typeof ClientIdSchema>;
|
|
84
|
-
|
|
85
|
-
/** Durable principal fingerprint (SHA-256 hex of signing public key DER). Signing-key evidence only. */
|
|
86
|
-
export const PrincipalFingerprintSchema = NonEmptyStringSchema.brand<"PrincipalFingerprint">();
|
|
87
|
-
export type PrincipalFingerprint = z.infer<typeof PrincipalFingerprintSchema>;
|
|
88
|
-
|
|
89
|
-
/** Transport public key / transport identity for a peer. */
|
|
90
|
-
export const PeerTransportIdSchema = NonEmptyStringSchema.brand<"PeerTransportId">();
|
|
91
|
-
export type PeerTransportId = z.infer<typeof PeerTransportIdSchema>;
|
|
92
|
-
|
|
93
|
-
/** TLS CA certificate fingerprint (SHA-256 hex of CA cert DER). Certificate-authority evidence only — distinct from signing-key evidence. */
|
|
94
|
-
export const TlsCaFingerprintSchema = NonEmptyStringSchema.brand<"TlsCaFingerprint">();
|
|
95
|
-
export type TlsCaFingerprint = z.infer<typeof TlsCaFingerprintSchema>;
|
|
96
|
-
|
|
97
|
-
/** Local-only loopback TLS SAN identity used for same-machine control attachment. */
|
|
98
|
-
export const LoopbackTlsIdentitySchema = NonEmptyStringSchema.brand<"LoopbackTlsIdentity">();
|
|
99
|
-
export type LoopbackTlsIdentity = z.infer<typeof LoopbackTlsIdentitySchema>;
|
|
100
|
-
/** Base64-encoded signing public key material crossing runtime/shared boundaries. */
|
|
101
|
-
export const SigningPublicKeySchema = NonEmptyStringSchema.brand<"SigningPublicKey">();
|
|
102
|
-
export type SigningPublicKey = z.infer<typeof SigningPublicKeySchema>;
|
|
103
|
-
|
|
104
|
-
/** Explicit network transport endpoint advertisement. */
|
|
105
|
-
export const TransportEndpointAdvertisementSchema = z.object({
|
|
106
|
-
host: NonEmptyStringSchema,
|
|
107
|
-
port: z.number().int().min(1).max(65535),
|
|
108
|
-
});
|
|
109
|
-
export type TransportEndpointAdvertisement = z.infer<typeof TransportEndpointAdvertisementSchema>;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Runtime-owned local inbox addressing.
|
|
113
|
-
* Same-machine clients are local attachments, not mesh peers.
|
|
114
|
-
*/
|
|
115
|
-
export const InboxAddressSchema = z.discriminatedUnion("kind", [
|
|
116
|
-
z.object({
|
|
117
|
-
kind: z.literal("node"),
|
|
118
|
-
nodeId: NodeIdSchema,
|
|
119
|
-
}),
|
|
120
|
-
z.object({
|
|
121
|
-
kind: z.literal("client"),
|
|
122
|
-
clientId: ClientIdSchema,
|
|
123
|
-
}),
|
|
124
|
-
]);
|
|
125
|
-
export type InboxAddress = z.infer<typeof InboxAddressSchema>;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Public control-plane endpoint advertisement used by peers for pinned,
|
|
129
|
-
* mutating requests.
|
|
130
|
-
*/
|
|
131
|
-
export const ControlEndpointAdvertisementSchema = z.object({
|
|
132
|
-
host: NonEmptyStringSchema,
|
|
133
|
-
port: z.number().int().min(1).max(65535),
|
|
134
|
-
tlsCaFingerprint: TlsCaFingerprintSchema,
|
|
135
|
-
tlsServerIdentity: PrincipalFingerprintSchema,
|
|
136
|
-
protocolVersion: z.number().int().positive(),
|
|
137
|
-
endpointRevision: EndpointRevisionSchema.optional(),
|
|
138
|
-
});
|
|
139
|
-
export type ControlEndpointAdvertisement = z.infer<typeof ControlEndpointAdvertisementSchema>;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Remote/public node advertisement. This deliberately excludes local-only
|
|
143
|
-
* runtime/session identity like RuntimeId.
|
|
144
|
-
*/
|
|
145
|
-
export const NodeAdvertisementSchema = z.object({
|
|
146
|
-
nodeId: NodeIdSchema,
|
|
147
|
-
principalFingerprint: PrincipalFingerprintSchema,
|
|
148
|
-
transportPublicKey: PeerTransportIdSchema,
|
|
149
|
-
publicationRevision: PublicationRevisionSchema.optional(),
|
|
150
|
-
controlEndpoint: ControlEndpointAdvertisementSchema.optional(),
|
|
151
|
-
displayNameSnapshot: NonEmptyStringSchema.optional(),
|
|
152
|
-
});
|
|
153
|
-
export type NodeAdvertisement = z.infer<typeof NodeAdvertisementSchema>;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Local-only runtime registry summary. This is not a remote/public mesh
|
|
157
|
-
* contract and may include RuntimeId.
|
|
158
|
-
*/
|
|
159
|
-
export const LocalRuntimeSummarySchema = z.object({
|
|
160
|
-
nodeId: NodeIdSchema,
|
|
161
|
-
runtimeId: RuntimeIdSchema,
|
|
162
|
-
lastHeartbeat: NonEmptyStringSchema.optional(),
|
|
163
|
-
controlEndpoint: ControlEndpointAdvertisementSchema.optional(),
|
|
164
|
-
displayNameSnapshot: NonEmptyStringSchema.optional(),
|
|
165
|
-
});
|
|
166
|
-
export type LocalRuntimeSummary = z.infer<typeof LocalRuntimeSummarySchema>;
|
|
167
|
-
|
|
168
|
-
// ── Durable Delivery Handle ────────────────────────────────────────
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Branded operation handle for durable delivery.
|
|
172
|
-
* Produced ONLY by `submitDurable()` — the caller never mints handles.
|
|
173
|
-
*/
|
|
174
|
-
export const DurableDeliveryHandleSchema = NonEmptyStringSchema.brand<"DurableDeliveryHandle">();
|
|
175
|
-
export type DurableDeliveryHandle = z.infer<typeof DurableDeliveryHandleSchema>;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Terminal status types for a durable delivery operation.
|
|
179
|
-
*/
|
|
180
|
-
export const DurableDeliveryResultSchema = z.discriminatedUnion("status", [
|
|
181
|
-
z.object({
|
|
182
|
-
status: z.literal("pending"),
|
|
183
|
-
queuedAt: z.string(),
|
|
184
|
-
nextAttemptAt: z.string().optional(),
|
|
185
|
-
attemptCount: z.number(),
|
|
186
|
-
}),
|
|
187
|
-
z.object({
|
|
188
|
-
status: z.literal("delivered"),
|
|
189
|
-
deliveredAt: z.string(),
|
|
190
|
-
}),
|
|
191
|
-
z.object({
|
|
192
|
-
status: z.literal("expired"),
|
|
193
|
-
reason: z.literal("ttl_exceeded"),
|
|
194
|
-
queuedAt: z.string(),
|
|
195
|
-
expiredAt: z.string(),
|
|
196
|
-
}),
|
|
197
|
-
z.object({
|
|
198
|
-
status: z.literal("rejected"),
|
|
199
|
-
reason: z.enum(["recipient_revoked", "recipient_unknown", "envelope_invalid"]),
|
|
200
|
-
}),
|
|
201
|
-
]);
|
|
202
|
-
export type DurableDeliveryResult = z.infer<typeof DurableDeliveryResultSchema>;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Submit result — returned immediately from `submitDurable()`.
|
|
206
|
-
*/
|
|
207
|
-
export const DurableSubmitResultSchema = z.discriminatedUnion("status", [
|
|
208
|
-
z.object({
|
|
209
|
-
status: z.literal("accepted"),
|
|
210
|
-
operationId: DurableDeliveryHandleSchema,
|
|
211
|
-
queuedAt: z.string(),
|
|
212
|
-
}),
|
|
213
|
-
z.object({
|
|
214
|
-
status: z.literal("rejected"),
|
|
215
|
-
reason: z.enum(["recipient_revoked", "recipient_unknown", "envelope_invalid"]),
|
|
216
|
-
}),
|
|
217
|
-
]);
|
|
218
|
-
export type DurableSubmitResult = z.infer<typeof DurableSubmitResultSchema>;
|