pi-harness-runtime 1.1.123 → 1.1.125
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 +113 -0
- 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/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/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/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/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
|
@@ -354,6 +354,98 @@ async function initHoncho(pi: { events: { emit(name: string, data: unknown): voi
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
+
// --- langchain-loop: Ping-pong write-review loop via harness/langchain/ -----------
|
|
358
|
+
// Requires pi-env package + env vars in settings.json["env"] + API keys in keys/
|
|
359
|
+
//
|
|
360
|
+
// Env vars set by pi-env (install: pi install npm:pi-env):
|
|
361
|
+
// PLANNER_MODEL, PLANNER_BASE_URL
|
|
362
|
+
// GLM_MODEL, GLM_BASE_URL
|
|
363
|
+
// MINIMAX_MODEL, MINIMAX_BASE_URL
|
|
364
|
+
//
|
|
365
|
+
// API keys from: ~/.pi-harness-runtime/keys/{planner,reviewer,coder}-api-key.txt
|
|
366
|
+
function initLangChain(pi: {
|
|
367
|
+
registerCommand(
|
|
368
|
+
name: string,
|
|
369
|
+
cmd: {
|
|
370
|
+
description: string;
|
|
371
|
+
handler: (args: string, ctx: unknown) => Promise<void>;
|
|
372
|
+
prompt?: string;
|
|
373
|
+
},
|
|
374
|
+
): void;
|
|
375
|
+
}): void {
|
|
376
|
+
const { readFileSync, existsSync } = require("node:fs");
|
|
377
|
+
const { spawn } = require("node:child_process");
|
|
378
|
+
const { fileURLToPath } = require("url");
|
|
379
|
+
const { dirname } = require("node:path");
|
|
380
|
+
|
|
381
|
+
const home = process.env.HOME || process.env.USERPROFILE || "/home/frappe";
|
|
382
|
+
const keysDir = `${home}/.pi-harness-runtime/keys`;
|
|
383
|
+
|
|
384
|
+
// Check env vars (set by pi-env from settings.json["env"])
|
|
385
|
+
const plannerEnv = process.env.PLANNER_MODEL && process.env.PLANNER_BASE_URL;
|
|
386
|
+
const reviewerEnv = process.env.GLM_MODEL && process.env.GLM_BASE_URL;
|
|
387
|
+
const coderEnv = process.env.MINIMAX_MODEL && process.env.MINIMAX_BASE_URL;
|
|
388
|
+
|
|
389
|
+
// Check API keys (from keys/ dir)
|
|
390
|
+
const plannerKey = existsSync(`${keysDir}/planner-api-key.txt`);
|
|
391
|
+
const reviewerKey = existsSync(`${keysDir}/reviewer-api-key.txt`);
|
|
392
|
+
const coderKey = existsSync(`${keysDir}/coder-api-key.txt`);
|
|
393
|
+
|
|
394
|
+
if (!plannerEnv || !reviewerEnv || !coderEnv) {
|
|
395
|
+
console.error("[pi-harness] LangChain loop not configured (pi-env missing):");
|
|
396
|
+
console.error("[pi-harness] 1. Run: pi install npm:pi-env");
|
|
397
|
+
console.error("[pi-harness] 2. Add to ~/.pi/agent/settings.json under \"env\":");
|
|
398
|
+
console.error("[pi-harness] PLANNER_MODEL, PLANNER_BASE_URL");
|
|
399
|
+
console.error("[pi-harness] GLM_MODEL, GLM_BASE_URL");
|
|
400
|
+
console.error("[pi-harness] MINIMAX_MODEL, MINIMAX_BASE_URL");
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (!plannerKey || !reviewerKey || !coderKey) {
|
|
405
|
+
console.error("[pi-harness] LangChain loop: API keys missing:");
|
|
406
|
+
if (!plannerKey) console.error(`[pi-harness] echo "{key}" > ${keysDir}/planner-api-key.txt`);
|
|
407
|
+
if (!reviewerKey) console.error(`[pi-harness] echo "{key}" > ${keysDir}/reviewer-api-key.txt`);
|
|
408
|
+
if (!coderKey) console.error(`[pi-harness] echo "{key}" > ${keysDir}/coder-api-key.txt`);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// All configured — register the /langchain command
|
|
413
|
+
pi.registerCommand("langchain", {
|
|
414
|
+
description:
|
|
415
|
+
"Run LangChain ping-pong loop: planner → coder → reviewer → fix → approve",
|
|
416
|
+
prompt: "Describe the feature or task for the LangChain loop to implement.",
|
|
417
|
+
handler: async (request: string) => {
|
|
418
|
+
if (!request.trim()) {
|
|
419
|
+
console.error("[pi-harness] /langchain requires a request.");
|
|
420
|
+
console.error("[pi-harness] Example: /langchain implement user auth module");
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const env: Record<string, string> = { ...(process.env as Record<string, string>) };
|
|
425
|
+
env.PLANNER_API_KEY = readFileSync(`${keysDir}/planner-api-key.txt`, "utf8").trim();
|
|
426
|
+
env.GLM_API_KEY = readFileSync(`${keysDir}/reviewer-api-key.txt`, "utf8").trim();
|
|
427
|
+
env.MINIMAX_API_KEY = readFileSync(`${keysDir}/coder-api-key.txt`, "utf8").trim();
|
|
428
|
+
|
|
429
|
+
if (existsSync(`${keysDir}/langsmith-api-key.txt`)) {
|
|
430
|
+
env.LANGSMITH_API_KEY = readFileSync(`${keysDir}/langsmith-api-key.txt`, "utf8").trim();
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const runtimeRoot = dirname(fileURLToPath(import.meta.url));
|
|
434
|
+
const runScript = `${runtimeRoot}/harness/langchain/run.ts`;
|
|
435
|
+
|
|
436
|
+
const proc = spawn("bun", ["run", runScript, "--mode", "graph", "--request", request], {
|
|
437
|
+
env,
|
|
438
|
+
stdio: "inherit",
|
|
439
|
+
});
|
|
440
|
+
proc.on("exit", (code: number | null) => {
|
|
441
|
+
if (code !== 0) console.error(`[pi-harness] /langchain exited with code ${code}`);
|
|
442
|
+
});
|
|
443
|
+
},
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
console.error("[pi-harness] LangChain loop ready (planner + reviewer + coder)");
|
|
447
|
+
}
|
|
448
|
+
|
|
357
449
|
// --- moocoding-sync-hint: Suggest syncing skills if skills dir is empty --------
|
|
358
450
|
// Fires after Jev + Qdrant so all three appear together in startup
|
|
359
451
|
function initMoocodingSyncHint(): void {
|
|
@@ -777,6 +869,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
777
869
|
// --- moocoding-sync-hint: Suggest skill sync if skills dir is empty --------
|
|
778
870
|
void initMoocodingSyncHint();
|
|
779
871
|
|
|
872
|
+
// --- langchain-loop: Ping-pong write-review loop (planner + reviewer + coder) ----
|
|
873
|
+
void initLangChain(pi);
|
|
874
|
+
|
|
780
875
|
// --- loop-completions: Watch daemon completions → agent TUI todos --------
|
|
781
876
|
void initLoopCompletions(pi);
|
|
782
877
|
|
|
@@ -1034,6 +1129,24 @@ Run \`bd ready\` to see current bd issues.
|
|
|
1034
1129
|
}
|
|
1035
1130
|
providerOverloadResumeAttempts = 0;
|
|
1036
1131
|
clearProviderOverloadResume();
|
|
1132
|
+
|
|
1133
|
+
// --- Auto-Continue: Check todos and keep going -------------------------------
|
|
1134
|
+
// If the agent stopped naturally AND the response mentions pending todos,
|
|
1135
|
+
// auto-steering forces it to continue without waiting for user input.
|
|
1136
|
+
const text = readMessageText(event.message);
|
|
1137
|
+
if (
|
|
1138
|
+
text &&
|
|
1139
|
+
/Todos?\s*\(\d+\/\d+\)|\([○◐●]\s+\w+.*pending|Tasks?\s*\(\d+.*pending\)/i.test(text)
|
|
1140
|
+
) {
|
|
1141
|
+
try {
|
|
1142
|
+
pi.sendUserMessage(
|
|
1143
|
+
"You have pending tasks. Run `todo list` to see them, then continue with the next pending one without asking.",
|
|
1144
|
+
{ deliverAs: "steer" },
|
|
1145
|
+
);
|
|
1146
|
+
} catch {
|
|
1147
|
+
// best-effort
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1037
1150
|
}
|
|
1038
1151
|
|
|
1039
1152
|
if (!m.usage) return;
|
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.125",
|
|
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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/provider-router",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.125",
|
|
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",
|