pi-harness-runtime 1.1.233 → 1.1.235
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/index.ts +39 -12
- package/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/e2e-tester/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/dist/continuation-controller.d.ts +2 -4
- package/packages/jev-judge/dist/continuation-controller.d.ts.map +1 -1
- package/packages/jev-judge/dist/continuation-controller.js +15 -72
- package/packages/jev-judge/dist/continuation-controller.js.map +1 -1
- package/packages/jev-judge/dist/typesafe-provider.js +2 -2
- package/packages/jev-judge/dist/typesafe-provider.js.map +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/jev-judge/src/continuation-controller.ts +18 -81
- package/packages/jev-judge/src/typesafe-provider.ts +2 -2
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/telegram/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/package.json +1 -1
package/index.ts
CHANGED
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
|
|
80
80
|
// --- Jev Auto-Continue: Agent autonomous decision-making --------------------
|
|
81
81
|
// Lazy import - only loads when packages/jev-judge exists and API key available
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Get tasks from bd (beads) for Jev decision context.
|
|
@@ -439,6 +439,34 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
439
439
|
}
|
|
440
440
|
};
|
|
441
441
|
|
|
442
|
+
// --- todo continuation: Retain one controller per session ----------
|
|
443
|
+
let todoContinuationController: import("./packages/jev-judge/dist/continuation-controller.js").TodoContinuationController | null = null;
|
|
444
|
+
|
|
445
|
+
// Create controller on session_start with proper dispatch callback
|
|
446
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
447
|
+
try {
|
|
448
|
+
const { TodoContinuationController } = await import("./packages/jev-judge/dist/continuation-controller.js");
|
|
449
|
+
// SAFETY: ctx is ExtensionContext with sessionManager, isIdle, hasPendingMessages
|
|
450
|
+
// dispatch uses pi.sendUserMessage for actual message delivery
|
|
451
|
+
todoContinuationController = new TodoContinuationController(
|
|
452
|
+
ctx as unknown as import("./packages/jev-judge/dist/todo-provider.js").TodoContext,
|
|
453
|
+
{
|
|
454
|
+
dispatch: async (content: string) => {
|
|
455
|
+
await pi.sendUserMessage(content, { deliverAs: "steer" });
|
|
456
|
+
},
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
logToFile("[auto-continue]", "Todo continuation controller initialized");
|
|
460
|
+
} catch (err) {
|
|
461
|
+
logToFile("[auto-continue]", "Failed to create todo continuation controller:", String(err));
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
// Clean up controller on session shutdown
|
|
466
|
+
pi.on("session_shutdown", () => {
|
|
467
|
+
todoContinuationController = null;
|
|
468
|
+
});
|
|
469
|
+
|
|
442
470
|
// --- agent_settled: Check todos and continue work ---------------
|
|
443
471
|
pi.on("agent_settled", async (_event, ctx) => {
|
|
444
472
|
// Don't continue if user is waiting for response
|
|
@@ -450,17 +478,18 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
450
478
|
// Don't continue if session is not idle or has pending messages
|
|
451
479
|
if (!ctx.isIdle?.() || ctx.hasPendingMessages?.()) return;
|
|
452
480
|
|
|
453
|
-
//
|
|
481
|
+
// Use the retained controller (not a new one per event)
|
|
454
482
|
try {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
483
|
+
if (!todoContinuationController) {
|
|
484
|
+
logToFile("[auto-continue]", "No todo continuation controller available");
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
const result = await todoContinuationController.decide();
|
|
460
489
|
|
|
461
490
|
if (result.action === "continue" && result.nextItemId) {
|
|
462
491
|
updateAutoContinueStatus("CONTINUING");
|
|
463
|
-
await
|
|
492
|
+
await todoContinuationController.steerToContinue(result.nextItemId);
|
|
464
493
|
setTimeout(() => updateAutoContinueStatus("IDLE"), 2000);
|
|
465
494
|
} else if (result.action === "blocked") {
|
|
466
495
|
updateAutoContinueStatus("ERROR", "blocked");
|
|
@@ -538,7 +567,8 @@ async function initQdrant(): Promise<void> {
|
|
|
538
567
|
|
|
539
568
|
// Verify Qdrant connection with health check
|
|
540
569
|
try {
|
|
541
|
-
|
|
570
|
+
// Use /healthz endpoint (not /health) for Qdrant
|
|
571
|
+
const healthUrl = `${cfg.url}/healthz`;
|
|
542
572
|
const healthResponse = await fetch(healthUrl, {
|
|
543
573
|
headers: cfg.apiKey ? { "api-key": cfg.apiKey } : {},
|
|
544
574
|
});
|
|
@@ -1687,9 +1717,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
1687
1717
|
// --- jev-auto-continue: Agent autonomous decision when user unavailable -----
|
|
1688
1718
|
asyncInitPromises.push(initAutoContinue(pi));
|
|
1689
1719
|
|
|
1690
|
-
// Register todo-driven continuation controller
|
|
1691
|
-
createTodoContinuation(pi);
|
|
1692
|
-
|
|
1693
1720
|
// --- qdrant-vector-search: Qdrant integration for semantic skill search ----
|
|
1694
1721
|
// Collect promise so we can wait for initialization before showing startup notification
|
|
1695
1722
|
asyncInitPromises.push(initQdrant());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/capability-registry",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.235",
|
|
4
4
|
"description": "Capability Registry for pi-harness-runtime — tracks model capabilities and enables capability-based routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -3,6 +3,8 @@ import type { TodoItem, TodoContext } from "./todo-provider.js";
|
|
|
3
3
|
* Continuation configuration
|
|
4
4
|
*/
|
|
5
5
|
export interface ContinuationConfig {
|
|
6
|
+
/** Dispatch function to send messages to the agent (required) */
|
|
7
|
+
dispatch: (content: string) => Promise<void>;
|
|
6
8
|
/** Minimum wait before Jev fallback (ms) */
|
|
7
9
|
jevFallbackMinWaitMs?: number;
|
|
8
10
|
/** Threshold for routine continuation */
|
|
@@ -59,10 +61,6 @@ export declare class TodoContinuationController {
|
|
|
59
61
|
* Checks blockers and pause BEFORE selecting a task
|
|
60
62
|
*/
|
|
61
63
|
decide(): Promise<ContinuationResult>;
|
|
62
|
-
/**
|
|
63
|
-
* Evaluate continuation decision and execute it
|
|
64
|
-
*/
|
|
65
|
-
private evaluateContinuation;
|
|
66
64
|
/**
|
|
67
65
|
* Continue a specific todo item
|
|
68
66
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"continuation-controller.d.ts","sourceRoot":"","sources":["../src/continuation-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAmBhE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,4CAA4C;IAC5C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2BAA2B,EAAE,MAAM,CAAC;IACpC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,qBAAa,0BAA0B;IACtC,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,YAAY,CAAwC;IAE5D,OAAO,CAAC,KAAK,CAaX;IAEF,YAAY,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,kBAAkB,EAUxD;IAED;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAuE1C;IAED;;OAEG;
|
|
1
|
+
{"version":3,"file":"continuation-controller.d.ts","sourceRoot":"","sources":["../src/continuation-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAmBhE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,iEAAiE;IACjE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,4CAA4C;IAC5C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2BAA2B,EAAE,MAAM,CAAC;IACpC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,qBAAa,0BAA0B;IACtC,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,YAAY,CAAwC;IAE5D,OAAO,CAAC,KAAK,CAaX;IAEF,YAAY,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,kBAAkB,EAUxD;IAED;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAuE1C;IAED;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BhD;IAED;;OAEG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCnD;IAED;;OAEG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjD;IAED;;OAEG;IACH,KAAK,IAAI,IAAI,CAIZ;IAED;;OAEG;IACH,MAAM,IAAI,IAAI,CAeb;IAED;;OAEG;IACH,QAAQ,IAAI,IAAI,CAIf;IAED;;OAEG;IACH,QAAQ,IAAI;QAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;QAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAM7E;CACD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,WAAW,EAChB,MAAM,CAAC,EAAE,kBAAkB,GACzB,0BAA0B,CAE5B"}
|
|
@@ -85,11 +85,11 @@ export class TodoContinuationController {
|
|
|
85
85
|
}
|
|
86
86
|
// 3. Get todo state (throws on branch read failure)
|
|
87
87
|
let inProgress;
|
|
88
|
-
let
|
|
88
|
+
let ready;
|
|
89
89
|
let blocked;
|
|
90
90
|
try {
|
|
91
91
|
inProgress = await this.todoProvider.getInProgress();
|
|
92
|
-
|
|
92
|
+
ready = await this.todoProvider.getReady();
|
|
93
93
|
blocked = await this.todoProvider.getBlocked();
|
|
94
94
|
}
|
|
95
95
|
catch (err) {
|
|
@@ -97,12 +97,7 @@ export class TodoContinuationController {
|
|
|
97
97
|
debugLog("TodoContinuation", "Failed to read todos:", msg);
|
|
98
98
|
return { action: "stop", reason: `todo read failed: ${msg}` };
|
|
99
99
|
}
|
|
100
|
-
// 4.
|
|
101
|
-
if (blocked.length > 0) {
|
|
102
|
-
debugLog("TodoContinuation", "Tasks blocked:", blocked.length);
|
|
103
|
-
return { action: "blocked", question: `${blocked.length} task(s) blocked` };
|
|
104
|
-
}
|
|
105
|
-
// 5. Continue in-progress work if any
|
|
100
|
+
// 4. Continue in-progress work first
|
|
106
101
|
if (inProgress.length > 0) {
|
|
107
102
|
const item = inProgress[0];
|
|
108
103
|
// Reset counter if switching to a different task
|
|
@@ -116,9 +111,9 @@ export class TodoContinuationController {
|
|
|
116
111
|
}
|
|
117
112
|
return { action: "continue", nextItemId: item.id };
|
|
118
113
|
}
|
|
119
|
-
//
|
|
120
|
-
if (
|
|
121
|
-
const item =
|
|
114
|
+
// 5. Continue ready pending work (not blocked)
|
|
115
|
+
if (ready.length > 0) {
|
|
116
|
+
const item = ready[0];
|
|
122
117
|
// Reset counter if switching to a different task
|
|
123
118
|
if (this.state.lastItemContinued !== item.id) {
|
|
124
119
|
this.state.steerAttemptsForCurrentItem = 0;
|
|
@@ -130,66 +125,14 @@ export class TodoContinuationController {
|
|
|
130
125
|
}
|
|
131
126
|
return { action: "continue", nextItemId: item.id };
|
|
132
127
|
}
|
|
128
|
+
// 6. Only report blocked when nothing can proceed
|
|
129
|
+
if (blocked.length > 0) {
|
|
130
|
+
debugLog("TodoContinuation", "Tasks blocked:", blocked.length);
|
|
131
|
+
return { action: "blocked", question: `${blocked.length} task(s) blocked` };
|
|
132
|
+
}
|
|
133
133
|
// 7. No work remaining
|
|
134
134
|
return { action: "stop", reason: "No pending tasks" };
|
|
135
135
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Evaluate continuation decision and execute it
|
|
138
|
-
*/
|
|
139
|
-
async evaluateContinuation() {
|
|
140
|
-
// 1. Check user pause
|
|
141
|
-
if (this.state.userPaused) {
|
|
142
|
-
debugLog("TodoContinuation", "User paused, stopping");
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
// 2. Get current todo snapshot
|
|
146
|
-
const availability = await this.todoProvider.availability();
|
|
147
|
-
if (!availability.available) {
|
|
148
|
-
// No todo provider - don't auto-continue
|
|
149
|
-
debugLog("TodoContinuation", "Provider unavailable:", availability.error);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
try {
|
|
153
|
-
// Get snapshot for state tracking
|
|
154
|
-
await this.todoProvider.getSnapshot();
|
|
155
|
-
// 3. Get in-progress and pending items
|
|
156
|
-
const inProgressItems = await this.todoProvider.getByStatus("in_progress");
|
|
157
|
-
const pendingItems = await this.todoProvider.getPending();
|
|
158
|
-
const completedItems = await this.todoProvider.getCompleted();
|
|
159
|
-
// 4. If there's work in progress, continue it
|
|
160
|
-
if (inProgressItems.length > 0) {
|
|
161
|
-
const item = inProgressItems[0];
|
|
162
|
-
debugLog("TodoContinuation", "In-progress item:", item.subject);
|
|
163
|
-
await this.continueItem(item);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
// 5. Determine action based on state
|
|
167
|
-
const totalItems = completedItems.length + pendingItems.length + inProgressItems.length;
|
|
168
|
-
const hasWork = pendingItems.length > 0 || inProgressItems.length > 0;
|
|
169
|
-
if (!hasWork && totalItems === 0) {
|
|
170
|
-
debugLog("TodoContinuation", "All items complete");
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (pendingItems.length > 0) {
|
|
174
|
-
// Check if items are blocked
|
|
175
|
-
const blockedItems = await this.todoProvider.getBlocked();
|
|
176
|
-
if (blockedItems.length === pendingItems.length) {
|
|
177
|
-
// All pending items are blocked - don't auto-continue
|
|
178
|
-
const blocker = blockedItems[0];
|
|
179
|
-
debugLog("TodoContinuation", "Items blocked:", blocker?.subject);
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
// Continue the first non-blocked pending item
|
|
183
|
-
const readyItems = await this.todoProvider.getReady();
|
|
184
|
-
if (readyItems.length > 0) {
|
|
185
|
-
await this.continueItem(readyItems[0]);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
catch (err) {
|
|
190
|
-
debugLog("TodoContinuation", "Evaluation error:", err);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
136
|
/**
|
|
194
137
|
* Continue a specific todo item
|
|
195
138
|
*/
|
|
@@ -211,9 +154,9 @@ export class TodoContinuationController {
|
|
|
211
154
|
: `Continue task: ${item.subject}`;
|
|
212
155
|
this.state.lastSteerMessage = message;
|
|
213
156
|
debugLog("TodoContinuation", "Sending continuation:", item.subject);
|
|
214
|
-
// Send continuation message via
|
|
157
|
+
// Send continuation message via dispatch callback
|
|
215
158
|
try {
|
|
216
|
-
await this.
|
|
159
|
+
await this.config.dispatch(message);
|
|
217
160
|
}
|
|
218
161
|
catch (err) {
|
|
219
162
|
debugLog("TodoContinuation", "Failed to send continuation:", String(err));
|
|
@@ -243,9 +186,9 @@ export class TodoContinuationController {
|
|
|
243
186
|
this.state.lastSteerMessage = message;
|
|
244
187
|
this.state.todoRevision = snapshot.revision;
|
|
245
188
|
debugLog("TodoContinuation", "Steering to continue item", itemId);
|
|
246
|
-
// Send continuation message via
|
|
189
|
+
// Send continuation message via dispatch callback
|
|
247
190
|
try {
|
|
248
|
-
await this.
|
|
191
|
+
await this.config.dispatch(message);
|
|
249
192
|
}
|
|
250
193
|
catch (err) {
|
|
251
194
|
debugLog("TodoContinuation", "Failed to send steer:", String(err));
|