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O,EAAE,qBAAqB,EAAE,CAAC;IACjC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpD;AAED,qBAAa,oBAAoB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAA2B;IAEvD,YAAY,OAAO,EAAE,2BAA2B,EAG/C;IAED,IAAI,KAAK,IAAI,iBAAiB,CAE7B;IAEK,QAAQ,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAS5E;IAEK,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAY1D;IAEK,IAAI,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAW5C;IAEK,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/C;IAED,oEAAoE;IAC9D,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAWzD;CACD","sourcesContent":["/**\n * Remote Execution — target registry (2.14.0).\n *\n * A small durable catalog of concrete remote targets. It is NOT a mission store,\n * NOT an assignment store, and NOT a scheduler: it only records where execution\n * can physically happen. Target selection remains explicit/static until\n * Capability Routing.\n */\n\nimport type { RemoteExecutionTarget, RemoteTargetHealth } from \"./remote-target-types.js\";\nimport { parseRemoteExecutionTarget, RemoteTargetError } from \"./remote-target-types.js\";\nimport type { RemoteExecutionTransport } from \"./remote-transport.js\";\n\nexport type RemoteTargetLoadResult =\n\t| { status: \"ok\"; target: RemoteExecutionTarget }\n\t| { status: \"missing\" }\n\t| { status: \"corrupt\"; targetId: string; diagnostic: string };\n\nexport type RemoteTargetRegisterResult =\n\t| { status: \"created\" }\n\t| { status: \"idempotent\"; target: RemoteExecutionTarget }\n\t| { status: \"conflict\"; error: string };\n\nexport interface RemoteTargetStore {\n\treadonly storeId: string;\n\tregister(target: RemoteExecutionTarget): Promise<RemoteTargetRegisterResult>;\n\tload(targetId: string): Promise<RemoteTargetLoadResult>;\n\tlistTargets(): Promise<string[]>;\n\tremove(targetId: string): Promise<boolean>;\n}\n\nexport interface RemoteTargetRegistryOptions {\n\tstore: RemoteTargetStore;\n\t/** Transport used for health probes (optional). */\n\ttransport?: RemoteExecutionTransport;\n}\n\nexport interface RemoteTargetListResult {\n\tentries: RemoteExecutionTarget[];\n\tcorrupt: { targetId: string; diagnostic: string }[];\n}\n\nexport class RemoteTargetRegistry {\n\tprivate readonly _store: RemoteTargetStore;\n\tprivate readonly _transport?: RemoteExecutionTransport;\n\n\tconstructor(options: RemoteTargetRegistryOptions) {\n\t\tthis._store = options.store;\n\t\tthis._transport = options.transport;\n\t}\n\n\tget store(): RemoteTargetStore {\n\t\treturn this._store;\n\t}\n\n\tasync register(target: RemoteExecutionTarget): Promise<RemoteExecutionTarget> {\n\t\tconst parsed = parseRemoteExecutionTarget(target);\n\t\tif (!parsed.ok) {\n\t\t\tthrow new RemoteTargetError(\"INVALID_TARGET\", parsed.diagnostic, { targetId: target.targetId });\n\t\t}\n\t\tconst result = await this._store.register(parsed.target);\n\t\tif (result.status === \"created\") return parsed.target;\n\t\tif (result.status === \"idempotent\") return result.target;\n\t\tthrow new RemoteTargetError(\"TARGET_ALREADY_EXISTS\", result.error, { targetId: target.targetId });\n\t}\n\n\tasync get(targetId: string): Promise<RemoteExecutionTarget> {\n\t\tconst loaded = await this._store.load(targetId);\n\t\tif (loaded.status === \"missing\") {\n\t\t\tthrow new RemoteTargetError(\"TARGET_NOT_FOUND\", `Remote target not found: ${targetId}`, { targetId });\n\t\t}\n\t\tif (loaded.status === \"corrupt\") {\n\t\t\tthrow new RemoteTargetError(\"TARGET_CORRUPT\", `Remote target ${targetId} is corrupt: ${loaded.diagnostic}`, {\n\t\t\t\ttargetId,\n\t\t\t\tdiagnostic: loaded.diagnostic,\n\t\t\t});\n\t\t}\n\t\treturn loaded.target;\n\t}\n\n\tasync list(): Promise<RemoteTargetListResult> {\n\t\tconst ids = await this._store.listTargets();\n\t\tconst entries: RemoteExecutionTarget[] = [];\n\t\tconst corrupt: { targetId: string; diagnostic: string }[] = [];\n\t\tfor (const id of ids) {\n\t\t\tconst loaded = await this._store.load(id);\n\t\t\tif (loaded.status === \"ok\") entries.push(loaded.target);\n\t\t\telse if (loaded.status === \"corrupt\") corrupt.push({ targetId: id, diagnostic: loaded.diagnostic });\n\t\t}\n\t\tentries.sort((a, b) => (a.targetId < b.targetId ? -1 : a.targetId > b.targetId ? 1 : 0));\n\t\treturn { entries, corrupt };\n\t}\n\n\tasync remove(targetId: string): Promise<boolean> {\n\t\treturn this._store.remove(targetId);\n\t}\n\n\t/** Non-mutating reachability probe, surfacing structured health. */\n\tasync probe(targetId: string): Promise<RemoteTargetHealth> {\n\t\tconst target = await this.get(targetId);\n\t\tif (!this._transport) {\n\t\t\treturn {\n\t\t\t\ttargetId,\n\t\t\t\tstatus: \"unknown\",\n\t\t\t\tsummary: \"no transport configured for probes\",\n\t\t\t\tobservedAtMs: Date.now(),\n\t\t\t};\n\t\t}\n\t\treturn this._transport.probe(target);\n\t}\n}\n"]}