@pi-chamber/web 0.6.0 → 0.7.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/dist/assets/{CommitSection-IIhrK4u7.js → CommitSection-DuGkZ_bm.js} +1 -1
- package/dist/assets/{DiagramEditor-DmDE7OFs.js → DiagramEditor-C7xe1Brl.js} +1 -1
- package/dist/assets/{DiagramView-BKKPzX5U.js → DiagramView-BTqROEWP.js} +1 -1
- package/dist/assets/{DiffView-BZAyvJ3r.js → DiffView-hcqXTjEc.js} +3 -3
- package/dist/assets/{FilesView-mwjEX08j.js → FilesView-GadyKxta.js} +4 -4
- package/dist/assets/{GitView-C1ltD6da.js → GitView-BKy-hYUN.js} +3 -3
- package/dist/assets/{JsonTreeView-De-9zk3N.js → JsonTreeView-CGc4eTGI.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-BJjIFNhO.js → MarkdownRendererImpl-CqfEAhPM.js} +1 -1
- package/dist/assets/{PatchDiff-DuR1fglg.js → PatchDiff-P17-Byb8.js} +1 -1
- package/dist/assets/{PierreDiffViewer-B_1JcH3B.js → PierreDiffViewer-BbUCO4IF.js} +1 -1
- package/dist/assets/{SessionSwitcherContent-DoEWfM8C.js → SessionSwitcherContent-j6KFBSe0.js} +1 -1
- package/dist/assets/{SessionSwitcherDropdown-CJWqyz1O.js → SessionSwitcherDropdown-DSVeuuVL.js} +2 -2
- package/dist/assets/{SessionUnreadDot-DB-YvwMh.js → SessionUnreadDot-BVBBEBTg.js} +1 -1
- package/dist/assets/SettingsView-FnmtcWZc.js +4 -0
- package/dist/assets/{SettingsWindow-nCTzNqyu.js → SettingsWindow-Bascj0V3.js} +1 -1
- package/dist/assets/{ToolOutputDialog-CIzj2Pxu.js → ToolOutputDialog-CPMzJ27S.js} +5 -5
- package/dist/assets/{ToolPartDiffPreview-BgewaN20.js → ToolPartDiffPreview-BZSRKHHM.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-aTd42JT9.js → VirtualizedFileDiff-DFx8xsmh.js} +3 -3
- package/dist/assets/{WindowsWindowControls-CdHYDpHx.js → WindowsWindowControls-DIqnZ2uU.js} +109 -109
- package/dist/assets/{collapsible-IV1T6v7c.js → collapsible-DlqZyxEY.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-CcGhkiFO.js → computeVirtualFileMetrics-elCbdk6U.js} +1 -1
- package/dist/assets/{contextFileOpenGuard-DRkKhovc.js → contextFileOpenGuard-BmQ7Zu-L.js} +1 -1
- package/dist/assets/{index-DmJfzwE5.js → index-BerHSX92.js} +1 -1
- package/dist/assets/index-ChFxkws4.js +8 -0
- package/dist/assets/index-DZ-f_hCQ.css +1 -0
- package/dist/assets/{isDiffPlainText-DL6dDuVG.js → isDiffPlainText-CvfRfc7h.js} +1 -1
- package/dist/assets/{isFilePlainText-nuUWsdc6.js → isFilePlainText-_vq9Ghu3.js} +1 -1
- package/dist/assets/{main-Bajw-SZm.js → main-DTCOwPr3.js} +2 -2
- package/dist/assets/main-DYs-nZO6.js +133 -0
- package/dist/assets/{markdownCore-CrfGNEFF.js → markdownCore-CzWR_p3k.js} +2 -2
- package/dist/assets/{miniChat-Dfoj435F.js → miniChat-C2XxEA3N.js} +2 -2
- package/dist/assets/{mobile-DFIt0gxE.js → mobile-BQhAOqV7.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-DKsf3ft3.js → renderElectronMiniChatApp-M2bY1WKA.js} +2 -2
- package/dist/assets/{renderMobileApp-iiD58RxE.js → renderMobileApp-BnpHUUhY.js} +4 -4
- package/dist/assets/{runtimeSurface-D3p7a-uO.js → runtimeSurface-OhCUGSKg.js} +1 -1
- package/dist/assets/{useInlineCommentController-5paFhtYM.js → useInlineCommentController-DC0iNSYX.js} +2 -2
- package/dist/assets/usePanelSlide-aeAIo1cp.js +56 -0
- package/dist/assets/{usePushVisibilityBeacon-BOPrDYSe.js → usePushVisibilityBeacon-om5Qlrt6.js} +2 -2
- package/dist/assets/{useSwitcherItems-DP5ufRVs.js → useSwitcherItems-Bln2r_Q2.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-B9y74Qvn.js → vendor-codemirror-language-data-Dv4zaHRN.js} +2 -2
- package/dist/assets/{web-components-CD0f7QZj.js → web-components-BOt08OHk.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +1 -1
- package/server/lib/inherited-env.js +1 -1
- package/server/lib/pi/routes.js +9 -1
- package/server/lib/pi/routes.test.js +24 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +3 -3
- package/server/lib/pi/session-daemon/session-daemon.js +64 -24
- package/server/lib/pi/session-daemon/session-daemon.test.js +78 -7
- package/server/lib/pi/session-daemon/session-jsonl.js +27 -7
- package/server/lib/pi/session-daemon/session-jsonl.test.js +31 -0
- package/dist/assets/SettingsView-ZwPgZh-7.js +0 -4
- package/dist/assets/index--5Zr-fSk.js +0 -8
- package/dist/assets/index--zDkVFU6.css +0 -1
- package/dist/assets/main-DIAtlyFC.js +0 -133
- package/dist/assets/usePanelSlide-D7Cl581q.js +0 -56
package/server/lib/pi/routes.js
CHANGED
|
@@ -727,6 +727,7 @@ export const registerPiRuntimeRoutes = (app, {
|
|
|
727
727
|
listCustomThemes = listPiCustomThemes,
|
|
728
728
|
updateChecker = checkForUpdates,
|
|
729
729
|
smallModelGenerator = async (input) => (await import('./small-model-generation.js')).generateWithSmallModel(input),
|
|
730
|
+
eventHeartbeatMs = 15_000,
|
|
730
731
|
}) => {
|
|
731
732
|
app.get('/api/pi/ui-settings', async (_req, res) => {
|
|
732
733
|
try {
|
|
@@ -1093,7 +1094,14 @@ export const registerPiRuntimeRoutes = (app, {
|
|
|
1093
1094
|
if (event) res.write(`data: ${JSON.stringify(event)}\n\n`);
|
|
1094
1095
|
};
|
|
1095
1096
|
close = await runtime.subscribe({ sessionId, directory, fromSequence, onEvent: send, onError: () => res.end() });
|
|
1096
|
-
|
|
1097
|
+
// Named heartbeat events are visible to native EventSource clients.
|
|
1098
|
+
// Comment-only SSE heartbeats keep proxies open but are hidden from the
|
|
1099
|
+
// EventSource API, so WKWebView cannot use them to detect a silent link.
|
|
1100
|
+
// Send one immediately so an empty replay still proves the connection is
|
|
1101
|
+
// healthy before the client resets its reconnect backoff.
|
|
1102
|
+
const sendHeartbeat = () => res.write('event: heartbeat\ndata: {}\n\n');
|
|
1103
|
+
sendHeartbeat();
|
|
1104
|
+
const heartbeat = setInterval(sendHeartbeat, eventHeartbeatMs);
|
|
1097
1105
|
const cleanup = () => {
|
|
1098
1106
|
clearInterval(heartbeat);
|
|
1099
1107
|
close?.();
|
|
@@ -590,6 +590,30 @@ describe('Pi runtime route', () => {
|
|
|
590
590
|
expect(text).not.toContain('/private/socket');
|
|
591
591
|
});
|
|
592
592
|
|
|
593
|
+
it('sends named SSE heartbeats that native EventSource clients can observe', async () => {
|
|
594
|
+
const runtime = {
|
|
595
|
+
subscribe: async () => () => {},
|
|
596
|
+
};
|
|
597
|
+
const app = express();
|
|
598
|
+
registerPiRuntimeRoutes(app, {
|
|
599
|
+
getPiSessionDaemonRuntime: () => runtime,
|
|
600
|
+
eventHeartbeatMs: 5,
|
|
601
|
+
});
|
|
602
|
+
server = await listen(app);
|
|
603
|
+
|
|
604
|
+
const response = await fetch(`http://127.0.0.1:${server.address().port}/api/pi/events`);
|
|
605
|
+
const reader = response.body.getReader();
|
|
606
|
+
let text = '';
|
|
607
|
+
while (!text.includes('event: heartbeat')) {
|
|
608
|
+
const next = await reader.read();
|
|
609
|
+
if (next.done) break;
|
|
610
|
+
text += new TextDecoder().decode(next.value);
|
|
611
|
+
}
|
|
612
|
+
await reader.cancel();
|
|
613
|
+
|
|
614
|
+
expect(text).toContain('event: heartbeat\ndata: {}\n\n');
|
|
615
|
+
});
|
|
616
|
+
|
|
593
617
|
it('projects session.updated titles onto the public event stream', async () => {
|
|
594
618
|
const runtime = {
|
|
595
619
|
health: async () => ({ state: 'ready', protocolVersion: 1, capabilities: [] }),
|
|
@@ -15,7 +15,7 @@ This module is the Pi-owned session-daemon foundation. A detached local daemon p
|
|
|
15
15
|
- `daemon-process.js` is the detached private-process entrypoint. It reads the daemon credential from its owner-only sidecar, starts the socket, writes non-secret identity state only after readiness, and removes only its own state on signal shutdown.
|
|
16
16
|
- `ipc-client.js` is the server-only authenticated request client. It owns JSONL framing and never exposes endpoint or credential values to callers.
|
|
17
17
|
- `runtime-registry.js` owns active runtime identities and session-local subscriptions. It rebinds the subscription after an SDK session replacement, rejects identity conflicts rather than displacing another runtime, and attempts every tracked disposal even when another disposal fails.
|
|
18
|
-
- `session-jsonl.js` validates cwd-scoped Pi JSONL before discovery. List, create, and daemon startup require a valid session header per file; they do not read whole transcripts. `sessions.list` uses `listPiSessionJsonlDirectory` (header, first user prompt, latest rename from the file tail). Full-file validation remains on open of a specific session so a malformed body still fails that chat. Pi's SDK list is not the production list path because it scans every line of every log. Directory names match Pi's SessionManager encoding, including Windows drive letters and Git Bash/MSYS/Cygwin/WSL `/c/...` paths so PiChamber and the Pi CLI share the same JSONL sessions.
|
|
18
|
+
- `session-jsonl.js` validates cwd-scoped Pi JSONL before discovery. List, create, and daemon startup require a valid session header per file; they do not read whole transcripts. `sessions.list` uses `listPiSessionJsonlDirectory` (header, first user prompt, latest rename from the file tail). Files in one directory are listed with at most eight concurrent reads; one unreadable or header-malformed file still fails that directory. Full-file validation remains on open of a specific session so a malformed body still fails that chat. Pi's SDK list is not the production list path because it scans every line of every log. Directory names match Pi's SessionManager encoding, including Windows drive letters and Git Bash/MSYS/Cygwin/WSL `/c/...` paths so PiChamber and the Pi CLI share the same JSONL sessions.
|
|
19
19
|
- `supervisor.js` resolves server-only overrides, creates the credential, serializes start/reuse/stop through an owner-only lock, validates daemon identity through `runtime.health`, forwards server-owned commands only after that identity check, and starts or stops the detached process. Reuse requires the ready-state sidecar `entrypoint` to match this checkout's `daemon-process.js`; a healthy daemon from another install (or an older daemon that never recorded an entrypoint) is stopped and replaced so local `bun run dev` cannot keep answering `getSession` without the live-turn overlay. When the parent is Electron, the child is spawned with `ELECTRON_RUN_AS_NODE=1` so packaged Windows/macOS/Linux apps run the daemon as Node instead of a hidden second Electron GUI process.
|
|
20
20
|
- `../routes.js` registers authenticated public adapters before the generic proxy. It exposes only whitelisted runtime, project, session, provider-auth/configuration, settings, resource, small-model utility, and SSE event shapes; no browser response contains daemon paths, credentials, PIDs, headers, or socket framing. Session actions are path-selected, so an identity supplied in a request body cannot redirect a mutation. `archive-store.js` persists PiChamber-only opaque session archive metadata atomically beneath the PiChamber data root and never edits Pi JSONL. `settings-store.js` keeps PiChamber new-session defaults separate from Pi settings.json. `/api/pi/small-model/generate` reads that sidecar and runs a bounded in-memory no-tools Pi session, so utility generation creates no visible or persisted session and exposes no model or credential details. `GET /api/pi/settings` copies leftover UI/desktop `defaultModel` / small / walkthrough strings into that sidecar when those sidecar fields are unset, then Sessions settings is the only editor. Sidecar `defaultThinkingByModel` is the per-model thinking map (`provider/model` keys). A stored global `defaultThinking` with a default model is copied onto that map key and dropped; global thinking without a default model remains a clamp-only fallback. `ui-settings-store.js` atomically owns shared PiChamber UI preferences at the data-root `settings.json`; it is exposed as `/api/pi/ui-settings`, not through removed `/api/config/*` aliases. `session-folders-store.js` validates and atomically persists the restored sidebar's folder snapshot at `/api/pi/session-folders`; a missing snapshot is distinct from an empty one. `custom-themes.js` serves validated custom-theme candidates from `/api/pi/themes` with per-file partial-failure isolation. `model-config-store.js` atomically updates Pi's credential-blind `models.json`; literal keys continue through Pi auth and headers are write-only. `providers.config.get` returns `config: null` for a provider that is not in `models.json` (built-in catalog entries) and fails only when that file is present but malformed.
|
|
21
21
|
- `*.test.js` uses temporary cwd, agent, data, and runtime directories; it never loads a developer's Pi home, credentials, or sessions. On Windows the private endpoint is a named pipe, not a `.sock` file, and POSIX mode-bit assertions are skipped.
|
|
@@ -28,7 +28,7 @@ This module is the Pi-owned session-daemon foundation. A detached local daemon p
|
|
|
28
28
|
- The public health route deliberately whitelists its response fields. It never returns a daemon endpoint, credential, PID, cwd, agent directory, or transcript data. Public transcript and event projections preserve daemon-redacted assistant error messages so the UI can distinguish provider/runtime failures instead of reducing every failure to `ASSISTANT_ERROR`.
|
|
29
29
|
- A client must send an `authenticate` frame carrying the host-private daemon credential before it can issue a request. Credentials are never logged or returned.
|
|
30
30
|
- Frames are LF-delimited JSON. They have a 1 MiB maximum buffered size. A malformed, oversized, unauthenticated, or invalid request closes the connection.
|
|
31
|
-
- The private core commands are `runtime.health`, `projects.list/select`, `providers.list/config.get/models.set/status/login/login.respond/login.status/logout`, `settings.get/set`, `resources.list/update/prompts.create/prompts.delete`, `extensions.list/respond`, and session list/create/open/rename/delete/tree/navigate/fork/clone/prompt/steer/followUp/abort/model/thinking/compact operations. Resource lists use opaque IDs and never disclose server paths. Only top-level Pi prompt templates and applicable AGENTS.md sources are editable; package/path resources and skills are browse-only. Resource writes are rejected while a session streams, use an atomic replace, then recreate the idle runtime. Project trust changes are persisted in Pi trust.json and likewise recreate an idle runtime; project-local extensions load through Pi's own trust flow once trust is resolved. Provider login submits API keys only across authenticated private IPC or brokers Pi's OAuth/device/manual-code interaction; public projections contain only opaque login IDs, prompts, URLs/device codes, model catalog/configuration, and stable states, never credentials or write-only headers. `providers.models.set` is rejected while a session streams, atomically persists Pi's `models.json`, then rehydrates the idle runtime so the catalog is authoritative immediately. `providers.list` projects only catalog and authentication-status metadata, including Pi-supported `thinkingLevels` (`null` map entries hidden, `xhigh`/`max` opt-in). Session thinking overrides are clamped to the live model's supported levels. `sessions.list` checks each cwd JSONL header (not the full transcript) so a project with large session logs cannot spend tens of seconds on startup. SDK `SessionManager.list` is not used for that path; `listPiSessionJsonlDirectory` reads a header, a bounded prefix for the first user prompt, and a tail for the latest rename. Concurrent lists of the same directory share one in-flight result. Concurrent `sessions.open` of the same id share one in-flight runtime create; a duplicate that finishes later disposes itself and returns the registered runtime instead of `SESSION_RUNTIME_CONFLICT`. Full-file JSONL validation stays on open of a chosen session. The browser explicitly selects an existing user-chosen project directory before listing it; the daemon's startup cwd is an internal fallback, not a user-visible default project. Unnamed persisted sessions use their first prompt as a readable list title when available. `sessions.open` and `getSession` project the last assistant `provider`/`model`/`thinkingLevel` onto the session record so reopening a chat keeps that cache identity. Session selection validates a persisted JSONL path before Pi opens it; inactive mutations are never directed by a browser-supplied path. `sessions.open`
|
|
31
|
+
- The private core commands are `runtime.health`, `projects.list/select`, `providers.list/config.get/models.set/status/login/login.respond/login.status/logout`, `settings.get/set`, `resources.list/update/prompts.create/prompts.delete`, `extensions.list/respond`, and session list/create/open/rename/delete/tree/navigate/fork/clone/prompt/steer/followUp/abort/model/thinking/compact operations. Resource lists use opaque IDs and never disclose server paths. Only top-level Pi prompt templates and applicable AGENTS.md sources are editable; package/path resources and skills are browse-only. Resource writes are rejected while a session streams, use an atomic replace, then recreate the idle runtime. Project trust changes are persisted in Pi trust.json and likewise recreate an idle runtime; project-local extensions load through Pi's own trust flow once trust is resolved. Provider login submits API keys only across authenticated private IPC or brokers Pi's OAuth/device/manual-code interaction; public projections contain only opaque login IDs, prompts, URLs/device codes, model catalog/configuration, and stable states, never credentials or write-only headers. `providers.models.set` is rejected while a session streams, atomically persists Pi's `models.json`, then rehydrates the idle runtime so the catalog is authoritative immediately. `providers.list` projects only catalog and authentication-status metadata, including Pi-supported `thinkingLevels` (`null` map entries hidden, `xhigh`/`max` opt-in). Session thinking overrides are clamped to the live model's supported levels. `sessions.list` checks each cwd JSONL header (not the full transcript) so a project with large session logs cannot spend tens of seconds on startup. SDK `SessionManager.list` is not used for that path; `listPiSessionJsonlDirectory` reads a header, a bounded prefix for the first user prompt, and a tail for the latest rename. Concurrent lists of the same directory share one in-flight result. Concurrent `sessions.open` of the same id share one in-flight runtime create; a duplicate that finishes later disposes itself and returns the registered runtime instead of `SESSION_RUNTIME_CONFLICT`. Full-file JSONL validation stays on open of a chosen session. The browser explicitly selects an existing user-chosen project directory before listing it; the daemon's startup cwd is an internal fallback, not a user-visible default project. Unnamed persisted sessions use their first prompt as a readable list title when available. `sessions.open` and `getSession` project the last assistant `provider`/`model`/`thinkingLevel` onto the session record so reopening a chat keeps that cache identity. Session selection validates a persisted JSONL path before Pi opens it; inactive mutations are never directed by a browser-supplied path. `sessions.open` first checks a caller-supplied directory through its bounded header list, so an ordinary project-scoped open neither walks every directory in the agent store nor adopts a same-id session from another directory. Directory-less deep links resolve by Pi's `timestamp_<id>.jsonl` filename before broader SDK-list and header-scan fallbacks. Directory-wide JSONL checks on list/create/startup are header-only; full-file validation stays on open of a chosen transcript. Attachment paths originate in the server-local upload map and cross only private IPC into Pi's tool context. Pi may persist or echo those paths in its authoritative JSONL transcript, so every public projection redacts them recursively: session titles/previews, user and assistant text/thinking, tool arguments, errors, snapshots, and live message events never expose the server-local path. Persisted projection first checks for the attachment marker, then redacts matching tokens with a delimiter scan whose work stays linear for large encoded strings and tool payloads. The daemon maps Pi message lifecycle, deltas, tools, queue changes, model/thinking, compaction, interruption state, and session title updates (`session.updated` on create-with-title, first-prompt auto-title, and rename) to canonical events. Pi `model_select`, `thinking_level_changed`, and `session_info_changed` events are authoritative for model, thinking, and session-name changes made by extensions, the TUI, or another client. The bridge observes Pi provider registration and label writes because Pi 0.84.1 emits no corresponding session events: provider mutations publish a catalog invalidation, and label mutations invalidate the bounded session-tree projection. `ctx.reload()` clears old extension UI state, reloads Pi resources, and invalidates provider/resource/command catalogs. `ctx.shutdown()` disposes only the requesting idle session runtime after its command or turn settles; it never stops the shared daemon or unrelated sessions. Compaction events preserve Pi's manual/threshold/overflow reason, active/retrying/terminal phase, retry timing, redacted failure, compact-and-retry intent, and pre/post token estimates. The latest state is included in `getSession` and reconnect snapshots; after daemon restart, the latest persisted Pi `CompactionEntry` restores completed feedback without treating history as live work. Tool events carry redacted input arguments, cumulative partial-output snapshots, final output, error text, renderer metadata (edit diffs, truncation notes), and start/end timestamps. Pi loads skills with the ordinary `read` tool. The daemon matches those read paths against the active runtime's authoritative `resourceLoader.getSkills()` catalog and adds path-free `metadata.pichamber.skill.name` for live events, hydrated history, and reconnect snapshots. PiChamber uses that metadata for its compact Skill row and Settings navigation; an arbitrary file named `SKILL.md` remains a normal read. Persisted `toolResult` entries merge into their assistant `toolCall` parts as output/error/end time so hydrated sessions render complete tool cards; tool-result entries never surface as standalone messages. Assistant message projections and start events carry the owning user-message id so the restored turn renderer can group and display replies; all assistant entries in a tool loop and every retry/compaction continuation remain attached to the latest user turn until `agent_settled` closes the run. Assistant message projections also pass through Pi's per-turn `Usage` (input, output, cacheRead, cacheWrite, totalTokens, and the same five numeric cost fields). The daemon sanitizes the raw payload through `projectUsage` before publication: every numeric must be finite and non-negative, the whole object is omitted when any field is missing or wrong type, and unknown keys are never copied. The `assistant.message.end` event carries the same sanitized usage so the last turn updates without waiting for a full `getSession` refetch. The public route whitelist re-applies the same sanitizer on each projection so a stale or malformed payload from a different daemon version cannot surface as `NaN` or `Infinity` in the reducer.
|
|
32
32
|
- Live `message_start` events use daemon-generated browser message IDs because Pi has not appended the corresponding session entry yet. Pi agent-core emits streaming assistant starts as shallow copies, not as the finalized object it later persists. At `message_end`, `message-entry-aliases.js` therefore rebinds the synthetic ID to the finalized event object, then maps that object by identity to Pi's appended entry in a microtask. `sessions.navigate` and `sessions.fork` resolve the mapping after stripping any part suffix. Alias keys include cwd and session ID, survive idle runtime disposal, and clear only on explicit session deletion or daemon shutdown. Hydrated message projections continue to use the Pi entry ID directly.
|
|
33
33
|
- Each event and reconnect snapshot has a monotonic sequence. A reconnect receives a bounded contiguous replay after its cursor when available, otherwise an authoritative `session.snapshot`; unavailable runtimes are not represented as empty sessions.
|
|
34
34
|
- Prompt, steer, and follow-up requests acknowledge acceptance immediately after Pi accepts the call; the daemon owns the still-running send promise and publishes any asynchronous rejection as `session.error`. An extension command may resolve without starting an agent turn, so completion of its non-streaming prompt promise publishes the idle lifecycle boundary that Pi does not emit as `agent_settled`. Manual compact requests likewise acknowledge startup instead of holding the public/private request open for the summarization call; the daemon-owned promise reports its outcome through `session.compaction`. A second compact request while Pi is compacting fails as `SESSION_BUSY`, and optional `/compact` instructions pass to `AgentSession.compact(customInstructions)`. A later prompt on the same session invalidates an older send rejection so it cannot error the new turn. If the rejected send left Pi streaming, the daemon aborts it. Steer/follow-up against an idle session starts a new prompt instead of `SESSION_NOT_RUNNING`. Agent and compaction completion are never held behind the 30-second public/private request budgets. Pi retryable provider failures remain live: an `agent_end` with `willRetry` does not publish terminal `session.error`, and `auto_retry_start` projects Pi's attempt, next-attempt time, and redacted error text through `session.lifecycle: retry`. Retry metadata is retained in reconnect and `getSession` snapshots until the next `agent_start` begins the attempt. `agent_settled` remains the authoritative idle boundary after retry success, exhaustion, or cancellation and clears the run's user/assistant ownership.
|
|
@@ -41,6 +41,6 @@ This module is the Pi-owned session-daemon foundation. A detached local daemon p
|
|
|
41
41
|
|
|
42
42
|
## Deliberate limits
|
|
43
43
|
|
|
44
|
-
This module defines the authenticated session API boundary consumed by the Pi-native session UI. Resource configuration and richer attachment extraction remain owned by their dedicated workstreams. The session event stream is SSE over the existing authenticated runtime transport; WebSocket callers fall back to it, preserving direct and relay behavior without a second daemon listener.
|
|
44
|
+
This module defines the authenticated session API boundary consumed by the Pi-native session UI. Resource configuration and richer attachment extraction remain owned by their dedicated workstreams. The session event stream is SSE over the existing authenticated runtime transport; WebSocket callers fall back to it, preserving direct and relay behavior without a second daemon listener. The public route emits named heartbeat events so native `EventSource` clients can detect a silent foreground connection, reconnect, and resume from their last accepted sequence.
|
|
45
45
|
|
|
46
46
|
The Pi SDK is pinned exactly at `0.84.1`. Any Pi 0.x minor upgrade requires a deliberate SDK/release-note review and repeat of this module's disposable-runtime smoke validation.
|
|
@@ -287,6 +287,14 @@ export function createSessionDaemon({
|
|
|
287
287
|
if (typeof requested === 'string' && requested.trim().length > 0) {
|
|
288
288
|
const validated = await validateDirectoryPath(requested);
|
|
289
289
|
knownDirectories.add(validated);
|
|
290
|
+
// PiChamber projects are trusted by default — auto-trust on explicit add/select
|
|
291
|
+
// so skills (and other resources) never trigger the trust popup for known dirs.
|
|
292
|
+
try {
|
|
293
|
+
const trustStore = createTrustStore(agentDir);
|
|
294
|
+
if (trustStore.get(validated) === null && hasTrustRequiringProjectResources(validated)) {
|
|
295
|
+
trustStore.set(validated, true);
|
|
296
|
+
}
|
|
297
|
+
} catch {}
|
|
290
298
|
return validated;
|
|
291
299
|
}
|
|
292
300
|
return activeDirectory || cwd;
|
|
@@ -649,42 +657,60 @@ export function createSessionDaemon({
|
|
|
649
657
|
if (typeof sessionId !== 'string' || sessionId.length === 0) {
|
|
650
658
|
throw new SessionDaemonProtocolError('INVALID_SESSION', 'The Pi session does not exist.');
|
|
651
659
|
}
|
|
652
|
-
// Filename identity is enough to 404 a missing id without listing or
|
|
653
|
-
// fully reading every transcript in every cwd. Deep-linking a stale
|
|
654
|
-
// `?session=` used to hang here while `validatePiSessionJsonlDirectory`
|
|
655
|
-
// scanned multi-megabyte JSONL files that cannot be the target.
|
|
656
|
-
try {
|
|
657
|
-
const named = await findPiSessionJsonlById({ sessionId, agentDir });
|
|
658
|
-
if (named?.path && named.cwd) {
|
|
659
|
-
await validatePiSessionJsonlFile(named.path);
|
|
660
|
-
const directory = await resolveDirectory(named.cwd);
|
|
661
|
-
knownDirectories.add(directory);
|
|
662
|
-
return { target: { id: sessionId, path: named.path }, directory };
|
|
663
|
-
}
|
|
664
|
-
} catch {
|
|
665
|
-
// Fall through to SDK list / header scan for non-standard filenames.
|
|
666
|
-
}
|
|
667
660
|
const candidateDirs = new Set();
|
|
661
|
+
let requestedTargetDirectory;
|
|
668
662
|
if (requestedDirectory) {
|
|
669
663
|
try {
|
|
670
|
-
|
|
664
|
+
requestedTargetDirectory = await resolveDirectory(requestedDirectory);
|
|
665
|
+
candidateDirs.add(requestedTargetDirectory);
|
|
671
666
|
} catch {}
|
|
672
667
|
}
|
|
673
668
|
if (activeDirectory) candidateDirs.add(activeDirectory);
|
|
674
669
|
if (cwd) candidateDirs.add(cwd);
|
|
675
670
|
for (const d of knownDirectories) candidateDirs.add(d);
|
|
676
671
|
|
|
677
|
-
|
|
672
|
+
const findInDirectory = async (directory) => {
|
|
678
673
|
try {
|
|
679
|
-
const sessions = await listSessions({ cwd:
|
|
674
|
+
const sessions = await listSessions({ cwd: directory, agentDir });
|
|
680
675
|
const target = Array.isArray(sessions) ? sessions.find((session) => session?.id === sessionId) : undefined;
|
|
681
676
|
if (target && typeof target.path === 'string' && target.path.length > 0) {
|
|
682
677
|
await validatePiSessionJsonlFile(target.path);
|
|
683
|
-
return { target, directory
|
|
678
|
+
return { target, directory };
|
|
684
679
|
}
|
|
685
|
-
} catch
|
|
686
|
-
// Continue
|
|
680
|
+
} catch {
|
|
681
|
+
// Continue through the remaining authoritative lookup paths.
|
|
687
682
|
}
|
|
683
|
+
return undefined;
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
// A caller-supplied directory is the narrowest authoritative scope. Check
|
|
687
|
+
// it before walking every directory in the agent store. This keeps an
|
|
688
|
+
// ordinary session open proportional to that project's sessions and avoids
|
|
689
|
+
// choosing a same-id record from another directory.
|
|
690
|
+
if (requestedTargetDirectory) {
|
|
691
|
+
const requestedTarget = await findInDirectory(requestedTargetDirectory);
|
|
692
|
+
if (requestedTarget) return requestedTarget;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// Filename identity is enough to locate a session from a directory-less
|
|
696
|
+
// deep link without fully reading every transcript. A stale link can still
|
|
697
|
+
// fall through to the bounded header scans below.
|
|
698
|
+
try {
|
|
699
|
+
const named = await findPiSessionJsonlById({ sessionId, agentDir });
|
|
700
|
+
if (named?.path && named.cwd) {
|
|
701
|
+
await validatePiSessionJsonlFile(named.path);
|
|
702
|
+
const directory = await resolveDirectory(named.cwd);
|
|
703
|
+
knownDirectories.add(directory);
|
|
704
|
+
return { target: { id: sessionId, path: named.path }, directory };
|
|
705
|
+
}
|
|
706
|
+
} catch {
|
|
707
|
+
// Fall through to list / header scan for non-standard filenames.
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
for (const directory of candidateDirs) {
|
|
711
|
+
if (directory === requestedTargetDirectory) continue;
|
|
712
|
+
const target = await findInDirectory(directory);
|
|
713
|
+
if (target) return target;
|
|
688
714
|
}
|
|
689
715
|
|
|
690
716
|
// If not found in candidateDirs, scan all directory stores under agentDir/sessions
|
|
@@ -1362,7 +1388,15 @@ export function createSessionDaemon({
|
|
|
1362
1388
|
const readPiSettings = (requestedDirectory) => {
|
|
1363
1389
|
const targetDir = requestedDirectory || activeDirectory || cwd;
|
|
1364
1390
|
const trustStore = createTrustStore(agentDir);
|
|
1365
|
-
|
|
1391
|
+
let trust = trustStore.get(targetDir);
|
|
1392
|
+
// Auto-trust known PiChamber projects so the skills popup never appears.
|
|
1393
|
+
// `knownDirectories` tracks every dir the user explicitly added/selected.
|
|
1394
|
+
if (trust === null && knownDirectories.has(targetDir) && hasTrustRequiringProjectResources(targetDir)) {
|
|
1395
|
+
try {
|
|
1396
|
+
trustStore.set(targetDir, true);
|
|
1397
|
+
trust = true;
|
|
1398
|
+
} catch {}
|
|
1399
|
+
}
|
|
1366
1400
|
const manager = createSettingsManager({ cwd: targetDir, agentDir, projectTrusted: trust === true });
|
|
1367
1401
|
const global = manager.getGlobalSettings();
|
|
1368
1402
|
const project = manager.getProjectSettings();
|
|
@@ -1403,8 +1437,14 @@ export function createSessionDaemon({
|
|
|
1403
1437
|
if (hasTrust && payload.trust !== null && typeof payload.trust !== 'boolean') {
|
|
1404
1438
|
throw new SessionDaemonProtocolError('INVALID_ARGUMENT', 'The project trust decision is invalid.');
|
|
1405
1439
|
}
|
|
1406
|
-
if (hasTrust
|
|
1407
|
-
|
|
1440
|
+
if (hasTrust) {
|
|
1441
|
+
const targetRuntimes = runtimeRegistry?.listByDirectory?.(targetDir) ?? [];
|
|
1442
|
+
const inheritsActive = runtime && runtime.cwd === targetDir ? [runtime] : [];
|
|
1443
|
+
const allTarget = targetRuntimes.length > 0 ? targetRuntimes : inheritsActive;
|
|
1444
|
+
const isTargetStreaming = allTarget.some((r) => r.session?.isStreaming);
|
|
1445
|
+
if (isTargetStreaming) {
|
|
1446
|
+
throw new SessionDaemonProtocolError('SESSION_BUSY', 'Project trust cannot change during an active session.');
|
|
1447
|
+
}
|
|
1408
1448
|
}
|
|
1409
1449
|
const trustStore = createTrustStore(agentDir);
|
|
1410
1450
|
if (hasTrust) trustStore.set(targetDir, payload.trust);
|
|
@@ -7,10 +7,14 @@ import { join } from 'node:path';
|
|
|
7
7
|
import { StringDecoder } from 'node:string_decoder';
|
|
8
8
|
|
|
9
9
|
import { createMessageEntryAliases } from './message-entry-aliases.js';
|
|
10
|
-
import { createSessionDaemon, isLocalSessionDaemonEndpoint } from './session-daemon.js';
|
|
10
|
+
import { createSessionDaemon as createSessionDaemonImpl, isLocalSessionDaemonEndpoint } from './session-daemon.js';
|
|
11
11
|
|
|
12
12
|
const credential = 'a-private-daemon-credential';
|
|
13
13
|
|
|
14
|
+
function createSessionDaemon(options) {
|
|
15
|
+
return createSessionDaemonImpl({ ...options, agentDir: options.agentDir ?? options.cwd });
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
class FakeSession {
|
|
15
19
|
constructor(sessionId = 'pi-session-1', sessionFile) {
|
|
16
20
|
this.sessionId = sessionId;
|
|
@@ -317,7 +321,7 @@ describe('Pi session daemon spike', () => {
|
|
|
317
321
|
await stale.close();
|
|
318
322
|
});
|
|
319
323
|
|
|
320
|
-
it('keeps existing
|
|
324
|
+
it('keeps existing, late-joining, and reconnecting device streams contiguous during one turn', async () => {
|
|
321
325
|
const root = await mkdtemp(join(tmpdir(), 'pichamber-pi-daemon-multi-client-'));
|
|
322
326
|
const endpoint = testDaemonEndpoint(root);
|
|
323
327
|
const session = new FakeSession();
|
|
@@ -358,15 +362,37 @@ describe('Pi session daemon spike', () => {
|
|
|
358
362
|
expect(firstDeltaFrame.sequence).toBe(lateDeltaFrame.sequence);
|
|
359
363
|
expect(lateDeltaFrame.payload.delta).toBe(' plus the rest');
|
|
360
364
|
|
|
365
|
+
await late.close();
|
|
366
|
+
const firstEnd = first.next((frame) => frame.event === 'assistant.message.end');
|
|
367
|
+
session.emit({
|
|
368
|
+
type: 'message_end',
|
|
369
|
+
message: {
|
|
370
|
+
role: 'assistant',
|
|
371
|
+
content: [{ type: 'text', text: 'half plus the rest' }],
|
|
372
|
+
provider: 'test',
|
|
373
|
+
model: 'model',
|
|
374
|
+
timestamp: 1_000,
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
const firstEndFrame = await firstEnd;
|
|
378
|
+
|
|
379
|
+
const resumed = connectClient(endpoint);
|
|
380
|
+
await resumed.authenticate(credential, {
|
|
381
|
+
sessionId: 'pi-session-1',
|
|
382
|
+
fromSequence: lateDeltaFrame.sequence,
|
|
383
|
+
});
|
|
384
|
+
const resumedEndFrame = await resumed.next((frame) => frame.event === 'assistant.message.end');
|
|
385
|
+
expect(resumedEndFrame.sequence).toBe(firstEndFrame.sequence);
|
|
386
|
+
|
|
361
387
|
const firstIdle = first.next((frame) => frame.event === 'session.lifecycle' && frame.payload?.state === 'idle');
|
|
362
|
-
const
|
|
388
|
+
const resumedIdle = resumed.next((frame) => frame.event === 'session.lifecycle' && frame.payload?.state === 'idle');
|
|
363
389
|
session.isStreaming = false;
|
|
364
390
|
session.emit({ type: 'agent_settled' });
|
|
365
|
-
const [firstIdleFrame,
|
|
366
|
-
expect(firstIdleFrame.sequence).toBe(
|
|
367
|
-
expect(firstIdleFrame.sequence).toBeGreaterThan(
|
|
391
|
+
const [firstIdleFrame, resumedIdleFrame] = await Promise.all([firstIdle, resumedIdle]);
|
|
392
|
+
expect(firstIdleFrame.sequence).toBe(resumedIdleFrame.sequence);
|
|
393
|
+
expect(firstIdleFrame.sequence).toBeGreaterThan(firstEndFrame.sequence);
|
|
368
394
|
|
|
369
|
-
await
|
|
395
|
+
await resumed.close();
|
|
370
396
|
await first.close();
|
|
371
397
|
});
|
|
372
398
|
|
|
@@ -532,6 +558,51 @@ describe('Pi session daemon spike', () => {
|
|
|
532
558
|
await second.close();
|
|
533
559
|
});
|
|
534
560
|
|
|
561
|
+
it('opens the requested directory before falling back to a same-id global session', async () => {
|
|
562
|
+
const root = await mkdtemp(join(tmpdir(), 'pichamber-pi-daemon-open-requested-'));
|
|
563
|
+
const otherRoot = await mkdtemp(join(tmpdir(), 'pichamber-pi-daemon-open-other-'));
|
|
564
|
+
const endpoint = testDaemonEndpoint(root);
|
|
565
|
+
const agentDir = join(root, 'agent');
|
|
566
|
+
const otherSessionDir = join(agentDir, 'sessions', 'other');
|
|
567
|
+
await mkdir(otherSessionDir, { recursive: true });
|
|
568
|
+
|
|
569
|
+
const requestedSessionFile = join(root, 'session-1.jsonl');
|
|
570
|
+
const otherSessionFile = join(otherSessionDir, 'session-1.jsonl');
|
|
571
|
+
await writeFile(requestedSessionFile, `{"type":"session","id":"session-1","cwd":${JSON.stringify(root)}}\n`);
|
|
572
|
+
await writeFile(otherSessionFile, `{"type":"session","id":"session-1","cwd":${JSON.stringify(otherRoot)}}\n`);
|
|
573
|
+
|
|
574
|
+
let opened;
|
|
575
|
+
daemon = createSessionDaemon({
|
|
576
|
+
endpoint,
|
|
577
|
+
credential,
|
|
578
|
+
cwd: root,
|
|
579
|
+
agentDir,
|
|
580
|
+
listSessions: async ({ cwd }) => cwd === root ? [{
|
|
581
|
+
path: requestedSessionFile,
|
|
582
|
+
id: 'session-1',
|
|
583
|
+
cwd: root,
|
|
584
|
+
created: new Date('2026-01-01T00:00:00.000Z'),
|
|
585
|
+
modified: new Date('2026-01-02T00:00:00.000Z'),
|
|
586
|
+
}] : [],
|
|
587
|
+
createRuntime: async (options) => {
|
|
588
|
+
opened = options;
|
|
589
|
+
return new FakeRuntime({
|
|
590
|
+
cwd: options.cwd,
|
|
591
|
+
session: new FakeSession('session-1', options.sessionFile),
|
|
592
|
+
});
|
|
593
|
+
},
|
|
594
|
+
});
|
|
595
|
+
await daemon.start();
|
|
596
|
+
|
|
597
|
+
const client = connectClient(endpoint);
|
|
598
|
+
await client.authenticate();
|
|
599
|
+
const response = await client.request('sessions.open', { sessionId: 'session-1', directory: root });
|
|
600
|
+
|
|
601
|
+
expect(response.result.session.directory).toBe(root);
|
|
602
|
+
expect(opened).toMatchObject({ cwd: root, sessionFile: requestedSessionFile });
|
|
603
|
+
await client.close();
|
|
604
|
+
});
|
|
605
|
+
|
|
535
606
|
it('does not include in-memory sessions from another directory when listing a newly selected project directory', async () => {
|
|
536
607
|
const rootA = await mkdtemp(join(tmpdir(), 'pichamber-pi-daemon-a-'));
|
|
537
608
|
const rootB = await mkdtemp(join(tmpdir(), 'pichamber-pi-daemon-b-'));
|
|
@@ -38,6 +38,25 @@ const LIST_HEAD_SCAN_BYTES = 512 * 1024;
|
|
|
38
38
|
/** Latest `session_info` (rename) is appended; read a tail instead of the whole log. */
|
|
39
39
|
const LIST_TAIL_SCAN_BYTES = 128 * 1024;
|
|
40
40
|
const LIST_PREVIEW_CHARS = 500;
|
|
41
|
+
/** Bound in-directory JSONL listing so a large folder is not one file at a time. */
|
|
42
|
+
const LIST_FILE_CONCURRENCY = 8;
|
|
43
|
+
|
|
44
|
+
const mapWithConcurrency = async (values, concurrency, mapper) => {
|
|
45
|
+
if (values.length === 0) return [];
|
|
46
|
+
const safeConcurrency = Math.max(1, Math.min(concurrency, values.length));
|
|
47
|
+
const results = new Array(values.length);
|
|
48
|
+
let cursor = 0;
|
|
49
|
+
const worker = async () => {
|
|
50
|
+
while (true) {
|
|
51
|
+
const nextIndex = cursor;
|
|
52
|
+
cursor += 1;
|
|
53
|
+
if (nextIndex >= values.length) return;
|
|
54
|
+
results[nextIndex] = await mapper(values[nextIndex]);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
await Promise.all(Array.from({ length: safeConcurrency }, () => worker()));
|
|
58
|
+
return results;
|
|
59
|
+
};
|
|
41
60
|
|
|
42
61
|
const isSessionHeader = (entry) => (
|
|
43
62
|
Boolean(entry)
|
|
@@ -266,7 +285,9 @@ async function readPiSessionJsonlListFields(filePath, fileSize) {
|
|
|
266
285
|
/**
|
|
267
286
|
* Sidebar/list metadata for one cwd. Reads a header, a bounded prefix for
|
|
268
287
|
* the first user prompt, and a tail for the latest rename. It does not
|
|
269
|
-
* load whole transcripts.
|
|
288
|
+
* load whole transcripts. Files in the directory are read with bounded
|
|
289
|
+
* concurrency; one unreadable or header-malformed file still fails the
|
|
290
|
+
* whole directory list.
|
|
270
291
|
*/
|
|
271
292
|
export async function listPiSessionJsonlDirectory({
|
|
272
293
|
cwd,
|
|
@@ -284,9 +305,8 @@ export async function listPiSessionJsonlDirectory({
|
|
|
284
305
|
throw unreadable();
|
|
285
306
|
}
|
|
286
307
|
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
if (!entry.name.endsWith('.jsonl') || entry.isDirectory()) continue;
|
|
308
|
+
const files = entries.filter((entry) => entry.name.endsWith('.jsonl') && !entry.isDirectory());
|
|
309
|
+
const sessions = await mapWithConcurrency(files, LIST_FILE_CONCURRENCY, async (entry) => {
|
|
290
310
|
const filePath = join(sessionDirectory, entry.name);
|
|
291
311
|
let fileStat;
|
|
292
312
|
try {
|
|
@@ -303,7 +323,7 @@ export async function listPiSessionJsonlDirectory({
|
|
|
303
323
|
? Date.parse(fields.header.timestamp)
|
|
304
324
|
: NaN;
|
|
305
325
|
const created = Number.isFinite(headerTime) ? new Date(headerTime) : fileStat.mtime;
|
|
306
|
-
|
|
326
|
+
return {
|
|
307
327
|
path: filePath,
|
|
308
328
|
id: fields.header.id,
|
|
309
329
|
cwd: fields.header.cwd,
|
|
@@ -312,8 +332,8 @@ export async function listPiSessionJsonlDirectory({
|
|
|
312
332
|
created,
|
|
313
333
|
modified: fileStat.mtime,
|
|
314
334
|
...(fields.firstMessage ? { firstMessage: fields.firstMessage } : {}),
|
|
315
|
-
}
|
|
316
|
-
}
|
|
335
|
+
};
|
|
336
|
+
});
|
|
317
337
|
sessions.sort((left, right) => right.modified.getTime() - left.modified.getTime());
|
|
318
338
|
return sessions;
|
|
319
339
|
}
|
|
@@ -138,4 +138,35 @@ describe('Pi session JSONL validation', () => {
|
|
|
138
138
|
]);
|
|
139
139
|
expect(listed[0].path).toContain('session-one.jsonl');
|
|
140
140
|
});
|
|
141
|
+
|
|
142
|
+
it('lists every session file in a crowded directory', async () => {
|
|
143
|
+
const root = await mkdtemp(join(tmpdir(), 'pichamber-pi-jsonl-'));
|
|
144
|
+
const cwd = join(root, 'project');
|
|
145
|
+
const agentDir = join(root, 'agent');
|
|
146
|
+
const sessionDirectory = getPiSessionDirectory({ cwd, agentDir });
|
|
147
|
+
await mkdir(sessionDirectory, { recursive: true });
|
|
148
|
+
const ids = Array.from({ length: 24 }, (_, index) => `session-${String(index).padStart(2, '0')}`);
|
|
149
|
+
await Promise.all(ids.map((id) => writeFile(
|
|
150
|
+
join(sessionDirectory, `${id}.jsonl`),
|
|
151
|
+
`${JSON.stringify({ type: 'session', version: 3, id, timestamp: '2026-01-01T00:00:00.000Z', cwd })}\n${JSON.stringify({ type: 'message', message: { role: 'user', content: [{ type: 'text', text: `Prompt ${id}` }] } })}\n`,
|
|
152
|
+
)));
|
|
153
|
+
|
|
154
|
+
const listed = await listPiSessionJsonlDirectory({ cwd, agentDir });
|
|
155
|
+
expect(listed.map((session) => session.id).sort()).toEqual([...ids].sort());
|
|
156
|
+
expect(listed.every((session) => session.cwd === cwd && session.firstMessage?.startsWith('Prompt '))).toBe(true);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('fails the directory list when one session header is malformed', async () => {
|
|
160
|
+
const root = await mkdtemp(join(tmpdir(), 'pichamber-pi-jsonl-'));
|
|
161
|
+
const cwd = join(root, 'project');
|
|
162
|
+
const agentDir = join(root, 'agent');
|
|
163
|
+
const sessionDirectory = getPiSessionDirectory({ cwd, agentDir });
|
|
164
|
+
await mkdir(sessionDirectory, { recursive: true });
|
|
165
|
+
await writeFile(join(sessionDirectory, 'valid.jsonl'), `${validHeader(cwd)}\n`);
|
|
166
|
+
await writeFile(join(sessionDirectory, 'broken.jsonl'), '{"type":"not-a-session"}\n');
|
|
167
|
+
|
|
168
|
+
await expect(listPiSessionJsonlDirectory({ cwd, agentDir })).rejects.toMatchObject({
|
|
169
|
+
code: 'MALFORMED_SESSION_JSONL',
|
|
170
|
+
});
|
|
171
|
+
});
|
|
141
172
|
});
|