ptbk 0.115.0-5 → 0.118.0-1

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 (77) hide show
  1. package/README.md +23 -15
  2. package/bin/ptbk.js +6 -4
  3. package/changelog/_current-preversion.md +9 -33
  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/agents.d.ts +39 -1
  8. package/dist/coder/agents.js +309 -94
  9. package/dist/coder/agents.js.map +1 -1
  10. package/dist/coder/authoring.d.ts +4 -0
  11. package/dist/coder/authoring.js +52 -97
  12. package/dist/coder/authoring.js.map +1 -1
  13. package/dist/coder/browser.d.ts +81 -0
  14. package/dist/coder/browser.js +320 -0
  15. package/dist/coder/browser.js.map +1 -0
  16. package/dist/coder/checks.js +17 -9
  17. package/dist/coder/checks.js.map +1 -1
  18. package/dist/coder/cli.js +173 -23
  19. package/dist/coder/cli.js.map +1 -1
  20. package/dist/coder/domain.d.ts +13 -1
  21. package/dist/coder/engine.d.ts +15 -2
  22. package/dist/coder/engine.js +456 -259
  23. package/dist/coder/engine.js.map +1 -1
  24. package/dist/coder/git.d.ts +5 -1
  25. package/dist/coder/git.js +74 -12
  26. package/dist/coder/git.js.map +1 -1
  27. package/dist/coder/harness.d.ts +22 -0
  28. package/dist/coder/harness.js +151 -27
  29. package/dist/coder/harness.js.map +1 -1
  30. package/dist/coder/logging.d.ts +9 -0
  31. package/dist/coder/logging.js +64 -0
  32. package/dist/coder/logging.js.map +1 -0
  33. package/dist/coder/migrate.js +3 -1
  34. package/dist/coder/migrate.js.map +1 -1
  35. package/dist/coder/persistence.d.ts +32 -0
  36. package/dist/coder/persistence.js +133 -0
  37. package/dist/coder/persistence.js.map +1 -0
  38. package/dist/coder/planner.js +1 -1
  39. package/dist/coder/planner.js.map +1 -1
  40. package/dist/coder/requests.d.ts +25 -0
  41. package/dist/coder/requests.js +133 -0
  42. package/dist/coder/requests.js.map +1 -0
  43. package/dist/coder/schedule.js +9 -1
  44. package/dist/coder/schedule.js.map +1 -1
  45. package/dist/coder/server.d.ts +3 -4
  46. package/dist/coder/server.js +4 -149
  47. package/dist/coder/server.js.map +1 -1
  48. package/dist/coder/service-worker.d.ts +1 -0
  49. package/dist/coder/service-worker.js +37 -0
  50. package/dist/coder/service-worker.js.map +1 -0
  51. package/dist/coder/service.d.ts +62 -0
  52. package/dist/coder/service.js +1058 -0
  53. package/dist/coder/service.js.map +1 -0
  54. package/dist/coder/setup.d.ts +36 -0
  55. package/dist/coder/setup.js +264 -0
  56. package/dist/coder/setup.js.map +1 -0
  57. package/dist/coder/sources.d.ts +18 -1
  58. package/dist/coder/sources.js +366 -119
  59. package/dist/coder/sources.js.map +1 -1
  60. package/dist/coder/state.d.ts +36 -4
  61. package/dist/coder/state.js +44 -11
  62. package/dist/coder/state.js.map +1 -1
  63. package/dist/coder/team.d.ts +2 -0
  64. package/dist/coder/team.js +11 -5
  65. package/dist/coder/team.js.map +1 -1
  66. package/dist/coder/terminal.d.ts +4 -0
  67. package/dist/coder/terminal.js +56 -2
  68. package/dist/coder/terminal.js.map +1 -1
  69. package/dist/coder/workspace.d.ts +2 -1
  70. package/dist/coder/workspace.js +48 -58
  71. package/dist/coder/workspace.js.map +1 -1
  72. package/dist/package.json +1 -0
  73. package/docs/compatibility.md +17 -47
  74. package/docs/releasing.md +71 -0
  75. package/docs/runtime.md +81 -0
  76. package/package.json +18 -11
  77. package/docs/coder.md +0 -159
package/README.md CHANGED
@@ -1,29 +1,37 @@
1
- # ptbk coder
1
+ # Promptbook (`ptbk`)
2
2
 
3
- `ptbk` is the repository’s single npm package. It installs the `ptbk coder` 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 coder 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
- npx ptbk coder init
15
- npx ptbk coder add "Fix CSV quoting and add a regression test"
16
- npx ptbk coder list
17
- npx ptbk coder run --harness openai-codex --dry-run
18
- npx ptbk coder run --harness openai-codex --check "npm run check"
14
+ npx ptbk init
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 and project conventions, preserving customized files. It offers supported harness installation and interactive authentication. `--no-install` skips installation; `--no-questions` avoids terminal prompts. Configure a meaningful project `check` script and commit the initialized project 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 show # inspect the same process and pending requests
25
+ ptbk answer REQUEST_ID "Reply"
26
+ ptbk stop # intentional stop also disables automatic restart
27
+ ```
28
+
29
+ `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.
30
+
31
+ Use `start --raw` for foreground logs or `start --interactive` for terminal controls. `--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.
24
32
 
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.
33
+ 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
34
 
27
- See [the coder guide](docs/coder.md), [compatibility and verification](docs/compatibility.md), `ptbk coder --help`, and [the specification](https://github.com/webgptorg/promptbook/blob/main/specs/coder.md). Run `npm run check` to verify the build, deterministic fixtures, and installation of the actual npm tarball in an external project.
35
+ 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
36
 
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).
37
+ 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,33 +1,9 @@
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.
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.
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"}
@@ -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[]>;