@unbrained/pm-cli 2026.8.18 → 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 +35 -2
- package/dist/cli/error-guidance.js +3 -2
- package/dist/cli/help-content.js +32 -13
- package/dist/cli/help-json-payload.d.ts +15 -0
- package/dist/cli/help-json-payload.js +101 -23
- package/dist/cli/main.js +6 -2
- package/dist/cli/register-list-query.js +18 -13
- package/dist/cli/register-mutation.js +8 -8
- package/dist/cli/register-operations.js +6 -6
- 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-UYCLQVL2.js → chunk-2RDVGYWE.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-BSK2IN3C.js → chunk-4GB2LTOQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RZQTVMRQ.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-K3EN3LK2.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-YRGOLZA7.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-5UZZAJKR.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-XJPAW63D.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-DSOSB2XQ.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-PPPEF3SN.js → register-setup-QUR6QL2C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-325UXIO7.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-5L7M4AI7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ODOVCP45.js → chunk-6AHG2YW7.js} +44 -44
- package/dist/cli-bundle/focused-chunks/chunk-AZBACT5T.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TN4AE665.js → chunk-BLJCGGID.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-FUREQLQN.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M62NO7EI.js → chunk-G3C5ERXG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-K43KKAFS.js → chunk-GXWQBE3T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UI6AJ5TD.js → chunk-JWKEDZJI.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EX6MKP2X.js → chunk-M32HFIQB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EUEGXZ2A.js → chunk-OM65KHGF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-V5XTGLK7.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-UGSS4F5X.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.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 +2 -1
- 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 +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 +5 -4
- 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/errors.d.ts +2 -0
- package/dist/core/shared/errors.js +2 -2
- 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 +53 -0
- package/dist/sdk/agent/refusal-closure.js +134 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +27 -1
- package/dist/sdk/agent/refusal-reachability.js +26 -2
- package/dist/sdk/agent-capability-contracts.d.ts +13 -0
- package/dist/sdk/agent-capability-contracts.js +101 -9
- package/dist/sdk/cli-contracts/command-aliases.js +18 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
- package/dist/sdk/cli-contracts/commander-types.js +5 -4
- 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 +7 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +84 -8
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +72 -0
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +340 -0
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +83 -2
- package/dist/sdk/cli-contracts/grammar-contracts.js +618 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +15 -4
- package/dist/sdk/cli-contracts/runtime-contracts.js +47 -13
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
- package/dist/sdk/cli-contracts/tool-schema.js +7 -2
- package/dist/sdk/cli-contracts.d.ts +4 -3
- package/dist/sdk/cli-contracts.js +6 -5
- package/dist/sdk/context-intent-contracts.d.ts +2 -2
- package/dist/sdk/context-intent-contracts.js +22 -7
- package/dist/sdk/contracts.d.ts +3 -0
- package/dist/sdk/contracts.js +5 -2
- package/dist/sdk/core.d.ts +1 -1
- package/dist/sdk/core.js +3 -3
- package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
- package/dist/sdk/flag-invocation-contracts.js +218 -9
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +206 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +244 -40
- package/dist/sdk/index.d.ts +11 -7
- package/dist/sdk/index.js +10 -6
- 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/output-projection.d.ts +2 -0
- package/dist/sdk/output-projection.js +11 -5
- package/dist/sdk/query/get.d.ts +1 -1
- package/dist/sdk/query/get.js +34 -49
- package/dist/sdk/query/list.d.ts +7 -21
- package/dist/sdk/query/list.js +44 -44
- 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 +3 -2
- package/dist/sdk/query/search-contracts.js +30 -85
- package/dist/sdk/query/search.d.ts +15 -0
- package/dist/sdk/query/search.js +32 -6
- package/dist/sdk/read-output/continuation.d.ts +1 -1
- package/dist/sdk/read-output/continuation.js +7 -24
- package/dist/sdk/read-output-contracts.js +55 -6
- package/dist/sdk/read-output-rows.d.ts +4 -0
- package/dist/sdk/read-output-rows.js +47 -18
- 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 +25 -17
- package/dist/sdk/similarity.d.ts +13 -0
- package/dist/sdk/similarity.js +32 -6
- package/dist/sdk/workspace-snapshot.d.ts +2 -0
- package/dist/sdk/workspace-snapshot.js +10 -2
- package/docs/COMMANDS.md +29 -5
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +114 -0
- package/docs/SDK.md +16 -2
- package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
- package/docs/TESTING.md +14 -1
- package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
- package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
- package/marketplace.json +2 -2
- package/package.json +9 -7
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/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/scripts/generate-agent-capability-surfaces.mjs +20 -14
- package/sdk/public-surface.json +950 -24
- package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +0 -197
- package/dist/cli-bundle/chunks/chunk-GNFAFIJI.js +0 -77
- package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +0 -35
- package/dist/cli-bundle/chunks/chunk-PVRUN5ZS.js +0 -5
- package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
- package/dist/cli-bundle/chunks/register-list-query-I23LALEE.js +0 -11
- package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-4HTFC6J7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3TKWMNKF.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-5AF3ZBNB.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +0 -2
|
@@ -4,82 +4,13 @@
|
|
|
4
4
|
* Owns search input parsing, output projection contracts, and tuning defaults.
|
|
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]="d20ab01b-a8ae-5fe8-988a-d05fe87951f6")}catch(e){}}();
|
|
8
8
|
import { coerceNumberInRange } from "../../core/shared/primitives.js";
|
|
9
|
-
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
10
|
-
import { PmCliError } from "../../core/shared/errors.js";
|
|
11
9
|
import { resolveIsoOrRelative } from "../../core/shared/time.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"type",
|
|
17
|
-
"priority",
|
|
18
|
-
"updated_at",
|
|
19
|
-
"score",
|
|
20
|
-
"matched_fields",
|
|
21
|
-
];
|
|
22
|
-
const SEARCH_HIT_FIELD_KEYS = new Set([
|
|
23
|
-
"score",
|
|
24
|
-
"matched_fields",
|
|
25
|
-
"highlights",
|
|
26
|
-
]);
|
|
27
|
-
const SEARCH_ITEM_FIELD_KEYS = new Set([
|
|
28
|
-
"id",
|
|
29
|
-
"title",
|
|
30
|
-
"description",
|
|
31
|
-
"type",
|
|
32
|
-
"status",
|
|
33
|
-
"priority",
|
|
34
|
-
"tags",
|
|
35
|
-
"created_at",
|
|
36
|
-
"updated_at",
|
|
37
|
-
"deadline",
|
|
38
|
-
"assignee",
|
|
39
|
-
"author",
|
|
40
|
-
"estimated_minutes",
|
|
41
|
-
"acceptance_criteria",
|
|
42
|
-
"dependencies",
|
|
43
|
-
"comments",
|
|
44
|
-
"notes",
|
|
45
|
-
"learnings",
|
|
46
|
-
"reminders",
|
|
47
|
-
"events",
|
|
48
|
-
"files",
|
|
49
|
-
"tests",
|
|
50
|
-
"docs",
|
|
51
|
-
"close_reason",
|
|
52
|
-
"parent",
|
|
53
|
-
"reviewer",
|
|
54
|
-
"risk",
|
|
55
|
-
"confidence",
|
|
56
|
-
"sprint",
|
|
57
|
-
"release",
|
|
58
|
-
"blocked_by",
|
|
59
|
-
"blocked_reason",
|
|
60
|
-
"reporter",
|
|
61
|
-
"severity",
|
|
62
|
-
"environment",
|
|
63
|
-
"repro_steps",
|
|
64
|
-
"resolution",
|
|
65
|
-
"expected_result",
|
|
66
|
-
"actual_result",
|
|
67
|
-
"affected_version",
|
|
68
|
-
"fixed_version",
|
|
69
|
-
"component",
|
|
70
|
-
"regression",
|
|
71
|
-
"customer_impact",
|
|
72
|
-
"definition_of_ready",
|
|
73
|
-
"order",
|
|
74
|
-
"rank",
|
|
75
|
-
"goal",
|
|
76
|
-
"objective",
|
|
77
|
-
"value",
|
|
78
|
-
"impact",
|
|
79
|
-
"outcome",
|
|
80
|
-
"why_now",
|
|
81
|
-
"plan",
|
|
82
|
-
]);
|
|
10
|
+
import { renderPmCommand } from "../command-line.js";
|
|
11
|
+
import { EXIT_CODE, PmCliError } from "../runtime-primitives.js";
|
|
12
|
+
import { DEFAULT_COMPACT_SEARCH_FIELDS, listSearchProjectionFields, } from "./projection-contracts.js";
|
|
13
|
+
export { DEFAULT_COMPACT_SEARCH_FIELDS, SEARCH_HIT_FIELD_KEYS, SEARCH_ITEM_FIELD_KEYS, listSearchProjectionFields, } from "./projection-contracts.js";
|
|
83
14
|
/** Parse the configured search execution mode. */
|
|
84
15
|
export function parseSearchMode(raw) {
|
|
85
16
|
if (raw === undefined)
|
|
@@ -154,7 +85,7 @@ function parseFieldSelectors(raw) {
|
|
|
154
85
|
return [...new Set(selectors)];
|
|
155
86
|
}
|
|
156
87
|
/** Resolve mutually exclusive compact, full, or explicit-field projection. */
|
|
157
|
-
export function parseSearchProjection(options) {
|
|
88
|
+
export function parseSearchProjection(options, query = "<query>") {
|
|
158
89
|
const compactRequested = options.compact === true;
|
|
159
90
|
const fullRequested = options.full === true;
|
|
160
91
|
const fieldSelectors = parseFieldSelectors(options.fields);
|
|
@@ -162,7 +93,13 @@ export function parseSearchProjection(options) {
|
|
|
162
93
|
Number(fullRequested) +
|
|
163
94
|
Number(fieldSelectors !== undefined);
|
|
164
95
|
if (enabledModes > 1) {
|
|
165
|
-
throw new PmCliError("Search projection options are mutually exclusive. Use one of --compact, --full, or --fields.", EXIT_CODE.USAGE
|
|
96
|
+
throw new PmCliError("Search projection options are mutually exclusive. Use one of --compact, --full, or --fields.", EXIT_CODE.USAGE, {
|
|
97
|
+
code: "projection_options_mutually_exclusive",
|
|
98
|
+
recovery: {
|
|
99
|
+
suggested_retry: renderPmCommand(["search", query, "--full"]),
|
|
100
|
+
suggested_retry_args: ["search", query, "--full"],
|
|
101
|
+
},
|
|
102
|
+
});
|
|
166
103
|
}
|
|
167
104
|
if (compactRequested) {
|
|
168
105
|
return { mode: "compact", fields: [...DEFAULT_COMPACT_SEARCH_FIELDS] };
|
|
@@ -174,24 +111,27 @@ export function parseSearchProjection(options) {
|
|
|
174
111
|
return { mode: "full", fields: [] };
|
|
175
112
|
}
|
|
176
113
|
/** Validate explicit projection fields against core and runtime metadata. */
|
|
177
|
-
export function validateSearchProjectionFields(projection, runtimeFieldRegistry) {
|
|
114
|
+
export function validateSearchProjectionFields(projection, runtimeFieldRegistry, query = "<query>") {
|
|
178
115
|
if (projection.mode !== "fields")
|
|
179
116
|
return;
|
|
180
|
-
const
|
|
117
|
+
const allowedValues = listSearchProjectionFields(runtimeFieldRegistry.definitions.flatMap((field) => [
|
|
181
118
|
field.key,
|
|
182
119
|
field.metadata_key,
|
|
183
120
|
]));
|
|
121
|
+
const allowed = new Set(allowedValues);
|
|
184
122
|
const unknown = projection.fields.filter((field) => {
|
|
185
123
|
const normalized = field.trim();
|
|
186
|
-
|
|
187
|
-
? normalized.slice("item.".length)
|
|
188
|
-
: normalized;
|
|
189
|
-
return (!SEARCH_HIT_FIELD_KEYS.has(normalized) &&
|
|
190
|
-
!SEARCH_ITEM_FIELD_KEYS.has(itemKey) &&
|
|
191
|
-
!runtimeKeys.has(itemKey));
|
|
124
|
+
return !allowed.has(normalized);
|
|
192
125
|
});
|
|
193
126
|
if (unknown.length > 0) {
|
|
127
|
+
const suggestedRetryArguments = [
|
|
128
|
+
"search",
|
|
129
|
+
query,
|
|
130
|
+
"--fields",
|
|
131
|
+
"id,title,status,score",
|
|
132
|
+
];
|
|
194
133
|
throw new PmCliError(`Unknown search --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
|
|
134
|
+
code: "unknown_field_projection",
|
|
195
135
|
examples: [
|
|
196
136
|
"pm search <query> --fields id,title,status,score",
|
|
197
137
|
"pm search <query> --fields id,title,item.description,matched_fields",
|
|
@@ -199,6 +139,11 @@ export function validateSearchProjectionFields(projection, runtimeFieldRegistry)
|
|
|
199
139
|
nextSteps: [
|
|
200
140
|
"Use item.<field> for explicit item metadata fields, or run pm search --help for projection examples.",
|
|
201
141
|
],
|
|
142
|
+
recovery: {
|
|
143
|
+
allowed_values: allowedValues,
|
|
144
|
+
suggested_retry: renderPmCommand(suggestedRetryArguments),
|
|
145
|
+
suggested_retry_args: suggestedRetryArguments,
|
|
146
|
+
},
|
|
202
147
|
});
|
|
203
148
|
}
|
|
204
149
|
}
|
|
@@ -283,4 +228,4 @@ export function resolveSearchTuning(settings) {
|
|
|
283
228
|
};
|
|
284
229
|
}
|
|
285
230
|
//# sourceMappingURL=search-contracts.js.map
|
|
286
|
-
//# debugId=
|
|
231
|
+
//# debugId=d20ab01b-a8ae-5fe8-988a-d05fe87951f6
|
|
@@ -183,8 +183,23 @@ export declare function collectErrorCauseCodes(error: unknown): string;
|
|
|
183
183
|
*/
|
|
184
184
|
export declare function classifyImplicitSemanticFallbackReason(error: unknown): ImplicitSemanticFallbackReason;
|
|
185
185
|
declare function buildExplicitSemanticFallbackWarning(requestedMode: SearchMode, error: unknown): string;
|
|
186
|
+
interface VectorIndexRecoveryRegistrations {
|
|
187
|
+
commands?: readonly {
|
|
188
|
+
command: string;
|
|
189
|
+
}[];
|
|
190
|
+
}
|
|
191
|
+
interface VectorIndexRecovery {
|
|
192
|
+
command: string;
|
|
193
|
+
args: string[];
|
|
194
|
+
follow_up_command?: string;
|
|
195
|
+
follow_up_args?: string[];
|
|
196
|
+
}
|
|
197
|
+
/** Resolve an executable reindex path from the active extension capability surface. */
|
|
198
|
+
export declare function resolveVectorIndexRecovery(registrations: VectorIndexRecoveryRegistrations | null): VectorIndexRecovery;
|
|
186
199
|
/** Compare the vectorization-status ledger against the filtered corpus and, when the vector index is behind, emit a one-line stderr warning plus a structured `vector_index_stale:N` entry in the JSON warnings array. Best-effort: ledger read failures fall through silently — the existing semantic/hybrid fallback paths cover backend errors. */
|
|
187
200
|
declare function maybeEmitVectorIndexStaleWarning(pmRoot: string, filteredDocuments: ItemDocument[], warnings: string[]): Promise<void>;
|
|
201
|
+
/** Format token-efficient vector-index staleness and executable recovery warnings. */
|
|
202
|
+
export declare function formatVectorIndexRecoveryWarnings(staleCount: number, recovery: VectorIndexRecovery): string[];
|
|
188
203
|
/** Public contract for test only search command, shared by SDK and presentation-layer consumers. */
|
|
189
204
|
export declare const _testOnlySearchCommand: {
|
|
190
205
|
applyFilters: typeof applyFilters;
|
package/dist/sdk/query/search.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm search command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c650f22f-5fcd-5489-aa9b-da11c2d1db63")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
|
|
@@ -128,6 +128,21 @@ function buildExplicitSemanticFallbackWarning(requestedMode, error) {
|
|
|
128
128
|
const reason = classifyImplicitSemanticFallbackReason(error);
|
|
129
129
|
return `search_${requestedMode}_fallback:${reason}:using_keyword_mode`;
|
|
130
130
|
}
|
|
131
|
+
/** Resolve an executable reindex path from the active extension capability surface. */
|
|
132
|
+
export function resolveVectorIndexRecovery(registrations) {
|
|
133
|
+
const hasReindex = registrations?.commands?.some((registration) => registration.command.trim() === "reindex") === true;
|
|
134
|
+
return hasReindex
|
|
135
|
+
? {
|
|
136
|
+
command: "pm reindex --mode hybrid",
|
|
137
|
+
args: ["reindex", "--mode", "hybrid"],
|
|
138
|
+
}
|
|
139
|
+
: {
|
|
140
|
+
command: "pm install search-advanced --project",
|
|
141
|
+
args: ["install", "search-advanced", "--project"],
|
|
142
|
+
follow_up_command: "pm reindex --mode hybrid",
|
|
143
|
+
follow_up_args: ["reindex", "--mode", "hybrid"],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
131
146
|
/** Compare the vectorization-status ledger against the filtered corpus and, when the vector index is behind, emit a one-line stderr warning plus a structured `vector_index_stale:N` entry in the JSON warnings array. Best-effort: ledger read failures fall through silently — the existing semantic/hybrid fallback paths cover backend errors. */
|
|
132
147
|
async function maybeEmitVectorIndexStaleWarning(pmRoot, filteredDocuments, warnings) {
|
|
133
148
|
try {
|
|
@@ -142,15 +157,26 @@ async function maybeEmitVectorIndexStaleWarning(pmRoot, filteredDocuments, warni
|
|
|
142
157
|
if (staleIds.length === 0) {
|
|
143
158
|
return;
|
|
144
159
|
}
|
|
145
|
-
|
|
160
|
+
const recovery = resolveVectorIndexRecovery(getActiveExtensionRegistrations());
|
|
161
|
+
warnings.push(...formatVectorIndexRecoveryWarnings(staleIds.length, recovery));
|
|
146
162
|
/* c8 ignore start -- singular/plural warning text branches are cosmetic and validated in integration UX tests */
|
|
147
|
-
process.stderr.write(`[pm] warning: ${staleIds.length} item${staleIds.length === 1 ? " is" : "s are"} new or modified since the last reindex and ${staleIds.length === 1 ? "is" : "are"} NOT in the semantic index yet —
|
|
163
|
+
process.stderr.write(`[pm] warning: ${staleIds.length} item${staleIds.length === 1 ? " is" : "s are"} new or modified since the last reindex and ${staleIds.length === 1 ? "is" : "are"} NOT in the semantic index yet — run '${recovery.command}'${recovery.follow_up_command ? `, then '${recovery.follow_up_command}'` : ""}. (Write-time embedding is governed by search.mutation_refresh_policy; staleness means the embed was skipped, failed, or the backend was unreachable.)\n`);
|
|
148
164
|
/* c8 ignore stop */
|
|
149
165
|
}
|
|
150
166
|
catch {
|
|
151
167
|
// Best-effort: missing/unreadable ledger is not a query-blocking concern.
|
|
152
168
|
}
|
|
153
169
|
}
|
|
170
|
+
/** Format token-efficient vector-index staleness and executable recovery warnings. */
|
|
171
|
+
export function formatVectorIndexRecoveryWarnings(staleCount, recovery) {
|
|
172
|
+
return [
|
|
173
|
+
`vector_index_stale:${staleCount}`,
|
|
174
|
+
`vector_index_recovery:${recovery.args.join(" ")}`,
|
|
175
|
+
...(recovery.follow_up_args
|
|
176
|
+
? [`vector_index_recovery_follow_up:${recovery.follow_up_args.join(" ")}`]
|
|
177
|
+
: []),
|
|
178
|
+
];
|
|
179
|
+
}
|
|
154
180
|
/** Public contract for test only search command, shared by SDK and presentation-layer consumers. */
|
|
155
181
|
export const _testOnlySearchCommand = {
|
|
156
182
|
applyFilters,
|
|
@@ -1539,7 +1565,7 @@ function prepareSearchInput(rawQuery, rawOptions) {
|
|
|
1539
1565
|
tokens: parseSearchTokens(query),
|
|
1540
1566
|
normalizedQuery: normalizeSearchPhrase(query),
|
|
1541
1567
|
limit: parseLimit(options.limit),
|
|
1542
|
-
projection: parseSearchProjection(options),
|
|
1568
|
+
projection: parseSearchProjection(options, rawQuery),
|
|
1543
1569
|
modeWasExplicit: typeof options.mode === "string" && options.mode.trim().length > 0,
|
|
1544
1570
|
};
|
|
1545
1571
|
}
|
|
@@ -1552,7 +1578,7 @@ async function resolveSearchRuntimeContext(prepared, global) {
|
|
|
1552
1578
|
const settings = resolveSettingsWithSemanticRuntimeDefaults(storedSettings).settings;
|
|
1553
1579
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
1554
1580
|
const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
|
|
1555
|
-
validateSearchProjectionFields(prepared.projection, runtimeFieldRegistry);
|
|
1581
|
+
validateSearchProjectionFields(prepared.projection, runtimeFieldRegistry, prepared.query);
|
|
1556
1582
|
const runtimeFieldFilters = collectRuntimeFilterValues(prepared.options, runtimeFieldRegistry, "search");
|
|
1557
1583
|
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
1558
1584
|
const providerResolution = resolveEmbeddingProviders(settings);
|
|
@@ -1961,4 +1987,4 @@ export async function runSearch(rawQuery, rawOptions, global) {
|
|
|
1961
1987
|
return withSearchWorkspaceMemory(buildSearchResultForHits(response, projectedItems, total, page.limited.length, effectiveProjection, page.pageExtras), workspaceMemoryResult);
|
|
1962
1988
|
}
|
|
1963
1989
|
//# sourceMappingURL=search.js.map
|
|
1964
|
-
//# debugId=
|
|
1990
|
+
//# debugId=c650f22f-5fcd-5489-aa9b-da11c2d1db63
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PmReadOutputCursorEnvelope, PmReadOutputSurface } from "../read-output-contracts.js";
|
|
2
|
-
/** Fingerprint
|
|
2
|
+
/** Fingerprint the complete canonical row snapshot so changed evidence fails closed. */
|
|
3
3
|
export declare function readOutputCollectionFingerprint(path: string, value: unknown[] | Record<string, unknown>): string;
|
|
4
4
|
/** Encode one stable declared-row continuation for CLI, SDK, and MCP callers. */
|
|
5
5
|
export declare function encodeReadOutputContinuationCursor(cursor: Omit<PmReadOutputCursorEnvelope, "version">): string;
|
|
@@ -6,38 +6,21 @@
|
|
|
6
6
|
* resolution and budget policy.
|
|
7
7
|
*/
|
|
8
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]="
|
|
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]="1c73c31e-6246-5730-8c8a-d3ba7c9ec112")}catch(e){}}();
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
12
12
|
import { PmCliError } from "../../core/shared/errors.js";
|
|
13
|
+
import { stableStringify } from "../../core/shared/serialization.js";
|
|
13
14
|
import { resolveReadOutputSurface } from "../read-output-contracts.js";
|
|
14
|
-
import {
|
|
15
|
+
import { readOutputContinuationRowCollections, sliceReadOutputRowCollection, } from "../read-output-rows.js";
|
|
15
16
|
const MAX_READ_OUTPUT_CURSOR_LENGTH = 4096;
|
|
16
17
|
function isRecord(value) {
|
|
17
18
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
18
19
|
}
|
|
19
|
-
/** Fingerprint
|
|
20
|
+
/** Fingerprint the complete canonical row snapshot so changed evidence fails closed. */
|
|
20
21
|
export function readOutputCollectionFingerprint(path, value) {
|
|
21
|
-
const identities = Array.isArray(value)
|
|
22
|
-
? value.map((row, index) => {
|
|
23
|
-
if (!isRecord(row))
|
|
24
|
-
return `index:${String(index)}`;
|
|
25
|
-
for (const key of [
|
|
26
|
-
"id",
|
|
27
|
-
"assertion_id",
|
|
28
|
-
"measurement_id",
|
|
29
|
-
"event_id",
|
|
30
|
-
]) {
|
|
31
|
-
const candidate = row[key];
|
|
32
|
-
if (typeof candidate === "string" && candidate.length > 0) {
|
|
33
|
-
return `${key}:${candidate}`;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return `index:${String(index)}`;
|
|
37
|
-
})
|
|
38
|
-
: Object.keys(value);
|
|
39
22
|
return createHash("sha256")
|
|
40
|
-
.update(
|
|
23
|
+
.update(stableStringify({ path, value }))
|
|
41
24
|
.digest("base64url")
|
|
42
25
|
.slice(0, 16);
|
|
43
26
|
}
|
|
@@ -113,7 +96,7 @@ export function applyReadOutputContinuation(result, command, cursor) {
|
|
|
113
96
|
if (cursor.command !== command) {
|
|
114
97
|
throw new PmCliError(`The read-output cursor belongs to ${cursor.command}, not ${command}.`, EXIT_CODE.USAGE, { code: "read_output_cursor_command_mismatch" });
|
|
115
98
|
}
|
|
116
|
-
const collection =
|
|
99
|
+
const collection = readOutputContinuationRowCollections(result).find((entry) => entry.path === cursor.path);
|
|
117
100
|
const totalRows = collection
|
|
118
101
|
? Array.isArray(collection.value)
|
|
119
102
|
? collection.value.length
|
|
@@ -129,4 +112,4 @@ export function applyReadOutputContinuation(result, command, cursor) {
|
|
|
129
112
|
return sliceReadOutputRowCollection(result, cursor.path, cursor.offset);
|
|
130
113
|
}
|
|
131
114
|
//# sourceMappingURL=continuation.js.map
|
|
132
|
-
//# debugId=
|
|
115
|
+
//# debugId=1c73c31e-6246-5730-8c8a-d3ba7c9ec112
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* surface without coupling package authors to command-specific option names.
|
|
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]="b3c001df-9891-5cf7-990b-8d9da7b51801")}catch(e){}}();
|
|
9
9
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
10
10
|
import { PmCliError } from "../core/shared/errors.js";
|
|
11
11
|
import { compactReadOutputToBudget, estimateReadOutputTokens, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
|
|
12
12
|
import { resolvePmCommandOutputBudget } from "./cli-contracts/agent-output-contracts.js";
|
|
13
|
-
import { boundReadOutputRows, countReadOutputRows, mapReadOutputRows,
|
|
13
|
+
import { boundReadOutputRows, countReadOutputRows, mapReadOutputRows, readOutputBudgetCollections, readOutputContinuationRowCollections, readOutputRowPaths, } from "./read-output-rows.js";
|
|
14
14
|
import { applyReadOutputContinuation, decodeReadOutputContinuationCursor, encodeReadOutputContinuationCursor, prioritizeAssuranceAssertions, readOutputCollectionFingerprint, } from "./read-output/continuation.js";
|
|
15
15
|
export { decodeReadOutputContinuationCursor, encodeReadOutputContinuationCursor, } from "./read-output/continuation.js";
|
|
16
16
|
import { applyReadOutputSessionReferences, attachReadOutputSessionReceipt, parseReadOutputSession, readOutputSessionRemainingTokens, } from "./read-output-session.js";
|
|
@@ -763,6 +763,54 @@ export function stabilizeReadOutputReceiptEstimates(result, options) {
|
|
|
763
763
|
}
|
|
764
764
|
return attachReadOutputSessionContracts(result, session, receipt);
|
|
765
765
|
}
|
|
766
|
+
/** Declare independently resumable validate diagnostic arrays on rich results. */
|
|
767
|
+
function attachValidateDiagnosticRowContract(command, result) {
|
|
768
|
+
if (command !== "validate")
|
|
769
|
+
return result;
|
|
770
|
+
const projection = isRecord(result.projection)
|
|
771
|
+
? result.projection
|
|
772
|
+
: undefined;
|
|
773
|
+
const declaredFieldGroups = Array.isArray(projection?.declared_field_groups)
|
|
774
|
+
? projection.declared_field_groups
|
|
775
|
+
: [];
|
|
776
|
+
if (!declaredFieldGroups.some((group) => isRecord(group) && group.name === "diagnostic_rows")) {
|
|
777
|
+
return result;
|
|
778
|
+
}
|
|
779
|
+
const diagnosticCollectionPaths = [
|
|
780
|
+
...new Set(readOutputBudgetCollections(result)
|
|
781
|
+
.map(({ path }) => path)
|
|
782
|
+
.filter((path) => /^checks\.\d+\.details\./u.test(path))),
|
|
783
|
+
];
|
|
784
|
+
const diagnosticRowKeys = diagnosticCollectionPaths.filter((path) => !diagnosticCollectionPaths.some((candidate) => candidate !== path && path.startsWith(`${candidate}.`)));
|
|
785
|
+
if (diagnosticRowKeys.length === 0)
|
|
786
|
+
return result;
|
|
787
|
+
const existingContract = isRecord(result.row_contract)
|
|
788
|
+
? result.row_contract
|
|
789
|
+
: {};
|
|
790
|
+
const existingRowKeys = Array.isArray(existingContract.row_keys)
|
|
791
|
+
? existingContract.row_keys.filter((entry) => typeof entry === "string")
|
|
792
|
+
: [];
|
|
793
|
+
const existingContinuationRowKeys = Array.isArray(existingContract.continuation_row_keys)
|
|
794
|
+
? existingContract.continuation_row_keys.filter((entry) => typeof entry === "string")
|
|
795
|
+
: [];
|
|
796
|
+
const rowKeys = existingRowKeys.length > 0 ? existingRowKeys : diagnosticRowKeys;
|
|
797
|
+
const continuationRowKeys = [...new Set(diagnosticRowKeys)];
|
|
798
|
+
return JSON.stringify(rowKeys) === JSON.stringify(existingRowKeys) &&
|
|
799
|
+
JSON.stringify(continuationRowKeys) ===
|
|
800
|
+
JSON.stringify(existingContinuationRowKeys)
|
|
801
|
+
? result
|
|
802
|
+
: {
|
|
803
|
+
...result,
|
|
804
|
+
row_contract: {
|
|
805
|
+
...existingContract,
|
|
806
|
+
row_keys: rowKeys,
|
|
807
|
+
continuation_row_keys: continuationRowKeys,
|
|
808
|
+
jq_selector: typeof existingContract.jq_selector === "string"
|
|
809
|
+
? existingContract.jq_selector
|
|
810
|
+
: ".checks[].details",
|
|
811
|
+
},
|
|
812
|
+
};
|
|
813
|
+
}
|
|
766
814
|
/** Apply field, amount, and repeat projections to every declared row path. */
|
|
767
815
|
function projectReadOutputRows(result, resolved, session, cursor) {
|
|
768
816
|
let projected = { ...result };
|
|
@@ -871,7 +919,7 @@ function attachReadOutputTruncationDisclosure(projected, resolved, receipt, bind
|
|
|
871
919
|
if (!receipt.rows_compacted)
|
|
872
920
|
return;
|
|
873
921
|
const overridden = resolved.amount?.value === "unbounded" ? ["amount"] : [];
|
|
874
|
-
const afterByPath = new Map(
|
|
922
|
+
const afterByPath = new Map(readOutputContinuationRowCollections(projected).map((collection) => [
|
|
875
923
|
collection.path,
|
|
876
924
|
Array.isArray(collection.value)
|
|
877
925
|
? collection.value.length
|
|
@@ -974,7 +1022,7 @@ function rebaseBudgetCompactedCursor(projected, originalItemCount, cursorSource,
|
|
|
974
1022
|
return true;
|
|
975
1023
|
}
|
|
976
1024
|
function captureReadOutputContinuationState(projected, cursor, options) {
|
|
977
|
-
const collectionsBeforeBudget = new Map(
|
|
1025
|
+
const collectionsBeforeBudget = new Map(readOutputContinuationRowCollections(projected).map((collection) => {
|
|
978
1026
|
const rows = Array.isArray(collection.value)
|
|
979
1027
|
? collection.value.length
|
|
980
1028
|
: Object.keys(collection.value).length;
|
|
@@ -1032,8 +1080,9 @@ export function applyReadOutputDimensions(command, options, result) {
|
|
|
1032
1080
|
canReturnReadOutputUnchanged(resolved, requested, session, result)) {
|
|
1033
1081
|
return result;
|
|
1034
1082
|
}
|
|
1083
|
+
const continuationReadyResult = attachValidateDiagnosticRowContract(resolved.command, result);
|
|
1035
1084
|
const bindingBudget = resolveBindingReadOutputBudget(resolved, session);
|
|
1036
|
-
let projected = projectReadOutputRows(
|
|
1085
|
+
let projected = projectReadOutputRows(continuationReadyResult, resolved, session, cursor);
|
|
1037
1086
|
const continuationState = captureReadOutputContinuationState(projected, cursor, options);
|
|
1038
1087
|
const receipt = {
|
|
1039
1088
|
contract_version: 1,
|
|
@@ -1085,4 +1134,4 @@ export function resolveReadOutputEncoding(command, options) {
|
|
|
1085
1134
|
: undefined;
|
|
1086
1135
|
}
|
|
1087
1136
|
//# sourceMappingURL=read-output-contracts.js.map
|
|
1088
|
-
//# debugId=
|
|
1137
|
+
//# debugId=b3c001df-9891-5cf7-990b-8d9da7b51801
|
|
@@ -15,8 +15,12 @@ export interface PmReadOutputRowCollection {
|
|
|
15
15
|
export declare function sliceReadOutputRowCollection(result: Record<string, unknown>, rowPath: string, offset: number): Record<string, unknown>;
|
|
16
16
|
/** Resolve declared row paths, falling back to top-level array properties. */
|
|
17
17
|
export declare function readOutputRowPaths(result: Record<string, unknown>): string[];
|
|
18
|
+
/** Resolve collections that may be resumed independently from primary result rows. */
|
|
19
|
+
export declare function readOutputContinuationRowPaths(result: Record<string, unknown>): string[];
|
|
18
20
|
/** Resolve every declared row path that currently contains iterable rows. */
|
|
19
21
|
export declare function readOutputRowCollections(result: Record<string, unknown>): PmReadOutputRowCollection[];
|
|
22
|
+
/** Resolve every declared continuation path that currently contains iterable rows. */
|
|
23
|
+
export declare function readOutputContinuationRowCollections(result: Record<string, unknown>): PmReadOutputRowCollection[];
|
|
20
24
|
/**
|
|
21
25
|
* Discover every collection the token-budget degradation ladder may reduce.
|
|
22
26
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* envelopes, including dot-delimited nested paths used by graph projections.
|
|
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]="810d42b5-98f4-57a7-bdd9-2dfa1b2b1c03")}catch(e){}}();
|
|
9
9
|
const BUDGET_METADATA_ROOT_KEYS = new Set([
|
|
10
10
|
"applied_bound",
|
|
11
11
|
"completeness",
|
|
@@ -29,31 +29,43 @@ function isRecord(value) {
|
|
|
29
29
|
function valueAtPath(result, rowPath) {
|
|
30
30
|
let value = result;
|
|
31
31
|
for (const segment of rowPath.split(".")) {
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
if (!/^\d+$/u.test(segment))
|
|
34
|
+
return undefined;
|
|
35
|
+
value = value[Number(segment)];
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
if (!isRecord(value))
|
|
39
|
+
return undefined;
|
|
40
|
+
value = value[segment];
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
return value;
|
|
37
44
|
}
|
|
38
45
|
/** Clone the owners along one row path and replace only its terminal value. */
|
|
39
46
|
function replaceValueAtPath(result, rowPath, replacement) {
|
|
40
47
|
const segments = rowPath.split(".");
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
const replace = (value, offset) => {
|
|
49
|
+
if (offset === segments.length)
|
|
50
|
+
return replacement;
|
|
51
|
+
const segment = segments[offset];
|
|
52
|
+
if (Array.isArray(value)) {
|
|
53
|
+
const index = Number(segment);
|
|
54
|
+
const cloned = [...value];
|
|
55
|
+
cloned[index] = replace(value[index], offset + 1);
|
|
56
|
+
return cloned;
|
|
57
|
+
}
|
|
58
|
+
const record = value;
|
|
59
|
+
return {
|
|
60
|
+
...record,
|
|
61
|
+
[segment]: replace(record[segment], offset + 1),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
return replace(result, 0);
|
|
53
65
|
}
|
|
54
66
|
/** Replace one declared row collection with a suffix beginning at an offset. */
|
|
55
67
|
export function sliceReadOutputRowCollection(result, rowPath, offset) {
|
|
56
|
-
const collection =
|
|
68
|
+
const collection = readOutputContinuationRowCollections(result).find((entry) => entry.path === rowPath);
|
|
57
69
|
if (!collection)
|
|
58
70
|
return result;
|
|
59
71
|
const replacement = Array.isArray(collection.value)
|
|
@@ -71,6 +83,14 @@ export function readOutputRowPaths(result) {
|
|
|
71
83
|
.filter(([, value]) => Array.isArray(value))
|
|
72
84
|
.map(([key]) => key);
|
|
73
85
|
}
|
|
86
|
+
/** Resolve collections that may be resumed independently from primary result rows. */
|
|
87
|
+
export function readOutputContinuationRowPaths(result) {
|
|
88
|
+
const contract = result.row_contract;
|
|
89
|
+
if (isRecord(contract) && Array.isArray(contract.continuation_row_keys)) {
|
|
90
|
+
return contract.continuation_row_keys.filter((entry) => typeof entry === "string" && entry.trim().length > 0);
|
|
91
|
+
}
|
|
92
|
+
return readOutputRowPaths(result);
|
|
93
|
+
}
|
|
74
94
|
/** Resolve every declared row path that currently contains iterable rows. */
|
|
75
95
|
export function readOutputRowCollections(result) {
|
|
76
96
|
return readOutputRowPaths(result).flatMap((rowPath) => {
|
|
@@ -80,6 +100,15 @@ export function readOutputRowCollections(result) {
|
|
|
80
100
|
: [];
|
|
81
101
|
});
|
|
82
102
|
}
|
|
103
|
+
/** Resolve every declared continuation path that currently contains iterable rows. */
|
|
104
|
+
export function readOutputContinuationRowCollections(result) {
|
|
105
|
+
return readOutputContinuationRowPaths(result).flatMap((rowPath) => {
|
|
106
|
+
const value = valueAtPath(result, rowPath);
|
|
107
|
+
return Array.isArray(value) || isRecord(value)
|
|
108
|
+
? [{ path: rowPath, value }]
|
|
109
|
+
: [];
|
|
110
|
+
});
|
|
111
|
+
}
|
|
83
112
|
/**
|
|
84
113
|
* Discover every collection the token-budget degradation ladder may reduce.
|
|
85
114
|
*
|
|
@@ -155,4 +184,4 @@ export function boundReadOutputRows(result, amount) {
|
|
|
155
184
|
return { result: projected, truncated };
|
|
156
185
|
}
|
|
157
186
|
//# sourceMappingURL=read-output-rows.js.map
|
|
158
|
-
//# debugId=
|
|
187
|
+
//# debugId=810d42b5-98f4-57a7-bdd9-2dfa1b2b1c03
|
|
@@ -72,7 +72,7 @@ export { splitCommaList } from "../core/shared/split-comma-list.js";
|
|
|
72
72
|
export { compareTimestampStrings, nowIso, resolveIsoOrRelative, } from "../core/shared/time.js";
|
|
73
73
|
export { migrateItemFilesToFormat } from "../core/store/item-format-migration.js";
|
|
74
74
|
export { type CachedDocumentCandidate, listAllDocumentCandidatesCached, } from "../core/store/item-metadata-cache.js";
|
|
75
|
-
export { buildItemNotFoundError, createMutationGuardSdk, deleteItem, listAllItemMetadata, listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
|
|
75
|
+
export { buildItemNotFoundError, createMutationGuardSdk, deleteItem, listAllItemMetadata, listAllItemMetadataLight, locateItem, mutateItem, mutateItemWithHistoryContext, readLocatedItem, } from "../core/store/item-store.js";
|
|
76
76
|
export { isTerminalPlanMode, shouldCompletePlanOnClose, } from "../core/item/plan-lifecycle.js";
|
|
77
77
|
export { getHistoryPath, getItemPath, getSettingsPath, resolveImplicitPmRoot, resolvePmRoot, } from "../core/store/paths.js";
|
|
78
78
|
export { persistSelectedItemFormat, readSettings, readSettingsWithMetadata, writeSettings, } from "../core/store/settings.js";
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* prefer the typed operations exported by the main SDK barrel.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!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]="
|
|
10
|
+
!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]="1bcfba24-e761-571c-96e6-36bbc12d2814")}catch(e){}}();
|
|
11
11
|
export { createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, } from "../core/checkpoint/mutation-checkpoint.js";
|
|
12
12
|
export { flattenFlagListValue, resolveFlagValueKind, } from "../core/extensions/flag-value-types.js";
|
|
13
13
|
export { createUnknownSubcommandError, } from "./agent/subcommand-recovery.js";
|
|
@@ -73,7 +73,7 @@ export { splitCommaList } from "../core/shared/split-comma-list.js";
|
|
|
73
73
|
export { compareTimestampStrings, nowIso, resolveIsoOrRelative, } from "../core/shared/time.js";
|
|
74
74
|
export { migrateItemFilesToFormat } from "../core/store/item-format-migration.js";
|
|
75
75
|
export { listAllDocumentCandidatesCached, } from "../core/store/item-metadata-cache.js";
|
|
76
|
-
export { buildItemNotFoundError, createMutationGuardSdk, deleteItem, listAllItemMetadata, listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
|
|
76
|
+
export { buildItemNotFoundError, createMutationGuardSdk, deleteItem, listAllItemMetadata, listAllItemMetadataLight, locateItem, mutateItem, mutateItemWithHistoryContext, readLocatedItem, } from "../core/store/item-store.js";
|
|
77
77
|
export { isTerminalPlanMode, shouldCompletePlanOnClose, } from "../core/item/plan-lifecycle.js";
|
|
78
78
|
export { getHistoryPath, getItemPath, getSettingsPath, resolveImplicitPmRoot, resolvePmRoot, } from "../core/store/paths.js";
|
|
79
79
|
export { persistSelectedItemFormat, readSettings, readSettingsWithMetadata, writeSettings, } from "../core/store/settings.js";
|
|
@@ -81,4 +81,4 @@ export { maybeRunFirstUseTelemetryPrompt } from "../core/telemetry/consent.js";
|
|
|
81
81
|
export { deriveTelemetryCommandResolution, } from "../core/telemetry/observability.js";
|
|
82
82
|
export { emitTelemetryErrorEvent, finishTelemetryCommand, startTelemetryCommand, } from "../core/telemetry/runtime.js";
|
|
83
83
|
//# sourceMappingURL=runtime-primitives.js.map
|
|
84
|
-
//# debugId=
|
|
84
|
+
//# debugId=1bcfba24-e761-571c-96e6-36bbc12d2814
|
package/dist/sdk/runtime.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { type AggregateOptions, type AggregateResult } from "./query/aggregate.j
|
|
|
23
23
|
import { type UpgradeCommandOptions, type UpgradeResult } from "./governance/upgrade.js";
|
|
24
24
|
import { type CreateResult } from "./lifecycle/create.js";
|
|
25
25
|
import { type UpdateResult } from "./lifecycle/update.js";
|
|
26
|
+
import type { ReopenCommandOptions, ReopenResult } from "./lifecycle/reopen.js";
|
|
26
27
|
import { type PlanCommandOptions, type PlanCommandResult, type PlanSubcommand } from "./lifecycle/plan.js";
|
|
27
28
|
import { type ContextOptions, type ContextResult } from "./query/context.js";
|
|
28
29
|
import { type NextOptions, type NextResult } from "./query/next.js";
|
|
@@ -93,6 +94,7 @@ export { runFocus, type FocusOptions, type FocusResult, } from "./lifecycle/focu
|
|
|
93
94
|
export { runRestore, type RestoreCommandOptions, type RestoreResult, } from "./lifecycle/restore.js";
|
|
94
95
|
export { DEFAULT_TERMINAL_TRANSITION_POLICY, applyTerminalOrderingPolicy, requireTerminalReason, resolveTerminalReason, type CloseOperationOptions, type CloseOperationResult, type TerminalOrderingMutation, type TerminalReasonInput, type TerminalReasonResolution, type TerminalReasonSource, type TerminalTransitionPolicy, } from "./lifecycle-policy.js";
|
|
95
96
|
export { runUpdate, type UpdateCommandOptions } from "./lifecycle/update.js";
|
|
97
|
+
export { runReopen, type PreviousTerminalEvidence, type RecurrenceReceipt, type ReopenCommandOptions, type ReopenResult } from "./lifecycle/reopen.js";
|
|
96
98
|
export { NEXT_OUTPUT_VALUES, runNext, type NextActionableItem, type NextBlockerRef, type NextOptions, type NextOutputFormat, type NextRecommendation, type NextResult, } from "./query/next.js";
|
|
97
99
|
export { runSearch, type SearchCompactResult, type SearchHit, type SearchHitHighlight, type SearchMatchMode, type SearchOptions, type SearchResult, type SearchResultItem, type SearchVerboseResult, } from "./query/search.js";
|
|
98
100
|
export { runStats, type StatsCommandOptions, type StatsResult, } from "./stats.js";
|
|
@@ -293,6 +295,8 @@ export declare class PmClient {
|
|
|
293
295
|
create(options?: PmCreateActionOptions): Promise<CreateResult>;
|
|
294
296
|
/** Update an item using the same mutation path as `pm update`. Options are contract-typed (pm-x29o): unknown keys and non-scalar values fail `tsc`; runtime-schema custom fields go through the repeatable `field` option, and {@link PmClient.run} stays the wide escape hatch. */
|
|
295
297
|
update(id: string, options?: PmUpdateActionOptions): Promise<UpdateResult>;
|
|
298
|
+
/** Reopen terminal work as a recurrence through the canonical update path. */
|
|
299
|
+
reopen(id: string, reason: string, options?: ReopenCommandOptions): Promise<ReopenResult>;
|
|
296
300
|
/** Close an item using the same mutation path as `pm close`. Options are contract-typed (pm-x29o); the close reason is the positional parameter, so the option bag omits `reason`/`text`. */
|
|
297
301
|
close(id: string, reason: string, options?: PmClientCloseActionOptions): Promise<CloseResult>;
|
|
298
302
|
/** Claim an item using the same mutation path as `pm claim`. */
|
|
@@ -469,6 +473,8 @@ export declare function historyCompactBulk(options: HistoryCompactBulkCommandOpt
|
|
|
469
473
|
export declare function create(options?: PmCreateActionOptions, clientOptions?: PmClientOptions): Promise<CreateResult>;
|
|
470
474
|
/** Update an item without constructing a reusable client. */
|
|
471
475
|
export declare function update(id: string, options?: PmUpdateActionOptions, clientOptions?: PmClientOptions): Promise<UpdateResult>;
|
|
476
|
+
/** Reopen terminal work as a recurrence without constructing a reusable client. */
|
|
477
|
+
export declare function reopen(id: string, reason: string, options?: ReopenCommandOptions, clientOptions?: PmClientOptions): Promise<ReopenResult>;
|
|
472
478
|
/** Close an item without constructing a reusable client. */
|
|
473
479
|
export declare function close(id: string, reason: string, options?: PmClientCloseActionOptions, clientOptions?: PmClientOptions): Promise<CloseResult>;
|
|
474
480
|
/** Claim an item without constructing a reusable client. */
|