@unbrained/pm-cli 2026.10.5 → 2026.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +26 -1
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/runtime/projection-retry.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +158 -158
- package/dist/cli-bundle/chunks/{chunk-Z66DWDAU.js → chunk-25EW53VO.js} +39 -38
- package/dist/cli-bundle/chunks/{chunk-YVBRASXO.js → chunk-3CCVTV6Q.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5MNOWZPN.js → chunk-3REXBTST.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-4WB55TBC.js +80 -0
- package/dist/cli-bundle/chunks/{chunk-OOLYASYJ.js → chunk-6STTPXOC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AJ7H6XUF.js → chunk-ATB4ZZBQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-N4YGSG6F.js → chunk-D4G43LBV.js} +38 -38
- package/dist/cli-bundle/chunks/{chunk-HRJ6G6ZG.js → chunk-K6D6DMRT.js} +28 -28
- package/dist/cli-bundle/chunks/chunk-KIRHWPZB.js +2 -0
- package/dist/cli-bundle/chunks/chunk-O67BH435.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-3CYOBJUK.js → chunk-RJHLD64E.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WFZ4UEOB.js → chunk-TUKO5NF7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VZ63DEVJ.js → chunk-XJD47LUH.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-75QXHIFH.js → register-list-query-53WYLNZT.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-YS54SCHG.js → register-mutation-34XXUBVI.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-6KHZQSYJ.js → register-operations-WANO6EIM.js} +2 -2
- package/dist/cli-bundle/chunks/register-setup-WT37UPBQ.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GITOYRUW.js → chunk-6KFKQD2D.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UDYRVBOZ.js → chunk-FOHRPFIT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DDRN42PB.js → chunk-GRQXL5G5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ABV67XCC.js → chunk-JZ4WGUVH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-B5RSLVE6.js → chunk-NM3PM6O6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-OT7HK7SG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2CVX3KR3.js → chunk-PCLU34KB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5C3IDDW7.js → chunk-QQIE4L42.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RPUNVKXK.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LE4JUCRR.js → chunk-RXSVJPZ7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-SPN5QTZ3.js +30 -0
- package/dist/cli-bundle/focused-chunks/{chunk-CLDPTMQY.js → chunk-SUZJNPGB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YMU42COG.js → chunk-W4BG5HHS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-C224METM.js → chunk-Y5HXFDTZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ECBOPEJE.js → chunk-ZK5SOOPC.js} +61 -61
- package/dist/cli-bundle/focused-chunks/chunk-ZQK2XUSS.js +12 -0
- package/dist/cli-bundle/main.js +21 -21
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +31 -30
- 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 +42 -42
- 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 +2 -2
- package/dist/core/extensions/extension-types.d.ts +2 -0
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +5 -1
- package/dist/sdk/cli-bootstrap.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/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/extension/managed-state.d.ts +2 -0
- package/dist/sdk/extension/managed-state.js +1 -1
- package/dist/sdk/extension/managed-update-status.d.ts +3 -0
- package/dist/sdk/extension/managed-update-status.js +2 -0
- package/dist/sdk/extension/source-resolution.d.ts +2 -6
- package/dist/sdk/extension/source-resolution.js +1 -1
- package/dist/sdk/extension/update-check.d.ts +10 -0
- package/dist/sdk/extension/update-check.js +1 -1
- package/dist/sdk/extension-command-context.js +2 -1
- package/dist/sdk/extension.d.ts +4 -0
- package/dist/sdk/extension.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/test/execution.d.ts +2 -1
- package/dist/sdk/test/execution.js +3 -3
- package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +36 -0
- package/docs/GET_READ_EVIDENCE.md +17 -1
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +23 -0
- package/docs/PR_REVIEW_LOOP.md +21 -4
- package/docs/README.md +1 -0
- package/docs/RELEASING.md +18 -0
- package/docs/SDK_CONFIGURATION_SAFETY.md +123 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +3 -3
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +2 -2
- package/package.json +3 -3
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
- package/dist/cli-bundle/chunks/chunk-D332RXZ7.js +0 -80
- package/dist/cli-bundle/chunks/chunk-KRVI56QE.js +0 -6
- package/dist/cli-bundle/chunks/chunk-TGMONGWX.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-RTATEN2M.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-DOVTUKJQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-GUIF3WVC.js +0 -30
- package/dist/cli-bundle/focused-chunks/chunk-RHIH6XIW.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-XV5RV4ZT.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ft,b as pt,d as _t}from"./chunk-5C3IDDW7.js";import{t as Sr}from"./chunk-YMU42COG.js";import{Ab as ne,Bb as ye,Ca as Pr,Cb as vt,Da as Et,Eb as It,Fb as oe,Gb as Hr,H as Mr,J as Dr,K as Or,Qa as $r,Sa as Ur,Sb as Br,T as fe,V as q,Wa as De,Xa as v,Y as yt,Ya as Oe,Yb as Gr,Z as gt,Zb as Yr,aa as pe,ac as Wr,bb as Ne,cb as re,eb as zr,fb as Vr,hb as jr,ib as Kr,oa as ht,pa as Nr,qa as wt,qb as St,sb as Tt,ub as qr,va as Fr,wb as _e,za as bt}from"./chunk-GITOYRUW.js";import{f as Tr,n as ee,p as ut}from"./chunk-B5RSLVE6.js";import{$ as m,$a as ue,$d as xr,Bc as Ir,Da as w,Ea as T,Fa as le,Ga as Z,Ha as E,Ja as br,Kc as P,Nc as Le,Qb as vr,Qc as Ar,Ta as A,Ua as de,V as at,Wd as M,Za as R,Zc as Cr,_d as te,aa as f,ab as ct,ae as xe,bb as lt,cb as Er,cd as Rr,db as me,dd as kr,de as Me,ed as mt,i as st,id as Lr,sa as U,sb as dt,ua as Q,va as S,xa as I,za as ke}from"./chunk-GUIF3WVC.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]="b84fee06-5bbd-57f9-9643-f283d6c87afa")}catch{}})();function Xr(e,t="--limit"){if(e===void 0)return;let r=Number(e);if(!Number.isFinite(r)||r<0)throw new f(`${t} must be a non-negative number`,m.USAGE);return Math.floor(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]="9b58b44d-819c-5115-b011-f9dfa8e2ab41")}catch{}})();var bi=3e4,ge=class extends Error{status;constructor(t,r){super(t),this.name="SearchHttpError",this.status=r}};function H(e,t,r=bi){let n=e??r;if(!Number.isFinite(n)||n<=0)throw new Error(`${t} timeout must be a positive finite number`);return Math.floor(n)}function B(e,t){if(e)return e;if(typeof globalThis.fetch=="function")return globalThis.fetch.bind(globalThis);throw new Error(`${t} execution requires a fetch implementation`)}async function Ei(e){try{return(await e.text()).replaceAll(/\s+/g," ").trim()}catch(t){return`(failed to read response body: ${E(t)})`}}async function Fe(e){let t=new AbortController,r=setTimeout(()=>{t.abort()},e.timeoutMs);try{let n;try{n=await e.fetcher(e.endpoint,{method:e.method,headers:e.headers,body:JSON.stringify(e.body),signal:t.signal})}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error(`${e.requestLabel} timed out after ${e.timeoutMs}ms`):new Error(`${e.requestLabel} execution failed: ${E(o)}`)}if(!n.ok){let o=await Ei(n),i=o.length>0?`: ${o}`:"";throw new ge(`${e.requestLabel} failed with status ${n.status} ${n.statusText}${i}`,n.status)}try{return await n.json()}catch(o){throw new Error(`${e.responseLabel} JSON parse failed: ${E(o)}`)}}finally{clearTimeout(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]="8e3bb919-c8f9-50b5-8e41-b6719d17bd21")}catch{}})();function Ed(e,t){let r=w(e);if(!r)return"unconfigured";let n=w(t);return n&&n.toLowerCase()===r.toLowerCase()?"configured":"auto-detected"}function Si(e){let t=le(e),r=t.toLowerCase();return r.endsWith("/embeddings")?t:r.endsWith("/v1")?`${t}/embeddings`:`${t}/v1/embeddings`}function Qr(e){let t=e.search?.embedding_model;return w(t)||null}function Ti(e){let t=w(e.providers?.openai?.base_url),r=w(e.providers?.openai?.model);if(!t||!r)return null;let n=Qr(e),o=w(e.providers?.openai?.api_key);return{name:"openai",base_url:t,model:n??r,...o?{api_key:o}:{}}}function vi(e){let t=w(e.providers?.ollama?.base_url),r=w(e.providers?.ollama?.model);if(!t||!r)return null;let n=Qr(e);return{name:"ollama",base_url:t,model:n??r}}function Zr(e){let t=(Array.isArray(e)?e:[e]).map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)throw new Error("Embedding input must include at least one non-empty string");return t}function Ii(e){let t=[],r=[],n=new Map;for(let o of e){let i=n.get(o);if(i===void 0){let s=t.length;t.push(o),n.set(o,s),r.push(s);continue}r.push(i)}return{uniqueInputs:t,originalToUniqueIndex:r}}function Ai(e){let t=e.map((r,n)=>({embedding:r.embedding,index:r.index,position:n}));if(t.some(r=>r.index!==void 0)){for(let r of t)if(!Number.isInteger(r.index))throw new TypeError(`OpenAI embedding response entry at position ${r.position} is missing a valid integer index`);return[...t].sort((r,n)=>{let o=r.index-n.index;return o!==0?o:r.position-n.position})}return t}function At(e){let t=Ti(e),r=vi(e),n=[t,r].filter(s=>s!==null),o=w(e.search?.provider),i=o?o.toLowerCase():null;return{active:(i?n.find(s=>s.name===i):void 0)??n[0]??null,available:n}}function Jr(e){let t=le(e.base_url);return e.name==="openai"?{provider:"openai",endpoint:Si(t),model:e.model}:{provider:"ollama",endpoint:`${t}/api/embed`,model:e.model}}function Ci(e,t){let r=Zr(t);return e.name==="openai"?{target:Jr(e),method:"POST",headers:{"content-type":"application/json",...e.api_key?{authorization:`Bearer ${e.api_key}`}:{}},body:{model:e.model,input:r.length===1?r[0]:r}}:{target:Jr(e),method:"POST",headers:{"content-type":"application/json"},body:{model:e.model,input:r}}}function Ri(e,t){if(e.name==="openai"){let o=t.data;if(!Array.isArray(o)||o.length===0)throw new Error("OpenAI embedding response must include a non-empty data array");return Ai(o).map((i,s)=>{let a=i.embedding;if(!Z(a))throw new Error(`OpenAI embedding response entry at index ${s} is missing a numeric embedding vector`);return[...a]})}let r=t.embedding;if(Z(r))return[[...r]];let n=t.embeddings;if(Array.isArray(n)&&n.length>0)return n.map((o,i)=>{if(!Z(o))throw new Error(`Ollama embedding response entry at index ${i} is missing a numeric embedding vector`);return[...o]});throw new Error("Ollama embedding response must include embedding or embeddings vectors")}async function en(e,t,r={}){let n=H(r.timeout_ms,"Embedding request"),o=B(r.fetcher,"Embedding request"),i=Zr(t),s=Ii(i),a=Ci(e,s.uniqueInputs),c=await Fe({endpoint:a.target.endpoint,method:a.method,headers:a.headers,body:a.body,timeoutMs:n,fetcher:o,requestLabel:"Embedding request",responseLabel:"Embedding response"}),l=Ri(e,c);if(l.length!==s.uniqueInputs.length)throw new Error(`Embedding response cardinality mismatch: expected ${s.uniqueInputs.length} vector(s), received ${l.length}`);return s.originalToUniqueIndex.map(d=>[...l[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]="5c86afdf-6d8d-5851-82c1-ae5bcc9f0196")}catch{}})();var Pe=["title","description","tags","status","type","priority","assignee","parent","goal","value","why_now","risk","confidence","estimated_minutes","acceptance_criteria","resolution","expected_result","actual_result","body","comments","notes","learnings","reminders","events","dependencies","plan"];function Ct(e){let t=e?.search?.corpus_fields;if(!Array.isArray(t))return[...Pe];let r=new Set(Pe),n=Array.from(new Set(t.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0&&r.has(o))));return n.length>0?n:[...Pe]}var ki=8e3,Li=3200,G="...[semantic corpus truncated]",xi="search_embedding_corpus_max_characters_invalid:using_provider_default";function O(e){return e.map(t=>t==null?"":String(t).trim()).filter(t=>t.length>0).join(" ")}function Mi(e){return(e.reminders??[]).map(t=>O([t.at,t.text]))}function Di(e){return(e.events??[]).map(t=>O([t.start_at,t.end_at,t.title,t.description,t.location,t.all_day===!0?"all day":void 0,t.timezone,t.recurrence?.freq,t.recurrence?.interval,t.recurrence?.count,t.recurrence?.until,t.recurrence?.by_weekday?.join(" "),t.recurrence?.by_month_day?.join(" "),t.recurrence?.exdates?.join(" ")]))}function Oi(e,t){e.push(t.title,t.body,t.status,t.owner,t.evidence,t.blocked_reason,t.superseded_by);for(let r of t.linked_items??[])e.push(`${r.kind} ${r.id}`,r.note);for(let r of t.files??[])e.push(r.path,r.note);for(let r of t.tests??[])e.push(r.command,r.path,r.note);for(let r of t.docs??[])e.push(r.path,r.note)}function Ni(e,t){for(let r of t.plan_decisions??[])e.push(r.decision,r.rationale,r.evidence);for(let r of t.plan_discoveries??[])e.push(r.text);for(let r of t.plan_validation??[])e.push(r.text,r.command,r.expected)}function vd(e){let t=[];t.push(e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context);for(let r of e.plan_steps??[])Oi(t,r);return Ni(t,e),t.filter(r=>typeof r=="string"&&r.length>0).join(" ")}function Fi(e){let t=(e.plan_steps??[]).map(i=>O([i.order,i.id,i.title,i.body,i.status,i.owner,i.evidence,i.blocked_reason,i.superseded_by,(i.linked_items??[]).map(s=>O([s.kind,s.id,s.note])).join(" "),(i.files??[]).map(s=>O([s.path,s.note])).join(" "),(i.tests??[]).map(s=>O([s.command,s.path,s.note])).join(" "),(i.docs??[]).map(s=>O([s.path,s.note])).join(" ")])),r=(e.plan_decisions??[]).map(i=>O([i.decision,i.rationale,i.evidence,i.step_id])),n=(e.plan_discoveries??[]).map(i=>O([i.text,i.step_id])),o=(e.plan_validation??[]).map(i=>O([i.text,i.command,i.expected]));if([e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context,...t,...r,...n,...o].some(i=>i!==void 0))return{mode:e.plan_mode,scope:e.plan_scope,harness:e.plan_harness,resume_context:e.plan_resume_context,steps:t,decisions:r,discoveries:n,validation:o}}function D(e){return typeof e=="string"&&e.trim().length>0}var Pi={title:e=>e.metadata.title,description:e=>e.metadata.description,tags:e=>e.metadata.tags,status:e=>e.metadata.status,type:e=>e.metadata.type,priority:e=>typeof e.metadata.priority=="number"?e.metadata.priority:void 0,assignee:e=>D(e.metadata.assignee)?e.metadata.assignee:void 0,parent:e=>D(e.metadata.parent)?e.metadata.parent:void 0,goal:e=>D(e.metadata.goal)?e.metadata.goal:void 0,value:e=>D(e.metadata.value)?e.metadata.value:void 0,why_now:e=>D(e.metadata.why_now)?e.metadata.why_now:void 0,risk:e=>D(e.metadata.risk)?e.metadata.risk:void 0,confidence:e=>e.metadata.confidence!==void 0&&e.metadata.confidence!==null?e.metadata.confidence:void 0,estimated_minutes:e=>typeof e.metadata.estimated_minutes=="number"?e.metadata.estimated_minutes:void 0,acceptance_criteria:e=>D(e.metadata.acceptance_criteria)?e.metadata.acceptance_criteria:void 0,resolution:e=>D(e.metadata.resolution)?e.metadata.resolution:void 0,expected_result:e=>D(e.metadata.expected_result)?e.metadata.expected_result:void 0,actual_result:e=>D(e.metadata.actual_result)?e.metadata.actual_result:void 0,body:e=>e.body,comments:e=>(e.metadata.comments??[]).map(t=>t.text),notes:e=>(e.metadata.notes??[]).map(t=>t.text),learnings:e=>(e.metadata.learnings??[]).map(t=>t.text),reminders:e=>Mi(e.metadata),events:e=>Di(e.metadata),dependencies:e=>(e.metadata.dependencies??[]).map(t=>({id:t.id,kind:t.kind})),plan:e=>Fi(e.metadata)};function tn(e,t={}){let r=t.fields??Pe,n={};for(let o of r){let i=Pi[o];if(!i)continue;let s=i(e);s!==void 0&&(n[o]=s)}return n}function $i(e){return e?.trim().toLowerCase()==="ollama"?Li:ki}function ie(e,t){let r=$i(e),n=br(t);return n!==null?{maxCharacters:n,warning:null}:{maxCharacters:r,warning:t==null?null:xi}}function Rt(e,t={}){let r=JSON.stringify(tn(e,{fields:t.fields})),n=ie(t.providerName,t.maxCharacters).maxCharacters;if(r.length<=n)return r;if(n<=G.length)return G.slice(0,n);let o=Math.max(0,n-G.length);return`${r.slice(0,o)}${G}`}(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]="67bae1a1-19d1-50ea-816f-4b68e6bb69d9")}catch{}})();function Ui(e,t,r){let n=e.search.embedding_batch_size,o=e.search.embedding_timeout_ms,i=e.search.scanner_max_batch_retries,s=Number.isFinite(n)&&n>0?Math.max(1,Math.floor(n)):1,a=Number.isFinite(o)&&o>0?Math.max(1,Math.floor(o)):3e4,c=Number.isFinite(i)&&i>=0?Math.floor(i):0;return{batchSize:s,timeoutMs:a,maxRetries:c,maxRequestBytes:r,maxInputCharacters:t}}function zi(e,t,r,n){let o=[],i=[],s=Buffer.byteLength(JSON.stringify({model:e.model,input:[]})),a=s;for(let c of t){let l=Buffer.byteLength(JSON.stringify(c.trim()));if(s+l>n)throw new RangeError(`Embedding input exceeds request byte ceiling ${n}; lower search.embedding_corpus_max_characters or raise maxRequestBytes`);let d=i.length>0?1:0;(i.length>=r||a+d+l>n)&&(o.push(i),i=[],a=s),a+=l+(i.length>0?1:0),i.push(c)}return o.push(i),o}function Vi(e,t){if(!Number.isFinite(t)||t<=0||e.length<=t)return e;let r=Math.max(0,t-G.length);return`${e.slice(0,r)}${G}`.slice(0,t)}function rn(e){let t=E(e).toLowerCase();return t.includes("timed out")||t.includes("timeout")}function ji(e,t,r,n,o,i){let s=`Embedding batch ${t} failed after ${o} attempt(s): ${E(i)}`,a=`provider=${e.name} model=${e.model} batch_size=${r} timeout_ms=${n}`;return rn(i)?`${s} (${a}; guidance=check provider availability or lower search.embedding_batch_size, raise search.embedding_timeout_ms, or run keyword search while semantic indexing catches up)`:`${s} (${a})`}function Ki(e){return e instanceof ge?e.status===413?"payload_too_large":null:rn(e)?"timeout":null}async function kt(e,t,r,n,o,i,s){let a=null;for(let c=0;c<=o;c+=1)try{s.requests+=1;let l=await en(e,t,{timeout_ms:n});return c>0&&i.push(`search_embedding_batch_retry_succeeded:batch=${r}:attempt=${c+1}:size=${t.length}`),s.successful_batches+=1,s.batch_size_histogram[t.length]=(s.batch_size_histogram[t.length]??0)+1,l}catch(l){a=l;let d=Ki(l);if(d!==null&&t.length>1){s.split_batches+=1;let u=Math.ceil(t.length/2),p=t.slice(0,u),_=t.slice(u);return i.push(`search_embedding_batch_split_after_${d}:batch=${r}:size=${t.length}:parts=${p.length}|${_.length}`),[...await kt(e,p,`${r}.1`,n,o,i,s),...await kt(e,_,`${r}.2`,n,o,i,s)]}if(c<o){s.retries+=1;let u=Math.min(1e3*2**c,8e3);await new Promise(p=>setTimeout(p,u))}}throw new Error(ji(e,r,t.length,n,o+1,a))}async function Lt(e,t,r,n={}){if(r.length===0)return{vectors:[],warnings:[]};let o=performance.now(),i=n.maxRequestBytes??262144;if(!Number.isSafeInteger(i)||i<=0)throw new RangeError("maxRequestBytes must be a positive safe integer");let s={provider:e.name,model:e.model,max_request_bytes:i,limit_source:n.maxRequestBytes===void 0?"default":"caller",planned_batches:0,requests:0,successful_batches:0,split_batches:0,retries:0,batch_size_histogram:{},elapsed_ms:0,inputs_per_second:0},a=[],c=ie(e.name,t.search.embedding_corpus_max_characters);c.warning&&a.push(c.warning);let l=Ui(t,c.maxCharacters,i),d=0,u=r.map(y=>{if(y.trim().length===0)throw new TypeError("Embedding inputs must be non-empty strings");let h=Vi(y,l.maxInputCharacters);return h.length<y.length&&(d+=1),h});d>0&&a.push(`search_embedding_input_truncated:count=${d}:max_characters=${l.maxInputCharacters}`);let p=zi(e,u,l.batchSize,l.maxRequestBytes);s.planned_batches=p.length;let _=[],g=0;for(let y=0;y<p.length;y+=1){let h=p[y];n.onProgress?.({batch_index:y+1,batch_total:p.length,batch_size:h.length,completed_inputs:g,total_inputs:u.length,phase:"start"}),_.push(...await kt(e,h,String(y+1),l.timeoutMs,l.maxRetries,a,s)),g+=h.length,n.onProgress?.({batch_index:y+1,batch_total:p.length,batch_size:h.length,completed_inputs:g,total_inputs:u.length,phase:"complete"})}return s.elapsed_ms=Math.max(1,performance.now()-o),s.inputs_per_second=r.length*1e3/s.elapsed_ms,{vectors:_,warnings:a,receipt: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]="4835aae2-a525-5683-abc0-0ba3c5781c95")}catch{}})();var nn=[{name:"private-key",mutationRule:"private_key",regex:/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/g},{name:"github-token",mutationRule:"github_token",regex:/\b(?:gh[opsru]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g},{name:"npm-token",mutationRule:"npm_token",regex:/\bnpm_[A-Za-z0-9]{20,}\b/g},{name:"aws-access-key",mutationRule:"aws_access_key",regex:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g},{name:"google-api-key",mutationRule:"google_api_key",regex:/\bAIza[0-9A-Za-z_-]{35}\b/g},{name:"slack-token",mutationRule:"slack_token",regex:/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g},{name:"anthropic-api-key",mutationRule:"anthropic_api_key",regex:/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g},{name:"openai-api-key",mutationRule:"openai_api_key",regex:/\bsk-(?!ant-)[A-Za-z0-9_-]{20,}\b/g},{name:"gitlab-token",mutationRule:"gitlab_token",regex:/\bglpat-[A-Za-z0-9_.-]{20,}\b/g},{name:"jwt-like-token",mutationRule:"jwt_like_token",regex:/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g},{name:"npm-auth-token-assignment",mutationRule:"npm_auth_token_assignment",regex:/_authToken\s*=\s*\S+/g},{name:"sentry-user-token",mutationRule:"sentry_user_token",regex:/\bsntryu_[A-Za-z0-9]{20,}\b/g},{name:"sentry-org-token",mutationRule:"sentry_org_token",regex:/\bsntrys_[A-Za-z0-9_-]{20,}\b/g},{name:"private-ip",mutationRule:"private_ip",regex:/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"private-ssh-target",mutationRule:"private_ssh_target",regex:/\b(?:ssh|scp|rsync)\s+[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"sshpass-inline-password",mutationRule:"sshpass_inline_password",regex:/\bsshpass\s+-p\s+["'][^"']{6,}["']/g},{name:"password-assignment",mutationRule:"password_assignment",regex:/\b(?:password|passphrase)\s*[:=]\s*(?:(?!<|\$\{|\$\(|config\.auth\.password\s*(?:\|\|\s*(?:''|"")|\?\s*unescape\(encodeURIComponent\(config\.auth\.password\)\)\s*:\s*(?:''|""))(?=[ \t]*(?:\/\*(?:[^*]|\*(?!\/))*\*\/[ \t]*)*(?:;|$|\/\/[^\r\n\u2028\u2029]*(?:\r\n)?$)))[A-Za-z0-9!@#$%^&*._+\-=]{8,}|"(?!<|\$\{|\$\()[^"]{8,}"|'(?!<|\$\{|\$\()[^']{8,}')/gi},{name:"absolute-home-path",mutationRule:"absolute_home_path",regex:/(?:^|[\s"'`(=])\/home\/[A-Za-z0-9._-]+\/[^\s"'`),;]+/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"user-at-private-host",mutationRule:"user_at_private_host",regex:/\b[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"high-entropy-assignment",mutationRule:"high_entropy_assignment",regex:/\b(?:token|secret|password|passwd|api[_-]?key)\s*[:=]\s*["']?([A-Za-z0-9+/=_-]{24,})/gi,mutationOnlyReason:"Generic assignments in source code are not credentials; preserve the existing mutation heuristic without treating source identifiers as secrets.",minimumEntropy:3.5}];function on(e,t){if(e.minimumEntropy===void 0)return!0;let r=t[1],n=new Map;for(let i of r)n.set(i,(n.get(i)??0)+1);let o=0;for(let i of n.values()){let s=i/r.length;o-=s*Math.log2(s)}return o>=e.minimumEntropy}(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]="b75bf20f-d341-5fa2-943d-db02211ca80d")}catch{}})();var qi=[{action:"append",history_scope:"item"},{action:"claim",history_scope:"item"},{action:"close",history_scope:"item"},{action:"close-many",history_scope:"item"},{action:"close-task",history_scope:"item"},{action:"comments",history_scope:"conditional"},{action:"config",history_scope:"conditional"},{action:"copy",history_scope:"item"},{action:"create",history_scope:"item"},{action:"delete",history_scope:"item"},{action:"deps",history_scope:"conditional"},{action:"discover",history_scope:"item"},{action:"docs",history_scope:"conditional"},{action:"files",history_scope:"conditional"},{action:"focus",history_scope:"conditional"},{action:"gc",history_scope:"conditional"},{action:"history-compact",history_scope:"history"},{action:"history-author-acknowledge",history_scope:"workspace"},{action:"history-redact",history_scope:"history"},{action:"history-repair",history_scope:"history"},{action:"init",history_scope:"workspace"},{action:"install",history_scope:"conditional"},{action:"learnings",history_scope:"conditional"},{action:"notes",history_scope:"conditional"},{action:"package",history_scope:"conditional"},{action:"pause-task",history_scope:"item"},{action:"plan",history_scope:"conditional"},{action:"profile",history_scope:"conditional"},{action:"release",history_scope:"item"},{action:"restore",history_scope:"item"},{action:"schema",history_scope:"conditional"},{action:"start-task",history_scope:"item"},{action:"templates",history_scope:"conditional"},{action:"test",history_scope:"conditional"},{action:"test-all",history_scope:"conditional"},{action:"update",history_scope:"item"},{action:"update-many",history_scope:"item"},{action:"upgrade",history_scope:"conditional"}],Mt=new Map(qi.map(e=>[e.action,e]));function xt(e,t="$",r=new WeakSet){return typeof e=="string"?[{path:t,value:e}]:typeof e!="object"||e===null?[]:r.has(e)?[]:(r.add(e),Array.isArray(e)?e.flatMap((n,o)=>xt(n,`${t}[${o}]`,r)):Object.entries(e).flatMap(([n,o])=>xt(o,`${t}.${n}`,r)))}function sn(e){let t=[];for(let r of xt(e))for(let n of nn){n.regex.lastIndex=0;for(let o of r.value.matchAll(n.regex))if(on(n,o)){t.push({rule:n.mutationRule,path:r.path});break}}return t.filter((r,n,o)=>o.findIndex(i=>i.rule===r.rule&&i.path===r.path)===n)}function Hi(e){let t=e.author.trim()||"unknown";if(e.settings.require_attributed_author&&t.toLowerCase()==="unknown")throw new f("Mutation author is required by workspace policy.",m.USAGE,{code:"mutation_author_required",required:"Pass --author <id>, set PM_AUTHOR, or configure author_default.",nextSteps:["Retry with --author <stable-agent-id>.","Set PM_AUTHOR for this agent session."]});if(e.settings.secret_guard==="off")return{author:t,findings:[],warnings:[],override_applied:!1};let r;try{r=sn(e.payload)}catch{return{author:t,findings:[],warnings:["secret_guard_scan_failed_open"],override_applied:!1}}if(r.length===0)return{author:t,findings:r,warnings:[],override_applied:!1};let n=[...new Set(r.map(o=>o.rule))].sort().join(",");if(e.settings.secret_guard==="block"&&e.force!==!0)throw new f(`Mutation blocked by secret guard (${n}). No detected value was logged.`,m.CONFLICT,{code:"mutation_secret_guard_blocked",required:"Remove the credential-shaped content or retry with --force after explicit review.",nextSteps:["Replace the value with a secret-manager reference.","Use pm history-redact if equivalent content already entered history."],recovery:{recovery_mode:"compact",attempted_command:"pm <mutation> [REDACTED]",normalized_args:["[REDACTED]"],suggested_retry:"Remove credential-shaped content, then retry the mutation."}});return{author:t,findings:r,warnings:[`secret_guard_detected:${r.length}:rules=${n}`,...e.settings.secret_guard==="block"&&e.force===!0?["secret_guard_force_override"]:[]],override_applied:e.settings.secret_guard==="block"&&e.force===!0}}function Bi(e){return Mt.has(e.trim().toLowerCase())}function Gi(){return[...Mt.keys()].sort((e,t)=>e.localeCompare(t))}function Nd(e){return Mt.get(e.trim().toLowerCase())}(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]="6c555c2c-9db2-5c9f-9d69-3456fe8bffaa")}catch{}})();function Yi(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Pd(e){return Yi(e).split(/[^a-z0-9]+/).filter(t=>t.length>0)}function he(e,t){if(e.length===0&&t.length===0)return 1;if(e.length===0||t.length===0)return 0;let r=new Set(e),n=new Set(t),o=0;for(let s of r)n.has(s)&&(o+=1);let i=new Set([...r,...n]).size;return o/i}(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]="5767332d-8094-55cd-96e9-47c5d20cd7df")}catch{}})();var Wi=/\b([a-z][a-z0-9]*)-(\d+)(?:-[a-z0-9]+)*\b/giu,Xi=/^(?:utf|iso|sha|tls|http|covid|match)$/iu;function $e(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function be(e){return[...new Set($e(e).match(/[\p{L}\p{N}]+/gu)??[])]}function we(e){let t=$e(e);return{normalized:t,tokens:be(t),issueCodes:[...new Set([...e.matchAll(Wi)].filter(r=>{let n=r[1],o=r.index,i=e.slice(o+r[0].length);return!Xi.test(n)&&(n===n.toUpperCase()||n.length<=2||o===0&&/^\s*(?::|—|–|\])/u.test(i))}).map(r=>r[0].toLowerCase()))]}}function Ue(e,t){return ze(we(e),we(t))}function ze(e,t){if(e.normalized===t.normalized)return{score:1,reason:"exact_title"};let r=new Set(e.issueCodes);return t.issueCodes.some(n=>r.has(n))?{score:.99,reason:"issue_code"}:{score:he(e.tokens,t.tokens),reason:"title_token_jaccard"}}import Ji 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]="a7cd1d62-16fe-5e5b-b382-64335fc5e403")}catch{}})();function Ve(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function Qi(e,t){return[e.updated_at,t].map(r=>({value:r,time:Date.parse(r??"")})).filter(r=>typeof r.value=="string"&&Number.isFinite(r.time)).sort((r,n)=>n.time-r.time)[0]?.value??e.updated_at}function an(e,t){let r=Math.max(1,Math.trunc(t.threshold_hours)),n=(t.now??new Date).getTime(),o=Ve(t.in_progress_status),i=[];for(let s of e){if(Ve(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=Qi(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let l=Math.max(0,Math.floor((n-c)/36e5));l>=r&&i.push({id:s.id,last_activity_at:a,age_hours:l})}return i.sort((s,a)=>a.age_hours-s.age_hours||s.id.localeCompare(a.id)),{threshold_hours:r,count:i.length,items:i,remediation:"Claim active work with `pm claim <id>` or return abandoned work to open with `pm update <id> --status open`."}}async function Zi(e,t,r){let n=new Map;return await Promise.all(t.filter(o=>Ve(String(o.status))===Ve(r.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await pe(Ji.join(e,"history",`${o.id}.jsonl`),o.id)}catch{return}let s=i.map(a=>a.ts).filter(a=>Number.isFinite(Date.parse(a))).sort((a,c)=>Date.parse(c)-Date.parse(a))[0];s&&n.set(o.id,s)})),an(t,{...r,last_history_activity:o=>n.get(o.id)})}(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]="42b217a3-31c0-561a-b7cb-b1a584b2edd5")}catch{}})();var es=new Set(["rename-type","rename-field","remap-status",...vr]);function ts(e,t){if(t&&!es.has(e))throw new f(`schema ${e} does not support --dry-run. Preview is supported for rename-type, rename-field, remap-status and workflow-policy actions. Remove --dry-run only when you intend to apply changes.`,m.USAGE,{code:"invalid_argument_value",examples:["pm schema rename-type Spike --to Experiment --dry-run"]})}import{readFile as rs}from"node:fs/promises";import cn 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]="da661b46-841c-526d-88bc-976e007e8fbe")}catch{}})();function ns(e){let t=e.trim();if(!t)throw new f("--rollback requires a non-empty checkpoint ID",m.USAGE);if(!/^[a-zA-Z0-9._-]+$/.test(t))throw new f("--rollback checkpoint ID must match [a-zA-Z0-9._-]+",m.USAGE);return t}function os(e,t){let r=t.replace(/[-:.TZ]/g,"").slice(0,14),n=Math.random().toString(36).slice(2,8);return`${e}-${r}-${n}`}function is(e,t){return cn.join(e,"checkpoints",t)}function ln(e,t,r){return cn.join(is(e,t),`${r}.json`)}async function ss(e,t,r,n){let o=ln(e,t,r),i=`${JSON.stringify(n,null,2)}
|
|
1
|
+
import{a as ft,b as pt,d as _t}from"./chunk-QQIE4L42.js";import{t as Sr}from"./chunk-W4BG5HHS.js";import{Ab as ne,Bb as ye,Ca as Pr,Cb as vt,Da as Et,Eb as It,Fb as oe,Gb as Hr,H as Mr,J as Dr,K as Or,Qa as $r,Sa as Ur,Sb as Br,T as fe,V as q,Wa as De,Xa as v,Y as yt,Ya as Oe,Yb as Gr,Z as gt,Zb as Yr,aa as pe,ac as Wr,bb as Ne,cb as re,eb as zr,fb as Vr,hb as jr,ib as Kr,oa as ht,pa as Nr,qa as wt,qb as St,sb as Tt,ub as qr,va as Fr,wb as _e,za as bt}from"./chunk-6KFKQD2D.js";import{f as Tr,n as ee,p as ut}from"./chunk-NM3PM6O6.js";import{$ as m,$d as te,Cc as Ir,Da as w,Ea as T,Fa as le,Ga as Z,Ha as E,Ja as br,Lc as P,Oc as Le,Rb as vr,Rc as Ar,Ua as A,V as at,Va as de,Xd as M,_a as R,_c as Cr,aa as f,ab as ue,ae as xr,bb as ct,be as xe,cb as lt,db as Er,dd as Rr,eb as me,ed as kr,ee as Me,fd as mt,i as st,jd as Lr,sa as U,tb as dt,ua as Q,va as S,xa as I,za as ke}from"./chunk-SPN5QTZ3.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]="b84fee06-5bbd-57f9-9643-f283d6c87afa")}catch{}})();function Xr(e,t="--limit"){if(e===void 0)return;let r=Number(e);if(!Number.isFinite(r)||r<0)throw new f(`${t} must be a non-negative number`,m.USAGE);return Math.floor(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]="9b58b44d-819c-5115-b011-f9dfa8e2ab41")}catch{}})();var bi=3e4,ge=class extends Error{status;constructor(t,r){super(t),this.name="SearchHttpError",this.status=r}};function H(e,t,r=bi){let n=e??r;if(!Number.isFinite(n)||n<=0)throw new Error(`${t} timeout must be a positive finite number`);return Math.floor(n)}function B(e,t){if(e)return e;if(typeof globalThis.fetch=="function")return globalThis.fetch.bind(globalThis);throw new Error(`${t} execution requires a fetch implementation`)}async function Ei(e){try{return(await e.text()).replaceAll(/\s+/g," ").trim()}catch(t){return`(failed to read response body: ${E(t)})`}}async function Fe(e){let t=new AbortController,r=setTimeout(()=>{t.abort()},e.timeoutMs);try{let n;try{n=await e.fetcher(e.endpoint,{method:e.method,headers:e.headers,body:JSON.stringify(e.body),signal:t.signal})}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error(`${e.requestLabel} timed out after ${e.timeoutMs}ms`):new Error(`${e.requestLabel} execution failed: ${E(o)}`)}if(!n.ok){let o=await Ei(n),i=o.length>0?`: ${o}`:"";throw new ge(`${e.requestLabel} failed with status ${n.status} ${n.statusText}${i}`,n.status)}try{return await n.json()}catch(o){throw new Error(`${e.responseLabel} JSON parse failed: ${E(o)}`)}}finally{clearTimeout(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]="8e3bb919-c8f9-50b5-8e41-b6719d17bd21")}catch{}})();function Ed(e,t){let r=w(e);if(!r)return"unconfigured";let n=w(t);return n&&n.toLowerCase()===r.toLowerCase()?"configured":"auto-detected"}function Si(e){let t=le(e),r=t.toLowerCase();return r.endsWith("/embeddings")?t:r.endsWith("/v1")?`${t}/embeddings`:`${t}/v1/embeddings`}function Qr(e){let t=e.search?.embedding_model;return w(t)||null}function Ti(e){let t=w(e.providers?.openai?.base_url),r=w(e.providers?.openai?.model);if(!t||!r)return null;let n=Qr(e),o=w(e.providers?.openai?.api_key);return{name:"openai",base_url:t,model:n??r,...o?{api_key:o}:{}}}function vi(e){let t=w(e.providers?.ollama?.base_url),r=w(e.providers?.ollama?.model);if(!t||!r)return null;let n=Qr(e);return{name:"ollama",base_url:t,model:n??r}}function Zr(e){let t=(Array.isArray(e)?e:[e]).map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)throw new Error("Embedding input must include at least one non-empty string");return t}function Ii(e){let t=[],r=[],n=new Map;for(let o of e){let i=n.get(o);if(i===void 0){let s=t.length;t.push(o),n.set(o,s),r.push(s);continue}r.push(i)}return{uniqueInputs:t,originalToUniqueIndex:r}}function Ai(e){let t=e.map((r,n)=>({embedding:r.embedding,index:r.index,position:n}));if(t.some(r=>r.index!==void 0)){for(let r of t)if(!Number.isInteger(r.index))throw new TypeError(`OpenAI embedding response entry at position ${r.position} is missing a valid integer index`);return[...t].sort((r,n)=>{let o=r.index-n.index;return o!==0?o:r.position-n.position})}return t}function At(e){let t=Ti(e),r=vi(e),n=[t,r].filter(s=>s!==null),o=w(e.search?.provider),i=o?o.toLowerCase():null;return{active:(i?n.find(s=>s.name===i):void 0)??n[0]??null,available:n}}function Jr(e){let t=le(e.base_url);return e.name==="openai"?{provider:"openai",endpoint:Si(t),model:e.model}:{provider:"ollama",endpoint:`${t}/api/embed`,model:e.model}}function Ci(e,t){let r=Zr(t);return e.name==="openai"?{target:Jr(e),method:"POST",headers:{"content-type":"application/json",...e.api_key?{authorization:`Bearer ${e.api_key}`}:{}},body:{model:e.model,input:r.length===1?r[0]:r}}:{target:Jr(e),method:"POST",headers:{"content-type":"application/json"},body:{model:e.model,input:r}}}function Ri(e,t){if(e.name==="openai"){let o=t.data;if(!Array.isArray(o)||o.length===0)throw new Error("OpenAI embedding response must include a non-empty data array");return Ai(o).map((i,s)=>{let a=i.embedding;if(!Z(a))throw new Error(`OpenAI embedding response entry at index ${s} is missing a numeric embedding vector`);return[...a]})}let r=t.embedding;if(Z(r))return[[...r]];let n=t.embeddings;if(Array.isArray(n)&&n.length>0)return n.map((o,i)=>{if(!Z(o))throw new Error(`Ollama embedding response entry at index ${i} is missing a numeric embedding vector`);return[...o]});throw new Error("Ollama embedding response must include embedding or embeddings vectors")}async function en(e,t,r={}){let n=H(r.timeout_ms,"Embedding request"),o=B(r.fetcher,"Embedding request"),i=Zr(t),s=Ii(i),a=Ci(e,s.uniqueInputs),c=await Fe({endpoint:a.target.endpoint,method:a.method,headers:a.headers,body:a.body,timeoutMs:n,fetcher:o,requestLabel:"Embedding request",responseLabel:"Embedding response"}),l=Ri(e,c);if(l.length!==s.uniqueInputs.length)throw new Error(`Embedding response cardinality mismatch: expected ${s.uniqueInputs.length} vector(s), received ${l.length}`);return s.originalToUniqueIndex.map(d=>[...l[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]="5c86afdf-6d8d-5851-82c1-ae5bcc9f0196")}catch{}})();var Pe=["title","description","tags","status","type","priority","assignee","parent","goal","value","why_now","risk","confidence","estimated_minutes","acceptance_criteria","resolution","expected_result","actual_result","body","comments","notes","learnings","reminders","events","dependencies","plan"];function Ct(e){let t=e?.search?.corpus_fields;if(!Array.isArray(t))return[...Pe];let r=new Set(Pe),n=Array.from(new Set(t.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0&&r.has(o))));return n.length>0?n:[...Pe]}var ki=8e3,Li=3200,G="...[semantic corpus truncated]",xi="search_embedding_corpus_max_characters_invalid:using_provider_default";function O(e){return e.map(t=>t==null?"":String(t).trim()).filter(t=>t.length>0).join(" ")}function Mi(e){return(e.reminders??[]).map(t=>O([t.at,t.text]))}function Di(e){return(e.events??[]).map(t=>O([t.start_at,t.end_at,t.title,t.description,t.location,t.all_day===!0?"all day":void 0,t.timezone,t.recurrence?.freq,t.recurrence?.interval,t.recurrence?.count,t.recurrence?.until,t.recurrence?.by_weekday?.join(" "),t.recurrence?.by_month_day?.join(" "),t.recurrence?.exdates?.join(" ")]))}function Oi(e,t){e.push(t.title,t.body,t.status,t.owner,t.evidence,t.blocked_reason,t.superseded_by);for(let r of t.linked_items??[])e.push(`${r.kind} ${r.id}`,r.note);for(let r of t.files??[])e.push(r.path,r.note);for(let r of t.tests??[])e.push(r.command,r.path,r.note);for(let r of t.docs??[])e.push(r.path,r.note)}function Ni(e,t){for(let r of t.plan_decisions??[])e.push(r.decision,r.rationale,r.evidence);for(let r of t.plan_discoveries??[])e.push(r.text);for(let r of t.plan_validation??[])e.push(r.text,r.command,r.expected)}function vd(e){let t=[];t.push(e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context);for(let r of e.plan_steps??[])Oi(t,r);return Ni(t,e),t.filter(r=>typeof r=="string"&&r.length>0).join(" ")}function Fi(e){let t=(e.plan_steps??[]).map(i=>O([i.order,i.id,i.title,i.body,i.status,i.owner,i.evidence,i.blocked_reason,i.superseded_by,(i.linked_items??[]).map(s=>O([s.kind,s.id,s.note])).join(" "),(i.files??[]).map(s=>O([s.path,s.note])).join(" "),(i.tests??[]).map(s=>O([s.command,s.path,s.note])).join(" "),(i.docs??[]).map(s=>O([s.path,s.note])).join(" ")])),r=(e.plan_decisions??[]).map(i=>O([i.decision,i.rationale,i.evidence,i.step_id])),n=(e.plan_discoveries??[]).map(i=>O([i.text,i.step_id])),o=(e.plan_validation??[]).map(i=>O([i.text,i.command,i.expected]));if([e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context,...t,...r,...n,...o].some(i=>i!==void 0))return{mode:e.plan_mode,scope:e.plan_scope,harness:e.plan_harness,resume_context:e.plan_resume_context,steps:t,decisions:r,discoveries:n,validation:o}}function D(e){return typeof e=="string"&&e.trim().length>0}var Pi={title:e=>e.metadata.title,description:e=>e.metadata.description,tags:e=>e.metadata.tags,status:e=>e.metadata.status,type:e=>e.metadata.type,priority:e=>typeof e.metadata.priority=="number"?e.metadata.priority:void 0,assignee:e=>D(e.metadata.assignee)?e.metadata.assignee:void 0,parent:e=>D(e.metadata.parent)?e.metadata.parent:void 0,goal:e=>D(e.metadata.goal)?e.metadata.goal:void 0,value:e=>D(e.metadata.value)?e.metadata.value:void 0,why_now:e=>D(e.metadata.why_now)?e.metadata.why_now:void 0,risk:e=>D(e.metadata.risk)?e.metadata.risk:void 0,confidence:e=>e.metadata.confidence!==void 0&&e.metadata.confidence!==null?e.metadata.confidence:void 0,estimated_minutes:e=>typeof e.metadata.estimated_minutes=="number"?e.metadata.estimated_minutes:void 0,acceptance_criteria:e=>D(e.metadata.acceptance_criteria)?e.metadata.acceptance_criteria:void 0,resolution:e=>D(e.metadata.resolution)?e.metadata.resolution:void 0,expected_result:e=>D(e.metadata.expected_result)?e.metadata.expected_result:void 0,actual_result:e=>D(e.metadata.actual_result)?e.metadata.actual_result:void 0,body:e=>e.body,comments:e=>(e.metadata.comments??[]).map(t=>t.text),notes:e=>(e.metadata.notes??[]).map(t=>t.text),learnings:e=>(e.metadata.learnings??[]).map(t=>t.text),reminders:e=>Mi(e.metadata),events:e=>Di(e.metadata),dependencies:e=>(e.metadata.dependencies??[]).map(t=>({id:t.id,kind:t.kind})),plan:e=>Fi(e.metadata)};function tn(e,t={}){let r=t.fields??Pe,n={};for(let o of r){let i=Pi[o];if(!i)continue;let s=i(e);s!==void 0&&(n[o]=s)}return n}function $i(e){return e?.trim().toLowerCase()==="ollama"?Li:ki}function ie(e,t){let r=$i(e),n=br(t);return n!==null?{maxCharacters:n,warning:null}:{maxCharacters:r,warning:t==null?null:xi}}function Rt(e,t={}){let r=JSON.stringify(tn(e,{fields:t.fields})),n=ie(t.providerName,t.maxCharacters).maxCharacters;if(r.length<=n)return r;if(n<=G.length)return G.slice(0,n);let o=Math.max(0,n-G.length);return`${r.slice(0,o)}${G}`}(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]="67bae1a1-19d1-50ea-816f-4b68e6bb69d9")}catch{}})();function Ui(e,t,r){let n=e.search.embedding_batch_size,o=e.search.embedding_timeout_ms,i=e.search.scanner_max_batch_retries,s=Number.isFinite(n)&&n>0?Math.max(1,Math.floor(n)):1,a=Number.isFinite(o)&&o>0?Math.max(1,Math.floor(o)):3e4,c=Number.isFinite(i)&&i>=0?Math.floor(i):0;return{batchSize:s,timeoutMs:a,maxRetries:c,maxRequestBytes:r,maxInputCharacters:t}}function zi(e,t,r,n){let o=[],i=[],s=Buffer.byteLength(JSON.stringify({model:e.model,input:[]})),a=s;for(let c of t){let l=Buffer.byteLength(JSON.stringify(c.trim()));if(s+l>n)throw new RangeError(`Embedding input exceeds request byte ceiling ${n}; lower search.embedding_corpus_max_characters or raise maxRequestBytes`);let d=i.length>0?1:0;(i.length>=r||a+d+l>n)&&(o.push(i),i=[],a=s),a+=l+(i.length>0?1:0),i.push(c)}return o.push(i),o}function Vi(e,t){if(!Number.isFinite(t)||t<=0||e.length<=t)return e;let r=Math.max(0,t-G.length);return`${e.slice(0,r)}${G}`.slice(0,t)}function rn(e){let t=E(e).toLowerCase();return t.includes("timed out")||t.includes("timeout")}function ji(e,t,r,n,o,i){let s=`Embedding batch ${t} failed after ${o} attempt(s): ${E(i)}`,a=`provider=${e.name} model=${e.model} batch_size=${r} timeout_ms=${n}`;return rn(i)?`${s} (${a}; guidance=check provider availability or lower search.embedding_batch_size, raise search.embedding_timeout_ms, or run keyword search while semantic indexing catches up)`:`${s} (${a})`}function Ki(e){return e instanceof ge?e.status===413?"payload_too_large":null:rn(e)?"timeout":null}async function kt(e,t,r,n,o,i,s){let a=null;for(let c=0;c<=o;c+=1)try{s.requests+=1;let l=await en(e,t,{timeout_ms:n});return c>0&&i.push(`search_embedding_batch_retry_succeeded:batch=${r}:attempt=${c+1}:size=${t.length}`),s.successful_batches+=1,s.batch_size_histogram[t.length]=(s.batch_size_histogram[t.length]??0)+1,l}catch(l){a=l;let d=Ki(l);if(d!==null&&t.length>1){s.split_batches+=1;let u=Math.ceil(t.length/2),p=t.slice(0,u),_=t.slice(u);return i.push(`search_embedding_batch_split_after_${d}:batch=${r}:size=${t.length}:parts=${p.length}|${_.length}`),[...await kt(e,p,`${r}.1`,n,o,i,s),...await kt(e,_,`${r}.2`,n,o,i,s)]}if(c<o){s.retries+=1;let u=Math.min(1e3*2**c,8e3);await new Promise(p=>setTimeout(p,u))}}throw new Error(ji(e,r,t.length,n,o+1,a))}async function Lt(e,t,r,n={}){if(r.length===0)return{vectors:[],warnings:[]};let o=performance.now(),i=n.maxRequestBytes??262144;if(!Number.isSafeInteger(i)||i<=0)throw new RangeError("maxRequestBytes must be a positive safe integer");let s={provider:e.name,model:e.model,max_request_bytes:i,limit_source:n.maxRequestBytes===void 0?"default":"caller",planned_batches:0,requests:0,successful_batches:0,split_batches:0,retries:0,batch_size_histogram:{},elapsed_ms:0,inputs_per_second:0},a=[],c=ie(e.name,t.search.embedding_corpus_max_characters);c.warning&&a.push(c.warning);let l=Ui(t,c.maxCharacters,i),d=0,u=r.map(y=>{if(y.trim().length===0)throw new TypeError("Embedding inputs must be non-empty strings");let h=Vi(y,l.maxInputCharacters);return h.length<y.length&&(d+=1),h});d>0&&a.push(`search_embedding_input_truncated:count=${d}:max_characters=${l.maxInputCharacters}`);let p=zi(e,u,l.batchSize,l.maxRequestBytes);s.planned_batches=p.length;let _=[],g=0;for(let y=0;y<p.length;y+=1){let h=p[y];n.onProgress?.({batch_index:y+1,batch_total:p.length,batch_size:h.length,completed_inputs:g,total_inputs:u.length,phase:"start"}),_.push(...await kt(e,h,String(y+1),l.timeoutMs,l.maxRetries,a,s)),g+=h.length,n.onProgress?.({batch_index:y+1,batch_total:p.length,batch_size:h.length,completed_inputs:g,total_inputs:u.length,phase:"complete"})}return s.elapsed_ms=Math.max(1,performance.now()-o),s.inputs_per_second=r.length*1e3/s.elapsed_ms,{vectors:_,warnings:a,receipt: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]="4835aae2-a525-5683-abc0-0ba3c5781c95")}catch{}})();var nn=[{name:"private-key",mutationRule:"private_key",regex:/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/g},{name:"github-token",mutationRule:"github_token",regex:/\b(?:gh[opsru]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g},{name:"npm-token",mutationRule:"npm_token",regex:/\bnpm_[A-Za-z0-9]{20,}\b/g},{name:"aws-access-key",mutationRule:"aws_access_key",regex:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g},{name:"google-api-key",mutationRule:"google_api_key",regex:/\bAIza[0-9A-Za-z_-]{35}\b/g},{name:"slack-token",mutationRule:"slack_token",regex:/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g},{name:"anthropic-api-key",mutationRule:"anthropic_api_key",regex:/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g},{name:"openai-api-key",mutationRule:"openai_api_key",regex:/\bsk-(?!ant-)[A-Za-z0-9_-]{20,}\b/g},{name:"gitlab-token",mutationRule:"gitlab_token",regex:/\bglpat-[A-Za-z0-9_.-]{20,}\b/g},{name:"jwt-like-token",mutationRule:"jwt_like_token",regex:/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g},{name:"npm-auth-token-assignment",mutationRule:"npm_auth_token_assignment",regex:/_authToken\s*=\s*\S+/g},{name:"sentry-user-token",mutationRule:"sentry_user_token",regex:/\bsntryu_[A-Za-z0-9]{20,}\b/g},{name:"sentry-org-token",mutationRule:"sentry_org_token",regex:/\bsntrys_[A-Za-z0-9_-]{20,}\b/g},{name:"private-ip",mutationRule:"private_ip",regex:/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"private-ssh-target",mutationRule:"private_ssh_target",regex:/\b(?:ssh|scp|rsync)\s+[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"sshpass-inline-password",mutationRule:"sshpass_inline_password",regex:/\bsshpass\s+-p\s+["'][^"']{6,}["']/g},{name:"password-assignment",mutationRule:"password_assignment",regex:/\b(?:password|passphrase)\s*[:=]\s*(?:(?!<|\$\{|\$\(|config\.auth\.password\s*(?:\|\|\s*(?:''|"")|\?\s*unescape\(encodeURIComponent\(config\.auth\.password\)\)\s*:\s*(?:''|""))(?=[ \t]*(?:\/\*(?:[^*]|\*(?!\/))*\*\/[ \t]*)*(?:;|$|\/\/[^\r\n\u2028\u2029]*(?:\r\n)?$)))[A-Za-z0-9!@#$%^&*._+\-=]{8,}|"(?!<|\$\{|\$\()[^"]{8,}"|'(?!<|\$\{|\$\()[^']{8,}')/gi},{name:"absolute-home-path",mutationRule:"absolute_home_path",regex:/(?:^|[\s"'`(=])\/home\/[A-Za-z0-9._-]+\/[^\s"'`),;]+/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"user-at-private-host",mutationRule:"user_at_private_host",regex:/\b[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"high-entropy-assignment",mutationRule:"high_entropy_assignment",regex:/\b(?:token|secret|password|passwd|api[_-]?key)\s*[:=]\s*["']?([A-Za-z0-9+/=_-]{24,})/gi,mutationOnlyReason:"Generic assignments in source code are not credentials; preserve the existing mutation heuristic without treating source identifiers as secrets.",minimumEntropy:3.5}];function on(e,t){if(e.minimumEntropy===void 0)return!0;let r=t[1],n=new Map;for(let i of r)n.set(i,(n.get(i)??0)+1);let o=0;for(let i of n.values()){let s=i/r.length;o-=s*Math.log2(s)}return o>=e.minimumEntropy}(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]="b75bf20f-d341-5fa2-943d-db02211ca80d")}catch{}})();var qi=[{action:"append",history_scope:"item"},{action:"claim",history_scope:"item"},{action:"close",history_scope:"item"},{action:"close-many",history_scope:"item"},{action:"close-task",history_scope:"item"},{action:"comments",history_scope:"conditional"},{action:"config",history_scope:"conditional"},{action:"copy",history_scope:"item"},{action:"create",history_scope:"item"},{action:"delete",history_scope:"item"},{action:"deps",history_scope:"conditional"},{action:"discover",history_scope:"item"},{action:"docs",history_scope:"conditional"},{action:"files",history_scope:"conditional"},{action:"focus",history_scope:"conditional"},{action:"gc",history_scope:"conditional"},{action:"history-compact",history_scope:"history"},{action:"history-author-acknowledge",history_scope:"workspace"},{action:"history-redact",history_scope:"history"},{action:"history-repair",history_scope:"history"},{action:"init",history_scope:"workspace"},{action:"install",history_scope:"conditional"},{action:"learnings",history_scope:"conditional"},{action:"notes",history_scope:"conditional"},{action:"package",history_scope:"conditional"},{action:"pause-task",history_scope:"item"},{action:"plan",history_scope:"conditional"},{action:"profile",history_scope:"conditional"},{action:"release",history_scope:"item"},{action:"restore",history_scope:"item"},{action:"schema",history_scope:"conditional"},{action:"start-task",history_scope:"item"},{action:"templates",history_scope:"conditional"},{action:"test",history_scope:"conditional"},{action:"test-all",history_scope:"conditional"},{action:"update",history_scope:"item"},{action:"update-many",history_scope:"item"},{action:"upgrade",history_scope:"conditional"}],Mt=new Map(qi.map(e=>[e.action,e]));function xt(e,t="$",r=new WeakSet){return typeof e=="string"?[{path:t,value:e}]:typeof e!="object"||e===null?[]:r.has(e)?[]:(r.add(e),Array.isArray(e)?e.flatMap((n,o)=>xt(n,`${t}[${o}]`,r)):Object.entries(e).flatMap(([n,o])=>xt(o,`${t}.${n}`,r)))}function sn(e){let t=[];for(let r of xt(e))for(let n of nn){n.regex.lastIndex=0;for(let o of r.value.matchAll(n.regex))if(on(n,o)){t.push({rule:n.mutationRule,path:r.path});break}}return t.filter((r,n,o)=>o.findIndex(i=>i.rule===r.rule&&i.path===r.path)===n)}function Hi(e){let t=e.author.trim()||"unknown";if(e.settings.require_attributed_author&&t.toLowerCase()==="unknown")throw new f("Mutation author is required by workspace policy.",m.USAGE,{code:"mutation_author_required",required:"Pass --author <id>, set PM_AUTHOR, or configure author_default.",nextSteps:["Retry with --author <stable-agent-id>.","Set PM_AUTHOR for this agent session."]});if(e.settings.secret_guard==="off")return{author:t,findings:[],warnings:[],override_applied:!1};let r;try{r=sn(e.payload)}catch{return{author:t,findings:[],warnings:["secret_guard_scan_failed_open"],override_applied:!1}}if(r.length===0)return{author:t,findings:r,warnings:[],override_applied:!1};let n=[...new Set(r.map(o=>o.rule))].sort().join(",");if(e.settings.secret_guard==="block"&&e.force!==!0)throw new f(`Mutation blocked by secret guard (${n}). No detected value was logged.`,m.CONFLICT,{code:"mutation_secret_guard_blocked",required:"Remove the credential-shaped content or retry with --force after explicit review.",nextSteps:["Replace the value with a secret-manager reference.","Use pm history-redact if equivalent content already entered history."],recovery:{recovery_mode:"compact",attempted_command:"pm <mutation> [REDACTED]",normalized_args:["[REDACTED]"],suggested_retry:"Remove credential-shaped content, then retry the mutation."}});return{author:t,findings:r,warnings:[`secret_guard_detected:${r.length}:rules=${n}`,...e.settings.secret_guard==="block"&&e.force===!0?["secret_guard_force_override"]:[]],override_applied:e.settings.secret_guard==="block"&&e.force===!0}}function Bi(e){return Mt.has(e.trim().toLowerCase())}function Gi(){return[...Mt.keys()].sort((e,t)=>e.localeCompare(t))}function Nd(e){return Mt.get(e.trim().toLowerCase())}(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]="6c555c2c-9db2-5c9f-9d69-3456fe8bffaa")}catch{}})();function Yi(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Pd(e){return Yi(e).split(/[^a-z0-9]+/).filter(t=>t.length>0)}function he(e,t){if(e.length===0&&t.length===0)return 1;if(e.length===0||t.length===0)return 0;let r=new Set(e),n=new Set(t),o=0;for(let s of r)n.has(s)&&(o+=1);let i=new Set([...r,...n]).size;return o/i}(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]="5767332d-8094-55cd-96e9-47c5d20cd7df")}catch{}})();var Wi=/\b([a-z][a-z0-9]*)-(\d+)(?:-[a-z0-9]+)*\b/giu,Xi=/^(?:utf|iso|sha|tls|http|covid|match)$/iu;function $e(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function be(e){return[...new Set($e(e).match(/[\p{L}\p{N}]+/gu)??[])]}function we(e){let t=$e(e);return{normalized:t,tokens:be(t),issueCodes:[...new Set([...e.matchAll(Wi)].filter(r=>{let n=r[1],o=r.index,i=e.slice(o+r[0].length);return!Xi.test(n)&&(n===n.toUpperCase()||n.length<=2||o===0&&/^\s*(?::|—|–|\])/u.test(i))}).map(r=>r[0].toLowerCase()))]}}function Ue(e,t){return ze(we(e),we(t))}function ze(e,t){if(e.normalized===t.normalized)return{score:1,reason:"exact_title"};let r=new Set(e.issueCodes);return t.issueCodes.some(n=>r.has(n))?{score:.99,reason:"issue_code"}:{score:he(e.tokens,t.tokens),reason:"title_token_jaccard"}}import Ji 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]="a7cd1d62-16fe-5e5b-b382-64335fc5e403")}catch{}})();function Ve(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function Qi(e,t){return[e.updated_at,t].map(r=>({value:r,time:Date.parse(r??"")})).filter(r=>typeof r.value=="string"&&Number.isFinite(r.time)).sort((r,n)=>n.time-r.time)[0]?.value??e.updated_at}function an(e,t){let r=Math.max(1,Math.trunc(t.threshold_hours)),n=(t.now??new Date).getTime(),o=Ve(t.in_progress_status),i=[];for(let s of e){if(Ve(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=Qi(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let l=Math.max(0,Math.floor((n-c)/36e5));l>=r&&i.push({id:s.id,last_activity_at:a,age_hours:l})}return i.sort((s,a)=>a.age_hours-s.age_hours||s.id.localeCompare(a.id)),{threshold_hours:r,count:i.length,items:i,remediation:"Claim active work with `pm claim <id>` or return abandoned work to open with `pm update <id> --status open`."}}async function Zi(e,t,r){let n=new Map;return await Promise.all(t.filter(o=>Ve(String(o.status))===Ve(r.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await pe(Ji.join(e,"history",`${o.id}.jsonl`),o.id)}catch{return}let s=i.map(a=>a.ts).filter(a=>Number.isFinite(Date.parse(a))).sort((a,c)=>Date.parse(c)-Date.parse(a))[0];s&&n.set(o.id,s)})),an(t,{...r,last_history_activity:o=>n.get(o.id)})}(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]="42b217a3-31c0-561a-b7cb-b1a584b2edd5")}catch{}})();var es=new Set(["rename-type","rename-field","remap-status",...vr]);function ts(e,t){if(t&&!es.has(e))throw new f(`schema ${e} does not support --dry-run. Preview is supported for rename-type, rename-field, remap-status and workflow-policy actions. Remove --dry-run only when you intend to apply changes.`,m.USAGE,{code:"invalid_argument_value",examples:["pm schema rename-type Spike --to Experiment --dry-run"]})}import{readFile as rs}from"node:fs/promises";import cn 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]="da661b46-841c-526d-88bc-976e007e8fbe")}catch{}})();function ns(e){let t=e.trim();if(!t)throw new f("--rollback requires a non-empty checkpoint ID",m.USAGE);if(!/^[a-zA-Z0-9._-]+$/.test(t))throw new f("--rollback checkpoint ID must match [a-zA-Z0-9._-]+",m.USAGE);return t}function os(e,t){let r=t.replace(/[-:.TZ]/g,"").slice(0,14),n=Math.random().toString(36).slice(2,8);return`${e}-${r}-${n}`}function is(e,t){return cn.join(e,"checkpoints",t)}function ln(e,t,r){return cn.join(is(e,t),`${r}.json`)}async function ss(e,t,r,n){let o=ln(e,t,r),i=`${JSON.stringify(n,null,2)}
|
|
2
2
|
`;if(!await Tr(o,i)&&await S(o)!==i)throw new f(`Checkpoint ${r} already exists with different contents; use a new checkpoint ID.`,m.CONFLICT);return o}function as(e,t){if(!Array.isArray(e.items))throw new f(`Checkpoint ${t} is missing items`,m.GENERIC_FAILURE);return e.items.map(r=>{if(!r||typeof r!="object")throw new f(`Checkpoint ${t} contains an invalid item entry`,m.GENERIC_FAILURE);let n=r;if(typeof n.id!="string"||n.id.trim().length===0)throw new f(`Checkpoint ${t} contains an item entry without ID`,m.GENERIC_FAILURE);if(typeof n.target_updated_at!="string"||n.target_updated_at.trim().length===0)throw new f(`Checkpoint ${t} contains an item entry without target_updated_at`,m.GENERIC_FAILURE);return{id:n.id.trim(),target_updated_at:n.target_updated_at.trim()}})}async function cs(e,t,r,n){let o=ns(r),i=ln(e,t,o);if(!await U(i))throw new f(`Checkpoint ${o} not found`,m.NOT_FOUND);let s=await rs(i,"utf8"),a;try{a=JSON.parse(s)}catch(d){throw new f(`Checkpoint ${o} contains invalid JSON: ${E(d)}`,m.GENERIC_FAILURE)}if(!a||typeof a!="object")throw new f(`Checkpoint ${o} is invalid`,m.GENERIC_FAILURE);let c=a;if(c.schema_version!==n)throw new f(`Checkpoint ${o} has unsupported schema version`,m.GENERIC_FAILURE);let l=as(c,o);return{record:c,items:l,path:i,id:typeof c.id=="string"?c.id:o,created_at:typeof c.created_at=="string"?c.created_at:M(),author:typeof c.author=="string"?c.author:"unknown"}}async function ls(e,t){let r=[],n=[];for(let o of e)try{let i=await t(o.id,o.target_updated_at);r.push({id:o.id,status:"restored",changed_fields:i.changed_fields,warnings:i.warnings}),n.push(o.id)}catch(i){r.push({id:o.id,status:"failed",error:E(i)})}return{rows:r,restored_ids:n,failed_count:r.filter(o=>o.status==="failed").length}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cb883ffc-c431-5bf9-a973-931a8a0a940c")}catch{}})();function z(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t.length>0?t:null}function ou(e,t){let r=z(t);return!e||!r?null:[...e.assurance_providers??[]].reverse().find(n=>z(n.definition.id)===r)??null}function ds(e,t){let r=z(t);return!e||!r?null:[...e.search_providers].reverse().find(n=>(z(n.runtime_definition?.name)??z(n.definition?.name))===r)??null}function us(e,t){let r=z(t);return!e||!r?null:[...e.vector_store_adapters].reverse().find(n=>(z(n.runtime_definition?.name)??z(n.definition?.name))===r)??null}(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]="4ce8635f-ea61-5443-abfc-092219a82396")}catch{}})();var $="-",un=new Set(["actual_result","body","cmd","command","customer_impact","description","environment","expected_result","impact","location","message","note","outcome","repro_steps","resolution","text","title","unblock_note","value","why_now"]);function cu(e,t){if(e.startsWith("```")||e.includes(`
|
|
3
3
|
`))return!0;let r=t.map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return new RegExp(`^(?:[-*+]\\s+)?(?:${r})\\s*[:=]`,"i").test(e)}function mn(e){let t=e.trim();if(t==="")return[];let r=(ys(t)??t.split(",")).map(n=>n.trim()).filter(Boolean).map(n=>n.toLowerCase());return Array.from(new Set(r)).sort((n,o)=>n.localeCompare(o))}function fn(e){if(!Array.isArray(e)||e.length===0)return[];let t=[];for(let r of e)if(typeof r=="string")for(let n of mn(r))t.push(n);return Array.from(new Set(t)).sort((r,n)=>r.localeCompare(n))}function pn(e){return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function ms(e){return typeof e!="string"?[]:e.split(";").map(t=>t.trim()).filter(Boolean)}function fs(e,t,r){let n=e.map(s=>s.trim()).filter(Boolean);for(let s of t??[]){let a=s.trim();if(a.includes(";"))throw new f('Acceptance criteria added with --add-ac cannot contain ";" because semicolons delimit stored criteria',m.USAGE,{code:"acceptance_criteria_semicolon_forbidden",required:"Pass one semicolon-free criterion per --add-ac value",why:"A semicolon inside one criterion would be re-read as multiple criteria",nextSteps:["Split the text into repeated --add-ac values, or replace the semicolon with punctuation that is not the storage delimiter"]});a.length>0&&!n.includes(a)&&n.push(a)}let o=[],i=n;for(let s of r??[]){let a=s.trim();if(a.length!==0){if(!i.includes(a)){o.push(a);continue}i=i.filter(c=>c!==a)}}return{criteria:i,unmatchedRemovals:o}}function ps(e,t){let r=pn(e);if(!t||t.length===0)return Array.from(new Set(r)).sort((o,i)=>o.localeCompare(i));let n=new Set(r);for(let o of fn(t))n.add(o);return Array.from(n).sort((o,i)=>o.localeCompare(i))}function _s(e,t){let r=Array.from(new Set(pn(e))).sort((o,i)=>o.localeCompare(i));if(!t||t.length===0)return r;let n=new Set(fn(t));return n.size===0?r:r.filter(o=>!n.has(o))}function ys(e){if(!e.startsWith("["))return null;let t;try{t=JSON.parse(e)}catch{return null}return t.map(r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"?String(r):"").filter(r=>r.length>0)}function Dt(e){return e.replace(/\r\n/g,`
|
|
4
4
|
`)}function _n(e){let t=Dt(e).trim();if(!t.startsWith("```"))return e;let r=t.split(`
|
|
@@ -17,4 +17,4 @@ ${i}`;continue}return null}return r}function Es(e,t){let r=_n(e).trim();if(!r)th
|
|
|
17
17
|
`)){let n=r.trim();if(n.length!==0)try{let o=JSON.parse(n);o&&typeof o=="object"&&typeof o.endpoint=="string"&&o.endpoint.trim().length>0&&"payload"in o&&typeof o.attempts=="number"&&Number.isFinite(o.attempts)&&((typeof o.id!="string"||o.id.length===0)&&(o.id=Jc(o)),t.push(o))}catch{}}return t}function Qc(e,t){if(typeof e.enqueued_at!="string"||e.enqueued_at.trim().length===0)return!1;let r=Date.parse(e.enqueued_at);return Number.isNaN(r)?!1:r<t}function go(e,t){let r=mo(t),n=[],o=0;for(let i of e){if(JSON.stringify(i).length>Wn||Qc(i,r)||i.attempts>=Xn){o+=1;continue}n.push(i)}if(n.length>Kn){let i=n.length-Kn;return o+=i,{entries:n.slice(i),prunedCount:o}}return{entries:n,prunedCount:o}}async function Zc(e,t){let r=t.map(o=>JSON.stringify(o)).join(`
|
|
18
18
|
`),n=r.length>0?`${r}
|
|
19
19
|
`:"";for(let o=0;;o+=1)try{await I(or(e),n);return}catch(i){let s=Jn[o];if(s===void 0||!po(i))throw i;await _o(s)}}async function Gn(e,t,r,n){return Ae(async()=>{let o=await S(or(e)),i=o===null?[]:yo(o),s=[];for(let c of i){if(r.has(c.id))continue;let l=n.get(c.id);s.push(l?{...c,attempts:l.attempts,next_attempt_after:l.next_attempt_after}:c)}let{entries:a}=go(s,t);return await Zc(e,a),a.length},e)}async function el(e,t){let r=await S(or(e));if(r===null||r.trim().length===0){await F(e,{pending_otel_spans:0});return}let n=yo(r),{entries:o,prunedCount:i}=go(n,t),s=o.filter(g=>uo(g.next_attempt_after)).slice(0,Tc);if(s.length===0){let g=i>0?await Gn(e,t,new Set,new Map):o.length;await F(e,{pending_otel_spans:g});return}let a=M(),c=new Set,l=new Map,d=0,u;await Promise.all(s.map(async g=>{try{let y=await ao(g.endpoint,{"content-type":"application/json"},JSON.stringify(g.payload));if(y<200||y>=300)throw new Error(`local_otel_export_http_${y}`);c.add(g.id),d+=1}catch(y){u=y instanceof Error?tr(y.message,"redacted"):"local_otel_export_failed";let h=g.attempts+1;l.set(g.id,{attempts:h,next_attempt_after:lo(h)})}}));let p=await Gn(e,t,c,l),_={pending_otel_spans:p,last_otel_attempt_at:a};d>0&&(_.last_otel_success_at=a),u!==void 0?(_.last_otel_failure_at=a,_.last_otel_failure_error=u):p===0&&(_.last_otel_failure_at=void 0,_.last_otel_failure_error=void 0),await F(e,_)}async function tl(e,t,r){try{await ol(e,t,r)}catch{}try{await el(e,r)}catch{}}async function rl(e,t=xc){try{let r=zc(e),n=await gc(r,{withFileTypes:!0}),o=Date.now()-Math.max(0,t);await Promise.all(n.filter(i=>i.isFile()&&/^\.events\.jsonl\.\d+\.\d+\.[a-f0-9]+\.tmp$/.test(i.name)).map(async i=>{let s=L.join(r,i.name);(await Yn(s)).mtimeMs<o&&await nr(s,{force:!0})}))}catch{}}async function Ae(e,t=ue(process.cwd()),r=5e3){let n=Hn.catch(()=>{}).then(()=>Ir(async()=>{let o=await Me(t,"telemetry-queue",60,"telemetry",!1,!1,r);try{return $r(t),await e()}finally{await o()}}));return Hn=n.catch(()=>{}),n}async function sr(e){let t=await S(rt(e));return t===null||t.trim().length===0?[]:co(t)}async function er(e,t,r){return Ae(async()=>{let n=await sr(e),{entries:o}=ir(n,r),i=o.filter(s=>!t.has(s.event.event_id));return await fo(e,i),i},e)}async function nl(e,t,r,n){return Ae(async()=>{let o=await sr(e),{entries:i}=ir(o,n),s=i.map(a=>{if(!t.has(a.event.event_id))return a;let c=a.attempts+1;return{...a,attempts:c,last_attempt_at:r,next_attempt_after:lo(c)}});return await fo(e,s),s},e)}async function ol(e,t,r){await rl(e);let n=t.trim();if(n.length===0)return;let o=await S(rt(e));if(o===null||o.trim().length===0){await F(e,{endpoint:n,queue_entries:0});return}let i=co(o);if(i.length===0){await F(e,{endpoint:n,queue_entries:0});return}let{entries:s,prunedCount:a}=ir(i,r);if(s.length===0){let _=await er(e,new Set,r);await F(e,{endpoint:n,queue_entries:_.length});return}let c=s.filter(_=>Wc(_)).slice(0,Ic);if(c.length===0){let _=a>0?await er(e,new Set,r):s;await F(e,{endpoint:n,queue_entries:_.length});return}let l=new Set(c.map(_=>_.event.event_id)),d=M(),u={"content-type":"application/json"},p=process.env.PM_TELEMETRY_INGEST_KEY?.trim();p&&(u["x-pm-telemetry-key"]=p);try{let _=await ao(n,u,JSON.stringify({schema_version:vc,events:c.map(g=>g.event)}));if(_<200||_>=300)throw new Error(`telemetry_flush_http_${_}`)}catch(_){let g=await nl(e,l,d,r),y=_ instanceof Error?tr(_.message,"redacted"):"telemetry_flush_failed";await F(e,{endpoint:n,queue_entries:g.length,last_attempted_flush_at:d,last_failed_flush_at:d,last_failed_flush_error:y});return}try{let _=await er(e,l,r);await F(e,{endpoint:n,queue_entries:_.length,last_attempted_flush_at:d,last_successful_flush_at:d,last_failed_flush_at:void 0,last_failed_flush_error:void 0})}catch(_){let g=_ instanceof Error?tr(_.message,"redacted"):"telemetry_flush_failed",y=await sr(e).catch(()=>s);await F(e,{endpoint:n,queue_entries:y.length,last_attempted_flush_at:d,last_failed_flush_at:d,last_failed_flush_error:g})}}async function il(e){let t=eo(e);await Zt(L.dirname(t),{recursive:!0});try{return await Zt(t),!0}catch(r){if(typeof r!="object"||r===null||!("code"in r)||r.code!=="EEXIST")throw r}try{let r=await Yn(t);return Date.now()-r.mtimeMs<Mc?!1:(await nr(t,{recursive:!0,force:!0}),await Zt(t),!0)}catch{return!1}}function sl(e){try{yc(e,{recursive:!0,force:!0})}catch{}}function al(e){sl(Vc(e))}async function cl(e,t,r){let n=await il(e);if(al(e),!!n)try{await tl(e,t,r)}finally{try{await nr(eo(e),{recursive:!0,force:!0})}catch{}}}async function Yf(e=ue(process.cwd())){if(!Ie().telemetry_disabled)try{if(!(await v(e)).telemetry.enabled)return;let t=await Ae(()=>Yc(e),e);if(!t)return;await cl(e,t.endpoint,t.retentionDays)}catch{}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a3b93077-f162-5874-b81b-5d6b8be427b5")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="738a98bc-eaf0-578d-88e3-1c5f83c8894b")}catch{}})();function nt(e,t="--limit"){if(e===void 0)return;let r=String(e).trim(),n=r.length===0?Number.NaN:Number(r);if(!Number.isInteger(n)||n<0)throw new f(`${t} must be a non-negative integer`,m.USAGE);return n}function ho(e,t="--priority"){if(e===void 0)return;let r=String(e).trim(),n=r.length===0?Number.NaN:Number(r);if(!Number.isInteger(n)||n<0||n>4)throw new f(`${t} filter must be 0..4`,m.USAGE);return n}function rh(e,t,r="--type"){if(e===void 0)return;let n=de(e,t);if(!n)throw new f(`${r} filter must be one of ${t.types.join("|")}`,m.USAGE);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]="75ecca0c-fac8-5a9b-9043-c65731daad4a")}catch{}})();function ar(e,t){if(e===void 0)return;let r=[],n="";for(let s=0;s<e.length;s+=1){let a=e[s];if(a==="\\"){let c=e[s+1];if(c===","||c==="\\"){n+=c,s+=1;continue}n+=a;continue}if(a===","){r.push(n),n="";continue}n+=a}r.push(n);let o=r.map(s=>s.trim());if(o.some(s=>s.length===0))throw new f(`${t.label} requires at least one non-empty value`,m.USAGE);let i=o.map(s=>t.normalize?.(s)??s);return[...new Set(i)]}function Ce(e,t){let r=ar(e,t);return r===void 0?void 0:new Set(r)}function wo(e,t,r="--type"){let n=ar(e,{label:r});if(n===void 0)return;let o=n.map(i=>{let s=de(i,t);if(!s)throw new f(`${r} filter token "${i}" must be one of ${t.types.join("|")}`,m.USAGE);return s});return new Set(o)}function bo(e,t="--priority"){let r=ar(e,{label:t});if(r!==void 0)return new Set(r.map(n=>ho(n,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]="f9d73d74-7c4e-5ea9-b34c-c984b4c15ab3")}catch{}})();function Eo(e,t){let r=e.trim().toLowerCase();return t.alias_to_id.get(r)??r}function Io(e){return{isTerminal(t){return e.terminal_statuses.has(Eo(t,e))},classify(t){let r=Eo(t,e);return e.terminal_canceled_statuses.has(r)?"canceled":e.terminal_statuses.has(r)?"closed":e.blocked_statuses.has(r)?"blocked":e.draft_statuses.has(r)?"draft":r===e.open_status?"open":e.active_statuses.has(r)?"in_progress":"other"}}}function cr(e){return T(e.acceptance_criteria)===void 0}function lr(e){return!Number.isFinite(e.estimated_minutes)}function Ao(e,t){return t.isTerminal(e.status)?T(e.resolution)===void 0:!1}function dl(e){return T(e.reviewer)===void 0}function ul(e){return T(e.risk)===void 0}function ml(e){return typeof e.confidence=="number"?!Number.isFinite(e.confidence):T(e.confidence)===void 0}function fl(e){return T(e.sprint)===void 0}function pl(e){return T(e.release)===void 0}function dr(e){return!!(e.acMissing||e.estimatesMissing||e.resolutionMissing||e.reviewerMissing||e.riskMissing||e.confidenceMissing||e.sprintMissing||e.releaseMissing||e.metadataMissing)}function _l(e,t,r){return[[t.acMissing,cr(e)],[t.estimatesMissing,lr(e)],[t.resolutionMissing,Ao(e,r)],[t.reviewerMissing,dl(e)],[t.riskMissing,ul(e)],[t.confidenceMissing,ml(e)],[t.sprintMissing,fl(e)],[t.releaseMissing,pl(e)]].every(([n,o])=>n!==!0||o)}function yl(e,t){return cr(e)||lr(e)||Ao(e,t)}function Co(e,t,r){return dr(t)?!(!_l(e,t,r)||t.metadataMissing&&!yl(e,r)):!0}var ur=["acceptance_criteria","estimated_minutes","resolution","tags","parent"];function gl(e,t){switch(t){case"acceptance_criteria":return!cr(e);case"estimated_minutes":return!lr(e);case"resolution":return T(e.resolution)!==void 0;case"tags":return Array.isArray(e.tags)&&e.tags.length>0;default:return T(e.parent)!==void 0}}function hl(e,t,r){return t==="resolution"?r.isTerminal(e.status):!0}function wl(e,t){return t===0?100:Math.round(e/t*1e3)/10}function So(){let e={};for(let t of ur)e[t]={present:0,applicable:0,percent:100};return e}function To(e,t,r){for(let n of ur){if(!hl(t,n,r))continue;let o=e[n];o.applicable+=1,gl(t,n)&&(o.present+=1)}}function vo(e){for(let t of ur){let r=e[t];r.percent=wl(r.present,r.applicable)}}function dh(e,t){let r=So(),n={};for(let o of e){To(r,o,t);let i=n[o.type]??(n[o.type]=So());To(i,o,t)}vo(r);for(let o of Object.values(n))vo(o);return{overall:r,by_type:n}}var bl={assignee:"(unassigned)",priority:"(no priority)",tag:"(untagged)",parent:"(unparented)",type:"(untyped)",status:"(no status)"};function El(e){return bl[e]}function Sl(){return{open:0,in_progress:0,blocked:0,draft:0,closed:0,canceled:0,other:0}}function Tl(e,t,r){switch(t){case"assignee":return[T(e.assignee)??null];case"parent":return[T(e.parent)??null];case"type":return[T(e.type)??null];case"status":return[T(e.status)??null];case"priority":return[typeof e.priority=="number"?`P${e.priority}`:null];default:{let n=r.tagPrefix?.trim(),o=(Array.isArray(e.tags)?e.tags:[]).filter(i=>typeof i=="string"&&i.length>0&&(!n||i.startsWith(n)));return o.length>0?o:[null]}}}function uh(e,t,r,n={}){let o=new Map,i=0;for(let a of e){i+=1;let c=r.classify(a.status);for(let l of Tl(a,t,n)){let d=l??"\0empty",u=o.get(d);u||(u={label:l??El(t),key:l,buckets:Sl(),total:0},o.set(d,u)),u.buckets[c]+=1,u.total+=1}}let s=[...o.values()].sort((a,c)=>c.total!==a.total?c.total-a.total:a.key===null?1:c.key===null?-1:a.label.localeCompare(c.label));return{dimension:t,rows:s,total_items:i}}(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]="67f9184e-08b6-5f21-9f92-e60974adbf1e")}catch{}})();var ae=["notes","learnings","files","docs","tests","comments","deps","body","linked_command"];function X(e){return Array.isArray(e)&&e.length>0}function vl(e){return typeof e=="string"&&e.trim().length>0}function Il(e){return Array.isArray(e)?e.some(t=>{if(typeof t!="object"||t===null)return!1;let r=t.command;return typeof r=="string"&&r.trim().length>0}):!1}function ko(e,t){switch(t){case"notes":return X(e.notes);case"learnings":return X(e.learnings);case"files":return X(e.files);case"docs":return X(e.docs);case"tests":return X(e.tests);case"comments":return X(e.comments);case"deps":return X(e.dependencies);case"body":return vl(e.body);case"linked_command":return Il(e.tests)}}function Lo(e){return ae.some(t=>e[t]!==void 0)}function xo(e,t){for(let r of ae){let n=t[r];if(n===void 0)continue;let o=ko(e,r);if(n==="present"&&!o||n==="absent"&&o)return!1}return!0}function Mo(e){return ae.some(t=>t!=="body"&&e[t]!==void 0)}function Do(e){return e.body!==void 0}function Ro(e,t){return t===0?100:Math.round(e/t*1e3)/10}function Al(){let e={};for(let t of ae)e[t]={present:0,total:0,percent:100};return e}function fh(e){let t=Al(),r=e.length;for(let s of e)for(let a of ae)ko(s,a)&&(t[a].present+=1);for(let s of ae)t[s].total=r,t[s].percent=Ro(t[s].present,r);let n=t.body,o=r-n.present,i={present:o,total:r,percent:Ro(o,r)};return{total_items:r,fields:t,body_populated:n,empty_body:i}}(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]="d638f294-7d4b-5fdc-9a86-d70c2cbdd9f4")}catch{}})();var Uo=e=>({acMissing:e.filterAcMissing===!0,estimatesMissing:e.filterEstimatesMissing===!0,resolutionMissing:e.filterResolutionMissing===!0,metadataMissing:e.filterMetadataMissing===!0,reviewerMissing:e.filterReviewerMissing===!0,riskMissing:e.filterRiskMissing===!0,confidenceMissing:e.filterConfidenceMissing===!0,sprintMissing:e.filterSprintMissing===!0,releaseMissing:e.filterReleaseMissing===!0}),Oo=[{field:"notes",presentKey:"hasNotes",absentKey:"noNotes",presentFlag:"--has-notes",absentFlag:"--no-notes"},{field:"learnings",presentKey:"hasLearnings",absentKey:"noLearnings",presentFlag:"--has-learnings",absentFlag:"--no-learnings"},{field:"files",presentKey:"hasFiles",absentKey:"noFiles",presentFlag:"--has-files",absentFlag:"--no-files"},{field:"docs",presentKey:"hasDocs",absentKey:"noDocs",presentFlag:"--has-docs",absentFlag:"--no-docs"},{field:"tests",presentKey:"hasTests",absentKey:"noTests",presentFlag:"--has-tests",absentFlag:"--no-tests"},{field:"comments",presentKey:"hasComments",absentKey:"noComments",presentFlag:"--has-comments",absentFlag:"--no-comments"},{field:"deps",presentKey:"hasDeps",absentKey:"noDeps",presentFlag:"--has-deps",absentFlag:"--no-deps"},{field:"body",presentKey:"hasBody",absentKey:"emptyBody",presentFlag:"--has-body",absentFlag:"--empty-body"},{field:"linked_command",presentKey:"hasLinkedCommand",absentKey:"noLinkedCommand",presentFlag:"--has-linked-command",absentFlag:"--no-linked-command"}],fr=e=>{let t=Oo.find(r=>e[r.presentKey]===!0&&e[r.absentKey]===!0);if(t)throw new f(`Cannot combine ${t.presentFlag} with ${t.absentFlag} for the same field.`,m.USAGE);return Object.fromEntries(Oo.flatMap(r=>e[r.presentKey]===!0?[[r.field,"present"]]:e[r.absentKey]===!0?[[r.field,"absent"]]:[]))},No=["priority","deadline","updated_at","created_at","title","parent"],Fo=["asc","desc"],zo=new Set(qr);function Cl(e,t,r){let n=e.filter(s=>s.startsWith("item_list_item_read_failed:")).length,o=e.filter(s=>s.startsWith("item_list_directory_read_failed:")).length,i={status:t?"unchecked":n+o>0?"partial":"complete",unreadable_item_count:n,unreadable_directory_count:o};if(r&&i.status==="partial")throw new f(`List source is incomplete: ${n} item document(s) and ${o} item directory/directories could not be read.`,m.GENERIC_FAILURE,{code:"list_source_incomplete",why:"Strict list reads fail closed so agents and SDK consumers never treat an omitted item as a complete workspace.",nextSteps:["Run pm validate --check-storage-integrity to locate unreadable tracker artifacts.","Repair the reported files or align the installed decoder version, then retry."]});return i}function Rl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length>0}var kl=[{key:"hasNotes",summaryKey:"has_notes"},{key:"hasLearnings",summaryKey:"has_learnings"},{key:"hasFiles",summaryKey:"has_files"},{key:"hasDocs",summaryKey:"has_docs"},{key:"hasTests",summaryKey:"has_tests"},{key:"hasComments",summaryKey:"has_comments"},{key:"hasDeps",summaryKey:"has_deps"},{key:"hasBody",summaryKey:"has_body"},{key:"hasLinkedCommand",summaryKey:"has_linked_command"},{key:"noNotes",summaryKey:"no_notes"},{key:"noLearnings",summaryKey:"no_learnings"},{key:"noFiles",summaryKey:"no_files"},{key:"noDocs",summaryKey:"no_docs"},{key:"noTests",summaryKey:"no_tests"},{key:"noComments",summaryKey:"no_comments"},{key:"noDeps",summaryKey:"no_deps"},{key:"emptyBody",summaryKey:"empty_body"},{key:"noLinkedCommand",summaryKey:"no_linked_command"}],Ll=[{key:"filterReviewerMissing",summaryKey:"filter_reviewer_missing"},{key:"filterRiskMissing",summaryKey:"filter_risk_missing"},{key:"filterConfidenceMissing",summaryKey:"filter_confidence_missing"},{key:"filterSprintMissing",summaryKey:"filter_sprint_missing"},{key:"filterReleaseMissing",summaryKey:"filter_release_missing"}];function Vo(e,t){for(let r of kl)t[r.key]===!0&&(e[r.summaryKey]=!0)}function jo(e,t){for(let r of Ll)t[r.key]===!0&&(e[r.summaryKey]=!0)}function xl(e,t,r){for(let n of r){let o=t[n.optionKey];o!==void 0&&(e[n.summaryKey]=n.normalize?n.normalize(o):o)}}function Ko(e){let t={};return Vo(t,e),t}function qo(e){let t={};return jo(t,e),t}var Ml=[{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"ids",summaryKey:"ids"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"assigneeFilter",summaryKey:"assignee_filter"},{optionKey:"parent",summaryKey:"parent"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"}],Dl=[{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"ids",summaryKey:"ids"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"assigneeFilter",summaryKey:"assignee_filter"},{optionKey:"parent",summaryKey:"parent"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"},{optionKey:"limit",summaryKey:"limit"},{optionKey:"offset",summaryKey:"offset"},{optionKey:"includeBody",summaryKey:"include_body"},{optionKey:"compact",summaryKey:"compact"},{optionKey:"fields",summaryKey:"fields"}],Ol=[{key:"filterAcMissing",summaryKey:"filter_ac_missing"},{key:"filterEstimatesMissing",summaryKey:"filter_estimates_missing"},{key:"filterResolutionMissing",summaryKey:"filter_resolution_missing"},{key:"filterMetadataMissing",summaryKey:"filter_metadata_missing"}],Nl="-7d";function Ho(e){let{filtersStatus:t,options:r,treeEnabled:n,treeDepth:o,sortField:i,sortOrder:s,runtimeFieldFilters:a}=e,c={};return t!==null&&(c.status=t),r.dependencyBlocked===!0&&(c.blocked_semantics="status_or_dependency"),xl(c,r,Ml),Go(c,r),r.filterAcMissing===!0&&(c.filter_ac_missing=!0),r.filterEstimatesMissing===!0&&(c.filter_estimates_missing=!0),r.filterResolutionMissing===!0&&(c.filter_resolution_missing=!0),r.filterMetadataMissing===!0&&(c.filter_metadata_missing=!0),jo(c,r),Vo(c,r),r.limit!==void 0&&(c.limit=r.limit),r.offset!==void 0&&(c.offset=r.offset),r.includeBody===!0&&(c.include_body=!0),r.fields!==void 0&&(c.fields=r.fields),n&&(c.tree=!0,o!==void 0&&(c.tree_depth=o)),i!==void 0&&(c.sort=i,c.order=s),Rl(a)&&(c.runtime_filters=a),c}function pr(e,t,r){let n=q(e.status,r),o=q(t.status,r);if(n!==o)return n?1:-1;let i=e.priority-t.priority;if(i!==0)return i;let s=te(t.updated_at,e.updated_at);return s!==0?s:(e.id??"").localeCompare(t.id??"")}function Fl(e,t){return[...e].sort((r,n)=>pr(r,n,t))}function Po(e,t){if(e!==void 0)return xe(e,new Date,t)}function Re(e,t){if(e==null)return;let r=String(e).trim();if(r.length!==0)return xe(r,new Date,t)}function Bo(e){let t=e.updatedAfter!=null&&String(e.updatedAfter).trim().length>0;if([e.today===!0,e.recent===!0,t].filter(r=>r).length>1)throw new f("Choose only one updated_at window: --today, --recent, or --updated-after.",m.USAGE);if(e.today===!0){let r=new Date;return r.setHours(0,0,0,0),r.toISOString()}return e.recent===!0?Re(Nl,"recent"):Re(e.updatedAfter,"updated-after")}function Go(e,t){t.today===!0&&(e.today=!0),t.recent===!0&&(e.recent=!0)}function Yo(e){if(e==null)return;let t=String(e).trim();if(t.length===0)throw new f("--ids requires at least one non-empty item ID",m.USAGE);let r=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(r.length===0)throw new f("--ids requires at least one non-empty item ID",m.USAGE);return new Set(r)}function _r(e){if(e===void 0)return;let t=String(e).trim(),r=t.length===0?Number.NaN:Number(t);if(!Number.isInteger(r)||r<0)throw new f("Offset filter must be a non-negative integer",m.USAGE);return r}function Wo(e){if(e===void 0)return;let t=e.split(",").map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)throw new f("List --fields requires a comma-separated list of field names",m.USAGE);return[...new Set(t)]}function Xo(e,t=e.projectionCommand??"list"){let r=e.compact===!0,n=e.brief===!0,o=e.full===!0,i=Wo(e.fields);if(Number(r)+Number(n)+Number(o)+ +(i!==void 0)>1)throw new f("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.",m.USAGE,{code:"projection_options_mutually_exclusive",recovery:{suggested_retry:`pm ${t} --brief`,suggested_retry_args:[t,"--brief"]}});return o?{mode:"full",fields:[]}:n?{mode:"brief",fields:[...pt]}:r?{mode:"compact",fields:[...ft]}:i?{mode:"fields",fields:[...new Set(i.map(s=>V(s)))]}:{mode:"full",fields:[]}}function V(e){return e.startsWith("item.")?e.slice(5):e}function Pl(e,t,r){if(e.mode!=="fields")return;let n=_t(t),o=new Set(n.map(s=>V(s))),i=e.fields.filter(s=>!o.has(V(s)));if(i.length>0){let s=[r,"--fields",e.fields.filter(a=>!i.includes(a)).join(",")||"id,title,status"];throw new f(`Unknown list --fields value(s): ${i.join(", ")}`,m.USAGE,{code:"unknown_field_projection",examples:["pm list-open --fields id,title,status,type,updated_at","pm list --fields id,title,parent,priority --limit 10","pm list-all --fields id,title,body --limit 5"],recovery:{allowed_values:n,suggested_retry:Cr(s),suggested_retry_args:s}})}}var $l=new Map([["updated","updated_at"],["update","updated_at"],["modified","updated_at"],["created","created_at"],["create","created_at"]]);function Jo(e){if(e===void 0)return;let t=e.trim().toLowerCase(),r=$l.get(t);if(r)return r;if(!No.includes(t))throw new f(`Sort field must be one of ${No.join("|")} (aliases: updated->updated_at, created->created_at)`,m.USAGE);return t}function Qo(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!Fo.includes(t))throw new f(`Sort order must be one of ${Fo.join("|")}`,m.USAGE);return t}function Ul(e){return nt(e,"--tree-depth")}function Zo(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!t)throw new f("Assignee filter must be one of assigned|unassigned",m.USAGE);if(t!=="assigned"&&t!=="unassigned")throw new f(`Invalid assignee filter "${e}". Allowed: assigned|unassigned`,m.USAGE);return t}function $o(e,t){return Pt(e,t,{strict:!0})}function ei(e){return Ce(e,{label:"--tag",normalize:t=>t.toLowerCase()})}function zl(e,t,r){let n=ei(t);if(n===void 0)return;let o=new Set(e.flatMap(s=>s.tags.map(a=>a.trim().toLowerCase()))),i=[...n].filter(s=>!o.has(s));i.length>0&&r.push(`unknown_tags:${i.join(",")}`)}function Vl(e,t){if(e&&[...e].some(r=>r.toLowerCase()==="none"||r.toLowerCase()==="null"))throw new f('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',m.USAGE);if(e!==void 0&&t==="unassigned")throw new f("Cannot combine --assignee with --assignee-filter unassigned",m.USAGE)}function jl(e,t,r,n){let o=Ce(t.assignee,{label:"--assignee"}),i=Zo(t.assigneeFilter);Vl(o,i);let s=Uo(t),a=fr(t);return{idsFilter:Yo(t.ids),statusSet:e&&e.length>0?new Set(e):void 0,excludeTerminal:t.excludeTerminal===!0,typeFilter:wo(t.type,r),tagFilters:ei(t.tag),priorityFilter:bo(t.priority),deadlineBefore:Po(t.deadlineBefore,"deadline-before"),deadlineAfter:Po(t.deadlineAfter,"deadline-after"),updatedAfter:Bo(t),updatedBefore:Re(t.updatedBefore,"updated-before"),createdAfter:Re(t.createdAfter,"created-after"),createdBefore:Re(t.createdBefore,"created-before"),assigneeFilter:o,assigneeModeFilter:i,parentFilter:t.parent?.trim(),treeEnabled:t.tree===!0,sprintFilter:Ce(t.sprint,{label:"--sprint"}),releaseFilter:Ce(t.release,{label:"--release"}),missingMetadataFilters:s,missingMetadataActive:dr(s),lifecycleClassifier:Io(n),contentFieldFilters:a,contentFiltersActive:Lo(a)}}function Kl(e,t,r){return t.idsFilter&&!t.idsFilter.has(e.id)||t.statusSet&&!t.statusSet.has(e.status)||t.excludeTerminal&&q(e.status,r)||t.typeFilter&&!t.typeFilter.has(e.type)||t.tagFilters&&![...t.tagFilters].some(n=>(e.tags??[]).some(o=>o.trim().toLowerCase()===n))?!1:t.priorityFilter===void 0||t.priorityFilter.has(e.priority)}function ql(e,t){return xr(e,t)}function Hl(e,t){return t.assigneeModeFilter==="assigned"&&!e.assignee||t.assigneeModeFilter==="unassigned"&&e.assignee?!1:t.assigneeFilter===void 0||e.assignee!==void 0&&t.assigneeFilter.has(e.assignee)}function Bl(e,t,r){let n=e.parent?.trim().toLowerCase(),o=[...new Set([...r?.get(e.id.trim().toLowerCase())??[],...n?[n]:[]])];return t.parentFilter!==void 0&&!t.treeEnabled&&!o.includes(t.parentFilter.trim().toLowerCase())||t.sprintFilter!==void 0&&(e.sprint===void 0||!t.sprintFilter.has(e.sprint))?!1:t.releaseFilter===void 0||e.release!==void 0&&t.releaseFilter.has(e.release)}function Gl(e,t,r,n,o){return!(!Kl(e,t,r)||!ql(e,t)||!Hl(e,t)||!Bl(e,t,o)||t.missingMetadataActive&&!Co(e,t.missingMetadataFilters,t.lifecycleClassifier)||t.contentFiltersActive&&!xo(e,t.contentFieldFilters)||!Ut(e,n))}function ti(e,t,r,n,o,i,s){let a=jl(t,r,n,o);return e.filter(c=>Gl(c,a,o,i,s))}function ce(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function mr(e,t,r,n){let o=e,i=typeof o.title=="string"?o.title:"",s=n??ce(typeof o.parent=="string"?o.parent:void 0)??null;return{...e,tree_depth:t,tree_parent:s,tree_children:r,tree_title:`${" ".repeat(t)}${i}`}}function Yl(e,t){let r=new Map,n=new Map;for(let o of e){let i=o.id.trim().toLowerCase();r.set(i,o);let s=t?t.parents_by_child.get(i)??[]:[ce(o.parent)?.toLowerCase()].filter(a=>a!==void 0);for(let a of s){let c=n.get(a)??[];c.push(o),n.set(a,c)}}return{byId:r,childrenByParent:n}}function Wl(e,t,r,n,o){return t?[...n.get(t.toLowerCase())??[]]:e.filter(i=>(o?o.parents_by_child.get(i.id.trim().toLowerCase())??[]:[ce(i.parent)?.toLowerCase()].filter(s=>s!==void 0)).every(s=>!r.has(s)))}function ri(e,t,r,n,o=e){let{byId:i,childrenByParent:s}=Yl(e,n),a=Wl(e,t,i,s,n),c=[],l=new Set,d=new Map(o.map(p=>[p.id.trim().toLowerCase(),p.id.trim()])),u=[...a].reverse().map(p=>({node:p,depth:0,parentId:t===void 0?void 0:d.get(t.trim().toLowerCase())??t.trim()}));for(;u.length>0;){let{node:p,depth:_,parentId:g}=u.pop(),y=p.id.trim().toLowerCase();if(l.has(y))continue;l.add(y);let h=s.get(y)??[];if(c.push(mr(p,_,h.length,g)),!(r!==void 0&&_>=r))for(let b of[...h].reverse())u.push({node:b,depth:_+1,parentId:d.get(y)})}if(t===void 0&&r===void 0)for(let p of e){let _=p.id.trim().toLowerCase();l.has(_)||(l.add(_),c.push(mr(p,0,s.get(_)?.length??0)))}return c}function ni(e,t){return e===t?0:e===null?1:t===null?-1:e.localeCompare(t)}function oi(e,t){return e===t?0:e===null?1:t===null?-1:te(e,t)}function ii(e,t,r){switch(r){case"priority":return e.priority-t.priority;case"deadline":return oi(e.deadline??null,t.deadline??null);case"updated_at":return te(e.updated_at,t.updated_at);case"created_at":return te(e.created_at,t.created_at);case"title":return(e.title??"").localeCompare(t.title??"");case"parent":return ni(e.parent??null,t.parent??null);default:return 0}}function si(e,t,r,n){return t?[...e].sort((o,i)=>{let s=ii(o,i,t);if(s!==0)return r==="desc"?-s:s;let a=pr(o,i,n);return r==="desc"?-a:a}):Fl(e,n)}function ai(e,t,r=!1){let n=V(t.trim());if(n.length===0)return null;let o=e;return r&&n==="title"&&typeof o.tree_title=="string"?o.tree_title:Object.prototype.hasOwnProperty.call(o,n)?o[n]??null:null}function yr(e,t,r=!1){return t.mode==="full"?e:e.map(n=>{let o={};for(let i of t.fields)o[i]=ai(n,i,r);return o})}function ci(e){let t=[];for(let r of e)t.push(r.metadata_key);return t}function li(e,t){if(e.noTruncate!==!0)return nt(e.limit)??(t>=1e4?20:void 0)}function Xl(e,t,r){return t.after===void 0?_r(t.offset)??0:Lr(e,t.after,r,n=>n.id)}function di(e,t,r){return{...e!==void 0?{applied_limit:e}:{},has_more:t,truncated:t,next_cursor:r??null}}async function Jl(e,t){let r=R(process.cwd(),t.path);await ne(r);let n=await v(r),o=ee(n.schema),i=ut(n.schema),s=e.projectionCommand??"list",a=Xo(e,s);return Pl(a,ci(i.definitions),s),{pmRoot:r,settings:n,statusRegistry:o,runtimeFieldFilters:$t(e,i,"list"),typeRegistry:A(n,P()),projection:a}}async function Ql(e,t,r){let n=t.projection.fields.some(c=>V(c)==="body"),o=t.projection.mode==="full"||t.projection.fields.some(c=>zo.has(V(c))),i=fr(e),s=Mo(i),a=Do(i);return e.includeBody||n||a?await Hr(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema):o||s?await It(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema):await oe(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema)}function Zl(e){let t=Jo(e.sort),r=Qo(e.order)??"asc",n=e.tree===!0;if(!n&&e.treeDepth!==void 0)throw new f("List --tree-depth requires --tree",m.USAGE);if(!t&&e.order!==void 0)throw new f("List --order requires --sort",m.USAGE);return{sortField:t,sortOrder:r,treeEnabled:n,treeDepth:n?Ul(e.treeDepth):void 0,parentRoot:n?ce(e.parent):void 0}}function ed(e,t,r){let n=$o(t.status,r),o;t.lifecycleBucket==="in_progress"?o=[r.in_progress_status]:t.lifecycleBucket==="open"&&(o=[...r.active_statuses].filter(l=>l!==r.in_progress_status).sort((l,d)=>l.localeCompare(d)));let i=n??o??$o(e,r),s=Sn(t.status),a=n||s?{...t,excludeTerminal:!1}:t,c="all";return s?c="all":n!==void 0?c=n.length===1?n[0]:n:t.lifecycleBucket!==void 0?c=t.lifecycleBucket:i!==void 0?c=i.length===1?i[0]:i:a.excludeTerminal===!0&&(c=null),{resolvedStatus:i,explicitAllStatuses:s,effectiveOptions:a,filtersStatus:c}}function td(e,t,r,n,o){if(t.after!==void 0&&t.offset!==void 0)throw new f("List --after cannot be combined with --offset.",m.USAGE);let i=li(t,e.length),s=Xl(e,t,o),a=i===void 0?e.slice(s):e.slice(s,s+i),c=yr(a,r,n),l=e.length,d=a.length>0&&s+a.length<l,u=d&&a.length>0?mt(o,a[a.length-1].id,s+a.length-1):void 0;return{projected:c,totalMatched:l,pageExtras:di(i,d,u)}}function ui(e,t,r,n){return kr("list",{pmRoot:n,status:e,options:Rr(t,Sr),sort:r.sortField??"default",order:r.sortOrder,tree:r.treeEnabled,tree_depth:r.treeDepth??null})}async function rd(e){let{options:t,runtime:r,statusSelection:n,ordering:o}=e,i=new Set(["status","limit","offset","compact","brief","full","fields","format","stream","includeBody","excludeTerminal","dependencyBlocked","lifecycleBucket","noTruncate","projectionCommand","truncate","notes","learnings","files","docs","tests","comments","deps","linkedCommand"]),s=[r.projection.mode==="full",r.projection.fields.some(_=>{let g=V(_);return g==="body"||zo.has(g)})].includes(!0);if([t.limit===void 0,t.after!==void 0,t.noTruncate===!0,t.includeBody===!0,t.dependencyBlocked===!0,t.strictRead===!0,o.treeEnabled,o.sortField!==void 0,s,Ar(),Object.keys(r.runtimeFieldFilters).length>0,Object.entries(t).some(([_,g])=>g!==void 0&&!i.has(_))].includes(!0))return null;let a=await _e(r.pmRoot,[...new Set(Object.values(r.typeRegistry.type_to_folder))]);if(!a)return null;let c=nt(t.limit),l=_r(t.offset)??0,d=await St({pmRoot:r.pmRoot,expectedSourceCursor:a.source_cursor,query:{statuses:n.resolvedStatus,excludeStatuses:n.resolvedStatus===void 0&&n.effectiveOptions.excludeTerminal===!0?[...r.statusRegistry.terminal_statuses]:void 0,terminalStatuses:[...r.statusRegistry.terminal_statuses],limit:c,offset:l}});if(!d)return null;let u=d.items.length>0&&l+d.items.length<d.total,p=u?mt(ui(n.filtersStatus,t,o,r.pmRoot),d.items.at(-1).id,l+d.items.length-1):void 0;return{projected:yr(d.items,r.projection,!1),totalMatched:d.total,pageExtras:di(c,u,p)}}function nd(e){let{filtersStatus:t,options:r,noTruncate:n,treeEnabled:o,treeDepth:i,sortField:s,sortOrder:a,runtimeFieldFilters:c}=e,l={};t!==null&&(l.status=t),r.dependencyBlocked===!0&&(l.blocked_semantics="status_or_dependency");let d=r;for(let u of Dl){let p=d[u.optionKey];p!=null&&(l[u.summaryKey]=p)}for(let u of Ol)d[u.key]===!0&&(l[u.summaryKey]=!0);return Object.assign(l,qo(r),Ko(r)),Go(l,r),n&&(l.no_truncate=!0),r.strictRead===!0&&(l.strict_read=!0),o&&(l.tree=!0,i!==void 0&&(l.tree_depth=i)),s!==void 0&&(l.sort=s,l.order=a),l.runtime_filters=c,l}async function qh(e,t,r){let n=await Jl(t,r),o=[],i=Zl(t),s=ed(e,t,n.statusRegistry),a=t.noTruncate===!0,c=await rd({options:t,runtime:n,statusSelection:s,ordering:i}),l=c;if(!l){let g=await Ql(t,n,o),y=i.treeEnabled||ce(t.parent)!==void 0?Wr(Yr(g,Gr())):void 0;zl(g,t.tag,o);let h=ti(g,s.resolvedStatus,s.effectiveOptions,n.typeRegistry,n.statusRegistry,n.runtimeFieldFilters,y?.parents_by_child),b=t.dependencyBlocked===!0?(()=>{let j=Br(g,n.statusRegistry);return h.filter(K=>j.has(K.id.trim().toLowerCase()))})():h,C=si(b,i.sortField,i.sortOrder,n.statusRegistry),x=i.treeEnabled?ri(C,i.parentRoot,i.treeDepth,y,g):C;l=td(x,t,n.projection,i.treeEnabled,ui(s.filtersStatus,t,i,n.pmRoot))}let d=M(),u=[...new Set(o)].sort((g,y)=>g.localeCompare(y)),p=Cl(u,c!==null,t.strictRead===!0),_=n.projection.mode==="full"?null:[...n.projection.fields];if(n.projection.mode==="compact"&&t.compact===!0){let g=Ho({filtersStatus:s.filtersStatus,options:t,treeEnabled:i.treeEnabled,treeDepth:i.treeDepth,sortField:i.sortField,sortOrder:i.sortOrder,runtimeFieldFilters:n.runtimeFieldFilters});return{items:l.projected,count:l.projected.length,total:l.totalMatched,...l.pageExtras,completeness:p,filters:g,projection:{mode:"compact",fields:_},...u.length>0?{warnings:u}:{}}}return{items:l.projected,count:l.projected.length,total:l.totalMatched,...l.pageExtras,completeness:p,filters:nd({filtersStatus:s.filtersStatus,options:t,noTruncate:a,treeEnabled:i.treeEnabled,treeDepth:i.treeDepth,sortField:i.sortField,sortOrder:i.sortOrder,runtimeFieldFilters:n.runtimeFieldFilters}),projection:{mode:n.projection.mode,fields:_},sorting:{sort:i.sortField??"default",order:i.sortField?i.sortOrder:"asc"},now:d,...u.length>0?{warnings:u}:{}}}var Hh={applyFilters:ti,buildCompactListFilterSummary:Ho,buildContentFilterEcho:Ko,buildGovernanceMissingFilterEcho:qo,resolveContentFieldFilters:fr,resolveMissingMetadataFilters:Uo,compareBySortField:ii,compareDefaultSort:pr,compareNullableString:ni,compareNullableTimestamp:oi,normalizeProjectionField:V,parseAssigneeFilter:Zo,parseFieldSelectors:Wo,parseIdsFilter:Yo,parseOffset:_r,parseProjectionConfig:Xo,resolveListUpdatedAfter:Bo,resolveListPageLimit:li,parseSortField:Jo,parseSortOrder:Qo,orderItemsAsTree:ri,projectListItems:yr,readListFieldValue:ai,runtimeMetadataKeysForProjection:ci,sortItems:si,trimNonEmpty:ce,withTreeMetadata:mr};(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]="59842825-3a81-53f4-845d-db2257ec6286")}catch{}})();async function ow(e){let t=R(process.cwd(),e);await ne(t);let r=await v(t),n=A(r,P());return{pmRoot:t,settings:r,typeRegistry:n}}async function mi(e,t,r,n){me(e,Ne(t));let o=await ye(e,t,r.id_prefix,r.item_format,n);if(o)return{id:o.id,historyPath:me(e,o.id),located:o};let i=re(t,r.id_prefix),s=Ne(t),a=i===s?[i]:[i,s];for(let c of a){let l=me(e,c);if(await U(l))return{id:c,historyPath:l,located:null}}throw new f(`Item ${t} not found`,m.NOT_FOUND)}(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]="eb2e6046-156c-56ee-a03a-ecaa1cccfb45")}catch{}})();function vw(e,t){let r=Et(e),n=e.length>0?e[e.length-1].after_hash:wt(),o=t===void 0||r.item_hash_version===void 0?void 0:Nr(t,r.item_hash_version,Mr(e.at(-1)?.hash_algorithm)),i=t===void 0?void 0:o===void 0?ht(t):o[Math.max(0,o.indexOf(n))],s=i===void 0?void 0:i===n,a=[...r.errors];return s===!1&&a.push("verify_failed:current_item_hash_mismatch"),{ok:a.length===0,entries:e.length,errors:a,latest_after_hash:e.length>0?e[e.length-1].after_hash:void 0,current_item_hash:i,current_matches_latest:s}}async function Iw(e,t,r={}){let n=R(r.cwd??process.cwd(),r.pmRoot);await ne(n);let o=await v(n),i=A(o,P()),s=await mi(n,e,o,i.type_to_folder),a=await pe(s.historyPath,s.id);if(a.length===0)throw new f(`No history exists for ${s.id}; point-in-time reads are unavailable.`,m.NOT_FOUND);let c=Vr(t,a),l=Kr(jr(a,c.historyIndex),c),d=bt(l,{schema:o.schema});if(d.metadata.id!==s.id)throw new f(`History target resolved to item ${d.metadata.id}, expected ${s.id}.`,m.GENERIC_FAILURE);let u=a[c.historyIndex],p=zr(a,!0);return{document:d,reconstructed:!0,as_of_version:p===null?null:p+c.historyIndex+1,as_of_timestamp:u.ts,target:c,history_length:a.length}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e524f0ad-faad-5d89-b8f5-1283979919ad")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="67d97df8-6551-52ed-9307-8b573a087831")}catch{}})();var ot=1e6;function gr(e,t=ot,r=.8,n=!1){let o=new Set,i=(d,u)=>{if(o.add(`${d}:${u}`),o.size>t)throw new f(`Duplicate sweep exceeded ${t} candidate pairs; narrow it with statuses or since.`,m.CONFLICT,{code:"duplicate_sweep_cost_limit",required:"Narrow the duplicate query or increase its similarity threshold. No partial result was returned."})};if(n||r===0){for(let d=0;d<e.length;d+=1)for(let u=0;u<d;u+=1)i(u,d);return o}let s=new Map;for(let{prepared:d}of e)for(let u of d.tokens)s.set(u,(s.get(u)??0)+1);let a=new Map,c=new Map,l=new Map;for(let[d,{prepared:u}]of e.entries()){let p=[...u.tokens].sort((y,h)=>s.get(y)-s.get(h)||y.localeCompare(h)),_=p.length-Math.ceil(r*p.length-1e-12)+1,g=[{index:a,keys:[u.normalized],lengthFilter:!1},{index:c,keys:r<=.99?u.issueCodes:[],lengthFilter:!1},{index:l,keys:p.length===0?[""]:p.slice(0,_),lengthFilter:!0}];for(let y of g)od(e,d,y,r,i)}return o}function od(e,t,r,n,o){let i=e[t].prepared.tokens.length;for(let s of r.keys){let a=r.index.get(s)??[];for(let c of a){let l=e[c].prepared.tokens.length;r.lengthFilter&&Math.min(l,i)/Math.max(l,i)+1e-12<n||o(c,t)}a.push(t),r.index.set(s,a)}}(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]="a5f450bd-8970-5b1b-8250-b76b7818e6e1")}catch{}})();var id=3,fi=20,sd=.8,ad=100,pi=1e3;function Xw(e){return e===void 0?[]:[`likely_duplicates:${e.result.items.map(t=>t.id).join(",")}`,`likely_duplicate_recovery:${e.recovery.action}:${e.recovery.item_id}`]}async function cd(e,t){let r=e.items[0],n=R(t.cwd??process.cwd(),t.pmRoot),o=ee((await v(n)).schema);return q(r.status,o)?{action:"reopen",item_id:r.id,command:`pm item reopen ${r.id} "<recurrence reason>"`,args:["item","reopen",r.id,"<recurrence reason>"]}:{action:"reuse",item_id:r.id,command:`pm get ${r.id} --full`,args:["get",r.id,"--full"]}}function hr(e){let t=e.limit??id,r=e.threshold??sd;if(!Number.isSafeInteger(t)||t<0||t>fi)throw new f(`Similarity limit must be an integer from 0 to ${fi}.`,m.USAGE);if(!Number.isFinite(r)||r<0||r>1)throw new f("Similarity threshold must be a number from 0 to 1.",m.USAGE);return{limit:t,threshold:r}}function _i(e){let t=e.limit??ad;if(!Number.isSafeInteger(t)||t<0||t>pi)throw new f(`Duplicate cluster limit must be an integer from 0 to ${pi}.`,m.USAGE);let r=e.since===void 0?void 0:new Date(e.since);if(r&&Number.isNaN(r.getTime()))throw new f("Duplicate cluster --since must be a valid ISO timestamp.",m.USAGE);return{limit:t,since:r}}async function ld(e,t){let r=R(e.cwd??process.cwd(),e.pmRoot),n=await v(r),o=A(n),i=e.statuses?.map(u=>u.trim().toLowerCase()).filter(Boolean);if(e.statuses!==void 0&&i?.length===0)throw new f("Duplicate cluster statuses must include at least one lifecycle status or all.",m.USAGE);let s=ee(n.schema),a=i?.map(u=>{if(u==="all")return u;let p=fe(u,s);if(!p)throw new f(`Unknown duplicate-cluster status "${u}". Allowed: all, ${s.definitions.map(_=>_.id).join(", ")}.`,m.USAGE);return p}),c=a?.includes("all")===!0;if(c&&a?.some(u=>u!=="all"))throw new f('The "all" status cannot be combined with other statuses.',m.USAGE);let l=c?void 0:a,d=l?new Set(l):void 0;return{items:(await oe(r,n.item_format,o.type_to_folder,void 0,n.schema)).filter(u=>(!d||d.has(u.status))&&(!t||new Date(u.created_at).getTime()>=t.getTime())),statuses:l}}var Jw={buildDuplicateClusters:gi,collectDuplicateCandidatePairs:gr,createDuplicateUnionFind:yi};function yi(e){let t=Array.from({length:e},(r,n)=>n);return{parent:t,findRoot:r=>{let n=r;for(;t[n]!==n;)n=t[n];for(;t[r]!==r;){let o=t[r];t[r]=n,r=o}return n}}}function dd(e,t,r,n){let o=[];for(let i of t){let[s,a]=i.split(":").map(u=>Number.parseInt(u,10)),c=ze(e[s].prepared,e[a].prepared);if(c.score<r)continue;let l=n.findRoot(s),d=n.findRoot(a);l!==d&&(n.parent[d]=l),o.push({left_id:e[s].item.id,right_id:e[a].item.id,...c})}return o}function gi(e,t,r,n){let o=new Map;for(let a of e.keys()){let c=r.findRoot(a),l=o.get(c)??[];l.push(a),o.set(c,l)}let i=new Map(e.map(({item:a},c)=>[a.id,r.findRoot(c)])),s=new Map;for(let a of t){let c=i.get(a.left_id),l=s.get(c)??[];l.push(a),s.set(c,l)}return[...o.values()].filter(a=>a.length>1).map(a=>{let c=(s.get(r.findRoot(a[0]))??[]).sort((l,d)=>d.score-l.score||l.left_id.localeCompare(d.left_id)||l.right_id.localeCompare(d.right_id));return{id:e[a[0]].item.id,items:a.map(l=>{let d=e[l].item;return{id:d.id,title:d.title,status:d.status,type:d.type}}),matches:c,max_score:c[0]?.score??0}}).sort((a,c)=>c.max_score-a.max_score||a.id.localeCompare(c.id)).slice(0,n)}function ud(e,t,r,n,o){return t.filter(i=>!r.has(i.id)).map(i=>({id:i.id,title:i.title,status:i.status,type:i.type,...Ue(e,i.title)})).filter(i=>i.score>=n).sort((i,s)=>s.score-i.score||i.id.localeCompare(s.id)).slice(0,o)}async function md(e,t={}){let r=e.title.trim();if(r.length===0)throw new f("Similarity candidate title must not be empty.",m.USAGE);let{limit:n,threshold:o}=hr(t),i=R(t.cwd??process.cwd(),t.pmRoot),s=await v(i),a=A(s),c=await _e(i,Object.values(a.type_to_folder)),l=be(r),d=c&&l.length>0?await Tt({pmRoot:i,expectedSourceCursor:c.source_cursor,query:l.map(_=>`"${_.replaceAll('"','""')}"`).join(" OR "),limit:Math.max(n*10,50)}):null,u=d===null?await oe(i,s.item_format,a.type_to_folder,void 0,s.schema):d.items,p=ud(r,u,new Set(e.excludeIds??[]),o,n);return{items:p,count:p.length,threshold:o,source:d?"persistent_index":"metadata_fallback"}}function fd(e,t={}){let{threshold:r}=hr({...t,limit:void 0}),{limit:n}=_i(t),o=new Set;for(let d of e){if(!d.id.trim()||o.has(d.id))throw new f("Duplicate analysis requires unique non-empty item ids.",m.USAGE);o.add(d.id)}let i=[...e].sort((d,u)=>d.id.localeCompare(u.id)).map(d=>({item:d,prepared:we(d.title)})),s=gr(i,ot,r,t.exhaustive===!0),a=yi(i.length),c=dd(i,s,r,a),l=gi(i,c,a,n);return{clusters:l,count:l.length,threshold:r,cost:{item_count:i.length,algorithm:t.exhaustive===!0||r===0?"exhaustive":"prefix_exact",possible_pairs:i.length*(i.length-1)/2,pair_limit:ot,recall_guarantee:"exact",candidate_pairs:s.size,scored_pairs:s.size}}}async function Qw(e={}){hr({...e,limit:void 0});let{since:t}=_i(e),{items:r,statuses:n}=await ld(e,t);return{...fd(r,e),source:"metadata_scan",filters:{statuses:n??null,since:e.since??null}}}async function Zw(e,t){if(t.mode==="off")return;let r=await md(e,t);if(r.count===0)return;let n=await cd(r,t),o=t.mode==="strict"&&t.allowDuplicate===!0;if(t.mode==="strict"&&!o){let i=r.items.map(a=>`${a.id} (${a.status}): ${a.title}`).join("; "),s=n.action==="reopen"?"Reopen the canonical item":"Reuse the canonical item";throw new f(`Likely duplicate item(s) found: ${i}. ${s} or pass --allow-duplicate with explicit intent.`,m.CONFLICT,{code:"likely_duplicate",required:`${s}, or explicitly acknowledge the duplicate with --allow-duplicate.`,recovery:{suggested_flags:["--allow-duplicate"],suggested_retry:n.command,suggested_retry_args:n.args}})}return{mode:t.mode,bypassed:o,result:r,recovery: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]="f091d0c3-f2a7-5d76-8656-4aebe82e9798")}catch{}})();function tb(e,t){let r=t??{};return e.filter(n=>r[n.id]!==n.updated_at).map(n=>n.id).sort((n,o)=>n.localeCompare(o))}export{ts as a,os as b,ss as c,cs as d,ls as e,ou as f,ds as g,us as h,cu as i,mn as j,ms as k,fs as l,ps as m,_s as n,Es as o,vs as p,lu as q,Is as r,gn as s,Cs as t,Rs as u,du as v,ks as w,je as x,uu as y,Ke as z,xs as A,Ms as B,Ot as C,Os as D,Nt as E,Ns as F,Au as G,Ps as H,wn as I,$s as J,Us as K,js as L,Du as M,Hs as N,Pt as O,Xs as P,Xr as Q,$t as R,Ut as S,Be as T,wa as U,Ed as V,At as W,en as X,Ct as Y,Mi as Z,Di as _,vd as $,tn as aa,ie as ba,Rt as ca,Lt as da,Gt as ea,am as fa,Yt as ga,Je as ha,Mn as ia,Qe as ja,Wt as ka,Xt as la,Jt as ma,Qt as na,$n as oa,Un as pa,Rm as qa,et as ra,Ie as sa,qi as ta,sn as ua,Hi as va,Bi as wa,Gi as xa,Nd as ya,Pd as za,he as Aa,$e as Ba,be as Ca,we as Da,Ue as Ea,ze as Fa,an as Ga,Zi as Ha,ac as Ia,dc as Ja,mc as Ka,fc as La,vc as Ma,Xn as Na,Ae as Oa,Yf as Pa,nt as Qa,ho as Ra,rh as Sa,ar as Ta,Ce as Ua,wo as Va,bo as Wa,Io as Xa,dr as Ya,Co as Za,dh as _a,uh as $a,Lo as ab,xo as bb,fh as cb,Uo as db,fr as eb,No as fb,Fo as gb,xl as hb,Ko as ib,qo as jb,qh as kb,Hh as lb,ow as mb,mi as nb,vw as ob,Iw as pb,Xw as qb,Jw as rb,md as sb,fd as tb,Qw as ub,Zw as vb,tb as wb};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-Y5HXFDTZ.js.map
|