@unbrained/pm-cli 2026.11.29 → 2026.11.30
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-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-Q6GIFUCW.js → chunk-2SBTXR6C.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PY6A7ULK.js → chunk-3TXEWHQX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-K3MVVDLN.js → chunk-47ZS6RPL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WLZ5KVM2.js → chunk-5PNOVDVO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3TK2YOVB.js → chunk-AOTI76Q6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CV2B4JUB.js → chunk-CCKM5YQM.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JQHLOSSS.js → chunk-DCWGM7CY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LQEB6GSY.js → chunk-FECZV72T.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FRYNDVLN.js → chunk-FR7ULTM4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NLHNB2L3.js → chunk-HXQ3OHQR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JFPCL45G.js → chunk-IGEFPHV7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NRCGGNOE.js → chunk-JPJNJHQW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-R6M5OGJH.js → chunk-KCVSSONY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3E53F7QY.js → chunk-KXTKLDKD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DBASKWBO.js → chunk-NHBG5ET3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CNZOC6JD.js → chunk-NVYDPNQP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3US5T6B2.js → chunk-NZSXWIX7.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-VI3A7UZ2.js → chunk-Q4VZSMUL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RWHS77ME.js → chunk-SJWIPGZW.js} +39 -39
- package/dist/cli-bundle/chunks/{chunk-EYEQC3L2.js → chunk-TX74QJ4W.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WNB62BGK.js → chunk-TY55UX6M.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4EBHZBM2.js → chunk-USBTXMKS.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-VCXQ6A35.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-L7HON3BE.js → chunk-WFYE34TO.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-YPMNXG2C.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ZK4CY24V.js → chunk-YVTALIN3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZSBPE36C.js → chunk-Z7YL2SUM.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KCR4NF2A.js → chunk-ZA5NS3PL.js} +2 -2
- package/dist/cli-bundle/chunks/{field-option-collisions-OZE43TOH.js → field-option-collisions-2F2Z7R7B.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-3WXNNFLP.js → item-revision-UAF6L47R.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-RJECL53Y.js +2 -0
- package/dist/cli-bundle/chunks/{linked-resource-value-list-2655COY2.js → linked-resource-value-list-WXPPYUVQ.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-actor-QOKPDYM4.js → mutation-actor-UK3QNEEB.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-admission-JNJHB3E6.js → mutation-admission-UTDYPFWP.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-YGVUE4YZ.js → register-list-query-DRA3CWHI.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-3JVZQDHH.js → register-mutation-WO74VLEQ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-LCHUHKRA.js → register-operations-CRBKH7WN.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-IJ7M3VUK.js → register-setup-6V6NQB5C.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-7BD7U2BX.js → stage-DYEHGASU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-WJAUHPXD.js → chunk-2UUBS4BG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KLOHZNJ4.js → chunk-4ER3VMST.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BZ3PUUPG.js → chunk-4YBMHMBJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ACTBMSCH.js → chunk-62AMZMR4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LSVRZ4KQ.js → chunk-7G7JIXLL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BPOU2S44.js → chunk-A3DORTXS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NNLENKU7.js → chunk-FM5WQ6ZU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BPBKHY6H.js → chunk-HXM7K6VH.js} +35 -35
- package/dist/cli-bundle/focused-chunks/{chunk-EUDAUT6T.js → chunk-IIVDBAJM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LKTRICZR.js → chunk-IJ3T3W4U.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-S5VG7RFY.js → chunk-L357ZAES.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PPCBCPIZ.js → chunk-LWBZ7UGG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TSZVCALS.js → chunk-M57KDG7I.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2CQFGJQ6.js → chunk-MZNV26XE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-NGHT2LNG.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GTUPHXKR.js → chunk-NJTKGBSK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5NSWNLFE.js → chunk-P55AZPFN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NO5MUY4I.js → chunk-RQYVX2T6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KWKPX36T.js → chunk-SXC3NVZI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QTV6UE2Q.js → chunk-TQQO42C2.js} +5 -5
- package/dist/cli-bundle/focused-chunks/{chunk-S4AC7OMI.js → chunk-U35K7FSE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-42SU4LK3.js → chunk-UQJ4PY2Y.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NZA2LP4Y.js → chunk-WAP3DF4B.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MYWUMVCZ.js → chunk-XR745UGE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{field-option-collisions-HABQYZMQ.js → field-option-collisions-7TG7STO7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-revision-YH5R7YPW.js → item-revision-J7EUGCHR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-transaction-YZ2PUPGM.js → item-transaction-2IC2MLML.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-actor-DJ2VRLKG.js → mutation-actor-LJVF2HVD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-3SECKVKY.js → mutation-admission-SLFAUONA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-FEJT2UCG.js → stage-MWR73LTZ.js} +2 -2
- package/dist/cli-bundle/main.js +3 -3
- 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 +61 -61
- 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/shared/url-credentials.d.ts +4 -2
- package/dist/core/shared/url-credentials.js +1 -1
- package/dist/sdk/context-intent-contracts.js +1 -1
- package/docs/CONFIGURATION.md +22 -3
- package/docs/READ_OUTPUT_CONTRACTS.md +5 -0
- package/docs/SDK.md +19 -3
- 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/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-JV7LREUF.js +0 -3
- package/dist/cli-bundle/chunks/chunk-SV27NNXQ.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-DJ5GAITL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-TX24L7RQ.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as E,T as j,U as G,V as k,W as w,X as $,Y as I,a as le,ba as F,g as P,i as J,o as N,q as U,s as B}from"./chunk-S4AC7OMI.js";import{E as ce,F as ue,H as _,I as de,W as V,fa as Z,o as K,oa as fe,p as X}from"./chunk-NZA2LP4Y.js";import{L as S}from"./chunk-BPBKHY6H.js";import{A as p,z as f}from"./chunk-IRYNVGKH.js";var Fe=new Set(["none","null"]);function bt(e={}){return[{optionKey:"dep",clearFlagKey:"clearDeps",valueFlag:"--dep",clearFlag:"--clear-deps",...e.depDisableFlagKey===void 0?{}:{disableFlagKey:e.depDisableFlagKey}},{optionKey:"comment",clearFlagKey:"clearComments",valueFlag:"--comment",clearFlag:"--clear-comments"},{optionKey:"note",clearFlagKey:"clearNotes",valueFlag:"--note",clearFlag:"--clear-notes"},{optionKey:"learning",clearFlagKey:"clearLearnings",valueFlag:"--learning",clearFlag:"--clear-learnings"},{optionKey:"file",clearFlagKey:"clearFiles",valueFlag:"--file",clearFlag:"--clear-files",...e.fileDisableFlagKey===void 0?{}:{disableFlagKey:e.fileDisableFlagKey}},{optionKey:"test",clearFlagKey:"clearTests",valueFlag:"--test",clearFlag:"--clear-tests",...e.testDisableFlagKey===void 0?{}:{disableFlagKey:e.testDisableFlagKey}},{optionKey:"doc",clearFlagKey:"clearDocs",valueFlag:"--doc",clearFlag:"--clear-docs",...e.docDisableFlagKey===void 0?{}:{disableFlagKey:e.docDisableFlagKey}},{optionKey:"reminder",clearFlagKey:"clearReminders",valueFlag:"--reminder",clearFlag:"--clear-reminders"},{optionKey:"event",clearFlagKey:"clearEvents",valueFlag:"--event",clearFlag:"--clear-events"},{optionKey:"typeOption",clearFlagKey:"clearTypeOptions",valueFlag:"--type-option",clearFlag:"--clear-type-options"}]}function v(e){return e===void 0?!1:Fe.has(e.trim().toLowerCase())}function Mt(e,t,r){if(!v(e))return;let n=r?` ${r}`:"";throw new p(`${t} no longer accepts "none" or "null".${n}`.trim(),f.USAGE)}function kt(e,t,r){if(!e||e.length===0||X(e)||!e.some(i=>v(i)))return;let o=r?` ${r}`:"";throw new p(`${t} no longer accepts "none" or "null".${o}`.trim(),f.USAGE)}function wt(e,t){for(let r of t){let n=e[r.optionKey];if(!Array.isArray(n)||n.length===0)continue;if(!n.every(s=>typeof s=="string"))throw new p(`${r.valueFlag} entries must be strings.`,f.USAGE);if(X(n))continue;let o=n;if(!o.some(s=>v(s)))continue;if(o.filter(s=>!v(s)).length>0)throw new p(`Cannot mix legacy clear token "none"/"null" with concrete ${r.valueFlag} entries. Use ${r.clearFlag} to clear or provide explicit entries.`,f.USAGE);e[r.optionKey]=void 0,e[r.clearFlagKey]=!0,r.disableFlagKey&&(e[r.disableFlagKey]=!1)}return e}var Ke=["close_reason","close-reason"],pe=[{canonical:"tags",aliases:["tags"],optionKey:"tags",metadataKey:"tags"}],me=[{canonical:"deadline",aliases:["deadline"],optionKey:"deadline",metadataKey:"deadline"},{canonical:"estimate",aliases:["estimate","estimated_minutes","estimated-minutes"],optionKey:"estimatedMinutes",metadataKey:"estimated_minutes"},{canonical:"acceptance-criteria",aliases:["acceptance_criteria","acceptance-criteria","ac"],optionKey:"acceptanceCriteria",metadataKey:"acceptance_criteria"},{canonical:"definition-of-ready",aliases:["definition_of_ready","definition-of-ready"],optionKey:"definitionOfReady",metadataKey:"definition_of_ready"},{canonical:"order",aliases:["order","rank"],optionKey:"order",metadataKey:"order"},{canonical:"goal",aliases:["goal"],optionKey:"goal",metadataKey:"goal"},{canonical:"objective",aliases:["objective"],optionKey:"objective",metadataKey:"objective"},{canonical:"value",aliases:["value"],optionKey:"value",metadataKey:"value"},{canonical:"impact",aliases:["impact"],optionKey:"impact",metadataKey:"impact"},{canonical:"outcome",aliases:["outcome"],optionKey:"outcome",metadataKey:"outcome"},{canonical:"why-now",aliases:["why_now","why-now"],optionKey:"whyNow",metadataKey:"why_now"}],De=[...pe,...me],ye=[{canonical:"assignee",aliases:["assignee"],optionKey:"assignee",metadataKey:"assignee"},{canonical:"parent",aliases:["parent"],optionKey:"parent",metadataKey:"parent"},{canonical:"reviewer",aliases:["reviewer"],optionKey:"reviewer",metadataKey:"reviewer"},{canonical:"risk",aliases:["risk"],optionKey:"risk",metadataKey:"risk"},{canonical:"confidence",aliases:["confidence"],optionKey:"confidence",metadataKey:"confidence"},{canonical:"sprint",aliases:["sprint"],optionKey:"sprint",metadataKey:"sprint"},{canonical:"release",aliases:["release"],optionKey:"release",metadataKey:"release"},{canonical:"blocked-by",aliases:["blocked_by","blocked-by"],optionKey:"blockedBy",metadataKey:"blocked_by"},{canonical:"blocked-reason",aliases:["blocked_reason","blocked-reason"],optionKey:"blockedReason",metadataKey:"blocked_reason"},{canonical:"unblock-note",aliases:["unblock_note","unblock-note"],optionKey:"unblockNote",metadataKey:"unblock_note"},{canonical:"reporter",aliases:["reporter"],optionKey:"reporter",metadataKey:"reporter"},{canonical:"severity",aliases:["severity"],optionKey:"severity",metadataKey:"severity"},{canonical:"environment",aliases:["environment"],optionKey:"environment",metadataKey:"environment"},{canonical:"repro-steps",aliases:["repro_steps","repro-steps"],optionKey:"reproSteps",metadataKey:"repro_steps"},{canonical:"resolution",aliases:["resolution"],optionKey:"resolution",metadataKey:"resolution"},{canonical:"expected-result",aliases:["expected_result","expected-result"],optionKey:"expectedResult",metadataKey:"expected_result"},{canonical:"actual-result",aliases:["actual_result","actual-result"],optionKey:"actualResult",metadataKey:"actual_result"},{canonical:"affected-version",aliases:["affected_version","affected-version"],optionKey:"affectedVersion",metadataKey:"affected_version"},{canonical:"fixed-version",aliases:["fixed_version","fixed-version"],optionKey:"fixedVersion",metadataKey:"fixed_version"},{canonical:"component",aliases:["component"],optionKey:"component",metadataKey:"component"},{canonical:"regression",aliases:["regression"],optionKey:"regression",metadataKey:"regression"},{canonical:"customer-impact",aliases:["customer_impact","customer-impact"],optionKey:"customerImpact",metadataKey:"customer_impact"}],ee=[...De,{canonical:"author",aliases:["author"],optionKey:"author",metadataKey:"author"},...ye],Le=[...pe,{canonical:"close-reason",aliases:Ke,optionKey:"closeReason",metadataKey:"close_reason"},...me,...ye],Pe=new Set(["none","null","-"]);function ge(e){return e==="create"?ee:Le}function H(e,t){let r=t.unset;if(r!==void 0&&typeof r!="string"&&!Array.isArray(r))return;let n=[];for(let o of ge(e))o.optionKey==="author"||!Object.hasOwn(t,o.optionKey)||t[o.optionKey]!==null||(Reflect.deleteProperty(t,o.optionKey),n.push(o.canonical));n.length!==0&&(t.unset=[...r===void 0?[]:typeof r=="string"?[r]:r,...n])}function Q(e){return typeof e=="string"&&Pe.has(e.trim().toLowerCase())}function Dt(e,t,r,n){return r?ge(e).flatMap(o=>{let i=t[o.optionKey],a=n[o.metadataKey];return Q(i)&&(Q(a)||Array.isArray(a)&&a.some(Q))?[`literal_sentinel_stored:${o.canonical}:${i.trim()}`]:[]}):[]}function Ue(e,t){return e.flatMap(r=>r.includes(",")&&t(r)?[r]:r.split(","))}function Be(e){let t=new Set,r=new Set;if(!e.raw||e.raw.length===0)return{metadataKeys:t,optionKeys:r};let n=Ue(e.raw,o=>e.resolveDefinition(o.trim().toLowerCase())!==void 0);for(let o of n){let i=o.trim().toLowerCase();if(!i)throw new p("--unset values must not be empty; name each field once, for example --unset parent,release",f.USAGE);if(v(i))throw new p('--unset no longer accepts "none" or "null". Specify concrete field names such as --unset deadline',f.USAGE);let a=e.resolveDefinition(i);if(!a)throw new p(`Unsupported --unset field "${o}". Supported fields: ${e.supportedFields}`,f.USAGE);t.add(a.metadataKey),r.add(a.optionKey)}return{metadataKeys:t,optionKeys:r}}function je(e,t,r){let n=e.trim().toLowerCase();if(!r)return;let o=r.command_to_fields?.get(t)??[];for(let i of o){if(i.allow_unset===!1)continue;let a=new Set;if(typeof i.key=="string"&&i.key.length>0&&a.add(i.key.toLowerCase()),typeof i.metadata_key=="string"&&i.metadata_key.length>0&&a.add(i.metadata_key.toLowerCase()),typeof i.cli_flag=="string"&&i.cli_flag.length>0&&(a.add(i.cli_flag.replaceAll("-","_").toLowerCase()),a.add(i.cli_flag.toLowerCase())),Array.isArray(i.cli_aliases))for(let s of i.cli_aliases)typeof s!="string"||s.length===0||(a.add(s.replaceAll("-","_").toLowerCase()),a.add(s.toLowerCase()));if(a.has(n))return{optionKey:i.key,metadataKey:i.metadata_key}}}var Ge=(()=>{let e=new Map;for(let t of ee)for(let r of t.aliases)e.set(r,{optionKey:t.optionKey,metadataKey:t.metadataKey});return e})(),$e=ee.map(e=>e.canonical).sort((e,t)=>e.localeCompare(t)).join(", ");function Lt(e,t){return Be({raw:e,supportedFields:$e,resolveDefinition:r=>Ge.get(r)??je(r,"create",t)})}var Ve={create:'client.create({ type: "Task", title: "Example", createMode: "progressive" })',update:'client.update(id, { estimatedMinutes: "45", force: false })',append:'client.append(id, "Body text")',reopen:'client.reopen(id, "The work recurred", { expectedResult: "Verified recovery" })'};function x(e,t,r){let n=`${e} ${t} must be ${r}.`;throw new p(n,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",field:t,changed:!1,required:n,examples:[Ve[e]]})}function D(e,t,r){typeof e!="string"&&x(t,r,"a string")}function te(e,t){(e===null||typeof e!="object"||Array.isArray(e))&&x(t,"options","an object")}function Ae(e,t){(e==="append"||e==="update")&&t.id!==void 0&&D(t.id,e,"id"),e==="item-reopen"&&(t.id!==void 0&&D(t.id,"reopen","id"),t.reason!==void 0&&D(t.reason,"reopen","reason"),t.options!==void 0&&He(t.options))}function Wt(e){te(e,"append");for(let t of["body","author","message"])e[t]!==void 0&&D(e[t],"append",t);e.force!==void 0&&typeof e.force!="boolean"&&x("append","force","a boolean")}function He(e){te(e,"reopen");for(let t of F["item-reopen"].optional){let r=e[t];r!==void 0&&(S(Reflect.get(E,t)).type==="boolean"?typeof r!="boolean"&&x("reopen",t,"a boolean"):D(r,"reopen",t))}}function ze(e,t){return e?t?"a string or string array":"a string array":"a string"}function qe(e,t,r,n,o,i){r===void 0||typeof r=="string"&&(!o||i)||n==="priority"&&typeof r=="number"&&Number.isFinite(r)||o&&Array.isArray(r)&&Array.from(r).every(a=>typeof a=="string")||x(e,t,ze(o,i))}function Ye(e,t,r){let n=e==="create"?U:B;for(let{param:o}of[...n,...N,{param:"force"}]){if(S(Reflect.get(E,o)).type!=="boolean")continue;let i=r.find(a=>a.keys.includes(o))?.keys??[o];for(let a of i)t[a]!==void 0&&typeof t[a]!="boolean"&&x(e,a,"a boolean")}}function re(e,t,r=!0,n=!1){let o=e==="create"?j:w;for(let{target:i,keys:a,repeatable:s}of o)if(S(Reflect.get(E,i)).type!=="boolean")for(let u of a){let h=n&&u!==i,A=s===!0&&(i!=="acceptanceCriteria"||h);qe(e,u,t[u],i,A,r||h)}Ye(e,t,o)}function Jt(e,t){te(t,e);let r=ce(t),n=K(r);return n||H(e,r),re(e,r,!1,n),r}import{Option as hr}from"commander";function O(e,t,r){if(typeof r!="string")return;let n=r.trim();n.length!==0&&e.push(t,n)}function y(e,t,r){r===!0&&e.push(t)}function C(e,t,r){if(Array.isArray(r))for(let n of r){if(typeof n!="string")continue;let o=n.trim();o.length!==0&&e.push(t,o)}}function We(e,t){let r=["test",e,"--run","--json","--progress"];return C(r,"--add",t.add),C(r,"--add-json",t.addJson),C(r,"--remove",t.remove),C(r,"--remove-index",Array.isArray(t.removeIndex)?t.removeIndex.map(n=>typeof n=="number"?String(n):n):t.removeIndex),O(r,"--match",t.match),O(r,"--only-index",typeof t.onlyIndex=="number"?String(t.onlyIndex):t.onlyIndex),y(r,"--only-last",t.onlyLast),y(r,"--full-history",t.fullHistory),C(r,"--measure",t.measure),O(r,"--metric-below",t.metricBelow),O(r,"--metric-diff",t.metricDiff),Je(r,t),O(r,"--author",t.author),O(r,"--message",t.message),y(r,"--force",t.force),r}function Je(e,t){O(e,"--timeout",t.timeout),C(e,"--env-set",t.envSet),C(e,"--env-clear",t.envClear),y(e,"--shared-host-safe",t.sharedHostSafe),O(e,"--pm-context",t.pmContext),y(e,"--override-linked-pm-context",t.overrideLinkedPmContext),O(e,"--workspace-context",t.workspaceContext),y(e,"--override-linked-workspace-context",t.overrideLinkedWorkspaceContext),y(e,"--allow-untrusted-linked-tests",t.allowUntrustedLinkedTests),y(e,"--fail-on-context-mismatch",t.failOnContextMismatch),y(e,"--fail-on-skipped",t.failOnSkipped),y(e,"--fail-on-empty-test-run",t.failOnEmptyTestRun),y(e,"--require-assertions-for-pm",t.requireAssertionsForPm),y(e,"--check-context",t.checkContext),y(e,"--full-output",t.fullOutput),y(e,"--auto-pm-context",t.autoPmContext)}function he(e,t){let r=[],n=new Set;for(let o of t.keys){if(!Object.hasOwn(e,o))continue;let i=e[o];if(i!=null){if(typeof i=="string"){r.push(i);continue}if(!Array.isArray(i)||!i.every(a=>typeof a=="string"))return;n.has(i)||(n.add(i),r.push(...i))}}return r.length>0?r.join("; "):void 0}function R(e,t){return e.find(n=>n.target===t)??{target:t,keys:[t]}}function l(e,t){return e[t]===!0?!0:void 0}function T(e,t){return e[t]===!1?!0:void 0}function z(e,t){return t.some(r=>e[r]===!0)?!0:void 0}function ne(e,t){for(let[r,n]of Object.entries(t))r==="__proto__"||r==="constructor"||r==="prototype"||Object.hasOwn(e,r)||(e[r]=n)}function _e(e,t={}){let r=a=>P(e,R(G,a)),n=a=>J(e,R(k,a)),o=r("type");if(t.requireType!==!1&&o===void 0)throw new p("Missing required option --type <value>. Why required: create resolves runtime schema fields/workflow from item type. Retry: add --type <built-in or configured custom type> (example: --type Task).",f.USAGE);let i={title:r("title"),description:r("description"),type:o,template:r("template"),createMode:r("createMode"),defer:n("defer"),deferReason:r("deferReason"),schedulePreset:r("schedulePreset"),status:r("status"),closeReason:r("closeReason"),completedAt:r("completedAt"),priority:r("priority"),tags:r("tags"),addTags:n("addTags"),body:r("body"),deadline:r("deadline"),estimatedMinutes:r("estimatedMinutes"),acceptanceCriteria:he(e,R(k,"acceptanceCriteria")),definitionOfReady:r("definitionOfReady"),order:r("order"),rank:r("rank"),goal:r("goal"),objective:r("objective"),value:r("value"),impact:r("impact"),outcome:r("outcome"),whyNow:r("whyNow"),author:r("author"),message:r("message"),assignee:r("assignee"),parent:r("parent"),inheritFocus:e.inheritFocus,allowMissingParent:z(e,["allowMissingParent","allow_missing_parent"])===!0,allowUnresolvedDeps:z(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,allowDuplicate:l(e,"allowDuplicate")===!0,reviewer:r("reviewer"),risk:r("risk"),confidence:r("confidence"),sprint:r("sprint"),release:r("release"),blockedBy:r("blockedBy"),blockedReason:r("blockedReason"),unblockNote:r("unblockNote"),reporter:r("reporter"),severity:r("severity"),environment:r("environment"),reproSteps:r("reproSteps"),resolution:r("resolution"),expectedResult:r("expectedResult"),actualResult:r("actualResult"),affectedVersion:r("affectedVersion"),fixedVersion:r("fixedVersion"),component:r("component"),regression:e.regression===!0?"true":r("regression"),customerImpact:r("customerImpact"),dep:n("dep"),comment:n("comment"),note:n("note"),learning:n("learning"),file:n("file"),test:n("test"),doc:n("doc"),reminder:n("reminder"),event:n("event"),typeOption:n("typeOption"),field:n("field"),unset:n("unset"),clearDeps:l(e,"clearDeps"),clearComments:l(e,"clearComments"),clearNotes:l(e,"clearNotes"),clearLearnings:l(e,"clearLearnings"),clearFiles:l(e,"clearFiles"),clearTests:l(e,"clearTests"),clearDocs:l(e,"clearDocs"),clearReminders:l(e,"clearReminders"),clearEvents:l(e,"clearEvents"),clearTypeOptions:l(e,"clearTypeOptions")};return ne(i,e),_(e,i)}function Oe(e){let t=o=>P(e,R($,o)),r=o=>J(e,R(I,o)),n={title:t("title"),description:t("description"),body:t("body"),status:t("status"),closeReason:t("closeReason"),priority:t("priority"),type:t("type"),tags:t("tags"),addTags:r("addTags"),removeTags:r("removeTags"),deadline:t("deadline"),estimatedMinutes:t("estimatedMinutes"),acceptanceCriteria:he(e,R(I,"acceptanceCriteria")),addAc:r("addAc"),removeAc:r("removeAc"),definitionOfReady:t("definitionOfReady"),order:t("order"),rank:t("rank"),goal:t("goal"),objective:t("objective"),value:t("value"),impact:t("impact"),outcome:t("outcome"),whyNow:t("whyNow"),author:t("author"),message:t("message"),force:!!e.force,ownershipMetadataBypass:e.ownershipMetadataBypass===!0?!0:void 0,ownershipDependencyBypass:e.ownershipDependencyBypass===!0?!0:void 0,assignee:t("assignee"),parent:t("parent"),allowUnresolvedDeps:z(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,reviewer:t("reviewer"),risk:t("risk"),confidence:t("confidence"),sprint:t("sprint"),release:t("release"),blockedBy:t("blockedBy"),blockedReason:t("blockedReason"),unblockNote:t("unblockNote"),reporter:t("reporter"),severity:t("severity"),environment:t("environment"),reproSteps:t("reproSteps"),resolution:t("resolution"),expectedResult:t("expectedResult"),actualResult:t("actualResult"),affectedVersion:t("affectedVersion"),fixedVersion:t("fixedVersion"),component:t("component"),regression:e.regression===!0?"true":t("regression"),customerImpact:t("customerImpact"),dep:r("dep"),depRemove:r("depRemove"),replaceDeps:l(e,"replaceDeps"),replaceTests:l(e,"replaceTests"),replaceFiles:l(e,"replaceFiles"),replaceDocs:l(e,"replaceDocs"),comment:r("comment"),note:r("note"),learning:r("learning"),file:r("file"),test:r("test"),doc:r("doc"),reminder:r("reminder"),event:r("event"),typeOption:r("typeOption"),field:r("field"),unset:r("unset"),clearDeps:l(e,"clearDeps"),clearComments:l(e,"clearComments"),clearNotes:l(e,"clearNotes"),clearLearnings:l(e,"clearLearnings"),clearFiles:l(e,"clearFiles"),clearTests:l(e,"clearTests"),clearDocs:l(e,"clearDocs"),clearReminders:l(e,"clearReminders"),clearEvents:l(e,"clearEvents"),clearTypeOptions:l(e,"clearTypeOptions")};return ne(n,e),_(e,n)}function d(e,t){let r=R(le,t),n=P(e,r);if(n!==void 0)return n;for(let o of r.keys){let i=e[o];if(Array.isArray(i)){let a=i.filter(s=>typeof s=="string");if(a.length>0)return a.join(",")}if(t==="ids"&&typeof i=="string")return i;if(typeof i=="number"&&Number.isFinite(i))return String(i)}}function Xe(e){let t=l(e,"filterFilesMissing"),r=l(e,"filterDocsMissing");return{filterReviewerMissing:l(e,"filterReviewerMissing"),filterRiskMissing:l(e,"filterRiskMissing"),filterConfidenceMissing:l(e,"filterConfidenceMissing"),filterSprintMissing:l(e,"filterSprintMissing"),filterReleaseMissing:l(e,"filterReleaseMissing"),hasNotes:l(e,"hasNotes"),hasLearnings:l(e,"hasLearnings"),hasFiles:l(e,"hasFiles"),hasDocs:l(e,"hasDocs"),hasTests:l(e,"hasTests"),hasComments:l(e,"hasComments"),hasDeps:l(e,"hasDeps"),hasBody:l(e,"hasBody"),hasLinkedCommand:l(e,"hasLinkedCommand"),noNotes:T(e,"notes"),noLearnings:T(e,"learnings"),noFiles:T(e,"files")??t,filterFilesMissing:t,noDocs:T(e,"docs")??r,filterDocsMissing:r,noTests:T(e,"tests"),noComments:T(e,"comments"),noDeps:T(e,"deps"),emptyBody:l(e,"emptyBody"),noLinkedCommand:T(e,"linkedCommand")}}function Te(e){let t={status:d(e,"status"),type:d(e,"type"),tag:d(e,"tag"),priority:d(e,"priority"),deadlineBefore:d(e,"deadlineBefore"),deadlineAfter:d(e,"deadlineAfter"),updatedAfter:d(e,"updatedAfter"),updatedBefore:d(e,"updatedBefore"),createdAfter:d(e,"createdAfter"),createdBefore:d(e,"createdBefore"),today:l(e,"today"),recent:l(e,"recent"),ids:d(e,"ids"),assignee:d(e,"assignee"),assigneeFilter:d(e,"assigneeFilter"),parent:d(e,"parent"),sprint:d(e,"sprint"),release:d(e,"release"),limit:d(e,"limit"),offset:d(e,"offset"),noTruncate:T(e,"truncate"),includeBody:l(e,"includeBody"),strictRead:l(e,"strictRead"),compact:l(e,"compact"),brief:l(e,"brief"),full:l(e,"full"),fields:d(e,"fields"),sort:d(e,"sort"),order:d(e,"order"),tree:l(e,"tree"),treeDepth:d(e,"treeDepth"),filterAcMissing:l(e,"filterAcMissing"),filterEstimatesMissing:z(e,["filterEstimatesMissing","filterEstimateMissing"]),filterResolutionMissing:l(e,"filterResolutionMissing"),filterMetadataMissing:l(e,"filterMetadataMissing"),...Xe(e)};return ne(t,e),t}var Ze=Symbol("pm.mcp-mutation-transport"),Qe=new Set(["create","update","append"]),W={create:{parameters:U,aliases:j,strings:G,repeatables:k},update:{parameters:B,aliases:w,strings:$,repeatables:I}},et=new Set(["activity","aggregate","context","contracts","deps","files-discover","files-lookup","get","graph","health","history","history-attest","list","next","search","stats","telemetry","validate"]);function L(e){return Ze in e}function Y(e,t){return L(e)?ue(t):_(e,t)}function Ur(e,t,r=[]){let n=_(e,{...e,...t});for(let o of r)Reflect.deleteProperty(n,o);return n}function c(e,t){let r=e[t];return typeof r=="string"&&r.trim().length>0?r:void 0}function m(e,t){let r=e[t];return typeof r=="string"?r.trim().length>0?r:void 0:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function Br(e,t){let r=e[t];return typeof r=="string"?r:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function jr(e,t){if(typeof e=="number"){if(!Number.isInteger(e))throw new p(`${t} must be a finite integer.`,f.USAGE);return e}if(typeof e=="string"&&e.trim().length>0){let r=Number(e);if(!Number.isInteger(r))throw new p(`${t} must be a finite integer.`,f.USAGE);return r}}function Gr(e,t){return typeof e.limit=="number"&&Number.isFinite(e.limit)?e.limit:typeof t.limit=="number"&&Number.isFinite(t.limit)?t.limit:c(e,"limit")??c(t,"limit")}function $r(e){let t=c(e,"outputFormat");return{json:!0,quiet:!0,author:c(e,"author"),path:c(e,"path"),noExtensions:e.noExtensions===!0||e.no_extensions===!0,noPager:!0,outputInclude:c(e,"outputInclude"),outputLimit:m(e,"outputLimit"),outputBudget:m(e,"outputBudget"),outputSession:c(e,"outputSession"),outputCursor:c(e,"outputCursor"),outputFormat:t==="json"||t==="toon"?t:void 0}}var Ee=new Set(["tags","blockedBy","blocked_by","skills","fields"]),ve=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),tt=new Set([...ve].filter(e=>e!=="file")),rt=new Set(["files","files-discover","docs","test","test-all"]),oe=new Set(["comments","notes","learnings"]);function nt(e,t){if(!(!oe.has(e)||!Object.prototype.hasOwnProperty.call(t,"file")))throw new p(`MCP ${e} does not accept options.file. Pass annotation text in options.add instead.`,f.USAGE,{code:"mcp_annotation_file_unavailable",required:"Pass annotation text as JSON data; MCP annotation actions cannot read server-local files."})}var it=new Set(["claim","release","start-task","pause-task","close-task"]),xe={history:["order"],"history-attest":["verify","output","hashAlgorithm"],list:["status","type","tag","priority","limit","offset"],search:["mode","status","type","tag","priority","limit"],create:["title","type","status","description","body","priority","tags","parent","createMode","create_mode","allowMissingParent","allowDuplicate","inheritFocus"],update:["parent","allowMissingParent","completedAt"],copy:["allowDuplicate"],close:["duplicateOf","completedAt","releaseAssignment"],claim:["start","next","ifAvailable","takeoverStale"],"start-task":["takeoverStale"],release:["pause","handoff"],comments:["ifAbsent"],notes:["ifAbsent"],learnings:["ifAbsent"],extension:["dryRun","offline","fields","scope"],package:["dryRun","offline","fields","scope"],install:["dryRun"],upgrade:["scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"],append:["body"]},at=new Set(["context","get","list","next","search","comments","notes","learnings","files","docs","test"]),ot=new Set(["query","keywords","id","text"]);function st(e){return at.has(e)?F[e].optional.filter(t=>!ot.has(t)):[]}var lt=new Set(["claim","start-task","comments","notes","learnings","files","docs","test"]);function ct(e,t){if(!lt.has(e??""))return t;let r={...t};for(let n of F[e].optional){let o=n.replace(/[A-Z]/gu,i=>`_${i.toLowerCase()}`);o===n||r[o]===void 0||(r[n]??=r[o],delete r[o])}return r}function ut(e,t,r){if(!oe.has(e??""))return r;let n=r,o=n.text??t.text;if(o===void 0)return n;if(n.add!==void 0&&n.add!==o){let a=e.replace(/s$/u,"");throw new p(`Specify ${a} text either as text or with add, not both.`,f.USAGE,{code:"annotation_text_source_conflict",field:"text",required:`Pass the ${a} text once: text and add are the same source.`})}let i={...n,add:o};return delete i.text,i}function dt(e,t){let r=t.replace(/[A-Z]/gu,n=>`_${n.toLowerCase()}`);return e[t]!==void 0||e[r]!==void 0}function ft(e){return[...xe[e]??[],...st(e),...be]}var be=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function Me(e,t=""){let r={},n=rt.has(t),o=t==="files"||t==="files-discover"||t==="docs",i=oe.has(t)?tt:ve;for(let[a,s]of Object.entries(e)){if(Array.isArray(s)&&Ee.has(a)){r[a]=s.join(",");continue}if(a==="note"&&o){r[a]=s;continue}if(typeof s=="string"&&i.has(a)){r[a]=[s];continue}if(typeof s=="string"&&n&&(a==="add"||a==="remove")){r[a]=[s];continue}r[a]=s}return Object.assign(r,Object.fromEntries(Object.getOwnPropertySymbols(e).map(a=>[a,Reflect.get(e,a)]))),r}function pt(e,t,r){let n=c(e,"author");return n!==void 0?n:r!==void 0&&it.has(r)?c(e,"assignee")??c(t,"assignee"):void 0}function mt(e,t){return t!==void 0&&e.author===void 0?{...e,author:t}:e}function yt(e,t,r){let n={},o=W[e],i=new Set([...o.parameters.map(({param:a})=>a),...N.map(({param:a})=>a),...xe[e],...be,"force"]);for(let a of i){let s=o.aliases.find(u=>u.keys.includes(a))?.keys??[a];t[a]===void 0||s.some(u=>r[u]!==void 0)||(n[a]=t[a])}return n}function b(e,t){throw new p(`Invalid MCP ${e} value for "${t}". No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:t,required:`Provide valid ${e} field values and an options object; inspect the pm_${e} input schema for supported types.`})}function gt(e,t,r){let n=W[e],o=[...n.parameters,...N,{param:"force"}];for(let{param:i}of o){if(S(E[i]).type!=="boolean")continue;let s=(n.aliases.find(u=>u.keys.includes(i))?.keys??[i]).find(u=>r[u]!==void 0&&typeof r[u]!="boolean");s!==void 0&&b(e,s)}for(let i of["idOnly","fullChangedFields"])t[i]!==void 0&&typeof t[i]!="boolean"&&b(e,i)}function At(e,t,r){t.options!==void 0&&!g(t.options)&&b(e,"options"),gt(e,t,r);for(let a of Ee){let s=r[a];Array.isArray(s)&&s.some(u=>typeof u!="string")&&b(e,a)}let n=Ie(r,e),o=W[e];for(let{keys:a,target:s}of o.strings)a.some(u=>r[u]!==void 0)&&n[s]===void 0&&b(e,s);let i=o.repeatables.flatMap(({keys:a})=>a).find(a=>{let s=r[a];return s!==void 0&&typeof s!="string"&&(!Array.isArray(s)||s.some(u=>typeof u!="string"))});return i!==void 0&&b(e,i),n}function ht(e,t,r,n,o){let i=(t==="create"||t==="update")&&L(e),a={...i?yt(t,e,n):r,...n};if((t==="create"||t==="update")&&!i){let s=g(e.options)&&K(e.options);s||H(t,a),re(t,a,!0,s)}return i?At(t,e,a):o?Me(a,t):a}function _t(e,t){return!Qe.has(e??"")||K(t)?t:fe(t)}function Vr(e,t,{nativeAction:r=!0}={}){Ae(t,e);let n=g(e.options)?e.options:void 0,o=S(e.options),i={},a=A=>{dt(o,A)||e[A]===void 0||(i[A]=e[A])};for(let A of ft(t??""))a(A);t!==void 0&&L(e)&&nt(t,o);let s=ut(t,e,ct(t,ht(e,t,i,o,r)));if(t==="history-attest"&&L(e)&&(s.output!==void 0||typeof s.verify=="string"))throw new p("MCP history attest does not accept server-local proof paths. Export the returned JSON bundle and pass that JSON object as verify.",f.USAGE);let u=L(e)?e:n??e,h=Y(u,mt(s,pt(e,s,t)));return _t(t,h)}function Hr(e){if(e.addNote===void 0)return e;let t={...e};return t.note===void 0&&typeof t.addNote=="string"&&(t.note=t.addNote),delete t.addNote,t}function zr(e){let t={...e};return t.discoveryNote!==void 0&&t.note===void 0&&typeof t.discoveryNote=="string"&&(t.note=t.discoveryNote),delete t.discover,delete t.discoveryNote,t}function Ot(e){let t=[],r=!0;for(let n of e.trim().toLowerCase()){if(n>="a"&&n<="z"||n>="0"&&n<="9"){t.push(n),r=!1;continue}r||(t.push("-"),r=!0)}return t.at(-1)==="-"&&t.pop(),t.join("")}function qr(e){return!et.has(Ot(e))}function Yr(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean).join(" ")}function Tt(e){return Array.isArray(e)?e.map(t=>String(t)).filter(t=>t.length>0):[]}function Wr(e,t){let r=new Set(["action","args","author","cwd","fullChangedFields","id","options","path","query","reason","target"]),n={};for(let[i,a]of Object.entries(e))r.has(i)||(n[i]=a);let o={...n,...t};return delete o.args,delete o.author,o}function Jr(e,t){let r=Y(t??{},{...t});return{changedFields:e.fullChangedFields===!0?"full":"compact",idOnly:e.idOnly===!0,runnerOptions:r}}function ae(e){return{type:m(e,"filterType"),tag:m(e,"filterTag"),priority:m(e,"filterPriority"),deadlineBefore:m(e,"filterDeadlineBefore"),deadlineAfter:m(e,"filterDeadlineAfter"),updatedAfter:m(e,"filterUpdatedAfter"),updatedBefore:m(e,"filterUpdatedBefore"),createdAfter:m(e,"filterCreatedAfter"),createdBefore:m(e,"filterCreatedBefore"),ids:Z(e.ids),assignee:m(e,"filterAssignee"),assigneeFilter:m(e,"filterAssigneeFilter")??m(e,"filterAssignee_filter"),parent:m(e,"filterParent"),sprint:m(e,"filterSprint"),release:m(e,"filterRelease"),limit:m(e,"limit"),offset:m(e,"offset")}}function ie(e){if(typeof e=="string"&&e.trim().length>0)return e;if(Array.isArray(e))return Tt(e)}function q(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&e.trim().length>0)return e}function Xr(e){let t=ie(e.kind),r=ie(e.exemptIsolate),n=ie(e.exemptIsolateType);return{...t===void 0?{}:{kind:t},maxDepth:q(e.maxDepth),limit:q(e.limit),after:c(e,"after"),direction:c(e,"direction"),maxPaths:q(e.maxPaths),sample:q(e.sample),...r===void 0?{}:{exemptIsolate:r},...n===void 0?{}:{exemptIsolateType:n},saveBaseline:e.saveBaseline===!0,rebuild:e.rebuild===!0,clear:e.clear===!0,summary:e.summary===!0,...e.full===!0?{full:!0}:{}}}function ke(e){let t=Te(e);return e.ids!==void 0&&(t.ids=Z(e.ids)),t}function Zr(e){return{status:c(e,"filterStatus"),list:g(e.list)?ke(e.list):ae(e),reason:c(e,"reason"),completedAt:c(e,"completedAt")??c(e,"completed_at"),resolution:c(e,"resolution"),expectedResult:c(e,"expectedResult")??c(e,"expected_result")??c(e,"expected"),actualResult:c(e,"actualResult")??c(e,"actual_result")??c(e,"actual"),validateClose:c(e,"validateClose")??c(e,"validate_close"),author:c(e,"author"),message:c(e,"message"),force:e.force===!0?!0:void 0,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:V(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}var se=new Set(["filterStatus","filterType","filterTag","filterPriority","filterDeadlineBefore","filterDeadlineAfter","filterUpdatedAfter","filterUpdatedBefore","filterCreatedAfter","filterCreatedBefore","filterAssignee","filterAssigneeFilter","filterAssignee_filter","filterParent","filterSprint","filterRelease","ids","list","update","limit","offset","dryRun","dry_run","rollback","checkpoint","noCheckpoint","no_checkpoint"]);function Se(e){let t={};for(let[r,n]of Object.entries(e))se.has(r)||(t[r]=n);return we(t)}function we(e){return Ie(e,"update")}function Ie(e,t){let r=Me(e,t),n=W[t],o=new Set([...n.parameters,...N].filter(({booleanish:i})=>i===!0).map(({param:i})=>i));for(let{keys:i}of n.repeatables)for(let a of i)typeof r[a]=="string"&&(r[a]=[r[a]]);for(let i of n.strings)for(let a of i.keys){let s=r[a];(typeof s=="number"&&Number.isFinite(s)||s===!1&&o.has(a))&&(r[a]=String(s))}return t==="create"?{..._e(r,{requireType:!1})}:Oe(r)}var St=new Map(w.flatMap(({target:e,keys:t})=>t.map(r=>[r,e])));function Ct(e){return e.startsWith("filter")||e==="ids"||e==="limit"||e==="offset"}function Ce(e,t){throw new p(`update-many "${e}" cannot be null. No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:e,required:t})}function Rt(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!se.has(t)))}function Re(e,t,r){if(!e)return;let n=g(t.list)?t.list:{},o=g(t.update)?t.update:void 0,i=Object.keys(t).find(s=>t[s]===null&&(o!==void 0||se.has(s)||Ct(s)))??Object.keys(n).filter(s=>n[s]===null).map(s=>`list.${s}`)[0];i!==void 0&&Ce(i,`"${i}" selects rows or controls the run: omit it or pass a value. To clear an item field, pass null on the field itself${o===void 0?"":" inside update"}.`);let a=o??Rt(t);for(let[s,u]of Object.entries(a)){if(u!==null)continue;let h=St.get(s);h===void 0&&Ce(s,`Pass unset: ["${s}"] to clear a field, or omit "${s}".`),r[h]=null}}var Nt=["author","message"];function Et(e,t){let r=Object.fromEntries(Nt.filter(n=>typeof e[n]=="string"&&t[n]===void 0).map(n=>[n,e[n]]));return e.force===!0&&t.force===void 0&&(r.force=!0),Object.keys(r).length===0?t:_(t,{...t,...r})}function Qr(e,t=!1){if(g(e.list)||g(e.update)){let n=g(e.update)?Et(e,e.update):Se(e),o=Y(e,we(n));return Re(t,e,o),{status:m(e,"filterStatus"),list:g(e.list)?ke(e.list):ae(e),update:de(n,o),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:V(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}let r=Y(e,Se(e));return Re(t,e,r),{status:m(e,"filterStatus"),list:ae(e),update:r,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:V(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}function Ne(e){return"expectHash"in e||"expect_hash"in e}function en(e){if(!Ne(e)&&!(g(e.options)&&Ne(e.options)))return{expectHash:void 0,dispatchArgs:e};let{expectHash:t,expect_hash:r,...n}=e,o=g(n.options)?n.options:{},{expectHash:i,expect_hash:a,...s}=o,u=[t,r,i,a].filter(M=>M!==void 0),h=u.length>1?u.flatMap(M=>Array.isArray(M)?M:[M]):u[0],A=_(e,"options"in n?{...n,options:g(n.options)?_(n.options,s):n.options}:n);return{expectHash:h,dispatchArgs:A}}export{bt as a,v as b,Mt as c,kt as d,wt as e,Ke as f,ee as g,Le as h,Dt as i,Ue as j,Be as k,je as l,Lt as m,D as n,te as o,Wt as p,He as q,Jt as r,We as s,L as t,Ur as u,c as v,m as w,Br as x,g as y,jr as z,Gr as A,$r as B,xe as C,Me as D,Vr as E,Hr as F,zr as G,Ot as H,qr as I,Yr as J,Tt as K,Wr as L,Jr as M,ae as N,Xr as O,Zr as P,se as Q,we as R,Qr as S,en as T};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{S as E,T as j,U as G,V as k,W as w,X as $,Y as I,a as le,ba as F,g as P,i as J,o as N,q as U,s as B}from"./chunk-U35K7FSE.js";import{E as ce,F as ue,H as _,I as de,W as V,fa as Z,o as K,oa as fe,p as X}from"./chunk-WAP3DF4B.js";import{L as S}from"./chunk-HXM7K6VH.js";import{A as p,z as f}from"./chunk-IRYNVGKH.js";var Fe=new Set(["none","null"]);function bt(e={}){return[{optionKey:"dep",clearFlagKey:"clearDeps",valueFlag:"--dep",clearFlag:"--clear-deps",...e.depDisableFlagKey===void 0?{}:{disableFlagKey:e.depDisableFlagKey}},{optionKey:"comment",clearFlagKey:"clearComments",valueFlag:"--comment",clearFlag:"--clear-comments"},{optionKey:"note",clearFlagKey:"clearNotes",valueFlag:"--note",clearFlag:"--clear-notes"},{optionKey:"learning",clearFlagKey:"clearLearnings",valueFlag:"--learning",clearFlag:"--clear-learnings"},{optionKey:"file",clearFlagKey:"clearFiles",valueFlag:"--file",clearFlag:"--clear-files",...e.fileDisableFlagKey===void 0?{}:{disableFlagKey:e.fileDisableFlagKey}},{optionKey:"test",clearFlagKey:"clearTests",valueFlag:"--test",clearFlag:"--clear-tests",...e.testDisableFlagKey===void 0?{}:{disableFlagKey:e.testDisableFlagKey}},{optionKey:"doc",clearFlagKey:"clearDocs",valueFlag:"--doc",clearFlag:"--clear-docs",...e.docDisableFlagKey===void 0?{}:{disableFlagKey:e.docDisableFlagKey}},{optionKey:"reminder",clearFlagKey:"clearReminders",valueFlag:"--reminder",clearFlag:"--clear-reminders"},{optionKey:"event",clearFlagKey:"clearEvents",valueFlag:"--event",clearFlag:"--clear-events"},{optionKey:"typeOption",clearFlagKey:"clearTypeOptions",valueFlag:"--type-option",clearFlag:"--clear-type-options"}]}function v(e){return e===void 0?!1:Fe.has(e.trim().toLowerCase())}function Mt(e,t,r){if(!v(e))return;let n=r?` ${r}`:"";throw new p(`${t} no longer accepts "none" or "null".${n}`.trim(),f.USAGE)}function kt(e,t,r){if(!e||e.length===0||X(e)||!e.some(i=>v(i)))return;let o=r?` ${r}`:"";throw new p(`${t} no longer accepts "none" or "null".${o}`.trim(),f.USAGE)}function wt(e,t){for(let r of t){let n=e[r.optionKey];if(!Array.isArray(n)||n.length===0)continue;if(!n.every(s=>typeof s=="string"))throw new p(`${r.valueFlag} entries must be strings.`,f.USAGE);if(X(n))continue;let o=n;if(!o.some(s=>v(s)))continue;if(o.filter(s=>!v(s)).length>0)throw new p(`Cannot mix legacy clear token "none"/"null" with concrete ${r.valueFlag} entries. Use ${r.clearFlag} to clear or provide explicit entries.`,f.USAGE);e[r.optionKey]=void 0,e[r.clearFlagKey]=!0,r.disableFlagKey&&(e[r.disableFlagKey]=!1)}return e}var Ke=["close_reason","close-reason"],pe=[{canonical:"tags",aliases:["tags"],optionKey:"tags",metadataKey:"tags"}],me=[{canonical:"deadline",aliases:["deadline"],optionKey:"deadline",metadataKey:"deadline"},{canonical:"estimate",aliases:["estimate","estimated_minutes","estimated-minutes"],optionKey:"estimatedMinutes",metadataKey:"estimated_minutes"},{canonical:"acceptance-criteria",aliases:["acceptance_criteria","acceptance-criteria","ac"],optionKey:"acceptanceCriteria",metadataKey:"acceptance_criteria"},{canonical:"definition-of-ready",aliases:["definition_of_ready","definition-of-ready"],optionKey:"definitionOfReady",metadataKey:"definition_of_ready"},{canonical:"order",aliases:["order","rank"],optionKey:"order",metadataKey:"order"},{canonical:"goal",aliases:["goal"],optionKey:"goal",metadataKey:"goal"},{canonical:"objective",aliases:["objective"],optionKey:"objective",metadataKey:"objective"},{canonical:"value",aliases:["value"],optionKey:"value",metadataKey:"value"},{canonical:"impact",aliases:["impact"],optionKey:"impact",metadataKey:"impact"},{canonical:"outcome",aliases:["outcome"],optionKey:"outcome",metadataKey:"outcome"},{canonical:"why-now",aliases:["why_now","why-now"],optionKey:"whyNow",metadataKey:"why_now"}],De=[...pe,...me],ye=[{canonical:"assignee",aliases:["assignee"],optionKey:"assignee",metadataKey:"assignee"},{canonical:"parent",aliases:["parent"],optionKey:"parent",metadataKey:"parent"},{canonical:"reviewer",aliases:["reviewer"],optionKey:"reviewer",metadataKey:"reviewer"},{canonical:"risk",aliases:["risk"],optionKey:"risk",metadataKey:"risk"},{canonical:"confidence",aliases:["confidence"],optionKey:"confidence",metadataKey:"confidence"},{canonical:"sprint",aliases:["sprint"],optionKey:"sprint",metadataKey:"sprint"},{canonical:"release",aliases:["release"],optionKey:"release",metadataKey:"release"},{canonical:"blocked-by",aliases:["blocked_by","blocked-by"],optionKey:"blockedBy",metadataKey:"blocked_by"},{canonical:"blocked-reason",aliases:["blocked_reason","blocked-reason"],optionKey:"blockedReason",metadataKey:"blocked_reason"},{canonical:"unblock-note",aliases:["unblock_note","unblock-note"],optionKey:"unblockNote",metadataKey:"unblock_note"},{canonical:"reporter",aliases:["reporter"],optionKey:"reporter",metadataKey:"reporter"},{canonical:"severity",aliases:["severity"],optionKey:"severity",metadataKey:"severity"},{canonical:"environment",aliases:["environment"],optionKey:"environment",metadataKey:"environment"},{canonical:"repro-steps",aliases:["repro_steps","repro-steps"],optionKey:"reproSteps",metadataKey:"repro_steps"},{canonical:"resolution",aliases:["resolution"],optionKey:"resolution",metadataKey:"resolution"},{canonical:"expected-result",aliases:["expected_result","expected-result"],optionKey:"expectedResult",metadataKey:"expected_result"},{canonical:"actual-result",aliases:["actual_result","actual-result"],optionKey:"actualResult",metadataKey:"actual_result"},{canonical:"affected-version",aliases:["affected_version","affected-version"],optionKey:"affectedVersion",metadataKey:"affected_version"},{canonical:"fixed-version",aliases:["fixed_version","fixed-version"],optionKey:"fixedVersion",metadataKey:"fixed_version"},{canonical:"component",aliases:["component"],optionKey:"component",metadataKey:"component"},{canonical:"regression",aliases:["regression"],optionKey:"regression",metadataKey:"regression"},{canonical:"customer-impact",aliases:["customer_impact","customer-impact"],optionKey:"customerImpact",metadataKey:"customer_impact"}],ee=[...De,{canonical:"author",aliases:["author"],optionKey:"author",metadataKey:"author"},...ye],Le=[...pe,{canonical:"close-reason",aliases:Ke,optionKey:"closeReason",metadataKey:"close_reason"},...me,...ye],Pe=new Set(["none","null","-"]);function ge(e){return e==="create"?ee:Le}function H(e,t){let r=t.unset;if(r!==void 0&&typeof r!="string"&&!Array.isArray(r))return;let n=[];for(let o of ge(e))o.optionKey==="author"||!Object.hasOwn(t,o.optionKey)||t[o.optionKey]!==null||(Reflect.deleteProperty(t,o.optionKey),n.push(o.canonical));n.length!==0&&(t.unset=[...r===void 0?[]:typeof r=="string"?[r]:r,...n])}function Q(e){return typeof e=="string"&&Pe.has(e.trim().toLowerCase())}function Dt(e,t,r,n){return r?ge(e).flatMap(o=>{let i=t[o.optionKey],a=n[o.metadataKey];return Q(i)&&(Q(a)||Array.isArray(a)&&a.some(Q))?[`literal_sentinel_stored:${o.canonical}:${i.trim()}`]:[]}):[]}function Ue(e,t){return e.flatMap(r=>r.includes(",")&&t(r)?[r]:r.split(","))}function Be(e){let t=new Set,r=new Set;if(!e.raw||e.raw.length===0)return{metadataKeys:t,optionKeys:r};let n=Ue(e.raw,o=>e.resolveDefinition(o.trim().toLowerCase())!==void 0);for(let o of n){let i=o.trim().toLowerCase();if(!i)throw new p("--unset values must not be empty; name each field once, for example --unset parent,release",f.USAGE);if(v(i))throw new p('--unset no longer accepts "none" or "null". Specify concrete field names such as --unset deadline',f.USAGE);let a=e.resolveDefinition(i);if(!a)throw new p(`Unsupported --unset field "${o}". Supported fields: ${e.supportedFields}`,f.USAGE);t.add(a.metadataKey),r.add(a.optionKey)}return{metadataKeys:t,optionKeys:r}}function je(e,t,r){let n=e.trim().toLowerCase();if(!r)return;let o=r.command_to_fields?.get(t)??[];for(let i of o){if(i.allow_unset===!1)continue;let a=new Set;if(typeof i.key=="string"&&i.key.length>0&&a.add(i.key.toLowerCase()),typeof i.metadata_key=="string"&&i.metadata_key.length>0&&a.add(i.metadata_key.toLowerCase()),typeof i.cli_flag=="string"&&i.cli_flag.length>0&&(a.add(i.cli_flag.replaceAll("-","_").toLowerCase()),a.add(i.cli_flag.toLowerCase())),Array.isArray(i.cli_aliases))for(let s of i.cli_aliases)typeof s!="string"||s.length===0||(a.add(s.replaceAll("-","_").toLowerCase()),a.add(s.toLowerCase()));if(a.has(n))return{optionKey:i.key,metadataKey:i.metadata_key}}}var Ge=(()=>{let e=new Map;for(let t of ee)for(let r of t.aliases)e.set(r,{optionKey:t.optionKey,metadataKey:t.metadataKey});return e})(),$e=ee.map(e=>e.canonical).sort((e,t)=>e.localeCompare(t)).join(", ");function Lt(e,t){return Be({raw:e,supportedFields:$e,resolveDefinition:r=>Ge.get(r)??je(r,"create",t)})}var Ve={create:'client.create({ type: "Task", title: "Example", createMode: "progressive" })',update:'client.update(id, { estimatedMinutes: "45", force: false })',append:'client.append(id, "Body text")',reopen:'client.reopen(id, "The work recurred", { expectedResult: "Verified recovery" })'};function x(e,t,r){let n=`${e} ${t} must be ${r}.`;throw new p(n,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",field:t,changed:!1,required:n,examples:[Ve[e]]})}function D(e,t,r){typeof e!="string"&&x(t,r,"a string")}function te(e,t){(e===null||typeof e!="object"||Array.isArray(e))&&x(t,"options","an object")}function Ae(e,t){(e==="append"||e==="update")&&t.id!==void 0&&D(t.id,e,"id"),e==="item-reopen"&&(t.id!==void 0&&D(t.id,"reopen","id"),t.reason!==void 0&&D(t.reason,"reopen","reason"),t.options!==void 0&&He(t.options))}function Wt(e){te(e,"append");for(let t of["body","author","message"])e[t]!==void 0&&D(e[t],"append",t);e.force!==void 0&&typeof e.force!="boolean"&&x("append","force","a boolean")}function He(e){te(e,"reopen");for(let t of F["item-reopen"].optional){let r=e[t];r!==void 0&&(S(Reflect.get(E,t)).type==="boolean"?typeof r!="boolean"&&x("reopen",t,"a boolean"):D(r,"reopen",t))}}function ze(e,t){return e?t?"a string or string array":"a string array":"a string"}function qe(e,t,r,n,o,i){r===void 0||typeof r=="string"&&(!o||i)||n==="priority"&&typeof r=="number"&&Number.isFinite(r)||o&&Array.isArray(r)&&Array.from(r).every(a=>typeof a=="string")||x(e,t,ze(o,i))}function Ye(e,t,r){let n=e==="create"?U:B;for(let{param:o}of[...n,...N,{param:"force"}]){if(S(Reflect.get(E,o)).type!=="boolean")continue;let i=r.find(a=>a.keys.includes(o))?.keys??[o];for(let a of i)t[a]!==void 0&&typeof t[a]!="boolean"&&x(e,a,"a boolean")}}function re(e,t,r=!0,n=!1){let o=e==="create"?j:w;for(let{target:i,keys:a,repeatable:s}of o)if(S(Reflect.get(E,i)).type!=="boolean")for(let u of a){let h=n&&u!==i,A=s===!0&&(i!=="acceptanceCriteria"||h);qe(e,u,t[u],i,A,r||h)}Ye(e,t,o)}function Jt(e,t){te(t,e);let r=ce(t),n=K(r);return n||H(e,r),re(e,r,!1,n),r}import{Option as hr}from"commander";function O(e,t,r){if(typeof r!="string")return;let n=r.trim();n.length!==0&&e.push(t,n)}function y(e,t,r){r===!0&&e.push(t)}function C(e,t,r){if(Array.isArray(r))for(let n of r){if(typeof n!="string")continue;let o=n.trim();o.length!==0&&e.push(t,o)}}function We(e,t){let r=["test",e,"--run","--json","--progress"];return C(r,"--add",t.add),C(r,"--add-json",t.addJson),C(r,"--remove",t.remove),C(r,"--remove-index",Array.isArray(t.removeIndex)?t.removeIndex.map(n=>typeof n=="number"?String(n):n):t.removeIndex),O(r,"--match",t.match),O(r,"--only-index",typeof t.onlyIndex=="number"?String(t.onlyIndex):t.onlyIndex),y(r,"--only-last",t.onlyLast),y(r,"--full-history",t.fullHistory),C(r,"--measure",t.measure),O(r,"--metric-below",t.metricBelow),O(r,"--metric-diff",t.metricDiff),Je(r,t),O(r,"--author",t.author),O(r,"--message",t.message),y(r,"--force",t.force),r}function Je(e,t){O(e,"--timeout",t.timeout),C(e,"--env-set",t.envSet),C(e,"--env-clear",t.envClear),y(e,"--shared-host-safe",t.sharedHostSafe),O(e,"--pm-context",t.pmContext),y(e,"--override-linked-pm-context",t.overrideLinkedPmContext),O(e,"--workspace-context",t.workspaceContext),y(e,"--override-linked-workspace-context",t.overrideLinkedWorkspaceContext),y(e,"--allow-untrusted-linked-tests",t.allowUntrustedLinkedTests),y(e,"--fail-on-context-mismatch",t.failOnContextMismatch),y(e,"--fail-on-skipped",t.failOnSkipped),y(e,"--fail-on-empty-test-run",t.failOnEmptyTestRun),y(e,"--require-assertions-for-pm",t.requireAssertionsForPm),y(e,"--check-context",t.checkContext),y(e,"--full-output",t.fullOutput),y(e,"--auto-pm-context",t.autoPmContext)}function he(e,t){let r=[],n=new Set;for(let o of t.keys){if(!Object.hasOwn(e,o))continue;let i=e[o];if(i!=null){if(typeof i=="string"){r.push(i);continue}if(!Array.isArray(i)||!i.every(a=>typeof a=="string"))return;n.has(i)||(n.add(i),r.push(...i))}}return r.length>0?r.join("; "):void 0}function R(e,t){return e.find(n=>n.target===t)??{target:t,keys:[t]}}function l(e,t){return e[t]===!0?!0:void 0}function T(e,t){return e[t]===!1?!0:void 0}function z(e,t){return t.some(r=>e[r]===!0)?!0:void 0}function ne(e,t){for(let[r,n]of Object.entries(t))r==="__proto__"||r==="constructor"||r==="prototype"||Object.hasOwn(e,r)||(e[r]=n)}function _e(e,t={}){let r=a=>P(e,R(G,a)),n=a=>J(e,R(k,a)),o=r("type");if(t.requireType!==!1&&o===void 0)throw new p("Missing required option --type <value>. Why required: create resolves runtime schema fields/workflow from item type. Retry: add --type <built-in or configured custom type> (example: --type Task).",f.USAGE);let i={title:r("title"),description:r("description"),type:o,template:r("template"),createMode:r("createMode"),defer:n("defer"),deferReason:r("deferReason"),schedulePreset:r("schedulePreset"),status:r("status"),closeReason:r("closeReason"),completedAt:r("completedAt"),priority:r("priority"),tags:r("tags"),addTags:n("addTags"),body:r("body"),deadline:r("deadline"),estimatedMinutes:r("estimatedMinutes"),acceptanceCriteria:he(e,R(k,"acceptanceCriteria")),definitionOfReady:r("definitionOfReady"),order:r("order"),rank:r("rank"),goal:r("goal"),objective:r("objective"),value:r("value"),impact:r("impact"),outcome:r("outcome"),whyNow:r("whyNow"),author:r("author"),message:r("message"),assignee:r("assignee"),parent:r("parent"),inheritFocus:e.inheritFocus,allowMissingParent:z(e,["allowMissingParent","allow_missing_parent"])===!0,allowUnresolvedDeps:z(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,allowDuplicate:l(e,"allowDuplicate")===!0,reviewer:r("reviewer"),risk:r("risk"),confidence:r("confidence"),sprint:r("sprint"),release:r("release"),blockedBy:r("blockedBy"),blockedReason:r("blockedReason"),unblockNote:r("unblockNote"),reporter:r("reporter"),severity:r("severity"),environment:r("environment"),reproSteps:r("reproSteps"),resolution:r("resolution"),expectedResult:r("expectedResult"),actualResult:r("actualResult"),affectedVersion:r("affectedVersion"),fixedVersion:r("fixedVersion"),component:r("component"),regression:e.regression===!0?"true":r("regression"),customerImpact:r("customerImpact"),dep:n("dep"),comment:n("comment"),note:n("note"),learning:n("learning"),file:n("file"),test:n("test"),doc:n("doc"),reminder:n("reminder"),event:n("event"),typeOption:n("typeOption"),field:n("field"),unset:n("unset"),clearDeps:l(e,"clearDeps"),clearComments:l(e,"clearComments"),clearNotes:l(e,"clearNotes"),clearLearnings:l(e,"clearLearnings"),clearFiles:l(e,"clearFiles"),clearTests:l(e,"clearTests"),clearDocs:l(e,"clearDocs"),clearReminders:l(e,"clearReminders"),clearEvents:l(e,"clearEvents"),clearTypeOptions:l(e,"clearTypeOptions")};return ne(i,e),_(e,i)}function Oe(e){let t=o=>P(e,R($,o)),r=o=>J(e,R(I,o)),n={title:t("title"),description:t("description"),body:t("body"),status:t("status"),closeReason:t("closeReason"),priority:t("priority"),type:t("type"),tags:t("tags"),addTags:r("addTags"),removeTags:r("removeTags"),deadline:t("deadline"),estimatedMinutes:t("estimatedMinutes"),acceptanceCriteria:he(e,R(I,"acceptanceCriteria")),addAc:r("addAc"),removeAc:r("removeAc"),definitionOfReady:t("definitionOfReady"),order:t("order"),rank:t("rank"),goal:t("goal"),objective:t("objective"),value:t("value"),impact:t("impact"),outcome:t("outcome"),whyNow:t("whyNow"),author:t("author"),message:t("message"),force:!!e.force,ownershipMetadataBypass:e.ownershipMetadataBypass===!0?!0:void 0,ownershipDependencyBypass:e.ownershipDependencyBypass===!0?!0:void 0,assignee:t("assignee"),parent:t("parent"),allowUnresolvedDeps:z(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,reviewer:t("reviewer"),risk:t("risk"),confidence:t("confidence"),sprint:t("sprint"),release:t("release"),blockedBy:t("blockedBy"),blockedReason:t("blockedReason"),unblockNote:t("unblockNote"),reporter:t("reporter"),severity:t("severity"),environment:t("environment"),reproSteps:t("reproSteps"),resolution:t("resolution"),expectedResult:t("expectedResult"),actualResult:t("actualResult"),affectedVersion:t("affectedVersion"),fixedVersion:t("fixedVersion"),component:t("component"),regression:e.regression===!0?"true":t("regression"),customerImpact:t("customerImpact"),dep:r("dep"),depRemove:r("depRemove"),replaceDeps:l(e,"replaceDeps"),replaceTests:l(e,"replaceTests"),replaceFiles:l(e,"replaceFiles"),replaceDocs:l(e,"replaceDocs"),comment:r("comment"),note:r("note"),learning:r("learning"),file:r("file"),test:r("test"),doc:r("doc"),reminder:r("reminder"),event:r("event"),typeOption:r("typeOption"),field:r("field"),unset:r("unset"),clearDeps:l(e,"clearDeps"),clearComments:l(e,"clearComments"),clearNotes:l(e,"clearNotes"),clearLearnings:l(e,"clearLearnings"),clearFiles:l(e,"clearFiles"),clearTests:l(e,"clearTests"),clearDocs:l(e,"clearDocs"),clearReminders:l(e,"clearReminders"),clearEvents:l(e,"clearEvents"),clearTypeOptions:l(e,"clearTypeOptions")};return ne(n,e),_(e,n)}function d(e,t){let r=R(le,t),n=P(e,r);if(n!==void 0)return n;for(let o of r.keys){let i=e[o];if(Array.isArray(i)){let a=i.filter(s=>typeof s=="string");if(a.length>0)return a.join(",")}if(t==="ids"&&typeof i=="string")return i;if(typeof i=="number"&&Number.isFinite(i))return String(i)}}function Xe(e){let t=l(e,"filterFilesMissing"),r=l(e,"filterDocsMissing");return{filterReviewerMissing:l(e,"filterReviewerMissing"),filterRiskMissing:l(e,"filterRiskMissing"),filterConfidenceMissing:l(e,"filterConfidenceMissing"),filterSprintMissing:l(e,"filterSprintMissing"),filterReleaseMissing:l(e,"filterReleaseMissing"),hasNotes:l(e,"hasNotes"),hasLearnings:l(e,"hasLearnings"),hasFiles:l(e,"hasFiles"),hasDocs:l(e,"hasDocs"),hasTests:l(e,"hasTests"),hasComments:l(e,"hasComments"),hasDeps:l(e,"hasDeps"),hasBody:l(e,"hasBody"),hasLinkedCommand:l(e,"hasLinkedCommand"),noNotes:T(e,"notes"),noLearnings:T(e,"learnings"),noFiles:T(e,"files")??t,filterFilesMissing:t,noDocs:T(e,"docs")??r,filterDocsMissing:r,noTests:T(e,"tests"),noComments:T(e,"comments"),noDeps:T(e,"deps"),emptyBody:l(e,"emptyBody"),noLinkedCommand:T(e,"linkedCommand")}}function Te(e){let t={status:d(e,"status"),type:d(e,"type"),tag:d(e,"tag"),priority:d(e,"priority"),deadlineBefore:d(e,"deadlineBefore"),deadlineAfter:d(e,"deadlineAfter"),updatedAfter:d(e,"updatedAfter"),updatedBefore:d(e,"updatedBefore"),createdAfter:d(e,"createdAfter"),createdBefore:d(e,"createdBefore"),today:l(e,"today"),recent:l(e,"recent"),ids:d(e,"ids"),assignee:d(e,"assignee"),assigneeFilter:d(e,"assigneeFilter"),parent:d(e,"parent"),sprint:d(e,"sprint"),release:d(e,"release"),limit:d(e,"limit"),offset:d(e,"offset"),noTruncate:T(e,"truncate"),includeBody:l(e,"includeBody"),strictRead:l(e,"strictRead"),compact:l(e,"compact"),brief:l(e,"brief"),full:l(e,"full"),fields:d(e,"fields"),sort:d(e,"sort"),order:d(e,"order"),tree:l(e,"tree"),treeDepth:d(e,"treeDepth"),filterAcMissing:l(e,"filterAcMissing"),filterEstimatesMissing:z(e,["filterEstimatesMissing","filterEstimateMissing"]),filterResolutionMissing:l(e,"filterResolutionMissing"),filterMetadataMissing:l(e,"filterMetadataMissing"),...Xe(e)};return ne(t,e),t}var Ze=Symbol("pm.mcp-mutation-transport"),Qe=new Set(["create","update","append"]),W={create:{parameters:U,aliases:j,strings:G,repeatables:k},update:{parameters:B,aliases:w,strings:$,repeatables:I}},et=new Set(["activity","aggregate","context","contracts","deps","files-discover","files-lookup","get","graph","health","history","history-attest","list","next","search","stats","telemetry","validate"]);function L(e){return Ze in e}function Y(e,t){return L(e)?ue(t):_(e,t)}function Ur(e,t,r=[]){let n=_(e,{...e,...t});for(let o of r)Reflect.deleteProperty(n,o);return n}function c(e,t){let r=e[t];return typeof r=="string"&&r.trim().length>0?r:void 0}function m(e,t){let r=e[t];return typeof r=="string"?r.trim().length>0?r:void 0:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function Br(e,t){let r=e[t];return typeof r=="string"?r:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function jr(e,t){if(typeof e=="number"){if(!Number.isInteger(e))throw new p(`${t} must be a finite integer.`,f.USAGE);return e}if(typeof e=="string"&&e.trim().length>0){let r=Number(e);if(!Number.isInteger(r))throw new p(`${t} must be a finite integer.`,f.USAGE);return r}}function Gr(e,t){return typeof e.limit=="number"&&Number.isFinite(e.limit)?e.limit:typeof t.limit=="number"&&Number.isFinite(t.limit)?t.limit:c(e,"limit")??c(t,"limit")}function $r(e){let t=c(e,"outputFormat");return{json:!0,quiet:!0,author:c(e,"author"),path:c(e,"path"),noExtensions:e.noExtensions===!0||e.no_extensions===!0,noPager:!0,outputInclude:c(e,"outputInclude"),outputLimit:m(e,"outputLimit"),outputBudget:m(e,"outputBudget"),outputSession:c(e,"outputSession"),outputCursor:c(e,"outputCursor"),outputFormat:t==="json"||t==="toon"?t:void 0}}var Ee=new Set(["tags","blockedBy","blocked_by","skills","fields"]),ve=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),tt=new Set([...ve].filter(e=>e!=="file")),rt=new Set(["files","files-discover","docs","test","test-all"]),oe=new Set(["comments","notes","learnings"]);function nt(e,t){if(!(!oe.has(e)||!Object.prototype.hasOwnProperty.call(t,"file")))throw new p(`MCP ${e} does not accept options.file. Pass annotation text in options.add instead.`,f.USAGE,{code:"mcp_annotation_file_unavailable",required:"Pass annotation text as JSON data; MCP annotation actions cannot read server-local files."})}var it=new Set(["claim","release","start-task","pause-task","close-task"]),xe={history:["order"],"history-attest":["verify","output","hashAlgorithm"],list:["status","type","tag","priority","limit","offset"],search:["mode","status","type","tag","priority","limit"],create:["title","type","status","description","body","priority","tags","parent","createMode","create_mode","allowMissingParent","allowDuplicate","inheritFocus"],update:["parent","allowMissingParent","completedAt"],copy:["allowDuplicate"],close:["duplicateOf","completedAt","releaseAssignment"],claim:["start","next","ifAvailable","takeoverStale"],"start-task":["takeoverStale"],release:["pause","handoff"],comments:["ifAbsent"],notes:["ifAbsent"],learnings:["ifAbsent"],extension:["dryRun","offline","fields","scope"],package:["dryRun","offline","fields","scope"],install:["dryRun"],upgrade:["scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"],append:["body"]},at=new Set(["context","get","list","next","search","comments","notes","learnings","files","docs","test"]),ot=new Set(["query","keywords","id","text"]);function st(e){return at.has(e)?F[e].optional.filter(t=>!ot.has(t)):[]}var lt=new Set(["claim","start-task","comments","notes","learnings","files","docs","test"]);function ct(e,t){if(!lt.has(e??""))return t;let r={...t};for(let n of F[e].optional){let o=n.replace(/[A-Z]/gu,i=>`_${i.toLowerCase()}`);o===n||r[o]===void 0||(r[n]??=r[o],delete r[o])}return r}function ut(e,t,r){if(!oe.has(e??""))return r;let n=r,o=n.text??t.text;if(o===void 0)return n;if(n.add!==void 0&&n.add!==o){let a=e.replace(/s$/u,"");throw new p(`Specify ${a} text either as text or with add, not both.`,f.USAGE,{code:"annotation_text_source_conflict",field:"text",required:`Pass the ${a} text once: text and add are the same source.`})}let i={...n,add:o};return delete i.text,i}function dt(e,t){let r=t.replace(/[A-Z]/gu,n=>`_${n.toLowerCase()}`);return e[t]!==void 0||e[r]!==void 0}function ft(e){return[...xe[e]??[],...st(e),...be]}var be=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function Me(e,t=""){let r={},n=rt.has(t),o=t==="files"||t==="files-discover"||t==="docs",i=oe.has(t)?tt:ve;for(let[a,s]of Object.entries(e)){if(Array.isArray(s)&&Ee.has(a)){r[a]=s.join(",");continue}if(a==="note"&&o){r[a]=s;continue}if(typeof s=="string"&&i.has(a)){r[a]=[s];continue}if(typeof s=="string"&&n&&(a==="add"||a==="remove")){r[a]=[s];continue}r[a]=s}return Object.assign(r,Object.fromEntries(Object.getOwnPropertySymbols(e).map(a=>[a,Reflect.get(e,a)]))),r}function pt(e,t,r){let n=c(e,"author");return n!==void 0?n:r!==void 0&&it.has(r)?c(e,"assignee")??c(t,"assignee"):void 0}function mt(e,t){return t!==void 0&&e.author===void 0?{...e,author:t}:e}function yt(e,t,r){let n={},o=W[e],i=new Set([...o.parameters.map(({param:a})=>a),...N.map(({param:a})=>a),...xe[e],...be,"force"]);for(let a of i){let s=o.aliases.find(u=>u.keys.includes(a))?.keys??[a];t[a]===void 0||s.some(u=>r[u]!==void 0)||(n[a]=t[a])}return n}function b(e,t){throw new p(`Invalid MCP ${e} value for "${t}". No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:t,required:`Provide valid ${e} field values and an options object; inspect the pm_${e} input schema for supported types.`})}function gt(e,t,r){let n=W[e],o=[...n.parameters,...N,{param:"force"}];for(let{param:i}of o){if(S(E[i]).type!=="boolean")continue;let s=(n.aliases.find(u=>u.keys.includes(i))?.keys??[i]).find(u=>r[u]!==void 0&&typeof r[u]!="boolean");s!==void 0&&b(e,s)}for(let i of["idOnly","fullChangedFields"])t[i]!==void 0&&typeof t[i]!="boolean"&&b(e,i)}function At(e,t,r){t.options!==void 0&&!g(t.options)&&b(e,"options"),gt(e,t,r);for(let a of Ee){let s=r[a];Array.isArray(s)&&s.some(u=>typeof u!="string")&&b(e,a)}let n=Ie(r,e),o=W[e];for(let{keys:a,target:s}of o.strings)a.some(u=>r[u]!==void 0)&&n[s]===void 0&&b(e,s);let i=o.repeatables.flatMap(({keys:a})=>a).find(a=>{let s=r[a];return s!==void 0&&typeof s!="string"&&(!Array.isArray(s)||s.some(u=>typeof u!="string"))});return i!==void 0&&b(e,i),n}function ht(e,t,r,n,o){let i=(t==="create"||t==="update")&&L(e),a={...i?yt(t,e,n):r,...n};if((t==="create"||t==="update")&&!i){let s=g(e.options)&&K(e.options);s||H(t,a),re(t,a,!0,s)}return i?At(t,e,a):o?Me(a,t):a}function _t(e,t){return!Qe.has(e??"")||K(t)?t:fe(t)}function Vr(e,t,{nativeAction:r=!0}={}){Ae(t,e);let n=g(e.options)?e.options:void 0,o=S(e.options),i={},a=A=>{dt(o,A)||e[A]===void 0||(i[A]=e[A])};for(let A of ft(t??""))a(A);t!==void 0&&L(e)&&nt(t,o);let s=ut(t,e,ct(t,ht(e,t,i,o,r)));if(t==="history-attest"&&L(e)&&(s.output!==void 0||typeof s.verify=="string"))throw new p("MCP history attest does not accept server-local proof paths. Export the returned JSON bundle and pass that JSON object as verify.",f.USAGE);let u=L(e)?e:n??e,h=Y(u,mt(s,pt(e,s,t)));return _t(t,h)}function Hr(e){if(e.addNote===void 0)return e;let t={...e};return t.note===void 0&&typeof t.addNote=="string"&&(t.note=t.addNote),delete t.addNote,t}function zr(e){let t={...e};return t.discoveryNote!==void 0&&t.note===void 0&&typeof t.discoveryNote=="string"&&(t.note=t.discoveryNote),delete t.discover,delete t.discoveryNote,t}function Ot(e){let t=[],r=!0;for(let n of e.trim().toLowerCase()){if(n>="a"&&n<="z"||n>="0"&&n<="9"){t.push(n),r=!1;continue}r||(t.push("-"),r=!0)}return t.at(-1)==="-"&&t.pop(),t.join("")}function qr(e){return!et.has(Ot(e))}function Yr(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean).join(" ")}function Tt(e){return Array.isArray(e)?e.map(t=>String(t)).filter(t=>t.length>0):[]}function Wr(e,t){let r=new Set(["action","args","author","cwd","fullChangedFields","id","options","path","query","reason","target"]),n={};for(let[i,a]of Object.entries(e))r.has(i)||(n[i]=a);let o={...n,...t};return delete o.args,delete o.author,o}function Jr(e,t){let r=Y(t??{},{...t});return{changedFields:e.fullChangedFields===!0?"full":"compact",idOnly:e.idOnly===!0,runnerOptions:r}}function ae(e){return{type:m(e,"filterType"),tag:m(e,"filterTag"),priority:m(e,"filterPriority"),deadlineBefore:m(e,"filterDeadlineBefore"),deadlineAfter:m(e,"filterDeadlineAfter"),updatedAfter:m(e,"filterUpdatedAfter"),updatedBefore:m(e,"filterUpdatedBefore"),createdAfter:m(e,"filterCreatedAfter"),createdBefore:m(e,"filterCreatedBefore"),ids:Z(e.ids),assignee:m(e,"filterAssignee"),assigneeFilter:m(e,"filterAssigneeFilter")??m(e,"filterAssignee_filter"),parent:m(e,"filterParent"),sprint:m(e,"filterSprint"),release:m(e,"filterRelease"),limit:m(e,"limit"),offset:m(e,"offset")}}function ie(e){if(typeof e=="string"&&e.trim().length>0)return e;if(Array.isArray(e))return Tt(e)}function q(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&e.trim().length>0)return e}function Xr(e){let t=ie(e.kind),r=ie(e.exemptIsolate),n=ie(e.exemptIsolateType);return{...t===void 0?{}:{kind:t},maxDepth:q(e.maxDepth),limit:q(e.limit),after:c(e,"after"),direction:c(e,"direction"),maxPaths:q(e.maxPaths),sample:q(e.sample),...r===void 0?{}:{exemptIsolate:r},...n===void 0?{}:{exemptIsolateType:n},saveBaseline:e.saveBaseline===!0,rebuild:e.rebuild===!0,clear:e.clear===!0,summary:e.summary===!0,...e.full===!0?{full:!0}:{}}}function ke(e){let t=Te(e);return e.ids!==void 0&&(t.ids=Z(e.ids)),t}function Zr(e){return{status:c(e,"filterStatus"),list:g(e.list)?ke(e.list):ae(e),reason:c(e,"reason"),completedAt:c(e,"completedAt")??c(e,"completed_at"),resolution:c(e,"resolution"),expectedResult:c(e,"expectedResult")??c(e,"expected_result")??c(e,"expected"),actualResult:c(e,"actualResult")??c(e,"actual_result")??c(e,"actual"),validateClose:c(e,"validateClose")??c(e,"validate_close"),author:c(e,"author"),message:c(e,"message"),force:e.force===!0?!0:void 0,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:V(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}var se=new Set(["filterStatus","filterType","filterTag","filterPriority","filterDeadlineBefore","filterDeadlineAfter","filterUpdatedAfter","filterUpdatedBefore","filterCreatedAfter","filterCreatedBefore","filterAssignee","filterAssigneeFilter","filterAssignee_filter","filterParent","filterSprint","filterRelease","ids","list","update","limit","offset","dryRun","dry_run","rollback","checkpoint","noCheckpoint","no_checkpoint"]);function Se(e){let t={};for(let[r,n]of Object.entries(e))se.has(r)||(t[r]=n);return we(t)}function we(e){return Ie(e,"update")}function Ie(e,t){let r=Me(e,t),n=W[t],o=new Set([...n.parameters,...N].filter(({booleanish:i})=>i===!0).map(({param:i})=>i));for(let{keys:i}of n.repeatables)for(let a of i)typeof r[a]=="string"&&(r[a]=[r[a]]);for(let i of n.strings)for(let a of i.keys){let s=r[a];(typeof s=="number"&&Number.isFinite(s)||s===!1&&o.has(a))&&(r[a]=String(s))}return t==="create"?{..._e(r,{requireType:!1})}:Oe(r)}var St=new Map(w.flatMap(({target:e,keys:t})=>t.map(r=>[r,e])));function Ct(e){return e.startsWith("filter")||e==="ids"||e==="limit"||e==="offset"}function Ce(e,t){throw new p(`update-many "${e}" cannot be null. No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:e,required:t})}function Rt(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!se.has(t)))}function Re(e,t,r){if(!e)return;let n=g(t.list)?t.list:{},o=g(t.update)?t.update:void 0,i=Object.keys(t).find(s=>t[s]===null&&(o!==void 0||se.has(s)||Ct(s)))??Object.keys(n).filter(s=>n[s]===null).map(s=>`list.${s}`)[0];i!==void 0&&Ce(i,`"${i}" selects rows or controls the run: omit it or pass a value. To clear an item field, pass null on the field itself${o===void 0?"":" inside update"}.`);let a=o??Rt(t);for(let[s,u]of Object.entries(a)){if(u!==null)continue;let h=St.get(s);h===void 0&&Ce(s,`Pass unset: ["${s}"] to clear a field, or omit "${s}".`),r[h]=null}}var Nt=["author","message"];function Et(e,t){let r=Object.fromEntries(Nt.filter(n=>typeof e[n]=="string"&&t[n]===void 0).map(n=>[n,e[n]]));return e.force===!0&&t.force===void 0&&(r.force=!0),Object.keys(r).length===0?t:_(t,{...t,...r})}function Qr(e,t=!1){if(g(e.list)||g(e.update)){let n=g(e.update)?Et(e,e.update):Se(e),o=Y(e,we(n));return Re(t,e,o),{status:m(e,"filterStatus"),list:g(e.list)?ke(e.list):ae(e),update:de(n,o),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:V(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}let r=Y(e,Se(e));return Re(t,e,r),{status:m(e,"filterStatus"),list:ae(e),update:r,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:V(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}function Ne(e){return"expectHash"in e||"expect_hash"in e}function en(e){if(!Ne(e)&&!(g(e.options)&&Ne(e.options)))return{expectHash:void 0,dispatchArgs:e};let{expectHash:t,expect_hash:r,...n}=e,o=g(n.options)?n.options:{},{expectHash:i,expect_hash:a,...s}=o,u=[t,r,i,a].filter(M=>M!==void 0),h=u.length>1?u.flatMap(M=>Array.isArray(M)?M:[M]):u[0],A=_(e,"options"in n?{...n,options:g(n.options)?_(n.options,s):n.options}:n);return{expectHash:h,dispatchArgs:A}}export{bt as a,v as b,Mt as c,kt as d,wt as e,Ke as f,ee as g,Le as h,Dt as i,Ue as j,Be as k,je as l,Lt as m,D as n,te as o,Wt as p,He as q,Jt as r,We as s,L as t,Ur as u,c as v,m as w,Br as x,g as y,jr as z,Gr as A,$r as B,xe as C,Me as D,Vr as E,Hr as F,zr as G,Ot as H,qr as I,Yr as J,Tt as K,Wr as L,Jr as M,ae as N,Xr as O,Zr as P,se as Q,we as R,Qr as S,en as T};
|
|
2
|
+
//# sourceMappingURL=chunk-7G7JIXLL.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{K as Qu,v as te,z as Ms}from"./chunk-LSVRZ4KQ.js";import{a as js,d as Hs,e as om,f as Us,g as sm}from"./chunk-KPASZGBL.js";import{a as ji,b as hr}from"./chunk-IIP6LZ5E.js";import{h as gm,j as ym}from"./chunk-5NSWNLFE.js";import{c as Dt,d as Cn,e as $n,f as Tn,g as cm,j as _m}from"./chunk-EUDAUT6T.js";import{a as am}from"./chunk-XR6MLUVW.js";import{a as hs,c as di,d as li,e as cl,g as dl,h as gs,i as ys,j as vl,k as hn,l as _n,m as kl,n as bl,o as ws}from"./chunk-PPCBCPIZ.js";import{g as lu,h as uu,i as As}from"./chunk-BZ3PUUPG.js";import{a as Ds}from"./chunk-K53OIT5J.js";import{H as iu,I as Ai,J as ou,K as Rs,M as su,N as au,P as cu,Q as du,R as Ii,_ as Ci}from"./chunk-S4AC7OMI.js";import{K as hm}from"./chunk-GTUPHXKR.js";import{A as Ve,B as I,C as Hi,D as dm,E as On,F as zs,G as lm,H as um,I as be,J as _r,K as Ui,L as mm,M as Pn,N as pm,Q as fm,Z as Ws,w as nm,y as im}from"./chunk-MYWUMVCZ.js";import{a as Fs,b as rm}from"./chunk-NO5MUY4I.js";import{$a as Ps,A as ur,Aa as pr,B as pu,C as fu,Ca as $s,D as mr,Ga as Mu,Ha as Fu,Hb as Yu,Ia as ju,Ja as Hu,Ka as Mi,M as hu,Ma as Uu,Na as zu,Oa as Wu,Pa as Kt,Pb as Xu,Qa as qu,Qb as Zu,R as _u,Ra as Rn,Sa as Gu,Ta as Ts,Ua as An,Va as Bu,Wa as Vu,Xa as Ju,Ya as Os,Za as Ku,_a as In,a as il,ab as Ls,b as mn,ba as gu,c as _s,ca as yu,d as ol,da as wu,e as sl,f as pt,g as ui,ga as Oi,h as al,i as Tt,rb as Ns,v as $i,xa as Li,ya as Eu,z as mu,za as Cs}from"./chunk-NZA2LP4Y.js";import{d as fr,f as Fi,m as em,p as tm}from"./chunk-42SU4LK3.js";import{A as Ni,C as Lu,D as _e,E as ge,F as Nu,G as Di,H as ht,I as _t,M as Du,N as gt,a as Ti,c as vu,j as Ru,k as Au,m as Iu,n as Cu,o as Nt,p as $u,q as Tu,u as Ou,v as Pu}from"./chunk-TSZVCALS.js";import{a as re,b as bn,c as ku,d as Is,e as xn,f as Sn,g as En,h as bu,i as xu,l as Be,q as Su,r as T,s as Pi,x as ie}from"./chunk-2CQFGJQ6.js";import{$a as xl,A as Re,Ab as Pt,B as et,Bb as Tl,Bc as We,C as qd,Cb as Ol,Cc as xs,Da as Bt,E as X,Ec as wn,Ed as Zl,Fc as gi,Gc as ft,Gd as Si,H as Gd,Hb as Pl,Hc as ke,Hd as Ql,Ib as Ll,Ic as cr,Id as eu,Jc as Wl,Kb as Nl,Kc as ql,Kd as tu,Lb as Dl,Lc as Gl,M as ci,Ma as fs,Mb as se,Mc as Bl,N as Xd,Nc as Vl,O as us,Oa as un,Oc as yi,P as ms,Pc as Jt,Q as ps,Qa as nt,Qc as wi,S as Zd,Sa as rt,Sd as U,T as Qd,W as el,Wc as Jl,Wd as Y,Xc as dr,Yc as vn,Zc as qe,_d as Ge,a as Ld,ad as kn,ae as nu,ba as nl,bd as vi,be as Ei,cb as ve,cd as Kl,d as Nd,db as vs,dd as ki,e as Dd,eb as pi,fb as ar,fd as Yl,gb as Rl,ge as ru,h as dn,hb as fi,hd as bi,ib as Al,kb as hi,lb as _i,me as Ri,nb as Il,nc as q,oc as Ml,od as Ss,pd as Es,q as zd,qc as Fl,qd as Xl,rb as Cl,rc as jl,sb as $l,sc as ze,t as Wd,tc as Hl,ua as rl,uc as Ul,v as ds,vb as Le,vc as ks,wc as zl,xc as bs,yd as lr,zc as Lt,zd as xi}from"./chunk-BPBKHY6H.js";import{B as yn,C as K,K as El,c as A,d as ls,e as Ce,p as tl,u as $,v as Sl,w as gn,x as Ot,y as Vt}from"./chunk-TX24L7RQ.js";import{e as Vd,f as Jd,g as W,l as sr,n as M,o as tt,p as ai,q as ln,s as Kd,t as mt,v as Yd}from"./chunk-26P6C6OO.js";import{E as Bd,G as ce,I as ll,J as pn,K as fn,L as ul,M as ml,N as pl,O as fl,P as we,T as hl,V as $e,W as _l,X as gl,Z as Te,ba as he,ca as yl,da as mi,fa as wl,i as cs}from"./chunk-JFICNN4T.js";import{A as g,B as or,C as P,D as Qe,E as H,F as B,J as ee,a as ii,d as oi,p as Md,r as Fd,t as jd,v as Hd,w as si,x as Ud,y as $t,z as y}from"./chunk-IRYNVGKH.js";var L=class extends TypeError{constructor(t){super(t),this.name="AssuranceMutationRefusalError"}},Ae=class extends TypeError{context;constructor(t,n={}){super(t),this.name="AssuranceEvaluationRefusalError",this.context=n}},it=class extends TypeError{measurement_id;source_kind;field;check;constructor(t,n){super(t),this.name="AssuranceSourceResolutionError",this.measurement_id=n.measurement_id,this.source_kind=n.source_kind,this.field=n.field,this.check=n.check}};async function Ln(e){try{return await e()}catch(t){throw t instanceof L?new g(t.message,y.USAGE,{code:"invalid_argument_value",reason:"assurance_mutation_refused"}):t}}async function qs(e){try{return await e()}catch(t){throw t instanceof Ae?new g(t.message,y.USAGE,{code:"invalid_argument_value",reason:"assurance_evaluation_refused",...t.context}):t}}import{createHash as pv}from"node:crypto";import fv from"node:path";var vm=1,Yt=["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"],Gs=["items","dependency_kind","prose_edge_gap","graph","validate","health","history","links","provider","derived"],hv=["ceiling","floor","equals","zero","monotone_nondecreasing","monotone_nonincreasing","subset_of"],_v=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,zi=30,Wi=5e3,km=4,gv=50;function yt(e,t){if(!_v.test(e))throw new L(`${t} must be a stable lowercase id`)}function yv(e,t){if(!Number.isFinite(e)||e<0)throw new L(`${t} must be a finite non-negative number`)}function yr(e){let t=hv.filter(i=>e[i]!==void 0);if(t.length!==1)throw new L(`assertion ${e.id} must declare exactly one polarity`);let n=t[0],r=e[n];return{polarity:n,value:n==="zero"?0:r}}function Vs(e,t){return A(e)===A(t)}function bm(e,t){if(t.polarity==="equals")return Vs(e,t.value);if(t.polarity==="subset_of"){if(!Array.isArray(e)||!Array.isArray(t.value))return!1;let r=t.value;return e.every(i=>r.includes(i))}if(typeof e!="number")return!1;let n=t.value;return t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?e<=n:t.polarity==="floor"||t.polarity==="monotone_nondecreasing"?e>=n:e===0}function xm(e){let t=yr(e),n=e.negative_control.cases;return n.some(r=>r.expected==="pass")&&n.some(r=>r.expected==="fail")&&n.every(r=>bm(r.observed,t)===(r.expected==="pass"))}function wv(e,t){if(e.polarity!==t.polarity)return!0;if(typeof e.value=="number"&&typeof t.value=="number")return e.polarity==="ceiling"||e.polarity==="monotone_nonincreasing"?t.value>e.value:e.polarity==="floor"||e.polarity==="monotone_nondecreasing"?t.value<e.value:t.value!==e.value;if(e.polarity==="subset_of"){let n=e.value,r=t.value;return!Array.isArray(n)||!Array.isArray(r)||r.some(i=>!n.includes(i))}return!Vs(e.value,t.value)}function vv(e,t){if(e.measurement_id!==t.measurement_id||e.owner_item_id!==t.owner_item_id||A(e.scope)!==A(t.scope))return!0;let n={observe:0,warn:1,block:2},r=(e.lifetime??"hold")==="hold"&&(t.lifetime??"hold")==="retire";return wv(yr(e),yr(t))||n[t.enforcement]<n[e.enforcement]||r}function kv(e){if(e.state!==void 0&&!(e.state==="present"||e.state==="missing"))throw new L("items source state must be present or missing");let t=Object.hasOwn(e,"equals"),n=e.state!==void 0,r=Number(t)+Number(n);if(e.field!==void 0&&r!==1)throw new L("items source with field requires exactly one of equals or state");if(e.field===void 0&&r!==0)throw new L("items source equals/state requires field")}function bv(e){if(typeof e.dependency_kind!="string"||e.dependency_kind.trim().length===0)throw new L("dependency_kind source requires dependency_kind");if([e.source_kind,e.source_kind_prefix,e.source_kind_state].filter(n=>n!==void 0).length>1)throw new L("dependency_kind source accepts at most one source_kind predicate");if(e.source_kind!==void 0&&e.source_kind.trim().length===0||e.source_kind_prefix!==void 0&&e.source_kind_prefix.trim().length===0)throw new L("dependency_kind source provenance values must not be empty");if(e.source_kind_state!==void 0&&e.source_kind_state!=="present"&&e.source_kind_state!=="missing")throw new L("dependency_kind source source_kind_state must be present or missing")}function xv(e){if(e.sample_limit!==void 0&&(!Number.isInteger(e.sample_limit)||e.sample_limit<1))throw new L("prose_edge_gap sample_limit must be a positive integer");for(let t of e.exemptions??[]){if(typeof t.holder_id!="string"||t.holder_id.trim().length===0||typeof t.reason!="string"||t.reason.trim().length===0)throw new L("prose_edge_gap exemptions require holder_id and reason");if(t.target_id!==void 0&&t.target_id.trim().length===0||t.text_contains!==void 0&&t.text_contains.trim().length===0)throw new L("prose_edge_gap exemption selectors must not be empty")}}function Js(e){yt(e.id,"measurement.id"),e.max_cost!==void 0&&yv(e.max_cost,"measurement.max_cost");let t=e.source;if(Object.prototype.toString.call(t)!=="[object Object]")throw new L(`measurement.source.kind must be one of ${Gs.join(", ")}`);let n=Reflect.get(t,"kind");if(!Gs.includes(n))throw new L(`measurement.source.kind must be one of ${Gs.join(", ")}`);let r=t;if(r.kind==="items"&&kv(r),r.kind==="dependency_kind"&&bv(r),r.kind==="prose_edge_gap"&&xv(r),(r.kind==="graph"||r.kind==="validate"||r.kind==="health")&&(typeof r.field!="string"||r.field.trim().length===0))throw new L(`${r.kind} source requires field`);return r.kind==="provider"&&(yt(r.provider,"provider source provider"),yt(r.key,"provider source key")),e}function Ks(e){if(yt(e.id,"assertion.id"),yt(e.measurement_id,"assertion.measurement_id"),typeof e.owner_item_id!="string"||e.owner_item_id.trim().length===0)throw new L("assertion.owner_item_id is required");let t=yr(e);if(typeof t.value=="number"&&!Number.isFinite(t.value))throw new L(`assertion.${t.polarity} must be a finite number`);if(e.lifetime==="retire"&&(typeof e.retire_reason!="string"||e.retire_reason.trim().length===0))throw new L("retired assertion requires retire_reason");e.scope.kind==="filter"&&yt(e.scope.measurement_id,"assertion.scope.measurement_id");let n=e.negative_control?.cases;if(!Array.isArray(n)||!n.some(r=>r.expected==="pass")||!n.some(r=>r.expected==="fail"))throw new L("assertion negative control requires pass and fail cases");if(!xm(e))throw new L(`assertion ${e.id} negative control does not prove its bound`);return e}function Sv(e){if(!Array.isArray(e.allowed_providers))throw new L("gate provider_policy.allowed_providers must be an array");for(let t of e.allowed_providers)yt(t,"gate.provider_policy.allowed_provider");if(typeof e.triggers!="object"||e.triggers===null||Array.isArray(e.triggers))throw new L("gate provider_policy.triggers must be an object");for(let[t,n]of Object.entries(e.triggers)){if(!Yt.includes(t))throw new L(`gate provider policy has unknown trigger ${t}`);if(typeof n!="object"||n===null||!["low","medium","high"].includes(n.max_cost_class)||typeof n.allow_network!="boolean")throw new L(`gate provider policy trigger ${t} is invalid`)}}function Sm(e){if(yt(e.id,"gate.id"),!Array.isArray(e.assertion_ids))throw new L("gate.assertion_ids is required and must be an array");if(e.assertion_ids.length===0)throw new L("gate requires at least one assertion");for(let t of e.assertion_ids)yt(t,"gate.assertion_id");if(!Array.isArray(e.triggers))throw new L(`gate.triggers is required and must be an array of ${Yt.join(", ")}`);if(e.triggers.length===0)throw new L("gate requires at least one trigger");for(let t of e.triggers)if(!Yt.includes(t))throw new L(`gate trigger must be one of ${Yt.join(", ")}`);return e.provider_policy&&Sv(e.provider_policy),e}function Nn(e){if(e.version!==vm)throw new L(`unsupported assurance document version ${String(e.version)}`);let t=new Set;for(let r of e.measurements){if(Js(r),t.has(`measurement:${r.id}`))throw new L(`duplicate measurement ${r.id}`);t.add(`measurement:${r.id}`)}for(let r of e.assertions){if(Ks(r),t.has(`assertion:${r.id}`))throw new L(`duplicate assertion ${r.id}`);t.add(`assertion:${r.id}`)}for(let r of e.gates){Sm(r);let i=r.assertion_ids.filter(o=>!e.assertions.some(s=>s.id===o));if(i.length>0)throw new L(`gate ${r.id} references missing assertions: ${i.join(", ")}`);if(t.has(`gate:${r.id}`))throw new L(`duplicate gate ${r.id}`);t.add(`gate:${r.id}`)}let n=new Set(e.measurements.map(r=>r.id));for(let[r,i]of Em(e))if(!n.has(r))throw new L(`${i.join(", ")} references missing measurement ${r}`);return e}function Ys(e,t){if("measurement"in e){t.push(e.measurement);return}if("operator"in e)for(let n of e.operands)Ys(n,t)}function Em(e){let t=new Map,n=(r,i)=>{let o=t.get(r)??[];o.push(i),t.set(r,o)};for(let r of e.assertions)n(r.measurement_id,`assertion ${r.id}`),r.scope.kind==="filter"&&n(r.scope.measurement_id,`assertion ${r.id} scope`);for(let r of e.measurements){if(r.source.kind!=="derived")continue;let i=[];Ys(r.source.expression,i);for(let o of i)n(o,`derived measurement ${r.id}`)}return t}function Ev(e,t){let n=e.assertion_ids.flatMap(o=>{let s=t.assertions.find(a=>a.id===o);return[s.measurement_id,...s.scope.kind==="filter"?[s.scope.measurement_id]:[]]}),r=new Set,i=new Set;for(;n.length>0;){let o=n.pop();if(r.has(o))continue;r.add(o);let s=t.measurements.find(a=>a.id===o);s.source.kind==="provider"?i.add(s.source.provider):s.source.kind==="derived"&&Ys(s.source.expression,n)}return i}function wr(){return{version:vm,measurements:[],assertions:[],gates:[]}}function Rv(e,t){let n=t.items.filter(r=>(e.statuses===void 0||e.statuses.includes(r.status))&&(e.types===void 0||e.types.includes(r.type))&&(e.tags===void 0||e.tags.every(i=>r.tags?.includes(i)))&&(e.field===void 0||(()=>{let i=r[e.field];if(e.state!==void 0){let o=i==null||i===""||Array.isArray(i)&&i.length===0;return e.state==="missing"?o:!o}return Vs(i,e.equals)})()));return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function Av(e,t){return e.source_kind!==void 0?t?.toLowerCase()===e.source_kind.trim().toLowerCase():e.source_kind_prefix!==void 0?t?.toLowerCase().startsWith(e.source_kind_prefix.trim().toLowerCase())===!0:e.source_kind_state==="present"?t!==void 0&&t.length>0:e.source_kind_state==="missing"?t===void 0||t.length===0:!0}function Iv(e,t){let n=[],r=ds(e.dependency_kind)??e.dependency_kind.trim().toLowerCase();for(let i of t.items)for(let o of i.dependencies??[]){let s=ds(o.kind)??o.kind.trim().toLowerCase(),a=o.source_kind?.trim();s===r&&Av(e,a)&&n.push(`${i.id}->${o.id}${a?`@${a}`:""}`)}return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n}}function Cv(e){let t=[e.description,e.body].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean);for(let n of["comments","notes","learnings"]){let r=e[n];if(Array.isArray(r)){for(let i of r)if(typeof i=="string")t.push(i);else if(typeof i=="object"&&i!==null){let o=Reflect.get(i,"text");typeof o=="string"&&t.push(o)}}}return t}function $v(e,t,n,r){return e.some(i=>i.holder_id.trim().toLowerCase()===t.toLowerCase()&&(i.target_id===void 0||i.target_id.trim().toLowerCase()===n.toLowerCase())&&(i.text_contains===void 0||r.toLowerCase().includes(i.text_contains.trim().toLowerCase())))}function Bs(e,t){return[e.toLowerCase(),t.toLowerCase()].sort().join("\0")}function Tv(e){let t=new Map,n=new Set,r=[],i=/(?<![\w-])[a-z0-9]+(?:-+[a-z0-9]+)+(?![\w-])/giu,o=0;for(let s of e){t.set(s.id.toLowerCase(),s.id);for(let a of s.dependencies??[])n.add(Bs(s.id,a.id));for(let a of[s.parent,s.blocked_by])typeof a=="string"&&n.add(Bs(s.id,a));for(let a of Cv(s)){let c=[...a.matchAll(i)].map(d=>d[0]);o+=c.length,r.push({holder_id:s.id,segment:a,mentioned_ids:c})}}return{canonical_ids:t,linked_pairs:n,prose_mentions:r,mention_count:o}}function Ov(e,t){let n=Tv(t.items),r=new Map;for(let s of n.prose_mentions){let a=s.mentioned_ids.map(d=>n.canonical_ids.get(d.toLowerCase())).filter(d=>d!==void 0&&d!==s.holder_id),c=[...new Set(a)];for(let d of c){let l=Bs(s.holder_id,d);if(n.linked_pairs.has(l)||$v(e.exemptions??[],s.holder_id,d,s.segment))continue;let u=c.some(m=>m!==d);r.get(l)?.explicit===!0&&!u||r.set(l,{contributor:`${s.holder_id}->${d}|subject=${u?"explicit":"implicit"}`,explicit:u})}}let i=[...r.values()],o=i.map(s=>s.contributor).sort();return{value:o.length,population_size:n.canonical_ids.size,cost:t.items.length+n.linked_pairs.size+n.mention_count,contributors:o.slice(0,e.sample_limit??25),partitions:{explicit_subject:i.filter(s=>s.explicit).length,implicit_subject:i.filter(s=>!s.explicit).length}}}function Pv(e,t){return{value:t.history.filter(r=>(e.op===void 0||r.op===e.op)&&(e.author===void 0||r.author===e.author)&&(e.harness===void 0||r.agent_harness===e.harness)&&(e.model===void 0||r.agent_model===e.model)).length,population_size:t.history.length,cost:t.history.length}}function Lv(e,t){let n=t.items.filter(r=>{let i=r[e.link],o=Array.isArray(i)&&i.length>0;return e.state==="present"?o:!o});return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function Nv(e,t){let n=e.source;return n.kind==="items"?Rv(n,t):n.kind==="dependency_kind"?Iv(n,t):n.kind==="prose_edge_gap"?Ov(n,t):n.kind==="history"?Pv(n,t):n.kind==="links"?Lv(n,t):null}function Rm(e,t){return e.reduce((n,r)=>({units:n.units+r.units,items_scanned:n.items_scanned+r.items_scanned,history_entries:n.history_entries+r.history_entries,provider_calls:n.provider_calls+r.provider_calls,duration_ms:t}),{units:0,items_scanned:0,history_entries:0,provider_calls:0,duration_ms:t})}function Dv(e,t){if(t.length===0)throw new TypeError(`derived ${e} requires operands`);if(e==="add")return t.reduce((n,r)=>n+r,0);if(e==="subtract")return t.slice(1).reduce((n,r)=>n-r,t[0]);if(e==="multiply")return t.reduce((n,r)=>n*r,1);if(e==="divide"){if(t.slice(1).includes(0))throw new TypeError("derived divide cannot divide by zero");return t.slice(1).reduce((n,r)=>n/r,t[0])}return e==="min"?Math.min(...t):Math.max(...t)}async function Am(e,t,n){let r=new Array(e.length),i=0,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let s=i;i+=1,r[s]=await n(e[s],s)}});return await Promise.all(o),r}async function Im(e,t,n,r,i){if("literal"in e)return{value:e.literal,costs:[],population_size:0,contributors:[]};if("measurement"in e){let s=n.find(d=>d.id===e.measurement);if(!s)throw new TypeError(`derived measurement references missing ${e.measurement}`);let a=await Cm(s,t,n,r,i);if(typeof a.value!="number")throw new TypeError(`derived measurement ${s.id} is not numeric`);let c=i.charged.has(s.id)?[]:[a.cost];return i.charged.add(s.id),{value:a.value,costs:c,population_size:a.population_size,contributors:a.contributors}}let o=await Am(e.operands,km,s=>Im(s,t,n,r,i));return{value:Dv(e.operator,o.map(s=>s.value)),costs:o.flatMap(s=>s.costs),population_size:Math.max(0,...o.map(s=>s.population_size)),contributors:[...new Set(o.flatMap(s=>s.contributors))]}}async function Mv(e,t,n,r,i){Js(e);let o=Date.now(),s,a=[],c=0;if(e.source.kind==="derived"){let u=await Im(e.source.expression,t,n,[...r,e.id],i);s={value:u.value,population_size:u.population_size,cost:0,contributors:u.contributors},a=u.costs}else{let u=Nv(e,t);u!==null?s=u:(s=await t.external(e.source),c=1)}let d={units:s.cost,items_scanned:e.source.kind==="items"||e.source.kind==="dependency_kind"||e.source.kind==="prose_edge_gap"||e.source.kind==="links"?t.items.length:0,history_entries:e.source.kind==="history"?t.history.length:0,provider_calls:c,duration_ms:Date.now()-o},l=Rm([...a,d],Date.now()-o);if(e.max_cost!==void 0&&l.units>e.max_cost)throw new Ae(`measurement ${e.id} exceeded cost ceiling ${e.max_cost} with ${l.units}`);return{id:e.id,definition_fingerprint:`sha256:${pv("sha256").update(A(e)).digest("hex")}`,value:s.value,population_size:s.population_size,cost:l,contributors:s.contributors??[],...s.partitions?{partitions:s.partitions}:{}}}function Cm(e,t,n,r,i){if(r.includes(e.id))throw new TypeError(`derived measurement cycle: ${[...r,e.id].join(" -> ")}`);let o=i.cache.get(e.id);if(o)return o;let s=Mv(e,t,n,r,i).catch(a=>{if(a instanceof it&&a.measurement_id===void 0){let c={measurement_id:e.id,source_kind:a.source_kind,field:a.field,...a.check?{check:a.check}:{}},d=new it(a.message,c);throw d.cause=a,d}throw a});return i.cache.set(e.id,s),s}async function Xs(e,t,n=[e]){return Cm(e,t,n,[],{cache:new Map,charged:new Set})}function Fv(e,t){return typeof e!="number"||typeof t.value!="number"?null:t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?t.value-e:(t.polarity==="floor"||t.polarity==="monotone_nondecreasing",e-t.value)}function jv(e,t,n={}){Ks(e);let r=yr(e),i=e.lifetime==="retire"&&n.owner_terminal===!0;return{assertion_id:e.id,measurement_id:e.measurement_id,measurement_definition_fingerprint:t.definition_fingerprint,scope:e.scope,population_size:t.population_size,observed:t.value,bound:r,distance:Fv(t.value,r),verdict:i?"retired":bm(t.value,r)?"pass":"fail",enforcement:e.enforcement,negative_control_proven:xm(e),cost:t.cost,contributors:t.contributors,...t.partitions?{partitions:t.partitions}:{}}}function Hv(e,t,n,r){let i=Ev(e,t);if(i.size===0)return;let o=e.provider_policy,s=o?.triggers[r];if(!o||!s)throw new Ae(`assurance gate ${e.id} refuses provider execution at trigger ${r} without an explicit provider policy`);let a=new Set(o.allowed_providers),c={low:0,medium:1,high:2};for(let d of i){if(!a.has(d))throw new Ae(`assurance gate ${e.id} refuses provider ${d}`);let l=n.provider_capabilities?.[d];if(!l)throw new Ae(`assurance provider ${d} has no declared capabilities`);if(c[l.cost_class]>c[s.max_cost_class])throw new Ae(`assurance gate ${e.id} refuses ${l.cost_class}-cost provider ${d} at trigger ${r}`);if(l.network&&!s.allow_network)throw new Ae(`assurance gate ${e.id} refuses network provider ${d} at trigger ${r}`)}}async function wm(e,t,n,r,i){try{return await Xs(n,r,i)}catch(o){if(o instanceof it){let s=o.check?` check ${o.check}`:"",a=o.measurement_id??n.id,c=new Ae(`assurance gate ${e} assertion ${t} measurement ${a} source ${o.source_kind}${s} field ${o.field} could not resolve: ${o.message}`,{gate_id:e,assertion_id:t,measurement_id:a,source_kind:o.source_kind,field:o.field,...o.check?{check:o.check}:{}});throw c.cause=o,c}throw o}}async function $m(e,t,n,r){Nn(t);let i=t.gates.find(c=>c.id===e);if(!i)throw new Ae(`assurance gate ${e} not found`);if(!i.triggers.includes(r.trigger))throw new Ae(`assurance gate ${e} does not declare trigger ${r.trigger}`);Hv(i,t,n,r.trigger);let o=await Am(i.assertion_ids,km,async c=>{let d=t.assertions.find(f=>f.id===c),l=t.measurements.find(f=>f.id===d.measurement_id),u=n;if(d.scope.kind==="active"){let f=new Set(n.terminal_statuses??["closed","canceled"]);u={...n,items:n.items.filter(h=>!f.has(h.status))}}else if(d.scope.kind==="filter"){let f=d.scope.measurement_id,h=t.measurements.find(v=>v.id===f),_=await wm(i.id,d.id,h,n,t.measurements),w=new Set(_.contributors);u={...n,items:n.items.filter(v=>w.has(v.id))}}let m=n.items.find(f=>f.id===d.owner_item_id),p=m!==void 0&&new Set(n.terminal_statuses??["closed","canceled"]).has(m.status);return jv(d,await wm(i.id,d.id,l,u,t.measurements),{owner_terminal:p})}),s=o.some(c=>c.verdict==="fail"&&c.enforcement==="block"),a=o.some(c=>c.verdict==="fail"&&c.enforcement==="warn");return{gate_id:i.id,tree_id:n.tree_id,trigger:r.trigger,dry_run:r.dry_run===!0,evaluated_at:new Date().toISOString(),verdict:s?"block":a?"warn":"pass",exit_code:s?1:0,assertions:o,assertions_total:o.length,row_contract:{row_keys:["assertions"],jq_selector:".assertions[]"},cost:Rm(o.map(c=>c.cost),Math.max(0,...o.map(c=>c.cost.duration_ms)))}}function qi(e){return fv.join(e,"assurance.json")}async function Tm(e){let t=await B(qi(e));return t===null?wr():Gi(t)}function Gi(e){try{return Nn(JSON.parse(e))}catch(t){throw new g("The assurance registry is invalid. Repair or restore .agents/pm/assurance.json and retry.",y.GENERIC_FAILURE,{code:"assurance_registry_invalid",reason:String(t),nextSteps:["Restore a valid assurance.json from version control or repair its declaration references.","Run pm assurance list measurement after the repair."]})}}function Bi(e,t){return t==="measurement"?e.measurements:t==="assertion"?e.assertions:e.gates}function Uv(e,t){e==="measurement"?Js(t):e==="assertion"?Ks(t):Sm(t)}async function vr(e,t){let n=structuredClone(Bi(await Tm(e),t));return{items:n,count:n.length,row_contract:{row_keys:["items"],jq_selector:".items[]"}}}async function Om(e,t,n){let r=Bi(await Tm(e),t).find(i=>i.id===n);if(!r)throw new Ae(`assurance ${t} ${n} not found`);return structuredClone(r)}async function Vi(e,t,n,r={}){Uv(t,n);let i=await T(e),o=q(r.author,i.author_default),s=await Sn({pmRoot:e,filePath:qi(e),op:`assurance:${t}:put`,author:o,message:r.message,lockTtlSeconds:zi,lockWaitMs:Wi,mutate:a=>{let c=a===null?wr():Gi(a),d=Bi(c,t),l=d.findIndex(m=>m.id===n.id),u=l<0?"created":"updated";if(t==="assertion"&&l>=0&&vv(d[l],n)){let m=n.authorization_decision;if(!m||!r.authorized_decision_ids?.includes(m))throw new L(`loosening assertion ${n.id} requires a verified authorization_decision`)}return l<0?d.push(structuredClone(n)):d[l]=structuredClone(n),Nn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
1
|
+
import{K as Qu,v as te,z as Ms}from"./chunk-7G7JIXLL.js";import{a as js,d as Hs,e as om,f as Us,g as sm}from"./chunk-KPASZGBL.js";import{a as ji,b as hr}from"./chunk-IIP6LZ5E.js";import{h as gm,j as ym}from"./chunk-P55AZPFN.js";import{c as Dt,d as Cn,e as $n,f as Tn,g as cm,j as _m}from"./chunk-IIVDBAJM.js";import{a as am}from"./chunk-XR6MLUVW.js";import{a as hs,c as di,d as li,e as cl,g as dl,h as gs,i as ys,j as vl,k as hn,l as _n,m as kl,n as bl,o as ws}from"./chunk-LWBZ7UGG.js";import{g as lu,h as uu,i as As}from"./chunk-4YBMHMBJ.js";import{a as Ds}from"./chunk-K53OIT5J.js";import{H as iu,I as Ai,J as ou,K as Rs,M as su,N as au,P as cu,Q as du,R as Ii,_ as Ci}from"./chunk-U35K7FSE.js";import{K as hm}from"./chunk-NJTKGBSK.js";import{A as Ve,B as I,C as Hi,D as dm,E as On,F as zs,G as lm,H as um,I as be,J as _r,K as Ui,L as mm,M as Pn,N as pm,Q as fm,Z as Ws,w as nm,y as im}from"./chunk-XR745UGE.js";import{a as Fs,b as rm}from"./chunk-RQYVX2T6.js";import{$a as Ps,A as ur,Aa as pr,B as pu,C as fu,Ca as $s,D as mr,Ga as Mu,Ha as Fu,Hb as Yu,Ia as ju,Ja as Hu,Ka as Mi,M as hu,Ma as Uu,Na as zu,Oa as Wu,Pa as Kt,Pb as Xu,Qa as qu,Qb as Zu,R as _u,Ra as Rn,Sa as Gu,Ta as Ts,Ua as An,Va as Bu,Wa as Vu,Xa as Ju,Ya as Os,Za as Ku,_a as In,a as il,ab as Ls,b as mn,ba as gu,c as _s,ca as yu,d as ol,da as wu,e as sl,f as pt,g as ui,ga as Oi,h as al,i as Tt,rb as Ns,v as $i,xa as Li,ya as Eu,z as mu,za as Cs}from"./chunk-WAP3DF4B.js";import{d as fr,f as Fi,m as em,p as tm}from"./chunk-UQJ4PY2Y.js";import{A as Ni,C as Lu,D as _e,E as ge,F as Nu,G as Di,H as ht,I as _t,M as Du,N as gt,a as Ti,c as vu,j as Ru,k as Au,m as Iu,n as Cu,o as Nt,p as $u,q as Tu,u as Ou,v as Pu}from"./chunk-M57KDG7I.js";import{a as re,b as bn,c as ku,d as Is,e as xn,f as Sn,g as En,h as bu,i as xu,l as Be,q as Su,r as T,s as Pi,x as ie}from"./chunk-MZNV26XE.js";import{$a as xl,A as Re,Ab as Pt,B as et,Bb as Tl,Bc as We,C as qd,Cb as Ol,Cc as xs,Da as Bt,E as X,Ec as wn,Ed as Zl,Fc as gi,Gc as ft,Gd as Si,H as Gd,Hb as Pl,Hc as ke,Hd as Ql,Ib as Ll,Ic as cr,Id as eu,Jc as Wl,Kb as Nl,Kc as ql,Kd as tu,Lb as Dl,Lc as Gl,M as ci,Ma as fs,Mb as se,Mc as Bl,N as Xd,Nc as Vl,O as us,Oa as un,Oc as yi,P as ms,Pc as Jt,Q as ps,Qa as nt,Qc as wi,S as Zd,Sa as rt,Sd as U,T as Qd,W as el,Wc as Jl,Wd as Y,Xc as dr,Yc as vn,Zc as qe,_d as Ge,a as Ld,ad as kn,ae as nu,ba as nl,bd as vi,be as Ei,cb as ve,cd as Kl,d as Nd,db as vs,dd as ki,e as Dd,eb as pi,fb as ar,fd as Yl,gb as Rl,ge as ru,h as dn,hb as fi,hd as bi,ib as Al,kb as hi,lb as _i,me as Ri,nb as Il,nc as q,oc as Ml,od as Ss,pd as Es,q as zd,qc as Fl,qd as Xl,rb as Cl,rc as jl,sb as $l,sc as ze,t as Wd,tc as Hl,ua as rl,uc as Ul,v as ds,vb as Le,vc as ks,wc as zl,xc as bs,yd as lr,zc as Lt,zd as xi}from"./chunk-HXM7K6VH.js";import{B as yn,C as K,K as El,c as A,d as ls,e as Ce,p as tl,u as $,v as Sl,w as gn,x as Ot,y as Vt}from"./chunk-NGHT2LNG.js";import{e as Vd,f as Jd,g as W,l as sr,n as M,o as tt,p as ai,q as ln,s as Kd,t as mt,v as Yd}from"./chunk-26P6C6OO.js";import{E as Bd,G as ce,I as ll,J as pn,K as fn,L as ul,M as ml,N as pl,O as fl,P as we,T as hl,V as $e,W as _l,X as gl,Z as Te,ba as he,ca as yl,da as mi,fa as wl,i as cs}from"./chunk-JFICNN4T.js";import{A as g,B as or,C as P,D as Qe,E as H,F as B,J as ee,a as ii,d as oi,p as Md,r as Fd,t as jd,v as Hd,w as si,x as Ud,y as $t,z as y}from"./chunk-IRYNVGKH.js";var L=class extends TypeError{constructor(t){super(t),this.name="AssuranceMutationRefusalError"}},Ae=class extends TypeError{context;constructor(t,n={}){super(t),this.name="AssuranceEvaluationRefusalError",this.context=n}},it=class extends TypeError{measurement_id;source_kind;field;check;constructor(t,n){super(t),this.name="AssuranceSourceResolutionError",this.measurement_id=n.measurement_id,this.source_kind=n.source_kind,this.field=n.field,this.check=n.check}};async function Ln(e){try{return await e()}catch(t){throw t instanceof L?new g(t.message,y.USAGE,{code:"invalid_argument_value",reason:"assurance_mutation_refused"}):t}}async function qs(e){try{return await e()}catch(t){throw t instanceof Ae?new g(t.message,y.USAGE,{code:"invalid_argument_value",reason:"assurance_evaluation_refused",...t.context}):t}}import{createHash as pv}from"node:crypto";import fv from"node:path";var vm=1,Yt=["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"],Gs=["items","dependency_kind","prose_edge_gap","graph","validate","health","history","links","provider","derived"],hv=["ceiling","floor","equals","zero","monotone_nondecreasing","monotone_nonincreasing","subset_of"],_v=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,zi=30,Wi=5e3,km=4,gv=50;function yt(e,t){if(!_v.test(e))throw new L(`${t} must be a stable lowercase id`)}function yv(e,t){if(!Number.isFinite(e)||e<0)throw new L(`${t} must be a finite non-negative number`)}function yr(e){let t=hv.filter(i=>e[i]!==void 0);if(t.length!==1)throw new L(`assertion ${e.id} must declare exactly one polarity`);let n=t[0],r=e[n];return{polarity:n,value:n==="zero"?0:r}}function Vs(e,t){return A(e)===A(t)}function bm(e,t){if(t.polarity==="equals")return Vs(e,t.value);if(t.polarity==="subset_of"){if(!Array.isArray(e)||!Array.isArray(t.value))return!1;let r=t.value;return e.every(i=>r.includes(i))}if(typeof e!="number")return!1;let n=t.value;return t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?e<=n:t.polarity==="floor"||t.polarity==="monotone_nondecreasing"?e>=n:e===0}function xm(e){let t=yr(e),n=e.negative_control.cases;return n.some(r=>r.expected==="pass")&&n.some(r=>r.expected==="fail")&&n.every(r=>bm(r.observed,t)===(r.expected==="pass"))}function wv(e,t){if(e.polarity!==t.polarity)return!0;if(typeof e.value=="number"&&typeof t.value=="number")return e.polarity==="ceiling"||e.polarity==="monotone_nonincreasing"?t.value>e.value:e.polarity==="floor"||e.polarity==="monotone_nondecreasing"?t.value<e.value:t.value!==e.value;if(e.polarity==="subset_of"){let n=e.value,r=t.value;return!Array.isArray(n)||!Array.isArray(r)||r.some(i=>!n.includes(i))}return!Vs(e.value,t.value)}function vv(e,t){if(e.measurement_id!==t.measurement_id||e.owner_item_id!==t.owner_item_id||A(e.scope)!==A(t.scope))return!0;let n={observe:0,warn:1,block:2},r=(e.lifetime??"hold")==="hold"&&(t.lifetime??"hold")==="retire";return wv(yr(e),yr(t))||n[t.enforcement]<n[e.enforcement]||r}function kv(e){if(e.state!==void 0&&!(e.state==="present"||e.state==="missing"))throw new L("items source state must be present or missing");let t=Object.hasOwn(e,"equals"),n=e.state!==void 0,r=Number(t)+Number(n);if(e.field!==void 0&&r!==1)throw new L("items source with field requires exactly one of equals or state");if(e.field===void 0&&r!==0)throw new L("items source equals/state requires field")}function bv(e){if(typeof e.dependency_kind!="string"||e.dependency_kind.trim().length===0)throw new L("dependency_kind source requires dependency_kind");if([e.source_kind,e.source_kind_prefix,e.source_kind_state].filter(n=>n!==void 0).length>1)throw new L("dependency_kind source accepts at most one source_kind predicate");if(e.source_kind!==void 0&&e.source_kind.trim().length===0||e.source_kind_prefix!==void 0&&e.source_kind_prefix.trim().length===0)throw new L("dependency_kind source provenance values must not be empty");if(e.source_kind_state!==void 0&&e.source_kind_state!=="present"&&e.source_kind_state!=="missing")throw new L("dependency_kind source source_kind_state must be present or missing")}function xv(e){if(e.sample_limit!==void 0&&(!Number.isInteger(e.sample_limit)||e.sample_limit<1))throw new L("prose_edge_gap sample_limit must be a positive integer");for(let t of e.exemptions??[]){if(typeof t.holder_id!="string"||t.holder_id.trim().length===0||typeof t.reason!="string"||t.reason.trim().length===0)throw new L("prose_edge_gap exemptions require holder_id and reason");if(t.target_id!==void 0&&t.target_id.trim().length===0||t.text_contains!==void 0&&t.text_contains.trim().length===0)throw new L("prose_edge_gap exemption selectors must not be empty")}}function Js(e){yt(e.id,"measurement.id"),e.max_cost!==void 0&&yv(e.max_cost,"measurement.max_cost");let t=e.source;if(Object.prototype.toString.call(t)!=="[object Object]")throw new L(`measurement.source.kind must be one of ${Gs.join(", ")}`);let n=Reflect.get(t,"kind");if(!Gs.includes(n))throw new L(`measurement.source.kind must be one of ${Gs.join(", ")}`);let r=t;if(r.kind==="items"&&kv(r),r.kind==="dependency_kind"&&bv(r),r.kind==="prose_edge_gap"&&xv(r),(r.kind==="graph"||r.kind==="validate"||r.kind==="health")&&(typeof r.field!="string"||r.field.trim().length===0))throw new L(`${r.kind} source requires field`);return r.kind==="provider"&&(yt(r.provider,"provider source provider"),yt(r.key,"provider source key")),e}function Ks(e){if(yt(e.id,"assertion.id"),yt(e.measurement_id,"assertion.measurement_id"),typeof e.owner_item_id!="string"||e.owner_item_id.trim().length===0)throw new L("assertion.owner_item_id is required");let t=yr(e);if(typeof t.value=="number"&&!Number.isFinite(t.value))throw new L(`assertion.${t.polarity} must be a finite number`);if(e.lifetime==="retire"&&(typeof e.retire_reason!="string"||e.retire_reason.trim().length===0))throw new L("retired assertion requires retire_reason");e.scope.kind==="filter"&&yt(e.scope.measurement_id,"assertion.scope.measurement_id");let n=e.negative_control?.cases;if(!Array.isArray(n)||!n.some(r=>r.expected==="pass")||!n.some(r=>r.expected==="fail"))throw new L("assertion negative control requires pass and fail cases");if(!xm(e))throw new L(`assertion ${e.id} negative control does not prove its bound`);return e}function Sv(e){if(!Array.isArray(e.allowed_providers))throw new L("gate provider_policy.allowed_providers must be an array");for(let t of e.allowed_providers)yt(t,"gate.provider_policy.allowed_provider");if(typeof e.triggers!="object"||e.triggers===null||Array.isArray(e.triggers))throw new L("gate provider_policy.triggers must be an object");for(let[t,n]of Object.entries(e.triggers)){if(!Yt.includes(t))throw new L(`gate provider policy has unknown trigger ${t}`);if(typeof n!="object"||n===null||!["low","medium","high"].includes(n.max_cost_class)||typeof n.allow_network!="boolean")throw new L(`gate provider policy trigger ${t} is invalid`)}}function Sm(e){if(yt(e.id,"gate.id"),!Array.isArray(e.assertion_ids))throw new L("gate.assertion_ids is required and must be an array");if(e.assertion_ids.length===0)throw new L("gate requires at least one assertion");for(let t of e.assertion_ids)yt(t,"gate.assertion_id");if(!Array.isArray(e.triggers))throw new L(`gate.triggers is required and must be an array of ${Yt.join(", ")}`);if(e.triggers.length===0)throw new L("gate requires at least one trigger");for(let t of e.triggers)if(!Yt.includes(t))throw new L(`gate trigger must be one of ${Yt.join(", ")}`);return e.provider_policy&&Sv(e.provider_policy),e}function Nn(e){if(e.version!==vm)throw new L(`unsupported assurance document version ${String(e.version)}`);let t=new Set;for(let r of e.measurements){if(Js(r),t.has(`measurement:${r.id}`))throw new L(`duplicate measurement ${r.id}`);t.add(`measurement:${r.id}`)}for(let r of e.assertions){if(Ks(r),t.has(`assertion:${r.id}`))throw new L(`duplicate assertion ${r.id}`);t.add(`assertion:${r.id}`)}for(let r of e.gates){Sm(r);let i=r.assertion_ids.filter(o=>!e.assertions.some(s=>s.id===o));if(i.length>0)throw new L(`gate ${r.id} references missing assertions: ${i.join(", ")}`);if(t.has(`gate:${r.id}`))throw new L(`duplicate gate ${r.id}`);t.add(`gate:${r.id}`)}let n=new Set(e.measurements.map(r=>r.id));for(let[r,i]of Em(e))if(!n.has(r))throw new L(`${i.join(", ")} references missing measurement ${r}`);return e}function Ys(e,t){if("measurement"in e){t.push(e.measurement);return}if("operator"in e)for(let n of e.operands)Ys(n,t)}function Em(e){let t=new Map,n=(r,i)=>{let o=t.get(r)??[];o.push(i),t.set(r,o)};for(let r of e.assertions)n(r.measurement_id,`assertion ${r.id}`),r.scope.kind==="filter"&&n(r.scope.measurement_id,`assertion ${r.id} scope`);for(let r of e.measurements){if(r.source.kind!=="derived")continue;let i=[];Ys(r.source.expression,i);for(let o of i)n(o,`derived measurement ${r.id}`)}return t}function Ev(e,t){let n=e.assertion_ids.flatMap(o=>{let s=t.assertions.find(a=>a.id===o);return[s.measurement_id,...s.scope.kind==="filter"?[s.scope.measurement_id]:[]]}),r=new Set,i=new Set;for(;n.length>0;){let o=n.pop();if(r.has(o))continue;r.add(o);let s=t.measurements.find(a=>a.id===o);s.source.kind==="provider"?i.add(s.source.provider):s.source.kind==="derived"&&Ys(s.source.expression,n)}return i}function wr(){return{version:vm,measurements:[],assertions:[],gates:[]}}function Rv(e,t){let n=t.items.filter(r=>(e.statuses===void 0||e.statuses.includes(r.status))&&(e.types===void 0||e.types.includes(r.type))&&(e.tags===void 0||e.tags.every(i=>r.tags?.includes(i)))&&(e.field===void 0||(()=>{let i=r[e.field];if(e.state!==void 0){let o=i==null||i===""||Array.isArray(i)&&i.length===0;return e.state==="missing"?o:!o}return Vs(i,e.equals)})()));return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function Av(e,t){return e.source_kind!==void 0?t?.toLowerCase()===e.source_kind.trim().toLowerCase():e.source_kind_prefix!==void 0?t?.toLowerCase().startsWith(e.source_kind_prefix.trim().toLowerCase())===!0:e.source_kind_state==="present"?t!==void 0&&t.length>0:e.source_kind_state==="missing"?t===void 0||t.length===0:!0}function Iv(e,t){let n=[],r=ds(e.dependency_kind)??e.dependency_kind.trim().toLowerCase();for(let i of t.items)for(let o of i.dependencies??[]){let s=ds(o.kind)??o.kind.trim().toLowerCase(),a=o.source_kind?.trim();s===r&&Av(e,a)&&n.push(`${i.id}->${o.id}${a?`@${a}`:""}`)}return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n}}function Cv(e){let t=[e.description,e.body].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean);for(let n of["comments","notes","learnings"]){let r=e[n];if(Array.isArray(r)){for(let i of r)if(typeof i=="string")t.push(i);else if(typeof i=="object"&&i!==null){let o=Reflect.get(i,"text");typeof o=="string"&&t.push(o)}}}return t}function $v(e,t,n,r){return e.some(i=>i.holder_id.trim().toLowerCase()===t.toLowerCase()&&(i.target_id===void 0||i.target_id.trim().toLowerCase()===n.toLowerCase())&&(i.text_contains===void 0||r.toLowerCase().includes(i.text_contains.trim().toLowerCase())))}function Bs(e,t){return[e.toLowerCase(),t.toLowerCase()].sort().join("\0")}function Tv(e){let t=new Map,n=new Set,r=[],i=/(?<![\w-])[a-z0-9]+(?:-+[a-z0-9]+)+(?![\w-])/giu,o=0;for(let s of e){t.set(s.id.toLowerCase(),s.id);for(let a of s.dependencies??[])n.add(Bs(s.id,a.id));for(let a of[s.parent,s.blocked_by])typeof a=="string"&&n.add(Bs(s.id,a));for(let a of Cv(s)){let c=[...a.matchAll(i)].map(d=>d[0]);o+=c.length,r.push({holder_id:s.id,segment:a,mentioned_ids:c})}}return{canonical_ids:t,linked_pairs:n,prose_mentions:r,mention_count:o}}function Ov(e,t){let n=Tv(t.items),r=new Map;for(let s of n.prose_mentions){let a=s.mentioned_ids.map(d=>n.canonical_ids.get(d.toLowerCase())).filter(d=>d!==void 0&&d!==s.holder_id),c=[...new Set(a)];for(let d of c){let l=Bs(s.holder_id,d);if(n.linked_pairs.has(l)||$v(e.exemptions??[],s.holder_id,d,s.segment))continue;let u=c.some(m=>m!==d);r.get(l)?.explicit===!0&&!u||r.set(l,{contributor:`${s.holder_id}->${d}|subject=${u?"explicit":"implicit"}`,explicit:u})}}let i=[...r.values()],o=i.map(s=>s.contributor).sort();return{value:o.length,population_size:n.canonical_ids.size,cost:t.items.length+n.linked_pairs.size+n.mention_count,contributors:o.slice(0,e.sample_limit??25),partitions:{explicit_subject:i.filter(s=>s.explicit).length,implicit_subject:i.filter(s=>!s.explicit).length}}}function Pv(e,t){return{value:t.history.filter(r=>(e.op===void 0||r.op===e.op)&&(e.author===void 0||r.author===e.author)&&(e.harness===void 0||r.agent_harness===e.harness)&&(e.model===void 0||r.agent_model===e.model)).length,population_size:t.history.length,cost:t.history.length}}function Lv(e,t){let n=t.items.filter(r=>{let i=r[e.link],o=Array.isArray(i)&&i.length>0;return e.state==="present"?o:!o});return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function Nv(e,t){let n=e.source;return n.kind==="items"?Rv(n,t):n.kind==="dependency_kind"?Iv(n,t):n.kind==="prose_edge_gap"?Ov(n,t):n.kind==="history"?Pv(n,t):n.kind==="links"?Lv(n,t):null}function Rm(e,t){return e.reduce((n,r)=>({units:n.units+r.units,items_scanned:n.items_scanned+r.items_scanned,history_entries:n.history_entries+r.history_entries,provider_calls:n.provider_calls+r.provider_calls,duration_ms:t}),{units:0,items_scanned:0,history_entries:0,provider_calls:0,duration_ms:t})}function Dv(e,t){if(t.length===0)throw new TypeError(`derived ${e} requires operands`);if(e==="add")return t.reduce((n,r)=>n+r,0);if(e==="subtract")return t.slice(1).reduce((n,r)=>n-r,t[0]);if(e==="multiply")return t.reduce((n,r)=>n*r,1);if(e==="divide"){if(t.slice(1).includes(0))throw new TypeError("derived divide cannot divide by zero");return t.slice(1).reduce((n,r)=>n/r,t[0])}return e==="min"?Math.min(...t):Math.max(...t)}async function Am(e,t,n){let r=new Array(e.length),i=0,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let s=i;i+=1,r[s]=await n(e[s],s)}});return await Promise.all(o),r}async function Im(e,t,n,r,i){if("literal"in e)return{value:e.literal,costs:[],population_size:0,contributors:[]};if("measurement"in e){let s=n.find(d=>d.id===e.measurement);if(!s)throw new TypeError(`derived measurement references missing ${e.measurement}`);let a=await Cm(s,t,n,r,i);if(typeof a.value!="number")throw new TypeError(`derived measurement ${s.id} is not numeric`);let c=i.charged.has(s.id)?[]:[a.cost];return i.charged.add(s.id),{value:a.value,costs:c,population_size:a.population_size,contributors:a.contributors}}let o=await Am(e.operands,km,s=>Im(s,t,n,r,i));return{value:Dv(e.operator,o.map(s=>s.value)),costs:o.flatMap(s=>s.costs),population_size:Math.max(0,...o.map(s=>s.population_size)),contributors:[...new Set(o.flatMap(s=>s.contributors))]}}async function Mv(e,t,n,r,i){Js(e);let o=Date.now(),s,a=[],c=0;if(e.source.kind==="derived"){let u=await Im(e.source.expression,t,n,[...r,e.id],i);s={value:u.value,population_size:u.population_size,cost:0,contributors:u.contributors},a=u.costs}else{let u=Nv(e,t);u!==null?s=u:(s=await t.external(e.source),c=1)}let d={units:s.cost,items_scanned:e.source.kind==="items"||e.source.kind==="dependency_kind"||e.source.kind==="prose_edge_gap"||e.source.kind==="links"?t.items.length:0,history_entries:e.source.kind==="history"?t.history.length:0,provider_calls:c,duration_ms:Date.now()-o},l=Rm([...a,d],Date.now()-o);if(e.max_cost!==void 0&&l.units>e.max_cost)throw new Ae(`measurement ${e.id} exceeded cost ceiling ${e.max_cost} with ${l.units}`);return{id:e.id,definition_fingerprint:`sha256:${pv("sha256").update(A(e)).digest("hex")}`,value:s.value,population_size:s.population_size,cost:l,contributors:s.contributors??[],...s.partitions?{partitions:s.partitions}:{}}}function Cm(e,t,n,r,i){if(r.includes(e.id))throw new TypeError(`derived measurement cycle: ${[...r,e.id].join(" -> ")}`);let o=i.cache.get(e.id);if(o)return o;let s=Mv(e,t,n,r,i).catch(a=>{if(a instanceof it&&a.measurement_id===void 0){let c={measurement_id:e.id,source_kind:a.source_kind,field:a.field,...a.check?{check:a.check}:{}},d=new it(a.message,c);throw d.cause=a,d}throw a});return i.cache.set(e.id,s),s}async function Xs(e,t,n=[e]){return Cm(e,t,n,[],{cache:new Map,charged:new Set})}function Fv(e,t){return typeof e!="number"||typeof t.value!="number"?null:t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?t.value-e:(t.polarity==="floor"||t.polarity==="monotone_nondecreasing",e-t.value)}function jv(e,t,n={}){Ks(e);let r=yr(e),i=e.lifetime==="retire"&&n.owner_terminal===!0;return{assertion_id:e.id,measurement_id:e.measurement_id,measurement_definition_fingerprint:t.definition_fingerprint,scope:e.scope,population_size:t.population_size,observed:t.value,bound:r,distance:Fv(t.value,r),verdict:i?"retired":bm(t.value,r)?"pass":"fail",enforcement:e.enforcement,negative_control_proven:xm(e),cost:t.cost,contributors:t.contributors,...t.partitions?{partitions:t.partitions}:{}}}function Hv(e,t,n,r){let i=Ev(e,t);if(i.size===0)return;let o=e.provider_policy,s=o?.triggers[r];if(!o||!s)throw new Ae(`assurance gate ${e.id} refuses provider execution at trigger ${r} without an explicit provider policy`);let a=new Set(o.allowed_providers),c={low:0,medium:1,high:2};for(let d of i){if(!a.has(d))throw new Ae(`assurance gate ${e.id} refuses provider ${d}`);let l=n.provider_capabilities?.[d];if(!l)throw new Ae(`assurance provider ${d} has no declared capabilities`);if(c[l.cost_class]>c[s.max_cost_class])throw new Ae(`assurance gate ${e.id} refuses ${l.cost_class}-cost provider ${d} at trigger ${r}`);if(l.network&&!s.allow_network)throw new Ae(`assurance gate ${e.id} refuses network provider ${d} at trigger ${r}`)}}async function wm(e,t,n,r,i){try{return await Xs(n,r,i)}catch(o){if(o instanceof it){let s=o.check?` check ${o.check}`:"",a=o.measurement_id??n.id,c=new Ae(`assurance gate ${e} assertion ${t} measurement ${a} source ${o.source_kind}${s} field ${o.field} could not resolve: ${o.message}`,{gate_id:e,assertion_id:t,measurement_id:a,source_kind:o.source_kind,field:o.field,...o.check?{check:o.check}:{}});throw c.cause=o,c}throw o}}async function $m(e,t,n,r){Nn(t);let i=t.gates.find(c=>c.id===e);if(!i)throw new Ae(`assurance gate ${e} not found`);if(!i.triggers.includes(r.trigger))throw new Ae(`assurance gate ${e} does not declare trigger ${r.trigger}`);Hv(i,t,n,r.trigger);let o=await Am(i.assertion_ids,km,async c=>{let d=t.assertions.find(f=>f.id===c),l=t.measurements.find(f=>f.id===d.measurement_id),u=n;if(d.scope.kind==="active"){let f=new Set(n.terminal_statuses??["closed","canceled"]);u={...n,items:n.items.filter(h=>!f.has(h.status))}}else if(d.scope.kind==="filter"){let f=d.scope.measurement_id,h=t.measurements.find(v=>v.id===f),_=await wm(i.id,d.id,h,n,t.measurements),w=new Set(_.contributors);u={...n,items:n.items.filter(v=>w.has(v.id))}}let m=n.items.find(f=>f.id===d.owner_item_id),p=m!==void 0&&new Set(n.terminal_statuses??["closed","canceled"]).has(m.status);return jv(d,await wm(i.id,d.id,l,u,t.measurements),{owner_terminal:p})}),s=o.some(c=>c.verdict==="fail"&&c.enforcement==="block"),a=o.some(c=>c.verdict==="fail"&&c.enforcement==="warn");return{gate_id:i.id,tree_id:n.tree_id,trigger:r.trigger,dry_run:r.dry_run===!0,evaluated_at:new Date().toISOString(),verdict:s?"block":a?"warn":"pass",exit_code:s?1:0,assertions:o,assertions_total:o.length,row_contract:{row_keys:["assertions"],jq_selector:".assertions[]"},cost:Rm(o.map(c=>c.cost),Math.max(0,...o.map(c=>c.cost.duration_ms)))}}function qi(e){return fv.join(e,"assurance.json")}async function Tm(e){let t=await B(qi(e));return t===null?wr():Gi(t)}function Gi(e){try{return Nn(JSON.parse(e))}catch(t){throw new g("The assurance registry is invalid. Repair or restore .agents/pm/assurance.json and retry.",y.GENERIC_FAILURE,{code:"assurance_registry_invalid",reason:String(t),nextSteps:["Restore a valid assurance.json from version control or repair its declaration references.","Run pm assurance list measurement after the repair."]})}}function Bi(e,t){return t==="measurement"?e.measurements:t==="assertion"?e.assertions:e.gates}function Uv(e,t){e==="measurement"?Js(t):e==="assertion"?Ks(t):Sm(t)}async function vr(e,t){let n=structuredClone(Bi(await Tm(e),t));return{items:n,count:n.length,row_contract:{row_keys:["items"],jq_selector:".items[]"}}}async function Om(e,t,n){let r=Bi(await Tm(e),t).find(i=>i.id===n);if(!r)throw new Ae(`assurance ${t} ${n} not found`);return structuredClone(r)}async function Vi(e,t,n,r={}){Uv(t,n);let i=await T(e),o=q(r.author,i.author_default),s=await Sn({pmRoot:e,filePath:qi(e),op:`assurance:${t}:put`,author:o,message:r.message,lockTtlSeconds:zi,lockWaitMs:Wi,mutate:a=>{let c=a===null?wr():Gi(a),d=Bi(c,t),l=d.findIndex(m=>m.id===n.id),u=l<0?"created":"updated";if(t==="assertion"&&l>=0&&vv(d[l],n)){let m=n.authorization_decision;if(!m||!r.authorized_decision_ids?.includes(m))throw new L(`loosening assertion ${n.id} requires a verified authorization_decision`)}return l<0?d.push(structuredClone(n)):d[l]=structuredClone(n),Nn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
2
2
|
`,result:{changed:!0,action:u,kind:t,id:n.id}}}});return{...s.result,changed:s.changed}}async function Zs(e,t,n={}){let r=wr();r.measurements=structuredClone(t.measurements),r.assertions=structuredClone(t.assertions),r.gates=structuredClone(t.gates),Nn(r);let i=await T(e),o=q(n.author,i.author_default),s=await Sn({pmRoot:e,filePath:qi(e),op:"assurance:bundle:apply",author:o,message:n.message,lockTtlSeconds:zi,lockWaitMs:Wi,mutate:a=>{let c=a===null?wr():Gi(a),d=[],l=[],u=(m,p,f)=>{for(let h of p){let _=m.find(w=>w.id===h.id);if(!_){m.push(structuredClone(h)),d.push(`${f}:${h.id}`);continue}if(A(_)!==A(h))throw new L(`assurance bundle refuses to replace divergent ${f} ${h.id}`);l.push(`${f}:${h.id}`)}};return u(c.measurements,r.measurements,"measurement"),u(c.assertions,r.assertions,"assertion"),u(c.gates,r.gates,"gate"),Nn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
3
3
|
`,result:{changed:d.length>0,created_ids:d,unchanged_ids:l}}}});return{...s.result,changed:s.changed}}async function Pm(e,t,n,r={}){let i=await T(e),o=q(r.author,i.author_default),s=await Sn({pmRoot:e,filePath:qi(e),op:`assurance:${t}:remove`,author:o,message:r.message,lockTtlSeconds:zi,lockWaitMs:Wi,mutate:a=>{let c=a===null?wr():Gi(a);if(t==="measurement"){let u=Em(c).get(n);if(u&&u.length>0)throw new L(`assurance measurement ${n} is referenced by ${u.join(", ")}`)}if(t==="assertion"&&c.gates.some(u=>u.assertion_ids.includes(n)))throw new L(`assurance assertion ${n} is referenced by gate`);let d=Bi(c,t),l=d.findIndex(u=>u.id===n);if(l<0)throw new L(`assurance ${t} ${n} not found`);return d.splice(l,1),Nn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
4
4
|
`,result:{changed:!0,action:"removed",kind:t,id:n}}}});return{...s.result,changed:s.changed}}async function Lm(e,t,n={}){if(t.dry_run)throw new TypeError("dry-run assurance verdicts are not persisted");let r=await T(e);await xn({pmRoot:e,op:"assurance:gate:verdict",author:q(n.author,r.author_default),context:{assurance_verdict:t},message:n.message??`Assurance gate ${t.gate_id} returned ${t.verdict}`,lockTtlSeconds:zi,lockWaitMs:Wi})}async function Nm(e,t={}){let n=t.limit??gv;if(!Number.isInteger(n)||n<1||n>1e3)throw new TypeError(`assurance verdict limit must be an integer from 1 through ${1e3}`);return(await ze(bn(e),re)).reverse().filter(i=>i.op==="assurance:gate:verdict").map(i=>i.context?.assurance_verdict).filter(i=>typeof i=="object"&&i!==null&&"gate_id"in i).filter(i=>t.gate_id===void 0||i.gate_id===t.gate_id).slice(0,n)}import{AsyncLocalStorage as zv}from"node:async_hooks";import Dm from"node:path";var Mm=new zv;function Fm(e,t){return Mm.run({...e,pmRoot:Dm.resolve(e.pmRoot)},t)}function PL(e,t){let n=Mm.getStore();return n!==void 0&&n.pmRoot===Dm.resolve(e)&&n.transactionId===t?n.step:void 0}import{mkdir as Wv,readFile as qv}from"node:fs/promises";import Hm from"node:path";import{createHash as Gv}from"node:crypto";var Qs=class extends Error{constructor(t="Workspace transaction interrupted"){super(t),this.name="WorkspaceTransactionInterruptedError"}},Um="sdk-workspace-transaction",zm=/^[a-zA-Z0-9._-]+$/,Wm=30,qm=3e3;function ia(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n||!zm.test(n))throw new TypeError(`${t} must match [a-zA-Z0-9._-]+`);return n}function ea(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n)throw new TypeError(`${t} must be non-empty`);return n}function oa(e){return{pmRoot:ea(e.pmRoot,"Transaction pmRoot"),transactionId:ia(e.transactionId,"Transaction id"),author:ea(e.author,"Transaction author")}}function Ki(e,t,n){let r=e??t;if(!Number.isInteger(r)||r<=0)throw new TypeError(`${n} must be a positive integer`);return r}function Gm(e,t){return Hm.join(e,"transactions","sdk",`${t}.json`)}async function ot(e,t){t.updatedAt=$();let n=Gm(e,t.transactionId);await Wv(Hm.dirname(n),{recursive:!0}),await ee(n,`${JSON.stringify(t,null,2)}
|
|
@@ -74,4 +74,4 @@ ${o}`,y.GENERIC_FAILURE)}}function is(e){return typeof e.tag=="string"&&e.tag.tr
|
|
|
74
74
|
`);de(e.progressEnabled,"writing keyword artifacts"),await ee(t,`${JSON.stringify(e.manifest,null,2)}
|
|
75
75
|
`),await ee(n,`${i}
|
|
76
76
|
`);let o=[];if(e.mode!=="keyword")try{de(e.progressEnabled,"writing vectorization status ledger"),await Bu(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(s){o.push(`search_vectorization_status_ledger_write_failed:${s instanceof Error?s.message:String(s)}`)}return o}async function q2(e,t){let n=XP(e.mode),r=YP(e),i=e.full===!0;de(r,`start mode=${n}`);let o=M(process.cwd(),t.path);await ie(o);let s=Li(await T(o)).settings,a=null;try{a=await se(o,Eu,s.locks.ttl_seconds,q(void 0,"pm-reindex"),!1,s.governance.force_required_for_stale_lock,s.locks.wait_ms)}catch(c){throw c instanceof g&&c.exitCode===y.CONFLICT?new g("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",y.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=eL(s),d=tL(s),l=aL({requestedMode:n,pmRoot:o,settings:s,extensionEmbedding:c,extensionVectorAdapter:d}),u=n;de(r,"loading item corpus");let m=await cL({pmRoot:o,settings:s}),p=m.warnings,{documentCandidates:f,metadataDocuments:h}=m;de(r,`loaded_items=${h.length}`);let _=$(),w=sL(u,_,h),v=ni.join(o,Cd),k=ni.join(o,$d),x=u==="keyword"?await Od(o,f,s.schema,p):h,E=[],R={},S=null,b=oL(u);if(u==="keyword"&&await dL({pmRoot:o,settings:s,forceFullSemantic:i,extensionEmbedding:c,reindexWarnings:p}),u!=="keyword"){let C=await _L({pmRoot:o,settings:s,requestedMode:n,activeEmbeddingProvider:l.activeEmbeddingProvider,activeVectorStore:l.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:d,documentCandidates:f,metadataDocuments:h,documentsForKeywordArtifacts:x,forceFullSemantic:i,reindexWarnings:p,semanticWarnings:E,semanticSummary:b,progressEnabled:r});x=C.documentsForKeywordArtifacts,R=C.vectorizationLedgerEntries,S=C.vectorizationEmbeddingMetadata}let D=await gL({pmRoot:o,mode:u,manifest:w,documentsForKeywordArtifacts:x,settings:s,vectorizationLedgerEntries:R,vectorizationEmbeddingMetadata:S,progressEnabled:r}),F=[...await Y({path:v,scope:"project",op:"reindex:manifest"}),...await Y({path:k,scope:"project",op:"reindex:embeddings"}),...await Ei({mode:u,total_items:h.length})];return de(r,"done"),{ok:!0,mode:u,total_items:h.length,semantic:b,artifacts:{manifest:Cd,embeddings:$d},warnings:[...p,...E,...D,...F],generated_at:_}}finally{await a?.()}}export{L as a,Ae as b,it as c,Ln as d,qs as e,vm as f,Yt as g,Gs as h,vv as i,Js as j,Ks as k,Sm as l,Nn as m,wr as n,Xs as o,jv as p,$m as q,vr as r,Om as s,Vi as t,Zs as u,Pm as v,Lm as w,Nm as x,PL as y,oa as z,Jm as A,BL as B,ek as C,VL as D,nk as E,YL as F,Zm as G,ok as H,fN as I,dx as J,KM as K,YM as L,XM as M,Or as N,ZM as O,QM as P,eF as Q,tF as R,nF as S,rF as T,iF as U,oF as V,sF as W,aF as X,cF as Y,$h as Z,ec as _,RD as $,zp as aa,dk as ba,ip as ca,IN as da,Sr as ea,CN as fa,_k as ga,gk as ha,$N as ia,yk as ja,O0 as ka,Ty as la,Z0 as ma,Ny as na,NN as oa,up as pa,My as qa,YG as ra,XG as sa,Er as ta,Qi as ua,pp as va,fp as wa,hp as xa,_p as ya,vp as za,ua as Aa,bp as Ba,Ep as Ca,Rp as Da,Mk as Ea,Ip as Fa,Ht as Ga,o1 as Ha,s1 as Ia,a1 as Ja,c1 as Ka,_1 as La,H_ as Ma,Oo as Na,j1 as Oa,Et as Pa,K_ as Qa,H1 as Ra,U1 as Sa,$I as Ta,LI as Ua,eg as Va,jk as Wa,pa as Xa,Vr as Ya,pW as Za,fW as _a,to as $a,no as ab,Gg as bb,Eq as cb,Bg as db,Jg as eb,Kg as fb,Zg as gb,ey as hb,gT as ib,yT as jb,rB as kb,iB as lb,oB as mb,sB as nb,Hy as ob,vT as pb,zy as qb,Bo as rb,qy as sb,Gy as tb,By as ub,bT as vb,ST as wb,RT as xb,aB as yb,AT as zb,id as Ab,od as Bb,yB as Cb,wB as Db,vB as Eb,rO as Fb,FV as Gb,Pw as Hb,Zr as Ib,Dw as Jb,Mw as Kb,Fw as Lb,kd as Mb,mP as Nb,kJ as Ob,qJ as Pb,QJ as Qb,Qw as Rb,ev as Sb,tv as Tb,x2 as Ub,D2 as Vb,M2 as Wb,F2 as Xb,q2 as Yb};
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-A3DORTXS.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as B,b as v}from"./chunk-X6CXWWNB.js";import{mb as I,nb as h,v as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as B,b as v}from"./chunk-X6CXWWNB.js";import{mb as I,nb as h,v as m}from"./chunk-HXM7K6VH.js";import{a as T,i as A}from"./chunk-26P6C6OO.js";function E(e,n){return(n===void 0?void 0:A(e,n))?.execution_role??T[e.trim().toLowerCase()]??"agent"}var g="blocked_by",L="blocks",G=Object.freeze([g,L]),x="no-active-blocker";function l(e){return e.trim().toLowerCase()}function b(e,n){return n?`external:${e}`:`local:${l(e)}`}function k(e){let n=new Map,t=typeof e.blocked_by=="string"?e.blocked_by.trim():"";if(t.length>0&&l(t)!==x){let o=B(t);n.set(b(t,o),o?t:l(t))}for(let o of e.dependencies??[]){let c=typeof o.id=="string"?o.id.trim():"";if(m(o.kind)===g&&c.length>0&&l(c)!==x){let s=B(c)||v(o.source_kind);n.set(b(c,s),s?c:l(c))}}return[...n.values()].sort((o,c)=>o.localeCompare(c))}function _(e){let n=new Map;for(let t of e){let o=l(t.id);o.length!==0&&n.set(o,new Set(k(t)))}for(let t of e){let o=l(t.id);if(o.length!==0)for(let c of t.dependencies??[]){let s=m(c.kind)===L&&typeof c.id=="string"?l(c.id):"";if(s.length===0||s===x)continue;let i=n.get(s)??new Set;i.add(o),n.set(s,i)}}return new Map([...n].map(([t,o])=>[t,[...o].sort((c,s)=>c.localeCompare(s))]))}function M(e,n){let t=l(e.id);return t.length>0?_(n).get(t)??k(e):k(e)}function S(e,n,t,o){let c=e,s=typeof c.id=="string"?o?.get(l(c.id))??M(c,[...n.values()]):k(e),i=new Set((e.dependencies??[]).filter(r=>m(r.kind)===g&&v(r.source_kind)&&typeof r.id=="string"&&r.id.trim().length>0).map(r=>b(r.id.trim(),!0)));return s.map(r=>{if(B(r)||i.has(b(r,!0)))return{id:r,title:null,status:null,resolved:!1,external:!0,...typeof e.updated_at=="string"?{blocked_since:e.updated_at}:{},resolver:null};let d=n.get(l(r));return d?{id:r,title:d.title,status:d.status,resolved:h(d.status,t)}:{id:r,title:null,status:null,resolved:!1}})}function R(e,n,t){return S(e,n,t)}function U(e,n){let t=new Map(e.map(i=>[l(i.id),i])),o=_(e),c=new Set([...z(n),...n.blocked_statuses]),s=new Set;for(let i of e){let r=I(i.status,n);if(!c.has(r))continue;(n.blocked_statuses.has(r)||S(i,t,n,o).some(f=>!f.resolved))&&s.add(l(i.id))}return s}function W(e,n,t={},o){let c=[...e.ready,...e.decisions,...e.gates];t.includeContainers===!0&&c.push(...e.containers.filter(i=>i.open_blockers.length===0&&!n.blocked_statuses.has(I(i.item.status,n))));let s={ready:[],decisions:[],gates:[]};for(let i of c){let r=E(i.item.type,o);r==="human"&&t.includeDecisions!==!0?s.decisions.push(i):r==="gate"&&t.includeGates!==!0?s.gates.push(i):s.ready.push(i)}return s}function z(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function $(e,n,t){let o=[l(e)],c=new Set;for(;o.length>0;){let s=o.pop();if(!c.has(s)){c.add(s);for(let i of n.get(s)??[]){if(!h(i.status,t))return!0;o.push(l(i.id))}}}return!1}function j(e){let n=new Map,t=new Map,o=new Map,c=_(e);for(let s of e){n.set(l(s.id),s);let i=typeof s.parent=="string"?s.parent.trim():"";if(i.length>0){let r=l(i),d=t.get(r)??[];d.push(s),t.set(r,d)}for(let r of c.get(l(s.id))){let d=l(r),f=o.get(d)??[];f.push(s.id),o.set(d,f)}}return{itemsById:n,childrenByParent:t,blockedByReverse:o,blockerIdsByItem:c}}function V(e,n,t,o){let{itemsById:c,childrenByParent:s,blockedByReverse:i,blockerIdsByItem:r}=j(n),d=new Set([...z(t),...t.blocked_statuses]),f=new Set(n.filter(a=>!h(a.status,t)).map(a=>l(a.id))),C=[],w=[],y=[],D=[],N=[],K=0;for(let a of e){if(!d.has(I(a.status,t)))continue;K+=1;let O=S(a,c,t,r).filter(u=>!u.resolved),Y=(i.get(l(a.id))??[]).filter(u=>f.has(l(u))).sort((u,F)=>u.localeCompare(F)),p={item:a,open_blockers:O,unblocks:Y};if($(a.id,s,t)){y.push(p);continue}let P=t.blocked_statuses.has(I(a.status,t));if(O.length===0&&!P){let u=E(a.type,o);u==="human"?D.push(p):u==="gate"?N.push(p):C.push(p)}else w.push(p)}return{ready:C,blocked:w,containers:y,decisions:D,gates:N,active_count:K,container_count:y.length}}export{E as a,G as b,k as c,_ as d,M as e,R as f,U as g,W as h,V as i};
|
|
2
|
+
//# sourceMappingURL=chunk-FM5WQ6ZU.js.map
|