@orion-agents/orion-code 0.1.0 → 0.1.2
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/README.md +107 -67
- package/README.zh-CN.md +192 -217
- package/dist/cli.js +23 -21
- package/dist/cli.js.map +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +397 -212
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/target-command.d.ts.map +1 -1
- package/dist/commands/target-command.js +43 -9
- package/dist/commands/target-command.js.map +1 -1
- package/dist/commands/types.d.ts +33 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +5 -1
- package/dist/commands/types.js.map +1 -1
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +2 -2
- package/dist/core/agent.js.map +1 -1
- package/dist/framework/external-assertion.d.ts +65 -0
- package/dist/framework/external-assertion.d.ts.map +1 -0
- package/dist/framework/external-assertion.js +571 -0
- package/dist/framework/external-assertion.js.map +1 -0
- package/dist/framework/index.d.ts +6 -4
- package/dist/framework/index.d.ts.map +1 -1
- package/dist/framework/index.js +4 -1
- package/dist/framework/index.js.map +1 -1
- package/dist/framework/query.d.ts +18 -1
- package/dist/framework/query.d.ts.map +1 -1
- package/dist/framework/query.js +65 -28
- package/dist/framework/query.js.map +1 -1
- package/dist/framework/tool-scheduler.d.ts +2 -0
- package/dist/framework/tool-scheduler.d.ts.map +1 -1
- package/dist/framework/tool-scheduler.js +23 -9
- package/dist/framework/tool-scheduler.js.map +1 -1
- package/dist/framework/tool-serializer.d.ts.map +1 -1
- package/dist/framework/tool-serializer.js +20 -4
- package/dist/framework/tool-serializer.js.map +1 -1
- package/dist/framework/tool.d.ts +11 -5
- package/dist/framework/tool.d.ts.map +1 -1
- package/dist/framework/tool.js.map +1 -1
- package/dist/harness/context-harness.d.ts.map +1 -1
- package/dist/harness/context-harness.js +4 -3
- package/dist/harness/context-harness.js.map +1 -1
- package/dist/harness/drift-guard.d.ts.map +1 -1
- package/dist/harness/drift-guard.js +14 -5
- package/dist/harness/drift-guard.js.map +1 -1
- package/dist/harness/safety.d.ts.map +1 -1
- package/dist/harness/safety.js +19 -3
- package/dist/harness/safety.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +115 -34
- package/dist/init.js.map +1 -1
- package/dist/ink-ui/screens/ReplScreen.d.ts.map +1 -1
- package/dist/ink-ui/screens/ReplScreen.js +4 -1
- package/dist/ink-ui/screens/ReplScreen.js.map +1 -1
- package/dist/memory/storage.d.ts.map +1 -1
- package/dist/memory/storage.js +1 -0
- package/dist/memory/storage.js.map +1 -1
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/memory/store.js +11 -5
- package/dist/memory/store.js.map +1 -1
- package/dist/migration/command.d.ts.map +1 -1
- package/dist/migration/command.js +6 -1
- package/dist/migration/command.js.map +1 -1
- package/dist/migration/migrate.d.ts.map +1 -1
- package/dist/migration/migrate.js +4 -1
- package/dist/migration/migrate.js.map +1 -1
- package/dist/print-ui/launch.d.ts +4 -0
- package/dist/print-ui/launch.d.ts.map +1 -1
- package/dist/print-ui/launch.js +102 -9
- package/dist/print-ui/launch.js.map +1 -1
- package/dist/product/identity.d.ts +2 -2
- package/dist/product/identity.d.ts.map +1 -1
- package/dist/product/identity.js +2 -2
- package/dist/product/identity.js.map +1 -1
- package/dist/product/index.d.ts +2 -1
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +5 -1
- package/dist/product/index.js.map +1 -1
- package/dist/product/version.d.ts +12 -0
- package/dist/product/version.d.ts.map +1 -0
- package/dist/product/version.js +31 -0
- package/dist/product/version.js.map +1 -0
- package/dist/runtime/agent-runtime-controller.d.ts +49 -0
- package/dist/runtime/agent-runtime-controller.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-controller.js +1048 -81
- package/dist/runtime/agent-runtime-controller.js.map +1 -1
- package/dist/runtime/agent-runtime-protocol.d.ts +14 -2
- package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-protocol.js +18 -0
- package/dist/runtime/agent-runtime-protocol.js.map +1 -1
- package/dist/runtime/chat-controller.d.ts +6 -0
- package/dist/runtime/chat-controller.d.ts.map +1 -1
- package/dist/runtime/chat-controller.js +226 -20
- package/dist/runtime/chat-controller.js.map +1 -1
- package/dist/runtime/goals/accounting.d.ts +28 -0
- package/dist/runtime/goals/accounting.d.ts.map +1 -1
- package/dist/runtime/goals/accounting.js +69 -0
- package/dist/runtime/goals/accounting.js.map +1 -1
- package/dist/runtime/goals/completion-audit.d.ts +13 -8
- package/dist/runtime/goals/completion-audit.d.ts.map +1 -1
- package/dist/runtime/goals/completion-audit.js +598 -16
- package/dist/runtime/goals/completion-audit.js.map +1 -1
- package/dist/runtime/goals/coordinator.d.ts +44 -5
- package/dist/runtime/goals/coordinator.d.ts.map +1 -1
- package/dist/runtime/goals/coordinator.js +1124 -58
- package/dist/runtime/goals/coordinator.js.map +1 -1
- package/dist/runtime/goals/evidence.d.ts +37 -0
- package/dist/runtime/goals/evidence.d.ts.map +1 -0
- package/dist/runtime/goals/evidence.js +300 -0
- package/dist/runtime/goals/evidence.js.map +1 -0
- package/dist/runtime/goals/presentation.d.ts +4 -0
- package/dist/runtime/goals/presentation.d.ts.map +1 -0
- package/dist/runtime/goals/presentation.js +50 -0
- package/dist/runtime/goals/presentation.js.map +1 -0
- package/dist/runtime/goals/prompt.d.ts.map +1 -1
- package/dist/runtime/goals/prompt.js +38 -8
- package/dist/runtime/goals/prompt.js.map +1 -1
- package/dist/runtime/goals/tools.d.ts +18 -1
- package/dist/runtime/goals/tools.d.ts.map +1 -1
- package/dist/runtime/goals/tools.js +308 -28
- package/dist/runtime/goals/tools.js.map +1 -1
- package/dist/runtime/goals/types.d.ts +241 -7
- package/dist/runtime/goals/types.d.ts.map +1 -1
- package/dist/runtime/goals/types.js +8 -2
- package/dist/runtime/goals/types.js.map +1 -1
- package/dist/runtime/subagents/child-executor-guard.d.ts +12 -4
- package/dist/runtime/subagents/child-executor-guard.d.ts.map +1 -1
- package/dist/runtime/subagents/child-executor-guard.js +397 -61
- package/dist/runtime/subagents/child-executor-guard.js.map +1 -1
- package/dist/runtime/subagents/presets.d.ts +4 -5
- package/dist/runtime/subagents/presets.d.ts.map +1 -1
- package/dist/runtime/subagents/presets.js +18 -33
- package/dist/runtime/subagents/presets.js.map +1 -1
- package/dist/runtime/subagents/production.d.ts +3 -1
- package/dist/runtime/subagents/production.d.ts.map +1 -1
- package/dist/runtime/subagents/production.js +37 -7
- package/dist/runtime/subagents/production.js.map +1 -1
- package/dist/runtime/subagents/runner.d.ts.map +1 -1
- package/dist/runtime/subagents/runner.js +24 -3
- package/dist/runtime/subagents/runner.js.map +1 -1
- package/dist/runtime/subagents/runtime-integration.d.ts +3 -0
- package/dist/runtime/subagents/runtime-integration.d.ts.map +1 -1
- package/dist/runtime/subagents/runtime-integration.js +18 -7
- package/dist/runtime/subagents/runtime-integration.js.map +1 -1
- package/dist/runtime/subagents/supervisor.d.ts +4 -4
- package/dist/runtime/subagents/supervisor.d.ts.map +1 -1
- package/dist/runtime/subagents/supervisor.js +39 -19
- package/dist/runtime/subagents/supervisor.js.map +1 -1
- package/dist/runtime/subagents/types.d.ts +7 -0
- package/dist/runtime/subagents/types.d.ts.map +1 -1
- package/dist/runtime/subagents/types.js +12 -1
- package/dist/runtime/subagents/types.js.map +1 -1
- package/dist/runtime/ui-events.d.ts +10 -0
- package/dist/runtime/ui-events.d.ts.map +1 -1
- package/dist/runtime/ui-events.js +5 -5
- package/dist/runtime/ui-events.js.map +1 -1
- package/dist/runtime/ui-view-model.d.ts +3 -3
- package/dist/runtime/ui-view-model.d.ts.map +1 -1
- package/dist/runtime/ui-view-model.js +11 -4
- package/dist/runtime/ui-view-model.js.map +1 -1
- package/dist/services/config.d.ts +18 -7
- package/dist/services/config.d.ts.map +1 -1
- package/dist/services/config.js +79 -57
- package/dist/services/config.js.map +1 -1
- package/dist/services/doctor.d.ts.map +1 -1
- package/dist/services/doctor.js +164 -18
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/global-config.d.ts +1 -1
- package/dist/services/global-config.d.ts.map +1 -1
- package/dist/services/goal-storage.d.ts +9 -4
- package/dist/services/goal-storage.d.ts.map +1 -1
- package/dist/services/goal-storage.js +1113 -75
- package/dist/services/goal-storage.js.map +1 -1
- package/dist/services/llm.d.ts +19 -0
- package/dist/services/llm.d.ts.map +1 -1
- package/dist/services/llm.js +153 -20
- package/dist/services/llm.js.map +1 -1
- package/dist/services/model-registry.d.ts +1 -1
- package/dist/services/model-registry.d.ts.map +1 -1
- package/dist/services/model-registry.js +69 -19
- package/dist/services/model-registry.js.map +1 -1
- package/dist/services/provider-resilience/coordinator.d.ts +2 -1
- package/dist/services/provider-resilience/coordinator.d.ts.map +1 -1
- package/dist/services/provider-resilience/coordinator.js +7 -6
- package/dist/services/provider-resilience/coordinator.js.map +1 -1
- package/dist/services/provider-resilience/error-classifier.d.ts.map +1 -1
- package/dist/services/provider-resilience/error-classifier.js +67 -17
- package/dist/services/provider-resilience/error-classifier.js.map +1 -1
- package/dist/services/provider-resilience/types.d.ts +1 -1
- package/dist/services/provider-resilience/types.d.ts.map +1 -1
- package/dist/services/provider-resilience/types.js.map +1 -1
- package/dist/services/redaction.d.ts.map +1 -1
- package/dist/services/redaction.js +9 -1
- package/dist/services/redaction.js.map +1 -1
- package/dist/services/session-storage.d.ts +12 -1
- package/dist/services/session-storage.d.ts.map +1 -1
- package/dist/services/session-storage.js +23 -7
- package/dist/services/session-storage.js.map +1 -1
- package/dist/services/storage-maintenance.d.ts +73 -3
- package/dist/services/storage-maintenance.d.ts.map +1 -1
- package/dist/services/storage-maintenance.js +771 -104
- package/dist/services/storage-maintenance.js.map +1 -1
- package/dist/services/task-manager.d.ts.map +1 -1
- package/dist/services/task-manager.js +2 -2
- package/dist/services/task-manager.js.map +1 -1
- package/dist/services/web-search-adapters.d.ts.map +1 -1
- package/dist/services/web-search-adapters.js +89 -49
- package/dist/services/web-search-adapters.js.map +1 -1
- package/dist/services/web-search-mcp.d.ts.map +1 -1
- package/dist/services/web-search-mcp.js +34 -37
- package/dist/services/web-search-mcp.js.map +1 -1
- package/dist/services/workspace-state.d.ts +4 -0
- package/dist/services/workspace-state.d.ts.map +1 -1
- package/dist/services/workspace-state.js +30 -9
- package/dist/services/workspace-state.js.map +1 -1
- package/dist/terminal-ui/completion.js +1 -1
- package/dist/terminal-ui/completion.js.map +1 -1
- package/dist/terminal-ui/launch.d.ts +3 -0
- package/dist/terminal-ui/launch.d.ts.map +1 -1
- package/dist/terminal-ui/launch.js +26 -98
- package/dist/terminal-ui/launch.js.map +1 -1
- package/dist/tools/git.d.ts.map +1 -1
- package/dist/tools/git.js +275 -27
- package/dist/tools/git.js.map +1 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +29 -10
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/mcp.d.ts.map +1 -1
- package/dist/tools/mcp.js +20 -12
- package/dist/tools/mcp.js.map +1 -1
- package/dist/tools/web.d.ts.map +1 -1
- package/dist/tools/web.js +38 -14
- package/dist/tools/web.js.map +1 -1
- package/dist/tui-ui/layout.d.ts.map +1 -1
- package/dist/tui-ui/layout.js +36 -23
- package/dist/tui-ui/layout.js.map +1 -1
- package/dist/tui-ui/pickers.d.ts.map +1 -1
- package/dist/tui-ui/pickers.js +5 -4
- package/dist/tui-ui/pickers.js.map +1 -1
- package/dist/tui-ui/runner.d.ts +1 -0
- package/dist/tui-ui/runner.d.ts.map +1 -1
- package/dist/tui-ui/runner.js +15 -17
- package/dist/tui-ui/runner.js.map +1 -1
- package/dist/tui-ui/state.d.ts +6 -0
- package/dist/tui-ui/state.d.ts.map +1 -1
- package/dist/tui-ui/state.js +61 -30
- package/dist/tui-ui/state.js.map +1 -1
- package/package.json +14 -9
package/dist/commands/index.js
CHANGED
|
@@ -30,9 +30,8 @@ const tools_1 = require("../tools");
|
|
|
30
30
|
const mcp_1 = require("../tools/mcp");
|
|
31
31
|
const session_storage_1 = require("../services/session-storage");
|
|
32
32
|
const session_index_1 = require("../services/session-index");
|
|
33
|
-
const coordinator_1 = require("../runtime/goals/coordinator");
|
|
34
33
|
const auto_compact_1 = require("../services/compact/auto-compact");
|
|
35
|
-
const
|
|
34
|
+
const coordinator_1 = require("../services/compact/coordinator");
|
|
36
35
|
const harness_1 = require("../harness");
|
|
37
36
|
const skills_1 = require("../skills");
|
|
38
37
|
const file_context_1 = require("../services/file-context");
|
|
@@ -99,10 +98,10 @@ function formatRendererStatus(ctx) {
|
|
|
99
98
|
});
|
|
100
99
|
const status = snapshot.renderer.status === 'deprecated'
|
|
101
100
|
? WARN('deprecated')
|
|
102
|
-
: snapshot.renderer.status === '
|
|
103
|
-
?
|
|
104
|
-
: snapshot.renderer.status === '
|
|
105
|
-
?
|
|
101
|
+
: snapshot.renderer.status === 'product'
|
|
102
|
+
? SUCCESS('product')
|
|
103
|
+
: snapshot.renderer.status === 'technical'
|
|
104
|
+
? DIM('technical')
|
|
106
105
|
: snapshot.renderer.status === 'non-interactive'
|
|
107
106
|
? DIM('non-interactive')
|
|
108
107
|
: DIM('custom');
|
|
@@ -169,9 +168,9 @@ function formatLoopStatsLines(stats, detail = false) {
|
|
|
169
168
|
];
|
|
170
169
|
lines.push(`Verify ${verificationParts.join(' ')}`);
|
|
171
170
|
}
|
|
172
|
-
if (typeof stats.loopBudgetMaxLlmRequests === 'number'
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
if (typeof stats.loopBudgetMaxLlmRequests === 'number' ||
|
|
172
|
+
typeof stats.loopBudgetMaxToolCalls === 'number' ||
|
|
173
|
+
typeof stats.loopBudgetMaxModelVisibleBytes === 'number') {
|
|
175
174
|
const caps = [
|
|
176
175
|
typeof stats.loopBudgetMaxLlmRequests === 'number'
|
|
177
176
|
? `${stats.llmRequests}/${stats.loopBudgetMaxLlmRequests} LLM`
|
|
@@ -247,6 +246,9 @@ function isAbortError(error, abortSignal) {
|
|
|
247
246
|
}
|
|
248
247
|
return false;
|
|
249
248
|
}
|
|
249
|
+
function hasCommandFlag(args, flag) {
|
|
250
|
+
return args.trim().split(/\s+/u).includes(flag);
|
|
251
|
+
}
|
|
250
252
|
// ============================================================================
|
|
251
253
|
// 工具参数摘要
|
|
252
254
|
// ============================================================================
|
|
@@ -254,11 +256,11 @@ function isAbortError(error, abortSignal) {
|
|
|
254
256
|
// 命令实现
|
|
255
257
|
// ============================================================================
|
|
256
258
|
let taskManager = null;
|
|
257
|
-
function showHelp() {
|
|
259
|
+
function showHelp(ctx) {
|
|
258
260
|
console.log();
|
|
259
261
|
console.log(HEADER('Commands:'));
|
|
260
262
|
console.log();
|
|
261
|
-
const visible = getVisibleCommands();
|
|
263
|
+
const visible = getVisibleCommands(ctx.uiRenderer);
|
|
262
264
|
for (const category of CATEGORY_ORDER) {
|
|
263
265
|
const items = visible.filter(cmd => commandCategory(cmd) === category);
|
|
264
266
|
if (items.length === 0)
|
|
@@ -267,8 +269,16 @@ function showHelp() {
|
|
|
267
269
|
for (const cmd of items) {
|
|
268
270
|
const aliases = cmd.aliases ? ` (${cmd.aliases.join(', ')})` : '';
|
|
269
271
|
const params = cmd.argumentHint || cmd.params?.map(p => `<${p.name}>`).join(' ') || '';
|
|
272
|
+
const lifecycle = cmd.deprecated
|
|
273
|
+
? ` deprecated since ${cmd.deprecated.since}${cmd.deprecated.replacement ? `; use ${cmd.deprecated.replacement}` : ''}`
|
|
274
|
+
: '';
|
|
275
|
+
const risk = cmd.risk === 'destructive' ? ' destructive' : '';
|
|
276
|
+
const availability = cmd.availability?.(ctx);
|
|
277
|
+
const unavailable = availability && !availability.available
|
|
278
|
+
? ` unavailable: ${availability.reason ?? 'requirements not met'}`
|
|
279
|
+
: '';
|
|
270
280
|
console.log(` ${ACCENT(`/${cmd.name}`)}${aliases} ${DIM(params)}`);
|
|
271
|
-
console.log(` ${DIM(cmd.description)}`);
|
|
281
|
+
console.log(` ${DIM(`${cmd.description}${lifecycle}${risk}${unavailable}`)}`);
|
|
272
282
|
}
|
|
273
283
|
console.log();
|
|
274
284
|
}
|
|
@@ -376,7 +386,9 @@ function formatTraceEventLine(event) {
|
|
|
376
386
|
event.providerLastRetryErrorType
|
|
377
387
|
? `last=${event.providerLastRetryErrorType}${event.providerLastRetryStatus ? `/${event.providerLastRetryStatus}` : ''}`
|
|
378
388
|
: '',
|
|
379
|
-
event.providerRetryErrorTypes?.length
|
|
389
|
+
event.providerRetryErrorTypes?.length
|
|
390
|
+
? `types=${event.providerRetryErrorTypes.join(',')}`
|
|
391
|
+
: '',
|
|
380
392
|
event.providerFinalModel ? `final=${event.providerFinalModel}` : '',
|
|
381
393
|
].filter(Boolean);
|
|
382
394
|
return `${prefix} ${parts.join(' ')}`;
|
|
@@ -384,7 +396,7 @@ function formatTraceEventLine(event) {
|
|
|
384
396
|
case 'provider_fallback': {
|
|
385
397
|
const path = event.providerFallbackFromModel && event.providerFallbackToModel
|
|
386
398
|
? `${event.providerFallbackFromModel}->${event.providerFallbackToModel}`
|
|
387
|
-
: event.providerFinalModel ?? 'active';
|
|
399
|
+
: (event.providerFinalModel ?? 'active');
|
|
388
400
|
const parts = [
|
|
389
401
|
`count=${event.providerFallbackCount ?? 0}`,
|
|
390
402
|
`path=${path}`,
|
|
@@ -454,13 +466,13 @@ function formatTraceEventLine(event) {
|
|
|
454
466
|
`llm=${typeof event.llmRequests === 'number' ? event.llmRequests : 'unknown'}`,
|
|
455
467
|
`tools=${typeof event.toolCalls === 'number' ? event.toolCalls : 'unknown'}`,
|
|
456
468
|
];
|
|
457
|
-
if (event.loopBudgetSource
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
469
|
+
if (event.loopBudgetSource ||
|
|
470
|
+
typeof event.loopBudgetMaxLlmRequests === 'number' ||
|
|
471
|
+
typeof event.loopBudgetMaxToolCalls === 'number' ||
|
|
472
|
+
typeof event.loopBudgetMaxModelVisibleBytes === 'number') {
|
|
461
473
|
const source = event.loopBudgetSource === 'config' && event.loopBudgetBaseProfile
|
|
462
474
|
? `config/${event.loopBudgetBaseProfile}`
|
|
463
|
-
: event.loopBudgetSource ?? 'unknown';
|
|
475
|
+
: (event.loopBudgetSource ?? 'unknown');
|
|
464
476
|
const caps = [
|
|
465
477
|
typeof event.loopBudgetMaxLlmRequests === 'number'
|
|
466
478
|
? `${typeof event.llmRequests === 'number' ? event.llmRequests : '?'}/${event.loopBudgetMaxLlmRequests}llm`
|
|
@@ -493,7 +505,9 @@ function formatTraceEventLine(event) {
|
|
|
493
505
|
case 'workspace_snapshot': {
|
|
494
506
|
const state = event.workspaceGitAvailable === false
|
|
495
507
|
? WARN('not-git')
|
|
496
|
-
: event.workspaceDirty
|
|
508
|
+
: event.workspaceDirty
|
|
509
|
+
? WARN('dirty')
|
|
510
|
+
: SUCCESS('clean');
|
|
497
511
|
const files = event.workspaceFiles?.length
|
|
498
512
|
? ` files=${event.workspaceFiles.slice(0, 6).join(', ')}${event.workspaceFiles.length > 6 ? ', ...' : ''}`
|
|
499
513
|
: '';
|
|
@@ -512,11 +526,21 @@ function formatTraceEventLine(event) {
|
|
|
512
526
|
`resolved=${resolved.length}`,
|
|
513
527
|
];
|
|
514
528
|
const details = [
|
|
515
|
-
added.length
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
529
|
+
added.length
|
|
530
|
+
? `new: ${added.slice(0, 6).join(', ')}${added.length > 6 ? ', ...' : ''}`
|
|
531
|
+
: '',
|
|
532
|
+
changed.length
|
|
533
|
+
? `changed: ${changed.slice(0, 6).join(', ')}${changed.length > 6 ? ', ...' : ''}`
|
|
534
|
+
: '',
|
|
535
|
+
modifiedPreExisting.length
|
|
536
|
+
? `pre-existing modified: ${modifiedPreExisting.slice(0, 6).join(', ')}${modifiedPreExisting.length > 6 ? ', ...' : ''}`
|
|
537
|
+
: '',
|
|
538
|
+
resolved.length
|
|
539
|
+
? `resolved: ${resolved.slice(0, 6).join(', ')}${resolved.length > 6 ? ', ...' : ''}`
|
|
540
|
+
: '',
|
|
541
|
+
]
|
|
542
|
+
.filter(Boolean)
|
|
543
|
+
.join(' | ');
|
|
520
544
|
return `${prefix} ${parts.join(' ')}${details ? ` ${DIM(details)}` : ''}${event.note ? ` ${DIM(event.note)}` : ''}`;
|
|
521
545
|
}
|
|
522
546
|
case 'verification_profile': {
|
|
@@ -607,7 +631,10 @@ function latestToolTrace(events) {
|
|
|
607
631
|
const call = event.type === 'tool_call'
|
|
608
632
|
? event
|
|
609
633
|
: callId
|
|
610
|
-
? events
|
|
634
|
+
? events
|
|
635
|
+
.slice(0, index)
|
|
636
|
+
.reverse()
|
|
637
|
+
.find(candidate => candidate.type === 'tool_call' && candidate.callId === callId)
|
|
611
638
|
: undefined;
|
|
612
639
|
return { call, result };
|
|
613
640
|
}
|
|
@@ -766,9 +793,7 @@ function handleLastTool(ctx, args = '') {
|
|
|
766
793
|
for (const pair of pairs.slice(-30)) {
|
|
767
794
|
const source = pair.result ?? pair.call;
|
|
768
795
|
const name = source?.name ?? 'tool';
|
|
769
|
-
const status = pair.result
|
|
770
|
-
? (pair.result.success === false ? '✗' : '✓')
|
|
771
|
-
: '…';
|
|
796
|
+
const status = pair.result ? (pair.result.success === false ? '✗' : '✓') : '…';
|
|
772
797
|
const duration = typeof pair.result?.duration === 'number'
|
|
773
798
|
? ` (${formatDurationMs(pair.result.duration)})`
|
|
774
799
|
: '';
|
|
@@ -786,7 +811,11 @@ function handleLastTool(ctx, args = '') {
|
|
|
786
811
|
const name = source?.name ?? 'tool';
|
|
787
812
|
const inputLabel = lastToolInputLabel(name);
|
|
788
813
|
const callId = source?.callId ?? call?.callId;
|
|
789
|
-
const status = result
|
|
814
|
+
const status = result
|
|
815
|
+
? result.success === false
|
|
816
|
+
? ERROR('error')
|
|
817
|
+
: SUCCESS('ok')
|
|
818
|
+
: WARN('running');
|
|
790
819
|
// Resolve sequence number from the trace events
|
|
791
820
|
let seqLabel = '';
|
|
792
821
|
if (options.ref && /^#?\d+$/.test(options.ref)) {
|
|
@@ -948,7 +977,10 @@ function handleCheckpoint(ctx, args = '') {
|
|
|
948
977
|
}
|
|
949
978
|
for (const checkpoint of checkpoints.slice(0, 20)) {
|
|
950
979
|
console.log(`${ACCENT(checkpoint.turnId)} ${DIM(formatDateTime(checkpoint.createdAt))}`);
|
|
951
|
-
const files = checkpoint.files
|
|
980
|
+
const files = checkpoint.files
|
|
981
|
+
.map(file => file.path)
|
|
982
|
+
.slice(0, 8)
|
|
983
|
+
.join(', ');
|
|
952
984
|
console.log(` ${DIM(`${checkpoint.files.length} file(s)${files ? `: ${files}` : ''}`)}`);
|
|
953
985
|
}
|
|
954
986
|
console.log();
|
|
@@ -967,9 +999,7 @@ function handleCheckpoint(ctx, args = '') {
|
|
|
967
999
|
}
|
|
968
1000
|
const { checkpoint, ambiguous } = findCheckpointByRef(ctx, ref);
|
|
969
1001
|
if (!checkpoint) {
|
|
970
|
-
console.log(ERROR(ambiguous
|
|
971
|
-
? `Checkpoint prefix is ambiguous: ${ref}`
|
|
972
|
-
: `Checkpoint not found: ${ref}`));
|
|
1002
|
+
console.log(ERROR(ambiguous ? `Checkpoint prefix is ambiguous: ${ref}` : `Checkpoint not found: ${ref}`));
|
|
973
1003
|
console.log(DIM('Run /checkpoint to list available checkpoint ids.'));
|
|
974
1004
|
return { success: false };
|
|
975
1005
|
}
|
|
@@ -1407,7 +1437,10 @@ function normalizePermissionMode(raw) {
|
|
|
1407
1437
|
const value = raw.trim().toLowerCase();
|
|
1408
1438
|
if (!value)
|
|
1409
1439
|
return null;
|
|
1410
|
-
if (value === 'accept' ||
|
|
1440
|
+
if (value === 'accept' ||
|
|
1441
|
+
value === 'acceptedits' ||
|
|
1442
|
+
value === 'accept-edits' ||
|
|
1443
|
+
value === 'edit') {
|
|
1411
1444
|
return 'acceptEdits';
|
|
1412
1445
|
}
|
|
1413
1446
|
if (value === 'default' || value === 'ask')
|
|
@@ -1435,9 +1468,7 @@ function handleMode(ctx, args) {
|
|
|
1435
1468
|
console.log();
|
|
1436
1469
|
return { success: true };
|
|
1437
1470
|
}
|
|
1438
|
-
const next = trimmed === 'next'
|
|
1439
|
-
? (0, types_1.getNextPermissionMode)(current)
|
|
1440
|
-
: normalizePermissionMode(trimmed);
|
|
1471
|
+
const next = trimmed === 'next' ? (0, types_1.getNextPermissionMode)(current) : normalizePermissionMode(trimmed);
|
|
1441
1472
|
if (!next || !types_1.PERMISSION_MODES.includes(next)) {
|
|
1442
1473
|
return {
|
|
1443
1474
|
success: false,
|
|
@@ -1471,10 +1502,14 @@ function handleTask(ctx, args) {
|
|
|
1471
1502
|
if (tasks.length > 0) {
|
|
1472
1503
|
console.log();
|
|
1473
1504
|
for (const t of tasks) {
|
|
1474
|
-
const statusIcon = t.status === 'completed'
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1505
|
+
const statusIcon = t.status === 'completed'
|
|
1506
|
+
? SUCCESS('✓')
|
|
1507
|
+
: t.status === 'failed'
|
|
1508
|
+
? ERROR('✗')
|
|
1509
|
+
: t.status === 'running'
|
|
1510
|
+
? WARN('◌')
|
|
1511
|
+
: t.status === 'cancelled'
|
|
1512
|
+
? DIM('⊘')
|
|
1478
1513
|
: DIM('○');
|
|
1479
1514
|
console.log(` ${statusIcon} ${ACCENT(t.name)} ${DIM(`(${t.id.slice(0, 8)})`)}`);
|
|
1480
1515
|
console.log(` ${DIM(`[${t.priority}]`)} ${t.description.slice(0, 60)}`);
|
|
@@ -1573,7 +1608,9 @@ async function handleChat(ctx, input) {
|
|
|
1573
1608
|
console.log();
|
|
1574
1609
|
return { success: false };
|
|
1575
1610
|
}
|
|
1576
|
-
const activeSession = ctx.getSession?.() ??
|
|
1611
|
+
const activeSession = ctx.getSession?.() ??
|
|
1612
|
+
ctx.ensureSession?.() ??
|
|
1613
|
+
(ctx.sessionId ? (0, session_storage_1.loadSessionMeta)(ctx.sessionId) : null);
|
|
1577
1614
|
const sessionId = activeSession?.id ?? ctx.sessionId;
|
|
1578
1615
|
const runtimeTools = (0, tools_1.getRuntimeTools)();
|
|
1579
1616
|
const skillResolution = (0, skills_1.resolveSkillsForTurn)({
|
|
@@ -1683,7 +1720,10 @@ async function handleChat(ctx, input) {
|
|
|
1683
1720
|
},
|
|
1684
1721
|
};
|
|
1685
1722
|
try {
|
|
1686
|
-
const messages = [
|
|
1723
|
+
const messages = [
|
|
1724
|
+
{ role: 'system', content: systemPrompt },
|
|
1725
|
+
...snapshot.conversationHistory,
|
|
1726
|
+
];
|
|
1687
1727
|
for await (const event of (0, framework_1.query)({
|
|
1688
1728
|
messages,
|
|
1689
1729
|
tools: skillResolution.tools,
|
|
@@ -1829,7 +1869,9 @@ async function handleChat(ctx, input) {
|
|
|
1829
1869
|
const stats = [
|
|
1830
1870
|
finalUsage ? `tokens: ${finalUsage.promptTokens}+${finalUsage.completionTokens}` : '',
|
|
1831
1871
|
finalModel ? finalModel : '',
|
|
1832
|
-
]
|
|
1872
|
+
]
|
|
1873
|
+
.filter(Boolean)
|
|
1874
|
+
.join(' ');
|
|
1833
1875
|
if (stats) {
|
|
1834
1876
|
writeLine(DIM(stats));
|
|
1835
1877
|
}
|
|
@@ -1865,9 +1907,10 @@ async function handleExit(ctx) {
|
|
|
1865
1907
|
}
|
|
1866
1908
|
(0, session_storage_1.endSession)(ctx.sessionId);
|
|
1867
1909
|
}
|
|
1910
|
+
ctx.requestShutdown?.('user request');
|
|
1868
1911
|
await ctx.runtime.shutdown();
|
|
1869
|
-
console.log(SUCCESS('Goodbye
|
|
1870
|
-
|
|
1912
|
+
console.log(SUCCESS('Goodbye.'));
|
|
1913
|
+
return { success: true };
|
|
1871
1914
|
}
|
|
1872
1915
|
function handleCost(ctx) {
|
|
1873
1916
|
console.log();
|
|
@@ -1971,13 +2014,13 @@ function handleSkill(ctx, args) {
|
|
|
1971
2014
|
const registry = (0, skills_1.getSkillsRegistry)();
|
|
1972
2015
|
registry.initialize();
|
|
1973
2016
|
if (!trimmed) {
|
|
1974
|
-
const names = registry
|
|
2017
|
+
const names = registry
|
|
2018
|
+
.getAllSkills()
|
|
2019
|
+
.map(skill => skill.name)
|
|
2020
|
+
.sort();
|
|
1975
2021
|
return {
|
|
1976
2022
|
success: false,
|
|
1977
|
-
error: [
|
|
1978
|
-
'Usage: /skill <name> <task>',
|
|
1979
|
-
`Loaded skills: ${names.join(', ') || 'none'}`,
|
|
1980
|
-
].join('\n'),
|
|
2023
|
+
error: ['Usage: /skill <name> <task>', `Loaded skills: ${names.join(', ') || 'none'}`].join('\n'),
|
|
1981
2024
|
};
|
|
1982
2025
|
}
|
|
1983
2026
|
const parsed = (0, skills_1.parseSkillCommandInput)(`/skill ${trimmed}`);
|
|
@@ -1990,11 +2033,13 @@ function handleSkill(ctx, args) {
|
|
|
1990
2033
|
error: `Invalid skill reference: ${parsed.skillPath}`,
|
|
1991
2034
|
};
|
|
1992
2035
|
}
|
|
1993
|
-
const skill = referencedSkill ||
|
|
1994
|
-
|
|
1995
|
-
|
|
2036
|
+
const skill = referencedSkill ||
|
|
2037
|
+
registry
|
|
2038
|
+
.getAllSkills()
|
|
2039
|
+
.find(candidate => (0, skills_1.skillActivationNames)(candidate).some(name => (0, skills_1.normalizeRequestedSkillName)(name) === requestedName));
|
|
1996
2040
|
if (!skill) {
|
|
1997
|
-
const suggestions = registry
|
|
2041
|
+
const suggestions = registry
|
|
2042
|
+
.getAllSkills()
|
|
1998
2043
|
.map(candidate => candidate.name)
|
|
1999
2044
|
.filter(name => name.includes(requestedName) || requestedName.includes(name))
|
|
2000
2045
|
.slice(0, 5);
|
|
@@ -2024,7 +2069,9 @@ function handleSkill(ctx, args) {
|
|
|
2024
2069
|
skillFile ? `SKILL.md ${skillFile}` : '',
|
|
2025
2070
|
resourceRoot ? `Root ${resourceRoot}` : '',
|
|
2026
2071
|
`Use: /skill ${usageSelector} <task>`,
|
|
2027
|
-
]
|
|
2072
|
+
]
|
|
2073
|
+
.filter(Boolean)
|
|
2074
|
+
.join('\n'),
|
|
2028
2075
|
};
|
|
2029
2076
|
}
|
|
2030
2077
|
return {
|
|
@@ -2069,36 +2116,103 @@ function handleDoctor(ctx) {
|
|
|
2069
2116
|
return { success: !(0, doctor_1.hasDoctorFailures)(report) };
|
|
2070
2117
|
}
|
|
2071
2118
|
function handleStorage(_ctx, args) {
|
|
2119
|
+
const usage = '/storage [doctor|status|repair [--dry-run|--yes] [--plan=<token>]|cleanup [--dry-run|--yes] [--plan=<token>]]';
|
|
2072
2120
|
const trimmed = args.trim();
|
|
2073
|
-
const
|
|
2121
|
+
const tokens = trimmed ? trimmed.split(/\s+/u) : [];
|
|
2122
|
+
const action = tokens[0] ?? 'doctor';
|
|
2123
|
+
const flags = tokens.slice(1);
|
|
2124
|
+
const acceptsMutationFlags = action === 'cleanup' || action === 'repair';
|
|
2125
|
+
const planFlags = flags.filter(flag => flag.startsWith('--plan='));
|
|
2126
|
+
const invalidTokens = flags.filter(flag => !acceptsMutationFlags ||
|
|
2127
|
+
(flag !== '--dry-run' && flag !== '--yes' && !flag.startsWith('--plan=')) ||
|
|
2128
|
+
(flag.startsWith('--plan=') && flag.length === '--plan='.length));
|
|
2129
|
+
if (planFlags.length > 1)
|
|
2130
|
+
invalidTokens.push(...planFlags.slice(1));
|
|
2131
|
+
if (invalidTokens.length > 0) {
|
|
2132
|
+
return {
|
|
2133
|
+
success: false,
|
|
2134
|
+
error: `Unknown /storage option: ${invalidTokens.join(', ')}. Usage: ${usage}`,
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
const confirmed = flags.includes('--yes');
|
|
2138
|
+
const explicitDryRun = flags.includes('--dry-run');
|
|
2139
|
+
const planToken = planFlags[0]?.slice('--plan='.length);
|
|
2140
|
+
const decodedPlan = planToken ? (0, storage_maintenance_1.deserializeStorageMaintenancePlan)(planToken) : undefined;
|
|
2141
|
+
if (planToken && !decodedPlan) {
|
|
2142
|
+
return { success: false, error: `Invalid or corrupted storage plan token. Usage: ${usage}` };
|
|
2143
|
+
}
|
|
2074
2144
|
if (action === 'cleanup') {
|
|
2075
|
-
|
|
2076
|
-
|
|
2145
|
+
if (decodedPlan && decodedPlan.kind !== 'cleanup') {
|
|
2146
|
+
return { success: false, error: 'The supplied storage plan is not a cleanup plan.' };
|
|
2147
|
+
}
|
|
2148
|
+
const dryRun = explicitDryRun || !confirmed;
|
|
2149
|
+
if (!dryRun && !decodedPlan) {
|
|
2150
|
+
return {
|
|
2151
|
+
success: false,
|
|
2152
|
+
error: 'Cleanup requires the exact preview plan. Run /storage cleanup first.',
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
const consumedPlan = !dryRun && planToken ? (0, storage_maintenance_1.consumeStorageMaintenancePlan)(planToken) : undefined;
|
|
2156
|
+
if (!dryRun && (!consumedPlan || consumedPlan.kind !== 'cleanup')) {
|
|
2157
|
+
return {
|
|
2158
|
+
success: false,
|
|
2159
|
+
error: 'The storage cleanup plan expired, was already used, or is not valid in this process.',
|
|
2160
|
+
};
|
|
2161
|
+
}
|
|
2162
|
+
const plan = dryRun
|
|
2163
|
+
? decodedPlan?.kind === 'cleanup'
|
|
2164
|
+
? decodedPlan.plan
|
|
2165
|
+
: (0, storage_maintenance_1.collectStorageCleanupPlan)()
|
|
2166
|
+
: consumedPlan
|
|
2167
|
+
.plan;
|
|
2168
|
+
const result = (0, storage_maintenance_1.cleanupStorage)({ dryRun }, plan);
|
|
2077
2169
|
console.log();
|
|
2078
2170
|
console.log((0, storage_maintenance_1.formatStorageCleanupResult)(result));
|
|
2171
|
+
if (dryRun) {
|
|
2172
|
+
const portablePlan = planToken ?? (0, storage_maintenance_1.serializeStorageMaintenancePlan)({ kind: 'cleanup', plan });
|
|
2173
|
+
console.log(DIM(`Preview only. Run /storage cleanup --plan=${portablePlan} --yes to apply this plan.`));
|
|
2174
|
+
}
|
|
2079
2175
|
console.log();
|
|
2080
2176
|
return { success: true };
|
|
2081
2177
|
}
|
|
2082
2178
|
if (action === 'repair') {
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
console.log(
|
|
2179
|
+
if (decodedPlan && decodedPlan.kind !== 'repair') {
|
|
2180
|
+
return { success: false, error: 'The supplied storage plan is not a repair plan.' };
|
|
2181
|
+
}
|
|
2182
|
+
const plan = decodedPlan?.kind === 'repair' ? decodedPlan.plan : (0, storage_maintenance_1.collectProjectMetadataRepairPlan)();
|
|
2183
|
+
if (explicitDryRun || !confirmed) {
|
|
2184
|
+
console.log();
|
|
2185
|
+
console.log(HEADER('Orion Code Storage Repair Preview'));
|
|
2186
|
+
console.log(DIM('─'.repeat(40)));
|
|
2187
|
+
console.log(` Repairable metadata entries ${ACCENT(String(plan.actions.length))}`);
|
|
2188
|
+
for (const action of plan.actions.slice(0, 12)) {
|
|
2189
|
+
console.log(` ${DIM('•')} ${DIM(action.metadataPath)}`);
|
|
2190
|
+
}
|
|
2191
|
+
const portablePlan = planToken ?? (0, storage_maintenance_1.serializeStorageMaintenancePlan)({ kind: 'repair', plan });
|
|
2192
|
+
console.log(DIM(` Preview only. Writable repair is disabled; /storage repair --plan=${portablePlan} --yes will fail closed.`));
|
|
2193
|
+
console.log();
|
|
2194
|
+
return { success: true };
|
|
2091
2195
|
}
|
|
2092
|
-
if (
|
|
2093
|
-
|
|
2196
|
+
if (!decodedPlan) {
|
|
2197
|
+
return {
|
|
2198
|
+
success: false,
|
|
2199
|
+
error: 'Repair requires the exact preview plan. Run /storage repair first.',
|
|
2200
|
+
};
|
|
2094
2201
|
}
|
|
2095
|
-
|
|
2096
|
-
|
|
2202
|
+
const consumedPlan = planToken ? (0, storage_maintenance_1.consumeStorageMaintenancePlan)(planToken) : undefined;
|
|
2203
|
+
if (!consumedPlan || consumedPlan.kind !== 'repair') {
|
|
2204
|
+
return {
|
|
2205
|
+
success: false,
|
|
2206
|
+
error: 'The storage repair plan expired, was already used, or is not valid in this process.',
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
const result = (0, storage_maintenance_1.repairProjectMetadata)(consumedPlan.plan);
|
|
2210
|
+
return { success: false, error: result.blockedReason };
|
|
2097
2211
|
}
|
|
2098
2212
|
if (action !== 'doctor' && action !== 'status') {
|
|
2099
2213
|
return {
|
|
2100
2214
|
success: false,
|
|
2101
|
-
error:
|
|
2215
|
+
error: `Usage: ${usage}`,
|
|
2102
2216
|
};
|
|
2103
2217
|
}
|
|
2104
2218
|
const report = (0, storage_maintenance_1.collectStorageReport)();
|
|
@@ -2107,80 +2221,6 @@ function handleStorage(_ctx, args) {
|
|
|
2107
2221
|
console.log();
|
|
2108
2222
|
return { success: true };
|
|
2109
2223
|
}
|
|
2110
|
-
function handleTarget(ctx, args) {
|
|
2111
|
-
const trimmed = args.trim();
|
|
2112
|
-
// GoalCoordinator needs projectPath + sessionId — derive from context
|
|
2113
|
-
const projectPath = ctx.cwd ?? process.cwd();
|
|
2114
|
-
const sessionId = ctx.sessionId ?? 'default';
|
|
2115
|
-
const coordinator = new coordinator_1.GoalCoordinator(projectPath, sessionId);
|
|
2116
|
-
// /target (no args) — show current goal
|
|
2117
|
-
if (!trimmed) {
|
|
2118
|
-
const snap = coordinator.snapshot();
|
|
2119
|
-
if (!snap) {
|
|
2120
|
-
console.log(chalk_1.default.gray('No goal is currently set. Use /target <objective> to create one.'));
|
|
2121
|
-
return { success: true };
|
|
2122
|
-
}
|
|
2123
|
-
console.log(chalk_1.default.bold('Goal: ') + snap.objective);
|
|
2124
|
-
console.log(chalk_1.default.gray(`Status: ${snap.status} | Continuations: ${snap.continuationCount}`));
|
|
2125
|
-
console.log(chalk_1.default.gray(`Tokens: ${snap.tokensUsed} | Time: ${snap.timeUsedMs}ms`));
|
|
2126
|
-
return { success: true };
|
|
2127
|
-
}
|
|
2128
|
-
// Sub-commands
|
|
2129
|
-
const subCommand = trimmed.split(/\s+/)[0].toLowerCase();
|
|
2130
|
-
const rest = trimmed.slice(subCommand.length).trim();
|
|
2131
|
-
switch (subCommand) {
|
|
2132
|
-
case 'pause': {
|
|
2133
|
-
const ok = coordinator.pause();
|
|
2134
|
-
console.log(ok ? chalk_1.default.yellow('Goal paused.') : chalk_1.default.red('Cannot pause.'));
|
|
2135
|
-
return { success: ok };
|
|
2136
|
-
}
|
|
2137
|
-
case 'resume': {
|
|
2138
|
-
const ok = coordinator.resume();
|
|
2139
|
-
console.log(ok ? chalk_1.default.green('Goal resumed.') : chalk_1.default.red('Cannot resume.'));
|
|
2140
|
-
return { success: ok };
|
|
2141
|
-
}
|
|
2142
|
-
case 'clear': {
|
|
2143
|
-
const ok = coordinator.clear();
|
|
2144
|
-
console.log(ok ? chalk_1.default.gray('Goal cleared.') : chalk_1.default.gray('No goal to clear.'));
|
|
2145
|
-
return { success: ok };
|
|
2146
|
-
}
|
|
2147
|
-
case 'status': {
|
|
2148
|
-
const snap = coordinator.snapshot();
|
|
2149
|
-
if (!snap) {
|
|
2150
|
-
console.log(chalk_1.default.gray('No goal set.'));
|
|
2151
|
-
return { success: true };
|
|
2152
|
-
}
|
|
2153
|
-
console.log(chalk_1.default.bold(`Status: ${snap.status}`));
|
|
2154
|
-
console.log(`Objective: ${snap.objective}`);
|
|
2155
|
-
console.log(`Continuations: ${snap.continuationCount} | Tokens: ${snap.tokensUsed}`);
|
|
2156
|
-
return { success: true };
|
|
2157
|
-
}
|
|
2158
|
-
case 'edit': {
|
|
2159
|
-
if (!rest) {
|
|
2160
|
-
console.log(chalk_1.default.red('Usage: /target edit <new objective text>'));
|
|
2161
|
-
return { success: false };
|
|
2162
|
-
}
|
|
2163
|
-
const ok = coordinator.edit(rest);
|
|
2164
|
-
console.log(ok ? chalk_1.default.green('Goal objective updated.') : chalk_1.default.red('Cannot edit.'));
|
|
2165
|
-
return { success: ok };
|
|
2166
|
-
}
|
|
2167
|
-
case 'replace': {
|
|
2168
|
-
if (!rest) {
|
|
2169
|
-
console.log(chalk_1.default.red('Usage: /target replace <new objective text>'));
|
|
2170
|
-
return { success: false };
|
|
2171
|
-
}
|
|
2172
|
-
const ok = coordinator.replace(rest);
|
|
2173
|
-
console.log(ok ? chalk_1.default.green('Goal replaced.') : chalk_1.default.red('Cannot replace.'));
|
|
2174
|
-
return { success: ok };
|
|
2175
|
-
}
|
|
2176
|
-
default: {
|
|
2177
|
-
// Treat as new objective
|
|
2178
|
-
const result = coordinator.create(trimmed);
|
|
2179
|
-
console.log(result.ok ? chalk_1.default.green('Goal created: ') + trimmed : chalk_1.default.red(result.error ?? 'Failed'));
|
|
2180
|
-
return { success: result.ok };
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
2224
|
function handleDiff(ctx, args) {
|
|
2185
2225
|
const maxFilesMatch = args.match(/--max-files(?:=|\s+)(\d+)/);
|
|
2186
2226
|
const maxFiles = maxFilesMatch ? Number(maxFilesMatch[1]) : 40;
|
|
@@ -2200,9 +2240,7 @@ function handleCommitPlan(ctx, args) {
|
|
|
2200
2240
|
return { success: plan.diff.isGitRepo };
|
|
2201
2241
|
}
|
|
2202
2242
|
function handleTools(ctx) {
|
|
2203
|
-
const tools = ctx.store.getSnapshot().tools.length > 0
|
|
2204
|
-
? ctx.store.getSnapshot().tools
|
|
2205
|
-
: (0, tools_1.getRuntimeTools)();
|
|
2243
|
+
const tools = ctx.store.getSnapshot().tools.length > 0 ? ctx.store.getSnapshot().tools : (0, tools_1.getRuntimeTools)();
|
|
2206
2244
|
const staticTools = tools.filter(tool => !tool.name.startsWith('mcp__'));
|
|
2207
2245
|
const mcpTools = tools.filter(tool => tool.name.startsWith('mcp__'));
|
|
2208
2246
|
console.log();
|
|
@@ -2235,8 +2273,10 @@ function handleTodos(ctx) {
|
|
|
2235
2273
|
return { success: true };
|
|
2236
2274
|
}
|
|
2237
2275
|
for (const todo of todos) {
|
|
2238
|
-
const marker = todo.status === 'completed'
|
|
2239
|
-
|
|
2276
|
+
const marker = todo.status === 'completed'
|
|
2277
|
+
? SUCCESS('✓')
|
|
2278
|
+
: todo.status === 'in_progress'
|
|
2279
|
+
? WARN('›')
|
|
2240
2280
|
: DIM('○');
|
|
2241
2281
|
console.log(` ${marker} ${todo.content}`);
|
|
2242
2282
|
if (todo.activeForm && todo.activeForm !== todo.content) {
|
|
@@ -2246,17 +2286,27 @@ function handleTodos(ctx) {
|
|
|
2246
2286
|
console.log();
|
|
2247
2287
|
return { success: true };
|
|
2248
2288
|
}
|
|
2249
|
-
function
|
|
2289
|
+
function handleContextClear(ctx, args) {
|
|
2250
2290
|
const history = ctx.store.getSnapshot().conversationHistory;
|
|
2251
2291
|
if (history.length === 0) {
|
|
2252
|
-
console.log(DIM('
|
|
2292
|
+
console.log(DIM('Current in-memory model context is already empty.'));
|
|
2253
2293
|
console.log();
|
|
2254
2294
|
return { success: true };
|
|
2255
2295
|
}
|
|
2296
|
+
if (!hasCommandFlag(args, '--yes')) {
|
|
2297
|
+
return {
|
|
2298
|
+
success: false,
|
|
2299
|
+
error: [
|
|
2300
|
+
`This will clear ${history.length} message(s) from the current in-memory model context.`,
|
|
2301
|
+
'Saved session history will not be deleted and can still be restored with /resume.',
|
|
2302
|
+
'Run /context-clear --yes to continue.',
|
|
2303
|
+
].join('\n'),
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2256
2306
|
ctx.store.resetConversation();
|
|
2257
2307
|
(0, framework_1.resetToolState)();
|
|
2258
|
-
console.log(SUCCESS(`✔ Cleared ${history.length} messages from
|
|
2259
|
-
console.log(DIM('
|
|
2308
|
+
console.log(SUCCESS(`✔ Cleared ${history.length} messages from current model context`));
|
|
2309
|
+
console.log(DIM(' Saved session history, configuration, and system state were preserved.'));
|
|
2260
2310
|
console.log();
|
|
2261
2311
|
return { success: true };
|
|
2262
2312
|
}
|
|
@@ -2285,13 +2335,14 @@ async function handleCompact(ctx, args) {
|
|
|
2285
2335
|
console.log(DIM((0, agent_status_1.compactStatus)()));
|
|
2286
2336
|
try {
|
|
2287
2337
|
const modelId = ctx.llm?.getModel() ?? ctx.store.getSnapshot().currentModel;
|
|
2288
|
-
const coordinator = ctx.compactCoordinator ??
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2338
|
+
const coordinator = ctx.compactCoordinator ??
|
|
2339
|
+
new coordinator_1.CompactCoordinator({
|
|
2340
|
+
modelId,
|
|
2341
|
+
llm: ctx.llm,
|
|
2342
|
+
outputReserveTokens: ctx.llm?.getMaxTokens?.(),
|
|
2343
|
+
getContextCapsule: () => ctx.store.getSnapshot().harnessState?.capsule,
|
|
2344
|
+
getHarnessState: () => ctx.store.getSnapshot().harnessState,
|
|
2345
|
+
});
|
|
2295
2346
|
coordinator.configure({
|
|
2296
2347
|
modelId,
|
|
2297
2348
|
llm: ctx.llm,
|
|
@@ -2505,9 +2556,7 @@ function handleSessions(ctx, args = '') {
|
|
|
2505
2556
|
const query = scope.query?.trim();
|
|
2506
2557
|
// If there's a search query, use the session index
|
|
2507
2558
|
if (query && !query.startsWith('--')) {
|
|
2508
|
-
const allSessions = scope.allProjects
|
|
2509
|
-
? (0, session_storage_1.listSessions)()
|
|
2510
|
-
: (0, session_storage_1.listProjectSessions)(scope.projectPath);
|
|
2559
|
+
const allSessions = scope.allProjects ? (0, session_storage_1.listSessions)() : (0, session_storage_1.listProjectSessions)(scope.projectPath);
|
|
2511
2560
|
const matchedIds = (0, session_index_1.searchSessions)(query, allSessions.map(session => ({
|
|
2512
2561
|
id: session.id,
|
|
2513
2562
|
projectPath: session.projectPath,
|
|
@@ -2524,12 +2573,18 @@ function handleSessions(ctx, args = '') {
|
|
|
2524
2573
|
}
|
|
2525
2574
|
// Rebuild session list in matched order
|
|
2526
2575
|
const sessionMap = new Map(allSessions.map(s => [s.id, s]));
|
|
2527
|
-
const matchedSessions = matchedIds
|
|
2576
|
+
const matchedSessions = matchedIds
|
|
2577
|
+
.map(id => sessionMap.get(id))
|
|
2578
|
+
.filter(Boolean);
|
|
2528
2579
|
console.log();
|
|
2529
2580
|
console.log(HEADER(`Sessions (search: "${query}") — ${matchedSessions.length} matches`));
|
|
2530
2581
|
console.log(DIM('─'.repeat(40)));
|
|
2531
2582
|
console.log();
|
|
2532
|
-
printSessionRows(matchedSessions, {
|
|
2583
|
+
printSessionRows(matchedSessions, {
|
|
2584
|
+
indexed: true,
|
|
2585
|
+
showProject: scope.allProjects,
|
|
2586
|
+
showIndexSummary: true,
|
|
2587
|
+
});
|
|
2533
2588
|
console.log();
|
|
2534
2589
|
console.log(DIM(`Searched ${allSessions.length} sessions, found ${matchedSessions.length} matches`));
|
|
2535
2590
|
console.log(DIM('Use /resume <number|session-id|name> to restore a session'));
|
|
@@ -2560,8 +2615,7 @@ function handleResume(ctx, args) {
|
|
|
2560
2615
|
const ui = commandUICapabilities(ctx);
|
|
2561
2616
|
const scope = parseSessionScopeArgs(args, ctx.cwd);
|
|
2562
2617
|
const sessionRef = scope.query;
|
|
2563
|
-
const scopedSessions = (scope.allProjects ? (0, session_storage_1.listSessions)() : (0, session_storage_1.listProjectSessions)(scope.projectPath))
|
|
2564
|
-
.filter(session => (session.messageCount ?? 0) > 0);
|
|
2618
|
+
const scopedSessions = (scope.allProjects ? (0, session_storage_1.listSessions)() : (0, session_storage_1.listProjectSessions)(scope.projectPath)).filter(session => (session.messageCount ?? 0) > 0);
|
|
2565
2619
|
if (!sessionRef) {
|
|
2566
2620
|
const lastSession = scopedSessions[0];
|
|
2567
2621
|
if (!lastSession) {
|
|
@@ -2599,14 +2653,18 @@ function handleResume(ctx, args) {
|
|
|
2599
2653
|
return restoreSession(ctx, scopedSessions[pickerIndex], false);
|
|
2600
2654
|
}
|
|
2601
2655
|
// Resume specific session
|
|
2602
|
-
const result = (0, session_storage_1.lookupSessionRef)(sessionRef, scope.projectPath, {
|
|
2656
|
+
const result = (0, session_storage_1.lookupSessionRef)(sessionRef, scope.projectPath, {
|
|
2657
|
+
allProjects: scope.allProjects,
|
|
2658
|
+
});
|
|
2603
2659
|
if (result.status === 'ambiguous') {
|
|
2604
2660
|
printSessionConflict(sessionRef, result.matches);
|
|
2605
2661
|
return { success: false };
|
|
2606
2662
|
}
|
|
2607
2663
|
if (result.status === 'not_found') {
|
|
2608
2664
|
console.log(ERROR(`Session not found: ${sessionRef}`));
|
|
2609
|
-
console.log(DIM(scope.allProjects
|
|
2665
|
+
console.log(DIM(scope.allProjects
|
|
2666
|
+
? 'Use /sessions --all to list sessions'
|
|
2667
|
+
: 'Use /sessions to list project sessions, or /resume <id> --all'));
|
|
2610
2668
|
console.log();
|
|
2611
2669
|
return { success: false };
|
|
2612
2670
|
}
|
|
@@ -2631,7 +2689,9 @@ function restoreSession(ctx, session, isLast) {
|
|
|
2631
2689
|
if (history.length > 0) {
|
|
2632
2690
|
const eventSummary = checkpoint?.summary.text ?? generateRestoredSessionEventSummary(history);
|
|
2633
2691
|
ctx.store.setState({ conversationHistory: history });
|
|
2634
|
-
ctx.store.setState({
|
|
2692
|
+
ctx.store.setState({
|
|
2693
|
+
harnessState: (0, session_storage_1.loadSessionHarnessState)(resumed.id) ?? resumed.harnessState,
|
|
2694
|
+
});
|
|
2635
2695
|
(0, framework_1.resetToolState)();
|
|
2636
2696
|
ctx.sessionRestored?.({
|
|
2637
2697
|
sessionId: resumed.id,
|
|
@@ -2709,7 +2769,9 @@ function handleSessionRename(ctx, args) {
|
|
|
2709
2769
|
console.log();
|
|
2710
2770
|
return { success: false };
|
|
2711
2771
|
}
|
|
2712
|
-
const scopedSessions = scope.allProjects
|
|
2772
|
+
const scopedSessions = scope.allProjects
|
|
2773
|
+
? (0, session_storage_1.listSessions)()
|
|
2774
|
+
: (0, session_storage_1.listProjectSessions)(scope.projectPath);
|
|
2713
2775
|
const pickerIndex = parsePickerIndex(ref, scopedSessions.length);
|
|
2714
2776
|
let session = pickerIndex !== null ? scopedSessions[pickerIndex] : null;
|
|
2715
2777
|
if (!session) {
|
|
@@ -2720,7 +2782,9 @@ function handleSessionRename(ctx, args) {
|
|
|
2720
2782
|
}
|
|
2721
2783
|
if (result.status === 'not_found') {
|
|
2722
2784
|
console.log(ERROR(`Session not found: ${ref}`));
|
|
2723
|
-
console.log(DIM(scope.allProjects
|
|
2785
|
+
console.log(DIM(scope.allProjects
|
|
2786
|
+
? 'Use /sessions --all to list sessions'
|
|
2787
|
+
: 'Use /sessions to list project sessions'));
|
|
2724
2788
|
console.log();
|
|
2725
2789
|
return { success: false };
|
|
2726
2790
|
}
|
|
@@ -2877,21 +2941,18 @@ const COMMANDS = [
|
|
|
2877
2941
|
// Coding workflows
|
|
2878
2942
|
{
|
|
2879
2943
|
name: 'target',
|
|
2944
|
+
aliases: ['goal'],
|
|
2880
2945
|
description: 'Create, view, pause, resume, or clear a persistent goal target',
|
|
2881
|
-
argumentHint: '[objective | pause | resume | clear | status | edit <text>]',
|
|
2946
|
+
argumentHint: '[objective | pause | resume | clear --yes | status | edit <text> | replace <text> | confirm <criterion-id> | budget <tokens>]',
|
|
2882
2947
|
category: 'workflow',
|
|
2883
2948
|
priority: 3,
|
|
2884
2949
|
type: 'builtin',
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
category: 'workflow',
|
|
2892
|
-
priority: 2,
|
|
2893
|
-
type: 'builtin',
|
|
2894
|
-
execute: (ctx, args) => handleTarget(ctx, args),
|
|
2950
|
+
execution: 'builtin',
|
|
2951
|
+
risk: 'state-write',
|
|
2952
|
+
execute: () => ({
|
|
2953
|
+
success: false,
|
|
2954
|
+
error: '/target must be routed through the shared AgentRuntimeController.',
|
|
2955
|
+
}),
|
|
2895
2956
|
},
|
|
2896
2957
|
{
|
|
2897
2958
|
name: 'diff',
|
|
@@ -2900,6 +2961,8 @@ const COMMANDS = [
|
|
|
2900
2961
|
category: 'workflow',
|
|
2901
2962
|
priority: 5,
|
|
2902
2963
|
type: 'builtin',
|
|
2964
|
+
execution: 'builtin',
|
|
2965
|
+
risk: 'read-only',
|
|
2903
2966
|
execute: (ctx, args) => handleDiff(ctx, args),
|
|
2904
2967
|
},
|
|
2905
2968
|
{
|
|
@@ -2909,6 +2972,8 @@ const COMMANDS = [
|
|
|
2909
2972
|
category: 'workflow',
|
|
2910
2973
|
priority: 8,
|
|
2911
2974
|
type: 'builtin',
|
|
2975
|
+
execution: 'builtin',
|
|
2976
|
+
risk: 'read-only',
|
|
2912
2977
|
execute: (ctx, args) => handleCommitPlan(ctx, args),
|
|
2913
2978
|
},
|
|
2914
2979
|
{
|
|
@@ -2918,6 +2983,8 @@ const COMMANDS = [
|
|
|
2918
2983
|
category: 'workflow',
|
|
2919
2984
|
priority: 10,
|
|
2920
2985
|
type: 'chat',
|
|
2986
|
+
execution: 'agent-workflow',
|
|
2987
|
+
risk: 'read-only',
|
|
2921
2988
|
execute: (_ctx, args) => continueAsSlashChat('review', args),
|
|
2922
2989
|
},
|
|
2923
2990
|
{
|
|
@@ -2928,6 +2995,8 @@ const COMMANDS = [
|
|
|
2928
2995
|
category: 'workflow',
|
|
2929
2996
|
priority: 20,
|
|
2930
2997
|
type: 'chat',
|
|
2998
|
+
execution: 'agent-workflow',
|
|
2999
|
+
risk: 'read-only',
|
|
2931
3000
|
execute: (_ctx, args) => continueAsSlashChat('security', args),
|
|
2932
3001
|
},
|
|
2933
3002
|
{
|
|
@@ -2938,6 +3007,8 @@ const COMMANDS = [
|
|
|
2938
3007
|
category: 'workflow',
|
|
2939
3008
|
priority: 30,
|
|
2940
3009
|
type: 'chat',
|
|
3010
|
+
execution: 'agent-workflow',
|
|
3011
|
+
risk: 'state-write',
|
|
2941
3012
|
execute: (_ctx, args) => continueAsSlashChat('test-gen', args),
|
|
2942
3013
|
},
|
|
2943
3014
|
{
|
|
@@ -2947,7 +3018,9 @@ const COMMANDS = [
|
|
|
2947
3018
|
category: 'workflow',
|
|
2948
3019
|
priority: 40,
|
|
2949
3020
|
type: 'builtin',
|
|
2950
|
-
|
|
3021
|
+
execution: 'builtin',
|
|
3022
|
+
risk: 'read-only',
|
|
3023
|
+
execute: ctx => handleTodos(ctx),
|
|
2951
3024
|
},
|
|
2952
3025
|
// Sessions and context lifecycle
|
|
2953
3026
|
{
|
|
@@ -2957,6 +3030,8 @@ const COMMANDS = [
|
|
|
2957
3030
|
category: 'session',
|
|
2958
3031
|
priority: 10,
|
|
2959
3032
|
type: 'builtin',
|
|
3033
|
+
execution: 'builtin',
|
|
3034
|
+
risk: 'state-write',
|
|
2960
3035
|
execute: (ctx, args) => handleResume(ctx, args),
|
|
2961
3036
|
},
|
|
2962
3037
|
{
|
|
@@ -2966,6 +3041,8 @@ const COMMANDS = [
|
|
|
2966
3041
|
category: 'session',
|
|
2967
3042
|
priority: 20,
|
|
2968
3043
|
type: 'builtin',
|
|
3044
|
+
execution: 'builtin',
|
|
3045
|
+
risk: 'read-only',
|
|
2969
3046
|
execute: (ctx, args) => handleSessions(ctx, args),
|
|
2970
3047
|
},
|
|
2971
3048
|
{
|
|
@@ -2976,6 +3053,8 @@ const COMMANDS = [
|
|
|
2976
3053
|
category: 'session',
|
|
2977
3054
|
priority: 30,
|
|
2978
3055
|
type: 'builtin',
|
|
3056
|
+
execution: 'builtin',
|
|
3057
|
+
risk: 'state-write',
|
|
2979
3058
|
execute: (ctx, args) => handleSessionRename(ctx, args),
|
|
2980
3059
|
},
|
|
2981
3060
|
{
|
|
@@ -2985,16 +3064,34 @@ const COMMANDS = [
|
|
|
2985
3064
|
category: 'session',
|
|
2986
3065
|
priority: 40,
|
|
2987
3066
|
type: 'builtin',
|
|
3067
|
+
execution: 'builtin',
|
|
3068
|
+
risk: 'state-write',
|
|
2988
3069
|
execute: (ctx, args) => handleCompact(ctx, args),
|
|
2989
3070
|
},
|
|
3071
|
+
{
|
|
3072
|
+
name: 'context-clear',
|
|
3073
|
+
description: 'Clear current in-memory model context; preserve saved session history',
|
|
3074
|
+
argumentHint: '--yes',
|
|
3075
|
+
category: 'session',
|
|
3076
|
+
priority: 50,
|
|
3077
|
+
type: 'builtin',
|
|
3078
|
+
execution: 'builtin',
|
|
3079
|
+
risk: 'destructive',
|
|
3080
|
+
execute: (ctx, args) => handleContextClear(ctx, args),
|
|
3081
|
+
},
|
|
2990
3082
|
{
|
|
2991
3083
|
name: 'clear-history',
|
|
2992
3084
|
aliases: ['reset'],
|
|
2993
|
-
description: '
|
|
2994
|
-
|
|
3085
|
+
description: 'Deprecated alias for clearing only the current in-memory model context',
|
|
3086
|
+
argumentHint: '--yes',
|
|
3087
|
+
category: 'legacy',
|
|
2995
3088
|
priority: 50,
|
|
2996
3089
|
type: 'builtin',
|
|
2997
|
-
|
|
3090
|
+
isHidden: true,
|
|
3091
|
+
execution: 'builtin',
|
|
3092
|
+
risk: 'destructive',
|
|
3093
|
+
deprecated: { since: 'v0.1.1', replacement: '/context-clear', removeIn: 'v0.3.0' },
|
|
3094
|
+
execute: (ctx, args) => handleContextClear(ctx, args),
|
|
2998
3095
|
},
|
|
2999
3096
|
// Harness, memory, and skills
|
|
3000
3097
|
{
|
|
@@ -3004,6 +3101,8 @@ const COMMANDS = [
|
|
|
3004
3101
|
category: 'context',
|
|
3005
3102
|
priority: 10,
|
|
3006
3103
|
type: 'builtin',
|
|
3104
|
+
execution: 'builtin',
|
|
3105
|
+
risk: 'read-only',
|
|
3007
3106
|
execute: (ctx, args) => showHarness(ctx, args),
|
|
3008
3107
|
},
|
|
3009
3108
|
{
|
|
@@ -3012,7 +3111,9 @@ const COMMANDS = [
|
|
|
3012
3111
|
category: 'context',
|
|
3013
3112
|
priority: 20,
|
|
3014
3113
|
type: 'builtin',
|
|
3015
|
-
|
|
3114
|
+
execution: 'builtin',
|
|
3115
|
+
risk: 'read-only',
|
|
3116
|
+
execute: ctx => handleSkills(ctx),
|
|
3016
3117
|
},
|
|
3017
3118
|
{
|
|
3018
3119
|
name: 'skill',
|
|
@@ -3022,6 +3123,8 @@ const COMMANDS = [
|
|
|
3022
3123
|
category: 'context',
|
|
3023
3124
|
priority: 21,
|
|
3024
3125
|
type: 'chat',
|
|
3126
|
+
execution: 'agent-workflow',
|
|
3127
|
+
risk: 'state-write',
|
|
3025
3128
|
execute: (ctx, args) => handleSkill(ctx, args),
|
|
3026
3129
|
},
|
|
3027
3130
|
{
|
|
@@ -3031,6 +3134,8 @@ const COMMANDS = [
|
|
|
3031
3134
|
category: 'context',
|
|
3032
3135
|
priority: 30,
|
|
3033
3136
|
type: 'builtin',
|
|
3137
|
+
execution: 'builtin',
|
|
3138
|
+
risk: 'state-write',
|
|
3034
3139
|
execute: (ctx, args) => handleMemory(ctx, args),
|
|
3035
3140
|
},
|
|
3036
3141
|
// Tools and safety
|
|
@@ -3041,7 +3146,9 @@ const COMMANDS = [
|
|
|
3041
3146
|
category: 'tools',
|
|
3042
3147
|
priority: 10,
|
|
3043
3148
|
type: 'builtin',
|
|
3044
|
-
|
|
3149
|
+
execution: 'builtin',
|
|
3150
|
+
risk: 'read-only',
|
|
3151
|
+
execute: ctx => handleTools(ctx),
|
|
3045
3152
|
},
|
|
3046
3153
|
{
|
|
3047
3154
|
name: 'edit-preview',
|
|
@@ -3049,7 +3156,9 @@ const COMMANDS = [
|
|
|
3049
3156
|
category: 'tools',
|
|
3050
3157
|
priority: 15,
|
|
3051
3158
|
type: 'builtin',
|
|
3052
|
-
|
|
3159
|
+
execution: 'builtin',
|
|
3160
|
+
risk: 'read-only',
|
|
3161
|
+
execute: ctx => handleEditPreview(ctx),
|
|
3053
3162
|
},
|
|
3054
3163
|
{
|
|
3055
3164
|
name: 'mcp',
|
|
@@ -3057,7 +3166,9 @@ const COMMANDS = [
|
|
|
3057
3166
|
category: 'tools',
|
|
3058
3167
|
priority: 20,
|
|
3059
3168
|
type: 'builtin',
|
|
3060
|
-
|
|
3169
|
+
execution: 'builtin',
|
|
3170
|
+
risk: 'read-only',
|
|
3171
|
+
execute: ctx => handleMcp(ctx),
|
|
3061
3172
|
},
|
|
3062
3173
|
{
|
|
3063
3174
|
name: 'safety',
|
|
@@ -3065,7 +3176,9 @@ const COMMANDS = [
|
|
|
3065
3176
|
category: 'tools',
|
|
3066
3177
|
priority: 30,
|
|
3067
3178
|
type: 'builtin',
|
|
3068
|
-
|
|
3179
|
+
execution: 'builtin',
|
|
3180
|
+
risk: 'read-only',
|
|
3181
|
+
execute: ctx => showSafety(ctx),
|
|
3069
3182
|
},
|
|
3070
3183
|
// Model and runtime configuration
|
|
3071
3184
|
{
|
|
@@ -3075,6 +3188,8 @@ const COMMANDS = [
|
|
|
3075
3188
|
category: 'model',
|
|
3076
3189
|
priority: 10,
|
|
3077
3190
|
type: 'builtin',
|
|
3191
|
+
execution: 'builtin',
|
|
3192
|
+
risk: 'state-write',
|
|
3078
3193
|
execute: (ctx, args) => handleModel(ctx, args),
|
|
3079
3194
|
},
|
|
3080
3195
|
{
|
|
@@ -3085,6 +3200,8 @@ const COMMANDS = [
|
|
|
3085
3200
|
category: 'model',
|
|
3086
3201
|
priority: 20,
|
|
3087
3202
|
type: 'builtin',
|
|
3203
|
+
execution: 'builtin',
|
|
3204
|
+
risk: 'state-write',
|
|
3088
3205
|
execute: (ctx, args) => handleMode(ctx, args),
|
|
3089
3206
|
},
|
|
3090
3207
|
{
|
|
@@ -3093,7 +3210,9 @@ const COMMANDS = [
|
|
|
3093
3210
|
category: 'model',
|
|
3094
3211
|
priority: 30,
|
|
3095
3212
|
type: 'builtin',
|
|
3096
|
-
|
|
3213
|
+
execution: 'builtin',
|
|
3214
|
+
risk: 'read-only',
|
|
3215
|
+
execute: ctx => showConfig(ctx),
|
|
3097
3216
|
},
|
|
3098
3217
|
// System commands
|
|
3099
3218
|
{
|
|
@@ -3103,7 +3222,9 @@ const COMMANDS = [
|
|
|
3103
3222
|
category: 'system',
|
|
3104
3223
|
priority: 10,
|
|
3105
3224
|
type: 'builtin',
|
|
3106
|
-
|
|
3225
|
+
execution: 'builtin',
|
|
3226
|
+
risk: 'read-only',
|
|
3227
|
+
execute: ctx => showHelp(ctx),
|
|
3107
3228
|
},
|
|
3108
3229
|
{
|
|
3109
3230
|
name: 'status',
|
|
@@ -3112,19 +3233,47 @@ const COMMANDS = [
|
|
|
3112
3233
|
category: 'system',
|
|
3113
3234
|
priority: 20,
|
|
3114
3235
|
type: 'builtin',
|
|
3115
|
-
|
|
3236
|
+
execution: 'builtin',
|
|
3237
|
+
risk: 'read-only',
|
|
3238
|
+
execute: ctx => showStatus(ctx),
|
|
3116
3239
|
},
|
|
3117
3240
|
{
|
|
3118
3241
|
name: 'clear',
|
|
3119
|
-
description: 'Clear the
|
|
3242
|
+
description: 'Clear the current view without deleting session data',
|
|
3120
3243
|
category: 'system',
|
|
3121
3244
|
priority: 30,
|
|
3122
3245
|
type: 'builtin',
|
|
3123
|
-
|
|
3124
|
-
|
|
3246
|
+
execution: 'renderer-local',
|
|
3247
|
+
risk: 'read-only',
|
|
3248
|
+
rendererScope: ['tui', 'terminal'],
|
|
3249
|
+
execute: ctx => {
|
|
3250
|
+
ctx.clearView?.();
|
|
3125
3251
|
return { success: true };
|
|
3126
3252
|
},
|
|
3127
3253
|
},
|
|
3254
|
+
{
|
|
3255
|
+
name: 'tool-output',
|
|
3256
|
+
description: 'Set the TUI tool output presentation mode',
|
|
3257
|
+
argumentHint: '[adaptive|collapsed|full]',
|
|
3258
|
+
category: 'system',
|
|
3259
|
+
priority: 32,
|
|
3260
|
+
type: 'builtin',
|
|
3261
|
+
execution: 'renderer-local',
|
|
3262
|
+
risk: 'read-only',
|
|
3263
|
+
rendererScope: ['tui'],
|
|
3264
|
+
execute: () => ({ success: true }),
|
|
3265
|
+
},
|
|
3266
|
+
{
|
|
3267
|
+
name: 'redraw',
|
|
3268
|
+
description: 'Redraw the TUI-owned live region',
|
|
3269
|
+
category: 'system',
|
|
3270
|
+
priority: 34,
|
|
3271
|
+
type: 'builtin',
|
|
3272
|
+
execution: 'renderer-local',
|
|
3273
|
+
risk: 'read-only',
|
|
3274
|
+
rendererScope: ['tui'],
|
|
3275
|
+
execute: () => ({ success: true }),
|
|
3276
|
+
},
|
|
3128
3277
|
{
|
|
3129
3278
|
name: 'exit',
|
|
3130
3279
|
aliases: ['quit', 'q'],
|
|
@@ -3132,7 +3281,9 @@ const COMMANDS = [
|
|
|
3132
3281
|
category: 'system',
|
|
3133
3282
|
priority: 40,
|
|
3134
3283
|
type: 'builtin',
|
|
3135
|
-
|
|
3284
|
+
execution: 'builtin',
|
|
3285
|
+
risk: 'state-write',
|
|
3286
|
+
execute: ctx => handleExit(ctx),
|
|
3136
3287
|
},
|
|
3137
3288
|
// Diagnostics
|
|
3138
3289
|
{
|
|
@@ -3142,15 +3293,19 @@ const COMMANDS = [
|
|
|
3142
3293
|
category: 'diagnostics',
|
|
3143
3294
|
priority: 5,
|
|
3144
3295
|
type: 'builtin',
|
|
3145
|
-
|
|
3296
|
+
execution: 'builtin',
|
|
3297
|
+
risk: 'read-only',
|
|
3298
|
+
execute: ctx => handleDoctor(ctx),
|
|
3146
3299
|
},
|
|
3147
3300
|
{
|
|
3148
3301
|
name: 'storage',
|
|
3149
3302
|
description: 'Inspect, repair, or clean Orion Code storage layout',
|
|
3150
|
-
argumentHint: '[doctor|repair|cleanup --dry-run]',
|
|
3303
|
+
argumentHint: '[doctor|repair [--dry-run|--yes] [--plan=<token>]|cleanup [--dry-run|--yes] [--plan=<token>]]',
|
|
3151
3304
|
category: 'diagnostics',
|
|
3152
3305
|
priority: 8,
|
|
3153
3306
|
type: 'builtin',
|
|
3307
|
+
execution: 'builtin',
|
|
3308
|
+
risk: 'destructive',
|
|
3154
3309
|
execute: (ctx, args) => handleStorage(ctx, args),
|
|
3155
3310
|
},
|
|
3156
3311
|
{
|
|
@@ -3160,7 +3315,9 @@ const COMMANDS = [
|
|
|
3160
3315
|
category: 'diagnostics',
|
|
3161
3316
|
priority: 10,
|
|
3162
3317
|
type: 'builtin',
|
|
3163
|
-
|
|
3318
|
+
execution: 'builtin',
|
|
3319
|
+
risk: 'read-only',
|
|
3320
|
+
execute: ctx => handleUsage(ctx),
|
|
3164
3321
|
},
|
|
3165
3322
|
{
|
|
3166
3323
|
name: 'loop-stats',
|
|
@@ -3169,7 +3326,9 @@ const COMMANDS = [
|
|
|
3169
3326
|
category: 'diagnostics',
|
|
3170
3327
|
priority: 12,
|
|
3171
3328
|
type: 'builtin',
|
|
3172
|
-
|
|
3329
|
+
execution: 'builtin',
|
|
3330
|
+
risk: 'read-only',
|
|
3331
|
+
execute: ctx => handleLoopStats(ctx),
|
|
3173
3332
|
},
|
|
3174
3333
|
{
|
|
3175
3334
|
name: 'trace',
|
|
@@ -3178,6 +3337,8 @@ const COMMANDS = [
|
|
|
3178
3337
|
category: 'diagnostics',
|
|
3179
3338
|
priority: 14,
|
|
3180
3339
|
type: 'builtin',
|
|
3340
|
+
execution: 'builtin',
|
|
3341
|
+
risk: 'read-only',
|
|
3181
3342
|
execute: (ctx, args) => handleTrace(ctx, args),
|
|
3182
3343
|
},
|
|
3183
3344
|
{
|
|
@@ -3187,6 +3348,8 @@ const COMMANDS = [
|
|
|
3187
3348
|
category: 'diagnostics',
|
|
3188
3349
|
priority: 15,
|
|
3189
3350
|
type: 'builtin',
|
|
3351
|
+
execution: 'builtin',
|
|
3352
|
+
risk: 'read-only',
|
|
3190
3353
|
execute: (ctx, args) => handleLastTool(ctx, args),
|
|
3191
3354
|
},
|
|
3192
3355
|
{
|
|
@@ -3197,6 +3360,8 @@ const COMMANDS = [
|
|
|
3197
3360
|
category: 'diagnostics',
|
|
3198
3361
|
priority: 16,
|
|
3199
3362
|
type: 'builtin',
|
|
3363
|
+
execution: 'builtin',
|
|
3364
|
+
risk: 'read-only',
|
|
3200
3365
|
execute: (ctx, args) => handleArtifacts(ctx, args),
|
|
3201
3366
|
},
|
|
3202
3367
|
{
|
|
@@ -3207,6 +3372,8 @@ const COMMANDS = [
|
|
|
3207
3372
|
category: 'diagnostics',
|
|
3208
3373
|
priority: 18,
|
|
3209
3374
|
type: 'builtin',
|
|
3375
|
+
execution: 'builtin',
|
|
3376
|
+
risk: 'destructive',
|
|
3210
3377
|
execute: (ctx, args) => handleCheckpoint(ctx, args),
|
|
3211
3378
|
},
|
|
3212
3379
|
{
|
|
@@ -3215,7 +3382,10 @@ const COMMANDS = [
|
|
|
3215
3382
|
category: 'diagnostics',
|
|
3216
3383
|
priority: 20,
|
|
3217
3384
|
type: 'builtin',
|
|
3218
|
-
|
|
3385
|
+
execution: 'builtin',
|
|
3386
|
+
risk: 'read-only',
|
|
3387
|
+
deprecated: { since: 'v0.1.1', replacement: '/usage', removeIn: 'v0.3.0' },
|
|
3388
|
+
execute: ctx => handleCost(ctx),
|
|
3219
3389
|
},
|
|
3220
3390
|
{
|
|
3221
3391
|
name: 'agents',
|
|
@@ -3223,18 +3393,23 @@ const COMMANDS = [
|
|
|
3223
3393
|
category: 'diagnostics',
|
|
3224
3394
|
priority: 30,
|
|
3225
3395
|
type: 'builtin',
|
|
3226
|
-
|
|
3396
|
+
execution: 'builtin',
|
|
3397
|
+
risk: 'read-only',
|
|
3398
|
+
isHidden: true,
|
|
3399
|
+
execute: ctx => showAgents(ctx),
|
|
3227
3400
|
},
|
|
3228
3401
|
{
|
|
3229
3402
|
name: 'migrate',
|
|
3230
3403
|
description: 'Migrate data from OpenHorse to Orion Code',
|
|
3231
|
-
argumentHint: 'openhorse [--dry-run] [--include-env] [--include-project-files]',
|
|
3404
|
+
argumentHint: 'openhorse [--dry-run | --yes] [--include-env] [--include-project-files]',
|
|
3232
3405
|
category: 'diagnostics',
|
|
3233
3406
|
priority: 32,
|
|
3234
3407
|
type: 'builtin',
|
|
3408
|
+
execution: 'builtin',
|
|
3409
|
+
risk: 'destructive',
|
|
3235
3410
|
execute: (ctx, args) => (0, command_1.handleMigrateCommand)(ctx, args),
|
|
3236
3411
|
},
|
|
3237
|
-
// Legacy commands kept executable for compatibility, but not shown in
|
|
3412
|
+
// Legacy commands kept executable for compatibility, but not shown in help/palette.
|
|
3238
3413
|
{
|
|
3239
3414
|
name: 'task',
|
|
3240
3415
|
description: 'Submit or list tasks',
|
|
@@ -3242,6 +3417,9 @@ const COMMANDS = [
|
|
|
3242
3417
|
category: 'legacy',
|
|
3243
3418
|
type: 'builtin',
|
|
3244
3419
|
isHidden: true,
|
|
3420
|
+
execution: 'builtin',
|
|
3421
|
+
risk: 'state-write',
|
|
3422
|
+
deprecated: { since: 'v0.1.1', replacement: '/target', removeIn: 'v0.3.0' },
|
|
3245
3423
|
execute: (ctx, args) => handleTask(ctx, args),
|
|
3246
3424
|
},
|
|
3247
3425
|
{
|
|
@@ -3251,6 +3429,9 @@ const COMMANDS = [
|
|
|
3251
3429
|
category: 'legacy',
|
|
3252
3430
|
type: 'builtin',
|
|
3253
3431
|
isHidden: true,
|
|
3432
|
+
execution: 'agent-workflow',
|
|
3433
|
+
risk: 'state-write',
|
|
3434
|
+
deprecated: { since: 'v0.1.1', replacement: '/target', removeIn: 'v0.3.0' },
|
|
3254
3435
|
execute: (ctx, args) => handleRun(ctx, args),
|
|
3255
3436
|
},
|
|
3256
3437
|
{
|
|
@@ -3260,6 +3441,9 @@ const COMMANDS = [
|
|
|
3260
3441
|
category: 'legacy',
|
|
3261
3442
|
type: 'chat',
|
|
3262
3443
|
isHidden: true,
|
|
3444
|
+
execution: 'agent-workflow',
|
|
3445
|
+
risk: 'state-write',
|
|
3446
|
+
deprecated: { since: 'v0.1.1', removeIn: 'v0.3.0' },
|
|
3263
3447
|
execute: (ctx, args) => ({ success: true, continueAsChat: true, chatInput: args }),
|
|
3264
3448
|
},
|
|
3265
3449
|
];
|
|
@@ -3269,8 +3453,9 @@ const COMMANDS = [
|
|
|
3269
3453
|
function getCommands() {
|
|
3270
3454
|
return sortCommands(COMMANDS);
|
|
3271
3455
|
}
|
|
3272
|
-
function getVisibleCommands() {
|
|
3273
|
-
return sortCommands(COMMANDS.filter(command => !command.isHidden
|
|
3456
|
+
function getVisibleCommands(renderer) {
|
|
3457
|
+
return sortCommands(COMMANDS.filter(command => !command.isHidden &&
|
|
3458
|
+
(!renderer || !command.rendererScope || command.rendererScope.includes(renderer))));
|
|
3274
3459
|
}
|
|
3275
3460
|
function findCommand(name) {
|
|
3276
3461
|
return COMMANDS.find(c => c.name === name || c.aliases?.includes(name));
|