@wherever-dev/client 0.2.2 → 0.3.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/CHANGELOG.md +38 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.js +483 -25
- package/dist/client.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +6 -3
- package/src/client.ts +507 -28
- package/src/types.ts +27 -0
- package/test/agent-pending.test.ts +107 -0
- package/test/creating-session-watchdog.test.ts +82 -0
- package/test/harness.ts +97 -0
- package/test/message-delivery-confirmation.test.ts +194 -0
- package/test/mid-stream-steer.test.ts +91 -0
- package/test/reconnect-rejoins-session.test.ts +136 -0
- package/test/resume-keeps-session.test.ts +118 -0
- package/test/tool-duration-history.test.ts +93 -0
- package/test/tool-duration.test.ts +86 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @wherever-dev/client
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 333f6ad: Never silently lose a message when the connection drops mid-send; confirm delivery and recover it on reload.
|
|
8
|
+
|
|
9
|
+
A frame handed to a socket that reports OPEN can still never reach the server (a half-open TCP connection: `send()` buffers locally and does not throw, but the bytes never land). The optimistic echo was treated as delivered, the input was cleared, and on reload the message was gone with no way to recover it.
|
|
10
|
+
|
|
11
|
+
Outbound user messages are now tracked as `delivery: 'sending'` until the server echoes them back (`message_end` role:user), at which point they are confirmed. If no echo arrives within a window, the message flips to `delivery: 'failed'` and the UI surfaces "Not delivered" with Retry / Discard instead of a normal-looking sent message. Unconfirmed messages are persisted per session, so a reload reconciles them against the loaded history: anything the server actually persisted is shown as delivered, and anything it did not is re-surfaced as a recoverable failed message (never silently dropped). New client APIs: `resendMessage(id)` and `discardMessage(id)`.
|
|
12
|
+
|
|
13
|
+
- 9368269: Show how long each tool call has been running, like the pi CLI.
|
|
14
|
+
|
|
15
|
+
A running tool now shows a live-ticking "Elapsed N.Ns" and, once it finishes, "Took N.Ns" (one decimal, matching the CLI's bash duration format). The client reducer stamps `startedAt` on `tool_start` and `endedAt` on `tool_end` (new `ChatMessage` fields), and freezes a still-running tool's `endedAt` if the turn ends or is aborted without a `tool_end`, so the timer stops instead of counting up forever. The web UI ticks only while a tool is actually running (no per-frame work on an idle session).
|
|
16
|
+
|
|
17
|
+
Durations also survive a reload/reconnect: history mapping pairs each `tool_call` with its `tool_result` and derives `startedAt`/`endedAt` from their timestamps (no server change needed), so a tool restored from loaded history shows the same "Took N.Ns" as a live-streamed one.
|
|
18
|
+
|
|
19
|
+
## 0.3.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- f17f262: Make opening a session fast, and add the deterministic fake-LLM integration gate.
|
|
24
|
+
|
|
25
|
+
Opening a session no longer blocks on building the live agent. Previously `session_load` awaited `createAgentSession` (which resolves extensions and connects MCP servers, seconds of work, occasionally hanging past the client's load watchdog) before sending anything, so returning to an idle-evicted session was slow and could time out. Now the server reads the session header + transcript cheaply and sends `session_created` (with a new `pending` flag) + `message_history` immediately, then builds the agent asynchronously and sends a new `session_ready` message. The client renders and lets you scroll the conversation right away; only the composer stays disabled (with a "Preparing the session agent..." banner) until the agent is ready. A failed cold build degrades to readable-but-not-sendable instead of a hard load failure. Warm (still-resident) sessions skip the pending phase entirely.
|
|
26
|
+
|
|
27
|
+
Also raised the default session idle-eviction window from 5 to 20 minutes (`PI_IDLE_TIMEOUT`, ms) so a dip-in/dip-out user usually returns to a warm session with no agent rebuild at all.
|
|
28
|
+
|
|
29
|
+
Foundation: promoted the fake-LLM test substrate (ADR 0001) into `server/test/` and wired `vitest` into the `server` and `client` packages, giving a deterministic, offline integration gate (real server + real pi + fake Anthropic-Messages SSE server). New coverage: server integration tests for fast-first load and a client reducer test for the pending/ready lifecycle.
|
|
30
|
+
|
|
31
|
+
Protocol: `session_created` gains an optional `pending` flag and there is a new `session_ready` server message. Both are additive and backward compatible (an older client that ignores them simply treats the load as before, seeing history once and the composer enabled on `session_created`).
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- f615141: Fix three frontend session-lifecycle bugs and add the first client unit tests.
|
|
36
|
+
- Creating a new session no longer spins the blocking "Creating session..." overlay forever when the server reply is lost (slow git init / remote-repo creation, a half-open socket, or an error before the reply is sent). A create watchdog now mirrors the existing load watchdog: it clears the overlay and surfaces a recoverable error instead of forcing a reload.
|
|
37
|
+
- Returning to the app (PWA/mobile) after a background suspend no longer flashes the new-session / search empty-state or the big "Not connected" panel over an already-loaded conversation. `suspend()` now correctly reflects the disconnected state so `resume()` actually rejoins in place (it was silently no-op'ing on a stale connected flag and falling through to a session-dropping reconnect). The chat view keeps the cached messages visible during a reconnect, with a thin "Reconnecting and syncing session..." banner over the composer; the sidebar and top-bar search stay usable, and only sending into that one session is blocked.
|
|
38
|
+
- An UNSOLICITED socket drop (tab switch, network blip, laptop sleep, half-open reap) no longer silently detaches the frontend from a still-running session. Previously the reconnect neither re-issued `session_load` nor preserved the cached session, so the relay reconnected but the session stream was dead: the UI froze on a stale tool call with "Abort" disabled and no "connecting"/"loading" hint while the agent kept working headless, recoverable only by reload. Now the auto-reconnect preserves the cached conversation, shows the resyncing banner during the backoff, re-attaches to the active session on open, and restores the true streaming state (re-enabling Abort) from the server.
|
|
39
|
+
- Added `vitest` to the `client` package with unit tests covering the create watchdog, the suspend/resume-keeps-session invariants, and unsolicited-reconnect re-attachment.
|
|
40
|
+
|
|
3
41
|
## 0.2.2
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare class WhereverClient {
|
|
|
17
17
|
private agentEndTimeout;
|
|
18
18
|
private loadWatchdog;
|
|
19
19
|
private static readonly LOAD_WATCHDOG_MS;
|
|
20
|
+
private createWatchdog;
|
|
21
|
+
private static readonly CREATE_WATCHDOG_MS;
|
|
20
22
|
private reconnectAttempts;
|
|
21
23
|
private reconnectDelay;
|
|
22
24
|
private maxReconnectDelay;
|
|
@@ -32,16 +34,22 @@ export declare class WhereverClient {
|
|
|
32
34
|
private resumeModel?;
|
|
33
35
|
private listeners;
|
|
34
36
|
private pendingUploads;
|
|
37
|
+
private confirmTimers;
|
|
38
|
+
private static readonly CONFIRM_MS;
|
|
39
|
+
private static readonly PENDING_PREFIX;
|
|
35
40
|
constructor(config: WhereverClientConfig);
|
|
36
41
|
connect(newConfig?: Partial<WhereverClientConfig>, preserveState?: boolean): void;
|
|
37
42
|
disconnect(resetState?: boolean): void;
|
|
38
43
|
suspend(): void;
|
|
39
44
|
resume(): void;
|
|
40
45
|
hasSuspendedSession(): boolean;
|
|
46
|
+
hasActiveSession(): boolean;
|
|
41
47
|
private startLivenessWatchdog;
|
|
42
48
|
private stopLivenessWatchdog;
|
|
43
49
|
private armLoadWatchdog;
|
|
44
50
|
private clearLoadWatchdog;
|
|
51
|
+
private armCreateWatchdog;
|
|
52
|
+
private clearCreateWatchdog;
|
|
45
53
|
private scheduleReconnect;
|
|
46
54
|
private handleMessage;
|
|
47
55
|
/**
|
|
@@ -59,6 +67,14 @@ export declare class WhereverClient {
|
|
|
59
67
|
loadMoreHistory(): void;
|
|
60
68
|
send(msg: any): boolean;
|
|
61
69
|
sendMessage(text: string): boolean;
|
|
70
|
+
private pendingKey;
|
|
71
|
+
private persistPending;
|
|
72
|
+
private loadPersistedPending;
|
|
73
|
+
private armConfirm;
|
|
74
|
+
private clearConfirm;
|
|
75
|
+
private confirmDeliveredByContent;
|
|
76
|
+
resendMessage(messageId: string): boolean;
|
|
77
|
+
discardMessage(messageId: string): void;
|
|
62
78
|
abort(): void;
|
|
63
79
|
joinSession(sessionFile: string, cwd?: string, model?: string): void;
|
|
64
80
|
switchSession(sessionFile: string, cwd?: string, model?: string): void;
|