@ai-sdk/harness 1.0.93 → 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,28 @@
1
1
  # @ai-sdk/harness
2
2
 
3
+ ## 1.0.95
4
+
5
+ ### Patch Changes
6
+
7
+ - 371e954: feat(harness): add `createBridgeToken()` and `withBridgeToken()` helpers for bridge backed harness adapters
8
+ - 87b4858: feat(harness): enhance per-turn telemetry with recently added per-turn configuration data
9
+ - Updated dependencies [11109ae]
10
+ - ai@7.0.86
11
+
12
+ ## 1.0.94
13
+
14
+ ### Patch Changes
15
+
16
+ - 8961fde: feat(harness): allow changing `model` between turns via call options
17
+ - eb59f2a: fix(harness): ensure harness adapters can stream tool input deltas before the complete tool call arrives
18
+ - Updated dependencies [55a9981]
19
+ - Updated dependencies [dd32de2]
20
+ - Updated dependencies [aa45741]
21
+ - Updated dependencies [cc29073]
22
+ - ai@7.0.85
23
+ - @ai-sdk/provider@4.0.9
24
+ - @ai-sdk/provider-utils@5.0.34
25
+
3
26
  ## 1.0.93
4
27
 
5
28
  ### Patch Changes
@@ -2,7 +2,7 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
2
  import { Experimental_SandboxSession, UserModelMessage, ToolSet, FlexibleSchema, Tool, Context, MaybePromiseLike, Arrayable, ToolApprovalResponse, ModelMessage } from '@ai-sdk/provider-utils';
3
3
  import { OutputInterface, AgentCallParameters, Prompt, StopCondition, ToolApprovalStatus, TelemetryOptions, ActiveTools, StreamTextResult, Agent, GenerateTextResult, AgentStreamParameters, Telemetry } from 'ai';
4
4
  import { z } from 'zod/v4';
5
- import { JSONSchema7, JSONValue, LanguageModelV4ToolCall, LanguageModelV4ToolApprovalRequest, LanguageModelV4ToolResult, LanguageModelV4FinishReason, LanguageModelV4Usage, AISDKError } from '@ai-sdk/provider';
5
+ import { JSONSchema7, JSONValue, LanguageModelV4StreamPart, LanguageModelV4ToolCall, LanguageModelV4ToolApprovalRequest, LanguageModelV4ToolResult, LanguageModelV4FinishReason, LanguageModelV4Usage, AISDKError } from '@ai-sdk/provider';
6
6
 
7
7
  /**
8
8
  * One file to write into the sandbox as part of an adapter's bootstrap recipe.
@@ -472,6 +472,12 @@ type HarnessV1PendingToolResult = {
472
472
  * so a resumed continuation cannot pick up configuration from a later turn.
473
473
  */
474
474
  type HarnessV1TurnSettings = {
475
+ /**
476
+ * Model identifier selected for this turn. Adapters interpret this value
477
+ * according to the underlying harness runtime. Rerun-based continuations
478
+ * reuse it when reconstructing the turn.
479
+ */
480
+ readonly model?: string;
475
481
  /**
476
482
  * Skills made available to the underlying runtime for this turn. Adapters
477
483
  * must replace skills from the preceding completed turn before starting a
@@ -630,7 +636,13 @@ type HarnessV1StreamPart = {
630
636
  type: 'reasoning-end';
631
637
  id: string;
632
638
  harnessMetadata?: HarnessV1Metadata;
633
- } | (LanguageModelV4ToolCall & {
639
+ } | Extract<LanguageModelV4StreamPart, {
640
+ type: 'tool-input-start';
641
+ }> | Extract<LanguageModelV4StreamPart, {
642
+ type: 'tool-input-delta';
643
+ }> | Extract<LanguageModelV4StreamPart, {
644
+ type: 'tool-input-end';
645
+ }> | (LanguageModelV4ToolCall & {
634
646
  nativeName?: string;
635
647
  /**
636
648
  * Total tool calls in the current model step, when known before tool
@@ -683,11 +695,6 @@ type HarnessV1BuiltinToolFiltering = {
683
695
  * calling the adapter, so adapters never need to derive provider-specific paths.
684
696
  */
685
697
  type HarnessV1StartOptions = {
686
- /**
687
- * Model identifier selected by the consumer. Adapters interpret this value
688
- * according to the underlying harness runtime.
689
- */
690
- readonly model?: string;
691
698
  /**
692
699
  * Stable identifier for this harness session. Used as the underlying
693
700
  * resource name where the adapter has a notion of a named session
@@ -815,13 +822,6 @@ type HarnessV1Session = {
815
822
  * sessions report `false`; resumed sessions report `true`.
816
823
  */
817
824
  readonly isResume: boolean;
818
- /**
819
- * The model id the underlying runtime is configured to use, if the adapter
820
- * knows it (e.g. from its settings). Surfaced into telemetry as
821
- * `gen_ai.request.model` and the trace span labels. Omitted when the adapter
822
- * defers to the runtime's own default and has no concrete id.
823
- */
824
- readonly modelId?: string;
825
825
  /**
826
826
  * Run one prompt turn. Returns a control handle the host uses to feed
827
827
  * tool results, approvals, and user messages back into the turn while it
@@ -1250,8 +1250,8 @@ type HarnessTools<TOOLS extends ToolSet> = ActiveTools<NoInfer<TOOLS>>;
1250
1250
  *
1251
1251
  * Prompt, abortSignal, callbacks, and custom call options belong on the
1252
1252
  * `AgentCallParameters` / `AgentStreamParameters` passed to `generate` /
1253
- * `stream`. `prepareCall` can derive turn-scoped skills, instructions, and
1254
- * tools from those custom call options.
1253
+ * `stream`. `prepareCall` can derive turn-scoped model, skills, instructions,
1254
+ * and tools from those custom call options.
1255
1255
  */
1256
1256
  type HarnessAgentToolFilteringSettings<TOOLS extends ToolSet> = {
1257
1257
  /**
@@ -1281,8 +1281,9 @@ type HarnessAgentSettings<THarness extends HarnessAgentAdapter<any> = HarnessAge
1281
1281
  */
1282
1282
  readonly id?: string;
1283
1283
  /**
1284
- * Model identifier passed to the harness adapter when a session starts.
1285
- * Supported values are defined by the selected harness.
1284
+ * Model identifier used by the harness adapter. Supported values are
1285
+ * defined by the selected harness. `prepareCall` can replace it between
1286
+ * completed turns.
1286
1287
  */
1287
1288
  readonly model?: string;
1288
1289
  /**
@@ -1326,7 +1327,7 @@ type HarnessAgentSettings<THarness extends HarnessAgentAdapter<any> = HarnessAge
1326
1327
  * })
1327
1328
  * ```
1328
1329
  */
1329
- readonly prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, HarnessAllTools<THarness, TUserTools>, RUNTIME_CONTEXT>, 'abortSignal' | 'timeout' | 'onStart' | 'experimental_onStart' | 'onStepStart' | 'experimental_onStepStart' | 'onToolExecutionStart' | 'experimental_onToolCallStart' | 'onToolExecutionEnd' | 'experimental_onToolCallFinish' | 'onStepEnd' | 'onStepFinish' | 'onEnd' | 'onFinish' | 'experimental_sandbox'> & Pick<HarnessAgentSettings<THarness, TUserTools, RUNTIME_CONTEXT, NoInfer<OUTPUT>, CALL_OPTIONS>, 'skills' | 'instructions' | 'tools'>) => MaybePromiseLike<Pick<HarnessAgentSettings<THarness, TUserTools, RUNTIME_CONTEXT, NoInfer<OUTPUT>, CALL_OPTIONS>, 'skills' | 'instructions' | 'tools'> & Omit<Prompt, 'system' | 'instructions' | 'allowSystemInMessages'>>;
1330
+ readonly prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, HarnessAllTools<THarness, TUserTools>, RUNTIME_CONTEXT>, 'abortSignal' | 'timeout' | 'onStart' | 'experimental_onStart' | 'onStepStart' | 'experimental_onStepStart' | 'onToolExecutionStart' | 'experimental_onToolCallStart' | 'onToolExecutionEnd' | 'experimental_onToolCallFinish' | 'onStepEnd' | 'onStepFinish' | 'onEnd' | 'onFinish' | 'experimental_sandbox'> & Pick<HarnessAgentSettings<THarness, TUserTools, RUNTIME_CONTEXT, NoInfer<OUTPUT>, CALL_OPTIONS>, 'model' | 'skills' | 'instructions' | 'tools'>) => MaybePromiseLike<Pick<HarnessAgentSettings<THarness, TUserTools, RUNTIME_CONTEXT, NoInfer<OUTPUT>, CALL_OPTIONS>, 'model' | 'skills' | 'instructions' | 'tools'> & Omit<Prompt, 'system' | 'instructions' | 'allowSystemInMessages'>>;
1330
1331
  /**
1331
1332
  * Optional specification for generating typed output. The same output
1332
1333
  * requirement is active for every turn run by this agent.
@@ -1490,6 +1491,7 @@ declare class HarnessAgentSession {
1490
1491
  hasUnfinishedTurn(): boolean;
1491
1492
  promptTurn<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context, OUTPUT extends OutputInterface>(options: {
1492
1493
  prompt: HarnessAgentPrompt;
1494
+ model: string | undefined;
1493
1495
  skills: ReadonlyArray<HarnessV1Skill>;
1494
1496
  instructions: string | undefined;
1495
1497
  tools: TOOLS;
@@ -1504,6 +1506,7 @@ declare class HarnessAgentSession {
1504
1506
  stopConditions: ReadonlyArray<StopCondition<TOOLS, RUNTIME_CONTEXT>>;
1505
1507
  }): HarnessAgentTurnResult<TOOLS, RUNTIME_CONTEXT, OUTPUT>;
1506
1508
  continueTurn<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context, OUTPUT extends OutputInterface>(options: {
1509
+ model: string | undefined;
1507
1510
  skills: ReadonlyArray<HarnessV1Skill>;
1508
1511
  instructions: string | undefined;
1509
1512
  tools: TOOLS;
@@ -889,6 +889,10 @@ function translateStreamPart(event, options = {}) {
889
889
  providerMetadata: event.harnessMetadata
890
890
  }
891
891
  ];
892
+ case "tool-input-start":
893
+ case "tool-input-delta":
894
+ case "tool-input-end":
895
+ return [event];
892
896
  case "tool-call":
893
897
  return [];
894
898
  case "tool-approval-request":
@@ -988,9 +992,45 @@ function translateStreamPart(event, options = {}) {
988
992
  }
989
993
 
990
994
  // src/agent/internal/strip-work-dir.ts
995
+ function createToolInputWorkDirStripper({
996
+ sessionWorkDir
997
+ }) {
998
+ const pendingByToolCallId = /* @__PURE__ */ new Map();
999
+ return (part) => {
1000
+ var _a4;
1001
+ if (sessionWorkDir.length === 0) return [part];
1002
+ if (part.type === "tool-input-start") {
1003
+ pendingByToolCallId.set(part.id, "");
1004
+ return [part];
1005
+ }
1006
+ if (part.type === "tool-input-delta") {
1007
+ const stripped2 = stripStreamingString({
1008
+ value: ((_a4 = pendingByToolCallId.get(part.id)) != null ? _a4 : "") + part.delta,
1009
+ workDir: sessionWorkDir,
1010
+ final: false
1011
+ });
1012
+ pendingByToolCallId.set(part.id, stripped2.pending);
1013
+ return stripped2.output.length === 0 ? [] : [{ ...part, delta: stripped2.output }];
1014
+ }
1015
+ const pending = pendingByToolCallId.get(part.id);
1016
+ pendingByToolCallId.delete(part.id);
1017
+ if (pending == null || pending.length === 0) return [part];
1018
+ const stripped = stripStreamingString({
1019
+ value: pending,
1020
+ workDir: sessionWorkDir,
1021
+ final: true
1022
+ });
1023
+ return stripped.output.length === 0 ? [part] : [
1024
+ { type: "tool-input-delta", id: part.id, delta: stripped.output },
1025
+ part
1026
+ ];
1027
+ };
1028
+ }
991
1029
  function stripWorkDir(part, sessionWorkDir) {
992
1030
  if (sessionWorkDir.length === 0) return part;
993
1031
  switch (part.type) {
1032
+ case "tool-input-delta":
1033
+ return { ...part, delta: stripString(part.delta, sessionWorkDir) };
994
1034
  case "tool-call":
995
1035
  return { ...part, input: stripString(part.input, sessionWorkDir) };
996
1036
  case "tool-result":
@@ -1007,6 +1047,42 @@ function stripWorkDir(part, sessionWorkDir) {
1007
1047
  function stripString(value, workDir) {
1008
1048
  return value.split(`${workDir}/`).join("").split(workDir).join(".");
1009
1049
  }
1050
+ function stripStreamingString({
1051
+ value,
1052
+ workDir,
1053
+ final
1054
+ }) {
1055
+ let remaining = value;
1056
+ let output = "";
1057
+ while (remaining.length > 0) {
1058
+ const matchIndex = remaining.indexOf(workDir);
1059
+ if (matchIndex >= 0) {
1060
+ output += remaining.slice(0, matchIndex);
1061
+ const followingIndex = matchIndex + workDir.length;
1062
+ if (followingIndex === remaining.length && !final) {
1063
+ return { output, pending: remaining.slice(matchIndex) };
1064
+ }
1065
+ if (remaining[followingIndex] === "/") {
1066
+ remaining = remaining.slice(followingIndex + 1);
1067
+ } else {
1068
+ output += ".";
1069
+ remaining = remaining.slice(followingIndex);
1070
+ }
1071
+ continue;
1072
+ }
1073
+ if (final) return { output: output + remaining, pending: "" };
1074
+ let pendingLength = Math.min(remaining.length, workDir.length - 1);
1075
+ while (pendingLength > 0 && !workDir.startsWith(remaining.slice(-pendingLength))) {
1076
+ pendingLength -= 1;
1077
+ }
1078
+ const outputLength = remaining.length - pendingLength;
1079
+ return {
1080
+ output: output + remaining.slice(0, outputLength),
1081
+ pending: remaining.slice(outputLength)
1082
+ };
1083
+ }
1084
+ return { output, pending: "" };
1085
+ }
1010
1086
  function stripDeep(value, workDir) {
1011
1087
  if (typeof value === "string") return stripString(value, workDir);
1012
1088
  if (Array.isArray(value)) return value.map((item) => stripDeep(item, workDir));
@@ -1021,7 +1097,9 @@ function stripDeep(value, workDir) {
1021
1097
  }
1022
1098
 
1023
1099
  // src/agent/internal/turn-telemetry.ts
1024
- import { generateId as generateId3 } from "@ai-sdk/provider-utils";
1100
+ import {
1101
+ generateId as generateId3
1102
+ } from "@ai-sdk/provider-utils";
1025
1103
  import { createTelemetryDispatcher } from "ai/internal";
1026
1104
  var NOOP = {
1027
1105
  async start() {
@@ -1089,6 +1167,12 @@ function createTurnTelemetry(opts) {
1089
1167
  const inputMessages = [
1090
1168
  { role: "user", content: opts.promptText }
1091
1169
  ];
1170
+ const languageModelTools = opts.toolSpecs.length === 0 ? void 0 : opts.toolSpecs.map((tool) => ({
1171
+ type: "function",
1172
+ name: tool.name,
1173
+ ...tool.description != null ? { description: tool.description } : {},
1174
+ ...tool.inputSchema != null ? { inputSchema: tool.inputSchema } : {}
1175
+ }));
1092
1176
  let started = false;
1093
1177
  let stepOpen = false;
1094
1178
  let stepNumber = 0;
@@ -1110,9 +1194,9 @@ function createTurnTelemetry(opts) {
1110
1194
  operationId: "ai.harness",
1111
1195
  provider,
1112
1196
  modelId,
1113
- tools: void 0,
1197
+ tools: opts.tools,
1114
1198
  toolChoice: void 0,
1115
- activeTools: void 0,
1199
+ activeTools: opts.activeToolNames,
1116
1200
  maxRetries: 0,
1117
1201
  timeout: void 0,
1118
1202
  headers: void 0,
@@ -1142,13 +1226,14 @@ function createTurnTelemetry(opts) {
1142
1226
  provider,
1143
1227
  modelId,
1144
1228
  stepNumber,
1145
- tools: void 0,
1229
+ tools: opts.tools,
1146
1230
  toolChoice: void 0,
1147
- activeTools: void 0,
1231
+ activeTools: opts.activeToolNames,
1148
1232
  steps: new Array(stepNumber),
1149
1233
  providerOptions: void 0,
1150
1234
  output: void 0,
1151
1235
  runtimeContext,
1236
+ instructions: opts.instructions,
1152
1237
  messages: inputMessages
1153
1238
  })
1154
1239
  ));
@@ -1158,8 +1243,9 @@ function createTurnTelemetry(opts) {
1158
1243
  callId,
1159
1244
  provider,
1160
1245
  modelId,
1246
+ instructions: opts.instructions,
1161
1247
  messages: inputMessages,
1162
- tools: void 0
1248
+ tools: languageModelTools
1163
1249
  })
1164
1250
  ));
1165
1251
  };
@@ -1171,6 +1257,8 @@ function createTurnTelemetry(opts) {
1171
1257
  dispatcher,
1172
1258
  cast({
1173
1259
  callId,
1260
+ provider,
1261
+ modelId,
1174
1262
  finishReason,
1175
1263
  responseId: callId,
1176
1264
  usage,
@@ -1490,11 +1578,23 @@ function runPrompt(input) {
1490
1578
  const onToolResultSettled = (_f = input.onToolResultSettled) != null ? _f : (() => {
1491
1579
  });
1492
1580
  const activeTools = (_g = input.activeTools) != null ? _g : input.tools;
1581
+ const activeToolNames = Object.keys(input.tools).filter(
1582
+ (toolName) => Object.prototype.hasOwnProperty.call(activeTools, toolName) || Object.prototype.hasOwnProperty.call(
1583
+ input.harness.builtinTools,
1584
+ toolName
1585
+ ) && isHarnessV1BuiltinToolIncluded({
1586
+ toolName,
1587
+ toolFiltering: input.builtinToolFiltering
1588
+ })
1589
+ );
1493
1590
  const telemetry = createTurnTelemetry({
1494
1591
  telemetry: input.telemetry,
1495
1592
  harnessId: input.harness.harnessId,
1496
- modelId: input.session.modelId,
1593
+ modelId: input.model,
1497
1594
  instructions: input.instructions,
1595
+ tools: input.tools,
1596
+ activeToolNames,
1597
+ toolSpecs: input.toolSpecs,
1498
1598
  promptText: input.prompt != null ? promptToText(input.prompt) : "",
1499
1599
  runtimeContext: input.runtimeContext
1500
1600
  });
@@ -1520,6 +1620,7 @@ function runPrompt(input) {
1520
1620
  invoke: input.mode === "continue" ? (emit) => {
1521
1621
  var _a6;
1522
1622
  return input.session.doContinueTurn({
1623
+ model: input.model,
1523
1624
  skills: (_a6 = input.skills) != null ? _a6 : [],
1524
1625
  responseFormat: input.responseFormat,
1525
1626
  tools: input.toolSpecs,
@@ -1536,6 +1637,7 @@ function runPrompt(input) {
1536
1637
  }
1537
1638
  return input.session.doPromptTurn({
1538
1639
  prompt: input.prompt,
1640
+ model: input.model,
1539
1641
  skills: (_a6 = input.skills) != null ? _a6 : [],
1540
1642
  responseFormat: input.responseFormat,
1541
1643
  tools: input.toolSpecs,
@@ -1559,6 +1661,9 @@ function runPrompt(input) {
1559
1661
  const { stream, control } = bridge;
1560
1662
  (_a5 = input.onPromptControlAvailable) == null ? void 0 : _a5.call(input, control);
1561
1663
  const reader = stream.getReader();
1664
+ const stripToolInputWorkDir = createToolInputWorkDirStripper({
1665
+ sessionWorkDir: input.sessionWorkDir
1666
+ });
1562
1667
  const toolCallsByToolCallId = /* @__PURE__ */ new Map();
1563
1668
  const rawToolCallsByToolCallId = /* @__PURE__ */ new Map();
1564
1669
  const translateOptions = {
@@ -1803,7 +1908,7 @@ function runPrompt(input) {
1803
1908
  toolName: approval.toolName,
1804
1909
  input: approval.input
1805
1910
  };
1806
- await telemetry.start(input.session.modelId);
1911
+ await telemetry.start(input.model);
1807
1912
  await telemetry.toolStart({
1808
1913
  toolCallId: rawToolCall.toolCallId,
1809
1914
  toolName: rawToolCall.toolName,
@@ -1902,11 +2007,25 @@ function runPrompt(input) {
1902
2007
  }
1903
2008
  }
1904
2009
  if (value.type === "stream-start") {
1905
- await telemetry.start((_e2 = value.modelId) != null ? _e2 : input.session.modelId);
2010
+ await telemetry.start((_e2 = value.modelId) != null ? _e2 : input.model);
1906
2011
  }
1907
2012
  if (value.type !== "stream-start" && value.type !== "finish-step" && value.type !== "finish" && value.type !== "error") {
1908
2013
  await telemetry.ensureStepOpen();
1909
2014
  }
2015
+ if (value.type === "tool-input-start" || value.type === "tool-input-delta" || value.type === "tool-input-end") {
2016
+ if (settledHostToolCallIds.has(value.id) || settledBuiltinApprovalToolCallIds.has(value.id)) {
2017
+ continue;
2018
+ }
2019
+ for (const displayValue2 of stripToolInputWorkDir(value)) {
2020
+ for (const part of translateStreamPart(
2021
+ displayValue2,
2022
+ translateOptions
2023
+ )) {
2024
+ result.enqueue(part);
2025
+ }
2026
+ }
2027
+ continue;
2028
+ }
1910
2029
  const displayValue = stripWorkDir(value, input.sessionWorkDir);
1911
2030
  const settledHostInputReplay = (displayValue.type === "tool-call" || displayValue.type === "tool-result" || displayValue.type === "tool-approval-request") && settledHostToolCallIds.has(displayValue.toolCallId);
1912
2031
  const settledBuiltinApprovalReplay = (displayValue.type === "tool-call" || displayValue.type === "tool-approval-request") && settledBuiltinApprovalToolCallIds.has(displayValue.toolCallId);
@@ -2411,6 +2530,7 @@ var HarnessAgentSession = class {
2411
2530
  const session = this.requireReusableSession();
2412
2531
  this.requirePromptableTurn();
2413
2532
  this.persistedTurnSettings = {
2533
+ ...options.model == null ? {} : { model: options.model },
2414
2534
  skills: options.skills,
2415
2535
  ...options.instructions == null ? {} : { instructions: options.instructions },
2416
2536
  tools: options.toolSpecs
@@ -2428,6 +2548,7 @@ var HarnessAgentSession = class {
2428
2548
  harness: this.harness,
2429
2549
  session,
2430
2550
  prompt: options.prompt,
2551
+ model: options.model,
2431
2552
  skills: options.skills,
2432
2553
  instructions: options.instructions,
2433
2554
  tools: options.tools,
@@ -2484,6 +2605,7 @@ var HarnessAgentSession = class {
2484
2605
  const session = this.requireReusableSession();
2485
2606
  this.requireContinuableTurn();
2486
2607
  const turnSettings = this.resolveActiveTurnSettings({
2608
+ model: options.model,
2487
2609
  skills: options.skills,
2488
2610
  instructions: options.instructions,
2489
2611
  tools: options.tools,
@@ -2498,6 +2620,7 @@ var HarnessAgentSession = class {
2498
2620
  harness: this.harness,
2499
2621
  session,
2500
2622
  mode: "continue",
2623
+ model: turnSettings.persisted.model,
2501
2624
  skills: turnSettings.persisted.skills,
2502
2625
  instructions: turnSettings.persisted.instructions,
2503
2626
  tools: turnSettings.tools,
@@ -2863,6 +2986,7 @@ var HarnessAgentSession = class {
2863
2986
  return this.activeTurnSettings;
2864
2987
  }
2865
2988
  const persisted = (_a4 = this.persistedTurnSettings) != null ? _a4 : {
2989
+ ...options.model == null ? {} : { model: options.model },
2866
2990
  skills: options.skills,
2867
2991
  ...options.instructions == null ? {} : { instructions: options.instructions },
2868
2992
  tools: options.toolSpecs
@@ -3663,7 +3787,6 @@ var HarnessAgent = class {
3663
3787
  }
3664
3788
  try {
3665
3789
  const baseStartOptions = {
3666
- model: this.settings.model,
3667
3790
  sessionId,
3668
3791
  resumeFrom: validatedResumeFrom,
3669
3792
  continueFrom: effectiveContinueFrom,
@@ -3805,6 +3928,7 @@ var HarnessAgent = class {
3805
3928
  }
3806
3929
  _buildTurnOptions(input) {
3807
3930
  return {
3931
+ model: input.turnSettings.model,
3808
3932
  skills: input.turnSettings.skills,
3809
3933
  instructions: input.turnSettings.instructions,
3810
3934
  tools: input.turnSettings.tools,
@@ -3894,6 +4018,7 @@ var HarnessAgent = class {
3894
4018
  ...promptOptions
3895
4019
  } = callOptions;
3896
4020
  const baseCallArgs = {
4021
+ model: this.settings.model,
3897
4022
  skills: this.settings.skills,
3898
4023
  instructions: this.settings.instructions,
3899
4024
  tools: this.settings.tools,
@@ -3911,6 +4036,7 @@ var HarnessAgent = class {
3911
4036
  return {
3912
4037
  prompt: this._resolvePromptTurnInput(preparedCallArgs),
3913
4038
  ...this._prepareTurnSettings({
4039
+ model: preparedCallArgs.model,
3914
4040
  skills: preparedCallArgs.skills,
3915
4041
  instructions: preparedCallArgs.instructions,
3916
4042
  tools: preparedCallArgs.tools
@@ -3921,6 +4047,7 @@ var HarnessAgent = class {
3921
4047
  var _a4, _b4;
3922
4048
  return {
3923
4049
  ...this._prepareTurnSettings({
4050
+ model: this.settings.model,
3924
4051
  skills: this.settings.skills,
3925
4052
  instructions: this.settings.instructions,
3926
4053
  tools: this.settings.tools
@@ -3944,6 +4071,7 @@ var HarnessAgent = class {
3944
4071
  inactiveTools: this.settings.inactiveTools
3945
4072
  });
3946
4073
  return {
4074
+ model: options.model,
3947
4075
  skills: (_b4 = options.skills) != null ? _b4 : [],
3948
4076
  instructions: options.instructions,
3949
4077
  tools,