@unbrained/pm-cli 2026.9.4 → 2026.9.5
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 +26 -1
- 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 +15 -6
- package/dist/cli/register-list-query.js +4 -2
- package/dist/cli/register-mutation.js +4 -2
- package/dist/cli/register-operations.js +6 -2
- package/dist/cli-bundle/bundle-manifest.json +153 -153
- package/dist/cli-bundle/chunks/{chunk-RI4XNOYS.js → chunk-3HBDTJRK.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-66VPKFP2.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-I2AS367G.js → chunk-HUAQITVW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HI6BHPCU.js → chunk-IBYREGSP.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-LUI4E32I.js +231 -0
- package/dist/cli-bundle/chunks/{chunk-YW4QK2G7.js → chunk-QPZHQY2O.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-X6CMGV6L.js → chunk-SF6SM6U5.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SVK5Y64D.js +40 -0
- package/dist/cli-bundle/chunks/chunk-V5GBD5KV.js +9 -0
- package/dist/cli-bundle/chunks/{chunk-V72UV7QS.js → chunk-WWAEGW4V.js} +57 -57
- package/dist/cli-bundle/chunks/{chunk-A24WAVE6.js → chunk-ZRAQS3UA.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-Z5YYSJJG.js → register-list-query-AYKGODWT.js} +3 -3
- package/dist/cli-bundle/chunks/{register-mutation-ELSP6I4I.js → register-mutation-YZYG53SQ.js} +4 -4
- package/dist/cli-bundle/chunks/register-operations-KFSCC7QV.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-E2AE72QG.js → register-setup-UJCRVGBG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-24IG6ONG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-53IHPICX.js → chunk-3ASU6WGI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3ITLIBKS.js +56 -0
- package/dist/cli-bundle/focused-chunks/chunk-3NQD5YDG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-7N2TV7WZ.js → chunk-4OSHLNUE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-65N6JHAN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-AJR3OP2E.js → chunk-B2TTQGFG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-GUBM3RGY.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-25UJBH4M.js → chunk-H5FOGAVD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-JX3RCVCX.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-6PWPQKDN.js → chunk-KWWCBWFO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MV752SUC.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-PKIPMCFS.js +6 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3646BZ4W.js → chunk-QL66QNWG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RJMR2JIF.js +9 -0
- package/dist/cli-bundle/focused-chunks/chunk-WIUPWIZR.js +177 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NBMJD6MK.js → chunk-WOCIPMW7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MHKUIPJW.js → chunk-YEF5PQQ2.js} +2 -2
- package/dist/cli-bundle/main.js +22 -15
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +29 -29
- 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 +8 -8
- package/dist/core/extensions/extension-types.d.ts +2 -0
- package/dist/core/extensions/extension-types.js +2 -2
- 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/shared/errors.d.ts +8 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/item-store.d.ts +14 -0
- package/dist/core/store/item-store.js +48 -10
- package/dist/core/store/settings-validator.js +3 -2
- 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.js +29 -5
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +19 -12
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +14 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +19 -6
- package/dist/sdk/context-intent-contracts.js +3 -3
- package/dist/sdk/context-usage.js +9 -11
- package/dist/sdk/define.d.ts +1 -1
- package/dist/sdk/define.js +2 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +98 -50
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -2
- package/dist/sdk/governance/validate-history-drift.js +16 -5
- 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 +5 -0
- package/dist/sdk/history-repair.js +14 -2
- package/dist/sdk/lifecycle/claim.d.ts +4 -0
- package/dist/sdk/lifecycle/claim.js +9 -3
- package/dist/sdk/lifecycle/restore.d.ts +1 -0
- package/dist/sdk/lifecycle/restore.js +19 -7
- 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/get.d.ts +2 -2
- package/dist/sdk/query/get.js +4 -3
- 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 +1 -0
- package/dist/sdk/query.js +3 -2
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_GUIDE.md +36 -0
- package/docs/HISTORY_RECOVERY.md +146 -0
- package/docs/README.md +1 -0
- package/docs/RELEASING.md +25 -11
- package/docs/SDK_CONTEXT_TRUTH_CONTRACTS.md +24 -1
- package/docs/SDK_EXECUTION_CONTRACTS.md +105 -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 +10 -10
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -3
- package/marketplace.json +2 -2
- package/package.json +4 -5
- 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-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
|
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]="16112e3d-b640-5114-a2c2-5effc655fe50")}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) {
|
|
@@ -447,4 +448,4 @@ export const _testOnlyGetCommand = {
|
|
|
447
448
|
shouldAutoIncludeGetChildren,
|
|
448
449
|
};
|
|
449
450
|
//# sourceMappingURL=get.js.map
|
|
450
|
-
//# debugId=
|
|
451
|
+
//# debugId=16112e3d-b640-5114-a2c2-5effc655fe50
|
|
@@ -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
|
};
|
package/dist/sdk/query/next.js
CHANGED
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
* re-deriving readiness from a full `pm context` snapshot every turn.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
13
|
-
import { collectBlockedByIds, computeActionabilityReport, } from "../actionability.js";
|
|
14
|
-
import { resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, nowIso, normalizeStatusInput, normalizeStatusForRegistry, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
12
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6035e85b-81ed-512e-b291-b0d86af1848b")}catch(e){}}();
|
|
13
|
+
import { collectBlockedByIds, computeActionabilityReport, resolveItemExecutionRole, selectActionableEntries, } from "../actionability.js";
|
|
14
|
+
import { resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, nowIso, normalizeStatusInput, normalizeStatusForRegistry, resolvePmRoot, readSettings, resolveAuthor, resolveItemTypeRegistry, } from "../runtime-primitives.js";
|
|
15
|
+
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
15
16
|
import { parseIntegerLimit } from "./parsers.js";
|
|
16
17
|
import { buildChildrenByParent, collectSubtreeIds, compareCriticalItems, mergeSortedWarnings, packRankedContextItems, resolveContextTokenBudget, toContextPackingSummary, toContextRankingSummary, toContextFocusItem, } from "./context.js";
|
|
17
18
|
import { runList } from "./list.js";
|
|
@@ -94,7 +95,7 @@ function buildRecommendationReasons(entry, statusRegistry, now, completedContain
|
|
|
94
95
|
reasons.push(`advances ${item.parent.trim()}`);
|
|
95
96
|
}
|
|
96
97
|
if (entry.unblocks.length > 0) {
|
|
97
|
-
reasons.push(`unblocks ${entry.unblocks.length} item(s)
|
|
98
|
+
reasons.push(`unblocks ${entry.unblocks.length} item(s)`);
|
|
98
99
|
}
|
|
99
100
|
return reasons;
|
|
100
101
|
}
|
|
@@ -118,12 +119,12 @@ export const _testOnlyNextCommand = {
|
|
|
118
119
|
resolveNextCallerAuthor: (options, settingsAuthor) => resolveNextCallerAuthor(options, settingsAuthor),
|
|
119
120
|
};
|
|
120
121
|
/** Separates human-gated decisions from autonomous agent work unless the caller explicitly opts into decision claims. */
|
|
121
|
-
export function partitionDecisionEntries(ready, includeDecisions) {
|
|
122
|
-
const decisions = ready.filter((entry) => entry.item.type
|
|
122
|
+
export function partitionDecisionEntries(ready, includeDecisions, typeRegistry) {
|
|
123
|
+
const decisions = ready.filter((entry) => resolveItemExecutionRole(entry.item.type, typeRegistry) === "human");
|
|
123
124
|
return {
|
|
124
125
|
agent: includeDecisions
|
|
125
126
|
? ready
|
|
126
|
-
: ready.filter((entry) => entry.item.type
|
|
127
|
+
: ready.filter((entry) => resolveItemExecutionRole(entry.item.type, typeRegistry) !== "human"),
|
|
127
128
|
decisions: includeDecisions ? [] : decisions,
|
|
128
129
|
};
|
|
129
130
|
}
|
|
@@ -195,13 +196,17 @@ function buildNextRecommendation(params) {
|
|
|
195
196
|
reasons: buildRecommendationReasons(params.projectedReady[0], params.statusRegistry, params.now, params.completedContainer),
|
|
196
197
|
};
|
|
197
198
|
}
|
|
198
|
-
function buildNextSuggestions(recommended, blockedRows) {
|
|
199
|
+
function buildNextSuggestions(recommended, blockedRows, gateCount) {
|
|
199
200
|
if (recommended !== null) {
|
|
200
201
|
return undefined;
|
|
201
202
|
}
|
|
203
|
+
const gateGuidance = gateCount > 0
|
|
204
|
+
? ["No executable recommendation: outcome gates require verification. Inspect gate_needed, or use pm next --include-gates to opt in."]
|
|
205
|
+
: [];
|
|
202
206
|
if (blockedRows.length > 0) {
|
|
203
207
|
const blockedWithReferences = blockedRows.find((item) => item.blockers.length > 0);
|
|
204
208
|
return [
|
|
209
|
+
...gateGuidance,
|
|
205
210
|
blockedWithReferences
|
|
206
211
|
? `${blockedRows.length} item(s) are blocked; unblock the top one by closing ${blockedWithReferences.blockers.map((blocker) => blocker.id).join(", ")}`
|
|
207
212
|
: `${blockedRows.length} item(s) are blocked; add blocker context or move the top item back to an active status`,
|
|
@@ -210,6 +215,7 @@ function buildNextSuggestions(recommended, blockedRows) {
|
|
|
210
215
|
];
|
|
211
216
|
}
|
|
212
217
|
return [
|
|
218
|
+
...gateGuidance,
|
|
213
219
|
'pm create --type Task --title "..." to add a new work item',
|
|
214
220
|
"pm list --status in_progress to review work already underway",
|
|
215
221
|
"pm context --depth deep for the full project snapshot",
|
|
@@ -271,7 +277,7 @@ async function finalizeNextResult(params) {
|
|
|
271
277
|
params.result.ranking = toContextRankingSummary(params.readyRanking, params.featureStore);
|
|
272
278
|
params.result.packing = toContextPackingSummary(params.packing);
|
|
273
279
|
}
|
|
274
|
-
params.result.suggestions = buildNextSuggestions(params.recommended, params.blockedRows);
|
|
280
|
+
params.result.suggestions = buildNextSuggestions(params.recommended, params.blockedRows, params.gateCount);
|
|
275
281
|
await attachNextUsageFeedback({
|
|
276
282
|
result: params.result,
|
|
277
283
|
pmRoot: params.pmRoot,
|
|
@@ -291,9 +297,9 @@ function filterCandidatesByParentScope(candidates, corpus, parentScope) {
|
|
|
291
297
|
}
|
|
292
298
|
return candidates.filter((item) => subtree.ids.has(item.id.trim().toLowerCase()));
|
|
293
299
|
}
|
|
294
|
-
async function rankReadyEntriesWithRelevance(rankedReady, childrenByParent, statusRegistry, now, callerAuthor, pmRoot, tokenBudget) {
|
|
300
|
+
async function rankReadyEntriesWithRelevance(rankedReady, childrenByParent, statusRegistry, now, callerAuthor, pmRoot, tokenBudget, includeContainers) {
|
|
295
301
|
const concreteReady = rankedReady.filter((entry) => !hasCompletedDescendants(entry.item, childrenByParent));
|
|
296
|
-
const structuralReady = concreteReady.length
|
|
302
|
+
const structuralReady = includeContainers || concreteReady.length === 0 ? rankedReady : concreteReady;
|
|
297
303
|
const usage = await readContextUsageAffinity({
|
|
298
304
|
pmRoot,
|
|
299
305
|
author: callerAuthor,
|
|
@@ -316,7 +322,7 @@ async function rankReadyEntriesWithRelevance(rankedReady, childrenByParent, stat
|
|
|
316
322
|
return {
|
|
317
323
|
projectedReady,
|
|
318
324
|
ranking,
|
|
319
|
-
completedContainer: concreteReady.length === 0,
|
|
325
|
+
completedContainer: concreteReady.length === 0 && !includeContainers,
|
|
320
326
|
packing,
|
|
321
327
|
featureStore,
|
|
322
328
|
};
|
|
@@ -335,6 +341,7 @@ export async function runNext(options, global) {
|
|
|
335
341
|
const settings = await readSettings(pmRoot);
|
|
336
342
|
const callerAuthor = resolveNextCallerAuthor(options, settings.author_default);
|
|
337
343
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
344
|
+
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
338
345
|
const now = nowIso();
|
|
339
346
|
const limit = parseNextLimit(options.limit, "--limit", DEFAULT_NEXT_LIMIT);
|
|
340
347
|
const tokenBudget = resolveContextTokenBudget(options.tokenBudget, Math.max(192, limit * 128));
|
|
@@ -350,16 +357,18 @@ export async function runNext(options, global) {
|
|
|
350
357
|
const corpusList = await runList(undefined, { excludeTerminal: false, noTruncate: true }, global);
|
|
351
358
|
const candidates = filterCandidatesByParentScope(candidatesList.items, corpusList.items, parentScope);
|
|
352
359
|
const corpus = corpusList.items;
|
|
353
|
-
const report = computeActionabilityReport(candidates, corpus, statusRegistry);
|
|
360
|
+
const report = computeActionabilityReport(candidates, corpus, statusRegistry, typeRegistry);
|
|
354
361
|
const childrenByParent = buildChildrenByParent(corpus);
|
|
355
|
-
const
|
|
356
|
-
const callerPartition = partitionCallerOwnedReady(
|
|
362
|
+
const selected = selectActionableEntries(report, statusRegistry, options, typeRegistry);
|
|
363
|
+
const callerPartition = partitionCallerOwnedReady(selected.ready, settings.author_default, callerAuthor);
|
|
357
364
|
const rankedReady = rankNextReadyEntries(callerPartition.available, childrenByParent, statusRegistry);
|
|
358
365
|
const rankedBlocked = [...report.blocked].sort((left, right) => compareCriticalItems(left.item, right.item, statusRegistry));
|
|
359
|
-
const { projectedReady, ranking: readyRanking, completedContainer, packing: readyPacking, featureStore, } = await rankReadyEntriesWithRelevance(rankedReady, childrenByParent, statusRegistry, now, callerAuthor, pmRoot, tokenBudget);
|
|
366
|
+
const { projectedReady, ranking: readyRanking, completedContainer, packing: readyPacking, featureStore, } = await rankReadyEntriesWithRelevance(rankedReady, childrenByParent, statusRegistry, now, callerAuthor, pmRoot, tokenBudget, options.includeContainers === true);
|
|
360
367
|
const readyRows = projectedReady.map((entry, index) => toNextActionableItem(entry, statusRegistry, childrenByParent, index + 1));
|
|
361
368
|
const blockedRows = rankedBlocked.map((entry, index) => toNextActionableItem(entry, statusRegistry, childrenByParent, index + 1));
|
|
362
|
-
const decisionRows = rankNextReadyEntries(
|
|
369
|
+
const decisionRows = rankNextReadyEntries(selected.decisions, childrenByParent, statusRegistry).map((entry, index) => toNextActionableItem(entry, statusRegistry, childrenByParent, index + 1));
|
|
370
|
+
const gateRows = rankNextReadyEntries(selected.gates, childrenByParent, statusRegistry).map((entry, index) => toNextActionableItem(entry, statusRegistry, childrenByParent, index + 1));
|
|
371
|
+
const containerRows = rankNextReadyEntries(report.containers, childrenByParent, statusRegistry).map((entry, index) => toNextActionableItem(entry, statusRegistry, childrenByParent, index + 1));
|
|
363
372
|
const recommended = buildNextRecommendation({
|
|
364
373
|
projectedReady,
|
|
365
374
|
readyRows,
|
|
@@ -367,13 +376,19 @@ export async function runNext(options, global) {
|
|
|
367
376
|
now,
|
|
368
377
|
completedContainer,
|
|
369
378
|
});
|
|
370
|
-
const truncation = buildNextTruncation(decisionRows.length, callerPartition.held.length, limit);
|
|
379
|
+
const truncation = buildNextTruncation(decisionRows.length, callerPartition.held.length, limit) ?? {};
|
|
380
|
+
if (gateRows.length > limit)
|
|
381
|
+
truncation.gate_needed_total = gateRows.length;
|
|
382
|
+
if (containerRows.length > limit)
|
|
383
|
+
truncation.containers_total = containerRows.length;
|
|
371
384
|
const result = {
|
|
372
385
|
output_default: "toon",
|
|
373
386
|
now,
|
|
374
387
|
recommended,
|
|
375
388
|
ready: readyRows.slice(1, limit + 1),
|
|
376
389
|
decision_needed: decisionRows.slice(0, limit),
|
|
390
|
+
gate_needed: gateRows.slice(0, limit),
|
|
391
|
+
containers: containerRows.slice(0, limit),
|
|
377
392
|
blocked: readyOnly ? [] : blockedRows.slice(0, blockedLimit),
|
|
378
393
|
held_by_others: callerPartition.held.slice(0, limit),
|
|
379
394
|
summary: {
|
|
@@ -384,6 +399,7 @@ export async function runNext(options, global) {
|
|
|
384
399
|
candidates: report.active_count,
|
|
385
400
|
containers: report.container_count,
|
|
386
401
|
decision_needed: decisionRows.length,
|
|
402
|
+
gate_needed: gateRows.length,
|
|
387
403
|
held_by_others: callerPartition.held.length,
|
|
388
404
|
},
|
|
389
405
|
filters: {
|
|
@@ -399,14 +415,17 @@ export async function runNext(options, global) {
|
|
|
399
415
|
blocked_limit: blockedLimit,
|
|
400
416
|
ready_only: readyOnly,
|
|
401
417
|
include_decisions: options.includeDecisions === true,
|
|
418
|
+
include_gates: options.includeGates === true,
|
|
419
|
+
include_containers: options.includeContainers === true,
|
|
402
420
|
token_budget: tokenBudget,
|
|
403
421
|
},
|
|
404
|
-
truncation,
|
|
422
|
+
truncation: Object.keys(truncation).length > 0 ? truncation : undefined,
|
|
405
423
|
};
|
|
406
424
|
return finalizeNextResult({
|
|
407
425
|
result,
|
|
408
426
|
recommended,
|
|
409
427
|
blockedRows,
|
|
428
|
+
gateCount: gateRows.length,
|
|
410
429
|
candidatesWarnings: candidatesList.warnings,
|
|
411
430
|
corpusWarnings: corpusList.warnings,
|
|
412
431
|
readyRanking,
|
|
@@ -424,6 +443,10 @@ export async function runNext(options, global) {
|
|
|
424
443
|
*/
|
|
425
444
|
export function renderNextMarkdown(result) {
|
|
426
445
|
const lines = ["# pm next", "", ...renderNextSummaryLines(result)];
|
|
446
|
+
for (const [title, rows] of [["Gate verification needed", result.gate_needed], ["Containers", result.containers]]) {
|
|
447
|
+
if (rows && rows.length > 0)
|
|
448
|
+
lines.push(...renderNextSection(title, rows.map((item) => `- ${formatNextLine(item)}`), ""));
|
|
449
|
+
}
|
|
427
450
|
lines.push(...renderNextSection("Recommended", renderNextRecommendedRows(result.recommended), "No ready work."));
|
|
428
451
|
lines.push(...renderNextSection("Decision needed",
|
|
429
452
|
// `?? []` tolerates JSON payloads from pre-decision-queue builds (the
|
|
@@ -488,4 +511,4 @@ function formatNextLine(item) {
|
|
|
488
511
|
return `${rankToken}${item.id} p${item.priority} ${item.status} ${item.type} deadline:${deadlineToken}${parentToken}${unblocksToken} ${item.title}`;
|
|
489
512
|
}
|
|
490
513
|
//# sourceMappingURL=next.js.map
|
|
491
|
-
//# debugId=
|
|
514
|
+
//# debugId=6035e85b-81ed-512e-b291-b0d86af1848b
|
package/dist/sdk/query.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { CONTEXT_OUTPUT_VALUES, applyContextTagProjection, buildChildrenByParent
|
|
|
13
13
|
export * from "./query/get.js";
|
|
14
14
|
export * from "./query/history.js";
|
|
15
15
|
export * from "./query/next.js";
|
|
16
|
+
export * from "./actionability.js";
|
|
16
17
|
export * from "./query/search-pagination.js";
|
|
17
18
|
export * from "./query/search-rendering.js";
|
|
18
19
|
export * from "./query/item-filter-options.js";
|
package/dist/sdk/query.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides focused read, search, pagination, and context-ranking primitives.
|
|
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]="214c6bc1-313b-53c1-883a-d2d0536f8aea")}catch(e){}}();
|
|
8
8
|
export * from "./query/list.js";
|
|
9
9
|
export * from "./query/complete-list.js";
|
|
10
10
|
export * from "./query/search.js";
|
|
@@ -15,6 +15,7 @@ export { CONTEXT_OUTPUT_VALUES, applyContextTagProjection, buildChildrenByParent
|
|
|
15
15
|
export * from "./query/get.js";
|
|
16
16
|
export * from "./query/history.js";
|
|
17
17
|
export * from "./query/next.js";
|
|
18
|
+
export * from "./actionability.js";
|
|
18
19
|
export * from "./query/search-pagination.js";
|
|
19
20
|
export * from "./query/search-rendering.js";
|
|
20
21
|
export * from "./query/item-filter-options.js";
|
|
@@ -30,4 +31,4 @@ export * from "./context-usage.js";
|
|
|
30
31
|
export * from "./workspace-memory.js";
|
|
31
32
|
export * from "./duplicates.js";
|
|
32
33
|
//# sourceMappingURL=query.js.map
|
|
33
|
-
//# debugId=
|
|
34
|
+
//# debugId=214c6bc1-313b-53c1-883a-d2d0536f8aea
|
|
@@ -34,7 +34,7 @@ export { isTerminalStatus, normalizeStatusForRegistry, normalizeStatusInput, } f
|
|
|
34
34
|
export { COMMON_MUTATION_COMMAND_OPTION_KEYS, type ItemTypeRegistry, type ResolvedItemTypeDefinition, canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTypeRegistry, resolveTypeDefinition, resolveTypeName, validateTypeOptions, } from "../core/item/type-registry.js";
|
|
35
35
|
export { resolveTypeSynonym } from "../core/item/type-synonyms.js";
|
|
36
36
|
export { acquireLock } from "../core/lock/lock.js";
|
|
37
|
-
export { printError, printResult, writeStdout } from "../core/output/output.js";
|
|
37
|
+
export { printError, printResult, writeStderr, writeStdout } from "../core/output/output.js";
|
|
38
38
|
export { renderRowsAsCsv, renderRowsAsTable } from "../core/output/tabular.js";
|
|
39
39
|
export { parseLimit } from "../core/shared/numeric-parsers.js";
|
|
40
40
|
export { resolveConfiguredPmPackageRoot, resolvePmCliVersion, resolvePmPackageRootFromModule, } from "../core/packages/root.js";
|