@ai-sdk/harness-pi 1.0.78 → 1.0.80
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 +18 -0
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/pi-session.ts +20 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/harness-pi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.80",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@earendil-works/pi-coding-agent": "^0.80.10",
|
|
31
31
|
"pi-mcp-adapter": "2.12.1",
|
|
32
32
|
"typebox": "^1.1.38",
|
|
33
|
-
"@ai-sdk/harness": "1.0.
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
33
|
+
"@ai-sdk/harness": "1.0.78",
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.28"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"zod": "^3.25.76 || ^4.1.8"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"tsup": "^8.5.1",
|
|
42
42
|
"typescript": "5.8.3",
|
|
43
43
|
"zod": "3.25.76",
|
|
44
|
-
"@ai-sdk/sandbox-just-bash": "1.0.
|
|
44
|
+
"@ai-sdk/sandbox-just-bash": "1.0.78",
|
|
45
45
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
package/src/pi-session.ts
CHANGED
|
@@ -31,7 +31,11 @@ import {
|
|
|
31
31
|
type HarnessV1StreamPart,
|
|
32
32
|
type HarnessV1ToolSpec,
|
|
33
33
|
} from '@ai-sdk/harness';
|
|
34
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
getRestrictedSandboxSession,
|
|
36
|
+
resolveSandboxHomeDir,
|
|
37
|
+
} from '@ai-sdk/harness/utils';
|
|
38
|
+
import type { Experimental_SandboxSession as SandboxSession } from '@ai-sdk/provider-utils';
|
|
35
39
|
import {
|
|
36
40
|
registerPiProviders,
|
|
37
41
|
resolvePiEnv,
|
|
@@ -220,7 +224,7 @@ export interface PiSessionSettings {
|
|
|
220
224
|
|
|
221
225
|
export interface CreatePiSessionInput {
|
|
222
226
|
readonly sessionId: string;
|
|
223
|
-
readonly sandboxSession: HarnessV1NetworkSandboxSession;
|
|
227
|
+
readonly sandboxSession: HarnessV1NetworkSandboxSession | SandboxSession;
|
|
224
228
|
readonly sessionWorkDir: string;
|
|
225
229
|
readonly skills: ReadonlyArray<HarnessV1Skill>;
|
|
226
230
|
readonly settings: PiSessionSettings;
|
|
@@ -314,9 +318,11 @@ export async function createPiSession(
|
|
|
314
318
|
await mkdir(hostAgentDir, { recursive: true });
|
|
315
319
|
await mkdir(hostSessionDir, { recursive: true });
|
|
316
320
|
|
|
317
|
-
const
|
|
321
|
+
const toolSafeSandboxSession = getRestrictedSandboxSession(
|
|
322
|
+
input.sandboxSession,
|
|
323
|
+
);
|
|
318
324
|
const sandboxHomeDir = await resolveSandboxHomeDir({
|
|
319
|
-
sandbox,
|
|
325
|
+
sandbox: toolSafeSandboxSession,
|
|
320
326
|
...(input.abortSignal ? { abortSignal: input.abortSignal } : {}),
|
|
321
327
|
});
|
|
322
328
|
const privateSessionDir = resolvePiPrivateSessionDirectory({
|
|
@@ -336,7 +342,7 @@ export async function createPiSession(
|
|
|
336
342
|
sandboxSkillRootDir,
|
|
337
343
|
});
|
|
338
344
|
await writePiSkills({
|
|
339
|
-
sandbox,
|
|
345
|
+
sandbox: toolSafeSandboxSession,
|
|
340
346
|
sandboxHomeDir,
|
|
341
347
|
skills: input.skills,
|
|
342
348
|
...(input.abortSignal ? { abortSignal: input.abortSignal } : {}),
|
|
@@ -351,7 +357,7 @@ export async function createPiSession(
|
|
|
351
357
|
input.resumeSessionFileName,
|
|
352
358
|
);
|
|
353
359
|
resumeSessionFilePath = await pullSessionFileFromSandbox({
|
|
354
|
-
sandbox,
|
|
360
|
+
sandbox: toolSafeSandboxSession,
|
|
355
361
|
privateSessionDir,
|
|
356
362
|
hostSessionDir,
|
|
357
363
|
sessionFileName: resumeSessionFileName,
|
|
@@ -362,7 +368,7 @@ export async function createPiSession(
|
|
|
362
368
|
// Snapshot sandbox state into the host mirror BEFORE the VFS goes live so
|
|
363
369
|
// Pi sees the workspace as soon as it boots.
|
|
364
370
|
await syncHostWorkspaceFromSandbox({
|
|
365
|
-
sandbox,
|
|
371
|
+
sandbox: toolSafeSandboxSession,
|
|
366
372
|
sandboxWorkDir: input.sessionWorkDir,
|
|
367
373
|
hostWorkDir,
|
|
368
374
|
});
|
|
@@ -573,7 +579,7 @@ export async function createPiSession(
|
|
|
573
579
|
}
|
|
574
580
|
|
|
575
581
|
const remoteOps = createPiRemoteOps({
|
|
576
|
-
sandbox,
|
|
582
|
+
sandbox: toolSafeSandboxSession,
|
|
577
583
|
paths,
|
|
578
584
|
onFileChange: (event, relPath) => {
|
|
579
585
|
currentEmit?.({ type: 'file-change', event, path: relPath });
|
|
@@ -597,7 +603,7 @@ export async function createPiSession(
|
|
|
597
603
|
async function persistSessionFile(): Promise<void> {
|
|
598
604
|
if (!sessionFileName) return;
|
|
599
605
|
await persistSessionFileToSandbox({
|
|
600
|
-
sandbox,
|
|
606
|
+
sandbox: toolSafeSandboxSession,
|
|
601
607
|
privateSessionDir,
|
|
602
608
|
hostSessionDir,
|
|
603
609
|
sessionFileName,
|
|
@@ -894,7 +900,10 @@ export async function createPiSession(
|
|
|
894
900
|
});
|
|
895
901
|
},
|
|
896
902
|
async submitUserMessage(text) {
|
|
897
|
-
|
|
903
|
+
if (piSession == null) {
|
|
904
|
+
throw new Error('Pi has no active runtime session to steer.');
|
|
905
|
+
}
|
|
906
|
+
await piSession.steer(text);
|
|
898
907
|
},
|
|
899
908
|
done: input.done,
|
|
900
909
|
};
|
|
@@ -1112,7 +1121,7 @@ export async function createPiSession(
|
|
|
1112
1121
|
turnAbortController.signal.throwIfAborted();
|
|
1113
1122
|
}
|
|
1114
1123
|
await syncHostWorkspaceFromSandbox({
|
|
1115
|
-
sandbox,
|
|
1124
|
+
sandbox: toolSafeSandboxSession,
|
|
1116
1125
|
sandboxWorkDir: input.sessionWorkDir,
|
|
1117
1126
|
hostWorkDir,
|
|
1118
1127
|
});
|