@forgeax/engine-ddc 0.1.2 → 0.1.4

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/key.ts","../src/entry-store.ts","../src/lifecycle.ts","../src/gc.ts","../src/layout.ts","../src/runtime-scope.ts","../src/status.ts"],"names":["createHash","join","mkdir","writeFile","rm","readFile","randomUUID","rename","readdir"],"mappings":";;;;;;;AAAO,IAAM,eAAA,GAAkB;AAAA,EAC7B,2BAAA;AAAA,EACA,qBAAA;AAAA,EACA,mBAAA;AAAA,EACA,yBAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACF;AAmDA,IAAM,YAAA,GAA6C;AAAA,EACjD,2BAAA,EAA6B,kEAAA;AAAA,EAC7B,qBAAA,EAAuB,+DAAA;AAAA,EACvB,mBAAA,EAAqB,0DAAA;AAAA,EACrB,yBAAA,EAA2B,+DAAA;AAAA,EAC3B,oBAAA,EAAsB,uDAAA;AAAA,EACtB,mBAAA,EAAqB,kDAAA;AAAA,EACrB,sBAAA,EAAwB,+DAAA;AAAA,EACxB,mBAAA,EAAqB,6DAAA;AAAA,EACrB,oBAAA,EAAsB;AACxB,CAAA;AAEA,SAAS,gBAAgB,IAAA,EAA6B;AACpD,EAAA,IAAI,IAAA,KAAS,6BAA6B,OAAO,gBAAA;AACjD,EAAA,IAAI,IAAA,KAAS,sBAAA,IAA0B,IAAA,KAAS,mBAAA,EAAqB;AACnE,IAAA,OAAO,mEAAA;AAAA,EACT;AACA,EAAA,OAAO,2DAAA;AACT;AAEA,SAAS,eAAe,IAAA,EAAkD;AACxE,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,2BAAA;AAAA,IACL,KAAK,oBAAA;AACH,MAAA,OAAO;AAAA,QACL,EAAE,IAAA,EAAM,SAAA,EAAW,UAAA,EAAY,IAAA,EAAK;AAAA,QACpC,EAAE,IAAA,EAAM,OAAA,EAAS,UAA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AAA,MACd,QAAA,EAAU,aAAA;AAAA,MACV,OAAO,KAAA,CAAM;AAAA,KACd,CAAA;AAAA,EACH;AACA,EAAA,OAAO,kBAAA,CAAmB,IAAA,EAAM,KAAA,CAAM,OAAO,CAAA;AAC/C;;;ACpFO,IAAM,iBAAA,GAAoB;AAwC1B,SAAS,mBAAmB,MAAA,EAA2B;AAC5D,EAAA,OAAO,IAAA,CAAK,UAAU,MAAM,CAAA;AAC9B;AAEO,SAAS,2BAA2B,MAAA,EAAqC;AAC9E,EAAA,OAAO;AAAA,IACL,aAAA,EAAe,iBAAA;AAAA,IACf,QAAQ,MAAA,CAAO,MAAA;AAAA,IACf,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,MACpC,GAAG,KAAA;AAAA,MACH,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,GAAA,CAAI,CAAC,EAAE,WAAA,EAAa,YAAA,EAAc,GAAG,MAAA,EAAO,KAAM,MAAM;AAAA,KACjF,CAAE;AAAA,GACJ;AACF;AAEO,IAAM,kBAAA,GAAqB","file":"index.mjs","sourcesContent":["export const DDC_ERROR_CODES = [\n 'ddc-project-root-required',\n 'ddc-object-conflict',\n 'ddc-head-conflict',\n 'ddc-generation-conflict',\n 'ddc-scope-mismatch',\n 'ddc-lease-expired',\n] as const;\n\nexport type DdcContractErrorCode = (typeof DDC_ERROR_CODES)[number];\nexport type DdcEntryErrorCode = 'ddc-entry-incomplete' | 'ddc-entry-invalid' | 'ddc-entry-conflict';\nexport type DdcErrorCode = DdcContractErrorCode | DdcEntryErrorCode;\n\nexport type DdcErrorRootKind = 'build-cache' | 'project-ddc' | 'runtime';\n\nexport interface DdcRecoveryAction {\n readonly kind:\n | 'inspect'\n | 'allocate-generation'\n | 'retry'\n | 'cold-rebuild'\n | 'prune'\n | 'release-lease';\n readonly executable: boolean;\n readonly exactTarget?: string;\n readonly reason?: string;\n}\n\nexport interface DdcStoreErrorInit {\n readonly code: DdcErrorCode;\n readonly detail: string;\n readonly hint?: string;\n readonly expected?: unknown;\n readonly actual?: unknown;\n readonly owner?: string;\n readonly rootKind?: DdcErrorRootKind;\n readonly scope?: string;\n readonly generation?: number;\n readonly lease?: string;\n readonly revision?: number;\n readonly recoveryActions?: readonly DdcRecoveryAction[];\n readonly hostPath?: string;\n}\n\nexport interface DdcBrowserError {\n readonly code: DdcErrorCode;\n readonly hint: string;\n readonly expected: unknown;\n readonly actual?: unknown;\n readonly owner?: string;\n readonly rootKind?: DdcErrorRootKind;\n readonly scope?: string;\n readonly generation?: number;\n readonly lease?: string;\n readonly revision?: number;\n readonly recoveryActions: readonly Omit<DdcRecoveryAction, 'exactTarget'>[];\n}\n\nconst defaultHints: Record<DdcErrorCode, string> = {\n 'ddc-project-root-required': 'inject the canonical projectDdcRoot before serving or publishing',\n 'ddc-object-conflict': 'keep the verified object and reject the competing publication',\n 'ddc-head-conflict': 'inspect the current head and retry with a fresh revision',\n 'ddc-generation-conflict': 'allocate a new persistent generation; do not edit the counter',\n 'ddc-scope-mismatch': 'reinspect the canonical root and allocate a new scope',\n 'ddc-lease-expired': 'discard the stale commit and acquire a new lease',\n 'ddc-entry-incomplete': 'discard the partial entry and cold-cook from author authority',\n 'ddc-entry-invalid': 'preserve last-known-good, inspect the entry, then cold-cook',\n 'ddc-entry-conflict': 'keep the verified entry and reject the competing publication',\n};\n\nfunction defaultExpected(code: DdcErrorCode): unknown {\n if (code === 'ddc-project-root-required') return 'projectDdcRoot';\n if (code === 'ddc-entry-incomplete' || code === 'ddc-entry-invalid') {\n return 'a complete DDC entry whose receipt and integrity digests validate';\n }\n return 'a valid DDC owner, scope, generation, revision, and lease';\n}\n\nfunction defaultActions(code: DdcErrorCode): readonly DdcRecoveryAction[] {\n switch (code) {\n case 'ddc-project-root-required':\n case 'ddc-scope-mismatch':\n return [\n { kind: 'inspect', executable: true },\n { kind: 'retry', executable: true },\n ];\n case 'ddc-generation-conflict':\n return [{ kind: 'allocate-generation', executable: true }];\n case 'ddc-lease-expired':\n return [\n { kind: 'release-lease', executable: true },\n { kind: 'retry', executable: true },\n ];\n case 'ddc-object-conflict':\n case 'ddc-head-conflict':\n return [\n { kind: 'inspect', executable: true },\n { kind: 'retry', executable: true },\n ];\n case 'ddc-entry-incomplete':\n case 'ddc-entry-invalid':\n return [{ kind: 'cold-rebuild', executable: true }];\n case 'ddc-entry-conflict':\n return [{ kind: 'inspect', executable: true }];\n }\n}\n\nexport class DdcStoreError extends Error {\n public readonly code: DdcErrorCode;\n public readonly detail: string;\n public readonly hint: string;\n public readonly expected: unknown;\n public readonly actual: unknown;\n public readonly owner: string | undefined;\n public readonly rootKind: DdcErrorRootKind | undefined;\n public readonly scope: string | undefined;\n public readonly generation: number | undefined;\n public readonly lease: string | undefined;\n public readonly revision: number | undefined;\n public readonly recoveryActions: readonly DdcRecoveryAction[];\n public readonly hostPath: string | undefined;\n\n public constructor(code: DdcErrorCode, detail: string);\n public constructor(input: DdcStoreErrorInit);\n public constructor(inputOrCode: DdcStoreErrorInit | DdcErrorCode, legacyDetail?: string) {\n const input: DdcStoreErrorInit =\n typeof inputOrCode === 'string'\n ? { code: inputOrCode, detail: legacyDetail ?? inputOrCode }\n : inputOrCode;\n super(input.detail);\n this.name = 'DdcStoreError';\n this.code = input.code;\n this.detail = input.detail;\n this.hint = input.hint ?? defaultHints[input.code];\n this.expected = input.expected ?? defaultExpected(input.code);\n this.actual = input.actual;\n this.owner = input.owner;\n this.rootKind = input.rootKind;\n this.scope = input.scope;\n this.generation = input.generation;\n this.lease = input.lease;\n this.revision = input.revision;\n this.recoveryActions = input.recoveryActions ?? defaultActions(input.code);\n this.hostPath = input.hostPath;\n }\n\n public toBrowserProjection(): DdcBrowserError {\n return {\n code: this.code,\n hint: this.hint,\n expected: this.expected,\n ...(this.actual === undefined ? {} : { actual: this.actual }),\n ...(this.owner === undefined ? {} : { owner: this.owner }),\n ...(this.rootKind === undefined ? {} : { rootKind: this.rootKind }),\n ...(this.scope === undefined ? {} : { scope: this.scope }),\n ...(this.generation === undefined ? {} : { generation: this.generation }),\n ...(this.lease === undefined ? {} : { lease: this.lease }),\n ...(this.revision === undefined ? {} : { revision: this.revision }),\n recoveryActions: this.recoveryActions.map(\n ({ exactTarget: _exactTarget, ...action }) => action,\n ),\n };\n }\n}\n","import { createHash } from 'node:crypto';\n\nexport interface SemanticDdcInput {\n readonly schemaVersion: string;\n readonly importer: string;\n readonly codec: string;\n readonly settings: unknown;\n readonly sourceBytes: readonly Uint8Array[];\n readonly declaredGuids: readonly string[];\n readonly targetProfile: string;\n readonly producer: string;\n}\n\nexport function canonicalDdcJson(value: unknown): string {\n const sorted = sortValue(value);\n return JSON.stringify(sorted) ?? 'null';\n}\n\nfunction sortValue(value: unknown): unknown {\n if (value instanceof Uint8Array) {\n return { encoding: 'base64', bytes: Buffer.from(value).toString('base64') };\n }\n if (Array.isArray(value)) return value.map(sortValue);\n if (value !== null && typeof value === 'object') {\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(value as Record<string, unknown>).sort()) {\n result[key] = sortValue((value as Record<string, unknown>)[key]);\n }\n return result;\n }\n return value;\n}\n\nexport function semanticDdcKey(input: SemanticDdcInput): string {\n const semantic = {\n schemaVersion: input.schemaVersion,\n importer: input.importer,\n codec: input.codec,\n settings: input.settings,\n sourceBytes: input.sourceBytes,\n declaredGuids: [...input.declaredGuids].sort(),\n targetProfile: input.targetProfile,\n producer: input.producer,\n };\n return createHash('sha256').update(canonicalDdcJson(semantic)).digest('hex');\n}\n","import { createHash, randomUUID } from 'node:crypto';\nimport { mkdir, readdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { DdcStoreError } from './errors.js';\nimport { canonicalDdcJson } from './key.js';\n\nexport { DdcStoreError } from './errors.js';\n\nexport interface DdcArtifact {\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n}\n\nexport interface DdcReceipt {\n readonly guid: string;\n readonly key: string;\n readonly producer: string;\n readonly inputFingerprint: string;\n readonly outputDigest: string;\n}\n\nexport interface DdcEntry {\n readonly key: string;\n readonly guid: string;\n readonly payload: unknown;\n readonly refs: readonly string[];\n readonly artifacts: Readonly<Record<string, DdcArtifact>>;\n readonly receipt: DdcReceipt;\n}\n\nexport interface StagedDdcEntry {\n readonly key: string;\n readonly path: string;\n}\n\nexport interface PublishDdcEntryResult {\n readonly result: 'published' | 'existing' | 'conflict';\n readonly key: string;\n}\n\ninterface ArtifactIntegrity {\n readonly mediaType: string;\n readonly byteLength: number;\n readonly digest: string;\n}\n\ninterface EntryIntegrity {\n readonly payload: string;\n readonly refs: string;\n readonly receipt: string;\n readonly artifacts: Readonly<Record<string, ArtifactIntegrity>>;\n readonly entry: string;\n}\n\nfunction digest(value: string | Uint8Array): string {\n return createHash('sha256').update(value).digest('hex');\n}\n\nfunction artifactFile(key: string): string {\n if (/^[A-Za-z0-9._-]+$/.test(key)) return key;\n return Buffer.from(key, 'utf8').toString('base64url');\n}\n\nfunction validateKey(key: string): void {\n if (!/^[a-f0-9]{64}$/.test(key)) {\n throw new DdcStoreError('ddc-entry-invalid', `invalid semantic key: ${key}`);\n }\n}\n\nfunction errorCode(error: unknown): string | undefined {\n if (error !== null && typeof error === 'object' && 'code' in error) {\n const code = (error as { readonly code?: unknown }).code;\n return typeof code === 'string' ? code : undefined;\n }\n return undefined;\n}\n\nfunction sortedArtifacts(entry: DdcEntry): readonly [string, DdcArtifact][] {\n return Object.entries(entry.artifacts).sort(([left], [right]) => left.localeCompare(right));\n}\n\n/** The one output identity shared by receipt validation and DDC publication. */\nexport function ddcOutputDigest(\n entry: Pick<DdcEntry, 'guid' | 'payload' | 'refs' | 'artifacts'>,\n): string {\n return `sha256:${digest(\n canonicalDdcJson({\n guid: entry.guid,\n payload: entry.payload,\n refs: entry.refs,\n artifacts: Object.fromEntries(\n sortedArtifacts(entry as DdcEntry).map(([key, artifact]) => [\n key,\n {\n mediaType: artifact.mediaType,\n bytes: artifact.bytes,\n },\n ]),\n ),\n }),\n )}`;\n}\n\nfunction existingResult(\n existing: DdcEntry,\n candidate: DdcEntry,\n key: string,\n): PublishDdcEntryResult {\n return canonicalDdcJson(existing) === canonicalDdcJson(candidate)\n ? { result: 'existing', key }\n : { result: 'conflict', key };\n}\n\nfunction entryShape(entry: DdcEntry): Record<string, unknown> {\n return {\n key: entry.key,\n guid: entry.guid,\n payload: entry.payload,\n refs: entry.refs,\n receipt: entry.receipt,\n artifacts: Object.fromEntries(\n sortedArtifacts(entry).map(([key, artifact]) => [\n key,\n { mediaType: artifact.mediaType, byteLength: artifact.bytes.byteLength },\n ]),\n ),\n };\n}\n\nfunction integrityFor(entry: DdcEntry): EntryIntegrity {\n const artifacts = Object.fromEntries(\n sortedArtifacts(entry).map(([key, artifact]) => [\n key,\n {\n mediaType: artifact.mediaType,\n byteLength: artifact.bytes.byteLength,\n digest: digest(artifact.bytes),\n },\n ]),\n );\n return {\n payload: digest(canonicalDdcJson(entry.payload)),\n refs: digest(canonicalDdcJson(entry.refs)),\n receipt: digest(canonicalDdcJson(entry.receipt)),\n artifacts,\n entry: digest(canonicalDdcJson(entryShape(entry))),\n };\n}\n\nasync function readJson<T>(path: string): Promise<T> {\n return JSON.parse(await readFile(path, 'utf8')) as T;\n}\n\nexport class DdcEntryStore {\n private readonly entries: string;\n private readonly staging: string;\n\n public constructor(root: string) {\n this.entries = join(root, 'entries');\n this.staging = join(root, 'staging');\n }\n\n public async stage(entry: DdcEntry): Promise<StagedDdcEntry> {\n validateKey(entry.key);\n if (entry.receipt.key !== entry.key || entry.receipt.guid !== entry.guid) {\n throw new DdcStoreError('ddc-entry-invalid', 'receipt identity does not match entry');\n }\n if (entry.receipt.outputDigest !== ddcOutputDigest(entry)) {\n throw new DdcStoreError('ddc-entry-invalid', 'receipt output digest does not match entry');\n }\n const path = join(this.staging, `${entry.key}-${randomUUID()}`);\n await mkdir(join(path, 'artifacts'), { recursive: true });\n await writeFile(join(path, 'payload.json'), canonicalDdcJson(entry.payload));\n await writeFile(join(path, 'refs.json'), canonicalDdcJson(entry.refs));\n await writeFile(join(path, 'receipt.json'), canonicalDdcJson(entry.receipt));\n const artifacts: Record<string, { mediaType: string; file: string }> = {};\n for (const [key, artifact] of sortedArtifacts(entry)) {\n const file = artifactFile(key);\n artifacts[key] = { mediaType: artifact.mediaType, file };\n await writeFile(join(path, 'artifacts', `${file}.bin`), artifact.bytes);\n }\n await writeFile(join(path, 'artifacts.json'), canonicalDdcJson(artifacts));\n await writeFile(join(path, 'integrity.json'), canonicalDdcJson(integrityFor(entry)));\n return { key: entry.key, path };\n }\n\n public async publish(staged: StagedDdcEntry): Promise<PublishDdcEntryResult> {\n validateKey(staged.key);\n const candidate = await this.readDirectory(staged.path, true);\n const target = join(this.entries, staged.key);\n await mkdir(this.entries, { recursive: true });\n try {\n await stat(target);\n const existing = await this.readDirectory(target, false);\n await rm(staged.path, { recursive: true, force: true });\n return existingResult(existing, candidate, staged.key);\n } catch (error) {\n if (error instanceof DdcStoreError) throw error;\n if (errorCode(error) !== 'ENOENT') throw error;\n }\n try {\n await rename(staged.path, target);\n return { result: 'published', key: staged.key };\n } catch (error) {\n if (!['EEXIST', 'ENOTEMPTY', 'EISDIR'].includes(errorCode(error) ?? '')) throw error;\n const existing = await this.readDirectory(target, false);\n await rm(staged.path, { recursive: true, force: true });\n return existingResult(existing, candidate, staged.key);\n }\n }\n\n public async write(entry: DdcEntry): Promise<PublishDdcEntryResult> {\n const staged = await this.stage(entry);\n return this.publish(staged);\n }\n\n public async read(key: string): Promise<DdcEntry | null> {\n try {\n validateKey(key);\n return await this.readDirectory(join(this.entries, key), false);\n } catch {\n return null;\n }\n }\n\n public async listKeys(): Promise<readonly string[]> {\n const entries = await readdir(this.entries, { withFileTypes: true }).catch(() => []);\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name)\n .sort();\n }\n\n public async remove(key: string): Promise<void> {\n validateKey(key);\n await rm(join(this.entries, key), { recursive: true, force: false });\n }\n\n /** Read with a machine-readable corruption result for recovery tooling. */\n public async readChecked(\n key: string,\n ): Promise<\n | { readonly ok: true; readonly value: DdcEntry | null }\n | { readonly ok: false; readonly error: DdcStoreError }\n > {\n try {\n validateKey(key);\n try {\n await stat(join(this.entries, key));\n } catch (error) {\n if (errorCode(error) === 'ENOENT') return { ok: true, value: null };\n throw error;\n }\n try {\n return { ok: true, value: await this.readDirectory(join(this.entries, key), false) };\n } catch (error) {\n if (error instanceof DdcStoreError && error.code === 'ddc-entry-incomplete') {\n return { ok: true, value: null };\n }\n throw error;\n }\n } catch (error) {\n const normalized =\n error instanceof DdcStoreError\n ? error\n : new DdcStoreError('ddc-entry-invalid', 'entry is unreadable');\n return { ok: false, error: normalized };\n }\n }\n\n private async readDirectory(path: string, incompleteIsError: boolean): Promise<DdcEntry> {\n try {\n const payload = await readJson<unknown>(join(path, 'payload.json'));\n const refs = await readJson<readonly string[]>(join(path, 'refs.json'));\n const receipt = await readJson<DdcReceipt>(join(path, 'receipt.json'));\n const manifest = await readJson<\n Readonly<Record<string, { mediaType: string; file: string }>>\n >(join(path, 'artifacts.json'));\n const integrity = await readJson<EntryIntegrity>(join(path, 'integrity.json'));\n const artifacts: Record<string, DdcArtifact> = {};\n for (const [key, descriptor] of Object.entries(manifest).sort(([left], [right]) =>\n left.localeCompare(right),\n )) {\n const bytes = new Uint8Array(\n await readFile(join(path, 'artifacts', `${descriptor.file}.bin`)),\n );\n artifacts[key] = { mediaType: descriptor.mediaType, bytes };\n }\n const entry = { key: receipt.key, guid: receipt.guid, payload, refs, artifacts, receipt };\n if (entry.receipt.outputDigest !== ddcOutputDigest(entry)) {\n throw new DdcStoreError('ddc-entry-invalid', 'receipt output digest does not match entry');\n }\n const actual = integrityFor(entry);\n if (canonicalDdcJson(actual) !== canonicalDdcJson(integrity)) {\n throw new DdcStoreError('ddc-entry-invalid', 'entry integrity mismatch');\n }\n return entry;\n } catch (error) {\n if (incompleteIsError) {\n if (error instanceof DdcStoreError) throw error;\n throw new DdcStoreError('ddc-entry-incomplete', 'staged entry is incomplete');\n }\n if (error instanceof DdcStoreError) throw error;\n throw new DdcStoreError('ddc-entry-invalid', 'entry is unreadable');\n }\n }\n}\n","import { randomUUID } from 'node:crypto';\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { DdcEntryStore } from './entry-store.js';\nimport { DdcStoreError } from './errors.js';\n\nexport type DdcLifecycleState = 'missing' | 'cooking' | 'current' | 'stale' | 'failed';\n\nexport interface DdcLease {\n readonly guid: string;\n readonly desiredKey: string;\n readonly attempt: string;\n readonly generation: number;\n readonly expectedRevision: number;\n readonly instanceId: string;\n readonly expiresAt: number;\n}\n\nexport interface DdcHead {\n readonly guid: string;\n readonly desiredKey: string;\n readonly state: DdcLifecycleState;\n readonly currentKey: string | undefined;\n readonly lastKnownGoodKey: string | undefined;\n readonly revision?: number;\n readonly generation?: number;\n readonly activeLease?: DdcLease;\n readonly failure?: { readonly code: string; readonly detail: string };\n}\n\nexport interface DdcCommitResult {\n readonly result: 'current' | 'stale' | 'lease-lost' | 'invalid';\n readonly key: string;\n readonly revision?: number;\n}\n\ninterface HeadRecord {\n readonly guid: string;\n readonly desiredKey: string;\n readonly revision: number;\n readonly currentKey?: string;\n readonly lastKnownGoodKey?: string;\n readonly generation?: number;\n readonly active?: DdcLease;\n readonly supersededAttempts?: readonly string[];\n readonly stale?: boolean;\n readonly failure?: {\n readonly desiredKey: string;\n readonly code: string;\n readonly detail: string;\n };\n}\n\ninterface GenerationRecord {\n readonly schemaVersion: 'forgeax-ddc-generation/v2';\n readonly next: number;\n}\n\nconst LOCK_WAIT_MS = 10;\nconst LOCK_TIMEOUT_MS = 5000;\nconst LEASE_TTL_MS = 30_000;\n\nfunction headFile(heads: string, guid: string): string {\n return join(heads, `${encodeURIComponent(guid)}.json`);\n}\n\nfunction lockFile(root: string, name: string): string {\n return join(root, 'locks', `${encodeURIComponent(name)}.lock`);\n}\n\nfunction withRevision(\n result: Omit<DdcCommitResult, 'revision'>,\n revision: number,\n): DdcCommitResult {\n const value = { ...result } as DdcCommitResult;\n Object.defineProperty(value, 'revision', { value: revision, enumerable: false });\n return value;\n}\n\nasync function delay(ms: number): Promise<void> {\n await new Promise((resolveDelay) => setTimeout(resolveDelay, ms));\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n\nfunction isNonNegativeInteger(value: unknown): value is number {\n return typeof value === 'number' && Number.isInteger(value) && value >= 0;\n}\n\nfunction isLeaseRecord(value: unknown): value is DdcLease {\n if (!isRecord(value)) return false;\n return (\n isString(value.guid) &&\n isString(value.desiredKey) &&\n isString(value.attempt) &&\n isNonNegativeInteger(value.generation) &&\n isNonNegativeInteger(value.expectedRevision) &&\n isString(value.instanceId) &&\n typeof value.expiresAt === 'number' &&\n Number.isFinite(value.expiresAt)\n );\n}\n\nfunction isHeadRecord(value: unknown): value is HeadRecord {\n if (!isRecord(value)) return false;\n if (\n !isString(value.guid) ||\n !isString(value.desiredKey) ||\n !isNonNegativeInteger(value.revision)\n ) {\n return false;\n }\n if (value.currentKey !== undefined && !isString(value.currentKey)) return false;\n if (value.lastKnownGoodKey !== undefined && !isString(value.lastKnownGoodKey)) return false;\n if (\n value.generation !== undefined &&\n (!isNonNegativeInteger(value.generation) || value.generation === 0)\n ) {\n return false;\n }\n if (value.active !== undefined && !isLeaseRecord(value.active)) return false;\n if (\n value.supersededAttempts !== undefined &&\n (!Array.isArray(value.supersededAttempts) || !value.supersededAttempts.every(isString))\n ) {\n return false;\n }\n if (value.stale !== undefined && typeof value.stale !== 'boolean') return false;\n if (value.failure !== undefined) {\n if (!isRecord(value.failure)) return false;\n if (\n !isString(value.failure.desiredKey) ||\n !isString(value.failure.code) ||\n !isString(value.failure.detail)\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction malformedHeadError(\n actual: 'syntax-invalid' | 'schema-invalid' | 'unreadable',\n): DdcStoreError {\n const detail =\n actual === 'syntax-invalid'\n ? 'DDC head JSON is syntactically invalid'\n : actual === 'schema-invalid'\n ? 'DDC head record does not match the lifecycle schema'\n : 'DDC head file is not readable';\n return new DdcStoreError({\n code: 'ddc-head-conflict',\n detail,\n expected: 'a valid DDC head record',\n actual,\n hint: 'inspect the current head and retry with a fresh revision',\n owner: 'engine-ddc',\n rootKind: 'project-ddc',\n recoveryActions: [\n { kind: 'inspect', executable: true },\n { kind: 'retry', executable: true },\n ],\n });\n}\n\n/** Cross-process mkdir lock; a lock owned by a dead PID is reclaimable. */\nexport async function withDdcLock<T>(\n root: string,\n name: string,\n operation: () => Promise<T>,\n): Promise<T> {\n const path = lockFile(root, name);\n await mkdir(join(root, 'locks'), { recursive: true });\n const deadline = Date.now() + LOCK_TIMEOUT_MS;\n while (true) {\n try {\n await mkdir(path);\n await writeFile(\n join(path, 'owner.json'),\n JSON.stringify({ pid: process.pid, acquiredAt: Date.now() }),\n );\n try {\n return await operation();\n } finally {\n await rm(path, { recursive: true, force: true });\n }\n } catch (error) {\n if ((error as { code?: string }).code !== 'EEXIST') throw error;\n let ownerPid: number | undefined;\n try {\n ownerPid = (\n JSON.parse(await readFile(join(path, 'owner.json'), 'utf8')) as { pid?: number }\n ).pid;\n } catch {\n ownerPid = undefined;\n }\n // mkdir() publishes the lock directory before the owner record can be\n // written. Treat that short publication window as an in-flight lock,\n // not as a dead owner: reclaiming it here lets two processes enter the\n // same critical section and loses the superseded-attempt fence.\n if (ownerPid === undefined) {\n if (Date.now() >= deadline) {\n throw new DdcStoreError({\n code: 'ddc-lease-expired',\n detail: `DDC lock ${name} did not publish an owner record`,\n hint: 'inspect the lock owner and retry after the incomplete instance exits',\n expected: 'a lock owner record',\n actual: { path },\n rootKind: 'project-ddc',\n });\n }\n await delay(LOCK_WAIT_MS);\n continue;\n }\n let alive = false;\n try {\n process.kill(ownerPid, 0);\n alive = true;\n } catch {\n alive = false;\n }\n if (!alive) {\n await rm(path, { recursive: true, force: true });\n continue;\n }\n if (Date.now() >= deadline) {\n throw new DdcStoreError({\n code: 'ddc-lease-expired',\n detail: `DDC lock ${name} remained owned by process ${ownerPid}`,\n hint: 'inspect the owner and retry after the stale instance exits',\n expected: 'an available project lock',\n actual: { ownerPid },\n rootKind: 'project-ddc',\n lease: String(ownerPid),\n });\n }\n await delay(LOCK_WAIT_MS);\n }\n }\n}\n\nexport class DdcLifecycle {\n private readonly heads: string;\n private readonly entries: DdcEntryStore;\n private readonly root: string;\n private readonly leaseTtlMs: number;\n\n public constructor(root: string, options?: { readonly leaseTtlMs?: number }) {\n this.root = root;\n this.heads = join(root, 'heads');\n this.entries = new DdcEntryStore(root);\n this.leaseTtlMs = options?.leaseTtlMs ?? LEASE_TTL_MS;\n }\n\n public async inspect(guid: string, desiredKey: string): Promise<DdcHead> {\n const record = await this.read(guid);\n if (record === null) {\n return {\n guid,\n desiredKey,\n state: 'missing',\n currentKey: undefined,\n lastKnownGoodKey: undefined,\n revision: 0,\n };\n }\n const recordedFailure =\n record.failure?.desiredKey === desiredKey\n ? { code: record.failure.code, detail: record.failure.detail }\n : undefined;\n const currentEntry =\n record.currentKey === undefined ? null : await this.entries.readChecked(record.currentKey);\n const entryFailure =\n currentEntry !== null && !currentEntry.ok\n ? { code: currentEntry.error.code, detail: currentEntry.error.detail }\n : undefined;\n const failure = recordedFailure ?? entryFailure;\n const currentValue = currentEntry?.ok === true ? currentEntry.value : null;\n const state: DdcLifecycleState =\n failure !== undefined\n ? 'failed'\n : record.currentKey === desiredKey && currentValue?.guid === guid\n ? 'current'\n : record.stale === true\n ? 'stale'\n : record.active?.desiredKey === desiredKey\n ? 'cooking'\n : 'stale';\n return {\n guid,\n desiredKey,\n state,\n currentKey: record.currentKey,\n lastKnownGoodKey: record.lastKnownGoodKey,\n revision: record.revision,\n ...(record.generation === undefined ? {} : { generation: record.generation }),\n ...(record.active === undefined ? {} : { activeLease: record.active }),\n ...(failure === undefined ? {} : { failure }),\n };\n }\n\n public async begin(guid: string, desiredKey: string): Promise<DdcLease> {\n return withDdcLock(this.root, `head-${guid}`, async () => {\n const previous = await this.read(guid);\n const generation = await this.allocateGeneration();\n const lease: DdcLease = {\n guid,\n desiredKey,\n attempt: randomUUID(),\n generation,\n expectedRevision: previous?.revision ?? 0,\n instanceId: `${process.pid}:${randomUUID()}`,\n expiresAt: Date.now() + this.leaseTtlMs,\n };\n const lastKnownGoodKey =\n previous?.currentKey !== undefined && previous.currentKey !== desiredKey\n ? previous.currentKey\n : previous?.lastKnownGoodKey;\n const supersededAttempts = [\n ...(previous?.supersededAttempts ?? []),\n ...(previous?.active === undefined ? [] : [previous.active.attempt]),\n ];\n await this.write({\n guid,\n desiredKey,\n revision: previous?.revision ?? 0,\n generation,\n active: lease,\n ...(previous?.currentKey === undefined ? {} : { currentKey: previous.currentKey }),\n ...(supersededAttempts.length === 0 ? {} : { supersededAttempts }),\n ...(lastKnownGoodKey === undefined ? {} : { lastKnownGoodKey }),\n });\n return lease;\n });\n }\n\n public async commit(lease: DdcLease, validatedKey: string): Promise<DdcCommitResult> {\n return withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.attempt !== lease.attempt) {\n if (current?.supersededAttempts?.includes(lease.attempt)) {\n await this.write({ ...current, stale: true });\n return withRevision({ result: 'stale', key: validatedKey }, current.revision);\n }\n return withRevision({ result: 'lease-lost', key: validatedKey }, current?.revision ?? 0);\n }\n if (Date.now() > lease.expiresAt) {\n throw new DdcStoreError({\n code: 'ddc-lease-expired',\n detail: 'cook lease expired before commit fencing',\n expected: { attempt: lease.attempt, revision: lease.expectedRevision },\n actual: { revision: current.revision },\n owner: 'engine-ddc',\n rootKind: 'project-ddc',\n generation: lease.generation,\n lease: lease.attempt,\n revision: current.revision,\n });\n }\n if (\n current.revision !== lease.expectedRevision ||\n current.desiredKey !== lease.desiredKey ||\n validatedKey !== lease.desiredKey\n ) {\n await this.write({ ...current, stale: true });\n return withRevision({ result: 'stale', key: validatedKey }, current.revision);\n }\n const entry = await this.entries.read(validatedKey);\n if (entry === null || entry.guid !== lease.guid || entry.receipt.key !== validatedKey) {\n await this.write({\n guid: lease.guid,\n desiredKey: lease.desiredKey,\n revision: current.revision + 1,\n generation: lease.generation,\n ...(current.lastKnownGoodKey === undefined\n ? {}\n : { lastKnownGoodKey: current.lastKnownGoodKey }),\n failure: {\n desiredKey: lease.desiredKey,\n code: 'entry-invalid',\n detail: 'validated DDC key has no readable entry for this asset',\n },\n });\n return withRevision({ result: 'invalid', key: validatedKey }, current.revision + 1);\n }\n const lastKnownGoodKey =\n current.currentKey !== undefined && current.currentKey !== validatedKey\n ? current.currentKey\n : current.lastKnownGoodKey;\n const nextRevision = current.revision + 1;\n await this.write({\n guid: lease.guid,\n desiredKey: lease.desiredKey,\n revision: nextRevision,\n generation: lease.generation,\n currentKey: validatedKey,\n stale: false,\n ...(current.supersededAttempts === undefined\n ? {}\n : { supersededAttempts: current.supersededAttempts }),\n ...(lastKnownGoodKey === undefined ? {} : { lastKnownGoodKey }),\n });\n return withRevision({ result: 'current', key: validatedKey }, nextRevision);\n });\n }\n\n public async fail(\n lease: DdcLease,\n failure: { readonly code: string; readonly detail: string },\n ): Promise<void> {\n await withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.attempt !== lease.attempt) return;\n await this.write({\n guid: lease.guid,\n desiredKey: lease.desiredKey,\n revision: current.revision + 1,\n generation: lease.generation,\n ...(current.currentKey === undefined ? {} : { currentKey: current.currentKey }),\n ...(current.lastKnownGoodKey === undefined\n ? {}\n : { lastKnownGoodKey: current.lastKnownGoodKey }),\n failure: { desiredKey: lease.desiredKey, ...failure },\n });\n });\n }\n\n public async heartbeat(lease: DdcLease): Promise<DdcLease> {\n return withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.attempt !== lease.attempt) {\n throw new DdcStoreError({\n code: 'ddc-lease-expired',\n detail: 'heartbeat belongs to a stale lease',\n expected: lease.attempt,\n actual: current?.active?.attempt,\n lease: lease.attempt,\n generation: lease.generation,\n rootKind: 'project-ddc',\n });\n }\n const refreshed = { ...lease, expiresAt: Date.now() + this.leaseTtlMs };\n await this.write({ ...current, active: refreshed });\n return refreshed;\n });\n }\n\n public async close(lease: DdcLease): Promise<void> {\n await withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.instanceId !== lease.instanceId) return;\n const { active: _active, ...withoutActive } = current;\n await this.write({\n ...withoutActive,\n revision: current.revision + 1,\n stale: current.currentKey === undefined,\n });\n });\n }\n\n public async revoke(lease: DdcLease): Promise<void> {\n await this.fail(lease, {\n code: 'lease-lost',\n detail: 'cook lease was revoked before validation',\n });\n }\n\n public async recover(guid: string, desiredKey: string): Promise<DdcHead> {\n return withDdcLock(this.root, `head-${guid}`, async () => {\n const current = await this.read(guid);\n if (current?.active?.desiredKey === desiredKey) {\n await this.write({\n guid,\n desiredKey,\n revision: current.revision + 1,\n ...(current.lastKnownGoodKey === undefined\n ? {}\n : { lastKnownGoodKey: current.lastKnownGoodKey }),\n failure: {\n desiredKey,\n code: 'writer-crashed',\n detail: 'active cook attempt was recovered after process interruption',\n },\n });\n }\n return this.inspect(guid, desiredKey);\n });\n }\n\n private async allocateGeneration(): Promise<number> {\n const path = join(this.root, 'generations', 'counter.json');\n await mkdir(join(this.root, 'generations'), { recursive: true });\n let next = 1;\n try {\n const record = JSON.parse(await readFile(path, 'utf8')) as GenerationRecord;\n if (record.schemaVersion === 'forgeax-ddc-generation/v2' && Number.isInteger(record.next))\n next = Math.max(1, record.next);\n } catch {\n // A missing counter is the first allocation, not an implicit legacy fallback.\n }\n const temporary = `${path}.${process.pid}.${randomUUID()}.tmp`;\n await writeFile(\n temporary,\n JSON.stringify({ schemaVersion: 'forgeax-ddc-generation/v2', next: next + 1 }),\n );\n await rename(temporary, path);\n return next;\n }\n\n private async read(guid: string): Promise<HeadRecord | null> {\n const path = headFile(this.heads, guid);\n let source: string;\n try {\n source = await readFile(path, 'utf8');\n } catch (error) {\n if (\n error !== null &&\n typeof error === 'object' &&\n 'code' in error &&\n (error as { readonly code?: unknown }).code === 'ENOENT'\n ) {\n return null;\n }\n throw malformedHeadError('unreadable');\n }\n let value: unknown;\n try {\n value = JSON.parse(source);\n } catch {\n throw malformedHeadError('syntax-invalid');\n }\n if (!isHeadRecord(value) || value.guid !== guid) throw malformedHeadError('schema-invalid');\n return value;\n }\n\n private async write(record: HeadRecord): Promise<void> {\n await mkdir(this.heads, { recursive: true });\n const path = headFile(this.heads, record.guid);\n const temporary = `${path}.${randomUUID()}.tmp`;\n await writeFile(temporary, JSON.stringify(record));\n await rename(temporary, path);\n }\n}\n","import { readdir, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { withDdcLock } from './lifecycle.js';\n\nexport interface DdcGcInput {\n readonly currentKeys: readonly string[];\n readonly lastKnownGoodKeys: readonly string[];\n readonly activeLeaseKeys: readonly string[];\n readonly scopeIds?: readonly string[];\n}\n\nexport interface DdcGcResult {\n readonly deleted: readonly string[];\n readonly protected: readonly string[];\n}\n\n/** Mark current/LKG/lease roots, then sweep only the same project root. */\nexport async function collectDdcGarbage(root: string, input: DdcGcInput): Promise<DdcGcResult> {\n return withDdcLock(root, 'gc', async () => {\n const protectedKeys = new Set([\n ...input.currentKeys,\n ...input.lastKnownGoodKeys,\n ...input.activeLeaseKeys,\n ]);\n const entries = await readdir(join(root, 'entries'), { withFileTypes: true }).catch(() => []);\n const deleted: string[] = [];\n for (const entry of entries) {\n if (!entry.isDirectory() || protectedKeys.has(entry.name)) continue;\n await rm(join(root, 'entries', entry.name), { recursive: true, force: false });\n deleted.push(entry.name);\n }\n return { deleted, protected: [...protectedKeys].sort() };\n });\n}\n","import { isAbsolute, normalize } from 'node:path';\n\nexport const DDC_LAYOUT_VERSION = 'v2' as const;\n\nexport interface DdcBuildOptions {\n readonly buildCacheRoot: string;\n}\n\nexport interface DdcServeOptions extends DdcBuildOptions {\n readonly projectDdcRoot?: string;\n}\n\nexport interface DdcBuildLayout {\n readonly objects: string;\n readonly staging: string;\n}\n\nexport interface DdcProjectLayout {\n readonly root: string;\n readonly scope: string;\n readonly heads: string;\n readonly generations: string;\n readonly leases: string;\n readonly staging: string;\n}\n\nexport interface DdcLayout {\n readonly version: typeof DDC_LAYOUT_VERSION;\n readonly buildCacheRoot: string;\n readonly projectDdcRoot: string;\n readonly build: DdcBuildLayout;\n readonly project: DdcProjectLayout;\n}\n\nexport interface DdcBuildLayoutResult {\n readonly ok: true;\n readonly value: DdcBuildLayout;\n}\n\nexport interface DdcLayoutError {\n readonly code: 'ddc-project-root-required' | 'ddc-root-absolute-required';\n readonly detail: string;\n readonly hint: string;\n readonly expected: string;\n readonly actual?: string;\n}\n\nexport interface DdcLayoutResult {\n readonly ok: true;\n readonly value: DdcLayout;\n}\n\nexport interface DdcLayoutFailure {\n readonly ok: false;\n readonly error: DdcLayoutError;\n}\n\ntype ClosedLayoutResult = DdcLayoutResult | DdcLayoutFailure;\n\nfunction rootOrError(root: string, name: string): string | DdcLayoutError {\n if (!isAbsolute(root)) {\n return {\n code: 'ddc-root-absolute-required',\n detail: `${name} must be an absolute injected path`,\n hint: `inject the canonical ${name} from the host root policy`,\n expected: 'an absolute filesystem path',\n actual: root,\n };\n }\n const normalized = normalize(root);\n return normalized.replace(/[\\\\/]+$/, '') || normalized;\n}\n\nfunction buildLayout(root: string): DdcBuildLayout {\n return { objects: `${root}/objects`, staging: `${root}/staging` };\n}\n\nfunction projectLayout(root: string): DdcProjectLayout {\n return {\n root,\n scope: `${root}/scope.json`,\n heads: `${root}/heads`,\n generations: `${root}/generations`,\n leases: `${root}/leases`,\n staging: `${root}/staging`,\n };\n}\n\nexport function resolveBuildDdcLayout(\n options: DdcBuildOptions,\n): DdcBuildLayoutResult | DdcLayoutFailure {\n const root = rootOrError(options.buildCacheRoot, 'buildCacheRoot');\n return typeof root === 'string'\n ? { ok: true, value: buildLayout(root) }\n : { ok: false, error: root };\n}\n\nexport function resolveDdcLayout(options: DdcServeOptions): ClosedLayoutResult {\n const buildRoot = rootOrError(options.buildCacheRoot, 'buildCacheRoot');\n if (typeof buildRoot !== 'string') return { ok: false, error: buildRoot };\n if (options.projectDdcRoot === undefined || options.projectDdcRoot.trim().length === 0) {\n return {\n ok: false,\n error: {\n code: 'ddc-project-root-required',\n detail: 'serve and publication require an explicitly injected projectDdcRoot',\n hint: 'canonicalize the game directory in the host and inject its .forgeax/ddc/v2 root',\n expected: 'projectDdcRoot',\n },\n };\n }\n const projectRoot = rootOrError(options.projectDdcRoot, 'projectDdcRoot');\n if (typeof projectRoot !== 'string') return { ok: false, error: projectRoot };\n return {\n ok: true,\n value: {\n version: DDC_LAYOUT_VERSION,\n buildCacheRoot: buildRoot,\n projectDdcRoot: projectRoot,\n build: buildLayout(buildRoot),\n project: projectLayout(projectRoot),\n },\n };\n}\n\nexport function isDdcLayout(value: unknown): value is DdcLayout {\n return (\n value !== null &&\n typeof value === 'object' &&\n (value as { readonly version?: unknown }).version === DDC_LAYOUT_VERSION\n );\n}\n","import { createHash } from 'node:crypto';\nimport { mkdir, readFile, rename, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { DdcStoreError } from './errors.js';\n\nexport interface DdcRuntimeScope {\n readonly scopeId: string;\n readonly scopeHash: string;\n readonly root: string;\n readonly metadataPath: string;\n}\n\ninterface ScopeMetadata {\n readonly schemaVersion: 'forgeax-ddc-scope/v2';\n readonly scopeId: string;\n readonly scopeHash: string;\n}\n\nfunction scopeHash(scopeId: string): string {\n return createHash('sha256').update(scopeId, 'utf8').digest('hex');\n}\n\nexport function runtimeScopeHash(scopeId: string): string {\n return scopeHash(scopeId);\n}\n\nexport async function createRuntimeScope(root: string, scopeId: string): Promise<DdcRuntimeScope> {\n if (scopeId.length === 0) {\n throw new DdcStoreError({\n code: 'ddc-scope-mismatch',\n detail: 'runtime scope id must not be empty',\n expected: 'a non-empty original scope id',\n actual: scopeId,\n rootKind: 'project-ddc',\n });\n }\n const hash = scopeHash(scopeId);\n const scopeRoot = join(root, 'scopes', hash);\n const metadataPath = join(scopeRoot, 'scope.json');\n await mkdir(scopeRoot, { recursive: true });\n const expected: ScopeMetadata = {\n schemaVersion: 'forgeax-ddc-scope/v2',\n scopeId,\n scopeHash: hash,\n };\n try {\n const actual = JSON.parse(await readFile(metadataPath, 'utf8')) as Partial<ScopeMetadata>;\n if (\n actual.schemaVersion !== expected.schemaVersion ||\n actual.scopeId !== expected.scopeId ||\n actual.scopeHash !== expected.scopeHash\n ) {\n throw new DdcStoreError({\n code: 'ddc-scope-mismatch',\n detail: 'runtime scope metadata does not match the requested scope',\n expected,\n actual,\n rootKind: 'project-ddc',\n scope: scopeId,\n });\n }\n } catch (error) {\n if (error instanceof DdcStoreError) throw error;\n const temporary = `${metadataPath}.${process.pid}.tmp`;\n await writeFile(temporary, JSON.stringify(expected));\n await rename(temporary, metadataPath);\n }\n return { scopeId, scopeHash: hash, root: scopeRoot, metadataPath };\n}\n\nexport async function assertRuntimeScope(\n root: string,\n scope: Pick<DdcRuntimeScope, 'scopeId' | 'scopeHash'>,\n): Promise<DdcRuntimeScope> {\n const expectedHash = scopeHash(scope.scopeId);\n if (scope.scopeHash !== expectedHash) {\n throw new DdcStoreError({\n code: 'ddc-scope-mismatch',\n detail: 'runtime scope hash does not match the original scope id',\n expected: expectedHash,\n actual: scope.scopeHash,\n rootKind: 'project-ddc',\n scope: scope.scopeId,\n });\n }\n return createRuntimeScope(root, scope.scopeId);\n}\n","import type { DdcErrorRootKind } from './errors.js';\n\nexport const DDC_STATUS_SCHEMA = 'forgeax-ddc-status/v2' as const;\n\nexport type DdcStatusHealth = 'ready' | 'blocked' | 'missing' | 'stale' | 'failed';\nexport type DdcStatusLayerKind = 'build' | 'project' | 'runtime';\nexport type DdcStatusRootKind = DdcErrorRootKind;\n\nexport interface DdcRecoveryAction {\n readonly kind: 'inspect' | 'allocate-generation' | 'retry' | 'cold-rebuild' | 'prune';\n readonly executable: boolean;\n readonly exactTarget?: string;\n readonly reason?: string;\n}\n\nexport interface DdcStatusLayer {\n readonly kind: DdcStatusLayerKind;\n readonly owner: 'engine-ddc' | 'engine-pack' | 'plugin' | 'runtime';\n readonly rootKind: DdcStatusRootKind;\n readonly scopeId?: string;\n readonly current?: number | string;\n readonly lastKnownGood?: number | string;\n readonly protection: readonly string[];\n readonly actions: readonly DdcRecoveryAction[];\n}\n\nexport interface DdcStatus {\n readonly schemaVersion: typeof DDC_STATUS_SCHEMA;\n readonly health: DdcStatusHealth;\n readonly layers: readonly DdcStatusLayer[];\n readonly gameDir?: string;\n readonly projectDdcRoot?: string;\n}\n\nexport type BrowserDdcRecoveryAction = Omit<DdcRecoveryAction, 'exactTarget'>;\nexport type BrowserDdcStatusLayer = Omit<DdcStatusLayer, 'actions'> & {\n readonly actions: readonly BrowserDdcRecoveryAction[];\n};\nexport type BrowserDdcStatus = Omit<DdcStatus, 'gameDir' | 'projectDdcRoot' | 'layers'> & {\n readonly layers: readonly BrowserDdcStatusLayer[];\n};\n\nexport function serializeDdcStatus(status: DdcStatus): string {\n return JSON.stringify(status);\n}\n\nexport function projectDdcStatusForBrowser(status: DdcStatus): BrowserDdcStatus {\n return {\n schemaVersion: DDC_STATUS_SCHEMA,\n health: status.health,\n layers: status.layers.map((layer) => ({\n ...layer,\n actions: layer.actions.map(({ exactTarget: _exactTarget, ...action }) => action),\n })),\n };\n}\n\nexport const toBrowserDdcStatus = projectDdcStatusForBrowser;\n"]}
1
+ {"version":3,"sources":["../src/key.ts","../src/build-cache.ts","../src/errors.ts","../src/entry-store.ts","../src/lifecycle.ts","../src/gc.ts","../src/layout.ts","../src/publication.ts","../src/runtime-scope.ts","../src/session.ts","../src/status.ts"],"names":["digest","createHash","join","mkdir","writeFile","rm","readFile","failure","randomUUID","rename","readdir","delay"],"mappings":";;;;;;;AAaO,SAAS,iBAAiB,KAAA,EAAwB;AACvD,EAAA,MAAM,MAA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CAAM,MAAM;AACX,QAAA,IAAA,CAAK,cAAc,SAAS,CAAA;AAAA,MAC9B,CAAC,CAAA;AAAA,IACL,GAAGA,MAAK,CAAA;AACR,IAAA,KAAA,CAAM,KAAA,IAAQ;AACd,IAAA,IAAA,CAAK,eAAA,CAAgB,GAAA,CAAI,OAAA,EAAS,KAAK,CAAA;AAAA,EACzC;AAAA,EAEQ,cAAc,SAAA,EAAyC;AAC7D,IAAA,MAAM,QAAQ,IAAA,CAAK,eAAA,CAAgB,GAAA,CAAI,SAAA,CAAU,MAAM,OAAO,CAAA;AAC9D,IAAA,IAAI,UAAU,MAAA,EAAW;AACzB,IAAA,YAAA,CAAa,KAAK,CAAA;AAClB,IAAA,IAAA,CAAK,eAAA,CAAgB,MAAA,CAAO,SAAA,CAAU,KAAA,CAAM,OAAO,CAAA;AAAA,EACrD;AACF;;;AC3PO,IAAM,iBAAA,GAAoB;AAwC1B,SAAS,mBAAmB,MAAA,EAA2B;AAC5D,EAAA,OAAO,IAAA,CAAK,UAAU,MAAM,CAAA;AAC9B;AAEO,SAAS,2BAA2B,MAAA,EAAqC;AAC9E,EAAA,OAAO;AAAA,IACL,aAAA,EAAe,iBAAA;AAAA,IACf,QAAQ,MAAA,CAAO,MAAA;AAAA,IACf,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,MACpC,GAAG,KAAA;AAAA,MACH,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,GAAA,CAAI,CAAC,EAAE,WAAA,EAAa,YAAA,EAAc,GAAG,MAAA,EAAO,KAAM,MAAM;AAAA,KACjF,CAAE;AAAA,GACJ;AACF;AAEO,IAAM,kBAAA,GAAqB","file":"index.mjs","sourcesContent":["import { createHash } from 'node:crypto';\n\nexport interface SemanticDdcInput {\n readonly schemaVersion: string;\n readonly importer: string;\n readonly codec: string;\n readonly settings: unknown;\n readonly sourceBytes: readonly Uint8Array[];\n readonly declaredGuids: readonly string[];\n readonly targetProfile: string;\n readonly producer: string;\n}\n\nexport function canonicalDdcJson(value: unknown): string {\n const sorted = sortValue(value);\n return JSON.stringify(sorted) ?? 'null';\n}\n\nfunction sortValue(value: unknown): unknown {\n if (value instanceof Uint8Array) {\n return { encoding: 'base64', bytes: Buffer.from(value).toString('base64') };\n }\n if (Array.isArray(value)) return value.map(sortValue);\n if (value !== null && typeof value === 'object') {\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(value as Record<string, unknown>).sort()) {\n result[key] = sortValue((value as Record<string, unknown>)[key]);\n }\n return result;\n }\n return value;\n}\n\nexport function semanticDdcKey(input: SemanticDdcInput): string {\n const semantic = {\n schemaVersion: input.schemaVersion,\n importer: input.importer,\n codec: input.codec,\n settings: input.settings,\n sourceBytes: input.sourceBytes,\n declaredGuids: [...input.declaredGuids].sort(),\n targetProfile: input.targetProfile,\n producer: input.producer,\n };\n return createHash('sha256').update(canonicalDdcJson(semantic)).digest('hex');\n}\n","import { existsSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { semanticDdcKey as ownerSemanticDdcKey } from './key.js';\n\nexport interface BuildDdcInput {\n readonly schemaVersion: string;\n readonly importerVersion: string;\n readonly codecVersion: string;\n readonly sourceDependencies: readonly (\n | string\n | { readonly path: string; readonly digest: string }\n )[];\n readonly settings: unknown;\n readonly declaredGuids: readonly string[];\n readonly cookProfile: string;\n readonly sourceOverrides?: unknown;\n readonly publish?: unknown;\n}\n\nexport function resolveDdcRoot(cwd: string): string {\n let current = resolve(cwd);\n while (true) {\n if (existsSync(join(current, 'pnpm-workspace.yaml'))) {\n return join(current, 'node_modules/.cache/forgeax-ddc');\n }\n const parent = dirname(current);\n if (parent === current) return join(resolve(cwd), 'node_modules/.cache/forgeax-ddc');\n current = parent;\n }\n}\n\n/** Derive the build key while keeping publish URLs out of the semantic identity. */\nexport function semanticBuildKey(input: BuildDdcInput): string {\n const hasSourceOverrides =\n input.sourceOverrides !== undefined &&\n typeof input.sourceOverrides === 'object' &&\n input.sourceOverrides !== null &&\n !Array.isArray(input.sourceOverrides) &&\n Object.keys(input.sourceOverrides).length > 0;\n const settings = hasSourceOverrides\n ? { settings: input.settings, sourceOverrides: input.sourceOverrides }\n : input.settings;\n return ownerSemanticDdcKey({\n schemaVersion: input.schemaVersion,\n importer: input.importerVersion,\n codec: input.codecVersion,\n settings,\n sourceBytes: input.sourceDependencies\n .map((dependency) =>\n typeof dependency === 'string'\n ? dependency.replaceAll('\\\\', '/').replace(/^.*\\/(assets\\/)/, '$1')\n : dependency.digest,\n )\n .sort()\n .map((digest) => new TextEncoder().encode(digest)),\n declaredGuids: input.declaredGuids,\n targetProfile: input.cookProfile,\n producer: input.importerVersion,\n });\n}\n","export const DDC_ERROR_CODES = [\n 'ddc-project-root-required',\n 'ddc-object-conflict',\n 'ddc-head-conflict',\n 'ddc-generation-conflict',\n 'ddc-scope-mismatch',\n 'ddc-lease-expired',\n] as const;\n\nexport type DdcContractErrorCode = (typeof DDC_ERROR_CODES)[number];\nexport type DdcEntryErrorCode = 'ddc-entry-incomplete' | 'ddc-entry-invalid' | 'ddc-entry-conflict';\nexport type DdcErrorCode = DdcContractErrorCode | DdcEntryErrorCode;\n\nexport type DdcErrorRootKind = 'build-cache' | 'project-ddc' | 'runtime';\n\nexport interface DdcRecoveryAction {\n readonly kind:\n | 'inspect'\n | 'allocate-generation'\n | 'retry'\n | 'cold-rebuild'\n | 'prune'\n | 'release-lease';\n readonly executable: boolean;\n readonly exactTarget?: string;\n readonly reason?: string;\n}\n\nexport interface DdcStoreErrorInit {\n readonly code: DdcErrorCode;\n readonly detail: string;\n readonly hint?: string;\n readonly expected?: unknown;\n readonly actual?: unknown;\n readonly owner?: string;\n readonly rootKind?: DdcErrorRootKind;\n readonly scope?: string;\n readonly generation?: number;\n readonly lease?: string;\n readonly revision?: number;\n readonly recoveryActions?: readonly DdcRecoveryAction[];\n readonly hostPath?: string;\n}\n\nexport interface DdcBrowserError {\n readonly code: DdcErrorCode;\n readonly hint: string;\n readonly expected: unknown;\n readonly actual?: unknown;\n readonly owner?: string;\n readonly rootKind?: DdcErrorRootKind;\n readonly scope?: string;\n readonly generation?: number;\n readonly lease?: string;\n readonly revision?: number;\n readonly recoveryActions: readonly Omit<DdcRecoveryAction, 'exactTarget'>[];\n}\n\nconst defaultHints: Record<DdcErrorCode, string> = {\n 'ddc-project-root-required': 'inject the canonical projectDdcRoot before serving or publishing',\n 'ddc-object-conflict': 'keep the verified object and reject the competing publication',\n 'ddc-head-conflict': 'inspect the current head and retry with a fresh revision',\n 'ddc-generation-conflict': 'allocate a new persistent generation; do not edit the counter',\n 'ddc-scope-mismatch': 'reinspect the canonical root and allocate a new scope',\n 'ddc-lease-expired': 'discard the stale commit and acquire a new lease',\n 'ddc-entry-incomplete': 'discard the partial entry and cold-cook from author authority',\n 'ddc-entry-invalid': 'preserve last-known-good, inspect the entry, then cold-cook',\n 'ddc-entry-conflict': 'keep the verified entry and reject the competing publication',\n};\n\nfunction defaultExpected(code: DdcErrorCode): unknown {\n if (code === 'ddc-project-root-required') return 'projectDdcRoot';\n if (code === 'ddc-entry-incomplete' || code === 'ddc-entry-invalid') {\n return 'a complete DDC entry whose receipt and integrity digests validate';\n }\n return 'a valid DDC owner, scope, generation, revision, and lease';\n}\n\nfunction defaultActions(code: DdcErrorCode): readonly DdcRecoveryAction[] {\n switch (code) {\n case 'ddc-project-root-required':\n case 'ddc-scope-mismatch':\n return [\n { kind: 'inspect', executable: true },\n { kind: 'retry', executable: true },\n ];\n case 'ddc-generation-conflict':\n return [{ kind: 'allocate-generation', executable: true }];\n case 'ddc-lease-expired':\n return [\n { kind: 'release-lease', executable: true },\n { kind: 'retry', executable: true },\n ];\n case 'ddc-object-conflict':\n case 'ddc-head-conflict':\n return [\n { kind: 'inspect', executable: true },\n { kind: 'retry', executable: true },\n ];\n case 'ddc-entry-incomplete':\n case 'ddc-entry-invalid':\n return [{ kind: 'cold-rebuild', executable: true }];\n case 'ddc-entry-conflict':\n return [{ kind: 'inspect', executable: true }];\n }\n}\n\nexport class DdcStoreError extends Error {\n public readonly code: DdcErrorCode;\n public readonly detail: string;\n public readonly hint: string;\n public readonly expected: unknown;\n public readonly actual: unknown;\n public readonly owner: string | undefined;\n public readonly rootKind: DdcErrorRootKind | undefined;\n public readonly scope: string | undefined;\n public readonly generation: number | undefined;\n public readonly lease: string | undefined;\n public readonly revision: number | undefined;\n public readonly recoveryActions: readonly DdcRecoveryAction[];\n public readonly hostPath: string | undefined;\n\n public constructor(code: DdcErrorCode, detail: string);\n public constructor(input: DdcStoreErrorInit);\n public constructor(inputOrCode: DdcStoreErrorInit | DdcErrorCode, legacyDetail?: string) {\n const input: DdcStoreErrorInit =\n typeof inputOrCode === 'string'\n ? { code: inputOrCode, detail: legacyDetail ?? inputOrCode }\n : inputOrCode;\n super(input.detail);\n this.name = 'DdcStoreError';\n this.code = input.code;\n this.detail = input.detail;\n this.hint = input.hint ?? defaultHints[input.code];\n this.expected = input.expected ?? defaultExpected(input.code);\n this.actual = input.actual;\n this.owner = input.owner;\n this.rootKind = input.rootKind;\n this.scope = input.scope;\n this.generation = input.generation;\n this.lease = input.lease;\n this.revision = input.revision;\n this.recoveryActions = input.recoveryActions ?? defaultActions(input.code);\n this.hostPath = input.hostPath;\n }\n\n public toBrowserProjection(): DdcBrowserError {\n return {\n code: this.code,\n hint: this.hint,\n expected: this.expected,\n ...(this.actual === undefined ? {} : { actual: this.actual }),\n ...(this.owner === undefined ? {} : { owner: this.owner }),\n ...(this.rootKind === undefined ? {} : { rootKind: this.rootKind }),\n ...(this.scope === undefined ? {} : { scope: this.scope }),\n ...(this.generation === undefined ? {} : { generation: this.generation }),\n ...(this.lease === undefined ? {} : { lease: this.lease }),\n ...(this.revision === undefined ? {} : { revision: this.revision }),\n recoveryActions: this.recoveryActions.map(\n ({ exactTarget: _exactTarget, ...action }) => action,\n ),\n };\n }\n}\n","import { createHash, randomUUID } from 'node:crypto';\nimport { mkdir, readdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { DdcStoreError } from './errors.js';\nimport { canonicalDdcJson } from './key.js';\n\nexport { DdcStoreError } from './errors.js';\n\nexport interface DdcArtifact {\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n}\n\nexport interface DdcReceipt {\n readonly guid: string;\n readonly key: string;\n readonly producer: string;\n readonly inputFingerprint: string;\n readonly outputDigest: string;\n}\n\nexport interface DdcEntry {\n readonly key: string;\n readonly guid: string;\n readonly payload: unknown;\n readonly refs: readonly string[];\n readonly artifacts: Readonly<Record<string, DdcArtifact>>;\n readonly receipt: DdcReceipt;\n}\n\nexport interface StagedDdcEntry {\n readonly key: string;\n readonly path: string;\n}\n\nexport interface PublishDdcEntryResult {\n readonly result: 'published' | 'existing' | 'conflict';\n readonly key: string;\n}\n\ninterface ArtifactIntegrity {\n readonly mediaType: string;\n readonly byteLength: number;\n readonly digest: string;\n}\n\ninterface EntryIntegrity {\n readonly payload: string;\n readonly refs: string;\n readonly receipt: string;\n readonly artifacts: Readonly<Record<string, ArtifactIntegrity>>;\n readonly entry: string;\n}\n\nfunction digest(value: string | Uint8Array): string {\n return createHash('sha256').update(value).digest('hex');\n}\n\nfunction artifactFile(key: string): string {\n if (/^[A-Za-z0-9._-]+$/.test(key)) return key;\n return Buffer.from(key, 'utf8').toString('base64url');\n}\n\nfunction validateKey(key: string): void {\n if (!/^[a-f0-9]{64}$/.test(key)) {\n throw new DdcStoreError('ddc-entry-invalid', `invalid semantic key: ${key}`);\n }\n}\n\nfunction errorCode(error: unknown): string | undefined {\n if (error !== null && typeof error === 'object' && 'code' in error) {\n const code = (error as { readonly code?: unknown }).code;\n return typeof code === 'string' ? code : undefined;\n }\n return undefined;\n}\n\nfunction sortedArtifacts(entry: DdcEntry): readonly [string, DdcArtifact][] {\n return Object.entries(entry.artifacts).sort(([left], [right]) => left.localeCompare(right));\n}\n\n/** The one output identity shared by receipt validation and DDC publication. */\nexport function ddcOutputDigest(\n entry: Pick<DdcEntry, 'guid' | 'payload' | 'refs' | 'artifacts'>,\n): string {\n return `sha256:${digest(\n canonicalDdcJson({\n guid: entry.guid,\n payload: entry.payload,\n refs: entry.refs,\n artifacts: Object.fromEntries(\n sortedArtifacts(entry as DdcEntry).map(([key, artifact]) => [\n key,\n {\n mediaType: artifact.mediaType,\n bytes: artifact.bytes,\n },\n ]),\n ),\n }),\n )}`;\n}\n\nfunction existingResult(\n existing: DdcEntry,\n candidate: DdcEntry,\n key: string,\n): PublishDdcEntryResult {\n return canonicalDdcJson(existing) === canonicalDdcJson(candidate)\n ? { result: 'existing', key }\n : { result: 'conflict', key };\n}\n\nfunction entryShape(entry: DdcEntry): Record<string, unknown> {\n return {\n key: entry.key,\n guid: entry.guid,\n payload: entry.payload,\n refs: entry.refs,\n receipt: entry.receipt,\n artifacts: Object.fromEntries(\n sortedArtifacts(entry).map(([key, artifact]) => [\n key,\n { mediaType: artifact.mediaType, byteLength: artifact.bytes.byteLength },\n ]),\n ),\n };\n}\n\nfunction integrityFor(entry: DdcEntry): EntryIntegrity {\n const artifacts = Object.fromEntries(\n sortedArtifacts(entry).map(([key, artifact]) => [\n key,\n {\n mediaType: artifact.mediaType,\n byteLength: artifact.bytes.byteLength,\n digest: digest(artifact.bytes),\n },\n ]),\n );\n return {\n payload: digest(canonicalDdcJson(entry.payload)),\n refs: digest(canonicalDdcJson(entry.refs)),\n receipt: digest(canonicalDdcJson(entry.receipt)),\n artifacts,\n entry: digest(canonicalDdcJson(entryShape(entry))),\n };\n}\n\nasync function readJson<T>(path: string): Promise<T> {\n return JSON.parse(await readFile(path, 'utf8')) as T;\n}\n\nexport class DdcEntryStore {\n private readonly entries: string;\n private readonly staging: string;\n\n public constructor(root: string) {\n this.entries = join(root, 'entries');\n this.staging = join(root, 'staging');\n }\n\n public async stage(entry: DdcEntry): Promise<StagedDdcEntry> {\n validateKey(entry.key);\n if (entry.receipt.key !== entry.key || entry.receipt.guid !== entry.guid) {\n throw new DdcStoreError('ddc-entry-invalid', 'receipt identity does not match entry');\n }\n if (entry.receipt.outputDigest !== ddcOutputDigest(entry)) {\n throw new DdcStoreError('ddc-entry-invalid', 'receipt output digest does not match entry');\n }\n const path = join(this.staging, `${entry.key}-${randomUUID()}`);\n try {\n await mkdir(join(path, 'artifacts'), { recursive: true });\n await writeFile(join(path, 'payload.json'), canonicalDdcJson(entry.payload));\n await writeFile(join(path, 'refs.json'), canonicalDdcJson(entry.refs));\n await writeFile(join(path, 'receipt.json'), canonicalDdcJson(entry.receipt));\n const artifacts: Record<string, { mediaType: string; file: string }> = {};\n for (const [key, artifact] of sortedArtifacts(entry)) {\n const file = artifactFile(key);\n artifacts[key] = { mediaType: artifact.mediaType, file };\n await writeFile(join(path, 'artifacts', `${file}.bin`), artifact.bytes);\n }\n await writeFile(join(path, 'artifacts.json'), canonicalDdcJson(artifacts));\n await writeFile(join(path, 'integrity.json'), canonicalDdcJson(integrityFor(entry)));\n return { key: entry.key, path };\n } catch (error) {\n await rm(path, { recursive: true, force: true }).catch(() => {});\n throw error;\n }\n }\n\n public async publish(staged: StagedDdcEntry): Promise<PublishDdcEntryResult> {\n validateKey(staged.key);\n const candidate = await this.readDirectory(staged.path, true);\n const target = join(this.entries, staged.key);\n await mkdir(this.entries, { recursive: true });\n const useExisting = async (): Promise<PublishDdcEntryResult> => {\n const existing = await this.readDirectory(target, false);\n await rm(staged.path, { recursive: true, force: true });\n return existingResult(existing, candidate, staged.key);\n };\n try {\n await stat(target);\n return useExisting();\n } catch (error) {\n if (error instanceof DdcStoreError) throw error;\n if (errorCode(error) !== 'ENOENT') throw error;\n }\n try {\n await rename(staged.path, target);\n return { result: 'published', key: staged.key };\n } catch (error) {\n if (!['EEXIST', 'ENOTEMPTY', 'EISDIR'].includes(errorCode(error) ?? '')) throw error;\n return useExisting();\n }\n }\n\n public async discard(staged: StagedDdcEntry): Promise<void> {\n await rm(staged.path, { recursive: true, force: true });\n }\n\n public async write(entry: DdcEntry): Promise<PublishDdcEntryResult> {\n const staged = await this.stage(entry);\n return this.publish(staged);\n }\n\n public async read(key: string): Promise<DdcEntry | null> {\n try {\n validateKey(key);\n return await this.readDirectory(join(this.entries, key), false);\n } catch {\n return null;\n }\n }\n\n public async listKeys(): Promise<readonly string[]> {\n const entries = await readdir(this.entries, { withFileTypes: true }).catch(() => []);\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name)\n .sort();\n }\n\n public async remove(key: string): Promise<void> {\n validateKey(key);\n await rm(join(this.entries, key), { recursive: true, force: false });\n }\n\n /** Read with a machine-readable corruption result for recovery tooling. */\n public async readChecked(\n key: string,\n ): Promise<\n | { readonly ok: true; readonly value: DdcEntry | null }\n | { readonly ok: false; readonly error: DdcStoreError }\n > {\n try {\n validateKey(key);\n try {\n await stat(join(this.entries, key));\n } catch (error) {\n if (errorCode(error) === 'ENOENT') return { ok: true, value: null };\n throw error;\n }\n try {\n return { ok: true, value: await this.readDirectory(join(this.entries, key), false) };\n } catch (error) {\n if (error instanceof DdcStoreError && error.code === 'ddc-entry-incomplete') {\n return { ok: true, value: null };\n }\n throw error;\n }\n } catch (error) {\n const normalized =\n error instanceof DdcStoreError\n ? error\n : new DdcStoreError('ddc-entry-invalid', 'entry is unreadable');\n return { ok: false, error: normalized };\n }\n }\n\n private async readDirectory(path: string, incompleteIsError: boolean): Promise<DdcEntry> {\n try {\n const payload = await readJson<unknown>(join(path, 'payload.json'));\n const refs = await readJson<readonly string[]>(join(path, 'refs.json'));\n const receipt = await readJson<DdcReceipt>(join(path, 'receipt.json'));\n const manifest = await readJson<\n Readonly<Record<string, { mediaType: string; file: string }>>\n >(join(path, 'artifacts.json'));\n const integrity = await readJson<EntryIntegrity>(join(path, 'integrity.json'));\n const artifacts: Record<string, DdcArtifact> = {};\n for (const [key, descriptor] of Object.entries(manifest).sort(([left], [right]) =>\n left.localeCompare(right),\n )) {\n const bytes = new Uint8Array(\n await readFile(join(path, 'artifacts', `${descriptor.file}.bin`)),\n );\n artifacts[key] = { mediaType: descriptor.mediaType, bytes };\n }\n const entry = { key: receipt.key, guid: receipt.guid, payload, refs, artifacts, receipt };\n if (entry.receipt.outputDigest !== ddcOutputDigest(entry)) {\n throw new DdcStoreError('ddc-entry-invalid', 'receipt output digest does not match entry');\n }\n const actual = integrityFor(entry);\n if (canonicalDdcJson(actual) !== canonicalDdcJson(integrity)) {\n throw new DdcStoreError('ddc-entry-invalid', 'entry integrity mismatch');\n }\n return entry;\n } catch (error) {\n if (incompleteIsError) {\n if (error instanceof DdcStoreError) throw error;\n throw new DdcStoreError('ddc-entry-incomplete', 'staged entry is incomplete');\n }\n if (error instanceof DdcStoreError) throw error;\n throw new DdcStoreError('ddc-entry-invalid', 'entry is unreadable');\n }\n }\n}\n","import { randomUUID } from 'node:crypto';\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { DdcEntryStore } from './entry-store.js';\nimport { DdcStoreError } from './errors.js';\n\nexport type DdcLifecycleState = 'missing' | 'cooking' | 'current' | 'stale' | 'failed';\n\nexport interface DdcLease {\n readonly guid: string;\n readonly desiredKey: string;\n readonly attempt: string;\n readonly generation: number;\n readonly expectedRevision: number;\n readonly instanceId: string;\n readonly expiresAt: number;\n}\n\nexport interface DdcHead {\n readonly guid: string;\n readonly desiredKey: string;\n readonly state: DdcLifecycleState;\n readonly currentKey: string | undefined;\n readonly lastKnownGoodKey: string | undefined;\n readonly revision?: number;\n readonly generation?: number;\n readonly activeLease?: DdcLease;\n readonly failure?: { readonly code: string; readonly detail: string };\n}\n\nexport interface DdcCommitResult {\n readonly result: 'current' | 'stale' | 'lease-lost' | 'invalid';\n readonly key: string;\n readonly revision?: number;\n}\n\ninterface HeadRecord {\n readonly guid: string;\n readonly desiredKey: string;\n readonly revision: number;\n readonly currentKey?: string;\n readonly lastKnownGoodKey?: string;\n readonly generation?: number;\n readonly active?: DdcLease;\n readonly supersededAttempts?: readonly string[];\n readonly stale?: boolean;\n readonly failure?: {\n readonly desiredKey: string;\n readonly code: string;\n readonly detail: string;\n };\n}\n\ninterface GenerationRecord {\n readonly schemaVersion: 'forgeax-ddc-generation/v2';\n readonly next: number;\n}\n\nconst LOCK_WAIT_MS = 10;\nconst LOCK_TIMEOUT_MS = 5000;\nconst LEASE_TTL_MS = 30_000;\n\nfunction headFile(heads: string, guid: string): string {\n return join(heads, `${encodeURIComponent(guid)}.json`);\n}\n\nfunction lockFile(root: string, name: string): string {\n return join(root, 'locks', `${encodeURIComponent(name)}.lock`);\n}\n\nfunction withRevision(\n result: Omit<DdcCommitResult, 'revision'>,\n revision: number,\n): DdcCommitResult {\n const value = { ...result } as DdcCommitResult;\n Object.defineProperty(value, 'revision', { value: revision, enumerable: false });\n return value;\n}\n\nasync function delay(ms: number): Promise<void> {\n await new Promise((resolveDelay) => setTimeout(resolveDelay, ms));\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n\nfunction isNonNegativeInteger(value: unknown): value is number {\n return typeof value === 'number' && Number.isInteger(value) && value >= 0;\n}\n\nfunction isLeaseRecord(value: unknown): value is DdcLease {\n if (!isRecord(value)) return false;\n return (\n isString(value.guid) &&\n isString(value.desiredKey) &&\n isString(value.attempt) &&\n isNonNegativeInteger(value.generation) &&\n isNonNegativeInteger(value.expectedRevision) &&\n isString(value.instanceId) &&\n typeof value.expiresAt === 'number' &&\n Number.isFinite(value.expiresAt)\n );\n}\n\nfunction isHeadRecord(value: unknown): value is HeadRecord {\n if (!isRecord(value)) return false;\n if (\n !isString(value.guid) ||\n !isString(value.desiredKey) ||\n !isNonNegativeInteger(value.revision)\n ) {\n return false;\n }\n if (value.currentKey !== undefined && !isString(value.currentKey)) return false;\n if (value.lastKnownGoodKey !== undefined && !isString(value.lastKnownGoodKey)) return false;\n if (\n value.generation !== undefined &&\n (!isNonNegativeInteger(value.generation) || value.generation === 0)\n ) {\n return false;\n }\n if (value.active !== undefined && !isLeaseRecord(value.active)) return false;\n if (\n value.supersededAttempts !== undefined &&\n (!Array.isArray(value.supersededAttempts) || !value.supersededAttempts.every(isString))\n ) {\n return false;\n }\n if (value.stale !== undefined && typeof value.stale !== 'boolean') return false;\n if (value.failure !== undefined) {\n if (!isRecord(value.failure)) return false;\n if (\n !isString(value.failure.desiredKey) ||\n !isString(value.failure.code) ||\n !isString(value.failure.detail)\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction malformedHeadError(\n actual: 'syntax-invalid' | 'schema-invalid' | 'unreadable',\n): DdcStoreError {\n const detail =\n actual === 'syntax-invalid'\n ? 'DDC head JSON is syntactically invalid'\n : actual === 'schema-invalid'\n ? 'DDC head record does not match the lifecycle schema'\n : 'DDC head file is not readable';\n return new DdcStoreError({\n code: 'ddc-head-conflict',\n detail,\n expected: 'a valid DDC head record',\n actual,\n hint: 'inspect the current head and retry with a fresh revision',\n owner: 'engine-ddc',\n rootKind: 'project-ddc',\n recoveryActions: [\n { kind: 'inspect', executable: true },\n { kind: 'retry', executable: true },\n ],\n });\n}\n\n/** Cross-process mkdir lock; a lock owned by a dead PID is reclaimable. */\nexport async function withDdcLock<T>(\n root: string,\n name: string,\n operation: () => Promise<T>,\n): Promise<T> {\n const path = lockFile(root, name);\n await mkdir(join(root, 'locks'), { recursive: true });\n const deadline = Date.now() + LOCK_TIMEOUT_MS;\n while (true) {\n try {\n await mkdir(path);\n await writeFile(\n join(path, 'owner.json'),\n JSON.stringify({ pid: process.pid, acquiredAt: Date.now() }),\n );\n try {\n return await operation();\n } finally {\n await rm(path, { recursive: true, force: true });\n }\n } catch (error) {\n if ((error as { code?: string }).code !== 'EEXIST') throw error;\n let ownerPid: number | undefined;\n try {\n ownerPid = (\n JSON.parse(await readFile(join(path, 'owner.json'), 'utf8')) as { pid?: number }\n ).pid;\n } catch {\n ownerPid = undefined;\n }\n // mkdir() publishes the lock directory before the owner record can be\n // written. Treat that short publication window as an in-flight lock,\n // not as a dead owner: reclaiming it here lets two processes enter the\n // same critical section and loses the superseded-attempt fence.\n if (ownerPid === undefined) {\n if (Date.now() >= deadline) {\n throw new DdcStoreError({\n code: 'ddc-lease-expired',\n detail: `DDC lock ${name} did not publish an owner record`,\n hint: 'inspect the lock owner and retry after the incomplete instance exits',\n expected: 'a lock owner record',\n actual: { path },\n rootKind: 'project-ddc',\n });\n }\n await delay(LOCK_WAIT_MS);\n continue;\n }\n let alive = false;\n try {\n process.kill(ownerPid, 0);\n alive = true;\n } catch {\n alive = false;\n }\n if (!alive) {\n await rm(path, { recursive: true, force: true });\n continue;\n }\n if (Date.now() >= deadline) {\n throw new DdcStoreError({\n code: 'ddc-lease-expired',\n detail: `DDC lock ${name} remained owned by process ${ownerPid}`,\n hint: 'inspect the owner and retry after the stale instance exits',\n expected: 'an available project lock',\n actual: { ownerPid },\n rootKind: 'project-ddc',\n lease: String(ownerPid),\n });\n }\n await delay(LOCK_WAIT_MS);\n }\n }\n}\n\nexport class DdcLifecycle {\n private readonly heads: string;\n private readonly entries: DdcEntryStore;\n private readonly root: string;\n private readonly leaseTtlMs: number;\n\n public constructor(root: string, options?: { readonly leaseTtlMs?: number }) {\n this.root = root;\n this.heads = join(root, 'heads');\n this.entries = new DdcEntryStore(root);\n this.leaseTtlMs = options?.leaseTtlMs ?? LEASE_TTL_MS;\n }\n\n public async inspect(guid: string, desiredKey: string): Promise<DdcHead> {\n const record = await this.read(guid);\n if (record === null) {\n return {\n guid,\n desiredKey,\n state: 'missing',\n currentKey: undefined,\n lastKnownGoodKey: undefined,\n revision: 0,\n };\n }\n const recordedFailure =\n record.failure?.desiredKey === desiredKey\n ? { code: record.failure.code, detail: record.failure.detail }\n : undefined;\n const currentEntry =\n record.currentKey === undefined ? null : await this.entries.readChecked(record.currentKey);\n const entryFailure =\n currentEntry !== null && !currentEntry.ok\n ? { code: currentEntry.error.code, detail: currentEntry.error.detail }\n : undefined;\n const failure = recordedFailure ?? entryFailure;\n const currentValue = currentEntry?.ok === true ? currentEntry.value : null;\n const state: DdcLifecycleState =\n failure !== undefined\n ? 'failed'\n : record.currentKey === desiredKey && currentValue?.guid === guid\n ? 'current'\n : record.stale === true\n ? 'stale'\n : record.active?.desiredKey === desiredKey\n ? 'cooking'\n : 'stale';\n return {\n guid,\n desiredKey,\n state,\n currentKey: record.currentKey,\n lastKnownGoodKey: record.lastKnownGoodKey,\n revision: record.revision,\n ...(record.generation === undefined ? {} : { generation: record.generation }),\n ...(record.active === undefined ? {} : { activeLease: record.active }),\n ...(failure === undefined ? {} : { failure }),\n };\n }\n\n public async begin(guid: string, desiredKey: string): Promise<DdcLease> {\n return withDdcLock(this.root, `head-${guid}`, async () => {\n const previous = await this.read(guid);\n const generation = await this.allocateGeneration();\n const lease: DdcLease = {\n guid,\n desiredKey,\n attempt: randomUUID(),\n generation,\n expectedRevision: previous?.revision ?? 0,\n instanceId: `${process.pid}:${randomUUID()}`,\n expiresAt: Date.now() + this.leaseTtlMs,\n };\n const lastKnownGoodKey =\n previous?.currentKey !== undefined && previous.currentKey !== desiredKey\n ? previous.currentKey\n : previous?.lastKnownGoodKey;\n const supersededAttempts = [\n ...(previous?.supersededAttempts ?? []),\n ...(previous?.active === undefined ? [] : [previous.active.attempt]),\n ];\n await this.write({\n guid,\n desiredKey,\n revision: previous?.revision ?? 0,\n generation,\n active: lease,\n ...(previous?.currentKey === undefined ? {} : { currentKey: previous.currentKey }),\n ...(supersededAttempts.length === 0 ? {} : { supersededAttempts }),\n ...(lastKnownGoodKey === undefined ? {} : { lastKnownGoodKey }),\n });\n return lease;\n });\n }\n\n public async commit(lease: DdcLease, validatedKey: string): Promise<DdcCommitResult> {\n return withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.attempt !== lease.attempt) {\n if (current?.supersededAttempts?.includes(lease.attempt)) {\n await this.write({ ...current, stale: true });\n return withRevision({ result: 'stale', key: validatedKey }, current.revision);\n }\n return withRevision({ result: 'lease-lost', key: validatedKey }, current?.revision ?? 0);\n }\n if (Date.now() > lease.expiresAt) {\n throw new DdcStoreError({\n code: 'ddc-lease-expired',\n detail: 'cook lease expired before commit fencing',\n expected: { attempt: lease.attempt, revision: lease.expectedRevision },\n actual: { revision: current.revision },\n owner: 'engine-ddc',\n rootKind: 'project-ddc',\n generation: lease.generation,\n lease: lease.attempt,\n revision: current.revision,\n });\n }\n if (\n current.revision !== lease.expectedRevision ||\n current.desiredKey !== lease.desiredKey ||\n validatedKey !== lease.desiredKey\n ) {\n await this.write({ ...current, stale: true });\n return withRevision({ result: 'stale', key: validatedKey }, current.revision);\n }\n const entry = await this.entries.read(validatedKey);\n if (entry === null || entry.guid !== lease.guid || entry.receipt.key !== validatedKey) {\n await this.write({\n guid: lease.guid,\n desiredKey: lease.desiredKey,\n revision: current.revision + 1,\n generation: lease.generation,\n ...(current.lastKnownGoodKey === undefined\n ? {}\n : { lastKnownGoodKey: current.lastKnownGoodKey }),\n failure: {\n desiredKey: lease.desiredKey,\n code: 'entry-invalid',\n detail: 'validated DDC key has no readable entry for this asset',\n },\n });\n return withRevision({ result: 'invalid', key: validatedKey }, current.revision + 1);\n }\n const lastKnownGoodKey =\n current.currentKey !== undefined && current.currentKey !== validatedKey\n ? current.currentKey\n : current.lastKnownGoodKey;\n const nextRevision = current.revision + 1;\n await this.write({\n guid: lease.guid,\n desiredKey: lease.desiredKey,\n revision: nextRevision,\n generation: lease.generation,\n currentKey: validatedKey,\n stale: false,\n ...(current.supersededAttempts === undefined\n ? {}\n : { supersededAttempts: current.supersededAttempts }),\n ...(lastKnownGoodKey === undefined ? {} : { lastKnownGoodKey }),\n });\n return withRevision({ result: 'current', key: validatedKey }, nextRevision);\n });\n }\n\n public async fail(\n lease: DdcLease,\n failure: { readonly code: string; readonly detail: string },\n ): Promise<void> {\n await withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.attempt !== lease.attempt) return;\n await this.write({\n guid: lease.guid,\n desiredKey: lease.desiredKey,\n revision: current.revision + 1,\n generation: lease.generation,\n ...(current.currentKey === undefined ? {} : { currentKey: current.currentKey }),\n ...(current.lastKnownGoodKey === undefined\n ? {}\n : { lastKnownGoodKey: current.lastKnownGoodKey }),\n failure: { desiredKey: lease.desiredKey, ...failure },\n });\n });\n }\n\n public async heartbeat(lease: DdcLease): Promise<DdcLease> {\n return withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.attempt !== lease.attempt) {\n throw new DdcStoreError({\n code: 'ddc-lease-expired',\n detail: 'heartbeat belongs to a stale lease',\n expected: lease.attempt,\n actual: current?.active?.attempt,\n lease: lease.attempt,\n generation: lease.generation,\n rootKind: 'project-ddc',\n });\n }\n const refreshed = { ...lease, expiresAt: Date.now() + this.leaseTtlMs };\n await this.write({ ...current, active: refreshed });\n return refreshed;\n });\n }\n\n public async close(lease: DdcLease): Promise<void> {\n await withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.instanceId !== lease.instanceId) return;\n const { active: _active, ...withoutActive } = current;\n await this.write({\n ...withoutActive,\n revision: current.revision + 1,\n stale: current.currentKey === undefined,\n });\n });\n }\n\n public async discard(lease: DdcLease): Promise<void> {\n await withDdcLock(this.root, `head-${lease.guid}`, async () => {\n const current = await this.read(lease.guid);\n if (current?.active?.attempt !== lease.attempt) return;\n const { active: _active, ...withoutActive } = current;\n await this.write({\n ...withoutActive,\n revision: current.revision + 1,\n generation: lease.generation,\n stale: current.currentKey === undefined,\n });\n });\n }\n\n /** Restore the last accepted head after a failed multi-owner generation commit. */\n public async restore(head: DdcHead): Promise<void> {\n await withDdcLock(this.root, `head-${head.guid}`, async () => {\n const path = headFile(this.heads, head.guid);\n if (head.state === 'missing') {\n await rm(path, { force: true });\n return;\n }\n await this.write({\n guid: head.guid,\n desiredKey: head.desiredKey,\n revision: head.revision ?? 0,\n ...(head.currentKey === undefined ? {} : { currentKey: head.currentKey }),\n ...(head.lastKnownGoodKey === undefined ? {} : { lastKnownGoodKey: head.lastKnownGoodKey }),\n ...(head.generation === undefined ? {} : { generation: head.generation }),\n ...(head.activeLease === undefined ? {} : { active: head.activeLease }),\n ...(head.state === 'stale' ? { stale: true } : {}),\n ...(head.failure === undefined\n ? {}\n : { failure: { desiredKey: head.desiredKey, ...head.failure } }),\n });\n });\n }\n\n public async revoke(lease: DdcLease): Promise<void> {\n await this.fail(lease, {\n code: 'lease-lost',\n detail: 'cook lease was revoked before validation',\n });\n }\n\n public async recover(guid: string, desiredKey: string): Promise<DdcHead> {\n return withDdcLock(this.root, `head-${guid}`, async () => {\n const current = await this.read(guid);\n if (current?.active?.desiredKey === desiredKey) {\n await this.write({\n guid,\n desiredKey,\n revision: current.revision + 1,\n ...(current.lastKnownGoodKey === undefined\n ? {}\n : { lastKnownGoodKey: current.lastKnownGoodKey }),\n failure: {\n desiredKey,\n code: 'writer-crashed',\n detail: 'active cook attempt was recovered after process interruption',\n },\n });\n }\n return this.inspect(guid, desiredKey);\n });\n }\n\n private async allocateGeneration(): Promise<number> {\n const path = join(this.root, 'generations', 'counter.json');\n await mkdir(join(this.root, 'generations'), { recursive: true });\n let next = 1;\n try {\n const record = JSON.parse(await readFile(path, 'utf8')) as GenerationRecord;\n if (record.schemaVersion === 'forgeax-ddc-generation/v2' && Number.isInteger(record.next))\n next = Math.max(1, record.next);\n } catch {\n // A missing counter is the first allocation, not an implicit legacy fallback.\n }\n const temporary = `${path}.${process.pid}.${randomUUID()}.tmp`;\n await writeFile(\n temporary,\n JSON.stringify({ schemaVersion: 'forgeax-ddc-generation/v2', next: next + 1 }),\n );\n await rename(temporary, path);\n return next;\n }\n\n private async read(guid: string): Promise<HeadRecord | null> {\n const path = headFile(this.heads, guid);\n let source: string;\n try {\n source = await readFile(path, 'utf8');\n } catch (error) {\n if (\n error !== null &&\n typeof error === 'object' &&\n 'code' in error &&\n (error as { readonly code?: unknown }).code === 'ENOENT'\n ) {\n return null;\n }\n throw malformedHeadError('unreadable');\n }\n let value: unknown;\n try {\n value = JSON.parse(source);\n } catch {\n throw malformedHeadError('syntax-invalid');\n }\n if (!isHeadRecord(value) || value.guid !== guid) throw malformedHeadError('schema-invalid');\n return value;\n }\n\n private async write(record: HeadRecord): Promise<void> {\n await mkdir(this.heads, { recursive: true });\n const path = headFile(this.heads, record.guid);\n const temporary = `${path}.${randomUUID()}.tmp`;\n await writeFile(temporary, JSON.stringify(record));\n await rename(temporary, path);\n }\n}\n","import { readdir, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { withDdcLock } from './lifecycle.js';\n\nexport interface DdcGcInput {\n readonly currentKeys: readonly string[];\n readonly lastKnownGoodKeys: readonly string[];\n readonly activeLeaseKeys: readonly string[];\n readonly scopeIds?: readonly string[];\n}\n\nexport interface DdcGcResult {\n readonly deleted: readonly string[];\n readonly protected: readonly string[];\n}\n\n/** Mark current/LKG/lease roots, then sweep only the same project root. */\nexport async function collectDdcGarbage(root: string, input: DdcGcInput): Promise<DdcGcResult> {\n return withDdcLock(root, 'gc', async () => {\n const protectedKeys = new Set([\n ...input.currentKeys,\n ...input.lastKnownGoodKeys,\n ...input.activeLeaseKeys,\n ]);\n const entries = await readdir(join(root, 'entries'), { withFileTypes: true }).catch(() => []);\n const deleted: string[] = [];\n for (const entry of entries) {\n if (!entry.isDirectory() || protectedKeys.has(entry.name)) continue;\n await rm(join(root, 'entries', entry.name), { recursive: true, force: false });\n deleted.push(entry.name);\n }\n return { deleted, protected: [...protectedKeys].sort() };\n });\n}\n","import { isAbsolute, normalize } from 'node:path';\n\nexport const DDC_LAYOUT_VERSION = 'v2' as const;\n\nexport interface DdcBuildOptions {\n readonly buildCacheRoot: string;\n}\n\nexport interface DdcServeOptions extends DdcBuildOptions {\n readonly projectDdcRoot?: string;\n}\n\nexport interface DdcBuildLayout {\n readonly objects: string;\n readonly staging: string;\n}\n\nexport interface DdcProjectLayout {\n readonly root: string;\n readonly scope: string;\n readonly heads: string;\n readonly generations: string;\n readonly leases: string;\n readonly staging: string;\n}\n\nexport interface DdcLayout {\n readonly version: typeof DDC_LAYOUT_VERSION;\n readonly buildCacheRoot: string;\n readonly projectDdcRoot: string;\n readonly build: DdcBuildLayout;\n readonly project: DdcProjectLayout;\n}\n\nexport interface DdcBuildLayoutResult {\n readonly ok: true;\n readonly value: DdcBuildLayout;\n}\n\nexport interface DdcLayoutError {\n readonly code: 'ddc-project-root-required' | 'ddc-root-absolute-required';\n readonly detail: string;\n readonly hint: string;\n readonly expected: string;\n readonly actual?: string;\n}\n\nexport interface DdcLayoutResult {\n readonly ok: true;\n readonly value: DdcLayout;\n}\n\nexport interface DdcLayoutFailure {\n readonly ok: false;\n readonly error: DdcLayoutError;\n}\n\ntype ClosedLayoutResult = DdcLayoutResult | DdcLayoutFailure;\n\nfunction rootOrError(root: string, name: string): string | DdcLayoutError {\n if (!isAbsolute(root)) {\n return {\n code: 'ddc-root-absolute-required',\n detail: `${name} must be an absolute injected path`,\n hint: `inject the canonical ${name} from the host root policy`,\n expected: 'an absolute filesystem path',\n actual: root,\n };\n }\n const normalized = normalize(root);\n return normalized.replace(/[\\\\/]+$/, '') || normalized;\n}\n\nfunction buildLayout(root: string): DdcBuildLayout {\n return { objects: `${root}/objects`, staging: `${root}/staging` };\n}\n\nfunction projectLayout(root: string): DdcProjectLayout {\n return {\n root,\n scope: `${root}/scope.json`,\n heads: `${root}/heads`,\n generations: `${root}/generations`,\n leases: `${root}/leases`,\n staging: `${root}/staging`,\n };\n}\n\nexport function resolveBuildDdcLayout(\n options: DdcBuildOptions,\n): DdcBuildLayoutResult | DdcLayoutFailure {\n const root = rootOrError(options.buildCacheRoot, 'buildCacheRoot');\n return typeof root === 'string'\n ? { ok: true, value: buildLayout(root) }\n : { ok: false, error: root };\n}\n\nexport function resolveDdcLayout(options: DdcServeOptions): ClosedLayoutResult {\n const buildRoot = rootOrError(options.buildCacheRoot, 'buildCacheRoot');\n if (typeof buildRoot !== 'string') return { ok: false, error: buildRoot };\n if (options.projectDdcRoot === undefined || options.projectDdcRoot.trim().length === 0) {\n return {\n ok: false,\n error: {\n code: 'ddc-project-root-required',\n detail: 'serve and publication require an explicitly injected projectDdcRoot',\n hint: 'canonicalize the game directory in the host and inject its .forgeax/ddc/v2 root',\n expected: 'projectDdcRoot',\n },\n };\n }\n const projectRoot = rootOrError(options.projectDdcRoot, 'projectDdcRoot');\n if (typeof projectRoot !== 'string') return { ok: false, error: projectRoot };\n return {\n ok: true,\n value: {\n version: DDC_LAYOUT_VERSION,\n buildCacheRoot: buildRoot,\n projectDdcRoot: projectRoot,\n build: buildLayout(buildRoot),\n project: projectLayout(projectRoot),\n },\n };\n}\n\nexport function isDdcLayout(value: unknown): value is DdcLayout {\n return (\n value !== null &&\n typeof value === 'object' &&\n (value as { readonly version?: unknown }).version === DDC_LAYOUT_VERSION\n );\n}\n","import { createHash } from 'node:crypto';\nimport type {\n AssetPublicationEnvelope,\n AssetPublicationExternalEvidence,\n AssetPublicationFailure,\n AssetPublicationLocator,\n AssetPublicationOutput,\n AssetPublicationRecovery,\n Result,\n} from '@forgeax/engine-types';\nimport { err, ok } from '@forgeax/engine-types';\n\nexport interface ScriptablePackPublicationSnapshot {\n readonly current?: AssetPublicationEnvelope;\n readonly lastKnownGood?: AssetPublicationEnvelope;\n readonly failure?: AssetPublicationFailure;\n}\n\nexport interface ScriptablePackPublicationError extends AssetPublicationFailure {\n readonly recovery: AssetPublicationRecovery;\n readonly current?: AssetPublicationLocator;\n readonly lastKnownGood?: AssetPublicationLocator;\n}\n\nexport interface AcceptedPublicationCandidate {\n readonly envelope: AssetPublicationEnvelope;\n readonly cancelled?: boolean;\n}\n\nexport interface ScriptablePackPublicationBuildInput {\n readonly sourcePath: string;\n readonly sourceRevision: string;\n /** Optional caller generation; the DDC owner derives one when omitted. */\n readonly generation?: number;\n readonly digest: string;\n readonly packageUrl: string;\n readonly inputFingerprint: string;\n readonly outputs: readonly AssetPublicationOutput[];\n readonly externalEvidence: readonly AssetPublicationExternalEvidence[];\n}\n\n/**\n * DDC-owned publication authority for source keyed producers. Transport\n * adapters may stage bytes, but they do not retain current/LKG or generation\n * state themselves.\n */\nexport interface AcceptedPublicationStore {\n observe(sourcePath: string): ScriptablePackPublicationSnapshot;\n stage(\n sourcePath: string,\n candidate: AcceptedPublicationCandidate,\n ): Result<void, ScriptablePackPublicationError>;\n commit(\n sourcePath: string,\n candidate: AcceptedPublicationCandidate,\n commitRoute: () => Promise<void> | void,\n ): Promise<Result<ScriptablePackPublicationSnapshot, ScriptablePackPublicationError>>;\n discard(sourcePath: string, candidate: AssetPublicationEnvelope): void;\n restore(sourcePath: string, snapshot: ScriptablePackPublicationSnapshot): void;\n}\n\nfunction stable(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(stable).join(',')}]`;\n if (value !== null && typeof value === 'object') {\n const record = value as Record<string, unknown>;\n return `{${Object.keys(record)\n .sort()\n .map((key) => `${JSON.stringify(key)}:${stable(record[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value) ?? 'null';\n}\n\nfunction digest(value: unknown): string {\n return `sha256:${createHash('sha256').update(stable(value)).digest('hex')}`;\n}\n\nexport function scriptablePackOutputSetDigest(outputs: readonly AssetPublicationOutput[]): string {\n return digest(\n outputs.map((output) => ({\n guid: output.guid.toLowerCase(),\n sourceKey: output.sourceKey,\n kind: output.kind,\n digest: output.digest,\n refs: [...output.refs].map((guid) => guid.toLowerCase()),\n })),\n );\n}\n\n/** Derive a stable positive generation from the accepted publication tuple. */\nexport function scriptablePackPublicationGeneration(input: {\n readonly sourceRevision: string;\n readonly digest: string;\n readonly outputSetDigest: string;\n}): number {\n const hash = createHash('sha256')\n .update(input.sourceRevision)\n .update('\\n')\n .update(input.digest)\n .update('\\n')\n .update(input.outputSetDigest)\n .digest('hex');\n const generation = Number.parseInt(hash.slice(0, 8), 16);\n return generation > 0 ? generation : 1;\n}\n\n/** Build the complete producer-owned tuple after the package route is finalized. */\nexport function createAcceptedPublication(\n input: ScriptablePackPublicationBuildInput,\n): AssetPublicationEnvelope {\n const outputSetDigest = scriptablePackOutputSetDigest(input.outputs);\n const publicationGeneration =\n input.generation ??\n scriptablePackPublicationGeneration({\n sourceRevision: input.sourceRevision,\n digest: input.digest,\n outputSetDigest,\n });\n return {\n schemaVersion: 'asset-publication/1',\n sourcePath: input.sourcePath,\n sourceRevision: input.sourceRevision,\n generation: publicationGeneration,\n digest: input.digest,\n outputSetDigest,\n outputs: input.outputs,\n receipt: {\n schemaVersion: 'asset-publication-receipt/1',\n sourcePath: input.sourcePath,\n sourceRevision: input.sourceRevision,\n inputFingerprint: input.inputFingerprint,\n outputDigest: input.digest,\n outputSetDigest,\n externalEvidence: input.externalEvidence,\n },\n externalEvidence: input.externalEvidence,\n current: {\n generation: publicationGeneration,\n digest: input.digest,\n outputSetDigest,\n packageUrl: input.packageUrl,\n receiptKey: input.inputFingerprint,\n },\n };\n}\n\nfunction locatorFor(envelope: AssetPublicationEnvelope): AssetPublicationLocator {\n return {\n generation: envelope.generation,\n digest: envelope.digest,\n outputSetDigest: envelope.outputSetDigest,\n packageUrl: envelope.current?.packageUrl ?? '',\n receiptKey: envelope.receipt.inputFingerprint,\n };\n}\n\nfunction recoveryFor(retryable: boolean, useLastKnownGood: boolean): AssetPublicationRecovery {\n return {\n retryable,\n preserveCurrent: true,\n useLastKnownGood,\n actions: retryable\n ? ['inspect-publication-failure', 'retry-rebuild', 'continue-last-known-good']\n : ['inspect-publication-failure', 'edit-source', 'continue-last-known-good'],\n };\n}\n\nfunction failure(\n envelope: AssetPublicationEnvelope,\n code: string,\n stage: AssetPublicationFailure['stage'],\n reason: string,\n retryable: boolean,\n current: AssetPublicationEnvelope | undefined,\n lastKnownGood: AssetPublicationEnvelope | undefined,\n): ScriptablePackPublicationError {\n return {\n code,\n stage,\n sourcePath: envelope.sourcePath,\n sourceRevision: envelope.sourceRevision,\n generation: envelope.generation,\n reason,\n recovery: recoveryFor(retryable, lastKnownGood !== undefined),\n ...(current === undefined ? {} : { current: locatorFor(current) }),\n ...(lastKnownGood === undefined ? {} : { lastKnownGood: locatorFor(lastKnownGood) }),\n };\n}\n\nfunction validateOutputs(\n envelope: AssetPublicationEnvelope,\n current: AssetPublicationEnvelope | undefined,\n lastKnownGood: AssetPublicationEnvelope | undefined,\n): ScriptablePackPublicationError | undefined {\n const guids = new Set<string>();\n const sourceKeys = new Set<string>();\n for (const output of envelope.outputs) {\n const guid = output.guid.toLowerCase();\n if (guids.has(guid) || sourceKeys.has(output.sourceKey)) {\n return failure(\n envelope,\n 'asset-publication-output-duplicate',\n 'output',\n 'publication output GUIDs and sourceKeys must be unique',\n false,\n current,\n lastKnownGood,\n );\n }\n guids.add(guid);\n sourceKeys.add(output.sourceKey);\n }\n if (\n envelope.outputs.length === 0 ||\n scriptablePackOutputSetDigest(envelope.outputs) !== envelope.outputSetDigest\n ) {\n return failure(\n envelope,\n 'asset-publication-output-set-mismatch',\n 'receipt',\n 'receipt outputSetDigest does not match the complete output tuple',\n false,\n current,\n lastKnownGood,\n );\n }\n return undefined;\n}\n\nfunction validateReceipt(\n envelope: AssetPublicationEnvelope,\n current: AssetPublicationEnvelope | undefined,\n lastKnownGood: AssetPublicationEnvelope | undefined,\n): ScriptablePackPublicationError | undefined {\n const receipt = envelope.receipt;\n if (\n receipt.schemaVersion !== 'asset-publication-receipt/1' ||\n receipt.sourcePath !== envelope.sourcePath ||\n receipt.sourceRevision !== envelope.sourceRevision ||\n receipt.outputSetDigest !== envelope.outputSetDigest ||\n receipt.outputDigest !== envelope.digest ||\n stable(receipt.externalEvidence) !== stable(envelope.externalEvidence)\n ) {\n return failure(\n envelope,\n 'asset-publication-receipt-mismatch',\n 'receipt',\n 'publication receipt does not match the candidate output tuple',\n false,\n current,\n lastKnownGood,\n );\n }\n return undefined;\n}\n\nfunction validateEnvelope(\n envelope: AssetPublicationEnvelope,\n current: AssetPublicationEnvelope | undefined,\n lastKnownGood: AssetPublicationEnvelope | undefined,\n): ScriptablePackPublicationError | undefined {\n if (envelope.schemaVersion !== 'asset-publication/1') {\n return failure(\n envelope,\n 'asset-publication-schema-invalid',\n 'receipt',\n 'publication envelope schemaVersion is not supported',\n false,\n current,\n lastKnownGood,\n );\n }\n if (!Number.isSafeInteger(envelope.generation) || envelope.generation < 1) {\n return failure(\n envelope,\n 'asset-publication-generation-invalid',\n 'receipt',\n 'publication generation must be a positive integer',\n false,\n current,\n lastKnownGood,\n );\n }\n const outputError = validateOutputs(envelope, current, lastKnownGood);\n if (outputError !== undefined) return outputError;\n const receiptError = validateReceipt(envelope, current, lastKnownGood);\n if (receiptError !== undefined) return receiptError;\n // Re-running a deterministic producer (for example a cold cook after a\n // rebuild) can yield the exact same publication tuple. That is an\n // idempotent request, not a late result: rejecting it here makes the\n // editor's retry/cold-cook operation fail even though the published asset is\n // already the requested content. A same-generation tuple with any changed\n // source/digest/output-set fact remains stale and is rejected below.\n const sameTuple =\n current !== undefined &&\n envelope.generation === current.generation &&\n envelope.sourcePath === current.sourcePath &&\n envelope.sourceRevision === current.sourceRevision &&\n envelope.digest === current.digest &&\n envelope.outputSetDigest === current.outputSetDigest;\n if (sameTuple) return undefined;\n if (current !== undefined && envelope.generation <= current.generation) {\n return failure(\n envelope,\n 'asset-publication-stale',\n 'cancelled',\n `candidate generation ${envelope.generation} is not newer than current ${current.generation}`,\n true,\n current,\n lastKnownGood,\n );\n }\n return undefined;\n}\n\ninterface PublicationState {\n snapshot: ScriptablePackPublicationSnapshot;\n readonly staged: Map<string, AssetPublicationEnvelope>;\n}\n\nfunction validateCandidate(\n state: PublicationState,\n candidate: AcceptedPublicationCandidate,\n cancelledReason: string,\n): ScriptablePackPublicationError | undefined {\n const current = state.snapshot.current;\n const lastKnownGood = state.snapshot.lastKnownGood ?? current;\n if (candidate.cancelled === true) {\n return failure(\n candidate.envelope,\n 'asset-publication-cancelled',\n 'cancelled',\n cancelledReason,\n true,\n current,\n lastKnownGood,\n );\n }\n return validateEnvelope(candidate.envelope, current, lastKnownGood);\n}\n\nasync function publishCandidate(\n state: PublicationState,\n candidate: AcceptedPublicationCandidate,\n commitRoute: () => Promise<void> | void,\n): Promise<Result<ScriptablePackPublicationSnapshot, ScriptablePackPublicationError>> {\n const current = state.snapshot.current;\n const lastKnownGood = state.snapshot.lastKnownGood ?? current;\n const invalid = validateCandidate(\n state,\n candidate,\n 'publication request was cancelled before route commit',\n );\n if (invalid !== undefined) {\n state.snapshot = { ...state.snapshot, failure: invalid };\n return err(invalid);\n }\n try {\n await commitRoute();\n } catch (error) {\n const failed = failure(\n candidate.envelope,\n 'asset-publication-route-failed',\n 'route',\n error instanceof Error ? error.message : String(error),\n true,\n current,\n lastKnownGood,\n );\n state.snapshot = { ...state.snapshot, failure: failed };\n return err(failed);\n }\n const published = {\n ...candidate.envelope,\n current: locatorFor(candidate.envelope),\n ...(current === undefined ? {} : { lastKnownGood: locatorFor(current) }),\n recovery: recoveryFor(false, current !== undefined),\n };\n state.snapshot = {\n current: published,\n ...(current === undefined ? {} : { lastKnownGood: current }),\n };\n return ok(state.snapshot);\n}\n\n/** Create the one DDC publication authority shared by dev attempts. */\nexport function createAcceptedPublicationStore(): AcceptedPublicationStore {\n const states = new Map<string, PublicationState>();\n function stateFor(sourcePath: string): PublicationState {\n const existing = states.get(sourcePath);\n if (existing !== undefined) return existing;\n const created: PublicationState = { snapshot: {}, staged: new Map() };\n states.set(sourcePath, created);\n return created;\n }\n function candidateKey(candidate: AssetPublicationEnvelope): string {\n return `${candidate.generation}\\0${candidate.digest}\\0${candidate.outputSetDigest}`;\n }\n return {\n observe(sourcePath) {\n return stateFor(sourcePath).snapshot;\n },\n stage(sourcePath, candidate) {\n const invalid = validateCandidate(\n stateFor(sourcePath),\n candidate,\n 'publication request was cancelled before DDC commit',\n );\n if (invalid !== undefined) return err(invalid);\n stateFor(sourcePath).staged.set(candidateKey(candidate.envelope), candidate.envelope);\n return ok(undefined);\n },\n async commit(sourcePath, candidate, commitRoute) {\n const key = candidateKey(candidate.envelope);\n const state = stateFor(sourcePath);\n if (!state.staged.has(key)) {\n const current = state.snapshot.current;\n const lastKnownGood = state.snapshot.lastKnownGood ?? current;\n return err(\n failure(\n candidate.envelope,\n 'asset-publication-cancelled',\n 'cancelled',\n 'publication candidate was discarded before DDC commit',\n true,\n current,\n lastKnownGood,\n ),\n );\n }\n const result = await publishCandidate(state, candidate, commitRoute);\n state.staged.delete(key);\n return result;\n },\n discard(sourcePath, candidate) {\n stateFor(sourcePath).staged.delete(candidateKey(candidate));\n },\n restore(sourcePath, snapshot) {\n const state = stateFor(sourcePath);\n state.staged.clear();\n state.snapshot = snapshot;\n },\n };\n}\n","import { createHash } from 'node:crypto';\nimport { mkdir, readFile, rename, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { DdcStoreError } from './errors.js';\n\nexport interface DdcRuntimeScope {\n readonly scopeId: string;\n readonly scopeHash: string;\n readonly root: string;\n readonly metadataPath: string;\n}\n\ninterface ScopeMetadata {\n readonly schemaVersion: 'forgeax-ddc-scope/v2';\n readonly scopeId: string;\n readonly scopeHash: string;\n}\n\nfunction scopeHash(scopeId: string): string {\n return createHash('sha256').update(scopeId, 'utf8').digest('hex');\n}\n\nexport function runtimeScopeHash(scopeId: string): string {\n return scopeHash(scopeId);\n}\n\nexport async function createRuntimeScope(root: string, scopeId: string): Promise<DdcRuntimeScope> {\n if (scopeId.length === 0) {\n throw new DdcStoreError({\n code: 'ddc-scope-mismatch',\n detail: 'runtime scope id must not be empty',\n expected: 'a non-empty original scope id',\n actual: scopeId,\n rootKind: 'project-ddc',\n });\n }\n const hash = scopeHash(scopeId);\n const scopeRoot = join(root, 'scopes', hash);\n const metadataPath = join(scopeRoot, 'scope.json');\n await mkdir(scopeRoot, { recursive: true });\n const expected: ScopeMetadata = {\n schemaVersion: 'forgeax-ddc-scope/v2',\n scopeId,\n scopeHash: hash,\n };\n try {\n const actual = JSON.parse(await readFile(metadataPath, 'utf8')) as Partial<ScopeMetadata>;\n if (\n actual.schemaVersion !== expected.schemaVersion ||\n actual.scopeId !== expected.scopeId ||\n actual.scopeHash !== expected.scopeHash\n ) {\n throw new DdcStoreError({\n code: 'ddc-scope-mismatch',\n detail: 'runtime scope metadata does not match the requested scope',\n expected,\n actual,\n rootKind: 'project-ddc',\n scope: scopeId,\n });\n }\n } catch (error) {\n if (error instanceof DdcStoreError) throw error;\n const temporary = `${metadataPath}.${process.pid}.tmp`;\n await writeFile(temporary, JSON.stringify(expected));\n await rename(temporary, metadataPath);\n }\n return { scopeId, scopeHash: hash, root: scopeRoot, metadataPath };\n}\n\nexport async function assertRuntimeScope(\n root: string,\n scope: Pick<DdcRuntimeScope, 'scopeId' | 'scopeHash'>,\n): Promise<DdcRuntimeScope> {\n const expectedHash = scopeHash(scope.scopeId);\n if (scope.scopeHash !== expectedHash) {\n throw new DdcStoreError({\n code: 'ddc-scope-mismatch',\n detail: 'runtime scope hash does not match the original scope id',\n expected: expectedHash,\n actual: scope.scopeHash,\n rootKind: 'project-ddc',\n scope: scope.scopeId,\n });\n }\n return createRuntimeScope(root, scope.scopeId);\n}\n","import type { DdcEntry, StagedDdcEntry } from './entry-store.js';\nimport { DdcEntryStore } from './entry-store.js';\nimport type { DdcCommitResult, DdcHead, DdcLease } from './lifecycle.js';\nimport { DdcLifecycle } from './lifecycle.js';\n\nexport interface DdcSessionOptions {\n readonly generation: number;\n readonly leaseTtlMs?: number;\n}\n\nexport interface DdcGenerationCandidate {\n readonly generation: number;\n readonly lease: DdcLease;\n readonly previousHead: DdcHead;\n}\n\nexport interface DdcGenerationEntryCandidate extends DdcGenerationCandidate {\n readonly staged: StagedDdcEntry;\n}\n\nexport interface DdcSessionMetrics {\n readonly hitCount: number;\n readonly missCount: number;\n readonly corruptCount: number;\n readonly writeFailureCount: number;\n}\n\ntype MutableDdcGenerationCandidate = Omit<DdcGenerationCandidate, 'lease'> & {\n lease: DdcLease;\n};\n\ntype MutableDdcGenerationEntryCandidate = Omit<DdcGenerationEntryCandidate, 'lease'> & {\n lease: DdcLease;\n};\n\ntype HeartbeatTimer = ReturnType<typeof setTimeout>;\n\ninterface MutableMetrics {\n hitCount: number;\n missCount: number;\n corruptCount: number;\n writeFailureCount: number;\n}\n\nexport class DdcGenerationSession {\n public readonly generation: number;\n private readonly lifecycle: DdcLifecycle;\n private readonly entries: DdcEntryStore;\n private readonly candidates = new Map<string, MutableDdcGenerationCandidate>();\n private readonly heartbeatTimers = new Map<string, HeartbeatTimer>();\n private readonly counters: MutableMetrics = {\n hitCount: 0,\n missCount: 0,\n corruptCount: 0,\n writeFailureCount: 0,\n };\n private accepting = true;\n\n public constructor(root: string, options: DdcSessionOptions) {\n if (!Number.isSafeInteger(options.generation) || options.generation < 1) {\n throw new TypeError('DDC generation must be a positive safe integer');\n }\n this.generation = options.generation;\n this.lifecycle = new DdcLifecycle(\n root,\n options.leaseTtlMs === undefined ? undefined : { leaseTtlMs: options.leaseTtlMs },\n );\n this.entries = new DdcEntryStore(root);\n }\n\n public async beginCandidate(guid: string, desiredKey: string): Promise<DdcGenerationCandidate> {\n const head = await this.inspect(guid, desiredKey);\n const lease = await this.lifecycle.begin(guid, desiredKey);\n const candidate: MutableDdcGenerationCandidate = {\n generation: this.generation,\n lease,\n previousHead: head,\n };\n this.candidates.set(lease.attempt, candidate);\n this.scheduleHeartbeat(candidate);\n return candidate;\n }\n\n public async stageEntry(entry: DdcEntry): Promise<DdcGenerationEntryCandidate> {\n this.assertOpen();\n const candidate = (await this.beginCandidate(\n entry.guid,\n entry.key,\n )) as MutableDdcGenerationCandidate;\n try {\n const staged = await this.entries.stage(entry);\n const entryCandidate: MutableDdcGenerationEntryCandidate = Object.assign(candidate, {\n staged,\n });\n this.candidates.set(candidate.lease.attempt, entryCandidate);\n return entryCandidate;\n } catch (error) {\n await this.lifecycle.fail(candidate.lease, {\n code: 'ddc-entry-stage-failed',\n detail: error instanceof Error ? error.message : String(error),\n });\n this.stopHeartbeat(candidate);\n this.candidates.delete(candidate.lease.attempt);\n this.counters.writeFailureCount += 1;\n throw error;\n }\n }\n\n public async inspect(guid: string, desiredKey: string): Promise<DdcHead> {\n this.assertOpen();\n const head = await this.lifecycle.inspect(guid, desiredKey);\n if (head.state === 'current') this.counters.hitCount += 1;\n else this.counters.missCount += 1;\n return head;\n }\n\n public async commitCandidate(\n candidate: DdcGenerationCandidate,\n validatedKey: string,\n ): Promise<DdcCommitResult> {\n const registered = this.assertCandidate(candidate);\n try {\n const result = await this.lifecycle.commit(registered.lease, validatedKey);\n if (result.result === 'invalid') this.counters.corruptCount += 1;\n this.stopHeartbeat(registered);\n this.candidates.delete(registered.lease.attempt);\n return result;\n } catch (error) {\n this.stopHeartbeat(registered);\n this.counters.writeFailureCount += 1;\n throw error;\n }\n }\n\n public async commitEntry(\n candidate: DdcGenerationEntryCandidate,\n validatedKey: string,\n ): Promise<DdcCommitResult> {\n const registered = this.assertCandidate(candidate);\n try {\n await this.entries.publish(candidate.staged);\n const result = await this.lifecycle.commit(registered.lease, validatedKey);\n this.stopHeartbeat(registered);\n this.candidates.delete(registered.lease.attempt);\n return result;\n } catch (error) {\n this.stopHeartbeat(registered);\n await this.lifecycle.fail(registered.lease, {\n code: 'ddc-entry-publish-failed',\n detail: error instanceof Error ? error.message : String(error),\n });\n await this.entries.discard(candidate.staged).catch(() => {});\n this.candidates.delete(registered.lease.attempt);\n this.counters.writeFailureCount += 1;\n throw error;\n }\n }\n\n public async discardCandidate(candidate: DdcGenerationCandidate): Promise<void> {\n const registered = this.candidates.get(candidate.lease.attempt);\n if (registered === undefined) return;\n try {\n this.stopHeartbeat(registered);\n await this.lifecycle.discard(registered.lease);\n this.candidates.delete(registered.lease.attempt);\n } catch (error) {\n this.counters.writeFailureCount += 1;\n throw error;\n }\n }\n\n public async discardEntry(candidate: DdcGenerationEntryCandidate): Promise<void> {\n await Promise.all([this.discardCandidate(candidate), this.entries.discard(candidate.staged)]);\n }\n\n public async restoreEntry(candidate: DdcGenerationEntryCandidate): Promise<void> {\n const registered = this.candidates.get(candidate.lease.attempt);\n let restoreError: unknown;\n try {\n await this.lifecycle.restore(candidate.previousHead);\n } catch (error) {\n restoreError = error;\n } finally {\n await this.entries.discard(candidate.staged).catch(() => {});\n if (registered !== undefined) {\n this.stopHeartbeat(registered);\n this.candidates.delete(registered.lease.attempt);\n }\n }\n if (restoreError !== undefined) throw restoreError;\n }\n\n public metrics(): DdcSessionMetrics {\n return { ...this.counters };\n }\n\n public async close(): Promise<void> {\n if (!this.accepting) return;\n this.accepting = false;\n for (const timer of this.heartbeatTimers.values()) clearTimeout(timer);\n this.heartbeatTimers.clear();\n const pending = [...this.candidates.values()];\n for (const candidate of pending) {\n try {\n await this.lifecycle.discard(candidate.lease);\n } catch {\n this.counters.writeFailureCount += 1;\n }\n }\n this.candidates.clear();\n }\n\n private assertOpen(): void {\n if (!this.accepting) throw new Error('DDC generation session is closed');\n }\n\n private assertCandidate(candidate: DdcGenerationCandidate): MutableDdcGenerationCandidate {\n this.assertOpen();\n const registered = this.candidates.get(candidate.lease.attempt);\n if (candidate.generation !== this.generation || registered === undefined) {\n throw new Error('DDC candidate belongs to another generation session');\n }\n return registered;\n }\n\n private scheduleHeartbeat(candidate: MutableDdcGenerationCandidate): void {\n const attempt = candidate.lease.attempt;\n this.stopHeartbeat(candidate);\n const delay = Math.max(1, Math.floor((candidate.lease.expiresAt - Date.now()) / 2));\n const timer = setTimeout(() => {\n this.heartbeatTimers.delete(attempt);\n if (!this.accepting || this.candidates.get(attempt) !== candidate) return;\n void this.lifecycle\n .heartbeat(candidate.lease)\n .then((lease) => {\n if (!this.accepting || this.candidates.get(attempt) !== candidate) return;\n candidate.lease = lease;\n this.scheduleHeartbeat(candidate);\n })\n .catch(() => {\n this.stopHeartbeat(candidate);\n });\n }, delay);\n timer.unref?.();\n this.heartbeatTimers.set(attempt, timer);\n }\n\n private stopHeartbeat(candidate: DdcGenerationCandidate): void {\n const timer = this.heartbeatTimers.get(candidate.lease.attempt);\n if (timer === undefined) return;\n clearTimeout(timer);\n this.heartbeatTimers.delete(candidate.lease.attempt);\n }\n}\n","import type { DdcErrorRootKind } from './errors.js';\n\nexport const DDC_STATUS_SCHEMA = 'forgeax-ddc-status/v2' as const;\n\nexport type DdcStatusHealth = 'ready' | 'blocked' | 'missing' | 'stale' | 'failed';\nexport type DdcStatusLayerKind = 'build' | 'project' | 'runtime';\nexport type DdcStatusRootKind = DdcErrorRootKind;\n\nexport interface DdcRecoveryAction {\n readonly kind: 'inspect' | 'allocate-generation' | 'retry' | 'cold-rebuild' | 'prune';\n readonly executable: boolean;\n readonly exactTarget?: string;\n readonly reason?: string;\n}\n\nexport interface DdcStatusLayer {\n readonly kind: DdcStatusLayerKind;\n readonly owner: 'engine-ddc' | 'engine-pack' | 'plugin' | 'runtime';\n readonly rootKind: DdcStatusRootKind;\n readonly scopeId?: string;\n readonly current?: number | string;\n readonly lastKnownGood?: number | string;\n readonly protection: readonly string[];\n readonly actions: readonly DdcRecoveryAction[];\n}\n\nexport interface DdcStatus {\n readonly schemaVersion: typeof DDC_STATUS_SCHEMA;\n readonly health: DdcStatusHealth;\n readonly layers: readonly DdcStatusLayer[];\n readonly gameDir?: string;\n readonly projectDdcRoot?: string;\n}\n\nexport type BrowserDdcRecoveryAction = Omit<DdcRecoveryAction, 'exactTarget'>;\nexport type BrowserDdcStatusLayer = Omit<DdcStatusLayer, 'actions'> & {\n readonly actions: readonly BrowserDdcRecoveryAction[];\n};\nexport type BrowserDdcStatus = Omit<DdcStatus, 'gameDir' | 'projectDdcRoot' | 'layers'> & {\n readonly layers: readonly BrowserDdcStatusLayer[];\n};\n\nexport function serializeDdcStatus(status: DdcStatus): string {\n return JSON.stringify(status);\n}\n\nexport function projectDdcStatusForBrowser(status: DdcStatus): BrowserDdcStatus {\n return {\n schemaVersion: DDC_STATUS_SCHEMA,\n health: status.health,\n layers: status.layers.map((layer) => ({\n ...layer,\n actions: layer.actions.map(({ exactTarget: _exactTarget, ...action }) => action),\n })),\n };\n}\n\nexport const toBrowserDdcStatus = projectDdcStatusForBrowser;\n"]}
@@ -46,6 +46,9 @@ export declare class DdcLifecycle {
46
46
  }): Promise<void>;
47
47
  heartbeat(lease: DdcLease): Promise<DdcLease>;
48
48
  close(lease: DdcLease): Promise<void>;
49
+ discard(lease: DdcLease): Promise<void>;
50
+ /** Restore the last accepted head after a failed multi-owner generation commit. */
51
+ restore(head: DdcHead): Promise<void>;
49
52
  revoke(lease: DdcLease): Promise<void>;
50
53
  recover(guid: string, desiredKey: string): Promise<DdcHead>;
51
54
  private allocateGeneration;
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;IAChC,QAAQ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,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAC1D,OAAO,CAAC,IAAI,CAAC;IAkBH,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAoB7C,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAarC,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAcpD,mFAAmF;IACtE,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBrC,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;YAsB1D,kBAAkB;YAoBlB,IAAI;YA0BJ,KAAK;CAOpB"}
@@ -0,0 +1,50 @@
1
+ import type { AssetPublicationEnvelope, AssetPublicationExternalEvidence, AssetPublicationFailure, AssetPublicationLocator, AssetPublicationOutput, AssetPublicationRecovery, Result } from '@forgeax/engine-types';
2
+ export interface ScriptablePackPublicationSnapshot {
3
+ readonly current?: AssetPublicationEnvelope;
4
+ readonly lastKnownGood?: AssetPublicationEnvelope;
5
+ readonly failure?: AssetPublicationFailure;
6
+ }
7
+ export interface ScriptablePackPublicationError extends AssetPublicationFailure {
8
+ readonly recovery: AssetPublicationRecovery;
9
+ readonly current?: AssetPublicationLocator;
10
+ readonly lastKnownGood?: AssetPublicationLocator;
11
+ }
12
+ export interface AcceptedPublicationCandidate {
13
+ readonly envelope: AssetPublicationEnvelope;
14
+ readonly cancelled?: boolean;
15
+ }
16
+ export interface ScriptablePackPublicationBuildInput {
17
+ readonly sourcePath: string;
18
+ readonly sourceRevision: string;
19
+ /** Optional caller generation; the DDC owner derives one when omitted. */
20
+ readonly generation?: number;
21
+ readonly digest: string;
22
+ readonly packageUrl: string;
23
+ readonly inputFingerprint: string;
24
+ readonly outputs: readonly AssetPublicationOutput[];
25
+ readonly externalEvidence: readonly AssetPublicationExternalEvidence[];
26
+ }
27
+ /**
28
+ * DDC-owned publication authority for source keyed producers. Transport
29
+ * adapters may stage bytes, but they do not retain current/LKG or generation
30
+ * state themselves.
31
+ */
32
+ export interface AcceptedPublicationStore {
33
+ observe(sourcePath: string): ScriptablePackPublicationSnapshot;
34
+ stage(sourcePath: string, candidate: AcceptedPublicationCandidate): Result<void, ScriptablePackPublicationError>;
35
+ commit(sourcePath: string, candidate: AcceptedPublicationCandidate, commitRoute: () => Promise<void> | void): Promise<Result<ScriptablePackPublicationSnapshot, ScriptablePackPublicationError>>;
36
+ discard(sourcePath: string, candidate: AssetPublicationEnvelope): void;
37
+ restore(sourcePath: string, snapshot: ScriptablePackPublicationSnapshot): void;
38
+ }
39
+ export declare function scriptablePackOutputSetDigest(outputs: readonly AssetPublicationOutput[]): string;
40
+ /** Derive a stable positive generation from the accepted publication tuple. */
41
+ export declare function scriptablePackPublicationGeneration(input: {
42
+ readonly sourceRevision: string;
43
+ readonly digest: string;
44
+ readonly outputSetDigest: string;
45
+ }): number;
46
+ /** Build the complete producer-owned tuple after the package route is finalized. */
47
+ export declare function createAcceptedPublication(input: ScriptablePackPublicationBuildInput): AssetPublicationEnvelope;
48
+ /** Create the one DDC publication authority shared by dev attempts. */
49
+ export declare function createAcceptedPublicationStore(): AcceptedPublicationStore;
50
+ //# sourceMappingURL=publication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publication.d.ts","sourceRoot":"","sources":["../src/publication.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,EACxB,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,MAAM,EACP,MAAM,uBAAuB,CAAC;A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