wherever-dev 0.18.5 → 0.19.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 +1180 -0
- package/README.md +60 -0
- package/dist/builtin-extensions.d.ts +28 -0
- package/dist/builtin-extensions.d.ts.map +1 -0
- package/dist/builtin-extensions.js +28 -0
- package/dist/builtin-extensions.js.map +1 -0
- package/dist/config-dir.d.ts +13 -0
- package/dist/config-dir.d.ts.map +1 -0
- package/dist/config-dir.js +18 -0
- package/dist/config-dir.js.map +1 -0
- package/dist/extension-lifecycle.d.ts +3 -2
- package/dist/extension-lifecycle.d.ts.map +1 -1
- package/dist/extension-lifecycle.js +8 -4
- package/dist/extension-lifecycle.js.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/pi-sdk-policy.d.ts +91 -0
- package/dist/pi-sdk-policy.d.ts.map +1 -0
- package/dist/pi-sdk-policy.js +173 -0
- package/dist/pi-sdk-policy.js.map +1 -0
- package/dist/pi-sdk.d.ts +56 -0
- package/dist/pi-sdk.d.ts.map +1 -0
- package/dist/pi-sdk.js +124 -0
- package/dist/pi-sdk.js.map +1 -0
- package/dist/protocol.d.ts +1 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/session-pool.d.ts +31 -12
- package/dist/session-pool.d.ts.map +1 -1
- package/dist/session-pool.js +71 -36
- package/dist/session-pool.js.map +1 -1
- package/package.json +32 -10
- package/public/_app/immutable/chunks/{BdyEwvKM.js → Be584n9t.js} +2 -2
- package/public/_app/immutable/chunks/{BdyEwvKM.js.map → Be584n9t.js.map} +1 -1
- package/public/_app/immutable/chunks/CDh6N9EK.js +2 -0
- package/public/_app/immutable/chunks/{CO_n26iD.js.map → CDh6N9EK.js.map} +1 -1
- package/public/_app/immutable/chunks/{BgfVtPUY.js → CHdncqe4.js} +2 -2
- package/public/_app/immutable/chunks/{BgfVtPUY.js.map → CHdncqe4.js.map} +1 -1
- package/public/_app/immutable/entry/{app.Cd34rZl-.js → app.Bvi1whhV.js} +3 -3
- package/public/_app/immutable/entry/{app.Cd34rZl-.js.map → app.Bvi1whhV.js.map} +1 -1
- package/public/_app/immutable/entry/start.DrBMY1f9.js +2 -0
- package/public/_app/immutable/entry/start.DrBMY1f9.js.map +1 -0
- package/public/_app/immutable/nodes/{0.CbsSRnKE.js → 0.BXOlI-1A.js} +2 -2
- package/public/_app/immutable/nodes/{0.CbsSRnKE.js.map → 0.BXOlI-1A.js.map} +1 -1
- package/public/_app/immutable/nodes/{1.FIugR_jQ.js → 1.Dw59rM0a.js} +2 -2
- package/public/_app/immutable/nodes/{1.FIugR_jQ.js.map → 1.Dw59rM0a.js.map} +1 -1
- package/public/_app/immutable/nodes/{2.B8lR6Ytl.js → 2.B4mmUgEN.js} +18 -18
- package/public/_app/immutable/nodes/2.B4mmUgEN.js.map +1 -0
- package/public/_app/version.json +1 -1
- package/public/index.html +10 -10
- package/public/service-worker.js +1 -1
- package/public/_app/immutable/chunks/CO_n26iD.js +0 -2
- package/public/_app/immutable/entry/start.Cs0K02Bg.js +0 -2
- package/public/_app/immutable/entry/start.Cs0K02Bg.js.map +0 -1
- package/public/_app/immutable/nodes/2.B8lR6Ytl.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# wherever-dev
|
|
2
|
+
|
|
3
|
+
The standalone server of [Wherever](https://wherever.dev): drive several [pi coding agent](https://pi.dev) sessions from a web dashboard on your phone, tablet or any browser, and keep a terminal `pi` in sync with them.
|
|
4
|
+
|
|
5
|
+
The server runs pi sessions in-process through the pi SDK and serves the web dashboard, so you do not need the `pi` CLI to use it. Install [`@wherever-dev/pi`](https://www.npmjs.com/package/@wherever-dev/pi) into pi as well if you also want terminal sessions mirrored to the dashboard (bridge mode).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Many concurrent sessions across your project folders, created, resumed and forked from the browser.
|
|
10
|
+
- A mobile-first dashboard (installable as a PWA): streaming replies, tool calls, model switching, `!` / `!!` shell commands, file and image uploads, downloads of files the agent attaches.
|
|
11
|
+
- Voice dictation and optional spoken replies.
|
|
12
|
+
- Native MCP: the servers in `~/.pi/agent/mcp.json` are available in web sessions, as in a terminal pi.
|
|
13
|
+
- Live hand-over with a terminal `pi` (through `@wherever-dev/pi`).
|
|
14
|
+
- Runs as a background service (systemd or launchd) with token auth and HTTPS.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Requires Node.js 22.19 or later.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g wherever-dev
|
|
22
|
+
wherever start
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then open `https://localhost:31415`. The server generates a self-signed certificate on first start (this needs `openssl`; without it the server falls back to plain HTTP), so the browser will warn once.
|
|
26
|
+
|
|
27
|
+
To run it as a service that starts with your session and restarts on failure:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
wherever install # per-user systemd unit (Linux) or LaunchAgent (macOS)
|
|
31
|
+
wherever service-status
|
|
32
|
+
wherever uninstall
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`wherever install` also adds `@wherever-dev/pi` to `~/.pi/agent/settings.json` (skip with `--no-pi-config`).
|
|
36
|
+
|
|
37
|
+
## Common options
|
|
38
|
+
|
|
39
|
+
| Flag | Environment | Default |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `--port` | `PI_REMOTE_PORT` | `31415` |
|
|
42
|
+
| `--host` | `PI_REMOTE_HOST` | `127.0.0.1` (use `0.0.0.0` to expose it) |
|
|
43
|
+
| `--token` | `WHEREVER_TOKEN`, `WHEREVER_TOKEN_FILE` | none |
|
|
44
|
+
| `--ssl-key` / `--ssl-cert` | `WHEREVER_SSL_KEY` / `WHEREVER_SSL_CERT` | auto-generated self-signed pair |
|
|
45
|
+
| `--no-ssl` (or `--http`) | `PI_REMOTE_NO_SSL` | HTTPS on |
|
|
46
|
+
| `--idle-timeout` | `PI_IDLE_TIMEOUT` | 20 minutes |
|
|
47
|
+
|
|
48
|
+
Prefer `WHEREVER_TOKEN` or `WHEREVER_TOKEN_FILE` over `--token` on a shared machine: a command line is readable by every user. Open `https://<host>:31415/#token=<token>` once on a device to log it in.
|
|
49
|
+
|
|
50
|
+
## Configuration
|
|
51
|
+
|
|
52
|
+
`~/.wherever/config.json` (override the directory with `WHEREVER_CONFIG_DIR`) holds the rest: preset folders, automatic remote repository creation, uploads, downloads, speech-to-text, the dashboard's per-machine appearance, and `piSdk`, which lets web sessions run on the pi you use in a terminal instead of the bundled SDK.
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
The [full documentation](https://github.com/wighawag/wherever#readme) covers every flag and configuration property, reverse proxies and trusted HTTPS (Tailscale, Tunnet), the service's memory limits and `PATH`, updating, and declarative deployment on NixOS.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
[AGPL-3.0-only](https://github.com/wighawag/wherever/blob/main/LICENSE)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InlineExtension } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
/**
|
|
3
|
+
* pi's BUILT-IN extensions (native MCP, codemode, tool search, plus llama.cpp
|
|
4
|
+
* when the SDK install provides its own list) for server-created sessions.
|
|
5
|
+
*
|
|
6
|
+
* The pi CLI loads them on its own (`builtInExtensions` in its main entry), but
|
|
7
|
+
* the SDK does not: "SDK sessions do not load built-in extensions". Without
|
|
8
|
+
* this, a web session would have no MCP at all even though the same user's
|
|
9
|
+
* terminal pi connects every server in `mcp.json`.
|
|
10
|
+
*
|
|
11
|
+
* They come from the SAME install as the rest of the SDK (pi-sdk.ts), as that
|
|
12
|
+
* install's CLI defines them: `builtin: true` entries, so they behave as in a
|
|
13
|
+
* terminal pi:
|
|
14
|
+
* - they load as `builtin:<name>` extension paths, so `-builtin:mcp` (or any
|
|
15
|
+
* other name) in the `extensions` setting, i.e. `pi config` > Built-in,
|
|
16
|
+
* turns them off for web sessions too;
|
|
17
|
+
* - `replaceable: true`: an installed extension that registers `/mcp`,
|
|
18
|
+
* `codemode` or `tool_search` (pi-mcp-adapter, say) takes over instead of
|
|
19
|
+
* both loading with a conflict, as in the CLI.
|
|
20
|
+
*
|
|
21
|
+
* Every factory keeps its state inside the `(pi) => ...` call, so one entry is
|
|
22
|
+
* safely shared by every session: each session build gets its own instance.
|
|
23
|
+
* The MCP extension connects its servers on `session_start`, which
|
|
24
|
+
* `bindServerSessionExtensions()` emits, and closes them on
|
|
25
|
+
* `session_shutdown`, which `shutdownAndDisposeAgentSession()` emits.
|
|
26
|
+
*/
|
|
27
|
+
export declare const serverBuiltinExtensions: readonly InlineExtension[];
|
|
28
|
+
//# sourceMappingURL=builtin-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-extensions.d.ts","sourceRoot":"","sources":["../src/builtin-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGvE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,eAAe,EAAwB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { piBuiltinExtensions } from './pi-sdk.js';
|
|
2
|
+
/**
|
|
3
|
+
* pi's BUILT-IN extensions (native MCP, codemode, tool search, plus llama.cpp
|
|
4
|
+
* when the SDK install provides its own list) for server-created sessions.
|
|
5
|
+
*
|
|
6
|
+
* The pi CLI loads them on its own (`builtInExtensions` in its main entry), but
|
|
7
|
+
* the SDK does not: "SDK sessions do not load built-in extensions". Without
|
|
8
|
+
* this, a web session would have no MCP at all even though the same user's
|
|
9
|
+
* terminal pi connects every server in `mcp.json`.
|
|
10
|
+
*
|
|
11
|
+
* They come from the SAME install as the rest of the SDK (pi-sdk.ts), as that
|
|
12
|
+
* install's CLI defines them: `builtin: true` entries, so they behave as in a
|
|
13
|
+
* terminal pi:
|
|
14
|
+
* - they load as `builtin:<name>` extension paths, so `-builtin:mcp` (or any
|
|
15
|
+
* other name) in the `extensions` setting, i.e. `pi config` > Built-in,
|
|
16
|
+
* turns them off for web sessions too;
|
|
17
|
+
* - `replaceable: true`: an installed extension that registers `/mcp`,
|
|
18
|
+
* `codemode` or `tool_search` (pi-mcp-adapter, say) takes over instead of
|
|
19
|
+
* both loading with a conflict, as in the CLI.
|
|
20
|
+
*
|
|
21
|
+
* Every factory keeps its state inside the `(pi) => ...` call, so one entry is
|
|
22
|
+
* safely shared by every session: each session build gets its own instance.
|
|
23
|
+
* The MCP extension connects its servers on `session_start`, which
|
|
24
|
+
* `bindServerSessionExtensions()` emits, and closes them on
|
|
25
|
+
* `session_shutdown`, which `shutdownAndDisposeAgentSession()` emits.
|
|
26
|
+
*/
|
|
27
|
+
export const serverBuiltinExtensions = piBuiltinExtensions;
|
|
28
|
+
//# sourceMappingURL=builtin-extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-extensions.js","sourceRoot":"","sources":["../src/builtin-extensions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA+B,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directory holding `config.json`. `WHEREVER_CONFIG_DIR` overrides the default
|
|
3
|
+
* `~/.wherever` so a test server can run in FULL isolation (ADR 0001): without
|
|
4
|
+
* it, an isolated harness still reads the developer's real config, so e.g. a
|
|
5
|
+
* personal `sessions.ignore: ["/tmp/**"]` silently hid the harness's own
|
|
6
|
+
* temp-dir sessions from /sessions.
|
|
7
|
+
*
|
|
8
|
+
* Its own module (re-exported by session-pool.ts) because `pi-sdk.ts` reads
|
|
9
|
+
* the config BEFORE session-pool.ts can load: session-pool imports the SDK
|
|
10
|
+
* that pi-sdk.ts picks.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getWhereverConfigDir(): string;
|
|
13
|
+
//# sourceMappingURL=config-dir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-dir.d.ts","sourceRoot":"","sources":["../src/config-dir.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Directory holding `config.json`. `WHEREVER_CONFIG_DIR` overrides the default
|
|
5
|
+
* `~/.wherever` so a test server can run in FULL isolation (ADR 0001): without
|
|
6
|
+
* it, an isolated harness still reads the developer's real config, so e.g. a
|
|
7
|
+
* personal `sessions.ignore: ["/tmp/**"]` silently hid the harness's own
|
|
8
|
+
* temp-dir sessions from /sessions.
|
|
9
|
+
*
|
|
10
|
+
* Its own module (re-exported by session-pool.ts) because `pi-sdk.ts` reads
|
|
11
|
+
* the config BEFORE session-pool.ts can load: session-pool imports the SDK
|
|
12
|
+
* that pi-sdk.ts picks.
|
|
13
|
+
*/
|
|
14
|
+
export function getWhereverConfigDir() {
|
|
15
|
+
const override = process.env.WHEREVER_CONFIG_DIR;
|
|
16
|
+
return override && override.trim() ? path.resolve(override.trim()) : path.join(os.homedir(), '.wherever');
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=config-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-dir.js","sourceRoot":"","sources":["../src/config-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IACjD,OAAO,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -31,8 +31,9 @@ import type { AgentSession } from '@earendil-works/pi-coding-agent';
|
|
|
31
31
|
* rebuilds with a FRESH loader (see SessionPool.reloadSession), whose first
|
|
32
32
|
* `reload()` does not clear, so without this the rebuilt agent silently runs the
|
|
33
33
|
* old code. `clearExtensionCache` is not in the package's `exports` map, so it is
|
|
34
|
-
* reached through the module file
|
|
35
|
-
*
|
|
34
|
+
* reached through the module file inside the package the server runs on
|
|
35
|
+
* (`piSdkInfo.root`, see pi-sdk.ts); it is the same module instance that SDK
|
|
36
|
+
* uses (same URL). If a future SDK moves it, reload
|
|
36
37
|
* still works for settings, skills, prompts and context files, and this logs
|
|
37
38
|
* why extension edits were not picked up. Pinned by test/session-reload-ws.test.ts.
|
|
38
39
|
* Clearing is safe for other sessions: their next build just reloads from disk.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-lifecycle.d.ts","sourceRoot":"","sources":["../src/extension-lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension-lifecycle.d.ts","sourceRoot":"","sources":["../src/extension-lifecycle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,iCAAiC,CAAC;AAGpF;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAa3D;AAED,qFAAqF;AACrF,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,KAAK,iBAAiB,GAAG,UAAU,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAWvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAmBpG;AAED,2GAA2G;AAC3G,wBAAsB,2BAA2B,CAC/C,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,WAAW,SAA+B,GACzC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;;GAMG;AACH,wBAAsB,8BAA8B,CAClD,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,SAAS,SAAgC,EACzC,MAAM,GAAE,MAAM,GAAG,QAAiB,GACjC,OAAO,CAAC,IAAI,CAAC,CAoCf"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import { piSdkInfo } from './pi-sdk.js';
|
|
1
4
|
/**
|
|
2
5
|
* The pi EXTENSION LIFECYCLE for server-created sessions.
|
|
3
6
|
*
|
|
@@ -30,16 +33,17 @@
|
|
|
30
33
|
* rebuilds with a FRESH loader (see SessionPool.reloadSession), whose first
|
|
31
34
|
* `reload()` does not clear, so without this the rebuilt agent silently runs the
|
|
32
35
|
* old code. `clearExtensionCache` is not in the package's `exports` map, so it is
|
|
33
|
-
* reached through the module file
|
|
34
|
-
*
|
|
36
|
+
* reached through the module file inside the package the server runs on
|
|
37
|
+
* (`piSdkInfo.root`, see pi-sdk.ts); it is the same module instance that SDK
|
|
38
|
+
* uses (same URL). If a future SDK moves it, reload
|
|
35
39
|
* still works for settings, skills, prompts and context files, and this logs
|
|
36
40
|
* why extension edits were not picked up. Pinned by test/session-reload-ws.test.ts.
|
|
37
41
|
* Clearing is safe for other sessions: their next build just reloads from disk.
|
|
38
42
|
*/
|
|
39
43
|
export async function clearPiExtensionCache() {
|
|
40
44
|
try {
|
|
41
|
-
const
|
|
42
|
-
const loader = (await import(
|
|
45
|
+
const loaderFile = path.join(piSdkInfo.root, 'dist', 'core', 'extensions', 'loader.js');
|
|
46
|
+
const loader = (await import(pathToFileURL(loaderFile).href));
|
|
43
47
|
if (typeof loader.clearExtensionCache !== 'function')
|
|
44
48
|
throw new Error('clearExtensionCache not found');
|
|
45
49
|
loader.clearExtensionCache();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-lifecycle.js","sourceRoot":"","sources":["../src/extension-lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension-lifecycle.js","sourceRoot":"","sources":["../src/extension-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;QACxF,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAE3D,CAAC;QACF,IAAI,OAAO,MAAM,CAAC,mBAAmB,KAAK,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACvG,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAA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AC;IACD,IAAI,CAAC;QACH,2EAA2E;QAC3E,mCAAmC;QACnC,MAAM,MAAM,GAAG,YAAY,CAAC,eAAe,CAAC;QAC5C,IAAI,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAC3C,IAAI,KAAgD,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;gBAClC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;gBACnE,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,EAAE;oBAC/B,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;gBACrD,CAAC,CAAC;aACH,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YACtC,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,6CAA6C,KAAK,aAAa,SAAS,sBAAsB,CAAC,CAAC;YAChH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,sFAAsF;QACtF,OAAO,CAAC,KAAK,CAAC,0CAA0C,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,CAAC;QACH,YAAY,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,iCAAiC,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { connect as netConnect } from 'node:net';
|
|
|
5
5
|
import { WebSocketServer, WebSocket } from 'ws';
|
|
6
6
|
import { SessionPool, RELOADING_REFUSAL, getWhereverConfig, getWhereverCertsDir, getWhereverStateDir, detectRemoteRepo, normalizePath, invalidateFolderExistence } from './session-pool.js';
|
|
7
7
|
import { readDrafts, addDraft, deleteDraft, validateDraftInput } from './drafts.js';
|
|
8
|
+
import { piSdkInfo } from './pi-sdk.js';
|
|
8
9
|
import { searchConversations } from './conversation-search.js';
|
|
9
10
|
import { matchRemoteRepoRule, resolveRemoteCandidates } from './remote-candidates.js';
|
|
10
11
|
import { RestoreJobRegistry } from './restore-jobs.js';
|
|
@@ -879,6 +880,8 @@ function sendThenTerminate(ws, msg, flushTimeoutMs = 1_000) {
|
|
|
879
880
|
async function main() {
|
|
880
881
|
const { port, host, socket, token, tokenSource, idleTimeout, sslKey, sslCert, noSsl, httpLocalhostFallbackPort, debug } = parseArgs();
|
|
881
882
|
debugEnabled = debug;
|
|
883
|
+
console.log(`[wherever] pi SDK ${piSdkInfo.version}: ` +
|
|
884
|
+
(piSdkInfo.tier === 'bundled' ? `bundled (${piSdkInfo.why})` : `${piSdkInfo.tier}, from ${piSdkInfo.root} (${piSdkInfo.why})`));
|
|
882
885
|
const sessionPool = new SessionPool(idleTimeout);
|
|
883
886
|
await sessionPool.initialize();
|
|
884
887
|
// Abandoned partial uploads (untouched for 24 h) are collected at startup and
|
|
@@ -1277,7 +1280,7 @@ async function main() {
|
|
|
1277
1280
|
return;
|
|
1278
1281
|
}
|
|
1279
1282
|
if (pathname === '/models' && req.method === 'GET') {
|
|
1280
|
-
const models = sessionPool.getAvailableModels();
|
|
1283
|
+
const models = await sessionPool.getAvailableModels();
|
|
1281
1284
|
sendJSON(res, 200, { models });
|
|
1282
1285
|
return;
|
|
1283
1286
|
}
|
|
@@ -1361,7 +1364,7 @@ async function main() {
|
|
|
1361
1364
|
// (folder-local harness/pi config wins), so the search composer can seed its
|
|
1362
1365
|
// model picker with the folder default rather than the server global.
|
|
1363
1366
|
const searchDefaultModel = searchFolder
|
|
1364
|
-
? sessionPool.getDefaultModelFor(searchFolder)
|
|
1367
|
+
? await sessionPool.getDefaultModelFor(searchFolder)
|
|
1365
1368
|
: null;
|
|
1366
1369
|
// The label defaults to the machine hostname so two servers sharing the
|
|
1367
1370
|
// same sessions over cloned folders are distinguishable with zero config.
|
|
@@ -2208,7 +2211,7 @@ async function main() {
|
|
|
2208
2211
|
ws.on('message', () => {
|
|
2209
2212
|
missedPings.set(ws, 0);
|
|
2210
2213
|
});
|
|
2211
|
-
sendWS(ws, { type: 'connected', clientId, serverVersion: getVersion(), capabilities: [UPLOAD_CAPABILITY] });
|
|
2214
|
+
sendWS(ws, { type: 'connected', clientId, serverVersion: getVersion(), capabilities: [UPLOAD_CAPABILITY], piVersion: piSdkInfo.version });
|
|
2212
2215
|
ws.on('message', async (data, isBinary) => {
|
|
2213
2216
|
// Binary frames are upload chunks (`upload.v1`), routed BEFORE any
|
|
2214
2217
|
// JSON.parse: a chunk is raw bytes, never text. A binary frame that does not
|