pi-harness-runtime 1.1.235 → 1.1.236
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 +28 -0
- 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 +4 -0
- package/packages/jev-judge/dist/continuation-controller.d.ts.map +1 -1
- package/packages/jev-judge/dist/continuation-controller.js +65 -19
- package/packages/jev-judge/dist/continuation-controller.js.map +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/jev-judge/src/continuation-controller.ts +73 -22
- 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
|
@@ -139,26 +139,38 @@ export class TodoContinuationController {
|
|
|
139
139
|
let inProgress: TodoItem[];
|
|
140
140
|
let ready: TodoItem[];
|
|
141
141
|
let blocked: TodoItem[];
|
|
142
|
+
let allItems: TodoItem[];
|
|
142
143
|
try {
|
|
143
144
|
inProgress = await this.todoProvider.getInProgress();
|
|
144
145
|
ready = await this.todoProvider.getReady();
|
|
145
146
|
blocked = await this.todoProvider.getBlocked();
|
|
147
|
+
const snapshot = await this.todoProvider.getSnapshot();
|
|
148
|
+
allItems = snapshot.items;
|
|
146
149
|
} catch (err) {
|
|
147
150
|
const msg = err instanceof Error ? err.message : String(err);
|
|
148
151
|
debugLog("TodoContinuation", "Failed to read todos:", msg);
|
|
149
152
|
return { action: "stop", reason: `todo read failed: ${msg}` };
|
|
150
153
|
}
|
|
151
154
|
|
|
152
|
-
// 4.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
// 4. Filter in-progress for items without unfinished blockers
|
|
156
|
+
const unblockedInProgress = inProgress.filter((item) => {
|
|
157
|
+
if (!item.blockedBy?.length) return true;
|
|
158
|
+
const blockerIds = new Set(item.blockedBy);
|
|
159
|
+
return !allItems.some(
|
|
160
|
+
(i) => blockerIds.has(i.id) && i.status !== "completed" && i.id !== item.id
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// 5. Continue unblocked in-progress work first
|
|
165
|
+
if (unblockedInProgress.length > 0) {
|
|
166
|
+
const item = unblockedInProgress[0];
|
|
167
|
+
|
|
156
168
|
// Reset counter if switching to a different task
|
|
157
169
|
if (this.state.lastItemContinued !== item.id) {
|
|
158
170
|
this.state.steerAttemptsForCurrentItem = 0;
|
|
159
171
|
this.state.lastItemContinued = item.id;
|
|
160
172
|
}
|
|
161
|
-
|
|
173
|
+
|
|
162
174
|
// Check per-task attempt limit
|
|
163
175
|
if (this.state.steerAttemptsForCurrentItem >= this.config.maxSteerAttempts) {
|
|
164
176
|
return { action: "stop", reason: `max attempts (${this.config.maxSteerAttempts}) reached for task ${item.id}` };
|
|
@@ -230,6 +242,56 @@ export class TodoContinuationController {
|
|
|
230
242
|
}
|
|
231
243
|
}
|
|
232
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Guarded dispatch - checks all conditions before sending
|
|
247
|
+
*/
|
|
248
|
+
private async guardedDispatch(itemId: number, message: string): Promise<boolean> {
|
|
249
|
+
// 1. Check if paused by user
|
|
250
|
+
if (this.state.userPaused) {
|
|
251
|
+
debugLog("TodoContinuation", "Guarded dispatch: user paused, skipping");
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// 2. Check if session is still idle
|
|
256
|
+
if (this.ctx.isIdle?.() === false) {
|
|
257
|
+
debugLog("TodoContinuation", "Guarded dispatch: session not idle, skipping");
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// 3. Check if continuation already queued (prevent duplicates)
|
|
262
|
+
if (this.state.continuationQueued) {
|
|
263
|
+
debugLog("TodoContinuation", "Guarded dispatch: already queued, skipping");
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// 4. Verify item still needs work (not completed)
|
|
268
|
+
try {
|
|
269
|
+
const snapshot = await this.todoProvider.getSnapshot();
|
|
270
|
+
const item = snapshot.items.find((i) => i.id === itemId);
|
|
271
|
+
if (item?.status === "completed") {
|
|
272
|
+
debugLog("TodoContinuation", "Guarded dispatch: item completed, skipping");
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
} catch {
|
|
276
|
+
// If we can't read todos, skip dispatch
|
|
277
|
+
debugLog("TodoContinuation", "Guarded dispatch: failed to read todos, skipping");
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// All checks passed - dispatch
|
|
282
|
+
this.state.continuationQueued = true;
|
|
283
|
+
this.state.lastSteerMessage = message;
|
|
284
|
+
|
|
285
|
+
try {
|
|
286
|
+
await this.config.dispatch(message);
|
|
287
|
+
return true;
|
|
288
|
+
} catch (err) {
|
|
289
|
+
debugLog("TodoContinuation", "Guarded dispatch failed:", String(err));
|
|
290
|
+
this.state.continuationQueued = false;
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
233
295
|
/**
|
|
234
296
|
* Steer to continue a todo item
|
|
235
297
|
*/
|
|
@@ -246,25 +308,14 @@ export class TodoContinuationController {
|
|
|
246
308
|
}
|
|
247
309
|
|
|
248
310
|
this.state.steerAttemptsForCurrentItem++;
|
|
249
|
-
this.state.continuationQueued = true;
|
|
250
|
-
|
|
251
|
-
const snapshot = await this.todoProvider.getSnapshot();
|
|
252
|
-
const item = snapshot.items.find((i) => i.id === itemId);
|
|
253
311
|
|
|
254
|
-
const message = item
|
|
255
|
-
|
|
256
|
-
: `Continue work on the next ready task.`;
|
|
257
|
-
|
|
258
|
-
this.state.lastSteerMessage = message;
|
|
259
|
-
this.state.todoRevision = snapshot.revision;
|
|
260
|
-
debugLog("TodoContinuation", "Steering to continue item", itemId);
|
|
312
|
+
const message = `Continue todo item ID ${itemId}.`;
|
|
313
|
+
debugLog("TodoContinuation", "Attempting steer to continue item", itemId);
|
|
261
314
|
|
|
262
|
-
//
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
debugLog("TodoContinuation", "Failed to send steer:", String(err));
|
|
267
|
-
this.state.continuationQueued = false;
|
|
315
|
+
// Use guarded dispatch to verify all conditions
|
|
316
|
+
const sent = await this.guardedDispatch(itemId, message);
|
|
317
|
+
if (!sent) {
|
|
318
|
+
debugLog("TodoContinuation", "Steer blocked by guard conditions");
|
|
268
319
|
}
|
|
269
320
|
}
|
|
270
321
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/provider-router",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.236",
|
|
4
4
|
"description": "Enhanced Provider Router for pi-harness-runtime — intelligent routing with capabilities, costs, and quotas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/provider-router.js",
|