orkestrator 2.37.0-alpha → 2.37.1-beta
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/client.js +5699 -187
- package/dist/main.js +9417 -5289
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +93 -24
- package/resources/claude-bridge/dist/index.js +66 -15
- package/resources/codex-bridge/dist/index.js +110 -18
- package/resources/cursor-bridge/dist/index.js +8 -1
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +78 -16
- package/resources/pi-bridge/runtime/bun.lock +13 -13
- package/resources/pi-bridge/runtime/install.json +1 -1
- package/resources/release-runtime/bun.lock +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orkestrator",
|
|
3
|
-
"version": "2.37.
|
|
3
|
+
"version": "2.37.1-beta",
|
|
4
4
|
"description": "Run the Orkestrator backend service without the desktop application",
|
|
5
5
|
"homepage": "https://orkestrator.dev",
|
|
6
6
|
"repository": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"sharp": "0.35.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@orkestrator/protocol": "2.37.
|
|
43
|
-
"@orkestrator/toolchain": "2.37.
|
|
42
|
+
"@orkestrator/protocol": "2.37.1-beta",
|
|
43
|
+
"@orkestrator/toolchain": "2.37.1-beta"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"bun": ">=1.4.4"
|
|
@@ -324,6 +324,7 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
324
324
|
"instance.republish-failed": "The instance descriptor could not be republished; a later pass retries.",
|
|
325
325
|
"parent.exited": "The parent process exited, so local servers are shutting down.",
|
|
326
326
|
"startup.step-failed": "One part of startup failed and the backend carried on; `step` says which.",
|
|
327
|
+
"startup.failed": "Startup failed; the backend released what it had started and exits with code 1.",
|
|
327
328
|
"startup.setup-fence-failed": "An environment's interrupted setup could not be fenced.",
|
|
328
329
|
"startup.setup-adopt-failed": "An environment's pending setup could not be adopted.",
|
|
329
330
|
"startup.deletion-pending": "An interrupted environment deletion stays pending. Its owning step logged the detail.",
|
|
@@ -488,6 +489,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
488
489
|
"app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
|
|
489
490
|
"app-server.stderr": "Metadata of an app-server stderr line, never its content.",
|
|
490
491
|
"app-server.stderr-suppressed": "app-server stderr lines beyond the budget were counted, not described.",
|
|
492
|
+
"app-server.termination-unconfirmed": "app-server did not report an exit after SIGKILL; the restart or shutdown went on without it.",
|
|
491
493
|
"approval.cancel-failed": "Cancelling a turn after an approval answer failed.",
|
|
492
494
|
"approval.present-failed": "Presenting an approval threw; it is auto-declined.",
|
|
493
495
|
"approval.resolved-callback-failed": "An approval resolved callback threw.",
|
|
@@ -1045,7 +1047,9 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1045
1047
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
1046
1048
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
1047
1049
|
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
1048
|
-
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
|
|
1050
|
+
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
|
|
1051
|
+
"host-database.separated": "Host OpenCode uses Orkestrator's own database because the shared one has no `session` table (an OpenCode 2 database); `reason` says why.",
|
|
1052
|
+
"host-database.unreadable": "The shared OpenCode database could not be inspected, so host OpenCode opens it as usual. Error class only."
|
|
1049
1053
|
}
|
|
1050
1054
|
}
|
|
1051
1055
|
});
|
|
@@ -2003,6 +2007,7 @@ var WEB_BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
2003
2007
|
"transcript.load-failed": "A stage transcript read failed and will retry with backoff.",
|
|
2004
2008
|
"legacy.state-too-large": "Legacy pipeline state was over the limit and skipped.",
|
|
2005
2009
|
"opencode-catalog.load-failed": "The cached OpenCode model list could not be loaded.",
|
|
2010
|
+
"model-catalog.hydrate-failed": "A node's cached model lists could not be loaded for a launcher.",
|
|
2006
2011
|
"opencode-preferences.load-failed": "OpenCode model preferences could not be loaded."
|
|
2007
2012
|
}
|
|
2008
2013
|
}
|
|
@@ -3820,7 +3825,7 @@ function namesLimitOrLogin(text) {
|
|
|
3820
3825
|
return NOT_A_CAPACITY_REFUSAL.test(text);
|
|
3821
3826
|
}
|
|
3822
3827
|
|
|
3823
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
3828
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/v1/schema/index.js
|
|
3824
3829
|
var AGENT_METHODS = {
|
|
3825
3830
|
initialize: "initialize",
|
|
3826
3831
|
authenticate: "authenticate",
|
|
@@ -9666,7 +9671,7 @@ function preprocess(fn, schema) {
|
|
|
9666
9671
|
out: schema
|
|
9667
9672
|
});
|
|
9668
9673
|
}
|
|
9669
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
9674
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/core/schema-deserialize.js
|
|
9670
9675
|
var skippedItem = Symbol("skippedItem");
|
|
9671
9676
|
function defaultOnError(schema, fallback) {
|
|
9672
9677
|
return schema.catch(fallback);
|
|
@@ -9737,7 +9742,7 @@ function wideInt() {
|
|
|
9737
9742
|
});
|
|
9738
9743
|
}
|
|
9739
9744
|
|
|
9740
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
9745
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/v1/schema/zod.gen.js
|
|
9741
9746
|
var zRequestId = union([wideInt(), string2()]).nullable();
|
|
9742
9747
|
var zSessionId = string2();
|
|
9743
9748
|
var zWriteTextFileRequest = object({
|
|
@@ -11259,13 +11264,13 @@ var zCancelRequestNotification = object({
|
|
|
11259
11264
|
})
|
|
11260
11265
|
});
|
|
11261
11266
|
|
|
11262
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
11267
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/core/jsonrpc.js
|
|
11263
11268
|
var nullIdResponders = new WeakSet;
|
|
11264
11269
|
|
|
11265
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
11270
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/core/stream-limits.js
|
|
11266
11271
|
var DEFAULT_MAX_MESSAGE_BYTES = 32 * 1024 * 1024;
|
|
11267
11272
|
|
|
11268
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
11273
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/v1/schema/guards.gen.js
|
|
11269
11274
|
var zGuardCreateElicitationRequestForm = zElicitationFormMode.and(object({ mode: literal("form") })).and(object({ message: string2() }));
|
|
11270
11275
|
var zGuardCreateElicitationRequestUrl = zElicitationUrlMode.and(object({ mode: literal("url") })).and(object({ message: string2() }));
|
|
11271
11276
|
var zGuardCreateElicitationRequestCustom = union([zElicitationSessionScope, zElicitationRequestScope]).and(object({ message: string2() }));
|
|
@@ -11282,7 +11287,7 @@ var zGuardCreateElicitationResponseDecline = object({
|
|
|
11282
11287
|
var zGuardCreateElicitationResponseCancel = object({
|
|
11283
11288
|
action: literal("cancel")
|
|
11284
11289
|
});
|
|
11285
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
11290
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/core/app-handlers.js
|
|
11286
11291
|
function parseParams(parser, params) {
|
|
11287
11292
|
if (!parser) {
|
|
11288
11293
|
return params;
|
|
@@ -11293,10 +11298,10 @@ function parseParams(parser, params) {
|
|
|
11293
11298
|
return parser.parse(params);
|
|
11294
11299
|
}
|
|
11295
11300
|
|
|
11296
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
11301
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/core/connection-access.js
|
|
11297
11302
|
var connectionContextOf = Symbol("connectionContextOf");
|
|
11298
11303
|
|
|
11299
|
-
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+
|
|
11304
|
+
// ../../node_modules/.bun/@agentclientprotocol+sdk@2.4.0+b277ba6e31909555/node_modules/@agentclientprotocol/sdk/dist/v1/stable/acp.js
|
|
11300
11305
|
var initializedConnections = new WeakSet;
|
|
11301
11306
|
function emptyObjectResponse(response) {
|
|
11302
11307
|
return response ?? {};
|
|
@@ -12529,6 +12534,79 @@ function formatAcpRpcError(error, provider) {
|
|
|
12529
12534
|
return primary ?? detail ?? "ACP request failed";
|
|
12530
12535
|
}
|
|
12531
12536
|
|
|
12537
|
+
// ../../bridges/acp-bridge/src/acp-process-tree.ts
|
|
12538
|
+
import { execFile } from "node:child_process";
|
|
12539
|
+
import { promisify } from "node:util";
|
|
12540
|
+
var exec = promisify(execFile);
|
|
12541
|
+
async function processes() {
|
|
12542
|
+
if (process.platform === "win32")
|
|
12543
|
+
return [];
|
|
12544
|
+
const { stdout } = await exec("ps", ["-A", "-ww", "-o", "pid=,ppid=,lstart=,command="], {
|
|
12545
|
+
timeout: 2000,
|
|
12546
|
+
maxBuffer: 4 * 1024 * 1024
|
|
12547
|
+
});
|
|
12548
|
+
return stdout.split(`
|
|
12549
|
+
`).flatMap((line) => {
|
|
12550
|
+
const match = /^\s*(\d+)\s+(\d+)\s+(.+)$/.exec(line);
|
|
12551
|
+
return match ? [{ pid: Number(match[1]), parent: Number(match[2]), stamp: match[3] }] : [];
|
|
12552
|
+
});
|
|
12553
|
+
}
|
|
12554
|
+
async function terminateAcpProcessTree(child) {
|
|
12555
|
+
if (!child.pid || child.exitCode !== null || child.signalCode !== null)
|
|
12556
|
+
return;
|
|
12557
|
+
const table = await processes().catch(() => []);
|
|
12558
|
+
const owned = new Map;
|
|
12559
|
+
const parents = new Set([child.pid]);
|
|
12560
|
+
let changed = true;
|
|
12561
|
+
while (changed) {
|
|
12562
|
+
changed = false;
|
|
12563
|
+
for (const entry of table) {
|
|
12564
|
+
if (parents.has(entry.parent) && !parents.has(entry.pid)) {
|
|
12565
|
+
owned.set(entry.pid, entry);
|
|
12566
|
+
parents.add(entry.pid);
|
|
12567
|
+
changed = true;
|
|
12568
|
+
}
|
|
12569
|
+
}
|
|
12570
|
+
}
|
|
12571
|
+
const signal = (kind, table) => {
|
|
12572
|
+
const current = new Map(table.map((entry) => [entry.pid, entry]));
|
|
12573
|
+
for (const entry of Array.from(owned.values()).reverse()) {
|
|
12574
|
+
if (current.get(entry.pid)?.stamp !== entry.stamp)
|
|
12575
|
+
continue;
|
|
12576
|
+
try {
|
|
12577
|
+
process.kill(entry.pid, kind);
|
|
12578
|
+
} catch {}
|
|
12579
|
+
}
|
|
12580
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
12581
|
+
try {
|
|
12582
|
+
child.kill(kind);
|
|
12583
|
+
} catch {}
|
|
12584
|
+
}
|
|
12585
|
+
};
|
|
12586
|
+
const alive = (pid) => {
|
|
12587
|
+
try {
|
|
12588
|
+
process.kill(pid, 0);
|
|
12589
|
+
return true;
|
|
12590
|
+
} catch (error) {
|
|
12591
|
+
return error.code !== "ESRCH";
|
|
12592
|
+
}
|
|
12593
|
+
};
|
|
12594
|
+
const wait = async (ms) => {
|
|
12595
|
+
const deadline = Date.now() + ms;
|
|
12596
|
+
while (Date.now() < deadline) {
|
|
12597
|
+
if ((child.exitCode !== null || child.signalCode !== null) && !Array.from(owned.keys()).some(alive))
|
|
12598
|
+
return true;
|
|
12599
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
12600
|
+
}
|
|
12601
|
+
return false;
|
|
12602
|
+
};
|
|
12603
|
+
signal("SIGTERM", table);
|
|
12604
|
+
if (await wait(2000))
|
|
12605
|
+
return;
|
|
12606
|
+
signal("SIGKILL", await processes().catch(() => []));
|
|
12607
|
+
await wait(1000);
|
|
12608
|
+
}
|
|
12609
|
+
|
|
12532
12610
|
// ../../bridges/acp-bridge/src/acp-jsonl-framer.ts
|
|
12533
12611
|
class JsonlLineFramer {
|
|
12534
12612
|
#maxLineBytes;
|
|
@@ -13760,6 +13838,7 @@ class AcpProcess {
|
|
|
13760
13838
|
#pending = new Map;
|
|
13761
13839
|
#closed = false;
|
|
13762
13840
|
#readOnlyProfile;
|
|
13841
|
+
#terminating;
|
|
13763
13842
|
#terminationOutcome;
|
|
13764
13843
|
#stdoutFramer = new JsonlLineFramer(MAX_LINE_BYTES);
|
|
13765
13844
|
onUpdate = unattachedUpdate;
|
|
@@ -13945,20 +14024,8 @@ class AcpProcess {
|
|
|
13945
14024
|
if (outcome === "rejected" || this.#terminationOutcome === undefined) {
|
|
13946
14025
|
this.#terminationOutcome = outcome;
|
|
13947
14026
|
}
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
const exited = new Promise((resolvePromise) => this.child.once("exit", () => resolvePromise()));
|
|
13951
|
-
this.child.kill("SIGTERM");
|
|
13952
|
-
const forced = setTimeout(() => {
|
|
13953
|
-
if (this.child.exitCode === null && this.child.signalCode === null)
|
|
13954
|
-
this.child.kill("SIGKILL");
|
|
13955
|
-
}, 2000);
|
|
13956
|
-
forced.unref();
|
|
13957
|
-
await Promise.race([
|
|
13958
|
-
exited,
|
|
13959
|
-
new Promise((resolvePromise) => setTimeout(resolvePromise, 3000))
|
|
13960
|
-
]);
|
|
13961
|
-
clearTimeout(forced);
|
|
14027
|
+
this.#terminating ??= terminateAcpProcessTree(this.child);
|
|
14028
|
+
await this.#terminating;
|
|
13962
14029
|
}
|
|
13963
14030
|
#write(value) {
|
|
13964
14031
|
try {
|
|
@@ -16971,6 +17038,7 @@ function isArtifactServerToolCall(params, connection, recordedInput) {
|
|
|
16971
17038
|
var WORKFLOW_RESULT_MAX_BYTES = 384 * 1024;
|
|
16972
17039
|
var WORKFLOW_RESULT_MAX_PENDING_BYTES = 8 * 1024 * 1024;
|
|
16973
17040
|
var WORKFLOW_RESULT_KINDS = [
|
|
17041
|
+
"auto-pipeline-draft",
|
|
16974
17042
|
"feature-plan-state",
|
|
16975
17043
|
"story-refinement",
|
|
16976
17044
|
"validation-plan",
|
|
@@ -16986,6 +17054,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
16986
17054
|
"graph-template"
|
|
16987
17055
|
];
|
|
16988
17056
|
var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
17057
|
+
"auto-pipeline-draft": "submit_auto_pipeline_draft",
|
|
16989
17058
|
"feature-plan-state": "submit_feature_plan_state",
|
|
16990
17059
|
"story-refinement": "submit_story_refinement",
|
|
16991
17060
|
"validation-plan": "submit_validation_plan",
|
|
@@ -142,6 +142,7 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
142
142
|
"instance.republish-failed": "The instance descriptor could not be republished; a later pass retries.",
|
|
143
143
|
"parent.exited": "The parent process exited, so local servers are shutting down.",
|
|
144
144
|
"startup.step-failed": "One part of startup failed and the backend carried on; `step` says which.",
|
|
145
|
+
"startup.failed": "Startup failed; the backend released what it had started and exits with code 1.",
|
|
145
146
|
"startup.setup-fence-failed": "An environment's interrupted setup could not be fenced.",
|
|
146
147
|
"startup.setup-adopt-failed": "An environment's pending setup could not be adopted.",
|
|
147
148
|
"startup.deletion-pending": "An interrupted environment deletion stays pending. Its owning step logged the detail.",
|
|
@@ -306,6 +307,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
306
307
|
"app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
|
|
307
308
|
"app-server.stderr": "Metadata of an app-server stderr line, never its content.",
|
|
308
309
|
"app-server.stderr-suppressed": "app-server stderr lines beyond the budget were counted, not described.",
|
|
310
|
+
"app-server.termination-unconfirmed": "app-server did not report an exit after SIGKILL; the restart or shutdown went on without it.",
|
|
309
311
|
"approval.cancel-failed": "Cancelling a turn after an approval answer failed.",
|
|
310
312
|
"approval.present-failed": "Presenting an approval threw; it is auto-declined.",
|
|
311
313
|
"approval.resolved-callback-failed": "An approval resolved callback threw.",
|
|
@@ -863,7 +865,9 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
863
865
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
864
866
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
865
867
|
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
866
|
-
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
|
|
868
|
+
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
|
|
869
|
+
"host-database.separated": "Host OpenCode uses Orkestrator's own database because the shared one has no `session` table (an OpenCode 2 database); `reason` says why.",
|
|
870
|
+
"host-database.unreadable": "The shared OpenCode database could not be inspected, so host OpenCode opens it as usual. Error class only."
|
|
867
871
|
}
|
|
868
872
|
}
|
|
869
873
|
});
|
|
@@ -1821,6 +1825,7 @@ var WEB_BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
1821
1825
|
"transcript.load-failed": "A stage transcript read failed and will retry with backoff.",
|
|
1822
1826
|
"legacy.state-too-large": "Legacy pipeline state was over the limit and skipped.",
|
|
1823
1827
|
"opencode-catalog.load-failed": "The cached OpenCode model list could not be loaded.",
|
|
1828
|
+
"model-catalog.hydrate-failed": "A node's cached model lists could not be loaded for a launcher.",
|
|
1824
1829
|
"opencode-preferences.load-failed": "OpenCode model preferences could not be loaded."
|
|
1825
1830
|
}
|
|
1826
1831
|
}
|
|
@@ -8545,7 +8550,6 @@ import {
|
|
|
8545
8550
|
writeFile as writeFile2
|
|
8546
8551
|
} from "node:fs/promises";
|
|
8547
8552
|
import { isAbsolute, join as join3 } from "node:path";
|
|
8548
|
-
|
|
8549
8553
|
// ../protocol/src/coordinator.ts
|
|
8550
8554
|
var COORDINATOR_COMMAND_SANDBOX_ENV = "ORKESTRATOR_COORDINATOR_COMMAND_SANDBOX";
|
|
8551
8555
|
var COORDINATOR_PROTECTED_DATA_DIR_ENV = "ORKESTRATOR_COORDINATOR_PROTECTED_DATA_DIR";
|
|
@@ -8556,6 +8560,8 @@ var COORDINATOR_CLAUDE_USER_SKILLS_DIR_ENV = "ORKESTRATOR_COORDINATOR_CLAUDE_USE
|
|
|
8556
8560
|
var COORDINATOR_OTHER_ENVIRONMENTS_SETTING_LABEL = "Let the coordinator use environments it did not create";
|
|
8557
8561
|
var COORDINATOR_ENVIRONMENT_ORIGIN_REFUSAL = `Not done: this coordinator did not create that environment, so it may not send it work. Do not retry. Use an environment this coordinator launched, or start a new one. If the user wants this coordinator to work in environments it did not create, tell them to turn on "${COORDINATOR_OTHER_ENVIRONMENTS_SETTING_LABEL}" in this project's settings, under Coordinator.`;
|
|
8558
8562
|
var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
8563
|
+
"mark_topic",
|
|
8564
|
+
"mark_question",
|
|
8559
8565
|
"ack_message",
|
|
8560
8566
|
"add_ticket_comment",
|
|
8561
8567
|
"address_multi_review",
|
|
@@ -12811,6 +12817,7 @@ async function retireDrainingClaudeRuntime(session, waitMs = DRAINING_RUNTIME_EX
|
|
|
12811
12817
|
runtime.ended.then(() => true),
|
|
12812
12818
|
new Promise((resolve) => {
|
|
12813
12819
|
timer = setTimeout(() => resolve(false), waitMs);
|
|
12820
|
+
timer.unref?.();
|
|
12814
12821
|
})
|
|
12815
12822
|
]);
|
|
12816
12823
|
} finally {
|
|
@@ -18633,6 +18640,7 @@ async function readFromLiveClaude(read, timeoutMs = LIVE_CLAUDE_READ_TIMEOUT_MS)
|
|
|
18633
18640
|
answer,
|
|
18634
18641
|
new Promise((resolve) => {
|
|
18635
18642
|
timer = setTimeout(() => resolve(undefined), timeoutMs);
|
|
18643
|
+
timer.unref?.();
|
|
18636
18644
|
})
|
|
18637
18645
|
]);
|
|
18638
18646
|
if (value !== undefined)
|
|
@@ -18963,6 +18971,7 @@ async function probeModels(at) {
|
|
|
18963
18971
|
answer,
|
|
18964
18972
|
new Promise((_resolve, reject) => {
|
|
18965
18973
|
timer = setTimeout(() => reject(new Error("The model probe did not answer in time")), CLAUDE_MODEL_PROBE_TIMEOUT_MS);
|
|
18974
|
+
timer.unref?.();
|
|
18966
18975
|
})
|
|
18967
18976
|
]);
|
|
18968
18977
|
debugLog("[session-manager] Supported models fetched", { count: models.length });
|
|
@@ -20159,6 +20168,7 @@ async function runDiscoveryProbe(config) {
|
|
|
20159
20168
|
}) : Promise.resolve(undefined);
|
|
20160
20169
|
const timeout = new Promise((_, reject) => {
|
|
20161
20170
|
timer = setTimeout(() => reject(new Error("Claude command discovery timed out")), COMMAND_PROBE_TIMEOUT_MS);
|
|
20171
|
+
timer.unref?.();
|
|
20162
20172
|
});
|
|
20163
20173
|
read.catch(() => {
|
|
20164
20174
|
return;
|
|
@@ -20526,6 +20536,7 @@ import { createHash as createHash11 } from "node:crypto";
|
|
|
20526
20536
|
var WORKFLOW_RESULT_MAX_BYTES = 384 * 1024;
|
|
20527
20537
|
var WORKFLOW_RESULT_MAX_PENDING_BYTES = 8 * 1024 * 1024;
|
|
20528
20538
|
var WORKFLOW_RESULT_KINDS = [
|
|
20539
|
+
"auto-pipeline-draft",
|
|
20529
20540
|
"feature-plan-state",
|
|
20530
20541
|
"story-refinement",
|
|
20531
20542
|
"validation-plan",
|
|
@@ -20541,6 +20552,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
20541
20552
|
"graph-template"
|
|
20542
20553
|
];
|
|
20543
20554
|
var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
20555
|
+
"auto-pipeline-draft": "submit_auto_pipeline_draft",
|
|
20544
20556
|
"feature-plan-state": "submit_feature_plan_state",
|
|
20545
20557
|
"story-refinement": "submit_story_refinement",
|
|
20546
20558
|
"validation-plan": "submit_validation_plan",
|
|
@@ -24250,6 +24262,7 @@ async function settlesBy(work, deadline) {
|
|
|
24250
24262
|
let timer;
|
|
24251
24263
|
const expired = new Promise((resolve) => {
|
|
24252
24264
|
timer = setTimeout(() => resolve(false), Math.max(0, deadline - Date.now()));
|
|
24265
|
+
timer.unref?.();
|
|
24253
24266
|
});
|
|
24254
24267
|
try {
|
|
24255
24268
|
return await Promise.race([work.then(() => true), expired]);
|
|
@@ -26813,6 +26826,51 @@ function createBoundedSseWriter(write, onOverflow, limits = {}) {
|
|
|
26813
26826
|
return attempt;
|
|
26814
26827
|
};
|
|
26815
26828
|
}
|
|
26829
|
+
function createSseConnectionClosure() {
|
|
26830
|
+
const waiters = new Set;
|
|
26831
|
+
let isClosed = false;
|
|
26832
|
+
let resolveClosed;
|
|
26833
|
+
const closed = new Promise((resolve) => {
|
|
26834
|
+
resolveClosed = resolve;
|
|
26835
|
+
});
|
|
26836
|
+
return {
|
|
26837
|
+
closed,
|
|
26838
|
+
get isClosed() {
|
|
26839
|
+
return isClosed;
|
|
26840
|
+
},
|
|
26841
|
+
get pendingWaiters() {
|
|
26842
|
+
return waiters.size;
|
|
26843
|
+
},
|
|
26844
|
+
close() {
|
|
26845
|
+
if (isClosed)
|
|
26846
|
+
return;
|
|
26847
|
+
isClosed = true;
|
|
26848
|
+
for (const wake of Array.from(waiters))
|
|
26849
|
+
wake();
|
|
26850
|
+
waiters.clear();
|
|
26851
|
+
resolveClosed();
|
|
26852
|
+
},
|
|
26853
|
+
race(write) {
|
|
26854
|
+
if (isClosed) {
|
|
26855
|
+
write.catch(() => {
|
|
26856
|
+
return;
|
|
26857
|
+
});
|
|
26858
|
+
return Promise.resolve();
|
|
26859
|
+
}
|
|
26860
|
+
return new Promise((resolve, reject) => {
|
|
26861
|
+
const wake = () => resolve();
|
|
26862
|
+
waiters.add(wake);
|
|
26863
|
+
write.then(() => {
|
|
26864
|
+
waiters.delete(wake);
|
|
26865
|
+
resolve();
|
|
26866
|
+
}, (error) => {
|
|
26867
|
+
waiters.delete(wake);
|
|
26868
|
+
reject(error);
|
|
26869
|
+
});
|
|
26870
|
+
});
|
|
26871
|
+
}
|
|
26872
|
+
};
|
|
26873
|
+
}
|
|
26816
26874
|
var KEEPALIVE_INTERVAL_MS = 30000;
|
|
26817
26875
|
function createEventsRouter(limits = {}) {
|
|
26818
26876
|
const events = new Hono2;
|
|
@@ -26827,22 +26885,15 @@ function createEventsRouter(limits = {}) {
|
|
|
26827
26885
|
const connectedAt = new Date().toISOString();
|
|
26828
26886
|
log24.debug("sse.opened", { connectedAt });
|
|
26829
26887
|
let isOpen = true;
|
|
26830
|
-
|
|
26831
|
-
const connectionClosed = new Promise((resolve) => {
|
|
26832
|
-
resolveConnectionClosed = resolve;
|
|
26833
|
-
});
|
|
26834
|
-
let resolveRequestAborted;
|
|
26835
|
-
const requestAborted = new Promise((resolve) => {
|
|
26836
|
-
resolveRequestAborted = resolve;
|
|
26837
|
-
});
|
|
26888
|
+
const closure = createSseConnectionClosure();
|
|
26838
26889
|
const onRequestAbort = () => {
|
|
26839
26890
|
log24.debug("sse.aborted");
|
|
26840
26891
|
isOpen = false;
|
|
26841
|
-
|
|
26892
|
+
closure.close();
|
|
26842
26893
|
};
|
|
26843
26894
|
if (c.req.raw.signal.aborted) {
|
|
26844
26895
|
isOpen = false;
|
|
26845
|
-
|
|
26896
|
+
closure.close();
|
|
26846
26897
|
} else {
|
|
26847
26898
|
c.req.raw.signal.addEventListener("abort", onRequestAbort, { once: true });
|
|
26848
26899
|
}
|
|
@@ -26851,12 +26902,12 @@ function createEventsRouter(limits = {}) {
|
|
|
26851
26902
|
return;
|
|
26852
26903
|
isOpen = false;
|
|
26853
26904
|
log24.info("sse.closed", { reason });
|
|
26854
|
-
|
|
26905
|
+
closure.close();
|
|
26855
26906
|
};
|
|
26856
26907
|
const writeFrame = createBoundedSseWriter(async (frame) => {
|
|
26857
26908
|
if (!isOpen)
|
|
26858
26909
|
throw new Error("SSE request aborted");
|
|
26859
|
-
await
|
|
26910
|
+
await closure.race(stream.writeSSE(frame));
|
|
26860
26911
|
if (!isOpen)
|
|
26861
26912
|
throw new Error("SSE request aborted");
|
|
26862
26913
|
}, () => closeConnection("write backlog exceeded its cap"), { maxPendingFrames, maxPendingBytes });
|
|
@@ -26968,7 +27019,7 @@ function createEventsRouter(limits = {}) {
|
|
|
26968
27019
|
}
|
|
26969
27020
|
});
|
|
26970
27021
|
}, keepaliveIntervalMs);
|
|
26971
|
-
await
|
|
27022
|
+
await closure.closed;
|
|
26972
27023
|
} catch (error) {
|
|
26973
27024
|
if (!c.req.raw.signal.aborted) {
|
|
26974
27025
|
log24.warn("sse.handshake-failed", { error: formatLogError(error) });
|