pi-onlyne 0.8.1 → 0.9.1

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/README.md CHANGED
@@ -189,7 +189,7 @@ The extension also supports `.onlyne/channels/loopback/in` when FIFO IO is enabl
189
189
 
190
190
  ## Swarm mode
191
191
 
192
- Swarm mode lets `onlyne-swarm >= 0.5.0` own task routing for a generated agent workspace. `pi-onlyne 0.8.1` uses the scheduler's `delivery: scheduler` header for task claims, so these versions upgrade together. Enable it in `.onlyne/config.toml`:
192
+ Swarm mode lets `onlyne-swarm >= 0.5.0` own task routing for a generated agent workspace. `pi-onlyne 0.9.1` uses the scheduler's `delivery: scheduler` header for task claims and binds a scheduler-created pane to its `ONLYNE_SWARM_TASK`, so these versions upgrade together. Enable it in `.onlyne/config.toml`:
193
193
 
194
194
  ```toml
195
195
  [swarm]
package/SPEC.md CHANGED
@@ -93,7 +93,18 @@ One session sees one toolset. The surface is chosen at `session_start` from
93
93
  - Startup handshake: swarm watch sends the `swarm_ready` op
94
94
  (`{workspace, terminal_handle}`) so the scheduler can match a pending task.
95
95
  `ONLYNE_SWARM_TASK` env and `ORCA_TERMINAL_HANDLE`/`ONLYNE_TERMINAL_HANDLE`
96
- provide fallback correlation.
96
+ provide fallback correlation. **`ONLYNE_SWARM_TASK` is a hard binding:** a
97
+ newly created terminal may replay history only for that exact task id. If
98
+ its FIFO delivery has not reached history yet, the session waits for the
99
+ live inbound event; it never claims a newest/old workspace-local task.
100
+ Sessions with no env task (manual ready pool) retain newest-unclosed
101
+ fallback replay.
102
+ - Hop activity (v0.9.1, R4): `agent_start` with a live claimed task sends
103
+ `swarm_busy` (`{workspace, terminal_handle, task_id}`); `agent_end` with
104
+ the turn ended and no out sends `swarm_idle` (same fields plus
105
+ `pending_exit`, mirroring whether the hop still awaits `swarm_complete`).
106
+ Both are fire-and-forget over the existing swarm event channel; the
107
+ scheduler treats missing rows as race residue and drives its own TTLs.
97
108
  - Tools: `swarm_complete({text})` writes the out message carrying this hop's
98
109
  header (the scheduler's done signal). Scheduler sends a `---swarm-ctl`
99
110
  recycle wire; pi-onlyne intercepts it, sends `swarm_recycled`, stops the
package/dist/index.d.ts CHANGED
@@ -1,2 +1,27 @@
1
1
  import { type ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import { type Workspace } from "./workspace.js";
3
+ import { type SwarmReportKind } from "./swarm.js";
4
+ import { type StateContext } from "./session.js";
5
+ /** Swarm task slot: one session carries exactly one hop. No waiting, no callbacks. */
6
+ interface SwarmTask {
7
+ taskId: string;
8
+ from: string;
9
+ transferSendTo: string;
10
+ attempt: number;
11
+ }
2
12
  export default function onlyne(pi: ExtensionAPI): void;
13
+ /** Test seam: drive the lifecycle-report wiring against a stub daemon socket.
14
+ * No live pi session and no real daemon are involved; the seam exposes the
15
+ * same closures the hooks call. Mirrors `__swarmSlotForTest`. */
16
+ export declare function __swarmReportForTest(): {
17
+ setWorkspace: (ws: Workspace | null) => void;
18
+ beginSession: (appendEntry: StateContext["appendEntry"], taskId: string) => {
19
+ generation: number;
20
+ seq: number;
21
+ };
22
+ setTask: (task?: SwarmTask) => void;
23
+ reportTaskId: () => string | null;
24
+ emit: (kind: SwarmReportKind) => Promise<boolean>;
25
+ beat: () => void;
26
+ };
27
+ export {};