@pasko70/pibo 3.1.3 → 3.2.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.
Files changed (48) hide show
  1. package/README.md +2 -2
  2. package/dist/apps/chat/data/timeline-query-service.js +5 -2
  3. package/dist/apps/chat/output-compactor.js +33 -30
  4. package/dist/apps/chat/trace-v2.js +1 -0
  5. package/dist/apps/chat/trace.js +3 -1
  6. package/dist/apps/chat/web-app.js +106 -65
  7. package/dist/apps/chat-ui/assets/{dist-CoA9zNTP.js → dist-BAXv9edD.js} +1 -1
  8. package/dist/apps/chat-ui/assets/{dist-BNzch-mL.js → dist-CiwafO2k.js} +1 -1
  9. package/dist/apps/chat-ui/assets/{dist-DDRlEGPR.js → dist-DD2HRAgt.js} +1 -1
  10. package/dist/apps/chat-ui/assets/{dist-liw1S7HS.js → dist-NsHPx2KS.js} +1 -1
  11. package/dist/apps/chat-ui/assets/{dist-7DhHpLCA.js → dist-jgYATWSF.js} +1 -1
  12. package/dist/apps/chat-ui/assets/index-BTzIdlcK.css +1 -0
  13. package/dist/apps/chat-ui/assets/index-C-s68zrN.js +228 -0
  14. package/dist/apps/chat-ui/index.html +2 -2
  15. package/dist/apps/chat-vscode-web/assets/{index-SluZr_-r.css → index-b18ZkEo0.css} +1 -1
  16. package/dist/apps/chat-vscode-web/assets/index-nHYofa-e.js +43 -0
  17. package/dist/apps/chat-vscode-web/index.html +2 -2
  18. package/dist/cli-session/localSessionSource.js +26 -20
  19. package/dist/core/output-persistence-retry.js +23 -1
  20. package/dist/core/output-render-sequence.js +33 -9
  21. package/dist/data/ingest-service.js +8 -0
  22. package/dist/debug/index.js +294 -2
  23. package/dist/debug/output-integrity.js +608 -0
  24. package/dist/debug/output-repair.js +584 -0
  25. package/dist/debug/trace.js +2 -0
  26. package/dist/reliability/store.js +2 -2
  27. package/dist/sessions/pibo-data-store.js +26 -20
  28. package/dist/setup/cli.js +5 -5
  29. package/dist/shared/trace-engine.js +5 -2
  30. package/dist/shared/trace-event-projection.js +74 -0
  31. package/dist/shared/trace-page-merge.js +31 -5
  32. package/docs/project/guides/pibo-on-windows-via-wsl.md +292 -0
  33. package/docs/project/guides/pibo-vscode-ext-quickstart.md +287 -0
  34. package/docs/project/installation-profiles.md +134 -0
  35. package/docs/project/operations/index.md +10 -0
  36. package/docs/{ops → project/operations}/install-developer-host.md +19 -0
  37. package/docs/{ops → project/operations}/install-user-host.md +19 -0
  38. package/docs/{ops → project/operations}/upgrade-user-to-developer-host.md +19 -0
  39. package/docs/{ops → project/operations}/vscode-extension-release.md +19 -0
  40. package/npm-shrinkwrap.json +4 -3
  41. package/package.json +17 -3
  42. package/skills/builtin/pibo-agent-runtime-adapter/references/testing-migration-and-validation.md +3 -1
  43. package/skills/builtin/pibo-spec-writing/SKILL.md +110 -168
  44. package/skills/builtin/prd/SKILL.md +18 -0
  45. package/dist/apps/chat-ui/assets/index-BKp6zKIe.js +0 -228
  46. package/dist/apps/chat-ui/assets/index-CmqRSbBU.css +0 -1
  47. package/dist/apps/chat-vscode-web/assets/index-CKC-46jZ.js +0 -43
  48. package/docs/README.md +0 -34
@@ -150,7 +150,7 @@ export class PiboDataSessionStore {
150
150
  claimOrAttachOutputPart(input) {
151
151
  return this.dataStore.transaction(() => {
152
152
  const indexAttribute = outputPartIndexAttribute(input.kind);
153
- const eventTypes = outputPartEventTypes(input.kind);
153
+ const eventTypes = [...outputPartEventTypes(input.kind), "message_finished"];
154
154
  const placeholders = eventTypes.map(() => "?").join(", ");
155
155
  const rows = this.db.prepare(`
156
156
  SELECT type, attributes_json
@@ -159,26 +159,33 @@ export class PiboDataSessionStore {
159
159
  ORDER BY stream_id ASC
160
160
  `).all(input.piboSessionId, input.eventId, ...eventTypes);
161
161
  let maximum = -1;
162
- const latestTypeByIndex = new Map();
162
+ let turnCompleted = false;
163
+ const persistedParts = [];
163
164
  for (const row of rows) {
165
+ if (row.type === "message_finished") {
166
+ turnCompleted = true;
167
+ continue;
168
+ }
164
169
  const attributes = parseJsonObject(row.attributes_json);
165
170
  const index = attributes[indexAttribute];
166
171
  if (typeof index !== "number" || !Number.isSafeInteger(index) || index < 0)
167
172
  continue;
168
173
  maximum = Math.max(maximum, index);
169
- if (attributes.outputPartFingerprint === input.fingerprint
170
- || attributes.identityFingerprint === input.identityFingerprint) {
171
- this.observeOutputPartIndex(input, index);
172
- return index;
173
- }
174
- latestTypeByIndex.set(index, row.type);
174
+ persistedParts.push({ index, attributes });
175
175
  }
176
- const latestOpen = [...latestTypeByIndex.entries()]
177
- .filter(([, eventType]) => !outputPartEventIsTerminal(eventType))
178
- .sort(([left], [right]) => right - left)[0]?.[0];
179
- if (latestOpen !== undefined) {
180
- this.observeOutputPartIndex(input, latestOpen);
181
- return latestOpen;
176
+ // An unfinished durable part may still belong to another process. Only a
177
+ // completed turn provides enough evidence to reattach an exact replay.
178
+ if (turnCompleted) {
179
+ const matchesReplay = ({ attributes }) => attributes.outputPartFingerprint === input.fingerprint
180
+ || attributes.identityFingerprint === input.identityFingerprint;
181
+ const replay = (input.suppliedIndex === undefined
182
+ ? undefined
183
+ : persistedParts.find((part) => part.index === input.suppliedIndex && matchesReplay(part)))
184
+ ?? persistedParts.find(matchesReplay);
185
+ if (replay) {
186
+ this.observeOutputPartIndex(input, replay.index);
187
+ return replay.index;
188
+ }
182
189
  }
183
190
  const minimum = Math.max(input.proposedIndex, maximum + 1);
184
191
  const row = this.db.prepare(`
@@ -193,6 +200,11 @@ export class PiboDataSessionStore {
193
200
  return row.part_index;
194
201
  });
195
202
  }
203
+ observeOutputPart(input) {
204
+ this.dataStore.transaction(() => {
205
+ this.observeOutputPartIndex(input, input.index);
206
+ });
207
+ }
196
208
  observeOutputPartIndex(input, index) {
197
209
  this.db.prepare(`
198
210
  INSERT INTO session_output_part_counters (
@@ -639,12 +651,6 @@ function outputPartEventTypes(kind) {
639
651
  case "compaction": return ["compaction_start", "compaction_end"];
640
652
  }
641
653
  }
642
- function outputPartEventIsTerminal(eventType) {
643
- return eventType === "assistant_message"
644
- || eventType === "thinking_finished"
645
- || eventType === "assistant_usage"
646
- || eventType === "compaction_end";
647
- }
648
654
  function parseJsonObject(json) {
649
655
  if (!json)
650
656
  return {};
package/dist/setup/cli.js CHANGED
@@ -128,7 +128,7 @@ export function createUserHostSetupPlan(options = {}) {
128
128
  if (!options.domain)
129
129
  warnings.push("No production domain was provided; generated Caddy/Auth examples use placeholders.");
130
130
  if (process.platform === "win32" && !isWsl()) {
131
- warnings.push("Pibo host setup targets Linux. Native Windows is not supported. Install WSL2 (https://aka.ms/wsl) and run setup inside the WSL distribution. See docs/guides/pibo-on-windows-via-wsl.md.");
131
+ warnings.push("Pibo host setup targets Linux. Native Windows is not supported. Install WSL2 (https://aka.ms/wsl) and run setup inside the WSL distribution. See docs/project/guides/pibo-on-windows-via-wsl.md.");
132
132
  }
133
133
  const generatedFiles = [
134
134
  {
@@ -201,7 +201,7 @@ export function createDeveloperHostSetupPlan(options = {}) {
201
201
  if (!options.prodDomain || !options.devDomain)
202
202
  warnings.push("Production and dev domains should both be configured before requesting HTTPS certificates.");
203
203
  if (process.platform === "win32" && !isWsl()) {
204
- warnings.push("Pibo developer-host setup targets Linux. Native Windows is not supported. Install WSL2 (https://aka.ms/wsl) and run setup inside the WSL distribution. See docs/guides/pibo-on-windows-via-wsl.md.");
204
+ warnings.push("Pibo developer-host setup targets Linux. Native Windows is not supported. Install WSL2 (https://aka.ms/wsl) and run setup inside the WSL distribution. See docs/project/guides/pibo-on-windows-via-wsl.md.");
205
205
  }
206
206
  const generatedFiles = [
207
207
  {
@@ -496,13 +496,13 @@ async function createDoctorStatus(options) {
496
496
  if (wslInfo.isWsl) {
497
497
  const versionLabel = wslInfo.version ? `WSL${wslInfo.version}` : "WSL";
498
498
  const distroLabel = wslInfo.distro ? ` (${wslInfo.distro})` : "";
499
- checks.push({ name: "platform.wsl", status: "ok", detail: `Running inside ${versionLabel}${distroLabel}; Pibo is fully supported here. See docs/guides/pibo-on-windows-via-wsl.md.` });
499
+ checks.push({ name: "platform.wsl", status: "ok", detail: `Running inside ${versionLabel}${distroLabel}; Pibo is fully supported here. See docs/project/guides/pibo-on-windows-via-wsl.md.` });
500
500
  }
501
501
  else if (process.platform === "win32") {
502
502
  checks.push({
503
503
  name: "platform.wsl",
504
504
  status: "fail",
505
- detail: "Native Windows is not supported. Install WSL2 (https://aka.ms/wsl) and run Pibo inside the WSL distribution. See docs/guides/pibo-on-windows-via-wsl.md.",
505
+ detail: "Native Windows is not supported. Install WSL2 (https://aka.ms/wsl) and run Pibo inside the WSL distribution. See docs/project/guides/pibo-on-windows-via-wsl.md.",
506
506
  });
507
507
  }
508
508
  checks.push(...swapCheck(options.minSwapGb));
@@ -610,7 +610,7 @@ async function createDoctorStatus(options) {
610
610
  recommendations.push("Browser-Use and Agent-Browser work directly under WSLg on Windows 11. On Windows 10, install an X server (e.g. VcXsrv) and export DISPLAY=:0 inside WSL.");
611
611
  }
612
612
  else if (process.platform === "win32") {
613
- recommendations.push("Pibo does not run natively on Windows. Install WSL2 with `wsl --install` and follow docs/guides/pibo-on-windows-via-wsl.md.");
613
+ recommendations.push("Pibo does not run natively on Windows. Install WSL2 with `wsl --install` and follow docs/project/guides/pibo-on-windows-via-wsl.md.");
614
614
  }
615
615
  return {
616
616
  node: process.versions.node,
@@ -1,5 +1,5 @@
1
1
  import { reconcileAsyncAgentRunStatuses } from "./trace-async-agent-runs.js";
2
- import { applySingleEventToNodes, dedupeTraceEvents, findOpenTranscriptEventIds, latestTraceStreamId, mergeMessageTurnTimings, messageTurnTimingsFromEvents, reconcileTranscriptUserMessages, } from "./trace-event-projection.js";
2
+ import { applySingleEventToNodes, dedupeTraceEvents, findOpenTranscriptEventIds, latestTraceStreamId, markIncompletePersistedTurns, mergeMessageTurnTimings, messageTurnTimingsFromEvents, reconcileTranscriptUserMessages, } from "./trace-event-projection.js";
3
3
  import { flattenTraceNodes, mapTraceNodesById, nestTraceNodes } from "./trace-nodes.js";
4
4
  import { mapTraceChildSessionsByParent, mapTraceSubagentSessionLinks, } from "./trace-subagent-links.js";
5
5
  import { projectHistoryEntries, traceNodesFromHistoryEntries } from "./trace-history.js";
@@ -18,7 +18,8 @@ export function buildTraceViewFromEvents(input) {
18
18
  const openHistoryEventIds = findOpenTranscriptEventIds(events, sessionStatus);
19
19
  const suppliedTurnTimings = input.turnTimings ?? [];
20
20
  const eventTurnTimings = messageTurnTimingsFromEvents(events);
21
- const timingOverflow = suppliedTurnTimings.length + eventTurnTimings.length > TRACE_RECONCILIATION_TIMING_CAP;
21
+ const timingOverflow = input.turnTimingOverflow === true
22
+ || suppliedTurnTimings.length + eventTurnTimings.length > TRACE_RECONCILIATION_TIMING_CAP;
22
23
  const turnTimings = timingOverflow
23
24
  ? []
24
25
  : mergeMessageTurnTimings(suppliedTurnTimings, eventTurnTimings);
@@ -42,11 +43,13 @@ export function buildTraceViewFromEvents(input) {
42
43
  for (const storedEvent of events) {
43
44
  applySingleEventToNodes(nodes, byId, input.session.id, storedEvent, childByParent, linkedChildByToolCallId, historyCoverage, openHistoryEventIds, sessionStatus);
44
45
  }
46
+ const hasIncompleteTurns = markIncompletePersistedTurns(nodes, byId, input.session.id, events, turnTimings, sessionStatus);
45
47
  const nestedNodes = nestTraceNodes(nodes);
46
48
  reconcileAsyncAgentRunStatuses(nestedNodes);
47
49
  return {
48
50
  piboSessionId: input.session.id,
49
51
  piSessionId: input.session.piSessionId,
52
+ ...(hasIncompleteTurns ? { integrityStatus: "incomplete" } : {}),
50
53
  title: input.session.title ?? "Untitled Session",
51
54
  version: "",
52
55
  latestStreamId: latestTraceStreamId(events, input.latestStreamId),
@@ -232,6 +232,80 @@ function turnClosedAt(turn, byId) {
232
232
  .at(0);
233
233
  return error?.startedAt;
234
234
  }
235
+ const INCOMPLETE_TURN_SUMMARY = "Incomplete output lifecycle";
236
+ const INCOMPLETE_TURN_ERROR = "Persisted output has message_started but no message_finished or session_error event.";
237
+ export function markIncompletePersistedTurns(nodes, byId, piboSessionId, events, turnTimings, sessionStatus) {
238
+ const lifecycleByEventId = new Map();
239
+ for (const timing of turnTimings) {
240
+ const lifecycle = lifecycleByEventId.get(timing.eventId) ?? { started: false, completed: false };
241
+ lifecycle.started ||= timing.startedAt !== undefined;
242
+ lifecycle.completed ||= timing.completedAt !== undefined;
243
+ lifecycleByEventId.set(timing.eventId, lifecycle);
244
+ }
245
+ const incompleteEventIds = new Set([...lifecycleByEventId].flatMap(([eventId, lifecycle]) => lifecycle.started && !lifecycle.completed ? [eventId] : []));
246
+ if (sessionStatus === "running") {
247
+ const currentTurn = [...turnTimings].reverse().find((timing) => timing.userMessageType !== "message_steered" &&
248
+ timing.startedAt !== undefined);
249
+ if (currentTurn?.startedAt !== undefined && currentTurn.completedAt === undefined) {
250
+ incompleteEventIds.delete(currentTurn.eventId);
251
+ }
252
+ }
253
+ if (incompleteEventIds.size === 0)
254
+ return false;
255
+ const startByEventId = new Map();
256
+ const lastByEventId = new Map();
257
+ for (const storedEvent of events) {
258
+ const event = storedEvent.payload;
259
+ const eventId = "eventId" in event && typeof event.eventId === "string" ? event.eventId : undefined;
260
+ if (!eventId || !incompleteEventIds.has(eventId))
261
+ continue;
262
+ if (event.type === "message_started" && !startByEventId.has(eventId))
263
+ startByEventId.set(eventId, storedEvent);
264
+ lastByEventId.set(eventId, storedEvent);
265
+ }
266
+ for (const eventId of incompleteEventIds) {
267
+ const start = startByEventId.get(eventId);
268
+ if (!start)
269
+ continue;
270
+ const startEvent = start.payload;
271
+ const turnId = messageTurnNodeId(eventId);
272
+ let turn = byId.get(turnId);
273
+ if (!turn) {
274
+ turn = traceNodeFromEvent(piboSessionId, startEvent, new Map(), new Map(), sessionStatus, start.createdAt, start.eventSequence, start.streamId, start.streamFrameIndex, start.traceSource, start.id);
275
+ if (!turn)
276
+ continue;
277
+ nodes.push(turn);
278
+ byId.set(turn.id, turn);
279
+ }
280
+ turn.status = "error";
281
+ turn.summary = INCOMPLETE_TURN_SUMMARY;
282
+ turn.error = INCOMPLETE_TURN_ERROR;
283
+ const markerId = `event:incomplete-turn:${eventId}`;
284
+ if (byId.has(markerId))
285
+ continue;
286
+ const last = lastByEventId.get(eventId) ?? start;
287
+ const marker = {
288
+ id: markerId,
289
+ parentId: turnId,
290
+ piboSessionId,
291
+ eventId,
292
+ type: "error",
293
+ title: "Incomplete Turn",
294
+ status: "error",
295
+ startedAt: last.createdAt,
296
+ summary: INCOMPLETE_TURN_SUMMARY,
297
+ error: INCOMPLETE_TURN_ERROR,
298
+ output: INCOMPLETE_TURN_ERROR,
299
+ source: "event-log",
300
+ stableKey: `incomplete-turn:${eventId}`,
301
+ orderKey: eventTraceNodeOrder(last.eventSequence, "session_error", last.streamId, last.streamFrameIndex, last.traceSource, undefined, last.createdAt),
302
+ children: [],
303
+ };
304
+ nodes.push(marker);
305
+ byId.set(marker.id, marker);
306
+ }
307
+ return [...incompleteEventIds].some((eventId) => byId.has(`event:incomplete-turn:${eventId}`));
308
+ }
235
309
  export function eventsCanAffectAsyncAgentRunStatus(events) {
236
310
  return events.some((event) => {
237
311
  const type = event.payload.type;
@@ -4,10 +4,12 @@ export function mergeOlderTracePage(current, older) {
4
4
  if (current.piboSessionId !== older.piboSessionId)
5
5
  return current;
6
6
  const rawEvents = mergeTraceRawEvents(older.rawEvents, current.rawEvents, false);
7
+ const nodes = mergeTraceNodes(older.nodes, current.nodes);
7
8
  return {
8
9
  ...current,
9
10
  version: current.version,
10
- nodes: mergeTraceNodes(older.nodes, current.nodes),
11
+ integrityStatus: traceIntegrityStatus(nodes) ?? current.integrityStatus ?? older.integrityStatus,
12
+ nodes,
11
13
  rawEvents,
12
14
  beforeCursor: older.beforeCursor ?? current.beforeCursor,
13
15
  firstEventSequence: older.firstEventSequence ?? current.firstEventSequence,
@@ -20,9 +22,11 @@ export function mergeOlderTracePage(current, older) {
20
22
  export function mergeRefreshedTracePage(current, refreshed) {
21
23
  if (current.piboSessionId !== refreshed.piboSessionId)
22
24
  return refreshed;
25
+ const nodes = mergeRefreshedTraceNodes(current.nodes, refreshed);
23
26
  return {
24
27
  ...refreshed,
25
- nodes: mergeRefreshedTraceNodes(current.nodes, refreshed),
28
+ integrityStatus: traceIntegrityStatus(nodes) ?? refreshed.integrityStatus,
29
+ nodes,
26
30
  rawEvents: mergeTraceRawEvents(current.rawEvents, refreshed.rawEvents, true),
27
31
  beforeCursor: current.beforeCursor,
28
32
  firstEventSequence: current.firstEventSequence ?? refreshed.firstEventSequence,
@@ -36,10 +40,13 @@ function mergeRefreshedTraceNodes(currentNodes, refreshed) {
36
40
  const flattenedCurrentNodes = flattenTraceNodes([...currentNodes]);
37
41
  const refreshedNodes = flattenTraceNodes([...refreshed.nodes]);
38
42
  const refreshedIds = new Set(refreshedNodes.map((node) => node.id));
43
+ const refreshedTerminalEventIds = terminalEventIds(refreshedNodes);
39
44
  const canonicalTranscriptEventIds = transcriptEventIds([...flattenedCurrentNodes, ...refreshedNodes]);
40
45
  const refreshedOrderBoundaries = earliestTraceNodeOrdersBySource(refreshedNodes);
41
46
  const refreshedStartedAt = earliestTraceNodeTimestamp(refreshedNodes);
42
47
  const retainedOlderNodes = flattenedCurrentNodes.filter((node) => {
48
+ if (isIncompleteTurnMarker(node) && node.eventId && refreshedTerminalEventIds.has(node.eventId))
49
+ return false;
43
50
  if (refreshedIds.has(node.id))
44
51
  return true;
45
52
  if (node.type === "agent.turn" &&
@@ -71,9 +78,28 @@ function mergeRefreshedTraceNodes(currentNodes, refreshed) {
71
78
  return mergeTraceNodes(clearRemovedParentIds(retainedOlderNodes, removedCurrentIds), clearRemovedParentIds(refreshedNodes, removedCurrentIds));
72
79
  }
73
80
  function clearRemovedParentIds(nodes, removedIds) {
74
- return nodes.map((node) => node.parentId && removedIds.has(node.parentId)
75
- ? { ...node, parentId: undefined }
76
- : node);
81
+ return nodes.map((node) => ({
82
+ ...node,
83
+ ...(node.parentId && removedIds.has(node.parentId) ? { parentId: undefined } : {}),
84
+ children: [],
85
+ }));
86
+ }
87
+ function traceIntegrityStatus(nodes) {
88
+ return flattenTraceNodes([...nodes]).some(isIncompleteTurnMarker) ? "incomplete" : undefined;
89
+ }
90
+ function isIncompleteTurnMarker(node) {
91
+ return node.id.startsWith("event:incomplete-turn:") || node.stableKey?.startsWith("incomplete-turn:") === true;
92
+ }
93
+ function terminalEventIds(nodes) {
94
+ return new Set(nodes.flatMap((node) => {
95
+ if (!node.eventId)
96
+ return [];
97
+ if (node.type === "agent.turn" && node.completedAt)
98
+ return [node.eventId];
99
+ if (node.type === "error" && node.title === "Session Error")
100
+ return [node.eventId];
101
+ return [];
102
+ }));
77
103
  }
78
104
  function transcriptEventIds(nodes) {
79
105
  const eventIds = new Set();
@@ -0,0 +1,292 @@
1
+ ---
2
+ type: "Guide"
3
+ title: "Pibo on Windows via WSL"
4
+ description: "Guides Windows users through installing Pibo and the VS Code extension inside WSL2."
5
+ tags: ["installation", "windows", "wsl", "vscode"]
6
+ status: "draft"
7
+ authority: "directive"
8
+ generated:
9
+ by: "openai/codex"
10
+ at: "2026-08-30T15:47:50Z"
11
+ sources:
12
+ - id: "foundation-relocation-source"
13
+ resource: "https://github.com/Pascapone/pibo/blob/2aef244301f5d181624662fdad53e18e83e80bd9/docs/guides/pibo-on-windows-via-wsl.md"
14
+ title: "Original byte-preserved Pibo on Windows via WSL guide"
15
+ commit: "2aef244301f5d181624662fdad53e18e83e80bd9"
16
+ path: "docs/guides/pibo-on-windows-via-wsl.md"
17
+ sha256: "132f00469edcfa8915525bff4d0c9d82573ae53868a74db81d5224d354ce1d25"
18
+ relation: "Byte-identical body lineage before Foundation relocation."
19
+ ---
20
+ # Pibo on Windows via WSL
21
+
22
+ Pibo is a Linux-first tool. Native Windows is **not** supported, but Pibo runs unmodified inside **WSL2** because WSL2 is a real Linux kernel with full filesystem, symlink, and process semantics. This guide walks a Windows user from a fresh machine to a working `pibo` install, including the Pibo VSCode extension.
23
+
24
+ Total setup time: **15–25 minutes** on Windows 11 with WSLg enabled.
25
+
26
+ ## Why WSL and not native Windows?
27
+
28
+ | | Native Windows | WSL2 |
29
+ |---|---|---|
30
+ | **Code changes** | 12+ POSIX assumptions would need workarounds | 0 — Pibo already runs on Linux |
31
+ | **Docker workers** | Docker Desktop only, paths are awkward | Docker Desktop integrates with WSL2, no friction |
32
+ | **Browser-Use / Agent-Browser** | Need WSL or WSLg anyway | Works directly under WSLg |
33
+ | **`pibo setup` (systemd, caddy)** | Would need a Windows port | Works as on Linux |
34
+ | **Symlinks, file modes, line endings** | Pain | Native |
35
+ | **Long-term maintenance** | Two code paths | One code path |
36
+
37
+ Microsoft itself recommends WSL for Linux-style development on Windows. The VSCode "WSL" extension, Docker Desktop's WSL2 backend, and Windows 11's WSLg GUI integration make WSL a first-class dev environment.
38
+
39
+ ## Prerequisites
40
+
41
+ - **Windows 10 version 2004+** or **Windows 11** (any edition)
42
+ - Administrator access for the WSL install
43
+ - About 5 GB free disk space (WSL image + Pibo + node_modules)
44
+
45
+ ## Step 1 — Install WSL (5 min, one-time)
46
+
47
+ Open **PowerShell as Administrator** and run:
48
+
49
+ ```powershell
50
+ wsl --install
51
+ ```
52
+
53
+ Default settings install Ubuntu. Reboot when prompted. On first boot, Ubuntu sets a username and password.
54
+
55
+ Verify the install:
56
+
57
+ ```powershell
58
+ wsl --status
59
+ # Default Distribution: Ubuntu
60
+ # Default Version: 2
61
+ ```
62
+
63
+ > **Tip:** If you want a different distro (Debian, openSUSE, Alpine…), run `wsl --install -d <DistroName>`. The rest of this guide works for any of them.
64
+
65
+ ## Step 2 — Verify the WSL version (1 min)
66
+
67
+ Inside the WSL shell (run `wsl` in PowerShell to enter it), confirm WSL2:
68
+
69
+ ```bash
70
+ cat /proc/sys/kernel/osrelease
71
+ # Look for "microsoft-standard-WSL2" or "WSL2" in the output.
72
+ ```
73
+
74
+ If you see "Microsoft" without the WSL2 marker, your distro is on WSL1. Convert it:
75
+
76
+ ```powershell
77
+ # PowerShell
78
+ wsl --set-version Ubuntu 2
79
+ ```
80
+
81
+ WSL1 cannot run Docker well and lacks the full Linux kernel Pibo expects. Use WSL2.
82
+
83
+ ## Step 3 — Install Node.js 24+ inside WSL (3 min)
84
+
85
+ The Ubuntu default Node is often too old. Use NodeSource:
86
+
87
+ ```bash
88
+ # Inside WSL
89
+ sudo apt update
90
+ sudo apt install -y ca-certificates curl gnupg
91
+ curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
92
+ sudo apt install -y nodejs build-essential
93
+ node --version # must print v24.x.x or higher
94
+ npm --version
95
+ ```
96
+
97
+ ## Step 4 — Install Pibo inside WSL (1 min)
98
+
99
+ ```bash
100
+ # Inside WSL
101
+ npm install -g @pasko70/pibo
102
+ pibo --version
103
+ ```
104
+
105
+ Pibo's data lives in `~/.pibo` inside the WSL filesystem. This is intentional: WSL-native paths are fast, while `/mnt/c/...` mounts are slow. Keep Pibo's working data inside WSL.
106
+
107
+ ## Step 5 — Install VSCode and the WSL extension (3 min)
108
+
109
+ 1. Install **VSCode for Windows** from <https://code.visualstudio.com/> (the standard Windows .exe, not the .deb).
110
+ 2. In VSCode, open the **Extensions** panel (Ctrl+Shift+X) and install **WSL** by Microsoft.
111
+ 3. **Open your project folder inside WSL.** In the WSL terminal:
112
+ ```bash
113
+ cd ~/projects/my-app # or wherever your project lives
114
+ code .
115
+ ```
116
+ VSCode opens a second VSCode window. Title bar shows the distro name in green (`[WSL: Ubuntu]`). File editing, terminal, and extensions all run inside WSL.
117
+
118
+ > **Why this step matters:** when you run `code .` from inside WSL, VSCode installs its Linux server binary inside the WSL distro, the integrated terminal becomes a WSL bash, and `code` is added to WSL's `PATH`. That is what makes `pibo vscode install` work seamlessly.
119
+
120
+ ## Step 6 — Configure Pibo auth (3 min)
121
+
122
+ Pibo uses [Better Auth](https://www.better-auth.com/) with Google OAuth. Set the keys once:
123
+
124
+ ```bash
125
+ # Inside WSL
126
+ pibo config set auth.baseURL http://127.0.0.1:4788
127
+ pibo config set auth.secret "$(openssl rand -hex 32)"
128
+ pibo config set auth.googleClientId <your-google-oauth-client-id>
129
+ pibo config set auth.googleClientSecret <your-google-oauth-client-secret>
130
+ pibo config set auth.allowedEmails you@example.com
131
+ ```
132
+
133
+ To get Google OAuth credentials, create a Web Application client at <https://console.cloud.google.com/apis/credentials>. The redirect URI is `http://127.0.0.1:4788/api/auth/callback/google`. See the [Quick Start Guide](./pibo-vscode-ext-quickstart.md) for the full walkthrough.
134
+
135
+ ## Step 7 — Start the Pibo gateway (1 min)
136
+
137
+ ```bash
138
+ # Inside WSL, leave this running in a terminal
139
+ pibo gateway:web
140
+ ```
141
+
142
+ The gateway listens on `127.0.0.1:4788` **inside WSL**. Windows can reach this URL because WSL2 forwards localhost from Windows to the WSL2 VM by default.
143
+
144
+ Open a **second** WSL terminal and verify:
145
+
146
+ ```bash
147
+ curl -s http://127.0.0.1:4788/api/health
148
+ # or open in your Windows browser:
149
+ # http://127.0.0.1:4788/apps/chat
150
+ ```
151
+
152
+ > **If localhost does not work in the Windows browser:** the WSL2 localhost forwarder is disabled or blocked. See [Troubleshooting](#localhost-forwarding-not-working) below.
153
+
154
+ ## Step 8 — Install the Pibo VSCode extension (2 min)
155
+
156
+ ### Option A — from the WSL terminal (recommended)
157
+
158
+ ```bash
159
+ # Inside the WSL VSCode terminal (Ctrl+`)
160
+ pibo vscode install
161
+ ```
162
+
163
+ This downloads the latest VSIX from GitHub Releases and runs `code --install-extension` against the WSL `code` binary.
164
+
165
+ ### Option B — from the Marketplace
166
+
167
+ Search **Pibo** by publisher `pibo` in the Extensions panel. Install the one named **Pibo** by `pibo`.
168
+
169
+ ### Verify
170
+
171
+ ```bash
172
+ pibo vscode status
173
+ # Should print the installed extension ID and the gateway URL.
174
+ ```
175
+
176
+ Click the **Pibo** icon in the VSCode sidebar (left rail). A web view opens. Sign in with Google. The status bar at the bottom should show the room you are in.
177
+
178
+ ## Step 9 — Optional — Docker workers
179
+
180
+ Pibo's compute workers run as Docker containers. To enable them on WSL:
181
+
182
+ 1. Install **Docker Desktop for Windows**: <https://www.docker.com/products/docker-desktop/>
183
+ 2. Open Docker Desktop → **Settings** → **Resources** → **WSL Integration**.
184
+ 3. Enable the toggle for **Ubuntu** (or whichever distro you use).
185
+ 4. Click **Apply & Restart**.
186
+
187
+ Test from WSL:
188
+
189
+ ```bash
190
+ docker run --rm hello-world
191
+ # Should print "Hello from Docker!"
192
+ ```
193
+
194
+ Pibo will detect Docker automatically. `pibo compute dev spawn --worktree <name>` now works.
195
+
196
+ ## Step 10 — Optional — Browser-Use and Agent-Browser
197
+
198
+ Both tools need a graphical browser under the hood.
199
+
200
+ - **Windows 11 with WSLg** (default on fresh installs): no extra setup. Browser windows appear as regular Windows windows.
201
+ - **Windows 10 or older Windows 11 without WSLg**: install an X server in Windows (e.g. [VcXsrv](https://sourceforge.net/projects/vcxsrv/)) and export the display in WSL:
202
+ ```bash
203
+ # Inside WSL ~/.bashrc
204
+ export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
205
+ ```
206
+ Launch VcXsrv in Windows with "Disable access control" ticked.
207
+
208
+ To install the tools:
209
+
210
+ ```bash
211
+ pibo tools install browser-use
212
+ pibo tools install agent-browser
213
+ pibo tools env browser-use
214
+ ```
215
+
216
+ ## Where Pibo stores things on WSL
217
+
218
+ | Path (inside WSL) | What |
219
+ |---|---|
220
+ | `~/.pibo/config.json` | Pibo configuration (auth, ports, etc.) |
221
+ | `~/.pibo/pibo.sqlite` | Sessions, rooms, signals |
222
+ | `~/.pibo/vscode/cache/` | VSIX cache for `pibo vscode install` |
223
+ | `<workspace>/.pibo/` | Per-workspace room state |
224
+
225
+ > Keep these inside the WSL filesystem (not under `/mnt/c/...`). Cross-FS access is slow and breaks symlinks.
226
+
227
+ ## Troubleshooting
228
+
229
+ ### Localhost forwarding not working
230
+
231
+ WSL2 forwards `localhost` from Windows to the WSL VM by default. If the gateway at `http://127.0.0.1:4788` is unreachable from a Windows browser:
232
+
233
+ 1. **Check Windows version.** Localhost forwarding works on Windows 11 and on Windows 10 22H2+. Older builds had bugs.
234
+ 2. **Check the WSL version.** Run `wsl --status` — `Default Version: 2`.
235
+ 3. **Check Windows Firewall.** Allow inbound to WSL. Run in PowerShell as Admin:
236
+ ```powershell
237
+ New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
238
+ ```
239
+ 4. **Fallback:** use the WSL2 VM's IP. Inside WSL run:
240
+ ```bash
241
+ hostname -I
242
+ # e.g. prints 172.21.123.45
243
+ ```
244
+ Then in your Windows browser use `http://172.21.123.45:4788`. The IP changes on each WSL boot, so this is a workaround, not a permanent solution.
245
+ 5. **Last resort:** set up `netsh interface portproxy`:
246
+ ```powershell
247
+ # PowerShell as Admin
248
+ $wslIp = wsl hostname -I
249
+ netsh interface portproxy add v4tov4 listenport=4788 listenaddress=0.0.0.0 connectport=4788 connectaddress=$wslIp
250
+ ```
251
+
252
+ ### `pibo setup doctor` warns about native Windows
253
+
254
+ You are running Pibo from a Windows PowerShell or `cmd.exe`, not from inside WSL. Open the **WSL** terminal (or run `wsl` from PowerShell) and try again.
255
+
256
+ ### Browser-Use opens a blank window
257
+
258
+ The DISPLAY is not set or the X server is not running. On Windows 11 with WSLg, `echo $DISPLAY` should print something like `:0` or `wayland-0`. On Windows 10, start VcXsrv and export `DISPLAY` as shown above.
259
+
260
+ ### `pibo vscode install` cannot find `code`
261
+
262
+ This means VSCode's WSL server is not active in the current VSCode window. Run `code .` from inside WSL once, restart VSCode, then try again. If you opened VSCode directly from the Start Menu (not via `code .` in WSL), you are in the Windows VSCode instance, not the WSL one.
263
+
264
+ ### File edits are slow
265
+
266
+ You are editing files on `/mnt/c/...` (the Windows drive). Move the project into the WSL filesystem (`/home/<you>/projects/...`). NTFS access from WSL is slow because of `metadata` and `umask` differences.
267
+
268
+ ### Docker commands fail inside WSL
269
+
270
+ Open Docker Desktop → Settings → Resources → WSL Integration → enable your distro → **Apply & Restart**. Verify with `docker run --rm hello-world`.
271
+
272
+ ## Verifying everything works
273
+
274
+ Run the following inside WSL:
275
+
276
+ ```bash
277
+ pibo --version # 1.3.0 or higher
278
+ pibo setup doctor # all checks should be OK or WARN
279
+ pibo vscode status # extension should be installed
280
+ pibo tools list # should list browser-use, agent-browser, etc.
281
+ ```
282
+
283
+ Open the VSCode sidebar → Pibo icon → web view loads → sign in with Google → create a new session → send a message. The status bar at the bottom should show a green dot and your room name.
284
+
285
+ If all of that works, you are fully set up.
286
+
287
+ ## What we deliberately do not support
288
+
289
+ - **Native Windows** (no WSL). Pibo will print a clear error pointing you back to this guide.
290
+ - **WSL1.** WSL1 lacks the full Linux kernel Pibo expects. Use WSL2.
291
+ - **Cygwin, MSYS2, Git Bash.** These are POSIX shims, not real Linux. Pibo will not work; use WSL2.
292
+ - **Windows Containers in Docker.** Pibo compute workers target Linux containers.