orkestrator 2.35.3-beta → 2.35.4-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +883 -15
- package/dist/main.js +198857 -195775
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +2226 -151
- package/resources/claude-bridge/dist/index.js +4374 -2500
- package/resources/codex-bridge/dist/index.js +2071 -132
- package/resources/cursor-bridge/dist/index.js +2282 -135
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +2183 -121
- package/resources/pi-bridge/runtime/install.json +1 -1
|
@@ -1,5 +1,1788 @@
|
|
|
1
|
+
// ../protocol/src/log-vocabulary/define.ts
|
|
2
|
+
var THROTTLE_LOG_EVENTS = {
|
|
3
|
+
"throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
|
|
4
|
+
"throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
|
|
5
|
+
"throttle.evicted": "The tracked-key limit dropped the `site`, so no recovered line follows unless it fails again."
|
|
6
|
+
};
|
|
7
|
+
function defineLogAreas(areas) {
|
|
8
|
+
return areas;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ../protocol/src/log-vocabulary/agent-mail.ts
|
|
12
|
+
var AGENT_MAIL_LOG_AREAS = defineLogAreas({
|
|
13
|
+
"agent-mail": {
|
|
14
|
+
description: "Delivering agent mail into waiting agent sessions.",
|
|
15
|
+
events: {
|
|
16
|
+
"delivery.waiting": "The drain passed over a pending message, for a reason it had not yet logged."
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// ../protocol/src/log-vocabulary/backend.ts
|
|
22
|
+
var BACKEND_LOG_AREAS = defineLogAreas({
|
|
23
|
+
"build.pipeline": {
|
|
24
|
+
description: "Build delivery, ticket reconciliation and persisted pipeline recovery.",
|
|
25
|
+
events: {
|
|
26
|
+
"delivery-policy.failed": "A ticket delivery edit could not be reconciled with the running build.",
|
|
27
|
+
"criteria.failed": "Verify could not record criterion results on the ticket.",
|
|
28
|
+
"transcript-maintenance.failed": "Pipeline transcript maintenance failed.",
|
|
29
|
+
"hydrate.failed": "The renderer could not load the authoritative pipeline snapshot."
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"backend.activity": {
|
|
33
|
+
description: "The backend's recurring activity and maintenance jobs.",
|
|
34
|
+
events: {
|
|
35
|
+
"job.failed": "One pass of the job named in `scope` failed; its next pass retries.",
|
|
36
|
+
...THROTTLE_LOG_EVENTS
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// ../protocol/src/log-vocabulary/bridge.ts
|
|
42
|
+
var MAX_BRIDGE_DIAGNOSTIC_BYTES = 8192;
|
|
43
|
+
var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
44
|
+
"bridge.diagnostics": {
|
|
45
|
+
description: "Metadata snapshots of bridge turns and processes, written while Save Logs for Debugging is on. docs/architecture/bridge-diagnostics.md reads them.",
|
|
46
|
+
tag: "bridge-diagnostics",
|
|
47
|
+
maxStringChars: MAX_BRIDGE_DIAGNOSTIC_BYTES,
|
|
48
|
+
events: {
|
|
49
|
+
heartbeat: "The once-a-minute snapshot of a turn or process that is still open.",
|
|
50
|
+
"send-started": "A turn or process diagnostic scope began.",
|
|
51
|
+
"send-resolved": "The provider accepted a dispatch.",
|
|
52
|
+
"cancel-requested": "Cancellation of a turn was requested.",
|
|
53
|
+
"cancel-settled": "The provider's cancel call returned or failed.",
|
|
54
|
+
closed: "A diagnostic scope ended, with its final counters.",
|
|
55
|
+
"snapshot-overflow": "A snapshot exceeded the bound, so only its size was written.",
|
|
56
|
+
"debug-events": "A batch of allowlisted debug labels with their counts.",
|
|
57
|
+
"setup-failed": "A Cursor setup step failed and swallowed its error.",
|
|
58
|
+
"sdk-snapshot": "Cursor's SDK transports and executions at a boundary.",
|
|
59
|
+
"sdk-snapshot-overflow": "A Cursor SDK snapshot exceeded the bound, so it was omitted."
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"bridge.lifecycle": {
|
|
63
|
+
description: "What every long-lived bridge does the same way: its sweep and its shutdown.",
|
|
64
|
+
events: {
|
|
65
|
+
"idle-sweep.failed": "An idle sweep threw; the next tick retries.",
|
|
66
|
+
"shutdown.failed": "Releasing the bridge failed during shutdown; it still exits."
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"bridge.acp": {
|
|
70
|
+
description: "The ACP bridge behind Grok: its routes, sessions, saved state and change evidence.",
|
|
71
|
+
events: {
|
|
72
|
+
"command-change.record-failed": "A measured command change could not be recorded.",
|
|
73
|
+
"evidence.record-failed": "Change evidence could not be recorded; the read loop carries on.",
|
|
74
|
+
"evidence.shell-record-failed": "A shell observation could not be recorded.",
|
|
75
|
+
"evidence.turn-record-failed": "Turn change evidence could not be recorded.",
|
|
76
|
+
"server.listening": "The HTTP server is listening.",
|
|
77
|
+
"state.composer-reset": "A saved composer state was malformed and was reset.",
|
|
78
|
+
"state.discarded": "Saved bridge state could not be used and was discarded.",
|
|
79
|
+
"state.persist-failed": "Saving bridge state failed; a later write retries.",
|
|
80
|
+
"state.session-config-reset": "A saved session configuration was malformed and was reset."
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"bridge.claude": {
|
|
84
|
+
description: "The Claude bridge: its routes, sessions, parked interactions and the Agent SDK turn loop.",
|
|
85
|
+
events: {
|
|
86
|
+
"commands.read-failed": "The command catalogue read failed; the cached answer stands.",
|
|
87
|
+
"context-usage.read-failed": "The detailed context usage read failed; the route falls back.",
|
|
88
|
+
"dispatch.rollback-failed": "Rolling back a prompt dispatch claim failed.",
|
|
89
|
+
"event-subscriber.failed": "An event subscriber threw; other subscribers still ran.",
|
|
90
|
+
"http.request-failed": "An HTTP route threw; it answered 500.",
|
|
91
|
+
"mcp.config-ignored": "An MCP server configuration of an unsupported shape was ignored.",
|
|
92
|
+
"mcp.read-failed": "Listing MCP servers failed; the route answered 500.",
|
|
93
|
+
"models.fetch-failed": "Reading the supported models failed; the fallback catalogue is served.",
|
|
94
|
+
"models.requested": "The model catalogue route was called.",
|
|
95
|
+
"models.responded": "The model catalogue route answered.",
|
|
96
|
+
"parent.gone": "The backend that launched this bridge has gone; shutting down.",
|
|
97
|
+
"plan-approval.responding": "Answering a parked plan approval.",
|
|
98
|
+
"plan-approval.response-failed": "The plan approval route failed.",
|
|
99
|
+
"plan-approval.response-received": "The route received a plan approval answer.",
|
|
100
|
+
"plan-approval.result": "A parked plan approval was answered.",
|
|
101
|
+
"plan-approval.wait-failed": "A parked plan approval ended without an answer: cancelled, timed out or closed.",
|
|
102
|
+
"plan-exit.failure-overridden": "ExitPlanMode failed after the user approved; treated as success with a continuation re-prompt.",
|
|
103
|
+
"plan-mode.record-failed": "Plan mode from a status frame could not be recorded.",
|
|
104
|
+
"plan.reprompt-approved-failed": "Re-prompting after an approved plan failed.",
|
|
105
|
+
"plan.reprompt-feedback-failed": "Re-prompting with plan rejection feedback failed.",
|
|
106
|
+
"plugin.path-missing": "A configured plugin was skipped because its path does not exist.",
|
|
107
|
+
"plugin.unsafe-path": "An installed plugin was skipped because its install path is unsafe.",
|
|
108
|
+
"plugins.read-failed": "Listing plugins failed; the route answered 500.",
|
|
109
|
+
"prompt.accepted": "The route accepted a prompt and answered 202.",
|
|
110
|
+
"prompt.failed": "A prompt turn failed; the session reports the error.",
|
|
111
|
+
"prompt.processing-failed": "A prompt accepted by the route failed while processing.",
|
|
112
|
+
"prompt.received": "A prompt reached the bridge; only its length is logged.",
|
|
113
|
+
"prompt.send-failed": "A prompt request failed; the route answered with an error.",
|
|
114
|
+
"query.close-failed": "Stopping the Claude query failed while closing a tab; the close stays pending.",
|
|
115
|
+
"query.failed": "A Claude query ended with an error result.",
|
|
116
|
+
"question.answer-failed": "The answer-question route failed.",
|
|
117
|
+
"question.answering": "Answering a parked question.",
|
|
118
|
+
"question.answers-prepared": "The route prepared a question answer for the session.",
|
|
119
|
+
"question.answers-received": "A parked question received its answers.",
|
|
120
|
+
"question.stale": "An answer arrived for a question no longer pending; the route answered stale.",
|
|
121
|
+
"question.wait-failed": "A parked question ended without an answer: cancelled, timed out or closed.",
|
|
122
|
+
"runtime.ended-under-resumed-turn": "The Claude runtime ended while a resumed root turn was still open.",
|
|
123
|
+
"server.listening": "The HTTP server is listening.",
|
|
124
|
+
"server.starting": "The HTTP server is about to bind.",
|
|
125
|
+
"session.compact-failed": "A requested compaction failed.",
|
|
126
|
+
"session.create-failed": "Creating a session failed; the route answered with an error.",
|
|
127
|
+
"session.created": "A session was created or recovered.",
|
|
128
|
+
"session.delete-failed": "Deleting a session failed.",
|
|
129
|
+
"session.fork-failed": "Forking a session failed.",
|
|
130
|
+
"session.rename-failed": "Renaming a session failed.",
|
|
131
|
+
"session.resolve-failed": "A session could not be found or loaded for a request; action names the request.",
|
|
132
|
+
"session.rewind-failed": "Rewinding session files failed.",
|
|
133
|
+
"session.task-state-hydrate-failed": "Hydrating session task state failed; the route answered with an error.",
|
|
134
|
+
"sessions.reconcile-failed": "Reconciling persisted sessions failed; the sessions already known are listed.",
|
|
135
|
+
"sse.aborted": "The client closed an event stream.",
|
|
136
|
+
"sse.cleanup": "An event stream connection was released.",
|
|
137
|
+
"sse.closed": "An event stream was closed by the bridge; the client reconnects and replays.",
|
|
138
|
+
"sse.handshake-failed": "An event stream failed during its handshake; the client reconnects.",
|
|
139
|
+
"sse.keepalive-failed": "An event stream keepalive failed, usually a client that has gone; the connection closes.",
|
|
140
|
+
"sse.opened": "An event stream connection opened.",
|
|
141
|
+
"sse.subscribe-requested": "A client asked to subscribe to the event stream.",
|
|
142
|
+
"sse.write-failed": "Writing to an event stream failed; the connection closes and the client reconnects.",
|
|
143
|
+
"task.candidate-bound-reached": "An unresolved Bash call was not tracked as a background task: the candidate bound is full.",
|
|
144
|
+
"task.details-persist-failed": "Shell task details could not be saved; the task carries on.",
|
|
145
|
+
"task.settling-bound-reached": "A settling task was not tracked: the settling bound is full.",
|
|
146
|
+
"task.stop-failed": "Stopping a background task failed on a control channel that had closed.",
|
|
147
|
+
"task.stop-route-failed": "The stop-task route failed.",
|
|
148
|
+
"transcript.background-hydrate-failed": "Hydrating a transcript in the background failed; the next read retries.",
|
|
149
|
+
"transcript.hydrate-failed": "Hydrating a transcript before a prompt failed; the prompt runs and a later read retries."
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"bridge.codex": {
|
|
153
|
+
description: "The Codex bridge: its routes, sessions and the app-server child it supervises.",
|
|
154
|
+
events: {
|
|
155
|
+
"account.connector-recovery-failed": "Recovering account connectors failed; the account answer stands.",
|
|
156
|
+
"account.login-reload-failed": "Reloading the stored account login failed.",
|
|
157
|
+
"account.sign-in-check-failed": "An account sign-in check failed; admission is left unchanged.",
|
|
158
|
+
"account.usage-read-failed": "Reading account usage failed; the route answers 503.",
|
|
159
|
+
"app-server.drain-expired": "The drain deadline expired, so app-server restarted with turns still in flight.",
|
|
160
|
+
"app-server.exited": "app-server exited unexpectedly; the code and signal say how.",
|
|
161
|
+
"app-server.invariant-violation": "app-server asked for something its configuration forbids.",
|
|
162
|
+
"app-server.protocol-violation": "app-server wrote a line that is not valid protocol; it was ignored.",
|
|
163
|
+
"app-server.recording": "Notification recording is on; recordings hold content.",
|
|
164
|
+
"app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
|
|
165
|
+
"app-server.stderr": "Metadata of an app-server stderr line, never its content.",
|
|
166
|
+
"app-server.stderr-suppressed": "app-server stderr lines beyond the budget were counted, not described.",
|
|
167
|
+
"approval.cancel-failed": "Cancelling a turn after an approval answer failed.",
|
|
168
|
+
"approval.present-failed": "Presenting an approval threw; it is auto-declined.",
|
|
169
|
+
"approval.resolved-callback-failed": "An approval resolved callback threw.",
|
|
170
|
+
"command-changes.record-failed": "Recording line changes for a command failed; the turn carries on.",
|
|
171
|
+
"dispatch.reconcile-failed": "A dispatch could not be reconciled against its thread; it stays recovering.",
|
|
172
|
+
"dispatch.restore-failed": "A journaled dispatch could not be restored after a restart; recovery retries.",
|
|
173
|
+
"engine.listener-failed": "An engine event listener threw; the others still ran.",
|
|
174
|
+
"engine.ready": "The app-server engine started.",
|
|
175
|
+
"engine.start-failed": "The app-server engine failed to start; reported through health.",
|
|
176
|
+
"engine.stop-failed": "Stopping the Codex engine failed during shutdown; the bridge exits anyway.",
|
|
177
|
+
"generation.recovery-failed": "Recovering sessions after an app-server generation change failed.",
|
|
178
|
+
"http.request-failed": "An HTTP route threw; it answered 500.",
|
|
179
|
+
"idle-sweep.failed": "An idle sweep failed; the next one retries.",
|
|
180
|
+
"interaction.present-failed": "Presenting an interaction threw; it is cancelled.",
|
|
181
|
+
"interaction.resolved-callback-failed": "An interaction resolved callback threw.",
|
|
182
|
+
"journal.persist-failed": "Saving the dispatch journal failed.",
|
|
183
|
+
"message.publish-failed": "Publishing a message update failed.",
|
|
184
|
+
"models.cache-persist-failed": "Saving the model cache failed.",
|
|
185
|
+
"models.debug-read-failed": "`codex debug models` failed; another source is used.",
|
|
186
|
+
"models.list-failed": "model/list failed; the cached models are served.",
|
|
187
|
+
"models.refresh-failed": "A background model refresh failed; the cache stands.",
|
|
188
|
+
"notification.enqueue-failed": "Queueing a notification threw.",
|
|
189
|
+
"ordered-events.flush-failed": "Flushing before ordered-event reconciliation failed.",
|
|
190
|
+
"ordered-events.publish-failed": "Publishing an ordered event failed; clients are told to rehydrate.",
|
|
191
|
+
"ordered-events.reconcile-failed": "Reconciling ordered events failed.",
|
|
192
|
+
"parent.gone": "The backend that launched this bridge has gone; stopping turns and shutting down.",
|
|
193
|
+
"queue.task-failed": "A task on a per-thread queue failed.",
|
|
194
|
+
"raw-log.write-failed": "Appending to the raw Codex log failed.",
|
|
195
|
+
"recorder.notice": "The notification recorder needs attention: it is on, or was asked for without its confirmation.",
|
|
196
|
+
"recorder.threw": "The notification recorder threw.",
|
|
197
|
+
"recorder.write-failed": "Writing a notification recording failed; its lines were dropped.",
|
|
198
|
+
"registry.persist-failed": "Saving the session registry failed; a later write retries.",
|
|
199
|
+
"rollout.hydrate-failed": "A rollout could not be read to hydrate a thread.",
|
|
200
|
+
"runtime-env.refresh-failed": "Refreshing the runtime environment failed; the last values stay.",
|
|
201
|
+
"runtime-env.refreshed": "Runtime environment variables changed; names only, never values.",
|
|
202
|
+
"server-request.answer-failed": "Answering a server request failed.",
|
|
203
|
+
"server-request.flush-timeout": "An answer to a server request did not flush in time.",
|
|
204
|
+
"server-request.handoff-failed": "Handing a server request to the router threw.",
|
|
205
|
+
"session.config-apply-failed": "Applying session configuration failed; the route answers unavailable.",
|
|
206
|
+
"sse.closed": "An event stream was closed by the bridge; the client reconnects and replays.",
|
|
207
|
+
"sse.keepalive-failed": "An event stream keepalive failed.",
|
|
208
|
+
"sse.observer-failed": "An event stream observer failed; it reconnects.",
|
|
209
|
+
"sse.payload-serialize-failed": "An event payload could not be serialized; a placeholder was sent.",
|
|
210
|
+
"sse.payload-snapshot-failed": "An event payload could not be snapshotted; a placeholder was sent.",
|
|
211
|
+
"sse.subscriber-failed": "An event stream subscriber failed; it reconnects and replays.",
|
|
212
|
+
"subagent.activity-load-failed": "Sub-agent activity could not be loaded; the transcript renders without it.",
|
|
213
|
+
"thread.archive-failed": "Archiving or unarchiving a thread failed.",
|
|
214
|
+
"thread.fork-failed": "thread/fork failed; the route answers 503.",
|
|
215
|
+
"thread.fork-hydrate-failed": "A forked thread could not be hydrated and was closed.",
|
|
216
|
+
"thread.reattach-failed": "A thread could not be re-attached.",
|
|
217
|
+
"thread.rename-failed": "thread/name/set failed; the bridge title index stays authoritative.",
|
|
218
|
+
"thread.turns-read-after-revert-failed": "A thread's turns could not be read after a revert.",
|
|
219
|
+
"thread.turns-read-failed": "A thread's turns could not be read.",
|
|
220
|
+
"thread.unsubscribe-failed": "thread/unsubscribe failed; the binding is kept so a retry can unsubscribe.",
|
|
221
|
+
"threads.list-failed": "thread/list failed; sessions come from the rollout parser.",
|
|
222
|
+
"transcript.serving-last-known": "A thread read failed, so the last known transcript is served.",
|
|
223
|
+
"turn.capacity-retry-failed": "Retrying a turn after a capacity failure failed.",
|
|
224
|
+
"turn.capacity-retry-journal-failed": "A capacity retry could not be journaled.",
|
|
225
|
+
"turn.finalize-failed": "Finalizing a turn failed.",
|
|
226
|
+
"turns.stopped": "Running turns were stopped because the backend went away."
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"bridge.cursor": {
|
|
230
|
+
description: "The Cursor bridge: its routes, sessions and saved state.",
|
|
231
|
+
events: {
|
|
232
|
+
"agent.archive-failed": "Archiving or unarchiving an agent failed.",
|
|
233
|
+
"http.route-failed": "An HTTP route failed unexpectedly; its error is not logged because it can hold content.",
|
|
234
|
+
"startup.closes-failed": "Finishing closes a previous process left behind failed at startup.",
|
|
235
|
+
"startup.closes-incomplete": "Some closes a previous process left behind did not finish at startup; a retried close finishes them.",
|
|
236
|
+
"state.publication-failing": "Saving bridge state is failing; new prompts and steers are refused until it recovers.",
|
|
237
|
+
"state.publication-recovered": "Saving bridge state recovered.",
|
|
238
|
+
"state.transcripts-shortened": "The state file reached its limit, so some sessions were saved with a shortened transcript copy."
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"bridge.pi": {
|
|
242
|
+
description: "The Pi bridge: its routes, sessions and saved state.",
|
|
243
|
+
events: {
|
|
244
|
+
"http.route-failed": "An HTTP route failed unexpectedly; its error is not logged because it can hold content.",
|
|
245
|
+
"state.over-budget": "The state file stayed over budget after shedding transcripts, so the write was skipped.",
|
|
246
|
+
"state.transcripts-shed": "The state file was over budget, so some sessions were saved without their transcript."
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// ../protocol/src/log-vocabulary/desktop.ts
|
|
252
|
+
var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
253
|
+
desktop: {
|
|
254
|
+
description: "The Electron main process: startup, windows, quit and the Local backend's life.",
|
|
255
|
+
events: {
|
|
256
|
+
"backend.docker-context-seed-failed": "An agent-test profile fell back to the default Docker context.",
|
|
257
|
+
"backend.exited": "The Local backend exited unexpectedly; Local work is unavailable.",
|
|
258
|
+
"backend.exited-recovering": "The Local backend exited just after a remote update; relaunching unattended.",
|
|
259
|
+
"backend.keychain-link-remove-failed": "An agent-test profile kept a legacy link to the host keychain.",
|
|
260
|
+
"backend.start-failed": "The Local backend did not start; continuing with remote machines.",
|
|
261
|
+
"clipboard.write-failed": "Writing text to the system clipboard failed.",
|
|
262
|
+
"instance.already-running": "Another instance holds this data directory; this one will quit.",
|
|
263
|
+
"main-thread.stalled": "A timer fired late, so windows, IPC and the stdout reader waited.",
|
|
264
|
+
"quit.stopping-backend": "The app is quitting and has asked the Local backend to stop.",
|
|
265
|
+
"relaunch.schedule-failed": "The AppImage relaunch waiter failed; using Electron's relauncher.",
|
|
266
|
+
"relaunch.service-register-failed": "The AppImage relaunch service was refused; using a detached waiter.",
|
|
267
|
+
"renderer.gone-giving-up": "A renderer kept dying, so the window is no longer reloaded.",
|
|
268
|
+
"renderer.gone-reloading": "A renderer died and the window is being reloaded.",
|
|
269
|
+
"renderer.reload-failed": "Reloading a window after its renderer died failed.",
|
|
270
|
+
"restart-prompt.failed": "A native restart prompt could not be shown.",
|
|
271
|
+
"saved-machines.attach-failed": "Saved machines were not imported into the command node yet.",
|
|
272
|
+
"saved-machines.attached": "Saved machines were imported into the local command node.",
|
|
273
|
+
"startup.failed": "The application failed to start.",
|
|
274
|
+
"uncaught-exception": "The main process hit an uncaught exception.",
|
|
275
|
+
"uncaught-exception.dialog-failed": "The uncaught exception sheet could not be shown.",
|
|
276
|
+
"window.create-failed": "A menu-driven new window could not be created.",
|
|
277
|
+
"window.recreate-failed": "The main window could not be recreated on activation.",
|
|
278
|
+
"window.second-launch-failed": "A second launch could not open a window."
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"desktop.startup": {
|
|
282
|
+
description: "Renderer startup markers and renderer process failures. These are the only events the renderer can place in the persistent log.",
|
|
283
|
+
tag: "DesktopStartup",
|
|
284
|
+
events: {
|
|
285
|
+
"backend-unavailable": "The renderer could not complete a Local backend read in time.",
|
|
286
|
+
"bridge-unavailable": "The preload API or connection-list IPC did not answer.",
|
|
287
|
+
checking: "The renderer began waiting for the desktop connection.",
|
|
288
|
+
"page-load-failed": "Chromium failed to load the main document.",
|
|
289
|
+
"preload-failed": "Electron rejected the preload script.",
|
|
290
|
+
ready: "The renderer reached the desktop connection and may mount the workspace.",
|
|
291
|
+
"renderer-error": "An uncaught error occurred while the renderer was starting.",
|
|
292
|
+
"renderer-gone": "A renderer process exited.",
|
|
293
|
+
"renderer-load-failed": "Importing or mounting the application failed.",
|
|
294
|
+
"unhandled-rejection": "An unhandled rejection occurred while the renderer was starting."
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"desktop.dialog": {
|
|
298
|
+
description: "Native dialogs, whose modal loops hold the main thread while they are open.",
|
|
299
|
+
events: {
|
|
300
|
+
"attention-failed": "A dialog could not ask for the user's attention.",
|
|
301
|
+
closed: "A native dialog closed.",
|
|
302
|
+
"open-failed": "A dialog could not open; it was answered as cancelled.",
|
|
303
|
+
opening: "A native dialog is opening.",
|
|
304
|
+
"preview-beforeunload-ignored": "A browser preview's beforeunload handler was ignored.",
|
|
305
|
+
"renderer-beforeunload-cancelled": "A renderer's beforeunload handler cancelled an unload."
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
"backend.client": {
|
|
309
|
+
description: "The desktop's HTTP and event stream client for a backend.",
|
|
310
|
+
events: {
|
|
311
|
+
"event-stream.disconnected": "The event stream dropped; the client reconnects with backoff.",
|
|
312
|
+
"event-stream.malformed-frame": "An event stream frame could not be parsed and was dropped."
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
connections: {
|
|
316
|
+
description: "The desktop's saved machines and active connection.",
|
|
317
|
+
events: {
|
|
318
|
+
"catalogue.legacy-read-failed": "The previous connection list could not be read to migrate.",
|
|
319
|
+
"catalogue.restored-from-backup": "The device catalogue was unreadable; the backup was used.",
|
|
320
|
+
"restore.failed": "The previous remote connection could not be restored; using Local.",
|
|
321
|
+
"secure-storage.waiting": "Startup is waiting on an operating system keychain prompt."
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
workspaces: {
|
|
325
|
+
description: "Workspace realms the desktop holds on other machines.",
|
|
326
|
+
events: {
|
|
327
|
+
"route.moved-direct": "A relayed workspace moved to its direct route."
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
toolchain: {
|
|
331
|
+
description: "Preparing the pinned agent toolchain at desktop startup.",
|
|
332
|
+
events: {
|
|
333
|
+
"bootstrap-progress.show-failed": "The toolchain progress window could not be shown.",
|
|
334
|
+
"prepare.failed": "Preparing the pinned agent tools failed."
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"artifact-host": {
|
|
338
|
+
description: "Live artifact hosts in the desktop app.",
|
|
339
|
+
events: {
|
|
340
|
+
"host.ended": "A host ended; fields count its blocked and rejected requests by reason."
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// ../protocol/src/log-vocabulary/environment.ts
|
|
346
|
+
var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
347
|
+
environment: {
|
|
348
|
+
description: "Environment naming, held setup and cleanup after deletion.",
|
|
349
|
+
events: {
|
|
350
|
+
"cleanup.branch-kept": "A deleted environment's local branch was kept, as it may hold unmerged work.",
|
|
351
|
+
"rename.failed": "Naming an environment from its pending prompt failed for the first time.",
|
|
352
|
+
"rename.still-failing": "That rename is still failing; written at the 2nd, 4th, 8th... failure.",
|
|
353
|
+
"rename.recovered": "A rename from a pending prompt succeeded after failing.",
|
|
354
|
+
"setup.attention-not-recorded": "Held setup could not be recorded as needing the user's attention.",
|
|
355
|
+
"setup.coordinator-not-notified": "The worker's coordinator could not be told that its setup is held for approval.",
|
|
356
|
+
"setup.unknown-environment": "The renderer was asked to act on the setup of an environment it does not hold.",
|
|
357
|
+
...THROTTLE_LOG_EVENTS
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
// ../protocol/src/log-vocabulary/gateway.ts
|
|
363
|
+
var GATEWAY_LOG_AREAS = defineLogAreas({
|
|
364
|
+
gateway: {
|
|
365
|
+
description: "The remote gateway other devices and browsers connect through.",
|
|
366
|
+
events: {
|
|
367
|
+
"remote.start-failed": "The desktop could not start the remote gateway.",
|
|
368
|
+
"remote.stop-failed": "The desktop could not stop the remote gateway cleanly."
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// ../protocol/src/log-vocabulary/local-server.ts
|
|
374
|
+
var LOCAL_SERVER_LOG_AREAS = defineLogAreas({
|
|
375
|
+
"local-server": {
|
|
376
|
+
description: "Agent bridge processes the backend runs on the host.",
|
|
377
|
+
events: {
|
|
378
|
+
"bridge.not-answering": "A bridge with work in progress fails health checks, so it is not restarted yet.",
|
|
379
|
+
...THROTTLE_LOG_EVENTS
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
// ../protocol/src/log-vocabulary/git.ts
|
|
385
|
+
var GIT_LOG_AREAS = defineLogAreas({
|
|
386
|
+
git: {
|
|
387
|
+
description: "Git operations the backend runs in environment worktrees and containers.",
|
|
388
|
+
events: {
|
|
389
|
+
"branch.rename-failed": "Renaming an environment's branch failed; the stored name is kept.",
|
|
390
|
+
"branch.push-config-failed": "A branch was renamed but its push settings could not be written; the rename is undone.",
|
|
391
|
+
"branch.rollback-failed": "Undoing a branch rename failed; the stored name follows whichever branch now exists."
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
// ../protocol/src/log-vocabulary/logging.ts
|
|
397
|
+
var LOGGING_LOG_AREAS = defineLogAreas({
|
|
398
|
+
logging: {
|
|
399
|
+
description: "The logger and the on-disk application log themselves.",
|
|
400
|
+
events: {
|
|
401
|
+
"capture.started": "Saving logs to disk began for this process.",
|
|
402
|
+
"capture.stopped": "Saving logs to disk stopped for this process.",
|
|
403
|
+
"config.invalid": "A logging environment variable held a value that was ignored.",
|
|
404
|
+
"entries.dropped": "The log queue was full, so entries were dropped and counted.",
|
|
405
|
+
"policy.changed": "The logging settings changed: saving, retention and levels, with no content.",
|
|
406
|
+
"policy.bridge-predates-route": "A running bridge has no logging settings route; it applies them at its next start.",
|
|
407
|
+
"policy.push-failed": "A running bridge did not take the logging settings after retries; its next start resends them.",
|
|
408
|
+
"prune.failed": "Removing expired log files failed; the next sweep retries.",
|
|
409
|
+
"write.failed": "Appending to the log file failed.",
|
|
410
|
+
"unknown-area": "Code outside the type checker asked for an area that is not listed."
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
// ../protocol/src/log-vocabulary/models.ts
|
|
416
|
+
var MODEL_LOG_AREAS = defineLogAreas({
|
|
417
|
+
models: {
|
|
418
|
+
description: "Agent model catalogues and their persistent caches.",
|
|
419
|
+
events: {
|
|
420
|
+
"cache.write-failed": "A successful catalogue refresh could not update the host cache."
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
// ../protocol/src/log-vocabulary/native-agent.ts
|
|
426
|
+
var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
427
|
+
"native-agent": {
|
|
428
|
+
description: "Native agent sessions and what the backend reads from their bridges.",
|
|
429
|
+
events: {
|
|
430
|
+
"catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
|
|
431
|
+
...THROTTLE_LOG_EVENTS
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// ../protocol/src/log-vocabulary/preview.ts
|
|
437
|
+
var PREVIEW_LOG_AREAS = defineLogAreas({
|
|
438
|
+
preview: {
|
|
439
|
+
description: "Browser and service previews: transports, partitions and captures.",
|
|
440
|
+
events: {
|
|
441
|
+
"attachment.release-failed": "Releasing a preview attachment failed; its lease expires it.",
|
|
442
|
+
"capture-spool.load-failed": "The pending browser capture spool could not be loaded.",
|
|
443
|
+
"certificate.refresh-failed": "Re-reading the preview certificate failed; the next check retries.",
|
|
444
|
+
"certificate.renewal-refused": "A renewed certificate does not cover the preview hosts, so it was ignored.",
|
|
445
|
+
"connection-cleanup.record-failed": "A forgotten connection's cleanup could not be recorded.",
|
|
446
|
+
"link.open-external-failed": "A preview link could not be opened in the system browser.",
|
|
447
|
+
"node.record-failed": "A node that owns preview partitions could not be recorded.",
|
|
448
|
+
"partition.clear-failed": "A preview partition could not be cleared.",
|
|
449
|
+
"partitions.record-cleared-failed": "Cleared preview partitions could not be recorded.",
|
|
450
|
+
"partitions.record-nodes-failed": "The nodes that own preview partitions could not be saved.",
|
|
451
|
+
"partitions.remove-failed": "Cleared preview partition directories could not be removed.",
|
|
452
|
+
"partitions.retry-forgotten-failed": "Retrying a forgotten preview cleanup failed.",
|
|
453
|
+
"port-hints.persist-failed": "Preview port hints could not be saved.",
|
|
454
|
+
"transport.close-failed": "A preview transport could not be closed.",
|
|
455
|
+
...THROTTLE_LOG_EVENTS
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
// ../protocol/src/log-vocabulary/runtime.ts
|
|
461
|
+
var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
462
|
+
"event-loop": {
|
|
463
|
+
description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
|
|
464
|
+
events: {
|
|
465
|
+
stalled: "A timer fired late, so every request in that window waited."
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
// ../protocol/src/log-vocabulary/terminal.ts
|
|
471
|
+
var TERMINAL_LOG_AREAS = defineLogAreas({
|
|
472
|
+
terminal: {
|
|
473
|
+
description: "The renderer's terminal. Its lines stay in the browser console, never the saved log.",
|
|
474
|
+
events: {
|
|
475
|
+
"input.undelivered": "A keystroke did not reach a shell: `no-session` or `not-delivered`.",
|
|
476
|
+
"input.resume-failed": "Asking the backend to resume refused terminal input failed.",
|
|
477
|
+
"input.write-failed": "Writing input to a terminal session threw.",
|
|
478
|
+
"listener.remove-failed": "Removing a terminal output listener threw.",
|
|
479
|
+
"listener.released": "A terminal hook unmounted and dropped its output listener.",
|
|
480
|
+
"session.unmounted": "A terminal hook unmounted; the shell keeps running.",
|
|
481
|
+
"connect.called": "A terminal hook began connecting to a session.",
|
|
482
|
+
"output.reconcile-failed": "Output could not be reconciled against the backend snapshot.",
|
|
483
|
+
"session.stopped-while-disconnected": "A session ended while its event stream was down.",
|
|
484
|
+
"session.disconnect-failed": "Closing or detaching a terminal session failed.",
|
|
485
|
+
"session.resize-failed": "Resizing a terminal session failed, other than for a gone session.",
|
|
486
|
+
"session.id-stored": "A new backend session id was saved for a terminal tab.",
|
|
487
|
+
"session-key.environment-missing": "A local session key was built with no environment id.",
|
|
488
|
+
"clipboard.image-failed": "An image pasted into a terminal could not be saved.",
|
|
489
|
+
"clipboard.copy-failed": "Copying a terminal selection to the clipboard failed.",
|
|
490
|
+
"clipboard.paste-failed": "A paste into a terminal failed; `target` says which path.",
|
|
491
|
+
"clipboard.process-failed": "Reading or storing clipboard data for a paste failed.",
|
|
492
|
+
"clipboard.image-save-failed": "An image from a paste event could not be written to disk.",
|
|
493
|
+
"environment.ready-detected": "A first tab's output showed that the workspace is ready.",
|
|
494
|
+
"shell.ready-detected": "A later tab's output showed that its shell is ready.",
|
|
495
|
+
"setup.scripts-completed": "A setup tab's scripts reported their end by an escape code.",
|
|
496
|
+
"setup.marked-complete": "The user marked a setup tab complete by hand.",
|
|
497
|
+
"setup.awaiting-detection": "A first tab connected and is watching output for readiness.",
|
|
498
|
+
"reconnect.setup-marker-found": "A reconnected tab's buffer already held the setup marker.",
|
|
499
|
+
"reconnect.setup-marker-absent": "A reconnected first tab's buffer lacked the setup marker.",
|
|
500
|
+
"reconnect.completed": "A terminal tab finished reconnecting to its session.",
|
|
501
|
+
"restore.setup-marker-found": "A restored tab's buffer already held the setup marker.",
|
|
502
|
+
"persistent-sessions.load-failed": "Listing an environment's saved sessions failed.",
|
|
503
|
+
"persistent-session.restoring": "A tab began restoring from its saved session.",
|
|
504
|
+
"persistent-session.found": "A tab found its saved session already recorded.",
|
|
505
|
+
"persistent-session.creating": "A tab began recording a saved session for the sidebar.",
|
|
506
|
+
"persistent-session.created": "A saved session for the sidebar was recorded.",
|
|
507
|
+
"persistent-session.create-failed": "Recording a saved session for the sidebar failed.",
|
|
508
|
+
"persistent-session.status-update-failed": "Marking a saved session connected failed.",
|
|
509
|
+
"persistent-session.activity-update-failed": "Updating a saved session's activity failed.",
|
|
510
|
+
"persistent-buffer.loaded": "A saved session's buffer loaded; only its length is logged.",
|
|
511
|
+
"persistent-buffer.load-failed": "A saved session's buffer could not be loaded.",
|
|
512
|
+
"persistent-buffer.save-failed": "Saving a session's buffer during cleanup failed.",
|
|
513
|
+
"buffer.restore-failed": "Writing a saved buffer back into a terminal threw.",
|
|
514
|
+
"buffer.serialize-failed": "Serializing a terminal's buffer during cleanup threw.",
|
|
515
|
+
"command.launching": "A tab began launching its command in a new session.",
|
|
516
|
+
"bootstrap.failed": "A launch request for a new session failed; it may retry.",
|
|
517
|
+
"setup-session.bind-failed": "Looking up or binding the backend setup session failed.",
|
|
518
|
+
"setup-tab.stale-removed": "A setup placeholder tab with no session was removed.",
|
|
519
|
+
"multi-reviews.restore-failed": "Multi-review tabs could not be restored for an environment.",
|
|
520
|
+
"pane-layout.restore-failed": "An environment's saved pane layout could not be read.",
|
|
521
|
+
"pane-layout.history-migrate-failed": "Stripping private browser history fields failed.",
|
|
522
|
+
"pane-layout.snapshot-remove-failed": "Removing an unusable pane layout snapshot failed.",
|
|
523
|
+
"pane-layout.selection-migrate-failed": "Saving a migrated legacy pane selection failed.",
|
|
524
|
+
"panes.reset": "An environment's panes were reset: its container changed or stopped.",
|
|
525
|
+
"tabs.limit-reached": "A new tab was refused because the tab limit was reached.",
|
|
526
|
+
"tab.created": "A new tab was added to a pane; `tabType` says which kind.",
|
|
527
|
+
"tab.activated": "Opening a file selected the tab that already held it.",
|
|
528
|
+
"tab.duplicate-refused": "A new tab was refused because its requested id is in use.",
|
|
529
|
+
"tab.multi-review-refused": "A multi-review tab was refused for lack of a workflow id.",
|
|
530
|
+
"tab.split-at-edge": "A dragged tab split a pane at one of its edges.",
|
|
531
|
+
"tab.reordered": "A dragged tab moved within its pane.",
|
|
532
|
+
"tab.moved": "A dragged tab moved to another pane.",
|
|
533
|
+
"drag.ended": "A tab drag ended, whether or not it landed on a target.",
|
|
534
|
+
"display.state": "The terminal container's overlays and tab count, on each dev render.",
|
|
535
|
+
"compose.draft-restore-failed": "A saved compose draft could not be read.",
|
|
536
|
+
"compose.draft-persist-failed": "A compose draft could not be saved or discarded.",
|
|
537
|
+
"compose.image-too-large": "A pasted image stayed over the attachment limit after resizing.",
|
|
538
|
+
"compose.image-add-failed": "Adding a pasted image to the compose bar failed.",
|
|
539
|
+
"compose.image-save-failed": "Saving one compose image for sending failed; the rest proceed.",
|
|
540
|
+
"compose.send-failed": "Sending from the compose bar failed.",
|
|
541
|
+
"init-logs.load-failed": "A container's initialization logs could not be loaded.",
|
|
542
|
+
"init-logs.refresh-stopped": "A container's initialization logs stopped refreshing.",
|
|
543
|
+
"portal.terminal-created": "The portal host created a terminal for a new tab.",
|
|
544
|
+
"portal.terminal-disposed": "The portal host disposed a terminal for a removed tab.",
|
|
545
|
+
"link.open-failed": "Opening a terminal link in the external browser failed.",
|
|
546
|
+
"canvas.context-unavailable": "A resize canvas had no 2D context; the original is kept.",
|
|
547
|
+
...THROTTLE_LOG_EVENTS
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
"terminal.setup": {
|
|
551
|
+
description: "The renderer attaching a backend-managed environment setup terminal.",
|
|
552
|
+
events: {
|
|
553
|
+
"session.bind-from-environment": "The environment hook bound a setup session to a tab.",
|
|
554
|
+
"setup.started-received": "An environment-setup-started event arrived.",
|
|
555
|
+
"setup.complete-received": "An environment-setup-complete event arrived.",
|
|
556
|
+
"attach.state-changed": "A setup tab's attach inputs changed; runs per effect pass.",
|
|
557
|
+
"terminal.preserve-failed": "Keeping a setup terminal's buffer before conversion failed.",
|
|
558
|
+
"tab.marker-retired": "A setup tab with no live PTY stopped being a setup tab.",
|
|
559
|
+
"tab.added": "The backend-managed setup tab was added to a new layout.",
|
|
560
|
+
"session.bind-skipped": "A setup session lookup was already running for this tab.",
|
|
561
|
+
"session.requested": "A tab asked the backend for its setup session.",
|
|
562
|
+
"session.unavailable": "The backend had no setup session to give a tab.",
|
|
563
|
+
"session.bind-started": "A backend setup session was found and is being bound to a tab.",
|
|
564
|
+
"session.awaited": "The layout is waiting for a setup session before adding the tab.",
|
|
565
|
+
"reconcile.started": "The reconcile effect found setup tabs that still need a session.",
|
|
566
|
+
"reconnect-listener.install-failed": "Listening for event stream reconnects failed.",
|
|
567
|
+
"layout.initial-decided": "An empty layout was evaluated for its setup tab; runs per effect."
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
// ../protocol/src/log-vocabulary/tmux.ts
|
|
573
|
+
var TMUX_LOG_AREAS = defineLogAreas({
|
|
574
|
+
tmux: {
|
|
575
|
+
description: "The poll loop behind a Claude tmux tab.",
|
|
576
|
+
events: {
|
|
577
|
+
"poll.discovery-failed": "Finding the session's transcript failed; a later tick retries.",
|
|
578
|
+
"poll.snapshot-failed": "Reading the hook and transcript state failed; the next tick retries.",
|
|
579
|
+
"poll.drain-pending-failed": "Delivering pending hook events failed; the next tick retries.",
|
|
580
|
+
"poll.drain-timeouts-failed": "Delivering hook timeouts failed; the next tick retries.",
|
|
581
|
+
"poll.tail-failed": "Reading new transcript lines failed; the next tick retries.",
|
|
582
|
+
...THROTTLE_LOG_EVENTS
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
// ../protocol/src/log-vocabulary/updater.ts
|
|
588
|
+
var UPDATER_LOG_AREAS = defineLogAreas({
|
|
589
|
+
updater: {
|
|
590
|
+
description: "Desktop self-update: electron-updater and updates a remote client requested.",
|
|
591
|
+
events: {
|
|
592
|
+
"channel.following": "Update checks now follow a different release channel.",
|
|
593
|
+
"check-report.failed": "A check's result could not be reported.",
|
|
594
|
+
"check.failed": "An update check failed; the next periodic check retries.",
|
|
595
|
+
"download.failed": "Downloading or staging an update failed.",
|
|
596
|
+
downloaded: "An update finished downloading.",
|
|
597
|
+
"library.message": "One line from electron-updater at its own level. Its debug output, which includes the differential download plan, is off by default.",
|
|
598
|
+
"remote.check-failed": "A check a remote client requested failed.",
|
|
599
|
+
"remote.installing": "Installing an update for a remote client.",
|
|
600
|
+
"remote.read-failed": "Update requests could not be read from the Local backend.",
|
|
601
|
+
"remote.relaunch-prepare-failed": "Preparing the relaunch after a remote update failed.",
|
|
602
|
+
"remote.relaunched": "The app relaunched to finish a remote client's update.",
|
|
603
|
+
"remote.report-failed": "An update report could not reach the Local backend.",
|
|
604
|
+
"remote.restart-not-recorded": "The backend did not record a restart, so it was not installed.",
|
|
605
|
+
"remote.unavailable": "Updates requested by remote clients are unavailable in this session.",
|
|
606
|
+
"restart-prompt.failed": "The restart prompt for a downloaded update failed.",
|
|
607
|
+
unavailable: "Auto-update could not be set up in this session.",
|
|
608
|
+
"update.failed": "electron-updater reported an update error."
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
// ../protocol/src/log-vocabulary/web-annotations.ts
|
|
614
|
+
var WEB_ANNOTATIONS_LOG_AREAS = defineLogAreas({
|
|
615
|
+
"web-annotations": {
|
|
616
|
+
description: "Web annotation requests and their background reconciler.",
|
|
617
|
+
events: {
|
|
618
|
+
"reconcile.failed": "A background reconcile pass failed; the next one retries.",
|
|
619
|
+
...THROTTLE_LOG_EVENTS
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
// ../protocol/src/log-vocabulary/web-app.ts
|
|
625
|
+
var WEB_APP_LOG_AREAS = defineLogAreas({
|
|
626
|
+
"web.app": {
|
|
627
|
+
description: "The application root: startup checks and restoring state.",
|
|
628
|
+
events: {
|
|
629
|
+
"config.load-failed": "The application config could not be loaded.",
|
|
630
|
+
"docker.check-failed": "A Docker availability probe failed; the result stays unknown.",
|
|
631
|
+
"docker.checked": "A Docker availability check finished.",
|
|
632
|
+
"docker.orphans-cleared": "Reconciling with Docker cleared orphaned container references.",
|
|
633
|
+
"docker.sync-failed": "Reconciling environments with Docker failed; non-fatal.",
|
|
634
|
+
"prompt-queues.restore-failed": "An environment's prompt queues could not be restored.",
|
|
635
|
+
"multi-reviews.restore-failed": "An environment's multi reviews could not be restored.",
|
|
636
|
+
"build-pipelines.migrate-failed": "Migrating legacy build pipelines failed; the next launch retries.",
|
|
637
|
+
"build-pipelines.restore-failed": "A project's build pipelines could not be restored.",
|
|
638
|
+
"macos-permissions.check-failed": "Reading macOS file permission status failed.",
|
|
639
|
+
"cli-check.failed": "One startup CLI check failed; its result stays unknown.",
|
|
640
|
+
"cli-check.completed": "A startup CLI check finished; one line per tool.",
|
|
641
|
+
"cli-check.retried": "A user-requested CLI recheck finished.",
|
|
642
|
+
"cli-check.retry-failed": "A user-requested CLI recheck failed.",
|
|
643
|
+
"exit.failed": "Exiting through the plugin failed; the window closes instead.",
|
|
644
|
+
"zoom.native-failed": "Applying native zoom failed; the CSS fallback is used.",
|
|
645
|
+
"github-cli.status-failed": "Reading the GitHub CLI setup status failed.",
|
|
646
|
+
"attachments.restore-failed": "Saved prompt attachments could not be restored before startup.",
|
|
647
|
+
"startup-launch.persist-failed": "Saving the startup agent launch failed; nothing started.",
|
|
648
|
+
"environment.start-failed": "Starting an environment from the terminal overlay failed.",
|
|
649
|
+
"project.delete-failed": "Deleting a project from its dialog failed."
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
"web.session": {
|
|
653
|
+
description: "The renderer's terminal and agent session store.",
|
|
654
|
+
events: {
|
|
655
|
+
"status.update-failed": "A session status change could not be saved.",
|
|
656
|
+
"activity.update-failed": "A best-effort session activity update failed.",
|
|
657
|
+
"environment-sessions.disconnect-failed": "Disconnecting an environment's sessions failed.",
|
|
658
|
+
"container-sessions.sync-failed": "Syncing sessions with container state failed.",
|
|
659
|
+
"reorder.failed": "Reordering sessions failed; the list reloads from the backend.",
|
|
660
|
+
"refresh.manual-failed": "A manual refresh of an agent tab failed."
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
"web.action-bar": {
|
|
664
|
+
description: "The environment action bar.",
|
|
665
|
+
events: {
|
|
666
|
+
"editor.open-failed": "The external editor could not be opened.",
|
|
667
|
+
"run-commands.read-failed": "Reading the project's run commands file failed.",
|
|
668
|
+
"environment.delete-failed": "Deleting an environment from the action bar failed.",
|
|
669
|
+
"merge.started": "A user-requested PR merge started.",
|
|
670
|
+
"merge.completed": "A user-requested PR merge command returned.",
|
|
671
|
+
"merge.failed": "A user-requested PR merge failed."
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
// ../protocol/src/log-vocabulary/web-build-pipeline.ts
|
|
677
|
+
var WEB_BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
678
|
+
"web.build-pipeline": {
|
|
679
|
+
description: "Build pipelines as the renderer starts, hydrates and shows them.",
|
|
680
|
+
events: {
|
|
681
|
+
"build.start-failed": "A build could not be started.",
|
|
682
|
+
"pipeline.hydrate-failed": "A pipeline read failed; source says who asked for it.",
|
|
683
|
+
"pipeline.project-mismatch": "A pending tab activation was dropped: wrong project.",
|
|
684
|
+
"environment.not-found": "A build's environment read returned nothing after creation.",
|
|
685
|
+
"environment.project-mismatch": "A build's environment was not added: wrong project.",
|
|
686
|
+
"environment.hydrate-failed": "A build's environment read failed; live sync can recover.",
|
|
687
|
+
"transcript.load-failed": "A stage transcript read failed and will retry with backoff.",
|
|
688
|
+
"legacy.state-too-large": "Legacy pipeline state was over the limit and skipped.",
|
|
689
|
+
"opencode-catalog.load-failed": "The cached OpenCode model list could not be loaded.",
|
|
690
|
+
"opencode-preferences.load-failed": "OpenCode model preferences could not be loaded."
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
// ../protocol/src/log-vocabulary/web-chat.ts
|
|
696
|
+
var WEB_CHAT_LOG_AREAS = defineLogAreas({
|
|
697
|
+
"web.chat": {
|
|
698
|
+
description: "Rendering the agent transcript: messages, rich blocks and question cards.",
|
|
699
|
+
events: {
|
|
700
|
+
"message.copy-failed": "A message could not be copied to the clipboard.",
|
|
701
|
+
"message.long-press-failed": "A user message's long-press action failed.",
|
|
702
|
+
"message.link-open-failed": "A link in a message could not be opened.",
|
|
703
|
+
"message.render-failed": "One transcript row failed to render; fields are the bounded diagnostic.",
|
|
704
|
+
"image-preview.load-failed": "An image in a message could not be loaded for preview.",
|
|
705
|
+
"session-list.load-failed": "The resume dialog could not fetch the resumable sessions.",
|
|
706
|
+
"question.submit-failed": "An answer to an agent's question could not be submitted.",
|
|
707
|
+
"question.dismiss-failed": "An agent's question could not be dismissed.",
|
|
708
|
+
"rich-block.render-failed": "A rich block's renderer failed and its source is shown instead.",
|
|
709
|
+
"rich-block.copy-failed": "A rich block's copy action could not write to the clipboard.",
|
|
710
|
+
"scroll-viewport.not-found": "The scroll viewport was still missing when polling for it ended."
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
"web.native-agent": {
|
|
714
|
+
description: "The native agent tab and its composer.",
|
|
715
|
+
events: {
|
|
716
|
+
"model-catalogue.load-failed": "The native model catalogue could not be loaded.",
|
|
717
|
+
"provider-lock.persist-failed": "The locked agent choice could not be saved.",
|
|
718
|
+
"compose-draft.persist-failed": "A compose draft could not be saved.",
|
|
719
|
+
"compose-draft.restore-failed": "A saved compose draft could not be restored.",
|
|
720
|
+
"compose-draft.discard-failed": "A saved compose draft could not be discarded.",
|
|
721
|
+
"paste.failed": "Pasting an image into a composer failed unexpectedly.",
|
|
722
|
+
"agent-state.listen-failed": "Subscribing to a tab's agent state events failed.",
|
|
723
|
+
"model-favorites.persist-failed": "The favorite model list could not be saved."
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
// ../protocol/src/log-vocabulary/web-claude-tmux.ts
|
|
729
|
+
var WEB_CLAUDE_TMUX_LOG_AREAS = defineLogAreas({
|
|
730
|
+
"web.claude-tmux": {
|
|
731
|
+
description: "The renderer's Claude tmux chat tab and interactive terminal.",
|
|
732
|
+
events: {
|
|
733
|
+
"sessions.list-failed": "The resume dialog could not list tmux sessions.",
|
|
734
|
+
"tab.hydrate-failed": "Reading a tab's tmux session from the backend failed.",
|
|
735
|
+
"models.catalog-unavailable": "The model catalogue failed; the bundled fallback stays.",
|
|
736
|
+
"queue.promote-failed": "After an interrupt, the next queued prompt did not become the draft.",
|
|
737
|
+
"files.load-failed": "The file list for @mentions could not be loaded.",
|
|
738
|
+
"clipboard.image-failed": "An image pasted into the interactive terminal could not be saved.",
|
|
739
|
+
"terminal.resize-failed": "Resizing the interactive terminal's session failed.",
|
|
740
|
+
"terminal.recover-failed": "The interactive terminal could not reattach to its session."
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
// ../protocol/src/log-vocabulary/web-design.ts
|
|
746
|
+
var WEB_DESIGN_LOG_AREAS = defineLogAreas({
|
|
747
|
+
"web.design": {
|
|
748
|
+
description: "Opening design canvas tabs.",
|
|
749
|
+
events: {
|
|
750
|
+
"tab.duplicate-refused": "A design tab was not opened because its id is already in use."
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
// ../protocol/src/log-vocabulary/web-environment.ts
|
|
756
|
+
var WEB_ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
757
|
+
"web.environment": {
|
|
758
|
+
description: "Environment lifecycle and dialogs as the renderer drives them.",
|
|
759
|
+
events: {
|
|
760
|
+
"start.called": "The renderer was asked to start an environment.",
|
|
761
|
+
"start.unknown-environment": "A start was requested for an id the store does not hold.",
|
|
762
|
+
"start.snapshot-read": "An environment's state as its start began.",
|
|
763
|
+
"start.status-set": "The environment was marked as creating before the backend call.",
|
|
764
|
+
"start.background-requested": "A start is being handed to the backend to run in background.",
|
|
765
|
+
"start.backend-requested": "A foreground start call to the backend is being made.",
|
|
766
|
+
"start.backend-completed": "The backend finished a foreground start.",
|
|
767
|
+
"start.environment-refreshed": "An environment was read back after a foreground start.",
|
|
768
|
+
"start.worktree-missing": "A local environment started with no worktree path.",
|
|
769
|
+
"start.failed": "Starting an environment from the renderer failed.",
|
|
770
|
+
"stop.called": "The renderer was asked to stop an environment.",
|
|
771
|
+
"stop.status-set": "The environment's status was set while stopping it.",
|
|
772
|
+
"stop.backend-requested": "A stop call to the backend is being made.",
|
|
773
|
+
"stop.backend-completed": "The backend finished a stop.",
|
|
774
|
+
"stop.sessions-disconnecting": "A stopped environment's sessions are being disconnected.",
|
|
775
|
+
"stop.sessions-disconnected": "A stopped environment's sessions were disconnected.",
|
|
776
|
+
"stop.failed": "Stopping an environment from the renderer failed.",
|
|
777
|
+
"restart.failed": "Restarting an environment from the renderer failed.",
|
|
778
|
+
"status-sync.failed": "An environment's status could not be synced from the backend.",
|
|
779
|
+
"list.refresh-failed": "A background refresh of a project's environments failed.",
|
|
780
|
+
"setup-snapshot.reconcile-failed": "An environment's setup state could not be reconciled.",
|
|
781
|
+
"rename.received": "An environment-renamed event arrived.",
|
|
782
|
+
"rename.pr-state-cleared": "A rename changed the branch, so stale PR state was cleared.",
|
|
783
|
+
"unread.clear-failed": "An environment's unread work could not be cleared on the backend.",
|
|
784
|
+
"create.failed": "Creating an environment from the dialog failed.",
|
|
785
|
+
"create.port-mappings-invalid": "Creation was refused: a port is not between 1 and 65535.",
|
|
786
|
+
"create.attachment-read-failed": "A file dropped on the create dialog could not be read.",
|
|
787
|
+
"auto-start.failed": "A background start after creating an environment was rejected.",
|
|
788
|
+
"models.pi-seed-failed": "The create dialog could not seed the Pi model catalogue.",
|
|
789
|
+
"models.opencode-cache-load-failed": "The create dialog could not read cached OpenCode models.",
|
|
790
|
+
"github-credential.check-failed": "The GitHub credential check before creating failed.",
|
|
791
|
+
"feature-build.start-failed": "Starting a feature build from the dialog failed.",
|
|
792
|
+
"settings.extensions-load-failed": "The settings dialog could not load extensions.",
|
|
793
|
+
"settings.container-reset-failed": "The settings dialog could not reset the container.",
|
|
794
|
+
"settings.save-failed": "The settings dialog could not save.",
|
|
795
|
+
"domains.test-failed": "Testing whether network whitelist domains resolve failed.",
|
|
796
|
+
"network-whitelist.save-failed": "The network whitelist dialog could not save."
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
"web.sidebar": {
|
|
800
|
+
description: "The project and environment sidebar.",
|
|
801
|
+
events: {
|
|
802
|
+
"reorder.persist-failed": "A sidebar reorder could not be saved.",
|
|
803
|
+
"fork.failed": "Forking an environment from the sidebar failed.",
|
|
804
|
+
"auto-start.started": "Selecting an unstarted local environment is starting it.",
|
|
805
|
+
"auto-start.failed": "Starting a local environment on selection failed.",
|
|
806
|
+
"environment.stop-failed": "Stopping a selected environment failed.",
|
|
807
|
+
"environment.restart-failed": "Restarting a selected environment failed.",
|
|
808
|
+
"environment.delete-failed": "Deleting an environment from the sidebar failed.",
|
|
809
|
+
"environments.load-failed": "A project's environments could not be loaded for the sidebar.",
|
|
810
|
+
"project.add-failed": "Adding a project from the sidebar failed.",
|
|
811
|
+
"project.create-failed": "Creating a project from scratch failed.",
|
|
812
|
+
"project.delete-failed": "Deleting a project from the sidebar failed.",
|
|
813
|
+
"folder.project-remove-failed": "A project could not be removed from its folder.",
|
|
814
|
+
"folder.rename-failed": "A project folder could not be renamed.",
|
|
815
|
+
"folder.ungroup-failed": "A project folder could not be removed.",
|
|
816
|
+
"folder.sort-failed": "A project folder could not be sorted."
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
"web.docker": {
|
|
820
|
+
description: "The Docker settings view.",
|
|
821
|
+
events: {
|
|
822
|
+
"data.load-failed": "Container or image data could not be loaded.",
|
|
823
|
+
"container.stop-failed": "Stopping a container from Docker settings failed.",
|
|
824
|
+
"container.delete-failed": "Deleting a container from Docker settings failed.",
|
|
825
|
+
"container.reattach-failed": "Reattaching a container to a project failed."
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
"web.project": {
|
|
829
|
+
description: "Adding a project from the renderer.",
|
|
830
|
+
events: {
|
|
831
|
+
"directory-picker.failed": "The directory picker could not be opened.",
|
|
832
|
+
"git-remote.read-failed": "A chosen directory's git remote could not be read."
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
// ../protocol/src/log-vocabulary/web-files.ts
|
|
838
|
+
var WEB_FILES_LOG_AREAS = defineLogAreas({
|
|
839
|
+
"web.files": {
|
|
840
|
+
description: "The files panel, file viewer and file search.",
|
|
841
|
+
events: {
|
|
842
|
+
"file.save-failed": "A file could not be saved.",
|
|
843
|
+
"git-changes.load-failed": "The files panel could not load the git changes.",
|
|
844
|
+
"file-tree.load-failed": "The file tree could not be loaded.",
|
|
845
|
+
"changes.refresh-failed": "Refreshing the files panel's changes failed.",
|
|
846
|
+
"folder.load-failed": "An expanded folder's contents could not be loaded.",
|
|
847
|
+
"path.copy-failed": "A file's path could not be copied to the clipboard.",
|
|
848
|
+
"draft.persist-failed": "A file viewer tab's draft could not be saved.",
|
|
849
|
+
"draft.restore-failed": "A file viewer tab's saved draft could not be restored.",
|
|
850
|
+
"draft.discard-failed": "A file's saved draft could not be discarded before a reload."
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
|
|
855
|
+
// ../protocol/src/log-vocabulary/web-github.ts
|
|
856
|
+
var WEB_GITHUB_LOG_AREAS = defineLogAreas({
|
|
857
|
+
"web.github": {
|
|
858
|
+
description: "Pull request and GitHub issue views.",
|
|
859
|
+
events: {
|
|
860
|
+
"pull-request.url-failed": "A pull request's URL could not be read.",
|
|
861
|
+
"pull-request.mode-request-failed": "The pull request monitor refused a watch mode request.",
|
|
862
|
+
"pull-request.copy-failed": "A pull request value could not be copied to the clipboard.",
|
|
863
|
+
"comment-edit-draft.clear-failed": "An edited comment's saved draft could not be cleared.",
|
|
864
|
+
"issue-draft.clear-failed": "An edited issue's saved drafts could not be cleared.",
|
|
865
|
+
"comment-draft.clear-failed": "A posted comment's draft could not be cleared."
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
"web.linear": {
|
|
869
|
+
description: "The Linear tickets view.",
|
|
870
|
+
events: {
|
|
871
|
+
"comment-draft.clear-failed": "A posted comment's draft could not be cleared."
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
// ../protocol/src/log-vocabulary/web-kanban.ts
|
|
877
|
+
var WEB_KANBAN_LOG_AREAS = defineLogAreas({
|
|
878
|
+
"web.kanban": {
|
|
879
|
+
description: "The Kanban board, its task dialog and project notes.",
|
|
880
|
+
events: {
|
|
881
|
+
"tasks.load-failed": "A project's tasks could not be loaded.",
|
|
882
|
+
"task.add-failed": "A new task could not be added.",
|
|
883
|
+
"task.update-failed": "A task's fields could not be updated.",
|
|
884
|
+
"task.content-update-failed": "A task's content edit could not be saved.",
|
|
885
|
+
"task.build-status-clear-failed": "A task's build status could not be cleared.",
|
|
886
|
+
"task.delete-failed": "A task could not be deleted.",
|
|
887
|
+
"task.move-failed": "A task move failed and its status was rolled back.",
|
|
888
|
+
"comment.add-failed": "A comment could not be added to a task.",
|
|
889
|
+
"comment.delete-failed": "A comment could not be deleted from a task.",
|
|
890
|
+
"image.add-failed": "An image could not be added to a task.",
|
|
891
|
+
"image.delete-failed": "An image could not be deleted from a task.",
|
|
892
|
+
"notes.load-failed": "Project notes could not be loaded; the editor stays disabled.",
|
|
893
|
+
"notes.save-failed": "Project notes could not be saved.",
|
|
894
|
+
"notes.draft-retained": "A notes save failed; the edit stays in its durable draft.",
|
|
895
|
+
"draft.restore-failed": "A saved create-task draft could not be restored.",
|
|
896
|
+
"draft.persist-failed": "A create-task draft could not be saved; phase says when.",
|
|
897
|
+
"draft.discard-failed": "A create-task draft could not be removed; phase says when.",
|
|
898
|
+
"build.start-failed": "The task dialog could not start a build for a task.",
|
|
899
|
+
"build.create-and-start-failed": "The task dialog could not create a task and build it."
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
"web.feature-plan": {
|
|
903
|
+
description: "Feature planning in the renderer.",
|
|
904
|
+
events: {
|
|
905
|
+
"features.load-failed": "A project's features could not be loaded.",
|
|
906
|
+
"feature.create-failed": "A new feature could not be created.",
|
|
907
|
+
"feature.update-failed": "A feature could not be updated.",
|
|
908
|
+
"build.claim-failed": "A feature's build could not be claimed for a task.",
|
|
909
|
+
"build.start-failed": "Starting a build from a feature failed.",
|
|
910
|
+
"message.append-failed": "A message could not be added to a feature's chat.",
|
|
911
|
+
"story-message.append-failed": "A message could not be added to a story's chat.",
|
|
912
|
+
"planning.start-failed": "Feature planning could not be started.",
|
|
913
|
+
"planning.retry-failed": "Feature planning could not be retried.",
|
|
914
|
+
"planning.cancel-failed": "Feature planning could not be cancelled.",
|
|
915
|
+
"drafts.persist-failed": "A project's feature chat drafts could not be saved.",
|
|
916
|
+
"drafts.restore-failed": "A project's feature chat drafts could not be restored."
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// ../protocol/src/log-vocabulary/web-pane-layout.ts
|
|
922
|
+
var WEB_PANE_LAYOUT_LOG_AREAS = defineLogAreas({
|
|
923
|
+
"web.pane-layout": {
|
|
924
|
+
description: "Panes and tabs in the renderer: moves, splits, teardown and saved layouts.",
|
|
925
|
+
events: {
|
|
926
|
+
"persist.failed": "A pane layout could not be written to the backend.",
|
|
927
|
+
"persist.install-skipped": "A saved layout was not installed: its dependencies did not load.",
|
|
928
|
+
"persist.settled-handler-failed": "A write-settled handler threw; later handlers still ran.",
|
|
929
|
+
"environment.activated": "The active environment changed.",
|
|
930
|
+
"environment.initialized": "An environment's pane state was initialized.",
|
|
931
|
+
"environment.initialize-skipped": "Initialize was called with no active environment.",
|
|
932
|
+
"environment.terminals-cleared": "A reset cleared the environment's terminal instances.",
|
|
933
|
+
"terminal-session.cleanup-started": "A closed tab's terminal session is being cleaned up.",
|
|
934
|
+
"teardown.pending": "A tab teardown was rejected; the backend keeps it pending and retries.",
|
|
935
|
+
"browser-preview.destroy-failed": "Destroying a closed browser tab's preview failed.",
|
|
936
|
+
"handoffs.prune-failed": "Pruning unreferenced agent handoffs failed.",
|
|
937
|
+
"tab.reactivated": "A tab added twice was activated in its existing pane instead.",
|
|
938
|
+
"tab.move-started": "A tab move passed its checks and is being applied.",
|
|
939
|
+
"tab.move-failed": "A tab move was refused; `reason` says which lookup failed.",
|
|
940
|
+
"tab.initial-prompt-cleared": "A tab's initial prompt was cleared.",
|
|
941
|
+
"tab.initial-agent-options-cleared": "A tab's initial agent options were cleared.",
|
|
942
|
+
"pane.split-depth-reached": "A split was refused at the maximum split depth.",
|
|
943
|
+
"pane.edge-split-started": "An edge split passed its checks and is being applied.",
|
|
944
|
+
"pane.edge-split-failed": "An edge split was refused; `reason` says which lookup failed.",
|
|
945
|
+
"pane.close-refused": "Closing the only pane in a layout was refused.",
|
|
946
|
+
"draft.discard-failed": "A closing tab's draft could not be discarded; the tab stayed open.",
|
|
947
|
+
"draft.file-conflict-resolve-failed": "Discarding a newer saved file draft failed.",
|
|
948
|
+
"draft.compose-conflict-resolve-failed": "Discarding a newer saved compose draft failed."
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
|
|
953
|
+
// ../protocol/src/log-vocabulary/web-settings.ts
|
|
954
|
+
var WEB_SETTINGS_LOG_AREAS = defineLogAreas({
|
|
955
|
+
"web.settings": {
|
|
956
|
+
description: "The settings screens.",
|
|
957
|
+
events: {
|
|
958
|
+
"config.save-failed": "Global settings could not be saved.",
|
|
959
|
+
"config.load-failed": "The settings page could not load the config.",
|
|
960
|
+
"config.reload-failed": "Re-reading the workspace config after a save failed.",
|
|
961
|
+
"domains.test-failed": "The domain resolution test could not run.",
|
|
962
|
+
"github-credentials.propagate-failed": "Propagating GitHub credentials to environments failed.",
|
|
963
|
+
"credential.save-failed": "A credential could not be saved.",
|
|
964
|
+
"credential.clear-failed": "A credential could not be cleared.",
|
|
965
|
+
"gateway-token.save-failed": "The gateway token could not be saved.",
|
|
966
|
+
"gateway-token.copy-failed": "Copying the gateway token to the clipboard failed.",
|
|
967
|
+
"web-client-url.copy-failed": "Copying the web client address to the clipboard failed.",
|
|
968
|
+
"backend-version.read-failed": "The debug tab could not read the backend version.",
|
|
969
|
+
"messaging.flush-failed": "Saving pending messaging settings on unmount failed.",
|
|
970
|
+
"directory-picker.failed": "The repository directory picker could not open.",
|
|
971
|
+
"file-picker.failed": "The repository file picker could not open.",
|
|
972
|
+
"repository.save-failed": "Repository settings could not be saved.",
|
|
973
|
+
"model-catalogues.read-failed": "Reading the model catalogues for settings failed."
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
// ../protocol/src/log-vocabulary/web-shell.ts
|
|
979
|
+
var WEB_SHELL_LOG_AREAS = defineLogAreas({
|
|
980
|
+
"web.startup": {
|
|
981
|
+
description: "Loading the renderer, after the desktop connection check.",
|
|
982
|
+
events: {
|
|
983
|
+
"renderer.load-failed": "Importing or mounting the application failed.",
|
|
984
|
+
"model-catalogue.restore-failed": "The cached model catalogue could not be restored; bundled fallbacks stay in use."
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
"web.window": {
|
|
988
|
+
description: "Errors nothing in the renderer caught. Bug reports classify these two lines.",
|
|
989
|
+
events: {
|
|
990
|
+
"error.unhandled": "A window error event reached the bootstrap handler.",
|
|
991
|
+
"rejection.unhandled": "A promise rejected with no handler."
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
"web.react": {
|
|
995
|
+
description: "React's root error callbacks and the lazy view boundary.",
|
|
996
|
+
events: {
|
|
997
|
+
"root.caught-error": "An error boundary caught a render error.",
|
|
998
|
+
"root.uncaught-error": "A render error reached the root with no boundary.",
|
|
999
|
+
"root.recoverable-error": "React recovered from a render error by retrying.",
|
|
1000
|
+
"lazy-view.failed": "A lazily loaded view failed; fields are the bounded diagnostic."
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
// ../protocol/src/log-vocabulary/web-sync.ts
|
|
1006
|
+
var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
1007
|
+
"web.resource-sync": {
|
|
1008
|
+
description: "Keeping renderer stores current with backend resources.",
|
|
1009
|
+
events: {
|
|
1010
|
+
"handler.threw": "A resource change handler threw; other handlers still ran.",
|
|
1011
|
+
"resync-handler.threw": "A resync handler threw; the resync counts as failed.",
|
|
1012
|
+
"view-safety-check.threw": "A view safety check handler threw; the others still ran.",
|
|
1013
|
+
"snapshots.batch-failed": "A scoped snapshot batch failed; individual reads take over.",
|
|
1014
|
+
"manifest.scoped-check-failed": "The scoped manifest read failed; a full resync runs.",
|
|
1015
|
+
"manifest.check-failed": "The manifest read failed; a full resync runs.",
|
|
1016
|
+
"subscribe.failed": "Subscribing to a resource transport event failed.",
|
|
1017
|
+
"change.malformed": "A resource-changed payload had the wrong shape and was dropped.",
|
|
1018
|
+
"config.refresh-failed": "Refreshing the config store after a change failed.",
|
|
1019
|
+
"pane-layout.refresh-failed": "Refreshing an environment's pane layout failed.",
|
|
1020
|
+
"setup-completion.observe-failed": "Subscribing to setup completion events failed.",
|
|
1021
|
+
"resync.project-failed": "The authoritative project read failed during a store resync.",
|
|
1022
|
+
"resync.environment-failed": "The authoritative environment read failed during a resync.",
|
|
1023
|
+
"resync.read-failed": "One of a store resync's per-environment reads failed.",
|
|
1024
|
+
"resync.pane-failed": "A pane layout read failed during a store resync.",
|
|
1025
|
+
"agent-mail.summary-refresh-failed": "Refreshing the agent mail summary failed.",
|
|
1026
|
+
"agent-mail.mailbox-refresh-failed": "Refreshing one agent mailbox failed.",
|
|
1027
|
+
"prompt-queues.refresh-failed": "Refreshing an environment's prompt queues failed.",
|
|
1028
|
+
"build-pipeline.refresh-failed": "Refreshing one build pipeline failed.",
|
|
1029
|
+
"multi-review.refresh-failed": "Refreshing one multi review workflow failed.",
|
|
1030
|
+
"authoritative.resync-failed": "Re-reading a snapshot after a stream reconnect failed.",
|
|
1031
|
+
"observation.listener-threw": "A native observation invalidation listener threw.",
|
|
1032
|
+
"observation.subscribe-failed": "Subscribing to native observation events failed.",
|
|
1033
|
+
"hydration.status-listener-failed": "A bounded hydration status listener threw.",
|
|
1034
|
+
"hydration.notification-failed": "A bounded hydration change notification threw."
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
"web.read-coordinator": {
|
|
1038
|
+
description: "The renderer's coalesced, bounded backend reads.",
|
|
1039
|
+
events: {
|
|
1040
|
+
"listener.threw": "A read state listener threw.",
|
|
1041
|
+
"read.settle-failed": "Applying a finished read's result threw."
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
"web.gateway": {
|
|
1045
|
+
description: "The renderer's connection to the gateway: requests and event streams.",
|
|
1046
|
+
events: {
|
|
1047
|
+
"events.disconnected": "The main event stream dropped; it reconnects and replays.",
|
|
1048
|
+
"terminal-stream.disconnected": "A terminal event stream dropped; it reconnects.",
|
|
1049
|
+
"connection-listener.failed": "A main stream connection state listener threw.",
|
|
1050
|
+
"event-listener.failed": "A listener for a gateway event threw.",
|
|
1051
|
+
"stream-listener.failed": "A listener for the stream-connected notice threw."
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1054
|
+
"web.federation": {
|
|
1055
|
+
description: "Events from federated nodes as the renderer receives them.",
|
|
1056
|
+
events: {
|
|
1057
|
+
"resync-handler.failed": "A node resync handler failed.",
|
|
1058
|
+
"event-handler.failed": "A handler for an event relayed from a node failed.",
|
|
1059
|
+
"environment.start-failed": "Starting an environment opened in a workspace window failed."
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
// ../protocol/src/log-vocabulary/index.ts
|
|
1065
|
+
var LOG_VOCABULARY = {
|
|
1066
|
+
...AGENT_MAIL_LOG_AREAS,
|
|
1067
|
+
...BACKEND_LOG_AREAS,
|
|
1068
|
+
...BRIDGE_LOG_AREAS,
|
|
1069
|
+
...DESKTOP_LOG_AREAS,
|
|
1070
|
+
...ENVIRONMENT_LOG_AREAS,
|
|
1071
|
+
...GATEWAY_LOG_AREAS,
|
|
1072
|
+
...LOCAL_SERVER_LOG_AREAS,
|
|
1073
|
+
...GIT_LOG_AREAS,
|
|
1074
|
+
...LOGGING_LOG_AREAS,
|
|
1075
|
+
...MODEL_LOG_AREAS,
|
|
1076
|
+
...NATIVE_AGENT_LOG_AREAS,
|
|
1077
|
+
...PREVIEW_LOG_AREAS,
|
|
1078
|
+
...RUNTIME_LOG_AREAS,
|
|
1079
|
+
...TERMINAL_LOG_AREAS,
|
|
1080
|
+
...TMUX_LOG_AREAS,
|
|
1081
|
+
...UPDATER_LOG_AREAS,
|
|
1082
|
+
...WEB_ANNOTATIONS_LOG_AREAS,
|
|
1083
|
+
...WEB_APP_LOG_AREAS,
|
|
1084
|
+
...WEB_BUILD_PIPELINE_LOG_AREAS,
|
|
1085
|
+
...WEB_CHAT_LOG_AREAS,
|
|
1086
|
+
...WEB_CLAUDE_TMUX_LOG_AREAS,
|
|
1087
|
+
...WEB_DESIGN_LOG_AREAS,
|
|
1088
|
+
...WEB_ENVIRONMENT_LOG_AREAS,
|
|
1089
|
+
...WEB_FILES_LOG_AREAS,
|
|
1090
|
+
...WEB_GITHUB_LOG_AREAS,
|
|
1091
|
+
...WEB_KANBAN_LOG_AREAS,
|
|
1092
|
+
...WEB_PANE_LAYOUT_LOG_AREAS,
|
|
1093
|
+
...WEB_SETTINGS_LOG_AREAS,
|
|
1094
|
+
...WEB_SHELL_LOG_AREAS,
|
|
1095
|
+
...WEB_SYNC_LOG_AREAS
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
// ../protocol/src/secret-redaction.ts
|
|
1099
|
+
var TEXT_RULES = [
|
|
1100
|
+
{
|
|
1101
|
+
pattern: /([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
|
|
1102
|
+
replacement: "$1[redacted]@"
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
pattern: /([?&](?:access[_-]?token|refresh[_-]?token|id[_-]?token|api[_-]?key|apikey|auth|authorization|token|secret|password|passwd|signature|sig|key|state|code)=)[^&\s"'`]+/gi,
|
|
1106
|
+
replacement: "$1[redacted]"
|
|
1107
|
+
},
|
|
1108
|
+
{ pattern: /\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi, replacement: "Bearer [redacted]" },
|
|
1109
|
+
{ pattern: /\bBasic\s+[A-Za-z0-9+/=]{8,}/gi, replacement: "Basic [redacted]" },
|
|
1110
|
+
{
|
|
1111
|
+
pattern: /\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/g,
|
|
1112
|
+
replacement: "[redacted]"
|
|
1113
|
+
},
|
|
1114
|
+
{ pattern: /\bgh[pousr]_[A-Za-z0-9]{16,}/g, replacement: "[redacted]" },
|
|
1115
|
+
{ pattern: /\bgithub_pat_[A-Za-z0-9_]{20,}/g, replacement: "[redacted]" },
|
|
1116
|
+
{ pattern: /\b(?:sk|rk|pk)-[A-Za-z0-9_-]{12,}/g, replacement: "[redacted]" },
|
|
1117
|
+
{ pattern: /\bxox[baprse]-[A-Za-z0-9-]{8,}/g, replacement: "[redacted]" },
|
|
1118
|
+
{ pattern: /\bAKIA[0-9A-Z]{12,}/g, replacement: "[redacted]" },
|
|
1119
|
+
{ pattern: /\bAIza[0-9A-Za-z_-]{20,}/g, replacement: "[redacted]" },
|
|
1120
|
+
{
|
|
1121
|
+
pattern: /\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,
|
|
1122
|
+
replacement: "$1$2[redacted]"
|
|
1123
|
+
}
|
|
1124
|
+
];
|
|
1125
|
+
function redactSecrets(value) {
|
|
1126
|
+
let result = value;
|
|
1127
|
+
for (const rule of TEXT_RULES) {
|
|
1128
|
+
result = result.replace(new RegExp(rule.pattern.source, rule.pattern.flags), rule.replacement);
|
|
1129
|
+
}
|
|
1130
|
+
return result;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// ../protocol/src/log-error.ts
|
|
1134
|
+
var MAX_MESSAGE_CHARS = 1024;
|
|
1135
|
+
var MAX_STACK_FRAMES = 8;
|
|
1136
|
+
var MAX_FRAME_CHARS = 240;
|
|
1137
|
+
var MAX_RAW_FRAME_CHARS = 1024;
|
|
1138
|
+
var MAX_CAUSE_DEPTH = 2;
|
|
1139
|
+
var TRUNCATED_MARKER = "...[truncated]";
|
|
1140
|
+
var NAME_PATTERN = /^[A-Za-z_$][\w$.-]{0,63}$/;
|
|
1141
|
+
var CODE_PATTERN = /^[\w.:-]{1,64}$/;
|
|
1142
|
+
var SYSCALL_PATTERN = /^[\w./ -]{1,128}$/;
|
|
1143
|
+
var COMMAND_OUTPUT_FIELDS = ["stdout", "stderr", "cmd", "spawnargs"];
|
|
1144
|
+
var safeErrors = new WeakSet;
|
|
1145
|
+
function isSafeLogError(value) {
|
|
1146
|
+
return typeof value === "object" && value !== null && safeErrors.has(value);
|
|
1147
|
+
}
|
|
1148
|
+
function brand(details) {
|
|
1149
|
+
const safe = Object.freeze(details);
|
|
1150
|
+
safeErrors.add(safe);
|
|
1151
|
+
return safe;
|
|
1152
|
+
}
|
|
1153
|
+
function boundedText(value, maxChars) {
|
|
1154
|
+
const cut = value.length > maxChars ? `${value.slice(0, maxChars - TRUNCATED_MARKER.length)}${TRUNCATED_MARKER}` : value;
|
|
1155
|
+
return redactSecrets(cut).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g, " ").trim();
|
|
1156
|
+
}
|
|
1157
|
+
var FRAME_LOCATION = /(^|[\s(])((?:[a-z][a-z0-9+.-]*:\/\/[^/\s)]*)?(?:\/|[a-z]:[\\/]|\\\\).*?)(?=:\d+(?::\d+)?\)?(?:,|$)|\)(?:,|$)|,\s|$)/gi;
|
|
1158
|
+
var LOCATION_SCHEME = /^([a-z][a-z0-9+.-]*):\/\/[^/\s)]*/i;
|
|
1159
|
+
var APP_PATH = /(?:^|\/)((?:apps\/(?:backend|desktop|web|web-public)|packages\/(?:protocol|cli|toolchain)|bridges\/[\w-]+|[\w-]+-bridge)\/.*)$/;
|
|
1160
|
+
var PACKAGED_PATH = /\/((?:app\.asar(?:\.unpacked)?|resources)\/.*)$/i;
|
|
1161
|
+
function appRelativeLocation(location) {
|
|
1162
|
+
const scheme = LOCATION_SCHEME.exec(location)?.[1]?.toLowerCase();
|
|
1163
|
+
const isWebUrl = scheme !== undefined && scheme !== "file";
|
|
1164
|
+
const withoutOrigin = location.replace(LOCATION_SCHEME, "");
|
|
1165
|
+
const path = (isWebUrl ? withoutOrigin.split(/[?#]/, 1)[0] : withoutOrigin).replace(/\\/g, "/");
|
|
1166
|
+
const modules = path.lastIndexOf("/node_modules/");
|
|
1167
|
+
if (modules >= 0)
|
|
1168
|
+
return path.slice(modules + 1);
|
|
1169
|
+
const app = APP_PATH.exec(path)?.[1] ?? PACKAGED_PATH.exec(path)?.[1];
|
|
1170
|
+
if (app)
|
|
1171
|
+
return app;
|
|
1172
|
+
if (isWebUrl)
|
|
1173
|
+
return path.replace(/^\/+/, "");
|
|
1174
|
+
return `.../${path.slice(path.lastIndexOf("/") + 1)}`;
|
|
1175
|
+
}
|
|
1176
|
+
function relativeFrame(frame) {
|
|
1177
|
+
return frame.slice(0, MAX_RAW_FRAME_CHARS).replace(FRAME_LOCATION, (_match, lead, location) => `${lead}${appRelativeLocation(location)}`);
|
|
1178
|
+
}
|
|
1179
|
+
function read(target, key) {
|
|
1180
|
+
try {
|
|
1181
|
+
return target[key];
|
|
1182
|
+
} catch {
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
function matching(value, pattern) {
|
|
1187
|
+
return typeof value === "string" && pattern.test(value) ? value : undefined;
|
|
1188
|
+
}
|
|
1189
|
+
function finite(value) {
|
|
1190
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
1191
|
+
}
|
|
1192
|
+
function isCommandFailure(target, name, message) {
|
|
1193
|
+
return name === "CommandFailedError" || Boolean(message?.startsWith("Command failed")) || COMMAND_OUTPUT_FIELDS.some((field) => read(target, field) !== undefined);
|
|
1194
|
+
}
|
|
1195
|
+
function stackFrames(target, message) {
|
|
1196
|
+
const stack = read(target, "stack");
|
|
1197
|
+
if (typeof stack !== "string")
|
|
1198
|
+
return;
|
|
1199
|
+
const index = message ? stack.indexOf(message) : -1;
|
|
1200
|
+
const body = index >= 0 ? stack.slice(index + message.length) : stack;
|
|
1201
|
+
const frames = body.split(`
|
|
1202
|
+
`).filter((line) => /^\s*at\s/.test(line)).slice(0, MAX_STACK_FRAMES).map((line) => boundedText(relativeFrame(line), MAX_FRAME_CHARS));
|
|
1203
|
+
return frames.length > 0 ? frames : undefined;
|
|
1204
|
+
}
|
|
1205
|
+
function describe(error, includeStack, depth) {
|
|
1206
|
+
if (typeof error !== "object" || error === null) {
|
|
1207
|
+
return {
|
|
1208
|
+
name: "NonError",
|
|
1209
|
+
message: typeof error === "string" ? boundedText(error, MAX_MESSAGE_CHARS) : `[${typeof error}]`
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
const rawMessage = read(error, "message");
|
|
1213
|
+
if (!(error instanceof Error) && typeof rawMessage !== "string") {
|
|
1214
|
+
return { name: "NonError", message: "[object]" };
|
|
1215
|
+
}
|
|
1216
|
+
const name = matching(read(error, "name"), NAME_PATTERN) ?? "Error";
|
|
1217
|
+
const message = typeof rawMessage === "string" ? rawMessage : undefined;
|
|
1218
|
+
const commandFailure = isCommandFailure(error, name, message);
|
|
1219
|
+
const stackHoldsMessage = message !== undefined && String(read(error, "stack") ?? "").includes(message);
|
|
1220
|
+
const details = { name };
|
|
1221
|
+
if (commandFailure)
|
|
1222
|
+
details.outputOmitted = true;
|
|
1223
|
+
else if (message)
|
|
1224
|
+
details.message = boundedText(message, MAX_MESSAGE_CHARS);
|
|
1225
|
+
const code = read(error, "code");
|
|
1226
|
+
const safeCode = finite(code) ?? matching(code, CODE_PATTERN);
|
|
1227
|
+
if (safeCode !== undefined)
|
|
1228
|
+
details.code = safeCode;
|
|
1229
|
+
const errno = finite(read(error, "errno"));
|
|
1230
|
+
if (errno !== undefined)
|
|
1231
|
+
details.errno = errno;
|
|
1232
|
+
const syscall = matching(read(error, "syscall"), SYSCALL_PATTERN);
|
|
1233
|
+
if (syscall)
|
|
1234
|
+
details.syscall = syscall;
|
|
1235
|
+
const exitCode = finite(read(error, "exitCode"));
|
|
1236
|
+
if (exitCode !== undefined)
|
|
1237
|
+
details.exitCode = exitCode;
|
|
1238
|
+
const signal = matching(read(error, "signal"), CODE_PATTERN);
|
|
1239
|
+
if (signal)
|
|
1240
|
+
details.signal = signal;
|
|
1241
|
+
if (includeStack && (!commandFailure || stackHoldsMessage || !message)) {
|
|
1242
|
+
const frames = stackFrames(error, message);
|
|
1243
|
+
if (frames)
|
|
1244
|
+
details.stack = frames;
|
|
1245
|
+
}
|
|
1246
|
+
const members = read(error, "errors");
|
|
1247
|
+
if (Array.isArray(members))
|
|
1248
|
+
details.errorCount = members.length;
|
|
1249
|
+
const cause = read(error, "cause") ?? (Array.isArray(members) ? members[0] : undefined);
|
|
1250
|
+
if (cause !== undefined && cause !== null && depth < MAX_CAUSE_DEPTH) {
|
|
1251
|
+
details.cause = describe(cause, false, depth + 1);
|
|
1252
|
+
}
|
|
1253
|
+
return details;
|
|
1254
|
+
}
|
|
1255
|
+
function formatLogError(error, options = {}) {
|
|
1256
|
+
try {
|
|
1257
|
+
return brand(describe(error, options.stack !== false, 0));
|
|
1258
|
+
} catch {
|
|
1259
|
+
return brand({ name: "Error", message: "[unreadable]" });
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
function logErrorKind(error) {
|
|
1263
|
+
if (typeof error !== "object" || error === null)
|
|
1264
|
+
return "NonError";
|
|
1265
|
+
if (!(error instanceof Error) && typeof read(error, "message") !== "string")
|
|
1266
|
+
return "NonError";
|
|
1267
|
+
const code = read(error, "code");
|
|
1268
|
+
const safeCode = finite(code) ?? matching(code, CODE_PATTERN);
|
|
1269
|
+
if (safeCode !== undefined)
|
|
1270
|
+
return String(safeCode);
|
|
1271
|
+
return matching(read(error, "name"), NAME_PATTERN) ?? "Error";
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
// ../protocol/src/logger.ts
|
|
1275
|
+
var LOG_LEVELS = ["error", "warn", "info", "debug", "trace"];
|
|
1276
|
+
var MAX_FIELD_CHARS = 2048;
|
|
1277
|
+
var TRUNCATION_MARKER_RESERVE = 32;
|
|
1278
|
+
var MAX_FIELDS = 32;
|
|
1279
|
+
var FIELD_NAME_PATTERN = /^[A-Za-z][\w.-]{0,63}$/;
|
|
1280
|
+
var BARE_TEXT_VALUE = /^[\w./:@+,~-]+$/;
|
|
1281
|
+
var THROTTLE_KIND_PATTERN = /^[\w.:-]{1,64}$/;
|
|
1282
|
+
var MAX_THROTTLE_SCOPE_CHARS = 128;
|
|
1283
|
+
var FORBIDDEN_FIELD_NAMES = new Set([
|
|
1284
|
+
"stdout",
|
|
1285
|
+
"stderr",
|
|
1286
|
+
"cmd",
|
|
1287
|
+
"spawnargs",
|
|
1288
|
+
"prompt",
|
|
1289
|
+
"token",
|
|
1290
|
+
"password",
|
|
1291
|
+
"secret",
|
|
1292
|
+
"authorization",
|
|
1293
|
+
"apikey",
|
|
1294
|
+
"cookie",
|
|
1295
|
+
"credentials"
|
|
1296
|
+
]);
|
|
1297
|
+
var LEVEL_RANK = {
|
|
1298
|
+
error: 0,
|
|
1299
|
+
warn: 1,
|
|
1300
|
+
info: 2,
|
|
1301
|
+
debug: 3,
|
|
1302
|
+
trace: 4
|
|
1303
|
+
};
|
|
1304
|
+
var OUTPUT_METHOD = {
|
|
1305
|
+
error: "error",
|
|
1306
|
+
warn: "warn",
|
|
1307
|
+
info: "info",
|
|
1308
|
+
debug: "debug",
|
|
1309
|
+
trace: "debug"
|
|
1310
|
+
};
|
|
1311
|
+
var consoleSink = ({ method, line }) => {
|
|
1312
|
+
console[method](line);
|
|
1313
|
+
};
|
|
1314
|
+
var DEFAULT_CONFIG = {
|
|
1315
|
+
level: "info",
|
|
1316
|
+
areaLevels: {},
|
|
1317
|
+
format: "text",
|
|
1318
|
+
sink: consoleSink
|
|
1319
|
+
};
|
|
1320
|
+
var config = DEFAULT_CONFIG;
|
|
1321
|
+
var generation = 0;
|
|
1322
|
+
function configureLogger(change) {
|
|
1323
|
+
config = { ...config, ...change };
|
|
1324
|
+
generation += 1;
|
|
1325
|
+
}
|
|
1326
|
+
function isLogLevel(value) {
|
|
1327
|
+
return typeof value === "string" && LOG_LEVELS.includes(value);
|
|
1328
|
+
}
|
|
1329
|
+
function areaSpec(area) {
|
|
1330
|
+
return Object.hasOwn(LOG_VOCABULARY, area) ? LOG_VOCABULARY[area] : undefined;
|
|
1331
|
+
}
|
|
1332
|
+
function thresholdRank(area) {
|
|
1333
|
+
for (let scope = area;; scope = scope.slice(0, scope.lastIndexOf("."))) {
|
|
1334
|
+
const level = Object.hasOwn(config.areaLevels, scope) ? config.areaLevels[scope] : undefined;
|
|
1335
|
+
if (level)
|
|
1336
|
+
return LEVEL_RANK[level];
|
|
1337
|
+
if (!scope.includes("."))
|
|
1338
|
+
return LEVEL_RANK[config.level];
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
function boundedString(value, maxChars) {
|
|
1342
|
+
if (value.length <= maxChars)
|
|
1343
|
+
return value;
|
|
1344
|
+
const kept = maxChars - TRUNCATION_MARKER_RESERVE;
|
|
1345
|
+
return `${value.slice(0, kept)}...[truncated ${value.length - kept} chars]`;
|
|
1346
|
+
}
|
|
1347
|
+
function sanitizeValue(name, value, maxChars) {
|
|
1348
|
+
if (FORBIDDEN_FIELD_NAMES.has(name.toLowerCase().replace(/[-_.]/g, "")))
|
|
1349
|
+
return "[forbidden]";
|
|
1350
|
+
switch (typeof value) {
|
|
1351
|
+
case "string":
|
|
1352
|
+
return boundedString(value, maxChars);
|
|
1353
|
+
case "number":
|
|
1354
|
+
return Number.isFinite(value) ? value : String(value);
|
|
1355
|
+
case "boolean":
|
|
1356
|
+
return value;
|
|
1357
|
+
case "undefined":
|
|
1358
|
+
return;
|
|
1359
|
+
case "bigint":
|
|
1360
|
+
return value.toString();
|
|
1361
|
+
case "object":
|
|
1362
|
+
if (value === null)
|
|
1363
|
+
return null;
|
|
1364
|
+
if (isSafeLogError(value))
|
|
1365
|
+
return value;
|
|
1366
|
+
if (value instanceof Error)
|
|
1367
|
+
return formatLogError(value);
|
|
1368
|
+
return "[rejected:object]";
|
|
1369
|
+
default:
|
|
1370
|
+
return `[rejected:${typeof value}]`;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
function sanitizeFields(fields, maxChars) {
|
|
1374
|
+
const clean = {};
|
|
1375
|
+
let count = 0;
|
|
1376
|
+
let dropped = 0;
|
|
1377
|
+
for (const name of Object.keys(fields)) {
|
|
1378
|
+
const value = sanitizeValue(name, fields[name], maxChars);
|
|
1379
|
+
if (value === undefined)
|
|
1380
|
+
continue;
|
|
1381
|
+
if (count >= MAX_FIELDS || !FIELD_NAME_PATTERN.test(name)) {
|
|
1382
|
+
dropped += 1;
|
|
1383
|
+
continue;
|
|
1384
|
+
}
|
|
1385
|
+
clean[name] = value;
|
|
1386
|
+
count += 1;
|
|
1387
|
+
}
|
|
1388
|
+
if (dropped > 0)
|
|
1389
|
+
clean.droppedFields = dropped;
|
|
1390
|
+
return count > 0 || dropped > 0 ? clean : undefined;
|
|
1391
|
+
}
|
|
1392
|
+
function textValue(value) {
|
|
1393
|
+
if (typeof value !== "string")
|
|
1394
|
+
return String(value);
|
|
1395
|
+
return BARE_TEXT_VALUE.test(value) ? value : JSON.stringify(value);
|
|
1396
|
+
}
|
|
1397
|
+
function appendTextField(parts, name, value) {
|
|
1398
|
+
if (typeof value !== "object" || value === null) {
|
|
1399
|
+
parts.push(`${name}=${textValue(value)}`);
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
for (const key of Object.keys(value)) {
|
|
1403
|
+
const entry = value[key];
|
|
1404
|
+
if (entry === undefined)
|
|
1405
|
+
continue;
|
|
1406
|
+
if (key === "cause")
|
|
1407
|
+
appendTextField(parts, `${name}.cause`, entry);
|
|
1408
|
+
else if (key === "stack")
|
|
1409
|
+
parts.push(`${name}.stack=${textValue(entry.join(" | "))}`);
|
|
1410
|
+
else
|
|
1411
|
+
parts.push(`${name}.${key}=${textValue(entry)}`);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
function escapeLogLine(line) {
|
|
1415
|
+
return line.replace(/[\u007f-\u009f\u2028\u2029]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
1416
|
+
}
|
|
1417
|
+
function renderText(record) {
|
|
1418
|
+
const tag = areaSpec(record.area)?.tag ?? record.area;
|
|
1419
|
+
const parts = [`[${tag}]`, record.event];
|
|
1420
|
+
if (record.fields) {
|
|
1421
|
+
for (const name of Object.keys(record.fields))
|
|
1422
|
+
appendTextField(parts, name, record.fields[name]);
|
|
1423
|
+
}
|
|
1424
|
+
return escapeLogLine(parts.join(" "));
|
|
1425
|
+
}
|
|
1426
|
+
function renderJson(record) {
|
|
1427
|
+
return escapeLogLine(JSON.stringify(record));
|
|
1428
|
+
}
|
|
1429
|
+
function deliver(record) {
|
|
1430
|
+
try {
|
|
1431
|
+
config.sink({
|
|
1432
|
+
method: OUTPUT_METHOD[record.level],
|
|
1433
|
+
line: config.format === "json" ? renderJson(record) : renderText(record),
|
|
1434
|
+
record
|
|
1435
|
+
});
|
|
1436
|
+
} catch {}
|
|
1437
|
+
}
|
|
1438
|
+
function buildRecord(level, area, event, fields) {
|
|
1439
|
+
const clean = fields ? sanitizeFields(fields, areaSpec(area)?.maxStringChars ?? MAX_FIELD_CHARS) : undefined;
|
|
1440
|
+
return {
|
|
1441
|
+
orklog: 1,
|
|
1442
|
+
ts: new Date().toISOString(),
|
|
1443
|
+
level,
|
|
1444
|
+
area,
|
|
1445
|
+
event,
|
|
1446
|
+
...clean ? { fields: clean } : {}
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
var LOG_THROTTLE_WINDOW_MS = 60000;
|
|
1450
|
+
var LOG_THROTTLE_MAX_KEYS = 512;
|
|
1451
|
+
var LOG_THROTTLE_IDLE_MS = 5 * LOG_THROTTLE_WINDOW_MS;
|
|
1452
|
+
var throttledSites = new Map;
|
|
1453
|
+
var throttledKeyCount = 0;
|
|
1454
|
+
var throttleRecency = 0;
|
|
1455
|
+
var throttleGeneration = generation;
|
|
1456
|
+
var nextThrottleFlushAt = 0;
|
|
1457
|
+
function writeThrottleLine(site, event, fields) {
|
|
1458
|
+
const spec = areaSpec(site.area);
|
|
1459
|
+
if (!spec)
|
|
1460
|
+
return;
|
|
1461
|
+
const listed = Object.hasOwn(spec.events, event);
|
|
1462
|
+
const line = { site: site.event, ...site.scope === undefined ? {} : { scope: site.scope } };
|
|
1463
|
+
deliver(buildRecord(site.level, site.area, listed ? event : "invalid-event", listed ? { ...line, ...fields } : undefined));
|
|
1464
|
+
}
|
|
1465
|
+
function syncThrottleLevels() {
|
|
1466
|
+
if (throttleGeneration === generation)
|
|
1467
|
+
return;
|
|
1468
|
+
throttleGeneration = generation;
|
|
1469
|
+
for (const [siteKey, site] of Array.from(throttledSites)) {
|
|
1470
|
+
if (LEVEL_RANK[site.level] <= thresholdRank(site.area))
|
|
1471
|
+
continue;
|
|
1472
|
+
throttledSites.delete(siteKey);
|
|
1473
|
+
throttledKeyCount -= site.keys.size;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
function rollThrottleWindow(site, kind, key, now) {
|
|
1477
|
+
const elapsed = now - key.windowStart;
|
|
1478
|
+
if (elapsed >= 0 && elapsed < LOG_THROTTLE_WINDOW_MS)
|
|
1479
|
+
return;
|
|
1480
|
+
if (key.pending > 0) {
|
|
1481
|
+
writeThrottleLine(site, "throttle.suppressed", {
|
|
1482
|
+
kind,
|
|
1483
|
+
suppressed: key.pending,
|
|
1484
|
+
windowSeconds: Math.max(0, Math.round(elapsed / 1000))
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
key.pending = 0;
|
|
1488
|
+
key.windowStart = now;
|
|
1489
|
+
}
|
|
1490
|
+
function flushDueThrottleWindows(now) {
|
|
1491
|
+
if (now < nextThrottleFlushAt && nextThrottleFlushAt - now <= LOG_THROTTLE_WINDOW_MS)
|
|
1492
|
+
return;
|
|
1493
|
+
nextThrottleFlushAt = now + LOG_THROTTLE_WINDOW_MS;
|
|
1494
|
+
for (const site of throttledSites.values()) {
|
|
1495
|
+
for (const [kind, key] of site.keys)
|
|
1496
|
+
rollThrottleWindow(site, kind, key, now);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
function evictOldestThrottleKey() {
|
|
1500
|
+
let oldest;
|
|
1501
|
+
for (const [siteKey, site] of throttledSites) {
|
|
1502
|
+
for (const [kind, key] of site.keys) {
|
|
1503
|
+
if (!oldest || key.recency < oldest.key.recency)
|
|
1504
|
+
oldest = { siteKey, site, kind, key };
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
if (!oldest)
|
|
1508
|
+
return;
|
|
1509
|
+
const { siteKey, site, kind, key } = oldest;
|
|
1510
|
+
writeThrottleLine(site, "throttle.evicted", { kind, suppressed: key.pending });
|
|
1511
|
+
site.keys.delete(kind);
|
|
1512
|
+
throttledKeyCount -= 1;
|
|
1513
|
+
if (site.keys.size === 0)
|
|
1514
|
+
throttledSites.delete(siteKey);
|
|
1515
|
+
}
|
|
1516
|
+
function throttleSiteKey(area, event, scope) {
|
|
1517
|
+
return `${area}\x00${event}\x00${scope ?? ""}`;
|
|
1518
|
+
}
|
|
1519
|
+
function noteThrottledFailure(area, level, event, scope, kind) {
|
|
1520
|
+
const now = Date.now();
|
|
1521
|
+
flushDueThrottleWindows(now);
|
|
1522
|
+
const siteKey = throttleSiteKey(area, event, scope);
|
|
1523
|
+
let site = throttledSites.get(siteKey);
|
|
1524
|
+
let known = site?.keys.get(kind);
|
|
1525
|
+
if (known && now - known.lastFailureAt >= LOG_THROTTLE_IDLE_MS) {
|
|
1526
|
+
site.keys.delete(kind);
|
|
1527
|
+
throttledKeyCount -= 1;
|
|
1528
|
+
if (site.keys.size === 0) {
|
|
1529
|
+
throttledSites.delete(siteKey);
|
|
1530
|
+
site = undefined;
|
|
1531
|
+
}
|
|
1532
|
+
known = undefined;
|
|
1533
|
+
}
|
|
1534
|
+
if (!known && throttledKeyCount >= LOG_THROTTLE_MAX_KEYS) {
|
|
1535
|
+
evictOldestThrottleKey();
|
|
1536
|
+
site = throttledSites.get(siteKey);
|
|
1537
|
+
}
|
|
1538
|
+
site ??= { area, event, scope, level, since: now, failures: 0, keys: new Map };
|
|
1539
|
+
site.level = level;
|
|
1540
|
+
site.failures += 1;
|
|
1541
|
+
throttledSites.delete(siteKey);
|
|
1542
|
+
throttledSites.set(siteKey, site);
|
|
1543
|
+
if (known) {
|
|
1544
|
+
rollThrottleWindow(site, kind, known, now);
|
|
1545
|
+
known.pending += 1;
|
|
1546
|
+
known.lastFailureAt = now;
|
|
1547
|
+
known.recency = ++throttleRecency;
|
|
1548
|
+
site.keys.delete(kind);
|
|
1549
|
+
site.keys.set(kind, known);
|
|
1550
|
+
return false;
|
|
1551
|
+
}
|
|
1552
|
+
site.keys.set(kind, {
|
|
1553
|
+
pending: 0,
|
|
1554
|
+
windowStart: now,
|
|
1555
|
+
lastFailureAt: now,
|
|
1556
|
+
recency: ++throttleRecency
|
|
1557
|
+
});
|
|
1558
|
+
throttledKeyCount += 1;
|
|
1559
|
+
return true;
|
|
1560
|
+
}
|
|
1561
|
+
function noteThrottledSuccess(area, event, scope) {
|
|
1562
|
+
const now = Date.now();
|
|
1563
|
+
flushDueThrottleWindows(now);
|
|
1564
|
+
const siteKey = throttleSiteKey(area, event, scope);
|
|
1565
|
+
const site = throttledSites.get(siteKey);
|
|
1566
|
+
if (!site)
|
|
1567
|
+
return;
|
|
1568
|
+
throttledSites.delete(siteKey);
|
|
1569
|
+
throttledKeyCount -= site.keys.size;
|
|
1570
|
+
let suppressed = 0;
|
|
1571
|
+
for (const key of site.keys.values())
|
|
1572
|
+
suppressed += key.pending;
|
|
1573
|
+
writeThrottleLine(site, "throttle.recovered", {
|
|
1574
|
+
failures: site.failures,
|
|
1575
|
+
kinds: site.keys.size,
|
|
1576
|
+
suppressed,
|
|
1577
|
+
faultSeconds: Math.max(0, Math.round((now - site.since) / 1000))
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
function throttleKind(options) {
|
|
1581
|
+
if (options.kind === undefined)
|
|
1582
|
+
return logErrorKind(options.error);
|
|
1583
|
+
return THROTTLE_KIND_PATTERN.test(options.kind) ? options.kind : "invalid-kind";
|
|
1584
|
+
}
|
|
1585
|
+
function resolveFields(fields) {
|
|
1586
|
+
try {
|
|
1587
|
+
return typeof fields === "function" ? fields() : fields;
|
|
1588
|
+
} catch {
|
|
1589
|
+
return { fieldsFailed: true };
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
function createLogger(area) {
|
|
1593
|
+
const spec = areaSpec(area);
|
|
1594
|
+
let seenGeneration = -1;
|
|
1595
|
+
let rank = 0;
|
|
1596
|
+
const enabled = (level) => {
|
|
1597
|
+
if (seenGeneration !== generation) {
|
|
1598
|
+
seenGeneration = generation;
|
|
1599
|
+
rank = thresholdRank(area);
|
|
1600
|
+
}
|
|
1601
|
+
return LEVEL_RANK[level] <= rank;
|
|
1602
|
+
};
|
|
1603
|
+
const writeResolved = (level, event, resolved) => {
|
|
1604
|
+
if (!spec) {
|
|
1605
|
+
deliver(buildRecord(level, "logging", "unknown-area", undefined));
|
|
1606
|
+
} else if (Object.hasOwn(spec.events, event)) {
|
|
1607
|
+
deliver(buildRecord(level, area, event, resolved));
|
|
1608
|
+
} else {
|
|
1609
|
+
deliver(buildRecord(level, area, "invalid-event", undefined));
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1612
|
+
const write = (level, event, fields) => {
|
|
1613
|
+
if (!enabled(level))
|
|
1614
|
+
return;
|
|
1615
|
+
writeResolved(level, event, resolveFields(fields));
|
|
1616
|
+
};
|
|
1617
|
+
return {
|
|
1618
|
+
error: (event, fields) => write("error", event, fields),
|
|
1619
|
+
warn: (event, fields) => write("warn", event, fields),
|
|
1620
|
+
info: (event, fields) => write("info", event, fields),
|
|
1621
|
+
debug: (event, fields) => write("debug", event, fields),
|
|
1622
|
+
trace: (event, fields) => write("trace", event, fields),
|
|
1623
|
+
throttled: (level, event, options) => {
|
|
1624
|
+
syncThrottleLevels();
|
|
1625
|
+
if (!enabled(level))
|
|
1626
|
+
return;
|
|
1627
|
+
if (!spec || !Object.hasOwn(spec.events, event) || event.startsWith("throttle.") || !Object.hasOwn(spec.events, "throttle.recovered")) {
|
|
1628
|
+
deliver(buildRecord(level, spec ? area : "logging", spec ? "invalid-event" : "unknown-area", undefined));
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
const kind = throttleKind(options);
|
|
1632
|
+
const scope = options.scope?.slice(0, MAX_THROTTLE_SCOPE_CHARS);
|
|
1633
|
+
if (!noteThrottledFailure(area, level, event, scope, kind))
|
|
1634
|
+
return;
|
|
1635
|
+
writeResolved(level, event, {
|
|
1636
|
+
...scope === undefined ? {} : { scope },
|
|
1637
|
+
kind,
|
|
1638
|
+
...resolveFields(options.fields)
|
|
1639
|
+
});
|
|
1640
|
+
},
|
|
1641
|
+
recovered: (event, scope) => {
|
|
1642
|
+
syncThrottleLevels();
|
|
1643
|
+
if (throttledKeyCount === 0)
|
|
1644
|
+
return;
|
|
1645
|
+
noteThrottledSuccess(area, event, scope?.slice(0, MAX_THROTTLE_SCOPE_CHARS));
|
|
1646
|
+
},
|
|
1647
|
+
isEnabled: enabled
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
// ../protocol/src/log-policy.ts
|
|
1652
|
+
var BRIDGE_DIAGNOSTICS_LOG_AREA = "bridge.diagnostics";
|
|
1653
|
+
var MAX_LOG_DETAIL_AREAS = 256;
|
|
1654
|
+
var MAX_LOG_AREA_NAME_CHARS = 64;
|
|
1655
|
+
var LOG_AREA_NAME = /^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*$/;
|
|
1656
|
+
function parseLogDetail(value) {
|
|
1657
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
1658
|
+
return null;
|
|
1659
|
+
const { level, areaLevels } = value;
|
|
1660
|
+
if (!isLogLevel(level))
|
|
1661
|
+
return null;
|
|
1662
|
+
if (areaLevels === undefined)
|
|
1663
|
+
return { level, areaLevels: {} };
|
|
1664
|
+
if (typeof areaLevels !== "object" || areaLevels === null || Array.isArray(areaLevels)) {
|
|
1665
|
+
return null;
|
|
1666
|
+
}
|
|
1667
|
+
const names = Object.keys(areaLevels).sort();
|
|
1668
|
+
if (names.length > MAX_LOG_DETAIL_AREAS)
|
|
1669
|
+
return null;
|
|
1670
|
+
const clean = {};
|
|
1671
|
+
for (const name of names) {
|
|
1672
|
+
const areaLevel = areaLevels[name];
|
|
1673
|
+
if (name.length > MAX_LOG_AREA_NAME_CHARS || !LOG_AREA_NAME.test(name))
|
|
1674
|
+
return null;
|
|
1675
|
+
if (!isLogLevel(areaLevel))
|
|
1676
|
+
return null;
|
|
1677
|
+
clean[name] = areaLevel;
|
|
1678
|
+
}
|
|
1679
|
+
return { level, areaLevels: clean };
|
|
1680
|
+
}
|
|
1681
|
+
var LEVEL_DETAIL = {
|
|
1682
|
+
error: 0,
|
|
1683
|
+
warn: 1,
|
|
1684
|
+
info: 2,
|
|
1685
|
+
debug: 3,
|
|
1686
|
+
trace: 4
|
|
1687
|
+
};
|
|
1688
|
+
function effectiveLogLevel(detail, area) {
|
|
1689
|
+
for (let scope = area;; scope = scope.slice(0, scope.lastIndexOf("."))) {
|
|
1690
|
+
const level = Object.hasOwn(detail.areaLevels, scope) ? detail.areaLevels[scope] : undefined;
|
|
1691
|
+
if (level)
|
|
1692
|
+
return level;
|
|
1693
|
+
if (!scope.includes("."))
|
|
1694
|
+
return detail.level;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
function logDetailEnablesBridgeDiagnostics(detail) {
|
|
1698
|
+
return LEVEL_DETAIL[effectiveLogLevel(detail, BRIDGE_DIAGNOSTICS_LOG_AREA)] >= LEVEL_DETAIL.debug;
|
|
1699
|
+
}
|
|
1700
|
+
var BRIDGE_LOG_POLICY_ROUTE = "/debug/log-policy";
|
|
1701
|
+
function parseBridgeLogPolicy(value) {
|
|
1702
|
+
const detail = parseLogDetail(value);
|
|
1703
|
+
if (!detail)
|
|
1704
|
+
return null;
|
|
1705
|
+
const { seq } = value;
|
|
1706
|
+
return Number.isSafeInteger(seq) && seq >= 0 ? { ...detail, seq } : null;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
// ../protocol/src/node/logger-environment.ts
|
|
1710
|
+
var LOG_LEVEL_ENV = "ORKESTRATOR_LOG_LEVEL";
|
|
1711
|
+
var LOG_FORMAT_ENV = "ORKESTRATOR_LOG_FORMAT";
|
|
1712
|
+
var BRIDGE_LOG_RELAY_ENV = "ORKESTRATOR_BRIDGE_LOG_RELAY";
|
|
1713
|
+
var bridgeLogLevelOverrides = new WeakMap;
|
|
1714
|
+
function logLevelEnvironmentValue(env) {
|
|
1715
|
+
return env[LOG_LEVEL_ENV] ?? bridgeLogLevelOverrides.get(env);
|
|
1716
|
+
}
|
|
1717
|
+
function parseLogLevels(value) {
|
|
1718
|
+
const parsed = { areaLevels: {}, invalid: [] };
|
|
1719
|
+
for (const entry of (value ?? "").split(",")) {
|
|
1720
|
+
const trimmed = entry.trim();
|
|
1721
|
+
if (!trimmed)
|
|
1722
|
+
continue;
|
|
1723
|
+
const separator = trimmed.indexOf("=");
|
|
1724
|
+
if (separator < 0) {
|
|
1725
|
+
if (isLogLevel(trimmed))
|
|
1726
|
+
parsed.level = trimmed;
|
|
1727
|
+
else
|
|
1728
|
+
parsed.invalid.push(trimmed);
|
|
1729
|
+
continue;
|
|
1730
|
+
}
|
|
1731
|
+
const area = trimmed.slice(0, separator);
|
|
1732
|
+
const level = trimmed.slice(separator + 1);
|
|
1733
|
+
if (isLogLevel(level) && isKnownScope(area))
|
|
1734
|
+
parsed.areaLevels[area] = level;
|
|
1735
|
+
else
|
|
1736
|
+
parsed.invalid.push(trimmed);
|
|
1737
|
+
}
|
|
1738
|
+
return parsed;
|
|
1739
|
+
}
|
|
1740
|
+
function isKnownScope(scope) {
|
|
1741
|
+
return Object.keys(LOG_VOCABULARY).some((area) => area === scope || area.startsWith(`${scope}.`));
|
|
1742
|
+
}
|
|
1743
|
+
function configureLoggerFromEnvironment(env, options = {}) {
|
|
1744
|
+
const levels = parseLogLevels(env[LOG_LEVEL_ENV]);
|
|
1745
|
+
const requestedFormat = env[LOG_FORMAT_ENV];
|
|
1746
|
+
const format = options.relayToSupervisor || requestedFormat === "json" ? "json" : "text";
|
|
1747
|
+
configureLogger({
|
|
1748
|
+
...levels.level ? { level: levels.level } : {},
|
|
1749
|
+
areaLevels: levels.areaLevels,
|
|
1750
|
+
format
|
|
1751
|
+
});
|
|
1752
|
+
const log = createLogger("logging");
|
|
1753
|
+
if (levels.invalid.length > 0) {
|
|
1754
|
+
log.warn("config.invalid", { variable: LOG_LEVEL_ENV, entries: levels.invalid.length });
|
|
1755
|
+
}
|
|
1756
|
+
if (requestedFormat && requestedFormat !== "json" && requestedFormat !== "text") {
|
|
1757
|
+
log.warn("config.invalid", { variable: LOG_FORMAT_ENV, entries: 1 });
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
function configureBridgeLogger(env = process.env) {
|
|
1761
|
+
const relayToSupervisor = env[BRIDGE_LOG_RELAY_ENV] === "1";
|
|
1762
|
+
bridgeLogLevelOverrides.set(env, env[LOG_LEVEL_ENV]);
|
|
1763
|
+
delete env[BRIDGE_LOG_RELAY_ENV];
|
|
1764
|
+
configureLoggerFromEnvironment(env, { relayToSupervisor });
|
|
1765
|
+
delete env[LOG_FORMAT_ENV];
|
|
1766
|
+
delete env[LOG_LEVEL_ENV];
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
// ../protocol/src/node/log-policy.ts
|
|
1770
|
+
function effectiveLogDetail(detail, env = process.env) {
|
|
1771
|
+
const overrides = parseLogLevels(logLevelEnvironmentValue(env));
|
|
1772
|
+
return {
|
|
1773
|
+
level: overrides.level ?? detail.level,
|
|
1774
|
+
areaLevels: { ...detail.areaLevels, ...overrides.areaLevels }
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
function applyLogDetail(detail, env = process.env) {
|
|
1778
|
+
const effective = effectiveLogDetail(detail, env);
|
|
1779
|
+
configureLogger(effective);
|
|
1780
|
+
return effective;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1
1783
|
// ../protocol/src/node/bridge-diagnostics.ts
|
|
2
1784
|
import { createHash } from "node:crypto";
|
|
1785
|
+
var log = createLogger("bridge.diagnostics");
|
|
3
1786
|
var INTERVAL_MS = 60000;
|
|
4
1787
|
var MAX_PENDING_TOOLS = 128;
|
|
5
1788
|
var MAX_REPORTED_TOOLS = 8;
|
|
@@ -69,7 +1852,16 @@ function identity(value) {
|
|
|
69
1852
|
function readBridgeDebugFlag(value) {
|
|
70
1853
|
return value?.trim() === "1";
|
|
71
1854
|
}
|
|
1855
|
+
var liveDiagnostics;
|
|
1856
|
+
var liveScopes = new Set;
|
|
1857
|
+
function setLiveBridgeDiagnostics(enabled) {
|
|
1858
|
+
liveDiagnostics = enabled;
|
|
1859
|
+
for (const scope of Array.from(liveScopes))
|
|
1860
|
+
scope.syncActive();
|
|
1861
|
+
}
|
|
72
1862
|
function bridgeDebugEnabled(bridge, env = process.env) {
|
|
1863
|
+
if (liveDiagnostics !== undefined && env === process.env)
|
|
1864
|
+
return liveDiagnostics;
|
|
73
1865
|
const value = env.ORKESTRATOR_BRIDGE_DEBUG ?? env[`${bridge.toUpperCase()}_BRIDGE_DEBUG`];
|
|
74
1866
|
return readBridgeDebugFlag(value);
|
|
75
1867
|
}
|
|
@@ -127,17 +1919,25 @@ function safeDiagnosticMetrics(value) {
|
|
|
127
1919
|
result.state = value.state;
|
|
128
1920
|
return result;
|
|
129
1921
|
}
|
|
130
|
-
|
|
131
|
-
|
|
1922
|
+
function writeBridgeDiagnostic({ bridge, event, payload }) {
|
|
1923
|
+
log.info(event, { bridge, payload });
|
|
1924
|
+
}
|
|
1925
|
+
function bridgeDiagnosticsActive() {
|
|
1926
|
+
return log.isEnabled("info");
|
|
1927
|
+
}
|
|
1928
|
+
function writeDiagnostic(bridge, event, payload, write) {
|
|
132
1929
|
try {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
1930
|
+
const json = JSON.stringify({ bridge, event, ...payload });
|
|
1931
|
+
const bytes = Buffer.byteLength(json);
|
|
1932
|
+
if (bytes <= MAX_BRIDGE_DIAGNOSTIC_BYTES) {
|
|
1933
|
+
write({ bridge, event, payload: json });
|
|
1934
|
+
return;
|
|
1935
|
+
}
|
|
1936
|
+
write({
|
|
1937
|
+
bridge,
|
|
1938
|
+
event: "snapshot-overflow",
|
|
1939
|
+
payload: JSON.stringify({ bridge, event: "snapshot-overflow", omittedBytes: bytes })
|
|
1940
|
+
});
|
|
141
1941
|
} catch {}
|
|
142
1942
|
}
|
|
143
1943
|
|
|
@@ -148,6 +1948,7 @@ class BridgeRunDiagnostics {
|
|
|
148
1948
|
write;
|
|
149
1949
|
intervalMs;
|
|
150
1950
|
metrics;
|
|
1951
|
+
active;
|
|
151
1952
|
counters = {
|
|
152
1953
|
stderrBytes: 0,
|
|
153
1954
|
requestsSent: 0,
|
|
@@ -175,19 +1976,29 @@ class BridgeRunDiagnostics {
|
|
|
175
1976
|
cancelReason;
|
|
176
1977
|
run;
|
|
177
1978
|
closed = false;
|
|
1979
|
+
wasActive;
|
|
178
1980
|
timer;
|
|
179
|
-
constructor(bridge, state, now = Date.now, write =
|
|
1981
|
+
constructor(bridge, state, now = Date.now, write = writeBridgeDiagnostic, intervalMs = INTERVAL_MS, metrics = () => ({}), active = () => true) {
|
|
180
1982
|
this.bridge = bridge;
|
|
181
1983
|
this.state = state;
|
|
182
1984
|
this.now = now;
|
|
183
1985
|
this.write = write;
|
|
184
1986
|
this.intervalMs = intervalMs;
|
|
185
1987
|
this.metrics = metrics;
|
|
1988
|
+
this.active = active;
|
|
186
1989
|
this.startedAt = this.lastTick = now();
|
|
1990
|
+
this.wasActive = active();
|
|
187
1991
|
this.timer = setInterval(() => this.report("heartbeat"), intervalMs);
|
|
188
1992
|
this.timer.unref();
|
|
1993
|
+
liveScopes.add(this);
|
|
189
1994
|
this.report("send-started");
|
|
190
1995
|
}
|
|
1996
|
+
syncActive() {
|
|
1997
|
+
const active = this.active();
|
|
1998
|
+
if (active && !this.wasActive)
|
|
1999
|
+
this.report("heartbeat");
|
|
2000
|
+
this.wasActive = active;
|
|
2001
|
+
}
|
|
191
2002
|
sent(runId) {
|
|
192
2003
|
this.run = identity(runId);
|
|
193
2004
|
this.phase = "following";
|
|
@@ -275,6 +2086,8 @@ class BridgeRunDiagnostics {
|
|
|
275
2086
|
const tickDelayMs = event === "heartbeat" ? Math.max(0, now - this.lastTick - this.intervalMs) : 0;
|
|
276
2087
|
if (event === "heartbeat")
|
|
277
2088
|
this.lastTick = now;
|
|
2089
|
+
if (!this.active() || !bridgeDiagnosticsActive())
|
|
2090
|
+
return;
|
|
278
2091
|
const pendingTools = Array.from(this.pending.entries()).slice(0, MAX_REPORTED_TOOLS).map(([id, tool]) => ({
|
|
279
2092
|
id,
|
|
280
2093
|
kind: tool.kind,
|
|
@@ -283,8 +2096,7 @@ class BridgeRunDiagnostics {
|
|
|
283
2096
|
ageMs: age(tool.since)
|
|
284
2097
|
}));
|
|
285
2098
|
try {
|
|
286
|
-
writeDiagnostic(this.bridge, {
|
|
287
|
-
event,
|
|
2099
|
+
writeDiagnostic(this.bridge, event, {
|
|
288
2100
|
session: identity(this.state.id),
|
|
289
2101
|
run: this.run,
|
|
290
2102
|
phase: this.phase,
|
|
@@ -319,12 +2131,55 @@ class BridgeRunDiagnostics {
|
|
|
319
2131
|
this.phase = phase;
|
|
320
2132
|
this.report("closed");
|
|
321
2133
|
this.closed = true;
|
|
2134
|
+
liveScopes.delete(this);
|
|
322
2135
|
clearInterval(this.timer);
|
|
323
2136
|
this.pending.clear();
|
|
324
2137
|
}
|
|
325
2138
|
}
|
|
326
2139
|
function createBridgeDiagnostics(bridge, state, metrics) {
|
|
327
|
-
return
|
|
2140
|
+
return new BridgeRunDiagnostics(bridge, state, undefined, undefined, undefined, metrics, () => bridgeDebugEnabled(bridge));
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
// ../protocol/src/node/bridge-log-policy.ts
|
|
2144
|
+
var MAX_BRIDGE_LOG_POLICY_BYTES = 64 * 1024;
|
|
2145
|
+
var appliedSeq = -1;
|
|
2146
|
+
function applyBridgeLogPolicy(value, env = process.env) {
|
|
2147
|
+
const policy = parseBridgeLogPolicy(value);
|
|
2148
|
+
if (!policy)
|
|
2149
|
+
return { status: 400, body: { error: "Invalid log policy" } };
|
|
2150
|
+
if (policy.seq < appliedSeq) {
|
|
2151
|
+
return { status: 200, body: { applied: false, stale: true, seq: appliedSeq } };
|
|
2152
|
+
}
|
|
2153
|
+
appliedSeq = policy.seq;
|
|
2154
|
+
const effective = applyLogDetail(policy, env);
|
|
2155
|
+
const diagnostics = logDetailEnablesBridgeDiagnostics(effective);
|
|
2156
|
+
setLiveBridgeDiagnostics(diagnostics);
|
|
2157
|
+
return { status: 200, body: { applied: true, seq: policy.seq, diagnostics } };
|
|
2158
|
+
}
|
|
2159
|
+
async function readBridgeLogPolicyBody(request) {
|
|
2160
|
+
if (!request.body)
|
|
2161
|
+
return null;
|
|
2162
|
+
const chunks = [];
|
|
2163
|
+
let bytes = 0;
|
|
2164
|
+
const reader = request.body.getReader();
|
|
2165
|
+
try {
|
|
2166
|
+
for (;; ) {
|
|
2167
|
+
const { done, value } = await reader.read();
|
|
2168
|
+
if (done)
|
|
2169
|
+
break;
|
|
2170
|
+
bytes += value.byteLength;
|
|
2171
|
+
if (bytes > MAX_BRIDGE_LOG_POLICY_BYTES)
|
|
2172
|
+
return null;
|
|
2173
|
+
chunks.push(value);
|
|
2174
|
+
}
|
|
2175
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
2176
|
+
} catch {
|
|
2177
|
+
return null;
|
|
2178
|
+
} finally {
|
|
2179
|
+
await reader.cancel().catch(() => {
|
|
2180
|
+
return;
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
328
2183
|
}
|
|
329
2184
|
|
|
330
2185
|
// ../../bridges/codex-bridge/src/index.ts
|
|
@@ -4014,6 +5869,7 @@ var AGENT_INTERACTION_LIMITS = Object.freeze({
|
|
|
4014
5869
|
maxSerializedPayloadBytes: 256 * 1024,
|
|
4015
5870
|
maxIdLength: 512,
|
|
4016
5871
|
maxProviderValueLength: 4096,
|
|
5872
|
+
maxSourceNameLength: 256,
|
|
4017
5873
|
maxJournalEntries: 512,
|
|
4018
5874
|
maxWorkflowSummaries: 64
|
|
4019
5875
|
});
|
|
@@ -4081,6 +5937,19 @@ var LIMITED_HOLD_REASONS = new Set([
|
|
|
4081
5937
|
"provider-limit",
|
|
4082
5938
|
"upstream-may-expire"
|
|
4083
5939
|
]);
|
|
5940
|
+
var AGENT_INTERACTION_SOURCE_KINDS = ["mcp-server"];
|
|
5941
|
+
var SOURCE_SCOPE_LABELS = Object.freeze({
|
|
5942
|
+
user: "user settings",
|
|
5943
|
+
project: "project settings",
|
|
5944
|
+
local: "local settings",
|
|
5945
|
+
dynamic: "session settings",
|
|
5946
|
+
plugin: "a plugin",
|
|
5947
|
+
managed: "managed settings",
|
|
5948
|
+
enterprise: "enterprise settings",
|
|
5949
|
+
claudeai: "a claude.ai connector",
|
|
5950
|
+
agent: "an agent definition",
|
|
5951
|
+
sdk: "the agent host"
|
|
5952
|
+
});
|
|
4084
5953
|
var UNATTENDED_POLICY_INSTRUCTION = "This is a non-interactive build session: no user can answer a provider input request. " + "If input is unavailable or declined, choose the safest likely assumption yourself, " + "state that assumption, and continue. Never treat the absence of a person as authorization.";
|
|
4085
5954
|
var INTERACTIVE_AGENT_INTERACTION_POLICY = Object.freeze({
|
|
4086
5955
|
version: AGENT_INTERACTION_POLICY_VERSION,
|
|
@@ -4156,8 +6025,11 @@ var REQUEST_KEYS = new Set([
|
|
|
4156
6025
|
"createdAt",
|
|
4157
6026
|
"updatedAt",
|
|
4158
6027
|
"expiresAt",
|
|
4159
|
-
"hold"
|
|
6028
|
+
"hold",
|
|
6029
|
+
"source"
|
|
4160
6030
|
]);
|
|
6031
|
+
var SOURCE_KEYS = new Set(["kind", "name", "scope"]);
|
|
6032
|
+
var SOURCE_KINDS = new Set(AGENT_INTERACTION_SOURCE_KINDS);
|
|
4161
6033
|
var HOLD_KEYS = new Set(["available", "heldAt", "reason"]);
|
|
4162
6034
|
var HOLD_REASONS = new Set(AGENT_INTERACTION_HOLD_REASONS);
|
|
4163
6035
|
var PRESENTATION_KEYS = new Set([
|
|
@@ -8954,6 +10826,7 @@ function toBridgeModel(model) {
|
|
|
8954
10826
|
}
|
|
8955
10827
|
// ../protocol/src/human-prompts.ts
|
|
8956
10828
|
var HUMAN_PROMPT_SCAN_BYTES = 16 * 1024;
|
|
10829
|
+
var HUMAN_PROMPT_OBSERVATION_ROWS = 64;
|
|
8957
10830
|
function humanPromptObservation(messages, tasks) {
|
|
8958
10831
|
const object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
8959
10832
|
const parts = [];
|
|
@@ -8987,7 +10860,7 @@ function humanPromptObservation(messages, tasks) {
|
|
|
8987
10860
|
}
|
|
8988
10861
|
};
|
|
8989
10862
|
if (Array.isArray(messages)) {
|
|
8990
|
-
for (let i = messages.length - 1;i >= Math.max(0, messages.length -
|
|
10863
|
+
for (let i = messages.length - 1;i >= Math.max(0, messages.length - HUMAN_PROMPT_OBSERVATION_ROWS); i--) {
|
|
8991
10864
|
const message = messages[i];
|
|
8992
10865
|
if (object(message))
|
|
8993
10866
|
walk(message.parts);
|
|
@@ -13237,6 +15110,7 @@ function parseCapacityRetryContinuation(text) {
|
|
|
13237
15110
|
}
|
|
13238
15111
|
|
|
13239
15112
|
// ../../bridges/codex-bridge/src/history/rollout.ts
|
|
15113
|
+
var log2 = createLogger("bridge.codex");
|
|
13240
15114
|
function getCodexHomeDir() {
|
|
13241
15115
|
return process.env.CODEX_HOME || join11(homedir(), ".codex");
|
|
13242
15116
|
}
|
|
@@ -13838,7 +15712,7 @@ async function hydrateMessagesFromPersistedSession(threadId, options = {}) {
|
|
|
13838
15712
|
};
|
|
13839
15713
|
}
|
|
13840
15714
|
}
|
|
13841
|
-
|
|
15715
|
+
log2.warn("rollout.hydrate-failed", { threadId });
|
|
13842
15716
|
return {
|
|
13843
15717
|
messages: [],
|
|
13844
15718
|
title: meta.title,
|
|
@@ -14327,6 +16201,7 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
14327
16201
|
}
|
|
14328
16202
|
|
|
14329
16203
|
// ../../bridges/codex-bridge/src/messages/render-turn.ts
|
|
16204
|
+
var log3 = createLogger("bridge.codex");
|
|
14330
16205
|
var TRUNCATION_NOTICE = `
|
|
14331
16206
|
… output truncated`;
|
|
14332
16207
|
var SUBAGENT_TRANSCRIPT_PROBE_INTERVAL_MS = 2000;
|
|
@@ -14743,7 +16618,7 @@ async function renderTurn(turn, options) {
|
|
|
14743
16618
|
loadSnapshot = latestSnapshot;
|
|
14744
16619
|
}
|
|
14745
16620
|
} catch (error) {
|
|
14746
|
-
|
|
16621
|
+
log3.warn("subagent.activity-load-failed", { error: formatLogError(error) });
|
|
14747
16622
|
}
|
|
14748
16623
|
}
|
|
14749
16624
|
const { items, itemsByKey, accumulatorsByKey, itemKeys } = collectTurnItems(turn, options.segment);
|
|
@@ -15521,6 +17396,7 @@ function extractThreadId(params) {
|
|
|
15521
17396
|
}
|
|
15522
17397
|
|
|
15523
17398
|
// ../../bridges/codex-bridge/src/app-server/jsonl-rpc-client.ts
|
|
17399
|
+
var log4 = createLogger("bridge.codex");
|
|
15524
17400
|
var DEFAULT_MAX_INBOUND_LINE_BYTES = 64 * 1024 * 1024;
|
|
15525
17401
|
var DEFAULT_MAX_OUTBOUND_LINE_BYTES = 32 * 1024 * 1024;
|
|
15526
17402
|
var DEFAULT_REQUEST_TIMEOUT_MS = 60000;
|
|
@@ -15632,7 +17508,7 @@ class JsonlRpcClient {
|
|
|
15632
17508
|
try {
|
|
15633
17509
|
this.options.recordInboundLine(line);
|
|
15634
17510
|
} catch (error) {
|
|
15635
|
-
|
|
17511
|
+
log4.error("recorder.threw", { error: formatLogError(error) });
|
|
15636
17512
|
}
|
|
15637
17513
|
}
|
|
15638
17514
|
const message = parseInboundLine(line);
|
|
@@ -15664,7 +17540,7 @@ class JsonlRpcClient {
|
|
|
15664
17540
|
try {
|
|
15665
17541
|
this.options.onServerRequest(message);
|
|
15666
17542
|
} catch (error) {
|
|
15667
|
-
|
|
17543
|
+
log4.error("server-request.handoff-failed", { error: formatLogError(error) });
|
|
15668
17544
|
}
|
|
15669
17545
|
return;
|
|
15670
17546
|
}
|
|
@@ -15673,7 +17549,7 @@ class JsonlRpcClient {
|
|
|
15673
17549
|
try {
|
|
15674
17550
|
this.options.onNotification(message, extractThreadId(message.params));
|
|
15675
17551
|
} catch (error) {
|
|
15676
|
-
|
|
17552
|
+
log4.error("notification.enqueue-failed", { error: formatLogError(error) });
|
|
15677
17553
|
}
|
|
15678
17554
|
return;
|
|
15679
17555
|
}
|
|
@@ -15845,7 +17721,7 @@ class SerialQueue {
|
|
|
15845
17721
|
this.maxObservedDepth = Math.max(this.maxObservedDepth, this.depth);
|
|
15846
17722
|
const previous = this.chains.get(key) ?? Promise.resolve();
|
|
15847
17723
|
const next = previous.then(() => task()).catch((error) => {
|
|
15848
|
-
|
|
17724
|
+
log4.error("queue.task-failed", { key, error: formatLogError(error) });
|
|
15849
17725
|
}).finally(() => {
|
|
15850
17726
|
this.depth -= 1;
|
|
15851
17727
|
if (this.chains.get(key) === next)
|
|
@@ -15868,6 +17744,10 @@ class SerialQueue {
|
|
|
15868
17744
|
// ../../bridges/codex-bridge/src/app-server/notification-recorder.ts
|
|
15869
17745
|
import { appendFile as appendFile4, mkdir as mkdir5 } from "node:fs/promises";
|
|
15870
17746
|
import { join as join13 } from "node:path";
|
|
17747
|
+
var log5 = createLogger("bridge.codex");
|
|
17748
|
+
function recorderNotice(message) {
|
|
17749
|
+
log5.warn("recorder.notice", { detail: message });
|
|
17750
|
+
}
|
|
15871
17751
|
var DEFAULT_MAX_RECORDING_BYTES = 64 * 1024 * 1024;
|
|
15872
17752
|
var DEFAULT_FLUSH_INTERVAL_MS = 250;
|
|
15873
17753
|
var DEFAULT_WARN_INTERVAL_MS = 60000;
|
|
@@ -15901,7 +17781,7 @@ class NotificationRecorder {
|
|
|
15901
17781
|
this.ensureDirImpl = options.ensureDirImpl ?? ((path) => mkdir5(path, { recursive: true }).then(() => {
|
|
15902
17782
|
return;
|
|
15903
17783
|
}));
|
|
15904
|
-
this.warnImpl = options.warnImpl ??
|
|
17784
|
+
this.warnImpl = options.warnImpl ?? recorderNotice;
|
|
15905
17785
|
this.now = options.now ?? Date.now;
|
|
15906
17786
|
this.stats = {
|
|
15907
17787
|
fileName: options.fileName,
|
|
@@ -15957,7 +17837,7 @@ class NotificationRecorder {
|
|
|
15957
17837
|
if (this.lastWarnedAt !== null && now - this.lastWarnedAt < this.warnIntervalMs)
|
|
15958
17838
|
return;
|
|
15959
17839
|
this.lastWarnedAt = now;
|
|
15960
|
-
this.warnImpl(`
|
|
17840
|
+
this.warnImpl(`RECORDING app-server notifications to ${this.path} ` + `(${this.stats.linesRecorded} lines). Prompts, file contents and absolute paths ` + "are written verbatim. Unset CODEX_BRIDGE_RECORD_NOTIFICATIONS to stop.");
|
|
15961
17841
|
}
|
|
15962
17842
|
async flushOnce() {
|
|
15963
17843
|
if (this.buffer.length === 0)
|
|
@@ -15979,7 +17859,7 @@ class NotificationRecorder {
|
|
|
15979
17859
|
} catch (error) {
|
|
15980
17860
|
this.stats.writeErrors += 1;
|
|
15981
17861
|
this.stats.linesDropped += pending.length;
|
|
15982
|
-
|
|
17862
|
+
log5.error("recorder.write-failed", { error: formatLogError(error, { stack: false }) });
|
|
15983
17863
|
}
|
|
15984
17864
|
}
|
|
15985
17865
|
async close() {
|
|
@@ -15993,12 +17873,12 @@ class NotificationRecorder {
|
|
|
15993
17873
|
}
|
|
15994
17874
|
function createRecorderFromEnv(options) {
|
|
15995
17875
|
const env = options.env ?? process.env;
|
|
15996
|
-
const warn = options.warn ??
|
|
17876
|
+
const warn = options.warn ?? recorderNotice;
|
|
15997
17877
|
const directory = env.CODEX_BRIDGE_RECORD_NOTIFICATIONS?.trim();
|
|
15998
17878
|
if (!directory)
|
|
15999
17879
|
return null;
|
|
16000
17880
|
if (env[RECORD_CONFIRM_ENV]?.trim() !== "1") {
|
|
16001
|
-
warn(`
|
|
17881
|
+
warn(`Ignoring CODEX_BRIDGE_RECORD_NOTIFICATIONS=${directory}: recordings ` + "capture every prompt, file content and absolute path verbatim, so they also " + `require ${RECORD_CONFIRM_ENV}=1. Not recording.`);
|
|
16002
17882
|
return null;
|
|
16003
17883
|
}
|
|
16004
17884
|
const stamp = new Date(options.now?.() ?? Date.now()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -16014,6 +17894,7 @@ function createRecorderFromEnv(options) {
|
|
|
16014
17894
|
import { execFile as execFileCallback } from "node:child_process";
|
|
16015
17895
|
import { createHash as createHash8 } from "node:crypto";
|
|
16016
17896
|
import { promisify } from "node:util";
|
|
17897
|
+
var log6 = createLogger("bridge.codex");
|
|
16017
17898
|
var execFile2 = promisify(execFileCallback);
|
|
16018
17899
|
var RUNTIME_ENV_SCRIPT_ENV = "ORKESTRATOR_RUNTIME_ENV_SCRIPT";
|
|
16019
17900
|
var DEFAULT_RUNTIME_ENV_SCRIPT = "/usr/local/bin/orkestrator-runtime-env.sh";
|
|
@@ -16091,10 +17972,10 @@ async function refreshRuntimeEnvironment(run = execFile2) {
|
|
|
16091
17972
|
});
|
|
16092
17973
|
const updated = applyRuntimeEnvironmentOutput(stdout);
|
|
16093
17974
|
if (updated.length > 0) {
|
|
16094
|
-
|
|
17975
|
+
log6.info("runtime-env.refreshed", { names: updated.join(", ") });
|
|
16095
17976
|
}
|
|
16096
17977
|
} catch (error) {
|
|
16097
|
-
|
|
17978
|
+
log6.warn("runtime-env.refresh-failed", { error: formatLogError(error) });
|
|
16098
17979
|
}
|
|
16099
17980
|
}
|
|
16100
17981
|
function fingerprintRuntimeEnvironment(env = process.env) {
|
|
@@ -16114,6 +17995,8 @@ function runtimeEnvironmentSnapshot(env = process.env) {
|
|
|
16114
17995
|
}
|
|
16115
17996
|
|
|
16116
17997
|
// ../../bridges/codex-bridge/src/app-server/process-supervisor.ts
|
|
17998
|
+
var log7 = createLogger("bridge.codex");
|
|
17999
|
+
|
|
16117
18000
|
class AppServerOwnershipUnavailableError extends AppServerUnavailableError {
|
|
16118
18001
|
ownershipContention = true;
|
|
16119
18002
|
constructor(detail) {
|
|
@@ -16393,7 +18276,10 @@ class AppServerSupervisor {
|
|
|
16393
18276
|
if (describedLines >= STDERR_METADATA_LINE_BUDGET)
|
|
16394
18277
|
return;
|
|
16395
18278
|
describedLines += 1;
|
|
16396
|
-
|
|
18279
|
+
log7.info("app-server.stderr", () => ({
|
|
18280
|
+
generation: generationId,
|
|
18281
|
+
detail: describeChildStderrLine(line)
|
|
18282
|
+
}));
|
|
16397
18283
|
};
|
|
16398
18284
|
child.stderr?.setEncoding?.("utf8");
|
|
16399
18285
|
child.stderr?.on("data", (chunk) => {
|
|
@@ -16414,13 +18300,20 @@ class AppServerSupervisor {
|
|
|
16414
18300
|
stderrTail = "";
|
|
16415
18301
|
if (suppressedLines === 0)
|
|
16416
18302
|
return;
|
|
16417
|
-
|
|
18303
|
+
log7.info("app-server.stderr-suppressed", {
|
|
18304
|
+
generation: generationId,
|
|
18305
|
+
lines: suppressedLines,
|
|
18306
|
+
payloadBytes: suppressedBytes
|
|
18307
|
+
});
|
|
16418
18308
|
suppressedLines = 0;
|
|
16419
18309
|
suppressedBytes = 0;
|
|
16420
18310
|
};
|
|
16421
18311
|
const recorder = (this.options.createRecorder ?? ((generation) => createRecorderFromEnv({ generation })))(generationId);
|
|
16422
18312
|
if (recorder) {
|
|
16423
|
-
|
|
18313
|
+
log7.warn("app-server.recording", {
|
|
18314
|
+
generation: generationId,
|
|
18315
|
+
fileName: recorder.getStats().fileName
|
|
18316
|
+
});
|
|
16424
18317
|
}
|
|
16425
18318
|
const client = new JsonlRpcClient({
|
|
16426
18319
|
generation: generationId,
|
|
@@ -16430,7 +18323,7 @@ class AppServerSupervisor {
|
|
|
16430
18323
|
onServerRequest: (request) => this.options.onServerRequest(request, generationId),
|
|
16431
18324
|
onProtocolViolation: (detail) => {
|
|
16432
18325
|
this.unknownNotifications += 1;
|
|
16433
|
-
|
|
18326
|
+
log7.warn("app-server.protocol-violation", { generation: generationId, detail });
|
|
16434
18327
|
},
|
|
16435
18328
|
...recorder ? { recordInboundLine: (line) => recorder.record(line) } : {}
|
|
16436
18329
|
});
|
|
@@ -16508,7 +18401,13 @@ class AppServerSupervisor {
|
|
|
16508
18401
|
return;
|
|
16509
18402
|
const exited = this.current;
|
|
16510
18403
|
this.current = null;
|
|
16511
|
-
|
|
18404
|
+
log7.warn("app-server.exited", {
|
|
18405
|
+
generation: generationId,
|
|
18406
|
+
code,
|
|
18407
|
+
signal,
|
|
18408
|
+
pid: exited.child.pid,
|
|
18409
|
+
uptimeMs: Math.max(0, this.now() - exited.startedAt)
|
|
18410
|
+
});
|
|
16512
18411
|
this.options.onGenerationExit?.(generationId);
|
|
16513
18412
|
if (this.stopping) {
|
|
16514
18413
|
this.setState("stopped");
|
|
@@ -16766,7 +18665,7 @@ class AppServerSupervisor {
|
|
|
16766
18665
|
if (outcome === "contended")
|
|
16767
18666
|
return true;
|
|
16768
18667
|
if (matches && pid !== null) {
|
|
16769
|
-
|
|
18668
|
+
log7.info("app-server.stale-reaped", { pid });
|
|
16770
18669
|
(this.options.signalPidFileProcess ?? signalStaleProcessTree)(pid);
|
|
16771
18670
|
}
|
|
16772
18671
|
return true;
|
|
@@ -17443,6 +19342,7 @@ function buildInteractionResponse(request, answer) {
|
|
|
17443
19342
|
}
|
|
17444
19343
|
|
|
17445
19344
|
// ../../bridges/codex-bridge/src/app-server/server-request-router.ts
|
|
19345
|
+
var log8 = createLogger("bridge.codex");
|
|
17446
19346
|
var DEFAULT_RESPONSE_TIMEOUT_MS = 1e4;
|
|
17447
19347
|
var DEFAULT_APPROVAL_TIMEOUT_MS = AGENT_INTERACTION_DEFAULT_TIMEOUT_MS;
|
|
17448
19348
|
|
|
@@ -17602,7 +19502,10 @@ class ServerRequestRouter {
|
|
|
17602
19502
|
record.timedOut = true;
|
|
17603
19503
|
this.counts.timedOut += 1;
|
|
17604
19504
|
if (this.sendStarted.has(key)) {
|
|
17605
|
-
|
|
19505
|
+
log8.error("server-request.flush-timeout", {
|
|
19506
|
+
method: record.method,
|
|
19507
|
+
timeoutMs: this.responseTimeoutMs
|
|
19508
|
+
});
|
|
17606
19509
|
return;
|
|
17607
19510
|
}
|
|
17608
19511
|
this.finish(key, record, "protocol-error", () => this.options.respondWithError(generation, request.id, JSON_RPC_METHOD_NOT_FOUND, "Orkestrator did not produce a response in time"));
|
|
@@ -17703,7 +19606,7 @@ class ServerRequestRouter {
|
|
|
17703
19606
|
accepted = this.options.presentApproval?.(approval) === true;
|
|
17704
19607
|
} catch (error) {
|
|
17705
19608
|
deadline.settle();
|
|
17706
|
-
|
|
19609
|
+
log8.error("approval.present-failed", { error: formatLogError(error) });
|
|
17707
19610
|
return false;
|
|
17708
19611
|
}
|
|
17709
19612
|
if (!accepted) {
|
|
@@ -17740,7 +19643,7 @@ class ServerRequestRouter {
|
|
|
17740
19643
|
try {
|
|
17741
19644
|
this.options.onApprovalResolved?.(parked.request, decision, resolution);
|
|
17742
19645
|
} catch (error) {
|
|
17743
|
-
|
|
19646
|
+
log8.error("approval.resolved-callback-failed", { error: formatLogError(error) });
|
|
17744
19647
|
}
|
|
17745
19648
|
if (options.skipSend) {
|
|
17746
19649
|
this.pending.delete(parked.key);
|
|
@@ -17761,7 +19664,7 @@ class ServerRequestRouter {
|
|
|
17761
19664
|
try {
|
|
17762
19665
|
this.options.onApprovalResolved?.(parked.request, "withdrawn", "withdrawn");
|
|
17763
19666
|
} catch (error) {
|
|
17764
|
-
|
|
19667
|
+
log8.error("approval.resolved-callback-failed", { error: formatLogError(error) });
|
|
17765
19668
|
}
|
|
17766
19669
|
this.pending.delete(parked.key);
|
|
17767
19670
|
this.sendStarted.delete(parked.key);
|
|
@@ -17803,7 +19706,7 @@ class ServerRequestRouter {
|
|
|
17803
19706
|
accepted = this.options.presentInteraction?.(interaction) === true;
|
|
17804
19707
|
} catch (error) {
|
|
17805
19708
|
deadline?.settle();
|
|
17806
|
-
|
|
19709
|
+
log8.error("interaction.present-failed", { error: formatLogError(error) });
|
|
17807
19710
|
return false;
|
|
17808
19711
|
}
|
|
17809
19712
|
if (!accepted) {
|
|
@@ -17839,7 +19742,7 @@ class ServerRequestRouter {
|
|
|
17839
19742
|
try {
|
|
17840
19743
|
this.options.onInteractionResolved?.(parked.request, answer, resolution);
|
|
17841
19744
|
} catch (error) {
|
|
17842
|
-
|
|
19745
|
+
log8.error("interaction.resolved-callback-failed", { error: formatLogError(error) });
|
|
17843
19746
|
}
|
|
17844
19747
|
if (options.skipSend) {
|
|
17845
19748
|
this.pending.delete(parked.key);
|
|
@@ -17872,7 +19775,10 @@ class ServerRequestRouter {
|
|
|
17872
19775
|
try {
|
|
17873
19776
|
await send();
|
|
17874
19777
|
} catch (error) {
|
|
17875
|
-
|
|
19778
|
+
log8.error("server-request.answer-failed", {
|
|
19779
|
+
method: record.method,
|
|
19780
|
+
error: formatLogError(error, { stack: false })
|
|
19781
|
+
});
|
|
17876
19782
|
} finally {
|
|
17877
19783
|
this.pending.delete(key);
|
|
17878
19784
|
this.sendStarted.delete(key);
|
|
@@ -17886,7 +19792,7 @@ class ServerRequestRouter {
|
|
|
17886
19792
|
}
|
|
17887
19793
|
violation(method, detail) {
|
|
17888
19794
|
this.options.onInvariantViolation?.(method, detail);
|
|
17889
|
-
|
|
19795
|
+
log8.error("app-server.invariant-violation", { method, detail });
|
|
17890
19796
|
}
|
|
17891
19797
|
explain(record, message) {
|
|
17892
19798
|
this.options.reportToTranscript?.({
|
|
@@ -18471,41 +20377,6 @@ function reduceHistoricalTurns(turns, generation, threadId, handle) {
|
|
|
18471
20377
|
return { events, unsupportedItemTypes };
|
|
18472
20378
|
}
|
|
18473
20379
|
|
|
18474
|
-
// ../protocol/src/secret-redaction.ts
|
|
18475
|
-
var TEXT_RULES = [
|
|
18476
|
-
{
|
|
18477
|
-
pattern: /([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
|
|
18478
|
-
replacement: "$1[redacted]@"
|
|
18479
|
-
},
|
|
18480
|
-
{
|
|
18481
|
-
pattern: /([?&](?:access[_-]?token|refresh[_-]?token|id[_-]?token|api[_-]?key|apikey|auth|authorization|token|secret|password|passwd|signature|sig|key|state|code)=)[^&\s"'`]+/gi,
|
|
18482
|
-
replacement: "$1[redacted]"
|
|
18483
|
-
},
|
|
18484
|
-
{ pattern: /\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi, replacement: "Bearer [redacted]" },
|
|
18485
|
-
{ pattern: /\bBasic\s+[A-Za-z0-9+/=]{8,}/gi, replacement: "Basic [redacted]" },
|
|
18486
|
-
{
|
|
18487
|
-
pattern: /\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/g,
|
|
18488
|
-
replacement: "[redacted]"
|
|
18489
|
-
},
|
|
18490
|
-
{ pattern: /\bgh[pousr]_[A-Za-z0-9]{16,}/g, replacement: "[redacted]" },
|
|
18491
|
-
{ pattern: /\bgithub_pat_[A-Za-z0-9_]{20,}/g, replacement: "[redacted]" },
|
|
18492
|
-
{ pattern: /\b(?:sk|rk|pk)-[A-Za-z0-9_-]{12,}/g, replacement: "[redacted]" },
|
|
18493
|
-
{ pattern: /\bxox[baprse]-[A-Za-z0-9-]{8,}/g, replacement: "[redacted]" },
|
|
18494
|
-
{ pattern: /\bAKIA[0-9A-Z]{12,}/g, replacement: "[redacted]" },
|
|
18495
|
-
{ pattern: /\bAIza[0-9A-Za-z_-]{20,}/g, replacement: "[redacted]" },
|
|
18496
|
-
{
|
|
18497
|
-
pattern: /\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,
|
|
18498
|
-
replacement: "$1$2[redacted]"
|
|
18499
|
-
}
|
|
18500
|
-
];
|
|
18501
|
-
function redactSecrets(value) {
|
|
18502
|
-
let result = value;
|
|
18503
|
-
for (const rule of TEXT_RULES) {
|
|
18504
|
-
result = result.replace(new RegExp(rule.pattern.source, rule.pattern.flags), rule.replacement);
|
|
18505
|
-
}
|
|
18506
|
-
return result;
|
|
18507
|
-
}
|
|
18508
|
-
|
|
18509
20380
|
// ../../bridges/codex-bridge/src/sessions/dispatch-journal.ts
|
|
18510
20381
|
import { createHash as createHash10 } from "node:crypto";
|
|
18511
20382
|
import { mkdir as mkdir8, open as open6, rename as rename6, rm as rm7, writeFile as writeFile5 } from "node:fs/promises";
|
|
@@ -18525,6 +20396,7 @@ import {
|
|
|
18525
20396
|
writeFile as writeFile4
|
|
18526
20397
|
} from "node:fs/promises";
|
|
18527
20398
|
import { join as join15 } from "node:path";
|
|
20399
|
+
var log9 = createLogger("bridge.codex");
|
|
18528
20400
|
var BRIDGE_SESSION_REGISTRY_VERSION = 2;
|
|
18529
20401
|
var SESSION_TITLE_SOURCES = new Set([
|
|
18530
20402
|
"codex",
|
|
@@ -18824,7 +20696,7 @@ class BridgeSessionStore {
|
|
|
18824
20696
|
await chmod(path, PRIVATE_FILE_MODE);
|
|
18825
20697
|
}
|
|
18826
20698
|
warnPersistenceFailure(error) {
|
|
18827
|
-
|
|
20699
|
+
log9.warn("registry.persist-failed", { error: formatLogError(error, { stack: false }) });
|
|
18828
20700
|
}
|
|
18829
20701
|
toRecord(options) {
|
|
18830
20702
|
const { agentMcp: _agentMcp, ...persistedConfig } = options.config;
|
|
@@ -18848,6 +20720,7 @@ class BridgeSessionStore {
|
|
|
18848
20720
|
}
|
|
18849
20721
|
|
|
18850
20722
|
// ../../bridges/codex-bridge/src/sessions/dispatch-journal.ts
|
|
20723
|
+
var log10 = createLogger("bridge.codex");
|
|
18851
20724
|
var DISPATCH_JOURNAL_VERSION = 1;
|
|
18852
20725
|
var DISPATCH_COMPLETENESS_VERSION = 1;
|
|
18853
20726
|
var MAX_FRESH_SESSION_MARKERS = 256;
|
|
@@ -19386,7 +21259,7 @@ class DispatchJournal {
|
|
|
19386
21259
|
throw error;
|
|
19387
21260
|
});
|
|
19388
21261
|
} catch (error) {
|
|
19389
|
-
|
|
21262
|
+
log10.warn("journal.persist-failed", { error: formatLogError(error, { stack: false }) });
|
|
19390
21263
|
if (options.failClosed)
|
|
19391
21264
|
throw error;
|
|
19392
21265
|
}
|
|
@@ -20051,6 +21924,7 @@ var APP_SERVER_CAPABILITIES = {
|
|
|
20051
21924
|
};
|
|
20052
21925
|
|
|
20053
21926
|
// ../../bridges/codex-bridge/src/engine/app-server-engine.ts
|
|
21927
|
+
var log11 = createLogger("bridge.codex");
|
|
20054
21928
|
var AGENT_MAIL_TOOL_APPROVALS = Object.fromEntries([
|
|
20055
21929
|
...AGENT_MAIL_TOOL_NAMES,
|
|
20056
21930
|
...ARTIFACT_TOOL_NAMES,
|
|
@@ -20634,7 +22508,7 @@ class AppServerEngine {
|
|
|
20634
22508
|
try {
|
|
20635
22509
|
listener(event);
|
|
20636
22510
|
} catch (error) {
|
|
20637
|
-
|
|
22511
|
+
log11.error("engine.listener-failed", { error: formatLogError(error) });
|
|
20638
22512
|
}
|
|
20639
22513
|
}
|
|
20640
22514
|
}
|
|
@@ -20759,7 +22633,9 @@ class AppServerEngine {
|
|
|
20759
22633
|
const sequence = ++this.accountCheckSequence;
|
|
20760
22634
|
const generation = this.supervisor.getGeneration();
|
|
20761
22635
|
this.supervisor.request("account/read", { refreshToken }).catch(signedOutAccountRead).then((response) => this.applyAccountRead(response, sequence, generation, accountReplaced)).catch((error) => {
|
|
20762
|
-
|
|
22636
|
+
log11.warn("account.sign-in-check-failed", {
|
|
22637
|
+
error: formatLogError(error, { stack: false })
|
|
22638
|
+
});
|
|
20763
22639
|
});
|
|
20764
22640
|
}
|
|
20765
22641
|
async applyAccountRead(response, sequence, generation, accountChanged) {
|
|
@@ -21344,7 +23220,9 @@ class AppServerEngine {
|
|
|
21344
23220
|
const generation = this.supervisor.getGeneration();
|
|
21345
23221
|
const response = await this.supervisor.request("account/read", { refreshToken: false }).catch(signedOutAccountRead);
|
|
21346
23222
|
this.applyAccountRead(response, sequence, generation, false).catch((error) => {
|
|
21347
|
-
|
|
23223
|
+
log11.warn("account.connector-recovery-failed", {
|
|
23224
|
+
error: formatLogError(error, { stack: false })
|
|
23225
|
+
});
|
|
21348
23226
|
});
|
|
21349
23227
|
const pendingSignIn = normalizePendingSignIn(this.pendingSignIn?.display);
|
|
21350
23228
|
if (!pendingSignIn && this.pendingSignIn) {
|
|
@@ -21555,7 +23433,7 @@ class AppServerEngine {
|
|
|
21555
23433
|
await this.supervisor.request("thread/name/set", { threadId, name });
|
|
21556
23434
|
return true;
|
|
21557
23435
|
} catch (error) {
|
|
21558
|
-
|
|
23436
|
+
log11.warn("thread.rename-failed", { error: formatLogError(error, { stack: false }) });
|
|
21559
23437
|
return false;
|
|
21560
23438
|
}
|
|
21561
23439
|
}
|
|
@@ -21575,7 +23453,7 @@ class AppServerEngine {
|
|
|
21575
23453
|
} catch (error) {
|
|
21576
23454
|
if (requireConfirmation)
|
|
21577
23455
|
throw error;
|
|
21578
|
-
|
|
23456
|
+
log11.warn("thread.unsubscribe-failed", { error: formatLogError(error, { stack: false }) });
|
|
21579
23457
|
}
|
|
21580
23458
|
this.accountProofTurns.delete(threadId);
|
|
21581
23459
|
this.rolloutPaths.delete(threadId);
|
|
@@ -22117,6 +23995,7 @@ function externalRevertCut(messages, survivingTurnIds, running) {
|
|
|
22117
23995
|
}
|
|
22118
23996
|
|
|
22119
23997
|
// ../../bridges/codex-bridge/src/app-server-runtime-sessions.ts
|
|
23998
|
+
var log12 = createLogger("bridge.codex");
|
|
22120
23999
|
var SESSION_CLOSING_ERROR = "Session is closing";
|
|
22121
24000
|
var ACTIVITY_PROCESS = randomUUID8();
|
|
22122
24001
|
|
|
@@ -22243,7 +24122,10 @@ class CodexRuntimeSessions {
|
|
|
22243
24122
|
try {
|
|
22244
24123
|
fork = await this.ctx.options.engine.forkThread(parent.threadId, parent.config, lastTurnId);
|
|
22245
24124
|
} catch (error) {
|
|
22246
|
-
|
|
24125
|
+
log12.warn("thread.fork-failed", {
|
|
24126
|
+
threadId: parent.threadId,
|
|
24127
|
+
error: formatLogError(error, { stack: false })
|
|
24128
|
+
});
|
|
22247
24129
|
return { outcome: "unavailable" };
|
|
22248
24130
|
}
|
|
22249
24131
|
if (!fork.id)
|
|
@@ -22292,7 +24174,10 @@ class CodexRuntimeSessions {
|
|
|
22292
24174
|
await this.ctx.callbacks.deleteSession(child.id).catch(() => {
|
|
22293
24175
|
return;
|
|
22294
24176
|
});
|
|
22295
|
-
|
|
24177
|
+
log12.warn("thread.fork-hydrate-failed", {
|
|
24178
|
+
threadId: parent.threadId,
|
|
24179
|
+
error: formatLogError(error, { stack: false })
|
|
24180
|
+
});
|
|
22296
24181
|
return { outcome: "unavailable" };
|
|
22297
24182
|
}
|
|
22298
24183
|
}
|
|
@@ -22304,7 +24189,10 @@ class CodexRuntimeSessions {
|
|
|
22304
24189
|
});
|
|
22305
24190
|
turns = thread?.turns;
|
|
22306
24191
|
} catch (error) {
|
|
22307
|
-
|
|
24192
|
+
log12.warn("thread.turns-read-failed", {
|
|
24193
|
+
threadId: context.threadId,
|
|
24194
|
+
error: formatLogError(error, { stack: false })
|
|
24195
|
+
});
|
|
22308
24196
|
return;
|
|
22309
24197
|
}
|
|
22310
24198
|
if (!turns?.length)
|
|
@@ -22792,7 +24680,10 @@ class CodexRuntimeSessions {
|
|
|
22792
24680
|
try {
|
|
22793
24681
|
turns = (await this.ctx.options.engine.readThread(context.threadId, { includeTurns: true }))?.turns;
|
|
22794
24682
|
} catch (error) {
|
|
22795
|
-
|
|
24683
|
+
log12.warn("thread.turns-read-after-revert-failed", {
|
|
24684
|
+
threadId: context.threadId,
|
|
24685
|
+
error: formatLogError(error, { stack: false })
|
|
24686
|
+
});
|
|
22796
24687
|
return;
|
|
22797
24688
|
}
|
|
22798
24689
|
if (!turns || this.ctx.registry.getThread(context.threadId) !== context)
|
|
@@ -22880,7 +24771,10 @@ class CodexRuntimeSessions {
|
|
|
22880
24771
|
if (attached && requestedModelChanged) {
|
|
22881
24772
|
attached.modelId = previousConfirmedModel;
|
|
22882
24773
|
}
|
|
22883
|
-
|
|
24774
|
+
log12.warn("session.config-apply-failed", {
|
|
24775
|
+
sessionId,
|
|
24776
|
+
error: formatLogError(error, { stack: false })
|
|
24777
|
+
});
|
|
22884
24778
|
return "unavailable";
|
|
22885
24779
|
}
|
|
22886
24780
|
if (session.config.policy?.projectResources !== nextConfig.policy?.projectResources) {
|
|
@@ -22900,7 +24794,10 @@ class CodexRuntimeSessions {
|
|
|
22900
24794
|
try {
|
|
22901
24795
|
context = await this.ctx.callbacks.ensureAttached(sessionId);
|
|
22902
24796
|
} catch (error) {
|
|
22903
|
-
|
|
24797
|
+
log12.warn("transcript.serving-last-known", {
|
|
24798
|
+
sessionId,
|
|
24799
|
+
error: formatLogError(error, { stack: false })
|
|
24800
|
+
});
|
|
22904
24801
|
const known = this.ctx.registry.getThreadForSession(sessionId);
|
|
22905
24802
|
return known ? this.ctx.callbacks.messagesForSession(session, known) : [...session.localMessages];
|
|
22906
24803
|
}
|
|
@@ -23099,7 +24996,7 @@ class CodexRuntimeSessions {
|
|
|
23099
24996
|
}
|
|
23100
24997
|
return "unpublished";
|
|
23101
24998
|
}
|
|
23102
|
-
|
|
24999
|
+
log12.warn("registry.persist-failed", { error: formatLogError(error, { stack: false }) });
|
|
23103
25000
|
}
|
|
23104
25001
|
if (this.ctx.registry.getSession(sessionId) !== session)
|
|
23105
25002
|
return "released";
|
|
@@ -23193,6 +25090,8 @@ class CodexRuntimeSessions {
|
|
|
23193
25090
|
}
|
|
23194
25091
|
}
|
|
23195
25092
|
// ../../bridges/codex-bridge/src/app-server-runtime-approvals.ts
|
|
25093
|
+
var log13 = createLogger("bridge.codex");
|
|
25094
|
+
|
|
23196
25095
|
class CodexRuntimeApprovals {
|
|
23197
25096
|
ctx;
|
|
23198
25097
|
lifecycle;
|
|
@@ -23282,7 +25181,7 @@ class CodexRuntimeApprovals {
|
|
|
23282
25181
|
if (this.ctx.options.engine.resolveApproval(approvalId, decision)) {
|
|
23283
25182
|
if (decision === "cancel") {
|
|
23284
25183
|
this.ctx.callbacks.abort(sessionId).catch((error) => {
|
|
23285
|
-
|
|
25184
|
+
log13.error("approval.cancel-failed", { error: formatLogError(error) });
|
|
23286
25185
|
});
|
|
23287
25186
|
}
|
|
23288
25187
|
return "applied";
|
|
@@ -23473,7 +25372,7 @@ async function readBounded2(absolutePath, maxBytes) {
|
|
|
23473
25372
|
await handle.close();
|
|
23474
25373
|
}
|
|
23475
25374
|
}
|
|
23476
|
-
function
|
|
25375
|
+
function describe2(bytes, candidate) {
|
|
23477
25376
|
const content = new TextDecoder("utf-8").decode(bytes);
|
|
23478
25377
|
const parsed = extractFrontmatter(content);
|
|
23479
25378
|
const base = candidate.relativePath.replace(/\.md$/i, "").split("/").at(-1) ?? "template";
|
|
@@ -23601,7 +25500,7 @@ async function scanPromptTemplates(roots, limits = TEMPLATE_LIMITS) {
|
|
|
23601
25500
|
const metadata = {
|
|
23602
25501
|
statKey: candidate.statKey,
|
|
23603
25502
|
fingerprint: fingerprintOf(bytes),
|
|
23604
|
-
...
|
|
25503
|
+
...describe2(bytes, candidate)
|
|
23605
25504
|
};
|
|
23606
25505
|
if (metadataCache.size >= METADATA_CACHE_MAX)
|
|
23607
25506
|
metadataCache.clear();
|
|
@@ -24685,6 +26584,8 @@ class UpdateCoalescer {
|
|
|
24685
26584
|
|
|
24686
26585
|
// ../../bridges/codex-bridge/src/app-server-runtime-capacity-retry.ts
|
|
24687
26586
|
import { stat as stat8 } from "node:fs/promises";
|
|
26587
|
+
var log14 = createLogger("bridge.codex");
|
|
26588
|
+
|
|
24688
26589
|
class CodexCapacityRetry {
|
|
24689
26590
|
ctx;
|
|
24690
26591
|
lifecycle;
|
|
@@ -24797,7 +26698,10 @@ class CodexCapacityRetry {
|
|
|
24797
26698
|
}
|
|
24798
26699
|
entry.stage = "starting";
|
|
24799
26700
|
const work = this.startContinuation(context, turn, entry).catch((error) => {
|
|
24800
|
-
|
|
26701
|
+
log14.error("turn.capacity-retry-failed", {
|
|
26702
|
+
turnId: turn.turnId,
|
|
26703
|
+
error: formatLogError(error, { stack: false })
|
|
26704
|
+
});
|
|
24801
26705
|
if (this.pending.get(turn) === entry && context.activeTurn === turn && !turn.isTerminal()) {
|
|
24802
26706
|
this.end(context, turn, "failed", entry.error, CAPACITY_RETRY_START_FAILED_TEXT);
|
|
24803
26707
|
}
|
|
@@ -24866,7 +26770,10 @@ class CodexCapacityRetry {
|
|
|
24866
26770
|
});
|
|
24867
26771
|
return;
|
|
24868
26772
|
}
|
|
24869
|
-
await this.ctx.journal.markAccepted(requestId, { threadId: context.threadId, turnId: started.turnId }).catch((error) =>
|
|
26773
|
+
await this.ctx.journal.markAccepted(requestId, { threadId: context.threadId, turnId: started.turnId }).catch((error) => log14.warn("turn.capacity-retry-journal-failed", {
|
|
26774
|
+
requestId,
|
|
26775
|
+
error: formatLogError(error, { stack: false })
|
|
26776
|
+
}));
|
|
24870
26777
|
if (plan.outputSchema) {
|
|
24871
26778
|
const ledger = this.ctx.registry.recordStructuredOutputTurn(context.threadId, started.turnId, false);
|
|
24872
26779
|
await Promise.all(ledger.map((session) => this.ctx.callbacks.persistSession(session)));
|
|
@@ -24934,6 +26841,7 @@ class CodexCapacityRetry {
|
|
|
24934
26841
|
}
|
|
24935
26842
|
|
|
24936
26843
|
// ../../bridges/codex-bridge/src/app-server-runtime-lifecycle.ts
|
|
26844
|
+
var log15 = createLogger("bridge.codex");
|
|
24937
26845
|
function artifactConnectionToken(value) {
|
|
24938
26846
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
24939
26847
|
return;
|
|
@@ -25117,7 +27025,10 @@ class CodexRuntimeLifecycle {
|
|
|
25117
27025
|
this.ctx.registry.setPhase(existing, "recovering");
|
|
25118
27026
|
this.emitStatus(existing);
|
|
25119
27027
|
this.ctx.callbacks.scheduleRecoveryBackstop(existing);
|
|
25120
|
-
|
|
27028
|
+
log15.warn("dispatch.restore-failed", {
|
|
27029
|
+
requestId: record.requestId,
|
|
27030
|
+
error: formatLogError(error, { stack: false })
|
|
27031
|
+
});
|
|
25121
27032
|
return;
|
|
25122
27033
|
}
|
|
25123
27034
|
if (!context) {
|
|
@@ -25293,7 +27204,11 @@ class CodexRuntimeLifecycle {
|
|
|
25293
27204
|
});
|
|
25294
27205
|
}));
|
|
25295
27206
|
}
|
|
25296
|
-
|
|
27207
|
+
log15.warn("thread.reattach-failed", {
|
|
27208
|
+
threadId,
|
|
27209
|
+
rolloutMissing: isMissingRolloutError(error),
|
|
27210
|
+
error: formatLogError(error, { stack: false })
|
|
27211
|
+
});
|
|
25297
27212
|
if (!isMissingRolloutError(error))
|
|
25298
27213
|
throw error;
|
|
25299
27214
|
return;
|
|
@@ -25370,7 +27285,7 @@ class CodexRuntimeLifecycle {
|
|
|
25370
27285
|
coalescer: new UpdateCoalescer({
|
|
25371
27286
|
intervalMs: this.ctx.options.coalesceIntervalMs ?? (() => messageSnapshotIntervalMs(this.ctx.threadState.get(threadId)?.lastPublishedSnapshotChars ?? 0)),
|
|
25372
27287
|
publish: () => this.ctx.callbacks.publishAssistantMessage(threadId),
|
|
25373
|
-
onError: (error) =>
|
|
27288
|
+
onError: (error) => log15.error("message.publish-failed", { error: formatLogError(error) })
|
|
25374
27289
|
})
|
|
25375
27290
|
};
|
|
25376
27291
|
this.ctx.threadState.set(threadId, state);
|
|
@@ -25406,7 +27321,7 @@ class CodexRuntimeLifecycle {
|
|
|
25406
27321
|
this.ctx.commandCatalogue.withdrawGeneration(event.generation);
|
|
25407
27322
|
const recovery = this.ctx.generationRecovery.then(() => this.ctx.callbacks.recoverAfterGenerationChange(event.generation));
|
|
25408
27323
|
this.ctx.generationRecovery = recovery.catch((error) => {
|
|
25409
|
-
|
|
27324
|
+
log15.error("generation.recovery-failed", { error: formatLogError(error) });
|
|
25410
27325
|
});
|
|
25411
27326
|
return;
|
|
25412
27327
|
}
|
|
@@ -25426,7 +27341,7 @@ class CodexRuntimeLifecycle {
|
|
|
25426
27341
|
}
|
|
25427
27342
|
if (event.kind === "account.reload.requested") {
|
|
25428
27343
|
this.ctx.callbacks.reloadStoredAccountLogin().catch((error) => {
|
|
25429
|
-
|
|
27344
|
+
log15.warn("account.login-reload-failed", { error: formatLogError(error, { stack: false }) });
|
|
25430
27345
|
});
|
|
25431
27346
|
return;
|
|
25432
27347
|
}
|
|
@@ -25729,7 +27644,10 @@ class CodexRuntimeLifecycle {
|
|
|
25729
27644
|
}
|
|
25730
27645
|
this.ctx.options.changeEvidence?.turn(this.evidenceSource(context, turn), event.status);
|
|
25731
27646
|
const finalize = () => this.runFinalization(context, turn).catch((error) => {
|
|
25732
|
-
|
|
27647
|
+
log15.error("turn.finalize-failed", {
|
|
27648
|
+
turnId: turn.turnId,
|
|
27649
|
+
error: formatLogError(error, { stack: false })
|
|
27650
|
+
});
|
|
25733
27651
|
});
|
|
25734
27652
|
const tail = this.takeRefusedCellTail(threadId, turn);
|
|
25735
27653
|
if (!tail) {
|
|
@@ -25944,7 +27862,7 @@ class CodexRuntimeLifecycle {
|
|
|
25944
27862
|
}
|
|
25945
27863
|
trackCommandChangeWork(work) {
|
|
25946
27864
|
const tracked = work.catch((error) => {
|
|
25947
|
-
|
|
27865
|
+
log15.warn("command-changes.record-failed", { error: formatLogError(error, { stack: false }) });
|
|
25948
27866
|
});
|
|
25949
27867
|
this.ctx.pendingCommandChanges.add(tracked);
|
|
25950
27868
|
tracked.finally(() => this.ctx.pendingCommandChanges.delete(tracked));
|
|
@@ -26387,7 +28305,7 @@ class CodexRuntimeLifecycle {
|
|
|
26387
28305
|
try {
|
|
26388
28306
|
await state.coalescer.flushNow();
|
|
26389
28307
|
} catch (error) {
|
|
26390
|
-
|
|
28308
|
+
log15.error("ordered-events.flush-failed", { error: formatLogError(error) });
|
|
26391
28309
|
}
|
|
26392
28310
|
state.orderedReconcilePending = false;
|
|
26393
28311
|
for (const sessionId of this.ctx.sessionIdsForThread(threadId)) {
|
|
@@ -26406,7 +28324,7 @@ class CodexRuntimeLifecycle {
|
|
|
26406
28324
|
await state.coalescer.flushNow();
|
|
26407
28325
|
event.publish();
|
|
26408
28326
|
} catch (error) {
|
|
26409
|
-
|
|
28327
|
+
log15.error("ordered-events.publish-failed", { error: formatLogError(error) });
|
|
26410
28328
|
state.orderedEvents.length = 0;
|
|
26411
28329
|
state.orderedEventBytes = 0;
|
|
26412
28330
|
state.orderedReconcilePending = true;
|
|
@@ -26415,7 +28333,7 @@ class CodexRuntimeLifecycle {
|
|
|
26415
28333
|
}
|
|
26416
28334
|
}
|
|
26417
28335
|
} catch (error) {
|
|
26418
|
-
|
|
28336
|
+
log15.error("ordered-events.reconcile-failed", { error: formatLogError(error) });
|
|
26419
28337
|
} finally {
|
|
26420
28338
|
state.orderedEventDraining = false;
|
|
26421
28339
|
if ((state.orderedReconcilePending || state.orderedEvents.length > 0) && this.ctx.threadState.get(threadId) === state) {
|
|
@@ -26531,6 +28449,7 @@ function isTabInitialPromptRequestId(requestId) {
|
|
|
26531
28449
|
}
|
|
26532
28450
|
|
|
26533
28451
|
// ../../bridges/codex-bridge/src/app-server-runtime-prompt.ts
|
|
28452
|
+
var log16 = createLogger("bridge.codex");
|
|
26534
28453
|
function commandRefusal(message) {
|
|
26535
28454
|
return { ok: false, status: 422, error: message, kind: "command-unavailable" };
|
|
26536
28455
|
}
|
|
@@ -27191,7 +29110,11 @@ class CodexRuntimePrompt {
|
|
|
27191
29110
|
try {
|
|
27192
29111
|
outcome = await this.ctx.options.engine.reconcileRequest(context.threadId, accumulator.providerRequestId);
|
|
27193
29112
|
} catch (error) {
|
|
27194
|
-
|
|
29113
|
+
log16.warn("dispatch.reconcile-failed", {
|
|
29114
|
+
requestId,
|
|
29115
|
+
threadId: context.threadId,
|
|
29116
|
+
error: formatLogError(error, { stack: false })
|
|
29117
|
+
});
|
|
27195
29118
|
return "recovering";
|
|
27196
29119
|
}
|
|
27197
29120
|
if (outcome.result === "attach") {
|
|
@@ -27462,7 +29385,7 @@ class CodexRuntimePrompt {
|
|
|
27462
29385
|
if (this.ctx.stopping || this.shouldAbandonDrain(expectedGeneration))
|
|
27463
29386
|
return;
|
|
27464
29387
|
if (Date.now() >= deadline) {
|
|
27465
|
-
|
|
29388
|
+
log16.warn("app-server.drain-expired");
|
|
27466
29389
|
return;
|
|
27467
29390
|
}
|
|
27468
29391
|
await this.waitForThreadActivity();
|
|
@@ -27496,6 +29419,8 @@ class CodexRuntimePrompt {
|
|
|
27496
29419
|
|
|
27497
29420
|
// ../../bridges/codex-bridge/src/app-server-runtime-tail.ts
|
|
27498
29421
|
import { join as join21, relative as relative4, isAbsolute as isAbsolute11 } from "node:path";
|
|
29422
|
+
var log17 = createLogger("bridge.codex");
|
|
29423
|
+
|
|
27499
29424
|
class CodexRuntimeTail {
|
|
27500
29425
|
ctx;
|
|
27501
29426
|
lifecycle;
|
|
@@ -27643,7 +29568,7 @@ class CodexRuntimeTail {
|
|
|
27643
29568
|
};
|
|
27644
29569
|
}
|
|
27645
29570
|
} catch (error) {
|
|
27646
|
-
|
|
29571
|
+
log17.warn("models.list-failed", { error: formatLogError(error, { stack: false }) });
|
|
27647
29572
|
}
|
|
27648
29573
|
return this.ctx.options.loadCachedModels();
|
|
27649
29574
|
}
|
|
@@ -27669,7 +29594,7 @@ class CodexRuntimeTail {
|
|
|
27669
29594
|
});
|
|
27670
29595
|
}
|
|
27671
29596
|
} catch (error) {
|
|
27672
|
-
|
|
29597
|
+
log17.warn("threads.list-failed", { error: formatLogError(error, { stack: false }) });
|
|
27673
29598
|
}
|
|
27674
29599
|
const archived = new Set;
|
|
27675
29600
|
try {
|
|
@@ -27754,7 +29679,10 @@ class CodexRuntimeTail {
|
|
|
27754
29679
|
else
|
|
27755
29680
|
await this.ctx.options.engine.unarchiveThread(threadId);
|
|
27756
29681
|
} catch (error) {
|
|
27757
|
-
|
|
29682
|
+
log17.warn("thread.archive-failed", {
|
|
29683
|
+
archived,
|
|
29684
|
+
error: formatLogError(error, { stack: false })
|
|
29685
|
+
});
|
|
27758
29686
|
return "failed";
|
|
27759
29687
|
} finally {
|
|
27760
29688
|
invalidateTranscriptCatalogCache();
|
|
@@ -28386,6 +30314,7 @@ var CODEX_FALLBACK_MODEL_CATALOG = [
|
|
|
28386
30314
|
];
|
|
28387
30315
|
|
|
28388
30316
|
// ../../bridges/codex-bridge/src/models-cache.ts
|
|
30317
|
+
var log18 = createLogger("bridge.codex");
|
|
28389
30318
|
var MODEL_REASONING_EFFORTS = new Set([
|
|
28390
30319
|
"minimal",
|
|
28391
30320
|
"low",
|
|
@@ -28532,12 +30461,14 @@ class ModelCatalogCache {
|
|
|
28532
30461
|
await this.opts.writePersistedCache(models);
|
|
28533
30462
|
}
|
|
28534
30463
|
} catch (error) {
|
|
28535
|
-
|
|
30464
|
+
log18.warn("models.refresh-failed", { error: formatLogError(error, { stack: false }) });
|
|
28536
30465
|
}
|
|
28537
30466
|
}
|
|
28538
30467
|
}
|
|
28539
30468
|
|
|
28540
30469
|
// ../../bridges/codex-bridge/src/index.ts
|
|
30470
|
+
var log19 = createLogger("bridge.codex");
|
|
30471
|
+
configureBridgeLogger();
|
|
28541
30472
|
var WORKFLOW_RESULT_TOOL_NAMES2 = new Set(WORKFLOW_RESULT_KINDS.map(workflowResultToolName));
|
|
28542
30473
|
function isWorkflowResultTool(value) {
|
|
28543
30474
|
return typeof value === "string" && (WORKFLOW_RESULT_TOOL_NAMES2.has(value) || workflowResultTurnToolPort(value) !== null);
|
|
@@ -28569,7 +30500,11 @@ app.onError((error, c) => {
|
|
|
28569
30500
|
const response = error.getResponse();
|
|
28570
30501
|
return c.newResponse(response.body, response);
|
|
28571
30502
|
}
|
|
28572
|
-
|
|
30503
|
+
log19.error("http.request-failed", {
|
|
30504
|
+
method: c.req.method,
|
|
30505
|
+
path: c.req.path,
|
|
30506
|
+
error: formatLogError(error)
|
|
30507
|
+
});
|
|
28573
30508
|
return c.text("Internal Server Error", 500);
|
|
28574
30509
|
});
|
|
28575
30510
|
var MAX_CODEX_TRANSCRIPT_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
@@ -28593,10 +30528,10 @@ function notifyObservers(event, revision) {
|
|
|
28593
30528
|
for (const observer of observers) {
|
|
28594
30529
|
try {
|
|
28595
30530
|
Promise.resolve(observer(event, revision, "{}")).catch((error) => {
|
|
28596
|
-
|
|
30531
|
+
log19.warn("sse.observer-failed", { error: formatLogError(error) });
|
|
28597
30532
|
});
|
|
28598
30533
|
} catch (error) {
|
|
28599
|
-
|
|
30534
|
+
log19.warn("sse.observer-failed", { error: formatLogError(error) });
|
|
28600
30535
|
}
|
|
28601
30536
|
}
|
|
28602
30537
|
}
|
|
@@ -28729,7 +30664,7 @@ async function writeCodexRawLog(sessionId, entry, logDir = codexRawLogDir) {
|
|
|
28729
30664
|
})}
|
|
28730
30665
|
`, "utf8");
|
|
28731
30666
|
} catch (error) {
|
|
28732
|
-
|
|
30667
|
+
log19.warn("raw-log.write-failed", { error: formatLogError(error) });
|
|
28733
30668
|
}
|
|
28734
30669
|
}
|
|
28735
30670
|
function createShutdownHandler(timer, clearTimer = clearInterval, exit = (code) => process.exit(code), stopEngine = () => stopSelectedEngine()) {
|
|
@@ -28740,12 +30675,12 @@ function createShutdownHandler(timer, clearTimer = clearInterval, exit = (code)
|
|
|
28740
30675
|
shuttingDown = true;
|
|
28741
30676
|
clearTimer(timer);
|
|
28742
30677
|
stopEngine().catch((error) => {
|
|
28743
|
-
|
|
30678
|
+
log19.warn("engine.stop-failed", { error: formatLogError(error) });
|
|
28744
30679
|
}).finally(() => exit(0));
|
|
28745
30680
|
};
|
|
28746
30681
|
}
|
|
28747
30682
|
function createParentExitHandler(interrupt, shutdown, report = (turns, ms) => {
|
|
28748
|
-
|
|
30683
|
+
log19.info("turns.stopped", { turns, elapsedMs: ms });
|
|
28749
30684
|
}) {
|
|
28750
30685
|
return async () => {
|
|
28751
30686
|
const detectedAt = performance.now();
|
|
@@ -28776,7 +30711,7 @@ function serializeSseEventData(event) {
|
|
|
28776
30711
|
...event.data
|
|
28777
30712
|
});
|
|
28778
30713
|
} catch {
|
|
28779
|
-
|
|
30714
|
+
log19.error("sse.payload-serialize-failed");
|
|
28780
30715
|
return JSON.stringify({
|
|
28781
30716
|
sessionId: event.sessionId,
|
|
28782
30717
|
error: "payload could not be serialized"
|
|
@@ -28841,7 +30776,7 @@ function emit(event) {
|
|
|
28841
30776
|
messageId = retainedMessageId(event.type, payload);
|
|
28842
30777
|
bytes = eager === null ? estimateSsePayloadBytes(payload) : Buffer.byteLength(eager, "utf8");
|
|
28843
30778
|
} catch {
|
|
28844
|
-
|
|
30779
|
+
log19.error("sse.payload-snapshot-failed");
|
|
28845
30780
|
payload = { error: "payload could not be serialized" };
|
|
28846
30781
|
eager = subscribers.size > 0 ? serializeSseEventData({ sessionId, data: payload }) : null;
|
|
28847
30782
|
messageId = undefined;
|
|
@@ -28858,10 +30793,10 @@ function emit(event) {
|
|
|
28858
30793
|
for (const subscriber of subscribers) {
|
|
28859
30794
|
try {
|
|
28860
30795
|
Promise.resolve(subscriber(event, revision, eager ?? "{}")).catch((error) => {
|
|
28861
|
-
|
|
30796
|
+
log19.warn("sse.subscriber-failed", { error: formatLogError(error) });
|
|
28862
30797
|
});
|
|
28863
30798
|
} catch (error) {
|
|
28864
|
-
|
|
30799
|
+
log19.warn("sse.subscriber-failed", { error: formatLogError(error) });
|
|
28865
30800
|
}
|
|
28866
30801
|
}
|
|
28867
30802
|
}
|
|
@@ -28888,7 +30823,7 @@ async function writePersistedBridgeCache(models) {
|
|
|
28888
30823
|
await mkdir9(bridgeCacheDir(), { recursive: true });
|
|
28889
30824
|
await writeFile6(bridgeCachePath(), JSON.stringify({ version: BRIDGE_MODEL_CACHE_VERSION, at: Date.now(), models }, null, 2));
|
|
28890
30825
|
} catch (error) {
|
|
28891
|
-
|
|
30826
|
+
log19.warn("models.cache-persist-failed", { error: formatLogError(error, { stack: false }) });
|
|
28892
30827
|
}
|
|
28893
30828
|
}
|
|
28894
30829
|
async function readCodexCliModelCache() {
|
|
@@ -28910,7 +30845,7 @@ async function fetchLiveModelsFromCli(run = execFile4, env = process.env) {
|
|
|
28910
30845
|
const models = parseModelCatalog(stdout);
|
|
28911
30846
|
return models.length > 0 ? models : null;
|
|
28912
30847
|
} catch (error) {
|
|
28913
|
-
|
|
30848
|
+
log19.warn("models.debug-read-failed", { error: formatLogError(error, { stack: false }) });
|
|
28914
30849
|
return null;
|
|
28915
30850
|
}
|
|
28916
30851
|
}
|
|
@@ -28955,7 +30890,7 @@ async function sweepIdleThreads(runtime = appServerRuntime) {
|
|
|
28955
30890
|
try {
|
|
28956
30891
|
await runtime.sweepIdle();
|
|
28957
30892
|
} catch (error) {
|
|
28958
|
-
|
|
30893
|
+
log19.warn("idle-sweep.failed", { error: formatLogError(error) });
|
|
28959
30894
|
}
|
|
28960
30895
|
}
|
|
28961
30896
|
function createCodexProcessDiagnostics(runtime = appServerRuntime) {
|
|
@@ -28991,9 +30926,9 @@ async function startSelectedEngine(env = process.env, runtime = appServerRuntime
|
|
|
28991
30926
|
}
|
|
28992
30927
|
try {
|
|
28993
30928
|
await runtime.start();
|
|
28994
|
-
|
|
30929
|
+
log19.info("engine.ready", { codexVersion: runtime.getHealth().codexVersion ?? "unknown" });
|
|
28995
30930
|
} catch (error) {
|
|
28996
|
-
|
|
30931
|
+
log19.error("engine.start-failed", { error: formatLogError(error, { stack: false }) });
|
|
28997
30932
|
}
|
|
28998
30933
|
}
|
|
28999
30934
|
var __testing = {
|
|
@@ -29079,7 +31014,7 @@ function startSseKeepalive(writeSSE, intervalMs = 5000, shouldSendAtActiveCadenc
|
|
|
29079
31014
|
id: String(eventRing.latestRevision),
|
|
29080
31015
|
data: "{}"
|
|
29081
31016
|
}).catch((error) => {
|
|
29082
|
-
|
|
31017
|
+
log19.warn("sse.keepalive-failed", { error: formatLogError(error, { stack: false }) });
|
|
29083
31018
|
});
|
|
29084
31019
|
}, intervalMs);
|
|
29085
31020
|
}
|
|
@@ -29158,6 +31093,10 @@ app.use("/session/:id/transcript", async (c, next) => {
|
|
|
29158
31093
|
c.res.headers.append("Vary", "Accept-Encoding");
|
|
29159
31094
|
});
|
|
29160
31095
|
app.use("/session/:id/transcript", compress({ encoding: "gzip" }));
|
|
31096
|
+
app.post(BRIDGE_LOG_POLICY_ROUTE, async (c) => {
|
|
31097
|
+
const answer = applyBridgeLogPolicy(await readBridgeLogPolicyBody(c.req.raw));
|
|
31098
|
+
return c.json(answer.body, answer.status);
|
|
31099
|
+
});
|
|
29161
31100
|
app.get("/global/health", (c) => {
|
|
29162
31101
|
const health = appServerRuntime.getHealth();
|
|
29163
31102
|
const terminal = health.state === "failed" || health.circuitOpen;
|
|
@@ -29329,7 +31268,7 @@ app.get("/session/:id/usage", async (c) => {
|
|
|
29329
31268
|
return c.json({ error: "Session not found" }, 404);
|
|
29330
31269
|
return c.json({ contextUsage });
|
|
29331
31270
|
} catch (error) {
|
|
29332
|
-
|
|
31271
|
+
log19.warn("account.usage-read-failed", { error: formatLogError(error, { stack: false }) });
|
|
29333
31272
|
return c.json({ error: "Account usage is temporarily unavailable" }, 503);
|
|
29334
31273
|
}
|
|
29335
31274
|
});
|
|
@@ -29739,7 +31678,7 @@ app.get("/event/subscribe", (c) => {
|
|
|
29739
31678
|
if (!open)
|
|
29740
31679
|
return;
|
|
29741
31680
|
open = false;
|
|
29742
|
-
|
|
31681
|
+
log19.info("sse.closed", { reason });
|
|
29743
31682
|
resolveConnectionClosed();
|
|
29744
31683
|
};
|
|
29745
31684
|
const writeWhileOpen = createSerializedSseWriter(createOpenSseWriter(() => open, (event) => stream.writeSSE(event)), { onOverflow: () => failSlowSubscriber("write backlog exceeded its cap") });
|
|
@@ -29887,7 +31826,7 @@ if (parentPid !== null) {
|
|
|
29887
31826
|
startParentWatchdog({
|
|
29888
31827
|
parentPid,
|
|
29889
31828
|
onParentExit: () => {
|
|
29890
|
-
|
|
31829
|
+
log19.warn("parent.gone", { parentPid });
|
|
29891
31830
|
createParentExitHandler((budgetMs) => appServerRuntime.interruptForParentExit(budgetMs), shutdownHandler)();
|
|
29892
31831
|
}
|
|
29893
31832
|
});
|