pi-harness-runtime 1.1.249 → 1.1.252
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 +55 -25
- 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/package.json +1 -1
- 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/dist/adapters/telegram-adapter.d.ts +10 -0
- package/packages/notification/dist/adapters/telegram-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/telegram-adapter.js +18 -1
- package/packages/notification/dist/adapters/telegram-adapter.js.map +1 -1
- package/packages/notification/dist/harness-widget.d.ts +10 -13
- package/packages/notification/dist/harness-widget.d.ts.map +1 -1
- package/packages/notification/dist/harness-widget.js.map +1 -1
- package/packages/notification/dist/index.d.ts +1 -1
- package/packages/notification/dist/index.d.ts.map +1 -1
- package/packages/notification/dist/index.js +1 -1
- package/packages/notification/dist/index.js.map +1 -1
- package/packages/notification/dist/notification-center.d.ts +4 -0
- package/packages/notification/dist/notification-center.d.ts.map +1 -1
- package/packages/notification/dist/notification-center.js +10 -0
- package/packages/notification/dist/notification-center.js.map +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/adapters/telegram-adapter.ts +29 -2
- package/packages/notification/src/harness-widget.ts +167 -0
- package/packages/notification/src/index.ts +1 -1
- package/packages/notification/src/notification-center.ts +11 -0
- 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
|
@@ -127,6 +127,14 @@ const startupStatus = new HarnessStartupStatus();
|
|
|
127
127
|
const harnessMessages = startupStatus.messages;
|
|
128
128
|
const addHarnessMessage = startupStatus.update.bind(startupStatus);
|
|
129
129
|
|
|
130
|
+
// Shared state for callback handlers (accessible across init functions)
|
|
131
|
+
const sharedState = {
|
|
132
|
+
waitingForUserSince: null as Date | null,
|
|
133
|
+
todoContinuationController: null as unknown,
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
|
+
updateAutoContinueStatus: null as any,
|
|
136
|
+
};
|
|
137
|
+
|
|
130
138
|
async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
131
139
|
addHarnessMessage("Jev", "initializing", "wait");
|
|
132
140
|
try {
|
|
@@ -190,6 +198,10 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
190
198
|
ERROR: "Auto-continue unavailable",
|
|
191
199
|
} as const;
|
|
192
200
|
|
|
201
|
+
// Wire shared state for callback handlers
|
|
202
|
+
sharedState.waitingForUserSince = waitingForUserSince;
|
|
203
|
+
sharedState.updateAutoContinueStatus = updateAutoContinueStatus;
|
|
204
|
+
|
|
193
205
|
// Update auto-continue status in TUI footer
|
|
194
206
|
function updateAutoContinueStatus(state: keyof typeof AC_STATE_MESSAGES, requestId?: string): void {
|
|
195
207
|
if (!_setAutoContinueStatus) return;
|
|
@@ -282,15 +294,26 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
282
294
|
return null;
|
|
283
295
|
}
|
|
284
296
|
|
|
285
|
-
// Detect routine continuation questions ("Should I continue?")
|
|
286
|
-
// These should NOT block immediate continuation - let Jev/todo controller decide
|
|
287
297
|
// Detect routine continuation questions ("Should I continue?")
|
|
288
298
|
// These should NOT block immediate continuation - let Jev/todo controller decide
|
|
289
299
|
function isRoutineContinuation(question: string): boolean {
|
|
290
300
|
const lower = question.toLowerCase();
|
|
291
|
-
// Match
|
|
292
|
-
|
|
293
|
-
|
|
301
|
+
// Match ALL routine continuation patterns
|
|
302
|
+
const routinePatterns = [
|
|
303
|
+
/\b(should i|should we|should the|can i continue|can we continue)\b/,
|
|
304
|
+
/\b(would you like me to continue|shall i proceed)\b/,
|
|
305
|
+
/\b(can i proceed|may i continue)\b/,
|
|
306
|
+
/\b(continue|proceed)\s*(with|to|on|with the next|to the next)\b/,
|
|
307
|
+
/\bshall\s+(i|we)\s+(proceed|continue)\b/,
|
|
308
|
+
/\bshould\s+(i|we)\s+(continue|proceed|move on)\b/,
|
|
309
|
+
/\b(continue|proceed)\s+\?/,
|
|
310
|
+
];
|
|
311
|
+
for (const pattern of routinePatterns) {
|
|
312
|
+
if (pattern.test(lower)) {
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return false;
|
|
294
317
|
}
|
|
295
318
|
|
|
296
319
|
// Detect when agent asks for continuation
|
|
@@ -329,19 +352,24 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
329
352
|
// Build rich context message
|
|
330
353
|
const waitMinutes = Math.round((Date.now() - waitingForUserSince!.getTime()) / 60000);
|
|
331
354
|
const taskInfo = taskContext.total > 0
|
|
332
|
-
? `
|
|
333
|
-
: "";
|
|
334
|
-
const contextInfo = `Waiting: ${waitMinutes}m${taskInfo}`;
|
|
355
|
+
? `Tasks: ${taskContext.completed}/${taskContext.total} done`
|
|
356
|
+
: "No active tasks";
|
|
357
|
+
const contextInfo = `Waiting: ${waitMinutes}m | ${taskInfo}`;
|
|
335
358
|
|
|
336
359
|
// Emit WaitingForUserInput to Telegram with Yes/No buttons
|
|
337
360
|
_nc?.notifyWithApproval("WaitingForUserInput", {
|
|
338
361
|
jobId: `waiting-user-${questionHash}`,
|
|
339
362
|
requirement: detectedQuestion,
|
|
340
|
-
error: contextInfo,
|
|
341
363
|
}, {
|
|
342
364
|
approveLabel: "Continue",
|
|
343
365
|
rejectLabel: "Not yet",
|
|
344
366
|
});
|
|
367
|
+
|
|
368
|
+
// Also send context info as a follow-up message (not in error field)
|
|
369
|
+
_nc?.notify("Info", {
|
|
370
|
+
jobId: `info-${questionHash}`,
|
|
371
|
+
message: contextInfo,
|
|
372
|
+
});
|
|
345
373
|
}
|
|
346
374
|
});
|
|
347
375
|
|
|
@@ -665,7 +693,6 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
665
693
|
const result = await todoContinuationController.decide();
|
|
666
694
|
|
|
667
695
|
if (result.action === "continue" && result.nextItemId) {
|
|
668
|
-
_steerSentThisTurn = true;
|
|
669
696
|
updateAutoContinueStatus("CONTINUING");
|
|
670
697
|
await todoContinuationController.steerToContinue(result.nextItemId);
|
|
671
698
|
// Queue remains set while agent processes, cleared on agent_end
|
|
@@ -863,7 +890,7 @@ async function initTelegram(pi: ExtensionAPI): Promise<void> {
|
|
|
863
890
|
|
|
864
891
|
// Register callback handler for inline keyboard button clicks (approve/reject)
|
|
865
892
|
const { parseCallbackData, CallbackActions } = await import(
|
|
866
|
-
|
|
893
|
+
"./packages/notification/dist/telegram-webhook-handler.js"
|
|
867
894
|
);
|
|
868
895
|
center.setCallbackHandler(async (data: string, _query: { id: string }) => {
|
|
869
896
|
const parsed = parseCallbackData(data);
|
|
@@ -871,18 +898,31 @@ async function initTelegram(pi: ExtensionAPI): Promise<void> {
|
|
|
871
898
|
|
|
872
899
|
switch (parsed.action) {
|
|
873
900
|
case CallbackActions.APPROVE:
|
|
874
|
-
//
|
|
875
|
-
logToFile("[TelegramCallback] Approved - user clicked Continue");
|
|
901
|
+
// User clicked Continue - clear waiting state and resume continuation
|
|
902
|
+
logToFile("[TelegramCallback] Approved - user clicked Continue, resuming work");
|
|
903
|
+
sharedState.waitingForUserSince = null;
|
|
904
|
+
sharedState.updateAutoContinueStatus?.("IDLE");
|
|
905
|
+
// Also resume continuation controller
|
|
906
|
+
(sharedState.todoContinuationController as any)?.resume?.();
|
|
876
907
|
break;
|
|
877
908
|
case CallbackActions.REJECT:
|
|
878
|
-
//
|
|
879
|
-
logToFile("[TelegramCallback] Rejected - user clicked Not yet");
|
|
909
|
+
// User clicked Not yet - just dismiss, don't resume
|
|
910
|
+
logToFile("[TelegramCallback] Rejected - user clicked Not yet, pausing");
|
|
911
|
+
// Explicitly pause the continuation
|
|
912
|
+
(sharedState.todoContinuationController as any)?.explicitPause?.();
|
|
880
913
|
break;
|
|
881
914
|
default:
|
|
882
915
|
logToFile("[TelegramCallback]", `Unknown action: ${parsed.action}`);
|
|
883
916
|
}
|
|
884
917
|
});
|
|
885
918
|
|
|
919
|
+
// Register message handler to forward Telegram messages to Pi
|
|
920
|
+
center.setMessageHandler(async (text: string, _chatId: string) => {
|
|
921
|
+
logToFile("[TelegramInbound]", `Forwarding message to Pi: "${text.slice(0, 50)}..."`);
|
|
922
|
+
// Forward the message to Pi as a user message
|
|
923
|
+
await pi.sendUserMessage(text, { deliverAs: "steer" });
|
|
924
|
+
});
|
|
925
|
+
|
|
886
926
|
// Wire to singleton nc() helper so all event emitters can reach Telegram
|
|
887
927
|
_nc = {
|
|
888
928
|
center,
|
|
@@ -2486,9 +2526,6 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2486
2526
|
let outputLimitResumeAttempts = 0;
|
|
2487
2527
|
let pendingOutputLimitResumeAfterCompact = false;
|
|
2488
2528
|
let pendingOutputLimitResumeAfterSettled = false;
|
|
2489
|
-
|
|
2490
|
-
// Track if we sent a steer message - cleared when agent completes
|
|
2491
|
-
let _steerSentThisTurn = false;
|
|
2492
2529
|
let providerOverloadResumeAttempts = 0;
|
|
2493
2530
|
let providerOverloadResumeTimer: ReturnType<typeof setTimeout> | null = null;
|
|
2494
2531
|
|
|
@@ -3552,13 +3589,6 @@ Run \`bd ready\` to see current bd issues.
|
|
|
3552
3589
|
|
|
3553
3590
|
pi.on("agent_end", () => {
|
|
3554
3591
|
setTimeout(() => {
|
|
3555
|
-
// Clear steer queue when agent completes processing our steer message
|
|
3556
|
-
if (_steerSentThisTurn) {
|
|
3557
|
-
_steerSentThisTurn = false;
|
|
3558
|
-
todoContinuationController?.clearQueue();
|
|
3559
|
-
logToFile("[auto-continue]", "Agent turn complete, queue cleared");
|
|
3560
|
-
}
|
|
3561
|
-
|
|
3562
3592
|
if (!pendingOutputLimitResumeAfterSettled) {
|
|
3563
3593
|
return;
|
|
3564
3594
|
}
|
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.252",
|
|
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",
|