@anyswarm/core 0.5.1 → 0.5.2

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 (171) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +13 -6
  3. package/dist/examples/README.md +16 -5
  4. package/dist/examples/authoring/README.md +4 -4
  5. package/dist/examples/autoresearch/README.md +15 -8
  6. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +3 -10
  7. package/dist/examples/autoresearch/demo.js +1 -1
  8. package/dist/examples/autoresearch/eject.json +2 -0
  9. package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
  10. package/dist/examples/autoresearch/frontiercs2-config.js +3 -0
  11. package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
  12. package/dist/examples/autoresearch/prepare-demo.js +15 -0
  13. package/dist/examples/autoresearch/prepare.js +3 -3
  14. package/dist/examples/autoresearch/project.d.ts +0 -94
  15. package/dist/examples/autoresearch/project.js +2 -20
  16. package/dist/examples/code/README.md +25 -17
  17. package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
  18. package/dist/examples/harness-session/README.md +3 -3
  19. package/dist/examples/messages/README.md +1 -1
  20. package/dist/examples/notes/README.md +3 -3
  21. package/dist/examples/services/mathlib-search/README.md +1 -1
  22. package/dist/examples/services/persistent-board/README.md +5 -2
  23. package/dist/examples/subagents/README.md +2 -2
  24. package/dist/examples/subagents/config.js +3 -3
  25. package/dist/examples/substrate/README.md +2 -2
  26. package/dist/examples/super/README.md +34 -22
  27. package/dist/examples/super/actions.d.ts +1 -1
  28. package/dist/examples/super/actions.js +11 -11
  29. package/dist/examples/super/config.js +3 -3
  30. package/dist/examples/super/eject.json +1 -1
  31. package/dist/examples/super/location.js +1 -1
  32. package/dist/examples/super/operator.d.ts +1 -0
  33. package/dist/examples/super/operator.js +31 -0
  34. package/dist/examples/super/project.d.ts +0 -107
  35. package/dist/examples/super/project.js +1 -3
  36. package/dist/scripts/anyswarm-arguments.d.ts +7 -25
  37. package/dist/scripts/anyswarm-arguments.js +69 -97
  38. package/dist/scripts/anyswarm-eject.js +1 -1
  39. package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
  40. package/dist/scripts/anyswarm-harnesses.js +1 -22
  41. package/dist/scripts/anyswarm-installation.d.ts +7 -40
  42. package/dist/scripts/anyswarm-installation.js +17 -291
  43. package/dist/scripts/anyswarm-launch.d.ts +6 -36
  44. package/dist/scripts/anyswarm-launch.js +32 -81
  45. package/dist/scripts/anyswarm-progress.d.ts +6 -0
  46. package/dist/scripts/anyswarm-progress.js +102 -0
  47. package/dist/scripts/anyswarm-project.d.ts +1 -9
  48. package/dist/scripts/anyswarm-project.js +40 -127
  49. package/dist/scripts/anyswarm-source-runner.js +9 -41
  50. package/dist/scripts/anyswarm.js +6 -26
  51. package/dist/scripts/build-provenance.json +1 -1
  52. package/dist/scripts/local-environment.d.ts +10 -4
  53. package/dist/scripts/local-environment.js +67 -20
  54. package/dist/scripts/local-setup.d.ts +3 -0
  55. package/dist/scripts/local-setup.js +135 -107
  56. package/dist/scripts/pack-release.js +4 -1
  57. package/dist/src/core/worker-image.js +1 -1
  58. package/dist/src/harness/project-harness.d.ts +1 -0
  59. package/dist/src/harness/project-harness.js +2 -2
  60. package/dist/src/harness/project-runtime.js +3 -1
  61. package/docs/INDEX.md +2 -1
  62. package/docs/architecture/04-services.md +1 -1
  63. package/docs/architecture/07-run-configuration.md +28 -14
  64. package/docs/architecture/12-code-coverage.md +56 -57
  65. package/docs/architecture/17-harness-reporting.md +1 -1
  66. package/docs/architecture/22-website.md +4 -7
  67. package/docs/architecture/23-project-harness.md +48 -23
  68. package/docs/architecture/26-code.md +20 -5
  69. package/docs/architecture/27-personal.md +23 -8
  70. package/docs/architecture/28-autoresearch.md +18 -6
  71. package/docs/architecture/INDEX.md +1 -2
  72. package/docs/architecture/prompts/source-manifest.json +5 -5
  73. package/docs/architecture/source-map.json +51 -71
  74. package/docs/designs/core-harness/01-core.md +2 -2
  75. package/docs/designs/core-harness/06-project-harness.md +3 -3
  76. package/docs/designs/core-harness/README.md +2 -2
  77. package/docs/en/agents.md +1 -1
  78. package/docs/en/build-your-harness.md +1 -1
  79. package/docs/en/changelog.md +7 -0
  80. package/docs/en/first-harness.md +6 -6
  81. package/docs/en/harnesses/lead-worker.md +1 -1
  82. package/docs/en/harnesses/peermesh.md +2 -2
  83. package/docs/en/harnesses/subagents.md +2 -2
  84. package/docs/en/harnesses/substrate.md +4 -4
  85. package/docs/en/harnesses/taskpool.md +2 -2
  86. package/docs/en/latest.md +9 -5
  87. package/docs/en/quickstart.md +20 -41
  88. package/docs/en/reference/api.md +1 -1
  89. package/docs/en/reference/cli.md +47 -85
  90. package/docs/en/sandbox.md +3 -3
  91. package/docs/operations/trace-viewer.md +1 -1
  92. package/docs/third-party-notices.md +0 -1
  93. package/docs/workflows/development.md +14 -12
  94. package/docs/workflows/release-and-docs-versioning.md +13 -12
  95. package/docs/workflows/release-cli-acceptance.md +85 -0
  96. package/docs/zh/agents.md +1 -1
  97. package/docs/zh/build-your-harness.md +1 -1
  98. package/docs/zh/changelog.md +8 -1
  99. package/docs/zh/first-harness.md +7 -7
  100. package/docs/zh/harnesses/lead-worker.md +1 -1
  101. package/docs/zh/harnesses/peermesh.md +2 -2
  102. package/docs/zh/harnesses/subagents.md +2 -2
  103. package/docs/zh/harnesses/substrate.md +4 -4
  104. package/docs/zh/harnesses/taskpool.md +2 -2
  105. package/docs/zh/latest.md +9 -5
  106. package/docs/zh/quickstart.md +20 -41
  107. package/docs/zh/reference/api.md +1 -1
  108. package/docs/zh/reference/cli.md +19 -79
  109. package/docs/zh/sandbox.md +3 -3
  110. package/examples/README.md +16 -5
  111. package/examples/authoring/README.md +4 -4
  112. package/examples/autoresearch/README.md +15 -8
  113. package/examples/autoresearch/REQUIREMENTS.zh.md +3 -10
  114. package/examples/autoresearch/demo.ts +1 -1
  115. package/examples/autoresearch/eject.json +2 -0
  116. package/examples/autoresearch/frontiercs2-config.ts +4 -0
  117. package/examples/autoresearch/prepare-demo.ts +15 -0
  118. package/examples/autoresearch/prepare.ts +3 -3
  119. package/examples/autoresearch/project.ts +2 -19
  120. package/examples/code/README.md +25 -17
  121. package/examples/code/REQUIREMENTS.zh.md +3 -3
  122. package/examples/harness-session/README.md +3 -3
  123. package/examples/messages/README.md +1 -1
  124. package/examples/notes/README.md +3 -3
  125. package/examples/services/mathlib-search/README.md +1 -1
  126. package/examples/services/persistent-board/README.md +5 -2
  127. package/examples/subagents/README.md +2 -2
  128. package/examples/subagents/config.ts +4 -3
  129. package/examples/substrate/README.md +2 -2
  130. package/examples/super/README.md +34 -22
  131. package/examples/super/actions.ts +11 -11
  132. package/examples/super/config.ts +3 -3
  133. package/examples/super/eject.json +1 -1
  134. package/examples/super/location.ts +1 -1
  135. package/examples/super/operator.ts +28 -0
  136. package/examples/super/project.ts +1 -3
  137. package/npm-shrinkwrap.development.json +42 -1541
  138. package/npm-shrinkwrap.json +3 -43
  139. package/package.development.json +2 -6
  140. package/package.json +2 -5
  141. package/scripts/anyswarm-arguments.ts +67 -96
  142. package/scripts/anyswarm-eject.ts +1 -1
  143. package/scripts/anyswarm-harnesses.ts +1 -18
  144. package/scripts/anyswarm-installation.ts +18 -294
  145. package/scripts/anyswarm-launch.ts +30 -102
  146. package/scripts/anyswarm-progress.ts +95 -0
  147. package/scripts/anyswarm-project.ts +31 -123
  148. package/scripts/anyswarm-source-runner.ts +9 -36
  149. package/scripts/anyswarm.ts +4 -24
  150. package/scripts/local-environment.ts +71 -20
  151. package/scripts/local-setup.ts +134 -94
  152. package/scripts/pack-release.ts +4 -1
  153. package/src/core/worker-image.ts +1 -1
  154. package/src/harness/project-harness.ts +2 -2
  155. package/src/harness/project-runtime.ts +2 -1
  156. package/dist/scripts/anyswarm-applications.d.ts +0 -19
  157. package/dist/scripts/anyswarm-applications.js +0 -19
  158. package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
  159. package/dist/scripts/anyswarm-tui-config.js +0 -189
  160. package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
  161. package/dist/scripts/anyswarm-tui-session.js +0 -304
  162. package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
  163. package/dist/scripts/anyswarm-tui-terminal.js +0 -154
  164. package/dist/scripts/anyswarm-tui.d.ts +0 -2
  165. package/dist/scripts/anyswarm-tui.js +0 -1012
  166. package/docs/architecture/25-foreground-tui.md +0 -51
  167. package/scripts/anyswarm-applications.ts +0 -39
  168. package/scripts/anyswarm-tui-config.ts +0 -174
  169. package/scripts/anyswarm-tui-session.ts +0 -295
  170. package/scripts/anyswarm-tui-terminal.ts +0 -147
  171. package/scripts/anyswarm-tui.ts +0 -912
@@ -10,7 +10,7 @@ Website CI runs for the site, bilingual guides, documentation images, and change
10
10
 
11
11
  The content loader reads the repository's `docs/en/` (English) and `docs/zh/` (Chinese), validating each page's title, description, section, and order. Astro prerenders the English and Chinese landing pages (`/` and `/zh/`) plus one documentation route per content slug under `/docs/` and `/zh/docs/`. The shared layouts use those fields for page metadata, navigation, the current page marker, a top-right language switcher linking each page to its counterpart locale, and active table-of-contents tracking. Copy page writes the title, description, and rendered article text to the clipboard. It excludes the code-copy controls and displays success or failure on the button. The site uses Astro’s Sätteri Markdown processor with a local link plugin. The Markdown files are the shared source for GitHub readers and the site. Authors write relative file links such as `../runtime.md` or `harnesses/index.md`. `markdown-doc-links.mjs` resolves each link from its source file, checks that the destination exists inside the repository, and converts guide links to the matching locale route with `BASE_PATH`. Links to implementation files or manuals become GitHub source links. The transform preserves query strings and fragments. Absolute external URLs and same-page fragments retain their meaning. A missing file fails the build instead of publishing a broken route. The URL helper adds the configured base to generated navigation, search destinations, and the favicon. Astro bundles local font assets and inline SVG landing schematics. The public directory supplies the favicon and verbatim font license notices. Departure Mono’s notice and font come from the [upstream font assets](https://github.com/rektdeckard/departure-mono/tree/75152a3f1e6dacdd248a6c397c97dbf27e33eea0/public/assets). The other notices come from the locked Fontsource packages. Update the included notices when changing the corresponding fonts.
12
12
 
13
- The shared top navigation displays the documented release, currently `v0.5.0`, and links to the release page in the active language. The version label is set in `TopNav.astro` when the stable guides advance. The website navigation and both landing pages render the same six-bird mark at different sizes with the active site foreground color. The browser icon uses the same geometry and follows the browser’s color scheme. The repository README selects the light or dark SVG through its picture element. The Trace Viewer and static replay use the same six silhouettes in their headers. Astro copies the transparent PNG export to `/anyswarm-logo.png` under the configured base path for direct download.
13
+ The shared top navigation displays the documented release, currently `v0.5.1`, and links to the release page in the active language. The version label is set in `TopNav.astro` when the stable guides advance. The website navigation and both landing pages render the same six-bird mark at different sizes with the active site foreground color. The browser icon uses the same geometry and follows the browser’s color scheme. The repository README selects the light or dark SVG through its picture element. The Trace Viewer and static replay use the same six silhouettes in their headers. Astro copies the transparent PNG export to `/anyswarm-logo.png` under the configured base path for direct download.
14
14
 
15
15
  The browser handles the landing page diagrams, Harness selector, theme, and site navigation. Search indexes documentation titles, descriptions and sections for the current locale at build time and uses sidebar labels and order for pages in the navigation. Other pages use their frontmatter section and order. The Tutorials group contains the first SDK Harness and Swarm Harness guides. Opening search shows up to eight pages. Typing filters the index locally. Search renders results and empty-query feedback as DOM text, uses only built documentation destinations, and sends no queries to a server. Escape or backdrop click closes it and returns focus to the navigation button. The theme preference stays in browser storage. The site writes no server-side session state.
16
16
 
@@ -20,14 +20,11 @@ Regenerate that bundle with `node website/scripts/build-trace-demo.mjs`. `--root
20
20
 
21
21
  ## Publish and recover
22
22
 
23
- During the v0.4.1 scope transition, Pages deployed the updated installer before GitHub Latest advanced. Both releases retain the same GitHub asset naming scheme. The published installer supports one-time migration from the archived v0.4.0 npm scope to the managed CLI. [Release procedure](../workflows/development.md#release-verification)
23
+ Both landing pages display the global npm install command and a copy button with clipboard success or failure feedback. Each locale links to its Quickstart and the project-local SDK installation section of the API reference. [npm installation and update](07-run-configuration.md#npm-cli-installation-and-update) describes prefix selection and failure recovery.
24
24
 
25
- Astro copies [the CLI installer](../../website/public/install.sh) verbatim into the Pages artifact at `/anyswarm/install.sh`. It checks Node.js and npm, chooses a writable prefix, and stages the verified stable archive before activating the two CLI entries. The installer reports the active binary, actual package root, source and SHA-256. Its `--archive` input takes an explicit absolute local tarball for release verification. Host setup and CLI update are separate commands. [Managed installation and update](07-run-configuration.md#managed-cli-installation-and-update) describes the on-disk generations and activation.
26
- The homepage offers two CLI installation tabs. Global npm is selected on first render and shows `npm install -g @anyswarm/core`. The shell installer tab shows the same curl-to-sh command as the Quickstart and tells users how to update a managed install. Selecting either tab changes the displayed command, copy text and explanatory note. Both locales link to their CLI Quickstart and to the SDK installation section of the API reference. That section shows the project dependency command and explains how to run the local CLI through `npm exec`.
25
+ Website CI verifies that the static build omits the retired installation script. The homepage command and bilingual Quickstart parity test runs on changes to those sources and is included in the full Core suite.
27
26
 
28
- curl prints download errors to stderr. A shell with `pipefail` enabled also propagates a curl failure through the pipeline exit status. The installer looks for the managed activation entry in `@anyswarm/core` first, then in `@anyswarm/anyswarm` for v0.4.1. If the staged npm bin directory has an executable `anyswarm` and no `anys` entry, the shell script adds an `anys` symlink to `anyswarm` inside the stage. This keeps existing prefixes with a managed short link usable when rolling back through the shell installer to an archive that predates that alias. The activated archive runs its own version and executable ownership checks, and supplies its own activation lock implementation. On Darwin, the installer supplies a temporary lock compatibility command for the checksum-verified v0.5.0 archive. That archive's CLI still carries its original updater. Upgrade a managed v0.5.0 Mac installation by rerunning the current site installer in the same prefix. The GitHub Release asset name stays stable. The release page starts at v0.5.0 and links to GitHub release history for earlier packages. Website CI verifies that the built installer matches the source. The focused install-command and installer tests also run when the installer script, the install command component, or either Quickstart changes. The full Core suite includes those tests.
29
-
30
- The [Pages workflow](../../.github/workflows/deploy-website.yml) starts after a push to `main` that changes `website/`, `docs/en/`, `docs/zh/` or its workflow, from manual dispatch for a selected ref, or after a successful tag-triggered Release run. The workflow requires `AnySwarm/anyswarm` and the `main` ref. It builds only after GitHub marks a release containing `luna-shi-anyswarm.tgz` as Latest. The installer can serve the historical v0.4.0 archive before a managed-install release is available. GitHub Pages uses the GitHub Actions source. The `github-pages` environment allows deployment from `main`. The workflow reads the site origin and base path from Pages, runs a locked Node 24 build, then uploads `website/dist/` as a Pages artifact. The deploy job runs only after the build succeeds and publishes that artifact using the repository Pages permission and an OIDC token. Each successful deployment replaces the entire published site under the configured base path. The public site is at `https://anyswarm.github.io/anyswarm/`. The organization transfer changed the origin, and GitHub Pages does not redirect requests from the previous origin. A deployed artifact must include both locale trees to serve both locales. Deployments share a concurrency group. No npm package publish or sandbox setup runs in this workflow.
27
+ The [Pages workflow](../../.github/workflows/deploy-website.yml) starts after a push to `main` that changes `website/`, `docs/en/`, `docs/zh/` or its workflow, from manual dispatch for a selected ref, or after a successful tag-triggered Release run. The workflow requires `AnySwarm/anyswarm` and the `main` ref. It builds only after GitHub marks a release containing `luna-shi-anyswarm.tgz` as Latest. GitHub Pages uses the GitHub Actions source. The `github-pages` environment allows deployment from `main`. The workflow reads the site origin and base path from Pages, runs a locked Node 24 build, then uploads `website/dist/` as a Pages artifact. The deploy job runs only after the build succeeds and publishes that artifact using the repository Pages permission and an OIDC token. Each successful deployment replaces the entire published site under the configured base path. The public site is at `https://anyswarm.github.io/anyswarm/`. The organization transfer changed the origin, and GitHub Pages does not redirect requests from the previous origin. A deployed artifact must include both locale trees to serve both locales. Deployments share a concurrency group. No npm package publish or sandbox setup runs in this workflow.
31
28
 
32
29
  Installation, build or environment errors surface in the corresponding Actions job. A successful deploy job records the public URL. A failed build leaves the previously published site available. After fixing a failed deployment, dispatch the workflow on `main` and verify both landing pages, a nested documentation route in each locale, and a static asset under the configured base. The package and local build output are independent of the live deployment history.
33
30
 
@@ -1,6 +1,6 @@
1
1
  # Harness entry and lifecycle
2
2
 
3
- The installed `anyswarm --harness` command runs one project. Its task input is a host directory and one nonblank prompt. Run configuration can choose resources, services, and limits. [Launch and configuration](07-run-configuration.md) covers host preparation and the editable SDK template.
3
+ The installed `anyswarm --harness` command runs one project. Its task input is a host directory and one nonblank prompt. Bare `anyswarm` prints Quickstart and exits 0. Run configuration can choose resources, services, and limits. [Launch and configuration](07-run-configuration.md) covers host preparation and the editable SDK template.
4
4
 
5
5
  ## Authoring an example
6
6
 
@@ -73,7 +73,34 @@ A mutation carries one `requestId`. The Session stores the operation and normali
73
73
 
74
74
  The Session owns the only input handler and captures operation identities before dispatch. The preparation and storage code owns project capture, the Run directory and the stop deadline. Normal return, exceptions, preflight failure, stop and timeout all use the same terminal path. That path seals new Session mutations and questions before cancelling unresolved questions and capturing the operation dispositions. Callbacks released by cancellation cannot admit new work while the report is being saved. Original mutation receipts can still be reconciled. Late evidence does not change the final record.
75
75
 
76
- The Host writes `project-run.json` atomically with private permissions. The report retains the full JSON result and sanitizes known credentials in business evidence and terminal failure messages before saving. `completion`, the final event, the final RPC record and foreground output share a result of at most 256 KiB. A large result marks `snapshotTruncated` and preserves the outcome, export and cleanup statuses, save status and a report path when saving succeeded. A save failure omits the report path. If its stop deadline expires before the Harness confirms cleanup, it reports pending resources. Required export failure can retain the Sandbox and its Slot. Exit 0 requires completed business and confirmed required export, cleanup and report save. Exit 1 records cancellation, business failure or unresolved results. Launch validation uses exit 2, SIGINT uses 130, and SIGTERM uses 143. EOF and input or output failure enter the same foreground stop path.
76
+ The Host writes `project-run.json` atomically with private permissions. The report retains the full JSON result and sanitizes known credentials in business evidence and terminal failure messages before saving. `completion`, the final event, the final RPC record and piped one-shot output share a result of at most 256 KiB. A large result marks `snapshotTruncated` and preserves the outcome, export and cleanup statuses, save status and a report path when saving succeeded. A save failure omits the report path. If its stop deadline expires before the Harness confirms cleanup, it reports pending resources. Required export failure can retain the Sandbox and its Slot. Exit 0 requires completed business and confirmed required export, cleanup and report save. Exit 1 records cancellation, business failure or unresolved results. Launch validation uses exit 2, SIGINT uses 130, and SIGTERM uses 143. RPC EOF or input failure and an output failure enter the same stop path.
77
+
78
+ ## One-shot terminal output
79
+
80
+ The CLI loads and validates the selected module, then constructs a HarnessSession.
81
+ For a module with a workspace resolver, the CLI resolves any explicit trusted
82
+ configuration early to choose the default workspace and allow time for configured
83
+ cleanup. Explicit `--cwd` wins. The early load uses the same configuration validation and stable error messages as admission. A rejected configuration or resolver exits before the Session starts and before any Run directory is created. Other configuration loads occur during admission.
84
+ RPC takes its workspace from the client's run request.
85
+
86
+ With terminal stdout, the CLI prints the Harness name and a copyable Trace
87
+ command for the selected or default state directory before admission. It
88
+ subscribes before starting the Session and writes compact phase transitions,
89
+ Agent startup, Sandbox readiness when an Agent reaches idle or running, turn
90
+ settlement, Agent closure and Service lifecycle changes. Static Service names
91
+ come from Session observation handles when the Harness reaches running. Progress
92
+ uses only the redacted Session projection and escapes terminal control characters.
93
+ Arbitrary business events, messages, and question contents stay out of progress.
94
+ On completion it prints outcome, separately observed export and cleanup statuses,
95
+ up to five artifact paths, the saved report path when available, and a Trace
96
+ command for the actual Run root. The final path accounts for the Host's fallback
97
+ when the default state directory cannot be used. Trace is started explicitly in
98
+ a separate process and can read records as they are written.
99
+
100
+ Piped stdout keeps the single machine-readable result. Both one-shot modes wait
101
+ for Session completion and final stdout flush before returning the exit status.
102
+ Output failure enters the existing cleanup path. Lifecycle observation has the
103
+ same bounded subscription semantics as other Session observers.
77
104
 
78
105
  ## Agent controls and live state
79
106
 
@@ -117,7 +144,7 @@ Register an owned Runtime through `context.registerAgentControls({ runtime, ...
117
144
 
118
145
  Harness authors can call `context.askUser` for text, choice or confirmation. Questions bind a stable question and request ID to a source and cancellation signal. For a Service the source comes from the authenticated caller and Service invocation, and authorization is checked again before accepting an answer and before the Service resumes. Subagents conditionally exposes the `user-interaction ask` Service to its Profiles when the client has enabled questions. The request schema accepts the question text. The service reply contains the answer. A question and its source exist in the projection before any event is emitted. A response specifies `questionId`; competing answers, timeout, loss of authorization and stop resolve to a single terminal state. Question stop and source cancellation prevent old work from consuming a late answer.
119
146
 
120
- Clients enable the answer channel with `clientCapabilities.questions`, or with `--interaction questions` on the CLI. It defaults to false and is independent of lifetime. A Run allows up to 64 question identities by default, with an aggregate budget limited by 256 KiB and one third of the snapshot budget. It reserves space for the question identity, source, timestamps, options, terminal fields and largest legal answer before admission. A confirm reserves a boolean, a choice reserves its longest declared option ID, and a text question exposes `maxAnswerBytes` (16 KiB of JSON-encoded string, including quotes). The Session rechecks the source and authorization after asynchronous target lookup and checks for abort again after installing the listener. The default timeout is 60 seconds and the maximum is one hour. The final report retains the question dispositions. Without an answer channel the SDK reports unsupported before publishing a question.
147
+ Clients enable the answer channel with `clientCapabilities.questions`, or with `--interaction questions` in CLI RPC mode. It defaults to false and is independent of lifetime. A Run allows up to 64 question identities by default, with an aggregate budget limited by 256 KiB and one third of the snapshot budget. It reserves space for the question identity, source, timestamps, options, terminal fields and largest legal answer before admission. A confirm reserves a boolean, a choice reserves its longest declared option ID, and a text question exposes `maxAnswerBytes` (16 KiB of JSON-encoded string, including quotes). The Session rechecks the source and authorization after asynchronous target lookup and checks for abort again after installing the listener. The default timeout is 60 seconds and the maximum is one hour. The final report retains the question dispositions. Without an answer channel the SDK reports unsupported before publishing a question.
121
148
 
122
149
  ## JSONL RPC
123
150
 
@@ -149,7 +176,7 @@ For the ordinary TaskPool entry, Workspace reads and publication accept the same
149
176
 
150
177
  ## Compatible launch surfaces
151
178
 
152
- Previously generated Subagents hosts are still directly runnable through their own entry point. The installed aliases open the [streaming terminal](25-foreground-tui.md) with no arguments in an interactive terminal. Setup and doctor remain explicit commands. The previous explicit Notes and Messages fixtures exercise the fixed observation and undeclared random string scripts. The explicit PeerMesh JSON fixture and prior Lead–Worker staged or Orders paths retain their benchmark roles. FATE preparation, single run, matrix and rescoring use explicit flags. Each uses its own fixtures rather than the ordinary project command.
179
+ Previously generated Subagents hosts are still directly runnable through their own entry point. The previous explicit Notes and Messages fixtures exercise the fixed observation and undeclared random string scripts. The explicit PeerMesh JSON fixture and prior Lead–Worker staged or Orders paths retain their benchmark roles. FATE preparation, single run, matrix and rescoring use explicit flags. Each uses its own fixtures rather than the ordinary project command.
153
180
 
154
181
  [Prompt composition and exact texts](08-prompts.md) · [Workspace handoff](05-workspace-continuity.md) · [Report semantics](17-harness-reporting.md)
155
182
 
@@ -173,7 +200,7 @@ RPC query or mutation rejection carries the same recognized framework fields bes
173
200
 
174
201
  ## TypeScript author entry and source export
175
202
 
176
- `anyswarm run ./harness.ts` and `anys run ./harness.ts` start a child Node process
203
+ `anyswarm run ./harness.ts` starts a child Node process
177
204
  with source maps enabled and forward the remaining arguments and standard streams.
178
205
  The parent forwards SIGINT and SIGTERM and returns the child's exit code. The
179
206
  child installs synchronous module hooks before loading the trusted author entry.
@@ -188,17 +215,15 @@ SDK. The trusted Harness and configuration loading paths enable these same hooks
188
215
  so explicit foreground/RPC and the legacy repository foreground runner can
189
216
  load TypeScript configuration modules as well.
190
217
 
191
- An entry without a default Harness executes as a normal TypeScript program with
218
+ An entry without a default Harness executes as an ordinary source program with
192
219
  its original argv. A default Harness with `apiVersion: 1` and `run` is dispatched
193
- through the same TUI, foreground or RPC host used by explicit `--harness`.
194
- With no arguments, a Harness supporting task lifetime receives a default prompt.
195
- An interactive-only Harness opens the TUI, which requires stdin and stdout to be
196
- terminals. Authors can pass `--mode tui`, `--prompt`, `--cwd`,
197
- `--config ./config.ts`, lifetime, output and RPC options. Explicit RPC and
198
- foreground invocations send top-level source and configuration logs to stderr.
199
- With no arguments, the loader inspects the effective TypeScript module source
200
- before evaluation. A TypeScript module without a default export and a legacy
201
- JavaScript entry stream stdout immediately, so they can prompt while evaluating.
220
+ through the same one-shot or RPC host used by explicit `--harness`. A source
221
+ entry accepts `--cwd`, `--config`, `--prompt` and `--output-dir`. Omitted prompt
222
+ uses `Run this Harness.` in one-shot mode. One-shot execution requests task
223
+ lifetime and provides no question channel. An interactive-only Harness needs an
224
+ explicit RPC or SDK client. RPC admits the first input over stdin.
225
+ The loader inspects the effective source before an implicit import. Modules
226
+ without a default export can stream stdout immediately.
202
227
  When a TypeScript entry could export a Harness,
203
228
  the first stdout write opens a private temporary file and unlinks its path.
204
229
  The loader starts replaying to stdout before input arrives when the module adds
@@ -210,18 +235,18 @@ import produced stdout and exports a task Harness, the implicit foreground comma
210
235
  exits 1 and requests an explicit `--prompt` before it admits a Run.
211
236
  For other imports, replay starts when evaluation returns or fails. The loader uses
212
237
  stderr for an implicit foreground Harness or a failed import, and stdout for a
213
- plain script or an interactive-only Harness. It restores the output writer,
238
+ plain script. It restores the output writer,
214
239
  removes its stdin listeners, restores its temporary `stdin.read` override and
215
240
  closes the temporary file. A script that exits
216
241
  directly during import writes pending output to stdout up to the stream's
217
242
  backpressure limit, or leaves an active replay's queued writes in order.
218
- Foreground results and RPC records retain their existing stdout protocol.
219
- Source entry, configuration import and Harness exceptions retain original source
220
- locations on stderr for the author command's foreground and RPC paths.
221
- In an ordinary non-Git author directory, generated
222
- Untracked top-level `node_modules`, `.anyswarm-sdk` and Code recovery directories named `.anyswarm-code-recovery-` plus a six-character suffix are excluded from project capture. Explicit Git-tracked files at those paths keep the tracked-file capture behavior.
243
+ A piped one-shot Run emits a single JSON result or launch error. RPC preserves
244
+ its JSONL protocol and bounded write queue regardless of terminal detection.
245
+ Source diagnostics and Harness console output go to stderr. Configuration
246
+ loading inside the Host records a stable configuration failure in the Run report.
247
+ In a non-Git author directory, untracked top-level `node_modules`, `.anyswarm-sdk` and Code recovery directories named `.anyswarm-code-recovery-` plus a six-character suffix are excluded from project capture. Explicit Git-tracked files at those paths keep the tracked-file capture behavior.
223
248
 
224
- `anys eject <code|autoresearch|super|example> --dir <target>` selects a packaged
249
+ `anyswarm eject <code|autoresearch|super|example> --dir <target>` selects a packaged
225
250
  application's `examples/<id>/eject.json`; `example` selects `examples/authoring`.
226
251
  The version-1 manifest names its TypeScript entry, an explicit file list and optional additional npm dependencies. The engine
227
252
  rejects absolute/traversal paths, private/runtime/build directories, secret-file
@@ -240,7 +265,7 @@ under `sdk.content`. The current command also reads version 1 exports from the
240
265
  previous candidate. New exports omit the old fields so an older CLI rejects them
241
266
  before loading source. Build provenance is generated into the package by
242
267
  `scripts/build.ts`; it remains unknown when Git revision information was
243
- unavailable. Before evaluating the entry, `anys run` hashes the recorded inventory
268
+ unavailable. Before evaluating the entry, `anyswarm run` hashes the recorded inventory
244
269
  of its own executable package. It resolves `@anyswarm/core` from the author entry
245
270
  with Node's ESM conditions and the same CLI fallback used for imports. It checks
246
271
  that the resolved file belongs to the inventory and that all listed package files
@@ -1,10 +1,15 @@
1
1
  # Code application
2
2
 
3
- Code is the installed `code` application and an ejectable TypeScript Harness. The [issue](https://github.com/AnySwarm/anyswarm/issues/336) combines the [reviewed project entry](https://github.com/AnySwarm/anyswarm/blob/45775d7312e62a791ab8a097c5e7715dc3c9d548/docs/designs/core-harness/06-project-harness.md) with interactive turn integration. The project on the host supplies the baseline and receives normal authorized changes. The Runtime owns the writable Root and any isolated editors it delegates to.
3
+ Code is an ejectable TypeScript Harness and an advanced SDK example. The [issue](https://github.com/AnySwarm/anyswarm/issues/336) combines the [reviewed project entry](https://github.com/AnySwarm/anyswarm/blob/45775d7312e62a791ab8a097c5e7715dc3c9d548/docs/designs/core-harness/06-project-harness.md) with interactive turn integration. The project on the host supplies the baseline and receives normal authorized changes. The Runtime owns the writable Root and any isolated editors it delegates to.
4
4
 
5
5
  ## Entry and team
6
6
 
7
- `anys -u code` selects the application in the shared terminal for the current directory. `anys -u code "task"` submits the prompt after successful configuration. From bare `anys`, `/code` selects the same application. The host resolves the directory, prepares a private Run output directory and captures the initial project using the common project admission policy. `anys -u code --headless --lifetime task "task"` runs one task and emits JSONL. Interactive SDK and RPC clients submit later strings to the same Session.
7
+ `anyswarm eject code --dir ./code-src` exports the source project and its pinned SDK.
8
+ Install it with npm and run `npm run start -- --cwd <project> --prompt <task>` for
9
+ one task. The host resolves the directory, prepares a private output directory
10
+ and captures the initial project using the common admission policy. For later
11
+ turns, a caller uses `createHarnessSession` or starts the same source with
12
+ `--mode rpc --lifetime interactive` and submits subsequent inputs to that Session.
8
13
 
9
14
  Code reads the executor, Sandbox, image, models, optional `model` alias and `maxEditors`. The alias defaults to `default`. `maxEditors` is 1 or 2 and defaults to 2. The first task seeds a writable Root from the project capture. Root reads and edits that copy and can run the available tools. The Root instructions call for direct work on ordinary tasks and delegation when the user asks for it. A simple task uses one Sandbox. Each delegated editor adds a separate Sandbox seeded from the same start-of-turn baseline, and is stopped once its result has been captured.
10
15
 
@@ -20,9 +25,19 @@ Code uses the same authenticated Service and Runtime spawn, send and settled-eve
20
25
 
21
26
  Both roles can call `ask` when the owner client accepts questions. Pi exposes direct Service tools and Codex uses `swarm code` in the Sandbox. The Service also publishes live stage, turn, editor IDs and file counters. Session controls can steer or stop an individual running member. Interrupting an editor excludes its proposal while Root and other work can continue. Interrupting Root fences the active turn and requests interruptions for the other participants. Work waits default to 300 seconds per editor and an additional 60 seconds for Root. Runtime close waits default to 30 seconds.
22
27
 
23
- The shared terminal renders Code's stage changes and turn summaries through the ordinary Session event stream. Completed turns include the writeback outcome, changed paths and verification status with a command preview and exit code when available. Inline decision cards show Service questions and host check confirmations. Reply with `/reply <id> <answer>` or use `/y` and `/n` for confirmations. `/agents` shows the member roster and supported controls. `@<editor> <message>` forwards text through Session steering, and `/stop <editor>` stops a single member. Ctrl+C interrupts the active Root turn when no member is targeted. The Session remains open for the next task. An explicit `/quit` while idle after an applied turn exits 0 when cleanup succeeds. A failed, partial or interrupted last task retains a failing exit status. The terminal prints the saved report location after restoring the screen.
28
+ The Session publishes Code's stage changes and each completed turn's writeback
29
+ outcome, changed paths, verification command and exit code where available.
30
+ An SDK/RPC client can enable questions and answer by question ID, steer or
31
+ interrupt a member, or stop and wait for cleanup. An interrupted turn leaves an
32
+ interactive Session available for later tasks. A one-shot process waits for
33
+ cleanup and prints the saved report path. A failed, partial or interrupted last
34
+ turn produces a failing exit status.
24
35
 
25
- Code declares `diff` in its input descriptor. An active Session routes `/diff` to the Code input handler, which immediately reports the most recent completed turn, even while the next task is running. The report emits up to 12 paths, up to eight hunk or changed lines, and the retained patch path when available. Long patch paths span consecutive stream entries. It prefers the applied patch and reports the candidate patch when writeback did not produce an applied patch. Before the first completed turn it reports that there is no turn to show. The command performs no capture, model request or worktree write.
36
+ The input descriptor declares `diff`. A client can send `/diff` as a Session
37
+ input to retrieve the last completed turn, even while the next task is running.
38
+ It emits up to 12 paths, a preview of up to eight diff lines and the retained
39
+ patch path. It prefers the applied patch and falls back to the candidate. The
40
+ operation performs no capture, model request or worktree write.
26
41
 
27
42
  ## Integration, check and writeback
28
43
 
@@ -36,4 +51,4 @@ The current Core file transport needs a complete snapshot for result download an
36
51
 
37
52
  ## Evidence and authoring
38
53
 
39
- `anys eject code` copies the application manifest's TypeScript files and binds the exported SDK to the installed bytes. The source uses public Harness, Runtime, Service and file APIs. The same design supports one-shot benchmark tasks with an explicitly configured project and Worker. The focused native regression exercises the actual local Worker with a controlled model endpoint. It checks single-Root editing and reuse, user edits between turns, concurrent Root and editor work, a stopped editor with partial writeback, rejected verification and owned container cleanup. With a candidate archive, it also drives the installed entry in a real PTY, inspecting the patch stream, accepting and declining checks, answering editor questions, steering an active editor, and stopping one editor while the other finishes. Archive acceptance checks the exported source before and after an author edit. Real-model acceptance and any ProgramBench results have separate evidence in the linked Issue or PR.
54
+ `anyswarm eject code` copies the application manifest's TypeScript files and binds the exported SDK to the installed bytes. The source uses public Harness, Runtime, Service and file APIs. The same design supports one-shot benchmark tasks with an explicitly configured project and Worker. The focused native regression exercises the actual local Worker with a controlled model endpoint. It checks single-Root editing and reuse, user edits between turns, concurrent Root and editor work, a stopped editor with partial writeback, rejected verification and owned container cleanup. Archive acceptance checks the exported source before and after an author edit. Real-model acceptance and any ProgramBench results have separate evidence in the linked Issue or PR. The driver resolves the compiled Code module from the selected CLI package and starts it with an explicit one-shot prompt.
@@ -4,15 +4,18 @@ The Personal Harness accepts user requests from an explicitly configured GitHub
4
4
 
5
5
  ## Setup and ownership
6
6
 
7
- The `super` module exports `observe` and `slashActions`. Select it with `/super`, `anys -u super`, or the registered `anys super` alias. `/setup` accepts the repository, allowed requesters and file scope as arguments, infers the GitHub repository from `origin` when configured, and opts into automatic branch and PR writes only with `--publish`. The configured Pi installation and model come from the host. With no requester override it uses the authenticated login. The command reads the actual account, repository, comments, default branch and each selected file. It reports the credential permission sets and how to verify write authority on GitHub. GitHub tokens come from host environment or the existing GitHub CLI credential store. Model headers come from host configuration. Neither is included in settings, the source export or the work input.
7
+ The ejected `super` example provides `project.ts` for SDK callers and
8
+ `operator.ts` for explicit commands. After installing the ejected SDK, use
9
+ `npm exec -- anyswarm run ./operator.ts setup`, then `start`, `jobs` or `stop`
10
+ from the same launch directory. Setup accepts the repository, allowed requesters and file scope as arguments, infers the GitHub repository from `origin` when configured, and opts into automatic branch and PR writes only with `--publish`. The configured Pi installation and model come from the host. With no requester override it uses the authenticated login. The command reads the actual account, repository, comments, default branch and each selected file. It reports the credential permission sets and how to verify write authority on GitHub. GitHub tokens come from host environment or the existing GitHub CLI credential store. Model headers come from host configuration. Neither is included in settings, the source export or the work input.
8
11
 
9
12
  `configured` means the GitHub settings were saved. The setup result marks the repository, comment and selected content reads as verified. Reply and publication writes remain unverified until real use. If GitHub denies repository push in its permissions response, Personal reports that denial and rejects setup with automatic publication enabled. Backend configuration is validated locally, separately from Worker and model connectivity. A Codex selection reports that Personal requires Pi. Missing or invalid model variables report the specific setting to fix. Setup performs GitHub reads and local checks. The first work item exercises Worker and model connectivity. A reply and an approved publication exercise their respective GitHub writes.
10
13
 
11
- A private state directory is keyed by the launch project path. `/setup` validates GitHub read authority before acquiring ownership and atomically replacing settings. An exclusive Node SQLite transaction in `daemon.lock.sqlite` protects setup, daemon startup and foreground export runs without holding locks on the Inbox database. Node closes the lock connection at normal exit and the OS releases its file lock on process death. The lock file remains for later contenders. Stop a running older candidate before switching versions. The implementation uses POSIX Unix sockets and Node SQLite on Linux and macOS. The GitHub and Pi acceptance environment is Linux.
14
+ A private state directory is keyed by the launch project path. `setup` validates GitHub read authority before acquiring ownership and atomically replacing settings. An exclusive Node SQLite transaction in `daemon.lock.sqlite` protects setup, daemon startup and foreground export runs without holding locks on the Inbox database. Node closes the lock connection at normal exit and the OS releases its file lock on process death. The lock file remains for later contenders. Stop a running older candidate before switching versions. The implementation uses POSIX Unix sockets and Node SQLite on Linux and macOS. The GitHub and Pi acceptance environment is Linux.
12
15
 
13
- `/start` probes for a live socket before spawning a detached Node process through the generic loader. The child obtains ownership, checks that an older observer is absent and removes a stale socket owned by the current user. It creates one interactive, question-capable HarnessSession and admits a Run from a private empty launch directory. The Unix socket serves JSONL using `runProjectRpc` with `detachOnDisconnect`. Closing a client ends its subscription. Stop sends the ordinary Session stop request and the stand-alone action waits for the final cleanup receipt. Socket startup failure stops admitted work before releasing ownership. The daemon log reports listening, exit outcome and cleanup. Stand-alone actions are also available through `anys -u super --cmd '/action [args]'`. The exported TypeScript module uses the same actions and lock.
16
+ `start` probes for a live socket before spawning a detached Node process through the generic loader. The child obtains ownership, checks that an older observer is absent and removes a stale socket owned by the current user. It creates one interactive, question-capable HarnessSession and admits a Run from a private empty launch directory. The Unix socket serves JSONL using `runProjectRpc` with `detachOnDisconnect`. Closing a client ends its subscription. Stop sends the ordinary Session stop request and the stand-alone action waits for the final cleanup receipt. Socket startup failure stops admitted work before releasing ownership. The daemon log reports listening, exit outcome and cleanup. The detached command is the same operator entry with its internal serve action enabled by the application. The operator owns signals and exits after returning its JSON result or error.
14
17
 
15
- Before launching the daemon, `/start` validates the local backend configuration and locates the GitHub credential. A Run that fails during GitHub identity verification, backend configuration, Runtime initialization or processing records a stage, stable code and operator hint in the Inbox, the Harness event and the daemon log. An account mismatch stops before creating a Runtime. A Runtime initialization failure points to `anys doctor --smoke` and the OpenSandbox and callback configuration. These messages use fixed text and omit credentials and underlying error data. `/start` associates a failure with its own launch ID, including when the socket has already closed. `/jobs` and `/logs` include the latest saved failure. A new Run that reaches running clears the saved failure.
18
+ Before launching the daemon, `start` validates the local backend configuration and locates the GitHub credential. A Run that fails during GitHub identity verification, backend configuration, Runtime initialization or processing records a stage, stable code and operator hint in the Inbox, the Harness event and the daemon log. An account mismatch stops before creating a Runtime. A Runtime initialization failure points to `anyswarm doctor --smoke` and the OpenSandbox and callback configuration. These messages use fixed text and omit credentials and underlying error data. `start` associates a failure with its own launch ID, including when the socket has already closed. `jobs` and `logs` include the latest saved failure. A new Run that reaches running clears the saved failure.
16
19
 
17
20
  ## Receipt and routing
18
21
 
@@ -28,7 +31,7 @@ The host pins a GitHub commit, reads only validated regular file blobs, and over
28
31
 
29
32
  ## Publication and restarts
30
33
 
31
- Publication is optional. The outbox first records a branch checkpoint, then creates the dedicated work branch at the pinned base. It records a commit checkpoint and asks GitHub to update that branch with an exact expected head. It records a PR checkpoint and creates the Draft PR. A follow-up uses the same branch and PR. When automatic publication is disabled, the patch reply is delivered first. The latest eligible artifact then becomes available for an owner decision. `/approve <work>` records approval for that one artifact in the same SQLite transaction that queues publication. It wakes the poll loop and retains the original comment receipt. The later publication reply uses a distinct marker and receipt. `/reject <work> [reason]` records a local reason and selects the most recent confirmed artifact as the follow-up baseline. Review of an already rejected artifact can begin with a new Router turn. Enabling automatic publication and restarting queues the last eligible pending artifact in each work. An uncertain external write stays under reconciliation even if the settings change. The operator can retry permission-denied publication after fixing GitHub authority. The reply is sent to the exact Issue or PR conversation that requested this turn. It includes the Router's response, available verified patch/PR evidence and validation details. The host records the returned GitHub comment URL as the delivery receipt. Work completion, publication, conversation reply and resource cleanup have independent status.
34
+ Publication is optional. The outbox first records a branch checkpoint, then creates the dedicated work branch at the pinned base. It records a commit checkpoint and asks GitHub to update that branch with an exact expected head. It records a PR checkpoint and creates the Draft PR. A follow-up uses the same branch and PR. When automatic publication is disabled, the patch reply is delivered first. The latest eligible artifact then becomes available for an owner decision. `approve <work>` records approval for that one artifact in the same SQLite transaction that queues publication. It wakes the poll loop and retains the original comment receipt. The later publication reply uses a distinct marker and receipt. `reject <work> [reason]` records a local reason and selects the most recent confirmed artifact as the follow-up baseline. Review of an already rejected artifact can begin with a new Router turn. Enabling automatic publication and restarting queues the last eligible pending artifact in each work. An uncertain external write stays under reconciliation even if the settings change. The operator can retry permission-denied publication after fixing GitHub authority. The reply is sent to the exact Issue or PR conversation that requested this turn. It includes the Router's response, available verified patch/PR evidence and validation details. The host records the returned GitHub comment URL as the delivery receipt. Work completion, publication, conversation reply and resource cleanup have independent status.
32
35
 
33
36
  On restart, local execution without a prepared result can be rebuilt from the last verified artifact. Prepared results and outbox checkpoints remain in SQLite. For an uncertain mutation, the host reads the remote branch, expected commit marker, PR marker or comment marker to reconcile the same action. If it cannot establish the outcome, it shows the pending reconciliation and keeps that work fenced behind the unknown event. It keeps polling unrelated work. It does not replay the uncertain mutation. Runtime crash cleanup uses the original durable callback settings when configured and reports pending cleanup when it cannot verify deletion. Cross-host and cross-boot original Sandbox recovery are outside this contract.
34
37
 
@@ -36,8 +39,20 @@ Recording a PR number and marking that PR's feedback unread are one SQLite trans
36
39
 
37
40
  ## View and intervene
38
41
 
39
- The Personal Service supplies the bounded live view of source health, active Agents, recent events and delivery. `/jobs [work]` reads the durable queue, verified artifact path and digest, question, publication, reply, conflict and cleanup projections. Work selectors resolve `#<issue>` by the original Issue, or a unique hexadecimal prefix. Ambiguous prefixes require more characters.
40
-
41
- The shared streaming terminal attaches through `observe`, uses the Unix socket for its Session and opens the attached Runtime's records with `/trace`. The application emits business receipts and projects Router questions and publish approvals into inline decision cards. An approval card shows the saved diff statistic and Reviewer findings. Each card is bound to the durable event ID and verifies that the decision is still current before mutating state. The Session card expires after one hour and the durable action remains available through `/jobs` and the named command. Older saved patches show the available artifact summary. `/ask #<issue> <text>` and `@router <work> <text>` use the same input queue as GitHub. `/answer <work> <text>` addresses a waiting Router question. `/stop-work <work>` stops one work item and its owned members. The generic Session still exposes individual stop and observation controls. Business messages go through the Router. `q` and `/quit` detach from that background Session.
42
+ The Personal Service supplies the bounded live view of source health, active Agents, recent events and delivery. `jobs [work]` reads the durable queue, verified artifact path and digest, question, publication, reply, conflict and cleanup projections. Work selectors resolve `#<issue>` by the original Issue, or a unique hexadecimal prefix. Ambiguous prefixes require more characters.
43
+
44
+ SDK clients call `observe` in the daemon module to connect a
45
+ `HarnessRpcClient` to the private Unix socket. Disconnecting the client releases
46
+ its subscription and socket. The daemon continues to own the Run. Use
47
+ `anyswarm trace --root <state-directory>/runs` for Runtime evidence.
48
+
49
+ The application emits business receipts, Router questions and publish approvals
50
+ through the Session. An approval includes the saved diff statistic and Reviewer
51
+ findings. Each response is bound to the durable event and verifies that the
52
+ decision is still current. The live question expires after one hour. The durable
53
+ action remains available through `jobs` and the named operator command.
54
+ `ask #<issue> <text>` uses the same input queue as GitHub, `answer <work> <text>`
55
+ addresses the pending Router question, and `stop-work <work>` stops one work item
56
+ and its owned members.
42
57
 
43
58
  The prompt text and send order are documented in [Prompts](08-prompts.md).
@@ -1,24 +1,36 @@
1
1
  # AutoResearch
2
2
 
3
- AutoResearch is a finite-run Harness with equal research peers. The search loop and research Service are shared by a custom trusted evaluator and the FrontierCS-2 demo. The CLI uses the existing project session, source loader, terminal and viewer. The applicable product requirements are [#337](https://github.com/AnySwarm/anyswarm/issues/337), the owner’s subsequent four-peer decision, [#344](https://github.com/AnySwarm/anyswarm/issues/344) and the [integration review](https://github.com/AnySwarm/anyswarm/pull/342#issuecomment-7346884457), and the [Core and Harness design revision](https://github.com/AnySwarm/anyswarm/tree/45775d7312e62a791ab8a097c5e7715dc3c9d548/docs/designs/core-harness).
3
+ AutoResearch is a finite-run Harness with equal research peers. The search loop and research Service are shared by a custom trusted evaluator and the FrontierCS-2 demo. It is the flagship one-shot CLI showcase and uses the common task Session, source runner and Trace records. The applicable product requirements are [#337](https://github.com/AnySwarm/anyswarm/issues/337), the owner’s subsequent four-peer decision, [#344](https://github.com/AnySwarm/anyswarm/issues/344) and the [integration review](https://github.com/AnySwarm/anyswarm/pull/342#issuecomment-7346884457), [#351](https://github.com/AnySwarm/anyswarm/issues/351), and the [Core and Harness design revision](https://github.com/AnySwarm/anyswarm/tree/45775d7312e62a791ab8a097c5e7715dc3c9d548/docs/designs/core-harness).
4
4
 
5
5
  ## Prepare, start and observe
6
6
 
7
- `anys -u autoresearch --cmd /prepare` checks Linux x86-64, Git and LFS, Python, the Docker context and daemon, host resources, authenticated OpenSandbox Lifecycle access with configured `dns+nft`, a prepared Worker image and the configured Kimi K3 route. The model checks first validate the provider, model ID and fixed HTTP(S) Responses URL. For valid configuration, a HEAD probe uses any configured bearer token, follows no redirects and expires in five seconds. A 2xx or 405 response passes the HTTP route check. Denial, an unexpected status or a transport failure fails preparation. The report always marks model inference as not attempted. The first real model turn establishes inference availability. The default resource plan budgets 8 CPUs and 16 GiB for four Workers, 2 CPUs and 4 GiB for the Pumpkin submission role, 2 CPUs and 4 GiB for the active judge, and separate host and build headroom. The checked plan totals 16 CPUs, 30 GiB RAM and 12 GiB disk. Docker and provider placement still determine actual capacity.
7
+ `anyswarm run ./prepare-demo.ts` in the ejected example checks Linux x86-64, Git and LFS, Python, the Docker context and daemon, host resources, authenticated OpenSandbox Lifecycle access with configured `dns+nft`, a prepared Worker image and the configured Kimi K3 route. The model checks first validate the provider, model ID and fixed HTTP(S) Responses URL. For valid configuration, a HEAD probe uses any configured bearer token, follows no redirects and expires in five seconds. A 2xx or 405 response passes the HTTP route check. Denial, an unexpected status or a transport failure fails preparation. The report always marks model inference as not attempted. The first real model turn establishes inference availability. The default resource plan budgets 8 CPUs and 16 GiB for four Workers, 2 CPUs and 4 GiB for the Pumpkin submission role, 2 CPUs and 4 GiB for the active judge, and separate host and build headroom. The checked plan totals 16 CPUs, 30 GiB RAM and 12 GiB disk. Docker and provider placement still determine actual capacity.
8
8
 
9
9
  Preparation takes an exclusive state-directory lock, checks out the pinned task and shared recipe materials with sparse Git, resolves LFS files, verifies the Pumpkin launcher pin and runs the official reference in its own record directory. It copies the pinned materials into a host-owned bridge tree and adds one model-free agent role to the pinned workflow. The extra role uses a minimal Ubuntu image pinned to the same base digest as the official recipes. Its trusted host call writes the tar in the role’s writable `/pumpkin` scratch mount and removes it after the call. The official recipes, judge definitions and grants are preserved. The prepare probe builds the role, verifies its grants and scratch access, and confirms cancellation and Docker cleanup. The reference path checks Docker cleanup after success, failure or interruption. The atomic prepared manifest stores the source and bridge hashes, bridge and judge image identities, Docker context, reference record and shared budget. Repeated preparation verifies the current materials and cached image. Existing record directories are retained.
10
10
 
11
- `/demo frontiercs2` in the AutoResearch terminal or `anys -u autoresearch --cmd "/demo frontiercs2"` loads the prepared manifest, validates the bridge tree and Kimi K3 identity, and captures only the clean task repo subdirectory of the pinned Git checkout as the initial tree. Tracked file enumeration still works when the prepared state lives beneath another Git checkout. The Harness rejects a missing task README or implementation header before it starts the evaluator or opens the model gateway. The trusted adapter starts the official workflow and resolves precisely one Docker container with the pinned run and role labels. The controller invokes `sandboxctl` inside that role and sends patch bytes on stdin. The container uses its own Pumpkin authorization. AnySwarm Workers each receive their private copy of the starter and the same Profile permissions, and the demo admits only the Runtime callback in each Worker's egress policy. Reference material, evaluator files and Docker credentials remain outside those workspaces.
11
+ `anyswarm run ./project.ts --config ./frontiercs2-config.ts --prompt "Run the prepared FrontierCS-2 task."` loads the prepared manifest, validates the bridge tree and Kimi K3 identity, and captures only the clean task repo subdirectory of the pinned Git checkout as the initial tree. Tracked file enumeration still works when the prepared state lives beneath another Git checkout. The Harness rejects a missing task README or implementation header before it starts the evaluator or opens the model gateway. The trusted adapter starts the official workflow and resolves precisely one Docker container with the pinned run and role labels. The controller invokes `sandboxctl` inside that role and sends patch bytes on stdin. The container uses its own Pumpkin authorization. AnySwarm Workers each receive their private copy of the starter and the same Profile permissions, and the demo admits only the Runtime callback in each Worker's egress policy. Reference material, evaluator files and Docker credentials remain outside those workspaces.
12
12
 
13
- The module exports `slashActions.prepare` and `slashActions.demo`. Prepare returns a check report whose `ok` field states whether setup succeeded. On an unsuccessful prerequisite check the standalone action prints the report and exits 2. Demo returns a start request to the generic launcher with a workspace, a fixed prompt and a trusted evaluator configuration. In the TTY, `anys -u autoresearch` selects the Harness and waits for input. The demo action starts in the same composer. The standalone demo action runs headlessly and streams events plus the final JSON result. A custom launch with `anys -u autoresearch --config ./research.ts` uses the same Run implementation with the provided evaluator. The configuration's `targetPath` is resolved from the invocation workspace when no explicit `--cwd` is supplied. An SDK or RPC caller supplies its own workspace.
13
+ The preparation runner prints the check report and returns exit 2 for an
14
+ unsuccessful prerequisite check. The demo configuration exports the trusted
15
+ evaluator, fixed research goal and absolute starter path. The one-shot launcher
16
+ calls the module's workspace resolver before initial capture. That resolver
17
+ uses configuration's `targetPath`, relative to the invocation directory when
18
+ needed. An explicit `--cwd` takes precedence. A custom configuration uses
19
+ `anyswarm --harness autoresearch --config ./research.ts --prompt <objective>`.
20
+ An SDK or RPC caller supplies its own workspace. The Harness only supports task
21
+ lifetime.
14
22
 
15
- At Runtime creation the Harness requests a local Viewer for the current Run. The host prints the `Live Trace URL` in the composer or on headless stderr. The composer shows a status summary with the current phase, train admissions and best score, plus compact events for claims, candidate submissions, peer review notices, full patch reads, reviews, evaluation results and owner controls. The full journal includes the detailed findings, peer messages, patch reads, review and lineage. The Viewer indexes the timed `research-events.jsonl` alongside Runtime evidence and shows these events in its Research track. The host owns the loopback server and prints a replay command when it exits. A Viewer startup failure leaves the saved journal and the Run lifecycle intact.
23
+ The CLI prints ordinary Run and Agent milestones and the explicit Trace command.
24
+ The Viewer indexes the timed research journal alongside Runtime evidence and
25
+ shows claims, patch reads, findings, peer messages, reviews, lineage and
26
+ evaluation results in its Research track. It can read the Run while it is active
27
+ and replay it after completion.
16
28
 
17
29
  ## Peer and evaluation lifecycle
18
30
 
19
31
  The Harness creates one Runtime and one shared model alias. It registers the research Service and owner controls, starts all configured Sandboxes concurrently, waits for readiness and starts all initial turns concurrently. The demo uses four peers, defaults to 720 seconds of shared work and eight train admissions, and counts actual model use. Its model gateway has no request-count cap. The demo ignores the model request count field in older prepared manifests while preserving saved time and train budgets. A custom Harness may specify a single attempt limit shared across the alias. The default demo uses the user-configured `kimi_proxy/k3` route. Candidate selection depends only on the configured score direction and train receipts. Peers decide which direction to pursue and when to use another result.
20
32
 
21
- The Harness registers its owned Runtime with the public Session controls. `@peer-2 <text>` uses native steer on that member's active turn. An idle peer returns the native non-admission receipt and does not get an independent turn. `/interrupt peer-2` cancels the current native turn and pending native inputs. The peer loop can schedule a new turn after a confirmed interrupt and current-turn settlement. An unknown interrupt prevents automatic redispatch. `/stop peer-2` synchronously fences that peer's scheduler, aborts its wait and stops its allocated Agent. A retry reads the original stop state. The peer remains in the record, and the other peers and already queued evaluations retain their existing budget and state. An explicit stop of the entire Run fences all further work, aborts active train and final, and proceeds to cleanup.
33
+ The Harness registers its owned Runtime with the public Session controls. The SDK/RPC `agent.send` operation uses native steer on the selected member's active turn. An idle peer returns the native non-admission receipt and does not get an independent turn. `agent.interrupt` cancels the current native turn and pending native inputs. The peer loop can schedule a new turn after a confirmed interrupt and current-turn settlement. An unknown interrupt prevents automatic redispatch. `agent.stop` synchronously fences that peer's scheduler, aborts its wait and stops its allocated Agent. A retry reads the original stop state. The peer remains in the record, and the other peers and already queued evaluations retain their existing budget and state. An explicit stop of the entire Run fences all further work, aborts active train and final, and proceeds to cleanup.
22
34
 
23
35
  Each peer can read the Board, claim a direction by normalized text, send a targeted message, publish findings, read segments of another candidate patch and record a review of a version it has read. Peers submit a patch by writing `.anyswarm-candidate.patch` inside their own workspace and passing a summary and optional predecessor identity to the research Service. Bridge authentication supplies caller identity. The host snapshots the file by request identity, hashes the bytes and stores an immutable candidate. Identical bytes reuse the original candidate identity. The host reserves capacity before queuing trusted evaluation. Once a new patch becomes readable, the Harness offers it to each other eligible peer who has yet to receive a review offer in this Run. It attempts conditional active steer if the executor supports it and no owner interrupt is pending. Accepted steer is recorded as a notice. The peer’s next regular turn can carry the prompt once if a matching review or derivative has not arrived. It can do so after the train quota has filled, while the work deadline and stop fences still apply. The notice never wakes an idle or stopped peer through steer. Publication of a review requires another peer’s candidate and a complete ordered read. The journal records the immutable SHA-256 on candidate registration, completion of a patch read, review publication and the corresponding parent hash on a derivative. Compare patch contents to check semantic adoption.
24
36
 
@@ -15,9 +15,8 @@ Start with [00 System overview](00-overview.md). For an SDK application, continu
15
15
  | [04 Services](04-services.md) | How do Service interfaces, adapters, Bridge authorization, and TaskPool compatibility paths work? How do the domain Services apply their own state rules? |
16
16
  | [17 Runtime evidence and Harness reports](17-harness-reporting.md) | How do SDK finalization, Messages, Notes, Subagents and foreground hosts record inputs, outputs, errors and cleanup? |
17
17
  | [23 Project Harness entry](23-project-harness.md) | How does the installed CLI load a Harness, capture a project, run or stop it, and report results? |
18
- | [25 Installed CLI and streaming terminal](25-foreground-tui.md) | How do the host aliases, generic Harness loading, live stream and terminal lifecycle fit together? |
19
18
  | [26 Code](26-code.md) | How do the Root and editors have multiple turns, propose changes, verify the candidate and write it to the local project? |
20
- | [27 Personal GitHub inbox](27-personal.md) | How does Personal run the Router, GitHub delivery and operator approvals from the streaming terminal? |
19
+ | [27 Personal GitHub inbox](27-personal.md) | How does Personal run the Router, GitHub delivery and operator approvals through its example operator and SDK? |
21
20
  | [07 Launch and configuration](07-run-configuration.md) | How are the package, Worker, host, model endpoints, CLI, local setup and optional Services configured? |
22
21
  | [06 Trace Viewer and evidence](06-observability-experiments.md) | How are saved and active Runs inspected, and what do those records establish? |
23
22
  | [09 Known boundaries](09-known-boundaries.md) | Which current limitations would otherwise make the SDK or architecture misleading? |
@@ -19,7 +19,7 @@
19
19
  },
20
20
  {
21
21
  "path": "examples/autoresearch/project.ts",
22
- "sha256": "7d34929d3952a6e7f4df5a29ec6167ddafbd92f812132632ffa8e9fb985fd6f6"
22
+ "sha256": "07314016d47bdbb19e12a0492d949152865ab55c718263be605bd0e2345e8aa1"
23
23
  },
24
24
  {
25
25
  "path": "examples/autoresearch/config.ts",
@@ -314,25 +314,25 @@
314
314
  {
315
315
  "path": "examples/autoresearch/project.ts",
316
316
  "anchor": "const instructions = `",
317
- "line": 11,
317
+ "line": 9,
318
318
  "sha256": "2f161c47284693d2dd415481a96d5de010b254e87cf9dfc977a6a07b7b9f151c"
319
319
  },
320
320
  {
321
321
  "path": "examples/autoresearch/project.ts",
322
322
  "anchor": "? `",
323
- "line": 318,
323
+ "line": 301,
324
324
  "sha256": "d6dd74e7a80cd89685befe2a715c6fa092fedde92ee4d4365376576ee8dce32e"
325
325
  },
326
326
  {
327
327
  "path": "examples/autoresearch/project.ts",
328
328
  "anchor": ": '",
329
- "line": 319,
329
+ "line": 302,
330
330
  "sha256": "bf91b7aaaf231d0ba9c6e805bd6bc2adf6bedb8db2e39acd94baba14b25f4ae6"
331
331
  },
332
332
  {
333
333
  "path": "examples/autoresearch/project.ts",
334
334
  "anchor": "return `",
335
- "line": 30,
335
+ "line": 28,
336
336
  "sha256": "adb341b2f26bf63f341fc67f54ea94d6137fe5af09777bfc5211c8f3d261d191"
337
337
  },
338
338
  {