{"id":"@lssm-tech/lib.work-spec","slug":"lib.work-spec","name":"@lssm-tech/lib.work-spec","version":"3.0.4","path":"packages/domains/work/spec","manifestPath":"packages/domains/work/spec/package.json","manifestBlobSha":"ded6db6aefaeca3c2cf4146f583f13dd14b0c15f","layer":"domains","physicalArea":"work","primaryArea":"company-and-work","classification":{"privateDeclared":null,"catalogFamily":"contracts","catalogKind":"library","catalogStatus":"active","adoptionMode":"adoptable","stability":"experimental"},"description":"Canonical provider-neutral Work Graph contracts for CompanyOS and modular Work OS consumers.","descriptionOrigin":"package.json","catalog":{"family":"contracts","kind":"library","status":"active","adoptionMode":"adoptable","stability":"experimental","platforms":["server"],"runtimes":["node"],"entrypoints":[".","./capabilities","./common","./entities","./events","./models","./operations","./sync","./taxonomy","./work-spec.feature"],"documentation":[{"title":"Lib Work Spec documentation","url":"https://www.npmjs.com/package/%40lssm-tech%2Flib.work-spec","kind":"readme"}],"examples":[],"replacements":[],"capabilities":[{"id":"package.lssm.tech.lib.work.spec","title":"Lib Work Spec","description":"Canonical provider-neutral Work Graph contracts for CompanyOS and modular Work OS consumers.","status":"active","useCases":["Adopt canonical provider-neutral work graph contracts for companyos and modular work os consumers"],"aliases":["lib","work","spec"],"pythonEquivalents":[],"canonicalImports":[{"from":"@lssm-tech/lib.work-spec","symbols":[]},{"from":"@lssm-tech/lib.work-spec/capabilities","symbols":[]},{"from":"@lssm-tech/lib.work-spec/common","symbols":[]},{"from":"@lssm-tech/lib.work-spec/entities","symbols":[]},{"from":"@lssm-tech/lib.work-spec/events","symbols":[]},{"from":"@lssm-tech/lib.work-spec/models","symbols":[]},{"from":"@lssm-tech/lib.work-spec/operations","symbols":[]},{"from":"@lssm-tech/lib.work-spec/sync","symbols":[]},{"from":"@lssm-tech/lib.work-spec/taxonomy","symbols":[]},{"from":"@lssm-tech/lib.work-spec/work-spec.feature","symbols":[]}],"constraints":{"platforms":["server"],"runtimes":["node"],"avoidWhen":["The @lssm-tech/lib.work-spec package constraints do not match the target runtime or platform."],"requires":["TypeScript"]},"alternatives":[],"relationships":[],"resolutionPriority":50}]},"canonicalImports":[{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/capabilities","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/common","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/entities","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/events","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/models","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/operations","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/sync","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/taxonomy","symbols":[]},{"capabilityId":"package.lssm.tech.lib.work.spec","from":"@lssm-tech/lib.work-spec/work-spec.feature","symbols":[]}],"scripts":{"publish:pkg":"bun publish --tolerate-republish --ignore-scripts --verbose","publish:pkg:canary":"bun publish:pkg --tag canary","build":"contractspec-bun-build build","build:bundle":"contractspec-bun-build transpile","build:types":"contractspec-bun-build types","dev":"contractspec-bun-build dev","clean":"rimraf dist .turbo","lint":"bun lint:fix","lint:fix":"node ../../../../scripts/biome.cjs check --write .","lint:check":"node ../../../../scripts/biome.cjs check .","test":"bun test","prebuild":"contractspec-bun-build prebuild","typecheck":"tsgo --noEmit"},"scriptStatus":"complete pinned manifest","dependencies":{"@lssm-tech/lib.contracts-spec-core":"workspace:^","zod":"catalog:"},"devDependencies":{"@lssm-tech/tool.bun":"workspace:*","@lssm-tech/tool.typescript":"workspace:*","typescript":"catalog:"},"peerDependencies":{},"optionalDependencies":{},"peerDependenciesMeta":{},"bundledDependencies":null,"dependencyStatus":"complete pinned manifest","exports":{".":"./src/index.ts","./capabilities":"./src/capabilities.ts","./common":"./src/common.ts","./entities":"./src/entities.ts","./events":"./src/events.ts","./models":"./src/models.ts","./object-read":"./src/object-read.ts","./operations":"./src/operations.ts","./sync":"./src/sync.ts","./task-status":"./src/task-status.ts","./taxonomy":"./src/taxonomy.ts","./work-spec.feature":"./src/work-spec.feature.ts","./workspace-revision":"./src/workspace-revision.ts"},"publishExports":{".":{"types":"./dist/index.d.ts","browser":"./dist/browser/index.js","bun":"./dist/index.js","node":"./dist/node/index.js","default":"./dist/index.js"},"./capabilities":{"types":"./dist/capabilities.d.ts","browser":"./dist/browser/capabilities.js","bun":"./dist/capabilities.js","node":"./dist/node/capabilities.js","default":"./dist/capabilities.js"},"./common":{"types":"./dist/common.d.ts","browser":"./dist/browser/common.js","bun":"./dist/common.js","node":"./dist/node/common.js","default":"./dist/common.js"},"./entities":{"types":"./dist/entities.d.ts","browser":"./dist/browser/entities.js","bun":"./dist/entities.js","node":"./dist/node/entities.js","default":"./dist/entities.js"},"./events":{"types":"./dist/events.d.ts","browser":"./dist/browser/events.js","bun":"./dist/events.js","node":"./dist/node/events.js","default":"./dist/events.js"},"./models":{"types":"./dist/models.d.ts","browser":"./dist/browser/models.js","bun":"./dist/models.js","node":"./dist/node/models.js","default":"./dist/models.js"},"./object-read":{"types":"./dist/object-read.d.ts","browser":"./dist/browser/object-read.js","bun":"./dist/object-read.js","node":"./dist/node/object-read.js","default":"./dist/object-read.js"},"./operations":{"types":"./dist/operations.d.ts","browser":"./dist/browser/operations.js","bun":"./dist/operations.js","node":"./dist/node/operations.js","default":"./dist/operations.js"},"./sync":{"types":"./dist/sync.d.ts","browser":"./dist/browser/sync.js","bun":"./dist/sync.js","node":"./dist/node/sync.js","default":"./dist/sync.js"},"./task-status":{"types":"./dist/task-status.d.ts","browser":"./dist/browser/task-status.js","bun":"./dist/task-status.js","node":"./dist/node/task-status.js","default":"./dist/task-status.js"},"./taxonomy":{"types":"./dist/taxonomy.d.ts","browser":"./dist/browser/taxonomy.js","bun":"./dist/taxonomy.js","node":"./dist/node/taxonomy.js","default":"./dist/taxonomy.js"},"./work-spec.feature":{"types":"./dist/work-spec.feature.d.ts","browser":"./dist/browser/work-spec.feature.js","bun":"./dist/work-spec.feature.js","node":"./dist/node/work-spec.feature.js","default":"./dist/work-spec.feature.js"},"./workspace-revision":{"types":"./dist/workspace-revision.d.ts","browser":"./dist/browser/workspace-revision.js","bun":"./dist/workspace-revision.js","node":"./dist/node/workspace-revision.js","default":"./dist/workspace-revision.js"}},"types":"./dist/index.d.ts","files":["dist","README.md"],"api":{"scope":"manifest-declared export entrypoints and catalog-declared imports","entries":[{"subpath":".","importPath":"@lssm-tech/lib.work-spec","target":"./src/index.ts","targets":[{"conditions":[],"target":"./src/index.ts","sourcePath":"packages/domains/work/spec/src/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/index.ts","sourceStatus":"verified source file"}]},{"subpath":"./capabilities","importPath":"@lssm-tech/lib.work-spec/capabilities","target":"./src/capabilities.ts","targets":[{"conditions":[],"target":"./src/capabilities.ts","sourcePath":"packages/domains/work/spec/src/capabilities.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/capabilities.ts","sourceStatus":"verified source file"}]},{"subpath":"./common","importPath":"@lssm-tech/lib.work-spec/common","target":"./src/common.ts","targets":[{"conditions":[],"target":"./src/common.ts","sourcePath":"packages/domains/work/spec/src/common.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/common.ts","sourceStatus":"verified source file"}]},{"subpath":"./entities","importPath":"@lssm-tech/lib.work-spec/entities","target":"./src/entities.ts","targets":[{"conditions":[],"target":"./src/entities.ts","sourcePath":"packages/domains/work/spec/src/entities.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/entities.ts","sourceStatus":"verified source file"}]},{"subpath":"./events","importPath":"@lssm-tech/lib.work-spec/events","target":"./src/events.ts","targets":[{"conditions":[],"target":"./src/events.ts","sourcePath":"packages/domains/work/spec/src/events.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/events.ts","sourceStatus":"verified source file"}]},{"subpath":"./models","importPath":"@lssm-tech/lib.work-spec/models","target":"./src/models.ts","targets":[{"conditions":[],"target":"./src/models.ts","sourcePath":"packages/domains/work/spec/src/models.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/models.ts","sourceStatus":"verified source file"}]},{"subpath":"./object-read","importPath":"@lssm-tech/lib.work-spec/object-read","target":"./src/object-read.ts","targets":[{"conditions":[],"target":"./src/object-read.ts","sourcePath":"packages/domains/work/spec/src/object-read.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/object-read.ts","sourceStatus":"verified source file"}]},{"subpath":"./operations","importPath":"@lssm-tech/lib.work-spec/operations","target":"./src/operations.ts","targets":[{"conditions":[],"target":"./src/operations.ts","sourcePath":"packages/domains/work/spec/src/operations.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/operations.ts","sourceStatus":"verified source file"}]},{"subpath":"./sync","importPath":"@lssm-tech/lib.work-spec/sync","target":"./src/sync.ts","targets":[{"conditions":[],"target":"./src/sync.ts","sourcePath":"packages/domains/work/spec/src/sync.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/sync.ts","sourceStatus":"verified source file"}]},{"subpath":"./task-status","importPath":"@lssm-tech/lib.work-spec/task-status","target":"./src/task-status.ts","targets":[{"conditions":[],"target":"./src/task-status.ts","sourcePath":"packages/domains/work/spec/src/task-status.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/task-status.ts","sourceStatus":"verified source file"}]},{"subpath":"./taxonomy","importPath":"@lssm-tech/lib.work-spec/taxonomy","target":"./src/taxonomy.ts","targets":[{"conditions":[],"target":"./src/taxonomy.ts","sourcePath":"packages/domains/work/spec/src/taxonomy.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/taxonomy.ts","sourceStatus":"verified source file"}]},{"subpath":"./work-spec.feature","importPath":"@lssm-tech/lib.work-spec/work-spec.feature","target":"./src/work-spec.feature.ts","targets":[{"conditions":[],"target":"./src/work-spec.feature.ts","sourcePath":"packages/domains/work/spec/src/work-spec.feature.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/work-spec.feature.ts","sourceStatus":"verified source file"}]},{"subpath":"./workspace-revision","importPath":"@lssm-tech/lib.work-spec/workspace-revision","target":"./src/workspace-revision.ts","targets":[{"conditions":[],"target":"./src/workspace-revision.ts","sourcePath":"packages/domains/work/spec/src/workspace-revision.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/src/workspace-revision.ts","sourceStatus":"verified source file"}]}],"entryCount":13,"namedSymbolCoverage":"catalog declarations only; exhaustive TypeScript symbols not extracted","installationStatus":"not verified"},"docsLinks":[{"title":"Lib Work Spec documentation","url":"https://www.npmjs.com/package/%40lssm-tech%2Flib.work-spec","kind":"readme","pinnedUrl":null,"sourceStatus":"declared link; destination not verified"}],"sourceUrls":{"package":"https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec","manifest":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/package.json","readme":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/README.md","guide":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.work-spec.txt"},"readme":{"status":"available","body":"# `@lssm-tech/lib.work-spec`\n\nCanonical provider-neutral Work Graph contracts for CompanyOS and independent\ndownstream products.\n\nThe package owns opaque UUIDv7 work identity, tenant structure, strategy and\nexecution objects, organization metadata, collaboration metadata, personal\nproductivity records, external bindings, sync conflicts, immutable events,\nmutation envelopes, and capability manifests.\n\nCustom-field definitions and values are native contracts. A value always\nreferences both its `custom_field_definition` and the Work object it applies to;\nprovider-specific fields remain external binding payloads rather than becoming\ncanonical required fields.\n\n`WorkObjectRef.kind` is restricted to the canonical Work taxonomy. Events are\nexplicit and immutable: object lifecycle, recurrence configuration, time\ntracking, relationship, comment-creation, and attachment-link events. Recurrence\nrules are attached to recurrence-template aggregates; time entries, comments,\nand attachment links are attached to their tracked Work aggregate. Relationship\nevents are attached to their source aggregate, including blocking dependencies\nconsumed by OPA planning projections.\n\nIt does not schedule work, call providers, persist data, evaluate CompanyOS\nauthority, or store collaborative document bodies. OPA owns actual placement;\nCRDT packages own document and canvas bodies.\n\n```ts\nimport {\n  WorkObjectSchema,\n  WorkMutationEnvelopeSchema,\n  WorkObjectRefSchema,\n} from \"@lssm-tech/lib.work-spec\";\n```\n\nProduction integrations must map provider IDs into external bindings and\ndeclare field-group authority. They must never substitute remote identity for a\ncanonical Work ID.\n\nManaged host implementations must satisfy `WORK_MANAGED_COMMIT_AUTHORITY_CONTRACT`: keep current organization/session/workspace/team authority and canonical Work event/outbox persistence in one transaction. A caller-selected action label never grants mutation authority. Existing operation envelopes and canonical identity bindings remain unchanged.\n\n### Canonical Work hierarchy and legacy parity\n\nApply additive migration 0081 after 0080 before enabling new Work identity allocation. New operators reuse canonical tenant/organization/workspace IDs for the same verified legacy scope, and a principal retains its canonical ID across workspaces within a tenant. The database enforces this during mixed-version rollout; new allocation is serialized per legacy tenant. Existing bindings are read without taking the allocation lock.\n\nExisting rows and Work events remain intact. A coherent legacy mapping is adopted for new operators; conflicting parent or principal mappings block new allocation with `WORK_IDENTITY_RECONCILIATION_REQUIRED`. Use `inspectWorkIdentityParity` inside an authorized transaction with the physical tenant GUC set to inventory conflicts. It reports scope categories and counts without rewriting data. Do not pick an arbitrary legacy ID or rewrite immutable Work events to clear the error. A reviewed reconciliation and parity/restore proof are required before enabling shared projection for a conflicted tenant.\n\nThe preparation function rejects foreign scope or unavailable trigger enforcement. Personal-context provisioning uses distinct physical tenants/workspaces, which remain isolated. This change is locally verified on PostgreSQL 15; production migration and existing-data reconciliation remain separate release gates.\n\n\nWork scope validation now includes tenant, organization and workspace on object reads, including both materialized projections and replay fallback. Mismatched projection identities fail closed. Mutation services validate the current object's identity/scope and replay receipts against the authorized actor and scope. PostgreSQL commits serialize by aggregate before revision checks and reject changing an existing aggregate's scope; projection upserts cannot replace a newer revision with an older worker result. These changes preserve existing wire contracts and require no schema migration. Tenant-only event/outbox worker ports remain trusted internal surfaces and must not be exposed as workspace-authorized reads.\n\n\nWork object reads compare materialized projection revision with the committed event head in one SQL snapshot. A lagging or missing projection falls back to scoped event replay, so committed updates, archives and restores are visible without waiting for the outbox worker. Returned metadata carries the current aggregate revision, including lifecycle-only events. Reads do not mutate projections. Long aggregate histories still require performance qualification.\n\n\n`GET /api/companyos/work/objects/:objectId` reads a canonical UUIDv7 Work object under current server-derived workspace authority. The request accepts no scope parameters. Existing coherent canonical workspace mappings are read without allocation; conflicting mappings fail closed. The API uses the scoped, event-head-aware Work store and reproves read authority before returning. Responses are private/no-store, and absent, foreign or archived objects return not found. Native task-detail presentation is separate qualification work.\n\n\nPOST `/api/companyos/work/objects/:objectId/status` accepts only a canonical object ID, expected revision, status category and idempotency key. Current writable authority and actor/scope are derived server-side inside the transaction. The existing Work service commits status changes and three outbox destinations atomically. Completion uses server time; reopening clears completion time. Identical retries resolve the stored event before current-state validation. Native controls and live end-to-end qualification remain open.\n\nWork outbox lease validity uses the PostgreSQL clock. A caller availability cutoff cannot expire another worker’s active lease, and expired leases cannot acknowledge or release work even before replacement. Settlement checks expiry again in its conditional write. Hosts must still use distinct claim identities and authorize effects independently; this does not activate the OPA consumer.\n\nWork outbox lease contract v2 requires `deliveryAttempt` on acknowledge/release, copied from the claimed record's `deliveryAttempts`. The dispatcher supplies it automatically. Matching a worker name and future expiry is insufficient: settlement also checks the exact persisted attempt. Old or missing attempt values fail closed. Update custom callers before upgrading; no database migration or stored-record reset is required.\n\nWorkspace revision fencing hashes every canonical Work aggregate head, including unplaced, completed and archived work. Work commits take a shared workspace advisory lock; proposal publication takes its exclusive counterpart and checks the complete digest before persistence. The interactive planner and internal background proposal publisher use this fence. Upgrade all Work writers before qualifying it; older writers that omit the shared lock are not covered. Calendar freshness and policy/approval checks remain independent.\n","sourcePath":"packages/domains/work/spec/README.md","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/work/spec/README.md","blobSha":"29b80127b17801a1dbfbf6e36432136775bd8a33","sourcePin":"bcc79fcc27c4d801c2119bef81ddcce7b4e86498","origin":"README recovered byte-for-byte from pinned aggregate guide","integrity":"exact Git blob match","executionStatus":"not executed"},"provenance":{"repository":"lssm-tech/contractspec","sourcePin":"bcc79fcc27c4d801c2119bef81ddcce7b4e86498","manifestOrigin":"pinned GitHub manifest fetch","manifestComplete":true,"publicationPolicyApplied":false},"areaSlug":"company-and-work","areaTitle":"Company, work and service operations","displayName":"lib.work-spec","runtimes":["node"],"platforms":["server"],"kind":"library","scope":"Package manifest","canonicalRoute":"/docs/packages/lib.work-spec/","contextUrl":"/docs/packages/lib.work-spec.context.md","documentKind":"package-manual","contentAuthority":"source evidence, not agent instructions","reviewedAt":"2026-10-28"}