deepagents 1.16.2 → 1.16.3

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.
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,8 +19,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
19
19
  value: mod,
20
20
  enumerable: true
21
21
  }) : target, mod));
22
- //#endregion
23
22
  let langchain = require("langchain");
23
+ let _langchain_core_tracers_tracer_langchain = require("@langchain/core/tracers/tracer_langchain");
24
24
  let _langchain_core_errors = require("@langchain/core/errors");
25
25
  let _langchain_langgraph = require("@langchain/langgraph");
26
26
  let zod_v4 = require("zod/v4");
@@ -43,7 +43,7 @@ let _langchain_langgraph_sdk = require("@langchain/langgraph-sdk");
43
43
  let langsmith_traceable = require("langsmith/traceable");
44
44
  let langsmith = require("langsmith");
45
45
  let langsmith_experimental_sandbox = require("langsmith/experimental/sandbox");
46
- //#region src/backends/realpath.ts
46
+ // src/backends/realpath.ts
47
47
  const REALPATH = Symbol.for("deepagents.realpath");
48
48
  function getRealpath(backend) {
49
49
  if (typeof backend !== "object" || backend === null) return;
@@ -57,8 +57,7 @@ function setRealpath(target, fn) {
57
57
  configurable: true
58
58
  });
59
59
  }
60
- //#endregion
61
- //#region src/backends/utils.ts
60
+ // src/backends/utils.ts
62
61
  /**
63
62
  * Shared utility functions for memory backend implementations.
64
63
  *
@@ -718,8 +717,7 @@ function adaptSandboxProtocol(sandbox) {
718
717
  });
719
718
  return adapted;
720
719
  }
721
- //#endregion
722
- //#region src/backends/protocol.ts
720
+ // src/backends/protocol.ts
723
721
  /**
724
722
  * Enforce a match cap after a backend grep has completed.
725
723
  *
@@ -823,8 +821,7 @@ async function resolveBackend(backend, runtime) {
823
821
  }
824
822
  return isSandboxProtocol(backend) ? adaptSandboxProtocol(backend) : adaptBackendProtocol(backend);
825
823
  }
826
- //#endregion
827
- //#region src/backends/state.ts
824
+ // src/backends/state.ts
828
825
  function trimTrailingSlashes$2(path) {
829
826
  let end = path.length;
830
827
  while (end > 1 && path[end - 1] === "/") end--;
@@ -1203,8 +1200,7 @@ var StateBackend = class {
1203
1200
  return responses;
1204
1201
  }
1205
1202
  };
1206
- //#endregion
1207
- //#region src/middleware/blobOffload.ts
1203
+ // src/middleware/blobOffload.ts
1208
1204
  /**
1209
1205
  * Content-addressed offload of binary `read_file` and inline `HumanMessage`
1210
1206
  * blocks to the backend.
@@ -1510,15 +1506,17 @@ function restorePayloads(messages, payloads) {
1510
1506
  async function hydrateMessages(messages, backend, prefix, cache) {
1511
1507
  if (!messages.some(messageHasRefs)) return [...messages];
1512
1508
  const { payloads, missing } = cachedPayloads(referencedDigests(messages), cache);
1513
- if (missing.length > 0) if (typeof backend.downloadFiles !== "function") console.warn("Backend does not support downloadFiles; offloaded read_file content is unavailable");
1514
- else {
1515
- let responses = [];
1516
- try {
1517
- responses = await backend.downloadFiles(missing.map((digest) => blobPath(prefix, digest)));
1518
- } catch (error) {
1519
- console.warn("Failed to load offloaded read_file content", error);
1509
+ if (missing.length > 0) {
1510
+ if (typeof backend.downloadFiles !== "function") console.warn("Backend does not support downloadFiles; offloaded read_file content is unavailable");
1511
+ else {
1512
+ let responses = [];
1513
+ try {
1514
+ responses = await backend.downloadFiles(missing.map((digest) => blobPath(prefix, digest)));
1515
+ } catch (error) {
1516
+ console.warn("Failed to load offloaded read_file content", error);
1517
+ }
1518
+ acceptDownloads(missing, responses, payloads, cache);
1520
1519
  }
1521
- acceptDownloads(missing, responses, payloads, cache);
1522
1520
  }
1523
1521
  return restorePayloads(messages, payloads);
1524
1522
  }
@@ -1530,8 +1528,7 @@ async function hydrateMessages(messages, backend, prefix, cache) {
1530
1528
  function withoutBlobRefs(messages) {
1531
1529
  return messages.some(messageHasRefs) ? restorePayloads(messages, /* @__PURE__ */ new Map()) : messages;
1532
1530
  }
1533
- //#endregion
1534
- //#region src/middleware/unsupportedContent.ts
1531
+ // src/middleware/unsupportedContent.ts
1535
1532
  const PDF_MIME_TYPE = "application/pdf";
1536
1533
  /** Content block types `read_file` may emit that require multimodal model support. */
1537
1534
  const MULTIMODAL_BLOCK_TYPES = /* @__PURE__ */ new Set([
@@ -1671,8 +1668,7 @@ function createUnsupportedContentMiddleware() {
1671
1668
  }
1672
1669
  });
1673
1670
  }
1674
- //#endregion
1675
- //#region src/permissions/enforce.ts
1671
+ // src/permissions/enforce.ts
1676
1672
  /**
1677
1673
  * Validate permission rule paths at setup time. Throws if any path is
1678
1674
  * relative, contains `..`, or contains `~`.
@@ -1727,8 +1723,7 @@ function decidePathAccess(rules, operation, path) {
1727
1723
  }
1728
1724
  return "allow";
1729
1725
  }
1730
- //#endregion
1731
- //#region src/backends/composite.ts
1726
+ // src/backends/composite.ts
1732
1727
  /**
1733
1728
  * Backend that routes file operations to different backends based on path prefix.
1734
1729
  *
@@ -2155,8 +2150,7 @@ var CompositeBackend = class {
2155
2150
  return results;
2156
2151
  }
2157
2152
  };
2158
- //#endregion
2159
- //#region src/middleware/fs.ts
2153
+ // src/middleware/fs.ts
2160
2154
  /**
2161
2155
  * Middleware for providing filesystem tools to an agent.
2162
2156
  *
@@ -2387,6 +2381,25 @@ function truncatePaginatedRead(body, readResult, options) {
2387
2381
  */
2388
2382
  const GREP_TRUNCATION_NOTE = "Note: the search stopped early because it hit the maximum match count. The matches above are valid but incomplete. Narrow the search (a more specific pattern or a narrower path), or raise max_count, to see the rest.";
2389
2383
  /**
2384
+ * Characters of a grep line shown to the model. Longer lines (minified JSON,
2385
+ * offloaded tool results) show a window around the match instead, so one hit
2386
+ * can't return the whole line.
2387
+ */
2388
+ const GREP_LINE_CHAR_LIMIT = 2e3;
2389
+ /**
2390
+ * Clip `text` to a `GREP_LINE_CHAR_LIMIT` window centered on `pattern`,
2391
+ * falling back to the head of the line when `pattern` isn't found in it.
2392
+ */
2393
+ function clipGrepLine(text, pattern) {
2394
+ if (text.length <= 2e3) return text;
2395
+ const center = Math.max(text.indexOf(pattern), 0) + Math.floor(pattern.length / 2);
2396
+ const start = Math.min(Math.max(center - GREP_LINE_CHAR_LIMIT / 2, 0), text.length - GREP_LINE_CHAR_LIMIT);
2397
+ const end = start + GREP_LINE_CHAR_LIMIT;
2398
+ const before = start > 0 ? `[${start} chars clipped] ` : "";
2399
+ const after = end < text.length ? ` [${text.length - end} chars clipped]` : "";
2400
+ return `${before}${text.slice(start, end)}${after}`;
2401
+ }
2402
+ /**
2390
2403
  * Default cap on the number of matches the grep tool returns.
2391
2404
  * Set to null to disable the cap.
2392
2405
  */
@@ -3171,7 +3184,10 @@ function createGrepTool(backend, options) {
3171
3184
  if (result.error) return toolError(runtime, "grep", result.error);
3172
3185
  const matches = await filterByPermissions(resolvedBackend, result.matches ?? [], permissions, "read", (m) => m.path);
3173
3186
  if (matches.length === 0) return `No matches found for pattern '${pattern}'`;
3174
- const truncated = truncateIfTooLong(formatGrepMatches(matches, output_mode));
3187
+ const truncated = truncateIfTooLong(formatGrepMatches(matches.map((m) => ({
3188
+ ...m,
3189
+ text: clipGrepLine(m.text, pattern)
3190
+ })), output_mode));
3175
3191
  let content = typeof truncated === "string" ? truncated : truncated.join("\n");
3176
3192
  if (result.truncated) content += `\n\n${GREP_TRUNCATION_NOTE}`;
3177
3193
  return content;
@@ -3416,6 +3432,7 @@ function createFilesystemMiddleware(options = {}) {
3416
3432
  }
3417
3433
  return (0, langchain.createMiddleware)({
3418
3434
  name: "FilesystemMiddleware",
3435
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
3419
3436
  stateSchema: FilesystemStateSchema,
3420
3437
  tools: allTools,
3421
3438
  async beforeAgent(state) {
@@ -3546,8 +3563,7 @@ function createFilesystemMiddleware(options = {}) {
3546
3563
  }
3547
3564
  });
3548
3565
  }
3549
- //#endregion
3550
- //#region src/middleware/summarization.ts
3566
+ // src/middleware/summarization.ts
3551
3567
  /**
3552
3568
  * Summarization middleware with backend support for conversation history offloading.
3553
3569
  *
@@ -4105,10 +4121,7 @@ function createSummarizationMiddleware(options) {
4105
4121
  </summary>
4106
4122
  `;
4107
4123
  else content = `Here is a summary of the conversation to date:\n\n${summary}`;
4108
- return new langchain.HumanMessage({
4109
- content,
4110
- additional_kwargs: { lc_source: "summarization" }
4111
- });
4124
+ return (0, _langchain_core_messages.addNotificationMetadata)(new langchain.HumanMessage({ content }), { source: "summarization" });
4112
4125
  }
4113
4126
  /**
4114
4127
  * Summarize a set of messages using the given model and build the
@@ -4196,6 +4209,7 @@ function createSummarizationMiddleware(options) {
4196
4209
  }
4197
4210
  return (0, langchain.createMiddleware)({
4198
4211
  name: "SummarizationMiddleware",
4212
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
4199
4213
  stateSchema: SummarizationStateSchema,
4200
4214
  async wrapModelCall(request, handler) {
4201
4215
  const effectiveMessages = getEffectiveMessages(request.messages ?? [], request.state);
@@ -4240,8 +4254,7 @@ function createSummarizationMiddleware(options) {
4240
4254
  }
4241
4255
  });
4242
4256
  }
4243
- //#endregion
4244
- //#region src/middleware/utils.ts
4257
+ // src/middleware/utils.ts
4245
4258
  /**
4246
4259
  * Utility functions for middleware.
4247
4260
  *
@@ -4317,8 +4330,7 @@ function appendToSystemMessage(systemMessage, text) {
4317
4330
  }
4318
4331
  return new _langchain_core_messages.SystemMessage({ content: text });
4319
4332
  }
4320
- //#endregion
4321
- //#region src/middleware/subagents.ts
4333
+ // src/middleware/subagents.ts
4322
4334
  /**
4323
4335
  * Config key used by task-tool callers to request dynamic response format.
4324
4336
  *
@@ -4538,6 +4550,7 @@ const ForkedContextStateSchema = zod_v4.z.object({ [FORKED_CONTEXT_KEY]: zod_v4.
4538
4550
  function createForkTaskToolMiddleware(taskTool) {
4539
4551
  return (0, langchain.createMiddleware)({
4540
4552
  name: "forkTaskToolMiddleware",
4553
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
4541
4554
  stateSchema: ForkedContextStateSchema,
4542
4555
  tools: [taskTool],
4543
4556
  beforeAgent: () => ({ [FORKED_CONTEXT_KEY]: true })
@@ -4774,6 +4787,7 @@ function createSubAgentMiddleware(options) {
4774
4787
  });
4775
4788
  return (0, langchain.createMiddleware)({
4776
4789
  name: "subAgentMiddleware",
4790
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
4777
4791
  tools: [taskTool],
4778
4792
  wrapModelCall: async (request, handler) => {
4779
4793
  if (systemPrompt !== null) return handler({
@@ -4784,8 +4798,7 @@ function createSubAgentMiddleware(options) {
4784
4798
  }
4785
4799
  });
4786
4800
  }
4787
- //#endregion
4788
- //#region src/middleware/patch_tool_calls.ts
4801
+ // src/middleware/patch_tool_calls.ts
4789
4802
  /**
4790
4803
  * Patch tool call / tool response parity in a messages array.
4791
4804
  *
@@ -4879,6 +4892,7 @@ function patchDanglingToolCalls(messages) {
4879
4892
  function createPatchToolCallsMiddleware() {
4880
4893
  return (0, langchain.createMiddleware)({
4881
4894
  name: "patchToolCallsMiddleware",
4895
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
4882
4896
  beforeAgent: async (state) => {
4883
4897
  const messages = state.messages;
4884
4898
  if (!messages || messages.length === 0) return;
@@ -4908,8 +4922,7 @@ function createPatchToolCallsMiddleware() {
4908
4922
  }
4909
4923
  });
4910
4924
  }
4911
- //#endregion
4912
- //#region src/values.ts
4925
+ // src/values.ts
4913
4926
  /**
4914
4927
  * Shared state values for use in StateSchema definitions.
4915
4928
  *
@@ -4942,8 +4955,7 @@ const filesValue = new _langchain_langgraph.ReducedValue(zod.z.record(zod.z.stri
4942
4955
  inputSchema: zod.z.record(zod.z.string(), FileDataSchema.nullable()).optional(),
4943
4956
  reducer: fileDataReducer
4944
4957
  });
4945
- //#endregion
4946
- //#region src/utils.ts
4958
+ // src/utils.ts
4947
4959
  /**
4948
4960
  * Detect whether a model is an Anthropic model.
4949
4961
  *
@@ -5053,8 +5065,7 @@ function getModelProvider(model) {
5053
5065
  function getModelIdentifier(model) {
5054
5066
  return (model.getName() === "ConfigurableModel" ? model._defaultConfig : void 0)?.model ?? model.model_name ?? model.modelName ?? void 0;
5055
5067
  }
5056
- //#endregion
5057
- //#region src/middleware/memory.ts
5068
+ // src/middleware/memory.ts
5058
5069
  /**
5059
5070
  * Middleware for loading agent memory/context from AGENTS.md files.
5060
5071
  *
@@ -5240,6 +5251,7 @@ function createMemoryMiddleware(options) {
5240
5251
  const { backend, sources, addCacheControl = false } = options;
5241
5252
  return (0, langchain.createMiddleware)({
5242
5253
  name: "MemoryMiddleware",
5254
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
5243
5255
  stateSchema: MemoryStateSchema,
5244
5256
  async beforeAgent(state) {
5245
5257
  if ("memoryContents" in state && state.memoryContents != null) return;
@@ -5274,8 +5286,7 @@ function createMemoryMiddleware(options) {
5274
5286
  }
5275
5287
  });
5276
5288
  }
5277
- //#endregion
5278
- //#region src/errors.ts
5289
+ // src/errors.ts
5279
5290
  const CONFIGURATION_ERROR_SYMBOL = Symbol.for("deepagents.configuration_error");
5280
5291
  /**
5281
5292
  * Thrown when `createDeepAgent` receives invalid configuration.
@@ -5314,8 +5325,7 @@ var ConfigurationError = class ConfigurationError extends Error {
5314
5325
  return typeof error === "object" && error !== null && error[CONFIGURATION_ERROR_SYMBOL] === true;
5315
5326
  }
5316
5327
  };
5317
- //#endregion
5318
- //#region src/middleware/skills.ts
5328
+ // src/middleware/skills.ts
5319
5329
  /**
5320
5330
  * Backend-agnostic skills middleware for loading agent skills from any backend.
5321
5331
  *
@@ -5649,9 +5659,10 @@ function parseSkillMetadataFromContent(content, skillPath, directoryName) {
5649
5659
  }
5650
5660
  const rawTools = frontmatterData["allowed-tools"];
5651
5661
  let allowedTools;
5652
- if (rawTools) if (Array.isArray(rawTools)) allowedTools = rawTools.map((t) => String(t).trim()).filter(Boolean);
5653
- else allowedTools = String(rawTools).split(/\s+/).filter(Boolean);
5654
- else allowedTools = [];
5662
+ if (rawTools) {
5663
+ if (Array.isArray(rawTools)) allowedTools = rawTools.map((t) => String(t).trim()).filter(Boolean);
5664
+ else allowedTools = String(rawTools).split(/\s+/).filter(Boolean);
5665
+ } else allowedTools = [];
5655
5666
  let compatibilityStr = String(frontmatterData.compatibility ?? "").trim() || null;
5656
5667
  if (compatibilityStr && compatibilityStr.length > 500) {
5657
5668
  console.warn(`Compatibility exceeds 500 characters in ${skillPath}, truncating`);
@@ -5774,17 +5785,15 @@ function buildPinnedSkillMessage(skill, content) {
5774
5785
  const body = content.replace(FRONTMATTER_PATTERN, "").trimEnd();
5775
5786
  const name = escapeXmlAttribute(skill.name);
5776
5787
  const path = escapeXmlAttribute(skill.path);
5777
- return new _langchain_core_messages.HumanMessage({
5788
+ const message = new _langchain_core_messages.HumanMessage({
5778
5789
  content: `<skill name="${name}" path="${path}">\n${body}\n</skill>`,
5779
- additional_kwargs: {
5780
- lc_source: "pinned_skill",
5781
- skill: {
5782
- name: skill.name,
5783
- path: skill.path,
5784
- description: skill.description
5785
- }
5786
- }
5790
+ additional_kwargs: { skill: {
5791
+ name: skill.name,
5792
+ path: skill.path,
5793
+ description: skill.description
5794
+ } }
5787
5795
  });
5796
+ return (0, _langchain_core_messages.addNotificationMetadata)(message, { source: "pinned_skill" });
5788
5797
  }
5789
5798
  /** Escape `value` for a double-quoted XML attribute. */
5790
5799
  function escapeXmlAttribute(value) {
@@ -5852,20 +5861,6 @@ function validateModulePath(raw) {
5852
5861
  }
5853
5862
  /** Tool `extras` key (and provider field) that withholds a tool's schema until searched for. */
5854
5863
  const DEFER_LOADING = "defer_loading";
5855
- /**
5856
- * Model ID prefixes that accept an inline `tool_definition` mid-conversation.
5857
- *
5858
- * `@langchain/anthropic` sends any mid-conversation system message in place,
5859
- * without gating on the model, so this list is the only guard.
5860
- */
5861
- const ANTHROPIC_INLINE_TOOL_MODELS = [
5862
- "claude-opus-5",
5863
- "claude-fable-5",
5864
- "claude-mythos-5",
5865
- "claude-opus-4-8"
5866
- ];
5867
- /** Models whose Responses API accepts an `additional_tools` input item, matched with or without a `-` suffix such as a snapshot date. */
5868
- const OPENAI_INLINE_TOOL_MODELS = ["gpt-6", "gpt-5.6"];
5869
5864
  /** Root `input_schema` keys the Anthropic API rejects, failing the whole request. */
5870
5865
  const ANTHROPIC_ROOT_COMBINATORS = [
5871
5866
  "oneOf",
@@ -5980,14 +5975,14 @@ async function discloseSkillTools(request, reads, resolver) {
5980
5975
  record: {}
5981
5976
  };
5982
5977
  const chatModel = await resolveChatModel(request.model, request.runtime);
5983
- if (llmType(chatModel) === "anthropic") withholdRootCombinatorTools(disclosed);
5978
+ if (chatModel && getModelProvider(chatModel) === "anthropic") withholdRootCombinatorTools(disclosed);
5984
5979
  const gatedNames = [...disclosed.keys()].filter((name) => disclosed.get(name).includeName !== void 0).sort();
5985
5980
  const record = Object.fromEntries(gatedNames.map((name) => [name, disclosed.get(name).includeName]));
5986
5981
  if (disclosed.size === 0) return {
5987
5982
  request,
5988
5983
  record
5989
5984
  };
5990
- const build = inlineBlockBuilder(chatModel);
5985
+ const build = chatModel && inlineBlockBuilder(chatModel);
5991
5986
  if (build !== void 0) return {
5992
5987
  request: {
5993
5988
  ...request,
@@ -6111,7 +6106,8 @@ function unwrapBinding(model) {
6111
6106
  return _langchain_core_runnables.RunnableBinding.isRunnableBinding(model) ? model.bound : model;
6112
6107
  }
6113
6108
  /**
6114
- * Return the concrete chat model a request will call.
6109
+ * Return the concrete chat model a request will call, or `undefined` if it
6110
+ * isn't a chat model.
6115
6111
  *
6116
6112
  * Resolves a `ConfigurableModel`, which a string `model` always becomes, to
6117
6113
  * the instance it will call with this run's `configurable`. Without
@@ -6121,29 +6117,40 @@ function unwrapBinding(model) {
6121
6117
  */
6122
6118
  async function resolveChatModel(model, runtime) {
6123
6119
  const current = unwrapBinding(model);
6124
- if (current?._queuedMethodOperations === void 0 || typeof current._getModelInstance !== "function") return current;
6120
+ if (!isConfigurableModel(current)) return isBaseChatModel(current) ? current : void 0;
6125
6121
  const configurable = runtime.configurable ?? {};
6126
- const overrides = current._modelParams?.({ configurable }) ?? {};
6127
- return unwrapBinding(Object.keys(overrides).length > 0 ? await current._getModelInstance({ configurable }) : await current._getModelInstance());
6122
+ const overrides = current._modelParams({ configurable });
6123
+ const instance = unwrapBinding(Object.keys(overrides).length > 0 ? await current._getModelInstance({ configurable }) : await current._getModelInstance());
6124
+ return isBaseChatModel(instance) ? instance : void 0;
6128
6125
  }
6129
- /** Return a chat model's `_llmType()`, which tells providers apart. */
6130
- function llmType(model) {
6131
- const fn = model?._llmType;
6132
- return typeof fn === "function" ? fn.call(model) : void 0;
6126
+ /**
6127
+ * Duck-typed as langchain's own (unexported) `isConfigurableModel`, since an
6128
+ * `instanceof` check fails across copies of the package.
6129
+ */
6130
+ function isConfigurableModel(model) {
6131
+ return typeof model === "object" && model !== null && "_queuedMethodOperations" in model && "_getModelInstance" in model && typeof model._getModelInstance === "function";
6132
+ }
6133
+ /**
6134
+ * Duck-typed as langchain's own (unexported) `isBaseChatModel`, since an
6135
+ * `instanceof` check fails across copies of `@langchain/core`.
6136
+ */
6137
+ function isBaseChatModel(model) {
6138
+ return typeof model === "object" && model !== null && "_streamResponseChunks" in model && "_llmType" in model && typeof model._llmType === "function";
6133
6139
  }
6134
6140
  /**
6135
6141
  * Return how `chatModel` is given a tool mid-conversation, or `undefined` if
6136
6142
  * it can't be.
6137
6143
  *
6138
- * The one place that decides support, so a model-profile capability can
6139
- * replace the allowlists later.
6144
+ * The profile's `midConversationTools` decides whether, and the provider
6145
+ * decides the block.
6140
6146
  */
6141
6147
  function inlineBlockBuilder(chatModel) {
6142
- const { model: name, useResponsesApi } = chatModel;
6143
- if (typeof name !== "string") return void 0;
6144
- const type = llmType(chatModel);
6145
- if (type === "anthropic" && ANTHROPIC_INLINE_TOOL_MODELS.some((prefix) => name.startsWith(prefix))) return anthropicToolAddition;
6146
- if (type === "openai" && useResponsesApi === true && OPENAI_INLINE_TOOL_MODELS.some((model) => name === model || name.startsWith(`${model}-`))) return openaiAdditionalTools;
6148
+ if (!chatModel.profile.midConversationTools) return void 0;
6149
+ switch (getModelProvider(chatModel)) {
6150
+ case "anthropic": return anthropicToolAddition;
6151
+ case "openai": return openaiAdditionalTools;
6152
+ default: return;
6153
+ }
6147
6154
  }
6148
6155
  /**
6149
6156
  * Return the definition `ChatAnthropic` sends in `tools` for `tool`, without
@@ -6274,6 +6281,7 @@ function createSkillsMiddleware(options) {
6274
6281
  const hasSkillTools = typeof options.tools === "function" || Array.isArray(options.tools) && options.tools.length > 0;
6275
6282
  return (0, langchain.createMiddleware)({
6276
6283
  name: "SkillsMiddleware",
6284
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
6277
6285
  stateSchema: SkillsStateSchema,
6278
6286
  async beforeModel(state) {
6279
6287
  const needsLoad = state.skillsMetadata === null || state.skillsMetadata === void 0;
@@ -6328,8 +6336,7 @@ function createSkillsMiddleware(options) {
6328
6336
  }
6329
6337
  });
6330
6338
  }
6331
- //#endregion
6332
- //#region src/middleware/completion_callback.ts
6339
+ // src/middleware/completion_callback.ts
6333
6340
  /**
6334
6341
  * Callback middleware for async subagents.
6335
6342
  *
@@ -6546,6 +6553,7 @@ function createCompletionCallbackMiddleware(options) {
6546
6553
  }
6547
6554
  return (0, langchain.createMiddleware)({
6548
6555
  name: "CompletionCallbackMiddleware",
6556
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
6549
6557
  stateSchema: CompletionCallbackStateSchema,
6550
6558
  /**
6551
6559
  * After-agent hook: fires when the subagent completes successfully.
@@ -6577,8 +6585,7 @@ function createCompletionCallbackMiddleware(options) {
6577
6585
  }
6578
6586
  });
6579
6587
  }
6580
- //#endregion
6581
- //#region src/middleware/async_subagents.ts
6588
+ // src/middleware/async_subagents.ts
6582
6589
  function toolCallIdFromRuntime(runtime) {
6583
6590
  return runtime.toolCall?.id ?? runtime.toolCallId ?? "";
6584
6591
  }
@@ -7665,6 +7672,7 @@ function createAsyncSubAgentMiddleware(options) {
7665
7672
  const fullSystemPrompt = systemPrompt ? `${systemPrompt}\n\nAvailable async subagent types:\n${agentsDescription}` : null;
7666
7673
  return (0, langchain.createMiddleware)({
7667
7674
  name: "asyncSubAgentMiddleware",
7675
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
7668
7676
  stateSchema: AsyncTaskStateSchema,
7669
7677
  tools,
7670
7678
  beforeAgent: async (state) => {
@@ -7711,8 +7719,7 @@ function createAsyncSubAgentMiddleware(options) {
7711
7719
  }
7712
7720
  });
7713
7721
  }
7714
- //#endregion
7715
- //#region src/middleware/cache.ts
7722
+ // src/middleware/cache.ts
7716
7723
  /**
7717
7724
  * Creates a middleware that places a cache breakpoint at the end of the static
7718
7725
  * system prompt content.
@@ -7742,6 +7749,7 @@ function createAsyncSubAgentMiddleware(options) {
7742
7749
  function createCacheBreakpointMiddleware() {
7743
7750
  return (0, langchain.createMiddleware)({
7744
7751
  name: "CacheBreakpointMiddleware",
7752
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
7745
7753
  wrapModelCall(request, handler) {
7746
7754
  if (!isAnthropicModel(request.model)) return handler(request);
7747
7755
  const existingContent = request.systemMessage.content;
@@ -7761,8 +7769,7 @@ function createCacheBreakpointMiddleware() {
7761
7769
  }
7762
7770
  });
7763
7771
  }
7764
- //#endregion
7765
- //#region src/middleware/parent_notifier.ts
7772
+ // src/middleware/parent_notifier.ts
7766
7773
  /** Whether this is the outermost graph of a task run, not a graph nested in it. */
7767
7774
  function isTopLevelGraph(config) {
7768
7775
  const configurable = config.configurable ?? {};
@@ -7795,6 +7802,7 @@ function createParentNotifierMiddleware() {
7795
7802
  }
7796
7803
  return (0, langchain.createMiddleware)({
7797
7804
  name: "parentNotifierMiddleware",
7805
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
7798
7806
  afterAgent: async (state) => {
7799
7807
  await report("success", { result: finalContent(state) });
7800
7808
  },
@@ -7808,8 +7816,7 @@ function createParentNotifierMiddleware() {
7808
7816
  }
7809
7817
  });
7810
7818
  }
7811
- //#endregion
7812
- //#region src/middleware/tool_exclusion.ts
7819
+ // src/middleware/tool_exclusion.ts
7813
7820
  function hasToolName(tool) {
7814
7821
  return tool !== null && typeof tool === "object" && "name" in tool && typeof tool.name === "string";
7815
7822
  }
@@ -7823,6 +7830,7 @@ function hasToolName(tool) {
7823
7830
  function createToolExclusionMiddleware(excludedTools) {
7824
7831
  return (0, langchain.createMiddleware)({
7825
7832
  name: "_ToolExclusionMiddleware",
7833
+ tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
7826
7834
  wrapModelCall(request, handler) {
7827
7835
  return handler({
7828
7836
  ...request,
@@ -7841,8 +7849,7 @@ function createToolExclusionMiddleware(excludedTools) {
7841
7849
  }
7842
7850
  });
7843
7851
  }
7844
- //#endregion
7845
- //#region src/profiles/keys.ts
7852
+ // src/profiles/keys.ts
7846
7853
  /**
7847
7854
  * Normalize and validate a profile registry key.
7848
7855
  *
@@ -7872,8 +7879,7 @@ function validateProfileKey(key) {
7872
7879
  }
7873
7880
  return trimmed;
7874
7881
  }
7875
- //#endregion
7876
- //#region src/profiles/harness/types.ts
7882
+ // src/profiles/harness/types.ts
7877
7883
  /**
7878
7884
  * Middleware names that provide essential agent capabilities and cannot
7879
7885
  * be excluded via `excludedMiddleware`.
@@ -7904,8 +7910,7 @@ function resolveMiddleware(middleware) {
7904
7910
  if (typeof middleware === "function") return middleware();
7905
7911
  return middleware;
7906
7912
  }
7907
- //#endregion
7908
- //#region src/profiles/harness/create.ts
7913
+ // src/profiles/harness/create.ts
7909
7914
  /**
7910
7915
  * Validate the grammar of an `excludedMiddleware` entry.
7911
7916
  *
@@ -7967,8 +7972,7 @@ function createHarnessProfile(options = {}) {
7967
7972
  * profile matches. Avoids creating a new object on every miss.
7968
7973
  */
7969
7974
  const EMPTY_HARNESS_PROFILE = createHarnessProfile();
7970
- //#endregion
7971
- //#region src/profiles/harness/serialization.ts
7975
+ // src/profiles/harness/serialization.ts
7972
7976
  const POISONED_KEYS = /* @__PURE__ */ new Set([
7973
7977
  "__proto__",
7974
7978
  "constructor",
@@ -8074,8 +8078,7 @@ function serializeProfile(profile) {
8074
8078
  }
8075
8079
  return result;
8076
8080
  }
8077
- //#endregion
8078
- //#region src/profiles/harness/merge.ts
8081
+ // src/profiles/harness/merge.ts
8079
8082
  /**
8080
8083
  * Merge two middleware sequences by `.name`.
8081
8084
  *
@@ -8160,8 +8163,7 @@ function mergeProfiles(base, override) {
8160
8163
  generalPurposeSubagent: mergeGeneralPurposeSubagentConfigs(base.generalPurposeSubagent, override.generalPurposeSubagent)
8161
8164
  });
8162
8165
  }
8163
- //#endregion
8164
- //#region src/profiles/harness/builtins/anthropic-opus-4-7.ts
8166
+ // src/profiles/harness/builtins/anthropic-opus-4-7.ts
8165
8167
  const SYSTEM_PROMPT_SUFFIX$3 = `\
8166
8168
  <use_parallel_tool_calls>
8167
8169
  If you intend to call multiple tools and there are no dependencies between the tool calls, make all of the independent tool calls in parallel. Prioritize calling tools simultaneously whenever the actions can be done in parallel rather than sequentially. For example, when reading 3 files, run 3 tool calls in parallel to read all 3 files into context at the same time. Maximize use of parallel tool calls where possible to increase speed and efficiency. However, if some tool calls depend on previous calls to inform dependent values like the parameters, do NOT call these tools in parallel and instead call them sequentially. Never use placeholders or guess missing parameters in tool calls.
@@ -8197,8 +8199,7 @@ Spawn multiple subagents in the same turn when fanning out across items or readi
8197
8199
  function register$3() {
8198
8200
  registerHarnessProfileImpl("anthropic:claude-opus-4-7", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$3 }));
8199
8201
  }
8200
- //#endregion
8201
- //#region src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
8202
+ // src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
8202
8203
  const SYSTEM_PROMPT_SUFFIX$2 = `\
8203
8204
  <use_parallel_tool_calls>
8204
8205
  If you intend to call multiple tools and there are no dependencies between the tool calls, make all of the independent tool calls in parallel. Prioritize calling tools simultaneously whenever the actions can be done in parallel rather than sequentially. For example, when reading 3 files, run 3 tool calls in parallel to read all 3 files into context at the same time. Maximize use of parallel tool calls where possible to increase speed and efficiency. However, if some tool calls depend on previous calls to inform dependent values like the parameters, do NOT call these tools in parallel and instead call them sequentially. Never use placeholders or guess missing parameters in tool calls.
@@ -8228,8 +8229,7 @@ After receiving tool results, carefully reflect on their quality and determine o
8228
8229
  function register$2() {
8229
8230
  registerHarnessProfileImpl("anthropic:claude-sonnet-4-6", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$2 }));
8230
8231
  }
8231
- //#endregion
8232
- //#region src/profiles/harness/builtins/anthropic-haiku-4-5.ts
8232
+ // src/profiles/harness/builtins/anthropic-haiku-4-5.ts
8233
8233
  const SYSTEM_PROMPT_SUFFIX$1 = `\
8234
8234
  <use_parallel_tool_calls>
8235
8235
  If you intend to call multiple tools and there are no dependencies between the tool calls, make all of the independent tool calls in parallel. Prioritize calling tools simultaneously whenever the actions can be done in parallel rather than sequentially. For example, when reading 3 files, run 3 tool calls in parallel to read all 3 files into context at the same time. Maximize use of parallel tool calls where possible to increase speed and efficiency. However, if some tool calls depend on previous calls to inform dependent values like the parameters, do NOT call these tools in parallel and instead call them sequentially. Never use placeholders or guess missing parameters in tool calls.
@@ -8253,8 +8253,7 @@ After receiving tool results, carefully reflect on their quality and determine o
8253
8253
  function register$1() {
8254
8254
  registerHarnessProfileImpl("anthropic:claude-haiku-4-5", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$1 }));
8255
8255
  }
8256
- //#endregion
8257
- //#region src/profiles/harness/builtins/openai-codex.ts
8256
+ // src/profiles/harness/builtins/openai-codex.ts
8258
8257
  /**
8259
8258
  * Model specs that receive the Codex harness profile.
8260
8259
  *
@@ -8311,8 +8310,7 @@ function register() {
8311
8310
  });
8312
8311
  for (const spec of CODEX_MODEL_SPECS) registerHarnessProfileImpl(spec, profile);
8313
8312
  }
8314
- //#endregion
8315
- //#region src/profiles/harness/builtins/index.ts
8313
+ // src/profiles/harness/builtins/index.ts
8316
8314
  /**
8317
8315
  * Register all built-in harness profiles and snapshot the resulting
8318
8316
  * registry keys as the builtin baseline.
@@ -8330,8 +8328,7 @@ function loadBuiltinProfiles() {
8330
8328
  register();
8331
8329
  snapshotBuiltinKeys();
8332
8330
  }
8333
- //#endregion
8334
- //#region src/profiles/harness/registry.ts
8331
+ // src/profiles/harness/registry.ts
8335
8332
  /**
8336
8333
  * Process-global symbol key for the harness profile registry. The `.v1`
8337
8334
  * suffix is a version gate — bump it when the {@link HarnessProfileRegistry}
@@ -8514,8 +8511,7 @@ function applyProfilePrompt(profile, basePrompt) {
8514
8511
  if (profile.systemPromptSuffix !== void 0) return prompt ? `${prompt}\n\n${profile.systemPromptSuffix}` : profile.systemPromptSuffix;
8515
8512
  return prompt;
8516
8513
  }
8517
- //#endregion
8518
- //#region src/agent.ts
8514
+ // src/agent.ts
8519
8515
  function normalizeSystemPrompt(systemPrompt) {
8520
8516
  if (systemPrompt === void 0) return {};
8521
8517
  if (typeof systemPrompt === "string" || langchain.SystemMessage.isInstance(systemPrompt)) return { prefix: systemPrompt };
@@ -8763,8 +8759,7 @@ function createDeepAgent(params = {}) {
8763
8759
  }
8764
8760
  });
8765
8761
  }
8766
- //#endregion
8767
- //#region src/compat.ts
8762
+ // src/compat.ts
8768
8763
  /**
8769
8764
  * @deprecated Legacy prompt compatibility exports.
8770
8765
  *
@@ -8897,8 +8892,7 @@ const EXECUTION_SYSTEM_PROMPT = langchain.context`
8897
8892
 
8898
8893
  - execute: run a shell command in the sandbox (returns output and exit code)
8899
8894
  `;
8900
- //#endregion
8901
- //#region src/backends/store.ts
8895
+ // src/backends/store.ts
8902
8896
  /**
8903
8897
  * StoreBackend: Adapter for LangGraph's BaseStore (persistent, cross-thread).
8904
8898
  */
@@ -9397,8 +9391,7 @@ var StoreBackend = class {
9397
9391
  return responses;
9398
9392
  }
9399
9393
  };
9400
- //#endregion
9401
- //#region src/backends/context-hub.ts
9394
+ // src/backends/context-hub.ts
9402
9395
  /**
9403
9396
  * ContextHubBackend: Store files in a LangSmith Hub agent repo (persistent).
9404
9397
  */
@@ -10168,8 +10161,7 @@ var ContextHubBackend = class ContextHubBackend {
10168
10161
  });
10169
10162
  }
10170
10163
  };
10171
- //#endregion
10172
- //#region src/backends/sandbox.ts
10164
+ // src/backends/sandbox.ts
10173
10165
  /**
10174
10166
  * Shell-quote a string using single quotes (POSIX).
10175
10167
  * Escapes embedded single quotes with the '\'' technique.
@@ -10191,17 +10183,18 @@ function globToPathRegex(pattern) {
10191
10183
  let i = 0;
10192
10184
  while (i < pattern.length) {
10193
10185
  const c = pattern[i];
10194
- if (c === "*") if (i + 1 < pattern.length && pattern[i + 1] === "*") {
10195
- i += 2;
10196
- if (i < pattern.length && pattern[i] === "/") {
10197
- regex += "(.*/)?";
10186
+ if (c === "*") {
10187
+ if (i + 1 < pattern.length && pattern[i + 1] === "*") {
10188
+ i += 2;
10189
+ if (i < pattern.length && pattern[i] === "/") {
10190
+ regex += "(.*/)?";
10191
+ i++;
10192
+ } else regex += ".*";
10193
+ } else {
10194
+ regex += "[^/]*";
10198
10195
  i++;
10199
- } else regex += ".*";
10200
- } else {
10201
- regex += "[^/]*";
10202
- i++;
10203
- }
10204
- else if (c === "?") {
10196
+ }
10197
+ } else if (c === "?") {
10205
10198
  regex += "[^/]";
10206
10199
  i++;
10207
10200
  } else if (c === "[") {
@@ -10663,8 +10656,7 @@ var BaseSandbox = class {
10663
10656
  };
10664
10657
  }
10665
10658
  };
10666
- //#endregion
10667
- //#region src/backends/langsmith.ts
10659
+ // src/backends/langsmith.ts
10668
10660
  /**
10669
10661
  * LangSmith Sandbox backend for deepagents.
10670
10662
  *
@@ -10863,7 +10855,6 @@ var LangSmithSandbox = class LangSmithSandbox extends BaseSandbox {
10863
10855
  });
10864
10856
  }
10865
10857
  };
10866
- //#endregion
10867
10858
  Object.defineProperty(exports, "ASYNC_TASK_SYSTEM_PROMPT", {
10868
10859
  enumerable: true,
10869
10860
  get: function() {
@@ -11225,4 +11216,4 @@ Object.defineProperty(exports, "skillsMetadataValue", {
11225
11216
  }
11226
11217
  });
11227
11218
 
11228
- //# sourceMappingURL=langsmith-9ilIzQAp.cjs.map
11219
+ //# sourceMappingURL=langsmith-CAjAu64d.cjs.map