@unbrained/pm-cli 2026.8.19 → 2026.8.20
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 +19 -0
- package/dist/cli/register-list-query.js +12 -10
- package/dist/cli/register-structured-mutation.d.ts +2 -0
- package/dist/cli/register-structured-mutation.js +29 -6
- package/dist/cli-bundle/bundle-manifest.json +151 -143
- package/dist/cli-bundle/chunks/{chunk-4THEB6PD.js → chunk-2RDVGYWE.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-BHYMXLAE.js → chunk-4GB2LTOQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TOXJM4WA.js → chunk-7BRF2BX2.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +35 -0
- package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-4NRRH7AM.js → chunk-K3EN3LK2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OIOKV6NO.js → chunk-L4LGPBJU.js} +49 -49
- package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +197 -0
- package/dist/cli-bundle/chunks/chunk-TSMWLCHS.js +3 -0
- package/dist/cli-bundle/chunks/chunk-US2ZQW2M.js +77 -0
- package/dist/cli-bundle/chunks/{chunk-QXSH7BLM.js → chunk-XYDDWBZN.js} +2 -2
- package/dist/cli-bundle/chunks/register-list-query-JSAQCVOC.js +11 -0
- package/dist/cli-bundle/chunks/{register-mutation-AUWVCW4M.js → register-mutation-XJPAW63D.js} +20 -20
- package/dist/cli-bundle/chunks/{register-operations-PZQPHXW5.js → register-operations-DSOSB2XQ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-I4LUHGVW.js → register-setup-QUR6QL2C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DKPLYW3L.js → chunk-325UXIO7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5L7M4AI7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EF6ZS5GH.js → chunk-6AHG2YW7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MCZXYZAF.js → chunk-AZBACT5T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-VXDSU5MC.js → chunk-BLJCGGID.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-FUREQLQN.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-US7VEYZG.js → chunk-G3C5ERXG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZBIQQYMI.js → chunk-GXWQBE3T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JDOMQ7VQ.js → chunk-JWKEDZJI.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ESISGDAY.js → chunk-M32HFIQB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EXBCLIBU.js → chunk-OM65KHGF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BJRYFVSH.js → chunk-RIHDMCUM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-TDR5OGG3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ODHQEECS.js → chunk-UGSS4F5X.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +2 -0
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +41 -41
- 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 +31 -31
- 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 +5 -5
- package/dist/core/output/mutation-projection.js +26 -2
- package/dist/core/shared/constants.d.ts +1 -5
- package/dist/core/shared/constants.js +3 -81
- package/dist/core/shared/item-metadata-contract.d.ts +14 -0
- package/dist/core/shared/item-metadata-contract.js +90 -0
- package/dist/core/store/item-store.d.ts +60 -0
- package/dist/core/store/item-store.js +22 -5
- package/dist/sdk/agent/closed-domain-contracts.d.ts +25 -0
- package/dist/sdk/agent/closed-domain-contracts.js +140 -0
- package/dist/sdk/agent/refusal-closure.d.ts +13 -1
- package/dist/sdk/agent/refusal-closure.js +45 -3
- package/dist/sdk/agent/refusal-reachability.d.ts +26 -0
- package/dist/sdk/agent/refusal-reachability.js +26 -2
- package/dist/sdk/agent-capability-contracts.js +6 -11
- package/dist/sdk/cli-contracts/completeness.js +8 -2
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -2
- package/dist/sdk/cli-contracts/enum-contracts.js +16 -6
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +11 -2
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +19 -2
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +105 -5
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts/grammar-contracts.js +5 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +7 -3
- package/dist/sdk/cli-contracts/tool-schema.js +7 -2
- package/dist/sdk/cli-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts.js +4 -4
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/core.d.ts +1 -1
- package/dist/sdk/core.js +3 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +74 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +112 -40
- package/dist/sdk/index.d.ts +5 -3
- package/dist/sdk/index.js +6 -4
- package/dist/sdk/init-agent-guidance.d.ts +5 -3
- package/dist/sdk/init-agent-guidance.js +69 -9
- package/dist/sdk/lifecycle/mcp-actions.d.ts +18 -0
- package/dist/sdk/lifecycle/mcp-actions.js +52 -0
- package/dist/sdk/lifecycle/reopen.d.ts +44 -0
- package/dist/sdk/lifecycle/reopen.js +69 -0
- package/dist/sdk/lifecycle/update.d.ts +31 -0
- package/dist/sdk/lifecycle/update.js +95 -13
- package/dist/sdk/query/get.d.ts +1 -1
- package/dist/sdk/query/get.js +18 -52
- package/dist/sdk/query/list.d.ts +7 -21
- package/dist/sdk/query/list.js +35 -49
- package/dist/sdk/query/projection-contracts.d.ts +33 -0
- package/dist/sdk/query/projection-contracts.js +185 -0
- package/dist/sdk/query/search-contracts.d.ts +2 -1
- package/dist/sdk/query/search-contracts.js +18 -87
- package/dist/sdk/query/search.d.ts +15 -0
- package/dist/sdk/query/search.js +31 -5
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.d.ts +6 -0
- package/dist/sdk/runtime.js +18 -14
- package/dist/sdk/similarity.d.ts +13 -0
- package/dist/sdk/similarity.js +32 -6
- package/docs/COMMANDS.md +13 -1
- package/docs/README.md +1 -0
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +114 -0
- package/docs/SDK.md +10 -2
- package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
- package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
- package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
- package/marketplace.json +2 -2
- package/package.json +5 -5
- 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 +387 -25
- package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +0 -197
- package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +0 -35
- package/dist/cli-bundle/chunks/chunk-OI4XI562.js +0 -5
- package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
- package/dist/cli-bundle/chunks/chunk-YBMRWW4E.js +0 -77
- package/dist/cli-bundle/chunks/register-list-query-Y56KINDU.js +0 -11
- package/dist/cli-bundle/focused-chunks/chunk-34QBIYZI.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PRHY2IMX.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +0 -2
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Provides shared primitives and utilities for Constants.
|
|
5
5
|
*/
|
|
6
6
|
import type { BuiltinItemType, GovernancePreset, GovernanceSettings, PmSettings, RuntimeStatusDefinition, RuntimeWorkflowDefinition } from "../../types/index.js";
|
|
7
|
+
export { ITEM_METADATA_KEY_ORDER, ITEM_PROJECT_CONTEXT_KEYS, } from "./item-metadata-contract.js";
|
|
7
8
|
/**
|
|
8
9
|
* Canonical default lifecycle status model and workflow role mapping.
|
|
9
10
|
*
|
|
@@ -28,10 +29,6 @@ export declare const PM_OPTIONAL_TYPE_SUBDIRS: readonly ["decisions", "events",
|
|
|
28
29
|
export declare const PM_REQUIRED_SUBDIRS: readonly ["", "epics", "features", "tasks", "chores", "issues", "schema", "history", "search", "extensions", "locks", "decisions", "events", "reminders", "milestones", "meetings", "plans"];
|
|
29
30
|
/** Public contract for type to folder, shared by SDK and presentation-layer consumers. */
|
|
30
31
|
export declare const TYPE_TO_FOLDER: Record<BuiltinItemType, string>;
|
|
31
|
-
/** Portable project-context fields shared by storage order and structured mutation IO. */
|
|
32
|
-
export declare const ITEM_PROJECT_CONTEXT_KEYS: readonly ["goal", "objective", "value", "impact", "outcome", "why_now", "parent", "reviewer", "risk", "confidence", "sprint", "release", "blocked_by", "blocked_reason", "unblock_note", "reporter", "severity", "environment", "repro_steps", "resolution", "expected_result", "actual_result"];
|
|
33
|
-
/** Public contract for item metadata key order, shared by SDK and presentation-layer consumers. */
|
|
34
|
-
export declare const ITEM_METADATA_KEY_ORDER: ReadonlyArray<string>;
|
|
35
32
|
type BuiltinGovernancePreset = Exclude<GovernancePreset, "custom">;
|
|
36
33
|
/** Public contract for governance preset defaults, shared by SDK and presentation-layer consumers. */
|
|
37
34
|
export declare const GOVERNANCE_PRESET_DEFAULTS: Record<BuiltinGovernancePreset, Omit<GovernanceSettings, "preset">>;
|
|
@@ -67,4 +64,3 @@ export type TelemetryErrorCategory = "usage" | "validation" | "conflict" | "runt
|
|
|
67
64
|
export declare const TELEMETRY_ERROR_CATEGORY_BY_CODE: Readonly<Record<string, TelemetryErrorCategory>>;
|
|
68
65
|
/** Implements resolve telemetry error category for the public runtime surface of this module. */
|
|
69
66
|
export declare function resolveTelemetryErrorCategory(errorCode: string | undefined): TelemetryErrorCategory;
|
|
70
|
-
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
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]="70cce114-b8a7-5770-ae42-eec473515709")}catch(e){}}();
|
|
3
3
|
import { createDefaultExtensionGovernancePolicy } from "../extensions/extension-types.js";
|
|
4
|
+
export { ITEM_METADATA_KEY_ORDER, ITEM_PROJECT_CONTEXT_KEYS, } from "./item-metadata-contract.js";
|
|
4
5
|
/**
|
|
5
6
|
* Canonical default lifecycle status model and workflow role mapping.
|
|
6
7
|
*
|
|
@@ -93,85 +94,6 @@ export const TYPE_TO_FOLDER = {
|
|
|
93
94
|
Meeting: "meetings",
|
|
94
95
|
Plan: "plans",
|
|
95
96
|
};
|
|
96
|
-
/** Portable project-context fields shared by storage order and structured mutation IO. */
|
|
97
|
-
export const ITEM_PROJECT_CONTEXT_KEYS = [
|
|
98
|
-
"goal",
|
|
99
|
-
"objective",
|
|
100
|
-
"value",
|
|
101
|
-
"impact",
|
|
102
|
-
"outcome",
|
|
103
|
-
"why_now",
|
|
104
|
-
"parent",
|
|
105
|
-
"reviewer",
|
|
106
|
-
"risk",
|
|
107
|
-
"confidence",
|
|
108
|
-
"sprint",
|
|
109
|
-
"release",
|
|
110
|
-
"blocked_by",
|
|
111
|
-
"blocked_reason",
|
|
112
|
-
"unblock_note",
|
|
113
|
-
"reporter",
|
|
114
|
-
"severity",
|
|
115
|
-
"environment",
|
|
116
|
-
"repro_steps",
|
|
117
|
-
"resolution",
|
|
118
|
-
"expected_result",
|
|
119
|
-
"actual_result",
|
|
120
|
-
];
|
|
121
|
-
/** Public contract for item metadata key order, shared by SDK and presentation-layer consumers. */
|
|
122
|
-
export const ITEM_METADATA_KEY_ORDER = [
|
|
123
|
-
"id",
|
|
124
|
-
"title",
|
|
125
|
-
"description",
|
|
126
|
-
"type",
|
|
127
|
-
"pm_format_version",
|
|
128
|
-
"source_type",
|
|
129
|
-
"type_options",
|
|
130
|
-
"status",
|
|
131
|
-
"priority",
|
|
132
|
-
"tags",
|
|
133
|
-
"created_at",
|
|
134
|
-
"updated_at",
|
|
135
|
-
"deadline",
|
|
136
|
-
"reminders",
|
|
137
|
-
"events",
|
|
138
|
-
"closed_at",
|
|
139
|
-
"completed_at",
|
|
140
|
-
"assignee",
|
|
141
|
-
"claim_principal",
|
|
142
|
-
"source_owner",
|
|
143
|
-
"author",
|
|
144
|
-
"estimated_minutes",
|
|
145
|
-
"acceptance_criteria",
|
|
146
|
-
"design",
|
|
147
|
-
"external_ref",
|
|
148
|
-
"definition_of_ready",
|
|
149
|
-
"order",
|
|
150
|
-
...ITEM_PROJECT_CONTEXT_KEYS,
|
|
151
|
-
"affected_version",
|
|
152
|
-
"fixed_version",
|
|
153
|
-
"component",
|
|
154
|
-
"regression",
|
|
155
|
-
"customer_impact",
|
|
156
|
-
"dependencies",
|
|
157
|
-
"comments",
|
|
158
|
-
"notes",
|
|
159
|
-
"learnings",
|
|
160
|
-
"files",
|
|
161
|
-
"tests",
|
|
162
|
-
"test_runs",
|
|
163
|
-
"docs",
|
|
164
|
-
"close_reason",
|
|
165
|
-
"duplicate_of",
|
|
166
|
-
"plan_mode",
|
|
167
|
-
"plan_scope",
|
|
168
|
-
"plan_harness",
|
|
169
|
-
"plan_resume_context",
|
|
170
|
-
"plan_validation",
|
|
171
|
-
"plan_decisions",
|
|
172
|
-
"plan_discoveries",
|
|
173
|
-
"plan_steps",
|
|
174
|
-
];
|
|
175
97
|
/** Public contract for governance preset defaults, shared by SDK and presentation-layer consumers. */
|
|
176
98
|
export const GOVERNANCE_PRESET_DEFAULTS = {
|
|
177
99
|
minimal: {
|
|
@@ -480,4 +402,4 @@ export function resolveTelemetryErrorCategory(errorCode) {
|
|
|
480
402
|
return "unknown";
|
|
481
403
|
}
|
|
482
404
|
//# sourceMappingURL=constants.js.map
|
|
483
|
-
//# debugId=
|
|
405
|
+
//# debugId=70cce114-b8a7-5770-ae42-eec473515709
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/shared/item-metadata-contract
|
|
3
|
+
*
|
|
4
|
+
* Declares the dependency-free canonical item metadata vocabulary shared by
|
|
5
|
+
* storage, query projections, generated contracts, and package consumers.
|
|
6
|
+
*/
|
|
7
|
+
/** Portable project-context fields shared by storage order and structured mutation IO. */
|
|
8
|
+
export declare const ITEM_PROJECT_CONTEXT_KEYS: readonly ["goal", "objective", "value", "impact", "outcome", "why_now", "parent", "reviewer", "risk", "confidence", "sprint", "release", "blocked_by", "blocked_reason", "unblock_note", "reporter", "severity", "environment", "repro_steps", "resolution", "expected_result", "actual_result"];
|
|
9
|
+
declare const ITEM_METADATA_KEY_ORDER_VALUES: readonly ["id", "title", "description", "type", "pm_format_version", "source_type", "type_options", "status", "priority", "tags", "created_at", "updated_at", "deadline", "reminders", "events", "closed_at", "completed_at", "assignee", "claim_principal", "source_owner", "author", "estimated_minutes", "acceptance_criteria", "design", "external_ref", "definition_of_ready", "order", "goal", "objective", "value", "impact", "outcome", "why_now", "parent", "reviewer", "risk", "confidence", "sprint", "release", "blocked_by", "blocked_reason", "unblock_note", "reporter", "severity", "environment", "repro_steps", "resolution", "expected_result", "actual_result", "affected_version", "fixed_version", "component", "regression", "customer_impact", "dependencies", "comments", "notes", "learnings", "files", "tests", "test_runs", "docs", "close_reason", "duplicate_of", "plan_mode", "plan_scope", "plan_harness", "plan_resume_context", "plan_validation", "plan_decisions", "plan_discoveries", "plan_steps"];
|
|
10
|
+
/** Literal union of every canonical built-in item metadata key. */
|
|
11
|
+
export type ItemMetadataKey = (typeof ITEM_METADATA_KEY_ORDER_VALUES)[number];
|
|
12
|
+
/** Public contract for item metadata key order, shared by SDK and presentation-layer consumers. */
|
|
13
|
+
export declare const ITEM_METADATA_KEY_ORDER: ReadonlyArray<string>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/shared/item-metadata-contract
|
|
3
|
+
*
|
|
4
|
+
* Declares the dependency-free canonical item metadata vocabulary shared by
|
|
5
|
+
* storage, query projections, generated contracts, and package consumers.
|
|
6
|
+
*/
|
|
7
|
+
/** Portable project-context fields shared by storage order and structured mutation IO. */
|
|
8
|
+
|
|
9
|
+
!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]="27c5eac3-4580-5f6f-8ae9-b04d0281766d")}catch(e){}}();
|
|
10
|
+
export const ITEM_PROJECT_CONTEXT_KEYS = [
|
|
11
|
+
"goal",
|
|
12
|
+
"objective",
|
|
13
|
+
"value",
|
|
14
|
+
"impact",
|
|
15
|
+
"outcome",
|
|
16
|
+
"why_now",
|
|
17
|
+
"parent",
|
|
18
|
+
"reviewer",
|
|
19
|
+
"risk",
|
|
20
|
+
"confidence",
|
|
21
|
+
"sprint",
|
|
22
|
+
"release",
|
|
23
|
+
"blocked_by",
|
|
24
|
+
"blocked_reason",
|
|
25
|
+
"unblock_note",
|
|
26
|
+
"reporter",
|
|
27
|
+
"severity",
|
|
28
|
+
"environment",
|
|
29
|
+
"repro_steps",
|
|
30
|
+
"resolution",
|
|
31
|
+
"expected_result",
|
|
32
|
+
"actual_result",
|
|
33
|
+
];
|
|
34
|
+
const ITEM_METADATA_KEY_ORDER_VALUES = [
|
|
35
|
+
"id",
|
|
36
|
+
"title",
|
|
37
|
+
"description",
|
|
38
|
+
"type",
|
|
39
|
+
"pm_format_version",
|
|
40
|
+
"source_type",
|
|
41
|
+
"type_options",
|
|
42
|
+
"status",
|
|
43
|
+
"priority",
|
|
44
|
+
"tags",
|
|
45
|
+
"created_at",
|
|
46
|
+
"updated_at",
|
|
47
|
+
"deadline",
|
|
48
|
+
"reminders",
|
|
49
|
+
"events",
|
|
50
|
+
"closed_at",
|
|
51
|
+
"completed_at",
|
|
52
|
+
"assignee",
|
|
53
|
+
"claim_principal",
|
|
54
|
+
"source_owner",
|
|
55
|
+
"author",
|
|
56
|
+
"estimated_minutes",
|
|
57
|
+
"acceptance_criteria",
|
|
58
|
+
"design",
|
|
59
|
+
"external_ref",
|
|
60
|
+
"definition_of_ready",
|
|
61
|
+
"order",
|
|
62
|
+
...ITEM_PROJECT_CONTEXT_KEYS,
|
|
63
|
+
"affected_version",
|
|
64
|
+
"fixed_version",
|
|
65
|
+
"component",
|
|
66
|
+
"regression",
|
|
67
|
+
"customer_impact",
|
|
68
|
+
"dependencies",
|
|
69
|
+
"comments",
|
|
70
|
+
"notes",
|
|
71
|
+
"learnings",
|
|
72
|
+
"files",
|
|
73
|
+
"tests",
|
|
74
|
+
"test_runs",
|
|
75
|
+
"docs",
|
|
76
|
+
"close_reason",
|
|
77
|
+
"duplicate_of",
|
|
78
|
+
"plan_mode",
|
|
79
|
+
"plan_scope",
|
|
80
|
+
"plan_harness",
|
|
81
|
+
"plan_resume_context",
|
|
82
|
+
"plan_validation",
|
|
83
|
+
"plan_decisions",
|
|
84
|
+
"plan_discoveries",
|
|
85
|
+
"plan_steps",
|
|
86
|
+
];
|
|
87
|
+
/** Public contract for item metadata key order, shared by SDK and presentation-layer consumers. */
|
|
88
|
+
export const ITEM_METADATA_KEY_ORDER = ITEM_METADATA_KEY_ORDER_VALUES;
|
|
89
|
+
//# sourceMappingURL=item-metadata-contract.js.map
|
|
90
|
+
//# debugId=27c5eac3-4580-5f6f-8ae9-b04d0281766d
|
|
@@ -50,6 +50,66 @@ declare function buildDidYouMeanSuggestions(pmRoot: string, badId: string, idPre
|
|
|
50
50
|
/** Implements build item not found error for the public runtime surface of this module. */
|
|
51
51
|
export declare function buildItemNotFoundError(pmRoot: string, badId: string, idPrefix: string, typeToFolder: Record<string, string>): Promise<PmCliError>;
|
|
52
52
|
declare function bypassesAssigneeConflict(op: string, bypassAssigneeConflict?: boolean): boolean;
|
|
53
|
+
interface ItemMutationResult {
|
|
54
|
+
item: ItemMetadata;
|
|
55
|
+
body: string;
|
|
56
|
+
changedFields: string[];
|
|
57
|
+
warnings: string[];
|
|
58
|
+
}
|
|
59
|
+
interface ItemMutationParams {
|
|
60
|
+
pmRoot: string;
|
|
61
|
+
settings: PmSettings;
|
|
62
|
+
id: string;
|
|
63
|
+
op: string;
|
|
64
|
+
author: string;
|
|
65
|
+
message?: string;
|
|
66
|
+
/** Structured immutable context attached to the appended history entry. */
|
|
67
|
+
historyContext?: Record<string, unknown>;
|
|
68
|
+
force?: boolean;
|
|
69
|
+
bypassAssigneeConflict?: boolean;
|
|
70
|
+
skipNoop?: boolean;
|
|
71
|
+
extensionFieldNames?: readonly string[];
|
|
72
|
+
typeToFolder?: Record<string, string>;
|
|
73
|
+
mutate: (document: ItemDocument) => {
|
|
74
|
+
changedFields: string[];
|
|
75
|
+
warnings?: string[];
|
|
76
|
+
} | Promise<{
|
|
77
|
+
changedFields: string[];
|
|
78
|
+
warnings?: string[];
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
81
|
+
/** Mutate one item while attaching structured context to its immutable history event. */
|
|
82
|
+
export declare function mutateItemWithHistoryContext(params: {
|
|
83
|
+
pmRoot: string;
|
|
84
|
+
settings: PmSettings;
|
|
85
|
+
id: string;
|
|
86
|
+
op: string;
|
|
87
|
+
author: string;
|
|
88
|
+
message?: string;
|
|
89
|
+
/** Structured immutable context attached to the appended history entry. */
|
|
90
|
+
historyContext?: Record<string, unknown>;
|
|
91
|
+
force?: boolean;
|
|
92
|
+
bypassAssigneeConflict?: boolean;
|
|
93
|
+
skipNoop?: boolean;
|
|
94
|
+
extensionFieldNames?: readonly string[];
|
|
95
|
+
typeToFolder?: Record<string, string>;
|
|
96
|
+
mutate: (document: ItemDocument) => {
|
|
97
|
+
changedFields: string[];
|
|
98
|
+
warnings?: string[];
|
|
99
|
+
} | Promise<{
|
|
100
|
+
changedFields: string[];
|
|
101
|
+
warnings?: string[];
|
|
102
|
+
}>;
|
|
103
|
+
}): Promise<{
|
|
104
|
+
item: ItemMetadata;
|
|
105
|
+
body: string;
|
|
106
|
+
changedFields: string[];
|
|
107
|
+
warnings: string[];
|
|
108
|
+
}>;
|
|
109
|
+
/** Mutate one item while resolving structured history context after its locked mutation. */
|
|
110
|
+
export declare function mutateItemWithHistoryContextResolver(params: Omit<ItemMutationParams, "historyContext"> & {
|
|
111
|
+
resolveHistoryContext: () => Record<string, unknown> | undefined;
|
|
112
|
+
}): Promise<ItemMutationResult>;
|
|
53
113
|
/** Implements mutate item for the public runtime surface of this module. */
|
|
54
114
|
export declare function mutateItem(params: {
|
|
55
115
|
pmRoot: string;
|
|
@@ -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]="b6db139b-7646-58f9-96af-d3c65bf7ddf6")}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";
|
|
@@ -20,7 +20,7 @@ import { acquireLock } from "../lock/lock.js";
|
|
|
20
20
|
import { writeFileAtomic } from "../fs/fs-utils.js";
|
|
21
21
|
import { normalizeItemId, normalizeRawItemId } from "../item/id.js";
|
|
22
22
|
import { acquireItemMetadataDerivedIndexLock, listAllDocumentCandidatesCached, listAllDocumentsCached, listAllDocumentsCachedLight, refreshItemMetadataDerivedIndex, } from "./item-metadata-cache.js";
|
|
23
|
-
import { getHistoryPath, getItemPath, ITEM_FILE_EXTENSIONS
|
|
23
|
+
import { getHistoryPath, getItemPath, ITEM_FILE_EXTENSIONS } from "./paths.js";
|
|
24
24
|
import { resolveGovernanceKnobs } from "./settings.js";
|
|
25
25
|
import { resolveClaimPrincipal } from "../shared/author.js";
|
|
26
26
|
import { nowIso } from "../shared/time.js";
|
|
@@ -377,8 +377,7 @@ async function rollbackMutatedItemWrite(params) {
|
|
|
377
377
|
}
|
|
378
378
|
await writeFileAtomic(params.originalItemPath, params.originalRaw);
|
|
379
379
|
}
|
|
380
|
-
|
|
381
|
-
export async function mutateItem(params) {
|
|
380
|
+
async function mutateItemWithDeferredHistoryContext(params) {
|
|
382
381
|
const prepared = await prepareLockedItem({
|
|
383
382
|
pmRoot: params.pmRoot,
|
|
384
383
|
settings: params.settings,
|
|
@@ -409,6 +408,7 @@ export async function mutateItem(params) {
|
|
|
409
408
|
warnings: [...parseWarnings, ...(mutation.warnings ?? [])],
|
|
410
409
|
};
|
|
411
410
|
}
|
|
411
|
+
const historyContext = params.resolveHistoryContext?.();
|
|
412
412
|
mutableDocument.metadata.updated_at = nowIso();
|
|
413
413
|
const afterDocument = canonicalDocument(mutableDocument, {
|
|
414
414
|
schema: params.settings.schema,
|
|
@@ -469,6 +469,7 @@ export async function mutateItem(params) {
|
|
|
469
469
|
before: beforeDocument,
|
|
470
470
|
after: afterDocument,
|
|
471
471
|
message: params.message,
|
|
472
|
+
context: historyContext,
|
|
472
473
|
});
|
|
473
474
|
try {
|
|
474
475
|
await appendHistoryEntry(historyPath, entry);
|
|
@@ -547,6 +548,22 @@ export async function mutateItem(params) {
|
|
|
547
548
|
await releaseLock();
|
|
548
549
|
}
|
|
549
550
|
}
|
|
551
|
+
/** Mutate one item while attaching structured context to its immutable history event. */
|
|
552
|
+
export async function mutateItemWithHistoryContext(params) {
|
|
553
|
+
const { historyContext, ...mutationParams } = params;
|
|
554
|
+
return mutateItemWithDeferredHistoryContext({
|
|
555
|
+
...mutationParams,
|
|
556
|
+
resolveHistoryContext: () => historyContext,
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
/** Mutate one item while resolving structured history context after its locked mutation. */
|
|
560
|
+
export async function mutateItemWithHistoryContextResolver(params) {
|
|
561
|
+
return mutateItemWithDeferredHistoryContext(params);
|
|
562
|
+
}
|
|
563
|
+
/** Mutate one item through the compatibility overload while preserving transactional storage and immutable history semantics. */
|
|
564
|
+
export async function mutateItem(params) {
|
|
565
|
+
return mutateItemWithDeferredHistoryContext(params);
|
|
566
|
+
}
|
|
550
567
|
/** Public contract for item store test only, shared by SDK and presentation-layer consumers. */
|
|
551
568
|
export const itemStoreTestOnly = {
|
|
552
569
|
appendWarning,
|
|
@@ -710,4 +727,4 @@ export async function deleteItem(params) {
|
|
|
710
727
|
}
|
|
711
728
|
}
|
|
712
729
|
//# sourceMappingURL=item-store.js.map
|
|
713
|
-
//# debugId=
|
|
730
|
+
//# debugId=b6db139b-7646-58f9-96af-d3c65bf7ddf6
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** A closed-domain refusal that can be executed and recovered automatically. */
|
|
2
|
+
export interface PmClosedDomainContract {
|
|
3
|
+
/** Stable assurance identity. */
|
|
4
|
+
probe_id: string;
|
|
5
|
+
/** Public command accepting the constrained flag. */
|
|
6
|
+
command: string;
|
|
7
|
+
/** Constrained option spelling. */
|
|
8
|
+
flag: string;
|
|
9
|
+
/** Invalid token used to prove the refusal path. */
|
|
10
|
+
rejected_value: string;
|
|
11
|
+
/** Exact argv that must refuse the invalid token. */
|
|
12
|
+
refusal_args: readonly string[];
|
|
13
|
+
/** Complete stable core domain accepted by the command. */
|
|
14
|
+
allowed_values: readonly string[];
|
|
15
|
+
/** Exact argv expected in the refusal's executable recovery. */
|
|
16
|
+
suggested_retry_args: readonly string[];
|
|
17
|
+
/** Stable machine-readable error code that owns the refusal. */
|
|
18
|
+
error_code: "projection_options_mutually_exclusive" | "unknown_context_intent" | "unknown_field_projection";
|
|
19
|
+
/** Whether a complete accepted-value domain is required in the refusal. */
|
|
20
|
+
allowed_values_required?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Return the complete stable core refusal corpus shared by every public surface. */
|
|
23
|
+
export declare function listCoreClosedDomainContracts(): PmClosedDomainContract[];
|
|
24
|
+
/** Render a compact but complete core-domain description for command help. */
|
|
25
|
+
export declare function renderPmClosedDomainHelp(command: string, flag: "--fields" | "--for"): string;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/agent/closed-domain-contracts
|
|
3
|
+
*
|
|
4
|
+
* Declares executable closed-domain refusals once for SDK consumers, CLI help,
|
|
5
|
+
* and repository assurance. Runtime schema fields can extend field domains
|
|
6
|
+
* without changing the stable core corpus.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
!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]="35d4f3d7-7ec2-5a8b-bd96-f7e73c658737")}catch(e){}}();
|
|
10
|
+
import { PM_CONTEXT_INTENT_CONTRACTS } from "../context-intent-contracts.js";
|
|
11
|
+
import { LIST_COMMAND_DEFAULT_PROJECTIONS, listGetProjectionFields, listListProjectionFields, listSearchProjectionFields, } from "../query/projection-contracts.js";
|
|
12
|
+
const REJECTED_INTENT = "not-a-declared-intent";
|
|
13
|
+
const REJECTED_FIELD = "not-a-declared-field";
|
|
14
|
+
/** Return the complete stable core refusal corpus shared by every public surface. */
|
|
15
|
+
export function listCoreClosedDomainContracts() {
|
|
16
|
+
const positionalArguments = {
|
|
17
|
+
get: ["pm-domain"],
|
|
18
|
+
search: ["Domain query"],
|
|
19
|
+
};
|
|
20
|
+
const intentContracts = [
|
|
21
|
+
...new Set(PM_CONTEXT_INTENT_CONTRACTS.map(({ command }) => command)),
|
|
22
|
+
].map((command) => {
|
|
23
|
+
const commandContracts = PM_CONTEXT_INTENT_CONTRACTS.filter((candidate) => candidate.command === command);
|
|
24
|
+
const contract = commandContracts[0];
|
|
25
|
+
const positionals = positionalArguments[contract.command] ?? [];
|
|
26
|
+
return {
|
|
27
|
+
probe_id: `${contract.command}-invalid-intent`,
|
|
28
|
+
command: contract.command,
|
|
29
|
+
flag: "--for",
|
|
30
|
+
rejected_value: REJECTED_INTENT,
|
|
31
|
+
refusal_args: [
|
|
32
|
+
contract.command,
|
|
33
|
+
...positionals,
|
|
34
|
+
"--for",
|
|
35
|
+
REJECTED_INTENT,
|
|
36
|
+
],
|
|
37
|
+
allowed_values: commandContracts.map(({ intent }) => intent).sort(),
|
|
38
|
+
suggested_retry_args: [
|
|
39
|
+
contract.command,
|
|
40
|
+
...positionals,
|
|
41
|
+
"--for",
|
|
42
|
+
contract.intent,
|
|
43
|
+
],
|
|
44
|
+
error_code: "unknown_context_intent",
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const listFields = listListProjectionFields();
|
|
48
|
+
const listFieldContracts = Object.keys(LIST_COMMAND_DEFAULT_PROJECTIONS).map((command) => ({
|
|
49
|
+
probe_id: `${command}-invalid-field`,
|
|
50
|
+
command,
|
|
51
|
+
flag: "--fields",
|
|
52
|
+
rejected_value: REJECTED_FIELD,
|
|
53
|
+
refusal_args: [command, "--fields", REJECTED_FIELD],
|
|
54
|
+
allowed_values: listFields,
|
|
55
|
+
suggested_retry_args: [
|
|
56
|
+
command,
|
|
57
|
+
"--fields",
|
|
58
|
+
"id,title,status",
|
|
59
|
+
"--limit",
|
|
60
|
+
"10",
|
|
61
|
+
],
|
|
62
|
+
error_code: "unknown_field_projection",
|
|
63
|
+
}));
|
|
64
|
+
const contracts = [
|
|
65
|
+
...intentContracts,
|
|
66
|
+
...listFieldContracts,
|
|
67
|
+
{
|
|
68
|
+
probe_id: "get-invalid-field",
|
|
69
|
+
command: "get",
|
|
70
|
+
flag: "--fields",
|
|
71
|
+
rejected_value: REJECTED_FIELD,
|
|
72
|
+
refusal_args: ["get", "pm-domain", "--fields", REJECTED_FIELD],
|
|
73
|
+
allowed_values: listGetProjectionFields(),
|
|
74
|
+
suggested_retry_args: ["get", "pm-domain", "--fields", "id,title,status"],
|
|
75
|
+
error_code: "unknown_field_projection",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
probe_id: "list-mutually-exclusive-projection",
|
|
79
|
+
command: "list",
|
|
80
|
+
flag: "--projection",
|
|
81
|
+
rejected_value: "--brief+--full",
|
|
82
|
+
refusal_args: ["list", "--brief", "--full"],
|
|
83
|
+
allowed_values: [],
|
|
84
|
+
suggested_retry_args: ["list", "--brief"],
|
|
85
|
+
error_code: "projection_options_mutually_exclusive",
|
|
86
|
+
allowed_values_required: false,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
probe_id: "get-mutually-exclusive-projection",
|
|
90
|
+
command: "get",
|
|
91
|
+
flag: "--projection",
|
|
92
|
+
rejected_value: "--full+--fields",
|
|
93
|
+
refusal_args: ["get", "pm-domain", "--full", "--fields", "id"],
|
|
94
|
+
allowed_values: [],
|
|
95
|
+
suggested_retry_args: ["get", "pm-domain", "--full"],
|
|
96
|
+
error_code: "projection_options_mutually_exclusive",
|
|
97
|
+
allowed_values_required: false,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
probe_id: "search-mutually-exclusive-projection",
|
|
101
|
+
command: "search",
|
|
102
|
+
flag: "--projection",
|
|
103
|
+
rejected_value: "--full+--fields",
|
|
104
|
+
refusal_args: ["search", "Domain query", "--full", "--fields", "id"],
|
|
105
|
+
allowed_values: [],
|
|
106
|
+
suggested_retry_args: ["search", "Domain query", "--full"],
|
|
107
|
+
error_code: "projection_options_mutually_exclusive",
|
|
108
|
+
allowed_values_required: false,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
probe_id: "search-invalid-field",
|
|
112
|
+
command: "search",
|
|
113
|
+
flag: "--fields",
|
|
114
|
+
rejected_value: REJECTED_FIELD,
|
|
115
|
+
refusal_args: ["search", "Domain query", "--fields", REJECTED_FIELD],
|
|
116
|
+
allowed_values: listSearchProjectionFields(),
|
|
117
|
+
suggested_retry_args: [
|
|
118
|
+
"search",
|
|
119
|
+
"Domain query",
|
|
120
|
+
"--fields",
|
|
121
|
+
"id,title,status,score",
|
|
122
|
+
],
|
|
123
|
+
error_code: "unknown_field_projection",
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
return contracts.sort((left, right) => left.probe_id.localeCompare(right.probe_id));
|
|
127
|
+
}
|
|
128
|
+
/** Render a compact but complete core-domain description for command help. */
|
|
129
|
+
export function renderPmClosedDomainHelp(command, flag) {
|
|
130
|
+
const contract = listCoreClosedDomainContracts().find((candidate) => candidate.command === command && candidate.flag === flag);
|
|
131
|
+
if (!contract)
|
|
132
|
+
return "No stable core values are declared.";
|
|
133
|
+
const canonicalValues = contract.allowed_values.filter((value) => !value.startsWith("item."));
|
|
134
|
+
const runtimeSuffix = flag === "--fields"
|
|
135
|
+
? " item.<field> aliases and configured runtime metadata fields are also accepted."
|
|
136
|
+
: " Configured package and workspace intents may extend this domain.";
|
|
137
|
+
return `Allowed core values: ${canonicalValues.join("|")}.${runtimeSuffix}`;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=closed-domain-contracts.js.map
|
|
140
|
+
//# debugId=35d4f3d7-7ec2-5a8b-bd96-f7e73c658737
|
|
@@ -10,15 +10,27 @@ export interface PmRefusalClosureObservation {
|
|
|
10
10
|
rejected_value: string;
|
|
11
11
|
/** Complete accepted domain emitted by the refusal. */
|
|
12
12
|
allowed_values: readonly string[];
|
|
13
|
+
/** Stable error code emitted by the refusal. */
|
|
14
|
+
error_code?: string;
|
|
15
|
+
/** Contract-owned error code required for this refusal. */
|
|
16
|
+
expected_error_code?: string;
|
|
17
|
+
/** Contract-owned complete accepted domain. */
|
|
18
|
+
expected_allowed_values?: readonly string[];
|
|
19
|
+
/** Whether an accepted-value domain is required for this refusal class. */
|
|
20
|
+
allowed_values_required?: boolean;
|
|
13
21
|
/** Exact command emitted for recovery. */
|
|
14
22
|
suggested_retry: string;
|
|
23
|
+
/** Shell-free argv emitted for safe programmatic recovery. */
|
|
24
|
+
suggested_retry_args?: readonly string[];
|
|
25
|
+
/** Contract-owned argv required for deterministic recovery. */
|
|
26
|
+
expected_suggested_retry_args?: readonly string[];
|
|
15
27
|
/** Whether executing the advertised retry succeeded. */
|
|
16
28
|
retry_succeeded: boolean;
|
|
17
29
|
}
|
|
18
30
|
/** One missing or contradictory recovery primitive. */
|
|
19
31
|
export interface PmRefusalClosureFinding {
|
|
20
32
|
/** Stable finding code. */
|
|
21
|
-
code: "accepted_rejected_value" | "duplicate_probe" | "empty_corpus" | "missing_allowed_values" | "missing_suggested_retry" | "non_refusal_exit" | "retry_failed";
|
|
33
|
+
code: "accepted_rejected_value" | "duplicate_probe" | "error_code_mismatch" | "empty_corpus" | "incomplete_allowed_values" | "missing_allowed_values" | "missing_suggested_retry_args" | "missing_suggested_retry" | "non_refusal_exit" | "suggested_retry_args_mismatch" | "retry_failed";
|
|
22
34
|
/** Stable corpus identifier. */
|
|
23
35
|
probe_id: string;
|
|
24
36
|
/** Actionable mismatch detail. */
|
|
@@ -5,8 +5,48 @@
|
|
|
5
5
|
* an agent to recover without another discovery round trip.
|
|
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]="0ec8c375-e58e-5ce4-b0aa-8a8a4dfa0778")}catch(e){}}();
|
|
9
9
|
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
10
|
+
/** Compare a refusal with its optional SDK-owned exact contract. */
|
|
11
|
+
function listContractObservationFindings(observation) {
|
|
12
|
+
return [
|
|
13
|
+
observation.expected_error_code !== undefined &&
|
|
14
|
+
observation.error_code !== observation.expected_error_code
|
|
15
|
+
? {
|
|
16
|
+
code: "error_code_mismatch",
|
|
17
|
+
probe_id: observation.probe_id,
|
|
18
|
+
detail: `Expected error code ${observation.expected_error_code}, received ${observation.error_code ?? "<missing>"}.`,
|
|
19
|
+
}
|
|
20
|
+
: undefined,
|
|
21
|
+
observation.expected_allowed_values !== undefined &&
|
|
22
|
+
JSON.stringify([...observation.allowed_values].sort()) !==
|
|
23
|
+
JSON.stringify([...observation.expected_allowed_values].sort())
|
|
24
|
+
? {
|
|
25
|
+
code: "incomplete_allowed_values",
|
|
26
|
+
probe_id: observation.probe_id,
|
|
27
|
+
detail: "The refusal's accepted domain differs from the SDK-owned domain contract.",
|
|
28
|
+
}
|
|
29
|
+
: undefined,
|
|
30
|
+
observation.expected_suggested_retry_args !== undefined &&
|
|
31
|
+
(observation.suggested_retry_args?.length ?? 0) === 0
|
|
32
|
+
? {
|
|
33
|
+
code: "missing_suggested_retry_args",
|
|
34
|
+
probe_id: observation.probe_id,
|
|
35
|
+
detail: "The refusal omitted shell-free suggested retry arguments.",
|
|
36
|
+
}
|
|
37
|
+
: undefined,
|
|
38
|
+
observation.expected_suggested_retry_args !== undefined &&
|
|
39
|
+
(observation.suggested_retry_args?.length ?? 0) > 0 &&
|
|
40
|
+
JSON.stringify(observation.suggested_retry_args) !==
|
|
41
|
+
JSON.stringify(observation.expected_suggested_retry_args)
|
|
42
|
+
? {
|
|
43
|
+
code: "suggested_retry_args_mismatch",
|
|
44
|
+
probe_id: observation.probe_id,
|
|
45
|
+
detail: "The refusal's suggested retry arguments differ from the SDK-owned contract.",
|
|
46
|
+
}
|
|
47
|
+
: undefined,
|
|
48
|
+
];
|
|
49
|
+
}
|
|
10
50
|
/** Return every closure defect contributed by one unique observation. */
|
|
11
51
|
function listObservationFindings(observation) {
|
|
12
52
|
return [
|
|
@@ -17,7 +57,8 @@ function listObservationFindings(observation) {
|
|
|
17
57
|
detail: `${observation.entrypoint} returned exit code ${observation.exit_code}; a structured usage refusal must return ${EXIT_CODE.USAGE}.`,
|
|
18
58
|
}
|
|
19
59
|
: undefined,
|
|
20
|
-
observation.
|
|
60
|
+
observation.allowed_values_required !== false &&
|
|
61
|
+
observation.allowed_values.length === 0
|
|
21
62
|
? {
|
|
22
63
|
code: "missing_allowed_values",
|
|
23
64
|
probe_id: observation.probe_id,
|
|
@@ -45,6 +86,7 @@ function listObservationFindings(observation) {
|
|
|
45
86
|
detail: "The advertised suggested retry did not succeed.",
|
|
46
87
|
}
|
|
47
88
|
: undefined,
|
|
89
|
+
...listContractObservationFindings(observation),
|
|
48
90
|
];
|
|
49
91
|
}
|
|
50
92
|
/** Score structured closed-domain refusals and executable retries. */
|
|
@@ -89,4 +131,4 @@ export function scorePmRefusalClosure(observations) {
|
|
|
89
131
|
};
|
|
90
132
|
}
|
|
91
133
|
//# sourceMappingURL=refusal-closure.js.map
|
|
92
|
-
//# debugId=
|
|
134
|
+
//# debugId=0ec8c375-e58e-5ce4-b0aa-8a8a4dfa0778
|