@unbrained/pm-cli 2026.8.15 → 2026.8.17
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 +56 -12
- package/README.md +13 -13
- package/dist/cli/error-guidance.d.ts +5 -0
- package/dist/cli/error-guidance.js +15 -2
- package/dist/cli/public.d.ts +2 -0
- package/dist/cli/public.js +21 -0
- package/dist/cli/register-history-author.js +16 -11
- package/dist/cli/register-mutation.js +4 -4
- package/dist/cli-bundle/bundle-manifest.json +143 -143
- package/dist/cli-bundle/chunks/{chunk-J42EGKDK.js → chunk-2QLOXC3V.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LJHOAVGI.js → chunk-3UEGXBMR.js} +49 -43
- package/dist/cli-bundle/chunks/chunk-4JPYF536.js +35 -0
- package/dist/cli-bundle/chunks/chunk-6VDLG2FC.js +13 -0
- package/dist/cli-bundle/chunks/chunk-7IBRGCHX.js +2 -0
- package/dist/cli-bundle/chunks/chunk-HBJAS566.js +8 -0
- package/dist/cli-bundle/chunks/chunk-ION3E43Q.js +197 -0
- package/dist/cli-bundle/chunks/{chunk-WLPDLNEZ.js → chunk-JOKATURE.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-MEM2ZS3O.js → chunk-TPXZIBIV.js} +5 -5
- package/dist/cli-bundle/chunks/chunk-YM2YAMF7.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-CT3LFDDN.js → register-list-query-Q7KII4G5.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-NWEVA5YS.js → register-mutation-4WBRPXLV.js} +3 -3
- package/dist/cli-bundle/chunks/{register-operations-AHIAG5KM.js → register-operations-SSENDH5B.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-ZJZFVAKE.js → register-setup-DOSFBGKE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-WTSER4WJ.js → chunk-267MUUS6.js} +11 -11
- package/dist/cli-bundle/focused-chunks/chunk-2NNFLLNG.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-2QSAKMIH.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZMFXQ7VF.js → chunk-ATEY76SX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-BUCG4ZI2.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M67F5AIN.js → chunk-CYFK5UPB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-EHXIKD6K.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EXZA4257.js → chunk-KGEXTMPG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KP2VQQVQ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MHPIL773.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-POEEAD2V.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ITAUHSO6.js → chunk-SALH6B6K.js} +47 -47
- package/dist/cli-bundle/focused-chunks/{chunk-KLVUMNXJ.js → chunk-SYZENPIT.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-KTKH4IMG.js → chunk-XKAMP5OU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NSPYTG6G.js → chunk-XPIC53VA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6XKF3PGV.js → chunk-ZQPGZZWQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZT2DJS27.js +155 -0
- package/dist/cli-bundle/main.js +10 -10
- 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 +31 -31
- 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 +32 -32
- 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 +4 -2
- package/dist/core/extensions/loader.js +10 -6
- package/dist/core/extensions/manifest-schema.d.ts +20 -0
- package/dist/core/extensions/manifest-schema.js +52 -0
- package/dist/core/history/replay.js +32 -14
- package/dist/core/history/workspace-history.js +32 -10
- package/dist/core/output/output.js +6 -3
- package/dist/core/schema/fields-file.d.ts +1 -1
- package/dist/core/schema/fields-file.js +2 -2
- package/dist/core/schema/runtime-field-values.js +115 -9
- package/dist/core/schema/runtime-schema.d.ts +3 -1
- package/dist/core/schema/runtime-schema.js +124 -3
- package/dist/core/shared/errors.d.ts +12 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/time.d.ts +2 -0
- package/dist/core/shared/time.js +27 -2
- package/dist/core/store/item-store.js +28 -2
- package/dist/sdk/agent/refusal-reachability.d.ts +56 -8
- package/dist/sdk/agent/refusal-reachability.js +414 -4
- package/dist/sdk/author-attribution.d.ts +56 -11
- package/dist/sdk/author-attribution.js +174 -50
- package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +12 -4
- package/dist/sdk/cli-contracts/tool-schema.js +12 -4
- package/dist/sdk/completion.js +11 -4
- package/dist/sdk/compose.d.ts +6 -2
- package/dist/sdk/compose.js +33 -3
- package/dist/sdk/context-intent-contracts.d.ts +8 -4
- package/dist/sdk/context-intent-contracts.js +76 -31
- package/dist/sdk/dependency-flag-validation.d.ts +9 -2
- package/dist/sdk/dependency-flag-validation.js +101 -35
- package/dist/sdk/environment/host-environment-errors.js +25 -7
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +62 -14
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -2
- package/dist/sdk/governance/assurance-action.d.ts +3 -7
- package/dist/sdk/governance/assurance-action.js +97 -2
- package/dist/sdk/governance/boundary-fixtures.d.ts +86 -0
- package/dist/sdk/governance/boundary-fixtures.js +201 -0
- package/dist/sdk/governance/coverage-assurance.d.ts +24 -0
- package/dist/sdk/governance/coverage-assurance.js +61 -0
- package/dist/sdk/governance/defect-recurrence-signals.d.ts +10 -0
- package/dist/sdk/governance/defect-recurrence-signals.js +25 -0
- package/dist/sdk/governance/defect-recurrence.d.ts +242 -0
- package/dist/sdk/governance/defect-recurrence.js +523 -0
- package/dist/sdk/governance/extension-host-version.js +20 -9
- package/dist/sdk/governance.d.ts +2 -0
- package/dist/sdk/governance.js +4 -2
- package/dist/sdk/graph/governance.js +3 -2
- package/dist/sdk/guide-topics.js +191 -2
- package/dist/sdk/index.d.ts +5 -1
- package/dist/sdk/index.js +6 -3
- package/dist/sdk/lifecycle/create.js +4 -2
- package/dist/sdk/lifecycle/update-many.js +15 -2
- package/dist/sdk/lifecycle/update.js +5 -2
- package/dist/sdk/linked-artifacts.js +63 -14
- package/dist/sdk/query/get.d.ts +2 -0
- package/dist/sdk/query/get.js +32 -7
- package/dist/sdk/read-output-contracts.js +5 -3
- package/dist/sdk/relationship-analytics.js +90 -14
- package/dist/sdk/relationship-kinds/contract.d.ts +4 -0
- package/dist/sdk/relationship-kinds/contract.js +3 -2
- package/dist/sdk/relationships.d.ts +1 -1
- package/dist/sdk/relationships.js +11 -2
- package/dist/sdk/runtime.d.ts +2 -5
- package/dist/sdk/runtime.js +3 -2
- package/dist/sdk/schema.d.ts +1 -0
- package/dist/sdk/schema.js +2 -2
- package/dist/sdk/test/execution.d.ts +6 -2
- package/dist/sdk/test/execution.js +39 -13
- package/dist/types.d.ts +29 -2
- package/dist/types.js +4 -2
- package/docs/CONFIGURATION.md +58 -1
- package/docs/CONTEXT_INTEGRITY_CONTRACTS.md +58 -0
- package/docs/DEFECT_RECURRENCE.md +134 -0
- package/docs/DEPENDENCY_KIND_CONTRACT.md +12 -2
- package/docs/README.md +2 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +7 -1
- package/docs/RELATIONSHIP_GRAPH.md +16 -2
- package/docs/RELEASING.md +13 -7
- package/docs/SDK.md +38 -5
- package/docs/SDK_CONTEXT_INTEGRITY.md +33 -5
- package/docs/SDK_CONTEXT_TRUTH_CONTRACTS.md +13 -5
- package/docs/SDK_RUNTIME_BOUNDARIES.md +9 -1
- package/docs/TESTING.md +18 -1
- package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +1 -1
- package/marketplace.json +2 -2
- package/package.json +6 -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-claude/skills/pm-audit/SKILL.md +26 -0
- package/plugins/pm-claude/skills/pm-developer/SKILL.md +26 -0
- package/plugins/pm-claude/skills/pm-planner/SKILL.md +26 -0
- package/plugins/pm-claude/skills/pm-release/SKILL.md +26 -0
- package/plugins/pm-claude/skills/pm-workflow/SKILL.md +26 -0
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/skills/pm-auditor/SKILL.md +26 -0
- package/plugins/pm-codex/skills/pm-native/SKILL.md +26 -0
- package/plugins/pm-codex/skills/pm-release/SKILL.md +26 -0
- package/sdk/public-surface.json +716 -33
- package/dist/cli-bundle/chunks/chunk-24GAV7XL.js +0 -8
- package/dist/cli-bundle/chunks/chunk-AIM6VT2N.js +0 -13
- package/dist/cli-bundle/chunks/chunk-DSWDLTDR.js +0 -197
- package/dist/cli-bundle/chunks/chunk-KIEGUBYQ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KLKYLSDX.js +0 -2
- package/dist/cli-bundle/chunks/chunk-QHPCJWEJ.js +0 -35
- package/dist/cli-bundle/focused-chunks/chunk-4X57RE4U.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7NJ4QYQ2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KT5XMYSX.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-OKA6ELTL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PUISBOPP.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QLNMCESQ.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-SLKC6QLJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-U65UC4G3.js +0 -2
|
@@ -4,7 +4,7 @@
|
|
|
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]="88b9179f-569e-5cd6-b67c-c27431961554")}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";
|
|
@@ -32,6 +32,119 @@ const RUNTIME_STATUS_ROLE_SET = new Set(RUNTIME_STATUS_ROLE_VALUES);
|
|
|
32
32
|
const RUNTIME_FIELD_TYPE_SET = new Set(RUNTIME_FIELD_TYPE_VALUES);
|
|
33
33
|
const RUNTIME_FIELD_COMMAND_SET = new Set(RUNTIME_FIELD_COMMAND_VALUES);
|
|
34
34
|
const RUNTIME_UNKNOWN_FIELD_POLICY_SET = new Set(RUNTIME_UNKNOWN_FIELD_POLICY_VALUES);
|
|
35
|
+
const RUNTIME_FIELD_VALUE_TYPE_SET = new Set([
|
|
36
|
+
"string",
|
|
37
|
+
"number",
|
|
38
|
+
"boolean",
|
|
39
|
+
"array",
|
|
40
|
+
"object",
|
|
41
|
+
]);
|
|
42
|
+
const MAX_RUNTIME_FIELD_VALUE_SCHEMA_DEPTH = 16;
|
|
43
|
+
function isPlainObject(value) {
|
|
44
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
45
|
+
}
|
|
46
|
+
const RUNTIME_FIELD_VALUE_SCHEMA_SHAPE_VALIDATORS = [
|
|
47
|
+
(schema) => schema.type === undefined ||
|
|
48
|
+
(typeof schema.type === "string" &&
|
|
49
|
+
RUNTIME_FIELD_VALUE_TYPE_SET.has(schema.type)),
|
|
50
|
+
(schema) => !Object.hasOwn(schema, "const") || isStructuredJsonValue(schema.const),
|
|
51
|
+
(schema) => schema.enum === undefined ||
|
|
52
|
+
(Array.isArray(schema.enum) &&
|
|
53
|
+
schema.enum.every((entry) => isStructuredJsonValue(entry))),
|
|
54
|
+
(schema) => schema.min_length === undefined ||
|
|
55
|
+
(Number.isInteger(schema.min_length) &&
|
|
56
|
+
schema.min_length >= 0),
|
|
57
|
+
(schema) => schema.min_items === undefined ||
|
|
58
|
+
(Number.isInteger(schema.min_items) && schema.min_items >= 0),
|
|
59
|
+
(schema) => schema.format === undefined || schema.format === "date-time",
|
|
60
|
+
(schema) => schema.required === undefined ||
|
|
61
|
+
(Array.isArray(schema.required) &&
|
|
62
|
+
schema.required.every((entry) => typeof entry === "string" && entry.length > 0)),
|
|
63
|
+
(schema) => schema.additional_properties === undefined ||
|
|
64
|
+
typeof schema.additional_properties === "boolean",
|
|
65
|
+
(schema) => schema.properties === undefined ||
|
|
66
|
+
isPlainObject(schema.properties),
|
|
67
|
+
(schema) => schema.one_of === undefined ||
|
|
68
|
+
(Array.isArray(schema.one_of) && schema.one_of.length > 0),
|
|
69
|
+
];
|
|
70
|
+
function isStructuredJsonValue(value, ancestors = new Set()) {
|
|
71
|
+
if (value === null ||
|
|
72
|
+
typeof value === "string" ||
|
|
73
|
+
typeof value === "boolean") {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
if (typeof value === "number")
|
|
77
|
+
return Number.isFinite(value);
|
|
78
|
+
if (typeof value !== "object" || ancestors.has(value))
|
|
79
|
+
return false;
|
|
80
|
+
ancestors.add(value);
|
|
81
|
+
const valid = Array.isArray(value)
|
|
82
|
+
? value.every((entry) => isStructuredJsonValue(entry, ancestors))
|
|
83
|
+
: Object.values(value).every((entry) => isStructuredJsonValue(entry, ancestors));
|
|
84
|
+
ancestors.delete(value);
|
|
85
|
+
return valid;
|
|
86
|
+
}
|
|
87
|
+
/** Normalize an untrusted recursive custom-field value schema or reject it. */
|
|
88
|
+
function normalizeRuntimeFieldValueSchema(value, depth = 0, ancestors = new Set()) {
|
|
89
|
+
if (!isPlainObject(value) ||
|
|
90
|
+
depth > MAX_RUNTIME_FIELD_VALUE_SCHEMA_DEPTH ||
|
|
91
|
+
ancestors.has(value)) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
ancestors.add(value);
|
|
95
|
+
const schema = value;
|
|
96
|
+
const type = schema.type;
|
|
97
|
+
const enumValues = schema.enum;
|
|
98
|
+
const oneOf = schema.one_of;
|
|
99
|
+
const properties = schema.properties;
|
|
100
|
+
const items = schema.items;
|
|
101
|
+
const required = schema.required;
|
|
102
|
+
const minLength = schema.min_length;
|
|
103
|
+
const minItems = schema.min_items;
|
|
104
|
+
const format = schema.format;
|
|
105
|
+
const additionalProperties = schema.additional_properties;
|
|
106
|
+
if (!RUNTIME_FIELD_VALUE_SCHEMA_SHAPE_VALIDATORS.every((check) => check(schema))) {
|
|
107
|
+
ancestors.delete(value);
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const normalizedProperties = properties === undefined
|
|
111
|
+
? undefined
|
|
112
|
+
: Object.fromEntries(Object.entries(properties).map(([key, entry]) => [
|
|
113
|
+
key,
|
|
114
|
+
normalizeRuntimeFieldValueSchema(entry, depth + 1, ancestors),
|
|
115
|
+
]));
|
|
116
|
+
const normalizedItems = items === undefined
|
|
117
|
+
? undefined
|
|
118
|
+
: normalizeRuntimeFieldValueSchema(items, depth + 1, ancestors);
|
|
119
|
+
const normalizedOneOf = oneOf === undefined
|
|
120
|
+
? undefined
|
|
121
|
+
: oneOf.map((entry) => normalizeRuntimeFieldValueSchema(entry, depth + 1, ancestors));
|
|
122
|
+
const normalizedNestedSchemas = [
|
|
123
|
+
...Object.values(normalizedProperties ?? {}),
|
|
124
|
+
...(items === undefined ? [] : [normalizedItems]),
|
|
125
|
+
...(normalizedOneOf ?? []),
|
|
126
|
+
];
|
|
127
|
+
if (normalizedNestedSchemas.some((entry) => entry === undefined)) {
|
|
128
|
+
ancestors.delete(value);
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
ancestors.delete(value);
|
|
132
|
+
return Object.fromEntries(Object.entries({
|
|
133
|
+
type: type,
|
|
134
|
+
const: Object.hasOwn(schema, "const") ? schema.const : undefined,
|
|
135
|
+
enum: enumValues,
|
|
136
|
+
min_length: minLength,
|
|
137
|
+
min_items: minItems,
|
|
138
|
+
format: format,
|
|
139
|
+
properties: normalizedProperties,
|
|
140
|
+
required: required === undefined
|
|
141
|
+
? undefined
|
|
142
|
+
: [...new Set(required)],
|
|
143
|
+
additional_properties: additionalProperties,
|
|
144
|
+
items: normalizedItems,
|
|
145
|
+
one_of: normalizedOneOf,
|
|
146
|
+
}).filter(([, entry]) => entry !== undefined));
|
|
147
|
+
}
|
|
35
148
|
function normalizeStringList(values) {
|
|
36
149
|
const candidates = Array.isArray(values) ? values : [];
|
|
37
150
|
return [
|
|
@@ -202,6 +315,12 @@ function normalizeRuntimeFieldDefinition(definition) {
|
|
|
202
315
|
})();
|
|
203
316
|
const description = definition.description?.trim();
|
|
204
317
|
const requiredTypes = normalizeStringList(definition.required_types);
|
|
318
|
+
const valueSchema = definition.value_schema === undefined
|
|
319
|
+
? undefined
|
|
320
|
+
: normalizeRuntimeFieldValueSchema(definition.value_schema);
|
|
321
|
+
if (definition.value_schema !== undefined && valueSchema === undefined) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
205
324
|
return {
|
|
206
325
|
key,
|
|
207
326
|
metadata_key: metadataKey,
|
|
@@ -210,11 +329,12 @@ function normalizeRuntimeFieldDefinition(definition) {
|
|
|
210
329
|
description: description && description.length > 0 ? description : undefined,
|
|
211
330
|
type,
|
|
212
331
|
commands,
|
|
213
|
-
repeatable: definition.repeatable === true
|
|
332
|
+
repeatable: [definition.repeatable === true, type === "string_array"].includes(true),
|
|
214
333
|
required: definition.required === true,
|
|
215
334
|
required_on_create: definition.required_on_create === true,
|
|
216
335
|
required_types: requiredTypes,
|
|
217
336
|
allow_unset: definition.allow_unset !== false,
|
|
337
|
+
value_schema: valueSchema,
|
|
218
338
|
};
|
|
219
339
|
}
|
|
220
340
|
function normalizeRuntimeStatusDefinitions(statusesSource) {
|
|
@@ -277,6 +397,7 @@ function serializeRuntimeFieldDefinition(definition) {
|
|
|
277
397
|
? [...definition.required_types]
|
|
278
398
|
: undefined,
|
|
279
399
|
allow_unset: definition.allow_unset === false ? false : undefined,
|
|
400
|
+
value_schema: definition.value_schema,
|
|
280
401
|
};
|
|
281
402
|
}
|
|
282
403
|
function normalizeUnknownFieldPolicy(policy) {
|
|
@@ -691,4 +812,4 @@ export function statusIsTerminal(status, registry) {
|
|
|
691
812
|
return registry.terminal_statuses.has(normalized);
|
|
692
813
|
}
|
|
693
814
|
//# sourceMappingURL=runtime-schema.js.map
|
|
694
|
-
//# debugId=
|
|
815
|
+
//# debugId=88b9179f-569e-5cd6-b67c-c27431961554
|
|
@@ -63,6 +63,16 @@ export interface PmCliErrorContext {
|
|
|
63
63
|
measurement_id?: string;
|
|
64
64
|
/** Assurance measurement source kind involved in a refusal, when known. */
|
|
65
65
|
source_kind?: string;
|
|
66
|
+
/** Source item whose endpoint metadata violated a relationship contract. */
|
|
67
|
+
source_id?: string;
|
|
68
|
+
/** Source item creation time used to evaluate a temporal relationship contract. */
|
|
69
|
+
source_created_at?: string;
|
|
70
|
+
/** Target item whose endpoint metadata violated a relationship contract. */
|
|
71
|
+
target_id?: string;
|
|
72
|
+
/** Target item creation time used to evaluate a temporal relationship contract. */
|
|
73
|
+
target_created_at?: string;
|
|
74
|
+
/** Temporal relationship rule evaluated for the source and target. */
|
|
75
|
+
temporal_order?: string;
|
|
66
76
|
/** Validate or health check selected by an assurance source, when known. */
|
|
67
77
|
check?: string;
|
|
68
78
|
/** Serialization format involved in a parse failure. */
|
|
@@ -87,6 +97,8 @@ export interface PmCliErrorContext {
|
|
|
87
97
|
nextSteps?: string[];
|
|
88
98
|
/** Exact selectors that could not be matched by a lossless removal. */
|
|
89
99
|
unmatched?: string[];
|
|
100
|
+
/** Exact verifier findings that caused an integrity-sensitive operation to refuse. */
|
|
101
|
+
verification_errors?: string[];
|
|
90
102
|
/** Local dependency targets that could not be resolved before mutation. */
|
|
91
103
|
unresolved_targets?: string[];
|
|
92
104
|
/** Available history bounds for a failed point-in-time read or restore target. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Implements the exported pm cli error runtime abstraction for core/shared/errors.ts. */
|
|
2
2
|
|
|
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]="
|
|
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]="c863f07f-428b-5b7f-a5f7-23e7f5fa749a")}catch(e){}}();
|
|
4
4
|
export class PmCliError extends Error {
|
|
5
5
|
/** Value that configures or reports exit code for this contract. */
|
|
6
6
|
exitCode;
|
|
@@ -18,4 +18,4 @@ export class PmCliError extends Error {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=errors.js.map
|
|
21
|
-
//# debugId=
|
|
21
|
+
//# debugId=c863f07f-428b-5b7f-a5f7-23e7f5fa749a
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export declare function nowIso(): string;
|
|
3
3
|
/** Implements check whether timestamp literal for the public runtime surface of this module. */
|
|
4
4
|
export declare function isTimestampLiteral(input: string): boolean;
|
|
5
|
+
/** Return whether a string is a calendar-valid RFC 3339 date-time. */
|
|
6
|
+
export declare function isRfc3339DateTime(input: string): boolean;
|
|
5
7
|
/** Implements compare timestamp strings for the public runtime surface of this module. */
|
|
6
8
|
export declare function compareTimestampStrings(left: string, right: string): number;
|
|
7
9
|
/** Timestamp-bearing record accepted by shared inclusive bound filtering. */
|
package/dist/core/shared/time.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides shared primitives and utilities for Time.
|
|
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]="7887e752-b1b8-5c5e-9dd8-93b41cb757af")}catch(e){}}();
|
|
8
8
|
import { PmCliError } from "./errors.js";
|
|
9
9
|
import { evictOldestMemoEntries } from "./memo.js";
|
|
10
10
|
import { EXIT_CODE } from "./constants.js";
|
|
@@ -15,6 +15,7 @@ const COMPACT_DATE = /^(\d{4})(\d{2})(\d{2})$/;
|
|
|
15
15
|
const COMPACT_DATETIME = /^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i;
|
|
16
16
|
const HYPHEN_TIME = /^(\d{4}-\d{2}-\d{2})[T\s](\d{2})-(\d{2})(?:-(\d{2}))?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i;
|
|
17
17
|
const COMPACT_TIME = /^(\d{4}-\d{2}-\d{2})[T\s](\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i;
|
|
18
|
+
const RFC_3339_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;
|
|
18
19
|
/** Implements now iso for the public runtime surface of this module. */
|
|
19
20
|
export function nowIso() {
|
|
20
21
|
return nextReproducibleTimestamp() ?? new Date().toISOString();
|
|
@@ -23,6 +24,30 @@ export function nowIso() {
|
|
|
23
24
|
export function isTimestampLiteral(input) {
|
|
24
25
|
return Number.isFinite(Date.parse(input));
|
|
25
26
|
}
|
|
27
|
+
/** Return whether a string is a calendar-valid RFC 3339 date-time. */
|
|
28
|
+
export function isRfc3339DateTime(input) {
|
|
29
|
+
const match = RFC_3339_DATE_TIME.exec(input);
|
|
30
|
+
if (!match || !Number.isFinite(Date.parse(input)))
|
|
31
|
+
return false;
|
|
32
|
+
const [, yearRaw, monthRaw, dayRaw, hourRaw, minuteRaw, secondRaw, offsetHourRaw, offsetMinuteRaw,] = match;
|
|
33
|
+
const [year, month, day, hour, minute, second] = [
|
|
34
|
+
yearRaw,
|
|
35
|
+
monthRaw,
|
|
36
|
+
dayRaw,
|
|
37
|
+
hourRaw,
|
|
38
|
+
minuteRaw,
|
|
39
|
+
secondRaw,
|
|
40
|
+
].map(Number);
|
|
41
|
+
return (month >= 1 &&
|
|
42
|
+
month <= 12 &&
|
|
43
|
+
day >= 1 &&
|
|
44
|
+
day <= daysInUtcMonth(year, month - 1) &&
|
|
45
|
+
hour <= 23 &&
|
|
46
|
+
minute <= 59 &&
|
|
47
|
+
second <= 59 &&
|
|
48
|
+
(offsetHourRaw === undefined || Number(offsetHourRaw) <= 23) &&
|
|
49
|
+
(offsetMinuteRaw === undefined || Number(offsetMinuteRaw) <= 59));
|
|
50
|
+
}
|
|
26
51
|
/**
|
|
27
52
|
* Memoized `Date.parse` for {@link compareTimestampStrings}. Sort comparators call it
|
|
28
53
|
* O(n log n) times over a corpus whose timestamp strings repeat heavily, and
|
|
@@ -273,4 +298,4 @@ export const _testOnly = {
|
|
|
273
298
|
isWhitespaceCharacter,
|
|
274
299
|
};
|
|
275
300
|
//# sourceMappingURL=time.js.map
|
|
276
|
-
//# debugId=
|
|
301
|
+
//# debugId=7887e752-b1b8-5c5e-9dd8-93b41cb757af
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Reads and writes tracker storage with format-aware helpers for Item Store.
|
|
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]="d24d61bf-7db8-5f35-8dbc-5ef93ec8220b")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveOnReadHooks, runActiveBeforeMutationHooks, runActiveOnWriteHooks, runActiveServiceOverride, } from "../extensions/index.js";
|
|
@@ -69,6 +69,15 @@ function trackerRootNotDirectoryError(pmRoot) {
|
|
|
69
69
|
],
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
function trackerRootUnreadableError(pmRoot) {
|
|
73
|
+
return new PmCliError(`Tracker root is not readable at ${pmRoot}.`, EXIT_CODE.GENERIC_FAILURE, {
|
|
74
|
+
code: "tracker_root_unreadable",
|
|
75
|
+
reason: "unreadable",
|
|
76
|
+
nextSteps: [
|
|
77
|
+
"Grant read and directory-search permission to the tracker root, then retry the SDK read.",
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
72
81
|
async function assertMissingMetadataRootAncestors(pmRoot) {
|
|
73
82
|
const filesystemRoot = path.parse(path.resolve(pmRoot)).root;
|
|
74
83
|
let ancestor = path.dirname(path.resolve(pmRoot));
|
|
@@ -114,11 +123,28 @@ async function assertItemMetadataRoot(pmRoot) {
|
|
|
114
123
|
if (isErrno(error, "ENOTDIR")) {
|
|
115
124
|
throw trackerRootNotDirectoryError(pmRoot);
|
|
116
125
|
}
|
|
126
|
+
if (isErrno(error, "EACCES") || isErrno(error, "EPERM")) {
|
|
127
|
+
throw trackerRootUnreadableError(pmRoot);
|
|
128
|
+
}
|
|
117
129
|
throw error;
|
|
118
130
|
}
|
|
119
131
|
if (!stats.isDirectory()) {
|
|
120
132
|
throw trackerRootNotDirectoryError(pmRoot);
|
|
121
133
|
}
|
|
134
|
+
if (process.platform !== "win32" &&
|
|
135
|
+
((stats.mode & 0o444) === 0 || (stats.mode & 0o111) === 0)) {
|
|
136
|
+
throw trackerRootUnreadableError(pmRoot);
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const directory = await fs.opendir(pmRoot);
|
|
140
|
+
await directory.close();
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (isErrno(error, "EACCES") || isErrno(error, "EPERM")) {
|
|
144
|
+
throw trackerRootUnreadableError(pmRoot);
|
|
145
|
+
}
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
122
148
|
}
|
|
123
149
|
/** Implements locate item for the public runtime surface of this module. */
|
|
124
150
|
export async function locateItem(pmRoot, rawId, idPrefix = "pm-", preferredFormat, typeToFolder = TYPE_TO_FOLDER) {
|
|
@@ -684,4 +710,4 @@ export async function deleteItem(params) {
|
|
|
684
710
|
}
|
|
685
711
|
}
|
|
686
712
|
//# sourceMappingURL=item-store.js.map
|
|
687
|
-
//# debugId=
|
|
713
|
+
//# debugId=d24d61bf-7db8-5f35-8dbc-5ef93ec8220b
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module sdk/agent/refusal-reachability
|
|
3
|
-
*
|
|
4
|
-
* Verifies real-entrypoint observations against refusal states declared by the
|
|
5
|
-
* generated public error-code catalog.
|
|
6
|
-
*/
|
|
7
1
|
import type { PmErrorCodeContract, PmErrorCodeClass } from "../error-code-catalog.js";
|
|
8
2
|
/** One recorded result from driving a real public entrypoint into a refusal. */
|
|
9
3
|
export interface PmRefusalProbeObservation {
|
|
@@ -37,9 +31,55 @@ export interface PmRefusalReachabilityReport {
|
|
|
37
31
|
findings: PmRefusalReachabilityFinding[];
|
|
38
32
|
}
|
|
39
33
|
/** Recovery-reference kinds emitted by structured refusal envelopes. */
|
|
40
|
-
export declare const PM_RECOVERY_REFERENCE_KINDS: readonly ["suggested_retry", "candidate_command", "example", "next_step"];
|
|
34
|
+
export declare const PM_RECOVERY_REFERENCE_KINDS: readonly ["suggested_retry", "candidate_command", "example", "next_step", "migration_hint", "restore_with"];
|
|
41
35
|
/** Recovery-reference kind emitted by a refusal. */
|
|
42
36
|
export type PmRecoveryReferenceKind = (typeof PM_RECOVERY_REFERENCE_KINDS)[number];
|
|
37
|
+
/** Behavioral promise attached to a recovery reference. */
|
|
38
|
+
export type PmRecoveryReferenceSemantics = "recovery" | "replacement" | "behavior_preserving";
|
|
39
|
+
/** Literal envelope fields recognized as recovery-reference producers. */
|
|
40
|
+
export declare const PM_RECOVERY_REFERENCE_FIELDS: readonly ("restore_with" | "migration_hint" | "migration_hints" | "suggested_retry" | "next_best_command" | "fallback_candidates" | "examples" | "next_steps" | "suggested_next_steps" | "candidate_commands" | "candidate_command" | "example" | "next_step" | "retry_command")[];
|
|
41
|
+
/** One source file supplied to the producer-census analyzer. */
|
|
42
|
+
export interface PmRecoveryProducerSource {
|
|
43
|
+
/** Repository-relative source path. */
|
|
44
|
+
path: string;
|
|
45
|
+
/** Complete source text. */
|
|
46
|
+
content: string;
|
|
47
|
+
}
|
|
48
|
+
/** One literal recovery field emitted from a source location. */
|
|
49
|
+
export interface PmRecoveryProducerLocation {
|
|
50
|
+
/** Repository-relative producer source path. */
|
|
51
|
+
path: string;
|
|
52
|
+
/** One-based source line. */
|
|
53
|
+
line: number;
|
|
54
|
+
/** Literal structured-envelope field. */
|
|
55
|
+
field: (typeof PM_RECOVERY_REFERENCE_FIELDS)[number];
|
|
56
|
+
/** Normalized recovery kind. */
|
|
57
|
+
kind: PmRecoveryReferenceKind;
|
|
58
|
+
}
|
|
59
|
+
/** Producer-census failure that requires a new field contract or producer. */
|
|
60
|
+
export interface PmRecoveryProducerCensusFinding {
|
|
61
|
+
/** Stable finding kind. */
|
|
62
|
+
kind: "invalid_source" | "missing_kind_producer" | "unknown_recovery_field";
|
|
63
|
+
/** Source path or normalized kind. */
|
|
64
|
+
subject: string;
|
|
65
|
+
/** Actionable explanation. */
|
|
66
|
+
detail: string;
|
|
67
|
+
}
|
|
68
|
+
/** Complete literal producer-table census for recovery references. */
|
|
69
|
+
export interface PmRecoveryProducerCensusReport {
|
|
70
|
+
/** Whether every recovery kind has a producer and no unknown fields exist. */
|
|
71
|
+
ok: boolean;
|
|
72
|
+
/** Source files inspected. */
|
|
73
|
+
scanned_file_count: number;
|
|
74
|
+
/** Literal producer locations. */
|
|
75
|
+
producer_count: number;
|
|
76
|
+
/** Stable counts by normalized recovery kind. */
|
|
77
|
+
producer_count_by_kind: Record<PmRecoveryReferenceKind, number>;
|
|
78
|
+
/** Stable producer locations. */
|
|
79
|
+
producers: PmRecoveryProducerLocation[];
|
|
80
|
+
/** Missing-kind or unknown-field findings. */
|
|
81
|
+
findings: PmRecoveryProducerCensusFinding[];
|
|
82
|
+
}
|
|
43
83
|
/** One derived promise that another invocation or command path is reachable. */
|
|
44
84
|
export interface PmRecoveryReferenceObligation {
|
|
45
85
|
/** Stable reference identifier derived from its emitting envelope. */
|
|
@@ -48,6 +88,8 @@ export interface PmRecoveryReferenceObligation {
|
|
|
48
88
|
probe_id: string;
|
|
49
89
|
/** Typed recovery vocabulary rather than prose inference. */
|
|
50
90
|
kind: PmRecoveryReferenceKind;
|
|
91
|
+
/** Whether the reference recovers, replaces, or preserves the original behavior. */
|
|
92
|
+
semantics: PmRecoveryReferenceSemantics;
|
|
51
93
|
/** Exact emitted command or recovery text. */
|
|
52
94
|
value: string;
|
|
53
95
|
}
|
|
@@ -59,6 +101,8 @@ export interface PmRecoveryReferenceObservation {
|
|
|
59
101
|
reachable: boolean;
|
|
60
102
|
/** How the promise was discharged. */
|
|
61
103
|
proof: "executed" | "declared_command_path" | "linked_execution";
|
|
104
|
+
/** Semantics actually demonstrated by the proof. */
|
|
105
|
+
semantics: PmRecoveryReferenceSemantics;
|
|
62
106
|
}
|
|
63
107
|
/** Coverage totals for one emitted recovery-reference kind. */
|
|
64
108
|
export interface PmRecoveryReferenceKindCoverage {
|
|
@@ -74,7 +118,7 @@ export interface PmRecoveryReferenceKindCoverage {
|
|
|
74
118
|
/** One recovery-reference coverage failure. */
|
|
75
119
|
export interface PmRecoveryReferenceFinding {
|
|
76
120
|
/** Stable finding kind for assurance and CI. */
|
|
77
|
-
kind: "duplicate_obligation" | "duplicate_observation" | "missing_observation" | "unreachable_reference" | "undeclared_observation";
|
|
121
|
+
kind: "duplicate_obligation" | "duplicate_observation" | "missing_observation" | "unreachable_reference" | "wrong_semantics" | "undeclared_observation";
|
|
78
122
|
/** Obligation or observation identifier. */
|
|
79
123
|
reference_id: string;
|
|
80
124
|
/** Human-readable mismatch summary. */
|
|
@@ -95,6 +139,10 @@ export interface PmRecoveryReferenceReport {
|
|
|
95
139
|
/** Stable, sorted conformance findings. */
|
|
96
140
|
findings: PmRecoveryReferenceFinding[];
|
|
97
141
|
}
|
|
142
|
+
/** Census syntax-parsed structured-envelope producers without executing source code. */
|
|
143
|
+
export declare function censusPmRecoveryReferenceProducers(sources: readonly PmRecoveryProducerSource[]): PmRecoveryProducerCensusReport;
|
|
144
|
+
/** Derive typed obligations from every recognized recovery field in an emitted envelope. */
|
|
145
|
+
export declare function derivePmRecoveryReferenceObligations(probeId: string, envelope: unknown): PmRecoveryReferenceObligation[];
|
|
98
146
|
/** Compare declared refusal states with real-entrypoint observations. */
|
|
99
147
|
export declare function verifyPmRefusalReachability(catalog: readonly PmErrorCodeContract[], observations: readonly PmRefusalProbeObservation[]): PmRefusalReachabilityReport;
|
|
100
148
|
/** Verify executable and declared-path proof for emitted recovery references. */
|