@myagentroam/node 0.9.9 → 0.9.11
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/capabilities.js +2 -92
- package/dist/claude-agent-sdk.js +2 -330
- package/dist/claude-channel.js +2 -44
- package/dist/codex-app-server.js +2 -503
- package/dist/config.js +2 -56
- package/dist/connector/node-connector-options.js +2 -1
- package/dist/connector/node-operation-router.js +2 -22
- package/dist/connector.js +2 -845
- package/dist/control-outbound-scheduler.js +2 -154
- package/dist/database.js +2 -1418
- package/dist/event-buffer.js +2 -19
- package/dist/fake-runner.js +2 -129
- package/dist/health.js +2 -3
- package/dist/main.js +2 -54
- package/dist/migrations/v001.js +3 -144
- package/dist/migrations/v002.js +2 -143
- package/dist/migrations/v003.js +2 -44
- package/dist/migrations/v004.js +34 -30
- package/dist/native-jsonl-reader.js +2 -186
- package/dist/native-session-history.js +2 -1119
- package/dist/opencode-runtime.js +2 -80
- package/dist/opencode-server.js +2 -263
- package/dist/operational.js +2 -122
- package/dist/process-tree.js +2 -18
- package/dist/rotating-log.js +2 -67
- package/dist/runner/abstract-runner.js +2 -232
- package/dist/runner/claude/managed-run-controller.js +2 -345
- package/dist/runner/claude-code-runner.js +2 -303
- package/dist/runner/codex/composer-image-markers.js +2 -0
- package/dist/runner/codex/conversation-parser.js +2 -861
- package/dist/runner/codex/managed-run-controller.js +2 -460
- package/dist/runner/codex-runner.js +2 -628
- package/dist/runner/fake-test-runner.js +2 -47
- package/dist/runner/opencode/conversation-parser.js +2 -221
- package/dist/runner/opencode/managed-run-controller.js +2 -537
- package/dist/runner/opencode-runner.js +2 -448
- package/dist/runner/runner-registry.js +2 -90
- package/dist/runner-command-engine.js +2 -70
- package/dist/runner-profiles.js +2 -215
- package/dist/runner-usage.js +2 -190
- package/dist/runtime-command-detector.js +2 -73
- package/dist/runtime-state.js +2 -982
- package/dist/service/attachment-domain-state.js +2 -7
- package/dist/service/conversation-history-service.js +2 -457
- package/dist/service/conversation-segment-service.js +2 -162
- package/dist/service/external-session-resume-service.js +2 -118
- package/dist/service/fake-managed-run-service.js +2 -60
- package/dist/service/managed-runner-session-service.js +2 -35
- package/dist/service/mcp-installation-verifier.js +2 -87
- package/dist/service/mcp-node-operation-service.js +2 -90
- package/dist/service/mcp-package-installer.js +2 -136
- package/dist/service/native-session-projection-service.js +2 -280
- package/dist/service/native-session-watch-service.js +2 -383
- package/dist/service/node-connection-lifecycle-service.js +2 -84
- package/dist/service/node-control-channel.js +2 -85
- package/dist/service/node-control-message-service.js +2 -107
- package/dist/service/node-request-service.js +2 -52
- package/dist/service/node-run-event-bridge.js +2 -83
- package/dist/service/node-terminal-channel.js +2 -182
- package/dist/service/node-upgrade-coordinator.js +2 -137
- package/dist/service/node-workspace-coordinator.js +2 -70
- package/dist/service/recent-run-projection-service.js +2 -78
- package/dist/service/run-attachment-service.js +2 -194
- package/dist/service/run-domain-state.js +2 -4
- package/dist/service/run-event-service.js +2 -193
- package/dist/service/run-workbench-service.js +2 -104
- package/dist/service/runner-channel-message-service.js +2 -20
- package/dist/service/runner-interaction-service.js +2 -243
- package/dist/service/runner-service.js +2 -71
- package/dist/service/session-catalog-service.js +2 -224
- package/dist/service/session-command-service.js +2 -76
- package/dist/service/session-context-service.js +2 -101
- package/dist/service/session-domain-state.js +2 -9
- package/dist/service/session-identity-service.js +2 -86
- package/dist/service/session-lifecycle-service.js +2 -240
- package/dist/service/session-message-service.js +2 -173
- package/dist/service/session-presentation-service.js +2 -43
- package/dist/service/session-query-service.js +2 -82
- package/dist/service/skill-directory-service.js +2 -238
- package/dist/service/skill-install-service.js +2 -434
- package/dist/service/skill-node-operation-service.js +2 -206
- package/dist/service/terminal-relay-state.js +2 -3
- package/dist/service/terminal-service.js +2 -52
- package/dist/service/workbench-event-service.js +2 -19
- package/dist/service/workbench-manifest-service.js +2 -69
- package/dist/service/workspace-change-service.js +2 -86
- package/dist/service/workspace-content-search-service.js +2 -477
- package/dist/service/workspace-domain-state.js +2 -41
- package/dist/service/workspace-file-service.js +2 -122
- package/dist/service/workspace-git-exclude-service.js +2 -119
- package/dist/service/workspace-queue-workbench-service.js +2 -304
- package/dist/service/workspace-service.js +2 -69
- package/dist/service/workspace-session-service.js +2 -139
- package/dist/service/workspace-upload-service.js +2 -262
- package/dist/service/workspace-watch-service.js +2 -146
- package/dist/service/workspace-workbench-service.js +2 -405
- package/dist/service.js +2 -38
- package/dist/storage.js +2 -32
- package/dist/supervisor.js +2 -136
- package/dist/terminal.js +2 -416
- package/dist/util/node-operation-parsers.js +2 -382
- package/dist/util/personal-instructions.js +2 -31
- package/dist/util/runner-error.js +2 -52
- package/dist/util/runner-native-session-parsers.js +2 -490
- package/dist/util/safe-error.js +2 -5
- package/dist/util/secret-environment.js +2 -25
- package/dist/workspace.js +2 -1519
- package/package.json +3 -3
- package/dist/capabilities.d.ts +0 -12
- package/dist/claude-agent-sdk.d.ts +0 -92
- package/dist/claude-channel.d.ts +0 -28
- package/dist/codex-app-server.d.ts +0 -133
- package/dist/config.d.ts +0 -18
- package/dist/connector/node-connector-options.d.ts +0 -27
- package/dist/connector/node-operation-router.d.ts +0 -9
- package/dist/connector.d.ts +0 -94
- package/dist/control-outbound-scheduler.d.ts +0 -29
- package/dist/database.d.ts +0 -305
- package/dist/event-buffer.d.ts +0 -9
- package/dist/fake-runner.d.ts +0 -42
- package/dist/health.d.ts +0 -4
- package/dist/main.d.ts +0 -2
- package/dist/migrations/v001.d.ts +0 -3
- package/dist/migrations/v002.d.ts +0 -4
- package/dist/migrations/v003.d.ts +0 -4
- package/dist/migrations/v004.d.ts +0 -4
- package/dist/native-jsonl-reader.d.ts +0 -35
- package/dist/native-session-history.d.ts +0 -126
- package/dist/opencode-runtime.d.ts +0 -33
- package/dist/opencode-server.d.ts +0 -49
- package/dist/operational.d.ts +0 -39
- package/dist/process-tree.d.ts +0 -9
- package/dist/rotating-log.d.ts +0 -17
- package/dist/runner/abstract-runner.d.ts +0 -172
- package/dist/runner/claude/managed-run-controller.d.ts +0 -51
- package/dist/runner/claude-code-runner.d.ts +0 -72
- package/dist/runner/codex/conversation-parser.d.ts +0 -59
- package/dist/runner/codex/managed-run-controller.d.ts +0 -90
- package/dist/runner/codex-runner.d.ts +0 -103
- package/dist/runner/fake-test-runner.d.ts +0 -26
- package/dist/runner/opencode/conversation-parser.d.ts +0 -31
- package/dist/runner/opencode/managed-run-controller.d.ts +0 -82
- package/dist/runner/opencode-runner.d.ts +0 -71
- package/dist/runner/runner-registry.d.ts +0 -19
- package/dist/runner-command-engine.d.ts +0 -28
- package/dist/runner-profiles.d.ts +0 -15
- package/dist/runner-usage.d.ts +0 -33
- package/dist/runtime-command-detector.d.ts +0 -3
- package/dist/runtime-state.d.ts +0 -171
- package/dist/service/attachment-domain-state.d.ts +0 -7
- package/dist/service/conversation-history-service.d.ts +0 -43
- package/dist/service/conversation-segment-service.d.ts +0 -20
- package/dist/service/external-session-resume-service.d.ts +0 -34
- package/dist/service/fake-managed-run-service.d.ts +0 -28
- package/dist/service/managed-runner-session-service.d.ts +0 -12
- package/dist/service/mcp-installation-verifier.d.ts +0 -9
- package/dist/service/mcp-node-operation-service.d.ts +0 -11
- package/dist/service/mcp-package-installer.d.ts +0 -8
- package/dist/service/native-session-projection-service.d.ts +0 -52
- package/dist/service/native-session-watch-service.d.ts +0 -62
- package/dist/service/node-connection-lifecycle-service.d.ts +0 -36
- package/dist/service/node-control-channel.d.ts +0 -32
- package/dist/service/node-control-message-service.d.ts +0 -27
- package/dist/service/node-request-service.d.ts +0 -14
- package/dist/service/node-run-event-bridge.d.ts +0 -40
- package/dist/service/node-terminal-channel.d.ts +0 -29
- package/dist/service/node-upgrade-coordinator.d.ts +0 -29
- package/dist/service/node-workspace-coordinator.d.ts +0 -29
- package/dist/service/recent-run-projection-service.d.ts +0 -14
- package/dist/service/run-attachment-service.d.ts +0 -38
- package/dist/service/run-domain-state.d.ts +0 -4
- package/dist/service/run-event-service.d.ts +0 -33
- package/dist/service/run-workbench-service.d.ts +0 -25
- package/dist/service/runner-channel-message-service.d.ts +0 -13
- package/dist/service/runner-interaction-service.d.ts +0 -39
- package/dist/service/runner-service.d.ts +0 -46
- package/dist/service/session-catalog-service.d.ts +0 -45
- package/dist/service/session-command-service.d.ts +0 -24
- package/dist/service/session-context-service.d.ts +0 -35
- package/dist/service/session-domain-state.d.ts +0 -9
- package/dist/service/session-identity-service.d.ts +0 -24
- package/dist/service/session-lifecycle-service.d.ts +0 -31
- package/dist/service/session-message-service.d.ts +0 -33
- package/dist/service/session-presentation-service.d.ts +0 -34
- package/dist/service/session-query-service.d.ts +0 -35
- package/dist/service/skill-directory-service.d.ts +0 -20
- package/dist/service/skill-install-service.d.ts +0 -21
- package/dist/service/skill-node-operation-service.d.ts +0 -44
- package/dist/service/terminal-relay-state.d.ts +0 -6
- package/dist/service/terminal-service.d.ts +0 -12
- package/dist/service/workbench-event-service.d.ts +0 -9
- package/dist/service/workbench-manifest-service.d.ts +0 -90
- package/dist/service/workspace-change-service.d.ts +0 -9
- package/dist/service/workspace-content-search-service.d.ts +0 -14
- package/dist/service/workspace-domain-state.d.ts +0 -79
- package/dist/service/workspace-file-service.d.ts +0 -18
- package/dist/service/workspace-git-exclude-service.d.ts +0 -4
- package/dist/service/workspace-queue-workbench-service.d.ts +0 -86
- package/dist/service/workspace-service.d.ts +0 -15
- package/dist/service/workspace-session-service.d.ts +0 -23
- package/dist/service/workspace-upload-service.d.ts +0 -39
- package/dist/service/workspace-watch-service.d.ts +0 -23
- package/dist/service/workspace-workbench-service.d.ts +0 -58
- package/dist/service.d.ts +0 -4
- package/dist/storage.d.ts +0 -2
- package/dist/supervisor.d.ts +0 -1
- package/dist/terminal.d.ts +0 -133
- package/dist/util/node-operation-parsers.d.ts +0 -92
- package/dist/util/personal-instructions.d.ts +0 -2
- package/dist/util/runner-error.d.ts +0 -6
- package/dist/util/runner-native-session-parsers.d.ts +0 -74
- package/dist/util/safe-error.d.ts +0 -2
- package/dist/util/secret-environment.d.ts +0 -1
- package/dist/workspace.d.ts +0 -217
|
@@ -1,460 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { parseSecretEnvironment } from '../../util/secret-environment.js';
|
|
3
|
-
import { safeErrorCode } from '../../util/safe-error.js';
|
|
4
|
-
import { runnerErrorProjection } from '../../util/runner-error.js';
|
|
5
|
-
import { boundedConversationItemId, codexImageAttachments, codexLiveConversationItem, codexUserInputQuestions, compactRunnerText, isPlainRecord } from './conversation-parser.js';
|
|
6
|
-
export function resolveCodexNotificationRun(runs, input) {
|
|
7
|
-
const entries = [...runs.entries()];
|
|
8
|
-
if (input.turnId !== undefined) {
|
|
9
|
-
const exact = entries.find(([, value]) => value.turnId === input.turnId &&
|
|
10
|
-
(input.threadId === undefined || value.threadId === input.threadId));
|
|
11
|
-
if (exact !== undefined)
|
|
12
|
-
return exact;
|
|
13
|
-
if (input.allowUnboundFallback !== true)
|
|
14
|
-
return undefined;
|
|
15
|
-
// `turn/started` can arrive before the `turn/start` response binds its native Turn ID. Only
|
|
16
|
-
// an unbound Run on the same thread is a valid fallback; an older bound Run is never valid.
|
|
17
|
-
return entries
|
|
18
|
-
.reverse()
|
|
19
|
-
.find(([, value]) => value.threadId === input.threadId && value.turnId === undefined);
|
|
20
|
-
}
|
|
21
|
-
if (input.threadId === undefined)
|
|
22
|
-
return undefined;
|
|
23
|
-
return entries.reverse().find(([, value]) => value.threadId === input.threadId);
|
|
24
|
-
}
|
|
25
|
-
export class CodexManagedRunController {
|
|
26
|
-
runner;
|
|
27
|
-
host;
|
|
28
|
-
constructor(runner, host) {
|
|
29
|
-
this.runner = runner;
|
|
30
|
-
this.host = host;
|
|
31
|
-
}
|
|
32
|
-
async executeCommand(session, command, input, context) {
|
|
33
|
-
if (command.id === 'plan') {
|
|
34
|
-
const environmentLeaseId = crypto.randomUUID();
|
|
35
|
-
this.runner.prepareEnvironment(context.secretEnvironment, environmentLeaseId);
|
|
36
|
-
let modes;
|
|
37
|
-
try {
|
|
38
|
-
await this.runner.start();
|
|
39
|
-
modes = await this.runner.listCollaborationModes();
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
this.runner.releaseEnvironment(environmentLeaseId);
|
|
43
|
-
}
|
|
44
|
-
if (!isPlainRecord(modes) ||
|
|
45
|
-
!Array.isArray(modes.data) ||
|
|
46
|
-
!modes.data.some((mode) => isPlainRecord(mode) && mode.mode === 'plan'))
|
|
47
|
-
throw new Error('RUNNER_COMMAND_UNAVAILABLE');
|
|
48
|
-
const current = this.host.commandState(session.id, 'plan');
|
|
49
|
-
if (current?.active)
|
|
50
|
-
this.host.clearCommandState(session.id, 'plan');
|
|
51
|
-
else
|
|
52
|
-
this.host.setCommandState(session.id, {
|
|
53
|
-
commandId: 'plan',
|
|
54
|
-
active: true,
|
|
55
|
-
label: 'Plan Mode',
|
|
56
|
-
detail: 'Subsequent messages run in collaborative Plan Mode.',
|
|
57
|
-
closable: true,
|
|
58
|
-
closeInput: '/plan',
|
|
59
|
-
continuation: { label: 'Implement', prompt: 'Implement the plan above.' }
|
|
60
|
-
});
|
|
61
|
-
return { command: command.id, states: this.host.commandStates(session.id) };
|
|
62
|
-
}
|
|
63
|
-
const threadId = session.externalSessionId;
|
|
64
|
-
if (threadId === null || session.nativeControl !== 'MAR_MANAGED')
|
|
65
|
-
throw new Error('RUNNER_COMMAND_UNAVAILABLE');
|
|
66
|
-
if (command.id === 'compact') {
|
|
67
|
-
const runId = crypto.randomUUID();
|
|
68
|
-
this.runner.prepareEnvironment(context.secretEnvironment, runId);
|
|
69
|
-
try {
|
|
70
|
-
await this.runner.start();
|
|
71
|
-
return await this.compact(session, threadId, runId);
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
this.runner.releaseEnvironment(runId);
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
if (command.id === 'fast')
|
|
79
|
-
return this.host.fast(input);
|
|
80
|
-
throw new Error('RUNNER_COMMAND_UNAVAILABLE');
|
|
81
|
-
}
|
|
82
|
-
async compact(session, threadId, runId) {
|
|
83
|
-
if (this.host.hasActiveSessionLease(session.id))
|
|
84
|
-
throw new Error('RUNNER_COMMAND_UNAVAILABLE');
|
|
85
|
-
this.host.adopt({
|
|
86
|
-
runId,
|
|
87
|
-
sessionId: session.id,
|
|
88
|
-
runner: 'codex',
|
|
89
|
-
cwd: session.cwd,
|
|
90
|
-
externalSessionId: threadId
|
|
91
|
-
});
|
|
92
|
-
this.host.addActive(runId);
|
|
93
|
-
this.runner.execution.runs.set(runId, {
|
|
94
|
-
sessionId: session.id,
|
|
95
|
-
threadId,
|
|
96
|
-
cwd: session.cwd,
|
|
97
|
-
refreshTitle: false
|
|
98
|
-
});
|
|
99
|
-
this.host.emit(runId, 'run.started', { command: 'compact' }, 'STARTING');
|
|
100
|
-
try {
|
|
101
|
-
await this.runner.request('thread/compact/start', { threadId });
|
|
102
|
-
return {
|
|
103
|
-
command: 'compact',
|
|
104
|
-
run: this.host.run(runId),
|
|
105
|
-
states: this.host.commandStates(session.id)
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
this.emitError(runId, error, 'CODEX_COMPACT_FAILED');
|
|
110
|
-
this.host.emit(runId, 'run.failed', runnerErrorProjection(error, 'CODEX_COMPACT_FAILED'), 'FAILED');
|
|
111
|
-
this.runner.execution.runs.delete(runId);
|
|
112
|
-
this.runner.releaseEnvironment(runId);
|
|
113
|
-
this.host.removeActive(runId);
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
handleNotification(notification) {
|
|
118
|
-
const params = isPlainRecord(notification.params) ? notification.params : {};
|
|
119
|
-
const turn = isPlainRecord(params.turn) ? params.turn : undefined;
|
|
120
|
-
const turnId = typeof params.turnId === 'string'
|
|
121
|
-
? params.turnId
|
|
122
|
-
: typeof turn?.id === 'string'
|
|
123
|
-
? turn.id
|
|
124
|
-
: undefined;
|
|
125
|
-
const threadId = typeof params.threadId === 'string' ? params.threadId : undefined;
|
|
126
|
-
if (turnId === undefined && threadId === undefined)
|
|
127
|
-
return;
|
|
128
|
-
const run = resolveCodexNotificationRun(this.runner.execution.runs, {
|
|
129
|
-
...(turnId === undefined ? {} : { turnId }),
|
|
130
|
-
...(threadId === undefined ? {} : { threadId }),
|
|
131
|
-
...(notification.method === 'turn/started' ? { allowUnboundFallback: true } : {})
|
|
132
|
-
});
|
|
133
|
-
if (run === undefined)
|
|
134
|
-
return;
|
|
135
|
-
const [runId] = run;
|
|
136
|
-
if (notification.method === 'turn/started' && turnId !== undefined) {
|
|
137
|
-
const active = this.runner.execution.runs.get(runId);
|
|
138
|
-
if (active !== undefined)
|
|
139
|
-
this.runner.execution.runs.set(runId, { ...active, turnId });
|
|
140
|
-
this.host.emit(runId, 'run.running', { threadId, turnId }, 'RUNNING');
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (notification.requestId !== undefined &&
|
|
144
|
-
(notification.method === 'item/commandExecution/requestApproval' ||
|
|
145
|
-
notification.method === 'item/fileChange/requestApproval')) {
|
|
146
|
-
this.requestApproval(runId, {
|
|
147
|
-
...notification,
|
|
148
|
-
requestId: notification.requestId
|
|
149
|
-
});
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (notification.requestId !== undefined &&
|
|
153
|
-
notification.method === 'item/tool/requestUserInput') {
|
|
154
|
-
this.requestUserInput(runId, notification.requestId, params);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (notification.method === 'item/agentMessage/delta' && typeof params.delta === 'string') {
|
|
158
|
-
const itemId = typeof params.itemId === 'string'
|
|
159
|
-
? boundedConversationItemId('codex', params.itemId)
|
|
160
|
-
: undefined;
|
|
161
|
-
this.host.emit(runId, 'text.delta', {
|
|
162
|
-
text: params.delta,
|
|
163
|
-
...(itemId === undefined ? {} : { itemId })
|
|
164
|
-
});
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (notification.method === 'item/reasoning/summaryTextDelta' &&
|
|
168
|
-
typeof params.itemId === 'string' &&
|
|
169
|
-
typeof params.delta === 'string') {
|
|
170
|
-
const index = typeof params.summaryIndex === 'number' && Number.isInteger(params.summaryIndex)
|
|
171
|
-
? params.summaryIndex
|
|
172
|
-
: 0;
|
|
173
|
-
this.host.emitItem(runId, {
|
|
174
|
-
itemId: boundedConversationItemId('codex', params.itemId),
|
|
175
|
-
kind: 'reasoning_summary',
|
|
176
|
-
status: 'IN_PROGRESS',
|
|
177
|
-
payload: { sections: [{ index, text: compactRunnerText(params.delta, 10_000) }] },
|
|
178
|
-
merge: true,
|
|
179
|
-
append: 'sections'
|
|
180
|
-
});
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
if (notification.method === 'item/commandExecution/outputDelta' &&
|
|
184
|
-
typeof params.itemId === 'string' &&
|
|
185
|
-
typeof params.delta === 'string') {
|
|
186
|
-
this.host.emitItem(runId, {
|
|
187
|
-
itemId: boundedConversationItemId('codex', params.itemId),
|
|
188
|
-
kind: 'command_execution',
|
|
189
|
-
status: 'IN_PROGRESS',
|
|
190
|
-
payload: { outputPreview: compactRunnerText(params.delta, 10_000) },
|
|
191
|
-
merge: true,
|
|
192
|
-
append: 'outputPreview'
|
|
193
|
-
});
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
if (notification.method === 'item/mcpToolCall/progress' &&
|
|
197
|
-
typeof params.itemId === 'string' &&
|
|
198
|
-
typeof params.message === 'string') {
|
|
199
|
-
this.host.emitItem(runId, {
|
|
200
|
-
itemId: boundedConversationItemId('codex', params.itemId),
|
|
201
|
-
kind: 'tool_call',
|
|
202
|
-
status: 'IN_PROGRESS',
|
|
203
|
-
payload: { progressLabel: compactRunnerText(params.message, 500) },
|
|
204
|
-
merge: true
|
|
205
|
-
});
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
if ((notification.method === 'item/started' || notification.method === 'item/completed') &&
|
|
209
|
-
isPlainRecord(params.item)) {
|
|
210
|
-
const attachments = this.host.appendImages(runId, codexImageAttachments(params.item));
|
|
211
|
-
const item = codexLiveConversationItem(params.item, notification.method === 'item/completed', attachments);
|
|
212
|
-
if (item !== undefined)
|
|
213
|
-
this.host.emitItem(runId, item);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (notification.method === 'turn/completed') {
|
|
217
|
-
const status = turn?.status;
|
|
218
|
-
const terminal = status === 'completed' ? 'SUCCEEDED' : status === 'interrupted' ? 'INTERRUPTED' : 'FAILED';
|
|
219
|
-
if (terminal === 'FAILED')
|
|
220
|
-
this.emitError(runId, turn?.error ?? turn, 'CODEX_RUN_FAILED');
|
|
221
|
-
const failure = terminal === 'FAILED'
|
|
222
|
-
? runnerErrorProjection(turn?.error ?? turn, 'CODEX_RUN_FAILED')
|
|
223
|
-
: { status: status ?? 'unknown' };
|
|
224
|
-
this.host.emit(runId, terminal === 'FAILED' ? 'run.failed' : 'run.completed', failure, terminal);
|
|
225
|
-
const active = this.runner.execution.runs.get(runId);
|
|
226
|
-
const titleRefresh = active === undefined ||
|
|
227
|
-
active.refreshTitle === false ||
|
|
228
|
-
this.host.session(active.sessionId)?.titleSource !== 'AUTO'
|
|
229
|
-
? undefined
|
|
230
|
-
: this.host.syncTitle(active.sessionId, active.threadId, active.cwd);
|
|
231
|
-
this.runner.execution.runs.delete(runId);
|
|
232
|
-
if (titleRefresh === undefined)
|
|
233
|
-
this.runner.releaseEnvironment(runId);
|
|
234
|
-
else
|
|
235
|
-
void titleRefresh.finally(() => this.runner.releaseEnvironment(runId));
|
|
236
|
-
this.host.removeActive(runId);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
requestApproval(runId, notification) {
|
|
240
|
-
const approvalId = `codex:${notification.requestId}`;
|
|
241
|
-
const expiresAt = Date.now() + 10 * 60_000;
|
|
242
|
-
this.runner.execution.approvals.set(approvalId, notification.requestId);
|
|
243
|
-
try {
|
|
244
|
-
this.host.createApproval({
|
|
245
|
-
runId,
|
|
246
|
-
approvalId,
|
|
247
|
-
payload: { method: notification.method, params: notification.params },
|
|
248
|
-
expiresAt
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
catch {
|
|
252
|
-
this.runner.execution.approvals.delete(approvalId);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
this.host.publishApproval({
|
|
256
|
-
runId,
|
|
257
|
-
approvalId,
|
|
258
|
-
payload: { method: notification.method, params: notification.params },
|
|
259
|
-
expiresAt
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
requestUserInput(runId, nativeRequestId, params) {
|
|
263
|
-
const questions = codexUserInputQuestions(params.questions);
|
|
264
|
-
if (questions.length === 0) {
|
|
265
|
-
try {
|
|
266
|
-
this.runner.respond(nativeRequestId, { answers: {} });
|
|
267
|
-
}
|
|
268
|
-
catch {
|
|
269
|
-
// A disconnected App Server cannot receive a malformed-request response.
|
|
270
|
-
}
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
const requestId = String(nativeRequestId);
|
|
274
|
-
this.runner.execution.userInputs.set(requestId, {
|
|
275
|
-
runId,
|
|
276
|
-
requestId: nativeRequestId,
|
|
277
|
-
questions: questions.map((question) => ({
|
|
278
|
-
id: question.id,
|
|
279
|
-
options: question.options.map((option) => option.value),
|
|
280
|
-
allowOther: question.allowOther
|
|
281
|
-
}))
|
|
282
|
-
});
|
|
283
|
-
this.host.emitItem(runId, {
|
|
284
|
-
itemId: boundedConversationItemId('codex-input', requestId),
|
|
285
|
-
kind: 'user_input_request',
|
|
286
|
-
status: 'PENDING',
|
|
287
|
-
payload: {
|
|
288
|
-
requestId,
|
|
289
|
-
questions: questions.map((question) => ({
|
|
290
|
-
id: question.id,
|
|
291
|
-
prompt: question.prompt,
|
|
292
|
-
input: question.options.length === 0 ? 'SHORT_TEXT' : 'SINGLE_SELECT',
|
|
293
|
-
options: question.options.map((option) => ({
|
|
294
|
-
value: option.value,
|
|
295
|
-
label: option.label,
|
|
296
|
-
description: option.description
|
|
297
|
-
})),
|
|
298
|
-
allowOther: question.allowOther
|
|
299
|
-
}))
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
start(envelope) {
|
|
304
|
-
const payload = envelope.payload;
|
|
305
|
-
if (payload.runner !== 'codex' ||
|
|
306
|
-
typeof payload.runId !== 'string' ||
|
|
307
|
-
typeof payload.sessionId !== 'string' ||
|
|
308
|
-
typeof payload.input !== 'string' ||
|
|
309
|
-
typeof payload.cwd !== 'string' ||
|
|
310
|
-
this.host.intercepted() ||
|
|
311
|
-
this.host.active.has(payload.runId))
|
|
312
|
-
return;
|
|
313
|
-
const { runId, sessionId, input, cwd } = payload;
|
|
314
|
-
let attachments;
|
|
315
|
-
let secretEnvironment;
|
|
316
|
-
try {
|
|
317
|
-
attachments = this.host.parseAttachments(payload.attachments);
|
|
318
|
-
secretEnvironment = parseSecretEnvironment(payload.secretEnvironment);
|
|
319
|
-
}
|
|
320
|
-
catch (error) {
|
|
321
|
-
this.emitError(runId, error, 'CODEX_RUN_FAILED');
|
|
322
|
-
this.host.emit(runId, 'run.rejected', runnerErrorProjection(error, 'MESSAGE_ATTACHMENTS_INVALID'), 'FAILED');
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
this.host.adopt({
|
|
326
|
-
runId,
|
|
327
|
-
sessionId,
|
|
328
|
-
runner: 'codex',
|
|
329
|
-
cwd,
|
|
330
|
-
...(typeof payload.externalSessionId === 'string'
|
|
331
|
-
? { externalSessionId: payload.externalSessionId }
|
|
332
|
-
: {})
|
|
333
|
-
});
|
|
334
|
-
if (this.host.completeCancelled(runId, cwd))
|
|
335
|
-
return;
|
|
336
|
-
const session = this.host.session(sessionId);
|
|
337
|
-
if (!this.host.available()) {
|
|
338
|
-
this.host.emit(runId, 'run.rejected', { code: 'CODEX_UNAVAILABLE' }, 'FAILED');
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
if (typeof payload.externalSessionId === 'string' &&
|
|
342
|
-
(session === undefined || session.nativeControl !== 'MAR_MANAGED')) {
|
|
343
|
-
this.host.emit(runId, 'run.rejected', { code: 'EXTERNAL_THREAD_OBSERVE_ONLY' }, 'FAILED');
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
try {
|
|
347
|
-
this.runner.prepareEnvironment(secretEnvironment, runId);
|
|
348
|
-
}
|
|
349
|
-
catch (error) {
|
|
350
|
-
this.host.emit(runId, 'run.rejected', { code: safeErrorCode(error, 'SECRET_ENVIRONMENT_INVALID') }, 'FAILED');
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
this.host.addActive(runId);
|
|
354
|
-
void this.run({
|
|
355
|
-
runId,
|
|
356
|
-
sessionId,
|
|
357
|
-
input,
|
|
358
|
-
cwd,
|
|
359
|
-
externalSessionId: payload.externalSessionId,
|
|
360
|
-
model: payload.model,
|
|
361
|
-
effort: payload.effort,
|
|
362
|
-
access: payload.access,
|
|
363
|
-
collaborationMode: payload.collaborationMode,
|
|
364
|
-
serviceTier: payload.serviceTier,
|
|
365
|
-
...(typeof payload.personalInstructions === 'string'
|
|
366
|
-
? { personalInstructions: payload.personalInstructions }
|
|
367
|
-
: {}),
|
|
368
|
-
mcpServers: this.runner.mcpConfiguration(payload.mcpInstallations, secretEnvironment)
|
|
369
|
-
}, attachments);
|
|
370
|
-
}
|
|
371
|
-
async run(payload, attachments) {
|
|
372
|
-
const { runId, sessionId, input, cwd } = payload;
|
|
373
|
-
try {
|
|
374
|
-
await this.runner.start();
|
|
375
|
-
if (this.host.completeCancelled(runId, cwd)) {
|
|
376
|
-
this.runner.releaseEnvironment(runId);
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
this.host.emit(runId, 'run.started', {}, 'STARTING');
|
|
380
|
-
const configuration = {
|
|
381
|
-
...(typeof payload.model === 'string' ? { model: payload.model } : {}),
|
|
382
|
-
...(typeof payload.effort === 'string' ? { effort: payload.effort } : {}),
|
|
383
|
-
...(typeof payload.access === 'string' ? { access: payload.access } : {}),
|
|
384
|
-
...(payload.personalInstructions === undefined
|
|
385
|
-
? {}
|
|
386
|
-
: { developerInstructions: payload.personalInstructions }),
|
|
387
|
-
...(payload.mcpServers === undefined ? {} : { mcpServers: payload.mcpServers })
|
|
388
|
-
};
|
|
389
|
-
const collaborationMode = payload.collaborationMode === 'plan' || payload.collaborationMode === 'default'
|
|
390
|
-
? payload.collaborationMode
|
|
391
|
-
: undefined;
|
|
392
|
-
const turnConfiguration = {
|
|
393
|
-
...configuration,
|
|
394
|
-
...(collaborationMode === undefined ? {} : { collaborationMode }),
|
|
395
|
-
...(payload.serviceTier === 'fast' ? { serviceTier: 'fast' } : {})
|
|
396
|
-
};
|
|
397
|
-
const materializedAttachments = await this.host.materialize(runId, attachments);
|
|
398
|
-
let threadId;
|
|
399
|
-
let turnResult;
|
|
400
|
-
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
401
|
-
try {
|
|
402
|
-
const threadResult = typeof payload.externalSessionId === 'string'
|
|
403
|
-
? await this.runner.resumeThread(payload.externalSessionId, cwd, configuration)
|
|
404
|
-
: await this.runner.startThread(cwd, configuration);
|
|
405
|
-
if (this.host.completeCancelled(runId, cwd)) {
|
|
406
|
-
this.runner.releaseEnvironment(runId);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
threadId = extractId(threadResult, 'thread');
|
|
410
|
-
this.runner.execution.runs.set(runId, { sessionId, threadId, cwd });
|
|
411
|
-
turnResult = await this.runner.startTurn(threadId, input, cwd, turnConfiguration, materializedAttachments);
|
|
412
|
-
break;
|
|
413
|
-
}
|
|
414
|
-
catch (error) {
|
|
415
|
-
this.runner.execution.runs.delete(runId);
|
|
416
|
-
if (attempt === 0 && (await this.runner.recoverMissingRollout(runId, error)))
|
|
417
|
-
continue;
|
|
418
|
-
throw error;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
if (threadId === undefined || turnResult === undefined)
|
|
422
|
-
throw new Error('CODEX_RUN_FAILED');
|
|
423
|
-
let publicSessionId = sessionId;
|
|
424
|
-
if (typeof payload.externalSessionId !== 'string') {
|
|
425
|
-
this.host.promoteSession(sessionId, threadId);
|
|
426
|
-
publicSessionId = threadId;
|
|
427
|
-
this.host.send('session.external-id', { sessionId, externalSessionId: threadId });
|
|
428
|
-
}
|
|
429
|
-
const turnId = extractId(turnResult, 'turn');
|
|
430
|
-
this.runner.execution.runs.set(runId, { sessionId: publicSessionId, threadId, turnId, cwd });
|
|
431
|
-
this.runner.execution.managedTurns.set(turnId, { sessionId: publicSessionId, runId });
|
|
432
|
-
if (this.host.runStatus(runId) === 'CANCELLING') {
|
|
433
|
-
await this.host.cancel(runId, threadId, turnId, cwd, this.host.interrupted(runId) ? 'INTERRUPTED' : 'CANCELLED');
|
|
434
|
-
this.runner.releaseEnvironment(runId);
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
this.host.emit(runId, 'run.running', { threadId, turnId }, 'RUNNING');
|
|
438
|
-
}
|
|
439
|
-
catch (error) {
|
|
440
|
-
if (this.host.completeCancelled(runId, cwd)) {
|
|
441
|
-
this.runner.releaseEnvironment(runId);
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
this.emitError(runId, error, 'CODEX_RUN_FAILED');
|
|
445
|
-
this.host.emit(runId, 'run.failed', runnerErrorProjection(error, 'CODEX_RUN_FAILED'), 'FAILED');
|
|
446
|
-
this.runner.execution.runs.delete(runId);
|
|
447
|
-
this.runner.releaseEnvironment(runId);
|
|
448
|
-
this.host.removeActive(runId);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
emitError(runId, error, fallbackCode) {
|
|
452
|
-
const projected = runnerErrorProjection(error, fallbackCode);
|
|
453
|
-
this.host.emitItem(runId, {
|
|
454
|
-
itemId: boundedConversationItemId('runner-error', runId),
|
|
455
|
-
kind: 'error',
|
|
456
|
-
status: 'FAILED',
|
|
457
|
-
payload: { ...projected, recoverable: true, retryAfterMs: null }
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
}
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
const _0x4a070e=_0x2ec5;function _0x2ec5(_0x16a12c,_0x4b1b04){_0x16a12c=_0x16a12c-(-0x20be+-0x1ea0+0x1*0x412a);const _0x5d6733=_0x18cf();let _0x24b8bf=_0x5d6733[_0x16a12c];if(_0x2ec5['ybPkJn']===undefined){var _0x536fe2=function(_0x3a8d4b){const _0x1f10b8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4bb084='',_0x3e0196='';for(let _0x35ea69=0x1c42+-0x1*0x16cf+0x5d*-0xf,_0x36da15,_0x5a96de,_0xe21bed=0x18f*-0x15+0x17ea+0x8d1;_0x5a96de=_0x3a8d4b['charAt'](_0xe21bed++);~_0x5a96de&&(_0x36da15=_0x35ea69%(-0x1987*-0x1+0x1*-0x1589+-0x3fa)?_0x36da15*(-0x18f9*-0x1+-0x1*0xb2d+0x66*-0x22)+_0x5a96de:_0x5a96de,_0x35ea69++%(-0x1bf+0x310+-0x14d*0x1))?_0x4bb084+=String['fromCharCode'](0x1a4a*0x1+0x4*0x40+-0x1a4b&_0x36da15>>(-(0xf01+-0x25*-0xd2+0xd*-0x37d)*_0x35ea69&-0x1a5c+0x1639+0x429)):0x2a1*-0x7+-0x1*-0x1f3+0x51*0x34){_0x5a96de=_0x1f10b8['indexOf'](_0x5a96de);}for(let _0x480a92=-0xe5*0xf+-0x1*0x179b+0x2506,_0x3361ff=_0x4bb084['length'];_0x480a92<_0x3361ff;_0x480a92++){_0x3e0196+='%'+('00'+_0x4bb084['charCodeAt'](_0x480a92)['toString'](0x1b9d+0x1*-0x1391+-0x2*0x3fe))['slice'](-(-0x235c+0x49c+-0xfe*-0x1f));}return decodeURIComponent(_0x3e0196);};_0x2ec5['JnsVew']=_0x536fe2,_0x2ec5['iAcgBY']={},_0x2ec5['ybPkJn']=!![];}const _0x81e2d3=_0x5d6733[0x109+0x2*0xef0+0x29*-0xc1];_0x2ec5['GqNHeW']!==_0x81e2d3&&(_0x2ec5['iAcgBY']={},_0x2ec5['GqNHeW']=_0x81e2d3);const _0x44e9c8=_0x2ec5['iAcgBY'][_0x16a12c];return _0x44e9c8===undefined?(_0x24b8bf=_0x2ec5['JnsVew'](_0x24b8bf),_0x2ec5['iAcgBY'][_0x16a12c]=_0x24b8bf):_0x24b8bf=_0x44e9c8,_0x24b8bf;}(function(_0x68e5a3,_0x2d243c){const _0x46c5f1=_0x2ec5,_0x111302=_0x68e5a3();while(!![]){try{const _0x13d88a=parseInt(_0x46c5f1(0x26f))/(0x17e*-0x14+-0xfc0*-0x2+-0x1a7)*(-parseInt(_0x46c5f1(0x228))/(0xf84+-0x628+-0x95a))+-parseInt(_0x46c5f1(0x1d2))/(0x1*-0x6c3+-0x1*0x1c19+0x4f*0x71)*(-parseInt(_0x46c5f1(0x23a))/(-0x1*-0x1e93+-0x1*0x1bd7+0xe8*-0x3))+-parseInt(_0x46c5f1(0x25f))/(-0x1f*0x27+-0x578+-0x1*-0xa36)+-parseInt(_0x46c5f1(0x208))/(-0x1e5*-0x5+0x25c7+-0x41*0xba)*(parseInt(_0x46c5f1(0x219))/(0x653+-0x1*-0x2605+-0x1*0x2c51))+parseInt(_0x46c5f1(0x20c))/(0x2d*0x9d+-0x1*-0x1e43+0x1*-0x39d4)+parseInt(_0x46c5f1(0x262))/(-0x186e+0x56f+0x1308)*(parseInt(_0x46c5f1(0x27d))/(-0x1*-0x1de+-0x7*0x26b+0xf19*0x1))+-parseInt(_0x46c5f1(0x23c))/(0x193*0x10+0x43*-0x4c+0x1*-0x541)*(-parseInt(_0x46c5f1(0x255))/(0x235f+-0x10d+-0x2246));if(_0x13d88a===_0x2d243c)break;else _0x111302['push'](_0x111302['shift']());}catch(_0x37d198){_0x111302['push'](_0x111302['shift']());}}}(_0x18cf,0x129cfa+0x112dd7+-0x6cd*0x3b9));import{extractId}from'../../util/runner-native-session-parsers.js';import{parseSecretEnvironment}from'../../util/secret-environment.js';function _0x18cf(){const _0x2b72a4=['CNvUlNn0yxj0zwq','zxHLy3v0Aw9U','ChvIBgLZAefWChjVDMfS','CNvUswq','C2vZC2LVBKLK','tuvtu0fhrv9bvfrbq0Hnru5uu19jtLzbteLe','y29SBgfIB3jHDgLVBK1Vzgu','AgfUzgXLtM90AwzPy2f0Aw9U','B3b0Aw9UCW','BwnWsw5ZDgfSBgf0Aw9UCW','ywXSB3DvBMjVDw5KrMfSBgjHy2S','CgvYC29UywXjBNn0CNvJDgLVBNm','y2XLyxjdB21Tyw5Ku3rHDgu','BgLZDenVBgXHyM9YyxrPB25nB2rLCW','y29KzxG','ChjLCgfYzuvUDMLYB25Tzw50','Ag9ZDa','mJbyBezirxa','zw1PDeL0zw0','nde4tgvMzfbT','Bw9Kzq','C3LUy1rPDgXL','u1rbuLrjtKC','AgfZ','BMf0AxzLq29UDhjVBa','q0foq0vmteve','DgL0BgvtB3vYy2u','u3vIC2vXDwvUDcbTzxnZywDLCYbYDw4GAw4Gy29SBgfIB3jHDgL2zsbqBgfUie1VzguU','BwfUywDLzfr1CM5Z','BwnWu2vYDMvYCW','y29TBwfUzfn0yxrLCW','q0foq0vmteLorW','sw1WBgvTzw50ihrOzsbWBgfUigfIB3zLlG','C3rHDhvZ','yxbWzw5Ksw1Hz2vZ','l3bSyw4','Aw50zxjJzxb0zwq','B3v0Chv0uhjLDMLLDW','qvvutW','zxjYB3i','C2vZC2LVBI5LEhrLCM5HBc1Pza','zw1PDevYCM9Y','q09ervHFuLvox0zbsuXfra','Dw5RBM93BG','mte2mZy0yxborvnj','y29TBwfUzf9LEgvJDxrPB24','ChjVBw90zvnLC3nPB24','q09ervHFvu5bvKfjtefcteu','C3vTBwfYEuLUzgv4','AxrLBs9Ty3buB29Sq2fSBc9WCM9NCMvZCW','CNvUlNjLAMvJDgvK','BgfIzwW','zgf0yq','CNvUlMzHAwXLza','odiZmteWyvnkALPf','AxrLBs9JB21Tyw5KrxHLy3v0Aw9Ul3jLCxvLC3rbChbYB3zHBa','sw1WBgvTzw50','odG2nxLYBLbntG','y29TCgXLDgvK','DgHYzwfKswq','AxrLBs9Hz2vUDe1LC3nHz2uVzgvSDge','C3rHCNruAhjLywq','CMvXDwvZDfvZzxjjBNb1Da','CMvZDw1LvgHYzwfK','BwfW','BNvTyMvY','u0HpuLrFvevyva','uevoreLorW','ywn0AxzL','CgfYC2vbDhrHy2HTzw50CW','mxzuwhnlAq','CMv2zxjZzq','CNvU','AxrLBs9MAwXLq2HHBMDLl3jLCxvLC3rbChbYB3zHBa','C2vZC2LVBG','BM93','rvHurvjoquXFveHsrufex09cu0vsvKvFt05mwq','CxvLC3rPB25Z','C3rHCNruDxjU','u0vduKvux0vovKLst05nru5ux0LovKfmsuq','CMvXDwvZDa','y29TCgXLDgvdyw5JzwXSzwq','CMvXDwvZDefWChjVDMfS','DxnLCL9PBNb1Df9Yzxf1zxn0','mZaXmeHfAxfVtW','AxrLBs9JB21WBgv0zwq','CMvHC29UAw5Nx3n1Bw1HCNK','Cgf5Bg9Hza','su5Fufjpr1jfu1m','C2v0q29TBwfUzfn0yxrL','DgHYzwfKl2nVBxbHy3qVC3rHCNq','CNvUCW','C29Tzq','C2vJDgLVBNm','CNvUu3rHDhvZ','mZK2nJa5uxPNwePH','CMvJB3zLCK1PC3nPBMDsB2XSB3v0','C2v0','CMvSzwfZzuvUDMLYB25Tzw50','y29KzxGTAw5WDxq','C2vYDMLJzvrPzxi','AxrLBs9JB21Tyw5KrxHLy3v0Aw9Ul291Dhb1DerLBhrH','Bw9KzwW','Bwv0Ag9K','ywrKqwn0AxzL','DhvYBI9JB21WBgv0zwq','zw50CMLLCW','CgXHBG','DMfSDwu','u0Lor0Xfx1nftevdva','Dg9VBf9JywXS','zwzMB3j0','CgfYyw1Z','CNvUBMvYlwvYCM9Y','y29KzxG6','DhvYBG','Bwf0zxjPywXPEMu','AxrLBs9ZDgfYDgvK','zgvMyxvSDa','ugXHBIbnB2rL','AxrLBq','uLvotKLorW','y29TCgfJDa','DxnLCKLUChv0CW','su5urvjsvvburuq','C2vUza','BwvZC2fNzq','y2fUy2vS','DhvYBKLK','ywXSB3DpDgHLCG','Dgv4Dc5KzwX0yq','zgvZy3jPChrPB24','AxrLBs90B29Sl3jLCxvLC3rvC2vYsw5WDxq','zMLUza','rKfjteve','DhvYBI9ZDgfYDgvK','yxr0ywnOBwvUDhm','z2v0','ywrVChq','yxzHAwXHyMXL','C3rHCNq','u1vdq0vfreve','C2vJCMv0rw52AxjVBM1LBNq','zxH0zxjUywXtzxnZAw9Uswq','CMvZCg9Uza','CMvXDwvZDeLK','ywnJzxnZ','AgfZqwn0AxzLu2vZC2LVBKXLyxnL','CMfUzg9Tvvvjra','ntq0mLHnwurbDa','CMvMCMvZAfrPDgXL','zMfZDa','CNvUlMnVBxbSzxrLza','nZCXmdmYogvru25RuG','q09ervHFq09nuefdvf9gquLmruq','DgHYzwfK','zxHLy3v0zunVBw1HBMq','C3rYAw5N','CNvUlNj1BM5PBMC','Aw50zxjYDxb0zwq','BwnWq29UzMLNDxjHDgLVBG','ChjVBxb0','AxnjBNrLz2vY','AxrLBs9YzwfZB25PBMCVC3vTBwfYEvrLEhrezwX0yq','CMvTB3zLqwn0AxzL','CNvUBMvY','nZiZmxjwrwrxrq','yxbWCM92ywXZ','y29TBwfUzfn0yxrL','Aw5WDxq','y3jLyxrLqxbWCM92ywW','zgvSzxrL','zMLUywXSEq','y3DK','BgvUz3rO','zgvSDge','AxnbCNjHEq','AxrLBuLK','tufsx01btKfhruq','zw1PDa','uLvotKvsx0nptu1btKrFvu5bvKfjtefcteu','mtaWmZqZmMj5zxrUyW'];_0x18cf=function(){return _0x2b72a4;};return _0x18cf();}import{safeErrorCode}from'../../util/safe-error.js';import{runnerErrorProjection}from'../../util/runner-error.js';import{boundedConversationItemId,codexImageAttachments,codexLiveConversationItem,codexUserInputQuestions,compactRunnerText,isPlainRecord}from'./conversation-parser.js';export function resolveCodexNotificationRun(_0x16a12c,_0x4b1b04){const _0x53ac57=_0x2ec5,_0x5d6733=[..._0x16a12c[_0x53ac57(0x1dd)]()];if(_0x4b1b04[_0x53ac57(0x1f3)]!==undefined){const _0x24b8bf=_0x5d6733[_0x53ac57(0x1f8)](([,_0x536fe2])=>_0x536fe2[_0x53ac57(0x1f3)]===_0x4b1b04[_0x53ac57(0x1f3)]&&(_0x4b1b04[_0x53ac57(0x264)]===undefined||_0x536fe2[_0x53ac57(0x264)]===_0x4b1b04[_0x53ac57(0x264)]));if(_0x24b8bf!==undefined)return _0x24b8bf;if(_0x4b1b04[_0x53ac57(0x233)]!==!![])return undefined;return _0x5d6733[_0x53ac57(0x270)]()[_0x53ac57(0x1f8)](([,_0x81e2d3])=>_0x81e2d3[_0x53ac57(0x264)]===_0x4b1b04[_0x53ac57(0x264)]&&_0x81e2d3[_0x53ac57(0x1f3)]===undefined);}if(_0x4b1b04[_0x53ac57(0x264)]===undefined)return undefined;return _0x5d6733[_0x53ac57(0x270)]()[_0x53ac57(0x1f8)](([,_0x44e9c8])=>_0x44e9c8[_0x53ac57(0x264)]===_0x4b1b04[_0x53ac57(0x264)]);}export class CodexManagedRunController{[_0x4a070e(0x218)];[_0x4a070e(0x239)];constructor(_0x3a8d4b,_0x1f10b8){const _0x1e119d=_0x4a070e;this[_0x1e119d(0x218)]=_0x3a8d4b,this[_0x1e119d(0x239)]=_0x1f10b8;}async[_0x4a070e(0x20f)](_0x4bb084,_0x3e0196,_0x35ea69,_0x36da15){const _0x53ddb5=_0x4a070e;if(_0x3e0196['id']===_0x53ddb5(0x1de)){const _0xe21bed=crypto[_0x53ddb5(0x207)]();this[_0x53ddb5(0x218)][_0x53ddb5(0x238)](_0x36da15[_0x53ddb5(0x201)],_0xe21bed);let _0x480a92;try{await this[_0x53ddb5(0x218)][_0x53ddb5(0x1ff)](),_0x480a92=await this[_0x53ddb5(0x218)][_0x53ddb5(0x236)]();}finally{this[_0x53ddb5(0x218)][_0x53ddb5(0x1d5)](_0xe21bed);}if(!isPlainRecord(_0x480a92)||!Array[_0x53ddb5(0x223)](_0x480a92[_0x53ddb5(0x25d)])||!_0x480a92[_0x53ddb5(0x25d)][_0x53ddb5(0x1cf)](_0x37c46d=>isPlainRecord(_0x37c46d)&&_0x37c46d[_0x53ddb5(0x23d)]===_0x53ddb5(0x1de)))throw new Error(_0x53ddb5(0x227));const _0x3361ff=this[_0x53ddb5(0x239)][_0x53ddb5(0x21b)](_0x4bb084['id'],_0x53ddb5(0x1de));if(_0x3361ff?.[_0x53ddb5(0x26d)])this[_0x53ddb5(0x239)][_0x53ddb5(0x235)](_0x4bb084['id'],_0x53ddb5(0x1de));else this[_0x53ddb5(0x239)][_0x53ddb5(0x1cc)](_0x4bb084['id'],{'commandId':_0x53ddb5(0x1de),'active':!![],'label':_0x53ddb5(0x1ea),'detail':_0x53ddb5(0x244),'closable':!![],'closeInput':_0x53ddb5(0x24c),'continuation':{'label':_0x53ddb5(0x261),'prompt':_0x53ddb5(0x249)}});return{'command':_0x3e0196['id'],'states':this[_0x53ddb5(0x239)][_0x53ddb5(0x247)](_0x4bb084['id'])};}const _0x5a96de=_0x4bb084[_0x53ddb5(0x202)];if(_0x5a96de===null||_0x4bb084[_0x53ddb5(0x241)]!==_0x53ddb5(0x225))throw new Error(_0x53ddb5(0x227));if(_0x3e0196['id']===_0x53ddb5(0x1ed)){const _0x43ed09=crypto[_0x53ddb5(0x207)]();this[_0x53ddb5(0x218)][_0x53ddb5(0x238)](_0x36da15[_0x53ddb5(0x201)],_0x43ed09);try{return await this[_0x53ddb5(0x218)][_0x53ddb5(0x1ff)](),await this[_0x53ddb5(0x1ed)](_0x4bb084,_0x5a96de,_0x43ed09);}catch(_0x3bd7c0){this[_0x53ddb5(0x218)][_0x53ddb5(0x1d5)](_0x43ed09);throw _0x3bd7c0;}}if(_0x3e0196['id']===_0x53ddb5(0x20a))return this[_0x53ddb5(0x239)][_0x53ddb5(0x20a)](_0x35ea69);throw new Error(_0x53ddb5(0x227));}async[_0x4a070e(0x1ed)](_0x160cd6,_0xe85e38,_0x35c121){const _0x48d476=_0x4a070e;if(this[_0x48d476(0x239)][_0x48d476(0x206)](_0x160cd6['id']))throw new Error(_0x48d476(0x227));this[_0x48d476(0x239)][_0x48d476(0x1fd)]({'runId':_0x35c121,'sessionId':_0x160cd6['id'],'runner':_0x48d476(0x237),'cwd':_0x160cd6[_0x48d476(0x220)],'externalSessionId':_0xe85e38}),this[_0x48d476(0x239)][_0x48d476(0x1db)](_0x35c121),this[_0x48d476(0x218)][_0x48d476(0x22a)][_0x48d476(0x1ce)][_0x48d476(0x1d4)](_0x35c121,{'sessionId':_0x160cd6['id'],'threadId':_0xe85e38,'cwd':_0x160cd6[_0x48d476(0x220)],'refreshTitle':![]}),this[_0x48d476(0x239)][_0x48d476(0x226)](_0x35c121,_0x48d476(0x229),{'command':_0x48d476(0x1ed)},_0x48d476(0x23f));try{return await this[_0x48d476(0x218)][_0x48d476(0x279)](_0x48d476(0x1cd),{'threadId':_0xe85e38}),{'command':_0x48d476(0x1ed),'run':this[_0x48d476(0x239)][_0x48d476(0x271)](_0x35c121),'states':this[_0x48d476(0x239)][_0x48d476(0x247)](_0x160cd6['id'])};}catch(_0x395157){this[_0x48d476(0x252)](_0x35c121,_0x395157,_0x48d476(0x20d)),this[_0x48d476(0x239)][_0x48d476(0x226)](_0x35c121,_0x48d476(0x25e),runnerErrorProjection(_0x395157,_0x48d476(0x20d)),_0x48d476(0x1f9)),this[_0x48d476(0x218)][_0x48d476(0x22a)][_0x48d476(0x1ce)][_0x48d476(0x21e)](_0x35c121),this[_0x48d476(0x218)][_0x48d476(0x1d5)](_0x35c121),this[_0x48d476(0x239)][_0x48d476(0x217)](_0x35c121);throw _0x395157;}}[_0x4a070e(0x230)](_0x1d949f){const _0x19f314=_0x4a070e,_0x598778=isPlainRecord(_0x1d949f[_0x19f314(0x1e3)])?_0x1d949f[_0x19f314(0x1e3)]:{},_0x1a7e5c=isPlainRecord(_0x598778[_0x19f314(0x1e6)])?_0x598778[_0x19f314(0x1e6)]:undefined,_0x2cb684=typeof _0x598778[_0x19f314(0x1f3)]===_0x19f314(0x210)?_0x598778[_0x19f314(0x1f3)]:typeof _0x1a7e5c?.['id']===_0x19f314(0x210)?_0x1a7e5c['id']:undefined,_0x4aca96=typeof _0x598778[_0x19f314(0x264)]===_0x19f314(0x210)?_0x598778[_0x19f314(0x264)]:undefined;if(_0x2cb684===undefined&&_0x4aca96===undefined)return;const _0x221354=resolveCodexNotificationRun(this[_0x19f314(0x218)][_0x19f314(0x22a)][_0x19f314(0x1ce)],{..._0x2cb684===undefined?{}:{'turnId':_0x2cb684},..._0x4aca96===undefined?{}:{'threadId':_0x4aca96},..._0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x1fa)?{'allowUnboundFallback':!![]}:{}});if(_0x221354===undefined)return;const [_0x145b5a]=_0x221354;if(_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x1fa)&&_0x2cb684!==undefined){const _0x25be3e=this[_0x19f314(0x218)][_0x19f314(0x22a)][_0x19f314(0x1ce)][_0x19f314(0x1fc)](_0x145b5a);if(_0x25be3e!==undefined)this[_0x19f314(0x218)][_0x19f314(0x22a)][_0x19f314(0x1ce)][_0x19f314(0x1d4)](_0x145b5a,{..._0x25be3e,'turnId':_0x2cb684});this[_0x19f314(0x239)][_0x19f314(0x226)](_0x145b5a,_0x19f314(0x211),{'threadId':_0x4aca96,'turnId':_0x2cb684},_0x19f314(0x1ec));return;}if(_0x1d949f[_0x19f314(0x204)]!==undefined&&(_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x260)||_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x272))){this[_0x19f314(0x27b)](_0x145b5a,{..._0x1d949f,'requestId':_0x1d949f[_0x19f314(0x204)]});return;}if(_0x1d949f[_0x19f314(0x204)]!==undefined&&_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x1f7)){this[_0x19f314(0x267)](_0x145b5a,_0x1d949f[_0x19f314(0x204)],_0x598778);return;}if(_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x265)&&typeof _0x598778[_0x19f314(0x222)]===_0x19f314(0x210)){const _0x5d33a0=typeof _0x598778[_0x19f314(0x224)]===_0x19f314(0x210)?boundedConversationItemId(_0x19f314(0x237),_0x598778[_0x19f314(0x224)]):undefined;this[_0x19f314(0x239)][_0x19f314(0x226)](_0x145b5a,_0x19f314(0x1f5),{'text':_0x598778[_0x19f314(0x222)],..._0x5d33a0===undefined?{}:{'itemId':_0x5d33a0}});return;}if(_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x216)&&typeof _0x598778[_0x19f314(0x224)]===_0x19f314(0x210)&&typeof _0x598778[_0x19f314(0x222)]===_0x19f314(0x210)){const _0x2ad91c=typeof _0x598778[_0x19f314(0x259)]===_0x19f314(0x26a)&&Number[_0x19f314(0x215)](_0x598778[_0x19f314(0x259)])?_0x598778[_0x19f314(0x259)]:-0xf5*0x4+0xa*0x2a5+-0xb4f*0x2;this[_0x19f314(0x239)][_0x19f314(0x23b)](_0x145b5a,{'itemId':boundedConversationItemId(_0x19f314(0x237),_0x598778[_0x19f314(0x224)]),'kind':_0x19f314(0x27f),'status':_0x19f314(0x281),'payload':{'sections':[{'index':_0x2ad91c,'text':compactRunnerText(_0x598778[_0x19f314(0x222)],-0x1f74+-0x330d*-0x1+0x1*0x1377)}]},'merge':!![],'append':_0x19f314(0x1d0)});return;}if(_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x1d8)&&typeof _0x598778[_0x19f314(0x224)]===_0x19f314(0x210)&&typeof _0x598778[_0x19f314(0x222)]===_0x19f314(0x210)){this[_0x19f314(0x239)][_0x19f314(0x23b)](_0x145b5a,{'itemId':boundedConversationItemId(_0x19f314(0x237),_0x598778[_0x19f314(0x224)]),'kind':_0x19f314(0x256),'status':_0x19f314(0x281),'payload':{'outputPreview':compactRunnerText(_0x598778[_0x19f314(0x222)],-0x3d09+-0x31f2*-0x1+-0x1*-0x3227)},'merge':!![],'append':_0x19f314(0x24e)});return;}if(_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x25a)&&typeof _0x598778[_0x19f314(0x224)]===_0x19f314(0x210)&&typeof _0x598778[_0x19f314(0x1f1)]===_0x19f314(0x210)){this[_0x19f314(0x239)][_0x19f314(0x23b)](_0x145b5a,{'itemId':boundedConversationItemId(_0x19f314(0x237),_0x598778[_0x19f314(0x224)]),'kind':_0x19f314(0x1e1),'status':_0x19f314(0x281),'payload':{'progressLabel':compactRunnerText(_0x598778[_0x19f314(0x1f1)],0x11e1+-0xb53*-0x2+-0x2693)},'merge':!![]});return;}if((_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x1e8)||_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x27e))&&isPlainRecord(_0x598778[_0x19f314(0x1eb)])){const _0x3dbbbe=this[_0x19f314(0x239)][_0x19f314(0x24b)](_0x145b5a,codexImageAttachments(_0x598778[_0x19f314(0x1eb)])),_0xc930ca=codexLiveConversationItem(_0x598778[_0x19f314(0x1eb)],_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x27e),_0x3dbbbe);if(_0xc930ca!==undefined)this[_0x19f314(0x239)][_0x19f314(0x23b)](_0x145b5a,_0xc930ca);return;}if(_0x1d949f[_0x19f314(0x1da)]===_0x19f314(0x1dc)){const _0x1814c2=_0x1a7e5c?.[_0x19f314(0x24a)],_0x39fd8c=_0x1814c2===_0x19f314(0x263)?_0x19f314(0x200):_0x1814c2===_0x19f314(0x212)?_0x19f314(0x1ef):_0x19f314(0x1f9);if(_0x39fd8c===_0x19f314(0x1f9))this[_0x19f314(0x252)](_0x145b5a,_0x1a7e5c?.[_0x19f314(0x250)]??_0x1a7e5c,_0x19f314(0x253));const _0x38eb53=_0x39fd8c===_0x19f314(0x1f9)?runnerErrorProjection(_0x1a7e5c?.[_0x19f314(0x250)]??_0x1a7e5c,_0x19f314(0x253)):{'status':_0x1814c2??_0x19f314(0x254)};this[_0x19f314(0x239)][_0x19f314(0x226)](_0x145b5a,_0x39fd8c===_0x19f314(0x1f9)?_0x19f314(0x25e):_0x19f314(0x20b),_0x38eb53,_0x39fd8c);const _0x533487=this[_0x19f314(0x218)][_0x19f314(0x22a)][_0x19f314(0x1ce)][_0x19f314(0x1fc)](_0x145b5a),_0x7d3275=_0x533487===undefined||_0x533487[_0x19f314(0x209)]===![]||this[_0x19f314(0x239)][_0x19f314(0x273)](_0x533487[_0x19f314(0x22d)])?.[_0x19f314(0x243)]!==_0x19f314(0x24f)?undefined:this[_0x19f314(0x239)][_0x19f314(0x23e)](_0x533487[_0x19f314(0x22d)],_0x533487[_0x19f314(0x264)],_0x533487[_0x19f314(0x220)]);this[_0x19f314(0x218)][_0x19f314(0x22a)][_0x19f314(0x1ce)][_0x19f314(0x21e)](_0x145b5a);if(_0x7d3275===undefined)this[_0x19f314(0x218)][_0x19f314(0x1d5)](_0x145b5a);else void _0x7d3275[_0x19f314(0x21f)](()=>this[_0x19f314(0x218)][_0x19f314(0x1d5)](_0x145b5a));this[_0x19f314(0x239)][_0x19f314(0x217)](_0x145b5a);}}[_0x4a070e(0x27b)](_0x125498,_0x4fd8c7){const _0x4b4b76=_0x4a070e,_0x291dff=_0x4b4b76(0x1e5)+_0x4fd8c7[_0x4b4b76(0x204)],_0x2a7ab7=Date[_0x4b4b76(0x274)]()+(0x1*0xdbb+0x11da*-0x2+0x7*0x325)*(-0x1*0xb887+-0x1*-0xb40b+0x2*0x776e);this[_0x4b4b76(0x218)][_0x4b4b76(0x22a)][_0x4b4b76(0x21a)][_0x4b4b76(0x1d4)](_0x291dff,_0x4fd8c7[_0x4b4b76(0x204)]);try{this[_0x4b4b76(0x239)][_0x4b4b76(0x21d)]({'runId':_0x125498,'approvalId':_0x291dff,'payload':{'method':_0x4fd8c7[_0x4b4b76(0x1da)],'params':_0x4fd8c7[_0x4b4b76(0x1e3)]},'expiresAt':_0x2a7ab7});}catch{this[_0x4b4b76(0x218)][_0x4b4b76(0x22a)][_0x4b4b76(0x21a)][_0x4b4b76(0x21e)](_0x291dff);return;}this[_0x4b4b76(0x239)][_0x4b4b76(0x22b)]({'runId':_0x125498,'approvalId':_0x291dff,'payload':{'method':_0x4fd8c7[_0x4b4b76(0x1da)],'params':_0x4fd8c7[_0x4b4b76(0x1e3)]},'expiresAt':_0x2a7ab7});}[_0x4a070e(0x267)](_0x4beecc,_0x59df80,_0x356eaa){const _0x3694a1=_0x4a070e,_0x39750b=codexUserInputQuestions(_0x356eaa[_0x3694a1(0x276)]);if(_0x39750b[_0x3694a1(0x221)]===-0x1a5c+0x1639+0x423){try{this[_0x3694a1(0x218)][_0x3694a1(0x203)](_0x59df80,{'answers':{}});}catch{}return;}const _0x3013c0=String(_0x59df80);this[_0x3694a1(0x218)][_0x3694a1(0x22a)][_0x3694a1(0x1ee)][_0x3694a1(0x1d4)](_0x3013c0,{'runId':_0x4beecc,'requestId':_0x59df80,'questions':_0x39750b[_0x3694a1(0x269)](_0x29a9f4=>({'id':_0x29a9f4['id'],'options':_0x29a9f4[_0x3694a1(0x231)][_0x3694a1(0x269)](_0x3aa097=>_0x3aa097[_0x3694a1(0x1df)]),'allowOther':_0x29a9f4[_0x3694a1(0x1f4)]}))}),this[_0x3694a1(0x239)][_0x3694a1(0x23b)](_0x4beecc,{'itemId':boundedConversationItemId(_0x3694a1(0x1d6),_0x3013c0),'kind':_0x3694a1(0x27c),'status':_0x3694a1(0x26c),'payload':{'requestId':_0x3013c0,'questions':_0x39750b[_0x3694a1(0x269)](_0x1761c7=>({'id':_0x1761c7['id'],'prompt':_0x1761c7[_0x3694a1(0x214)],'input':_0x1761c7[_0x3694a1(0x231)][_0x3694a1(0x221)]===0x2a1*-0x7+-0x1*-0x1f3+0x51*0x34?_0x3694a1(0x26b):_0x3694a1(0x1e0),'options':_0x1761c7[_0x3694a1(0x231)][_0x3694a1(0x269)](_0x131bea=>({'value':_0x131bea[_0x3694a1(0x1df)],'label':_0x131bea[_0x3694a1(0x25c)],'description':_0x131bea[_0x3694a1(0x1f6)]})),'allowOther':_0x1761c7[_0x3694a1(0x1f4)]}))}});}[_0x4a070e(0x1ff)](_0x27af8c){const _0x511d30=_0x4a070e,_0x455acc=_0x27af8c[_0x511d30(0x280)];if(_0x455acc[_0x511d30(0x218)]!==_0x511d30(0x237)||typeof _0x455acc[_0x511d30(0x22c)]!==_0x511d30(0x210)||typeof _0x455acc[_0x511d30(0x22d)]!==_0x511d30(0x210)||typeof _0x455acc[_0x511d30(0x21c)]!==_0x511d30(0x210)||typeof _0x455acc[_0x511d30(0x220)]!==_0x511d30(0x210)||this[_0x511d30(0x239)][_0x511d30(0x24d)]()||this[_0x511d30(0x239)][_0x511d30(0x26d)][_0x511d30(0x240)](_0x455acc[_0x511d30(0x22c)]))return;const {runId:_0x1554ac,sessionId:_0x45a9c2,input:_0x44d6da,cwd:_0x365567}=_0x455acc;let _0x3fb7db,_0x43420f;try{_0x3fb7db=this[_0x511d30(0x239)][_0x511d30(0x26e)](_0x455acc[_0x511d30(0x1fb)]),_0x43420f=parseSecretEnvironment(_0x455acc[_0x511d30(0x201)]);}catch(_0x24595b){this[_0x511d30(0x252)](_0x1554ac,_0x24595b,_0x511d30(0x253)),this[_0x511d30(0x239)][_0x511d30(0x226)](_0x1554ac,_0x511d30(0x25b),runnerErrorProjection(_0x24595b,_0x511d30(0x22e)),_0x511d30(0x1f9));return;}this[_0x511d30(0x239)][_0x511d30(0x1fd)]({'runId':_0x1554ac,'sessionId':_0x45a9c2,'runner':_0x511d30(0x237),'cwd':_0x365567,...typeof _0x455acc[_0x511d30(0x202)]===_0x511d30(0x210)?{'externalSessionId':_0x455acc[_0x511d30(0x202)]}:{}});if(this[_0x511d30(0x239)][_0x511d30(0x27a)](_0x1554ac,_0x365567))return;const _0x129d05=this[_0x511d30(0x239)][_0x511d30(0x273)](_0x45a9c2);if(!this[_0x511d30(0x239)][_0x511d30(0x1fe)]()){this[_0x511d30(0x239)][_0x511d30(0x226)](_0x1554ac,_0x511d30(0x25b),{'code':_0x511d30(0x258)},_0x511d30(0x1f9));return;}if(typeof _0x455acc[_0x511d30(0x202)]===_0x511d30(0x210)&&(_0x129d05===undefined||_0x129d05[_0x511d30(0x241)]!==_0x511d30(0x225))){this[_0x511d30(0x239)][_0x511d30(0x226)](_0x1554ac,_0x511d30(0x25b),{'code':_0x511d30(0x275)},_0x511d30(0x1f9));return;}try{this[_0x511d30(0x218)][_0x511d30(0x238)](_0x43420f,_0x1554ac);}catch(_0x53e6b2){this[_0x511d30(0x239)][_0x511d30(0x226)](_0x1554ac,_0x511d30(0x25b),{'code':safeErrorCode(_0x53e6b2,_0x511d30(0x278))},_0x511d30(0x1f9));return;}this[_0x511d30(0x239)][_0x511d30(0x1db)](_0x1554ac),void this[_0x511d30(0x271)]({'runId':_0x1554ac,'sessionId':_0x45a9c2,'input':_0x44d6da,'cwd':_0x365567,'externalSessionId':_0x455acc[_0x511d30(0x202)],'model':_0x455acc[_0x511d30(0x1d9)],'effort':_0x455acc[_0x511d30(0x1e2)],'access':_0x455acc[_0x511d30(0x205)],'collaborationMode':_0x455acc[_0x511d30(0x22f)],'serviceTier':_0x455acc[_0x511d30(0x1d7)],...typeof _0x455acc[_0x511d30(0x234)]===_0x511d30(0x210)?{'personalInstructions':_0x455acc[_0x511d30(0x234)]}:{},'mcpServers':this[_0x511d30(0x218)][_0x511d30(0x213)](_0x455acc[_0x511d30(0x232)],_0x43420f)},_0x3fb7db);}async[_0x4a070e(0x271)](_0x4589e6,_0x5d66d8){const _0x4a375a=_0x4a070e,{runId:_0xbaefb3,sessionId:_0x4b321c,input:_0x1b90f1,cwd:_0x2f1656}=_0x4589e6;try{await this[_0x4a375a(0x218)][_0x4a375a(0x1ff)]();if(this[_0x4a375a(0x239)][_0x4a375a(0x27a)](_0xbaefb3,_0x2f1656)){this[_0x4a375a(0x218)][_0x4a375a(0x1d5)](_0xbaefb3);return;}this[_0x4a375a(0x239)][_0x4a375a(0x226)](_0xbaefb3,_0x4a375a(0x229),{},_0x4a375a(0x23f));const _0x1d4070={...typeof _0x4589e6[_0x4a375a(0x1d9)]===_0x4a375a(0x210)?{'model':_0x4589e6[_0x4a375a(0x1d9)]}:{},...typeof _0x4589e6[_0x4a375a(0x1e2)]===_0x4a375a(0x210)?{'effort':_0x4589e6[_0x4a375a(0x1e2)]}:{},...typeof _0x4589e6[_0x4a375a(0x205)]===_0x4a375a(0x210)?{'access':_0x4589e6[_0x4a375a(0x205)]}:{},..._0x4589e6[_0x4a375a(0x234)]===undefined?{}:{'developerInstructions':_0x4589e6[_0x4a375a(0x234)]},..._0x4589e6[_0x4a375a(0x246)]===undefined?{}:{'mcpServers':_0x4589e6[_0x4a375a(0x246)]}},_0x139597=_0x4589e6[_0x4a375a(0x22f)]===_0x4a375a(0x1de)||_0x4589e6[_0x4a375a(0x22f)]===_0x4a375a(0x1e9)?_0x4589e6[_0x4a375a(0x22f)]:undefined,_0x525e36={..._0x1d4070,..._0x139597===undefined?{}:{'collaborationMode':_0x139597},..._0x4589e6[_0x4a375a(0x1d7)]===_0x4a375a(0x20a)?{'serviceTier':_0x4a375a(0x20a)}:{}},_0x5523bf=await this[_0x4a375a(0x239)][_0x4a375a(0x1e7)](_0xbaefb3,_0x5d66d8);let _0x46817a,_0x22584d;for(let _0x3b3938=-0xe5*0xf+-0x1*0x179b+0x2506;_0x3b3938<0x1b9d+0x1*-0x1391+-0x2*0x405;_0x3b3938+=-0x235c+0x49c+-0x1ec1*-0x1){try{const _0x247570=typeof _0x4589e6[_0x4a375a(0x202)]===_0x4a375a(0x210)?await this[_0x4a375a(0x218)][_0x4a375a(0x268)](_0x4589e6[_0x4a375a(0x202)],_0x2f1656,_0x1d4070):await this[_0x4a375a(0x218)][_0x4a375a(0x266)](_0x2f1656,_0x1d4070);if(this[_0x4a375a(0x239)][_0x4a375a(0x27a)](_0xbaefb3,_0x2f1656)){this[_0x4a375a(0x218)][_0x4a375a(0x1d5)](_0xbaefb3);return;}_0x46817a=extractId(_0x247570,_0x4a375a(0x20e)),this[_0x4a375a(0x218)][_0x4a375a(0x22a)][_0x4a375a(0x1ce)][_0x4a375a(0x1d4)](_0xbaefb3,{'sessionId':_0x4b321c,'threadId':_0x46817a,'cwd':_0x2f1656}),_0x22584d=await this[_0x4a375a(0x218)][_0x4a375a(0x277)](_0x46817a,_0x1b90f1,_0x2f1656,_0x525e36,_0x5523bf);break;}catch(_0xafd630){this[_0x4a375a(0x218)][_0x4a375a(0x22a)][_0x4a375a(0x1ce)][_0x4a375a(0x21e)](_0xbaefb3);if(_0x3b3938===0x109+0x2*0xef0+0x29*-0xc1&&await this[_0x4a375a(0x218)][_0x4a375a(0x1d3)](_0xbaefb3,_0xafd630))continue;throw _0xafd630;}}if(_0x46817a===undefined||_0x22584d===undefined)throw new Error(_0x4a375a(0x253));let _0x2e91ef=_0x4b321c;typeof _0x4589e6[_0x4a375a(0x202)]!==_0x4a375a(0x210)&&(this[_0x4a375a(0x239)][_0x4a375a(0x257)](_0x4b321c,_0x46817a),_0x2e91ef=_0x46817a,this[_0x4a375a(0x239)][_0x4a375a(0x1f0)](_0x4a375a(0x251),{'sessionId':_0x4b321c,'externalSessionId':_0x46817a}));const _0x464041=extractId(_0x22584d,_0x4a375a(0x1e6));this[_0x4a375a(0x218)][_0x4a375a(0x22a)][_0x4a375a(0x1ce)][_0x4a375a(0x1d4)](_0xbaefb3,{'sessionId':_0x2e91ef,'threadId':_0x46817a,'turnId':_0x464041,'cwd':_0x2f1656}),this[_0x4a375a(0x218)][_0x4a375a(0x22a)][_0x4a375a(0x245)][_0x4a375a(0x1d4)](_0x464041,{'sessionId':_0x2e91ef,'runId':_0xbaefb3});if(this[_0x4a375a(0x239)][_0x4a375a(0x1d1)](_0xbaefb3)===_0x4a375a(0x248)){await this[_0x4a375a(0x239)][_0x4a375a(0x1f2)](_0xbaefb3,_0x46817a,_0x464041,_0x2f1656,this[_0x4a375a(0x239)][_0x4a375a(0x212)](_0xbaefb3)?_0x4a375a(0x1ef):_0x4a375a(0x242)),this[_0x4a375a(0x218)][_0x4a375a(0x1d5)](_0xbaefb3);return;}this[_0x4a375a(0x239)][_0x4a375a(0x226)](_0xbaefb3,_0x4a375a(0x211),{'threadId':_0x46817a,'turnId':_0x464041},_0x4a375a(0x1ec));}catch(_0x370012){if(this[_0x4a375a(0x239)][_0x4a375a(0x27a)](_0xbaefb3,_0x2f1656)){this[_0x4a375a(0x218)][_0x4a375a(0x1d5)](_0xbaefb3);return;}this[_0x4a375a(0x252)](_0xbaefb3,_0x370012,_0x4a375a(0x253)),this[_0x4a375a(0x239)][_0x4a375a(0x226)](_0xbaefb3,_0x4a375a(0x25e),runnerErrorProjection(_0x370012,_0x4a375a(0x253)),_0x4a375a(0x1f9)),this[_0x4a375a(0x218)][_0x4a375a(0x22a)][_0x4a375a(0x1ce)][_0x4a375a(0x21e)](_0xbaefb3),this[_0x4a375a(0x218)][_0x4a375a(0x1d5)](_0xbaefb3),this[_0x4a375a(0x239)][_0x4a375a(0x217)](_0xbaefb3);}}[_0x4a070e(0x252)](_0x330bbd,_0x5b5003,_0x13778b){const _0x56792f=_0x4a070e,_0x589da3=runnerErrorProjection(_0x5b5003,_0x13778b);this[_0x56792f(0x239)][_0x56792f(0x23b)](_0x330bbd,{'itemId':boundedConversationItemId(_0x56792f(0x1e4),_0x330bbd),'kind':_0x56792f(0x250),'status':_0x56792f(0x1f9),'payload':{..._0x589da3,'recoverable':!![],'retryAfterMs':null}});}}
|