@unbrained/pm-cli 2026.9.1 → 2026.9.3
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 +27 -0
- package/dist/cli/after-command-context-usage.js +16 -3
- package/dist/cli-bundle/bundle-manifest.json +153 -153
- package/dist/cli-bundle/chunks/{chunk-6XIIGE7U.js → chunk-34HASX3S.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-AY324UJ5.js +9 -0
- package/dist/cli-bundle/chunks/{chunk-TAG4VC22.js → chunk-DKGP3QLE.js} +27 -27
- package/dist/cli-bundle/chunks/chunk-E5RBBCXO.js +230 -0
- package/dist/cli-bundle/chunks/{chunk-DTGWEL23.js → chunk-EDPIS7EB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-X4RCGLTX.js → chunk-IEHHE6GA.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-U45JXJCC.js → chunk-L7B7343B.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2MC2LCXZ.js → chunk-LENC656S.js} +41 -41
- package/dist/cli-bundle/chunks/chunk-LISESA7W.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-3WICXLVT.js → chunk-UPPM2FOZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Y7VOMSZT.js → chunk-Y4PJ6HPK.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-XYNX4ASQ.js → register-list-query-W2ZTOMKP.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-2MVLRS3J.js → register-mutation-RVND5NCG.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-WCIDXBU3.js → register-operations-TTROIVC4.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-KVNC5KPL.js → register-setup-D3ZFHY3L.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3ZBI35HU.js +176 -0
- package/dist/cli-bundle/focused-chunks/{chunk-SVXJYD6G.js → chunk-4HJFY4MB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4RRHC3S4.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-4WR46RMG.js +9 -0
- package/dist/cli-bundle/focused-chunks/chunk-5RFXUPN5.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-BWKHEIVF.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4O4CJAR6.js → chunk-D7KXFBXV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MKHG3T76.js → chunk-GHCZ3YFR.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-KB5OFSFD.js → chunk-GT7MXDLW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KBLZRU62.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-KZ2NB3ET.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-M5M6SVHS.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BEVHCEWG.js → chunk-OL5EH6I3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MEASX544.js → chunk-Q45NHPF2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y6JJIX6I.js → chunk-QKHCSUGJ.js} +48 -48
- package/dist/cli-bundle/focused-chunks/chunk-S27XMBIN.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-TXE4TSHM.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-UCLO3XDU.js +2 -0
- package/dist/cli-bundle/main.js +15 -15
- 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 +28 -28
- 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 +35 -33
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +9 -9
- package/dist/core/diagnostics/remediation.js +9 -4
- package/dist/core/history/event-classification.d.ts +21 -0
- package/dist/core/history/event-classification.js +109 -0
- package/dist/core/history/event-index.d.ts +14 -3
- package/dist/core/history/event-index.js +543 -88
- package/dist/core/history/history.js +47 -18
- package/dist/core/history/workspace-history.js +7 -6
- package/dist/core/lock/lock.d.ts +22 -2
- package/dist/core/lock/lock.js +121 -19
- package/dist/core/output/output.js +31 -7
- package/dist/core/shared/time.d.ts +2 -0
- package/dist/core/shared/time.js +8 -2
- package/dist/core/store/item-metadata-query-index.js +5 -5
- package/dist/sdk/context/recency.d.ts +9 -0
- package/dist/sdk/context/recency.js +34 -0
- package/dist/sdk/context/usage-egress.d.ts +9 -0
- package/dist/sdk/context/usage-egress.js +30 -0
- package/dist/sdk/context-intent-contracts.js +7 -3
- package/dist/sdk/context-relevance.d.ts +23 -0
- package/dist/sdk/context-relevance.js +94 -23
- package/dist/sdk/context-signal-store.d.ts +7 -3
- package/dist/sdk/context-signal-store.js +155 -42
- package/dist/sdk/context-usage.d.ts +54 -0
- package/dist/sdk/context-usage.js +245 -16
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -14
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +14 -2
- package/dist/sdk/governance/health.js +77 -11
- package/dist/sdk/governance/validate.js +4 -2
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +4 -2
- package/dist/sdk/init.d.ts +2 -0
- package/dist/sdk/init.js +18 -9
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +2 -2
- package/dist/sdk/merge/receipts.d.ts +24 -0
- package/dist/sdk/merge/receipts.js +122 -30
- package/dist/sdk/query/context.d.ts +3 -1
- package/dist/sdk/query/context.js +21 -9
- package/dist/sdk/query/next.js +18 -9
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +25 -2
- package/dist/sdk/runtime.d.ts +1 -0
- package/dist/sdk/runtime.js +17 -26
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -2
- package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +11 -2
- package/docs/CONTEXT_RELEVANCE.md +44 -1
- package/docs/MERGE_SAFETY.md +16 -2
- package/docs/PERFORMANCE.md +6 -3
- package/docs/READ_OUTPUT_CONTRACTS.md +9 -1
- package/docs/SDK.md +11 -8
- package/docs/SDK_CONTEXT.md +7 -0
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +5 -3
- package/marketplace.json +2 -2
- package/package.json +4 -4
- 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-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +268 -28
- package/dist/cli-bundle/chunks/chunk-ALKKAUFN.js +0 -35
- package/dist/cli-bundle/chunks/chunk-GOACULJW.js +0 -13
- package/dist/cli-bundle/chunks/chunk-NOPL37X4.js +0 -205
- package/dist/cli-bundle/focused-chunks/chunk-2FEZ5SKM.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-6GCRSLPG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7VATS5QY.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-FWPLDEXF.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JEFKLWMM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PF3E6Q36.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-QDFJIRKN.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-RMRCQPWU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-S4U5CN5Q.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-T2LXXSOD.js +0 -158
- package/dist/cli-bundle/focused-chunks/chunk-Z2USIBR2.js +0 -5
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{F as w,G as m,La as c}from"./chunk-QDFJIRKN.js";import{l as d}from"./chunk-Z2USIBR2.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]="989b570c-112e-5ee3-8731-ab34f215ba45")}catch{}})();var x=new Map(d.map(e=>[e.toLowerCase(),e])),$=/^[A-Za-z][A-Za-z0-9_-]*$/;function g(e,t){if(!$.test(e))throw new Error(`${t} "${e}" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. "Spike" or "code-review").`)}function y(e){return x.get(e.trim().toLowerCase())}function T(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function I(e){return e.replace(/[\\"`$]/g,t=>`\\${t}`)}function b(e){let t=new Map;for(let o of e){let n=o.trim();if(n.length===0)continue;let i=n.toLowerCase();t.has(i)||t.set(i,n)}return[...t.values()].sort((o,n)=>o.localeCompare(n))}function k(e){let t=(e.name??"").trim();if(t.length===0)throw new Error("Type name must not be empty.");g(t,"Type name");let o=y(t);if(o)throw new Error(`Cannot redefine built-in item type "${o}". Built-in types are reserved: ${d.join(", ")}.`);let n=e.description?.trim(),i=e.defaultStatus?.trim(),a=e.folder?.trim(),r=a&&a.length>0?m(a):void 0,s=b(e.aliases??[]);for(let l of s){g(l,"Alias");let f=y(l);if(f)throw new Error(`Alias "${l}" collides with built-in item type "${f}". Built-in types are reserved: ${d.join(", ")}.`)}return{name:t,description:n&&n.length>0?n:void 0,defaultStatus:i&&i.length>0?i:void 0,folder:r,aliases:s}}function S(e,t){let o=e.name.toLowerCase(),n=new Map;for(let a of t.definitions){if(typeof a.name!="string")continue;let r=a.name.trim();if(!(r.length===0||r.toLowerCase()===o)){n.set(r.toLowerCase(),r);for(let s of T(a.aliases))s.trim().length>0&&n.set(s.trim().toLowerCase(),r)}}let i=n.get(o);if(i)throw new Error(`Type name "${e.name}" collides with an alias of existing item type "${i}".`);for(let a of e.aliases){let r=n.get(a.toLowerCase());if(r)throw new Error(`Alias "${a}" already maps to existing item type "${r}".`)}}function h(e,t){return typeof t=="string"&&t.trim().length>0?m(t).toLowerCase():w(e).toLowerCase()}function D(e,t,o){let n=e.name.toLowerCase(),i=h(e.name,e.folder),a=s=>{throw new Error(`Item type "${e.name}" would store items in folder "${i}", which already belongs to existing item type "${s}". Pass a distinct --folder to keep their storage separate.`)};for(let s of t.definitions){if(typeof s.name!="string")continue;let l=s.name.trim();l.length===0||l.toLowerCase()===n||h(l,s.folder)===i&&a(l)}let r=o?.get(i);r!==void 0&&r.toLowerCase()!==n&&a(r)}function j(e){if(e==null||e.trim().length===0)return{definitions:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/types.json contains invalid JSON.")}return{definitions:L(t)}}function L(e){let t=C(e);if(!t)return[];let o=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=n;typeof i.name!="string"||i.name.trim().length===0||o.push(i)}return o}function C(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let o=t.item_types;if(Array.isArray(o.definitions))return o.definitions}}function F(e,t){let o=t.name.toLowerCase(),n=e.definitions.slice(),i=n.findIndex(l=>typeof l.name=="string"&&l.name.trim().toLowerCase()===o),a=i>=0?n[i]:void 0,r=b([...T(a?.aliases),...t.aliases]),s={...a,name:t.name};return t.folder!==void 0&&(s.folder=t.folder),r.length>0?s.aliases=r:s.aliases!==void 0&&delete s.aliases,A(s,"description",t.description),A(s,"default_status",t.defaultStatus),i>=0?n[i]=s:n.push(s),n.sort((l,f)=>l.name.localeCompare(f.name)),{file:{definitions:n},definition:s,replaced:i>=0,...a&&typeof a.name=="string"?{previousName:a.name}:{}}}function M(e,t){let o=(t??"").trim();if(o.length===0)throw new Error("Type name must not be empty.");let n=y(o);if(n)throw new Error(`Cannot remove built-in item type "${n}". Built-in types are reserved: ${d.join(", ")}.`);let i=o.toLowerCase(),a=e.definitions.slice(),r=a.findIndex(l=>typeof l.name=="string"&&l.name.trim().toLowerCase()===i);if(r<0)return{file:{definitions:a},removed:!1};let[s]=a.splice(r,1);return{file:{definitions:a},removed:!0,definition:s}}function A(e,t,o){let n=e;o!==void 0&&(n[t]=o)}function z(e){return`${JSON.stringify({definitions:e.definitions},null,2)}
|
|
2
|
-
`}function v(e,t){let o=e.trim().length>0?e.trim():e,n=t?.trim()||".agents/pm/schema/types.json";return`To register a custom type, run: pm schema add-type "${I(o)}" (writes ${n}).`}function O(e,t,o){return`Invalid type value "${e}". Allowed: ${t.join(", ")}. ${v(e,o)}`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c4e316a0-823d-5722-9e15-6d741ae44f1b")}catch{}})();function _(e){return typeof e=="string"?e.trim().toLowerCase():""}function u(e,t){let o=c(e);return o.length===0?"":t?.alias_to_id?.get(o)??o}function P(e){let t=Array.isArray(e?.type_workflows)?e.type_workflows:[],o=new Map;for(let n of t){let i=_(n?.type);if(i.length===0||!Array.isArray(n?.allowed_transitions))continue;let a=n.allowed_transitions,r=o.get(i)??{pairs:[],denyAll:!1};a.length===0&&(r.denyAll=!0);for(let s of a){if(!Array.isArray(s)||s.length!==2)continue;let l=c(s[0]),f=c(s[1]);l.length===0||f.length===0||r.pairs.some(p=>p[0]===l&&p[1]===f)||r.pairs.push([l,f])}o.set(i,r)}return[...o.entries()].filter(([,n])=>n.pairs.length>0||n.denyAll).map(([n,i])=>({type:n,allowed_transitions:i.pairs})).sort((n,i)=>n.type.localeCompare(i.type))}function U(e){let t=_(e.typeName),o=e.typeWorkflows.find(r=>r.type===t);if(!o)return{allowed:!0,hasRule:!1,allowedTransitions:[]};let n=u(e.fromStatus,e.statusRegistry),i=u(e.toStatus,e.statusRegistry);return n.length>0&&n===i?{allowed:!0,hasRule:!0,allowedTransitions:o.allowed_transitions}:{allowed:o.allowed_transitions.some(r=>{let s=u(r[0],e.statusRegistry),l=u(r[1],e.statusRegistry);return s===n&&l===i}),hasRule:!0,allowedTransitions:o.allowed_transitions}}function J(e){return e.length===0?"(no transitions allowed)":e.map(t=>`${t[0]} -> ${t[1]}`).join(", ")}export{y as a,I as b,k as c,S as d,D as e,j as f,F as g,M as h,z as i,O as j,P as k,U as l,J as m};
|
|
3
|
-
//# sourceMappingURL=chunk-2FEZ5SKM.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Ua as E,Y as w,Z as b,cb as $,ub as D,vb as B}from"./chunk-Z2USIBR2.js";import{AsyncLocalStorage as me}from"node:async_hooks";(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]="288a7da9-888b-527d-88fb-4711917cec5b")}catch{}})();var H=e=>{let t='"',n=0;for(let o of e){if(o==="\\"){n+=1;continue}t+="\\".repeat(o==='"'?n*2+1:n),t+=o,n=0}return`${t}${"\\".repeat(n*2)}"`},Z=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?H(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,A=(e,t=process.platform)=>{let n=e.map(o=>Z(o,t)).join(" ");return n.length>0?`pm ${n}`:"pm"};(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]="8ffd2cd5-8b7e-5ae1-a0c6-aab488edb73c")}catch{}})();var q=new WeakMap;function Le(e,t){q.set(e,new Set(t))}var M='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',Q={context:{row_keys:["high_level","low_level"],fields:"supported"},get:{row_keys:["children"],fields:"supported"},list:{row_keys:["items"],fields:"supported"},next:{row_keys:["recommended","ready","decision_needed","blocked","held_by_others"],fields:"unsupported"},search:{row_keys:["items"],fields:"supported"},activity:{row_keys:["activity_digest","compact_activity","provenance_activity","activity"],fields:"unsupported"},history:{row_keys:["compact_history","provenance_history","history"],fields:"unsupported"},deps:{row_keys:["graph.nodes","graph.edges","context.nodes","context.edges"],fields:"unsupported"},health:{row_keys:["checks"],fields:"unsupported"},aggregate:{row_keys:["groups"],fields:"unsupported"},duplicates:{row_keys:["clusters"],fields:"unsupported"},stats:{row_keys:["by_type","by_status"],fields:"unsupported"},comments:{row_keys:["comments"],fields:"unsupported"},notes:{row_keys:["notes"],fields:"unsupported"},learnings:{row_keys:["learnings"],fields:"unsupported"},files:{row_keys:["files"],fields:"unsupported"},docs:{row_keys:["docs"],fields:"unsupported"},validate:{row_keys:["checks","warnings"],fields:"unsupported"},contracts:{row_keys:["command_summaries","commands"],fields:"unsupported"}},V=[{command:"activity",complete_mode:"full",omissions_by_mode:{digest:[{name:"event_rows",restore_with:"--raw"}],compact:[{name:"provenance",restore_with:"--full"}],provenance:[{name:"patch_and_hashes",restore_with:"--full"}]}},{command:"history",complete_mode:"full",omissions_by_mode:{compact:[{name:"raw_history",restore_with:"--full"}],provenance:[{name:"patch_and_hashes",restore_with:"--full"}]}}];function Pe(e,t,n){if(e&&t)throw new b(`${n} cannot be combined with --full`,w.USAGE)}function m(e,t=new Set){let n=e.filter(o=>!t.has(o.name)).map(o=>({...o}));return{has_omissions:n.length>0,omitted_field_group_count:n.length,omitted_field_groups:n}}function qe(e,t){let n=V.find(i=>i.command===e);if(n===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===n.complete_mode)return m([]);let o=n.omissions_by_mode[t];if(o===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return m(o)}var ee=[{name:"hierarchy",restore_with:"--depth standard"},{name:"activity",restore_with:"--depth standard"},{name:"progress",restore_with:"--depth standard"},{name:"blockers",restore_with:"--depth standard"},{name:"recently_created",restore_with:"--depth standard"},{name:"unparented",restore_with:"--depth standard"},{name:"files",restore_with:"--depth deep"},{name:"workload",restore_with:"--depth standard"},{name:"staleness",restore_with:"--depth deep"},{name:"tests",restore_with:"--depth deep"},{name:"workspace_memory",restore_with:"--depth deep"}];function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var te=new Set([void 0,"tabular_when_uniform"]),ne=new Set(["collection","none"]),oe=new Set(["supported","unsupported"]);function L(e,t){return Array.isArray(e)&&(t||e.length>0)&&e.every(n=>typeof n=="string"&&n.length>0)&&new Set(e).size===e.length}function ie(e){return _(e)&&typeof e.command=="string"&&e.command.trim().length>0&&ne.has(e.row_kind)&&L(e.row_keys,!0)&&(e.continuation_row_keys===void 0||L(e.continuation_row_keys,!1))&&oe.has(e.fields)&&te.has(e.toon_encoding)&&(e.row_kind==="collection"?e.row_keys.length>0&&typeof e.jq_selector=="string"&&e.jq_selector.trim().length>0:e.row_keys.length===0&&e.jq_selector===void 0)}var re={ancestors:["ids"],descendants:["ids"],predecessors:["ids"],successors:["ids"],paths:["paths"],impact:["affected"],audit:["findings"],communities:["communities"],redundancy:["redundant"],dominators:["bottlenecks"],slack:["rows"],centrality:["rows"],articulation:["articulation_points","bridges"],plan:["steps"]},se={context:["sections_included","high_level","low_level"],get:["item"],list:["items","projection"],next:["recommended","ready","decision_needed","blocked","held_by_others"],search:["items","projection"],activity:["activity_digest","compact_activity","provenance_activity","activity"],history:["compact_history","provenance_history","history"],deps:["tree","graph","projection"],health:["checks"],aggregate:["groups"],duplicates:["clusters"],stats:["totals","by_type","by_status"],comments:["comments"],notes:["notes"],learnings:["learnings"],files:["files"],docs:["docs"],validate:["checks","warnings"],contracts:["command_summaries","commands","selected"]};function de(e,t){let n=e.trim().toLowerCase().split(/\s+/u,1)[0],o=n?.startsWith("list-")?"list":n;if(o==="graph"){let s=typeof t.subcommand=="string"?t.subcommand:"";if(s.length===0)return;let d=re[s];if(d===void 0)return;let c=d.filter(u=>Array.isArray(t[u])||_(t[u]));return{command:"graph",row_kind:c.length>0?"collection":"none",row_keys:c,fields:"unsupported",...c.length>0?{jq_selector:M}:{},toon_encoding:"tabular_when_uniform"}}let i=Q[o],r=se[o];return i===void 0||r===void 0||!r.some(s=>Object.hasOwn(t,s))?void 0:(()=>{let s=i.row_keys.filter(d=>{let c=d.split(".").reduce((u,f)=>_(u)?u[f]:void 0,t);return Array.isArray(c)||_(c)});return{command:o,row_kind:s.length>0?"collection":"none",row_keys:s,fields:i.fields,...s.length>0?{jq_selector:M}:{},toon_encoding:"tabular_when_uniform"}})()}function ce(e){if(!_(e.projection)||typeof e.projection.mode!="string"||e.projection.mode.trim().length===0)return;let t=e.projection.declared_field_groups,n=e.projection.included_field_groups;if(!Array.isArray(t)||!Array.isArray(n))return;let o=t.filter(s=>_(s)&&typeof s.name=="string"&&s.name.trim().length>0&&typeof s.restore_with=="string"&&s.restore_with.trim().length>0),i=n.filter(s=>typeof s=="string");if(o.length!==t.length||i.length!==n.length)return;let r=new Set(o.map(s=>s.name));if(!(r.size!==o.length||new Set(i).size!==i.length||i.some(s=>!r.has(s))))return m(o,new Set(i))}function ae(e){if(Array.isArray(e.sections_included))return m(ee,new Set(e.sections_included.filter(t=>typeof t=="string")))}function ue(e){if(!_(e.item))return;let t=e.item,n=["comments","notes","learnings","files","tests","docs","reminders","events"],o=["body","children","claim_state","linked","schedule"],i=q.get(e),r=d=>n.includes(d)||d==="body"?t:e,s=["body",...n,...o.slice(1)].filter(d=>i===void 0||i.has(d)||Object.hasOwn(r(d),d)).map(d=>({name:d,restore_with:`--fields ${d}`}));return m(s,new Set(s.flatMap(({name:d})=>Object.hasOwn(r(d),d)?[d]:[])))}function P(e){if(_(e.projection))return m([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function fe(e){if(!_(e.projection))return m([]);if(typeof e.projection.mode=="string")return m([{name:"full_check_details",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_check_details"]:[]))}function le(e){if(!(!_(e.selected)||typeof e.selected.summary!="boolean"))return m([{name:"full_contract_catalog",restore_with:"--full"}],new Set(e.selected.summary?[]:["full_contract_catalog"]))}function _e(e,t){let n=ce(t);if(n!==void 0)return n;let[o]=e.split(/\s+/u,1);if(o==="context")return ae(t);if(o==="get")return ue(t);if(o==="list"||o.startsWith("list-"))return P(t);if(o==="search")return P(t)??m([{name:"projection_metadata",restore_with:"--full"}]);if(o==="health")return fe(t);if(o==="contracts")return le(t)}function G(e,t){if(e===void 0||!_(t))return t;let n=_e(e,t),o=t.row_contract,i=ie(o)?o:de(e,t),r=i!==void 0?{...t,row_contract:i}:Object.hasOwn(t,"row_contract")?Object.fromEntries(Object.entries(t).filter(([s])=>s!=="row_contract")):t;return _(r.omission_receipt)||n===void 0?r:{...r,omission_receipt: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]="da15ca02-02cc-5886-8c82-610939b8581c")}catch{}})();var z=Object.freeze([{command:"context",intent:"orient",description:"Bounded active hierarchy, ownership, blockers, and recent progress.",included_field_groups:["summary","focus","hierarchy","blockers","activity"],token_budget:3e3,source:"core"},{command:"context",intent:"handoff",description:"Active ownership, evidence, decisions, and immediate continuation context.",included_field_groups:["summary","focus","in_progress","decisions","activity"],token_budget:2200,source:"core"},{command:"get",intent:"inspect",description:"Standard-depth item metadata, relationships, evidence, and lifecycle state.",included_field_groups:["item","children","claim_state","linked"],token_budget:3200,source:"core"},{command:"list",intent:"triage",description:"A budget-derived page of compact governance, ownership, priority, and blocker rows for triage.",included_field_groups:["identity","governance","ownership","dependencies"],token_budget:3200,source:"core"},{command:"next",intent:"execute",description:"The highest-ranked actionable work with concise ranking evidence.",included_field_groups:["recommended"],token_budget:1200,source:"core"},{command:"search",intent:"discover",description:"A budget-derived page of ranked canonical lineage candidates with compact match evidence.",included_field_groups:["identity","status","lineage","match"],token_budget:1800,source:"core"}]),W=new me;function pe(){return W.getStore()??z}function Je(e,t){return W.run(he(e.workspaceContracts,e.packageContracts),t)}function ge(e,t){let n=e.command.trim().toLowerCase(),o=e.intent.trim().toLowerCase(),i=`${n}:${o}`;if(!/^[a-z0-9][a-z0-9-]*$/.test(n)||!/^[a-z0-9][a-z0-9-]*$/.test(o))throw new TypeError(`Invalid context intent command or name: ${i}`);if(e.description.trim().length===0)throw new TypeError(`Context intent ${i} requires a non-empty description`);if(!Number.isSafeInteger(e.token_budget)||e.token_budget<=0)throw new TypeError(`Context intent ${i} requires a positive integer token_budget`);let r=[...new Set(e.included_field_groups.map(s=>s.trim()).filter(Boolean))];if(r.length===0)throw new TypeError(`Context intent ${i} requires included_field_groups`);return{command:n,intent:o,description:e.description.trim(),included_field_groups:r,token_budget:e.token_budget,source:t}}function he(e=[],t=[]){let n=[{source:"core",contracts:z,allowOverride:!1},{source:"package",contracts:t,allowOverride:!1},{source:"workspace",contracts:e,allowOverride:!0}],o=new Map,i=new Set;for(let r of n){i.clear();for(let s of r.contracts){let d=ge(s,r.source),c=`${d.command}:${d.intent}`;if(i.has(c))throw new TypeError(`Duplicate context intent declaration: ${c}`);if(i.add(c),!r.allowOverride&&o.has(c))throw new TypeError(`Duplicate context intent declaration: ${c}`);o.set(c,d)}}return[...o.values()].sort((r,s)=>r.command.localeCompare(s.command)||r.intent.localeCompare(s.intent))}function j(e,t,n=pe(),o=[]){let i=e.trim().toLowerCase(),r=t.trim().toLowerCase(),s=n.find(a=>a.command===i&&a.intent===r);if(s)return{...s,source:s.source??"core"};let d=n.filter(a=>a.command===i).map(a=>a.intent);if(d.length===0)return;let c=d.map(a=>{let l=Array.from({length:r.length+1},(v,O)=>O);for(let v=1;v<=a.length;v+=1){let O=l[0];l[0]=v;for(let h=1;h<=r.length;h+=1){let Y=l[h];l[h]=Math.min(l[h]+1,l[h-1]+1,O+(a[v-1]===r[h-1]?0:1)),O=Y}}return{candidate:a,distance:l[r.length]}}).sort((a,l)=>a.distance-l.distance||a.candidate.localeCompare(l.candidate))[0].candidate,u=[i,...o,"--for",r],f=[i,...o,"--for",c],p=A(f);throw new b(`Unknown context intent "${r}" for ${i}. Did you mean "${c}"?`,w.USAGE,{code:"unknown_context_intent",reason:"unknown_intent",field:"for",flag:"--for",value:r,required:`Use a declared ${i} intent.`,why:"Intent names are command-local contracts and cannot be inferred from output section names.",nextSteps:[p],recovery:{recovery_mode:"compact",attempted_command:A(u),allowed_values:[...d].sort(),suggested_retry:p,suggested_retry_args:f}})}var K={context:(e,t,n)=>{e.depth===void 0&&(e.depth=t.intent==="handoff"?"deep":"standard"),e.section===void 0&&(e.section=t.intent==="handoff"?["activity","progress","blockers"]:["hierarchy","blockers","activity"]);let o=T(e.tokenBudget,t.token_budget),i=R("context",t.intent,o,n),r=y(e.limit),s=String(r===void 0?i:Math.min(r,i));(e.limit===void 0||r!==void 0)&&(e.limit=s),e.activityLimit===void 0&&(e.activityLimit=s)},get:e=>{e.depth===void 0&&e.fields===void 0&&(e.depth="standard")},list:(e,t,n)=>{e.brief===void 0&&e.compact===void 0&&e.full===void 0&&e.fields===void 0&&(e.fields="id,title,status,type,priority,parent,assignee,risk,blocked_by");let o=T(e.tokenBudget,t.token_budget),i=R("list",t.intent,o,n),r=y(e.limit);(e.limit===void 0||r!==void 0)&&(e.limit=String(r===void 0?i:Math.min(r,i)))},next:e=>{e.readyOnly===void 0&&(e.readyOnly=!0)},search:(e,t,n)=>{e.compact===void 0&&e.full===void 0&&e.fields===void 0&&(e.compact=!0);let o=T(e.tokenBudget,t.token_budget),i=R("search",t.intent,o,n),r=y(e.limit);(e.limit===void 0||r!==void 0)&&(e.limit=String(r===void 0?i:Math.min(r,i)))}};function Ye(e,t,n=[]){let o=t.tokenBudget??t.token_budget;if(typeof t.for!="string"){if(o!==void 0&&(e==="get"||e==="list"||e==="search"))throw new b("--token-budget requires a declared context intent selected with --for",w.USAGE,{code:"missing_required_option",field:"for",required:"Select a context intent with --for when setting --token-budget.",why:"A token-budget override has no projection contract to constrain without a selected intent.",nextSteps:["Retry with --for <intent> --token-budget <n>, or omit --token-budget."]});if(t.tokenBudget!==void 0||t.token_budget===void 0)return t;let d={...t,tokenBudget:o};return delete d.token_budget,d}let i=j(e,t.for,void 0,n),r=y(o)!==void 0,s={...t};return s.tokenBudget===void 0&&o!==void 0&&(s.tokenBudget=o),delete s.token_budget,s.tokenBudget===void 0&&(s.tokenBudget=String(i.token_budget)),K[e](s,i,r),s}var ye={context:"bounded_sections",get:"standard_item",list:"bounded_fields_and_rows",next:"bounded_ranked_rows",search:"bounded_ranked_rows"},C=256;function S(e){return Array.isArray(e)?e.map(S):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,S(n)])):typeof e=="string"&&e.length>240?`${e.slice(0,240)}\u2026`:e}function y(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function T(e,t){let n=y(e);if(n===void 0)return t;if(n<C)throw new b(`Context intent token budget must be at least ${C}`,w.USAGE,{code:"invalid_argument_value",reason:"below_minimum",field:"tokenBudget",required:`Use an integer token budget of at least ${C}.`,why:"Smaller ceilings cannot contain the minimum machine-readable intent receipt.",nextSteps:[`Retry with --token-budget ${C} or omit the override.`]});return n}function R(e,t,n,o){if(e==="get"||e==="next")return;let i=e==="context"&&t==="orient",r=e==="context"?i?1200:800:e==="list"?520:480,s=e==="context"?i?600:500:16,d=Math.max(e==="context"?1:2,Math.floor((n-r)/s));return o?d:Math.min(e==="context"?20:100,d)}function g(e,t){let n=t.estimated_tokens;for(;;){t.estimated_tokens=n;let o=Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4);if(o===n)return;n=o}}var U={context:["high_level","low_level","blocked_fallback","recently_created","unparented","hierarchy","activity","blockers"],get:["children"],list:["items"],next:["ready","decision_needed","blocked","held_by_others"],search:["items"]};function F(e){try{let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));return typeof t.fingerprint!="string"||!Number.isSafeInteger(t.after_index)?void 0:{fingerprint:t.fingerprint,after_index:t.after_index,...typeof t.snapshot=="string"?{snapshot:t.snapshot}:{}}}catch{return}}function we(e){if(e===null||typeof e!="object")return;if(typeof e.id=="string")return e.id;let t=e.item?.id;return typeof t=="string"?t:void 0}function be(e,t,n){let o=!1;for(;;){if(g(e,t),t.estimated_tokens<=t.token_budget||n.length<=1)return o;let i=Buffer.byteLength(JSON.stringify(n),"utf8"),r=(t.estimated_tokens-t.token_budget)*4;n.splice(-Math.min(n.length-1,Math.max(1,Math.ceil(r/Math.max(1,Math.ceil(i/n.length)))))),o=!0}}function ke(e,t,n){let o=e.items,i=typeof e.next_cursor=="string",r=i?e.next_cursor:n.after;if(!Array.isArray(o)||typeof r!="string")return!1;let s=F(r);if(s===void 0)return!1;let d=o.length,c=[...o],u=!1;for(;;){if(u=be(e,t,o)||u,!u)return!1;let f=we(o.at(-1));if(f===void 0)return o.splice(0,o.length,...c),g(e,t),!1;if(e.next_cursor=$(s.fingerprint,f,i?s.after_index-(d-o.length):s.after_index+o.length,s.snapshot),g(e,t),t.estimated_tokens<=t.token_budget||o.length<=1)break}return typeof e.count=="number"&&(e.count=o.length),typeof e.applied_limit=="number"&&(e.applied_limit=o.length),!0}function xe(e,t,n,o){if(e==="list"||e==="search")return ke(t,n,o);if(e!=="next"||typeof t.next_cursor=="string")return!1;let i=!1;for(;;){if(g(t,n),n.estimated_tokens<=n.token_budget)return i;let r=U[e].map(a=>({key:a,rows:Array.isArray(t[a])?t[a]:[]})).filter(({rows:a})=>a.length>0).sort((a,l)=>l.rows.length-a.rows.length||a.key.localeCompare(l.key))[0];if(r===void 0)return i;let s=U[e].reduce((a,l)=>a+(Array.isArray(t[l])?t[l].length:0),0);if(s<=1)return i;let d=Math.min(r.rows.length,s-1),c=Buffer.byteLength(JSON.stringify(r.rows),"utf8"),u=Math.max(1,Math.ceil(c/r.rows.length)),f=(n.estimated_tokens-n.token_budget)*4,p=Math.min(d,Math.max(1,Math.ceil(f/u)));r.rows.splice(-p,p),i=!0}}function ve(e,t,n){if(typeof t.for!="string")return n;let o=e.startsWith("list-")?"list":e;if(!(o in K))return n;let i=o,r=j(i,t.for),s=T(t.tokenBudget??t.token_budget,r.token_budget),d={command:i,intent:r.intent,source:r.source,included_field_groups:[...r.included_field_groups],token_budget:s,declared_token_budget:r.token_budget,token_budget_override:s-r.token_budget,estimated_tokens:0,within_budget:!0,degradation:ye[i],declaration_feasible:!0,result_omitted:!1},c={...n},u=R(i,r.intent,d.token_budget,y(t.tokenBudget??t.token_budget)!==void 0);if(u!==void 0){let p=y(t.limit),a=p!==void 0&&p<u;d.budget_derived_limit=u,d.binding_constraint=a?"explicit_limit":"token_budget",d.limit_reason=a?"The caller supplied a smaller row limit than the budget-derived ceiling.":"The selected intent token budget constrains the effective row ceiling.",c.budget_derived_limit=u}let f={...c,context_intent:d};return g(f,d),d.estimated_tokens>d.token_budget&&(d.degradation="recursive_budget_compaction",f={...S(c),context_intent:d},g(f,d)),d.estimated_tokens>d.token_budget&&xe(i,f,d,t)&&(d.degradation="budget_row_compaction",g(f,d)),d.declaration_feasible=d.estimated_tokens<=d.declared_token_budget,d.estimated_tokens>d.token_budget&&(d.degradation="budget_receipt_only",d.result_omitted=!0,d.within_budget=!1,f={budget_exceeded:{omitted_result:!0,reason:d.token_budget_override===0?"declared_budget_infeasible":"effective_budget_infeasible",restore_with:Ee(e,i,r.intent,d,c)},context_intent:d}),f}function Oe(e,t){if(typeof e.after!="string"||e.after.length===0)return t;let n=F(e.after)?.fingerprint??"opaque_cursor",o={...t};for(let i of["applied_limit","completeness","context_intent","count","filters","has_more","now","omission_receipt","projection","row_contract","sorting","total","truncated"])delete o[i];return o.continuation_contract={fingerprint:n,metadata:"reference",restore_with:"omit --after"},o}function I(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ee(e,t,n,o,i){let r=t==="get"&&I(i.item)&&typeof i.item.id=="string"?i.item.id:t==="search"&&typeof i.query=="string"?i.query:void 0,s=r===void 0?"":` '${r.replaceAll("'",`'"'"'`)}'`,d=t==="get"?"":` --limit ${o.budget_derived_limit??1}`;return`pm ${e}${s} --for ${n} --token-budget ${Math.ceil(o.estimated_tokens/100)*100}${d}`}function k(e,t){if(I(e))return typeof e[t]=="number"?e[t]:void 0}function Ce(e,t){let n=e;for(let o=0;o<8;o+=1){let i=k(n.context_intent,"estimated_tokens"),r=k(n.read_output,"estimated_tokens"),s=k(n.read_session,"spent_this_call_tokens");if(I(n.context_intent)&&g(n,n.context_intent),n=D(n,t),k(n.context_intent,"estimated_tokens")===i&&k(n.read_output,"estimated_tokens")===r&&k(n.read_session,"spent_this_call_tokens")===s)break}return n}function He(e,t,n){let o=G(e,n),i=typeof o=="object"&&o!==null&&!Array.isArray(o)?B(e??"",t,Oe(t,ve(e??"",t,o))):o;return t.outputRowContract===!0||t.output_row_contract===!0||typeof i!="object"||i===null||Array.isArray(i)||!Object.hasOwn(i,"row_contract")?i:Ce(Object.fromEntries(Object.entries(i).filter(([r])=>r!=="row_contract")),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]="02baf966-46eb-5e19-b7eb-2f9fe05bb263")}catch{}})();var x=["result_rows","envelope","diagnostics","hints"],Te=/^(?:items|results|rows|ready|blocked|recommended|decision_needed|children|dependencies|events|matches|commands|tools)$/u,Re=/^(?:diagnostics|errors?|warnings?|findings|violations|failures?)$/u,Ae=/^(?:hints?|suggestions?|next_steps?|recovery|remediation|examples?)$/u,Se=8;function N(e){return Buffer.byteLength(e,"utf8")}function X(e){return N(JSON.stringify(e)??"null")}function Ie(e,t){return Re.test(e)?"diagnostics":Ae.test(e)?"hints":Te.test(e)||Array.isArray(t)?"result_rows":"envelope"}function Ne(e){let t={result_rows:0,envelope:0,diagnostics:0,hints:0};if(typeof e!="object"||e===null||Array.isArray(e))return t[Array.isArray(e)?"result_rows":"envelope"]=X(e),t;for(let[n,o]of Object.entries(e))t[Ie(n,o)]+=X({[n]:o});return Object.values(t).every(n=>n===0)&&(t.envelope=1),t}function $e(e,t){let n=x.reduce((s,d)=>s+t[d],0),o=x.map(s=>({section:s,value:e*t[s]/n})),i={result_rows:0,envelope:0,diagnostics:0,hints:0};for(let s of o)i[s.section]=Math.floor(s.value);let r=e-x.reduce((s,d)=>s+i[d],0);for(let s of[...o].sort((d,c)=>c.value-Math.floor(c.value)-(d.value-Math.floor(d.value))||x.indexOf(d.section)-x.indexOf(c.section))){if(r===0)break;i[s.section]+=1,r-=1}return i}function J(e,t){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...e,token_accounting:t}:{result:e,token_accounting:t}}function Ve(e,t){let n=N(t(e)),o=$e(n,Ne(e)),i=Object.fromEntries(x.map(d=>[d,{bytes:o[d],estimated_tokens:E(o[d])}])),r={version:1,measurement_scope:"output_before_token_accounting",estimator:"ceil(utf8_bytes / 4)",total_bytes:n,total_estimated_tokens:E(n),sections:i,accounting_receipt_bytes:0,accounting_receipt_estimated_tokens:0,excluded_fields:["token_accounting"],section_allocation:"proportional_canonical_json"},s=J(e,r);for(let d=0;d<Se;d+=1){let c=N(t(s))-n;if(c===r.accounting_receipt_bytes)return s;r={...r,accounting_receipt_bytes:c,accounting_receipt_estimated_tokens:E(c)},s=J(e,r)}return s}export{Z as a,A as b,Le as c,Pe as d,qe as e,G as f,z as g,pe as h,Je as i,he as j,j as k,Ye as l,F as m,we as n,ve as o,He as p,Ve as q};
|
|
2
|
-
//# sourceMappingURL=chunk-6GCRSLPG.js.map
|