{"version":3,"file":"fork-policy.d.ts","sourceRoot":"","sources":["../../../src/harness/session/fork-policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC;AAEjE,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAClC,OAAO,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAC7D,KAAK,EAAE,QAAQ,GAAG,MAAM,EACxB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GACzC,eAAe,CAkBjB","sourcesContent":["/**\n * Final action for current state at one address:\n * - copy: emit the current value in the destination;\n * - exclude: omit it from the destination;\n * - reconstruct: do not copy the row because lane handling emits a coherent replacement.\n */\nexport type ForkDisposition = \"copy\" | \"exclude\" | \"reconstruct\";\n\n/** Decide the final fork action for one current scalar or list address. */\nexport function classifyForkAddress(\n\taddress: { readonly namespace: string; readonly key: string },\n\tscope: \"branch\" | \"tree\",\n\tisEntryCopied: (entryId: string) => boolean,\n): ForkDisposition {\n\tswitch (address.namespace) {\n\t\tcase \"pi.session.name\":\n\t\t\treturn \"copy\";\n\t\tcase \"pi.entry.label\":\n\t\t\treturn isEntryCopied(address.key) ? \"copy\" : \"exclude\";\n\t\tcase \"pi.branch.tip\":\n\t\tcase \"pi.lane.config\":\n\t\tcase \"pi.lane.state\":\n\t\t\treturn \"reconstruct\";\n\t\tcase \"pi.result\":\n\t\t\treturn \"exclude\";\n\t}\n\tif (address.namespace.startsWith(\"pi.op.\") || address.namespace.startsWith(\"pi.pending.\")) return \"exclude\";\n\tif (address.namespace === \"pi\" || address.namespace.startsWith(\"pi.\")) {\n\t\tthrow new Error(`Unknown reserved fork namespace: ${address.namespace}`);\n\t}\n\treturn scope === \"tree\" ? \"copy\" : \"exclude\";\n}\n"]}