@unbrained/pm-cli 2026.11.4 → 2026.11.6
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/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
- package/.agents/skills/README.md +14 -14
- package/.agents/skills/pm-developer/SKILL.md +16 -16
- package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +14 -14
- package/.agents/skills/pm-developer/references/SCRIPTING_COMPOSITION.md +10 -10
- package/.agents/skills/pm-extensions/SKILL.md +13 -13
- package/.agents/skills/pm-extensions/references/AUTHORING.md +12 -12
- package/.agents/skills/pm-sdk/SKILL.md +27 -27
- package/.agents/skills/pm-sdk/references/SURFACE_MAP.md +32 -32
- package/.agents/skills/pm-test-audit/references/AUDIT.md +1 -1
- package/.agents/skills/pm-user/SKILL.md +35 -35
- package/.claude-plugin/marketplace.json +1 -1
- package/AGENTS.md +9 -9
- package/CHANGELOG.md +16 -0
- package/README.md +13 -13
- package/dist/cli/register-operations.js +1 -1
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-NPEDFOVQ.js → chunk-335BZ75D.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-5GWEY4P6.js +122 -0
- package/dist/cli-bundle/chunks/chunk-6VRX2CM7.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-7PGNAHNW.js → chunk-7DEKAXVA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3OXQGGRD.js → chunk-7ZRCYESH.js} +42 -41
- package/dist/cli-bundle/chunks/{chunk-BWAXA6S4.js → chunk-AUEKTX7V.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SRDO2NJU.js → chunk-D7KYPRK4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ODMJ3HIB.js → chunk-DAX3AOFI.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-T56MB6SF.js → chunk-FRNMQM45.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5S6RT5LX.js → chunk-HNGLDMSZ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-BK2XAQVC.js → chunk-HRFGFIYU.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6T2V3UIK.js → chunk-LS3GI3H4.js} +53 -53
- package/dist/cli-bundle/chunks/chunk-OH6WQ7VT.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-5BVZ32G7.js → chunk-PE3ASURT.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-QNWUIPBO.js +31 -0
- package/dist/cli-bundle/chunks/{chunk-7RCI7AAA.js → chunk-S4LPZ4TN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QN7VCOUU.js → chunk-SLC5UWCM.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BRIPGUAO.js → chunk-TSQCUBUX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AQ5UHHQS.js → chunk-UEGXWXUZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-L4BKTPJ6.js → chunk-WC4M2H6R.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CERNIZLB.js → chunk-X3URBPMV.js} +42 -42
- package/dist/cli-bundle/chunks/{chunk-2GW662DP.js → chunk-YKXATU2G.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-UAZOBP2Q.js → item-revision-OJJVPQY7.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-TBKEATN6.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-admission-QZQI2NN5.js → mutation-admission-INMM3HHG.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-P3NOKQUA.js → register-list-query-5Y5JKWU5.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-A6I5K5N6.js → register-mutation-MDSUU3G7.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-WJHZJFK2.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-RRFOS7IT.js +2 -0
- package/dist/cli-bundle/chunks/{stage-L3T725DS.js → stage-E3MMV4TV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2KTJY7BV.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TFYTTDAK.js → chunk-7KK66ISG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y5GOUUYJ.js → chunk-AHWJPZSJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-C7UX2ZI3.js → chunk-C6P6HPCX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Q4OIRSKL.js → chunk-CPMSL4HS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CZM75DE3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-CO2DNPH7.js → chunk-D2TBEBNW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-E56OXRYH.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FXFDVM5O.js → chunk-F62XGAAY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-G4QP365K.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-J7M52SCZ.js → chunk-G5PJCR7R.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-GS3JC5UU.js +23 -0
- package/dist/cli-bundle/focused-chunks/{chunk-W3CSX6GI.js → chunk-LW64TINU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MEJKELWC.js → chunk-M6V7UMWL.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-CXTDEQ3N.js → chunk-MC7IE7D7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MG7C3JUY.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-QEVJ3Y67.js → chunk-MK4HV4JO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-O7EI33NP.js +91 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FFO7RBLN.js → chunk-RFTJZ5VB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PNPYQDHU.js → chunk-SNOXXRSJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JQS7TYQ6.js → chunk-UPJUTP2V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SDLIUZEL.js → chunk-VWWTIX5L.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-A2246ZM7.js → chunk-WSOAASCY.js} +54 -54
- package/dist/cli-bundle/focused-chunks/{chunk-J6FDCAMH.js → chunk-XHOBYCVE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-J3YOATXR.js → chunk-YMGB2O4E.js} +25 -24
- package/dist/cli-bundle/focused-chunks/{item-revision-L6GVT42D.js → item-revision-CTDO4H3I.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-transaction-GYGP264N.js → item-transaction-H2XACBOP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-UWTH56OD.js → mutation-admission-4WM7TNHZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-WRSNJ7VI.js → stage-WV7QXR4C.js} +2 -2
- package/dist/cli-bundle/main.js +2 -2
- 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 +57 -57
- 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 +9 -9
- package/dist/core/config/positional-value.d.ts +6 -0
- package/dist/core/config/positional-value.js +1 -1
- package/dist/core/item/literal-mutation-input.d.ts +17 -0
- package/dist/core/item/literal-mutation-input.js +1 -1
- package/dist/core/item/parent-reference-policy.d.ts +8 -4
- package/dist/core/item/parent-reference-policy.js +1 -1
- package/dist/core/item/sprint-release-format.d.ts +2 -1
- package/dist/core/item/sprint-release-format.js +1 -1
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/store/item-mutation-precondition.d.ts +3 -1
- package/dist/core/store/item-mutation-precondition.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/settings.d.ts +14 -0
- package/dist/core/store/settings.js +5 -4
- package/dist/core/telemetry/policy.d.ts +27 -1
- package/dist/core/telemetry/policy.js +1 -1
- package/dist/core/telemetry/runtime.d.ts +18 -7
- package/dist/core/telemetry/runtime.js +4 -4
- package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +8 -5
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +1 -1
- package/dist/sdk/config.d.ts +2 -2
- package/dist/sdk/config.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/governance/health/projection.js +1 -1
- package/dist/sdk/governance/health.d.ts +5 -5
- package/dist/sdk/governance/health.js +2 -2
- package/dist/sdk/index.d.ts +4 -2
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/init.d.ts +4 -4
- package/dist/sdk/init.js +8 -8
- package/dist/sdk/lifecycle/claim.d.ts +4 -0
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/close.d.ts +10 -0
- package/dist/sdk/lifecycle/close.js +1 -1
- package/dist/sdk/lifecycle/create.d.ts +7 -5
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/shared-unset-fields.d.ts +628 -4
- package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
- package/dist/sdk/lifecycle/update.d.ts +5 -4
- package/dist/sdk/lifecycle/update.js +2 -2
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/runtime/actions.js +1 -1
- package/dist/sdk/runtime/mutation-value-validation.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +1 -0
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/telemetry.d.ts +1 -1
- package/dist/sdk/telemetry.js +2 -2
- package/docs/AGENT_GUIDE.md +48 -48
- package/docs/AGENT_OUTPUT_ENCODINGS.md +20 -20
- package/docs/ASSURANCE.md +10 -10
- package/docs/BOUNDED_CONTEXT_READS.md +3 -3
- package/docs/CLAUDE_CODE_PLUGIN.md +1 -1
- package/docs/CLI_GRAMMAR.md +2 -2
- package/docs/COMMANDS.md +56 -35
- package/docs/COMMAND_NAMESPACES.md +1 -1
- package/docs/CONFIGURATION.md +82 -71
- package/docs/CONTEXT_ALGORITHM_PORTFOLIO.md +2 -2
- package/docs/CONTEXT_INTEGRITY_CONTRACTS.md +5 -5
- package/docs/CORPUS_SHAPES.md +1 -1
- package/docs/DEPENDENCY_KIND_CONTRACT.md +6 -6
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +5 -5
- package/docs/ECOSYSTEM_PLANNING_REVIEW.md +3 -3
- package/docs/EXTENSION_AUTHOR_CONTRACTS.md +4 -4
- package/docs/HISTORY_ATTESTATION.md +1 -1
- package/docs/HISTORY_MAINTENANCE.md +1 -1
- package/docs/LIFECYCLE_COMMANDS.md +1 -1
- package/docs/MCP_2026_07_28.md +16 -16
- package/docs/MCP_2026_07_28_CONFORMANCE.md +19 -19
- package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +22 -22
- package/docs/MCP_SKILLS_AND_APPS.md +1 -1
- package/docs/MERGE_SAFETY.md +6 -6
- package/docs/MUTATION_INTEGRITY.md +5 -5
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +21 -14
- package/docs/PACKED_FIRST_RUN.md +1 -1
- package/docs/QUICKSTART.md +10 -10
- package/docs/README.md +21 -21
- package/docs/READ_OUTPUT_CONTRACTS.md +9 -9
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +1 -1
- package/docs/RELEASING.md +43 -16
- package/docs/SCRIPTING.md +10 -10
- package/docs/SDK.md +74 -38
- package/docs/SDK_ARTIFACT_OUTPUT.md +1 -1
- package/docs/SDK_PRIMITIVE_INVENTORY.md +2 -2
- package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +7 -7
- package/docs/TESTING.md +1 -1
- package/docs/WORKFLOW_POLICIES.md +2 -2
- package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +8 -8
- package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
- package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +1 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +1 -1
- package/docs/performance/cli-transport-overhead.md +7 -7
- package/marketplace.json +1 -1
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/README.md +5 -5
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/GAP_REPORT.md +16 -16
- 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/README.md +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/GAP_REPORT.md +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/README.md +6 -6
- 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-5Z6LWFDL.js +0 -31
- package/dist/cli-bundle/chunks/chunk-DSCFJTHB.js +0 -122
- package/dist/cli-bundle/chunks/chunk-QQHMNUZT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-TX2W6G37.js +0 -3
- package/dist/cli-bundle/chunks/item-transaction-N5F4LXYV.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-SPKB3TNM.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-ZZRHJ4IS.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5NGNO54M.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-B6U44WPW.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-BAW3DGQO.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-BHNY3KPJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CBG67HUP.js +0 -23
- package/dist/cli-bundle/focused-chunks/chunk-FEPE2CE4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PMKR4MJI.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as de}from"./chunk-BK2XAQVC.js";import{Ab as re,Kc as ae,bb as R,cb as ie,db as T,eb as oe,kd as _,ld as I,oc as se,pc as ce,tb as x,ub as k}from"./chunk-DSCFJTHB.js";import{Fa as j,Ha as V,N as z,Na as X,Ta as J,Ui as ne,W,Wb as m,Wd as Z,fi as te,od as Q,pe as y,qe as v,rf as ee,za as Y}from"./chunk-3OXQGGRD.js";import{A as f,C as u,z as G}from"./chunk-O4ZLEN4T.js";import{readdir as Be}from"node:fs/promises";import L from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a319e7d9-e248-573b-bf1f-35217ce49fd0")}catch{}})();function D(e,t){return(t===void 0?void 0:V(e,t))?.execution_role??Y[e.trim().toLowerCase()]??"agent"}var A="blocked_by",le="blocks",ke=Object.freeze([A,le]),B="no-active-blocker";function a(e){return e.trim().toLowerCase()}function E(e,t){return t?`external:${e}`:`local:${a(e)}`}function p(e){let t=new Map,n=typeof e.blocked_by=="string"?e.blocked_by.trim():"";if(n.length>0&&a(n)!==B){let o=_(n);t.set(E(n,o),o?n:a(n))}for(let o of e.dependencies??[]){let i=typeof o.id=="string"?o.id.trim():"";if(m(o.kind)===A&&i.length>0&&a(i)!==B){let r=_(i)||I(o.source_kind);t.set(E(i,r),r?i:a(i))}}return[...t.values()].sort((o,i)=>o.localeCompare(i))}function C(e){let t=new Map;for(let n of e){let o=a(n.id);o.length!==0&&t.set(o,new Set(p(n)))}for(let n of e){let o=a(n.id);if(o.length!==0)for(let i of n.dependencies??[]){let r=m(i.kind)===le&&typeof i.id=="string"?a(i.id):"";if(r.length===0||r===B)continue;let c=t.get(r)??new Set;c.add(o),t.set(r,c)}}return new Map([...t].map(([n,o])=>[n,[...o].sort((i,r)=>i.localeCompare(r))]))}function fe(e,t){let n=a(e.id);return n.length>0?C(t).get(n)??p(e):p(e)}function N(e,t,n,o){let i=e,r=typeof i.id=="string"?o?.get(a(i.id))??fe(i,[...t.values()]):p(e),c=new Set((e.dependencies??[]).filter(s=>m(s.kind)===A&&I(s.source_kind)&&typeof s.id=="string"&&s.id.trim().length>0).map(s=>E(s.id.trim(),!0)));return r.map(s=>{if(_(s)||c.has(E(s,!0)))return{id:s,title:null,status:null,resolved:!1,external:!0,...typeof e.updated_at=="string"?{blocked_since:e.updated_at}:{},resolver:null};let d=t.get(a(s));return d?{id:s,title:d.title,status:d.status,resolved:v(d.status,n)}:{id:s,title:null,status:null,resolved:!1}})}function O(e,t,n){return N(e,t,n)}function Ee(e,t){let n=new Map(e.map(c=>[a(c.id),c])),o=C(e),i=new Set([...ue(t),...t.blocked_statuses]),r=new Set;for(let c of e){let s=y(c.status,t);i.has(s)&&(t.blocked_statuses.has(s)||N(c,n,t,o).some(d=>!d.resolved))&&r.add(a(c.id))}return r}function Ce(e,t,n={},o){let i=[...e.ready,...e.decisions,...e.gates];n.includeContainers===!0&&i.push(...e.containers.filter(c=>c.open_blockers.length===0&&!t.blocked_statuses.has(y(c.item.status,t))));let r={ready:[],decisions:[],gates:[]};for(let c of i){let s=D(c.item.type,o);s==="human"&&n.includeDecisions!==!0?r.decisions.push(c):s==="gate"&&n.includeGates!==!0?r.gates.push(c):r.ready.push(c)}return r}function ue(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function Se(e,t,n){let o=[a(e)],i=new Set;for(;o.length>0;){let r=o.pop();if(!i.has(r)){i.add(r);for(let c of t.get(r)??[]){if(!v(c.status,n))return!0;o.push(a(c.id))}}}return!1}function Re(e){let t=new Map,n=new Map,o=new Map,i=C(e);for(let r of e){t.set(a(r.id),r);let c=typeof r.parent=="string"?r.parent.trim():"";if(c.length>0){let s=a(c),d=n.get(s)??[];d.push(r),n.set(s,d)}for(let s of i.get(a(r.id))){let d=a(s),w=o.get(d)??[];w.push(r.id),o.set(d,w)}}return{itemsById:t,childrenByParent:n,blockedByReverse:o,blockerIdsByItem:i}}function Te(e,t,n,o){let{itemsById:i,childrenByParent:r,blockedByReverse:c,blockerIdsByItem:s}=Re(t),d=new Set([...ue(n),...n.blocked_statuses]),w=new Set(t.filter(l=>!v(l.status,n)).map(l=>a(l.id))),H=[],$=[],S=[],K=[],F=[],q=0;for(let l of e){if(!d.has(y(l.status,n)))continue;q+=1;let U=N(l,i,n,s).filter(h=>!h.resolved),we=(c.get(a(l.id))??[]).filter(h=>w.has(a(h))).sort((h,xe)=>h.localeCompare(xe)),g={item:l,open_blockers:U,unblocks:we};if(Se(l.id,r,n)){S.push(g);continue}let ve=n.blocked_statuses.has(y(l.status,n));if(U.length===0&&!ve){let h=D(l.type,o);h==="human"?K.push(g):h==="gate"?F.push(g):H.push(g)}else $.push(g)}return{ready:H,blocked:$,containers:S,decisions:K,gates:F,active_count:q,container_count:S.length}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ae1c56b3-148d-502d-9450-e807fdfab4da")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e9b7731d-e6f5-51a8-970b-462c0b728a9c")}catch{}})();function De(e,t){let n=new Map;for(let o of e){let i=o.external?o.id:t.get(o.id.toLowerCase())?.id??o.id;n.set(o.external?`external:${i}`:`local:${i.toLowerCase()}`,{...o,id:i})}return[...n.values()]}async function M(e,t){let n=L.basename(e),o=(await Be(L.dirname(e)).catch(i=>{throw se("Cannot verify the blocker's physical file identity",{exitCode:f.GENERIC_FAILURE,context:{code:"blocker_identity_read_failed",required:"Restore access to the blocker item directory, then retry the item read."},cause:i})})).filter(i=>i.toLowerCase()===n.toLowerCase()).sort((i,r)=>+(r===n)-+(i===n)||i.localeCompare(r)).map(i=>L.parse(i).name)[0];if(o===void 0)throw new u(`Blocker canonical file disappeared during identity verification: ${t}`,f.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker file and validate storage integrity before retrying the item read."});return o}async function nt(e){let t=p(e.metadata);if(t.length===0)return[];let n=new Map([e.metadata.blocked_by,...(e.metadata.dependencies??[]).filter(i=>m(i.kind)==="blocked_by").map(i=>i.id)].filter(i=>typeof i=="string").map(i=>[i.trim().toLowerCase(),i.trim()])),o=new Map;for(let i of t){if(_(i)||!/^(?!\.{1,2}$)[^/\\:\0]+$/u.test(i)||e.metadata.dependencies?.some(s=>s.id.trim()===i&&m(s.kind)==="blocked_by"&&I(s.source_kind)))continue;let r=await x(e.pmRoot,n.get(i),e.settings.id_prefix,e.settings.item_format,e.typeToFolder);if(r===null)continue;let c=await k(r,{schema:e.settings.schema});if(r.id=await M(r.itemPath,r.id),c.document.metadata.id!==r.id)throw new u(`Blocker identity differs from its canonical file: ${r.id}`,f.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker identity and validate storage integrity before retrying the item read."});o.set(i.toLowerCase(),c.document.metadata)}return De(O({blocked_by:e.metadata.blocked_by,dependencies:e.metadata.dependencies,updated_at:e.metadata.updated_at},o,Z(e.settings.schema)),o)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aca1dfc0-e0c9-5554-96e3-bb9b2cdeb7f9")}catch{}})();var me="item_revision_conflict",Ae=10,Ne=/^[0-9a-f]{64}$/u;function b(e,t){return new u(`Invalid expected revision ${JSON.stringify(e)}: ${t}.`,f.USAGE,{code:"expect_hash_invalid",value:e,required:"Pass the 64-character item_hash from pm get <id> --json, optionally as <id>=<item_hash>.",examples:["--expect-hash <item_hash>","--expect-hash pm-a1b2=<item_hash>"]})}function pe(e){let t=typeof e=="string"?e.trim().toLowerCase():"";if(!Ne.test(t))throw b(String(e),"the revision is not a 64-character hexadecimal item_hash");return t}function Oe(e){return(e===void 0?[]:typeof e=="string"?[e]:e).flatMap(t=>{if(typeof t!="string")throw b(String(t),"expected a string");let n=t.split(",").map(o=>o.trim()).filter(o=>o.length>0);if(n.length===0)throw b(t,"the value is empty");return n.map(o=>{let i=o.lastIndexOf("="),r=i===-1?void 0:o.slice(0,i).trim();if(r!==void 0&&r.length===0)throw b(o,"the item id before = is empty");let c=pe(i===-1?o:o.slice(i+1));return r===void 0?{itemHash:c}:{id:r,itemHash:c}})})}async function _e(e,t){let n=await ne(e),o=j(n,Q()).type_to_folder,i=await x(e,t,n.id_prefix,n.item_format,o);if(i){let{document:r}=await k(i,{schema:n.schema});if(r.metadata.id!==await M(i.itemPath,i.id))throw new u(`Item file ${i.id} embeds the id ${r.metadata.id}; no revision can be bound to an item whose identity is in conflict.`,f.CONFLICT,{code:"item_identity_conflict",item_id:i.id,required:`Repair ${i.id}'s identity first (pm validate reports it; pm restore ${i.id} <version> recovers a recorded state), then read its item_hash again.`});return{id:r.metadata.id,document:r}}try{return{id:(await de(e,t,n,o)).id,document:G}}catch{throw await re(e,t,n.id_prefix,o)}}function ge(e){return X(e.cwd??process.cwd(),e.pmRoot)}async function bt(e,t={}){let n=await _e(ge(t),e);return{id:n.id,item_hash:te(n.document)}}async function ye(e,t,n){let o=[];for(let i of t){let r=i.id??n;if(r===void 0||r.trim().length===0)throw new u("A bare expected revision needs an item to bind to.",f.USAGE,{code:"expect_hash_target_required",required:"This command has no single item argument; name each target as --expect-hash <id>=<item_hash>.",examples:["--expect-hash pm-a1b2=<item_hash>"]});o.push({id:(await _e(e,r)).id,itemHash:i.itemHash})}return o}function Le(e){return[...new Set(e.patch.map(t=>{let n=t.path.split("/");return String(n[1]==="metadata"?n[2]:n[1])}))].sort()}async function Me(e,t,n){let o;try{o=await ee(J(e,t),t)}catch{return}let i=-1;for(let s=o.length-1;s>=0;s-=1){let d=o[s];if(d.after_hash===n){i=s+1;break}if(d.before_hash===n){i=s;break}}if(i===-1)return{expected_revision_recorded:!1,changes_since:[],changes_since_omitted:0};let r=o.slice(i),c=r.slice(-Ae);return{expected_revision_recorded:!0,changes_since:c.map(s=>({ts:s.ts,op:s.op,author:s.author,fields:Le(s)})),changes_since_omitted:r.length-c.length}}async function wt(e,t){if(!P(e))return{};let n=await Ie(e,t);return{error_code:me,expected_revision:String(n.context.expected_revision),current_revision:String(n.context.current_revision),details:n.context.details}}function P(e){return ce(e)&&e.context.code===me}function vt(e){let t=e.find(n=>P(n));if(t!==void 0)throw t}function xt(){return new u("--expect-hash cannot guard an invocation an extension override rewrote: which item it writes is not provable.",f.USAGE,{code:"expect_hash_invocation_rewritten",required:"Run the command without the rewriting extension (--no-extensions), or drop --expect-hash.",why:"An extension parser or preflight override changed this invocation's tracker or arguments, and final dispatch, the extension SDK client and the guard do not share one rewritten view."})}async function Ie(e,t){if(!P(e)||e.context.details!==void 0)return e;let n=e.context.item_id,o=e.context.expected_revision;if(typeof n!="string"||typeof o!="string")return e;let i;try{i=await Me(t,n,o)}catch{return e}if(i===void 0)return e;let r={expected_revision_recorded:i.expected_revision_recorded,changes_since:i.changes_since.map(s=>({ts:s.ts,op:s.op,author:s.author,fields:[...s.fields]})),changes_since_omitted:i.changes_since_omitted},c=new u(e.message,e.exitCode,{...e.context,details:r});return c.stack=e.stack,c}async function be(e,t){try{return{result:await ie(e,t),...oe(e)}}catch(n){throw e.pmRoot===void 0?n:await Ie(n,e.pmRoot)}}async function kt(e,t,n={}){return be(await Pe(e,n),t)}async function Pe(e,t={}){let n=ge(t),o=e.map(({id:r,itemHash:c})=>({id:r,itemHash:pe(c)})),i=R();return T(i,n,await ye(n,o)),i}function He(e){return`expect_hash_unchecked:${e}:no_locked_write_reached_this_item`}var he=new Set(z);function $e(e,t={}){let n=e.trim().replace(/\s+/gu,"-"),o=he.has(n)?n:e;if(he.has(o)&&(!ae(o)||o==="deps")&&!W.has(o))throw Ke(o);if((o==="test"||o==="test-all")&&t.background===!0)throw new u(`--expect-hash cannot guard ${o} --background: the worker runs in another process.`,f.USAGE,{code:"expect_hash_background_unsupported",required:`Run ${o} in the foreground to guard its result recording, or drop --expect-hash for a background run.`})}function Ke(e){return new u(`--expect-hash guards item writes, and ${e} is not a mutation.`,f.USAGE,{code:"expect_hash_requires_mutation",required:"Use --expect-hash (MCP/SDK expectHash) only on a command or action that writes items."})}function Fe(e,t){if(t.length===0||typeof e!="object"||e===null||Array.isArray(e))return e;let n=e,o=Array.isArray(n.warnings)?n.warnings:[];return{...n,warnings:[...o,...t.map(He)]}}async function Et(e){let t=e.expectHash;if(t!==void 0&&typeof t!="string"&&!(Array.isArray(t)&&t.every(r=>typeof r=="string")))throw b(JSON.stringify(t)??String(t),"expected a string or an array of strings");let n=Oe(t);if(n.length===0)return e.run();$e(e.action,{background:e.background===!0||e.options?.background===!0});let o=R();T(o,e.pmRoot,await ye(e.pmRoot,n,e.defaultId));let i=await be(o,e.run);return Fe(i.result,i.unchecked)}export{D as a,ke as b,p as c,C as d,fe as e,O as f,Ee as g,Ce as h,Te as i,nt as j,me as k,Ae as l,pe as m,Oe as n,bt as o,ye as p,Me as q,wt as r,P as s,vt as t,xt as u,Ie as v,be as w,kt as x,Pe as y,He as z,$e as A,Ke as B,Et as C};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as de}from"./chunk-HRFGFIYU.js";import{Fb as re,Tc as ae,gb as R,hb as ie,ib as T,jb as oe,td as _,ud as I,xc as se,yb as x,yc as ce,zb as k}from"./chunk-5GWEY4P6.js";import{Fa as j,Ha as V,N as z,Na as X,Ta as J,Vi as ne,W,Wb as m,Xd as Z,gi as te,pd as Q,qe as y,re as v,sf as ee,za as Y}from"./chunk-7ZRCYESH.js";import{A as f,C as u,z as G}from"./chunk-O4ZLEN4T.js";import{readdir as Be}from"node:fs/promises";import L from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a319e7d9-e248-573b-bf1f-35217ce49fd0")}catch{}})();function D(e,t){return(t===void 0?void 0:V(e,t))?.execution_role??Y[e.trim().toLowerCase()]??"agent"}var A="blocked_by",le="blocks",ke=Object.freeze([A,le]),B="no-active-blocker";function a(e){return e.trim().toLowerCase()}function E(e,t){return t?`external:${e}`:`local:${a(e)}`}function p(e){let t=new Map,n=typeof e.blocked_by=="string"?e.blocked_by.trim():"";if(n.length>0&&a(n)!==B){let o=_(n);t.set(E(n,o),o?n:a(n))}for(let o of e.dependencies??[]){let i=typeof o.id=="string"?o.id.trim():"";if(m(o.kind)===A&&i.length>0&&a(i)!==B){let r=_(i)||I(o.source_kind);t.set(E(i,r),r?i:a(i))}}return[...t.values()].sort((o,i)=>o.localeCompare(i))}function C(e){let t=new Map;for(let n of e){let o=a(n.id);o.length!==0&&t.set(o,new Set(p(n)))}for(let n of e){let o=a(n.id);if(o.length!==0)for(let i of n.dependencies??[]){let r=m(i.kind)===le&&typeof i.id=="string"?a(i.id):"";if(r.length===0||r===B)continue;let c=t.get(r)??new Set;c.add(o),t.set(r,c)}}return new Map([...t].map(([n,o])=>[n,[...o].sort((i,r)=>i.localeCompare(r))]))}function fe(e,t){let n=a(e.id);return n.length>0?C(t).get(n)??p(e):p(e)}function N(e,t,n,o){let i=e,r=typeof i.id=="string"?o?.get(a(i.id))??fe(i,[...t.values()]):p(e),c=new Set((e.dependencies??[]).filter(s=>m(s.kind)===A&&I(s.source_kind)&&typeof s.id=="string"&&s.id.trim().length>0).map(s=>E(s.id.trim(),!0)));return r.map(s=>{if(_(s)||c.has(E(s,!0)))return{id:s,title:null,status:null,resolved:!1,external:!0,...typeof e.updated_at=="string"?{blocked_since:e.updated_at}:{},resolver:null};let d=t.get(a(s));return d?{id:s,title:d.title,status:d.status,resolved:v(d.status,n)}:{id:s,title:null,status:null,resolved:!1}})}function O(e,t,n){return N(e,t,n)}function Ee(e,t){let n=new Map(e.map(c=>[a(c.id),c])),o=C(e),i=new Set([...ue(t),...t.blocked_statuses]),r=new Set;for(let c of e){let s=y(c.status,t);i.has(s)&&(t.blocked_statuses.has(s)||N(c,n,t,o).some(d=>!d.resolved))&&r.add(a(c.id))}return r}function Ce(e,t,n={},o){let i=[...e.ready,...e.decisions,...e.gates];n.includeContainers===!0&&i.push(...e.containers.filter(c=>c.open_blockers.length===0&&!t.blocked_statuses.has(y(c.item.status,t))));let r={ready:[],decisions:[],gates:[]};for(let c of i){let s=D(c.item.type,o);s==="human"&&n.includeDecisions!==!0?r.decisions.push(c):s==="gate"&&n.includeGates!==!0?r.gates.push(c):r.ready.push(c)}return r}function ue(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function Se(e,t,n){let o=[a(e)],i=new Set;for(;o.length>0;){let r=o.pop();if(!i.has(r)){i.add(r);for(let c of t.get(r)??[]){if(!v(c.status,n))return!0;o.push(a(c.id))}}}return!1}function Re(e){let t=new Map,n=new Map,o=new Map,i=C(e);for(let r of e){t.set(a(r.id),r);let c=typeof r.parent=="string"?r.parent.trim():"";if(c.length>0){let s=a(c),d=n.get(s)??[];d.push(r),n.set(s,d)}for(let s of i.get(a(r.id))){let d=a(s),w=o.get(d)??[];w.push(r.id),o.set(d,w)}}return{itemsById:t,childrenByParent:n,blockedByReverse:o,blockerIdsByItem:i}}function Te(e,t,n,o){let{itemsById:i,childrenByParent:r,blockedByReverse:c,blockerIdsByItem:s}=Re(t),d=new Set([...ue(n),...n.blocked_statuses]),w=new Set(t.filter(l=>!v(l.status,n)).map(l=>a(l.id))),H=[],$=[],S=[],K=[],F=[],q=0;for(let l of e){if(!d.has(y(l.status,n)))continue;q+=1;let U=N(l,i,n,s).filter(h=>!h.resolved),we=(c.get(a(l.id))??[]).filter(h=>w.has(a(h))).sort((h,xe)=>h.localeCompare(xe)),g={item:l,open_blockers:U,unblocks:we};if(Se(l.id,r,n)){S.push(g);continue}let ve=n.blocked_statuses.has(y(l.status,n));if(U.length===0&&!ve){let h=D(l.type,o);h==="human"?K.push(g):h==="gate"?F.push(g):H.push(g)}else $.push(g)}return{ready:H,blocked:$,containers:S,decisions:K,gates:F,active_count:q,container_count:S.length}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ae1c56b3-148d-502d-9450-e807fdfab4da")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e9b7731d-e6f5-51a8-970b-462c0b728a9c")}catch{}})();function De(e,t){let n=new Map;for(let o of e){let i=o.external?o.id:t.get(o.id.toLowerCase())?.id??o.id;n.set(o.external?`external:${i}`:`local:${i.toLowerCase()}`,{...o,id:i})}return[...n.values()]}async function M(e,t){let n=L.basename(e),o=(await Be(L.dirname(e)).catch(i=>{throw se("Cannot verify the blocker's physical file identity",{exitCode:f.GENERIC_FAILURE,context:{code:"blocker_identity_read_failed",required:"Restore access to the blocker item directory, then retry the item read."},cause:i})})).filter(i=>i.toLowerCase()===n.toLowerCase()).sort((i,r)=>+(r===n)-+(i===n)||i.localeCompare(r)).map(i=>L.parse(i).name)[0];if(o===void 0)throw new u(`Blocker canonical file disappeared during identity verification: ${t}`,f.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker file and validate storage integrity before retrying the item read."});return o}async function nt(e){let t=p(e.metadata);if(t.length===0)return[];let n=new Map([e.metadata.blocked_by,...(e.metadata.dependencies??[]).filter(i=>m(i.kind)==="blocked_by").map(i=>i.id)].filter(i=>typeof i=="string").map(i=>[i.trim().toLowerCase(),i.trim()])),o=new Map;for(let i of t){if(_(i)||!/^(?!\.{1,2}$)[^/\\:\0]+$/u.test(i)||e.metadata.dependencies?.some(s=>s.id.trim()===i&&m(s.kind)==="blocked_by"&&I(s.source_kind)))continue;let r=await x(e.pmRoot,n.get(i),e.settings.id_prefix,e.settings.item_format,e.typeToFolder);if(r===null)continue;let c=await k(r,{schema:e.settings.schema});if(r.id=await M(r.itemPath,r.id),c.document.metadata.id!==r.id)throw new u(`Blocker identity differs from its canonical file: ${r.id}`,f.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker identity and validate storage integrity before retrying the item read."});o.set(i.toLowerCase(),c.document.metadata)}return De(O({blocked_by:e.metadata.blocked_by,dependencies:e.metadata.dependencies,updated_at:e.metadata.updated_at},o,Z(e.settings.schema)),o)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aca1dfc0-e0c9-5554-96e3-bb9b2cdeb7f9")}catch{}})();var me="item_revision_conflict",Ae=10,Ne=/^[0-9a-f]{64}$/u;function b(e,t){return new u(`Invalid expected revision ${JSON.stringify(e)}: ${t}.`,f.USAGE,{code:"expect_hash_invalid",value:e,required:"Pass the 64-character item_hash from pm get <id> --json, optionally as <id>=<item_hash>.",examples:["--expect-hash <item_hash>","--expect-hash pm-a1b2=<item_hash>"]})}function pe(e){let t=typeof e=="string"?e.trim().toLowerCase():"";if(!Ne.test(t))throw b(String(e),"the revision is not a 64-character hexadecimal item_hash");return t}function Oe(e){return(e===void 0?[]:typeof e=="string"?[e]:e).flatMap(t=>{if(typeof t!="string")throw b(String(t),"expected a string");let n=t.split(",").map(o=>o.trim()).filter(o=>o.length>0);if(n.length===0)throw b(t,"the value is empty");return n.map(o=>{let i=o.lastIndexOf("="),r=i===-1?void 0:o.slice(0,i).trim();if(r!==void 0&&r.length===0)throw b(o,"the item id before = is empty");let c=pe(i===-1?o:o.slice(i+1));return r===void 0?{itemHash:c}:{id:r,itemHash:c}})})}async function _e(e,t){let n=await ne(e),o=j(n,Q()).type_to_folder,i=await x(e,t,n.id_prefix,n.item_format,o);if(i){let{document:r}=await k(i,{schema:n.schema});if(r.metadata.id!==await M(i.itemPath,i.id))throw new u(`Item file ${i.id} embeds the id ${r.metadata.id}; no revision can be bound to an item whose identity is in conflict.`,f.CONFLICT,{code:"item_identity_conflict",item_id:i.id,required:`Repair ${i.id}'s identity first (pm validate reports it; pm restore ${i.id} <version> recovers a recorded state), then read its item_hash again.`});return{id:r.metadata.id,document:r}}try{return{id:(await de(e,t,n,o)).id,document:G}}catch{throw await re(e,t,n.id_prefix,o)}}function ge(e){return X(e.cwd??process.cwd(),e.pmRoot)}async function bt(e,t={}){let n=await _e(ge(t),e);return{id:n.id,item_hash:te(n.document)}}async function ye(e,t,n){let o=[];for(let i of t){let r=i.id??n;if(r===void 0||r.trim().length===0)throw new u("A bare expected revision needs an item to bind to.",f.USAGE,{code:"expect_hash_target_required",required:"This command has no single item argument; name each target as --expect-hash <id>=<item_hash>.",examples:["--expect-hash pm-a1b2=<item_hash>"]});o.push({id:(await _e(e,r)).id,itemHash:i.itemHash})}return o}function Le(e){return[...new Set(e.patch.map(t=>{let n=t.path.split("/");return String(n[1]==="metadata"?n[2]:n[1])}))].sort()}async function Me(e,t,n){let o;try{o=await ee(J(e,t),t)}catch{return}let i=-1;for(let s=o.length-1;s>=0;s-=1){let d=o[s];if(d.after_hash===n){i=s+1;break}if(d.before_hash===n){i=s;break}}if(i===-1)return{expected_revision_recorded:!1,changes_since:[],changes_since_omitted:0};let r=o.slice(i),c=r.slice(-Ae);return{expected_revision_recorded:!0,changes_since:c.map(s=>({ts:s.ts,op:s.op,author:s.author,fields:Le(s)})),changes_since_omitted:r.length-c.length}}async function wt(e,t){if(!P(e))return{};let n=await Ie(e,t);return{error_code:me,expected_revision:String(n.context.expected_revision),current_revision:String(n.context.current_revision),details:n.context.details}}function P(e){return ce(e)&&e.context.code===me}function vt(e){let t=e.find(n=>P(n));if(t!==void 0)throw t}function xt(){return new u("--expect-hash cannot guard an invocation an extension override rewrote: which item it writes is not provable.",f.USAGE,{code:"expect_hash_invocation_rewritten",required:"Run the command without the rewriting extension (--no-extensions), or drop --expect-hash.",why:"An extension parser or preflight override changed this invocation's tracker or arguments, and final dispatch, the extension SDK client and the guard do not share one rewritten view."})}async function Ie(e,t){if(!P(e)||e.context.details!==void 0)return e;let n=e.context.item_id,o=e.context.expected_revision;if(typeof n!="string"||typeof o!="string")return e;let i;try{i=await Me(t,n,o)}catch{return e}if(i===void 0)return e;let r={expected_revision_recorded:i.expected_revision_recorded,changes_since:i.changes_since.map(s=>({ts:s.ts,op:s.op,author:s.author,fields:[...s.fields]})),changes_since_omitted:i.changes_since_omitted},c=new u(e.message,e.exitCode,{...e.context,details:r});return c.stack=e.stack,c}async function be(e,t){try{return{result:await ie(e,t),...oe(e)}}catch(n){throw e.pmRoot===void 0?n:await Ie(n,e.pmRoot)}}async function kt(e,t,n={}){return be(await Pe(e,n),t)}async function Pe(e,t={}){let n=ge(t),o=e.map(({id:r,itemHash:c})=>({id:r,itemHash:pe(c)})),i=R();return T(i,n,await ye(n,o)),i}function He(e){return`expect_hash_unchecked:${e}:no_locked_write_reached_this_item`}var he=new Set(z);function $e(e,t={}){let n=e.trim().replace(/\s+/gu,"-"),o=he.has(n)?n:e;if(he.has(o)&&(!ae(o)||o==="deps")&&!W.has(o))throw Ke(o);if((o==="test"||o==="test-all")&&t.background===!0)throw new u(`--expect-hash cannot guard ${o} --background: the worker runs in another process.`,f.USAGE,{code:"expect_hash_background_unsupported",required:`Run ${o} in the foreground to guard its result recording, or drop --expect-hash for a background run.`})}function Ke(e){return new u(`--expect-hash guards item writes, and ${e} is not a mutation.`,f.USAGE,{code:"expect_hash_requires_mutation",required:"Use --expect-hash (MCP/SDK expectHash) only on a command or action that writes items."})}function Fe(e,t){if(t.length===0||typeof e!="object"||e===null||Array.isArray(e))return e;let n=e,o=Array.isArray(n.warnings)?n.warnings:[];return{...n,warnings:[...o,...t.map(He)]}}async function Et(e){let t=e.expectHash;if(t!==void 0&&typeof t!="string"&&!(Array.isArray(t)&&t.every(r=>typeof r=="string")))throw b(JSON.stringify(t)??String(t),"expected a string or an array of strings");let n=Oe(t);if(n.length===0)return e.run();$e(e.action,{background:e.background===!0||e.options?.background===!0});let o=R();T(o,e.pmRoot,await ye(e.pmRoot,n,e.defaultId));let i=await be(o,e.run);return Fe(i.result,i.unchecked)}export{D as a,ke as b,p as c,C as d,fe as e,O as f,Ee as g,Ce as h,Te as i,nt as j,me as k,Ae as l,pe as m,Oe as n,bt as o,ye as p,Me as q,wt as r,P as s,vt as t,xt as u,Ie as v,be as w,kt as x,Pe as y,He as z,$e as A,Ke as B,Et as C};
|
|
2
|
+
//# sourceMappingURL=chunk-FRNMQM45.js.map
|