@unbrained/pm-cli 2026.8.12 → 2026.8.14
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 +162 -111
- package/dist/cli/error-guidance.js +4 -8
- package/dist/cli/main.js +40 -3
- package/dist/cli/register-assurance.js +28 -17
- package/dist/cli-bundle/bundle-manifest.json +141 -173
- package/dist/cli-bundle/chunks/chunk-BBOFSVAK.js +197 -0
- package/dist/cli-bundle/chunks/chunk-BFALV3YP.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-WLAHPSOX.js → chunk-FIW4P64F.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BM5YJ2UW.js → chunk-G5JUB66K.js} +52 -52
- package/dist/cli-bundle/chunks/chunk-SBRKH6OR.js +2 -0
- package/dist/cli-bundle/chunks/chunk-TMJ7URWS.js +13 -0
- package/dist/cli-bundle/chunks/chunk-TXMEUUUY.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-KOQMGCTA.js → chunk-XAVMOK6B.js} +50 -50
- package/dist/cli-bundle/chunks/chunk-YAMTJL6Y.js +34 -0
- package/dist/cli-bundle/chunks/chunk-YSVSMJ2B.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-XPCJRUUD.js → register-list-query-T3EHHNNV.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-4RJCBKRS.js → register-mutation-E27WCLSZ.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-4R6I7CPY.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-LLHAKP2V.js → register-setup-3YXZ444E.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JAFRIWVF.js → chunk-4DQ2YERC.js} +4 -4
- package/dist/cli-bundle/focused-chunks/chunk-F43TT2QQ.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-K7RWWOAG.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-KFSZ3BP6.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KHM2CS2C.js → chunk-KSEDUWVZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KYUQGTSB.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZMGWAYH7.js → chunk-LZ4MV3RH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-PGXJQLCT.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-RWPAWUOT.js → chunk-PPFGQDSI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q4YY3XNF.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QK753U3U.js +46 -0
- package/dist/cli-bundle/focused-chunks/chunk-QUMB2J27.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-SM7MTG27.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GQW4BPUT.js → chunk-WCVE2NIG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-XDNAW5OI.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YIAXMC3T.js → chunk-YOOI3UZX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZM6TZVHC.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- 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 +45 -41
- 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 +109 -1
- 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/checkpoint/checkpoint-gc.js +7 -12
- package/dist/core/extensions/activation-summary-markdown.js +5 -4
- package/dist/core/extensions/activation-summary.d.ts +2 -0
- package/dist/core/extensions/activation-summary.js +6 -2
- package/dist/core/extensions/capability-usage.d.ts +1 -1
- package/dist/core/extensions/capability-usage.js +4 -3
- package/dist/core/extensions/contribution-inventory.d.ts +1 -0
- package/dist/core/extensions/contribution-inventory.js +6 -2
- package/dist/core/extensions/extension-registries.js +3 -2
- package/dist/core/extensions/extension-types.d.ts +83 -1
- package/dist/core/extensions/extension-types.js +3 -2
- package/dist/core/extensions/loader.d.ts +2 -8
- package/dist/core/extensions/loader.js +53 -144
- package/dist/core/extensions/registration-values.d.ts +43 -0
- package/dist/core/extensions/registration-values.js +210 -0
- package/dist/core/extensions/runtime-registrations.d.ts +3 -1
- package/dist/core/extensions/runtime-registrations.js +12 -2
- package/dist/core/fs/fs-utils.d.ts +2 -0
- package/dist/core/fs/fs-utils.js +7 -3
- package/dist/core/history/drift-cache.js +4 -3
- package/dist/core/history/drift-scan.d.ts +6 -0
- package/dist/core/history/drift-scan.js +76 -58
- package/dist/core/history/workspace-history.d.ts +59 -0
- package/dist/core/history/workspace-history.js +197 -10
- package/dist/core/lock/lock-gc.js +8 -13
- package/dist/core/lock/lock.js +5 -4
- package/dist/core/output/output.js +12 -4
- package/dist/core/search/vector-stores.js +6 -11
- package/dist/core/store/item-metadata-cache.js +4 -4
- package/dist/core/telemetry/runtime.d.ts +6 -0
- package/dist/core/telemetry/runtime.js +101 -30
- package/dist/sdk/agent/command-recovery.d.ts +2 -0
- package/dist/sdk/agent/command-recovery.js +10 -2
- package/dist/sdk/annotations.js +4 -4
- package/dist/sdk/cli-contracts/completeness.js +9 -3
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +6 -3
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +6 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +155 -60
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +32 -0
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +25 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +35 -5
- package/dist/sdk/cli-contracts/tool-schema.js +17 -2
- package/dist/sdk/cli-program.js +3 -3
- package/dist/sdk/comments.js +4 -3
- package/dist/sdk/compile-cache.js +4 -3
- package/dist/sdk/compose.d.ts +3 -1
- package/dist/sdk/compose.js +16 -2
- package/dist/sdk/context-relevance.js +12 -4
- package/dist/sdk/context-signal-store.js +4 -3
- package/dist/sdk/extension/install-runtime.js +4 -4
- package/dist/sdk/extension/managed-state.js +4 -3
- package/dist/sdk/extension-contracts.d.ts +1 -1
- package/dist/sdk/flag-invocation-contracts.js +5 -6
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
- package/dist/sdk/governance/assurance-action.d.ts +27 -3
- package/dist/sdk/governance/assurance-action.js +112 -28
- package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
- package/dist/sdk/governance/assurance-mutation-error.js +25 -2
- package/dist/sdk/governance/assurance-presets.d.ts +54 -0
- package/dist/sdk/governance/assurance-presets.js +136 -0
- package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
- package/dist/sdk/governance/assurance-runtime.js +109 -8
- package/dist/sdk/governance/assurance.d.ts +39 -0
- package/dist/sdk/governance/assurance.js +145 -6
- package/dist/sdk/governance/gc.js +5 -11
- package/dist/sdk/governance/health.js +18 -6
- package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
- package/dist/sdk/governance/validate-history-drift.js +68 -0
- package/dist/sdk/governance/validate.js +6 -48
- package/dist/sdk/graph/assembly.d.ts +23 -0
- package/dist/sdk/graph/assembly.js +54 -2
- package/dist/sdk/graph/durable-cache.js +91 -3
- package/dist/sdk/graph/governance-contracts.d.ts +12 -0
- package/dist/sdk/graph/governance-contracts.js +29 -0
- package/dist/sdk/graph/governance.d.ts +51 -3
- package/dist/sdk/graph/governance.js +216 -35
- package/dist/sdk/graph/index.d.ts +2 -2
- package/dist/sdk/graph/index.js +4 -4
- package/dist/sdk/graph/mutation-advisory.js +15 -7
- package/dist/sdk/graph/remediation.js +12 -2
- package/dist/sdk/guide.js +4 -4
- package/dist/sdk/history-read.d.ts +8 -0
- package/dist/sdk/history-read.js +2 -2
- package/dist/sdk/index.d.ts +3 -2
- package/dist/sdk/index.js +5 -4
- package/dist/sdk/linked-artifacts.d.ts +2 -0
- package/dist/sdk/linked-artifacts.js +29 -4
- package/dist/sdk/merge/install.js +5 -4
- package/dist/sdk/query/activity.js +4 -3
- package/dist/sdk/query/history.js +20 -3
- package/dist/sdk/read-output-budget.d.ts +2 -0
- package/dist/sdk/read-output-budget.js +12 -5
- package/dist/sdk/read-output-contracts.d.ts +61 -5
- package/dist/sdk/read-output-contracts.js +210 -28
- package/dist/sdk/read-output-rows.d.ts +11 -0
- package/dist/sdk/read-output-rows.js +47 -2
- package/dist/sdk/relationship-history.js +5 -5
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.js +5 -3
- package/dist/sdk/schema-migration.js +4 -4
- package/dist/sdk/test/execution.js +4 -4
- package/dist/sdk/workspace-memory.js +4 -4
- package/dist/sdk/workspace-snapshot.js +8 -14
- package/dist/sdk/workspace-transaction-gc.js +4 -9
- package/dist/sdk/workspace-transaction.js +4 -4
- package/dist/sdk/workspace.js +4 -3
- package/docs/ASSURANCE.md +163 -3
- package/docs/COMMANDS.md +31 -2
- package/docs/CONFIGURATION.md +2 -0
- package/docs/EXTENSIONS.md +11 -12
- package/docs/READ_OUTPUT_CONTRACTS.md +44 -8
- package/docs/RELATIONSHIP_GRAPH.md +34 -4
- package/docs/SDK.md +29 -8
- package/docs/SDK_CONTEXT_INTEGRITY.md +32 -1
- package/docs/TESTING.md +47 -16
- package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
- package/marketplace.json +2 -2
- package/package.json +6 -6
- package/packages/pm-beads/extensions/beads/index.ts +1 -0
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/extensions/digital-twin/index.ts +7 -0
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
- 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/extensions/linked-test-adapters/index.ts +6 -0
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/extensions/templates/index.ts +4 -0
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/extensions/todos/index.ts +2 -0
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
- 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/scripts/bundle-cli.mjs +17 -4
- package/sdk/public-surface.json +390 -60
- package/dist/cli-bundle/chunks/chunk-3PS7X6GS.js +0 -8
- package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +0 -13
- package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +0 -33
- package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +0 -196
- package/dist/cli-bundle/chunks/chunk-R76342NV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +0 -5
- package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KPSXVBDV.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KTLOKKCQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-NBLUKITQ.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-NYLOUPOB.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +0 -31
- package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +0 -17
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Ha as x,Ta as N,Ua as M,Y as h,Z as y,aa as I}from"./chunk-Q4YY3XNF.js";import{createHash as Y}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,H=/^[A-Za-z0-9_-]+$/;function B(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function Ue(e,t){let n=new Set;for(let r of t)if(r.cursor_semantics==="presentation"){n.add(B(r.flag));for(let o of r.aliases??[])n.add(B(o))}return Object.fromEntries(Object.entries(e).filter(([r])=>!n.has(r)))}function Ge(e,t){return Y("sha256").update(e).update("\0").update(I(t)).digest("hex").slice(0,24)}function R(e,t,n,r){return Buffer.from(JSON.stringify({version:C,fingerprint:e,after_id:t,...n===void 0?{}:{after_index:n},...r===void 0?{}:{snapshot:r}})).toString("base64url")}function w(e){return new y(e,h.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function V(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 S(e,t){if(typeof e!="string")throw w("Query cursor is malformed.");let n=e.trim();if(n.length===0||n.length>D||!H.test(n))throw w("Query cursor is malformed.");let r;try{r=JSON.parse(Buffer.from(n,"base64url").toString("utf8"))}catch{throw w("Query cursor is malformed.")}if(!V(r))throw w("Query cursor version or payload is unsupported.");let o=r;if(o.fingerprint!==t)throw w(`Query cursor does not match the current filters, sort, or query (${o.fingerprint} != ${t}).`);return{after_id:o.after_id,...o.after_index===void 0?{}:{after_index:o.after_index},...o.snapshot===void 0?{}:{snapshot:o.snapshot}}}function ze(e,t){return S(e,t).after_id}function Z(e,t,n,r){if(t===void 0)return 0;let o=S(t,n),s=e.findIndex(i=>r(i)===o.after_id);if(s<0){if(o.after_index!==void 0)return Math.min(o.after_index,e.length);throw w(`Query cursor item ${o.after_id} is no longer present in this result set.`)}return s+1}function je(e,t){if(t.cursor!==void 0&&S(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw w("Query cursor does not match the requested snapshot.");let n=Z(e,t.cursor,t.fingerprint,t.readId),r=e.slice(n,n+t.limit),o=r.length>0&&n+r.length<e.length,s=r.at(-1);return{rows:r,has_more:o,...o&&s!==void 0?{next_cursor:R(t.fingerprint,t.readId(s),n+r.length-1,t.snapshot)}:{}}}var qe=Object.freeze({version:C,max_length:D});import{AsyncLocalStorage as ge}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]="d059aa19-3822-5ff4-b4be-e2be8f537d1e")}catch{}})();var P=new WeakMap;function Fe(e,t){P.set(e,new Set(t))}var $='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',ee={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"}},te=[{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 Xe(e,t,n){if(e&&t)throw new y(`${n} cannot be combined with --full`,h.USAGE)}function m(e,t=new Set){let n=e.filter(r=>!t.has(r.name)).map(r=>({...r}));return{has_omissions:n.length>0,omitted_field_group_count:n.length,omitted_field_groups:n}}function Je(e,t){let n=te.find(o=>o.command===e);if(n===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===n.complete_mode)return m([]);let r=n.omissions_by_mode[t];if(r===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return m(r)}var ne=[{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 re=new Set([void 0,"tabular_when_uniform"]),oe=new Set(["collection","none"]),ie=new Set(["supported","unsupported"]);function se(e){return _(e)&&typeof e.command=="string"&&e.command.trim().length>0&&oe.has(e.row_kind)&&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&&ie.has(e.fields)&&re.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 de={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"]},ae={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 ce(e,t){let n=e.trim().toLowerCase().split(/\s+/u,1)[0],r=n?.startsWith("list-")?"list":n;if(r==="graph"){let i=typeof t.subcommand=="string"?t.subcommand:"";if(i.length===0)return;let d=de[i];if(d===void 0)return;let a=d.filter(c=>Array.isArray(t[c])||_(t[c]));return{command:"graph",row_kind:a.length>0?"collection":"none",row_keys:a,fields:"unsupported",...a.length>0?{jq_selector:$}:{},toon_encoding:"tabular_when_uniform"}}let o=ee[r],s=ae[r];return o===void 0||s===void 0||!s.some(i=>Object.hasOwn(t,i))?void 0:(()=>{let i=o.row_keys.filter(d=>{let a=d.split(".").reduce((c,u)=>_(c)?c[u]:void 0,t);return Array.isArray(a)||_(a)});return{command:r,row_kind:i.length>0?"collection":"none",row_keys:i,fields:o.fields,...i.length>0?{jq_selector:$}:{},toon_encoding:"tabular_when_uniform"}})()}function ue(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 r=t.filter(i=>_(i)&&typeof i.name=="string"&&i.name.trim().length>0&&typeof i.restore_with=="string"&&i.restore_with.trim().length>0),o=n.filter(i=>typeof i=="string");if(r.length!==t.length||o.length!==n.length)return;let s=new Set(r.map(i=>i.name));if(!(s.size!==r.length||new Set(o).size!==o.length||o.some(i=>!s.has(i))))return m(r,new Set(o))}function fe(e){if(Array.isArray(e.sections_included))return m(ne,new Set(e.sections_included.filter(t=>typeof t=="string")))}function le(e){if(!_(e.item))return;let t=e.item,n=["comments","notes","learnings","files","tests","docs","reminders","events"],r=["body","children","claim_state","linked","schedule"],o=P.get(e),s=d=>n.includes(d)||d==="body"?t:e,i=["body",...n,...r.slice(1)].filter(d=>o===void 0||o.has(d)||Object.hasOwn(s(d),d)).map(d=>({name:d,restore_with:`--fields ${d}`}));return m(i,new Set(i.flatMap(({name:d})=>Object.hasOwn(s(d),d)?[d]:[])))}function L(e){if(_(e.projection))return m([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function _e(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 me(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 pe(e,t){let n=ue(t);if(n!==void 0)return n;let[r]=e.split(/\s+/u,1);if(r==="context")return fe(t);if(r==="get")return le(t);if(r==="list"||r.startsWith("list-"))return L(t);if(r==="search")return L(t)??m([{name:"projection_metadata",restore_with:"--full"}]);if(r==="health")return _e(t);if(r==="contracts")return me(t)}function U(e,t){if(e===void 0||!_(t))return t;let n=pe(e,t),r=t.row_contract,o=se(r)?r:ce(e,t),s=o!==void 0?{...t,row_contract:o}:Object.hasOwn(t,"row_contract")?Object.fromEntries(Object.entries(t).filter(([i])=>i!=="row_contract")):t;return _(s.omission_receipt)||n===void 0?s:{...s,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]="fa03d543-ff0d-5556-8558-9bed82838a58")}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: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"}]),j=new ge;function he(){return j.getStore()??z}function rt(e,t){return j.run(we(e.workspaceContracts,e.packageContracts),t)}function ye(e,t){let n=e.command.trim().toLowerCase(),r=e.intent.trim().toLowerCase(),o=`${n}:${r}`;if(!/^[a-z0-9][a-z0-9-]*$/.test(n)||!/^[a-z0-9][a-z0-9-]*$/.test(r))throw new TypeError(`Invalid context intent command or name: ${o}`);if(e.description.trim().length===0)throw new TypeError(`Context intent ${o} requires a non-empty description`);if(!Number.isSafeInteger(e.token_budget)||e.token_budget<=0)throw new TypeError(`Context intent ${o} 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 ${o} requires included_field_groups`);return{command:n,intent:r,description:e.description.trim(),included_field_groups:s,token_budget:e.token_budget,source:t}}function we(e=[],t=[]){let n=[{source:"core",contracts:z,allowOverride:!1},{source:"package",contracts:t,allowOverride:!1},{source:"workspace",contracts:e,allowOverride:!0}],r=new Map,o=new Set;for(let s of n){o.clear();for(let i of s.contracts){let d=ye(i,s.source),a=`${d.command}:${d.intent}`;if(o.has(a))throw new TypeError(`Duplicate context intent declaration: ${a}`);if(o.add(a),!s.allowOverride&&r.has(a))throw new TypeError(`Duplicate context intent declaration: ${a}`);r.set(a,d)}}return[...r.values()].sort((s,i)=>s.command.localeCompare(i.command)||s.intent.localeCompare(i.intent))}function q(e,t,n=he()){let r=e.trim().toLowerCase(),o=t.trim().toLowerCase(),s=n.find(c=>c.command===r&&c.intent===o);if(s)return{...s,source:s.source??"core"};let i=n.filter(c=>c.command===r).map(c=>c.intent);if(i.length===0)return;let d=i.map(c=>{let u=Array.from({length:o.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<=o.length;l+=1){let J=u[l];u[l]=Math.min(u[l]+1,u[l-1]+1,f+(c[p-1]===o[l-1]?0:1)),f=J}}return{candidate:c,distance:u[o.length]}}).sort((c,u)=>c.distance-u.distance||c.candidate.localeCompare(u.candidate))[0].candidate,a=`pm ${r} --for ${d}`;throw new y(`Unknown context intent "${o}" for ${r}. Did you mean "${d}"?`,h.USAGE,{code:"unknown_context_intent",reason:"unknown_intent",field:"for",required:`Use a declared ${r} 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 ${r} --for ${o}`,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 r=E(e.tokenBudget,t.token_budget),o=Math.max(1,Math.floor((r-800)/500)),s=String(n?o:Math.min(20,o));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 r=E(e.tokenBudget,t.token_budget),o=Math.max(2,Math.floor((r-520)/16));e.limit=String(n?o:Math.min(100,o))}},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 r=E(e.tokenBudget,t.token_budget),o=Math.max(2,Math.floor((r-480)/16));e.limit=String(n?o:Math.min(100,o))}}};function ot(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 y("--token-budget requires a declared context intent selected with --for",h.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 r=q(e,t.for),o=T(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(r.token_budget)),Q[e](s,r,o),s}var be={context:"bounded_sections",get:"standard_item",list:"bounded_fields_and_rows",next:"bounded_ranked_rows",search:"bounded_ranked_rows"},O=256;function v(e){return Array.isArray(e)?e.map(v):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,v(n)])):typeof e=="string"&&e.length>240?`${e.slice(0,240)}\u2026`:e}function T(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 E(e,t){let n=T(e);if(n===void 0)return t;if(n<O)throw new y(`Context intent token budget must be at least ${O}`,h.USAGE,{code:"invalid_argument_value",reason:"below_minimum",field:"tokenBudget",required:`Use an integer token budget of at least ${O}.`,why:"Smaller ceilings cannot contain the minimum machine-readable intent receipt.",nextSteps:[`Retry with --token-budget ${O} or omit the override.`]});return n}function g(e,t){let n=t.estimated_tokens;for(;;){t.estimated_tokens=n;let r=Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4);if(r===n)return;n=r}}var G={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 W(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 ke(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 xe(e,t,n){let r=!1;for(;;){if(g(e,t),t.estimated_tokens<=t.token_budget||n.length<=1)return r;let o=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(o/n.length)))))),r=!0}}function Oe(e,t,n){let r=e.items,o=typeof e.next_cursor=="string",s=o?e.next_cursor:n.after;if(!Array.isArray(r)||typeof s!="string")return!1;let i=W(s);if(i===void 0)return!1;let d=r.length,a=[...r],c=!1;for(;;){if(c=xe(e,t,r)||c,!c)return!1;let u=ke(r.at(-1));if(u===void 0)return r.splice(0,r.length,...a),g(e,t),!1;if(e.next_cursor=R(i.fingerprint,u,o?i.after_index-(d-r.length):i.after_index+r.length,i.snapshot),g(e,t),t.estimated_tokens<=t.token_budget||r.length<=1)break}return typeof e.count=="number"&&(e.count=r.length),typeof e.applied_limit=="number"&&(e.applied_limit=r.length),!0}function Ee(e,t,n,r){if(e==="list"||e==="search")return Oe(t,n,r);if(e!=="next"||typeof t.next_cursor=="string")return!1;let o=!1;for(;;){if(g(t,n),n.estimated_tokens<=n.token_budget)return o;let s=G[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 o;let i=G[e].reduce((f,l)=>f+(Array.isArray(t[l])?t[l].length:0),0);if(i<=1)return o;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),o=!0}}function Ce(e,t,n){if(typeof t.for!="string")return n;let r=e.startsWith("list-")?"list":e;if(!(r in Q))return n;let o=r,s=q(o,t.for),i={command:o,intent:s.intent,source:s.source,included_field_groups:[...s.included_field_groups],token_budget:E(t.tokenBudget??t.token_budget,s.token_budget),estimated_tokens:0,within_budget:!0,degradation:be[o],declaration_feasible:!0,result_omitted:!1},d={...n};if(o==="list"||o==="search"){let c=o==="list"?520:480,u=Math.max(2,Math.floor((i.token_budget-c)/16)),f=T(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 g(a,i),i.estimated_tokens>i.token_budget&&(i.degradation="recursive_budget_compaction",a={...v(d),context_intent:i},g(a,i)),i.estimated_tokens>i.token_budget&&Ee(o,a,i,t)&&(i.degradation="budget_row_compaction",g(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},g(a,i)),a}function Re(e,t){if(typeof e.after!="string"||e.after.length===0)return t;let n=W(e.after)?.fingerprint??"opaque_cursor",r={...t};for(let o of["applied_limit","completeness","context_intent","count","filters","has_more","now","omission_receipt","projection","row_contract","sorting","total","truncated"])delete r[o];return r.continuation_contract={fingerprint:n,metadata:"reference",restore_with:"omit --after"},r}function K(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function b(e,t){if(K(e))return typeof e[t]=="number"?e[t]:void 0}function Se(e,t){let n=e;for(let r=0;r<8;r+=1){let o=b(n.context_intent,"estimated_tokens"),s=b(n.read_output,"estimated_tokens"),i=b(n.read_session,"spent_this_call_tokens");if(K(n.context_intent)&&g(n,n.context_intent),n=N(n,t),b(n.context_intent,"estimated_tokens")===o&&b(n.read_output,"estimated_tokens")===s&&b(n.read_session,"spent_this_call_tokens")===i)break}return n}function it(e,t,n){let r=U(e,n),o=typeof r=="object"&&r!==null&&!Array.isArray(r)?M(e??"",t,Re(t,Ce(e??"",t,r))):r;return t.outputRowContract===!0||t.output_row_contract===!0||typeof o!="object"||o===null||Array.isArray(o)||!Object.hasOwn(o,"row_contract")?o:Se(Object.fromEntries(Object.entries(o).filter(([s])=>s!=="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 k=["result_rows","envelope","diagnostics","hints"],ve=/^(?:items|results|rows|ready|blocked|recommended|decision_needed|children|dependencies|events|matches|commands|tools)$/u,Te=/^(?:diagnostics|errors?|warnings?|findings|violations|failures?)$/u,Ae=/^(?:hints?|suggestions?|next_steps?|recovery|remediation|examples?)$/u,Ie=8;function A(e){return Buffer.byteLength(e,"utf8")}function F(e){return A(JSON.stringify(e)??"null")}function Ne(e,t){return Te.test(e)?"diagnostics":Ae.test(e)?"hints":ve.test(e)||Array.isArray(t)?"result_rows":"envelope"}function Me(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"]=F(e),t;for(let[n,r]of Object.entries(e))t[Ne(n,r)]+=F({[n]:r});return Object.values(t).every(n=>n===0)&&(t.envelope=1),t}function Be(e,t){let n=k.reduce((i,d)=>i+t[d],0),r=k.map(i=>({section:i,value:e*t[i]/n})),o={result_rows:0,envelope:0,diagnostics:0,hints:0};for(let i of r)o[i.section]=Math.floor(i.value);let s=e-k.reduce((i,d)=>i+o[d],0);for(let i of[...r].sort((d,a)=>a.value-Math.floor(a.value)-(d.value-Math.floor(d.value))||k.indexOf(d.section)-k.indexOf(a.section))){if(s===0)break;o[i.section]+=1,s-=1}return o}function X(e,t){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...e,token_accounting:t}:{result:e,token_accounting:t}}function at(e,t){let n=A(t(e)),r=Be(n,Me(e)),o=Object.fromEntries(k.map(d=>[d,{bytes:r[d],estimated_tokens:x(r[d])}])),s={version:1,measurement_scope:"output_before_token_accounting",estimator:"ceil(utf8_bytes / 4)",total_bytes:n,total_estimated_tokens:x(n),sections:o,accounting_receipt_bytes:0,accounting_receipt_estimated_tokens:0,excluded_fields:["token_accounting"],section_allocation:"proportional_canonical_json"},i=X(e,s);for(let d=0;d<Ie;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:x(a)},i=X(e,s)}return i}export{Fe as a,Xe as b,Je as c,U as d,Ue as e,Ge as f,R as g,S as h,ze as i,Z as j,je as k,qe as l,z as m,he as n,rt as o,we as p,q,ot as r,W as s,ke as t,Ce as u,it as v,at as w};
|
|
2
|
+
//# sourceMappingURL=chunk-ZM6TZVHC.js.map
|