@unbrained/pm-cli 2026.8.12 → 2026.8.13
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 +22 -0
- package/dist/cli/error-guidance.js +4 -8
- package/dist/cli/main.js +3 -2
- package/dist/cli/register-assurance.js +28 -17
- package/dist/cli-bundle/bundle-manifest.json +161 -161
- package/dist/cli-bundle/chunks/chunk-3ZMOWAFM.js +2 -0
- package/dist/cli-bundle/chunks/chunk-DEDU3DG7.js +196 -0
- package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +13 -0
- package/dist/cli-bundle/chunks/chunk-F7FJYGK3.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-RBTK5EZV.js → chunk-HIUZVCMN.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-IMGIN7R6.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-WLAHPSOX.js → chunk-Q47C67TQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BM5YJ2UW.js → chunk-QGTUPEU5.js} +52 -52
- package/dist/cli-bundle/chunks/chunk-TF3TPKPR.js +34 -0
- package/dist/cli-bundle/chunks/{chunk-KOQMGCTA.js → chunk-YLBAPY22.js} +50 -50
- package/dist/cli-bundle/chunks/{register-list-query-XPCJRUUD.js → register-list-query-4HIZ7EA3.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-4RJCBKRS.js → register-mutation-W64FZ5HN.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-C44ET7R5.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-LLHAKP2V.js → register-setup-634MFRXU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +31 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YIAXMC3T.js → chunk-2JP7W7GO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2RI2FESN.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KHM2CS2C.js → chunk-3DJSGWVB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2DALMVF7.js → chunk-6MLIRBLV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +155 -0
- package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-RWPAWUOT.js → chunk-E3AVJ655.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5TAGTDRE.js → chunk-EBTNSFYE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KPSXVBDV.js → chunk-HC2OL2H2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GQW4BPUT.js → chunk-I75MANL7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZMGWAYH7.js → chunk-IIS2FRKL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-NFHFZH2Z.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +17 -0
- package/dist/cli-bundle/focused-chunks/{chunk-JAFRIWVF.js → chunk-OOYYKQWX.js} +4 -4
- package/dist/cli-bundle/focused-chunks/{chunk-KTLOKKCQ.js → chunk-PKPOZXLL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-QDZUABWL.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NYLOUPOB.js → chunk-TEZIXMTH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +18 -0
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +42 -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 +1 -1
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -2
- package/dist/core/checkpoint/checkpoint-gc.js +7 -12
- package/dist/core/extensions/activation-summary-markdown.js +5 -4
- package/dist/core/extensions/activation-summary.d.ts +2 -0
- package/dist/core/extensions/activation-summary.js +6 -2
- package/dist/core/extensions/capability-usage.d.ts +1 -1
- package/dist/core/extensions/capability-usage.js +4 -3
- package/dist/core/extensions/contribution-inventory.d.ts +1 -0
- package/dist/core/extensions/contribution-inventory.js +6 -2
- package/dist/core/extensions/extension-registries.js +3 -2
- package/dist/core/extensions/extension-types.d.ts +83 -1
- package/dist/core/extensions/extension-types.js +3 -2
- package/dist/core/extensions/loader.d.ts +2 -8
- package/dist/core/extensions/loader.js +53 -144
- package/dist/core/extensions/registration-values.d.ts +43 -0
- package/dist/core/extensions/registration-values.js +210 -0
- package/dist/core/extensions/runtime-registrations.d.ts +3 -1
- package/dist/core/extensions/runtime-registrations.js +12 -2
- package/dist/core/fs/fs-utils.d.ts +2 -0
- package/dist/core/fs/fs-utils.js +7 -3
- package/dist/core/history/drift-cache.js +4 -3
- package/dist/core/history/drift-scan.js +5 -11
- package/dist/core/lock/lock-gc.js +8 -13
- package/dist/core/lock/lock.js +5 -4
- package/dist/core/search/vector-stores.js +6 -11
- package/dist/core/store/item-metadata-cache.js +4 -4
- package/dist/core/telemetry/runtime.d.ts +6 -0
- package/dist/core/telemetry/runtime.js +101 -30
- package/dist/sdk/agent/command-recovery.d.ts +2 -0
- package/dist/sdk/agent/command-recovery.js +10 -2
- package/dist/sdk/annotations.js +4 -4
- package/dist/sdk/cli-contracts/completeness.js +9 -3
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +6 -3
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +32 -0
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +25 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +35 -5
- package/dist/sdk/cli-contracts/tool-schema.js +17 -2
- package/dist/sdk/comments.js +4 -3
- package/dist/sdk/compile-cache.js +4 -3
- package/dist/sdk/compose.d.ts +3 -1
- package/dist/sdk/compose.js +16 -2
- package/dist/sdk/context-signal-store.js +4 -3
- package/dist/sdk/extension/install-runtime.js +4 -4
- package/dist/sdk/extension/managed-state.js +4 -3
- package/dist/sdk/extension-contracts.d.ts +1 -1
- package/dist/sdk/flag-invocation-contracts.js +5 -6
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
- package/dist/sdk/governance/assurance-action.d.ts +27 -3
- package/dist/sdk/governance/assurance-action.js +112 -28
- package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
- package/dist/sdk/governance/assurance-mutation-error.js +25 -2
- package/dist/sdk/governance/assurance-presets.d.ts +54 -0
- package/dist/sdk/governance/assurance-presets.js +136 -0
- package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
- package/dist/sdk/governance/assurance-runtime.js +109 -8
- package/dist/sdk/governance/assurance.d.ts +39 -0
- package/dist/sdk/governance/assurance.js +143 -4
- package/dist/sdk/governance/gc.js +5 -11
- package/dist/sdk/governance/health.js +5 -5
- package/dist/sdk/governance/validate.js +4 -4
- package/dist/sdk/graph/durable-cache.js +61 -3
- package/dist/sdk/graph/governance-contracts.d.ts +12 -0
- package/dist/sdk/graph/governance-contracts.js +27 -0
- package/dist/sdk/graph/governance.d.ts +30 -2
- package/dist/sdk/graph/governance.js +124 -5
- package/dist/sdk/guide.js +4 -4
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +4 -3
- package/dist/sdk/linked-artifacts.d.ts +2 -0
- package/dist/sdk/linked-artifacts.js +29 -4
- package/dist/sdk/merge/install.js +5 -4
- package/dist/sdk/query/activity.js +4 -3
- package/dist/sdk/relationship-history.js +5 -5
- package/dist/sdk/schema-migration.js +4 -4
- package/dist/sdk/test/execution.js +4 -4
- package/dist/sdk/workspace-memory.js +4 -4
- package/dist/sdk/workspace-snapshot.js +8 -14
- package/dist/sdk/workspace-transaction-gc.js +4 -9
- package/dist/sdk/workspace-transaction.js +4 -4
- package/dist/sdk/workspace.js +4 -3
- package/docs/ASSURANCE.md +154 -3
- package/docs/CONFIGURATION.md +2 -0
- package/docs/EXTENSIONS.md +11 -12
- package/docs/RELATIONSHIP_GRAPH.md +15 -0
- package/docs/SDK.md +17 -3
- package/docs/TESTING.md +24 -15
- package/marketplace.json +2 -2
- package/package.json +3 -3
- 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 +183 -33
- package/dist/cli-bundle/chunks/chunk-3PS7X6GS.js +0 -8
- package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +0 -13
- package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +0 -33
- package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +0 -196
- package/dist/cli-bundle/chunks/chunk-R76342NV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-NBLUKITQ.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +0 -31
- package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +0 -17
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/extensions/registration-values
|
|
3
|
+
*
|
|
4
|
+
* Preserves executable extension registrations while producing deterministic,
|
|
5
|
+
* serializable public inventory snapshots and validates assurance providers.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7316b9ef-38e1-5ee0-9107-da15ec7804d4")}catch(e){}}();
|
|
9
|
+
import { KNOWN_EXTENSION_SERVICE_NAMES, } from "./extension-types.js";
|
|
10
|
+
import { asRegistrationRecord, assertOptionalBooleanField, assertOptionalStringField, } from "./registration-validation.js";
|
|
11
|
+
import { normalizeCommandName } from "./extension-runtime-helpers.js";
|
|
12
|
+
/** Narrow a string to a renderer format accepted by the extension host. */
|
|
13
|
+
export function isOutputRendererFormat(value) {
|
|
14
|
+
return value === "toon" || value === "json";
|
|
15
|
+
}
|
|
16
|
+
/** Narrow a string to a service name accepted by the extension host. */
|
|
17
|
+
export function isExtensionServiceName(value) {
|
|
18
|
+
return KNOWN_EXTENSION_SERVICE_NAMES.includes(value);
|
|
19
|
+
}
|
|
20
|
+
/** Require a callable lifecycle hook before registry mutation. */
|
|
21
|
+
export function assertHookHandler(hookName, hook) {
|
|
22
|
+
if (typeof hook !== "function") {
|
|
23
|
+
throw new TypeError(`api.hooks.${hookName} requires a function handler`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const EXTENSION_REGISTRATION_TRACE_SYMBOL = Symbol("extension_registration_trace");
|
|
27
|
+
/** Create a validation error carrying a hidden structured activation trace. */
|
|
28
|
+
export function createRegistrationValidationError(message, trace) {
|
|
29
|
+
const error = new TypeError(message);
|
|
30
|
+
Object.defineProperty(error, EXTENSION_REGISTRATION_TRACE_SYMBOL, {
|
|
31
|
+
value: trace,
|
|
32
|
+
enumerable: false,
|
|
33
|
+
configurable: false,
|
|
34
|
+
writable: false,
|
|
35
|
+
});
|
|
36
|
+
return error;
|
|
37
|
+
}
|
|
38
|
+
/** Recover a hidden structured activation trace from a validation error. */
|
|
39
|
+
export function extractRegistrationValidationTrace(error) {
|
|
40
|
+
return error instanceof Error
|
|
41
|
+
? error[EXTENSION_REGISTRATION_TRACE_SYMBOL]
|
|
42
|
+
: undefined;
|
|
43
|
+
}
|
|
44
|
+
/** Recursively project an arbitrary registration value into serializable data. */
|
|
45
|
+
export function sanitizeRegistrationValue(value) {
|
|
46
|
+
if (value === null)
|
|
47
|
+
return null;
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
return value.map((entry) => sanitizeRegistrationValue(entry));
|
|
50
|
+
}
|
|
51
|
+
if (typeof value === "function")
|
|
52
|
+
return "[Function]";
|
|
53
|
+
if (typeof value === "bigint" || typeof value === "symbol") {
|
|
54
|
+
return value.toString();
|
|
55
|
+
}
|
|
56
|
+
if (typeof value === "object") {
|
|
57
|
+
const record = value;
|
|
58
|
+
const normalized = {};
|
|
59
|
+
for (const key of Object.keys(record).sort((left, right) => left.localeCompare(right))) {
|
|
60
|
+
normalized[key] = sanitizeRegistrationValue(record[key]);
|
|
61
|
+
}
|
|
62
|
+
return normalized;
|
|
63
|
+
}
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
/** Recursively clone registration containers while preserving function identities. */
|
|
67
|
+
export function cloneRuntimeRegistrationValue(value) {
|
|
68
|
+
if (Array.isArray(value)) {
|
|
69
|
+
return value.map((entry) => cloneRuntimeRegistrationValue(entry));
|
|
70
|
+
}
|
|
71
|
+
if (typeof value === "object" && value !== null) {
|
|
72
|
+
const record = value;
|
|
73
|
+
const cloned = {};
|
|
74
|
+
for (const key of Object.keys(record).sort((left, right) => left.localeCompare(right))) {
|
|
75
|
+
cloned[key] = cloneRuntimeRegistrationValue(record[key]);
|
|
76
|
+
}
|
|
77
|
+
return cloned;
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
/** Create a deterministic serializable registration snapshot with functions redacted. */
|
|
82
|
+
export function normalizeRegistrationRecord(name, value) {
|
|
83
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
84
|
+
throw new TypeError(`${name} requires an object definition`);
|
|
85
|
+
}
|
|
86
|
+
return sanitizeRegistrationValue(value);
|
|
87
|
+
}
|
|
88
|
+
/** Clone a registration record without stripping executable function values. */
|
|
89
|
+
export function normalizeRuntimeRegistrationRecord(name, value) {
|
|
90
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
91
|
+
throw new TypeError(`${name} requires an object definition`);
|
|
92
|
+
}
|
|
93
|
+
return cloneRuntimeRegistrationValue(value);
|
|
94
|
+
}
|
|
95
|
+
/** Implement the typed and untyped registration-array normalization overloads. */
|
|
96
|
+
export function normalizeRegistrationRecordList(name, value) {
|
|
97
|
+
if (!Array.isArray(value)) {
|
|
98
|
+
throw new TypeError(`${name} requires an array of object definitions`);
|
|
99
|
+
}
|
|
100
|
+
return value.map((entry) => normalizeRegistrationRecord(name, entry));
|
|
101
|
+
}
|
|
102
|
+
/** Require a trimmed non-empty string at an extension authoring boundary. */
|
|
103
|
+
export function assertNonEmptyRegistrationString(name, value) {
|
|
104
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
105
|
+
throw new TypeError(`${name} requires a non-empty string`);
|
|
106
|
+
}
|
|
107
|
+
return value.trim();
|
|
108
|
+
}
|
|
109
|
+
/** Require an executable handler at an extension authoring boundary. */
|
|
110
|
+
export function assertRegistrationFunction(name, value) {
|
|
111
|
+
if (typeof value !== "function") {
|
|
112
|
+
throw new TypeError(`${name} requires a function handler`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** Canonicalize a user-facing registration name for stable routing. */
|
|
116
|
+
export function normalizeRegistrationName(name) {
|
|
117
|
+
return name
|
|
118
|
+
.trim()
|
|
119
|
+
.toLowerCase()
|
|
120
|
+
.split(/\s+/)
|
|
121
|
+
.filter((part) => part.length > 0)
|
|
122
|
+
.join(" ");
|
|
123
|
+
}
|
|
124
|
+
/** Build the canonical command path synthesized for an importer or exporter. */
|
|
125
|
+
export function toRegistrationCommandPath(name, action) {
|
|
126
|
+
return normalizeCommandName(`${name} ${action}`);
|
|
127
|
+
}
|
|
128
|
+
/** Attach an executable definition as hidden immutable runtime-only state. */
|
|
129
|
+
export function attachRuntimeDefinition(entry, runtimeDefinition) {
|
|
130
|
+
Object.defineProperty(entry, "runtime_definition", {
|
|
131
|
+
value: runtimeDefinition,
|
|
132
|
+
enumerable: false,
|
|
133
|
+
writable: false,
|
|
134
|
+
configurable: false,
|
|
135
|
+
});
|
|
136
|
+
return entry;
|
|
137
|
+
}
|
|
138
|
+
const ASSURANCE_PROVIDER_COST_CLASSES = new Set(["low", "medium", "high"]);
|
|
139
|
+
const ASSURANCE_PROVIDER_VALUE_TYPES = new Set(["number", "string_set"]);
|
|
140
|
+
const ASSURANCE_PROVIDER_PARAMETER_TYPES = new Set([
|
|
141
|
+
"string",
|
|
142
|
+
"number",
|
|
143
|
+
"boolean",
|
|
144
|
+
]);
|
|
145
|
+
function nonEmptyString(label, value) {
|
|
146
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
147
|
+
throw new TypeError(`${label} requires a non-empty string`);
|
|
148
|
+
}
|
|
149
|
+
return value.trim();
|
|
150
|
+
}
|
|
151
|
+
function validateAssuranceProviderKey(providerId, key, definition) {
|
|
152
|
+
const label = `registerAssuranceMeasurementProvider provider.keys.${key}`;
|
|
153
|
+
const record = asRegistrationRecord(label, definition);
|
|
154
|
+
if (!ASSURANCE_PROVIDER_VALUE_TYPES.has(String(record.value_type))) {
|
|
155
|
+
throw new TypeError(`${label}.value_type must be number or string_set`);
|
|
156
|
+
}
|
|
157
|
+
assertOptionalStringField(`${label}.description`, record.description);
|
|
158
|
+
if (record.parameters === undefined)
|
|
159
|
+
return;
|
|
160
|
+
const parameters = asRegistrationRecord(`${label}.parameters`, record.parameters);
|
|
161
|
+
for (const [parameter, rawDefinition] of Object.entries(parameters)) {
|
|
162
|
+
const parameterLabel = `${label}.parameters.${parameter}`;
|
|
163
|
+
nonEmptyString(`${parameterLabel}.name`, parameter);
|
|
164
|
+
const parameterDefinition = asRegistrationRecord(parameterLabel, rawDefinition);
|
|
165
|
+
if (!ASSURANCE_PROVIDER_PARAMETER_TYPES.has(String(parameterDefinition.type))) {
|
|
166
|
+
throw new TypeError(`${parameterLabel}.type must be string, number, or boolean`);
|
|
167
|
+
}
|
|
168
|
+
assertOptionalBooleanField(`${parameterLabel}.required`, parameterDefinition.required);
|
|
169
|
+
assertOptionalStringField(`${parameterLabel}.description`, parameterDefinition.description);
|
|
170
|
+
}
|
|
171
|
+
if (Object.keys(parameters).length > 50) {
|
|
172
|
+
throw new TypeError(`assurance provider ${providerId} key ${key} exceeds 50 parameters`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/** Validate the closed provider schema before any activation registry mutation. */
|
|
176
|
+
export function validateAssuranceMeasurementProviderDefinition(provider) {
|
|
177
|
+
const record = asRegistrationRecord("registerAssuranceMeasurementProvider provider", provider);
|
|
178
|
+
const id = nonEmptyString("registerAssuranceMeasurementProvider provider.id", record.id);
|
|
179
|
+
if (!/^[a-z0-9][a-z0-9-]*$/u.test(id)) {
|
|
180
|
+
throw new TypeError("registerAssuranceMeasurementProvider provider.id must be a stable lowercase id");
|
|
181
|
+
}
|
|
182
|
+
if (!ASSURANCE_PROVIDER_COST_CLASSES.has(String(record.cost_class))) {
|
|
183
|
+
throw new TypeError("registerAssuranceMeasurementProvider provider.cost_class must be low, medium, or high");
|
|
184
|
+
}
|
|
185
|
+
if (typeof record.network !== "boolean") {
|
|
186
|
+
throw new TypeError("registerAssuranceMeasurementProvider provider.network must be boolean");
|
|
187
|
+
}
|
|
188
|
+
const keys = asRegistrationRecord("registerAssuranceMeasurementProvider provider.keys", record.keys);
|
|
189
|
+
if (Object.keys(keys).length === 0) {
|
|
190
|
+
throw new TypeError("registerAssuranceMeasurementProvider provider.keys requires at least one key");
|
|
191
|
+
}
|
|
192
|
+
for (const [key, definition] of Object.entries(keys)) {
|
|
193
|
+
if (!/^[a-z0-9][a-z0-9-]*$/u.test(key)) {
|
|
194
|
+
throw new TypeError(`registerAssuranceMeasurementProvider provider key ${key} must be a stable lowercase id`);
|
|
195
|
+
}
|
|
196
|
+
validateAssuranceProviderKey(id, key, definition);
|
|
197
|
+
}
|
|
198
|
+
if (record.timeout_ms !== undefined &&
|
|
199
|
+
(typeof record.timeout_ms !== "number" ||
|
|
200
|
+
!Number.isInteger(record.timeout_ms) ||
|
|
201
|
+
record.timeout_ms < 1 ||
|
|
202
|
+
record.timeout_ms > 300_000)) {
|
|
203
|
+
throw new TypeError("registerAssuranceMeasurementProvider provider.timeout_ms must be an integer from 1 through 300000");
|
|
204
|
+
}
|
|
205
|
+
if (typeof record.resolve !== "function") {
|
|
206
|
+
throw new TypeError("registerAssuranceMeasurementProvider provider.resolve requires a function handler");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=registration-values.js.map
|
|
210
|
+
//# debugId=7316b9ef-38e1-5ee0-9107-da15ec7804d4
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Implements extension runtime contracts and governance for Runtime Registrations.
|
|
5
5
|
*/
|
|
6
|
-
import type { ExtensionRegistrationRegistry, RegisteredExtensionSchemaMigrationDefinition, RegisteredExtensionSearchProvider, RegisteredExtensionVectorStoreAdapter, SchemaFieldDefinition } from "./loader.js";
|
|
6
|
+
import type { ExtensionRegistrationRegistry, RegisteredExtensionSchemaMigrationDefinition, RegisteredExtensionSearchProvider, RegisteredExtensionVectorStoreAdapter, RegisteredExtensionAssuranceMeasurementProvider, SchemaFieldDefinition } from "./loader.js";
|
|
7
|
+
/** Resolve the last-activated assurance provider with the requested stable id. */
|
|
8
|
+
export declare function resolveRegisteredAssuranceMeasurementProvider(registrations: ExtensionRegistrationRegistry | null, providerId: string | undefined): RegisteredExtensionAssuranceMeasurementProvider | null;
|
|
7
9
|
/** Implements collect registered item fields for the public runtime surface of this module. */
|
|
8
10
|
export declare function collectRegisteredItemFields(registrations: ExtensionRegistrationRegistry | null): SchemaFieldDefinition[];
|
|
9
11
|
/** Implements resolve registered search provider for the public runtime surface of this module. */
|
|
@@ -1,5 +1,5 @@
|
|
|
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]="ab276268-7a98-5f97-b3f5-300dfd1b5ed5")}catch(e){}}();
|
|
3
3
|
function normalizeRegistrationName(value) {
|
|
4
4
|
if (typeof value !== "string") {
|
|
5
5
|
return null;
|
|
@@ -7,6 +7,16 @@ function normalizeRegistrationName(value) {
|
|
|
7
7
|
const normalized = value.trim().toLowerCase();
|
|
8
8
|
return normalized.length > 0 ? normalized : null;
|
|
9
9
|
}
|
|
10
|
+
/** Resolve the last-activated assurance provider with the requested stable id. */
|
|
11
|
+
export function resolveRegisteredAssuranceMeasurementProvider(registrations, providerId) {
|
|
12
|
+
const normalizedId = normalizeRegistrationName(providerId);
|
|
13
|
+
if (!registrations || !normalizedId)
|
|
14
|
+
return null;
|
|
15
|
+
return ([...(registrations.assurance_providers ?? [])]
|
|
16
|
+
.reverse()
|
|
17
|
+
.find((registration) => normalizeRegistrationName(registration.definition.id) ===
|
|
18
|
+
normalizedId) ?? null);
|
|
19
|
+
}
|
|
10
20
|
/** Implements collect registered item fields for the public runtime surface of this module. */
|
|
11
21
|
export function collectRegisteredItemFields(registrations) {
|
|
12
22
|
if (!registrations) {
|
|
@@ -55,4 +65,4 @@ export function getMigrationRuntimeDefinition(migration) {
|
|
|
55
65
|
return migration.runtime_definition ?? migration.definition;
|
|
56
66
|
}
|
|
57
67
|
//# sourceMappingURL=runtime-registrations.js.map
|
|
58
|
-
//# debugId=
|
|
68
|
+
//# debugId=ab276268-7a98-5f97-b3f5-300dfd1b5ed5
|
|
@@ -12,6 +12,8 @@ export declare function pathExists(targetPath: string): Promise<boolean>;
|
|
|
12
12
|
* runtime fault instead of reaching the caller's own root validation.
|
|
13
13
|
*/
|
|
14
14
|
export declare function isFileAbsentError(error: unknown): boolean;
|
|
15
|
+
/** Report an exact missing-entry race while preserving ENOTDIR as structural corruption. */
|
|
16
|
+
export declare function isFileMissingError(error: unknown): boolean;
|
|
15
17
|
/** Implements read file if exists for the public runtime surface of this module. */
|
|
16
18
|
export declare function readFileIfExists(targetPath: string): Promise<string | null>;
|
|
17
19
|
/** Implements write file atomic for the public runtime surface of this module. */
|
package/dist/core/fs/fs-utils.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides filesystem helpers for Fs Utils.
|
|
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]="23fc5fcb-5c80-57ab-8d91-8d15ee35ab53")}catch(e){}}();
|
|
8
8
|
import * as fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import crypto from "node:crypto";
|
|
@@ -33,7 +33,11 @@ export async function pathExists(targetPath) {
|
|
|
33
33
|
* runtime fault instead of reaching the caller's own root validation.
|
|
34
34
|
*/
|
|
35
35
|
export function isFileAbsentError(error) {
|
|
36
|
-
return
|
|
36
|
+
return isFileMissingError(error) || isErrno(error, "ENOTDIR");
|
|
37
|
+
}
|
|
38
|
+
/** Report an exact missing-entry race while preserving ENOTDIR as structural corruption. */
|
|
39
|
+
export function isFileMissingError(error) {
|
|
40
|
+
return isErrno(error, "ENOENT");
|
|
37
41
|
}
|
|
38
42
|
/** Implements read file if exists for the public runtime surface of this module. */
|
|
39
43
|
export async function readFileIfExists(targetPath) {
|
|
@@ -152,4 +156,4 @@ function isErrno(error, code) {
|
|
|
152
156
|
error.code === code);
|
|
153
157
|
}
|
|
154
158
|
//# sourceMappingURL=fs-utils.js.map
|
|
155
|
-
//# debugId=
|
|
159
|
+
//# debugId=23fc5fcb-5c80-57ab-8d91-8d15ee35ab53
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Invalidates derived history-chain verification state after committed writes.
|
|
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]="5121b339-6594-58ec-b479-11cbf7dafd27")}catch(e){}}();
|
|
8
|
+
import { isFileMissingError } from "../fs/fs-utils.js";
|
|
8
9
|
import fs from "node:fs/promises";
|
|
9
10
|
import path from "node:path";
|
|
10
11
|
import { writeStderr } from "../output/output.js";
|
|
@@ -49,7 +50,7 @@ export async function invalidateHistoryDriftCache(pmRoot) {
|
|
|
49
50
|
}
|
|
50
51
|
catch (error) {
|
|
51
52
|
const errorCode = getFilesystemErrorCode(error);
|
|
52
|
-
if (
|
|
53
|
+
if (isFileMissingError(error)) {
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
56
|
const code = errorCode === undefined
|
|
@@ -69,4 +70,4 @@ export async function invalidateHistoryDriftCacheForPath(historyPath) {
|
|
|
69
70
|
await invalidateHistoryDriftCache(path.dirname(historyDirectory));
|
|
70
71
|
}
|
|
71
72
|
//# sourceMappingURL=drift-cache.js.map
|
|
72
|
-
//# debugId=
|
|
73
|
+
//# debugId=5121b339-6594-58ec-b479-11cbf7dafd27
|
|
@@ -1,10 +1,10 @@
|
|
|
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]="a6714da6-6e2b-5647-bfde-607a54d7e4cd")}catch(e){}}();
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { getHistoryPath } from "../store/paths.js";
|
|
7
|
-
import { writeFileAtomic } from "../fs/fs-utils.js";
|
|
7
|
+
import { isFileMissingError, writeFileAtomic } from "../fs/fs-utils.js";
|
|
8
8
|
import { CURRENT_HISTORY_ITEM_HASH_VERSION, hashDocumentForVersion, } from "./history.js";
|
|
9
9
|
import { verifyHistoryChainWithVersion } from "./replay.js";
|
|
10
10
|
import { getWorkspaceHistoryPath, WORKSPACE_HISTORY_ID, } from "./workspace-history.js";
|
|
@@ -28,12 +28,6 @@ async function loadDriftCache(pmRoot) {
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
function isErrno(error, code) {
|
|
32
|
-
return (typeof error === "object" &&
|
|
33
|
-
error !== null &&
|
|
34
|
-
"code" in error &&
|
|
35
|
-
error.code === code);
|
|
36
|
-
}
|
|
37
31
|
async function scanWorkspaceHistory(pmRoot, previousEntries, nextEntries, verifyCacheHitByContent, accumulator) {
|
|
38
32
|
const historyPath = getWorkspaceHistoryPath(pmRoot);
|
|
39
33
|
let stat;
|
|
@@ -41,7 +35,7 @@ async function scanWorkspaceHistory(pmRoot, previousEntries, nextEntries, verify
|
|
|
41
35
|
stat = await fs.stat(historyPath);
|
|
42
36
|
}
|
|
43
37
|
catch (error) {
|
|
44
|
-
if (
|
|
38
|
+
if (isFileMissingError(error))
|
|
45
39
|
return false;
|
|
46
40
|
accumulator.unreadableStreams.push(WORKSPACE_HISTORY_ID);
|
|
47
41
|
return false;
|
|
@@ -210,7 +204,7 @@ export async function scanHistoryDrift(pmRoot, items, options = {}) {
|
|
|
210
204
|
stat = await fs.stat(historyPath);
|
|
211
205
|
}
|
|
212
206
|
catch (error) {
|
|
213
|
-
if (
|
|
207
|
+
if (isFileMissingError(error)) {
|
|
214
208
|
accumulator.missingStreams.push(item.id);
|
|
215
209
|
}
|
|
216
210
|
else {
|
|
@@ -276,4 +270,4 @@ export async function scanHistoryDrift(pmRoot, items, options = {}) {
|
|
|
276
270
|
return { ...accumulator, driftedItems };
|
|
277
271
|
}
|
|
278
272
|
//# sourceMappingURL=drift-scan.js.map
|
|
279
|
-
//# debugId=
|
|
273
|
+
//# debugId=a6714da6-6e2b-5647-bfde-607a54d7e4cd
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* Zero ttl means any lock older than 0 ms is stale. Negative ttl means always stale.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
!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]="
|
|
12
|
+
!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]="79f9ccbd-48d1-5eb3-82ae-3dd62427041c")}catch(e){}}();
|
|
13
|
+
import { isFileMissingError } from "../fs/fs-utils.js";
|
|
13
14
|
import fs from "node:fs/promises";
|
|
14
15
|
import path from "node:path";
|
|
15
16
|
function parseLock(raw) {
|
|
@@ -34,12 +35,6 @@ function parseLock(raw) {
|
|
|
34
35
|
}
|
|
35
36
|
return { id, owner, created_at, ttl_seconds };
|
|
36
37
|
}
|
|
37
|
-
function isErrno(error, code) {
|
|
38
|
-
return (typeof error === "object" &&
|
|
39
|
-
error !== null &&
|
|
40
|
-
"code" in error &&
|
|
41
|
-
error.code === code);
|
|
42
|
-
}
|
|
43
38
|
/** Pure classification of one lock file's raw content against `nowMs`. This is the single staleness/parse policy shared by `pm gc --scope locks` (which acts on it) and the `pm health` locks check (which only reports it). */
|
|
44
39
|
export function classifyLockContent(file, raw, nowMs) {
|
|
45
40
|
const lock = parseLock(raw);
|
|
@@ -108,7 +103,7 @@ export async function scanLockHealth(pmRoot, now) {
|
|
|
108
103
|
dirEntries = rawDir.filter((f) => f.endsWith(".lock")).sort();
|
|
109
104
|
}
|
|
110
105
|
catch (error) {
|
|
111
|
-
if (
|
|
106
|
+
if (isFileMissingError(error)) {
|
|
112
107
|
return scan;
|
|
113
108
|
}
|
|
114
109
|
throw error;
|
|
@@ -119,7 +114,7 @@ export async function scanLockHealth(pmRoot, now) {
|
|
|
119
114
|
raw = await fs.readFile(path.join(locksDir, file), "utf8");
|
|
120
115
|
}
|
|
121
116
|
catch (readError) {
|
|
122
|
-
if (
|
|
117
|
+
if (isFileMissingError(readError)) {
|
|
123
118
|
// Disappeared between readdir and readFile — treat as a ghost; skip quietly.
|
|
124
119
|
continue;
|
|
125
120
|
}
|
|
@@ -159,7 +154,7 @@ export async function runLockGc(pmRoot, options) {
|
|
|
159
154
|
dirEntries = raw.filter((f) => f.endsWith(".lock")).sort();
|
|
160
155
|
}
|
|
161
156
|
catch (error) {
|
|
162
|
-
if (
|
|
157
|
+
if (isFileMissingError(error)) {
|
|
163
158
|
return result;
|
|
164
159
|
}
|
|
165
160
|
throw error;
|
|
@@ -179,7 +174,7 @@ export async function runLockGc(pmRoot, options) {
|
|
|
179
174
|
raw = await fs.readFile(absPath, "utf8");
|
|
180
175
|
}
|
|
181
176
|
catch (readError) {
|
|
182
|
-
if (
|
|
177
|
+
if (isFileMissingError(readError)) {
|
|
183
178
|
// Disappeared between readdir and readFile — treat as a ghost; skip quietly.
|
|
184
179
|
result.scanned -= 1;
|
|
185
180
|
continue;
|
|
@@ -223,7 +218,7 @@ export async function runLockGc(pmRoot, options) {
|
|
|
223
218
|
await fs.unlink(absPath);
|
|
224
219
|
}
|
|
225
220
|
catch (unlinkError) {
|
|
226
|
-
if (!
|
|
221
|
+
if (!isFileMissingError(unlinkError)) {
|
|
227
222
|
result.warnings.push(`lock_remove_failed:${file}`);
|
|
228
223
|
result.retained.push(relPath);
|
|
229
224
|
result.entries.push(classified.entry);
|
|
@@ -243,4 +238,4 @@ export async function runLockGc(pmRoot, options) {
|
|
|
243
238
|
return result;
|
|
244
239
|
}
|
|
245
240
|
//# sourceMappingURL=lock-gc.js.map
|
|
246
|
-
//# debugId=
|
|
241
|
+
//# debugId=79f9ccbd-48d1-5eb3-82ae-3dd62427041c
|
package/dist/core/lock/lock.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Coordinates tracker lock ownership and cleanup for Lock.
|
|
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]="a9ad8a9f-de6e-5bce-8685-844f1129d5fb")}catch(e){}}();
|
|
8
|
+
import { isFileMissingError } from "../fs/fs-utils.js";
|
|
8
9
|
import fs from "node:fs/promises";
|
|
9
10
|
import path from "node:path";
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
@@ -70,7 +71,7 @@ async function readLockInfo(lockPath) {
|
|
|
70
71
|
return parseLockInfo(raw);
|
|
71
72
|
}
|
|
72
73
|
catch (error) {
|
|
73
|
-
if (
|
|
74
|
+
if (isFileMissingError(error)) {
|
|
74
75
|
return {
|
|
75
76
|
info: null,
|
|
76
77
|
warnings: [],
|
|
@@ -294,7 +295,7 @@ async function removeExpiredStaleCleanupGate(gatePath) {
|
|
|
294
295
|
}
|
|
295
296
|
}
|
|
296
297
|
catch (error) {
|
|
297
|
-
return
|
|
298
|
+
return isFileMissingError(error);
|
|
298
299
|
}
|
|
299
300
|
const owner = await readStaleCleanupGateOwner(gatePath);
|
|
300
301
|
if (owner !== null &&
|
|
@@ -446,4 +447,4 @@ export async function acquireLock(pmRoot, id, ttlSeconds, owner, force = false,
|
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
449
|
//# sourceMappingURL=lock.js.map
|
|
449
|
-
//# debugId=
|
|
450
|
+
//# debugId=a9ad8a9f-de6e-5bce-8685-844f1129d5fb
|
|
@@ -1,10 +1,10 @@
|
|
|
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]="98c8d03c-bdde-5ac4-b80d-395d885f7442")}catch(e){}}();
|
|
3
3
|
import { mkdir, readFile, stat, unlink } from "node:fs/promises";
|
|
4
4
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
5
5
|
import { executeSearchJsonRequest, normalizeSearchHttpTimeoutMs, resolveSearchHttpFetcher, } from "./http-client.js";
|
|
6
6
|
import { isFiniteNumberArray, toErrorMessage, toNonEmptyString, trimTrailingSlashes, } from "../shared/primitives.js";
|
|
7
|
-
import { writeFileAtomic } from "../fs/fs-utils.js";
|
|
7
|
+
import { isFileMissingError, writeFileAtomic } from "../fs/fs-utils.js";
|
|
8
8
|
const DEFAULT_COLLECTION = "pm_items";
|
|
9
9
|
const COLLECTION_SANITIZE_PATTERN = /[^a-zA-Z0-9_-]/g;
|
|
10
10
|
const MAX_COLLECTION_NAME_LENGTH = 128;
|
|
@@ -200,11 +200,6 @@ function getLanceDbLocalTableKey(storePath, table) {
|
|
|
200
200
|
function getLanceDbSnapshotPath(storePath, table) {
|
|
201
201
|
return join(resolve(storePath), LANCE_DB_LOCAL_SNAPSHOT_DIR, `${table}.json`);
|
|
202
202
|
}
|
|
203
|
-
function isNodeErrorWithCode(error, code) {
|
|
204
|
-
return (typeof error === "object" &&
|
|
205
|
-
error !== null &&
|
|
206
|
-
error.code === code);
|
|
207
|
-
}
|
|
208
203
|
function normalizeSnapshotRecord(entry, index, snapshotPath) {
|
|
209
204
|
const id = toNonEmptyString(entry.id);
|
|
210
205
|
if (!id) {
|
|
@@ -261,7 +256,7 @@ async function readLanceDbSnapshotStats(snapshotPath) {
|
|
|
261
256
|
return { mtimeMs: stats.mtimeMs, size: stats.size };
|
|
262
257
|
}
|
|
263
258
|
catch (error) {
|
|
264
|
-
if (!
|
|
259
|
+
if (!isFileMissingError(error)) {
|
|
265
260
|
throw error;
|
|
266
261
|
}
|
|
267
262
|
return null;
|
|
@@ -306,7 +301,7 @@ async function loadLanceDbLocalTable(storePath, table) {
|
|
|
306
301
|
loaded = parseLanceDbSnapshot(snapshotPath, table, raw);
|
|
307
302
|
}
|
|
308
303
|
catch (error) {
|
|
309
|
-
if (!
|
|
304
|
+
if (!isFileMissingError(error)) {
|
|
310
305
|
throw error;
|
|
311
306
|
}
|
|
312
307
|
}
|
|
@@ -331,7 +326,7 @@ async function removeSnapshotFile(snapshotPath) {
|
|
|
331
326
|
await unlink(snapshotPath);
|
|
332
327
|
}
|
|
333
328
|
catch (error) {
|
|
334
|
-
if (!
|
|
329
|
+
if (!isFileMissingError(error)) {
|
|
335
330
|
throw new Error(`LanceDB local snapshot delete failed at '${snapshotPath}': ${toErrorMessage(error)}`);
|
|
336
331
|
}
|
|
337
332
|
}
|
|
@@ -667,4 +662,4 @@ export async function executeVectorReset(store, knownIds = [], options = {}, vec
|
|
|
667
662
|
return await executeVectorDelete(store, idsToDelete, options);
|
|
668
663
|
}
|
|
669
664
|
//# sourceMappingURL=vector-stores.js.map
|
|
670
|
-
//# debugId=
|
|
665
|
+
//# debugId=98c8d03c-bdde-5ac4-b80d-395d885f7442
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Reads and writes tracker storage with format-aware helpers for the item metadata cache.
|
|
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]="8b8c705a-8d80-576f-8642-f6f686cdbed9")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -12,7 +12,7 @@ import { getActiveExtensionRegistrations, hasActiveOnReadHooks, runActiveOnReadH
|
|
|
12
12
|
import { collectRegisteredItemFieldNames } from "../extensions/item-fields.js";
|
|
13
13
|
import { parseItemDocument } from "../item/item-format.js";
|
|
14
14
|
import { evictOldestMemoEntries } from "../shared/memo.js";
|
|
15
|
-
import { writeFileAtomic } from "../fs/fs-utils.js";
|
|
15
|
+
import { isFileMissingError, writeFileAtomic } from "../fs/fs-utils.js";
|
|
16
16
|
import { acquireLock } from "../lock/lock.js";
|
|
17
17
|
import { ITEM_FILE_EXTENSIONS, getItemFormatFromPath } from "./paths.js";
|
|
18
18
|
import { rebuildItemMetadataQueryIndex, removeItemMetadataQueryIndex, updateItemMetadataQueryIndex, } from "./item-metadata-query-index.js";
|
|
@@ -442,7 +442,7 @@ async function readItemDirectoryFiles(pmRoot, folder, warnings) {
|
|
|
442
442
|
if (typeof error === "object" &&
|
|
443
443
|
error !== null &&
|
|
444
444
|
"code" in error &&
|
|
445
|
-
error
|
|
445
|
+
!isFileMissingError(error)) {
|
|
446
446
|
appendWarning(warnings, `item_list_directory_read_failed:${folder}`);
|
|
447
447
|
}
|
|
448
448
|
return { folder, dirPath, files: [] };
|
|
@@ -1114,4 +1114,4 @@ export async function listAllDocumentsCachedLight(pmRoot, preferredFormat, typeT
|
|
|
1114
1114
|
}));
|
|
1115
1115
|
}
|
|
1116
1116
|
//# sourceMappingURL=item-metadata-cache.js.map
|
|
1117
|
-
//# debugId=
|
|
1117
|
+
//# debugId=8b8c705a-8d80-576f-8642-f6f686cdbed9
|
|
@@ -171,6 +171,10 @@ declare function sanitizeValue(value: unknown, keyHint?: string, captureLevel?:
|
|
|
171
171
|
declare function sanitizeCommandArgs(args: string[], captureLevel?: Exclude<TelemetryCaptureLevel, "minimal">): string[];
|
|
172
172
|
declare function normalizeCaptureLevel(value: string | undefined): TelemetryCaptureLevel;
|
|
173
173
|
declare function parseBooleanTrueLike(value: string | undefined): boolean;
|
|
174
|
+
/** Resolve the background event and OTLP request timeout within the flush-lock safety envelope. */
|
|
175
|
+
declare function resolveTelemetryHttpTimeoutMs(): number;
|
|
176
|
+
/** POST a JSON payload with one total timeout that covers DNS, connection, TLS, and response completion. */
|
|
177
|
+
declare function postTelemetryJson(endpoint: string, headers: Record<string, string>, body: string): Promise<number>;
|
|
174
178
|
declare function normalizePmVersion(value: string | undefined): string;
|
|
175
179
|
declare function normalizeTelemetryErrorCode(value: string | undefined): string | undefined;
|
|
176
180
|
declare function normalizeTelemetryExitCode(exitCode: number | undefined, ok: boolean): number;
|
|
@@ -335,11 +339,13 @@ export declare const _testOnly: {
|
|
|
335
339
|
looksLikeEmailToken: typeof looksLikeEmailToken;
|
|
336
340
|
otelSpansQueuePath: typeof otelSpansQueuePath;
|
|
337
341
|
parseBooleanTrueLike: typeof parseBooleanTrueLike;
|
|
342
|
+
postTelemetryJson: typeof postTelemetryJson;
|
|
338
343
|
parsePendingOtelSpanLines: typeof parsePendingOtelSpanLines;
|
|
339
344
|
prunePendingOtelSpans: typeof prunePendingOtelSpans;
|
|
340
345
|
reconcilePendingOtelSpansAfterFlush: typeof reconcilePendingOtelSpansAfterFlush;
|
|
341
346
|
retentionCutoffMs: typeof retentionCutoffMs;
|
|
342
347
|
resolveOtelTracesEndpoint: typeof resolveOtelTracesEndpoint;
|
|
348
|
+
resolveTelemetryHttpTimeoutMs: typeof resolveTelemetryHttpTimeoutMs;
|
|
343
349
|
rewritePendingOtelSpans: typeof rewritePendingOtelSpans;
|
|
344
350
|
normalizeForHash: typeof normalizeForHash;
|
|
345
351
|
normalizeCaptureLevel: typeof normalizeCaptureLevel;
|