@unbrained/pm-cli 2026.11.30 → 2026.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli/commander-usage.js +10 -10
- package/dist/cli/error-guidance.js +5 -5
- package/dist/cli/extension-command-help.js +6 -6
- package/dist/cli/help-json-payload.js +7 -7
- package/dist/cli/main.js +5 -5
- package/dist/cli/register-list-query.js +10 -10
- package/dist/cli/register-mutation.js +3 -3
- package/dist/cli/runtime/invocation-command-path.js +2 -0
- package/dist/cli/runtime/read-output-mutation-retry.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-DCWGM7CY.js → chunk-3HKPVOAN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Z7YL2SUM.js → chunk-3KEMIPKG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TX74QJ4W.js → chunk-4YYFY33T.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-47ZS6RPL.js → chunk-7NAO7I75.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IGEFPHV7.js → chunk-7V65VACG.js} +52 -52
- package/dist/cli-bundle/chunks/chunk-A5ZEMOVR.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-5PNOVDVO.js → chunk-AHV3CSQG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KCVSSONY.js → chunk-C6WM6ZN4.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-CBUC4X7Q.js +127 -0
- package/dist/cli-bundle/chunks/{chunk-CCKM5YQM.js → chunk-G6TARHFK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TY55UX6M.js → chunk-GOEQXVOI.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-I4SPJQQI.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-Q4VZSMUL.js → chunk-L2ZSSMYY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NHBG5ET3.js → chunk-MZZ4ZJ5Z.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-NRQCBUYD.js +113 -0
- package/dist/cli-bundle/chunks/{chunk-YVTALIN3.js → chunk-OBPO6V7H.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KXTKLDKD.js → chunk-OXC5KBIQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HXQ3OHQR.js → chunk-PCDTWL6V.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AOTI76Q6.js → chunk-Q6K7HWZ7.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-QDV7S2QS.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-NZSXWIX7.js → chunk-ROTEELDL.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-WFYE34TO.js → chunk-SDXCJZKB.js} +23 -23
- package/dist/cli-bundle/chunks/{chunk-2SBTXR6C.js → chunk-SY5C3U32.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-FR7ULTM4.js → chunk-TKUG2X24.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FECZV72T.js → chunk-UNBW2LF3.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-V2S4XAX3.js +2 -0
- package/dist/cli-bundle/chunks/chunk-WSEIEDEK.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ZA5NS3PL.js → chunk-ZL6J6JYT.js} +6 -6
- package/dist/cli-bundle/chunks/{field-option-collisions-2F2Z7R7B.js → field-option-collisions-BBGTV7AD.js} +2 -2
- package/dist/cli-bundle/chunks/item-revision-3LENTXYF.js +2 -0
- package/dist/cli-bundle/chunks/item-transaction-56J5OCHA.js +2 -0
- package/dist/cli-bundle/chunks/{linked-resource-value-list-WXPPYUVQ.js → linked-resource-value-list-ZBIY4H23.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-actor-UK3QNEEB.js → mutation-actor-NHN33ITJ.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-admission-UTDYPFWP.js → mutation-admission-PGKJTCG6.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-DRA3CWHI.js → register-list-query-7S5QWDTI.js} +11 -11
- package/dist/cli-bundle/chunks/{register-mutation-WO74VLEQ.js → register-mutation-EK6DVIQK.js} +5 -5
- package/dist/cli-bundle/chunks/{register-operations-CRBKH7WN.js → register-operations-6MURXE4V.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-6V6NQB5C.js → register-setup-RW26X3GJ.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-DYEHGASU.js → stage-4ZCF74G4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RQYVX2T6.js → chunk-2DGKVXFT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2UWKU2BQ.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-A3DORTXS.js → chunk-3COWDIPX.js} +54 -54
- package/dist/cli-bundle/focused-chunks/{chunk-UQJ4PY2Y.js → chunk-4SCFAWAW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7G7JIXLL.js → chunk-6BKT6XQN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-6IY5CVGJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-7A6SEZEY.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IJ3T3W4U.js → chunk-BHNBPCHP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LWBZ7UGG.js → chunk-EQCQTYKO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FM5WQ6ZU.js → chunk-HTDYNY4L.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TQQO42C2.js → chunk-J72TRWR5.js} +26 -26
- package/dist/cli-bundle/focused-chunks/{chunk-L357ZAES.js → chunk-JPZGC3W4.js} +5 -5
- package/dist/cli-bundle/focused-chunks/{chunk-62AMZMR4.js → chunk-KNBGHCIP.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-N64AC5G6.js +100 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IIVDBAJM.js → chunk-OG57ESZK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MZNV26XE.js → chunk-P2H3GTJK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-QZRYGYTI.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-SQMOF65W.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-T3ILWAEV.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-SXC3NVZI.js → chunk-TR22GU7M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-M57KDG7I.js → chunk-TXTPAFHJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-VK3IE3TS.js +29 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NJTKGBSK.js → chunk-VQIC3UZB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-U35K7FSE.js → chunk-W4JMV7GF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{field-option-collisions-7TG7STO7.js → field-option-collisions-2C6DLUC4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-revision-723XCQPS.js +2 -0
- package/dist/cli-bundle/focused-chunks/{item-transaction-2IC2MLML.js → item-transaction-LQLQLZE7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-actor-LJVF2HVD.js → mutation-actor-DJMZUIZI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-SDWQVVHN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{stage-MWR73LTZ.js → stage-QBZIK3T5.js} +2 -2
- package/dist/cli-bundle/main.js +27 -27
- 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 +1 -1
- 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 +61 -61
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -2
- package/dist/core/extensions/reserved-host-flags.js +1 -1
- package/dist/core/shared/secret-rules.d.ts +86 -12
- package/dist/core/shared/secret-rules.js +7 -5
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +50 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/extension/command-options.js +1 -1
- package/dist/sdk/extension/install-sources.d.ts +2 -2
- package/dist/sdk/extension/install-sources.js +5 -5
- package/dist/sdk/lifecycle/expect-hash-admission.d.ts +15 -0
- package/dist/sdk/lifecycle/expect-hash-admission.js +2 -0
- package/dist/sdk/lifecycle/item-revision.d.ts +4 -1
- package/dist/sdk/lifecycle/item-revision.js +1 -1
- package/dist/sdk/mutation-guard.js +1 -1
- package/dist/sdk/output-contracts.js +1 -1
- package/dist/sdk/output-projection.d.ts +1 -1
- package/dist/sdk/output-projection.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/aggregate.js +1 -1
- package/dist/sdk/query/context.js +1 -1
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/next.js +1 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/read-output/surfaces.js +1 -1
- package/dist/sdk/read-output-budget.d.ts +1 -1
- package/dist/sdk/read-output-budget.js +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.js +1 -1
- package/docs/COMMANDS.md +37 -0
- package/docs/MUTATION_INTEGRITY.md +226 -10
- package/docs/SDK.md +16 -6
- package/docs/agent-task-token-baseline.json +1 -1
- package/marketplace.json +1 -1
- package/node_modules/tar/README.md +1792 -1147
- package/node_modules/tar/dist/commonjs/bytes.d.ts +21 -0
- package/node_modules/tar/dist/commonjs/bytes.js +83 -0
- package/node_modules/tar/dist/commonjs/codec.d.ts +53 -0
- package/node_modules/tar/dist/commonjs/codec.js +35 -0
- package/node_modules/tar/dist/commonjs/concat.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/concat.js +20 -0
- package/node_modules/tar/dist/commonjs/create.d.ts +39 -2
- package/node_modules/tar/dist/commonjs/create.js +150 -64
- package/node_modules/tar/dist/commonjs/dealias.d.ts +79 -0
- package/node_modules/tar/dist/commonjs/dealias.js +50 -0
- package/node_modules/tar/dist/commonjs/delete.d.ts +19 -0
- package/node_modules/tar/dist/commonjs/delete.js +121 -0
- package/node_modules/tar/dist/commonjs/entries.d.ts +82 -0
- package/node_modules/tar/dist/commonjs/entries.js +398 -0
- package/node_modules/tar/dist/commonjs/extract.d.ts +14 -2
- package/node_modules/tar/dist/commonjs/extract.js +40 -81
- package/node_modules/tar/dist/commonjs/fs.d.ts +201 -0
- package/node_modules/tar/dist/commonjs/fs.js +5 -0
- package/node_modules/tar/dist/commonjs/header.d.ts +4 -4
- package/node_modules/tar/dist/commonjs/header.js +71 -53
- package/node_modules/tar/dist/commonjs/index.d.ts +25 -18
- package/node_modules/tar/dist/commonjs/index.js +46 -18
- package/node_modules/tar/dist/commonjs/index.min.js +2 -3
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts +2 -2
- package/node_modules/tar/dist/commonjs/large-numbers.js +4 -4
- package/node_modules/tar/dist/commonjs/list.d.ts +23 -6
- package/node_modules/tar/dist/commonjs/list.js +99 -138
- package/node_modules/tar/dist/commonjs/mkdir.d.ts +16 -11
- package/node_modules/tar/dist/commonjs/mkdir.js +121 -159
- package/node_modules/tar/dist/commonjs/normalize-unicode.js +9 -0
- package/node_modules/tar/dist/commonjs/options.d.ts +284 -513
- package/node_modules/tar/dist/commonjs/options.js +20 -61
- package/node_modules/tar/dist/commonjs/pack.d.ts +150 -96
- package/node_modules/tar/dist/commonjs/pack.js +752 -445
- package/node_modules/tar/dist/commonjs/parser.d.ts +98 -0
- package/node_modules/tar/dist/commonjs/parser.js +452 -0
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts +17 -7
- package/node_modules/tar/dist/commonjs/path-reservations.js +110 -140
- package/node_modules/tar/dist/commonjs/path.d.ts +19 -0
- package/node_modules/tar/dist/commonjs/path.js +90 -0
- package/node_modules/tar/dist/commonjs/pax.d.ts +3 -1
- package/node_modules/tar/dist/commonjs/pax.js +67 -36
- package/node_modules/tar/dist/commonjs/read-entry.d.ts +97 -11
- package/node_modules/tar/dist/commonjs/read-entry.js +251 -97
- package/node_modules/tar/dist/commonjs/read-file.d.ts +22 -0
- package/node_modules/tar/dist/commonjs/read-file.js +104 -0
- package/node_modules/tar/dist/commonjs/replace.d.ts +45 -1
- package/node_modules/tar/dist/commonjs/replace.js +164 -211
- package/node_modules/tar/dist/commonjs/server/codecs.d.ts +38 -0
- package/node_modules/tar/dist/commonjs/server/codecs.js +252 -0
- package/node_modules/tar/dist/commonjs/server/index.d.ts +115 -0
- package/node_modules/tar/dist/commonjs/server/index.js +166 -0
- package/node_modules/tar/dist/commonjs/server/index.min.js +3 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +8 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.js +17 -20
- package/node_modules/tar/dist/commonjs/to-stream.d.ts +7 -0
- package/node_modules/tar/dist/commonjs/to-stream.js +22 -0
- package/node_modules/tar/dist/commonjs/types.d.ts +4 -3
- package/node_modules/tar/dist/commonjs/types.js +4 -3
- package/node_modules/tar/dist/commonjs/unpack.d.ts +143 -89
- package/node_modules/tar/dist/commonjs/unpack.js +780 -725
- package/node_modules/tar/dist/commonjs/update.d.ts +11 -1
- package/node_modules/tar/dist/commonjs/update.js +37 -28
- package/node_modules/tar/dist/commonjs/warn.d.ts +27 -0
- package/node_modules/tar/dist/commonjs/warn.js +36 -0
- package/node_modules/tar/dist/commonjs/win32-path.d.ts +16 -0
- package/node_modules/tar/dist/commonjs/win32-path.js +67 -0
- package/node_modules/tar/dist/commonjs/write-entry.d.ts +64 -111
- package/node_modules/tar/dist/commonjs/write-entry.js +108 -672
- package/node_modules/tar/dist/commonjs/write-flag.d.ts +18 -0
- package/node_modules/tar/dist/commonjs/write-flag.js +29 -0
- package/node_modules/tar/dist/esm/bytes.d.ts +21 -0
- package/node_modules/tar/dist/esm/bytes.js +72 -0
- package/node_modules/tar/dist/esm/codec.d.ts +53 -0
- package/node_modules/tar/dist/esm/codec.js +32 -0
- package/node_modules/tar/dist/esm/concat.d.ts +3 -0
- package/node_modules/tar/dist/esm/concat.js +16 -0
- package/node_modules/tar/dist/esm/create.d.ts +39 -2
- package/node_modules/tar/dist/esm/create.js +144 -61
- package/node_modules/tar/dist/esm/dealias.d.ts +79 -0
- package/node_modules/tar/dist/esm/dealias.js +46 -0
- package/node_modules/tar/dist/esm/delete.d.ts +19 -0
- package/node_modules/tar/dist/esm/delete.js +117 -0
- package/node_modules/tar/dist/esm/entries.d.ts +82 -0
- package/node_modules/tar/dist/esm/entries.js +388 -0
- package/node_modules/tar/dist/esm/extract.d.ts +14 -2
- package/node_modules/tar/dist/esm/extract.js +37 -44
- package/node_modules/tar/dist/esm/fs.d.ts +201 -0
- package/node_modules/tar/dist/esm/fs.js +4 -0
- package/node_modules/tar/dist/esm/header.d.ts +4 -4
- package/node_modules/tar/dist/esm/header.js +71 -53
- package/node_modules/tar/dist/esm/index.d.ts +25 -18
- package/node_modules/tar/dist/esm/index.js +23 -18
- package/node_modules/tar/dist/esm/index.min.js +2 -3
- package/node_modules/tar/dist/esm/large-numbers.d.ts +2 -2
- package/node_modules/tar/dist/esm/large-numbers.js +4 -4
- package/node_modules/tar/dist/esm/list.d.ts +23 -6
- package/node_modules/tar/dist/esm/list.js +96 -101
- package/node_modules/tar/dist/esm/mkdir.d.ts +16 -11
- package/node_modules/tar/dist/esm/mkdir.js +119 -154
- package/node_modules/tar/dist/esm/normalize-unicode.js +9 -0
- package/node_modules/tar/dist/esm/options.d.ts +284 -513
- package/node_modules/tar/dist/esm/options.js +17 -51
- package/node_modules/tar/dist/esm/pack.d.ts +150 -96
- package/node_modules/tar/dist/esm/pack.js +750 -441
- package/node_modules/tar/dist/esm/parser.d.ts +98 -0
- package/node_modules/tar/dist/esm/parser.js +448 -0
- package/node_modules/tar/dist/esm/path-reservations.d.ts +17 -7
- package/node_modules/tar/dist/esm/path-reservations.js +110 -140
- package/node_modules/tar/dist/esm/path.d.ts +19 -0
- package/node_modules/tar/dist/esm/path.js +80 -0
- package/node_modules/tar/dist/esm/pax.d.ts +3 -1
- package/node_modules/tar/dist/esm/pax.js +66 -35
- package/node_modules/tar/dist/esm/read-entry.d.ts +97 -11
- package/node_modules/tar/dist/esm/read-entry.js +248 -96
- package/node_modules/tar/dist/esm/read-file.d.ts +22 -0
- package/node_modules/tar/dist/esm/read-file.js +99 -0
- package/node_modules/tar/dist/esm/replace.d.ts +45 -1
- package/node_modules/tar/dist/esm/replace.js +160 -207
- package/node_modules/tar/dist/esm/server/codecs.d.ts +38 -0
- package/node_modules/tar/dist/esm/server/codecs.js +214 -0
- package/node_modules/tar/dist/esm/server/index.d.ts +115 -0
- package/node_modules/tar/dist/esm/server/index.js +102 -0
- package/node_modules/tar/dist/esm/server/index.min.js +3 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +8 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.js +17 -20
- package/node_modules/tar/dist/esm/to-stream.d.ts +7 -0
- package/node_modules/tar/dist/esm/to-stream.js +18 -0
- package/node_modules/tar/dist/esm/types.d.ts +4 -3
- package/node_modules/tar/dist/esm/types.js +4 -3
- package/node_modules/tar/dist/esm/unpack.d.ts +143 -89
- package/node_modules/tar/dist/esm/unpack.js +776 -719
- package/node_modules/tar/dist/esm/update.d.ts +11 -1
- package/node_modules/tar/dist/esm/update.js +35 -28
- package/node_modules/tar/dist/esm/warn.d.ts +27 -0
- package/node_modules/tar/dist/esm/warn.js +31 -0
- package/node_modules/tar/dist/esm/win32-path.d.ts +16 -0
- package/node_modules/tar/dist/esm/win32-path.js +60 -0
- package/node_modules/tar/dist/esm/write-entry.d.ts +64 -111
- package/node_modules/tar/dist/esm/write-entry.js +107 -633
- package/node_modules/tar/dist/esm/write-flag.d.ts +18 -0
- package/node_modules/tar/dist/esm/write-flag.js +25 -0
- package/node_modules/tar/package.json +68 -224
- package/package.json +2 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-3TXEWHQX.js +0 -125
- package/dist/cli-bundle/chunks/chunk-JPJNJHQW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-NVYDPNQP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SJWIPGZW.js +0 -113
- package/dist/cli-bundle/chunks/chunk-USBTXMKS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-VCXQ6A35.js +0 -3
- package/dist/cli-bundle/chunks/chunk-YPMNXG2C.js +0 -2
- package/dist/cli-bundle/chunks/item-revision-UAF6L47R.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-RJECL53Y.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2UUBS4BG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4ER3VMST.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4YBMHMBJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HXM7K6VH.js +0 -100
- package/dist/cli-bundle/focused-chunks/chunk-NGHT2LNG.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-P55AZPFN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WAP3DF4B.js +0 -27
- package/dist/cli-bundle/focused-chunks/chunk-XR745UGE.js +0 -4
- package/dist/cli-bundle/focused-chunks/item-revision-J7EUGCHR.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-SLFAUONA.js +0 -2
- package/node_modules/@isaacs/fs-minipass/LICENSE +0 -15
- package/node_modules/@isaacs/fs-minipass/README.md +0 -71
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +0 -118
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +0 -430
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +0 -3
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +0 -118
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +0 -420
- package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +0 -3
- package/node_modules/@isaacs/fs-minipass/package.json +0 -72
- package/node_modules/chownr/LICENSE.md +0 -63
- package/node_modules/chownr/README.md +0 -3
- package/node_modules/chownr/dist/commonjs/index.d.ts +0 -3
- package/node_modules/chownr/dist/commonjs/index.js +0 -93
- package/node_modules/chownr/dist/commonjs/package.json +0 -3
- package/node_modules/chownr/dist/esm/index.d.ts +0 -3
- package/node_modules/chownr/dist/esm/index.js +0 -85
- package/node_modules/chownr/dist/esm/package.json +0 -3
- package/node_modules/chownr/package.json +0 -69
- package/node_modules/minipass/LICENSE.md +0 -55
- package/node_modules/minipass/README.md +0 -825
- package/node_modules/minipass/dist/commonjs/index.d.ts +0 -545
- package/node_modules/minipass/dist/commonjs/index.js +0 -1038
- package/node_modules/minipass/dist/commonjs/package.json +0 -3
- package/node_modules/minipass/dist/esm/index.d.ts +0 -545
- package/node_modules/minipass/dist/esm/index.js +0 -1020
- package/node_modules/minipass/dist/esm/package.json +0 -3
- package/node_modules/minipass/package.json +0 -77
- package/node_modules/minizlib/LICENSE +0 -26
- package/node_modules/minizlib/README.md +0 -64
- package/node_modules/minizlib/dist/commonjs/constants.d.ts +0 -2
- package/node_modules/minizlib/dist/commonjs/constants.js +0 -123
- package/node_modules/minizlib/dist/commonjs/index.d.ts +0 -99
- package/node_modules/minizlib/dist/commonjs/index.js +0 -416
- package/node_modules/minizlib/dist/commonjs/package.json +0 -3
- package/node_modules/minizlib/dist/esm/constants.d.ts +0 -2
- package/node_modules/minizlib/dist/esm/constants.js +0 -117
- package/node_modules/minizlib/dist/esm/index.d.ts +0 -99
- package/node_modules/minizlib/dist/esm/index.js +0 -363
- package/node_modules/minizlib/dist/esm/package.json +0 -3
- package/node_modules/minizlib/package.json +0 -80
- package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +0 -2
- package/node_modules/tar/dist/commonjs/get-write-flag.js +0 -32
- package/node_modules/tar/dist/commonjs/make-command.d.ts +0 -49
- package/node_modules/tar/dist/commonjs/make-command.js +0 -52
- package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +0 -2
- package/node_modules/tar/dist/commonjs/normalize-windows-path.js +0 -12
- package/node_modules/tar/dist/commonjs/parse.d.ts +0 -92
- package/node_modules/tar/dist/commonjs/parse.js +0 -655
- package/node_modules/tar/dist/commonjs/process-umask.d.ts +0 -2
- package/node_modules/tar/dist/commonjs/process-umask.js +0 -7
- package/node_modules/tar/dist/commonjs/warn-method.d.ts +0 -24
- package/node_modules/tar/dist/commonjs/warn-method.js +0 -31
- package/node_modules/tar/dist/esm/get-write-flag.d.ts +0 -2
- package/node_modules/tar/dist/esm/get-write-flag.js +0 -26
- package/node_modules/tar/dist/esm/make-command.d.ts +0 -49
- package/node_modules/tar/dist/esm/make-command.js +0 -48
- package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +0 -2
- package/node_modules/tar/dist/esm/normalize-windows-path.js +0 -9
- package/node_modules/tar/dist/esm/parse.d.ts +0 -92
- package/node_modules/tar/dist/esm/parse.js +0 -651
- package/node_modules/tar/dist/esm/process-umask.d.ts +0 -2
- package/node_modules/tar/dist/esm/process-umask.js +0 -3
- package/node_modules/tar/dist/esm/warn-method.d.ts +0 -24
- package/node_modules/tar/dist/esm/warn-method.js +0 -27
- package/node_modules/yallist/LICENSE.md +0 -63
- package/node_modules/yallist/README.md +0 -205
- package/node_modules/yallist/dist/commonjs/index.d.ts +0 -39
- package/node_modules/yallist/dist/commonjs/index.js +0 -384
- package/node_modules/yallist/dist/commonjs/package.json +0 -3
- package/node_modules/yallist/dist/esm/index.d.ts +0 -39
- package/node_modules/yallist/dist/esm/index.js +0 -379
- package/node_modules/yallist/dist/esm/package.json +0 -3
- package/node_modules/yallist/package.json +0 -68
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{READ_OUTPUT_DIMENSION_FLAGS as wt,READ_OUTPUT_COMPOSITION_FLAGS as Rt,PM_READ_OUTPUT_SURFACES as bt}from"./read-output/options.js";import{resolvePmHistoryOperation as L}from"./cli-contracts/command-aliases.js";import{resolveExtensionOutputCommand as At}from"./read-output/extension.js";import{BEHAVIOR_PRESERVING_MIGRATION_HINTS as G,LEGACY_FLAGS_BY_COMMAND as Ct,VALUE_BEARING_INCLUDE_ALIASES as Et,flagSelector as $,optionKey as kt,readOutputIncludeModeOptionsForSurface as q,resolveNativeReadOutputSurface as Tt}from"./read-output/surfaces.js";import{EXIT_CODE as w}from"../core/shared/constants.js";import{PmCliError as R}from"../core/shared/errors.js";import{compactReadOutputToBudget as St,estimateReadOutputTokens as xt,readOutputMeasurementFormat as V,projectReadOutputItemToBrief as It,preserveReadOutputRowContract as k,mirrorReadOutputReceiptEstimate as jt,resolveReadOutputPassHooks as z,resolveReadOutputRecoveryBudget as vt,updateReadOutputReceiptEstimate as T}from"./read-output-budget.js";import{resolveReadOutputRecoveryBudget as en}from"./read-output-budget.js";import{resolvePmCommandOutputBudget as Ut}from"./cli-contracts/agent-output-contracts.js";import{boundReadOutputRows as Pt,countReadOutputRows as K,mapReadOutputRows as H,readOutputBudgetCollections as Y,readOutputContinuationRowCollections as v,readOutputRowPaths as Nt,readOutputRowCollections as Mt,refreshReadOutputDeliveredCounts as U}from"./read-output-rows.js";import{applyReadOutputContinuation as Dt,decodeReadOutputContinuationCursor as Ft,encodeReadOutputContinuationCursor as Bt,prioritizeAssuranceAssertions as Lt,readOutputCollectionFingerprint as Gt,refreshReadOutputDeliveredRowCounters as $t}from"./read-output/continuation.js";import{PM_READ_OUTPUT_TAIL_RETENTION_POLICIES as S,readOutputRetainsTail as x}from"./read-output/tail-retention.js";import{decodeReadOutputContinuationCursor as on,encodeReadOutputContinuationCursor as un,PM_READ_OUTPUT_CONTINUATION_FINGERPRINT_POLICIES as rn,readOutputCollectionFingerprint as sn}from"./read-output/continuation.js";import{PM_READ_OUTPUT_TAIL_RETENTION_POLICIES as cn,readOutputRetainsTail as dn}from"./read-output/tail-retention.js";import{applyReadOutputSessionReferences as qt,attachReadOutputSessionReceipt as W,parseReadOutputSession as P,readOutputSessionRemainingTokens as Vt}from"./read-output-session.js";import{decodeQueryCursorEnvelope as zt,encodeQueryCursor as Kt}from"./pagination.js";import{READ_OUTPUT_INVOCATION_PROVENANCE as N}from"./read-output/provenance.js";const b=["include","amount","cost","encoding"];import{PM_READ_OUTPUT_SURFACES as fn}from"./read-output/options.js";const J=["canonical","legacy","intent","default"],C=wt,qe=Object.freeze(b.map(t=>C[t])),Ve=Rt;function Ht(t,e){const n=G[t];if(n!==void 0)return n;const o=e==="include"?Et.has(t)?"<csv>":$(t):e==="amount"?"<n>":e==="cost"?"<tokens>":"<toon|json>";return`${t} is a compatibility alias; prefer ${C[e]} ${o}.`}function X(t){const e=Ct[t]??{},n=Object.freeze(Object.fromEntries(b.map(o=>[o,Object.freeze({dimension:o,canonical_option:C[o],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((e[o]??[]).map(u=>Object.freeze({flag:u,semantics:G[u]===void 0?"replacement":"behavior_preserving",migration_hint:Ht(u,o),visibility:"hidden_alias"})))})])));return Object.freeze({command:t,dimensions:n,precedence:J,budget_retention_policy:t==="assurance"?"verdict_priority":Object.hasOwn(S,t)?"ordered_suffix":"ordered_prefix",projection_modes:Object.freeze([...q(t).keys()])})}const Yt=Object.freeze(bt.map(X)),Wt=new Map(Yt.map(t=>[t.command,t]));function I(t,e={}){const n=L(t.trim().toLowerCase()),o=At(n);return o!==void 0?o.read_output===void 0?void 0:`extension:${o.command}`:Tt(n,e)}const Q=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],Z={comments:["add","body","comment","text","stdin","file","edit","delete"],notes:["add","note","text","addJson","stdin","file","edit","delete"],learnings:["add","learning","text","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"],"package-catalog":["activate","adopt","adoptAll","deactivate","doctor","init","install","manage","migrate","reload","scaffold","uninstall"]};function Jt(t){return Q.some(e=>e!=="outputFormat"&&e!=="output_format"&&t[e]!==void 0)}const Xt=[{keys:["outputInclude","output_include"],valid:t=>E(t)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:t=>t==="unbounded"||A(t)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:t=>t==="unbounded"||A(t)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputSession","output_session"],valid:t=>(P(t),!0),message:"--output-session must be a valid session-state object."},{keys:["outputCursor","output_cursor"],valid:t=>typeof t=="string"&&t.trim().length>0,message:"--output-cursor requires a non-empty continuation cursor."}],ze="read_output_surface_unsupported",Ke="read_output_mutation_conflict",tt=[{flag:"--output-include",keys:["outputInclude","output_include"]},{flag:"--output-limit",keys:["outputLimit","output_limit"]},{flag:"--output-budget",keys:["outputBudget","output_budget"]},{flag:"--output-session",keys:["outputSession","output_session"]},{flag:"--output-cursor",keys:["outputCursor","output_cursor"]},{flag:"--output-row-contract",keys:["outputRowContract","output_row_contract"]}],He=tt.map(({flag:t})=>t);function Qt(t,e,n){const o=tt.filter(({keys:s})=>s.some(d=>e[d]!==void 0)),u=o.map(({flag:s})=>s),i=o.flatMap(({keys:s})=>s.filter(d=>e[d]!==void 0)),r=u.join(", ");return new R(`Universal output controls (${r}) cannot be combined with a ${t} mutation; nothing was written.`,w.USAGE,{code:"read_output_mutation_conflict",field:u[0],details:{surface:t,output_controls:u,output_option_keys:i,mutation_options:[...n]},required:`Retry the ${t} mutation without ${r}. To bound or page the result, read it with those controls in a separate call after the write.`,why:"Universal output controls shape a read. A mutation returns its own bounded receipt, so the controls have nothing to shape and the write is refused before it runs.",examples:[...Zt[t]]})}const Zt={comments:['pm comments <id> --add "<text>"',"pm comments <id> --output-limit 5"],notes:['pm notes <id> --add "<text>"',"pm notes <id> --output-limit 5"],learnings:['pm learnings <id> --add "<text>"',"pm learnings <id> --output-limit 5"],files:["pm files <id> --add path=<path>","pm files <id> --output-limit 5"],docs:["pm docs <id> --add path=<path>","pm docs <id> --output-limit 5"],"package-catalog":["pm package install <source> --project","pm package catalog --output-limit 5"]},te=new Set(["comments","notes","learnings"]);function Ye(t,e){const n=e[1];return te.has(L(t.trim().toLowerCase()))&&typeof n=="string"?{add:n}:{}}function We(t,e){const n=e.outputFormat??e.output_format;if(n!==void 0&&n!=="json"&&n!=="toon")throw new R("--output-format must be toon or json.",w.USAGE);if(!Jt(e))return;const o=I(t,e);if(!o){const u=Q.filter(i=>e[i]!==void 0);throw new R(`Universal output controls apply only to read commands; ${t||"this command"} is not a read surface.`,w.USAGE,{code:"read_output_surface_unsupported",details:{command:t||null,output_option_keys:u},required:"Drop the universal output controls, or run a read command. An extension command accepts them only when it declares read_output.",why:"Universal output controls shape a read's rows; a command that is not a read surface has no rows for them to bound, page or project."})}if(Object.hasOwn(Z,o)){const u=o,i=Z[u].filter(r=>e[r]!==void 0&&e[r]!==!1);if(i.length>0)throw Qt(u,e,i)}for(const u of Xt){const i=u.keys.map(r=>e[r]).find(r=>r!==void 0);if(i!==void 0&&!u.valid(i))throw new R(u.message,w.USAGE)}}function et(t){const e=I(t);return e?q(e):new Map}function ee(t,e,n){const o=E(e)??[],u=et(t),i=[],r=[],s=n,d=s[N],f=new Set(d?.canonical_include_modes??[]),l=new Set(d?.explicit_legacy_aliases??[]);for(const c of o){const _=u.get(c);if(_===void 0){i.push(c);continue}const O=`--${c.replaceAll("_","-")}`;D(M(n,O))&&l.add(O),n[_]=!0,r.push(c),f.add(c)}const a=I(t)==="get"?i.filter(c=>c!=="item"):[],p=a.length>0;return p&&(n.fields=[...new Set([...E(n.fields)??[],...a])].join(","),f.add("fields")),(r.length>0||p)&&(s[N]={canonical_include_modes:[...f],explicit_legacy_aliases:[...l],...d?.cli_invocation_observed===!0?{cli_invocation_observed:!0}:{}}),{selectors:i,modes:r}}function Je(t,e){const n=e.outputInclude??e.output_include;if(n===void 0)return;const{selectors:o,modes:u}=ee(t,n,e);if(u.length===0)return;const i=o.length>0?o.join(","):void 0;e.outputInclude=i,Object.hasOwn(e,"output_include")&&(e.output_include=i)}function M(t,e){const n=kt(e);if(Object.hasOwn(t,n))return t[n];const o=e.slice(2).replaceAll("-","_");if(Object.hasOwn(t,o))return t[o];if(e==="--no-truncate"&&t.truncate===!1)return!0}function D(t){return t!==void 0&&t!==!1&&t!==null}function E(t){const n=(Array.isArray(t)?t:[t]).flatMap(o=>typeof o=="string"?o.split(","):[]).map(o=>o.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function A(t){const e=typeof t=="number"?t:typeof t=="string"&&/^\d+$/u.test(t.trim())?Number(t):Number.NaN;return Number.isSafeInteger(e)&&e>0?e:void 0}function ne(t,e,n,o){for(const u of t.legacy_aliases){if(o(u.flag))continue;const i=M(e,u.flag),r={value:i,flag:u.flag};if(D(i)&&n(r))return r}}function nt(t,e){const n=E(t);if(n)return{source:"canonical",value:n};if(e)return{source:"legacy",value:E(e.value)??[$(e.flag)]}}function ot(t,e){if(t==="unbounded")return{source:"canonical",value:"unbounded"};const n=A(t);if(n!==void 0)return{source:"canonical",value:n};if(!e)return;if(e.flag==="--no-truncate"||e.flag==="--unbounded")return{source:"legacy",value:"unbounded"};const o=A(e.value);return o===void 0?void 0:{source:"legacy",value:o}}function ut(t,e){if(t==="unbounded")return{source:"canonical",value:"unbounded"};const n=A(t);if(n!==void 0)return{source:"canonical",value:n};if(!e)return;const o=A(e.value);return o===void 0?void 0:{source:"legacy",value:o}}function it(t,e){if(t==="json"||t==="toon")return{source:"canonical",value:t};if(e)return e.flag==="--stream"||e.flag==="--follow"?{source:"legacy",value:"stream"}:e.value==="json"||e.value==="toon"?{source:"legacy",value:e.value}:void 0}function rt(t,e,n){if(!t)return!1;const o=new Set(t.explicit_legacy_aliases);if(t.cli_invocation_observed===!0||t.sdk_invocation_observed===!0)return!o.has(n);const u=new Set(t.canonical_include_modes.map(i=>`--${i.replaceAll("_","-")}`));return e==="include"&&u.has(n)&&!o.has(n)}function oe(t,e,n,o){return t.trim().toLowerCase().replaceAll(/\s+/gu," ").split(" ")[0]==="list-all"||D(M(o,"--no-truncate"))&&!rt(n,"amount","--no-truncate")||e.amount?.flag==="--no-truncate"||e.include?.flag==="--full"||n?.canonical_include_modes.includes("full")===!0}function ue(t,e){return b.flatMap(n=>t[n]?.source==="canonical"||n==="include"&&(e?.canonical_include_modes.length??0)>0?[C[n]]:[])}function st(t,e){const n=I(t,e);if(!n)return;const o=Wt.get(n)??X(n),u=e[N],i={include:g=>nt(void 0,g),amount:g=>ot(void 0,g),cost:g=>ut(void 0,g),encoding:g=>it(void 0,g)},r=Object.fromEntries(b.map(g=>[g,ne(o.dimensions[g],e,y=>i[g](y)!==void 0,y=>rt(u,g,y))])),s=b.flatMap(g=>{const y=r[g];return y?[y.flag]:[]}),d=b.flatMap(g=>{const y=r[g];return y?[o.dimensions[g].legacy_aliases.find(yt=>yt.flag===y.flag).migration_hint]:[]}),f=it(e.outputFormat??e.output_format,r.encoding),l=nt(e.outputInclude??e.output_include,r.include),a=ot(e.outputLimit??e.output_limit,r.amount),p=ut(e.outputBudget??e.output_budget,r.cost),c=oe(t,r,u,e),_=Ut(t,{generateFallback:!0}),O=f?.value==="json"||e.resolvedOutputFormat==="json"?"json":"toon",h=p??(c?{source:"intent",value:"unbounded"}:{source:"default",value:_.default_max_estimated_tokens_by_format[O]});return{command:n,include:l,amount:a,cost:h,encoding:f,canonical_options_used:ue({include:l,amount:a,cost:h,encoding:f},u),legacy_aliases_used:s,migration_hints:d,precedence:J}}function m(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}const F=new Set(["applied_bound","applied_limit","completeness","continuation_kind","continuation_path","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","budget_retention_policy","row_contract","sorting","total","truncated"]),ie=["collection_counts","notes_count","tests_count"];function at(t,e){const n=new Set(e.map(o=>o.split(".")[0]));return Object.fromEntries(Object.entries(t).filter(([o])=>n.has(o)))}function re(t){const e=m(t.item)?t.item:{},n=[...new Set([...Object.keys(e),...ie.filter(u=>Object.hasOwn(e,u))])].sort((u,i)=>u.localeCompare(i)),o=Object.keys(t).filter(u=>u!=="item"&&u!=="read_output"&&!F.has(u)).sort((u,i)=>u.localeCompare(i));return{item:e,itemFields:n,sections:o,valid:[...n,"item",...n.map(u=>`item.${u}`),...o]}}function se(t,e){const n=re(t),o=e.filter(a=>!n.valid.includes(a));if(o.length>0)throw new R(`Unknown --output-include selector(s) for get: ${o.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,w.USAGE);const u=e.includes("item"),i=e.flatMap(a=>a.startsWith("item.")?[a.slice(5)]:n.itemFields.includes(a)?[a]:[]).filter((a,p,c)=>c.indexOf(a)===p);if(u&&i.length>0)throw new R("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.",w.USAGE);const r=new Set(e.filter(a=>n.sections.includes(a))),s=Object.fromEntries(Object.entries(t).filter(([a])=>F.has(a)||r.has(a)));u?s.item=n.item:i.length>0&&(s.item=at(n.item,i));const d=[...u?[]:i.length>0?n.itemFields.filter(a=>!i.includes(a)).map(a=>({name:`item.${a}`,restore_with:`--output-include item.${a}`})):[{name:"item",restore_with:"--output-include item"}],...n.sections.filter(a=>!r.has(a)).map(a=>({name:a,restore_with:`--output-include ${a}`}))],l=[...m(s.omission_receipt)&&Array.isArray(s.omission_receipt.omitted_field_groups)?s.omission_receipt.omitted_field_groups:[],...d];return s.omission_receipt={has_omissions:l.length>0,omitted_field_group_count:l.length,omitted_field_groups:l},s}function ct(t){let e=0;return H({...t},n=>(m(n)&&Object.keys(n).length>0&&(e+=1),n)),e}function ae(t,e,n,o){if(ct(e)===0||ct(n)>0)return;const u=[...et(t).keys()],i=u.length>0?` Declared ${t} projection modes: ${u.join(", ")}.`:` The ${t} surface declares no projection modes; name row fields instead.`;throw new R(`Unknown --output-include selector(s) for ${t}: ${o.join(", ")}. No selector matched any returned row field.${i}`,w.USAGE)}function ce(t,e,n){if(t==="get")return se(e,n);const o=Nt(e),u=n.flatMap(r=>o.flatMap(s=>r.startsWith(`${s}.`)?[r.slice(s.length+1)]:[])),i=n.some(r=>Object.hasOwn(e,r.split(".")[0])&&!o.some(s=>r.startsWith(`${s}.`)));if(o.length>0&&(!i||u.length>0)){const r={...e},s=u.length>0?u:n,d=H(r,f=>m(f)?at(f,s):f);return ae(t,e,d,s),d}return Object.fromEntries(Object.entries(e).filter(([r])=>n.some(s=>s.split(".")[0]===r)||F.has(r)))}function de(t,e,n,o){if(e==="unbounded")return t;const{result:u,truncated:i}=Pt(t,e,r=>x(n,r));if(!i)return u;if(u.has_more=!0,u.truncated=!0,mt(u,n,[...o.entries()].flatMap(([r,s])=>s.rows>e?[{path:r,total_rows:s.totalRows}]:[])),typeof u.count=="number"){const r=m(u.projection)?u.projection.row_key:void 0;u.count=typeof r=="string"&&Array.isArray(u[r])?u[r].length:K(u)}return typeof u.returned_count=="number"&&(u.returned_count=K(u)),u.applied_bound={kind:"output_limit",source:"explicit",value:e},u}function le(t){return b.filter(e=>t[e]!==void 0&&t[e]?.source!=="default"||t.canonical_options_used.includes(C[e]))}function j(t,e,n,o){let u=W(t,e,o);k(t,u);for(let i=0;i<8;i+=1){const r=n.estimated_tokens,s=u.read_session.spent_this_call_tokens;T(u,n,o);const d=u;u=W(u,e,o),k(d,u);const f=u.read_session.spent_this_call_tokens;if(n.estimated_tokens===r&&f===s)return u}return u}function fe(t,e){if(!m(t.read_output))return t;const n=V(e),o=t.read_output,u=P(e.outputSession??e.output_session);return u===void 0?(T(t,o,n),t):j(t,u,o,n)}function dt(t,e){if(t!=="validate")return e;const n=m(e.projection)?e.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(a=>m(a)&&a.name==="diagnostic_rows"))return e;const u=[...new Set(Y(e).map(({path:a})=>a).filter(a=>/^checks\.\d+\.details\./u.test(a)))],i=u.filter(a=>!u.some(p=>p!==a&&a.startsWith(`${p}.`)));if(i.length===0)return e;const r=m(e.row_contract)?e.row_contract:{},s=Array.isArray(r.row_keys)?r.row_keys.filter(a=>typeof a=="string"):[],d=Array.isArray(r.continuation_row_keys)?r.continuation_row_keys.filter(a=>typeof a=="string"):[],f=s.length>0?s:i,l=[...new Set(i)];return JSON.stringify(f)===JSON.stringify(s)&&JSON.stringify(l)===JSON.stringify(d)?e:{...e,row_contract:{...r,row_keys:f,continuation_row_keys:l,jq_selector:typeof r.jq_selector=="string"?r.jq_selector:".checks[].details"}}}function pe(t,e){return t.include?.source==="canonical"&&!B(e)}function lt(t,e){let n={...t};return pe(e,t)&&(n=ce(e.command,n,e.include.value)),e.command==="assurance"?Lt(n):n}function _e(t,e){const n=z(e)?.continuationBinding;if(n===void 0)return;const o=lt(dt(t.command,n),t);return new Map(v(o).filter(u=>!x(t.command,u.path)).map(u=>[u.path,u]))}function me(t,e,n,o,u){let i=lt(t,e);U(i,t);const r=_e(e,u);if(i=Dt(i,e.command,o,r),e.command==="history"&&o){const f=["compact_history","provenance_history","history","diff"];if(i=Object.fromEntries(Object.entries(i).filter(([l])=>!f.includes(l)||l===o.path)),m(i.projection)&&(i.projection={...i.projection,row_key:o.path}),m(i.row_contract)){const l=i.row_contract;i.row_contract={...l,row_keys:[o.path],...Array.isArray(l.continuation_row_keys)?{continuation_row_keys:[o.path]}:{}}}i.count=Object.keys(i[o.path]).length}const s=t.count_only===!0?{...i,count_only:!0,count:t.count}:i,d=Ae(i,t,e.command,o,u,r);return e.amount?.source==="canonical"&&(i=de(i,e.amount.value,e.command,d.collectionsBeforeBudget),d.cursorContinuesExistingPage&&Ot(i,d.originalItems,d.cursorSource,!0,d.originalItemOffset)),U(i,s),gt(i,e.command,d),{projected:n===void 0?i:qt(i,n),continuationState:d}}function ge(t,e){return[...t.cost!==void 0&&t.cost.value!=="unbounded"&&(t.cost.source==="canonical"||t.cost.source==="default"||t.command==="context"&&t.cost.source==="legacy")?[{source:t.cost.source,tokens:t.cost.value}]:[],...e===void 0?[]:[{source:"session",tokens:Vt(e)}]].sort((o,u)=>o.tokens-u.tokens)[0]}function ft(t){const e=t.canonical_options_used;return e&&e.length>0?{canonical_options_used:e}:{}}function pt(t,e){return m(t.context_intent)&&t.context_intent.command==="context"&&t.context_intent.token_budget===e&&t.context_intent.within_budget===!0}function Oe(t,e,n){return t.command!=="next"||(e.tokenBudget??e.token_budget)===void 0?!1:!(m(n.context_intent)&&n.context_intent.command==="next"&&n.context_intent.within_budget===!0)}function _t(t,e={}){return t?.source==="default"||t?.source==="legacy"&&!pt(e,t.tokens)?{budget_source:t.source,budget_tokens:t.tokens}:{}}function he(t,e,n,o,u,i){const r={contract_version:1,command:t.command,requested_dimensions:e,..._t(o),precedence:t.precedence,...ft(t),legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0,...n===void 0?{omitted_result_estimated_tokens:u}:{}},s={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:r},d=n===void 0?s:j(s,n,r,i);if(n===void 0&&T(d,r,i),n!==void 0&&r.estimated_tokens>o.tokens)throw new R("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",w.USAGE);return d}function ye(t,e,n){return t.command==="context"&&t.cost?.source==="legacy"&&!pt(n,t.cost.value)||Oe(t,e,n)||e.outputRowContract===!0||e.output_row_contract===!0||t.canonical_options_used.includes("--output-include")||t.command==="list"&&t.canonical_options_used.length>0&&t.include?.value.includes("full")===!0}function we(t,e,n,o,u){if(e!==void 0||B(n)||ye(t,u,n))return!1;if(t.amount?.source==="canonical"&&t.amount.value!=="unbounded"){const i=t.amount.value;if(Mt(n).some(({value:r})=>(Array.isArray(r)?r.length:Object.keys(r).length)>i))return!1}return t.cost===void 0||t.cost.value==="unbounded"||t.cost.source==="legacy"&&t.command!=="context"||xt(u.outputRowContract===!1?Object.fromEntries(Object.entries(n).filter(([i])=>i!=="row_contract")):n,o)<=t.cost.value}function mt(t,e,n){const o=Object.hasOwn(S,e)?S[e]:void 0,u=n.find(i=>o?.paths.includes(i.path));o!==void 0&&u!==void 0&&typeof t[o.total_key]!="number"&&(t[o.total_key]=u.total_rows)}function gt(t,e,n){const o=S[e]?.paths[0];o!==void 0&&$t(t,e,n.producer,n.collectionsBeforeBudget.get(o)?.rows)}function Re(t,e,n,o){const u=n.backward?n.rows-o:n.baseOffset+o;return{path:e,cursor:Bt({command:t,path:e,offset:u,total_rows:n.totalRows,fingerprint:n.fingerprint,...n.backward?{direction:"backward"}:{}}),retained_rows:o,remaining_rows:n.backward?u:n.totalRows-u,total_rows:n.totalRows}}function be(t,e,n,o,u,i,r){if(!n.rows_compacted)return;const s=e.amount?.value==="unbounded"?["amount"]:[],d=new Map(v(t).map(_=>[_.path,Array.isArray(_.value)?_.value.length:Object.keys(_.value).length])),f=[...r.entries()].flatMap(([_,O])=>{const h=d.get(_);return h>=O.rows?[]:[Re(e.command,_,O,h)]}),l=f[0];mt(t,e.command,f);const a=l?"; page --output-cursor":"",p=o.source==="session"?`Truncated by the remaining ${o.tokens}-token session budget; start a new output session with a larger token_budget${a}.`:`${o.tokens}-token: raise --output-budget${a}`;n.migration_hints=[p,...e.migration_hints];const c=vt({effective_budget_tokens:o.tokens,measured_result_tokens:i});l&&!u&&(typeof t.next_cursor!="string"||t.continuation_kind==="output_cursor")&&(t.next_cursor=l.cursor),t.continuation_kind=u?"producer_cursor":l?"output_cursor":"none",t.output_budget_truncation={reason:"output_budget_reached",budget_source:o.source,budget_tokens:o.tokens,overridden_dimensions:s,compacted_row_paths:n.compacted_row_paths,continuation_cursor_rebased:u,continuation_available:f.length>0,recovery_budget_multiplier:l?1:c.recovery_budget_multiplier,continuations:f,restore_with:l?"recovery":`Retry with --output-budget ${c.output_budget} because no declared row collection can be continued.`,recovery:l?{cursor:l.cursor,cli:"--output-cursor",sdk:"outputCursor",mcp:"outputCursor"}:{cli:`--output-budget ${c.output_budget}`,sdk:{outputBudget:c.output_budget},mcp:{outputBudget:c.output_budget}}}}function Ot(t,e,n,o,u){if(typeof n!="string"||!Array.isArray(t.items))return!1;const i=t.items.length,r=e.length;if(i===0||i>=r)return!1;let s;try{s=zt(n)}catch{return!1}const d=s.after_index;if(d===void 0)return!1;const f=e[i-1];if(Object.prototype.toString.call(f)!=="[object Object]")return!1;const l=Reflect.get(f,"id");if(typeof l!="string"||l.length===0)return!1;const a=o?d-(r-i):d+u+i;return a<0?!1:(t.next_cursor=Kt(s.fingerprint,l,a,s.snapshot),!0)}function ht(t){return Array.isArray(t)?t.length:Object.keys(t).length}function Ae(t,e,n,o,u,i){const r=new Map(v(t).map(f=>{const l=ht(f.value),a=o?.path===f.path,p=x(n,f.path),c=i?.get(f.path)??f;let _;return[f.path,{rows:l,totalRows:a?o.total_rows:ht(c.value),baseOffset:a&&!p?o.offset:0,backward:p,get fingerprint(){return _??=a?o.fingerprint:Gt(f.path,c.value,n),_}}]})),s=typeof t.next_cursor=="string",d=o?.path==="items"?o.offset:0;return{collectionsBeforeBudget:r,originalItems:Array.isArray(e.items)?d>0?e.items.slice(d):e.items:[],originalItemOffset:d,cursorContinuesExistingPage:s,cursorSource:s?t.next_cursor:u.after,producer:e}}function Ce(t,e,n,o,u,i,r,s,d,f){const l={...e,count_only:n},a=o.command==="assurance"&&Array.isArray(t.assertions)?t.assertions.filter(c=>m(c)&&c.verdict!=="pass").length:0,p=new Map;if(a>0&&p.set("assertions",a),o.command==="history"&&Array.isArray(t.diff))for(const c of Y(t))c.path.startsWith("diff.")&&p.set(c.path,Object.keys(c.value).length);return St(t,u,i.tokens,p,f,c=>{U(c,l),gt(c,o.command,s);const _=Ot(c,s.originalItems,s.cursorSource,s.cursorContinuesExistingPage,s.originalItemOffset);if(be(c,o,u,i,_,d,s.collectionsBeforeBudget),o.command==="history"&&m(c.projection)){c.has_more=typeof c.next_cursor=="string"||c.applied_bound?.kind==="output_limit";const O=c.projection.row_key;typeof O=="string"&&Array.isArray(c[O])&&(c.count=c[O].length)}r!==void 0&&Object.assign(c,j(c,r,u,f))},o.command==="history"&&Array.isArray(t.diff),c=>x(o.command,c),o.command)}function Xe(t,e,n){const o=st(t,e);if(!o)return n;const u=V(e),i=P(e.outputSession??e.output_session),r=e.outputCursor??e.output_cursor,s=typeof r=="string"?Ft(r):void 0,d=le(o),f=dt(o.command,n);if(s===void 0&&we(o,i,f,u,e))return f;const l=ge(o,i),a=me(f,o,i,s,e);let p=a.projected;k(p,p,e.outputRowContract===!1);const c=B(p),_={contract_version:1,command:o.command,requested_dimensions:d,..._t(l,p),precedence:o.precedence,...ft(o),legacy_aliases_used:o.legacy_aliases_used,migration_hints:o.migration_hints,estimated_tokens:0,within_budget:!c,strings_compacted:!1,rows_compacted:!1,result_omitted:c};p.read_output=_;const O=z(e)?.mirrorEstimate;if(O!==void 0&&jt(_,O),p=i===void 0?p:j(p,i,_,u),T(p,_,u),l!==void 0&&_.estimated_tokens>l.tokens){const h=It(o.command,e,p);h!==void 0&&(_.applied_depth="brief",_.degradation_reason="output_budget_reached",k(p,h),p=fe(h,e)),_.estimated_tokens>l.tokens&&(p=Ce(p,p,f.count_only===!0,o,_,l,i,a.continuationState,_.estimated_tokens,u))}return l!==void 0&&_.estimated_tokens>l.tokens?he(o,d,i,l,_.estimated_tokens,u):p}function Ee(t){return m(t)&&m(t.context_intent)&&t.context_intent.result_omitted===!0}function B(t){return ke(t)||Ee(t)}function ke(t){return m(t)&&m(t.output_budget_exceeded)&&t.output_budget_exceeded.omitted_result===!0&&t.output_budget_exceeded.reason==="requested_budget_infeasible"}function Qe(t,e){const n=e.outputFormat??e.output_format;if(n==="json"||n==="toon")return n;const o=st(t,e)?.encoding;return o?.value==="json"||o?.value==="toon"?o.value:void 0}export{Ve as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,rn as PM_READ_OUTPUT_CONTINUATION_FINGERPRINT_POLICIES,b as PM_READ_OUTPUT_DIMENSIONS,qe as PM_READ_OUTPUT_OPTION_FLAGS,fn as PM_READ_OUTPUT_SURFACES,Yt as PM_READ_OUTPUT_SURFACE_CONTRACTS,cn as PM_READ_OUTPUT_TAIL_RETENTION_POLICIES,Ke as READ_OUTPUT_MUTATION_CONFLICT_CODE,He as READ_OUTPUT_SHAPING_CONTROL_FLAGS,ze as READ_OUTPUT_SURFACE_UNSUPPORTED_CODE,Ye as annotationPositionalMutationOptions,Xe as applyReadOutputDimensions,ee as applyReadOutputIncludeModes,on as decodeReadOutputContinuationCursor,un as encodeReadOutputContinuationCursor,ke as isReadOutputBudgetExceeded,B as isReadResultOmittedForBudget,Je as normalizeReadOutputIncludeModeOptions,sn as readOutputCollectionFingerprint,et as readOutputIncludeModeOptions,dn as readOutputRetainsTail,st as resolveReadOutputDimensions,Qe as resolveReadOutputEncoding,en as resolveReadOutputRecoveryBudget,I as resolveReadOutputSurface,fe as stabilizeReadOutputReceiptEstimates,We as validateReadOutputOptions};
|
|
1
|
+
import{READ_OUTPUT_DIMENSION_FLAGS as wt,READ_OUTPUT_COMPOSITION_FLAGS as Rt,PM_READ_OUTPUT_SURFACES as bt}from"./read-output/options.js";import{resolvePmHistoryOperation as B}from"./cli-contracts/command-aliases.js";import{resolveExtensionOutputCommand as At}from"./read-output/extension.js";import{BEHAVIOR_PRESERVING_MIGRATION_HINTS as G,LEGACY_FLAGS_BY_COMMAND as Ct,VALUE_BEARING_INCLUDE_ALIASES as Et,flagSelector as $,optionKey as kt,readOutputIncludeModeOptionsForSurface as q,resolveNativeReadOutputSurface as Tt}from"./read-output/surfaces.js";import{EXIT_CODE as w}from"../core/shared/constants.js";import{PmCliError as R}from"../core/shared/errors.js";import{compactReadOutputToBudget as St,estimateReadOutputTokens as xt,readOutputMeasurementFormat as V,projectReadOutputItemToBrief as It,preserveReadOutputRowContract as k,mirrorReadOutputReceiptEstimate as jt,resolveReadOutputPassHooks as z,resolveReadOutputRecoveryBudget as vt,updateReadOutputReceiptEstimate as T}from"./read-output-budget.js";import{resolveReadOutputRecoveryBudget as on}from"./read-output-budget.js";import{resolvePmCommandOutputBudget as Pt}from"./cli-contracts/agent-output-contracts.js";import{boundReadOutputRows as Ut,countReadOutputRows as K,mapReadOutputRows as H,readOutputBudgetCollections as Y,readOutputContinuationRowCollections as v,readOutputRowPaths as Nt,readOutputRowCollections as Dt,refreshReadOutputDeliveredCounts as P}from"./read-output-rows.js";import{applyReadOutputContinuation as Mt,decodeReadOutputContinuationCursor as Ft,encodeReadOutputContinuationCursor as Lt,prioritizeAssuranceAssertions as Bt,readOutputCollectionFingerprint as Gt,refreshReadOutputDeliveredRowCounters as $t}from"./read-output/continuation.js";import{PM_READ_OUTPUT_TAIL_RETENTION_POLICIES as S,readOutputRetainsTail as x}from"./read-output/tail-retention.js";import{decodeReadOutputContinuationCursor as rn,encodeReadOutputContinuationCursor as sn,PM_READ_OUTPUT_CONTINUATION_FINGERPRINT_POLICIES as an,readOutputCollectionFingerprint as cn}from"./read-output/continuation.js";import{PM_READ_OUTPUT_TAIL_RETENTION_POLICIES as ln,readOutputRetainsTail as fn}from"./read-output/tail-retention.js";import{applyReadOutputSessionReferences as qt,attachReadOutputSessionReceipt as W,parseReadOutputSession as U,readOutputSessionRemainingTokens as Vt}from"./read-output-session.js";import{decodeQueryCursorEnvelope as zt,encodeQueryCursor as Kt}from"./pagination.js";import{READ_OUTPUT_INVOCATION_PROVENANCE as N}from"./read-output/provenance.js";const b=["include","amount","cost","encoding"];import{PM_READ_OUTPUT_SURFACES as _n}from"./read-output/options.js";const J=["canonical","legacy","intent","default"],C=wt,ze=Object.freeze(b.map(t=>C[t])),Ke=Rt;function Ht(t,e){const n=G[t];if(n!==void 0)return n;const o=e==="include"?Et.has(t)?"<csv>":$(t):e==="amount"?"<n>":e==="cost"?"<tokens>":"<toon|json>";return`${t} is a compatibility alias; prefer ${C[e]} ${o}.`}function X(t){const e=Ct[t]??{},n=Object.freeze(Object.fromEntries(b.map(o=>[o,Object.freeze({dimension:o,canonical_option:C[o],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((e[o]??[]).map(u=>Object.freeze({flag:u,semantics:G[u]===void 0?"replacement":"behavior_preserving",migration_hint:Ht(u,o),visibility:"hidden_alias"})))})])));return Object.freeze({command:t,dimensions:n,precedence:J,budget_retention_policy:t==="assurance"?"verdict_priority":Object.hasOwn(S,t)?"ordered_suffix":"ordered_prefix",projection_modes:Object.freeze([...q(t).keys()])})}const Yt=Object.freeze(bt.map(X)),Wt=new Map(Yt.map(t=>[t.command,t]));function I(t,e={}){const n=B(t.trim().toLowerCase()),o=At(n);return o!==void 0?o.read_output===void 0?void 0:`extension:${o.command}`:Tt(n,e)}const Q=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],Z={comments:["add","body","comment","text","stdin","file","edit","delete"],notes:["add","note","text","addJson","stdin","file","edit","delete"],learnings:["add","learning","text","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"],"package-catalog":["activate","adopt","adoptAll","deactivate","doctor","init","install","manage","migrate","reload","scaffold","uninstall"]};function Jt(t){return Q.some(e=>e!=="outputFormat"&&e!=="output_format"&&t[e]!==void 0)}const Xt=[{keys:["outputInclude","output_include"],valid:t=>E(t)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:t=>t==="unbounded"||A(t)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:t=>t==="unbounded"||A(t)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputSession","output_session"],valid:t=>(U(t),!0),message:"--output-session must be a valid session-state object."},{keys:["outputCursor","output_cursor"],valid:t=>typeof t=="string"&&t.trim().length>0,message:"--output-cursor requires a non-empty continuation cursor."}],He="read_output_surface_unsupported",Ye="read_output_mutation_conflict",tt=[{flag:"--output-include",keys:["outputInclude","output_include"]},{flag:"--output-limit",keys:["outputLimit","output_limit"]},{flag:"--output-budget",keys:["outputBudget","output_budget"]},{flag:"--output-session",keys:["outputSession","output_session"]},{flag:"--output-cursor",keys:["outputCursor","output_cursor"]},{flag:"--output-row-contract",keys:["outputRowContract","output_row_contract"]}],We=tt.map(({flag:t})=>t);function Qt(t,e,n){const o=tt.filter(({keys:s})=>s.some(d=>e[d]!==void 0)),u=o.map(({flag:s})=>s),i=o.flatMap(({keys:s})=>s.filter(d=>e[d]!==void 0)),r=u.join(", ");return new R(`Universal output controls (${r}) cannot be combined with a ${t} mutation; nothing was written.`,w.USAGE,{code:"read_output_mutation_conflict",field:u[0],details:{surface:t,output_controls:u,output_option_keys:i,mutation_options:[...n]},required:`Retry the ${t} mutation without ${r}. To bound or page the result, read it with those controls in a separate call after the write.`,why:"Universal output controls shape a read. A mutation returns its own bounded receipt, so the controls have nothing to shape and the write is refused before it runs.",examples:[...Zt[t]]})}const Zt={comments:['pm comments <id> --add "<text>"',"pm comments <id> --output-limit 5"],notes:['pm notes <id> --add "<text>"',"pm notes <id> --output-limit 5"],learnings:['pm learnings <id> --add "<text>"',"pm learnings <id> --output-limit 5"],files:["pm files <id> --add path=<path>","pm files <id> --output-limit 5"],docs:["pm docs <id> --add path=<path>","pm docs <id> --output-limit 5"],"package-catalog":["pm package install <source> --project","pm package catalog --output-limit 5"]},te=new Set(["comments","notes","learnings"]);function Je(t,e){const n=e[1];return te.has(B(t.trim().toLowerCase()))&&typeof n=="string"?{add:n}:{}}function Xe(t,e){const n=e.outputFormat??e.output_format;if(n!==void 0&&n!=="json"&&n!=="toon")throw new R("--output-format must be toon or json.",w.USAGE);if(!Jt(e))return;const o=I(t,e);if(!o){const u=Q.filter(i=>e[i]!==void 0);throw new R(`Universal output controls apply only to read commands; ${t||"this command"} is not a read surface.`,w.USAGE,{code:"read_output_surface_unsupported",details:{command:t||null,output_option_keys:u},required:"Drop the universal output controls, or run a read command. An extension command accepts them only when it declares read_output.",why:"Universal output controls shape a read's rows; a command that is not a read surface has no rows for them to bound, page or project."})}if(Object.hasOwn(Z,o)){const u=o,i=Z[u].filter(r=>e[r]!==void 0&&e[r]!==!1);if(i.length>0)throw Qt(u,e,i)}for(const u of Xt){const i=u.keys.map(r=>e[r]).find(r=>r!==void 0);if(i!==void 0&&!u.valid(i))throw new R(u.message,w.USAGE)}}function et(t){const e=I(t);return e?q(e):new Map}function ee(t,e,n){const o=E(e)??[],u=et(t),i=[],r=[],s=n,d=s[N],l=new Set(d?.canonical_include_modes??[]),f=new Set(d?.explicit_legacy_aliases??[]);for(const _ of o){const c=u.get(_);if(c===void 0){i.push(_);continue}const h=`--${_.replaceAll("_","-")}`;M(D(n,h))&&f.add(h),n[c]=!0,r.push(_),l.add(_)}const a=I(t)==="get"?i.filter(_=>_!=="item"):[],p=a.length>0;return p&&(n.fields=[...new Set([...E(n.fields)??[],...a])].join(","),l.add("fields")),(r.length>0||p)&&(s[N]={canonical_include_modes:[...l],explicit_legacy_aliases:[...f],...d?.cli_invocation_observed===!0?{cli_invocation_observed:!0}:{}}),{selectors:i,modes:r}}function Qe(t,e){const n=e.outputInclude??e.output_include;if(n===void 0)return;const{selectors:o,modes:u}=ee(t,n,e);if(u.length===0)return;const i=o.length>0?o.join(","):void 0;e.outputInclude=i,Object.hasOwn(e,"output_include")&&(e.output_include=i)}function D(t,e){const n=kt(e);if(Object.hasOwn(t,n))return t[n];const o=e.slice(2).replaceAll("-","_");if(Object.hasOwn(t,o))return t[o];if(e==="--no-truncate"&&t.truncate===!1)return!0}function M(t){return t!==void 0&&t!==!1&&t!==null}function E(t){const n=(Array.isArray(t)?t:[t]).flatMap(o=>typeof o=="string"?o.split(","):[]).map(o=>o.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function A(t){const e=typeof t=="number"?t:typeof t=="string"&&/^\d+$/u.test(t.trim())?Number(t):Number.NaN;return Number.isSafeInteger(e)&&e>0?e:void 0}function ne(t,e,n,o){for(const u of t.legacy_aliases){if(o(u.flag))continue;const i=D(e,u.flag),r={value:i,flag:u.flag};if(M(i)&&n(r))return r}}function nt(t,e){const n=E(t);if(n)return{source:"canonical",value:n};if(e)return{source:"legacy",value:E(e.value)??[$(e.flag)]}}function ot(t,e){if(t==="unbounded")return{source:"canonical",value:"unbounded"};const n=A(t);if(n!==void 0)return{source:"canonical",value:n};if(!e)return;if(e.flag==="--no-truncate"||e.flag==="--unbounded")return{source:"legacy",value:"unbounded"};const o=A(e.value);return o===void 0?void 0:{source:"legacy",value:o}}function ut(t,e){if(t==="unbounded")return{source:"canonical",value:"unbounded"};const n=A(t);if(n!==void 0)return{source:"canonical",value:n};if(!e)return;const o=A(e.value);return o===void 0?void 0:{source:"legacy",value:o}}function it(t,e){if(t==="json"||t==="toon")return{source:"canonical",value:t};if(e)return e.flag==="--stream"||e.flag==="--follow"?{source:"legacy",value:"stream"}:e.value==="json"||e.value==="toon"?{source:"legacy",value:e.value}:void 0}function rt(t,e,n){if(!t)return!1;const o=new Set(t.explicit_legacy_aliases);if(t.cli_invocation_observed===!0||t.sdk_invocation_observed===!0)return!o.has(n);const u=new Set(t.canonical_include_modes.map(i=>`--${i.replaceAll("_","-")}`));return e==="include"&&u.has(n)&&!o.has(n)}function oe(t,e,n,o){return t.trim().toLowerCase().replaceAll(/\s+/gu," ").split(" ")[0]==="list-all"||M(D(o,"--no-truncate"))&&!rt(n,"amount","--no-truncate")||e.amount?.flag==="--no-truncate"||e.include?.flag==="--full"||n?.canonical_include_modes.includes("full")===!0}function ue(t,e){return b.flatMap(n=>t[n]?.source==="canonical"||n==="include"&&(e?.canonical_include_modes.length??0)>0?[C[n]]:[])}function st(t,e){const n=I(t,e);if(!n)return;const o=Wt.get(n)??X(n),u=e[N],i={include:g=>nt(void 0,g),amount:g=>ot(void 0,g),cost:g=>ut(void 0,g),encoding:g=>it(void 0,g)},r=Object.fromEntries(b.map(g=>[g,ne(o.dimensions[g],e,y=>i[g](y)!==void 0,y=>rt(u,g,y))])),s=b.flatMap(g=>{const y=r[g];return y?[y.flag]:[]}),d=b.flatMap(g=>{const y=r[g];return y?[o.dimensions[g].legacy_aliases.find(yt=>yt.flag===y.flag).migration_hint]:[]}),l=it(e.outputFormat??e.output_format,r.encoding),f=nt(e.outputInclude??e.output_include,r.include),a=ot(e.outputLimit??e.output_limit,r.amount),p=ut(e.outputBudget??e.output_budget,r.cost),_=oe(t,r,u,e),c=Pt(t,{generateFallback:!0}),h=l?.value==="json"||e.resolvedOutputFormat==="json"?"json":"toon",O=p??(_?{source:"intent",value:"unbounded"}:{source:"default",value:c.default_max_estimated_tokens_by_format[h]});return{command:n,include:f,amount:a,cost:O,encoding:l,canonical_options_used:ue({include:f,amount:a,cost:O,encoding:l},u),legacy_aliases_used:s,migration_hints:d,precedence:J}}function m(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}const F=new Set(["applied_bound","applied_limit","completeness","continuation_kind","continuation_path","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","budget_retention_policy","row_contract","sorting","total","truncated"]),ie=["collection_counts","notes_count","tests_count"];function at(t,e){const n=new Set(e.map(o=>o.split(".")[0]));return Object.fromEntries(Object.entries(t).filter(([o])=>n.has(o)))}function re(t){const e=m(t.item)?t.item:{},n=[...new Set([...Object.keys(e),...ie.filter(u=>Object.hasOwn(e,u))])].sort((u,i)=>u.localeCompare(i)),o=Object.keys(t).filter(u=>u!=="item"&&u!=="read_output"&&!F.has(u)).sort((u,i)=>u.localeCompare(i));return{item:e,itemFields:n,sections:o,valid:[...n,"item",...n.map(u=>`item.${u}`),...o]}}function se(t,e){const n=re(t),o=e.filter(a=>!n.valid.includes(a));if(o.length>0)throw new R(`Unknown --output-include selector(s) for get: ${o.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,w.USAGE);const u=e.includes("item"),i=e.flatMap(a=>a.startsWith("item.")?[a.slice(5)]:n.itemFields.includes(a)?[a]:[]).filter((a,p,_)=>_.indexOf(a)===p);if(u&&i.length>0)throw new R("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.",w.USAGE);const r=new Set(e.filter(a=>n.sections.includes(a))),s=Object.fromEntries(Object.entries(t).filter(([a])=>F.has(a)||r.has(a)));u?s.item=n.item:i.length>0&&(s.item=at(n.item,i));const d=[...u?[]:i.length>0?n.itemFields.filter(a=>!i.includes(a)).map(a=>({name:`item.${a}`,restore_with:`--output-include item.${a}`})):[{name:"item",restore_with:"--output-include item"}],...n.sections.filter(a=>!r.has(a)).map(a=>({name:a,restore_with:`--output-include ${a}`}))],f=[...m(s.omission_receipt)&&Array.isArray(s.omission_receipt.omitted_field_groups)?s.omission_receipt.omitted_field_groups:[],...d];return s.omission_receipt={has_omissions:f.length>0,omitted_field_group_count:f.length,omitted_field_groups:f},s}function ct(t){let e=0;return H({...t},n=>(m(n)&&Object.keys(n).length>0&&(e+=1),n)),e}function ae(t,e,n,o){if(ct(e)===0||ct(n)>0)return;const u=[...et(t).keys()],i=u.length>0?` Declared ${t} projection modes: ${u.join(", ")}.`:` The ${t} surface declares no projection modes; name row fields instead.`;throw new R(`Unknown --output-include selector(s) for ${t}: ${o.join(", ")}. No selector matched any returned row field.${i}`,w.USAGE)}function ce(t,e,n){if(t==="get")return se(e,n);const o=Nt(e),u=n.flatMap(r=>o.flatMap(s=>r.startsWith(`${s}.`)?[r.slice(s.length+1)]:[])),i=n.some(r=>Object.hasOwn(e,r.split(".")[0])&&!o.some(s=>r.startsWith(`${s}.`)));if(o.length>0&&(!i||u.length>0)){const r={...e},s=u.length>0?u:n,d=H(r,l=>m(l)?at(l,s):l);return ae(t,e,d,s),d}return Object.fromEntries(Object.entries(e).filter(([r])=>n.some(s=>s.split(".")[0]===r)||F.has(r)))}function de(t,e,n,o){if(e==="unbounded")return t;const{result:u,truncated:i}=Ut(t,e,r=>x(n,r));if(!i)return u;if(u.has_more=!0,u.truncated=!0,mt(u,n,[...o.entries()].flatMap(([r,s])=>s.rows>e?[{path:r,total_rows:s.totalRows}]:[])),typeof u.count=="number"){const r=m(u.projection)?u.projection.row_key:void 0;u.count=typeof r=="string"&&Array.isArray(u[r])?u[r].length:K(u)}return typeof u.returned_count=="number"&&(u.returned_count=K(u)),u.applied_bound={kind:"output_limit",source:"explicit",value:e},u}function le(t){return b.filter(e=>t[e]!==void 0&&t[e]?.source!=="default"||t.canonical_options_used.includes(C[e]))}function j(t,e,n,o){let u=W(t,e,o);k(t,u);for(let i=0;i<8;i+=1){const r=n.estimated_tokens,s=u.read_session.spent_this_call_tokens;T(u,n,o);const d=u;u=W(u,e,o),k(d,u);const l=u.read_session.spent_this_call_tokens;if(n.estimated_tokens===r&&l===s)return u}return u}function fe(t,e){if(!m(t.read_output))return t;const n=V(e),o=t.read_output,u=U(e.outputSession??e.output_session);return u===void 0?(T(t,o,n),t):j(t,u,o,n)}function dt(t,e){if(t!=="validate")return e;const n=m(e.projection)?e.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(a=>m(a)&&a.name==="diagnostic_rows"))return e;const u=[...new Set(Y(e).map(({path:a})=>a).filter(a=>/^checks\.\d+\.details\./u.test(a)))],i=u.filter(a=>!u.some(p=>p!==a&&a.startsWith(`${p}.`)));if(i.length===0)return e;const r=m(e.row_contract)?e.row_contract:{},s=Array.isArray(r.row_keys)?r.row_keys.filter(a=>typeof a=="string"):[],d=Array.isArray(r.continuation_row_keys)?r.continuation_row_keys.filter(a=>typeof a=="string"):[],l=s.length>0?s:i,f=[...new Set(i)];return JSON.stringify(l)===JSON.stringify(s)&&JSON.stringify(f)===JSON.stringify(d)?e:{...e,row_contract:{...r,row_keys:l,continuation_row_keys:f,jq_selector:typeof r.jq_selector=="string"?r.jq_selector:".checks[].details"}}}function pe(t,e){return t.include?.source==="canonical"&&!L(e)}function lt(t,e){let n={...t};return pe(e,t)&&(n=ce(e.command,n,e.include.value)),e.command==="assurance"?Bt(n):n}function _e(t,e){const n=z(e)?.continuationBinding;if(n===void 0)return;const o=lt(dt(t.command,n),t);return new Map(v(o).filter(u=>!x(t.command,u.path)).map(u=>[u.path,u]))}function me(t,e,n,o,u){let i=lt(t,e);P(i,t);const r=_e(e,u);if(i=Mt(i,e.command,o,r),e.command==="history"&&o){const l=["compact_history","provenance_history","history","diff"];if(i=Object.fromEntries(Object.entries(i).filter(([f])=>!l.includes(f)||f===o.path)),m(i.projection)&&(i.projection={...i.projection,row_key:o.path}),m(i.row_contract)){const f=i.row_contract;i.row_contract={...f,row_keys:[o.path],...Array.isArray(f.continuation_row_keys)?{continuation_row_keys:[o.path]}:{}}}i.count=Object.keys(i[o.path]).length}const s=t.count_only===!0?{...i,count_only:!0,count:t.count}:i,d=Ae(i,t,e.command,o,u,r);return e.amount?.source==="canonical"&&(i=de(i,e.amount.value,e.command,d.collectionsBeforeBudget),d.cursorContinuesExistingPage&&Ot(i,d.originalItems,d.cursorSource,!0,d.originalItemOffset)),P(i,s),gt(i,e.command,d),{projected:n===void 0?i:qt(i,n),continuationState:d}}function ge(t,e){return[...t.cost!==void 0&&t.cost.value!=="unbounded"&&(t.cost.source==="canonical"||t.cost.source==="default"||t.command==="context"&&t.cost.source==="legacy")?[{source:t.cost.source,tokens:t.cost.value}]:[],...e===void 0?[]:[{source:"session",tokens:Vt(e)}]].sort((o,u)=>o.tokens-u.tokens)[0]}function ft(t){const e=t.canonical_options_used;return e&&e.length>0?{canonical_options_used:e}:{}}function pt(t,e){return m(t.context_intent)&&t.context_intent.command==="context"&&t.context_intent.token_budget===e&&t.context_intent.within_budget===!0}function Oe(t,e,n){return t.command!=="next"||(e.tokenBudget??e.token_budget)===void 0?!1:!(m(n.context_intent)&&n.context_intent.command==="next"&&n.context_intent.within_budget===!0)}function _t(t,e={}){return t?.source==="default"||t?.source==="legacy"&&!pt(e,t.tokens)?{budget_source:t.source,budget_tokens:t.tokens}:{}}function he(t,e,n,o,u,i){const r={contract_version:1,command:t.command,requested_dimensions:e,..._t(o),precedence:t.precedence,...ft(t),legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0,...n===void 0?{omitted_result_estimated_tokens:u}:{}},s={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:r},d=n===void 0?s:j(s,n,r,i);if(n===void 0&&T(d,r,i),n!==void 0&&r.estimated_tokens>o.tokens)throw new R("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",w.USAGE);return d}function ye(t,e,n){return t.command==="context"&&t.cost?.source==="legacy"&&!pt(n,t.cost.value)||Oe(t,e,n)||e.outputRowContract===!0||e.output_row_contract===!0||t.canonical_options_used.includes("--output-include")||t.command==="list"&&t.canonical_options_used.length>0&&t.include?.value.includes("full")===!0}function we(t,e,n,o,u){if(e!==void 0||L(n)||ye(t,u,n))return!1;if(t.amount?.source==="canonical"&&t.amount.value!=="unbounded"){const i=t.amount.value;if(Dt(n).some(({value:r})=>(Array.isArray(r)?r.length:Object.keys(r).length)>i))return!1}return t.cost===void 0||t.cost.value==="unbounded"||t.cost.source==="legacy"&&t.command!=="context"||xt(u.outputRowContract===!1?Object.fromEntries(Object.entries(n).filter(([i])=>i!=="row_contract")):n,o)<=t.cost.value}function mt(t,e,n){const o=Object.hasOwn(S,e)?S[e]:void 0,u=n.find(i=>o?.paths.includes(i.path));o!==void 0&&u!==void 0&&typeof t[o.total_key]!="number"&&(t[o.total_key]=u.total_rows)}function gt(t,e,n){const o=S[e]?.paths[0];o!==void 0&&$t(t,e,n.producer,n.collectionsBeforeBudget.get(o)?.rows)}function Re(t,e,n,o){const u=n.backward?n.rows-o:n.baseOffset+o;return{path:e,cursor:Lt({command:t,path:e,offset:u,total_rows:n.totalRows,fingerprint:n.fingerprint,...n.backward?{direction:"backward"}:{}}),retained_rows:o,remaining_rows:n.backward?u:n.totalRows-u,total_rows:n.totalRows}}function be(t,e,n,o,u,i,r){if(!n.rows_compacted)return;const s=e.amount?.value==="unbounded"?["amount"]:[],d=new Map(v(t).map(c=>[c.path,Array.isArray(c.value)?c.value.length:Object.keys(c.value).length])),l=[...r.entries()].flatMap(([c,h])=>{const O=d.get(c);return O>=h.rows?[]:[Re(e.command,c,h,O)]}),f=l[0];mt(t,e.command,l);const a=f?"; page --output-cursor":"",p=o.source==="session"?`Truncated by the remaining ${o.tokens}-token session budget; start a new output session with a larger token_budget${a}.`:`${o.tokens}-token: raise --output-budget${a}`;n.migration_hints=[p,...e.migration_hints];const _=vt({effective_budget_tokens:o.tokens,measured_result_tokens:i});f&&!u&&(typeof t.next_cursor!="string"||t.continuation_kind==="output_cursor")&&(t.next_cursor=f.cursor),t.continuation_kind=u?"producer_cursor":f?"output_cursor":"none",t.output_budget_truncation={reason:"output_budget_reached",budget_source:o.source,budget_tokens:o.tokens,overridden_dimensions:s,compacted_row_paths:n.compacted_row_paths,continuation_cursor_rebased:u,continuation_available:l.length>0,recovery_budget_multiplier:f?1:_.recovery_budget_multiplier,continuations:l,restore_with:f?"recovery":`Retry with --output-budget ${_.output_budget} because no declared row collection can be continued.`,recovery:f?{cursor:f.cursor,cli:"--output-cursor",sdk:"outputCursor",mcp:"outputCursor"}:{cli:`--output-budget ${_.output_budget}`,sdk:{outputBudget:_.output_budget},mcp:{outputBudget:_.output_budget}}}}function Ot(t,e,n,o,u){if(typeof n!="string"||!Array.isArray(t.items))return!1;const i=t.items.length,r=e.length;if(i===0||i>=r)return!1;let s;try{s=zt(n)}catch{return!1}const d=s.after_index;if(d===void 0)return!1;const l=e[i-1];if(Object.prototype.toString.call(l)!=="[object Object]")return!1;const f=Reflect.get(l,"id");if(typeof f!="string"||f.length===0)return!1;const a=o?d-(r-i):d+u+i;return a<0?!1:(t.next_cursor=Kt(s.fingerprint,f,a,s.snapshot),!0)}function ht(t){return Array.isArray(t)?t.length:Object.keys(t).length}function Ae(t,e,n,o,u,i){const r=new Map(v(t).map(l=>{const f=ht(l.value),a=o?.path===l.path,p=x(n,l.path),_=i?.get(l.path)??l;let c;return[l.path,{rows:f,totalRows:a?o.total_rows:ht(_.value),baseOffset:a&&!p?o.offset:0,backward:p,get fingerprint(){return c??=a?o.fingerprint:Gt(l.path,_.value,n),c}}]})),s=typeof t.next_cursor=="string",d=o?.path==="items"?o.offset:0;return{collectionsBeforeBudget:r,originalItems:Array.isArray(e.items)?d>0?e.items.slice(d):e.items:[],originalItemOffset:d,cursorContinuesExistingPage:s,cursorSource:s?t.next_cursor:u.after,producer:e}}function Ce(t,e,n,o,u,i,r,s,d,l,f){const a={...e,count_only:n},p=o.command==="assurance"&&Array.isArray(t.assertions)?t.assertions.filter(c=>m(c)&&c.verdict!=="pass").length:0,_=new Map;if(p>0&&_.set("assertions",p),o.command==="history"&&Array.isArray(t.diff))for(const c of Y(t))c.path.startsWith("diff.")&&_.set(c.path,Object.keys(c.value).length);return St(t,u,i.tokens,_,l,c=>{P(c,a),gt(c,o.command,s);const h=Ot(c,s.originalItems,s.cursorSource,s.cursorContinuesExistingPage,s.originalItemOffset);if(be(c,o,u,i,h,d,s.collectionsBeforeBudget),o.command==="history"&&m(c.projection)){c.has_more=typeof c.next_cursor=="string"||c.applied_bound?.kind==="output_limit";const O=c.projection.row_key;typeof O=="string"&&Array.isArray(c[O])&&(c.count=c[O].length)}r!==void 0&&Object.assign(c,j(c,r,u,l))},o.command==="history"&&Array.isArray(t.diff),c=>x(o.command,c),o.command,f)}const Ee=/^command_flags\.\d+\.flags$/u;function ke(t,e){const n=t==="contracts"&&m(e.selected)&&e.selected.command_scoped===!0;return o=>n&&Ee.test(o)}function Ze(t,e,n){const o=st(t,e);if(!o)return n;const u=V(e),i=U(e.outputSession??e.output_session),r=e.outputCursor??e.output_cursor,s=typeof r=="string"?Ft(r):void 0,d=le(o),l=dt(o.command,n);if(s===void 0&&we(o,i,l,u,e))return l;const f=ge(o,i),a=me(l,o,i,s,e);let p=a.projected;k(p,p,e.outputRowContract===!1);const _=L(p),c={contract_version:1,command:o.command,requested_dimensions:d,..._t(f,p),precedence:o.precedence,...ft(o),legacy_aliases_used:o.legacy_aliases_used,migration_hints:o.migration_hints,estimated_tokens:0,within_budget:!_,strings_compacted:!1,rows_compacted:!1,result_omitted:_};p.read_output=c;const h=z(e)?.mirrorEstimate;if(h!==void 0&&jt(c,h),p=i===void 0?p:j(p,i,c,u),T(p,c,u),f!==void 0&&c.estimated_tokens>f.tokens){const O=It(o.command,e,p);O!==void 0&&(c.applied_depth="brief",c.degradation_reason="output_budget_reached",k(p,O),p=fe(O,e)),c.estimated_tokens>f.tokens&&(p=Ce(p,p,l.count_only===!0,o,c,f,i,a.continuationState,c.estimated_tokens,u,ke(o.command,l)))}return f!==void 0&&c.estimated_tokens>f.tokens?he(o,d,i,f,c.estimated_tokens,u):p}function Te(t){return m(t)&&m(t.context_intent)&&t.context_intent.result_omitted===!0}function L(t){return Se(t)||Te(t)}function Se(t){return m(t)&&m(t.output_budget_exceeded)&&t.output_budget_exceeded.omitted_result===!0&&t.output_budget_exceeded.reason==="requested_budget_infeasible"}function tn(t,e){const n=e.outputFormat??e.output_format;if(n==="json"||n==="toon")return n;const o=st(t,e)?.encoding;return o?.value==="json"||o?.value==="toon"?o.value:void 0}export{Ke as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,an as PM_READ_OUTPUT_CONTINUATION_FINGERPRINT_POLICIES,b as PM_READ_OUTPUT_DIMENSIONS,ze as PM_READ_OUTPUT_OPTION_FLAGS,_n as PM_READ_OUTPUT_SURFACES,Yt as PM_READ_OUTPUT_SURFACE_CONTRACTS,ln as PM_READ_OUTPUT_TAIL_RETENTION_POLICIES,Ye as READ_OUTPUT_MUTATION_CONFLICT_CODE,We as READ_OUTPUT_SHAPING_CONTROL_FLAGS,He as READ_OUTPUT_SURFACE_UNSUPPORTED_CODE,Je as annotationPositionalMutationOptions,Ze as applyReadOutputDimensions,ee as applyReadOutputIncludeModes,rn as decodeReadOutputContinuationCursor,sn as encodeReadOutputContinuationCursor,Se as isReadOutputBudgetExceeded,L as isReadResultOmittedForBudget,Qe as normalizeReadOutputIncludeModeOptions,cn as readOutputCollectionFingerprint,et as readOutputIncludeModeOptions,fn as readOutputRetainsTail,st as resolveReadOutputDimensions,tn as resolveReadOutputEncoding,on as resolveReadOutputRecoveryBudget,I as resolveReadOutputSurface,fe as stabilizeReadOutputReceiptEstimates,Xe as validateReadOutputOptions};
|
|
2
2
|
//# sourceMappingURL=read-output-contracts.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const b=new Set(["applied_bound","completeness","budget_retention_policy","continuation_contract","continuation_kind","continuation_path","filters","omission_receipt","output_budget_truncation","projection","read_output","read_session","row_contract","sorting"]);function u(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function A(t,r){let e=t;for(const n of r.split("."))if(Array.isArray(e)){if(!/^\d+$/u.test(n))return;e=e[Number(n)]}else{if(!u(e))return;e=e[n]}return e}function y(t,r,e){const n=r.split("."),
|
|
1
|
+
const b=new Set(["applied_bound","completeness","budget_retention_policy","continuation_contract","continuation_kind","continuation_path","filters","omission_receipt","output_budget_truncation","projection","read_output","read_session","row_contract","sorting"]);function u(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function A(t,r){let e=t;for(const n of r.split("."))if(Array.isArray(e)){if(!/^\d+$/u.test(n))return;e=e[Number(n)]}else{if(!u(e))return;e=e[n]}return e}function y(t,r,e){const n=r.split("."),s=(i,o)=>{if(o===n.length)return e;const c=n[o];if(Array.isArray(i)){const l=Number(c),f=[...i];return f[l]=s(i[l],o+1),f}const a=i;return{...a,[c]:s(a[c],o+1)}};return s(t,0)}function C(t,r,e,n){const s=w(t).find(c=>c.path===r);if(!s)return t;const i=Array.isArray(s.value)?s.value.slice(e,n):Object.fromEntries(Object.entries(s.value).slice(e,n)),o=y(t,r,i);return r==="matches"&&typeof o.count=="number"&&Array.isArray(i)&&(o.count=i.length),u(o.summary)&&u(o.summary.focus_row_states)&&typeof o.summary.focus_row_states[r]=="string"&&(o.summary={...o.summary,focus_row_states:{...o.summary.focus_row_states,[r]:o.summary.focus_row_states[r].slice(e,n)}}),S(o),o}function g(t){const r=t.row_contract;return u(r)&&Array.isArray(r.row_keys)?r.row_keys.filter(e=>typeof e=="string"&&e.trim().length>0):Object.entries(t).filter(([,e])=>Array.isArray(e)).map(([e])=>e)}function O(t){const r=t.row_contract;return u(r)&&Array.isArray(r.continuation_row_keys)?r.continuation_row_keys.filter(e=>typeof e=="string"&&e.trim().length>0):g(t)}function p(t){return g(t).flatMap(r=>{const e=A(t,r);return Array.isArray(e)||u(e)?[{path:r,value:e}]:[]})}function w(t){return O(t).flatMap(r=>{const e=A(t,r);return Array.isArray(e)||u(e)?[{path:r,value:e}]:[]})}function x(t){const r=p(t),e=new Set(r.map(s=>s.path)),n=(s,i)=>{if(Array.isArray(s)){e.has(i)||r.push({path:i,value:s}),s.forEach((o,c)=>n(o,`${i}.${c}`));return}if(u(s))for(const[o,c]of Object.entries(s))i.length===0&&b.has(o)||n(c,i.length===0?o:`${i}.${o}`)};return n(t,""),r}function E(t){return p(t).reduce((r,e)=>r+(Array.isArray(e.value)?e.value.length:Object.keys(e.value).length),0)}function M(t,r){let e=t;for(const n of p(e)){const s=Array.isArray(n.value)?n.value.map((i,o)=>r(i,n.path,o)):Object.fromEntries(Object.entries(n.value).map(([i,o],c)=>[i,r(o,n.path,c)]));e=y(e,n.path,s)}return e}function $(t,r,e=()=>!1){let n=t,s=!1;for(const i of p(n)){const o=Array.isArray(i.value)?i.value:Object.entries(i.value);if(o.length<=r)continue;s=!0;const c=e(i.path)?o.length-r:0,a=o.slice(c,c+r),l=Array.isArray(i.value)?a:Object.fromEntries(a);n=y(n,i.path,l)}return{result:n,truncated:s}}const h=["high_level","low_level","blocked_fallback"];function m(t){const r=t.status==="in_progress"?"i":"o";return t.blocked===!0?r.toUpperCase():r}function k(t,r){if(!u(t.summary)||!u(t.summary.returned_focus))return;const e=new Map(r.map(n=>[n.id,n]));t.summary={...t.summary,focus_row_states:Object.fromEntries(h.map(n=>[n,Array.isArray(t[n])?t[n].filter(u).map(s=>m(e.get(s.id)??s)).join(""):""]))}}function v(t,r){if(t!==void 0){if(typeof t!="string"||t.length!==r||!/^[iIoO]*$/u.test(t))throw new TypeError("Context focus classification receipt must contain one i/I/o/O code per delivered record");return t}}function j(t,r,e,n){const s=Array.isArray(r[e])?r[e].filter(u):[],i=v(n[e],s.length)??s.map(m).join(""),o=new Map(s.flatMap((f,d)=>f.id===void 0?[]:[[f.id,i[d]]])),c=Array.isArray(t[e])?t[e].filter(u):[];let a=!1;return{states:c.map((f,d)=>{const _=o.get(f.id)??(f.id===void 0?i[d]:void 0)??m(f);return _!==m(f)&&(a=!0),_}).join(""),needsStates:a}}function R(t,r){typeof t.count=="number"&&(t.count_only===!0||r.count_only===!0?typeof r.count=="number"&&(t.count=r.count):Array.isArray(t.items)&&(t.count=t.items.length))}function S(t,r=t){if(R(t,r),!u(t.summary)||!u(t.summary.returned_focus))return;const e={...t.summary},n=u(r.summary)&&u(r.summary.focus_row_states)?r.summary.focus_row_states:{},s=h.map(a=>({key:a,...j(t,r,a,n)})),i=Object.fromEntries(s.map(({key:a,states:l})=>[a,l])),o=s.some(a=>a.needsStates),c=Object.values(i).join("");typeof e.high_level=="number"&&(e.high_level=Array.isArray(t.high_level)?t.high_level.length:0),typeof e.low_level=="number"&&(e.low_level=Array.isArray(t.low_level)?t.low_level.length:0),e.returned_focus={active_items:c.length,in_progress:[...c].filter(a=>a.toLowerCase()==="i").length,open:[...c].filter(a=>a.toLowerCase()==="o").length,blocked:[...c].filter(a=>a===a.toUpperCase()).length},o?e.focus_row_states=i:delete e.focus_row_states,t.summary=e}export{$ as boundReadOutputRows,E as countReadOutputRows,M as mapReadOutputRows,x as readOutputBudgetCollections,w as readOutputContinuationRowCollections,O as readOutputContinuationRowPaths,p as readOutputRowCollections,g as readOutputRowPaths,S as refreshReadOutputDeliveredCounts,k as rememberReadOutputFocusRows,C as sliceReadOutputRowCollection};
|
|
2
2
|
//# sourceMappingURL=read-output-rows.js.map
|
package/docs/COMMANDS.md
CHANGED
|
@@ -1846,6 +1846,43 @@ back to the registered description), so agents never need a generic
|
|
|
1846
1846
|
`Inspect flags.` placeholder. Request heavier command-specific flags or schemas
|
|
1847
1847
|
only after selecting the exact path.
|
|
1848
1848
|
|
|
1849
|
+
A command-scoped contract lists two row sets: `flags`, the options the command
|
|
1850
|
+
declares, and `inherited_flags`, the host flags it accepts from the root program,
|
|
1851
|
+
each marked `owner: "host"`
|
|
1852
|
+
([pm-6vk110](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-6vk110.toon),
|
|
1853
|
+
tracker record excluded from npm). A core command inherits `--json`, `--quiet`,
|
|
1854
|
+
`--pm-path`, `--no-extensions` and the other reserved host flags; the read-output
|
|
1855
|
+
controls (`--output-include`, `--output-limit`, `--output-budget`,
|
|
1856
|
+
`--output-session`, `--output-cursor`, `--output-row-contract`) appear only on
|
|
1857
|
+
read surfaces, because every other core command refuses them with
|
|
1858
|
+
`read_output_surface_unsupported`. `--expect-hash` follows the runtime's
|
|
1859
|
+
admission rule: it is omitted and refused with `expect_hash_requires_mutation`
|
|
1860
|
+
on reads, the static package inventory and read-only subcommands such as
|
|
1861
|
+
`files lookup`; native mutations that write no existing item (`config`, `gc`,
|
|
1862
|
+
`profile`) still admit it for now, and refusing them there is pending
|
|
1863
|
+
([pm-oehf5s](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-oehf5s.toon),
|
|
1864
|
+
tracker record excluded from npm). A host
|
|
1865
|
+
flag the command publishes itself, such as `close --author` or an
|
|
1866
|
+
`--output-format` encoding row, stays in `flags` and is not repeated. Under the
|
|
1867
|
+
default output budget a command-scoped contract keeps every declared flag and
|
|
1868
|
+
sheds inherited rows and per-flag invocation detail first. `pm help <command> --json` lists the same
|
|
1869
|
+
rows as `inherited_options`. An unscoped catalog omits the core rows instead of
|
|
1870
|
+
repeating them on every command and says so in
|
|
1871
|
+
`core_inherited_flags_omitted_reason`.
|
|
1872
|
+
|
|
1873
|
+
Executable subcommands have their own entries, so `pm contracts --command "files
|
|
1874
|
+
discover"` and `pm contracts --command "files lookup"` publish exactly the flags
|
|
1875
|
+
those parsers accept, and the `files` entry lists only what `pm files <id>`
|
|
1876
|
+
accepts. A census over the command tree fails when an executable command has no
|
|
1877
|
+
entry, or when a contract row and the parser disagree
|
|
1878
|
+
([pm-9ke7h9](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-9ke7h9.toon),
|
|
1879
|
+
tracker record excluded from npm). An invalid-value refusal offers an executable
|
|
1880
|
+
retry only when it can bind the refused flag, from the producer's field or the one
|
|
1881
|
+
supplied flag its message names, and rewrites only that flag's value; a missing or
|
|
1882
|
+
ambiguous binding withholds the retry and keeps the help and contract guidance
|
|
1883
|
+
([pm-s1fw0x](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-s1fw0x.toon),
|
|
1884
|
+
tracker record excluded from npm).
|
|
1885
|
+
|
|
1849
1886
|
## Completion
|
|
1850
1887
|
|
|
1851
1888
|
`pm completion` is provided by the optional `guide-shell` package (`pm package install guide-shell --project`).
|
|
@@ -238,7 +238,12 @@ keys (including temporary keys), Google, Anthropic, OpenAI, GitLab, Sentry,
|
|
|
238
238
|
private keys, JWT-shaped tokens, npm authentication assignments, password
|
|
239
239
|
assignments, inline sshpass passwords, private IPv4 addresses, private SSH
|
|
240
240
|
hosts, and absolute home-directory paths. Every repository rule also runs
|
|
241
|
-
against mutation string leaves in `advise` and `block` modes.
|
|
241
|
+
against mutation string leaves in `advise` and `block` modes. JWT-shaped tokens
|
|
242
|
+
are found by a scan with exactly the pattern's matches that examines each
|
|
243
|
+
segment run a bounded number of times, so text made of repeated `-eyJ` runs
|
|
244
|
+
stays linear
|
|
245
|
+
([pm-8oetjo](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-8oetjo.toon);
|
|
246
|
+
tracker record excluded from npm).
|
|
242
247
|
|
|
243
248
|
Two repository fixture exemptions apply only to `tests/` and `examples/`:
|
|
244
249
|
absolute home paths and user-at-private-host matches. They never exempt
|
|
@@ -475,8 +480,9 @@ decodes to `$`, as JSON and JavaScript readers decode it.
|
|
|
475
480
|
|
|
476
481
|
Each candidate key/value is judged by the rule's own value grammar. The
|
|
477
482
|
password rule's literal minimum, the credential-key placeholder exclusions
|
|
478
|
-
and the high-entropy predicate therefore carry over.
|
|
479
|
-
|
|
483
|
+
and the high-entropy predicate therefore carry over. The string walk never
|
|
484
|
+
judges a bare token inside a container, so `password=[scrubbed]` stays clean;
|
|
485
|
+
numbers in a container are judged by the separate number walk described below. A
|
|
480
486
|
structured string literal that spans a raw line break is a host-language
|
|
481
487
|
artifact, not a credential. The pass is linear. Nested keys inside a
|
|
482
488
|
walked container still get their own scalar check. Each container is walked
|
|
@@ -542,15 +548,186 @@ compactly (whitespace-free) under a prefixed key or as an object member's
|
|
|
542
548
|
value under any credential key above it. The finding reports the leaf's path,
|
|
543
549
|
never its value. `{ api_key: "…" }`, `{ clientSecret: "…" }` and
|
|
544
550
|
`{ password: ["…"] }` are therefore judged like `{"api_key":"…"}`, and pm's
|
|
545
|
-
own fields such as `token_budget`, `max_tokens` and
|
|
551
|
+
own fields such as `token_budget`, `max_tokens` and `estimated_minutes` stay
|
|
552
|
+
clean, because no credential key names them.
|
|
546
553
|
A payload string is complete data, so it is judged as a decoded literal
|
|
547
554
|
whether or not its JSON spelling needs escapes: its quote characters are
|
|
548
555
|
data, and an unclosed reference in it is literal text (the source-text rule
|
|
549
|
-
for a reference cut by the grammar never applies).
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
556
|
+
for a reference cut by the grammar never applies). A finite number or a
|
|
557
|
+
bigint under a credential key is judged as its JSON spelling: the unquoted
|
|
558
|
+
`JSON.stringify` spelling of a finite number (with its sign, decimal point or
|
|
559
|
+
exponent, such as `1e+21`), or the base-10 digits of a bigint
|
|
560
|
+
(GH-1802,
|
|
561
|
+
[pm-gh1802](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1802.toon);
|
|
562
|
+
tracker record excluded from npm): `{ password: { pin: <nine digits> } }` is
|
|
563
|
+
reported like `{"password":{"pin":<nine digits>}}`, while a number shorter
|
|
564
|
+
than the rule's literal minimum stays clean. In text, a number inside an array
|
|
565
|
+
or a nested object under a credential key is judged exactly as the same number
|
|
566
|
+
directly after the key. Strings keep their container walk unchanged; numbers
|
|
567
|
+
get a walk of their own, which reads JSON, JSON-like text and the
|
|
568
|
+
JSON-compatible subset of YAML flow. There a number (a JSON number, or a YAML
|
|
569
|
+
decimal such as `+5`, `.5` or `5.`) must start where a value starts and a
|
|
570
|
+
delimiter, a closer or the end must end it, so `abc123` and other bare tokens
|
|
571
|
+
stay unjudged. A value starts after an array opener, a separator, or a colon
|
|
572
|
+
that YAML flow reads as a separator: one after a quoted key (`"pin":1`), or one
|
|
573
|
+
before a blank, a flow indicator or the end (`pin: 1`, `items:[1]`, also as an
|
|
574
|
+
implicit mapping inside an array), so the
|
|
575
|
+
digits after a colon inside a plain scalar (`{ref:2026…}`, `[ref:2026…]`) are
|
|
576
|
+
not a value. A container that
|
|
577
|
+
holds one of these constructs only YAML has is not judged for numbers at all: a
|
|
578
|
+
blank-separated comment, an anchor, alias or tag, an explicit key (`?` before
|
|
579
|
+
a blank, a delimiter, an opener or the end), a bare YAML 1.1 merge key (`<<`), a collection used as a key, a doubled quote
|
|
580
|
+
inside a single-quoted string, a quoted string folded over a line break, a
|
|
581
|
+
double-quoted string with an escape JSON does not define, a backslash outside
|
|
582
|
+
a string, or a quote inside a bare token (`pin's`, `item-"x`): JSON has neither,
|
|
583
|
+
so escaped text read raw, or a quote the text lexer may pair differently, is
|
|
584
|
+
never read as structure. Two values with no separator between them (a
|
|
585
|
+
collection or a token, quoted or bare, right after a collection, a number or a
|
|
586
|
+
quoted string: `[[] {}]`, `[1 []]`, `[[] "a"]`, `["a" b]`) and a second
|
|
587
|
+
separator colon in one member or array element (`{a: b: 1}`, `["a": "b": 1]`)
|
|
588
|
+
also stop the walk, since neither JSON nor YAML flow allows them; separated by
|
|
589
|
+
commas the values are ordinary, as is one colon per member or implicit array
|
|
590
|
+
mapping. A YAML-only scalar spelling that is not
|
|
591
|
+
one of them (a hexadecimal `0x2a`, `.inf`) is a bare token the walk skips: it is
|
|
592
|
+
not judged, and a decimal beside it still is. A single-quoted string that holds a backslash also stops the walk,
|
|
593
|
+
because YAML reads the backslash literally and Python reads it as an escape,
|
|
594
|
+
so the two dialects disagree on where the string ends. A number is reported
|
|
595
|
+
only once the container it sits in closes with its matching closer: a
|
|
596
|
+
mismatched closer, or text or an enclosing string that ends first, means no
|
|
597
|
+
finding. The closed container must also be a value, not a key (no separator
|
|
598
|
+
colon follows it, as in `{"pin":[1]: 0}`), and, read on its own, a real
|
|
599
|
+
parser must accept it: `JSON.parse`, or a strict YAML 1.2 parse (the `yaml`
|
|
600
|
+
dependency, loaded on first use) that reports no error and reads one of the
|
|
601
|
+
judged numbers as a numeric scalar at the same offset (a bare carriage return
|
|
602
|
+
after digits belongs to a YAML plain scalar, so there the value is a string,
|
|
603
|
+
while JSON reads the carriage return as whitespace). A container too deep
|
|
604
|
+
for the YAML parser (it records the stack overflow as `RESOURCE_EXHAUSTION`;
|
|
605
|
+
how deep that is depends on the runtime's stack, so the spec simulates the
|
|
606
|
+
error) was never read, so when that is the only parse error a pending number there
|
|
607
|
+
is reported with `normalization_incomplete` for review instead of being
|
|
608
|
+
dropped, unless every judged number lies inside a scalar the parser did
|
|
609
|
+
compose and none qualifies (a number under a metadata key stays exempt; a
|
|
610
|
+
number qualifies only as a numeric scalar starting at its offset). It takes
|
|
611
|
+
precedence over a string finding in the same container, so the review flag
|
|
612
|
+
reaches the caller. After a string finding the number walk runs only as a
|
|
613
|
+
probe for such a number. Every number walk, probe or not, is skipped inside
|
|
614
|
+
a range a recorded walk already covered; a probe is also skipped inside a
|
|
615
|
+
range an earlier probe covered, whatever that probe's verdict, and records
|
|
616
|
+
only probe ranges, so recorded walks never see probes. Ranges are kept per
|
|
617
|
+
key class, as for the other walks (a walk or probe of an exact key covers
|
|
618
|
+
later ones of both classes in its range, one of a prefixed key only later
|
|
619
|
+
prefixed ones), so within one rule reading and lexical scope at most two
|
|
620
|
+
recorded ranges and two probe ranges cover any offset, and nested string
|
|
621
|
+
findings keep the scan linear. A match therefore carries
|
|
622
|
+
`normalization_incomplete` only from its own walk's or probe's verdict, which
|
|
623
|
+
flags that container's match rather than a particular number. A nested key
|
|
624
|
+
whose walk or probe was skipped contributes no number verdict or review flag
|
|
625
|
+
of its own; only the earlier walks and probes covering it report, each for
|
|
626
|
+
its own container, so a number reachable only through the skipped scan is a
|
|
627
|
+
recorded miss of the same kind as a discarded walk's, owned by pm-o1ntjo. Any other parse error, or a repeated key in the part the
|
|
628
|
+
parser did read, settles the container as invalid. JSON of any depth is read by `JSON.parse`. The numeric metadata
|
|
629
|
+
exemption follows the same split: JSON reads a member name exactly as the
|
|
630
|
+
walk does, while on the YAML route it is judged by the key the parser
|
|
631
|
+
resolves (a bare carriage return before the colon stays in a YAML plain
|
|
632
|
+
key, so `exp` followed by one is another key than `exp`). A container that
|
|
633
|
+
reads as JSON on its own is judged as JSON even when the text around it is
|
|
634
|
+
YAML, where a bare carriage return after digits would make the value a
|
|
635
|
+
string: the walk cannot know the surrounding language, and valid JSON keeps
|
|
636
|
+
its findings (a recorded limit; a bare carriage return outside a string is
|
|
637
|
+
rare, and `JSON.stringify` never writes one). The hand-written walk
|
|
638
|
+
stops early at constructs outside JSON-compatible flow; the parse makes the
|
|
639
|
+
boundary exact, so YAML's own rules apply too: no empty entries, one colon per
|
|
640
|
+
entry, the implicit key of a single-pair entry in a flow sequence on one line
|
|
641
|
+
and at most 1,024 UTF-16 code units from its start to its colon, blanks
|
|
642
|
+
included (the parser's count; the YAML spec counts characters, and sets no
|
|
643
|
+
such limit for keys inside a flow mapping), no scalar starting with a
|
|
644
|
+
reserved indicator such as `@` or `- `, no
|
|
645
|
+
document markers, and unique keys, while a JSON text with duplicate names
|
|
646
|
+
still counts. Key uniqueness is checked in one pass with a set per mapping,
|
|
647
|
+
judging keys as the parser does (a scalar by its resolved value, a collection
|
|
648
|
+
or tagged object by identity, mappings used as keys and `!!pairs` entries
|
|
649
|
+
included), since the
|
|
650
|
+
parser's own check compares each key with every earlier one; a `.nan` key
|
|
651
|
+
counts as a repeat, which only withholds a finding, and a key of 1,024 or more
|
|
652
|
+
characters is remembered by the SHA-256 digest of its UTF-16 code units,
|
|
653
|
+
because V8 hashes a long string by its length alone. For the same reason
|
|
654
|
+
`JSON.parse`, which interns the keys it builds, is quadratic over many long
|
|
655
|
+
keys of one length: each double-quoted run of 1,024 or more code units is
|
|
656
|
+
parsed alone, as a value, and shrunk to `""` before the text around it is
|
|
657
|
+
parsed. One string token in place of another leaves JSON validity unchanged,
|
|
658
|
+
so JSON verdicts hold exactly (repeated names, any JSON whitespace, nesting
|
|
659
|
+
deeper than the YAML parser reads). The whole confirmation path (walk, parse,
|
|
660
|
+
key check) is linear in the container's length. YAML's indentation rules relative to
|
|
661
|
+
an enclosing block are not applied, since the container is read alone. A seeded property in the spec checks that, in nested
|
|
662
|
+
flow text neither parser reads, a number never adds a finding, and that, for
|
|
663
|
+
its generated texts, readable YAML-only text reports a number finding only
|
|
664
|
+
where the scan of its parsed payload reports the same rule. That compares rule
|
|
665
|
+
names, not members: the YAML route confirms a numeric scalar at the judged
|
|
666
|
+
offset, while a payload built from the same YAML can differ (YAML keys `0` and
|
|
667
|
+
`"0"` are distinct, but a JavaScript object merges them), so it is not a
|
|
668
|
+
member-for-member parity claim. The number walk stops at that construct
|
|
669
|
+
without a finding, so inside a walked container YAML-only syntax may hide a
|
|
670
|
+
number but never creates or names one, and the walks stay linear. A walk that
|
|
671
|
+
ends without a finding, at such a construct, at a mismatched closer or at the
|
|
672
|
+
end of its text, also covers the complete containers it read before it: within
|
|
673
|
+
the same lexical scope, a discarded walk of an exact key
|
|
674
|
+
suppresses the walk of any key inside that range, and one of a prefixed key
|
|
675
|
+
suppresses only prefixed keys, so
|
|
676
|
+
such a key's numbers are not judged (a recorded miss, owned with the key scan
|
|
677
|
+
by pm-o1ntjo). Strings in
|
|
678
|
+
such a container are judged exactly as before. The key scan that starts each
|
|
679
|
+
walk is lexical, as it is for strings and flat assignments: a `password` key
|
|
680
|
+
written inside a comment, an anchor name, a tag URI or the continuation line of
|
|
681
|
+
a quoted string folded over a line break is read as text and starts its own
|
|
682
|
+
walk, so such a span can yield a number finding that YAML would not read
|
|
683
|
+
([pm-o1ntjo](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-o1ntjo.toon)
|
|
684
|
+
owns a YAML-aware key scan; tracker record excluded from npm). A walk that starts
|
|
685
|
+
inside a quoted string value reads that string's text as standalone text with
|
|
686
|
+
its own quotes (a note string holding single-quoted fragments is read as those
|
|
687
|
+
fragments), descending into each enclosing string in turn, and none starts where a
|
|
688
|
+
quote earlier on the line leaves the text lexer unsure whether it is inside a
|
|
689
|
+
string: a container that closes inside the string's text is judged, one that
|
|
690
|
+
does not is not a container, and an outer container that skipped the string
|
|
691
|
+
never suppresses the walk inside it. No raw number walk starts inside a string
|
|
692
|
+
that holds a backslash where the text lexer reads backslashes as escapes, even
|
|
693
|
+
a trailing one with nothing after it to escape (the string walk there is
|
|
694
|
+
unchanged). A valid double-quoted JSON
|
|
695
|
+
string with an escape is judged through the text it decodes to (the decoded
|
|
696
|
+
reading below); any other such string, such as an escaping single-quoted Python
|
|
697
|
+
string, is not decoded, so the raw number walk does not read a container in it
|
|
698
|
+
(a recorded miss). A number directly after its key there is still judged as a
|
|
699
|
+
raw scalar (by the flat reading for a bare key, by the structured reading for a
|
|
700
|
+
quoted key), a valid JSON literal inside it is still decoded on its own, and a
|
|
701
|
+
single-quoted form the lexer reads as shell text keeps its container walk.
|
|
702
|
+
For the numeric metadata exemption, the number walk reads a double-quoted
|
|
703
|
+
member name as JSON decodes it (`"\u0065xp"` is `exp`); the key scan that
|
|
704
|
+
recognizes credential keys reads key names as written. Text is judged as written and a payload number as
|
|
705
|
+
`JSON.stringify` spells it, so `1e10` in text is the four characters written
|
|
706
|
+
there. The key scan reads key names as written; escaped and camelCase key
|
|
707
|
+
spellings, which a payload reads too, are
|
|
708
|
+
[pm-f89x9c](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-f89x9c.toon)
|
|
709
|
+
(tracker record excluded from npm). A number whose member name, decoded, is
|
|
710
|
+
numeric metadata is not judged in either reading: a JSON Schema
|
|
711
|
+
bound (`maximum`, `minimum`, `exclusiveMaximum`, `exclusiveMinimum`,
|
|
712
|
+
`multipleOf`, and the `max`/`min` `Length`, `Items`, `Properties` and
|
|
713
|
+
`Contains` keywords) or a time field of a token or session record (`exp`,
|
|
714
|
+
`iat`, `nbf`, `expires_at`, `expires_in`, `issued_at`, `not_before`,
|
|
715
|
+
`created_at`, `updated_at` and their camelCase spellings). A bigint of
|
|
716
|
+
more than 4096 digits is not converted: it is reported for review with
|
|
717
|
+
`normalization_incomplete: true`, like a value too large for a rule's pattern.
|
|
718
|
+
A boolean, null, non-finite number or boxed value is not judged. The pass
|
|
719
|
+
spells only a judged string or finite number with `JSON.stringify` (a bigint
|
|
720
|
+
as its digits); it never serializes the payload or any object in it, and never
|
|
721
|
+
calls a `toJSON` method. Each leaf is judged once per rule,
|
|
722
|
+
so the pass is linear in the payload. Findings are deduplicated by their
|
|
723
|
+
structural location (each entry's position under its parent, interned once per
|
|
724
|
+
scan), so a flagged name's `[key <n>]` placeholder and a literal property
|
|
725
|
+
spelled the same way never merge, however long the names above them are. When
|
|
726
|
+
the text pass and the member pass both report the same rule for a value at the
|
|
727
|
+
same location, the finding kept carries `normalization_incomplete` if either
|
|
728
|
+
did, so a member the member pass could not judge still needs review after the
|
|
729
|
+
text pass found an ordinary match there; a finding on the property name keeps
|
|
730
|
+
its own key and never merges with one on the value. Both passes walk the payload with their own stack, so payload
|
|
554
731
|
depth is not limited by the call stack, and a deeply nested credential is
|
|
555
732
|
blocked like a shallow one
|
|
556
733
|
([pm-wq9njf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-wq9njf.toon);
|
|
@@ -558,6 +735,42 @@ tracker record excluded from npm). A value that is clean only as unquoted code,
|
|
|
558
735
|
statement constant, is a string literal in a payload, as it already is in its
|
|
559
736
|
JSON spelling.
|
|
560
737
|
|
|
738
|
+
A mutation string is also judged as the text each escaped JSON string in it
|
|
739
|
+
encodes
|
|
740
|
+
([pm-rzojed](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-rzojed.toon);
|
|
741
|
+
tracker record excluded from npm). An escape can hide an assignment from the
|
|
742
|
+
text reading: in `"pm comments pm-x --add 'note\npassword=\"…\"'"` the `\n`
|
|
743
|
+
joins the letter `n` to the key and `\"` hides the quoted value. Every span
|
|
744
|
+
between consecutive unescaped double quotes on one line that holds a backslash
|
|
745
|
+
is decoded when it is a valid JSON string literal, and the decoded text is
|
|
746
|
+
judged again by every reading of every rule (the home-path views included), up
|
|
747
|
+
to three string levels deep, so a rendered recovery command keeps its findings inside a JSON
|
|
748
|
+
envelope. A span with a backslash JSON
|
|
749
|
+
does not define as an escape (a regular expression's `\.`, a Windows path, a
|
|
750
|
+
YAML-only or Python-only escape) is not a JSON string and keeps its text as
|
|
751
|
+
written. The inventory rules skip a decoded text shorter than seven UTF-16 code
|
|
752
|
+
units only under a conservative test: the text is ASCII without `%` or a
|
|
753
|
+
backslash. Seven units is the shortest concrete finding any inventory rule
|
|
754
|
+
reports in text as it stands; it does not bound warnings, because a home-path
|
|
755
|
+
view can rewrite text before judging it (NFKC folds a circled 25 to two
|
|
756
|
+
digits, so a five-unit literal can stay encoded after the last pass and raise
|
|
757
|
+
an incomplete-inspection warning). Every view leaves ASCII without `%` or a
|
|
758
|
+
backslash unchanged, so such text holds no finding and raises no warning; any
|
|
759
|
+
other short text is judged, including some that no view would change (`é`).
|
|
760
|
+
A rule outside the inventory carries no such minimum and judges every decoded
|
|
761
|
+
literal. A finding from
|
|
762
|
+
this reading records the `json_unescape` normalization and never returns the
|
|
763
|
+
decoded text. Because spans between consecutive quotes partition a line, a
|
|
764
|
+
stray prose quote cannot misalign a literal, and each level reads each
|
|
765
|
+
character once. The reading only adds findings, and each judged string's
|
|
766
|
+
literals are decoded once for the inventory rules, on a decode node they
|
|
767
|
+
share (a scan that also runs rules outside the inventory decodes them once more
|
|
768
|
+
for those). The
|
|
769
|
+
repository gate reads files as written: it still reports whatever a file's
|
|
770
|
+
text matches as written, but not a finding that only this decoded reading
|
|
771
|
+
makes, such as a synthetic detector fixture that tracker history records
|
|
772
|
+
inside an escaped JSON string.
|
|
773
|
+
|
|
561
774
|
Property names are text too
|
|
562
775
|
([pm-x07qz2](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-x07qz2.toon);
|
|
563
776
|
tracker record excluded from npm). Every property name in a payload is judged
|
|
@@ -576,7 +789,10 @@ characters that exhausts the regex stack) fails closed for itself: the guard
|
|
|
576
789
|
reports it under that rule with `normalization_incomplete: true` for explicit
|
|
577
790
|
review, and keeps scanning every other leaf, instead of letting the error make
|
|
578
791
|
the whole scan fail open. Any other detector error still yields the
|
|
579
|
-
`secret_guard_scan_failed_open` advisory.
|
|
792
|
+
`secret_guard_scan_failed_open` advisory. A rule that reports an ordinary
|
|
793
|
+
match in a leaf keeps scanning that leaf for an incomplete one, so the flag
|
|
794
|
+
survives for every rule (it once did only for the home-path rule): a policy
|
|
795
|
+
that allows the ordinary finding still sees that the leaf needs review.
|
|
580
796
|
|
|
581
797
|
A private address or host path can be legitimate project context. The default
|
|
582
798
|
remains advisory; a workspace selecting `block` must replace those literals
|
package/docs/SDK.md
CHANGED
|
@@ -3556,12 +3556,22 @@ tracker record excluded from npm):
|
|
|
3556
3556
|
|
|
3557
3557
|
`pm help <command> --json` carries the same split as `options` and
|
|
3558
3558
|
`inherited_options`, and text help prints an "Inherited host flags" section.
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3559
|
+
Core commands publish the same split when the request names one command, with
|
|
3560
|
+
`--no-extensions` included (a core command survives it), the read-output
|
|
3561
|
+
controls only on read surfaces (on the `package`, `packages` and `extension`
|
|
3562
|
+
roots only with `--catalog`),
|
|
3563
|
+
and `--expect-hash` where the runtime admits it (not on reads, the static
|
|
3564
|
+
inventory or read-only subcommands; native mutations that write no existing
|
|
3565
|
+
item still admit it until pm-oehf5s lands)
|
|
3566
|
+
([pm-6vk110](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-6vk110.toon),
|
|
3567
|
+
tracker record excluded from npm).
|
|
3568
|
+
For an extension command the inherited set is derived from the reserved
|
|
3569
|
+
host-flag table: read-output controls (`--output-include`, `--output-limit`,
|
|
3570
|
+
`--output-budget`, `--output-session`, `--output-cursor`,
|
|
3571
|
+
`--output-row-contract`) appear only on commands that declare `read_output`,
|
|
3572
|
+
`--no-extensions` never appears because it removes the command itself, and
|
|
3573
|
+
root-only flags (`--version`, `--all`, `--explain`) are refused as unknown
|
|
3574
|
+
unless the command declares them.
|
|
3565
3575
|
|
|
3566
3576
|
On the CLI, a command with declared flags refuses any other option with
|
|
3567
3577
|
`unknown_option` (exit 2), and the refusal lists exactly what the command
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":5,"transcript_version":2,"transcript_digest":"sha256:b4b151f3d36860e73cd535d0520e9f03b4ecec4444ee81a8b868896b5b0bba47","estimator":"ceil(utf8_bytes / 4)","comparison_scope":"plan_recovery_tracker_root_canonicalized","measurement_scope":"output_before_token_accounting","published_with_release":true,"orientation":{"canonical_task_id":"orientation-context-intent","required_capabilities":["actionable_work","active_ownership","workspace_state"],"measured_winner_tokens":1052,"protocols":[{"task_id":"orientation-context-intent","command_count":1,"estimated_tokens":1052,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"context","field_path":"hierarchy"}],"active_ownership":[{"step_id":"context","field_path":"activity"}],"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}]}},{"task_id":"orientation-operating-rules","command_count":4,"estimated_tokens":2067,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"open","field_path":"items"}],"active_ownership":[{"step_id":"in-progress","field_path":"items"}],"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}]}},{"task_id":"orientation-contracts-next","command_count":2,"estimated_tokens":
|
|
1
|
+
{"version":5,"transcript_version":2,"transcript_digest":"sha256:b4b151f3d36860e73cd535d0520e9f03b4ecec4444ee81a8b868896b5b0bba47","estimator":"ceil(utf8_bytes / 4)","comparison_scope":"plan_recovery_tracker_root_canonicalized","measurement_scope":"output_before_token_accounting","published_with_release":true,"orientation":{"canonical_task_id":"orientation-context-intent","required_capabilities":["actionable_work","active_ownership","workspace_state"],"measured_winner_tokens":1052,"protocols":[{"task_id":"orientation-context-intent","command_count":1,"estimated_tokens":1052,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"context","field_path":"hierarchy"}],"active_ownership":[{"step_id":"context","field_path":"activity"}],"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}]}},{"task_id":"orientation-operating-rules","command_count":4,"estimated_tokens":2067,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"open","field_path":"items"}],"active_ownership":[{"step_id":"in-progress","field_path":"items"}],"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}]}},{"task_id":"orientation-contracts-next","command_count":2,"estimated_tokens":5223,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"next","field_path":"recommended.id"}],"active_ownership":[{"step_id":"next","field_path":"held_by_others"}],"workspace_state":[{"step_id":"next","field_path":"summary.in_progress"}]}}]},"tasks":[{"id":"orientation-context-intent","max_estimated_tokens":1052,"steps":[{"id":"context","max_estimated_tokens":1052,"accounting_mode":"self_reported"}]},{"id":"orientation-contracts-next","max_estimated_tokens":5223,"steps":[{"id":"contracts","max_estimated_tokens":4491,"accounting_mode":"self_reported"},{"id":"next","max_estimated_tokens":732,"accounting_mode":"self_reported"}]},{"id":"orientation-operating-rules","max_estimated_tokens":2067,"steps":[{"id":"context","max_estimated_tokens":1015,"accounting_mode":"self_reported"},{"id":"search","max_estimated_tokens":164,"accounting_mode":"self_reported"},{"id":"open","max_estimated_tokens":712,"accounting_mode":"self_reported"},{"id":"in-progress","max_estimated_tokens":176,"accounting_mode":"self_reported"}]},{"id":"context-bootstrap","max_estimated_tokens":2025,"steps":[{"id":"triage","max_estimated_tokens":619,"accounting_mode":"self_reported"},{"id":"orient","max_estimated_tokens":1015,"accounting_mode":"self_reported"},{"id":"inspect","max_estimated_tokens":391,"accounting_mode":"self_reported"}]},{"id":"closed-domain-recovery","max_estimated_tokens":650,"steps":[{"id":"refuse-intent","max_estimated_tokens":259,"accounting_mode":"self_reported"},{"id":"retry-intent","max_estimated_tokens":391,"accounting_mode":"self_reported"}]},{"id":"unknown-option-recovery","max_estimated_tokens":596,"steps":[{"id":"refuse-option","max_estimated_tokens":433,"accounting_mode":"self_reported"},{"id":"retry-option","max_estimated_tokens":163,"accounting_mode":"self_reported"}]},{"id":"lifecycle-mutation","max_estimated_tokens":915,"steps":[{"id":"create","max_estimated_tokens":20,"accounting_mode":"self_reported"},{"id":"inspect-open","max_estimated_tokens":384,"accounting_mode":"self_reported"},{"id":"close","max_estimated_tokens":92,"accounting_mode":"self_reported"},{"id":"inspect-closed","max_estimated_tokens":419,"accounting_mode":"self_reported"}]},{"id":"bulk-effect-outcomes","max_estimated_tokens":392,"steps":[{"id":"create-bulk-target","max_estimated_tokens":20,"accounting_mode":"self_reported"},{"id":"partial-effect","max_estimated_tokens":240,"accounting_mode":"self_reported"},{"id":"no-effect","max_estimated_tokens":132,"accounting_mode":"self_reported"}]},{"id":"plan-execution-mutations","max_estimated_tokens":806,"steps":[{"id":"create-plan","max_estimated_tokens":21,"accounting_mode":"self_reported"},{"id":"add-step","max_estimated_tokens":254,"accounting_mode":"self_reported"},{"id":"complete-step","max_estimated_tokens":253,"accounting_mode":"self_reported"},{"id":"inspect-plan","max_estimated_tokens":278,"accounting_mode":"self_reported"}]}],"composite_max_estimated_tokens":13726}
|
package/marketplace.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"pm","owner":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"description":"Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.","version":"2026.
|
|
1
|
+
{"name":"pm","owner":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"description":"Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.","version":"2026.12.2","plugins":[{"name":"pm-claude","source":"./plugins/pm-claude","description":"Native pm CLI integration for Claude Code — 32 MCP tools, 14 workflow skills with slash invocations, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.","version":"2026.12.2","author":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"homepage":"https://github.com/unbraind/pm-cli","repository":"https://github.com/unbraind/pm-cli","license":"MIT","keywords":["pm-cli","project-management","mcp","tasks","agents","workflows","git-native","task-tracker","ai"],"category":"productivity"}]}
|