@orion-agents/orion-code 0.4.7 → 0.4.9

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 (142) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +8 -9
  3. package/README.zh-CN.md +8 -8
  4. package/dist/acp/session-updates.js +1 -0
  5. package/dist/cli.js +42 -3
  6. package/dist/commands/session-command-handlers.js +8 -3
  7. package/dist/commands/system-commands.js +3 -3
  8. package/dist/commands/types.d.ts +3 -0
  9. package/dist/framework/loop-progress.js +3 -1
  10. package/dist/framework/query.d.ts +6 -8
  11. package/dist/framework/query.js +39 -76
  12. package/dist/framework/tool-serializer.d.ts +12 -0
  13. package/dist/framework/tool-serializer.js +35 -0
  14. package/dist/framework/tool.d.ts +2 -0
  15. package/dist/framework/verification-command.d.ts +21 -0
  16. package/dist/framework/verification-command.js +53 -4
  17. package/dist/harness/context-harness.d.ts +3 -9
  18. package/dist/harness/context-harness.js +43 -163
  19. package/dist/harness/ledger.js +2 -1
  20. package/dist/harness/state.d.ts +3 -0
  21. package/dist/harness/state.js +37 -4
  22. package/dist/harness/task-checklist.d.ts +1 -1
  23. package/dist/harness/task-checklist.js +1 -1
  24. package/dist/harness/types.d.ts +1 -0
  25. package/dist/harness/verification.js +5 -4
  26. package/dist/print-ui/delivery.d.ts +15 -0
  27. package/dist/print-ui/delivery.js +131 -0
  28. package/dist/print-ui/event-stream.d.ts +6 -1
  29. package/dist/print-ui/event-stream.js +56 -10
  30. package/dist/print-ui/launch.d.ts +5 -0
  31. package/dist/print-ui/launch.js +66 -9
  32. package/dist/runtime/agent-loop.d.ts +3 -1
  33. package/dist/runtime/agent-loop.js +26 -41
  34. package/dist/runtime/agent-runtime-controller.d.ts +4 -1
  35. package/dist/runtime/agent-runtime-controller.js +36 -22
  36. package/dist/runtime/agent-runtime-runner.d.ts +4 -0
  37. package/dist/runtime/agent-runtime-runner.js +9 -0
  38. package/dist/runtime/builtin-tool-provider.js +6 -5
  39. package/dist/runtime/composer/layout.d.ts +1 -1
  40. package/dist/runtime/composer/layout.js +5 -5
  41. package/dist/runtime/core-tools/descriptors.d.ts +1 -1
  42. package/dist/runtime/core-tools/descriptors.js +39 -1
  43. package/dist/runtime/first-party-core-provider.js +1 -0
  44. package/dist/runtime/first-party-tool-services.js +10 -0
  45. package/dist/runtime/goal-lifecycle-v2.js +5 -0
  46. package/dist/runtime/goal-runtime-coordinator.js +6 -2
  47. package/dist/runtime/goals/evidence.js +2 -0
  48. package/dist/runtime/legacy-thread-materializer.d.ts +7 -0
  49. package/dist/runtime/legacy-thread-materializer.js +32 -6
  50. package/dist/runtime/orion-runtime-v1.d.ts +2 -1
  51. package/dist/runtime/orion-runtime-v1.js +34 -6
  52. package/dist/runtime/product-bootstrap.d.ts +2 -0
  53. package/dist/runtime/product-bootstrap.js +1 -0
  54. package/dist/runtime/product-orion-runtime.d.ts +2 -1
  55. package/dist/runtime/product-orion-runtime.js +7 -2
  56. package/dist/runtime/rich-text/layout.d.ts +3 -1
  57. package/dist/runtime/rich-text/layout.js +37 -22
  58. package/dist/runtime/shell-process-sessions.d.ts +41 -0
  59. package/dist/runtime/shell-process-sessions.js +258 -0
  60. package/dist/runtime/step-snapshot.js +61 -11
  61. package/dist/runtime/subagents/presets.d.ts +1 -1
  62. package/dist/runtime/subagents/presets.js +1 -0
  63. package/dist/runtime/task-context-recovery.js +14 -3
  64. package/dist/runtime/task-context-service.d.ts +2 -6
  65. package/dist/runtime/task-context-service.js +3 -12
  66. package/dist/runtime/thread-event-store.d.ts +3 -0
  67. package/dist/runtime/thread-event-store.js +35 -22
  68. package/dist/runtime/thread-session-index.d.ts +15 -3
  69. package/dist/runtime/thread-session-index.js +152 -45
  70. package/dist/runtime/thread-session-view.js +1 -1
  71. package/dist/runtime/thread-ui-adapter.d.ts +1 -1
  72. package/dist/runtime/thread-ui-adapter.js +23 -5
  73. package/dist/runtime/tool-gateway.d.ts +1 -0
  74. package/dist/runtime/tool-gateway.js +1 -0
  75. package/dist/runtime/tool-transcript-entry.d.ts +8 -1
  76. package/dist/runtime/tool-transcript-entry.js +35 -7
  77. package/dist/runtime/ui-events.d.ts +10 -0
  78. package/dist/runtime/verification-feedback.d.ts +4 -0
  79. package/dist/runtime/verification-feedback.js +61 -0
  80. package/dist/services/global-config.d.ts +1 -1
  81. package/dist/services/global-config.js +2 -0
  82. package/dist/services/llm.d.ts +3 -0
  83. package/dist/services/llm.js +48 -4
  84. package/dist/terminal-ui/raw-editor.js +2 -1
  85. package/dist/tools/bash_security.d.ts +1 -24
  86. package/dist/tools/bash_security.js +7 -124
  87. package/dist/tools/core/exec-command.js +51 -42
  88. package/dist/tools/core/index.d.ts +2 -1
  89. package/dist/tools/core/index.js +4 -1
  90. package/dist/tools/core/process-session.d.ts +2 -0
  91. package/dist/tools/core/process-session.js +54 -0
  92. package/dist/tools/todo.js +9 -13
  93. package/dist/tui-core/frame.d.ts +2 -0
  94. package/dist/tui-core/frame.js +19 -0
  95. package/dist/tui-core/input-parser.d.ts +4 -1
  96. package/dist/tui-core/input-parser.js +22 -0
  97. package/dist/tui-ui/chrome-view-model.d.ts +0 -2
  98. package/dist/tui-ui/chrome-view-model.js +54 -56
  99. package/dist/tui-ui/launch.js +133 -202
  100. package/dist/tui-ui/layout.d.ts +16 -41
  101. package/dist/tui-ui/layout.js +408 -295
  102. package/dist/tui-ui/render-scheduler.d.ts +2 -5
  103. package/dist/tui-ui/render-scheduler.js +10 -10
  104. package/dist/tui-ui/response-clipboard.d.ts +17 -0
  105. package/dist/tui-ui/response-clipboard.js +201 -0
  106. package/dist/tui-ui/runner.d.ts +65 -80
  107. package/dist/tui-ui/runner.js +545 -738
  108. package/dist/tui-ui/session-picker-preview.d.ts +8 -0
  109. package/dist/tui-ui/session-picker-preview.js +119 -0
  110. package/dist/tui-ui/session-picker.d.ts +20 -0
  111. package/dist/tui-ui/session-picker.js +42 -0
  112. package/dist/tui-ui/state.d.ts +34 -81
  113. package/dist/tui-ui/state.js +155 -288
  114. package/dist/tui-ui/terminal-image.d.ts +3 -7
  115. package/dist/tui-ui/terminal-image.js +18 -47
  116. package/dist/tui-ui/terminal-viewport.d.ts +55 -0
  117. package/dist/tui-ui/terminal-viewport.js +221 -0
  118. package/dist/tui-ui/transcript-layout.d.ts +5 -0
  119. package/dist/tui-ui/transcript-layout.js +43 -28
  120. package/dist/tui-ui/transcript-pager.d.ts +39 -0
  121. package/dist/tui-ui/transcript-pager.js +278 -0
  122. package/dist/tui-ui/transcript-tool-output.d.ts +16 -0
  123. package/dist/tui-ui/transcript-tool-output.js +102 -0
  124. package/dist/utils/bounded-file.d.ts +4 -0
  125. package/dist/utils/bounded-file.js +30 -0
  126. package/dist/utils/command-process.d.ts +4 -0
  127. package/dist/utils/command-process.js +23 -0
  128. package/dist/utils/shell-command.d.ts +29 -0
  129. package/dist/utils/shell-command.js +185 -0
  130. package/docs/cli-guide.md +50 -6
  131. package/npm-shrinkwrap.json +115 -15
  132. package/package.json +4 -1
  133. package/dist/tui-ui/inline-surface.d.ts +0 -191
  134. package/dist/tui-ui/inline-surface.js +0 -644
  135. package/dist/tui-ui/input-ownership.d.ts +0 -46
  136. package/dist/tui-ui/input-ownership.js +0 -74
  137. package/dist/tui-ui/transcript-inspector-layout.d.ts +0 -9
  138. package/dist/tui-ui/transcript-inspector-layout.js +0 -107
  139. package/dist/tui-ui/transcript-inspector-surface.d.ts +0 -18
  140. package/dist/tui-ui/transcript-inspector-surface.js +0 -91
  141. package/dist/tui-ui/transcript-inspector.d.ts +0 -36
  142. package/dist/tui-ui/transcript-inspector.js +0 -129
package/docs/cli-guide.md CHANGED
@@ -53,11 +53,29 @@ orion doctor
53
53
 
54
54
  ## TUI 命令与会话
55
55
 
56
- 从 v0.4.6 起,在输入框开头键入 `/` 可查看命令。候选根据命令名和别名筛选,并贴近输入框显示。
57
- 用方向键选中候选,Tab 补全命令名并保留已经输入的参数,Enter 执行。Esc 关闭候选并保留草稿。
56
+ 在输入框开头键入 `/` 查看命令,键入 `@` 选择文件。候选在输入框下方显示。
57
+ 用方向键选中候选,Tab 补全并保留已经输入的参数,Enter 执行命令。Esc 关闭候选并保留草稿。
58
58
  光标进入参数区后,可以继续编辑并直接提交。
59
59
 
60
- - `/new` 创建独立会话,`/resume` 可回到原会话。进行中的回合结束后即可切换。
60
+ Ctrl+T 打开或关闭完整会话历史。对话、Thinking 摘要及工具详情按时间顺序显示。
61
+ 用滚轮、方向键或 PgUp/PgDn 翻阅,Home/End 跳到最早/最新。回到最新位置后恢复跟随。
62
+ 恢复会话后,翻到已载记录的开头可继续加载较早记录。窗口缩放和新输出会保留当前阅读位置。TUI 退出时把当前会话最近最多 2,000 行已完成内容追加到终端的原生滚回区。
63
+
64
+ 在主对话按 Ctrl+O 将当前会话最近的已完成回复复制到剪贴板,保留原始 Markdown 格式。
65
+ 新回复仍在生成时,复制先前已完成的回复。恢复会话后可以复制该会话已有的回复。
66
+
67
+ 长草稿随终端宽度自动换行。↑/↓ 在可视行之间移动,行首尾仍沿用当前逻辑行。`?` 打开快捷键说明。
68
+ 运行信息位于输入框上方,显示执行阶段、中断键和可容纳的工具详情。模式、模型和上下文显示在下方。
69
+ 同一轮里连续成功的读取、搜索和目录浏览合并为一条探索记录。失败、写入和命令各自显示。
70
+ 用 Ctrl+T 查看逐条调用和输出,或用 `/tool-output full` 在主对话显示明细。
71
+
72
+ 运行中按 Enter 补充当前任务,按 Tab 将消息排到下一轮。输入框上方的 `Next turn` 预览显示待发数量和前两条消息。
73
+ 用 `/queue` 打开管理视图。↑/↓ 选中条目,Enter 编辑,`[`/`]` 移动,Delete 撤回。
74
+ 编辑时 Enter 保存,Ctrl+J 换行,Esc 返回。支持 Alt+↑ 的终端可直接编辑最后一条待发消息,主输入草稿会保留。
75
+ 用 `/queue resume` 继续已暂停的队列,`/queue clear` 清空。
76
+
77
+ - `/new` 创建独立会话。回合结束后用 `/resume` 搜索当前项目,或用 `/resume --all` 查全部项目。
78
+ 支持按标题、摘要、项目和 ID 筛选。方向键切换预览,Enter 恢复选中会话,Esc 返回。
61
79
  - `/rename <name>` 重命名当前会话,`/session rename` 仍支持指定其他会话。
62
80
  - `/quit` 退出,`/memories` 查看本地记忆状态。旧拼写 `/exit` 和 `/memory` 仍可输入。
63
81
 
@@ -103,6 +121,32 @@ JSONL stdout 每行是一个独立的 JSON 对象。每条记录有 `schemaVersi
103
121
  在原工作目录和 profile 下传入 `--resume`,通过新提示继续已保存的会话。新进程使用之前的
104
122
  历史与工具回执,JSONL 流只发出本次请求的事件。也可通过 stdin 管道传入新提示。
105
123
 
124
+ ### 按 JSON Schema 校验并保存最终回复
125
+
126
+ ```bash
127
+ orion -p --output-format jsonl --output-schema ./report.schema.json -o ./report.json -- "输出本次审查结果"
128
+ orion -p --output-last-message ./summary.txt -- "用三句话总结当前计划"
129
+ ```
130
+
131
+ - `--output-schema` 支持 JSON Schema Draft 7 和 2020-12,可使用同一文件内的引用。CLI 在请求模型前编译
132
+ Schema,并在当前回合完成后校验最终回复。兼容路由在 Provider 明确拒绝原生结构化输出时改用提示指引,始终执行本地校验。
133
+ - `-o` 和 `--output-last-message` 含义相同,只保存本回合最终模型回复。路径相对当前目录,目标父目录须已存在。
134
+ 文件通过原子替换写入,正文以换行结尾。旧文件在失败或中断时保留。
135
+ - 使用任一交付参数即启用严格退出状态。JSONL 会返回单一的 `result`,例如
136
+ `invalid_output_schema`、`invalid_final_json`、`output_schema_mismatch` 或 `output_write_failed`。
137
+ text 和 JSON 模式维持原有 stdout 格式,交付错误写入 stderr。
138
+
139
+ ### 在回合内继续操作 Shell 进程
140
+
141
+ Agent 可以用 `exec_command` 的 `interactive: true` 启动需要 stdin 或持续输出的命令。
142
+ `yieldMs` 控制单次等待,`timeout` 控制进程总时限。工具通过 `processId` 返回句柄。
143
+ 后续调用 `process_session`,以 `poll` 读新增输出、以 `write` 向 stdin 写入 `input`、以
144
+ `cancel` 停止进程。需要换行的命令须在 `input` 中包含换行。交互进程由当前回合持有,回合结束或中断会回收。
145
+
146
+ JSONL 的交互工具终态会带上 `processId`、`processStatus` 和 `outputTruncated`,
147
+ 实际退出时可带 `exitCode`。默认一次性命令继续在完成后返回输出,并在启动时关闭 stdin。
148
+ 交互方式使用管道,适用于行式程序,当前不支持 Docker sandbox 或要求 PTY 的程序。
149
+
106
150
  ## ACP 接入
107
151
 
108
152
  在 ACP 客户端中将 Agent 启动命令配置为 `orion`,参数设为 `["acp"]`。如果客户端进程的 PATH
@@ -490,12 +534,12 @@ ui:
490
534
  | --- | --- |
491
535
  | `theme` | `orion-pixel / classic / high-contrast / auto`;默认 `orion-pixel` |
492
536
  | `motion` | `full / reduced / off`;默认 `reduced` |
493
- | `mascot` | 布尔值,默认 `true` |
537
+ | `mascot` | 布尔值,默认 `false`,设为 `true` 可在启动区显示 Orion 像素形象 |
494
538
  | `statusLine` | 有序数组,可用项为示例中的七项,省略时按终端空间展示 |
495
539
  | `keymap` | 动作到按键数组的映射;省略使用默认快捷键 |
496
540
 
497
- keymap 动作为 `submit / queue / interrupt / history-search / external-editor / transcript / redraw / exit`。
498
- 允许的绑定为 `enter / tab / escape / ctrl+c / ctrl+d / ctrl+e / ctrl+l / ctrl+o / ctrl+r`;
541
+ keymap 动作为 `submit / queue / interrupt / history-search / external-editor / transcript / copy / redraw / exit`。
542
+ 允许的绑定为 `enter / tab / escape / ctrl+c / ctrl+d / ctrl+e / ctrl+l / ctrl+o / ctrl+r / ctrl+t`;
499
543
  配置不能重复占用同一个绑定,不接受原始 ANSI escape sequence。
500
544
  `ui.renderer` 不能写入 YAML;产品默认为 TUI,诊断界面使用 `orion --ui terminal`。
501
545
 
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@orion-agents/orion-code",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@orion-agents/orion-code",
9
- "version": "0.4.7",
9
+ "version": "0.4.9",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@agentclientprotocol/sdk": "2.12.0",
13
13
  "@clack/prompts": "^0.7.0",
14
+ "ajv": "8.20.0",
15
+ "ajv-formats": "3.0.1",
14
16
  "axios": "^1.6.0",
15
17
  "better-sqlite3": "^12.10.0",
16
18
  "chalk": "^4.1.2",
@@ -39,6 +41,7 @@
39
41
  "@types/node": "^22.0.0",
40
42
  "@typescript-eslint/eslint-plugin": "^7.18.0",
41
43
  "@typescript-eslint/parser": "^7.18.0",
44
+ "@xterm/headless": "6.0.0",
42
45
  "eslint": "^8.56.0",
43
46
  "eslint-config-prettier": "^9.1.2",
44
47
  "jest": "^29.7.0",
@@ -706,6 +709,30 @@
706
709
  "url": "https://opencollective.com/eslint"
707
710
  }
708
711
  },
712
+ "node_modules/@eslint/eslintrc/node_modules/ajv": {
713
+ "version": "6.15.0",
714
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
715
+ "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
716
+ "dev": true,
717
+ "license": "MIT",
718
+ "dependencies": {
719
+ "fast-deep-equal": "^3.1.1",
720
+ "fast-json-stable-stringify": "^2.0.0",
721
+ "json-schema-traverse": "^0.4.1",
722
+ "uri-js": "^4.2.2"
723
+ },
724
+ "funding": {
725
+ "type": "github",
726
+ "url": "https://github.com/sponsors/epoberezkin"
727
+ }
728
+ },
729
+ "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
730
+ "version": "0.4.1",
731
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
732
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
733
+ "dev": true,
734
+ "license": "MIT"
735
+ },
709
736
  "node_modules/@eslint/js": {
710
737
  "version": "8.57.1",
711
738
  "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz",
@@ -1695,6 +1722,16 @@
1695
1722
  "dev": true,
1696
1723
  "license": "ISC"
1697
1724
  },
1725
+ "node_modules/@xterm/headless": {
1726
+ "version": "6.0.0",
1727
+ "resolved": "https://registry.npmjs.org/@xterm/headless/-/headless-6.0.0.tgz",
1728
+ "integrity": "sha512-5Yj1QINYCyzrZtf8OFIHi47iQtI+0qYFPHmouEfG8dHNxbZ9Tb9YGSuLcsEwj9Z+OL75GJqPyJbyoFer80a2Hw==",
1729
+ "dev": true,
1730
+ "license": "MIT",
1731
+ "workspaces": [
1732
+ "addons/*"
1733
+ ]
1734
+ },
1698
1735
  "node_modules/abort-controller": {
1699
1736
  "version": "3.0.0",
1700
1737
  "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
@@ -1756,22 +1793,38 @@
1756
1793
  }
1757
1794
  },
1758
1795
  "node_modules/ajv": {
1759
- "version": "6.15.0",
1760
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
1761
- "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
1762
- "dev": true,
1796
+ "version": "8.20.0",
1797
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
1798
+ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
1763
1799
  "license": "MIT",
1764
1800
  "dependencies": {
1765
- "fast-deep-equal": "^3.1.1",
1766
- "fast-json-stable-stringify": "^2.0.0",
1767
- "json-schema-traverse": "^0.4.1",
1768
- "uri-js": "^4.2.2"
1801
+ "fast-deep-equal": "^3.1.3",
1802
+ "fast-uri": "^3.0.1",
1803
+ "json-schema-traverse": "^1.0.0",
1804
+ "require-from-string": "^2.0.2"
1769
1805
  },
1770
1806
  "funding": {
1771
1807
  "type": "github",
1772
1808
  "url": "https://github.com/sponsors/epoberezkin"
1773
1809
  }
1774
1810
  },
1811
+ "node_modules/ajv-formats": {
1812
+ "version": "3.0.1",
1813
+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",
1814
+ "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",
1815
+ "license": "MIT",
1816
+ "dependencies": {
1817
+ "ajv": "^8.0.0"
1818
+ },
1819
+ "peerDependencies": {
1820
+ "ajv": "^8.0.0"
1821
+ },
1822
+ "peerDependenciesMeta": {
1823
+ "ajv": {
1824
+ "optional": true
1825
+ }
1826
+ }
1827
+ },
1775
1828
  "node_modules/ansi-escapes": {
1776
1829
  "version": "4.3.2",
1777
1830
  "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
@@ -2957,6 +3010,30 @@
2957
3010
  "url": "https://opencollective.com/eslint"
2958
3011
  }
2959
3012
  },
3013
+ "node_modules/eslint/node_modules/ajv": {
3014
+ "version": "6.15.0",
3015
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
3016
+ "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
3017
+ "dev": true,
3018
+ "license": "MIT",
3019
+ "dependencies": {
3020
+ "fast-deep-equal": "^3.1.1",
3021
+ "fast-json-stable-stringify": "^2.0.0",
3022
+ "json-schema-traverse": "^0.4.1",
3023
+ "uri-js": "^4.2.2"
3024
+ },
3025
+ "funding": {
3026
+ "type": "github",
3027
+ "url": "https://github.com/sponsors/epoberezkin"
3028
+ }
3029
+ },
3030
+ "node_modules/eslint/node_modules/json-schema-traverse": {
3031
+ "version": "0.4.1",
3032
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
3033
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
3034
+ "dev": true,
3035
+ "license": "MIT"
3036
+ },
2960
3037
  "node_modules/espree": {
2961
3038
  "version": "9.6.1",
2962
3039
  "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
@@ -3128,7 +3205,6 @@
3128
3205
  "version": "3.1.3",
3129
3206
  "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
3130
3207
  "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
3131
- "dev": true,
3132
3208
  "license": "MIT"
3133
3209
  },
3134
3210
  "node_modules/fast-glob": {
@@ -3175,6 +3251,22 @@
3175
3251
  "dev": true,
3176
3252
  "license": "MIT"
3177
3253
  },
3254
+ "node_modules/fast-uri": {
3255
+ "version": "3.1.9",
3256
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz",
3257
+ "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",
3258
+ "funding": [
3259
+ {
3260
+ "type": "github",
3261
+ "url": "https://github.com/sponsors/fastify"
3262
+ },
3263
+ {
3264
+ "type": "opencollective",
3265
+ "url": "https://opencollective.com/fastify"
3266
+ }
3267
+ ],
3268
+ "license": "BSD-3-Clause"
3269
+ },
3178
3270
  "node_modules/fastq": {
3179
3271
  "version": "1.20.1",
3180
3272
  "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz",
@@ -4597,10 +4689,9 @@
4597
4689
  "license": "MIT"
4598
4690
  },
4599
4691
  "node_modules/json-schema-traverse": {
4600
- "version": "0.4.1",
4601
- "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
4602
- "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
4603
- "dev": true,
4692
+ "version": "1.0.0",
4693
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
4694
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
4604
4695
  "license": "MIT"
4605
4696
  },
4606
4697
  "node_modules/json-stable-stringify-without-jsonify": {
@@ -5647,6 +5738,15 @@
5647
5738
  "node": ">=0.10.0"
5648
5739
  }
5649
5740
  },
5741
+ "node_modules/require-from-string": {
5742
+ "version": "2.0.2",
5743
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
5744
+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
5745
+ "license": "MIT",
5746
+ "engines": {
5747
+ "node": ">=0.10.0"
5748
+ }
5749
+ },
5650
5750
  "node_modules/resolve": {
5651
5751
  "version": "1.22.12",
5652
5752
  "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-agents/orion-code",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "Orion Code - local-first goal-driven coding agent for the terminal.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -78,6 +78,8 @@
78
78
  "dependencies": {
79
79
  "@agentclientprotocol/sdk": "2.12.0",
80
80
  "@clack/prompts": "^0.7.0",
81
+ "ajv": "8.20.0",
82
+ "ajv-formats": "3.0.1",
81
83
  "axios": "^1.6.0",
82
84
  "better-sqlite3": "^12.10.0",
83
85
  "chalk": "^4.1.2",
@@ -103,6 +105,7 @@
103
105
  "@types/node": "^22.0.0",
104
106
  "@typescript-eslint/eslint-plugin": "^7.18.0",
105
107
  "@typescript-eslint/parser": "^7.18.0",
108
+ "@xterm/headless": "6.0.0",
106
109
  "eslint": "^8.56.0",
107
110
  "eslint-config-prettier": "^9.1.2",
108
111
  "jest": "^29.7.0",
@@ -1,191 +0,0 @@
1
- /**
2
- * InlineTerminalSurface: primary-screen inline TUI surface.
3
- *
4
- * Replaces the alternate-screen (1049) approach. Finalized transcript
5
- * content is committed once to stdout (entering shell native scrollback),
6
- * while the bottom live region holds only ephemeral content (streaming
7
- * assistant, running tools, overlay, status, prompt).
8
- *
9
- * Control sequences used (relative addressing only):
10
- * CR \r return to column 0
11
- * EL2 \x1b[2K erase current line
12
- * CUU(n) \x1b[<n>A cursor up (relative)
13
- * CUD(n) \x1b[<n>B cursor down (relative)
14
- * CUF(n) \x1b[<n>C cursor forward (relative)
15
- * SGR0 \x1b[0m reset style
16
- * DECTCEM \x1b[?25l/?25h hide/show cursor
17
- * DECAWM \x1b[?7l/?7h disable/enable autowrap (paint batch)
18
- *
19
- * Forbidden (never emitted):
20
- * \x1b[?1049h / \x1b[?1049l (alternate screen)
21
- * CSI row;col H / f (absolute cursor positioning)
22
- * CSI 2J (full screen clear)
23
- * mouse reporting, OSC52, OSC8
24
- *
25
- * All operations are serialized via an internal FIFO queue so commit,
26
- * renderLive, resize, suspend, and unmount never interleave on the same stream.
27
- */
28
- import { type TuiFrame } from '../tui-core/frame';
29
- /** Minimal output stream interface. */
30
- export type SurfaceOutputEvent = 'drain' | 'error' | 'close';
31
- export interface SurfaceOutput {
32
- write(chunk: string | Uint8Array): boolean;
33
- on(event: SurfaceOutputEvent, listener: (error?: unknown) => void): this;
34
- off(event: SurfaceOutputEvent, listener: (error?: unknown) => void): this;
35
- readonly writable: boolean;
36
- }
37
- export interface InlineSurfaceOptions {
38
- output: SurfaceOutput;
39
- /** Inject for deterministic tests. */
40
- now?: () => number;
41
- }
42
- export type SurfacePhase = 'idle' | 'mounted' | 'suspended' | 'unmounted' | 'failed';
43
- export interface InlineSurfaceState {
44
- phase: SurfacePhase;
45
- width: number;
46
- height: number;
47
- /** Height of the bottom live band. */
48
- liveBandRows: number;
49
- /** Rows currently owned by the inline live block. */
50
- liveRegionCapacity: number;
51
- cursorRow: number;
52
- cursorColumn: number;
53
- previousFrame: TuiFrame | null;
54
- }
55
- /** A committed transcript entry rendered to styled rows. */
56
- export interface CommittedEntry {
57
- displayKey: string;
58
- rows: {
59
- text: string;
60
- style?: import('../tui-core/style').TuiStyle;
61
- }[][];
62
- }
63
- export interface TranscriptCommitBatch {
64
- batchId?: string;
65
- generation: number;
66
- reason: 'append' | 'finalize' | 'restore' | 'replace' | 'clear-divider';
67
- entries: CommittedEntry[];
68
- }
69
- export interface TuiTerminalRenderResult {
70
- output: string;
71
- committedEntries: number;
72
- batchId?: string;
73
- generation?: number;
74
- displayKeys?: string[];
75
- }
76
- /**
77
- * Get the latest live frame for rendering after a commit.
78
- * The runner provides this so commit + finalize interleaving uses fresh state.
79
- */
80
- export type LiveFrameProvider = () => TuiFrame | null;
81
- export declare class InlineTerminalSurface {
82
- private phase;
83
- private width;
84
- private height;
85
- /** Height of the bottom live band (status + prompt + live tail). */
86
- private liveBandRows;
87
- private liveRegionCapacity;
88
- private cursorRow;
89
- private cursorColumn;
90
- private previousFrame;
91
- /** Suppress stale-width live paints between SIGWINCH and the resize repaint. */
92
- private resizePending;
93
- private pendingResizeWidth;
94
- private resizeGeneration;
95
- private resizeWaiters;
96
- private readonly output;
97
- private readonly now;
98
- private readonly suppressColor;
99
- /** Serialized FIFO queue of pending operations. */
100
- private queue;
101
- private processing;
102
- constructor(options: InlineSurfaceOptions);
103
- /** Compute the live band height (~75% of screen, min 8, max height-1). */
104
- private static computeBandRows;
105
- /** Live band height for the runner to size its live frame. */
106
- getLiveBandRows(): number;
107
- /** History area rows above the band (recently scrolled committed lines). */
108
- get historyAreaRows(): number;
109
- getState(): InlineSurfaceState;
110
- /** Mark the terminal as resizing before the debounced layout pass runs. */
111
- beginResize(width?: number): number;
112
- /**
113
- * Await completion of all queued operations.
114
- * Because the queue is strictly FIFO, enqueueing a no-op and awaiting it
115
- * guarantees every operation enqueued before this call has finished. Used by
116
- * tests to deterministically observe the terminal after a burst of renders.
117
- */
118
- whenIdle(): Promise<void>;
119
- /** Safe content width: never write the last column (avoid pending-wrap). */
120
- get safeContentWidth(): number;
121
- /** Enqueue an operation; FIFO guarantees no interleaving. */
122
- private enqueue;
123
- private drainQueue;
124
- /** Mount: enable bracketed paste + hide cursor. NO alternate screen. */
125
- mount(width: number, height: number): Promise<void>;
126
- /**
127
- * Commit finalized transcript entries to native scrollback.
128
- *
129
- * Protocol:
130
- * 1. Erase only the live rows owned by this surface and return to their top.
131
- * 2. Release that block and write finalized rows as ordinary line-oriented
132
- * shell output. The terminal decides when those lines enter scrollback.
133
- * 3. Allocate a fresh live block from the resulting cursor and repaint the
134
- * latest live frame below the committed output.
135
- */
136
- commit(batch: TranscriptCommitBatch, getLatestLiveFrame: LiveFrameProvider): Promise<TuiTerminalRenderResult>;
137
- /** Render the live region frame (relative addressing, changed-row diff). */
138
- renderLive(frame: TuiFrame): Promise<string>;
139
- /** Forget the diff baseline and repaint only the currently owned live region. */
140
- forceRedraw(frame: TuiFrame): Promise<string>;
141
- private renderLiveInternal;
142
- /** Render a single styled frame row to ANSI chunks (text + SGR + reset). */
143
- private renderRowChunks;
144
- /** Stable string form of a styled row, used for changed-row comparison. */
145
- private renderRowString;
146
- private trimDefaultTrailingCells;
147
- private renderedRowWidth;
148
- /**
149
- * Ensure the surface owns exactly `requiredRows` rows starting at the current
150
- * cursor. Allocation uses ordinary newlines, so existing shell output is
151
- * preserved and may naturally move into terminal scrollback.
152
- */
153
- private ensureCapacity;
154
- /** Clear the live band rows (relative, no absolute addressing). */
155
- private clearLiveRegion;
156
- /**
157
- * Clear the old live block after the terminal has already adopted a new
158
- * width. A previously full row can occupy multiple physical rows after
159
- * reflow, so tracked logical rows are not sufficient during resize.
160
- */
161
- private clearReflowedLiveRegion;
162
- private clearOwnedLiveRegion;
163
- private waitForResizeCompletion;
164
- private completeResize;
165
- private releaseLiveRegion;
166
- /** Resize: erase only the owned block, then rebuild from the current cursor. */
167
- resize(width: number, height: number, getLatestLiveFrame: LiveFrameProvider, generation?: number): Promise<void>;
168
- /** Suspend for child process: clear live region, disable bracketed paste, show cursor. */
169
- suspend(): Promise<void>;
170
- /** Restore after child process: re-enable bracketed paste, rebuild live frame. */
171
- restore(getLatestLiveFrame: LiveFrameProvider, width?: number, height?: number): Promise<void>;
172
- /** Unmount: clear live region, restore terminal state. Does NOT erase scrollback. */
173
- unmount(): Promise<void>;
174
- /** Flush all operations enqueued before this call without timer polling. */
175
- flush(): Promise<void>;
176
- private writeRaw;
177
- /** Reset for tests. */
178
- reset(): void;
179
- }
180
- export declare class MemoryOutput implements SurfaceOutput {
181
- chunks: string[];
182
- writable: boolean;
183
- private drainListeners;
184
- write(chunk: string | Uint8Array): boolean;
185
- on(event: SurfaceOutputEvent, listener: (error?: unknown) => void): this;
186
- off(event: SurfaceOutputEvent, listener: (error?: unknown) => void): this;
187
- text(): string;
188
- /** Assert output never contains forbidden sequences. */
189
- assertNoForbidden(): void;
190
- }
191
- //# sourceMappingURL=inline-surface.d.ts.map