@orion-agents/orion-code 0.4.4 → 0.4.6

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +4 -4
  3. package/README.zh-CN.md +4 -4
  4. package/dist/commands/context-commands.js +16 -28
  5. package/dist/commands/context-tool-command-handlers.d.ts +2 -3
  6. package/dist/commands/context-tool-command-handlers.js +2 -20
  7. package/dist/commands/registry.js +24 -61
  8. package/dist/commands/retired-commands.d.ts +2 -0
  9. package/dist/commands/retired-commands.js +24 -0
  10. package/dist/commands/session-command-handlers.d.ts +3 -2
  11. package/dist/commands/session-command-handlers.js +41 -42
  12. package/dist/commands/session-commands.js +21 -0
  13. package/dist/commands/system-commands.js +2 -27
  14. package/dist/commands/tool-commands.js +0 -10
  15. package/dist/commands/types.d.ts +6 -4
  16. package/dist/commands/workflow-commands.js +0 -24
  17. package/dist/core/tool-artifacts.js +17 -4
  18. package/dist/framework/query.js +151 -17
  19. package/dist/framework/tool-state.d.ts +4 -0
  20. package/dist/harness/context-harness.d.ts +7 -3
  21. package/dist/harness/context-harness.js +222 -48
  22. package/dist/harness/contract.js +3 -1
  23. package/dist/harness/drift-guard.js +67 -17
  24. package/dist/harness/goal-verification.d.ts +11 -0
  25. package/dist/harness/goal-verification.js +62 -0
  26. package/dist/harness/ledger.js +16 -3
  27. package/dist/harness/state.js +3 -0
  28. package/dist/harness/stop-controller.js +1 -1
  29. package/dist/harness/task-checklist.d.ts +11 -1
  30. package/dist/harness/task-checklist.js +48 -4
  31. package/dist/harness/types.d.ts +10 -0
  32. package/dist/harness/verification.d.ts +11 -1
  33. package/dist/harness/verification.js +47 -2
  34. package/dist/runtime/agent-loop.js +4 -1
  35. package/dist/runtime/agent-runtime-controller.d.ts +4 -2
  36. package/dist/runtime/agent-runtime-controller.js +115 -30
  37. package/dist/runtime/batch-read-service.js +21 -4
  38. package/dist/runtime/goal-runtime-coordinator.js +1 -0
  39. package/dist/runtime/orion-session-runner.js +3 -5
  40. package/dist/runtime/product-bootstrap.js +24 -11
  41. package/dist/runtime/product-orion-runtime.js +24 -2
  42. package/dist/runtime/task-context-recovery.js +21 -5
  43. package/dist/runtime/task-context-service.d.ts +3 -1
  44. package/dist/runtime/task-context-service.js +3 -0
  45. package/dist/runtime/ui-events.d.ts +4 -1
  46. package/dist/runtime/ui-view-model.js +7 -3
  47. package/dist/runtime/workspace-verification.d.ts +2 -2
  48. package/dist/runtime/workspace-verification.js +24 -9
  49. package/dist/services/chat-completion-sse.d.ts +9 -0
  50. package/dist/services/chat-completion-sse.js +50 -0
  51. package/dist/services/compact/summary-generator.d.ts +1 -1
  52. package/dist/services/compact/summary-generator.js +12 -0
  53. package/dist/services/llm.d.ts +1 -1
  54. package/dist/services/llm.js +165 -292
  55. package/dist/services/provider-diagnostics.d.ts +1 -1
  56. package/dist/services/provider-diagnostics.js +7 -2
  57. package/dist/services/provider-resilience/error-classifier.d.ts +3 -0
  58. package/dist/services/provider-resilience/error-classifier.js +14 -0
  59. package/dist/skills/builtin/security-check/SKILL.md +2 -2
  60. package/dist/skills/builtin/test-gen/SKILL.md +2 -2
  61. package/dist/terminal-ui/launch.js +1 -1
  62. package/dist/tools/core/common.d.ts +0 -11
  63. package/dist/tools/core/common.js +0 -18
  64. package/dist/tools/core/edit-file.js +57 -86
  65. package/dist/tools/core/exec-command.js +61 -80
  66. package/dist/tools/core/grep.js +84 -24
  67. package/dist/tools/core/read-file.js +3 -2
  68. package/dist/tools/todo.d.ts +2 -2
  69. package/dist/tools/todo.js +13 -10
  70. package/dist/tui-ui/launch.js +4 -1
  71. package/dist/tui-ui/layout.d.ts +2 -2
  72. package/dist/tui-ui/layout.js +59 -47
  73. package/dist/tui-ui/pickers.d.ts +3 -1
  74. package/dist/tui-ui/pickers.js +17 -11
  75. package/dist/tui-ui/runner.d.ts +1 -1
  76. package/dist/tui-ui/runner.js +61 -68
  77. package/dist/tui-ui/state.d.ts +4 -0
  78. package/dist/tui-ui/state.js +33 -2
  79. package/dist/utils/utf8.d.ts +6 -0
  80. package/dist/utils/utf8.js +14 -0
  81. package/docs/cli-guide.md +27 -3
  82. package/npm-shrinkwrap.json +2 -2
  83. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -22,6 +22,21 @@ which is **not** a pass.
22
22
 
23
23
  ## [Unreleased]
24
24
 
25
+ ## [0.4.6] — UNRELEASED
26
+
27
+ - Keep the transcript, status, and composer in place when opening or closing slash command and file suggestions in the TUI.
28
+ - Match slash commands by name or alias. Tab completes the name while preserving arguments, and Esc closes the picker without clearing the draft.
29
+ - Add `/new` for a separate session and `/rename` for the active session. Use `/resume` to reopen saved sessions.
30
+ - Use `/quit` and `/memories` in the command picker. Consolidate retired commands into existing shortcuts, diagnostics, and skill entry points.
31
+
32
+ ## [0.4.5] — UNRELEASED
33
+
34
+ - Recover stale checklist entries and keep path-scoped writes and verification separately accountable (#388, #389, #391, #392).
35
+ - Tie staged checks to Git index content, identify the exact failed check, and avoid repeating repair feedback for an unchanged failure (#390, #393, #402).
36
+ - Persist explicit live corrections to a Goal's required verification across turns and process restarts (#401).
37
+ - Fix fuzzy edit placement, retain failed command output, count actual grep matches, preserve bounded batch results, and report MCP tool failures (#394–#398).
38
+ - Detect incomplete provider streams and use deterministic fallback when a context summary is incomplete (#399, #400).
39
+
25
40
  ## [0.4.4] — UNRELEASED
26
41
 
27
42
  - Invalidate verification after shell or external edits. A matching fresh check is required to complete the task (#372).
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Local-first, goal-driven coding agent for the terminal (CLI/TUI).
4
4
 
5
- > v0.4.4 is a candidate for Goal recovery and Harness evidence fixes.
5
+ > v0.4.6 is a candidate for faster TUI command navigation and clearer session commands.
6
6
  > Web Workbench and desktop product surfaces are retired. Configuration is `orion.yaml`;
7
7
  > old-version data compatibility and migration are not part of this release.
8
8
  > A version number or local installation is not proof of release qualification or npm publication.
@@ -30,7 +30,7 @@ The exact package qualification floors are 22.12.0 / 24.0.0 / 26.0.0.
30
30
  Install a local candidate from the exact tested tarball, substituting its actual path:
31
31
 
32
32
  ```bash
33
- npm install -g /absolute/path/orion-agents-orion-code-0.4.4.tgz
33
+ npm install -g /absolute/path/orion-agents-orion-code-0.4.6.tgz
34
34
  orion --version
35
35
  orion doctor
36
36
  ```
@@ -38,7 +38,7 @@ orion doctor
38
38
  Only after npm publication has been separately verified, use the pinned registry install:
39
39
 
40
40
  ```bash
41
- npm install -g @orion-agents/orion-code@0.4.4
41
+ npm install -g @orion-agents/orion-code@0.4.6
42
42
  ```
43
43
 
44
44
  From a checkout of the candidate branch:
@@ -108,7 +108,7 @@ npm run format:check
108
108
  npm run build
109
109
  npm run test:coverage -- --runInBand
110
110
  npm run test:harness-confluence
111
- npm run release:check -- --expected-version 0.4.4
111
+ npm run release:check -- --expected-version 0.4.6
112
112
  ```
113
113
 
114
114
  Qualification binds one exact tarball's SHA-256 and source identity to installed CLI, TUI, terminal,
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  面向终端、本地优先的目标驱动 Coding Agent(CLI/TUI)。
4
4
 
5
- > v0.4.4 是 Goal 续跑与 Harness 证据修复的候选版本。
5
+ > v0.4.6 是优化 TUI 命令导航与会话操作的候选版本。
6
6
  > Web Workbench 与桌面产品链已退役,全局配置统一为 `orion.yaml`。
7
7
  > 源码版本号、本地可运行、候选包验收与 npm 发布分别记录,不互相替代。
8
8
 
@@ -28,7 +28,7 @@
28
28
  本地候选使用实际被测的同一包安装,请替换为实际路径:
29
29
 
30
30
  ```bash
31
- npm install -g /absolute/path/orion-agents-orion-code-0.4.4.tgz
31
+ npm install -g /absolute/path/orion-agents-orion-code-0.4.6.tgz
32
32
  orion --version
33
33
  orion doctor
34
34
  ```
@@ -36,7 +36,7 @@ orion doctor
36
36
  仅在另行确认 npm 已发布后,固定 registry 版本安装:
37
37
 
38
38
  ```bash
39
- npm install -g @orion-agents/orion-code@0.4.4
39
+ npm install -g @orion-agents/orion-code@0.4.6
40
40
  ```
41
41
 
42
42
  从候选分支源码运行:
@@ -104,7 +104,7 @@ npm run format:check
104
104
  npm run build
105
105
  npm run test:coverage -- --runInBand
106
106
  npm run test:harness-confluence
107
- npm run release:check -- --expected-version 0.4.4
107
+ npm run release:check -- --expected-version 0.4.6
108
108
  ```
109
109
 
110
110
  准出需绑定同一 tarball 的 SHA-256 与源码身份,在三个 Node floor 验证安装后的 CLI、TUI、
@@ -2,48 +2,35 @@
2
2
  /** Command definitions extracted from the stable slash-command registry. */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.CONTEXT_COMMANDS = void 0;
5
+ const retired_commands_1 = require("./retired-commands");
5
6
  const context_tool_command_handlers_1 = require("./context-tool-command-handlers");
6
- const session_command_handlers_1 = require("./session-command-handlers");
7
7
  exports.CONTEXT_COMMANDS = [
8
8
  {
9
9
  name: 'context',
10
- description: 'Show diagnostics or clear only in-memory model context with confirmation',
11
- argumentHint: '[show|harness|explain [--json]|clear --yes]',
10
+ description: 'Show context usage or explain harness diagnostics',
11
+ argumentHint: '[show|explain [--json]]',
12
12
  category: 'context',
13
13
  priority: 5,
14
14
  type: 'builtin',
15
15
  execution: 'builtin',
16
- risk: 'destructive',
16
+ risk: 'read-only',
17
17
  execute: (ctx, args) => {
18
- const trimmed = args.trim();
19
- if (!trimmed || trimmed === 'show' || trimmed === 'harness')
20
- return (0, context_tool_command_handlers_1.showHarness)(ctx, '');
21
- if (trimmed === 'explain' || trimmed.startsWith('explain ')) {
22
- return (0, context_tool_command_handlers_1.showHarness)(ctx, trimmed);
23
- }
24
- if (trimmed === 'harness explain' || trimmed.startsWith('harness explain ')) {
25
- return (0, context_tool_command_handlers_1.showHarness)(ctx, trimmed.slice('harness '.length));
26
- }
27
- if (trimmed.startsWith('clear')) {
28
- return (0, session_command_handlers_1.handleContextClear)(ctx, trimmed.slice('clear'.length).trim());
18
+ const [subcommand = 'show', ...options] = args
19
+ .trim()
20
+ .toLowerCase()
21
+ .split(/\s+/u)
22
+ .filter(Boolean);
23
+ if (subcommand === 'show' && options.length === 0)
24
+ return (0, context_tool_command_handlers_1.showHarness)(ctx, 'show');
25
+ if (subcommand === 'explain' && (options.length === 0 || options.join(' ') === '--json')) {
26
+ return (0, context_tool_command_handlers_1.showHarness)(ctx, 'explain', options.length > 0);
29
27
  }
30
28
  return {
31
29
  success: false,
32
- error: 'Usage: /context [show|harness|explain [--json]|clear --yes]',
30
+ error: (0, retired_commands_1.retiredCommandNotice)('context', args.trim()) ?? 'Usage: /context [show|explain [--json]]',
33
31
  };
34
32
  },
35
33
  },
36
- {
37
- name: 'harness',
38
- description: 'Explain the live v0.2 runtime, capability, Skill, MCP, and compact state',
39
- argumentHint: '[explain [--json]]',
40
- category: 'context',
41
- priority: 10,
42
- type: 'builtin',
43
- execution: 'builtin',
44
- risk: 'read-only',
45
- execute: (ctx, args) => (0, context_tool_command_handlers_1.showHarness)(ctx, args),
46
- },
47
34
  {
48
35
  name: 'skills',
49
36
  description: 'List loaded skills (built-in / user / project)',
@@ -67,7 +54,8 @@ exports.CONTEXT_COMMANDS = [
67
54
  execute: (ctx, args) => (0, context_tool_command_handlers_1.handleSkill)(ctx, args),
68
55
  },
69
56
  {
70
- name: 'memory',
57
+ name: 'memories',
58
+ aliases: ['memory'],
71
59
  description: 'Show memory status, validate references, or rebuild the semantic index',
72
60
  argumentHint: '[validate|reindex]',
73
61
  category: 'context',
@@ -1,12 +1,11 @@
1
1
  /** Handler implementations for the context-tool-command-handlers boundary. */
2
2
  import { type CommandContext, type CommandResult } from './types';
3
3
  declare function handleMemory(ctx: CommandContext, args: string): Promise<CommandResult>;
4
- declare function showSafety(): CommandResult;
5
- declare function showHarness(ctx: CommandContext, args?: string): Promise<CommandResult>;
4
+ declare function showHarness(ctx: CommandContext, mode: 'show' | 'explain', json?: boolean): Promise<CommandResult>;
6
5
  declare function handleSkills(ctx: CommandContext): Promise<CommandResult>;
7
6
  declare function handleSkill(_ctx: CommandContext, args: string): CommandResult;
8
7
  declare function handleMcp(_ctx: CommandContext): CommandResult;
9
8
  declare function handleTools(ctx: CommandContext): CommandResult;
10
9
  declare function handleTodos(ctx: CommandContext): CommandResult;
11
- export { handleTodos, showHarness, handleSkills, handleSkill, handleMemory, handleTools, handleMcp, showSafety, };
10
+ export { handleTodos, showHarness, handleSkills, handleSkill, handleMemory, handleTools, handleMcp, };
12
11
  //# sourceMappingURL=context-tool-command-handlers.d.ts.map
@@ -11,7 +11,6 @@ exports.handleSkill = handleSkill;
11
11
  exports.handleMemory = handleMemory;
12
12
  exports.handleTools = handleTools;
13
13
  exports.handleMcp = handleMcp;
14
- exports.showSafety = showSafety;
15
14
  const chalk_1 = __importDefault(require("chalk"));
16
15
  const errors_1 = require("../utils/errors");
17
16
  const session_storage_1 = require("../services/session-storage");
@@ -129,18 +128,6 @@ async function handleMemory(ctx, args) {
129
128
  }
130
129
  return showMemory(ctx);
131
130
  }
132
- function showSafety() {
133
- console.log();
134
- console.log(HEADER('Safety Checker'));
135
- console.log(DIM('─'.repeat(40)));
136
- console.log();
137
- console.log(` Boundary ${SUCCESS('ToolGateway')}`);
138
- console.log(' Tools enabled by default');
139
- console.log(` Approval independent from sandbox enforcement`);
140
- console.log(` Mode BUILD / PLAN / AUTO never changes containment`);
141
- console.log();
142
- return { success: true };
143
- }
144
131
  function renderRuntimeHarnessDiagnostics(output, diagnostics) {
145
132
  const shortDigest = (value) => value === 'unavailable' ? value : value.slice(0, 12);
146
133
  output.log();
@@ -199,7 +186,7 @@ function renderRuntimeHarnessDiagnostics(output, diagnostics) {
199
186
  output.log(` Stop ${diagnostics.latest.stopDecision ? JSON.stringify(diagnostics.latest.stopDecision) : 'none'}`);
200
187
  output.log();
201
188
  }
202
- async function showHarness(ctx, args = '') {
189
+ async function showHarness(ctx, mode, json = false) {
203
190
  const lines = [];
204
191
  const console = {
205
192
  log: (...values) => {
@@ -207,12 +194,7 @@ async function showHarness(ctx, args = '') {
207
194
  },
208
195
  };
209
196
  const result = () => ({ success: true, output: lines.join('\n') });
210
- const tokens = args.trim().toLowerCase().split(/\s+/u).filter(Boolean);
211
- const explain = tokens[0] === 'explain';
212
- const json = tokens.includes('--json');
213
- if (tokens.some(token => token !== 'explain' && token !== '--json')) {
214
- return { success: false, error: 'Usage: /harness [explain [--json]]' };
215
- }
197
+ const explain = mode === 'explain';
216
198
  if (explain && ctx.getHarnessDiagnostics) {
217
199
  try {
218
200
  const diagnostics = await ctx.getHarnessDiagnostics();
@@ -9,7 +9,6 @@ const raw = (subcommands) => ({
9
9
  });
10
10
  const none = () => ({ kind: 'none', opaqueTail: false });
11
11
  const stable = (since = 'v0.1.5') => ({ status: 'stable', since });
12
- const internal = () => ({ status: 'internal', since: 'v0.1.5' });
13
12
  /**
14
13
  * Explicit migration manifest for every built-in root. Adding a command without
15
14
  * metadata fails during module initialization instead of silently inheriting a
@@ -70,24 +69,6 @@ const BUILTIN_METADATA = {
70
69
  lifecycle: stable(),
71
70
  argumentSchema: raw(['local', 'web', 'mixed']),
72
71
  },
73
- security: {
74
- id: 'builtin.workflow.security',
75
- audience: 'advanced',
76
- sideEffects: ['agent-request'],
77
- busyPolicy: 'queue-next',
78
- defaultAction: 'execute',
79
- lifecycle: stable(),
80
- argumentSchema: raw(),
81
- },
82
- 'test-gen': {
83
- id: 'builtin.workflow.test-gen',
84
- audience: 'advanced',
85
- sideEffects: ['agent-request', 'workspace-write'],
86
- busyPolicy: 'queue-next',
87
- defaultAction: 'execute',
88
- lifecycle: stable(),
89
- argumentSchema: raw(),
90
- },
91
72
  todos: {
92
73
  id: 'builtin.workflow.todos',
93
74
  audience: 'advanced',
@@ -97,6 +78,24 @@ const BUILTIN_METADATA = {
97
78
  lifecycle: stable(),
98
79
  argumentSchema: none(),
99
80
  },
81
+ new: {
82
+ id: 'builtin.session.new',
83
+ audience: 'primary',
84
+ sideEffects: ['session-state'],
85
+ busyPolicy: 'reject-busy',
86
+ defaultAction: 'execute',
87
+ lifecycle: stable('v0.4.6'),
88
+ argumentSchema: none(),
89
+ },
90
+ rename: {
91
+ id: 'builtin.session.rename',
92
+ audience: 'primary',
93
+ sideEffects: ['session-state'],
94
+ busyPolicy: 'reject-busy',
95
+ defaultAction: 'execute',
96
+ lifecycle: stable('v0.4.6'),
97
+ argumentSchema: raw(),
98
+ },
100
99
  resume: {
101
100
  id: 'builtin.session.resume',
102
101
  audience: 'primary',
@@ -127,11 +126,11 @@ const BUILTIN_METADATA = {
127
126
  context: {
128
127
  id: 'builtin.context.context',
129
128
  audience: 'primary',
130
- sideEffects: ['session-state'],
129
+ sideEffects: ['none'],
131
130
  busyPolicy: 'reject-busy',
132
131
  defaultAction: 'show-status',
133
132
  lifecycle: stable(),
134
- argumentSchema: raw(['show', 'clear', 'harness', 'explain']),
133
+ argumentSchema: raw(['show', 'explain']),
135
134
  },
136
135
  rewind: {
137
136
  id: 'builtin.session.rewind',
@@ -142,15 +141,6 @@ const BUILTIN_METADATA = {
142
141
  lifecycle: stable(),
143
142
  argumentSchema: raw(['list', 'restore']),
144
143
  },
145
- harness: {
146
- id: 'builtin.context.harness',
147
- audience: 'advanced',
148
- sideEffects: ['none'],
149
- busyPolicy: 'immediate',
150
- defaultAction: 'show-status',
151
- lifecycle: stable(),
152
- argumentSchema: raw(),
153
- },
154
144
  skills: {
155
145
  id: 'builtin.extension.skills',
156
146
  audience: 'advanced',
@@ -169,7 +159,7 @@ const BUILTIN_METADATA = {
169
159
  lifecycle: stable(),
170
160
  argumentSchema: raw(),
171
161
  },
172
- memory: {
162
+ memories: {
173
163
  id: 'builtin.context.memory',
174
164
  audience: 'advanced',
175
165
  sideEffects: ['session-state'],
@@ -196,15 +186,6 @@ const BUILTIN_METADATA = {
196
186
  lifecycle: stable(),
197
187
  argumentSchema: raw(),
198
188
  },
199
- safety: {
200
- id: 'builtin.tool.safety',
201
- audience: 'advanced',
202
- sideEffects: ['none'],
203
- busyPolicy: 'immediate',
204
- defaultAction: 'show-status',
205
- lifecycle: stable(),
206
- argumentSchema: raw(),
207
- },
208
189
  model: {
209
190
  id: 'builtin.model.model',
210
191
  audience: 'primary',
@@ -260,15 +241,6 @@ const BUILTIN_METADATA = {
260
241
  lifecycle: stable(),
261
242
  argumentSchema: none(),
262
243
  },
263
- clear: {
264
- id: 'builtin.renderer.clear',
265
- audience: 'advanced',
266
- sideEffects: ['renderer-view'],
267
- busyPolicy: 'immediate',
268
- defaultAction: 'execute',
269
- lifecycle: stable(),
270
- argumentSchema: none(),
271
- },
272
244
  'tool-output': {
273
245
  id: 'builtin.renderer.tool-output',
274
246
  audience: 'advanced',
@@ -314,20 +286,11 @@ const BUILTIN_METADATA = {
314
286
  lifecycle: stable(),
315
287
  argumentSchema: raw(['clear']),
316
288
  },
317
- redraw: {
318
- id: 'builtin.renderer.redraw',
319
- audience: 'internal',
320
- sideEffects: ['renderer-view'],
321
- busyPolicy: 'immediate',
322
- defaultAction: 'execute',
323
- lifecycle: internal(),
324
- argumentSchema: none(),
325
- },
326
- exit: {
289
+ quit: {
327
290
  id: 'builtin.system.exit',
328
- audience: 'advanced',
291
+ audience: 'primary',
329
292
  sideEffects: ['process-lifecycle'],
330
- busyPolicy: 'reject-busy',
293
+ busyPolicy: 'immediate',
331
294
  defaultAction: 'execute',
332
295
  lifecycle: stable(),
333
296
  argumentSchema: none(),
@@ -0,0 +1,2 @@
1
+ export declare function retiredCommandNotice(name: string, args?: string): string | undefined;
2
+ //# sourceMappingURL=retired-commands.d.ts.map
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.retiredCommandNotice = retiredCommandNotice;
4
+ const RETIRED_COMMAND_REPLACEMENTS = new Map([
5
+ ['harness', 'Use /context explain to inspect harness diagnostics.'],
6
+ ['safety', 'Use /doctor to check the runtime and tools.'],
7
+ [
8
+ 'context clear',
9
+ 'Use /new to start another session. Use /resume to reopen saved conversations.',
10
+ ],
11
+ ['context harness', 'Use /context explain to inspect harness diagnostics.'],
12
+ ['clear', 'Use /new to start another session. Use /resume to reopen saved conversations.'],
13
+ ['redraw', 'Press Ctrl+L in the TUI to redraw.'],
14
+ ['security', 'Use /skill security-check <task>.'],
15
+ ['audit', 'Use /skill security-check <task>.'],
16
+ ['test-gen', 'Use /skill test-gen <task>.'],
17
+ ['tests', 'Use /skill test-gen <task>.'],
18
+ ]);
19
+ function retiredCommandNotice(name, args = '') {
20
+ const key = name === 'context' ? name + ' ' + args.toLowerCase().split(/\s+/u, 1)[0] : name;
21
+ const replacement = RETIRED_COMMAND_REPLACEMENTS.get(key);
22
+ return replacement ? `/${key} was retired in v0.4.6. ${replacement}` : undefined;
23
+ }
24
+ //# sourceMappingURL=retired-commands.js.map
@@ -1,10 +1,11 @@
1
1
  /** Handler implementations for the session-command-handlers boundary. */
2
2
  import { type CommandContext, type CommandResult } from './types';
3
- declare function handleContextClear(ctx: CommandContext, args: string): CommandResult;
4
3
  declare function handleCompact(ctx: CommandContext, args: string): Promise<CommandResult>;
5
4
  declare function handleSessions(ctx: CommandContext, args?: string): CommandResult;
6
5
  declare function handleSessionInfo(ctx: CommandContext, args?: string): CommandResult;
6
+ declare function handleNewSession(ctx: CommandContext, args: string): Promise<CommandResult>;
7
7
  declare function handleResume(ctx: CommandContext, args: string): Promise<CommandResult>;
8
8
  declare function handleSessionRename(ctx: CommandContext, args: string): CommandResult;
9
- export { handleResume, handleSessions, handleSessionInfo, handleSessionRename, handleCompact, handleContextClear, };
9
+ declare function handleCurrentSessionRename(ctx: CommandContext, args: string): CommandResult;
10
+ export { handleResume, handleSessions, handleSessionInfo, handleSessionRename, handleCompact, handleNewSession, handleCurrentSessionRename, };
10
11
  //# sourceMappingURL=session-command-handlers.d.ts.map
@@ -9,7 +9,8 @@ exports.handleSessions = handleSessions;
9
9
  exports.handleSessionInfo = handleSessionInfo;
10
10
  exports.handleSessionRename = handleSessionRename;
11
11
  exports.handleCompact = handleCompact;
12
- exports.handleContextClear = handleContextClear;
12
+ exports.handleNewSession = handleNewSession;
13
+ exports.handleCurrentSessionRename = handleCurrentSessionRename;
13
14
  const chalk_1 = __importDefault(require("chalk"));
14
15
  const ui_view_model_1 = require("../runtime/ui-view-model");
15
16
  const legacy_thread_materializer_1 = require("../runtime/legacy-thread-materializer");
@@ -89,33 +90,6 @@ function commandUICapabilities(ctx) {
89
90
  capabilities: ctx.uiCapabilities,
90
91
  }).renderer.capabilities;
91
92
  }
92
- function hasCommandFlag(args, flag) {
93
- return args.trim().split(/\s+/u).includes(flag);
94
- }
95
- function handleContextClear(ctx, args) {
96
- const history = ctx.store.getSnapshot().conversationHistory;
97
- if (history.length === 0) {
98
- return { success: true, output: 'Current in-memory model context is already empty.' };
99
- }
100
- if (!hasCommandFlag(args, '--yes')) {
101
- return {
102
- success: false,
103
- error: [
104
- `This will clear ${history.length} message(s) from the current in-memory model context.`,
105
- 'Saved session history will not be deleted and can still be restored with /resume.',
106
- 'Run /context clear --yes to continue.',
107
- ].join('\n'),
108
- };
109
- }
110
- ctx.store.resetConversation();
111
- return {
112
- success: true,
113
- output: [
114
- `Cleared ${history.length} messages from current model context.`,
115
- 'Saved session history, configuration, and system state were preserved.',
116
- ].join('\n'),
117
- };
118
- }
119
93
  async function handleCompact(ctx, args) {
120
94
  const trimmedArgs = args.trim();
121
95
  const match = trimmedArgs.match(/^(?:(\d+)(?:\s+|$))?([\s\S]*)$/u);
@@ -351,6 +325,17 @@ function handleSessionInfo(ctx, args = '') {
351
325
  ].join('\n'),
352
326
  };
353
327
  }
328
+ async function handleNewSession(ctx, args) {
329
+ if (args.trim())
330
+ return { success: false, error: 'Usage: /new' };
331
+ if (!ctx.startNewSession) {
332
+ return { success: false, error: 'The current runtime cannot start a new session.' };
333
+ }
334
+ const session = await ctx.startNewSession();
335
+ return ctx.uiRenderer === 'tui' || ctx.uiRenderer === 'terminal'
336
+ ? { success: true }
337
+ : { success: true, output: 'New session ' + session.id };
338
+ }
354
339
  async function handleResume(ctx, args) {
355
340
  const lines = [];
356
341
  const write = (text = '') => lines.push(text);
@@ -440,7 +425,7 @@ async function restoreSession(ctx, session, isLast) {
440
425
  const checkpoint = restoredView.checkpoint;
441
426
  const restoredHarnessState = restoredView.harnessState;
442
427
  let runtimeActivation = restoredView.runtimeActivation;
443
- if (ctx.restoreSessionRuntime && !runtimeActivation) {
428
+ if ((ctx.activateSessionRuntime || ctx.restoreSessionRuntime) && !runtimeActivation) {
444
429
  // A legacy target is cut over and verified while the healthy current
445
430
  // Runtime still owns the foreground. The same verified Store is then
446
431
  // handed to the replacement Runtime, so failure cannot tear down the
@@ -452,23 +437,26 @@ async function restoreSession(ctx, session, isLast) {
452
437
  }
453
438
  }
454
439
  const selected = (0, session_storage_1.loadSessionMeta)(session.id) ?? { ...session };
455
- // Swap in the resumed session's transcript BEFORE emitting any command output,
456
- // so the output is appended after the history rather than wiped by the
457
- // transcript replacement below.
458
- ctx.setSession?.(selected);
459
440
  // Notify runtime/TUI consumers only after the target view is validated.
460
441
  const resumeGeneratedAt = Date.now();
461
442
  const summary = checkpoint?.summary.text ?? (history.length > 0 ? generateHistorySummary(history) : '');
462
443
  const summaryGeneratedAt = checkpoint?.summary.generatedAt ?? resumeGeneratedAt;
463
444
  const summarySource = checkpoint?.summary.source ?? 'resume_heuristic';
464
445
  const summaryCoveredMessages = checkpoint?.summary.sourceMessageCount ?? restoredView.sourceMessageCount;
465
- if (restoredHarnessState) {
466
- ctx.store.setState({ harnessState: restoredHarnessState });
446
+ if (ctx.activateSessionRuntime) {
447
+ await ctx.activateSessionRuntime(selected, runtimeActivation, {
448
+ conversationHistory: history,
449
+ harnessState: restoredHarnessState,
450
+ });
467
451
  }
468
- if (history.length > 0) {
469
- ctx.store.setState({ conversationHistory: history });
452
+ else {
453
+ ctx.setSession?.(selected);
454
+ if (restoredHarnessState)
455
+ ctx.store.setState({ harnessState: restoredHarnessState });
456
+ if (history.length > 0)
457
+ ctx.store.setState({ conversationHistory: history });
458
+ await ctx.restoreSessionRuntime?.(runtimeActivation);
470
459
  }
471
- await ctx.restoreSessionRuntime?.(runtimeActivation);
472
460
  // The runner needs the selected ID before it can acquire Thread ownership.
473
461
  // A rejected activation leaves the saved session's lifecycle and recent hint intact.
474
462
  const resumed = (0, session_storage_1.resumeSession)(selected.id) ?? selected;
@@ -589,12 +577,23 @@ function handleSessionRename(ctx, args) {
589
577
  }
590
578
  session = result.session;
591
579
  }
592
- const duplicate = scopedSessions.find(s => s.id !== session.id && s.name === newName);
580
+ return renameResolvedSession(ctx, session, newName, scopedSessions);
581
+ }
582
+ function handleCurrentSessionRename(ctx, args) {
583
+ const name = args.trim();
584
+ if (!name)
585
+ return { success: false, error: 'Usage: /rename <name>' };
586
+ const session = ctx.getSession?.() ?? (ctx.sessionId ? (0, session_storage_1.loadSessionMeta)(ctx.sessionId) : null);
587
+ if (!session) {
588
+ return { success: false, error: 'No current session. Use /new or /resume first.' };
589
+ }
590
+ return renameResolvedSession(ctx, session, name, (0, session_storage_1.listProjectSessions)(session.projectPath));
591
+ }
592
+ function renameResolvedSession(ctx, session, newName, scopedSessions) {
593
+ const duplicate = scopedSessions.find(candidate => candidate.id !== session.id && candidate.name === newName);
593
594
  const renamed = (0, session_storage_1.renameSession)(session.id, newName);
594
595
  if (!renamed) {
595
- console.log(ERROR(`Session not found: ${ref}`));
596
- console.log();
597
- return { success: false };
596
+ return { success: false, error: 'Session not found: ' + session.id };
598
597
  }
599
598
  if (ctx.getSession?.()?.id === renamed.id) {
600
599
  ctx.setSession?.(renamed);
@@ -4,6 +4,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.SESSION_COMMANDS = void 0;
5
5
  const session_command_handlers_1 = require("./session-command-handlers");
6
6
  exports.SESSION_COMMANDS = [
7
+ {
8
+ name: 'new',
9
+ description: 'Start an independent session',
10
+ category: 'session',
11
+ priority: 5,
12
+ type: 'builtin',
13
+ execution: 'builtin',
14
+ risk: 'state-write',
15
+ execute: session_command_handlers_1.handleNewSession,
16
+ },
7
17
  {
8
18
  name: 'resume',
9
19
  description: 'Resume a previous session',
@@ -15,6 +25,17 @@ exports.SESSION_COMMANDS = [
15
25
  risk: 'state-write',
16
26
  execute: (ctx, args) => (0, session_command_handlers_1.handleResume)(ctx, args),
17
27
  },
28
+ {
29
+ name: 'rename',
30
+ description: 'Rename the current session',
31
+ argumentHint: '<name>',
32
+ category: 'session',
33
+ priority: 12,
34
+ type: 'builtin',
35
+ execution: 'builtin',
36
+ risk: 'state-write',
37
+ execute: session_command_handlers_1.handleCurrentSessionRename,
38
+ },
18
39
  {
19
40
  name: 'session',
20
41
  description: 'List, inspect, or rename sessions through one domain command',
@@ -29,20 +29,6 @@ function createSystemCommands(getVisibleCommands) {
29
29
  risk: 'read-only',
30
30
  execute: ctx => (0, core_command_handlers_1.showStatus)(ctx),
31
31
  },
32
- {
33
- name: 'clear',
34
- description: 'Clear the current view without deleting session data',
35
- category: 'system',
36
- priority: 30,
37
- type: 'builtin',
38
- execution: 'renderer-local',
39
- risk: 'read-only',
40
- rendererScope: ['tui', 'terminal'],
41
- execute: ctx => {
42
- ctx.clearView?.();
43
- return { success: true };
44
- },
45
- },
46
32
  {
47
33
  name: 'theme',
48
34
  description: 'Choose the TUI theme',
@@ -127,19 +113,8 @@ function createSystemCommands(getVisibleCommands) {
127
113
  execute: () => ({ success: true }),
128
114
  },
129
115
  {
130
- name: 'redraw',
131
- description: 'Redraw the TUI-owned live region',
132
- category: 'system',
133
- priority: 36,
134
- type: 'builtin',
135
- execution: 'renderer-local',
136
- risk: 'read-only',
137
- rendererScope: ['tui'],
138
- execute: () => ({ success: true }),
139
- },
140
- {
141
- name: 'exit',
142
- aliases: ['quit', 'q'],
116
+ name: 'quit',
117
+ aliases: ['exit', 'q'],
143
118
  description: 'Shutdown and exit',
144
119
  category: 'system',
145
120
  priority: 40,
@@ -25,15 +25,5 @@ exports.TOOL_COMMANDS = [
25
25
  risk: 'read-only',
26
26
  execute: ctx => (0, context_tool_command_handlers_1.handleMcp)(ctx),
27
27
  },
28
- {
29
- name: 'safety',
30
- description: 'Show safety checker status and audit summary',
31
- category: 'tools',
32
- priority: 30,
33
- type: 'builtin',
34
- execution: 'builtin',
35
- risk: 'read-only',
36
- execute: () => (0, context_tool_command_handlers_1.showSafety)(),
37
- },
38
28
  ];
39
29
  //# sourceMappingURL=tool-commands.js.map