@unbrained/pm-cli 2026.9.4 → 2026.9.6
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/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
- package/.agents/skills/README.md +2 -2
- package/.agents/skills/pm-developer/SKILL.md +4 -1
- package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +10 -0
- package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +3 -1
- package/.agents/skills/pm-extensions/SKILL.md +2 -2
- package/.agents/skills/pm-extensions/references/LIFECYCLE.md +3 -3
- package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +3 -3
- package/.agents/skills/pm-user/SKILL.md +2 -0
- package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +5 -0
- package/.agents/skills/pm-user/references/WORKFLOWS.md +20 -5
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +58 -3
- package/dist/cli/commander-usage.d.ts +2 -0
- package/dist/cli/commander-usage.js +15 -12
- package/dist/cli/help-json-payload.js +12 -7
- package/dist/cli/main.js +22 -11
- package/dist/cli/register-list-query.js +4 -2
- package/dist/cli/register-mutation.js +4 -2
- package/dist/cli/register-operations.js +17 -8
- package/dist/cli-bundle/bundle-manifest.json +153 -161
- package/dist/cli-bundle/chunks/chunk-AZDFJGH6.js +9 -0
- package/dist/cli-bundle/chunks/{chunk-V72UV7QS.js → chunk-BAX2BYUW.js} +73 -73
- package/dist/cli-bundle/chunks/{chunk-HI6BHPCU.js → chunk-CKOL5U7J.js} +51 -51
- package/dist/cli-bundle/chunks/{chunk-A24WAVE6.js → chunk-JT6XF6GE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-I2AS367G.js → chunk-JX4DH4WC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YW4QK2G7.js → chunk-NPN5I67J.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-OF76PSDQ.js +5 -0
- package/dist/cli-bundle/chunks/chunk-QUWFABDM.js +232 -0
- package/dist/cli-bundle/chunks/{chunk-RI4XNOYS.js → chunk-RWWBOWJ5.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-WGAOYSYH.js +40 -0
- package/dist/cli-bundle/chunks/{chunk-X6CMGV6L.js → chunk-WI2AYPA7.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-Z5YYSJJG.js → register-list-query-5JL52D33.js} +3 -3
- package/dist/cli-bundle/chunks/{register-mutation-ELSP6I4I.js → register-mutation-ZPG7KMVP.js} +4 -4
- package/dist/cli-bundle/chunks/register-operations-I5W3KMGB.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-E2AE72QG.js → register-setup-H4SVAVX7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3646BZ4W.js → chunk-3BZEOXLT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-AL5ON6K6.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-CHC2IDXA.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-CK6QFAPZ.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NBMJD6MK.js → chunk-EZR3GHFE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-H2WJWK7L.js +56 -0
- package/dist/cli-bundle/focused-chunks/{chunk-53IHPICX.js → chunk-LIJIA4TY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-25UJBH4M.js → chunk-M6PBRFSH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AJR3OP2E.js → chunk-NTPY5GSO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-P5O7MP5Y.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-PDMW2E36.js +177 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MHKUIPJW.js → chunk-PEFABF7E.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6PWPQKDN.js → chunk-QTVCLMSZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7N2TV7WZ.js → chunk-QTZRBUYA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-SGQST3PQ.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-UKHASMMP.js +10 -0
- package/dist/cli-bundle/focused-chunks/chunk-ZPEKQHOC.js +2 -0
- package/dist/cli-bundle/main.js +22 -15
- 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 +37 -37
- 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 +42 -39
- 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 +9 -9
- package/dist/core/extensions/extension-types.d.ts +2 -0
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/module-graph-snapshot.js +5 -4
- package/dist/core/fs/host-environment-errors.d.ts +27 -0
- package/dist/core/fs/host-environment-errors.js +142 -0
- package/dist/core/history/drift-scan.d.ts +5 -0
- package/dist/core/history/drift-scan.js +16 -6
- package/dist/core/history/event-classification.d.ts +1 -1
- package/dist/core/history/event-classification.js +3 -2
- package/dist/core/history/history.js +37 -5
- package/dist/core/history/identity.d.ts +15 -0
- package/dist/core/history/identity.js +31 -0
- package/dist/core/history/projection.js +50 -17
- package/dist/core/history/read.js +6 -3
- package/dist/core/history/replay.d.ts +1 -2
- package/dist/core/history/replay.js +4 -4
- package/dist/core/history/version-address.d.ts +13 -0
- package/dist/core/history/version-address.js +33 -0
- package/dist/core/item/actionability.d.ts +21 -1
- package/dist/core/item/actionability.js +45 -10
- package/dist/core/item/id.js +8 -4
- package/dist/core/item/item-type-definition.d.ts +2 -0
- package/dist/core/item/item-type-definition.js +9 -2
- package/dist/core/item/type-registry.d.ts +5 -1
- package/dist/core/item/type-registry.js +9 -4
- package/dist/core/output/mutation-projection.js +12 -5
- package/dist/core/shared/errors.d.ts +8 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/item-metadata-query-index.js +13 -10
- package/dist/core/store/item-metadata-read-work.d.ts +19 -0
- package/dist/core/store/item-metadata-read-work.js +44 -0
- package/dist/core/store/item-store.d.ts +14 -0
- package/dist/core/store/item-store.js +52 -10
- package/dist/core/store/settings-validator.js +3 -2
- package/dist/core/validate/fix-planning.d.ts +1 -1
- package/dist/core/validate/fix-planning.js +2 -2
- package/dist/core/validate/missing-link-owners.d.ts +1 -1
- package/dist/core/validate/missing-link-owners.js +5 -3
- package/dist/core/validate/stale-file-classification.d.ts +6 -4
- package/dist/core/validate/stale-file-classification.js +20 -5
- package/dist/mcp/server.js +12 -5
- package/dist/sdk/actionability.d.ts +1 -1
- package/dist/sdk/actionability.js +3 -3
- package/dist/sdk/cli-contracts/command-aliases.js +11 -2
- package/dist/sdk/cli-contracts/completeness.js +4 -3
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +31 -5
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +21 -13
- package/dist/sdk/cli-contracts/grammar-contracts.js +11 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +5 -2
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +254 -5
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +52 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +30 -6
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +32 -7
- package/dist/sdk/context/usage-ledger.d.ts +41 -0
- package/dist/sdk/context/usage-ledger.js +186 -0
- package/dist/sdk/context-intent-contracts.js +3 -3
- package/dist/sdk/context-usage.d.ts +18 -9
- package/dist/sdk/context-usage.js +44 -121
- package/dist/sdk/define.d.ts +1 -1
- package/dist/sdk/define.js +2 -2
- package/dist/sdk/dependency-provenance.d.ts +7 -0
- package/dist/sdk/dependency-provenance.js +14 -4
- package/dist/sdk/duplicates.d.ts +2 -0
- package/dist/sdk/duplicates.js +3 -2
- package/dist/sdk/environment/host-environment-errors.d.ts +5 -27
- package/dist/sdk/environment/host-environment-errors.js +4 -137
- package/dist/sdk/extension/install-runtime.js +9 -6
- package/dist/sdk/extension/install-snapshot.js +7 -6
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +104 -56
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -2
- package/dist/sdk/governance/assurance-action.d.ts +3 -2
- package/dist/sdk/governance/assurance-action.js +23 -11
- package/dist/sdk/governance/assurance-runtime.d.ts +2 -0
- package/dist/sdk/governance/assurance-runtime.js +6 -3
- package/dist/sdk/governance/defect-recurrence-coverage.d.ts +93 -0
- package/dist/sdk/governance/defect-recurrence-coverage.js +189 -0
- package/dist/sdk/governance/defect-recurrence-graph.d.ts +33 -0
- package/dist/sdk/governance/defect-recurrence-graph.js +121 -0
- package/dist/sdk/governance/defect-recurrence.d.ts +8 -0
- package/dist/sdk/governance/defect-recurrence.js +118 -17
- package/dist/sdk/governance/health.d.ts +17 -2
- package/dist/sdk/governance/health.js +31 -10
- package/dist/sdk/governance/linked-file-report.d.ts +41 -0
- package/dist/sdk/governance/linked-file-report.js +72 -0
- package/dist/sdk/governance/validate-history-drift.js +16 -5
- package/dist/sdk/governance/validate.d.ts +5 -2
- package/dist/sdk/governance/validate.js +21 -37
- package/dist/sdk/governance.d.ts +2 -0
- package/dist/sdk/governance.js +4 -2
- package/dist/sdk/guide-topics.js +116 -2
- package/dist/sdk/history/salvage.d.ts +35 -0
- package/dist/sdk/history/salvage.js +248 -0
- package/dist/sdk/history-compact.js +32 -37
- package/dist/sdk/history-read.d.ts +3 -2
- package/dist/sdk/history-read.js +6 -3
- package/dist/sdk/history-repair.d.ts +12 -0
- package/dist/sdk/history-repair.js +60 -13
- package/dist/sdk/lifecycle/claim.d.ts +4 -0
- package/dist/sdk/lifecycle/claim.js +9 -3
- package/dist/sdk/lifecycle/close.d.ts +8 -0
- package/dist/sdk/lifecycle/close.js +16 -8
- package/dist/sdk/lifecycle/create.js +9 -12
- package/dist/sdk/lifecycle/restore.d.ts +1 -0
- package/dist/sdk/lifecycle/restore.js +19 -7
- package/dist/sdk/lifecycle/update.js +12 -12
- package/dist/sdk/lifecycle-policy.d.ts +3 -0
- package/dist/sdk/lifecycle-policy.js +2 -2
- package/dist/sdk/merge/abandoned-receipts.d.ts +15 -0
- package/dist/sdk/merge/abandoned-receipts.js +47 -0
- package/dist/sdk/merge/driver.js +4 -2
- package/dist/sdk/merge/index.d.ts +1 -0
- package/dist/sdk/merge/index.js +2 -2
- package/dist/sdk/merge/receipt-operation.d.ts +15 -0
- package/dist/sdk/merge/receipt-operation.js +97 -0
- package/dist/sdk/merge/receipt-schema.d.ts +20 -0
- package/dist/sdk/merge/receipt-schema.js +398 -0
- package/dist/sdk/merge/receipts.d.ts +16 -7
- package/dist/sdk/merge/receipts.js +54 -340
- package/dist/sdk/merge/reconcile.d.ts +2 -0
- package/dist/sdk/merge/reconcile.js +11 -4
- package/dist/sdk/output-projection.d.ts +3 -1
- package/dist/sdk/output-projection.js +11 -3
- package/dist/sdk/public-surface.json +1 -0
- package/dist/sdk/query/context.d.ts +9 -0
- package/dist/sdk/query/context.js +33 -21
- package/dist/sdk/query/duplicate-candidates.d.ts +7 -0
- package/dist/sdk/query/duplicate-candidates.js +71 -0
- package/dist/sdk/query/get.d.ts +2 -2
- package/dist/sdk/query/get.js +9 -8
- package/dist/sdk/query/history.d.ts +11 -0
- package/dist/sdk/query/history.js +34 -10
- package/dist/sdk/query/next.d.ts +15 -1
- package/dist/sdk/query/next.js +43 -20
- package/dist/sdk/query.d.ts +3 -0
- package/dist/sdk/query.js +5 -2
- package/dist/sdk/read-output-session.js +5 -3
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.js +4 -2
- package/dist/sdk/similarity.d.ts +24 -3
- package/dist/sdk/similarity.js +50 -55
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_GUIDE.md +58 -1
- package/docs/BOUNDED_CONTEXT_READS.md +185 -0
- package/docs/CLOSE_EVIDENCE_RECOVERY.md +35 -0
- package/docs/COMMANDS.md +30 -8
- package/docs/CONTEXT_RELEVANCE.md +16 -4
- package/docs/DEFECT_RECURRENCE.md +80 -6
- package/docs/EXTENSIONS.md +18 -19
- package/docs/HISTORY_RECOVERY.md +146 -0
- package/docs/MERGE_SAFETY.md +50 -0
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +66 -0
- package/docs/PR_REVIEW_LOOP.md +18 -3
- package/docs/README.md +19 -1
- package/docs/RELEASING.md +31 -13
- package/docs/SDK_CONTEXT_TRUTH_CONTRACTS.md +24 -1
- package/docs/SDK_EXECUTION_CONTRACTS.md +105 -0
- package/docs/SDK_LIFECYCLE.md +27 -0
- package/docs/SDK_RUNTIME_BOUNDARIES.md +11 -0
- package/docs/TESTING.md +5 -0
- package/docs/agent-task-token-baseline.json +17 -17
- package/docs/agent-task-transcripts.json +2 -1
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +11 -11
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -3
- package/marketplace.json +2 -2
- package/package.json +8 -6
- 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/README.md +10 -1
- package/packages/pm-governance-audit/extensions/governance-audit/dedupe-audit.ts +50 -65
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +2 -2
- package/packages/pm-governance-audit/extensions/governance-audit/sdk.ts +1 -0
- 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-claude/skills/pm-audit/SKILL.md +2 -2
- package/plugins/pm-claude/skills/pm-developer/SKILL.md +2 -2
- package/plugins/pm-claude/skills/pm-planner/SKILL.md +2 -2
- package/plugins/pm-claude/skills/pm-release/SKILL.md +2 -2
- package/plugins/pm-claude/skills/pm-workflow/SKILL.md +3 -3
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/skills/pm-auditor/SKILL.md +2 -2
- package/plugins/pm-codex/skills/pm-native/SKILL.md +3 -4
- package/plugins/pm-codex/skills/pm-release/SKILL.md +2 -2
- package/scripts/finalize-build.mjs +13 -1
- package/dist/cli-bundle/chunks/chunk-6XSKPNCF.js +0 -230
- package/dist/cli-bundle/chunks/chunk-OGBVU67G.js +0 -5
- package/dist/cli-bundle/chunks/chunk-TXW6VL33.js +0 -38
- package/dist/cli-bundle/chunks/chunk-VGLHECAP.js +0 -9
- package/dist/cli-bundle/chunks/register-operations-OH7R3ZT4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4YRAVI43.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-5P4HVOWG.js +0 -176
- package/dist/cli-bundle/focused-chunks/chunk-636VVQ7F.js +0 -54
- package/dist/cli-bundle/focused-chunks/chunk-B3A6MJYE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-BFDDJ2T2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-BHUIRZWQ.js +0 -9
- package/dist/cli-bundle/focused-chunks/chunk-JADHHPY6.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-NSKBLHVI.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-P2GOAOQN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YARWJM2B.js +0 -2
- package/sdk/public-surface.json +0 -33034
|
@@ -267,6 +267,15 @@ interface ContextAgendaSummary {
|
|
|
267
267
|
scheduled: number;
|
|
268
268
|
}
|
|
269
269
|
interface ContextSummary {
|
|
270
|
+
/** Population counters honor item filters and parent scope, never output limits. */
|
|
271
|
+
scope?: "matching_items";
|
|
272
|
+
/** Counts for the bounded focus selection, separate from the matching population. */
|
|
273
|
+
returned_focus?: {
|
|
274
|
+
active_items: number;
|
|
275
|
+
in_progress: number;
|
|
276
|
+
open: number;
|
|
277
|
+
blocked: number;
|
|
278
|
+
};
|
|
270
279
|
active_items: number;
|
|
271
280
|
in_progress: number;
|
|
272
281
|
open: number;
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Implements the pm context command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
8
|
-
import { SETTINGS_DEFAULTS, EXIT_CODE, PmCliError, compareTimestampStrings, nowIso, isTerminalStatus, normalizeStatusForRegistry, normalizeStatusInput, resolveRuntimeStatusRegistry, resolvePmRoot, readSettings, resolveAuthor, discoverExtensions, } from "../runtime-primitives.js";
|
|
9
|
-
import {
|
|
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]="4f8e82a2-f4ea-5ecb-8ef5-3ca795cdeda5")}catch(e){}}();
|
|
8
|
+
import { SETTINGS_DEFAULTS, EXIT_CODE, PmCliError, compareTimestampStrings, nowIso, isTerminalStatus, normalizeStatusForRegistry, normalizeStatusInput, resolveRuntimeStatusRegistry, resolvePmRoot, readSettings, resolveAuthor, discoverExtensions, resolveItemTypeRegistry, } from "../runtime-primitives.js";
|
|
9
|
+
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
10
|
+
import { collectDependencyBlockedIds, resolveItemBlockers, resolveItemExecutionRole, computeActionabilityReport, } from "../actionability.js";
|
|
10
11
|
import { CONTEXT_DEPTH_VALUES, CONTEXT_SECTION_VALUES, } from "../../types/index.js";
|
|
11
12
|
import { parseIntegerLimit } from "./parsers.js";
|
|
12
13
|
import { runCalendar, } from "./calendar.js";
|
|
@@ -1201,7 +1202,6 @@ function buildUnpaginatedContextListOptions(baseListOptions, extra) {
|
|
|
1201
1202
|
};
|
|
1202
1203
|
}
|
|
1203
1204
|
async function loadContextCorpus(global, runtime) {
|
|
1204
|
-
const needsAllItems = contextNeedsAllItems(runtime.sectionsIncluded);
|
|
1205
1205
|
// One full-corpus scan serves every consumer: runList always reads all item
|
|
1206
1206
|
// files before filtering, so deriving the non-terminal subset in memory is
|
|
1207
1207
|
// free and keeps terminal blocker targets available for the shared
|
|
@@ -1211,9 +1211,7 @@ async function loadContextCorpus(global, runtime) {
|
|
|
1211
1211
|
}), global);
|
|
1212
1212
|
const fullCorpus = listed.items;
|
|
1213
1213
|
let listedItemMetadata = fullCorpus.filter((item) => !isTerminalStatus(item.status, runtime.statusRegistry));
|
|
1214
|
-
let allItems =
|
|
1215
|
-
? fullCorpus
|
|
1216
|
-
: listedItemMetadata;
|
|
1214
|
+
let allItems = fullCorpus;
|
|
1217
1215
|
const subtreeIds = resolveContextSubtreeIds(runtime.parentScope, fullCorpus);
|
|
1218
1216
|
if (subtreeIds) {
|
|
1219
1217
|
listedItemMetadata = listedItemMetadata.filter((item) => subtreeIds.has(item.id.trim().toLowerCase()));
|
|
@@ -1231,7 +1229,14 @@ function resolveContextSubtreeIds(parentScope, fullCorpus) {
|
|
|
1231
1229
|
}
|
|
1232
1230
|
return subtree.ids;
|
|
1233
1231
|
}
|
|
1234
|
-
|
|
1232
|
+
/** Classify strategic and human-directed context through the shared execution rules. */
|
|
1233
|
+
function collectHighLevelContextIds(activeItems, fullCorpus, statusRegistry, typeRegistry) {
|
|
1234
|
+
const containers = new Set(computeActionabilityReport(activeItems, fullCorpus, statusRegistry, typeRegistry)
|
|
1235
|
+
.containers.map((entry) => entry.item.id));
|
|
1236
|
+
return new Set(activeItems.filter((item) => HIGH_LEVEL_TYPES.has(item.type) || containers.has(item.id) ||
|
|
1237
|
+
resolveItemExecutionRole(item.type, typeRegistry) !== "agent").map((item) => item.id));
|
|
1238
|
+
}
|
|
1239
|
+
async function resolveContextFocusGroups(listedItemMetadata, allItems, fullCorpus, blockedIds, statusRegistry, sectionsIncluded, limit, now, author, cursor, cursorFingerprint, useBoundedPage, pmRoot, tokenBudget, claimFocus, typeRegistry) {
|
|
1235
1240
|
const structural = [...listedItemMetadata].sort((left, right) => compareCriticalItems(left, right, statusRegistry));
|
|
1236
1241
|
const usage = await readContextUsageAffinity({
|
|
1237
1242
|
pmRoot,
|
|
@@ -1293,12 +1298,13 @@ async function resolveContextFocusGroups(listedItemMetadata, allItems, fullCorpu
|
|
|
1293
1298
|
.map((blocker) => blocker.id);
|
|
1294
1299
|
return focus;
|
|
1295
1300
|
};
|
|
1301
|
+
const highLevelIds = collectHighLevelContextIds(activeItems, fullCorpus, statusRegistry, typeRegistry);
|
|
1296
1302
|
const highLevel = activeItems
|
|
1297
|
-
.filter((item) =>
|
|
1303
|
+
.filter((item) => highLevelIds.has(item.id))
|
|
1298
1304
|
.slice(0, useBoundedPage ? focusPage.length : limit)
|
|
1299
1305
|
.map(projectFocusItem);
|
|
1300
1306
|
const lowLevel = activeItems
|
|
1301
|
-
.filter((item) => !
|
|
1307
|
+
.filter((item) => !highLevelIds.has(item.id))
|
|
1302
1308
|
.slice(0, useBoundedPage ? focusPage.length : limit)
|
|
1303
1309
|
.map(projectFocusItem);
|
|
1304
1310
|
const blockedFallbackUsed = rankedActiveItems.length === 0;
|
|
@@ -1409,12 +1415,16 @@ async function buildOptionalContextSections(params) {
|
|
|
1409
1415
|
tests: has("tests") ? buildTestHealth(focusGroups.activeItems) : undefined,
|
|
1410
1416
|
};
|
|
1411
1417
|
}
|
|
1412
|
-
function buildContextSummaryExtras(
|
|
1413
|
-
if (!needsAllItems) {
|
|
1414
|
-
return {};
|
|
1415
|
-
}
|
|
1418
|
+
function buildContextSummaryExtras(allItems, statusRegistry, blockedIds) {
|
|
1416
1419
|
const canceledStatus = normalizeStatusInput("canceled", statusRegistry);
|
|
1420
|
+
const activeItems = allItems.filter((item) => statusRegistry.active_statuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
|
|
1421
|
+
const inProgress = countContextStatus(activeItems, statusRegistry.in_progress_status, statusRegistry);
|
|
1417
1422
|
return {
|
|
1423
|
+
scope: "matching_items",
|
|
1424
|
+
active_items: activeItems.length,
|
|
1425
|
+
open: activeItems.length - inProgress,
|
|
1426
|
+
in_progress: inProgress,
|
|
1427
|
+
blocked: allItems.filter((item) => blockedIds.has(item.id.trim().toLowerCase())).length,
|
|
1418
1428
|
total_items: allItems.length,
|
|
1419
1429
|
closed: allItems.filter((item) => isClosedStatus(item.status, statusRegistry)).length,
|
|
1420
1430
|
canceled: allItems.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) ===
|
|
@@ -1595,7 +1605,7 @@ export async function runContext(options, global) {
|
|
|
1595
1605
|
// Single shared edge-aware blocked classification (GH-578): resolved against
|
|
1596
1606
|
// the full corpus so terminal blocker targets count as satisfied at every depth.
|
|
1597
1607
|
const blockedIds = collectDependencyBlockedIds(corpus.fullCorpus, runtime.statusRegistry);
|
|
1598
|
-
const focusGroups = await resolveContextFocusGroups(corpus.listedItemMetadata, corpus.allItems, corpus.fullCorpus, blockedIds, runtime.statusRegistry, runtime.sectionsIncluded, runtime.limit, nowIso(), author, options.after, buildContextCursorFingerprint(options), shouldPageContextFocus(options, corpus.fullCorpus.length), pmRoot, runtime.tokenBudget, claimFocus);
|
|
1608
|
+
const focusGroups = await resolveContextFocusGroups(corpus.listedItemMetadata, corpus.allItems, corpus.fullCorpus, blockedIds, runtime.statusRegistry, runtime.sectionsIncluded, runtime.limit, nowIso(), author, options.after, buildContextCursorFingerprint(options), shouldPageContextFocus(options, corpus.fullCorpus.length), pmRoot, runtime.tokenBudget, claimFocus, resolveItemTypeRegistry(runtime.settings, getActiveExtensionRegistrations()));
|
|
1599
1609
|
const agendaContext = await buildContextAgenda(global, runtime, corpus.subtreeIds, new Set([
|
|
1600
1610
|
...focusGroups.highLevel,
|
|
1601
1611
|
...focusGroups.lowLevel,
|
|
@@ -1618,7 +1628,7 @@ export async function runContext(options, global) {
|
|
|
1618
1628
|
now: agendaContext.agenda.now,
|
|
1619
1629
|
global,
|
|
1620
1630
|
});
|
|
1621
|
-
const summaryExtras = buildContextSummaryExtras(
|
|
1631
|
+
const summaryExtras = buildContextSummaryExtras(corpus.allItems, runtime.statusRegistry, blockedIds);
|
|
1622
1632
|
const result = {
|
|
1623
1633
|
output_default: "toon",
|
|
1624
1634
|
now: agendaContext.agenda.now,
|
|
@@ -1649,10 +1659,12 @@ export async function runContext(options, global) {
|
|
|
1649
1659
|
{}),
|
|
1650
1660
|
},
|
|
1651
1661
|
summary: {
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1662
|
+
returned_focus: {
|
|
1663
|
+
active_items: focusGroups.activeItems.length,
|
|
1664
|
+
in_progress: inProgressCount,
|
|
1665
|
+
open: openCount,
|
|
1666
|
+
blocked: focusGroups.blockedItems.length,
|
|
1667
|
+
},
|
|
1656
1668
|
blocked_fallback_used: focusGroups.blockedFallbackUsed,
|
|
1657
1669
|
high_level: focusGroups.highLevel.length,
|
|
1658
1670
|
low_level: focusGroups.lowLevel.length,
|
|
@@ -1688,4 +1700,4 @@ export async function runContext(options, global) {
|
|
|
1688
1700
|
return result;
|
|
1689
1701
|
}
|
|
1690
1702
|
//# sourceMappingURL=context.js.map
|
|
1691
|
-
//# debugId=
|
|
1703
|
+
//# debugId=4f8e82a2-f4ea-5ecb-8ef5-3ca795cdeda5
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PreparedSimilarityText } from "../similarity-scoring.js";
|
|
2
|
+
/** Declared safety bound applies to retained pairs, never silently to recall. */
|
|
3
|
+
export declare const MAX_DUPLICATE_CANDIDATE_PAIRS = 1000000;
|
|
4
|
+
/** Generate every potentially qualifying pair once, with an explicit exhaustive oracle. */
|
|
5
|
+
export declare function collectDuplicateCandidatePairs(items: readonly {
|
|
6
|
+
prepared: PreparedSimilarityText;
|
|
7
|
+
}[], maxPairs?: number, threshold?: number, exhaustive?: boolean): Set<string>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/query/duplicate-candidates
|
|
3
|
+
*
|
|
4
|
+
* Lossless prefix filtering for Jaccard joins. A globally ordered prefix of
|
|
5
|
+
* length n-ceil(threshold*n)+1 must intersect the corresponding prefix of
|
|
6
|
+
* every qualifying set. Exact titles and issue codes remain independent
|
|
7
|
+
* signals, including titles with no word tokens.
|
|
8
|
+
*/
|
|
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]="d425cf45-5b62-5613-a5ce-78da6b0e201b")}catch(e){}}();
|
|
11
|
+
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
12
|
+
import { PmCliError } from "../../core/shared/errors.js";
|
|
13
|
+
/** Declared safety bound applies to retained pairs, never silently to recall. */
|
|
14
|
+
export const MAX_DUPLICATE_CANDIDATE_PAIRS = 1_000_000;
|
|
15
|
+
/** Generate every potentially qualifying pair once, with an explicit exhaustive oracle. */
|
|
16
|
+
export function collectDuplicateCandidatePairs(items, maxPairs = MAX_DUPLICATE_CANDIDATE_PAIRS, threshold = 0.8, exhaustive = false) {
|
|
17
|
+
const candidates = new Set();
|
|
18
|
+
/** Deduplicate a candidate pair and refuse before publishing an over-budget result. */
|
|
19
|
+
const add = (left, right) => {
|
|
20
|
+
candidates.add(`${left}:${right}`);
|
|
21
|
+
if (candidates.size > maxPairs) {
|
|
22
|
+
throw new PmCliError(`Duplicate sweep exceeded ${maxPairs} candidate pairs; narrow it with statuses or since.`, EXIT_CODE.CONFLICT, { code: "duplicate_sweep_cost_limit", required: "Narrow the duplicate query or increase its similarity threshold. No partial result was returned." });
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
if (exhaustive || threshold === 0) {
|
|
26
|
+
for (let right = 0; right < items.length; right += 1) {
|
|
27
|
+
for (let left = 0; left < right; left += 1)
|
|
28
|
+
add(left, right);
|
|
29
|
+
}
|
|
30
|
+
return candidates;
|
|
31
|
+
}
|
|
32
|
+
const frequencies = new Map();
|
|
33
|
+
for (const { prepared } of items) {
|
|
34
|
+
for (const token of prepared.tokens)
|
|
35
|
+
frequencies.set(token, (frequencies.get(token) ?? 0) + 1);
|
|
36
|
+
}
|
|
37
|
+
const exact = new Map();
|
|
38
|
+
const codes = new Map();
|
|
39
|
+
const prefixes = new Map();
|
|
40
|
+
for (const [right, { prepared }] of items.entries()) {
|
|
41
|
+
const tokens = [...prepared.tokens].sort((left, other) => frequencies.get(left) - frequencies.get(other) || left.localeCompare(other));
|
|
42
|
+
// An epsilon expands rather than shrinks the prefix at floating boundaries.
|
|
43
|
+
const prefixLength = tokens.length - Math.ceil(threshold * tokens.length - 1e-12) + 1;
|
|
44
|
+
const signals = [
|
|
45
|
+
{ index: exact, keys: [prepared.normalized], lengthFilter: false },
|
|
46
|
+
{ index: codes, keys: threshold <= 0.99 ? prepared.issueCodes : [], lengthFilter: false },
|
|
47
|
+
{ index: prefixes, keys: tokens.length === 0 ? [""] : tokens.slice(0, prefixLength), lengthFilter: true },
|
|
48
|
+
];
|
|
49
|
+
for (const signal of signals) {
|
|
50
|
+
appendPostingCandidates(items, right, signal, threshold, add);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return candidates;
|
|
54
|
+
}
|
|
55
|
+
/** Join one exact/code/prefix posting list, applying the Jaccard length bound only to tokens. */
|
|
56
|
+
function appendPostingCandidates(items, right, signal, threshold, add) {
|
|
57
|
+
const rightLength = items[right].prepared.tokens.length;
|
|
58
|
+
for (const key of signal.keys) {
|
|
59
|
+
const posting = signal.index.get(key) ?? [];
|
|
60
|
+
for (const left of posting) {
|
|
61
|
+
const leftLength = items[left].prepared.tokens.length;
|
|
62
|
+
if (signal.lengthFilter && Math.min(leftLength, rightLength) / Math.max(leftLength, rightLength) + 1e-12 < threshold)
|
|
63
|
+
continue;
|
|
64
|
+
add(left, right);
|
|
65
|
+
}
|
|
66
|
+
posting.push(right);
|
|
67
|
+
signal.index.set(key, posting);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=duplicate-candidates.js.map
|
|
71
|
+
//# debugId=d425cf45-5b62-5613-a5ce-78da6b0e201b
|
package/dist/sdk/query/get.d.ts
CHANGED
|
@@ -52,8 +52,8 @@ export interface GetResult {
|
|
|
52
52
|
schedule?: Partial<ItemScheduleContext>;
|
|
53
53
|
/** True when the item was reconstructed from immutable history. */
|
|
54
54
|
reconstructed?: true;
|
|
55
|
-
/**
|
|
56
|
-
as_of_version?: number;
|
|
55
|
+
/** Durable version, or null when legacy compaction lost the numeric mapping. */
|
|
56
|
+
as_of_version?: number | null;
|
|
57
57
|
/** Timestamp of the last history entry included in a reconstructed read. */
|
|
58
58
|
as_of_timestamp?: string;
|
|
59
59
|
/** Value that configures or reports tree for this contract. */
|
package/dist/sdk/query/get.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the SDK-owned item query shared by every surface.
|
|
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]="88732a1d-ae5a-5dfb-93d6-9659cb6f05c3")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
9
|
import { getActiveExtensionRegistrations, toItemRecord, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, TYPE_TO_FOLDER, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, getHistoryPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
10
10
|
import { readHistoryEntries } from "../history-read.js";
|
|
@@ -310,6 +310,7 @@ function shouldIncludeGetField(params) {
|
|
|
310
310
|
}
|
|
311
311
|
return depth !== "brief";
|
|
312
312
|
}
|
|
313
|
+
/** Derive claim evidence from the selected physical history prefix, excluding future claims. */
|
|
313
314
|
async function resolveGetClaimState(context, includeClaimState) {
|
|
314
315
|
if (!includeClaimState) {
|
|
315
316
|
return undefined;
|
|
@@ -317,7 +318,7 @@ async function resolveGetClaimState(context, includeClaimState) {
|
|
|
317
318
|
const historyPath = getHistoryPath(context.pmRoot, context.locatedId);
|
|
318
319
|
const history = await readHistoryEntries(historyPath, context.locatedId);
|
|
319
320
|
return resolveClaimStateContext(context.metadata.assignee, context.historical
|
|
320
|
-
? history.slice(0, context.historical.
|
|
321
|
+
? history.slice(0, context.historical.target.historyIndex + 1)
|
|
321
322
|
: history);
|
|
322
323
|
}
|
|
323
324
|
function attachGetLinked(result, context, fields, includeLinked) {
|
|
@@ -336,14 +337,14 @@ function attachGetLinked(result, context, fields, includeLinked) {
|
|
|
336
337
|
docs: includeLinkedDocs ? (context.metadata.docs ?? []) : [],
|
|
337
338
|
};
|
|
338
339
|
}
|
|
339
|
-
|
|
340
|
+
/** Enumerate hierarchy metadata only when the caller explicitly requested a child rollup. */
|
|
341
|
+
async function buildGetChildrenRollup(context, includeChildren) {
|
|
340
342
|
if (!includeChildren) {
|
|
341
343
|
return undefined;
|
|
342
344
|
}
|
|
343
345
|
const statusRegistry = resolveRuntimeStatusRegistry(context.settings.schema);
|
|
344
346
|
const corpus = await listAllItemMetadataLight(context.pmRoot, context.settings.item_format, context.typeToFolder, undefined, context.settings.schema);
|
|
345
|
-
|
|
346
|
-
return rollup.count > 0 || includeEmpty ? rollup : undefined;
|
|
347
|
+
return buildItemChildrenRollup(context.locatedId, corpus, statusRegistry);
|
|
347
348
|
}
|
|
348
349
|
function attachGetSchedule(result, context, fields, includeSchedule) {
|
|
349
350
|
if (!includeSchedule) {
|
|
@@ -394,7 +395,7 @@ export async function runGet(id, global, options = {}) {
|
|
|
394
395
|
const includeChildren = context.historical === undefined &&
|
|
395
396
|
(projection.fieldProjection
|
|
396
397
|
? fieldsIncludeRoot(projection.fields, "children")
|
|
397
|
-
: projection.depth
|
|
398
|
+
: projection.depth === "deep" &&
|
|
398
399
|
shouldAutoIncludeGetChildren(context.metadata.type));
|
|
399
400
|
const includeSchedule = projection.fieldProjection
|
|
400
401
|
? fieldsIncludeRoot(projection.fields, "schedule")
|
|
@@ -413,7 +414,7 @@ export async function runGet(id, global, options = {}) {
|
|
|
413
414
|
result.claim_state = claimState;
|
|
414
415
|
}
|
|
415
416
|
attachGetSchedule(result, context, projection.fields, includeSchedule);
|
|
416
|
-
const children = await buildGetChildrenRollup(context, includeChildren
|
|
417
|
+
const children = await buildGetChildrenRollup(context, includeChildren);
|
|
417
418
|
if (children !== undefined) {
|
|
418
419
|
result.children = children;
|
|
419
420
|
}
|
|
@@ -447,4 +448,4 @@ export const _testOnlyGetCommand = {
|
|
|
447
448
|
shouldAutoIncludeGetChildren,
|
|
448
449
|
};
|
|
449
450
|
//# sourceMappingURL=get.js.map
|
|
450
|
-
//# debugId=
|
|
451
|
+
//# debugId=88732a1d-ae5a-5dfb-93d6-9659cb6f05c3
|
|
@@ -32,6 +32,8 @@ export interface HistoryCommandOptions {
|
|
|
32
32
|
export interface HistoryDiffEntry {
|
|
33
33
|
/** Value that configures or reports index for this contract. */
|
|
34
34
|
index: number;
|
|
35
|
+
/** Durable version address after compaction; null for unmapped legacy checkpoints. */
|
|
36
|
+
version?: number | null;
|
|
35
37
|
/** Value that configures or reports ts for this contract. */
|
|
36
38
|
ts: string;
|
|
37
39
|
/** Value that configures or reports op for this contract. */
|
|
@@ -74,6 +76,15 @@ export interface HistoryResult {
|
|
|
74
76
|
verification?: HistoryVerificationResult;
|
|
75
77
|
/** Constant-size provenance completeness metrics. */
|
|
76
78
|
provenance_summary?: HistoryProvenanceSummary;
|
|
79
|
+
/** Present after compaction; row indices remain physical stream positions. */
|
|
80
|
+
version_addressing?: {
|
|
81
|
+
/** Add to a physical one-based index; null when the original mapping is lost. */
|
|
82
|
+
offset: number | null;
|
|
83
|
+
/** Earliest reconstructable original version, or null for legacy checkpoints. */
|
|
84
|
+
first_version: number | null;
|
|
85
|
+
/** Latest addressable version, including maintenance audit events. */
|
|
86
|
+
last_version: number | null;
|
|
87
|
+
};
|
|
77
88
|
}
|
|
78
89
|
/** Implements run history for the public runtime surface of this module. */
|
|
79
90
|
export declare function runHistory(id: string, options: HistoryCommandOptions, global: GlobalOptions): Promise<HistoryResult>;
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Implements the pm history command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="13e944b0-f049-55e5-8ff8-6335ce888b65")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
+
import { historyVersionOffset } from "../../core/history/version-address.js";
|
|
9
10
|
import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.js";
|
|
10
11
|
import { readHistoryEntries, verifyHistoryEntries, } from "../history-read.js";
|
|
11
12
|
export { readHistoryEntries } from "../history-read.js";
|
|
@@ -18,8 +19,9 @@ function limitEntries(values, limit) {
|
|
|
18
19
|
return values;
|
|
19
20
|
return values.slice(Math.max(0, values.length - limit));
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
/** Summarize patch fields with physical indices and separately mapped durable versions. */
|
|
23
|
+
function buildDiffEntries(entries, addressing) {
|
|
24
|
+
return entries.map(({ entry, version }) => {
|
|
23
25
|
const changedFields = new Set();
|
|
24
26
|
const patch = normalizeReplayPatchOps(entry.patch);
|
|
25
27
|
for (const op of patch) {
|
|
@@ -29,7 +31,8 @@ function buildDiffEntries(entries, startIndex) {
|
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
return {
|
|
32
|
-
index:
|
|
34
|
+
index: version,
|
|
35
|
+
...(addressing ? { version: addressing.offset === null ? null : addressing.offset + version } : {}),
|
|
33
36
|
ts: entry.ts,
|
|
34
37
|
op: entry.op,
|
|
35
38
|
author: entry.author,
|
|
@@ -38,6 +41,17 @@ function buildDiffEntries(entries, startIndex) {
|
|
|
38
41
|
};
|
|
39
42
|
});
|
|
40
43
|
}
|
|
44
|
+
/** Describe the checkpoint mapping without changing physical diagnostic indices. */
|
|
45
|
+
function buildVersionAddressing(history) {
|
|
46
|
+
if (history[0]?.op !== "history_compact_baseline")
|
|
47
|
+
return undefined;
|
|
48
|
+
const offset = historyVersionOffset(history, true);
|
|
49
|
+
return {
|
|
50
|
+
offset,
|
|
51
|
+
first_version: offset === null ? null : offset + 1,
|
|
52
|
+
last_version: offset === null ? null : offset + history.length,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
41
55
|
async function resolveHistoryReadTarget(id, global) {
|
|
42
56
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
43
57
|
await assertInitializedTracker(pmRoot);
|
|
@@ -71,6 +85,7 @@ export async function runHistory(id, options, global) {
|
|
|
71
85
|
const limit = parseLimit(options.limit);
|
|
72
86
|
const { historyPath, located, resolvedId, settings } = await resolveHistoryReadTarget(id, global);
|
|
73
87
|
const fullHistory = await readHistoryEntries(historyPath, resolvedId);
|
|
88
|
+
const addressing = buildVersionAddressing(fullHistory);
|
|
74
89
|
const vocabulary = settings.agent_identity.identity_vocabulary;
|
|
75
90
|
const provenanceDimensions = resolveHistoryProvenanceDimensions(settings.agent_identity.harness_signals);
|
|
76
91
|
const matchesProvenance = compileHistoryProvenanceMatcher({
|
|
@@ -78,19 +93,18 @@ export async function runHistory(id, options, global) {
|
|
|
78
93
|
agentInstance: options.agentInstance,
|
|
79
94
|
provenance: options.provenanceFilter,
|
|
80
95
|
}, vocabulary, provenanceDimensions);
|
|
81
|
-
const filteredHistory = fullHistory
|
|
82
|
-
.map((entry, index) => ({ entry, version: index + 1 }))
|
|
96
|
+
const filteredHistory = indexHistoryEntries(fullHistory)
|
|
83
97
|
.filter(({ entry }) => matchesProvenance(entry));
|
|
84
98
|
const selectedHistory = limitEntries(filteredHistory, limit);
|
|
85
99
|
const history = selectedHistory.map(({ entry }) => entry);
|
|
86
100
|
const compact = options.compact === true;
|
|
87
101
|
const compactHistory = compact
|
|
88
|
-
? buildDiffEntries(
|
|
102
|
+
? buildDiffEntries(selectedHistory, addressing)
|
|
89
103
|
: undefined;
|
|
90
104
|
const provenanceHistory = options.provenance === true
|
|
91
|
-
? selectedHistory.map(({ entry,
|
|
105
|
+
? selectedHistory.map(({ entry, durableVersion }) => projectHistoryProvenance(entry, vocabulary, {
|
|
92
106
|
itemId: resolvedId,
|
|
93
|
-
version,
|
|
107
|
+
version: durableVersion,
|
|
94
108
|
}))
|
|
95
109
|
: undefined;
|
|
96
110
|
const projectionMode = options.provenance === true ? "provenance" : compact ? "compact" : "full";
|
|
@@ -115,6 +129,7 @@ export async function runHistory(id, options, global) {
|
|
|
115
129
|
omission_receipt: resolveModePairedOutputOmissionReceipt("history", projectionMode),
|
|
116
130
|
count: history.length,
|
|
117
131
|
limit: limit ?? null,
|
|
132
|
+
version_addressing: addressing,
|
|
118
133
|
...(options.provenanceSummary === true
|
|
119
134
|
? {
|
|
120
135
|
provenance_summary: summarizeHistoryProvenance(filteredHistory.map(({ entry }) => entry), vocabulary, provenanceDimensions),
|
|
@@ -159,5 +174,14 @@ export async function runHistory(id, options, global) {
|
|
|
159
174
|
}
|
|
160
175
|
return result;
|
|
161
176
|
}
|
|
177
|
+
/** Attach physical and durable coordinates before filtering or limiting the stream. */
|
|
178
|
+
function indexHistoryEntries(history) {
|
|
179
|
+
const offset = historyVersionOffset(history, true);
|
|
180
|
+
return history.map((entry, index) => ({
|
|
181
|
+
entry,
|
|
182
|
+
version: index + 1,
|
|
183
|
+
durableVersion: offset === null ? undefined : offset + index + 1,
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
162
186
|
//# sourceMappingURL=history.js.map
|
|
163
|
-
//# debugId=
|
|
187
|
+
//# debugId=13e944b0-f049-55e5-8ff8-6335ce888b65
|
package/dist/sdk/query/next.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { type ActionableEntry } from "../actionability.js";
|
|
12
12
|
import { type GlobalOptions } from "../runtime-primitives.js";
|
|
13
|
+
import type { ItemTypeRegistry } from "../../core/item/type-registry.js";
|
|
13
14
|
import type { ItemStatus } from "../../types/index.js";
|
|
14
15
|
import { type ContextFocusItem, type ContextRankingSummary, type ContextPackingSummary } from "./context.js";
|
|
15
16
|
/** Supported values accepted by the next output contract. */
|
|
@@ -48,6 +49,10 @@ export interface NextOptions {
|
|
|
48
49
|
tokenBudget?: string | number;
|
|
49
50
|
/** Include human-gated Decision items in the claimable ready queue. */
|
|
50
51
|
includeDecisions?: boolean;
|
|
52
|
+
/** Opt into gate-shaped leaf work; blockers and ownership restrictions still apply. */
|
|
53
|
+
includeGates?: boolean;
|
|
54
|
+
/** Opt into containers with unfinished descendants; blockers and ownership restrictions still apply. */
|
|
55
|
+
includeContainers?: boolean;
|
|
51
56
|
/** Internal caller override used to align claim-next ranking with --author. */
|
|
52
57
|
callerAuthor?: string;
|
|
53
58
|
[key: string]: unknown;
|
|
@@ -95,6 +100,7 @@ interface NextSummary {
|
|
|
95
100
|
candidates: number;
|
|
96
101
|
containers: number;
|
|
97
102
|
decision_needed: number;
|
|
103
|
+
gate_needed?: number;
|
|
98
104
|
held_by_others: number;
|
|
99
105
|
}
|
|
100
106
|
/** Documents the `pm next` result payload exchanged by command, SDK, and package integrations. */
|
|
@@ -109,6 +115,10 @@ export interface NextResult {
|
|
|
109
115
|
ready: NextActionableItem[];
|
|
110
116
|
/** Human-gated decisions kept visible without dispatching them to agents. */
|
|
111
117
|
decision_needed: NextActionableItem[];
|
|
118
|
+
/** Outcome gates held out of autonomous dispatch. */
|
|
119
|
+
gate_needed?: NextActionableItem[];
|
|
120
|
+
/** Containers with unfinished descendants, retained as readable worklists. */
|
|
121
|
+
containers?: NextActionableItem[];
|
|
112
122
|
/** Value that configures or reports blocked for this contract. */
|
|
113
123
|
blocked: NextActionableItem[];
|
|
114
124
|
/** Value that configures or reports held by others for this contract. */
|
|
@@ -132,6 +142,8 @@ export interface NextResult {
|
|
|
132
142
|
blocked_limit: number;
|
|
133
143
|
ready_only: boolean;
|
|
134
144
|
include_decisions: boolean;
|
|
145
|
+
include_gates?: boolean;
|
|
146
|
+
include_containers?: boolean;
|
|
135
147
|
token_budget: number;
|
|
136
148
|
};
|
|
137
149
|
/** Value that configures or reports suggestions for this contract. */
|
|
@@ -146,6 +158,8 @@ export interface NextResult {
|
|
|
146
158
|
truncation?: {
|
|
147
159
|
decision_needed_total?: number;
|
|
148
160
|
held_by_others_total?: number;
|
|
161
|
+
gate_needed_total?: number;
|
|
162
|
+
containers_total?: number;
|
|
149
163
|
};
|
|
150
164
|
}
|
|
151
165
|
/** Resolves the effective `pm next` output format from the command `--format` flag and the global `--json` switch, rejecting the contradictory `--json --format markdown|toon` combination. Defaults to `toon`. */
|
|
@@ -163,7 +177,7 @@ export declare const _testOnlyNextCommand: {
|
|
|
163
177
|
resolveNextCallerAuthor: (options: NextOptions, settingsAuthor: string) => string;
|
|
164
178
|
};
|
|
165
179
|
/** Separates human-gated decisions from autonomous agent work unless the caller explicitly opts into decision claims. */
|
|
166
|
-
export declare function partitionDecisionEntries(ready: ActionableEntry[], includeDecisions: boolean): {
|
|
180
|
+
export declare function partitionDecisionEntries(ready: ActionableEntry[], includeDecisions: boolean, typeRegistry?: ItemTypeRegistry): {
|
|
167
181
|
agent: ActionableEntry[];
|
|
168
182
|
decisions: ActionableEntry[];
|
|
169
183
|
};
|