ptbk 0.119.0-13 → 0.119.0-15
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.
- package/README.md +49 -21
- package/dist/book/commitments.d.ts +52 -0
- package/dist/book/commitments.js +72 -0
- package/dist/book/commitments.js.map +1 -0
- package/dist/book/edit.d.ts +13 -0
- package/dist/book/edit.js +49 -0
- package/dist/book/edit.js.map +1 -0
- package/dist/book/parse.d.ts +84 -0
- package/dist/book/parse.js +142 -0
- package/dist/book/parse.js.map +1 -0
- package/dist/book/references.d.ts +62 -0
- package/dist/book/references.js +139 -0
- package/dist/book/references.js.map +1 -0
- package/dist/browser/browser.d.ts +78 -0
- package/dist/browser/browser.js +434 -0
- package/dist/browser/browser.js.map +1 -0
- package/dist/browser/recording.d.ts +138 -0
- package/dist/browser/recording.js +361 -0
- package/dist/browser/recording.js.map +1 -0
- package/dist/cli/commands/about.d.ts +7 -0
- package/dist/cli/commands/about.js +40 -0
- package/dist/cli/commands/about.js.map +1 -0
- package/dist/cli/commands/access.d.ts +25 -0
- package/dist/cli/commands/access.js +79 -0
- package/dist/cli/commands/access.js.map +1 -0
- package/dist/cli/commands/add.d.ts +7 -0
- package/dist/cli/commands/add.js +204 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/answer.d.ts +7 -0
- package/dist/cli/commands/answer.js +79 -0
- package/dist/cli/commands/answer.js.map +1 -0
- package/dist/cli/commands/boilerplates.d.ts +7 -0
- package/dist/cli/commands/boilerplates.js +61 -0
- package/dist/cli/commands/boilerplates.js.map +1 -0
- package/dist/cli/commands/dashboard.d.ts +7 -0
- package/dist/cli/commands/dashboard.js +29 -0
- package/dist/cli/commands/dashboard.js.map +1 -0
- package/dist/cli/commands/find.d.ts +19 -0
- package/dist/cli/commands/find.js +122 -0
- package/dist/cli/commands/find.js.map +1 -0
- package/dist/cli/commands/fix.d.ts +7 -0
- package/dist/cli/commands/fix.js +83 -0
- package/dist/cli/commands/fix.js.map +1 -0
- package/dist/cli/commands/init.d.ts +41 -0
- package/dist/cli/commands/init.js +1074 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/lint.d.ts +7 -0
- package/dist/cli/commands/lint.js +56 -0
- package/dist/cli/commands/lint.js.map +1 -0
- package/dist/cli/commands/list.d.ts +7 -0
- package/dist/cli/commands/list.js +139 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +7 -0
- package/dist/cli/commands/migrate.js +165 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/ping.d.ts +7 -0
- package/dist/cli/commands/ping.js +66 -0
- package/dist/cli/commands/ping.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +7 -0
- package/dist/cli/commands/plan.js +234 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/recover.d.ts +7 -0
- package/dist/cli/commands/recover.js +78 -0
- package/dist/cli/commands/recover.js.map +1 -0
- package/dist/cli/commands/restart.d.ts +7 -0
- package/dist/cli/commands/restart.js +38 -0
- package/dist/cli/commands/restart.js.map +1 -0
- package/dist/cli/commands/run.d.ts +7 -0
- package/dist/cli/commands/run.js +150 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/start.d.ts +7 -0
- package/dist/cli/commands/start.js +180 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/status.d.ts +7 -0
- package/dist/cli/commands/status.js +32 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +7 -0
- package/dist/cli/commands/stop.js +29 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/verify.d.ts +7 -0
- package/dist/cli/commands/verify.js +108 -0
- package/dist/cli/commands/verify.js.map +1 -0
- package/dist/cli/common.d.ts +46 -0
- package/dist/cli/common.js +140 -0
- package/dist/cli/common.js.map +1 -0
- package/dist/cli/context.d.ts +55 -0
- package/dist/cli/context.js +42 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/help.d.ts +20 -0
- package/dist/cli/help.js +159 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/parser.d.ts +49 -0
- package/dist/cli/parser.js +283 -0
- package/dist/cli/parser.js.map +1 -0
- package/dist/cli/registry.d.ts +7 -0
- package/dist/cli/registry.js +494 -0
- package/dist/cli/registry.js.map +1 -0
- package/dist/cli/service-view.d.ts +36 -0
- package/dist/cli/service-view.js +88 -0
- package/dist/cli/service-view.js.map +1 -0
- package/dist/cli/sources.d.ts +15 -0
- package/dist/cli/sources.js +35 -0
- package/dist/cli/sources.js.map +1 -0
- package/dist/cli/spec.d.ts +164 -0
- package/dist/cli/spec.js +136 -0
- package/dist/cli/spec.js.map +1 -0
- package/dist/cli.d.ts +8 -4
- package/dist/cli.js +40 -9
- package/dist/cli.js.map +1 -1
- package/dist/common/duration.d.ts +32 -0
- package/dist/common/duration.js +153 -0
- package/dist/common/duration.js.map +1 -0
- package/dist/common/errors.d.ts +79 -0
- package/dist/common/errors.js +72 -0
- package/dist/common/errors.js.map +1 -0
- package/dist/common/fs.d.ts +98 -0
- package/dist/common/fs.js +234 -0
- package/dist/common/fs.js.map +1 -0
- package/dist/common/ids.d.ts +24 -0
- package/dist/common/ids.js +49 -0
- package/dist/common/ids.js.map +1 -0
- package/dist/common/ipc.d.ts +46 -0
- package/dist/common/ipc.js +147 -0
- package/dist/common/ipc.js.map +1 -0
- package/dist/common/mutex.d.ts +12 -0
- package/dist/common/mutex.js +26 -0
- package/dist/common/mutex.js.map +1 -0
- package/dist/common/process.d.ts +102 -0
- package/dist/common/process.js +338 -0
- package/dist/common/process.js.map +1 -0
- package/dist/common/redact.d.ts +24 -0
- package/dist/common/redact.js +70 -0
- package/dist/common/redact.js.map +1 -0
- package/dist/common/semver.d.ts +18 -0
- package/dist/common/semver.js +70 -0
- package/dist/common/semver.js.map +1 -0
- package/dist/common/time.d.ts +59 -0
- package/dist/common/time.js +154 -0
- package/dist/common/time.js.map +1 -0
- package/dist/common/version.d.ts +52 -0
- package/dist/common/version.js +76 -0
- package/dist/common/version.js.map +1 -0
- package/dist/engine/agenda.d.ts +326 -0
- package/dist/engine/agenda.js +1619 -0
- package/dist/engine/agenda.js.map +1 -0
- package/dist/engine/bridge.d.ts +47 -0
- package/dist/engine/bridge.js +63 -0
- package/dist/engine/bridge.js.map +1 -0
- package/dist/engine/executor.d.ts +202 -0
- package/dist/engine/executor.js +626 -0
- package/dist/engine/executor.js.map +1 -0
- package/dist/engine/generated.d.ts +155 -0
- package/dist/engine/generated.js +271 -0
- package/dist/engine/generated.js.map +1 -0
- package/dist/engine/harnesses.d.ts +35 -0
- package/dist/engine/harnesses.js +102 -0
- package/dist/engine/harnesses.js.map +1 -0
- package/dist/engine/isolation.d.ts +35 -0
- package/dist/engine/isolation.js +76 -0
- package/dist/engine/isolation.js.map +1 -0
- package/dist/engine/mcp-server.js +83 -0
- package/dist/engine/mcp-server.js.map +1 -0
- package/dist/engine/preview.d.ts +28 -0
- package/dist/engine/preview.js +70 -0
- package/dist/engine/preview.js.map +1 -0
- package/dist/engine/prompt.d.ts +53 -0
- package/dist/engine/prompt.js +103 -0
- package/dist/engine/prompt.js.map +1 -0
- package/dist/engine/requests.d.ts +111 -0
- package/dist/engine/requests.js +173 -0
- package/dist/engine/requests.js.map +1 -0
- package/dist/engine/result.d.ts +31 -0
- package/dist/engine/result.js +81 -0
- package/dist/engine/result.js.map +1 -0
- package/dist/engine/routing.d.ts +68 -0
- package/dist/engine/routing.js +127 -0
- package/dist/engine/routing.js.map +1 -0
- package/dist/engine/snapshot.d.ts +276 -0
- package/dist/engine/snapshot.js +2 -0
- package/dist/engine/snapshot.js.map +1 -0
- package/dist/engine/state.d.ts +240 -0
- package/dist/engine/state.js +134 -0
- package/dist/engine/state.js.map +1 -0
- package/dist/engine/task-trace.d.ts +90 -0
- package/dist/engine/task-trace.js +206 -0
- package/dist/engine/task-trace.js.map +1 -0
- package/dist/engine/team.d.ts +60 -0
- package/dist/engine/team.js +154 -0
- package/dist/engine/team.js.map +1 -0
- package/dist/engine/traces.d.ts +12 -0
- package/dist/engine/traces.js +27 -0
- package/dist/engine/traces.js.map +1 -0
- package/dist/expert/_main.md +91 -0
- package/dist/expert/agents/_index.md +18 -0
- package/dist/expert/agents/consistency.md +16 -0
- package/dist/expert/agents/core-agents.md +13 -0
- package/dist/expert/agents/expert.md +11 -0
- package/dist/expert/agents/learning.md +13 -0
- package/dist/expert/agents/manager.md +13 -0
- package/dist/expert/agents/non-agents.md +15 -0
- package/dist/expert/agents/teacher.md +11 -0
- package/dist/expert/agents/visual-identity.md +31 -0
- package/dist/expert/book-language/_index.md +14 -0
- package/dist/expert/book-language/commitments/_index.md +49 -0
- package/dist/expert/book-language/commitments/action.md +7 -0
- package/dist/expert/book-language/commitments/closed.md +7 -0
- package/dist/expert/book-language/commitments/delete.md +7 -0
- package/dist/expert/book-language/commitments/dictionary.md +7 -0
- package/dist/expert/book-language/commitments/format.md +7 -0
- package/dist/expert/book-language/commitments/from.md +7 -0
- package/dist/expert/book-language/commitments/goal.md +7 -0
- package/dist/expert/book-language/commitments/import.md +7 -0
- package/dist/expert/book-language/commitments/knowledge.md +7 -0
- package/dist/expert/book-language/commitments/language.md +7 -0
- package/dist/expert/book-language/commitments/model.md +7 -0
- package/dist/expert/book-language/commitments/note.md +7 -0
- package/dist/expert/book-language/commitments/open.md +7 -0
- package/dist/expert/book-language/commitments/persona.md +7 -0
- package/dist/expert/book-language/commitments/rule.md +7 -0
- package/dist/expert/book-language/commitments/sample.md +7 -0
- package/dist/expert/book-language/commitments/style.md +7 -0
- package/dist/expert/book-language/commitments/task-after.md +7 -0
- package/dist/expert/book-language/commitments/task-agent.md +7 -0
- package/dist/expert/book-language/commitments/task-depends-on.md +7 -0
- package/dist/expert/book-language/commitments/task-done.md +7 -0
- package/dist/expert/book-language/commitments/task-due-date.md +7 -0
- package/dist/expert/book-language/commitments/task-harness.md +7 -0
- package/dist/expert/book-language/commitments/task-id.md +9 -0
- package/dist/expert/book-language/commitments/task-model.md +7 -0
- package/dist/expert/book-language/commitments/task-note.md +7 -0
- package/dist/expert/book-language/commitments/task-origin.md +7 -0
- package/dist/expert/book-language/commitments/task-parent.md +7 -0
- package/dist/expert/book-language/commitments/task-priority.md +7 -0
- package/dist/expert/book-language/commitments/task-repeat.md +7 -0
- package/dist/expert/book-language/commitments/task-runner.md +7 -0
- package/dist/expert/book-language/commitments/task-status.md +7 -0
- package/dist/expert/book-language/commitments/task-thinking-level.md +7 -0
- package/dist/expert/book-language/commitments/task.md +7 -0
- package/dist/expert/book-language/commitments/team.md +7 -0
- package/dist/expert/book-language/commitments/template.md +7 -0
- package/dist/expert/book-language/commitments/writing-rules.md +7 -0
- package/dist/expert/book-language/commitments/writing-sample.md +7 -0
- package/dist/expert/book-language/inheritance.md +13 -0
- package/dist/expert/book-language/references.md +42 -0
- package/dist/expert/book-language/syntax.md +22 -0
- package/dist/expert/cli/acceptance.md +84 -0
- package/dist/expert/cli/agent-context.md +11 -0
- package/dist/expert/cli/api.md +19 -0
- package/dist/expert/cli/authoring.md +15 -0
- package/dist/expert/cli/autonomous-operation.md +39 -0
- package/dist/expert/cli/browser.md +33 -0
- package/dist/expert/cli/channels.md +13 -0
- package/dist/expert/cli/checks.md +19 -0
- package/dist/expert/cli/cli.md +57 -0
- package/dist/expert/cli/configuration.md +27 -0
- package/dist/expert/cli/controls.md +15 -0
- package/dist/expert/cli/dashboard-layout.md +23 -0
- package/dist/expert/cli/dashboard.md +17 -0
- package/dist/expert/cli/eligibility.md +13 -0
- package/dist/expert/cli/errors.md +15 -0
- package/dist/expert/cli/execution.md +17 -0
- package/dist/expert/cli/first-task.md +27 -0
- package/dist/expert/cli/git-persistence.md +49 -0
- package/dist/expert/cli/git-preflight.md +11 -0
- package/dist/expert/cli/git-synchronization.md +11 -0
- package/dist/expert/cli/goal-discovery.md +15 -0
- package/dist/expert/cli/harness-plugins.md +23 -0
- package/dist/expert/cli/harness-updates.md +19 -0
- package/dist/expert/cli/harnesses.md +33 -0
- package/dist/expert/cli/help.md +27 -0
- package/dist/expert/cli/initialization-ui.md +31 -0
- package/dist/expert/cli/initialization.md +47 -0
- package/dist/expert/cli/installation.md +19 -0
- package/dist/expert/cli/interactive-ui.md +43 -0
- package/dist/expert/cli/isolation.md +11 -0
- package/dist/expert/cli/migration.md +13 -0
- package/dist/expert/cli/nested-projects.md +19 -0
- package/dist/expert/cli/not-before.md +13 -0
- package/dist/expert/cli/operations.md +15 -0
- package/dist/expert/cli/persistence.md +17 -0
- package/dist/expert/cli/planning.md +11 -0
- package/dist/expert/cli/process-modes.md +28 -0
- package/dist/expert/cli/recovery.md +13 -0
- package/dist/expert/cli/recurrence.md +15 -0
- package/dist/expert/cli/releasing.md +23 -0
- package/dist/expert/cli/remote-access.md +41 -0
- package/dist/expert/cli/retries.md +15 -0
- package/dist/expert/cli/rich-input.md +15 -0
- package/dist/expert/cli/run.md +13 -0
- package/dist/expert/cli/start.md +31 -0
- package/dist/expert/cli/status-view.md +33 -0
- package/dist/expert/cli/task-books.md +28 -0
- package/dist/expert/cli/task-identity.md +17 -0
- package/dist/expert/cli/task-markdown.md +15 -0
- package/dist/expert/cli/task-origins.md +17 -0
- package/dist/expert/cli/task-relationships.md +13 -0
- package/dist/expert/cli/team.md +13 -0
- package/dist/expert/cli/terminal.md +29 -0
- package/dist/expert/cli/trace-configuration.md +23 -0
- package/dist/expert/cli/traces.md +45 -0
- package/dist/expert/cli/tunnel-options.md +24 -0
- package/dist/expert/cli/updates.md +17 -0
- package/dist/expert/cli/user-interactions.md +39 -0
- package/dist/expert/cli/workspace.md +23 -0
- package/dist/expert/dictionary.md +33 -0
- package/dist/expert/whitepaper.md +211 -0
- package/dist/harness/maintenance.d.ts +69 -0
- package/dist/harness/maintenance.js +161 -0
- package/dist/harness/maintenance.js.map +1 -0
- package/dist/harness/plugins/claude-code/index.d.ts +7 -0
- package/dist/harness/plugins/claude-code/index.js +79 -0
- package/dist/harness/plugins/claude-code/index.js.map +1 -0
- package/dist/harness/plugins/cline/index.d.ts +7 -0
- package/dist/harness/plugins/cline/index.js +67 -0
- package/dist/harness/plugins/cline/index.js.map +1 -0
- package/dist/harness/plugins/gemini/index.d.ts +7 -0
- package/dist/harness/plugins/gemini/index.js +50 -0
- package/dist/harness/plugins/gemini/index.js.map +1 -0
- package/dist/harness/plugins/github-copilot/index.d.ts +7 -0
- package/dist/harness/plugins/github-copilot/index.js +70 -0
- package/dist/harness/plugins/github-copilot/index.js.map +1 -0
- package/dist/harness/plugins/openai-codex/index.d.ts +7 -0
- package/dist/harness/plugins/openai-codex/index.js +199 -0
- package/dist/harness/plugins/openai-codex/index.js.map +1 -0
- package/dist/harness/plugins/opencode/index.d.ts +7 -0
- package/dist/harness/plugins/opencode/index.js +110 -0
- package/dist/harness/plugins/opencode/index.js.map +1 -0
- package/dist/harness/plugins/qwen-code/index.d.ts +7 -0
- package/dist/harness/plugins/qwen-code/index.js +50 -0
- package/dist/harness/plugins/qwen-code/index.js.map +1 -0
- package/dist/harness/registry.d.ts +19 -0
- package/dist/harness/registry.js +32 -0
- package/dist/harness/registry.js.map +1 -0
- package/dist/harness/run.d.ts +54 -0
- package/dist/harness/run.js +127 -0
- package/dist/harness/run.js.map +1 -0
- package/dist/harness/shared.d.ts +70 -0
- package/dist/harness/shared.js +228 -0
- package/dist/harness/shared.js.map +1 -0
- package/dist/harness/types.d.ts +220 -0
- package/dist/harness/types.js +2 -0
- package/dist/harness/types.js.map +1 -0
- package/dist/project/agents.d.ts +217 -0
- package/dist/project/agents.js +536 -0
- package/dist/project/agents.js.map +1 -0
- package/dist/project/checks.d.ts +59 -0
- package/dist/project/checks.js +155 -0
- package/dist/project/checks.js.map +1 -0
- package/dist/project/config.d.ts +211 -0
- package/dist/project/config.js +443 -0
- package/dist/project/config.js.map +1 -0
- package/dist/project/defaults.d.ts +102 -0
- package/dist/project/defaults.js +251 -0
- package/dist/project/defaults.js.map +1 -0
- package/dist/project/draft.d.ts +29 -0
- package/dist/project/draft.js +65 -0
- package/dist/project/draft.js.map +1 -0
- package/dist/project/expert.d.ts +14 -0
- package/dist/project/expert.js +58 -0
- package/dist/project/expert.js.map +1 -0
- package/dist/project/git.d.ts +208 -0
- package/dist/project/git.js +323 -0
- package/dist/project/git.js.map +1 -0
- package/dist/project/install.d.ts +52 -0
- package/dist/project/install.js +113 -0
- package/dist/project/install.js.map +1 -0
- package/dist/project/readiness.d.ts +35 -0
- package/dist/project/readiness.js +63 -0
- package/dist/project/readiness.js.map +1 -0
- package/dist/project/self-update.d.ts +28 -0
- package/dist/project/self-update.js +48 -0
- package/dist/project/self-update.js.map +1 -0
- package/dist/project/setup.d.ts +116 -0
- package/dist/project/setup.js +253 -0
- package/dist/project/setup.js.map +1 -0
- package/dist/project/workspace.d.ts +82 -0
- package/dist/project/workspace.js +78 -0
- package/dist/project/workspace.js.map +1 -0
- package/dist/service/actions.d.ts +30 -0
- package/dist/service/actions.js +66 -0
- package/dist/service/actions.js.map +1 -0
- package/dist/service/auth.d.ts +92 -0
- package/dist/service/auth.js +146 -0
- package/dist/service/auth.js.map +1 -0
- package/dist/service/cloudflared.d.ts +18 -0
- package/dist/service/cloudflared.js +83 -0
- package/dist/service/cloudflared.js.map +1 -0
- package/dist/service/control.d.ts +61 -0
- package/dist/service/control.js +101 -0
- package/dist/service/control.js.map +1 -0
- package/dist/service/host.d.ts +75 -0
- package/dist/service/host.js +229 -0
- package/dist/service/host.js.map +1 -0
- package/dist/service/http.d.ts +48 -0
- package/dist/service/http.js +281 -0
- package/dist/service/http.js.map +1 -0
- package/dist/service/launcher.d.ts +51 -0
- package/dist/service/launcher.js +187 -0
- package/dist/service/launcher.js.map +1 -0
- package/dist/service/persistence.d.ts +25 -0
- package/dist/service/persistence.js +123 -0
- package/dist/service/persistence.js.map +1 -0
- package/dist/service/records.d.ts +146 -0
- package/dist/service/records.js +224 -0
- package/dist/service/records.js.map +1 -0
- package/dist/service/spa/app.css +433 -0
- package/dist/service/spa/app.js +456 -0
- package/dist/service/spa/icon.svg +1 -0
- package/dist/service/spa/index.html +22 -0
- package/dist/service/supervisor.d.ts +1 -0
- package/dist/service/supervisor.js +73 -0
- package/dist/service/supervisor.js.map +1 -0
- package/dist/service/tunnel.d.ts +55 -0
- package/dist/service/tunnel.js +199 -0
- package/dist/service/tunnel.js.map +1 -0
- package/dist/service/worker.d.ts +1 -0
- package/dist/service/worker.js +79 -0
- package/dist/service/worker.js.map +1 -0
- package/dist/tasks/authoring.d.ts +36 -0
- package/dist/tasks/authoring.js +50 -0
- package/dist/tasks/authoring.js.map +1 -0
- package/dist/tasks/book-task.d.ts +33 -0
- package/dist/tasks/book-task.js +202 -0
- package/dist/tasks/book-task.js.map +1 -0
- package/dist/tasks/eligibility.d.ts +134 -0
- package/dist/tasks/eligibility.js +163 -0
- package/dist/tasks/eligibility.js.map +1 -0
- package/dist/tasks/identity.d.ts +41 -0
- package/dist/tasks/identity.js +67 -0
- package/dist/tasks/identity.js.map +1 -0
- package/dist/tasks/markdown.d.ts +81 -0
- package/dist/tasks/markdown.js +246 -0
- package/dist/tasks/markdown.js.map +1 -0
- package/dist/tasks/model.d.ts +146 -0
- package/dist/tasks/model.js +28 -0
- package/dist/tasks/model.js.map +1 -0
- package/dist/tasks/prepare.d.ts +33 -0
- package/dist/tasks/prepare.js +90 -0
- package/dist/tasks/prepare.js.map +1 -0
- package/dist/tasks/priority.d.ts +17 -0
- package/dist/tasks/priority.js +47 -0
- package/dist/tasks/priority.js.map +1 -0
- package/dist/tasks/recurrence.d.ts +31 -0
- package/dist/tasks/recurrence.js +43 -0
- package/dist/tasks/recurrence.js.map +1 -0
- package/dist/tasks/sources.d.ts +52 -0
- package/dist/tasks/sources.js +113 -0
- package/dist/tasks/sources.js.map +1 -0
- package/dist/ui/ansi.d.ts +60 -0
- package/dist/ui/ansi.js +174 -0
- package/dist/ui/ansi.js.map +1 -0
- package/dist/ui/attachments.d.ts +55 -0
- package/dist/ui/attachments.js +134 -0
- package/dist/ui/attachments.js.map +1 -0
- package/dist/ui/badges.d.ts +69 -0
- package/dist/ui/badges.js +158 -0
- package/dist/ui/badges.js.map +1 -0
- package/dist/ui/celebration.d.ts +8 -0
- package/dist/ui/celebration.js +47 -0
- package/dist/ui/celebration.js.map +1 -0
- package/dist/ui/composer.d.ts +108 -0
- package/dist/ui/composer.js +365 -0
- package/dist/ui/composer.js.map +1 -0
- package/dist/ui/dashboard.d.ts +43 -0
- package/dist/ui/dashboard.js +376 -0
- package/dist/ui/dashboard.js.map +1 -0
- package/dist/ui/error-view.d.ts +18 -0
- package/dist/ui/error-view.js +88 -0
- package/dist/ui/error-view.js.map +1 -0
- package/dist/ui/keys.d.ts +54 -0
- package/dist/ui/keys.js +183 -0
- package/dist/ui/keys.js.map +1 -0
- package/dist/ui/panels.d.ts +42 -0
- package/dist/ui/panels.js +69 -0
- package/dist/ui/panels.js.map +1 -0
- package/dist/ui/prompts.d.ts +161 -0
- package/dist/ui/prompts.js +530 -0
- package/dist/ui/prompts.js.map +1 -0
- package/dist/ui/screen.d.ts +50 -0
- package/dist/ui/screen.js +117 -0
- package/dist/ui/screen.js.map +1 -0
- package/dist/ui/status-view.d.ts +73 -0
- package/dist/ui/status-view.js +278 -0
- package/dist/ui/status-view.js.map +1 -0
- package/dist/ui/terminal.d.ts +78 -0
- package/dist/ui/terminal.js +51 -0
- package/dist/ui/terminal.js.map +1 -0
- package/package.json +9 -13
- package/changelog/README.md +0 -8
- package/changelog/_current-preversion.md +0 -39
- package/dist/coder/add-wizard.d.ts +0 -14
- package/dist/coder/add-wizard.js +0 -88
- package/dist/coder/add-wizard.js.map +0 -1
- package/dist/coder/agent-identity.d.ts +0 -23
- package/dist/coder/agent-identity.js +0 -67
- package/dist/coder/agent-identity.js.map +0 -1
- package/dist/coder/agents.d.ts +0 -64
- package/dist/coder/agents.js +0 -586
- package/dist/coder/agents.js.map +0 -1
- package/dist/coder/attached-dashboard.d.ts +0 -15
- package/dist/coder/attached-dashboard.js +0 -221
- package/dist/coder/attached-dashboard.js.map +0 -1
- package/dist/coder/authoring.d.ts +0 -40
- package/dist/coder/authoring.js +0 -316
- package/dist/coder/authoring.js.map +0 -1
- package/dist/coder/browser.d.ts +0 -93
- package/dist/coder/browser.js +0 -459
- package/dist/coder/browser.js.map +0 -1
- package/dist/coder/check-setup.d.ts +0 -44
- package/dist/coder/check-setup.js +0 -174
- package/dist/coder/check-setup.js.map +0 -1
- package/dist/coder/checks.d.ts +0 -30
- package/dist/coder/checks.js +0 -168
- package/dist/coder/checks.js.map +0 -1
- package/dist/coder/choices.d.ts +0 -36
- package/dist/coder/choices.js +0 -409
- package/dist/coder/choices.js.map +0 -1
- package/dist/coder/cli.d.ts +0 -10
- package/dist/coder/cli.js +0 -1181
- package/dist/coder/cli.js.map +0 -1
- package/dist/coder/configuration.d.ts +0 -23
- package/dist/coder/configuration.js +0 -201
- package/dist/coder/configuration.js.map +0 -1
- package/dist/coder/dashboard-access.d.ts +0 -56
- package/dist/coder/dashboard-access.js +0 -122
- package/dist/coder/dashboard-access.js.map +0 -1
- package/dist/coder/dashboard-page.d.ts +0 -2
- package/dist/coder/dashboard-page.js +0 -102
- package/dist/coder/dashboard-page.js.map +0 -1
- package/dist/coder/dashboard-server.d.ts +0 -15
- package/dist/coder/dashboard-server.js +0 -183
- package/dist/coder/dashboard-server.js.map +0 -1
- package/dist/coder/diagnostics.d.ts +0 -13
- package/dist/coder/diagnostics.js +0 -44
- package/dist/coder/diagnostics.js.map +0 -1
- package/dist/coder/domain.d.ts +0 -95
- package/dist/coder/domain.js +0 -2
- package/dist/coder/domain.js.map +0 -1
- package/dist/coder/edit-task-control.d.ts +0 -7
- package/dist/coder/edit-task-control.js +0 -43
- package/dist/coder/edit-task-control.js.map +0 -1
- package/dist/coder/engine.d.ts +0 -115
- package/dist/coder/engine.js +0 -1340
- package/dist/coder/engine.js.map +0 -1
- package/dist/coder/file-replacement.d.ts +0 -13
- package/dist/coder/file-replacement.js +0 -25
- package/dist/coder/file-replacement.js.map +0 -1
- package/dist/coder/finite.d.ts +0 -24
- package/dist/coder/finite.js +0 -259
- package/dist/coder/finite.js.map +0 -1
- package/dist/coder/first-task.d.ts +0 -9
- package/dist/coder/first-task.js +0 -39
- package/dist/coder/first-task.js.map +0 -1
- package/dist/coder/git.d.ts +0 -88
- package/dist/coder/git.js +0 -386
- package/dist/coder/git.js.map +0 -1
- package/dist/coder/harness-plugins/acp.d.ts +0 -8
- package/dist/coder/harness-plugins/acp.js +0 -107
- package/dist/coder/harness-plugins/acp.js.map +0 -1
- package/dist/coder/harness-plugins/claude-code/index.d.ts +0 -2
- package/dist/coder/harness-plugins/claude-code/index.js +0 -140
- package/dist/coder/harness-plugins/claude-code/index.js.map +0 -1
- package/dist/coder/harness-plugins/cline/index.d.ts +0 -2
- package/dist/coder/harness-plugins/cline/index.js +0 -111
- package/dist/coder/harness-plugins/cline/index.js.map +0 -1
- package/dist/coder/harness-plugins/configuration.d.ts +0 -4
- package/dist/coder/harness-plugins/configuration.js +0 -22
- package/dist/coder/harness-plugins/configuration.js.map +0 -1
- package/dist/coder/harness-plugins/contract.d.ts +0 -123
- package/dist/coder/harness-plugins/contract.js +0 -2
- package/dist/coder/harness-plugins/contract.js.map +0 -1
- package/dist/coder/harness-plugins/gemini/index.d.ts +0 -2
- package/dist/coder/harness-plugins/gemini/index.js +0 -70
- package/dist/coder/harness-plugins/gemini/index.js.map +0 -1
- package/dist/coder/harness-plugins/github-copilot/index.d.ts +0 -2
- package/dist/coder/harness-plugins/github-copilot/index.js +0 -197
- package/dist/coder/harness-plugins/github-copilot/index.js.map +0 -1
- package/dist/coder/harness-plugins/index.d.ts +0 -5
- package/dist/coder/harness-plugins/index.js +0 -17
- package/dist/coder/harness-plugins/index.js.map +0 -1
- package/dist/coder/harness-plugins/locks.d.ts +0 -13
- package/dist/coder/harness-plugins/locks.js +0 -123
- package/dist/coder/harness-plugins/locks.js.map +0 -1
- package/dist/coder/harness-plugins/maintenance.d.ts +0 -33
- package/dist/coder/harness-plugins/maintenance.js +0 -115
- package/dist/coder/harness-plugins/maintenance.js.map +0 -1
- package/dist/coder/harness-plugins/openai-codex/index.d.ts +0 -2
- package/dist/coder/harness-plugins/openai-codex/index.js +0 -268
- package/dist/coder/harness-plugins/openai-codex/index.js.map +0 -1
- package/dist/coder/harness-plugins/opencode/index.d.ts +0 -2
- package/dist/coder/harness-plugins/opencode/index.js +0 -81
- package/dist/coder/harness-plugins/opencode/index.js.map +0 -1
- package/dist/coder/harness-plugins/qwen-code/index.d.ts +0 -2
- package/dist/coder/harness-plugins/qwen-code/index.js +0 -65
- package/dist/coder/harness-plugins/qwen-code/index.js.map +0 -1
- package/dist/coder/harness-plugins/shared.d.ts +0 -27
- package/dist/coder/harness-plugins/shared.js +0 -277
- package/dist/coder/harness-plugins/shared.js.map +0 -1
- package/dist/coder/harness-process.d.ts +0 -51
- package/dist/coder/harness-process.js +0 -368
- package/dist/coder/harness-process.js.map +0 -1
- package/dist/coder/harness.d.ts +0 -74
- package/dist/coder/harness.js +0 -255
- package/dist/coder/harness.js.map +0 -1
- package/dist/coder/help.d.ts +0 -39
- package/dist/coder/help.js +0 -283
- package/dist/coder/help.js.map +0 -1
- package/dist/coder/initialization.d.ts +0 -81
- package/dist/coder/initialization.js +0 -599
- package/dist/coder/initialization.js.map +0 -1
- package/dist/coder/interactive.d.ts +0 -45
- package/dist/coder/interactive.js +0 -299
- package/dist/coder/interactive.js.map +0 -1
- package/dist/coder/logging.d.ts +0 -9
- package/dist/coder/logging.js +0 -64
- package/dist/coder/logging.js.map +0 -1
- package/dist/coder/migrate.d.ts +0 -29
- package/dist/coder/migrate.js +0 -249
- package/dist/coder/migrate.js.map +0 -1
- package/dist/coder/persistence.d.ts +0 -32
- package/dist/coder/persistence.js +0 -133
- package/dist/coder/persistence.js.map +0 -1
- package/dist/coder/planner.d.ts +0 -32
- package/dist/coder/planner.js +0 -203
- package/dist/coder/planner.js.map +0 -1
- package/dist/coder/presentation.d.ts +0 -34
- package/dist/coder/presentation.js +0 -106
- package/dist/coder/presentation.js.map +0 -1
- package/dist/coder/requests.d.ts +0 -25
- package/dist/coder/requests.js +0 -147
- package/dist/coder/requests.js.map +0 -1
- package/dist/coder/schedule.d.ts +0 -13
- package/dist/coder/schedule.js +0 -165
- package/dist/coder/schedule.js.map +0 -1
- package/dist/coder/server.d.ts +0 -8
- package/dist/coder/server.js +0 -8
- package/dist/coder/server.js.map +0 -1
- package/dist/coder/service-environment.d.ts +0 -9
- package/dist/coder/service-environment.js +0 -30
- package/dist/coder/service-environment.js.map +0 -1
- package/dist/coder/service-worker.js +0 -46
- package/dist/coder/service-worker.js.map +0 -1
- package/dist/coder/service.d.ts +0 -90
- package/dist/coder/service.js +0 -1404
- package/dist/coder/service.js.map +0 -1
- package/dist/coder/setup.d.ts +0 -39
- package/dist/coder/setup.js +0 -95
- package/dist/coder/setup.js.map +0 -1
- package/dist/coder/sources.d.ts +0 -58
- package/dist/coder/sources.js +0 -746
- package/dist/coder/sources.js.map +0 -1
- package/dist/coder/state.d.ts +0 -162
- package/dist/coder/state.js +0 -300
- package/dist/coder/state.js.map +0 -1
- package/dist/coder/status-view.d.ts +0 -17
- package/dist/coder/status-view.js +0 -89
- package/dist/coder/status-view.js.map +0 -1
- package/dist/coder/team.d.ts +0 -36
- package/dist/coder/team.js +0 -138
- package/dist/coder/team.js.map +0 -1
- package/dist/coder/terminal.d.ts +0 -27
- package/dist/coder/terminal.js +0 -498
- package/dist/coder/terminal.js.map +0 -1
- package/dist/coder/tunnel.d.ts +0 -68
- package/dist/coder/tunnel.js +0 -288
- package/dist/coder/tunnel.js.map +0 -1
- package/dist/coder/updates.d.ts +0 -34
- package/dist/coder/updates.js +0 -99
- package/dist/coder/updates.js.map +0 -1
- package/dist/coder/version.d.ts +0 -4
- package/dist/coder/version.js +0 -16
- package/dist/coder/version.js.map +0 -1
- package/dist/coder/workspace.d.ts +0 -42
- package/dist/coder/workspace.js +0 -204
- package/dist/coder/workspace.js.map +0 -1
- package/docs/compatibility.md +0 -22
- package/docs/releasing.md +0 -73
- package/docs/runtime.md +0 -126
- /package/dist/{coder/service-worker.d.ts → engine/mcp-server.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,40 +1,68 @@
|
|
|
1
1
|
# Promptbook (`ptbk`)
|
|
2
2
|
|
|
3
|
-
Promptbook operates readable
|
|
3
|
+
Promptbook operates readable **agents** and **tasks** over a Git project. Agents are Books with lasting roles, goals and rules; tasks are bounded work. Once started, the agenda runs unattended: it executes one task at a time, routes unassigned tasks through Manager, verifies every result with your project check and commits it together with its completion record (`PTBK: <task title>` plus a `Task-ID` trailer). When the backlog is empty, agents with goals are asked whether new work is useful. You are asked only when something genuinely needs a person.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This repository publishes exactly one npm package, `ptbk`, which installs the `ptbk` command. It requires Node.js 22.13+ (Node 22 line) or 24+, npm 10+ and Git.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
# Global
|
|
10
|
+
# Global
|
|
9
11
|
npm install --global ptbk
|
|
10
|
-
ptbk init --path ./project
|
|
11
12
|
|
|
12
|
-
#
|
|
13
|
+
# Or project-local (no PATH entry; use npx or npm scripts)
|
|
13
14
|
npm install --save-dev ptbk
|
|
14
|
-
npx ptbk
|
|
15
|
+
npx ptbk --version
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Global and local installations are independent; every project keeps using the installation that started it, including after restarts.
|
|
19
|
+
|
|
20
|
+
## Use
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
ptbk init # describe your project, answer a few setup questions; the agenda then starts in the background
|
|
24
|
+
ptbk dashboard # live terminal view and controls (Q leaves, the service keeps running)
|
|
25
|
+
ptbk status # one snapshot: requests, current work, queue, connection
|
|
26
|
+
ptbk add "Improve CSV export" # creates and commits a task (with its Task-ID); Manager assigns it
|
|
27
|
+
ptbk list "#<task-id>" # one task: its trace, browser video and commits
|
|
28
|
+
ptbk answer # answer questions agents asked you
|
|
29
|
+
ptbk stop # stop (stays stopped after reboot until the next start or init)
|
|
30
|
+
ptbk start # start an initialized, cloned or stopped project
|
|
31
|
+
ptbk run --limit 1 # finite run with one agent/harness configuration
|
|
15
32
|
```
|
|
16
33
|
|
|
17
|
-
|
|
34
|
+
`ptbk init` first asks what you are working on — free text, long pasted material, images or other files (Ctrl+O attaches a file, Ctrl+V pastes a clipboard image, long pastes become compact `[Pasted text #1, 120 lines]` tokens). Your input is saved verbatim in `specs/_initial.md` (attachments in `specs/_initial/`), and one ordinary task assigned to the engine-supplied Expert transforms the project according to it. Init shows `Step X of Y`, never runs that task itself, starts the background agenda and returns; a blank intent gives a small skeleton whose first task is a readiness review.
|
|
35
|
+
|
|
36
|
+
Run `ptbk help` for all commands and `ptbk help <command>` for one command's options, defaults and examples.
|
|
37
|
+
|
|
38
|
+
- **Unattended setup:** `ptbk init --non-interactive --installation local --harness openai-codex --check "npm test" --intent-file brief.md --attach mockup.png` (`--no-start` only prepares the project).
|
|
39
|
+
- **Harnesses:** OpenAI Codex and Claude Code are featured; GitHub Copilot, Cline, OpenCode, Gemini CLI and Qwen Code are also supported. They are installed globally and use their own login.
|
|
40
|
+
- **Files:** agents in `agents/` (core Adam, Manager and Teacher in `agents/.core/`), tasks in `tasks/` (Books or Markdown), specifications in `specs/`, per-task audit evidence in `traces/<task-id>/`, configuration in `ptbk.json`, runtime state in the Git-ignored `.ptbk/`.
|
|
41
|
+
- **Task IDs and traces:** every task has a stable ID (`TASK ID` in Books, `<!-- ptbk-task-id: … -->` in Markdown sections) that also appears in its commits' `Task-ID` trailer and names `traces/<task-id>/`: the consolidated harness output (`harness.log`), events (`events.jsonl`) and, when the task used the project browser, its video (`video/`, sign-in steps excluded). `ptbk.json` `traces.commit` (default off: `traces/` is ignored), `traces.ignoreVideos` (default on) and `traces.recordVideo` (default on) are chosen on init's Traces screen. With `ffmpeg` on PATH videos are H.264 MP4, otherwise Motion-JPEG MOV.
|
|
42
|
+
- **Remote access:** `ptbk start` serves a dashboard on `127.0.0.1` and publishes it through a Cloudflare quick tunnel; devices must pair with a single-use link shown in the local terminal (`ptbk access pair`). Use `--no-tunnel` for local-only access or `--no-server` for neither.
|
|
43
|
+
- **Presentation:** pretty terminal UI by default; `--raw` (or redirected output) gives plain text without prompts. `--non-interactive` never asks questions.
|
|
44
|
+
- **Commits:** every mutating workflow commits its own changes with a `PTBK: ` subject; `--no-commit` is the explicit exception.
|
|
45
|
+
|
|
46
|
+
The behavior is defined by [the specification](specs/_main.md).
|
|
47
|
+
|
|
48
|
+
## Develop
|
|
18
49
|
|
|
19
50
|
```bash
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ptbk start # background agenda, protected remote 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
|
|
51
|
+
npm ci
|
|
52
|
+
npm run check # typecheck, tests with a fake harness, packed local/global installation checks
|
|
53
|
+
npm run ptbk -- --help
|
|
28
54
|
```
|
|
29
55
|
|
|
30
|
-
|
|
56
|
+
## Release
|
|
31
57
|
|
|
32
|
-
|
|
58
|
+
From a clean, committed, named branch:
|
|
33
59
|
|
|
34
|
-
|
|
60
|
+
```bash
|
|
61
|
+
npm version prerelease # or patch / minor / major
|
|
62
|
+
```
|
|
35
63
|
|
|
36
|
-
|
|
64
|
+
`preversion` verifies the clean branch, typechecks, runs the tests and validates the manifest/lockfile. `postversion` atomically pushes the version commit and its `vX.Y.Z` tag. GitHub Actions then runs **Check ptbk** on Node 22/24 × Linux/macOS/Windows for the tag and, only if it passes, **Publish ptbk** publishes the single `ptbk` package with npm provenance and verifies the public registry and default local/global installations. Publishing needs the `NPM_TOKEN` secret or npm trusted publishing configured for this repository.
|
|
37
65
|
|
|
38
|
-
|
|
66
|
+
## License
|
|
39
67
|
|
|
40
|
-
|
|
68
|
+
See [LICENSE.md](LICENSE.md).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which document kinds a commitment belongs to.
|
|
3
|
+
*
|
|
4
|
+
* @private Book language
|
|
5
|
+
*/
|
|
6
|
+
export type CommitmentScope = 'agent' | 'task' | 'both';
|
|
7
|
+
/**
|
|
8
|
+
* How a commitment's content is interpreted.
|
|
9
|
+
*
|
|
10
|
+
* - `instruction`: repeatable multi-line natural-language content
|
|
11
|
+
* - `control`: single-value control field (its value is the first line)
|
|
12
|
+
* - `repeatable-control`: control field that may appear several times (e.g. `TASK DONE`, `TASK DEPENDS ON`)
|
|
13
|
+
* - `flag`: marker without required content (e.g. `CLOSED`)
|
|
14
|
+
*
|
|
15
|
+
* @private Book language
|
|
16
|
+
*/
|
|
17
|
+
export type CommitmentKind = 'instruction' | 'control' | 'repeatable-control' | 'flag';
|
|
18
|
+
/**
|
|
19
|
+
* Definition of one canonical commitment with its aliases.
|
|
20
|
+
*
|
|
21
|
+
* @private Book language
|
|
22
|
+
*/
|
|
23
|
+
export type CommitmentDefinition = {
|
|
24
|
+
/** Canonical uppercase keyword (may contain spaces). */
|
|
25
|
+
readonly keyword: string;
|
|
26
|
+
/** Alias keywords sharing the semantics. */
|
|
27
|
+
readonly aliases: readonly string[];
|
|
28
|
+
/** Document kinds accepting the commitment. */
|
|
29
|
+
readonly scope: CommitmentScope;
|
|
30
|
+
/** Content interpretation. */
|
|
31
|
+
readonly kind: CommitmentKind;
|
|
32
|
+
/** Short description used by help, Expert and diagnostics. */
|
|
33
|
+
readonly description: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Every recognized commitment.
|
|
37
|
+
*
|
|
38
|
+
* @private Book language
|
|
39
|
+
*/
|
|
40
|
+
export declare const COMMITMENTS: readonly CommitmentDefinition[];
|
|
41
|
+
/**
|
|
42
|
+
* Recognizes a commitment at the beginning of a line.
|
|
43
|
+
*
|
|
44
|
+
* The keyword must be uppercase and complete: it is followed by whitespace or the end of the line.
|
|
45
|
+
*
|
|
46
|
+
* @private Book language
|
|
47
|
+
*/
|
|
48
|
+
export declare function matchCommitmentKeyword(line: string): {
|
|
49
|
+
definition: CommitmentDefinition;
|
|
50
|
+
written: string;
|
|
51
|
+
content: string;
|
|
52
|
+
} | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every recognized commitment.
|
|
3
|
+
*
|
|
4
|
+
* @private Book language
|
|
5
|
+
*/
|
|
6
|
+
export const COMMITMENTS = [
|
|
7
|
+
{ keyword: 'PERSONA', aliases: ['PERSONAE'], scope: 'agent', kind: 'instruction', description: 'Role and identity of the agent.' },
|
|
8
|
+
{ keyword: 'GOAL', aliases: ['GOALS'], scope: 'agent', kind: 'instruction', description: 'Lasting objective, also used for goal discovery.' },
|
|
9
|
+
{ keyword: 'RULE', aliases: ['RULES'], scope: 'both', kind: 'instruction', description: 'Behavioral constraint (task rules apply only to that task).' },
|
|
10
|
+
{ keyword: 'KNOWLEDGE', aliases: [], scope: 'agent', kind: 'instruction', description: 'Inline knowledge or a reference to relevant material.' },
|
|
11
|
+
{ keyword: 'STYLE', aliases: ['STYLES'], scope: 'agent', kind: 'instruction', description: 'Style of communication or output.' },
|
|
12
|
+
{ keyword: 'LANGUAGE', aliases: ['LANGUAGES'], scope: 'agent', kind: 'instruction', description: 'Language(s) of responses.' },
|
|
13
|
+
{ keyword: 'WRITING SAMPLE', aliases: [], scope: 'agent', kind: 'instruction', description: 'Example of the desired writing style.' },
|
|
14
|
+
{ keyword: 'WRITING RULES', aliases: ['WRITING RULE'], scope: 'agent', kind: 'instruction', description: 'Specific writing conventions.' },
|
|
15
|
+
{ keyword: 'SAMPLE', aliases: ['EXAMPLE'], scope: 'agent', kind: 'instruction', description: 'Representative interaction or output.' },
|
|
16
|
+
{ keyword: 'FORMAT', aliases: ['FORMATS'], scope: 'agent', kind: 'instruction', description: 'Requested output format.' },
|
|
17
|
+
{ keyword: 'TEMPLATE', aliases: ['TEMPLATES'], scope: 'agent', kind: 'instruction', description: 'Reusable response/output pattern.' },
|
|
18
|
+
{ keyword: 'FROM', aliases: [], scope: 'agent', kind: 'control', description: 'Single inheritance parent (default Adam).' },
|
|
19
|
+
{ keyword: 'IMPORT', aliases: ['IMPORTS'], scope: 'agent', kind: 'repeatable-control', description: 'In-place inclusion of another agent\'s instructions.' },
|
|
20
|
+
{ keyword: 'MODEL', aliases: ['MODELS'], scope: 'agent', kind: 'instruction', description: 'Model preference or requirement of the agent.' },
|
|
21
|
+
{ keyword: 'ACTION', aliases: ['ACTIONS'], scope: 'agent', kind: 'instruction', description: 'Actions/tools the role intends to use.' },
|
|
22
|
+
{ keyword: 'TEAM', aliases: [], scope: 'agent', kind: 'instruction', description: 'Whom the agent may consult and when.' },
|
|
23
|
+
{ keyword: 'OPEN', aliases: [], scope: 'agent', kind: 'instruction', description: 'Permits learning, optionally with natural-language limits.' },
|
|
24
|
+
{ keyword: 'CLOSED', aliases: [], scope: 'agent', kind: 'flag', description: 'Prohibits automatic learning changes.' },
|
|
25
|
+
{ keyword: 'NOTE', aliases: ['NOTES', 'COMMENT', 'NONCE', 'TODO'], scope: 'both', kind: 'instruction', description: 'Non-executable commentary.' },
|
|
26
|
+
{ keyword: 'DELETE', aliases: ['CANCEL', 'DISCARD', 'REMOVE'], scope: 'agent', kind: 'instruction', description: 'Withdraws an identified earlier commitment.' },
|
|
27
|
+
{ keyword: 'DICTIONARY', aliases: [], scope: 'agent', kind: 'instruction', description: 'Terminology for the role\'s work.' },
|
|
28
|
+
{ keyword: 'TASK', aliases: [], scope: 'task', kind: 'control', description: 'Declares a task: `TASK <title>` on the first nonempty line.' },
|
|
29
|
+
{ keyword: 'TASK ID', aliases: [], scope: 'task', kind: 'control', description: 'Stable reference key, distinct from the title.' },
|
|
30
|
+
{ keyword: 'TASK AGENT', aliases: [], scope: 'task', kind: 'control', description: 'Responsible agent.' },
|
|
31
|
+
{ keyword: 'TASK HARNESS', aliases: [], scope: 'task', kind: 'control', description: 'Required execution harness.' },
|
|
32
|
+
{ keyword: 'TASK MODEL', aliases: [], scope: 'task', kind: 'control', description: 'Required model.' },
|
|
33
|
+
{ keyword: 'TASK THINKING LEVEL', aliases: [], scope: 'task', kind: 'control', description: 'Required reasoning/effort setting.' },
|
|
34
|
+
{ keyword: 'TASK PRIORITY', aliases: [], scope: 'task', kind: 'control', description: 'Nonnegative number or textual importance; higher first.' },
|
|
35
|
+
{ keyword: 'TASK AFTER', aliases: [], scope: 'task', kind: 'control', description: 'Inclusive earliest permitted start.' },
|
|
36
|
+
{ keyword: 'TASK DUE DATE', aliases: [], scope: 'task', kind: 'control', description: 'Desired completion deadline (not a start condition).' },
|
|
37
|
+
{ keyword: 'TASK DONE', aliases: [], scope: 'task', kind: 'repeatable-control', description: 'Completion stamp with explicit timezone.' },
|
|
38
|
+
{ keyword: 'TASK STATUS', aliases: [], scope: 'task', kind: 'control', description: '`todo`, `not-ready`, `failed` or `retired`.' },
|
|
39
|
+
{ keyword: 'TASK REPEAT', aliases: [], scope: 'task', kind: 'control', description: 'Positive fixed recurrence interval.' },
|
|
40
|
+
{ keyword: 'TASK DEPENDS ON', aliases: [], scope: 'task', kind: 'repeatable-control', description: 'Prerequisite task references.' },
|
|
41
|
+
{ keyword: 'TASK PARENT', aliases: [], scope: 'task', kind: 'control', description: 'Parent task reference (no implied ordering).' },
|
|
42
|
+
{ keyword: 'TASK RUNNER', aliases: [], scope: 'task', kind: 'repeatable-control', description: 'Opaque any-of routing selectors from Markdown.' },
|
|
43
|
+
{ keyword: 'TASK NOTE', aliases: [], scope: 'task', kind: 'instruction', description: 'Explanatory task metadata.' },
|
|
44
|
+
{ keyword: 'TASK ORIGIN', aliases: [], scope: 'task', kind: 'control', description: 'Provenance of the task.' },
|
|
45
|
+
];
|
|
46
|
+
/**
|
|
47
|
+
* Lookup from every accepted keyword spelling to its definition.
|
|
48
|
+
*/
|
|
49
|
+
const KEYWORD_LOOKUP = new Map(COMMITMENTS.flatMap((definition) => [definition.keyword, ...definition.aliases].map((keyword) => [keyword, definition])));
|
|
50
|
+
/**
|
|
51
|
+
* All keyword spellings, longest first (so `TASK AGENT` wins over `TASK`).
|
|
52
|
+
*/
|
|
53
|
+
const KEYWORDS_LONGEST_FIRST = [...KEYWORD_LOOKUP.keys()].sort((a, b) => b.length - a.length);
|
|
54
|
+
/**
|
|
55
|
+
* Recognizes a commitment at the beginning of a line.
|
|
56
|
+
*
|
|
57
|
+
* The keyword must be uppercase and complete: it is followed by whitespace or the end of the line.
|
|
58
|
+
*
|
|
59
|
+
* @private Book language
|
|
60
|
+
*/
|
|
61
|
+
export function matchCommitmentKeyword(line) {
|
|
62
|
+
for (const keyword of KEYWORDS_LONGEST_FIRST) {
|
|
63
|
+
if (!line.startsWith(keyword))
|
|
64
|
+
continue;
|
|
65
|
+
const rest = line.slice(keyword.length);
|
|
66
|
+
if (rest !== '' && !/^\s/.test(rest))
|
|
67
|
+
continue;
|
|
68
|
+
return { definition: KEYWORD_LOOKUP.get(keyword), written: keyword, content: rest.trim() };
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=commitments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commitments.js","sourceRoot":"","sources":["../../src/book/commitments.ts"],"names":[],"mappings":"AAqCA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAoC;IACxD,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,iCAAiC,EAAE;IAClI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,kDAAkD,EAAE;IAC7I,EAAE,OAAO,E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Appends a commitment line at the end of a Book, preserving everything else.
|
|
3
|
+
*
|
|
4
|
+
* @private Book language
|
|
5
|
+
*/
|
|
6
|
+
export declare function appendCommitment(source: string, keyword: string, value: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Sets a single-value control commitment: replaces the keyword line of its first occurrence (keeping continuation
|
|
9
|
+
* text) or appends it when absent.
|
|
10
|
+
*
|
|
11
|
+
* @private Book language
|
|
12
|
+
*/
|
|
13
|
+
export declare function setControlCommitment(source: string, keyword: string, value: string): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { parseBook } from './parse.js';
|
|
2
|
+
/**
|
|
3
|
+
* Joins lines with the source's newline style and guarantees exactly one trailing newline.
|
|
4
|
+
*/
|
|
5
|
+
function joinLines(lines, newline) {
|
|
6
|
+
const result = [...lines];
|
|
7
|
+
while (result.length && result[result.length - 1].trim() === '')
|
|
8
|
+
result.pop();
|
|
9
|
+
return result.join(newline) + newline;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Formats one commitment line.
|
|
13
|
+
*/
|
|
14
|
+
function commitmentLine(keyword, value) {
|
|
15
|
+
return value ? `${keyword} ${value}` : keyword;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Appends a commitment line at the end of a Book, preserving everything else.
|
|
19
|
+
*
|
|
20
|
+
* @private Book language
|
|
21
|
+
*/
|
|
22
|
+
export function appendCommitment(source, keyword, value) {
|
|
23
|
+
const document = parseBook(source);
|
|
24
|
+
const lines = [...document.lines];
|
|
25
|
+
while (lines.length && lines[lines.length - 1].trim() === '')
|
|
26
|
+
lines.pop();
|
|
27
|
+
const last = lines[lines.length - 1] ?? '';
|
|
28
|
+
const lastIsCommitment = document.commitments.some((commitment) => commitment.startLine === lines.length - 1);
|
|
29
|
+
if (lines.length && !lastIsCommitment && last.trim() !== '')
|
|
30
|
+
lines.push('');
|
|
31
|
+
lines.push(commitmentLine(keyword, value));
|
|
32
|
+
return joinLines(lines, document.newline);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sets a single-value control commitment: replaces the keyword line of its first occurrence (keeping continuation
|
|
36
|
+
* text) or appends it when absent.
|
|
37
|
+
*
|
|
38
|
+
* @private Book language
|
|
39
|
+
*/
|
|
40
|
+
export function setControlCommitment(source, keyword, value) {
|
|
41
|
+
const document = parseBook(source);
|
|
42
|
+
const existing = document.commitments.find((commitment) => commitment.keyword === keyword);
|
|
43
|
+
if (!existing)
|
|
44
|
+
return appendCommitment(source, keyword, value);
|
|
45
|
+
const lines = [...document.lines];
|
|
46
|
+
lines[existing.startLine] = commitmentLine(existing.written === keyword ? keyword : existing.written, value);
|
|
47
|
+
return joinLines(lines, document.newline);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../src/book/edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;GAEG;AACH,SAAS,SAAS,CAAC,KAAwB,EAAE,OAAe;IACxD,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,MAAM,CAAC,GAAG,EAAE,CAAC;IAC/E,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,OAAe,EAAE,KAAa;IAClD,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAAe,EAAE,KAAa;IAC3E,MAAM,QAAQ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CAAC,CAAC;IAClC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7G,OAAO,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type CommitmentDefinition } from './commitments.js';
|
|
2
|
+
/**
|
|
3
|
+
* A problem found while reading a Book, with its 1-based line.
|
|
4
|
+
*
|
|
5
|
+
* @private Book language
|
|
6
|
+
*/
|
|
7
|
+
export type BookDiagnostic = {
|
|
8
|
+
/** 1-based line number (0 when not line-specific). */
|
|
9
|
+
readonly line: number;
|
|
10
|
+
/** Human-readable explanation. */
|
|
11
|
+
readonly message: string;
|
|
12
|
+
/** Errors block use of the document; warnings are informational. */
|
|
13
|
+
readonly severity: 'error' | 'warning';
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* One commitment occurrence in a Book.
|
|
17
|
+
*
|
|
18
|
+
* @private Book language
|
|
19
|
+
*/
|
|
20
|
+
export type BookCommitment = {
|
|
21
|
+
/** Canonical keyword of the commitment (alias resolved). */
|
|
22
|
+
readonly keyword: string;
|
|
23
|
+
/** Keyword spelling written in the source. */
|
|
24
|
+
readonly written: string;
|
|
25
|
+
/** Definition of the commitment. */
|
|
26
|
+
readonly definition: CommitmentDefinition;
|
|
27
|
+
/** Content on the keyword's own line. */
|
|
28
|
+
readonly value: string;
|
|
29
|
+
/** Full content including continuation lines (trimmed). */
|
|
30
|
+
readonly body: string;
|
|
31
|
+
/** Continuation lines only (trimmed). */
|
|
32
|
+
readonly continuation: string;
|
|
33
|
+
/** 0-based index of the keyword line. */
|
|
34
|
+
readonly startLine: number;
|
|
35
|
+
/** 0-based index after the last continuation line. */
|
|
36
|
+
readonly endLine: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A parsed Book document.
|
|
40
|
+
*
|
|
41
|
+
* @private Book language
|
|
42
|
+
*/
|
|
43
|
+
export type BookDocument = {
|
|
44
|
+
/** Agent (name on first line), task (`TASK <title>`), empty or invalid document. */
|
|
45
|
+
readonly kind: 'agent' | 'task' | 'empty' | 'invalid';
|
|
46
|
+
/** Agent name or task title. */
|
|
47
|
+
readonly name: string;
|
|
48
|
+
/** 0-based index of the identifying first nonempty line. */
|
|
49
|
+
readonly headerLine: number;
|
|
50
|
+
/** Natural text between the header and the first commitment (trimmed). */
|
|
51
|
+
readonly intro: string;
|
|
52
|
+
/** Commitments in source order. */
|
|
53
|
+
readonly commitments: readonly BookCommitment[];
|
|
54
|
+
/** Problems found while reading. */
|
|
55
|
+
readonly diagnostics: readonly BookDiagnostic[];
|
|
56
|
+
/** Source lines (without line terminators). */
|
|
57
|
+
readonly lines: readonly string[];
|
|
58
|
+
/** Line terminator used by the source. */
|
|
59
|
+
readonly newline: '\n' | '\r\n';
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Reads a Book source: identifies the document kind and its commitments.
|
|
63
|
+
*
|
|
64
|
+
* Fenced literal content is preserved as text and never interpreted as commitments.
|
|
65
|
+
*
|
|
66
|
+
* @private Book language
|
|
67
|
+
*/
|
|
68
|
+
export declare function parseBook(source: string): BookDocument;
|
|
69
|
+
/**
|
|
70
|
+
* Returns all commitments of a canonical keyword.
|
|
71
|
+
*
|
|
72
|
+
* @private Book language
|
|
73
|
+
*/
|
|
74
|
+
export declare function commitmentsOf(document: BookDocument, keyword: string): BookCommitment[];
|
|
75
|
+
/**
|
|
76
|
+
* Returns the single effective value of a control commitment, reporting conflicting duplicates.
|
|
77
|
+
*
|
|
78
|
+
* @private Book language
|
|
79
|
+
*/
|
|
80
|
+
export declare function singleValue(document: BookDocument, keyword: string): {
|
|
81
|
+
value?: string;
|
|
82
|
+
commitment?: BookCommitment;
|
|
83
|
+
conflict?: BookDiagnostic;
|
|
84
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { matchCommitmentKeyword } from './commitments.js';
|
|
2
|
+
/**
|
|
3
|
+
* Detects a fence opener/closer (``` or ~~~).
|
|
4
|
+
*/
|
|
5
|
+
function fenceMarker(line) {
|
|
6
|
+
const match = /^\s{0,3}(`{3,}|~{3,})/.exec(line);
|
|
7
|
+
return match?.[1];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reads a Book source: identifies the document kind and its commitments.
|
|
11
|
+
*
|
|
12
|
+
* Fenced literal content is preserved as text and never interpreted as commitments.
|
|
13
|
+
*
|
|
14
|
+
* @private Book language
|
|
15
|
+
*/
|
|
16
|
+
export function parseBook(source) {
|
|
17
|
+
const newline = source.includes('\r\n') ? '\r\n' : '\n';
|
|
18
|
+
const text = source.startsWith('') ? source.slice(1) : source;
|
|
19
|
+
const lines = text.split(/\r?\n/);
|
|
20
|
+
const diagnostics = [];
|
|
21
|
+
const headerLine = lines.findIndex((line) => line.trim() !== '');
|
|
22
|
+
if (headerLine < 0) {
|
|
23
|
+
return { kind: 'empty', name: '', headerLine: -1, intro: '', commitments: [], diagnostics, lines, newline };
|
|
24
|
+
}
|
|
25
|
+
const header = lines[headerLine].trim();
|
|
26
|
+
let kind;
|
|
27
|
+
let name;
|
|
28
|
+
const headerMatch = matchCommitmentKeyword(header);
|
|
29
|
+
if (headerMatch && headerMatch.definition.keyword === 'TASK') {
|
|
30
|
+
kind = 'task';
|
|
31
|
+
name = headerMatch.content;
|
|
32
|
+
if (!name) {
|
|
33
|
+
kind = 'invalid';
|
|
34
|
+
diagnostics.push({ line: headerLine + 1, message: 'A task needs a nonempty title after `TASK`.', severity: 'error' });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else if (headerMatch && headerMatch.definition.scope !== 'agent' && headerMatch.definition.keyword.startsWith('TASK')) {
|
|
38
|
+
kind = 'invalid';
|
|
39
|
+
name = '';
|
|
40
|
+
diagnostics.push({ line: headerLine + 1, message: `\`${headerMatch.written}\` cannot start a Book; a task starts with \`TASK <title>\`.`, severity: 'error' });
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
kind = 'agent';
|
|
44
|
+
name = header;
|
|
45
|
+
}
|
|
46
|
+
const commitments = [];
|
|
47
|
+
const introLines = [];
|
|
48
|
+
let current;
|
|
49
|
+
let fence;
|
|
50
|
+
const close = (end) => {
|
|
51
|
+
if (!current)
|
|
52
|
+
return;
|
|
53
|
+
const continuation = current.continuation.join('\n').trim();
|
|
54
|
+
const body = [current.match.content, ...current.continuation].join('\n').trim();
|
|
55
|
+
commitments.push({
|
|
56
|
+
keyword: current.match.definition.keyword,
|
|
57
|
+
written: current.match.written,
|
|
58
|
+
definition: current.match.definition,
|
|
59
|
+
value: current.match.content,
|
|
60
|
+
body,
|
|
61
|
+
continuation,
|
|
62
|
+
startLine: current.start,
|
|
63
|
+
endLine: end,
|
|
64
|
+
});
|
|
65
|
+
current = undefined;
|
|
66
|
+
};
|
|
67
|
+
for (let index = headerLine + 1; index < lines.length; index++) {
|
|
68
|
+
const line = lines[index];
|
|
69
|
+
const marker = fenceMarker(line);
|
|
70
|
+
if (fence) {
|
|
71
|
+
if (marker && marker[0] === fence[0] && marker.length >= fence.length && line.trim() === marker)
|
|
72
|
+
fence = undefined;
|
|
73
|
+
}
|
|
74
|
+
else if (marker) {
|
|
75
|
+
fence = marker;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const match = matchCommitmentKeyword(line);
|
|
79
|
+
if (match) {
|
|
80
|
+
close(index);
|
|
81
|
+
current = { match, start: index, continuation: [] };
|
|
82
|
+
if (match.definition.keyword === 'TASK') {
|
|
83
|
+
diagnostics.push({
|
|
84
|
+
line: index + 1,
|
|
85
|
+
message: 'A later `TASK` line does not declare another task; only the first nonempty line identifies the document.',
|
|
86
|
+
severity: 'warning',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (current)
|
|
93
|
+
current.continuation.push(line);
|
|
94
|
+
else
|
|
95
|
+
introLines.push(line);
|
|
96
|
+
}
|
|
97
|
+
close(lines.length);
|
|
98
|
+
if (fence)
|
|
99
|
+
diagnostics.push({ line: lines.length, message: 'An unterminated fenced block runs to the end of the document.', severity: 'warning' });
|
|
100
|
+
for (const commitment of commitments) {
|
|
101
|
+
const scope = commitment.definition.scope;
|
|
102
|
+
if (kind === 'task' && scope === 'agent') {
|
|
103
|
+
diagnostics.push({ line: commitment.startLine + 1, message: `\`${commitment.written}\` is an agent commitment and has no meaning in a task.`, severity: 'warning' });
|
|
104
|
+
}
|
|
105
|
+
if (kind === 'agent' && scope === 'task') {
|
|
106
|
+
diagnostics.push({ line: commitment.startLine + 1, message: `\`${commitment.written}\` is a task commitment and has no meaning in an agent.`, severity: 'warning' });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return { kind, name, headerLine, intro: introLines.join('\n').trim(), commitments, diagnostics, lines, newline };
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Returns all commitments of a canonical keyword.
|
|
113
|
+
*
|
|
114
|
+
* @private Book language
|
|
115
|
+
*/
|
|
116
|
+
export function commitmentsOf(document, keyword) {
|
|
117
|
+
return document.commitments.filter((commitment) => commitment.keyword === keyword);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Returns the single effective value of a control commitment, reporting conflicting duplicates.
|
|
121
|
+
*
|
|
122
|
+
* @private Book language
|
|
123
|
+
*/
|
|
124
|
+
export function singleValue(document, keyword) {
|
|
125
|
+
const found = commitmentsOf(document, keyword);
|
|
126
|
+
if (found.length === 0)
|
|
127
|
+
return {};
|
|
128
|
+
const distinct = new Set(found.map((commitment) => commitment.value));
|
|
129
|
+
if (distinct.size > 1) {
|
|
130
|
+
return {
|
|
131
|
+
value: found[0].value,
|
|
132
|
+
commitment: found[0],
|
|
133
|
+
conflict: {
|
|
134
|
+
line: found[1].startLine + 1,
|
|
135
|
+
message: `\`${keyword}\` has conflicting values (${[...distinct].map((value) => `"${value}"`).join(', ')}).`,
|
|
136
|
+
severity: 'error',
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return { value: found[0].value, commitment: found[0] };
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/book/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAA6B,MAAM,kBAAkB,CAAC;AAgErF;;GAEG;AACH,SAAS,WAAW,CAAC,IAAY;IAC7B,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc;IACpC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,WAAW,GAAqB,EAAE,CAAC;IACzC,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACjE,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACjB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,E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C7B,OAAO,EAAE,KAAK,OAAO,8BAA8B,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;gBAC5G,QAAQ,EAAE,OAAO;aACpB;SACJ,CAAC;IACN,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine-supplied non-agents.
|
|
3
|
+
*
|
|
4
|
+
* @private Book language
|
|
5
|
+
*/
|
|
6
|
+
export type NonAgentName = 'Void' | 'User' | 'Expert';
|
|
7
|
+
/**
|
|
8
|
+
* Normalizes an agent name or reference for comparison.
|
|
9
|
+
*
|
|
10
|
+
* Case, diacritics and word separators (whitespace, underscores, hyphens) are ignored; the original spelling is
|
|
11
|
+
* preserved elsewhere for display.
|
|
12
|
+
*
|
|
13
|
+
* @private Book language
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeAgentName(name: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves a normalized name to a non-agent, if reserved.
|
|
18
|
+
*
|
|
19
|
+
* @private Book language
|
|
20
|
+
*/
|
|
21
|
+
export declare function nonAgentOf(normalized: string): NonAgentName | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* A parsed agent reference.
|
|
24
|
+
*
|
|
25
|
+
* @private Book language
|
|
26
|
+
*/
|
|
27
|
+
export type AgentReference = {
|
|
28
|
+
/** Exact source text, e.g. `@Developer` or `{Frontend Developer}`. */
|
|
29
|
+
readonly raw: string;
|
|
30
|
+
/** Name without reference syntax, e.g. `Frontend Developer`. */
|
|
31
|
+
readonly name: string;
|
|
32
|
+
/** Normalized comparison key. */
|
|
33
|
+
readonly normalized: string;
|
|
34
|
+
/** Offset in the scanned text. */
|
|
35
|
+
readonly index: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Parses a single dedicated reference field value (`@Name`, `{Name}` or a bare name, as in `FROM Adam`).
|
|
39
|
+
*
|
|
40
|
+
* Returns `undefined` for an empty or malformed value.
|
|
41
|
+
*
|
|
42
|
+
* @private Book language
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseReferenceValue(value: string): AgentReference | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Finds agent references (`@Token` and `{Name}`) in natural text, skipping fenced/inline code and email addresses.
|
|
47
|
+
*
|
|
48
|
+
* @private Book language
|
|
49
|
+
*/
|
|
50
|
+
export declare function findAgentReferences(text: string): AgentReference[];
|
|
51
|
+
/**
|
|
52
|
+
* Replaces fenced blocks and inline code spans with spaces so their content is never interpreted.
|
|
53
|
+
*
|
|
54
|
+
* @private Book language
|
|
55
|
+
*/
|
|
56
|
+
export declare function maskCode(text: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Formats an agent name as a reference (`@Name` for single tokens, `{Name}` otherwise).
|
|
59
|
+
*
|
|
60
|
+
* @private Book language
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatAgentReference(name: string): string;
|