@unbrained/pm-cli 2026.8.21 → 2026.8.23
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 +44 -0
- package/dist/cli/error-guidance.d.ts +22 -4
- package/dist/cli/error-guidance.js +73 -16
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +51 -9
- package/dist/cli/register-mutation.js +6 -6
- package/dist/cli/register-operations.d.ts +73 -0
- package/dist/cli/register-operations.js +39 -14
- package/dist/cli/register-setup.js +3 -3
- package/dist/cli/schema-registration-helpers.d.ts +8 -1
- package/dist/cli/schema-registration-helpers.js +14 -5
- package/dist/cli-bundle/bundle-manifest.json +149 -149
- package/dist/cli-bundle/chunks/chunk-3ENVHX6C.js +36 -0
- package/dist/cli-bundle/chunks/{chunk-LOVTQ52Z.js → chunk-DW2CGEMU.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-EG6CLDZT.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-LARJJ3RK.js → chunk-F3AI2JFL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-N3DSV4CH.js → chunk-HWZ6CELB.js} +8 -8
- package/dist/cli-bundle/chunks/chunk-HZBMLSZI.js +201 -0
- package/dist/cli-bundle/chunks/chunk-JB4KZWBF.js +3 -0
- package/dist/cli-bundle/chunks/chunk-KPH73XXJ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-BKYB45NQ.js → chunk-KXPMB2YL.js} +50 -50
- package/dist/cli-bundle/chunks/{chunk-BUNIEJNE.js → chunk-QDVHNHAQ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TFI5V5N2.js +13 -0
- package/dist/cli-bundle/chunks/{register-list-query-F57EWDEF.js → register-list-query-UJB5FMV2.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-NX5XE4VX.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-RXIJIYXC.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-HXU7IZZD.js → register-setup-GFUZEKRE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-F4YEW5I2.js → chunk-37Z4OEAP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3UPTYG44.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-5S7E72FY.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4ERLO7QD.js → chunk-AUFH5H35.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-E7X25GC3.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FQCSTBWE.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FH6DYED3.js → chunk-FZS4H32O.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-IFLWKY2R.js +156 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YKBKIEAJ.js → chunk-JOWDB2MH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-LYVSW5VM.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MRCNF3U6.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-UZE7XUZK.js → chunk-OFVUGTLJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FJ22HNRP.js → chunk-OGLQBL46.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-OY7QAV4Y.js +51 -0
- package/dist/cli-bundle/focused-chunks/chunk-QGFNI65N.js +26 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KDNG7TKQ.js → chunk-R27IDGHD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-UYRFYCDQ.js +5 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2NIY5NKG.js → chunk-ZHVA42R5.js} +9 -9
- 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 -2
- package/dist/cli-bundle/sdk-core.js +40 -40
- 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 +33 -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 -5
- package/dist/core/config/nested-settings.js +8 -2
- package/dist/core/config/positional-value.d.ts +1 -1
- package/dist/core/config/positional-value.js +5 -2
- package/dist/core/extensions/extension-hook-runtime.js +22 -20
- package/dist/core/extensions/extension-types.d.ts +8 -1
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/loader.js +7 -3
- package/dist/core/extensions/service-ownership.d.ts +8 -0
- package/dist/core/extensions/service-ownership.js +20 -0
- package/dist/core/history/history.js +3 -3
- package/dist/core/item/id.js +20 -5
- package/dist/core/item/item-format.js +81 -2
- package/dist/core/reproducibility/context.d.ts +4 -0
- package/dist/core/reproducibility/context.js +14 -8
- package/dist/core/shared/author.d.ts +55 -1
- package/dist/core/shared/author.js +333 -16
- package/dist/core/shared/constants.js +3 -2
- package/dist/core/shared/errors.d.ts +4 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/settings-validator.d.ts +1 -0
- package/dist/core/store/settings-validator.js +6 -3
- package/dist/core/store/settings.js +5 -2
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +30 -9
- package/dist/sdk/agent/identity-config.d.ts +63 -0
- package/dist/sdk/agent/identity-config.js +107 -0
- package/dist/sdk/agent/refusal-corpus-contracts.d.ts +76 -0
- package/dist/sdk/agent/refusal-corpus-contracts.js +194 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
- package/dist/sdk/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +2 -2
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +77 -0
- package/dist/sdk/cli-contracts/agent-output-contracts.js +326 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -3
- 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.js +9 -2
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +4 -4
- package/dist/sdk/cli-contracts/registration-helpers.js +5 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +22 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +14 -3
- package/dist/sdk/cli-contracts.d.ts +4 -4
- package/dist/sdk/cli-contracts.js +5 -5
- package/dist/sdk/config.d.ts +6 -1
- package/dist/sdk/config.js +119 -14
- package/dist/sdk/context-intent-contracts.js +4 -2
- package/dist/sdk/core-governance.d.ts +1 -1
- package/dist/sdk/core-governance.js +3 -3
- package/dist/sdk/extension/install-sources.d.ts +1 -1
- package/dist/sdk/extension/install-sources.js +6 -3
- package/dist/sdk/extension/output-ownership.d.ts +1 -0
- package/dist/sdk/extension/output-ownership.js +3 -2
- package/dist/sdk/extension/scaffold.js +11 -5
- package/dist/sdk/flag-invocation-contracts.js +4 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +74 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +87 -26
- package/dist/sdk/governance/assurance-action.js +30 -10
- package/dist/sdk/governance/health.d.ts +3 -0
- package/dist/sdk/governance/health.js +39 -7
- package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
- package/dist/sdk/governance/hierarchy-validation.js +109 -0
- package/dist/sdk/governance/validate.d.ts +3 -9
- package/dist/sdk/governance/validate.js +84 -111
- package/dist/sdk/graph/assembly.d.ts +6 -1
- package/dist/sdk/graph/assembly.js +16 -22
- package/dist/sdk/graph/governance-contracts.d.ts +1 -1
- package/dist/sdk/graph/governance-contracts.js +8 -2
- package/dist/sdk/graph/governance.js +46 -2
- package/dist/sdk/graph/hierarchy-integrity.d.ts +94 -0
- package/dist/sdk/graph/hierarchy-integrity.js +311 -0
- package/dist/sdk/graph/index.d.ts +2 -1
- package/dist/sdk/graph/index.js +3 -2
- package/dist/sdk/graph/remediation.js +32 -2
- package/dist/sdk/graph/run.d.ts +31 -2
- package/dist/sdk/graph/run.js +80 -31
- package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +8 -0
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +28 -0
- package/dist/sdk/index.d.ts +8 -3
- package/dist/sdk/index.js +9 -4
- package/dist/sdk/item-children.js +21 -8
- package/dist/sdk/lifecycle/create.js +129 -97
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +15 -0
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +25 -0
- package/dist/sdk/lifecycle/update.d.ts +2 -0
- package/dist/sdk/lifecycle/update.js +174 -84
- package/dist/sdk/merge/three-way.js +105 -26
- package/dist/sdk/query/complete-list.d.ts +3 -3
- package/dist/sdk/query/complete-list.js +46 -3
- package/dist/sdk/query/list.d.ts +4 -3
- package/dist/sdk/query/list.js +89 -49
- package/dist/sdk/read-output-budget.d.ts +21 -0
- package/dist/sdk/read-output-budget.js +39 -2
- package/dist/sdk/read-output-contracts.d.ts +10 -4
- package/dist/sdk/read-output-contracts.js +105 -32
- package/dist/sdk/relationship-context.js +3 -4
- package/dist/sdk/relationships.js +17 -10
- package/dist/sdk/reproducibility/process.d.ts +19 -0
- package/dist/sdk/reproducibility/process.js +88 -0
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.d.ts +3 -2
- package/dist/sdk/runtime.js +7 -5
- package/dist/sdk/test/batch.d.ts +6 -0
- package/dist/sdk/test/batch.js +26 -6
- package/dist/sdk/test/entry.d.ts +1 -1
- package/dist/sdk/test/entry.js +3 -2
- package/dist/sdk/test/execution.d.ts +28 -3
- package/dist/sdk/test/execution.js +201 -34
- package/dist/sdk/test/parsers.d.ts +6 -0
- package/dist/sdk/test/parsers.js +21 -2
- package/dist/sdk/test/trust.d.ts +33 -0
- package/dist/sdk/test/trust.js +207 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_PROVENANCE_ADR.md +41 -5
- package/docs/AGENT_UX_CONTRACTS.md +20 -4
- package/docs/COMMANDS.md +29 -14
- package/docs/CONFIGURATION.md +4 -0
- package/docs/DEPENDENCY_KIND_CONTRACT.md +31 -3
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +115 -0
- package/docs/EXTENSIONS.md +2 -1
- package/docs/MERGE_SAFETY.md +15 -1
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +19 -2
- package/docs/RELATIONSHIP_GRAPH.md +6 -3
- package/docs/REPRODUCIBLE_WORKSPACES.md +42 -8
- package/docs/SDK.md +9 -0
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +6 -4
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +1 -1
- package/docs/TESTING.md +83 -1
- package/docs/agent-task-token-baseline.json +2 -2
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
- package/marketplace.json +2 -2
- package/package.json +2 -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/sdk/public-surface.json +1021 -53
- package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +0 -197
- package/dist/cli-bundle/chunks/chunk-3AFAUHUE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-7VHZS727.js +0 -5
- package/dist/cli-bundle/chunks/chunk-JSLOFXGA.js +0 -3
- package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +0 -35
- package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +0 -13
- package/dist/cli-bundle/chunks/register-mutation-7IY2D5KO.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-FALL3YTU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +0 -50
- package/dist/cli-bundle/focused-chunks/chunk-CKKQSJNN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-F2A56DHV.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JEAVFOWM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-TJ7EMJ46.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-ZOSEELYJ.js +0 -26
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* surface without coupling package authors to command-specific option names.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
8
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="76c9c2d0-951d-579e-916e-e8d54d4a8be9")}catch(e){}}();
|
|
9
9
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
10
10
|
import { PmCliError } from "../core/shared/errors.js";
|
|
11
|
-
import { compactReadOutputToBudget, estimateReadOutputTokens, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
|
|
11
|
+
import { compactReadOutputToBudget, estimateReadOutputTokens, resolveReadOutputRecoveryBudget, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
|
|
12
|
+
export { resolveReadOutputRecoveryBudget } from "./read-output-budget.js";
|
|
12
13
|
import { resolvePmCommandOutputBudget } from "./cli-contracts/agent-output-contracts.js";
|
|
13
14
|
import { boundReadOutputRows, countReadOutputRows, mapReadOutputRows, readOutputBudgetCollections, readOutputContinuationRowCollections, readOutputRowPaths, } from "./read-output-rows.js";
|
|
14
15
|
import { applyReadOutputContinuation, decodeReadOutputContinuationCursor, encodeReadOutputContinuationCursor, prioritizeAssuranceAssertions, readOutputCollectionFingerprint, } from "./read-output/continuation.js";
|
|
@@ -43,6 +44,7 @@ export const PM_READ_OUTPUT_SURFACES = [
|
|
|
43
44
|
"docs",
|
|
44
45
|
"stats",
|
|
45
46
|
"aggregate",
|
|
47
|
+
"duplicates",
|
|
46
48
|
"package-catalog",
|
|
47
49
|
"package-manage",
|
|
48
50
|
"comments-audit",
|
|
@@ -60,6 +62,7 @@ const CANONICAL_OPTIONS = {
|
|
|
60
62
|
cost: "--output-budget",
|
|
61
63
|
encoding: "--output-format",
|
|
62
64
|
};
|
|
65
|
+
const READ_OUTPUT_INVOCATION_PROVENANCE = Symbol.for("pm.readOutputInvocationProvenance");
|
|
63
66
|
/** Canonical CLI flags that opt a read invocation into universal output shaping. */
|
|
64
67
|
export const PM_READ_OUTPUT_OPTION_FLAGS = Object.freeze(PM_READ_OUTPUT_DIMENSIONS.map((dimension) => CANONICAL_OPTIONS[dimension]));
|
|
65
68
|
/** Canonical control that composes the four per-call dimensions across reads. */
|
|
@@ -136,6 +139,7 @@ const LEGACY_FLAGS_BY_COMMAND = {
|
|
|
136
139
|
docs: {},
|
|
137
140
|
stats: {},
|
|
138
141
|
aggregate: {},
|
|
142
|
+
duplicates: { amount: ["--limit"] },
|
|
139
143
|
"package-catalog": {},
|
|
140
144
|
"package-manage": {},
|
|
141
145
|
"comments-audit": {},
|
|
@@ -363,14 +367,32 @@ export function applyReadOutputIncludeModes(command, includeValue, commandOption
|
|
|
363
367
|
const modeOptions = readOutputIncludeModeOptions(command);
|
|
364
368
|
const selectors = [];
|
|
365
369
|
const modes = [];
|
|
370
|
+
const optionsWithProvenance = commandOptions;
|
|
371
|
+
const existingProvenance = optionsWithProvenance[READ_OUTPUT_INVOCATION_PROVENANCE];
|
|
372
|
+
const canonicalModes = new Set(existingProvenance?.canonical_include_modes ?? []);
|
|
373
|
+
const explicitLegacyAliases = new Set(existingProvenance?.explicit_legacy_aliases ?? []);
|
|
366
374
|
for (const token of requested) {
|
|
367
375
|
const option = modeOptions.get(token);
|
|
368
376
|
if (option === undefined) {
|
|
369
377
|
selectors.push(token);
|
|
370
378
|
continue;
|
|
371
379
|
}
|
|
380
|
+
const legacyFlag = `--${token.replaceAll("_", "-")}`;
|
|
381
|
+
if (isRequestedOption(readOption(commandOptions, legacyFlag))) {
|
|
382
|
+
explicitLegacyAliases.add(legacyFlag);
|
|
383
|
+
}
|
|
372
384
|
commandOptions[option] = true;
|
|
373
385
|
modes.push(token);
|
|
386
|
+
canonicalModes.add(token);
|
|
387
|
+
}
|
|
388
|
+
if (modes.length > 0) {
|
|
389
|
+
optionsWithProvenance[READ_OUTPUT_INVOCATION_PROVENANCE] = {
|
|
390
|
+
canonical_include_modes: [...canonicalModes],
|
|
391
|
+
explicit_legacy_aliases: [...explicitLegacyAliases],
|
|
392
|
+
...(existingProvenance?.cli_invocation_observed === true
|
|
393
|
+
? { cli_invocation_observed: true }
|
|
394
|
+
: {}),
|
|
395
|
+
};
|
|
374
396
|
}
|
|
375
397
|
return { selectors, modes };
|
|
376
398
|
}
|
|
@@ -430,8 +452,10 @@ function positiveInteger(value) {
|
|
|
430
452
|
: Number.NaN;
|
|
431
453
|
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined;
|
|
432
454
|
}
|
|
433
|
-
function resolveLegacyDimension(contract, options, usable) {
|
|
455
|
+
function resolveLegacyDimension(contract, options, usable, ignore) {
|
|
434
456
|
for (const alias of contract.legacy_aliases) {
|
|
457
|
+
if (ignore(alias.flag))
|
|
458
|
+
continue;
|
|
435
459
|
const value = readOption(options, alias.flag);
|
|
436
460
|
const candidate = { value, flag: alias.flag };
|
|
437
461
|
if (isRequestedOption(value) && usable(candidate))
|
|
@@ -496,12 +520,43 @@ function resolveEncodingValue(canonical, legacy) {
|
|
|
496
520
|
? { source: "legacy", value: legacy.value }
|
|
497
521
|
: undefined;
|
|
498
522
|
}
|
|
523
|
+
function shouldIgnoreReadOutputLegacyAlias(provenance, dimension, flag) {
|
|
524
|
+
if (!provenance)
|
|
525
|
+
return false;
|
|
526
|
+
const explicitLegacyAliases = new Set(provenance.explicit_legacy_aliases);
|
|
527
|
+
if (provenance.cli_invocation_observed === true) {
|
|
528
|
+
return !explicitLegacyAliases.has(flag);
|
|
529
|
+
}
|
|
530
|
+
const forwardedIncludeAliases = new Set(provenance.canonical_include_modes.map((mode) => `--${mode.replaceAll("_", "-")}`));
|
|
531
|
+
return (dimension === "include" &&
|
|
532
|
+
forwardedIncludeAliases.has(flag) &&
|
|
533
|
+
!explicitLegacyAliases.has(flag));
|
|
534
|
+
}
|
|
535
|
+
function hasCompleteReadOutputIntent(command, legacyByDimension, provenance) {
|
|
536
|
+
const root = command
|
|
537
|
+
.trim()
|
|
538
|
+
.toLowerCase()
|
|
539
|
+
.replaceAll(/\s+/gu, " ")
|
|
540
|
+
.split(" ")[0];
|
|
541
|
+
return (root === "list-all" ||
|
|
542
|
+
legacyByDimension.amount?.flag === "--no-truncate" ||
|
|
543
|
+
legacyByDimension.include?.flag === "--full" ||
|
|
544
|
+
provenance?.canonical_include_modes.includes("full") === true);
|
|
545
|
+
}
|
|
546
|
+
function canonicalReadOutputOptionsUsed(resolvedByDimension, provenance) {
|
|
547
|
+
return PM_READ_OUTPUT_DIMENSIONS.flatMap((dimension) => resolvedByDimension[dimension]?.source === "canonical" ||
|
|
548
|
+
(dimension === "include" &&
|
|
549
|
+
(provenance?.canonical_include_modes.length ?? 0) > 0)
|
|
550
|
+
? [CANONICAL_OPTIONS[dimension]]
|
|
551
|
+
: []);
|
|
552
|
+
}
|
|
499
553
|
/** Resolve canonical and compatibility controls into the universal dimension set. */
|
|
500
554
|
export function resolveReadOutputDimensions(command, options) {
|
|
501
555
|
const normalizedCommand = resolveReadOutputSurface(command, options);
|
|
502
556
|
if (!normalizedCommand)
|
|
503
557
|
return undefined;
|
|
504
558
|
const contract = SURFACE_CONTRACT_BY_COMMAND.get(normalizedCommand);
|
|
559
|
+
const invocationProvenance = options[READ_OUTPUT_INVOCATION_PROVENANCE];
|
|
505
560
|
const legacyResolvers = {
|
|
506
561
|
include: (candidate) => resolveIncludeValue(undefined, candidate),
|
|
507
562
|
amount: (candidate) => resolveAmountValue(undefined, candidate),
|
|
@@ -510,7 +565,7 @@ export function resolveReadOutputDimensions(command, options) {
|
|
|
510
565
|
};
|
|
511
566
|
const legacyByDimension = Object.fromEntries(PM_READ_OUTPUT_DIMENSIONS.map((dimension) => [
|
|
512
567
|
dimension,
|
|
513
|
-
resolveLegacyDimension(contract.dimensions[dimension], options, (candidate) => legacyResolvers[dimension](candidate) !== undefined),
|
|
568
|
+
resolveLegacyDimension(contract.dimensions[dimension], options, (candidate) => legacyResolvers[dimension](candidate) !== undefined, (flag) => shouldIgnoreReadOutputLegacyAlias(invocationProvenance, dimension, flag)),
|
|
514
569
|
]));
|
|
515
570
|
const legacyAliasesUsed = PM_READ_OUTPUT_DIMENSIONS.flatMap((dimension) => {
|
|
516
571
|
const resolved = legacyByDimension[dimension];
|
|
@@ -524,29 +579,31 @@ export function resolveReadOutputDimensions(command, options) {
|
|
|
524
579
|
return [alias.migration_hint];
|
|
525
580
|
});
|
|
526
581
|
const encoding = resolveEncodingValue(options.outputFormat ?? options.output_format, legacyByDimension.encoding);
|
|
582
|
+
const include = resolveIncludeValue(options.outputInclude ?? options.output_include, legacyByDimension.include);
|
|
583
|
+
const amount = resolveAmountValue(options.outputLimit ?? options.output_limit, legacyByDimension.amount);
|
|
527
584
|
const explicitCost = resolveCostValue(options.outputBudget ?? options.output_budget, legacyByDimension.cost);
|
|
528
|
-
const completeResultIntent = command
|
|
529
|
-
"list-all" ||
|
|
530
|
-
legacyByDimension.amount?.flag === "--no-truncate" ||
|
|
531
|
-
legacyByDimension.include?.flag === "--full";
|
|
585
|
+
const completeResultIntent = hasCompleteReadOutputIntent(command, legacyByDimension, invocationProvenance);
|
|
532
586
|
const budget = resolvePmCommandOutputBudget(command, {
|
|
533
587
|
generateFallback: true,
|
|
534
588
|
});
|
|
535
589
|
const resolvedOutputFormat = encoding?.value === "json" || options.resolvedOutputFormat === "json"
|
|
536
590
|
? "json"
|
|
537
591
|
: "toon";
|
|
592
|
+
const cost = explicitCost ??
|
|
593
|
+
(completeResultIntent
|
|
594
|
+
? { source: "intent", value: "unbounded" }
|
|
595
|
+
: {
|
|
596
|
+
source: "default",
|
|
597
|
+
value: budget.default_max_estimated_tokens_by_format[resolvedOutputFormat],
|
|
598
|
+
});
|
|
599
|
+
const resolvedByDimension = { include, amount, cost, encoding };
|
|
538
600
|
return {
|
|
539
601
|
command: normalizedCommand,
|
|
540
|
-
include
|
|
541
|
-
amount
|
|
542
|
-
cost
|
|
543
|
-
(completeResultIntent
|
|
544
|
-
? { source: "intent", value: "unbounded" }
|
|
545
|
-
: {
|
|
546
|
-
source: "default",
|
|
547
|
-
value: budget.default_max_estimated_tokens_by_format[resolvedOutputFormat],
|
|
548
|
-
}),
|
|
602
|
+
include,
|
|
603
|
+
amount,
|
|
604
|
+
cost,
|
|
549
605
|
encoding,
|
|
606
|
+
canonical_options_used: canonicalReadOutputOptionsUsed(resolvedByDimension, invocationProvenance),
|
|
550
607
|
legacy_aliases_used: legacyAliasesUsed,
|
|
551
608
|
migration_hints: migrationHints,
|
|
552
609
|
precedence: READ_OUTPUT_PRECEDENCE,
|
|
@@ -732,8 +789,9 @@ function applyAmountBound(result, amount) {
|
|
|
732
789
|
return bounded;
|
|
733
790
|
}
|
|
734
791
|
function requestedDimensions(resolved) {
|
|
735
|
-
return PM_READ_OUTPUT_DIMENSIONS.filter((dimension) => resolved[dimension] !== undefined &&
|
|
736
|
-
resolved[dimension]?.source !== "default")
|
|
792
|
+
return PM_READ_OUTPUT_DIMENSIONS.filter((dimension) => (resolved[dimension] !== undefined &&
|
|
793
|
+
resolved[dimension]?.source !== "default") ||
|
|
794
|
+
resolved.canonical_options_used.includes(CANONICAL_OPTIONS[dimension]));
|
|
737
795
|
}
|
|
738
796
|
/** Stabilize the per-call and cross-call receipts in one complete envelope. */
|
|
739
797
|
function attachReadOutputSessionContracts(result, state, receipt) {
|
|
@@ -847,6 +905,12 @@ function resolveBindingReadOutputBudget(resolved, session) {
|
|
|
847
905
|
];
|
|
848
906
|
return budgets.sort((left, right) => left.tokens - right.tokens)[0];
|
|
849
907
|
}
|
|
908
|
+
function canonicalReadOutputReceiptFields(resolved) {
|
|
909
|
+
const canonicalOptions = resolved.canonical_options_used;
|
|
910
|
+
return canonicalOptions && canonicalOptions.length > 0
|
|
911
|
+
? { canonical_options_used: canonicalOptions }
|
|
912
|
+
: {};
|
|
913
|
+
}
|
|
850
914
|
/** Build the smallest truthful omission envelope or reject an exhausted session. */
|
|
851
915
|
function omitReadOutputForBudget(resolved, requested, session, bindingBudget, omittedResultEstimatedTokens) {
|
|
852
916
|
const minimalReceipt = {
|
|
@@ -860,6 +924,7 @@ function omitReadOutputForBudget(resolved, requested, session, bindingBudget, om
|
|
|
860
924
|
}
|
|
861
925
|
: {}),
|
|
862
926
|
precedence: resolved.precedence,
|
|
927
|
+
...canonicalReadOutputReceiptFields(resolved),
|
|
863
928
|
legacy_aliases_used: [],
|
|
864
929
|
migration_hints: [],
|
|
865
930
|
estimated_tokens: 0,
|
|
@@ -893,10 +958,10 @@ function omitReadOutputForBudget(resolved, requested, session, bindingBudget, om
|
|
|
893
958
|
return boundedOmission;
|
|
894
959
|
}
|
|
895
960
|
/** Decide whether shaping would add no value to an already-bounded result. */
|
|
896
|
-
function canReturnReadOutputUnchanged(resolved,
|
|
961
|
+
function canReturnReadOutputUnchanged(resolved, session, result) {
|
|
897
962
|
if (session !== undefined)
|
|
898
963
|
return false;
|
|
899
|
-
const canonicalRequestedCount =
|
|
964
|
+
const canonicalRequestedCount = resolved.canonical_options_used.length;
|
|
900
965
|
if (resolved.cost?.value === "unbounded") {
|
|
901
966
|
return (canonicalRequestedCount === (resolved.cost.source === "canonical" ? 1 : 0));
|
|
902
967
|
}
|
|
@@ -915,7 +980,7 @@ function canReturnReadOutputUnchanged(resolved, requested, session, result) {
|
|
|
915
980
|
* without this an explicitly requested unbounded read is silently downgraded and
|
|
916
981
|
* the only working recovery is never named.
|
|
917
982
|
*/
|
|
918
|
-
function attachReadOutputTruncationDisclosure(projected, resolved, receipt, bindingBudget, continuationCursorRebased, collectionsBeforeBudget) {
|
|
983
|
+
function attachReadOutputTruncationDisclosure(projected, resolved, receipt, bindingBudget, continuationCursorRebased, measuredResultTokens, collectionsBeforeBudget) {
|
|
919
984
|
if (!receipt.rows_compacted)
|
|
920
985
|
return;
|
|
921
986
|
const overridden = resolved.amount?.value === "unbounded" ? ["amount"] : [];
|
|
@@ -949,6 +1014,10 @@ function attachReadOutputTruncationDisclosure(projected, resolved, receipt, bind
|
|
|
949
1014
|
];
|
|
950
1015
|
});
|
|
951
1016
|
const primary = continuations[0];
|
|
1017
|
+
const recoveryBudget = resolveReadOutputRecoveryBudget({
|
|
1018
|
+
effective_budget_tokens: bindingBudget.tokens,
|
|
1019
|
+
measured_result_tokens: measuredResultTokens,
|
|
1020
|
+
});
|
|
952
1021
|
if (primary && typeof projected.next_cursor !== "string") {
|
|
953
1022
|
projected.next_cursor = primary.cursor;
|
|
954
1023
|
}
|
|
@@ -965,11 +1034,13 @@ function attachReadOutputTruncationDisclosure(projected, resolved, receipt, bind
|
|
|
965
1034
|
compacted_row_paths: receipt.compacted_row_paths,
|
|
966
1035
|
continuation_cursor_rebased: continuationCursorRebased,
|
|
967
1036
|
continuation_available: continuations.length > 0,
|
|
968
|
-
recovery_budget_multiplier:
|
|
1037
|
+
recovery_budget_multiplier: primary
|
|
1038
|
+
? 1
|
|
1039
|
+
: recoveryBudget.recovery_budget_multiplier,
|
|
969
1040
|
continuations,
|
|
970
1041
|
restore_with: primary
|
|
971
1042
|
? "Use recovery binding."
|
|
972
|
-
:
|
|
1043
|
+
: `Retry with --output-budget ${recoveryBudget.output_budget} because no declared row collection can be continued.`,
|
|
973
1044
|
recovery: primary
|
|
974
1045
|
? {
|
|
975
1046
|
cursor: primary.cursor,
|
|
@@ -978,9 +1049,9 @@ function attachReadOutputTruncationDisclosure(projected, resolved, receipt, bind
|
|
|
978
1049
|
mcp: "outputCursor",
|
|
979
1050
|
}
|
|
980
1051
|
: {
|
|
981
|
-
cli:
|
|
982
|
-
sdk: { outputBudget:
|
|
983
|
-
mcp: { outputBudget:
|
|
1052
|
+
cli: `--output-budget ${recoveryBudget.output_budget}`,
|
|
1053
|
+
sdk: { outputBudget: recoveryBudget.output_budget },
|
|
1054
|
+
mcp: { outputBudget: recoveryBudget.output_budget },
|
|
984
1055
|
},
|
|
985
1056
|
};
|
|
986
1057
|
}
|
|
@@ -1051,7 +1122,7 @@ function captureReadOutputContinuationState(projected, cursor, options) {
|
|
|
1051
1122
|
: options.after,
|
|
1052
1123
|
};
|
|
1053
1124
|
}
|
|
1054
|
-
function compactReadOutputProjection(projected, resolved, receipt, bindingBudget, session, continuationState) {
|
|
1125
|
+
function compactReadOutputProjection(projected, resolved, receipt, bindingBudget, session, continuationState, measuredResultTokens) {
|
|
1055
1126
|
const assuranceMinimumRows = resolved.command === "assurance" && Array.isArray(projected.assertions)
|
|
1056
1127
|
? projected.assertions.filter((row) => isRecord(row) && row.verdict !== "pass").length
|
|
1057
1128
|
: 0;
|
|
@@ -1059,7 +1130,7 @@ function compactReadOutputProjection(projected, resolved, receipt, bindingBudget
|
|
|
1059
1130
|
? new Map([["assertions", assuranceMinimumRows]])
|
|
1060
1131
|
: new Map());
|
|
1061
1132
|
const continuationCursorRebased = rebaseBudgetCompactedCursor(compacted, continuationState.originalItemCount, continuationState.cursorSource, continuationState.cursorContinuesExistingPage);
|
|
1062
|
-
attachReadOutputTruncationDisclosure(compacted, resolved, receipt, bindingBudget, continuationCursorRebased, continuationState.collectionsBeforeBudget);
|
|
1133
|
+
attachReadOutputTruncationDisclosure(compacted, resolved, receipt, bindingBudget, continuationCursorRebased, measuredResultTokens, continuationState.collectionsBeforeBudget);
|
|
1063
1134
|
if (session !== undefined) {
|
|
1064
1135
|
compacted = attachReadOutputSessionContracts(compacted, session, receipt);
|
|
1065
1136
|
}
|
|
@@ -1077,7 +1148,7 @@ export function applyReadOutputDimensions(command, options, result) {
|
|
|
1077
1148
|
: undefined;
|
|
1078
1149
|
const requested = requestedDimensions(resolved);
|
|
1079
1150
|
if (cursor === undefined &&
|
|
1080
|
-
canReturnReadOutputUnchanged(resolved,
|
|
1151
|
+
canReturnReadOutputUnchanged(resolved, session, result)) {
|
|
1081
1152
|
return result;
|
|
1082
1153
|
}
|
|
1083
1154
|
const continuationReadyResult = attachValidateDiagnosticRowContract(resolved.command, result);
|
|
@@ -1095,6 +1166,7 @@ export function applyReadOutputDimensions(command, options, result) {
|
|
|
1095
1166
|
}
|
|
1096
1167
|
: {}),
|
|
1097
1168
|
precedence: resolved.precedence,
|
|
1169
|
+
...canonicalReadOutputReceiptFields(resolved),
|
|
1098
1170
|
legacy_aliases_used: resolved.legacy_aliases_used,
|
|
1099
1171
|
migration_hints: resolved.migration_hints,
|
|
1100
1172
|
estimated_tokens: 0,
|
|
@@ -1111,7 +1183,8 @@ export function applyReadOutputDimensions(command, options, result) {
|
|
|
1111
1183
|
updateReadOutputReceiptEstimate(projected, receipt);
|
|
1112
1184
|
if (bindingBudget !== undefined &&
|
|
1113
1185
|
receipt.estimated_tokens > bindingBudget.tokens) {
|
|
1114
|
-
|
|
1186
|
+
const measuredResultTokens = receipt.estimated_tokens;
|
|
1187
|
+
projected = compactReadOutputProjection(projected, resolved, receipt, bindingBudget, session, continuationState, measuredResultTokens);
|
|
1115
1188
|
}
|
|
1116
1189
|
if (bindingBudget !== undefined &&
|
|
1117
1190
|
receipt.estimated_tokens > bindingBudget.tokens) {
|
|
@@ -1134,4 +1207,4 @@ export function resolveReadOutputEncoding(command, options) {
|
|
|
1134
1207
|
: undefined;
|
|
1135
1208
|
}
|
|
1136
1209
|
//# sourceMappingURL=read-output-contracts.js.map
|
|
1137
|
-
//# debugId=
|
|
1210
|
+
//# debugId=76c9c2d0-951d-579e-916e-e8d54d4a8be9
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* packet for agents, custom tools, and presentation-layer adapters.
|
|
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]="afdba960-ae43-52be-b21d-282dac1f22ff")}catch(e){}}();
|
|
9
9
|
import { createQueryFingerprint, encodeQueryCursor, resolveQueryCursorStart, } from "./pagination.js";
|
|
10
10
|
import { createRelationshipKindRegistry, } from "./relationships.js";
|
|
11
11
|
/** Deterministic priority used when one node matches several semantic families. */
|
|
@@ -37,8 +37,7 @@ function explainDirectEdge(edge, node, registry) {
|
|
|
37
37
|
return node === before ? "prerequisite" : "dependent";
|
|
38
38
|
}
|
|
39
39
|
if (definition?.hierarchy) {
|
|
40
|
-
|
|
41
|
-
const sourceIsParent = (definition.hierarchyDirection ?? "source_parent") === "source_parent";
|
|
40
|
+
const sourceIsParent = definition.hierarchyDirection === "source_parent";
|
|
42
41
|
const parent = sourceIsParent ? edge.source : edge.target;
|
|
43
42
|
return node === parent ? "ancestor" : "descendant";
|
|
44
43
|
}
|
|
@@ -283,4 +282,4 @@ export function buildRelationshipContext(graph, rootId, details, options = {}) {
|
|
|
283
282
|
};
|
|
284
283
|
}
|
|
285
284
|
//# sourceMappingURL=relationship-context.js.map
|
|
286
|
-
//# debugId=
|
|
285
|
+
//# debugId=afdba960-ae43-52be-b21d-282dac1f22ff
|
|
@@ -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]="d7d44fba-603b-5ef2-8490-51112b929433")}catch(e){}}();
|
|
3
3
|
import { BUILTIN_RELATIONSHIP_KINDS, } from "./relationship-kinds/contract.js";
|
|
4
4
|
export { BUILTIN_RELATIONSHIP_KINDS, } from "./relationship-kinds/contract.js";
|
|
5
5
|
function normalizeKind(kind) {
|
|
@@ -105,6 +105,17 @@ function assertRelationshipKindPayload(definition, kind) {
|
|
|
105
105
|
definition.aliases.some((alias) => typeof alias !== "string")))
|
|
106
106
|
throw new TypeError(`Invalid relationship aliases for ${kind}`);
|
|
107
107
|
}
|
|
108
|
+
function resolveRelationshipTraversal(definition) {
|
|
109
|
+
if (definition.traversal)
|
|
110
|
+
return definition.traversal;
|
|
111
|
+
// Dual-family extension kinds use ordering precedence, matching relationship
|
|
112
|
+
// context role classification. Explicit traversal always remains authoritative.
|
|
113
|
+
if (definition.ordering)
|
|
114
|
+
return "ordering";
|
|
115
|
+
if (definition.hierarchy)
|
|
116
|
+
return "hierarchy";
|
|
117
|
+
return definition.direction === "undirected" ? "association" : "semantic";
|
|
118
|
+
}
|
|
108
119
|
/** Mutable registry with immutable snapshots and collision-safe extension registration. */
|
|
109
120
|
export class RelationshipKindRegistry {
|
|
110
121
|
#definitions = new Map();
|
|
@@ -139,15 +150,11 @@ export class RelationshipKindRegistry {
|
|
|
139
150
|
const normalized = Object.freeze({
|
|
140
151
|
...definition,
|
|
141
152
|
kind,
|
|
142
|
-
traversal: definition
|
|
143
|
-
(definition.hierarchy
|
|
144
|
-
? "hierarchy"
|
|
145
|
-
: definition.ordering
|
|
146
|
-
? "ordering"
|
|
147
|
-
: definition.direction === "undirected"
|
|
148
|
-
? "association"
|
|
149
|
-
: "semantic"),
|
|
153
|
+
traversal: resolveRelationshipTraversal(definition),
|
|
150
154
|
hierarchy: definition.hierarchy ?? false,
|
|
155
|
+
hierarchyDirection: definition.hierarchy
|
|
156
|
+
? (definition.hierarchyDirection ?? "source_parent")
|
|
157
|
+
: undefined,
|
|
151
158
|
inverse,
|
|
152
159
|
aliases: Object.freeze(aliases),
|
|
153
160
|
payloadSchema: definition.payloadSchema
|
|
@@ -570,4 +577,4 @@ export function dependencyToRelationship(source, dependency, registry = defaultR
|
|
|
570
577
|
};
|
|
571
578
|
}
|
|
572
579
|
//# sourceMappingURL=relationships.js.map
|
|
573
|
-
//# debugId=
|
|
580
|
+
//# debugId=d7d44fba-603b-5ef2-8490-51112b929433
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReproducibleExecutionSettings, type ReproducibleExecutionRunner } from "../../core/reproducibility/context.js";
|
|
2
|
+
/** Stable environment-variable names understood by every pm process transport. */
|
|
3
|
+
export declare const PM_REPRODUCIBLE_PROCESS_ENV: Readonly<{
|
|
4
|
+
readonly clock: "PM_CLOCK";
|
|
5
|
+
readonly tickMs: "PM_CLOCK_TICK_MS";
|
|
6
|
+
readonly seed: "PM_SEED";
|
|
7
|
+
}>;
|
|
8
|
+
/** Environment-shaped input accepted by the reproducible process adapter. */
|
|
9
|
+
export type ReproducibleProcessEnvironment = Readonly<Record<string, string | undefined>>;
|
|
10
|
+
/** Public deterministic settings installed by recipes and process transports. */
|
|
11
|
+
export type { ReproducibleExecutionSettings };
|
|
12
|
+
/** Runner used by long-lived transports whose serial operations share one sequence. */
|
|
13
|
+
export type ReproducibleProcessRunner = ReproducibleExecutionRunner;
|
|
14
|
+
/** Resolve validated deterministic settings, or undefined when no opt-in is present. */
|
|
15
|
+
export declare function resolveReproducibleProcessEnvironment(environment: ReproducibleProcessEnvironment): ReproducibleExecutionSettings | undefined;
|
|
16
|
+
/** Create one process-lifetime runner for long-lived serial transports such as MCP. */
|
|
17
|
+
export declare function createReproducibleProcessRunner(environment: ReproducibleProcessEnvironment): ReproducibleProcessRunner;
|
|
18
|
+
/** Run one process transport operation under its declared deterministic context. */
|
|
19
|
+
export declare function runWithReproducibleProcessEnvironment<T>(environment: ReproducibleProcessEnvironment, operation: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/reproducible-process
|
|
3
|
+
*
|
|
4
|
+
* Owns the process-environment contract that lets CLI and MCP transports enter
|
|
5
|
+
* the same deterministic execution context as SDK workspace recipes.
|
|
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]="ae031bac-f5a1-5762-9c58-0410b8f1f86d")}catch(e){}}();
|
|
9
|
+
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
10
|
+
import { PmCliError } from "../../core/shared/errors.js";
|
|
11
|
+
import { isRfc3339DateTime } from "../../core/shared/time.js";
|
|
12
|
+
import { createReproducibleExecutionRunner, validateReproducibleExecutionSettings, } from "../../core/reproducibility/context.js";
|
|
13
|
+
/** Stable environment-variable names understood by every pm process transport. */
|
|
14
|
+
export const PM_REPRODUCIBLE_PROCESS_ENV = Object.freeze({
|
|
15
|
+
clock: "PM_CLOCK",
|
|
16
|
+
tickMs: "PM_CLOCK_TICK_MS",
|
|
17
|
+
seed: "PM_SEED",
|
|
18
|
+
});
|
|
19
|
+
function invalidProcessEnvironment(message, reason, field, providedFields) {
|
|
20
|
+
return new PmCliError(message, EXIT_CODE.USAGE, {
|
|
21
|
+
code: "invalid_reproducible_process_environment",
|
|
22
|
+
reason,
|
|
23
|
+
field,
|
|
24
|
+
required: `${PM_REPRODUCIBLE_PROCESS_ENV.clock} and ${PM_REPRODUCIBLE_PROCESS_ENV.seed}; ${PM_REPRODUCIBLE_PROCESS_ENV.tickMs} is optional`,
|
|
25
|
+
nextSteps: [
|
|
26
|
+
`Set ${PM_REPRODUCIBLE_PROCESS_ENV.clock} to an ISO-8601 instant with Z or a numeric UTC offset and ${PM_REPRODUCIBLE_PROCESS_ENV.seed} to a non-empty reproducibility seed.`,
|
|
27
|
+
`Optionally set ${PM_REPRODUCIBLE_PROCESS_ENV.tickMs} to a non-negative integer; it defaults to 1.`,
|
|
28
|
+
`Unset all three variables to retain normal wall-clock and cryptographic-random behavior.`,
|
|
29
|
+
],
|
|
30
|
+
recovery: {
|
|
31
|
+
recovery_mode: "compact",
|
|
32
|
+
provided_fields: providedFields,
|
|
33
|
+
missing_required_fields: reason === "incomplete"
|
|
34
|
+
? [
|
|
35
|
+
PM_REPRODUCIBLE_PROCESS_ENV.clock,
|
|
36
|
+
PM_REPRODUCIBLE_PROCESS_ENV.seed,
|
|
37
|
+
].filter((name) => !providedFields.includes(name))
|
|
38
|
+
: undefined,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** Resolve validated deterministic settings, or undefined when no opt-in is present. */
|
|
43
|
+
export function resolveReproducibleProcessEnvironment(environment) {
|
|
44
|
+
const clock = environment[PM_REPRODUCIBLE_PROCESS_ENV.clock];
|
|
45
|
+
const tick = environment[PM_REPRODUCIBLE_PROCESS_ENV.tickMs];
|
|
46
|
+
const seed = environment[PM_REPRODUCIBLE_PROCESS_ENV.seed];
|
|
47
|
+
const providedFields = [
|
|
48
|
+
[PM_REPRODUCIBLE_PROCESS_ENV.clock, clock],
|
|
49
|
+
[PM_REPRODUCIBLE_PROCESS_ENV.tickMs, tick],
|
|
50
|
+
[PM_REPRODUCIBLE_PROCESS_ENV.seed, seed],
|
|
51
|
+
]
|
|
52
|
+
.filter((entry) => entry[1] !== undefined)
|
|
53
|
+
.map(([name]) => name);
|
|
54
|
+
if (providedFields.length === 0) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (clock === undefined || seed === undefined) {
|
|
58
|
+
throw invalidProcessEnvironment("Reproducible process execution requires PM_CLOCK and PM_SEED together.", "incomplete", clock === undefined
|
|
59
|
+
? PM_REPRODUCIBLE_PROCESS_ENV.clock
|
|
60
|
+
: PM_REPRODUCIBLE_PROCESS_ENV.seed, providedFields);
|
|
61
|
+
}
|
|
62
|
+
if (seed.trim().length === 0) {
|
|
63
|
+
throw invalidProcessEnvironment(`${PM_REPRODUCIBLE_PROCESS_ENV.seed} must not be empty.`, "invalid_value", PM_REPRODUCIBLE_PROCESS_ENV.seed, providedFields);
|
|
64
|
+
}
|
|
65
|
+
if (!isRfc3339DateTime(clock)) {
|
|
66
|
+
throw invalidProcessEnvironment(`${PM_REPRODUCIBLE_PROCESS_ENV.clock} must be a valid ISO-8601 instant with Z or a numeric UTC offset.`, "invalid_value", PM_REPRODUCIBLE_PROCESS_ENV.clock, providedFields);
|
|
67
|
+
}
|
|
68
|
+
const tickMs = tick === undefined ? 1 : Number(tick);
|
|
69
|
+
if (tick?.trim().length === 0 ||
|
|
70
|
+
!Number.isSafeInteger(tickMs) ||
|
|
71
|
+
tickMs < 0) {
|
|
72
|
+
throw invalidProcessEnvironment(`${PM_REPRODUCIBLE_PROCESS_ENV.tickMs} must be a non-negative integer.`, "invalid_value", PM_REPRODUCIBLE_PROCESS_ENV.tickMs, providedFields);
|
|
73
|
+
}
|
|
74
|
+
return validateReproducibleExecutionSettings({ clock, seed, tickMs });
|
|
75
|
+
}
|
|
76
|
+
/** Create one process-lifetime runner for long-lived serial transports such as MCP. */
|
|
77
|
+
export function createReproducibleProcessRunner(environment) {
|
|
78
|
+
const settings = resolveReproducibleProcessEnvironment(environment);
|
|
79
|
+
return settings === undefined
|
|
80
|
+
? (operation) => operation()
|
|
81
|
+
: createReproducibleExecutionRunner(settings);
|
|
82
|
+
}
|
|
83
|
+
/** Run one process transport operation under its declared deterministic context. */
|
|
84
|
+
export async function runWithReproducibleProcessEnvironment(environment, operation) {
|
|
85
|
+
return createReproducibleProcessRunner(environment)(operation);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=process.js.map
|
|
88
|
+
//# debugId=ae031bac-f5a1-5762-9c58-0410b8f1f86d
|
|
@@ -53,7 +53,7 @@ export { type VectorizationEmbeddingIdentity, type VectorizationEmbeddingMetadat
|
|
|
53
53
|
export { sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, } from "../core/sentry/helpers.js";
|
|
54
54
|
export { ensureSentryInit } from "../core/sentry/instrument.js";
|
|
55
55
|
export { clearFocusedItem, getFocusedItem, setFocusedItem, } from "../core/session/session-state.js";
|
|
56
|
-
export { readAuthorEnvironment, diagnoseAgentIdentity, resolveAuthor, resolveClaimPrincipal, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, type AgentClientInfo, writeAuthorEnvironment, } from "../core/shared/author.js";
|
|
56
|
+
export { readAuthorEnvironment, diagnoseAgentIdentity, resolveAuthor, resolveClaimPrincipal, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, BUILTIN_AGENT_PROVENANCE_ADAPTERS, listAgentProvenanceAdapters, normalizeAgentProvenanceAdapterValue, registerAgentProvenanceAdapters, type AgentProvenanceAdapter, type AgentClientInfo, writeAuthorEnvironment, } from "../core/shared/author.js";
|
|
57
57
|
export { agentSessionEnvironment, boundAgentEpisodeIdentity, runWithAgentSessionContext, resolveAgentSessionContextFromSignals, type AgentEpisodeIdentity, type AgentSessionContext, } from "../core/shared/agent-session-context.js";
|
|
58
58
|
export { evaluateMutationGuard, isMutationAction, listMutationActions, scanMutationSecrets, type EvaluateMutationGuardOptions, type MutationGuardResult, type MutationGuardSettings, type SecretGuardFinding, type SecretGuardMode, } from "./mutation-guard.js";
|
|
59
59
|
export { jaccardSimilarity, normalizeSimilarityText, scoreItemSimilarity, tokenizeSimilarityText, type ItemSimilarityScore, } from "./similarity-scoring.js";
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* prefer the typed operations exported by the main SDK barrel.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
10
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="472ea74c-138f-584f-b363-e76e100e124c")}catch(e){}}();
|
|
11
11
|
export { createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, } from "../core/checkpoint/mutation-checkpoint.js";
|
|
12
12
|
export { flattenFlagListValue, resolveFlagValueKind, } from "../core/extensions/flag-value-types.js";
|
|
13
13
|
export { createUnknownSubcommandError, } from "./agent/subcommand-recovery.js";
|
|
@@ -55,7 +55,7 @@ export { buildVectorizationEmbeddingIdentity, buildVectorizationEmbeddingMetadat
|
|
|
55
55
|
export { sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, } from "../core/sentry/helpers.js";
|
|
56
56
|
export { ensureSentryInit } from "../core/sentry/instrument.js";
|
|
57
57
|
export { clearFocusedItem, getFocusedItem, setFocusedItem, } from "../core/session/session-state.js";
|
|
58
|
-
export { readAuthorEnvironment, diagnoseAgentIdentity, resolveAuthor, resolveClaimPrincipal, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, } from "../core/shared/author.js";
|
|
58
|
+
export { readAuthorEnvironment, diagnoseAgentIdentity, resolveAuthor, resolveClaimPrincipal, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, BUILTIN_AGENT_PROVENANCE_ADAPTERS, listAgentProvenanceAdapters, normalizeAgentProvenanceAdapterValue, registerAgentProvenanceAdapters, writeAuthorEnvironment, } from "../core/shared/author.js";
|
|
59
59
|
export { agentSessionEnvironment, boundAgentEpisodeIdentity, runWithAgentSessionContext, resolveAgentSessionContextFromSignals, } from "../core/shared/agent-session-context.js";
|
|
60
60
|
export { evaluateMutationGuard, isMutationAction, listMutationActions, scanMutationSecrets, } from "./mutation-guard.js";
|
|
61
61
|
export { jaccardSimilarity, normalizeSimilarityText, scoreItemSimilarity, tokenizeSimilarityText, } from "./similarity-scoring.js";
|
|
@@ -81,4 +81,4 @@ export { maybeRunFirstUseTelemetryPrompt } from "../core/telemetry/consent.js";
|
|
|
81
81
|
export { deriveTelemetryCommandResolution, } from "../core/telemetry/observability.js";
|
|
82
82
|
export { emitTelemetryErrorEvent, finishTelemetryCommand, startTelemetryCommand, } from "../core/telemetry/runtime.js";
|
|
83
83
|
//# sourceMappingURL=runtime-primitives.js.map
|
|
84
|
-
//# debugId=
|
|
84
|
+
//# debugId=472ea74c-138f-584f-b363-e76e100e124c
|
package/dist/sdk/runtime.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, type EnsurePmGitignoreResult, } from "./workspace.js";
|
|
7
7
|
export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
|
|
8
8
|
export type { FlagDefinition } from "../core/extensions/loader.js";
|
|
9
|
+
export * from "./cli-contracts/agent-output-contracts.js";
|
|
9
10
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
10
11
|
import type { ItemMetadata } from "../types/index.js";
|
|
11
12
|
import { type PmCompleteListOptions, type PmCompleteListResult } from "./query/complete-list.js";
|
|
@@ -155,7 +156,7 @@ export declare class PmClient {
|
|
|
155
156
|
/** Return project tracker statistics with the same sections as `pm stats`. */
|
|
156
157
|
stats<Options extends ReadOptions<StatsCommandOptions> = StatsCommandOptions>(options?: Options): ReadPromise<StatsResult, Options>;
|
|
157
158
|
/** Discover existing duplicate clusters without mutating tracker state. */
|
|
158
|
-
duplicates(options?:
|
|
159
|
+
duplicates<Options extends ReadOptions<DuplicatesCommandOptions> = DuplicatesCommandOptions>(options?: Options): ReadPromise<DuplicatesResult, Options>;
|
|
159
160
|
/** List, add, edit, or delete item comments. */
|
|
160
161
|
comments<Options extends ReadOptions<CommentsCommandOptions> = CommentsCommandOptions>(id: string, options?: Options): ReadPromise<CommentsResult, Options>;
|
|
161
162
|
/** List or append private item notes. */
|
|
@@ -371,7 +372,7 @@ export declare function aggregate<Options extends ReadOptions<AggregateOptions>
|
|
|
371
372
|
/** Return project tracker statistics with the same sections as `pm stats` without constructing a reusable client. */
|
|
372
373
|
export declare function stats<Options extends ReadOptions<StatsCommandOptions> = StatsCommandOptions>(options?: Options, clientOptions?: PmClientOptions): ReadPromise<StatsResult, Options>;
|
|
373
374
|
/** Discover duplicate clusters without constructing a reusable client. */
|
|
374
|
-
export declare function duplicates(options?:
|
|
375
|
+
export declare function duplicates<Options extends ReadOptions<DuplicatesCommandOptions> = DuplicatesCommandOptions>(options?: Options, clientOptions?: PmClientOptions): ReadPromise<DuplicatesResult, Options>;
|
|
375
376
|
/** List, add, edit, or delete item comments without constructing a reusable client. */
|
|
376
377
|
export declare function comments<Options extends ReadOptions<CommentsCommandOptions> = CommentsCommandOptions>(id: string, options?: Options, clientOptions?: PmClientOptions): ReadPromise<CommentsResult, Options>;
|
|
377
378
|
/** List or append private item notes without constructing a reusable client. */
|
package/dist/sdk/runtime.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Defines public SDK APIs and package-author helpers for Runtime.
|
|
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]="600f391a-c960-5dda-a85a-04d3fa8b1a51")}catch(e){}}();
|
|
8
8
|
export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, } from "./workspace.js";
|
|
9
9
|
export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
|
|
10
|
+
export * from "./cli-contracts/agent-output-contracts.js";
|
|
10
11
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
11
12
|
import path from "node:path";
|
|
12
13
|
import { createEmptyExtensionCommandRegistry, createEmptyExtensionHookRegistry, createEmptyExtensionParserRegistry, createEmptyExtensionPreflightRegistry, createEmptyExtensionRegistrationRegistry, createEmptyExtensionRendererRegistry, createEmptyExtensionServiceRegistry, } from "../core/extensions/extension-registries.js";
|
|
@@ -1456,12 +1457,13 @@ function runMcpConfigAction(ctx) {
|
|
|
1456
1457
|
const configAction = readString(ctx.args, "configAction") ??
|
|
1457
1458
|
readString(ctx.options, "configAction") ??
|
|
1458
1459
|
readString(ctx.options, "action");
|
|
1459
|
-
if (configAction === undefined)
|
|
1460
|
+
if (configAction === undefined)
|
|
1460
1461
|
throw new PmCliError("Missing required argument: configAction", 64);
|
|
1461
|
-
|
|
1462
|
+
const value = readString(ctx.args, "value") ?? readString(ctx.options, "value");
|
|
1463
|
+
const options = readString(ctx.options, "policy") !== undefined && value !== undefined ? { ...ctx.options, value } : ctx.options;
|
|
1462
1464
|
return runConfig(readString(ctx.args, "scope") ??
|
|
1463
1465
|
readString(ctx.options, "scope") ??
|
|
1464
|
-
"project", configAction, readString(ctx.args, "key") ?? readString(ctx.options, "key"),
|
|
1466
|
+
"project", configAction, readString(ctx.args, "key") ?? readString(ctx.options, "key"), options, ctx.global, readString(ctx.options, "policy") === undefined ? value : undefined);
|
|
1465
1467
|
}
|
|
1466
1468
|
function runMcpActivityAction(ctx) {
|
|
1467
1469
|
const options = ctx.options;
|
|
@@ -1944,4 +1946,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
|
|
|
1944
1946
|
}
|
|
1945
1947
|
}
|
|
1946
1948
|
//# sourceMappingURL=runtime.js.map
|
|
1947
|
-
//# debugId=
|
|
1949
|
+
//# debugId=600f391a-c960-5dda-a85a-04d3fa8b1a51
|
package/dist/sdk/test/batch.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ export interface TestAllCommandOptions {
|
|
|
25
25
|
pmContext?: string;
|
|
26
26
|
/** Value that configures or reports override linked pm context for this contract. */
|
|
27
27
|
overrideLinkedPmContext?: boolean;
|
|
28
|
+
/** Source-workspace visibility and working-directory mode. */
|
|
29
|
+
workspaceContext?: string;
|
|
30
|
+
/** Force run-level source-workspace mode over linked metadata. */
|
|
31
|
+
overrideLinkedWorkspaceContext?: boolean;
|
|
32
|
+
/** Explicitly permit untrusted commands when project policy also permits them. */
|
|
33
|
+
allowUntrustedLinkedTests?: boolean;
|
|
28
34
|
/** Value that configures or reports fail on context mismatch for this contract. */
|
|
29
35
|
failOnContextMismatch?: boolean;
|
|
30
36
|
/** Value that configures or reports fail on skipped for this contract. */
|