pi-landstrip 0.19.0 → 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/dist/index.ts +1 -1
- package/dist/worker-auth-entry.js +28 -25
- package/package.json +5 -5
package/dist/index.ts
CHANGED
|
@@ -4897,7 +4897,7 @@ ${catalog.diagnostics.join(`
|
|
|
4897
4897
|
const workerExtensions = this.integration.getWorkerExtensions?.() ?? [];
|
|
4898
4898
|
const workerEntry = join7(packageDir, existsSync5(join7(packageDir, "worker-auth-entry.js")) ? "worker-auth-entry.js" : "worker-auth-entry.ts");
|
|
4899
4899
|
const args = [
|
|
4900
|
-
...endpoint.resolveAuth ? [workerEntry] : invocation.args,
|
|
4900
|
+
...endpoint.resolveAuth ? ["--experimental-import-meta-resolve", workerEntry, ...invocation.args] : invocation.args,
|
|
4901
4901
|
"--mode",
|
|
4902
4902
|
"rpc",
|
|
4903
4903
|
"--offline",
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
// worker-auth-entry.ts
|
|
2
2
|
import { Socket } from "node:net";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
createAgentSessionFromServices,
|
|
7
|
-
createAgentSessionRuntime,
|
|
8
|
-
createAgentSessionServices,
|
|
9
|
-
getAgentDir,
|
|
10
|
-
ModelRuntime as ModelRuntime2,
|
|
11
|
-
parseArgs,
|
|
12
|
-
runRpcMode,
|
|
13
|
-
SessionManager,
|
|
14
|
-
SettingsManager
|
|
15
|
-
} from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { isAbsolute, resolve } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
16
5
|
import { EnvHttpProxyAgent, install, setGlobalDispatcher } from "undici";
|
|
17
6
|
|
|
18
7
|
// worker-auth-channel.ts
|
|
@@ -167,9 +156,7 @@ class WorkerAuthClient {
|
|
|
167
156
|
}
|
|
168
157
|
|
|
169
158
|
// worker-auth-runtime.ts
|
|
170
|
-
|
|
171
|
-
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
172
|
-
async function createWorkerAuthRuntime(catalog, model, resolveAuth) {
|
|
159
|
+
async function createWorkerAuthRuntime(catalog, runtime, model, resolveAuth) {
|
|
173
160
|
if (!catalog.getProvider(model.provider)) {
|
|
174
161
|
catalog.registerProvider(model.provider, {
|
|
175
162
|
baseUrl: model.baseUrl,
|
|
@@ -180,12 +167,6 @@ async function createWorkerAuthRuntime(catalog, model, resolveAuth) {
|
|
|
180
167
|
const provider = catalog.getProvider(model.provider);
|
|
181
168
|
if (!provider)
|
|
182
169
|
throw new Error("Subagent provider is unavailable in the worker");
|
|
183
|
-
const runtime = await ModelRuntime.create({
|
|
184
|
-
credentials: new InMemoryCredentialStore,
|
|
185
|
-
modelsPath: null,
|
|
186
|
-
allowModelNetwork: false,
|
|
187
|
-
refreshOnCreate: false
|
|
188
|
-
});
|
|
189
170
|
runtime.registerNativeProvider({
|
|
190
171
|
id: provider.id,
|
|
191
172
|
name: provider.name,
|
|
@@ -206,6 +187,23 @@ async function createWorkerAuthRuntime(catalog, model, resolveAuth) {
|
|
|
206
187
|
|
|
207
188
|
// worker-auth-entry.ts
|
|
208
189
|
async function main() {
|
|
190
|
+
const cliEntry = process.argv[2];
|
|
191
|
+
if (!cliEntry || !isAbsolute(cliEntry))
|
|
192
|
+
throw new Error("Missing host Pi CLI entry");
|
|
193
|
+
const hostUrl = pathToFileURL(cliEntry).href;
|
|
194
|
+
const {
|
|
195
|
+
createAgentSessionFromServices,
|
|
196
|
+
createAgentSessionRuntime,
|
|
197
|
+
createAgentSessionServices,
|
|
198
|
+
getAgentDir,
|
|
199
|
+
ModelRuntime,
|
|
200
|
+
parseArgs,
|
|
201
|
+
runRpcMode,
|
|
202
|
+
SessionManager,
|
|
203
|
+
SettingsManager
|
|
204
|
+
} = await import(import.meta.resolve("@earendil-works/pi-coding-agent", hostUrl));
|
|
205
|
+
const { InMemoryCredentialStore } = await import(import.meta.resolve("@earendil-works/pi-ai", hostUrl));
|
|
206
|
+
process.argv.splice(1, 1);
|
|
209
207
|
const args = parseArgs(process.argv.slice(2));
|
|
210
208
|
if (args.mode !== "rpc" || !args.provider || !args.model || args.apiKey || args.messages.length || args.fileArgs.length) {
|
|
211
209
|
throw new Error("Invalid authenticated worker invocation");
|
|
@@ -231,8 +229,8 @@ async function main() {
|
|
|
231
229
|
const sessionManager = args.session ? SessionManager.open(args.session, args.sessionDir) : args.noSession ? SessionManager.inMemory(cwd) : SessionManager.create(cwd, args.sessionDir);
|
|
232
230
|
const absolutePaths = (paths) => paths?.map((path) => resolve(cwd, path));
|
|
233
231
|
const runtime = await createAgentSessionRuntime(async ({ cwd: cwd2, sessionManager: sessionManager2, sessionStartEvent }) => {
|
|
234
|
-
const catalog = await
|
|
235
|
-
credentials: new
|
|
232
|
+
const catalog = await ModelRuntime.create({
|
|
233
|
+
credentials: new InMemoryCredentialStore,
|
|
236
234
|
allowModelNetwork: false,
|
|
237
235
|
refreshOnCreate: false
|
|
238
236
|
});
|
|
@@ -261,7 +259,12 @@ async function main() {
|
|
|
261
259
|
if (services.diagnostics.some((diagnostic) => diagnostic.type === "error") || services.resourceLoader.getExtensions().errors.length) {
|
|
262
260
|
throw new Error("Authenticated worker initialization failed");
|
|
263
261
|
}
|
|
264
|
-
services.modelRuntime = await createWorkerAuthRuntime(catalog,
|
|
262
|
+
services.modelRuntime = await createWorkerAuthRuntime(catalog, await ModelRuntime.create({
|
|
263
|
+
credentials: new InMemoryCredentialStore,
|
|
264
|
+
modelsPath: null,
|
|
265
|
+
allowModelNetwork: false,
|
|
266
|
+
refreshOnCreate: false
|
|
267
|
+
}), initial.model, async (signal) => {
|
|
265
268
|
const result = await client.request(signal);
|
|
266
269
|
if (result.model.provider !== initial.model.provider || result.model.id !== initial.model.id) {
|
|
267
270
|
throw new Error("Authenticated worker model mismatch");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-landstrip",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Sandboxed Bash and process-backed agents for Pi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"landstrip",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ci:test": "npm run test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@landstrip/landstrip-api": "^0.19.
|
|
42
|
+
"@landstrip/landstrip-api": "^0.19.1",
|
|
43
43
|
"jsonc-parser": "^3.3.1",
|
|
44
44
|
"minimatch": "^10.2.5",
|
|
45
45
|
"undici": "^8.9.0",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@earendil-works/pi-ai": "^0.84.1",
|
|
50
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
51
|
-
"@earendil-works/pi-tui": "^0.
|
|
52
|
-
"@types/node": "^
|
|
50
|
+
"@earendil-works/pi-coding-agent": "^0.85.1",
|
|
51
|
+
"@earendil-works/pi-tui": "^0.85.1",
|
|
52
|
+
"@types/node": "^26.4.1",
|
|
53
53
|
"oxfmt": "^0.64.0",
|
|
54
54
|
"oxlint": "^1.68.0",
|
|
55
55
|
"typebox": "^1.3.6",
|