{"_id":"@animastor/contracts","_rev":"2-33e583f49082861ea1057138ec5631ee","name":"@animastor/contracts","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@animastor/contracts","version":"0.1.0","license":"MIT","_id":"@animastor/contracts@0.1.0","maintainers":[{"name":"animastor","email":"admin@animastor.in"}],"homepage":"https://github.com/Animastor/animastor#readme","bugs":{"url":"https://github.com/Animastor/animastor/issues"},"dist":{"shasum":"88cc59ee6b3c7f04b1d3506ef840df7abe8c4827","tarball":"https://registry.npmjs.org/@animastor/contracts/-/contracts-0.1.0.tgz","fileCount":5,"integrity":"sha512-dSNAlU8QWd3ryCFaHXmX1CH2CefBVlR5xsM0brZRJ1Qtl3AZrHsIRRxXvvvvgI3a4YXVSFdpeorSOCCWOsVBuw==","signatures":[{"sig":"MEUCIGmmQ3CRxUKmbJJCAC3+nhPtTEIGvhk0taku5FI74zVnAiEAnOdSnXk4U6pN21Fw6I9HrDdtwdcaXV4GHNKmUyoEcyI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15987},"main":"src/index.js","engines":{"node":">=18"},"gitHead":"dc5cb89413114373f6eb3d152769d88e6064e396","scripts":{"test":"node tests/run-all.cjs"},"_npmUser":{"name":"animastor","email":"admin@animastor.in"},"repository":{"url":"git+https://github.com/Animastor/animastor.git","type":"git","directory":"contracts"},"_npmVersion":"10.9.8","description":"Frozen wire contracts shared by Animastor components. Currently: Job Protocol v2 (backend <-> GPU Hub <-> Worker) — protocol constants, job_id grammar, envelope/error contract helpers. Canonical implementation; docs/architecture/JOB_PROTOCOL_V2.md is the ","directories":{},"_nodeVersion":"22.22.3","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/contracts_0.1.0_1788706600390_0.9655427778148653","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@animastor/contracts","version":"0.1.1","description":"Frozen wire contracts shared by Animastor components: Job Protocol v2 (backend <-> GPU Hub <-> Worker) — protocol constants, job_id grammar, envelope/error contract helpers; plus the Runtime Result contract (Phase 5 seam — job/dispatch execution results b","main":"src/index.js","exports":{".":"./src/index.js"},"scripts":{"test":"node tests/run-all.cjs"},"engines":{"node":">=18"},"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/Animastor/animastor.git","directory":"packages/animastor-contracts"},"bugs":{"url":"https://github.com/Animastor/animastor/issues"},"_id":"@animastor/contracts@0.1.1","gitHead":"e4078e723f5d02648a39c7ab7d98b619cb6d525c","homepage":"https://github.com/Animastor/animastor#readme","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-l0EonPEOkWg3x46S/5azPX9Xm9s38c+HoWyrZse0wnq0zNspqaVSLgThMP7nwFGXG7pLCZ3lH8M6KoCZMmojuQ==","shasum":"71c15714db12eea8c0daf9c224b8d5122b360fe8","tarball":"https://registry.npmjs.org/@animastor/contracts/-/contracts-0.1.1.tgz","fileCount":6,"unpackedSize":21993,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDp/Ll4LlDqw8SOHedrjXtD5cMWWk+SgHyc43wwSX9BtAIhAN1Tc/VBKJhgdXc7pz6+vNKxskecfORhjyU1zJNLpkwY"}]},"_npmUser":{"name":"animastor","email":"admin@animastor.in"},"directories":{},"maintainers":[{"name":"animastor","email":"admin@animastor.in"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/contracts_0.1.1_1789310772871_0.8454632319306679"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-06T14:56:40.212Z","modified":"2026-09-13T14:46:13.138Z","0.1.0":"2026-09-06T14:56:40.514Z","0.1.1":"2026-09-13T14:46:13.009Z"},"bugs":{"url":"https://github.com/Animastor/animastor/issues"},"license":"MIT","homepage":"https://github.com/Animastor/animastor#readme","repository":{"type":"git","url":"git+https://github.com/Animastor/animastor.git","directory":"packages/animastor-contracts"},"description":"Frozen wire contracts shared by Animastor components: Job Protocol v2 (backend <-> GPU Hub <-> Worker) — protocol constants, job_id grammar, envelope/error contract helpers; plus the Runtime Result contract (Phase 5 seam — job/dispatch execution results b","maintainers":[{"name":"animastor","email":"admin@animastor.in"}],"readme":"# @animastor/contracts\n\nFrozen wire contracts shared by Animastor components. **Single source of\ntruth** so backend, GPU Hub and Worker stop drifting apart before/after the\nworker physical extraction.\n\nCurrently published contracts:\n\n- **Job Protocol v2** (`src/job-protocol-v2.js`) — the frozen wire contract\n  between backend (orchestrator/dispatcher), GPU Hub (queues/claim) and\n  Worker (ComfyUI execution). The normative specification is\n  [`docs/architecture/JOB_PROTOCOL_V2.md`](../docs/architecture/JOB_PROTOCOL_V2.md)\n  (Phase 9A, FROZEN) — this package implements it verbatim, no more.\n- **Runtime Result** (`src/runtime-result.js`, exported as `runtimeResult`) —\n  the Phase 5 stable shape of a runtime job/dispatch execution result\n  (`completed | failed | cancelled`), produced by the runtime tier and\n  consumed by the orchestration tier (`@animastor/orchestration`), injected\n  through the composition-root seam. Moved verbatim from\n  `backend/src/contracts/runtime-result.js` at the §32.30 physical extraction\n  (docs/architecture/PHASE_5_ORCHESTRATION_RUNTIME.md §3.1); a leaf module —\n  no relative requires, never participates in an import cycle.\n\n## What is inside (Job Protocol v2)\n\n| Export | Meaning |\n|---|---|\n| `PROTOCOL_VERSION` | `2` — frozen for the whole Phase 9 (§3.1) |\n| `JOB_TYPES` | job_id suffix family: `audio, image, iu_image, video` |\n| `SYSTEM_JOB_TYPES` | hub transport/scan-queue family: `audio, image, video` |\n| `STAGE_BY_KIND` | parse `kind` → `stage` mapping |\n| `buildJobId / splitJobId / parseJobId / getStageForJobId` | canonical job_id grammar (`${assetId}:${type}`, parse-from-end) |\n| `TASK_ENVELOPE_REQUIRED_FIELDS`, `TASK_ENVELOPE_FIELDS` | task envelope contract (§3.2) |\n| `RESULT_ENVELOPE_REQUIRED_FIELDS`, `ERROR_ENVELOPE_REQUIRED_FIELDS`, `BEACON_ENVELOPE_REQUIRED_FIELDS` | callback envelope contract (§3.10–3.12) |\n| `ERROR_TOKENS` | canonical wire error tokens (§3.13) |\n| `validateTaskEnvelopeIdentity`, `validateResultEnvelopeIdentity` | advisory identity-block helpers mirroring hub checks |\n\n**No business logic.** Nothing here performs I/O, HTTP, Redis or workflow\nwork; the package is dependency-free (Node >= 18, CommonJS).\n\n## What is inside (Runtime Result)\n\n| Export | Meaning |\n|---|---|\n| `RUNTIME_RESULT_STATUS` / `RUNTIME_RESULT_STATUSES` | frozen status vocabulary: `completed`, `failed`, `cancelled` |\n| `OUTCOME_TO_STATUS` / `statusFromOutcome` | dispatch-engine finalization outcome → contract status |\n| `createRuntimeResult` | validated, frozen Runtime Result factory (`jobId` or `dispatchId` required) |\n\n## Consumers\n\n| Component | How it consumes |\n|---|---|\n| backend | `backend/src/runtime/job-schema.js` — compatibility facade re-exporting this package (12 import sites unchanged) |\n| gpu-hub | `require('@animastor/contracts').jobProtocolV2` — runtime import via optionalDependency or docker bind mount |\n| orchestration | `require('@animastor/contracts')` root specifier — `.jobProtocolV2` (scene-orchestrator job ids) and `.runtimeResult` (`runtime-result-emitter` result contract); registry dependency `^0.1.0` |\n| worker | Generated byte-exact copy (`worker/worker/job-protocol-v2.cjs`) synced by `worker/tools/sync-protocol.cjs` |\n\nParity between the package and the remaining copies is enforced by\n`backend/tests/architecture/phase9c-contracts.test.js` (cross-side contract\ntest) and the package's own suite (`npm test` here).\n\n### Bootstrap for a fresh checkout (backend tests)\n\nThe backend deliberately has **no npm dependency** on this package yet (a\n`file:../contracts` dep would break the backend docker build whose context is\n`./backend` — see `docs/architecture/PHASE_9C_CONTRACTS_EXTRACTION_AUDIT.md`\n§3.1). Resolve it with a one-time symlink from the repo root:\n\n```bash\nmkdir -p node_modules/@animastor && ln -sfn ../../contracts node_modules/@animastor/contracts\n```\n\nIn docker-compose deployments the backend service mounts\n`./contracts:/app/node_modules/@animastor/contracts:ro` automatically.\n\n## Usage\n\n```js\nconst { PROTOCOL_VERSION, parseJobId, buildJobId } = require('@animastor/contracts');\n// or namespaced:\nconst { jobProtocolV2, runtimeResult } = require('@animastor/contracts');\n```\n\n## Rules for contributors\n\n- `protocol_version` stays `2` for the whole Phase 9. Any change goes through\n  the versioning policy (`JOB_PROTOCOL_V2.md` §4) with a coordinated bump in\n  all three components.\n- Grammar/envelope changes are breaking (v3 material) unless explicitly\n  additive and wire-compatible.\n- This package must never depend on backend, GPU Hub, Worker or any npm\n  package. Zero runtime dependencies.\n- Publishable to npm registry as `@animastor/contracts` (see PHASE_10F audit).\n","readmeFilename":"README.md"}