@minicor/mcp-server 4.8.0 → 4.9.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 (37) hide show
  1. package/README.md +82 -3
  2. package/dist/__live__/blueprints.live.test.d.ts +2 -0
  3. package/dist/__live__/blueprints.live.test.d.ts.map +1 -0
  4. package/dist/__live__/blueprints.live.test.js +610 -0
  5. package/dist/__live__/blueprints.live.test.js.map +1 -0
  6. package/dist/__tests__/blueprints-tools.test.d.ts +2 -0
  7. package/dist/__tests__/blueprints-tools.test.d.ts.map +1 -0
  8. package/dist/__tests__/blueprints-tools.test.js +1190 -0
  9. package/dist/__tests__/blueprints-tools.test.js.map +1 -0
  10. package/dist/__tests__/jobs-tools.test.js +76 -0
  11. package/dist/__tests__/jobs-tools.test.js.map +1 -1
  12. package/dist/__tests__/server-surface.test.js +19 -0
  13. package/dist/__tests__/server-surface.test.js.map +1 -1
  14. package/dist/bootstrap-perms.d.ts +12 -0
  15. package/dist/bootstrap-perms.d.ts.map +1 -0
  16. package/dist/bootstrap-perms.js +92 -0
  17. package/dist/bootstrap-perms.js.map +1 -0
  18. package/dist/bootstrap.js +2 -63
  19. package/dist/bootstrap.js.map +1 -1
  20. package/dist/middleware-service-client.d.ts +286 -0
  21. package/dist/middleware-service-client.d.ts.map +1 -1
  22. package/dist/middleware-service-client.js +143 -1
  23. package/dist/middleware-service-client.js.map +1 -1
  24. package/dist/server-surface.d.ts.map +1 -1
  25. package/dist/server-surface.js +26 -1
  26. package/dist/server-surface.js.map +1 -1
  27. package/dist/sync.js +5 -2
  28. package/dist/sync.js.map +1 -1
  29. package/dist/tools/blueprints.d.ts +20 -0
  30. package/dist/tools/blueprints.d.ts.map +1 -0
  31. package/dist/tools/blueprints.js +1193 -0
  32. package/dist/tools/blueprints.js.map +1 -0
  33. package/dist/tools/jobs.d.ts.map +1 -1
  34. package/dist/tools/jobs.js +57 -5
  35. package/dist/tools/jobs.js.map +1 -1
  36. package/package.json +2 -1
  37. package/skills/general/blueprint-vm-walkthrough.md +162 -0
package/README.md CHANGED
@@ -296,15 +296,65 @@ After a successful build:
296
296
  - Skills are stored per-workspace and available to future builds
297
297
  - Customer-specific quirks become reusable knowledge
298
298
 
299
+ ## Blueprints (the spec front door)
300
+
301
+ A **Blueprint** is the living spec + context library that owns a job. Instead of hand-writing a job definition, you feed the blueprint's library (SOPs, Loom videos, notes, transcripts, VM walkthrough sessions), let the service synthesize a spec proposal, review and apply it, then `blueprint_build` syncs the spec into a Job and hands the jobs toolset its coordinates (`middlewareId`/`routeId`/`buildId`). One ownership rule: when a route is blueprint-linked, never `register_job` / `update_job` / `add_test_case` on it directly - that trips reverse-drift detection (state `job_ahead`). Drive changes through the spec.
302
+
303
+ ### The blueprint tools
304
+
305
+ | Tool | What it does |
306
+ | --- | --- |
307
+ | `resolve_blueprint_state` | The first call to make when working a blueprint (the sibling of `resolve_job_state`, one layer up). One call fetches the blueprint (state + drift + proposal + open questions), the library's enrichment status, and the linked build run, then returns an unfolded state (`no_context` / `enriching` / `no_spec` / `proposal_pending` / `needs_answers` / `building` / `needs_input` / `build_failed` / `job_ahead` / `spec_stale` / `job_stale` / `in_sync` - every state maps to one verb), `blockers[]` (enrichment failures, a stalled builder, questions needing a human), and ordered `nextActions` with the concrete tool calls prefilled. |
308
+ | `blueprint_list` | List a workspace's blueprints: id, name, computed state, drift flags, and the linked job coordinates. For any blueprint not `in_sync`, call `resolve_blueprint_state` on it and follow `nextActions`. |
309
+ | `blueprint_create` | Create a blueprint. Two entry paths: create empty and feed the library (new automation), or pass `routeId` + `middlewareId` to link an existing job (backfill) - `blueprint_import_cases` then adopts its test cases into the spec. |
310
+ | `blueprint_get` | Get a blueprint: the full spec document, computed state, both drift summaries, and the inbox (`document.openQuestions` + `pendingProposal`). `headVersion` here is the `baseVersion` for `blueprint_update`'s CAS. |
311
+ | `blueprint_update` | Edit the spec directly: `document` replaces wholesale, `patch` is a section-level merge. Document edits require `baseVersion` (compare-and-swap: a 409 means the blueprint moved past your read - re-read and re-author, never retry blindly). Prefer the synthesize -> apply path for library-derived changes; direct edits are for surgical fixes. |
312
+ | `blueprint_add_entry` | Add (or, with `entryId`, update) a library entry. Context kinds (doc/video/url/note/transcript/data-source/walkthrough) feed synthesis; resource kinds (screen-map/anchor/screenshot) are runtime-referenceable as `entry://<id>#<fragment>`. Enrichable kinds start `pending` and are enriched to text by a worker. Every write bumps `librarySeq`, so the spec goes `spec_stale` until the next synthesize. |
313
+ | `blueprint_list_entries` | List a blueprint's library entries with enrichment status (`pending`/`processing` means the worker is still on it; `failed` carries the reason), or one entry via `entryId` (`revisions: true` adds its immutable history, `downloadUrl: true` adds a signed read URL for the uploaded blob). |
314
+ | `blueprint_entry_upload_url` | Get a short-lived signed upload URL for a file that will become a library entry: returns `{ uploadUrl, blobRef, expiresOn }`; PUT the bytes (plain PUT with the file's Content-Type - works from inside a VM via `vm_execute_script`), then `blueprint_add_entry` with the returned `gs://` `blobRef`. |
315
+ | `blueprint_synthesize` | Synthesize a spec proposal from the library (LLM). Produces ONE pending proposal for review - never applied silently. Answer all open questions first so one synthesis folds every answer in. Blocked responses are structured: `proposal_pending`, `entries_enriching`, `llm_unconfigured`, `library_empty`, plus retryable LLM-leg failures. |
316
+ | `blueprint_get_proposal` | Read the pending proposal for review: the section-level patch, regenerated SOP, summary, and per-claim citations (provenance `extracted`/`inferred`/`ambiguous` - scrutinize the latter two). Returns the exact apply coordinates (`baseVersion` + `basedOnSeq`). |
317
+ | `blueprint_apply_proposal` | Apply the reviewed proposal as one validated, version-snapshotted document update. Requires the reviewed proposal's `baseVersion` + `proposalBasedOnSeq`: the service atomically refuses (409 `proposal_mismatch`) if a concurrent resynthesize swapped the proposal after your review. After a successful apply the job is stale - `blueprint_build` is the next verb. |
318
+ | `blueprint_reject_proposal` | Discard the pending proposal (bad synthesis, or the spec moved underneath it). A 404 is success-shaped: someone else already applied or rejected it. Follow with `blueprint_synthesize`, optionally with steering `instructions`. |
319
+ | `blueprint_answer_question` | Answer ONE open synthesis question atomically: removed from `openQuestions`, stored as a note entry, version snapshotted. Answer ALL open questions, then synthesize ONCE - each answer bumps `librarySeq`, so never loop answer -> synthesize per question. Builder questions (`needs_input`) go to `answer_build_question` instead. |
320
+ | `blueprint_build` | Sync the spec into its Job (the primary build verb): validates the spec, ensures the router + route exist, upserts judge test cases from `exampleCases` (content-hash idempotent), attaches spec + library as the builder artifact, and queues a build run. Returns the handoff coordinates `{ middlewareId, routeId, buildId, testCaseIds }` the jobs toolset takes over with. |
321
+ | `blueprint_build_status` | Blueprint-side view of the linked build run (status `queued`/`running`/`green`/`failed`/`needs_input`, summary, open questions). `needs_input` questions come back with `answer_build_question` coordinates prefilled - try to answer them from the library first. |
322
+ | `blueprint_import_cases` | Adopt the linked job's test cases into the spec's `exampleCases` (upsert by name) - the `job_ahead` fold-back arrow. The alternative exit is `blueprint_build` alone, which rebuilds from the spec and overwrites the direct edits. |
323
+ | `blueprint_list_versions` | List the spec's version snapshots (newest first) - every document change snapshots one, with its note. Pass `version` to fetch one full snapshot (diff a proposal, or recover a document after a CAS 409). |
324
+
325
+ ### The blueprint loop - context entries -> synthesize -> review -> apply -> build
326
+
327
+ The blueprint loop sits in front of the job build loop below. When in doubt about a blueprint, call `resolve_blueprint_state` - it returns the concrete next tool calls, exactly like `resolve_job_state` does for jobs.
328
+
329
+ ```
330
+ 1. FEED THE LIBRARY - blueprint_add_entry (SOPs, Looms, notes, transcripts, VM
331
+ walkthroughs). Files: blueprint_entry_upload_url -> PUT the
332
+ bytes -> blueprint_add_entry with the gs:// blobRef.
333
+ Enrichable entries start pending - poll blueprint_list_entries.
334
+ 2. SYNTHESIZE - blueprint_synthesize drafts ONE pending spec proposal (LLM).
335
+ Never applied silently.
336
+ 3. REVIEW + ANSWER - blueprint_get_proposal (patch + SOP + per-claim citations).
337
+ Answer open questions with blueprint_answer_question - ALL
338
+ of them, then ONE resynthesize.
339
+ 4. APPLY - blueprint_apply_proposal with the reviewed proposal's
340
+ baseVersion + proposalBasedOnSeq (409 proposal_mismatch if a
341
+ concurrent resynthesize swapped it).
342
+ 5. BUILD - blueprint_build syncs the spec into the Job: router + route +
343
+ judge test cases + build run. Returns {middlewareId, routeId,
344
+ buildId} - the jobs loop (resolve_job_state) takes over.
345
+ ```
346
+
347
+ Two drift directions keep the spec and the job honest: `spec_stale` (the library moved past the spec - synthesize) and `job_stale` (the spec moved past the job - build). `job_ahead` means the job was edited directly behind the spec's back; exit with `blueprint_import_cases` (fold the edits back) or `blueprint_build` (overwrite them). To teach a blueprint from a live VM session, load `get_skill("blueprint-vm-walkthrough")`.
348
+
299
349
  ## Jobs (RPA orchestration)
300
350
 
301
- A **Job** is a middleware route whose behavior is a structured `definition` (a step graph) instead of freeform handler code. Jobs sit **above** workflows: a job step either calls an entire Minicor workflow (`kind: "workflow"`, by `workflowId`) or runs a code block (`kind: "code"`). The job never touches a workflow's internal steps - a workflow is an opaque callable with an input and an output. A job is the **macro zoom** (what ran, status, replays); a workflow → step is the **microscope**. This is the layer that turns one or more workflows into a versioned, testable, observable API endpoint.
351
+ A **Job** is a middleware route whose behavior is a structured `definition` (a step graph) instead of freeform handler code. Jobs sit **above** workflows: a job step either calls an entire Minicor workflow (`kind: "workflow"`, by `workflowId`) or runs a code block (`kind: "code"`). The job never touches a workflow's internal steps - a workflow is an opaque callable with an input and an output. A job is the **macro zoom** (what ran, status, replays); a workflow → step is the **microscope**. This is the layer that turns one or more workflows into a versioned, testable, observable API endpoint. When a route is owned by a Blueprint (see above), drive changes through the spec, not the direct job tools.
302
352
 
303
353
  ### The job tools
304
354
 
305
355
  | Tool | What it does |
306
356
  | --- | --- |
307
- | `resolve_job_state` | The first call to make when picking up a job. Returns the job's state (draft vs published, test cases, latest test run, recent executions, active build) plus `nextActions` - the concrete next tool calls. A red test run is drilled automatically: failing case → failing step → its `workflowId` (a `dev_mode_load` hint) → a seeded `fromStepId` replay command. |
357
+ | `resolve_job_state` | The first call to make when picking up a job. Returns the job's state (draft vs published, test cases, latest test run, recent executions, active build) plus `nextActions` - the concrete next tool calls. A red test run is drilled automatically: failing case → failing step → its `workflowId` (a `dev_mode_load` hint) → a seeded `fromStepId` replay command. Blueprint-owned routes come back with a `blueprint` block: edit those through the spec (`resolve_blueprint_state`), not `update_job`/`add_test_case`. |
308
358
  | `list_middlewares` | List the routers (middlewares) in a workspace - jobs attach to one of these. |
309
359
  | `register_middleware` | Create a router jobs attach to. `autoConfigure` (default true) populates the router's `workspaceApiKey` from the workspace's first key; or pass `workspaceApiKey` explicitly. |
310
360
  | `register_job` | Create a job - a route backed by a structured `definition` (step graph). |
@@ -434,6 +484,7 @@ Skills are reusable RPA patterns that accumulate as you build automations. The M
434
484
  | Skill | Purpose |
435
485
  | ---------------------------- | --------------------------------------------------------------------------------- |
436
486
  | `job-build-loop` | **Mandatory for job work.** The test-case-first build/debug loop: green-gate first, macroscope (job) → microscope (workflow steps), seeded range replays, stop semantics, publish gates |
487
+ | `blueprint-vm-walkthrough` | Guided VM walkthrough that teaches a blueprint: the user narrates a process on a live VM while you capture screens, ground UI anchors, and persist walkthrough + screenshot + screen-map entries |
437
488
  | `rpa-testing-workflow` | **Mandatory.** Exact tool call sequences for testing through the Minicor executor |
438
489
  | `cdp-browser-automation` | CDP starter template, React-safe setters, parallel execution |
439
490
  | `desktop-uiautomation` | Framework selection, element selectors, wait/retry patterns |
@@ -542,12 +593,38 @@ On multi-session (broker) VMs every execute/screenshot call must name a `targetU
542
593
  | `preview_flow_changes` / `compare_flow_versions` | Diff code before deploying |
543
594
 
544
595
 
596
+ ### Blueprints
597
+
598
+
599
+ | Tool | What it does |
600
+ | ----------------------------- | ---------------------------------------------------------------------------------------------- |
601
+ | `resolve_blueprint_state` | "Where am I in the blueprint loop?" - unfolded state + `blockers` + `nextActions` |
602
+ | `blueprint_list` | List a workspace's blueprints with computed state, drift flags, and linked job coordinates |
603
+ | `blueprint_create` | Create a blueprint (empty, or linked to an existing job via `routeId` + `middlewareId`) |
604
+ | `blueprint_get` | Get the spec document, computed state, drift, and inbox (`openQuestions` + `pendingProposal`) |
605
+ | `blueprint_update` | Direct spec edit (`document` or section-level `patch`); document edits require `baseVersion` CAS |
606
+ | `blueprint_add_entry` | Add or patch a library entry (context kinds feed synthesis; resource kinds are `entry://` refs) |
607
+ | `blueprint_list_entries` | List entries with enrichment status; `entryId` + `revisions`/`downloadUrl` for one entry |
608
+ | `blueprint_entry_upload_url` | Signed upload handshake: `{ uploadUrl, blobRef }` -> PUT the bytes -> `blueprint_add_entry` with the `gs://` ref |
609
+ | `blueprint_synthesize` | LLM-draft a spec proposal from the library (one pending proposal; structured blocked reasons) |
610
+ | `blueprint_get_proposal` | Read the pending proposal + per-claim citations; returns the exact apply coordinates |
611
+ | `blueprint_apply_proposal` | Apply the reviewed proposal (`baseVersion` + `proposalBasedOnSeq`; 409 `proposal_mismatch` if swapped) |
612
+ | `blueprint_reject_proposal` | Discard the pending proposal; a 404 means someone already resolved it (success-shaped) |
613
+ | `blueprint_answer_question` | Atomically answer one open question (stored as a note entry; then synthesize ONCE) |
614
+ | `blueprint_build` | Sync spec -> Job; returns `{ middlewareId, routeId, buildId }` for the jobs toolset |
615
+ | `blueprint_build_status` | Blueprint-side view of the linked build run (status, summary, open questions) |
616
+ | `blueprint_import_cases` | Fold the linked job's test cases back into the spec's `exampleCases` (the `job_ahead` exit) |
617
+ | `blueprint_list_versions` | List spec version snapshots; pass `version` for one full snapshot |
618
+
619
+
620
+ See the **Blueprints (the spec front door)** section above for the loop and the ownership rule.
621
+
545
622
  ### Jobs & Test Cases
546
623
 
547
624
 
548
625
  | Tool | What it does |
549
626
  | --------------------- | -------------------------------------------------------------------------------------------- |
550
- | `resolve_job_state` | "Where am I in the build loop?" - job state + `nextActions` (the concrete next tool calls) |
627
+ | `resolve_job_state` | "Where am I in the build loop?" - job state + `nextActions`; flags blueprint-owned routes |
551
628
  | `list_middlewares` | List the routers (middlewares) in a workspace - jobs attach to one of these |
552
629
  | `register_middleware` | Create a router (middleware) jobs attach to; `autoConfigure` populates its workspace API key |
553
630
  | `register_job` | Create a job - a middleware route backed by a structured `definition` (step graph) |
@@ -766,6 +843,8 @@ src/
766
843
  sync-tools.ts - clone_workspace, init_project, pull/push, set_workspaces_root
767
844
  vm.ts, vm-rpa.ts - VM and RPA tools
768
845
  core.ts - Workflows, flows, executions
846
+ jobs.ts - Jobs, test cases, scenarios, build runs
847
+ blueprints.ts - Blueprints: spec + library + synthesize/apply + build sync
769
848
  ...
770
849
  prompts/
771
850
  workspace-session.ts - Workspace session guide prompt
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=blueprints.live.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprints.live.test.d.ts","sourceRoot":"","sources":["../../src/__live__/blueprints.live.test.ts"],"names":[],"mappings":""}