@unbrained/pm-cli 2026.10.25 → 2026.10.26
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/CHANGELOG.md +28 -0
- package/dist/cli/error-guidance.d.ts +5 -0
- package/dist/cli/error-guidance.js +2 -2
- package/dist/cli/register-mutation.js +2 -2
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-O3ZTGRIH.js → chunk-25MTQAHX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TLMXSYJA.js → chunk-57YPOOED.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4GD6QOP6.js → chunk-7UDQAINZ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-LNKPH2DD.js → chunk-ER7RLJW5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YCCGZHOR.js → chunk-MWCG25PO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-444VPGQT.js → chunk-N6FTEILW.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-FNZT4BTE.js → chunk-NGKTROAO.js} +86 -86
- package/dist/cli-bundle/chunks/chunk-OCDRHIVQ.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-3CYXE6BV.js → chunk-ONC4BBQP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RQKDANP7.js → chunk-OUDR2HWR.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-RD6UW3MW.js → chunk-T7T4WLUY.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-MVJGGCGQ.js → chunk-TGOG5BFM.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-UF6EXZSP.js +2 -0
- package/dist/cli-bundle/chunks/chunk-VS2IIV3F.js +128 -0
- package/dist/cli-bundle/chunks/chunk-XAIR53QZ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-VAEB6IUQ.js → chunk-Y42DYMZX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-EYCVAAIP.js → chunk-YJBIPNDL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UI3FD3DW.js → chunk-Z35XAHUN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7C3GCLOO.js → chunk-ZLVFUZI4.js} +27 -27
- package/dist/cli-bundle/chunks/{chunk-7T3H24HN.js → chunk-ZT64RDMF.js} +2 -2
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-47I6KKDO.js → indexed-receipt-blobs-NWQIDTH7.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-admission-747C6IUR.js → mutation-admission-VTNV6JV2.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-COST6KRV.js → register-list-query-LZDWUZS4.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-M2A7PH42.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-S4LKLUBJ.js → register-operations-E7P2JTXM.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-3ITZXPOL.js → register-setup-DOV7KGSH.js} +2 -2
- package/dist/cli-bundle/chunks/{settlement-hook-5IVCF6ZY.js → settlement-hook-SVD6CO7U.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-3UUIYROS.js → stage-LYLEOAQB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HMYDUEQK.js → chunk-226XKW3W.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-ABMNYWV6.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3M5FZCMC.js → chunk-ADSBGYLW.js} +8 -8
- package/dist/cli-bundle/focused-chunks/{chunk-22727JYL.js → chunk-B266DDBJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y4JHHY24.js → chunk-BH7RE2ZY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-BL77VCRB.js +22 -0
- package/dist/cli-bundle/focused-chunks/{chunk-77NU7NPN.js → chunk-CSCZYSNZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-URWYYJ7K.js → chunk-D5YQ4KAE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZYCOMRFT.js → chunk-E5C24MCV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-74KC7FUQ.js → chunk-I7H3XF25.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-IF6C43IP.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-KERJNFXY.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-46KDJH3K.js → chunk-KTXU5WU6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-NE27VCU7.js +91 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NI5SG2M2.js → chunk-NFN2P4TW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NC5HUGHU.js → chunk-NLZUI234.js} +4 -4
- package/dist/cli-bundle/focused-chunks/chunk-PK5FJIVA.js +12 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LWJ2X75I.js → chunk-UHWTPOM4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-B5JOVH5F.js → chunk-UP765R2V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-U6HXIF6G.js → chunk-WDWHUJQW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7DEZT4JN.js → chunk-YQKLKRMW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YTEC2EPM.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3FM75SBJ.js → chunk-YW5GHQN2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-YCLN2ZZG.js → indexed-receipt-blobs-YFDNGHCM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-BQBQXILV.js → mutation-admission-L42E3U5U.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{settlement-hook-XVS6P2XI.js → settlement-hook-3CADO4XZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-VSIL4MTZ.js → stage-TUQHWU7N.js} +2 -2
- package/dist/cli-bundle/main.js +4 -4
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +23 -23
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +57 -57
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +9 -9
- package/dist/core/extensions/extension-types.d.ts +3 -0
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/policy/workflow-policy-store.js +1 -1
- package/dist/core/shared/errors.d.ts +9 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/shared/secret-rules.d.ts +17 -0
- package/dist/core/shared/secret-rules.js +2 -1
- package/dist/core/store/item-mutation-precondition.d.ts +8 -0
- package/dist/core/store/item-mutation-precondition.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
- package/dist/sdk/cli-contracts/completeness.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.d.ts +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +4 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/context-signal-store.js +2 -2
- package/dist/sdk/core.d.ts +1 -1
- package/dist/sdk/core.js +1 -1
- package/dist/sdk/extension-command-context.js +2 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/lifecycle/close-many.d.ts +3 -0
- package/dist/sdk/lifecycle/close-many.js +1 -1
- package/dist/sdk/lifecycle/close.d.ts +3 -1
- package/dist/sdk/lifecycle/close.js +1 -1
- package/dist/sdk/lifecycle/create.d.ts +2 -0
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/plan.d.ts +2 -0
- package/dist/sdk/lifecycle/plan.js +1 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle-policy.d.ts +11 -0
- package/dist/sdk/lifecycle-policy.js +1 -1
- package/dist/sdk/mutation-guard.d.ts +6 -1
- package/dist/sdk/mutation-guard.js +1 -1
- package/dist/sdk/output/fit-envelope.d.ts +98 -0
- package/dist/sdk/output/fit-envelope.js +2 -0
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query.d.ts +1 -0
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/read-output-session.d.ts +1 -1
- package/dist/sdk/read-output-session.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime.d.ts +2 -2
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/scheduling-shortcuts.d.ts +2 -0
- package/dist/sdk/scheduling-shortcuts.js +1 -1
- package/dist/sdk/workspace-transaction.d.ts +3 -1
- package/dist/sdk/workspace-transaction.js +2 -2
- package/docs/COMMANDS.md +2 -1
- package/docs/MUTATION_INTEGRITY.md +33 -0
- package/docs/QUALITY_EVIDENCE.md +9 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +55 -1
- package/docs/SDK.md +88 -6
- package/docs/WORKFLOW_POLICIES.md +14 -1
- package/docs/agent-task-token-baseline.json +1 -1
- package/docs/agent-task-transcripts.json +1 -1
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +1 -1
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/extensions/calendar/shortcuts.ts +2 -2
- 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-5ZPT67NJ.js +0 -127
- package/dist/cli-bundle/chunks/chunk-HMJSFWHK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RLXK2S7P.js +0 -2
- package/dist/cli-bundle/chunks/chunk-XYLBOXSH.js +0 -6
- package/dist/cli-bundle/chunks/register-mutation-JZVVJUHY.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-5LBZR6YW.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-IVLIUPVV.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-KIIGME23.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MT5TYMEU.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-QH5KMIYZ.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-W7MCCFYV.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WMPDY5ZU.js +0 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ze,e as Fe,f as $e,i as Ln,j as Hn,k as zn,l as Fn,m as $n}from"./chunk-22727JYL.js";import{h as Bn}from"./chunk-YLVHHWHN.js";import{Ad as q,B as Tn,Dc as Un,Dd as Wn,Ea as jn,Ed as qn,Fa as A,Ga as $,Gd as Gn,Ha as ot,Ia as y,Kd as M,ea as Dn,i as Qe,j as kn,ja as Pn,k as Sn,l as In,m as On,mc as Mn,oc as it,oe as Kt,q as et,r as tt,s as An,sc as Vn,wd as Me,x as rt,xd as W,y as nt,yd as st,z as Bt,za as Ee,zd as ke}from"./chunk-NC5HUGHU.js";import{B as Cn,C as ie,D as se,E as J,F as Nn,G as Jt,H as He,I as Rn,l as B,t as xn,w as p,x as Le,y as w,z as b}from"./chunk-46KDJH3K.js";import{createHash as us}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ca5b60a5-80a7-5e7d-917f-4c7649bcbab6")}catch{}})();var Ml=["sha256","sha512"],_s="sha256",Jn="sha256";function ae(e){if(e===void 0)return _s;if(e==="sha256"||e==="sha512")return e;throw new TypeError(`unsupported_history_hash_algorithm:${String(e)}`)}function K(e,t){return us(ae(t)).update(e,"utf8").digest("hex")}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4d5692ce-ec33-5eb4-bd9b-7497ffe25b0e")}catch{}})();var fs=16;function Xt(e){let t=e.trim().replaceAll(/[^A-Za-z0-9]+/g," ").split(/\s+/).filter(o=>o.length>0).map(o=>o.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(o=>`${o.slice(0,1).toUpperCase()}${o.slice(1)}`).join("")}`}function ms(e){return[...new Set([$n(e),Xt(e.key),Xt(e.cli_flag),...e.cli_aliases.map(t=>Xt(t))])]}function Yn(e,t){for(let r of ms(t)){if(!Object.hasOwn(e,r))continue;let n=e[r];if(n!==void 0)return n}}function Zn(e){return Array.isArray(e)?e.flatMap(t=>Zn(t)).map(t=>t.trim()).filter(t=>t.length>0):typeof e=="string"?e.split(/[,\n|]/).map(t=>t.trim()).filter(t=>t.length>0):e==null?[]:[String(e).trim()].filter(t=>t.length>0)}function Kn(e,t){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e=="string"){let r=e.trim().toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}throw new b(`${t} must be one of true|false|1|0|yes|no`,w.USAGE)}function Xn(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;let r=typeof e=="string"?e.trim():String(e),n=Number(r);if(!Number.isFinite(n))throw new b(`${t} must be a number`,w.USAGE);return n}function ps(e,t,r){let n=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return}})():e;if(r==="array"&&Array.isArray(n)||r==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n;throw new b(`${t} must be valid JSON ${r}`,w.USAGE)}function hs(e,t){return t===void 0?!0:t==="array"?Array.isArray(e):t==="object"?typeof e=="object"&&e!==null&&!Array.isArray(e):typeof e===t}function ys(e,t,r){if(t.const!==void 0&&A(e)!==A(t.const))return`${r} must equal ${A(t.const)}`;if(t.enum!==void 0&&!t.enum.some(n=>A(n)===A(e)))return`${r} must be one of ${t.enum.map(n=>A(n)).join("|")}`;if(!hs(e,t.type))return`${r} must match configured type ${String(t.type)}`;if(typeof e=="string"){if(t.min_length!==void 0&&e.length<t.min_length)return`${r} must contain at least ${t.min_length} characters`;if(t.format==="date-time"&&!st(e))return`${r} must be an RFC 3339 date-time`}}function gs(e,t,r,n){if(Array.isArray(e)){if(t.min_items!==void 0&&e.length<t.min_items)return`${r} must contain at least ${t.min_items} items`;if(t.items)for(let[o,i]of e.entries()){let s=at(i,t.items,`${r}[${o}]`,n+1);if(s)return s}}}function vs(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))return;let o=e;for(let i of t.required??[])if(!Object.hasOwn(o,i))return`${r}.${i} is required`;for(let[i,s]of Object.entries(o)){let a=t.properties?.[i];if(!a){if(t.additional_properties===!1)return`${r}.${i} is not allowed`;continue}let d=at(s,a,`${r}.${i}`,n+1);if(d)return d}}function at(e,t,r,n=0){if(n>fs)return`${r} value schema exceeds maximum depth`;let o=ys(e,t,r);if(o)return o;let i=gs(e,t,r,n);if(i)return i;let s=vs(e,t,r,n);if(s)return s;if(!t.one_of)return;let a=0;for(let d of t.one_of)if(at(e,d,r,n+1)===void 0&&(a+=1,a>1))break;return a===1?void 0:`${r} must match exactly one configured schema variant`}function ce(e,t,r){if(!e.value_schema||t===void 0)return t;let n=at(t,e.value_schema,r);if(n)throw new b(n,w.USAGE);return t}function bs(e,t,r,n){let o=n==="option"&&Array.isArray(t)?t[t.length-1]:t;if(o!==void 0)return ce(e,ps(o,r,e.type),r)}function Ve(e,t,r,n="option"){let o=r??`--${e.cli_flag}`;if(e.type==="array"||e.type==="object")return bs(e,t,o,n);if(e.repeatable||e.type==="string_array"){let s=Zn(t);return e.type==="number"?ce(e,s.map(a=>Xn(a,o)),o):e.type==="boolean"?ce(e,s.map(a=>Kn(a,o)),o):ce(e,s,o)}let i=Array.isArray(t)?t[t.length-1]:t;if(i!==void 0)return e.type==="number"?ce(e,Xn(i,o),o):e.type==="boolean"?ce(e,Kn(i,o),o):ce(e,typeof i=="string"?i:String(i),o)}function ws(e,t){return!e.required&&!e.required_on_create?!1:e.required_types.length===0?!0:t?e.required_types.map(r=>r.toLowerCase()).includes(t.trim().toLowerCase()):!1}function Jl(e,t,r){let n={},o=[];for(let i of t.command_to_fields.get("create")??[]){let s=Yn(e,i);if(s===void 0){ws(i,r)&&o.push(`--${i.cli_flag}`);continue}n[i.metadata_key]=Ve(i,s)}return{values:n,missing_required_flags:[...new Set(o)].sort((i,s)=>i.localeCompare(s))}}function Kl(e,t,r=["update"]){let n={},o=(r??["update"]).flatMap(s=>t.command_to_fields.get(s)??[]),i=new Set;for(let s of o){let a=Yn(e,s);a!==void 0&&(i.has(s.metadata_key)||(i.add(s.metadata_key),n[s.metadata_key]=Ve(s,a)))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c35d4830-d7d1-5ee4-99bc-ab52cc3e4e09")}catch{}})();var Yt=1,Zt=2;function Yl(e){return Math.max(Qt(e),e.tests?.some(t=>t.updated_by!==void 0||t.updated_at!==void 0)?2:1)}function Qt(e){let t=e.pm_format_version;return typeof t=="number"&&Number.isInteger(t)&&t>=1?t:1}function Qn(e){if(!(typeof e!="number"||!Number.isInteger(e)||e<=1))return e}function Es(e,t=2,r=t){return e<r?"outdated":e>t?"ahead":"current"}function Zl(e,t=2,r=t){let n=[],o=[];for(let i of e){let s=Es(i.version,t,r);s==="outdated"?n.push(i.ref):s==="ahead"&&o.push(i.ref)}return{outdated:n.sort((i,s)=>i.localeCompare(s)),ahead:o.sort((i,s)=>i.localeCompare(s))}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="515840b7-cf86-5d71-8ac1-beac7fd7c8a8")}catch{}})();var ks={"in-progress":"in_progress",cancelled:"canceled"};function ct(e,t){if(t){let o=zn(e,t);if(o)return o}if(typeof e!="string")return;let r=e.trim().toLowerCase();if(!r)return;let n=ks[r]??r;if(Qe.includes(n))return n}function Ss(e,t){return ct(e,t)??e}function ru(e,t){return t.terminal_statuses.has(Ss(e,t))}import{encode as Ts}from"@toon-format/toon";import{isDeepStrictEqual as eo}from"node:util";import{decode as Is}from"@toon-format/toon";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aaa2be03-9478-5fbe-82e6-e4fc86e3735b")}catch{}})();function er(e){return{value:Is(e),usedScalarBracketEscape:!1}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="79626299-17a8-573a-9b66-ce37c65e2f5d")}catch{}})();var Os=/^\s*(<<<<<<<|=======|>>>>>>>)(?:\s.*)?$/;function As(e){if(e.length===0)return[];let t=e.split(/\r?\n/),r=[];for(let n=0;n<t.length;n+=1){let o=t[n]??"",i=o.match(Os);if(!i)continue;let s=i[1];r.push({line:n+1,marker:s,text:o})}return r}function dt(e){return As(e)[0]}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2789e87f-0706-52e8-8f4c-3855c65c618c")}catch{}})();var or=new Set(["schema","tracker","auto","none"]),io=new Set(["source","isolated","snapshot"]),xs=new Set(["legacy","local_mutation","local_source_ref","acknowledged","invalid_provenance","foreign_source_ref"]),Cs=new Set(["passed","failed","stopped","canceled"]),Ns=new Set(Tn);function Oe(e){return e.replaceAll("\\","/")}function so(e){for(let t of e)if(t!==0)return t;return 0}function ut(e){for(let[t,r]of Object.entries(e))r===void 0&&delete e[t]}var ao=["id","title","description","created_at","updated_at"],Rs=new Set(B);function co(e){if(e?.schema)return{statusRegistry:Hn(e.schema),fieldRegistry:Fn(e.schema),unknownFieldPolicy:e.schema.unknown_field_policy??"allow",extensionFieldNames:new Set(e.extensionFieldNames??[]),onWarning:e.onWarning}}function Ds(e,t){return e.required?e.required_types.length===0?!0:e.required_types.map(r=>r.toLowerCase()).includes(t.trim().toLowerCase()):!1}function X(e){let t=e.match(/^([a-z_][\w.]*)\s/u)?.[1];throw new b(`Invalid item metadata: ${e}`,w.GENERIC_FAILURE,{code:"item_document_invalid",reason:e.includes("required")?"missing_required_field":"schema_validation_error",...t?{field:t}:{},required:"Provide an item document whose metadata satisfies the active runtime schema.",why:e})}function qe(e,t){throw new b(t,w.GENERIC_FAILURE,{code:"item_document_invalid",reason:"syntax_error",format:e,required:`Provide a syntactically valid ${e==="toon"?"TOON":"JSON Markdown"} item document.`,why:"The document could not be decoded far enough to validate item metadata."})}function lo(e,t){if(!t||typeof e!="object"||e===null)return;let r=Qt(e);if(!(r<=Zt))throw new b(`Stored item uses format version ${r}; this runtime supports up to ${Zt}. Upgrade pm before reading or changing this item.`,w.CONFLICT,{code:"item_format_version_unsupported",format_version:r,required:"Upgrade to a pm runtime supporting the stored item format.",nextSteps:["Preserve the original item and history; do not lower pm_format_version to bypass compatibility checks."]})}function uo(e){let t=new Set(Rs);for(let r of e.fieldRegistry?.definitions??[])t.add(r.metadata_key);for(let r of e.extensionFieldNames)t.add(r);return t}function h(e,t){e||X(t)}function Ge(e,t){return(typeof e!="object"||e===null||Array.isArray(e))&&X(t),e}function tr(e,t){let r=e[t];h(typeof r=="string",`${t} must be a string`),h(W(r),`${t} must be a valid ISO timestamp`)}function to(e,t,r){let n=e[t];n!==void 0&&h(typeof n=="number"&&Number.isInteger(n)&&n>=1,`${r} must be an integer >= 1`)}function ir(e,t,r){let n=e[t];n!==void 0&&(h(typeof n=="string",`${r} must be a string`),h(W(n),`${r} must be a valid ISO timestamp`))}function Ps(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.by_weekday must be an array");for(let t of e){h(typeof t=="string","event.recurrence.by_weekday entries must be strings");let r=t.trim().toLowerCase();h(nt.includes(r),`event.recurrence.by_weekday entries must be one of: ${nt.join(", ")}`)}}}function js(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.by_month_day must be an array");for(let t of e)h(typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=31,"event.recurrence.by_month_day entries must be integers 1..31")}}function Ls(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.exdates must be an array");for(let t of e)h(typeof t=="string","event.recurrence.exdates entries must be strings"),h(W(t),"event.recurrence.exdates entries must be valid ISO timestamps")}}function Hs(e){let t=Ge(e,"event.recurrence must be an object");h(typeof t.freq=="string","event.recurrence.freq must be a string");let r=t.freq.trim().toLowerCase();h(rt.includes(r),`event.recurrence.freq must be one of: ${rt.join(", ")}`),to(t,"interval","event.recurrence.interval"),to(t,"count","event.recurrence.count"),ir(t,"until","event.recurrence.until"),Ps(t.by_weekday),js(t.by_month_day),Ls(t.exdates)}function zs(e){for(let n of ao)h(typeof e[n]=="string",`${n} is required and must be a string`);let t=e.type;h(typeof t=="string"&&t.trim().length>0,"type must be a non-empty string");let r=e.pm_format_version;return r!==void 0&&h(typeof r=="number"&&Number.isInteger(r)&&r>=Yt,`pm_format_version must be an integer >= ${Yt}`),t}function Fs(e,t){let r=e.status;h(typeof r=="string"&&r.trim().length>0,"status must be a non-empty string");let n=t?.statusRegistry,o=ct(r,n),i=n?n.definitions.map(s=>s.id):[...Qe];h(o!==void 0,`status must be one of: ${i.join(", ")}`)}function $s(e){let t=e.priority;h(typeof t=="number"&&Number.isInteger(t)&&[0,1,2,3,4].includes(t),"priority must be an integer 0..4");let r=e.tags;h(Array.isArray(r),"tags must be an array");for(let n of r)h(typeof n=="string","tags entries must be strings")}function Ms(e){let t=e.confidence;if(t!==void 0){if(typeof t=="number"){h(Number.isInteger(t)&&t>=0&&t<=100,"confidence number value must be an integer 0..100");return}if(typeof t=="string"){let r=t.trim().toLowerCase(),n=r==="med"||tt.includes(r);h(n,`confidence string value must be one of: ${[...tt,"med"].join(", ")}`);return}h(!1,"confidence must be a number or string")}}function Vs(e){let t=e.severity;if(t===void 0)return;typeof t!="string"&&X("severity must be a string");let r=t.trim().toLowerCase(),n=r==="med"||et.includes(r);h(n,`severity value must be one of: ${[...et,"med"].join(", ")}`)}function Us(e){e.regression!==void 0&&typeof e.regression!="boolean"&&X("regression must be a boolean")}function Ws(e){let t=e.reminders;if(t!==void 0){h(Array.isArray(t),"reminders must be an array");for(let r of t){let n=Ge(r,"reminders entries must be objects");h(typeof n.at=="string","reminder.at must be a string"),h(W(n.at),"reminder.at must be a valid ISO timestamp"),h(typeof n.text=="string","reminder.text must be a string"),h(n.text.trim().length>0,"reminder.text must not be empty")}}}function qs(e){for(let t of["title","description","location","timezone"])e[t]!==void 0&&(h(typeof e[t]=="string",`event.${t} must be a string`),h(e[t].trim().length>0,`event.${t} must not be empty`))}function Gs(e){e.recurrence!==void 0&&(Hs(e.recurrence),e.recurrence.until!==void 0&&h(q(e.recurrence.until,e.start_at)>=0,"event.recurrence.until must be at or after event.start_at"))}function Bs(e){let t=Ge(e,"events entries must be objects");h(typeof t.start_at=="string","event.start_at must be a string"),h(W(t.start_at),"event.start_at must be a valid ISO timestamp"),t.end_at!==void 0&&(h(typeof t.end_at=="string","event.end_at must be a string"),h(W(t.end_at),"event.end_at must be a valid ISO timestamp"),h(q(t.end_at,t.start_at)>0,"event.end_at must be after event.start_at")),qs(t),t.all_day!==void 0&&h(typeof t.all_day=="boolean","event.all_day must be a boolean"),Gs(t)}function Js(e){let t=e.events;if(t!==void 0){h(Array.isArray(t),"events must be an array");for(let r of t)Bs(r)}}function Ks(e){for(let t of["source_type","source_owner","design","external_ref"]){let r=e[t];r!==void 0&&h(typeof r=="string",`${t} must be a string`)}}function Xs(e){let t=e.type_options;if(t===void 0)return;let r=Ge(t,"type_options must be an object");for(let[n,o]of Object.entries(r))h(n.trim().length>0,"type_options keys must be non-empty"),h(typeof o=="string","type_options values must be strings"),h(o.trim().length>0,"type_options values must be non-empty strings")}function Ys(e,t,r){if(r?.fieldRegistry)for(let n of r.fieldRegistry.definitions){let o=e[n.metadata_key];if(o===void 0){Ds(n,t)&&X(`missing required schema field: ${n.metadata_key}`);continue}try{e[n.metadata_key]=Ve(n,o,`metadata field "${n.metadata_key}"`,"metadata")}catch(i){X(String(i?.message).replace(/^Invalid\s+/u,""))}}}function Zs(e,t){if(!t||t.unknownFieldPolicy==="allow")return;let r=uo(t),n=Object.keys(e).filter(o=>!r.has(o)).sort((o,i)=>o.localeCompare(i));n.length!==0&&(t.unknownFieldPolicy==="reject"?X(`unknown schema fields are not allowed: ${n.join(", ")}`):t.onWarning?.(`item_unknown_schema_fields:${n.join(",")}`))}function sr(e,t){let r=Ge(e,"item metadata must be an object"),n=zs(r);Fs(r,t),$s(r),Ms(r),Vs(r),Us(r),tr(r,"created_at"),tr(r,"updated_at"),r.deadline!==void 0&&tr(r,"deadline"),Ws(r),Js(r),ir(r,"closed_at","closed_at"),ir(r,"completed_at","completed_at"),Ks(r),Xs(r),Ys(r,n,t),Zs(r,t)}function Qs(e){if(!(!e||e.length===0))return[...e].map((t,r)=>(h(t.created_at===void 0||typeof t.created_at=="string"&&st(t.created_at),`dependencies.${r}.created_at requires a valid timestamp; restore the dependency timestamp from its source record`),{id:t.id.trim(),kind:t.kind,created_at:t.created_at,author:t.author?.trim()||void 0,source_kind:t.source_kind?.trim()||void 0,author_source:t.author_source})).sort((t,r)=>{let n=q(t.created_at??"",r.created_at??"");if(n!==0)return n;let o=t.id.localeCompare(r.id);if(o!==0)return o;let i=t.kind.localeCompare(r.kind);return i!==0?i:(t.source_kind??"").localeCompare(r.source_kind??"")})}function rr(e){if(!(!e||e.length===0))return[...e].sort((t,r)=>{let n=q(t.created_at,r.created_at);if(n!==0)return n;let o=t.text.localeCompare(r.text);return o!==0?o:t.author.localeCompare(r.author)})}function ea(e){if(!e||e.length===0)return;let t=[...e].map(r=>({at:r.at,text:r.text.trim()})).filter(r=>r.text.length>0).sort((r,n)=>{let o=q(r.at,n.at);return o!==0?o:r.text.localeCompare(n.text)});return t.length===0?void 0:t}function ta(e){if(!e)return;let t=e.freq.trim().toLowerCase();if(!rt.includes(t))return;let r=Array.from(new Set((e.by_weekday??[]).map(s=>s.trim().toLowerCase()).filter(s=>nt.includes(s)))).sort((s,a)=>Bt(s)-Bt(a)),n=Array.from(new Set((e.by_month_day??[]).filter(s=>Number.isInteger(s)&&s>=1&&s<=31).map(s=>s))).sort((s,a)=>s-a),o=Array.from(new Set((e.exdates??[]).map(s=>s.trim()).filter(s=>W(s)))).sort((s,a)=>q(s,a)),i={freq:t,interval:e.interval!==void 0&&e.interval>1?e.interval:void 0,count:e.count,until:e.until?.trim()||void 0,by_weekday:r.length>0?r:void 0,by_month_day:n.length>0?n:void 0,exdates:o.length>0?o:void 0};for(let[s,a]of Object.entries(i))a===void 0&&delete i[s];return i}function ra(e){return!Array.isArray(e)||e.length===0?void 0:[...e].map(na).sort(oa)}function na(e){let t={start_at:e.start_at,end_at:e.end_at||void 0,title:e.title?.trim()||void 0,description:e.description?.trim()||void 0,location:e.location?.trim()||void 0,all_day:e.all_day,timezone:e.timezone?.trim()||void 0,recurrence:ta(e.recurrence)};return ut(t),t}function oa(e,t){return so([q(e.start_at,t.start_at),(e.end_at??"").localeCompare(t.end_at??""),(e.title??"").localeCompare(t.title??""),+!!e.all_day-+!!t.all_day,(e.timezone??"").localeCompare(t.timezone??""),(e.location??"").localeCompare(t.location??""),(e.description??"").localeCompare(t.description??""),JSON.stringify(e.recurrence??{}).localeCompare(JSON.stringify(t.recurrence??{}))])}function ia(e){if(!(!e||e.length===0))return e.map(t=>({path:Oe(t.path),scope:t.scope,note:t.note?.trim()||void 0}))}function sa(e){if(!e||e.length===0)return;let t=e.map(la).filter(r=>r.run_id.length>0&&r.started_at.length>0&&r.finished_at.length>0&&r.recorded_at.length>0).sort((r,n)=>so([q(r.recorded_at,n.recorded_at),r.run_id.localeCompare(n.run_id),r.kind.localeCompare(n.kind)]));return t.length>0?t:void 0}function Se(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0}function aa(e){return typeof e=="number"&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0}function nr(e){return typeof e=="string"?e:""}function ca(e){if(!Array.isArray(e))return;let t=e.filter(n=>n!==null&&typeof n=="object"&&typeof n.name=="string"&&n.name.trim().length>0&&typeof n.value=="number"&&Number.isFinite(n.value)&&typeof n.recorded_at=="string"&&n.recorded_at.trim().length>0).map(n=>({name:n.name.trim(),value:n.value,unit:typeof n.unit=="string"&&n.unit.trim()||void 0,threshold:typeof n.threshold=="number"&&Number.isFinite(n.threshold)?n.threshold:void 0,recorded_at:n.recorded_at.trim()})),r=[...new Map(t.map(n=>[n.name,n])).values()].sort((n,o)=>n.name.localeCompare(o.name)).slice(0,32);return r.length>0?r:void 0}function lt(e,t){return typeof e=="string"&&t.has(e)?e:void 0}function da(e){if(!Array.isArray(e))return;let t=e.filter(r=>r&&typeof r.command=="string"&&r.command.trim().length>0).slice(0,32).map(r=>({command:r.command.trim(),requested_pm_context_mode:lt(r.requested_pm_context_mode,or),pm_context_mode:lt(r.pm_context_mode,or),workspace_context_mode:lt(r.workspace_context_mode,io),trust_reason:lt(r.trust_reason,xs)}));return t.length>0?t:void 0}function la(e){let t=typeof e.run_id=="string"?e.run_id.trim():"",r=e.kind==="test"||e.kind==="test-all"?e.kind:"test",n=Cs.has(e.status)?e.status:"failed",o={run_id:t,kind:r,status:n,started_at:nr(e.started_at),finished_at:nr(e.finished_at),recorded_at:nr(e.recorded_at),attempt:aa(e.attempt),resumed_from:e.resumed_from?.trim()||void 0,passed:Se(e.passed)??0,failed:Se(e.failed)??0,skipped:Se(e.skipped)??0,items:Se(e.items),linked_tests:Se(e.linked_tests),fail_on_skipped_triggered:e.fail_on_skipped_triggered===!0?!0:void 0,measurements:ca(e.measurements),executions:da(e.executions)};return ut(o),o}function ua(e){if(!(!Array.isArray(e)||e.length===0))return e.map(ha)}function Ue(e){if(!Array.isArray(e))return;let t=[...new Set(e.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n));return t.length>0?t:void 0}function lr(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ur(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function ro(e){if(!lr(e))return;let t=Object.entries(e).map(([r,n])=>[r.trim(),String(n).trim()]).filter(([r,n])=>r.length>0&&!ur(r)&&n.length>0).sort(([r],[n])=>r.localeCompare(n));return t.length>0?Object.fromEntries(t):void 0}function _a(e){if(!lr(e))return;let t=Object.entries(e).map(([r,n])=>[r.trim(),Number(n)]).filter(([r,n])=>r.length>0&&!ur(r)&&Number.isFinite(n)).sort(([r],[n])=>r.localeCompare(n));return t.length>0?Object.fromEntries(t):void 0}function fa(e){let t=e?.trim().toLowerCase();if(!(!t||!or.has(t)))return t}function ma(e){let t=e?.trim().toLowerCase();if(!(!t||!io.has(t)))return t}function pa(e,t){if(t===!0)return{provenance_invalid:!0};if(e===void 0)return{};if(!lr(e))return{provenance_invalid:!0};let r=f(e.author),n=f(e.created_at),o=e.source_kind;return!r||!n||!W(n)||o!=="local_mutation"&&o!=="merge_union"?{provenance_invalid:!0}:{provenance:{author:r,created_at:n,source_kind:o,source_ref:f(e.source_ref)}}}function ha(e){let t={command:e.command?.trim()||void 0,path:e.path?Oe(e.path):void 0,scope:e.scope,timeout_seconds:typeof e.timeout_seconds=="number"&&Number.isFinite(e.timeout_seconds)&&e.timeout_seconds>0?e.timeout_seconds:void 0,pm_context_mode:fa(e.pm_context_mode),workspace_context_mode:ma(e.workspace_context_mode),...pa(e.provenance,e.provenance_invalid),updated_by:f(e.updated_by),updated_at:f(e.updated_at),env_set:ro(e.env_set),env_clear:Ue(e.env_clear),shared_host_safe:e.shared_host_safe===!0?!0:void 0,assert_stdout_contains:Ue(e.assert_stdout_contains),assert_stdout_regex:Ue(e.assert_stdout_regex),assert_stderr_contains:Ue(e.assert_stderr_contains),assert_stderr_regex:Ue(e.assert_stderr_regex),assert_stdout_min_lines:Se(e.assert_stdout_min_lines),assert_json_field_equals:ro(e.assert_json_field_equals),assert_json_field_gte:_a(e.assert_json_field_gte),note:e.note?.trim()||void 0};return ut(t),t}function ya(e){if(!(!e||e.length===0))return[...e].map(t=>({path:Oe(t.path),scope:t.scope,note:t.note?.trim()||void 0})).sort((t,r)=>{let n=t.scope.localeCompare(r.scope);if(n!==0)return n;let o=t.path.localeCompare(r.path);return o!==0?o:(t.note??"").localeCompare(r.note??"")})}function f(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function ga(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.id),i=f(n.kind);if(!o||!i)continue;let s={id:o,kind:i},a=f(n.note);a&&(s.note=a),n.required_before_step===!0&&(s.required_before_step=!0),t.push(s)}return t.length>0?t:void 0}function va(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.path);if(!o)continue;let i={path:Oe(o)};(n.scope==="project"||n.scope==="global")&&(i.scope=n.scope);let s=f(n.note);s&&(i.note=s),t.push(i)}return t.length>0?t:void 0}function ba(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.command),i=f(n.path);if(!o&&!i)continue;let s={};o&&(s.command=o),i&&(s.path=Oe(i));let a=f(n.note);a&&(s.note=a),t.push(s)}return t.length>0?t:void 0}function wa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.path);if(!o)continue;let i={path:Oe(o)};(n.scope==="project"||n.scope==="global")&&(i.scope=n.scope);let s=f(n.note);s&&(i.note=s),t.push(i)}return t.length>0?t:void 0}function Ea(e){if(e===null||typeof e!="object")return;let t=e,r=f(t.id),n=f(t.title),o=f(t.status),i=o&&Ns.has(o)?o:void 0,s=Dn(t.order)??Number.NaN,a=typeof t.created_at=="string"?t.created_at:"",d=typeof t.updated_at=="string"?t.updated_at:"";if(!r||!n||!i||!Number.isFinite(s)||!a||!d)return;let l={id:r,order:s,title:n,status:i,created_at:a,updated_at:d};return ka(l,t),l}function ka(e,t){let r=[["body","body"],["owner","owner"],["evidence","evidence"],["blocked_reason","blocked_reason"],["superseded_by","superseded_by"]];for(let[i,s]of r){let a=f(t[s]);a&&(e[i]=a)}let n=typeof t.completed_at=="string"?t.completed_at:void 0;n&&n.length>0&&(e.completed_at=n);let o=[["linked_items","linked_items",ga],["files","files",va],["tests","tests",ba],["docs","docs",wa]];for(let[i,s,a]of o){let d=a(t[s]);d&&(e[i]=d)}}function Sa(e){if(!Array.isArray(e))return;let t=e.flatMap(r=>{let n=Ea(r);return n?[n]:[]});return t.sort((r,n)=>r.order-n.order),t.length>0?t:void 0}function Ia(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=typeof n.ts=="string"?n.ts:"",i=typeof n.author=="string"?n.author:"",s=f(n.decision);if(!o||!i||!s)continue;let a={ts:o,author:i,decision:s},d=f(n.rationale);d&&(a.rationale=d);let l=f(n.evidence);l&&(a.evidence=l);let _=f(n.step_id);_&&(a.step_id=_),t.push(a)}return t.length>0?t:void 0}function Oa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=typeof n.ts=="string"?n.ts:"",i=typeof n.author=="string"?n.author:"",s=f(n.text);if(!o||!i||!s)continue;let a={ts:o,author:i,text:s},d=f(n.step_id);d&&(a.step_id=d),t.push(a)}return t.length>0?t:void 0}function Aa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.text);if(!o)continue;let i={text:o},s=f(n.command);s&&(i.command=s);let a=f(n.expected);a&&(i.expected=a),t.push(i)}return t.length>0?t:void 0}function Ta(e){if(!e)return;let t=Object.entries(e).map(([r,n])=>[r.trim(),n.trim()]).filter(([r,n])=>r.length>0&&n.length>0).sort((r,n)=>r[0].localeCompare(n[0]));if(t.length!==0)return Object.fromEntries(t)}function Ie(e){let t=0;for(;t<e.length&&e[t]===`
|
|
1
|
+
import{c as ze,e as Fe,f as $e,i as Ln,j as Hn,k as zn,l as Fn,m as $n}from"./chunk-B266DDBJ.js";import{h as Bn}from"./chunk-YLVHHWHN.js";import{Ad as q,B as Tn,Dc as Un,Dd as Wn,Ea as jn,Ed as qn,Fa as A,Ga as $,Gd as Gn,Ha as ot,Ia as y,Kd as M,ea as Dn,i as Qe,j as kn,ja as Pn,k as Sn,l as In,m as On,mc as Mn,oc as it,oe as Kt,q as et,r as tt,s as An,sc as Vn,wd as Me,x as rt,xd as W,y as nt,yd as st,z as Bt,za as Ee,zd as ke}from"./chunk-NLZUI234.js";import{B as Cn,C as ie,D as se,E as J,F as Nn,G as Jt,H as He,I as Rn,l as B,t as xn,w as p,x as Le,y as w,z as b}from"./chunk-KTXU5WU6.js";import{createHash as us}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ca5b60a5-80a7-5e7d-917f-4c7649bcbab6")}catch{}})();var Ml=["sha256","sha512"],_s="sha256",Jn="sha256";function ae(e){if(e===void 0)return _s;if(e==="sha256"||e==="sha512")return e;throw new TypeError(`unsupported_history_hash_algorithm:${String(e)}`)}function K(e,t){return us(ae(t)).update(e,"utf8").digest("hex")}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4d5692ce-ec33-5eb4-bd9b-7497ffe25b0e")}catch{}})();var fs=16;function Xt(e){let t=e.trim().replaceAll(/[^A-Za-z0-9]+/g," ").split(/\s+/).filter(o=>o.length>0).map(o=>o.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(o=>`${o.slice(0,1).toUpperCase()}${o.slice(1)}`).join("")}`}function ms(e){return[...new Set([$n(e),Xt(e.key),Xt(e.cli_flag),...e.cli_aliases.map(t=>Xt(t))])]}function Yn(e,t){for(let r of ms(t)){if(!Object.hasOwn(e,r))continue;let n=e[r];if(n!==void 0)return n}}function Zn(e){return Array.isArray(e)?e.flatMap(t=>Zn(t)).map(t=>t.trim()).filter(t=>t.length>0):typeof e=="string"?e.split(/[,\n|]/).map(t=>t.trim()).filter(t=>t.length>0):e==null?[]:[String(e).trim()].filter(t=>t.length>0)}function Kn(e,t){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e=="string"){let r=e.trim().toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}throw new b(`${t} must be one of true|false|1|0|yes|no`,w.USAGE)}function Xn(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;let r=typeof e=="string"?e.trim():String(e),n=Number(r);if(!Number.isFinite(n))throw new b(`${t} must be a number`,w.USAGE);return n}function ps(e,t,r){let n=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return}})():e;if(r==="array"&&Array.isArray(n)||r==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n;throw new b(`${t} must be valid JSON ${r}`,w.USAGE)}function hs(e,t){return t===void 0?!0:t==="array"?Array.isArray(e):t==="object"?typeof e=="object"&&e!==null&&!Array.isArray(e):typeof e===t}function ys(e,t,r){if(t.const!==void 0&&A(e)!==A(t.const))return`${r} must equal ${A(t.const)}`;if(t.enum!==void 0&&!t.enum.some(n=>A(n)===A(e)))return`${r} must be one of ${t.enum.map(n=>A(n)).join("|")}`;if(!hs(e,t.type))return`${r} must match configured type ${String(t.type)}`;if(typeof e=="string"){if(t.min_length!==void 0&&e.length<t.min_length)return`${r} must contain at least ${t.min_length} characters`;if(t.format==="date-time"&&!st(e))return`${r} must be an RFC 3339 date-time`}}function gs(e,t,r,n){if(Array.isArray(e)){if(t.min_items!==void 0&&e.length<t.min_items)return`${r} must contain at least ${t.min_items} items`;if(t.items)for(let[o,i]of e.entries()){let s=at(i,t.items,`${r}[${o}]`,n+1);if(s)return s}}}function vs(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))return;let o=e;for(let i of t.required??[])if(!Object.hasOwn(o,i))return`${r}.${i} is required`;for(let[i,s]of Object.entries(o)){let a=t.properties?.[i];if(!a){if(t.additional_properties===!1)return`${r}.${i} is not allowed`;continue}let d=at(s,a,`${r}.${i}`,n+1);if(d)return d}}function at(e,t,r,n=0){if(n>fs)return`${r} value schema exceeds maximum depth`;let o=ys(e,t,r);if(o)return o;let i=gs(e,t,r,n);if(i)return i;let s=vs(e,t,r,n);if(s)return s;if(!t.one_of)return;let a=0;for(let d of t.one_of)if(at(e,d,r,n+1)===void 0&&(a+=1,a>1))break;return a===1?void 0:`${r} must match exactly one configured schema variant`}function ce(e,t,r){if(!e.value_schema||t===void 0)return t;let n=at(t,e.value_schema,r);if(n)throw new b(n,w.USAGE);return t}function bs(e,t,r,n){let o=n==="option"&&Array.isArray(t)?t[t.length-1]:t;if(o!==void 0)return ce(e,ps(o,r,e.type),r)}function Ve(e,t,r,n="option"){let o=r??`--${e.cli_flag}`;if(e.type==="array"||e.type==="object")return bs(e,t,o,n);if(e.repeatable||e.type==="string_array"){let s=Zn(t);return e.type==="number"?ce(e,s.map(a=>Xn(a,o)),o):e.type==="boolean"?ce(e,s.map(a=>Kn(a,o)),o):ce(e,s,o)}let i=Array.isArray(t)?t[t.length-1]:t;if(i!==void 0)return e.type==="number"?ce(e,Xn(i,o),o):e.type==="boolean"?ce(e,Kn(i,o),o):ce(e,typeof i=="string"?i:String(i),o)}function ws(e,t){return!e.required&&!e.required_on_create?!1:e.required_types.length===0?!0:t?e.required_types.map(r=>r.toLowerCase()).includes(t.trim().toLowerCase()):!1}function Jl(e,t,r){let n={},o=[];for(let i of t.command_to_fields.get("create")??[]){let s=Yn(e,i);if(s===void 0){ws(i,r)&&o.push(`--${i.cli_flag}`);continue}n[i.metadata_key]=Ve(i,s)}return{values:n,missing_required_flags:[...new Set(o)].sort((i,s)=>i.localeCompare(s))}}function Kl(e,t,r=["update"]){let n={},o=(r??["update"]).flatMap(s=>t.command_to_fields.get(s)??[]),i=new Set;for(let s of o){let a=Yn(e,s);a!==void 0&&(i.has(s.metadata_key)||(i.add(s.metadata_key),n[s.metadata_key]=Ve(s,a)))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c35d4830-d7d1-5ee4-99bc-ab52cc3e4e09")}catch{}})();var Yt=1,Zt=2;function Yl(e){return Math.max(Qt(e),e.tests?.some(t=>t.updated_by!==void 0||t.updated_at!==void 0)?2:1)}function Qt(e){let t=e.pm_format_version;return typeof t=="number"&&Number.isInteger(t)&&t>=1?t:1}function Qn(e){if(!(typeof e!="number"||!Number.isInteger(e)||e<=1))return e}function Es(e,t=2,r=t){return e<r?"outdated":e>t?"ahead":"current"}function Zl(e,t=2,r=t){let n=[],o=[];for(let i of e){let s=Es(i.version,t,r);s==="outdated"?n.push(i.ref):s==="ahead"&&o.push(i.ref)}return{outdated:n.sort((i,s)=>i.localeCompare(s)),ahead:o.sort((i,s)=>i.localeCompare(s))}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="515840b7-cf86-5d71-8ac1-beac7fd7c8a8")}catch{}})();var ks={"in-progress":"in_progress",cancelled:"canceled"};function ct(e,t){if(t){let o=zn(e,t);if(o)return o}if(typeof e!="string")return;let r=e.trim().toLowerCase();if(!r)return;let n=ks[r]??r;if(Qe.includes(n))return n}function Ss(e,t){return ct(e,t)??e}function ru(e,t){return t.terminal_statuses.has(Ss(e,t))}import{encode as Ts}from"@toon-format/toon";import{isDeepStrictEqual as eo}from"node:util";import{decode as Is}from"@toon-format/toon";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aaa2be03-9478-5fbe-82e6-e4fc86e3735b")}catch{}})();function er(e){return{value:Is(e),usedScalarBracketEscape:!1}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="79626299-17a8-573a-9b66-ce37c65e2f5d")}catch{}})();var Os=/^\s*(<<<<<<<|=======|>>>>>>>)(?:\s.*)?$/;function As(e){if(e.length===0)return[];let t=e.split(/\r?\n/),r=[];for(let n=0;n<t.length;n+=1){let o=t[n]??"",i=o.match(Os);if(!i)continue;let s=i[1];r.push({line:n+1,marker:s,text:o})}return r}function dt(e){return As(e)[0]}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2789e87f-0706-52e8-8f4c-3855c65c618c")}catch{}})();var or=new Set(["schema","tracker","auto","none"]),io=new Set(["source","isolated","snapshot"]),xs=new Set(["legacy","local_mutation","local_source_ref","acknowledged","invalid_provenance","foreign_source_ref"]),Cs=new Set(["passed","failed","stopped","canceled"]),Ns=new Set(Tn);function Oe(e){return e.replaceAll("\\","/")}function so(e){for(let t of e)if(t!==0)return t;return 0}function ut(e){for(let[t,r]of Object.entries(e))r===void 0&&delete e[t]}var ao=["id","title","description","created_at","updated_at"],Rs=new Set(B);function co(e){if(e?.schema)return{statusRegistry:Hn(e.schema),fieldRegistry:Fn(e.schema),unknownFieldPolicy:e.schema.unknown_field_policy??"allow",extensionFieldNames:new Set(e.extensionFieldNames??[]),onWarning:e.onWarning}}function Ds(e,t){return e.required?e.required_types.length===0?!0:e.required_types.map(r=>r.toLowerCase()).includes(t.trim().toLowerCase()):!1}function X(e){let t=e.match(/^([a-z_][\w.]*)\s/u)?.[1];throw new b(`Invalid item metadata: ${e}`,w.GENERIC_FAILURE,{code:"item_document_invalid",reason:e.includes("required")?"missing_required_field":"schema_validation_error",...t?{field:t}:{},required:"Provide an item document whose metadata satisfies the active runtime schema.",why:e})}function qe(e,t){throw new b(t,w.GENERIC_FAILURE,{code:"item_document_invalid",reason:"syntax_error",format:e,required:`Provide a syntactically valid ${e==="toon"?"TOON":"JSON Markdown"} item document.`,why:"The document could not be decoded far enough to validate item metadata."})}function lo(e,t){if(!t||typeof e!="object"||e===null)return;let r=Qt(e);if(!(r<=Zt))throw new b(`Stored item uses format version ${r}; this runtime supports up to ${Zt}. Upgrade pm before reading or changing this item.`,w.CONFLICT,{code:"item_format_version_unsupported",format_version:r,required:"Upgrade to a pm runtime supporting the stored item format.",nextSteps:["Preserve the original item and history; do not lower pm_format_version to bypass compatibility checks."]})}function uo(e){let t=new Set(Rs);for(let r of e.fieldRegistry?.definitions??[])t.add(r.metadata_key);for(let r of e.extensionFieldNames)t.add(r);return t}function h(e,t){e||X(t)}function Ge(e,t){return(typeof e!="object"||e===null||Array.isArray(e))&&X(t),e}function tr(e,t){let r=e[t];h(typeof r=="string",`${t} must be a string`),h(W(r),`${t} must be a valid ISO timestamp`)}function to(e,t,r){let n=e[t];n!==void 0&&h(typeof n=="number"&&Number.isInteger(n)&&n>=1,`${r} must be an integer >= 1`)}function ir(e,t,r){let n=e[t];n!==void 0&&(h(typeof n=="string",`${r} must be a string`),h(W(n),`${r} must be a valid ISO timestamp`))}function Ps(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.by_weekday must be an array");for(let t of e){h(typeof t=="string","event.recurrence.by_weekday entries must be strings");let r=t.trim().toLowerCase();h(nt.includes(r),`event.recurrence.by_weekday entries must be one of: ${nt.join(", ")}`)}}}function js(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.by_month_day must be an array");for(let t of e)h(typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=31,"event.recurrence.by_month_day entries must be integers 1..31")}}function Ls(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.exdates must be an array");for(let t of e)h(typeof t=="string","event.recurrence.exdates entries must be strings"),h(W(t),"event.recurrence.exdates entries must be valid ISO timestamps")}}function Hs(e){let t=Ge(e,"event.recurrence must be an object");h(typeof t.freq=="string","event.recurrence.freq must be a string");let r=t.freq.trim().toLowerCase();h(rt.includes(r),`event.recurrence.freq must be one of: ${rt.join(", ")}`),to(t,"interval","event.recurrence.interval"),to(t,"count","event.recurrence.count"),ir(t,"until","event.recurrence.until"),Ps(t.by_weekday),js(t.by_month_day),Ls(t.exdates)}function zs(e){for(let n of ao)h(typeof e[n]=="string",`${n} is required and must be a string`);let t=e.type;h(typeof t=="string"&&t.trim().length>0,"type must be a non-empty string");let r=e.pm_format_version;return r!==void 0&&h(typeof r=="number"&&Number.isInteger(r)&&r>=Yt,`pm_format_version must be an integer >= ${Yt}`),t}function Fs(e,t){let r=e.status;h(typeof r=="string"&&r.trim().length>0,"status must be a non-empty string");let n=t?.statusRegistry,o=ct(r,n),i=n?n.definitions.map(s=>s.id):[...Qe];h(o!==void 0,`status must be one of: ${i.join(", ")}`)}function $s(e){let t=e.priority;h(typeof t=="number"&&Number.isInteger(t)&&[0,1,2,3,4].includes(t),"priority must be an integer 0..4");let r=e.tags;h(Array.isArray(r),"tags must be an array");for(let n of r)h(typeof n=="string","tags entries must be strings")}function Ms(e){let t=e.confidence;if(t!==void 0){if(typeof t=="number"){h(Number.isInteger(t)&&t>=0&&t<=100,"confidence number value must be an integer 0..100");return}if(typeof t=="string"){let r=t.trim().toLowerCase(),n=r==="med"||tt.includes(r);h(n,`confidence string value must be one of: ${[...tt,"med"].join(", ")}`);return}h(!1,"confidence must be a number or string")}}function Vs(e){let t=e.severity;if(t===void 0)return;typeof t!="string"&&X("severity must be a string");let r=t.trim().toLowerCase(),n=r==="med"||et.includes(r);h(n,`severity value must be one of: ${[...et,"med"].join(", ")}`)}function Us(e){e.regression!==void 0&&typeof e.regression!="boolean"&&X("regression must be a boolean")}function Ws(e){let t=e.reminders;if(t!==void 0){h(Array.isArray(t),"reminders must be an array");for(let r of t){let n=Ge(r,"reminders entries must be objects");h(typeof n.at=="string","reminder.at must be a string"),h(W(n.at),"reminder.at must be a valid ISO timestamp"),h(typeof n.text=="string","reminder.text must be a string"),h(n.text.trim().length>0,"reminder.text must not be empty")}}}function qs(e){for(let t of["title","description","location","timezone"])e[t]!==void 0&&(h(typeof e[t]=="string",`event.${t} must be a string`),h(e[t].trim().length>0,`event.${t} must not be empty`))}function Gs(e){e.recurrence!==void 0&&(Hs(e.recurrence),e.recurrence.until!==void 0&&h(q(e.recurrence.until,e.start_at)>=0,"event.recurrence.until must be at or after event.start_at"))}function Bs(e){let t=Ge(e,"events entries must be objects");h(typeof t.start_at=="string","event.start_at must be a string"),h(W(t.start_at),"event.start_at must be a valid ISO timestamp"),t.end_at!==void 0&&(h(typeof t.end_at=="string","event.end_at must be a string"),h(W(t.end_at),"event.end_at must be a valid ISO timestamp"),h(q(t.end_at,t.start_at)>0,"event.end_at must be after event.start_at")),qs(t),t.all_day!==void 0&&h(typeof t.all_day=="boolean","event.all_day must be a boolean"),Gs(t)}function Js(e){let t=e.events;if(t!==void 0){h(Array.isArray(t),"events must be an array");for(let r of t)Bs(r)}}function Ks(e){for(let t of["source_type","source_owner","design","external_ref"]){let r=e[t];r!==void 0&&h(typeof r=="string",`${t} must be a string`)}}function Xs(e){let t=e.type_options;if(t===void 0)return;let r=Ge(t,"type_options must be an object");for(let[n,o]of Object.entries(r))h(n.trim().length>0,"type_options keys must be non-empty"),h(typeof o=="string","type_options values must be strings"),h(o.trim().length>0,"type_options values must be non-empty strings")}function Ys(e,t,r){if(r?.fieldRegistry)for(let n of r.fieldRegistry.definitions){let o=e[n.metadata_key];if(o===void 0){Ds(n,t)&&X(`missing required schema field: ${n.metadata_key}`);continue}try{e[n.metadata_key]=Ve(n,o,`metadata field "${n.metadata_key}"`,"metadata")}catch(i){X(String(i?.message).replace(/^Invalid\s+/u,""))}}}function Zs(e,t){if(!t||t.unknownFieldPolicy==="allow")return;let r=uo(t),n=Object.keys(e).filter(o=>!r.has(o)).sort((o,i)=>o.localeCompare(i));n.length!==0&&(t.unknownFieldPolicy==="reject"?X(`unknown schema fields are not allowed: ${n.join(", ")}`):t.onWarning?.(`item_unknown_schema_fields:${n.join(",")}`))}function sr(e,t){let r=Ge(e,"item metadata must be an object"),n=zs(r);Fs(r,t),$s(r),Ms(r),Vs(r),Us(r),tr(r,"created_at"),tr(r,"updated_at"),r.deadline!==void 0&&tr(r,"deadline"),Ws(r),Js(r),ir(r,"closed_at","closed_at"),ir(r,"completed_at","completed_at"),Ks(r),Xs(r),Ys(r,n,t),Zs(r,t)}function Qs(e){if(!(!e||e.length===0))return[...e].map((t,r)=>(h(t.created_at===void 0||typeof t.created_at=="string"&&st(t.created_at),`dependencies.${r}.created_at requires a valid timestamp; restore the dependency timestamp from its source record`),{id:t.id.trim(),kind:t.kind,created_at:t.created_at,author:t.author?.trim()||void 0,source_kind:t.source_kind?.trim()||void 0,author_source:t.author_source})).sort((t,r)=>{let n=q(t.created_at??"",r.created_at??"");if(n!==0)return n;let o=t.id.localeCompare(r.id);if(o!==0)return o;let i=t.kind.localeCompare(r.kind);return i!==0?i:(t.source_kind??"").localeCompare(r.source_kind??"")})}function rr(e){if(!(!e||e.length===0))return[...e].sort((t,r)=>{let n=q(t.created_at,r.created_at);if(n!==0)return n;let o=t.text.localeCompare(r.text);return o!==0?o:t.author.localeCompare(r.author)})}function ea(e){if(!e||e.length===0)return;let t=[...e].map(r=>({at:r.at,text:r.text.trim()})).filter(r=>r.text.length>0).sort((r,n)=>{let o=q(r.at,n.at);return o!==0?o:r.text.localeCompare(n.text)});return t.length===0?void 0:t}function ta(e){if(!e)return;let t=e.freq.trim().toLowerCase();if(!rt.includes(t))return;let r=Array.from(new Set((e.by_weekday??[]).map(s=>s.trim().toLowerCase()).filter(s=>nt.includes(s)))).sort((s,a)=>Bt(s)-Bt(a)),n=Array.from(new Set((e.by_month_day??[]).filter(s=>Number.isInteger(s)&&s>=1&&s<=31).map(s=>s))).sort((s,a)=>s-a),o=Array.from(new Set((e.exdates??[]).map(s=>s.trim()).filter(s=>W(s)))).sort((s,a)=>q(s,a)),i={freq:t,interval:e.interval!==void 0&&e.interval>1?e.interval:void 0,count:e.count,until:e.until?.trim()||void 0,by_weekday:r.length>0?r:void 0,by_month_day:n.length>0?n:void 0,exdates:o.length>0?o:void 0};for(let[s,a]of Object.entries(i))a===void 0&&delete i[s];return i}function ra(e){return!Array.isArray(e)||e.length===0?void 0:[...e].map(na).sort(oa)}function na(e){let t={start_at:e.start_at,end_at:e.end_at||void 0,title:e.title?.trim()||void 0,description:e.description?.trim()||void 0,location:e.location?.trim()||void 0,all_day:e.all_day,timezone:e.timezone?.trim()||void 0,recurrence:ta(e.recurrence)};return ut(t),t}function oa(e,t){return so([q(e.start_at,t.start_at),(e.end_at??"").localeCompare(t.end_at??""),(e.title??"").localeCompare(t.title??""),+!!e.all_day-+!!t.all_day,(e.timezone??"").localeCompare(t.timezone??""),(e.location??"").localeCompare(t.location??""),(e.description??"").localeCompare(t.description??""),JSON.stringify(e.recurrence??{}).localeCompare(JSON.stringify(t.recurrence??{}))])}function ia(e){if(!(!e||e.length===0))return e.map(t=>({path:Oe(t.path),scope:t.scope,note:t.note?.trim()||void 0}))}function sa(e){if(!e||e.length===0)return;let t=e.map(la).filter(r=>r.run_id.length>0&&r.started_at.length>0&&r.finished_at.length>0&&r.recorded_at.length>0).sort((r,n)=>so([q(r.recorded_at,n.recorded_at),r.run_id.localeCompare(n.run_id),r.kind.localeCompare(n.kind)]));return t.length>0?t:void 0}function Se(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0}function aa(e){return typeof e=="number"&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0}function nr(e){return typeof e=="string"?e:""}function ca(e){if(!Array.isArray(e))return;let t=e.filter(n=>n!==null&&typeof n=="object"&&typeof n.name=="string"&&n.name.trim().length>0&&typeof n.value=="number"&&Number.isFinite(n.value)&&typeof n.recorded_at=="string"&&n.recorded_at.trim().length>0).map(n=>({name:n.name.trim(),value:n.value,unit:typeof n.unit=="string"&&n.unit.trim()||void 0,threshold:typeof n.threshold=="number"&&Number.isFinite(n.threshold)?n.threshold:void 0,recorded_at:n.recorded_at.trim()})),r=[...new Map(t.map(n=>[n.name,n])).values()].sort((n,o)=>n.name.localeCompare(o.name)).slice(0,32);return r.length>0?r:void 0}function lt(e,t){return typeof e=="string"&&t.has(e)?e:void 0}function da(e){if(!Array.isArray(e))return;let t=e.filter(r=>r&&typeof r.command=="string"&&r.command.trim().length>0).slice(0,32).map(r=>({command:r.command.trim(),requested_pm_context_mode:lt(r.requested_pm_context_mode,or),pm_context_mode:lt(r.pm_context_mode,or),workspace_context_mode:lt(r.workspace_context_mode,io),trust_reason:lt(r.trust_reason,xs)}));return t.length>0?t:void 0}function la(e){let t=typeof e.run_id=="string"?e.run_id.trim():"",r=e.kind==="test"||e.kind==="test-all"?e.kind:"test",n=Cs.has(e.status)?e.status:"failed",o={run_id:t,kind:r,status:n,started_at:nr(e.started_at),finished_at:nr(e.finished_at),recorded_at:nr(e.recorded_at),attempt:aa(e.attempt),resumed_from:e.resumed_from?.trim()||void 0,passed:Se(e.passed)??0,failed:Se(e.failed)??0,skipped:Se(e.skipped)??0,items:Se(e.items),linked_tests:Se(e.linked_tests),fail_on_skipped_triggered:e.fail_on_skipped_triggered===!0?!0:void 0,measurements:ca(e.measurements),executions:da(e.executions)};return ut(o),o}function ua(e){if(!(!Array.isArray(e)||e.length===0))return e.map(ha)}function Ue(e){if(!Array.isArray(e))return;let t=[...new Set(e.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n));return t.length>0?t:void 0}function lr(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ur(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function ro(e){if(!lr(e))return;let t=Object.entries(e).map(([r,n])=>[r.trim(),String(n).trim()]).filter(([r,n])=>r.length>0&&!ur(r)&&n.length>0).sort(([r],[n])=>r.localeCompare(n));return t.length>0?Object.fromEntries(t):void 0}function _a(e){if(!lr(e))return;let t=Object.entries(e).map(([r,n])=>[r.trim(),Number(n)]).filter(([r,n])=>r.length>0&&!ur(r)&&Number.isFinite(n)).sort(([r],[n])=>r.localeCompare(n));return t.length>0?Object.fromEntries(t):void 0}function fa(e){let t=e?.trim().toLowerCase();if(!(!t||!or.has(t)))return t}function ma(e){let t=e?.trim().toLowerCase();if(!(!t||!io.has(t)))return t}function pa(e,t){if(t===!0)return{provenance_invalid:!0};if(e===void 0)return{};if(!lr(e))return{provenance_invalid:!0};let r=f(e.author),n=f(e.created_at),o=e.source_kind;return!r||!n||!W(n)||o!=="local_mutation"&&o!=="merge_union"?{provenance_invalid:!0}:{provenance:{author:r,created_at:n,source_kind:o,source_ref:f(e.source_ref)}}}function ha(e){let t={command:e.command?.trim()||void 0,path:e.path?Oe(e.path):void 0,scope:e.scope,timeout_seconds:typeof e.timeout_seconds=="number"&&Number.isFinite(e.timeout_seconds)&&e.timeout_seconds>0?e.timeout_seconds:void 0,pm_context_mode:fa(e.pm_context_mode),workspace_context_mode:ma(e.workspace_context_mode),...pa(e.provenance,e.provenance_invalid),updated_by:f(e.updated_by),updated_at:f(e.updated_at),env_set:ro(e.env_set),env_clear:Ue(e.env_clear),shared_host_safe:e.shared_host_safe===!0?!0:void 0,assert_stdout_contains:Ue(e.assert_stdout_contains),assert_stdout_regex:Ue(e.assert_stdout_regex),assert_stderr_contains:Ue(e.assert_stderr_contains),assert_stderr_regex:Ue(e.assert_stderr_regex),assert_stdout_min_lines:Se(e.assert_stdout_min_lines),assert_json_field_equals:ro(e.assert_json_field_equals),assert_json_field_gte:_a(e.assert_json_field_gte),note:e.note?.trim()||void 0};return ut(t),t}function ya(e){if(!(!e||e.length===0))return[...e].map(t=>({path:Oe(t.path),scope:t.scope,note:t.note?.trim()||void 0})).sort((t,r)=>{let n=t.scope.localeCompare(r.scope);if(n!==0)return n;let o=t.path.localeCompare(r.path);return o!==0?o:(t.note??"").localeCompare(r.note??"")})}function f(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function ga(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.id),i=f(n.kind);if(!o||!i)continue;let s={id:o,kind:i},a=f(n.note);a&&(s.note=a),n.required_before_step===!0&&(s.required_before_step=!0),t.push(s)}return t.length>0?t:void 0}function va(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.path);if(!o)continue;let i={path:Oe(o)};(n.scope==="project"||n.scope==="global")&&(i.scope=n.scope);let s=f(n.note);s&&(i.note=s),t.push(i)}return t.length>0?t:void 0}function ba(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.command),i=f(n.path);if(!o&&!i)continue;let s={};o&&(s.command=o),i&&(s.path=Oe(i));let a=f(n.note);a&&(s.note=a),t.push(s)}return t.length>0?t:void 0}function wa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.path);if(!o)continue;let i={path:Oe(o)};(n.scope==="project"||n.scope==="global")&&(i.scope=n.scope);let s=f(n.note);s&&(i.note=s),t.push(i)}return t.length>0?t:void 0}function Ea(e){if(e===null||typeof e!="object")return;let t=e,r=f(t.id),n=f(t.title),o=f(t.status),i=o&&Ns.has(o)?o:void 0,s=Dn(t.order)??Number.NaN,a=typeof t.created_at=="string"?t.created_at:"",d=typeof t.updated_at=="string"?t.updated_at:"";if(!r||!n||!i||!Number.isFinite(s)||!a||!d)return;let l={id:r,order:s,title:n,status:i,created_at:a,updated_at:d};return ka(l,t),l}function ka(e,t){let r=[["body","body"],["owner","owner"],["evidence","evidence"],["blocked_reason","blocked_reason"],["superseded_by","superseded_by"]];for(let[i,s]of r){let a=f(t[s]);a&&(e[i]=a)}let n=typeof t.completed_at=="string"?t.completed_at:void 0;n&&n.length>0&&(e.completed_at=n);let o=[["linked_items","linked_items",ga],["files","files",va],["tests","tests",ba],["docs","docs",wa]];for(let[i,s,a]of o){let d=a(t[s]);d&&(e[i]=d)}}function Sa(e){if(!Array.isArray(e))return;let t=e.flatMap(r=>{let n=Ea(r);return n?[n]:[]});return t.sort((r,n)=>r.order-n.order),t.length>0?t:void 0}function Ia(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=typeof n.ts=="string"?n.ts:"",i=typeof n.author=="string"?n.author:"",s=f(n.decision);if(!o||!i||!s)continue;let a={ts:o,author:i,decision:s},d=f(n.rationale);d&&(a.rationale=d);let l=f(n.evidence);l&&(a.evidence=l);let _=f(n.step_id);_&&(a.step_id=_),t.push(a)}return t.length>0?t:void 0}function Oa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=typeof n.ts=="string"?n.ts:"",i=typeof n.author=="string"?n.author:"",s=f(n.text);if(!o||!i||!s)continue;let a={ts:o,author:i,text:s},d=f(n.step_id);d&&(a.step_id=d),t.push(a)}return t.length>0?t:void 0}function Aa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.text);if(!o)continue;let i={text:o},s=f(n.command);s&&(i.command=s);let a=f(n.expected);a&&(i.expected=a),t.push(i)}return t.length>0?t:void 0}function Ta(e){if(!e)return;let t=Object.entries(e).map(([r,n])=>[r.trim(),n.trim()]).filter(([r,n])=>r.length>0&&n.length>0).sort((r,n)=>r[0].localeCompare(n[0]));if(t.length!==0)return Object.fromEntries(t)}function Ie(e){let t=0;for(;t<e.length&&e[t]===`
|
|
2
2
|
`;)t+=1;return e.slice(t).trimEnd()}function xa(e){if(e===void 0)return;if(typeof e=="number")return e;let t=e.trim().toLowerCase();if(t==="med")return"medium";if(tt.includes(t))return t}function Ca(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(t==="med")return"medium";if(et.includes(t))return t}function We(e){return e||void 0}function Na(e,t){let r=e,n=t;for(let[o,i]of Object.entries(n))ur(o)||Object.prototype.hasOwnProperty.call(r,o)||i===void 0||(r[o]=i)}function Ra(e,t){if(!t?.fieldRegistry)return;let r=e;for(let n of t.fieldRegistry.definitions){let o=r[n.metadata_key];o!==void 0&&(r[n.metadata_key]=Ve(n,o,`metadata field "${n.metadata_key}"`,"metadata"))}}function Da(e,t){if(!t||t.unknownFieldPolicy==="allow")return;let r=uo(t),n=Object.keys(e).filter(o=>!r.has(o)).sort((o,i)=>o.localeCompare(i));n.length>0&&t.unknownFieldPolicy==="reject"&&X(`unknown schema fields are not allowed: ${n.join(", ")}`),n.length>0&&t.onWarning?.(`item_unknown_schema_fields:${n.join(",")}`)}function _t(e,t={}){let r=co(t),n=ct(e.status,r?.statusRegistry)??e.status,o=Array.from(new Set((Array.isArray(e.tags)?e.tags:[]).filter(s=>typeof s=="string").map(s=>s.trim().toLowerCase()).filter(Boolean))).sort((s,a)=>s.localeCompare(a)),i={id:e.id,title:e.title,description:e.description,type:e.type,pm_format_version:Qn(e.pm_format_version),source_type:f(e.source_type),type_options:Ta(e.type_options),status:n,priority:e.priority,tags:o,created_at:e.created_at,updated_at:e.updated_at,dependencies:Qs(e.dependencies),comments:rr(e.comments),notes:rr(e.notes),learnings:rr(e.learnings),files:ia(e.files),tests:ua(e.tests),test_runs:sa(e.test_runs),docs:ya(e.docs),deadline:We(e.deadline),reminders:ea(e.reminders),events:ra(e.events),closed_at:We(e.closed_at),completed_at:We(e.completed_at),assignee:f(e.assignee),claim_principal:f(e.claim_principal),source_owner:f(e.source_owner),author:We(e.author),estimated_minutes:e.estimated_minutes,acceptance_criteria:e.acceptance_criteria??void 0,design:e.design??void 0,external_ref:e.external_ref??void 0,definition_of_ready:f(e.definition_of_ready),order:e.order,goal:f(e.goal),objective:f(e.objective),value:f(e.value),impact:f(e.impact),outcome:f(e.outcome),why_now:f(e.why_now),parent:f(e.parent),reviewer:f(e.reviewer),risk:e.risk??void 0,confidence:xa(e.confidence),sprint:f(e.sprint),release:f(e.release),blocked_by:f(e.blocked_by),blocked_reason:f(e.blocked_reason),unblock_note:f(e.unblock_note),reporter:f(e.reporter),severity:Ca(e.severity),environment:f(e.environment),repro_steps:f(e.repro_steps),resolution:f(e.resolution),expected_result:f(e.expected_result),actual_result:f(e.actual_result),affected_version:f(e.affected_version),fixed_version:f(e.fixed_version),component:f(e.component),regression:e.regression,customer_impact:f(e.customer_impact),close_reason:We(e.close_reason),plan_mode:f(e.plan_mode),plan_scope:f(e.plan_scope),plan_harness:f(e.plan_harness),plan_resume_context:f(e.plan_resume_context),plan_steps:Sa(e.plan_steps),plan_decisions:Ia(e.plan_decisions),plan_discoveries:Oa(e.plan_discoveries),plan_validation:Aa(e.plan_validation)};return Na(i,e),Ra(i,r),Da(i,r),ut(i),i}function _o(e){return y(e,B)}function Pa(e){let t=0,r=!1,n=!1;for(let o=0;o<e.length;o+=1){let i=e[o];if(r){if(n){n=!1;continue}if(i==="\\"){n=!0;continue}i==='"'&&(r=!1);continue}if(i==='"'){r=!0;continue}if(i==="{"){t+=1;continue}if(i==="}"&&(t-=1,t===0))return o}return-1}function ja(e){if(!e.startsWith("{"))return{frontMatter:"",body:e};let t=Pa(e);if(t<0)return{frontMatter:"",body:e};let r=e.slice(0,t+1),n=e.slice(t+1).replace(/^\r?\n+/,"");return{frontMatter:r,body:n}}function La(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,r=t.match(/^[ \t]*---[ \t]*(?:\r?\n|$)/);if(!r)return{content:t,stripped:!1};let n=r[0].length;for(;n<t.length;){let o=t.indexOf(`
|
|
3
3
|
`,n),i=o===-1?t.length:o,s=t.slice(n,i).replace(/\r$/,""),a=o===-1?i:i+1;if(s.trim()==="---")return{content:t.slice(a).replace(/^\s+/,""),stripped:!0};n=a}return{content:t,stripped:!1}}function ar(e,t){return _t(e,{...t,onWarning:void 0})}function Ha(e,t,r={}){let n=La(e);n.stripped&&r.onWarning?.("json_markdown_leading_yaml_frontmatter_ignored");let{frontMatter:o,body:i}=ja(n.content);o||(e.trimStart().startsWith("{")&&qe("json_markdown","JSON front matter is not valid JSON"),qe("json_markdown","JSON Markdown item document is missing JSON front matter"));let s;try{s=JSON.parse(o)}catch{qe("json_markdown","JSON front matter is not valid JSON")}return lo(s,r.requireSupportedFormat),sr(s,t),{metadata:ar(s,r),body:Ie(i)}}function za(e,t,r={}){let n;try{n=er(e).value}catch{qe("toon","TOON item document is not valid TOON")}h(typeof n=="object"&&n!==null&&!Array.isArray(n),"TOON item document must be an object");let o=n;if(lo(Object.prototype.hasOwnProperty.call(o,"front_matter")?o.front_matter:o,r.requireSupportedFormat),!ao.some(a=>Object.prototype.hasOwnProperty.call(o,a))&&!Object.prototype.hasOwnProperty.call(o,"front_matter")&&qe("toon","TOON input does not have the shape of an item document"),Object.prototype.hasOwnProperty.call(o,"front_matter"))return sr(o.front_matter,t),h(o.body===void 0||typeof o.body=="string","TOON item document body must be a string"),{metadata:ar(o.front_matter,r),body:Ie(typeof o.body=="string"?o.body:"")};let{body:i,...s}=o;return h(i===void 0||typeof i=="string","TOON item document body must be a string"),sr(s,t),{metadata:ar(s,r),body:Ie(typeof i=="string"?i:"")}}function Fa(e,t={}){let r=_t(e.metadata,t),n=_o(r),o=Ie(e.body??"");dr(JSON.parse(JSON.stringify(n))),dr({body:o});let i=JSON.stringify(n,null,2);return o?`${i}
|
|
4
4
|
|
|
@@ -75,4 +75,4 @@ ${o}
|
|
|
75
75
|
`}async function Cl(e){let t;try{t=await Li(e)}catch(a){if(ie(a))return U();throw a}let r=Ee(t),n;try{n=await Yd(r)}catch(a){if(ie(a))return U();throw a}if(!n.isFile())throw Jt("settings.json");let o;try{o=await Nn(r,Jt("settings.json"))}catch(a){if(ie(a))return U();throw a}let i;try{i=JSON.parse(o)}catch{return U("settings_read_invalid_json")}let s=en(i);return s.success?{settings:$t(s.data),metadata:{has_explicit_item_format:Yi(i)},warnings:s.data.item_format==="json_markdown"?["settings_item_format_legacy_json_markdown_coerced_to_toon"]:[]}:U("settings_read_invalid_schema")}async function os(e){if(Zd(e))return Cl(e);let t=Ee(e),r=[t];await it({path:t,scope:"project"});let n=Ni(e);if(n){let l=await te(n.tracked_paths);if(Xe(l,n.signatures))return Ft(n.value)}let o=await te([t]),i;try{i=await J(t)}catch{return U("settings_read_fs_error")}if(i===null){let l=U();return await an(e,[t],l,o,[t]),l}let s=await te([t]);if(!Xe(o,s))return be(e),os(e);let a;try{a=JSON.parse(i)}catch{let l=U("settings_read_invalid_json");return await an(e,[t],l,s,[t]),l}let d=en(a);if(!d.success){let l=U("settings_read_invalid_schema");return await an(e,[t],l,s,[t]),l}try{let l=$t(d.data),_=il(e,l.schema,t);r=_;let v=await te(_),I=await Ln(e,l.schema),O=await te(_),S={...l,item_types:{definitions:je([...l.item_types.definitions,...un(I.type_definitions_from_file)])},schema:I.schema};_n(S,Ki(d.data,S));let z={settings:S,metadata:{has_explicit_item_format:Yi(a)},warnings:[...d.data.item_format==="json_markdown"?["settings_item_format_legacy_json_markdown_coerced_to_toon"]:[],...I.warnings]};return Xe(v,O)?zt(e,{tracked_paths:_,signatures:O,value:Ft(z)}):be(e),z}catch{let l=U("settings_read_merge_failed");return await al(e,r,l),l}}async function um(e){return(await os(e)).settings}async function _m(e,t,r=Qd){let n=Ee(e),o=Xi(t),i=xl(t,{persist_source:o}),s=JSON.parse(i);try{await Oi({pmRoot:e,filePath:n,mutate:a=>{let d=null;if(a!==null)try{d=JSON.parse(a)}catch{throw new b("Existing settings.json is malformed; the settings write was refused.",w.USAGE,{code:"settings_write_invalid_existing_json",reason:"existing_settings_json_malformed",why:"Writing defaults over malformed settings could destroy intended project configuration.",nextSteps:["Repair the syntax in .agents/pm/settings.json, then retry the original command.","Run pm health to confirm the settings warning has cleared."]})}return{raw:o?`${JSON.stringify(y(rn(o.persisted_settings,s,d),fn),null,2)}
|
|
76
76
|
`:i,result:void 0}},op:r,author:Do(void 0,t.author_default),lockTtlSeconds:t.locks.ttl_seconds,lockWaitMs:t.locks.wait_ms,recordCreation:!1}),o&&_n(t,{...o,persisted_settings:structuredClone(s)}),await Mn({path:n,scope:"project",op:r})}finally{be(e)}}import is from"node:fs";import Ye from"node:path";import{createRequire as Nl}from"node:module";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="19d9b802-1efa-5716-8176-ecbf5b153ff0")}catch{}})();var ss="@unbrained/pm-cli";var pn=/\b(\d{4})\.(\d{1,2})\.(\d{1,2})(?:-(\d+))?\b/u,hn="2026.8.31";function Mt(e){let t=e.match(pn);return t?[Number(t[1]),Number(t[2]),Number(t[3]),Number(t[4]??0)]:null}function Ut(e,t){let r=Mt(e),n=Mt(t);if(!r||!n)return null;for(let o=0;o<r.length;o+=1){let i=r[o]-n[o];if(i!==0)return Math.sign(i)}return 0}function mn(e){return Ut(e,hn)!==-1?3:2}function Vt(e){try{let t=JSON.parse(is.readFileSync(e,"utf8"));return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}catch{return null}}function Rl(e){let t=[...e.matchAll(/(<=|<)\s*v?(\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?)/gu)].map(n=>({inclusive:n[1]==="<=",version:n[2]})),r=e.match(/\b\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?\s+-\s+v?(\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?)/u);return r?[...t,{inclusive:!0,version:r[1]}]:t}function Dl(e){let t=e.split("||").map(r=>Rl(r));return{bounded:t.some(r=>r.length>0),compatible:t.some(r=>r.every(n=>{let o=Ut(hn,n.version);return o!==null&&(n.inclusive?o!==1:o===-1)}))}}function as(e){return["dependencies","devDependencies","optionalDependencies","peerDependencies"].flatMap(t=>{let r=e[t];if(typeof r!="object"||r===null)return[];let n=r[ss];return typeof n=="string"?[n.trim()]:[]})}function Pl(e){return as(e).flatMap(t=>{let r=/^[<!]/u.test(t)?void 0:t.match(pn)?.[0];if(!r)return[];let n=/^(?:=|v)?\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?$/u.test(t),o=Dl(t);return[{version:r,constraint:n?"exact":o.bounded?"range":"minimum",...n?{}:{declaration:t},history_epoch_compatible:n?Ut(r,hn)!==-1:o.compatible}]})}function jl(e){let t=Vt(Ye.join(e,"package-lock.json"))?.packages;if(typeof t!="object"||t===null)return;let r=t["node_modules/@unbrained/pm-cli"];if(typeof r!="object"||r===null)return;let n=r.version;return typeof n=="string"?n:void 0}function Ll(e,t){try{let r=is.readFileSync(Ye.join(e,t),"utf8").split(/\r?\n/u),n=r.findIndex(s=>s.includes(ss));if(n<0)return;let o=r[n].match(/^\s*/u)[0].length,i=[r[n]];for(let s=n+1;s<r.length;s+=1){let a=r[s],d=a.trim(),l=a.match(/^\s*/u)[0].length;if(d.length>0&&l<=o)break;i.push(a)}return i.join(`
|
|
77
77
|
`).match(/^\s*version(?::\s*|\s+)["']?(\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?)/mu)?.[1]??i[0].match(pn)?.[0]}catch{return}}function Hl(e){let t=[],r=Vt(Ye.join(e,"package.json"));r&&t.push(...Pl(r).map(i=>({...i,source:"package.json"})));let n=Vt(Ye.join(e,"node_modules","@unbrained","pm-cli","package.json"))?.version;typeof n=="string"&&Mt(n)&&t.push({version:n,source:"installed-package",constraint:"exact",history_epoch_compatible:mn(n)===3});let o=jl(e);o&&Mt(o)&&t.push({version:o,source:"package-lock.json",constraint:"exact",history_epoch_compatible:mn(o)===3});for(let i of["pnpm-lock.yaml","yarn.lock"]){let s=Ll(e,i);s&&t.push({version:s,source:i,constraint:"exact",history_epoch_compatible:mn(s)===3})}return t}function vm(e,t){if(t<=1)return;let{minVersion:r,lt:n}=Nl(import.meta.url)("semver"),o=as(Vt(Ye.join(e,"package.json"))??{}).find(s=>{try{let a=r(s);return a!==null&&n(a,"2026.10.10")}catch{return!1}}),i=o===void 0?Hl(e).find(s=>Ut(s.version,"2026.10.10")===-1):{version:o,source:"package.json"};if(i)throw new b(`The project selects pm ${i.version}, which cannot safely refuse item format ${t}.`,w.CONFLICT,{code:"project_runtime_item_format_incompatible",reason:i.source,required:"Upgrade project pins, installed SDKs, CI hosts and Git merge drivers before writing guarded item formats.",nextSteps:["Use a pm runtime supporting the required item format throughout the project; preserve original item and history bytes, and never re-anchor history to satisfy an older host."]})}import gn from"node:fs/promises";import Wt from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="658ab1c3-da92-5af6-a170-85ed7befaad6")}catch{}})();function ne(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}function cs(e){let t=["--pm-path",e,"init","--defaults","--agent-guidance","skip"];return{suggested_retry:Un(t),suggested_retry_args:t}}function qt(e){return new b(`Tracker root is not a directory at ${e}.`,w.USAGE,{code:"tracker_root_not_directory",reason:"not_a_directory",resolved_path:e,nextSteps:["Pass a tracker directory, usually <workspace>/.agents/pm, rather than a file path."]})}function yn(e){return new b(`Tracker root is not readable at ${e}.`,w.GENERIC_FAILURE,{code:"tracker_root_unreadable",reason:"unreadable",resolved_path:e,nextSteps:["Grant read and directory-search permission to the tracker root, then retry."]})}async function zl(e){let t=Wt.resolve(e),r=Wt.parse(t).root,n=Wt.dirname(t);for(;n!==r;){let o;try{o=await gn.stat(n)}catch(i){if(ne(i,"ENOTDIR"))throw qt(e);if(!ne(i,"ENOENT"))throw i;n=Wt.dirname(n);continue}if(!o.isDirectory())throw qt(e);return}}async function Fl(e){let t;try{t=await gn.stat(e)}catch(r){throw ne(r,"ENOENT")?(await zl(e),new b(`Tracker is not initialized at ${e}. Tracker root does not exist. Run pm init first.`,w.NOT_FOUND,{code:"tracker_root_missing",reason:"missing",resolved_path:e,nextSteps:["Confirm the tracker root path or initialize it with the emitted retry."],recovery:cs(e)})):ne(r,"ENOTDIR")?qt(e):ne(r,"EACCES")||ne(r,"EPERM")?yn(e):r}if(!t.isDirectory())throw qt(e);if(process.platform!=="win32"&&((t.mode&292)===0||(t.mode&73)===0))throw yn(e);try{await(await gn.opendir(e)).close()}catch(r){throw ne(r,"EACCES")||ne(r,"EPERM")?yn(e):r}}async function Tm(e){if(await Fl(e),!await Cn(Ee(e)))throw new b(`Tracker is not initialized at ${e}. Run pm init first.`,w.NOT_FOUND,{code:"tracker_not_initialized",reason:"settings_missing",resolved_path:e,nextSteps:["Initialize the selected tracker root with the emitted retry."],recovery:cs(e)})}export{Ml as a,_s as b,Jn as c,ae as d,K as e,Po as f,Yn as g,Ve as h,Jl as i,Kl as j,Yt as k,Zt as l,Yl as m,Qt as n,Qn as o,Es as p,Zl as q,ct as r,Ss as s,ru as t,dt as u,ha as v,_t as w,wu as x,Eu as y,Ae as z,de as A,fr as B,Iu as C,Ou as D,yo as E,gr as F,ju as G,Lu as H,Hu as I,zu as J,Fu as K,$u as L,Ar as M,Tr as N,Io as O,Xu as P,Yu as Q,Zu as R,Qu as S,e_ as T,t_ as U,Rr as V,Co as W,r_ as X,n_ as Y,o_ as Z,bc as _,i_ as $,Do as aa,wc as ba,fe as ca,Ce as da,Lo as ea,$c as fa,C_ as ga,N_ as ha,R_ as ia,Qc as ja,It as ka,ye as la,Je as ma,rf as na,Gr as oa,Tt as pa,ui as qa,nf as ra,mi as sa,of as ta,Jr as ua,Kr as va,yd as wa,xt as xa,pf as ya,Xr as za,Ct as Aa,hf as Ba,yf as Ca,vi as Da,Nt as Ea,Ei as Fa,Ke as Ga,Od as Ha,gf as Ia,vf as Ja,Pe as Ka,Dt as La,Pf as Ma,jf as Na,Lf as Oa,Oi as Pa,Hf as Qa,en as Ra,Uf as Sa,be as Ta,lm as Ua,Zd as Va,Fi as Wa,$t as Xa,xl as Ya,os as Za,um as _a,_m as $a,Hl as ab,vm as bb,Fl as cb,Tm as db};
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
78
|
+
//# sourceMappingURL=chunk-UHWTPOM4.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{r as q,s as V}from"./chunk-
|
|
1
|
+
import{r as q,s as V}from"./chunk-I7H3XF25.js";import{m,s as M,u as k}from"./chunk-D5YQ4KAE.js";import{Fa as O,Kd as z,R as x,W as g,nd as N,qd as D,td as j}from"./chunk-NLZUI234.js";import{D as _,H as L,y as S,z as C}from"./chunk-KTXU5WU6.js";import{constants as p}from"node:fs";import{lstat as A,mkdir as I,open as P}from"node:fs/promises";import h from"node:path";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function E(i,e){if(typeof i!="string"||i.trim().length===0)throw new TypeError(`Relationship event ${e} must be non-empty`);return i.trim()}function $(i,e){let t=e.require(i.kind),n=t.direction==="undirected"?[i.source,i.target].sort().join("\0"):`${i.source}\0${i.target}`;return`${t.kind}\0${n}`}function Q(i){return Object.freeze({...i,...i.payload===void 0?{}:{payload:Object.freeze(structuredClone(i.payload))}})}function U(i,e,t,n){let r=t.require(i.kind),o=n.outgoingOne.get(`${r.kind}\0${i.source}`);if(o!==void 0&&o!==e)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=n.incomingOne.get(`${r.kind}\0${i.target}`);if(s!==void 0&&s!==e)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let c=$(i,t),a=n.identities.get(c);if(a!==void 0&&a!==e)throw new TypeError(`Relationship edge already active: ${c}`)}function Y(i){let e=new Map;for(let t of i)t.action==="remove"?e.delete(t.relationshipId):e.set(t.relationshipId,t.edge);return e}function X(i,e,t){if(i.expectedVersion!==void 0&&i.expectedVersion!==e)throw new TypeError(`Relationship event version conflict: expected ${i.expectedVersion}, current ${e}`);let n=E(i.eventId,"eventId");if(t.has(n))throw new TypeError(`Relationship event already exists: ${n}`);if(i.action!=="add"&&i.action!=="remove"&&i.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${i.action}`);if(!Number.isFinite(Date.parse(i.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:n,relationshipId:E(i.relationshipId,"relationshipId"),author:E(i.author,"author"),timestamp:new Date(i.timestamp).toISOString()}}function Z(i,e,t,n,r,o){let s=t.has(e);if(i.action==="add"&&s)throw new TypeError(`Relationship is already active: ${e}`);if(i.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${e}`);if(i.action==="remove")return;if(!i.edge)throw new TypeError(`Relationship ${i.action} event requires an edge`);let c=typeof i.edge.source=="string"?i.edge.source.trim():"",a=typeof i.edge.target=="string"?i.edge.target.trim():"";if(!n.has(c)||!n.has(a))throw new TypeError(`Relationship endpoint not found: ${c} -> ${a}`);let d=new g([c,a],[i.edge],r).edges()[0];return U(d,e,r,o),Q(d)}var T=class{#t;#i;#n=[];#o=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(e,t={}){this.#t=new Set([...e].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean)),this.#i=t.registry??x()}get version(){return this.#n.length}events(){return Object.freeze([...this.#n])}*stream(e={}){let t=e.fromVersion??1,n=e.toVersion??this.version,r=e.batchSize??100;if(!Number.isInteger(t)||t<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(n)||n<0||n>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${n}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(t>n+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let o=t-1;o<n;o+=r)yield Object.freeze(this.#n.slice(o,Math.min(o+r,n)))}project(e,t,n={}){if(typeof t!="function")throw new TypeError("Relationship event projection requires a reducer");let r=e,o=0,s;for(let c of this.stream({...n,batchSize:256}))for(let a of c)r=t(r,a),o+=1,s=a;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(n.fromVersion??1)-1),processed:o,...s===void 0?{}:{asOf:s.timestamp}})}#s(e,t){let n=this.#i.require(t.kind);this.#r.identities.set($(t,this.#i),e),n.outgoing==="one"&&this.#r.outgoingOne.set(`${n.kind}\0${t.source}`,e),n.incoming==="one"&&this.#r.incomingOne.set(`${n.kind}\0${t.target}`,e)}#a(e){let t=this.#i.require(e.kind);this.#r.identities.delete($(e,this.#i)),t.outgoing==="one"&&this.#r.outgoingOne.delete(`${t.kind}\0${e.source}`),t.incoming==="one"&&this.#r.incomingOne.delete(`${t.kind}\0${e.target}`)}append(e){let t=X(e,this.version,this.#o),n=this.#e.get(t.relationshipId),r=Z(e,t.relationshipId,this.#e,this.#t,this.#i,this.#r),o=Object.freeze({eventId:t.eventId,relationshipId:t.relationshipId,action:e.action,...r===void 0?{}:{edge:r},author:t.author,timestamp:t.timestamp,...e.reason?.trim()?{reason:e.reason.trim()}:{},sequence:this.version+1});return this.#n.push(o),this.#o.add(t.eventId),n&&this.#a(n),e.action==="remove"?this.#e.delete(t.relationshipId):(this.#e.set(t.relationshipId,r),this.#s(t.relationshipId,r)),o}snapshot(e={}){if(e.atVersion!==void 0&&e.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let t;if(e.atTimestamp!==void 0){let o=Date.parse(e.atTimestamp);if(!Number.isFinite(o))throw new TypeError("Relationship snapshot timestamp must be valid");t=this.#n.filter(s=>Date.parse(s.timestamp)<=o)}else{let o=e.atVersion??this.version;if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship snapshot version out of range: ${o}`);t=this.#n.slice(0,o)}let n=Y(t),r=new g(this.#t,n.values(),this.#i);return Object.freeze({version:t.at(-1)?.sequence??0,...t.at(-1)?{asOf:t.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(e){if(!Number.isInteger(e.limit)||e.limit<1)throw new TypeError("Relationship event page limit must be positive");let t=N("relationship-events",{order:"append-sequence"}),n=e.cursor===void 0?this.version:Number(D(e.cursor,t).snapshot);if(!Number.isSafeInteger(n)||n<0||n>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=j(this.#n.slice(0,n),{cursor:e.cursor,fingerprint:t,limit:e.limit,readId:o=>o.eventId,snapshot:String(n)});return{version:n,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},ee="relationship-event-store",W=p.O_NOFOLLOW;function w(i){return z(i,ee,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function f(i,e="relationships/events.jsonl"){let t=h.resolve(i),n=h.resolve(t,e),r=h.relative(t,n);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${h.sep}`)||h.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await I(t,{recursive:!0}),(await A(t)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let o=t;for(let s of r.split(h.sep)){o=h.join(o,s);try{if((await A(o)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(_(c))break;throw c}}return n}async function y(i,e,t){let n=new T(e,{registry:t}),r,o;try{o=await P(i,p.O_RDONLY|W),r=await o.readFile("utf8")}catch(c){if(_(c))return{log:n,raw:""};throw c}finally{await o?.close()}let s=r.split(`
|
|
2
2
|
`);for(let c=0;c<s.length;c+=1){let a=s[c].trim();if(!a)continue;let d;try{d=JSON.parse(a)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${c+1}`)}if(d.sequence!==n.version+1)throw new TypeError(`Invalid relationship event sequence at line ${c+1}`);n.append({eventId:d.eventId,relationshipId:d.relationshipId,action:d.action,...d.edge===void 0?{}:{edge:d.edge},author:d.author,timestamp:d.timestamp,...d.reason===void 0?{}:{reason:d.reason},expectedVersion:n.version})}return{log:n,raw:r}}function te(i,e,t,n){let r=Date.parse(e.timestamp),o;return e.action!=="remove"&&e.edge!==void 0&&(o=new g(t,[e.edge],n).edges()[0]),i.eventId===e.eventId.trim()&&i.relationshipId===e.relationshipId.trim()&&i.action===e.action&&i.author===e.author.trim()&&Number.isFinite(r)&&i.timestamp===new Date(r).toISOString()&&i.reason===(e.reason?.trim()||void 0)&&O(i.edge)===O(o)}var F=class i{#t;#i;#n;#o;#e;constructor(e,t,n,r){this.#t=e.pmRoot,this.#i=t,this.#n=e.registry,this.#o=n,this.#e=r}static async open(e){let t=Object.freeze([...e.nodes]),n=await f(e.pmRoot,e.relativePath),r=await w(e.pmRoot);try{await f(e.pmRoot,n);let{log:o}=await y(n,t,e.registry);return new i(e,t,n,o)}finally{await r()}}get path(){return this.#o}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(e){let t=await w(this.#t);try{let n=await f(this.#t,this.#o),{log:r}=await y(n,this.#i,this.#n),o=r.append(e);await I(h.dirname(n),{recursive:!0}),await f(this.#t,n);let s=await P(n,p.O_APPEND|p.O_CREAT|p.O_WRONLY|W);try{await s.appendFile(`${JSON.stringify(o)}
|
|
3
3
|
`,"utf8")}finally{await s.close()}return this.#e=r,o}finally{await t()}}async appendBatch(e,t={}){let n=await w(this.#t);try{let r=await f(this.#t,this.#o),{log:o,raw:s}=await y(r,this.#i,this.#n),c=o.version,a=new Map(o.events().map(l=>[l.eventId,l])),d=[],R=[];for(let l of e){let u=l.eventId.trim(),v=a.get(u);if(v!==void 0){if(t.existingEventPolicy==="skip_identical"&&te(v,l,this.#i,this.#n)){R.push(v.eventId);continue}if(t.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${u}`)}let b=o.append(l);a.set(b.eventId,b),d.push(b)}if(d.length>0){let l=s.length===0||s.endsWith(`
|
|
4
4
|
`)?s:`${s}
|
|
5
5
|
`;await I(h.dirname(r),{recursive:!0}),await f(this.#t,r),await L(r,`${l}${d.map(u=>JSON.stringify(u)).join(`
|
|
6
6
|
`)}
|
|
7
7
|
`)}return this.#e=o,Object.freeze({version_before:c,version_after:o.version,appended:Object.freeze(d),skipped_event_ids:Object.freeze(R)})}finally{await n()}}async snapshot(e={}){return this.#e=await this.#r(),this.#e.snapshot(e)}async page(e){return this.#e=await this.#r(),this.#e.page(e)}async*stream(e={}){this.#e=await this.#r(),yield*this.#e.stream(e)}async project(e,t,n={}){return this.#e=await this.#r(),this.#e.project(e,t,n)}async#r(){let e=await w(this.#t);try{let t=await f(this.#t,this.#o);return(await y(t,this.#i,this.#n)).log}finally{await e()}}};(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="73852fdf-f072-51ab-9449-d7922712eeb4")}catch{}})();function K(i){return[...i].sort().join("\0")}function ie(i,e,t){let n=i.successors.get(e);n?n.push(t):i.successors.set(e,[t]);let r=i.predecessors.get(t);r?r.push(e):i.predecessors.set(t,[e])}function G(i,e,t,n,r){let o=e.resolve(r);if(o?.ordering!==!0)return;let s=M(n),c=s===void 0?void 0:i.canonicalIds.get(s.toLowerCase());if(c===void 0)return;let a=(o.precedence??"source_before_target")==="source_before_target";ie(i,a?t:c,a?c:t)}function ne(i,e){let t={successors:new Map,predecessors:new Map,canonicalIds:new Map},n=i.filter(r=>typeof r?.id=="string"&&r.id.trim().length>0);for(let r of n){let o=r.id.trim();t.canonicalIds.set(o.toLowerCase(),o)}for(let r of n){let o=r.id.trim();G(t,e,o,r.blocked_by,"blocked_by");for(let s of r.dependencies??[])typeof s!="object"||s===null||G(t,e,o,s.id,typeof s.kind=="string"?s.kind:"related")}for(let r of[t.successors,t.predecessors])for(let o of r.values())o.sort();return t}function re(i,e){let t=new Set([e]),n=[e];for(;n.length>0;){let r=n.pop();for(let o of[i.successors,i.predecessors])for(let s of o.get(r)??[])t.has(s)||(t.add(s),n.push(s))}return t}function oe(i,e){let t=new Map;for(let n of e){let r=(i.successors.get(n)??[]).filter(o=>e.has(o));r.length>0&&t.set(n,r)}return t}function H(i,e,t){let n=ne(i,e),r=n.canonicalIds.get(t.trim().toLowerCase());if(r===void 0)return{cycles:[],successors:new Map,canonical:t};let o=oe(n,re(n,r));return{cycles:q(o).filter(s=>s.includes(r)),successors:o,canonical:r}}function se(i,e,t){let n=new Set(e),r=n.has(t)?t:e[0];if(i.get(r)?.includes(r))return[r,r];for(let o of i.get(r)??[]){if(!n.has(o))continue;let s=ae(i,n,r,o);if(s)return s}return[...e,e[0]]}function ae(i,e,t,n){let r=[[n]],o=new Set([t,n]);for(;r.length>0;){let s=r.shift(),c=s.at(-1);for(let a of i.get(c)??[]){if(a===t)return[t,...s,t];!e.has(a)||o.has(a)||(o.add(a),r.push([...s,a]))}}}function ve(i,e,t){let n=m(),r=H(i,n,t),o=H(e,n,t),s=new Set(r.cycles.map(K)),c=new Set(k(i,void 0,n).map(a=>`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`));return[...k(e,void 0,n).filter(a=>a.holder_id.toLowerCase()===t.trim().toLowerCase()&&!c.has(`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`)).map(a=>`ordering_storage_contradiction_created:${V(a)}:remove_contradicting_dependency_row:run_pm_graph_audit`),...o.cycles.filter(a=>!s.has(K(a))).map(a=>`ordering_cycle_created:${se(o.successors,a,o.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="5f2ca18e-450d-5b6e-9e07-7bbf080764f9")}catch{}})();function Ee(i,e){let t=e.resolve(i);return t?.hierarchy===!0||t?.outgoing==="one"||t?.incoming==="one"}function J(i,e,t,n,r){let o=JSON.stringify([e,t,n]),s=i.get(o);s===void 0&&(s={kind:e,direction:t,node_id:n,endpoints:new Set},i.set(o,s)),s.endpoints.add(r)}function B(i,e){let t=new Map;for(let n of i)for(let r of n.dependencies??[]){let o=e.resolve(r.kind);o===void 0||o.hierarchy||(o.outgoing==="one"&&J(t,o.kind,"outgoing",n.id,r.id),o.incoming==="one"&&J(t,o.kind,"incoming",r.id,n.id))}return t}function Ie(i,e,t=m()){let n=B(i,t),r=B(e,t);for(let o of[...r.keys()].sort()){let s=r.get(o);if(s.endpoints.size<=1)continue;let c=n.get(o);if(![...s.endpoints].every(a=>c?.endpoints.has(a)))throw new C(`Relationship ${s.kind} permits only one ${s.direction} endpoint for ${s.node_id}.`,S.USAGE,{code:"dependency_cardinality_created",field:"dependencies",value:s.kind,relationship_cardinality:{kind:s.kind,direction:s.direction,node_id:s.node_id,endpoint_ids:[...s.endpoints].sort()},required:"The final dependency set must satisfy the active relationship kind's one-edge cardinality.",nextSteps:["Drop extra --dep seeds, or remove conflicting rows with update --dep-remove before adding another edge.","Choose another kind only when its declared semantics match the intended relationship."]})}}export{T as a,F as b,ve as c,Ee as d,Ie as e};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-UP765R2V.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as w,i as y,j,k as B,l as U,o as f,p as X,q as W,r as Y}from"./chunk-
|
|
1
|
+
import{f as w,i as y,j,k as B,l as U,o as f,p as X,q as W,r as Y}from"./chunk-YQKLKRMW.js";import{U as H,a as $,b as D}from"./chunk-YTEC2EPM.js";import{c as u,f as M,g as z,i as q}from"./chunk-E5C24MCV.js";import{Va as F,q as L,t as R}from"./chunk-ABMNYWV6.js";import{a as g,d as K}from"./chunk-B266DDBJ.js";import{da as k,g as P}from"./chunk-NLZUI234.js";import{a as N,e as O,f as A,g as x,i as C}from"./chunk-KTXU5WU6.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3ec1f825-59d1-5ce2-ac76-c628264bd8be")}catch{}})();var Ce=N,Pe=O,$e=C,De=A,Le=x;function G(e,t,n,r){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(a,i)=>i.toUpperCase()),o=n.has(s);return{long:t,...r?{short:r}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:o?"string":"boolean",...o?{value_name:e.value_name??"value"}:{}}}function Q(e,t=[]){let n=new Set(t.flatMap(s=>s.keys)),r=[];for(let s of L(e.map(o=>({...o})))){r.push(G(s,s.flag,n,s.short));for(let o of s.aliases??[])r.push(G(s,o,n))}return r}var Re=Q(R,$),Fe=Q(F,D);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="59d16a38-d6df-5695-96e3-28b6e384f76b")}catch{}})();var _=["agile","ops","research"],I={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:w.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
|
|
2
2
|
|
|
3
3
|
## I want
|
|
4
4
|
|
|
@@ -23,4 +23,4 @@ import{f as w,i as y,j,k as B,l as U,o as f,p as X,q as W,r as Y}from"./chunk-7D
|
|
|
23
23
|
|
|
24
24
|
## Conclusion
|
|
25
25
|
`}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function ne(e){if(e===void 0)return;let t=p(e);if(t.length===0)throw new Error("Profile name must not be empty.");if(_.includes(t))return t;throw new Error(`Invalid profile "${e}". Allowed: ${_.join(", ")}.`)}function qe(e){let t=ne(e);if(t===void 0)throw new Error(`Profile name is required. Allowed: ${_.join(", ")}.`);return I[t]}function je(){return _.map(e=>I[e])}function p(e){return e.trim().toLowerCase().replaceAll("-","_")}function J(e){return e.map(t=>t.definition.name).join(", ")}function re(e=[]){let t=_.map(o=>({definition:I[o],source:"builtin"})),n=new Set(_.map(o=>p(o))),r=new Set(n),s=[];for(let o of e){let a=p(o.profile.name);if(n.has(a)){s.push(`Extension "${o.name}" profile "${o.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(r.has(a)){s.push(`Profile "${o.profile.name}" from extension "${o.name}" duplicates an already-registered profile and was ignored.`);continue}r.add(a),t.push({definition:o.profile,source:"extension",package:o.name})}return{profiles:t,warnings:s}}function Be(e,t=[]){let{profiles:n,warnings:r}=re(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${J(n)}.`);let s=p(e),o=n.find(a=>p(a.definition.name)===s);if(o===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${J(n)}.`);return{resolved:o,warnings:r}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ab26bcb3-fb2a-5f2f-96e7-7965787b924e")}catch{}})();function se(e){return{types:e.types.length,statuses:e.statuses.length,fields:e.fields.length,workflows:e.workflows.length,config:e.config.length,templates:e.templates.length,packages:e.packages.length}}function Ye(e){return{name:e.name,title:e.title,summary:e.summary,composition:se(e),types:e.types.map(t=>S(()=>u(t).name,()=>String(t.name??""))),statuses:e.statuses.map(t=>S(()=>f(t).id,()=>String(t.id??""))),fields:e.fields.map(t=>S(()=>y(t).key,()=>String(t.key??""))),workflows:e.workflows.map(t=>t.type),config:e.config.map(t=>`${t.key}=${t.value}`),templates:e.templates.map(t=>t.name),packages:e.packages.map(t=>({spec:t.spec,reason:t.reason}))}}function S(e,t){try{return e()}catch{return t()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d681ddfe-ad15-527b-90de-bfbe341c6a86")}catch{}})();var oe=[{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_default_mode",path:"search.default_mode",kind:"string",choices:["auto","keyword","semantic","hybrid"],summary:"Mode a bare pm search runs in: auto (hybrid when semantic search is explicitly configured and runnable, else keyword), or a pinned keyword, semantic, or hybrid."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"agent_identity_probes_enabled",path:"agent_identity.probes_enabled",kind:"boolean",summary:"Allow privacy-bounded local harness provenance probes; no network or subprocess access is permitted."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Wait budget in milliseconds before a contended lock fails with lock_conflict; item-store mutations, restore and the hierarchy lock treat it as a no-progress window that each observed owner handoff restarts (120 s total cap), other locks as a fixed total; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],ae=new Map(oe.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function b(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return ae.get(t)}function ie(e,t){let n=t.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"||n==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:n==="false"||n==="0"||n==="no"||n==="off"?{ok:!0,parsed:{descriptor:e,value:!1}}:{ok:!1,error:{message:`Config set ${e.key} requires a boolean value (true|false), got "${t}"`}}}function le(e,t,n){return e.non_empty===!0&&n.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(n)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function de(e,t,n){if(n.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let r=Number(n);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1,error:{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function ce(e,t,n){return!Number.isInteger(n)||n<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires an integer >= ${e.min}, got "${t}" (the runtime silently ignores 0 here and falls back to the default)`}}:e.max!==void 0&&n>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function me(e,t,n){return n<0||n>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function pe(e,t,n){return e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function v(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let n=t.trim();if(e.kind==="boolean")return ie(e,t);if(e.kind==="string")return le(e,t,n);let r=de(e,t,n);return r.ok?e.kind==="integer"?ce(e,t,r.value):e.kind==="ratio"?me(e,t,r.value):pe(e,t,r.value):{ok:!1,error:r.error}}function V(e,t){let n=t.path.split("."),r=e;for(let s of n){if(typeof r!="object"||r===null)return null;let o=Object.getOwnPropertyDescriptor(r,s);if(!o||!Object.hasOwn(o,"value"))return null;r=o.value}return typeof r=="string"||typeof r=="number"||typeof r=="boolean"?r:null}function Ge(e,t,n){let r=t.path.split(".");if(r.some(a=>a.length===0||["__proto__","constructor","prototype"].includes(a)))throw new Error("Unsafe settings path");let s=e;for(let a=0;a<r.length-1;a+=1){let i=r[a],d=Object.getOwnPropertyDescriptor(s,i)?.value;if(typeof d!="object"||d===null||Array.isArray(d)){let c={};Object.defineProperty(s,i,{value:c,writable:!0,enumerable:!0,configurable:!0}),s=c}else s=d}let o=r[r.length-1];return Object.getOwnPropertyDescriptor(s,o)?.value===n?!1:(Object.defineProperty(s,o,{value:n,writable:!0,enumerable:!0,configurable:!0}),!0)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b04624c-2096-55dc-9dde-b8c76ead72d6")}catch{}})();var it=["profile","types","statuses","fields","workflows","config","templates","packages"],lt=["profile_name_empty","profile_name_not_normalized","profile_title_empty","profile_summary_empty","type_invalid","type_duplicate","status_invalid","status_duplicate","field_invalid","field_duplicate","field_mcp_input_collision","workflow_type_empty","workflow_type_unknown","workflow_duplicate_type","workflow_transition_malformed","workflow_status_unknown","config_key_unknown","config_value_invalid","config_duplicate","template_type_unknown","package_spec_empty"],ue=new Set(K.flatMap(e=>[g(e.id),...(e.aliases??[]).map(t=>g(t))]).filter(e=>e.length>0)),Z=new Set(P.map(e=>e.toLowerCase()));function ye(e,t){e.name.trim().length===0?t.push({severity:"error",code:"profile_name_empty",dimension:"profile",message:"Profile name must not be empty; profile resolution requires a non-blank name."}):e.name!==p(e.name)&&t.push({severity:"warning",code:"profile_name_not_normalized",dimension:"profile",target:e.name,message:`Profile name "${e.name}" is not in canonical form; resolution folds it to "${p(e.name)}" (lowercase, hyphens as underscores).`}),e.title.trim().length===0&&t.push({severity:"warning",code:"profile_title_empty",dimension:"profile",message:"Profile title is empty; list and show surfaces will render a blank title."}),e.summary.trim().length===0&&t.push({severity:"warning",code:"profile_summary_empty",dimension:"profile",message:"Profile summary is empty; list and show surfaces will render a blank archetype description."})}function fe(e,t){let n=new Set,r=new Set;for(let[s,o]of e.types.entries()){let a;try{a=u(o).name}catch(d){t.push({severity:"error",code:"type_invalid",dimension:"types",target:typeof o.name=="string"?o.name:`#${s}`,message:k(d)});continue}let i=a.toLowerCase();if(r.has(i)){t.push({severity:"error",code:"type_duplicate",dimension:"types",target:a,message:`Item type "${a}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(i),n.add(i)}return n}function he(e,t){let n=new Set,r=new Set;for(let[s,o]of e.statuses.entries()){let a;try{a=f(o)}catch(i){t.push({severity:"error",code:"status_invalid",dimension:"statuses",target:typeof o.id=="string"?o.id:`#${s}`,message:k(i)});continue}if(r.has(a.id)){t.push({severity:"error",code:"status_duplicate",dimension:"statuses",target:a.id,message:`Status "${a.id}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(a.id),n.add(a.id);for(let i of a.aliases??[])n.add(g(i))}return n}function ge(e,t){let n=new Set;for(let[r,s]of e.fields.entries()){let o;try{o=y(s).key}catch(i){t.push({severity:"error",code:"field_invalid",dimension:"fields",target:typeof s.key=="string"?s.key:`#${r}`,message:k(i)});continue}if(n.has(o)){t.push({severity:"error",code:"field_duplicate",dimension:"fields",target:o,message:`Field "${o}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}n.add(o);let a=H(o);a&&t.push({severity:"warning",code:"field_mcp_input_collision",dimension:"fields",target:o,message:`Field "${o}" collides with canonical MCP property "${a.property}" owned by ${a.owner}; callers must pass the custom value through ${a.nested_path}.`})}}function _e(e,t,n,r){let s=new Set;for(let[o,a]of e.workflows.entries()){let i=a.type.trim().toLowerCase();if(i.length===0){r.push({severity:"error",code:"workflow_type_empty",dimension:"workflows",target:`#${o}`,message:"Workflow has an empty type; the workflow resolver drops entries without a type."});continue}let d=s.has(i);s.add(i),d?r.push({severity:"warning",code:"workflow_duplicate_type",dimension:"workflows",target:a.type,message:`Workflow type "${a.type}" is declared more than once; the later transition set wins.`}):!Z.has(i)&&!t.has(i)&&r.push({severity:"warning",code:"workflow_type_unknown",dimension:"workflows",target:a.type,message:`Workflow governs type "${a.type}" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`});let c=new Set;for(let l of a.allowed_transitions){let m=g(l[0]),T=g(l[1]);if(m.length===0||T.length===0){r.push({severity:"error",code:"workflow_transition_malformed",dimension:"workflows",target:a.type,message:`Workflow "${a.type}" has a transition with an empty status; the workflow resolver silently drops it.`});continue}for(let h of[m,T])ue.has(h)||n.has(h)||c.has(h)||(c.add(h),r.push({severity:"warning",code:"workflow_status_unknown",dimension:"workflows",target:h,message:`Workflow "${a.type}" references status "${h}" which is neither a built-in status nor declared by this profile; transitions to or from it are unreachable.`}))}}}function ke(e,t){let n=new Set;for(let r of e.config){let s=b(r.key);if(s===void 0){t.push({severity:"error",code:"config_key_unknown",dimension:"config",target:r.key,message:`Config knob "${r.key}" is not a recognized setting; apply rejects it with a usage error.`});continue}n.has(s.key)?t.push({severity:"error",code:"config_duplicate",dimension:"config",target:s.key,message:`Config knob "${s.key}" is set more than once; the later value silently overwrites the earlier one.`}):n.add(s.key);let o=v(s,r.value);o.ok||t.push({severity:"error",code:"config_value_invalid",dimension:"config",target:r.key,message:o.error.message})}}function we(e,t,n){for(let r of e.templates){let s=r.options.type;if(typeof s!="string"||s.trim().length===0)continue;let o=s.trim().toLowerCase();!Z.has(o)&&!t.has(o)&&n.push({severity:"warning",code:"template_type_unknown",dimension:"templates",target:r.name,message:`Template "${r.name}" creates type "${s}" which is neither a built-in type nor declared by this profile.`})}}function be(e,t){for(let[n,r]of e.packages.entries())r.spec.trim().length===0&&t.push({severity:"warning",code:"package_spec_empty",dimension:"packages",target:`#${n}`,message:"Package recommendation has an empty spec; it cannot be surfaced as an install hint."})}function dt(e){let t=[];ye(e,t);let n=fe(e,t),r=he(e,t);ge(e,t),_e(e,n,r,t),ke(e,t),we(e,n,t),be(e,t);let s=t.filter(a=>a.severity==="error").length,o=t.length-s;return{profile:e.name,ok:s===0,findings:t,errorCount:s,warningCount:o}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be2b507d-2797-570c-b211-46d950edcbde")}catch{}})();function E(e,t,n,r,s){let o=e,a=[];for(let i of t){let d=r(o),c=s(o,i),l=r(c.file);o=c.file;let m=d===l?"unchanged":c.replaced?"update":"add";a.push({key:n(i),status:m})}return{file:o,changes:a,changed:a.some(i=>i.status!=="unchanged")}}function ee(e){return JSON.stringify(e.map(t=>t.join("\0")).sort())}function ve(e,t){let n=e.map(s=>({...s})),r=[];for(let s of t){let o=n.findIndex(i=>i.type===s.type),a={type:s.type,allowed_transitions:s.allowed_transitions};o<0?(n.push(a),r.push({type:s.type,status:"add"})):ee(n[o].allowed_transitions)===ee(s.allowed_transitions)?r.push({type:s.type,status:"unchanged"}):(n[o]=a,r.push({type:s.type,status:"update"}))}return{changes:r,result:n,changed:r.some(s=>s.status!=="unchanged")}}function Ie(e,t){let n=[];for(let r of e.config){let s=b(r.key);if(s===void 0)throw new Error(`Profile "${e.name}" references unknown config key "${r.key}".`);let o=v(s,r.value);if(!o.ok)throw new Error(`Profile "${e.name}" config ${r.key}: ${o.error.message}`);let a=V(t,s),i=a===null?"add":a===o.parsed.value?"unchanged":"update";n.push({key:s.key,path:s.path,value:o.parsed.value,status:i})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function te(e){let t=Object.entries(e).sort(([n],[r])=>n.localeCompare(r));return JSON.stringify(t)}function Se(e,t){let n=[];for(let r of e.templates){let s=t.get(r.name),o;s===void 0?o="add":te(s)===te(r.options)?o="unchanged":o="update",n.push({name:r.name,options:r.options,status:o})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function ft(e,t){let n=E(M(t.typesRaw),e.types,l=>u(l).name,q,(l,m)=>z(l,u(m))),r=E(X(t.statusesRaw),e.statuses,l=>f(l).id,W,(l,m)=>Y(l,f(m))),s=E(j(t.fieldsRaw),e.fields,l=>y(l).key,B,(l,m)=>U(l,y(m))),o=ve(t.workflows,e.workflows),a=Ie(e,t.settings),i=Se(e,t.templates),d=e.packages.map(l=>({spec:l.spec,reason:l.reason,status:t.installedPackages.has(l.spec)?"installed":"recommended"})),c=n.changed||r.changed||s.changed||o.changed||a.changed||i.changed;return{profile:{name:e.name,title:e.title,summary:e.summary},types:n,statuses:r,fields:s,workflows:o,config:a,templates:i,packages:d,changed:c}}export{Ce as a,Pe as b,$e as c,De as d,Le as e,Q as f,Re as g,Fe as h,_ as i,I as j,ne as k,qe as l,je as m,re as n,Be as o,se as p,Ye as q,oe as r,b as s,v as t,V as u,Ge as v,it as w,lt as x,dt as y,ft as z};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-WDWHUJQW.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as k}from"./chunk-
|
|
1
|
+
import{c as k}from"./chunk-E5C24MCV.js";import{a,d as w}from"./chunk-B266DDBJ.js";import{Y as A,j as g,k as _,l as b}from"./chunk-NLZUI234.js";import{B as y,l as S,y as f,z as u}from"./chunk-KTXU5WU6.js";import x from"node:fs/promises";import p from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="74b72dd8-0877-55a4-9c80-d043f19e1f96")}catch{}})();var M=["extensions","docs","examples","assets","prompts"],P=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});function U(e){return M.includes(e)}function R(e,t){if(t==null)return[];let n=Array.isArray(t)?t:[t],r=[];for(let o of n){if(typeof o!="string"||o.trim().length===0)throw new u(`Package manifest field pm.${e} must contain string paths.`,f.USAGE);r.push(o.trim())}return[...new Set(r)].sort((o,i)=>o.localeCompare(i))}function q(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new u("Package manifest field pm must be an object.",f.USAGE);let t={},n=e;for(let[r,o]of Object.entries(n)){if(!U(r))continue;let i=R(r,o);i.length>0&&(t[r]=i)}return t}function d(e,t){let n=e[t];return typeof n=="string"&&n.trim().length>0?n.trim():void 0}function v(e){if(!Array.isArray(e))return;let t=e.map(n=>typeof n=="string"?n.trim():"").filter(n=>n.length>0);return t.length>0?[...new Set(t)].sort((n,r)=>n.localeCompare(r)):void 0}function T(e){if(typeof e=="string"&&e.trim().length>0)return e.trim();if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let t=e.url;return typeof t=="string"&&t.trim().length>0?t.trim():void 0}}function G(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={docs:d(t,"docs"),npm:d(t,"npm"),repository:d(t,"repository"),report:d(t,"report")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function J(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={image:d(t,"image"),video:d(t,"video")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={display_name:d(t,"display_name")??d(t,"displayName"),category:d(t,"category"),summary:d(t,"summary"),links:G(t.links),media:J(t.media),tags:v(t.tags)};return Object.values(n).some(r=>r!==void 0)?n:void 0}async function V(e){let t=p.join(e,"package.json");if(!await y(t))return{source:"convention",resources:{}};let n;try{n=JSON.parse(await x.readFile(t,"utf8"))}catch(l){throw new u(`Failed to parse package manifest at "${t}": ${String(l)}`,f.USAGE)}if(typeof n!="object"||n===null||Array.isArray(n))throw new u(`Package manifest at "${t}" must be a JSON object.`,f.USAGE);let r=n,o=r.pm,i=o!=null,s=typeof o=="object"&&o!==null&&!Array.isArray(o)?o:{};return{source:i?"pm":"convention",package_json_path:t,package_name:typeof r.name=="string"?r.name:void 0,package_version:typeof r.version=="string"?r.version:void 0,package_private:r.private===!0,package_description:typeof r.description=="string"?r.description:void 0,package_keywords:v(r.keywords),package_homepage:typeof r.homepage=="string"?r.homepage:void 0,package_repository_url:T(r.repository),package_bugs_url:T(r.bugs),aliases:v(s.aliases),resources:q(o),catalog:K(s.catalog)}}async function I(e){if(!await y(e))return[];let t=await x.readdir(e,{withFileTypes:!0}),n=[];for(let r of t){if(!r.isDirectory())continue;let o=p.join(e,r.name);await y(p.join(o,"manifest.json"))&&n.push(o)}return n.sort((r,o)=>r.localeCompare(o))}async function ge(e){if(await y(p.join(e,"manifest.json")))return[e];let t=(await V(e)).resources.extensions??[],n=new Set;for(let r of t){if(r.includes("*")||r.startsWith("!"))throw new u(`Package extension entry "${r}" uses a glob/exclusion pattern. pm package installs currently require concrete extension paths or directories.`,f.USAGE);let o=p.resolve(e,r);if(!A(e,o))throw new u(`Package extension entry "${r}" resolves outside package root.`,f.USAGE);if(await y(p.join(o,"manifest.json"))){n.add(o);continue}for(let i of await I(o))n.add(i)}if(t.length===0)for(let r of P.extensions)for(let o of await I(p.join(e,r)))n.add(o);return[...n].sort((r,o)=>r.localeCompare(o))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3984f1ef-1703-5a83-a4fa-ec1cdc738572")}catch{}})();var j=[["commands","Commands"],["command_overrides","Command overrides"],["flag_commands","Flag commands"],["item_types","Item types"],["item_fields","Item fields"],["migrations","Migrations"],["profiles","Profiles"],["importers","Importers"],["exporters","Exporters"],["search_providers","Search providers"],["vector_store_adapters","Vector store adapters"],["assurance_providers","Assurance measurement providers"],["hooks","Lifecycle hooks"],["parser_overrides","Parser overrides"],["service_overrides","Service overrides"],["renderer_overrides","Renderer overrides"]];function E(e){return"#".repeat(e)}function C(e){if(!e.includes("`"))return`\`${e}\``;let t=0,n=0;for(let i of e)n=i==="`"?n+1:0,t=Math.max(t,n);let r="`".repeat(t+1),o=e.startsWith("`")||e.endsWith("`")?" ":"";return`${r}${o}${e}${o}${r}`}function Y(e){return e.length===0?"Capabilities: _none registered_":`Capabilities: ${e.map(C).join(", ")}`}function B(e,t,n){let r=[`${E(t)} ${e}`,""];return n.length===0?(r.push("_None._",""),r):(r.push(...n.map(o=>`- ${C(o)}`),""),r)}function W(e,t,n){return e===0&&!n?[]:[`${E(t)} Preflight overrides`,"",e>0?`- ${e} registered (this surface carries no per-entry identifier)`:"_None._",""]}function _e(e,t={}){let n=t.headingLevel??2;if(!Number.isInteger(n)||n<1||n>6)throw new RangeError(`headingLevel must be an integer in [1, 6], received ${String(t.headingLevel)}`);let r=Math.min(n+1,6),o=t.includeEmpty===!0,i=t.title??"Extension surfaces",s=[`${E(n)} ${i}`,""];(o||e.capabilities.length>0)&&s.push(Y(e.capabilities),"");for(let[l,c]of j){let m=e[l]??[];m.length===0&&!o||s.push(...B(c,r,m))}return s.push(...W(e.preflight_overrides,r,o)),!(e.preflight_overrides>0||j.some(([l])=>(e[l]?.length??0)>0))&&!o&&s.push("_This extension registers no surfaces._",""),`${s.join(`
|
|
2
2
|
`).trimEnd()}
|
|
3
3
|
`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="abb182c9-6d6c-5be4-a2ad-c91b00a098d0")}catch{}})();var H=["agile","ops","research"],X={agile:[{name:"Story",description:"User-facing outcome or capability slice expressed from a stakeholder perspective.",defaultStatus:"open",folder:"stories",aliases:["user-story"]},{name:"Spike",description:"Time-boxed investigation used to reduce uncertainty before implementation.",defaultStatus:"open",folder:"spikes",aliases:["research-spike"]}],ops:[{name:"Incident",description:"Operational disruption, degradation, or support escalation with recovery tracking.",defaultStatus:"open",folder:"incidents",aliases:["outage"]},{name:"Runbook",description:"Repeatable operational procedure, diagnostic path, or response playbook.",defaultStatus:"open",folder:"runbooks",aliases:["playbook"]}],research:[{name:"Experiment",description:"Validated-learning activity with hypothesis, method, and outcome tracking.",defaultStatus:"open",folder:"experiments",aliases:["study"]},{name:"Hypothesis",description:"Testable claim or assumption that should be supported, rejected, or refined.",defaultStatus:"open",folder:"hypotheses",aliases:["assumption"]}]};function Ee(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new Error("Type preset name must not be empty.");if(t==="agile"||t==="ops"||t==="research")return t;throw new Error(`Invalid type preset "${e}". Allowed: ${H.join(", ")}.`)}function Se(e){return X[e].map(t=>k(t))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="68be16cc-4cb4-5df6-90f0-897d4fe82339")}catch{}})();var Q=new Set(_),Z=new Set(b),D=new Set([...S.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),ee=["create","update"];function O(e){if(typeof e!="string")return"";let t=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return t.startsWith("--")?t.slice(2):t}function $(e){return e.replaceAll("_","-")}function te(e,t){let n=new Set;for(let r of e){let o=O(r);o.length>0&&o!==t&&n.add(o)}return[...n].sort((r,o)=>r.localeCompare(o))}function re(e){let t=new Set;for(let n of e??[]){let r=n.trim();r.length>0&&t.add(r)}return[...t].sort((n,r)=>n.localeCompare(r))}function ne(e){let t=new Set,n=[];for(let r of e??[]){let o=r.trim().toLowerCase();if(o.length!==0){if(!Z.has(o))throw new Error(`Invalid field command "${r}". Allowed: ${b.join(", ")}.`);t.has(o)||(t.add(o),n.push(o))}}return e===void 0||n.length===0?[...ee]:n}function xe(e){let t=a(e.key);if(t.length===0)throw new Error("Field key must not be empty.");if(D.has(t))throw new Error(`Cannot define custom field "${t}": custom schema field "${t}" collides with built-in item metadata "${t}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...D].sort((L,z)=>L.localeCompare(z)).join(", ")}.`);let n=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!Q.has(n))throw new Error(`Invalid field type "${e.type}". Allowed: ${_.join(", ")}.`);let r=n,o=ne(e.commands),i=O(e.cliFlag),s=i.length>0&&i!==$(t)?i:void 0,l=s??$(t),c=te(e.aliases??[],l),m=e.description?.trim();return{key:t,type:r,commands:o,description:m&&m.length>0?m:void 0,cliFlag:s,cliAliases:c,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:re(e.requiredTypes)}}function oe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function ie(e){let t=oe(e);if(!t)return[];let n=[];for(let r of t){if(typeof r!="object"||r===null||Array.isArray(r))continue;let o=r;typeof o.key!="string"||o.key.trim().length===0||n.push(o)}return n}function je(e){if(e==null||e.trim().length===0)return{fields:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:ie(t)}}function Ce(e){return`${JSON.stringify({fields:e.fields},null,2)}
|
|
4
4
|
`}function De(e,t){let n=e.fields.find(s=>a(s.key)===t.key),r=n!==void 0,o=e.fields.filter(s=>a(s.key)!==t.key),i={...n,key:t.key,type:t.type,commands:[...t.commands]};return F(i,"description",t.description),F(i,"cli_flag",t.cliFlag),t.cliAliases.length>0?i.cli_aliases=[...t.cliAliases]:delete i.cli_aliases,N(i,"required",t.required),N(i,"required_on_create",t.requiredOnCreate),t.allowUnset===!1?i.allow_unset=!1:delete i.allow_unset,t.requiredTypes.length>0?i.required_types=[...t.requiredTypes]:delete i.required_types,o.push(i),o.sort((s,l)=>a(s.key).localeCompare(a(l.key))),{file:{fields:o},definition:i,replaced:r}}function $e(e,t){let n=a(t);if(n.length===0)throw new Error("Field key must not be empty.");let r=[],o=e.fields.filter(i=>a(i.key)===n?(r.push(i),!1):!0);return r.length===0?{file:{fields:o},removed:!1}:{file:{fields:o},removed:!0,definition:r[0]}}function F(e,t,n){let r=e;n!==void 0&&n.length>0?r[t]=n:delete r[t]}function N(e,t,n){let r=e;n?r[t]=!0:delete r[t]}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b1e4c04e-0ade-5d24-95e3-b8dca3832c5a")}catch{}})();var se=new Set(g),h=new Set(w.map(e=>a(e.id)).filter(e=>e.length>0));function ae(e){let t=new Set;for(let n of e){let r=a(n);r.length>0&&t.add(r)}return[...t].sort((n,r)=>n.localeCompare(r))}function Me(e){let t=a(e.id);if(t.length===0)throw new Error("Status id must not be empty.");if(h.has(t))throw new Error(`Cannot add-status the built-in status "${t}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let n;if(e.roles!==void 0){n=[];let s=new Set;for(let l of e.roles){let c=typeof l=="string"?l.trim().toLowerCase():"";if(c.length!==0){if(!se.has(c))throw new Error(`Invalid status role "${l}". Allowed roles: ${g.join(", ")}.`);s.has(c)||(s.add(c),n.push(c))}}if(n.length===0)throw new Error(`Status role must include at least one lifecycle role. Allowed roles: ${g.join(", ")}.`)}let r=e.aliases===void 0?void 0:ae(e.aliases).filter(s=>s!==t),o=e.description?.trim(),i=typeof e.order=="number"&&Number.isFinite(e.order)?Math.trunc(e.order):void 0;return{id:t,roles:n,aliases:r,description:o&&o.length>0?o:void 0,order:i}}function le(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function de(e){let t=le(e);if(!t)return[];let n=[];for(let r of t){if(typeof r!="object"||r===null||Array.isArray(r))continue;let o=r;typeof o.id!="string"||o.id.trim().length===0||n.push(o)}return n}function Pe(e){if(e==null||e.trim().length===0)return{statuses:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/statuses.json contains invalid JSON.")}return{statuses:de(t)}}function Ue(e){return`${JSON.stringify({statuses:e.statuses},null,2)}
|
|
5
5
|
`}function Re(e,t,n){let r=e.statuses.slice(),o=r.findIndex(l=>a(l.id)===t.id),i=o>=0?r[o]:n,s={...i,id:t.id};return t.roles!==void 0&&(t.roles.length>0?s.roles=[...t.roles]:s.roles!==void 0&&delete s.roles),t.aliases!==void 0&&(t.aliases.length>0?s.aliases=[...t.aliases]:s.aliases!==void 0&&delete s.aliases),t.description!==void 0&&(s.description=t.description),t.order!==void 0&&(s.order=t.order),o>=0?r[o]=s:r.push(s),{file:{statuses:r},definition:s,replaced:i!==void 0}}function qe(e,t){let n=a(t);if(n.length===0)throw new Error("Status id must not be empty.");if(h.has(n))throw new Error(`Cannot remove built-in status "${n}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let r=e.statuses.slice(),o=r.findIndex(s=>a(s.id)===n);if(o<0)return{file:{statuses:r},removed:!1};let[i]=r.splice(o,1);return{file:{statuses:r},removed:!0,definition:i}}function Ge(e,t){let n=[e.id,...e.aliases??[]];for(let r of n){let o=a(r);if(o.length===0)continue;let i=t.get(o);if(i!==void 0&&i!==e.id)throw new Error(`Status token "${o}" already belongs to status "${i}". Choose a different id/alias to avoid shadowing it.`)}}export{M as a,P as b,V as c,ge as d,H as e,X as f,Ee as g,Se as h,xe as i,je as j,Ce as k,De as l,$e as m,h as n,Me as o,Pe as p,Ue as q,Re as r,qe as s,Ge as t,_e as u};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-YQKLKRMW.js.map
|