@wherever-dev/client 0.2.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 ADDED
@@ -0,0 +1,8 @@
1
+ # @wherever-dev/client
2
+
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 37de34b: Extract core client WebSocket and state management logic into a dedicated, framework-agnostic `@wherever-dev/client` monorepo package. Update both the web dashboard (`@wherever-dev/web`) and the CLI extension (`@wherever-dev/pi`) to use the new shared client, reducing duplicate code and establishing a modular architecture for future integrations.
8
+ - ffd28c7: Speed up loading of long sessions with tail-first history windowing. On load/join, the server now sends only the most recent messages (with a total count and offset) instead of the entire history in one payload, and the web dashboard shows a "Load older messages" button that lazily fetches earlier windows (with scroll-position anchoring). This adds `history_load_more` / `message_history_prepend` to the protocol and a `loadMoreHistory()` method plus history pagination state to `@wherever-dev/client`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,61 @@
1
+ import { type Writable } from "sveltore";
2
+ import { type WhereverState } from "./types.js";
3
+ export interface WhereverClientConfig {
4
+ host: string;
5
+ port: number | string;
6
+ token?: string;
7
+ secure?: boolean;
8
+ WebSocketCtor?: any;
9
+ hideThinking?: boolean;
10
+ hideTools?: boolean;
11
+ }
12
+ export declare class WhereverClient {
13
+ private ws;
14
+ private config;
15
+ stateStore: Writable<WhereverState>;
16
+ private reconnectTimer;
17
+ private agentEndTimeout;
18
+ private reconnectAttempts;
19
+ private reconnectDelay;
20
+ private maxReconnectDelay;
21
+ private isInitialConnect;
22
+ private listeners;
23
+ private pendingUploads;
24
+ constructor(config: WhereverClientConfig);
25
+ connect(newConfig?: Partial<WhereverClientConfig>): void;
26
+ disconnect(resetState?: boolean): void;
27
+ private scheduleReconnect;
28
+ private handleMessage;
29
+ /**
30
+ * Map a server `HistoryMessage[]` window into UI `ChatMessage[]`. When
31
+ * `applyStreamingTail` is true, the last assistant/thinking message and any
32
+ * unmatched tool-call placeholders are marked streaming (used only for the
33
+ * live tail window, not for prepended older history).
34
+ */
35
+ private mapHistory;
36
+ /**
37
+ * Request the previous window of older history for the active session.
38
+ * No-op when there is nothing older to load or a request is already in
39
+ * flight.
40
+ */
41
+ loadMoreHistory(): void;
42
+ send(msg: any): void;
43
+ sendMessage(text: string): void;
44
+ abort(): void;
45
+ joinSession(sessionFile: string, cwd?: string, model?: string): void;
46
+ createSession(cwd: string, model?: string, gitInit?: boolean, createRemote?: boolean, repoVisibility?: 'private' | 'public'): void;
47
+ leaveSession(): void;
48
+ resolveConflict(action: 'take_over' | 'read_only', cwd?: string): void;
49
+ ping(): void;
50
+ clearMessages(): void;
51
+ dismissSessionError(): void;
52
+ changeModel(model: string): void;
53
+ setConfig(updates: Partial<WhereverClientConfig>): void;
54
+ onMessage(cb: (msg: any) => void): () => void;
55
+ uploadFileViaWebSocket(sessionId: string, filename: string, base64Data: string): Promise<{
56
+ savedPath: string;
57
+ filename: string;
58
+ }>;
59
+ private generateId;
60
+ getIsConnected(): any;
61
+ }