@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
|
@@ -10,10 +10,17 @@
|
|
|
10
10
|
* `blocked_by` resolution a single source of truth.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
!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]="
|
|
13
|
+
!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]="de8a82e1-0b02-5d5a-9086-686529a1ccab")}catch(e){}}();
|
|
14
14
|
import { isTerminalStatus, normalizeStatusForRegistry } from "./status.js";
|
|
15
15
|
/** Dependency kind that marks "this item is blocked by the referenced item". */
|
|
16
16
|
const BLOCKED_BY_DEPENDENCY_KIND = "blocked_by";
|
|
17
|
+
/** Reverse dependency kind that marks "this item blocks the referenced item". */
|
|
18
|
+
const BLOCKS_DEPENDENCY_KIND = "blocks";
|
|
19
|
+
/** Built-in ordering kinds that must remain reachable by blocker resolution. */
|
|
20
|
+
export const ACTIONABILITY_ORDERING_KINDS = Object.freeze([
|
|
21
|
+
BLOCKED_BY_DEPENDENCY_KIND,
|
|
22
|
+
BLOCKS_DEPENDENCY_KIND,
|
|
23
|
+
]);
|
|
17
24
|
/** Retired placeholder that explicitly means an item has no active blocker. */
|
|
18
25
|
const NO_ACTIVE_BLOCKER_SENTINEL = "no-active-blocker";
|
|
19
26
|
/**
|
|
@@ -28,23 +35,66 @@ function normalizeItemId(id) {
|
|
|
28
35
|
/** Collects the blocker item ids declared by an item: the legacy scalar `blocked_by` field plus every `blocked_by` dependency edge. Ids are trimmed, de-duplicated, and returned in stable lexicographic order. This is the single source of truth for "what must close before this item can proceed", shared by `pm next` readiness classification and the close-time auto-unblock sweep. */
|
|
29
36
|
export function collectBlockedByIds(item) {
|
|
30
37
|
const ids = new Set();
|
|
31
|
-
const scalar = typeof item.blocked_by === "string" ? item.blocked_by
|
|
32
|
-
if (scalar.length > 0 && scalar
|
|
38
|
+
const scalar = typeof item.blocked_by === "string" ? normalizeItemId(item.blocked_by) : "";
|
|
39
|
+
if (scalar.length > 0 && scalar !== NO_ACTIVE_BLOCKER_SENTINEL) {
|
|
33
40
|
ids.add(scalar);
|
|
34
41
|
}
|
|
35
42
|
for (const dependency of item.dependencies ?? []) {
|
|
43
|
+
const dependencyId = typeof dependency.id === "string" ? normalizeItemId(dependency.id) : "";
|
|
36
44
|
if (dependency.kind === BLOCKED_BY_DEPENDENCY_KIND &&
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
ids.add(dependency.id.trim());
|
|
45
|
+
dependencyId.length > 0 &&
|
|
46
|
+
dependencyId !== NO_ACTIVE_BLOCKER_SENTINEL) {
|
|
47
|
+
ids.add(dependencyId);
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
return [...ids].sort((left, right) => left.localeCompare(right));
|
|
44
51
|
}
|
|
52
|
+
/** Build every forward and reverse blocker set in one corpus pass. */
|
|
53
|
+
export function indexBlockedByIds(corpus) {
|
|
54
|
+
const idsByItem = new Map();
|
|
55
|
+
for (const item of corpus) {
|
|
56
|
+
const itemId = normalizeItemId(item.id);
|
|
57
|
+
if (itemId.length === 0)
|
|
58
|
+
continue;
|
|
59
|
+
idsByItem.set(itemId, new Set(collectBlockedByIds(item)));
|
|
60
|
+
}
|
|
61
|
+
for (const candidate of corpus) {
|
|
62
|
+
const candidateId = normalizeItemId(candidate.id);
|
|
63
|
+
if (candidateId.length === 0)
|
|
64
|
+
continue;
|
|
65
|
+
for (const dependency of candidate.dependencies ?? []) {
|
|
66
|
+
const targetId = dependency.kind === BLOCKS_DEPENDENCY_KIND &&
|
|
67
|
+
typeof dependency.id === "string"
|
|
68
|
+
? normalizeItemId(dependency.id)
|
|
69
|
+
: "";
|
|
70
|
+
if (targetId.length === 0 || targetId === NO_ACTIVE_BLOCKER_SENTINEL) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const blockerIds = idsByItem.get(targetId) ?? new Set();
|
|
74
|
+
blockerIds.add(candidateId);
|
|
75
|
+
idsByItem.set(targetId, blockerIds);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return new Map([...idsByItem].map(([itemId, blockerIds]) => [
|
|
79
|
+
itemId,
|
|
80
|
+
[...blockerIds].sort((left, right) => left.localeCompare(right)),
|
|
81
|
+
]));
|
|
82
|
+
}
|
|
83
|
+
/** Collect blockers from both an item's forward declarations and corpus-level reverse `blocks` edges. */
|
|
84
|
+
export function collectBlockedByIdsFromCorpus(item, corpus) {
|
|
85
|
+
const itemId = normalizeItemId(item.id);
|
|
86
|
+
return itemId.length > 0
|
|
87
|
+
? (indexBlockedByIds(corpus).get(itemId) ?? collectBlockedByIds(item))
|
|
88
|
+
: collectBlockedByIds(item);
|
|
89
|
+
}
|
|
45
90
|
/** Resolves an item's declared blockers against a corpus index, annotating each with the blocker's title/status and whether it still gates work. Unknown ids remain unresolved: silently treating a typo as satisfied would dispatch work whose prerequisite was never completed. Terminal referenced items alone are resolved. */
|
|
46
|
-
|
|
47
|
-
|
|
91
|
+
function resolveItemBlockersWithIndex(item, itemsById, statusRegistry, blockerIdsByItem) {
|
|
92
|
+
const itemWithId = item;
|
|
93
|
+
const blockerIds = typeof itemWithId.id === "string"
|
|
94
|
+
? (blockerIdsByItem?.get(normalizeItemId(itemWithId.id)) ??
|
|
95
|
+
collectBlockedByIdsFromCorpus(itemWithId, [...itemsById.values()]))
|
|
96
|
+
: collectBlockedByIds(item);
|
|
97
|
+
return blockerIds.map((id) => {
|
|
48
98
|
const blocker = itemsById.get(normalizeItemId(id));
|
|
49
99
|
if (!blocker) {
|
|
50
100
|
return { id, title: null, status: null, resolved: false };
|
|
@@ -57,6 +107,10 @@ export function resolveItemBlockers(item, itemsById, statusRegistry) {
|
|
|
57
107
|
};
|
|
58
108
|
});
|
|
59
109
|
}
|
|
110
|
+
/** Resolves an item's blockers against a corpus index with reverse `blocks` support. */
|
|
111
|
+
export function resolveItemBlockers(item, itemsById, statusRegistry) {
|
|
112
|
+
return resolveItemBlockersWithIndex(item, itemsById, statusRegistry);
|
|
113
|
+
}
|
|
60
114
|
/**
|
|
61
115
|
* Collects the normalized (trimmed, lowercased) ids of every corpus item that is
|
|
62
116
|
* blocked under the single shared edge-aware definition: a non-terminal item
|
|
@@ -70,6 +124,7 @@ export function resolveItemBlockers(item, itemsById, statusRegistry) {
|
|
|
70
124
|
*/
|
|
71
125
|
export function collectDependencyBlockedIds(corpus, statusRegistry) {
|
|
72
126
|
const itemsById = new Map(corpus.map((item) => [normalizeItemId(item.id), item]));
|
|
127
|
+
const blockerIdsByItem = indexBlockedByIds(corpus);
|
|
73
128
|
// Same candidate gate as computeActionabilityReport: active statuses plus
|
|
74
129
|
// lifecycle-blocked statuses, so the two surfaces classify identically.
|
|
75
130
|
const candidateStatuses = new Set([
|
|
@@ -83,7 +138,7 @@ export function collectDependencyBlockedIds(corpus, statusRegistry) {
|
|
|
83
138
|
continue;
|
|
84
139
|
const lifecycleBlocked = statusRegistry.blocked_statuses.has(normalizedStatus);
|
|
85
140
|
if (lifecycleBlocked ||
|
|
86
|
-
|
|
141
|
+
resolveItemBlockersWithIndex(item, itemsById, statusRegistry, blockerIdsByItem).some((blocker) => !blocker.resolved)) {
|
|
87
142
|
blocked.add(normalizeItemId(item.id));
|
|
88
143
|
}
|
|
89
144
|
}
|
|
@@ -122,6 +177,7 @@ function indexCorpus(corpus) {
|
|
|
122
177
|
const itemsById = new Map();
|
|
123
178
|
const childrenByParent = new Map();
|
|
124
179
|
const blockedByReverse = new Map();
|
|
180
|
+
const blockerIdsByItem = indexBlockedByIds(corpus);
|
|
125
181
|
for (const item of corpus) {
|
|
126
182
|
// Index keys are normalized (lowercased) for case-insensitive resolution;
|
|
127
183
|
// stored values keep the item's original-case id for display.
|
|
@@ -133,14 +189,14 @@ function indexCorpus(corpus) {
|
|
|
133
189
|
siblings.push(item);
|
|
134
190
|
childrenByParent.set(parentKey, siblings);
|
|
135
191
|
}
|
|
136
|
-
for (const blockerId of
|
|
192
|
+
for (const blockerId of blockerIdsByItem.get(normalizeItemId(item.id))) {
|
|
137
193
|
const blockerKey = normalizeItemId(blockerId);
|
|
138
194
|
const dependents = blockedByReverse.get(blockerKey) ?? [];
|
|
139
195
|
dependents.push(item.id);
|
|
140
196
|
blockedByReverse.set(blockerKey, dependents);
|
|
141
197
|
}
|
|
142
198
|
}
|
|
143
|
-
return { itemsById, childrenByParent, blockedByReverse };
|
|
199
|
+
return { itemsById, childrenByParent, blockedByReverse, blockerIdsByItem };
|
|
144
200
|
}
|
|
145
201
|
/**
|
|
146
202
|
* Partitions a candidate set into ready vs blocked leaf work using the corpus to
|
|
@@ -154,7 +210,7 @@ function indexCorpus(corpus) {
|
|
|
154
210
|
* the candidate order so the caller can apply its own ranking.
|
|
155
211
|
*/
|
|
156
212
|
export function computeActionabilityReport(candidates, corpus, statusRegistry) {
|
|
157
|
-
const { itemsById, childrenByParent, blockedByReverse } = indexCorpus(corpus);
|
|
213
|
+
const { itemsById, childrenByParent, blockedByReverse, blockerIdsByItem } = indexCorpus(corpus);
|
|
158
214
|
const activeStatuses = new Set([
|
|
159
215
|
...resolveActiveStatusSet(statusRegistry),
|
|
160
216
|
...statusRegistry.blocked_statuses,
|
|
@@ -176,7 +232,7 @@ export function computeActionabilityReport(candidates, corpus, statusRegistry) {
|
|
|
176
232
|
containerCount += 1;
|
|
177
233
|
continue;
|
|
178
234
|
}
|
|
179
|
-
const openBlockers =
|
|
235
|
+
const openBlockers = resolveItemBlockersWithIndex(item, itemsById, statusRegistry, blockerIdsByItem).filter((blocker) => !blocker.resolved);
|
|
180
236
|
const unblocks = (blockedByReverse.get(normalizeItemId(item.id)) ?? [])
|
|
181
237
|
.filter((dependentId) => nonTerminalIds.has(normalizeItemId(dependentId)))
|
|
182
238
|
.sort((left, right) => left.localeCompare(right));
|
|
@@ -201,4 +257,4 @@ export function computeActionabilityReport(candidates, corpus, statusRegistry) {
|
|
|
201
257
|
};
|
|
202
258
|
}
|
|
203
259
|
//# sourceMappingURL=actionability.js.map
|
|
204
|
-
//# debugId=
|
|
260
|
+
//# debugId=de8a82e1-0b02-5d5a-9086-686529a1ccab
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Defines item parsing, formatting, and lifecycle helpers for Item Format.
|
|
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]="eaf0e260-a864-57cf-b23b-aac4f9151d8e")}catch(e){}}();
|
|
8
8
|
import { encode as encodeToon } from "@toon-format/toon";
|
|
9
9
|
import { isDeepStrictEqual } from "node:util";
|
|
10
10
|
import { CONFIDENCE_TEXT_VALUES, ISSUE_SEVERITY_VALUES, PLAN_STEP_STATUS_VALUES, RECURRENCE_FREQUENCY_VALUES, RECURRENCE_WEEKDAY_VALUES, STATUS_VALUES, weekdayOrderIndex, } from "../../types/index.js";
|
|
@@ -630,7 +630,7 @@ function normalizeTestRunSummary(value) {
|
|
|
630
630
|
function sortTests(values) {
|
|
631
631
|
if (!Array.isArray(values) || values.length === 0)
|
|
632
632
|
return undefined;
|
|
633
|
-
return
|
|
633
|
+
return values.map(normalizeLinkedTest);
|
|
634
634
|
}
|
|
635
635
|
function normalizeTrimmedStringList(value) {
|
|
636
636
|
if (!Array.isArray(value)) {
|
|
@@ -709,35 +709,6 @@ function normalizeLinkedTest(value) {
|
|
|
709
709
|
deleteUndefinedFields(test);
|
|
710
710
|
return test;
|
|
711
711
|
}
|
|
712
|
-
function compareLinkedTests(a, b) {
|
|
713
|
-
return firstNonZeroComparison([
|
|
714
|
-
a.scope.localeCompare(b.scope),
|
|
715
|
-
compareOptionalStrings(a.path, b.path),
|
|
716
|
-
compareOptionalStrings(a.command, b.command),
|
|
717
|
-
compareOptionalNumbers(a.timeout_seconds, b.timeout_seconds),
|
|
718
|
-
compareOptionalStrings(a.pm_context_mode, b.pm_context_mode),
|
|
719
|
-
Number(Boolean(a.shared_host_safe)) - Number(Boolean(b.shared_host_safe)),
|
|
720
|
-
compareJsonValues(a.env_clear, b.env_clear, []),
|
|
721
|
-
compareJsonValues(a.env_set, b.env_set, {}),
|
|
722
|
-
compareJsonValues(a.assert_stdout_contains, b.assert_stdout_contains, []),
|
|
723
|
-
compareJsonValues(a.assert_stdout_regex, b.assert_stdout_regex, []),
|
|
724
|
-
compareJsonValues(a.assert_stderr_contains, b.assert_stderr_contains, []),
|
|
725
|
-
compareJsonValues(a.assert_stderr_regex, b.assert_stderr_regex, []),
|
|
726
|
-
compareOptionalNumbers(a.assert_stdout_min_lines, b.assert_stdout_min_lines),
|
|
727
|
-
compareJsonValues(a.assert_json_field_equals, b.assert_json_field_equals, {}),
|
|
728
|
-
compareJsonValues(a.assert_json_field_gte, b.assert_json_field_gte, {}),
|
|
729
|
-
compareOptionalStrings(a.note, b.note),
|
|
730
|
-
]);
|
|
731
|
-
}
|
|
732
|
-
function compareOptionalStrings(left, right) {
|
|
733
|
-
return (left ?? "").localeCompare(right ?? "");
|
|
734
|
-
}
|
|
735
|
-
function compareOptionalNumbers(left, right) {
|
|
736
|
-
return (left ?? 0) - (right ?? 0);
|
|
737
|
-
}
|
|
738
|
-
function compareJsonValues(left, right, fallback) {
|
|
739
|
-
return JSON.stringify(left ?? fallback).localeCompare(JSON.stringify(right ?? fallback));
|
|
740
|
-
}
|
|
741
712
|
function sortDocs(values) {
|
|
742
713
|
if (!values || values.length === 0)
|
|
743
714
|
return undefined;
|
|
@@ -1422,4 +1393,4 @@ export const _testOnlyItemFormat = {
|
|
|
1422
1393
|
sortTests,
|
|
1423
1394
|
};
|
|
1424
1395
|
//# sourceMappingURL=item-format.js.map
|
|
1425
|
-
//# debugId=
|
|
1396
|
+
//# debugId=eaf0e260-a864-57cf-b23b-aac4f9151d8e
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RuntimeFieldCommand, RuntimeFieldDefinition, RuntimeFieldType } from "../../types/index.js";
|
|
2
|
+
export { normalizeStatusToken as normalizeFieldKey } from "./status-token.js";
|
|
2
3
|
export type { RuntimeFieldCommand, RuntimeFieldDefinition, RuntimeFieldType, } from "../../types/index.js";
|
|
3
4
|
/** Built-in item-metadata field names a custom field key must never shadow. A custom key that collides with one of these would let `pm create --<key>` write over reserved metadata, so add-field rejects them up front (symmetric with the built-in-type guard in item-types-file.ts). */
|
|
4
5
|
export declare const BUILTIN_FIELD_KEYS: ReadonlySet<string>;
|
|
@@ -71,8 +72,6 @@ export interface RemoveFieldResult {
|
|
|
71
72
|
/** The removed definition, when one matched the requested key. */
|
|
72
73
|
definition?: RuntimeFieldDefinition;
|
|
73
74
|
}
|
|
74
|
-
/** Normalizes a field key using the same rule as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
|
|
75
|
-
export declare function normalizeFieldKey(value: unknown): string;
|
|
76
75
|
/** Validates and normalizes raw add-field CLI input. Throws a plain Error with a stable message when the key is missing/empty, collides with a built-in field, or carries an invalid type/command; the CLI layer maps these to PmCliError exit codes. A `string_array` type implies a repeatable field downstream (runtime-schema.ts derives `repeatable`), so no separate repeatable flag is exposed. */
|
|
77
76
|
export declare function normalizeAddFieldInput(raw: RawAddFieldInput): NormalizedAddFieldInput;
|
|
78
77
|
/** Coerces an arbitrary parsed value from fields.json into a FieldsFile. Accepts the canonical `{ fields: [...] }` shape, a bare array, or a `{ definitions: [...] }` form, and tolerates a missing/invalid file by returning an empty fields list. */
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Resolves configurable schema, fields, statuses, and workflows for Fields File.
|
|
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]="575b0c3a-9ce1-504f-a24e-d8854e898f17")}catch(e){}}();
|
|
8
8
|
import { RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, } from "../../types/index.js";
|
|
9
9
|
import { ITEM_METADATA_KEY_ORDER } from "../shared/constants.js";
|
|
10
|
+
import { normalizeStatusToken as normalizeFieldKey } from "./status-token.js";
|
|
11
|
+
export { normalizeStatusToken as normalizeFieldKey } from "./status-token.js";
|
|
10
12
|
/**
|
|
11
13
|
* Pure logic for the `pm schema add-field` / `pm schema remove-field` commands
|
|
12
14
|
* and the `list-fields` / `show-field` inspectors. The CLI command file
|
|
@@ -52,15 +54,6 @@ export const BUILTIN_FIELD_KEYS = new Set([
|
|
|
52
54
|
]);
|
|
53
55
|
/** The default commands a field is wired onto when `--commands` is omitted, matching the runtime default in runtime-schema.ts (normalizeRuntimeFieldDefinition). */
|
|
54
56
|
const DEFAULT_FIELD_COMMANDS = ["create", "update"];
|
|
55
|
-
/** Normalizes a field key using the same rule as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
|
|
56
|
-
export function normalizeFieldKey(value) {
|
|
57
|
-
return typeof value === "string"
|
|
58
|
-
? value
|
|
59
|
-
.trim()
|
|
60
|
-
.toLowerCase()
|
|
61
|
-
.replaceAll(/[\s-]+/g, "_")
|
|
62
|
-
: "";
|
|
63
|
-
}
|
|
64
57
|
/** Normalizes a CLI flag token: strip a leading `--`, lowercase, and collapse whitespace/underscore runs to a single hyphen (matches normalizeCliToken in runtime-schema.ts). */
|
|
65
58
|
function normalizeCliToken(value) {
|
|
66
59
|
if (typeof value !== "string") {
|
|
@@ -293,4 +286,4 @@ function applyBooleanFlag(definition, key, value) {
|
|
|
293
286
|
}
|
|
294
287
|
}
|
|
295
288
|
//# sourceMappingURL=fields-file.js.map
|
|
296
|
-
//# debugId=
|
|
289
|
+
//# debugId=575b0c3a-9ce1-504f-a24e-d8854e898f17
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Resolves configurable schema, fields, statuses, and workflows for Runtime Schema.
|
|
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]="a9ff482a-f9f9-5e35-88d0-240db815ec08")}catch(e){}}();
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { pathExists, readFileIfExists, writeFileAtomic, } from "../fs/fs-utils.js";
|
|
10
10
|
import { DEFAULT_STATUS_DEFINITIONS, DEFAULT_WORKFLOW_DEFINITION, } from "../shared/constants.js";
|
|
11
11
|
import { RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, RUNTIME_STATUS_ROLE_VALUES, RUNTIME_UNKNOWN_FIELD_POLICY_VALUES, STATUS_VALUES, } from "../../types/index.js";
|
|
12
|
+
import { normalizeStatusToken } from "./status-token.js";
|
|
12
13
|
/** Fallback runtime schema file paths used when callers do not provide an override. */
|
|
13
14
|
export const DEFAULT_RUNTIME_SCHEMA_FILE_PATHS = Object.freeze({
|
|
14
15
|
types: "schema/types.json",
|
|
@@ -39,14 +40,6 @@ function normalizeStringList(values) {
|
|
|
39
40
|
.filter((value) => value.length > 0)),
|
|
40
41
|
].sort((left, right) => left.localeCompare(right));
|
|
41
42
|
}
|
|
42
|
-
function normalizeStatusToken(value) {
|
|
43
|
-
return typeof value === "string"
|
|
44
|
-
? value
|
|
45
|
-
.trim()
|
|
46
|
-
.toLowerCase()
|
|
47
|
-
.replaceAll(/[\s-]+/g, "_")
|
|
48
|
-
: "";
|
|
49
|
-
}
|
|
50
43
|
function normalizeStatusId(value) {
|
|
51
44
|
if (typeof value !== "string" || value.length === 0) {
|
|
52
45
|
return undefined;
|
|
@@ -698,4 +691,4 @@ export function statusIsTerminal(status, registry) {
|
|
|
698
691
|
return registry.terminal_statuses.has(normalized);
|
|
699
692
|
}
|
|
700
693
|
//# sourceMappingURL=runtime-schema.js.map
|
|
701
|
-
//# debugId=
|
|
694
|
+
//# debugId=a9ff482a-f9f9-5e35-88d0-240db815ec08
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RuntimeStatusDefinition, RuntimeStatusRole } from "../../types/index.js";
|
|
2
|
+
export { normalizeStatusToken } from "./status-token.js";
|
|
2
3
|
export type { RuntimeStatusDefinition, RuntimeStatusRole, } from "../../types/index.js";
|
|
3
4
|
/** The 5 lifecycle status ids that ship as built-in defaults and may never be removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS: open/in_progress/blocked/closed/canceled). `draft` is also a default but the acceptance criteria enumerate the 5 terminal/active ids explicitly, so the guard derives the full set from the canonical defaults to stay in sync. */
|
|
4
5
|
export declare const BUILTIN_STATUS_IDS: ReadonlySet<string>;
|
|
@@ -51,8 +52,6 @@ export interface RemoveStatusDefResult {
|
|
|
51
52
|
/** The removed definition, when one matched the requested id. */
|
|
52
53
|
definition?: RuntimeStatusDefinition;
|
|
53
54
|
}
|
|
54
|
-
/** Normalizes a status token using the same rules as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
|
|
55
|
-
export declare function normalizeStatusToken(value: unknown): string;
|
|
56
55
|
/**
|
|
57
56
|
* Validates and normalizes raw add-status CLI input. Throws a plain Error with a
|
|
58
57
|
* stable message when the id is missing/empty or a role is not one of
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* Resolves configurable schema, fields, statuses, and workflows for Status Defs File.
|
|
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]="3eac0218-43c9-5bd2-8eaf-589d02d2c8ad")}catch(e){}}();
|
|
8
8
|
import { RUNTIME_STATUS_ROLE_VALUES } from "../../types/index.js";
|
|
9
9
|
import { DEFAULT_RUNTIME_STATUS_DEFINITIONS } from "./runtime-schema.js";
|
|
10
|
-
import {
|
|
10
|
+
import { normalizeStatusToken } from "./status-token.js";
|
|
11
|
+
export { normalizeStatusToken } from "./status-token.js";
|
|
11
12
|
/**
|
|
12
13
|
* Pure logic for the `pm schema add-status` / `pm schema remove-status`
|
|
13
14
|
* commands. The CLI command file (schema.ts) owns IO/governance; everything
|
|
@@ -20,37 +21,8 @@ import { evictOldestMemoEntries } from "../shared/memo.js";
|
|
|
20
21
|
* into the persisted file.
|
|
21
22
|
*/
|
|
22
23
|
const RUNTIME_STATUS_ROLE_SET = new Set(RUNTIME_STATUS_ROLE_VALUES);
|
|
23
|
-
/**
|
|
24
|
-
* Memo for {@link normalizeStatusToken}. Status ranking inside sort comparators
|
|
25
|
-
* normalizes the same handful of status strings O(n log n) times per corpus scan, and
|
|
26
|
-
* the trim/lowercase/regex pipeline shows up in list/next/context profiles. The cap
|
|
27
|
-
* bounds memory in long-lived hosts against unbounded arbitrary inputs; half-eviction keeps the
|
|
28
|
-
* newest-inserted half when the cap is hit. Declared before
|
|
29
|
-
* BUILTIN_STATUS_IDS, whose module-level initializer already normalizes tokens.
|
|
30
|
-
*/
|
|
31
|
-
const STATUS_TOKEN_MEMO_MAX_ENTRIES = 2_000;
|
|
32
|
-
const statusTokenMemo = new Map();
|
|
33
24
|
/** The 5 lifecycle status ids that ship as built-in defaults and may never be removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS: open/in_progress/blocked/closed/canceled). `draft` is also a default but the acceptance criteria enumerate the 5 terminal/active ids explicitly, so the guard derives the full set from the canonical defaults to stay in sync. */
|
|
34
25
|
export const BUILTIN_STATUS_IDS = new Set(DEFAULT_RUNTIME_STATUS_DEFINITIONS.map((definition) => normalizeStatusToken(definition.id)).filter((id) => id.length > 0));
|
|
35
|
-
/** Normalizes a status token using the same rules as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
|
|
36
|
-
export function normalizeStatusToken(value) {
|
|
37
|
-
if (typeof value !== "string") {
|
|
38
|
-
return "";
|
|
39
|
-
}
|
|
40
|
-
const memoized = statusTokenMemo.get(value);
|
|
41
|
-
if (memoized !== undefined) {
|
|
42
|
-
return memoized;
|
|
43
|
-
}
|
|
44
|
-
const normalized = value
|
|
45
|
-
.trim()
|
|
46
|
-
.toLowerCase()
|
|
47
|
-
.replaceAll(/[\s-]+/g, "_");
|
|
48
|
-
if (statusTokenMemo.size >= STATUS_TOKEN_MEMO_MAX_ENTRIES) {
|
|
49
|
-
evictOldestMemoEntries(statusTokenMemo);
|
|
50
|
-
}
|
|
51
|
-
statusTokenMemo.set(value, normalized);
|
|
52
|
-
return normalized;
|
|
53
|
-
}
|
|
54
26
|
function dedupeTokens(values) {
|
|
55
27
|
const seen = new Set();
|
|
56
28
|
for (const value of values) {
|
|
@@ -250,4 +222,4 @@ export function assertStatusTokensAvailable(input, resolvedAliasToId) {
|
|
|
250
222
|
}
|
|
251
223
|
}
|
|
252
224
|
//# sourceMappingURL=status-defs-file.js.map
|
|
253
|
-
//# debugId=
|
|
225
|
+
//# debugId=3eac0218-43c9-5bd2-8eaf-589d02d2c8ad
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/schema/status-token
|
|
3
|
+
*
|
|
4
|
+
* Owns the canonical bounded status-token normalization primitive used by
|
|
5
|
+
* schema files, runtime registries, workflows, and package-facing SDK helpers.
|
|
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]="d6056922-237d-525a-b354-687493a4e123")}catch(e){}}();
|
|
9
|
+
import { evictOldestMemoEntries } from "../shared/memo.js";
|
|
10
|
+
const STATUS_TOKEN_MEMO_MAX_ENTRIES = 2_000;
|
|
11
|
+
const statusTokenMemo = new Map();
|
|
12
|
+
/** Lowercase a status token and collapse whitespace or hyphen runs to one underscore. */
|
|
13
|
+
export function normalizeStatusToken(value) {
|
|
14
|
+
if (typeof value !== "string") {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
const memoized = statusTokenMemo.get(value);
|
|
18
|
+
if (memoized !== undefined) {
|
|
19
|
+
return memoized;
|
|
20
|
+
}
|
|
21
|
+
const normalized = value
|
|
22
|
+
.trim()
|
|
23
|
+
.toLowerCase()
|
|
24
|
+
.replaceAll(/[\s-]+/g, "_");
|
|
25
|
+
if (statusTokenMemo.size >= STATUS_TOKEN_MEMO_MAX_ENTRIES) {
|
|
26
|
+
evictOldestMemoEntries(statusTokenMemo);
|
|
27
|
+
}
|
|
28
|
+
statusTokenMemo.set(value, normalized);
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=status-token.js.map
|
|
32
|
+
//# debugId=d6056922-237d-525a-b354-687493a4e123
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Resolves configurable schema, fields, statuses, and workflows for Type Workflows.
|
|
5
5
|
*/
|
|
6
6
|
import type { RuntimeSchemaSettings } from "../../types/index.js";
|
|
7
|
+
export { normalizeStatusToken } from "./status-token.js";
|
|
7
8
|
/**
|
|
8
9
|
* Per-type allowed-transition support (governance.workflow_enforcement).
|
|
9
10
|
*
|
|
@@ -51,8 +52,6 @@ export interface EvaluateTransitionResult {
|
|
|
51
52
|
/** Allowed [from, to] pairs for the matched type (normalized ids). Empty when the type is unrestricted. */
|
|
52
53
|
allowedTransitions: [string, string][];
|
|
53
54
|
}
|
|
54
|
-
/** Normalize a status token the same way runtime-schema statuses are normalized. */
|
|
55
|
-
export declare function normalizeStatusToken(value: unknown): string;
|
|
56
55
|
/**
|
|
57
56
|
* Normalize the raw type_workflows from a runtime schema into a deduped,
|
|
58
57
|
* lower-cased-type list with normalized status tokens.
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/** Normalize a status token the same way runtime-schema statuses are normalized. */
|
|
2
1
|
|
|
3
|
-
!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]="
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
? value
|
|
7
|
-
.trim()
|
|
8
|
-
.toLowerCase()
|
|
9
|
-
.replaceAll(/[\s-]+/g, "_")
|
|
10
|
-
: "";
|
|
11
|
-
}
|
|
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]="c4e316a0-823d-5722-9e15-6d741ae44f1b")}catch(e){}}();
|
|
3
|
+
import { normalizeStatusToken } from "./status-token.js";
|
|
4
|
+
export { normalizeStatusToken } from "./status-token.js";
|
|
12
5
|
function normalizeTypeName(value) {
|
|
13
6
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
14
7
|
}
|
|
@@ -109,4 +102,4 @@ export function describeAllowedTransitions(allowedTransitions) {
|
|
|
109
102
|
.join(", ");
|
|
110
103
|
}
|
|
111
104
|
//# sourceMappingURL=type-workflows.js.map
|
|
112
|
-
//# debugId=
|
|
105
|
+
//# debugId=c4e316a0-823d-5722-9e15-6d741ae44f1b
|
|
@@ -19,6 +19,19 @@ export interface AgentProvenanceObservation {
|
|
|
19
19
|
* selected harness declared the dimension but exposed no value this run.
|
|
20
20
|
*/
|
|
21
21
|
export type AgentProvenance = Readonly<Record<string, AgentProvenanceObservation | null>>;
|
|
22
|
+
/** Bounded reason explaining why one declared provenance dimension was absent. */
|
|
23
|
+
export type AgentProvenanceAbsenceReason = "harness_unavailable" | "resolver_failed" | "resolver_not_configured" | "probes_disabled" | "invalid_value";
|
|
24
|
+
/** Machine-readable resolution outcome for one provenance dimension. */
|
|
25
|
+
export interface AgentProvenanceOutcome {
|
|
26
|
+
/** Whether the dimension resolved without retaining private source material. */
|
|
27
|
+
status: "resolved" | "unavailable" | "not_configured" | "failed";
|
|
28
|
+
/** Stable bounded reason for absent or rejected values. */
|
|
29
|
+
reason?: AgentProvenanceAbsenceReason;
|
|
30
|
+
/** Resolver name when a bounded local resolver was attempted. */
|
|
31
|
+
resolver?: AgentProvenanceResolver;
|
|
32
|
+
/** Stable inference contract version used by downstream analytics. */
|
|
33
|
+
rule_version: "v1";
|
|
34
|
+
}
|
|
22
35
|
/** Privacy-bounded MCP client metadata that can participate in agent detection. */
|
|
23
36
|
export interface AgentClientInfo {
|
|
24
37
|
/** Client or harness name reported during protocol initialization. */
|
|
@@ -72,6 +85,11 @@ export interface DetectedAgentIdentity {
|
|
|
72
85
|
/** Stable declared episode identity when the session supplied one. */
|
|
73
86
|
episode?: AgentEpisodeIdentity;
|
|
74
87
|
}
|
|
88
|
+
/** Agent identity plus explicit outcomes for every built-in provenance dimension. */
|
|
89
|
+
export interface DiagnosedAgentIdentity extends DetectedAgentIdentity {
|
|
90
|
+
/** Resolution outcomes that distinguish absence from resolver failure. */
|
|
91
|
+
provenance_outcomes: Readonly<Record<string, AgentProvenanceOutcome>>;
|
|
92
|
+
}
|
|
75
93
|
/** Public, privacy-safe identity resolution result shared by CLI and SDK hosts. */
|
|
76
94
|
export interface ResolvedAuthorIdentity extends DetectedAgentIdentity {
|
|
77
95
|
/** Stable author value written to mutation history. */
|
|
@@ -126,6 +144,13 @@ export declare function runWithWorkspaceHarnessSignalDescriptors<T>(descriptors:
|
|
|
126
144
|
* traversal, or network requests.
|
|
127
145
|
*/
|
|
128
146
|
export declare function detectAgentIdentity(signals?: HarnessDetectionSignals): DetectedAgentIdentity;
|
|
147
|
+
/**
|
|
148
|
+
* Diagnose provenance without exposing environment values, paths, or probe data.
|
|
149
|
+
*
|
|
150
|
+
* This additive SDK contract keeps legacy `detectAgentIdentity` projections
|
|
151
|
+
* stable while giving health checks and history writers explicit absence states.
|
|
152
|
+
*/
|
|
153
|
+
export declare function diagnoseAgentIdentity(signals?: HarnessDetectionSignals): DiagnosedAgentIdentity;
|
|
129
154
|
/** Reads the invocation-wide author override through the canonical environment seam. */
|
|
130
155
|
export declare function readAuthorEnvironment(): string | undefined;
|
|
131
156
|
/** Updates or clears the invocation-wide author override through the canonical environment seam. */
|