@unbrained/pm-cli 2026.11.28 → 2026.11.29
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli/commander-usage.js +4 -4
- package/dist/cli/error-guidance.js +5 -5
- package/dist/cli/linked-resource-value-list.js +2 -0
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-YEMFOKFG.js → chunk-3AZOATC2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LMDIKSDZ.js → chunk-3E53F7QY.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-OFIYA3PI.js → chunk-3TK2YOVB.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-C4O5TZY3.js → chunk-3US5T6B2.js} +60 -60
- package/dist/cli-bundle/chunks/chunk-4EBHZBM2.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-MGJMQSN4.js → chunk-4QA5O64H.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-5EFS7K7Y.js +1 -0
- package/dist/cli-bundle/chunks/chunk-CNZOC6JD.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-TWRUA2NH.js → chunk-CV2B4JUB.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-DBASKWBO.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-Q6BGQRCB.js → chunk-EYEQC3L2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-O2SWNEBW.js → chunk-FRYNDVLN.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-GSLOAEY2.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-T7RZPIOB.js → chunk-JFPCL45G.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CTM26LUE.js → chunk-JQHLOSSS.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-JV7LREUF.js +3 -0
- package/dist/cli-bundle/chunks/chunk-K3MVVDLN.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-6OIHST4I.js → chunk-K672XXGQ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-T7UTG56V.js → chunk-KCR4NF2A.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-L7HON3BE.js +23 -0
- package/dist/cli-bundle/chunks/chunk-LQEB6GSY.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ZXERHBMA.js → chunk-NLHNB2L3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FG4TNQQM.js → chunk-NRCGGNOE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KHFUHGL3.js → chunk-OGVSGXQX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CATRDGAB.js → chunk-PY6A7ULK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-O2WNNIKK.js → chunk-Q6GIFUCW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CDUV7DFD.js → chunk-R6M5OGJH.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-RWHS77ME.js +113 -0
- package/dist/cli-bundle/chunks/chunk-SV27NNXQ.js +2 -0
- package/dist/cli-bundle/chunks/chunk-TE6FBDHP.js +4 -0
- package/dist/cli-bundle/chunks/{chunk-LRGYV6QQ.js → chunk-VI3A7UZ2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-E2LQ6LCJ.js → chunk-WLZ5KVM2.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-WNB62BGK.js +10 -0
- package/dist/cli-bundle/chunks/chunk-X5D5YUHR.js +2 -0
- package/dist/cli-bundle/chunks/chunk-ZK4CY24V.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-JQYPSABI.js → chunk-ZSBPE36C.js} +2 -2
- package/dist/cli-bundle/chunks/field-definition-losses-XKE4DRUA.js +2 -0
- package/dist/cli-bundle/chunks/{field-option-collisions-G4LQ2646.js → field-option-collisions-OZE43TOH.js} +2 -2
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-H3MMNXXG.js → indexed-receipt-blobs-DR3FDHND.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-O7L3AA2W.js → item-revision-3WXNNFLP.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-DJ5GAITL.js +2 -0
- package/dist/cli-bundle/chunks/linked-resource-value-list-2655COY2.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-actor-A45DFDEO.js → mutation-actor-QOKPDYM4.js} +2 -2
- package/dist/cli-bundle/chunks/mutation-admission-JNJHB3E6.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-FCPGG2UT.js → register-list-query-YGVUE4YZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-VD3JX23I.js → register-mutation-3JVZQDHH.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-LCHUHKRA.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-EWAZZWPL.js → register-setup-IJ7M3VUK.js} +2 -2
- package/dist/cli-bundle/chunks/runtime-schema-OAIUNQRL.js +2 -0
- package/dist/cli-bundle/chunks/{settlement-hook-KWBOSRDZ.js → settlement-hook-BIVNGBZF.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-UIDZMTE5.js → stage-7BD7U2BX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-26P6C6OO.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-2CQFGJQ6.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-42SU4LK3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-7P6OGPEG.js → chunk-5NSWNLFE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y7EC2L2G.js → chunk-ACTBMSCH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-BPBKHY6H.js +100 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YC3PFFDE.js → chunk-BPOU2S44.js} +57 -57
- package/dist/cli-bundle/focused-chunks/chunk-BZ3PUUPG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-AHCOSTL7.js → chunk-CWQLW4ZO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7EKKUYN5.js → chunk-EUDAUT6T.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-GTUPHXKR.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NGFDPEP7.js → chunk-IRYNVGKH.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-JFICNN4T.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-J4V3J5MC.js → chunk-KLOHZNJ4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KPASZGBL.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-Q6JCMFGU.js → chunk-KWKPX36T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZYHGQIQ7.js → chunk-LKTRICZR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-OEMI52ZS.js → chunk-LSVRZ4KQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MYWUMVCZ.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-CQLOYNJY.js → chunk-NNLENKU7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-NO5MUY4I.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-XVCMYFQU.js → chunk-NZA2LP4Y.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HCWDMFWA.js → chunk-PPCBCPIZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-QTV6UE2Q.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-VNU3IFBL.js → chunk-S4AC7OMI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YX75PQFO.js → chunk-S5VG7RFY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JD45Y2BR.js → chunk-TSZVCALS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-O33WUEAF.js → chunk-TX24L7RQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-WJAUHPXD.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4SX2BN4V.js → chunk-XR6MLUVW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/field-definition-losses-GGA6FUHD.js +2 -0
- package/dist/cli-bundle/focused-chunks/{field-option-collisions-63YQ2J3N.js → field-option-collisions-HABQYZMQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-PG2VJ3MB.js → indexed-receipt-blobs-EUYZJR5R.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-revision-PV5O6F5Y.js → item-revision-YH5R7YPW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-YZ2PUPGM.js +2 -0
- package/dist/cli-bundle/focused-chunks/{mutation-actor-2AAUJG2Z.js → mutation-actor-DJ2VRLKG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-3SECKVKY.js +2 -0
- package/dist/cli-bundle/focused-chunks/runtime-schema-IDRXWCC4.js +2 -0
- package/dist/cli-bundle/focused-chunks/{settlement-hook-4MGRERCT.js → settlement-hook-Q6MJQKIE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-56RYPMBK.js → stage-FEJT2UCG.js} +2 -2
- package/dist/cli-bundle/main.js +26 -26
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +63 -63
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +1 -1
- package/dist/core/extensions/item-fields.d.ts +18 -1
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/fs/fs-utils.d.ts +8 -0
- package/dist/core/fs/fs-utils.js +2 -2
- package/dist/core/item/item-type-inspection.js +2 -0
- package/dist/core/item/type-registry.js +1 -1
- package/dist/core/schema/runtime-schema.d.ts +19 -0
- package/dist/core/schema/runtime-schema.js +2 -2
- package/dist/core/store/settings.d.ts +7 -0
- package/dist/core/store/settings.js +5 -5
- package/dist/sdk/extension-command-context.js +2 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/runtime/schema.js +1 -1
- package/dist/sdk/schema/field-definition-losses.js +1 -1
- package/dist/sdk/schema/schema-file-entry-losses.js +2 -0
- package/dist/sdk/test/execution.d.ts +9 -1
- package/dist/sdk/test/execution.js +4 -4
- package/docs/COMMANDS.md +3 -1
- package/docs/CONFIGURATION.md +1 -1
- package/docs/EXTENSIONS.md +1 -1
- package/docs/SDK_AUDITED_MUTATIONS.md +9 -0
- package/marketplace.json +1 -1
- package/node_modules/fast-json-patch/README.md +2 -2
- package/node_modules/fast-json-patch/dist/fast-json-patch.js +604 -818
- package/node_modules/fast-json-patch/dist/fast-json-patch.min.js +4 -8
- package/node_modules/fast-json-patch/package.json +14 -17
- package/package.json +2 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-2YD2AERA.js +0 -2
- package/dist/cli-bundle/chunks/chunk-54AQJTUH.js +0 -3
- package/dist/cli-bundle/chunks/chunk-56DKWGHE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-56GUDMXN.js +0 -113
- package/dist/cli-bundle/chunks/chunk-5ECCMDSU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-6RBD2AKU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-D3I5AHNN.js +0 -2
- package/dist/cli-bundle/chunks/chunk-MO6PPUI6.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RGE3XW3A.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SP6CDM6B.js +0 -31
- package/dist/cli-bundle/chunks/chunk-WKDKBS4P.js +0 -4
- package/dist/cli-bundle/chunks/chunk-YLS2N4SN.js +0 -2
- package/dist/cli-bundle/chunks/field-definition-losses-JFMMMVTV.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-4XC74ULD.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-SIUIMAEO.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-KHJD4GFZ.js +0 -2
- package/dist/cli-bundle/chunks/runtime-schema-3RAXYNG5.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5MZXU6HB.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-64DSKZJN.js +0 -100
- package/dist/cli-bundle/focused-chunks/chunk-A5B43EWU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-E4C6T3NL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KMGI5GZP.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MSLRDKWL.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-RBOWKXFV.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-TF57RHS2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-X5ZVPFK7.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-Z4FWJGQG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZHHFOQSL.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-ZUAPUBJK.js +0 -2
- package/dist/cli-bundle/focused-chunks/field-definition-losses-NUZO3JCP.js +0 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-S5QXBGAT.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-X7HHNERR.js +0 -2
- package/dist/cli-bundle/focused-chunks/runtime-schema-5J2ONRNV.js +0 -2
- package/node_modules/fast-json-patch/webpack.config.js +0 -63
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ba as l}from"./chunk-BPBKHY6H.js";import{k as y,m,n as f,o as h}from"./chunk-TX24L7RQ.js";import{z as a}from"./chunk-IRYNVGKH.js";var R=[{exit_code:a.SUCCESS,outcome:"effect",success:!0,meaning:"The requested operation completed with its intended effect."},{exit_code:a.GENERIC_FAILURE,outcome:"internal_failure",success:!1,meaning:"An unexpected runtime or internal failure prevented completion."},{exit_code:a.USAGE,outcome:"refused_input",success:!1,meaning:"The invocation was refused because its input or composition was invalid."},{exit_code:a.NOT_FOUND,outcome:"refused_tracker_state",success:!1,meaning:"The requested tracker, item, or resource was not present."},{exit_code:a.CONFLICT,outcome:"conflict",success:!1,meaning:"Current state or concurrency prevented the requested effect."},{exit_code:a.DEPENDENCY_FAILED,outcome:"dependency_failed",success:!1,meaning:"A required dependency operation failed."},{exit_code:a.NO_EFFECT,outcome:"no_effect",success:!0,meaning:"The request was valid and completed, but matched nothing to change."},{exit_code:a.PARTIAL_EFFECT,outcome:"partial_effect",success:!0,meaning:"The request completed and changed some, but not all, selected targets."}],b=[a.SUCCESS,a.GENERIC_FAILURE,a.USAGE,a.NOT_FOUND,a.CONFLICT,a.DEPENDENCY_FAILED],I=new Set(["close-many","update-many"]),w=l.map(t=>({command:t,exit_codes:I.has(t)?[...b,a.NO_EFFECT,a.PARTIAL_EFFECT]:[...b]})),v=new Map(w.map(t=>[t.command,t])),D=[a.SUCCESS,a.NO_EFFECT,a.PARTIAL_EFFECT];function Ee(t){return D.includes(t)}function Ae(t){return R.some(e=>e.exit_code===t)}function Oe(t){let e=t.trim().toLowerCase().split(/\s+/u).filter(Boolean).join(" ");return v.get(e)??v.get(e.split(" ")[0])}function Te(t,e=l,s=w){let o=new Map(s.map(r=>[r.command,r])),i=e.filter(r=>!o.has(r)),n=t.filter(r=>{let _=o.get(r.command)??o.get(r.command.split(" ")[0]);return _===void 0||!_.exit_codes.includes(r.exit_code)}),d=new Set(t.map(r=>r.exit_code)),c=[...new Set(s.flatMap(r=>r.exit_codes))].filter(r=>!d.has(r)).sort((r,_)=>r-_);return{ok:i.length===0&&n.length===0&&c.length===0,missing_commands:i,undeclared_observations:n,unreachable_exit_codes:c}}function Se(t){return t.applied===0&&t.failed>0?{outcome:"dependency_failed",exit_code:a.DEPENDENCY_FAILED}:t.applied===0?{outcome:"no_effect",exit_code:a.NO_EFFECT}:t.skipped>0||t.failed>0||t.unmatched>0?{outcome:"partial_effect",exit_code:a.PARTIAL_EFFECT}:{outcome:"effect",exit_code:a.SUCCESS}}var g=[{exit_code:1,class:"generic_failure"},{exit_code:2,class:"usage"},{exit_code:3,class:"not_found"},{exit_code:4,class:"conflict"},{exit_code:5,class:"dependency_failed"}],q=new Map(g.map(t=>[t.exit_code,t.class]));function x(t){return[...new Set(t.map(e=>e.trim()).filter(Boolean))].sort()}function L(t){if(!t)return[];let e=new Set,s=new Set;return t.map(o=>{let i=o.state.trim(),n=o.probe_id.trim(),d=x(o.entrypoints);if(!/^[a-z][a-z0-9_]*$/.test(i)||!/^[a-z][a-z0-9-]*$/.test(n)||d.length===0||e.has(i)||s.has(n))throw new TypeError("Invalid pm refusal state contract");return e.add(i),s.add(n),{state:i,probe_id:n,entrypoints:d,expected_exit_class:o.expected_exit_class}}).sort((o,i)=>o.state.localeCompare(i.state))}function j(t,e,s,o,i){return![[1,2,3,4,5].includes(t.exit_code),t.meaning.trim().length>0,t.recovery.trim().length>0,e.length>0,s.length>0,/^[a-z][a-z0-9_]*$/.test(o),i.every(n=>/^[a-z][a-z0-9_]*$/.test(n)),q.get(t.exit_code)===t.class].includes(!1)}function F(t,e){let s=t,o=new Set;for(;s.canonical_code!==s.code;){if(o.has(s.code))throw new TypeError(`Alias cycle in pm error code catalog: ${t.code}`);o.add(s.code);let i=e.get(s.canonical_code);if(!i)throw new TypeError(`Invalid pm error code contract: ${t.code}`);s=i}return s}function $(t){let e=new Map(t.map(s=>[s.code,s]));for(let s of t){let o=F(s,e);if(o.exit_code!==s.exit_code||o.class!==s.class)throw new TypeError(`Alias transport mismatch for pm error code: ${s.code}`);let i=t.filter(n=>n.code!==o.code&&n.canonical_code===o.code).map(n=>n.code).sort();if(s.code===o.code?JSON.stringify(s.aliases)!==JSON.stringify(i):s.aliases.length>0)throw new TypeError(`Invalid pm error code contract: ${s.code}`)}}function E(t){let e=new Set,s=t.map(o=>{let i=o.code.trim();if(!/^[a-z][a-z0-9_]*$/.test(i))throw new TypeError(`Invalid pm error code: ${JSON.stringify(o.code)}`);if(e.has(i))throw new TypeError(`Duplicate pm error code: ${i}`);e.add(i);let n=x(o.sources),d=x(o.emitting_commands),u=(o.canonical_code??i).trim(),c=x(o.aliases??[]),r=L(o.owned_states);if(!j(o,n,d,u,c))throw new TypeError(`Invalid pm error code contract: ${i}`);if(r.some(_=>_.expected_exit_class!==o.class))throw new TypeError(`Invalid pm refusal state exit class: ${i}`);return Object.freeze({...o,code:i,meaning:o.meaning.trim(),recovery:o.recovery.trim(),sources:n,emitting_commands:d,canonical_code:u,aliases:c,owned_states:r})});return $(s),Object.freeze(s.sort((o,i)=>o.code.localeCompare(i.code)))}function Ne(t,e){let s=C(t,e);return C(s.canonical_code??s.code,e)}function C(t,e){let s=t.trim(),o=e.find(i=>i.code===s);if(!o)throw new TypeError(`Unknown pm error code "${s}"`);return o}var z="Inspect the structured error guidance, then retry the suggested command when one is present.",U=new Map(g.map(t=>[t.exit_code,t.class]));function A(t){return t.map(e=>{let s=`${e.code.replaceAll("_"," ")} condition.`,o={code:e.code,meaning:`${s.charAt(0).toUpperCase()}${s.slice(1)}`,stability:e.stable?"stable":"provisional",exit_code:e.exit_code,class:U.get(e.exit_code),recovery:z,sources:e.sources,emitting_commands:e.emitting_commands??["*"],canonical_code:e.canonical_code??e.code,aliases:e.aliases??[]};return e.owned_states&&(o.owned_states=e.owned_states),o})}var O=[{code:"acceptance_criteria_mutation_conflict",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_remove_unmatched",exit_code:3,sources:["sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_semicolon_forbidden",exit_code:2,stable:!0,sources:["core/item/parse.ts"]},{code:"accepted_rejected_value",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"alias_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"alias_target_missing",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"already_claimed_by",exit_code:4,stable:!0,sources:["sdk/lifecycle/claim.ts"],emitting_commands:["claim"]},{code:"ambiguous_option_combination",exit_code:2,stable:!0,sources:["sdk/lifecycle/claim.ts","sdk/lifecycle/plan.ts"],emitting_commands:["claim","plan"]},{code:"annotation_alias_conflict",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"annotation_entry_mismatch",exit_code:4,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_invalid",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_without_target",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_flag_like_value",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_if_absent_without_append",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_message_without_text",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_text_compacted",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_text_source_conflict",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"annotation_transposed_subcommand",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"append_empty_body",exit_code:2,stable:!0,sources:["sdk/lifecycle/append.ts"],emitting_commands:["append"]},{code:"assurance_registry_invalid",exit_code:1,sources:["sdk/governance/assurance.ts"]},{code:"bare_comma_entry_ambiguous",exit_code:2,sources:["core/item/parse.ts"]},{code:"blocker_identity_read_failed",exit_code:1,sources:["sdk/query/declared-blockers.ts"]},{code:"body_file_conflicts_with_body",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_missing_path",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_unreadable",exit_code:3,stable:!0,sources:["core/io/body-file.ts"]},{code:"budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"bulk_create_route",exit_code:2,sources:["cli/register-mutation.ts"]},{code:"bulk_ids_input_empty",exit_code:2,sources:["core/io/bulk-ids-input.ts","sdk/history-compact.ts","sdk/history-mcp.ts"],owned_states:[{state:"bulk_ids_stdin_contains_no_nonempty_ids",probe_id:"bulk-ids-stdin-empty",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_missing_path",exit_code:2,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_token_omits_its_path",probe_id:"bulk-ids-file-path-missing",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_unreadable",exit_code:3,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_path_cannot_be_read",probe_id:"bulk-ids-file-unreadable",entrypoints:["update-many"],expected_exit_class:"not_found"}]},{code:"bundle_integrity_torn_install",exit_code:1,stable:!0,sources:["cli/bundle-integrity.ts"]},{code:"capability_undeclared",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"capability_unused",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"child_projection_item_bound_exceeded",exit_code:1,stable:!0,sources:["sdk/item-children.ts"]},{code:"close_reason_required",exit_code:2,stable:!0,sources:["sdk/lifecycle-policy.ts","sdk/lifecycle/close-many.ts"],emitting_commands:["*","close-many"]},{code:"close_through_update",exit_code:1,stable:!0,sources:["core/telemetry/observability.ts"]},{code:"close_validation_deferred_fields",exit_code:2,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"close_validation_missing_fields",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"collected_zero_items",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"collection_transposed_subcommand",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"command_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"command_namespace",exit_code:2,stable:!0,sources:["sdk/cli-contracts/runtime-contracts.ts"]},{code:"command_override_conflict",exit_code:4,stable:!0,sources:["sdk/compose.ts"]},{code:"config_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"config_key_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts","sdk/config.ts"]},{code:"config_value_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"conflicting_lifecycle_owner",exit_code:2,stable:!0,sources:["cli/register-operations.ts"]},{code:"context_evaluation_read_incomplete",exit_code:2,sources:["sdk/context-relevance.ts"]},{code:"context_signal_store_invalid",exit_code:2,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_stale",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_write_failed",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_takes_no_item_argument",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"core_item_field_requires_dedicated_flag",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"create_deferral_conflict",exit_code:2,sources:["sdk/lifecycle/create-deferrals.ts"],emitting_commands:["create"]},{code:"create_deferral_field_unsupported",exit_code:2,sources:["sdk/lifecycle/create-deferrals.ts"],emitting_commands:["create"]},{code:"create_deferral_fields_required",exit_code:2,sources:["sdk/lifecycle/create-deferrals.ts"],emitting_commands:["create"]},{code:"create_deferral_reason_required",exit_code:2,sources:["sdk/lifecycle/create-deferrals.ts"],emitting_commands:["create"]},{code:"create_positional_type_without_title",exit_code:2,stable:!0,sources:["cli/register-mutation.ts"]},{code:"dependency_cardinality_created",exit_code:2,sources:["sdk/graph/cardinality-integrity.ts"]},{code:"dependency_edge_not_allowed",exit_code:2,stable:!0,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_flag_value_invalid",exit_code:2,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_remove_no_match",exit_code:3,sources:["sdk/lifecycle/dependency-removal.ts"],emitting_commands:["update"]},{code:"dependency_target_not_found",exit_code:3,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_temporal_order_invalid",exit_code:2,sources:["sdk/dependency-flag-validation.ts"]},{code:"duplicate_canonical_flag",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"duplicate_command",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"duplicate_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"duplicate_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"duplicate_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"duplicate_probe",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"duplicate_sweep_cost_limit",exit_code:4,stable:!0,sources:["sdk/query/duplicate-candidates.ts"],emitting_commands:["duplicate-candidates"]},{code:"duplicate_target_circular",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_is_duplicate",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_missing",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_self",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"empty_corpus",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"empty_surface",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"event_cursor_query_mismatch",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"event_history_integrity_failed",exit_code:1,sources:["core/history/event-index.ts"]},{code:"event_index_unavailable",exit_code:1,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"exit_code_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"expect_hash_background_unsupported",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_invalid",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_invocation_rewritten",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_requires_mutation",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_target_required",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expected_revision_duplicate",exit_code:2,sources:["core/store/item-mutation-precondition.ts"]},{code:"expected_revision_scope_conflict",exit_code:2,sources:["core/store/item-mutation-precondition.ts"]},{code:"extension_command_activation_failed",exit_code:1,stable:!0,sources:["cli/commander-usage.ts"]},{code:"extension_dependency_name_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_spec_invalid",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_version_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_flag_value_invalid",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_install_incomplete_source_scan",exit_code:2,sources:["sdk/extension/install-plan.ts"]},{code:"extension_install_rollback_failed",exit_code:1,sources:["sdk/extension/install-snapshot.ts"]},{code:"extension_install_soft_failed",exit_code:1,stable:!0,sources:["cli/register-setup.ts"]},{code:"extension_install_source_contains_destination",exit_code:2,stable:!0,sources:["sdk/extension/install-runtime.ts"]},{code:"extension_item_field_reserved",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_type_conflict",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_unknown",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_mutation_guard_failed",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_decision",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_denial",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_timed_out",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_option_disabled",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_option_spelling_conflict",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_read_output_invalid",exit_code:2,sources:["sdk/read-output/extension.ts"]},{code:"extension_update_health_partial_coverage",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"extensions_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"field_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_flag_invalid",exit_code:2,sources:["core/profile/profile-lint.ts"]},{code:"field_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_mcp_input_collision",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_option_collision",exit_code:1,sources:["core/profile/profile-lint.ts"]},{code:"finalization_invalid_document",exit_code:2,sources:["sdk/transactions/item-finalization.ts"]},{code:"github_source_entry_unbuilt",exit_code:2,stable:!0,sources:["sdk/extension/shared.ts"]},{code:"hierarchy_cardinality_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"hierarchy_cycle_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"hierarchy_parent_divergence_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"history_append_only_repair_unavailable",exit_code:4,sources:["sdk/history/append-only-repair.ts"]},{code:"history_author_acknowledge_plan_conflict",exit_code:4,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_plan_fingerprint_required",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_preview_limit_invalid",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_required_values_missing",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_selector_conflict",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_selector_required",exit_code:2,stable:!0,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_target_not_actionable",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_target_unreadable",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_baseline_unavailable",exit_code:1,sources:["core/history/projection.ts"]},{code:"history_compact_boundary_bridged",exit_code:2,sources:["sdk/history-compact.ts"]},{code:"history_drift_chain_mismatch",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_chain_mismatches"]},{code:"history_drift_chain_unbridgeable",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_hash_mismatch",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_hash_mismatches"]},{code:"history_drift_merge_receipt",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_missing_stream",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_missing_streams"]},{code:"history_drift_unreadable_stream",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_unreadable_streams"]},{code:"history_drift_unrepairable_stream",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_version_skew",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_version_skews"]},{code:"history_json_invalid",exit_code:1,sources:["core/history/read.ts"]},{code:"history_merge_conflict_markers_detected",exit_code:1,stable:!0,sources:["core/history/read.ts"],canonical_code:"merge_conflict_markers_detected"},{code:"history_record_integrity_invalid",exit_code:4,sources:["sdk/history/reanchor-refusal.ts"]},{code:"history_record_invalid",exit_code:1,sources:["core/history/read.ts"]},{code:"history_record_version_unsupported",exit_code:4,sources:["sdk/history/reanchor-refusal.ts"]},{code:"history_redact_bridge_unlocated",exit_code:1,sources:["sdk/history-redact.ts"]},{code:"history_replay_invalid",exit_code:1,sources:["core/history/projection.ts","core/history/tombstone.ts"]},{code:"history_salvage_refused",exit_code:4,sources:["sdk/history/salvage.ts"]},{code:"history_stream_over_compact_threshold",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"history_target_out_of_range",exit_code:1,stable:!0,sources:["core/history/projection.ts"]},{code:"history_timestamp_invalid",exit_code:1,sources:["core/history/event-index.ts","core/history/history.ts"]},{code:"history_union_rebase_conflict",exit_code:4,sources:["sdk/merge/history-scalar-rebase.ts"]},{code:"history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_unknown_author_events"]},{code:"history_version_mapping_unavailable",exit_code:2,sources:["core/history/version-address.ts"]},{code:"history_version_pruned",exit_code:2,sources:["core/history/projection.ts"]},{code:"history_version_unreconstructable",exit_code:2,sources:["core/history/projection.ts"]},{code:"host_environment_capacity_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_operation_invalid",exit_code:2,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_permission_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_resource_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"improvement_metric_contract_conflict",exit_code:4,sources:["sdk/improvement-ledger.ts"]},{code:"improvement_observation_conflict",exit_code:4,sources:["sdk/improvement-ledger.ts"]},{code:"in_progress_idle",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"in_progress_unowned",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"incomplete_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"inconsistent_concept_kind",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"init_existing_settings_requires_force",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"init_gitignore_unwritable",exit_code:1,stable:!0,sources:["sdk/workspace.ts"]},{code:"init_id_prefix_conflict",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"init_id_prefix_path_like",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"integrity_history_conflict_marker",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_storage_history_conflict_markers"]},{code:"integrity_history_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_history_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_ahead_format_version",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_format_version_ahead_items"]},{code:"integrity_item_conflict_marker",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_outdated_format_version",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_format_version_outdated_items"]},{code:"integrity_item_parse_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"invalid_argument_value",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/item/priority.ts","core/shared/url-credentials.ts","core/telemetry/observability.ts","sdk/config.ts","sdk/context-intent-contracts.ts","sdk/dependencies.ts","sdk/extension/listing-fields.ts","sdk/extension/static-inventory.ts","sdk/governance/assurance-mutation-error.ts","sdk/history-redact.ts","sdk/lifecycle/create.ts","sdk/lifecycle/task-composition.ts","sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts","sdk/linked-artifacts.ts","sdk/query/next.ts","sdk/runtime-input.ts","sdk/runtime.ts","sdk/runtime/mutation-admission.ts","sdk/runtime/mutation-value-validation.ts","sdk/runtime/schema-preview.ts","sdk/test/run-phases.ts","sdk/workspace.ts"],emitting_commands:["*","create","next","task-composition","update","update-many"]},{code:"invalid_command_usage",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"invalid_event_cursor",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_cursor_mode",exit_code:2,sources:["cli/register-list-query.ts","sdk/mutation-events.ts","sdk/runtime-extended-actions.ts"]},{code:"invalid_event_follow_interval",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_limit",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_since",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_history_analytics_limit",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_history_analytics_minimum_sample",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_history_analytics_since",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_improvement_ledger",exit_code:1,sources:["sdk/improvement-ledger-validation.ts"]},{code:"invalid_improvement_metric",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation_limit",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation_timestamp",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_provenance_predicate",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"invalid_query_cursor",exit_code:2,stable:!0,sources:["sdk/pagination.ts","sdk/query/window-pagination.ts"]},{code:"invalid_read_output_session",exit_code:2,sources:["sdk/read-output-session.ts"]},{code:"invalid_reproducible_process_environment",exit_code:2,sources:["sdk/reproducibility/process.ts"]},{code:"invalid_workspace_snapshot_target",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"item_already_active",exit_code:4,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"item_already_exists",exit_code:4,stable:!0,sources:["sdk/lifecycle/create.ts"],emitting_commands:["create"]},{code:"item_deleted",exit_code:3,sources:["core/history/tombstone.ts"]},{code:"item_document_encoding_invalid",exit_code:4,sources:["core/store/item-store.ts"]},{code:"item_document_invalid",exit_code:1,stable:!0,sources:["core/item/item-format.ts"]},{code:"item_document_roundtrip_failed",exit_code:1,stable:!0,sources:["core/item/item-format.ts"]},{code:"item_format_version_unsupported",exit_code:4,sources:["core/item/item-format.ts"]},{code:"item_id_collision",exit_code:4,stable:!0,sources:["sdk/lifecycle/copy.ts"],emitting_commands:["copy"]},{code:"item_identity_ambiguous",exit_code:4,sources:["core/store/item-store.ts"]},{code:"item_identity_conflict",exit_code:4,sources:["sdk/governance/validate-history-drift.ts","sdk/lifecycle/item-revision.ts","sdk/merge/three-way.ts","sdk/query/declared-blockers.ts"]},{code:"item_identity_reserved",exit_code:4,sources:["core/history/history.ts"]},{code:"item_not_found",exit_code:3,stable:!0,sources:["cli/error-guidance.ts","core/store/item-store.ts","core/telemetry/observability.ts","sdk/governance/validate-history-drift.ts"]},{code:"item_revision_conflict",exit_code:4,sources:["core/store/item-mutation-precondition.ts"]},{code:"likely_duplicate",exit_code:4,stable:!0,sources:["sdk/similarity.ts"]},{code:"linked_artifact_mutation_conflict",exit_code:2,sources:["sdk/linked-artifacts.ts"]},{code:"linked_artifact_note_conflict",exit_code:4,sources:["sdk/linked-artifacts.ts"]},{code:"linked_artifact_note_key_misread",exit_code:2,sources:["sdk/linked-artifacts.ts"]},{code:"linked_resource_positional_value",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"linked_resource_value_list",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"linked_test_command_immutable",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_command_not_executable",exit_code:2,sources:["sdk/test/entry.ts"]},{code:"linked_test_context_invalid",exit_code:2,sources:["sdk/test/entry.ts"]},{code:"linked_test_patch_fields_unsupported",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_remove_no_match",exit_code:3,sources:["sdk/test/execution.ts"]},{code:"linked_test_update_ambiguous",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_update_no_match",exit_code:3,sources:["sdk/test/update.ts"]},{code:"linked_test_value_not_quoted",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"list_source_incomplete",exit_code:1,stable:!0,sources:["sdk/query/list.ts"],emitting_commands:["list"]},{code:"local_package_archive_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"local_source_not_found_bare_name",exit_code:3,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"lock_conflict",exit_code:4,stable:!0,sources:["cli/error-guidance.ts","core/lock/lock.ts","core/telemetry/observability.ts"]},{code:"lock_lost",exit_code:4,sources:["core/lock/lock.ts"]},{code:"lock_path_unsafe",exit_code:4,sources:["core/lock/lock-confinement.ts"]},{code:"locks_stale_count",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"locks_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"malformed_plan_step_evidence",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"managed_state_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"managed_state_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"manifest_capabilities_absent",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"manifest_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"manifest_unknown_key",exit_code:1,sources:["core/extensions/manifest-schema.ts"],owned_states:[{state:"author_workspace_manifest_declares_an_unknown_top_level_key",probe_id:"author-manifest-unknown-key",entrypoints:["health"],expected_exit_class:"generic_failure"}]},{code:"manifest_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"mcp_annotation_file_unavailable",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"mcp_stdin_unavailable",exit_code:2,sources:["sdk/annotations.ts"]},{code:"mcp_task_not_found_or_not_authorized",exit_code:3,sources:["sdk/mcp/tasks.ts"]},{code:"merge_artifacts_ignored",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_bun_launcher_unavailable",exit_code:5,sources:["sdk/merge/install.ts"]},{code:"merge_conflict_markers_detected",exit_code:1,stable:!0,sources:["core/item/item-format.ts"],aliases:["history_merge_conflict_markers_detected"]},{code:"merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_driver_configuration_drift",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_driver_configuration_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]}];var T=[{code:"merge_fence_drift",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_fence_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_git_config_unwritable",exit_code:5,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_receipt_evidence_invalid",exit_code:4,sources:["core/diagnostics/remediation.ts","sdk/merge/reconcile.ts"]},{code:"merge_receipt_history_reference_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_receipt_not_portable",exit_code:4,sources:["sdk/merge/receipts.ts"]},{code:"merge_receipts_pending",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_reconcile_receipt_evidence_untrusted",exit_code:4,sources:["sdk/history-repair.ts"]},{code:"merge_root_not_found",exit_code:3,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_settlement_hook_conflict",exit_code:4,sources:["sdk/merge/settlement-hook.ts"]},{code:"merge_settlement_review_required",exit_code:4,sources:["sdk/merge/ignored-artifacts.ts","sdk/merge/reconcile.ts","sdk/merge/stage.ts"]},{code:"missing_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"missing_cli_flag",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_directory",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"missing_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_lifecycle_target",exit_code:2,stable:!0,sources:["sdk/extension.ts"]},{code:"missing_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"missing_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_parameter_alias",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_positive_execution_receipt",exit_code:1,sources:["sdk/test/execution.ts"]},{code:"missing_probe",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_required_argument",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/main.ts","cli/register-mutation.ts","cli/schema/registration.ts","core/telemetry/observability.ts","sdk/governance/assurance-action.ts","sdk/history-redact.ts","sdk/invocation-author.ts","sdk/lifecycle/claim.ts","sdk/linked-artifacts.ts"],emitting_commands:["*","claim"]},{code:"missing_required_option",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/context-intent-contracts.ts","sdk/extension/command-options.ts","sdk/lifecycle/create.ts","sdk/lifecycle/plan.ts"],emitting_commands:["*","create","plan"]},{code:"missing_suggested_retry",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_suggested_retry_args",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"module_import_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"multi_target_github_install_ambiguous",exit_code:2,stable:!0,sources:["cli/register-setup.ts"]},{code:"mutation_author_required",exit_code:2,stable:!0,sources:["sdk/mutation-guard.ts"]},{code:"mutation_document_unreadable",exit_code:2,sources:["cli/register-structured-mutation.ts"]},{code:"mutation_option_value_invalid",exit_code:2,sources:["sdk/lifecycle/mutation-option-validation.ts"],emitting_commands:["item mutate"]},{code:"mutation_secret_guard_blocked",exit_code:4,stable:!0,sources:["sdk/mutation-guard.ts"]},{code:"no_matching_tests",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_projects_matched_filters",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_test_files_found",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_tests_found",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_update_fields",exit_code:1,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"no_version_bounds_declared",exit_code:1,sources:["core/extensions/manifest-schema.ts"],owned_states:[{state:"author_workspace_manifest_omits_canonical_pm_version_bounds",probe_id:"author-manifest-version-bounds-missing",entrypoints:["health"],expected_exit_class:"generic_failure"}]},{code:"non_refusal_exit",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"npm_pack_json_shape_unsupported",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_archive_missing",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_archive_unsafe",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_not_found",exit_code:3,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"npm_source_shorthand_ambiguous",exit_code:2,sources:["sdk/extension/install-sources.ts"]},{code:"output_budget_exceeded",exit_code:2,sources:["sdk/testing.ts"]},{code:"ownership_conflict",exit_code:4,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/annotations.ts"]},{code:"ownership_dependency_bypass_restricted_options",exit_code:1,stable:!0,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"ownership_metadata_bypass_restricted_options",exit_code:1,stable:!0,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"package_spec_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"package_upgrade_modes_mutually_exclusive",exit_code:2,sources:["sdk/governance/upgrade.ts"]},{code:"positional_shape_budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"positional_signature_mismatch",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"profile_name_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_name_not_normalized",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_summary_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_title_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"project_runtime_history_epoch_incompatible",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_item_format_incompatible",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_stale_mutation",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_stale_read",exit_code:1,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_schema_field_requires_declared_flag",exit_code:2,sources:["core/extensions/item-fields.ts"]},{code:"projection_options_mutually_exclusive",exit_code:2,sources:["sdk/query/get.ts","sdk/query/list.ts","sdk/query/search-contracts.ts"],emitting_commands:["get","list","search"]},{code:"provenance_value_domain_invalid",exit_code:2,sources:["core/diagnostics/remediation.ts"]},{code:"read_output_cursor_command_mismatch",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_cursor_invalid",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_cursor_stale",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_mutation_conflict",exit_code:2,sources:["sdk/read-output-contracts.ts"]},{code:"read_output_surface_unsupported",exit_code:2,sources:["sdk/extension/static-inventory.ts","sdk/read-output-contracts.ts"]},{code:"recovery_kind_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"redundant_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"refusal_allowed_values_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_exit_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_mutated_state",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_probe_missing",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_recovery_failed",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"reindex_already_running",exit_code:4,stable:!0,sources:["sdk/governance/reindex.ts"]},{code:"removed_canonical_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"removed_compatibility_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"reopen_reason_required",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reopen_receipt_missing",exit_code:1,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"reopen_target_status_invalid",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reported_zero_passes",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reported_zero_tests",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reserved_item_field",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"retry_failed",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"schema_field_flag_invalid",exit_code:2,sources:["sdk/schema/field-option-collisions.ts"]},{code:"schema_field_option_collision",exit_code:2,sources:["sdk/schema/field-option-collisions.ts"]},{code:"schema_migration_input_required",exit_code:2,stable:!0,sources:["cli/migration-gates.ts"]},{code:"semantic_spelling_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"settings_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"settings_read_fs_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_schema",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_merge_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_section_document_malformed",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_document_missing",exit_code:3,sources:["core/store/settings-sections.ts"]},{code:"settings_section_invalid",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_name_invalid",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_reserved",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_revision_conflict",exit_code:4,sources:["core/store/settings-sections.ts"]},{code:"settings_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"settings_write_assigned_path_invalid",exit_code:2,sources:["core/store/settings.ts"]},{code:"settings_write_invalid_existing_json",exit_code:2,sources:["core/store/settings.ts"]},{code:"settings_write_invalid_existing_schema",exit_code:2,sources:["core/store/settings.ts"]},{code:"stale_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"stale_claim_takeover_refused",exit_code:4,sources:["sdk/lifecycle/claim.ts"],emitting_commands:["claim"]},{code:"stale_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"stale_in_progress_items",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"stale_lock_requires_override",exit_code:4,sources:["core/lock/lock.ts"]},{code:"stale_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"stale_revision",exit_code:4,sources:["core/store/item-store.ts"]},{code:"start_blocked_by_open_dependency",exit_code:4,sources:["sdk/lifecycle/start-blockers.ts"],emitting_commands:["claim","start-task","update"]},{code:"status_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"status_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"status_lifecycle_role_required",exit_code:2,sources:["sdk/schema.ts"]},{code:"stdin_json_invalid",exit_code:2,stable:!0,sources:["sdk/structured-mutations.ts"]},{code:"stdin_json_persisted_annotation_changed",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"stdin_json_unknown_key",exit_code:2,stable:!0,sources:["sdk/structured-mutations.ts"]},{code:"structured_entry_key_repeated",exit_code:2,sources:["core/item/parse.ts"]},{code:"structured_event_immutable",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"structured_event_input_conflict",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_json_empty",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_json_invalid",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_since_invalid",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"suggested_retry_args_mismatch",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"telemetry_endpoint_probe_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_endpoint_probe_http_status",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_otel_export_failing",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_high_retries",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_invalid_rows",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_pending",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_schema_version_behind",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_state_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"template_type_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"terminal_plan_mutation",exit_code:4,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"terminal_state_conflict",exit_code:4,stable:!0,sources:["core/telemetry/observability.ts","sdk/lifecycle/claim.ts"],emitting_commands:["*","claim"]},{code:"test_measure_requires_execution",exit_code:2,sources:["sdk/test/prerequisites.ts"]},{code:"test_measure_requires_run",exit_code:2,sources:["sdk/test/prerequisites.ts"]},{code:"text_unpaired_surrogate",exit_code:2,sources:["core/item/item-format.ts","core/shared/output-unicode.ts"]},{code:"tracked_runtime_cache_files",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_storage_tracked_runtime_cache_files"]},{code:"tracker_not_initialized",exit_code:3,stable:!0,sources:["cli/error-guidance.ts","core/store/tracker-preflight.ts","core/telemetry/observability.ts"],owned_states:[{state:"selected_tracker_root_exists_without_settings",probe_id:"tracker-root-settings-missing",entrypoints:["list"],expected_exit_class:"not_found"}]},{code:"tracker_root_missing",exit_code:3,stable:!0,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_does_not_exist",probe_id:"tracker-root-missing",entrypoints:["list"],expected_exit_class:"not_found"}]},{code:"tracker_root_not_directory",exit_code:2,stable:!0,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_is_a_regular_file",probe_id:"tracker-root-not-directory",entrypoints:["list"],expected_exit_class:"usage"}]},{code:"tracker_root_unreadable",exit_code:1,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_is_not_readable",probe_id:"tracker-root-unreadable",entrypoints:["list"],expected_exit_class:"generic_failure"}]},{code:"transaction_abandoned",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_committed",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_create_compensated",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_journal_invalid",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_partial_mutation",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_plan_mismatch",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_preview_external_schema",exit_code:2,sources:["sdk/item-transaction.ts"]},{code:"transaction_preview_non_regular_file",exit_code:2,sources:["core/fs/fs-utils.ts"]},{code:"transaction_preview_snapshot_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_recovery_plan_missing",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"type_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"type_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"undeclared_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"unexpected_refusal_probe",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"unknown_command",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/cli-contracts/runtime-contracts.ts"]},{code:"unknown_context_intent",exit_code:2,stable:!0,sources:["sdk/context-intent-contracts.ts"]},{code:"unknown_error",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"unknown_field",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_field_projection",exit_code:2,stable:!0,sources:["sdk/query/get.ts","sdk/query/list.ts","sdk/query/search-contracts.ts"],emitting_commands:["get","list","search"]},{code:"unknown_item_type",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_lifecycle_action",exit_code:2,stable:!0,sources:["sdk/agent/subcommand-recovery.ts"],canonical_code:"unknown_subcommand"},{code:"unknown_noun",exit_code:2,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"unknown_option",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/runtime/invocation-options.ts","core/telemetry/observability.ts","sdk/extension/command-options.ts"],owned_states:[{state:"declared_option_is_rejected_on_the_selected_command_path",probe_id:"cross-command-unknown-option",entrypoints:["deps"],expected_exit_class:"usage"}]},{code:"unknown_plan_template",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"unknown_provenance_dimension",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"unknown_status",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_subcommand",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","sdk/agent/subcommand-recovery.ts"],aliases:["unknown_lifecycle_action"],owned_states:[{state:"config_action_token_is_not_declared",probe_id:"config-unknown-action",entrypoints:["config"],expected_exit_class:"usage"},{state:"graph_command_token_is_not_declared",probe_id:"graph-unknown-subcommand",entrypoints:["graph"],expected_exit_class:"usage"},{state:"nested_command_token_is_not_declared_by_its_family",probe_id:"schema-unknown-subcommand",entrypoints:["schema"],expected_exit_class:"usage"},{state:"package_lifecycle_token_is_not_declared",probe_id:"package-unknown-action",entrypoints:["package"],expected_exit_class:"usage"}]},{code:"unsafe_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"unsupported_update_option",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"upsert_key_ambiguous",exit_code:4,sources:["sdk/structured-mutations.ts"]},{code:"upsert_key_conflict",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"upsert_key_duplicate",exit_code:2,sources:["sdk/item-transaction.ts","sdk/structured-mutations.ts"]},{code:"upsert_key_missing",exit_code:2,sources:["sdk/structured-mutations.ts"]},{code:"upsert_match_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"validate_command_references_stale_pm_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_missing_linked_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_orphaned_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_tracked_all_strict_forces_pm_internals",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_format_version_ahead_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_ahead_format_version"},{code:"validate_format_version_outdated_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_outdated_format_version"},{code:"validate_hierarchy_parent_cycle",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_hierarchy_parent_cycle_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_chain_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_chain_mismatch"},{code:"validate_history_drift_hash_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_hash_mismatch"},{code:"validate_history_drift_missing_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_missing_stream"},{code:"validate_history_drift_unreadable_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_unreadable_stream"},{code:"validate_history_drift_version_skews",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_version_skew"},{code:"validate_history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_unknown_author_events"},{code:"validate_lifecycle_active_closure_like_metadata",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_active_terminal_parent",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_stale_blockers",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_driver_configuration",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_fence_drift",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_custom_profile_missing_required_fields",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_duplicate_issue_codes",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_acceptance_criteria",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_close_reason",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_closed_at",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_confidence",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_estimate",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_release",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_reviewer",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_risk",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_sprint",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_resolution_missing_fields",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_schema_field_option_collision",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_duplicate_item_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_history_conflict_markers",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_history_conflict_marker"},{code:"validate_storage_resurrected_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_tracked_runtime_cache_files",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"tracked_runtime_cache_files"},{code:"validate_storage_unparseable_config",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unparseable_history",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unreadable_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_embedding_identity_changed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_stale_items_remaining",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"visible_surface_ceiling_exceeded",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"workflow_duplicate_type",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_policy_approval_history_invalid",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_audit_failed",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_input_unreadable",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_invalid",exit_code:2,sources:["core/policy/workflow-policy.ts"]},{code:"workflow_policy_refused",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_registry_invalid",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_status_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_transition_malformed",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workspace_history_chain_invalid",exit_code:4,sources:["core/history/workspace-history.ts"]},{code:"workspace_history_state_conflict",exit_code:4,stable:!0,sources:["core/history/workspace-history.ts"]},{code:"workspace_root_pm_path",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"workspace_snapshot_force_required",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_manifest_mismatch",exit_code:4,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_name_reserved_fingerprint",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_not_found",exit_code:3,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_permission_denied",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_resource_exhausted",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_storage_exhausted",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"wrong_item_type",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]}];var ze=E(A([...O,...T]));var G=Object.freeze({"--body":"Set the item body.","--body-file":"Read the item body from a file, or from stdin when set to -.","--description":"Set the item description.","--stdin":"Read the value from stdin.","--stdin-json":"Read a complete JSON document from stdin."}),B=new Set(["--add","--body","--comment","--dep","--dep-remove","--description","--doc","--event","--field","--file","--learning","--note","--remove","--reminder","--test","--type-option"]),V=new Set(["append","comments","create","docs","files","learnings","notes","test","update","update-many"]),Y=new Set(["close-many:--ids","comments:--file","create:--body-file","history-compact:--ids","learnings:--file","notes:--file","update:--body-file","update-many:--ids"]),X=new Set(["close-many:--ids","history-compact:--ids","update-many:--ids"]),W=["--allow-","--check-","--dry-run","--explain","--fail-","--fix-","--full","--has-","--include-","--json","--no-","--prune-","--quiet","--refresh-","--require-","--runtime-only","--schema-only","--skip-","--stream","--strict-","--summary","--today","--verbose"],H=new Set(["--activate","--active-only","--adopt","--adopt-all","--all","--all-actionable","--all-affected-ids","--all-day","--all-streams","--acknowledge-linked-tests","--append-stable","--auto-fix","--auto-pm-context","--availability-only","--background","--brief","--by-assignee","--by-priority","--by-tag","--catalog","--claim","--clear","--clear-comments","--clear-criteria","--clear-deps","--clear-docs","--clear-events","--clear-files","--clear-learnings","--clear-notes","--clear-reminders","--clear-tests","--clear-type-options","--cli-only","--closed","--compact","--completion","--count","--counts","--deactivate","--declarative","--defaults","--describe","--diff","--doctor","--empty-body","--explore","--field-utilization","--filter-empty-body","--flags-only","--follow","--force","--global","--highlight","--hybrid","--id-only","--if-available","--ignore-global","--include_unparented","--infer","--init","--install","--isolated","--lean","--list","--local","--manage","--markdown","--metadata-coverage","--next","--normalize-provenance","--only","--only-last","--output-row-contract","--override-linked-pm-context","--override-linked-workspace-context","--packages-only","--past","--phrase-exact","--profile","--progress","--project","--promote-to-item-dep","--provenance","--provenance-summary","--raw","--ready-only","--ready_only","--rebuild","--recent","--reload","--repair","--replace-deps","--replace-docs","--replace-files","--replace-tests","--required","--required-on-create","--run","--runtime-probe","--save-baseline","--scaffold","--semantic","--shared-host-safe","--storage","--takeover-stale","--title-exact","--token-accounting","--trace","--tree","--unbounded","--uninstall","--validate-paths","--verify","--watch","--with-packages"]),J=new Set(["--only-index"]),K=new Set(["activity:--stream","eval:--fail-under","validate:--fix-scope"]),Q=new Set(["activity:--stream","close:--validate-close","close-many:--validate-close","comments:--author","learnings:--author","notes:--author"]),Z=new Set(["--regression"]);function ee(t,e){return e==="--stdin"||e==="--stdin-json"?["stdin"]:Y.has(`${t}:${e}`)?["argv","file","stdin"]:e.endsWith("-file")?["argv","file"]:B.has(e)&&V.has(t)?["argv","stdin"]:["argv"]}function te(t,e){let s=K.has(`${t}:${e.flag}`)||e.value_name!==void 0||e.value_type==="string"||e.value_type==="number"||e.list===!0||e.repeatable===!0,o=e.value_type==="boolean"||e.flag==="--stdin"||e.flag==="--stdin-json"||e.flag.startsWith("--filter-")&&(e.flag.endsWith("-missing")||e.flag.startsWith("--filter-has-")||e.flag.startsWith("--filter-no-"))||W.some(i=>e.flag.startsWith(i));return s||J.has(e.flag)||!H.has(e.flag)&&!o}function se(t,e){return e.value_arity!==void 0?e.value_arity:te(t,e)?Z.has(e.flag)||Q.has(`${t}:${e.flag}`)?"optional":"required":"none"}function oe(t,e){let s=f(t),o=se(s,e),i=o!=="none",n=ee(s,e.flag),d=e.description??G[e.flag]??`${i?"Set":"Enable"} ${e.flag.slice(2).replaceAll("-"," ")}.`;return{...e,description:d,takes_value:i,value_required:o==="required",...i?{value_name:e.value_name??"value"}:{},value_type:i?e.value_type??"string":"boolean",required:e.required===!0,repeatable:e.repeatable===!0||e.list===!0,input_sources:n,...n.includes("stdin")&&e.flag!=="--stdin"&&e.flag!=="--stdin-json"?{stdin_token:"-"}:{},...X.has(`${s}:${e.flag}`)?{file_token_prefix:"@"}:{}}}function Be(t,e){return e.map(s=>oe(t,s))}function Ve(t,e,s){let o=t.trim().toLowerCase(),i=[],n=new Map,d=0;for(let c of s)if(c.command.trim().toLowerCase()===o){if(d+=1,n.has(c.flag)){i.push({code:"duplicate_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} was observed more than once.`});continue}n.set(c.flag,c)}let u=new Set(e.map(({flag:c})=>c));for(let c of e){let r=n.get(c.flag);if(!r){i.push({code:"missing_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} has no executable option observation.`});continue}for(let[_,P]of[["takes_value","takes_value_mismatch"],["value_required","value_required_mismatch"],["repeatable","repeatable_mismatch"]])c[_]!==r[_]&&i.push({code:P,command:o,flag:c.flag,detail:`${o} ${c.flag} declares ${_}=${String(c[_])} but the executable option reports ${String(r[_])}.`})}for(let c of n.values())u.has(c.flag)||i.push({code:"undeclared_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} is executable but absent from invocation contracts.`});return i.sort((c,r)=>c.flag.localeCompare(r.flag)||c.code.localeCompare(r.code)),{ok:i.length===0,declared_count:e.length,observed_count:d,findings:i}}var ie=["mutation_receipt","entity","collection","diagnostic","stream"],ce=new Set(["append","claim","close","close-task","copy","create","delete","focus","pause-task","release","restore","start-task","update"]),re=new Set(["close-many","update-many"]),ne=new Set(["activity","comments","contracts","events","history","learnings","list","notes","search"]),ae=new Set(["aggregate","deps","graph","health","history-redact","history-repair","history-compact","stats","validate"]);function p(t){if(t.command.trim().length===0)throw new TypeError("command must be a non-empty command path");if(!ie.includes(t.kind))throw new TypeError(`Unsupported output envelope kind: ${t.kind}`);return t}function S(t){let e=t.trim().replace(/\s+/gu," "),[s=e]=e.split(" ");return re.has(s)?p({command:e,kind:"collection",wrapper_key:"rows",cardinality:"many",format_flag:"--json"}):ce.has(s)?p({command:e,kind:"mutation_receipt",wrapper_key:null,cardinality:"one",format_flag:"--json"}):ne.has(s)?p({command:e,kind:"collection",wrapper_key:s==="contracts"?null:"items",cardinality:"many",format_flag:"--json"}):ae.has(s)?p({command:e,kind:"diagnostic",wrapper_key:null,cardinality:"none",format_flag:"--json"}):p({command:e,kind:s==="get"?"entity":"diagnostic",wrapper_key:s==="get"?"item":null,cardinality:s==="get"?"one":"none",format_flag:"--json"})}var de=l.map(t=>S(t)),_e=new Map(de.map(t=>[t.command,t]));function He(t){let e=t.trim().replace(/\s+/gu," ");if(e.length===0)throw new TypeError("command must be a non-empty command path");let[s=e]=f(e).split(" "),o=_e.get(s);return o?{...o,command:e}:S(e)}function le(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ue(t){return le(t)&&typeof t.id=="string"&&t.id.length>0&&typeof t.status=="string"&&t.status.length>0&&Number.isSafeInteger(t.changed_field_count)&&Number(t.changed_field_count)>=0&&(t.close_reason===void 0||typeof t.close_reason=="string")&&(t.deleted===void 0||typeof t.deleted=="boolean")&&(t.previous_status===void 0||typeof t.previous_status=="string")&&(t.warnings===void 0||Array.isArray(t.warnings))}function Je(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(s){throw new TypeError(`Mutation receipt must be valid JSON: ${String(s)}`,{cause:s})}if(!ue(e))throw new TypeError("Mutation receipt must be a flat object with top-level id, status, and changed_field_count fields");return{id:e.id,status:e.status,changedFieldCount:e.changed_field_count,...typeof e.close_reason=="string"?{closeReason:e.close_reason}:{},...typeof e.deleted=="boolean"?{deleted:e.deleted}:{},...typeof e.previous_status=="string"?{previousStatus:e.previous_status}:{},...Array.isArray(e.warnings)?{warnings:e.warnings}:{}}}var me=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate","workspace"]),pe=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]),fe=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-attest","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])}),xe=new Set(["extension","install","package","packages","upgrade"]);function ge(t){let e=m(t.trim().toLowerCase());if(e==="ops")return"quality";for(let[s,o]of Object.entries(fe))if(o.has(e))return s;return xe.has(e)?"extensions":"internal"}var k=Object.freeze([...l.flatMap(t=>t==="item"?["item","item-reopen"]:[t,...y.filter(e=>e.alias===t).map(e=>e.canonical)]).map(t=>({command:t,tier:me.has(m(t))?"core":pe.has(m(t))?"standard":"full",family:ge(t)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"},{command:"item test worker",tier:"internal",family:"internal"}]),ke=k,et=Object.freeze({max_lines:50,max_utf8_bytes:6e3}),tt=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);var M={core:0,standard:1,full:2,internal:3},N=new Map(ke.map(({command:t,tier:e})=>[t,e]));function st(t,e="standard"){return N.get(t.trim().toLowerCase())??N.get(m(t.trim().toLowerCase()))??e}function ot(t){return ye(t,k)}function ye(t,e){let s=M[t];return e.filter(o=>o.tier!=="internal"&&M[o.tier]<=s).map(o=>o.command)}function he(t,e){return e.filter(s=>s.family===t).map(s=>s.command)}var be=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],ve=new Set([...h.filter(t=>t.hidden).map(t=>t.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function it(t=k){return be.map(e=>({family:e,commands:he(e,t).filter(s=>t.find(o=>o.command===s)?.tier!=="internal"&&!ve.has(s))})).filter(({commands:e})=>e.length>0)}var ct=Object.freeze({pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});var rt=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]),nt=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:!0},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:!1}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0},{name:"evidence",description:"Exact verification and outcome evidence.",required:!0}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);export{R as a,w as b,D as c,Ee as d,Ae as e,Oe as f,Te as g,Se as h,g as i,E as j,Ne as k,C as l,ze as m,oe as n,Be as o,Ve as p,k as q,st as r,ot as s,it as t,ie as u,p as v,de as w,He as x,ue as y,Je as z};
|
|
2
|
+
//# sourceMappingURL=chunk-WJAUHPXD.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as h,E as u,z as p}from"./chunk-
|
|
1
|
+
import{A as h,E as u,z as p}from"./chunk-IRYNVGKH.js";import{readFile as $,realpath as _,stat as G,writeFile as k}from"node:fs/promises";import l from"node:path";var f="# pm-cli:runtime-cache:start",g="# pm-cli:runtime-cache:end",E=".agents/pm";async function d(n){let e=l.resolve(n),t=[];for(;;)try{let i=await _(e);if(!(await G(i)).isDirectory())throw Object.assign(new Error("Initialization path ancestry must be a directory."),{code:"ENOTDIR"});return l.join(i,...t)}catch(i){if(!u(i)||l.dirname(e)===e)throw i;t.unshift(l.basename(e)),e=l.dirname(e)}}var R=["runtime/","search/","locks/","transactions/","checkpoints/"],T=["search/eval-queries.json"];async function w(n){try{return await n()}catch(e){throw e instanceof Error&&"code"in e&&typeof e.code=="string"&&["EACCES","EPERM","EROFS"].includes(e.code)?new h("The workspace .gitignore is not writable.",p.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:e.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):e}}function I(n){let e=n.split(l.sep).join("/").replace(/^\.\/+/,""),t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}function x(n){let e=n.replaceAll("\\","/");return l.isAbsolute(n)||e===".."||e.startsWith("../")}function b(n=E){let e=I(n);if(/[\r\n]/u.test(e))throw new h("A tracker path containing a line break cannot be represented safely in .gitignore.",p.USAGE,{code:"invalid_argument_value",required:"a tracker path without line breaks",nextSteps:["Choose a tracker path without carriage returns or newlines and rerun pm init."]});let t=e.replace(/[\\*?[\]#! \t]/gu,"\\$&");return[f,...R.map(i=>i==="search/"?`${t}/${i}*`:`${t}/${i}`),...T.map(i=>`!${t}/${i}`),g].join(`
|
|
2
2
|
`)}function y(n,e,t){let i=e.replace(/[\\*?[\]#! \t]/gu,"\\$&"),o=[...new Set([e,i])].flatMap(s=>R.flatMap(c=>[`${s}/${c}`,`!${s}/${c}`])),a=[],r=!1;for(let s of n)o.some(c=>s.startsWith(c))?(r||a.push(...t),r=!0):a.push(s);return r||a.push(...t),a}function O(n){let e=[],t=-1,i=0,o=0;for(let a of n.split(`
|
|
3
3
|
`)){let r=a.endsWith("\r")?a.slice(0,-1):a;r===f?(t=o,i=o+a.length+1):r===g&&t>=0&&(e.push({index:t,end:o+r.length,lines:n.slice(i,o).split(/\r?\n/u).filter(s=>s.length>0)}),t=-1),o+=a.length+1}return e}function P(n,e){let t=n.includes(`\r
|
|
4
4
|
`)?`\r
|
|
@@ -6,4 +6,4 @@ import{A as h,E as u,z as p}from"./chunk-NGFDPEP7.js";import{readFile as $,realp
|
|
|
6
6
|
`,i=b(e).split(`
|
|
7
7
|
`).slice(1,-1),o=O(n),a=o.flatMap(c=>c.lines),r=[f,...y(a,e,i),g].join(t);if(o.length===0){let c=n.length===0?"":n.endsWith(`
|
|
8
8
|
`)?t:`${t}${t}`;return`${n}${c}${r}${t}`}let s=n;for(let[c,m]of[...o.entries()].reverse())s=`${s.slice(0,m.index)}${c===0?r:""}${s.slice(m.end)}`;return s}async function N(n,e={}){let t=l.join(n,".gitignore"),i=E;if(e.pmRoot!==void 0){let r=I(l.relative(await d(n),await d(e.pmRoot)));if(x(r))return{path:t,changed:!1};i=r}let o="";try{o=await w(()=>$(t,"utf8"))}catch(r){if(!(r instanceof Error&&"code"in r&&u(r)))throw r}let a=P(o,i);return a===o?{path:t,changed:!1}:(await w(()=>k(t,a,"utf8")),{path:t,changed:!0})}export{R as a,x as b,N as c};
|
|
9
|
-
//# sourceMappingURL=chunk-
|
|
9
|
+
//# sourceMappingURL=chunk-XR6MLUVW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk-KPASZGBL.js";import"./chunk-CWQLW4ZO.js";import"./chunk-26P6C6OO.js";import"./chunk-JFICNN4T.js";import"./chunk-IRYNVGKH.js";export{d as collectDefinitionLosses,c as readAdmittedFieldsFileDefinitions,e as readConfiguredSchema,b as readFieldsFileDefinitions,a as readStoredJson,g as scanFieldDefinitionLosses,f as trackerRelativePath};
|
|
2
|
+
//# sourceMappingURL=field-definition-losses-GGA6FUHD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=field-option-collisions-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk-BZ3PUUPG.js";import"./chunk-KLOHZNJ4.js";import"./chunk-BWOVFE5B.js";import"./chunk-TX24L7RQ.js";import"./chunk-JFICNN4T.js";import"./chunk-IRYNVGKH.js";export{i as assertFieldDefinitionOptionsAvailable,h as assertFieldOptionsAvailable,e as describeFieldFlagSpellingDefectLine,f as describeFieldOptionCollision,d as resolveAddFieldFlagSpellingDefects,b as resolveAddFieldOptionCollisions,c as resolveFieldFlagSpellingDefects,a as resolveFieldOptionCollisions,g as scanFieldOptionCollisions};
|
|
2
|
+
//# sourceMappingURL=field-option-collisions-HABQYZMQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as E}from"./chunk-
|
|
1
|
+
import{b as E}from"./chunk-XR6MLUVW.js";import{c as I}from"./chunk-AIDL2ZNT.js";import"./chunk-IRYNVGKH.js";import{execFile as M}from"node:child_process";import{realpath as x}from"node:fs/promises";import w from"node:path";import{promisify as N}from"node:util";var b=N(M),_="[a-f0-9]{40}(?:[a-f0-9]{24})?",R=new RegExp(`^100(?:644|755) (${_}) 0$`,"u"),B=new RegExp(`^(${_}) blob (\\d+)$`,"u");async function v(o,a,r){let t=b("git",o,{...r,encoding:"buffer"}),e=t.child.stdin;return e!==null&&(e.on("error",()=>{t.child.kill()}),e.end(`${a.join(`
|
|
2
2
|
`)}
|
|
3
3
|
`)),(await t).stdout}function S(o,a){let r=new Map;for(let t of o.split("\0")){let e=t.indexOf(" "),i=t.slice(e+1),n=R.exec(t.slice(0,e));n!==null&&a.has(i)&&r.set(i,n[1])}return r}function y(o,a,r){let t=[],e=[],i=0;for(let n of o.trimEnd().split(/\r?\n/u)){let s=B.exec(n);if(s===null||!a.has(s[1]))continue;let c=Number(s[2]);!Number.isSafeInteger(c)||c>r||(e.length>0&&i+c+128>r&&(t.push(e),e=[],i=0),e.push({id:s[1],size:c}),i+=c+128)}return e.length>0&&t.push(e),t}function z(o,a,r){let t=0;for(let{id:e,size:i}of a){let n=o.indexOf(10,t)+1;if(n===0||o.subarray(t,n-1).toString("ascii")!==`${e} blob ${i}`||o[n+i]!==10)throw new Error("Invalid indexed receipt batch framing");r.set(e,o.subarray(n,n+i).toString("utf8")),t=n+i+1}if(t!==o.length)throw new Error("Unexpected indexed receipt batch data")}async function C(o,a,r,t,e,i={}){let n=I();n.GIT_NO_REPLACE_OBJECTS="1",e===void 0&&process.env.GIT_INDEX_FILE!==void 0&&(n.GIT_INDEX_FILE=w.resolve(process.env.GIT_INDEX_FILE));let s={cwd:o,env:n,windowsHide:!0,timeout:1e4,maxBuffer:t+256};try{let c=(await b("git",["rev-parse","--show-toplevel"],{...s,encoding:"utf8"})).stdout.trim(),[g,$]=await Promise.all([x(c),x(e??a)]),d=w.relative(g,e===void 0?$:w.resolve(e)).replaceAll("\\","/");if(E(d))return new Map;s.cwd=g;let m=new Map(r.map(f=>[`${d}/${f}`,f])),O=(await b("git",["ls-files","--stage","-z","--",`:(literal)${d}/`],{...s,encoding:"utf8"})).stdout,p=S(O,new Set(m.keys()));if(p.size===0)return new Map;let u=new Set(p.values()),T=(await v(["cat-file","--batch-check"],[...u],s)).toString("utf8"),l=new Map;for(let f of y(T,u,t))z(await v(["cat-file","--batch"],f.map(h=>h.id),s),f,l);if(i.failOnReadError&&l.size!==u.size)throw new Error("Unable to read every indexed receipt blob");return new Map([...p].filter(([,f])=>l.has(f)).map(([f,h])=>[m.get(f),l.get(h)]))}catch(c){if(i.failOnReadError)throw c;return new Map}}export{C as readIndexedReceiptBlobs};
|
|
4
|
-
//# sourceMappingURL=indexed-receipt-blobs-
|
|
4
|
+
//# sourceMappingURL=indexed-receipt-blobs-EUYZJR5R.js.map
|
package/dist/cli-bundle/focused-chunks/{item-revision-PV5O6F5Y.js → item-revision-YH5R7YPW.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=item-revision-
|
|
1
|
+
import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y}from"./chunk-5NSWNLFE.js";import"./chunk-NO5MUY4I.js";import"./chunk-NZA2LP4Y.js";import"./chunk-NNLENKU7.js";import"./chunk-BKPUUW5O.js";import"./chunk-TSZVCALS.js";import"./chunk-2CQFGJQ6.js";import"./chunk-CWQLW4ZO.js";import"./chunk-X6CXWWNB.js";import{kd as a,ld as b,md as c,nd as d}from"./chunk-BPBKHY6H.js";import"./chunk-TX24L7RQ.js";import"./chunk-26P6C6OO.js";import"./chunk-JFICNN4T.js";import"./chunk-IRYNVGKH.js";export{f as ITEM_REVISION_CONFLICT_CHANGE_LIMIT,e as ITEM_REVISION_CONFLICT_CODE,w as assertExpectHashAdmissible,t as bindExpectedItemRevisions,c as bindItemRevisionScope,a as createItemRevisionScope,k as describeItemRevisionChanges,y as dispatchWithExpectedItemRevisions,q as enrichItemRevisionConflict,o as expectHashInvocationRewrittenError,x as expectHashRequiresMutationError,m as isItemRevisionConflict,u as isTrackerRevisionGuarded,l as itemRevisionConflictRowFields,d as itemRevisionScopeReceipt,v as itemRevisionUncheckedWarning,g as normalizeExpectedItemHash,h as parseExpectHashSpecs,i as readItemRevision,j as resolveExpectedItemRevisions,r as runWithBoundItemRevisionScope,b as runWithItemRevisionScope,p as scopeItemRevisionConflict,n as throwFirstItemRevisionConflict,s as withExpectedItemRevisions};
|
|
2
|
+
//# sourceMappingURL=item-revision-YH5R7YPW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{B as Le,C as Je,E as Z,H as We,J as Be,K as Ve,M as Ye,N as He,a as Pe,p as H}from"./chunk-QTV6UE2Q.js";import"./chunk-ACTBMSCH.js";import"./chunk-WJAUHPXD.js";import{A as V,B as Ge,C as Y,D as qe,y as ze,z as j}from"./chunk-BPOU2S44.js";import"./chunk-LSVRZ4KQ.js";import"./chunk-KPASZGBL.js";import"./chunk-IIP6LZ5E.js";import"./chunk-5NSWNLFE.js";import"./chunk-EUDAUT6T.js";import"./chunk-XR6MLUVW.js";import"./chunk-AIDL2ZNT.js";import"./chunk-PPCBCPIZ.js";import"./chunk-BZ3PUUPG.js";import"./chunk-K53OIT5J.js";import"./chunk-KWKPX36T.js";import{T as Ne,W as je}from"./chunk-S4AC7OMI.js";import"./chunk-LKTRICZR.js";import"./chunk-GTUPHXKR.js";import{Ha as Ke}from"./chunk-S5VG7RFY.js";import"./chunk-MYWUMVCZ.js";import"./chunk-NO5MUY4I.js";import{H as W}from"./chunk-NZA2LP4Y.js";import{sa as _e,ya as Se}from"./chunk-KLOHZNJ4.js";import"./chunk-42SU4LK3.js";import"./chunk-NNLENKU7.js";import"./chunk-BKPUUW5O.js";import{H as xe,N as De,h as B}from"./chunk-TSZVCALS.js";import{k as Fe,r as N}from"./chunk-2CQFGJQ6.js";import{b as Ue}from"./chunk-CWQLW4ZO.js";import"./chunk-BWOVFE5B.js";import"./chunk-X6CXWWNB.js";import{$c as C,Ab as Ae,Bb as $e,Cb as J,Ob as Te,Rd as Ie,Sd as k,Xd as Me,Yd as Ce,ed as Re,h as ye,jd as T,oc as ke,sc as M,tb as ve}from"./chunk-BPBKHY6H.js";import{c as E}from"./chunk-TX24L7RQ.js";import{g as K,o as ge}from"./chunk-26P6C6OO.js";import{P as Ee,V as L,Z as Oe,aa as be}from"./chunk-JFICNN4T.js";import{A as p,E as q,H as we,I as $,l as le,q as A,s as me,x as he,z as l}from"./chunk-IRYNVGKH.js";import oe from"node:crypto";import{constants as te,readFileSync as It}from"node:fs";import{cp as Mt,lstat as it,mkdir as Ct,mkdtemp as ot,open as Nt,readdir as jt,realpath as st,rm as at,stat as se,writeFile as ct}from"node:fs/promises";import{tmpdir as dt}from"node:os";import u from"node:path";var Et=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...le,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]);function X(e,t,n){let r=e?.estimatedMinutes;if(!(r===void 0||typeof r=="string"))throw new p(`Mutation ${n+1} ${t} option "estimatedMinutes" must be a string.`,l.USAGE,{code:"mutation_option_value_invalid",required:'Pass estimatedMinutes as a string, for example "45", in raw mutation options.',why:"Raw options use the create/update command option types; item documents accept numeric estimated_minutes instead.",nextSteps:["Quote the estimatedMinutes value or use an item document with numeric estimated_minutes, then retry the transaction."]})}var Ot=["op","id","reason","options","unique","match"],bt=[...Ot,"ref"],xn=[...bt,"item"];var Xe="[a-z][a-z0-9._-]{0,63}",Dn=new RegExp(`^${Xe}$`,"u"),Pn=new RegExp(`(^|,)id=@(${Xe})(?=,|$)`,"gu"),Ze=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,n)=>n.toUpperCase());var vt=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count","pm_format_version","claim_principal","test_runs","deferred_fields"]),zn=new Set([...vt,"completed_at","id"]),Gn={create:Ne.map(e=>e.target),update:je.map(e=>e.target),close:_e.map(e=>Ze(e.flag)).filter(e=>e!=="reason"),release:Se.map(e=>Ze(e.flag))};function At(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function $t(e,t){return e<t?-1:+(e!==t)}function Q(e){return Array.isArray(e)?e.map(Q):At(e)?Object.fromEntries(Object.entries(e).sort(([t],[n])=>$t(t,n)).map(([t,n])=>[t,Q(n)])):e}function O(e){return typeof e=="string"?e.trim():JSON.stringify(Q(e))}var Tt=["id","updated_at","pm_format_version","type"],kt="import";function Qe(e,t){if(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_]*$/u.test(e)||e in Object.prototype)throw new TypeError(`${t} names an invalid field ${JSON.stringify(e)}; use a front-matter field name of letters, digits and underscores`);if(Tt.includes(e))throw new TypeError(`${t} cannot change "${e}"; the item writer derives it, or an update row owns it`)}function U(e){return Array.isArray(e)?`array of ${e.length}`:typeof e}var Rt=["__proto__","constructor","prototype"];function et(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype}function R(e){return e===null||typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?Array.from(e).every(R):et(e)?Object.entries(e).every(([t,n])=>!Rt.includes(t)&&R(n)):!1}function ee(e,t){let{set:n,unset:r}=e;if(n!==void 0&&!et(n))throw new TypeError(`${t} set must be a plain object of front-matter fields`);if(r!==void 0&&!Array.isArray(r))throw new TypeError(`${t} unset must be an array of front-matter field names`);let i=Object.keys(n??{}),s=r??[];if(i.length+s.length===0)throw new TypeError(`${t} requires at least one field in set or unset`);for(let o of i)if(Qe(o,t),n[o]===null||!R(n[o]))throw new TypeError(`${t} set "${o}" must be a non-null JSON value (no undefined, non-finite number, sparse array, class instance, or __proto__/constructor/prototype key); remove a field with unset`);for(let o of s){if(Qe(o,t),o==="body"||o==="front_matter")throw new TypeError(`${t} cannot unset "${o}"; the item format reserves that name`);if(i.includes(o))throw new TypeError(`${t} both sets and unsets "${o}"`)}if(new Set(s).size!==s.length)throw new TypeError(`${t} unset repeats a field`)}async function tt(e){ee(e,`Finalization of ${e.id}`);let t=await N(e.pmRoot),n={schema:t.schema,extensionFieldNames:ye(k())},r=await De({pmRoot:e.pmRoot,settings:t,id:e.id,op:kt,author:e.author,message:e.message,force:e.force===!0,extensionFieldNames:n.extensionFieldNames,mutate:i=>{let s=structuredClone(i.metadata),o=i.metadata;for(let[c,f]of Object.entries(e.set??{}))o[c]=structuredClone(f);for(let c of e.unset??[])delete o[c];let a;try{ve(i.metadata);let c=J(i,n),f=J(Ae($e(c,n),n),n);if(E(f)!==E(c))throw new TypeError("the stored item reads back as a different document; a set field collides with a name the item format reserves");a=c.metadata;let h=Object.entries(e.set??{}).find(([m,w])=>U(a[m])!==U(w));if(h!==void 0)throw new TypeError(`set "${h[0]}" is not stored as declared (${U(h[1])} normalizes to ${a[h[0]]===void 0?"an absent field":U(a[h[0]])})`)}catch(c){throw new p(`Finalization of ${e.id} would not store a readable item with the declared fields: ${c.message}`,l.USAGE,{code:"finalization_invalid_document",item_id:e.id,required:"Declare set and unset fields that leave a valid item under the workspace schema, with each set value in the shape its field stores.",why:"A finalization writes front-matter fields exactly, so the patched document is read back through the item reader, and each declared value is checked against what would be stored, before anything is written.",nextSteps:[`Run pm get ${e.id} --json to compare the current fields with the finalization, then correct the patch and retry the transaction.`]})}return{changedFields:[...new Set([...Object.keys(s),...Object.keys(a)])].filter(c=>Object.hasOwn(s,c)!==Object.hasOwn(a,c)||E(s[c])!==E(a[c])).sort((c,f)=>c.localeCompare(f))}}});return{item:r.item,changedFields:r.changedFields}}async function Ut(e,t){if(!Fe(e))return{schema:L(t.schema),typeDefinitionsFromFile:[]};let n=await Ht(e,t.schema);return{schema:n.schema,typeDefinitionsFromFile:n.type_definitions_from_file??[]}}async function Ft(e,t,n,r){let i=K({...t,item_types:{...t.item_types,definitions:[...t.item_types?.definitions??[],...n.typeDefinitionsFromFile]}},k());return(await xe(e,t.item_format,i.type_to_folder,void 0,n.schema)).flatMap(o=>{let a=o[r];return a==null?[]:[{id:o.id,value:a}]})}function ae(e){let t=new Map,n=async r=>{let i=await N(e),s=await Ut(e,i),o=new Map;for(let a of await Ft(e,i,s,r)){let d=O(a.value);o.set(d,[...o.get(d)??[],a.id])}return o};return{lookup(r){let i=t.get(r)??n(r);return t.set(r,i),i},async recordCreate(r){for(let[i,s]of t){let o=r[i];if(o==null)continue;let a=await s,d=O(o);a.set(d,[...a.get(d)??[],String(r.id)])}},invalidate(){t.clear()}}}async function xt(e,t){let n=O(t.value),r=(await e.lookup(t.key)).get(n)??[];if(r.length!==0)throw new p(`Upsert key "${t.key}" value ${JSON.stringify(n)} now matches existing item ${r.join(", ")}; the plan was resolved before it existed.`,l.CONFLICT,{code:"upsert_key_conflict",required:"Re-plan the document so the row updates the existing item instead of creating a duplicate.",why:"Keyed upsert is resolved before the writer lock, so every remaining create is re-checked under the lock; concurrent imports therefore cannot create two items for one key value.",nextSteps:["Re-run pm item mutate with the same document and --upsert-key; the re-plan turns the row into an update of the existing item.","Inspect the existing item first when its content should win over the document row."]})}function ut(e,t,n){let r=e.metadata[n.key],i=O(n.value);if(O(r)!==i)throw new p(`Item ${t} no longer carries upsert key "${n.key}" value ${JSON.stringify(i)}; the plan selected it before the key changed.`,l.CONFLICT,{code:"upsert_match_changed",required:"Re-plan the document so the row is resolved against the current key values.",why:"Keyed upsert selects its target before the writer lock, so the update re-reads the key under the lock instead of updating a mismatched item blindly.",nextSteps:["Re-run pm item mutate with the same document and --upsert-key; the re-plan creates or re-targets the row from the current key values."]})}function nt(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.key=="string"&&t.key.trim().length>0&&t.value!==void 0&&t.value!==null}function P(e,t){let n={...e,...t};return e===void 0?n:W(e,n)}async function _(e,t){try{let r=(await H(t,{},{pmRoot:e})).item;return{id:r.id,closedAt:r.closed_at,updatedAt:r.updated_at,assignee:r.assignee,claimPrincipal:r.claim_principal}}catch(n){if(n instanceof p&&n.exitCode===l.NOT_FOUND)return;throw n}}function ce(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),r=oe.createHash("sha256").update(E(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${n}-${r}`}function Dt(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${n}`}function y(e,t,n){return`bulk-item-transaction ${e} ${t} ${n}`}function de(e,t){return e===t||(e?.startsWith(`${t} | `)??!1)}async function v(e,t,n,r){let i=await M(u.join(e,"history",`${t}.jsonl`),t),s=y(n,r,"apply"),o=y(n,r,"compensate");for(let a=i.length-1;a>=0;a-=1){let d=i[a].message;if(de(d,s))return!0;if(d===o)return!1}return!1}async function z(e,t){let n=await _(e,t.id);if(n?.updatedAt===void 0)throw new p(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,l.NOT_FOUND);let r=await M(u.join(e,"history",`${n.id}.jsonl`),n.id);if(r.length===0)throw new p(`Bulk ${t.op} target ${t.id} has no restorable history`,l.NOT_FOUND);return{target_updated_at:n.updatedAt,target_version:String(B(r)+r.length),target_history_hash:C(r),target_history_length:r.length}}function b(e,t,n){return new p(`Transaction ${e.transactionId} cannot safely compensate incomplete step ${n}; review item ${t} history before recovery.`,l.CONFLICT,{code:"transaction_partial_mutation",item_id:t,required:"Reconcile the item's partial or intervening changes before resuming this transaction.",why:"The retained history does not prove exclusive ownership of the changes to undo. The journal remains compensating instead of claiming a rollback or overwriting another writer.",nextSteps:[`Run pm history ${t} and inspect this transaction's retained compensation data before explicitly restoring or reconciling the item.`]})}function ft(e,t){let n=`bulk-item-transaction ${t} `;return[e.message,e.context?.item_transaction_step].some(r=>typeof r=="string"&&r.startsWith(n))}function Pt(e,t,n){let{expectedHistory:r,length:i,version:s}=t;if(C(e)===r)return!1;if(typeof i!="number"||!Number.isSafeInteger(i)||i<1||C(e.slice(0,i))!==r||s!==String(B(e)+i))throw b(n,n.itemId,n.stepId);let o=y(n.transactionId,n.stepId,"apply"),a=e.slice(i),d=m=>de(m.message,o)||m.context?.item_transaction_step===o,c=y(n.transactionId,n.stepId,"compensate");if(a.filter(m=>d(m)||m.message===c).at(-1)?.message===c)return!1;let f=a.filter(d);if(f.length===0)return!1;let h=e.at(-1).after_hash===f.at(-1).after_hash&&a.every(m=>ft(m,n.transactionId));if(f.length!==a.length&&!h)throw b(n,n.itemId,n.stepId);return!0}async function pt(e,t){let n=u.join(e,"history",`${t}.jsonl`),r=await ke(n,t);return{history:r.entries,assertOwnedUnderLock:(i,s)=>{let o;try{o=It(n).equals(r.raw_bytes)&&Re(i)===r.entries.at(-1).after_hash}catch(a){throw Object.assign(s(),{cause:a})}if(!o)throw s()}}}async function I(e,t,n,r){let i=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:void 0;if(i===void 0||typeof i.target_updated_at!="string")return;let s=i.target_updated_at,o=await _(e.pmRoot,t);if(o===void 0)return;let{history:a,assertOwnedUnderLock:d}=await pt(e.pmRoot,o.id),c=i.target_history_hash,f=typeof c=="string";if(typeof c=="string"){if(!Pt(a,{expectedHistory:c,length:i.target_history_length,version:i.target_version},{...e,itemId:o.id,stepId:n}))return}else{if(o.updatedAt===s)return;if(!await v(e.pmRoot,o.id,e.transactionId,n))throw b(e,o.id,n)}let h=()=>Ve(t,typeof i.target_version=="string"?i.target_version:s,{force:!0,author:e.author,message:y(e.transactionId,n,"compensate")},{pmRoot:e.pmRoot});await T({pmRoot:e.pmRoot,id:o.id,validate:m=>{d(m,()=>b(e,o.id,n))},compensation:mt(e,t,n,"restore",f)},h)}var lt=new WeakMap;function mt(e,t,n,r,i){let s=i?ze(e.pmRoot,e.transactionId):void 0,o=s===void 0?void 0:lt.get(s);if(!(o?.stepId!==n||o.itemId!==t||o.operation!==r))return{transaction_id:e.transactionId,step_id:n,operations:[r],overrides:[]}}function ht(e,t,n){return{id:n,async inspect(){let r=await _(e.pmRoot,t.id);if(r===void 0)return{state:"pending"};if(r.closedAt!==void 0){let i=await M(u.join(e.pmRoot,"history",`${r.id}.jsonl`),r.id),s=`Compensated: interrupted bulk transaction ${e.transactionId}`;if(i.filter(d=>d.op==="close").at(-1)?.patch.some(d=>d.op==="add"||d.op==="replace"?d.path==="/metadata/close_reason"&&d.value===s:!1)??!1)throw new p(`Created item ${r.id} remains closed by transaction compensation; explicitly reopen or reconcile it before retrying.`,l.CONFLICT,{code:"transaction_create_compensated",item_id:r.id,required:"Review the compensated item and explicitly reopen it before retrying the same document.",why:"This item's latest closure belongs to transaction compensation. Automatically reopening it could overwrite later lifecycle decisions.",nextSteps:[`Run pm item reopen ${r.id} "Retry compensated creation" after reviewing its history, then retry the transaction.`]})}return{state:"applied",result:{id:r.id,op:"create"}}},async apply(){t.unique!==void 0&&await xt(e.uniqueIndex,t.unique);let r=await Le(P(t.options,{author:e.author,id:t.id,message:y(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot}),i=r.item;return e.onCreateWarnings?.(String(i.id),r.warnings),await e.uniqueIndex.recordCreate(i),{id:String(i.id),op:"create"}},async compensate(){await zt(e,t.id,n)}}}async function zt(e,t,n){let r=await _(e.pmRoot,t);if(r===void 0||e.createCompensation==="close"&&r.closedAt!==void 0)return;let{history:i,assertOwnedUnderLock:s}=await pt(e.pmRoot,r.id),o=y(e.transactionId,n,"apply"),a=y(e.transactionId,n,"compensate"),d=i.filter(c=>de(c.message,o)||c.message===a).at(-1);if(d?.message!==a){if(d===void 0||!i.every(c=>ft(c,e.transactionId)))throw b(e,r.id,n);await T({pmRoot:e.pmRoot,id:r.id,validate:c=>{s(c,()=>b(e,r.id,n))},compensation:mt(e,t,n,e.createCompensation==="delete"?"delete":"close",!0)},async()=>{let c={force:!0,author:e.author,message:a};e.createCompensation==="delete"?await Be(t,c,{pmRoot:e.pmRoot}):await Z(t,`Compensated: interrupted bulk transaction ${e.transactionId}`,{...c,validateClose:"off"},{pmRoot:e.pmRoot})})}}function Gt(e,t,n){return{id:n,compensatePending:!0,async inspect(){let r=await _(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await v(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return z(e.pmRoot,t)},async apply(){let r=()=>Je(t.id,P(t.options,{author:e.author,message:y(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot}),i=t.match,s=i,a=(await T({pmRoot:e.pmRoot,id:await yt(e.pmRoot,t.id),validate:d=>{s!==void 0&&ut(d,t.id,s)},committed:d=>{i!==void 0&&(s={key:i.key,value:structuredClone(d.metadata[i.key])})},historyContext:{item_transaction_step:y(e.transactionId,n,"apply")}},r)).item;return e.uniqueIndex.invalidate(),{id:String(a.id),op:"update"}},async compensate(r){await I(e,t.id,n,r)}}}async function yt(e,t){return String((await H(t,{},{pmRoot:e})).item.id)}function qt(e,t,n){let r=y(e.transactionId,n,"apply");return{id:n,compensatePending:!0,async inspect(){let i=await _(e.pmRoot,t.id);return i===void 0||!await v(e.pmRoot,i.id,e.transactionId,n)?{state:"pending"}:{state:"applied",result:{id:i.id,op:t.op}}},async prepareCompensation(){return z(e.pmRoot,t)},async apply(){let i=await yt(e.pmRoot,t.id),{match:s}=t;return await He(e.pmRoot,()=>T({pmRoot:e.pmRoot,id:i,validate:o=>{s!==void 0&&ut(o,t.id,s)},historyContext:{item_transaction_step:r}},()=>tt({pmRoot:e.pmRoot,id:i,author:e.author,message:r,force:t.force,...t.set===void 0?{}:{set:t.set},...t.unset===void 0?{}:{unset:t.unset}}))),e.uniqueIndex.invalidate(),{id:i,op:t.op}},async compensate(i){await I(e,t.id,n,i)}}}function Kt(e,t,n){return{id:n,async inspect(){let r=await _(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await v(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"close"}}:r.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"close"}}},async prepareCompensation(){return z(e.pmRoot,t)},async apply(){let i=(await Z(t.id,t.reason,P(t.options,{author:e.author,message:y(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return e.uniqueIndex.invalidate(),{id:String(i.id),op:"close"}},async compensate(r){await I(e,t.id,n,r)}}}function Lt(e,t,n){return{id:n,async inspect(){let r=await _(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await v(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"release"}}:r.assignee!==void 0||r.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"release"}}},async prepareCompensation(){return z(e.pmRoot,t)},async apply(){let i=(await We(t.id,P(t.options,{author:e.author,message:y(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return e.uniqueIndex.invalidate(),{id:String(i.id),op:"release"}},async compensate(r){await I(e,t.id,n,r)}}}function ue(e,t,n){let r=ce(t,n),i=Jt(e,t,r);return lt.set(i,{transactionId:e.transactionId,stepId:r,itemId:t.id,operation:t.op!=="create"?"restore":e.createCompensation==="delete"?"delete":"close"}),i}function Jt(e,t,n){switch(t.op){case"create":return ht(e,t,n);case"update":return Gt(e,t,n);case"close":return Kt(e,t,n);case"release":return Lt(e,t,n);case"finalize":return qt(e,t,n)}}function Wt(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`Bulk mutation ${t+1} must be an object`);if(!["create","update","close","release","finalize"].includes(e.op))throw new TypeError(`Bulk mutation ${t+1} op must be create, update, close, release, or finalize`);if(typeof e.id!="string"||e.id.trim().length===0)throw new TypeError(`Bulk mutation ${t+1} requires a non-empty id`);if(e.op==="close"&&(typeof e.reason!="string"||e.reason.trim().length===0))throw new TypeError(`Bulk close mutation ${t+1} requires a non-empty reason`);if(Bt(e,t),e.op==="finalize"){Vt(e,t);return}X(e.options,e.op,t)}function Bt(e,t){if(e.op==="create"&&e.unique!==void 0&&!nt(e.unique))throw new TypeError(`Bulk create mutation ${t+1} unique must be an object with a non-empty key and a value`);if((e.op==="update"||e.op==="finalize")&&e.match!==void 0&&!nt(e.match))throw new TypeError(`Bulk ${e.op} mutation ${t+1} match must be an object with a non-empty key and a value`)}var rt=["op","id","set","unset","match","force"];function Vt(e,t){let n=`Bulk finalize mutation ${t+1}`,r=Object.keys(e).filter(i=>!rt.includes(i));if(r.length>0)throw new TypeError(`${n} has unsupported keys: ${r.join(", ")}; a finalization carries only ${rt.join(", ")}`);if(e.force!==void 0&&typeof e.force!="boolean")throw new TypeError(`${n} force must be a boolean`);if(e.match!==void 0&&!R(e.match))throw new TypeError(`${n} match must be a plain object with a JSON value`);ee(e,n)}function ie(e){if(e.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");let t=new Map;for(let[n,r]of e.entries()){if(Wt(r,n),r.op!=="create"||r.unique===void 0)continue;let{key:i,value:s}=r.unique,o=t.get(i)??new Map,a=O(s),d=o.get(a);if(d!==void 0)throw new p(`Bulk create mutations ${d+1} and ${n+1} share the upsert key value ${JSON.stringify(a)} for "${i}".`,l.USAGE,{code:"upsert_key_duplicate",required:"Each create must carry a distinct unique key value within one batch.",why:"Direct SDK batches must preserve the same uniqueness invariant as planned document rows."});o.set(a,n),t.set(i,o)}}function wt(e){let t=[...e];ie(t);let n=t.map(r=>{let i=structuredClone(r);return r.op!=="finalize"&&i.op!=="finalize"&&r.options!==void 0&&i.options!==void 0&&W(r.options,i.options),i});return ie(n),n}function gt(e,t=""){return e===null||typeof e!="object"?[]:Object.entries(e).flatMap(([n,r])=>{let i=`${t}/${n.replaceAll("~","~0").replaceAll("/","~1")}`;return/^(created_at|updated_at|closed_at|completed_at|timestamp)$/u.test(n)?[i]:gt(r,i)})}async function ne(e,t,n){try{return await n()}catch(r){throw r instanceof p?new p(r.message,r.exitCode,{...r.context,transaction_operation:{index:t,op:e.op,id:e.id}}):r}}function _t(e,t,n,r){let i=u.relative(e,t),s=i.split(u.sep);return s[0]==="extensions"&&s[2]==="node_modules"&&!r.some(o=>i===o||i.startsWith(`${o}${u.sep}`)||o.startsWith(`${i}${u.sep}`))?!1:["locks","runtime","search"].includes(i.split(u.sep)[0])?r.some(o=>i===o||i.startsWith(`${o}${u.sep}`)||o.startsWith(`${i}${u.sep}`)):i===""||n===void 0||n.some(o=>i===o||i.startsWith(`${o}${u.sep}`)||o.startsWith(`${i}${u.sep}`))}async function x(e,t){let n=await it(t);if(n.isSymbolicLink())await se(t);else if(n.isDirectory()||n.isFile())return n;throw $(u.relative(e,t))}async function Yt(e,t){let n=await Nt(t,te.O_RDONLY|te.O_NOFOLLOW|te.O_NONBLOCK);try{let r=await n.stat();if(!r.isFile())throw $(u.relative(e,t));let i=oe.createHash("sha256");if(r.size>0)for await(let s of n.createReadStream({highWaterMark:64*1024,end:r.size-1,autoClose:!1}))i.update(s);return i.digest()}finally{await n.close()}}async function re(e,t,n){let r=oe.createHash("sha256");async function i(s){for(let o of(await jt(s)).sort()){let a=u.join(s,o);_t(e,a,t,n)&&((await x(e,a)).isDirectory()?await i(a):(r.update(JSON.stringify(u.relative(e,a))),r.update(await Yt(e,a))))}}return await i(e),r.digest("hex")}function F(){return new p("Tracker changed while preparing the transaction preview; retry against stable state.",l.CONFLICT,{code:"transaction_preview_snapshot_changed"})}async function fe(e){if(!q(e))return!1;let t=e.path;if(typeof t!="string")return!1;let n=u.resolve(t),r=n;for(;;)try{let i=await it(r);return r!==n&&i.isDirectory()}catch(i){if(!q(i))return!1;let s=u.dirname(r);if(s===r)return!1;r=s}}async function D(e,t){let n=u.join(e,t);try{let r=e;for(let i of t.split(u.sep).slice(0,-1))r=u.join(r,i),await x(e,r);if(!(await x(e,n)).isFile())throw $(t);return await we(n,$(t))}catch(r){if(await fe(r))return;throw r}}async function St(e,t,n,r){let i=L(n);for(let[s,o]of Object.entries(i.files)){let a=u.relative(e,Oe(e,o,Ee[s]));if(a===""||!u.resolve(e,a).startsWith(u.join(e,u.sep)))throw new p("Transaction preview requires schema files inside the selected tracker root; relocate the configured schema file before retrying.",l.USAGE,{code:"transaction_preview_external_schema",field:`schema.files.${s}`});i.files[s]=a;let d=await D(e,a);if(r?.set(a,d),d!==void 0){let c=u.join(t,a);await Ct(u.dirname(c),{recursive:!0}),await ct(c,d)}}return be(t,i)}async function Ht(e,t){await se(e);let n=await ot(u.join(dt(),"pm-schema-plan-"));try{let r=await st(e);return await St(r,u.join(n,"configuration"),t)}catch(r){throw await fe(r)?F():r}finally{await at(n,{recursive:!0,force:!0})}}async function Zt(e,t,n){let r=new Map,i=await D(e,A);r.set(A,i);let s;try{s=JSON.parse(i??"null")}catch{s=null}let o=Ue(s),a=o.success?o.data:void 0,d=await St(e,t,a?.schema,r),c=d.schema,f=u.relative(e,Te(e));r.set(f,await D(e,f));let h=K({...he,item_types:{definitions:[...a?.item_types?.definitions??[],...d.type_definitions_from_file??[]]}},n),m=ge(e)===e?[...me.filter(Boolean),A,Pe,"transactions",...h.folders,...r.keys()].map(g=>u.normalize(g)):void 0,w=a===void 0?void 0:JSON.stringify({...s,schema:{...a.schema,files:c.files}});return{configuration:r,ownedPaths:m,stagedSettings:w,registryFolders:h.folders}}async function Xt(e,t,n){await se(e);try{let r=await st(e),i=await Zt(r,u.join(u.dirname(t),"configuration"),n),s=[...i.configuration.keys(),...i.registryFolders].map(c=>u.normalize(c)),o=await re(r,i.ownedPaths,s);await Mt(r,t,{recursive:!0,dereference:!1,filter:async c=>_t(r,c,i.ownedPaths,s)?(await x(r,c),!0):!1});let[a,d]=await Promise.all([re(r,i.ownedPaths,s),re(t,i.ownedPaths,s)]);if(o!==a||o!==d)throw F();for(let[c,f]of i.configuration)if(await D(t,c)!==f)throw F();i.stagedSettings!==void 0&&await ct(u.join(t,A),i.stagedSettings)}catch(r){throw await fe(r)?F():r}}async function Ir(e){let t=j(e),n=wt(e.mutations),r=k(),i=Ce(),s=await ot(u.join(dt(),"pm-transaction-preview-")),o=u.join(s,"tracker");try{await Xt(t.pmRoot,o,r);let a=!1,d=[],c=[],f=new Set;return await Me(i,()=>Ye({path:o,noExtensions:!0},async()=>{Ie(r);let h={...t,pmRoot:o,createCompensation:"close",uniqueIndex:ae(o)},m=n.map((w,g)=>{let S=ue({...h,onCreateWarnings:(G,pe)=>{pe.length>0&&d.push({index:g,id:G,op:"create",warnings:pe})}},w,g);return{...S,inspect:()=>ne(w,g,()=>S.inspect()),prepareCompensation:()=>ne(w,g,async()=>S.prepareCompensation?.()),apply:()=>ne(w,g,async()=>{let G=await S.apply();return f.add(g),G})}});if(await V({...t,pmRoot:o,steps:m,onTransition:({transition:w})=>{w==="committed"&&(a=!0)}}),a)for(let[w,g]of n.entries()){let S=(await Ke(g.id,{path:o},{full:!0})).item;c.push({index:w,id:String(S.id),op:g.op,execution:f.has(w)?"applied":"adopted",item:S,commit_time_fields:gt(S)})}})),{records:c,validated:a,state:a?"staged_snapshot":"replayed_committed_plan",warnings:d,unresolved_commit_constraints:["concurrent_tracker_changes","extension_write_hooks","derived_extension_dependencies_excluded","generated_timestamps_and_provenance"]}}finally{await at(s,{recursive:!0,force:!0})}}async function Qt(e){let t=j(e),n=wt(e.mutations),r=e.createCompensation??"close";if(!["close","delete"].includes(r))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let i={...t,createCompensation:r,uniqueIndex:ae(t.pmRoot)},s=await V({...t,steps:n.map((a,d)=>ue(i,a,d)),recoveryData:JSON.parse(JSON.stringify({kind:"item-mutations-v1",mutations:n,createCompensation:r})),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),o={};for(let[a,d]of n.entries()){let c=ce(d,a),f=s.results[c];o[Dt(d,a)]=f}return{transactionId:s.transactionId,status:"committed",recovered:s.recovered,results:o}}function en(e){let t=[];return e.evidence!==void 0&&Object.keys(e.evidence).length>0&&t.push({op:"update",id:e.id,options:e.evidence}),t.push({op:"close",id:e.id,reason:e.reason,...e.closeOptions===void 0?{}:{options:e.closeOptions}},{op:"release",id:e.id,...e.releaseOptions===void 0?{}:{options:e.releaseOptions}}),t}function Mr(e){return Qt({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:en(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var Cr={buildCreateStep:ht,bulkHistoryMarker:y,compensateByRestore:I,deriveStepId:ce,isUpdateMarkerApplied:v,readItemSnapshot:_};async function Nr(e,t){let n=await Ge(e,t);return n===void 0?void 0:{journal:n,planDigest:Y(n)}}function tn(e,t){let n=t.recoveryData;if(n===null||typeof n!="object"||Array.isArray(n)||n.kind!=="item-mutations-v1"||!Array.isArray(n.mutations)||!["close","delete"].includes(String(n.createCompensation)))throw new p("Transaction has no supported item recovery plan",l.CONFLICT,{code:"transaction_recovery_plan_missing",required:"Resume with the original plan and its original adapter.",why:"Legacy or foreign journals cannot safely reconstruct item compensation."});let r=n.mutations;ie(r);let i={...e,createCompensation:n.createCompensation,uniqueIndex:ae(e.pmRoot)};return r.map((s,o)=>ue(i,s,o))}async function jr(e){let t=j(e),n=await qe({...e,...t,resolveSteps:r=>tn({...e,...t},r)});return{journal:n,planDigest:Y(n)}}export{Cr as _testOnlyItemTransaction,jr as abandonItemTransaction,en as buildItemCompletionMutations,Mr as commitItemCompletion,Qt as commitItemMutations,Ft as listUpsertKeyCandidates,Ht as loadGuardedRuntimeSchema,Ir as previewItemMutations,Nr as readItemTransaction,Ut as resolveTransactionSchema};
|
|
2
|
+
//# sourceMappingURL=item-transaction-YZ2PUPGM.js.map
|
package/dist/cli-bundle/focused-chunks/{mutation-actor-2AAUJG2Z.js → mutation-actor-DJ2VRLKG.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{kc as t,lc as r,mc as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=mutation-actor-
|
|
1
|
+
import{kc as t,lc as r,mc as s}from"./chunk-BPBKHY6H.js";import"./chunk-TX24L7RQ.js";import"./chunk-26P6C6OO.js";import"./chunk-JFICNN4T.js";import"./chunk-IRYNVGKH.js";function c(n){let e=r(n),o={...e.harness===void 0?{}:{harness:e.harness},...e.model===void 0?{}:{model:e.model},...e.model_source===void 0?{}:{model_source:e.model_source},...e.instance===void 0?{}:{instance:e.instance}};return Object.freeze({author:n,author_source:t(n),principal:s(n),...Object.keys(o).length===0?{}:{agent:Object.freeze(o)}})}export{c as resolveMutationActor};
|
|
2
|
+
//# sourceMappingURL=mutation-actor-DJ2VRLKG.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Q as y,t as _,y as f}from"./chunk-LSVRZ4KQ.js";import"./chunk-KWKPX36T.js";import{T as A,W as L,a as T}from"./chunk-S4AC7OMI.js";import"./chunk-NZA2LP4Y.js";import{F as g,Pa as C,Va as E}from"./chunk-KLOHZNJ4.js";import"./chunk-TSZVCALS.js";import{r as M}from"./chunk-2CQFGJQ6.js";import"./chunk-CWQLW4ZO.js";import"./chunk-BWOVFE5B.js";import"./chunk-X6CXWWNB.js";import{a as w}from"./chunk-BPBKHY6H.js";import{T as b}from"./chunk-TX24L7RQ.js";import{n as S}from"./chunk-26P6C6OO.js";import{da as R,ea as N}from"./chunk-JFICNN4T.js";import{A as m}from"./chunk-IRYNVGKH.js";function l(e,t,n,i=!1){let s=[...n].map(o=>({candidate:o,distance:w(t,o,3)})).filter(o=>o.distance!==null).sort((o,d)=>o.distance-d.distance||o.candidate.localeCompare(d.candidate))[0]?.candidate,a=i?`Put mutation fields under options (options.${t}).`:s?`Did you mean "${s}"?`:"Use the declared command options or the field option for registered item fields.";throw new m(`Unknown ${e} ${i?"argument":"option"} "${t}". ${a} No changes were made.`,2,{code:"invalid_argument_value",reason:"unknown_mutation_option",changed:!1,field:t,required:a,nextSteps:[a]})}var p=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function $(e){let t=e==="create"?A:L,i=(e==="create"?C:E).map(({flag:s})=>s.slice(2).replace(/-([a-z])/gu,(a,o)=>o.toUpperCase()));return new Set([...t.flatMap(s=>[s.target,...s.keys]),...i,"author","message","force","fullChangedFields","idOnly",...p])}function F(e){if(e!==void 0&&!f(e))throw new m("Mutation options must be an object. No changes were made.",2,{code:"invalid_argument_value",changed:!1})}async function v(e,t){let i=R((await M(S(process.cwd(),t))).schema).command_to_fields.get(e)??[];return{targets:i.map(s=>N(s)),reads:s=>i.some(a=>b({[s]:!0},a)===!0)}}async function h(e,t,n,i,s,a=(o,d)=>l(e,o,d)){let o=[...n].filter(r=>!i.has(r));if(o.length===0)return;let d=await v(t,s);for(let r of d.targets)i.add(r);for(let r of o)d.reads(r)||a(r,i)}async function ee(e,t,n,i,s){if(_(t))return;let a=$(e),o=new Set(["action","options","path","cwd","author","force","noExtensions","no_extensions","fullChangedFields","idOnly",...p,...s,...e==="update"?["id"]:[]]);for(let r of Object.keys(t))o.has(r)||l(e,r,a,a.has(r));let d=t.options;F(d),await h(e,e,new Set([...Object.keys(d??{}),...Object.keys(n)]),a,i)}var I=new Set([...y].filter(e=>e!=="filterStatus"&&(e.startsWith("filter")||e==="ids"||e==="limit"||e==="offset"))),k=e=>e.replace(/_([a-z])/gu,(t,n)=>n.toUpperCase()),O=new Map([["for","Bound the selection with list.limit."],["tokenBudget","Bound the selection with list.limit."],["token_budget","Bound the selection with list.limit."],["all",'State the status selection as filterStatus: "all" beside the list record.'],["status","State the status selection as filterStatus beside the list record."]]),K=["compact","brief","fields","includeBody","full"];async function U(e,t){let n=K.filter(s=>Object.hasOwn(e,s));if(n.length===0)return;let i=await v("list",t);for(let s of n)i.reads(s)&&c(`update-many "list.${s}" is not read beside this selection.`,`list.${s}`,"The bulk selection clears this list option, so the schema field's filter under that name is not applied; select the rows another way.")}var j=["excludeTerminal","lifecycleBucket","dependencyBlocked"];function P(){let e=g.map(({flag:n})=>n.replace(/^--(?:no-)?/u,"").replace(/-([a-z])/gu,(i,s)=>s.toUpperCase())),t=new Set([...e,...T.flatMap(n=>n.keys),"filterEstimateMissing",...j]);for(let n of O.keys())t.delete(n);return t}function c(e,t,n,i="unknown_mutation_option"){throw new m(`${e} ${n} No changes were made.`,2,{code:"invalid_argument_value",reason:i,changed:!1,field:t,required:n,nextSteps:[n]})}function D(){let e=$("update");e.delete("id");for(let t of e)/File$|^stdin/u.test(t)&&e.delete(t);return e.add("documentAnnotationSnapshot"),e}function B(e){for(let t of["list","update"]){let n=e[t];n!=null&&!f(n)&&c(`update-many "${t}" must be an object.`,t,`Pass ${t} as an object, or omit it.`,"invalid_mutation_option_value")}}async function x(e,t,n){Object.hasOwn(e,"id")&&l("update-many list","id",new Set(["ids"])),Object.hasOwn(e,"status")&&c('update-many "list.status" is not read beside this selection.',"list.status",O.get("status"));let i=[...t].find(s=>I.has(s));i!==void 0&&c(`update-many "${i}" is not read beside this selection.`,i,`Put the selection inside list, or drop the list record; a flat "${i}" beside it is not read.`),await U(e,n),await h("update-many list","list",Object.keys(e),P(),n,(s,a)=>{let o=O.get(s);o===void 0&&l("update-many list",s,a),c(`update-many "list.${s}" is not read beside this selection.`,`list.${s}`,o)})}function Y(e,t,n){for(let i of e)t.has(i)||(n.has(i)&&c(`Unknown update-many option "${i}".`,i,`Put update fields inside update (update.${i}); beside a nested update record an outer key selects rows or controls the run.`),l("update-many",i,t))}async function te(e,t,n){if(_(e))return;let i=e.options;F(i);let s=D(),a=new Set([...y,"author","message","force","fullChangedFields","idOnly",...p]),o=new Set([...s,...a]),d=new Set(["action","options","path","cwd","author","noExtensions","no_extensions","fullChangedFields","idOnly",...p]);for(let u of Object.keys(e))d.has(u)||l("update-many",u,o,o.has(u));let r=new Set([...Object.keys(i??{}),...Object.keys(t)].map(u=>p.includes(k(u))?k(u):u));if(B(t),f(t.list)&&await x(t.list,r,n),!f(t.update)){await h("update-many","update_many",r,o,n);return}Y(r,a,s),await h("update-many","update_many",Object.keys(t.update),s,n)}export{ee as assertNativeMutationOptions,te as assertNativeUpdateManyOptions};
|
|
2
|
+
//# sourceMappingURL=mutation-admission-3SECKVKY.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$ as m,P as a,Q as b,R as c,S as d,T as e,U as f,V as g,W as h,X as i,Y as j,Z as k,_ as l,aa as n,ba as o,ca as p,da as q,ea as r,fa as s}from"./chunk-JFICNN4T.js";import"./chunk-IRYNVGKH.js";export{a as DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,c as DEFAULT_RUNTIME_STATUS_DEFINITIONS,b as DEFAULT_RUNTIME_WORKFLOW,m as ensureRuntimeSchemaFileScaffold,k as filePathForSchemaSection,f as inspectRuntimeFieldDefinition,e as inspectRuntimeStatusDefinition,n as loadRuntimeSchemaFromOptionalFiles,d as normalizeCliToken,g as normalizeRuntimeSchemaSettings,p as normalizeStatusInputWithRegistry,j as readFieldsFromSchemaFile,i as readStatusesFromSchemaFile,h as readTypeDefinitionsFromSchemaFile,l as resolveItemTypesFilePath,q as resolveRuntimeFieldRegistry,o as resolveRuntimeStatusRegistry,r as runtimeFieldOptionTarget,s as statusIsTerminal};
|
|
2
|
+
//# sourceMappingURL=runtime-schema-IDRXWCC4.js.map
|
package/dist/cli-bundle/focused-chunks/{settlement-hook-4MGRERCT.js → settlement-hook-Q6MJQKIE.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as l}from"./chunk-IIP6LZ5E.js";import{c as p}from"./chunk-AIDL2ZNT.js";import{A as m,E as s,
|
|
1
|
+
import{b as l}from"./chunk-IIP6LZ5E.js";import{c as p}from"./chunk-AIDL2ZNT.js";import{A as m,E as s,J as c,z as a}from"./chunk-IRYNVGKH.js";import{execFile as f}from"node:child_process";import{chmod as h,lstat as u}from"node:fs/promises";import{promisify as w}from"node:util";var x=w(f),g=`#!/bin/sh
|
|
2
2
|
# pm-cli:lossless-merge-settlement:v1
|
|
3
3
|
`;async function A(e,d){let r=(await x("git",["rev-parse","--path-format=absolute","--git-path","hooks/pre-commit"],{cwd:e,env:p(),timeout:1e4})).stdout.trim(),t,o=!1;try{t=await l(r,65536)??"",o=process.platform==="win32"||((await u(r)).mode&73)!==0}catch(n){if(!s(n))throw n}if(t!==void 0&&!t.startsWith(g))throw new m("The pre-commit hook already exists and is not owned by pm; it was preserved.",a.CONFLICT,{code:"merge_settlement_hook_conflict",recovery:{suggested_retry:"pm merge install --dry-run"},nextSteps:["Integrate pm merge reconcile --stage into your existing hook after reviewing its policy, or keep manual settlement. pm never replaces an existing unowned hook."]});let i=`${g}merge_head=$(git rev-parse --git-path MERGE_HEAD) || exit 1
|
|
4
4
|
[ -f "$merge_head" ] || exit 0
|
|
5
5
|
exec ${d} merge reconcile --stage
|
|
6
6
|
`;return{path:r,changed:t!==i||!o,content:i}}async function C(e){e.changed&&(await c(e.path,e.content),await h(e.path,493))}export{A as prepareMergeSettlementHook,C as writeMergeSettlementHook};
|
|
7
|
-
//# sourceMappingURL=settlement-hook-
|
|
7
|
+
//# sourceMappingURL=settlement-hook-Q6MJQKIE.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as w,j as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=stage-
|
|
1
|
+
import{c as w,j as y}from"./chunk-EUDAUT6T.js";import{b as u}from"./chunk-XR6MLUVW.js";import{c as g}from"./chunk-AIDL2ZNT.js";import"./chunk-BKPUUW5O.js";import"./chunk-2CQFGJQ6.js";import"./chunk-CWQLW4ZO.js";import"./chunk-BPBKHY6H.js";import"./chunk-TX24L7RQ.js";import{n as h}from"./chunk-26P6C6OO.js";import"./chunk-JFICNN4T.js";import{A as f,z as d}from"./chunk-IRYNVGKH.js";import{execFile as x}from"node:child_process";import{realpath as R}from"node:fs/promises";import p from"node:path";import{promisify as $}from"node:util";var b=$(x);function c(t){return new f(`Automatic merge settlement refused: ${t}`,d.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function G(t){let e=process.env.GIT_INDEX_FILE;if(e===void 0)return;let s=(await t(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(p.resolve(e)!==p.resolve(s))throw c("an alternate Git index requires explicit manual settlement")}async function k(t,e){if(e.length===0)return[];let s=e.map(n=>`:(literal)${n}`),a=new Set((await t(["ls-files","--cached","-z","--",...s])).stdout.split("\0")),i=e.filter(n=>!a.has(n)).map(n=>`:(literal)${n}`);if(i.length>0&&(await t(["diff","--cached","--name-only","--diff-filter=D","-z","--",...i])).stdout.length>0)throw c("a receipt has a staged deletion that requires explicit review");return i}async function I(t){let{git:e,preview:s,paths:a,newReceiptPathspecs:i}=t,n=!1;try{i.length>0&&(n=!0,await e(["add","--",...i]));let o=await t.apply();if(!o.ok||JSON.stringify(o.receipts.summaries)!==JSON.stringify(s.receipts.summaries)||o.repair.streams.some(m=>!s.repair.streams.some(l=>l.id===m.id)))throw c("reconciliation changed or did not finish; inspect the audit artifacts before staging");return a.length>0&&await e(["add","--",...a.map(m=>`:(literal)${m}`)]),{...o,staged_paths:a,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(o){throw n&&await e(["reset","--quiet","--",...i]),o}}function S(t){if(t.repair.totals.failed>0||t.receipts.missing_history_references_after>0||t.receipts.summaries.some(e=>e.conflict_fields.length>0)||t.repair.streams.some(e=>e.merge_receipt_proof?.trusted!==!0)||t.validation.checks.some(e=>e.name!=="history_drift"&&e.status!=="ok"))throw c("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function q(t){try{return{...t,path:await R(h(process.cwd(),t.path))}}catch{throw c("the tracker root cannot be resolved")}}async function z(t){let{preview:e}=t;S(e);let{path:s}=await q(t.global),a=await w(s);if(a===null)throw c("a Git workspace is required");let i=r=>b("git",r,{cwd:a,env:g(),timeout:1e4});if(await G(i),(await i(["ls-files","--unmerged","-z"])).stdout.length>0)throw c("Git still has unresolved paths");let o=[...new Set([...[...new Set([...e.repair.streams.map(r=>r.id),...e.receipts.summaries.map(r=>r.item_id)])].map(r=>p.join(s,"history",`${r}.jsonl`)),...e.receipts.summaries.map(r=>p.join(s,"merge-receipts",`${r.receipt_id}.json`))])].map(r=>p.relative(a,r).replaceAll("\\","/"));if(o.some(u))throw c("reconciliation artifacts must belong to this Git workspace");let m=await y(a,o);if(m.length>0)throw new f(`Automatic merge settlement refused: required artifacts are ignored by Git: ${m.map(r=>`${r.path} (${r.source}:${r.line}: ${r.pattern})`).join(", ")}. Remove or narrow the owning ignore rules because merge receipts must travel with the commit.`,d.CONFLICT,{code:"merge_settlement_review_required",reason:"ignored_merge_artifacts",paths:m.map(r=>r.path),nextSteps:["Remove or narrow the named ignore rules, preserve receipt and history files, then retry pm merge reconcile --stage --dry-run before applying pm merge reconcile --stage. Do not force-add ignored proof as a substitute for fixing the shared policy."]});let l=o.map(r=>`:(literal)${r}`),v=e.receipts.summaries.map(r=>p.relative(a,p.join(s,"merge-receipts",`${r.receipt_id}.json`)).replaceAll("\\","/"));if(l.length>0)try{await i(["diff","--quiet","--",...l])}catch{throw c("reconciliation paths have unstaged edits or Git cannot verify their index state")}let _=await k(i,v);return t.dryRun?{...e,staged_paths:[]}:I({...t,git:i,paths:o,newReceiptPathspecs:_})}export{q as resolveMergeSettlementGlobal,z as stageLosslessMergeReconciliation};
|
|
2
|
+
//# sourceMappingURL=stage-FEJT2UCG.js.map
|