orkestrator 2.35.5-beta → 2.36.0
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 +956 -486
- package/dist/main.js +48232 -43225
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +317 -242
- package/resources/claude-bridge/dist/index.js +179 -22
- package/resources/codex-bridge/dist/index.js +529 -113
- package/resources/cursor-bridge/dist/index.js +26 -6
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +61 -12
- package/resources/pi-bridge/runtime/install.json +1 -1
|
@@ -161,6 +161,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
161
161
|
"session.created": "A session was created or recovered.",
|
|
162
162
|
"session.delete-failed": "Deleting a session failed.",
|
|
163
163
|
"session.fork-failed": "Forking a session failed.",
|
|
164
|
+
"session.policy-widening-refused": "A config request tried to widen a live session's execution policy and was refused; widened names the axes.",
|
|
164
165
|
"session.rename-failed": "Renaming a session failed.",
|
|
165
166
|
"session.resolve-failed": "A session could not be found or loaded for a request; action names the request.",
|
|
166
167
|
"session.rewind-failed": "Rewinding session files failed.",
|
|
@@ -293,6 +294,7 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
293
294
|
"backend.keychain-link-remove-failed": "An agent-test profile kept a legacy link to the host keychain.",
|
|
294
295
|
"backend.start-failed": "The Local backend did not start; continuing with remote machines.",
|
|
295
296
|
"clipboard.write-failed": "Writing text to the system clipboard failed.",
|
|
297
|
+
"dev-mode.ignored-packaged": "A packaged app was launched with ELECTRON_DEV=1 and ignored it; it loads its bundled renderer.",
|
|
296
298
|
"instance.already-running": "Another instance holds this data directory; this one will quit.",
|
|
297
299
|
"main-thread.stalled": "A timer fired late, so windows, IPC and the stdout reader waited.",
|
|
298
300
|
"quit.stopping-backend": "The app is quitting and has asked the Local backend to stop.",
|
|
@@ -365,7 +367,8 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
365
367
|
description: "Preparing the pinned agent toolchain at desktop startup.",
|
|
366
368
|
events: {
|
|
367
369
|
"bootstrap-progress.show-failed": "The toolchain progress window could not be shown.",
|
|
368
|
-
"prepare.failed": "Preparing the pinned agent tools failed."
|
|
370
|
+
"prepare.failed": "Preparing the pinned agent tools failed.",
|
|
371
|
+
"prepare.ready": "The pinned agent tools were verified and activated; durationMs is how long startup waited."
|
|
369
372
|
}
|
|
370
373
|
},
|
|
371
374
|
"artifact-host": {
|
|
@@ -553,6 +556,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
553
556
|
description: "Native agent sessions and what the backend reads from their bridges.",
|
|
554
557
|
events: {
|
|
555
558
|
"catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
|
|
559
|
+
"compact.instructions-ignored": "A bridge compacted without confirming the instructions sent with /compact: it predates them.",
|
|
556
560
|
"handoff.summary-read-failed": "Change summaries could not be read for a handoff, so the carrier says they are unmeasured.",
|
|
557
561
|
"handoff.consume-failed": "A delivered handoff could not be marked consumed.",
|
|
558
562
|
"job.pr-refresh-rollback-failed": "Rolling back a pull request refresh for a job failed.",
|
|
@@ -808,6 +812,8 @@ var TMUX_LOG_AREAS = defineLogAreas({
|
|
|
808
812
|
"interactive.snapshot-failed": "An interactive snapshot failed; expected while a pane is closing.",
|
|
809
813
|
"signal.arm-failed": "The Claude state signal could not be armed.",
|
|
810
814
|
"signal.degraded": "The Claude state signal missed a change or rang too often, so polling stays at one second until it is re-armed.",
|
|
815
|
+
"hook-signal.arm-failed": "The tmux hook doorbell could not be armed.",
|
|
816
|
+
"hook-signal.degraded": "The tmux hook doorbell missed a hook, so idle tabs poll every second until it is re-armed.",
|
|
811
817
|
"pr-refresh.schedule-failed": "A pull request refresh after a turn could not be scheduled.",
|
|
812
818
|
"pr-probe.failed": "Probing for a pull request an agent created failed.",
|
|
813
819
|
"activity.persist-failed": "Tmux tab activity could not be saved.",
|
|
@@ -989,6 +995,7 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
989
995
|
"work.move-failed": "Work could not move to the main coordinator.",
|
|
990
996
|
"wake.observe-remote-workflow-failed": "A remote workflow could not be observed for status wakes.",
|
|
991
997
|
"wake.observe-pull-request-failed": "A pull request could not be observed for status wakes.",
|
|
998
|
+
"wake.observe-feature-plan-failed": "A feature plan could not be observed for status wakes.",
|
|
992
999
|
"wake.observe-workflow-failed": "A workflow could not be observed for status wakes.",
|
|
993
1000
|
"wake.deliver-failed": "A workflow status wake could not be delivered; the next pass retries.",
|
|
994
1001
|
"wake.waiting-check-failed": "A waiting worker could not be checked; the next pass retries.",
|
|
@@ -1000,7 +1007,11 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
1000
1007
|
"store.invalid-workspace": "An invalid coordinator workspace record was ignored.",
|
|
1001
1008
|
"store.workflows-cleared": "The workflow store was full, so a batch of its oldest finished records was removed.",
|
|
1002
1009
|
"store.workflows-in-use": "The workflow store was full and every record was still in use, so new work was refused.",
|
|
1003
|
-
"remote-worker.settle-failed": "A remote worker could not be settled."
|
|
1010
|
+
"remote-worker.settle-failed": "A remote worker could not be settled.",
|
|
1011
|
+
"checkout.merge-followed": "After an environment's PR merged, the project checkout was fast-forwarded, or `outcome` says why not.",
|
|
1012
|
+
"checkout.merge-follow-failed": "Fast-forwarding the project checkout failed, after an environment's PR merged or before mail woke the main coordinator.",
|
|
1013
|
+
"checkout.mail-follow": "Before mail woke the main coordinator, the project checkout was fast-forwarded, or `outcome` says why not (`timed-out`, `failed`).",
|
|
1014
|
+
"checkout.mail-follow-failed": "Before mail woke the main coordinator, checking whether to fast-forward the project checkout failed; the mail was delivered anyway."
|
|
1004
1015
|
}
|
|
1005
1016
|
}
|
|
1006
1017
|
});
|
|
@@ -1032,6 +1043,7 @@ var REVIEW_LOG_AREAS = defineLogAreas({
|
|
|
1032
1043
|
"gh.pr-list-unparseable": "`gh pr list` returned nothing that parses. Sizes only, never the output.",
|
|
1033
1044
|
"monitor.start-failed": "Monitoring could not start for a newly opened pull request.",
|
|
1034
1045
|
"cleanup-scheduler.missing": "A merged pull request was seen, but this runtime has no merge cleanup scheduler.",
|
|
1046
|
+
"checkout.follow-merge-lookup-failed": "A merged pull request's project could not be read, so its checkout was not fast-forwarded.",
|
|
1035
1047
|
"auto-merge.evaluation-failed": "Evaluating an environment for auto-merge failed.",
|
|
1036
1048
|
"auto-merge.merge-failed": "Auto-merge could not merge a pull request; the attempt is held and retried.",
|
|
1037
1049
|
"auto-merge.resolve-failed": "Auto-merge could not launch Resolve for a pull request; the attempt is held and retried.",
|
|
@@ -1075,6 +1087,8 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
|
|
|
1075
1087
|
"container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
|
|
1076
1088
|
"last-usage.save-failed": "The last plan usage reading could not be saved; the next save retries.",
|
|
1077
1089
|
"login-cleanup.failed": "A temporary login could not be cleaned up.",
|
|
1090
|
+
"login-renewal.failed": "Renewing an idle account's sign-in to read its usage failed; it is retried after a backoff.",
|
|
1091
|
+
"login-renewal.not-extended": "Claude Code ran to renew an idle account's sign-in, but its token is still lapsed.",
|
|
1078
1092
|
"login-refresh.deferred": "Containers were not told to refresh their login now; they reconcile from its durable generation."
|
|
1079
1093
|
}
|
|
1080
1094
|
}
|
|
@@ -1088,6 +1102,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1088
1102
|
"portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
|
|
1089
1103
|
"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.",
|
|
1090
1104
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
1105
|
+
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
1091
1106
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
1092
1107
|
"login-keeper.refresh-failed": "Refreshing the host Claude login failed. Fixed text: CLI output can hold credentials.",
|
|
1093
1108
|
"login-keeper.refresh-not-extended": "Refreshing the host Claude login did not extend its expiry.",
|
|
@@ -1211,7 +1226,7 @@ var GRAPH_LOG_AREAS = defineLogAreas({
|
|
|
1211
1226
|
// ../protocol/src/log-vocabulary/nodes.ts
|
|
1212
1227
|
var NODES_LOG_AREAS = defineLogAreas({
|
|
1213
1228
|
nodes: {
|
|
1214
|
-
description: "Command nodes: links, handovers, leaf mail and project copies.",
|
|
1229
|
+
description: "Command nodes: links, handovers, leaf mail, ticket sync and project copies.",
|
|
1215
1230
|
events: {
|
|
1216
1231
|
"actions.resume-failed": "Approved actions could not be resumed; a later pass retries.",
|
|
1217
1232
|
"project-copy.notify-failed": "The coordinator could not be told a project copy finished.",
|
|
@@ -1223,7 +1238,11 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
1223
1238
|
"verification.record-failed": "A node verification could not be recorded.",
|
|
1224
1239
|
"profile.record-failed": "A node profile could not be recorded.",
|
|
1225
1240
|
"detach.unconfirmed": "A forgotten node has not confirmed the detach yet.",
|
|
1226
|
-
"handover.recovery-pending": "Command handover recovery is still pending."
|
|
1241
|
+
"handover.recovery-pending": "Command handover recovery is still pending.",
|
|
1242
|
+
"ticket-sync.work-record-failed": "A remote build started but its ticket work location could not be saved.",
|
|
1243
|
+
"ticket-sync.failed": "A Kanban sync with a node failed; it is retried.",
|
|
1244
|
+
"ticket-sync.unknown-project": "A node sent ticket changes for a project that no longer exists here.",
|
|
1245
|
+
"ticket-sync.forget-failed": "A detached command node's ticket copies could not be released."
|
|
1227
1246
|
}
|
|
1228
1247
|
}
|
|
1229
1248
|
});
|
|
@@ -1806,7 +1825,7 @@ var LOG_VOCABULARY = {
|
|
|
1806
1825
|
// ../protocol/src/secret-redaction.ts
|
|
1807
1826
|
var TEXT_RULES = [
|
|
1808
1827
|
{
|
|
1809
|
-
pattern: /([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
|
|
1828
|
+
pattern: /(?<![a-z0-9+.-])([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
|
|
1810
1829
|
replacement: "$1[redacted]@"
|
|
1811
1830
|
},
|
|
1812
1831
|
{
|
|
@@ -1826,7 +1845,7 @@ var TEXT_RULES = [
|
|
|
1826
1845
|
{ pattern: /\bAKIA[0-9A-Z]{12,}/g, replacement: "[redacted]" },
|
|
1827
1846
|
{ pattern: /\bAIza[0-9A-Za-z_-]{20,}/g, replacement: "[redacted]" },
|
|
1828
1847
|
{
|
|
1829
|
-
pattern:
|
|
1848
|
+
pattern: /(?<![A-Za-z0-9_-])(-*\b(?:[A-Za-z0-9]+[_-])*(?:api[_-]?key|apikey|access[_-]?token|refresh[_-]?token|auth[_-]?token|token|secret|client[_-]?secret|password|passwd|passphrase|authorization))("?\s*[:=]\s*)("?)(?!Bearer\b|Basic\b|\[redacted\])[^\s"',;)&]{6,}\3/gi,
|
|
1830
1849
|
replacement: "$1$2[redacted]"
|
|
1831
1850
|
}
|
|
1832
1851
|
];
|
|
@@ -3047,7 +3066,7 @@ async function readBridgeLogPolicyBody(request) {
|
|
|
3047
3066
|
import { execFile as execFileCallback2 } from "node:child_process";
|
|
3048
3067
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
3049
3068
|
import { appendFile as appendFile5, mkdir as mkdir9, readFile as readFile7, writeFile as writeFile6 } from "node:fs/promises";
|
|
3050
|
-
import { join as
|
|
3069
|
+
import { join as join23 } from "node:path";
|
|
3051
3070
|
import { promisify as promisify2 } from "node:util";
|
|
3052
3071
|
|
|
3053
3072
|
// ../../node_modules/.bun/@hono+node-server@2.1.5+c539cad7f494f5c9/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
@@ -13966,7 +13985,7 @@ async function deriveTranscriptSubagentPartsForTurn({
|
|
|
13966
13985
|
|
|
13967
13986
|
// ../../bridges/codex-bridge/src/history/rollout.ts
|
|
13968
13987
|
import { createHash as createHash7 } from "node:crypto";
|
|
13969
|
-
import {
|
|
13988
|
+
import { readdir, stat as stat5 } from "node:fs/promises";
|
|
13970
13989
|
import { homedir } from "node:os";
|
|
13971
13990
|
import { basename as basename2, join as join11 } from "node:path";
|
|
13972
13991
|
|
|
@@ -15971,6 +15990,306 @@ function parseCapacityRetryContinuation(text) {
|
|
|
15971
15990
|
return { attempt: Number(match[1]), maxAttempts: Number(match[2]) };
|
|
15972
15991
|
}
|
|
15973
15992
|
|
|
15993
|
+
// ../../bridges/codex-bridge/src/history/session-index-cache.ts
|
|
15994
|
+
import { open as open4, readFile as readFile4, stat as stat4 } from "node:fs/promises";
|
|
15995
|
+
var MAX_SESSION_INDEX_CACHE_ENTRIES = 50000;
|
|
15996
|
+
var MAX_SESSION_INDEX_CACHE_BYTES = 16 * 1024 * 1024;
|
|
15997
|
+
var MAX_SESSION_INDEX_CACHE_PATHS = 4;
|
|
15998
|
+
var ENTRY_OVERHEAD_BYTES2 = 96;
|
|
15999
|
+
var INDEX_OVERHEAD_BYTES = 512;
|
|
16000
|
+
var ANCHOR_BYTES2 = 64;
|
|
16001
|
+
var NEWLINE2 = 10;
|
|
16002
|
+
var DEFAULT_LIMITS2 = {
|
|
16003
|
+
maxEntries: MAX_SESSION_INDEX_CACHE_ENTRIES,
|
|
16004
|
+
maxBytes: MAX_SESSION_INDEX_CACHE_BYTES,
|
|
16005
|
+
maxPaths: MAX_SESSION_INDEX_CACHE_PATHS
|
|
16006
|
+
};
|
|
16007
|
+
var limits2 = DEFAULT_LIMITS2;
|
|
16008
|
+
var EMPTY_SNAPSHOT = { entries: () => [], last: () => {
|
|
16009
|
+
return;
|
|
16010
|
+
} };
|
|
16011
|
+
var cache = new Map;
|
|
16012
|
+
var locks = new Map;
|
|
16013
|
+
var counters2 = { fullReads: 0, tailReads: 0, uncachedReads: 0, bytesRead: 0 };
|
|
16014
|
+
function entryBytes2(entry) {
|
|
16015
|
+
return ENTRY_OVERHEAD_BYTES2 + 2 * (entry.id.length + (entry.threadName?.length ?? 0) + (entry.updatedAt?.length ?? 0));
|
|
16016
|
+
}
|
|
16017
|
+
function fitsAlone(entryCount, bytes) {
|
|
16018
|
+
return entryCount <= limits2.maxEntries && bytes <= limits2.maxBytes;
|
|
16019
|
+
}
|
|
16020
|
+
function touch2(index) {
|
|
16021
|
+
cache.delete(index.path);
|
|
16022
|
+
cache.set(index.path, index);
|
|
16023
|
+
}
|
|
16024
|
+
function enforceBudgets2() {
|
|
16025
|
+
let entries = 0;
|
|
16026
|
+
let bytes = 0;
|
|
16027
|
+
for (const index of cache.values()) {
|
|
16028
|
+
entries += index.entries.length;
|
|
16029
|
+
bytes += index.estimatedBytes;
|
|
16030
|
+
}
|
|
16031
|
+
for (const index of Array.from(cache.values())) {
|
|
16032
|
+
if (cache.size <= limits2.maxPaths && entries <= limits2.maxEntries && bytes <= limits2.maxBytes) {
|
|
16033
|
+
return;
|
|
16034
|
+
}
|
|
16035
|
+
cache.delete(index.path);
|
|
16036
|
+
entries -= index.entries.length;
|
|
16037
|
+
bytes -= index.estimatedBytes;
|
|
16038
|
+
}
|
|
16039
|
+
}
|
|
16040
|
+
function parseIndexLine(line) {
|
|
16041
|
+
const text = line.trim();
|
|
16042
|
+
if (!text)
|
|
16043
|
+
return;
|
|
16044
|
+
let parsed;
|
|
16045
|
+
try {
|
|
16046
|
+
parsed = JSON.parse(text);
|
|
16047
|
+
} catch {
|
|
16048
|
+
return;
|
|
16049
|
+
}
|
|
16050
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
16051
|
+
return;
|
|
16052
|
+
const record = parsed;
|
|
16053
|
+
if (typeof record.id !== "string")
|
|
16054
|
+
return;
|
|
16055
|
+
return {
|
|
16056
|
+
id: record.id,
|
|
16057
|
+
...typeof record.thread_name === "string" ? { threadName: record.thread_name } : {},
|
|
16058
|
+
...typeof record.updated_at === "string" ? { updatedAt: record.updated_at } : {}
|
|
16059
|
+
};
|
|
16060
|
+
}
|
|
16061
|
+
function parseChunk(bytes) {
|
|
16062
|
+
const lastNewline = bytes.lastIndexOf(NEWLINE2);
|
|
16063
|
+
const committedBytes = lastNewline + 1;
|
|
16064
|
+
const entries = [];
|
|
16065
|
+
if (committedBytes > 0) {
|
|
16066
|
+
for (const line of bytes.subarray(0, committedBytes).toString("utf8").split(`
|
|
16067
|
+
`)) {
|
|
16068
|
+
const entry = parseIndexLine(line);
|
|
16069
|
+
if (entry)
|
|
16070
|
+
entries.push(entry);
|
|
16071
|
+
}
|
|
16072
|
+
}
|
|
16073
|
+
const pendingTail = committedBytes < bytes.length ? parseIndexLine(bytes.subarray(committedBytes).toString("utf8")) : undefined;
|
|
16074
|
+
return { entries, committedBytes, ...pendingTail ? { pendingTail } : {} };
|
|
16075
|
+
}
|
|
16076
|
+
function snapshotOf2(index) {
|
|
16077
|
+
const { entries, lastById, pendingTail } = index;
|
|
16078
|
+
const length = entries.length;
|
|
16079
|
+
return {
|
|
16080
|
+
entries: () => {
|
|
16081
|
+
const committed = entries.slice(0, length);
|
|
16082
|
+
if (pendingTail)
|
|
16083
|
+
committed.push(pendingTail);
|
|
16084
|
+
return committed;
|
|
16085
|
+
},
|
|
16086
|
+
last(id) {
|
|
16087
|
+
if (pendingTail?.id === id)
|
|
16088
|
+
return pendingTail;
|
|
16089
|
+
const position = lastById.get(id);
|
|
16090
|
+
if (position === undefined)
|
|
16091
|
+
return;
|
|
16092
|
+
if (position < length)
|
|
16093
|
+
return entries[position];
|
|
16094
|
+
for (let at = length - 1;at >= 0; at -= 1) {
|
|
16095
|
+
if (entries[at].id === id)
|
|
16096
|
+
return entries[at];
|
|
16097
|
+
}
|
|
16098
|
+
return;
|
|
16099
|
+
}
|
|
16100
|
+
};
|
|
16101
|
+
}
|
|
16102
|
+
function lookupSnapshot(entries) {
|
|
16103
|
+
let lastById;
|
|
16104
|
+
return {
|
|
16105
|
+
entries: () => entries,
|
|
16106
|
+
last(id) {
|
|
16107
|
+
if (!lastById) {
|
|
16108
|
+
lastById = new Map;
|
|
16109
|
+
for (const entry of entries)
|
|
16110
|
+
lastById.set(entry.id, entry);
|
|
16111
|
+
}
|
|
16112
|
+
return lastById.get(id);
|
|
16113
|
+
}
|
|
16114
|
+
};
|
|
16115
|
+
}
|
|
16116
|
+
function sameStats2(index, stats) {
|
|
16117
|
+
return index.fileId === `${stats.dev}:${stats.ino}` && Number(stats.size) === index.size && stats.mtimeNs === index.mtimeNs && stats.ctimeNs === index.ctimeNs;
|
|
16118
|
+
}
|
|
16119
|
+
async function readRange(handle, start, end) {
|
|
16120
|
+
const length = end - start;
|
|
16121
|
+
if (length <= 0)
|
|
16122
|
+
return Buffer.alloc(0);
|
|
16123
|
+
const buffer = Buffer.alloc(length);
|
|
16124
|
+
let filled = 0;
|
|
16125
|
+
while (filled < length) {
|
|
16126
|
+
const { bytesRead } = await handle.read(buffer, filled, length - filled, start + filled);
|
|
16127
|
+
if (bytesRead === 0)
|
|
16128
|
+
return null;
|
|
16129
|
+
filled += bytesRead;
|
|
16130
|
+
}
|
|
16131
|
+
counters2.bytesRead += length;
|
|
16132
|
+
return buffer;
|
|
16133
|
+
}
|
|
16134
|
+
async function readAnchor2(handle, end) {
|
|
16135
|
+
return readRange(handle, Math.max(0, end - ANCHOR_BYTES2), end);
|
|
16136
|
+
}
|
|
16137
|
+
var RETRY2 = Symbol("retry");
|
|
16138
|
+
async function fullRead(path, handle, stats) {
|
|
16139
|
+
const size = Number(stats.size);
|
|
16140
|
+
const bytes = await readRange(handle, 0, size);
|
|
16141
|
+
if (!bytes)
|
|
16142
|
+
return RETRY2;
|
|
16143
|
+
const { entries, committedBytes, pendingTail } = parseChunk(bytes);
|
|
16144
|
+
let estimatedBytes = INDEX_OVERHEAD_BYTES;
|
|
16145
|
+
for (const entry of entries)
|
|
16146
|
+
estimatedBytes += entryBytes2(entry);
|
|
16147
|
+
if (pendingTail)
|
|
16148
|
+
estimatedBytes += entryBytes2(pendingTail);
|
|
16149
|
+
if (!fitsAlone(entries.length, estimatedBytes)) {
|
|
16150
|
+
cache.delete(path);
|
|
16151
|
+
counters2.uncachedReads += 1;
|
|
16152
|
+
return lookupSnapshot(pendingTail ? [...entries, pendingTail] : entries);
|
|
16153
|
+
}
|
|
16154
|
+
counters2.fullReads += 1;
|
|
16155
|
+
const lastById = new Map;
|
|
16156
|
+
entries.forEach((entry, position) => lastById.set(entry.id, position));
|
|
16157
|
+
const index = {
|
|
16158
|
+
path,
|
|
16159
|
+
fileId: `${stats.dev}:${stats.ino}`,
|
|
16160
|
+
size,
|
|
16161
|
+
mtimeNs: stats.mtimeNs,
|
|
16162
|
+
ctimeNs: stats.ctimeNs,
|
|
16163
|
+
consumedEnd: committedBytes,
|
|
16164
|
+
anchor: Buffer.from(bytes.subarray(Math.max(0, committedBytes - ANCHOR_BYTES2), committedBytes)),
|
|
16165
|
+
entries,
|
|
16166
|
+
lastById,
|
|
16167
|
+
...pendingTail ? { pendingTail } : {},
|
|
16168
|
+
estimatedBytes
|
|
16169
|
+
};
|
|
16170
|
+
touch2(index);
|
|
16171
|
+
enforceBudgets2();
|
|
16172
|
+
return snapshotOf2(index);
|
|
16173
|
+
}
|
|
16174
|
+
async function tailRead(index, handle, stats) {
|
|
16175
|
+
const size = Number(stats.size);
|
|
16176
|
+
const anchor = await readAnchor2(handle, index.consumedEnd);
|
|
16177
|
+
if (!anchor?.equals(index.anchor))
|
|
16178
|
+
return false;
|
|
16179
|
+
const bytes = await readRange(handle, index.consumedEnd, size);
|
|
16180
|
+
if (!bytes)
|
|
16181
|
+
return false;
|
|
16182
|
+
const { entries, committedBytes, pendingTail } = parseChunk(bytes);
|
|
16183
|
+
let estimatedBytes = index.estimatedBytes - (index.pendingTail ? entryBytes2(index.pendingTail) : 0);
|
|
16184
|
+
for (const entry of entries)
|
|
16185
|
+
estimatedBytes += entryBytes2(entry);
|
|
16186
|
+
if (pendingTail)
|
|
16187
|
+
estimatedBytes += entryBytes2(pendingTail);
|
|
16188
|
+
if (!fitsAlone(index.entries.length + entries.length, estimatedBytes))
|
|
16189
|
+
return false;
|
|
16190
|
+
counters2.tailReads += 1;
|
|
16191
|
+
for (const entry of entries) {
|
|
16192
|
+
index.lastById.set(entry.id, index.entries.length);
|
|
16193
|
+
index.entries.push(entry);
|
|
16194
|
+
}
|
|
16195
|
+
if (committedBytes > 0) {
|
|
16196
|
+
const committed = bytes.subarray(0, committedBytes);
|
|
16197
|
+
index.anchor = Buffer.from((committedBytes >= ANCHOR_BYTES2 ? committed : Buffer.concat([index.anchor, committed])).subarray(-ANCHOR_BYTES2));
|
|
16198
|
+
index.consumedEnd += committedBytes;
|
|
16199
|
+
}
|
|
16200
|
+
index.pendingTail = pendingTail;
|
|
16201
|
+
index.size = size;
|
|
16202
|
+
index.mtimeNs = stats.mtimeNs;
|
|
16203
|
+
index.ctimeNs = stats.ctimeNs;
|
|
16204
|
+
index.estimatedBytes = estimatedBytes;
|
|
16205
|
+
touch2(index);
|
|
16206
|
+
enforceBudgets2();
|
|
16207
|
+
return snapshotOf2(index);
|
|
16208
|
+
}
|
|
16209
|
+
async function refreshOnce2(path) {
|
|
16210
|
+
const cached = cache.get(path);
|
|
16211
|
+
let pathStats;
|
|
16212
|
+
try {
|
|
16213
|
+
pathStats = await stat4(path, { bigint: true });
|
|
16214
|
+
} catch {
|
|
16215
|
+
cache.delete(path);
|
|
16216
|
+
return EMPTY_SNAPSHOT;
|
|
16217
|
+
}
|
|
16218
|
+
if (!pathStats.isFile()) {
|
|
16219
|
+
cache.delete(path);
|
|
16220
|
+
return EMPTY_SNAPSHOT;
|
|
16221
|
+
}
|
|
16222
|
+
if (cached && sameStats2(cached, pathStats)) {
|
|
16223
|
+
touch2(cached);
|
|
16224
|
+
return snapshotOf2(cached);
|
|
16225
|
+
}
|
|
16226
|
+
let handle;
|
|
16227
|
+
try {
|
|
16228
|
+
handle = await open4(path, "r");
|
|
16229
|
+
} catch {
|
|
16230
|
+
cache.delete(path);
|
|
16231
|
+
return EMPTY_SNAPSHOT;
|
|
16232
|
+
}
|
|
16233
|
+
try {
|
|
16234
|
+
const stats = await handle.stat({ bigint: true });
|
|
16235
|
+
const index = cache.get(path);
|
|
16236
|
+
if (index && sameStats2(index, stats)) {
|
|
16237
|
+
touch2(index);
|
|
16238
|
+
return snapshotOf2(index);
|
|
16239
|
+
}
|
|
16240
|
+
if (index && index.fileId === `${stats.dev}:${stats.ino}` && Number(stats.size) > index.size) {
|
|
16241
|
+
const extended = await tailRead(index, handle, stats);
|
|
16242
|
+
if (extended)
|
|
16243
|
+
return extended;
|
|
16244
|
+
}
|
|
16245
|
+
cache.delete(path);
|
|
16246
|
+
return await fullRead(path, handle, stats);
|
|
16247
|
+
} finally {
|
|
16248
|
+
await handle.close().catch(() => {
|
|
16249
|
+
return;
|
|
16250
|
+
});
|
|
16251
|
+
}
|
|
16252
|
+
}
|
|
16253
|
+
async function refreshLocked2(path) {
|
|
16254
|
+
for (let attempt = 0;attempt < 2; attempt += 1) {
|
|
16255
|
+
try {
|
|
16256
|
+
const snapshot = await refreshOnce2(path);
|
|
16257
|
+
if (snapshot !== RETRY2)
|
|
16258
|
+
return snapshot;
|
|
16259
|
+
} catch {
|
|
16260
|
+
cache.delete(path);
|
|
16261
|
+
break;
|
|
16262
|
+
}
|
|
16263
|
+
}
|
|
16264
|
+
cache.delete(path);
|
|
16265
|
+
return uncachedRead(path);
|
|
16266
|
+
}
|
|
16267
|
+
async function uncachedRead(path) {
|
|
16268
|
+
counters2.uncachedReads += 1;
|
|
16269
|
+
try {
|
|
16270
|
+
const raw = await readFile4(path);
|
|
16271
|
+
counters2.bytesRead += raw.length;
|
|
16272
|
+
const { entries, pendingTail } = parseChunk(raw);
|
|
16273
|
+
return lookupSnapshot(pendingTail ? [...entries, pendingTail] : entries);
|
|
16274
|
+
} catch {
|
|
16275
|
+
return EMPTY_SNAPSHOT;
|
|
16276
|
+
}
|
|
16277
|
+
}
|
|
16278
|
+
async function readSessionIndex(path) {
|
|
16279
|
+
const previous = locks.get(path) ?? Promise.resolve();
|
|
16280
|
+
const run = previous.then(() => refreshLocked2(path), () => refreshLocked2(path));
|
|
16281
|
+
const settled = run.catch(() => {
|
|
16282
|
+
return;
|
|
16283
|
+
});
|
|
16284
|
+
locks.set(path, settled);
|
|
16285
|
+
try {
|
|
16286
|
+
return await run;
|
|
16287
|
+
} finally {
|
|
16288
|
+
if (locks.get(path) === settled)
|
|
16289
|
+
locks.delete(path);
|
|
16290
|
+
}
|
|
16291
|
+
}
|
|
16292
|
+
|
|
15974
16293
|
// ../../bridges/codex-bridge/src/history/rollout.ts
|
|
15975
16294
|
var log3 = createLogger("bridge.codex");
|
|
15976
16295
|
function getCodexHomeDir() {
|
|
@@ -16044,7 +16363,7 @@ async function findTranscriptPath(threadId, transcriptPaths, options) {
|
|
|
16044
16363
|
if (cached) {
|
|
16045
16364
|
if (cached.path !== null) {
|
|
16046
16365
|
try {
|
|
16047
|
-
await
|
|
16366
|
+
await stat5(cached.path);
|
|
16048
16367
|
return cached.path;
|
|
16049
16368
|
} catch {
|
|
16050
16369
|
cachedTranscriptPaths.delete(key);
|
|
@@ -16058,15 +16377,6 @@ async function findTranscriptPath(threadId, transcriptPaths, options) {
|
|
|
16058
16377
|
rememberTranscriptPath(threadId, found);
|
|
16059
16378
|
return found;
|
|
16060
16379
|
}
|
|
16061
|
-
async function readTranscriptLines(path) {
|
|
16062
|
-
try {
|
|
16063
|
-
const raw = await readFile4(path, "utf8");
|
|
16064
|
-
return raw.split(`
|
|
16065
|
-
`).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
16066
|
-
} catch {
|
|
16067
|
-
return [];
|
|
16068
|
-
}
|
|
16069
|
-
}
|
|
16070
16380
|
async function getSessionMetaFromTranscriptPath(transcriptPath, fallbackTitle, fallbackUpdatedAt) {
|
|
16071
16381
|
const { records } = await readTranscriptHead(transcriptPath);
|
|
16072
16382
|
const sessionMetaRecord = records.find((record) => record.type === "session_meta");
|
|
@@ -16345,21 +16655,13 @@ async function listPersistedSessionsForCwd(cwd, options) {
|
|
|
16345
16655
|
return (await listPersistedSessionsWithTitlesForCwd(cwd, options)).sessions;
|
|
16346
16656
|
}
|
|
16347
16657
|
async function listPersistedSessionsWithTitlesForCwd(cwd, options) {
|
|
16348
|
-
const
|
|
16349
|
-
const lines = await readTranscriptLines(indexPath);
|
|
16658
|
+
const index = await readSessionIndex(sessionIndexPath());
|
|
16350
16659
|
const sessions = new Map;
|
|
16351
16660
|
const transcriptCatalog = await buildTranscriptCatalogCached(options?.mustContainThreadId);
|
|
16352
|
-
for (const
|
|
16353
|
-
|
|
16354
|
-
try {
|
|
16355
|
-
entry = JSON.parse(line);
|
|
16356
|
-
} catch {
|
|
16661
|
+
for (const entry of index.entries()) {
|
|
16662
|
+
if (!entry.id)
|
|
16357
16663
|
continue;
|
|
16358
|
-
|
|
16359
|
-
const id = typeof entry.id === "string" ? entry.id : undefined;
|
|
16360
|
-
if (!id)
|
|
16361
|
-
continue;
|
|
16362
|
-
const meta = await getPersistedSessionMeta(id, typeof entry.thread_name === "string" ? entry.thread_name : undefined, typeof entry.updated_at === "string" ? entry.updated_at : undefined, transcriptCatalog);
|
|
16664
|
+
const meta = await getPersistedSessionMeta(entry.id, entry.threadName, entry.updatedAt, transcriptCatalog);
|
|
16363
16665
|
if (!meta || meta.cwd !== cwd) {
|
|
16364
16666
|
continue;
|
|
16365
16667
|
}
|
|
@@ -16503,27 +16805,11 @@ function createPersistedToolParts(payload, cwd, callId) {
|
|
|
16503
16805
|
function persistedOutputState(payloadType, part, output) {
|
|
16504
16806
|
return payloadType === "custom_tool_call_output" ? resolveTranscriptToolOutputState(part.toolName, output, part.toolState ?? null) : null;
|
|
16505
16807
|
}
|
|
16808
|
+
function sessionIndexPath() {
|
|
16809
|
+
return join11(getCodexHomeDir(), "session_index.jsonl");
|
|
16810
|
+
}
|
|
16506
16811
|
async function findSessionIndexEntry(threadId) {
|
|
16507
|
-
|
|
16508
|
-
let match = null;
|
|
16509
|
-
for (const line of lines) {
|
|
16510
|
-
let parsed;
|
|
16511
|
-
try {
|
|
16512
|
-
parsed = JSON.parse(line);
|
|
16513
|
-
} catch {
|
|
16514
|
-
continue;
|
|
16515
|
-
}
|
|
16516
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
16517
|
-
continue;
|
|
16518
|
-
const entry = parsed;
|
|
16519
|
-
if (entry.id !== threadId)
|
|
16520
|
-
continue;
|
|
16521
|
-
match = {
|
|
16522
|
-
threadName: typeof entry.thread_name === "string" ? entry.thread_name : undefined,
|
|
16523
|
-
updatedAt: typeof entry.updated_at === "string" ? entry.updated_at : undefined
|
|
16524
|
-
};
|
|
16525
|
-
}
|
|
16526
|
-
return match;
|
|
16812
|
+
return (await readSessionIndex(sessionIndexPath())).last(threadId) ?? null;
|
|
16527
16813
|
}
|
|
16528
16814
|
async function resolvePersistedSessionMetaForThread(threadId) {
|
|
16529
16815
|
const indexed = await findSessionIndexEntry(threadId);
|
|
@@ -17919,7 +18205,7 @@ function repositoryInstructionsBlock(path, content, truncated) {
|
|
|
17919
18205
|
}
|
|
17920
18206
|
|
|
17921
18207
|
// ../protocol/src/node/repository-instructions.ts
|
|
17922
|
-
import { open as
|
|
18208
|
+
import { open as open5, realpath } from "node:fs/promises";
|
|
17923
18209
|
import { join as join12, relative as relative2, isAbsolute as isAbsolute7 } from "node:path";
|
|
17924
18210
|
var MAX_REPOSITORY_INSTRUCTIONS_BYTES = 256 * 1024;
|
|
17925
18211
|
async function readRepositoryInstructions(cwd, maxBytes = MAX_REPOSITORY_INSTRUCTIONS_BYTES) {
|
|
@@ -17929,7 +18215,7 @@ async function readRepositoryInstructions(cwd, maxBytes = MAX_REPOSITORY_INSTRUC
|
|
|
17929
18215
|
const inside = relative2(root, target);
|
|
17930
18216
|
if (!inside || inside.startsWith("..") || isAbsolute7(inside))
|
|
17931
18217
|
return;
|
|
17932
|
-
const handle = await
|
|
18218
|
+
const handle = await open5(target, "r");
|
|
17933
18219
|
try {
|
|
17934
18220
|
const buffer = Buffer.alloc(maxBytes + 1);
|
|
17935
18221
|
const { bytesRead } = await handle.read(buffer, 0, maxBytes + 1, 0);
|
|
@@ -17987,9 +18273,9 @@ var ORKESTRATOR_ARTIFACT_MCP_SERVER_NAME = "orkestrator-artifacts";
|
|
|
17987
18273
|
var ORKESTRATOR_ARTIFACT_MCP_PATH = "/artifact-mcp";
|
|
17988
18274
|
|
|
17989
18275
|
// ../../bridges/codex-bridge/src/engine/app-server-engine.ts
|
|
17990
|
-
import { open as
|
|
18276
|
+
import { open as open9 } from "node:fs/promises";
|
|
17991
18277
|
import { createHash as createHash11 } from "node:crypto";
|
|
17992
|
-
import { isAbsolute as isAbsolute9, join as
|
|
18278
|
+
import { isAbsolute as isAbsolute9, join as join20 } from "node:path";
|
|
17993
18279
|
|
|
17994
18280
|
// ../../bridges/codex-bridge/src/app-server/process-supervisor.ts
|
|
17995
18281
|
import { execFile as execFile3, spawn as spawn2 } from "node:child_process";
|
|
@@ -17997,12 +18283,12 @@ import { randomUUID as randomUUID6 } from "node:crypto";
|
|
|
17997
18283
|
import {
|
|
17998
18284
|
link,
|
|
17999
18285
|
mkdir as mkdir6,
|
|
18000
|
-
open as
|
|
18286
|
+
open as open6,
|
|
18001
18287
|
readFile as readFile5,
|
|
18002
18288
|
readlink,
|
|
18003
18289
|
rename as rename4,
|
|
18004
18290
|
rm as rm5,
|
|
18005
|
-
stat as
|
|
18291
|
+
stat as stat6
|
|
18006
18292
|
} from "node:fs/promises";
|
|
18007
18293
|
import { join as join14 } from "node:path";
|
|
18008
18294
|
|
|
@@ -19423,7 +19709,7 @@ class AppServerSupervisor {
|
|
|
19423
19709
|
instanceId
|
|
19424
19710
|
}), "utf8");
|
|
19425
19711
|
const temporary = `${path}.${this.pidOwnerToken}.update`;
|
|
19426
|
-
const handle = await
|
|
19712
|
+
const handle = await open6(temporary, "wx", 384);
|
|
19427
19713
|
try {
|
|
19428
19714
|
await handle.write(payload, 0, payload.length, 0);
|
|
19429
19715
|
await handle.sync();
|
|
@@ -19447,7 +19733,7 @@ class AppServerSupervisor {
|
|
|
19447
19733
|
await mkdir6(this.pidFileDir(), { recursive: true });
|
|
19448
19734
|
for (let attempt = 0;attempt < PID_ACQUISITION_MAX_ATTEMPTS; attempt += 1) {
|
|
19449
19735
|
try {
|
|
19450
|
-
const handle = await
|
|
19736
|
+
const handle = await open6(this.pidFilePath(), "wx", 384);
|
|
19451
19737
|
try {
|
|
19452
19738
|
const record = {
|
|
19453
19739
|
ownerToken: this.pidOwnerToken,
|
|
@@ -19499,7 +19785,7 @@ class AppServerSupervisor {
|
|
|
19499
19785
|
return false;
|
|
19500
19786
|
} else {
|
|
19501
19787
|
try {
|
|
19502
|
-
const metadata = await
|
|
19788
|
+
const metadata = await stat6(path);
|
|
19503
19789
|
if (Date.now() - metadata.mtimeMs < INCOMPLETE_PIDFILE_GRACE_MS)
|
|
19504
19790
|
return false;
|
|
19505
19791
|
} catch {
|
|
@@ -19624,7 +19910,7 @@ class AppServerSupervisor {
|
|
|
19624
19910
|
}
|
|
19625
19911
|
let moved = null;
|
|
19626
19912
|
try {
|
|
19627
|
-
moved = await
|
|
19913
|
+
moved = await stat6(quarantinePath, { bigint: true });
|
|
19628
19914
|
} catch {
|
|
19629
19915
|
moved = null;
|
|
19630
19916
|
}
|
|
@@ -21241,7 +21527,7 @@ function reduceHistoricalTurns(turns, generation, threadId, handle) {
|
|
|
21241
21527
|
|
|
21242
21528
|
// ../../bridges/codex-bridge/src/sessions/dispatch-journal.ts
|
|
21243
21529
|
import { createHash as createHash10 } from "node:crypto";
|
|
21244
|
-
import { mkdir as mkdir8, open as
|
|
21530
|
+
import { mkdir as mkdir8, open as open7, rename as rename6, rm as rm7, writeFile as writeFile5 } from "node:fs/promises";
|
|
21245
21531
|
import { join as join16 } from "node:path";
|
|
21246
21532
|
|
|
21247
21533
|
// ../../bridges/codex-bridge/src/sessions/persistence.ts
|
|
@@ -21254,7 +21540,7 @@ import {
|
|
|
21254
21540
|
readdir as readdir2,
|
|
21255
21541
|
rename as rename5,
|
|
21256
21542
|
rm as rm6,
|
|
21257
|
-
stat as
|
|
21543
|
+
stat as stat7,
|
|
21258
21544
|
writeFile as writeFile4
|
|
21259
21545
|
} from "node:fs/promises";
|
|
21260
21546
|
import { join as join15 } from "node:path";
|
|
@@ -21343,6 +21629,7 @@ function hashCwd(cwd) {
|
|
|
21343
21629
|
return createHash9("sha256").update(cwd).digest("hex").slice(0, 16);
|
|
21344
21630
|
}
|
|
21345
21631
|
var DEFAULT_RETENTION_MS = 7 * 24 * 60 * 60 * 1000;
|
|
21632
|
+
var RECORD_FILE_MISSING = Symbol("record-file-missing");
|
|
21346
21633
|
var TEMP_FILE_GRACE_MS = 60 * 60 * 1000;
|
|
21347
21634
|
var PRIVATE_DIRECTORY_MODE = 448;
|
|
21348
21635
|
var PRIVATE_FILE_MODE = 384;
|
|
@@ -21433,9 +21720,40 @@ class BridgeSessionStore {
|
|
|
21433
21720
|
const loaded = records.filter((record) => record !== null);
|
|
21434
21721
|
return migrationFailed && loaded.length === 0 ? legacy : loaded;
|
|
21435
21722
|
}
|
|
21723
|
+
async loadRecord(bridgeSessionId) {
|
|
21724
|
+
const cutoff = this.now() - this.retentionMs;
|
|
21725
|
+
const key = `${this.recordKey(bridgeSessionId)}.json`;
|
|
21726
|
+
const record = await this.readRecordFile(join15(this.recordsDir(), key), bridgeSessionId, cutoff);
|
|
21727
|
+
if (record !== RECORD_FILE_MISSING)
|
|
21728
|
+
return record;
|
|
21729
|
+
const legacy = (await this.readLegacy(cutoff)).find((session) => session.bridgeSessionId === bridgeSessionId);
|
|
21730
|
+
if (legacy)
|
|
21731
|
+
return legacy;
|
|
21732
|
+
const loginRecords = this.loginRecordsDir();
|
|
21733
|
+
if (!loginRecords)
|
|
21734
|
+
return null;
|
|
21735
|
+
const adoptable = await this.readRecordFile(join15(loginRecords, key), bridgeSessionId, cutoff);
|
|
21736
|
+
return adoptable === RECORD_FILE_MISSING ? null : adoptable;
|
|
21737
|
+
}
|
|
21738
|
+
async readRecordFile(path, bridgeSessionId, cutoff) {
|
|
21739
|
+
let raw;
|
|
21740
|
+
try {
|
|
21741
|
+
raw = await readFile6(path, "utf8");
|
|
21742
|
+
} catch (error) {
|
|
21743
|
+
return error.code === "ENOENT" ? RECORD_FILE_MISSING : null;
|
|
21744
|
+
}
|
|
21745
|
+
try {
|
|
21746
|
+
const value = JSON.parse(raw);
|
|
21747
|
+
if (isPersistedSessionTombstone(value))
|
|
21748
|
+
return null;
|
|
21749
|
+
return isPersistedBridgeSession(value, this.cwdHash, cutoff) && value.bridgeSessionId === bridgeSessionId ? value : null;
|
|
21750
|
+
} catch {
|
|
21751
|
+
return null;
|
|
21752
|
+
}
|
|
21753
|
+
}
|
|
21436
21754
|
async collectStaleTemporary(path) {
|
|
21437
21755
|
try {
|
|
21438
|
-
const info = await
|
|
21756
|
+
const info = await stat7(path);
|
|
21439
21757
|
if (this.now() - info.mtimeMs < TEMP_FILE_GRACE_MS)
|
|
21440
21758
|
return;
|
|
21441
21759
|
await rm6(path, { force: true });
|
|
@@ -21471,6 +21789,13 @@ class BridgeSessionStore {
|
|
|
21471
21789
|
try {
|
|
21472
21790
|
await chmod(this.dir(), PRIVATE_DIRECTORY_MODE);
|
|
21473
21791
|
await chmod(this.path(), PRIVATE_FILE_MODE);
|
|
21792
|
+
} catch {
|
|
21793
|
+
return [];
|
|
21794
|
+
}
|
|
21795
|
+
return this.readLegacy(cutoff);
|
|
21796
|
+
}
|
|
21797
|
+
async readLegacy(cutoff) {
|
|
21798
|
+
try {
|
|
21474
21799
|
const parsed = JSON.parse(await readFile6(this.path(), "utf8"));
|
|
21475
21800
|
if (parsed.version !== BRIDGE_SESSION_REGISTRY_VERSION)
|
|
21476
21801
|
return [];
|
|
@@ -21763,7 +22088,7 @@ class DispatchJournal {
|
|
|
21763
22088
|
return true;
|
|
21764
22089
|
}
|
|
21765
22090
|
async readBounded(path) {
|
|
21766
|
-
const handle = await
|
|
22091
|
+
const handle = await open7(path, "r");
|
|
21767
22092
|
try {
|
|
21768
22093
|
const metadata = await handle.stat();
|
|
21769
22094
|
if (!metadata.isFile() || metadata.size > this.maxBytes) {
|
|
@@ -22238,8 +22563,80 @@ function coordinatorCapabilityPolicy(mode) {
|
|
|
22238
22563
|
|
|
22239
22564
|
// ../../bridges/codex-bridge/src/codex-config.ts
|
|
22240
22565
|
import { existsSync as existsSync3, readdirSync as readdirSync3, realpathSync, statSync as statSync2 } from "node:fs";
|
|
22566
|
+
import { homedir as homedir3 } from "node:os";
|
|
22567
|
+
import { isAbsolute as isAbsolute8, join as join18, relative as relative3, sep } from "node:path";
|
|
22568
|
+
|
|
22569
|
+
// ../../bridges/codex-bridge/src/shell-exclusions.ts
|
|
22570
|
+
import { closeSync, openSync, readSync, fstatSync } from "node:fs";
|
|
22241
22571
|
import { homedir as homedir2 } from "node:os";
|
|
22242
|
-
import {
|
|
22572
|
+
import { dirname as dirname3, join as join17, resolve as resolve3 } from "node:path";
|
|
22573
|
+
function configuredShellExclusions(env) {
|
|
22574
|
+
const paths = new Set([
|
|
22575
|
+
"/etc/codex/config.toml",
|
|
22576
|
+
join17(env.CODEX_HOME || join17(env.HOME || homedir2(), ".codex"), "config.toml")
|
|
22577
|
+
]);
|
|
22578
|
+
{
|
|
22579
|
+
let directory = resolve3(env.CWD || process.cwd());
|
|
22580
|
+
for (;; ) {
|
|
22581
|
+
paths.add(join17(directory, ".codex", "config.toml"));
|
|
22582
|
+
const parent = dirname3(directory);
|
|
22583
|
+
if (parent === directory)
|
|
22584
|
+
break;
|
|
22585
|
+
directory = parent;
|
|
22586
|
+
}
|
|
22587
|
+
}
|
|
22588
|
+
const exclusions = new Set;
|
|
22589
|
+
for (const path of paths) {
|
|
22590
|
+
let fd;
|
|
22591
|
+
try {
|
|
22592
|
+
fd = openSync(path, "r");
|
|
22593
|
+
} catch (error) {
|
|
22594
|
+
if (error.code === "ENOENT")
|
|
22595
|
+
continue;
|
|
22596
|
+
throw new Error("Cannot read Codex shell exclusions");
|
|
22597
|
+
}
|
|
22598
|
+
try {
|
|
22599
|
+
const stat = fstatSync(fd);
|
|
22600
|
+
if (!stat.isFile() || stat.size > 1024 * 1024) {
|
|
22601
|
+
throw new Error("Invalid Codex configuration file");
|
|
22602
|
+
}
|
|
22603
|
+
const buffer = Buffer.alloc(1024 * 1024 + 1);
|
|
22604
|
+
let length = 0;
|
|
22605
|
+
while (length < buffer.length) {
|
|
22606
|
+
const count = readSync(fd, buffer, length, buffer.length - length, null);
|
|
22607
|
+
if (count === 0)
|
|
22608
|
+
break;
|
|
22609
|
+
length += count;
|
|
22610
|
+
}
|
|
22611
|
+
if (length > 1024 * 1024)
|
|
22612
|
+
throw new Error("Codex configuration too large");
|
|
22613
|
+
const config = Bun.TOML.parse(buffer.subarray(0, length).toString("utf8"));
|
|
22614
|
+
collect(config, exclusions);
|
|
22615
|
+
} catch {
|
|
22616
|
+
throw new Error("Cannot load Codex shell exclusions");
|
|
22617
|
+
} finally {
|
|
22618
|
+
closeSync(fd);
|
|
22619
|
+
}
|
|
22620
|
+
}
|
|
22621
|
+
return [...exclusions];
|
|
22622
|
+
}
|
|
22623
|
+
function collect(config, exclusions) {
|
|
22624
|
+
if (!config || typeof config !== "object" || Array.isArray(config))
|
|
22625
|
+
return;
|
|
22626
|
+
const table = config;
|
|
22627
|
+
const policy = table.shell_environment_policy;
|
|
22628
|
+
if (policy && Object.hasOwn(policy, "exclude")) {
|
|
22629
|
+
if (!Array.isArray(policy.exclude) || policy.exclude.some((item) => typeof item !== "string")) {
|
|
22630
|
+
throw new Error("Invalid Codex shell exclusions");
|
|
22631
|
+
}
|
|
22632
|
+
for (const pattern of policy.exclude)
|
|
22633
|
+
exclusions.add(pattern);
|
|
22634
|
+
}
|
|
22635
|
+
if (table.profiles && typeof table.profiles === "object") {
|
|
22636
|
+
for (const profile of Object.values(table.profiles))
|
|
22637
|
+
collect(profile, exclusions);
|
|
22638
|
+
}
|
|
22639
|
+
}
|
|
22243
22640
|
|
|
22244
22641
|
// ../../bridges/codex-bridge/src/engine/mcp-tool-availability.ts
|
|
22245
22642
|
var ORKESTRATOR_MCP_STARTUP_TIMEOUT_SEC = 15;
|
|
@@ -22351,7 +22748,7 @@ function codexCoordinatorSkillExtraRoots(env = process.env, cwd = env.CWD?.trim(
|
|
|
22351
22748
|
const userDir = env[COORDINATOR_CODEX_USER_SKILLS_DIR_ENV]?.trim();
|
|
22352
22749
|
return [
|
|
22353
22750
|
...userDir && isAbsolute8(userDir) ? [userDir] : [],
|
|
22354
|
-
...cwd && isAbsolute8(cwd) ? [
|
|
22751
|
+
...cwd && isAbsolute8(cwd) ? [join18(cwd, ".claude", "skills")] : []
|
|
22355
22752
|
].filter((dir) => existsSync3(dir));
|
|
22356
22753
|
}
|
|
22357
22754
|
var MAX_SKILL_READ_GRANTS = 256;
|
|
@@ -22359,11 +22756,11 @@ function isWithin(parent, child) {
|
|
|
22359
22756
|
const path = relative3(parent, child);
|
|
22360
22757
|
return path === "" || !path.startsWith(`..${sep}`) && path !== ".." && !isAbsolute8(path);
|
|
22361
22758
|
}
|
|
22362
|
-
function codexCoordinatorSkillReadRoots(env = process.env, home = env.HOME?.trim() ||
|
|
22759
|
+
function codexCoordinatorSkillReadRoots(env = process.env, home = env.HOME?.trim() || homedir3()) {
|
|
22363
22760
|
const userDir = env[COORDINATOR_CODEX_USER_SKILLS_DIR_ENV]?.trim();
|
|
22364
22761
|
const roots = [
|
|
22365
22762
|
...userDir && isAbsolute8(userDir) ? [userDir] : [],
|
|
22366
|
-
|
|
22763
|
+
join18(home, ".agents", "skills")
|
|
22367
22764
|
];
|
|
22368
22765
|
const homeReal = (() => {
|
|
22369
22766
|
try {
|
|
@@ -22397,8 +22794,8 @@ function codexCoordinatorSkillReadRoots(env = process.env, home = env.HOME?.trim
|
|
|
22397
22794
|
break;
|
|
22398
22795
|
let target;
|
|
22399
22796
|
try {
|
|
22400
|
-
target = realpathSync(
|
|
22401
|
-
if (!statSync2(target).isDirectory() || !existsSync3(
|
|
22797
|
+
target = realpathSync(join18(real, entry));
|
|
22798
|
+
if (!statSync2(target).isDirectory() || !existsSync3(join18(target, "SKILL.md")))
|
|
22402
22799
|
continue;
|
|
22403
22800
|
} catch {
|
|
22404
22801
|
continue;
|
|
@@ -22537,13 +22934,35 @@ function resolveCodexMaxConcurrentThreads(value) {
|
|
|
22537
22934
|
const parsed = Number(value);
|
|
22538
22935
|
return Number.isSafeInteger(parsed) && parsed >= 1 && parsed <= MAX_CODEX_CONCURRENT_THREADS ? parsed : DEFAULT_CODEX_MAX_CONCURRENT_THREADS;
|
|
22539
22936
|
}
|
|
22937
|
+
var CODEX_SESSION_SHELL_EXCLUDE = Object.freeze([
|
|
22938
|
+
"CODEX_BRIDGE_TOKEN",
|
|
22939
|
+
"*_BRIDGE_TOKEN",
|
|
22940
|
+
ORKESTRATOR_AGENT_MCP_TOKEN_ENV,
|
|
22941
|
+
ORKESTRATOR_AGENT_MCP_URL_ENV,
|
|
22942
|
+
"CODEX_API_KEY"
|
|
22943
|
+
]);
|
|
22944
|
+
var CODEX_COORDINATOR_SHELL_EXCLUDE = Object.freeze([
|
|
22945
|
+
...new Set([
|
|
22946
|
+
"*_KEY",
|
|
22947
|
+
"*_SECRET",
|
|
22948
|
+
"*_TOKEN",
|
|
22949
|
+
"CODEX_HOME",
|
|
22950
|
+
...CODEX_SESSION_SHELL_EXCLUDE,
|
|
22951
|
+
"CODEX_BRIDGE_PERMISSION_PROFILE",
|
|
22952
|
+
"CODEX_BRIDGE_READABLE_RUNTIME_ROOT"
|
|
22953
|
+
])
|
|
22954
|
+
]);
|
|
22540
22955
|
function codexAppServerConfigOverrides(env = process.env) {
|
|
22956
|
+
const userExclusions = configuredShellExclusions(env);
|
|
22541
22957
|
const childLimit = resolveCodexMaxConcurrentThreads(env[CODEX_MAX_CONCURRENT_THREADS_ENV]);
|
|
22542
22958
|
const overrides = {
|
|
22543
22959
|
"agents.max_concurrent_threads_per_session": String(childLimit),
|
|
22544
22960
|
"features.multi_agent_v2.max_concurrent_threads_per_session": String(childLimit + 1),
|
|
22545
22961
|
"features.incremental_tools": "false",
|
|
22546
|
-
"features.goals": "false"
|
|
22962
|
+
"features.goals": "false",
|
|
22963
|
+
"shell_environment_policy.exclude": JSON.stringify([
|
|
22964
|
+
...new Set([...userExclusions, ...CODEX_SESSION_SHELL_EXCLUDE])
|
|
22965
|
+
])
|
|
22547
22966
|
};
|
|
22548
22967
|
const rawUrl = env[ORKESTRATOR_AGENT_MCP_URL_ENV]?.trim();
|
|
22549
22968
|
const token = env[ORKESTRATOR_AGENT_MCP_TOKEN_ENV]?.trim();
|
|
@@ -22591,15 +23010,7 @@ function codexAppServerConfigOverrides(env = process.env) {
|
|
|
22591
23010
|
overrides["shell_environment_policy.inherit"] = JSON.stringify("core");
|
|
22592
23011
|
overrides["shell_environment_policy.ignore_default_excludes"] = "false";
|
|
22593
23012
|
overrides["shell_environment_policy.exclude"] = JSON.stringify([
|
|
22594
|
-
|
|
22595
|
-
"*_SECRET",
|
|
22596
|
-
"*_TOKEN",
|
|
22597
|
-
"CODEX_HOME",
|
|
22598
|
-
"CODEX_BRIDGE_TOKEN",
|
|
22599
|
-
"CODEX_BRIDGE_PERMISSION_PROFILE",
|
|
22600
|
-
"CODEX_BRIDGE_READABLE_RUNTIME_ROOT",
|
|
22601
|
-
ORKESTRATOR_AGENT_MCP_TOKEN_ENV,
|
|
22602
|
-
ORKESTRATOR_AGENT_MCP_URL_ENV
|
|
23013
|
+
...new Set([...userExclusions, ...CODEX_COORDINATOR_SHELL_EXCLUDE])
|
|
22603
23014
|
]);
|
|
22604
23015
|
}
|
|
22605
23016
|
if (rawUrl && token) {
|
|
@@ -22631,7 +23042,7 @@ function codexAppServerConfigOverrides(env = process.env) {
|
|
|
22631
23042
|
// ../../bridges/codex-bridge/src/github-credential-config.ts
|
|
22632
23043
|
import { mkdtemp as mkdtemp2 } from "node:fs/promises";
|
|
22633
23044
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
22634
|
-
import { join as
|
|
23045
|
+
import { join as join19 } from "node:path";
|
|
22635
23046
|
var CODEX_INHERITED_GIT_CONFIG_PATTERNS = Object.freeze([
|
|
22636
23047
|
"GIT_CONFIG_COUNT",
|
|
22637
23048
|
"GIT_CONFIG_KEY_*",
|
|
@@ -22666,7 +23077,7 @@ function codexGitHubCredentialThreadConfig(policy, options) {
|
|
|
22666
23077
|
}
|
|
22667
23078
|
var withheldGhConfigDir;
|
|
22668
23079
|
function emptyGhConfigDir() {
|
|
22669
|
-
withheldGhConfigDir ??= mkdtemp2(
|
|
23080
|
+
withheldGhConfigDir ??= mkdtemp2(join19(tmpdir2(), "orkestrator-gh-withheld-")).catch((error) => {
|
|
22670
23081
|
withheldGhConfigDir = undefined;
|
|
22671
23082
|
throw error;
|
|
22672
23083
|
});
|
|
@@ -22674,11 +23085,11 @@ function emptyGhConfigDir() {
|
|
|
22674
23085
|
}
|
|
22675
23086
|
|
|
22676
23087
|
// ../../bridges/codex-bridge/src/sessions/tool-history-guard.ts
|
|
22677
|
-
import { open as
|
|
23088
|
+
import { open as open8 } from "node:fs/promises";
|
|
22678
23089
|
var TOOL_HISTORY_MARKER = '"type":"additional_tools"';
|
|
22679
23090
|
var MAX_TOOL_HISTORY_LINEAGE_DEPTH = 32;
|
|
22680
23091
|
async function rolloutDeclaresToolHistory(path, end) {
|
|
22681
|
-
const handle = await
|
|
23092
|
+
const handle = await open8(path, "r");
|
|
22682
23093
|
try {
|
|
22683
23094
|
const size = (await handle.stat()).size;
|
|
22684
23095
|
const limit = end === undefined ? size : Math.min(end, size);
|
|
@@ -22703,7 +23114,7 @@ async function rolloutDeclaresToolHistory(path, end) {
|
|
|
22703
23114
|
}
|
|
22704
23115
|
}
|
|
22705
23116
|
async function historyBase(path) {
|
|
22706
|
-
const handle = await
|
|
23117
|
+
const handle = await open8(path, "r");
|
|
22707
23118
|
try {
|
|
22708
23119
|
const chunks = [];
|
|
22709
23120
|
let filled = 0;
|
|
@@ -23143,7 +23554,7 @@ function signedOutAccountRead(error) {
|
|
|
23143
23554
|
}
|
|
23144
23555
|
async function readStoredLoginFingerprint(codexHome) {
|
|
23145
23556
|
try {
|
|
23146
|
-
const file = await
|
|
23557
|
+
const file = await open9(join20(codexHome, "auth.json"), "r");
|
|
23147
23558
|
let raw;
|
|
23148
23559
|
try {
|
|
23149
23560
|
const bytes = Buffer.alloc(65537);
|
|
@@ -25914,7 +26325,7 @@ class CodexRuntimeSessions {
|
|
|
25914
26325
|
if (!session.threadId)
|
|
25915
26326
|
return true;
|
|
25916
26327
|
try {
|
|
25917
|
-
const persisted =
|
|
26328
|
+
const persisted = await this.ctx.store.loadRecord(session.id);
|
|
25918
26329
|
if (!persisted)
|
|
25919
26330
|
return false;
|
|
25920
26331
|
const { agentMcp: _agentMcp, ...persistableConfig } = session.config;
|
|
@@ -26165,8 +26576,8 @@ function parseCommandToken(text, sigils = ["/"]) {
|
|
|
26165
26576
|
|
|
26166
26577
|
// ../../bridges/codex-bridge/src/prompts/template-discovery.ts
|
|
26167
26578
|
import { createHash as createHash13 } from "node:crypto";
|
|
26168
|
-
import { open as
|
|
26169
|
-
import { join as
|
|
26579
|
+
import { open as open10, readdir as readdir3, stat as stat8 } from "node:fs/promises";
|
|
26580
|
+
import { join as join21 } from "node:path";
|
|
26170
26581
|
var TEMPLATE_LIMITS = Object.freeze({
|
|
26171
26582
|
maxTemplates: 512,
|
|
26172
26583
|
maxVisitedEntries: 2048,
|
|
@@ -26186,8 +26597,8 @@ var RESERVED_TEMPLATE_PREFIXES = ["/skill:", "/prompts:"];
|
|
|
26186
26597
|
var TEMPLATE_ID_PREFIX = "codex-template:";
|
|
26187
26598
|
function templateRoots(cwd, codexHome = getCodexHomeDir()) {
|
|
26188
26599
|
return [
|
|
26189
|
-
{ origin: "project", dir:
|
|
26190
|
-
{ origin: "user", dir:
|
|
26600
|
+
{ origin: "project", dir: join21(cwd, ".codex", "prompts") },
|
|
26601
|
+
{ origin: "user", dir: join21(codexHome, "prompts") }
|
|
26191
26602
|
];
|
|
26192
26603
|
}
|
|
26193
26604
|
function templateCommandId(origin, relativePath) {
|
|
@@ -26212,7 +26623,7 @@ function isReservedName(name) {
|
|
|
26212
26623
|
var metadataCache = new Map;
|
|
26213
26624
|
var METADATA_CACHE_MAX = 1024;
|
|
26214
26625
|
async function readBounded2(absolutePath, maxBytes) {
|
|
26215
|
-
const handle = await
|
|
26626
|
+
const handle = await open10(absolutePath, "r");
|
|
26216
26627
|
try {
|
|
26217
26628
|
const info = await handle.stat();
|
|
26218
26629
|
if (!info.isFile())
|
|
@@ -26292,7 +26703,7 @@ async function scanPromptTemplates(roots, limits = TEMPLATE_LIMITS) {
|
|
|
26292
26703
|
return;
|
|
26293
26704
|
}
|
|
26294
26705
|
visited += 1;
|
|
26295
|
-
const absolutePath =
|
|
26706
|
+
const absolutePath = join21(dir, entry.name);
|
|
26296
26707
|
const relativePath = relative ? `${relative}/${entry.name}` : entry.name;
|
|
26297
26708
|
if (entry.isDirectory()) {
|
|
26298
26709
|
if (depth + 1 > limits.maxDepth) {
|
|
@@ -26309,7 +26720,7 @@ async function scanPromptTemplates(roots, limits = TEMPLATE_LIMITS) {
|
|
|
26309
26720
|
continue;
|
|
26310
26721
|
let info;
|
|
26311
26722
|
try {
|
|
26312
|
-
info = await
|
|
26723
|
+
info = await stat8(absolutePath);
|
|
26313
26724
|
} catch {
|
|
26314
26725
|
skipped += 1;
|
|
26315
26726
|
continue;
|
|
@@ -26596,6 +27007,11 @@ function skillCommandRow(binding, projectResources = true) {
|
|
|
26596
27007
|
...unavailable ? { availability: { state: "unavailable", ...unavailable } } : {}
|
|
26597
27008
|
};
|
|
26598
27009
|
}
|
|
27010
|
+
function realSettleTimer(fire, delayMs) {
|
|
27011
|
+
const timer = setTimeout(fire, delayMs);
|
|
27012
|
+
timer.unref?.();
|
|
27013
|
+
return () => clearTimeout(timer);
|
|
27014
|
+
}
|
|
26599
27015
|
|
|
26600
27016
|
class SkillInventory {
|
|
26601
27017
|
deps;
|
|
@@ -26607,7 +27023,7 @@ class SkillInventory {
|
|
|
26607
27023
|
settledGeneration = null;
|
|
26608
27024
|
settling = null;
|
|
26609
27025
|
answeredGeneration = null;
|
|
26610
|
-
|
|
27026
|
+
cancelSettle = null;
|
|
26611
27027
|
disposed = false;
|
|
26612
27028
|
stats = { invalidations: 0, reads: 0, scheduledRefreshes: 0, settlingReads: 0 };
|
|
26613
27029
|
constructor(deps) {
|
|
@@ -26725,10 +27141,10 @@ class SkillInventory {
|
|
|
26725
27141
|
armSettle(snapshot, round) {
|
|
26726
27142
|
const { generation } = snapshot;
|
|
26727
27143
|
const baseline = snapshotSignature(snapshot);
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
this.
|
|
26731
|
-
this.
|
|
27144
|
+
this.cancelSettle?.();
|
|
27145
|
+
const setSettleTimer = this.deps.setSettleTimer ?? realSettleTimer;
|
|
27146
|
+
this.cancelSettle = setSettleTimer(() => {
|
|
27147
|
+
this.cancelSettle = null;
|
|
26732
27148
|
if (this.disposed || this.deps.generation() !== generation)
|
|
26733
27149
|
return;
|
|
26734
27150
|
this.invalidationSerial += 1;
|
|
@@ -26753,16 +27169,14 @@ class SkillInventory {
|
|
|
26753
27169
|
return;
|
|
26754
27170
|
});
|
|
26755
27171
|
}, this.coldSettleMs());
|
|
26756
|
-
this.settleTimer.unref?.();
|
|
26757
27172
|
}
|
|
26758
27173
|
dispose() {
|
|
26759
27174
|
this.disposed = true;
|
|
26760
27175
|
if (this.refreshTimer)
|
|
26761
27176
|
clearTimeout(this.refreshTimer);
|
|
26762
27177
|
this.refreshTimer = null;
|
|
26763
|
-
|
|
26764
|
-
|
|
26765
|
-
this.settleTimer = null;
|
|
27178
|
+
this.cancelSettle?.();
|
|
27179
|
+
this.cancelSettle = null;
|
|
26766
27180
|
this.settling = null;
|
|
26767
27181
|
}
|
|
26768
27182
|
}
|
|
@@ -26852,6 +27266,7 @@ class CodexCommandCatalogue {
|
|
|
26852
27266
|
...options.skillTtlMs !== undefined ? { ttlMs: options.skillTtlMs } : {},
|
|
26853
27267
|
...options.skillRefreshDebounceMs !== undefined ? { refreshDebounceMs: options.skillRefreshDebounceMs } : {},
|
|
26854
27268
|
...options.skillColdSettleMs !== undefined ? { coldSettleMs: options.skillColdSettleMs } : {},
|
|
27269
|
+
...options.skillSettleTimer ? { setSettleTimer: options.skillSettleTimer } : {},
|
|
26855
27270
|
onRefreshed: (read) => {
|
|
26856
27271
|
this.skillsDigest = commandBindingRevision([
|
|
26857
27272
|
String(read.fresh),
|
|
@@ -27445,7 +27860,7 @@ class UpdateCoalescer {
|
|
|
27445
27860
|
}
|
|
27446
27861
|
|
|
27447
27862
|
// ../../bridges/codex-bridge/src/app-server-runtime-capacity-retry.ts
|
|
27448
|
-
import { stat as
|
|
27863
|
+
import { stat as stat9 } from "node:fs/promises";
|
|
27449
27864
|
var log15 = createLogger("bridge.codex");
|
|
27450
27865
|
|
|
27451
27866
|
class CodexCapacityRetry {
|
|
@@ -27587,7 +28002,7 @@ class CodexCapacityRetry {
|
|
|
27587
28002
|
await this.ctx.journal.markContinuation(requestId, clientId);
|
|
27588
28003
|
plan.attempt = entry.attempt;
|
|
27589
28004
|
const path = engine.rolloutPath(context.threadId);
|
|
27590
|
-
const offset = path ? await
|
|
28005
|
+
const offset = path ? await stat9(path).then((stats) => stats.size, () => {
|
|
27591
28006
|
return;
|
|
27592
28007
|
}) : undefined;
|
|
27593
28008
|
this.lifecycle.stateFor(context.threadId).refusedCellOffset = offset;
|
|
@@ -29303,7 +29718,7 @@ function requiredCoordinatorPermissionProfile() {
|
|
|
29303
29718
|
}
|
|
29304
29719
|
|
|
29305
29720
|
// ../../bridges/codex-bridge/src/app-server-runtime-prompt.ts
|
|
29306
|
-
import { stat as
|
|
29721
|
+
import { stat as stat10 } from "node:fs/promises";
|
|
29307
29722
|
// ../protocol/src/tab-initial-prompt.ts
|
|
29308
29723
|
var TAB_INITIAL_PROMPT_REQUEST_PREFIX = "initial-prompt:";
|
|
29309
29724
|
function isTabInitialPromptRequestId(requestId) {
|
|
@@ -29678,7 +30093,7 @@ class CodexRuntimePrompt {
|
|
|
29678
30093
|
let refusedCellOffset;
|
|
29679
30094
|
const startTurn = async () => {
|
|
29680
30095
|
const path = this.ctx.options.engine.rolloutPath(context.threadId);
|
|
29681
|
-
refusedCellOffset = path ? await
|
|
30096
|
+
refusedCellOffset = path ? await stat10(path).then((stats) => stats.size, (error) => error.code === "ENOENT" ? 0 : undefined) : undefined;
|
|
29682
30097
|
return this.ctx.options.engine.startTurn({
|
|
29683
30098
|
handle: context.engineHandle,
|
|
29684
30099
|
input: engineInput,
|
|
@@ -30280,7 +30695,7 @@ class CodexRuntimePrompt {
|
|
|
30280
30695
|
}
|
|
30281
30696
|
|
|
30282
30697
|
// ../../bridges/codex-bridge/src/app-server-runtime-tail.ts
|
|
30283
|
-
import { join as
|
|
30698
|
+
import { join as join22, relative as relative4, isAbsolute as isAbsolute11 } from "node:path";
|
|
30284
30699
|
var log18 = createLogger("bridge.codex");
|
|
30285
30700
|
|
|
30286
30701
|
class CodexRuntimeTail {
|
|
@@ -30480,7 +30895,7 @@ class CodexRuntimeTail {
|
|
|
30480
30895
|
cursor = page.nextCursor ?? undefined;
|
|
30481
30896
|
} while (cursor);
|
|
30482
30897
|
} catch {}
|
|
30483
|
-
const archivedRoot =
|
|
30898
|
+
const archivedRoot = join22(this.ctx.options.codexHome, "archived_sessions");
|
|
30484
30899
|
const isArchived = (meta) => {
|
|
30485
30900
|
if (archived.has(meta.id))
|
|
30486
30901
|
return true;
|
|
@@ -31377,6 +31792,7 @@ function boundCodexTranscriptResponse(messages, tailMessages) {
|
|
|
31377
31792
|
var BRIDGE_TOKEN_ENV = "CODEX_BRIDGE_TOKEN";
|
|
31378
31793
|
var BRIDGE_ALLOWED_ORIGINS_ENV = "CODEX_BRIDGE_ALLOWED_ORIGINS";
|
|
31379
31794
|
var bridgeAuthToken = process.env[BRIDGE_TOKEN_ENV]?.trim() || randomBytes(32).toString("base64url");
|
|
31795
|
+
delete process.env[BRIDGE_TOKEN_ENV];
|
|
31380
31796
|
var bridgeAuthEnabledOverrideForTesting = null;
|
|
31381
31797
|
var sseRouteTestHooks = null;
|
|
31382
31798
|
var BRIDGE_VERSION = "1.0.0";
|
|
@@ -31519,7 +31935,7 @@ async function writeCodexRawLog(sessionId, entry, logDir = codexRawLogDir) {
|
|
|
31519
31935
|
try {
|
|
31520
31936
|
await mkdir9(logDir, { recursive: true });
|
|
31521
31937
|
const filename = `${sanitizeLogFileComponent(sessionId)}.jsonl`;
|
|
31522
|
-
await appendFile5(
|
|
31938
|
+
await appendFile5(join23(logDir, filename), `${JSON.stringify({
|
|
31523
31939
|
timestamp: new Date().toISOString(),
|
|
31524
31940
|
sessionId,
|
|
31525
31941
|
...entry
|
|
@@ -31663,10 +32079,10 @@ function emit(event) {
|
|
|
31663
32079
|
}
|
|
31664
32080
|
}
|
|
31665
32081
|
function bridgeCacheDir() {
|
|
31666
|
-
return
|
|
32082
|
+
return join23(getCodexHomeDir(), "orkestrator-bridge");
|
|
31667
32083
|
}
|
|
31668
32084
|
function bridgeCachePath() {
|
|
31669
|
-
return
|
|
32085
|
+
return join23(bridgeCacheDir(), "models-cache.json");
|
|
31670
32086
|
}
|
|
31671
32087
|
var BRIDGE_MODEL_CACHE_VERSION = 2;
|
|
31672
32088
|
async function readPersistedBridgeCache() {
|
|
@@ -31690,7 +32106,7 @@ async function writePersistedBridgeCache(models) {
|
|
|
31690
32106
|
}
|
|
31691
32107
|
async function readCodexCliModelCache() {
|
|
31692
32108
|
try {
|
|
31693
|
-
const raw = await readFile7(
|
|
32109
|
+
const raw = await readFile7(join23(getCodexHomeDir(), "models_cache.json"), "utf8");
|
|
31694
32110
|
const models = parseModelCatalog(raw);
|
|
31695
32111
|
return models.length > 0 ? models : null;
|
|
31696
32112
|
} catch {
|