{"_id":"@avant-garde/design-loop","name":"@avant-garde/design-loop","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@avant-garde/design-loop","version":"0.1.0","description":"Design-code deep agent: render → see → refine Shopify theme implementation, with the Design Work Contract for orchestrator delegation","type":"module","license":"MIT","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./contract":{"types":"./dist/contract.d.ts","default":"./dist/contract.js"}},"bin":{"design-code-agent":"dist/delegation/cli.js","design-code-agent-mcp":"dist/delegation/mcp-server.js","design-loop-bench":"dist/bench/cli.js","design-loop-release-gate":"dist/release/cli.js"},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","mcp":"node dist/delegation/mcp-server.js","bench":"node dist/bench/cli.js","release:gate":"node dist/release/cli.js","prepublishOnly":"pnpm run build"},"dependencies":{"zod":"^3.25.0"},"optionalDependencies":{"@modelcontextprotocol/sdk":"^1.0.0","playwright":"^1.49.0","pixelmatch":"^6.0.0","pngjs":"^7.0.0"},"devDependencies":{"@types/node":"^22.0.0","tsup":"^8.0.2","tsx":"^4.7.0","typescript":"^5.7.0","vitest":"^2.0.0"},"engines":{"node":">=20.0.0"},"repository":{"type":"git","url":"git+https://github.com/Avant-Garde-AI/marketing-os.git","directory":"packages/design-loop"},"_id":"@avant-garde/design-loop@0.1.0","gitHead":"8476d509e7c1a1c5bc2ef8e20a40caae5704d537","bugs":{"url":"https://github.com/Avant-Garde-AI/marketing-os/issues"},"homepage":"https://github.com/Avant-Garde-AI/marketing-os#readme","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-wAEEErCqfHEodHC3umTfLllmhuTCVEek16Z0FxOy35hYiLrxnpUvhAMaFuB4XRLD/zYJk5GH+Atw83BxeD7yyg==","shasum":"2146e9947b8e5b1d4d37839f4cbd90dc7483ddc7","tarball":"https://registry.npmjs.org/@avant-garde/design-loop/-/design-loop-0.1.0.tgz","fileCount":16,"unpackedSize":1391496,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@avant-garde%2fdesign-loop@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC546c3qIR1nOB27jhlyvUJmh1mH0Ngh0Vf2Y/ZropExwIgdlj0dGldIYY/W9P1vY9a3XjcILBLuTJjjmEQ/j1HWPk="}]},"_npmUser":{"name":"geastham","email":"garrett@openconjecture.com"},"directories":{},"maintainers":[{"name":"geastham","email":"garrett@openconjecture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/design-loop_0.1.0_1783276383239_0.24021571428946342"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-05T18:33:03.116Z","0.1.0":"2026-07-05T18:33:03.494Z","modified":"2026-07-05T18:33:03.883Z"},"maintainers":[{"name":"geastham","email":"garrett@openconjecture.com"}],"description":"Design-code deep agent: render → see → refine Shopify theme implementation, with the Design Work Contract for orchestrator delegation","homepage":"https://github.com/Avant-Garde-AI/marketing-os#readme","repository":{"type":"git","url":"git+https://github.com/Avant-Garde-AI/marketing-os.git","directory":"packages/design-loop"},"bugs":{"url":"https://github.com/Avant-Garde-AI/marketing-os/issues"},"license":"MIT","readme":"# @avant-garde/design-loop\n\nThe **design-code deep agent** for Marketing OS: the render → see → refine engine\nfor on-brand, conversion-driven Shopify theme implementation, plus the **Design\nWork Contract** that lets a general-purpose planner (Claude Code in the GH\nrunner) delegate implementation to it.\n\nPlan & rationale: `docs/plans/brand-conversion-design-agent/`.\n\n## What's here\n\n- **The contract** (`./contract`) — `TaskSpec` / `ProgressEvent` / `WorkReport` /\n  `RevisionSpec` zod schemas. Parent-agnostic; the same shapes back the MCP\n  server and the CLI.\n- **The deep agent** (`runDesignAgent`) — decomposes a `TaskSpec` into\n  per-page/section sub-tasks, runs the bounded refine loop for each, and merges\n  the results into one `WorkReport`.\n- **The refine loop** (`runRefineLoop`) — propose → implement → render → capture →\n  conform → refine, capped at N iterations (default 4), escalate-with-best on the\n  cap, `rejected` on a guardrail/asset-boundary refusal.\n- **Deterministic gates** — dark-pattern blocklist (output-processor), WCAG\n  accessibility floor, token fidelity. Rule-based, never routed through a model.\n- **Delegation surface** — `DelegationService` (in-process registry, async +\n  progress), an MCP server (`pnpm mcp`), and a CLI (`design-code-agent run`).\n\n## Architecture: logic vs. I/O\n\nAll **logic** (contract, loop, deep agent, gates, conformance merge, delegation)\nis fully typed and tested with **injectable providers** — no browser, no model,\nno Shopify needed. The **I/O adapters** (Playwright capture, `shopify theme\ndev`, a VLM critic endpoint, pixelmatch diff, the MCP transport) are thin,\nlazy-loaded glue in `src/adapters/` (marked `@ts-nocheck`) and declared as\n**optional dependencies**, so the package builds and tests run with zero heavy\ndeps installed.\n\n```\nTaskSpec ─▶ DelegationService ─▶ runDesignAgent ─▶ runRefineLoop ─▶ WorkReport\n                                       │                 │\n                                       └─ decompose      ├─ Implementer  (stub | LLM)\n                                                         ├─ CaptureProvider (stub | Playwright)\n                                                         ├─ CriticProvider  (stub | VLM)  ┐\n                                                         └─ gates (deterministic) ────────┴─▶ ConformanceResult\n```\n\n`ConformanceResult` matches the Design MCP `validate_design_conformance` return\nshape, so the local merge can be swapped for the hosted MCP call (set\n`DESIGN_MCP_ENDPOINT`) without changing callers.\n\n## Run\n\n```bash\npnpm --filter @avant-garde/design-loop build\npnpm --filter @avant-garde/design-loop test\n\n# CLI (stub providers — no external deps):\nnode dist/delegation/cli.js run --task task.json --report report.json --stub\n\n# MCP server (needs @modelcontextprotocol/sdk; what the GH-runner planner connects to):\npnpm --filter @avant-garde/design-loop mcp\n```\n\nA live run (`DESIGN_LOOP_REAL=1` + a configured critic endpoint + `shopify theme\ndev`) uses the real adapters; otherwise the stub providers run deterministically.\n","readmeFilename":"README.md","_rev":"1-4871f62ca2621d08d1e6de12fae18013"}