@unbrained/pm-cli 2026.8.7 → 2026.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +54 -0
- package/dist/cli/main.js +4 -3
- package/dist/cli/register-annotations.d.ts +11 -0
- package/dist/cli/register-annotations.js +195 -0
- package/dist/cli/register-history-author.js +7 -30
- package/dist/cli/register-mutation.js +25 -206
- package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
- package/dist/cli/runtime-compatibility-boundary.js +43 -0
- package/dist/cli-bundle/bundle-manifest.json +158 -694
- package/dist/cli-bundle/chunks/chunk-2DTCZXSD.js +13 -0
- package/dist/cli-bundle/chunks/chunk-5JO6R4BS.js +3 -0
- package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +194 -0
- package/dist/cli-bundle/chunks/chunk-EF43KODO.js +2 -0
- package/dist/cli-bundle/chunks/chunk-GMX5YOI3.js +77 -0
- package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +28 -0
- package/dist/cli-bundle/chunks/chunk-MHBVCUF2.js +2 -0
- package/dist/cli-bundle/chunks/chunk-PYO5GZU6.js +5 -0
- package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
- package/dist/cli-bundle/chunks/chunk-RJC7TPF4.js +8 -0
- package/dist/cli-bundle/chunks/chunk-YC3UF2IO.js +2068 -0
- package/dist/cli-bundle/chunks/{register-list-query-FJZCJ67O.js → register-list-query-BUE7PTCU.js} +8 -8
- package/dist/cli-bundle/chunks/register-mutation-FC3XLVIK.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-YH2WAOXU.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-UQDTNTLJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +153 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4VJQTS3P.js → chunk-3GSFUDAI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3WVHTUAW.js +5 -0
- package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-73JUDYXT.js → chunk-54TZJ4BM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5NK5TJ5D.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-HNL6IFGS.js → chunk-6DO4YQWZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-73FIJONU.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TIKDBG4D.js → chunk-C3GCHDSQ.js} +29 -27
- package/dist/cli-bundle/focused-chunks/chunk-JGRSQZJT.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YZEZAPJK.js → chunk-KNEHLPBF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MRWVJ3ZG.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NBJKQP4S.js → chunk-P6BBIQRG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QHRTT7WT.js → chunk-PZAGVQNN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +14 -0
- package/dist/cli-bundle/focused-chunks/chunk-T4IGQCSY.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-U46GQJNY.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-RPNYG5MO.js → chunk-VRXJSGIT.js} +6 -6
- package/dist/cli-bundle/focused-chunks/{chunk-R2LEMEV5.js → chunk-XC2ZW3CJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZG54B4XG.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +38 -38
- 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 +1 -1
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -1
- package/dist/cli.js +14 -4
- package/dist/core/diagnostics/remediation.js +12 -2
- package/dist/core/history/history.js +13 -4
- package/dist/core/item/actionability.d.ts +7 -1
- package/dist/core/item/actionability.js +71 -15
- package/dist/core/output/output.js +9 -2
- package/dist/core/sentry/helpers.d.ts +10 -0
- package/dist/core/sentry/helpers.js +59 -4
- package/dist/core/shared/author.d.ts +25 -0
- package/dist/core/shared/author.js +114 -9
- package/dist/core/shared/constants.d.ts +2 -0
- package/dist/core/shared/constants.js +4 -2
- package/dist/sdk/actionability.d.ts +1 -1
- package/dist/sdk/actionability.js +3 -3
- package/dist/sdk/annotations.d.ts +40 -0
- package/dist/sdk/annotations.js +61 -9
- package/dist/sdk/author-attribution.d.ts +12 -0
- package/dist/sdk/author-attribution.js +73 -11
- package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
- package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
- package/dist/sdk/cli-contracts/completeness.js +5 -3
- package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +19 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +44 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +6 -3
- package/dist/sdk/comments.d.ts +7 -0
- package/dist/sdk/comments.js +2 -2
- package/dist/sdk/completion.js +9 -5
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/core-governance.d.ts +1 -1
- package/dist/sdk/core-governance.js +3 -3
- package/dist/sdk/dependencies.d.ts +2 -0
- package/dist/sdk/dependencies.js +7 -6
- package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
- package/dist/sdk/environment/host-environment-errors.js +124 -0
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
- package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
- package/dist/sdk/environment/source-context.d.ts +23 -0
- package/dist/sdk/environment/source-context.js +29 -0
- package/dist/sdk/error-code-catalog.d.ts +6 -0
- package/dist/sdk/error-code-catalog.js +62 -8
- package/dist/sdk/extension/bundled-catalog.js +19 -6
- package/dist/sdk/generated-error-code-catalog.js +665 -3
- package/dist/sdk/governance/health.d.ts +11 -3
- package/dist/sdk/governance/health.js +32 -13
- package/dist/sdk/governance/provenance-health.d.ts +26 -0
- package/dist/sdk/governance/provenance-health.js +139 -0
- package/dist/sdk/governance/validate.js +13 -8
- package/dist/sdk/governance.d.ts +1 -0
- package/dist/sdk/governance.js +3 -2
- package/dist/sdk/graph/assembly.d.ts +4 -0
- package/dist/sdk/graph/assembly.js +22 -2
- package/dist/sdk/graph/run.d.ts +2 -0
- package/dist/sdk/graph/run.js +3 -2
- package/dist/sdk/index.d.ts +7 -3
- package/dist/sdk/index.js +9 -5
- package/dist/sdk/learnings.d.ts +15 -0
- package/dist/sdk/learnings.js +2 -2
- package/dist/sdk/lifecycle/close-many.d.ts +6 -1
- package/dist/sdk/lifecycle/close-many.js +43 -5
- package/dist/sdk/lifecycle/close.js +13 -8
- package/dist/sdk/lifecycle/create.js +6 -12
- package/dist/sdk/lifecycle/plan.js +6 -3
- package/dist/sdk/lifecycle/update-many.d.ts +2 -1
- package/dist/sdk/lifecycle/update-many.js +29 -5
- package/dist/sdk/lifecycle/update.js +6 -20
- package/dist/sdk/merge/driver.d.ts +2 -1
- package/dist/sdk/merge/driver.js +7 -4
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +21 -0
- package/dist/sdk/merge/install.js +51 -21
- package/dist/sdk/merge/receipts.d.ts +14 -1
- package/dist/sdk/merge/receipts.js +36 -8
- package/dist/sdk/merge/reconcile.js +21 -4
- package/dist/sdk/merge/three-way.d.ts +6 -2
- package/dist/sdk/merge/three-way.js +24 -10
- package/dist/sdk/notes.d.ts +7 -0
- package/dist/sdk/notes.js +2 -2
- package/dist/sdk/query/get.d.ts +11 -0
- package/dist/sdk/query/get.js +37 -3
- package/dist/sdk/read-output-contracts.d.ts +1 -1
- package/dist/sdk/read-output-contracts.js +103 -5
- package/dist/sdk/relationship-kinds/contract.d.ts +48 -0
- package/dist/sdk/relationship-kinds/contract.js +22 -0
- package/dist/sdk/relationships.d.ts +6 -41
- package/dist/sdk/relationships.js +12 -126
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.d.ts +1 -1
- package/dist/sdk/runtime.js +9 -25
- package/dist/sdk/similarity.d.ts +5 -0
- package/dist/sdk/similarity.js +40 -10
- package/dist/sdk/structured-mutations.js +5 -2
- package/dist/sdk/test/execution.js +4 -2
- package/dist/sdk/test/linked-command-detection.d.ts +2 -7
- package/dist/sdk/test/linked-command-detection.js +22 -9
- package/dist/sdk/test/parsers.js +5 -2
- package/dist/sdk/workspace-snapshot.d.ts +9 -0
- package/dist/sdk/workspace-snapshot.js +48 -16
- package/docs/AGENT_GUIDE.md +2 -1
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
- package/docs/COMMANDS.md +19 -1
- package/docs/DEPENDENCY_KIND_CONTRACT.md +29 -0
- package/docs/ITEM_READ_PROJECTIONS.md +26 -0
- package/docs/MERGE_SAFETY.md +10 -3
- package/docs/README.md +1 -0
- package/docs/RELATIONSHIP_GRAPH.md +1 -1
- package/docs/RELEASING.md +27 -2
- package/docs/SCRIPTING.md +27 -1
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +35 -2
- package/docs/SDK_CONTEXT_INTEGRITY.md +81 -0
- package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
- package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
- package/docs/SENTRY_CONTRACT_EPOCHS.md +20 -0
- package/docs/TESTING.md +17 -0
- package/docs/agent-task-token-baseline.json +2 -2
- package/marketplace.json +2 -2
- package/package.json +5 -3
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +756 -57
- package/dist/cli-bundle/chunks/append-7BXBFDGD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-2AXF3VSK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-2XS43CCV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-3A6KWB72.js +0 -8
- package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +0 -8
- package/dist/cli-bundle/chunks/chunk-4MTI7XOV.js +0 -5
- package/dist/cli-bundle/chunks/chunk-6BX5UDCN.js +0 -3
- package/dist/cli-bundle/chunks/chunk-6QPO7KLR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-7MXHZHSQ.js +0 -5
- package/dist/cli-bundle/chunks/chunk-7ZPMJW4U.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AGYNSNCI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +0 -5
- package/dist/cli-bundle/chunks/chunk-B4KLBBMN.js +0 -2
- package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CALJHNBL.js +0 -23
- package/dist/cli-bundle/chunks/chunk-CFIGP5LY.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CS6MRHG7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CUGNQQKH.js +0 -2
- package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +0 -164
- package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-H5Y5YE6A.js +0 -2
- package/dist/cli-bundle/chunks/chunk-H5Y6UV6E.js +0 -2
- package/dist/cli-bundle/chunks/chunk-H7KGWPDF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HFSD77TQ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HX2GTA6L.js +0 -2
- package/dist/cli-bundle/chunks/chunk-J2IEKAVR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-K44PYFXH.js +0 -2
- package/dist/cli-bundle/chunks/chunk-K4KGEEBT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +0 -21
- package/dist/cli-bundle/chunks/chunk-KL6IEBV2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KWQZDZSS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KZ4X3DGU.js +0 -3
- package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +0 -13
- package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ME2JJ4LA.js +0 -3
- package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-NG6OXIBR.js +0 -19
- package/dist/cli-bundle/chunks/chunk-NYIGHWQY.js +0 -8
- package/dist/cli-bundle/chunks/chunk-NZ75GNSA.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PCJWJNC2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PD3225AM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PDEGKG7P.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PW2H7YJR.js +0 -56
- package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-TPKN3S7S.js +0 -2
- package/dist/cli-bundle/chunks/chunk-TPXAXTCO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +0 -2
- package/dist/cli-bundle/chunks/chunk-UQLZQVFW.js +0 -55
- package/dist/cli-bundle/chunks/chunk-VT3Z5G7D.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WOD3WWUN.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WSJEIGJF.js +0 -3
- package/dist/cli-bundle/chunks/chunk-WYNUU7ZW.js +0 -2008
- package/dist/cli-bundle/chunks/chunk-YGPNCCXZ.js +0 -2
- package/dist/cli-bundle/chunks/close-CMY3BAUG.js +0 -2
- package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +0 -2
- package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +0 -2
- package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +0 -2
- package/dist/cli-bundle/chunks/create-I5DVV4YG.js +0 -2
- package/dist/cli-bundle/chunks/delete-RL3JACSW.js +0 -2
- package/dist/cli-bundle/chunks/deps-S7UBCECS.js +0 -2
- package/dist/cli-bundle/chunks/docs-ZZNVBBYO.js +0 -2
- package/dist/cli-bundle/chunks/files-27C337VT.js +0 -2
- package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +0 -2
- package/dist/cli-bundle/chunks/history-compact-HJQK67CZ.js +0 -2
- package/dist/cli-bundle/chunks/history-redact-PWC6PDWA.js +0 -2
- package/dist/cli-bundle/chunks/history-repair-N3CY4WBF.js +0 -2
- package/dist/cli-bundle/chunks/learnings-4FH23XDT.js +0 -2
- package/dist/cli-bundle/chunks/profile-5Y5XXH5N.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-YGYPW3BL.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-DL7FFABC.js +0 -2
- package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +0 -2
- package/dist/cli-bundle/chunks/schema-EQGKBYXJ.js +0 -2
- package/dist/cli-bundle/chunks/update-QVTYOD6I.js +0 -2
- package/dist/cli-bundle/chunks/update-many-DJSBU525.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2ECLECMK.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-3K4XV2BF.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-4EX25PXM.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-CIXVQPB7.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-DLTS3IHM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-DQ6FKGL3.js +0 -14
- package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MHMTKV5V.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MOTJFQ3F.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-RW5IYD4J.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-VZFU2R4M.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +0 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides shared primitives and utilities for Author.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a89b5501-1909-5ea8-b34b-8ca9b4bc5dd5")}catch(e){}}();
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
import fs from "node:fs";
|
|
@@ -31,13 +31,12 @@ export const BUILTIN_HARNESS_SIGNAL_DESCRIPTORS = [
|
|
|
31
31
|
session_environment_keys: ["CLAUDE_CODE_SESSION_ID"],
|
|
32
32
|
provenance_environment_keys: {
|
|
33
33
|
effort: ["CLAUDE_EFFORT"],
|
|
34
|
-
role: ["CLAUDE_CODE_CHILD_SESSION"],
|
|
35
34
|
},
|
|
36
35
|
provenance_resolvers: {
|
|
37
36
|
model: "claude_session_file",
|
|
38
37
|
version: "claude_session_file",
|
|
39
38
|
},
|
|
40
|
-
provenance_unavailable_dimensions: ["topic"],
|
|
39
|
+
provenance_unavailable_dimensions: ["role", "topic"],
|
|
41
40
|
argv_markers: ["claude", "claude-code"],
|
|
42
41
|
client_names: ["claude", "claude-code", "claude code"],
|
|
43
42
|
},
|
|
@@ -192,6 +191,28 @@ function firstEnvironmentValue(env, keys) {
|
|
|
192
191
|
return undefined;
|
|
193
192
|
}
|
|
194
193
|
function provenanceFromArgv(argv, dimension) {
|
|
194
|
+
const flaggedValue = provenanceFlagValue(argv, dimension);
|
|
195
|
+
if (flaggedValue !== undefined)
|
|
196
|
+
return flaggedValue;
|
|
197
|
+
if (dimension === "topic") {
|
|
198
|
+
return argv
|
|
199
|
+
.slice(0, 16)
|
|
200
|
+
.map((token) => token.trim())
|
|
201
|
+
.find((token) => /^pm-[a-z0-9][a-z0-9-]{2,63}$/u.test(token));
|
|
202
|
+
}
|
|
203
|
+
if (dimension === "role") {
|
|
204
|
+
const command = argv
|
|
205
|
+
.slice(0, 8)
|
|
206
|
+
.map((token) => token.trim().toLowerCase())
|
|
207
|
+
.find((token) => ["claim", "create", "update", "close", "release", "review"].includes(token));
|
|
208
|
+
if (command === "review")
|
|
209
|
+
return "reviewer";
|
|
210
|
+
if (command)
|
|
211
|
+
return "implementer";
|
|
212
|
+
}
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
function provenanceFlagValue(argv, dimension) {
|
|
195
216
|
const acceptedFlags = dimension === "model"
|
|
196
217
|
? ["--model", "--agent-model"]
|
|
197
218
|
: [`--agent-${dimension}`];
|
|
@@ -208,6 +229,21 @@ function provenanceFromArgv(argv, dimension) {
|
|
|
208
229
|
}
|
|
209
230
|
return undefined;
|
|
210
231
|
}
|
|
232
|
+
const AGENT_ROLE_VALUES = new Set([
|
|
233
|
+
"implementation",
|
|
234
|
+
"implementer",
|
|
235
|
+
"investigator",
|
|
236
|
+
"orchestrator",
|
|
237
|
+
"planner",
|
|
238
|
+
"release-operator",
|
|
239
|
+
"reviewer",
|
|
240
|
+
]);
|
|
241
|
+
function normalizeProvenanceValue(dimension, value) {
|
|
242
|
+
if (dimension !== "role" || value === undefined)
|
|
243
|
+
return value;
|
|
244
|
+
const normalized = value.trim().toLowerCase().replaceAll(/[_\s]+/gu, "-");
|
|
245
|
+
return AGENT_ROLE_VALUES.has(normalized) ? normalized : undefined;
|
|
246
|
+
}
|
|
211
247
|
function boundedProvenanceValue(provenance, dimension) {
|
|
212
248
|
return nonBlank(provenance?.[dimension])?.slice(0, 256);
|
|
213
249
|
}
|
|
@@ -307,7 +343,7 @@ function resolveAgentProvenanceObservation(dimension, signals, env, descriptor,
|
|
|
307
343
|
let overrideValue;
|
|
308
344
|
let argvValue;
|
|
309
345
|
if (hostResolvedDimensions.has(dimension)) {
|
|
310
|
-
overrideValue = nonBlank(env[overrideKey])?.slice(0, 256);
|
|
346
|
+
overrideValue = normalizeProvenanceValue(dimension, nonBlank(env[overrideKey])?.slice(0, 256));
|
|
311
347
|
argvValue = provenanceFromArgv(signals.argv ?? [], dimension);
|
|
312
348
|
}
|
|
313
349
|
const environmentKeysByDimension = {
|
|
@@ -321,10 +357,10 @@ function resolveAgentProvenanceObservation(dimension, signals, env, descriptor,
|
|
|
321
357
|
const values = [
|
|
322
358
|
overrideValue,
|
|
323
359
|
boundedProvenanceValue(sessionContext?.provenance, dimension),
|
|
324
|
-
firstEnvironmentValue(env, environmentKeysByDimension[dimension]),
|
|
325
|
-
boundedProvenanceValue(clientProvenance, dimension),
|
|
326
|
-
boundedProvenanceValue(signals.provenance, dimension),
|
|
327
|
-
argvValue,
|
|
360
|
+
normalizeProvenanceValue(dimension, firstEnvironmentValue(env, environmentKeysByDimension[dimension])),
|
|
361
|
+
normalizeProvenanceValue(dimension, boundedProvenanceValue(clientProvenance, dimension)),
|
|
362
|
+
normalizeProvenanceValue(dimension, boundedProvenanceValue(signals.provenance, dimension)),
|
|
363
|
+
normalizeProvenanceValue(dimension, argvValue),
|
|
328
364
|
resolveProvenanceProbe(dimension, signals, env, descriptor),
|
|
329
365
|
];
|
|
330
366
|
const sources = [
|
|
@@ -469,6 +505,75 @@ export function detectAgentIdentity(signals) {
|
|
|
469
505
|
];
|
|
470
506
|
return Object.fromEntries(entries.filter((entry) => entry[1] !== undefined));
|
|
471
507
|
}
|
|
508
|
+
function resolveProvenanceOutcome(dimension, identity, descriptor, env, probesEnabled, invalidValue) {
|
|
509
|
+
const resolver = descriptor?.provenance_resolvers[dimension];
|
|
510
|
+
if (identity.provenance?.[dimension]) {
|
|
511
|
+
return {
|
|
512
|
+
status: "resolved",
|
|
513
|
+
...(resolver ? { resolver } : {}),
|
|
514
|
+
rule_version: "v1",
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
if (invalidValue) {
|
|
518
|
+
return {
|
|
519
|
+
status: "unavailable",
|
|
520
|
+
reason: "invalid_value",
|
|
521
|
+
rule_version: "v1",
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
if (resolver) {
|
|
525
|
+
const resolverHasInput = resolver === "ai_agent_version"
|
|
526
|
+
? nonBlank(env.AI_AGENT) !== undefined
|
|
527
|
+
: nonBlank(env.CLAUDE_CODE_SESSION_ID) !== undefined;
|
|
528
|
+
const status = resolverHasInput && probesEnabled ? "failed" : "unavailable";
|
|
529
|
+
const reason = !resolverHasInput
|
|
530
|
+
? "harness_unavailable"
|
|
531
|
+
: probesEnabled
|
|
532
|
+
? "resolver_failed"
|
|
533
|
+
: "probes_disabled";
|
|
534
|
+
return { status, reason, resolver, rule_version: "v1" };
|
|
535
|
+
}
|
|
536
|
+
return {
|
|
537
|
+
status: "unavailable",
|
|
538
|
+
reason: descriptor?.provenance_unavailable_dimensions.includes(dimension)
|
|
539
|
+
? "harness_unavailable"
|
|
540
|
+
: "resolver_not_configured",
|
|
541
|
+
rule_version: "v1",
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Diagnose provenance without exposing environment values, paths, or probe data.
|
|
546
|
+
*
|
|
547
|
+
* This additive SDK contract keeps legacy `detectAgentIdentity` projections
|
|
548
|
+
* stable while giving health checks and history writers explicit absence states.
|
|
549
|
+
*/
|
|
550
|
+
export function diagnoseAgentIdentity(signals) {
|
|
551
|
+
const effectiveSignals = effectiveHarnessDetectionSignals(signals);
|
|
552
|
+
const identity = detectAgentIdentity(effectiveSignals);
|
|
553
|
+
const descriptor = currentHarnessSignalDescriptors(effectiveSignals.descriptors).find((candidate) => candidate.harness === identity.harness);
|
|
554
|
+
const env = effectiveSignals.env ?? {};
|
|
555
|
+
const probesEnabled = effectiveSignals.probes_enabled !== false &&
|
|
556
|
+
workspaceHarnessSignalsStorage.getStore()?.probesEnabled !== false &&
|
|
557
|
+
!["0", "false", "off"].includes(nonBlank(env.PM_AGENT_PROBES)?.toLowerCase() ?? "");
|
|
558
|
+
const sessionContext = resolveAgentSessionContextFromSignals(effectiveSignals, env);
|
|
559
|
+
const invalidRoleValue = [
|
|
560
|
+
env.PM_AGENT_ROLE,
|
|
561
|
+
sessionContext.provenance?.role,
|
|
562
|
+
firstEnvironmentValue(env, descriptor?.provenance_environment_keys.role),
|
|
563
|
+
effectiveSignals.client_info?.provenance?.role,
|
|
564
|
+
effectiveSignals.provenance?.role,
|
|
565
|
+
provenanceFlagValue(effectiveSignals.argv ?? [], "role"),
|
|
566
|
+
].some((candidate) => {
|
|
567
|
+
const value = nonBlank(candidate)?.slice(0, 256);
|
|
568
|
+
return (value !== undefined &&
|
|
569
|
+
normalizeProvenanceValue("role", value) === undefined);
|
|
570
|
+
});
|
|
571
|
+
const outcomes = Object.fromEntries(AGENT_PROVENANCE_DIMENSIONS.map((dimension) => [
|
|
572
|
+
dimension,
|
|
573
|
+
resolveProvenanceOutcome(dimension, identity, descriptor, env, probesEnabled, dimension === "role" && invalidRoleValue),
|
|
574
|
+
]));
|
|
575
|
+
return { ...identity, provenance_outcomes: outcomes };
|
|
576
|
+
}
|
|
472
577
|
/** Reads the invocation-wide author override through the canonical environment seam. */
|
|
473
578
|
export function readAuthorEnvironment() {
|
|
474
579
|
return process.env.PM_AUTHOR;
|
|
@@ -575,4 +680,4 @@ export function resolveAuthor(candidate, fallback) {
|
|
|
575
680
|
return identity.author;
|
|
576
681
|
}
|
|
577
682
|
//# sourceMappingURL=author.js.map
|
|
578
|
-
//# debugId=
|
|
683
|
+
//# debugId=a89b5501-1909-5ea8-b34b-8ca9b4bc5dd5
|
|
@@ -58,6 +58,8 @@ export declare const EXIT_CODE: {
|
|
|
58
58
|
readonly NOT_FOUND: 3;
|
|
59
59
|
readonly CONFLICT: 4;
|
|
60
60
|
readonly DEPENDENCY_FAILED: 5;
|
|
61
|
+
readonly NO_EFFECT: 6;
|
|
62
|
+
readonly PARTIAL_EFFECT: 7;
|
|
61
63
|
};
|
|
62
64
|
/** Restricts telemetry error category values accepted by command, SDK, and storage contracts. */
|
|
63
65
|
export type TelemetryErrorCategory = "usage" | "validation" | "conflict" | "runtime" | "unknown";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="36b908f0-ea19-5adc-8ccd-320ad3c3b1fe")}catch(e){}}();
|
|
3
3
|
import { createDefaultExtensionGovernancePolicy } from "../extensions/extension-types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Canonical default lifecycle status model and workflow role mapping.
|
|
@@ -421,6 +421,8 @@ export const EXIT_CODE = {
|
|
|
421
421
|
NOT_FOUND: 3,
|
|
422
422
|
CONFLICT: 4,
|
|
423
423
|
DEPENDENCY_FAILED: 5,
|
|
424
|
+
NO_EFFECT: 6,
|
|
425
|
+
PARTIAL_EFFECT: 7,
|
|
424
426
|
};
|
|
425
427
|
/** Public contract for telemetry error category by code, shared by SDK and presentation-layer consumers. */
|
|
426
428
|
export const TELEMETRY_ERROR_CATEGORY_BY_CODE = Object.freeze({
|
|
@@ -475,4 +477,4 @@ export function resolveTelemetryErrorCategory(errorCode) {
|
|
|
475
477
|
return "unknown";
|
|
476
478
|
}
|
|
477
479
|
//# sourceMappingURL=constants.js.map
|
|
478
|
-
//# debugId=
|
|
480
|
+
//# debugId=36b908f0-ea19-5adc-8ccd-320ad3c3b1fe
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* blocker or ready-work classifications without storage or rendering side
|
|
8
8
|
* effects.
|
|
9
9
|
*/
|
|
10
|
-
export { collectBlockedByIds, collectDependencyBlockedIds, computeActionabilityReport, resolveItemBlockers, type ActionabilityReport, type ActionableEntry, type ResolvedBlocker, } from "../core/item/actionability.js";
|
|
10
|
+
export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, type ActionabilityReport, type ActionableEntry, type ResolvedBlocker, } from "../core/item/actionability.js";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* effects.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
12
|
-
export { collectBlockedByIds, collectDependencyBlockedIds, computeActionabilityReport, resolveItemBlockers, } from "../core/item/actionability.js";
|
|
11
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cc271a73-9767-54bb-a142-d4d4569e3c6a")}catch(e){}}();
|
|
12
|
+
export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, } from "../core/item/actionability.js";
|
|
13
13
|
//# sourceMappingURL=actionability.js.map
|
|
14
|
-
//# debugId=
|
|
14
|
+
//# debugId=cc271a73-9767-54bb-a142-d4d4569e3c6a
|
|
@@ -23,7 +23,45 @@ export interface AnnotationCommandOptions {
|
|
|
23
23
|
force?: boolean;
|
|
24
24
|
/** Whether list results include paging metadata. */
|
|
25
25
|
includeMeta?: boolean;
|
|
26
|
+
/** Return the complete collection after a mutation instead of the bounded mutation receipt. */
|
|
27
|
+
fullHistory?: boolean;
|
|
26
28
|
}
|
|
29
|
+
/** Identifies the single annotation mutation represented by a bounded response. */
|
|
30
|
+
export interface AnnotationMutationReceipt {
|
|
31
|
+
/** Mutation applied to the annotation collection. */
|
|
32
|
+
action: "add" | "edit" | "delete";
|
|
33
|
+
/** Stable one-based collection position targeted by the mutation. */
|
|
34
|
+
entry_index: number;
|
|
35
|
+
/** Number of stored entries changed by the mutation. */
|
|
36
|
+
changed_count: 1;
|
|
37
|
+
/** Whether the response includes the complete post-mutation collection. */
|
|
38
|
+
full_history_included: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Transport-neutral selectors that restore a complete annotation collection. */
|
|
41
|
+
export interface AnnotationHistoryRestoration {
|
|
42
|
+
/** Stable semantic selector shared by every transport. */
|
|
43
|
+
selector: "full_history";
|
|
44
|
+
/** Equivalent CLI flag. */
|
|
45
|
+
cli_flag: "--full-history";
|
|
46
|
+
/** Equivalent direct SDK option. */
|
|
47
|
+
sdk_option: "fullHistory";
|
|
48
|
+
/** Equivalent MCP tool option. */
|
|
49
|
+
mcp_option: "full";
|
|
50
|
+
}
|
|
51
|
+
/** Describes annotation history withheld from a bounded mutation response. */
|
|
52
|
+
export interface AnnotationOmissionReceipt {
|
|
53
|
+
/** Whether any historical collection entries were withheld. */
|
|
54
|
+
has_omissions: boolean;
|
|
55
|
+
/** Number of independently restorable field groups withheld. */
|
|
56
|
+
omitted_field_group_count: number;
|
|
57
|
+
/** Omitted groups and the transport-neutral selectors that restore them. */
|
|
58
|
+
omitted_field_groups: Array<{
|
|
59
|
+
name: string;
|
|
60
|
+
restore_with: AnnotationHistoryRestoration;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
/** Map transport-level `full` onto the SDK annotation history option. */
|
|
64
|
+
export declare function normalizeAnnotationTransportOptions(options: Record<string, unknown>): Record<string, unknown>;
|
|
27
65
|
/** Presentation-layer inputs accepted by the shared annotation source resolver. */
|
|
28
66
|
export interface AnnotationSourceOptions {
|
|
29
67
|
/** Inline annotation text or the stdin token (`-`). */
|
|
@@ -93,6 +131,8 @@ export type AnnotationCommandResult<TKey extends string, TEntry extends Annotati
|
|
|
93
131
|
returned_count?: number;
|
|
94
132
|
has_more?: boolean;
|
|
95
133
|
limit?: number;
|
|
134
|
+
mutation_receipt?: AnnotationMutationReceipt;
|
|
135
|
+
omission_receipt?: AnnotationOmissionReceipt;
|
|
96
136
|
};
|
|
97
137
|
/** Implements limit annotation entries for the public runtime surface of this module. */
|
|
98
138
|
export declare function limitAnnotationEntries<TEntry>(values: TEntry[], limit: number | undefined): TEntry[];
|
package/dist/sdk/annotations.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm annotation command command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="13cf8bd9-0aee-5838-a6eb-de9f87ddfac7")}catch(e){}}();
|
|
8
8
|
import { readFile } from "node:fs/promises";
|
|
9
9
|
import { pathExists } from "../core/fs/fs-utils.js";
|
|
10
10
|
import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
|
|
@@ -18,6 +18,15 @@ import { resolveAuthor } from "../core/shared/author.js";
|
|
|
18
18
|
import { locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
|
|
19
19
|
import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
|
|
20
20
|
import { readSettings } from "../core/store/settings.js";
|
|
21
|
+
/** Map transport-level `full` onto the SDK annotation history option. */
|
|
22
|
+
export function normalizeAnnotationTransportOptions(options) {
|
|
23
|
+
const normalized = {
|
|
24
|
+
...options,
|
|
25
|
+
...(options.full === true ? { fullHistory: true } : {}),
|
|
26
|
+
};
|
|
27
|
+
delete normalized.full;
|
|
28
|
+
return normalized;
|
|
29
|
+
}
|
|
21
30
|
/** Reject mutation of canonical structured events while allowing ordinary annotations. */
|
|
22
31
|
function assertAnnotationEntryMutable(entry, operation) {
|
|
23
32
|
if (typeof entry === "object" &&
|
|
@@ -249,7 +258,10 @@ export async function runAnnotationCommand(id, options, global, config) {
|
|
|
249
258
|
wrapOwnershipConflict(error, config.conflictGuidance);
|
|
250
259
|
}
|
|
251
260
|
const allEntries = readAnnotationEntries(result.item, config.collectionKey);
|
|
252
|
-
return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true
|
|
261
|
+
return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true, {
|
|
262
|
+
action: "delete",
|
|
263
|
+
entryIndex: config.input.index,
|
|
264
|
+
}, options.fullHistory === true);
|
|
253
265
|
}
|
|
254
266
|
const rawText = config.input.rawValue ?? config.input.value ?? "";
|
|
255
267
|
assertAnnotationAddValueIsNotFlagLike(rawText, config);
|
|
@@ -289,7 +301,11 @@ export async function runAnnotationCommand(id, options, global, config) {
|
|
|
289
301
|
wrapOwnershipConflict(error, config.conflictGuidance);
|
|
290
302
|
}
|
|
291
303
|
const allEntries = readAnnotationEntries(result.item, config.collectionKey);
|
|
292
|
-
return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true
|
|
304
|
+
return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true, {
|
|
305
|
+
action: "edit",
|
|
306
|
+
entryIndex: config.input.index,
|
|
307
|
+
entry: allEntries[config.input.index - 1],
|
|
308
|
+
}, options.fullHistory === true);
|
|
293
309
|
}
|
|
294
310
|
let result;
|
|
295
311
|
try {
|
|
@@ -315,7 +331,11 @@ export async function runAnnotationCommand(id, options, global, config) {
|
|
|
315
331
|
wrapOwnershipConflict(error, config.conflictGuidance);
|
|
316
332
|
}
|
|
317
333
|
const allEntries = readAnnotationEntries(result.item, config.collectionKey);
|
|
318
|
-
return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true
|
|
334
|
+
return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true, {
|
|
335
|
+
action: "add",
|
|
336
|
+
entryIndex: allEntries.length,
|
|
337
|
+
entry: allEntries.at(-1),
|
|
338
|
+
}, options.fullHistory === true);
|
|
319
339
|
}
|
|
320
340
|
/** Implements resolve annotation index for the public runtime surface of this module. */
|
|
321
341
|
export function resolveAnnotationIndex(oneBasedIndex, count, collectionKey) {
|
|
@@ -330,21 +350,53 @@ export function resolveAnnotationIndex(oneBasedIndex, count, collectionKey) {
|
|
|
330
350
|
}
|
|
331
351
|
return oneBasedIndex - 1;
|
|
332
352
|
}
|
|
333
|
-
function renderAnnotationResult(id, collectionKey, allEntries, limit, includeMeta) {
|
|
334
|
-
const entries =
|
|
353
|
+
function renderAnnotationResult(id, collectionKey, allEntries, limit, includeMeta, mutation, fullHistory = false) {
|
|
354
|
+
const entries = mutation === undefined || fullHistory
|
|
355
|
+
? limitAnnotationEntries(allEntries, mutation !== undefined && fullHistory ? undefined : limit)
|
|
356
|
+
: mutation.entry === undefined
|
|
357
|
+
? []
|
|
358
|
+
: [mutation.entry];
|
|
359
|
+
const historyOmitted = mutation !== undefined && entries.length < allEntries.length;
|
|
335
360
|
return {
|
|
336
361
|
id,
|
|
337
362
|
[collectionKey]: entries,
|
|
338
363
|
count: entries.length,
|
|
339
|
-
...(includeMeta
|
|
364
|
+
...([includeMeta, mutation !== undefined].includes(true)
|
|
340
365
|
? {
|
|
341
366
|
total_count: allEntries.length,
|
|
342
367
|
returned_count: entries.length,
|
|
343
|
-
has_more: entries.length < allEntries.length,
|
|
368
|
+
has_more: historyOmitted || entries.length < allEntries.length,
|
|
344
369
|
...(limit !== undefined ? { limit } : {}),
|
|
345
370
|
}
|
|
346
371
|
: {}),
|
|
372
|
+
...(mutation === undefined
|
|
373
|
+
? {}
|
|
374
|
+
: {
|
|
375
|
+
mutation_receipt: {
|
|
376
|
+
action: mutation.action,
|
|
377
|
+
entry_index: mutation.entryIndex,
|
|
378
|
+
changed_count: 1,
|
|
379
|
+
full_history_included: !historyOmitted,
|
|
380
|
+
},
|
|
381
|
+
omission_receipt: {
|
|
382
|
+
has_omissions: historyOmitted,
|
|
383
|
+
omitted_field_group_count: historyOmitted ? 1 : 0,
|
|
384
|
+
omitted_field_groups: historyOmitted
|
|
385
|
+
? [
|
|
386
|
+
{
|
|
387
|
+
name: `${collectionKey}_history`,
|
|
388
|
+
restore_with: {
|
|
389
|
+
selector: "full_history",
|
|
390
|
+
cli_flag: "--full-history",
|
|
391
|
+
sdk_option: "fullHistory",
|
|
392
|
+
mcp_option: "full",
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
]
|
|
396
|
+
: [],
|
|
397
|
+
},
|
|
398
|
+
}),
|
|
347
399
|
};
|
|
348
400
|
}
|
|
349
401
|
//# sourceMappingURL=annotations.js.map
|
|
350
|
-
//# debugId=
|
|
402
|
+
//# debugId=13cf8bd9-0aee-5838-a6eb-de9f87ddfac7
|
|
@@ -52,6 +52,18 @@ export interface AcknowledgeUnknownAuthorEventsOptions {
|
|
|
52
52
|
/** Evidence-backed rationale for the attribution. */
|
|
53
53
|
reason: string;
|
|
54
54
|
}
|
|
55
|
+
/** Resolve the mutually exclusive CLI and SDK acknowledgment selectors. */
|
|
56
|
+
export declare function resolveUnknownAuthorAcknowledgmentSelector(rawEvents: readonly string[], allActionable: boolean): {
|
|
57
|
+
events: UnknownAuthorHistoryEvent[];
|
|
58
|
+
all_actionable: boolean;
|
|
59
|
+
};
|
|
60
|
+
/** Parse user-facing item or workspace history coordinates into SDK events. */
|
|
61
|
+
export declare function parseUnknownAuthorHistoryEventCoordinates(values: readonly string[]): UnknownAuthorHistoryEvent[];
|
|
62
|
+
/** Normalize an untyped transport payload and execute author acknowledgment. */
|
|
63
|
+
export declare function acknowledgeUnknownAuthorHistoryEventsFromTransport(pmRoot: string, input: Record<string, unknown>): Promise<{
|
|
64
|
+
acknowledged: number;
|
|
65
|
+
history_path: string;
|
|
66
|
+
}>;
|
|
55
67
|
/**
|
|
56
68
|
* Append an audited disposition for immutable unknown-author events without
|
|
57
69
|
* rewriting their original streams.
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Provides reusable diagnostics for mutation-author provenance in tracker history.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4fd16197-979e-5269-bed7-f2fb0e2038c2")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
|
-
import { appendWorkspaceAuditEvent } from "../core/history/workspace-history.js";
|
|
10
|
+
import { appendWorkspaceAuditEvent, WORKSPACE_HISTORY_ID, } from "../core/history/workspace-history.js";
|
|
11
11
|
import { readSettings } from "../core/store/settings.js";
|
|
12
12
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
13
13
|
import { PmCliError } from "../core/shared/errors.js";
|
|
14
|
+
import { readRuntimeString, readRuntimeStringArray } from "./runtime-input.js";
|
|
14
15
|
/**
|
|
15
16
|
* Refuse an acknowledgment argument as a classified usage error.
|
|
16
17
|
*
|
|
@@ -22,8 +23,8 @@ import { PmCliError } from "../core/shared/errors.js";
|
|
|
22
23
|
* keeps expected validation out of the error channel without masking genuine
|
|
23
24
|
* failures, which retain their own exit codes.
|
|
24
25
|
*/
|
|
25
|
-
function refuseAuthorAcknowledgmentArgument(message,
|
|
26
|
-
throw new PmCliError(message, EXIT_CODE.USAGE,
|
|
26
|
+
function refuseAuthorAcknowledgmentArgument(message, context) {
|
|
27
|
+
throw new PmCliError(message, EXIT_CODE.USAGE, context);
|
|
27
28
|
}
|
|
28
29
|
/** First release-governance anchor after which unknown authors require remediation. */
|
|
29
30
|
export const HISTORY_AUTHOR_ATTRIBUTION_BASELINE = "2026-07-15T06:22:12.276Z";
|
|
@@ -203,6 +204,63 @@ export const scanHistoryAuthorAttribution = async (pmRoot, sampleLimit = 20, inc
|
|
|
203
204
|
...(includeActionableEvents ? { actionable_events: actionableEvents } : {}),
|
|
204
205
|
};
|
|
205
206
|
};
|
|
207
|
+
/** Resolve the mutually exclusive CLI and SDK acknowledgment selectors. */
|
|
208
|
+
export function resolveUnknownAuthorAcknowledgmentSelector(rawEvents, allActionable) {
|
|
209
|
+
const hasExplicitEvents = rawEvents.length > 0;
|
|
210
|
+
if (hasExplicitEvents && allActionable) {
|
|
211
|
+
refuseAuthorAcknowledgmentArgument("Specify exactly one selector: repeat --event or pass --all-actionable.", {
|
|
212
|
+
code: "history_author_acknowledge_selector_conflict",
|
|
213
|
+
required: "Exactly one of --event or --all-actionable",
|
|
214
|
+
examples: [
|
|
215
|
+
'pm history-author-acknowledge --event pm-a1b2:4 --attributed-author agent --reviewer maintainer --reason "Verified provenance"',
|
|
216
|
+
'pm history-author-acknowledge --all-actionable --attributed-author import-agent --reviewer maintainer --reason "Reviewed the complete actionable set"',
|
|
217
|
+
],
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
if (!hasExplicitEvents && !allActionable) {
|
|
221
|
+
refuseAuthorAcknowledgmentArgument("Specify exactly one selector: repeat --event or pass --all-actionable.", {
|
|
222
|
+
code: "history_author_acknowledge_selector_required",
|
|
223
|
+
required: "Exactly one of --event or --all-actionable",
|
|
224
|
+
examples: [
|
|
225
|
+
'pm history-author-acknowledge --event pm-a1b2:4 --attributed-author agent --reviewer maintainer --reason "Verified provenance"',
|
|
226
|
+
'pm history-author-acknowledge --all-actionable --attributed-author import-agent --reviewer maintainer --reason "Reviewed the complete actionable set"',
|
|
227
|
+
],
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
events: parseUnknownAuthorHistoryEventCoordinates(rawEvents),
|
|
232
|
+
all_actionable: allActionable,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** Parse user-facing item or workspace history coordinates into SDK events. */
|
|
236
|
+
export function parseUnknownAuthorHistoryEventCoordinates(values) {
|
|
237
|
+
return values.map((value) => {
|
|
238
|
+
const separator = value.lastIndexOf(":");
|
|
239
|
+
const itemId = value.slice(0, separator).trim();
|
|
240
|
+
const line = Number(value.slice(separator + 1));
|
|
241
|
+
const validItemId = itemId === WORKSPACE_HISTORY_ID || /^[a-z0-9][a-z0-9-]*$/iu.test(itemId);
|
|
242
|
+
if (separator < 1 ||
|
|
243
|
+
!validItemId ||
|
|
244
|
+
!Number.isSafeInteger(line) ||
|
|
245
|
+
line < 1) {
|
|
246
|
+
refuseAuthorAcknowledgmentArgument(`history-author-acknowledge --event expects <item-id>:<one-based-line>, received "${value}".`, { code: "history_author_acknowledge_target_unreadable" });
|
|
247
|
+
}
|
|
248
|
+
return { item_id: itemId, line };
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/** Normalize an untyped transport payload and execute author acknowledgment. */
|
|
252
|
+
export function acknowledgeUnknownAuthorHistoryEventsFromTransport(pmRoot, input) {
|
|
253
|
+
const selector = resolveUnknownAuthorAcknowledgmentSelector(readRuntimeStringArray(input.historyEvent), input.allActionable === true || input.all_actionable === true);
|
|
254
|
+
return acknowledgeUnknownAuthorHistoryEvents(pmRoot, {
|
|
255
|
+
events: selector.events,
|
|
256
|
+
all_actionable: selector.all_actionable,
|
|
257
|
+
attributed_author: readRuntimeString(input, "attributedAuthor") ??
|
|
258
|
+
readRuntimeString(input, "attributed_author") ??
|
|
259
|
+
"",
|
|
260
|
+
reviewer: readRuntimeString(input, "reviewer") ?? "",
|
|
261
|
+
reason: readRuntimeString(input, "reason") ?? "",
|
|
262
|
+
});
|
|
263
|
+
}
|
|
206
264
|
/**
|
|
207
265
|
* Append an audited disposition for immutable unknown-author events without
|
|
208
266
|
* rewriting their original streams.
|
|
@@ -213,8 +271,11 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
213
271
|
const reason = options.reason.trim();
|
|
214
272
|
const explicitEvents = options.events ?? [];
|
|
215
273
|
const selectorCount = Number(options.all_actionable === true) + Number(explicitEvents.length > 0);
|
|
274
|
+
if (selectorCount === 0) {
|
|
275
|
+
refuseAuthorAcknowledgmentArgument("Specify exactly one selector: events or all_actionable.", { code: "history_author_acknowledge_selector_required" });
|
|
276
|
+
}
|
|
216
277
|
if (selectorCount > 1) {
|
|
217
|
-
refuseAuthorAcknowledgmentArgument("Author acknowledgment accepts either explicit events or all_actionable, not both.", "history_author_acknowledge_selector_conflict");
|
|
278
|
+
refuseAuthorAcknowledgmentArgument("Author acknowledgment accepts either explicit events or all_actionable, not both.", { code: "history_author_acknowledge_selector_conflict" });
|
|
218
279
|
}
|
|
219
280
|
const selectedEvents = options.all_actionable === true
|
|
220
281
|
? (await scanHistoryAuthorAttribution(pmRoot, 0, true))
|
|
@@ -229,7 +290,7 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
229
290
|
reason.length > 0,
|
|
230
291
|
].includes(false);
|
|
231
292
|
if (requiredValuesMissing) {
|
|
232
|
-
refuseAuthorAcknowledgmentArgument("Author acknowledgment requires events, reviewer, attributed_author, and reason.", "history_author_acknowledge_required_values_missing");
|
|
293
|
+
refuseAuthorAcknowledgmentArgument("Author acknowledgment requires events, reviewer, attributed_author, and reason.", { code: "history_author_acknowledge_required_values_missing" });
|
|
233
294
|
}
|
|
234
295
|
const uniqueEvents = [
|
|
235
296
|
...new Map(selectedEvents.map((event) => [
|
|
@@ -239,12 +300,13 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
239
300
|
].sort((left, right) => left.item_id.localeCompare(right.item_id) || left.line - right.line);
|
|
240
301
|
for (const event of uniqueEvents) {
|
|
241
302
|
const invalidCoordinate = [
|
|
242
|
-
|
|
303
|
+
event.item_id === WORKSPACE_HISTORY_ID ||
|
|
304
|
+
/^[a-z0-9][a-z0-9-]*$/i.test(event.item_id),
|
|
243
305
|
Number.isSafeInteger(event.line),
|
|
244
306
|
event.line >= 1,
|
|
245
307
|
].includes(false);
|
|
246
308
|
if (invalidCoordinate) {
|
|
247
|
-
refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, "history_author_acknowledge_target_unreadable");
|
|
309
|
+
refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
|
|
248
310
|
}
|
|
249
311
|
let parsed;
|
|
250
312
|
try {
|
|
@@ -253,10 +315,10 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
253
315
|
parsed = JSON.parse(line ?? "");
|
|
254
316
|
}
|
|
255
317
|
catch {
|
|
256
|
-
refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, "history_author_acknowledge_target_unreadable");
|
|
318
|
+
refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
|
|
257
319
|
}
|
|
258
320
|
if (classifyHistoryAuthorEvent(parsed) !== "actionable_unknown") {
|
|
259
|
-
refuseAuthorAcknowledgmentArgument(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`, "history_author_acknowledge_target_not_actionable");
|
|
321
|
+
refuseAuthorAcknowledgmentArgument(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`, { code: "history_author_acknowledge_target_not_actionable" });
|
|
260
322
|
}
|
|
261
323
|
}
|
|
262
324
|
const settings = await readSettings(pmRoot);
|
|
@@ -280,4 +342,4 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
280
342
|
};
|
|
281
343
|
}
|
|
282
344
|
//# sourceMappingURL=author-attribution.js.map
|
|
283
|
-
//# debugId=
|
|
345
|
+
//# debugId=4fd16197-979e-5269-bed7-f2fb0e2038c2
|