@deepagents/context 2.3.0 → 2.4.0

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/dist/index.js CHANGED
@@ -188,18 +188,35 @@ function fragment(name, ...children) {
188
188
  data: children
189
189
  };
190
190
  }
191
+ function withoutDuplicateReasoningParts(message2) {
192
+ const seenReasoningItemIds = /* @__PURE__ */ new Set();
193
+ let dropped = false;
194
+ const parts = message2.parts.filter((part) => {
195
+ if (part.type !== "reasoning") return true;
196
+ const itemId = part.providerMetadata?.openai?.itemId;
197
+ if (typeof itemId !== "string") return true;
198
+ if (seenReasoningItemIds.has(itemId)) {
199
+ dropped = true;
200
+ return false;
201
+ }
202
+ seenReasoningItemIds.add(itemId);
203
+ return true;
204
+ });
205
+ return dropped ? { ...message2, parts } : message2;
206
+ }
191
207
  function assistant(message2) {
208
+ const normalized = withoutDuplicateReasoningParts(message2);
192
209
  return {
193
- id: message2.id,
210
+ id: normalized.id,
194
211
  name: "assistant",
195
212
  type: "message",
196
213
  persist: true,
197
214
  codec: {
198
215
  decode() {
199
- return message2;
216
+ return normalized;
200
217
  },
201
218
  encode() {
202
- return message2;
219
+ return normalized;
203
220
  }
204
221
  }
205
222
  };
@@ -1614,7 +1631,8 @@ var Agent = class _Agent {
1614
1631
  model: this.#options.model,
1615
1632
  system: systemPrompt,
1616
1633
  messages: await convertToModelMessages(messages, {
1617
- ignoreIncompleteToolCalls: true
1634
+ ignoreIncompleteToolCalls: true,
1635
+ tools: this.tools
1618
1636
  }),
1619
1637
  stopWhen: stepCountIs(200),
1620
1638
  tools: this.tools,
@@ -1688,7 +1706,8 @@ var Agent = class _Agent {
1688
1706
  model,
1689
1707
  system: systemPrompt,
1690
1708
  messages: await convertToModelMessages(messages, {
1691
- ignoreIncompleteToolCalls: true
1709
+ ignoreIncompleteToolCalls: true,
1710
+ tools: this.tools
1692
1711
  }),
1693
1712
  experimental_repairToolCall: createRepairToolCall(
1694
1713
  model,
@@ -1963,7 +1982,8 @@ function structuredOutput(options) {
1963
1982
  model: options.model,
1964
1983
  system: systemPrompt,
1965
1984
  messages: await convertToModelMessages(messages, {
1966
- ignoreIncompleteToolCalls: true
1985
+ ignoreIncompleteToolCalls: true,
1986
+ tools: options.tools
1967
1987
  }),
1968
1988
  stopWhen: stepCountIs(200),
1969
1989
  experimental_repairToolCall: createRepairToolCall(
@@ -1998,7 +2018,8 @@ function structuredOutput(options) {
1998
2018
  config?.abortSignal
1999
2019
  ),
2000
2020
  messages: await convertToModelMessages(messages, {
2001
- ignoreIncompleteToolCalls: true
2021
+ ignoreIncompleteToolCalls: true,
2022
+ tools: options.tools
2002
2023
  }),
2003
2024
  stopWhen: stepCountIs(200),
2004
2025
  experimental_transform: config?.transform ?? smoothStream(),
@@ -6109,7 +6130,7 @@ async function snapshot(execute, destination) {
6109
6130
  const probe = await execute(`[ -d ${shellQuote(destination)} ]`);
6110
6131
  if (probe.exitCode !== 0) return /* @__PURE__ */ new Map();
6111
6132
  const list = await execute(
6112
- `find ${shellQuote(destination)} -type f -print0 | while IFS= read -r -d '' p; do sha256sum "$p"; done`
6133
+ `find ${shellQuote(destination)} -type f -exec sha256sum {} +`
6113
6134
  );
6114
6135
  if (list.exitCode !== 0) {
6115
6136
  throw new SnapshotFailedError(
@@ -8023,6 +8044,16 @@ async function useSandbox(options, fn) {
8023
8044
  }
8024
8045
  }
8025
8046
 
8047
+ // packages/context/src/lib/sandbox/gcs.ts
8048
+ function gcs(options) {
8049
+ return {
8050
+ type: "bind",
8051
+ hostPath: options.hostPath,
8052
+ containerPath: options.mountPath,
8053
+ readOnly: options.readOnly ?? false
8054
+ };
8055
+ }
8056
+
8026
8057
  // packages/context/src/lib/sandbox/installers/package-manager.ts
8027
8058
  var PackageInstaller = class extends Installer {
8028
8059
  kind;
@@ -11723,6 +11754,7 @@ export {
11723
11754
  firstN,
11724
11755
  fragment,
11725
11756
  fromFragment,
11757
+ gcs,
11726
11758
  getFragmentData,
11727
11759
  getLocaleFromMessage,
11728
11760
  getModelsRegistry,