@unbrained/pm-cli 2026.8.9 → 2026.8.10

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.
Files changed (172) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +40 -0
  3. package/dist/cli/commander-usage.js +17 -12
  4. package/dist/cli/help-json-payload.js +51 -16
  5. package/dist/cli/main.js +7 -6
  6. package/dist/cli-bundle/bundle-manifest.json +165 -165
  7. package/dist/cli-bundle/chunks/chunk-2QYH4QMI.js +30 -0
  8. package/dist/cli-bundle/chunks/{chunk-YC3UF2IO.js → chunk-EBO7OUUE.js} +57 -57
  9. package/dist/cli-bundle/chunks/{chunk-GMX5YOI3.js → chunk-ETML5C6H.js} +48 -48
  10. package/dist/cli-bundle/chunks/chunk-JUDU4RO4.js +194 -0
  11. package/dist/cli-bundle/chunks/{chunk-PYO5GZU6.js → chunk-JZSNADRR.js} +5 -5
  12. package/dist/cli-bundle/chunks/{chunk-EF43KODO.js → chunk-MENWVGJW.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-5JO6R4BS.js → chunk-S4EITGLA.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-2DTCZXSD.js → chunk-TIGKWVLA.js} +9 -9
  15. package/dist/cli-bundle/chunks/{chunk-RJC7TPF4.js → chunk-TRWXF476.js} +2 -2
  16. package/dist/cli-bundle/chunks/chunk-TSLDTJLQ.js +2 -0
  17. package/dist/cli-bundle/chunks/{register-list-query-BUE7PTCU.js → register-list-query-OJ6ZXKV4.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-mutation-FC3XLVIK.js → register-mutation-DKI7QC7O.js} +2 -2
  19. package/dist/cli-bundle/chunks/register-operations-P5OGMT6I.js +2 -0
  20. package/dist/cli-bundle/chunks/{register-setup-UQDTNTLJ.js → register-setup-S3KT2LTH.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-6DO4YQWZ.js → chunk-2COZ67XT.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/chunk-2EXI2DKR.js +4 -0
  23. package/dist/cli-bundle/focused-chunks/{chunk-KNEHLPBF.js → chunk-34SX654S.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/chunk-36FTZ2NT.js +2 -0
  25. package/dist/cli-bundle/focused-chunks/chunk-3CQECMKR.js +16 -0
  26. package/dist/cli-bundle/focused-chunks/chunk-75774JWP.js +6 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-MRWVJ3ZG.js → chunk-7UN6BHHO.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/{chunk-VRXJSGIT.js → chunk-CHIBMEZR.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-DZGAHZZV.js +3 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-FF4MNAYB.js +153 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-ZG54B4XG.js → chunk-GHTN2ILR.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-I4YM2I7S.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-IMDTEN7K.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-IW43E4XL.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-3WVHTUAW.js → chunk-JMVA4HKR.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-C3GCHDSQ.js → chunk-KR5RVXLQ.js} +31 -31
  37. package/dist/cli-bundle/focused-chunks/chunk-KSNJG4KI.js +16 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-73FIJONU.js → chunk-M6RPIXKC.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-MXYSIQ56.js +18 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-RIIN5V4N.js +2 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-U46GQJNY.js → chunk-RKWSCYYN.js} +2 -2
  42. package/dist/cli-bundle/main.js +13 -13
  43. package/dist/cli-bundle/sdk-authoring.js +1 -1
  44. package/dist/cli-bundle/sdk-contracts.js +1 -1
  45. package/dist/cli-bundle/sdk-core.js +38 -38
  46. package/dist/cli-bundle/sdk-governance.js +1 -1
  47. package/dist/cli-bundle/sdk-graph.js +1 -1
  48. package/dist/cli-bundle/sdk-merge.js +1 -1
  49. package/dist/cli-bundle/sdk-query.js +1 -1
  50. package/dist/cli-bundle/sdk-runtime.js +1 -1
  51. package/dist/cli-bundle/sdk-testing.js +1 -1
  52. package/dist/cli-bundle/sdk.js +2 -2
  53. package/dist/core/diagnostics/remediation.js +9 -9
  54. package/dist/core/fs/fs-utils.d.ts +10 -0
  55. package/dist/core/fs/fs-utils.js +16 -4
  56. package/dist/core/item/item-format.js +3 -32
  57. package/dist/core/schema/fields-file.d.ts +1 -2
  58. package/dist/core/schema/fields-file.js +4 -11
  59. package/dist/core/schema/runtime-schema.js +3 -10
  60. package/dist/core/schema/status-defs-file.d.ts +1 -2
  61. package/dist/core/schema/status-defs-file.js +4 -32
  62. package/dist/core/schema/status-token.d.ts +2 -0
  63. package/dist/core/schema/status-token.js +32 -0
  64. package/dist/core/schema/type-workflows.d.ts +1 -2
  65. package/dist/core/schema/type-workflows.js +4 -11
  66. package/dist/core/shared/author.d.ts +1 -1
  67. package/dist/core/shared/author.js +21 -8
  68. package/dist/core/shared/errors.d.ts +4 -0
  69. package/dist/core/shared/errors.js +2 -2
  70. package/dist/core/shared/text-normalization.d.ts +1 -1
  71. package/dist/core/shared/text-normalization.js +2 -2
  72. package/dist/sdk/agent/command-recovery.d.ts +4 -0
  73. package/dist/sdk/agent/command-recovery.js +52 -0
  74. package/dist/sdk/agent/command-suggestions.d.ts +4 -0
  75. package/dist/sdk/agent/command-suggestions.js +67 -0
  76. package/dist/sdk/agent/create-option-policy.d.ts +12 -0
  77. package/dist/sdk/agent/create-option-policy.js +32 -0
  78. package/dist/sdk/agent/item-addressing.d.ts +19 -0
  79. package/dist/sdk/agent/item-addressing.js +208 -0
  80. package/dist/sdk/cli-bootstrap.d.ts +1 -1
  81. package/dist/sdk/cli-bootstrap.js +20 -5
  82. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -4
  83. package/dist/sdk/cli-contracts/flag-contracts.js +62 -21
  84. package/dist/sdk/cli-contracts/registration-helpers.js +10 -2
  85. package/dist/sdk/cli-contracts/runtime-contracts.js +5 -3
  86. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
  87. package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
  88. package/dist/sdk/cli-contracts/tool-parameter-tables.js +19 -4
  89. package/dist/sdk/cli-contracts/tool-schema.js +17 -4
  90. package/dist/sdk/context-intent-runtime.js +8 -5
  91. package/dist/sdk/context-signal-store.d.ts +34 -0
  92. package/dist/sdk/context-signal-store.js +24 -2
  93. package/dist/sdk/dependency-flag-validation.d.ts +15 -1
  94. package/dist/sdk/dependency-flag-validation.js +54 -2
  95. package/dist/sdk/generated-error-code-catalog.js +74 -2
  96. package/dist/sdk/governance/health.js +14 -7
  97. package/dist/sdk/governance/provenance-health.d.ts +13 -0
  98. package/dist/sdk/governance/provenance-health.js +63 -17
  99. package/dist/sdk/governance/validate-item-reader.d.ts +13 -0
  100. package/dist/sdk/governance/validate-item-reader.js +18 -0
  101. package/dist/sdk/governance/validate.d.ts +2 -2
  102. package/dist/sdk/governance/validate.js +15 -6
  103. package/dist/sdk/index.d.ts +4 -0
  104. package/dist/sdk/index.js +6 -2
  105. package/dist/sdk/lifecycle/close.js +17 -14
  106. package/dist/sdk/lifecycle/create.d.ts +2 -0
  107. package/dist/sdk/lifecycle/create.js +62 -9
  108. package/dist/sdk/lifecycle/update-many.js +39 -27
  109. package/dist/sdk/lifecycle/update.d.ts +6 -1
  110. package/dist/sdk/lifecycle/update.js +47 -10
  111. package/dist/sdk/merge/index.d.ts +1 -1
  112. package/dist/sdk/merge/index.js +3 -3
  113. package/dist/sdk/merge/install.d.ts +4 -0
  114. package/dist/sdk/merge/install.js +28 -16
  115. package/dist/sdk/merge/receipts.d.ts +3 -0
  116. package/dist/sdk/merge/receipts.js +81 -17
  117. package/dist/sdk/output-projection.js +24 -4
  118. package/dist/sdk/query/context.d.ts +2 -0
  119. package/dist/sdk/query/context.js +7 -4
  120. package/dist/sdk/query/light-metadata.d.ts +3 -0
  121. package/dist/sdk/query/light-metadata.js +19 -0
  122. package/dist/sdk/runtime.d.ts +4 -1
  123. package/dist/sdk/runtime.js +8 -3
  124. package/dist/sdk/schema-migration.js +7 -9
  125. package/dist/sdk/similarity-scoring.d.ts +1 -2
  126. package/dist/sdk/similarity-scoring.js +4 -16
  127. package/dist/sdk/workspace-snapshot.d.ts +4 -0
  128. package/dist/sdk/workspace-snapshot.js +24 -11
  129. package/docs/AGENT_GUIDE.md +3 -1
  130. package/docs/COMMANDS.md +8 -5
  131. package/docs/MERGE_SAFETY.md +7 -5
  132. package/docs/README.md +2 -5
  133. package/docs/READ_OUTPUT_CONTRACTS.md +2 -2
  134. package/docs/SDK.md +33 -8
  135. package/docs/SDK_AGENT_SESSION_CONTEXT.md +3 -2
  136. package/docs/SDK_CONTEXT.md +97 -0
  137. package/docs/SDK_CONTEXT_INTEGRITY.md +18 -3
  138. package/docs/agent-task-token-baseline.json +2 -2
  139. package/marketplace.json +2 -2
  140. package/package.json +5 -4
  141. package/packages/pm-beads/package.json +1 -1
  142. package/packages/pm-calendar/package.json +1 -1
  143. package/packages/pm-command-kit/package.json +1 -1
  144. package/packages/pm-digital-twin/package.json +1 -1
  145. package/packages/pm-governance-audit/package.json +1 -1
  146. package/packages/pm-guide-shell/package.json +1 -1
  147. package/packages/pm-kanban/package.json +1 -1
  148. package/packages/pm-lifecycle-hooks/package.json +1 -1
  149. package/packages/pm-linked-test-adapters/package.json +1 -1
  150. package/packages/pm-search-advanced/package.json +1 -1
  151. package/packages/pm-templates/package.json +1 -1
  152. package/packages/pm-todos/package.json +1 -1
  153. package/packages/pm-vcs/package.json +1 -1
  154. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  155. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  156. package/sdk/public-surface.json +194 -26
  157. package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +0 -194
  158. package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +0 -28
  159. package/dist/cli-bundle/chunks/chunk-MHBVCUF2.js +0 -2
  160. package/dist/cli-bundle/chunks/register-operations-YH2WAOXU.js +0 -2
  161. package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +0 -153
  162. package/dist/cli-bundle/focused-chunks/chunk-3GSFUDAI.js +0 -2
  163. package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +0 -16
  164. package/dist/cli-bundle/focused-chunks/chunk-54TZJ4BM.js +0 -2
  165. package/dist/cli-bundle/focused-chunks/chunk-5NK5TJ5D.js +0 -2
  166. package/dist/cli-bundle/focused-chunks/chunk-JGRSQZJT.js +0 -18
  167. package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +0 -4
  168. package/dist/cli-bundle/focused-chunks/chunk-P6BBIQRG.js +0 -6
  169. package/dist/cli-bundle/focused-chunks/chunk-PZAGVQNN.js +0 -3
  170. package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +0 -14
  171. package/dist/cli-bundle/focused-chunks/chunk-T4IGQCSY.js +0 -2
  172. package/dist/cli-bundle/focused-chunks/chunk-XC2ZW3CJ.js +0 -2
@@ -1,2 +0,0 @@
1
- import{Ia as M,Y as g,Z as h,aa as R,ka as I}from"./chunk-ZG54B4XG.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]="23b3a820-f205-506b-9507-dbd60087f62e")}catch{}})();var X=["full","compact","brief","summary","counts"],qe=["mutation","read","discovery","governance"],Y=new Set(["append","claim","close","close-many","close-task","comments","config","copy","create","delete","docs","event","files","focus","history-author-acknowledge","history-compact","history-redact","history-repair","init","item","learnings","meet","notes","pause-task","release","remind","restore","schema","start-task","update","update-many"]),F=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),H=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),V={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},Z=3,ee=2;function te(e){let[t=""]=e.trim().split(/\s+/u);return Y.has(t)?"mutation":F.has(t)?"discovery":H.has(t)?"governance":"read"}function N(e,t=te(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let o=V[t];return ne({command:n,budget_class:t,default_max_estimated_tokens:o,default_max_estimated_tokens_by_format:{toon:o,json:Math.ceil(o*Z/ee)},degradation_ladder:X,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function ne(e){if(!Number.isSafeInteger(e.default_max_estimated_tokens)||e.default_max_estimated_tokens<=0)throw new RangeError("default_max_estimated_tokens must be a positive safe integer");for(let[t,n]of Object.entries(e.default_max_estimated_tokens_by_format))if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`default_max_estimated_tokens_by_format.${t} must be a positive safe integer`);return e}var oe=I.map(e=>N(e)),re=new Map(oe.map(e=>[e.command,e]));function ze(e,t={}){let n=e.trim().replace(/\s+/gu," "),[o]=n.split(" "),r=re.get(o);return r?{...r,command:n}:t.generateFallback?N(n):null}function k(e){return Math.ceil(Math.max(0,e)/4)}import{createHash as ie}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="83fe180b-9d95-5d19-9d3b-ba3821700e61")}catch{}})();var C=1,D=4096,se=/^[A-Za-z0-9_-]+$/;function B(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function Xe(e,t){let n=new Set;for(let o of t)if(o.cursor_semantics==="presentation"){n.add(B(o.flag));for(let r of o.aliases??[])n.add(B(r))}return Object.fromEntries(Object.entries(e).filter(([o])=>!n.has(o)))}function Ye(e,t){return ie("sha256").update(e).update("\0").update(R(t)).digest("hex").slice(0,24)}function O(e,t,n,o){return Buffer.from(JSON.stringify({version:C,fingerprint:e,after_id:t,...n===void 0?{}:{after_index:n},...o===void 0?{}:{snapshot:o}})).toString("base64url")}function w(e){return new h(e,g.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function ae(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===C&&typeof t.fingerprint=="string"&&typeof t.after_id=="string"&&t.after_id.length>0&&(t.after_index===void 0||Number.isSafeInteger(t.after_index)&&t.after_index>=0)&&(t.snapshot===void 0||typeof t.snapshot=="string"&&t.snapshot.length>0)}function E(e,t){if(typeof e!="string")throw w("Query cursor is malformed.");let n=e.trim();if(n.length===0||n.length>D||!se.test(n))throw w("Query cursor is malformed.");let o;try{o=JSON.parse(Buffer.from(n,"base64url").toString("utf8"))}catch{throw w("Query cursor is malformed.")}if(!ae(o))throw w("Query cursor version or payload is unsupported.");let r=o;if(r.fingerprint!==t)throw w(`Query cursor does not match the current filters, sort, or query (${r.fingerprint} != ${t}).`);return{after_id:r.after_id,...r.after_index===void 0?{}:{after_index:r.after_index},...r.snapshot===void 0?{}:{snapshot:r.snapshot}}}function Fe(e,t){return E(e,t).after_id}function de(e,t,n,o){if(t===void 0)return 0;let r=E(t,n),s=e.findIndex(i=>o(i)===r.after_id);if(s<0){if(r.after_index!==void 0)return Math.min(r.after_index,e.length);throw w(`Query cursor item ${r.after_id} is no longer present in this result set.`)}return s+1}function He(e,t){if(t.cursor!==void 0&&E(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw w("Query cursor does not match the requested snapshot.");let n=de(e,t.cursor,t.fingerprint,t.readId),o=e.slice(n,n+t.limit),r=o.length>0&&n+o.length<e.length,s=o.at(-1);return{rows:o,has_more:r,...r&&s!==void 0?{next_cursor:O(t.fingerprint,t.readId(s),n+o.length-1,t.snapshot)}:{}}}var Ve=Object.freeze({version:C,max_length:D});import{AsyncLocalStorage as xe}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]="4a108e0e-0dfc-55c4-9f14-7395cfbac456")}catch{}})();var P='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',ce={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:["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"}},ue=[{command:"activity",complete_mode:"full",omissions_by_mode:{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 nt(e,t,n){if(e&&t)throw new h(`${n} cannot be combined with --full`,g.USAGE)}function _(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 ot(e,t){let n=ue.find(r=>r.command===e);if(n===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===n.complete_mode)return _([]);let o=n.omissions_by_mode[t];if(o===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return _(o)}var fe=[{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 m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function le(e){return m(e)&&typeof e.command=="string"&&e.command.trim().length>0&&(e.row_kind==="collection"||e.row_kind==="none")&&Array.isArray(e.row_keys)&&e.row_keys.every(t=>typeof t=="string"&&t.length>0)&&new Set(e.row_keys).size===e.row_keys.length&&(e.fields==="supported"||e.fields==="unsupported")&&(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 me={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"]},_e={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:["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 pe(e,t){let n=e.trim().toLowerCase().split(/\s+/u,1)[0],o=n?.startsWith("list-")?"list":n;if(o==="graph"){let i=typeof t.subcommand=="string"?t.subcommand:"";if(i.length===0)return;let d=me[i];if(d===void 0)return;let a=d.filter(c=>Array.isArray(t[c])||m(t[c]));return{command:"graph",row_kind:a.length>0?"collection":"none",row_keys:a,fields:"unsupported",...a.length>0?{jq_selector:P}:{}}}let r=ce[o],s=_e[o];return r===void 0||s===void 0||!s.some(i=>Object.hasOwn(t,i))?void 0:(()=>{let i=r.row_keys.filter(d=>{let a=d.split(".").reduce((c,u)=>m(c)?c[u]:void 0,t);return Array.isArray(a)||m(a)});return{command:o,row_kind:i.length>0?"collection":"none",row_keys:i,fields:r.fields,...i.length>0?{jq_selector:P}:{}}})()}function ge(e){if(!m(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(i=>m(i)&&typeof i.name=="string"&&i.name.trim().length>0&&typeof i.restore_with=="string"&&i.restore_with.trim().length>0),r=n.filter(i=>typeof i=="string");if(o.length!==t.length||r.length!==n.length)return;let s=new Set(o.map(i=>i.name));if(!(s.size!==o.length||new Set(r).size!==r.length||r.some(i=>!s.has(i))))return _(o,new Set(r))}function he(e){if(Array.isArray(e.sections_included))return _(fe,new Set(e.sections_included.filter(t=>typeof t=="string")))}function ye(e){if(!m(e.item))return;let t=["children","claim_state","linked"].map(n=>({name:n,restore_with:`--fields ${n}`}));return _(t,new Set(t.flatMap(({name:n})=>e[n]===void 0?[]:[n])))}function U(e){if(m(e.projection))return _([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function we(e){if(!m(e.projection))return _([]);if(typeof e.projection.mode=="string")return _([{name:"full_check_details",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_check_details"]:[]))}function be(e){if(!(!m(e.selected)||typeof e.selected.summary!="boolean"))return _([{name:"full_contract_catalog",restore_with:"--full"}],new Set(e.selected.summary?[]:["full_contract_catalog"]))}function ke(e,t){let n=ge(t);if(n!==void 0)return n;let[o]=e.split(/\s+/u,1);if(o==="context")return he(t);if(o==="get")return ye(t);if(o==="list"||o.startsWith("list-"))return U(t);if(o==="search")return U(t)??_([{name:"projection_metadata",restore_with:"--full"}]);if(o==="health")return we(t);if(o==="contracts")return be(t)}function $(e,t){if(e===void 0||!m(t))return t;let n=t.row_contract,o=le(n)?n:pe(e,t),r=o!==void 0?{...t,row_contract:o}:Object.hasOwn(t,"row_contract")?Object.fromEntries(Object.entries(t).filter(([i])=>i!=="row_contract")):t;if(m(r.omission_receipt))return r;let s=ke(e,r);return s===void 0?r:{...r,omission_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]="e48a306e-debb-5e66-ae9b-68bf17fa405f")}catch{}})();var G=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:2400,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"}]),q=new xe;function Te(){return q.getStore()??G}function ft(e,t){return q.run(Oe(e.workspaceContracts,e.packageContracts),t)}function Ce(e,t){let n=e.command.trim().toLowerCase(),o=e.intent.trim().toLowerCase(),r=`${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: ${r}`);if(e.description.trim().length===0)throw new TypeError(`Context intent ${r} requires a non-empty description`);if(!Number.isSafeInteger(e.token_budget)||e.token_budget<=0)throw new TypeError(`Context intent ${r} requires a positive integer token_budget`);let s=[...new Set(e.included_field_groups.map(i=>i.trim()).filter(Boolean))];if(s.length===0)throw new TypeError(`Context intent ${r} requires included_field_groups`);return{command:n,intent:o,description:e.description.trim(),included_field_groups:s,token_budget:e.token_budget,source:t}}function Oe(e=[],t=[]){let n=[{source:"core",contracts:G,allowOverride:!1},{source:"package",contracts:t,allowOverride:!1},{source:"workspace",contracts:e,allowOverride:!0}],o=new Map,r=new Set;for(let s of n){r.clear();for(let i of s.contracts){let d=Ce(i,s.source),a=`${d.command}:${d.intent}`;if(r.has(a))throw new TypeError(`Duplicate context intent declaration: ${a}`);if(r.add(a),!s.allowOverride&&o.has(a))throw new TypeError(`Duplicate context intent declaration: ${a}`);o.set(a,d)}}return[...o.values()].sort((s,i)=>s.command.localeCompare(i.command)||s.intent.localeCompare(i.intent))}function z(e,t,n=Te()){let o=e.trim().toLowerCase(),r=t.trim().toLowerCase(),s=n.find(c=>c.command===o&&c.intent===r);if(s)return{...s,source:s.source??"core"};let i=n.filter(c=>c.command===o).map(c=>c.intent);if(i.length===0)return;let d=i.map(c=>{let u=Array.from({length:r.length+1},(p,f)=>f);for(let p=1;p<=c.length;p+=1){let f=u[0];u[0]=p;for(let l=1;l<=r.length;l+=1){let W=u[l];u[l]=Math.min(u[l]+1,u[l-1]+1,f+(c[p-1]===r[l-1]?0:1)),f=W}}return{candidate:c,distance:u[r.length]}}).sort((c,u)=>c.distance-u.distance||c.candidate.localeCompare(u.candidate))[0].candidate,a=`pm ${o} --for ${d}`;throw new h(`Unknown context intent "${r}" for ${o}. Did you mean "${d}"?`,g.USAGE,{code:"unknown_context_intent",reason:"unknown_intent",field:"for",required:`Use a declared ${o} intent.`,why:"Intent names are command-local contracts and cannot be inferred from output section names.",nextSteps:[a],recovery:{recovery_mode:"compact",attempted_command:`pm ${o} --for ${r}`,suggested_retry:a}})}var Q={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),r=Math.max(1,Math.floor((o-800)/500)),s=String(n?r:Math.min(20,r));e.limit===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)=>{if(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"),e.limit===void 0){let o=T(e.tokenBudget,t.token_budget),r=Math.max(2,Math.floor((o-520)/16));e.limit=String(n?r:Math.min(100,r))}},next:e=>{e.readyOnly===void 0&&(e.readyOnly=!0)},search:(e,t,n)=>{if(e.compact===void 0&&e.full===void 0&&e.fields===void 0&&(e.compact=!0),e.limit===void 0){let o=T(e.tokenBudget,t.token_budget),r=Math.max(2,Math.floor((o-480)/16));e.limit=String(n?r:Math.min(100,r))}}};function lt(e,t){let n=t.tokenBudget??t.token_budget;if(typeof t.for!="string"){if(n!==void 0&&(e==="get"||e==="list"||e==="search"))throw new h("--token-budget requires a declared context intent selected with --for",g.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 i={...t,tokenBudget:n};return delete i.token_budget,i}let o=z(e,t.for),r=v(n)!==void 0,s={...t};return s.tokenBudget===void 0&&n!==void 0&&(s.tokenBudget=n),delete s.token_budget,s.tokenBudget===void 0&&(s.tokenBudget=String(o.token_budget)),Q[e](s,o,r),s}var Ee={context:"bounded_sections",get:"standard_item",list:"bounded_fields_and_rows",next:"bounded_ranked_rows",search:"bounded_ranked_rows"},x=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 v(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=v(e);if(n===void 0)return t;if(n<x)throw new h(`Context intent token budget must be at least ${x}`,g.USAGE,{code:"invalid_argument_value",reason:"below_minimum",field:"tokenBudget",required:`Use an integer token budget of at least ${x}.`,why:"Smaller ceilings cannot contain the minimum machine-readable intent receipt.",nextSteps:[`Retry with --token-budget ${x} or omit the override.`]});return n}function y(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 L={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 K(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 Se(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 ve(e,t,n){let o=!1;for(;;){if(y(e,t),t.estimated_tokens<=t.token_budget||n.length<=1)return o;let r=Buffer.byteLength(JSON.stringify(n),"utf8"),s=(t.estimated_tokens-t.token_budget)*4;n.splice(-Math.min(n.length-1,Math.max(1,Math.ceil(s/Math.max(1,Math.ceil(r/n.length)))))),o=!0}}function Ae(e,t,n){let o=e.items,r=typeof e.next_cursor=="string",s=r?e.next_cursor:n.after;if(!Array.isArray(o)||typeof s!="string")return!1;let i=K(s);if(i===void 0)return!1;let d=o.length,a=[...o],c=!1;for(;;){if(c=ve(e,t,o)||c,!c)return!1;let u=Se(o.at(-1));if(u===void 0)return o.splice(0,o.length,...a),y(e,t),!1;if(e.next_cursor=O(i.fingerprint,u,r?i.after_index-(d-o.length):i.after_index+o.length,i.snapshot),y(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 Re(e,t,n,o){if(e==="list"||e==="search")return Ae(t,n,o);if(e!=="next"||typeof t.next_cursor=="string")return!1;let r=!1;for(;;){if(y(t,n),n.estimated_tokens<=n.token_budget)return r;let s=L[e].map(f=>({key:f,rows:Array.isArray(t[f])?t[f]:[]})).filter(({rows:f})=>f.length>0).sort((f,l)=>l.rows.length-f.rows.length||f.key.localeCompare(l.key))[0];if(s===void 0)return r;let i=L[e].reduce((f,l)=>f+(Array.isArray(t[l])?t[l].length:0),0);if(i<=1)return r;let d=Math.min(s.rows.length,i-1),a=Buffer.byteLength(JSON.stringify(s.rows),"utf8"),c=Math.max(1,Math.ceil(a/s.rows.length)),u=(n.estimated_tokens-n.token_budget)*4,p=Math.min(d,Math.max(1,Math.ceil(u/c)));s.rows.splice(-p,p),r=!0}}function Ie(e,t,n){if(typeof t.for!="string")return n;let o=e.startsWith("list-")?"list":e;if(!(o in Q))return n;let r=o,s=z(r,t.for),i={command:r,intent:s.intent,source:s.source,included_field_groups:[...s.included_field_groups],token_budget:T(t.tokenBudget??t.token_budget,s.token_budget),estimated_tokens:0,within_budget:!0,degradation:Ee[r],declaration_feasible:!0,result_omitted:!1},d={...n};if(r==="list"||r==="search"){let c=r==="list"?520:480,u=Math.max(2,Math.floor((i.token_budget-c)/16)),f=v(t.tokenBudget??t.token_budget)!==void 0?u:Math.min(100,u),l=t.limit!==void 0;i.budget_derived_limit=f,i.binding_constraint=l?"explicit_limit":"token_budget",i.limit_reason=l?"The caller supplied an explicit row limit; the budget-derived limit remains diagnostic.":"The selected intent token budget determines the row ceiling.",d.budget_derived_limit=f}let a={...d,context_intent:i};return y(a,i),i.estimated_tokens>i.token_budget&&(i.degradation="recursive_budget_compaction",a={...S(d),context_intent:i},y(a,i)),i.estimated_tokens>i.token_budget&&Re(r,a,i,t)&&(i.degradation="budget_row_compaction",y(a,i)),i.estimated_tokens>i.token_budget&&(i.degradation="budget_receipt_only",i.declaration_feasible=!1,i.result_omitted=!0,i.within_budget=!1,a={budget_exceeded:{omitted_result:!0,reason:"declared_budget_infeasible",restore_with:"Increase --token-budget or narrow the request; the unprojected command may be larger."},context_intent:i},y(a,i)),a}function Me(e,t){if(typeof e.after!="string"||e.after.length===0)return t;let n=K(e.after)?.fingerprint??"opaque_cursor",o={...t};for(let r of["applied_limit","completeness","context_intent","count","filters","has_more","now","omission_receipt","projection","row_contract","sorting","total","truncated"])delete o[r];return o.continuation_contract={fingerprint:n,metadata:"reference",restore_with:"omit --after"},o}function mt(e,t,n){let o=$(e,n);return typeof o=="object"&&o!==null&&!Array.isArray(o)?M(e??"",t,Me(t,Ie(e??"",t,o))):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]="02baf966-46eb-5e19-b7eb-2f9fe05bb263")}catch{}})();var b=["result_rows","envelope","diagnostics","hints"],Ne=/^(?:items|results|rows|ready|blocked|recommended|decision_needed|children|dependencies|events|matches|commands|tools)$/u,Be=/^(?:diagnostics|errors?|warnings?|findings|violations|failures?)$/u,De=/^(?:hints?|suggestions?|next_steps?|recovery|remediation|examples?)$/u,Pe=8;function A(e){return Buffer.byteLength(e,"utf8")}function j(e){return A(JSON.stringify(e)??"null")}function Ue(e,t){return Be.test(e)?"diagnostics":De.test(e)?"hints":Ne.test(e)||Array.isArray(t)?"result_rows":"envelope"}function $e(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"]=j(e),t;for(let[n,o]of Object.entries(e))t[Ue(n,o)]+=j({[n]:o});return Object.values(t).every(n=>n===0)&&(t.envelope=1),t}function Le(e,t){let n=b.reduce((i,d)=>i+t[d],0),o=b.map(i=>({section:i,value:e*t[i]/n})),r={result_rows:0,envelope:0,diagnostics:0,hints:0};for(let i of o)r[i.section]=Math.floor(i.value);let s=e-b.reduce((i,d)=>i+r[d],0);for(let i of[...o].sort((d,a)=>a.value-Math.floor(a.value)-(d.value-Math.floor(d.value))||b.indexOf(d.section)-b.indexOf(a.section))){if(s===0)break;r[i.section]+=1,s-=1}return r}function J(e,t){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...e,token_accounting:t}:{result:e,token_accounting:t}}function gt(e,t){let n=A(t(e)),o=Le(n,$e(e)),r=Object.fromEntries(b.map(d=>[d,{bytes:o[d],estimated_tokens:k(o[d])}])),s={version:1,measurement_scope:"output_before_token_accounting",estimator:"ceil(utf8_bytes / 4)",total_bytes:n,total_estimated_tokens:k(n),sections:r,accounting_receipt_bytes:0,accounting_receipt_estimated_tokens:0,excluded_fields:["token_accounting"],section_allocation:"proportional_canonical_json"},i=J(e,s);for(let d=0;d<Pe;d+=1){let a=A(t(i))-n;if(a===s.accounting_receipt_bytes)return i;s={...s,accounting_receipt_bytes:a,accounting_receipt_estimated_tokens:k(a)},i=J(e,s)}return i}export{X as a,qe as b,te as c,N as d,ne as e,oe as f,ze as g,k as h,nt as i,ot as j,$ as k,Xe as l,Ye as m,O as n,E as o,Fe as p,de as q,He as r,Ve as s,G as t,Te as u,ft as v,Oe as w,z as x,lt as y,K as z,Se as A,Ie as B,mt as C,gt as D};
2
- //# sourceMappingURL=chunk-XC2ZW3CJ.js.map