stitchkit 0.70.0 → 0.70.1
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/coding-tool-files.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-paths.d.ts +0 -1
- package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/contained-files.d.ts +30 -7
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime-coding-tools.js +29 -32
- package/dist/agent-runtime-harness.js +1 -1
- package/dist/application/server-resource.d.ts +1 -0
- package/dist/application/server-resource.d.ts.map +1 -1
- package/dist/application.js +5 -2
- package/dist/index-1z5xxfst.js +397 -0
- package/dist/{index-38hs3a58.js → index-4g196jmf.js} +4 -1
- package/dist/{index-dk6e56g0.js → index-7wpgrqa8.js} +37 -2
- package/dist/{index-6wzr93cg.js → index-w0445741.js} +1 -1
- package/dist/node.js +22 -2
- package/dist/server/bun.d.ts.map +1 -1
- package/dist/server/index.js +10 -2
- package/dist/server/node.d.ts.map +1 -1
- package/dist/server/process-signals.d.ts.map +1 -1
- package/dist/server/shutdown.d.ts +2 -0
- package/dist/server/shutdown.d.ts.map +1 -1
- package/dist/testing.js +2 -2
- package/llms-full.txt +22 -13
- package/native/darwin-arm64.node +0 -0
- package/native/darwin-x64.node +0 -0
- package/package.json +3 -1
- package/dist/index-xbtcszs7.js +0 -202
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coding-tool-files.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coding-tool-files.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-files.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAK3B,MAAM,wBAAwB,CAAC;AAyBhC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,SAAS,yBAAyB,EAAE,CAuFtC"}
|
|
@@ -13,7 +13,6 @@ export declare function editableCodingPath(root: string, requested: string, maxP
|
|
|
13
13
|
relative: string;
|
|
14
14
|
}>;
|
|
15
15
|
export declare function authorizeCodingTool(config: AgentCodingToolConfig, request: AgentCodingToolAuthorization): Promise<void>;
|
|
16
|
-
export declare function atomicCodingReplace(target: string, content: string, mode?: number): Promise<void>;
|
|
17
16
|
/** Serialize framework-owned compare-and-replace transactions for one canonical target. */
|
|
18
17
|
export declare function withCodingPathLock<T>(target: string, work: () => Promise<T>): Promise<T>;
|
|
19
18
|
export declare function textOccurrences(source: string, search: string): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coding-tool-paths.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,4BAA4B,EAEjC,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAC;AAoBhC,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAGzF;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAKrB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAarB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAQrB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAGf;
|
|
1
|
+
{"version":3,"file":"coding-tool-paths.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,4BAA4B,EAEjC,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAC;AAoBhC,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAGzF;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAKrB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAarB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAQrB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAGf;AAID,2FAA2F;AAC3F,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coding-tool-search-patch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-search-patch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coding-tool-search-patch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-search-patch.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAiEhC,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,SAAS,yBAAyB,EAAE,CAsItC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Stats } from 'node:fs';
|
|
2
2
|
export interface ContainedFile {
|
|
3
3
|
absolute: string;
|
|
4
4
|
relative: string;
|
|
@@ -14,18 +14,40 @@ export interface ContainedFileScan {
|
|
|
14
14
|
skippedDirectories: number;
|
|
15
15
|
skippedSymlinks: number;
|
|
16
16
|
}
|
|
17
|
+
export interface ContainedFileHandle {
|
|
18
|
+
readonly fd: number;
|
|
19
|
+
close(): Promise<void>;
|
|
20
|
+
read(buffer: Buffer, offset: number, length: number, position: number): Promise<{
|
|
21
|
+
bytesRead: number;
|
|
22
|
+
}>;
|
|
23
|
+
stat(): Promise<Stats>;
|
|
24
|
+
}
|
|
25
|
+
interface ContainedEntryMetadata {
|
|
26
|
+
mode: number;
|
|
27
|
+
isDirectory(): boolean;
|
|
28
|
+
isFile(): boolean;
|
|
29
|
+
isSymbolicLink(): boolean;
|
|
30
|
+
}
|
|
17
31
|
export interface ContainedParent {
|
|
18
|
-
handle:
|
|
19
|
-
path: string;
|
|
32
|
+
handle: ContainedFileHandle;
|
|
20
33
|
basename: string;
|
|
21
34
|
}
|
|
22
35
|
/** Pin every ancestor as a directory descriptor before returning the final parent capability. */
|
|
23
36
|
export declare function openContainedParent(root: string, relative: string): Promise<ContainedParent>;
|
|
24
37
|
/** Open a final regular-file candidate through pinned ancestors without following symlinks. */
|
|
25
|
-
export declare function openContainedFile(root: string, relative: string): Promise<
|
|
26
|
-
export declare function assertContainedFileCurrent(root: string, relative: string, expected:
|
|
27
|
-
export declare function assertContainedParentCurrent(root: string, relative: string, expected:
|
|
28
|
-
|
|
38
|
+
export declare function openContainedFile(root: string, relative: string): Promise<ContainedFileHandle>;
|
|
39
|
+
export declare function assertContainedFileCurrent(root: string, relative: string, expected: ContainedFileHandle): Promise<void>;
|
|
40
|
+
export declare function assertContainedParentCurrent(root: string, relative: string, expected: ContainedFileHandle): Promise<void>;
|
|
41
|
+
/** Create or atomically replace one direct child through the pinned parent descriptor. */
|
|
42
|
+
export declare function writeContainedFile(input: {
|
|
43
|
+
parent: ContainedParent;
|
|
44
|
+
content: string;
|
|
45
|
+
replace: boolean;
|
|
46
|
+
mode?: number;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
export declare function containedEntryMetadata(parent: ContainedParent): Promise<ContainedEntryMetadata | null>;
|
|
49
|
+
export declare function openContainedParentFile(parent: ContainedParent): Promise<ContainedFileHandle>;
|
|
50
|
+
export declare function readContainedUtf8Handle(handle: ContainedFileHandle, maxBytes: number): Promise<{
|
|
29
51
|
text: string;
|
|
30
52
|
bytes: number;
|
|
31
53
|
mode: number;
|
|
@@ -53,4 +75,5 @@ export declare function scanContainedFiles(input: {
|
|
|
53
75
|
skipUnreadable?: boolean;
|
|
54
76
|
excludeDirectory?: (relative: string) => boolean;
|
|
55
77
|
}): Promise<ContainedFileScan>;
|
|
78
|
+
export {};
|
|
56
79
|
//# sourceMappingURL=contained-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contained-files.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contained-files.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,KAAK,EAEX,MAAM,SAAS,CAAC;AAMjB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED,MAAM,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CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAClD,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+E7B"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertContainedFileCurrent,
|
|
3
3
|
assertContainedParentCurrent,
|
|
4
|
+
containedEntryMetadata,
|
|
4
5
|
openContainedFile,
|
|
5
6
|
openContainedParent,
|
|
7
|
+
openContainedParentFile,
|
|
6
8
|
readContainedUtf8Handle,
|
|
7
|
-
scanContainedFiles
|
|
8
|
-
|
|
9
|
+
scanContainedFiles,
|
|
10
|
+
writeContainedFile
|
|
11
|
+
} from "./index-1z5xxfst.js";
|
|
9
12
|
import {
|
|
10
13
|
defineRuntimeTool
|
|
11
14
|
} from "./index-wwst0td5.js";
|
|
@@ -20,7 +23,7 @@ import"./index-qyrqwr4c.js";
|
|
|
20
23
|
import"./index-6k1937bx.js";
|
|
21
24
|
|
|
22
25
|
// src/agent-runtime/coding-tools.ts
|
|
23
|
-
import
|
|
26
|
+
import path3 from "node:path";
|
|
24
27
|
import { z as z3 } from "zod";
|
|
25
28
|
|
|
26
29
|
// src/agent-runtime/coding-tool-contract.ts
|
|
@@ -141,11 +144,10 @@ function resolveCodingToolLimits(input) {
|
|
|
141
144
|
|
|
142
145
|
// src/agent-runtime/coding-tool-files.ts
|
|
143
146
|
import { createHash } from "node:crypto";
|
|
144
|
-
import {
|
|
145
|
-
import path2 from "node:path";
|
|
147
|
+
import { realpath as realpath2 } from "node:fs/promises";
|
|
146
148
|
|
|
147
149
|
// src/agent-runtime/coding-tool-paths.ts
|
|
148
|
-
import { lstat, realpath
|
|
150
|
+
import { lstat, realpath } from "node:fs/promises";
|
|
149
151
|
import path from "node:path";
|
|
150
152
|
function within(root, target) {
|
|
151
153
|
const relative = path.relative(root, target);
|
|
@@ -177,18 +179,6 @@ async function authorizeCodingTool(config, request) {
|
|
|
177
179
|
if (!await config.authorize(parsed))
|
|
178
180
|
forbidden("Coding tool permission denied");
|
|
179
181
|
}
|
|
180
|
-
async function atomicCodingReplace(target, content, mode) {
|
|
181
|
-
const temporary = path.join(path.dirname(target), `.${path.basename(target)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
182
|
-
try {
|
|
183
|
-
await writeFile(temporary, content, { flag: "wx", ...mode !== undefined && { mode } });
|
|
184
|
-
await rename(temporary, target);
|
|
185
|
-
} catch (error) {
|
|
186
|
-
await unlink(temporary).catch(() => {
|
|
187
|
-
return;
|
|
188
|
-
});
|
|
189
|
-
throw error;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
182
|
var codingPathLocks = new Map;
|
|
193
183
|
async function withCodingPathLock(target, work) {
|
|
194
184
|
const previous = codingPathLocks.get(target) ?? Promise.resolve();
|
|
@@ -294,7 +284,6 @@ function createFileCodingTools(config, limits) {
|
|
|
294
284
|
if (bytes > limits.maxWriteBytes)
|
|
295
285
|
throw new Error("Coding tool write exceeds maxWriteBytes");
|
|
296
286
|
const parent = await openContainedParent(root, relative);
|
|
297
|
-
const target = path2.join(parent.path, parent.basename);
|
|
298
287
|
try {
|
|
299
288
|
await authorizeCodingTool(config, {
|
|
300
289
|
operation: "write",
|
|
@@ -304,12 +293,17 @@ function createFileCodingTools(config, limits) {
|
|
|
304
293
|
});
|
|
305
294
|
await assertContainedParentCurrent(root, relative, parent.handle);
|
|
306
295
|
if (input.overwrite) {
|
|
307
|
-
const current = await
|
|
296
|
+
const current = await containedEntryMetadata(parent);
|
|
308
297
|
if (current?.isSymbolicLink())
|
|
309
298
|
throw new Error("Coding tools do not overwrite symlinks");
|
|
310
|
-
await
|
|
299
|
+
await writeContainedFile({
|
|
300
|
+
parent,
|
|
301
|
+
content: input.content,
|
|
302
|
+
replace: true,
|
|
303
|
+
...current && { mode: current.mode }
|
|
304
|
+
});
|
|
311
305
|
} else {
|
|
312
|
-
await
|
|
306
|
+
await writeContainedFile({ parent, content: input.content, replace: false });
|
|
313
307
|
}
|
|
314
308
|
} finally {
|
|
315
309
|
await parent.handle.close();
|
|
@@ -322,9 +316,8 @@ function createFileCodingTools(config, limits) {
|
|
|
322
316
|
|
|
323
317
|
// src/agent-runtime/coding-tool-search-patch.ts
|
|
324
318
|
import { createHash as createHash2 } from "node:crypto";
|
|
325
|
-
import {
|
|
326
|
-
import
|
|
327
|
-
import path3 from "node:path";
|
|
319
|
+
import { realpath as realpath3 } from "node:fs/promises";
|
|
320
|
+
import path2 from "node:path";
|
|
328
321
|
import { z as z2 } from "zod";
|
|
329
322
|
var DEFAULT_EXCLUDED_DIRECTORIES = [
|
|
330
323
|
".git",
|
|
@@ -387,7 +380,7 @@ function createSearchAndPatchCodingTools(config, limits) {
|
|
|
387
380
|
readMaxBytes: limits.maxReadBytes,
|
|
388
381
|
skipUnreadable: true
|
|
389
382
|
},
|
|
390
|
-
excludeDirectory: (relative) => relative.split(
|
|
383
|
+
excludeDirectory: (relative) => relative.split(path2.sep).some((segment) => excluded.has(segment))
|
|
391
384
|
});
|
|
392
385
|
const matches = [];
|
|
393
386
|
let truncated = false;
|
|
@@ -435,8 +428,7 @@ function createSearchAndPatchCodingTools(config, limits) {
|
|
|
435
428
|
const relative = boundedCodingRelativePath(input.path, limits.maxPathBytes);
|
|
436
429
|
const parent = await openContainedParent(root, relative);
|
|
437
430
|
try {
|
|
438
|
-
const
|
|
439
|
-
const initial = await open(target, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
431
|
+
const initial = await openContainedParentFile(parent);
|
|
440
432
|
const read = await readContainedUtf8Handle(initial, limits.maxWriteBytes).finally(() => initial.close());
|
|
441
433
|
const source = read.text;
|
|
442
434
|
const baseSha256 = sha256(source);
|
|
@@ -465,11 +457,16 @@ function createSearchAndPatchCodingTools(config, limits) {
|
|
|
465
457
|
await assertContainedParentCurrent(root, relative, parent.handle);
|
|
466
458
|
if (!input.dryRun) {
|
|
467
459
|
await withCodingPathLock(`${root}:${relative}`, async () => {
|
|
468
|
-
const currentHandle = await
|
|
460
|
+
const currentHandle = await openContainedParentFile(parent);
|
|
469
461
|
const current = await readContainedUtf8Handle(currentHandle, limits.maxWriteBytes).finally(() => currentHandle.close());
|
|
470
462
|
if (sha256(current.text) !== baseSha256)
|
|
471
463
|
conflict("Coding patch base digest became stale before apply");
|
|
472
|
-
await
|
|
464
|
+
await writeContainedFile({
|
|
465
|
+
parent,
|
|
466
|
+
content: changed,
|
|
467
|
+
replace: true,
|
|
468
|
+
mode: current.mode
|
|
469
|
+
});
|
|
473
470
|
});
|
|
474
471
|
}
|
|
475
472
|
return {
|
|
@@ -695,10 +692,10 @@ var AGENT_CODING_TOOL_NAMES = {
|
|
|
695
692
|
writeFile: "write_file"
|
|
696
693
|
};
|
|
697
694
|
function createAgentCodingTools(config) {
|
|
698
|
-
if (!
|
|
695
|
+
if (!path3.isAbsolute(config.root))
|
|
699
696
|
throw new Error("Coding tool root must be absolute");
|
|
700
697
|
for (const executable of Object.values(config.executables ?? {})) {
|
|
701
|
-
if (!
|
|
698
|
+
if (!path3.isAbsolute(executable)) {
|
|
702
699
|
throw new Error("Coding tool executables must be absolute paths");
|
|
703
700
|
}
|
|
704
701
|
}
|
|
@@ -14,6 +14,7 @@ export interface ManagedServerResourceConfig<TRuntime> {
|
|
|
14
14
|
readonly dependsOn?: readonly ManagedResourceDependency[];
|
|
15
15
|
readonly required?: boolean;
|
|
16
16
|
readonly retryAfterSeconds?: number;
|
|
17
|
+
readonly realtimeCloseTimeoutMs?: number;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* A managed resource that owns a managed server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-resource.d.ts","sourceRoot":"","sources":["../../src/application/server-resource.ts"],"names":[],"mappings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AC1D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB,CAAC,QAAQ,CAAE,SAAQ,eAAe;IACtE,KAAK,CACH,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC;QAAE,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED,uFAAuF;AACvF,wBAAgB,qBAAqB,CAAC,QAAQ,EAC5C,MAAM,EAAE,2BAA2B,CAAC,QAAQ,CAAC,GAC5C,qBAAqB,CAAC,QAAQ,CAAC,CA2IjC"}
|
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-w0445741.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-7wpgrqa8.js";
|
|
51
51
|
import"./index-0w9abg87.js";
|
|
52
52
|
import {
|
|
53
53
|
isRecord
|
|
@@ -1030,6 +1030,9 @@ function managedServerResource(config) {
|
|
|
1030
1030
|
...gracePeriodMs !== undefined && { gracePeriodMs },
|
|
1031
1031
|
...forceTimeoutMs !== undefined && { forceTimeoutMs },
|
|
1032
1032
|
retryAfterSeconds: grace(config.retryAfterSeconds ?? 5),
|
|
1033
|
+
...config.realtimeCloseTimeoutMs !== undefined && {
|
|
1034
|
+
realtimeCloseTimeoutMs: grace(config.realtimeCloseTimeoutMs)
|
|
1035
|
+
},
|
|
1033
1036
|
signal: context.signal
|
|
1034
1037
|
};
|
|
1035
1038
|
shutdownPromise = isHandle(server) ? server.shutdown(options) : server.then((handle) => handle.shutdown(options));
|