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

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 (125) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +1 -1
  3. package/dist/cli.js +3680 -1947
  4. package/dist/sdk/cli.js +2 -0
  5. package/dist/sdk/commands/registry.d.ts +15 -0
  6. package/dist/sdk/commands/registry.js +2 -0
  7. package/dist/sdk/computer/screenshot.d.ts +32 -0
  8. package/dist/sdk/computer/screenshot.js +35 -0
  9. package/dist/sdk/context/attribution.d.ts +18 -0
  10. package/dist/sdk/context/attribution.js +295 -0
  11. package/dist/sdk/context/types.d.ts +94 -0
  12. package/dist/sdk/context/types.js +10 -0
  13. package/dist/sdk/index.d.ts +2 -1
  14. package/dist/sdk/index.js +2 -1
  15. package/dist/sdk/plugins/builtin.js +1 -0
  16. package/dist/sdk/prompt/compile.d.ts +42 -2
  17. package/dist/sdk/prompt/compile.js +87 -15
  18. package/dist/sdk/remote/addresses.d.ts +19 -0
  19. package/dist/sdk/remote/addresses.js +52 -0
  20. package/dist/sdk/remote/pairing.d.ts +59 -0
  21. package/dist/sdk/remote/pairing.js +160 -0
  22. package/dist/sdk/remote/seal.d.ts +28 -0
  23. package/dist/sdk/remote/seal.js +84 -0
  24. package/dist/sdk/remote/server.d.ts +28 -0
  25. package/dist/sdk/remote/server.js +158 -0
  26. package/dist/sdk/remote/service.d.ts +125 -0
  27. package/dist/sdk/remote/service.js +330 -0
  28. package/dist/sdk/remote/webClient.d.ts +4 -0
  29. package/dist/sdk/remote/webClient.js +444 -0
  30. package/dist/sdk/server/methods.js +3 -0
  31. package/dist/sdk/sessions/contracts.d.ts +4 -0
  32. package/dist/sdk/sessions/contracts.js +2 -0
  33. package/dist/sdk/sessions/planMode.d.ts +26 -1
  34. package/dist/sdk/sessions/planMode.js +48 -1
  35. package/dist/sdk/sessions/runner.d.ts +12 -0
  36. package/dist/sdk/sessions/runner.js +34 -2
  37. package/dist/sdk/sessions/sessions.js +1 -0
  38. package/dist/sdk/sessions/subagentService.d.ts +11 -1
  39. package/dist/sdk/sessions/subagentService.js +120 -38
  40. package/dist/sdk/sessions/subagents.d.ts +31 -0
  41. package/dist/sdk/sessions/subagents.js +45 -0
  42. package/dist/sdk/sessions/workSlice.d.ts +5 -9
  43. package/dist/sdk/sessions/workSlice.js +8 -149
  44. package/dist/sdk/terminal/client.d.ts +3 -1
  45. package/dist/sdk/terminal/client.js +15 -6
  46. package/dist/sdk/terminal/control.d.ts +1 -1
  47. package/dist/sdk/terminal/control.js +2 -2
  48. package/dist/sdk/terminal/controller.d.ts +22 -0
  49. package/dist/sdk/terminal/controller.js +104 -13
  50. package/dist/sdk/terminal/piExtension.js +106 -4
  51. package/dist/sdk/terminal/stallWatch.d.ts +13 -0
  52. package/dist/sdk/terminal/stallWatch.js +16 -0
  53. package/dist/sdk/terminal/standalone.d.ts +2 -0
  54. package/dist/sdk/terminal/standalone.js +9 -2
  55. package/dist/sdk/terminal/terminals.d.ts +14 -0
  56. package/dist/sdk/terminal/terminals.js +98 -2
  57. package/dist/sdk/terminal/tui/commandPages.d.ts +4 -1
  58. package/dist/sdk/terminal/tui/commandPages.js +12 -0
  59. package/dist/sdk/terminal/tui/commands.d.ts +3 -2
  60. package/dist/sdk/terminal/tui/commands.js +19 -5
  61. package/dist/sdk/terminal/tui/dialogs.d.ts +3 -2
  62. package/dist/sdk/terminal/tui/dialogs.js +4 -3
  63. package/dist/sdk/terminal/tui/keybindings.d.ts +1 -1
  64. package/dist/sdk/terminal/tui/keybindings.js +1 -1
  65. package/dist/sdk/terminal/tui/markdown.d.ts +16 -0
  66. package/dist/sdk/terminal/tui/markdown.js +55 -0
  67. package/dist/sdk/terminal/tui/modeChoices.d.ts +3 -2
  68. package/dist/sdk/terminal/tui/modeChoices.js +4 -4
  69. package/dist/sdk/terminal/tui/mouseReport.d.ts +30 -0
  70. package/dist/sdk/terminal/tui/mouseReport.js +80 -0
  71. package/dist/sdk/terminal/tui/pages/annotatePage.js +3 -2
  72. package/dist/sdk/terminal/tui/pages/browserPage.d.ts +1 -1
  73. package/dist/sdk/terminal/tui/pages/contextPage.d.ts +62 -0
  74. package/dist/sdk/terminal/tui/pages/contextPage.js +484 -0
  75. package/dist/sdk/terminal/tui/pages/remoteControlPage.d.ts +32 -0
  76. package/dist/sdk/terminal/tui/pages/remoteControlPage.js +170 -0
  77. package/dist/sdk/terminal/tui/pages/trajectoryPage.js +5 -4
  78. package/dist/sdk/terminal/tui/qr.d.ts +4 -0
  79. package/dist/sdk/terminal/tui/qr.js +35 -0
  80. package/dist/sdk/terminal/tui/runtime.js +8 -2
  81. package/dist/sdk/terminal/tui/search.js +3 -2
  82. package/dist/sdk/terminal/tui/sideQuestion.d.ts +1 -0
  83. package/dist/sdk/terminal/tui/sideQuestion.js +8 -3
  84. package/dist/sdk/terminal/tui/skillInvocation.d.ts +21 -2
  85. package/dist/sdk/terminal/tui/skillInvocation.js +31 -11
  86. package/dist/sdk/terminal/tui/status.d.ts +6 -0
  87. package/dist/sdk/terminal/tui/status.js +15 -1
  88. package/dist/sdk/terminal/tui/theme.d.ts +9 -0
  89. package/dist/sdk/terminal/tui/theme.js +9 -0
  90. package/dist/sdk/tools/defaultSkills.d.ts +19 -0
  91. package/dist/sdk/tools/defaultSkills.js +27 -1
  92. package/dist/sdk/tools/dispatch.js +8 -9
  93. package/dist/sdk/tools/spawnSubagent.d.ts +1 -1
  94. package/dist/sdk/tools/spawnSubagent.js +4 -2
  95. package/dist/terminal-opentui.js +1607 -492
  96. package/dist/terminal-pi.js +256 -144
  97. package/docs/README.md +1 -0
  98. package/docs/architecture/02-sessions-and-runs.md +55 -22
  99. package/docs/architecture/04-prompt.md +23 -4
  100. package/docs/architecture/07-tools-and-gate.md +4 -2
  101. package/docs/architecture/10-server-protocol.md +24 -0
  102. package/docs/architecture/11-terminal.md +52 -10
  103. package/docs/architecture/12-storage.md +5 -2
  104. package/docs/architecture/13-world-tools.md +17 -3
  105. package/docs/architecture/14-surfaces-and-parity.md +7 -3
  106. package/docs/architecture/15-remote-control.md +118 -0
  107. package/docs/architecture/README.md +3 -0
  108. package/docs/architecture/proposals/PROP-0049-context-attribution.md +409 -0
  109. package/docs/architecture/proposals/README.md +2 -1
  110. package/docs/decisions/ADR-0039-progress-aware-stall-guards.md +4 -0
  111. package/docs/decisions/ADR-0048-required-skills-from-a-message.md +42 -0
  112. package/docs/decisions/ADR-0050-approved-window-screenshots.md +19 -0
  113. package/docs/decisions/ADR-0051-terminal-decision-wait.md +10 -0
  114. package/docs/decisions/ADR-0052-per-profile-subagent-budgets.md +25 -0
  115. package/docs/decisions/ADR-0053-no-repeated-work-guard.md +45 -0
  116. package/docs/decisions/ADR-0054-terminal-reply-heartbeat-and-stall.md +52 -0
  117. package/docs/decisions/ADR-0055-plan-output-repair.md +51 -0
  118. package/docs/decisions/ADR-0056-remote-control.md +53 -0
  119. package/docs/decisions/ADR-0057-structured-plan-outcomes.md +39 -0
  120. package/docs/decisions/ADR-0058-ask-user-only-plan-clarification.md +36 -0
  121. package/docs/parity.md +14 -10
  122. package/docs/releases/1.3.1-unstable.3.md +54 -0
  123. package/docs/releases/1.3.1-unstable.4.md +56 -0
  124. package/docs/terminal-tui.md +43 -18
  125. package/package.json +3 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,88 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Render the `/btw` side answer as Markdown instead of plain text. Headings, emphasis, lists,
6
+ quotes, links, tables and fenced code use the theme's markdown colours, and a streaming answer
7
+ re-renders in place. Terminal control sequences in model output are still removed.
8
+
9
+ - Add `/remote-control` (alias `/rc`): continue a terminal session from a phone or iPad, as Claude
10
+ Code's `/rc` does, without a cloud relay. The harness serves a small phone page on the computer's
11
+ Tailscale address, or its private Wi-Fi address, and the terminal shows a QR code for a one-device
12
+ pairing link. The person at the terminal allows each device; a paired phone then sends messages,
13
+ watches the reply stream, stops it, and answers approvals and questions through the same paths
14
+ the terminal uses. Every body is sealed with a key that reaches the phone only in the QR code's
15
+ fragment, keys live in memory, and remote control ends with the session. `xagent --remote-control`
16
+ turns it on at start; `/rc off` stops it. Terminal runs now also record streamed `message.delta`
17
+ events. New dependencies: `tweetnacl`, `uqr` (ADR-0056, page 15).
18
+
19
+ - Recover a plan run whose reply loses its plan block. An attended top-level plan run now makes one
20
+ hidden format-repair turn in the same run, asking the model to re-send its own plan in one complete
21
+ block; a failed repair leaves the run completed and the terminal shows a warning instead of a plan
22
+ choice. The plan-research children, commands, probes, improvers, reflections and other unattended
23
+ runs are unchanged (ADR-0055).
24
+
25
+ - A live terminal reply now reports a heartbeat every 30 seconds, and one that produces nothing but
26
+ heartbeats for 15 minutes is ended as `interrupted` with reason `stalled` instead of showing a run
27
+ that never settles. A running tool gets 30 minutes and an unanswered approval or question is never
28
+ cut short. Before this, a terminal reply reported no heartbeat at all, so the run sweep waited the
29
+ full 30-minute silence window and recorded `owner_gone` while the process was alive (ADR-0054).
30
+
31
+ - Stop refusing repeated work. A reply is no longer refused, or ended, for calling the same tool
32
+ with the same arguments three times, for a Bash check that keeps failing, or for editing one path
33
+ more than four times: those calls are ordinary work, and the reply budget is the single bound. The
34
+ 320-call/60-minute budget, its checkpoint handoff, slice continuation and the three-compaction
35
+ thrash rule are unchanged, and the `stuck` checkpoint reason stays readable in existing runs
36
+ (ADR-0053).
37
+
38
+ - Make a skill named in a message required for that request. `$name` is a skill invocation at any
39
+ word start, not only as the first token: `Launch.requiredSkills` carries it and the compiler
40
+ renders a built-in dynamic `required-skills` section (order 52, 12,000 characters) from the pinned
41
+ variant's `SKILL.md`, naming an unavailable skill honestly and falling back to the shipped
42
+ `plugin-authoring` skill. It changes no tool or permission, and it belongs to the request, so an
43
+ identical one is delivered again; structured sessions deliver it through `sessionLaunch` and the
44
+ terminal appends the same text as a hidden `xingular-required-skills` message
45
+ (`requiredSkillsText`). The terminal no longer rewrites a leading `$name` to `/skill:name`, and its
46
+ `$` palette opens at the caret and inserts there, keeping the rest of the draft (ADR-0048).
47
+
48
+ - Bound delegation per run and per profile. `spawn_subagent` and `wait_subagents` still exist, but a
49
+ run now starts at most four distinct child conversations: two `worker`, three `explorer`, one of
50
+ any other named profile and one with no profile. The parent's `subagents` option overrides them
51
+ (`maxChildren`, `maxByProfile`, `maxOther`, `maxUnprofiled`, clamped to 0–50), so a host and the
52
+ terminal receive the same defaults; `Subagents.spawn` refuses a child past a limit with an
53
+ `invalid_request` that tells the model to do the work itself, and starts no run. The count covers
54
+ the runs the parent was continued from, continuing a stopped child costs no slot, and a concurrent
55
+ spawn reserves its slot before it launches (ADR-0052).
56
+
57
+ - Record where a request's characters went. `renderSized` returns the prompt and each section's
58
+ size, `Delivery.sizes` stores them on the recorded pack, and `Source.chars` attributes a variant's
59
+ tool guidance inside the tools section, so `context.attribution` (`terminal.context` in the
60
+ terminal) can return one row per contributor with its estimated tokens and share of the window,
61
+ reconciled to the provider's measured total, plus one row's text. `context.snapshot` also records
62
+ the compaction headroom the run was held to (`compaction: { enabled, reserveTokens }`) from Pi's
63
+ own settings.
64
+
65
+ - Define an opt-in approved-window screenshot contract. `computer_screenshot` in
66
+ `src/computer/screenshot.ts` takes a host backend that captures exactly one currently approved
67
+ window, excludes the desktop, other windows and overlapping overlays, and refuses with
68
+ `COMPUTER_SCREENSHOT_UNAVAILABLE` instead of falling back to a display capture. It goes through
69
+ the ordinary tool gate and is not plan-mode safe; the standalone terminal has no backend, and the
70
+ existing macOS host capture has not adopted the contract (ADR-0050).
71
+
72
+ - Watch approvals and questions through `terminal.pending.wait`: a control-key-protected revision
73
+ snapshot that returns as soon as the pending set changes and otherwise waits at most 20 seconds,
74
+ waking on additions, removals and disposal. `terminal.pending` stays available, the client
75
+ resynchronizes after errors, and no persisted state or public protocol changes (ADR-0051).
76
+
77
+ - Swap the OpenTUI send keys back. `Return` sends, or queues a follow-up behind a running reply, and
78
+ `Cmd+Return`, `Ctrl+Return` or `Alt+Return` steers that reply. The `app.message.followUp` action is
79
+ `app.message.steer` again, so a `keybindings.json` entry under the newer name needs renaming.
80
+
81
+ - Keep a stray mouse report out of input. When the terminal delivers a mouse report in two pieces
82
+ across the input parser's timeout, its `<button;column;row>` tail is dropped instead of being
83
+ typed into the composer or a single-line field, so a scroll can never become a run's prompt or a
84
+ filter. Text typed at human speed is never touched, pastes are never rewritten, and the Trajectory
85
+ page no longer prints a recorded mouse report.
86
+
5
87
  - Give top-level sessions a name and a current-state prompt. An unnamed session derives a
6
88
  provisional six-word name from its first substantive request; greetings and short replies stay
7
89
  unnamed, and the model can revise the name. Each top-level run also receives a request-scoped
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.