wherever-dev 0.18.3 → 0.18.5
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/dist/cli-bridge-extension.d.ts +51 -0
- package/dist/cli-bridge-extension.d.ts.map +1 -0
- package/dist/cli-bridge-extension.js +100 -0
- package/dist/cli-bridge-extension.js.map +1 -0
- package/dist/index.js +372 -33
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +22 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/server-process-marker.d.ts +28 -0
- package/dist/server-process-marker.d.ts.map +1 -0
- package/dist/server-process-marker.js +30 -0
- package/dist/server-process-marker.js.map +1 -0
- package/dist/session-pool.d.ts +25 -0
- package/dist/session-pool.d.ts.map +1 -1
- package/dist/session-pool.js +52 -1
- package/dist/session-pool.js.map +1 -1
- package/dist/upload-gate.d.ts +96 -0
- package/dist/upload-gate.d.ts.map +1 -0
- package/dist/upload-gate.js +109 -0
- package/dist/upload-gate.js.map +1 -0
- package/dist/upload-staging.d.ts +172 -0
- package/dist/upload-staging.d.ts.map +1 -0
- package/dist/upload-staging.js +368 -0
- package/dist/upload-staging.js.map +1 -0
- package/package.json +1 -1
- package/public/_app/immutable/assets/{0.BnOlDJL_.css → 0.Cb5vRzMp.css} +1 -1
- package/public/_app/immutable/chunks/{pzF36qD8.js → BdyEwvKM.js} +2 -2
- package/public/_app/immutable/chunks/{pzF36qD8.js.map → BdyEwvKM.js.map} +1 -1
- package/public/_app/immutable/chunks/{CxeW4bFU.js → BgfVtPUY.js} +2 -2
- package/public/_app/immutable/chunks/{CxeW4bFU.js.map → BgfVtPUY.js.map} +1 -1
- package/public/_app/immutable/chunks/CO_n26iD.js +2 -0
- package/public/_app/immutable/chunks/{BDyT5Iv7.js.map → CO_n26iD.js.map} +1 -1
- package/public/_app/immutable/entry/{app.fmRrIlrx.js → app.Cd34rZl-.js} +3 -3
- package/public/_app/immutable/entry/{app.fmRrIlrx.js.map → app.Cd34rZl-.js.map} +1 -1
- package/public/_app/immutable/entry/start.Cs0K02Bg.js +2 -0
- package/public/_app/immutable/entry/start.Cs0K02Bg.js.map +1 -0
- package/public/_app/immutable/nodes/{0.y9mNw2ua.js → 0.CbsSRnKE.js} +2 -2
- package/public/_app/immutable/nodes/{0.y9mNw2ua.js.map → 0.CbsSRnKE.js.map} +1 -1
- package/public/_app/immutable/nodes/{1.D0t3PhYs.js → 1.FIugR_jQ.js} +2 -2
- package/public/_app/immutable/nodes/{1.D0t3PhYs.js.map → 1.FIugR_jQ.js.map} +1 -1
- package/public/_app/immutable/nodes/2.B8lR6Ytl.js +120 -0
- package/public/_app/immutable/nodes/2.B8lR6Ytl.js.map +1 -0
- package/public/_app/version.json +1 -1
- package/public/index.html +11 -11
- package/public/service-worker.js +1 -1
- package/public/_app/immutable/chunks/BDyT5Iv7.js +0 -2
- package/public/_app/immutable/entry/start.CR5sFyDq.js +0 -2
- package/public/_app/immutable/entry/start.CR5sFyDq.js.map +0 -1
- package/public/_app/immutable/nodes/2.hfqxCQJf.js +0 -120
- package/public/_app/immutable/nodes/2.hfqxCQJf.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { LoadExtensionsResult } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
/**
|
|
3
|
+
* Keep the CLI BRIDGE extension out of server-built sessions.
|
|
4
|
+
*
|
|
5
|
+
* The bridge (`@wherever-dev/pi`, source in `extension/`) exists to connect a
|
|
6
|
+
* TERMINAL pi to this server. The server loads every extension in the user's pi
|
|
7
|
+
* settings for its own sessions (see extension-lifecycle.ts), and the normal
|
|
8
|
+
* install lists `npm:@wherever-dev/pi` there. Loaded in-process, the bridge's
|
|
9
|
+
* session_start connected back and registered the server's own session as a CLI
|
|
10
|
+
* bridge, `registerCliSession` took it over and shut the server agent down,
|
|
11
|
+
* session_shutdown disconnected the bridge, `unregisterCliSession` reloaded the
|
|
12
|
+
* session, and the loop repeated several times a second, aborting every turn with
|
|
13
|
+
* "CLI terminal disconnected". Nothing the bridge offers is needed in-process:
|
|
14
|
+
* the server registers its own attach_file / say tools and conversation-mode hook.
|
|
15
|
+
*/
|
|
16
|
+
/** The bridge's npm package name, the `name` in `extension/package.json`. */
|
|
17
|
+
export declare const CLI_BRIDGE_PACKAGE_NAME = "@wherever-dev/pi";
|
|
18
|
+
/**
|
|
19
|
+
* THE IDENTIFICATION RULE: an extension is the CLI bridge exactly when the
|
|
20
|
+
* NEAREST NAMED `package.json` enclosing its resolved entry file (symlinks
|
|
21
|
+
* resolved) has `"name": "@wherever-dev/pi"`. A package.json without a `name`
|
|
22
|
+
* is skipped, so a dual-build `dist/package.json` cannot hide the real one.
|
|
23
|
+
*
|
|
24
|
+
* - It follows the package, not how it was listed: `npm:@wherever-dev/pi`
|
|
25
|
+
* (…/node_modules/@wherever-dev/pi/dist/index.js), a git or local-path package,
|
|
26
|
+
* a direct file path to `extension/dist/index.js`, or the TypeScript source used
|
|
27
|
+
* in development all resolve inside that package.
|
|
28
|
+
* - It never matches on a substring such as "wherever": an unrelated extension
|
|
29
|
+
* in a `wherever-*` folder, or one whose package is merely named like us, has
|
|
30
|
+
* its own nearest package.json with a different name and keeps loading.
|
|
31
|
+
* - Only the NEAREST named package.json counts, so an extension that happens to
|
|
32
|
+
* sit somewhere below the bridge package (it would carry its own named
|
|
33
|
+
* package.json) is not swept up, and an extension with no package.json at all
|
|
34
|
+
* is not the bridge.
|
|
35
|
+
* - Inline extensions (`<inline…>` paths, the server's own factories) and paths
|
|
36
|
+
* that cannot be resolved on disk are never the bridge.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isCliBridgeExtensionPath(extensionPath: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* `DefaultResourceLoader` `extensionsOverride` for server sessions: the loaded
|
|
41
|
+
* set minus the CLI bridge (see `isCliBridgeExtensionPath` for the rule).
|
|
42
|
+
* Every other extension, and every load error, passes through untouched, so they
|
|
43
|
+
* keep the full lifecycle (session_start / session_shutdown).
|
|
44
|
+
*
|
|
45
|
+
* The bridge's factory has already RUN by the time this sees the result (pi
|
|
46
|
+
* loads, then offers the override); that is harmless because the bridge only
|
|
47
|
+
* registers handlers, flags, commands and tools at load and connects on
|
|
48
|
+
* session_start, which it never receives here.
|
|
49
|
+
*/
|
|
50
|
+
export declare function withoutCliBridgeExtension(base: LoadExtensionsResult): LoadExtensionsResult;
|
|
51
|
+
//# sourceMappingURL=cli-bridge-extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-bridge-extension.d.ts","sourceRoot":"","sources":["../src/cli-bridge-extension.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAyB1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CASvE;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,oBAAoB,GAAG,oBAAoB,CAY1F"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Keep the CLI BRIDGE extension out of server-built sessions.
|
|
5
|
+
*
|
|
6
|
+
* The bridge (`@wherever-dev/pi`, source in `extension/`) exists to connect a
|
|
7
|
+
* TERMINAL pi to this server. The server loads every extension in the user's pi
|
|
8
|
+
* settings for its own sessions (see extension-lifecycle.ts), and the normal
|
|
9
|
+
* install lists `npm:@wherever-dev/pi` there. Loaded in-process, the bridge's
|
|
10
|
+
* session_start connected back and registered the server's own session as a CLI
|
|
11
|
+
* bridge, `registerCliSession` took it over and shut the server agent down,
|
|
12
|
+
* session_shutdown disconnected the bridge, `unregisterCliSession` reloaded the
|
|
13
|
+
* session, and the loop repeated several times a second, aborting every turn with
|
|
14
|
+
* "CLI terminal disconnected". Nothing the bridge offers is needed in-process:
|
|
15
|
+
* the server registers its own attach_file / say tools and conversation-mode hook.
|
|
16
|
+
*/
|
|
17
|
+
/** The bridge's npm package name, the `name` in `extension/package.json`. */
|
|
18
|
+
export const CLI_BRIDGE_PACKAGE_NAME = '@wherever-dev/pi';
|
|
19
|
+
/**
|
|
20
|
+
* `name` of the nearest `package.json` at or above `startDir` that HAS a name,
|
|
21
|
+
* or undefined. A name-less package.json (a dual-build `dist/package.json` that
|
|
22
|
+
* only says `{"type":"module"}`) marks no package, so the walk goes past it.
|
|
23
|
+
*/
|
|
24
|
+
function nearestPackageName(startDir) {
|
|
25
|
+
let dir = startDir;
|
|
26
|
+
for (;;) {
|
|
27
|
+
const candidate = path.join(dir, 'package.json');
|
|
28
|
+
if (fs.existsSync(candidate)) {
|
|
29
|
+
try {
|
|
30
|
+
const name = JSON.parse(fs.readFileSync(candidate, 'utf8'))?.name;
|
|
31
|
+
if (typeof name === 'string' && name)
|
|
32
|
+
return name;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Unreadable or invalid: not a package boundary we can use; keep going.
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const parent = path.dirname(dir);
|
|
39
|
+
if (parent === dir)
|
|
40
|
+
return undefined;
|
|
41
|
+
dir = parent;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* THE IDENTIFICATION RULE: an extension is the CLI bridge exactly when the
|
|
46
|
+
* NEAREST NAMED `package.json` enclosing its resolved entry file (symlinks
|
|
47
|
+
* resolved) has `"name": "@wherever-dev/pi"`. A package.json without a `name`
|
|
48
|
+
* is skipped, so a dual-build `dist/package.json` cannot hide the real one.
|
|
49
|
+
*
|
|
50
|
+
* - It follows the package, not how it was listed: `npm:@wherever-dev/pi`
|
|
51
|
+
* (…/node_modules/@wherever-dev/pi/dist/index.js), a git or local-path package,
|
|
52
|
+
* a direct file path to `extension/dist/index.js`, or the TypeScript source used
|
|
53
|
+
* in development all resolve inside that package.
|
|
54
|
+
* - It never matches on a substring such as "wherever": an unrelated extension
|
|
55
|
+
* in a `wherever-*` folder, or one whose package is merely named like us, has
|
|
56
|
+
* its own nearest package.json with a different name and keeps loading.
|
|
57
|
+
* - Only the NEAREST named package.json counts, so an extension that happens to
|
|
58
|
+
* sit somewhere below the bridge package (it would carry its own named
|
|
59
|
+
* package.json) is not swept up, and an extension with no package.json at all
|
|
60
|
+
* is not the bridge.
|
|
61
|
+
* - Inline extensions (`<inline…>` paths, the server's own factories) and paths
|
|
62
|
+
* that cannot be resolved on disk are never the bridge.
|
|
63
|
+
*/
|
|
64
|
+
export function isCliBridgeExtensionPath(extensionPath) {
|
|
65
|
+
if (!extensionPath || extensionPath.startsWith('<'))
|
|
66
|
+
return false;
|
|
67
|
+
let resolved;
|
|
68
|
+
try {
|
|
69
|
+
resolved = fs.realpathSync(extensionPath);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return nearestPackageName(path.dirname(resolved)) === CLI_BRIDGE_PACKAGE_NAME;
|
|
75
|
+
}
|
|
76
|
+
let loggedExclusion = false;
|
|
77
|
+
/**
|
|
78
|
+
* `DefaultResourceLoader` `extensionsOverride` for server sessions: the loaded
|
|
79
|
+
* set minus the CLI bridge (see `isCliBridgeExtensionPath` for the rule).
|
|
80
|
+
* Every other extension, and every load error, passes through untouched, so they
|
|
81
|
+
* keep the full lifecycle (session_start / session_shutdown).
|
|
82
|
+
*
|
|
83
|
+
* The bridge's factory has already RUN by the time this sees the result (pi
|
|
84
|
+
* loads, then offers the override); that is harmless because the bridge only
|
|
85
|
+
* registers handlers, flags, commands and tools at load and connects on
|
|
86
|
+
* session_start, which it never receives here.
|
|
87
|
+
*/
|
|
88
|
+
export function withoutCliBridgeExtension(base) {
|
|
89
|
+
// `resolvedPath` is always set by pi: absolute for files (resolved against the
|
|
90
|
+
// session cwd), `<inline…>` for factories. `path` may be relative, so never use it.
|
|
91
|
+
const extensions = base.extensions.filter((ext) => !isCliBridgeExtensionPath(ext.resolvedPath));
|
|
92
|
+
if (extensions.length === base.extensions.length)
|
|
93
|
+
return base;
|
|
94
|
+
if (!loggedExclusion) {
|
|
95
|
+
loggedExclusion = true;
|
|
96
|
+
console.log(`[wherever] not loading the CLI bridge extension (${CLI_BRIDGE_PACKAGE_NAME}) in server sessions; it only runs inside a terminal pi`);
|
|
97
|
+
}
|
|
98
|
+
return { ...base, extensions };
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=cli-bridge-extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-bridge-extension.js","sourceRoot":"","sources":["../src/cli-bridge-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;;;;;;;;;;GAaG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAE1D;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,QAAgB;IAC1C,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,SAAS,CAAC;QACR,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,MAAM,IAAI,GAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAwB,EAAE,IAAI,CAAC;gBAC1F,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI;oBAAE,OAAO,IAAI,CAAC;YACpD,CAAC;YAAC,MAAM,CAAC;gBACP,wEAAwE;YAC1E,CAAC;QACH,CAAC;QACD,MAAM,MAAM,G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