@unbrained/pm-cli 2026.8.10 → 2026.8.12
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 +153 -100
- package/dist/cli/commander-usage.js +113 -15
- package/dist/cli/error-guidance.d.ts +12 -0
- package/dist/cli/error-guidance.js +147 -29
- package/dist/cli/main.js +38 -19
- package/dist/cli/register-annotations.js +56 -3
- package/dist/cli/register-assurance.d.ts +8 -0
- package/dist/cli/register-assurance.js +52 -0
- package/dist/cli/register-files-lookup.js +14 -3
- package/dist/cli/register-list-query.js +10 -7
- package/dist/cli/register-mutation.js +30 -9
- package/dist/cli/register-operations.js +30 -15
- package/dist/cli-bundle/bundle-manifest.json +155 -155
- package/dist/cli-bundle/chunks/{chunk-TRWXF476.js → chunk-3PS7X6GS.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-EBO7OUUE.js → chunk-BM5YJ2UW.js} +69 -55
- package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +33 -0
- package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +196 -0
- package/dist/cli-bundle/chunks/{chunk-ETML5C6H.js → chunk-KOQMGCTA.js} +47 -47
- package/dist/cli-bundle/chunks/chunk-R76342NV.js +2 -0
- package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +5 -0
- package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +2 -0
- package/dist/cli-bundle/chunks/chunk-WLAHPSOX.js +3 -0
- package/dist/cli-bundle/chunks/register-list-query-XPCJRUUD.js +10 -0
- package/dist/cli-bundle/chunks/register-mutation-4RJCBKRS.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-S3KT2LTH.js → register-setup-LLHAKP2V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +5 -0
- package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +155 -0
- package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IW43E4XL.js → chunk-GQW4BPUT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-75774JWP.js → chunk-JAFRIWVF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2COZ67XT.js → chunk-KHM2CS2C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-M6RPIXKC.js → chunk-KPSXVBDV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-34SX654S.js → chunk-KTLOKKCQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2EXI2DKR.js → chunk-NBLUKITQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-NYLOUPOB.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +31 -0
- package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-DZGAHZZV.js → chunk-RWPAWUOT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +17 -0
- package/dist/cli-bundle/focused-chunks/{chunk-7UN6BHHO.js → chunk-YIAXMC3T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZMGWAYH7.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 +41 -39
- 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/extensions/reserved-host-flags.js +3 -2
- package/dist/core/history/drift-scan.js +13 -8
- package/dist/core/history/history.d.ts +8 -0
- package/dist/core/history/history.js +57 -7
- package/dist/core/history/replay.d.ts +9 -1
- package/dist/core/history/replay.js +48 -13
- package/dist/core/output/output.d.ts +2 -0
- package/dist/core/output/output.js +46 -14
- package/dist/core/session/session-state.d.ts +47 -0
- package/dist/core/session/session-state.js +207 -6
- package/dist/core/shared/author.d.ts +7 -1
- package/dist/core/shared/author.js +66 -46
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/errors.d.ts +13 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/item-metadata-cache.d.ts +1 -1
- package/dist/core/store/item-metadata-cache.js +14 -7
- package/dist/sdk/agent/refusal-reachability.d.ts +40 -0
- package/dist/sdk/agent/refusal-reachability.js +72 -0
- package/dist/sdk/agent/subcommand-recovery.d.ts +40 -0
- package/dist/sdk/agent/subcommand-recovery.js +84 -0
- package/dist/sdk/cli-bootstrap.d.ts +10 -0
- package/dist/sdk/cli-bootstrap.js +11 -7
- package/dist/sdk/cli-contracts/completeness.js +14 -3
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +20 -2
- package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
- package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
- package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +515 -0
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +252 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +99 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -3
- package/dist/sdk/cli-contracts/tool-schema.js +38 -5
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +3 -3
- package/dist/sdk/cli-program.js +3 -2
- package/dist/sdk/completion.js +23 -8
- package/dist/sdk/config.js +9 -3
- package/dist/sdk/context/semantic-session-attribution.d.ts +32 -0
- package/dist/sdk/context/semantic-session-attribution.js +83 -0
- package/dist/sdk/context-intent-contracts.js +45 -4
- package/dist/sdk/core-governance.d.ts +3 -1
- package/dist/sdk/core-governance.js +5 -3
- package/dist/sdk/core.d.ts +2 -1
- package/dist/sdk/core.js +3 -2
- package/dist/sdk/error-code-catalog.d.ts +13 -0
- package/dist/sdk/error-code-catalog.js +35 -2
- package/dist/sdk/extension.js +18 -17
- package/dist/sdk/files.d.ts +11 -0
- package/dist/sdk/files.js +82 -24
- package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1585 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
- package/dist/sdk/generated-error-code-catalog.js +6 -3121
- package/dist/sdk/governance/assurance-action-contracts.d.ts +7 -0
- package/dist/sdk/governance/assurance-action-contracts.js +5 -0
- package/dist/sdk/governance/assurance-action.d.ts +70 -0
- package/dist/sdk/governance/assurance-action.js +200 -0
- package/dist/sdk/governance/assurance-limits.d.ts +7 -0
- package/dist/sdk/governance/assurance-limits.js +11 -0
- package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
- package/dist/sdk/governance/assurance-mutation-error.js +35 -0
- package/dist/sdk/governance/assurance-runtime.d.ts +20 -0
- package/dist/sdk/governance/assurance-runtime.js +134 -0
- package/dist/sdk/governance/assurance.d.ts +438 -0
- package/dist/sdk/governance/assurance.js +804 -0
- package/dist/sdk/governance/health.d.ts +3 -1
- package/dist/sdk/governance/health.js +21 -4
- package/dist/sdk/governance/validate-item-reader.js +3 -3
- package/dist/sdk/governance/validate.d.ts +2 -0
- package/dist/sdk/governance/validate.js +13 -3
- package/dist/sdk/graph/durable-cache.d.ts +1 -1
- package/dist/sdk/graph/durable-cache.js +98 -29
- package/dist/sdk/graph/governance.d.ts +14 -0
- package/dist/sdk/graph/governance.js +34 -9
- package/dist/sdk/graph/run.js +8 -3
- package/dist/sdk/index.d.ts +7 -2
- package/dist/sdk/index.js +9 -4
- package/dist/sdk/lifecycle/claim.js +26 -4
- package/dist/sdk/lifecycle/focus.js +13 -3
- package/dist/sdk/lifecycle/plan.js +8 -3
- package/dist/sdk/merge/driver.d.ts +2 -2
- package/dist/sdk/merge/driver.js +3 -3
- package/dist/sdk/merge/receipts.d.ts +6 -4
- package/dist/sdk/merge/receipts.js +7 -5
- package/dist/sdk/merge/three-way.d.ts +2 -2
- package/dist/sdk/merge/three-way.js +3 -3
- package/dist/sdk/output-projection.d.ts +9 -1
- package/dist/sdk/output-projection.js +45 -9
- package/dist/sdk/provenance.d.ts +38 -0
- package/dist/sdk/provenance.js +64 -2
- package/dist/sdk/query/activity.d.ts +49 -2
- package/dist/sdk/query/activity.js +183 -37
- package/dist/sdk/query/context.js +19 -8
- package/dist/sdk/query/get.js +19 -2
- package/dist/sdk/read-output-contracts.d.ts +5 -1
- package/dist/sdk/read-output-contracts.js +17 -2
- package/dist/sdk/read-output-session.d.ts +2 -0
- package/dist/sdk/read-output-session.js +12 -5
- package/dist/sdk/runtime-extended-actions.js +22 -5
- package/dist/sdk/runtime-primitives.d.ts +5 -3
- package/dist/sdk/runtime-primitives.js +7 -5
- package/dist/sdk/runtime-stats-options.js +3 -2
- package/dist/sdk/runtime.d.ts +4 -0
- package/dist/sdk/runtime.js +34 -34
- package/dist/sdk/stats.d.ts +36 -3
- package/dist/sdk/stats.js +55 -15
- package/dist/sdk/telemetry.js +7 -4
- package/dist/sdk/test/execution.d.ts +4 -0
- package/dist/sdk/test/execution.js +86 -21
- package/dist/sdk/traceability/runtime-files-lookup.d.ts +8 -0
- package/dist/sdk/traceability/runtime-files-lookup.js +33 -0
- package/dist/sdk/traceability/source-traceability.d.ts +102 -0
- package/dist/sdk/traceability/source-traceability.js +293 -0
- package/dist/types.d.ts +10 -2
- package/dist/types.js +2 -2
- package/docs/ASSURANCE.md +137 -0
- package/docs/COMMANDS.md +29 -8
- package/docs/CONFIGURATION.md +7 -0
- package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
- package/docs/MERGE_SAFETY.md +3 -1
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
- package/docs/README.md +3 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
- package/docs/RELEASING.md +9 -5
- package/docs/SDK.md +12 -1
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +52 -5
- package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
- package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +39 -1
- package/docs/SDK_RUNTIME_BOUNDARIES.md +36 -1
- package/docs/TESTING.md +12 -9
- package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
- package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -0
- package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
- package/marketplace.json +2 -2
- package/package.json +7 -7
- 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/extensions/templates/index.ts +9 -3
- 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 +1030 -67
- package/dist/cli-bundle/chunks/chunk-2QYH4QMI.js +0 -30
- package/dist/cli-bundle/chunks/chunk-JUDU4RO4.js +0 -194
- package/dist/cli-bundle/chunks/chunk-JZSNADRR.js +0 -5
- package/dist/cli-bundle/chunks/chunk-MENWVGJW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-S4EITGLA.js +0 -3
- package/dist/cli-bundle/chunks/chunk-TIGKWVLA.js +0 -13
- package/dist/cli-bundle/chunks/chunk-TSLDTJLQ.js +0 -2
- package/dist/cli-bundle/chunks/register-list-query-OJ6ZXKV4.js +0 -10
- package/dist/cli-bundle/chunks/register-mutation-DKI7QC7O.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-P5OGMT6I.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-36FTZ2NT.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3CQECMKR.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-CHIBMEZR.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-FF4MNAYB.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-GHTN2ILR.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-I4YM2I7S.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-IMDTEN7K.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JMVA4HKR.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-KR5RVXLQ.js +0 -31
- package/dist/cli-bundle/focused-chunks/chunk-KSNJG4KI.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-MXYSIQ56.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-RIIN5V4N.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-RKWSCYYN.js +0 -2
|
@@ -15,6 +15,8 @@ export interface HealthCheck {
|
|
|
15
15
|
name: "settings" | "directories" | "settings_values" | "telemetry" | "extensions" | "storage" | "locks" | "integrity" | "history_drift" | "vectorization";
|
|
16
16
|
/** Lifecycle state reported for status. */
|
|
17
17
|
status: HealthStatus;
|
|
18
|
+
/** Boolean companion to status for direct agent and assurance predicates. */
|
|
19
|
+
ok: boolean;
|
|
18
20
|
/** Value that configures or reports details for this contract. */
|
|
19
21
|
details: Record<string, unknown>;
|
|
20
22
|
}
|
|
@@ -113,7 +115,7 @@ interface ExtensionHealthTriageSummary {
|
|
|
113
115
|
top_warnings: string[];
|
|
114
116
|
remediation: string[];
|
|
115
117
|
}
|
|
116
|
-
/** Advisory warnings are surfaced for visibility but never flip overall health to not-ok. Telemetry is opt-out, non-critical observability: a queued/unreachable telemetry endpoint or corrupt local telemetry state is not a project-health failure and must not block agents that gate on `pm health` `ok`. History over-compaction-threshold warnings are likewise advisory maintenance hints — a deep stream is healthy, just a candidate for `pm history-compact`. */
|
|
118
|
+
/** Advisory warnings are surfaced for visibility but never flip overall health to not-ok. Telemetry is opt-out, non-critical observability: a queued/unreachable telemetry endpoint or corrupt local telemetry state is not a project-health failure and must not block agents that gate on `pm health` `ok`. History over-compaction-threshold warnings are likewise advisory maintenance hints — a deep stream is healthy, just a candidate for `pm history-compact`. Invalid legacy provenance values remain immutable diagnostic evidence: write-time resolvers reject new invalid values, while health reports the bounded aggregate without requiring truthful history to be rewritten. */
|
|
117
119
|
declare function isAdvisoryHealthWarning(warning: string, requireMergeDrivers?: boolean): boolean;
|
|
118
120
|
declare function warningCode(value: string): string;
|
|
119
121
|
declare function normalizeExtensionNameForMatch(value: string): string;
|
|
@@ -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]="af3d60bd-94d4-52e8-90e3-7929ce04428c")}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";
|
|
@@ -54,12 +54,13 @@ const TELEMETRY_SERVER_MAX_SCHEMA_VERSION_HEADERS = [
|
|
|
54
54
|
"x-pm-telemetry-max-schema-version",
|
|
55
55
|
"x-pm-telemetry-max-version",
|
|
56
56
|
];
|
|
57
|
-
/** Advisory warnings are surfaced for visibility but never flip overall health to not-ok. Telemetry is opt-out, non-critical observability: a queued/unreachable telemetry endpoint or corrupt local telemetry state is not a project-health failure and must not block agents that gate on `pm health` `ok`. History over-compaction-threshold warnings are likewise advisory maintenance hints — a deep stream is healthy, just a candidate for `pm history-compact`. */
|
|
57
|
+
/** Advisory warnings are surfaced for visibility but never flip overall health to not-ok. Telemetry is opt-out, non-critical observability: a queued/unreachable telemetry endpoint or corrupt local telemetry state is not a project-health failure and must not block agents that gate on `pm health` `ok`. History over-compaction-threshold warnings are likewise advisory maintenance hints — a deep stream is healthy, just a candidate for `pm history-compact`. Invalid legacy provenance values remain immutable diagnostic evidence: write-time resolvers reject new invalid values, while health reports the bounded aggregate without requiring truthful history to be rewritten. */
|
|
58
58
|
function isAdvisoryHealthWarning(warning, requireMergeDrivers = false) {
|
|
59
59
|
return (warning.startsWith("telemetry_") ||
|
|
60
60
|
warning.startsWith("history_stream_over_compact_threshold:") ||
|
|
61
61
|
warning.startsWith("stale_in_progress_items:") ||
|
|
62
62
|
warning.startsWith("provenance_resolver_zero_success:") ||
|
|
63
|
+
warning.startsWith("provenance_value_domain_invalid:") ||
|
|
63
64
|
(!requireMergeDrivers &&
|
|
64
65
|
warning.startsWith("merge_driver_configuration_missing:")));
|
|
65
66
|
}
|
|
@@ -360,6 +361,7 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
360
361
|
check: {
|
|
361
362
|
name: "integrity",
|
|
362
363
|
status: normalizedWarnings.length === 0 ? "ok" : "warn",
|
|
364
|
+
ok: normalizedWarnings.length === 0,
|
|
363
365
|
details: {
|
|
364
366
|
checked_item_files: itemScan.paths.length,
|
|
365
367
|
checked_history_streams: historyScan.files.length,
|
|
@@ -703,6 +705,7 @@ async function buildExtensionCheck(pmRoot, settings, noExtensionsFlag) {
|
|
|
703
705
|
check: {
|
|
704
706
|
name: "extensions",
|
|
705
707
|
status: extensionWarnings.length === 0 ? "ok" : "warn",
|
|
708
|
+
ok: extensionWarnings.length === 0,
|
|
706
709
|
details: {
|
|
707
710
|
...loadResult,
|
|
708
711
|
loaded: loadedSummaries,
|
|
@@ -951,6 +954,7 @@ function applyBriefHealthProjection(result) {
|
|
|
951
954
|
checks: result.checks.map((check) => ({
|
|
952
955
|
name: check.name,
|
|
953
956
|
status: check.status,
|
|
957
|
+
ok: check.ok,
|
|
954
958
|
details: summarizeHealthCheckDetails(check, BRIEF_HEALTH_DETAIL_LIMIT),
|
|
955
959
|
})),
|
|
956
960
|
warnings: warningsSummary.sample,
|
|
@@ -978,6 +982,7 @@ function applySummaryHealthProjection(result) {
|
|
|
978
982
|
.map((check) => ({
|
|
979
983
|
name: check.name,
|
|
980
984
|
status: check.status,
|
|
985
|
+
ok: check.ok,
|
|
981
986
|
details: {},
|
|
982
987
|
})),
|
|
983
988
|
warning_count: warningsSummary.count,
|
|
@@ -1261,6 +1266,7 @@ async function buildTelemetryCheck(settings, options) {
|
|
|
1261
1266
|
check: {
|
|
1262
1267
|
name: "telemetry",
|
|
1263
1268
|
status: warnings.length === 0 ? "ok" : "warn",
|
|
1269
|
+
ok: warnings.length === 0,
|
|
1264
1270
|
details: {
|
|
1265
1271
|
enabled: settings.telemetry.enabled,
|
|
1266
1272
|
capture_level: settings.telemetry.capture_level,
|
|
@@ -1306,6 +1312,7 @@ async function buildLocksCheck(pmRoot) {
|
|
|
1306
1312
|
check: {
|
|
1307
1313
|
name: "locks",
|
|
1308
1314
|
status: "warn",
|
|
1315
|
+
ok: false,
|
|
1309
1316
|
details: {
|
|
1310
1317
|
active_lock_count: 0,
|
|
1311
1318
|
stale_lock_count: 0,
|
|
@@ -1331,6 +1338,7 @@ async function buildLocksCheck(pmRoot) {
|
|
|
1331
1338
|
check: {
|
|
1332
1339
|
name: "locks",
|
|
1333
1340
|
status: warnings.length === 0 ? "ok" : "warn",
|
|
1341
|
+
ok: warnings.length === 0,
|
|
1334
1342
|
details: {
|
|
1335
1343
|
active_lock_count: scan.active_lock_count,
|
|
1336
1344
|
stale_lock_count: scan.stale_lock_count,
|
|
@@ -1354,6 +1362,7 @@ async function buildHistoryDriftCheck(pmRoot, items) {
|
|
|
1354
1362
|
check: {
|
|
1355
1363
|
name: "history_drift",
|
|
1356
1364
|
status: warnings.length === 0 ? "ok" : "warn",
|
|
1365
|
+
ok: warnings.length === 0,
|
|
1357
1366
|
details: {
|
|
1358
1367
|
checked_items: items.length,
|
|
1359
1368
|
cache_hit_verification: cacheHitVerification,
|
|
@@ -1519,6 +1528,7 @@ async function buildVectorizationCheck(pmRoot, settings, items, refreshPolicy, v
|
|
|
1519
1528
|
check: {
|
|
1520
1529
|
name: "vectorization",
|
|
1521
1530
|
status: warnings.length === 0 ? "ok" : "warn",
|
|
1531
|
+
ok: warnings.length === 0,
|
|
1522
1532
|
details: {
|
|
1523
1533
|
semantic_runtime_available: snapshot.semanticRuntimeAvailable,
|
|
1524
1534
|
compatibility_mode_auto_defaults: snapshot.runtimeDefaults.auto_ollama_defaults_applied,
|
|
@@ -1661,7 +1671,7 @@ async function readHealthItems(params) {
|
|
|
1661
1671
|
}
|
|
1662
1672
|
function buildSkippedHealthCheck(name) {
|
|
1663
1673
|
return {
|
|
1664
|
-
check: { name, status: "ok", details: { skipped: true } },
|
|
1674
|
+
check: { name, status: "ok", ok: true, details: { skipped: true } },
|
|
1665
1675
|
warnings: [],
|
|
1666
1676
|
};
|
|
1667
1677
|
}
|
|
@@ -1670,6 +1680,7 @@ function buildSettingsHealthCheck(settingsPath, settings, normalizedSettingsRead
|
|
|
1670
1680
|
name: "settings",
|
|
1671
1681
|
/* c8 ignore next -- settings read-warning status split is covered in broader read-settings integration tests */
|
|
1672
1682
|
status: normalizedSettingsReadWarnings.length === 0 ? "ok" : "warn",
|
|
1683
|
+
ok: normalizedSettingsReadWarnings.length === 0,
|
|
1673
1684
|
details: {
|
|
1674
1685
|
path: settingsPath,
|
|
1675
1686
|
version: settings.version,
|
|
@@ -1683,6 +1694,7 @@ function buildDirectoriesHealthCheck(directoryState, strictDirectories) {
|
|
|
1683
1694
|
return {
|
|
1684
1695
|
name: "directories",
|
|
1685
1696
|
status: directoryState.missingDirs.length === 0 ? "ok" : "warn",
|
|
1697
|
+
ok: directoryState.missingDirs.length === 0,
|
|
1686
1698
|
details: {
|
|
1687
1699
|
required: directoryState.requiredDirs,
|
|
1688
1700
|
optional: directoryState.optionalDirs,
|
|
@@ -1697,6 +1709,7 @@ function buildSettingsValuesHealthCheck(settingWarnings) {
|
|
|
1697
1709
|
return {
|
|
1698
1710
|
name: "settings_values",
|
|
1699
1711
|
status: settingWarnings.length === 0 ? "ok" : "warn",
|
|
1712
|
+
ok: settingWarnings.length === 0,
|
|
1700
1713
|
details: { warnings: settingWarnings },
|
|
1701
1714
|
};
|
|
1702
1715
|
}
|
|
@@ -1719,6 +1732,10 @@ function buildStorageHealthCheck(items, settings, historySummary, authorAttribut
|
|
|
1719
1732
|
!hasStaleInProgressItems
|
|
1720
1733
|
? "ok"
|
|
1721
1734
|
: "warn",
|
|
1735
|
+
ok: historySummary.over_threshold.length === 0 &&
|
|
1736
|
+
historySummary.orphaned.length === 0 &&
|
|
1737
|
+
!hasActionableAuthorWarnings &&
|
|
1738
|
+
!hasStaleInProgressItems,
|
|
1722
1739
|
details: {
|
|
1723
1740
|
items: items.length,
|
|
1724
1741
|
history_streams: historySummary.count,
|
|
@@ -1990,4 +2007,4 @@ export const _testOnlyHealthCommand = {
|
|
|
1990
2007
|
warningCode,
|
|
1991
2008
|
};
|
|
1992
2009
|
//# sourceMappingURL=health.js.map
|
|
1993
|
-
//# debugId=
|
|
2010
|
+
//# debugId=af3d60bd-94d4-52e8-90e3-7929ce04428c
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* validation run.
|
|
6
6
|
*/
|
|
7
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]="
|
|
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]="01f042d0-7f02-59f5-8894-cf48eb936d99")}catch(e){}}();
|
|
9
9
|
import { listAllItemMetadata, listAllItemMetadataWithBody, } from "../../core/store/item-store.js";
|
|
10
10
|
/** Load collections for normal checks and add bodies only when history hashes must be verified. */
|
|
11
11
|
export async function readValidateItems(params) {
|
|
12
12
|
if (params.includeBody) {
|
|
13
|
-
return listAllItemMetadataWithBody(params.pmRoot, params.settings.item_format, params.typeToFolder, params.warnings, params.settings.schema);
|
|
13
|
+
return listAllItemMetadataWithBody(params.pmRoot, params.settings.item_format, params.typeToFolder, params.warnings, params.settings.schema, { forceSourceScan: true });
|
|
14
14
|
}
|
|
15
15
|
return listAllItemMetadata(params.pmRoot, params.settings.item_format, params.typeToFolder, params.warnings, params.settings.schema);
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=validate-item-reader.js.map
|
|
18
|
-
//# debugId=
|
|
18
|
+
//# debugId=01f042d0-7f02-59f5-8894-cf48eb936d99
|
|
@@ -75,6 +75,8 @@ export interface ValidateCheck {
|
|
|
75
75
|
name: ValidateCheckName;
|
|
76
76
|
/** Lifecycle state reported for status. */
|
|
77
77
|
status: ValidateStatus;
|
|
78
|
+
/** Direct machine predicate derived from whether status is ok. */
|
|
79
|
+
ok: boolean;
|
|
78
80
|
/** Value that configures or reports details for this contract. */
|
|
79
81
|
details: Record<string, unknown>;
|
|
80
82
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm validate 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]="5affc1f1-2b4f-5f04-a6cb-c3e389bcb356")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import { realpathSync } from "node:fs";
|
|
10
10
|
import { execFile } from "node:child_process";
|
|
@@ -913,6 +913,7 @@ function buildMetadataCheck(items, metadataPolicy, statusRegistry, verboseDiagno
|
|
|
913
913
|
check: {
|
|
914
914
|
name: "metadata",
|
|
915
915
|
status: warningTokens.length === 0 ? "ok" : "warn",
|
|
916
|
+
ok: warningTokens.length === 0,
|
|
916
917
|
details,
|
|
917
918
|
},
|
|
918
919
|
warnings: warningTokens,
|
|
@@ -957,6 +958,7 @@ function buildResolutionCheck(items, statusRegistry, verboseDiagnostics) {
|
|
|
957
958
|
check: {
|
|
958
959
|
name: "resolution",
|
|
959
960
|
status: warnings.length === 0 ? "ok" : "warn",
|
|
961
|
+
ok: warnings.length === 0,
|
|
960
962
|
details: {
|
|
961
963
|
checked_closed_items: closedItems.length,
|
|
962
964
|
missing_resolution_items: missingResolutionRows.length,
|
|
@@ -1026,6 +1028,7 @@ function buildDependencyReferencesCheck(items, verboseDiagnostics, statusRegistr
|
|
|
1026
1028
|
check: {
|
|
1027
1029
|
name: "dependency_references",
|
|
1028
1030
|
status: activeRows.length === 0 ? "ok" : "warn",
|
|
1031
|
+
ok: activeRows.length === 0,
|
|
1029
1032
|
details: {
|
|
1030
1033
|
checked_items: items.length,
|
|
1031
1034
|
dangling_reference_count: activeRows.length + legacyRows.length,
|
|
@@ -1582,6 +1585,7 @@ function buildLifecycleCheck(items, includeStaleBlockers, dependencyCycleSeverit
|
|
|
1582
1585
|
: warnings.length === 0
|
|
1583
1586
|
? "ok"
|
|
1584
1587
|
: "warn",
|
|
1588
|
+
ok: !hasErrorSeverityCycle && warnings.length === 0,
|
|
1585
1589
|
details: {
|
|
1586
1590
|
checked_active_items: rows.activeItems.length,
|
|
1587
1591
|
active_closure_like_metadata_items: rows.closureLikeRows.length,
|
|
@@ -1709,6 +1713,7 @@ async function buildFilesCheck(items, workspaceRoot, pmRoot, fileScanMode, inclu
|
|
|
1709
1713
|
check: {
|
|
1710
1714
|
name: "files",
|
|
1711
1715
|
status: warnings.length === 0 ? "ok" : "warn",
|
|
1716
|
+
ok: warnings.length === 0,
|
|
1712
1717
|
details: {
|
|
1713
1718
|
workspace_root: workspaceRoot,
|
|
1714
1719
|
scan_mode_requested: fileCandidates.requestedMode,
|
|
@@ -1786,6 +1791,7 @@ async function buildHistoryDriftCheck(pmRoot, items, verboseDiagnostics) {
|
|
|
1786
1791
|
check: {
|
|
1787
1792
|
name: "history_drift",
|
|
1788
1793
|
status: warnings.length === 0 ? "ok" : "warn",
|
|
1794
|
+
ok: warnings.length === 0,
|
|
1789
1795
|
details: {
|
|
1790
1796
|
checked_items: items.length,
|
|
1791
1797
|
drifted_items_count: driftedItems.length,
|
|
@@ -1859,6 +1865,7 @@ function buildCommandReferencesCheck(items, idPrefix, verboseDiagnostics) {
|
|
|
1859
1865
|
check: {
|
|
1860
1866
|
name: "command_references",
|
|
1861
1867
|
status: warnings.length === 0 ? "ok" : "warn",
|
|
1868
|
+
ok: warnings.length === 0,
|
|
1862
1869
|
details: {
|
|
1863
1870
|
checked_items: items.length,
|
|
1864
1871
|
linked_commands_scanned: linkedCommandsScanned,
|
|
@@ -1905,6 +1912,7 @@ function buildFormatVersionCheck(items, verboseDiagnostics) {
|
|
|
1905
1912
|
check: {
|
|
1906
1913
|
name: "format_version",
|
|
1907
1914
|
status,
|
|
1915
|
+
ok: status === "ok",
|
|
1908
1916
|
details: {
|
|
1909
1917
|
checked_items: items.length,
|
|
1910
1918
|
current_format_version: CURRENT_ITEM_FORMAT_VERSION,
|
|
@@ -2108,13 +2116,15 @@ async function buildStorageIntegrityCheck(pmRoot, items, typeToFolder, settings)
|
|
|
2108
2116
|
if (pendingMergeDecisions.length > 0) {
|
|
2109
2117
|
warnings.push(`validate_merge_decisions_unreviewed:${pendingMergeDecisions.length}`);
|
|
2110
2118
|
}
|
|
2119
|
+
const status = errorCount > 0 ? "error" : warnings.length > 0 ? "warn" : "ok";
|
|
2111
2120
|
return {
|
|
2112
2121
|
check: {
|
|
2113
2122
|
name: "storage_integrity",
|
|
2114
2123
|
// Corruption findings fail the check; fence drift alone is a warning —
|
|
2115
2124
|
// the workspace data is intact, but future merges of uncovered paths
|
|
2116
2125
|
// would fall back to git's default text driver.
|
|
2117
|
-
status
|
|
2126
|
+
status,
|
|
2127
|
+
ok: status === "ok",
|
|
2118
2128
|
details: {
|
|
2119
2129
|
...scan,
|
|
2120
2130
|
merge_fence: fenceAudit,
|
|
@@ -2346,4 +2356,4 @@ export async function runValidate(options, global, services = {}) {
|
|
|
2346
2356
|
}
|
|
2347
2357
|
/* c8 ignore stop */
|
|
2348
2358
|
//# sourceMappingURL=validate.js.map
|
|
2349
|
-
//# debugId=
|
|
2359
|
+
//# debugId=5affc1f1-2b4f-5f04-a6cb-c3e389bcb356
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RelationshipAuditSnapshot } from "./governance.js";
|
|
2
2
|
/** Envelope format version; any change invalidates persisted entries. */
|
|
3
3
|
export declare const GRAPH_DURABLE_CACHE_VERSION = 1;
|
|
4
4
|
/** Workspaces below this item count skip implicit persistence. */
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
* threshold or after an explicit `pm graph index --rebuild` opt-in.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
!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]="
|
|
18
|
+
!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]="4cb399d6-7311-5e2d-a8d2-e0140530ec72")}catch(e){}}();
|
|
19
19
|
import path from "node:path";
|
|
20
20
|
import { readFileIfExists, removeFileIfExists, writeFileAtomic, } from "../../core/fs/fs-utils.js";
|
|
21
21
|
import { acquireLock } from "../../core/lock/lock.js";
|
|
22
|
+
import { isSemanticContextKind, } from "./governance.js";
|
|
22
23
|
/** Envelope format version; any change invalidates persisted entries. */
|
|
23
24
|
export const GRAPH_DURABLE_CACHE_VERSION = 1;
|
|
24
25
|
/** Workspaces below this item count skip implicit persistence. */
|
|
@@ -140,19 +141,75 @@ export function shouldPersistDurableGraphCache(itemCount, envelopeExists) {
|
|
|
140
141
|
}
|
|
141
142
|
/** Return whether a decoded value is a string-keyed non-negative integer count map. */
|
|
142
143
|
function isNonnegativeCountRecord(value) {
|
|
143
|
-
return (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
return isRecord(value) && Object.values(value).every(isNonnegativeInteger);
|
|
145
|
+
}
|
|
146
|
+
/** Return whether a decoded value is a non-array record. */
|
|
147
|
+
function isRecord(value) {
|
|
148
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
149
|
+
}
|
|
150
|
+
/** Return whether a decoded value is a non-negative integer. */
|
|
151
|
+
function isNonnegativeInteger(value) {
|
|
152
|
+
return Number.isInteger(value) && Number(value) >= 0;
|
|
153
|
+
}
|
|
154
|
+
/** Return whether a decoded value is a finite share in the inclusive unit interval. */
|
|
155
|
+
function isUnitShare(value) {
|
|
156
|
+
return (typeof value === "number" &&
|
|
157
|
+
Number.isFinite(value) &&
|
|
158
|
+
value >= 0 &&
|
|
159
|
+
value <= 1);
|
|
160
|
+
}
|
|
161
|
+
/** Apply a validator only when an optional decoded value is present. */
|
|
162
|
+
function isOptionalValid(value, validate) {
|
|
163
|
+
return value === undefined || validate(value);
|
|
164
|
+
}
|
|
165
|
+
/** Return whether a decoded record contains finite shares in the inclusive unit interval. */
|
|
166
|
+
function isUnitShareRecord(value) {
|
|
167
|
+
return isRecord(value) && Object.values(value).every(isUnitShare);
|
|
147
168
|
}
|
|
148
169
|
/** Return whether every decoded item-type coverage entry contains valid counts. */
|
|
149
170
|
function isNonnegativeCoverageByTypeRecord(value) {
|
|
150
|
-
if (
|
|
171
|
+
if (!isRecord(value))
|
|
151
172
|
return false;
|
|
152
|
-
return Object.values(value).every((entry) =>
|
|
153
|
-
entry
|
|
154
|
-
|
|
155
|
-
|
|
173
|
+
return Object.values(value).every((entry) => isRecord(entry) &&
|
|
174
|
+
[entry.active, entry.isolated, entry.degree_leq_one].every(isNonnegativeInteger));
|
|
175
|
+
}
|
|
176
|
+
/** Decode and cross-check optional graph-composition fields as one coherent unit. */
|
|
177
|
+
function decodeGraphComposition(edges, edgesByKind, edgeShareByKind, semanticEdgesValue, semanticEdgeShareValue) {
|
|
178
|
+
const values = [
|
|
179
|
+
edgeShareByKind,
|
|
180
|
+
semanticEdgesValue,
|
|
181
|
+
semanticEdgeShareValue,
|
|
182
|
+
];
|
|
183
|
+
const presentCount = values.filter((value) => value !== undefined).length;
|
|
184
|
+
if (presentCount === 0) {
|
|
185
|
+
return {
|
|
186
|
+
edge_share_by_kind: {},
|
|
187
|
+
semantic_edges: 0,
|
|
188
|
+
semantic_edge_share: 0,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
if (presentCount !== values.length ||
|
|
192
|
+
!isUnitShareRecord(edgeShareByKind) ||
|
|
193
|
+
!isNonnegativeInteger(semanticEdgesValue) ||
|
|
194
|
+
!isUnitShare(semanticEdgeShareValue)) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
const edgeEntries = Object.entries(edgesByKind);
|
|
198
|
+
if (edgeEntries.reduce((sum, [, count]) => sum + count, 0) !== edges ||
|
|
199
|
+
Object.keys(edgeShareByKind).length !== edgeEntries.length ||
|
|
200
|
+
edgeEntries.some(([kind, count]) => edgeShareByKind[kind] !== (edges === 0 ? 0 : count / edges))) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
const semanticEdges = edgeEntries.reduce((sum, [kind, count]) => sum + (isSemanticContextKind(kind) ? count : 0), 0);
|
|
204
|
+
if (semanticEdgesValue !== semanticEdges ||
|
|
205
|
+
semanticEdgeShareValue !== (edges === 0 ? 0 : semanticEdges / edges)) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
edge_share_by_kind: edgeShareByKind,
|
|
210
|
+
semantic_edges: semanticEdgesValue,
|
|
211
|
+
semantic_edge_share: semanticEdgeShareValue,
|
|
212
|
+
};
|
|
156
213
|
}
|
|
157
214
|
/** Decode one persisted audit census baseline, undefined on any defect. */
|
|
158
215
|
function decodeBaseline(raw) {
|
|
@@ -160,32 +217,44 @@ function decodeBaseline(raw) {
|
|
|
160
217
|
return undefined;
|
|
161
218
|
try {
|
|
162
219
|
const parsed = JSON.parse(raw);
|
|
163
|
-
if (
|
|
220
|
+
if (!isRecord(parsed))
|
|
164
221
|
return undefined;
|
|
165
222
|
const snapshot = parsed;
|
|
166
223
|
const profile = snapshot.profile;
|
|
167
|
-
if (typeof snapshot.saved_at !== "string"
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
224
|
+
if (typeof snapshot.saved_at !== "string")
|
|
225
|
+
return undefined;
|
|
226
|
+
if (typeof snapshot.fingerprint !== "string")
|
|
227
|
+
return undefined;
|
|
228
|
+
if (!isNonnegativeCountRecord(snapshot.affected_subjects_by_code)) {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
if (!isRecord(profile))
|
|
232
|
+
return undefined;
|
|
233
|
+
if (![
|
|
234
|
+
profile.nodes,
|
|
235
|
+
profile.edges,
|
|
236
|
+
profile.active_nodes,
|
|
237
|
+
profile.missing_nodes,
|
|
238
|
+
profile.isolated_active_nodes,
|
|
239
|
+
profile.degree_leq_one_active_nodes,
|
|
240
|
+
].every(isNonnegativeInteger)) {
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
if (!isNonnegativeCountRecord(profile.edges_by_kind))
|
|
244
|
+
return undefined;
|
|
245
|
+
if (!isOptionalValid(profile.coverage_by_type, isNonnegativeCoverageByTypeRecord)) {
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
const composition = decodeGraphComposition(profile.edges, profile.edges_by_kind, profile.edge_share_by_kind, profile.semantic_edges, profile.semantic_edge_share);
|
|
249
|
+
if (composition === undefined)
|
|
183
250
|
return undefined;
|
|
251
|
+
const { coverage_by_type = {} } = profile;
|
|
184
252
|
return {
|
|
185
253
|
...snapshot,
|
|
186
254
|
profile: {
|
|
187
255
|
...profile,
|
|
188
|
-
|
|
256
|
+
...composition,
|
|
257
|
+
coverage_by_type,
|
|
189
258
|
},
|
|
190
259
|
};
|
|
191
260
|
}
|
|
@@ -202,4 +271,4 @@ export async function saveGraphAuditBaseline(pmRoot, snapshot) {
|
|
|
202
271
|
await writeFileAtomic(graphAuditBaselinePath(pmRoot), JSON.stringify(snapshot));
|
|
203
272
|
}
|
|
204
273
|
//# sourceMappingURL=durable-cache.js.map
|
|
205
|
-
//# debugId=
|
|
274
|
+
//# debugId=4cb399d6-7311-5e2d-a8d2-e0140530ec72
|
|
@@ -56,6 +56,12 @@ export interface RelationshipCoverageProfile {
|
|
|
56
56
|
edge_basis: "deduplicated_directed";
|
|
57
57
|
/** Deterministic per-kind edge counts. */
|
|
58
58
|
edges_by_kind: Record<string, number>;
|
|
59
|
+
/** Per-kind share of all deduplicated directed edges. */
|
|
60
|
+
edge_share_by_kind: Record<string, number>;
|
|
61
|
+
/** Edges carrying discovery, provenance, incident, or verification semantics. */
|
|
62
|
+
semantic_edges: number;
|
|
63
|
+
/** Share of all edges carrying discovery, provenance, incident, or verification semantics. */
|
|
64
|
+
semantic_edge_share: number;
|
|
59
65
|
/** Nodes whose lifecycle status is active (non-terminal, non-missing). */
|
|
60
66
|
active_nodes: number;
|
|
61
67
|
/** Materialized placeholder nodes for referenced-but-absent items. */
|
|
@@ -89,6 +95,8 @@ export interface RelationshipAuditReport {
|
|
|
89
95
|
/** Structural coverage metrics computed during the audit. */
|
|
90
96
|
profile: RelationshipCoverageProfile;
|
|
91
97
|
}
|
|
98
|
+
/** Return whether a relationship kind carries provenance or verification context. */
|
|
99
|
+
export declare function isSemanticContextKind(kind: string): boolean;
|
|
92
100
|
/**
|
|
93
101
|
* Enumerate strongly connected components with more than one member (or a
|
|
94
102
|
* self-loop) over an ordering-only successor digraph using an iterative Tarjan
|
|
@@ -165,6 +173,12 @@ export interface RelationshipAuditDelta {
|
|
|
165
173
|
degree_leq_one_active_nodes: number;
|
|
166
174
|
/** Signed per-kind edge-count deltas; unchanged kinds are dropped. */
|
|
167
175
|
edges_by_kind: Record<string, number>;
|
|
176
|
+
/** Signed per-kind edge-share deltas; unchanged kinds are dropped. */
|
|
177
|
+
edge_share_by_kind: Record<string, number>;
|
|
178
|
+
/** Change in semantic-context edge count. */
|
|
179
|
+
semantic_edges: number;
|
|
180
|
+
/** Change in semantic-context edge share. */
|
|
181
|
+
semantic_edge_share: number;
|
|
168
182
|
/** Signed per-type coverage deltas; unchanged types are dropped. */
|
|
169
183
|
coverage_by_type: Record<string, RelationshipCoverageTypeProfile>;
|
|
170
184
|
};
|
|
@@ -1,8 +1,19 @@
|
|
|
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]="996cfe8f-1b9b-534e-9e22-ede6f76d7cac")}catch(e){}}();
|
|
3
3
|
import { isTransitiveKind, orientTransitiveEdge, transitiveFamilyKey, } from "./analytics.js";
|
|
4
4
|
/** Default bounded sample size applied to every finding family. */
|
|
5
5
|
const DEFAULT_MAX_SAMPLE_SIZE = 25;
|
|
6
|
+
/** Relationship kinds that preserve why work exists or how evidence supports it. */
|
|
7
|
+
const SEMANTIC_CONTEXT_KINDS = new Set([
|
|
8
|
+
"discovered_from",
|
|
9
|
+
"incident_from",
|
|
10
|
+
"supersedes",
|
|
11
|
+
"verifies",
|
|
12
|
+
]);
|
|
13
|
+
/** Return whether a relationship kind carries provenance or verification context. */
|
|
14
|
+
export function isSemanticContextKind(kind) {
|
|
15
|
+
return SEMANTIC_CONTEXT_KINDS.has(kind);
|
|
16
|
+
}
|
|
6
17
|
/** Rank used to order findings by decreasing severity. */
|
|
7
18
|
const SEVERITY_RANK = {
|
|
8
19
|
error: 0,
|
|
@@ -332,13 +343,22 @@ function collectCoverageReport(assembly, nodeStates, exemptIsolates, isolateExem
|
|
|
332
343
|
const findings = [];
|
|
333
344
|
appendFinding(findings, isolates, maxSampleSize, "isolated_active_node", "warning", "Active work should be reachable from the graph unless explicitly declared a valid isolate.", (count) => `${count} active item(s) with no relationships`, "Link the item to its parent, prerequisite, or origin — or register it as an exempt isolate.");
|
|
334
345
|
appendFinding(findings, sparse, maxSampleSize, "sparse_active_node", "info", "Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.", (count) => `${count} active item(s) with exactly one relationship`, "Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one.");
|
|
346
|
+
const edgeCount = assembly.graph.edges().length;
|
|
347
|
+
const sortedEdgesByKind = Object.fromEntries(Object.entries(edgesByKind).sort(([left], [right]) => left.localeCompare(right)));
|
|
348
|
+
const semanticEdges = Object.entries(sortedEdgesByKind).reduce((count, [kind, value]) => count + (isSemanticContextKind(kind) ? value : 0), 0);
|
|
335
349
|
return {
|
|
336
350
|
findings,
|
|
337
351
|
profile: {
|
|
338
352
|
nodes: assembly.graph.nodes().length,
|
|
339
|
-
edges:
|
|
353
|
+
edges: edgeCount,
|
|
340
354
|
edge_basis: "deduplicated_directed",
|
|
341
|
-
edges_by_kind:
|
|
355
|
+
edges_by_kind: sortedEdgesByKind,
|
|
356
|
+
edge_share_by_kind: Object.fromEntries(Object.entries(sortedEdgesByKind).map(([kind, count]) => [
|
|
357
|
+
kind,
|
|
358
|
+
count / edgeCount,
|
|
359
|
+
])),
|
|
360
|
+
semantic_edges: semanticEdges,
|
|
361
|
+
semantic_edge_share: edgeCount === 0 ? 0 : semanticEdges / edgeCount,
|
|
342
362
|
active_nodes: tallies.active,
|
|
343
363
|
missing_nodes: tallies.missing,
|
|
344
364
|
isolated_active_nodes: tallies.isolated,
|
|
@@ -437,16 +457,18 @@ export function diffRelationshipAuditSnapshots(baseline, current) {
|
|
|
437
457
|
]),
|
|
438
458
|
].sort();
|
|
439
459
|
for (const type of typeKeys) {
|
|
440
|
-
const before = baselineCoverageByType[type];
|
|
441
|
-
const after = currentCoverageByType[type];
|
|
460
|
+
const before = Object.assign({ active: 0, isolated: 0, degree_leq_one: 0 }, baselineCoverageByType[type]);
|
|
461
|
+
const after = Object.assign({ active: 0, isolated: 0, degree_leq_one: 0 }, currentCoverageByType[type]);
|
|
442
462
|
const delta = {
|
|
443
|
-
active:
|
|
444
|
-
isolated:
|
|
445
|
-
degree_leq_one:
|
|
463
|
+
active: after.active - before.active,
|
|
464
|
+
isolated: after.isolated - before.isolated,
|
|
465
|
+
degree_leq_one: after.degree_leq_one - before.degree_leq_one,
|
|
446
466
|
};
|
|
447
467
|
if (Object.values(delta).some((value) => value !== 0))
|
|
448
468
|
coverageByType[type] = delta;
|
|
449
469
|
}
|
|
470
|
+
const { edge_share_by_kind: baselineEdgeShareByKind = {}, semantic_edges: baselineSemanticEdges = 0, semantic_edge_share: baselineSemanticEdgeShare = 0, } = baseline.profile;
|
|
471
|
+
const { edge_share_by_kind: currentEdgeShareByKind = {}, semantic_edges: currentSemanticEdges = 0, semantic_edge_share: currentSemanticEdgeShare = 0, } = current.profile;
|
|
450
472
|
return {
|
|
451
473
|
baseline_saved_at: baseline.saved_at,
|
|
452
474
|
same_snapshot: baseline.fingerprint === current.fingerprint,
|
|
@@ -461,9 +483,12 @@ export function diffRelationshipAuditSnapshots(baseline, current) {
|
|
|
461
483
|
degree_leq_one_active_nodes: current.profile.degree_leq_one_active_nodes -
|
|
462
484
|
baseline.profile.degree_leq_one_active_nodes,
|
|
463
485
|
edges_by_kind: diffCountRecords(baseline.profile.edges_by_kind, current.profile.edges_by_kind),
|
|
486
|
+
edge_share_by_kind: diffCountRecords(baselineEdgeShareByKind, currentEdgeShareByKind),
|
|
487
|
+
semantic_edges: currentSemanticEdges - baselineSemanticEdges,
|
|
488
|
+
semantic_edge_share: currentSemanticEdgeShare - baselineSemanticEdgeShare,
|
|
464
489
|
coverage_by_type: coverageByType,
|
|
465
490
|
},
|
|
466
491
|
};
|
|
467
492
|
}
|
|
468
493
|
//# sourceMappingURL=governance.js.map
|
|
469
|
-
//# debugId=
|
|
494
|
+
//# debugId=996cfe8f-1b9b-534e-9e22-ede6f76d7cac
|
package/dist/sdk/graph/run.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* queries in long-lived hosts are answered from the memoized snapshot.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
!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]="
|
|
14
|
+
!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]="6c8bfb7a-687a-5fbb-b408-ffdbab1187a9")}catch(e){}}();
|
|
15
15
|
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
16
16
|
import { pathExists } from "../../core/fs/fs-utils.js";
|
|
17
17
|
import { isTerminalStatus } from "../../core/item/status.js";
|
|
@@ -19,6 +19,7 @@ import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
|
|
|
19
19
|
import { resolveRuntimeStatusRegistry } from "../../core/schema/runtime-schema.js";
|
|
20
20
|
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
21
21
|
import { PmCliError } from "../../core/shared/errors.js";
|
|
22
|
+
import { createUnknownSubcommandError } from "../agent/subcommand-recovery.js";
|
|
22
23
|
import { listAllItemMetadataLight } from "../../core/store/item-store.js";
|
|
23
24
|
import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
|
|
24
25
|
import { readSettings } from "../../core/store/settings.js";
|
|
@@ -74,7 +75,11 @@ function normalizeIdList(raw) {
|
|
|
74
75
|
export function parseGraphSubcommand(raw, id, target) {
|
|
75
76
|
const candidate = raw.trim().toLowerCase();
|
|
76
77
|
if (!GRAPH_SUBCOMMAND_VALUES.includes(candidate)) {
|
|
77
|
-
throw
|
|
78
|
+
throw createUnknownSubcommandError({
|
|
79
|
+
command_path: "graph",
|
|
80
|
+
token: candidate || "<empty>",
|
|
81
|
+
allowed: GRAPH_SUBCOMMAND_VALUES,
|
|
82
|
+
});
|
|
78
83
|
}
|
|
79
84
|
const subcommand = candidate;
|
|
80
85
|
if (ROOTED_SUBCOMMANDS.has(subcommand) && !id?.trim()) {
|
|
@@ -714,4 +719,4 @@ export async function runGraph(subcommandRaw, id, target, options, global) {
|
|
|
714
719
|
return attachGraphProjection(value, invocation.summary, "result_rows");
|
|
715
720
|
}
|
|
716
721
|
//# sourceMappingURL=run.js.map
|
|
717
|
-
//# debugId=
|
|
722
|
+
//# debugId=6c8bfb7a-687a-5fbb-b408-ffdbab1187a9
|