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
|
@@ -1150,6 +1150,7 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
1150
1150
|
"instance.republish-failed": "The instance descriptor could not be republished; a later pass retries.",
|
|
1151
1151
|
"parent.exited": "The parent process exited, so local servers are shutting down.",
|
|
1152
1152
|
"startup.step-failed": "One part of startup failed and the backend carried on; `step` says which.",
|
|
1153
|
+
"startup.failed": "Startup failed; the backend released what it had started and exits with code 1.",
|
|
1153
1154
|
"startup.setup-fence-failed": "An environment's interrupted setup could not be fenced.",
|
|
1154
1155
|
"startup.setup-adopt-failed": "An environment's pending setup could not be adopted.",
|
|
1155
1156
|
"startup.deletion-pending": "An interrupted environment deletion stays pending. Its owning step logged the detail.",
|
|
@@ -1314,6 +1315,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
1314
1315
|
"app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
|
|
1315
1316
|
"app-server.stderr": "Metadata of an app-server stderr line, never its content.",
|
|
1316
1317
|
"app-server.stderr-suppressed": "app-server stderr lines beyond the budget were counted, not described.",
|
|
1318
|
+
"app-server.termination-unconfirmed": "app-server did not report an exit after SIGKILL; the restart or shutdown went on without it.",
|
|
1317
1319
|
"approval.cancel-failed": "Cancelling a turn after an approval answer failed.",
|
|
1318
1320
|
"approval.present-failed": "Presenting an approval threw; it is auto-declined.",
|
|
1319
1321
|
"approval.resolved-callback-failed": "An approval resolved callback threw.",
|
|
@@ -1871,7 +1873,9 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1871
1873
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
1872
1874
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
1873
1875
|
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
1874
|
-
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
|
|
1876
|
+
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
|
|
1877
|
+
"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.",
|
|
1878
|
+
"host-database.unreadable": "The shared OpenCode database could not be inspected, so host OpenCode opens it as usual. Error class only."
|
|
1875
1879
|
}
|
|
1876
1880
|
}
|
|
1877
1881
|
});
|
|
@@ -2829,6 +2833,7 @@ var WEB_BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
2829
2833
|
"transcript.load-failed": "A stage transcript read failed and will retry with backoff.",
|
|
2830
2834
|
"legacy.state-too-large": "Legacy pipeline state was over the limit and skipped.",
|
|
2831
2835
|
"opencode-catalog.load-failed": "The cached OpenCode model list could not be loaded.",
|
|
2836
|
+
"model-catalog.hydrate-failed": "A node's cached model lists could not be loaded for a launcher.",
|
|
2832
2837
|
"opencode-preferences.load-failed": "OpenCode model preferences could not be loaded."
|
|
2833
2838
|
}
|
|
2834
2839
|
}
|
|
@@ -9746,6 +9751,7 @@ function parseNumstatZ(output) {
|
|
|
9746
9751
|
var WORKFLOW_RESULT_MAX_BYTES = 384 * 1024;
|
|
9747
9752
|
var WORKFLOW_RESULT_MAX_PENDING_BYTES = 8 * 1024 * 1024;
|
|
9748
9753
|
var WORKFLOW_RESULT_KINDS = [
|
|
9754
|
+
"auto-pipeline-draft",
|
|
9749
9755
|
"feature-plan-state",
|
|
9750
9756
|
"story-refinement",
|
|
9751
9757
|
"validation-plan",
|
|
@@ -9761,6 +9767,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
9761
9767
|
"graph-template"
|
|
9762
9768
|
];
|
|
9763
9769
|
var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
9770
|
+
"auto-pipeline-draft": "submit_auto_pipeline_draft",
|
|
9764
9771
|
"feature-plan-state": "submit_feature_plan_state",
|
|
9765
9772
|
"story-refinement": "submit_story_refinement",
|
|
9766
9773
|
"validation-plan": "submit_validation_plan",
|
|
@@ -17737,12 +17744,13 @@ function rolloutCommandExecutionParts(item) {
|
|
|
17737
17744
|
});
|
|
17738
17745
|
return adapted?.type === "command_execution" ? commandExecutionParts(adapted) : null;
|
|
17739
17746
|
}
|
|
17740
|
-
|
|
17741
17747
|
// ../protocol/src/coordinator.ts
|
|
17742
17748
|
var COORDINATOR_CODEX_USER_SKILLS_DIR_ENV = "ORKESTRATOR_COORDINATOR_CODEX_USER_SKILLS_DIR";
|
|
17743
17749
|
var COORDINATOR_OTHER_ENVIRONMENTS_SETTING_LABEL = "Let the coordinator use environments it did not create";
|
|
17744
17750
|
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.`;
|
|
17745
17751
|
var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
17752
|
+
"mark_topic",
|
|
17753
|
+
"mark_question",
|
|
17746
17754
|
"ack_message",
|
|
17747
17755
|
"add_ticket_comment",
|
|
17748
17756
|
"address_multi_review",
|
|
@@ -21432,6 +21440,7 @@ var DEFAULT_CIRCUIT_WINDOW_MS = 60000;
|
|
|
21432
21440
|
var DEFAULT_CIRCUIT_COOLDOWN_MS = 5 * 60000;
|
|
21433
21441
|
var DEFAULT_CIRCUIT_MAX_COOLDOWN_MS = 30 * 60000;
|
|
21434
21442
|
var DEFAULT_SHUTDOWN_GRACE_MS = 5000;
|
|
21443
|
+
var DEFAULT_KILL_CONFIRM_MS = 1000;
|
|
21435
21444
|
var INCOMPLETE_PIDFILE_GRACE_MS = 1000;
|
|
21436
21445
|
var PID_OWNERSHIP_TTL_MS = 24 * 60 * 60 * 1000;
|
|
21437
21446
|
var PID_ACQUISITION_MAX_ATTEMPTS = 5;
|
|
@@ -21448,6 +21457,7 @@ class AppServerSupervisor {
|
|
|
21448
21457
|
circuitCooldownMs;
|
|
21449
21458
|
circuitMaxCooldownMs;
|
|
21450
21459
|
shutdownGraceMs;
|
|
21460
|
+
killConfirmMs;
|
|
21451
21461
|
fingerprintEnvironment;
|
|
21452
21462
|
notificationQueue;
|
|
21453
21463
|
state = "stopped";
|
|
@@ -21468,7 +21478,9 @@ class AppServerSupervisor {
|
|
|
21468
21478
|
stopping = false;
|
|
21469
21479
|
unknownNotifications = 0;
|
|
21470
21480
|
unknownServerRequests = 0;
|
|
21481
|
+
unconfirmedTerminations = 0;
|
|
21471
21482
|
drainPromise = null;
|
|
21483
|
+
terminating = null;
|
|
21472
21484
|
pidOwnerToken = randomUUID7();
|
|
21473
21485
|
pidOwnershipHeld = false;
|
|
21474
21486
|
constructor(options) {
|
|
@@ -21481,6 +21493,7 @@ class AppServerSupervisor {
|
|
|
21481
21493
|
this.circuitMaxCooldownMs = Math.max(this.circuitCooldownMs, options.circuitMaxCooldownMs ?? DEFAULT_CIRCUIT_MAX_COOLDOWN_MS);
|
|
21482
21494
|
this.nextCircuitCooldownMs = this.circuitCooldownMs;
|
|
21483
21495
|
this.shutdownGraceMs = options.shutdownGraceMs ?? DEFAULT_SHUTDOWN_GRACE_MS;
|
|
21496
|
+
this.killConfirmMs = Math.max(0, options.killConfirmMs ?? DEFAULT_KILL_CONFIRM_MS);
|
|
21484
21497
|
this.fingerprintEnvironment = options.fingerprintEnvironment ?? fingerprintRuntimeEnvironment;
|
|
21485
21498
|
this.notificationQueue = new SerialQueue({
|
|
21486
21499
|
maxDepth: options.notificationQueueMaxDepth,
|
|
@@ -21514,7 +21527,8 @@ class AppServerSupervisor {
|
|
|
21514
21527
|
notificationQueueDepth: this.notificationQueue.pendingDepth,
|
|
21515
21528
|
notificationQueueHighWaterMark: this.notificationQueue.highWaterMark,
|
|
21516
21529
|
unknownNotifications: this.unknownNotifications,
|
|
21517
|
-
unknownServerRequests: this.unknownServerRequests
|
|
21530
|
+
unknownServerRequests: this.unknownServerRequests,
|
|
21531
|
+
unconfirmedTerminations: this.unconfirmedTerminations
|
|
21518
21532
|
};
|
|
21519
21533
|
}
|
|
21520
21534
|
recordUnknownNotification() {
|
|
@@ -21539,6 +21553,10 @@ class AppServerSupervisor {
|
|
|
21539
21553
|
throw new AppServerUnavailableError("stopped");
|
|
21540
21554
|
if (this.startPromise)
|
|
21541
21555
|
return this.startPromise;
|
|
21556
|
+
if (this.terminating) {
|
|
21557
|
+
await this.terminating;
|
|
21558
|
+
return this.ensureStarted();
|
|
21559
|
+
}
|
|
21542
21560
|
if (this.circuitOpen && this.now() < this.circuitProbeAt) {
|
|
21543
21561
|
throw new AppServerCircuitOpenError(this.restartFailures.length, this.lastError);
|
|
21544
21562
|
}
|
|
@@ -21879,11 +21897,23 @@ class AppServerSupervisor {
|
|
|
21879
21897
|
const previous = this.current;
|
|
21880
21898
|
this.current = null;
|
|
21881
21899
|
if (previous) {
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21900
|
+
const retire = (async () => {
|
|
21901
|
+
previous.client.close(new AppServerProcessExitError(`app-server restarting: ${reason}`, {
|
|
21902
|
+
generation: previous.id
|
|
21903
|
+
}));
|
|
21904
|
+
await previous.recorder?.close();
|
|
21905
|
+
await this.terminateChild(previous.child);
|
|
21906
|
+
})();
|
|
21907
|
+
const terminating = retire.catch(() => {
|
|
21908
|
+
return;
|
|
21909
|
+
});
|
|
21910
|
+
this.terminating = terminating;
|
|
21911
|
+
try {
|
|
21912
|
+
await retire;
|
|
21913
|
+
} finally {
|
|
21914
|
+
if (this.terminating === terminating)
|
|
21915
|
+
this.terminating = null;
|
|
21916
|
+
}
|
|
21887
21917
|
}
|
|
21888
21918
|
if (this.stopping)
|
|
21889
21919
|
return;
|
|
@@ -21903,6 +21933,8 @@ class AppServerSupervisor {
|
|
|
21903
21933
|
});
|
|
21904
21934
|
const generation = this.current;
|
|
21905
21935
|
this.current = null;
|
|
21936
|
+
if (this.terminating)
|
|
21937
|
+
await this.terminating;
|
|
21906
21938
|
if (generation) {
|
|
21907
21939
|
generation.client.close(new AppServerProcessExitError("bridge shutting down", {
|
|
21908
21940
|
generation: generation.id
|
|
@@ -21934,7 +21966,17 @@ class AppServerSupervisor {
|
|
|
21934
21966
|
]);
|
|
21935
21967
|
if (timedOut) {
|
|
21936
21968
|
this.signalProcessTree(child, "SIGKILL");
|
|
21937
|
-
await Promise.race([
|
|
21969
|
+
const confirmed = await Promise.race([
|
|
21970
|
+
exited.then(() => true),
|
|
21971
|
+
sleep(this.killConfirmMs).then(() => false)
|
|
21972
|
+
]);
|
|
21973
|
+
if (!confirmed) {
|
|
21974
|
+
this.unconfirmedTerminations += 1;
|
|
21975
|
+
log10.warn("app-server.termination-unconfirmed", {
|
|
21976
|
+
pid: child.pid,
|
|
21977
|
+
waitedMs: this.shutdownGraceMs + this.killConfirmMs
|
|
21978
|
+
});
|
|
21979
|
+
}
|
|
21938
21980
|
}
|
|
21939
21981
|
}
|
|
21940
21982
|
signalProcessTree(child, signal) {
|
|
@@ -24988,6 +25030,7 @@ async function waitForMcpToolAvailability(list, serverName, toolName, options =
|
|
|
24988
25030
|
list(remainingMs),
|
|
24989
25031
|
new Promise((resolve) => {
|
|
24990
25032
|
timer = setTimeout(() => resolve(expired), remainingMs);
|
|
25033
|
+
timer.unref?.();
|
|
24991
25034
|
})
|
|
24992
25035
|
]);
|
|
24993
25036
|
} catch {
|
|
@@ -25000,7 +25043,9 @@ async function waitForMcpToolAvailability(list, serverName, toolName, options =
|
|
|
25000
25043
|
const availability = classifyMcpToolAvailability(response, serverName, toolName);
|
|
25001
25044
|
if (availability)
|
|
25002
25045
|
return availability;
|
|
25003
|
-
await new Promise((resolve) =>
|
|
25046
|
+
await new Promise((resolve) => {
|
|
25047
|
+
setTimeout(resolve, Math.min(pollMs, deadline - now())).unref?.();
|
|
25048
|
+
});
|
|
25004
25049
|
}
|
|
25005
25050
|
}
|
|
25006
25051
|
|
|
@@ -29978,6 +30023,8 @@ class CodexRuntimeContext {
|
|
|
29978
30023
|
now;
|
|
29979
30024
|
started = false;
|
|
29980
30025
|
startPromise = null;
|
|
30026
|
+
sessionRestore = "not-started";
|
|
30027
|
+
sessionsRestored = Promise.withResolvers();
|
|
29981
30028
|
stopping = false;
|
|
29982
30029
|
sweepTimer = null;
|
|
29983
30030
|
detachedThreads = 0;
|
|
@@ -30536,6 +30583,11 @@ class CodexRuntimeLifecycle {
|
|
|
30536
30583
|
async start() {
|
|
30537
30584
|
if (this.ctx.started)
|
|
30538
30585
|
return;
|
|
30586
|
+
if (this.ctx.sessionRestore === "failed") {
|
|
30587
|
+
this.ctx.sessionsRestored = Promise.withResolvers();
|
|
30588
|
+
}
|
|
30589
|
+
if (this.ctx.sessionRestore !== "restored")
|
|
30590
|
+
this.ctx.sessionRestore = "restoring";
|
|
30539
30591
|
if (this.ctx.startPromise)
|
|
30540
30592
|
return this.ctx.startPromise;
|
|
30541
30593
|
const startPromise = this.startOnce();
|
|
@@ -30543,6 +30595,12 @@ class CodexRuntimeLifecycle {
|
|
|
30543
30595
|
try {
|
|
30544
30596
|
await startPromise;
|
|
30545
30597
|
this.ctx.started = true;
|
|
30598
|
+
} catch (error) {
|
|
30599
|
+
if (this.ctx.sessionRestore === "restoring") {
|
|
30600
|
+
this.ctx.sessionRestore = "failed";
|
|
30601
|
+
this.ctx.sessionsRestored.resolve(false);
|
|
30602
|
+
}
|
|
30603
|
+
throw error;
|
|
30546
30604
|
} finally {
|
|
30547
30605
|
if (this.ctx.startPromise === startPromise)
|
|
30548
30606
|
this.ctx.startPromise = null;
|
|
@@ -30582,6 +30640,8 @@ class CodexRuntimeLifecycle {
|
|
|
30582
30640
|
if (record.threadId)
|
|
30583
30641
|
this.ctx.threadsAwaitingDispatchRecovery.add(record.threadId);
|
|
30584
30642
|
}
|
|
30643
|
+
this.ctx.sessionRestore = "restored";
|
|
30644
|
+
this.ctx.sessionsRestored.resolve(true);
|
|
30585
30645
|
try {
|
|
30586
30646
|
await this.ctx.options.engine.start();
|
|
30587
30647
|
await this.ctx.generationRecovery;
|
|
@@ -30602,6 +30662,22 @@ class CodexRuntimeLifecycle {
|
|
|
30602
30662
|
this.ctx.sweepTimer.unref?.();
|
|
30603
30663
|
}
|
|
30604
30664
|
}
|
|
30665
|
+
async whenSessionsRestored(timeoutMs) {
|
|
30666
|
+
if (this.ctx.sessionRestore === "failed")
|
|
30667
|
+
return false;
|
|
30668
|
+
if (this.ctx.sessionRestore !== "restoring")
|
|
30669
|
+
return true;
|
|
30670
|
+
let timer;
|
|
30671
|
+
const timedOut = new Promise((resolve) => {
|
|
30672
|
+
timer = setTimeout(() => resolve(false), timeoutMs);
|
|
30673
|
+
timer.unref?.();
|
|
30674
|
+
});
|
|
30675
|
+
try {
|
|
30676
|
+
return await Promise.race([this.ctx.sessionsRestored.promise, timedOut]);
|
|
30677
|
+
} finally {
|
|
30678
|
+
clearTimeout(timer);
|
|
30679
|
+
}
|
|
30680
|
+
}
|
|
30605
30681
|
async stop() {
|
|
30606
30682
|
this.ctx.stopping = true;
|
|
30607
30683
|
for (const state of this.ctx.threadState.values())
|
|
@@ -33481,6 +33557,9 @@ class AppServerRuntime {
|
|
|
33481
33557
|
start(...args) {
|
|
33482
33558
|
return this.lifecycle.start(...args);
|
|
33483
33559
|
}
|
|
33560
|
+
whenSessionsRestored(...args) {
|
|
33561
|
+
return this.lifecycle.whenSessionsRestored(...args);
|
|
33562
|
+
}
|
|
33484
33563
|
stop(...args) {
|
|
33485
33564
|
return this.lifecycle.stop(...args);
|
|
33486
33565
|
}
|
|
@@ -34023,16 +34102,16 @@ function logUnhandledRejection(reason) {
|
|
|
34023
34102
|
// ../protocol/src/codex-model-catalog.ts
|
|
34024
34103
|
var CODEX_FALLBACK_MODEL_CATALOG = [
|
|
34025
34104
|
{
|
|
34026
|
-
id: "gpt-
|
|
34027
|
-
name: "
|
|
34028
|
-
description: "Latest
|
|
34105
|
+
id: "gpt-6.1-sol",
|
|
34106
|
+
name: "GPT-6.1-Sol",
|
|
34107
|
+
description: "Latest workhorse model for coding and everyday work.",
|
|
34029
34108
|
reasoningEfforts: ["low", "medium", "high", "xhigh"],
|
|
34030
34109
|
defaultReasoningEffort: "high"
|
|
34031
34110
|
},
|
|
34032
34111
|
{
|
|
34033
|
-
id: "gpt-
|
|
34034
|
-
name: "GPT-
|
|
34035
|
-
description: "
|
|
34112
|
+
id: "gpt-6-luna",
|
|
34113
|
+
name: "GPT-6-Luna",
|
|
34114
|
+
description: "Fast and affordable model for easier tasks.",
|
|
34036
34115
|
reasoningEfforts: ["low", "medium", "high", "xhigh"],
|
|
34037
34116
|
defaultReasoningEffort: "high"
|
|
34038
34117
|
}
|
|
@@ -34678,6 +34757,7 @@ var __testing = {
|
|
|
34678
34757
|
sseRouteTestHooks = hooks;
|
|
34679
34758
|
},
|
|
34680
34759
|
startBridgeServerForTesting: startBridgeServer,
|
|
34760
|
+
startBridgeForTesting: startBridge,
|
|
34681
34761
|
startSelectedEngineForTesting: startSelectedEngine,
|
|
34682
34762
|
stopSelectedEngineForTesting: stopSelectedEngine,
|
|
34683
34763
|
startSseKeepaliveForTesting: startSseKeepalive,
|
|
@@ -34779,6 +34859,15 @@ app.use("*", async (c, next) => {
|
|
|
34779
34859
|
}
|
|
34780
34860
|
await next();
|
|
34781
34861
|
});
|
|
34862
|
+
var SESSION_RESTORE_WAIT_MS = 1e4;
|
|
34863
|
+
var awaitRestoredSessions = async (c, next) => {
|
|
34864
|
+
if (!await appServerRuntime.whenSessionsRestored(SESSION_RESTORE_WAIT_MS)) {
|
|
34865
|
+
return c.json({ error: "The Codex bridge is still restoring its sessions" }, 503);
|
|
34866
|
+
}
|
|
34867
|
+
await next();
|
|
34868
|
+
};
|
|
34869
|
+
app.use("/session/*", awaitRestoredSessions);
|
|
34870
|
+
app.use("/sessions/*", awaitRestoredSessions);
|
|
34782
34871
|
app.use("/session/:id/messages", async (c, next) => {
|
|
34783
34872
|
await next();
|
|
34784
34873
|
c.res.headers.append("Vary", "Accept-Encoding");
|
|
@@ -35514,6 +35603,10 @@ function startBridgeServer(env = process.env, start = serve) {
|
|
|
35514
35603
|
hostname: env.HOSTNAME || "0.0.0.0"
|
|
35515
35604
|
});
|
|
35516
35605
|
}
|
|
35606
|
+
function startBridge(env = process.env, listen = serve, runtime = appServerRuntime) {
|
|
35607
|
+
startSelectedEngine(env, runtime);
|
|
35608
|
+
return startBridgeServer(env, listen);
|
|
35609
|
+
}
|
|
35517
35610
|
var shutdownHandler = createShutdownHandler(cleanupTimer);
|
|
35518
35611
|
for (const signal of ["SIGTERM", "SIGINT"]) {
|
|
35519
35612
|
process.on(signal, shutdownHandler);
|
|
@@ -35530,8 +35623,7 @@ if (parentPid !== null) {
|
|
|
35530
35623
|
}
|
|
35531
35624
|
});
|
|
35532
35625
|
}
|
|
35533
|
-
|
|
35534
|
-
startSelectedEngine();
|
|
35626
|
+
startBridge();
|
|
35535
35627
|
export {
|
|
35536
35628
|
MAX_CODEX_TRANSCRIPT_RESPONSE_BYTES,
|
|
35537
35629
|
MAX_REPLAY_SSE_BYTES,
|
|
@@ -328,6 +328,7 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
328
328
|
"instance.republish-failed": "The instance descriptor could not be republished; a later pass retries.",
|
|
329
329
|
"parent.exited": "The parent process exited, so local servers are shutting down.",
|
|
330
330
|
"startup.step-failed": "One part of startup failed and the backend carried on; `step` says which.",
|
|
331
|
+
"startup.failed": "Startup failed; the backend released what it had started and exits with code 1.",
|
|
331
332
|
"startup.setup-fence-failed": "An environment's interrupted setup could not be fenced.",
|
|
332
333
|
"startup.setup-adopt-failed": "An environment's pending setup could not be adopted.",
|
|
333
334
|
"startup.deletion-pending": "An interrupted environment deletion stays pending. Its owning step logged the detail.",
|
|
@@ -492,6 +493,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
492
493
|
"app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
|
|
493
494
|
"app-server.stderr": "Metadata of an app-server stderr line, never its content.",
|
|
494
495
|
"app-server.stderr-suppressed": "app-server stderr lines beyond the budget were counted, not described.",
|
|
496
|
+
"app-server.termination-unconfirmed": "app-server did not report an exit after SIGKILL; the restart or shutdown went on without it.",
|
|
495
497
|
"approval.cancel-failed": "Cancelling a turn after an approval answer failed.",
|
|
496
498
|
"approval.present-failed": "Presenting an approval threw; it is auto-declined.",
|
|
497
499
|
"approval.resolved-callback-failed": "An approval resolved callback threw.",
|
|
@@ -1049,7 +1051,9 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1049
1051
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
1050
1052
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
1051
1053
|
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
1052
|
-
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
|
|
1054
|
+
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
|
|
1055
|
+
"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.",
|
|
1056
|
+
"host-database.unreadable": "The shared OpenCode database could not be inspected, so host OpenCode opens it as usual. Error class only."
|
|
1053
1057
|
}
|
|
1054
1058
|
}
|
|
1055
1059
|
});
|
|
@@ -2007,6 +2011,7 @@ var WEB_BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
2007
2011
|
"transcript.load-failed": "A stage transcript read failed and will retry with backoff.",
|
|
2008
2012
|
"legacy.state-too-large": "Legacy pipeline state was over the limit and skipped.",
|
|
2009
2013
|
"opencode-catalog.load-failed": "The cached OpenCode model list could not be loaded.",
|
|
2014
|
+
"model-catalog.hydrate-failed": "A node's cached model lists could not be loaded for a launcher.",
|
|
2010
2015
|
"opencode-preferences.load-failed": "OpenCode model preferences could not be loaded."
|
|
2011
2016
|
}
|
|
2012
2017
|
}
|
|
@@ -29011,6 +29016,7 @@ var ORKESTRATOR_ARTIFACT_MCP_PATH = "/artifact-mcp";
|
|
|
29011
29016
|
var WORKFLOW_RESULT_MAX_BYTES = 384 * 1024;
|
|
29012
29017
|
var WORKFLOW_RESULT_MAX_PENDING_BYTES = 8 * 1024 * 1024;
|
|
29013
29018
|
var WORKFLOW_RESULT_KINDS = [
|
|
29019
|
+
"auto-pipeline-draft",
|
|
29014
29020
|
"feature-plan-state",
|
|
29015
29021
|
"story-refinement",
|
|
29016
29022
|
"validation-plan",
|
|
@@ -29026,6 +29032,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
29026
29032
|
"graph-template"
|
|
29027
29033
|
];
|
|
29028
29034
|
var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
29035
|
+
"auto-pipeline-draft": "submit_auto_pipeline_draft",
|
|
29029
29036
|
"feature-plan-state": "submit_feature_plan_state",
|
|
29030
29037
|
"story-refinement": "submit_story_refinement",
|
|
29031
29038
|
"validation-plan": "submit_validation_plan",
|
|
@@ -821,6 +821,7 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
821
821
|
"instance.republish-failed": "The instance descriptor could not be republished; a later pass retries.",
|
|
822
822
|
"parent.exited": "The parent process exited, so local servers are shutting down.",
|
|
823
823
|
"startup.step-failed": "One part of startup failed and the backend carried on; `step` says which.",
|
|
824
|
+
"startup.failed": "Startup failed; the backend released what it had started and exits with code 1.",
|
|
824
825
|
"startup.setup-fence-failed": "An environment's interrupted setup could not be fenced.",
|
|
825
826
|
"startup.setup-adopt-failed": "An environment's pending setup could not be adopted.",
|
|
826
827
|
"startup.deletion-pending": "An interrupted environment deletion stays pending. Its owning step logged the detail.",
|
|
@@ -985,6 +986,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
985
986
|
"app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
|
|
986
987
|
"app-server.stderr": "Metadata of an app-server stderr line, never its content.",
|
|
987
988
|
"app-server.stderr-suppressed": "app-server stderr lines beyond the budget were counted, not described.",
|
|
989
|
+
"app-server.termination-unconfirmed": "app-server did not report an exit after SIGKILL; the restart or shutdown went on without it.",
|
|
988
990
|
"approval.cancel-failed": "Cancelling a turn after an approval answer failed.",
|
|
989
991
|
"approval.present-failed": "Presenting an approval threw; it is auto-declined.",
|
|
990
992
|
"approval.resolved-callback-failed": "An approval resolved callback threw.",
|
|
@@ -1542,7 +1544,9 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1542
1544
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
1543
1545
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
1544
1546
|
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
1545
|
-
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
|
|
1547
|
+
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
|
|
1548
|
+
"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.",
|
|
1549
|
+
"host-database.unreadable": "The shared OpenCode database could not be inspected, so host OpenCode opens it as usual. Error class only."
|
|
1546
1550
|
}
|
|
1547
1551
|
}
|
|
1548
1552
|
});
|
|
@@ -2500,6 +2504,7 @@ var WEB_BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
2500
2504
|
"transcript.load-failed": "A stage transcript read failed and will retry with backoff.",
|
|
2501
2505
|
"legacy.state-too-large": "Legacy pipeline state was over the limit and skipped.",
|
|
2502
2506
|
"opencode-catalog.load-failed": "The cached OpenCode model list could not be loaded.",
|
|
2507
|
+
"model-catalog.hydrate-failed": "A node's cached model lists could not be loaded for a launcher.",
|
|
2503
2508
|
"opencode-preferences.load-failed": "OpenCode model preferences could not be loaded."
|
|
2504
2509
|
}
|
|
2505
2510
|
}
|
|
@@ -7530,12 +7535,13 @@ class InteractionDeadline {
|
|
|
7530
7535
|
this.timer = timer;
|
|
7531
7536
|
}
|
|
7532
7537
|
}
|
|
7533
|
-
|
|
7534
7538
|
// ../protocol/src/coordinator.ts
|
|
7535
7539
|
var COORDINATOR_PROTECTED_DATA_DIR_ENV = "ORKESTRATOR_COORDINATOR_PROTECTED_DATA_DIR";
|
|
7536
7540
|
var COORDINATOR_OTHER_ENVIRONMENTS_SETTING_LABEL = "Let the coordinator use environments it did not create";
|
|
7537
7541
|
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.`;
|
|
7538
7542
|
var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
7543
|
+
"mark_topic",
|
|
7544
|
+
"mark_question",
|
|
7539
7545
|
"ack_message",
|
|
7540
7546
|
"add_ticket_comment",
|
|
7541
7547
|
"address_multi_review",
|
|
@@ -7711,6 +7717,7 @@ var ORKESTRATOR_ARTIFACT_MCP_PATH = "/artifact-mcp";
|
|
|
7711
7717
|
var WORKFLOW_RESULT_MAX_BYTES = 384 * 1024;
|
|
7712
7718
|
var WORKFLOW_RESULT_MAX_PENDING_BYTES = 8 * 1024 * 1024;
|
|
7713
7719
|
var WORKFLOW_RESULT_KINDS = [
|
|
7720
|
+
"auto-pipeline-draft",
|
|
7714
7721
|
"feature-plan-state",
|
|
7715
7722
|
"story-refinement",
|
|
7716
7723
|
"validation-plan",
|
|
@@ -7726,6 +7733,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
7726
7733
|
"graph-template"
|
|
7727
7734
|
];
|
|
7728
7735
|
var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
7736
|
+
"auto-pipeline-draft": "submit_auto_pipeline_draft",
|
|
7729
7737
|
"feature-plan-state": "submit_feature_plan_state",
|
|
7730
7738
|
"story-refinement": "submit_story_refinement",
|
|
7731
7739
|
"validation-plan": "submit_validation_plan",
|
|
@@ -32280,7 +32288,15 @@ var log2 = createLogger("bridge.pi");
|
|
|
32280
32288
|
var tail = Promise.resolve();
|
|
32281
32289
|
var scheduled = false;
|
|
32282
32290
|
var shuttingDown = false;
|
|
32291
|
+
var draining;
|
|
32283
32292
|
var writeGateForTests;
|
|
32293
|
+
|
|
32294
|
+
class PersistenceClosedError extends Error {
|
|
32295
|
+
name = "PersistenceClosedError";
|
|
32296
|
+
constructor() {
|
|
32297
|
+
super("Pi bridge is shutting down");
|
|
32298
|
+
}
|
|
32299
|
+
}
|
|
32284
32300
|
function setPersistWriteGateForTests(gate) {
|
|
32285
32301
|
writeGateForTests = gate;
|
|
32286
32302
|
}
|
|
@@ -32298,7 +32314,13 @@ function schedulePersist() {
|
|
|
32298
32314
|
async function persistBarrier() {
|
|
32299
32315
|
if (!stateFilePath())
|
|
32300
32316
|
return;
|
|
32301
|
-
|
|
32317
|
+
if (shuttingDown)
|
|
32318
|
+
throw new PersistenceClosedError;
|
|
32319
|
+
const operation = tail.then(() => {
|
|
32320
|
+
if (shuttingDown)
|
|
32321
|
+
throw new PersistenceClosedError;
|
|
32322
|
+
return persistNow({ barrier: true });
|
|
32323
|
+
});
|
|
32302
32324
|
tail = operation.catch(() => {
|
|
32303
32325
|
return;
|
|
32304
32326
|
});
|
|
@@ -32313,16 +32335,23 @@ async function settlePersistenceForTests() {
|
|
|
32313
32335
|
});
|
|
32314
32336
|
} while (settled !== tail);
|
|
32315
32337
|
}
|
|
32316
|
-
|
|
32338
|
+
function drainPersistence() {
|
|
32317
32339
|
if (!stateFilePath())
|
|
32318
|
-
return;
|
|
32340
|
+
return Promise.resolve();
|
|
32319
32341
|
shuttingDown = true;
|
|
32320
|
-
|
|
32321
|
-
|
|
32322
|
-
|
|
32323
|
-
|
|
32324
|
-
|
|
32325
|
-
|
|
32342
|
+
draining ??= (async () => {
|
|
32343
|
+
await tail.catch(() => {
|
|
32344
|
+
return;
|
|
32345
|
+
});
|
|
32346
|
+
await persistNow().catch(() => {
|
|
32347
|
+
return;
|
|
32348
|
+
});
|
|
32349
|
+
})();
|
|
32350
|
+
return draining;
|
|
32351
|
+
}
|
|
32352
|
+
function reopenPersistenceForTests() {
|
|
32353
|
+
shuttingDown = false;
|
|
32354
|
+
draining = undefined;
|
|
32326
32355
|
}
|
|
32327
32356
|
function encodeStateWithinBudget(payload, lastAccessedById, budget) {
|
|
32328
32357
|
const envelope = JSON.stringify({ ...payload, sessions: [] });
|
|
@@ -40328,6 +40357,23 @@ function setCancelAckTimeoutForTests(timeoutMs) {
|
|
|
40328
40357
|
cancelAckTimeoutMs = timeoutMs ?? DEFAULT_CANCEL_ACK_TIMEOUT_MS;
|
|
40329
40358
|
}
|
|
40330
40359
|
var gzipCapableResponses = new WeakSet;
|
|
40360
|
+
|
|
40361
|
+
class DeliveryUncertainError extends Error {
|
|
40362
|
+
requestId;
|
|
40363
|
+
followUp;
|
|
40364
|
+
constructor(requestId, followUp = false) {
|
|
40365
|
+
super("Pi delivery outcome is unknown");
|
|
40366
|
+
this.requestId = requestId;
|
|
40367
|
+
this.followUp = followUp;
|
|
40368
|
+
}
|
|
40369
|
+
}
|
|
40370
|
+
async function persistAfterDelivery(requestId, followUp = false) {
|
|
40371
|
+
try {
|
|
40372
|
+
await persistBarrier();
|
|
40373
|
+
} catch {
|
|
40374
|
+
throw new DeliveryUncertainError(requestId, followUp);
|
|
40375
|
+
}
|
|
40376
|
+
}
|
|
40331
40377
|
async function route(request, response, clientSignal) {
|
|
40332
40378
|
const url = new URL(request.url || "/", `http://${request.headers.host || "localhost"}`);
|
|
40333
40379
|
if (acceptsGzip(request))
|
|
@@ -40360,6 +40406,13 @@ async function route(request, response, clientSignal) {
|
|
|
40360
40406
|
return;
|
|
40361
40407
|
return await routeSession(request, response, url, clientSignal);
|
|
40362
40408
|
} catch (error) {
|
|
40409
|
+
if (error instanceof DeliveryUncertainError) {
|
|
40410
|
+
return json(response, 503, {
|
|
40411
|
+
...error.followUp ? { accepted: false } : {},
|
|
40412
|
+
outcome: "unknown",
|
|
40413
|
+
...error.requestId ? { requestId: error.requestId } : {}
|
|
40414
|
+
});
|
|
40415
|
+
}
|
|
40363
40416
|
if (error instanceof HttpError)
|
|
40364
40417
|
return json(response, error.status, { error: error.message });
|
|
40365
40418
|
if (error instanceof PolicyWideningRefusedError) {
|
|
@@ -40383,6 +40436,13 @@ async function route(request, response, clientSignal) {
|
|
|
40383
40436
|
if (error instanceof PromptAttachmentError) {
|
|
40384
40437
|
return json(response, 400, { error: error.message });
|
|
40385
40438
|
}
|
|
40439
|
+
if (error instanceof PersistenceClosedError) {
|
|
40440
|
+
return json(response, 503, {
|
|
40441
|
+
error: error.message,
|
|
40442
|
+
kind: "persistence-unavailable",
|
|
40443
|
+
code: "persistence-closed"
|
|
40444
|
+
});
|
|
40445
|
+
}
|
|
40386
40446
|
log8.error("http.route-failed");
|
|
40387
40447
|
return json(response, 500, { error: "Internal bridge error" });
|
|
40388
40448
|
}
|
|
@@ -40854,7 +40914,7 @@ async function handleSteer(request, response, state) {
|
|
|
40854
40914
|
if (pendingIndex >= 0)
|
|
40855
40915
|
state.pendingSteerDeliveries.splice(pendingIndex, 1);
|
|
40856
40916
|
setSteerJournal(state, { ...prepared, state: "ambiguous" });
|
|
40857
|
-
await
|
|
40917
|
+
await persistAfterDelivery(requestId);
|
|
40858
40918
|
return json(response, 503, { outcome: "unknown", requestId });
|
|
40859
40919
|
}
|
|
40860
40920
|
if (disposition === "handled") {
|
|
@@ -40862,19 +40922,19 @@ async function handleSteer(request, response, state) {
|
|
|
40862
40922
|
if (pendingIndex >= 0)
|
|
40863
40923
|
state.pendingSteerDeliveries.splice(pendingIndex, 1);
|
|
40864
40924
|
setSteerJournal(state, { ...prepared, state: "ambiguous" });
|
|
40865
|
-
await
|
|
40925
|
+
await persistAfterDelivery(requestId);
|
|
40866
40926
|
return json(response, 503, { outcome: "unknown", requestId });
|
|
40867
40927
|
}
|
|
40868
40928
|
if (state.steerJournal.get(requestId)?.state !== "delivered" && !steerStillPendingOnRun(state, session, requestId, expectedRunId)) {
|
|
40869
40929
|
const outcome = withdrawLateSteer(state, session, requestId);
|
|
40870
40930
|
setSteerJournal(state, { ...prepared, state: outcome });
|
|
40871
|
-
await
|
|
40931
|
+
await persistAfterDelivery(requestId);
|
|
40872
40932
|
return outcome === "dropped" ? json(response, 409, { outcome: "idle" }) : json(response, 503, { outcome: "unknown", requestId });
|
|
40873
40933
|
}
|
|
40874
40934
|
if (state.steerJournal.get(requestId)?.state !== "delivered") {
|
|
40875
40935
|
setSteerJournal(state, { ...prepared, state: "queued" });
|
|
40876
40936
|
}
|
|
40877
|
-
await
|
|
40937
|
+
await persistAfterDelivery(requestId);
|
|
40878
40938
|
return json(response, 202, state.steerJournal.get(requestId)?.state === "delivered" ? { outcome: "applied", requestId } : { outcome: "unknown", requestId });
|
|
40879
40939
|
}
|
|
40880
40940
|
function steerStillPendingOnRun(state, session, requestId, expectedRunId) {
|
|
@@ -41073,7 +41133,7 @@ async function handleAdmittedPrompt(request, response, state, clientSignal, admi
|
|
|
41073
41133
|
const outcome = withdrawLateFollowUp(state, session);
|
|
41074
41134
|
if (requestId)
|
|
41075
41135
|
journal(state, requestId, outcome);
|
|
41076
|
-
await
|
|
41136
|
+
await persistAfterDelivery(requestId, true);
|
|
41077
41137
|
return outcome === "dropped" ? json(response, 409, { accepted: false, outcome: "idle" }) : json(response, 503, { accepted: false, outcome: "unknown", requestId });
|
|
41078
41138
|
}
|
|
41079
41139
|
journal(state, requestId, "accepted");
|
|
@@ -41839,6 +41899,7 @@ export {
|
|
|
41839
41899
|
PI_SIGN_IN,
|
|
41840
41900
|
PROMPT_TIMEOUT_MS,
|
|
41841
41901
|
PROVIDER,
|
|
41902
|
+
PersistenceClosedError,
|
|
41842
41903
|
PromptAttachmentError,
|
|
41843
41904
|
PromptRefusedError,
|
|
41844
41905
|
PromptStartupTimeoutError,
|
|
@@ -41970,6 +42031,7 @@ export {
|
|
|
41970
42031
|
refreshSessionCommands,
|
|
41971
42032
|
releasePromptClaim,
|
|
41972
42033
|
renderToolCall,
|
|
42034
|
+
reopenPersistenceForTests,
|
|
41973
42035
|
replayNestedToolCalls,
|
|
41974
42036
|
requestToolApproval,
|
|
41975
42037
|
requestTurnCancellation,
|