@xingular/harness 1.3.1-unstable.4 → 1.3.1-unstable.8

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 (150) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +14 -9
  3. package/dist/cli.js +1734 -796
  4. package/dist/sdk/accounts/choices.d.ts +18 -0
  5. package/dist/sdk/accounts/choices.js +27 -0
  6. package/dist/sdk/cli.js +4 -0
  7. package/dist/sdk/commands/extensionOwners.d.ts +4 -0
  8. package/dist/sdk/commands/extensionOwners.js +17 -0
  9. package/dist/sdk/commands/list.js +15 -2
  10. package/dist/sdk/commands/promptLoader.d.ts +5 -0
  11. package/dist/sdk/commands/promptLoader.js +76 -0
  12. package/dist/sdk/commands/promptRoutes.d.ts +13 -0
  13. package/dist/sdk/commands/promptRoutes.js +46 -0
  14. package/dist/sdk/commands/registry.d.ts +14 -0
  15. package/dist/sdk/commands/registry.js +2 -0
  16. package/dist/sdk/commands/runtimeRouter.d.ts +4 -0
  17. package/dist/sdk/commands/runtimeRouter.js +48 -0
  18. package/dist/sdk/computer/boundary.d.ts +40 -0
  19. package/dist/sdk/computer/boundary.js +79 -0
  20. package/dist/sdk/computer/contracts.d.ts +127 -0
  21. package/dist/sdk/computer/contracts.js +13 -0
  22. package/dist/sdk/computer/control.d.ts +34 -0
  23. package/dist/sdk/computer/control.js +112 -0
  24. package/dist/sdk/computer/terminalCapture.d.ts +26 -0
  25. package/dist/sdk/computer/terminalCapture.js +64 -0
  26. package/dist/sdk/computer/volatileImages.d.ts +9 -0
  27. package/dist/sdk/computer/volatileImages.js +50 -0
  28. package/dist/sdk/context/runDetails.d.ts +16 -0
  29. package/dist/sdk/context/runDetails.js +22 -0
  30. package/dist/sdk/doctor/checks.js +3 -0
  31. package/dist/sdk/doctor/probe.js +8 -6
  32. package/dist/sdk/harness.d.ts +8 -0
  33. package/dist/sdk/harness.js +7 -4
  34. package/dist/sdk/history/trajectory.js +2 -0
  35. package/dist/sdk/hub/hub.js +1 -1
  36. package/dist/sdk/hub/schema.d.ts +2 -2
  37. package/dist/sdk/plugins/manifest.d.ts +2 -0
  38. package/dist/sdk/plugins/manifest.js +1 -0
  39. package/dist/sdk/prompt/compile.d.ts +3 -1
  40. package/dist/sdk/prompt/compile.js +10 -7
  41. package/dist/sdk/refine/host.d.ts +9 -1
  42. package/dist/sdk/refine/host.js +29 -0
  43. package/dist/sdk/refine/prompts.d.ts +15 -0
  44. package/dist/sdk/refine/prompts.js +44 -0
  45. package/dist/sdk/refine/recursion.js +4 -4
  46. package/dist/sdk/refine/runner.d.ts +2 -0
  47. package/dist/sdk/refine/runner.js +2 -1
  48. package/dist/sdk/refine/serverMethods.js +4 -1
  49. package/dist/sdk/refine/service.d.ts +31 -0
  50. package/dist/sdk/refine/service.js +119 -4
  51. package/dist/sdk/refine/trajectory.js +7 -2
  52. package/dist/sdk/refine/types.d.ts +16 -0
  53. package/dist/sdk/remote/webClient.js +7 -3
  54. package/dist/sdk/server/methods.js +31 -1
  55. package/dist/sdk/sessions/compactionCheckpoint.d.ts +6 -1
  56. package/dist/sdk/sessions/compactionCheckpoint.js +34 -35
  57. package/dist/sdk/sessions/contracts.d.ts +141 -2
  58. package/dist/sdk/sessions/contracts.js +115 -3
  59. package/dist/sdk/sessions/planMode.d.ts +1 -1
  60. package/dist/sdk/sessions/planMode.js +7 -4
  61. package/dist/sdk/sessions/registry.d.ts +6 -2
  62. package/dist/sdk/sessions/registry.js +16 -13
  63. package/dist/sdk/sessions/runStore.d.ts +3 -1
  64. package/dist/sdk/sessions/runStore.js +26 -8
  65. package/dist/sdk/sessions/runner.d.ts +5 -5
  66. package/dist/sdk/sessions/runner.js +78 -15
  67. package/dist/sdk/sessions/sessions.js +35 -21
  68. package/dist/sdk/sessions/workSlice.d.ts +2 -0
  69. package/dist/sdk/sessions/workSlice.js +4 -3
  70. package/dist/sdk/terminal/client.d.ts +3 -0
  71. package/dist/sdk/terminal/client.js +13 -0
  72. package/dist/sdk/terminal/controller.d.ts +2 -0
  73. package/dist/sdk/terminal/controller.js +12 -6
  74. package/dist/sdk/terminal/opentui/theme.d.ts +2 -0
  75. package/dist/sdk/terminal/opentui/theme.js +4 -0
  76. package/dist/sdk/terminal/piExtension.js +73 -13
  77. package/dist/sdk/terminal/standalone.d.ts +6 -1
  78. package/dist/sdk/terminal/standalone.js +30 -3
  79. package/dist/sdk/terminal/terminals.d.ts +11 -1
  80. package/dist/sdk/terminal/terminals.js +58 -5
  81. package/dist/sdk/terminal/trajectory.js +2 -2
  82. package/dist/sdk/terminal/tui/commandPages.d.ts +1 -1
  83. package/dist/sdk/terminal/tui/commandPages.js +4 -2
  84. package/dist/sdk/terminal/tui/commands.js +29 -65
  85. package/dist/sdk/terminal/tui/modeChoices.d.ts +18 -0
  86. package/dist/sdk/terminal/tui/modeChoices.js +26 -1
  87. package/dist/sdk/terminal/tui/pages/contextPage.d.ts +30 -1
  88. package/dist/sdk/terminal/tui/pages/contextPage.js +109 -8
  89. package/dist/sdk/terminal/tui/pages/textPage.d.ts +17 -0
  90. package/dist/sdk/terminal/tui/pages/textPage.js +52 -0
  91. package/dist/sdk/terminal/tui/pages/trajectoryPage.d.ts +1 -0
  92. package/dist/sdk/terminal/tui/pages/trajectoryPage.js +12 -3
  93. package/dist/sdk/terminal/tui/runtime.js +60 -3
  94. package/dist/sdk/terminal/tui/sideQuestion.d.ts +3 -0
  95. package/dist/sdk/terminal/tui/sideQuestion.js +7 -1
  96. package/dist/sdk/terminal/tui/status.d.ts +0 -6
  97. package/dist/sdk/terminal/tui/status.js +1 -15
  98. package/dist/sdk/terminal/tui/variantCommands.d.ts +32 -0
  99. package/dist/sdk/terminal/tui/variantCommands.js +359 -0
  100. package/dist/sdk/terminal/variantControl.d.ts +24 -0
  101. package/dist/sdk/terminal/variantControl.js +145 -0
  102. package/dist/sdk/tools/definitions.js +1 -1
  103. package/dist/sdk/tools/dispatch.d.ts +1 -1
  104. package/dist/sdk/tools/dispatch.js +17 -3
  105. package/dist/sdk/variant/store.d.ts +33 -1
  106. package/dist/sdk/variant/store.js +108 -3
  107. package/dist/sdk/worktrees/git.d.ts +2 -0
  108. package/dist/sdk/worktrees/git.js +8 -0
  109. package/dist/sdk/worktrees/snapshot.d.ts +16 -0
  110. package/dist/sdk/worktrees/snapshot.js +83 -0
  111. package/dist/sdk/world/actions.js +1 -1
  112. package/dist/terminal-opentui.js +1643 -451
  113. package/dist/terminal-pi.js +179 -56
  114. package/docs/architecture/02-sessions-and-runs.md +33 -13
  115. package/docs/architecture/03-variants.md +24 -3
  116. package/docs/architecture/04-prompt.md +22 -11
  117. package/docs/architecture/05-refinement.md +32 -5
  118. package/docs/architecture/06-plugins-and-capabilities.md +13 -2
  119. package/docs/architecture/07-tools-and-gate.md +14 -0
  120. package/docs/architecture/08-memory-and-history.md +7 -3
  121. package/docs/architecture/09-accounts-and-connectors.md +13 -3
  122. package/docs/architecture/10-server-protocol.md +26 -3
  123. package/docs/architecture/11-terminal.md +50 -19
  124. package/docs/architecture/12-storage.md +12 -4
  125. package/docs/architecture/13-world-tools.md +19 -0
  126. package/docs/architecture/14-surfaces-and-parity.md +3 -3
  127. package/docs/architecture/README.md +2 -0
  128. package/docs/architecture/proposals/PROP-0049-context-attribution.md +7 -1
  129. package/docs/architecture/proposals/PROP-0050-run-stop-codes-and-refusals.md +30 -0
  130. package/docs/architecture/proposals/PROP-0051-unfinished-run-handoff.md +110 -0
  131. package/docs/architecture/proposals/PROP-0052-terminal-refine-and-variant-switch.md +111 -0
  132. package/docs/architecture/proposals/README.md +2 -0
  133. package/docs/decisions/ADR-0032-compaction-run-checkpoints.md +3 -1
  134. package/docs/decisions/ADR-0059-run-diagnostic-evidence.md +35 -0
  135. package/docs/decisions/ADR-0060-approvals-are-controls.md +40 -0
  136. package/docs/decisions/ADR-0061-strict-plugin-command-namespaces.md +41 -0
  137. package/docs/decisions/ADR-0062-shared-account-state.md +67 -0
  138. package/docs/decisions/ADR-0063-unfinished-work-handoffs.md +32 -0
  139. package/docs/decisions/ADR-0064-account-model-fallback-on-resume.md +79 -0
  140. package/docs/decisions/ADR-0065-variant-switch-at-turn-boundaries.md +31 -0
  141. package/docs/decisions/ADR-0066-guided-refinement-from-turn-snapshots.md +37 -0
  142. package/docs/decisions/ADR-0067-cache-stable-compaction-checkpoint.md +54 -0
  143. package/docs/doctor.md +2 -0
  144. package/docs/parity.md +18 -7
  145. package/docs/releases/1.3.1-unstable.5.md +53 -0
  146. package/docs/releases/1.3.1-unstable.6.md +31 -0
  147. package/docs/releases/1.3.1-unstable.7.md +17 -0
  148. package/docs/releases/1.3.1-unstable.8.md +19 -0
  149. package/docs/terminal-tui.md +48 -16
  150. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,80 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Reword the final-reply guidance so the outcome leads and structure follows what the answer needs. The
6
+ reporting guidance is part of every request's stable prefix, so this changes the cached prefix.
7
+ - Keep the provider cache working after a compaction (ADR-0067). The compaction checkpoint now arms only
8
+ for a compaction during the running reply, is built once, and sits right after the summary instead
9
+ of being rebuilt at the end of every request. A request after a compaction is again the previous
10
+ request plus new items, so Codex WebSocket continuation and prefix caching apply. Before, every later
11
+ turn of a compacted session resent its whole context: one measured session fell from 94–99% to
12
+ 18–24% cache hits after its first compaction.
13
+ - Flag a low prompt-cache hit rate in the terminal's composer status bar. `R<percentage>%` now covers the
14
+ last 10 model responses instead of the whole session (`recentCacheUsage`, `CACHE_HIT_WINDOW`), and
15
+ gets a yellow `⚠` below 70 percent and a red one below 40 percent. Each drop to a worse level posts
16
+ one transcript notice. A window of one response, or one with no cache reads or writes, is not judged
17
+ (`cacheHitLevel`, `CACHE_HIT_WARNING_PERCENT`, `CACHE_HIT_CRITICAL_PERCENT`).
18
+
19
+ - Refine a variant from the terminal and keep checkpoints of it (PROP-0052, ADR-0065, ADR-0066).
20
+ `/refine [what to look at]` replays the latest request typed in this chat from a snapshot of the
21
+ folder as that turn found it, in throwaway shared clones, after a confirmation that shows the run
22
+ count and models; it runs in the background, and `/refine review` shows every candidate's changes
23
+ and output and adopts any of them. Guidance reaches improvers and composers only, never the blind
24
+ selector. Task runs default to this chat's model; `--model` sets the improver's, and an adopted
25
+ version records the model it was tuned on. `/variant` switches this conversation to another
26
+ version at the next turn (resuming the same conversation), restores, compares, tags, and takes
27
+ single components back from an earlier version. New methods: `refine.fromRun`,
28
+ `refine.candidateDiff`, `refine.candidateOutput`, `variants.tag|untag|tags|resolve|revert`. Run
29
+ records gain `workspaceSnapshot`, version records `tunedFor`, and scopes `tags.json`.
30
+
31
+ - Start a conversation this account cannot use on the account's newest selection. A resumed
32
+ conversation keeps its model while the account offers it and holds its provider's credentials;
33
+ otherwise the terminal starts it on the mode's choice, then normal's, then the newest selection in
34
+ any mode, with that selection's effort, writes the model change into the conversation, and says in
35
+ one notice which model it replaced. A fallback is never saved as the person's choice, and with no
36
+ usable saved model Pi's own fallback message stands (ADR-0064).
37
+
38
+ - Make unfinished-work handoffs actionable: the stable reporting guidance now names the person’s
39
+ concrete decision or the next action and its owner for each material blocker, without imposing a
40
+ fixed heading (PROP-0051, ADR-0063).
41
+
42
+ - Share the account sign-in between `npm run dev` and the installed `xagent`. A standalone launch
43
+ can now take its account identity from another state directory with `--account-state <dir>`
44
+ (`HarnessOptions.accountsDir` plus that state's `secrets.json`), and `npm run dev` passes the
45
+ installed one, so one provider sign-in serves both while development keeps its own data,
46
+ approvals and plugin trust (ADR-0062).
47
+
48
+ - Require owner-prefixed plugin commands on terminal and structured sessions. Plugin-owned prompt
49
+ templates join extension commands under `/<owner-prefix>:<name>`, with no bare plugin aliases.
50
+ A package can select a root template with `harness.defaultPrompt`; owner and route collisions fail
51
+ closed. Standalone templates, `/skill:<name>` and core commands remain (ADR-0061).
52
+
53
+ - Make an approval a control, never a typed permission. The compiled guidance now tells the model to
54
+ call the tool, the Harness pauses that exact call (`waiting_for_approval`), and Allow resumes it in
55
+ the same turn; a denial returns a tool result on the still-running turn and says so, instead of
56
+ inviting another prose request. Nothing outside the workspace changes before the click, and Full
57
+ Permission remains the standing bypass (INV-GATE-9, ADR-0060).
58
+
59
+ - Record structured tool refusals and run stop codes, and expose them in trajectory search and the
60
+ terminal trajectory page. Compaction events include available token measurements; older run
61
+ records remain readable without these fields.
62
+
63
+ - Keep a refused question answer in the terminal. A choice, note or typed answer that the Harness
64
+ would reject now stays in the dock with an inline reason, instead of closing the form and losing the
65
+ draft; the reason names the question and the field (selection, typed answer or note), and the answer
66
+ is checked against the server rule before it is sent. The terminal was previously reopening an empty
67
+ question after any rejection, so a second Continue skipped everything.
68
+
69
+ - Scroll a `/btw` answer taller than its block. PageUp/PageDown now reach the side-question dock
70
+ while it is open, and the mouse wheel over the block browses it too; before this the transcript
71
+ consumed those keys, so the block's `PgUp/PgDn/wheel browse` hint did nothing. When the answer fits, the
72
+ keys scroll the transcript as before.
73
+
74
+ - Drop the context-use reading from the terminal's composer status line, so it no longer ends the
75
+ token group with a figure such as `6.6%/?`. The line keeps the project and branch, account, model
76
+ and effort, and input/cache hit rate/output tokens; the share of the window stays on the `/context`
77
+ page. Both the OpenTUI status bar and the exported `tui/status` band lose the reading.
78
+
5
79
  - Render the `/btw` side answer as Markdown instead of plain text. Headings, emphasis, lists,
6
80
  quotes, links, tables and fenced code use the theme's markdown colours, and a streaming answer
7
81
  re-renders in place. Terminal control sequences in model output are still removed.
package/README.md CHANGED
@@ -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