@myagentroam/node 0.9.62 → 0.9.65
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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/dist/capabilities.js +110 -2
- package/dist/claude-agent-sdk.js +330 -2
- package/dist/claude-channel.js +44 -2
- package/dist/codex-app-server.js +510 -2
- package/dist/config.js +106 -2
- package/dist/connector/node-connector-options.js +1 -2
- package/dist/connector/node-operation-router.js +22 -2
- package/dist/connector.js +1736 -2
- package/dist/control-outbound-scheduler.js +153 -2
- package/dist/database.js +639 -2
- package/dist/fake-runner.js +129 -2
- package/dist/git-askpass.js +12 -0
- package/dist/git-execution-helper.js +266 -0
- package/dist/health.js +3 -2
- package/dist/main.js +57 -2
- package/dist/mcp-installation-model.js +1 -2
- package/dist/migrations/v004.js +55 -3
- package/dist/migrations/v005.js +13 -3
- package/dist/migrations/v006.js +90 -3
- package/dist/migrations/v007.js +22 -3
- package/dist/migrations/v008.js +18 -3
- package/dist/migrations/v009.js +70 -4
- package/dist/migrations/v010.js +43 -3
- package/dist/migrations/v011.js +20 -3
- package/dist/migrations/v012.js +8 -0
- package/dist/native-jsonl-reader.js +186 -2
- package/dist/native-session-history.js +1143 -2
- package/dist/opencode-runtime.js +80 -2
- package/dist/opencode-server.js +259 -2
- package/dist/operational.js +122 -2
- package/dist/process-tree.js +18 -2
- package/dist/ripgrep-binary.js +31 -2
- package/dist/rotating-log.js +67 -2
- package/dist/runner/abstract-runner.js +260 -2
- package/dist/runner/claude/managed-run-controller.js +355 -2
- package/dist/runner/claude/tool-normalizer.js +120 -2
- package/dist/runner/claude-code-runner.js +303 -2
- package/dist/runner/codex/composer-image-markers.js +8 -2
- package/dist/runner/codex/conversation-parser.js +913 -2
- package/dist/runner/codex/managed-run-controller.js +494 -2
- package/dist/runner/codex/tool-normalizer.js +214 -2
- package/dist/runner/codex-runner.js +585 -2
- package/dist/runner/fake-test-runner.js +47 -2
- package/dist/runner/mar-agent/conversation-normalizer.js +644 -2
- package/dist/runner/mar-agent/executor-stdio-client-transport.js +139 -2
- package/dist/runner/mar-agent/generated-images.js +41 -2
- package/dist/runner/mar-agent/history-projection.js +106 -2
- package/dist/runner/mar-agent/hosted-conversation-runtime.js +446 -2
- package/dist/runner/mar-agent/managed-run-controller.js +785 -2
- package/dist/runner/mar-agent/mcp-client-pool.js +233 -2
- package/dist/runner/mar-agent/runtime-model-factory.js +326 -2
- package/dist/runner/mar-agent-runner.js +458 -2
- package/dist/runner/opencode/conversation-parser.js +221 -2
- package/dist/runner/opencode/managed-run-controller.js +588 -2
- package/dist/runner/opencode/tool-normalizer.js +80 -2
- package/dist/runner/opencode-runner.js +426 -2
- package/dist/runner/runner-registry.js +87 -2
- package/dist/runner-command-engine.js +71 -2
- package/dist/runner-profiles.js +323 -2
- package/dist/runner-usage.js +190 -2
- package/dist/runtime-command-detector.js +73 -2
- package/dist/runtime-model.js +1 -2
- package/dist/runtime-state.js +1509 -2
- package/dist/service/attachment-domain-state.js +7 -2
- package/dist/service/bubblewrap-sandbox-executor.js +543 -2
- package/dist/service/continuous-run-coordinator.js +425 -2
- package/dist/service/conversation-history-service.js +552 -2
- package/dist/service/conversation-hosting-capability-service.js +61 -2
- package/dist/service/conversation-hosting-enablement-service.js +91 -2
- package/dist/service/conversation-hosting-maintenance-service.js +174 -2
- package/dist/service/conversation-segment-service.js +162 -2
- package/dist/service/conversation-template-node-service.js +992 -2
- package/dist/service/external-session-resume-service.js +152 -2
- package/dist/service/fake-managed-run-service.js +60 -2
- package/dist/service/git-execution-service.js +418 -0
- package/dist/service/git-operation-service.js +57 -0
- package/dist/service/hosted-conversation-node-service.js +1982 -2
- package/dist/service/hosted-conversation-store.js +1405 -2
- package/dist/service/managed-runner-session-service.js +35 -2
- package/dist/service/mar-agent-model-transport-test-service.js +88 -2
- package/dist/service/mcp-installation-verifier.js +87 -2
- package/dist/service/mcp-node-operation-service.js +90 -2
- package/dist/service/mission-mcp-server.js +124 -2
- package/dist/service/mission-mcp-stdio.js +40 -2
- package/dist/service/mission-runtime.js +142 -2
- package/dist/service/native-session-projection-service.js +274 -2
- package/dist/service/native-session-watch-service.js +683 -2
- package/dist/service/node-connection-lifecycle-service.js +88 -2
- package/dist/service/node-control-channel.js +85 -2
- package/dist/service/node-control-message-service.js +109 -2
- package/dist/service/node-request-service.js +62 -2
- package/dist/service/node-run-event-bridge.js +88 -2
- package/dist/service/node-terminal-channel.js +202 -2
- package/dist/service/node-upgrade-coordinator.js +137 -2
- package/dist/service/node-workspace-coordinator.js +97 -2
- package/dist/service/recent-run-projection-service.js +99 -2
- package/dist/service/run-attachment-service.js +321 -2
- package/dist/service/run-domain-state.js +4 -2
- package/dist/service/run-event-service.js +246 -2
- package/dist/service/run-ownership-policy.js +22 -2
- package/dist/service/run-workbench-service.js +120 -2
- package/dist/service/runner-channel-message-service.js +20 -2
- package/dist/service/runner-interaction-service.js +243 -2
- package/dist/service/runner-service.js +69 -2
- package/dist/service/runtime-credential-control-service.js +95 -2
- package/dist/service/session-catalog-service.js +404 -2
- package/dist/service/session-command-service.js +125 -2
- package/dist/service/session-context-service.js +128 -2
- package/dist/service/session-domain-state.js +9 -2
- package/dist/service/session-identity-service.js +86 -2
- package/dist/service/session-lifecycle-service.js +248 -2
- package/dist/service/session-message-service.js +270 -2
- package/dist/service/session-presentation-service.js +43 -2
- package/dist/service/session-query-service.js +82 -2
- package/dist/service/session-watch-slot-coordinator.js +21 -2
- package/dist/service/skill-directory-service.js +238 -2
- package/dist/service/skill-install-service.js +434 -2
- package/dist/service/skill-node-operation-service.js +206 -2
- package/dist/service/terminal-relay-state.js +3 -2
- package/dist/service/terminal-service.js +90 -2
- package/dist/service/web-search-error.js +40 -2
- package/dist/service/workbench-event-service.js +21 -2
- package/dist/service/workbench-manifest-service.js +69 -2
- package/dist/service/workspace-change-service.js +290 -2
- package/dist/service/workspace-content-search-service.js +457 -2
- package/dist/service/workspace-domain-state.js +41 -2
- package/dist/service/workspace-file-service.js +150 -2
- package/dist/service/workspace-git-exclude-service.js +119 -2
- package/dist/service/workspace-queue-workbench-service.js +176 -2
- package/dist/service/workspace-service.js +92 -2
- package/dist/service/workspace-session-service.js +154 -2
- package/dist/service/workspace-upload-service.js +262 -2
- package/dist/service/workspace-watch-controller.js +68 -2
- package/dist/service/workspace-watch-service.js +170 -2
- package/dist/service/workspace-watch-snapshot-service.js +218 -2
- package/dist/service/workspace-workbench-service.js +239 -2
- package/dist/service.js +91 -2
- package/dist/storage.js +32 -2
- package/dist/supervisor.js +136 -2
- package/dist/terminal.js +496 -2
- package/dist/util/git-credential-client.js +32 -0
- package/dist/util/node-operation-data.js +9 -2
- package/dist/util/node-operation-parsers.js +382 -2
- package/dist/util/personal-instructions.js +34 -2
- package/dist/util/runner-error.js +70 -2
- package/dist/util/runner-native-session-parsers.js +510 -2
- package/dist/util/safe-error.js +8 -2
- package/dist/util/secret-environment.js +25 -2
- package/dist/workspace.js +1793 -2
- package/package.json +11 -8
- package/vendor/ripgrep/darwin-arm64/rg +0 -0
- package/vendor/ripgrep/darwin-x64/rg +0 -0
- package/vendor/ripgrep/manifest.json +12 -0
- package/README.md +0 -42
- package/dist/event-buffer.js +0 -2
- package/dist/migrations/v001.js +0 -107
- package/dist/migrations/v002.js +0 -2
- package/dist/migrations/v003.js +0 -2
- package/dist/service/mcp-package-installer.js +0 -2
|
@@ -1,2 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { nodeLog } from '../operational.js';
|
|
2
|
+
export class RunnerRegistry {
|
|
3
|
+
runners = new Map();
|
|
4
|
+
constructor(runners = []) {
|
|
5
|
+
for (const runner of runners)
|
|
6
|
+
this.register(runner);
|
|
7
|
+
}
|
|
8
|
+
register(runner) {
|
|
9
|
+
if (this.runners.has(runner.name))
|
|
10
|
+
throw new Error(`RUNNER_ALREADY_REGISTERED:${runner.name}`);
|
|
11
|
+
this.runners.set(runner.name, runner);
|
|
12
|
+
return runner;
|
|
13
|
+
}
|
|
14
|
+
optional(name) {
|
|
15
|
+
return this.runners.get(name);
|
|
16
|
+
}
|
|
17
|
+
require(name) {
|
|
18
|
+
const runner = this.optional(name);
|
|
19
|
+
if (runner === undefined)
|
|
20
|
+
throw new Error(`RUNNER_NOT_REGISTERED:${name}`);
|
|
21
|
+
return runner;
|
|
22
|
+
}
|
|
23
|
+
advertised() {
|
|
24
|
+
return [...this.runners.values()].filter((runner) => runner.advertised);
|
|
25
|
+
}
|
|
26
|
+
product(name) {
|
|
27
|
+
if (typeof name !== 'string')
|
|
28
|
+
return undefined;
|
|
29
|
+
const runner = this.runners.get(name);
|
|
30
|
+
return runner?.advertised === true ? runner : undefined;
|
|
31
|
+
}
|
|
32
|
+
profiles(capabilities) {
|
|
33
|
+
return this.advertised().flatMap((runner) => {
|
|
34
|
+
const profile = runner.profile(capabilities);
|
|
35
|
+
return profile === undefined ? [] : [profile];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async refreshProfiles(capabilities, workspace, environment = {}) {
|
|
39
|
+
const profiles = await Promise.all(this.advertised().map(async (runner) => {
|
|
40
|
+
const startedAt = performance.now();
|
|
41
|
+
try {
|
|
42
|
+
return await runner.refreshProfile(capabilities, workspace, environment);
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
const durationMs = Math.round(performance.now() - startedAt);
|
|
46
|
+
if (durationMs >= 100)
|
|
47
|
+
nodeLog('runner.profile.refresh.completed', {
|
|
48
|
+
runner: runner.name,
|
|
49
|
+
workspaceId: workspace?.id,
|
|
50
|
+
durationMs
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
return profiles.flatMap((profile) => (profile === undefined ? [] : [profile]));
|
|
55
|
+
}
|
|
56
|
+
startManagedRun(envelope) {
|
|
57
|
+
const runnerName = envelope.payload.runner;
|
|
58
|
+
const values = [...this.runners.values()];
|
|
59
|
+
const runner = values.find((candidate) => candidate.interceptsRuns && candidate.acceptsRun(runnerName)) ??
|
|
60
|
+
values.find((candidate) => candidate.acceptsRun(runnerName));
|
|
61
|
+
if (runner === undefined)
|
|
62
|
+
return false;
|
|
63
|
+
runner.startManagedRun(envelope);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
cancelManagedRun(runId, intent) {
|
|
67
|
+
for (const runner of this.runners.values())
|
|
68
|
+
if (runner.cancelManagedRun(runId, intent))
|
|
69
|
+
return true;
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
decideApproval(input) {
|
|
73
|
+
let handled = false;
|
|
74
|
+
for (const runner of this.runners.values())
|
|
75
|
+
handled = runner.decideApproval(input) || handled;
|
|
76
|
+
return handled;
|
|
77
|
+
}
|
|
78
|
+
respondUserInput(runId, requestId, answers) {
|
|
79
|
+
for (const runner of this.runners.values())
|
|
80
|
+
if (runner.respondUserInput(runId, requestId, answers))
|
|
81
|
+
return true;
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
async stop() {
|
|
85
|
+
await Promise.allSettled([...this.runners.values()].map((runner) => runner.stop()));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,2 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const CLAUDE_PLAN_TAG_OPEN = '<plan_mode>';
|
|
2
|
+
const CLAUDE_PLAN_TAG_CLOSE = '</plan_mode>';
|
|
3
|
+
/**
|
|
4
|
+
* Claude Agent SDK has no mid-session collaboration mode switch. Plan Mode is
|
|
5
|
+
* therefore declared as a fixed Node-owned instruction tag prepended to each
|
|
6
|
+
* Runner-bound input while the command state is active. The tag never appears
|
|
7
|
+
* in the user bubble; native history strips it again on read.
|
|
8
|
+
*/
|
|
9
|
+
export function withClaudePlanTag(input) {
|
|
10
|
+
return `${CLAUDE_PLAN_TAG_OPEN}
|
|
11
|
+
You are in Plan Mode. Perform only read-only analysis and planning. Do not create, modify, or delete files, and do not run commands with side effects. Wrap the complete final plan in <proposed_plan> and </proposed_plan> tags without repeating the plan outside those tags.
|
|
12
|
+
${CLAUDE_PLAN_TAG_CLOSE}
|
|
13
|
+
|
|
14
|
+
${input}`;
|
|
15
|
+
}
|
|
16
|
+
/** Removes one leading plan instruction tag from a native transcript user text. */
|
|
17
|
+
export function stripClaudePlanTag(text) {
|
|
18
|
+
if (!text.startsWith(CLAUDE_PLAN_TAG_OPEN))
|
|
19
|
+
return text;
|
|
20
|
+
const close = text.indexOf(CLAUDE_PLAN_TAG_CLOSE);
|
|
21
|
+
if (close === -1)
|
|
22
|
+
return text;
|
|
23
|
+
return text.slice(close + CLAUDE_PLAN_TAG_CLOSE.length).trimStart();
|
|
24
|
+
}
|
|
25
|
+
export function parseCommandInvocation(definition, input) {
|
|
26
|
+
const normalized = input.trim();
|
|
27
|
+
const prefix = `/${definition.descriptor.id}`;
|
|
28
|
+
if (!normalized.startsWith(prefix) ||
|
|
29
|
+
(normalized.length > prefix.length && !/\s/.test(normalized[prefix.length])))
|
|
30
|
+
throw new Error('RUNNER_COMMAND_INVALID');
|
|
31
|
+
const argument = normalized.slice(prefix.length).trim();
|
|
32
|
+
if ((definition.descriptor.interaction === 'IMMEDIATE_ACTION' ||
|
|
33
|
+
definition.descriptor.interaction === 'DESTRUCTIVE_ACTION' ||
|
|
34
|
+
definition.descriptor.id === 'plan') &&
|
|
35
|
+
argument.length > 0)
|
|
36
|
+
throw new Error('RUNNER_COMMAND_ARGUMENT_INVALID');
|
|
37
|
+
return { input: normalized, argument };
|
|
38
|
+
}
|
|
39
|
+
export class CommandStateStore {
|
|
40
|
+
states = new Map();
|
|
41
|
+
list(sessionId) {
|
|
42
|
+
return [...(this.states.get(sessionId)?.values() ?? [])].filter((state) => state.active || state.commandId === 'mission');
|
|
43
|
+
}
|
|
44
|
+
set(sessionId, state) {
|
|
45
|
+
const values = this.states.get(sessionId) ?? new Map();
|
|
46
|
+
values.set(state.commandId, state);
|
|
47
|
+
this.states.set(sessionId, values);
|
|
48
|
+
return this.list(sessionId);
|
|
49
|
+
}
|
|
50
|
+
clear(sessionId, commandId) {
|
|
51
|
+
this.states.get(sessionId)?.delete(commandId);
|
|
52
|
+
return this.list(sessionId);
|
|
53
|
+
}
|
|
54
|
+
removeSession(sessionId) {
|
|
55
|
+
this.states.delete(sessionId);
|
|
56
|
+
}
|
|
57
|
+
promoteSessionIdentity(sessionId, nativeSessionId) {
|
|
58
|
+
if (sessionId === nativeSessionId)
|
|
59
|
+
return;
|
|
60
|
+
const values = this.states.get(sessionId);
|
|
61
|
+
if (values === undefined)
|
|
62
|
+
return;
|
|
63
|
+
if (this.states.has(nativeSessionId))
|
|
64
|
+
throw new Error('SESSION_ID_CONFLICT');
|
|
65
|
+
this.states.delete(sessionId);
|
|
66
|
+
this.states.set(nativeSessionId, values);
|
|
67
|
+
}
|
|
68
|
+
get(sessionId, commandId) {
|
|
69
|
+
return this.states.get(sessionId)?.get(commandId);
|
|
70
|
+
}
|
|
71
|
+
}
|
package/dist/runner-profiles.js
CHANGED
|
@@ -1,2 +1,323 @@
|
|
|
1
|
-
|
|
2
|
-
const _0x44ec60=_0x2f1c;(function(_0x4a55aa,_0x335b1c){const _0x2971b=_0x2f1c,_0x1eed84=_0x4a55aa();while(!![]){try{const _0x53eca3=-parseInt(_0x2971b(0xa1))/(0x33b*-0x9+0x98e+0x1386)+parseInt(_0x2971b(0xde))/(0x1953+0x4a5*0x5+-0x308a)+parseInt(_0x2971b(0xfc))/(0x4*0x650+0x1c8d+-0x35ca)*(-parseInt(_0x2971b(0xb1))/(-0x223d+0xabc+0x1b*0xdf))+parseInt(_0x2971b(0xc5))/(0x112*0x23+0x3*-0x2e1+-0x2*0xe67)+-parseInt(_0x2971b(0xc8))/(-0x1cc9+-0x3b0*0x5+0x127*0x29)+-parseInt(_0x2971b(0xdc))/(0x132e*0x2+0x2644+-0x4c99)+parseInt(_0x2971b(0xb8))/(0x1*0x262c+0x2701+0xe3*-0x57)*(parseInt(_0x2971b(0xc2))/(-0x1*-0x1aad+-0x2388*-0x1+-0x2e*0x15a));if(_0x53eca3===_0x335b1c)break;else _0x1eed84['push'](_0x1eed84['shift']());}catch(_0x20dd2a){_0x1eed84['push'](_0x1eed84['shift']());}}}(_0x371d,-0x30d9f+-0x3b066+0x143323));const COMMON_COMMAND_DESCRIPTIONS={'compact':_0x44ec60(0x102),'plan':_0x44ec60(0xa8),'mission':_0x44ec60(0xfb)},CLAUDE_MODEL_ENVIRONMENT={'opus':_0x44ec60(0xcd),'sonnet':_0x44ec60(0xc4),'haiku':_0x44ec60(0xc7)},OFFICIAL_ANTHROPIC_HOST=_0x44ec60(0xd0),definitions={'codex':{'runner':_0x44ec60(0xe8),'models':[],'accessOptions':[{'id':_0x44ec60(0x10c),'label':_0x44ec60(0xf4),'description':_0x44ec60(0xf7)},{'id':_0x44ec60(0x10d),'label':_0x44ec60(0xd7),'description':_0x44ec60(0xff)},{'id':_0x44ec60(0x108),'label':_0x44ec60(0xd9),'description':_0x44ec60(0xe9)},{'id':_0x44ec60(0xe2),'label':_0x44ec60(0xa4),'description':_0x44ec60(0xb5)}],'commands':[{'id':_0x44ec60(0xcc),'label':_0x44ec60(0xd6),'description':COMMON_COMMAND_DESCRIPTIONS[_0x44ec60(0xcc)],'inputHint':_0x44ec60(0xd6),'interaction':_0x44ec60(0xf6)},{'id':_0x44ec60(0xb6),'label':_0x44ec60(0xd2),'stateLabel':_0x44ec60(0x10a),'description':COMMON_COMMAND_DESCRIPTIONS[_0x44ec60(0xb6)],'inputHint':_0x44ec60(0xd2),'interaction':_0x44ec60(0xae)},{'id':_0x44ec60(0xa9),'label':_0x44ec60(0xbb),'description':_0x44ec60(0xc1),'inputHint':_0x44ec60(0xbb),'interaction':_0x44ec60(0xae)}][_0x44ec60(0x106)](_0x468dbf=>({..._0x468dbf,'runner':_0x44ec60(0xe8),'source':_0x44ec60(0x103),'available':!![],'reasonCode':null}))},'claude-code':{'runner':_0x44ec60(0xc0),'models':[{'id':_0x44ec60(0xf5),'label':_0x44ec60(0xce),'supportedEfforts':[_0x44ec60(0xca),_0x44ec60(0xad),_0x44ec60(0x107),_0x44ec60(0xe0),_0x44ec60(0xf9)]},{'id':_0x44ec60(0xe7),'label':_0x44ec60(0xeb),'supportedEfforts':[_0x44ec60(0xca),_0x44ec60(0xad),_0x44ec60(0x107),_0x44ec60(0xe0),_0x44ec60(0xf9)]},{'id':_0x44ec60(0xb0),'label':_0x44ec60(0xf2),'supportedEfforts':[_0x44ec60(0xca),_0x44ec60(0xad)]}],'accessOptions':[{'id':_0x44ec60(0xa2),'label':_0x44ec60(0xb2),'description':_0x44ec60(0xd3)},{'id':_0x44ec60(0xef),'label':_0x44ec60(0xa5),'description':_0x44ec60(0xec)},{'id':_0x44ec60(0xac),'label':_0x44ec60(0xfd),'description':_0x44ec60(0xa3)},{'id':_0x44ec60(0xb6),'label':_0x44ec60(0x10a),'description':_0x44ec60(0xea)}],'commands':[{'id':_0x44ec60(0xcc),'runner':_0x44ec60(0xc0),'label':_0x44ec60(0xd6),'description':COMMON_COMMAND_DESCRIPTIONS[_0x44ec60(0xcc)],'inputHint':_0x44ec60(0xd6),'source':_0x44ec60(0xbd),'interaction':_0x44ec60(0xf6),'available':!![],'reasonCode':null},{'id':_0x44ec60(0xb6),'runner':_0x44ec60(0xc0),'label':_0x44ec60(0xd2),'stateLabel':_0x44ec60(0x10a),'description':COMMON_COMMAND_DESCRIPTIONS[_0x44ec60(0xb6)],'inputHint':_0x44ec60(0xd2),'source':_0x44ec60(0xbd),'interaction':_0x44ec60(0xae),'available':!![],'reasonCode':null}]},'opencode':{'runner':_0x44ec60(0x10e),'models':[],'accessOptions':[{'id':_0x44ec60(0xa2),'label':_0x44ec60(0xb2),'description':_0x44ec60(0xfe)},{'id':_0x44ec60(0xa7),'label':_0x44ec60(0xb7),'description':_0x44ec60(0xbc)}],'commands':[{'id':_0x44ec60(0xcc),'runner':_0x44ec60(0x10e),'label':_0x44ec60(0xd6),'description':COMMON_COMMAND_DESCRIPTIONS[_0x44ec60(0xcc)],'inputHint':_0x44ec60(0xd6),'source':_0x44ec60(0xed),'interaction':_0x44ec60(0xf6),'available':!![],'reasonCode':null},{'id':_0x44ec60(0xb6),'runner':_0x44ec60(0x10e),'label':_0x44ec60(0xd2),'stateLabel':_0x44ec60(0x10a),'description':COMMON_COMMAND_DESCRIPTIONS[_0x44ec60(0xb6)],'inputHint':_0x44ec60(0xd2),'source':_0x44ec60(0xed),'interaction':_0x44ec60(0xae),'available':!![],'reasonCode':null}]},'mar-agent':{'runner':_0x44ec60(0xb3),'models':[],'accessOptions':[{'id':_0x44ec60(0x10c),'label':_0x44ec60(0xf4),'description':_0x44ec60(0xf3)},{'id':_0x44ec60(0x108),'label':_0x44ec60(0xd9),'description':_0x44ec60(0x104)}],'commands':[{'id':_0x44ec60(0xcc),'runner':_0x44ec60(0xb3),'label':_0x44ec60(0xd6),'description':COMMON_COMMAND_DESCRIPTIONS[_0x44ec60(0xcc)],'inputHint':_0x44ec60(0xd6),'source':_0x44ec60(0xe4),'interaction':_0x44ec60(0xf6),'available':!![],'reasonCode':null},{'id':_0x44ec60(0xb6),'runner':_0x44ec60(0xb3),'label':_0x44ec60(0xd2),'stateLabel':_0x44ec60(0x10a),'description':COMMON_COMMAND_DESCRIPTIONS[_0x44ec60(0xb6)],'inputHint':_0x44ec60(0xd2),'source':_0x44ec60(0xe4),'interaction':_0x44ec60(0xae),'available':!![],'reasonCode':null},{'id':_0x44ec60(0xaa),'runner':_0x44ec60(0xb3),'label':_0x44ec60(0xc6),'description':_0x44ec60(0xab),'inputHint':_0x44ec60(0xc6),'source':_0x44ec60(0xe4),'interaction':_0x44ec60(0xf6),'available':!![],'reasonCode':null}]}};export function declaredRunnerProfiles(_0x2e4484){const _0x5d03e8=_0x44ec60;return[withCapabilities(definitions[_0x5d03e8(0xe8)],_0x2e4484[_0x5d03e8(0xc9)]),withCapabilities(claudeProfile(_0x2e4484[_0x5d03e8(0x100)]??process.env),_0x2e4484[_0x5d03e8(0x109)]),withCapabilities(definitions[_0x5d03e8(0x10e)],_0x2e4484[_0x5d03e8(0xbf)]===!![])];}export function supportsRunnerConfiguration(_0x6614e6){const _0x34d244=_0x44ec60,_0x3ebd18=_0x6614e6[_0x34d244(0xcf)]===_0x34d244(0xc0)?claudeProfile(_0x6614e6[_0x34d244(0x100)]??process.env):definitions[_0x6614e6[_0x34d244(0xcf)]],_0x98e8f3=_0x3ebd18[_0x34d244(0xdd)][_0x34d244(0xf1)](_0x1cca1c=>_0x1cca1c['id']===_0x6614e6[_0x34d244(0xd1)]);return _0x98e8f3!==undefined&&_0x98e8f3[_0x34d244(0xe1)][_0x34d244(0xf8)](_0x6614e6[_0x34d244(0xb4)])&&_0x3ebd18[_0x34d244(0xb9)][_0x34d244(0xf0)](_0x45c32a=>_0x45c32a['id']===_0x6614e6[_0x34d244(0xd8)]);}function _0x2f1c(_0x7fb6a,_0x2a15eb){_0x7fb6a=_0x7fb6a-(-0x1*0xcb1+0x2442+-0x1*0x16f0);const _0x1c02f3=_0x371d();let _0x5bfe2e=_0x1c02f3[_0x7fb6a];if(_0x2f1c['PDsUdA']===undefined){var _0x771b2d=function(_0x2afbae){const _0x9fa9ff='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2249b6='',_0x31f294='';for(let _0x1991d6=-0x193+0x196b+-0x38*0x6d,_0x31d503,_0x4f24cd,_0x3b6c65=-0x17a8+0x11d4+-0x2*-0x2ea;_0x4f24cd=_0x2afbae['charAt'](_0x3b6c65++);~_0x4f24cd&&(_0x31d503=_0x1991d6%(-0xa83+0x1*0x234e+-0x18c7)?_0x31d503*(0x9*-0xbf+0x2306+-0x1c0f)+_0x4f24cd:_0x4f24cd,_0x1991d6++%(0xc55+0x535*-0x6+-0x64f*-0x3))?_0x2249b6+=String['fromCharCode'](-0x1*-0x158f+0x9fe+-0x1e8e&_0x31d503>>(-(-0x22f9*-0x1+0x7*0x173+-0x2d1c)*_0x1991d6&0x29*-0x7+-0x2266+0x3f3*0x9)):-0xc58+-0x189*-0x9+-0x179){_0x4f24cd=_0x9fa9ff['indexOf'](_0x4f24cd);}for(let _0x25a60b=0x193*-0x1+-0x305+0x498,_0x470974=_0x2249b6['length'];_0x25a60b<_0x470974;_0x25a60b++){_0x31f294+='%'+('00'+_0x2249b6['charCodeAt'](_0x25a60b)['toString'](0x1003*-0x1+-0x7*-0x4bb+0x5ae*-0x3))['slice'](-(0x1346+-0x683+-0xcc1));}return decodeURIComponent(_0x31f294);};_0x2f1c['eDuoqD']=_0x771b2d,_0x2f1c['tbbEIH']={},_0x2f1c['PDsUdA']=!![];}const _0x58e22e=_0x1c02f3[0x3*-0x172+0x826+0x2*-0x1e8];_0x2f1c['fVGpIN']!==_0x58e22e&&(_0x2f1c['tbbEIH']={},_0x2f1c['fVGpIN']=_0x58e22e);const _0x5c0478=_0x2f1c['tbbEIH'][_0x7fb6a];return _0x5c0478===undefined?(_0x5bfe2e=_0x2f1c['eDuoqD'](_0x5bfe2e),_0x2f1c['tbbEIH'][_0x7fb6a]=_0x5bfe2e):_0x5bfe2e=_0x5c0478,_0x5bfe2e;}function _0x371d(){const _0x99e32f=['B3bLBKnVzgvbDMfPBgfIBgu','y2XHDwrLlwnVzgu','vg9Nz2XLihrOzsbMyxn0ihnLCNzPy2uGDgLLCIb3AgvUihn1ChbVCNrLzc4','ntiWntzdtxL5Eeu','DhvYBI5ZDgfYDa','qu5usfjpueLdx0rfrKfvtfrFu09otKvux01prevm','mtq1mZKZnwjMC0jHqG','l3jLDMLLDW','qu5usfjpueLdx0rfrKfvtfrFsefjs1vFtu9eruW','nZyZnZm4ofjhDu1nEa','y29KzxHbDMfPBgfIBgu','Bg93','qu5usfjpueLdx01prevm','y29TCgfJDa','qu5usfjpueLdx0rfrKfvtfrFt1bvu19nt0rfta','q2XHDwrLie9WDxm','CNvUBMvY','yxbPlMfUDgHYB3bPyY5JB20','Bw9KzwW','l3bSyw4','vxnLienSyxvKzsbdB2rLigrLzMf1BhqGy29UzMLYBwf0Aw9UCY4','zxzLBNrZlMXPDMu','AgLZDg9YEs5YzwfK','l2nVBxbHy3q','v29YA3nWywnLihDYAxrL','ywnJzxnZ','rNvSBcbHy2nLC3m','uLvotKvsx1voqvzbsuXbqKXf','qu5usfjpueLdx0jbu0vFvvjm','mZyWoty2ouHYvuvXsG','Bw9KzwXZ','mti0nZu3mNz4B2P4rG','BgvUz3rO','EgHPz2G','C3vWCg9YDgvKrwzMB3j0CW','CMvHzc1VBMX5','zMLUzeLUzgv4','tufsx1jvtLrjtuu','Ag9ZDg5HBwu','DhvYBI5XDwv1zq','C29UBMv0','y29KzxG','qwXSB3CGzNvSBcbHy2nLC3mGD2L0Ag91DcbPBMrPDMLKDwfSignVBMzPCM1HDgLVBNmU','uNvUigLUifbSyw4Gtw9Kzsb3AxrOB3v0igv4zwn1DgLUzYb0B29SCY4','q2XHDwrLifnVBM5LDa','qxv0B21HDgLJywXSEsbHy2nLChqGzwrPDhmGAw4GDgHLign1CNjLBNqGv29YA3nWywnLlG','t1bftKnprevFu0vsvKvs','Dg9mB3DLCKnHC2u','ywnJzxb0lwvKAxrZ','C29Tzq','zMLUza','q2XHDwrLieHHAwT1','qxnRigjLzM9Yzsb0B29SCYb3AxrOihnPzguGzwzMzwn0CY4GvgHPCYbPCYbUB3qGyw4GB3bLCMf0Aw5Nlxn5C3rLBsbZyw5KyM94lG','t24TCMvXDwvZDa','B3b1CW','su1nrurjqvrfx0fdveLptG','qxnRihDOzw4GywrKAxrPB25HBcbWzxjTAxnZAw9UigLZihjLCxvPCMvKlG','Aw5JBhvKzxm','Bwf4','DhjPBq','rw50zxiGCgvYC2LZDgvUDcbnAxnZAw9Uig1VzguU','ndu4mtK0mLbezfrdyq','qNLWyxnZihbLCM1PC3nPB25Z','vxnLie9Wzw5dB2rLigfUzcbxB3jRC3bHy2uGCgvYBwLZC2LVBIbJB25MAwD1CMf0Aw9UlG','qwXSB3CGD3jPDgvZigLUihrOzsbJDxjYzw50ifDVCMTZCgfJzs4','zw52AxjVBM1LBNq','l21PC3nPB24','q29TCgfJDcb0AguGy3vYCMvUDcbZzxnZAw9UignVBNrLEhqU','q09ervHFqvbqx1nfuLzfuG','u2TPCcbbz2vUDcbHChbYB3zHBhmUieHVC3qGDMfSAwrHDgLVBIbZDgLSBcbHChbSAwvZigfUzcbUBYbbz2vUDcbZyw5KyM94igLZihbYB3zPzgvKlG','twLZC2LVBG','BwfW','AgLNAa','zNvSBc1Hy2nLC3m','y2XHDwrLq29Kzuf2ywLSywjSzq','ugXHBIbnB2rL','zMXHDe1HCa','B24TCMvXDwvZDa','D29YA3nWywnLlxDYAxrL','B3bLBMnVzgu','ntu3mZiWvfn0rvjn','zgvMyxvSDa','qNLWyxnZihbLCM1PC3nPB24Gy29UzMLYBwf0Aw9UCY4','uMvHzc1VBMX5','qwnJzxb0igvKAxrZ','DhvYBI5PBNrLCNj1Chq','yxv0BW','vg9Nz2XLignVBgXHyM9YyxrPDMuGugXHBIbnB2rLlG','zMfZDa','CMv2Awv3','uMv2Awv3ihrOzsbZzwXLy3rLzcb3B3jRC3bHy2uGy2HHBMDLCYb3AxrOB3v0ig1VzgLMEwLUzYbMAwXLCY4','yNLWyxnZ','BwvKAxvT','ve9hr0Xf','zMLSDgvY','AgfPA3u','nhDWwwvxwq','rgvMyxvSDa','BwfYlwfNzw50','zwzMB3j0','uMvZDhjPy3qGq29KzxGGDg8GysbYzwfKlw9UBhKGC2fUzgjVEc4','CgXHBG','qxv0BYbHChbYB3zL','ntmXmLfPtgTpAa','ywnJzxnZt3b0Aw9UCW','y29TBwfUzhm','l2zHC3q','qxv0B21HDgLJywXSEsbHBgXVDYbYzxf1zxn0zwqGDg9VBcbWzxjTAxnZAw9UCY4','q0Xbvurfx0fhru5ux1nesW','BwLZC2LVBG'];_0x371d=function(){return _0x99e32f;};return _0x371d();}export function claudeDefaultModel(_0x54d7d7=process.env){const _0x194060=_0x44ec60,_0x400b56=configuredClaudeModel(_0x194060(0xe7),_0x54d7d7);if(_0x400b56!==undefined)return _0x400b56;if(usesThirdPartyEndpoint(_0x54d7d7))return configuredClaudeModel(_0x194060(0xf5),_0x54d7d7)??configuredClaudeModel(_0x194060(0xb0),_0x54d7d7)??_0x194060(0xe7);return _0x194060(0xe7);}function claudeProfile(_0x3733c8){const _0x28c5b0=_0x44ec60,_0x4a00ca=definitions[_0x28c5b0(0xc0)],_0x3be283=usesThirdPartyEndpoint(_0x3733c8),_0x5c2692=_0x4a00ca[_0x28c5b0(0xdd)][_0x28c5b0(0x10b)](_0x2045b5=>{const _0x14c854=configuredClaudeModel(_0x2045b5['id'],_0x3733c8);if(_0x14c854!==undefined)return[{..._0x2045b5,'id':_0x14c854,'label':_0x14c854}];return _0x3be283?[]:[_0x2045b5];});return{..._0x4a00ca,'models':_0x5c2692[_0x28c5b0(0xaf)]((_0xdf3001,_0x5a5f81)=>_0x5c2692[_0x28c5b0(0xe3)](_0x3c1227=>_0x3c1227['id']===_0xdf3001['id'])===_0x5a5f81)};}function usesThirdPartyEndpoint(_0x3b6a50){const _0x1f514b=_0x44ec60,_0x687b76=_0x3b6a50[_0x1f514b(0xdb)]?.[_0x1f514b(0xfa)]();if(_0x687b76===undefined||_0x687b76[_0x1f514b(0xdf)]===-0x1bb+0x1cde+-0x1*0x1b23)return![];try{return new URL(_0x687b76)[_0x1f514b(0xe5)][_0x1f514b(0xee)]()!==OFFICIAL_ANTHROPIC_HOST;}catch{return!![];}}function configuredClaudeModel(_0x3d8e48,_0x398f6b){const _0x254a58=_0x44ec60,_0x2af3f5=CLAUDE_MODEL_ENVIRONMENT[_0x3d8e48];return validModelName(_0x2af3f5===undefined?undefined:_0x398f6b[_0x2af3f5])??(_0x3d8e48===_0x254a58(0xe7)?validModelName(_0x398f6b[_0x254a58(0xcb)]):undefined);}function validModelName(_0x2e51ef){const _0x5bc50c=_0x44ec60,_0x5b4f58=_0x2e51ef?.[_0x5bc50c(0xfa)]();return _0x5b4f58!==undefined&&_0x5b4f58[_0x5bc50c(0xdf)]>-0x14ea+0x242e+-0x2*0x7a2&&_0x5b4f58[_0x5bc50c(0xdf)]<=0x1a1d+0x524+0x1*-0x1ec1?_0x5b4f58:undefined;}function withCapabilities(_0x38a98b,_0x5271cf){const _0x1af785=_0x44ec60,_0x1c00aa={'id':_0x1af785(0xbe),'runner':_0x38a98b[_0x1af785(0xcf)],'label':_0x1af785(0x101),'stateLabel':_0x1af785(0x105),'description':COMMON_COMMAND_DESCRIPTIONS[_0x1af785(0xbe)],'inputHint':_0x1af785(0x101),'source':_0x1af785(0xe4),'interaction':_0x1af785(0xae),'available':_0x5271cf,'reasonCode':_0x5271cf?null:_0x1af785(0xda)};return{..._0x38a98b,'commands':[..._0x38a98b[_0x1af785(0xba)][_0x1af785(0x106)](_0x52578e=>_0x5271cf?_0x52578e:{..._0x52578e,'available':![],'reasonCode':_0x1af785(0xda)}),_0x1c00aa],'capabilities':_0x5271cf?[_0x1af785(0xd5),_0x1af785(0xd4),_0x1af785(0xc3),_0x1af785(0xe6),_0x1af785(0xa6)]:[]};}
|
|
1
|
+
const COMMON_COMMAND_DESCRIPTIONS = {
|
|
2
|
+
compact: 'Compact the current session context.',
|
|
3
|
+
plan: 'Toggle collaborative Plan Mode.',
|
|
4
|
+
mission: 'Enter persistent Mission mode.'
|
|
5
|
+
};
|
|
6
|
+
const CLAUDE_MODEL_ENVIRONMENT = {
|
|
7
|
+
opus: 'ANTHROPIC_DEFAULT_OPUS_MODEL',
|
|
8
|
+
sonnet: 'ANTHROPIC_DEFAULT_SONNET_MODEL',
|
|
9
|
+
haiku: 'ANTHROPIC_DEFAULT_HAIKU_MODEL'
|
|
10
|
+
};
|
|
11
|
+
const OFFICIAL_ANTHROPIC_HOST = 'api.anthropic.com';
|
|
12
|
+
/**
|
|
13
|
+
* Keep product-visible permission modes and slash commands in one Node-owned
|
|
14
|
+
* definition. Codex models are supplied by App Server `model/list`; Claude
|
|
15
|
+
* aliases are accepted by the Agent SDK and avoid coupling the UI to a vendor
|
|
16
|
+
* version suffix.
|
|
17
|
+
*/
|
|
18
|
+
const definitions = {
|
|
19
|
+
codex: {
|
|
20
|
+
runner: 'codex',
|
|
21
|
+
models: [],
|
|
22
|
+
accessOptions: [
|
|
23
|
+
{
|
|
24
|
+
id: 'on-request',
|
|
25
|
+
label: 'On-request',
|
|
26
|
+
description: 'Ask when additional permission is required.'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'workspace-write',
|
|
30
|
+
label: 'Workspace write',
|
|
31
|
+
description: 'Allow writes in the current Workspace.'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'full-access',
|
|
35
|
+
label: 'Full access',
|
|
36
|
+
description: 'Allow full access without individual confirmations.'
|
|
37
|
+
},
|
|
38
|
+
{ id: 'read-only', label: 'Read-only', description: 'Restrict Codex to a read-only sandbox.' }
|
|
39
|
+
],
|
|
40
|
+
commands: [
|
|
41
|
+
{
|
|
42
|
+
id: 'compact',
|
|
43
|
+
label: '/compact',
|
|
44
|
+
description: COMMON_COMMAND_DESCRIPTIONS.compact,
|
|
45
|
+
inputHint: '/compact',
|
|
46
|
+
interaction: 'IMMEDIATE_ACTION'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'plan',
|
|
50
|
+
label: '/plan',
|
|
51
|
+
stateLabel: 'Plan Mode',
|
|
52
|
+
description: COMMON_COMMAND_DESCRIPTIONS.plan,
|
|
53
|
+
inputHint: '/plan',
|
|
54
|
+
interaction: 'TOGGLE'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'fast',
|
|
58
|
+
label: '/fast',
|
|
59
|
+
description: 'Toggle the fast service tier when supported.',
|
|
60
|
+
inputHint: '/fast',
|
|
61
|
+
interaction: 'TOGGLE'
|
|
62
|
+
}
|
|
63
|
+
].map((command) => ({
|
|
64
|
+
...command,
|
|
65
|
+
runner: 'codex',
|
|
66
|
+
source: 'CODEX_APP_SERVER',
|
|
67
|
+
available: true,
|
|
68
|
+
reasonCode: null
|
|
69
|
+
}))
|
|
70
|
+
},
|
|
71
|
+
'claude-code': {
|
|
72
|
+
runner: 'claude-code',
|
|
73
|
+
models: [
|
|
74
|
+
{
|
|
75
|
+
id: 'opus',
|
|
76
|
+
label: 'Claude Opus',
|
|
77
|
+
supportedEfforts: ['low', 'medium', 'high', 'xhigh', 'max']
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'sonnet',
|
|
81
|
+
label: 'Claude Sonnet',
|
|
82
|
+
supportedEfforts: ['low', 'medium', 'high', 'xhigh', 'max']
|
|
83
|
+
},
|
|
84
|
+
{ id: 'haiku', label: 'Claude Haiku', supportedEfforts: ['low', 'medium'] }
|
|
85
|
+
],
|
|
86
|
+
accessOptions: [
|
|
87
|
+
{ id: 'default', label: 'Default', description: 'Use Claude Code default confirmations.' },
|
|
88
|
+
{
|
|
89
|
+
id: 'accept-edits',
|
|
90
|
+
label: 'Accept edits',
|
|
91
|
+
description: 'Automatically accept edits in the current Workspace.'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'bypass',
|
|
95
|
+
label: 'Bypass permissions',
|
|
96
|
+
description: 'Bypass permission confirmations.'
|
|
97
|
+
},
|
|
98
|
+
{ id: 'plan', label: 'Plan Mode', description: 'Run in Plan Mode without executing tools.' }
|
|
99
|
+
],
|
|
100
|
+
commands: [
|
|
101
|
+
{
|
|
102
|
+
id: 'compact',
|
|
103
|
+
runner: 'claude-code',
|
|
104
|
+
label: '/compact',
|
|
105
|
+
description: COMMON_COMMAND_DESCRIPTIONS.compact,
|
|
106
|
+
inputHint: '/compact',
|
|
107
|
+
source: 'CLAUDE_AGENT_SDK',
|
|
108
|
+
interaction: 'IMMEDIATE_ACTION',
|
|
109
|
+
available: true,
|
|
110
|
+
reasonCode: null
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'plan',
|
|
114
|
+
runner: 'claude-code',
|
|
115
|
+
label: '/plan',
|
|
116
|
+
stateLabel: 'Plan Mode',
|
|
117
|
+
description: COMMON_COMMAND_DESCRIPTIONS.plan,
|
|
118
|
+
inputHint: '/plan',
|
|
119
|
+
source: 'CLAUDE_AGENT_SDK',
|
|
120
|
+
interaction: 'TOGGLE',
|
|
121
|
+
available: true,
|
|
122
|
+
reasonCode: null
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
opencode: {
|
|
127
|
+
runner: 'opencode',
|
|
128
|
+
models: [],
|
|
129
|
+
accessOptions: [
|
|
130
|
+
{
|
|
131
|
+
id: 'default',
|
|
132
|
+
label: 'Default',
|
|
133
|
+
description: 'Use OpenCode and Workspace permission configuration.'
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'auto',
|
|
137
|
+
label: 'Auto approve',
|
|
138
|
+
description: 'Automatically allow requested tool permissions.'
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
commands: [
|
|
142
|
+
{
|
|
143
|
+
id: 'compact',
|
|
144
|
+
runner: 'opencode',
|
|
145
|
+
label: '/compact',
|
|
146
|
+
description: COMMON_COMMAND_DESCRIPTIONS.compact,
|
|
147
|
+
inputHint: '/compact',
|
|
148
|
+
source: 'OPENCODE_SERVER',
|
|
149
|
+
interaction: 'IMMEDIATE_ACTION',
|
|
150
|
+
available: true,
|
|
151
|
+
reasonCode: null
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'plan',
|
|
155
|
+
runner: 'opencode',
|
|
156
|
+
label: '/plan',
|
|
157
|
+
stateLabel: 'Plan Mode',
|
|
158
|
+
description: COMMON_COMMAND_DESCRIPTIONS.plan,
|
|
159
|
+
inputHint: '/plan',
|
|
160
|
+
source: 'OPENCODE_SERVER',
|
|
161
|
+
interaction: 'TOGGLE',
|
|
162
|
+
available: true,
|
|
163
|
+
reasonCode: null
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
'mar-agent': {
|
|
168
|
+
runner: 'mar-agent',
|
|
169
|
+
models: [],
|
|
170
|
+
accessOptions: [
|
|
171
|
+
{
|
|
172
|
+
id: 'on-request',
|
|
173
|
+
label: 'On-request',
|
|
174
|
+
description: 'Ask before tools with side effects. This is not an operating-system sandbox.'
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'full-access',
|
|
178
|
+
label: 'Full access',
|
|
179
|
+
description: 'Skip Agent approvals. Host validation still applies and no Agent sandbox is provided.'
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
commands: [
|
|
183
|
+
{
|
|
184
|
+
id: 'compact',
|
|
185
|
+
runner: 'mar-agent',
|
|
186
|
+
label: '/compact',
|
|
187
|
+
description: COMMON_COMMAND_DESCRIPTIONS.compact,
|
|
188
|
+
inputHint: '/compact',
|
|
189
|
+
source: 'MAR_RUNTIME',
|
|
190
|
+
interaction: 'IMMEDIATE_ACTION',
|
|
191
|
+
available: true,
|
|
192
|
+
reasonCode: null
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: 'plan',
|
|
196
|
+
runner: 'mar-agent',
|
|
197
|
+
label: '/plan',
|
|
198
|
+
stateLabel: 'Plan Mode',
|
|
199
|
+
description: COMMON_COMMAND_DESCRIPTIONS.plan,
|
|
200
|
+
inputHint: '/plan',
|
|
201
|
+
source: 'MAR_RUNTIME',
|
|
202
|
+
interaction: 'TOGGLE',
|
|
203
|
+
available: true,
|
|
204
|
+
reasonCode: null
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: 'review',
|
|
208
|
+
runner: 'mar-agent',
|
|
209
|
+
label: '/review',
|
|
210
|
+
description: 'Review the selected workspace changes without modifying files.',
|
|
211
|
+
inputHint: '/review',
|
|
212
|
+
source: 'MAR_RUNTIME',
|
|
213
|
+
interaction: 'IMMEDIATE_ACTION',
|
|
214
|
+
available: true,
|
|
215
|
+
reasonCode: null
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: 'clear',
|
|
219
|
+
runner: 'mar-agent',
|
|
220
|
+
label: '/clear',
|
|
221
|
+
description: 'Permanently clear this session history while keeping the session.',
|
|
222
|
+
inputHint: '/clear',
|
|
223
|
+
source: 'MAR_RUNTIME',
|
|
224
|
+
interaction: 'DESTRUCTIVE_ACTION',
|
|
225
|
+
available: true,
|
|
226
|
+
reasonCode: null
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
export function declaredRunnerProfiles(input) {
|
|
232
|
+
return [
|
|
233
|
+
withCapabilities(definitions.codex, input.codexAvailable),
|
|
234
|
+
withCapabilities(claudeProfile(input.environment ?? process.env), input.claudeCodeAvailable),
|
|
235
|
+
withCapabilities(definitions.opencode, input.openCodeAvailable === true)
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
export function supportsRunnerConfiguration(input) {
|
|
239
|
+
const profile = input.runner === 'claude-code'
|
|
240
|
+
? claudeProfile(input.environment ?? process.env)
|
|
241
|
+
: definitions[input.runner];
|
|
242
|
+
const model = profile.models.find((candidate) => candidate.id === input.model);
|
|
243
|
+
return (model !== undefined &&
|
|
244
|
+
model.supportedEfforts.includes(input.effort) &&
|
|
245
|
+
profile.accessOptions.some((candidate) => candidate.id === input.access));
|
|
246
|
+
}
|
|
247
|
+
export function claudeDefaultModel(environment = process.env) {
|
|
248
|
+
const sonnet = configuredClaudeModel('sonnet', environment);
|
|
249
|
+
if (sonnet !== undefined)
|
|
250
|
+
return sonnet;
|
|
251
|
+
if (usesThirdPartyEndpoint(environment)) {
|
|
252
|
+
return (configuredClaudeModel('opus', environment) ??
|
|
253
|
+
configuredClaudeModel('haiku', environment) ??
|
|
254
|
+
'sonnet');
|
|
255
|
+
}
|
|
256
|
+
return 'sonnet';
|
|
257
|
+
}
|
|
258
|
+
function claudeProfile(environment) {
|
|
259
|
+
const profile = definitions['claude-code'];
|
|
260
|
+
const thirdParty = usesThirdPartyEndpoint(environment);
|
|
261
|
+
const models = profile.models.flatMap((model) => {
|
|
262
|
+
const configured = configuredClaudeModel(model.id, environment);
|
|
263
|
+
if (configured !== undefined)
|
|
264
|
+
return [{ ...model, id: configured, label: configured }];
|
|
265
|
+
return thirdParty ? [] : [model];
|
|
266
|
+
});
|
|
267
|
+
return {
|
|
268
|
+
...profile,
|
|
269
|
+
models: models.filter((model, index) => models.findIndex((candidate) => candidate.id === model.id) === index)
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* A custom `ANTHROPIC_BASE_URL` points Claude Code at a third-party gateway
|
|
274
|
+
* where the built-in `opus`/`sonnet`/`haiku` aliases usually do not resolve;
|
|
275
|
+
* only environment-declared model names are meaningful there. Unparsable
|
|
276
|
+
* non-empty values are treated as custom endpoints.
|
|
277
|
+
*/
|
|
278
|
+
function usesThirdPartyEndpoint(environment) {
|
|
279
|
+
const raw = environment['ANTHROPIC_BASE_URL']?.trim();
|
|
280
|
+
if (raw === undefined || raw.length === 0)
|
|
281
|
+
return false;
|
|
282
|
+
try {
|
|
283
|
+
return new URL(raw).hostname.toLowerCase() !== OFFICIAL_ANTHROPIC_HOST;
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function configuredClaudeModel(alias, environment) {
|
|
290
|
+
const environmentName = CLAUDE_MODEL_ENVIRONMENT[alias];
|
|
291
|
+
return (validModelName(environmentName === undefined ? undefined : environment[environmentName]) ??
|
|
292
|
+
(alias === 'sonnet' ? validModelName(environment['ANTHROPIC_MODEL']) : undefined));
|
|
293
|
+
}
|
|
294
|
+
function validModelName(value) {
|
|
295
|
+
const normalized = value?.trim();
|
|
296
|
+
return normalized !== undefined && normalized.length > 0 && normalized.length <= 128
|
|
297
|
+
? normalized
|
|
298
|
+
: undefined;
|
|
299
|
+
}
|
|
300
|
+
function withCapabilities(profile, available) {
|
|
301
|
+
const mission = {
|
|
302
|
+
id: 'mission',
|
|
303
|
+
runner: profile.runner,
|
|
304
|
+
label: '/mission',
|
|
305
|
+
stateLabel: 'Mission',
|
|
306
|
+
description: COMMON_COMMAND_DESCRIPTIONS.mission,
|
|
307
|
+
inputHint: '/mission',
|
|
308
|
+
source: 'MAR_RUNTIME',
|
|
309
|
+
interaction: 'TOGGLE',
|
|
310
|
+
available,
|
|
311
|
+
reasonCode: available ? null : 'RUNNER_UNAVAILABLE'
|
|
312
|
+
};
|
|
313
|
+
return {
|
|
314
|
+
...profile,
|
|
315
|
+
commands: [
|
|
316
|
+
...profile.commands.map((command) => available ? command : { ...command, available: false, reasonCode: 'RUNNER_UNAVAILABLE' }),
|
|
317
|
+
mission
|
|
318
|
+
],
|
|
319
|
+
capabilities: available
|
|
320
|
+
? ['history.read', 'events.live', 'turn.start', 'turn.queue', 'turn.interrupt']
|
|
321
|
+
: []
|
|
322
|
+
};
|
|
323
|
+
}
|