@ai-sdk/harness-pi 1.0.94 → 1.0.95

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,21 @@
1
1
  # @ai-sdk/harness-pi
2
2
 
3
+ ## 1.0.95
4
+
5
+ ### Patch Changes
6
+
7
+ - f7fa993: fix(harness-pi): allow configuring Pi sessions with the `max` thinking level
8
+ - 7608210: feat(harness): add `model` parameter to `HarnessAgent` instead of having each harness adapter support it on their own constructor functions
9
+ - f7bd978: chore(harness): update underlying adapter SDKs to their latest versions
10
+ - 14d4fc0: feat(harness): allow changing harness settings between turns via `prepareCall()` support on `HarnessAgent`
11
+ - Updated dependencies [cc9f6ce]
12
+ - Updated dependencies [7608210]
13
+ - Updated dependencies [6f8a2d7]
14
+ - Updated dependencies [14d4fc0]
15
+ - Updated dependencies [90192f1]
16
+ - @ai-sdk/harness@1.0.93
17
+ - @ai-sdk/provider-utils@5.0.33
18
+
3
19
  ## 1.0.94
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { ExtensionFactory } from '@earendil-works/pi-coding-agent';
8
8
  */
9
9
  type PiAuthenticationMode = HarnessV1Authentication<'openai' | 'anthropic' | 'custom'>;
10
10
 
11
- type PiThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
11
+ type PiThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
12
12
 
13
13
  /**
14
14
  * Configuration knobs for `createPi`. Pi runs as an in-process Node library
@@ -21,6 +21,8 @@ type PiHarnessSettings = {
21
21
  * Pi model id (or name). Leaving this unset falls back to the AI Gateway
22
22
  * default when `AI_GATEWAY_API_KEY` / `VERCEL_OIDC_TOKEN` is set, and to
23
23
  * Pi's own resolution otherwise.
24
+ *
25
+ * @deprecated Use `model` on `HarnessAgent` instead.
24
26
  */
25
27
  readonly model?: string;
26
28
  /**
package/dist/index.js CHANGED
@@ -134,7 +134,7 @@ import {
134
134
  import { access } from "fs/promises";
135
135
 
136
136
  // src/version.ts
137
- var VERSION = true ? "1.0.94" : "0.0.0-test";
137
+ var VERSION = true ? "1.0.95" : "0.0.0-test";
138
138
 
139
139
  // src/pi-auth.ts
140
140
  var DEFAULT_GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh";
@@ -984,7 +984,7 @@ function createPiRemoteOps(options) {
984
984
  import path4 from "path";
985
985
  import { writeSkills } from "@ai-sdk/harness/utils";
986
986
  async function writePiSkills(args) {
987
- await writeSkills({
987
+ return writeSkills({
988
988
  sandbox: args.sandbox,
989
989
  rootDir: path4.posix.join(args.sandboxHomeDir, ".agents", "skills"),
990
990
  skills: args.skills,
@@ -1959,21 +1959,12 @@ async function createPiSession(input) {
1959
1959
  sessionId: input.sessionId
1960
1960
  });
1961
1961
  const permissionMode = input.permissionMode ?? "allow-all";
1962
- let sandboxSkillRootDir;
1962
+ const sandboxSkillRootDir = path7.posix.join(
1963
+ sandboxHomeDir,
1964
+ ".agents",
1965
+ "skills"
1966
+ );
1963
1967
  let harnessSkills = [];
1964
- if (input.skills.length > 0) {
1965
- sandboxSkillRootDir = path7.posix.join(sandboxHomeDir, ".agents", "skills");
1966
- harnessSkills = createHarnessPiSkills({
1967
- skills: input.skills,
1968
- sandboxSkillRootDir
1969
- });
1970
- await writePiSkills({
1971
- sandbox: toolSafeSandboxSession,
1972
- sandboxHomeDir,
1973
- skills: input.skills,
1974
- ...input.abortSignal ? { abortSignal: input.abortSignal } : {}
1975
- });
1976
- }
1977
1968
  let resumeSessionFilePath;
1978
1969
  if (input.isResume && input.resumeSessionFileName) {
1979
1970
  const resumeSessionFileName = safePiSessionFileName(
@@ -1997,7 +1988,7 @@ async function createPiSession(input) {
1997
1988
  const paths = createPiPathMapper({
1998
1989
  hostWorkDir,
1999
1990
  sandboxWorkDir: sessionWorkDir,
2000
- readableRoots: sandboxSkillRootDir ? [{ sandboxDir: sandboxSkillRootDir }] : []
1991
+ readableRoots: [{ sandboxDir: sandboxSkillRootDir }]
2001
1992
  });
2002
1993
  const agentDir = input.agentDir ?? hostAgentDir;
2003
1994
  const modelRuntime = await createPiModelRuntime({
@@ -2249,6 +2240,7 @@ async function createPiSession(input) {
2249
2240
  try {
2250
2241
  const control = await runTurn({
2251
2242
  text: "",
2243
+ skills: continueOpts.skills,
2252
2244
  tools: continueOpts.tools ?? [],
2253
2245
  instructions: continueOpts.instructions,
2254
2246
  emit: continueOpts.emit,
@@ -2460,6 +2452,19 @@ async function createPiSession(input) {
2460
2452
  if (stopped) {
2461
2453
  throw new Error("Pi session has been stopped.");
2462
2454
  }
2455
+ const skillWriteResult = await writePiSkills({
2456
+ sandbox: toolSafeSandboxSession,
2457
+ sandboxHomeDir,
2458
+ skills: turnOpts.skills,
2459
+ abortSignal: turnOpts.abortSignal
2460
+ });
2461
+ harnessSkills = createHarnessPiSkills({
2462
+ skills: turnOpts.skills,
2463
+ sandboxSkillRootDir
2464
+ });
2465
+ if (piSession != null && skillWriteResult.changed) {
2466
+ await reloadResourcesOnly();
2467
+ }
2463
2468
  const userTools = turnOpts.tools;
2464
2469
  currentEmit = turnOpts.emit;
2465
2470
  const turnAbortController = new AbortController();
@@ -2646,6 +2651,7 @@ async function createPiSession(input) {
2646
2651
  }
2647
2652
  return runTurn({
2648
2653
  text: extractUserText(promptOpts.prompt),
2654
+ skills: promptOpts.skills,
2649
2655
  tools: promptOpts.tools ?? [],
2650
2656
  instructions: promptOpts.instructions,
2651
2657
  emit: promptOpts.emit,
@@ -2681,6 +2687,7 @@ async function createPiSession(input) {
2681
2687
  }
2682
2688
  return runTurn({
2683
2689
  text: "",
2690
+ skills: continueOpts.skills,
2684
2691
  tools: continueOpts.tools ?? [],
2685
2692
  instructions: continueOpts.instructions,
2686
2693
  emit: continueOpts.emit,
@@ -3101,16 +3108,16 @@ function createPi(settings = {}) {
3101
3108
  supportsBuiltinToolFiltering: true,
3102
3109
  lifecycleStateSchema: piResumeStateSchema,
3103
3110
  doStart: async (startOpts) => {
3111
+ const model = startOpts.model ?? settings.model;
3104
3112
  const lifecycleState = startOpts.continueFrom ?? startOpts.resumeFrom;
3105
3113
  const resumeData = lifecycleState?.data;
3106
3114
  return createPiSession({
3107
3115
  sessionId: startOpts.sessionId,
3108
3116
  sandboxSession: startOpts.sandboxSession,
3109
3117
  sessionWorkDir: startOpts.sessionWorkDir,
3110
- skills: startOpts.skills ?? [],
3111
3118
  settings: {
3112
3119
  ...settings.auth ? { auth: settings.auth } : {},
3113
- ...settings.model ? { model: settings.model } : {},
3120
+ ...model == null ? {} : { model },
3114
3121
  ...settings.thinkingLevel ? { thinkingLevel: settings.thinkingLevel } : {},
3115
3122
  ...settings.mcpServers ? { mcpServers: settings.mcpServers } : {},
3116
3123
  ...settings.extensionFactories ? { extensionFactories: settings.extensionFactories } : {}