orkestrator 2.35.5-beta → 2.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +964 -486
- package/dist/main.js +50800 -44088
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +325 -242
- package/resources/claude-bridge/dist/index.js +187 -22
- package/resources/codex-bridge/dist/index.js +537 -113
- package/resources/cursor-bridge/dist/index.js +34 -6
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +69 -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.",
|
|
@@ -927,6 +933,7 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
927
933
|
"usage.read-failed": "Reading a stage session's token usage failed.",
|
|
928
934
|
"checkpoint.deferred": "A stage transcript checkpoint could not be written yet; the provider's history stands.",
|
|
929
935
|
"checkpoint.not-committed": "A stage transcript checkpoint was reverted in the commit that should have kept it.",
|
|
936
|
+
"worker-mail.claim-failed": "Mail queued for a worker could not be claimed at its turn end; it stays queued.",
|
|
930
937
|
"legacy-transcript.deferred": "Moving a legacy inline transcript failed; the inline body stays readable."
|
|
931
938
|
}
|
|
932
939
|
}
|
|
@@ -989,18 +996,27 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
989
996
|
"work.move-failed": "Work could not move to the main coordinator.",
|
|
990
997
|
"wake.observe-remote-workflow-failed": "A remote workflow could not be observed for status wakes.",
|
|
991
998
|
"wake.observe-pull-request-failed": "A pull request could not be observed for status wakes.",
|
|
999
|
+
"wake.observe-feature-plan-failed": "A feature plan could not be observed for status wakes.",
|
|
992
1000
|
"wake.observe-workflow-failed": "A workflow could not be observed for status wakes.",
|
|
993
1001
|
"wake.deliver-failed": "A workflow status wake could not be delivered; the next pass retries.",
|
|
994
1002
|
"wake.waiting-check-failed": "A waiting worker could not be checked; the next pass retries.",
|
|
995
1003
|
"wake.resolve-report-failed": "A finished Resolve tab could not be reported.",
|
|
996
1004
|
"wake.waiting-report-failed": "A waiting worker could not be reported.",
|
|
997
1005
|
"wake.worker-outcomes-failed": "Coordinator-owned workers' merges and deletions could not be checked; the next sweep retries.",
|
|
1006
|
+
"pr-watch.added": "A pull request a coordinator conversation showed joined the project's watch; `source` says how.",
|
|
1007
|
+
"pr-watch.observe-failed": "A watched pull request could not be observed; the next sweep retries.",
|
|
1008
|
+
"pr-watch.read-failed": "GitHub could not be read for a watched pull request; `code` is the error category.",
|
|
1009
|
+
"pr-watch.removed": "A watched pull request stopped being watched without a reading; `reason` is `deleted` (GitHub confirmed it is gone) or `unreadable` (not found for the give-up period).",
|
|
998
1010
|
"store.malformed": "The coordinator store was malformed and is treated as empty.",
|
|
999
1011
|
"store.unsupported-version": "The coordinator store has an unsupported version and is treated as empty.",
|
|
1000
1012
|
"store.invalid-workspace": "An invalid coordinator workspace record was ignored.",
|
|
1001
1013
|
"store.workflows-cleared": "The workflow store was full, so a batch of its oldest finished records was removed.",
|
|
1002
1014
|
"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."
|
|
1015
|
+
"remote-worker.settle-failed": "A remote worker could not be settled.",
|
|
1016
|
+
"checkout.merge-followed": "After an environment's PR merged, the project checkout was fast-forwarded, or `outcome` says why not.",
|
|
1017
|
+
"checkout.merge-follow-failed": "Fast-forwarding the project checkout failed, after an environment's PR merged or before mail woke the main coordinator.",
|
|
1018
|
+
"checkout.mail-follow": "Before mail woke the main coordinator, the project checkout was fast-forwarded, or `outcome` says why not (`timed-out`, `failed`).",
|
|
1019
|
+
"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
1020
|
}
|
|
1005
1021
|
}
|
|
1006
1022
|
});
|
|
@@ -1032,6 +1048,7 @@ var REVIEW_LOG_AREAS = defineLogAreas({
|
|
|
1032
1048
|
"gh.pr-list-unparseable": "`gh pr list` returned nothing that parses. Sizes only, never the output.",
|
|
1033
1049
|
"monitor.start-failed": "Monitoring could not start for a newly opened pull request.",
|
|
1034
1050
|
"cleanup-scheduler.missing": "A merged pull request was seen, but this runtime has no merge cleanup scheduler.",
|
|
1051
|
+
"checkout.follow-merge-lookup-failed": "A merged pull request's project could not be read, so its checkout was not fast-forwarded.",
|
|
1035
1052
|
"auto-merge.evaluation-failed": "Evaluating an environment for auto-merge failed.",
|
|
1036
1053
|
"auto-merge.merge-failed": "Auto-merge could not merge a pull request; the attempt is held and retried.",
|
|
1037
1054
|
"auto-merge.resolve-failed": "Auto-merge could not launch Resolve for a pull request; the attempt is held and retried.",
|
|
@@ -1075,6 +1092,8 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
|
|
|
1075
1092
|
"container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
|
|
1076
1093
|
"last-usage.save-failed": "The last plan usage reading could not be saved; the next save retries.",
|
|
1077
1094
|
"login-cleanup.failed": "A temporary login could not be cleaned up.",
|
|
1095
|
+
"login-renewal.failed": "Renewing an idle account's sign-in to read its usage failed; it is retried after a backoff.",
|
|
1096
|
+
"login-renewal.not-extended": "Claude Code ran to renew an idle account's sign-in, but its token is still lapsed.",
|
|
1078
1097
|
"login-refresh.deferred": "Containers were not told to refresh their login now; they reconcile from its durable generation."
|
|
1079
1098
|
}
|
|
1080
1099
|
}
|
|
@@ -1088,6 +1107,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1088
1107
|
"portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
|
|
1089
1108
|
"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
1109
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
1110
|
+
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
1091
1111
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
1092
1112
|
"login-keeper.refresh-failed": "Refreshing the host Claude login failed. Fixed text: CLI output can hold credentials.",
|
|
1093
1113
|
"login-keeper.refresh-not-extended": "Refreshing the host Claude login did not extend its expiry.",
|
|
@@ -1211,7 +1231,7 @@ var GRAPH_LOG_AREAS = defineLogAreas({
|
|
|
1211
1231
|
// ../protocol/src/log-vocabulary/nodes.ts
|
|
1212
1232
|
var NODES_LOG_AREAS = defineLogAreas({
|
|
1213
1233
|
nodes: {
|
|
1214
|
-
description: "Command nodes: links, handovers, leaf mail and project copies.",
|
|
1234
|
+
description: "Command nodes: links, handovers, leaf mail, ticket sync and project copies.",
|
|
1215
1235
|
events: {
|
|
1216
1236
|
"actions.resume-failed": "Approved actions could not be resumed; a later pass retries.",
|
|
1217
1237
|
"project-copy.notify-failed": "The coordinator could not be told a project copy finished.",
|
|
@@ -1223,7 +1243,11 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
1223
1243
|
"verification.record-failed": "A node verification could not be recorded.",
|
|
1224
1244
|
"profile.record-failed": "A node profile could not be recorded.",
|
|
1225
1245
|
"detach.unconfirmed": "A forgotten node has not confirmed the detach yet.",
|
|
1226
|
-
"handover.recovery-pending": "Command handover recovery is still pending."
|
|
1246
|
+
"handover.recovery-pending": "Command handover recovery is still pending.",
|
|
1247
|
+
"ticket-sync.work-record-failed": "A remote build started but its ticket work location could not be saved.",
|
|
1248
|
+
"ticket-sync.failed": "A Kanban sync with a node failed; it is retried.",
|
|
1249
|
+
"ticket-sync.unknown-project": "A node sent ticket changes for a project that no longer exists here.",
|
|
1250
|
+
"ticket-sync.forget-failed": "A detached command node's ticket copies could not be released."
|
|
1227
1251
|
}
|
|
1228
1252
|
}
|
|
1229
1253
|
});
|
|
@@ -1806,7 +1830,7 @@ var LOG_VOCABULARY = {
|
|
|
1806
1830
|
// ../protocol/src/secret-redaction.ts
|
|
1807
1831
|
var TEXT_RULES = [
|
|
1808
1832
|
{
|
|
1809
|
-
pattern: /([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
|
|
1833
|
+
pattern: /(?<![a-z0-9+.-])([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
|
|
1810
1834
|
replacement: "$1[redacted]@"
|
|
1811
1835
|
},
|
|
1812
1836
|
{
|
|
@@ -1826,7 +1850,7 @@ var TEXT_RULES = [
|
|
|
1826
1850
|
{ pattern: /\bAKIA[0-9A-Z]{12,}/g, replacement: "[redacted]" },
|
|
1827
1851
|
{ pattern: /\bAIza[0-9A-Za-z_-]{20,}/g, replacement: "[redacted]" },
|
|
1828
1852
|
{
|
|
1829
|
-
pattern:
|
|
1853
|
+
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
1854
|
replacement: "$1$2[redacted]"
|
|
1831
1855
|
}
|
|
1832
1856
|
];
|
|
@@ -3047,7 +3071,7 @@ async function readBridgeLogPolicyBody(request) {
|
|
|
3047
3071
|
import { execFile as execFileCallback2 } from "node:child_process";
|
|
3048
3072
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
3049
3073
|
import { appendFile as appendFile5, mkdir as mkdir9, readFile as readFile7, writeFile as writeFile6 } from "node:fs/promises";
|
|
3050
|
-
import { join as
|
|
3074
|
+
import { join as join23 } from "node:path";
|
|
3051
3075
|
import { promisify as promisify2 } from "node:util";
|
|
3052
3076
|
|
|
3053
3077
|
// ../../node_modules/.bun/@hono+node-server@2.1.5+c539cad7f494f5c9/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
@@ -13966,7 +13990,7 @@ async function deriveTranscriptSubagentPartsForTurn({
|
|
|
13966
13990
|
|
|
13967
13991
|
// ../../bridges/codex-bridge/src/history/rollout.ts
|
|
13968
13992
|
import { createHash as createHash7 } from "node:crypto";
|
|
13969
|
-
import {
|
|
13993
|
+
import { readdir, stat as stat5 } from "node:fs/promises";
|
|
13970
13994
|
import { homedir } from "node:os";
|
|
13971
13995
|
import { basename as basename2, join as join11 } from "node:path";
|
|
13972
13996
|
|
|
@@ -15971,6 +15995,306 @@ function parseCapacityRetryContinuation(text) {
|
|
|
15971
15995
|
return { attempt: Number(match[1]), maxAttempts: Number(match[2]) };
|
|
15972
15996
|
}
|
|
15973
15997
|
|
|
15998
|
+
// ../../bridges/codex-bridge/src/history/session-index-cache.ts
|
|
15999
|
+
import { open as open4, readFile as readFile4, stat as stat4 } from "node:fs/promises";
|
|
16000
|
+
var MAX_SESSION_INDEX_CACHE_ENTRIES = 50000;
|
|
16001
|
+
var MAX_SESSION_INDEX_CACHE_BYTES = 16 * 1024 * 1024;
|
|
16002
|
+
var MAX_SESSION_INDEX_CACHE_PATHS = 4;
|
|
16003
|
+
var ENTRY_OVERHEAD_BYTES2 = 96;
|
|
16004
|
+
var INDEX_OVERHEAD_BYTES = 512;
|
|
16005
|
+
var ANCHOR_BYTES2 = 64;
|
|
16006
|
+
var NEWLINE2 = 10;
|
|
16007
|
+
var DEFAULT_LIMITS2 = {
|
|
16008
|
+
maxEntries: MAX_SESSION_INDEX_CACHE_ENTRIES,
|
|
16009
|
+
maxBytes: MAX_SESSION_INDEX_CACHE_BYTES,
|
|
16010
|
+
maxPaths: MAX_SESSION_INDEX_CACHE_PATHS
|
|
16011
|
+
};
|
|
16012
|
+
var limits2 = DEFAULT_LIMITS2;
|
|
16013
|
+
var EMPTY_SNAPSHOT = { entries: () => [], last: () => {
|
|
16014
|
+
return;
|
|
16015
|
+
} };
|
|
16016
|
+
var cache = new Map;
|
|
16017
|
+
var locks = new Map;
|
|
16018
|
+
var counters2 = { fullReads: 0, tailReads: 0, uncachedReads: 0, bytesRead: 0 };
|
|
16019
|
+
function entryBytes2(entry) {
|
|
16020
|
+
return ENTRY_OVERHEAD_BYTES2 + 2 * (entry.id.length + (entry.threadName?.length ?? 0) + (entry.updatedAt?.length ?? 0));
|
|
16021
|
+
}
|
|
16022
|
+
function fitsAlone(entryCount, bytes) {
|
|
16023
|
+
return entryCount <= limits2.maxEntries && bytes <= limits2.maxBytes;
|
|
16024
|
+
}
|
|
16025
|
+
function touch2(index) {
|
|
16026
|
+
cache.delete(index.path);
|
|
16027
|
+
cache.set(index.path, index);
|
|
16028
|
+
}
|
|
16029
|
+
function enforceBudgets2() {
|
|
16030
|
+
let entries = 0;
|
|
16031
|
+
let bytes = 0;
|
|
16032
|
+
for (const index of cache.values()) {
|
|
16033
|
+
entries += index.entries.length;
|
|
16034
|
+
bytes += index.estimatedBytes;
|
|
16035
|
+
}
|
|
16036
|
+
for (const index of Array.from(cache.values())) {
|
|
16037
|
+
if (cache.size <= limits2.maxPaths && entries <= limits2.maxEntries && bytes <= limits2.maxBytes) {
|
|
16038
|
+
return;
|
|
16039
|
+
}
|
|
16040
|
+
cache.delete(index.path);
|
|
16041
|
+
entries -= index.entries.length;
|
|
16042
|
+
bytes -= index.estimatedBytes;
|
|
16043
|
+
}
|
|
16044
|
+
}
|
|
16045
|
+
function parseIndexLine(line) {
|
|
16046
|
+
const text = line.trim();
|
|
16047
|
+
if (!text)
|
|
16048
|
+
return;
|
|
16049
|
+
let parsed;
|
|
16050
|
+
try {
|
|
16051
|
+
parsed = JSON.parse(text);
|
|
16052
|
+
} catch {
|
|
16053
|
+
return;
|
|
16054
|
+
}
|
|
16055
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
16056
|
+
return;
|
|
16057
|
+
const record = parsed;
|
|
16058
|
+
if (typeof record.id !== "string")
|
|
16059
|
+
return;
|
|
16060
|
+
return {
|
|
16061
|
+
id: record.id,
|
|
16062
|
+
...typeof record.thread_name === "string" ? { threadName: record.thread_name } : {},
|
|
16063
|
+
...typeof record.updated_at === "string" ? { updatedAt: record.updated_at } : {}
|
|
16064
|
+
};
|
|
16065
|
+
}
|
|
16066
|
+
function parseChunk(bytes) {
|
|
16067
|
+
const lastNewline = bytes.lastIndexOf(NEWLINE2);
|
|
16068
|
+
const committedBytes = lastNewline + 1;
|
|
16069
|
+
const entries = [];
|
|
16070
|
+
if (committedBytes > 0) {
|
|
16071
|
+
for (const line of bytes.subarray(0, committedBytes).toString("utf8").split(`
|
|
16072
|
+
`)) {
|
|
16073
|
+
const entry = parseIndexLine(line);
|
|
16074
|
+
if (entry)
|
|
16075
|
+
entries.push(entry);
|
|
16076
|
+
}
|
|
16077
|
+
}
|
|
16078
|
+
const pendingTail = committedBytes < bytes.length ? parseIndexLine(bytes.subarray(committedBytes).toString("utf8")) : undefined;
|
|
16079
|
+
return { entries, committedBytes, ...pendingTail ? { pendingTail } : {} };
|
|
16080
|
+
}
|
|
16081
|
+
function snapshotOf2(index) {
|
|
16082
|
+
const { entries, lastById, pendingTail } = index;
|
|
16083
|
+
const length = entries.length;
|
|
16084
|
+
return {
|
|
16085
|
+
entries: () => {
|
|
16086
|
+
const committed = entries.slice(0, length);
|
|
16087
|
+
if (pendingTail)
|
|
16088
|
+
committed.push(pendingTail);
|
|
16089
|
+
return committed;
|
|
16090
|
+
},
|
|
16091
|
+
last(id) {
|
|
16092
|
+
if (pendingTail?.id === id)
|
|
16093
|
+
return pendingTail;
|
|
16094
|
+
const position = lastById.get(id);
|
|
16095
|
+
if (position === undefined)
|
|
16096
|
+
return;
|
|
16097
|
+
if (position < length)
|
|
16098
|
+
return entries[position];
|
|
16099
|
+
for (let at = length - 1;at >= 0; at -= 1) {
|
|
16100
|
+
if (entries[at].id === id)
|
|
16101
|
+
return entries[at];
|
|
16102
|
+
}
|
|
16103
|
+
return;
|
|
16104
|
+
}
|
|
16105
|
+
};
|
|
16106
|
+
}
|
|
16107
|
+
function lookupSnapshot(entries) {
|
|
16108
|
+
let lastById;
|
|
16109
|
+
return {
|
|
16110
|
+
entries: () => entries,
|
|
16111
|
+
last(id) {
|
|
16112
|
+
if (!lastById) {
|
|
16113
|
+
lastById = new Map;
|
|
16114
|
+
for (const entry of entries)
|
|
16115
|
+
lastById.set(entry.id, entry);
|
|
16116
|
+
}
|
|
16117
|
+
return lastById.get(id);
|
|
16118
|
+
}
|
|
16119
|
+
};
|
|
16120
|
+
}
|
|
16121
|
+
function sameStats2(index, stats) {
|
|
16122
|
+
return index.fileId === `${stats.dev}:${stats.ino}` && Number(stats.size) === index.size && stats.mtimeNs === index.mtimeNs && stats.ctimeNs === index.ctimeNs;
|
|
16123
|
+
}
|
|
16124
|
+
async function readRange(handle, start, end) {
|
|
16125
|
+
const length = end - start;
|
|
16126
|
+
if (length <= 0)
|
|
16127
|
+
return Buffer.alloc(0);
|
|
16128
|
+
const buffer = Buffer.alloc(length);
|
|
16129
|
+
let filled = 0;
|
|
16130
|
+
while (filled < length) {
|
|
16131
|
+
const { bytesRead } = await handle.read(buffer, filled, length - filled, start + filled);
|
|
16132
|
+
if (bytesRead === 0)
|
|
16133
|
+
return null;
|
|
16134
|
+
filled += bytesRead;
|
|
16135
|
+
}
|
|
16136
|
+
counters2.bytesRead += length;
|
|
16137
|
+
return buffer;
|
|
16138
|
+
}
|
|
16139
|
+
async function readAnchor2(handle, end) {
|
|
16140
|
+
return readRange(handle, Math.max(0, end - ANCHOR_BYTES2), end);
|
|
16141
|
+
}
|
|
16142
|
+
var RETRY2 = Symbol("retry");
|
|
16143
|
+
async function fullRead(path, handle, stats) {
|
|
16144
|
+
const size = Number(stats.size);
|
|
16145
|
+
const bytes = await readRange(handle, 0, size);
|
|
16146
|
+
if (!bytes)
|
|
16147
|
+
return RETRY2;
|
|
16148
|
+
const { entries, committedBytes, pendingTail } = parseChunk(bytes);
|
|
16149
|
+
let estimatedBytes = INDEX_OVERHEAD_BYTES;
|
|
16150
|
+
for (const entry of entries)
|
|
16151
|
+
estimatedBytes += entryBytes2(entry);
|
|
16152
|
+
if (pendingTail)
|
|
16153
|
+
estimatedBytes += entryBytes2(pendingTail);
|
|
16154
|
+
if (!fitsAlone(entries.length, estimatedBytes)) {
|
|
16155
|
+
cache.delete(path);
|
|
16156
|
+
counters2.uncachedReads += 1;
|
|
16157
|
+
return lookupSnapshot(pendingTail ? [...entries, pendingTail] : entries);
|
|
16158
|
+
}
|
|
16159
|
+
counters2.fullReads += 1;
|
|
16160
|
+
const lastById = new Map;
|
|
16161
|
+
entries.forEach((entry, position) => lastById.set(entry.id, position));
|
|
16162
|
+
const index = {
|
|
16163
|
+
path,
|
|
16164
|
+
fileId: `${stats.dev}:${stats.ino}`,
|
|
16165
|
+
size,
|
|
16166
|
+
mtimeNs: stats.mtimeNs,
|
|
16167
|
+
ctimeNs: stats.ctimeNs,
|
|
16168
|
+
consumedEnd: committedBytes,
|
|
16169
|
+
anchor: Buffer.from(bytes.subarray(Math.max(0, committedBytes - ANCHOR_BYTES2), committedBytes)),
|
|
16170
|
+
entries,
|
|
16171
|
+
lastById,
|
|
16172
|
+
...pendingTail ? { pendingTail } : {},
|
|
16173
|
+
estimatedBytes
|
|
16174
|
+
};
|
|
16175
|
+
touch2(index);
|
|
16176
|
+
enforceBudgets2();
|
|
16177
|
+
return snapshotOf2(index);
|
|
16178
|
+
}
|
|
16179
|
+
async function tailRead(index, handle, stats) {
|
|
16180
|
+
const size = Number(stats.size);
|
|
16181
|
+
const anchor = await readAnchor2(handle, index.consumedEnd);
|
|
16182
|
+
if (!anchor?.equals(index.anchor))
|
|
16183
|
+
return false;
|
|
16184
|
+
const bytes = await readRange(handle, index.consumedEnd, size);
|
|
16185
|
+
if (!bytes)
|
|
16186
|
+
return false;
|
|
16187
|
+
const { entries, committedBytes, pendingTail } = parseChunk(bytes);
|
|
16188
|
+
let estimatedBytes = index.estimatedBytes - (index.pendingTail ? entryBytes2(index.pendingTail) : 0);
|
|
16189
|
+
for (const entry of entries)
|
|
16190
|
+
estimatedBytes += entryBytes2(entry);
|
|
16191
|
+
if (pendingTail)
|
|
16192
|
+
estimatedBytes += entryBytes2(pendingTail);
|
|
16193
|
+
if (!fitsAlone(index.entries.length + entries.length, estimatedBytes))
|
|
16194
|
+
return false;
|
|
16195
|
+
counters2.tailReads += 1;
|
|
16196
|
+
for (const entry of entries) {
|
|
16197
|
+
index.lastById.set(entry.id, index.entries.length);
|
|
16198
|
+
index.entries.push(entry);
|
|
16199
|
+
}
|
|
16200
|
+
if (committedBytes > 0) {
|
|
16201
|
+
const committed = bytes.subarray(0, committedBytes);
|
|
16202
|
+
index.anchor = Buffer.from((committedBytes >= ANCHOR_BYTES2 ? committed : Buffer.concat([index.anchor, committed])).subarray(-ANCHOR_BYTES2));
|
|
16203
|
+
index.consumedEnd += committedBytes;
|
|
16204
|
+
}
|
|
16205
|
+
index.pendingTail = pendingTail;
|
|
16206
|
+
index.size = size;
|
|
16207
|
+
index.mtimeNs = stats.mtimeNs;
|
|
16208
|
+
index.ctimeNs = stats.ctimeNs;
|
|
16209
|
+
index.estimatedBytes = estimatedBytes;
|
|
16210
|
+
touch2(index);
|
|
16211
|
+
enforceBudgets2();
|
|
16212
|
+
return snapshotOf2(index);
|
|
16213
|
+
}
|
|
16214
|
+
async function refreshOnce2(path) {
|
|
16215
|
+
const cached = cache.get(path);
|
|
16216
|
+
let pathStats;
|
|
16217
|
+
try {
|
|
16218
|
+
pathStats = await stat4(path, { bigint: true });
|
|
16219
|
+
} catch {
|
|
16220
|
+
cache.delete(path);
|
|
16221
|
+
return EMPTY_SNAPSHOT;
|
|
16222
|
+
}
|
|
16223
|
+
if (!pathStats.isFile()) {
|
|
16224
|
+
cache.delete(path);
|
|
16225
|
+
return EMPTY_SNAPSHOT;
|
|
16226
|
+
}
|
|
16227
|
+
if (cached && sameStats2(cached, pathStats)) {
|
|
16228
|
+
touch2(cached);
|
|
16229
|
+
return snapshotOf2(cached);
|
|
16230
|
+
}
|
|
16231
|
+
let handle;
|
|
16232
|
+
try {
|
|
16233
|
+
handle = await open4(path, "r");
|
|
16234
|
+
} catch {
|
|
16235
|
+
cache.delete(path);
|
|
16236
|
+
return EMPTY_SNAPSHOT;
|
|
16237
|
+
}
|
|
16238
|
+
try {
|
|
16239
|
+
const stats = await handle.stat({ bigint: true });
|
|
16240
|
+
const index = cache.get(path);
|
|
16241
|
+
if (index && sameStats2(index, stats)) {
|
|
16242
|
+
touch2(index);
|
|
16243
|
+
return snapshotOf2(index);
|
|
16244
|
+
}
|
|
16245
|
+
if (index && index.fileId === `${stats.dev}:${stats.ino}` && Number(stats.size) > index.size) {
|
|
16246
|
+
const extended = await tailRead(index, handle, stats);
|
|
16247
|
+
if (extended)
|
|
16248
|
+
return extended;
|
|
16249
|
+
}
|
|
16250
|
+
cache.delete(path);
|
|
16251
|
+
return await fullRead(path, handle, stats);
|
|
16252
|
+
} finally {
|
|
16253
|
+
await handle.close().catch(() => {
|
|
16254
|
+
return;
|
|
16255
|
+
});
|
|
16256
|
+
}
|
|
16257
|
+
}
|
|
16258
|
+
async function refreshLocked2(path) {
|
|
16259
|
+
for (let attempt = 0;attempt < 2; attempt += 1) {
|
|
16260
|
+
try {
|
|
16261
|
+
const snapshot = await refreshOnce2(path);
|
|
16262
|
+
if (snapshot !== RETRY2)
|
|
16263
|
+
return snapshot;
|
|
16264
|
+
} catch {
|
|
16265
|
+
cache.delete(path);
|
|
16266
|
+
break;
|
|
16267
|
+
}
|
|
16268
|
+
}
|
|
16269
|
+
cache.delete(path);
|
|
16270
|
+
return uncachedRead(path);
|
|
16271
|
+
}
|
|
16272
|
+
async function uncachedRead(path) {
|
|
16273
|
+
counters2.uncachedReads += 1;
|
|
16274
|
+
try {
|
|
16275
|
+
const raw = await readFile4(path);
|
|
16276
|
+
counters2.bytesRead += raw.length;
|
|
16277
|
+
const { entries, pendingTail } = parseChunk(raw);
|
|
16278
|
+
return lookupSnapshot(pendingTail ? [...entries, pendingTail] : entries);
|
|
16279
|
+
} catch {
|
|
16280
|
+
return EMPTY_SNAPSHOT;
|
|
16281
|
+
}
|
|
16282
|
+
}
|
|
16283
|
+
async function readSessionIndex(path) {
|
|
16284
|
+
const previous = locks.get(path) ?? Promise.resolve();
|
|
16285
|
+
const run = previous.then(() => refreshLocked2(path), () => refreshLocked2(path));
|
|
16286
|
+
const settled = run.catch(() => {
|
|
16287
|
+
return;
|
|
16288
|
+
});
|
|
16289
|
+
locks.set(path, settled);
|
|
16290
|
+
try {
|
|
16291
|
+
return await run;
|
|
16292
|
+
} finally {
|
|
16293
|
+
if (locks.get(path) === settled)
|
|
16294
|
+
locks.delete(path);
|
|
16295
|
+
}
|
|
16296
|
+
}
|
|
16297
|
+
|
|
15974
16298
|
// ../../bridges/codex-bridge/src/history/rollout.ts
|
|
15975
16299
|
var log3 = createLogger("bridge.codex");
|
|
15976
16300
|
function getCodexHomeDir() {
|
|
@@ -16044,7 +16368,7 @@ async function findTranscriptPath(threadId, transcriptPaths, options) {
|
|
|
16044
16368
|
if (cached) {
|
|
16045
16369
|
if (cached.path !== null) {
|
|
16046
16370
|
try {
|
|
16047
|
-
await
|
|
16371
|
+
await stat5(cached.path);
|
|
16048
16372
|
return cached.path;
|
|
16049
16373
|
} catch {
|
|
16050
16374
|
cachedTranscriptPaths.delete(key);
|
|
@@ -16058,15 +16382,6 @@ async function findTranscriptPath(threadId, transcriptPaths, options) {
|
|
|
16058
16382
|
rememberTranscriptPath(threadId, found);
|
|
16059
16383
|
return found;
|
|
16060
16384
|
}
|
|
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
16385
|
async function getSessionMetaFromTranscriptPath(transcriptPath, fallbackTitle, fallbackUpdatedAt) {
|
|
16071
16386
|
const { records } = await readTranscriptHead(transcriptPath);
|
|
16072
16387
|
const sessionMetaRecord = records.find((record) => record.type === "session_meta");
|
|
@@ -16345,21 +16660,13 @@ async function listPersistedSessionsForCwd(cwd, options) {
|
|
|
16345
16660
|
return (await listPersistedSessionsWithTitlesForCwd(cwd, options)).sessions;
|
|
16346
16661
|
}
|
|
16347
16662
|
async function listPersistedSessionsWithTitlesForCwd(cwd, options) {
|
|
16348
|
-
const
|
|
16349
|
-
const lines = await readTranscriptLines(indexPath);
|
|
16663
|
+
const index = await readSessionIndex(sessionIndexPath());
|
|
16350
16664
|
const sessions = new Map;
|
|
16351
16665
|
const transcriptCatalog = await buildTranscriptCatalogCached(options?.mustContainThreadId);
|
|
16352
|
-
for (const
|
|
16353
|
-
|
|
16354
|
-
try {
|
|
16355
|
-
entry = JSON.parse(line);
|
|
16356
|
-
} catch {
|
|
16357
|
-
continue;
|
|
16358
|
-
}
|
|
16359
|
-
const id = typeof entry.id === "string" ? entry.id : undefined;
|
|
16360
|
-
if (!id)
|
|
16666
|
+
for (const entry of index.entries()) {
|
|
16667
|
+
if (!entry.id)
|
|
16361
16668
|
continue;
|
|
16362
|
-
const meta = await getPersistedSessionMeta(id,
|
|
16669
|
+
const meta = await getPersistedSessionMeta(entry.id, entry.threadName, entry.updatedAt, transcriptCatalog);
|
|
16363
16670
|
if (!meta || meta.cwd !== cwd) {
|
|
16364
16671
|
continue;
|
|
16365
16672
|
}
|
|
@@ -16503,27 +16810,11 @@ function createPersistedToolParts(payload, cwd, callId) {
|
|
|
16503
16810
|
function persistedOutputState(payloadType, part, output) {
|
|
16504
16811
|
return payloadType === "custom_tool_call_output" ? resolveTranscriptToolOutputState(part.toolName, output, part.toolState ?? null) : null;
|
|
16505
16812
|
}
|
|
16813
|
+
function sessionIndexPath() {
|
|
16814
|
+
return join11(getCodexHomeDir(), "session_index.jsonl");
|
|
16815
|
+
}
|
|
16506
16816
|
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;
|
|
16817
|
+
return (await readSessionIndex(sessionIndexPath())).last(threadId) ?? null;
|
|
16527
16818
|
}
|
|
16528
16819
|
async function resolvePersistedSessionMetaForThread(threadId) {
|
|
16529
16820
|
const indexed = await findSessionIndexEntry(threadId);
|
|
@@ -17882,6 +18173,9 @@ function agentMailCapabilities(tabType, agent, locked = true) {
|
|
|
17882
18173
|
}
|
|
17883
18174
|
if (tabType === "claude-tmux")
|
|
17884
18175
|
return { canPull: true, canSend: true, canInject: true };
|
|
18176
|
+
if (tabType === "pipeline-worker") {
|
|
18177
|
+
return agent ? { canPull: true, canSend: true, canInject: true } : { canPull: false, canSend: false, canInject: false };
|
|
18178
|
+
}
|
|
17885
18179
|
if (["claude", "codex", "opencode"].includes(tabType)) {
|
|
17886
18180
|
return { canPull: true, canSend: true, canInject: false };
|
|
17887
18181
|
}
|
|
@@ -17919,7 +18213,7 @@ function repositoryInstructionsBlock(path, content, truncated) {
|
|
|
17919
18213
|
}
|
|
17920
18214
|
|
|
17921
18215
|
// ../protocol/src/node/repository-instructions.ts
|
|
17922
|
-
import { open as
|
|
18216
|
+
import { open as open5, realpath } from "node:fs/promises";
|
|
17923
18217
|
import { join as join12, relative as relative2, isAbsolute as isAbsolute7 } from "node:path";
|
|
17924
18218
|
var MAX_REPOSITORY_INSTRUCTIONS_BYTES = 256 * 1024;
|
|
17925
18219
|
async function readRepositoryInstructions(cwd, maxBytes = MAX_REPOSITORY_INSTRUCTIONS_BYTES) {
|
|
@@ -17929,7 +18223,7 @@ async function readRepositoryInstructions(cwd, maxBytes = MAX_REPOSITORY_INSTRUC
|
|
|
17929
18223
|
const inside = relative2(root, target);
|
|
17930
18224
|
if (!inside || inside.startsWith("..") || isAbsolute7(inside))
|
|
17931
18225
|
return;
|
|
17932
|
-
const handle = await
|
|
18226
|
+
const handle = await open5(target, "r");
|
|
17933
18227
|
try {
|
|
17934
18228
|
const buffer = Buffer.alloc(maxBytes + 1);
|
|
17935
18229
|
const { bytesRead } = await handle.read(buffer, 0, maxBytes + 1, 0);
|
|
@@ -17987,9 +18281,9 @@ var ORKESTRATOR_ARTIFACT_MCP_SERVER_NAME = "orkestrator-artifacts";
|
|
|
17987
18281
|
var ORKESTRATOR_ARTIFACT_MCP_PATH = "/artifact-mcp";
|
|
17988
18282
|
|
|
17989
18283
|
// ../../bridges/codex-bridge/src/engine/app-server-engine.ts
|
|
17990
|
-
import { open as
|
|
18284
|
+
import { open as open9 } from "node:fs/promises";
|
|
17991
18285
|
import { createHash as createHash11 } from "node:crypto";
|
|
17992
|
-
import { isAbsolute as isAbsolute9, join as
|
|
18286
|
+
import { isAbsolute as isAbsolute9, join as join20 } from "node:path";
|
|
17993
18287
|
|
|
17994
18288
|
// ../../bridges/codex-bridge/src/app-server/process-supervisor.ts
|
|
17995
18289
|
import { execFile as execFile3, spawn as spawn2 } from "node:child_process";
|
|
@@ -17997,12 +18291,12 @@ import { randomUUID as randomUUID6 } from "node:crypto";
|
|
|
17997
18291
|
import {
|
|
17998
18292
|
link,
|
|
17999
18293
|
mkdir as mkdir6,
|
|
18000
|
-
open as
|
|
18294
|
+
open as open6,
|
|
18001
18295
|
readFile as readFile5,
|
|
18002
18296
|
readlink,
|
|
18003
18297
|
rename as rename4,
|
|
18004
18298
|
rm as rm5,
|
|
18005
|
-
stat as
|
|
18299
|
+
stat as stat6
|
|
18006
18300
|
} from "node:fs/promises";
|
|
18007
18301
|
import { join as join14 } from "node:path";
|
|
18008
18302
|
|
|
@@ -19423,7 +19717,7 @@ class AppServerSupervisor {
|
|
|
19423
19717
|
instanceId
|
|
19424
19718
|
}), "utf8");
|
|
19425
19719
|
const temporary = `${path}.${this.pidOwnerToken}.update`;
|
|
19426
|
-
const handle = await
|
|
19720
|
+
const handle = await open6(temporary, "wx", 384);
|
|
19427
19721
|
try {
|
|
19428
19722
|
await handle.write(payload, 0, payload.length, 0);
|
|
19429
19723
|
await handle.sync();
|
|
@@ -19447,7 +19741,7 @@ class AppServerSupervisor {
|
|
|
19447
19741
|
await mkdir6(this.pidFileDir(), { recursive: true });
|
|
19448
19742
|
for (let attempt = 0;attempt < PID_ACQUISITION_MAX_ATTEMPTS; attempt += 1) {
|
|
19449
19743
|
try {
|
|
19450
|
-
const handle = await
|
|
19744
|
+
const handle = await open6(this.pidFilePath(), "wx", 384);
|
|
19451
19745
|
try {
|
|
19452
19746
|
const record = {
|
|
19453
19747
|
ownerToken: this.pidOwnerToken,
|
|
@@ -19499,7 +19793,7 @@ class AppServerSupervisor {
|
|
|
19499
19793
|
return false;
|
|
19500
19794
|
} else {
|
|
19501
19795
|
try {
|
|
19502
|
-
const metadata = await
|
|
19796
|
+
const metadata = await stat6(path);
|
|
19503
19797
|
if (Date.now() - metadata.mtimeMs < INCOMPLETE_PIDFILE_GRACE_MS)
|
|
19504
19798
|
return false;
|
|
19505
19799
|
} catch {
|
|
@@ -19624,7 +19918,7 @@ class AppServerSupervisor {
|
|
|
19624
19918
|
}
|
|
19625
19919
|
let moved = null;
|
|
19626
19920
|
try {
|
|
19627
|
-
moved = await
|
|
19921
|
+
moved = await stat6(quarantinePath, { bigint: true });
|
|
19628
19922
|
} catch {
|
|
19629
19923
|
moved = null;
|
|
19630
19924
|
}
|
|
@@ -21241,7 +21535,7 @@ function reduceHistoricalTurns(turns, generation, threadId, handle) {
|
|
|
21241
21535
|
|
|
21242
21536
|
// ../../bridges/codex-bridge/src/sessions/dispatch-journal.ts
|
|
21243
21537
|
import { createHash as createHash10 } from "node:crypto";
|
|
21244
|
-
import { mkdir as mkdir8, open as
|
|
21538
|
+
import { mkdir as mkdir8, open as open7, rename as rename6, rm as rm7, writeFile as writeFile5 } from "node:fs/promises";
|
|
21245
21539
|
import { join as join16 } from "node:path";
|
|
21246
21540
|
|
|
21247
21541
|
// ../../bridges/codex-bridge/src/sessions/persistence.ts
|
|
@@ -21254,7 +21548,7 @@ import {
|
|
|
21254
21548
|
readdir as readdir2,
|
|
21255
21549
|
rename as rename5,
|
|
21256
21550
|
rm as rm6,
|
|
21257
|
-
stat as
|
|
21551
|
+
stat as stat7,
|
|
21258
21552
|
writeFile as writeFile4
|
|
21259
21553
|
} from "node:fs/promises";
|
|
21260
21554
|
import { join as join15 } from "node:path";
|
|
@@ -21343,6 +21637,7 @@ function hashCwd(cwd) {
|
|
|
21343
21637
|
return createHash9("sha256").update(cwd).digest("hex").slice(0, 16);
|
|
21344
21638
|
}
|
|
21345
21639
|
var DEFAULT_RETENTION_MS = 7 * 24 * 60 * 60 * 1000;
|
|
21640
|
+
var RECORD_FILE_MISSING = Symbol("record-file-missing");
|
|
21346
21641
|
var TEMP_FILE_GRACE_MS = 60 * 60 * 1000;
|
|
21347
21642
|
var PRIVATE_DIRECTORY_MODE = 448;
|
|
21348
21643
|
var PRIVATE_FILE_MODE = 384;
|
|
@@ -21433,9 +21728,40 @@ class BridgeSessionStore {
|
|
|
21433
21728
|
const loaded = records.filter((record) => record !== null);
|
|
21434
21729
|
return migrationFailed && loaded.length === 0 ? legacy : loaded;
|
|
21435
21730
|
}
|
|
21731
|
+
async loadRecord(bridgeSessionId) {
|
|
21732
|
+
const cutoff = this.now() - this.retentionMs;
|
|
21733
|
+
const key = `${this.recordKey(bridgeSessionId)}.json`;
|
|
21734
|
+
const record = await this.readRecordFile(join15(this.recordsDir(), key), bridgeSessionId, cutoff);
|
|
21735
|
+
if (record !== RECORD_FILE_MISSING)
|
|
21736
|
+
return record;
|
|
21737
|
+
const legacy = (await this.readLegacy(cutoff)).find((session) => session.bridgeSessionId === bridgeSessionId);
|
|
21738
|
+
if (legacy)
|
|
21739
|
+
return legacy;
|
|
21740
|
+
const loginRecords = this.loginRecordsDir();
|
|
21741
|
+
if (!loginRecords)
|
|
21742
|
+
return null;
|
|
21743
|
+
const adoptable = await this.readRecordFile(join15(loginRecords, key), bridgeSessionId, cutoff);
|
|
21744
|
+
return adoptable === RECORD_FILE_MISSING ? null : adoptable;
|
|
21745
|
+
}
|
|
21746
|
+
async readRecordFile(path, bridgeSessionId, cutoff) {
|
|
21747
|
+
let raw;
|
|
21748
|
+
try {
|
|
21749
|
+
raw = await readFile6(path, "utf8");
|
|
21750
|
+
} catch (error) {
|
|
21751
|
+
return error.code === "ENOENT" ? RECORD_FILE_MISSING : null;
|
|
21752
|
+
}
|
|
21753
|
+
try {
|
|
21754
|
+
const value = JSON.parse(raw);
|
|
21755
|
+
if (isPersistedSessionTombstone(value))
|
|
21756
|
+
return null;
|
|
21757
|
+
return isPersistedBridgeSession(value, this.cwdHash, cutoff) && value.bridgeSessionId === bridgeSessionId ? value : null;
|
|
21758
|
+
} catch {
|
|
21759
|
+
return null;
|
|
21760
|
+
}
|
|
21761
|
+
}
|
|
21436
21762
|
async collectStaleTemporary(path) {
|
|
21437
21763
|
try {
|
|
21438
|
-
const info = await
|
|
21764
|
+
const info = await stat7(path);
|
|
21439
21765
|
if (this.now() - info.mtimeMs < TEMP_FILE_GRACE_MS)
|
|
21440
21766
|
return;
|
|
21441
21767
|
await rm6(path, { force: true });
|
|
@@ -21471,6 +21797,13 @@ class BridgeSessionStore {
|
|
|
21471
21797
|
try {
|
|
21472
21798
|
await chmod(this.dir(), PRIVATE_DIRECTORY_MODE);
|
|
21473
21799
|
await chmod(this.path(), PRIVATE_FILE_MODE);
|
|
21800
|
+
} catch {
|
|
21801
|
+
return [];
|
|
21802
|
+
}
|
|
21803
|
+
return this.readLegacy(cutoff);
|
|
21804
|
+
}
|
|
21805
|
+
async readLegacy(cutoff) {
|
|
21806
|
+
try {
|
|
21474
21807
|
const parsed = JSON.parse(await readFile6(this.path(), "utf8"));
|
|
21475
21808
|
if (parsed.version !== BRIDGE_SESSION_REGISTRY_VERSION)
|
|
21476
21809
|
return [];
|
|
@@ -21763,7 +22096,7 @@ class DispatchJournal {
|
|
|
21763
22096
|
return true;
|
|
21764
22097
|
}
|
|
21765
22098
|
async readBounded(path) {
|
|
21766
|
-
const handle = await
|
|
22099
|
+
const handle = await open7(path, "r");
|
|
21767
22100
|
try {
|
|
21768
22101
|
const metadata = await handle.stat();
|
|
21769
22102
|
if (!metadata.isFile() || metadata.size > this.maxBytes) {
|
|
@@ -22238,8 +22571,80 @@ function coordinatorCapabilityPolicy(mode) {
|
|
|
22238
22571
|
|
|
22239
22572
|
// ../../bridges/codex-bridge/src/codex-config.ts
|
|
22240
22573
|
import { existsSync as existsSync3, readdirSync as readdirSync3, realpathSync, statSync as statSync2 } from "node:fs";
|
|
22574
|
+
import { homedir as homedir3 } from "node:os";
|
|
22575
|
+
import { isAbsolute as isAbsolute8, join as join18, relative as relative3, sep } from "node:path";
|
|
22576
|
+
|
|
22577
|
+
// ../../bridges/codex-bridge/src/shell-exclusions.ts
|
|
22578
|
+
import { closeSync, openSync, readSync, fstatSync } from "node:fs";
|
|
22241
22579
|
import { homedir as homedir2 } from "node:os";
|
|
22242
|
-
import {
|
|
22580
|
+
import { dirname as dirname3, join as join17, resolve as resolve3 } from "node:path";
|
|
22581
|
+
function configuredShellExclusions(env) {
|
|
22582
|
+
const paths = new Set([
|
|
22583
|
+
"/etc/codex/config.toml",
|
|
22584
|
+
join17(env.CODEX_HOME || join17(env.HOME || homedir2(), ".codex"), "config.toml")
|
|
22585
|
+
]);
|
|
22586
|
+
{
|
|
22587
|
+
let directory = resolve3(env.CWD || process.cwd());
|
|
22588
|
+
for (;; ) {
|
|
22589
|
+
paths.add(join17(directory, ".codex", "config.toml"));
|
|
22590
|
+
const parent = dirname3(directory);
|
|
22591
|
+
if (parent === directory)
|
|
22592
|
+
break;
|
|
22593
|
+
directory = parent;
|
|
22594
|
+
}
|
|
22595
|
+
}
|
|
22596
|
+
const exclusions = new Set;
|
|
22597
|
+
for (const path of paths) {
|
|
22598
|
+
let fd;
|
|
22599
|
+
try {
|
|
22600
|
+
fd = openSync(path, "r");
|
|
22601
|
+
} catch (error) {
|
|
22602
|
+
if (error.code === "ENOENT")
|
|
22603
|
+
continue;
|
|
22604
|
+
throw new Error("Cannot read Codex shell exclusions");
|
|
22605
|
+
}
|
|
22606
|
+
try {
|
|
22607
|
+
const stat = fstatSync(fd);
|
|
22608
|
+
if (!stat.isFile() || stat.size > 1024 * 1024) {
|
|
22609
|
+
throw new Error("Invalid Codex configuration file");
|
|
22610
|
+
}
|
|
22611
|
+
const buffer = Buffer.alloc(1024 * 1024 + 1);
|
|
22612
|
+
let length = 0;
|
|
22613
|
+
while (length < buffer.length) {
|
|
22614
|
+
const count = readSync(fd, buffer, length, buffer.length - length, null);
|
|
22615
|
+
if (count === 0)
|
|
22616
|
+
break;
|
|
22617
|
+
length += count;
|
|
22618
|
+
}
|
|
22619
|
+
if (length > 1024 * 1024)
|
|
22620
|
+
throw new Error("Codex configuration too large");
|
|
22621
|
+
const config = Bun.TOML.parse(buffer.subarray(0, length).toString("utf8"));
|
|
22622
|
+
collect(config, exclusions);
|
|
22623
|
+
} catch {
|
|
22624
|
+
throw new Error("Cannot load Codex shell exclusions");
|
|
22625
|
+
} finally {
|
|
22626
|
+
closeSync(fd);
|
|
22627
|
+
}
|
|
22628
|
+
}
|
|
22629
|
+
return [...exclusions];
|
|
22630
|
+
}
|
|
22631
|
+
function collect(config, exclusions) {
|
|
22632
|
+
if (!config || typeof config !== "object" || Array.isArray(config))
|
|
22633
|
+
return;
|
|
22634
|
+
const table = config;
|
|
22635
|
+
const policy = table.shell_environment_policy;
|
|
22636
|
+
if (policy && Object.hasOwn(policy, "exclude")) {
|
|
22637
|
+
if (!Array.isArray(policy.exclude) || policy.exclude.some((item) => typeof item !== "string")) {
|
|
22638
|
+
throw new Error("Invalid Codex shell exclusions");
|
|
22639
|
+
}
|
|
22640
|
+
for (const pattern of policy.exclude)
|
|
22641
|
+
exclusions.add(pattern);
|
|
22642
|
+
}
|
|
22643
|
+
if (table.profiles && typeof table.profiles === "object") {
|
|
22644
|
+
for (const profile of Object.values(table.profiles))
|
|
22645
|
+
collect(profile, exclusions);
|
|
22646
|
+
}
|
|
22647
|
+
}
|
|
22243
22648
|
|
|
22244
22649
|
// ../../bridges/codex-bridge/src/engine/mcp-tool-availability.ts
|
|
22245
22650
|
var ORKESTRATOR_MCP_STARTUP_TIMEOUT_SEC = 15;
|
|
@@ -22351,7 +22756,7 @@ function codexCoordinatorSkillExtraRoots(env = process.env, cwd = env.CWD?.trim(
|
|
|
22351
22756
|
const userDir = env[COORDINATOR_CODEX_USER_SKILLS_DIR_ENV]?.trim();
|
|
22352
22757
|
return [
|
|
22353
22758
|
...userDir && isAbsolute8(userDir) ? [userDir] : [],
|
|
22354
|
-
...cwd && isAbsolute8(cwd) ? [
|
|
22759
|
+
...cwd && isAbsolute8(cwd) ? [join18(cwd, ".claude", "skills")] : []
|
|
22355
22760
|
].filter((dir) => existsSync3(dir));
|
|
22356
22761
|
}
|
|
22357
22762
|
var MAX_SKILL_READ_GRANTS = 256;
|
|
@@ -22359,11 +22764,11 @@ function isWithin(parent, child) {
|
|
|
22359
22764
|
const path = relative3(parent, child);
|
|
22360
22765
|
return path === "" || !path.startsWith(`..${sep}`) && path !== ".." && !isAbsolute8(path);
|
|
22361
22766
|
}
|
|
22362
|
-
function codexCoordinatorSkillReadRoots(env = process.env, home = env.HOME?.trim() ||
|
|
22767
|
+
function codexCoordinatorSkillReadRoots(env = process.env, home = env.HOME?.trim() || homedir3()) {
|
|
22363
22768
|
const userDir = env[COORDINATOR_CODEX_USER_SKILLS_DIR_ENV]?.trim();
|
|
22364
22769
|
const roots = [
|
|
22365
22770
|
...userDir && isAbsolute8(userDir) ? [userDir] : [],
|
|
22366
|
-
|
|
22771
|
+
join18(home, ".agents", "skills")
|
|
22367
22772
|
];
|
|
22368
22773
|
const homeReal = (() => {
|
|
22369
22774
|
try {
|
|
@@ -22397,8 +22802,8 @@ function codexCoordinatorSkillReadRoots(env = process.env, home = env.HOME?.trim
|
|
|
22397
22802
|
break;
|
|
22398
22803
|
let target;
|
|
22399
22804
|
try {
|
|
22400
|
-
target = realpathSync(
|
|
22401
|
-
if (!statSync2(target).isDirectory() || !existsSync3(
|
|
22805
|
+
target = realpathSync(join18(real, entry));
|
|
22806
|
+
if (!statSync2(target).isDirectory() || !existsSync3(join18(target, "SKILL.md")))
|
|
22402
22807
|
continue;
|
|
22403
22808
|
} catch {
|
|
22404
22809
|
continue;
|
|
@@ -22537,13 +22942,35 @@ function resolveCodexMaxConcurrentThreads(value) {
|
|
|
22537
22942
|
const parsed = Number(value);
|
|
22538
22943
|
return Number.isSafeInteger(parsed) && parsed >= 1 && parsed <= MAX_CODEX_CONCURRENT_THREADS ? parsed : DEFAULT_CODEX_MAX_CONCURRENT_THREADS;
|
|
22539
22944
|
}
|
|
22945
|
+
var CODEX_SESSION_SHELL_EXCLUDE = Object.freeze([
|
|
22946
|
+
"CODEX_BRIDGE_TOKEN",
|
|
22947
|
+
"*_BRIDGE_TOKEN",
|
|
22948
|
+
ORKESTRATOR_AGENT_MCP_TOKEN_ENV,
|
|
22949
|
+
ORKESTRATOR_AGENT_MCP_URL_ENV,
|
|
22950
|
+
"CODEX_API_KEY"
|
|
22951
|
+
]);
|
|
22952
|
+
var CODEX_COORDINATOR_SHELL_EXCLUDE = Object.freeze([
|
|
22953
|
+
...new Set([
|
|
22954
|
+
"*_KEY",
|
|
22955
|
+
"*_SECRET",
|
|
22956
|
+
"*_TOKEN",
|
|
22957
|
+
"CODEX_HOME",
|
|
22958
|
+
...CODEX_SESSION_SHELL_EXCLUDE,
|
|
22959
|
+
"CODEX_BRIDGE_PERMISSION_PROFILE",
|
|
22960
|
+
"CODEX_BRIDGE_READABLE_RUNTIME_ROOT"
|
|
22961
|
+
])
|
|
22962
|
+
]);
|
|
22540
22963
|
function codexAppServerConfigOverrides(env = process.env) {
|
|
22964
|
+
const userExclusions = configuredShellExclusions(env);
|
|
22541
22965
|
const childLimit = resolveCodexMaxConcurrentThreads(env[CODEX_MAX_CONCURRENT_THREADS_ENV]);
|
|
22542
22966
|
const overrides = {
|
|
22543
22967
|
"agents.max_concurrent_threads_per_session": String(childLimit),
|
|
22544
22968
|
"features.multi_agent_v2.max_concurrent_threads_per_session": String(childLimit + 1),
|
|
22545
22969
|
"features.incremental_tools": "false",
|
|
22546
|
-
"features.goals": "false"
|
|
22970
|
+
"features.goals": "false",
|
|
22971
|
+
"shell_environment_policy.exclude": JSON.stringify([
|
|
22972
|
+
...new Set([...userExclusions, ...CODEX_SESSION_SHELL_EXCLUDE])
|
|
22973
|
+
])
|
|
22547
22974
|
};
|
|
22548
22975
|
const rawUrl = env[ORKESTRATOR_AGENT_MCP_URL_ENV]?.trim();
|
|
22549
22976
|
const token = env[ORKESTRATOR_AGENT_MCP_TOKEN_ENV]?.trim();
|
|
@@ -22591,15 +23018,7 @@ function codexAppServerConfigOverrides(env = process.env) {
|
|
|
22591
23018
|
overrides["shell_environment_policy.inherit"] = JSON.stringify("core");
|
|
22592
23019
|
overrides["shell_environment_policy.ignore_default_excludes"] = "false";
|
|
22593
23020
|
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
|
|
23021
|
+
...new Set([...userExclusions, ...CODEX_COORDINATOR_SHELL_EXCLUDE])
|
|
22603
23022
|
]);
|
|
22604
23023
|
}
|
|
22605
23024
|
if (rawUrl && token) {
|
|
@@ -22631,7 +23050,7 @@ function codexAppServerConfigOverrides(env = process.env) {
|
|
|
22631
23050
|
// ../../bridges/codex-bridge/src/github-credential-config.ts
|
|
22632
23051
|
import { mkdtemp as mkdtemp2 } from "node:fs/promises";
|
|
22633
23052
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
22634
|
-
import { join as
|
|
23053
|
+
import { join as join19 } from "node:path";
|
|
22635
23054
|
var CODEX_INHERITED_GIT_CONFIG_PATTERNS = Object.freeze([
|
|
22636
23055
|
"GIT_CONFIG_COUNT",
|
|
22637
23056
|
"GIT_CONFIG_KEY_*",
|
|
@@ -22666,7 +23085,7 @@ function codexGitHubCredentialThreadConfig(policy, options) {
|
|
|
22666
23085
|
}
|
|
22667
23086
|
var withheldGhConfigDir;
|
|
22668
23087
|
function emptyGhConfigDir() {
|
|
22669
|
-
withheldGhConfigDir ??= mkdtemp2(
|
|
23088
|
+
withheldGhConfigDir ??= mkdtemp2(join19(tmpdir2(), "orkestrator-gh-withheld-")).catch((error) => {
|
|
22670
23089
|
withheldGhConfigDir = undefined;
|
|
22671
23090
|
throw error;
|
|
22672
23091
|
});
|
|
@@ -22674,11 +23093,11 @@ function emptyGhConfigDir() {
|
|
|
22674
23093
|
}
|
|
22675
23094
|
|
|
22676
23095
|
// ../../bridges/codex-bridge/src/sessions/tool-history-guard.ts
|
|
22677
|
-
import { open as
|
|
23096
|
+
import { open as open8 } from "node:fs/promises";
|
|
22678
23097
|
var TOOL_HISTORY_MARKER = '"type":"additional_tools"';
|
|
22679
23098
|
var MAX_TOOL_HISTORY_LINEAGE_DEPTH = 32;
|
|
22680
23099
|
async function rolloutDeclaresToolHistory(path, end) {
|
|
22681
|
-
const handle = await
|
|
23100
|
+
const handle = await open8(path, "r");
|
|
22682
23101
|
try {
|
|
22683
23102
|
const size = (await handle.stat()).size;
|
|
22684
23103
|
const limit = end === undefined ? size : Math.min(end, size);
|
|
@@ -22703,7 +23122,7 @@ async function rolloutDeclaresToolHistory(path, end) {
|
|
|
22703
23122
|
}
|
|
22704
23123
|
}
|
|
22705
23124
|
async function historyBase(path) {
|
|
22706
|
-
const handle = await
|
|
23125
|
+
const handle = await open8(path, "r");
|
|
22707
23126
|
try {
|
|
22708
23127
|
const chunks = [];
|
|
22709
23128
|
let filled = 0;
|
|
@@ -23143,7 +23562,7 @@ function signedOutAccountRead(error) {
|
|
|
23143
23562
|
}
|
|
23144
23563
|
async function readStoredLoginFingerprint(codexHome) {
|
|
23145
23564
|
try {
|
|
23146
|
-
const file = await
|
|
23565
|
+
const file = await open9(join20(codexHome, "auth.json"), "r");
|
|
23147
23566
|
let raw;
|
|
23148
23567
|
try {
|
|
23149
23568
|
const bytes = Buffer.alloc(65537);
|
|
@@ -25914,7 +26333,7 @@ class CodexRuntimeSessions {
|
|
|
25914
26333
|
if (!session.threadId)
|
|
25915
26334
|
return true;
|
|
25916
26335
|
try {
|
|
25917
|
-
const persisted =
|
|
26336
|
+
const persisted = await this.ctx.store.loadRecord(session.id);
|
|
25918
26337
|
if (!persisted)
|
|
25919
26338
|
return false;
|
|
25920
26339
|
const { agentMcp: _agentMcp, ...persistableConfig } = session.config;
|
|
@@ -26165,8 +26584,8 @@ function parseCommandToken(text, sigils = ["/"]) {
|
|
|
26165
26584
|
|
|
26166
26585
|
// ../../bridges/codex-bridge/src/prompts/template-discovery.ts
|
|
26167
26586
|
import { createHash as createHash13 } from "node:crypto";
|
|
26168
|
-
import { open as
|
|
26169
|
-
import { join as
|
|
26587
|
+
import { open as open10, readdir as readdir3, stat as stat8 } from "node:fs/promises";
|
|
26588
|
+
import { join as join21 } from "node:path";
|
|
26170
26589
|
var TEMPLATE_LIMITS = Object.freeze({
|
|
26171
26590
|
maxTemplates: 512,
|
|
26172
26591
|
maxVisitedEntries: 2048,
|
|
@@ -26186,8 +26605,8 @@ var RESERVED_TEMPLATE_PREFIXES = ["/skill:", "/prompts:"];
|
|
|
26186
26605
|
var TEMPLATE_ID_PREFIX = "codex-template:";
|
|
26187
26606
|
function templateRoots(cwd, codexHome = getCodexHomeDir()) {
|
|
26188
26607
|
return [
|
|
26189
|
-
{ origin: "project", dir:
|
|
26190
|
-
{ origin: "user", dir:
|
|
26608
|
+
{ origin: "project", dir: join21(cwd, ".codex", "prompts") },
|
|
26609
|
+
{ origin: "user", dir: join21(codexHome, "prompts") }
|
|
26191
26610
|
];
|
|
26192
26611
|
}
|
|
26193
26612
|
function templateCommandId(origin, relativePath) {
|
|
@@ -26212,7 +26631,7 @@ function isReservedName(name) {
|
|
|
26212
26631
|
var metadataCache = new Map;
|
|
26213
26632
|
var METADATA_CACHE_MAX = 1024;
|
|
26214
26633
|
async function readBounded2(absolutePath, maxBytes) {
|
|
26215
|
-
const handle = await
|
|
26634
|
+
const handle = await open10(absolutePath, "r");
|
|
26216
26635
|
try {
|
|
26217
26636
|
const info = await handle.stat();
|
|
26218
26637
|
if (!info.isFile())
|
|
@@ -26292,7 +26711,7 @@ async function scanPromptTemplates(roots, limits = TEMPLATE_LIMITS) {
|
|
|
26292
26711
|
return;
|
|
26293
26712
|
}
|
|
26294
26713
|
visited += 1;
|
|
26295
|
-
const absolutePath =
|
|
26714
|
+
const absolutePath = join21(dir, entry.name);
|
|
26296
26715
|
const relativePath = relative ? `${relative}/${entry.name}` : entry.name;
|
|
26297
26716
|
if (entry.isDirectory()) {
|
|
26298
26717
|
if (depth + 1 > limits.maxDepth) {
|
|
@@ -26309,7 +26728,7 @@ async function scanPromptTemplates(roots, limits = TEMPLATE_LIMITS) {
|
|
|
26309
26728
|
continue;
|
|
26310
26729
|
let info;
|
|
26311
26730
|
try {
|
|
26312
|
-
info = await
|
|
26731
|
+
info = await stat8(absolutePath);
|
|
26313
26732
|
} catch {
|
|
26314
26733
|
skipped += 1;
|
|
26315
26734
|
continue;
|
|
@@ -26596,6 +27015,11 @@ function skillCommandRow(binding, projectResources = true) {
|
|
|
26596
27015
|
...unavailable ? { availability: { state: "unavailable", ...unavailable } } : {}
|
|
26597
27016
|
};
|
|
26598
27017
|
}
|
|
27018
|
+
function realSettleTimer(fire, delayMs) {
|
|
27019
|
+
const timer = setTimeout(fire, delayMs);
|
|
27020
|
+
timer.unref?.();
|
|
27021
|
+
return () => clearTimeout(timer);
|
|
27022
|
+
}
|
|
26599
27023
|
|
|
26600
27024
|
class SkillInventory {
|
|
26601
27025
|
deps;
|
|
@@ -26607,7 +27031,7 @@ class SkillInventory {
|
|
|
26607
27031
|
settledGeneration = null;
|
|
26608
27032
|
settling = null;
|
|
26609
27033
|
answeredGeneration = null;
|
|
26610
|
-
|
|
27034
|
+
cancelSettle = null;
|
|
26611
27035
|
disposed = false;
|
|
26612
27036
|
stats = { invalidations: 0, reads: 0, scheduledRefreshes: 0, settlingReads: 0 };
|
|
26613
27037
|
constructor(deps) {
|
|
@@ -26725,10 +27149,10 @@ class SkillInventory {
|
|
|
26725
27149
|
armSettle(snapshot, round) {
|
|
26726
27150
|
const { generation } = snapshot;
|
|
26727
27151
|
const baseline = snapshotSignature(snapshot);
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
this.
|
|
26731
|
-
this.
|
|
27152
|
+
this.cancelSettle?.();
|
|
27153
|
+
const setSettleTimer = this.deps.setSettleTimer ?? realSettleTimer;
|
|
27154
|
+
this.cancelSettle = setSettleTimer(() => {
|
|
27155
|
+
this.cancelSettle = null;
|
|
26732
27156
|
if (this.disposed || this.deps.generation() !== generation)
|
|
26733
27157
|
return;
|
|
26734
27158
|
this.invalidationSerial += 1;
|
|
@@ -26753,16 +27177,14 @@ class SkillInventory {
|
|
|
26753
27177
|
return;
|
|
26754
27178
|
});
|
|
26755
27179
|
}, this.coldSettleMs());
|
|
26756
|
-
this.settleTimer.unref?.();
|
|
26757
27180
|
}
|
|
26758
27181
|
dispose() {
|
|
26759
27182
|
this.disposed = true;
|
|
26760
27183
|
if (this.refreshTimer)
|
|
26761
27184
|
clearTimeout(this.refreshTimer);
|
|
26762
27185
|
this.refreshTimer = null;
|
|
26763
|
-
|
|
26764
|
-
|
|
26765
|
-
this.settleTimer = null;
|
|
27186
|
+
this.cancelSettle?.();
|
|
27187
|
+
this.cancelSettle = null;
|
|
26766
27188
|
this.settling = null;
|
|
26767
27189
|
}
|
|
26768
27190
|
}
|
|
@@ -26852,6 +27274,7 @@ class CodexCommandCatalogue {
|
|
|
26852
27274
|
...options.skillTtlMs !== undefined ? { ttlMs: options.skillTtlMs } : {},
|
|
26853
27275
|
...options.skillRefreshDebounceMs !== undefined ? { refreshDebounceMs: options.skillRefreshDebounceMs } : {},
|
|
26854
27276
|
...options.skillColdSettleMs !== undefined ? { coldSettleMs: options.skillColdSettleMs } : {},
|
|
27277
|
+
...options.skillSettleTimer ? { setSettleTimer: options.skillSettleTimer } : {},
|
|
26855
27278
|
onRefreshed: (read) => {
|
|
26856
27279
|
this.skillsDigest = commandBindingRevision([
|
|
26857
27280
|
String(read.fresh),
|
|
@@ -27445,7 +27868,7 @@ class UpdateCoalescer {
|
|
|
27445
27868
|
}
|
|
27446
27869
|
|
|
27447
27870
|
// ../../bridges/codex-bridge/src/app-server-runtime-capacity-retry.ts
|
|
27448
|
-
import { stat as
|
|
27871
|
+
import { stat as stat9 } from "node:fs/promises";
|
|
27449
27872
|
var log15 = createLogger("bridge.codex");
|
|
27450
27873
|
|
|
27451
27874
|
class CodexCapacityRetry {
|
|
@@ -27587,7 +28010,7 @@ class CodexCapacityRetry {
|
|
|
27587
28010
|
await this.ctx.journal.markContinuation(requestId, clientId);
|
|
27588
28011
|
plan.attempt = entry.attempt;
|
|
27589
28012
|
const path = engine.rolloutPath(context.threadId);
|
|
27590
|
-
const offset = path ? await
|
|
28013
|
+
const offset = path ? await stat9(path).then((stats) => stats.size, () => {
|
|
27591
28014
|
return;
|
|
27592
28015
|
}) : undefined;
|
|
27593
28016
|
this.lifecycle.stateFor(context.threadId).refusedCellOffset = offset;
|
|
@@ -29303,7 +29726,7 @@ function requiredCoordinatorPermissionProfile() {
|
|
|
29303
29726
|
}
|
|
29304
29727
|
|
|
29305
29728
|
// ../../bridges/codex-bridge/src/app-server-runtime-prompt.ts
|
|
29306
|
-
import { stat as
|
|
29729
|
+
import { stat as stat10 } from "node:fs/promises";
|
|
29307
29730
|
// ../protocol/src/tab-initial-prompt.ts
|
|
29308
29731
|
var TAB_INITIAL_PROMPT_REQUEST_PREFIX = "initial-prompt:";
|
|
29309
29732
|
function isTabInitialPromptRequestId(requestId) {
|
|
@@ -29678,7 +30101,7 @@ class CodexRuntimePrompt {
|
|
|
29678
30101
|
let refusedCellOffset;
|
|
29679
30102
|
const startTurn = async () => {
|
|
29680
30103
|
const path = this.ctx.options.engine.rolloutPath(context.threadId);
|
|
29681
|
-
refusedCellOffset = path ? await
|
|
30104
|
+
refusedCellOffset = path ? await stat10(path).then((stats) => stats.size, (error) => error.code === "ENOENT" ? 0 : undefined) : undefined;
|
|
29682
30105
|
return this.ctx.options.engine.startTurn({
|
|
29683
30106
|
handle: context.engineHandle,
|
|
29684
30107
|
input: engineInput,
|
|
@@ -30280,7 +30703,7 @@ class CodexRuntimePrompt {
|
|
|
30280
30703
|
}
|
|
30281
30704
|
|
|
30282
30705
|
// ../../bridges/codex-bridge/src/app-server-runtime-tail.ts
|
|
30283
|
-
import { join as
|
|
30706
|
+
import { join as join22, relative as relative4, isAbsolute as isAbsolute11 } from "node:path";
|
|
30284
30707
|
var log18 = createLogger("bridge.codex");
|
|
30285
30708
|
|
|
30286
30709
|
class CodexRuntimeTail {
|
|
@@ -30480,7 +30903,7 @@ class CodexRuntimeTail {
|
|
|
30480
30903
|
cursor = page.nextCursor ?? undefined;
|
|
30481
30904
|
} while (cursor);
|
|
30482
30905
|
} catch {}
|
|
30483
|
-
const archivedRoot =
|
|
30906
|
+
const archivedRoot = join22(this.ctx.options.codexHome, "archived_sessions");
|
|
30484
30907
|
const isArchived = (meta) => {
|
|
30485
30908
|
if (archived.has(meta.id))
|
|
30486
30909
|
return true;
|
|
@@ -31377,6 +31800,7 @@ function boundCodexTranscriptResponse(messages, tailMessages) {
|
|
|
31377
31800
|
var BRIDGE_TOKEN_ENV = "CODEX_BRIDGE_TOKEN";
|
|
31378
31801
|
var BRIDGE_ALLOWED_ORIGINS_ENV = "CODEX_BRIDGE_ALLOWED_ORIGINS";
|
|
31379
31802
|
var bridgeAuthToken = process.env[BRIDGE_TOKEN_ENV]?.trim() || randomBytes(32).toString("base64url");
|
|
31803
|
+
delete process.env[BRIDGE_TOKEN_ENV];
|
|
31380
31804
|
var bridgeAuthEnabledOverrideForTesting = null;
|
|
31381
31805
|
var sseRouteTestHooks = null;
|
|
31382
31806
|
var BRIDGE_VERSION = "1.0.0";
|
|
@@ -31519,7 +31943,7 @@ async function writeCodexRawLog(sessionId, entry, logDir = codexRawLogDir) {
|
|
|
31519
31943
|
try {
|
|
31520
31944
|
await mkdir9(logDir, { recursive: true });
|
|
31521
31945
|
const filename = `${sanitizeLogFileComponent(sessionId)}.jsonl`;
|
|
31522
|
-
await appendFile5(
|
|
31946
|
+
await appendFile5(join23(logDir, filename), `${JSON.stringify({
|
|
31523
31947
|
timestamp: new Date().toISOString(),
|
|
31524
31948
|
sessionId,
|
|
31525
31949
|
...entry
|
|
@@ -31663,10 +32087,10 @@ function emit(event) {
|
|
|
31663
32087
|
}
|
|
31664
32088
|
}
|
|
31665
32089
|
function bridgeCacheDir() {
|
|
31666
|
-
return
|
|
32090
|
+
return join23(getCodexHomeDir(), "orkestrator-bridge");
|
|
31667
32091
|
}
|
|
31668
32092
|
function bridgeCachePath() {
|
|
31669
|
-
return
|
|
32093
|
+
return join23(bridgeCacheDir(), "models-cache.json");
|
|
31670
32094
|
}
|
|
31671
32095
|
var BRIDGE_MODEL_CACHE_VERSION = 2;
|
|
31672
32096
|
async function readPersistedBridgeCache() {
|
|
@@ -31690,7 +32114,7 @@ async function writePersistedBridgeCache(models) {
|
|
|
31690
32114
|
}
|
|
31691
32115
|
async function readCodexCliModelCache() {
|
|
31692
32116
|
try {
|
|
31693
|
-
const raw = await readFile7(
|
|
32117
|
+
const raw = await readFile7(join23(getCodexHomeDir(), "models_cache.json"), "utf8");
|
|
31694
32118
|
const models = parseModelCatalog(raw);
|
|
31695
32119
|
return models.length > 0 ? models : null;
|
|
31696
32120
|
} catch {
|