@ai-sdk/harness 1.0.94 → 1.0.96

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,22 @@
1
1
  # @ai-sdk/harness
2
2
 
3
+ ## 1.0.96
4
+
5
+ ### Patch Changes
6
+
7
+ - c0c7fac: feat(harness): add reusable `createReadBridgeAsset()` helper function
8
+ - Updated dependencies [850d863]
9
+ - ai@7.0.87
10
+
11
+ ## 1.0.95
12
+
13
+ ### Patch Changes
14
+
15
+ - 371e954: feat(harness): add `createBridgeToken()` and `withBridgeToken()` helpers for bridge backed harness adapters
16
+ - 87b4858: feat(harness): enhance per-turn telemetry with recently added per-turn configuration data
17
+ - Updated dependencies [11109ae]
18
+ - ai@7.0.86
19
+
3
20
  ## 1.0.94
4
21
 
5
22
  ### Patch Changes
@@ -1097,7 +1097,9 @@ function stripDeep(value, workDir) {
1097
1097
  }
1098
1098
 
1099
1099
  // src/agent/internal/turn-telemetry.ts
1100
- import { generateId as generateId3 } from "@ai-sdk/provider-utils";
1100
+ import {
1101
+ generateId as generateId3
1102
+ } from "@ai-sdk/provider-utils";
1101
1103
  import { createTelemetryDispatcher } from "ai/internal";
1102
1104
  var NOOP = {
1103
1105
  async start() {
@@ -1165,6 +1167,12 @@ function createTurnTelemetry(opts) {
1165
1167
  const inputMessages = [
1166
1168
  { role: "user", content: opts.promptText }
1167
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
+ }));
1168
1176
  let started = false;
1169
1177
  let stepOpen = false;
1170
1178
  let stepNumber = 0;
@@ -1186,9 +1194,9 @@ function createTurnTelemetry(opts) {
1186
1194
  operationId: "ai.harness",
1187
1195
  provider,
1188
1196
  modelId,
1189
- tools: void 0,
1197
+ tools: opts.tools,
1190
1198
  toolChoice: void 0,
1191
- activeTools: void 0,
1199
+ activeTools: opts.activeToolNames,
1192
1200
  maxRetries: 0,
1193
1201
  timeout: void 0,
1194
1202
  headers: void 0,
@@ -1218,13 +1226,14 @@ function createTurnTelemetry(opts) {
1218
1226
  provider,
1219
1227
  modelId,
1220
1228
  stepNumber,
1221
- tools: void 0,
1229
+ tools: opts.tools,
1222
1230
  toolChoice: void 0,
1223
- activeTools: void 0,
1231
+ activeTools: opts.activeToolNames,
1224
1232
  steps: new Array(stepNumber),
1225
1233
  providerOptions: void 0,
1226
1234
  output: void 0,
1227
1235
  runtimeContext,
1236
+ instructions: opts.instructions,
1228
1237
  messages: inputMessages
1229
1238
  })
1230
1239
  ));
@@ -1234,8 +1243,9 @@ function createTurnTelemetry(opts) {
1234
1243
  callId,
1235
1244
  provider,
1236
1245
  modelId,
1246
+ instructions: opts.instructions,
1237
1247
  messages: inputMessages,
1238
- tools: void 0
1248
+ tools: languageModelTools
1239
1249
  })
1240
1250
  ));
1241
1251
  };
@@ -1247,6 +1257,8 @@ function createTurnTelemetry(opts) {
1247
1257
  dispatcher,
1248
1258
  cast({
1249
1259
  callId,
1260
+ provider,
1261
+ modelId,
1250
1262
  finishReason,
1251
1263
  responseId: callId,
1252
1264
  usage,
@@ -1566,11 +1578,23 @@ function runPrompt(input) {
1566
1578
  const onToolResultSettled = (_f = input.onToolResultSettled) != null ? _f : (() => {
1567
1579
  });
1568
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
+ );
1569
1590
  const telemetry = createTurnTelemetry({
1570
1591
  telemetry: input.telemetry,
1571
1592
  harnessId: input.harness.harnessId,
1572
1593
  modelId: input.model,
1573
1594
  instructions: input.instructions,
1595
+ tools: input.tools,
1596
+ activeToolNames,
1597
+ toolSpecs: input.toolSpecs,
1574
1598
  promptText: input.prompt != null ? promptToText(input.prompt) : "",
1575
1599
  runtimeContext: input.runtimeContext
1576
1600
  });