orkestrator 2.37.4-beta → 2.37.5-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/artifact-runtime/worker-context/Dockerfile +1 -1
- package/dist/artifact-runtime/worker-context/package-lock.json +4 -4
- package/dist/artifact-runtime/worker-context/package.json +1 -1
- package/dist/client.js +45 -12
- package/dist/main.js +1275 -1518
- package/package.json +4 -4
- package/resources/acp-bridge/dist/index.js +23 -51
- package/resources/claude-bridge/dist/index.js +98 -296
- package/resources/codex-bridge/dist/index.js +23 -139
- package/resources/cursor-bridge/dist/index.js +29 -27
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +26 -34
- package/resources/pi-bridge/runtime/install.json +1 -1
- package/resources/release-runtime/bun.lock +2 -2
- package/resources/release-runtime/package.json +1 -1
|
@@ -1315,10 +1315,13 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
1315
1315
|
"prompt.accepted": "The route accepted a prompt and answered 202.",
|
|
1316
1316
|
"prompt.failed": "A prompt turn failed; the session reports the error.",
|
|
1317
1317
|
"prompt.processing-failed": "A prompt accepted by the route failed while processing.",
|
|
1318
|
+
"prompt.processing-usage-limited": "A prompt accepted by the route ended on a usage limit; the turn already logged prompt.usage-limited.",
|
|
1318
1319
|
"prompt.received": "A prompt reached the bridge; only its length is logged.",
|
|
1319
1320
|
"prompt.send-failed": "A prompt request failed; the route answered with an error.",
|
|
1321
|
+
"prompt.usage-limited": "A prompt turn ended because the account's plan allowance is used up; the session reports the limit.",
|
|
1320
1322
|
"query.close-failed": "Stopping the Claude query failed while closing a tab; the close stays pending.",
|
|
1321
1323
|
"query.failed": "A Claude query ended with an error result.",
|
|
1324
|
+
"query.usage-limited": "Claude refused a query because the account's plan allowance is used up; the turn reports the limit.",
|
|
1322
1325
|
"question.answer-failed": "The answer-question route failed.",
|
|
1323
1326
|
"question.answering": "Answering a parked question.",
|
|
1324
1327
|
"question.answers-prepared": "The route prepared a question answer for the session.",
|
|
@@ -1517,10 +1520,10 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
1517
1520
|
"dev-mode.ignored-packaged": "A packaged app was launched with ELECTRON_DEV=1 and ignored it; it loads its bundled renderer.",
|
|
1518
1521
|
"instance.already-running": "Another instance holds this data directory; this one will quit.",
|
|
1519
1522
|
"main-thread.stalled": {
|
|
1520
|
-
description: "A timer fired late, so windows, IPC and the stdout reader waited.",
|
|
1523
|
+
description: "A timer fired late, so windows, IPC and the stdout reader waited. `cpuMs` is the CPU time the process used in the window: near `lagMs` the main thread was busy, far below it the thread waited.",
|
|
1521
1524
|
essential: true,
|
|
1522
1525
|
minLevel: "error",
|
|
1523
|
-
fields: { lagMs: "number", intervalMs: "number" }
|
|
1526
|
+
fields: { lagMs: "number", intervalMs: "number", cpuMs: "number" }
|
|
1524
1527
|
},
|
|
1525
1528
|
"process-memory": "Development only: working set per Electron process type, sampled on an interval.",
|
|
1526
1529
|
"process-memory.failed": "Development only: one process memory sample could not be read.",
|
|
@@ -2019,12 +2022,13 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
2019
2022
|
description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
|
|
2020
2023
|
events: {
|
|
2021
2024
|
stalled: {
|
|
2022
|
-
description: "A timer fired late, so every request in that window waited. In the backend the line also names what ran: `storageMs` and the `storage*` fields describe the slow SQLite calls in the window (`operation.slow` in `storage`), `commandsInFlight` and `commands` the commands running,
|
|
2025
|
+
description: "A timer fired late, so every request in that window waited. In the backend the line also names what ran: `storageMs` and the `storage*` fields describe the slow SQLite calls in the window (`operation.slow` in `storage`), `commandsInFlight` and `commands` the commands running, `blockingCommand` one whose synchronous part overlapped it, and `jobsInWindow` and `jobs` the recurring jobs that ran around it. `cpuMs` is the CPU time the process used in the window: near `lagMs` its own thread was busy, far below it the thread waited.",
|
|
2023
2026
|
essential: true,
|
|
2024
2027
|
minLevel: "error",
|
|
2025
2028
|
fields: {
|
|
2026
2029
|
lagMs: "number",
|
|
2027
2030
|
intervalMs: "number",
|
|
2031
|
+
cpuMs: "number",
|
|
2028
2032
|
storageMs: "number",
|
|
2029
2033
|
storageDatabase: "label",
|
|
2030
2034
|
storageOp: "label",
|
|
@@ -2032,7 +2036,8 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
2032
2036
|
storageLongestMs: "number",
|
|
2033
2037
|
storageBusy: "boolean",
|
|
2034
2038
|
commandsInFlight: "number",
|
|
2035
|
-
blockingCommandMs: "number"
|
|
2039
|
+
blockingCommandMs: "number",
|
|
2040
|
+
jobsInWindow: "number"
|
|
2036
2041
|
}
|
|
2037
2042
|
}
|
|
2038
2043
|
}
|
|
@@ -2072,6 +2077,8 @@ var TERMINAL_LOG_AREAS = defineLogAreas({
|
|
|
2072
2077
|
"pty.exit-notify-failed": "Notifying a terminal's exit failed.",
|
|
2073
2078
|
"pty.late-exit-listener-failed": "A listener added after a terminal exited threw.",
|
|
2074
2079
|
"setup.pty-reused": "A setup terminal reused its existing PTY.",
|
|
2080
|
+
"setup.pty-retired": "A setup retry ended the terminal the previous run left open, so the new run gets its own.",
|
|
2081
|
+
"setup.pty-retire-failed": "A setup retry could not end the previous run's process tree, so it kept that terminal and started nothing.",
|
|
2075
2082
|
"setup.pty-spawning": "A setup terminal is spawning its PTY. The argument count only, never the arguments.",
|
|
2076
2083
|
"setup.pty-spawned": "A setup terminal's PTY started.",
|
|
2077
2084
|
"setup.pty-exited": "A setup terminal's PTY exited.",
|
|
@@ -2383,6 +2390,8 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
2383
2390
|
"workspace.waiting": "A pipeline is waiting for its workspace; written once per reason.",
|
|
2384
2391
|
"rewind.pending": "A pipeline's code rewind has not finished; written once per reason.",
|
|
2385
2392
|
"kanban.status-failed": "A restarted pipeline's Kanban status could not be set; it retries shortly.",
|
|
2393
|
+
"kanban.environment-deleted-read-failed": "The pipelines of an environment being deleted could not be read, so their tickets keep their columns.",
|
|
2394
|
+
"kanban.environment-deleted-update-failed": "The ticket of a pipeline whose environment was deleted could not be moved; the deletion goes on.",
|
|
2386
2395
|
"usage.read-failed": "Reading a stage session's token usage failed.",
|
|
2387
2396
|
"checkpoint.deferred": "A stage transcript checkpoint could not be written yet; the provider's history stands.",
|
|
2388
2397
|
"checkpoint.not-committed": "A stage transcript checkpoint was reverted in the commit that should have kept it.",
|
|
@@ -2433,6 +2442,7 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
2433
2442
|
"baseline.update-failed": "An environment's diff baseline could not be updated.",
|
|
2434
2443
|
"scan.watcher-failed": "An environment's diff watcher failed; its scans fall back to polling.",
|
|
2435
2444
|
"scan.failed": "A diff scan failed; the last results stay, marked stale, and the scan is retried.",
|
|
2445
|
+
"scan.target-missing": "A local environment's worktree folder is missing (deleted, moved or on an unmounted drive); no scan runs, the last results stay, marked stale, and the folder is checked again on the failure backoff.",
|
|
2436
2446
|
"scan.freshness-read-failed": "Reading whether an environment's remote is fresh failed.",
|
|
2437
2447
|
"scan.listener-failed": "A change-tracking scan listener threw; the scan itself stands.",
|
|
2438
2448
|
"emit.diff-stats-failed": "A diff stats change could not be emitted to its sink.",
|
|
@@ -2610,9 +2620,9 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2610
2620
|
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
2611
2621
|
"project-seed.refused": "A project .env, .env.local or opencode.json was not copied into a new container: a link, not a regular file, outside the project, too large or unreadable.",
|
|
2612
2622
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
2613
|
-
"opencode.listener-replaced": "The process on a container's OpenCode port (`provider`: `opencode` or `opencode2`) is not the server the backend launched and recorded, so its password was withheld and the next start replaces it. `stage` is `request` when the re-check after a refused connection or an unexpected answer found it
|
|
2623
|
+
"opencode.listener-replaced": "The process on a container's OpenCode port (`provider`: `opencode` or `opencode2`) is not the server the backend launched and recorded, so its password was withheld and the next start replaces it. `stage` is `request` when the re-check after a refused connection or an unexpected answer found it; that connection then sends nothing more.",
|
|
2614
2624
|
"opencode.project-config-too-large": "A checkout's opencode.json or opencode.jsonc was larger than the limit, so a launched OpenCode server does not read it. File name only.",
|
|
2615
|
-
"opencode.project-config-filtered": "Values were left out of a checkout's OpenCode configuration before a launched server reads it
|
|
2625
|
+
"opencode.project-config-filtered": "Values were left out of a checkout's OpenCode configuration before a launched server reads it: counts of plugin keys, `{env:}` and `{file:}` references and dropped instructions (including separate instructionGlob and instructionUrl counts), and the names of files that were not a JSONC object. Never values.",
|
|
2616
2626
|
"log-driver.unbounded": "The Docker daemon offers neither the local nor the json-file log driver, so new containers keep its default driver, whose log may be uncapped. Written once per backend.",
|
|
2617
2627
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
2618
2628
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
@@ -2649,7 +2659,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2649
2659
|
fields: { provider: "label", containerPort: "number" }
|
|
2650
2660
|
},
|
|
2651
2661
|
"bridge.listener-refused": {
|
|
2652
|
-
description: "The socket listening on a container bridge's port is not the one the bridge the backend started opened
|
|
2662
|
+
description: "The socket listening on a container bridge's port is not the one the bridge the backend started opened, so its token is not handed out and the next start replaces it. `reason` is a fixed label: `different-socket`, `several-sockets`, `pending` (a start has not recorded its bridge yet, or failed before it did) or `scan-incomplete`.",
|
|
2653
2663
|
essential: true,
|
|
2654
2664
|
fields: { provider: "label", reason: "label" }
|
|
2655
2665
|
},
|
|
@@ -3171,6 +3181,7 @@ var WEB_KANBAN_LOG_AREAS = defineLogAreas({
|
|
|
3171
3181
|
"task.move-failed": "A task move failed and its status was rolled back.",
|
|
3172
3182
|
"comment.add-failed": "A comment could not be added to a task.",
|
|
3173
3183
|
"comment.delete-failed": "A comment could not be deleted from a task.",
|
|
3184
|
+
"pr.merge-failed": "Merging a ticket's pull request from its Notes tab failed; the error was shown to the user.",
|
|
3174
3185
|
"image.add-failed": "An image could not be added to a task.",
|
|
3175
3186
|
"image.delete-failed": "An image could not be deleted from a task.",
|
|
3176
3187
|
"notes.load-failed": "Project notes could not be loaded; the editor stays disabled.",
|
|
@@ -4720,11 +4731,10 @@ function setLiveBridgeDiagnostics(enabled) {
|
|
|
4720
4731
|
for (const scope of Array.from(liveScopes))
|
|
4721
4732
|
scope.syncActive();
|
|
4722
4733
|
}
|
|
4723
|
-
function bridgeDebugEnabled(
|
|
4734
|
+
function bridgeDebugEnabled(_bridge, env = process.env) {
|
|
4724
4735
|
if (liveDiagnostics !== undefined && env === process.env)
|
|
4725
4736
|
return liveDiagnostics;
|
|
4726
|
-
|
|
4727
|
-
return readBridgeDebugFlag(value);
|
|
4737
|
+
return readBridgeDebugFlag(env.ORKESTRATOR_BRIDGE_DEBUG);
|
|
4728
4738
|
}
|
|
4729
4739
|
function safeDiagnosticMetrics(value) {
|
|
4730
4740
|
const result = {};
|
|
@@ -24041,7 +24051,6 @@ import {
|
|
|
24041
24051
|
} from "node:fs/promises";
|
|
24042
24052
|
import { join as join15 } from "node:path";
|
|
24043
24053
|
var log12 = createLogger("bridge.codex");
|
|
24044
|
-
var BRIDGE_SESSION_REGISTRY_VERSION = 2;
|
|
24045
24054
|
var SESSION_TITLE_SOURCES = new Set([
|
|
24046
24055
|
"codex",
|
|
24047
24056
|
"explicit",
|
|
@@ -24145,9 +24154,6 @@ class BridgeSessionStore {
|
|
|
24145
24154
|
dir() {
|
|
24146
24155
|
return codexBridgeStateDir(this.codexHome);
|
|
24147
24156
|
}
|
|
24148
|
-
path() {
|
|
24149
|
-
return join15(this.dir(), `bridge-sessions-${this.cwdHash}.json`);
|
|
24150
|
-
}
|
|
24151
24157
|
recordsDir() {
|
|
24152
24158
|
return join15(this.dir(), `bridge-sessions-${this.cwdHash}`);
|
|
24153
24159
|
}
|
|
@@ -24172,19 +24178,13 @@ class BridgeSessionStore {
|
|
|
24172
24178
|
}
|
|
24173
24179
|
async load() {
|
|
24174
24180
|
const cutoff = this.now() - this.retentionMs;
|
|
24175
|
-
const legacy = await this.loadLegacy(cutoff);
|
|
24176
|
-
let migrationFailed = false;
|
|
24177
|
-
await this.migrateLegacy(legacy).catch((error) => {
|
|
24178
|
-
migrationFailed = true;
|
|
24179
|
-
this.warnPersistenceFailure(error);
|
|
24180
|
-
});
|
|
24181
24181
|
await this.adoptLoginRecords().catch((error) => this.warnPersistenceFailure(error));
|
|
24182
24182
|
let names;
|
|
24183
24183
|
try {
|
|
24184
24184
|
await this.ensurePrivateStorage();
|
|
24185
24185
|
names = await readdir2(this.recordsDir());
|
|
24186
24186
|
} catch {
|
|
24187
|
-
return
|
|
24187
|
+
return [];
|
|
24188
24188
|
}
|
|
24189
24189
|
const records = await Promise.all(names.map(async (name) => {
|
|
24190
24190
|
const path = join15(this.recordsDir(), name);
|
|
@@ -24213,8 +24213,7 @@ class BridgeSessionStore {
|
|
|
24213
24213
|
return null;
|
|
24214
24214
|
}
|
|
24215
24215
|
}));
|
|
24216
|
-
|
|
24217
|
-
return migrationFailed && loaded.length === 0 ? legacy : loaded;
|
|
24216
|
+
return records.filter((record) => record !== null);
|
|
24218
24217
|
}
|
|
24219
24218
|
async loadRecord(bridgeSessionId) {
|
|
24220
24219
|
const cutoff = this.now() - this.retentionMs;
|
|
@@ -24222,9 +24221,6 @@ class BridgeSessionStore {
|
|
|
24222
24221
|
const record = await this.readRecordFile(join15(this.recordsDir(), key), bridgeSessionId, cutoff);
|
|
24223
24222
|
if (record !== RECORD_FILE_MISSING)
|
|
24224
24223
|
return record;
|
|
24225
|
-
const legacy = (await this.readLegacy(cutoff)).find((session) => session.bridgeSessionId === bridgeSessionId);
|
|
24226
|
-
if (legacy)
|
|
24227
|
-
return legacy;
|
|
24228
24224
|
const loginRecords = this.loginRecordsDir();
|
|
24229
24225
|
if (!loginRecords)
|
|
24230
24226
|
return null;
|
|
@@ -24281,53 +24277,6 @@ class BridgeSessionStore {
|
|
|
24281
24277
|
});
|
|
24282
24278
|
await attempt;
|
|
24283
24279
|
}
|
|
24284
|
-
async loadLegacy(cutoff) {
|
|
24285
|
-
try {
|
|
24286
|
-
await chmod(this.dir(), PRIVATE_DIRECTORY_MODE);
|
|
24287
|
-
await chmod(this.path(), PRIVATE_FILE_MODE);
|
|
24288
|
-
} catch {
|
|
24289
|
-
return [];
|
|
24290
|
-
}
|
|
24291
|
-
return this.readLegacy(cutoff);
|
|
24292
|
-
}
|
|
24293
|
-
async readLegacy(cutoff) {
|
|
24294
|
-
try {
|
|
24295
|
-
const parsed = JSON.parse(await readFile6(this.path(), "utf8"));
|
|
24296
|
-
if (parsed.version !== BRIDGE_SESSION_REGISTRY_VERSION)
|
|
24297
|
-
return [];
|
|
24298
|
-
if (!Array.isArray(parsed.sessions))
|
|
24299
|
-
return [];
|
|
24300
|
-
return parsed.sessions.filter((session) => isPersistedBridgeSession(session, this.cwdHash, cutoff));
|
|
24301
|
-
} catch {
|
|
24302
|
-
return [];
|
|
24303
|
-
}
|
|
24304
|
-
}
|
|
24305
|
-
async migrateLegacy(sessions) {
|
|
24306
|
-
if (sessions.length === 0)
|
|
24307
|
-
return;
|
|
24308
|
-
await this.ensurePrivateStorage();
|
|
24309
|
-
await Promise.all(sessions.map(async (session) => {
|
|
24310
|
-
const target = this.recordPath(session.bridgeSessionId);
|
|
24311
|
-
const temporary = `${target}.${process.pid}.${randomUUID8()}.tmp`;
|
|
24312
|
-
await writeFile4(temporary, `${JSON.stringify(session, null, 2)}
|
|
24313
|
-
`, {
|
|
24314
|
-
encoding: "utf8",
|
|
24315
|
-
mode: PRIVATE_FILE_MODE
|
|
24316
|
-
});
|
|
24317
|
-
await chmod(temporary, PRIVATE_FILE_MODE);
|
|
24318
|
-
await link2(temporary, target).catch((error) => {
|
|
24319
|
-
if (error.code !== "EEXIST")
|
|
24320
|
-
throw error;
|
|
24321
|
-
});
|
|
24322
|
-
await chmod(target, PRIVATE_FILE_MODE);
|
|
24323
|
-
await rm6(temporary, { force: true }).catch(() => {
|
|
24324
|
-
return;
|
|
24325
|
-
});
|
|
24326
|
-
}));
|
|
24327
|
-
await rm6(this.path(), { force: true }).catch(() => {
|
|
24328
|
-
return;
|
|
24329
|
-
});
|
|
24330
|
-
}
|
|
24331
24280
|
async adoptLoginRecords() {
|
|
24332
24281
|
const source = this.loginRecordsDir();
|
|
24333
24282
|
if (!source)
|
|
@@ -25920,34 +25869,6 @@ function allowlistRateLimits(value) {
|
|
|
25920
25869
|
...Object.keys(rateLimitsByLimitId).length > 0 ? { rateLimitsByLimitId } : {}
|
|
25921
25870
|
};
|
|
25922
25871
|
}
|
|
25923
|
-
var MAX_DATE_MS2 = 8640000000000000;
|
|
25924
|
-
function rateLimitWindowsFromRead(value) {
|
|
25925
|
-
const response = objectRecord(value);
|
|
25926
|
-
const snapshot = allowlistRateLimitSnapshot(response.rateLimits);
|
|
25927
|
-
const planLabel = optionalPublicString(snapshot.limitName);
|
|
25928
|
-
const normalModelSlug = optionalPublicString(snapshot.normalModelSlug);
|
|
25929
|
-
const windows = [];
|
|
25930
|
-
for (const slot of ["primary", "secondary"]) {
|
|
25931
|
-
if (!Object.hasOwn(snapshot, slot))
|
|
25932
|
-
continue;
|
|
25933
|
-
const window = objectRecord(snapshot[slot]);
|
|
25934
|
-
if (!window)
|
|
25935
|
-
continue;
|
|
25936
|
-
const usedPercent = typeof window.usedPercent === "number" ? window.usedPercent : undefined;
|
|
25937
|
-
const windowMinutes = typeof window.windowDurationMins === "number" ? window.windowDurationMins : undefined;
|
|
25938
|
-
const resetsAtSeconds = typeof window.resetsAt === "number" ? window.resetsAt : undefined;
|
|
25939
|
-
const resetsAtMs = resetsAtSeconds !== undefined && Math.abs(resetsAtSeconds * 1000) <= MAX_DATE_MS2 ? resetsAtSeconds * 1000 : undefined;
|
|
25940
|
-
const resetsAt = resetsAtMs !== undefined ? new Date(resetsAtMs).toISOString() : undefined;
|
|
25941
|
-
windows.push({
|
|
25942
|
-
slot,
|
|
25943
|
-
label: slot === "primary" ? planLabel ?? normalModelSlug ?? "Primary" : "Secondary",
|
|
25944
|
-
...usedPercent !== undefined ? { usedPercent } : {},
|
|
25945
|
-
...resetsAt !== undefined ? { resetsAt } : {},
|
|
25946
|
-
...windowMinutes !== undefined ? { windowMinutes } : {}
|
|
25947
|
-
});
|
|
25948
|
-
}
|
|
25949
|
-
return windows;
|
|
25950
|
-
}
|
|
25951
25872
|
function safeUsageCount(value) {
|
|
25952
25873
|
let parsed;
|
|
25953
25874
|
if (typeof value === "bigint")
|
|
@@ -27074,10 +26995,6 @@ class AppServerEngine {
|
|
|
27074
26995
|
const response = await this.supervisor.request("account/usage/read", undefined);
|
|
27075
26996
|
return accountUsageWindows(response);
|
|
27076
26997
|
}
|
|
27077
|
-
async readRateLimitWindows() {
|
|
27078
|
-
const response = await this.supervisor.request("account/rateLimits/read", undefined);
|
|
27079
|
-
return rateLimitWindowsFromRead(response);
|
|
27080
|
-
}
|
|
27081
26998
|
async beginAccountLogin(method = "browser") {
|
|
27082
26999
|
const sequence = ++this.loginSequence;
|
|
27083
27000
|
this.forgetSignIn();
|
|
@@ -33515,11 +33432,6 @@ class CodexRuntimeTail {
|
|
|
33515
33432
|
}
|
|
33516
33433
|
return this.ctx.options.loadCachedModels();
|
|
33517
33434
|
}
|
|
33518
|
-
async readPlanUsage() {
|
|
33519
|
-
const limits = await this.ctx.options.engine.readRateLimitWindows();
|
|
33520
|
-
const windows = accountUsageFromLimits(limits);
|
|
33521
|
-
return windows.length > 0 ? windows : undefined;
|
|
33522
|
-
}
|
|
33523
33435
|
async listSessions(options = {}) {
|
|
33524
33436
|
const cwd = getWorkingDirectory(this.ctx.options.cwd);
|
|
33525
33437
|
const merged = new Map;
|
|
@@ -33875,9 +33787,6 @@ class AppServerRuntime {
|
|
|
33875
33787
|
listModels(...args) {
|
|
33876
33788
|
return this.tail.listModels(...args);
|
|
33877
33789
|
}
|
|
33878
|
-
readPlanUsage(...args) {
|
|
33879
|
-
return this.tail.readPlanUsage(...args);
|
|
33880
|
-
}
|
|
33881
33790
|
listSessions(...args) {
|
|
33882
33791
|
return this.tail.listSessions(...args);
|
|
33883
33792
|
}
|
|
@@ -34501,7 +34410,6 @@ function boundCodexTranscriptResponse(messages, tailMessages) {
|
|
|
34501
34410
|
return { messages: bounded, messageWindow };
|
|
34502
34411
|
}
|
|
34503
34412
|
var BRIDGE_TOKEN_ENV = "CODEX_BRIDGE_TOKEN";
|
|
34504
|
-
var BRIDGE_ALLOWED_ORIGINS_ENV = "CODEX_BRIDGE_ALLOWED_ORIGINS";
|
|
34505
34413
|
var bridgeCredential = loadBridgeCredential(BRIDGE_TOKEN_ENV);
|
|
34506
34414
|
var bridgeAuthEnabledOverrideForTesting = null;
|
|
34507
34415
|
var sseRouteTestHooks = null;
|
|
@@ -34604,11 +34512,6 @@ function bearerToken(header) {
|
|
|
34604
34512
|
function isTrustedBridgeOrigin(origin) {
|
|
34605
34513
|
if (!origin)
|
|
34606
34514
|
return true;
|
|
34607
|
-
if (origin === "null" || origin === "file://")
|
|
34608
|
-
return true;
|
|
34609
|
-
const configured = (process.env[BRIDGE_ALLOWED_ORIGINS_ENV] ?? "").split(",").map((entry) => entry.trim().replace(/\/$/, "")).filter(Boolean);
|
|
34610
|
-
if (configured.includes(origin.replace(/\/$/, "")))
|
|
34611
|
-
return true;
|
|
34612
34515
|
try {
|
|
34613
34516
|
const parsed = new URL(origin);
|
|
34614
34517
|
return (parsed.protocol === "http:" || parsed.protocol === "https:") && (parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1" || parsed.hostname === "[::1]");
|
|
@@ -35013,21 +34916,10 @@ app.use("*", async (c, next) => {
|
|
|
35013
34916
|
if (!isTrustedBridgeOrigin(origin)) {
|
|
35014
34917
|
return c.json({ error: "Origin is not allowed" }, 403);
|
|
35015
34918
|
}
|
|
35016
|
-
if (origin) {
|
|
35017
|
-
c.header("Access-Control-Allow-Origin", origin);
|
|
35018
|
-
c.header("Vary", "Origin");
|
|
35019
|
-
}
|
|
35020
|
-
if (c.req.method === "OPTIONS") {
|
|
35021
|
-
c.header("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
|
|
35022
|
-
c.header("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Orkestrator-Codex-Token");
|
|
35023
|
-
c.header("Access-Control-Allow-Private-Network", "true");
|
|
35024
|
-
return c.body(null, 204);
|
|
35025
|
-
}
|
|
35026
34919
|
if (isBridgeAuthEnabled() && !isPublicHealthRequest(c.req.method, c.req.path)) {
|
|
35027
34920
|
const dedicatedHeaderToken = c.req.raw.headers.get("x-orkestrator-codex-token")?.trim();
|
|
35028
34921
|
const headerToken = bearerToken(c.req.raw.headers.get("authorization") ?? undefined);
|
|
35029
|
-
|
|
35030
|
-
if (!tokenMatches(dedicatedHeaderToken) && !tokenMatches(headerToken) && !tokenMatches(eventToken)) {
|
|
34922
|
+
if (!tokenMatches(dedicatedHeaderToken) && !tokenMatches(headerToken)) {
|
|
35031
34923
|
return c.json({ error: "Unauthorized" }, 401);
|
|
35032
34924
|
}
|
|
35033
34925
|
const admission = await admitFetchBridgeRequest(bridgeCredential.authority, c.req.raw);
|
|
@@ -35136,10 +35028,6 @@ app.post("/global/auth/logout", async (c) => {
|
|
|
35136
35028
|
app.get("/global/models", async (c) => {
|
|
35137
35029
|
return c.json(await appServerRuntime.listModels());
|
|
35138
35030
|
});
|
|
35139
|
-
app.get("/global/usage", async (c) => {
|
|
35140
|
-
const account = await appServerRuntime.readPlanUsage();
|
|
35141
|
-
return c.json({ account: account ?? null });
|
|
35142
|
-
});
|
|
35143
35031
|
app.get("/session/:id/commands", async (c) => {
|
|
35144
35032
|
return c.json(await appServerRuntime.getCommandCatalogue(c.req.param("id")));
|
|
35145
35033
|
});
|
|
@@ -35628,10 +35516,6 @@ app.post("/session/:id/abort", async (c) => {
|
|
|
35628
35516
|
return c.json({ error: "Session not found" }, 404);
|
|
35629
35517
|
return c.json({ status: outcome.status, phase: outcome.phase }, 202);
|
|
35630
35518
|
});
|
|
35631
|
-
app.delete("/session/:id", async (c) => {
|
|
35632
|
-
const deleted = await appServerRuntime.deleteSession(c.req.param("id"));
|
|
35633
|
-
return deleted ? c.json({ status: "deleted" }) : c.json({ error: "Session not found" }, 404);
|
|
35634
|
-
});
|
|
35635
35519
|
app.get("/event/subscribe", (c) => {
|
|
35636
35520
|
const cursor = parseEventCursor(c.req.query("since")) ?? parseEventCursor(c.req.header("last-event-id"));
|
|
35637
35521
|
const sessionFilter = c.req.query("sessionId")?.trim() || null;
|
|
@@ -436,10 +436,13 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
436
436
|
"prompt.accepted": "The route accepted a prompt and answered 202.",
|
|
437
437
|
"prompt.failed": "A prompt turn failed; the session reports the error.",
|
|
438
438
|
"prompt.processing-failed": "A prompt accepted by the route failed while processing.",
|
|
439
|
+
"prompt.processing-usage-limited": "A prompt accepted by the route ended on a usage limit; the turn already logged prompt.usage-limited.",
|
|
439
440
|
"prompt.received": "A prompt reached the bridge; only its length is logged.",
|
|
440
441
|
"prompt.send-failed": "A prompt request failed; the route answered with an error.",
|
|
442
|
+
"prompt.usage-limited": "A prompt turn ended because the account's plan allowance is used up; the session reports the limit.",
|
|
441
443
|
"query.close-failed": "Stopping the Claude query failed while closing a tab; the close stays pending.",
|
|
442
444
|
"query.failed": "A Claude query ended with an error result.",
|
|
445
|
+
"query.usage-limited": "Claude refused a query because the account's plan allowance is used up; the turn reports the limit.",
|
|
443
446
|
"question.answer-failed": "The answer-question route failed.",
|
|
444
447
|
"question.answering": "Answering a parked question.",
|
|
445
448
|
"question.answers-prepared": "The route prepared a question answer for the session.",
|
|
@@ -638,10 +641,10 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
638
641
|
"dev-mode.ignored-packaged": "A packaged app was launched with ELECTRON_DEV=1 and ignored it; it loads its bundled renderer.",
|
|
639
642
|
"instance.already-running": "Another instance holds this data directory; this one will quit.",
|
|
640
643
|
"main-thread.stalled": {
|
|
641
|
-
description: "A timer fired late, so windows, IPC and the stdout reader waited.",
|
|
644
|
+
description: "A timer fired late, so windows, IPC and the stdout reader waited. `cpuMs` is the CPU time the process used in the window: near `lagMs` the main thread was busy, far below it the thread waited.",
|
|
642
645
|
essential: true,
|
|
643
646
|
minLevel: "error",
|
|
644
|
-
fields: { lagMs: "number", intervalMs: "number" }
|
|
647
|
+
fields: { lagMs: "number", intervalMs: "number", cpuMs: "number" }
|
|
645
648
|
},
|
|
646
649
|
"process-memory": "Development only: working set per Electron process type, sampled on an interval.",
|
|
647
650
|
"process-memory.failed": "Development only: one process memory sample could not be read.",
|
|
@@ -1140,12 +1143,13 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
1140
1143
|
description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
|
|
1141
1144
|
events: {
|
|
1142
1145
|
stalled: {
|
|
1143
|
-
description: "A timer fired late, so every request in that window waited. In the backend the line also names what ran: `storageMs` and the `storage*` fields describe the slow SQLite calls in the window (`operation.slow` in `storage`), `commandsInFlight` and `commands` the commands running,
|
|
1146
|
+
description: "A timer fired late, so every request in that window waited. In the backend the line also names what ran: `storageMs` and the `storage*` fields describe the slow SQLite calls in the window (`operation.slow` in `storage`), `commandsInFlight` and `commands` the commands running, `blockingCommand` one whose synchronous part overlapped it, and `jobsInWindow` and `jobs` the recurring jobs that ran around it. `cpuMs` is the CPU time the process used in the window: near `lagMs` its own thread was busy, far below it the thread waited.",
|
|
1144
1147
|
essential: true,
|
|
1145
1148
|
minLevel: "error",
|
|
1146
1149
|
fields: {
|
|
1147
1150
|
lagMs: "number",
|
|
1148
1151
|
intervalMs: "number",
|
|
1152
|
+
cpuMs: "number",
|
|
1149
1153
|
storageMs: "number",
|
|
1150
1154
|
storageDatabase: "label",
|
|
1151
1155
|
storageOp: "label",
|
|
@@ -1153,7 +1157,8 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
1153
1157
|
storageLongestMs: "number",
|
|
1154
1158
|
storageBusy: "boolean",
|
|
1155
1159
|
commandsInFlight: "number",
|
|
1156
|
-
blockingCommandMs: "number"
|
|
1160
|
+
blockingCommandMs: "number",
|
|
1161
|
+
jobsInWindow: "number"
|
|
1157
1162
|
}
|
|
1158
1163
|
}
|
|
1159
1164
|
}
|
|
@@ -1193,6 +1198,8 @@ var TERMINAL_LOG_AREAS = defineLogAreas({
|
|
|
1193
1198
|
"pty.exit-notify-failed": "Notifying a terminal's exit failed.",
|
|
1194
1199
|
"pty.late-exit-listener-failed": "A listener added after a terminal exited threw.",
|
|
1195
1200
|
"setup.pty-reused": "A setup terminal reused its existing PTY.",
|
|
1201
|
+
"setup.pty-retired": "A setup retry ended the terminal the previous run left open, so the new run gets its own.",
|
|
1202
|
+
"setup.pty-retire-failed": "A setup retry could not end the previous run's process tree, so it kept that terminal and started nothing.",
|
|
1196
1203
|
"setup.pty-spawning": "A setup terminal is spawning its PTY. The argument count only, never the arguments.",
|
|
1197
1204
|
"setup.pty-spawned": "A setup terminal's PTY started.",
|
|
1198
1205
|
"setup.pty-exited": "A setup terminal's PTY exited.",
|
|
@@ -1504,6 +1511,8 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
1504
1511
|
"workspace.waiting": "A pipeline is waiting for its workspace; written once per reason.",
|
|
1505
1512
|
"rewind.pending": "A pipeline's code rewind has not finished; written once per reason.",
|
|
1506
1513
|
"kanban.status-failed": "A restarted pipeline's Kanban status could not be set; it retries shortly.",
|
|
1514
|
+
"kanban.environment-deleted-read-failed": "The pipelines of an environment being deleted could not be read, so their tickets keep their columns.",
|
|
1515
|
+
"kanban.environment-deleted-update-failed": "The ticket of a pipeline whose environment was deleted could not be moved; the deletion goes on.",
|
|
1507
1516
|
"usage.read-failed": "Reading a stage session's token usage failed.",
|
|
1508
1517
|
"checkpoint.deferred": "A stage transcript checkpoint could not be written yet; the provider's history stands.",
|
|
1509
1518
|
"checkpoint.not-committed": "A stage transcript checkpoint was reverted in the commit that should have kept it.",
|
|
@@ -1554,6 +1563,7 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
1554
1563
|
"baseline.update-failed": "An environment's diff baseline could not be updated.",
|
|
1555
1564
|
"scan.watcher-failed": "An environment's diff watcher failed; its scans fall back to polling.",
|
|
1556
1565
|
"scan.failed": "A diff scan failed; the last results stay, marked stale, and the scan is retried.",
|
|
1566
|
+
"scan.target-missing": "A local environment's worktree folder is missing (deleted, moved or on an unmounted drive); no scan runs, the last results stay, marked stale, and the folder is checked again on the failure backoff.",
|
|
1557
1567
|
"scan.freshness-read-failed": "Reading whether an environment's remote is fresh failed.",
|
|
1558
1568
|
"scan.listener-failed": "A change-tracking scan listener threw; the scan itself stands.",
|
|
1559
1569
|
"emit.diff-stats-failed": "A diff stats change could not be emitted to its sink.",
|
|
@@ -1731,9 +1741,9 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1731
1741
|
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
1732
1742
|
"project-seed.refused": "A project .env, .env.local or opencode.json was not copied into a new container: a link, not a regular file, outside the project, too large or unreadable.",
|
|
1733
1743
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
1734
|
-
"opencode.listener-replaced": "The process on a container's OpenCode port (`provider`: `opencode` or `opencode2`) is not the server the backend launched and recorded, so its password was withheld and the next start replaces it. `stage` is `request` when the re-check after a refused connection or an unexpected answer found it
|
|
1744
|
+
"opencode.listener-replaced": "The process on a container's OpenCode port (`provider`: `opencode` or `opencode2`) is not the server the backend launched and recorded, so its password was withheld and the next start replaces it. `stage` is `request` when the re-check after a refused connection or an unexpected answer found it; that connection then sends nothing more.",
|
|
1735
1745
|
"opencode.project-config-too-large": "A checkout's opencode.json or opencode.jsonc was larger than the limit, so a launched OpenCode server does not read it. File name only.",
|
|
1736
|
-
"opencode.project-config-filtered": "Values were left out of a checkout's OpenCode configuration before a launched server reads it
|
|
1746
|
+
"opencode.project-config-filtered": "Values were left out of a checkout's OpenCode configuration before a launched server reads it: counts of plugin keys, `{env:}` and `{file:}` references and dropped instructions (including separate instructionGlob and instructionUrl counts), and the names of files that were not a JSONC object. Never values.",
|
|
1737
1747
|
"log-driver.unbounded": "The Docker daemon offers neither the local nor the json-file log driver, so new containers keep its default driver, whose log may be uncapped. Written once per backend.",
|
|
1738
1748
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
1739
1749
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
@@ -1770,7 +1780,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1770
1780
|
fields: { provider: "label", containerPort: "number" }
|
|
1771
1781
|
},
|
|
1772
1782
|
"bridge.listener-refused": {
|
|
1773
|
-
description: "The socket listening on a container bridge's port is not the one the bridge the backend started opened
|
|
1783
|
+
description: "The socket listening on a container bridge's port is not the one the bridge the backend started opened, so its token is not handed out and the next start replaces it. `reason` is a fixed label: `different-socket`, `several-sockets`, `pending` (a start has not recorded its bridge yet, or failed before it did) or `scan-incomplete`.",
|
|
1774
1784
|
essential: true,
|
|
1775
1785
|
fields: { provider: "label", reason: "label" }
|
|
1776
1786
|
},
|
|
@@ -2292,6 +2302,7 @@ var WEB_KANBAN_LOG_AREAS = defineLogAreas({
|
|
|
2292
2302
|
"task.move-failed": "A task move failed and its status was rolled back.",
|
|
2293
2303
|
"comment.add-failed": "A comment could not be added to a task.",
|
|
2294
2304
|
"comment.delete-failed": "A comment could not be deleted from a task.",
|
|
2305
|
+
"pr.merge-failed": "Merging a ticket's pull request from its Notes tab failed; the error was shown to the user.",
|
|
2295
2306
|
"image.add-failed": "An image could not be added to a task.",
|
|
2296
2307
|
"image.delete-failed": "An image could not be deleted from a task.",
|
|
2297
2308
|
"notes.load-failed": "Project notes could not be loaded; the editor stays disabled.",
|
|
@@ -31903,7 +31914,7 @@ async function sweepTemporaries(stateFile) {
|
|
|
31903
31914
|
continue;
|
|
31904
31915
|
const middle = name.slice(prefix.length, -".tmp".length);
|
|
31905
31916
|
const match = TEMPORARY_NAME.exec(middle);
|
|
31906
|
-
if (
|
|
31917
|
+
if (!match)
|
|
31907
31918
|
continue;
|
|
31908
31919
|
const path = join3(directory, name);
|
|
31909
31920
|
if (match?.[1] !== String(process.pid)) {
|
|
@@ -33906,11 +33917,10 @@ function setLiveBridgeDiagnostics(enabled) {
|
|
|
33906
33917
|
for (const scope of Array.from(liveScopes))
|
|
33907
33918
|
scope.syncActive();
|
|
33908
33919
|
}
|
|
33909
|
-
function bridgeDebugEnabled(
|
|
33920
|
+
function bridgeDebugEnabled(_bridge, env = process.env) {
|
|
33910
33921
|
if (liveDiagnostics !== undefined && env === process.env)
|
|
33911
33922
|
return liveDiagnostics;
|
|
33912
|
-
|
|
33913
|
-
return readBridgeDebugFlag(value);
|
|
33923
|
+
return readBridgeDebugFlag(env.ORKESTRATOR_BRIDGE_DEBUG);
|
|
33914
33924
|
}
|
|
33915
33925
|
function safeDiagnosticMetrics(value) {
|
|
33916
33926
|
const result = {};
|
|
@@ -41594,11 +41604,6 @@ async function routeGlobal(request, response, url) {
|
|
|
41594
41604
|
json(response, 200, { models: await listModels() });
|
|
41595
41605
|
return true;
|
|
41596
41606
|
}
|
|
41597
|
-
if (url.pathname === "/global/usage" && request.method === "GET") {
|
|
41598
|
-
const account = await refreshPlanAccountWindows();
|
|
41599
|
-
json(response, 200, { account: account ?? null });
|
|
41600
|
-
return true;
|
|
41601
|
-
}
|
|
41602
41607
|
if (url.pathname === "/global/refresh-catalog" && request.method === "POST") {
|
|
41603
41608
|
refreshModels();
|
|
41604
41609
|
json(response, 200, { ok: true });
|
|
@@ -41734,8 +41739,8 @@ async function routeSession(request, response, url, clientSignal) {
|
|
|
41734
41739
|
return json(response, 200, unsupportedCommandRefresh());
|
|
41735
41740
|
}
|
|
41736
41741
|
const tombstoned = hasRestoredTombstone(match[1]);
|
|
41737
|
-
if (tombstoned &&
|
|
41738
|
-
return await answerCloseOperation(response, closeRestoredTombstone(match[1])
|
|
41742
|
+
if (tombstoned && isCloseRequest(action, request)) {
|
|
41743
|
+
return await answerCloseOperation(response, closeRestoredTombstone(match[1]));
|
|
41739
41744
|
}
|
|
41740
41745
|
if (isCloseRequest(action, request) && !subject) {
|
|
41741
41746
|
return json(response, 200, { closed: true, missing: true });
|
|
@@ -41895,11 +41900,8 @@ async function routeSession(request, response, url, clientSignal) {
|
|
|
41895
41900
|
if (action === "prompt" && request.method === "POST") {
|
|
41896
41901
|
return await handlePrompt(request, response, state, clientSignal);
|
|
41897
41902
|
}
|
|
41898
|
-
if (!action && request.method === "DELETE") {
|
|
41899
|
-
return await answerCloseOperation(response, closeSessionPermanently(state), "delete");
|
|
41900
|
-
}
|
|
41901
41903
|
if (isCloseRequest(action, request) && !subject) {
|
|
41902
|
-
return await answerCloseOperation(response, closeSessionPermanently(state)
|
|
41904
|
+
return await answerCloseOperation(response, closeSessionPermanently(state));
|
|
41903
41905
|
}
|
|
41904
41906
|
return json(response, 405, { error: "Method not allowed" });
|
|
41905
41907
|
}
|
|
@@ -41996,12 +41998,12 @@ function rejectSteer(response, requestId, reason) {
|
|
|
41996
41998
|
function isCloseRequest(action, request) {
|
|
41997
41999
|
return action === "close" && request.method === "POST";
|
|
41998
42000
|
}
|
|
41999
|
-
async function answerCloseOperation(response, operation
|
|
42001
|
+
async function answerCloseOperation(response, operation) {
|
|
42000
42002
|
let outcome;
|
|
42001
42003
|
try {
|
|
42002
42004
|
outcome = await operation;
|
|
42003
42005
|
} catch (error) {
|
|
42004
|
-
if (
|
|
42006
|
+
if (!(error instanceof PersistenceError))
|
|
42005
42007
|
throw error;
|
|
42006
42008
|
return json(response, 503, {
|
|
42007
42009
|
closed: false,
|
|
@@ -42011,9 +42013,9 @@ async function answerCloseOperation(response, operation, route) {
|
|
|
42011
42013
|
code: error.code
|
|
42012
42014
|
});
|
|
42013
42015
|
}
|
|
42014
|
-
return answerClose(response, outcome
|
|
42016
|
+
return answerClose(response, outcome);
|
|
42015
42017
|
}
|
|
42016
|
-
function answerClose(response, outcome
|
|
42018
|
+
function answerClose(response, outcome) {
|
|
42017
42019
|
if (outcome === "pending") {
|
|
42018
42020
|
return json(response, 503, {
|
|
42019
42021
|
closed: false,
|
|
@@ -42021,7 +42023,7 @@ function answerClose(response, outcome, route) {
|
|
|
42021
42023
|
error: "Cursor session close is still in progress"
|
|
42022
42024
|
});
|
|
42023
42025
|
}
|
|
42024
|
-
return json(response, 200,
|
|
42026
|
+
return json(response, 200, { closed: true, retained: true });
|
|
42025
42027
|
}
|
|
42026
42028
|
async function handleConfig(request, response, state) {
|
|
42027
42029
|
const body = await readJson(request);
|