{"version":3,"file":"unity-scheduler-proof.d.ts","sourceRoot":"","sources":["../../../src/core/unity-mcp/unity-scheduler-proof.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAM1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,EAAE,oBAGzC,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,0BAA0B,EAAE,mBAGxC,CAAC;AAEF,MAAM,WAAW,0BAA0B;IAC1C,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,yBAAyB;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAiEpH","sourcesContent":["/**\n * Unity MCP Vertical Slice — scheduler designation proof (2.13.0).\n *\n * Proves LOTG Unity participates in Jensen's existing scheduling concepts\n * WITHOUT implementing Worker execution. It registers a logical Unity-capable\n * executor, creates a real durable mission requiring Unity capability, enqueues\n * scheduling intent, runs one scheduler tick, and stops at the durable\n * Assignment. The vertical-slice inspection is then explicitly correlated with\n * the resulting missionId / intentId / assignmentId / executorId.\n *\n * No assignment is accepted or started here. The Worker daemon + remote\n * execution are explicitly out of scope and remain a later slice.\n */\n\nimport { join } from \"node:path\";\nimport { AssignmentControlService } from \"../assignment/assignment-control-service.js\";\nimport type { MissionRequirements } from \"../assignment/assignment-types.js\";\nimport { FileAssignmentStore } from \"../assignment/file-assignment-store.js\";\nimport type { ExecutorCapabilities } from \"../executor-registry/index.js\";\nimport { ExecutorControlService, FileExecutorRegistry } from \"../executor-registry/index.js\";\nimport { createDurableMissionRecord, createMissionRequest } from \"../mission-domain/index.js\";\nimport { FileDurableMissionStore } from \"../mission-durable/index.js\";\nimport { FileSchedulerStore } from \"../scheduler/file-scheduler-store.js\";\nimport { SchedulerControlService } from \"../scheduler/scheduler-control-service.js\";\nimport type { SchedulingDecisionKind } from \"../scheduler/scheduler-types.js\";\n\n/** Stable logical executor identity for the LOTG Unity-capable target. */\nexport const UNITY_EXECUTOR_ID = \"blackpearl-unity-lotg\";\n\n/** Existing-style capability advertisement using the Executor Registry model. */\nexport const UNITY_EXECUTOR_CAPABILITIES: ExecutorCapabilities = {\n\tplatform: { os: \"windows\", arch: \"x64\" },\n\tspecialized: [\"unity.editor\", \"unity.mcp\", \"project.lotg\"],\n};\n\n/** Mission requirement that only a Unity-capable Windows executor can satisfy. */\nexport const UNITY_MISSION_REQUIREMENTS: MissionRequirements = {\n\tplatform: { os: \"windows\" },\n\tspecialized: [\"unity.editor\", \"unity.mcp\", \"project.lotg\"],\n};\n\nexport interface UnitySchedulerProofOptions {\n\t/** Durable store root (temp dir for tests; agent dir for operator proof). */\n\troot: string;\n\tmissionId?: string;\n\tnow?: () => number;\n\ttickIdFactory?: () => string;\n}\n\nexport interface UnitySchedulerProofResult {\n\tmissionId: string;\n\texecutorId: string;\n\tintentId: string;\n\tdecision: SchedulingDecisionKind;\n\tassignmentId?: string;\n\treason?: string;\n}\n\n/**\n * Run the scheduler designation proof. Deterministic given the same clock; the\n * chosen executor is total-ordered by executorId and the mission requires the\n * Unity specialized capabilities.\n */\nexport async function runUnitySchedulerProof(options: UnitySchedulerProofOptions): Promise<UnitySchedulerProofResult> {\n\tconst now = options.now ?? (() => Date.now());\n\tconst missionStore = new FileDurableMissionStore({ root: join(options.root, \"missions\") });\n\tconst executorStore = new FileExecutorRegistry({ root: join(options.root, \"executors\") });\n\tconst assignmentStore = new FileAssignmentStore({ root: join(options.root, \"assignments\") });\n\tconst schedulerStore = new FileSchedulerStore({ root: join(options.root, \"intents\") });\n\n\tconst executors = new ExecutorControlService({\n\t\tstore: executorStore,\n\t\tnow,\n\t\texpiryMs: 30_000,\n\t\tassignmentStore,\n\t});\n\tconst assignments = new AssignmentControlService({\n\t\tstore: assignmentStore,\n\t\tmissions: missionStore,\n\t\texecutors,\n\t\tnow,\n\t});\n\tconst scheduler = new SchedulerControlService({\n\t\tstore: schedulerStore,\n\t\tmissions: missionStore,\n\t\texecutors,\n\t\tassignments,\n\t\tnow,\n\t\ttickIdFactory: options.tickIdFactory ?? (() => \"tick_unity_proof\"),\n\t});\n\n\tawait executors.registerExecutor({\n\t\texecutorId: UNITY_EXECUTOR_ID,\n\t\tdisplayName: \"Blackpearl LOTG Unity Editor\",\n\t\tlabels: [\"blackpearl\", \"lotg\"],\n\t\tconfiguredCapabilities: UNITY_EXECUTOR_CAPABILITIES,\n\t});\n\tawait executors.activateExecutor(UNITY_EXECUTOR_ID, {\n\t\thostname: \"blackpearl\",\n\t\tplatform: \"windows\",\n\t\tarch: \"x64\",\n\t\tadvertisedCapabilities: { ...UNITY_EXECUTOR_CAPABILITIES, platform: undefined },\n\t});\n\n\tconst missionId = options.missionId ?? `mission_unity_proof`;\n\tconst request = createMissionRequest({\n\t\tmissionId,\n\t\tobjective: \"Inspect the currently open LOTG Unity project on Blackpearl through Unity MCP\",\n\t\tagent: \"worker\",\n\t\texecutionMode: \"observe\",\n\t\tacceptanceCriteria: [],\n\t});\n\tawait missionStore.create(createDurableMissionRecord({ request, now: now() }));\n\n\tconst enqueued = await scheduler.enqueueIntent(missionId, { requirements: UNITY_MISSION_REQUIREMENTS });\n\tconst tick = await scheduler.runTick();\n\n\tconst decision = tick.decisions.find((entry) => entry.missionId === missionId);\n\tconst assignment = await assignments.getCurrentForMission(missionId).catch(() => undefined);\n\n\treturn {\n\t\tmissionId,\n\t\texecutorId: UNITY_EXECUTOR_ID,\n\t\tintentId: enqueued.intentId,\n\t\tdecision: decision?.decision ?? \"UNSCHEDULABLE\",\n\t\tassignmentId: assignment?.assignmentId,\n\t\treason: decision?.reason,\n\t};\n}\n"]}