@ai-sdk/harness-codex 1.0.119 → 1.0.121
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 +19 -0
- package/dist/bridge/index.mjs +46 -10
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/bridge/package.json +1 -1
- package/dist/bridge/pnpm-lock.yaml +34 -34
- package/dist/index.d.ts +8 -0
- package/dist/index.js +42 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/bridge/create-emit-stream-event.ts +54 -10
- package/src/bridge/package.json +1 -1
- package/src/bridge/pnpm-lock.yaml +34 -34
- package/src/codex-harness.ts +54 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ai-sdk/harness-codex
|
|
2
2
|
|
|
3
|
+
## 1.0.121
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2adbb77: feat(harness): update underlying harness SDKs to their latest versions
|
|
8
|
+
- Updated dependencies [125f493]
|
|
9
|
+
- @ai-sdk/harness@1.0.119
|
|
10
|
+
|
|
11
|
+
## 1.0.120
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- d975097: feat(harness): add `AbortSignal` to `SandboxChannel.connect`, plus a `sleep()` helper function
|
|
16
|
+
- 7040da0: fix(harness-codex): fix empty `query` value for `web_search` tool calls
|
|
17
|
+
- c0e5d1d: feat(harness): allow consumers of bridge backed harnesses to configure `reconnect` timeout
|
|
18
|
+
- Updated dependencies [d975097]
|
|
19
|
+
- Updated dependencies [b2baeba]
|
|
20
|
+
- @ai-sdk/harness@1.0.118
|
|
21
|
+
|
|
3
22
|
## 1.0.119
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/bridge/index.mjs
CHANGED
|
@@ -912,6 +912,7 @@ function createEmitStreamEvent({
|
|
|
912
912
|
}) {
|
|
913
913
|
const textByItem = /* @__PURE__ */ new Map();
|
|
914
914
|
const reasoningByItem = /* @__PURE__ */ new Map();
|
|
915
|
+
const emittedWebSearchToolCalls = /* @__PURE__ */ new Set();
|
|
915
916
|
return (event) => {
|
|
916
917
|
if (event.type === "thread.started" && typeof event.thread_id === "string") {
|
|
917
918
|
setThreadId(event.thread_id);
|
|
@@ -1023,24 +1024,32 @@ function createEmitStreamEvent({
|
|
|
1023
1024
|
}
|
|
1024
1025
|
if (item.type === "web_search") {
|
|
1025
1026
|
const nativeName = "web_search";
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1027
|
+
const query = getWebSearchQuery(item);
|
|
1028
|
+
if (event.type === "item.started" || event.type === "item.updated") {
|
|
1029
|
+
if (query !== void 0) {
|
|
1030
|
+
emitWebSearchToolCall({
|
|
1031
|
+
id,
|
|
1032
|
+
query,
|
|
1033
|
+
nativeName,
|
|
1034
|
+
emittedWebSearchToolCalls,
|
|
1035
|
+
send
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
} else if (event.type === "item.completed") {
|
|
1039
|
+
emitWebSearchToolCall({
|
|
1040
|
+
id,
|
|
1041
|
+
query: query ?? "",
|
|
1031
1042
|
nativeName,
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
}),
|
|
1035
|
-
providerExecuted: true
|
|
1043
|
+
emittedWebSearchToolCalls,
|
|
1044
|
+
send
|
|
1036
1045
|
});
|
|
1037
|
-
} else if (event.type === "item.completed") {
|
|
1038
1046
|
send({
|
|
1039
1047
|
type: "tool-result",
|
|
1040
1048
|
toolCallId: id,
|
|
1041
1049
|
toolName: toCommonName(nativeName),
|
|
1042
1050
|
result: item.result ?? item.action ?? null
|
|
1043
1051
|
});
|
|
1052
|
+
emittedWebSearchToolCalls.delete(id);
|
|
1044
1053
|
}
|
|
1045
1054
|
observeStep();
|
|
1046
1055
|
return;
|
|
@@ -1062,6 +1071,33 @@ function createEmitStreamEvent({
|
|
|
1062
1071
|
}
|
|
1063
1072
|
};
|
|
1064
1073
|
}
|
|
1074
|
+
function getWebSearchQuery(item) {
|
|
1075
|
+
if (typeof item.query === "string" && item.query.length > 0) {
|
|
1076
|
+
return item.query;
|
|
1077
|
+
}
|
|
1078
|
+
if (typeof item.action?.query === "string" && item.action.query.length > 0) {
|
|
1079
|
+
return item.action.query;
|
|
1080
|
+
}
|
|
1081
|
+
return void 0;
|
|
1082
|
+
}
|
|
1083
|
+
function emitWebSearchToolCall({
|
|
1084
|
+
id,
|
|
1085
|
+
query,
|
|
1086
|
+
nativeName,
|
|
1087
|
+
emittedWebSearchToolCalls,
|
|
1088
|
+
send
|
|
1089
|
+
}) {
|
|
1090
|
+
if (emittedWebSearchToolCalls.has(id)) return;
|
|
1091
|
+
emittedWebSearchToolCalls.add(id);
|
|
1092
|
+
send({
|
|
1093
|
+
type: "tool-call",
|
|
1094
|
+
toolCallId: id,
|
|
1095
|
+
toolName: toCommonName(nativeName),
|
|
1096
|
+
nativeName,
|
|
1097
|
+
input: JSON.stringify({ query }),
|
|
1098
|
+
providerExecuted: true
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1065
1101
|
function extractMcpToolCallResult(item) {
|
|
1066
1102
|
if (item.result === void 0 || item.result === null || typeof item.result !== "object") {
|
|
1067
1103
|
return item.error?.message ? { error: item.error.message } : null;
|