pi-harness-runtime 0.9.6 → 0.9.7
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 +15 -0
- package/index.ts +48 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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
|
+
### [0.9.7](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.9.5...v0.9.7) (2026-07-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* harden auto-resume after compaction ([13378e8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/13378e852c984ead0e66f0adeffc073ff58af50c))
|
|
11
|
+
* resume after output-limit error stops ([8c75a24](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8c75a2432082c4f9ba6296ffe2d04b636863bf2f))
|
|
12
|
+
|
|
13
|
+
### [0.9.3](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.5.0-beta.1...v0.9.3) (2026-07-14)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* auto-resume pi dev with literal resume ([#51](https://github.com/ManotLuijiu/pi-harness-runtime/issues/51)) ([fd98762](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fd987629f6062a4a7ff7a28d9dfb607962f5a4a9))
|
|
19
|
+
|
|
5
20
|
### [0.9.6](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.9.5...v0.9.6) (2026-07-16)
|
|
6
21
|
|
|
7
22
|
|
package/index.ts
CHANGED
|
@@ -81,6 +81,33 @@ async function getCheckpointManager(): Promise<CheckpointManager> {
|
|
|
81
81
|
) as unknown as CheckpointManager;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
function isOutputLimitResumePromptMessage(message: {
|
|
85
|
+
role?: string;
|
|
86
|
+
content?: unknown;
|
|
87
|
+
}): boolean {
|
|
88
|
+
if (message.role !== "user") {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (typeof message.content === "string") {
|
|
92
|
+
return message.content === OUTPUT_LIMIT_RESUME_PROMPT;
|
|
93
|
+
}
|
|
94
|
+
if (!Array.isArray(message.content)) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return (
|
|
98
|
+
message.content
|
|
99
|
+
.filter(
|
|
100
|
+
(part): part is { type: "text"; text: string } =>
|
|
101
|
+
part &&
|
|
102
|
+
typeof part === "object" &&
|
|
103
|
+
(part as { type?: unknown }).type === "text" &&
|
|
104
|
+
typeof (part as { text?: unknown }).text === "string",
|
|
105
|
+
)
|
|
106
|
+
.map((part) => part.text)
|
|
107
|
+
.join("\n") === OUTPUT_LIMIT_RESUME_PROMPT
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
84
111
|
export default function (pi: ExtensionAPI) {
|
|
85
112
|
const tracker = new UsageTracker();
|
|
86
113
|
const mirrorStore = new MirrorStore();
|
|
@@ -88,6 +115,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
88
115
|
|
|
89
116
|
// ─── Auto-track every assistant message ──────────────────────────────
|
|
90
117
|
pi.on("message_end", async (event, ctx) => {
|
|
118
|
+
if (isOutputLimitResumePromptMessage(event.message)) {
|
|
119
|
+
pendingOutputLimitResumeAfterSettled = false;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
91
122
|
if (event.message.role !== "assistant") return;
|
|
92
123
|
const m = event.message as {
|
|
93
124
|
role?: string;
|
|
@@ -111,9 +142,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
111
142
|
) {
|
|
112
143
|
outputLimitResumeAttempts += 1;
|
|
113
144
|
pendingOutputLimitResumeAfterCompact = true;
|
|
145
|
+
pendingOutputLimitResumeAfterSettled = true;
|
|
114
146
|
queueAutoResume("output-limit", OUTPUT_LIMIT_RESUME_PROMPT, "steer");
|
|
115
147
|
} else if (m.stopReason === "stop") {
|
|
116
148
|
outputLimitResumeAttempts = 0;
|
|
149
|
+
pendingOutputLimitResumeAfterSettled = false;
|
|
117
150
|
}
|
|
118
151
|
|
|
119
152
|
if (!m.usage) return;
|
|
@@ -147,6 +180,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
147
180
|
let proactiveCompactCircuitReported = false;
|
|
148
181
|
let outputLimitResumeAttempts = 0;
|
|
149
182
|
let pendingOutputLimitResumeAfterCompact = false;
|
|
183
|
+
let pendingOutputLimitResumeAfterSettled = false;
|
|
150
184
|
|
|
151
185
|
function writeMirrorRecord(record: MirrorRecord): void {
|
|
152
186
|
mirrorStore.write(record);
|
|
@@ -683,6 +717,20 @@ export default function (pi: ExtensionAPI) {
|
|
|
683
717
|
maybeTriggerProactiveCompact(ctx);
|
|
684
718
|
});
|
|
685
719
|
|
|
720
|
+
pi.on("agent_end", () => {
|
|
721
|
+
setTimeout(() => {
|
|
722
|
+
if (!pendingOutputLimitResumeAfterSettled) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
pendingOutputLimitResumeAfterSettled = false;
|
|
726
|
+
queueAutoResume(
|
|
727
|
+
"output-limit-settled",
|
|
728
|
+
OUTPUT_LIMIT_RESUME_PROMPT,
|
|
729
|
+
"followUp",
|
|
730
|
+
);
|
|
731
|
+
}, 0);
|
|
732
|
+
});
|
|
733
|
+
|
|
686
734
|
pi.on("session_compact", (event, ctx) => {
|
|
687
735
|
footerStatusCtx = ctx;
|
|
688
736
|
proactiveCompactInFlight = false;
|
package/package.json
CHANGED