@kolohelios/dipping-bird 0.1.4 → 0.1.6
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 +7 -0
- package/README.md +23 -3
- package/architecture-decision-record.md +14 -0
- package/architecture.md +4 -0
- package/extensions/core.ts +16 -0
- package/extensions/index.ts +38 -30
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
- Keep canceled or reload-paused startups rejected when delayed preflight
|
|
6
|
+
finishes in a replacement extension runtime.
|
|
7
|
+
- Persist exact issued/consumed startup receipts without claiming unrelated
|
|
8
|
+
pasted markers or later manual copies of consumed prompts.
|
|
9
|
+
|
|
3
10
|
## [0.1.0]
|
|
4
11
|
|
|
5
12
|
- Prepare the jj-only continuation extension as a portable Pi package.
|
package/README.md
CHANGED
|
@@ -30,6 +30,9 @@ In Pi:
|
|
|
30
30
|
resumes the saved goal with the **remaining original limits**. Supplying a new
|
|
31
31
|
goal explicitly starts a new supervision window, not a new permission grant.
|
|
32
32
|
|
|
33
|
+
When upgrading from `0.1.4` or earlier, quit Pi before updating and start a new
|
|
34
|
+
process afterward. Old in-flight startups have no receipts to recover on reload.
|
|
35
|
+
|
|
33
36
|
## Limits and safety
|
|
34
37
|
|
|
35
38
|
- At most **60 automatic continuations** or **two elapsed hours**, checked
|
|
@@ -41,7 +44,8 @@ goal explicitly starts a new supervision window, not a new permission grant.
|
|
|
41
44
|
start still waiting for jj; Pi's idle Escape handling does not cancel commands.
|
|
42
45
|
Plain `stop` or `pause` input also pauses Bird.
|
|
43
46
|
- Reload, resume, fork, and tree navigation restore saved state **paused**.
|
|
44
|
-
|
|
47
|
+
Issued-start receipts reject exact canceled prompts when delayed preflight
|
|
48
|
+
finishes after reload completes. Compaction preserves the current window.
|
|
45
49
|
- `bird_checkpoint` lets the model report `continue`, `blocked`, `pause`, or
|
|
46
50
|
`complete`. Completion requires evidence references and means **completion
|
|
47
51
|
reported for review**, not independent certification.
|
|
@@ -53,11 +57,21 @@ credential, deployment, or publication authority. Existing approval gates remain
|
|
|
53
57
|
in force. The continuation prompt also forbids Git use, creating changes/commits/
|
|
54
58
|
workspaces/PRs, and spawning helper agents while Bird supervises the task.
|
|
55
59
|
|
|
60
|
+
## Known SDK limitations
|
|
61
|
+
|
|
62
|
+
This is a partial cancellation fix for Pi 1.5.2. Preflight completing during
|
|
63
|
+
resource replacement, or input extensions transforming startup text, can still
|
|
64
|
+
let canceled work reach the model. An old preflight can also abort a newer
|
|
65
|
+
manual run because the SDK's abort is session-wide. Restart Pi to cancel a stuck
|
|
66
|
+
preflight rather than relying on reload. Host-level cancellation fixes remain
|
|
67
|
+
necessary before this change is ready for release.
|
|
68
|
+
|
|
56
69
|
## Privacy
|
|
57
70
|
|
|
58
71
|
Bird makes no direct network/model calls, reads no credentials, and starts no
|
|
59
72
|
background services or timers. It stores its goal, workspace/change pin, limits,
|
|
60
|
-
|
|
73
|
+
checkpoint summaries/references, and issued/consumed startup prompts as custom
|
|
74
|
+
entries in Pi's session history.
|
|
61
75
|
Do not put secrets or raw sensitive output in goals or checkpoints. Control
|
|
62
76
|
characters are normalized; that is **not** secret redaction.
|
|
63
77
|
|
|
@@ -78,8 +92,14 @@ just validate
|
|
|
78
92
|
just compat
|
|
79
93
|
```
|
|
80
94
|
|
|
95
|
+
`just typecheck` uses TypeScript 7 through the `typescript-compiler` alias.
|
|
96
|
+
ESLint retains TypeScript 6 for its supported JavaScript parser API. Use the
|
|
97
|
+
recipe rather than a bare `tsc`, whose npm bin link can be ambiguous.
|
|
98
|
+
|
|
81
99
|
Tests use Node's test runner. Core/state and lifecycle tests use a fake Pi host;
|
|
82
|
-
loader/package smoke tests use the real pinned Pi SDK
|
|
100
|
+
loader/package smoke tests use the real pinned Pi SDK. Reload regressions run
|
|
101
|
+
real SDK sessions with isolated credentials and a stub provider, without model
|
|
102
|
+
requests.
|
|
83
103
|
The coverage gate measures all extension source, including unimported files.
|
|
84
104
|
`just build` packs the release into `dist/`, installs it offline without peer or
|
|
85
105
|
dev dependencies, and verifies its manifest, contents, and Pi discovery. Only
|
|
@@ -35,6 +35,20 @@ completion as a report for review, and restores paused state. It does not inspec
|
|
|
35
35
|
evidence artifacts or implement a tool permission gate. Stronger enforcement
|
|
36
36
|
would require a separate design and cannot be implied by installation.
|
|
37
37
|
|
|
38
|
+
## Separate TypeScript's compiler from ESLint's parser runtime
|
|
39
|
+
|
|
40
|
+
Use TypeScript 7 via the pinned `typescript-compiler` npm alias for typechecking.
|
|
41
|
+
Keep `typescript` at 6.0.3 to satisfy typescript-eslint's supported peer range
|
|
42
|
+
and provide the JavaScript compiler API its parser uses. A direct upgrade of
|
|
43
|
+
`typescript` to 7 fails `npm ci` because typescript-eslint 8.x currently requires
|
|
44
|
+
TypeScript below 6.1. Do not bypass this with forced or legacy peer resolution.
|
|
45
|
+
|
|
46
|
+
`just typecheck` invokes the aliased compiler entry point explicitly, avoiding
|
|
47
|
+
ambiguous `tsc` bin links when both versions are installed. Toolchain tests check
|
|
48
|
+
both the real compiler version and ESLint's resolution/parsing. Both packages
|
|
49
|
+
are development-only; neither is shipped in the extension tarball. Remove this
|
|
50
|
+
split once typescript-eslint supports the TypeScript 7 package/API.
|
|
51
|
+
|
|
38
52
|
## Use Shaka's real gates without pretending it builds TypeScript
|
|
39
53
|
|
|
40
54
|
The pinned Shaka binary provides repository preflight and whitespace checks.
|
package/architecture.md
CHANGED
|
@@ -39,6 +39,10 @@ armed window. Checkpoints are session data, not independent proof.
|
|
|
39
39
|
A start queues a nonce-bearing user prompt while Bird remains paused. Only the
|
|
40
40
|
exact prompt with a verified pin and remaining budget can arm at `agent_start`.
|
|
41
41
|
Stop, lifecycle replacement, and final settlement invalidate pending lookups.
|
|
42
|
+
`dipping-bird-start-v1` entries record each exact issued prompt and its consumption.
|
|
43
|
+
The active branch retains these receipts across extension reloads, unlike a
|
|
44
|
+
factory-local set. A receipt can reject a delayed prompt but cannot arm Bird.
|
|
45
|
+
Once consumed, it no longer claims a later manual copy of that prompt.
|
|
42
46
|
`agent_before_settle` appends its proposal after earlier extensions' entries;
|
|
43
47
|
it does not duplicate work when another continuation or message is pending.
|
|
44
48
|
|
package/extensions/core.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
export const MAX_CONTINUATIONS = 60;
|
|
2
2
|
export const MAX_ELAPSED_MS = 2 * 60 * 60 * 1000;
|
|
3
3
|
export const STATE_KEY = "dipping-bird-v1";
|
|
4
|
+
export const START_KEY = "dipping-bird-start-v1";
|
|
5
|
+
|
|
6
|
+
export type StartReceipt = Readonly<{ prompt: string; consumed: boolean }>;
|
|
7
|
+
|
|
8
|
+
export function readStartReceipt(raw: unknown): StartReceipt | undefined {
|
|
9
|
+
if (
|
|
10
|
+
typeof raw !== "object" ||
|
|
11
|
+
raw === null ||
|
|
12
|
+
!("prompt" in raw) ||
|
|
13
|
+
typeof raw.prompt !== "string" ||
|
|
14
|
+
!("consumed" in raw) ||
|
|
15
|
+
typeof raw.consumed !== "boolean"
|
|
16
|
+
)
|
|
17
|
+
return undefined;
|
|
18
|
+
return { prompt: raw.prompt, consumed: raw.consumed };
|
|
19
|
+
}
|
|
4
20
|
|
|
5
21
|
export type Mode = "running" | "paused" | "blocked" | "review";
|
|
6
22
|
export type Verdict = "continue" | "blocked" | "complete" | "pause";
|
package/extensions/index.ts
CHANGED
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
MAX_ELAPSED_MS,
|
|
14
14
|
pause,
|
|
15
15
|
prompt,
|
|
16
|
+
readStartReceipt,
|
|
16
17
|
restore,
|
|
17
18
|
start,
|
|
19
|
+
START_KEY,
|
|
18
20
|
STATE_KEY,
|
|
19
21
|
type State,
|
|
20
22
|
} from "./core.ts";
|
|
@@ -25,7 +27,6 @@ const DEFAULT_GOAL =
|
|
|
25
27
|
export default function dippingBird(pi: ExtensionAPI): void {
|
|
26
28
|
let state: State | undefined;
|
|
27
29
|
let revision = 0;
|
|
28
|
-
const issuedStarts = new Set<string>();
|
|
29
30
|
let pendingStart:
|
|
30
31
|
{ state: State; prompt: string; ready: boolean } | undefined;
|
|
31
32
|
|
|
@@ -43,6 +44,19 @@ export default function dippingBird(pi: ExtensionAPI): void {
|
|
|
43
44
|
pi.appendEntry(STATE_KEY, next);
|
|
44
45
|
show(ctx);
|
|
45
46
|
};
|
|
47
|
+
const consumeStart = (ctx: ExtensionContext, text: string): boolean => {
|
|
48
|
+
const receipt = ctx.sessionManager
|
|
49
|
+
.getBranch()
|
|
50
|
+
.flatMap((entry) =>
|
|
51
|
+
entry.type === "custom" && entry.customType === START_KEY
|
|
52
|
+
? [readStartReceipt(entry.data)]
|
|
53
|
+
: [],
|
|
54
|
+
)
|
|
55
|
+
.findLast((entry) => entry?.prompt === text);
|
|
56
|
+
if (receipt?.consumed !== false) return false;
|
|
57
|
+
pi.appendEntry(START_KEY, { prompt: text, consumed: true });
|
|
58
|
+
return true;
|
|
59
|
+
};
|
|
46
60
|
const identity = async (
|
|
47
61
|
ctx: ExtensionContext,
|
|
48
62
|
): Promise<{ cwd: string; change: string }> => {
|
|
@@ -155,35 +169,29 @@ export default function dippingBird(pi: ExtensionAPI): void {
|
|
|
155
169
|
);
|
|
156
170
|
return;
|
|
157
171
|
}
|
|
158
|
-
save(ctx, {
|
|
159
|
-
...state,
|
|
160
|
-
mode: "running",
|
|
161
|
-
summary:
|
|
162
|
-
"Resumed explicitly with remaining limits; no permissions renewed.",
|
|
163
|
-
});
|
|
164
|
-
} else {
|
|
165
|
-
save(
|
|
166
|
-
ctx,
|
|
167
|
-
start(goal || DEFAULT_GOAL, pin.cwd, pin.change, Date.now()),
|
|
168
|
-
);
|
|
169
172
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
173
|
+
const next: State =
|
|
174
|
+
state && !goal
|
|
175
|
+
? {
|
|
176
|
+
...state,
|
|
177
|
+
mode: "running",
|
|
178
|
+
summary:
|
|
179
|
+
"Resumed explicitly with remaining limits; no permissions renewed.",
|
|
180
|
+
}
|
|
181
|
+
: start(goal || DEFAULT_GOAL, pin.cwd, pin.change, Date.now());
|
|
182
|
+
const initialPrompt = `[BIRD START ${randomUUID()}]\n${prompt(next)}`;
|
|
183
|
+
save(ctx, pause(next, "Awaiting initial run; Bird remains paused."));
|
|
184
|
+
pi.appendEntry(START_KEY, { prompt: initialPrompt, consumed: false });
|
|
185
|
+
pendingStart = { state: next, prompt: initialPrompt, ready: false };
|
|
186
|
+
try {
|
|
187
|
+
pi.sendUserMessage(initialPrompt);
|
|
188
|
+
} catch {
|
|
189
|
+
pendingStart = undefined;
|
|
190
|
+
save(ctx, pause(next, "Initial prompt could not be queued."));
|
|
191
|
+
ctx.ui.notify(
|
|
192
|
+
"Bird paused: initial prompt could not be queued.",
|
|
193
|
+
"warning",
|
|
194
|
+
);
|
|
187
195
|
}
|
|
188
196
|
} catch {
|
|
189
197
|
if (revision !== ticket) return;
|
|
@@ -283,7 +291,7 @@ export default function dippingBird(pi: ExtensionAPI): void {
|
|
|
283
291
|
});
|
|
284
292
|
pi.on("before_agent_start", async (event, ctx) => {
|
|
285
293
|
const birdStart =
|
|
286
|
-
event.messageType === "user" &&
|
|
294
|
+
event.messageType === "user" && consumeStart(ctx, event.prompt);
|
|
287
295
|
const pending = pendingStart;
|
|
288
296
|
if (pending) {
|
|
289
297
|
pendingStart = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolohelios/dipping-bird",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Opt-in, bounded, evidence-driven continuation for the Pi coding agent (jj workspaces).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT OR Apache-2.0",
|
|
@@ -49,11 +49,12 @@
|
|
|
49
49
|
"prettier": "3.10.1",
|
|
50
50
|
"typebox": "1.4.7",
|
|
51
51
|
"typescript": "6.0.3",
|
|
52
|
+
"typescript-compiler": "npm:typescript@7.0.2",
|
|
52
53
|
"typescript-eslint": "8.73.0",
|
|
53
54
|
"yaml": "2.9.1"
|
|
54
55
|
},
|
|
55
56
|
"scripts": {
|
|
56
|
-
"typecheck": "tsc --noEmit",
|
|
57
|
+
"typecheck": "node node_modules/typescript-compiler/bin/tsc --noEmit",
|
|
57
58
|
"lint": "eslint extensions scripts test",
|
|
58
59
|
"format:check": "prettier --check .",
|
|
59
60
|
"format": "prettier --write .",
|
|
@@ -82,5 +83,5 @@
|
|
|
82
83
|
"json-summary"
|
|
83
84
|
]
|
|
84
85
|
},
|
|
85
|
-
"x-release-commit": "
|
|
86
|
+
"x-release-commit": "ceffdf4b03d0e860caf3f8d3916670c047619b9c"
|
|
86
87
|
}
|