ptbk 0.117.0-0 → 0.119.0-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +24 -13
  2. package/bin/ptbk.js +6 -4
  3. package/changelog/_current-preversion.md +22 -57
  4. package/dist/cli.d.ts +4 -0
  5. package/dist/cli.js +11 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/coder/add-wizard.d.ts +14 -0
  8. package/dist/coder/add-wizard.js +88 -0
  9. package/dist/coder/add-wizard.js.map +1 -0
  10. package/dist/coder/agents.d.ts +39 -1
  11. package/dist/coder/agents.js +310 -94
  12. package/dist/coder/agents.js.map +1 -1
  13. package/dist/coder/attached-dashboard.d.ts +14 -0
  14. package/dist/coder/attached-dashboard.js +210 -0
  15. package/dist/coder/attached-dashboard.js.map +1 -0
  16. package/dist/coder/authoring.d.ts +18 -5
  17. package/dist/coder/authoring.js +62 -107
  18. package/dist/coder/authoring.js.map +1 -1
  19. package/dist/coder/browser.d.ts +93 -0
  20. package/dist/coder/browser.js +432 -0
  21. package/dist/coder/browser.js.map +1 -0
  22. package/dist/coder/checks.js +16 -8
  23. package/dist/coder/checks.js.map +1 -1
  24. package/dist/coder/choices.d.ts +36 -0
  25. package/dist/coder/choices.js +409 -0
  26. package/dist/coder/choices.js.map +1 -0
  27. package/dist/coder/cli.d.ts +3 -0
  28. package/dist/coder/cli.js +713 -84
  29. package/dist/coder/cli.js.map +1 -1
  30. package/dist/coder/configuration.d.ts +21 -0
  31. package/dist/coder/configuration.js +186 -0
  32. package/dist/coder/configuration.js.map +1 -0
  33. package/dist/coder/dashboard-page.d.ts +2 -0
  34. package/dist/coder/dashboard-page.js +91 -0
  35. package/dist/coder/dashboard-page.js.map +1 -0
  36. package/dist/coder/diagnostics.d.ts +13 -0
  37. package/dist/coder/diagnostics.js +44 -0
  38. package/dist/coder/diagnostics.js.map +1 -0
  39. package/dist/coder/domain.d.ts +13 -1
  40. package/dist/coder/edit-task-control.d.ts +7 -0
  41. package/dist/coder/edit-task-control.js +43 -0
  42. package/dist/coder/edit-task-control.js.map +1 -0
  43. package/dist/coder/engine.d.ts +32 -2
  44. package/dist/coder/engine.js +476 -257
  45. package/dist/coder/engine.js.map +1 -1
  46. package/dist/coder/file-replacement.d.ts +13 -0
  47. package/dist/coder/file-replacement.js +25 -0
  48. package/dist/coder/file-replacement.js.map +1 -0
  49. package/dist/coder/finite.d.ts +22 -0
  50. package/dist/coder/finite.js +251 -0
  51. package/dist/coder/finite.js.map +1 -0
  52. package/dist/coder/git.d.ts +5 -1
  53. package/dist/coder/git.js +74 -12
  54. package/dist/coder/git.js.map +1 -1
  55. package/dist/coder/harness-plugins/acp.d.ts +8 -0
  56. package/dist/coder/harness-plugins/acp.js +107 -0
  57. package/dist/coder/harness-plugins/acp.js.map +1 -0
  58. package/dist/coder/harness-plugins/claude-code/index.d.ts +2 -0
  59. package/dist/coder/harness-plugins/claude-code/index.js +140 -0
  60. package/dist/coder/harness-plugins/claude-code/index.js.map +1 -0
  61. package/dist/coder/harness-plugins/cline/index.d.ts +2 -0
  62. package/dist/coder/harness-plugins/cline/index.js +111 -0
  63. package/dist/coder/harness-plugins/cline/index.js.map +1 -0
  64. package/dist/coder/harness-plugins/configuration.d.ts +4 -0
  65. package/dist/coder/harness-plugins/configuration.js +22 -0
  66. package/dist/coder/harness-plugins/configuration.js.map +1 -0
  67. package/dist/coder/harness-plugins/contract.d.ts +123 -0
  68. package/dist/coder/harness-plugins/contract.js +2 -0
  69. package/dist/coder/harness-plugins/contract.js.map +1 -0
  70. package/dist/coder/harness-plugins/gemini/index.d.ts +2 -0
  71. package/dist/coder/harness-plugins/gemini/index.js +70 -0
  72. package/dist/coder/harness-plugins/gemini/index.js.map +1 -0
  73. package/dist/coder/harness-plugins/github-copilot/index.d.ts +2 -0
  74. package/dist/coder/harness-plugins/github-copilot/index.js +197 -0
  75. package/dist/coder/harness-plugins/github-copilot/index.js.map +1 -0
  76. package/dist/coder/harness-plugins/index.d.ts +5 -0
  77. package/dist/coder/harness-plugins/index.js +17 -0
  78. package/dist/coder/harness-plugins/index.js.map +1 -0
  79. package/dist/coder/harness-plugins/locks.d.ts +13 -0
  80. package/dist/coder/harness-plugins/locks.js +123 -0
  81. package/dist/coder/harness-plugins/locks.js.map +1 -0
  82. package/dist/coder/harness-plugins/maintenance.d.ts +33 -0
  83. package/dist/coder/harness-plugins/maintenance.js +115 -0
  84. package/dist/coder/harness-plugins/maintenance.js.map +1 -0
  85. package/dist/coder/harness-plugins/openai-codex/index.d.ts +2 -0
  86. package/dist/coder/harness-plugins/openai-codex/index.js +272 -0
  87. package/dist/coder/harness-plugins/openai-codex/index.js.map +1 -0
  88. package/dist/coder/harness-plugins/opencode/index.d.ts +2 -0
  89. package/dist/coder/harness-plugins/opencode/index.js +81 -0
  90. package/dist/coder/harness-plugins/opencode/index.js.map +1 -0
  91. package/dist/coder/harness-plugins/qwen-code/index.d.ts +2 -0
  92. package/dist/coder/harness-plugins/qwen-code/index.js +65 -0
  93. package/dist/coder/harness-plugins/qwen-code/index.js.map +1 -0
  94. package/dist/coder/harness-plugins/shared.d.ts +27 -0
  95. package/dist/coder/harness-plugins/shared.js +277 -0
  96. package/dist/coder/harness-plugins/shared.js.map +1 -0
  97. package/dist/coder/harness-process.d.ts +51 -0
  98. package/dist/coder/harness-process.js +349 -0
  99. package/dist/coder/harness-process.js.map +1 -0
  100. package/dist/coder/harness.d.ts +28 -52
  101. package/dist/coder/harness.js +108 -966
  102. package/dist/coder/harness.js.map +1 -1
  103. package/dist/coder/help.d.ts +39 -0
  104. package/dist/coder/help.js +277 -0
  105. package/dist/coder/help.js.map +1 -0
  106. package/dist/coder/initialization.d.ts +78 -0
  107. package/dist/coder/initialization.js +570 -0
  108. package/dist/coder/initialization.js.map +1 -0
  109. package/dist/coder/interactive.d.ts +45 -0
  110. package/dist/coder/interactive.js +299 -0
  111. package/dist/coder/interactive.js.map +1 -0
  112. package/dist/coder/logging.d.ts +9 -0
  113. package/dist/coder/logging.js +64 -0
  114. package/dist/coder/logging.js.map +1 -0
  115. package/dist/coder/migrate.js +3 -1
  116. package/dist/coder/migrate.js.map +1 -1
  117. package/dist/coder/persistence.d.ts +32 -0
  118. package/dist/coder/persistence.js +133 -0
  119. package/dist/coder/persistence.js.map +1 -0
  120. package/dist/coder/planner.d.ts +4 -0
  121. package/dist/coder/planner.js +21 -10
  122. package/dist/coder/planner.js.map +1 -1
  123. package/dist/coder/presentation.d.ts +34 -0
  124. package/dist/coder/presentation.js +106 -0
  125. package/dist/coder/presentation.js.map +1 -0
  126. package/dist/coder/requests.d.ts +25 -0
  127. package/dist/coder/requests.js +147 -0
  128. package/dist/coder/requests.js.map +1 -0
  129. package/dist/coder/schedule.js +9 -1
  130. package/dist/coder/schedule.js.map +1 -1
  131. package/dist/coder/server.d.ts +3 -4
  132. package/dist/coder/server.js +4 -149
  133. package/dist/coder/server.js.map +1 -1
  134. package/dist/coder/service-worker.d.ts +1 -0
  135. package/dist/coder/service-worker.js +44 -0
  136. package/dist/coder/service-worker.js.map +1 -0
  137. package/dist/coder/service.d.ts +91 -0
  138. package/dist/coder/service.js +1261 -0
  139. package/dist/coder/service.js.map +1 -0
  140. package/dist/coder/setup.d.ts +25 -0
  141. package/dist/coder/setup.js +68 -0
  142. package/dist/coder/setup.js.map +1 -0
  143. package/dist/coder/sources.d.ts +24 -2
  144. package/dist/coder/sources.js +384 -123
  145. package/dist/coder/sources.js.map +1 -1
  146. package/dist/coder/state.d.ts +38 -5
  147. package/dist/coder/state.js +137 -20
  148. package/dist/coder/state.js.map +1 -1
  149. package/dist/coder/team.d.ts +2 -0
  150. package/dist/coder/team.js +11 -5
  151. package/dist/coder/team.js.map +1 -1
  152. package/dist/coder/terminal.d.ts +9 -0
  153. package/dist/coder/terminal.js +240 -17
  154. package/dist/coder/terminal.js.map +1 -1
  155. package/dist/coder/updates.d.ts +34 -0
  156. package/dist/coder/updates.js +99 -0
  157. package/dist/coder/updates.js.map +1 -0
  158. package/dist/coder/version.d.ts +4 -0
  159. package/dist/coder/version.js +16 -0
  160. package/dist/coder/version.js.map +1 -0
  161. package/dist/coder/workspace.d.ts +6 -1
  162. package/dist/coder/workspace.js +52 -60
  163. package/dist/coder/workspace.js.map +1 -1
  164. package/dist/package.json +1 -0
  165. package/docs/compatibility.md +17 -50
  166. package/docs/releasing.md +73 -0
  167. package/docs/runtime.md +118 -0
  168. package/package.json +18 -13
  169. package/docs/coder.md +0 -161
package/README.md CHANGED
@@ -1,29 +1,40 @@
1
1
  # Promptbook (`ptbk`)
2
2
 
3
- `ptbk` is the repository’s single npm package. It installs the `ptbk` CLI for local coding tasks, with interchangeable coding harnesses, project checks, Git persistence, and a persistent loopback dashboard.
3
+ Promptbook operates readable agent and task Books over a Git project. This repository publishes one npm package, `ptbk`, which installs the `ptbk` command. Runtime state, requests, traces and the shared browser profile live in ignored `.ptbk/` files.
4
4
 
5
- Requires Node.js 22.13+ in the Node 22 line, or Node 24+, npm 10+, and Git. macOS and Linux are target platforms; use WSL on Windows. Install a coding harness separately and authenticate with its provider.
5
+ Requires Node.js 22.13+ in the Node 22 line, or Node 24+, and npm 10+.
6
6
 
7
7
  ```bash
8
8
  # Global installation
9
9
  npm install --global ptbk
10
- ptbk init --path ./my-project
10
+ ptbk init --path ./project
11
11
 
12
- # Or install into a project
12
+ # Project-local installation
13
13
  npm install --save-dev ptbk
14
14
  npx ptbk init
15
- npx ptbk add "Fix CSV quoting and add a regression test"
16
- npx ptbk list
17
- npx ptbk run --harness openai-codex --dry-run
18
- npx ptbk run --harness openai-codex --check "npm run check"
19
15
  ```
20
16
 
21
- The coder owns task state and commits. Harnesses receive instructions to leave commits to the coder. Initial project changes are preserved; the default run refuses a dirty working tree. Pull and push require explicit flags. `list` and `run --dry-run` are offline read-only operations.
17
+ Initialization creates missing core agents, task templates, `ptbk.json` and project conventions, preserving customized files. Its wizard offers destination-local installation of the exact running version and selected global harness setup, reusing native login. Unattended setup requires `--installation local|global` or `--no-install`; `--non-interactive` disables prompts. Setup commits only safe generated artifacts; `--no-commit` defers persistence, and edits overlapping user work remain pending review. Configure meaningful project checks before starting work.
22
18
 
23
- Current Codex account execution requires explicit `--allow-credits` because its CLI cannot enforce the default credit prohibition. Add that flag only when authorizing account credits; see [the credit policy and provider limits](docs/coder.md#harnesses-planning-and-team).
19
+ ```bash
20
+ ptbk add "Implement the new behavior and its acceptance checks" --commit
21
+ ptbk list
22
+ ptbk run --dry-run
23
+ ptbk start # background agenda, localhost dashboard, reboot persistence
24
+ ptbk dashboard # attach terminal controls to the existing service
25
+ ptbk show # inspect the same process and pending requests
26
+ ptbk answer REQUEST_ID "Reply"
27
+ ptbk stop # intentional stop also disables automatic restart
28
+ ```
29
+
30
+ `start` discovers available authenticated harnesses, uses Manager for missing assignments, and executes one task at a time. It requires reported outcome evidence and passing project checks before committing implementation, dated task completion and learning follow-ups together. It watches future work and materializes goal enquiries when no unfinished backlog remains. Failures retain work and expose recovery diagnostics.
31
+
32
+ Lifecycle commands report once and return; `start --raw` still launches a daemon. Use `dashboard` to attach terminal controls, or `start --foreground` to own execution in the current terminal (`--raw` gives plain foreground events). Q/Ctrl+C leaves an attached dashboard while its service continues. `--no-persist`, `--no-server`, `--no-qr` and `--port` customize startup. `run` executes a finite queue with one configuration; for example `ptbk run --harness openai-codex --check "npm run check" --limit 1`. Harness availability, account policy and capability checks happen before inference; unsupported installed provider features produce an actionable diagnostic.
33
+
34
+ Suitable terminals default to rich presentation; `--raw` or redirected output gives plain results without prompts or QR codes. `ptbk add` guides and confirms task creation. Use `ptbk init --help`, `ptbk init help` or `ptbk help init` for the same command-specific offline reference.
24
35
 
25
- New work is stored as task Books under `tasks/`. Existing top-level Markdown tasks under `prompts/` remain supported by the same engine. Agent Books under `agents/` define roles and are distinct from task Books.
36
+ Global installation, local `npx ptbk`, or a project script such as `"ptbk": "ptbk"` work outside this repository. Each process loads its own installed runtime/version and pins that installation for restart. See [runtime usage](docs/runtime.md), [compatibility and verification](docs/compatibility.md), and [the specification](https://github.com/webgptorg/promptbook/blob/main/specs/_main.md).
26
37
 
27
- See [the coder guide](docs/coder.md), [compatibility and verification](docs/compatibility.md), `ptbk --help`, and [the specification](https://github.com/webgptorg/promptbook/blob/main/specs/_main.md). Run `npm run check` to verify the build, deterministic fixtures, and installation of the actual npm tarball in an external project.
38
+ For development, use `npm ci` and `npm run check`. Checks validate types, deterministic integration fixtures and real tarball installations in disposable external projects. CI runs on Linux, macOS and Windows with Node 22 and 24.
28
39
 
29
- This prerelease replaces the old collection of npm packages. Publishing runs only in GitHub Actions when a `vVERSION` tag is pushed. From a clean, committed tree on a named branch, `npm run release:preminor` or `npm run release:prerelease` checks the release, creates npm's version commit/tag, and atomically pushes the branch and exact tag. Normal releases, including numeric prereleases, use `latest` so the default install gets the current CLI. See [release and push-retry instructions](docs/coder.md#releasing).
40
+ For releases, run `npm version patch`, `npm version minor`, or `npm version prerelease` on a clean named branch after committing your work. Basic `preversion` checks run locally; `postversion` atomically pushes the version commit and exact `vVERSION` tag. GitHub Actions checks and publishes only `ptbk` with npm provenance, then verifies the public registry and installed CLI. Configure npm trusted publishing once as described in [releasing](docs/releasing.md).
package/bin/ptbk.js CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
- /** Runs the compiled CLI from either a local or global npm installation. */
3
- import('../dist/coder/cli.js')
4
- .then(async ({ main }) => { process.exitCode = await main(process.argv.slice(2)); })
5
- .catch(error => { process.stderr.write(`${error.message}\n`); process.exitCode = 1; });
2
+
3
+ /** Load the runtime relative to this installation, independently of the project directory. */
4
+ import('../dist/cli.js').then(({ main }) => main()).catch((error) => {
5
+ process.stderr.write(`ptbk: ${error.message}\n`);
6
+ process.exitCode = 1;
7
+ });
@@ -1,57 +1,22 @@
1
- - Removed npm installation deprecation warnings by upgrading ESLint from 8 to 10 and refreshing the lockfile.
2
- Migrated to flat configuration, preserving custom rules and file overrides, and installed the previously
3
- missing TypeScript lint dependencies and runtime global definitions.
4
- Updated the declared Node.js requirement to 22.13+ in the Node 22 line, or 24+.
5
- - Replaced the former multi-package publishing pipeline with the single `ptbk` CLI package,
6
- versioned as a pre-minor prerelease. Added compiled executable packaging,
7
- release/version validation, npm prerelease tags, version-tag-triggered GitHub publication,
8
- macOS/Linux CI, external local/global installation checks, and post-publication registry
9
- version, dist-tag, artifact integrity and executable verification. Node 22.13+ is required.
10
- - Restricted npm publication to the official repository's GitHub Actions release job.
11
- Local npm version hooks check types, metadata, a named branch and clean tracked/untracked
12
- tree, create the normal version commit/tag, and atomically push the current
13
- branch and exact new tag to trigger CI. Failed pushes can be retried with
14
- `npm run postversion`; local registry verification remains available without publishing.
15
- - Wait for npm registry propagation after a successful upload instead of failing on the
16
- first temporary missing-version response. Keep verification bounded and reject invalid
17
- artifact metadata and authentication failures immediately.
18
- - Restore `latest` as the npm channel for normal `ptbk` releases, including numeric
19
- prereleases, so default local/global installs receive the current coder CLI instead
20
- of the legacy package. Verify unversioned installs against the released version and
21
- clarify npm's selected-version publication date versus package-wide last publication.
22
- - Implemented the coder task engine with legacy Markdown and task Books, strict scheduling,
23
- recurrence, deterministic migration, project initialization and authoring, safe Git/check
24
- phase persistence, recovery journals, harness adapters, agent context and TEAM tools,
25
- read-only planning, human verification, and a protected loopback persistent dashboard.
26
- Read-only previews report blocked/future tasks without initializing or calling models.
27
- Restored legacy trace filenames while preserving immutable occurrence records and exact
28
- finalization outcomes in journals. This prerelease refuses Qwen/Cline TEAM before inference;
29
- they require an agent without TEAM. OpenCode TEAM requires an explicit qualified model.
30
- - Codex account inference now requires either an advertised provider credit-prohibition
31
- capability or explicit `--allow-credits`. Current Codex versions without that capability
32
- are refused before inference, including accounts with remaining included usage. Account
33
- and API authentication are forced explicitly; generated scripts never opt into credits.
34
- - Reorganized the specifications around `specs/_main.md`, splitting coder contracts into focused,
35
- interlinked files and expanding the dictionary into a linked term index. Preserved the dated
36
- audit, acceptance IDs and lower-authority historical agent/server specs in `specs/deprecated/`,
37
- repaired specification links, and left `old-prompts` and implementation code untouched.
38
- - Translated all organized specifications into English, including examples and cross-reference labels,
39
- updated heading links, and simplified the dictionary to linked bullet points. The `old-prompts` archive
40
- and implementation code remain unchanged.
41
- - Simplified prose-heavy specification tables into bullet points and a numbered delivery list,
42
- retaining tables for compact state/harness comparisons, module ownership and reference resolution.
43
- - Defined Promptbook in the specifications solely as the `ptbk` CLI, replacing the nested coder
44
- commands with top-level workflows, grouping the contracts under `specs/cli/`, and retaining
45
- the broader APT framework/server vision as historical material. Preserved legacy identifiers
46
- and source references for compatibility; implementation code and `old-prompts` are unchanged.
47
- - Restored the compiled TypeScript CLI after the implementation cleanup and moved every workflow
48
- to the top-level `ptbk` commands, including initialization, execution, checks, planning,
49
- migration, recovery and the persistent dashboard. Historical storage paths and task markers
50
- retain their compatibility meaning. The removed `coder` command group now explains the replacement.
51
- - Initialization upgrades only exact recognized generated npm callers, supplies root-command
52
- run/list/fix/plan scripts, and diagnoses custom legacy scripts/workflows without rewriting them.
53
- Checks reject both root and historical worker invocations, including indirect npm-script recursion.
54
- - Release preflight now rejects dirty/detached checkouts before doing other work and verifies the
55
- compiled build before npm changes the version. CI checks all branches on macOS/Linux and Node 22/24;
56
- publication remains restricted to the single `ptbk` package through GitHub Actions. Updated the
57
- packed local/global installation regressions and documentation to exercise root commands.
1
+ - Implement the complete `ptbk` runtime from the current specification, including modern task Books and legacy Markdown, normalized agent discovery and inheritance, core roles, Manager assignment, Expert agenda bootstrap, TEAM consultations and OPEN/CLOSED Teacher follow-ups.
2
+ - Add finite checked execution and continuous project supervision with one task at a time, dated completion and implementation in one result commit, bounded retries, safe staging, recovery journals, synchronization and isolated worktree integration.
3
+ - Add project-specific daemon/raw/interactive modes, authenticated shared CLI/terminal/dashboard/API controls, durable questions and answers, browser CDP tools with persistent sessions, and current-user startup persistence for Linux, macOS and Windows.
4
+ - Preserve custom initialization files and routing requirements, schedule prerequisites and recurrence, and materialize bounded goal enquiries only when unfinished present/future work is exhausted.
5
+ - Publish only the installable root `ptbk` npm package. Add local npm version preflight and atomic branch/tag push, tagged GitHub Actions publication with OIDC/provenance, and bounded public registry/default installation verification.
6
+ - Validate Node 22/24 installations on Linux/macOS/Windows, deterministic provider and recovery fixtures, real local browser sessions where available, and checked task execution from local/global tarball installations in disposable external projects.
7
+ - Fix Windows runtime state/browser startup sharing violations, process cancellation, secret-redaction scope, portable trace/learning paths and isolation recovery across Git checkout line-ending filters.
8
+ - Make integration fixtures independent of host path separators and Git line-ending defaults, with bounded completion waits that tolerate hosted-runner load and surface runtime failures immediately.
9
+ - Keep all platform checks running after a matrix failure, bound concurrent fixture processes, and document releasing code fixes under a new immutable version tag.
10
+ - Fix `ptbk run` failing with `Invalid string length` while claiming tasks in large checkouts by storing deduplicated snapshot bytes separately from recovery journal JSON; preserve existing journal compatibility and verify stored bytes before recovery.
11
+ - Resolve versioned `ptbk.json` project defaults beneath temporary CLI overrides, preserve explicit disabled/empty settings, and keep credentials out of configuration. Make bare/help/about output offline, concise and specific to the invoked engine version.
12
+ - Add incremental initialization with exact-version destination-local installation, explicit ignored-child/submodule boundaries, scoped setup commits, and durable pending review for generated changes overlapping user edits. Separate invoked-engine self-update from selected global harness maintenance.
13
+ - Move the seven harness integrations into a common plugin contract with featured/More catalogs, selected-only setup, native login reuse, actual version evidence and bounded global updates protected against concurrent project invocations.
14
+ - Share versioned terminal/dashboard state and authenticated controls between finite run and ongoing start; add multiline input with safe paste, keyboard/pointer editing and draft preservation, independent persistent browser profile/mode changes, and actionable redacted diagnostics with real trace references.
15
+ - Replace typed predefined answers with labeled arrow-key pickers and Space-toggle checkboxes throughout setup, harness updates, confirmations and runtime requests. Preserve selections while browsing More, resizing and receiving logs; clarify the shared choice controls in the specification.
16
+ - Separate daemon/foreground placement from pretty/raw presentation: lifecycle commands render one result, `start --raw` launches a daemon, and `--foreground` explicitly owns execution. Add an authenticated attached `dashboard` client with client-only exit, shared controls and continuous raw observation.
17
+ - Add coherent rich terminal summaries and live panels, an independently usable local API with a lightweight synchronized browser SPA, explicit connection/control outcomes, retained input drafts and safe task editing. Preserve color suppression and plain redirected output.
18
+ - Add a finite task-creation wizard with reusable supplied inputs, template/priority selection, exact preview, Back and confirmation before any task is saved. Resolve offline command-scoped help in all supported help forms, with relevant defaults/examples, alias support and scoped usage diagnostics.
19
+ - Fix release validation on runners without a Git identity by isolating initialization fixtures from host configuration and supplying fixture-only authorship.
20
+ - Synchronize browser dashboard control outcomes with a fresh snapshot and make browser tests wait for document/control readiness. Bound DevTools and owned-browser shutdown waits, preserve ownership when termination fails, and close browsers before removing fixture profiles to prevent Windows CI hangs.
21
+ - Retry transient Windows file-sharing failures when recording task completion and saving dashboard edits, rechecking source revision, path confinement and workspace ownership before each attempt while preserving concurrent edits and checked work. Read decoded Git submodule configuration in release fixtures so escaped Windows paths are validated correctly.
22
+ - Fix daemon stop failing when a read-only shutdown inspection encounters a reset control connection. Bound inspection retries with fresh process authentication, preserve ownership checks and never replay a mutation whose reply was lost; keep client disconnects from terminating the supervisor.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /** Return the selected installation's package version, independently of project metadata. @private */
2
+ export declare function installedVersion(): Promise<string>;
3
+ /** Run the installed root command and preserve its documented exit status. @private */
4
+ export declare function main(args?: string[]): Promise<void>;
package/dist/cli.js ADDED
@@ -0,0 +1,11 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { main as runCli } from './coder/cli.js';
3
+ /** Return the selected installation's package version, independently of project metadata. @private */
4
+ export async function installedVersion() {
5
+ return JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')).version;
6
+ }
7
+ /** Run the installed root command and preserve its documented exit status. @private */
8
+ export async function main(args = process.argv.slice(2)) {
9
+ process.exitCode = await runCli(args);
10
+ }
11
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEhD,sGAAsG;AACtG,MAAM,CAAC,KAAK,UAAU,gBAAgB;IAClC,OAAQ,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAyB,CAAC,OAAO,CAAC;AAC5H,CAAC;AAED,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Readable, Writable } from 'node:stream';
2
+ import type { Workspace } from './domain.js';
3
+ import { type PreparedAuthoredTask } from './authoring.js';
4
+ /** Supplied authoring inputs are reused rather than asked for again. @private */
5
+ export interface AddWizardOptions {
6
+ description?: string;
7
+ template?: string;
8
+ priority?: number;
9
+ signal?: AbortSignal;
10
+ input?: Readable;
11
+ output?: Writable;
12
+ }
13
+ /** Review exact task bytes in a finite wizard; cancellation never creates a task. @private */
14
+ export declare function addTaskWizard(workspace: Workspace, options?: AddWizardOptions): Promise<PreparedAuthoredTask | undefined>;
@@ -0,0 +1,88 @@
1
+ import { readdir } from 'node:fs/promises';
2
+ import { join, relative } from 'node:path';
3
+ import { prepareAuthoredTask } from './authoring.js';
4
+ import { promptChoice } from './choices.js';
5
+ import { promptText } from './interactive.js';
6
+ import { installedEngineVersion } from './version.js';
7
+ import { confinePath, InputError } from './workspace.js';
8
+ /** Inspect the selected project's templates without creating files or following escaping links. */
9
+ async function taskTemplates(workspace) {
10
+ const directory = await confinePath(workspace.projectPath, join(workspace.tasksPath, 'templates'));
11
+ try {
12
+ return (await readdir(directory, { withFileTypes: true })).filter(entry => entry.isFile() && /\.(?:book|md|txt)$/i.test(entry.name))
13
+ .sort((a, b) => a.name.localeCompare(b.name)).map(entry => ({ value: relative(workspace.projectPath, join(directory, entry.name)), label: entry.name }));
14
+ }
15
+ catch (error) {
16
+ if (error.code === 'ENOENT')
17
+ return [];
18
+ throw error;
19
+ }
20
+ }
21
+ /** Review exact task bytes in a finite wizard; cancellation never creates a task. @private */
22
+ export async function addTaskWizard(workspace, options = {}) {
23
+ const version = await installedEngineVersion();
24
+ const surface = { input: options.input, output: options.output, signal: options.signal };
25
+ const heading = (step) => `Promptbook ${version} · Add task · ${step}/4`;
26
+ let description = options.description;
27
+ let template = options.template;
28
+ let priority = options.priority;
29
+ /** Keep descriptions in the shared multiline editor while enforcing nonempty authoring input. */
30
+ const describe = () => promptText('Task description', { ...surface, heading: heading(1), initial: description,
31
+ validate: value => value.trim() ? undefined : 'Describe the task before continuing.' });
32
+ /** Select existing templates with labels; an omitted template keeps the description as supplied. */
33
+ const selectTemplate = async () => {
34
+ const templates = await taskTemplates(workspace);
35
+ if (!templates.length) {
36
+ template = undefined;
37
+ return;
38
+ }
39
+ const choice = await promptChoice('Task template', [{ value: '@none', label: 'No template', description: 'Use the task description directly.' }, ...templates], {
40
+ ...surface, heading: heading(2), initial: template && templates.some(item => item.value === template) ? template : '@none',
41
+ });
42
+ template = choice === '@none' ? undefined : choice;
43
+ };
44
+ /** Offer common priorities while retaining arbitrary nonnegative priorities through a custom field. */
45
+ const selectPriority = async () => {
46
+ const choice = await promptChoice('Task priority (higher values run first)', [
47
+ { value: '0', label: 'Normal · 0' }, { value: '1', label: 'Raised · 1' },
48
+ { value: '2', label: 'High · 2' }, { value: '3', label: 'Urgent · 3' },
49
+ { value: 'custom', label: 'Custom priority…' },
50
+ ], { ...surface, heading: heading(3), initial: priority !== undefined && priority <= 3 ? String(priority) : priority === undefined ? '0' : 'custom' });
51
+ if (choice !== 'custom') {
52
+ priority = Number(choice);
53
+ return;
54
+ }
55
+ const value = await promptText('Custom nonnegative priority', { ...surface, heading: heading(3), initial: String(priority ?? 0),
56
+ validate: text => /^\d+$/.test(text.trim()) && Number.isSafeInteger(Number(text.trim())) ? undefined : 'Use a nonnegative safe integer.' });
57
+ priority = Number(value.trim());
58
+ };
59
+ if (description === undefined)
60
+ description = await describe();
61
+ if (!description.trim())
62
+ throw new InputError('A non-empty task description is required.');
63
+ if (options.template === undefined)
64
+ await selectTemplate();
65
+ if (options.priority === undefined)
66
+ await selectPriority();
67
+ for (;;) {
68
+ const prepared = await prepareAuthoredTask(workspace, description, { template, priority });
69
+ const action = await promptChoice('Review the task before saving', [
70
+ { value: 'save', label: 'Save this task' },
71
+ { value: 'description', label: 'Back to description' },
72
+ { value: 'template', label: 'Back to template' },
73
+ { value: 'priority', label: 'Back to priority' },
74
+ { value: 'cancel', label: 'Cancel without creating a task' },
75
+ ], { ...surface, heading: heading(4), initial: 'cancel', preview: `${relative(workspace.projectPath, prepared.path)}\n${prepared.content}` });
76
+ if (action === 'save')
77
+ return prepared;
78
+ if (action === 'cancel')
79
+ return undefined;
80
+ if (action === 'description')
81
+ description = await describe();
82
+ else if (action === 'template')
83
+ await selectTemplate();
84
+ else
85
+ await selectPriority();
86
+ }
87
+ }
88
+ //# sourceMappingURL=add-wizard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-wizard.js","sourceRoot":"","sources":["../../src/coder/add-wizard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAE,mBAAmB,EAA6B,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,UAAU,E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,MAAM;YAAE,OAAO,QAAQ,CAAC;QACvC,IAAI,MAAM,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QAC1C,IAAI,MAAM,KAAK,aAAa;YAAE,WAAW,GAAG,MAAM,QAAQ,EAAE,CAAC;aACxD,IAAI,MAAM,KAAK,UAAU;YAAE,MAAM,cAAc,EAAE,CAAC;;YAClD,MAAM,cAAc,EAAE,CAAC;IAChC,CAAC;AACL,CAAC"}
@@ -3,18 +3,56 @@ export interface TeamMember {
3
3
  name: string;
4
4
  path: string;
5
5
  declaringPath: string;
6
+ kind?: 'agent' | 'expert' | 'user' | 'void';
7
+ }
8
+ /** Learning permission belongs to the local Book, independently of its ancestors. @private */
9
+ export interface LearningPolicy {
10
+ open: boolean;
11
+ limits?: string;
12
+ }
13
+ /** A discovered project identity, including hidden supporting definitions. @private */
14
+ export interface AgentDefinition {
15
+ name: string;
16
+ normalizedName: string;
17
+ path: string;
18
+ hidden: boolean;
19
+ learning: LearningPolicy;
6
20
  }
7
21
  /** Immutable Book snapshot used for one inference attempt. @private */
8
22
  export interface PreparedAgent {
23
+ name: string;
24
+ path: string;
9
25
  instructions: string;
10
26
  aliases: string[];
11
27
  team: TeamMember[];
28
+ learning: LearningPolicy;
29
+ sources: Record<string, string>;
12
30
  model?: string;
13
31
  modelParameters?: Record<string, string>;
14
32
  }
33
+ /** Missing core definitions are created from these installed-engine defaults only. @private */
34
+ export declare const CORE_BOOKS: Readonly<Record<string, string>>;
35
+ /** Normalize identity across case, diacritics, separators and camel case. @private */
36
+ export declare function normalizeAgentName(name: string): string;
37
+ /** Resolve engine-owned identities without consulting or materializing project files. @private */
38
+ export declare function nonAgentReference(reference: string): {
39
+ name: string;
40
+ path: string;
41
+ kind: 'expert' | 'user' | 'void';
42
+ } | undefined;
15
43
  /** Resolve a local file without allowing a symlink to escape the selected project. @private */
16
44
  export declare function agentLocalPath(path: string, projectPath: string): Promise<string>;
17
45
  /** Recognize public-network exclusions, including IPv4-mapped IPv6 literals. @private */
18
46
  export declare function isPrivateBookAddress(address: string): boolean;
19
- /** Compile persona, local/remote inheritance, knowledge and distinct advisor tools. @private */
47
+ /** Discover canonical identities recursively, rejecting every ambiguity before selection. @private */
48
+ export declare function discoverAgents(projectPath: string): Promise<AgentDefinition[]>;
49
+ /** Repair missing core definitions individually; existing custom Books are never overwritten. @private */
50
+ export declare function ensureCoreAgents(projectPath: string): Promise<string[]>;
51
+ /** Resolve a shared identity from its declaring Book; filenames never override name uniqueness. @private */
52
+ export declare function resolveAgentReference(raw: string, declaring: string, projectPath: string): Promise<string>;
53
+ /** Resolve an inherited local MODEL without network, knowledge reads, setup or advisor calls. @private */
54
+ export declare function readLocalAgentModel(agentPath: string, projectPath: string): Promise<string | undefined>;
55
+ /** Compile immutable instruction provenance, inheritance, knowledge and distinct TEAM tools. @private */
20
56
  export declare function prepareAgent(agentPath: string, projectPath: string): Promise<PreparedAgent>;
57
+ /** Validate every effective local Book before unattended execution, including hidden supporting roles. @private */
58
+ export declare function validateAgents(projectPath: string): Promise<PreparedAgent[]>;