pagegraph 0.13.0 → 0.14.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 (80) hide show
  1. package/README.md +48 -41
  2. package/dist/anthropic-messages-TqKpKmfW.js +1067 -0
  3. package/dist/anthropic-messages-TqKpKmfW.js.map +1 -0
  4. package/dist/audit.d.ts +2 -0
  5. package/dist/audit.js +1 -1
  6. package/dist/audit.js.map +1 -1
  7. package/dist/azure-openai-responses-DJjBLwoI.js +231 -0
  8. package/dist/azure-openai-responses-DJjBLwoI.js.map +1 -0
  9. package/dist/cli.js +10487 -38044
  10. package/dist/cli.js.map +1 -1
  11. package/dist/cloudflare-workers-ai-system-one-f3ZrvNYZ.js +41 -0
  12. package/dist/cloudflare-workers-ai-system-one-f3ZrvNYZ.js.map +1 -0
  13. package/dist/config.d.ts +6 -6
  14. package/dist/config.js.map +1 -1
  15. package/dist/diagnostics-Wt5faNDM.js +108 -0
  16. package/dist/diagnostics-Wt5faNDM.js.map +1 -0
  17. package/dist/dist-cFoAzruL.js +4794 -0
  18. package/dist/dist-cFoAzruL.js.map +1 -0
  19. package/dist/env-api-keys-C-OA0yM-.js +124 -0
  20. package/dist/env-api-keys-C-OA0yM-.js.map +1 -0
  21. package/dist/error-body-CyiejW4b.js +103 -0
  22. package/dist/error-body-CyiejW4b.js.map +1 -0
  23. package/dist/github-copilot-headers-CEpMOpQF.js +24 -0
  24. package/dist/github-copilot-headers-CEpMOpQF.js.map +1 -0
  25. package/dist/google-generative-ai-BxABKIKO.js +330 -0
  26. package/dist/google-generative-ai-BxABKIKO.js.map +1 -0
  27. package/dist/google-shared-0gpM2jFi.js +19471 -0
  28. package/dist/google-shared-0gpM2jFi.js.map +1 -0
  29. package/dist/google-vertex-D8Eb5cbu.js +376 -0
  30. package/dist/google-vertex-D8Eb5cbu.js.map +1 -0
  31. package/dist/hash-Dp7EzZUo.js +18 -0
  32. package/dist/hash-Dp7EzZUo.js.map +1 -0
  33. package/dist/headers-BRNMVpzu.js +19 -0
  34. package/dist/headers-BRNMVpzu.js.map +1 -0
  35. package/dist/json-parse-C10znB7l.js +383 -0
  36. package/dist/json-parse-C10znB7l.js.map +1 -0
  37. package/dist/mistral-conversations-CvaqBWjR.js +690 -0
  38. package/dist/mistral-conversations-CvaqBWjR.js.map +1 -0
  39. package/dist/models-DcT5qOEL.js +1203 -0
  40. package/dist/models-DcT5qOEL.js.map +1 -0
  41. package/dist/node-Ccvru9GE.js +26 -0
  42. package/dist/node-Ccvru9GE.js.map +1 -0
  43. package/dist/node-MEosBOF2.js +2403 -0
  44. package/dist/node-MEosBOF2.js.map +1 -0
  45. package/dist/openai-BCBEd2eO.js +17350 -0
  46. package/dist/openai-BCBEd2eO.js.map +1 -0
  47. package/dist/openai-codex-responses-vJqxeeRC.js +1268 -0
  48. package/dist/openai-codex-responses-vJqxeeRC.js.map +1 -0
  49. package/dist/openai-completions-Cb_fRAbI.js +989 -0
  50. package/dist/openai-completions-Cb_fRAbI.js.map +1 -0
  51. package/dist/openai-prompt-cache-Bc6qNWt0.js +10 -0
  52. package/dist/openai-prompt-cache-Bc6qNWt0.js.map +1 -0
  53. package/dist/openai-responses-sDuh82G5.js +268 -0
  54. package/dist/openai-responses-sDuh82G5.js.map +1 -0
  55. package/dist/openai-responses-shared-mhuo1Jov.js +599 -0
  56. package/dist/openai-responses-shared-mhuo1Jov.js.map +1 -0
  57. package/dist/openrouter-images-CRmBkzpX.js +127 -0
  58. package/dist/openrouter-images-CRmBkzpX.js.map +1 -0
  59. package/dist/pi-D3mMmYey.js +56805 -0
  60. package/dist/pi-D3mMmYey.js.map +1 -0
  61. package/dist/pi-messages-CejiVYvO.js +308 -0
  62. package/dist/pi-messages-CejiVYvO.js.map +1 -0
  63. package/dist/provider-env-t38GK5FF.js +39 -0
  64. package/dist/provider-env-t38GK5FF.js.map +1 -0
  65. package/dist/provider-retry-DzKoh1X7.js +80 -0
  66. package/dist/provider-retry-DzKoh1X7.js.map +1 -0
  67. package/dist/rolldown-runtime-B-lAHAz2.js +37 -0
  68. package/dist/sanitize-unicode-Ds14l9Om.js +28 -0
  69. package/dist/sanitize-unicode-Ds14l9Om.js.map +1 -0
  70. package/dist/sdk-C9_wiO6w.js +12503 -0
  71. package/dist/sdk-C9_wiO6w.js.map +1 -0
  72. package/dist/state-BuJP_3Lr.js +28102 -0
  73. package/dist/state-BuJP_3Lr.js.map +1 -0
  74. package/dist/system-one-shared-Dl10ZF7Z.js +167 -0
  75. package/dist/system-one-shared-Dl10ZF7Z.js.map +1 -0
  76. package/dist/transform-messages-BLJ8EfK6.js +468 -0
  77. package/dist/transform-messages-BLJ8EfK6.js.map +1 -0
  78. package/dist/typesafe-system-one-CwEWMV8P.js +25 -0
  79. package/dist/typesafe-system-one-CwEWMV8P.js.map +1 -0
  80. package/package.json +4 -8
package/README.md CHANGED
@@ -222,21 +222,14 @@ instead of crashing on a native binding when a request first runs the code. The
222
222
  have **zero runtime dependencies** beyond their listed peers; a test pins each entry's import
223
223
  graph.
224
224
 
225
- The CLI **bundles PageGraph's Effect and TypeSafe provider runtime**, so it does not depend on the
226
- app's Effect version; it runs on [Bun](https://bun.sh) (`bunx pagegraph`). Agentic workflows load the
227
- OpenCode SDK only when invoked. The first workflow installs pinned OpenCode 2.0.22 into
228
- `~/.cache/pagegraph/opencode-2.0.22-2`, outside the app's dependency tree; subsequent workflows
229
- reuse the verified cache. This keeps consumer dependency overrides away from OpenCode's declared
230
- Effect and Drizzle versions. Executor plugins must use OpenCode's Effect version (`4.0.0-rc.112`).
231
- Bun and network access to npm are required for the first install. The pinned OpenCode client's
232
- HTTP error handling retains the method, path, status, and response body for diagnostics;
233
- undeclared error bodies are capped at 16 KiB.
234
- Discovery-only research gets one continuation to complete provider evidence. Every workflow failure
235
- after run creation writes `failure.json` in the run directory, with the stage, session ID when available,
236
- transcript, and cause chain. `vite` stays a peer — graph commands
237
- load your app through Vite at runtime — and `lighthouse` is only needed by `pagegraph audit`.
238
- Importing `pagegraph/audit` programmatically needs `effect@^4.0.0`. The Effect and TypeSafe
239
- peers remain optional for other library entry points and the bundled CLI.
225
+ The CLI **bundles PageGraph's Effect, TypeSafe provider runtime, and Pi agent runtime**, so it does
226
+ not depend on the app's Effect version; it runs on [Bun](https://bun.sh) (`bunx pagegraph`). Every
227
+ workflow runs in-process on Pi 1.0.0. Improve workflows use guarded repository edit tools;
228
+ research and dry-run actions expose only read tools. Every workflow failure after run creation
229
+ writes `failure.json` with its stage, agent messages, and cause chain. `vite` stays a peer — graph commands load your app through Vite at
230
+ runtime — and `lighthouse` is only needed by `pagegraph audit`. Importing `pagegraph/audit`
231
+ programmatically needs `effect@^4.0.0`. The Effect and TypeSafe peers remain optional for other
232
+ library entry points and the bundled CLI.
240
233
 
241
234
  ### Agent skill
242
235
 
@@ -400,17 +393,26 @@ Preview hosts (`indexable: false`) drop `contentSignal` and `directives`;
400
393
 
401
394
  ## Agentic workflows
402
395
 
403
- PageGraph can combine the deterministic route graph with a project-owned embedded OpenCode agent,
404
- live tools exposed by an Executor plugin, and Jev decisions. Scaffold the OpenCode preset once:
396
+ PageGraph combines the deterministic route graph with project-owned agent instructions, live
397
+ Executor tools, and Jev decisions. Every workflow uses Pi in-process. Scaffold the shared preset once:
405
398
 
406
399
  ```bash
407
400
  pagegraph init
408
401
  ```
409
402
 
410
- The generated `.pagegraph/opencode` directory contains one `seo` agent and customizable `content`,
411
- `technical`, and `authority` skills. Add your Executor plugin to its `opencode.jsonc`; OpenCode and
412
- the plugin own model and Executor authentication. PageGraph does not copy credentials or assume
413
- fixed provider-tool addresses.
403
+ The generated `.pagegraph/agent` directory contains the `seo` agent instructions, `AGENTS.md`,
404
+ and customizable workflow skills with Executor recipes. Pi composes these files into its system
405
+ prompt and fails if a required file is missing. Pi uses its provider-specific environment variables
406
+ for model authentication, such as `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`.
407
+
408
+ Research connects to [Executor](https://github.com/RhysSullivan/executor) through
409
+ `@pi-ext/executor`. Set `EXECUTOR_BASE_URL` to the server, plus `EXECUTOR_CLIENT_ID[_FILE]` and
410
+ `EXECUTOR_CLIENT_SECRET[_FILE]` when Cloudflare Access fronts it (both or neither). Every workflow
411
+ declines Executor approval requests, and only provider calls that succeeded count as evidence.
412
+ Use `executor_search` to discover tools and their TypeScript shapes, then `executor_execute` with
413
+ a TypeScript snippet calling `tools.<namespace>.<tool>(input)` and a top-level `return`.
414
+ Repository tools are `read_file`, `list_files`, and `search_text`; structured results go through
415
+ `submit_result`. Improve action turns expose `edit_file` and `write_file` in write mode.
414
416
 
415
417
  Enable workflows in `pagegraph.config.ts`:
416
418
 
@@ -418,10 +420,10 @@ Enable workflows in `pagegraph.config.ts`:
418
420
  export default defineSeoConfig({
419
421
  // origin, disallow, and loadGraph as above
420
422
  workflows: {
421
- opencode: {
422
- configDirectory: ".pagegraph/opencode",
423
+ agent: {
424
+ presetDirectory: ".pagegraph/agent",
423
425
  defaultModel: "openrouter/example/model",
424
- // Optional per-completion budget in milliseconds; default 180000.
426
+ // Optional per-turn budget in milliseconds; default 180000.
425
427
  timeoutMs: 360_000,
426
428
  models: {
427
429
  "research.keywords": "openrouter/example/research-model",
@@ -452,9 +454,9 @@ Executor's live catalog and inspect the discovered tools' argument schemas, then
452
454
  structured observations with Jev. Tool paths are discovered at runtime; the generated skills contain
453
455
  editable starter recipes, not a fixed integration list.
454
456
 
455
- `workflows.opencode.timeoutMs` sets the positive integer deadline in milliseconds for each OpenCode
456
- completion (maximum `2147483647`). It covers prompt admission, model execution, and any workflow JSON
457
- repair prompt. A later action or continuation turn gets a separate budget. The default is `180000`.
457
+ `workflows.agent.timeoutMs` sets the positive integer deadline in milliseconds for each Pi research or action turn
458
+ (maximum `2147483647`, default `180000`). Research and action share the same agent conversation,
459
+ so action turns retain the research context.
458
460
 
459
461
  Selecting pages preserves their incoming and outgoing relationships to non-selected pages in
460
462
  `evidence.neighborhood`. Those neighbors supply architecture context without becoming workflow
@@ -462,12 +464,13 @@ targets or consuming `--limit`. The agent receives the limit before research, an
462
464
  the decoded result before decisions.
463
465
 
464
466
  After research is validated, the run directory contains `research.json`: an incomplete checkpoint
465
- with the collected evidence, decision inputs, and OpenCode transcript. A downstream failure reports
466
- its path so the evidence remains available for diagnosis. Only a completed workflow writes
467
+ with the collected evidence, decision inputs, and agent messages. A downstream failure
468
+ reports its path so the evidence remains available for diagnosis. Only a completed workflow writes
467
469
  `run.json` and `summary.md`; a research checkpoint is not a final recommendation.
468
- Model JSON drops null properties and array elements before validation. Schema validation collects all
469
- issues for one read-only repair turn. Every error after run creation writes `failure.json` in that
470
- run directory with the workflow, stage, available OpenCode session ID, transcript, and full cause
470
+ Model results drop null properties and array elements before validation. Pi receives decode issues
471
+ and missing Executor evidence through `submit_result`, so it can correct the result in the same
472
+ agent loop; repeated rejected submissions fail the run. Every error after run creation writes
473
+ `failure.json` with the workflow, stage, agent messages, and full cause
471
474
  chain. The error reports the artifact path and a next step; a failed artifact write preserves the
472
475
  original error with a note.
473
476
 
@@ -486,20 +489,24 @@ original error with a note.
486
489
  | `improve links` | Contextual internal-link edits from graph and page evidence |
487
490
 
488
491
  The common selectors are repeatable `--page`, `--query`, and `--kind`, plus `--limit`, `--market`,
489
- `--language`, `--refresh`, `--model`, `--opencode-config`, and `--out`. Relevant workflows also
490
- accept `--competitor`, `--domain`, or `--device desktop|mobile`. Workflows are noninteractive and
491
- fail immediately if the agent asks a question or requests permission.
492
+ `--language`, `--refresh`, `--model`, `--preset-directory`, and `--out`. Relevant workflows also
493
+ accept `--competitor`, `--domain`, or `--device desktop|mobile`. Workflow prompts direct the agent
494
+ to proceed without questions or forms and fail clearly when required input is missing.
492
495
 
493
496
  The four `improve` workflows write source files by default and require a clean Git tree. Use
494
- `--dry-run` to keep repository edit and shell tools disabled, or `--allow-dirty` when you explicitly
497
+ `--dry-run` to expose only read tools, or `--allow-dirty` when you explicitly
495
498
  want the agent to edit alongside existing changes. PageGraph leaves every diff uncommitted and
496
- records modified, added, and deleted files after the workflow finishes.
499
+ records modified, added, and deleted files after the workflow finishes. Write tools reject paths
500
+ outside the repository, including symlink escapes, and paths under `.git`, `node_modules`,
501
+ the runs directory, and the preset directory. There is no shell tool. For `improve links`,
502
+ `fetch_page` reads extracted sentences from served pages on suggestion-report origins, respecting
503
+ robots rules and the response size limit.
497
504
 
498
505
  Each run writes `.pagegraph/runs/<run-id>/run.json` and `summary.md`. The JSON retains the
499
- deterministic graph, context, complete OpenCode session export, Executor tool evidence, Jev question
500
- definitions and answers, Git provenance, changed files, and model provenance. Keep this directory
501
- ignored: provider output can be large or account-specific. Workflows fail when the configured model,
502
- active Executor plugin, catalog search plus discovered tool call, or `TYPESAFE_API_KEY` for Jev is
506
+ deterministic graph, context, Executor tool evidence, Jev question definitions and answers, Git
507
+ provenance, changed files, and model provenance. Schema-version-2 artifacts record `agent.runtime`
508
+ as the literal `pi`, with messages and usage. Keep this directory ignored: provider output can be large or account-specific. Workflows fail when the configured model,
509
+ Executor toolset, catalog search plus completed tool call, or `TYPESAFE_API_KEY` for Jev is
503
510
  unavailable.
504
511
 
505
512
  ## Typed paths