@unbrained/pm-cli 2026.8.17 → 2026.8.19
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/AGENTS.md +4 -3
- package/CHANGELOG.md +51 -5
- package/README.md +3 -3
- package/dist/cli/error-guidance.js +8 -4
- 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 +138 -54
- package/dist/cli/register-mutation.js +8 -8
- package/dist/cli/register-operations.js +6 -6
- package/dist/cli-bundle/bundle-manifest.json +149 -149
- package/dist/cli-bundle/chunks/chunk-4NRRH7AM.js +2 -0
- package/dist/cli-bundle/chunks/chunk-4THEB6PD.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-HBJAS566.js → chunk-BHYMXLAE.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +197 -0
- package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +35 -0
- package/dist/cli-bundle/chunks/chunk-OI4XI562.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-3UEGXBMR.js → chunk-OIOKV6NO.js} +58 -54
- package/dist/cli-bundle/chunks/chunk-QXSH7BLM.js +3 -0
- package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-7IBRGCHX.js → chunk-TOXJM4WA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JOKATURE.js → chunk-YBMRWW4E.js} +44 -44
- package/dist/cli-bundle/chunks/register-list-query-Y56KINDU.js +11 -0
- package/dist/cli-bundle/chunks/register-mutation-AUWVCW4M.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-PZQPHXW5.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-DOSFBGKE.js → register-setup-I4LUHGVW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-34QBIYZI.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MHPIL773.js → chunk-BJRYFVSH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-DKPLYW3L.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-SALH6B6K.js → chunk-EF6ZS5GH.js} +44 -44
- package/dist/cli-bundle/focused-chunks/{chunk-XKAMP5OU.js → chunk-ESISGDAY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SYZENPIT.js → chunk-EXBCLIBU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-JDOMQ7VQ.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MCZXYZAF.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-ODHQEECS.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZQPGZZWQ.js → chunk-PRHY2IMX.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ATEY76SX.js → chunk-US7VEYZG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-VXDSU5MC.js +26 -0
- package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-CYFK5UPB.js → chunk-ZBIQQYMI.js} +2 -2
- 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 +28 -28
- 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/config/nested-settings.js +8 -2
- package/dist/core/extensions/exporter-output-contract.d.ts +12 -0
- package/dist/core/extensions/exporter-output-contract.js +67 -0
- package/dist/core/extensions/extension-types.d.ts +36 -1
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/loader.js +35 -44
- package/dist/core/history/event-index.d.ts +5 -0
- package/dist/core/history/event-index.js +133 -27
- package/dist/core/sentry/helpers.js +3 -3
- package/dist/core/shared/constants.js +5 -2
- package/dist/core/shared/errors.d.ts +2 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/settings-validator.d.ts +4 -0
- package/dist/core/store/settings-validator.js +3 -2
- package/dist/core/store/settings.js +8 -2
- package/dist/mcp/tool-definitions.js +12 -7
- package/dist/sdk/agent/refusal-closure.d.ts +41 -0
- package/dist/sdk/agent/refusal-closure.js +92 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
- package/dist/sdk/agent/refusal-reachability.js +4 -4
- package/dist/sdk/agent-capability-contracts.d.ts +13 -0
- package/dist/sdk/agent-capability-contracts.js +104 -7
- package/dist/sdk/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +2 -2
- package/dist/sdk/cli-bootstrap.d.ts +2 -2
- package/dist/sdk/cli-bootstrap.js +4 -4
- package/dist/sdk/cli-contracts/command-aliases.d.ts +34 -2
- package/dist/sdk/cli-contracts/command-aliases.js +80 -13
- 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/enum-contracts.d.ts +4 -0
- package/dist/sdk/cli-contracts/enum-contracts.js +9 -2
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +5 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +84 -13
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +55 -0
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +240 -0
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +151 -0
- package/dist/sdk/cli-contracts/grammar-contracts.js +958 -0
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +33 -5
- package/dist/sdk/cli-contracts/runtime-contracts.js +100 -23
- 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-parameter-tables.js +7 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +20 -11
- package/dist/sdk/cli-contracts.d.ts +5 -4
- package/dist/sdk/cli-contracts.js +7 -6
- package/dist/sdk/completion.js +13 -15
- package/dist/sdk/compose.d.ts +3 -3
- package/dist/sdk/compose.js +2 -2
- 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/environment/host-environment-errors.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 +186 -14
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +194 -26
- package/dist/sdk/guide-topics.js +5 -5
- package/dist/sdk/index.d.ts +10 -7
- package/dist/sdk/index.js +10 -7
- package/dist/sdk/init-agent-guidance.js +3 -3
- package/dist/sdk/mutation-events.d.ts +18 -2
- package/dist/sdk/mutation-events.js +59 -16
- package/dist/sdk/output-projection.d.ts +2 -0
- package/dist/sdk/output-projection.js +11 -5
- package/dist/sdk/output.d.ts +44 -0
- package/dist/sdk/output.js +28 -2
- package/dist/sdk/query/complete-list.d.ts +94 -0
- package/dist/sdk/query/complete-list.js +173 -0
- package/dist/sdk/query/get.js +25 -6
- package/dist/sdk/query/list.js +19 -2
- package/dist/sdk/query/search-contracts.d.ts +1 -1
- package/dist/sdk/query/search-contracts.js +23 -9
- package/dist/sdk/query/search.js +3 -3
- package/dist/sdk/query.d.ts +1 -0
- package/dist/sdk/query.js +3 -2
- 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.d.ts +2 -2
- package/dist/sdk/read-output-contracts.js +89 -13
- package/dist/sdk/read-output-rows.d.ts +4 -0
- package/dist/sdk/read-output-rows.js +47 -18
- package/dist/sdk/runtime-extended-actions.js +10 -2
- package/dist/sdk/runtime.d.ts +8 -2
- package/dist/sdk/runtime.js +18 -11
- package/dist/sdk/workspace-snapshot.d.ts +2 -0
- package/dist/sdk/workspace-snapshot.js +10 -2
- package/dist/types.d.ts +5 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_GUIDE.md +25 -9
- package/docs/CLI_GRAMMAR.md +106 -0
- package/docs/COMMANDS.md +39 -27
- package/docs/ONBOARDING.md +4 -4
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
- package/docs/QUICKSTART.md +1 -1
- package/docs/README.md +2 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
- package/docs/RELEASING.md +30 -6
- package/docs/SDK.md +42 -2
- package/docs/SDK_ARTIFACT_OUTPUT.md +72 -0
- package/docs/SDK_CONTEXT_COORDINATION.md +46 -12
- package/docs/TESTING.md +14 -1
- package/docs/agent-task-token-baseline.json +5 -5
- package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
- package/marketplace.json +2 -2
- package/package.json +5 -2
- 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 +1245 -60
- package/dist/cli-bundle/chunks/chunk-2QLOXC3V.js +0 -3
- package/dist/cli-bundle/chunks/chunk-4JPYF536.js +0 -35
- package/dist/cli-bundle/chunks/chunk-6VDLG2FC.js +0 -13
- package/dist/cli-bundle/chunks/chunk-ION3E43Q.js +0 -197
- package/dist/cli-bundle/chunks/chunk-OAC5NIV4.js +0 -3
- package/dist/cli-bundle/chunks/chunk-TPXZIBIV.js +0 -5
- package/dist/cli-bundle/chunks/chunk-YM2YAMF7.js +0 -2
- package/dist/cli-bundle/chunks/register-list-query-Q7KII4G5.js +0 -10
- package/dist/cli-bundle/chunks/register-mutation-4WBRPXLV.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-SSENDH5B.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-267MUUS6.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-2NNFLLNG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2QSAKMIH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-BUCG4ZI2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-EHXIKD6K.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KGEXTMPG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KP2VQQVQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-POEEAD2V.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-XPIC53VA.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-ZT2DJS27.js +0 -155
|
@@ -0,0 +1,67 @@
|
|
|
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]="057f439e-ac5c-5715-9fd0-4410e003d481")}catch(e){}}();
|
|
3
|
+
import { cloneContextSnapshot } from "./extension-runtime-helpers.js";
|
|
4
|
+
import { asRegistrationRecord, assertOptionalStringField, } from "./registration-validation.js";
|
|
5
|
+
/** Validates and normalizes the public artifact-channel metadata for one exporter registration. */
|
|
6
|
+
export function normalizeExporterArtifactOutput(value) {
|
|
7
|
+
const candidate = asRegistrationRecord("registerExporter options.output", value);
|
|
8
|
+
const allowedKeys = new Set(["channel", "receipt", "media_type"]);
|
|
9
|
+
for (const key of Object.keys(candidate)) {
|
|
10
|
+
if (!allowedKeys.has(key)) {
|
|
11
|
+
throw new TypeError(`registerExporter options.output contains unsupported field ${key}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (candidate.channel !== "stdout" && candidate.channel !== "file") {
|
|
15
|
+
throw new TypeError("registerExporter options.output.channel must be stdout|file");
|
|
16
|
+
}
|
|
17
|
+
if (candidate.receipt !== undefined &&
|
|
18
|
+
candidate.receipt !== "suppress" &&
|
|
19
|
+
candidate.receipt !== "render") {
|
|
20
|
+
throw new TypeError("registerExporter options.output.receipt must be suppress|render");
|
|
21
|
+
}
|
|
22
|
+
if (candidate.channel === "stdout" && candidate.receipt === "render") {
|
|
23
|
+
throw new TypeError("registerExporter stdout artifacts cannot render a host receipt");
|
|
24
|
+
}
|
|
25
|
+
assertOptionalStringField("registerExporter options.output.media_type", candidate.media_type);
|
|
26
|
+
return {
|
|
27
|
+
channel: candidate.channel,
|
|
28
|
+
receipt: candidate.receipt ??
|
|
29
|
+
(candidate.channel === "stdout" ? "suppress" : "render"),
|
|
30
|
+
...(typeof candidate.media_type === "string"
|
|
31
|
+
? { media_type: candidate.media_type }
|
|
32
|
+
: {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Enforces importer/exporter channel ownership and applies the stdout-specific derived description. */
|
|
36
|
+
export function resolveImportExportArtifactOutput(method, resolvedOptions, descriptionWasDeclared) {
|
|
37
|
+
if (method === "registerImporter" && resolvedOptions.output !== undefined) {
|
|
38
|
+
throw new TypeError("registerImporter options.output is exporter-only");
|
|
39
|
+
}
|
|
40
|
+
if (method !== "registerExporter" || resolvedOptions.output === undefined) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const output = normalizeExporterArtifactOutput(resolvedOptions.output);
|
|
44
|
+
if (!descriptionWasDeclared && output.channel === "stdout") {
|
|
45
|
+
resolvedOptions.description =
|
|
46
|
+
"Export items with the registered extension adapter. Artifact bytes are written exclusively to stdout and the host receipt is suppressed by default.";
|
|
47
|
+
}
|
|
48
|
+
return output;
|
|
49
|
+
}
|
|
50
|
+
/** Snapshots a host command invocation into the stable importer/exporter context contract. */
|
|
51
|
+
export function buildImportExportContext(context, registration, action) {
|
|
52
|
+
return {
|
|
53
|
+
registration,
|
|
54
|
+
action,
|
|
55
|
+
command: context.command,
|
|
56
|
+
args: cloneContextSnapshot(context.args),
|
|
57
|
+
options: cloneContextSnapshot(context.options),
|
|
58
|
+
global: cloneContextSnapshot(context.global),
|
|
59
|
+
pm_root: context.pm_root,
|
|
60
|
+
source_workspace_root: context.source_workspace_root,
|
|
61
|
+
repo_root: context.repo_root,
|
|
62
|
+
pm_root_rel: context.pm_root_rel,
|
|
63
|
+
...(context.sdk === undefined ? {} : { sdk: context.sdk }),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=exporter-output-contract.js.map
|
|
67
|
+
//# debugId=057f439e-ac5c-5715-9fd0-4410e003d481
|
|
@@ -715,6 +715,39 @@ export interface ImportExportRegistrationOptions {
|
|
|
715
715
|
/** Value that configures or reports flags for this contract. */
|
|
716
716
|
flags?: FlagDefinition[];
|
|
717
717
|
}
|
|
718
|
+
/**
|
|
719
|
+
* Declares where an exporter writes its artifact and whether the host may
|
|
720
|
+
* render the returned structured receipt after the exporter completes.
|
|
721
|
+
*/
|
|
722
|
+
export type ExporterArtifactOutputContract = {
|
|
723
|
+
/** Stdout exclusively carries artifact bytes. */
|
|
724
|
+
channel: "stdout";
|
|
725
|
+
/** Stdout artifacts cannot opt back into host rendering. */
|
|
726
|
+
receipt?: "suppress";
|
|
727
|
+
/** Optional IANA media type describing the emitted artifact. */
|
|
728
|
+
media_type?: string;
|
|
729
|
+
} | {
|
|
730
|
+
/** The exporter writes its artifact to a file. */
|
|
731
|
+
channel: "file";
|
|
732
|
+
/** File exporters may render or suppress their bounded receipt. */
|
|
733
|
+
receipt?: "suppress" | "render";
|
|
734
|
+
/** Optional IANA media type describing the emitted artifact. */
|
|
735
|
+
media_type?: string;
|
|
736
|
+
};
|
|
737
|
+
/** Exporter command metadata plus its optional artifact-delivery contract. */
|
|
738
|
+
export interface ExporterRegistrationOptions extends ImportExportRegistrationOptions {
|
|
739
|
+
/** Declaration for artifact bytes and the host receipt. */
|
|
740
|
+
output?: ExporterArtifactOutputContract;
|
|
741
|
+
}
|
|
742
|
+
/** Fully normalized exporter artifact contract stored in inventories. */
|
|
743
|
+
export interface RegisteredExporterArtifactOutputContract {
|
|
744
|
+
/** Destination carrying the artifact bytes. */
|
|
745
|
+
channel: "stdout" | "file";
|
|
746
|
+
/** Explicit host receipt policy after normalization. */
|
|
747
|
+
receipt: "suppress" | "render";
|
|
748
|
+
/** Optional IANA media type describing the emitted artifact. */
|
|
749
|
+
media_type?: string;
|
|
750
|
+
}
|
|
718
751
|
/** Restricts flag value type values accepted by command, SDK, and storage contracts. */
|
|
719
752
|
export type FlagValueType = "string" | "number" | "boolean";
|
|
720
753
|
/** Documents the flag definition payload exchanged by command, SDK, and package integrations. */
|
|
@@ -1288,6 +1321,8 @@ export interface RegisteredExtensionExporter {
|
|
|
1288
1321
|
name: string;
|
|
1289
1322
|
/** Value that configures or reports exporter for this contract. */
|
|
1290
1323
|
exporter: string;
|
|
1324
|
+
/** Declared artifact channel and normalized receipt policy. */
|
|
1325
|
+
output?: RegisteredExporterArtifactOutputContract;
|
|
1291
1326
|
}
|
|
1292
1327
|
/** Documents the registered extension search provider payload exchanged by command, SDK, and package integrations. */
|
|
1293
1328
|
export interface RegisteredExtensionSearchProvider {
|
|
@@ -1447,7 +1482,7 @@ export interface ExtensionApi {
|
|
|
1447
1482
|
/** Value that configures or reports register importer for this contract. */
|
|
1448
1483
|
registerImporter(name: string, importer: Importer, options?: ImportExportRegistrationOptions): void;
|
|
1449
1484
|
/** Value that configures or reports register exporter for this contract. */
|
|
1450
|
-
registerExporter(name: string, exporter: Exporter, options?:
|
|
1485
|
+
registerExporter(name: string, exporter: Exporter, options?: ExporterRegistrationOptions): void;
|
|
1451
1486
|
/** Value that configures or reports register search provider for this contract. */
|
|
1452
1487
|
registerSearchProvider(provider: SearchProviderDefinition): void;
|
|
1453
1488
|
/** Value that configures or reports register vector store adapter for this contract. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Public contract for known extension capabilities, shared by SDK and presentation-layer consumers. */
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a54549aa-2f6c-5092-a3eb-5b36ee698ea4")}catch(e){}}();
|
|
4
4
|
export const KNOWN_EXTENSION_CAPABILITIES = [
|
|
5
5
|
"commands",
|
|
6
6
|
"renderers",
|
|
@@ -100,4 +100,4 @@ export function createDefaultExtensionGovernancePolicy() {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
//# sourceMappingURL=extension-types.js.map
|
|
103
|
-
//# debugId=
|
|
103
|
+
//# debugId=a54549aa-2f6c-5092-a3eb-5b36ee698ea4
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* Implements extension runtime contracts and governance for Loader.
|
|
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]="cccce7c1-dd08-5c9f-a74e-e639536b9a6a")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { pathToFileURL } from "node:url";
|
|
11
11
|
import { pathExists } from "../fs/fs-utils.js";
|
|
12
12
|
import { isPathWithinDirectory } from "../fs/path-utils.js";
|
|
13
|
+
import { isHostOutputSuppressed, suppressHostOutput, } from "../output/output-control.js";
|
|
13
14
|
import { resolvePmPackageRootFromModule } from "../packages/root.js";
|
|
14
15
|
import { resolveGlobalPmRoot } from "../store/paths.js";
|
|
15
16
|
import { asRecordLoose, resolveActivatablePropertyRecord, } from "../shared/primitives.js";
|
|
@@ -19,6 +20,7 @@ import { snapshotExtensionModuleGraph } from "./module-graph-snapshot.js";
|
|
|
19
20
|
import { captureExtensionActivationRollback } from "./activation-transaction.js";
|
|
20
21
|
import { collectPreflightCollisionWarnings, normalizePreflightOverride, } from "./preflight-ownership.js";
|
|
21
22
|
import { assertCommandDefinitionMetadataStrings } from "./command-visibility-tier.js";
|
|
23
|
+
import { buildImportExportContext, resolveImportExportArtifactOutput, } from "./exporter-output-contract.js";
|
|
22
24
|
import { asRegistrationRecord, assertOptionalBooleanField, assertOptionalFlagDefaultField, assertOptionalStringArrayField, assertOptionalStringField, normalizeOptionalStringArrayField, } from "./registration-validation.js";
|
|
23
25
|
import { describeExtensionLongFlagFailure, findExtensionFlagTokenFailure, } from "./flag-definition-validation.js";
|
|
24
26
|
import { compareComparableVersions, evaluatePmMaxVersionBound, evaluatePmMinVersionBound, parseComparableVersion, } from "./version-compat.js";
|
|
@@ -26,7 +28,7 @@ import { createRelationshipKindRegistry, } from "../../sdk/relationships.js";
|
|
|
26
28
|
import { normalizeNames, isKnownExtensionCapability, collectUnknownExtensionCapabilities, normalizeManifestCapabilities, formatUnknownExtensionCapabilityWarning, formatLegacyExtensionCapabilityAliasWarning, } from "./extension-capability-aliases.js";
|
|
27
29
|
import { normalizeExtensionPolicy, serializeExtensionPolicy, hydrateExtensionPolicy, normalizePolicySandboxProfile, evaluateExtensionPolicyForExtension, evaluateExtensionPolicyForCapability, evaluateExtensionPolicyForRegistration, } from "./extension-policy.js";
|
|
28
30
|
import { createEmptyExtensionHookRegistry, createEmptyExtensionCommandRegistry, createEmptyExtensionParserRegistry, createEmptyExtensionPreflightRegistry, createEmptyExtensionServiceRegistry, createEmptyExtensionRendererRegistry, createEmptyExtensionRegistrationRegistry, } from "./extension-registries.js";
|
|
29
|
-
import { normalizeCommandName
|
|
31
|
+
import { normalizeCommandName } from "./extension-runtime-helpers.js";
|
|
30
32
|
import { normalizeExtensionContributionInventory } from "./contribution-inventory.js";
|
|
31
33
|
import { formatExtensionManifestSchemaWarnings } from "./manifest-schema.js";
|
|
32
34
|
import { attachRuntimeDefinition, assertHookHandler, assertNonEmptyRegistrationString, assertRegistrationFunction, cloneRuntimeRegistrationValue, createRegistrationValidationError, extractRegistrationValidationTrace, isExtensionServiceName, isOutputRendererFormat, normalizeRegistrationRecord, normalizeRegistrationRecordList, normalizeRuntimeRegistrationRecord, normalizeRegistrationName, sanitizeRegistrationValue, toRegistrationCommandPath, validateAssuranceMeasurementProviderDefinition, } from "./registration-values.js";
|
|
@@ -1727,6 +1729,23 @@ class ExtensionApiRegistrar {
|
|
|
1727
1729
|
profile: applyProjectProfileDefaults(snapshot),
|
|
1728
1730
|
});
|
|
1729
1731
|
}
|
|
1732
|
+
/** Validates and records optional importer/exporter flag metadata through the schema policy gate. */
|
|
1733
|
+
registerImportExportCommandFlags(method, commandPath, resolvedOptions) {
|
|
1734
|
+
if (resolvedOptions.flags === undefined) {
|
|
1735
|
+
return;
|
|
1736
|
+
}
|
|
1737
|
+
assertExtensionCapability(this.#loadedExtension, "schema", `${method} options.flags`);
|
|
1738
|
+
if (!this.allowRegistration("schema.flags", `${method} options.flags`, "schema")) {
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
validateFlagDefinitions(resolvedOptions.flags);
|
|
1742
|
+
this.#registrationRegistry.flags.push({
|
|
1743
|
+
layer: this.#loadedExtension.layer,
|
|
1744
|
+
name: this.#loadedExtension.name,
|
|
1745
|
+
target_command: commandPath,
|
|
1746
|
+
flags: normalizeFlagDefinitions(`${method} options.flags`, resolvedOptions.flags),
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1730
1749
|
applyImportExportCommandMetadata(method, commandPath, options) {
|
|
1731
1750
|
if (options !== undefined &&
|
|
1732
1751
|
(typeof options !== "object" ||
|
|
@@ -1747,6 +1766,7 @@ class ExtensionApiRegistrar {
|
|
|
1747
1766
|
description: options?.description ?? defaultDescription,
|
|
1748
1767
|
arguments: options?.arguments ?? defaultArguments,
|
|
1749
1768
|
};
|
|
1769
|
+
const output = resolveImportExportArtifactOutput(method, resolvedOptions, options?.description !== undefined);
|
|
1750
1770
|
assertOptionalStringField(`${method} options.action`, resolvedOptions.action);
|
|
1751
1771
|
assertOptionalStringField(`${method} options.description`, resolvedOptions.description);
|
|
1752
1772
|
assertOptionalStringField(`${method} options.intent`, resolvedOptions.intent);
|
|
@@ -1754,20 +1774,7 @@ class ExtensionApiRegistrar {
|
|
|
1754
1774
|
const examples = normalizeOptionalStringArrayField(`${method} options.examples`, resolvedOptions.examples);
|
|
1755
1775
|
const failureHints = normalizeOptionalStringArrayField(`${method} options.failure_hints`, resolvedOptions.failure_hints);
|
|
1756
1776
|
const argumentsDefinition = normalizeCommandDefinitionArguments(resolvedOptions.arguments);
|
|
1757
|
-
|
|
1758
|
-
assertExtensionCapability(this.#loadedExtension, "schema", `${method} options.flags`);
|
|
1759
|
-
// Route metadata flags through the same surface-policy gate as registerFlags so
|
|
1760
|
-
// enforce-mode policies blocking schema.flags are honored even when importers are allowed.
|
|
1761
|
-
if (this.allowRegistration("schema.flags", `${method} options.flags`, "schema")) {
|
|
1762
|
-
validateFlagDefinitions(resolvedOptions.flags);
|
|
1763
|
-
this.#registrationRegistry.flags.push({
|
|
1764
|
-
layer: this.#loadedExtension.layer,
|
|
1765
|
-
name: this.#loadedExtension.name,
|
|
1766
|
-
target_command: commandPath,
|
|
1767
|
-
flags: normalizeFlagDefinitions(`${method} options.flags`, resolvedOptions.flags),
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1777
|
+
this.registerImportExportCommandFlags(method, commandPath, resolvedOptions);
|
|
1771
1778
|
const registration = {
|
|
1772
1779
|
layer: this.#loadedExtension.layer,
|
|
1773
1780
|
name: this.#loadedExtension.name,
|
|
@@ -1787,6 +1794,7 @@ class ExtensionApiRegistrar {
|
|
|
1787
1794
|
registration.intent = intent;
|
|
1788
1795
|
}
|
|
1789
1796
|
this.#registrationRegistry.commands.push(registration);
|
|
1797
|
+
return output;
|
|
1790
1798
|
}
|
|
1791
1799
|
registerImporter(name, importer, options) {
|
|
1792
1800
|
assertExtensionCapability(this.#loadedExtension, "importers", "registerImporter");
|
|
@@ -1808,19 +1816,7 @@ class ExtensionApiRegistrar {
|
|
|
1808
1816
|
layer: this.#loadedExtension.layer,
|
|
1809
1817
|
name: this.#loadedExtension.name,
|
|
1810
1818
|
command: commandPath,
|
|
1811
|
-
run: async (context) => importer(
|
|
1812
|
-
registration: normalizedName,
|
|
1813
|
-
action: "import",
|
|
1814
|
-
command: context.command,
|
|
1815
|
-
args: cloneContextSnapshot(context.args),
|
|
1816
|
-
options: cloneContextSnapshot(context.options),
|
|
1817
|
-
global: cloneContextSnapshot(context.global),
|
|
1818
|
-
pm_root: context.pm_root,
|
|
1819
|
-
source_workspace_root: context.source_workspace_root,
|
|
1820
|
-
repo_root: context.repo_root,
|
|
1821
|
-
pm_root_rel: context.pm_root_rel,
|
|
1822
|
-
...(context.sdk === undefined ? {} : { sdk: context.sdk }),
|
|
1823
|
-
}),
|
|
1819
|
+
run: async (context) => importer(buildImportExportContext(context, normalizedName, "import")),
|
|
1824
1820
|
});
|
|
1825
1821
|
}
|
|
1826
1822
|
registerExporter(name, exporter, options) {
|
|
@@ -1833,29 +1829,24 @@ class ExtensionApiRegistrar {
|
|
|
1833
1829
|
const commandPath = toRegistrationCommandPath(normalizedName, "export");
|
|
1834
1830
|
// Validate and register optional command metadata before mutating the registry
|
|
1835
1831
|
// so an invalid options object leaves no partial exporter registration.
|
|
1836
|
-
this.applyImportExportCommandMetadata("registerExporter", commandPath, options);
|
|
1832
|
+
const output = this.applyImportExportCommandMetadata("registerExporter", commandPath, options);
|
|
1837
1833
|
this.#registrationRegistry.exporters.push({
|
|
1838
1834
|
layer: this.#loadedExtension.layer,
|
|
1839
1835
|
name: this.#loadedExtension.name,
|
|
1840
1836
|
exporter: normalizedName,
|
|
1837
|
+
...(output === undefined ? {} : { output }),
|
|
1841
1838
|
});
|
|
1842
1839
|
this.#commandRegistry.handlers.push({
|
|
1843
1840
|
layer: this.#loadedExtension.layer,
|
|
1844
1841
|
name: this.#loadedExtension.name,
|
|
1845
1842
|
command: commandPath,
|
|
1846
|
-
run: async (context) =>
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
pm_root: context.pm_root,
|
|
1854
|
-
source_workspace_root: context.source_workspace_root,
|
|
1855
|
-
repo_root: context.repo_root,
|
|
1856
|
-
pm_root_rel: context.pm_root_rel,
|
|
1857
|
-
...(context.sdk === undefined ? {} : { sdk: context.sdk }),
|
|
1858
|
-
}),
|
|
1843
|
+
run: async (context) => {
|
|
1844
|
+
const result = await exporter(buildImportExportContext(context, normalizedName, "export"));
|
|
1845
|
+
return output?.receipt === "suppress" &&
|
|
1846
|
+
!isHostOutputSuppressed(result)
|
|
1847
|
+
? suppressHostOutput(result)
|
|
1848
|
+
: result;
|
|
1849
|
+
},
|
|
1859
1850
|
});
|
|
1860
1851
|
}
|
|
1861
1852
|
registerSearchProvider(provider) {
|
|
@@ -2225,4 +2216,4 @@ export const _testOnlyLoader = {
|
|
|
2225
2216
|
},
|
|
2226
2217
|
};
|
|
2227
2218
|
//# sourceMappingURL=loader.js.map
|
|
2228
|
-
//# debugId=
|
|
2219
|
+
//# debugId=cccce7c1-dd08-5c9f-a74e-e639536b9a6a
|
|
@@ -51,6 +51,11 @@ declare function loadDatabaseSync(loadModule: (specifier: string) => unknown): D
|
|
|
51
51
|
declare function loadStableDatabaseSync(nodeVersion: string, loadModule: (specifier: string) => unknown): DatabaseSyncConstructor | null;
|
|
52
52
|
/** Rebuild the complete optional event projection from authoritative streams. */
|
|
53
53
|
export declare function rebuildHistoryEventIndex(pmRoot: string): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Query authoritative history streams when the optional SQLite accelerator is
|
|
56
|
+
* unavailable. The result preserves the index contract at higher read cost.
|
|
57
|
+
*/
|
|
58
|
+
export declare function queryHistoryEventStreams(pmRoot: string, query: HistoryEventIndexQuery): Promise<HistoryEventIndexQueryResult>;
|
|
54
59
|
/**
|
|
55
60
|
* Update an already-built event projection after one authoritative append.
|
|
56
61
|
* Absence is a cheap no-op; corrupt projections are removed for lazy rebuild.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* for cursor-resumable cross-item mutation event reads.
|
|
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]="a84b308f-7eef-535c-9531-b33b0775c651")}catch(e){}}();
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { randomUUID } from "node:crypto";
|
|
@@ -13,9 +13,76 @@ import { createRequire } from "node:module";
|
|
|
13
13
|
import { readHistoryEntries } from "./read.js";
|
|
14
14
|
const EVENT_INDEX_FILENAME = "history-event-index.sqlite";
|
|
15
15
|
const EVENT_INDEX_VERSION = "2";
|
|
16
|
+
const AUTHORITATIVE_HISTORY_CACHE_LIMIT = 8;
|
|
17
|
+
const authoritativeHistoryCaches = new Map();
|
|
16
18
|
function eventIndexPath(pmRoot) {
|
|
17
19
|
return path.join(pmRoot, "runtime", EVENT_INDEX_FILENAME);
|
|
18
20
|
}
|
|
21
|
+
async function readAuthoritativeHistoryEvents(pmRoot) {
|
|
22
|
+
const historyRoot = path.join(pmRoot, "history");
|
|
23
|
+
const entries = await fs
|
|
24
|
+
.readdir(historyRoot, { withFileTypes: true })
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
if (typeof error === "object" &&
|
|
27
|
+
error !== null &&
|
|
28
|
+
"code" in error &&
|
|
29
|
+
error.code === "ENOENT") {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
});
|
|
34
|
+
const cached = authoritativeHistoryCaches.get(pmRoot) ?? {
|
|
35
|
+
streams: new Map(),
|
|
36
|
+
ordered_events: [],
|
|
37
|
+
};
|
|
38
|
+
const presentStreams = new Set();
|
|
39
|
+
let changed = !authoritativeHistoryCaches.has(pmRoot);
|
|
40
|
+
for (const historyFile of entries
|
|
41
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl"))
|
|
42
|
+
.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
43
|
+
const streamId = historyFile.name.slice(0, -".jsonl".length);
|
|
44
|
+
presentStreams.add(streamId);
|
|
45
|
+
const historyPath = path.join(historyRoot, historyFile.name);
|
|
46
|
+
const stats = await fs.stat(historyPath, { bigint: true });
|
|
47
|
+
const signature = [
|
|
48
|
+
stats.dev,
|
|
49
|
+
stats.ino,
|
|
50
|
+
stats.size,
|
|
51
|
+
stats.mtimeNs,
|
|
52
|
+
stats.ctimeNs,
|
|
53
|
+
].join(":");
|
|
54
|
+
if (cached.streams.get(streamId)?.signature === signature)
|
|
55
|
+
continue;
|
|
56
|
+
const history = await readHistoryEntries(historyPath, streamId);
|
|
57
|
+
cached.streams.set(streamId, {
|
|
58
|
+
signature,
|
|
59
|
+
events: history.map((entry, streamOffset) => ({
|
|
60
|
+
stream_id: streamId,
|
|
61
|
+
stream_offset: streamOffset,
|
|
62
|
+
entry,
|
|
63
|
+
})),
|
|
64
|
+
});
|
|
65
|
+
changed = true;
|
|
66
|
+
}
|
|
67
|
+
for (const streamId of cached.streams.keys()) {
|
|
68
|
+
if (!presentStreams.has(streamId)) {
|
|
69
|
+
cached.streams.delete(streamId);
|
|
70
|
+
changed = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (changed) {
|
|
74
|
+
cached.ordered_events = [...cached.streams.values()]
|
|
75
|
+
.flatMap((stream) => stream.events)
|
|
76
|
+
.sort(compareHistoryEventPosition);
|
|
77
|
+
}
|
|
78
|
+
authoritativeHistoryCaches.delete(pmRoot);
|
|
79
|
+
authoritativeHistoryCaches.set(pmRoot, cached);
|
|
80
|
+
if (authoritativeHistoryCaches.size > AUTHORITATIVE_HISTORY_CACHE_LIMIT) {
|
|
81
|
+
const oldestRoot = authoritativeHistoryCaches.keys().next().value;
|
|
82
|
+
authoritativeHistoryCaches.delete(oldestRoot);
|
|
83
|
+
}
|
|
84
|
+
return cached.ordered_events;
|
|
85
|
+
}
|
|
19
86
|
function loadDatabaseSync(loadModule) {
|
|
20
87
|
try {
|
|
21
88
|
const loaded = loadModule(["node", "sqlite"].join(":"));
|
|
@@ -85,21 +152,6 @@ export async function rebuildHistoryEventIndex(pmRoot) {
|
|
|
85
152
|
const Database = resolveDatabaseSync();
|
|
86
153
|
if (!Database)
|
|
87
154
|
return false;
|
|
88
|
-
const historyRoot = path.join(pmRoot, "history");
|
|
89
|
-
const entries = await fs
|
|
90
|
-
.readdir(historyRoot, { withFileTypes: true })
|
|
91
|
-
.catch((error) => {
|
|
92
|
-
if (typeof error === "object" &&
|
|
93
|
-
error !== null &&
|
|
94
|
-
"code" in error &&
|
|
95
|
-
error.code === "ENOENT") {
|
|
96
|
-
return [];
|
|
97
|
-
}
|
|
98
|
-
throw error;
|
|
99
|
-
});
|
|
100
|
-
const historyFiles = entries
|
|
101
|
-
.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl"))
|
|
102
|
-
.sort((left, right) => left.name.localeCompare(right.name));
|
|
103
155
|
const targetPath = eventIndexPath(pmRoot);
|
|
104
156
|
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
|
105
157
|
const temporaryPath = `${targetPath}.${randomUUID()}.tmp`;
|
|
@@ -108,16 +160,8 @@ export async function rebuildHistoryEventIndex(pmRoot) {
|
|
|
108
160
|
database = new Database(temporaryPath);
|
|
109
161
|
createSchema(database);
|
|
110
162
|
database.exec("BEGIN IMMEDIATE");
|
|
111
|
-
for (const
|
|
112
|
-
|
|
113
|
-
const history = await readHistoryEntries(path.join(historyRoot, historyFile.name), streamId);
|
|
114
|
-
for (const [streamOffset, entry] of history.entries()) {
|
|
115
|
-
insertEvent(database, {
|
|
116
|
-
stream_id: streamId,
|
|
117
|
-
stream_offset: streamOffset,
|
|
118
|
-
entry,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
163
|
+
for (const event of await readAuthoritativeHistoryEvents(pmRoot)) {
|
|
164
|
+
insertEvent(database, event);
|
|
121
165
|
}
|
|
122
166
|
database.exec("COMMIT");
|
|
123
167
|
database.close();
|
|
@@ -132,6 +176,68 @@ export async function rebuildHistoryEventIndex(pmRoot) {
|
|
|
132
176
|
throw error;
|
|
133
177
|
}
|
|
134
178
|
}
|
|
179
|
+
function matchesSet(value, accepted) {
|
|
180
|
+
return !accepted || accepted.length === 0 || accepted.includes(value);
|
|
181
|
+
}
|
|
182
|
+
function compareHistoryEventPosition(left, right) {
|
|
183
|
+
return (left.entry.ts.localeCompare(right.entry.ts) ||
|
|
184
|
+
left.stream_id.localeCompare(right.stream_id) ||
|
|
185
|
+
left.stream_offset - right.stream_offset);
|
|
186
|
+
}
|
|
187
|
+
function isInsideHistoryEventWindow(event, query) {
|
|
188
|
+
if (query.after_ts !== undefined &&
|
|
189
|
+
query.after_stream_id !== undefined &&
|
|
190
|
+
query.after_stream_offset !== undefined) {
|
|
191
|
+
if (compareHistoryEventPosition(event, {
|
|
192
|
+
stream_id: query.after_stream_id,
|
|
193
|
+
stream_offset: query.after_stream_offset,
|
|
194
|
+
entry: { ...event.entry, ts: query.after_ts },
|
|
195
|
+
}) <= 0) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else if (query.since_ts !== undefined &&
|
|
200
|
+
event.entry.ts < query.since_ts) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
function matchesHistoryEventHarness(event, query) {
|
|
206
|
+
if (!query.harnesses || query.harnesses.length === 0)
|
|
207
|
+
return true;
|
|
208
|
+
if (query.harnesses.includes(event.entry.agent_harness ?? ""))
|
|
209
|
+
return true;
|
|
210
|
+
return (event.entry.agent_harness === undefined &&
|
|
211
|
+
(query.harness_alias_authors ?? []).includes(event.entry.author));
|
|
212
|
+
}
|
|
213
|
+
function matchesHistoryEventQuery(event, query) {
|
|
214
|
+
if (!isInsideHistoryEventWindow(event, query) ||
|
|
215
|
+
!matchesSet(event.entry.op, query.ops) ||
|
|
216
|
+
!matchesSet(event.entry.author, query.authors) ||
|
|
217
|
+
!matchesSet(event.entry.agent_instance ?? "", query.agent_instances) ||
|
|
218
|
+
!matchesSet(event.stream_id, query.stream_ids) ||
|
|
219
|
+
!matchesHistoryEventHarness(event, query)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
return (query.provenance ?? []).every((predicate) => {
|
|
223
|
+
const value = event.entry.agent_provenance?.[predicate.dimension]?.value;
|
|
224
|
+
return value !== undefined && predicate.values.includes(value);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Query authoritative history streams when the optional SQLite accelerator is
|
|
229
|
+
* unavailable. The result preserves the index contract at higher read cost.
|
|
230
|
+
*/
|
|
231
|
+
export async function queryHistoryEventStreams(pmRoot, query) {
|
|
232
|
+
const limit = Math.max(0, Math.floor(query.limit));
|
|
233
|
+
const rows = (await readAuthoritativeHistoryEvents(pmRoot))
|
|
234
|
+
.filter((event) => matchesHistoryEventQuery(event, query))
|
|
235
|
+
.slice(0, limit + 1);
|
|
236
|
+
return {
|
|
237
|
+
events: rows.slice(0, query.limit),
|
|
238
|
+
has_more: rows.length > query.limit,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
135
241
|
/**
|
|
136
242
|
* Update an already-built event projection after one authoritative append.
|
|
137
243
|
* Absence is a cheap no-op; corrupt projections are removed for lazy rebuild.
|
|
@@ -268,4 +374,4 @@ export const _testOnly = {
|
|
|
268
374
|
},
|
|
269
375
|
};
|
|
270
376
|
//# sourceMappingURL=event-index.js.map
|
|
271
|
-
//# debugId=
|
|
377
|
+
//# debugId=a84b308f-7eef-535c-9531-b33b0775c651
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Integrates Sentry instrumentation and release diagnostics for Helpers.
|
|
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]="5e6ba316-b067-51df-abeb-c3e3488a504d")}catch(e){}}();
|
|
8
8
|
import { getSentry } from "./instrument.js";
|
|
9
9
|
import { PmCliError } from "../shared/errors.js";
|
|
10
10
|
import { EXIT_CODE } from "../shared/constants.js";
|
|
@@ -236,7 +236,7 @@ export function shouldCaptureCliError(error) {
|
|
|
236
236
|
}
|
|
237
237
|
if (error instanceof Error &&
|
|
238
238
|
error.name === "AbortError" &&
|
|
239
|
-
/(?:ctrl\+
|
|
239
|
+
/(?:ctrl\+[cd]|sigint|user[- ]initiated)/i.test(error.message)) {
|
|
240
240
|
return false;
|
|
241
241
|
}
|
|
242
242
|
if (typeof error === "object" &&
|
|
@@ -270,4 +270,4 @@ export async function sentryFlush(timeoutMs = 3000) {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
//# sourceMappingURL=helpers.js.map
|
|
273
|
-
//# debugId=
|
|
273
|
+
//# debugId=5e6ba316-b067-51df-abeb-c3e3488a504d
|
|
@@ -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]="45e1dcb9-d2d6-52d7-b0b0-a57556a3fb03")}catch(e){}}();
|
|
3
3
|
import { createDefaultExtensionGovernancePolicy } from "../extensions/extension-types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Canonical default lifecycle status model and workflow role mapping.
|
|
@@ -271,6 +271,9 @@ export const SETTINGS_DEFAULTS = {
|
|
|
271
271
|
output: {
|
|
272
272
|
default_format: "toon",
|
|
273
273
|
},
|
|
274
|
+
ux: {
|
|
275
|
+
deprecation_hints: true,
|
|
276
|
+
},
|
|
274
277
|
history: {
|
|
275
278
|
missing_stream: "auto_create",
|
|
276
279
|
compact_policy: {
|
|
@@ -477,4 +480,4 @@ export function resolveTelemetryErrorCategory(errorCode) {
|
|
|
477
480
|
return "unknown";
|
|
478
481
|
}
|
|
479
482
|
//# sourceMappingURL=constants.js.map
|
|
480
|
-
//# debugId=
|
|
483
|
+
//# debugId=45e1dcb9-d2d6-52d7-b0b0-a57556a3fb03
|
|
@@ -36,6 +36,8 @@ export interface PmCliErrorRecoveryPayload {
|
|
|
36
36
|
option_scope?: "declared_on_path" | "declared_elsewhere" | "declared_nowhere";
|
|
37
37
|
/** Value that configures or reports suggested retry for this contract. */
|
|
38
38
|
suggested_retry?: string;
|
|
39
|
+
/** Tokenized retry arguments for direct execution without reparsing display text. */
|
|
40
|
+
suggested_retry_args?: string[];
|
|
39
41
|
/** Elapsed time in milliseconds for retry after. */
|
|
40
42
|
retry_after_ms?: number;
|
|
41
43
|
/** Value that configures or reports fallback candidates for this contract. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Implements the exported pm cli error runtime abstraction for core/shared/errors.ts. */
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a19ff5c0-2c4d-5576-a551-cab35276fdc3")}catch(e){}}();
|
|
4
4
|
export class PmCliError extends Error {
|
|
5
5
|
/** Value that configures or reports exit code for this contract. */
|
|
6
6
|
exitCode;
|
|
@@ -18,4 +18,4 @@ export class PmCliError extends Error {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=errors.js.map
|
|
21
|
-
//# debugId=
|
|
21
|
+
//# debugId=a19ff5c0-2c4d-5576-a551-cab35276fdc3
|
|
@@ -35,6 +35,10 @@ export interface ParsedSettings {
|
|
|
35
35
|
output: {
|
|
36
36
|
default_format: "toon" | "json";
|
|
37
37
|
};
|
|
38
|
+
/** Agent and human interaction preferences. */
|
|
39
|
+
ux?: {
|
|
40
|
+
deprecation_hints?: boolean;
|
|
41
|
+
};
|
|
38
42
|
/** Value that configures or reports history for this contract. */
|
|
39
43
|
history?: {
|
|
40
44
|
missing_stream: "auto_create" | "strict_error";
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* byte-identical to the previous implementation.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
!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]="
|
|
15
|
+
!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]="8883f930-193e-5133-835a-f15b1b62f6be")}catch(e){}}();
|
|
16
16
|
import { GOVERNANCE_PRESET_VALUES, RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, RUNTIME_STATUS_ROLE_VALUES, RUNTIME_UNKNOWN_FIELD_POLICY_VALUES, } from "../../types.js";
|
|
17
17
|
// Generic over `never` so it is assignable to every `Outcome<T>`.
|
|
18
18
|
const FAIL = { ok: false };
|
|
@@ -304,6 +304,7 @@ const settingsCheck = vObject({
|
|
|
304
304
|
retention_days: vOptional(vNumber({ int: true, positive: true })),
|
|
305
305
|
})),
|
|
306
306
|
output: vObject({ default_format: vLiteral("toon", "json") }),
|
|
307
|
+
ux: vOptional(vObject({ deprecation_hints: vOptional(vBoolean) })),
|
|
307
308
|
history: vOptional(vObject({
|
|
308
309
|
missing_stream: vLiteral("auto_create", "strict_error"),
|
|
309
310
|
compact_policy: vOptional(vObject({
|
|
@@ -414,4 +415,4 @@ export function validateSettings(raw) {
|
|
|
414
415
|
return { success: true, data: result.value };
|
|
415
416
|
}
|
|
416
417
|
//# sourceMappingURL=settings-validator.js.map
|
|
417
|
-
//# debugId=
|
|
418
|
+
//# debugId=8883f930-193e-5133-835a-f15b1b62f6be
|