@jwilger/pi-development-system 0.43.0 → 0.44.0
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { cadenceLine, DEFAULT_PUSH_MINUTES } from "../src/context/cadence.ts";
|
|
4
|
-
import { registerCompactionResync } from "../src/context/compaction.ts";
|
|
5
4
|
import { appendContextTail, renderContextTail } from "../src/context/context-tail.ts";
|
|
6
5
|
import { registerModelAdvice } from "../src/context/model-advice.ts";
|
|
7
6
|
import { renderStatus, renderStatusLine, STATUS_KEY } from "../src/context/status.ts";
|
|
@@ -114,7 +113,6 @@ export function createDevelopmentSystem(pi: ExtensionAPI) {
|
|
|
114
113
|
});
|
|
115
114
|
registerTestGuard({ pi, state, approvals, jev: (ctx) => jevHolder.forContext(ctx) });
|
|
116
115
|
registerTestEvidence({ pi, state });
|
|
117
|
-
registerCompactionResync({ pi, state });
|
|
118
116
|
registerModelAdvice({
|
|
119
117
|
pi,
|
|
120
118
|
state,
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type { SessionState } from "../state/session-state.ts";
|
|
3
|
-
import { renderStateBlock } from "./state-block.ts";
|
|
4
|
-
|
|
5
|
-
export const RESYNC_ENTRY_TYPE = "devsys-resync";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* pi lets `session_before_compact` only REPLACE the whole summary (summary, firstKeptEntryId,
|
|
9
|
-
* tokensBefore), which would mean writing our own summariser and paying another model call. So the
|
|
10
|
-
* summary is left to pi, and once it lands we re-state the working state as one message the next
|
|
11
|
-
* request sees. State itself lives in session entries and the per-turn context tail, so nothing is
|
|
12
|
-
* lost; this just makes it visible to the model again.
|
|
13
|
-
*/
|
|
14
|
-
export function registerCompactionResync(deps: { pi: ExtensionAPI; state: SessionState }): void {
|
|
15
|
-
deps.pi.on("session_compact", () => {
|
|
16
|
-
const state = deps.state.get();
|
|
17
|
-
if (state.phase === "idle" && state.openDepartures.length === 0) return;
|
|
18
|
-
// triggerTurn:false: while a run is active pi would otherwise steer the message, and the queued
|
|
19
|
-
// message would force an extra model turn after automatic compaction.
|
|
20
|
-
deps.pi.sendMessage(
|
|
21
|
-
{
|
|
22
|
-
customType: RESYNC_ENTRY_TYPE,
|
|
23
|
-
content: `[devsys resync] Context was compacted. Current working state:\n\n${renderStateBlock(state)}`,
|
|
24
|
-
display: true,
|
|
25
|
-
},
|
|
26
|
-
{ triggerTurn: false },
|
|
27
|
-
);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { DevsysState } from "../core/types.ts";
|
|
2
|
-
import { activeReview } from "./status.ts";
|
|
3
|
-
|
|
4
|
-
const MAX_DEPARTURES = 8;
|
|
5
|
-
|
|
6
|
-
/** The durable working state as a short markdown block, for compaction resync and the like. */
|
|
7
|
-
export function renderStateBlock(state: DevsysState): string {
|
|
8
|
-
const departures = state.openDepartures.map(
|
|
9
|
-
(d) => ` - ${d.gate} — ${d.chosen.replace(/\s+/g, " ")}`,
|
|
10
|
-
);
|
|
11
|
-
const shown =
|
|
12
|
-
departures.length <= MAX_DEPARTURES
|
|
13
|
-
? departures
|
|
14
|
-
: [
|
|
15
|
-
...departures.slice(0, MAX_DEPARTURES - 1),
|
|
16
|
-
` - …and ${departures.length - MAX_DEPARTURES + 1} more`,
|
|
17
|
-
];
|
|
18
|
-
const run = state.lastTestRun;
|
|
19
|
-
return [
|
|
20
|
-
"## Development System State",
|
|
21
|
-
`- phase: ${state.phase}`,
|
|
22
|
-
`- sizing: ${state.sizing ?? "unset"}`,
|
|
23
|
-
`- slice: ${state.activeSlice ?? "none"}`,
|
|
24
|
-
`- open departures: ${state.openDepartures.length === 0 ? "none" : state.openDepartures.length}`,
|
|
25
|
-
...shown,
|
|
26
|
-
`- ${activeReview(state) ?? "review: none"}`,
|
|
27
|
-
`- last test run: ${run === undefined ? "none" : `exit ${run.exitCode} — ${run.summary}`}`,
|
|
28
|
-
`- last push: ${state.lastPushAt ?? "none"}`,
|
|
29
|
-
].join("\n");
|
|
30
|
-
}
|