deepagents 1.16.1 → 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,10 +1,11 @@
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";
5
6
  import micromatch from "micromatch";
6
7
  import { createHash } from "node:crypto";
7
- import { AIMessage as AIMessage$1, BaseMessage, HumanMessage as HumanMessage$1, RemoveMessage, SystemMessage as SystemMessage$1, ToolMessage as ToolMessage$1, coerceMessageLikeToMessage, getBufferString } from "@langchain/core/messages";
8
+ import { AIMessage as AIMessage$1, BaseMessage, HumanMessage as HumanMessage$1, RemoveMessage, SystemMessage as SystemMessage$1, ToolMessage as ToolMessage$1, addNotificationMetadata, coerceMessageLikeToMessage, getBufferString, getNotificationMetadata } from "@langchain/core/messages";
8
9
  import * as z$2 from "zod";
9
10
  import { z as z$1 } from "zod";
10
11
  import { initChatModel } from "langchain/chat_models/universal";
@@ -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
  */
@@ -2578,11 +2592,11 @@ async function checkPermission(backend, rules, operation, path) {
2578
2592
  return { path: canonical };
2579
2593
  }
2580
2594
  /**
2581
- * Build an error {@link ToolMessage} for a rejected or denied path. Returning a
2582
- * bare string would be wrapped as a `status: "success"` message whose content
2583
- * merely starts with "Error:"; marking `status: "error"` reports the failure
2584
- * accurately so callers and the model can distinguish a real failure from a
2585
- * successful result.
2595
+ * Build an error {@link ToolMessage} for a denied path or a failed backend
2596
+ * operation. Returning a bare string would be wrapped as a `status: "success"`
2597
+ * message whose content merely starts with "Error:"; marking `status: "error"`
2598
+ * reports the failure accurately so callers and the model can distinguish a
2599
+ * real failure from a successful result.
2586
2600
  */
2587
2601
  function toolError(runtime, toolName, message) {
2588
2602
  return new ToolMessage({
@@ -3004,7 +3018,7 @@ function createWriteFileTool(backend, options) {
3004
3018
  if (permission.error !== void 0) return toolError(runtime, "write_file", permission.error);
3005
3019
  const { file_path, content } = input;
3006
3020
  const result = await resolvedBackend.write(permission.path, content);
3007
- if (result.error) return result.error;
3021
+ if (result.error) return toolError(runtime, "write_file", result.error);
3008
3022
  const message = new ToolMessage({
3009
3023
  content: `Successfully wrote to '${file_path}'`,
3010
3024
  tool_call_id: runtime.toolCall?.id,
@@ -3036,7 +3050,7 @@ function createEditFileTool(backend, options) {
3036
3050
  if (permission.error !== void 0) return toolError(runtime, "edit_file", permission.error);
3037
3051
  const { file_path, old_string, new_string, replace_all = false } = input;
3038
3052
  const result = await resolvedBackend.edit(permission.path, old_string, new_string, replace_all);
3039
- if (result.error) return result.error;
3053
+ if (result.error) return toolError(runtime, "edit_file", result.error);
3040
3054
  const message = new ToolMessage({
3041
3055
  content: `Successfully replaced ${result.occurrences} occurrence(s) in '${file_path}'`,
3042
3056
  tool_call_id: runtime.toolCall?.id,
@@ -3117,7 +3131,7 @@ function createGlobTool(backend, options) {
3117
3131
  const permission = await checkPermission(resolvedBackend, permissions, "read", input.path ?? "/");
3118
3132
  if (permission.error !== void 0) return toolError(runtime, "glob", permission.error);
3119
3133
  const globResult = await resolvedBackend.glob(pattern, input.path === void 0 ? void 0 : permission.path);
3120
- if (globResult.error) return `Error finding files: ${globResult.error}`;
3134
+ if (globResult.error) return toolError(runtime, "glob", `Error finding files: ${globResult.error}`);
3121
3135
  const infos = await filterByPermissions(resolvedBackend, globResult.files ?? [], permissions, "read", (info) => info.path);
3122
3136
  if (infos.length === 0) return `No files found matching pattern '${pattern}'`;
3123
3137
  const result = truncateIfTooLong(infos.map((info) => info.path));
@@ -3144,10 +3158,13 @@ function createGrepTool(backend, options) {
3144
3158
  if (permission.error !== void 0) return toolError(runtime, "grep", permission.error);
3145
3159
  const maxCount = input.max_count ?? grepMaxCount;
3146
3160
  const result = await resolvedBackend.grep(pattern, permission.path, glob, maxCount);
3147
- if (result.error) return result.error;
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
  }
@@ -7027,8 +7035,15 @@ function launchingAgent(config) {
7027
7035
  if (metadata.parent_assistant_id) fallback.assistant_id = String(metadata.parent_assistant_id);
7028
7036
  return fallback;
7029
7037
  }
7030
- /** Message field (`additional_kwargs` key) marking a task notification and carrying its {@link TaskEvent}. */
7038
+ /** `lc_source` of a task notification; its `lc_data` is the {@link TaskEvent}. */
7039
+ const NOTIFICATION_SOURCE = "async_subagent";
7040
+ /**
7041
+ * `additional_kwargs` key carrying a notification's {@link TaskEvent}; still written, and read when a message has no `async_subagent` event.
7042
+ *
7043
+ * @deprecated Read `getNotificationMetadata(message)?.data` where `source` is `"async_subagent"`.
7044
+ */
7031
7045
  const NOTIFICATION_KEY = "deepagents_notification";
7046
+ const NOTIFICATION_NOTE = "An async subagent task you started has an update. This is not a message from the user: don't treat it as their answer to any question.";
7032
7047
  /** Results longer than this are cut in notifications, matching the limit for large tool results. */
7033
7048
  const MAX_RESULT_CHARS = 8e4;
7034
7049
  const NEXT_STEP = {
@@ -7070,23 +7085,24 @@ function resultBlocks(blocks) {
7070
7085
  else if (MEDIA_BLOCK_TYPES.has(block.type)) kept.push({ ...block });
7071
7086
  return kept;
7072
7087
  }
7073
- /**
7074
- * Frame a task update as a system notification the model won't mistake for the user.
7075
- *
7076
- * The result keeps its own content blocks, so an image reaches the model as an image.
7077
- */
7078
- function notificationContent(update) {
7079
- const blocks = [notificationHeader(update)];
7088
+ function notificationBody(update) {
7089
+ const blocks = [taskHeader(update)];
7080
7090
  if (update.result) blocks.push(textBlock("<result>\n"), ...resultBlocks(update.result), textBlock("\n</result>\n"));
7081
7091
  const details = Object.fromEntries(["error", "interrupts"].filter((key) => update[key] !== void 0).map((key) => [key, update[key]]));
7082
7092
  if (Object.keys(details).length > 0) blocks.push(textBlock(`<details>${escape(clip(JSON.stringify(details)))}</details>\n`));
7083
7093
  blocks.push(textBlock(`</task-notification>\n${NEXT_STEP[update.status]}`));
7084
7094
  return blocks;
7085
7095
  }
7086
- function notificationHeader(event) {
7087
- return textBlock(`[SYSTEM NOTIFICATION - NOT USER INPUT]
7088
- An async subagent task you started has an update. This is not a message from the user: don't treat it as their answer to any question.
7089
- <task-notification>\n<task-id>${escape(event.task_id)}</task-id>\n<agent-name>${escape(event.agent_name)}</agent-name>\n<status>${escape(event.status)}</status>\n`);
7096
+ /** `blocks` under the note and task header, labeled with `event`. */
7097
+ function labeled(blocks, event) {
7098
+ const header = textBlock(`${NOTIFICATION_NOTE}\n`);
7099
+ return addNotificationMetadata(new HumanMessage$1({ content: [header, ...blocks] }), {
7100
+ source: NOTIFICATION_SOURCE,
7101
+ data: { ...event }
7102
+ });
7103
+ }
7104
+ function taskHeader(event) {
7105
+ return textBlock(`<task-notification>\n<task-id>${escape(event.task_id)}</task-id>\n<agent-name>${escape(event.agent_name)}</agent-name>\n<status>${escape(event.status)}</status>\n`);
7090
7106
  }
7091
7107
  /**
7092
7108
  * Reframe an earlier run's notification so the model doesn't think the queued follow-up finished.
@@ -7096,7 +7112,7 @@ An async subagent task you started has an update. This is not a message from the
7096
7112
  function supersededNotificationContent(message, event) {
7097
7113
  const content = message.content;
7098
7114
  const closing = Array.isArray(content) ? content.at(-1) : void 0;
7099
- return [...closing?.type === "text" && String(closing.text).startsWith("</task-notification>") ? content.slice(0, -1) : [notificationHeader(event)], textBlock("</task-notification>\nThis update is from an earlier run of this task, before your latest follow-up. It is not the result of the follow-up. Use `check_async_task` to get the current status of the task.")];
7115
+ return [...closing?.type === "text" && String(closing.text).startsWith("</task-notification>") ? content.slice(0, -1) : labeled([taskHeader(event)], event).content, textBlock("</task-notification>\nThis update is from an earlier run of this task, before your latest follow-up. It is not the result of the follow-up. Use `check_async_task` to get the current status of the task.")];
7100
7116
  }
7101
7117
  /** Describe a failure without its message, which can carry internals into the parent's conversation. */
7102
7118
  function failureText(error) {
@@ -7149,21 +7165,32 @@ function finalContent(values) {
7149
7165
  }
7150
7166
  /** The task event a notification message carries, or `null` for any other message. */
7151
7167
  function notificationEvent(message) {
7152
- const event = message?.additional_kwargs?.[NOTIFICATION_KEY];
7168
+ if (message === void 0) return null;
7169
+ const metadata = getNotificationMetadata(message);
7170
+ const event = (metadata?.source === NOTIFICATION_SOURCE ? metadata.data : void 0) ?? message.additional_kwargs?.["deepagents_notification"];
7153
7171
  return event && typeof event === "object" && !Array.isArray(event) ? event : null;
7154
7172
  }
7155
- /** A task update as the message the parent's model sees, marked with its {@link TaskEvent} so apps can recognize it. */
7156
- function notificationMessage(update) {
7173
+ /** The {@link TaskEvent} fields of a task update. */
7174
+ function eventOf(update) {
7157
7175
  const event = {
7158
7176
  task_id: update.task_id,
7159
7177
  agent_name: update.agent_name,
7160
7178
  status: update.status
7161
7179
  };
7162
7180
  if (update.run_id) event.run_id = update.run_id;
7181
+ return event;
7182
+ }
7183
+ /** A task update as the message the parent's model sees, labeled with its {@link TaskEvent}. */
7184
+ function notificationMessage(update) {
7185
+ const event = eventOf(update);
7186
+ const message = labeled(notificationBody(update), event);
7163
7187
  return {
7164
7188
  role: "user",
7165
- content: notificationContent(update),
7166
- additional_kwargs: { [NOTIFICATION_KEY]: event }
7189
+ content: message.content,
7190
+ additional_kwargs: {
7191
+ ...message.additional_kwargs,
7192
+ [NOTIFICATION_KEY]: event
7193
+ }
7167
7194
  };
7168
7195
  }
7169
7196
  /** Parent thread statuses a notification run can start on: neither running nor waiting for a human. */
@@ -7622,6 +7649,7 @@ function createAsyncSubAgentMiddleware(options) {
7622
7649
  const fullSystemPrompt = systemPrompt ? `${systemPrompt}\n\nAvailable async subagent types:\n${agentsDescription}` : null;
7623
7650
  return createMiddleware({
7624
7651
  name: "asyncSubAgentMiddleware",
7652
+ tracePolicy: { processInputs: omitPayload },
7625
7653
  stateSchema: AsyncTaskStateSchema,
7626
7654
  tools,
7627
7655
  beforeAgent: async (state) => {
@@ -7668,8 +7696,7 @@ function createAsyncSubAgentMiddleware(options) {
7668
7696
  }
7669
7697
  });
7670
7698
  }
7671
- //#endregion
7672
- //#region src/middleware/cache.ts
7699
+ // src/middleware/cache.ts
7673
7700
  /**
7674
7701
  * Creates a middleware that places a cache breakpoint at the end of the static
7675
7702
  * system prompt content.
@@ -7699,6 +7726,7 @@ function createAsyncSubAgentMiddleware(options) {
7699
7726
  function createCacheBreakpointMiddleware() {
7700
7727
  return createMiddleware({
7701
7728
  name: "CacheBreakpointMiddleware",
7729
+ tracePolicy: { processInputs: omitPayload },
7702
7730
  wrapModelCall(request, handler) {
7703
7731
  if (!isAnthropicModel(request.model)) return handler(request);
7704
7732
  const existingContent = request.systemMessage.content;
@@ -7718,8 +7746,7 @@ function createCacheBreakpointMiddleware() {
7718
7746
  }
7719
7747
  });
7720
7748
  }
7721
- //#endregion
7722
- //#region src/middleware/parent_notifier.ts
7749
+ // src/middleware/parent_notifier.ts
7723
7750
  /** Whether this is the outermost graph of a task run, not a graph nested in it. */
7724
7751
  function isTopLevelGraph(config) {
7725
7752
  const configurable = config.configurable ?? {};
@@ -7752,6 +7779,7 @@ function createParentNotifierMiddleware() {
7752
7779
  }
7753
7780
  return createMiddleware({
7754
7781
  name: "parentNotifierMiddleware",
7782
+ tracePolicy: { processInputs: omitPayload },
7755
7783
  afterAgent: async (state) => {
7756
7784
  await report("success", { result: finalContent(state) });
7757
7785
  },
@@ -7765,8 +7793,7 @@ function createParentNotifierMiddleware() {
7765
7793
  }
7766
7794
  });
7767
7795
  }
7768
- //#endregion
7769
- //#region src/middleware/tool_exclusion.ts
7796
+ // src/middleware/tool_exclusion.ts
7770
7797
  function hasToolName(tool) {
7771
7798
  return tool !== null && typeof tool === "object" && "name" in tool && typeof tool.name === "string";
7772
7799
  }
@@ -7780,6 +7807,7 @@ function hasToolName(tool) {
7780
7807
  function createToolExclusionMiddleware(excludedTools) {
7781
7808
  return createMiddleware({
7782
7809
  name: "_ToolExclusionMiddleware",
7810
+ tracePolicy: { processInputs: omitPayload },
7783
7811
  wrapModelCall(request, handler) {
7784
7812
  return handler({
7785
7813
  ...request,
@@ -7798,8 +7826,7 @@ function createToolExclusionMiddleware(excludedTools) {
7798
7826
  }
7799
7827
  });
7800
7828
  }
7801
- //#endregion
7802
- //#region src/profiles/keys.ts
7829
+ // src/profiles/keys.ts
7803
7830
  /**
7804
7831
  * Normalize and validate a profile registry key.
7805
7832
  *
@@ -7829,8 +7856,7 @@ function validateProfileKey(key) {
7829
7856
  }
7830
7857
  return trimmed;
7831
7858
  }
7832
- //#endregion
7833
- //#region src/profiles/harness/types.ts
7859
+ // src/profiles/harness/types.ts
7834
7860
  /**
7835
7861
  * Middleware names that provide essential agent capabilities and cannot
7836
7862
  * be excluded via `excludedMiddleware`.
@@ -7861,8 +7887,7 @@ function resolveMiddleware(middleware) {
7861
7887
  if (typeof middleware === "function") return middleware();
7862
7888
  return middleware;
7863
7889
  }
7864
- //#endregion
7865
- //#region src/profiles/harness/create.ts
7890
+ // src/profiles/harness/create.ts
7866
7891
  /**
7867
7892
  * Validate the grammar of an `excludedMiddleware` entry.
7868
7893
  *
@@ -7924,8 +7949,7 @@ function createHarnessProfile(options = {}) {
7924
7949
  * profile matches. Avoids creating a new object on every miss.
7925
7950
  */
7926
7951
  const EMPTY_HARNESS_PROFILE = createHarnessProfile();
7927
- //#endregion
7928
- //#region src/profiles/harness/serialization.ts
7952
+ // src/profiles/harness/serialization.ts
7929
7953
  const POISONED_KEYS = /* @__PURE__ */ new Set([
7930
7954
  "__proto__",
7931
7955
  "constructor",
@@ -8031,8 +8055,7 @@ function serializeProfile(profile) {
8031
8055
  }
8032
8056
  return result;
8033
8057
  }
8034
- //#endregion
8035
- //#region src/profiles/harness/merge.ts
8058
+ // src/profiles/harness/merge.ts
8036
8059
  /**
8037
8060
  * Merge two middleware sequences by `.name`.
8038
8061
  *
@@ -8117,8 +8140,7 @@ function mergeProfiles(base, override) {
8117
8140
  generalPurposeSubagent: mergeGeneralPurposeSubagentConfigs(base.generalPurposeSubagent, override.generalPurposeSubagent)
8118
8141
  });
8119
8142
  }
8120
- //#endregion
8121
- //#region src/profiles/harness/builtins/anthropic-opus-4-7.ts
8143
+ // src/profiles/harness/builtins/anthropic-opus-4-7.ts
8122
8144
  const SYSTEM_PROMPT_SUFFIX$3 = `\
8123
8145
  <use_parallel_tool_calls>
8124
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.
@@ -8154,8 +8176,7 @@ Spawn multiple subagents in the same turn when fanning out across items or readi
8154
8176
  function register$3() {
8155
8177
  registerHarnessProfileImpl("anthropic:claude-opus-4-7", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$3 }));
8156
8178
  }
8157
- //#endregion
8158
- //#region src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
8179
+ // src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
8159
8180
  const SYSTEM_PROMPT_SUFFIX$2 = `\
8160
8181
  <use_parallel_tool_calls>
8161
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.
@@ -8185,8 +8206,7 @@ After receiving tool results, carefully reflect on their quality and determine o
8185
8206
  function register$2() {
8186
8207
  registerHarnessProfileImpl("anthropic:claude-sonnet-4-6", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$2 }));
8187
8208
  }
8188
- //#endregion
8189
- //#region src/profiles/harness/builtins/anthropic-haiku-4-5.ts
8209
+ // src/profiles/harness/builtins/anthropic-haiku-4-5.ts
8190
8210
  const SYSTEM_PROMPT_SUFFIX$1 = `\
8191
8211
  <use_parallel_tool_calls>
8192
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.
@@ -8210,8 +8230,7 @@ After receiving tool results, carefully reflect on their quality and determine o
8210
8230
  function register$1() {
8211
8231
  registerHarnessProfileImpl("anthropic:claude-haiku-4-5", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$1 }));
8212
8232
  }
8213
- //#endregion
8214
- //#region src/profiles/harness/builtins/openai-codex.ts
8233
+ // src/profiles/harness/builtins/openai-codex.ts
8215
8234
  /**
8216
8235
  * Model specs that receive the Codex harness profile.
8217
8236
  *
@@ -8268,8 +8287,7 @@ function register() {
8268
8287
  });
8269
8288
  for (const spec of CODEX_MODEL_SPECS) registerHarnessProfileImpl(spec, profile);
8270
8289
  }
8271
- //#endregion
8272
- //#region src/profiles/harness/builtins/index.ts
8290
+ // src/profiles/harness/builtins/index.ts
8273
8291
  /**
8274
8292
  * Register all built-in harness profiles and snapshot the resulting
8275
8293
  * registry keys as the builtin baseline.
@@ -8287,8 +8305,7 @@ function loadBuiltinProfiles() {
8287
8305
  register();
8288
8306
  snapshotBuiltinKeys();
8289
8307
  }
8290
- //#endregion
8291
- //#region src/profiles/harness/registry.ts
8308
+ // src/profiles/harness/registry.ts
8292
8309
  /**
8293
8310
  * Process-global symbol key for the harness profile registry. The `.v1`
8294
8311
  * suffix is a version gate — bump it when the {@link HarnessProfileRegistry}
@@ -8471,8 +8488,7 @@ function applyProfilePrompt(profile, basePrompt) {
8471
8488
  if (profile.systemPromptSuffix !== void 0) return prompt ? `${prompt}\n\n${profile.systemPromptSuffix}` : profile.systemPromptSuffix;
8472
8489
  return prompt;
8473
8490
  }
8474
- //#endregion
8475
- //#region src/agent.ts
8491
+ // src/agent.ts
8476
8492
  function normalizeSystemPrompt(systemPrompt) {
8477
8493
  if (systemPrompt === void 0) return {};
8478
8494
  if (typeof systemPrompt === "string" || SystemMessage.isInstance(systemPrompt)) return { prefix: systemPrompt };
@@ -8720,8 +8736,7 @@ function createDeepAgent(params = {}) {
8720
8736
  }
8721
8737
  });
8722
8738
  }
8723
- //#endregion
8724
- //#region src/compat.ts
8739
+ // src/compat.ts
8725
8740
  /**
8726
8741
  * @deprecated Legacy prompt compatibility exports.
8727
8742
  *
@@ -8854,8 +8869,7 @@ const EXECUTION_SYSTEM_PROMPT = context`
8854
8869
 
8855
8870
  - execute: run a shell command in the sandbox (returns output and exit code)
8856
8871
  `;
8857
- //#endregion
8858
- //#region src/backends/store.ts
8872
+ // src/backends/store.ts
8859
8873
  /**
8860
8874
  * StoreBackend: Adapter for LangGraph's BaseStore (persistent, cross-thread).
8861
8875
  */
@@ -9354,8 +9368,7 @@ var StoreBackend = class {
9354
9368
  return responses;
9355
9369
  }
9356
9370
  };
9357
- //#endregion
9358
- //#region src/backends/context-hub.ts
9371
+ // src/backends/context-hub.ts
9359
9372
  /**
9360
9373
  * ContextHubBackend: Store files in a LangSmith Hub agent repo (persistent).
9361
9374
  */
@@ -10125,8 +10138,7 @@ var ContextHubBackend = class ContextHubBackend {
10125
10138
  });
10126
10139
  }
10127
10140
  };
10128
- //#endregion
10129
- //#region src/backends/sandbox.ts
10141
+ // src/backends/sandbox.ts
10130
10142
  /**
10131
10143
  * Shell-quote a string using single quotes (POSIX).
10132
10144
  * Escapes embedded single quotes with the '\'' technique.
@@ -10148,17 +10160,18 @@ function globToPathRegex(pattern) {
10148
10160
  let i = 0;
10149
10161
  while (i < pattern.length) {
10150
10162
  const c = pattern[i];
10151
- if (c === "*") if (i + 1 < pattern.length && pattern[i + 1] === "*") {
10152
- i += 2;
10153
- if (i < pattern.length && pattern[i] === "/") {
10154
- 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 += "[^/]*";
10155
10172
  i++;
10156
- } else regex += ".*";
10157
- } else {
10158
- regex += "[^/]*";
10159
- i++;
10160
- }
10161
- else if (c === "?") {
10173
+ }
10174
+ } else if (c === "?") {
10162
10175
  regex += "[^/]";
10163
10176
  i++;
10164
10177
  } else if (c === "[") {
@@ -10620,8 +10633,7 @@ var BaseSandbox = class {
10620
10633
  };
10621
10634
  }
10622
10635
  };
10623
- //#endregion
10624
- //#region src/backends/langsmith.ts
10636
+ // src/backends/langsmith.ts
10625
10637
  /**
10626
10638
  * LangSmith Sandbox backend for deepagents.
10627
10639
  *
@@ -10820,7 +10832,6 @@ var LangSmithSandbox = class LangSmithSandbox extends BaseSandbox {
10820
10832
  });
10821
10833
  }
10822
10834
  };
10823
- //#endregion
10824
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 };
10825
10836
 
10826
- //# sourceMappingURL=langsmith-B1pbrx3y.js.map
10837
+ //# sourceMappingURL=langsmith-BCgECepG.js.map