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,5 @@
1
1
  import { AIMessage, HumanMessage, SystemMessage, ToolMessage, anthropicPromptCachingMiddleware, bedrockPromptCachingMiddleware, context, countTokensApproximately, createAgent, createMiddleware, humanInTheLoopMiddleware, todoListMiddleware, tool } from "langchain";
2
+ import { omitPayload } from "@langchain/core/tracers/tracer_langchain";
2
3
  import { ContextOverflowError } from "@langchain/core/errors";
3
4
  import { Command, Overwrite, REMOVE_ALL_MESSAGES, ReducedValue, StateSchema, getConfig, getCurrentTaskInput, getStore, isCommand, isGraphBubbleUp } from "@langchain/langgraph";
4
5
  import { z } from "zod/v4";
@@ -19,7 +20,7 @@ import { Client } from "@langchain/langgraph-sdk";
19
20
  import { getCurrentRunTree } from "langsmith/traceable";
20
21
  import { Client as Client$1 } from "langsmith";
21
22
  import { LangSmithResourceNotFoundError, LangSmithSandboxError, SandboxClient } from "langsmith/experimental/sandbox";
22
- //#region src/backends/realpath.ts
23
+ // src/backends/realpath.ts
23
24
  const REALPATH = Symbol.for("deepagents.realpath");
24
25
  function getRealpath(backend) {
25
26
  if (typeof backend !== "object" || backend === null) return;
@@ -33,8 +34,7 @@ function setRealpath(target, fn) {
33
34
  configurable: true
34
35
  });
35
36
  }
36
- //#endregion
37
- //#region src/backends/utils.ts
37
+ // src/backends/utils.ts
38
38
  /**
39
39
  * Shared utility functions for memory backend implementations.
40
40
  *
@@ -694,8 +694,7 @@ function adaptSandboxProtocol(sandbox) {
694
694
  });
695
695
  return adapted;
696
696
  }
697
- //#endregion
698
- //#region src/backends/protocol.ts
697
+ // src/backends/protocol.ts
699
698
  /**
700
699
  * Enforce a match cap after a backend grep has completed.
701
700
  *
@@ -799,8 +798,7 @@ async function resolveBackend(backend, runtime) {
799
798
  }
800
799
  return isSandboxProtocol(backend) ? adaptSandboxProtocol(backend) : adaptBackendProtocol(backend);
801
800
  }
802
- //#endregion
803
- //#region src/backends/state.ts
801
+ // src/backends/state.ts
804
802
  function trimTrailingSlashes$2(path) {
805
803
  let end = path.length;
806
804
  while (end > 1 && path[end - 1] === "/") end--;
@@ -1179,8 +1177,7 @@ var StateBackend = class {
1179
1177
  return responses;
1180
1178
  }
1181
1179
  };
1182
- //#endregion
1183
- //#region src/middleware/blobOffload.ts
1180
+ // src/middleware/blobOffload.ts
1184
1181
  /**
1185
1182
  * Content-addressed offload of binary `read_file` and inline `HumanMessage`
1186
1183
  * blocks to the backend.
@@ -1486,15 +1483,17 @@ function restorePayloads(messages, payloads) {
1486
1483
  async function hydrateMessages(messages, backend, prefix, cache) {
1487
1484
  if (!messages.some(messageHasRefs)) return [...messages];
1488
1485
  const { payloads, missing } = cachedPayloads(referencedDigests(messages), cache);
1489
- if (missing.length > 0) if (typeof backend.downloadFiles !== "function") console.warn("Backend does not support downloadFiles; offloaded read_file content is unavailable");
1490
- else {
1491
- let responses = [];
1492
- try {
1493
- responses = await backend.downloadFiles(missing.map((digest) => blobPath(prefix, digest)));
1494
- } catch (error) {
1495
- console.warn("Failed to load offloaded read_file content", error);
1486
+ if (missing.length > 0) {
1487
+ if (typeof backend.downloadFiles !== "function") console.warn("Backend does not support downloadFiles; offloaded read_file content is unavailable");
1488
+ else {
1489
+ let responses = [];
1490
+ try {
1491
+ responses = await backend.downloadFiles(missing.map((digest) => blobPath(prefix, digest)));
1492
+ } catch (error) {
1493
+ console.warn("Failed to load offloaded read_file content", error);
1494
+ }
1495
+ acceptDownloads(missing, responses, payloads, cache);
1496
1496
  }
1497
- acceptDownloads(missing, responses, payloads, cache);
1498
1497
  }
1499
1498
  return restorePayloads(messages, payloads);
1500
1499
  }
@@ -1506,8 +1505,7 @@ async function hydrateMessages(messages, backend, prefix, cache) {
1506
1505
  function withoutBlobRefs(messages) {
1507
1506
  return messages.some(messageHasRefs) ? restorePayloads(messages, /* @__PURE__ */ new Map()) : messages;
1508
1507
  }
1509
- //#endregion
1510
- //#region src/middleware/unsupportedContent.ts
1508
+ // src/middleware/unsupportedContent.ts
1511
1509
  const PDF_MIME_TYPE = "application/pdf";
1512
1510
  /** Content block types `read_file` may emit that require multimodal model support. */
1513
1511
  const MULTIMODAL_BLOCK_TYPES = /* @__PURE__ */ new Set([
@@ -1647,8 +1645,7 @@ function createUnsupportedContentMiddleware() {
1647
1645
  }
1648
1646
  });
1649
1647
  }
1650
- //#endregion
1651
- //#region src/permissions/enforce.ts
1648
+ // src/permissions/enforce.ts
1652
1649
  /**
1653
1650
  * Validate permission rule paths at setup time. Throws if any path is
1654
1651
  * relative, contains `..`, or contains `~`.
@@ -1703,8 +1700,7 @@ function decidePathAccess(rules, operation, path) {
1703
1700
  }
1704
1701
  return "allow";
1705
1702
  }
1706
- //#endregion
1707
- //#region src/backends/composite.ts
1703
+ // src/backends/composite.ts
1708
1704
  /**
1709
1705
  * Backend that routes file operations to different backends based on path prefix.
1710
1706
  *
@@ -2131,8 +2127,7 @@ var CompositeBackend = class {
2131
2127
  return results;
2132
2128
  }
2133
2129
  };
2134
- //#endregion
2135
- //#region src/middleware/fs.ts
2130
+ // src/middleware/fs.ts
2136
2131
  /**
2137
2132
  * Middleware for providing filesystem tools to an agent.
2138
2133
  *
@@ -2363,6 +2358,25 @@ function truncatePaginatedRead(body, readResult, options) {
2363
2358
  */
2364
2359
  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.";
2365
2360
  /**
2361
+ * Characters of a grep line shown to the model. Longer lines (minified JSON,
2362
+ * offloaded tool results) show a window around the match instead, so one hit
2363
+ * can't return the whole line.
2364
+ */
2365
+ const GREP_LINE_CHAR_LIMIT = 2e3;
2366
+ /**
2367
+ * Clip `text` to a `GREP_LINE_CHAR_LIMIT` window centered on `pattern`,
2368
+ * falling back to the head of the line when `pattern` isn't found in it.
2369
+ */
2370
+ function clipGrepLine(text, pattern) {
2371
+ if (text.length <= 2e3) return text;
2372
+ const center = Math.max(text.indexOf(pattern), 0) + Math.floor(pattern.length / 2);
2373
+ const start = Math.min(Math.max(center - GREP_LINE_CHAR_LIMIT / 2, 0), text.length - GREP_LINE_CHAR_LIMIT);
2374
+ const end = start + GREP_LINE_CHAR_LIMIT;
2375
+ const before = start > 0 ? `[${start} chars clipped] ` : "";
2376
+ const after = end < text.length ? ` [${text.length - end} chars clipped]` : "";
2377
+ return `${before}${text.slice(start, end)}${after}`;
2378
+ }
2379
+ /**
2366
2380
  * Default cap on the number of matches the grep tool returns.
2367
2381
  * Set to null to disable the cap.
2368
2382
  */
@@ -3147,7 +3161,10 @@ function createGrepTool(backend, options) {
3147
3161
  if (result.error) return toolError(runtime, "grep", result.error);
3148
3162
  const matches = await filterByPermissions(resolvedBackend, result.matches ?? [], permissions, "read", (m) => m.path);
3149
3163
  if (matches.length === 0) return `No matches found for pattern '${pattern}'`;
3150
- const truncated = truncateIfTooLong(formatGrepMatches(matches, output_mode));
3164
+ const truncated = truncateIfTooLong(formatGrepMatches(matches.map((m) => ({
3165
+ ...m,
3166
+ text: clipGrepLine(m.text, pattern)
3167
+ })), output_mode));
3151
3168
  let content = typeof truncated === "string" ? truncated : truncated.join("\n");
3152
3169
  if (result.truncated) content += `\n\n${GREP_TRUNCATION_NOTE}`;
3153
3170
  return content;
@@ -3392,6 +3409,7 @@ function createFilesystemMiddleware(options = {}) {
3392
3409
  }
3393
3410
  return createMiddleware({
3394
3411
  name: "FilesystemMiddleware",
3412
+ tracePolicy: { processInputs: omitPayload },
3395
3413
  stateSchema: FilesystemStateSchema,
3396
3414
  tools: allTools,
3397
3415
  async beforeAgent(state) {
@@ -3522,8 +3540,7 @@ function createFilesystemMiddleware(options = {}) {
3522
3540
  }
3523
3541
  });
3524
3542
  }
3525
- //#endregion
3526
- //#region src/middleware/summarization.ts
3543
+ // src/middleware/summarization.ts
3527
3544
  /**
3528
3545
  * Summarization middleware with backend support for conversation history offloading.
3529
3546
  *
@@ -4081,10 +4098,7 @@ function createSummarizationMiddleware(options) {
4081
4098
  </summary>
4082
4099
  `;
4083
4100
  else content = `Here is a summary of the conversation to date:\n\n${summary}`;
4084
- return new HumanMessage({
4085
- content,
4086
- additional_kwargs: { lc_source: "summarization" }
4087
- });
4101
+ return addNotificationMetadata(new HumanMessage({ content }), { source: "summarization" });
4088
4102
  }
4089
4103
  /**
4090
4104
  * Summarize a set of messages using the given model and build the
@@ -4172,6 +4186,7 @@ function createSummarizationMiddleware(options) {
4172
4186
  }
4173
4187
  return createMiddleware({
4174
4188
  name: "SummarizationMiddleware",
4189
+ tracePolicy: { processInputs: omitPayload },
4175
4190
  stateSchema: SummarizationStateSchema,
4176
4191
  async wrapModelCall(request, handler) {
4177
4192
  const effectiveMessages = getEffectiveMessages(request.messages ?? [], request.state);
@@ -4216,8 +4231,7 @@ function createSummarizationMiddleware(options) {
4216
4231
  }
4217
4232
  });
4218
4233
  }
4219
- //#endregion
4220
- //#region src/middleware/utils.ts
4234
+ // src/middleware/utils.ts
4221
4235
  /**
4222
4236
  * Utility functions for middleware.
4223
4237
  *
@@ -4293,8 +4307,7 @@ function appendToSystemMessage(systemMessage, text) {
4293
4307
  }
4294
4308
  return new SystemMessage$1({ content: text });
4295
4309
  }
4296
- //#endregion
4297
- //#region src/middleware/subagents.ts
4310
+ // src/middleware/subagents.ts
4298
4311
  /**
4299
4312
  * Config key used by task-tool callers to request dynamic response format.
4300
4313
  *
@@ -4514,6 +4527,7 @@ const ForkedContextStateSchema = z.object({ [FORKED_CONTEXT_KEY]: z.boolean().op
4514
4527
  function createForkTaskToolMiddleware(taskTool) {
4515
4528
  return createMiddleware({
4516
4529
  name: "forkTaskToolMiddleware",
4530
+ tracePolicy: { processInputs: omitPayload },
4517
4531
  stateSchema: ForkedContextStateSchema,
4518
4532
  tools: [taskTool],
4519
4533
  beforeAgent: () => ({ [FORKED_CONTEXT_KEY]: true })
@@ -4750,6 +4764,7 @@ function createSubAgentMiddleware(options) {
4750
4764
  });
4751
4765
  return createMiddleware({
4752
4766
  name: "subAgentMiddleware",
4767
+ tracePolicy: { processInputs: omitPayload },
4753
4768
  tools: [taskTool],
4754
4769
  wrapModelCall: async (request, handler) => {
4755
4770
  if (systemPrompt !== null) return handler({
@@ -4760,8 +4775,7 @@ function createSubAgentMiddleware(options) {
4760
4775
  }
4761
4776
  });
4762
4777
  }
4763
- //#endregion
4764
- //#region src/middleware/patch_tool_calls.ts
4778
+ // src/middleware/patch_tool_calls.ts
4765
4779
  /**
4766
4780
  * Patch tool call / tool response parity in a messages array.
4767
4781
  *
@@ -4855,6 +4869,7 @@ function patchDanglingToolCalls(messages) {
4855
4869
  function createPatchToolCallsMiddleware() {
4856
4870
  return createMiddleware({
4857
4871
  name: "patchToolCallsMiddleware",
4872
+ tracePolicy: { processInputs: omitPayload },
4858
4873
  beforeAgent: async (state) => {
4859
4874
  const messages = state.messages;
4860
4875
  if (!messages || messages.length === 0) return;
@@ -4884,8 +4899,7 @@ function createPatchToolCallsMiddleware() {
4884
4899
  }
4885
4900
  });
4886
4901
  }
4887
- //#endregion
4888
- //#region src/values.ts
4902
+ // src/values.ts
4889
4903
  /**
4890
4904
  * Shared state values for use in StateSchema definitions.
4891
4905
  *
@@ -4918,8 +4932,7 @@ const filesValue = new ReducedValue(z$1.record(z$1.string(), FileDataSchema).def
4918
4932
  inputSchema: z$1.record(z$1.string(), FileDataSchema.nullable()).optional(),
4919
4933
  reducer: fileDataReducer
4920
4934
  });
4921
- //#endregion
4922
- //#region src/utils.ts
4935
+ // src/utils.ts
4923
4936
  /**
4924
4937
  * Detect whether a model is an Anthropic model.
4925
4938
  *
@@ -5029,8 +5042,7 @@ function getModelProvider(model) {
5029
5042
  function getModelIdentifier(model) {
5030
5043
  return (model.getName() === "ConfigurableModel" ? model._defaultConfig : void 0)?.model ?? model.model_name ?? model.modelName ?? void 0;
5031
5044
  }
5032
- //#endregion
5033
- //#region src/middleware/memory.ts
5045
+ // src/middleware/memory.ts
5034
5046
  /**
5035
5047
  * Middleware for loading agent memory/context from AGENTS.md files.
5036
5048
  *
@@ -5216,6 +5228,7 @@ function createMemoryMiddleware(options) {
5216
5228
  const { backend, sources, addCacheControl = false } = options;
5217
5229
  return createMiddleware({
5218
5230
  name: "MemoryMiddleware",
5231
+ tracePolicy: { processInputs: omitPayload },
5219
5232
  stateSchema: MemoryStateSchema,
5220
5233
  async beforeAgent(state) {
5221
5234
  if ("memoryContents" in state && state.memoryContents != null) return;
@@ -5250,8 +5263,7 @@ function createMemoryMiddleware(options) {
5250
5263
  }
5251
5264
  });
5252
5265
  }
5253
- //#endregion
5254
- //#region src/errors.ts
5266
+ // src/errors.ts
5255
5267
  const CONFIGURATION_ERROR_SYMBOL = Symbol.for("deepagents.configuration_error");
5256
5268
  /**
5257
5269
  * Thrown when `createDeepAgent` receives invalid configuration.
@@ -5290,8 +5302,7 @@ var ConfigurationError = class ConfigurationError extends Error {
5290
5302
  return typeof error === "object" && error !== null && error[CONFIGURATION_ERROR_SYMBOL] === true;
5291
5303
  }
5292
5304
  };
5293
- //#endregion
5294
- //#region src/middleware/skills.ts
5305
+ // src/middleware/skills.ts
5295
5306
  /**
5296
5307
  * Backend-agnostic skills middleware for loading agent skills from any backend.
5297
5308
  *
@@ -5625,9 +5636,10 @@ function parseSkillMetadataFromContent(content, skillPath, directoryName) {
5625
5636
  }
5626
5637
  const rawTools = frontmatterData["allowed-tools"];
5627
5638
  let allowedTools;
5628
- if (rawTools) if (Array.isArray(rawTools)) allowedTools = rawTools.map((t) => String(t).trim()).filter(Boolean);
5629
- else allowedTools = String(rawTools).split(/\s+/).filter(Boolean);
5630
- else allowedTools = [];
5639
+ if (rawTools) {
5640
+ if (Array.isArray(rawTools)) allowedTools = rawTools.map((t) => String(t).trim()).filter(Boolean);
5641
+ else allowedTools = String(rawTools).split(/\s+/).filter(Boolean);
5642
+ } else allowedTools = [];
5631
5643
  let compatibilityStr = String(frontmatterData.compatibility ?? "").trim() || null;
5632
5644
  if (compatibilityStr && compatibilityStr.length > 500) {
5633
5645
  console.warn(`Compatibility exceeds 500 characters in ${skillPath}, truncating`);
@@ -5750,17 +5762,15 @@ function buildPinnedSkillMessage(skill, content) {
5750
5762
  const body = content.replace(FRONTMATTER_PATTERN, "").trimEnd();
5751
5763
  const name = escapeXmlAttribute(skill.name);
5752
5764
  const path = escapeXmlAttribute(skill.path);
5753
- return new HumanMessage$1({
5765
+ const message = new HumanMessage$1({
5754
5766
  content: `<skill name="${name}" path="${path}">\n${body}\n</skill>`,
5755
- additional_kwargs: {
5756
- lc_source: "pinned_skill",
5757
- skill: {
5758
- name: skill.name,
5759
- path: skill.path,
5760
- description: skill.description
5761
- }
5762
- }
5767
+ additional_kwargs: { skill: {
5768
+ name: skill.name,
5769
+ path: skill.path,
5770
+ description: skill.description
5771
+ } }
5763
5772
  });
5773
+ return addNotificationMetadata(message, { source: "pinned_skill" });
5764
5774
  }
5765
5775
  /** Escape `value` for a double-quoted XML attribute. */
5766
5776
  function escapeXmlAttribute(value) {
@@ -5828,20 +5838,6 @@ function validateModulePath(raw) {
5828
5838
  }
5829
5839
  /** Tool `extras` key (and provider field) that withholds a tool's schema until searched for. */
5830
5840
  const DEFER_LOADING = "defer_loading";
5831
- /**
5832
- * Model ID prefixes that accept an inline `tool_definition` mid-conversation.
5833
- *
5834
- * `@langchain/anthropic` sends any mid-conversation system message in place,
5835
- * without gating on the model, so this list is the only guard.
5836
- */
5837
- const ANTHROPIC_INLINE_TOOL_MODELS = [
5838
- "claude-opus-5",
5839
- "claude-fable-5",
5840
- "claude-mythos-5",
5841
- "claude-opus-4-8"
5842
- ];
5843
- /** Models whose Responses API accepts an `additional_tools` input item, matched with or without a `-` suffix such as a snapshot date. */
5844
- const OPENAI_INLINE_TOOL_MODELS = ["gpt-6", "gpt-5.6"];
5845
5841
  /** Root `input_schema` keys the Anthropic API rejects, failing the whole request. */
5846
5842
  const ANTHROPIC_ROOT_COMBINATORS = [
5847
5843
  "oneOf",
@@ -5956,14 +5952,14 @@ async function discloseSkillTools(request, reads, resolver) {
5956
5952
  record: {}
5957
5953
  };
5958
5954
  const chatModel = await resolveChatModel(request.model, request.runtime);
5959
- if (llmType(chatModel) === "anthropic") withholdRootCombinatorTools(disclosed);
5955
+ if (chatModel && getModelProvider(chatModel) === "anthropic") withholdRootCombinatorTools(disclosed);
5960
5956
  const gatedNames = [...disclosed.keys()].filter((name) => disclosed.get(name).includeName !== void 0).sort();
5961
5957
  const record = Object.fromEntries(gatedNames.map((name) => [name, disclosed.get(name).includeName]));
5962
5958
  if (disclosed.size === 0) return {
5963
5959
  request,
5964
5960
  record
5965
5961
  };
5966
- const build = inlineBlockBuilder(chatModel);
5962
+ const build = chatModel && inlineBlockBuilder(chatModel);
5967
5963
  if (build !== void 0) return {
5968
5964
  request: {
5969
5965
  ...request,
@@ -6087,7 +6083,8 @@ function unwrapBinding(model) {
6087
6083
  return RunnableBinding.isRunnableBinding(model) ? model.bound : model;
6088
6084
  }
6089
6085
  /**
6090
- * Return the concrete chat model a request will call.
6086
+ * Return the concrete chat model a request will call, or `undefined` if it
6087
+ * isn't a chat model.
6091
6088
  *
6092
6089
  * Resolves a `ConfigurableModel`, which a string `model` always becomes, to
6093
6090
  * the instance it will call with this run's `configurable`. Without
@@ -6097,29 +6094,40 @@ function unwrapBinding(model) {
6097
6094
  */
6098
6095
  async function resolveChatModel(model, runtime) {
6099
6096
  const current = unwrapBinding(model);
6100
- if (current?._queuedMethodOperations === void 0 || typeof current._getModelInstance !== "function") return current;
6097
+ if (!isConfigurableModel(current)) return isBaseChatModel(current) ? current : void 0;
6101
6098
  const configurable = runtime.configurable ?? {};
6102
- const overrides = current._modelParams?.({ configurable }) ?? {};
6103
- return unwrapBinding(Object.keys(overrides).length > 0 ? await current._getModelInstance({ configurable }) : await current._getModelInstance());
6099
+ const overrides = current._modelParams({ configurable });
6100
+ const instance = unwrapBinding(Object.keys(overrides).length > 0 ? await current._getModelInstance({ configurable }) : await current._getModelInstance());
6101
+ return isBaseChatModel(instance) ? instance : void 0;
6104
6102
  }
6105
- /** Return a chat model's `_llmType()`, which tells providers apart. */
6106
- function llmType(model) {
6107
- const fn = model?._llmType;
6108
- return typeof fn === "function" ? fn.call(model) : void 0;
6103
+ /**
6104
+ * Duck-typed as langchain's own (unexported) `isConfigurableModel`, since an
6105
+ * `instanceof` check fails across copies of the package.
6106
+ */
6107
+ function isConfigurableModel(model) {
6108
+ return typeof model === "object" && model !== null && "_queuedMethodOperations" in model && "_getModelInstance" in model && typeof model._getModelInstance === "function";
6109
+ }
6110
+ /**
6111
+ * Duck-typed as langchain's own (unexported) `isBaseChatModel`, since an
6112
+ * `instanceof` check fails across copies of `@langchain/core`.
6113
+ */
6114
+ function isBaseChatModel(model) {
6115
+ return typeof model === "object" && model !== null && "_streamResponseChunks" in model && "_llmType" in model && typeof model._llmType === "function";
6109
6116
  }
6110
6117
  /**
6111
6118
  * Return how `chatModel` is given a tool mid-conversation, or `undefined` if
6112
6119
  * it can't be.
6113
6120
  *
6114
- * The one place that decides support, so a model-profile capability can
6115
- * replace the allowlists later.
6121
+ * The profile's `midConversationTools` decides whether, and the provider
6122
+ * decides the block.
6116
6123
  */
6117
6124
  function inlineBlockBuilder(chatModel) {
6118
- const { model: name, useResponsesApi } = chatModel;
6119
- if (typeof name !== "string") return void 0;
6120
- const type = llmType(chatModel);
6121
- if (type === "anthropic" && ANTHROPIC_INLINE_TOOL_MODELS.some((prefix) => name.startsWith(prefix))) return anthropicToolAddition;
6122
- if (type === "openai" && useResponsesApi === true && OPENAI_INLINE_TOOL_MODELS.some((model) => name === model || name.startsWith(`${model}-`))) return openaiAdditionalTools;
6125
+ if (!chatModel.profile.midConversationTools) return void 0;
6126
+ switch (getModelProvider(chatModel)) {
6127
+ case "anthropic": return anthropicToolAddition;
6128
+ case "openai": return openaiAdditionalTools;
6129
+ default: return;
6130
+ }
6123
6131
  }
6124
6132
  /**
6125
6133
  * Return the definition `ChatAnthropic` sends in `tools` for `tool`, without
@@ -6250,6 +6258,7 @@ function createSkillsMiddleware(options) {
6250
6258
  const hasSkillTools = typeof options.tools === "function" || Array.isArray(options.tools) && options.tools.length > 0;
6251
6259
  return createMiddleware({
6252
6260
  name: "SkillsMiddleware",
6261
+ tracePolicy: { processInputs: omitPayload },
6253
6262
  stateSchema: SkillsStateSchema,
6254
6263
  async beforeModel(state) {
6255
6264
  const needsLoad = state.skillsMetadata === null || state.skillsMetadata === void 0;
@@ -6304,8 +6313,7 @@ function createSkillsMiddleware(options) {
6304
6313
  }
6305
6314
  });
6306
6315
  }
6307
- //#endregion
6308
- //#region src/middleware/completion_callback.ts
6316
+ // src/middleware/completion_callback.ts
6309
6317
  /**
6310
6318
  * Callback middleware for async subagents.
6311
6319
  *
@@ -6522,6 +6530,7 @@ function createCompletionCallbackMiddleware(options) {
6522
6530
  }
6523
6531
  return createMiddleware({
6524
6532
  name: "CompletionCallbackMiddleware",
6533
+ tracePolicy: { processInputs: omitPayload },
6525
6534
  stateSchema: CompletionCallbackStateSchema,
6526
6535
  /**
6527
6536
  * After-agent hook: fires when the subagent completes successfully.
@@ -6553,8 +6562,7 @@ function createCompletionCallbackMiddleware(options) {
6553
6562
  }
6554
6563
  });
6555
6564
  }
6556
- //#endregion
6557
- //#region src/middleware/async_subagents.ts
6565
+ // src/middleware/async_subagents.ts
6558
6566
  function toolCallIdFromRuntime(runtime) {
6559
6567
  return runtime.toolCall?.id ?? runtime.toolCallId ?? "";
6560
6568
  }
@@ -7641,6 +7649,7 @@ function createAsyncSubAgentMiddleware(options) {
7641
7649
  const fullSystemPrompt = systemPrompt ? `${systemPrompt}\n\nAvailable async subagent types:\n${agentsDescription}` : null;
7642
7650
  return createMiddleware({
7643
7651
  name: "asyncSubAgentMiddleware",
7652
+ tracePolicy: { processInputs: omitPayload },
7644
7653
  stateSchema: AsyncTaskStateSchema,
7645
7654
  tools,
7646
7655
  beforeAgent: async (state) => {
@@ -7687,8 +7696,7 @@ function createAsyncSubAgentMiddleware(options) {
7687
7696
  }
7688
7697
  });
7689
7698
  }
7690
- //#endregion
7691
- //#region src/middleware/cache.ts
7699
+ // src/middleware/cache.ts
7692
7700
  /**
7693
7701
  * Creates a middleware that places a cache breakpoint at the end of the static
7694
7702
  * system prompt content.
@@ -7718,6 +7726,7 @@ function createAsyncSubAgentMiddleware(options) {
7718
7726
  function createCacheBreakpointMiddleware() {
7719
7727
  return createMiddleware({
7720
7728
  name: "CacheBreakpointMiddleware",
7729
+ tracePolicy: { processInputs: omitPayload },
7721
7730
  wrapModelCall(request, handler) {
7722
7731
  if (!isAnthropicModel(request.model)) return handler(request);
7723
7732
  const existingContent = request.systemMessage.content;
@@ -7737,8 +7746,7 @@ function createCacheBreakpointMiddleware() {
7737
7746
  }
7738
7747
  });
7739
7748
  }
7740
- //#endregion
7741
- //#region src/middleware/parent_notifier.ts
7749
+ // src/middleware/parent_notifier.ts
7742
7750
  /** Whether this is the outermost graph of a task run, not a graph nested in it. */
7743
7751
  function isTopLevelGraph(config) {
7744
7752
  const configurable = config.configurable ?? {};
@@ -7771,6 +7779,7 @@ function createParentNotifierMiddleware() {
7771
7779
  }
7772
7780
  return createMiddleware({
7773
7781
  name: "parentNotifierMiddleware",
7782
+ tracePolicy: { processInputs: omitPayload },
7774
7783
  afterAgent: async (state) => {
7775
7784
  await report("success", { result: finalContent(state) });
7776
7785
  },
@@ -7784,8 +7793,7 @@ function createParentNotifierMiddleware() {
7784
7793
  }
7785
7794
  });
7786
7795
  }
7787
- //#endregion
7788
- //#region src/middleware/tool_exclusion.ts
7796
+ // src/middleware/tool_exclusion.ts
7789
7797
  function hasToolName(tool) {
7790
7798
  return tool !== null && typeof tool === "object" && "name" in tool && typeof tool.name === "string";
7791
7799
  }
@@ -7799,6 +7807,7 @@ function hasToolName(tool) {
7799
7807
  function createToolExclusionMiddleware(excludedTools) {
7800
7808
  return createMiddleware({
7801
7809
  name: "_ToolExclusionMiddleware",
7810
+ tracePolicy: { processInputs: omitPayload },
7802
7811
  wrapModelCall(request, handler) {
7803
7812
  return handler({
7804
7813
  ...request,
@@ -7817,8 +7826,7 @@ function createToolExclusionMiddleware(excludedTools) {
7817
7826
  }
7818
7827
  });
7819
7828
  }
7820
- //#endregion
7821
- //#region src/profiles/keys.ts
7829
+ // src/profiles/keys.ts
7822
7830
  /**
7823
7831
  * Normalize and validate a profile registry key.
7824
7832
  *
@@ -7848,8 +7856,7 @@ function validateProfileKey(key) {
7848
7856
  }
7849
7857
  return trimmed;
7850
7858
  }
7851
- //#endregion
7852
- //#region src/profiles/harness/types.ts
7859
+ // src/profiles/harness/types.ts
7853
7860
  /**
7854
7861
  * Middleware names that provide essential agent capabilities and cannot
7855
7862
  * be excluded via `excludedMiddleware`.
@@ -7880,8 +7887,7 @@ function resolveMiddleware(middleware) {
7880
7887
  if (typeof middleware === "function") return middleware();
7881
7888
  return middleware;
7882
7889
  }
7883
- //#endregion
7884
- //#region src/profiles/harness/create.ts
7890
+ // src/profiles/harness/create.ts
7885
7891
  /**
7886
7892
  * Validate the grammar of an `excludedMiddleware` entry.
7887
7893
  *
@@ -7943,8 +7949,7 @@ function createHarnessProfile(options = {}) {
7943
7949
  * profile matches. Avoids creating a new object on every miss.
7944
7950
  */
7945
7951
  const EMPTY_HARNESS_PROFILE = createHarnessProfile();
7946
- //#endregion
7947
- //#region src/profiles/harness/serialization.ts
7952
+ // src/profiles/harness/serialization.ts
7948
7953
  const POISONED_KEYS = /* @__PURE__ */ new Set([
7949
7954
  "__proto__",
7950
7955
  "constructor",
@@ -8050,8 +8055,7 @@ function serializeProfile(profile) {
8050
8055
  }
8051
8056
  return result;
8052
8057
  }
8053
- //#endregion
8054
- //#region src/profiles/harness/merge.ts
8058
+ // src/profiles/harness/merge.ts
8055
8059
  /**
8056
8060
  * Merge two middleware sequences by `.name`.
8057
8061
  *
@@ -8136,8 +8140,7 @@ function mergeProfiles(base, override) {
8136
8140
  generalPurposeSubagent: mergeGeneralPurposeSubagentConfigs(base.generalPurposeSubagent, override.generalPurposeSubagent)
8137
8141
  });
8138
8142
  }
8139
- //#endregion
8140
- //#region src/profiles/harness/builtins/anthropic-opus-4-7.ts
8143
+ // src/profiles/harness/builtins/anthropic-opus-4-7.ts
8141
8144
  const SYSTEM_PROMPT_SUFFIX$3 = `\
8142
8145
  <use_parallel_tool_calls>
8143
8146
  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.
@@ -8173,8 +8176,7 @@ Spawn multiple subagents in the same turn when fanning out across items or readi
8173
8176
  function register$3() {
8174
8177
  registerHarnessProfileImpl("anthropic:claude-opus-4-7", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$3 }));
8175
8178
  }
8176
- //#endregion
8177
- //#region src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
8179
+ // src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
8178
8180
  const SYSTEM_PROMPT_SUFFIX$2 = `\
8179
8181
  <use_parallel_tool_calls>
8180
8182
  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.
@@ -8204,8 +8206,7 @@ After receiving tool results, carefully reflect on their quality and determine o
8204
8206
  function register$2() {
8205
8207
  registerHarnessProfileImpl("anthropic:claude-sonnet-4-6", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$2 }));
8206
8208
  }
8207
- //#endregion
8208
- //#region src/profiles/harness/builtins/anthropic-haiku-4-5.ts
8209
+ // src/profiles/harness/builtins/anthropic-haiku-4-5.ts
8209
8210
  const SYSTEM_PROMPT_SUFFIX$1 = `\
8210
8211
  <use_parallel_tool_calls>
8211
8212
  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.
@@ -8229,8 +8230,7 @@ After receiving tool results, carefully reflect on their quality and determine o
8229
8230
  function register$1() {
8230
8231
  registerHarnessProfileImpl("anthropic:claude-haiku-4-5", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$1 }));
8231
8232
  }
8232
- //#endregion
8233
- //#region src/profiles/harness/builtins/openai-codex.ts
8233
+ // src/profiles/harness/builtins/openai-codex.ts
8234
8234
  /**
8235
8235
  * Model specs that receive the Codex harness profile.
8236
8236
  *
@@ -8287,8 +8287,7 @@ function register() {
8287
8287
  });
8288
8288
  for (const spec of CODEX_MODEL_SPECS) registerHarnessProfileImpl(spec, profile);
8289
8289
  }
8290
- //#endregion
8291
- //#region src/profiles/harness/builtins/index.ts
8290
+ // src/profiles/harness/builtins/index.ts
8292
8291
  /**
8293
8292
  * Register all built-in harness profiles and snapshot the resulting
8294
8293
  * registry keys as the builtin baseline.
@@ -8306,8 +8305,7 @@ function loadBuiltinProfiles() {
8306
8305
  register();
8307
8306
  snapshotBuiltinKeys();
8308
8307
  }
8309
- //#endregion
8310
- //#region src/profiles/harness/registry.ts
8308
+ // src/profiles/harness/registry.ts
8311
8309
  /**
8312
8310
  * Process-global symbol key for the harness profile registry. The `.v1`
8313
8311
  * suffix is a version gate — bump it when the {@link HarnessProfileRegistry}
@@ -8490,8 +8488,7 @@ function applyProfilePrompt(profile, basePrompt) {
8490
8488
  if (profile.systemPromptSuffix !== void 0) return prompt ? `${prompt}\n\n${profile.systemPromptSuffix}` : profile.systemPromptSuffix;
8491
8489
  return prompt;
8492
8490
  }
8493
- //#endregion
8494
- //#region src/agent.ts
8491
+ // src/agent.ts
8495
8492
  function normalizeSystemPrompt(systemPrompt) {
8496
8493
  if (systemPrompt === void 0) return {};
8497
8494
  if (typeof systemPrompt === "string" || SystemMessage.isInstance(systemPrompt)) return { prefix: systemPrompt };
@@ -8739,8 +8736,7 @@ function createDeepAgent(params = {}) {
8739
8736
  }
8740
8737
  });
8741
8738
  }
8742
- //#endregion
8743
- //#region src/compat.ts
8739
+ // src/compat.ts
8744
8740
  /**
8745
8741
  * @deprecated Legacy prompt compatibility exports.
8746
8742
  *
@@ -8873,8 +8869,7 @@ const EXECUTION_SYSTEM_PROMPT = context`
8873
8869
 
8874
8870
  - execute: run a shell command in the sandbox (returns output and exit code)
8875
8871
  `;
8876
- //#endregion
8877
- //#region src/backends/store.ts
8872
+ // src/backends/store.ts
8878
8873
  /**
8879
8874
  * StoreBackend: Adapter for LangGraph's BaseStore (persistent, cross-thread).
8880
8875
  */
@@ -9373,8 +9368,7 @@ var StoreBackend = class {
9373
9368
  return responses;
9374
9369
  }
9375
9370
  };
9376
- //#endregion
9377
- //#region src/backends/context-hub.ts
9371
+ // src/backends/context-hub.ts
9378
9372
  /**
9379
9373
  * ContextHubBackend: Store files in a LangSmith Hub agent repo (persistent).
9380
9374
  */
@@ -10144,8 +10138,7 @@ var ContextHubBackend = class ContextHubBackend {
10144
10138
  });
10145
10139
  }
10146
10140
  };
10147
- //#endregion
10148
- //#region src/backends/sandbox.ts
10141
+ // src/backends/sandbox.ts
10149
10142
  /**
10150
10143
  * Shell-quote a string using single quotes (POSIX).
10151
10144
  * Escapes embedded single quotes with the '\'' technique.
@@ -10167,17 +10160,18 @@ function globToPathRegex(pattern) {
10167
10160
  let i = 0;
10168
10161
  while (i < pattern.length) {
10169
10162
  const c = pattern[i];
10170
- if (c === "*") if (i + 1 < pattern.length && pattern[i + 1] === "*") {
10171
- i += 2;
10172
- if (i < pattern.length && pattern[i] === "/") {
10173
- regex += "(.*/)?";
10163
+ if (c === "*") {
10164
+ if (i + 1 < pattern.length && pattern[i + 1] === "*") {
10165
+ i += 2;
10166
+ if (i < pattern.length && pattern[i] === "/") {
10167
+ regex += "(.*/)?";
10168
+ i++;
10169
+ } else regex += ".*";
10170
+ } else {
10171
+ regex += "[^/]*";
10174
10172
  i++;
10175
- } else regex += ".*";
10176
- } else {
10177
- regex += "[^/]*";
10178
- i++;
10179
- }
10180
- else if (c === "?") {
10173
+ }
10174
+ } else if (c === "?") {
10181
10175
  regex += "[^/]";
10182
10176
  i++;
10183
10177
  } else if (c === "[") {
@@ -10639,8 +10633,7 @@ var BaseSandbox = class {
10639
10633
  };
10640
10634
  }
10641
10635
  };
10642
- //#endregion
10643
- //#region src/backends/langsmith.ts
10636
+ // src/backends/langsmith.ts
10644
10637
  /**
10645
10638
  * LangSmith Sandbox backend for deepagents.
10646
10639
  *
@@ -10839,7 +10832,6 @@ var LangSmithSandbox = class LangSmithSandbox extends BaseSandbox {
10839
10832
  });
10840
10833
  }
10841
10834
  };
10842
- //#endregion
10843
10835
  export { adaptSandboxProtocol as $, filesValue as A, createFilesystemMiddleware as B, MAX_SKILL_FILE_SIZE as C, skillsMetadataValue as D, pinnedSkillsValue as E, SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY as F, scrubUnsupportedMultimodalContent as G, MULTIMODAL_BLOCK_TYPES as H, createSubAgent as I, applyGrepMaxCount as J, StateBackend as K, createSubAgentMiddleware as L, DEFAULT_GENERAL_PURPOSE_DESCRIPTION as M, DEFAULT_SUBAGENT_PROMPT as N, ConfigurationError as O, GENERAL_PURPOSE_SUBAGENT as P, adaptBackendProtocol as Q, computeSummarizationDefaults as R, MAX_SKILL_DESCRIPTION_LENGTH as S, createSkillsMiddleware as T, createUnsupportedContentMiddleware as U, CompositeBackend as V, multimodalBlockSupported as W, isSandboxProtocol as X, isSandboxBackend as Y, resolveBackend as Z, createHarnessProfile as _, ASYNC_TASK_SYSTEM_PROMPT as a, setRealpath as at, isAsyncSubAgent as b, TASK_SYSTEM_PROMPT as c, registerHarnessProfile as d, checkEmptyContent as et, generalPurposeSubagentConfigSchema as f, EMPTY_HARNESS_PROFILE as g, serializeProfile as h, StoreBackend as i, performStringReplacement as it, createPatchToolCallsMiddleware as j, createMemoryMiddleware as k, createDeepAgent as l, parseHarnessProfileConfig as m, BaseSandbox as n, isTextMimeType as nt, BASE_AGENT_PROMPT as o, harnessProfileConfigSchema as p, SandboxError as q, ContextHubBackend as r, normalizeReadPagination as rt, EXECUTION_SYSTEM_PROMPT as s, LangSmithSandbox as t, getMimeType as tt, getHarnessProfile as u, REQUIRED_MIDDLEWARE_NAMES as v, MAX_SKILL_NAME_LENGTH as w, createCompletionCallbackMiddleware as x, createAsyncSubAgentMiddleware as y, createSummarizationMiddleware as z };
10844
10836
 
10845
- //# sourceMappingURL=langsmith-BsXCKa99.js.map
10837
+ //# sourceMappingURL=langsmith-BCgECepG.js.map