pi-harness-runtime 1.1.346 → 1.1.348
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 +71 -75
- 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/connection-runtime/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/contracts/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/durable-review/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-sink/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/index.d.ts +1 -0
- package/packages/notification/dist/index.d.ts.map +1 -1
- package/packages/notification/dist/index.js +1 -0
- package/packages/notification/dist/index.js.map +1 -1
- package/packages/notification/dist/notification-center.d.ts +13 -0
- package/packages/notification/dist/notification-center.d.ts.map +1 -1
- package/packages/notification/dist/notification-center.js +91 -1
- package/packages/notification/dist/notification-center.js.map +1 -1
- package/packages/notification/dist/pending-question.d.ts +198 -0
- package/packages/notification/dist/pending-question.d.ts.map +1 -0
- package/packages/notification/dist/pending-question.js +410 -0
- package/packages/notification/dist/pending-question.js.map +1 -0
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/index.ts +1 -0
- package/packages/notification/src/notification-center.ts +92 -1
- package/packages/notification/src/pending-question.ts +594 -0
- package/packages/notification/test/pending-question.test.ts +331 -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/permission-mode/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/relay/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/voice-api/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/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
|
@@ -168,6 +168,8 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
168
168
|
readFileSync(`${keysDir}/jev-api-key.txt`, "utf8").trim();
|
|
169
169
|
|
|
170
170
|
const mod = await import("./packages/jev-judge/src/auto-continue.js");
|
|
171
|
+
const { createPendingQuestionController } = await import("./packages/notification/dist/index.js");
|
|
172
|
+
const pqController = createPendingQuestionController();
|
|
171
173
|
|
|
172
174
|
// Track waiting state
|
|
173
175
|
let waitingForUserSince: Date | null = null;
|
|
@@ -176,6 +178,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
176
178
|
let _inferenceInProgress = false; // Track for overlap prevention
|
|
177
179
|
let _sessionId = Date.now().toString(36); // Track session for cancellation
|
|
178
180
|
let _lastNotifiedQuestion = ""; // Track last question to prevent repeat notifications
|
|
181
|
+
let _completedNotifiedFor: string | null = null; // Track completion notification deduplication
|
|
179
182
|
|
|
180
183
|
// UI status for auto-continue (captured from session_start ctx)
|
|
181
184
|
let _setAutoContinueStatus: ((text: string | undefined) => void) | null = null;
|
|
@@ -271,50 +274,20 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
271
274
|
}
|
|
272
275
|
|
|
273
276
|
// Detect actual confirmation requests (questions, not progress statements)
|
|
274
|
-
//
|
|
277
|
+
// Uses the pending question controller for detection with expanded patterns
|
|
275
278
|
function detectConfirmationRequest(text: string): string | null {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
const matches = text.matchAll(questionPattern);
|
|
280
|
-
|
|
281
|
-
for (const match of matches) {
|
|
282
|
-
const sentence = match[1].trim();
|
|
283
|
-
const lower = sentence.toLowerCase();
|
|
284
|
-
|
|
285
|
-
// Must contain request words AND user intent words
|
|
286
|
-
const hasRequest = /\b(continue|proceed|next|wait|pause|stop|hold|resume|repeat|rephrase|clarify|explain)\b/i.test(lower);
|
|
287
|
-
const hasUserIntent = /\b(should|would|could|shall|may i|do you|would you|should i|could we|can i|can we|would like)\b/i.test(lower);
|
|
288
|
-
|
|
289
|
-
if (hasRequest && hasUserIntent) {
|
|
290
|
-
// Return the question for deduplication (with the ? preserved)
|
|
291
|
-
return sentence;
|
|
292
|
-
}
|
|
279
|
+
const result = pqController.detectQuestion(text);
|
|
280
|
+
if (result.detected && result.questionText) {
|
|
281
|
+
return result.questionText;
|
|
293
282
|
}
|
|
294
|
-
|
|
295
283
|
return null;
|
|
296
284
|
}
|
|
297
285
|
|
|
298
286
|
// Detect routine continuation questions ("Should I continue?")
|
|
299
287
|
// These should NOT block immediate continuation - let Jev/todo controller decide
|
|
300
288
|
function isRoutineContinuation(question: string): boolean {
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
const routinePatterns = [
|
|
304
|
-
/\b(should i|should we|should the|can i continue|can we continue)\b/,
|
|
305
|
-
/\b(would you like me to continue|shall i proceed)\b/,
|
|
306
|
-
/\b(can i proceed|may i continue)\b/,
|
|
307
|
-
/\b(continue|proceed)\s*(with|to|on|with the next|to the next)\b/,
|
|
308
|
-
/\bshall\s+(i|we)\s+(proceed|continue)\b/,
|
|
309
|
-
/\bshould\s+(i|we)\s+(continue|proceed|move on)\b/,
|
|
310
|
-
/\b(continue|proceed)\s+\?/,
|
|
311
|
-
];
|
|
312
|
-
for (const pattern of routinePatterns) {
|
|
313
|
-
if (pattern.test(lower)) {
|
|
314
|
-
return true;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return false;
|
|
289
|
+
const result = pqController.detectQuestion(question);
|
|
290
|
+
return result.isRoutine ?? false;
|
|
318
291
|
}
|
|
319
292
|
|
|
320
293
|
// Detect when agent asks for continuation
|
|
@@ -792,26 +765,50 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
792
765
|
if (result.action === "blocked") {
|
|
793
766
|
updateAutoContinueStatus("ERROR", "blocked");
|
|
794
767
|
logToFile("[auto-continue]", "Tasks blocked:", result.question ?? "unknown");
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
768
|
+
} else if (result.action === "stop") {
|
|
769
|
+
const reason = result.reason ?? "unknown";
|
|
770
|
+
logToFile("[auto-continue]", "decide returned stop:", reason);
|
|
771
|
+
|
|
772
|
+
// Only send completion notification for "No pending tasks"
|
|
773
|
+
// Other stop reasons (paused, unavailable, max attempts) are not completion
|
|
774
|
+
const isNoPendingTasks = reason === "No pending tasks";
|
|
775
|
+
|
|
776
|
+
if (isNoPendingTasks) {
|
|
777
|
+
// Check if there's a pending question - suppress completion if so
|
|
778
|
+
if (pqController.hasPendingQuestion()) {
|
|
779
|
+
logToFile("[auto-continue]", "Suppressing completion - pending question exists");
|
|
780
|
+
updateAutoContinueStatus("WAITING", "pending");
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// Deduplication: only notify once per work generation
|
|
785
|
+
// Use a static flag for this session's settled cycle
|
|
786
|
+
const completionKey = `done-${reason}`;
|
|
787
|
+
if (_completedNotifiedFor === completionKey) {
|
|
788
|
+
logToFile("[auto-continue]", "Completion already notified for:", reason);
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
_completedNotifiedFor = completionKey;
|
|
792
|
+
|
|
793
|
+
// Get full todo list for notification
|
|
794
|
+
const snapshot = await todoContinuationController.getSnapshot();
|
|
795
|
+
const todoList = snapshot.items
|
|
796
|
+
.map((item) => {
|
|
797
|
+
const status = item.status === "completed" ? "[DONE]" : "[PENDING]";
|
|
798
|
+
const subject = item.subject.length > 50 ? item.subject.slice(0, 47) + "..." : item.subject;
|
|
799
|
+
return `${status} ${subject}`;
|
|
800
|
+
})
|
|
801
|
+
.join("\n");
|
|
802
|
+
const message = todoList || "All tasks completed";
|
|
803
|
+
// Notify user that all work is complete with todo list
|
|
804
|
+
_nc?.notify("ReadyForClient", {
|
|
805
|
+
jobId: `done-${reason.replace(/\s+/g, "-")}`,
|
|
806
|
+
requirement: message,
|
|
807
|
+
}).catch((e) => logToFile("[Notification]", "ReadyForClient failed:", String(e)));
|
|
812
808
|
}
|
|
813
|
-
|
|
814
|
-
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
} catch (err) {
|
|
815
812
|
logToFile("[auto-continue]", "agent_settled handler error:", String(err));
|
|
816
813
|
todoContinuationController?.clearQueue();
|
|
817
814
|
}
|
|
@@ -1231,30 +1228,29 @@ async function initTelegram(pi: ExtensionAPI): Promise<void> {
|
|
|
1231
1228
|
|
|
1232
1229
|
// Register message handler to forward Telegram messages to Pi
|
|
1233
1230
|
center.setMessageHandler(async (text: string, _chatId: string) => {
|
|
1234
|
-
// Parse /notify command for channel management
|
|
1235
|
-
// Usage: /notify
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1231
|
+
// Parse /notify-settings command for channel management
|
|
1232
|
+
// Usage: /notify-settings - show current status
|
|
1233
|
+
// /notify-settings telegram on - enable Telegram
|
|
1234
|
+
// /notify-settings line off - disable LINE
|
|
1235
|
+
// /notify-settings all on - enable all channels
|
|
1236
|
+
const settingsMatch = text.match(/^\/notify-settings(?:\s+(\w+)\s+(on|off))?/i);
|
|
1237
|
+
if (settingsMatch || text === "/notify-settings") {
|
|
1238
|
+
const [, channel, action] = settingsMatch || [];
|
|
1239
|
+
|
|
1240
|
+
if (action && channel) {
|
|
1241
|
+
const isEnabled = action === "on";
|
|
1242
|
+
const targetChannels = channel === "all" ? ["telegram", "line"] : [channel];
|
|
1243
|
+
for (const ch of targetChannels) {
|
|
1244
|
+
(center as any).setChannelEnabled?.(ch, isEnabled);
|
|
1245
|
+
logToFile("[NotifySettings]", `Set ${ch} to ${isEnabled ? "enabled" : "disabled"}`);
|
|
1246
|
+
}
|
|
1246
1247
|
}
|
|
1247
|
-
const telegramStatus = (center as any).isChannelEnabled?.("telegram") ? "ON" : "OFF";
|
|
1248
|
-
const lineStatus = (center as any).isChannelEnabled?.("line") ? "ON" : "OFF";
|
|
1249
|
-
logToFile("[NotifyCommand]", `Current: Telegram=${telegramStatus}, LINE=${lineStatus}`);
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
1248
|
|
|
1253
|
-
|
|
1254
|
-
if (text === "/notify") {
|
|
1249
|
+
// Show current status
|
|
1255
1250
|
const telegramStatus = (center as any).isChannelEnabled?.("telegram") ? "ON" : "OFF";
|
|
1256
1251
|
const lineStatus = (center as any).isChannelEnabled?.("line") ? "ON" : "OFF";
|
|
1257
|
-
logToFile("[
|
|
1252
|
+
logToFile("[NotifySettings]", `Current: Telegram=${telegramStatus}, LINE=${lineStatus}`);
|
|
1253
|
+
logToFile("[NotifySettings]", `Commands: /notify-settings telegram on|off, /notify-settings line on|off, /notify-settings all on|off`);
|
|
1258
1254
|
return;
|
|
1259
1255
|
}
|
|
1260
1256
|
|
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.348",
|
|
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",
|