@xingular/harness 1.3.1-unstable.1 → 1.3.1-unstable.10

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 (259) hide show
  1. package/CHANGELOG.md +256 -1
  2. package/NOTICE.md +26 -0
  3. package/README.md +15 -10
  4. package/dist/cli.js +6401 -2889
  5. package/dist/sdk/accounts/accounts.d.ts +26 -20
  6. package/dist/sdk/accounts/accounts.js +100 -63
  7. package/dist/sdk/accounts/choices.d.ts +18 -0
  8. package/dist/sdk/accounts/choices.js +27 -0
  9. package/dist/sdk/agents/builtin.js +2 -0
  10. package/dist/sdk/cli.js +6 -0
  11. package/dist/sdk/commands/extensionOwners.d.ts +4 -0
  12. package/dist/sdk/commands/extensionOwners.js +17 -0
  13. package/dist/sdk/commands/list.js +15 -2
  14. package/dist/sdk/commands/promptLoader.d.ts +5 -0
  15. package/dist/sdk/commands/promptLoader.js +76 -0
  16. package/dist/sdk/commands/promptRoutes.d.ts +13 -0
  17. package/dist/sdk/commands/promptRoutes.js +46 -0
  18. package/dist/sdk/commands/registry.d.ts +36 -0
  19. package/dist/sdk/commands/registry.js +5 -0
  20. package/dist/sdk/commands/runtimeRouter.d.ts +4 -0
  21. package/dist/sdk/commands/runtimeRouter.js +48 -0
  22. package/dist/sdk/computer/boundary.d.ts +40 -0
  23. package/dist/sdk/computer/boundary.js +79 -0
  24. package/dist/sdk/computer/contracts.d.ts +127 -0
  25. package/dist/sdk/computer/contracts.js +13 -0
  26. package/dist/sdk/computer/control.d.ts +34 -0
  27. package/dist/sdk/computer/control.js +112 -0
  28. package/dist/sdk/computer/screenshot.d.ts +32 -0
  29. package/dist/sdk/computer/screenshot.js +35 -0
  30. package/dist/sdk/computer/terminalCapture.d.ts +26 -0
  31. package/dist/sdk/computer/terminalCapture.js +64 -0
  32. package/dist/sdk/computer/volatileImages.d.ts +9 -0
  33. package/dist/sdk/computer/volatileImages.js +50 -0
  34. package/dist/sdk/context/attribution.d.ts +18 -0
  35. package/dist/sdk/context/attribution.js +295 -0
  36. package/dist/sdk/context/runDetails.d.ts +16 -0
  37. package/dist/sdk/context/runDetails.js +22 -0
  38. package/dist/sdk/context/types.d.ts +94 -0
  39. package/dist/sdk/context/types.js +10 -0
  40. package/dist/sdk/core/commandBudget.js +7 -2
  41. package/dist/sdk/core/workspaceWriteOperations.d.ts +24 -0
  42. package/dist/sdk/core/workspaceWriteOperations.js +21 -0
  43. package/dist/sdk/doctor/checks.js +3 -0
  44. package/dist/sdk/doctor/probe.js +8 -6
  45. package/dist/sdk/harness.d.ts +8 -0
  46. package/dist/sdk/harness.js +7 -4
  47. package/dist/sdk/history/trajectory.js +2 -0
  48. package/dist/sdk/hub/hub.js +1 -1
  49. package/dist/sdk/hub/schema.d.ts +2 -2
  50. package/dist/sdk/index.d.ts +2 -1
  51. package/dist/sdk/index.js +2 -1
  52. package/dist/sdk/plugins/builtin.js +1 -4
  53. package/dist/sdk/plugins/manifest.d.ts +2 -0
  54. package/dist/sdk/plugins/manifest.js +1 -0
  55. package/dist/sdk/prompt/compile.d.ts +47 -3
  56. package/dist/sdk/prompt/compile.js +111 -32
  57. package/dist/sdk/prompt/standard.d.ts +12 -0
  58. package/dist/sdk/prompt/standard.js +53 -2
  59. package/dist/sdk/refine/host.d.ts +9 -1
  60. package/dist/sdk/refine/host.js +29 -0
  61. package/dist/sdk/refine/prompts.d.ts +15 -0
  62. package/dist/sdk/refine/prompts.js +44 -0
  63. package/dist/sdk/refine/recursion.js +4 -4
  64. package/dist/sdk/refine/runner.d.ts +2 -0
  65. package/dist/sdk/refine/runner.js +2 -1
  66. package/dist/sdk/refine/serverMethods.js +4 -1
  67. package/dist/sdk/refine/service.d.ts +31 -0
  68. package/dist/sdk/refine/service.js +119 -4
  69. package/dist/sdk/refine/trajectory.js +7 -2
  70. package/dist/sdk/refine/types.d.ts +16 -0
  71. package/dist/sdk/remote/addresses.d.ts +19 -0
  72. package/dist/sdk/remote/addresses.js +52 -0
  73. package/dist/sdk/remote/pairing.d.ts +59 -0
  74. package/dist/sdk/remote/pairing.js +160 -0
  75. package/dist/sdk/remote/seal.d.ts +28 -0
  76. package/dist/sdk/remote/seal.js +84 -0
  77. package/dist/sdk/remote/server.d.ts +28 -0
  78. package/dist/sdk/remote/server.js +158 -0
  79. package/dist/sdk/remote/service.d.ts +125 -0
  80. package/dist/sdk/remote/service.js +330 -0
  81. package/dist/sdk/remote/webClient.d.ts +4 -0
  82. package/dist/sdk/remote/webClient.js +448 -0
  83. package/dist/sdk/server/methods.js +34 -1
  84. package/dist/sdk/sessions/checkpoint.d.ts +7 -0
  85. package/dist/sdk/sessions/checkpoint.js +41 -0
  86. package/dist/sdk/sessions/compactionCheckpoint.d.ts +8 -1
  87. package/dist/sdk/sessions/compactionCheckpoint.js +36 -36
  88. package/dist/sdk/sessions/completionCheck.d.ts +49 -0
  89. package/dist/sdk/sessions/completionCheck.js +143 -0
  90. package/dist/sdk/sessions/continuation.js +1 -1
  91. package/dist/sdk/sessions/contracts.d.ts +241 -2
  92. package/dist/sdk/sessions/contracts.js +134 -3
  93. package/dist/sdk/sessions/goal.d.ts +145 -0
  94. package/dist/sdk/sessions/goal.js +405 -0
  95. package/dist/sdk/sessions/goalLoop.d.ts +37 -0
  96. package/dist/sdk/sessions/goalLoop.js +125 -0
  97. package/dist/sdk/sessions/goalPrompts.d.ts +4 -0
  98. package/dist/sdk/sessions/goalPrompts.js +93 -0
  99. package/dist/sdk/sessions/planMode.d.ts +57 -1
  100. package/dist/sdk/sessions/planMode.js +103 -8
  101. package/dist/sdk/sessions/registry.d.ts +12 -3
  102. package/dist/sdk/sessions/registry.js +19 -16
  103. package/dist/sdk/sessions/runStore.d.ts +3 -1
  104. package/dist/sdk/sessions/runStore.js +27 -8
  105. package/dist/sdk/sessions/runner.d.ts +26 -5
  106. package/dist/sdk/sessions/runner.js +176 -29
  107. package/dist/sdk/sessions/sessions.d.ts +10 -0
  108. package/dist/sdk/sessions/sessions.js +121 -29
  109. package/dist/sdk/sessions/stopGate.d.ts +78 -0
  110. package/dist/sdk/sessions/stopGate.js +143 -0
  111. package/dist/sdk/sessions/subagentService.d.ts +13 -1
  112. package/dist/sdk/sessions/subagentService.js +120 -38
  113. package/dist/sdk/sessions/subagents.d.ts +31 -0
  114. package/dist/sdk/sessions/subagents.js +45 -0
  115. package/dist/sdk/sessions/workSlice.d.ts +65 -18
  116. package/dist/sdk/sessions/workSlice.js +104 -175
  117. package/dist/sdk/terminal/client.d.ts +6 -1
  118. package/dist/sdk/terminal/client.js +28 -6
  119. package/dist/sdk/terminal/control.d.ts +1 -1
  120. package/dist/sdk/terminal/control.js +2 -2
  121. package/dist/sdk/terminal/controller.d.ts +26 -2
  122. package/dist/sdk/terminal/controller.js +128 -21
  123. package/dist/sdk/terminal/credentialStore.d.ts +4 -0
  124. package/dist/sdk/terminal/credentialStore.js +33 -0
  125. package/dist/sdk/terminal/opentui/theme.d.ts +2 -0
  126. package/dist/sdk/terminal/opentui/theme.js +4 -0
  127. package/dist/sdk/terminal/piExtension.d.ts +2 -1
  128. package/dist/sdk/terminal/piExtension.js +335 -40
  129. package/dist/sdk/terminal/stallWatch.d.ts +13 -0
  130. package/dist/sdk/terminal/stallWatch.js +16 -0
  131. package/dist/sdk/terminal/standalone.d.ts +8 -1
  132. package/dist/sdk/terminal/standalone.js +39 -5
  133. package/dist/sdk/terminal/terminals.d.ts +24 -0
  134. package/dist/sdk/terminal/terminals.js +181 -9
  135. package/dist/sdk/terminal/trajectory.js +2 -2
  136. package/dist/sdk/terminal/tui/commandPages.d.ts +4 -1
  137. package/dist/sdk/terminal/tui/commandPages.js +15 -1
  138. package/dist/sdk/terminal/tui/commands.d.ts +5 -2
  139. package/dist/sdk/terminal/tui/commands.js +49 -68
  140. package/dist/sdk/terminal/tui/dialogs.d.ts +3 -2
  141. package/dist/sdk/terminal/tui/dialogs.js +4 -3
  142. package/dist/sdk/terminal/tui/goalCommand.d.ts +19 -0
  143. package/dist/sdk/terminal/tui/goalCommand.js +83 -0
  144. package/dist/sdk/terminal/tui/keybindings.js +1 -1
  145. package/dist/sdk/terminal/tui/markdown.d.ts +16 -0
  146. package/dist/sdk/terminal/tui/markdown.js +55 -0
  147. package/dist/sdk/terminal/tui/modeChoices.d.ts +21 -2
  148. package/dist/sdk/terminal/tui/modeChoices.js +30 -5
  149. package/dist/sdk/terminal/tui/mouseReport.d.ts +30 -0
  150. package/dist/sdk/terminal/tui/mouseReport.js +80 -0
  151. package/dist/sdk/terminal/tui/pages/annotatePage.js +3 -2
  152. package/dist/sdk/terminal/tui/pages/browserPage.d.ts +1 -1
  153. package/dist/sdk/terminal/tui/pages/contextPage.d.ts +91 -0
  154. package/dist/sdk/terminal/tui/pages/contextPage.js +585 -0
  155. package/dist/sdk/terminal/tui/pages/remoteControlPage.d.ts +32 -0
  156. package/dist/sdk/terminal/tui/pages/remoteControlPage.js +170 -0
  157. package/dist/sdk/terminal/tui/pages/textPage.d.ts +17 -0
  158. package/dist/sdk/terminal/tui/pages/textPage.js +52 -0
  159. package/dist/sdk/terminal/tui/pages/trajectoryPage.d.ts +1 -0
  160. package/dist/sdk/terminal/tui/pages/trajectoryPage.js +17 -7
  161. package/dist/sdk/terminal/tui/planMode.d.ts +1 -1
  162. package/dist/sdk/terminal/tui/planMode.js +1 -1
  163. package/dist/sdk/terminal/tui/qr.d.ts +4 -0
  164. package/dist/sdk/terminal/tui/qr.js +35 -0
  165. package/dist/sdk/terminal/tui/runtime.d.ts +3 -0
  166. package/dist/sdk/terminal/tui/runtime.js +89 -9
  167. package/dist/sdk/terminal/tui/search.js +3 -2
  168. package/dist/sdk/terminal/tui/sideQuestion.d.ts +4 -0
  169. package/dist/sdk/terminal/tui/sideQuestion.js +15 -4
  170. package/dist/sdk/terminal/tui/skillInvocation.d.ts +21 -2
  171. package/dist/sdk/terminal/tui/skillInvocation.js +31 -11
  172. package/dist/sdk/terminal/tui/theme.d.ts +9 -0
  173. package/dist/sdk/terminal/tui/theme.js +9 -0
  174. package/dist/sdk/terminal/tui/variantCommands.d.ts +32 -0
  175. package/dist/sdk/terminal/tui/variantCommands.js +359 -0
  176. package/dist/sdk/terminal/variantControl.d.ts +24 -0
  177. package/dist/sdk/terminal/variantControl.js +145 -0
  178. package/dist/sdk/tools/askUser.js +1 -1
  179. package/dist/sdk/tools/defaultSkills.d.ts +19 -0
  180. package/dist/sdk/tools/defaultSkills.js +27 -1
  181. package/dist/sdk/tools/definitions.js +1 -1
  182. package/dist/sdk/tools/dispatch.d.ts +1 -1
  183. package/dist/sdk/tools/dispatch.js +24 -11
  184. package/dist/sdk/tools/spawnSubagent.d.ts +1 -1
  185. package/dist/sdk/tools/spawnSubagent.js +4 -2
  186. package/dist/sdk/tools/todo.js +2 -1
  187. package/dist/sdk/variant/store.d.ts +33 -1
  188. package/dist/sdk/variant/store.js +108 -3
  189. package/dist/sdk/worktrees/git.d.ts +2 -0
  190. package/dist/sdk/worktrees/git.js +8 -0
  191. package/dist/sdk/worktrees/snapshot.d.ts +16 -0
  192. package/dist/sdk/worktrees/snapshot.js +83 -0
  193. package/dist/sdk/world/actions.js +1 -1
  194. package/dist/terminal-opentui.js +5479 -1985
  195. package/dist/terminal-pi.js +1323 -499
  196. package/docs/README.md +1 -0
  197. package/docs/architecture/02-sessions-and-runs.md +131 -42
  198. package/docs/architecture/03-variants.md +24 -3
  199. package/docs/architecture/04-prompt.md +121 -18
  200. package/docs/architecture/05-refinement.md +32 -5
  201. package/docs/architecture/06-plugins-and-capabilities.md +13 -2
  202. package/docs/architecture/07-tools-and-gate.md +25 -4
  203. package/docs/architecture/08-memory-and-history.md +7 -3
  204. package/docs/architecture/09-accounts-and-connectors.md +22 -3
  205. package/docs/architecture/10-server-protocol.md +61 -1
  206. package/docs/architecture/11-terminal.md +135 -29
  207. package/docs/architecture/12-storage.md +17 -6
  208. package/docs/architecture/13-world-tools.md +36 -3
  209. package/docs/architecture/14-surfaces-and-parity.md +10 -6
  210. package/docs/architecture/15-remote-control.md +118 -0
  211. package/docs/architecture/README.md +6 -0
  212. package/docs/architecture/proposals/PROP-0041-bounded-work-slices.md +2 -0
  213. package/docs/architecture/proposals/PROP-0049-context-attribution.md +415 -0
  214. package/docs/architecture/proposals/PROP-0050-run-stop-codes-and-refusals.md +30 -0
  215. package/docs/architecture/proposals/PROP-0051-unfinished-run-handoff.md +110 -0
  216. package/docs/architecture/proposals/PROP-0052-terminal-refine-and-variant-switch.md +111 -0
  217. package/docs/architecture/proposals/README.md +4 -1
  218. package/docs/decisions/ADR-0032-compaction-run-checkpoints.md +3 -1
  219. package/docs/decisions/ADR-0039-progress-aware-stall-guards.md +4 -0
  220. package/docs/decisions/ADR-0048-required-skills-from-a-message.md +42 -0
  221. package/docs/decisions/ADR-0050-approved-window-screenshots.md +19 -0
  222. package/docs/decisions/ADR-0051-terminal-decision-wait.md +10 -0
  223. package/docs/decisions/ADR-0052-per-profile-subagent-budgets.md +25 -0
  224. package/docs/decisions/ADR-0053-no-repeated-work-guard.md +45 -0
  225. package/docs/decisions/ADR-0054-terminal-reply-heartbeat-and-stall.md +52 -0
  226. package/docs/decisions/ADR-0055-plan-output-repair.md +51 -0
  227. package/docs/decisions/ADR-0056-remote-control.md +53 -0
  228. package/docs/decisions/ADR-0057-structured-plan-outcomes.md +39 -0
  229. package/docs/decisions/ADR-0058-ask-user-only-plan-clarification.md +36 -0
  230. package/docs/decisions/ADR-0059-run-diagnostic-evidence.md +35 -0
  231. package/docs/decisions/ADR-0060-approvals-are-controls.md +40 -0
  232. package/docs/decisions/ADR-0061-strict-plugin-command-namespaces.md +41 -0
  233. package/docs/decisions/ADR-0062-shared-account-state.md +67 -0
  234. package/docs/decisions/ADR-0063-unfinished-work-handoffs.md +34 -0
  235. package/docs/decisions/ADR-0064-account-model-fallback-on-resume.md +79 -0
  236. package/docs/decisions/ADR-0065-variant-switch-at-turn-boundaries.md +31 -0
  237. package/docs/decisions/ADR-0066-guided-refinement-from-turn-snapshots.md +37 -0
  238. package/docs/decisions/ADR-0067-cache-stable-compaction-checkpoint.md +54 -0
  239. package/docs/decisions/ADR-0068-scope-and-completion-report.md +57 -0
  240. package/docs/decisions/ADR-0069-stop-gate-and-finish.md +130 -0
  241. package/docs/decisions/ADR-0070-terminal-slice-continuation.md +46 -0
  242. package/docs/decisions/ADR-0071-completion-check.md +104 -0
  243. package/docs/decisions/ADR-0072-codex-prompts-and-goal.md +105 -0
  244. package/docs/doctor.md +2 -0
  245. package/docs/parity.md +32 -14
  246. package/docs/releases/1.3.1-unstable.2.md +11 -0
  247. package/docs/releases/1.3.1-unstable.3.md +54 -0
  248. package/docs/releases/1.3.1-unstable.4.md +56 -0
  249. package/docs/releases/1.3.1-unstable.5.md +53 -0
  250. package/docs/releases/1.3.1-unstable.6.md +31 -0
  251. package/docs/releases/1.3.1-unstable.7.md +17 -0
  252. package/docs/releases/1.3.1-unstable.8.md +19 -0
  253. package/docs/releases/1.3.1-unstable.9.md +54 -0
  254. package/docs/study/00-index.md +3 -0
  255. package/docs/study/STUDY-0004-turn-end-controls.md +123 -0
  256. package/docs/terminal-tui.md +117 -34
  257. package/package.json +3 -1
  258. package/dist/sdk/tools/checkpoint.d.ts +0 -27
  259. package/dist/sdk/tools/checkpoint.js +0 -154
package/CHANGELOG.md CHANGED
@@ -2,6 +2,261 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - **Codex's prompts and `/goal`; the completion check moves behind `/goal` (ADR-0072).**
6
+ - **Ordinary replies.** No model-judged check runs on them. The todo gate stays and says the list
7
+ is progress, not the limit of the work; `TODO_GUIDANCE` now says the request is the scope.
8
+ - **Prompt.** A person's own session reads Codex's autonomy and persistence, when-to-ask,
9
+ steering and compaction, and writing-style rules as separate sections, and a longer reporting
10
+ section: unfinished work says so on the first line, with the reason and the next step.
11
+ `ask_user` is never used to ask permission, and no answer means continue.
12
+ - **Failures from outside the session.** A test or error that does not come from the session's
13
+ work is reported with its command and output, not fixed, unless the person asks. It stays off
14
+ the todo list, and it is a reason to stop that the autonomy rules name.
15
+ - **`/goal <objective>`.** A long run the person starts. Codex's `get_goal` and `update_goal`,
16
+ continuation, round-cap and edit prompts, `blocked` after the same blocker on three turns, and
17
+ brakes for idle, failing and erroring rounds. `/goal edit|pause|resume|clear`, a footer label,
18
+ Esc pauses. Caps: 30 rounds or 8 hours (`--rounds`, `--hours`).
19
+ - **A completion claim is checked** once by the same model at low effort with a fresh context.
20
+ `sessions.run` takes `goal`; `run.json` records `goalMode`.
21
+ - **Fixed.** The check sends a session id, so opencode-go no longer answers 400 `MissingSessionID`.
22
+ - Adapted from OpenAI Codex (Apache-2.0); see `NOTICE.md`.
23
+ - **A completion check replaces `finish` (ADR-0071; the every-reply check is superseded by ADR-0072).**
24
+ - **The check.** When a reply that did work ends with its todo list closed or absent, the run's
25
+ own model, at low effort and with a fresh context, judges the person's request against what the
26
+ reply did: `done`, `continue` (the reply is sent back with the reason and next step), or
27
+ `needs_person`. The request is the goal; there is no `/goal` command.
28
+ - **Shared cap.** It shares the stop gate's cap of three nudges per reply and its no-progress rule.
29
+ - **Usage and failure.** Its request counts in the run's usage, and any failure leaves the reply
30
+ as it was.
31
+ - **`finish` is removed.** A live GPT 6 Luna run used `needs_decision` after 23 seconds to ask
32
+ something the handoff already answered. Only the check can now decide that the person is needed.
33
+ - **Prompt.** The `role` paragraph names which decisions are the agent's own, says a document the
34
+ request points to is the request, and says a question the request or files already answer is not
35
+ a question for the person. Its budget rises from 1,500 to 2,200 characters, so it fits uncut with
36
+ the subagent paragraph.
37
+ - **Kill switches.** `XINGULAR_STOP_GATE=off` and `XINGULAR_COMPLETION_CHECK=off` at launch switch a
38
+ layer off, for experiments.
39
+ - **The model is told it has `edit` and `write`.** Pi's `createEditTool` and `createWriteTool` drop
40
+ the definition's prompt line and guidelines, and Pi lists only tools with a prompt line, so every
41
+ terminal and headless run's system prompt named only `read` and `bash`. Models edited files
42
+ through shell scripts instead: one 2-hour terminal run made 156 script edits (14 failed) and no
43
+ `edit` call. `createWorkspaceFileTools` now restores the prompt line and guidelines, as Pi's own
44
+ `createBashTool` does, for both the terminal and the runner. The stable prefix changes once.
45
+ - **A plan no longer leaks its tools into normal mode.** A terminal plan request narrows the active
46
+ tools, and Pi records the restored normal set only with the next request. A rebuild before then
47
+ (a new runtime, resume, switch, fork or tree navigation) replayed the plan set, so normal work ran
48
+ without `edit`, `write`, browser and connected-app tools. One recorded session implemented a whole
49
+ plan that way. The terminal now marks each plan request in the session and restores the normal
50
+ set after any rebuild.
51
+ - **Terminal replies continue across work slices (ADR-0070).** A terminal reply that reaches its
52
+ 320-call or 60-minute budget after doing work now continues in place as the next slice, with a
53
+ checkpoint and a notice, up to 8 slices, instead of waiting for "continue" and re-sending the
54
+ whole context uncached. Fruitless, blocked, failed, aborted and plan slices still stop.
55
+ `XINGULAR_WORK_SLICE` also accepts key=value pairs such as `maxToolCalls=15,maxSlices=3`.
56
+ - **One copy of each credential: no more `invalid_grant` from terminals.** A terminal's Pi kept the
57
+ account's tokens in `auth.json` under its own lock while the host, its subagents and usage probes
58
+ refreshed the same token in the Keychain under another, and `terminalEnd` copied the file back
59
+ over whatever the Keychain held. OpenAI rotates refresh tokens, so whichever side refreshed second
60
+ failed with `invalid_grant` and the account needed a new sign-in. A terminal now reads and refreshes
61
+ through the host store (`accounts.credentials.*`, INV-ACC-5), holding its lock for the refresh. An
62
+ `auth.json` left by an older terminal is folded in, newest token first.
63
+ - **A stalled terminal reply is recorded as `stalled`.** Pi's abort reports back through
64
+ `terminal.interrupt` like a person's Esc, which closed the run as `user_abort` before the reply
65
+ settled as `stalled`; one silent 15-minute hang was recorded as the person's abort. The interrupt
66
+ now carries the stall. An interrupt also ends a settling reply's wait for its subagents.
67
+
68
+ - **A reply can no longer quietly stop with work open (ADR-0069).**
69
+ - **Stop gate.** In attended top-level runs, terminal included, a reply that ends while its todo
70
+ list has open items is sent back to the model, naming the items, up to three times per reply,
71
+ and never after a nudge that produced no work.
72
+ - **`finish`.** Added here as the one explicit way to stop with work open; removed again by ADR-0071
73
+ above.
74
+ - **Honest stop codes.** Such a reply settles `interrupted` with the new stop codes `needs_person`
75
+ or `unfinished`, never `completed`, with a checkpoint the harness writes from the todo list,
76
+ files and checks.
77
+ - **`checkpoint_write` is removed.** A run used it as a sign-off and stopped with work open. At a
78
+ work-slice budget the harness now writes the checkpoint itself.
79
+ - **One budget per reply.** The work-slice budget now covers the whole reply: Pi's own
80
+ continuations (nudges, delivered subagent results, plan repair) no longer reset it.
81
+ - **Prompt wording.** The texts that read as permission to stop were rewritten: the todo guidance's
82
+ "final update before your final reply", and `## What would make this complete` "when the run
83
+ could be more complete".
84
+ - **Subagents.** `spawn_subagent` now returns the child's tools, and the read-only profiles say up
85
+ front when a brief needs a tool they lack.
86
+ - **Hosts.** Accept the two new stop codes and offer Continue for them.
87
+ - **Restart required.** A live terminal session keeps the code it started with, so restart it to
88
+ get the gate.
89
+ - Do the job the request implies, and report it apart from the request. A standard session's role
90
+ paragraph now sets the scope of the work — the obvious adjacent step, what the work itself exposes,
91
+ the check it needs, inside the working folder and away from what a person must decide (a deploy, a
92
+ secret, remote data, money), without asking first inside those bounds — and the reporting guidance
93
+ requires two headings when they apply: `## Beyond what you asked` and
94
+ `## What would make this complete` (ADR-0068). The reporting budget rises from 2,000 to 2,400
95
+ characters so both fit uncut. All of it is stable-prefix text, so the cached prefix changes once
96
+ per session.
97
+ - Say in the prompt when a reply may end. The standard session's role paragraph, the opening of the
98
+ reporting guidance and the todo guidance now say that an open todo item, a passing check or a
99
+ partial result is not a reason to end the turn, and name the reasons that are: the request is done,
100
+ the work-slice guard hands the reply back, a person's decision is needed, or the person interrupts.
101
+ ADR-0069 below now enforces it in the runner. A sweep of 822 runs in seven days found 207 that ended with work left
102
+ (137 within 30 tool calls, median 17, and 191 with no checkpoint), which is what the wording is
103
+ for. All three texts are in the stable prefix, so this changes the cached prefix once.
104
+ - Reword the final-reply guidance so the outcome leads and structure follows what the answer needs. The
105
+ reporting guidance is part of every request's stable prefix, so this changes the cached prefix.
106
+ - Keep the provider cache working after a compaction (ADR-0067). The compaction checkpoint now arms only
107
+ for a compaction during the running reply, is built once, and sits right after the summary instead
108
+ of being rebuilt at the end of every request. A request after a compaction is again the previous
109
+ request plus new items, so Codex WebSocket continuation and prefix caching apply. Before, every later
110
+ turn of a compacted session resent its whole context: one measured session fell from 94–99% to
111
+ 18–24% cache hits after its first compaction.
112
+ - Flag a low prompt-cache hit rate in the terminal's composer status bar. `R<percentage>%` now covers the
113
+ last 10 model responses instead of the whole session (`recentCacheUsage`, `CACHE_HIT_WINDOW`), and
114
+ gets a yellow `⚠` below 70 percent and a red one below 40 percent. Each drop to a worse level posts
115
+ one transcript notice. A window of one response, or one with no cache reads or writes, is not judged
116
+ (`cacheHitLevel`, `CACHE_HIT_WARNING_PERCENT`, `CACHE_HIT_CRITICAL_PERCENT`).
117
+
118
+ - Refine a variant from the terminal and keep checkpoints of it (PROP-0052, ADR-0065, ADR-0066).
119
+ `/refine [what to look at]` replays the latest request typed in this chat from a snapshot of the
120
+ folder as that turn found it, in throwaway shared clones, after a confirmation that shows the run
121
+ count and models; it runs in the background, and `/refine review` shows every candidate's changes
122
+ and output and adopts any of them. Guidance reaches improvers and composers only, never the blind
123
+ selector. Task runs default to this chat's model; `--model` sets the improver's, and an adopted
124
+ version records the model it was tuned on. `/variant` switches this conversation to another
125
+ version at the next turn (resuming the same conversation), restores, compares, tags, and takes
126
+ single components back from an earlier version. New methods: `refine.fromRun`,
127
+ `refine.candidateDiff`, `refine.candidateOutput`, `variants.tag|untag|tags|resolve|revert`. Run
128
+ records gain `workspaceSnapshot`, version records `tunedFor`, and scopes `tags.json`.
129
+
130
+ - Start a conversation this account cannot use on the account's newest selection. A resumed
131
+ conversation keeps its model while the account offers it and holds its provider's credentials;
132
+ otherwise the terminal starts it on the mode's choice, then normal's, then the newest selection in
133
+ any mode, with that selection's effort, writes the model change into the conversation, and says in
134
+ one notice which model it replaced. A fallback is never saved as the person's choice, and with no
135
+ usable saved model Pi's own fallback message stands (ADR-0064).
136
+
137
+ - Make unfinished-work handoffs actionable: the stable reporting guidance now names the person’s
138
+ concrete decision or the next action and its owner for each material blocker, without imposing a
139
+ fixed heading (PROP-0051, ADR-0063).
140
+
141
+ - Share the account sign-in between `npm run dev` and the installed `xagent`. A standalone launch
142
+ can now take its account identity from another state directory with `--account-state <dir>`
143
+ (`HarnessOptions.accountsDir` plus that state's `secrets.json`), and `npm run dev` passes the
144
+ installed one, so one provider sign-in serves both while development keeps its own data,
145
+ approvals and plugin trust (ADR-0062).
146
+
147
+ - Require owner-prefixed plugin commands on terminal and structured sessions. Plugin-owned prompt
148
+ templates join extension commands under `/<owner-prefix>:<name>`, with no bare plugin aliases.
149
+ A package can select a root template with `harness.defaultPrompt`; owner and route collisions fail
150
+ closed. Standalone templates, `/skill:<name>` and core commands remain (ADR-0061).
151
+
152
+ - Make an approval a control, never a typed permission. The compiled guidance now tells the model to
153
+ call the tool, the Harness pauses that exact call (`waiting_for_approval`), and Allow resumes it in
154
+ the same turn; a denial returns a tool result on the still-running turn and says so, instead of
155
+ inviting another prose request. Nothing outside the workspace changes before the click, and Full
156
+ Permission remains the standing bypass (INV-GATE-9, ADR-0060).
157
+
158
+ - Record structured tool refusals and run stop codes, and expose them in trajectory search and the
159
+ terminal trajectory page. Compaction events include available token measurements; older run
160
+ records remain readable without these fields.
161
+
162
+ - Keep a refused question answer in the terminal. A choice, note or typed answer that the Harness
163
+ would reject now stays in the dock with an inline reason, instead of closing the form and losing the
164
+ draft; the reason names the question and the field (selection, typed answer or note), and the answer
165
+ is checked against the server rule before it is sent. The terminal was previously reopening an empty
166
+ question after any rejection, so a second Continue skipped everything.
167
+
168
+ - Scroll a `/btw` answer taller than its block. PageUp/PageDown now reach the side-question dock
169
+ while it is open, and the mouse wheel over the block browses it too; before this the transcript
170
+ consumed those keys, so the block's `PgUp/PgDn/wheel browse` hint did nothing. When the answer fits, the
171
+ keys scroll the transcript as before.
172
+
173
+ - Drop the context-use reading from the terminal's composer status line, so it no longer ends the
174
+ token group with a figure such as `6.6%/?`. The line keeps the project and branch, account, model
175
+ and effort, and input/cache hit rate/output tokens; the share of the window stays on the `/context`
176
+ page. Both the OpenTUI status bar and the exported `tui/status` band lose the reading.
177
+
178
+ - Render the `/btw` side answer as Markdown instead of plain text. Headings, emphasis, lists,
179
+ quotes, links, tables and fenced code use the theme's markdown colours, and a streaming answer
180
+ re-renders in place. Terminal control sequences in model output are still removed.
181
+
182
+ - Add `/remote-control` (alias `/rc`): continue a terminal session from a phone or iPad, as Claude
183
+ Code's `/rc` does, without a cloud relay. The harness serves a small phone page on the computer's
184
+ Tailscale address, or its private Wi-Fi address, and the terminal shows a QR code for a one-device
185
+ pairing link. The person at the terminal allows each device; a paired phone then sends messages,
186
+ watches the reply stream, stops it, and answers approvals and questions through the same paths
187
+ the terminal uses. Every body is sealed with a key that reaches the phone only in the QR code's
188
+ fragment, keys live in memory, and remote control ends with the session. `xagent --remote-control`
189
+ turns it on at start; `/rc off` stops it. Terminal runs now also record streamed `message.delta`
190
+ events. New dependencies: `tweetnacl`, `uqr` (ADR-0056, page 15).
191
+
192
+ - Recover a plan run whose reply loses its plan block. An attended top-level plan run now makes one
193
+ hidden format-repair turn in the same run, asking the model to re-send its own plan in one complete
194
+ block; a failed repair leaves the run completed and the terminal shows a warning instead of a plan
195
+ choice. The plan-research children, commands, probes, improvers, reflections and other unattended
196
+ runs are unchanged (ADR-0055).
197
+
198
+ - A live terminal reply now reports a heartbeat every 30 seconds, and one that produces nothing but
199
+ heartbeats for 15 minutes is ended as `interrupted` with reason `stalled` instead of showing a run
200
+ that never settles. A running tool gets 30 minutes and an unanswered approval or question is never
201
+ cut short. Before this, a terminal reply reported no heartbeat at all, so the run sweep waited the
202
+ full 30-minute silence window and recorded `owner_gone` while the process was alive (ADR-0054).
203
+
204
+ - Stop refusing repeated work. A reply is no longer refused, or ended, for calling the same tool
205
+ with the same arguments three times, for a Bash check that keeps failing, or for editing one path
206
+ more than four times: those calls are ordinary work, and the reply budget is the single bound. The
207
+ 320-call/60-minute budget, its checkpoint handoff, slice continuation and the three-compaction
208
+ thrash rule are unchanged, and the `stuck` checkpoint reason stays readable in existing runs
209
+ (ADR-0053).
210
+
211
+ - Make a skill named in a message required for that request. `$name` is a skill invocation at any
212
+ word start, not only as the first token: `Launch.requiredSkills` carries it and the compiler
213
+ renders a built-in dynamic `required-skills` section (order 52, 12,000 characters) from the pinned
214
+ variant's `SKILL.md`, naming an unavailable skill honestly and falling back to the shipped
215
+ `plugin-authoring` skill. It changes no tool or permission, and it belongs to the request, so an
216
+ identical one is delivered again; structured sessions deliver it through `sessionLaunch` and the
217
+ terminal appends the same text as a hidden `xingular-required-skills` message
218
+ (`requiredSkillsText`). The terminal no longer rewrites a leading `$name` to `/skill:name`, and its
219
+ `$` palette opens at the caret and inserts there, keeping the rest of the draft (ADR-0048).
220
+
221
+ - Bound delegation per run and per profile. `spawn_subagent` and `wait_subagents` still exist, but a
222
+ run now starts at most four distinct child conversations: two `worker`, three `explorer`, one of
223
+ any other named profile and one with no profile. The parent's `subagents` option overrides them
224
+ (`maxChildren`, `maxByProfile`, `maxOther`, `maxUnprofiled`, clamped to 0–50), so a host and the
225
+ terminal receive the same defaults; `Subagents.spawn` refuses a child past a limit with an
226
+ `invalid_request` that tells the model to do the work itself, and starts no run. The count covers
227
+ the runs the parent was continued from, continuing a stopped child costs no slot, and a concurrent
228
+ spawn reserves its slot before it launches (ADR-0052).
229
+
230
+ - Record where a request's characters went. `renderSized` returns the prompt and each section's
231
+ size, `Delivery.sizes` stores them on the recorded pack, and `Source.chars` attributes a variant's
232
+ tool guidance inside the tools section, so `context.attribution` (`terminal.context` in the
233
+ terminal) can return one row per contributor with its estimated tokens and share of the window,
234
+ reconciled to the provider's measured total, plus one row's text. `context.snapshot` also records
235
+ the compaction headroom the run was held to (`compaction: { enabled, reserveTokens }`) from Pi's
236
+ own settings.
237
+
238
+ - Define an opt-in approved-window screenshot contract. `computer_screenshot` in
239
+ `src/computer/screenshot.ts` takes a host backend that captures exactly one currently approved
240
+ window, excludes the desktop, other windows and overlapping overlays, and refuses with
241
+ `COMPUTER_SCREENSHOT_UNAVAILABLE` instead of falling back to a display capture. It goes through
242
+ the ordinary tool gate and is not plan-mode safe; the standalone terminal has no backend, and the
243
+ existing macOS host capture has not adopted the contract (ADR-0050).
244
+
245
+ - Watch approvals and questions through `terminal.pending.wait`: a control-key-protected revision
246
+ snapshot that returns as soon as the pending set changes and otherwise waits at most 20 seconds,
247
+ waking on additions, removals and disposal. `terminal.pending` stays available, the client
248
+ resynchronizes after errors, and no persisted state or public protocol changes (ADR-0051).
249
+
250
+ - Swap the OpenTUI send keys back. `Return` sends, or queues a follow-up behind a running reply, and
251
+ `Cmd+Return`, `Ctrl+Return` or `Alt+Return` steers that reply. The `app.message.followUp` action is
252
+ `app.message.steer` again, so a `keybindings.json` entry under the newer name needs renaming.
253
+
254
+ - Keep a stray mouse report out of input. When the terminal delivers a mouse report in two pieces
255
+ across the input parser's timeout, its `<button;column;row>` tail is dropped instead of being
256
+ typed into the composer or a single-line field, so a scroll can never become a run's prompt or a
257
+ filter. Text typed at human speed is never touched, pastes are never rewritten, and the Trajectory
258
+ page no longer prints a recorded mouse report.
259
+
5
260
  - Give top-level sessions a name and a current-state prompt. An unnamed session derives a
6
261
  provisional six-word name from its first substantive request; greetings and short replies stay
7
262
  unnamed, and the model can revise the name. Each top-level run also receives a request-scoped
@@ -141,7 +396,7 @@ The first published release of the 1.1 line, and npm `latest`. It follows the 1.
141
396
 
142
397
  - Keep the OpenTUI home screen when a notice arrives before any conversation, such as `Unknown command: /tihnk`. The notice shows beneath the product mark instead of replacing it, and the composer keeps its "Ask anything…" placeholder.
143
398
 
144
- - Swap the OpenTUI send keys: `Return` now queues a prompt behind a running reply (it still sends when idle), and `Cmd+Return` steers the reply mid-run. `Alt+Return` also steers, for terminals that do not report Cmd. The `app.message.followUp` action is renamed `app.message.steer`, so a `keybindings.json` entry under the old name needs renaming.
399
+ - Swap the OpenTUI send keys back: `Return` sends, or steers a running reply, and `Cmd+Return`, `Ctrl+Return` or `Alt+Return` queues a follow-up. The `app.message.steer` action is renamed `app.message.followUp` again, so a `keybindings.json` entry under the older name needs renaming. Pending steering, follow-up and deferred plan/Bash inputs show above the working line with their delivery type, a queued plan or `!` command acts as a barrier that later inputs wait behind, and `Alt+Up` restores queued text to the draft.
145
400
 
146
401
  - Draw the OpenTUI `select`, `confirm`, `input` and `editor` dialogs, including `/effort` and the Thinking setting, as the same flat centered panel on the scrim that `/model` and the other pages use, instead of a rounded bordered box. The box clipped the heading's `Esc` hint and the option count; centered dialogs now cap their height at the rows the overlay shows.
147
402
 
package/NOTICE.md CHANGED
@@ -58,3 +58,29 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58
58
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
59
59
  SOFTWARE.
60
60
  ```
61
+
62
+ ## OpenAI Codex
63
+
64
+ The standard session prompt (`src/prompt/standard.ts`: autonomy and persistence, when to ask the
65
+ person, steering and compaction, writing style), the final-reply rules in `REPORTING_GUIDANCE`
66
+ (`src/prompt/compile.ts`), the `/goal` prompts and tool descriptions (`src/sessions/goalPrompts.ts`,
67
+ `src/sessions/goal.ts`), the goal brakes and status text, and the `/goal` command
68
+ (`src/terminal/tui/goalCommand.ts`) adapt text and design from OpenAI Codex, mainly:
69
+
70
+ - `codex-rs/models-manager/models.json` (`instructions_template` of `gpt-6.1-sol` and `gpt-6-luna`);
71
+ - `codex-rs/ext/goal/templates/goals/{continuation,budget_limit,objective_updated}.md`;
72
+ - `codex-rs/ext/goal/src/{spec,tool,accounting,runtime,api}.rs`;
73
+ - `codex-rs/tui/src/{goal_display,slash_dispatch,goal_menu}.rs`;
74
+ - `codex-rs/collaboration-mode-templates/templates/default.md` (the `ask_user` rule).
75
+
76
+ Upstream: https://github.com/openai/codex (OpenAI Codex, Copyright 2025 OpenAI)
77
+
78
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except
79
+ in compliance with the License. You may obtain a copy of the License at
80
+ https://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in
81
+ writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
82
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Changes from upstream: ported from
83
+ Rust to TypeScript for Pi; text about Codex's own channels and tools (commentary channel,
84
+ `apply_patch`, `functions.exec`, apps, plugins, visualizations) left out; the goal's token budget
85
+ became rounds and hours; `update_plan` became `todo_write`; completing a goal is a claim that the
86
+ harness checks; the model cannot create a goal.
package/README.md CHANGED
@@ -37,7 +37,7 @@ index](docs/README.md) links the architecture and other project records.
37
37
 
38
38
  ### Session options for applications
39
39
 
40
- - Interactive sessions offer `spawn_subagent` and `wait_subagents` by default. `subagents: null` disables them; `{ maxDepth }` configures native nesting (default one, maximum three), independently of the host caller depth. Unattended sessions remain disabled unless the host explicitly supplies subagent options. A frozen capability set can narrow these tools further.
40
+ - Interactive sessions offer `spawn_subagent` and `wait_subagents` by default. `subagents: null` disables them; `{ maxDepth }` configures native nesting (default one, maximum three), independently of the host caller depth. `{ maxChildren, maxByProfile, maxOther, maxUnprofiled }` bounds breadth: by default a run starts at most four distinct child conversations, two `worker`, three `explorer`, one of any other named profile and one with no profile. Unattended sessions remain disabled unless the host explicitly supplies subagent options. A frozen capability set can narrow these tools further.
41
41
  - `harness.subagents.spawn({ parentRunId, brief, agent?, tools?, wait? })` opens a fresh child of the same caller with no wider capabilities. `agent` names an agent profile (below). It returns `{ runId, nativeSessionId, agent?, unavailableTools? }` once open; `wait: true` also waits for settlement. `harness.subagents.wait({ parentRunId, runIds? })` joins selected direct children, or the current children when omitted, and returns their outcomes. `results` reads the same bounded outcome records without waiting. RPC exposes `subagents.spawn`, `subagents.wait`, and `subagents.results`; `sessions.spawnSubagent` remains a compatibility alias.
42
42
  - **Agent profiles** (PROP-0029) are what a subagent starts from: the built-in `worker` (reads, edits, writes, runs commands) and `explorer` (reads only), a person's own `<data root>/agents/<name>.md`, a repository's `<project>/.xingular/agents/<name>.md`, and the variant's c5 subagents, later ones winning. A profile is Markdown with frontmatter (`description`, `color`, `tools`, `plugins`, `variant`, `model`, `effort`) and its body is the role. It only narrows the parent's tools and plugins. `listProfiles`, `resolveProfile`, `createProfile` and `removeProfile` (RPC `agents.list|get|create|remove`) read and write them, and the child's `RunRecord.profile` names the one it used.
43
43
  - The model's `spawn_subagent` returns immediately by default; `wait: true` returns an inline result. `wait_subagents` joins selected children. The SDK and standalone terminal share this execution service. Terminal calls use its private control channel, including when connected apps are disabled.
@@ -294,11 +294,13 @@ npm run dev
294
294
 
295
295
  `npm run dev` rebuilds the CLI and opens the Harness terminal in the current working directory.
296
296
  It uses separate development directories by default: `~/.xingular-harness-dev/data` and
297
- `~/.xingular-harness-dev/state`. This keeps development harness data and device settings—including
298
- accounts, Pi settings, approvals, and connections—separate from the installed command. Press
299
- `/quit`, Ctrl+C or Ctrl+D to close it. Override either directory with `--data <dir>` or
300
- `--state <dir>`; for example: `npm run dev -- --data <dir> --state <dir>`. An omitted option keeps
301
- its development specific default.
297
+ `~/.xingular-harness-dev/state`, so development harness data, approvals, plugin trust and
298
+ connections stay separate from the installed command. It signs in as the installed command's
299
+ accounts, though: one provider sign-in serves both launches. Press `/quit`, Ctrl+C or Ctrl+D to
300
+ close it. Override either directory with `--data <dir>` or `--state <dir>`; choose the accounts a
301
+ launch signs in as with `--account-state <dir>`, for example
302
+ `npm run dev -- --account-state ~/.xingular-harness-dev/state` for a fully separate identity. An
303
+ omitted option keeps its development specific default.
302
304
 
303
305
  The OpenTUI/Solid frontend is the only terminal. Install Bun 1.3.14 or newer and run
304
306
  `npm run build:tui` (or `npm run build`); without Bun the build fails rather than producing a
@@ -404,10 +406,13 @@ still be removed; that session then asks for another account the next time it st
404
406
  The installed standalone command defaults to `~/.xingular-harness/data` and
405
407
  `~/.xingular-harness/state`; `npm run dev` instead defaults to the separate
406
408
  `~/.xingular-harness-dev/data` and `~/.xingular-harness-dev/state`. Override either with
407
- `--data <dir>` and `--state <dir>`. Session history is stored per working directory and can be
408
- reopened with the terminal's `/resume` command. The explicit `terminal` command is an alias for
409
- the default launch. Use `--help` to see the commands; `serve` remains the host-facing RPC service
410
- for integrations such as Xingular Agent/App.
409
+ `--data <dir>` and `--state <dir>`. A launch signs in as the accounts kept in the state directory
410
+ it uses; `--account-state <dir>` takes them from another state directory instead (its `accounts`
411
+ folder and its `secrets.json`), which is how `npm run dev` reaches the installed command's sign-in.
412
+ Session history is stored per working directory and can be reopened with the terminal's `/resume`
413
+ command. The explicit `terminal` command is an alias for the default launch. Use `--help` to see
414
+ the commands; `serve` remains the host-facing RPC service for integrations such as Xingular
415
+ Agent/App.
411
416
 
412
417
  ## Storage
413
418