@xingular/harness 1.0.0 → 1.2.0

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 (397) hide show
  1. package/CHANGELOG.md +46 -5
  2. package/README.md +75 -21
  3. package/dist/cli.js +17421 -8711
  4. package/dist/sdk/accounts/accounts.d.ts +27 -3
  5. package/dist/sdk/accounts/accounts.js +78 -24
  6. package/dist/sdk/accounts/secrets.d.ts +12 -0
  7. package/dist/sdk/accounts/secrets.js +114 -7
  8. package/dist/sdk/accounts/store.d.ts +26 -1
  9. package/dist/sdk/accounts/store.js +1 -1
  10. package/dist/sdk/agents/builtin.d.ts +2 -0
  11. package/dist/sdk/agents/builtin.js +48 -0
  12. package/dist/sdk/agents/narrow.d.ts +13 -0
  13. package/dist/sdk/agents/narrow.js +29 -0
  14. package/dist/sdk/agents/planResearch.d.ts +5 -0
  15. package/dist/sdk/agents/planResearch.js +19 -0
  16. package/dist/sdk/agents/profiles.d.ts +81 -0
  17. package/dist/sdk/agents/profiles.js +226 -0
  18. package/dist/sdk/annotations/bridge.d.ts +42 -0
  19. package/dist/sdk/annotations/bridge.js +264 -0
  20. package/dist/sdk/annotations/capture.d.ts +116 -0
  21. package/dist/sdk/annotations/capture.js +308 -0
  22. package/dist/sdk/annotations/delivery.d.ts +72 -0
  23. package/dist/sdk/annotations/delivery.js +130 -0
  24. package/dist/sdk/annotations/inspect.d.ts +10 -0
  25. package/dist/sdk/annotations/inspect.js +33 -0
  26. package/dist/sdk/annotations/isolated.d.ts +6 -0
  27. package/dist/sdk/annotations/isolated.js +51 -0
  28. package/dist/sdk/annotations/pageScript.d.ts +28 -0
  29. package/dist/sdk/annotations/pageScript.js +871 -0
  30. package/dist/sdk/annotations/part.d.ts +10 -0
  31. package/dist/sdk/annotations/part.js +155 -0
  32. package/dist/sdk/annotations/queue.d.ts +4 -0
  33. package/dist/sdk/annotations/queue.js +40 -0
  34. package/dist/sdk/annotations/serverMethods.d.ts +3 -0
  35. package/dist/sdk/annotations/serverMethods.js +62 -0
  36. package/dist/sdk/annotations/store.d.ts +167 -0
  37. package/dist/sdk/annotations/store.js +394 -0
  38. package/dist/sdk/browser/backend.d.ts +16 -0
  39. package/dist/sdk/browser/backend.js +17 -0
  40. package/dist/sdk/browser/contracts.d.ts +19 -0
  41. package/dist/sdk/browser/contracts.js +116 -0
  42. package/dist/sdk/browser/index.d.ts +14 -3
  43. package/dist/sdk/browser/index.js +11 -4
  44. package/dist/sdk/browser/serverMethods.d.ts +3 -0
  45. package/dist/sdk/browser/serverMethods.js +7 -0
  46. package/dist/sdk/browser/session.d.ts +1 -0
  47. package/dist/sdk/browser/session.js +45 -9
  48. package/dist/sdk/browser/tools.d.ts +1 -4
  49. package/dist/sdk/browser/tools.js +14 -91
  50. package/dist/sdk/cli.js +24 -15
  51. package/dist/sdk/commands/list.d.ts +3 -0
  52. package/dist/sdk/commands/list.js +75 -0
  53. package/dist/sdk/commands/registry.d.ts +250 -0
  54. package/dist/sdk/commands/registry.js +47 -0
  55. package/dist/sdk/commands/routes.d.ts +16 -0
  56. package/dist/sdk/commands/routes.js +33 -0
  57. package/dist/sdk/core/bus.js +1 -1
  58. package/dist/sdk/core/commandBudget.d.ts +23 -0
  59. package/dist/sdk/core/commandBudget.js +57 -0
  60. package/dist/sdk/core/env.d.ts +1 -1
  61. package/dist/sdk/core/env.js +1 -1
  62. package/dist/sdk/core/index.js +17 -1
  63. package/dist/sdk/core/interactiveProfile.d.ts +46 -0
  64. package/dist/sdk/core/interactiveProfile.js +143 -0
  65. package/dist/sdk/core/workspace.d.ts +13 -0
  66. package/dist/sdk/core/workspace.js +88 -0
  67. package/dist/sdk/core/workspaceBashTool.d.ts +4 -0
  68. package/dist/sdk/core/workspaceBashTool.js +36 -0
  69. package/dist/sdk/core/workspaceSandbox.d.ts +31 -0
  70. package/dist/sdk/core/workspaceSandbox.js +320 -0
  71. package/dist/sdk/core/workspaceWriteOperations.d.ts +22 -0
  72. package/dist/sdk/core/workspaceWriteOperations.js +206 -0
  73. package/dist/sdk/doctor/serverMethods.d.ts +3 -0
  74. package/dist/sdk/doctor/serverMethods.js +8 -0
  75. package/dist/sdk/doctor/types.d.ts +2 -2
  76. package/dist/sdk/harness.d.ts +22 -0
  77. package/dist/sdk/harness.js +84 -5
  78. package/dist/sdk/history/recall.js +8 -8
  79. package/dist/sdk/history/serverMethods.d.ts +3 -0
  80. package/dist/sdk/history/serverMethods.js +8 -0
  81. package/dist/sdk/hub/cli.d.ts +1 -1
  82. package/dist/sdk/hub/cli.js +1 -1
  83. package/dist/sdk/hub/schema.d.ts +1 -1
  84. package/dist/sdk/hub/serverMethods.d.ts +3 -0
  85. package/dist/sdk/hub/serverMethods.js +11 -0
  86. package/dist/sdk/index.d.ts +16 -1
  87. package/dist/sdk/index.js +10 -0
  88. package/dist/sdk/mcp/connections.js +14 -7
  89. package/dist/sdk/mcp/serverMethods.d.ts +3 -0
  90. package/dist/sdk/mcp/serverMethods.js +22 -0
  91. package/dist/sdk/pi/runtime.d.ts +2 -1
  92. package/dist/sdk/pi/runtime.js +2 -2
  93. package/dist/sdk/plugins/builtin.d.ts +1 -0
  94. package/dist/sdk/plugins/builtin.js +145 -33
  95. package/dist/sdk/plugins/builtinRegistry.d.ts +60 -0
  96. package/dist/sdk/plugins/builtinRegistry.js +71 -0
  97. package/dist/sdk/plugins/catalogue.js +2 -1
  98. package/dist/sdk/plugins/cli.d.ts +1 -1
  99. package/dist/sdk/plugins/cli.js +4 -3
  100. package/dist/sdk/plugins/commandPrefix.d.ts +8 -0
  101. package/dist/sdk/plugins/commandPrefix.js +21 -0
  102. package/dist/sdk/plugins/firstParty.d.ts +1 -1
  103. package/dist/sdk/plugins/firstParty.js +8 -2
  104. package/dist/sdk/plugins/inventory.js +4 -3
  105. package/dist/sdk/plugins/manifest.d.ts +2 -0
  106. package/dist/sdk/plugins/manifest.js +2 -1
  107. package/dist/sdk/plugins/surfaces.d.ts +5 -0
  108. package/dist/sdk/plugins/surfaces.js +11 -0
  109. package/dist/sdk/plugins/types.d.ts +15 -0
  110. package/dist/sdk/prompt/compile.d.ts +19 -2
  111. package/dist/sdk/prompt/compile.js +79 -26
  112. package/dist/sdk/prompt/standard.d.ts +17 -0
  113. package/dist/sdk/prompt/standard.js +21 -0
  114. package/dist/sdk/refine/cli.d.ts +1 -1
  115. package/dist/sdk/refine/cli.js +2 -2
  116. package/dist/sdk/refine/serverMethods.d.ts +3 -0
  117. package/dist/sdk/refine/serverMethods.js +20 -0
  118. package/dist/sdk/server/methods.js +27 -86
  119. package/dist/sdk/server/params.d.ts +4 -0
  120. package/dist/sdk/server/params.js +11 -0
  121. package/dist/sdk/server/remote.js +36 -11
  122. package/dist/sdk/sessions/compactionCheckpoint.d.ts +11 -0
  123. package/dist/sdk/sessions/compactionCheckpoint.js +79 -0
  124. package/dist/sdk/sessions/continuation.d.ts +3 -0
  125. package/dist/sdk/sessions/continuation.js +5 -1
  126. package/dist/sdk/sessions/contracts.d.ts +185 -0
  127. package/dist/sdk/sessions/contracts.js +101 -4
  128. package/dist/sdk/sessions/control.d.ts +72 -0
  129. package/dist/sdk/sessions/control.js +158 -0
  130. package/dist/sdk/sessions/initialBash.d.ts +7 -0
  131. package/dist/sdk/sessions/initialBash.js +7 -0
  132. package/dist/sdk/sessions/planMode.d.ts +18 -4
  133. package/dist/sdk/sessions/planMode.js +82 -16
  134. package/dist/sdk/sessions/reasoningSummaries.d.ts +2 -2
  135. package/dist/sdk/sessions/reasoningSummaries.js +3 -3
  136. package/dist/sdk/sessions/registry.d.ts +2 -1
  137. package/dist/sdk/sessions/registry.js +6 -3
  138. package/dist/sdk/sessions/runIndex.js +7 -7
  139. package/dist/sdk/sessions/runStore.d.ts +14 -0
  140. package/dist/sdk/sessions/runStore.js +38 -1
  141. package/dist/sdk/sessions/runner.d.ts +40 -2
  142. package/dist/sdk/sessions/runner.js +163 -15
  143. package/dist/sdk/sessions/sessions.d.ts +40 -8
  144. package/dist/sdk/sessions/sessions.js +279 -27
  145. package/dist/sdk/sessions/sideQuestionServerMethods.d.ts +3 -0
  146. package/dist/sdk/sessions/sideQuestionServerMethods.js +19 -0
  147. package/dist/sdk/sessions/sideQuestions.d.ts +66 -0
  148. package/dist/sdk/sessions/sideQuestions.js +290 -0
  149. package/dist/sdk/sessions/subagentServerMethods.d.ts +3 -0
  150. package/dist/sdk/sessions/subagentServerMethods.js +41 -0
  151. package/dist/sdk/sessions/subagentService.d.ts +22 -2
  152. package/dist/sdk/sessions/subagentService.js +93 -16
  153. package/dist/sdk/sessions/subagents.d.ts +9 -1
  154. package/dist/sdk/sessions/subagents.js +19 -0
  155. package/dist/sdk/sessions/workSlice.d.ts +103 -0
  156. package/dist/sdk/sessions/workSlice.js +297 -0
  157. package/dist/sdk/sessions/workspaceBoundary.d.ts +15 -0
  158. package/dist/sdk/sessions/workspaceBoundary.js +46 -0
  159. package/dist/sdk/terminal/browser.d.ts +62 -0
  160. package/dist/sdk/terminal/browser.js +41 -0
  161. package/dist/sdk/terminal/browserControl.d.ts +29 -0
  162. package/dist/sdk/terminal/browserControl.js +187 -0
  163. package/dist/sdk/terminal/commandHelp.d.ts +17 -0
  164. package/dist/sdk/terminal/commandHelp.js +20 -0
  165. package/dist/sdk/terminal/controller.d.ts +15 -1
  166. package/dist/sdk/terminal/controller.js +67 -8
  167. package/dist/sdk/terminal/opentui/subagentsWidget.d.ts +28 -0
  168. package/dist/sdk/terminal/opentui/subagentsWidget.js +52 -0
  169. package/dist/sdk/terminal/opentui/theme.d.ts +43 -0
  170. package/dist/sdk/terminal/opentui/theme.js +87 -0
  171. package/dist/sdk/terminal/piExtension.d.ts +6 -1
  172. package/dist/sdk/terminal/piExtension.js +169 -84
  173. package/dist/sdk/terminal/socket.d.ts +6 -3
  174. package/dist/sdk/terminal/socket.js +40 -9
  175. package/dist/sdk/terminal/standalone.d.ts +9 -0
  176. package/dist/sdk/terminal/standalone.js +118 -19
  177. package/dist/sdk/terminal/subagentMonitor.d.ts +47 -0
  178. package/dist/sdk/terminal/subagentMonitor.js +152 -0
  179. package/dist/sdk/terminal/terminals.d.ts +60 -7
  180. package/dist/sdk/terminal/terminals.js +598 -47
  181. package/dist/sdk/terminal/trajectory.js +2 -2
  182. package/dist/sdk/terminal/tui/annotateCommand.d.ts +3 -0
  183. package/dist/sdk/terminal/tui/annotateCommand.js +22 -0
  184. package/dist/sdk/terminal/tui/commandPages.d.ts +7 -1
  185. package/dist/sdk/terminal/tui/commandPages.js +57 -6
  186. package/dist/sdk/terminal/tui/commands.d.ts +10 -4
  187. package/dist/sdk/terminal/tui/commands.js +269 -65
  188. package/dist/sdk/terminal/tui/dialogGeometry.d.ts +2 -2
  189. package/dist/sdk/terminal/tui/dialogGeometry.js +4 -2
  190. package/dist/sdk/terminal/tui/dialogs.d.ts +6 -1
  191. package/dist/sdk/terminal/tui/dialogs.js +9 -2
  192. package/dist/sdk/terminal/tui/list.d.ts +14 -1
  193. package/dist/sdk/terminal/tui/list.js +96 -14
  194. package/dist/sdk/terminal/tui/modelPicker.js +1 -6
  195. package/dist/sdk/terminal/tui/page.d.ts +3 -0
  196. package/dist/sdk/terminal/tui/pageOverlay.js +27 -7
  197. package/dist/sdk/terminal/tui/pages/accountsPage.d.ts +26 -4
  198. package/dist/sdk/terminal/tui/pages/accountsPage.js +264 -36
  199. package/dist/sdk/terminal/tui/pages/agentsPage.d.ts +74 -0
  200. package/dist/sdk/terminal/tui/pages/agentsPage.js +190 -0
  201. package/dist/sdk/terminal/tui/pages/annotatePage.d.ts +94 -0
  202. package/dist/sdk/terminal/tui/pages/annotatePage.js +341 -0
  203. package/dist/sdk/terminal/tui/pages/browserPage.d.ts +87 -0
  204. package/dist/sdk/terminal/tui/pages/browserPage.js +738 -0
  205. package/dist/sdk/terminal/tui/pages/doctorPage.d.ts +2 -0
  206. package/dist/sdk/terminal/tui/pages/doctorPage.js +103 -15
  207. package/dist/sdk/terminal/tui/pages/notesPage.d.ts +75 -0
  208. package/dist/sdk/terminal/tui/pages/notesPage.js +201 -0
  209. package/dist/sdk/terminal/tui/pages/pluginsPage.d.ts +0 -5
  210. package/dist/sdk/terminal/tui/pages/pluginsPage.js +9 -3
  211. package/dist/sdk/terminal/tui/pages/settingsPage.d.ts +8 -0
  212. package/dist/sdk/terminal/tui/pages/settingsPage.js +16 -1
  213. package/dist/sdk/terminal/tui/pages/subagentsPage.d.ts +24 -0
  214. package/dist/sdk/terminal/tui/pages/subagentsPage.js +152 -0
  215. package/dist/sdk/terminal/tui/pages/trajectoryPage.d.ts +12 -5
  216. package/dist/sdk/terminal/tui/pages/trajectoryPage.js +156 -83
  217. package/dist/sdk/terminal/tui/pages/usagePage.d.ts +43 -0
  218. package/dist/sdk/terminal/tui/pages/usagePage.js +370 -0
  219. package/dist/sdk/terminal/tui/pages/worktreesPage.d.ts +72 -0
  220. package/dist/sdk/terminal/tui/pages/worktreesPage.js +203 -0
  221. package/dist/sdk/terminal/tui/piAdapter.d.ts +1 -2
  222. package/dist/sdk/terminal/tui/piAdapter.js +3 -5
  223. package/dist/sdk/terminal/tui/planMode.d.ts +1 -1
  224. package/dist/sdk/terminal/tui/planMode.js +1 -1
  225. package/dist/sdk/terminal/tui/pluginCommands.d.ts +16 -0
  226. package/dist/sdk/terminal/tui/pluginCommands.js +31 -0
  227. package/dist/sdk/terminal/tui/questions.d.ts +2 -0
  228. package/dist/sdk/terminal/tui/runtime.js +27 -5
  229. package/dist/sdk/terminal/tui/sessionPicker.d.ts +40 -0
  230. package/dist/sdk/terminal/tui/sessionPicker.js +141 -0
  231. package/dist/sdk/terminal/tui/settingsModel.d.ts +2 -0
  232. package/dist/sdk/terminal/tui/settingsModel.js +32 -2
  233. package/dist/sdk/terminal/tui/sideQuestion.d.ts +26 -26
  234. package/dist/sdk/terminal/tui/sideQuestion.js +131 -98
  235. package/dist/sdk/terminal/tui/ui.d.ts +2 -0
  236. package/dist/sdk/terminal/tui/ui.js +1 -0
  237. package/dist/sdk/tools/askUser.js +26 -8
  238. package/dist/sdk/tools/checklist.js +3 -2
  239. package/dist/sdk/tools/checkpoint.d.ts +27 -0
  240. package/dist/sdk/tools/checkpoint.js +154 -0
  241. package/dist/sdk/tools/getCapabilities.d.ts +31 -0
  242. package/dist/sdk/tools/getCapabilities.js +34 -0
  243. package/dist/sdk/tools/harnessTools.d.ts +2 -0
  244. package/dist/sdk/tools/harnessTools.js +1 -1
  245. package/dist/sdk/tools/spawnSubagent.js +14 -4
  246. package/dist/sdk/usage/analytics.d.ts +20 -0
  247. package/dist/sdk/usage/analytics.js +151 -0
  248. package/dist/sdk/usage/ledger.d.ts +38 -0
  249. package/dist/sdk/usage/ledger.js +142 -0
  250. package/dist/sdk/usage/limits/adapters.d.ts +11 -0
  251. package/dist/sdk/usage/limits/adapters.js +349 -0
  252. package/dist/sdk/usage/limits/capture.d.ts +8 -0
  253. package/dist/sdk/usage/limits/capture.js +47 -0
  254. package/dist/sdk/usage/limits/http.d.ts +12 -0
  255. package/dist/sdk/usage/limits/http.js +51 -0
  256. package/dist/sdk/usage/limits/normalize.d.ts +15 -0
  257. package/dist/sdk/usage/limits/normalize.js +211 -0
  258. package/dist/sdk/usage/limits/service.d.ts +30 -0
  259. package/dist/sdk/usage/limits/service.js +176 -0
  260. package/dist/sdk/usage/limits/types.d.ts +65 -0
  261. package/dist/sdk/usage/limits/types.js +1 -0
  262. package/dist/sdk/usage/serverMethods.d.ts +3 -0
  263. package/dist/sdk/usage/serverMethods.js +22 -0
  264. package/dist/sdk/usage/service.d.ts +32 -0
  265. package/dist/sdk/usage/service.js +66 -0
  266. package/dist/sdk/usage/settings.d.ts +7 -0
  267. package/dist/sdk/usage/settings.js +28 -0
  268. package/dist/sdk/usage/types.d.ts +60 -0
  269. package/dist/sdk/usage/types.js +4 -0
  270. package/dist/sdk/web/part.d.ts +10 -0
  271. package/dist/sdk/web/part.js +6 -0
  272. package/dist/sdk/web/serverMethods.d.ts +3 -0
  273. package/dist/sdk/web/serverMethods.js +7 -0
  274. package/dist/sdk/wiki/serverMethods.d.ts +3 -0
  275. package/dist/sdk/wiki/serverMethods.js +26 -0
  276. package/dist/sdk/worktrees/cli.d.ts +11 -0
  277. package/dist/sdk/worktrees/cli.js +146 -0
  278. package/dist/sdk/worktrees/copy.d.ts +9 -0
  279. package/dist/sdk/worktrees/copy.js +111 -0
  280. package/dist/sdk/worktrees/git.d.ts +16 -0
  281. package/dist/sdk/worktrees/git.js +81 -0
  282. package/dist/sdk/worktrees/serverMethods.d.ts +3 -0
  283. package/dist/sdk/worktrees/serverMethods.js +30 -0
  284. package/dist/sdk/worktrees/service.d.ts +73 -0
  285. package/dist/sdk/worktrees/service.js +483 -0
  286. package/dist/sdk/worktrees/setup.d.ts +23 -0
  287. package/dist/sdk/worktrees/setup.js +65 -0
  288. package/dist/sdk/worktrees/types.d.ts +91 -0
  289. package/dist/sdk/worktrees/types.js +1 -0
  290. package/dist/sdk/world/cli.d.ts +2 -2
  291. package/dist/sdk/world/cli.js +6 -6
  292. package/dist/sdk/world/world.d.ts +3 -1
  293. package/dist/sdk/world/world.js +8 -9
  294. package/dist/terminal-opentui.js +16456 -5966
  295. package/dist/terminal-pi.js +1579 -573
  296. package/docs/README.md +22 -2
  297. package/docs/architecture/00-overview.md +28 -16
  298. package/docs/architecture/02-sessions-and-runs.md +184 -25
  299. package/docs/architecture/03-variants.md +10 -2
  300. package/docs/architecture/04-prompt.md +65 -7
  301. package/docs/architecture/06-plugins-and-capabilities.md +57 -4
  302. package/docs/architecture/07-tools-and-gate.md +112 -17
  303. package/docs/architecture/08-memory-and-history.md +4 -2
  304. package/docs/architecture/09-accounts-and-connectors.md +39 -1
  305. package/docs/architecture/10-server-protocol.md +168 -4
  306. package/docs/architecture/11-terminal.md +251 -8
  307. package/docs/architecture/12-storage.md +45 -3
  308. package/docs/architecture/13-world-tools.md +49 -6
  309. package/docs/architecture/14-surfaces-and-parity.md +136 -0
  310. package/docs/architecture/README.md +17 -4
  311. package/docs/architecture/proposals/PROP-0006-run-checklist.md +4 -2
  312. package/docs/architecture/proposals/PROP-0013-resource-browser.md +58 -0
  313. package/docs/architecture/proposals/PROP-0014-fullscreen-browser-tabs.md +58 -0
  314. package/docs/architecture/proposals/PROP-0015-one-capability-surface.md +88 -0
  315. package/docs/architecture/proposals/PROP-0016-managed-worktrees.md +156 -0
  316. package/docs/architecture/proposals/PROP-0017-page-annotations.md +131 -0
  317. package/docs/architecture/proposals/PROP-0018-annotation-queue-and-app-targets.md +179 -0
  318. package/docs/architecture/proposals/PROP-0019-contextual-side-questions.md +122 -0
  319. package/docs/architecture/proposals/PROP-0020-builtin-feature-plugins.md +105 -0
  320. package/docs/architecture/proposals/PROP-0021-command-namespaces-and-duplicates.md +99 -0
  321. package/docs/architecture/proposals/PROP-0022-plan-only-questions.md +102 -0
  322. package/docs/architecture/proposals/PROP-0023-xagent-cli-name.md +61 -0
  323. package/docs/architecture/proposals/PROP-0024-question-sketch-previews.md +130 -0
  324. package/docs/architecture/proposals/PROP-0025-contextual-question-wireframes.md +49 -0
  325. package/docs/architecture/proposals/PROP-0026-connected-sketch-display.md +94 -0
  326. package/docs/architecture/proposals/PROP-0027-xingular-agent-product-identity.md +60 -0
  327. package/docs/architecture/proposals/PROP-0028-normalize-question-wireframes.md +55 -0
  328. package/docs/architecture/proposals/PROP-0029-agent-profiles.md +124 -0
  329. package/docs/architecture/proposals/PROP-0030-subagent-title.md +86 -0
  330. package/docs/architecture/proposals/PROP-0031-plugin-command-owner-namespaces.md +54 -0
  331. package/docs/architecture/proposals/PROP-0032-planning-quality.md +196 -0
  332. package/docs/architecture/proposals/PROP-0033-compaction-plan-checkpoints.md +75 -0
  333. package/docs/architecture/proposals/PROP-0034-conversation-fast-mode.md +120 -0
  334. package/docs/architecture/proposals/PROP-0035-retain-subagent-status.md +47 -0
  335. package/docs/architecture/proposals/PROP-0036-first-class-harness-commands.md +59 -0
  336. package/docs/architecture/proposals/PROP-0037-workspace-write-boundary.md +63 -0
  337. package/docs/architecture/proposals/PROP-0038-annotate-open-shadow-roots.md +73 -0
  338. package/docs/architecture/proposals/PROP-0039-workspace-boundary-hardening.md +139 -0
  339. package/docs/architecture/proposals/PROP-0040-one-launch-path.md +87 -0
  340. package/docs/architecture/proposals/PROP-0041-bounded-work-slices.md +247 -0
  341. package/docs/architecture/proposals/PROP-0042-usage-and-provider-limits.md +127 -0
  342. package/docs/architecture/proposals/PROP-0043-read-only-plan-bash.md +74 -0
  343. package/docs/architecture/proposals/README.md +39 -0
  344. package/docs/decisions/ADR-0001-owned-terminal.md +1 -1
  345. package/docs/decisions/ADR-0009-xharness-command.md +6 -5
  346. package/docs/decisions/ADR-0014-public-release-baseline.md +3 -2
  347. package/docs/decisions/ADR-0015-resource-browser.md +28 -0
  348. package/docs/decisions/ADR-0016-fullscreen-browser-tabs.md +31 -0
  349. package/docs/decisions/ADR-0017-one-capability-surface.md +34 -0
  350. package/docs/decisions/ADR-0018-builtin-feature-plugins.md +35 -0
  351. package/docs/decisions/ADR-0019-managed-git-worktrees.md +31 -0
  352. package/docs/decisions/ADR-0020-page-annotations.md +37 -0
  353. package/docs/decisions/ADR-0021-required-command-namespaces.md +40 -0
  354. package/docs/decisions/ADR-0022-plan-only-question-tools.md +34 -0
  355. package/docs/decisions/ADR-0023-contextual-side-question-runs.md +35 -0
  356. package/docs/decisions/ADR-0024-xagent-command.md +40 -0
  357. package/docs/decisions/ADR-0025-question-choice-sketches.md +49 -0
  358. package/docs/decisions/ADR-0026-contextual-question-wireframes.md +58 -0
  359. package/docs/decisions/ADR-0027-connected-sketch-display.md +60 -0
  360. package/docs/decisions/ADR-0028-xingular-agent-product-identity.md +56 -0
  361. package/docs/decisions/ADR-0029-normalized-question-wireframe-borders.md +33 -0
  362. package/docs/decisions/ADR-0030-agent-profiles.md +43 -0
  363. package/docs/decisions/ADR-0031-plugin-command-owner-namespaces.md +37 -0
  364. package/docs/decisions/ADR-0032-compaction-run-checkpoints.md +33 -0
  365. package/docs/decisions/ADR-0033-plan-mode-research-delegation.md +47 -0
  366. package/docs/decisions/ADR-0034-first-class-harness-terminal-commands.md +25 -0
  367. package/docs/decisions/ADR-0035-one-launch-path.md +40 -0
  368. package/docs/decisions/ADR-0036-workspace-write-operation-boundary.md +54 -0
  369. package/docs/decisions/ADR-0037-usage-ledger-and-provider-limits.md +44 -0
  370. package/docs/decisions/ADR-0038-plan-bash-os-read-only.md +29 -0
  371. package/docs/doctor.md +10 -4
  372. package/docs/experiments/EXP-0003-performance-audit/data/session-runtime-replication.json +420 -0
  373. package/docs/experiments/EXP-0003-performance-audit/data/session-runtime.json +420 -0
  374. package/docs/experiments/EXP-0003-performance-audit/data/terminal-compact.json +376 -0
  375. package/docs/experiments/EXP-0003-performance-audit/data/terminal-history.json +422 -0
  376. package/docs/experiments/EXP-0003-performance-audit/data/terminal-question.json +95 -0
  377. package/docs/experiments/EXP-0003-performance-audit/data/terminal-wide.json +1036 -0
  378. package/docs/experiments/EXP-0003-performance-audit/plan.md +109 -0
  379. package/docs/experiments/EXP-0003-performance-audit/results.md +151 -0
  380. package/docs/features/README.md +26 -0
  381. package/docs/features/interfaces/README.md +1 -1
  382. package/docs/future-work.md +48 -0
  383. package/docs/handoff-2026-10-25-app-parity-and-solo-tabs.md +202 -0
  384. package/docs/parity.md +134 -0
  385. package/docs/releases/1.0.0.md +2 -2
  386. package/docs/releases/1.1.1.md +28 -0
  387. package/docs/releases/1.2.0.md +49 -0
  388. package/docs/releases/4.0.0.md +47 -0
  389. package/docs/releases/README.md +37 -27
  390. package/docs/study/00-index.md +8 -0
  391. package/docs/study/STUDY-0003-long-horizon-runs.md +210 -0
  392. package/docs/study/autonomous-engineering-sources.md +277 -0
  393. package/docs/study/autonomy-sources.md +147 -0
  394. package/docs/study/proactive-autonomy.md +408 -0
  395. package/docs/study/tui-resource-browser.md +78 -0
  396. package/docs/terminal-tui.md +386 -113
  397. package/package.json +6 -5
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- The harness owns a generic interactive terminal application (`xharness`) over a
5
+ The harness owns a generic interactive terminal application (`xagent`) over a
6
6
  persistent Pi session on a variant. It is the standalone way to use the harness, and an
7
7
  embedding application can host it in its own PTY. Detail, screen layout and verification evidence
8
8
  are in [`../terminal-tui.md`](../terminal-tui.md); this page states the binding parts.
@@ -24,20 +24,66 @@ Harness parent: account + compiled context + trusted resources + run writer
24
24
  | launch specification / session socket
25
25
  Harness terminal child (Bun): OpenTUI application + persistent Pi AgentSessionRuntime
26
26
  | typed native events / plugin UI callbacks
27
- Screen: transcript above the composer, centred page dialogs
27
+ Screen: transcript above the composer, centred dialogs, full-screen resource browser
28
28
  ```
29
29
 
30
30
  ## Contracts
31
31
 
32
- - The published executable is `xharness`; with no command it starts the interactive terminal. `terminal` remains an explicit alias, and `serve` remains the host-facing RPC path.
32
+ - The published executable is `xagent`; `xharness` is not retained as a compatibility alias. With no command, `xagent` starts the interactive terminal. `terminal` remains an explicit alias, and `serve` remains the host-facing RPC path.
33
33
  - `TerminalAssets` is `{ node, cli, piExtension, openTui }`. The command is Bun with
34
34
  `--conditions=browser` and `dist/terminal-opentui.js`; no global `pi` is needed.
35
35
  - The `piExtension` path is the final prepared extension argument; the runtime loads it as the
36
36
  final trusted inline factory.
37
+ - Each terminal `begin` returns the run's pinned `workspaceRoot` to that extension. Native file
38
+ writes use the same revalidated atomic helper and OS write scope as SDK sessions. Terminal Bash,
39
+ including initial `!` commands, defaults to the workspace sandbox and external-hard-link scan;
40
+ `!outside <command>` requests human-only approval before that exact command runs once; its full
41
+ escaped command is available in scrollable approval details, and an undersized terminal denies
42
+ the request. The eligible Full Permission switch is the only standing boundary bypass; remembered
43
+ per-tool grants do not widen it, and command output never triggers approval or replay.
37
44
  - The terminal compiles its prompt once (`compile` + `render`) and keeps that pack; each run
38
- records a copy (page 04).
39
- - Standalone defaults: `~/.xingular-harness/{data,state}`; `npm run dev` uses
40
- `~/.xingular-harness-dev/{data,state}`.
45
+ records a copy (page 04). The shared compaction checkpoint extension reintroduces the active
46
+ request and latest checklist into post-compaction model context until the run settles.
47
+ - Normal mode keeps `ask_user` out of the active tool set. An attended plan request enables the
48
+ shared tool alongside its read-only set and restores the normal set on success, failure or
49
+ interruption. There is no terminal-only question alias (PROP-0040).
50
+ - A plan request keeps `bash` in its active set; each call runs in the sandbox's read-only scope
51
+ (PROP-0043). A user `!` command is refused while a plan request runs.
52
+ - Current standalone source defaults: `~/.xingular-harness/{data,state}`; `npm run dev` uses
53
+ `~/.xingular-harness-dev/{data,state}`. The standalone development launch uses a file SecretStore
54
+ under its resolved development state directory, even when its profile names a host backend; it
55
+ does not use or alter host credentials. `--variant <scope>` explicitly selects a variant head.
56
+ PROP-0040 approves a shared Harness-owned interactive profile, neutral default scope and
57
+ credential backend; adoption and runtime verification remain in progress. Until that lands,
58
+ matching roots/scopes is explicit and matching roots alone does not share host Keychain secrets.
59
+ - `Launch.standard` supplies the shared role and folder text. History, Wiki and skill model tools
60
+ use the session socket; enabled output-trim/budget-guard hooks load through `firstParty.list`.
61
+ Pi CLI built-ins (llama.cpp, codemode, tool-search and MCP) are not loaded as a terminal-only
62
+ resource path. Harness MCP remains available.
63
+ - An empty conversation shows a centered welcome using `env.productName` (default `Xingular Agent`):
64
+ the first letter of a multiword name is the orange block mark and its remaining words are letter-spaced
65
+ in blue. The welcome adds a greeting, tagline and `/help` hint without replacing the composer or
66
+ status bar. Explicit host product names use the same generic formatting.
67
+ - `xagent --worktree [name]` (`-w`) starts in a new managed worktree of the current repository,
68
+ or in the named one, and prunes older managed worktrees (PROP-0016). A session that names a
69
+ worktree holds it for its whole life. `/worktree` opens the worktree page; selecting
70
+ one switches folders by asking the host to restart the frontend there (`TerminalRelaunch.cwd`),
71
+ as a new conversation: Pi keeps one history per working folder.
72
+ - Slash-command aliases share one registry entry: `/session (resume)` opens the full-screen, searchable
73
+ saved-session page with unnumbered title and metadata rows; `/history (tree)` navigates branches in
74
+ the current session, and `/btw (side)` asks a side
75
+ question through the Harness `SideQuestions` service. It uses the same account/model/effort,
76
+ mirrors the main run's redacted prompt and public evidence, starts a separate tool-free run, and
77
+ leaves the main conversation untouched. The dock streams, scrolls and copies the complete answer.
78
+ Aliases remain callable and searchable, but help and palette show only the canonical
79
+ entry. `/usage:` and `/usage:analysis` open the usage page's Analysis tab, and `/usage:limit`
80
+ opens its Limits tab (PROP-0042); both are plugin-owned namespaced routes. The usage page is a
81
+ centered dialog: each window is a label and reset line above a quota-left bar coloured green at
82
+ 50% or more left, amber from 20–49%, and red below 20%. `commands.list`
83
+ publishes the effective routes; the browser-safe core catalogue is `commands/registry.ts`. First-class Harness commands are unprefixed and live in that registry,
84
+ independently of plugin command metadata. Every plugin-owned command uses
85
+ `/<owner-prefix>:<command>`; the namespace root is offered only by plugins that declare a default
86
+ command. Prompt templates and `/skill:<name>` keep their existing forms.
41
87
 
42
88
  ## Invariants
43
89
 
@@ -50,18 +96,46 @@ Screen: transcript above the composer, centred page dialogs
50
96
  their existing layers. The terminal adds no second path for any of them; its runs are written
51
97
  through the controller and the run store.
52
98
  - **INV-TUI-4** Changes made through the session socket (`plugins.attach|detach|trust|untrust|configure`,
53
- `accounts.*`, Hub installs) require the control key the trusted terminal process claimed once
99
+ `accounts.*`, Hub installs, `terminal.browser.*`, `terminal.worktrees.*`,
100
+ `terminal.annotations.*`, `terminal.sideQuestions.*`) require the control key the trusted terminal process claimed once
54
101
  (`control.claim`). The session's shell can read the session token, so the token alone is never
55
102
  enough.
56
103
  - **INV-TUI-5** Every resource reload revalidates the original trusted selection; changed or
57
104
  revoked code needs review and a fresh terminal.
58
105
  - **INV-TUI-6** `sessions.run` stays the embedding and unattended path. The terminal keeps a
59
106
  persistent child instead of opening a session per turn.
107
+ - **INV-TUI-7** Harness core commands use unprefixed names and are registered independently of
108
+ feature-plugin command metadata. This includes `/doctor`, `/worktree`, `/trajectory`, `/subagents`
109
+ and `/agents`; `/history` remains session-branch navigation, and `/mcp` remains a Connections
110
+ shortcut. Every plugin-owned terminal command uses `/<owner-prefix>:<command>`, for required and
111
+ optional built-ins and Pi extensions alike. Completions, help and dispatch use the same stable
112
+ owner prefix. Prefixes are unique to an owner; a prefix collision or duplicate command within an
113
+ owner is rejected with owner diagnostics. `/skill:<name>` remains reserved for skill invocation.
114
+ For one release, the former owner-qualified and `/plugin:<command>` forms of promoted Harness
115
+ commands remain hidden compatibility aliases; aliases are not listed in help or completion.
116
+ - **INV-TUI-8** Terminal sessions use the Harness-pinned workspace root and the same write
117
+ boundary as SDK sessions. Native file mutations use revalidated atomic replacement under an OS
118
+ scope; default Bash scans for external hard-link aliases and runs inside the sandbox. The terminal
119
+ cannot widen the boundary through its socket or native extension. `!outside <command>` requests
120
+ human-only approval before one execution; the terminal shows the complete escaped command and
121
+ denies the request if it cannot display details and choices together. stdout/stderr cannot trigger
122
+ approval or replay. Missing enforcement fails closed. Full Permission bypasses the boundary only
123
+ for eligible interactive
124
+ user runs and does not override hard policy denials, read-only or plan mode, unattended work, or
125
+ refinement restrictions.
60
126
 
61
127
  ## Source map
62
128
 
63
129
  `src/terminal/**`. Decisions: ADR-0001, [ADR-0004](../decisions/ADR-0004-fullscreen-terminal-layout.md)
64
- (superseded), ADR-0006. Experiments: EXP-0001, EXP-0002 in `../experiments/`.
130
+ (superseded), ADR-0006, [ADR-0021](../decisions/ADR-0021-required-command-namespaces.md)
131
+ (superseded by [ADR-0031](../decisions/ADR-0031-plugin-command-owner-namespaces.md)),
132
+ [ADR-0024](../decisions/ADR-0024-xagent-command.md),
133
+ [ADR-0027](../decisions/ADR-0027-connected-sketch-display.md),
134
+ [ADR-0028](../decisions/ADR-0028-xingular-agent-product-identity.md),
135
+ [ADR-0031](../decisions/ADR-0031-plugin-command-owner-namespaces.md),
136
+ [ADR-0034](../decisions/ADR-0034-first-class-harness-terminal-commands.md),
137
+ [ADR-0036](../decisions/ADR-0036-workspace-write-operation-boundary.md). Experiments:
138
+ EXP-0001, EXP-0002 in `../experiments/`.
65
139
 
66
140
  ## Session name in the working line (PROP-0010)
67
141
 
@@ -79,3 +153,172 @@ truncate at the right edge. Manual `/name` and existing long names remain suppor
79
153
  Live checks opens an explicit selection followed by account/model, destination, cost and isolation
80
154
  confirmation. The page polls structured reports, retains findings after cancellation, and cancels
81
155
  on close. No command text is sent to the conversation model. See [Doctor](../doctor.md).
156
+
157
+ ## Resource browser (PROP-0013)
158
+
159
+ `/harness` owns shared navigation for Foundation, Variant, Skills, Plugins, Connections, Tools
160
+ and Library. `/skills`, `/plugins`, `/connections` (`/mcp`), `/tools`, `/hub` and `/components`
161
+ are shortcuts into that browser. Current availability comes from the live resource loader and
162
+ active tool registry, independently of saved configuration and the latest variant head.
163
+
164
+ Every `terminal.browser.*` call requires the private control key, including bounded resource
165
+ inspection, local imports, connection management and browser settings. Package install/remove use protected
166
+ `plugins.install|remove`. These are adapters to the existing services, not another loader,
167
+ attachment store, gate or secret store. Browsing neither executes plugin code nor connects MCP.
168
+ The browser uses the full terminal with persistent section tabs (PROP-0014); wide screens keep
169
+ inventory beside details, actions and content, while compact screens keep inline details under
170
+ the same tabs. Other command pages remain centered except `/settings` and `/accounts`, which use
171
+ full-screen page layouts. Accounts keeps Accounts/Pools tabs, search and account-service operations.
172
+ Wide terminals show selected-account details beside the list; Enter or a primary click opens grouped
173
+ actions in that inspector. Compact terminals replace the list with a full-page account detail view
174
+ and its grouped actions. Enter opens the selected account; Escape returns to the list while
175
+ preserving its section, query and selection across navigation and resizing. Tab/Shift+Tab moves focus
176
+ between tabs, the list and (when open) actions; Left/Right changes a focused tab and Up/Down moves
177
+ the focused list or action list. Account actions retain their Session, Account, Sign-in and Remove
178
+ groups; pool actions remain grouped under Manage and Remove. See the
179
+ [terminal guide](../terminal-tui.md#blocks-and-pages) for layout and interaction.
180
+
181
+ `/settings` is a full-screen page with category tabs, search, settings list and the device-local
182
+ Browser tab for `allowPrivate`. Enabling private address access requires confirmation and allows both
183
+ agent browsing and annotation capture to reach localhost and private networks. It is off by default.
184
+
185
+ ## Worktrees command (PROP-0016)
186
+
187
+ `/worktree` opens a page of the managed worktrees of the repository the session works in: make a
188
+ managed or permanent worktree, switch the terminal to one (or back to the main checkout), create a
189
+ branch on a detached one, hand changes off in either direction, remove one (with a snapshot when it
190
+ holds work, never the one this terminal uses), restore a removed one, prune older ones, and trust
191
+ the repository's setup script. The page calls `terminal.worktrees.*` routes, which use the same
192
+ `Worktrees` service as the `worktrees.*` server methods. `xagent worktree <command>` offers the
193
+ same actions from a shell.
194
+
195
+ ## Question dock
196
+
197
+ Pending questions appear in a flat block above the composer, with a tab for each 1–2 word question
198
+ label above its title. Tabs can be clicked; Left/Right also switch questions and preserve staged
199
+ answers. The header has no pager or collapse control, and the dock stays expanded until the answer
200
+ is submitted or Escape cancels the pending question. While it is active, the chat composer and its
201
+ lower status bar are hidden. `n` opens a note for the focused selected choice; Tab and Shift+Tab
202
+ navigate existing note fields, the free-text answer and the action without creating notes. Notes
203
+ and the “Something else” answer wrap across lines. Choice recommendations remain visual only and
204
+ never preselect an answer.
205
+
206
+ Every choice uses one shared measured layout: a marker gutter, a one-third label cell, a two-cell
207
+ gap, and the remaining description cell. Column boundaries align across all rows at every terminal
208
+ width, including compact widths. Text wraps within its cell; a missing description keeps its cell
209
+ and columns never stack. Recommendation text uses `(Rec.)` when the label column is fewer than 14
210
+ cells. Below 60 terminal columns, the dock uses a compact hint. Multi-select choices use `✓`
211
+ when selected and `○` when unselected, matching checklist glyphs; single-choice options remain
212
+ numbered.
213
+
214
+ The dock body has bounded height and vertical scrolling; question tabs and answer/action controls
215
+ stay outside that scrolling region. PageUp/PageDown scroll the body and Ctrl+Home/End jump to its
216
+ beginning/end while the dock is active, rather than scrolling the transcript. Focused choices and
217
+ note fields are brought into view. Ordinary arrows retain question/choice navigation; Shift+arrows
218
+ pan the sketch horizontally or vertically.
219
+
220
+ When a question sets `uiSketch: true`, one shared border-only monospace preview below the choices
221
+ shows the hovered or focused choice's ASCII wireframe, with no visible caption or extra left rule.
222
+ Sketch source supports up to 80 columns by 24 lines (page 02) and remains literal ASCII in
223
+ persistence. The terminal uses a bounded structural display projection: recognized ASCII table-border
224
+ rows—including a title between horizontal runs—and enclosed vertical table edges become connected
225
+ box-drawing glyphs, while internal framed tables retain their original widths and positions. For a
226
+ high-confidence frame with matched `+` corners, missing or slightly displaced side edges may be
227
+ filled or moved only through whitespace to the established boundary columns; interior text is never
228
+ moved or overwritten, and conflicting or ambiguous rows remain literal. Bare standalone hyphen
229
+ divider rows expand to `max(panel viewport width, original sketch widest line)` and join the outer
230
+ single-line preview frame with `├` and `┤`. This is not a global `+|-` substitution: prose, content
231
+ operators, ordinary pipes and unrecognized rows remain literal. Source sketches and all persisted
232
+ whitespace remain unchanged; only the display projection adjusts recognized boundary cells.
233
+
234
+ There is no wrapping, reflow, truncation or markup interpretation. A bounded two-axis viewport makes
235
+ all overflow reachable by panning. Moving focus changes the preview without changing the staged
236
+ answer. Projected glyphs and expanded dividers never enter persisted events or answers; the wire
237
+ contract is unchanged. See [PROP-0025](proposals/PROP-0025-contextual-question-wireframes.md),
238
+ [ADR-0026](../decisions/ADR-0026-contextual-question-wireframes.md) and the approved display amendment
239
+ [PROP-0026](proposals/PROP-0026-connected-sketch-display.md) /
240
+ [ADR-0027](../decisions/ADR-0027-connected-sketch-display.md), and
241
+ [PROP-0028](proposals/PROP-0028-normalize-question-wireframes.md) /
242
+ [ADR-0029](../decisions/ADR-0029-normalized-question-wireframe-borders.md). Isolated production
243
+ PTY verification is retained in `docs/evidence/terminal-wireframe-normalization/`; it establishes
244
+ cell topology for bounded fixtures, not every emulator/font or live-model sketch quality.
245
+
246
+ ## Web annotations commands (PROP-0017)
247
+
248
+ `/annotate:notes` lists the Web annotations kept in the data root, with search, and offers reveal, edit, resolve or
249
+ reopen, share with this session or stop sharing, and delete. `/annotate:` opens the default capture pane;
250
+ `/annotate:annotate [url]` is its explicit command form. It opens a visible capture browser (its own window and profile, separate from the agent's browser), where the person can annotate the whole page,
251
+ select text, or click an element there. An annotation is private until shared; this session's agent then reads it with `page_notes_list`
252
+ and `page_notes_read`.
253
+
254
+ The annotate pane (PROP-0018) is a full-screen page beside the window being inspected.
255
+
256
+ - **Ways to start it:**
257
+ - `/annotate:` or `/annotate:annotate [url]`: the capture browser
258
+ - `/annotate:annotate --app <DevTools address | port> [name]`: an app's own windows over its DevTools port
259
+ - `/annotate:annotate --bridge [name]`: app windows that load the page bridge script, which the pane shows
260
+ - **The inspector** (`i`) outlines components on hover. A click or a text drag opens a popover in the page with Create annotation, Ask agent to fix, and Proceed now.
261
+ - **Sections:** Queue, Sent and fixed (with the agent's summary), and Saved.
262
+ - **Other keys:** `s` sends the queue as one run of this session, confirming notes that came from a page-world script first; `x` takes a note out of the queue; `t` picks a window.
263
+ - **Routes:** `terminal.annotations.target|attach|windows|selectWindow|inspect|stopInspect|next|queue|dequeue|confirm|send` act only on this terminal's session and need the control key.
264
+
265
+ ## Checklist (PROP-0006, PAR-001)
266
+
267
+ Terminal sessions register the shared `checklist_write` tool. The extension validates each list
268
+ with the same tool code and sends it as `checklist` telemetry; the controller emits it as
269
+ `checklist.updated` on the active run, so `runs.checklist` and continuation read terminal runs too.
270
+ The gate treats it as read-only, plan mode allows it, and terminal children inherit it. The
271
+ transcript shows each write as a checklist block (`✓` done, `●` in progress (warning yellow), `○` pending) under a
272
+ `Checklist · n of m done` header instead of a tool row; a failed or malformed call stays a tool row.
273
+
274
+ ## Work-slice checkpoint (PROP-0041)
275
+
276
+ Terminal replies carry the same work-slice guard as structured runs: 160 tool calls, 40 minutes or
277
+ 320 000 new tokens, then a refusal that asks for `checkpoint_write`. The extension registers the shared
278
+ tool and sends it as `checkpoint` telemetry, which the controller records as `checkpoint` on the
279
+ active run, so an App reading the same session sees the handoff. Terminal replies are not
280
+ auto-continued: at the boundary the person decides, which is what the terminal's own turn model
281
+ already does. The run record says `interrupted` with terminal reason `slice_complete` (or `stalled`
282
+ when the guard ended it), so a host can continue it; a checkpoint card in the transcript is not built
283
+ yet (PAR-004). Start the terminal with `XINGULAR_WORK_SLICE=off` to launch a reply with no
284
+ boundary at all; it is not persisted, so the next launch without it restores the guard.
285
+
286
+ ## Subagent activity monitor
287
+
288
+ During an active parent run, the terminal polls a private read-only monitor once per second. It
289
+ projects the flat set of child and nested-child runs with task, status, elapsed time, the latest
290
+ tool name, the child's agent profile (name and colour, PROP-0029), the title the parent gave it
291
+ (PROP-0030), counts from the child's own checklist, the pinned account label, effective model and
292
+ effort, and cumulative usage totals. Model and effort come from the volatile launch selection; the
293
+ latest provider-reported model supersedes the launch model when usage is available. Usage is an
294
+ explicit projection of token, cache, cost, request-count and context-window totals. Per-request
295
+ payloads and reasoning summaries do not enter the monitor. The child's own `session_name` is not
296
+ projected; it names the child's session, not its row. Tool summaries, other arguments, output and
297
+ checklist item text never enter the monitor. The latest completed tool name remains visible across
298
+ one-second snapshots until new tool or response activity replaces it. The monitor exposes no
299
+ controls to steer or stop children.
300
+
301
+ The live rows sit under the status line, after one blank row, with no heading. Each row reads, in
302
+ order: the status mark (`○` queued, a running row that shows the working spinner's frame in the profile's colour (warning for a copy of the parent), `●` waiting in the accent,
303
+ `✓` done, `✕` failed, `!` stopped), the profile name in its colour (`subagent`, muted, for a copy
304
+ of the parent), the title the parent gave the child (PROP-0030), and `n of m tasks` when the child
305
+ keeps a checklist. Active rows come first, at most three, then `+N more · /subagents`; a narrow
306
+ terminal cuts the title first. `/subagents` opens the searchable full roster, with a colored
307
+ profile and normal-color title on its first line, then muted account, model, effort and usage
308
+ metadata on its second line. One blank row separates each two-line entry. Narrow rows truncate this
309
+ lower-priority summary without hiding the title.
310
+ At parent settlement, the terminal makes a final monitor read and keeps the latest parent's rows
311
+ visible until the next parent run starts. The projection remains volatile and read-only, is scoped to
312
+ the latest parent run in the terminal session, and is cleared on session replacement or terminal
313
+ disposal. It is not a persisted event or public server method.
314
+
315
+ ## Agent profiles (PROP-0029)
316
+
317
+ `/agents` opens the Agents page over `terminal.agents.list|create|remove`, which call the same
318
+ `agents/profiles.ts` functions as `agents.*`. It lists built-in, global, project and variant
319
+ profiles, and files that cannot be read. The detail pane shows the colour, description, tools,
320
+ plugins, variant, model, effort, file and instructions. Enter on a row offers: for a person's own
321
+ profile, edit (opens the file in `$VISUAL`/`$EDITOR` with the renderer suspended), copy and delete
322
+ (confirmed); for a built-in or variant profile, copy. New profile asks for a name and a place
323
+ (project or global), writes the template and opens it. The terminal passes its pinned variant to
324
+ `Subagents.register`, so the variant's c5 names are profiles there too.
@@ -16,6 +16,7 @@ index.
16
16
  refine/<id>/ summary.json, task.json, variants/, rollouts/, sessions/, context/, selection/, reflection/, improver/, or matrix.json + suite.json for evaluation matrices (05)
17
17
  rollouts/<label>/workspace/ only when started with retainWorkspaces
18
18
  library/<scope>/<area>/ INDEX.md, variants/<task>/{variant/, EXPERIENCE.md} (05)
19
+ annotations/<id>.json page notes (13, PROP-0017)
19
20
  wiki/ home.md, library/ (library/lessons/ from the lessons plugin), projects/<slug>/ (08)
20
21
  reflection/improver/lesson-<run id>/ a reflection's native history and reply (08)
21
22
  wiki-history/ earlier versions of notes (08)
@@ -24,9 +25,12 @@ index.
24
25
  plugins/<name>/ packages kept with the data (06)
25
26
  trash/plugins/ removed packages (06)
26
27
  hub/ installed documents and provenance (09)
27
- runs/<id>/ run.json, events.jsonl, owner.json, subagents.json, context.json, caller.json, capabilities.json, mcp-context.json (02)
28
+ runs/<id>/ run.json (including optional legacy-compatible workspaceRoot), events.jsonl, owner.json, subagents.json, context.json, caller.json, capabilities.json, mcp-context.json (02)
29
+ # `checkpoint` and `heartbeat` are run events in the same events.jsonl; a bounded reply emits one
30
+ # heartbeat per 30 seconds (about 60 KB an hour) and no side file (PROP-0041).
28
31
  config/ plugin-attachments.json and settings the harness reads (06)
29
- index.sqlite derived index (FTS5) (08)
32
+ agents/<name>.md a person's global agent profiles; agents/profiles.ts owns it (02, PROP-0029)
33
+ index.sqlite derived index (FTS5, recall, usage ledger) (08, PROP-0042)
30
34
  projects.json read only: the application owns it
31
35
 
32
36
  <state dir>/
@@ -36,10 +40,39 @@ index.
36
40
  plugin-trust.json, variant-plugin-trust.json, plugin-registered.json, plugin-hooks.json (03, 06)
37
41
  connections.json connected apps, no secrets (09)
38
42
  hub/catalog.json catalog cache (09)
39
- run/ the session socket and terminal commands (11)
43
+ run/ terminal commands, and one session socket per Harness process,
44
+ harness-<pid>-<random>.sock; files of ended processes are pruned (11)
45
+ worktrees.json managed worktree registry (02, PROP-0016)
46
+ worktrees/<repo>/<name>/ managed worktree checkouts; worktrees/logs/ setup output (PROP-0016)
47
+ worktree-setup-trust.json trusted setup-script hashes, owner-only (PROP-0016)
48
+ browser/ isolated browser settings and profiles (13)
49
+ notes-bridge.json the page bridge's port and token, kept so an app's script tag stays valid (13, PROP-0018)
40
50
  harness.log standalone terminal diagnostics
41
51
  ```
42
52
 
53
+ The interactive profile is a credential-free, versioned selection file at
54
+ `~/.xingular-harness/profile.json`, owned by `src/core/interactiveProfile.ts`. It selects the
55
+ interactive defaults: data root, state directory, default variant scope, and a credential-backend
56
+ descriptor. With no selected profile, the defaults are `~/.xingular-harness/data`,
57
+ `~/.xingular-harness/state`, scope `default`, and the state directory's owner-only file secret
58
+ store. A host may provide a stable host-backed secret adapter instead; the profile stores only its
59
+ identifier, never credentials. If that adapter is unavailable, startup fails rather than falling
60
+ back to a different store.
61
+
62
+ Explicit roots or variant scopes take precedence over the selected profile; the selected profile
63
+ precedes caller-supplied legacy defaults. Explicit adoption creates the profile file without
64
+ replacing an existing selection and does not create, copy, merge, or migrate data roots or
65
+ credentials. Existing account, variant, and session pins remain authoritative for their saved
66
+ runs; the profile selects defaults for new interactive work. `scripts/dev.mjs` and a development
67
+ interactive profile use `~/.xingular-harness-dev/{data,state}` and a separate profile file, not the
68
+ production defaults. The standalone development launch always selects a file SecretStore under its
69
+ resolved development state directory, even if that profile names a host backend; it does not use or
70
+ alter host credentials.
71
+
72
+ Side-question runs use the ordinary `runs/<id>/` records. Their temporary Pi native history is
73
+ created under the operating system temporary directory and removed when the run ends; it is not
74
+ retained in the data root or state directory.
75
+
43
76
  ## Invariants
44
77
 
45
78
  - **INV-STO-1** Device-local state (credentials, approvals, trust, connections, sockets) is never
@@ -50,10 +83,19 @@ index.
50
83
  through that module's functions. A new top-level folder or a new file in `runs/<id>/` is an
51
84
  architecture change.
52
85
  - **INV-STO-4** `projects.json` belongs to the application; the harness only reads it.
86
+ Project agent profiles live in the repository at `<project>/.xingular/agents/<name>.md`; the
87
+ harness writes them only through `agents.create` and `agents.remove` (PROP-0029).
53
88
  - **INV-STO-5** Migrations of stored data are one-way and safe: the old data is backed up or left
54
89
  as it was when a migration fails, and the failure is reported in `Recovery.migrationError`.
55
90
  - **INV-STO-6** Writes of shared JSON files are atomic (`core/fs.ts::atomicWrite`, `writeJson`).
56
91
  - **INV-STO-7** Files holding trust or secrets are owner-only (`0600`).
92
+ - **INV-STO-8** `core/interactiveProfile.ts` owns the credential-free selection of interactive
93
+ roots, default variant scope, and credential-backend descriptor. Explicit roots/scopes win; a
94
+ selected profile wins over legacy defaults. Adoption never replaces a selection or merges roots,
95
+ and a missing host credential adapter never silently downgrades to a file store. The standalone
96
+ development launch explicitly selects its isolated file store; this is not a fallback for normal
97
+ interactive profiles. Profile defaults do not replace the account, variant, or other pins on saved
98
+ runs.
57
99
 
58
100
  ## Source map
59
101
 
@@ -1,10 +1,12 @@
1
1
  # 13 World tools
2
2
 
3
- The foundation supplies generic web and isolated browser tools through the existing tool-provider
4
- surface. Web requests use the public-address guard. Each browser session owns its context and
5
- profile; its tools pass the same capability and policy gate as other tools. Read page content is
6
- untrusted. Sending, purchasing, deleting, changing accounts and granting access require explicit
7
- human approval. Sensitive fields are not filled by the agent.
3
+ The Foundation owns the generic isolated browser engine, per-session contexts and profiles,
4
+ network policy, and lifecycle. Built-in World plugins contribute the user-facing web search/page
5
+ tools, browser tools and annotations through the existing tool-provider surface. Every tool passes
6
+ the same capability and policy gate. Web requests use the public-address guard; browser requests
7
+ use the device-local private-address setting. Read page content is untrusted. Sending, purchasing,
8
+ deleting, changing accounts and granting access require explicit human approval. Sensitive fields
9
+ are not filled by the agent.
8
10
 
9
11
  The App owns its shared WebKit browser UI, private/shared tab policy, selected-file uploads,
10
12
  windows and the native computer bridge. These application objects do not enter the Harness.
@@ -16,8 +18,49 @@ synthetic page. Their input runs only after live-check confirmation, and their r
16
18
  released on completion, timeout or cancellation. Computer interaction needs a host-provided
17
19
  isolated surface; without one it is blocked.
18
20
 
19
- Ownership is recorded in PROP-0012 and ADR-0014. No eighth extension point is added.
21
+ ## Shared browser contract and native WebKit limits (PROP-0040)
22
+
23
+ `browser/contracts.ts` owns the backend-neutral names and input schemas for `browser_*` tools;
24
+ providers adapt those definitions rather than inventing host-specific selectors. The isolated Harness
25
+ backend supports accessibility snapshots and snapshot-scoped refs. A native WebKit host backend
26
+ currently supports navigation, tab management, visible-text reads and page-level scrolling without a
27
+ ref. It does not support accessibility snapshots, snapshot refs or ref-based click/type/select/scroll,
28
+ browser screenshots, browser waits or keyboard presses.
29
+
30
+ For an unsupported operation the native provider returns an explicit `browser_unsupported` refusal
31
+ with “Nothing was done”; it never treats a snapshot ref as a selector and never silently switches to
32
+ the isolated browser. The isolated Harness browser is an independent backend, not an automatic
33
+ fallback for the native provider. A host plugin's `surfaces` description labels that fallback and its
34
+ limits; it does not assert full browser parity.
35
+
36
+ Plugin ownership and the Foundation boundary are recorded in PROP-0012, ADR-0014 and PROP-0020.
37
+ World providers are assembled through `BuiltinPluginRegistry`; no eighth extension point is added.
20
38
 
21
39
  An embedding host may set `browser: false` to disable the generic backend and its plugin
22
40
  descriptor before supplying its own browser tool provider. The App uses this option for its
23
41
  shared-tab browser, so matching tool names never silently select the wrong backend.
42
+
43
+ ## Page notes (PROP-0017)
44
+
45
+ The `annotations` world part offers `page_notes_list` and `page_notes_read`, read-only, to SDK and
46
+ terminal sessions. It is separate from the browser part, so a host that sets `browser: false` keeps
47
+ it. A tool returns only notes a person shared with the calling session or agent; quoted page text
48
+ and element names are marked untrusted. Capture happens in a visible capture browser in the
49
+ terminal, or in a host's own web view running the same page helper (`annotations.pageScript`).
50
+
51
+ **Inspector, queue and app targets (PROP-0018).**
52
+
53
+ - **Inspector.** In the page helper's inspector, hovering outlines a component and a click (or a drag over text) opens a comment popover inside the page, with three choices: save, queue for the agent, or send now.
54
+ - A queued note is shared with its session.
55
+ - `annotations/delivery.ts` sends a batch as one instruction, and sends notes the person asked for while the session was busy when its run ends.
56
+ - The agent reports a fix with `page_notes_mark_fixed`, the only page-note tool that writes. It never resolves a note or changes grants.
57
+ - **Targets.** Element targets prefer semantic role/name/text. A visually empty element may still be
58
+ annotated when it has a specific CSS selector (ID, test ID, classes, and a structural path when
59
+ needed); bare tag selectors are not enough. Reveal checks for one live match and preserves any
60
+ captured semantic/context evidence, otherwise reporting ambiguous or unresolved. Text annotations
61
+ continue to use quote plus context, not screen coordinates.
62
+ - Besides the browser window, capture can use an app's own windows:
63
+ - **DevTools port:** an app started with a DevTools port, on a loopback address only. It uses the app's existing windows, routes nothing, and never closes the app.
64
+ - **Page bridge:** a loopback server whose script an app loads while it is developed (`annotations/bridge.ts`), for web views without a DevTools port.
65
+ - **Web components (PROP-0038).** The helper walks the composed tree: open shadow roots and slotted content can be picked, selected and revealed, and such targets carry `tree: 'composed'`. Targets without it resolve by the document-only rules as before. Closed shadow roots and frames stay out of reach, and the inspector says why it refuses something.
66
+ - **Trust.** In Chromium targets the helper runs in an isolated script world, so the page cannot forge a comment. A send from the bridge, or from a host web view without isolation, waits for the person to confirm it.
@@ -0,0 +1,136 @@
1
+ # 14 Surfaces and parity
2
+
3
+ ## Purpose
4
+
5
+ The harness has more than one front end: its own standalone terminal (`xagent`, page 11) and
6
+ every application that embeds it. This page fixes how capabilities relate to those front ends, so
7
+ that a person can do the same work in the terminal and in a host, and so that a reader knows that
8
+ a capability is Harness work even when a request names a host.
9
+
10
+ A *capability* is something a person or a model can do: start a session, approve a call, work in
11
+ a worktree, annotate a page, inspect a run. A *surface* is how one front end presents it: a
12
+ terminal command or page, a host screen.
13
+
14
+ ## Components
15
+
16
+ | Kind | What it is | Example |
17
+ |---|---|---|
18
+ | Foundation service | A member of `Harness` with server methods | `sessions`, `accounts`, `apps`, `worktrees` (PROP-0016), agent profiles (`agents.*`, PROP-0029) |
19
+ | Built-in feature plugin | A module in `BuiltinPluginRegistry` (`plugins/builtin.ts`) that may supply a `WorldPart`, server methods and terminal commands | web tools, browser tools, annotations, worktrees |
20
+ | First-party plugin | A descriptor in the registry (`plugins/builtin.ts`) | lessons, checklist |
21
+ | Terminal surface | A command, page or dialog in `terminal/` | `/plan`, `/doctor`, the resource browser |
22
+ | Host surface | A host screen built on the same methods and tools | the App's chat, Capability and Harness screens |
23
+ | Host-backed backend | An operating-system object only a host has, behind a generic Harness contract | the App's WebKit tabs, macOS computer bridge, keychain |
24
+ | Host-only surface | Presentation a terminal cannot show (INV-PAR-4) | reserved: interactive agent output ("OpenUI") |
25
+
26
+ ## Contracts
27
+
28
+ - A capability is reachable through server methods (page 10) and, where a model uses it, through a
29
+ tool that passes the gate (page 07). Both front ends use the same methods; neither has a private
30
+ path to Harness state. Foundation context behavior, including bounded checkpoint restoration after
31
+ compaction (PROP-0033), is shared by terminal and embedded sessions; a host does not reimplement it.
32
+ - Workspace write scope is Harness-owned on both surfaces. Each run pins a canonical root after
33
+ worktree selection; reads retain OS-permission scope, while native file writes and shell
34
+ filesystem effects default to that root; the filesystem root itself is not a valid workspace.
35
+ Native mutations revalidate their canonical target and atomically replace the file under an OS
36
+ write scope. Default Bash scans for external hard-link
37
+ aliases and runs under an OS sandbox that prevents its own processes from creating cross-boundary
38
+ hard links; on macOS the sandbox denies hard-link creation entirely, including within the
39
+ workspace. `workspaceWriteScope: 'outside'` (terminal `!outside <command>`) requests a human-only
40
+ approval before one execution, showing the complete escaped command in scrollable terminal details
41
+ and denying if the terminal is too small. Output never triggers approval or retry. Hosts may
42
+ tighten or deny policy but cannot silently waive the boundary. Only the eligible Full Permission
43
+ switch may answer automatically under its existing restrictions. A same-user peer process outside
44
+ Harness is not controlled by this rule. `workspaceRoot` is additive and legacy run records may
45
+ omit it.
46
+ - Harness core terminal commands use unprefixed names and are registered independently of feature
47
+ plugin command metadata. This includes `/doctor`, `/worktree`, `/trajectory`, `/subagents` and
48
+ `/agents`; `/history` remains session-branch navigation, and `/mcp` remains a Connections shortcut.
49
+ Every plugin-owned terminal command uses `/<owner-prefix>:<command>`, for required and optional
50
+ built-ins and Pi extensions alike. Built-in prefixes are stable registry metadata; Pi package
51
+ extensions use a normalized package name or the package's `harness.commandPrefix`, and loose
52
+ extensions use their normalized extension name. Prefix collisions and duplicate commands within
53
+ one owner are rejected with owner diagnostics. Built-in plugin modules may declare a default
54
+ command for their namespace root. The former owner-qualified and `/plugin:<command>` forms of
55
+ promoted Harness commands remain hidden compatibility aliases for one release. Prompt templates
56
+ and `/skill:<name>` keep their existing forms. Built-in plugin categories remain documented in
57
+ page 06, not public metadata.
58
+ - A capability may be limited to a run mode when Harness resolves the callable set; the register
59
+ records that restriction for both surfaces. `ask_user` is available only in attended plan runs,
60
+ with no terminal-only question alias (PROP-0040). Plan-mode delegation
61
+ is limited to named profiles whose effective tool and plugin allowlists qualify for read-only
62
+ research; both terminal and host use the same gate and child-capability narrowing.
63
+ - Question choice sketches use one optional validated event contract: up to 80 printable ASCII
64
+ columns by 24 LF-separated lines (1,943 bytes maximum; page 02). Both surfaces use the same
65
+ literal ASCII source, persisted unchanged, in one shared preview with access to overflow; neither
66
+ changes the answer payload (PROP-0025, ADR-0026; originally PROP-0024). The terminal may project
67
+ recognized ASCII table-border rows—including title-bearing rules—and enclosed vertical table
68
+ edges into connected box-drawing glyphs, retaining internal framed table widths. For a
69
+ high-confidence frame, it may fill a missing boundary cell or realign a displaced edge only
70
+ through whitespace to matched corner columns; interior text and ambiguous rows remain unchanged
71
+ (PROP-0028, ADR-0029). Bare standalone hyphen dividers expand to the larger of viewport width and
72
+ original sketch widest line and join the outer single-line frame with `├` and `┤` (PROP-0026,
73
+ ADR-0027). Prose, content operators and ordinary pipes are not globally substituted. Hosts may
74
+ retain literal ASCII previews: equivalent capability does not require identical structural
75
+ typography. No schema, validation-bound, persistence or answer-payload change follows from these
76
+ display amendments. Terminal geometry, scrolling and projection boundaries follow page 11; hosts
77
+ may use native presentation without narrowing accepted metadata. Existing hosts with the old
78
+ bounds must update before accepting larger sketches. Acceptance of the expanded contract on both
79
+ surfaces is tracked in the parity register. Isolated production PTY evidence verifies bounded
80
+ fixture topology, not every emulator/font or live-model sketch quality.
81
+ - Side questions use one Harness service on both surfaces. Each caller supplies its visible
82
+ transcript projection; Harness adds the parent run's effective prompt and public events, then
83
+ starts an independent tool-free run.
84
+ - PROP-0040 defines one shared launch/command contract: `Launch.standard`, `commands.list`,
85
+ saved-history controls and tracked `SessionRunInput.command` runs. Hosts present these rather
86
+ than approximating navigation with a fork. A listed command or handler is not proof of acceptance.
87
+ The current host `/session` picker reads a host-owned session catalog rather than a shared Harness
88
+ catalog (PAR-008), and read-only command pages do not stand in for unsupported management methods.
89
+ The register records command routes individually; parity remains open until each route passes
90
+ acceptance.
91
+ - Read-only `get_capabilities` is implemented in structured sessions and the terminal. Structured
92
+ sessions report tools filtered by the run's frozen capability set and actual registered schemas;
93
+ the terminal reports Pi's active tools and schemas, applying its plan-mode allowed set when active.
94
+ It is in the shared plan-mode allowlist and grants no permission. Hosts use this Harness tool rather
95
+ than defining a duplicate.
96
+ - `browser/contracts.ts` owns shared backend-neutral browser schemas. A native WebKit host backend
97
+ still lacks accessibility snapshots and snapshot-ref interactions, browser screenshots, waits and
98
+ keyboard input; unsupported calls return an explicit refusal before effects and do not trigger an
99
+ automatic backend switch (page 13, PAR-015).
100
+ - Shared interactive defaults, profile adoption, credentials and a cross-surface session catalog
101
+ remain in progress under PROP-0040. Existing pins and explicit profile choices win; adoption must
102
+ not merge stores, copy credentials or silently downgrade the secret backend.
103
+ - `PluginDescriptor.surfaces` / `Plugin.surfaces` optionally describe a host preference, terminal
104
+ fallback/unavailability and reason. This labels add-ons, not plugin categories or permissions.
105
+ - The register of capabilities and their surfaces is [`docs/parity.md`](../parity.md). It is
106
+ descriptive; the invariants below are binding.
107
+ - A host keeps its own register of host-only surfaces. The Harness names no host surface.
108
+
109
+ ## Invariants
110
+
111
+ - **INV-PAR-1** Every capability a person can use in a host is a Harness capability: a foundation
112
+ service, a world part or a first-party plugin, reachable through server methods. The standalone
113
+ terminal surfaces it. A host is a presentation of it.
114
+ - **INV-PAR-2** A capability is complete only when its terminal surface and its host surface both
115
+ pass acceptance. It lands in the Harness first, together with its terminal surface; the host
116
+ surface follows.
117
+ - **INV-PAR-3** A host-backed capability needs an operating-system object only a host has. The
118
+ Harness defines the generic contract and a terminal fallback (for example the headed isolated
119
+ browser for page annotations). Without a fallback, the terminal shows the capability as
120
+ unavailable, with the reason, in `/doctor` and `/tools`.
121
+ - **INV-PAR-4** A host-only surface owns no capability. Its actions are Harness methods or tools,
122
+ its data lives in Harness records, the terminal renders a text fallback, and each one is listed
123
+ in the host's register by an owner decision. A generic rich-output event kind for such surfaces
124
+ needs its own proposal; the name is reserved and nothing is designed.
125
+
126
+ ## Data
127
+
128
+ None of its own. Each capability stores its data as its own page says.
129
+
130
+ ## Source map
131
+
132
+ `src/harness.ts` (services), `src/world/world.ts` (world parts), `src/plugins/builtin.ts`
133
+ (first-party descriptors), `src/terminal/` (terminal surfaces), `src/server/methods.ts` (methods).
134
+ Decision: [PROP-0015](proposals/PROP-0015-one-capability-surface.md),
135
+ [ADR-0017](../decisions/ADR-0017-one-capability-surface.md),
136
+ [ADR-0036](../decisions/ADR-0036-workspace-write-operation-boundary.md).