pi-harness-runtime 1.1.143 → 1.1.145
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 +182 -17
- package/package.json +1 -1
- package/packages/a2a-adapter/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/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 +2 -0
- package/packages/notification/dist/adapters/telegram-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/telegram-adapter.js +11 -2
- package/packages/notification/dist/adapters/telegram-adapter.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 +22 -0
- package/packages/notification/dist/notification-center.js.map +1 -1
- package/packages/notification/dist/types.d.ts +1 -1
- package/packages/notification/dist/types.d.ts.map +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/adapters/telegram-adapter.ts +18 -7
- package/packages/notification/src/notification-center.ts +23 -0
- package/packages/notification/src/types.ts +3 -0
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/paperclip-integration/dist/index.d.ts +121 -0
- package/packages/paperclip-integration/dist/index.d.ts.map +1 -0
- package/packages/paperclip-integration/dist/index.js +228 -0
- package/packages/paperclip-integration/dist/index.js.map +1 -0
- package/packages/paperclip-integration/package.json +20 -0
- package/packages/paperclip-integration/src/index.ts +326 -0
- 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/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/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
|
@@ -69,6 +69,12 @@ import {
|
|
|
69
69
|
createBlackboard,
|
|
70
70
|
} from "./harness/blackboard.ts";
|
|
71
71
|
import { scheduleAutoResume, cancelAutoResume, getGLMQuotaCountdown } from "./harness/index.js";
|
|
72
|
+
import { startWatcher, classifyMessage } from "./packages/codex-watcher/dist/src/index.js";
|
|
73
|
+
import {
|
|
74
|
+
getPaperclipConfig,
|
|
75
|
+
hasPaperclipConfig,
|
|
76
|
+
PaperclipWatcher,
|
|
77
|
+
} from "./packages/paperclip-integration/dist/index.js";
|
|
72
78
|
|
|
73
79
|
// --- Jev Auto-Continue: Agent autonomous decision-making --------------------
|
|
74
80
|
// Lazy import - only loads when packages/jev-judge exists and API key available
|
|
@@ -91,7 +97,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
91
97
|
readFileSync(`${keysDir}/jev-api-key.txt`, "utf8").trim().length > 10;
|
|
92
98
|
|
|
93
99
|
if (!hasEnvKey && !hasFileKey) {
|
|
94
|
-
console.
|
|
100
|
+
console.error(
|
|
95
101
|
"[auto-continue] No Jev API key found. Set TYPESAFE_API_KEY run: echo \"{api_key}\" > ~/.pi-harness-runtime/keys/jev-api-key.txt"
|
|
96
102
|
);
|
|
97
103
|
return;
|
|
@@ -114,6 +120,11 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
114
120
|
if (hasContinuation && !waitingForUserSince) {
|
|
115
121
|
waitingForUserSince = new Date();
|
|
116
122
|
console.log("[auto-continue] Agent waiting for continuation confirmation");
|
|
123
|
+
// Emit WaitingForUserInput to Telegram so user knows to respond
|
|
124
|
+
nc("WaitingForUserInput", {
|
|
125
|
+
requirement: "Agent awaiting your response",
|
|
126
|
+
error: "Continue / proceed confirmation needed",
|
|
127
|
+
});
|
|
117
128
|
}
|
|
118
129
|
});
|
|
119
130
|
|
|
@@ -188,7 +199,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
188
199
|
// Start periodic check
|
|
189
200
|
setInterval(checkAndAutoContinue, AUTO_CONTINUE_INTERVAL_MS);
|
|
190
201
|
|
|
191
|
-
console.
|
|
202
|
+
console.error("[auto-continue] Jev Auto-Continue initialized");
|
|
192
203
|
} catch {
|
|
193
204
|
// auto-continue not available
|
|
194
205
|
}
|
|
@@ -255,11 +266,12 @@ async function initTelegram(): Promise<void> {
|
|
|
255
266
|
const chatIdPath = `${keysDir}/telegram-chat-id.txt`;
|
|
256
267
|
|
|
257
268
|
if (!existsSync(botTokenPath) || !existsSync(chatIdPath)) {
|
|
258
|
-
logStartup("[pi-harness] Telegram
|
|
259
|
-
logStartup(
|
|
260
|
-
logStartup(
|
|
261
|
-
logStartup(
|
|
262
|
-
logStartup(
|
|
269
|
+
logStartup("[pi-harness] Telegram (@PiHarnessRuntimeBot) not configured:");
|
|
270
|
+
logStartup("[pi-harness] 1. DM @BotFather → /newbot → name it → get token");
|
|
271
|
+
logStartup("[pi-harness] 2. DM @userinfobot → reply shows your chat ID");
|
|
272
|
+
logStartup("[pi-harness] 3. echo \"{token}\" > ~/.pi-harness-runtime/keys/telegram-bot-token.txt");
|
|
273
|
+
logStartup("[pi-harness] 4. echo \"{chat-id}\" > ~/.pi-harness-runtime/keys/telegram-chat-id.txt");
|
|
274
|
+
logStartup("[pi-harness] 5. Reload pi — then DM @PiHarnessRuntimeBot to verify");
|
|
263
275
|
return;
|
|
264
276
|
}
|
|
265
277
|
|
|
@@ -289,12 +301,26 @@ async function initTelegram(): Promise<void> {
|
|
|
289
301
|
return;
|
|
290
302
|
}
|
|
291
303
|
|
|
292
|
-
// Wire to
|
|
304
|
+
// Wire to singleton nc() helper so all event emitters can reach Telegram
|
|
305
|
+
_nc = {
|
|
306
|
+
center,
|
|
307
|
+
notify: (event: string, ctx: Record<string, unknown>) =>
|
|
308
|
+
center.notify(event as never, ctx as never),
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// Wire to GLMQuotaCountdown so it sends Telegram alerts
|
|
293
312
|
try {
|
|
294
313
|
const { getGLMQuotaCountdown } = await import("./harness/index.js");
|
|
295
314
|
getGLMQuotaCountdown().setNotificationCenter(center);
|
|
296
315
|
} catch { /* not critical */ }
|
|
297
|
-
|
|
316
|
+
|
|
317
|
+
// Log the actual bot username (fetched from Telegram API via getMe)
|
|
318
|
+
const botUsername = center.getTelegramBotUsername();
|
|
319
|
+
if (botUsername) {
|
|
320
|
+
logStartup(`[pi-harness] Telegram (@${botUsername}) ready — DM the bot to receive alerts`);
|
|
321
|
+
} else {
|
|
322
|
+
logStartup(`[pi-harness] Telegram notifications ready`);
|
|
323
|
+
}
|
|
298
324
|
} catch (err) {
|
|
299
325
|
logStartup("[pi-harness] Telegram: init failed:", err instanceof Error ? err.message : String(err));
|
|
300
326
|
}
|
|
@@ -812,6 +838,7 @@ function logStartup(...parts: string[]): void {
|
|
|
812
838
|
|
|
813
839
|
interface HarnessSession {
|
|
814
840
|
jobId: string;
|
|
841
|
+
requirement: string;
|
|
815
842
|
machine: JobStateMachine;
|
|
816
843
|
graph: TaskGraphManager;
|
|
817
844
|
blackboard: SharedBlackboard;
|
|
@@ -821,6 +848,23 @@ interface HarnessSession {
|
|
|
821
848
|
|
|
822
849
|
let currentSession: HarnessSession | null = null;
|
|
823
850
|
|
|
851
|
+
/** Singleton notification center — set by initTelegram(), used by all emit helpers */
|
|
852
|
+
let _nc: { center: unknown; notify: (event: string, ctx: Record<string, unknown>) => Promise<unknown> } | null = null;
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Fire a Telegram notification event. Silently skips if Telegram is not configured.
|
|
856
|
+
*/
|
|
857
|
+
async function nc(event: string, ctx: Record<string, unknown>): Promise<void> {
|
|
858
|
+
if (!_nc) return;
|
|
859
|
+
try {
|
|
860
|
+
await (_nc as { notify: (e: string, c: Record<string, unknown>) => Promise<void> }).notify(event, ctx);
|
|
861
|
+
} catch {
|
|
862
|
+
// Never crash runtime on notification failure
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
824
868
|
/**
|
|
825
869
|
* Safely extract a text view from an LLM message. Used to feed the TUI
|
|
826
870
|
* quota-signal extractor. Handles string content, array-of-parts content
|
|
@@ -1011,6 +1055,68 @@ export default function (pi: ExtensionAPI) {
|
|
|
1011
1055
|
// --- telegram-notifications: Telegram bot for harness event notifications ----
|
|
1012
1056
|
void initTelegram();
|
|
1013
1057
|
|
|
1058
|
+
// --- codex-watcher: Inject Codex plans into pi.dev + Telegram --------------
|
|
1059
|
+
// Lightweight: polls ~/.codex/sessions/ every 5s, no LangChain daemon.
|
|
1060
|
+
// On plan detected: sends Telegram alert + steer message to pi.dev.
|
|
1061
|
+
try {
|
|
1062
|
+
let latestCodexSession = "";
|
|
1063
|
+
let latestPlanOrdinal = 0;
|
|
1064
|
+
|
|
1065
|
+
const codexHandle = startWatcher({
|
|
1066
|
+
pollIntervalMs: 5000,
|
|
1067
|
+
maxIdlePolls: Infinity,
|
|
1068
|
+
onSessionChange: (session) => {
|
|
1069
|
+
if (session) {
|
|
1070
|
+
latestCodexSession = session.id;
|
|
1071
|
+
console.error(`[codex] Session started: ${session.threadName}`);
|
|
1072
|
+
nc("CodexSessionStarted", {
|
|
1073
|
+
requirement: session.threadName || "Codex session",
|
|
1074
|
+
taskTitle: session.id,
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1078
|
+
onMessages: (msgs) => {
|
|
1079
|
+
for (const msg of msgs) {
|
|
1080
|
+
// Skip user messages — only track assistant plans
|
|
1081
|
+
if (msg.role !== "assistant") continue;
|
|
1082
|
+
|
|
1083
|
+
const classification = classifyMessage(msg.text);
|
|
1084
|
+
if (classification !== "plan" && classification !== "mixed") continue;
|
|
1085
|
+
if (msg.ordinal <= latestPlanOrdinal) continue;
|
|
1086
|
+
|
|
1087
|
+
latestPlanOrdinal = msg.ordinal;
|
|
1088
|
+
|
|
1089
|
+
// Emit Telegram alert
|
|
1090
|
+
nc("CodexPlanDetected", {
|
|
1091
|
+
requirement: "Codex plan ready",
|
|
1092
|
+
taskTitle: `Ordinal ${msg.ordinal}`,
|
|
1093
|
+
});
|
|
1094
|
+
|
|
1095
|
+
// Inject plan into pi.dev as a steer message
|
|
1096
|
+
const planPreview = msg.text.slice(0, 500) + (msg.text.length > 500 ? "
|
|
1097
|
+
..." : "");
|
|
1098
|
+
try {
|
|
1099
|
+
pi.sendUserMessage(
|
|
1100
|
+
`[Codex plan detected — ordinal ${msg.ordinal}]
|
|
1101
|
+
|
|
1102
|
+
${planPreview}`,
|
|
1103
|
+
{ deliverAs: "steer" },
|
|
1104
|
+
);
|
|
1105
|
+
} catch {
|
|
1106
|
+
// pi.dev may not be ready
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
});
|
|
1111
|
+
|
|
1112
|
+
// Clean up when pi session ends
|
|
1113
|
+
pi.on("session_end", () => {
|
|
1114
|
+
codexHandle.stop();
|
|
1115
|
+
});
|
|
1116
|
+
} catch {
|
|
1117
|
+
// Codex watcher unavailable (e.g. no codex package installed)
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1014
1120
|
// --- honcho-memory: Honcho MCP for peer/user memory (honcho_profile, etc.) ----
|
|
1015
1121
|
void initHoncho(pi);
|
|
1016
1122
|
|
|
@@ -1020,6 +1126,46 @@ export default function (pi: ExtensionAPI) {
|
|
|
1020
1126
|
// --- langchain-loop: Ping-pong write-review loop (planner + reviewer + coder) ----
|
|
1021
1127
|
void initLangChain(pi);
|
|
1022
1128
|
|
|
1129
|
+
// --- paperclip: Watch Paperclip inbox, route tasks to pi.dev + Telegram ------------
|
|
1130
|
+
// Only starts if PAPERCLIP_API_KEY is set or keys file exists.
|
|
1131
|
+
if (hasPaperclipConfig()) {
|
|
1132
|
+
const paperclipConfig = getPaperclipConfig();
|
|
1133
|
+
if (paperclipConfig) {
|
|
1134
|
+
const watcher = new PaperclipWatcher(paperclipConfig, {
|
|
1135
|
+
nc,
|
|
1136
|
+
sendUserMessage: (content, opts) => {
|
|
1137
|
+
try {
|
|
1138
|
+
pi.sendUserMessage(content, opts as { deliverAs: "steer" });
|
|
1139
|
+
} catch {
|
|
1140
|
+
// pi.dev may not be ready
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
pollIntervalMs: 30_000,
|
|
1144
|
+
onRouted: async (issue) => {
|
|
1145
|
+
// Mark task as in_progress in Paperclip
|
|
1146
|
+
try {
|
|
1147
|
+
const config = getPaperclipConfig();
|
|
1148
|
+
if (config) {
|
|
1149
|
+
const { PaperclipClient } = await import(
|
|
1150
|
+
"./packages/paperclip-integration/dist/index.js"
|
|
1151
|
+
);
|
|
1152
|
+
const client = new PaperclipClient(config);
|
|
1153
|
+
await client.updateIssueStatus(issue.id, "in_progress");
|
|
1154
|
+
}
|
|
1155
|
+
} catch {
|
|
1156
|
+
// Non-critical
|
|
1157
|
+
}
|
|
1158
|
+
},
|
|
1159
|
+
});
|
|
1160
|
+
void watcher.start();
|
|
1161
|
+
pi.on("session_end", () => watcher.stop());
|
|
1162
|
+
}
|
|
1163
|
+
} else {
|
|
1164
|
+
console.error(
|
|
1165
|
+
"[paperclip] Not configured. Set PAPERCLIP_API_KEY or write API key to ~/.pi-harness-runtime/keys/paperclip-api-key.txt",
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1023
1169
|
// --- loop-completions: Watch daemon completions → agent TUI todos --------
|
|
1024
1170
|
void initLoopCompletions(pi);
|
|
1025
1171
|
|
|
@@ -1258,7 +1404,12 @@ Run \`bd ready\` to see current bd issues.
|
|
|
1258
1404
|
outputLimitResumeAttempts += 1;
|
|
1259
1405
|
pendingOutputLimitResumeAfterCompact = true;
|
|
1260
1406
|
pendingOutputLimitResumeAfterSettled = true;
|
|
1261
|
-
queueAutoResume("output-limit", OUTPUT_LIMIT_RESUME_PROMPT, "steer");
|
|
1407
|
+
await queueAutoResume("output-limit", OUTPUT_LIMIT_RESUME_PROMPT, "steer");
|
|
1408
|
+
// Emit OutputLimitContinued to Telegram
|
|
1409
|
+
await nc("OutputLimitContinued", {
|
|
1410
|
+
requirement: "Session output",
|
|
1411
|
+
error: `Attempt ${outputLimitResumeAttempts}`,
|
|
1412
|
+
});
|
|
1262
1413
|
} else if (
|
|
1263
1414
|
shouldQueueProviderOverloadResume(
|
|
1264
1415
|
m,
|
|
@@ -2074,6 +2225,9 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2074
2225
|
return;
|
|
2075
2226
|
}
|
|
2076
2227
|
|
|
2228
|
+
// Emit JobStarted to Telegram
|
|
2229
|
+
await nc("JobStarted", { requirement, jobId });
|
|
2230
|
+
|
|
2077
2231
|
// Create task graph using heuristic planner
|
|
2078
2232
|
const planner = new MasterPlanner();
|
|
2079
2233
|
const planResult = await planner.createPlan(
|
|
@@ -2100,6 +2254,7 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2100
2254
|
// Store session
|
|
2101
2255
|
currentSession = {
|
|
2102
2256
|
jobId,
|
|
2257
|
+
requirement,
|
|
2103
2258
|
machine,
|
|
2104
2259
|
graph: createTaskGraphManager(),
|
|
2105
2260
|
blackboard,
|
|
@@ -2311,6 +2466,7 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2311
2466
|
}
|
|
2312
2467
|
|
|
2313
2468
|
cancelAutoResume(currentSession.jobId);
|
|
2469
|
+
await nc("JobCancelled", { requirement: currentSession.requirement });
|
|
2314
2470
|
const sessionJobId = currentSession.jobId;
|
|
2315
2471
|
currentSession = null;
|
|
2316
2472
|
|
|
@@ -2407,7 +2563,7 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2407
2563
|
return;
|
|
2408
2564
|
}
|
|
2409
2565
|
pendingOutputLimitResumeAfterSettled = false;
|
|
2410
|
-
queueAutoResume(
|
|
2566
|
+
void queueAutoResume(
|
|
2411
2567
|
"output-limit-settled",
|
|
2412
2568
|
OUTPUT_LIMIT_RESUME_PROMPT,
|
|
2413
2569
|
"followUp",
|
|
@@ -2415,7 +2571,7 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2415
2571
|
}, 0);
|
|
2416
2572
|
});
|
|
2417
2573
|
|
|
2418
|
-
pi.on("session_compact", (event, ctx) => {
|
|
2574
|
+
pi.on("session_compact", async (event, ctx) => {
|
|
2419
2575
|
// Capture only the setStatus function, not the ctx
|
|
2420
2576
|
footerSetStatus = ctx.ui.setStatus.bind(ctx.ui);
|
|
2421
2577
|
proactiveCompactInFlight = false;
|
|
@@ -2442,7 +2598,7 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2442
2598
|
}
|
|
2443
2599
|
|
|
2444
2600
|
if (forceOutputLimitResume) {
|
|
2445
|
-
queueAutoResume(
|
|
2601
|
+
await queueAutoResume(
|
|
2446
2602
|
"post-compact-output-limit",
|
|
2447
2603
|
OUTPUT_LIMIT_RESUME_PROMPT,
|
|
2448
2604
|
event.willRetry ? "steer" : "followUp",
|
|
@@ -2452,7 +2608,7 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2452
2608
|
|
|
2453
2609
|
outputLimitResumeAttempts = 0;
|
|
2454
2610
|
// pi.dev expects the literal "resume" command to continue after compaction.
|
|
2455
|
-
queueAutoResume("post-compact", "resume", "followUp");
|
|
2611
|
+
await queueAutoResume("post-compact", "resume", "followUp");
|
|
2456
2612
|
});
|
|
2457
2613
|
|
|
2458
2614
|
// --- Periodic quota refresh every 15 minutes ---
|
|
@@ -2495,7 +2651,7 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2495
2651
|
console.error(`[pi-harness] Resume skipped: hasPendingMessages=true`);
|
|
2496
2652
|
return;
|
|
2497
2653
|
}
|
|
2498
|
-
queueAutoResume(
|
|
2654
|
+
void queueAutoResume(
|
|
2499
2655
|
"provider-overload",
|
|
2500
2656
|
PROVIDER_OVERLOAD_RESUME_PROMPT,
|
|
2501
2657
|
"followUp",
|
|
@@ -2503,13 +2659,17 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2503
2659
|
}, delayMs);
|
|
2504
2660
|
}
|
|
2505
2661
|
|
|
2506
|
-
function queueAutoResume(
|
|
2662
|
+
async function queueAutoResume(
|
|
2507
2663
|
reason: string,
|
|
2508
2664
|
content: string,
|
|
2509
2665
|
deliverAs: "steer" | "followUp",
|
|
2510
|
-
): void {
|
|
2666
|
+
): Promise<void> {
|
|
2511
2667
|
try {
|
|
2512
2668
|
pi.sendUserMessage(content, { deliverAs });
|
|
2669
|
+
await nc("ResumeScheduled", {
|
|
2670
|
+
requirement: "Session auto-resume",
|
|
2671
|
+
error: reason,
|
|
2672
|
+
});
|
|
2513
2673
|
} catch (error) {
|
|
2514
2674
|
console.error(
|
|
2515
2675
|
`[pi-harness] Failed to queue ${reason} auto-resume:`,
|
|
@@ -2553,6 +2713,11 @@ Run \`bd ready\` to see current bd issues.
|
|
|
2553
2713
|
lastProactiveCompactAt = Date.now();
|
|
2554
2714
|
consecutiveCompactFailures = 0;
|
|
2555
2715
|
proactiveCompactCircuitReported = false;
|
|
2716
|
+
// Emit ContextCompacted to Telegram
|
|
2717
|
+
nc("ContextCompacted", {
|
|
2718
|
+
requirement: "Session context",
|
|
2719
|
+
error: "Proactive compact completed",
|
|
2720
|
+
});
|
|
2556
2721
|
},
|
|
2557
2722
|
onError: (error) => {
|
|
2558
2723
|
proactiveCompactInFlight = false;
|
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.145",
|
|
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",
|