@wherever-dev/client 0.5.4 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @wherever-dev/client
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 914a24c: Support `/reload` in the web composer. It no longer reaches the model as chat text: the client sends a new `session_reload` frame and the server rebuilds the session's agent so it re-reads settings, extensions (including edited extension code), skills, prompts and context files such as AGENTS.md. Extensions see `session_shutdown` and `session_start` with reason `reload`. The rebuild keeps the conversation, model and thinking level, and avoids pi's in-place reload, whose provider reset would affect every other live session. While it runs, viewers get `session_reloading` (composer blocked) and then `session_ready`. It is refused with a notice while the agent is busy, for terminal-driven sessions and for read-only viewers. The client gains `reloadResources()`.
8
+
9
+ ## 0.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 5214eb8: Creating a new session that CLONES an existing remote now runs through the path-keyed restore registry, with live progress instead of a blocking overlay, and the old synchronous clone is gone.
14
+
15
+ Creating a session in a folder that does not exist could already clone the remote the provider probe found, but it did so synchronously behind the "Creating session..." overlay: no progress, no submodules, and a 25-second client watchdog that gave up while git was still running, which made a large repository effectively un-clonable. That clone is now the same job the restore panel drives, so there is ONE clone implementation left in the codebase.
16
+ - **Cloning here is now RECURSIVE** (`--recurse-submodules`), which it was not before. A session created this way lands with its submodule content present rather than with empty submodule directories discovered later. Upstream tracking is still configured on the resulting clone, as it always was.
17
+ - **Real progress, no watchdog.** The server answers `session_new { cloneRemote: true }` with `restore_started` and then the ordinary `restore_progress` / `restore_complete` frames; the dashboard shows the same honest progress display as the restore panel (phase, scope, a real percentage or an explicitly indeterminate bar, submodules counted separately) and disarms the create watchdog while the job is watched. A multi-minute clone no longer strands the UI.
18
+ - **The server continues into creation itself** once the job is `done`. Unlike the restore panel, this path has nothing to reload: the session does not exist until the clone lands, so the flow completes itself rather than asking the user to retry.
19
+ - **A failed or cancelled clone fails the create** with the registry's mapped cause (no key this host accepts, host missing from `known_hosts`, repository not found, network) on `session_error`, and leaves no half-made session. The clone stays cancellable while it runs, through the ordinary `restore_cancel` frame, because the job is server-owned and keyed by the target path.
20
+ - **`POST /session/new` takes the same branch** for `cloneRemote`, gaining recursion; having no progress channel, it simply waits for the job.
21
+ - **The synchronous `cloneRemoteRepo()` helper is DELETED** and `SessionPool.createNewSession` no longer takes `cloneRemote`: by the time it is called the folder is there. Creating a NEW remote repository (the other branch of the clone-or-create dialog), creating a session in a folder that already exists, and the plain create-the-folder path are all unchanged.
22
+ - The shared client package carries `RestoreInfo.forSessionCreate`, which marks a restore that is the first step of a session create, so a client can tell "watch this and then hand back to the create" apart from the panel's "restore, then reload".
23
+
24
+ - 84fc5a9: Restore a session's missing working folder from the dashboard: tap Clone, watch it honestly, cancel it, survive a dropped connection, and come back to a live session.
25
+
26
+ A folder-missing session now shows a RESTORE PANEL in place of its composer: the missing absolute path, an editable URL pre-filled from the server's remote candidates (`GET /remote-candidates`, so a repository can be restored from a phone without typing one), a Clone button, live progress, Cancel while it runs, and on success a Reload that brings the session back live. This is the user-facing half of the path-keyed restore registry, wired over the WebSocket.
27
+ - **New frames**, all namespaced `restore_*` and all addressed by TARGET PATH (never by session id, because the job's key is the path). Client to server: `restore_start { targetPath, action, url?, gitInit? }` and `restore_cancel { targetPath }`. Server to client: `restore_started` (with `outcome: 'started' | 'joined'` and the url really in flight), `restore_rejected` (refused before anything was spawned: no job, no completion coming), `restore_progress` and `restore_complete` (which carries every terminal state -- `done`, `failed` or `cancelled`). `folder_missing` now also carries any `job` already running for the path.
28
+ - **Subscription is DERIVED, not registered**: progress reaches every client whose attached session cwd, pending load target, or folder-missing path MATCHES the job path, evaluated per frame. A phone that drops mid-clone and reconnects repaints the RUNNING job from the `folder_missing` frame and keeps receiving live progress, with no second clone and no leaked bookkeeping. A second device sees the same job, and its Clone tap JOINS it and is told which URL is actually being cloned rather than being silently answered as though its edited URL had won.
29
+ - **A restore in flight now counts as folder-missing.** `git clone` creates the target directory in its first breath, so the plain existence check said "present" for the whole of a multi-minute clone and a client loading in that window was handed a live agent pointed at a HALF-CLONED tree. A session whose folder has a running restore job is locked read-only with no agent built, exactly like one whose folder is absent, and the send refusal says "still being restored" instead of "does not exist".
30
+ - **Honest progress, per story 8**: the phase, the scope (the repository or a named submodule), and either a real percentage or an explicitly indeterminate bar -- never a fake unified number. Submodules are shown under their own scope with a standing note that each is counted separately.
31
+ - **Failures explain themselves**: the mapped cause (no key this host accepts, host missing from `known_hosts`, repository not found, network) with git's raw output available underneath, and a refused request (a target outside the home directory, a non-empty folder, a URL outside the SSH/`file://` allowlist) says why and leaves the panel offering to try again.
32
+ - The shared client package carries the new frames as `WhereverState.restore` (`RestoreInfo` / `RestoreJobInfo` / `RestoreProgressInfo` / `RestoreFailureInfo`) plus `startRestore()`, `cancelRestore()` and `reloadSession()`. Older clients degrade safely: they do not render the panel, and the server's refusal to accept their sends is what protects them.
33
+
34
+ Restoring ends in a RELOAD by design: whether a session has a live agent is a load-time decision, and the load that found the folder missing built none. See the new `CONTEXT.md` section and `docs/adr/0009`.
35
+
3
36
  ## 0.5.4
4
37
 
5
38
  ### Patch Changes
package/dist/client.d.ts CHANGED
@@ -20,10 +20,13 @@ export interface WhereverClientConfig {
20
20
  WebSocketCtor?: any;
21
21
  hideThinking?: boolean;
22
22
  hideTools?: boolean;
23
+ clientKey?: string;
24
+ onClientKeyChange?: (key: string) => void;
23
25
  }
24
26
  export declare class WhereverClient {
25
27
  private ws;
26
28
  private config;
29
+ private clientKey;
27
30
  stateStore: Writable<WhereverState>;
28
31
  private reconnectTimer;
29
32
  private agentEndTimeout;
@@ -95,6 +98,7 @@ export declare class WhereverClient {
95
98
  send(msg: any): boolean;
96
99
  private messageFrame;
97
100
  sendMessage(text: string, options?: SendMessageOptions): boolean;
101
+ private withRestoredQueuedMessages;
98
102
  private pendingKey;
99
103
  private persistPending;
100
104
  private loadPersistedPending;
@@ -104,12 +108,48 @@ export declare class WhereverClient {
104
108
  resendMessage(messageId: string, options?: SendMessageOptions): boolean;
105
109
  discardMessage(messageId: string): void;
106
110
  abort(): void;
111
+ reloadResources(): void;
107
112
  cancelSteer(): void;
113
+ /**
114
+ * Apply `mutate` to the restore state for `targetPath`, or ignore the frame.
115
+ *
116
+ * Restore frames are addressed by PATH (the server's job key) rather than by
117
+ * session id, because the server derives who gets them from a path match. This
118
+ * is where a frame for a folder this client is no longer looking at is dropped
119
+ * -- the one still in flight when the user switched sessions.
120
+ */
121
+ private withRestore;
108
122
  joinSession(sessionFile: string, cwd?: string, model?: string): void;
109
123
  switchSession(sessionFile: string, cwd?: string, model?: string): void;
110
124
  forkSession(sessionId: string, entryId: string): boolean;
111
125
  createSession(cwd: string, model?: string, gitInit?: boolean, createRemote?: boolean, repoVisibility?: 'private' | 'public', cloneRemote?: boolean): void;
112
126
  leaveSession(): void;
127
+ /**
128
+ * Ask the server to restore the folder of the folder-missing session this
129
+ * client is looking at: CLONE `url` into it, or CREATE it.
130
+ *
131
+ * The job is server-owned and keyed by that path, so this may well JOIN a job
132
+ * another device (or this client's previous, dropped socket) already started;
133
+ * the server's `restore_started` says which, and carries the url really in
134
+ * flight. Returns false when there is no missing folder to restore, or when a
135
+ * clone was asked for with no url.
136
+ */
137
+ startRestore(action: 'clone' | 'create', url?: string, gitInit?: boolean): boolean;
138
+ /**
139
+ * Cancel the restore running for this session's folder. The server settles the
140
+ * job authoritatively and broadcasts the `cancelled` completion to every client
141
+ * watching that folder (this one included), so no state is guessed here.
142
+ */
143
+ cancelRestore(): boolean;
144
+ /**
145
+ * Re-load the active session file.
146
+ *
147
+ * This is how a completed restore goes LIVE: whether a session has a live agent
148
+ * is a load-time decision, and the load that found the folder missing
149
+ * deliberately built none. Re-loading is therefore the honest way to get one,
150
+ * not a refresh hint. Returns false when there is no active session file.
151
+ */
152
+ reloadSession(): boolean;
113
153
  continueFolderConflict(): void;
114
154
  ping(): void;
115
155
  clearMessages(): void;