@xingular/harness 1.5.1-unstable → 1.6.0-unstable

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 (94) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/browser-extension/README.md +32 -0
  3. package/browser-extension/background.js +612 -0
  4. package/browser-extension/manifest.json +16 -0
  5. package/browser-extension/overlay.js +97 -0
  6. package/browser-extension/popup.css +19 -0
  7. package/browser-extension/popup.html +30 -0
  8. package/browser-extension/popup.js +101 -0
  9. package/browser-extension/site-access.js +63 -0
  10. package/dist/cli.js +1489 -680
  11. package/dist/sdk/browser/config.d.ts +3 -0
  12. package/dist/sdk/browser/config.js +2 -1
  13. package/dist/sdk/browser/extension/bridge.d.ts +55 -0
  14. package/dist/sdk/browser/extension/bridge.js +336 -0
  15. package/dist/sdk/browser/extension/session.d.ts +50 -0
  16. package/dist/sdk/browser/extension/session.js +321 -0
  17. package/dist/sdk/browser/index.d.ts +7 -2
  18. package/dist/sdk/browser/index.js +58 -25
  19. package/dist/sdk/browser/serverMethods.js +4 -1
  20. package/dist/sdk/browser/tools.d.ts +99 -2
  21. package/dist/sdk/browser/tools.js +6 -1
  22. package/dist/sdk/commands/registry.d.ts +5 -0
  23. package/dist/sdk/commands/registry.js +1 -0
  24. package/dist/sdk/harness.d.ts +4 -0
  25. package/dist/sdk/harness.js +1 -1
  26. package/dist/sdk/pi/retryPolicy.d.ts +19 -0
  27. package/dist/sdk/pi/retryPolicy.js +11 -0
  28. package/dist/sdk/prompt/compile.d.ts +0 -2
  29. package/dist/sdk/prompt/compile.js +2 -6
  30. package/dist/sdk/prompt/reporting.d.ts +1 -1
  31. package/dist/sdk/prompt/reporting.js +30 -13
  32. package/dist/sdk/prompt/standard.d.ts +1 -1
  33. package/dist/sdk/prompt/standard.js +1 -1
  34. package/dist/sdk/remote/webClient.js +6 -2
  35. package/dist/sdk/sessions/contracts.d.ts +2 -0
  36. package/dist/sdk/sessions/contracts.js +5 -1
  37. package/dist/sdk/sessions/planMode.d.ts +16 -6
  38. package/dist/sdk/sessions/planMode.js +59 -23
  39. package/dist/sdk/sessions/runner.js +14 -5
  40. package/dist/sdk/sessions/workSlice.d.ts +15 -1
  41. package/dist/sdk/sessions/workSlice.js +17 -9
  42. package/dist/sdk/terminal/controller.d.ts +6 -0
  43. package/dist/sdk/terminal/controller.js +44 -5
  44. package/dist/sdk/terminal/opentui/model.d.ts +0 -1
  45. package/dist/sdk/terminal/opentui/model.js +3 -4
  46. package/dist/sdk/terminal/piExtension.js +7 -2
  47. package/dist/sdk/terminal/stallWatch.d.ts +18 -0
  48. package/dist/sdk/terminal/stallWatch.js +20 -0
  49. package/dist/sdk/terminal/subagentMonitor.d.ts +2 -0
  50. package/dist/sdk/terminal/subagentMonitor.js +4 -1
  51. package/dist/sdk/terminal/terminals.js +35 -4
  52. package/dist/sdk/terminal/toolName.d.ts +6 -0
  53. package/dist/sdk/terminal/toolName.js +12 -0
  54. package/dist/sdk/terminal/tui/commandPages.d.ts +1 -1
  55. package/dist/sdk/terminal/tui/commandPages.js +3 -0
  56. package/dist/sdk/terminal/tui/commands.d.ts +14 -0
  57. package/dist/sdk/terminal/tui/commands.js +4 -1
  58. package/dist/sdk/terminal/tui/pages/followUpQueuePage.d.ts +34 -0
  59. package/dist/sdk/terminal/tui/pages/followUpQueuePage.js +130 -0
  60. package/dist/sdk/terminal/tui/pages/trajectoryPage.js +37 -7
  61. package/dist/sdk/terminal/tui/runtime.js +2 -1
  62. package/dist/sdk/terminal/tui/settingsModel.js +88 -7
  63. package/dist/sdk/tools/askUser.js +2 -2
  64. package/dist/sdk/world/world.d.ts +12 -2
  65. package/dist/sdk/world/world.js +42 -4
  66. package/dist/terminal-opentui.js +1455 -758
  67. package/dist/terminal-pi.js +62 -31
  68. package/docs/README.md +1 -0
  69. package/docs/architecture/02-sessions-and-runs.md +43 -25
  70. package/docs/architecture/04-prompt.md +23 -22
  71. package/docs/architecture/10-server-protocol.md +23 -3
  72. package/docs/architecture/11-terminal.md +41 -29
  73. package/docs/architecture/12-storage.md +2 -1
  74. package/docs/architecture/13-world-tools.md +35 -22
  75. package/docs/architecture/14-surfaces-and-parity.md +24 -20
  76. package/docs/architecture/README.md +4 -1
  77. package/docs/architecture/proposals/PROP-0026-connected-sketch-display.md +3 -1
  78. package/docs/decisions/ADR-0027-connected-sketch-display.md +4 -2
  79. package/docs/decisions/ADR-0076-codex-final-answer-verbatim.md +6 -1
  80. package/docs/decisions/ADR-0077-plan-runs-may-conclude-no-plan-needed.md +120 -0
  81. package/docs/decisions/ADR-0078-child-aware-stall-watch.md +46 -0
  82. package/docs/decisions/ADR-0079-phase-led-reporting-guidance.md +72 -0
  83. package/docs/decisions/ADR-0080-fixed-width-question-sketch-canvas.md +50 -0
  84. package/docs/decisions/ADR-0081-no-work-slice-budget-by-default.md +36 -0
  85. package/docs/decisions/ADR-0082-connected-brave-browser.md +72 -0
  86. package/docs/parity.md +7 -5
  87. package/docs/releases/1.5.1-unstable.md +14 -1
  88. package/docs/releases/1.6.0-unstable.md +59 -0
  89. package/docs/study/00-index.md +12 -0
  90. package/docs/study/STUDY-0008-browser-control.md +281 -0
  91. package/docs/study/STUDY-0009-claude-code-reporting.md +205 -0
  92. package/docs/study/sources/claude-code.md +4 -0
  93. package/docs/terminal-tui.md +46 -18
  94. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,99 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - **Connect the agent to your own signed-in Brave profile (ADR-0082).**
6
+ - A device-local browser backend. `/settings` → Browser offers **Isolated browser** or **Brave
7
+ profile**; choosing Brave asks first, naming the extension's `debugger` permission, that a
8
+ signed-in page may hold private information, and that a disconnect never switches backends. No
9
+ project, variant or page can choose it.
10
+ - The **Brave extension** row starts a loopback bridge on `127.0.0.1` and shows a one-time
11
+ `port:code` that expires after five minutes. The unpacked `browser-extension/` folder now ships
12
+ in the package and is loaded from `brave://extensions`. The bridge accepts only the paired
13
+ extension origin with a bearer token, and keeps that pairing owner-only in
14
+ `<state dir>/browser/extension-bridge.json`.
15
+ - Each site is allowed separately in the extension popup by exact origin, port included; a tab
16
+ that leaves an allowed site becomes unavailable. Incognito is disabled, and the extension asks
17
+ for no history or cookie permission and exports no cookies.
18
+ - Brave adopts the existing `browser_*` tools and the shared gate: snapshot-scoped refs that are
19
+ invalidated when the page or the debugger attachment changes, a refused password field, and
20
+ fresh approval for sending, buying, deleting, account changes and granting access.
21
+ `browser_upload` stays with the App's WebKit backend.
22
+ - An in-page badge reads “Xingular Agent is on this site” with **Pause** and **Stop**. Pause
23
+ refuses new calls and lets an in-flight call finish; stop revokes the pairing and rejects
24
+ pending calls. A lost connection refuses calls with a reconnect message instead of switching
25
+ to the isolated browser.
26
+ - New methods `browser.config`, `browser.configure` and
27
+ `browser.extension.status|start|stop`, and `HarnessOptions.browserExtension` for a host that
28
+ supplies its own browser provider. `browser.json` gains `backend`; `<state dir>/browser/` is
29
+ now only profiles, downloads and pairing state.
30
+ - The live acceptance test drives a disposable Brave profile against a fixture page and runs only
31
+ when a person asks for it: `XINGULAR_BRAVE_LIVE=1 npx vitest run
32
+ src/browser/extension/brave-live.acceptance.test.ts`.
33
+
34
+ - **A reply waiting on children, or on a flaky network, no longer looks stalled (ADR-0078).**
35
+ - Each child a terminal reply waits on gets its own stall clock: fifteen minutes without
36
+ progress, or thirty minutes inside one tool, ends that child as `stalled` and the parent
37
+ receives its result as `interrupted`. The parent's own clock pauses while only child-wait tools
38
+ run, so a long child is no longer recorded as the parent's stall.
39
+ - A transient model failure retries eight times over about four minutes (2, 4, 8, 16, 32, 60, 60
40
+ and 60 seconds) instead of Pi's three attempts over fourteen seconds. A retry budget the person
41
+ set in their own settings still wins.
42
+ - The working row says what the reply waits on instead of repeating the verb: `Waiting on 2
43
+ subagents · last activity 12s ago (Read)`, `Running Bash · 1m 23s`, `Waiting for the model · no
44
+ output for 1m 15s`, `Reconnecting 2/8 · retry in 12s`, and `No progress for 6m · Esc to stop`.
45
+ - `heartbeat` events carry optional `activeTools` and `oldestToolMs`; hosts must tolerate both.
46
+
47
+ - **Edit the follow-up and steering queue from its own page.**
48
+ - `/follow-up`, and clicking a `Steer:` or `Follow-up:` row in the transcript, opens a page that
49
+ separates the two kinds, marks the next entry, and offers edit, send next, remove and return to
50
+ the composer. Queued images are preserved and marked `· images`.
51
+ - An explicit stop (`/stop` or Esc) now sends one unconsumed steering message before the
52
+ follow-ups, so a correction typed while the reply ran is applied first. A normal completion
53
+ still drains in FIFO order, and nothing is drained on a retry, a failure or a non-user
54
+ interruption.
55
+
56
+ - **Every question sketch is drawn on one 80-column canvas (ADR-0080).**
57
+ - The `ask_user` guidance asks the model for its `uiSketch` on a fixed 80-column canvas, and the
58
+ terminal projects every valid sketch to 80 content columns: short rows are padded, a standalone
59
+ divider spans the canvas, and the frame stays inside the dock with horizontal panning.
60
+ - Padding is display-only. The permissive validator (1–24 lines, 80 columns), stored events and
61
+ answer payloads are unchanged, and a host may keep its literal, scrollable preview.
62
+
63
+ - **No work-slice budget by default (ADR-0081).** A reply is no longer ended at 320 tool calls or
64
+ 60 minutes, and is no longer continued as a "next slice". The defaults are now no tool-call, time
65
+ or token limit; `workSlice` on a run and `XINGULAR_WORK_SLICE` at launch still set one. The prompt
66
+ no longer tells the model a budget exists, and the standard prompt's "ends only when the guard
67
+ hands it back" now reads "keep working until the request is done or the person interrupts". The
68
+ three-compaction guard stays. This changes the stable prompt prefix once.
69
+
70
+ - **Phase-led flexible reporting guidance (ADR-0079).** Final reports account for a reader picking
71
+ up cold, state when verification was not run or failed, and give subagents a concise caller-facing
72
+ report contract. Substantial multi-part reports often use content-named Markdown headings, with
73
+ no fixed heading vocabulary; the duplicated progress-update line is removed from `reporting` and
74
+ remains in `writing`. One example now demonstrates headings while the short blocked-publish
75
+ example stays prose.
76
+
77
+ - **A plan run may conclude that no plan is needed (ADR-0077).**
78
+ - A plan-mode reply with no outcome block is a valid `no_plan` ending: no plan card, no notice, no
79
+ warning, and no repair turn. `plan_ready` and `blocked` are unchanged.
80
+ - The plan instructions say to check whether the requested work already exists, to name the
81
+ evidence and stop when it does, and that a person's instruction not to plan outranks the
82
+ mode's output shape. The one hidden repair stays, but only for a block the model started and
83
+ left incomplete, empty or in conflict; it may finish that block, state that there is nothing to
84
+ plan, or return the blocked block.
85
+ - Plan tags inside fenced or inline code are text, not outcomes, so a reply that quotes plan
86
+ syntax is no longer `invalid`.
87
+ - The terminal's warning reads “The plan reply left its plan block incomplete, so no plan was
88
+ offered.” The App needs no change: it already shows a card only for a complete block.
89
+
90
+ - **Every tool-like name in CamelCase.**
91
+ - `toolDisplayName` moves to `src/terminal/toolName.ts` and splits on any separator, so
92
+ `todo_write`, `computer-screenshot`, `computer.screenshot` and `customTool` all read in
93
+ CamelCase and the letters a name already has are kept.
94
+ - The todo card reads `Todo` instead of `todo`; a custom message carries its type through the same
95
+ helper (`note` reads `Note`); a running child's activity reads `Read` rather than `read`; and
96
+ the approval prompt, the phone page's transcript and its approval card use the same names.
97
+ - The `/todo` empty-state notice names `TodoWrite` rather than `todo_write`.
5
98
  - **Codex's final-answer guidance, adopted verbatim (ADR-0076).**
6
99
  - The `reporting` section drops the four content questions, the by-hand check, the next-step
7
100
  block, the evidence table, the anti-pattern table and one example. It now carries Codex's
@@ -0,0 +1,32 @@
1
+ # Xingular Agent Brave bridge
2
+
3
+ This unpacked extension lets Harness use Brave's existing tabs through a short-lived loopback connection. It does not enable remote debugging on your profile and does not use Native Messaging.
4
+
5
+ ## Install and connect
6
+
7
+ 1. In Brave, open `brave://extensions`, turn on **Developer mode**, and choose **Load unpacked**. Select this `browser-extension` folder. In a packaged App install, use the unpacked extension folder shown in App Browser settings.
8
+ 2. Select **Brave profile** in Harness Browser settings. This uses your signed-in profile, so pages may contain private account information. Harness will not switch to the isolated browser if Brave disconnects.
9
+ 3. Choose **Start bridge** (or the equivalent connection action) in Harness Browser settings. Copy the one-time `port:code` shown there; it expires after five minutes.
10
+ 4. Open the Xingular Agent extension from Brave's toolbar, paste the code, and connect.
11
+ 5. Open a normal tab on the site you want Harness to use. Open the extension popup and choose **Allow this site**. Repeat only for sites you want the agent to reach.
12
+
13
+ The extension records the exact origin you allow, including its port, and checks that record for each tab. Chrome's underlying host permission can cover every port on that host, but other origins remain blocked by the extension. Incognito is disabled. The extension does not request cookie or history access. Site permission is separate from Harness tool permissions and from the per-action approvals for sending, buying, deleting, account changes, or granting access.
14
+
15
+ ## Pause and stop
16
+
17
+ The in-page badge appears on allowed tabs while the bridge is connected. **Pause** prevents new browser calls until resumed; an action already in flight may finish. **Stop** disconnects the extension and removes the badge. Removing a site's permission in the extension popup also makes its tabs unavailable.
18
+
19
+ A lost connection makes Brave browser calls fail with a reconnect message. Harness does not fall back to its isolated browser.
20
+
21
+ ## Permission warning
22
+
23
+ Brave requires the extension's `debugger` permission to inspect accessibility structure, capture screenshots, and send real input to a tab. Brave may show a broad permission warning at install time. The extension uses that ability only for normal tabs on sites you separately allowed in its popup. Close DevTools on a tab if Brave refuses debugger attachment. Do not install an unpacked extension from a source you do not trust.
24
+
25
+ The bridge listens only on `127.0.0.1`, accepts pairing only from a browser extension origin, and requires a random bearer token for each later call. It rejects a mismatched Origin when one is supplied; extension service-worker requests may omit Origin. The bridge stores its token in the Harness state directory with owner-only file permissions. The pairing code is not a permanent credential. The extension stores the token locally so it can reconnect after a normal Harness restart; **Stop** revokes it. Because Chrome host permissions do not narrow to ports, the extension keeps exact allowed origins separately and checks that list before exposing tabs; its loopback bridge permission alone never authorizes a site.
26
+
27
+ ## Limits
28
+
29
+ - Only `http` and `https` sites can be granted. Browser-internal pages and Incognito tabs are unavailable.
30
+ - `browser_upload` stays with the App's isolated WebKit browser and is not offered while Brave is selected.
31
+ - Brave may refuse control of a tab while DevTools or another debugger is attached.
32
+ - A tab that leaves a site you allowed becomes unavailable to the agent until you separately allow its new site.