@wherever-dev/client 0.5.3 → 0.6.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,42 @@
1
1
  # @wherever-dev/client
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 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.
8
+
9
+ 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.
10
+ - **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.
11
+ - **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.
12
+ - **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.
13
+ - **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.
14
+ - **`POST /session/new` takes the same branch** for `cloneRemote`, gaining recursion; having no progress channel, it simply waits for the job.
15
+ - **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.
16
+ - 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".
17
+
18
+ - 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.
19
+
20
+ 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.
21
+ - **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.
22
+ - **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.
23
+ - **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".
24
+ - **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.
25
+ - **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.
26
+ - 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.
27
+
28
+ 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`.
29
+
30
+ ## 0.5.4
31
+
32
+ ### Patch Changes
33
+
34
+ - fcd3d23: Make conversation mode's spoken reply actually happen: the agent is now TOLD, per turn, that a spoken conversation is active, so it adds a short `say` reply to its written answer instead of staying silent. "Conversation mode is on" only ever lived in the web client, and a dictated message is byte-identical to a typed one, so the agent had no signal and (following the `say` tool's own guidance) defaulted to not speaking, which made the feature inert unless the user nagged it every turn.
35
+
36
+ The signal is an OPTIONAL `conversationMode` boolean FIELD on the EXISTING `message` WebSocket payload (no new message type, no new chat role; an absent field means false, so older clients keep working). The web app stamps it, on both the send and the resend path, only when the master `conversationMode` AND `speakReplies` knobs are both active. For a turn whose message carried the flag, a `before_agent_start` hook APPENDS one line to the assembled system prompt asking for a short spoken `say` reply in addition to the written answer; the hint is per-turn (the mode can flip mid-session) and ephemeral (it is a system-prompt addition, so the user's message is preserved verbatim, nothing extra renders on web or CLI, and only the resulting `say` call is visible). It is wired for BOTH session types, mirroring the `say` tool's dual registration: an inline pi extension on the server's own agent sessions, and a `pi.on("before_agent_start", ...)` handler in the `@wherever-dev/pi` extension fed by the flag relayed on `cli_message`, so a bridged terminal session driven from a phone speaks too. With conversation mode (or speak-replies) off, no flag is sent, nothing is injected, and behaviour is exactly as before.
37
+
38
+ The `say` tool description/guidelines (server and extension, in lockstep) no longer tell the agent to stay silent when "the user is typing", which was the instruction fighting the feature; `say` is now framed as an additive short spoken layer for an active spoken conversation.
39
+
3
40
  ## 0.5.3
4
41
 
5
42
  ### Patch Changes
package/dist/client.d.ts CHANGED
@@ -1,5 +1,17 @@
1
1
  import { type Writable } from "sveltore";
2
2
  import { type WhereverState } from "./types.js";
3
+ /**
4
+ * Per-send options for a user message.
5
+ *
6
+ * `conversationMode` is the per-turn CONVERSATION-MODE SIGNAL: true means a spoken
7
+ * conversation is active for this send (the web app stamps it when its
8
+ * conversation-mode AND speak-replies knobs are both active), so the agent adds a
9
+ * short spoken `say` reply alongside its written answer. Omitted/false means off,
10
+ * which is exactly the pre-existing behaviour.
11
+ */
12
+ export interface SendMessageOptions {
13
+ conversationMode?: boolean;
14
+ }
3
15
  export interface WhereverClientConfig {
4
16
  host: string;
5
17
  port: number | string;
@@ -8,10 +20,13 @@ export interface WhereverClientConfig {
8
20
  WebSocketCtor?: any;
9
21
  hideThinking?: boolean;
10
22
  hideTools?: boolean;
23
+ clientKey?: string;
24
+ onClientKeyChange?: (key: string) => void;
11
25
  }
12
26
  export declare class WhereverClient {
13
27
  private ws;
14
28
  private config;
29
+ private clientKey;
15
30
  stateStore: Writable<WhereverState>;
16
31
  private reconnectTimer;
17
32
  private agentEndTimeout;
@@ -81,22 +96,59 @@ export declare class WhereverClient {
81
96
  */
82
97
  loadMoreHistory(): void;
83
98
  send(msg: any): boolean;
84
- sendMessage(text: string): boolean;
99
+ private messageFrame;
100
+ sendMessage(text: string, options?: SendMessageOptions): boolean;
101
+ private withRestoredQueuedMessages;
85
102
  private pendingKey;
86
103
  private persistPending;
87
104
  private loadPersistedPending;
88
105
  private armConfirm;
89
106
  private clearConfirm;
90
107
  private confirmDeliveredByContent;
91
- resendMessage(messageId: string): boolean;
108
+ resendMessage(messageId: string, options?: SendMessageOptions): boolean;
92
109
  discardMessage(messageId: string): void;
93
110
  abort(): void;
94
111
  cancelSteer(): void;
112
+ /**
113
+ * Apply `mutate` to the restore state for `targetPath`, or ignore the frame.
114
+ *
115
+ * Restore frames are addressed by PATH (the server's job key) rather than by
116
+ * session id, because the server derives who gets them from a path match. This
117
+ * is where a frame for a folder this client is no longer looking at is dropped
118
+ * -- the one still in flight when the user switched sessions.
119
+ */
120
+ private withRestore;
95
121
  joinSession(sessionFile: string, cwd?: string, model?: string): void;
96
122
  switchSession(sessionFile: string, cwd?: string, model?: string): void;
97
123
  forkSession(sessionId: string, entryId: string): boolean;
98
124
  createSession(cwd: string, model?: string, gitInit?: boolean, createRemote?: boolean, repoVisibility?: 'private' | 'public', cloneRemote?: boolean): void;
99
125
  leaveSession(): void;
126
+ /**
127
+ * Ask the server to restore the folder of the folder-missing session this
128
+ * client is looking at: CLONE `url` into it, or CREATE it.
129
+ *
130
+ * The job is server-owned and keyed by that path, so this may well JOIN a job
131
+ * another device (or this client's previous, dropped socket) already started;
132
+ * the server's `restore_started` says which, and carries the url really in
133
+ * flight. Returns false when there is no missing folder to restore, or when a
134
+ * clone was asked for with no url.
135
+ */
136
+ startRestore(action: 'clone' | 'create', url?: string, gitInit?: boolean): boolean;
137
+ /**
138
+ * Cancel the restore running for this session's folder. The server settles the
139
+ * job authoritatively and broadcasts the `cancelled` completion to every client
140
+ * watching that folder (this one included), so no state is guessed here.
141
+ */
142
+ cancelRestore(): boolean;
143
+ /**
144
+ * Re-load the active session file.
145
+ *
146
+ * This is how a completed restore goes LIVE: whether a session has a live agent
147
+ * is a load-time decision, and the load that found the folder missing
148
+ * deliberately built none. Re-loading is therefore the honest way to get one,
149
+ * not a refresh hint. Returns false when there is no active session file.
150
+ */
151
+ reloadSession(): boolean;
100
152
  continueFolderConflict(): void;
101
153
  ping(): void;
102
154
  clearMessages(): void;