@unbrained/pm-cli 2026.8.8 → 2026.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +59 -0
- package/dist/cli/commander-usage.js +17 -12
- package/dist/cli/help-json-payload.js +51 -16
- package/dist/cli/main.js +7 -6
- package/dist/cli-bundle/bundle-manifest.json +162 -162
- package/dist/cli-bundle/chunks/chunk-2QYH4QMI.js +30 -0
- package/dist/cli-bundle/chunks/{chunk-2ZMXX3Q6.js → chunk-EBO7OUUE.js} +70 -70
- package/dist/cli-bundle/chunks/{chunk-NUXRRNAB.js → chunk-ETML5C6H.js} +48 -48
- package/dist/cli-bundle/chunks/chunk-JUDU4RO4.js +194 -0
- package/dist/cli-bundle/chunks/chunk-JZSNADRR.js +5 -0
- package/dist/cli-bundle/chunks/chunk-MENWVGJW.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ALDHXLPS.js → chunk-S4EITGLA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TIGKWVLA.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-CBLA33YK.js → chunk-TRWXF476.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TSLDTJLQ.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-WFZAMJHZ.js → register-list-query-OJ6ZXKV4.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-SOKKOTHQ.js → register-mutation-DKI7QC7O.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-P5OGMT6I.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-2HL5ZHMK.js → register-setup-S3KT2LTH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ANTMGYLI.js → chunk-2COZ67XT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2EXI2DKR.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YSAHYUXX.js → chunk-34SX654S.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-36FTZ2NT.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-3CQECMKR.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-75774JWP.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-7UN6BHHO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TCSAPH33.js → chunk-CHIBMEZR.js} +6 -6
- package/dist/cli-bundle/focused-chunks/chunk-DZGAHZZV.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-FF4MNAYB.js +153 -0
- package/dist/cli-bundle/focused-chunks/chunk-GHTN2ILR.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-I4YM2I7S.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IMDTEN7K.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IW43E4XL.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-JMVA4HKR.js +5 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PL2EYDJK.js → chunk-KR5RVXLQ.js} +31 -29
- package/dist/cli-bundle/focused-chunks/chunk-KSNJG4KI.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-M6RPIXKC.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MXYSIQ56.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-RIIN5V4N.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-RKWSCYYN.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 -2
- package/dist/core/diagnostics/remediation.js +19 -9
- package/dist/core/fs/fs-utils.d.ts +10 -0
- package/dist/core/fs/fs-utils.js +16 -4
- 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/item/item-format.js +3 -32
- package/dist/core/schema/fields-file.d.ts +1 -2
- package/dist/core/schema/fields-file.js +4 -11
- package/dist/core/schema/runtime-schema.js +3 -10
- package/dist/core/schema/status-defs-file.d.ts +1 -2
- package/dist/core/schema/status-defs-file.js +4 -32
- package/dist/core/schema/status-token.d.ts +2 -0
- package/dist/core/schema/status-token.js +32 -0
- package/dist/core/schema/type-workflows.d.ts +1 -2
- package/dist/core/schema/type-workflows.js +4 -11
- package/dist/core/shared/author.d.ts +25 -0
- package/dist/core/shared/author.js +128 -10
- package/dist/core/shared/errors.d.ts +4 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/text-normalization.d.ts +1 -1
- package/dist/core/shared/text-normalization.js +2 -2
- package/dist/sdk/actionability.d.ts +1 -1
- package/dist/sdk/actionability.js +3 -3
- package/dist/sdk/agent/command-recovery.d.ts +4 -0
- package/dist/sdk/agent/command-recovery.js +52 -0
- package/dist/sdk/agent/command-suggestions.d.ts +4 -0
- package/dist/sdk/agent/command-suggestions.js +67 -0
- package/dist/sdk/agent/create-option-policy.d.ts +12 -0
- package/dist/sdk/agent/create-option-policy.js +32 -0
- package/dist/sdk/agent/item-addressing.d.ts +19 -0
- package/dist/sdk/agent/item-addressing.js +208 -0
- package/dist/sdk/cli-bootstrap.d.ts +1 -1
- package/dist/sdk/cli-bootstrap.js +20 -5
- package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -4
- package/dist/sdk/cli-contracts/flag-contracts.js +62 -21
- package/dist/sdk/cli-contracts/registration-helpers.js +10 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +8 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +20 -3
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +19 -4
- package/dist/sdk/cli-contracts/tool-schema.js +17 -4
- package/dist/sdk/context-intent-runtime.js +8 -5
- package/dist/sdk/context-signal-store.d.ts +34 -0
- package/dist/sdk/context-signal-store.js +24 -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/dependency-flag-validation.d.ts +15 -1
- package/dist/sdk/dependency-flag-validation.js +54 -2
- package/dist/sdk/extension/bundled-catalog.js +19 -6
- package/dist/sdk/generated-error-code-catalog.js +110 -2
- package/dist/sdk/governance/health.js +38 -12
- package/dist/sdk/governance/provenance-health.d.ts +39 -0
- package/dist/sdk/governance/provenance-health.js +185 -0
- package/dist/sdk/governance/validate-item-reader.d.ts +13 -0
- package/dist/sdk/governance/validate-item-reader.js +18 -0
- package/dist/sdk/governance/validate.d.ts +2 -2
- package/dist/sdk/governance/validate.js +25 -11
- 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 +4 -0
- package/dist/sdk/index.js +6 -2
- package/dist/sdk/lifecycle/close.js +27 -19
- package/dist/sdk/lifecycle/create.d.ts +2 -0
- package/dist/sdk/lifecycle/create.js +66 -19
- package/dist/sdk/lifecycle/plan.js +6 -3
- package/dist/sdk/lifecycle/update-many.js +39 -27
- package/dist/sdk/lifecycle/update.d.ts +6 -1
- package/dist/sdk/lifecycle/update.js +51 -28
- 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 +4 -0
- package/dist/sdk/merge/install.js +29 -17
- package/dist/sdk/merge/receipts.d.ts +17 -1
- package/dist/sdk/merge/receipts.js +112 -20
- 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/output-projection.js +24 -4
- package/dist/sdk/query/context.d.ts +2 -0
- package/dist/sdk/query/context.js +7 -4
- package/dist/sdk/query/get.d.ts +11 -0
- package/dist/sdk/query/get.js +37 -3
- package/dist/sdk/query/light-metadata.d.ts +3 -0
- package/dist/sdk/query/light-metadata.js +19 -0
- package/dist/sdk/read-output-contracts.d.ts +1 -1
- package/dist/sdk/read-output-contracts.js +23 -4
- 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 +4 -1
- package/dist/sdk/runtime.js +8 -3
- package/dist/sdk/schema-migration.js +7 -9
- package/dist/sdk/similarity-scoring.d.ts +1 -2
- package/dist/sdk/similarity-scoring.js +4 -16
- 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/linked-command-detection.d.ts +2 -7
- package/dist/sdk/test/linked-command-detection.js +22 -9
- package/dist/sdk/workspace-snapshot.d.ts +4 -0
- package/dist/sdk/workspace-snapshot.js +24 -11
- package/docs/AGENT_GUIDE.md +5 -2
- package/docs/COMMANDS.md +27 -6
- package/docs/DEPENDENCY_KIND_CONTRACT.md +29 -0
- package/docs/ITEM_READ_PROJECTIONS.md +26 -0
- package/docs/MERGE_SAFETY.md +17 -8
- package/docs/README.md +2 -5
- package/docs/READ_OUTPUT_CONTRACTS.md +2 -2
- package/docs/RELATIONSHIP_GRAPH.md +1 -1
- package/docs/SDK.md +33 -8
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +36 -2
- package/docs/SDK_CONTEXT.md +97 -0
- package/docs/SDK_CONTEXT_INTEGRITY.md +33 -3
- package/docs/SENTRY_CONTRACT_EPOCHS.md +20 -0
- package/docs/agent-task-token-baseline.json +2 -2
- package/marketplace.json +2 -2
- package/package.json +5 -4
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +415 -43
- package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +0 -5
- package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +0 -26
- package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +0 -13
- package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +0 -194
- package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5FLBTZJQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +0 -14
- package/dist/cli-bundle/focused-chunks/chunk-DMKOMTTY.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-F5B3HBEZ.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-FI6DWU2M.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FNOKJG6N.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-FPDYXZBK.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-GWI6YIKJ.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-HCUC62AB.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HGNKPSCB.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +0 -2
|
@@ -4,10 +4,34 @@
|
|
|
4
4
|
* Generated by scripts/generate-error-code-catalog.mjs. Do not edit manually.
|
|
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]="94952ea0-bfe7-5d64-9ac4-101c483b4c55")}catch(e){}}();
|
|
8
8
|
import { definePmErrorCodeCatalog } from "./error-code-catalog.js";
|
|
9
9
|
/** Exhaustive catalog generated from literal error guidance declarations. */
|
|
10
10
|
export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
|
|
11
|
+
{
|
|
12
|
+
code: "acceptance_criteria_mutation_conflict",
|
|
13
|
+
meaning: "Acceptance criteria mutation conflict condition.",
|
|
14
|
+
stability: "provisional",
|
|
15
|
+
exit_code: 2,
|
|
16
|
+
class: "usage",
|
|
17
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
18
|
+
sources: ["sdk/lifecycle/update.ts"],
|
|
19
|
+
emitting_commands: ["update", "update-many"],
|
|
20
|
+
canonical_code: "acceptance_criteria_mutation_conflict",
|
|
21
|
+
aliases: [],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
code: "acceptance_criteria_remove_unmatched",
|
|
25
|
+
meaning: "Acceptance criteria remove unmatched condition.",
|
|
26
|
+
stability: "provisional",
|
|
27
|
+
exit_code: 3,
|
|
28
|
+
class: "not_found",
|
|
29
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
30
|
+
sources: ["sdk/lifecycle/update-many.ts", "sdk/lifecycle/update.ts"],
|
|
31
|
+
emitting_commands: ["update", "update-many"],
|
|
32
|
+
canonical_code: "acceptance_criteria_remove_unmatched",
|
|
33
|
+
aliases: [],
|
|
34
|
+
},
|
|
11
35
|
{
|
|
12
36
|
code: "acceptance_criteria_semicolon_forbidden",
|
|
13
37
|
meaning: "Acceptance criteria semicolon forbidden condition.",
|
|
@@ -308,6 +332,42 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
|
|
|
308
332
|
canonical_code: "conflicting_lifecycle_owner",
|
|
309
333
|
aliases: [],
|
|
310
334
|
},
|
|
335
|
+
{
|
|
336
|
+
code: "context_signal_store_invalid",
|
|
337
|
+
meaning: "Context signal store invalid condition.",
|
|
338
|
+
stability: "provisional",
|
|
339
|
+
exit_code: 2,
|
|
340
|
+
class: "usage",
|
|
341
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
342
|
+
sources: ["sdk/context-signal-store.ts"],
|
|
343
|
+
emitting_commands: ["*"],
|
|
344
|
+
canonical_code: "context_signal_store_invalid",
|
|
345
|
+
aliases: [],
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
code: "context_signal_store_stale",
|
|
349
|
+
meaning: "Context signal store stale condition.",
|
|
350
|
+
stability: "provisional",
|
|
351
|
+
exit_code: 1,
|
|
352
|
+
class: "generic_failure",
|
|
353
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
354
|
+
sources: ["sdk/context-signal-store.ts"],
|
|
355
|
+
emitting_commands: ["*"],
|
|
356
|
+
canonical_code: "context_signal_store_stale",
|
|
357
|
+
aliases: [],
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
code: "context_signal_store_write_failed",
|
|
361
|
+
meaning: "Context signal store write failed condition.",
|
|
362
|
+
stability: "provisional",
|
|
363
|
+
exit_code: 1,
|
|
364
|
+
class: "generic_failure",
|
|
365
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
366
|
+
sources: ["sdk/context-signal-store.ts"],
|
|
367
|
+
emitting_commands: ["*"],
|
|
368
|
+
canonical_code: "context_signal_store_write_failed",
|
|
369
|
+
aliases: [],
|
|
370
|
+
},
|
|
311
371
|
{
|
|
312
372
|
code: "context_takes_no_item_argument",
|
|
313
373
|
meaning: "Context takes no item argument condition.",
|
|
@@ -356,6 +416,18 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
|
|
|
356
416
|
canonical_code: "dependency_edge_not_allowed",
|
|
357
417
|
aliases: [],
|
|
358
418
|
},
|
|
419
|
+
{
|
|
420
|
+
code: "dependency_target_not_found",
|
|
421
|
+
meaning: "Dependency target not found condition.",
|
|
422
|
+
stability: "provisional",
|
|
423
|
+
exit_code: 3,
|
|
424
|
+
class: "not_found",
|
|
425
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
426
|
+
sources: ["sdk/dependency-flag-validation.ts"],
|
|
427
|
+
emitting_commands: ["*"],
|
|
428
|
+
canonical_code: "dependency_target_not_found",
|
|
429
|
+
aliases: [],
|
|
430
|
+
},
|
|
359
431
|
{
|
|
360
432
|
code: "duplicate_command",
|
|
361
433
|
meaning: "Duplicate command condition.",
|
|
@@ -1469,6 +1541,18 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
|
|
|
1469
1541
|
canonical_code: "merge_conflict_markers_detected",
|
|
1470
1542
|
aliases: ["history_merge_conflict_markers_detected"],
|
|
1471
1543
|
},
|
|
1544
|
+
{
|
|
1545
|
+
code: "merge_decisions_unreviewed",
|
|
1546
|
+
meaning: "Merge decisions unreviewed condition.",
|
|
1547
|
+
stability: "provisional",
|
|
1548
|
+
exit_code: 1,
|
|
1549
|
+
class: "generic_failure",
|
|
1550
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
1551
|
+
sources: ["core/diagnostics/remediation.ts"],
|
|
1552
|
+
emitting_commands: ["*"],
|
|
1553
|
+
canonical_code: "merge_decisions_unreviewed",
|
|
1554
|
+
aliases: [],
|
|
1555
|
+
},
|
|
1472
1556
|
{
|
|
1473
1557
|
code: "merge_git_config_unwritable",
|
|
1474
1558
|
meaning: "Merge git config unwritable condition.",
|
|
@@ -1481,6 +1565,18 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
|
|
|
1481
1565
|
canonical_code: "merge_git_config_unwritable",
|
|
1482
1566
|
aliases: [],
|
|
1483
1567
|
},
|
|
1568
|
+
{
|
|
1569
|
+
code: "merge_reconcile_discards_require_acceptance",
|
|
1570
|
+
meaning: "Merge reconcile discards require acceptance condition.",
|
|
1571
|
+
stability: "provisional",
|
|
1572
|
+
exit_code: 4,
|
|
1573
|
+
class: "conflict",
|
|
1574
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
1575
|
+
sources: ["sdk/merge/reconcile.ts"],
|
|
1576
|
+
emitting_commands: ["*"],
|
|
1577
|
+
canonical_code: "merge_reconcile_discards_require_acceptance",
|
|
1578
|
+
aliases: [],
|
|
1579
|
+
},
|
|
1484
1580
|
{
|
|
1485
1581
|
code: "merge_root_not_found",
|
|
1486
1582
|
meaning: "Merge root not found condition.",
|
|
@@ -2587,6 +2683,18 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
|
|
|
2587
2683
|
canonical_code: "validate_lifecycle_stale_blockers",
|
|
2588
2684
|
aliases: [],
|
|
2589
2685
|
},
|
|
2686
|
+
{
|
|
2687
|
+
code: "validate_merge_decisions_unreviewed",
|
|
2688
|
+
meaning: "Validate merge decisions unreviewed condition.",
|
|
2689
|
+
stability: "provisional",
|
|
2690
|
+
exit_code: 1,
|
|
2691
|
+
class: "generic_failure",
|
|
2692
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
2693
|
+
sources: ["core/diagnostics/remediation.ts"],
|
|
2694
|
+
emitting_commands: ["*"],
|
|
2695
|
+
canonical_code: "validate_merge_decisions_unreviewed",
|
|
2696
|
+
aliases: [],
|
|
2697
|
+
},
|
|
2590
2698
|
{
|
|
2591
2699
|
code: "validate_merge_fence_drift",
|
|
2592
2700
|
meaning: "Validate merge fence drift condition.",
|
|
@@ -3021,4 +3129,4 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
|
|
|
3021
3129
|
},
|
|
3022
3130
|
]);
|
|
3023
3131
|
//# sourceMappingURL=generated-error-code-catalog.js.map
|
|
3024
|
-
//# debugId=
|
|
3132
|
+
//# debugId=94952ea0-bfe7-5d64-9ac4-101c483b4c55
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm health 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]="539b0cb4-5e20-51e2-a33e-1a43ca961f05")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
|
|
@@ -28,19 +28,20 @@ import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
|
|
|
28
28
|
import { nowIso } from "../../core/shared/time.js";
|
|
29
29
|
import { parseItemDocument } from "../../core/item/item-format.js";
|
|
30
30
|
import { effectiveItemFormatVersion, scanItemFormatVersions, } from "../../core/item/item-format-version.js";
|
|
31
|
-
import {
|
|
31
|
+
import { listAllItemMetadataLight, listAllItemMetadataWithBody, } from "../../core/store/item-store.js";
|
|
32
32
|
import { PM_TELEMETRY_SOURCE_CONTEXT_VALUES, TELEMETRY_MAX_QUEUE_ENTRY_ATTEMPTS, TELEMETRY_SCHEMA_VERSION, } from "../../core/telemetry/runtime.js";
|
|
33
33
|
import { getItemFormatFromPath, getSettingsPath, ITEM_FILE_EXTENSIONS, resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
|
|
34
34
|
import { readSettingsWithMetadata } from "../../core/store/settings.js";
|
|
35
35
|
import { buildRemediationMap } from "../../core/diagnostics/remediation.js";
|
|
36
36
|
import { scanHistoryAuthorAttribution, } from "../author-attribution.js";
|
|
37
37
|
import { readManagedExtensionState } from "../extension.js";
|
|
38
|
+
import { scanProvenanceResolverHealth } from "./provenance-health.js";
|
|
38
39
|
import { applyStoredExtensionMigrationState } from "../extension/migrations.js";
|
|
39
40
|
import { buildCapabilityContractMetadata, buildRegistrationCollisionRemediation, collectUnknownCapabilityGuidance, } from "../extension/doctor.js";
|
|
40
41
|
import { scanStaleInProgressItems, } from "./stale-work.js";
|
|
41
42
|
import { scanTrackedRuntimeCache } from "./tracked-runtime-cache.js";
|
|
42
43
|
import { auditMergeDriverConfiguration, findGitWorkspaceRoot, } from "../merge/install.js";
|
|
43
|
-
import { listMergeReceipts } from "../merge/receipts.js";
|
|
44
|
+
import { listMergeReceipts, partitionMergeReceipts, } from "../merge/receipts.js";
|
|
44
45
|
const PM_TELEMETRY_SOURCE_CONTEXT_SET = new Set(PM_TELEMETRY_SOURCE_CONTEXT_VALUES);
|
|
45
46
|
const STALE_VECTORIZATION_SUMMARY_LIMIT = 25;
|
|
46
47
|
const BRIEF_HEALTH_DETAIL_LIMIT = 8;
|
|
@@ -58,6 +59,7 @@ function isAdvisoryHealthWarning(warning, requireMergeDrivers = false) {
|
|
|
58
59
|
return (warning.startsWith("telemetry_") ||
|
|
59
60
|
warning.startsWith("history_stream_over_compact_threshold:") ||
|
|
60
61
|
warning.startsWith("stale_in_progress_items:") ||
|
|
62
|
+
warning.startsWith("provenance_resolver_zero_success:") ||
|
|
61
63
|
(!requireMergeDrivers &&
|
|
62
64
|
warning.startsWith("merge_driver_configuration_missing:")));
|
|
63
65
|
}
|
|
@@ -318,7 +320,13 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
318
320
|
const mergeDriverAudit = gitWorkspaceRoot === null
|
|
319
321
|
? null
|
|
320
322
|
: await auditMergeDriverConfiguration(gitWorkspaceRoot);
|
|
321
|
-
const pendingMergeReceipts = gitWorkspaceRoot === null
|
|
323
|
+
const pendingMergeReceipts = gitWorkspaceRoot === null
|
|
324
|
+
? []
|
|
325
|
+
: await listMergeReceipts(gitWorkspaceRoot, {
|
|
326
|
+
includeLossless: true,
|
|
327
|
+
pmRoot,
|
|
328
|
+
});
|
|
329
|
+
const { pendingDecisions: pendingMergeDecisions, lossless: losslessMergeReceipts, } = partitionMergeReceipts(pendingMergeReceipts);
|
|
322
330
|
const mergeDriverInstallationMissing = mergeDriverAudit?.status === "missing" &&
|
|
323
331
|
mergeDriverAudit.missing_keys.length === 5 &&
|
|
324
332
|
mergeDriverAudit.drifted_keys.length === 0;
|
|
@@ -343,8 +351,8 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
343
351
|
`merge_driver_configuration_${mergeDriverInstallationMissing ? "missing" : "drift"}:${mergeDriverAudit.missing_keys.length + mergeDriverAudit.drifted_keys.length}`,
|
|
344
352
|
]
|
|
345
353
|
: []),
|
|
346
|
-
...(
|
|
347
|
-
? [`merge_decisions_unreviewed:${
|
|
354
|
+
...(pendingMergeDecisions.length > 0
|
|
355
|
+
? [`merge_decisions_unreviewed:${pendingMergeDecisions.length}`]
|
|
348
356
|
: []),
|
|
349
357
|
];
|
|
350
358
|
const normalizedWarnings = [...new Set(warnings)].sort((left, right) => left.localeCompare(right));
|
|
@@ -369,7 +377,8 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
369
377
|
? 0
|
|
370
378
|
: mergeDriverAudit.missing_keys.length +
|
|
371
379
|
mergeDriverAudit.drifted_keys.length,
|
|
372
|
-
pending_merge_decisions:
|
|
380
|
+
pending_merge_decisions: pendingMergeDecisions.length,
|
|
381
|
+
lossless_merge_receipts: losslessMergeReceipts.length,
|
|
373
382
|
},
|
|
374
383
|
item_unreadable: itemScan.unreadable,
|
|
375
384
|
item_conflict_markers: itemScan.conflictMarkers,
|
|
@@ -392,7 +401,10 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
392
401
|
required: requireMergeDrivers,
|
|
393
402
|
},
|
|
394
403
|
pending_merge_decision_items: [
|
|
395
|
-
...new Set(
|
|
404
|
+
...new Set(pendingMergeDecisions.map((receipt) => receipt.item_id)),
|
|
405
|
+
].sort((left, right) => left.localeCompare(right)),
|
|
406
|
+
lossless_merge_receipt_items: [
|
|
407
|
+
...new Set(losslessMergeReceipts.map((receipt) => receipt.item_id)),
|
|
396
408
|
].sort((left, right) => left.localeCompare(right)),
|
|
397
409
|
},
|
|
398
410
|
},
|
|
@@ -1643,7 +1655,7 @@ function resolveHealthSkipPolicy(options) {
|
|
|
1643
1655
|
}
|
|
1644
1656
|
async function readHealthItems(params) {
|
|
1645
1657
|
if (params.skipPolicy.skipDrift && params.skipPolicy.skipVectors) {
|
|
1646
|
-
return
|
|
1658
|
+
return listAllItemMetadataLight(params.pmRoot, params.settings.item_format, params.typeRegistry.type_to_folder, params.itemReadWarnings, params.settings.schema);
|
|
1647
1659
|
}
|
|
1648
1660
|
return listAllItemMetadataWithBody(params.pmRoot, params.settings.item_format, params.typeRegistry.type_to_folder, params.itemReadWarnings, params.settings.schema);
|
|
1649
1661
|
}
|
|
@@ -1693,7 +1705,7 @@ const resolveUnknownAuthorEventCount = (authorAttribution) => authorAttribution.
|
|
|
1693
1705
|
/** Preserve actionable-author semantics for current and legacy scan payloads. */
|
|
1694
1706
|
const resolveActionableUnknownAuthorEventCount = (authorAttribution) => authorAttribution.actionable_unknown_event_count ??
|
|
1695
1707
|
resolveUnknownAuthorEventCount(authorAttribution);
|
|
1696
|
-
function buildStorageHealthCheck(items, settings, historySummary, authorAttribution, staleInProgress) {
|
|
1708
|
+
function buildStorageHealthCheck(items, settings, historySummary, authorAttribution, staleInProgress, provenanceResolverOutcomes, provenanceInvalidValues) {
|
|
1697
1709
|
const unknownAuthorEventCount = resolveUnknownAuthorEventCount(authorAttribution);
|
|
1698
1710
|
const actionableUnknownAuthorEventCount = resolveActionableUnknownAuthorEventCount(authorAttribution);
|
|
1699
1711
|
const hasAuthorEvents = unknownAuthorEventCount > 0;
|
|
@@ -1726,6 +1738,12 @@ function buildStorageHealthCheck(items, settings, historySummary, authorAttribut
|
|
|
1726
1738
|
...(hasStaleInProgressItems
|
|
1727
1739
|
? { stale_in_progress: staleInProgress }
|
|
1728
1740
|
: {}),
|
|
1741
|
+
...(provenanceResolverOutcomes.length > 0
|
|
1742
|
+
? { provenance_resolver_outcomes: provenanceResolverOutcomes }
|
|
1743
|
+
: {}),
|
|
1744
|
+
...(provenanceInvalidValues.length > 0
|
|
1745
|
+
? { provenance_invalid_values: provenanceInvalidValues }
|
|
1746
|
+
: {}),
|
|
1729
1747
|
...(historySummary.max_entries !== null
|
|
1730
1748
|
? {
|
|
1731
1749
|
compact_policy: {
|
|
@@ -1756,6 +1774,7 @@ function collectHealthWarnings(params) {
|
|
|
1756
1774
|
...params.historySummary.warnings,
|
|
1757
1775
|
...params.authorAttributionWarnings,
|
|
1758
1776
|
...params.staleInProgressWarnings,
|
|
1777
|
+
...params.provenanceWarnings,
|
|
1759
1778
|
...params.locksCheck.warnings,
|
|
1760
1779
|
...params.integrityCheck.warnings,
|
|
1761
1780
|
...params.historyDriftCheck.warnings,
|
|
@@ -1779,6 +1798,7 @@ function buildHealthRemediationSources(params) {
|
|
|
1779
1798
|
...params.historySummary.over_threshold.map((id) => `history_stream_over_compact_threshold:${id}`),
|
|
1780
1799
|
...params.authorAttributionWarnings,
|
|
1781
1800
|
...params.staleInProgressWarnings,
|
|
1801
|
+
...params.provenanceWarnings,
|
|
1782
1802
|
],
|
|
1783
1803
|
locks: params.locksCheck.warnings,
|
|
1784
1804
|
integrity: params.integrityCheck.warnings,
|
|
@@ -1865,6 +1885,10 @@ export async function runHealth(global, options = {}) {
|
|
|
1865
1885
|
in_progress_status: settings.schema.workflow.in_progress_status,
|
|
1866
1886
|
threshold_hours: settings.mutation_guard.stale_in_progress_hours,
|
|
1867
1887
|
}));
|
|
1888
|
+
const provenanceResolverHealth = await scanProvenanceResolverHealth(pmRoot);
|
|
1889
|
+
const provenanceResolverOutcomes = provenanceResolverHealth.outcomes;
|
|
1890
|
+
const provenanceInvalidValues = provenanceResolverHealth.invalid_values;
|
|
1891
|
+
const provenanceWarnings = provenanceResolverHealth.warnings;
|
|
1868
1892
|
const locksCheck = await buildLocksCheck(pmRoot);
|
|
1869
1893
|
const integrityCheck = skipPolicy.skipIntegrity
|
|
1870
1894
|
? buildSkippedHealthCheck("integrity")
|
|
@@ -1881,7 +1905,7 @@ export async function runHealth(global, options = {}) {
|
|
|
1881
1905
|
buildSettingsValuesHealthCheck(settingWarnings),
|
|
1882
1906
|
telemetryCheck.check,
|
|
1883
1907
|
extensionCheck.check,
|
|
1884
|
-
buildStorageHealthCheck(items, settings, historySummary, authorAttribution, staleInProgress.scan),
|
|
1908
|
+
buildStorageHealthCheck(items, settings, historySummary, authorAttribution, staleInProgress.scan, provenanceResolverOutcomes, provenanceInvalidValues),
|
|
1885
1909
|
locksCheck.check,
|
|
1886
1910
|
integrityCheck.check,
|
|
1887
1911
|
historyDriftCheck.check,
|
|
@@ -1898,6 +1922,7 @@ export async function runHealth(global, options = {}) {
|
|
|
1898
1922
|
historySummary,
|
|
1899
1923
|
authorAttributionWarnings,
|
|
1900
1924
|
staleInProgressWarnings: staleInProgress.warnings,
|
|
1925
|
+
provenanceWarnings,
|
|
1901
1926
|
locksCheck,
|
|
1902
1927
|
integrityCheck,
|
|
1903
1928
|
historyDriftCheck,
|
|
@@ -1914,6 +1939,7 @@ export async function runHealth(global, options = {}) {
|
|
|
1914
1939
|
historySummary,
|
|
1915
1940
|
authorAttributionWarnings,
|
|
1916
1941
|
staleInProgressWarnings: staleInProgress.warnings,
|
|
1942
|
+
provenanceWarnings,
|
|
1917
1943
|
locksCheck,
|
|
1918
1944
|
integrityCheck,
|
|
1919
1945
|
historyDriftCheck,
|
|
@@ -1964,4 +1990,4 @@ export const _testOnlyHealthCommand = {
|
|
|
1964
1990
|
warningCode,
|
|
1965
1991
|
};
|
|
1966
1992
|
//# sourceMappingURL=health.js.map
|
|
1967
|
-
//# debugId=
|
|
1993
|
+
//# debugId=539b0cb4-5e20-51e2-a33e-1a43ca961f05
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Aggregated resolver attempts for one harness provenance dimension. */
|
|
2
|
+
export interface ProvenanceResolverHealthOutcome {
|
|
3
|
+
/** Detected harness namespace. */
|
|
4
|
+
harness: string;
|
|
5
|
+
/** Provenance dimension resolved by the bounded resolver. */
|
|
6
|
+
dimension: string;
|
|
7
|
+
/** Built-in resolver name. */
|
|
8
|
+
resolver: string;
|
|
9
|
+
/** Events on which the resolver was actually attempted. */
|
|
10
|
+
attempts: number;
|
|
11
|
+
/** Attempted events that produced a bounded value. */
|
|
12
|
+
successes: number;
|
|
13
|
+
}
|
|
14
|
+
/** Aggregate for legacy provenance values that violate the bounded domain. */
|
|
15
|
+
export interface ProvenanceValueHealthFinding {
|
|
16
|
+
/** Detected harness namespace. */
|
|
17
|
+
harness: string;
|
|
18
|
+
/** Provenance dimension containing the invalid value. */
|
|
19
|
+
dimension: string;
|
|
20
|
+
/** Privacy-safe invalid-value class. */
|
|
21
|
+
kind: "boolean" | "single_digit";
|
|
22
|
+
/** Events containing this invalid value class. */
|
|
23
|
+
count: number;
|
|
24
|
+
}
|
|
25
|
+
/** Bounded provenance health result suitable for `pm health` adapters. */
|
|
26
|
+
export interface ProvenanceResolverHealthScan {
|
|
27
|
+
/** Stable resolver outcome aggregates. */
|
|
28
|
+
outcomes: ProvenanceResolverHealthOutcome[];
|
|
29
|
+
/** Aggregated invalid legacy values without retaining the values themselves. */
|
|
30
|
+
invalid_values: ProvenanceValueHealthFinding[];
|
|
31
|
+
/** Advisory warnings for attempted resolvers with no success. */
|
|
32
|
+
warnings: string[];
|
|
33
|
+
/** Number of nonblank history events inspected. */
|
|
34
|
+
events_read: number;
|
|
35
|
+
/** Whether an event or byte ceiling omitted history input. */
|
|
36
|
+
truncated: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Scan immutable history without failing over malformed streams owned by integrity checks. */
|
|
39
|
+
export declare function scanProvenanceResolverHealth(pmRoot: string, eventLimit?: number): Promise<ProvenanceResolverHealthScan>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/governance/provenance-health
|
|
3
|
+
*
|
|
4
|
+
* Reads bounded, privacy-safe provenance resolver outcomes for health checks.
|
|
5
|
+
*/
|
|
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]="60154e1b-8348-5b6b-badf-e76bba43bef8")}catch(e){}}();
|
|
8
|
+
import fs from "node:fs/promises";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
const DEFAULT_PROVENANCE_HISTORY_BYTE_LIMIT = 8_388_608;
|
|
11
|
+
const ATTEMPTED_PROVENANCE_OUTCOME_STATUSES = new Set(["resolved", "failed"]);
|
|
12
|
+
const INVALID_PROVENANCE_VALUE_CLASSIFIERS = [
|
|
13
|
+
{
|
|
14
|
+
kind: "boolean",
|
|
15
|
+
matches: (value) => typeof value === "boolean" ||
|
|
16
|
+
(typeof value === "string" && /^(?:true|false)$/iu.test(value.trim())),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
kind: "single_digit",
|
|
20
|
+
matches: (value) => (typeof value === "number" &&
|
|
21
|
+
Number.isInteger(value) &&
|
|
22
|
+
value >= 0 &&
|
|
23
|
+
value <= 9) ||
|
|
24
|
+
(typeof value === "string" && /^\d$/u.test(value.trim())),
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
function isRecord(value) {
|
|
28
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29
|
+
}
|
|
30
|
+
async function listHistoryFiles(pmRoot) {
|
|
31
|
+
try {
|
|
32
|
+
return (await fs.readdir(path.join(pmRoot, "history")))
|
|
33
|
+
.filter((file) => file.endsWith(".jsonl"))
|
|
34
|
+
.sort();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function readHistoryFile(pmRoot, file, byteLimit) {
|
|
41
|
+
let handle;
|
|
42
|
+
try {
|
|
43
|
+
handle = await fs.open(path.join(pmRoot, "history", file), "r");
|
|
44
|
+
const size = (await handle.stat()).size;
|
|
45
|
+
const length = Math.min(size, Math.max(0, byteLimit));
|
|
46
|
+
const buffer = Buffer.alloc(length);
|
|
47
|
+
const { bytesRead } = await handle.read(buffer, 0, length, 0);
|
|
48
|
+
const decoded = buffer.subarray(0, bytesRead).toString("utf8");
|
|
49
|
+
const complete = bytesRead >= size;
|
|
50
|
+
const finalNewline = decoded.lastIndexOf("\n");
|
|
51
|
+
let content = decoded;
|
|
52
|
+
if (!complete) {
|
|
53
|
+
content = finalNewline === -1 ? "" : decoded.slice(0, finalNewline + 1);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
content,
|
|
57
|
+
bytesRead,
|
|
58
|
+
complete,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
await handle?.close();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function parseHistoryEntry(line) {
|
|
69
|
+
try {
|
|
70
|
+
const value = JSON.parse(line);
|
|
71
|
+
return isRecord(value) ? value : null;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function collectResolverOutcomes(entry, aggregates, invalidValues) {
|
|
78
|
+
const harness = typeof entry.agent_harness === "string" ? entry.agent_harness : undefined;
|
|
79
|
+
if (harness === undefined)
|
|
80
|
+
return;
|
|
81
|
+
const provenance = isRecord(entry.agent_provenance)
|
|
82
|
+
? entry.agent_provenance
|
|
83
|
+
: {};
|
|
84
|
+
Object.entries(provenance).forEach(([dimension, observation]) => {
|
|
85
|
+
if (!isRecord(observation))
|
|
86
|
+
return;
|
|
87
|
+
const kind = INVALID_PROVENANCE_VALUE_CLASSIFIERS.find((classifier) => classifier.matches(observation.value))?.kind;
|
|
88
|
+
if (!kind)
|
|
89
|
+
return;
|
|
90
|
+
const key = `${harness}\0${dimension}\0${kind}`;
|
|
91
|
+
const aggregate = invalidValues.get(key) ?? {
|
|
92
|
+
harness,
|
|
93
|
+
dimension,
|
|
94
|
+
kind,
|
|
95
|
+
count: 0,
|
|
96
|
+
};
|
|
97
|
+
aggregate.count += 1;
|
|
98
|
+
invalidValues.set(key, aggregate);
|
|
99
|
+
});
|
|
100
|
+
if (!isRecord(entry.context))
|
|
101
|
+
return;
|
|
102
|
+
const outcomes = entry.context.agent_provenance_outcomes;
|
|
103
|
+
if (!isRecord(outcomes))
|
|
104
|
+
return;
|
|
105
|
+
Object.entries(outcomes).forEach(([dimension, rawOutcome]) => {
|
|
106
|
+
if (!isRecord(rawOutcome) || typeof rawOutcome.resolver !== "string") {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (!ATTEMPTED_PROVENANCE_OUTCOME_STATUSES.has(String(rawOutcome.status))) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const key = `${harness}\0${dimension}\0${rawOutcome.resolver}`;
|
|
113
|
+
const aggregate = aggregates.get(key) ?? {
|
|
114
|
+
harness,
|
|
115
|
+
dimension,
|
|
116
|
+
resolver: rawOutcome.resolver,
|
|
117
|
+
attempts: 0,
|
|
118
|
+
successes: 0,
|
|
119
|
+
};
|
|
120
|
+
aggregate.attempts += 1;
|
|
121
|
+
if (rawOutcome.status === "resolved")
|
|
122
|
+
aggregate.successes += 1;
|
|
123
|
+
aggregates.set(key, aggregate);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function collectHistoryContent(content, aggregates, invalidValues, eventLimit, initialEventsRead) {
|
|
127
|
+
let eventsRead = initialEventsRead;
|
|
128
|
+
for (const line of content.split("\n")) {
|
|
129
|
+
if (line.trim().length === 0)
|
|
130
|
+
continue;
|
|
131
|
+
if (eventsRead >= eventLimit)
|
|
132
|
+
return { eventsRead, truncated: true };
|
|
133
|
+
eventsRead += 1;
|
|
134
|
+
const entry = parseHistoryEntry(line);
|
|
135
|
+
if (entry)
|
|
136
|
+
collectResolverOutcomes(entry, aggregates, invalidValues);
|
|
137
|
+
}
|
|
138
|
+
return { eventsRead, truncated: false };
|
|
139
|
+
}
|
|
140
|
+
/** Scan immutable history without failing over malformed streams owned by integrity checks. */
|
|
141
|
+
export async function scanProvenanceResolverHealth(pmRoot, eventLimit = 10_000) {
|
|
142
|
+
const aggregates = new Map();
|
|
143
|
+
const invalidValues = new Map();
|
|
144
|
+
let eventsRead = 0;
|
|
145
|
+
let bytesRead = 0;
|
|
146
|
+
let truncated = false;
|
|
147
|
+
for (const file of await listHistoryFiles(pmRoot)) {
|
|
148
|
+
const history = await readHistoryFile(pmRoot, file, Math.max(0, DEFAULT_PROVENANCE_HISTORY_BYTE_LIMIT - bytesRead));
|
|
149
|
+
if (history === null)
|
|
150
|
+
continue;
|
|
151
|
+
bytesRead += history.bytesRead;
|
|
152
|
+
const collected = collectHistoryContent(history.content, aggregates, invalidValues, eventLimit, eventsRead);
|
|
153
|
+
eventsRead = collected.eventsRead;
|
|
154
|
+
if (collected.truncated) {
|
|
155
|
+
truncated = true;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
if (!history.complete) {
|
|
159
|
+
truncated = true;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const outcomes = [...aggregates.values()].sort((left, right) => left.harness.localeCompare(right.harness) ||
|
|
164
|
+
left.dimension.localeCompare(right.dimension) ||
|
|
165
|
+
left.resolver.localeCompare(right.resolver));
|
|
166
|
+
const invalidValueFindings = [...invalidValues.values()].sort((left, right) => left.harness.localeCompare(right.harness) ||
|
|
167
|
+
left.dimension.localeCompare(right.dimension) ||
|
|
168
|
+
left.kind.localeCompare(right.kind));
|
|
169
|
+
return {
|
|
170
|
+
outcomes,
|
|
171
|
+
invalid_values: invalidValueFindings,
|
|
172
|
+
warnings: truncated
|
|
173
|
+
? []
|
|
174
|
+
: [
|
|
175
|
+
...outcomes
|
|
176
|
+
.filter((outcome) => outcome.attempts > 0 && outcome.successes === 0)
|
|
177
|
+
.map((outcome) => `provenance_resolver_zero_success:${outcome.harness}:${outcome.dimension}:${outcome.resolver}:${String(outcome.attempts)}`),
|
|
178
|
+
...invalidValueFindings.map((finding) => `provenance_value_domain_invalid:${finding.harness}:${finding.dimension}:${finding.kind}:${String(finding.count)}`),
|
|
179
|
+
],
|
|
180
|
+
events_read: eventsRead,
|
|
181
|
+
truncated,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=provenance-health.js.map
|
|
185
|
+
//# debugId=60154e1b-8348-5b6b-badf-e76bba43bef8
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ItemMetadata, PmSettings } from "../../types/index.js";
|
|
2
|
+
/** Item projection accepted by validate checks; body is read only for strict drift verification. */
|
|
3
|
+
export type ValidateItem = ItemMetadata & {
|
|
4
|
+
body: string;
|
|
5
|
+
};
|
|
6
|
+
/** Load collections for normal checks and add bodies only when history hashes must be verified. */
|
|
7
|
+
export declare function readValidateItems(params: {
|
|
8
|
+
includeBody: boolean;
|
|
9
|
+
pmRoot: string;
|
|
10
|
+
settings: PmSettings;
|
|
11
|
+
typeToFolder: Record<string, string>;
|
|
12
|
+
warnings: string[];
|
|
13
|
+
}): Promise<ValidateItem[]>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/governance/validate-item-reader
|
|
3
|
+
*
|
|
4
|
+
* Selects the least expensive authoritative item projection required by a
|
|
5
|
+
* validation run.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
!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]="896ffe11-2cf1-5de0-8d07-5585d4f30c94")}catch(e){}}();
|
|
9
|
+
import { listAllItemMetadata, listAllItemMetadataWithBody, } from "../../core/store/item-store.js";
|
|
10
|
+
/** Load collections for normal checks and add bodies only when history hashes must be verified. */
|
|
11
|
+
export async function readValidateItems(params) {
|
|
12
|
+
if (params.includeBody) {
|
|
13
|
+
return listAllItemMetadataWithBody(params.pmRoot, params.settings.item_format, params.typeToFolder, params.warnings, params.settings.schema);
|
|
14
|
+
}
|
|
15
|
+
return listAllItemMetadata(params.pmRoot, params.settings.item_format, params.typeToFolder, params.warnings, params.settings.schema);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=validate-item-reader.js.map
|
|
18
|
+
//# debugId=896ffe11-2cf1-5de0-8d07-5585d4f30c94
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type RuntimeStatusRegistry } from "../../core/schema/runtime-schema.js";
|
|
2
2
|
import type { GlobalOptions } from "../../core/shared/command-types.js";
|
|
3
|
-
import { listAllItemMetadataWithBody } from "../../core/store/item-store.js";
|
|
4
3
|
import { type CloseReasonBackfillRow, type EstimateBackfillRow, type StaleLinkPruneRow, type TerminalParentFixRow, type ValidateFixRecord } from "../../core/validate/fix-planning.js";
|
|
5
4
|
import { type DuplicateIssueCode } from "../../core/governance/issue-codes.js";
|
|
6
5
|
import { type MissingFieldOccurrence } from "../../core/validate/missing-by-type.js";
|
|
7
6
|
import type { ValidateMetadataProfile, ValidateMetadataRequiredField } from "../../types/index.js";
|
|
8
7
|
import { type OutputProjectionDeclaration } from "../output-projection.js";
|
|
9
8
|
import { type RelationshipKindRegistry } from "../relationships.js";
|
|
9
|
+
import { type ValidateItem } from "./validate-item-reader.js";
|
|
10
10
|
type ValidateCheckName = "metadata" | "resolution" | "lifecycle" | "dependency_references" | "files" | "command_references" | "history_drift" | "format_version" | "storage_integrity";
|
|
11
11
|
type ValidateStatus = "ok" | "warn" | "error";
|
|
12
12
|
type ValidateDependencyCycleSeverity = "off" | "warn" | "error";
|
|
13
13
|
type ValidateFileScanMode = "default" | "tracked-all" | "tracked-all-strict";
|
|
14
|
-
type ItemWithBody =
|
|
14
|
+
type ItemWithBody = ValidateItem;
|
|
15
15
|
type OrphanedPathClassification = "docs_unowned" | "tests_unowned" | "source_unowned" | "unlinked_existing";
|
|
16
16
|
declare const LIFECYCLE_PATTERN_FIELD_KEYS: readonly ["blocked_reason", "resolution", "actual_result"];
|
|
17
17
|
type LifecyclePatternFieldKey = (typeof LIFECYCLE_PATTERN_FIELD_KEYS)[number];
|