@kolohelios/dipping-bird 0.1.3 → 0.1.5

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 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
- Compaction preserves the current supervision window.
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
- and checkpoint summaries/references as custom entries in Pi's session history.
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
 
@@ -79,7 +93,9 @@ just compat
79
93
  ```
80
94
 
81
95
  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 without model requests.
96
+ loader/package smoke tests use the real pinned Pi SDK. Reload regressions run
97
+ real SDK sessions with isolated credentials and a stub provider, without model
98
+ requests.
83
99
  The coverage gate measures all extension source, including unimported files.
84
100
  `just build` packs the release into `dist/`, installs it offline without peer or
85
101
  dev dependencies, and verifies its manifest, contents, and Pi discovery. Only
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
 
@@ -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";
@@ -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
- if (state) {
171
- const next = state;
172
- const initialPrompt = `[BIRD START ${randomUUID()}]\n${prompt(next)}`;
173
- save(ctx, pause(next, "Awaiting initial run; Bird remains paused."));
174
- pendingStart = { state: next, prompt: initialPrompt, ready: false };
175
- issuedStarts.add(initialPrompt);
176
- try {
177
- pi.sendUserMessage(initialPrompt);
178
- } catch {
179
- issuedStarts.delete(initialPrompt);
180
- pendingStart = undefined;
181
- save(ctx, pause(next, "Initial prompt could not be queued."));
182
- ctx.ui.notify(
183
- "Bird paused: initial prompt could not be queued.",
184
- "warning",
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" && issuedStarts.delete(event.prompt);
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",
3
+ "version": "0.1.5",
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",
@@ -45,7 +45,7 @@
45
45
  "@types/node": "26.6.6",
46
46
  "c8": "9.1.0",
47
47
  "eslint": "10.15.0",
48
- "globals": "17.4.0",
48
+ "globals": "17.14.0",
49
49
  "prettier": "3.10.1",
50
50
  "typebox": "1.4.7",
51
51
  "typescript": "6.0.3",
@@ -82,5 +82,5 @@
82
82
  "json-summary"
83
83
  ]
84
84
  },
85
- "x-release-commit": "bea6280a9e6a15332d1ef7f2d9b84c102c5fbbdd"
85
+ "x-release-commit": "dd071ce369ff8b5112e82cdd6bf7606e488f737b"
86
86
  }