pi-harness-runtime 1.1.11 → 1.1.13
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/CHANGELOG.md +14 -0
- package/index.ts +55 -5
- 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/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/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-registry/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/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/proactive-compact.ts +71 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.13](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.12...v1.1.13) (2026-08-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **runtime:** auto-resume after provider overload ([7bd98bb](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7bd98bb885536667a5eb35cfe6de45a06dc77269))
|
|
11
|
+
|
|
12
|
+
### [1.1.12](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.11...v1.1.12) (2026-08-20)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **runtime:** refresh minimax quota from provider mirror ([a8976b4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a8976b4ff61e28b964bf76405142672798714647))
|
|
18
|
+
|
|
5
19
|
### [1.1.11](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.42...v1.1.11) (2026-08-20)
|
|
6
20
|
|
|
7
21
|
|
package/index.ts
CHANGED
|
@@ -47,8 +47,11 @@ import { registerCopySyncShortcut } from "./packages/clipboard/src/copy-sync.js"
|
|
|
47
47
|
import {
|
|
48
48
|
MAX_PROACTIVE_COMPACT_FAILURES,
|
|
49
49
|
OUTPUT_LIMIT_RESUME_PROMPT,
|
|
50
|
+
PROVIDER_OVERLOAD_RESUME_PROMPT,
|
|
51
|
+
getProviderOverloadResumeDelayMs,
|
|
50
52
|
PROACTIVE_COMPACT_COOLDOWN_MS,
|
|
51
53
|
shouldQueueOutputLimitResume,
|
|
54
|
+
shouldQueueProviderOverloadResume,
|
|
52
55
|
shouldQueuePostCompactionResume,
|
|
53
56
|
shouldTriggerProactiveCompact,
|
|
54
57
|
} from "./proactive-compact.ts";
|
|
@@ -395,6 +398,7 @@ Run \`bd ready\` to see current tasks.
|
|
|
395
398
|
role?: string;
|
|
396
399
|
stopReason?: unknown;
|
|
397
400
|
errorMessage?: unknown;
|
|
401
|
+
content?: unknown;
|
|
398
402
|
usage?: {
|
|
399
403
|
input?: number;
|
|
400
404
|
output?: number;
|
|
@@ -415,9 +419,20 @@ Run \`bd ready\` to see current tasks.
|
|
|
415
419
|
pendingOutputLimitResumeAfterCompact = true;
|
|
416
420
|
pendingOutputLimitResumeAfterSettled = true;
|
|
417
421
|
queueAutoResume("output-limit", OUTPUT_LIMIT_RESUME_PROMPT, "steer");
|
|
422
|
+
} else if (
|
|
423
|
+
shouldQueueProviderOverloadResume(
|
|
424
|
+
m,
|
|
425
|
+
providerOverloadResumeAttempts,
|
|
426
|
+
ctx.hasPendingMessages(),
|
|
427
|
+
)
|
|
428
|
+
) {
|
|
429
|
+
providerOverloadResumeAttempts += 1;
|
|
430
|
+
scheduleProviderOverloadResume(() => ctx.hasPendingMessages());
|
|
418
431
|
} else if (m.stopReason === "stop") {
|
|
419
432
|
outputLimitResumeAttempts = 0;
|
|
420
433
|
pendingOutputLimitResumeAfterSettled = false;
|
|
434
|
+
providerOverloadResumeAttempts = 0;
|
|
435
|
+
clearProviderOverloadResume();
|
|
421
436
|
}
|
|
422
437
|
|
|
423
438
|
if (!m.usage) return;
|
|
@@ -482,7 +497,6 @@ Run \`bd ready\` to see current tasks.
|
|
|
482
497
|
}
|
|
483
498
|
};
|
|
484
499
|
|
|
485
|
-
const cookieQuotaAutoFetchAvailable = hasCookieSource();
|
|
486
500
|
|
|
487
501
|
// --- TUI quota signal plumbing (OpenAI / GLM / Anthropic / OpenRouter) --
|
|
488
502
|
// The TUIUsageMonitor parses provider quota-exhaustion messages from pi's
|
|
@@ -574,6 +588,9 @@ Run \`bd ready\` to see current tasks.
|
|
|
574
588
|
let outputLimitResumeAttempts = 0;
|
|
575
589
|
let pendingOutputLimitResumeAfterCompact = false;
|
|
576
590
|
let pendingOutputLimitResumeAfterSettled = false;
|
|
591
|
+
let providerOverloadResumeAttempts = 0;
|
|
592
|
+
let providerOverloadResumeTimer: ReturnType<typeof setTimeout> | null =
|
|
593
|
+
null;
|
|
577
594
|
|
|
578
595
|
// --- Context-usage escalating warning tiers -----------------------------
|
|
579
596
|
// Amber at 75%, red at 85%. No notify above 90% (proactive compact handles it).
|
|
@@ -763,7 +780,7 @@ Run \`bd ready\` to see current tasks.
|
|
|
763
780
|
return true;
|
|
764
781
|
}
|
|
765
782
|
|
|
766
|
-
if (!
|
|
783
|
+
if (!hasCookieSource()) {
|
|
767
784
|
return false;
|
|
768
785
|
}
|
|
769
786
|
|
|
@@ -853,7 +870,7 @@ Run \`bd ready\` to see current tasks.
|
|
|
853
870
|
return;
|
|
854
871
|
}
|
|
855
872
|
|
|
856
|
-
const mirror = mirrorStore.
|
|
873
|
+
const mirror = mirrorStore.readProvider("minimax");
|
|
857
874
|
const freshness = mirrorStore.freshness(mirror, nowMs);
|
|
858
875
|
const shouldFetchBaseline = !mirror || freshness === "expired";
|
|
859
876
|
const usageSinceSync = getMiniMaxUsageSince(
|
|
@@ -912,7 +929,10 @@ Run \`bd ready\` to see current tasks.
|
|
|
912
929
|
description: "Show Codex-style usage status (local + provider mirror)",
|
|
913
930
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
914
931
|
const local = aggregateWindows(tracker.all());
|
|
915
|
-
const
|
|
932
|
+
const provider = providerFromModelId(ctx.model?.id ?? null);
|
|
933
|
+
const mirror = provider
|
|
934
|
+
? mirrorStore.readProvider(provider)
|
|
935
|
+
: mirrorStore.read();
|
|
916
936
|
const output = renderStatus({
|
|
917
937
|
model: ctx.model?.id ?? null,
|
|
918
938
|
cwd: ctx.cwd ?? process.cwd(),
|
|
@@ -930,7 +950,8 @@ Run \`bd ready\` to see current tasks.
|
|
|
930
950
|
description: "Force refresh quota from provider console",
|
|
931
951
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
932
952
|
const autoFetchAvailable =
|
|
933
|
-
|
|
953
|
+
hasCookieSource() ||
|
|
954
|
+
(await hasBrowserProfileAutoFetchSource());
|
|
934
955
|
if (!autoFetchAvailable) {
|
|
935
956
|
ctx.ui.notify(
|
|
936
957
|
"MiniMax cookies not found. Drop any cookie file (Netscape or EditThisCookie JSON) into ~/.pi-harness-runtime/cookies/ — the runtime normalizes it for you. Or run `bun packages/auth/src/run-minimax-auth.ts auth`.",
|
|
@@ -1403,6 +1424,35 @@ Run \`bd ready\` to see current tasks.
|
|
|
1403
1424
|
}
|
|
1404
1425
|
}, MINIMAX_REFRESH_MIN_INTERVAL_MS);
|
|
1405
1426
|
|
|
1427
|
+
function clearProviderOverloadResume(): void {
|
|
1428
|
+
if (providerOverloadResumeTimer) {
|
|
1429
|
+
clearTimeout(providerOverloadResumeTimer);
|
|
1430
|
+
providerOverloadResumeTimer = null;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
function scheduleProviderOverloadResume(hasPendingMessages: () => boolean): void {
|
|
1435
|
+
clearProviderOverloadResume();
|
|
1436
|
+
const delayMs = getProviderOverloadResumeDelayMs();
|
|
1437
|
+
const delayMinutes = Math.max(1, Math.round(delayMs / 60_000));
|
|
1438
|
+
console.error(
|
|
1439
|
+
"[pi-harness] Provider overloaded; scheduling resume in " +
|
|
1440
|
+
delayMinutes +
|
|
1441
|
+
" min",
|
|
1442
|
+
);
|
|
1443
|
+
providerOverloadResumeTimer = setTimeout(() => {
|
|
1444
|
+
providerOverloadResumeTimer = null;
|
|
1445
|
+
if (hasPendingMessages()) {
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
queueAutoResume(
|
|
1449
|
+
"provider-overload",
|
|
1450
|
+
PROVIDER_OVERLOAD_RESUME_PROMPT,
|
|
1451
|
+
"followUp",
|
|
1452
|
+
);
|
|
1453
|
+
}, delayMs);
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1406
1456
|
function queueAutoResume(
|
|
1407
1457
|
reason: string,
|
|
1408
1458
|
content: string,
|
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.13",
|
|
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.13",
|
|
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",
|
package/proactive-compact.ts
CHANGED
|
@@ -7,6 +7,10 @@ export const MAX_PROACTIVE_COMPACT_FAILURES = 3;
|
|
|
7
7
|
export const OUTPUT_LIMIT_AUTO_RESUME_LIMIT = 3;
|
|
8
8
|
export const OUTPUT_LIMIT_RESUME_PROMPT =
|
|
9
9
|
"Output token limit hit. Resume directly — no apology, no recap. Pick up mid-thought if the cut happened there. Break remaining work into smaller pieces.";
|
|
10
|
+
export const PROVIDER_OVERLOAD_AUTO_RESUME_LIMIT = 3;
|
|
11
|
+
export const PROVIDER_OVERLOAD_AUTO_RESUME_MIN_MS = 60_000;
|
|
12
|
+
export const PROVIDER_OVERLOAD_AUTO_RESUME_MAX_MS = 5 * 60_000;
|
|
13
|
+
export const PROVIDER_OVERLOAD_RESUME_PROMPT = "resume";
|
|
10
14
|
|
|
11
15
|
export function shouldTriggerProactiveCompact(
|
|
12
16
|
usage: ContextUsage | undefined,
|
|
@@ -33,8 +37,36 @@ export type AssistantStopLike = {
|
|
|
33
37
|
role?: string;
|
|
34
38
|
stopReason?: unknown;
|
|
35
39
|
errorMessage?: unknown;
|
|
40
|
+
content?: unknown;
|
|
36
41
|
};
|
|
37
42
|
|
|
43
|
+
function readAssistantStopText(message: AssistantStopLike): string {
|
|
44
|
+
const parts: string[] = [];
|
|
45
|
+
if (typeof message.errorMessage === "string") {
|
|
46
|
+
parts.push(message.errorMessage);
|
|
47
|
+
}
|
|
48
|
+
if (typeof message.stopReason === "string") {
|
|
49
|
+
parts.push(message.stopReason);
|
|
50
|
+
}
|
|
51
|
+
if (typeof message.content === "string") {
|
|
52
|
+
parts.push(message.content);
|
|
53
|
+
} else if (Array.isArray(message.content)) {
|
|
54
|
+
for (const part of message.content) {
|
|
55
|
+
if (typeof part === "string") {
|
|
56
|
+
parts.push(part);
|
|
57
|
+
} else if (part && typeof part === "object") {
|
|
58
|
+
const obj = part as { text?: unknown; content?: unknown };
|
|
59
|
+
if (typeof obj.text === "string") {
|
|
60
|
+
parts.push(obj.text);
|
|
61
|
+
} else if (typeof obj.content === "string") {
|
|
62
|
+
parts.push(obj.content);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return parts.join("\n");
|
|
68
|
+
}
|
|
69
|
+
|
|
38
70
|
export function isOutputLimitAssistantMessage(
|
|
39
71
|
message: AssistantStopLike,
|
|
40
72
|
): boolean {
|
|
@@ -72,6 +104,45 @@ export function shouldQueueOutputLimitResume(
|
|
|
72
104
|
);
|
|
73
105
|
}
|
|
74
106
|
|
|
107
|
+
export function isProviderOverloadAssistantMessage(
|
|
108
|
+
message: AssistantStopLike,
|
|
109
|
+
): boolean {
|
|
110
|
+
if (message.role !== "assistant") {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return /overloaded_error|peak-hour surge|temporarily busy|server is temporarily busy|try again shortly|Retry failed after \d+ attempts:.*529|\b529\b|\b2064\b/i.test(
|
|
115
|
+
readAssistantStopText(message),
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function shouldQueueProviderOverloadResume(
|
|
120
|
+
message: AssistantStopLike,
|
|
121
|
+
resumeAttempts: number,
|
|
122
|
+
hasPendingMessages: boolean,
|
|
123
|
+
options?: { maxAttempts?: number },
|
|
124
|
+
): boolean {
|
|
125
|
+
const maxAttempts =
|
|
126
|
+
options?.maxAttempts ?? PROVIDER_OVERLOAD_AUTO_RESUME_LIMIT;
|
|
127
|
+
return (
|
|
128
|
+
isProviderOverloadAssistantMessage(message) &&
|
|
129
|
+
resumeAttempts < maxAttempts &&
|
|
130
|
+
!hasPendingMessages
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function getProviderOverloadResumeDelayMs(options?: {
|
|
135
|
+
minMs?: number;
|
|
136
|
+
maxMs?: number;
|
|
137
|
+
random?: () => number;
|
|
138
|
+
}): number {
|
|
139
|
+
const minMs = options?.minMs ?? PROVIDER_OVERLOAD_AUTO_RESUME_MIN_MS;
|
|
140
|
+
const maxMs = options?.maxMs ?? PROVIDER_OVERLOAD_AUTO_RESUME_MAX_MS;
|
|
141
|
+
const random = options?.random ?? Math.random;
|
|
142
|
+
const clampedRandom = Math.max(0, Math.min(1, random()));
|
|
143
|
+
return Math.round(minMs + clampedRandom * (maxMs - minMs));
|
|
144
|
+
}
|
|
145
|
+
|
|
75
146
|
export function shouldQueuePostCompactionResume(
|
|
76
147
|
event: {
|
|
77
148
|
willRetry?: boolean;
|