imprint-mcp 0.6.5 → 0.7.0

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 (107) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +278 -16
  3. package/package.json +2 -2
  4. package/prompts/audit-agent.md +28 -7
  5. package/prompts/auth-compile-agent.md +65 -7
  6. package/prompts/build-planning.md +3 -3
  7. package/prompts/compile-agent.md +922 -183
  8. package/prompts/live-verifier-agent.md +25 -8
  9. package/prompts/master-teach-api-researcher.md +813 -0
  10. package/prompts/master-teach-baseline-mvp-review.md +217 -0
  11. package/prompts/master-teach-completion-review.md +188 -0
  12. package/prompts/master-teach-decision.md +885 -0
  13. package/prompts/master-teach-focused-planner.md +764 -0
  14. package/prompts/master-teach-parameter-advisor.md +58 -0
  15. package/prompts/master-teach-recording-evidence.md +19 -0
  16. package/prompts/master-teach-refine-plan.md +7 -0
  17. package/prompts/master-teach-tool-advisor.md +130 -0
  18. package/prompts/playbook-compilation.md +45 -54
  19. package/prompts/prereq-builder.md +28 -6
  20. package/prompts/prereq-planner.md +2 -2
  21. package/prompts/request-triage.md +51 -9
  22. package/prompts/tool-candidate-detection.md +75 -38
  23. package/prompts/tool-planning.md +3 -3
  24. package/src/cli.ts +197 -151
  25. package/src/imprint/agent.ts +47 -33
  26. package/src/imprint/api-research-agent.ts +933 -0
  27. package/src/imprint/audit.ts +72 -7
  28. package/src/imprint/auth-compile-agent.ts +136 -62
  29. package/src/imprint/auth-compile-tools.ts +99 -18
  30. package/src/imprint/auth-verifier.ts +10 -20
  31. package/src/imprint/backend-ladder.ts +517 -365
  32. package/src/imprint/body-structure.ts +656 -0
  33. package/src/imprint/build-plan.ts +54 -323
  34. package/src/imprint/cdp-browser-fetch.ts +734 -29
  35. package/src/imprint/cdp-jar-cache.ts +7 -12
  36. package/src/imprint/claude-cli-compile.ts +283 -321
  37. package/src/imprint/codex-cli-compile.ts +482 -350
  38. package/src/imprint/codex-sdk-turn.ts +102 -0
  39. package/src/imprint/compile-agent-types.ts +49 -10
  40. package/src/imprint/compile-agent.ts +222 -266
  41. package/src/imprint/compile-done-sentinel.ts +211 -0
  42. package/src/imprint/compile-provider-control.ts +401 -0
  43. package/src/imprint/compile-provider-recovery.ts +142 -0
  44. package/src/imprint/compile-strategy.ts +5 -0
  45. package/src/imprint/compile-tools.ts +1901 -3020
  46. package/src/imprint/compile-verification.ts +20 -3
  47. package/src/imprint/compile.ts +391 -84
  48. package/src/imprint/compiler-log.ts +12 -0
  49. package/src/imprint/compiler-process.ts +440 -0
  50. package/src/imprint/concurrency.ts +43 -58
  51. package/src/imprint/credential-extract.ts +1 -88
  52. package/src/imprint/effects.ts +9 -0
  53. package/src/imprint/emit.ts +18 -2
  54. package/src/imprint/evidence-inspection.ts +55 -0
  55. package/src/imprint/freeform-redact.ts +34 -234
  56. package/src/imprint/import-module-fresh.ts +30 -0
  57. package/src/imprint/live-finesse-runner.ts +299 -0
  58. package/src/imprint/live-verifier.ts +726 -364
  59. package/src/imprint/llm.ts +466 -422
  60. package/src/imprint/log.ts +1 -9
  61. package/src/imprint/login.ts +30 -12
  62. package/src/imprint/master-teach-agent-contracts.ts +875 -0
  63. package/src/imprint/master-teach-agents.ts +2850 -0
  64. package/src/imprint/master-teach-checks.ts +341 -0
  65. package/src/imprint/master-teach-controller.ts +7159 -0
  66. package/src/imprint/master-teach-plan.ts +1410 -0
  67. package/src/imprint/master-teach-prompt-projections.ts +347 -0
  68. package/src/imprint/master-teach-store.ts +961 -0
  69. package/src/imprint/mcp-cdp-sessions.ts +60 -0
  70. package/src/imprint/mcp-compile-server.ts +564 -662
  71. package/src/imprint/mcp-live-verifier-server.ts +267 -178
  72. package/src/imprint/mcp-server.ts +46 -57
  73. package/src/imprint/native-agent-pass.ts +260 -0
  74. package/src/imprint/native-agent-usage.ts +141 -0
  75. package/src/imprint/native-teach-agents.ts +495 -0
  76. package/src/imprint/param-grounding.ts +488 -347
  77. package/src/imprint/playbook-runner.ts +254 -63
  78. package/src/imprint/prereq-builder.ts +55 -543
  79. package/src/imprint/private-file.ts +18 -0
  80. package/src/imprint/probe-backends.ts +135 -33
  81. package/src/imprint/provider-retry.ts +501 -0
  82. package/src/imprint/provider-terminal.ts +214 -0
  83. package/src/imprint/recording-request.ts +297 -3
  84. package/src/imprint/recording-verification.ts +444 -0
  85. package/src/imprint/redact.ts +33 -749
  86. package/src/imprint/refine-worker.ts +326 -0
  87. package/src/imprint/refine.ts +241 -0
  88. package/src/imprint/replay-capture.ts +85 -37
  89. package/src/imprint/replay-evidence.ts +1007 -0
  90. package/src/imprint/request-capture.ts +14 -0
  91. package/src/imprint/research-response-evidence.ts +45 -0
  92. package/src/imprint/runtime.ts +616 -128
  93. package/src/imprint/sensitive-keys.ts +0 -6
  94. package/src/imprint/session-merge.ts +103 -7
  95. package/src/imprint/stealth-fetch.ts +25 -8
  96. package/src/imprint/stealth-token-cache.ts +16 -16
  97. package/src/imprint/teach-plan.ts +0 -242
  98. package/src/imprint/teach-research-memory.ts +229 -0
  99. package/src/imprint/teach-state.ts +47 -626
  100. package/src/imprint/teach.ts +12 -3477
  101. package/src/imprint/tool-candidates.ts +75 -210
  102. package/src/imprint/tool-loader.ts +3 -0
  103. package/src/imprint/tool-plan.ts +3 -134
  104. package/src/imprint/tracing.ts +24 -7
  105. package/src/imprint/triage-selection.ts +44 -0
  106. package/src/imprint/types.ts +107 -7
  107. package/src/imprint/endpoint-key.ts +0 -23
@@ -87,7 +87,7 @@ You receive:
87
87
 
88
88
  1. **Emit exactly one `perTool` entry per `selectedTools` entry**, using the same `toolName`. Do not invent or drop tools.
89
89
  2. **Only hoist a shared module when ≥2 selected tools genuinely share it.** Single-use logic stays inside that tool's own parser.ts / request-transform.ts — do NOT create a `_shared/` module for it.
90
- 3. **`request-transform`** — URL signing or body construction shared across tools. Wire-up: the consuming tool sets `requestTransformModule: "../_shared/<name>.ts"`. Ground it in `ephemeralValues` (browser_minted, high-entropy query param) and `sourceSeqs`. The exported `transform(method, url, responses, params?)` returns the signed URL (or `{ url?, body?, headers?, skip? }`).
90
+ 3. **`request-transform`** — request preparation shared across tools. Wire-up: the consuming tool sets `requestTransformModule: "../_shared/<name>.ts"`. Ground it in exact recorded request/response evidence and `sourceSeqs`. The exported `transform(method, url, responses, params?)` returns either a body string or `{ url?, body?, headers?, navigation?, skip? }`, matching the runtime contract.
91
91
  4. **`parser-helper`** — a decoder/normalizer ≥2 tools' parsers call (e.g. a shared JSPB walker, a shared field mapper). The consuming tool's parser.ts does `import { ... } from '../_shared/<name>.ts'`. Ground it in a captured response body (`sourceSeqs`).
92
92
  5. **`types`** — shared TypeScript interfaces used by ≥2 parsers. Type-only; no runtime behavior.
93
93
  6. **Auth is NEVER a shared module.** When `sharedContext.authRequestSeqs` or
@@ -101,8 +101,8 @@ You receive:
101
101
  7. **`exportSignatures` must be real TypeScript signatures** the builder will implement and the verifier will check for. List every public export.
102
102
  8. **`spec` must be concrete enough to implement and test** — name the inputs, the exact output, and the `sourceSeqs` that prove it (e.g. "given the URL at seq 41 with the `sig` param stripped, regenerate `sig` to match the recorded value").
103
103
  9. **`dependsOn` only references other `sharedModules[].path`.** No cycles.
104
- 10. **Be conservative.** Never invent a module without grounding `sourceSeqs`. If unsure whether two tools truly share logic, leave it per-tool (empty `sharedModules`, empty `usesSharedModules`). A wrong shared module forces every assigned tool to import code that doesn't fit. Fewer, well-grounded modules beat many speculative ones.
105
- 11. `paramChecklist` mirrors the candidate's `likelyParams` names — the inputs each tool must template as `${param.NAME}`.
104
+ 10. **Be conservative.** Never invent a module without grounding `sourceSeqs`. If unsure whether two tools truly share logic, leave it per-tool (empty `sharedModules`, empty `usesSharedModules`). These are advisory module proposals for the master to consider, not host-enforced import assignments. Fewer, well-grounded modules beat many speculative ones.
105
+ 11. `paramChecklist` is your evidence-backed proposal for the public inputs worth investigating during focused compilation. It may add, rename, or drop candidate `likelyParams`; the detector list is not authoritative.
106
106
  12. **Producer-derived chains (`emitsTokens` / `tokenParams`).** When one tool's param is an opaque id/token OR another context value a caller cannot type reliably — because its value is minted/derived by ANOTHER selected tool's response (a `search_*` → `get_*_details` chain) — model it as a cross-tool compatibility target instead of asking the caller/auditor to fabricate it. An `emitsTokens` entry does not redefine the producer's core success: useful producer records and input classes remain valid when an optional downstream token is unavailable, provided compilation records the missing output and affected consumers as a limitation. Start from `tokenContractHints[]` (each entry is a pre-detected edge you MUST declare), and also catch any the diff missed (`ephemeralValues` with a `server_derived` `producerSeq` belonging to a different tool's `requestSeqs`, or a `dependencySeqs` link):
107
107
  - On the CONSUMER, add `tokenParams: [{ param, sourceTool, sourceField }]` — the param's value comes from `sourceTool`'s `sourceField` output, used as-is.
108
108
  - On the PRODUCER (`sourceTool`), add `emitsTokens: [{ field, shape }]` so its parser uses that exact `field` and emits the full shape when the response supplies it (e.g. a composite of id + area context), never a bare or fabricated fragment. If some useful result class lacks the field, preserve that class and require an explicit producer limitation; leave affected consumers limited/unverified rather than narrowing the producer merely to make the chain total.