stitchkit 0.70.3 → 0.70.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime-harness.js +4 -4
- package/dist/agent-runtime.js +7 -7
- package/dist/application.js +2 -2
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/cli.js +6 -6
- package/dist/{index-0yphgata.js → index-1rxswfbv.js} +1 -1
- package/dist/{index-4qfqy0m6.js → index-35wcrke5.js} +1 -1
- package/dist/{index-7wpgrqa8.js → index-3z73fh2c.js} +93 -7
- package/dist/{index-wc80at9n.js → index-6d32zk83.js} +1 -1
- package/dist/{index-1zxf9x2z.js → index-cx84zg25.js} +90 -26
- package/dist/{index-7rey2b8s.js → index-ejv31h14.js} +1 -1
- package/dist/{index-y3w12g8d.js → index-ekkt4gy9.js} +2 -2
- package/dist/{index-w0445741.js → index-hvftzz91.js} +1 -1
- package/dist/{index-vc498pst.js → index-hxtm2xr2.js} +1 -1
- package/dist/{index-bd17ytae.js → index-nt1mp8km.js} +4 -2
- package/dist/{index-qzbg46b6.js → index-qm87g51s.js} +2 -2
- package/dist/{index-mjx0wt4c.js → index-tnazr5tc.js} +4 -4
- package/dist/{index-s8nt8c22.js → index-trrf7nch.js} +3 -3
- package/dist/{index-ktsps64f.js → index-w9m1wznn.js} +1 -1
- package/dist/index.js +5 -3
- package/dist/internal/random-hex.d.ts +3 -0
- package/dist/internal/random-hex.d.ts.map +1 -0
- package/dist/node.js +4 -4
- package/dist/observability/index.js +2 -2
- package/dist/observability/trace.d.ts.map +1 -1
- package/dist/realtime/request.d.ts +1 -1
- package/dist/realtime/request.d.ts.map +1 -1
- package/dist/remote.js +3 -3
- package/dist/server/contract-stream.d.ts.map +1 -1
- package/dist/server/http-stream-lifetime.d.ts +19 -0
- package/dist/server/http-stream-lifetime.d.ts.map +1 -0
- package/dist/server/index.js +5 -5
- package/dist/server/shutdown.d.ts.map +1 -1
- package/dist/server/socket-io-config.d.ts +1 -1
- package/dist/server/socket-io-config.d.ts.map +1 -1
- package/dist/server/socket-io.d.ts.map +1 -1
- package/dist/server/streaming-route.d.ts.map +1 -1
- package/dist/testing.js +5 -5
- package/dist/tool-invoker.js +5 -5
- package/dist/tools.js +8 -8
- package/llms-full.txt +34 -5
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
composeAgentPrompt,
|
|
4
4
|
createAgentRuntime,
|
|
5
5
|
createAgentRuntimeEventSink
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-35wcrke5.js";
|
|
7
7
|
import {
|
|
8
8
|
walkContainedFiles
|
|
9
9
|
} from "./index-1z5xxfst.js";
|
|
@@ -16,15 +16,15 @@ import"./index-3xnq72rz.js";
|
|
|
16
16
|
import {
|
|
17
17
|
defineRuntimeTool
|
|
18
18
|
} from "./index-wwst0td5.js";
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
19
|
+
import"./index-qm87g51s.js";
|
|
20
|
+
import"./index-w9m1wznn.js";
|
|
21
21
|
import {
|
|
22
22
|
AgentMessagePartSchema,
|
|
23
23
|
AgentSnapshotSchema
|
|
24
24
|
} from "./index-x1th9s8c.js";
|
|
25
25
|
import"./index-22by16v6.js";
|
|
26
26
|
import"./index-cby4ar3v.js";
|
|
27
|
-
import"./index-
|
|
27
|
+
import"./index-nt1mp8km.js";
|
|
28
28
|
import"./index-vj3vvpaa.js";
|
|
29
29
|
import"./index-0w9abg87.js";
|
|
30
30
|
import"./index-qyrqwr4c.js";
|
package/dist/agent-runtime.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
registerDeferredToolRepair,
|
|
28
28
|
repairedSearchCall,
|
|
29
29
|
selectAgentHistory
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-35wcrke5.js";
|
|
31
31
|
import {
|
|
32
32
|
AgentModelCapabilitySchema,
|
|
33
33
|
AgentModelCatalogEntrySchema,
|
|
@@ -82,15 +82,15 @@ import {
|
|
|
82
82
|
import {
|
|
83
83
|
buildToolManifest,
|
|
84
84
|
mountAgent
|
|
85
|
-
} from "./index-
|
|
85
|
+
} from "./index-trrf7nch.js";
|
|
86
86
|
import"./index-3xnq72rz.js";
|
|
87
|
-
import"./index-
|
|
87
|
+
import"./index-hxtm2xr2.js";
|
|
88
88
|
import {
|
|
89
89
|
defineRuntimeTool
|
|
90
90
|
} from "./index-wwst0td5.js";
|
|
91
|
-
import"./index-
|
|
92
|
-
import"./index-
|
|
93
|
-
import"./index-
|
|
91
|
+
import"./index-ejv31h14.js";
|
|
92
|
+
import"./index-qm87g51s.js";
|
|
93
|
+
import"./index-w9m1wznn.js";
|
|
94
94
|
import {
|
|
95
95
|
AgentAssistantPlaceholderSchema,
|
|
96
96
|
AgentControlPartSchema,
|
|
@@ -129,7 +129,7 @@ import"./index-cby4ar3v.js";
|
|
|
129
129
|
import {
|
|
130
130
|
childSpan,
|
|
131
131
|
createTraceContext
|
|
132
|
-
} from "./index-
|
|
132
|
+
} from "./index-nt1mp8km.js";
|
|
133
133
|
import"./index-vj3vvpaa.js";
|
|
134
134
|
import"./index-0w9abg87.js";
|
|
135
135
|
import {
|
package/dist/application.js
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
ApplicationShutdownBudgetSchema,
|
|
30
30
|
ApplicationShutdownOptionsSchema,
|
|
31
31
|
createApplication
|
|
32
|
-
} from "./index-
|
|
32
|
+
} from "./index-hvftzz91.js";
|
|
33
33
|
import {
|
|
34
34
|
defineManagedResource,
|
|
35
35
|
managedResourceDependencyId
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
ManagedResourceStateSchema,
|
|
48
48
|
projectApplicationStatus
|
|
49
49
|
} from "./index-8eywc9zv.js";
|
|
50
|
-
import"./index-
|
|
50
|
+
import"./index-3z73fh2c.js";
|
|
51
51
|
import"./index-0w9abg87.js";
|
|
52
52
|
import {
|
|
53
53
|
isRecord
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-io.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"socket-io.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,sBAAsB,EAG3B,KAAK,wBAAwB,EAE9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAuG5B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AA4GD;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAI7B,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB,CAAC,aAAa,SAAS,cAAc,GAAG,cAAc;IACzF,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,IAAI,CAAC,EACD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACvE,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM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F,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC,CAclD;AAED,wBAAgB,oBAAoB,CAClC,aAAa,SAAS,cAAc,EACpC,aAAa,SAAS,cAAc,EACpC,MAAM,EAAE,oBAAoB,CAAC,aAAa,CAAC,GAAG,cAAc,CAAC,aAAa,EAAE,aAAa,CAAC,CAE3F"}
|
package/dist/cli.js
CHANGED
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
emitResult,
|
|
6
6
|
parseCliArgs,
|
|
7
7
|
pollUntilDone
|
|
8
|
-
} from "./index-
|
|
9
|
-
import"./index-
|
|
8
|
+
} from "./index-tnazr5tc.js";
|
|
9
|
+
import"./index-hxtm2xr2.js";
|
|
10
10
|
import"./index-wwst0td5.js";
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
11
|
+
import"./index-ejv31h14.js";
|
|
12
|
+
import"./index-qm87g51s.js";
|
|
13
|
+
import"./index-w9m1wznn.js";
|
|
14
14
|
import"./index-sbdmyz75.js";
|
|
15
15
|
import"./index-22by16v6.js";
|
|
16
16
|
import"./index-cby4ar3v.js";
|
|
17
|
-
import"./index-
|
|
17
|
+
import"./index-nt1mp8km.js";
|
|
18
18
|
import"./index-vj3vvpaa.js";
|
|
19
19
|
import"./index-0w9abg87.js";
|
|
20
20
|
import"./index-qyrqwr4c.js";
|
|
@@ -1,5 +1,84 @@
|
|
|
1
1
|
// src/server/shutdown.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
// src/server/http-stream-lifetime.ts
|
|
5
|
+
var requests = new WeakMap;
|
|
6
|
+
function isStreamCancellation(error, signal) {
|
|
7
|
+
return signal.aborted && (error === signal.reason || error instanceof Error && error.name === "AbortError" && error.cause === signal.reason);
|
|
8
|
+
}
|
|
9
|
+
function ownHttpStream(request, stream) {
|
|
10
|
+
requests.get(request)?.add(stream);
|
|
11
|
+
}
|
|
12
|
+
async function settleStreamCleanup(operations) {
|
|
13
|
+
const results = await Promise.allSettled(operations);
|
|
14
|
+
const errors = results.flatMap((result) => result.status === "rejected" ? [result.reason] : []);
|
|
15
|
+
if (errors.length)
|
|
16
|
+
throw new AggregateError(errors, "HTTP stream source did not close cleanly");
|
|
17
|
+
}
|
|
18
|
+
function createHttpStreamTracker() {
|
|
19
|
+
const streams = new Map;
|
|
20
|
+
const failures = [];
|
|
21
|
+
let draining = false;
|
|
22
|
+
const assertClean = () => {
|
|
23
|
+
if (failures.length) {
|
|
24
|
+
throw new AggregateError(failures, "[stitchkit] HTTP stream cleanup failed");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
bind(request, onComplete) {
|
|
29
|
+
let handlerDone = false;
|
|
30
|
+
let pending = 0;
|
|
31
|
+
const complete = () => {
|
|
32
|
+
if (!handlerDone || pending !== 0)
|
|
33
|
+
return;
|
|
34
|
+
requests.delete(request);
|
|
35
|
+
onComplete();
|
|
36
|
+
};
|
|
37
|
+
requests.set(request, {
|
|
38
|
+
add(stream) {
|
|
39
|
+
pending += 1;
|
|
40
|
+
streams.set(stream, request);
|
|
41
|
+
stream.settled.then(() => {
|
|
42
|
+
streams.delete(stream);
|
|
43
|
+
pending -= 1;
|
|
44
|
+
complete();
|
|
45
|
+
}, (error) => {
|
|
46
|
+
if (draining)
|
|
47
|
+
failures.push(error);
|
|
48
|
+
else
|
|
49
|
+
console.error("[stitchkit] HTTP stream cleanup failed:", error);
|
|
50
|
+
streams.delete(stream);
|
|
51
|
+
pending -= 1;
|
|
52
|
+
complete();
|
|
53
|
+
});
|
|
54
|
+
if (draining)
|
|
55
|
+
stream.cancel();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return () => {
|
|
59
|
+
handlerDone = true;
|
|
60
|
+
complete();
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
get pendingRequests() {
|
|
64
|
+
return new Set(streams.values()).size;
|
|
65
|
+
},
|
|
66
|
+
cancel() {
|
|
67
|
+
draining = true;
|
|
68
|
+
for (const stream of streams.keys())
|
|
69
|
+
stream.cancel();
|
|
70
|
+
},
|
|
71
|
+
assertClean,
|
|
72
|
+
async drain() {
|
|
73
|
+
while (streams.size) {
|
|
74
|
+
await Promise.allSettled([...streams.keys()].map((stream) => stream.settled));
|
|
75
|
+
}
|
|
76
|
+
assertClean();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/server/shutdown.ts
|
|
3
82
|
var ShutdownStateSchema = z.enum([
|
|
4
83
|
"running",
|
|
5
84
|
"draining-http",
|
|
@@ -109,13 +188,15 @@ function createServerLifecycle(getAdapter) {
|
|
|
109
188
|
let pendingApplicationRequests = 0;
|
|
110
189
|
let retryAfterSeconds = 5;
|
|
111
190
|
let shutdownPromise;
|
|
191
|
+
const streams = createHttpStreamTracker();
|
|
192
|
+
const pendingRequests = () => Math.max(getAdapter().pendingRequests(), streams.pendingRequests);
|
|
112
193
|
const status = () => {
|
|
113
194
|
const adapter = getAdapter();
|
|
114
195
|
return ShutdownStatusSchema.parse({
|
|
115
196
|
state,
|
|
116
197
|
acceptedRequests,
|
|
117
198
|
completedRequests,
|
|
118
|
-
pendingRequests:
|
|
199
|
+
pendingRequests: pendingRequests(),
|
|
119
200
|
pendingWebSockets: adapter.pendingWebSockets()
|
|
120
201
|
});
|
|
121
202
|
};
|
|
@@ -125,11 +206,14 @@ function createServerLifecycle(getAdapter) {
|
|
|
125
206
|
return rejectedResponse(retryAfterSeconds);
|
|
126
207
|
acceptedRequests += 1;
|
|
127
208
|
pendingApplicationRequests += 1;
|
|
209
|
+
const complete = streams.bind(request, () => {
|
|
210
|
+
completedRequests += 1;
|
|
211
|
+
});
|
|
128
212
|
try {
|
|
129
213
|
return await handler(request, server);
|
|
130
214
|
} finally {
|
|
131
215
|
pendingApplicationRequests -= 1;
|
|
132
|
-
|
|
216
|
+
complete();
|
|
133
217
|
}
|
|
134
218
|
};
|
|
135
219
|
};
|
|
@@ -142,6 +226,7 @@ function createServerLifecycle(getAdapter) {
|
|
|
142
226
|
const adapter = getAdapter();
|
|
143
227
|
state = "draining-http";
|
|
144
228
|
adapter.beginShutdown(retryAfterSeconds);
|
|
229
|
+
streams.cancel();
|
|
145
230
|
shutdownPromise = new Promise((resolve, reject) => {
|
|
146
231
|
const phaseAbort = new AbortController;
|
|
147
232
|
let forcedReason;
|
|
@@ -164,7 +249,8 @@ function createServerLifecycle(getAdapter) {
|
|
|
164
249
|
};
|
|
165
250
|
(async () => {
|
|
166
251
|
try {
|
|
167
|
-
await waitForZero(() => pendingApplicationRequests, phaseAbort.signal);
|
|
252
|
+
await waitForZero(() => pendingApplicationRequests + streams.pendingRequests, phaseAbort.signal);
|
|
253
|
+
streams.assertClean();
|
|
168
254
|
if (!forcedReason) {
|
|
169
255
|
state = "closing-realtime";
|
|
170
256
|
const realtimeOutcome = await closeRealtimeWithin(adapter, parsed.realtimeCloseTimeoutMs, phaseAbort.signal);
|
|
@@ -189,13 +275,13 @@ function createServerLifecycle(getAdapter) {
|
|
|
189
275
|
let pendingWebSocketsAtForce = 0;
|
|
190
276
|
if (forcedReason) {
|
|
191
277
|
state = "stopping-runtime";
|
|
192
|
-
pendingRequestsAtForce =
|
|
278
|
+
pendingRequestsAtForce = pendingRequests();
|
|
193
279
|
pendingWebSocketsAtForce = adapter.pendingWebSockets();
|
|
194
280
|
forcedWebSockets += pendingWebSocketsAtForce;
|
|
195
281
|
let forceError;
|
|
196
282
|
let forceFailed = false;
|
|
197
283
|
try {
|
|
198
|
-
await withTimeout(adapter.forceStop(), parsed.forceTimeoutMs, `[stitchkit] forced shutdown did not complete within ${parsed.forceTimeoutMs}ms`);
|
|
284
|
+
await withTimeout(Promise.all([adapter.forceStop(), streams.drain()]), parsed.forceTimeoutMs, `[stitchkit] forced shutdown did not complete within ${parsed.forceTimeoutMs}ms`);
|
|
199
285
|
} catch (error) {
|
|
200
286
|
forceFailed = true;
|
|
201
287
|
forceError = error;
|
|
@@ -219,7 +305,7 @@ function createServerLifecycle(getAdapter) {
|
|
|
219
305
|
...forcedReason && { reason: forcedReason },
|
|
220
306
|
acceptedRequests,
|
|
221
307
|
completedRequests,
|
|
222
|
-
pendingRequests:
|
|
308
|
+
pendingRequests: pendingRequests(),
|
|
223
309
|
pendingWebSockets: adapter.pendingWebSockets(),
|
|
224
310
|
pendingRequestsAtForce,
|
|
225
311
|
pendingWebSocketsAtForce,
|
|
@@ -243,4 +329,4 @@ function createServerLifecycle(getAdapter) {
|
|
|
243
329
|
};
|
|
244
330
|
}
|
|
245
331
|
|
|
246
|
-
export { ShutdownStateSchema, ShutdownOptionsSchema, ShutdownStatusSchema, ShutdownResultSchema, createServerLifecycle };
|
|
332
|
+
export { isStreamCancellation, ownHttpStream, settleStreamCleanup, ShutdownStateSchema, ShutdownOptionsSchema, ShutdownStatusSchema, ShutdownResultSchema, createServerLifecycle };
|
|
@@ -18,10 +18,13 @@ import {
|
|
|
18
18
|
runWithRequestContext,
|
|
19
19
|
setRequestEndpoint,
|
|
20
20
|
setRequestError
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-w9m1wznn.js";
|
|
22
22
|
import {
|
|
23
|
-
ShutdownOptionsSchema
|
|
24
|
-
|
|
23
|
+
ShutdownOptionsSchema,
|
|
24
|
+
isStreamCancellation,
|
|
25
|
+
ownHttpStream,
|
|
26
|
+
settleStreamCleanup
|
|
27
|
+
} from "./index-3z73fh2c.js";
|
|
25
28
|
import {
|
|
26
29
|
errorCode,
|
|
27
30
|
normalizeError,
|
|
@@ -29,7 +32,7 @@ import {
|
|
|
29
32
|
resolveTraceContext,
|
|
30
33
|
validateDeclaredOutput,
|
|
31
34
|
zodIssues
|
|
32
|
-
} from "./index-
|
|
35
|
+
} from "./index-nt1mp8km.js";
|
|
33
36
|
import {
|
|
34
37
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
35
38
|
isUnsafeKey,
|
|
@@ -598,8 +601,28 @@ function streamingRoute(options) {
|
|
|
598
601
|
handler: async (request, context) => {
|
|
599
602
|
applyIdleTimeout(context.server, request, idleTimeoutSeconds);
|
|
600
603
|
const departed = new AbortController;
|
|
601
|
-
const
|
|
602
|
-
|
|
604
|
+
const settled = Promise.withResolvers();
|
|
605
|
+
settled.promise.catch(() => {
|
|
606
|
+
return;
|
|
607
|
+
});
|
|
608
|
+
const pumped = Promise.withResolvers();
|
|
609
|
+
pumped.promise.catch(() => {
|
|
610
|
+
return;
|
|
611
|
+
});
|
|
612
|
+
let cancel = () => departed.abort();
|
|
613
|
+
ownHttpStream(request, { cancel: () => cancel(), settled: settled.promise });
|
|
614
|
+
let iterator;
|
|
615
|
+
try {
|
|
616
|
+
const iterable = await options.source(request, {
|
|
617
|
+
...context,
|
|
618
|
+
signal: departed.signal
|
|
619
|
+
});
|
|
620
|
+
iterator = iterable[Symbol.asyncIterator]();
|
|
621
|
+
} catch (error) {
|
|
622
|
+
departed.abort();
|
|
623
|
+
settled.reject(error);
|
|
624
|
+
throw error;
|
|
625
|
+
}
|
|
603
626
|
const encoder2 = new TextEncoder;
|
|
604
627
|
let heartbeat = null;
|
|
605
628
|
let closed = false;
|
|
@@ -613,15 +636,22 @@ function streamingRoute(options) {
|
|
|
613
636
|
if (closed)
|
|
614
637
|
return;
|
|
615
638
|
closed = true;
|
|
639
|
+
stopHeartbeat();
|
|
640
|
+
signalDemand();
|
|
641
|
+
request.signal.removeEventListener("abort", onRequestAbort);
|
|
642
|
+
departed.abort();
|
|
643
|
+
const hook = Promise.withResolvers();
|
|
616
644
|
try {
|
|
617
645
|
options.onClose?.();
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
646
|
+
hook.resolve();
|
|
647
|
+
} catch (error) {
|
|
648
|
+
hook.reject(error);
|
|
649
|
+
}
|
|
650
|
+
settleStreamCleanup([
|
|
651
|
+
hook.promise,
|
|
652
|
+
pumped.promise,
|
|
653
|
+
Promise.resolve().then(() => iterator.return?.(undefined))
|
|
654
|
+
]).then(() => settled.resolve(), (error) => settled.reject(error));
|
|
625
655
|
};
|
|
626
656
|
let demand = null;
|
|
627
657
|
const signalDemand = () => {
|
|
@@ -629,6 +659,7 @@ function streamingRoute(options) {
|
|
|
629
659
|
demand = null;
|
|
630
660
|
resolve?.();
|
|
631
661
|
};
|
|
662
|
+
const onRequestAbort = () => cancel();
|
|
632
663
|
const stream = new ReadableStream({
|
|
633
664
|
start(controller) {
|
|
634
665
|
const send = (text) => {
|
|
@@ -647,15 +678,16 @@ function streamingRoute(options) {
|
|
|
647
678
|
controller.close();
|
|
648
679
|
} catch {}
|
|
649
680
|
};
|
|
650
|
-
|
|
681
|
+
cancel = () => {
|
|
651
682
|
release();
|
|
652
683
|
finish();
|
|
684
|
+
};
|
|
685
|
+
if (request.signal.aborted || departed.signal.aborted) {
|
|
686
|
+
pumped.resolve();
|
|
687
|
+
cancel();
|
|
653
688
|
return;
|
|
654
689
|
}
|
|
655
|
-
request.signal.addEventListener("abort",
|
|
656
|
-
release();
|
|
657
|
-
finish();
|
|
658
|
-
});
|
|
690
|
+
request.signal.addEventListener("abort", onRequestAbort, { once: true });
|
|
659
691
|
send(framing.keepAlive);
|
|
660
692
|
heartbeat = setInterval(() => {
|
|
661
693
|
if ((controller.desiredSize ?? 1) > 0)
|
|
@@ -696,9 +728,13 @@ function streamingRoute(options) {
|
|
|
696
728
|
if (framing.done)
|
|
697
729
|
send(framing.done);
|
|
698
730
|
} catch (error) {
|
|
699
|
-
if (
|
|
731
|
+
if (closed) {
|
|
732
|
+
if (!isStreamCancellation(error, departed.signal))
|
|
733
|
+
pumped.reject(error);
|
|
734
|
+
} else
|
|
700
735
|
send(framing.frame(normalizeError(error).toJSON()));
|
|
701
736
|
} finally {
|
|
737
|
+
pumped.resolve();
|
|
702
738
|
release();
|
|
703
739
|
finish();
|
|
704
740
|
}
|
|
@@ -890,9 +926,32 @@ function waitForAbort(signal) {
|
|
|
890
926
|
function contractStreamResponse(request, context, source, descriptor, operationAbort) {
|
|
891
927
|
const format = descriptor.format ?? "ndjson";
|
|
892
928
|
const maxFrameBytes = descriptor.maxFrameBytes ?? DEFAULT_CONTRACT_STREAM_FRAME_BYTES;
|
|
929
|
+
const iterator = source[Symbol.asyncIterator]();
|
|
930
|
+
let pendingNext;
|
|
931
|
+
const settled = Promise.withResolvers();
|
|
932
|
+
settled.promise.catch(() => {
|
|
933
|
+
return;
|
|
934
|
+
});
|
|
893
935
|
let lifetime;
|
|
894
936
|
let lifetimeExpired = false;
|
|
895
|
-
|
|
937
|
+
let closing = false;
|
|
938
|
+
const closeSource = (cancelled = operationAbort.signal.aborted) => {
|
|
939
|
+
if (closing)
|
|
940
|
+
return;
|
|
941
|
+
closing = true;
|
|
942
|
+
if (lifetime !== undefined)
|
|
943
|
+
clearTimeout(lifetime);
|
|
944
|
+
operationAbort.abort();
|
|
945
|
+
settleStreamCleanup([
|
|
946
|
+
Promise.resolve(pendingNext).catch((error) => {
|
|
947
|
+
if (cancelled && !isStreamCancellation(error, operationAbort.signal))
|
|
948
|
+
throw error;
|
|
949
|
+
}),
|
|
950
|
+
Promise.resolve().then(() => iterator.return?.(undefined))
|
|
951
|
+
]).then(() => settled.resolve(), (error) => settled.reject(error));
|
|
952
|
+
};
|
|
953
|
+
ownHttpStream(request, { cancel: () => closeSource(true), settled: settled.promise });
|
|
954
|
+
if (descriptor.lifetimeMs !== undefined && !closing) {
|
|
896
955
|
lifetime = setTimeout(() => {
|
|
897
956
|
lifetimeExpired = true;
|
|
898
957
|
operationAbort.abort(new Error("Stream lifetime expired"));
|
|
@@ -900,12 +959,14 @@ function contractStreamResponse(request, context, source, descriptor, operationA
|
|
|
900
959
|
lifetime.unref?.();
|
|
901
960
|
}
|
|
902
961
|
const frames = async function* () {
|
|
903
|
-
|
|
962
|
+
if (closing)
|
|
963
|
+
return;
|
|
904
964
|
const aborted = waitForAbort(operationAbort.signal);
|
|
905
965
|
let terminalSeen = descriptor.terminal === undefined;
|
|
906
966
|
try {
|
|
907
967
|
for (;; ) {
|
|
908
|
-
|
|
968
|
+
pendingNext = Promise.resolve(iterator.next());
|
|
969
|
+
const next = await Promise.race([pendingNext, aborted]);
|
|
909
970
|
if (next.done)
|
|
910
971
|
break;
|
|
911
972
|
const parsed = descriptor.item.safeParse(next.value);
|
|
@@ -951,10 +1012,7 @@ function contractStreamResponse(request, context, source, descriptor, operationA
|
|
|
951
1012
|
} finally {
|
|
952
1013
|
if (lifetime !== undefined)
|
|
953
1014
|
clearTimeout(lifetime);
|
|
954
|
-
|
|
955
|
-
Promise.resolve(iterator.return?.(undefined)).catch(() => {
|
|
956
|
-
return;
|
|
957
|
-
});
|
|
1015
|
+
closeSource();
|
|
958
1016
|
}
|
|
959
1017
|
};
|
|
960
1018
|
const route = streamingRoute({
|
|
@@ -2410,6 +2468,12 @@ async function createSocketIOServer(config) {
|
|
|
2410
2468
|
let closePromise;
|
|
2411
2469
|
const consumerAllowRequest = config.allowRequest;
|
|
2412
2470
|
const checkRequest = async (request) => {
|
|
2471
|
+
if (onBun) {
|
|
2472
|
+
const requested = new URL(request.url).searchParams.get("transport");
|
|
2473
|
+
if (!transports.some((transport) => transport === requested)) {
|
|
2474
|
+
throw new Error("Transport rejected by the configured Socket.IO policy");
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2413
2477
|
if (consumerAllowRequest && !await consumerAllowRequest(request)) {
|
|
2414
2478
|
throw new Error("Request rejected by the configured Socket.IO policy");
|
|
2415
2479
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collectTools,
|
|
3
3
|
createToolRunner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-ejv31h14.js";
|
|
5
5
|
import {
|
|
6
6
|
toolErrorFromResult
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-qm87g51s.js";
|
|
8
8
|
import {
|
|
9
9
|
assertUniqueToolName
|
|
10
10
|
} from "./index-22by16v6.js";
|
|
@@ -109,8 +109,7 @@ function validateDeclaredOutput(schema, data, onStripped) {
|
|
|
109
109
|
return validateHandlerOutput(schema, data, onStripped);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
// src/
|
|
113
|
-
var TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(.*)$/i;
|
|
112
|
+
// src/internal/random-hex.ts
|
|
114
113
|
function randomHex(bytes) {
|
|
115
114
|
const arr = new Uint8Array(bytes);
|
|
116
115
|
crypto.getRandomValues(arr);
|
|
@@ -119,6 +118,9 @@ function randomHex(bytes) {
|
|
|
119
118
|
hex += byte.toString(16).padStart(2, "0");
|
|
120
119
|
return hex;
|
|
121
120
|
}
|
|
121
|
+
|
|
122
|
+
// src/observability/trace.ts
|
|
123
|
+
var TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(.*)$/i;
|
|
122
124
|
function createTraceContext() {
|
|
123
125
|
return { traceId: randomHex(16), spanId: randomHex(8) };
|
|
124
126
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getRequestContext,
|
|
3
3
|
runWithRequestContext
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-w9m1wznn.js";
|
|
5
5
|
import {
|
|
6
6
|
objectShapeKeys
|
|
7
7
|
} from "./index-22by16v6.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
formatZodError,
|
|
10
10
|
normalizeError,
|
|
11
11
|
validateDeclaredOutput
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-nt1mp8km.js";
|
|
13
13
|
import {
|
|
14
14
|
isUnsafeKey,
|
|
15
15
|
safeJsonParse
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collectToolSurface
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-hxtm2xr2.js";
|
|
4
4
|
import {
|
|
5
5
|
createToolRunner,
|
|
6
6
|
formatToolError
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-ejv31h14.js";
|
|
8
8
|
import {
|
|
9
9
|
coerceJsonArgs,
|
|
10
10
|
toolResultFromError
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-qm87g51s.js";
|
|
12
12
|
import {
|
|
13
13
|
isWithinDir
|
|
14
14
|
} from "./index-sbdmyz75.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
formatZodError,
|
|
25
25
|
validateDeclaredOutput
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-nt1mp8km.js";
|
|
27
27
|
import {
|
|
28
28
|
isUnsafeKey,
|
|
29
29
|
safeJsonParse
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
} from "./index-3xnq72rz.js";
|
|
4
4
|
import {
|
|
5
5
|
collectToolSurface
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-hxtm2xr2.js";
|
|
7
7
|
import {
|
|
8
8
|
createToolRunner,
|
|
9
9
|
formatToolError
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-ejv31h14.js";
|
|
11
11
|
import {
|
|
12
12
|
isToolExecutionControlError,
|
|
13
13
|
toolResultFromError
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-qm87g51s.js";
|
|
15
15
|
import {
|
|
16
16
|
isRecord
|
|
17
17
|
} from "./index-qyrqwr4c.js";
|
package/dist/index.js
CHANGED
|
@@ -405,8 +405,7 @@ import ky, {
|
|
|
405
405
|
isTimeoutError
|
|
406
406
|
} from "ky";
|
|
407
407
|
|
|
408
|
-
// src/
|
|
409
|
-
var TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(.*)$/i;
|
|
408
|
+
// src/internal/random-hex.ts
|
|
410
409
|
function randomHex(bytes) {
|
|
411
410
|
const arr = new Uint8Array(bytes);
|
|
412
411
|
crypto.getRandomValues(arr);
|
|
@@ -415,6 +414,9 @@ function randomHex(bytes) {
|
|
|
415
414
|
hex += byte.toString(16).padStart(2, "0");
|
|
416
415
|
return hex;
|
|
417
416
|
}
|
|
417
|
+
|
|
418
|
+
// src/observability/trace.ts
|
|
419
|
+
var TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(.*)$/i;
|
|
418
420
|
function createTraceContext() {
|
|
419
421
|
return { traceId: randomHex(16), spanId: randomHex(8) };
|
|
420
422
|
}
|
|
@@ -2461,7 +2463,7 @@ function createSocketIOClientInternal(config, onRequestPhase) {
|
|
|
2461
2463
|
},
|
|
2462
2464
|
emitWithAck(event, args, options) {
|
|
2463
2465
|
const trace = onRequestPhase || options.onPhase ? {
|
|
2464
|
-
requestId:
|
|
2466
|
+
requestId: randomHex(16),
|
|
2465
2467
|
event,
|
|
2466
2468
|
startedAt: performance.now(),
|
|
2467
2469
|
observeClient: onRequestPhase,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random-hex.d.ts","sourceRoot":"","sources":["../../src/internal/random-hex.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/C"}
|
package/dist/node.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createHandler,
|
|
6
6
|
createSocketIOServer,
|
|
7
7
|
createUnixClientTransport
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-cx84zg25.js";
|
|
9
9
|
import {
|
|
10
10
|
createImplement,
|
|
11
11
|
createImplementRegistry,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
implement,
|
|
16
16
|
implementRegistry
|
|
17
17
|
} from "./index-vbf2p6me.js";
|
|
18
|
-
import"./index-
|
|
18
|
+
import"./index-w9m1wznn.js";
|
|
19
19
|
import"./index-7b188kmz.js";
|
|
20
20
|
import {
|
|
21
21
|
ShutdownOptionsSchema,
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
ShutdownStateSchema,
|
|
24
24
|
ShutdownStatusSchema,
|
|
25
25
|
createServerLifecycle
|
|
26
|
-
} from "./index-
|
|
27
|
-
import"./index-
|
|
26
|
+
} from "./index-3z73fh2c.js";
|
|
27
|
+
import"./index-nt1mp8km.js";
|
|
28
28
|
import"./index-vj3vvpaa.js";
|
|
29
29
|
import {
|
|
30
30
|
AppError,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
setRequestError,
|
|
22
22
|
setRequestUser,
|
|
23
23
|
wrapInRequestContext
|
|
24
|
-
} from "../index-
|
|
24
|
+
} from "../index-w9m1wznn.js";
|
|
25
25
|
import {
|
|
26
26
|
childSpan,
|
|
27
27
|
createTraceContext,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
recordedErrorMessage,
|
|
31
31
|
resolvePropagationContext,
|
|
32
32
|
resolveTraceContext
|
|
33
|
-
} from "../index-
|
|
33
|
+
} from "../index-nt1mp8km.js";
|
|
34
34
|
import"../index-vj3vvpaa.js";
|
|
35
35
|
import"../index-0w9abg87.js";
|
|
36
36
|
import {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/observability/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/observability/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID,qEAAqE;AACrE,wBAAgB,kBAAkB,IAAI,YAAY,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,GAAG,IAAI,CAmBvF;AAED,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAS5D;AAuBD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,QAAQ,CAAC,EAAE,YAAY,GACtB,YAAY,CAkBd"}
|
|
@@ -8,7 +8,7 @@ export declare const RealtimeRequestPhaseSchema: z.ZodEnum<{
|
|
|
8
8
|
settled: "settled";
|
|
9
9
|
timeout: "timeout";
|
|
10
10
|
}>;
|
|
11
|
-
/** Metadata-only observation:
|
|
11
|
+
/** Metadata-only observation: opaque local IDs (not a UUID contract), no payload or packet bytes. */
|
|
12
12
|
export declare const RealtimeRequestPhaseEventSchema: z.ZodObject<{
|
|
13
13
|
requestId: z.ZodString;
|
|
14
14
|
event: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/realtime/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B;;;;;;EAMrC,CAAC;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KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAIxC;CACF;AAED;;;;;;;;;GASG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,+BAA+B;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,sBAAsB,EAAE,GAAG,SAAS,CAAC;IAEtD,YACE,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,sBAAsB,EAAE,EAOlC;CACF"}
|
package/dist/remote.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiError,
|
|
3
3
|
createClient
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
4
|
+
} from "./index-6d32zk83.js";
|
|
5
|
+
import"./index-1rxswfbv.js";
|
|
6
|
+
import"./index-nt1mp8km.js";
|
|
7
7
|
import {
|
|
8
8
|
mergeMeta
|
|
9
9
|
} from "./index-vj3vvpaa.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-stream.d.ts","sourceRoot":"","sources":["../../src/server/contract-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"contract-stream.d.ts","sourceRoot":"","sources":["../../src/server/contract-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,aAAa,CAAC;AAQrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiB/C,gEAAgE;AAChE,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,UAAU,EAAE,wBAAwB,EACpC,cAAc,EAAE,eAAe,GAC9B,OAAO,CAAC,QAAQ,CAAC,CAoHnB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Request identity stays native: cloning it would break runtime timeout/upgrade APIs. */
|
|
2
|
+
interface StreamLifetime {
|
|
3
|
+
cancel(): void;
|
|
4
|
+
settled: Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
/** Abort-aware I/O may reject with the signal reason or wrap it as its cause. */
|
|
7
|
+
export declare function isStreamCancellation(error: unknown, signal: AbortSignal): boolean;
|
|
8
|
+
/** Internal bridge between Fetch-clean streaming routes and their managed server. */
|
|
9
|
+
export declare function ownHttpStream(request: Request, stream: StreamLifetime): void;
|
|
10
|
+
export declare function settleStreamCleanup(operations: readonly Promise<unknown>[]): Promise<void>;
|
|
11
|
+
export declare function createHttpStreamTracker(): {
|
|
12
|
+
bind(request: Request, onComplete: () => void): () => void;
|
|
13
|
+
readonly pendingRequests: number;
|
|
14
|
+
cancel(): void;
|
|
15
|
+
assertClean: () => void;
|
|
16
|
+
drain(): Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=http-stream-lifetime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-stream-lifetime.d.ts","sourceRoot":"","sources":["../../src/server/http-stream-lifetime.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,UAAU,cAAc;IACtB,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAQD,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAMjF;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAE5E;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,SAAS,OAAO,CAAC,OAAO,CAAC,EAAE,GACtC,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAgB,uBAAuB;kBAWrB,OAAO,cAAc,MAAM,IAAI,GAAG,MAAM,IAAI;8BAkCnC,MAAM;;;;EAehC"}
|
package/dist/server/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
sseRoute,
|
|
14
14
|
streamingRoute,
|
|
15
15
|
webSocketLane
|
|
16
|
-
} from "../index-
|
|
16
|
+
} from "../index-cx84zg25.js";
|
|
17
17
|
import {
|
|
18
18
|
composeAuthHooks,
|
|
19
19
|
createAuthHook,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
getTraceId,
|
|
49
49
|
resolveSocketIp,
|
|
50
50
|
resolveTraceId
|
|
51
|
-
} from "../index-
|
|
51
|
+
} from "../index-w9m1wznn.js";
|
|
52
52
|
import {
|
|
53
53
|
isWithinDir,
|
|
54
54
|
realPathWithinDir
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
ShutdownStateSchema,
|
|
61
61
|
ShutdownStatusSchema,
|
|
62
62
|
createServerLifecycle
|
|
63
|
-
} from "../index-
|
|
63
|
+
} from "../index-3z73fh2c.js";
|
|
64
64
|
import {
|
|
65
65
|
jsonSchemaFields,
|
|
66
66
|
toJsonSchema
|
|
@@ -69,13 +69,13 @@ import {
|
|
|
69
69
|
inputIsQuery,
|
|
70
70
|
parseSSE,
|
|
71
71
|
streamSSE
|
|
72
|
-
} from "../index-
|
|
72
|
+
} from "../index-1rxswfbv.js";
|
|
73
73
|
import {
|
|
74
74
|
errorCode,
|
|
75
75
|
formatZodError,
|
|
76
76
|
normalizeError,
|
|
77
77
|
zodIssues
|
|
78
|
-
} from "../index-
|
|
78
|
+
} from "../index-nt1mp8km.js";
|
|
79
79
|
import {
|
|
80
80
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
81
81
|
joinRoutePath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../src/server/shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../src/server/shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,mBAAmB;;;;;;;EAO9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,qBAAqB;;;;;;iBAehC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;iBAM/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;iBAY/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB,CAAC,QAAQ;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,eAAe,IAAI,MAAM,CAAC;IAC1B,iBAAiB,IAAI,MAAM,CAAC;IAC5B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,UAAU,eAAe;IACvB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAC1E,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9D;AAoFD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,eAAe,GAAG,eAAe,CA4KxF"}
|
|
@@ -103,7 +103,7 @@ export interface SocketIOServerConfig<TParsed = any, TData = TParsed> {
|
|
|
103
103
|
};
|
|
104
104
|
/** Socket.IO endpoint path. Default `/socket.io/`. */
|
|
105
105
|
path?: string;
|
|
106
|
-
/**
|
|
106
|
+
/** Admitted transports. Bun defaults to both; Node defaults to websocket only. */
|
|
107
107
|
transports?: Array<'websocket' | 'polling'>;
|
|
108
108
|
/** Heartbeat: ms without a pong before the connection is dropped. */
|
|
109
109
|
pingTimeout?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-io-config.d.ts","sourceRoot":"","sources":["../../src/server/socket-io-config.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,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oBAAoB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,WAAW,CAAC,GAC3E,YAAY,CAMd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-route.d.ts","sourceRoot":"","sources":["../../src/server/streaming-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"streaming-route.d.ts","sourceRoot":"","sources":["../../src/server/streaming-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,uFAAuF;AACvF,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AAEjD,MAAM,WAAW,qBAAqB,CAAC,OAAO,GAAG,OAAO;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,MAAM,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC;IAC5B,sCAAsC;IACtC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;OAOG;IACH,MAAM,EAAE,CACN,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,KACrC,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,sBAAsB,CAAC,OAAO,GAAG,OAAO,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IACzF,4EAA4E;IAC5E,MAAM,EAAE,WAAW,CAAC;CACrB;AAiGD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAG,OAAO,EAC9C,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,GACtC,QAAQ,CAAC,OAAO,CAAC,CA4OnB;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,OAAO,GAAG,OAAO,EAC3C,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,GACtD,QAAQ,CAAC,OAAO,CAAC,CAEnB;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,OAAO,GAAG,OAAO,EACxC,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,GACtD,QAAQ,CAAC,OAAO,CAAC,CAEnB"}
|
package/dist/testing.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./index-x1th9s8c.js";
|
|
5
5
|
import {
|
|
6
6
|
createApplication
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-hvftzz91.js";
|
|
8
8
|
import"./index-2k4yrqkc.js";
|
|
9
9
|
import"./index-8eywc9zv.js";
|
|
10
10
|
import {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
RealtimeRequestInvalidAcknowledgementError,
|
|
13
13
|
RealtimeRequestTimeoutError
|
|
14
14
|
} from "./index-7b188kmz.js";
|
|
15
|
-
import"./index-
|
|
15
|
+
import"./index-3z73fh2c.js";
|
|
16
16
|
import {
|
|
17
17
|
mcpProjectionCandidate,
|
|
18
18
|
prepareProjectedMcpTools,
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
createClient,
|
|
26
26
|
createClients
|
|
27
|
-
} from "./index-
|
|
28
|
-
import"./index-
|
|
29
|
-
import"./index-
|
|
27
|
+
} from "./index-6d32zk83.js";
|
|
28
|
+
import"./index-1rxswfbv.js";
|
|
29
|
+
import"./index-nt1mp8km.js";
|
|
30
30
|
import {
|
|
31
31
|
joinRoutePath
|
|
32
32
|
} from "./index-vj3vvpaa.js";
|
package/dist/tool-invoker.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createToolInvoker
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
3
|
+
} from "./index-ekkt4gy9.js";
|
|
4
|
+
import"./index-ejv31h14.js";
|
|
5
|
+
import"./index-qm87g51s.js";
|
|
6
|
+
import"./index-w9m1wznn.js";
|
|
7
7
|
import"./index-22by16v6.js";
|
|
8
8
|
import"./index-cby4ar3v.js";
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-nt1mp8km.js";
|
|
10
10
|
import"./index-vj3vvpaa.js";
|
|
11
11
|
import"./index-0w9abg87.js";
|
|
12
12
|
import"./index-qyrqwr4c.js";
|
package/dist/tools.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
buildToolManifest,
|
|
6
6
|
mountAgent
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-trrf7nch.js";
|
|
8
8
|
import"./index-3xnq72rz.js";
|
|
9
9
|
import {
|
|
10
10
|
signJwt,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./index-vbf2p6me.js";
|
|
21
21
|
import {
|
|
22
22
|
createToolInvoker
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-ekkt4gy9.js";
|
|
24
24
|
import {
|
|
25
25
|
WaitTimeoutError,
|
|
26
26
|
createCli,
|
|
@@ -29,10 +29,10 @@ import {
|
|
|
29
29
|
fetchPinnedDocument,
|
|
30
30
|
readCapped,
|
|
31
31
|
runWaitOperation
|
|
32
|
-
} from "./index-
|
|
32
|
+
} from "./index-tnazr5tc.js";
|
|
33
33
|
import {
|
|
34
34
|
collectToolSurface
|
|
35
|
-
} from "./index-
|
|
35
|
+
} from "./index-hxtm2xr2.js";
|
|
36
36
|
import {
|
|
37
37
|
createRuntimeToolFactory,
|
|
38
38
|
defineRuntimeTool
|
|
@@ -41,19 +41,19 @@ import {
|
|
|
41
41
|
collectTools,
|
|
42
42
|
createToolRunner,
|
|
43
43
|
formatToolError
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-ejv31h14.js";
|
|
45
45
|
import {
|
|
46
46
|
ToolExecutionControlError,
|
|
47
47
|
coerceJsonArgs,
|
|
48
48
|
executeToolMethod,
|
|
49
49
|
isToolExecutionControlError,
|
|
50
50
|
toolResultFromError
|
|
51
|
-
} from "./index-
|
|
51
|
+
} from "./index-qm87g51s.js";
|
|
52
52
|
import {
|
|
53
53
|
getRequestContext,
|
|
54
54
|
getTraceId,
|
|
55
55
|
runWithRequestContext
|
|
56
|
-
} from "./index-
|
|
56
|
+
} from "./index-w9m1wznn.js";
|
|
57
57
|
import {
|
|
58
58
|
ManagedFileError
|
|
59
59
|
} from "./index-bfcpjw20.js";
|
|
@@ -73,7 +73,7 @@ import"./index-cby4ar3v.js";
|
|
|
73
73
|
import {
|
|
74
74
|
normalizeError,
|
|
75
75
|
resolvePropagationContext
|
|
76
|
-
} from "./index-
|
|
76
|
+
} from "./index-nt1mp8km.js";
|
|
77
77
|
import {
|
|
78
78
|
defineContract
|
|
79
79
|
} from "./index-vj3vvpaa.js";
|
package/llms-full.txt
CHANGED
|
@@ -960,8 +960,11 @@ const result = await server.shutdown({
|
|
|
960
960
|
})
|
|
961
961
|
```
|
|
962
962
|
|
|
963
|
-
The first call closes HTTP and Socket.IO admission
|
|
964
|
-
|
|
963
|
+
The first call closes HTTP and Socket.IO admission and cancels owned contract streams and
|
|
964
|
+
`streamingRoute` / `ndjsonRoute` / `sseRoute` sources. Their supplied `signal` is the lifetime:
|
|
965
|
+
waiting producers must honour it, and their iterator cleanup must finish. No separate application
|
|
966
|
+
abort controller or copied shutdown loop is required. Admitted finite HTTP/application work and
|
|
967
|
+
stream cleanup share the full `gracePeriodMs` budget. Once that work drains, `realtimeCloseTimeoutMs` (default `1_000`)
|
|
965
968
|
bounds WebSocket close handshakes inside the same outer deadline. Any upgraded sockets still open
|
|
966
969
|
at that boundary are terminated without shortening HTTP grace, and graceful runtime shutdown
|
|
967
970
|
continues. If the outer grace budget or external signal forces destructive teardown,
|
|
@@ -970,11 +973,18 @@ the first options win. New
|
|
|
970
973
|
ordinary HTTP work receives `503`, `Retry-After` and `Connection: close` outside
|
|
971
974
|
`wrapFetch`. `result.outcome` is `clean` or `forced`; a forced result preserves
|
|
972
975
|
the pending snapshot and reason while final pending counters describe the
|
|
973
|
-
post-close transport state
|
|
976
|
+
post-close transport state and any still-owned stream cleanup. A streaming request increments
|
|
977
|
+
`completedRequests` only after its source cleanup settles, not when its `Response` is returned.
|
|
978
|
+
`abortedRequests` counts requests pending at outer force, not subscriptions closed cooperatively
|
|
979
|
+
during grace. `forcedWebSockets` counts both sockets terminated at the dedicated
|
|
974
980
|
realtime bound and sockets terminated by outer force; `pendingWebSocketsAtForce` is only the latter
|
|
975
981
|
snapshot, so a clean result can truthfully report a bounded realtime termination. A graceful phase error still runs forced cleanup and
|
|
976
982
|
then rejects with the original error; a forced transport that cannot confirm
|
|
977
|
-
completion before `forceTimeoutMs` rejects instead of reporting a false zero.
|
|
983
|
+
completion before `forceTimeoutMs` rejects instead of reporting a false zero. An uncooperative
|
|
984
|
+
stream stays pending even if its connection is gone; a cleanup error rejects shutdown.
|
|
985
|
+
Standalone `createHandler` and arbitrary raw `Response` bodies have no managed source ownership:
|
|
986
|
+
their embedding host/producer owns cancellation. Request identity must be retained by `wrapFetch`
|
|
987
|
+
when forwarding to owned streaming routes; it is also required by native timeout/upgrade APIs.
|
|
978
988
|
`runtime` is a diagnostics escape hatch, not a second canonical stop path.
|
|
979
989
|
|
|
980
990
|
### Trusted HTTPS in development
|
|
@@ -5219,6 +5229,12 @@ try {
|
|
|
5219
5229
|
`release()` is idempotent. Admission and counter increment are atomic, so work
|
|
5220
5230
|
cannot slip between the shutdown check and drain accounting.
|
|
5221
5231
|
|
|
5232
|
+
`managedServerResource` already owns contract/streaming-route response lifetimes. It cancels
|
|
5233
|
+
their supplied signals at admission close and awaits source cleanup before dependent resources
|
|
5234
|
+
close. Do not add application admission leases or a second cancellation registry for those
|
|
5235
|
+
streams. A source that ignores cancellation or fails its cleanup prevents a clean shutdown;
|
|
5236
|
+
the existing grace and force budgets still bound the result.
|
|
5237
|
+
|
|
5222
5238
|
### Bounded operation admission
|
|
5223
5239
|
|
|
5224
5240
|
Compose `createBoundedAdmission` when accepted work also competes for a finite
|
|
@@ -6294,6 +6310,13 @@ the typed **`handshake`** identity gate (schema + verify →
|
|
|
6294
6310
|
[typed `socket.data`](#handshake-auth--cookie-or-token)). `allowRequest` is the
|
|
6295
6311
|
transport gate (composed with managed-shutdown admission on both Bun and Node);
|
|
6296
6312
|
`handshake` is the identity gate that runs after it.
|
|
6313
|
+
`transports` is an admission allowlist: `['websocket']` refuses polling,
|
|
6314
|
+
`['polling']` refuses WebSocket handshakes/upgrades, and both explicitly enabled
|
|
6315
|
+
transports remain usable. Defaults are both transports on Bun and WebSocket-only
|
|
6316
|
+
on Node. Bun enforces this before consumer authorization through the engine's
|
|
6317
|
+
request-policy extension (including existing sessions); Node uses native Engine.IO
|
|
6318
|
+
enforcement. Bun's native upgrade hints do not override the allowlist. CORS
|
|
6319
|
+
preflight is not transport admission and keeps its ordinary behavior.
|
|
6297
6320
|
For anything else socket.io's `ServerOptions` exposes, use the
|
|
6298
6321
|
typed **`serverOptions`** passthrough — most often `maxHttpBufferSize` to lift the
|
|
6299
6322
|
1 MB default for large emits:
|
|
@@ -6577,6 +6600,12 @@ closed phase:
|
|
|
6577
6600
|
| `timeout` | the existing native acknowledgement timeout won |
|
|
6578
6601
|
| `disconnected` | the request began disconnected or an in-flight disconnect won |
|
|
6579
6602
|
|
|
6603
|
+
Observation also works on non-localhost HTTP origins: identity generation uses
|
|
6604
|
+
browser-compatible `crypto.getRandomValues`, not secure-context-only
|
|
6605
|
+
`crypto.randomUUID`. A `requestId` is opaque local diagnostic identity, not a
|
|
6606
|
+
promised UUID format, authentication token or transmitted field. Bun and Node
|
|
6607
|
+
use the same mechanism; enabling observation adds no HTTPS requirement.
|
|
6608
|
+
|
|
6580
6609
|
When a caller needs to join those phases to its own invocation, put `onPhase`
|
|
6581
6610
|
on that request's options and keep the caller identity in the hook's closure:
|
|
6582
6611
|
|
|
@@ -11930,7 +11959,7 @@ Also re-exports the error helpers from `stitchkit/contract`.
|
|
|
11930
11959
|
| `BunServerHandle` | _type_ | managed Bun handle (`url`, `port`, `runtime`, `status`, `shutdown`) |
|
|
11931
11960
|
| `ManagedServerHandle` | _type_ | shared lifecycle shape generic over the runtime escape hatch |
|
|
11932
11961
|
| `ShutdownOptionsSchema` / `ShutdownOptions` | schema / _type_ | HTTP/application grace, a separate WebSocket close-handshake bound, bounded forced-completion timeout, retry hint and optional external abort signal |
|
|
11933
|
-
| `ShutdownStatusSchema` / `ShutdownStatus` | schema / _type_ | live state and request/WebSocket counters |
|
|
11962
|
+
| `ShutdownStatusSchema` / `ShutdownStatus` | schema / _type_ | live state and request/WebSocket counters; owned streams remain pending through source cleanup |
|
|
11934
11963
|
| `ShutdownResultSchema` / `ShutdownResult` | schema / _type_ | clean/forced result with final counters, outer-force snapshots and `forcedWebSockets` including bounded realtime terminations |
|
|
11935
11964
|
| `ShutdownStateSchema` / `ShutdownState` | schema / _type_ | managed lifecycle state machine |
|
|
11936
11965
|
| `ServiceDef` | _type_ | the result of `implement` |
|
package/package.json
CHANGED