deepagents 1.16.2 → 1.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-NWukGdxN.d.ts → agent-BAuGxPZn.d.ts} +11 -81
- package/dist/{agent-Dkx5TFNW.d.cts → agent-DOFzksfM.d.cts} +11 -81
- package/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{langsmith-9ilIzQAp.cjs → langsmith-D_tzVwxp.cjs} +215 -155
- package/dist/langsmith-D_tzVwxp.cjs.map +1 -0
- package/dist/{langsmith-BsXCKa99.js → langsmith-DfobOVRO.js} +216 -155
- package/dist/langsmith-DfobOVRO.js.map +1 -0
- package/dist/node.cjs +2 -2
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/{src-nyyR-RIy.cjs → src-DTOh2Xrc.cjs} +8 -10
- package/dist/src-DTOh2Xrc.cjs.map +1 -0
- package/dist/{src-DkSAwRPY.js → src-KaJuKnnd.js} +8 -10
- package/dist/src-KaJuKnnd.js.map +1 -0
- package/package.json +12 -12
- package/dist/langsmith-9ilIzQAp.cjs.map +0 -1
- package/dist/langsmith-BsXCKa99.js.map +0 -1
- package/dist/src-DkSAwRPY.js.map +0 -1
- package/dist/src-nyyR-RIy.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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,55 @@ function createFilesystemMiddleware(options = {}) {
|
|
|
3546
3563
|
}
|
|
3547
3564
|
});
|
|
3548
3565
|
}
|
|
3549
|
-
|
|
3550
|
-
|
|
3566
|
+
// src/middleware/refusal.ts
|
|
3567
|
+
/**
|
|
3568
|
+
* The task result reported when a model in the subagent refused.
|
|
3569
|
+
*
|
|
3570
|
+
* @param refusal - The refusal block from the model's reply.
|
|
3571
|
+
*/
|
|
3572
|
+
function refusalNotice(refusal) {
|
|
3573
|
+
let notice = "The subagent stopped because a model refused the request.";
|
|
3574
|
+
const category = refusal.extras?.category;
|
|
3575
|
+
if (category) notice += ` Category: ${String(category)}.`;
|
|
3576
|
+
if (refusal.refusal) notice += ` Explanation: "${refusal.refusal}"`;
|
|
3577
|
+
return `${notice} Retrying the same request is unlikely to succeed; rephrase it or continue without it.`;
|
|
3578
|
+
}
|
|
3579
|
+
/**
|
|
3580
|
+
* The refusal block in `message`, if it is a message that refused.
|
|
3581
|
+
*
|
|
3582
|
+
* @param message - The message to check. Callers often take it from an
|
|
3583
|
+
* unchecked cast, so non-messages are treated as no refusal.
|
|
3584
|
+
*/
|
|
3585
|
+
function refusalIn(message) {
|
|
3586
|
+
if (!_langchain_core_messages.BaseMessage.isInstance(message)) return void 0;
|
|
3587
|
+
try {
|
|
3588
|
+
return message.contentBlocks.find((block) => block.type === "refusal");
|
|
3589
|
+
} catch {
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
/**
|
|
3594
|
+
* The task result for an error caused by a refusal, or `undefined` to rethrow it.
|
|
3595
|
+
*
|
|
3596
|
+
* Middleware wraps errors in `MiddlewareError`, so this walks the `cause` chain.
|
|
3597
|
+
*
|
|
3598
|
+
* @param error - The error the subagent run threw.
|
|
3599
|
+
*/
|
|
3600
|
+
function refusalNoticeFor(error) {
|
|
3601
|
+
let current = error;
|
|
3602
|
+
while (current) {
|
|
3603
|
+
if (_langchain_core_errors.ModelRefusalError.isInstance(current)) return refusalNotice(refusalIn(current.rawMessage) ?? {
|
|
3604
|
+
type: "refusal",
|
|
3605
|
+
refusal: current.message
|
|
3606
|
+
});
|
|
3607
|
+
if (typeof current === "object" && "aiMessage" in current) {
|
|
3608
|
+
const refusal = refusalIn(current.aiMessage);
|
|
3609
|
+
if (refusal) return refusalNotice(refusal);
|
|
3610
|
+
}
|
|
3611
|
+
current = typeof current === "object" && "cause" in current ? current.cause : void 0;
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
// src/middleware/summarization.ts
|
|
3551
3615
|
/**
|
|
3552
3616
|
* Summarization middleware with backend support for conversation history offloading.
|
|
3553
3617
|
*
|
|
@@ -4105,10 +4169,7 @@ function createSummarizationMiddleware(options) {
|
|
|
4105
4169
|
</summary>
|
|
4106
4170
|
`;
|
|
4107
4171
|
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
|
-
});
|
|
4172
|
+
return (0, _langchain_core_messages.addNotificationMetadata)(new langchain.HumanMessage({ content }), { source: "summarization" });
|
|
4112
4173
|
}
|
|
4113
4174
|
/**
|
|
4114
4175
|
* Summarize a set of messages using the given model and build the
|
|
@@ -4196,6 +4257,7 @@ function createSummarizationMiddleware(options) {
|
|
|
4196
4257
|
}
|
|
4197
4258
|
return (0, langchain.createMiddleware)({
|
|
4198
4259
|
name: "SummarizationMiddleware",
|
|
4260
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
4199
4261
|
stateSchema: SummarizationStateSchema,
|
|
4200
4262
|
async wrapModelCall(request, handler) {
|
|
4201
4263
|
const effectiveMessages = getEffectiveMessages(request.messages ?? [], request.state);
|
|
@@ -4240,8 +4302,7 @@ function createSummarizationMiddleware(options) {
|
|
|
4240
4302
|
}
|
|
4241
4303
|
});
|
|
4242
4304
|
}
|
|
4243
|
-
|
|
4244
|
-
//#region src/middleware/utils.ts
|
|
4305
|
+
// src/middleware/utils.ts
|
|
4245
4306
|
/**
|
|
4246
4307
|
* Utility functions for middleware.
|
|
4247
4308
|
*
|
|
@@ -4317,8 +4378,7 @@ function appendToSystemMessage(systemMessage, text) {
|
|
|
4317
4378
|
}
|
|
4318
4379
|
return new _langchain_core_messages.SystemMessage({ content: text });
|
|
4319
4380
|
}
|
|
4320
|
-
|
|
4321
|
-
//#region src/middleware/subagents.ts
|
|
4381
|
+
// src/middleware/subagents.ts
|
|
4322
4382
|
/**
|
|
4323
4383
|
* Config key used by task-tool callers to request dynamic response format.
|
|
4324
4384
|
*
|
|
@@ -4506,7 +4566,9 @@ const INVALID_TOOL_MESSAGE_BLOCK_TYPES = [
|
|
|
4506
4566
|
function returnCommandWithStateUpdate(result, toolCallId) {
|
|
4507
4567
|
const stateUpdate = filterStateForSubagent(result);
|
|
4508
4568
|
let content;
|
|
4569
|
+
const refusal = refusalIn(result.messages?.at(-1));
|
|
4509
4570
|
if (result.structuredResponse != null) content = JSON.stringify(result.structuredResponse);
|
|
4571
|
+
else if (refusal) content = refusalNotice(refusal);
|
|
4510
4572
|
else {
|
|
4511
4573
|
const messages = result.messages ?? [];
|
|
4512
4574
|
content = "Task completed";
|
|
@@ -4538,6 +4600,7 @@ const ForkedContextStateSchema = zod_v4.z.object({ [FORKED_CONTEXT_KEY]: zod_v4.
|
|
|
4538
4600
|
function createForkTaskToolMiddleware(taskTool) {
|
|
4539
4601
|
return (0, langchain.createMiddleware)({
|
|
4540
4602
|
name: "forkTaskToolMiddleware",
|
|
4603
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
4541
4604
|
stateSchema: ForkedContextStateSchema,
|
|
4542
4605
|
tools: [taskTool],
|
|
4543
4606
|
beforeAgent: () => ({ [FORKED_CONTEXT_KEY]: true })
|
|
@@ -4706,18 +4769,29 @@ function createTaskTool(options) {
|
|
|
4706
4769
|
...config,
|
|
4707
4770
|
metadata: {
|
|
4708
4771
|
...config.metadata,
|
|
4709
|
-
lc_agent_name: subagent_type
|
|
4772
|
+
lc_agent_name: subagent_type,
|
|
4773
|
+
...config.toolCall?.id && { lc_subagent_tool_call_id: config.toolCall.id }
|
|
4710
4774
|
},
|
|
4711
4775
|
configurable: {
|
|
4712
4776
|
...config.configurable,
|
|
4713
4777
|
ls_agent_type: "subagent"
|
|
4714
4778
|
}
|
|
4715
4779
|
};
|
|
4716
|
-
|
|
4780
|
+
let result;
|
|
4781
|
+
try {
|
|
4782
|
+
result = await subagent.invoke(subagentState, subagentConfig);
|
|
4783
|
+
} catch (error) {
|
|
4784
|
+
const notice = refusalNoticeFor(error);
|
|
4785
|
+
if (notice === void 0) throw error;
|
|
4786
|
+
return notice;
|
|
4787
|
+
}
|
|
4717
4788
|
if (!config.toolCall?.id) {
|
|
4718
4789
|
if (result.structuredResponse != null) return JSON.stringify(result.structuredResponse);
|
|
4719
4790
|
const messages = result.messages;
|
|
4720
|
-
|
|
4791
|
+
const lastMessage = messages?.[messages.length - 1];
|
|
4792
|
+
const refusal = refusalIn(lastMessage);
|
|
4793
|
+
if (refusal) return refusalNotice(refusal);
|
|
4794
|
+
let content = lastMessage?.content || "Task completed";
|
|
4721
4795
|
if (Array.isArray(content)) {
|
|
4722
4796
|
content = content.filter((block) => !INVALID_TOOL_MESSAGE_BLOCK_TYPES.includes(block.type));
|
|
4723
4797
|
if (content.length === 0) return "Task completed";
|
|
@@ -4774,6 +4848,7 @@ function createSubAgentMiddleware(options) {
|
|
|
4774
4848
|
});
|
|
4775
4849
|
return (0, langchain.createMiddleware)({
|
|
4776
4850
|
name: "subAgentMiddleware",
|
|
4851
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
4777
4852
|
tools: [taskTool],
|
|
4778
4853
|
wrapModelCall: async (request, handler) => {
|
|
4779
4854
|
if (systemPrompt !== null) return handler({
|
|
@@ -4784,8 +4859,7 @@ function createSubAgentMiddleware(options) {
|
|
|
4784
4859
|
}
|
|
4785
4860
|
});
|
|
4786
4861
|
}
|
|
4787
|
-
|
|
4788
|
-
//#region src/middleware/patch_tool_calls.ts
|
|
4862
|
+
// src/middleware/patch_tool_calls.ts
|
|
4789
4863
|
/**
|
|
4790
4864
|
* Patch tool call / tool response parity in a messages array.
|
|
4791
4865
|
*
|
|
@@ -4879,6 +4953,7 @@ function patchDanglingToolCalls(messages) {
|
|
|
4879
4953
|
function createPatchToolCallsMiddleware() {
|
|
4880
4954
|
return (0, langchain.createMiddleware)({
|
|
4881
4955
|
name: "patchToolCallsMiddleware",
|
|
4956
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
4882
4957
|
beforeAgent: async (state) => {
|
|
4883
4958
|
const messages = state.messages;
|
|
4884
4959
|
if (!messages || messages.length === 0) return;
|
|
@@ -4908,8 +4983,7 @@ function createPatchToolCallsMiddleware() {
|
|
|
4908
4983
|
}
|
|
4909
4984
|
});
|
|
4910
4985
|
}
|
|
4911
|
-
|
|
4912
|
-
//#region src/values.ts
|
|
4986
|
+
// src/values.ts
|
|
4913
4987
|
/**
|
|
4914
4988
|
* Shared state values for use in StateSchema definitions.
|
|
4915
4989
|
*
|
|
@@ -4942,8 +5016,7 @@ const filesValue = new _langchain_langgraph.ReducedValue(zod.z.record(zod.z.stri
|
|
|
4942
5016
|
inputSchema: zod.z.record(zod.z.string(), FileDataSchema.nullable()).optional(),
|
|
4943
5017
|
reducer: fileDataReducer
|
|
4944
5018
|
});
|
|
4945
|
-
|
|
4946
|
-
//#region src/utils.ts
|
|
5019
|
+
// src/utils.ts
|
|
4947
5020
|
/**
|
|
4948
5021
|
* Detect whether a model is an Anthropic model.
|
|
4949
5022
|
*
|
|
@@ -5053,8 +5126,7 @@ function getModelProvider(model) {
|
|
|
5053
5126
|
function getModelIdentifier(model) {
|
|
5054
5127
|
return (model.getName() === "ConfigurableModel" ? model._defaultConfig : void 0)?.model ?? model.model_name ?? model.modelName ?? void 0;
|
|
5055
5128
|
}
|
|
5056
|
-
|
|
5057
|
-
//#region src/middleware/memory.ts
|
|
5129
|
+
// src/middleware/memory.ts
|
|
5058
5130
|
/**
|
|
5059
5131
|
* Middleware for loading agent memory/context from AGENTS.md files.
|
|
5060
5132
|
*
|
|
@@ -5240,6 +5312,7 @@ function createMemoryMiddleware(options) {
|
|
|
5240
5312
|
const { backend, sources, addCacheControl = false } = options;
|
|
5241
5313
|
return (0, langchain.createMiddleware)({
|
|
5242
5314
|
name: "MemoryMiddleware",
|
|
5315
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
5243
5316
|
stateSchema: MemoryStateSchema,
|
|
5244
5317
|
async beforeAgent(state) {
|
|
5245
5318
|
if ("memoryContents" in state && state.memoryContents != null) return;
|
|
@@ -5274,8 +5347,7 @@ function createMemoryMiddleware(options) {
|
|
|
5274
5347
|
}
|
|
5275
5348
|
});
|
|
5276
5349
|
}
|
|
5277
|
-
|
|
5278
|
-
//#region src/errors.ts
|
|
5350
|
+
// src/errors.ts
|
|
5279
5351
|
const CONFIGURATION_ERROR_SYMBOL = Symbol.for("deepagents.configuration_error");
|
|
5280
5352
|
/**
|
|
5281
5353
|
* Thrown when `createDeepAgent` receives invalid configuration.
|
|
@@ -5314,8 +5386,7 @@ var ConfigurationError = class ConfigurationError extends Error {
|
|
|
5314
5386
|
return typeof error === "object" && error !== null && error[CONFIGURATION_ERROR_SYMBOL] === true;
|
|
5315
5387
|
}
|
|
5316
5388
|
};
|
|
5317
|
-
|
|
5318
|
-
//#region src/middleware/skills.ts
|
|
5389
|
+
// src/middleware/skills.ts
|
|
5319
5390
|
/**
|
|
5320
5391
|
* Backend-agnostic skills middleware for loading agent skills from any backend.
|
|
5321
5392
|
*
|
|
@@ -5649,9 +5720,10 @@ function parseSkillMetadataFromContent(content, skillPath, directoryName) {
|
|
|
5649
5720
|
}
|
|
5650
5721
|
const rawTools = frontmatterData["allowed-tools"];
|
|
5651
5722
|
let allowedTools;
|
|
5652
|
-
if (rawTools)
|
|
5653
|
-
|
|
5654
|
-
|
|
5723
|
+
if (rawTools) {
|
|
5724
|
+
if (Array.isArray(rawTools)) allowedTools = rawTools.map((t) => String(t).trim()).filter(Boolean);
|
|
5725
|
+
else allowedTools = String(rawTools).split(/\s+/).filter(Boolean);
|
|
5726
|
+
} else allowedTools = [];
|
|
5655
5727
|
let compatibilityStr = String(frontmatterData.compatibility ?? "").trim() || null;
|
|
5656
5728
|
if (compatibilityStr && compatibilityStr.length > 500) {
|
|
5657
5729
|
console.warn(`Compatibility exceeds 500 characters in ${skillPath}, truncating`);
|
|
@@ -5774,17 +5846,15 @@ function buildPinnedSkillMessage(skill, content) {
|
|
|
5774
5846
|
const body = content.replace(FRONTMATTER_PATTERN, "").trimEnd();
|
|
5775
5847
|
const name = escapeXmlAttribute(skill.name);
|
|
5776
5848
|
const path = escapeXmlAttribute(skill.path);
|
|
5777
|
-
|
|
5849
|
+
const message = new _langchain_core_messages.HumanMessage({
|
|
5778
5850
|
content: `<skill name="${name}" path="${path}">\n${body}\n</skill>`,
|
|
5779
|
-
additional_kwargs: {
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
description: skill.description
|
|
5785
|
-
}
|
|
5786
|
-
}
|
|
5851
|
+
additional_kwargs: { skill: {
|
|
5852
|
+
name: skill.name,
|
|
5853
|
+
path: skill.path,
|
|
5854
|
+
description: skill.description
|
|
5855
|
+
} }
|
|
5787
5856
|
});
|
|
5857
|
+
return (0, _langchain_core_messages.addNotificationMetadata)(message, { source: "pinned_skill" });
|
|
5788
5858
|
}
|
|
5789
5859
|
/** Escape `value` for a double-quoted XML attribute. */
|
|
5790
5860
|
function escapeXmlAttribute(value) {
|
|
@@ -5852,20 +5922,6 @@ function validateModulePath(raw) {
|
|
|
5852
5922
|
}
|
|
5853
5923
|
/** Tool `extras` key (and provider field) that withholds a tool's schema until searched for. */
|
|
5854
5924
|
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
5925
|
/** Root `input_schema` keys the Anthropic API rejects, failing the whole request. */
|
|
5870
5926
|
const ANTHROPIC_ROOT_COMBINATORS = [
|
|
5871
5927
|
"oneOf",
|
|
@@ -5980,14 +6036,14 @@ async function discloseSkillTools(request, reads, resolver) {
|
|
|
5980
6036
|
record: {}
|
|
5981
6037
|
};
|
|
5982
6038
|
const chatModel = await resolveChatModel(request.model, request.runtime);
|
|
5983
|
-
if (
|
|
6039
|
+
if (chatModel && getModelProvider(chatModel) === "anthropic") withholdRootCombinatorTools(disclosed);
|
|
5984
6040
|
const gatedNames = [...disclosed.keys()].filter((name) => disclosed.get(name).includeName !== void 0).sort();
|
|
5985
6041
|
const record = Object.fromEntries(gatedNames.map((name) => [name, disclosed.get(name).includeName]));
|
|
5986
6042
|
if (disclosed.size === 0) return {
|
|
5987
6043
|
request,
|
|
5988
6044
|
record
|
|
5989
6045
|
};
|
|
5990
|
-
const build = inlineBlockBuilder(chatModel);
|
|
6046
|
+
const build = chatModel && inlineBlockBuilder(chatModel);
|
|
5991
6047
|
if (build !== void 0) return {
|
|
5992
6048
|
request: {
|
|
5993
6049
|
...request,
|
|
@@ -6111,7 +6167,8 @@ function unwrapBinding(model) {
|
|
|
6111
6167
|
return _langchain_core_runnables.RunnableBinding.isRunnableBinding(model) ? model.bound : model;
|
|
6112
6168
|
}
|
|
6113
6169
|
/**
|
|
6114
|
-
* Return the concrete chat model a request will call
|
|
6170
|
+
* Return the concrete chat model a request will call, or `undefined` if it
|
|
6171
|
+
* isn't a chat model.
|
|
6115
6172
|
*
|
|
6116
6173
|
* Resolves a `ConfigurableModel`, which a string `model` always becomes, to
|
|
6117
6174
|
* the instance it will call with this run's `configurable`. Without
|
|
@@ -6121,29 +6178,40 @@ function unwrapBinding(model) {
|
|
|
6121
6178
|
*/
|
|
6122
6179
|
async function resolveChatModel(model, runtime) {
|
|
6123
6180
|
const current = unwrapBinding(model);
|
|
6124
|
-
if (current
|
|
6181
|
+
if (!isConfigurableModel(current)) return isBaseChatModel(current) ? current : void 0;
|
|
6125
6182
|
const configurable = runtime.configurable ?? {};
|
|
6126
|
-
const overrides = current._modelParams
|
|
6127
|
-
|
|
6183
|
+
const overrides = current._modelParams({ configurable });
|
|
6184
|
+
const instance = unwrapBinding(Object.keys(overrides).length > 0 ? await current._getModelInstance({ configurable }) : await current._getModelInstance());
|
|
6185
|
+
return isBaseChatModel(instance) ? instance : void 0;
|
|
6128
6186
|
}
|
|
6129
|
-
/**
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6187
|
+
/**
|
|
6188
|
+
* Duck-typed as langchain's own (unexported) `isConfigurableModel`, since an
|
|
6189
|
+
* `instanceof` check fails across copies of the package.
|
|
6190
|
+
*/
|
|
6191
|
+
function isConfigurableModel(model) {
|
|
6192
|
+
return typeof model === "object" && model !== null && "_queuedMethodOperations" in model && "_getModelInstance" in model && typeof model._getModelInstance === "function";
|
|
6193
|
+
}
|
|
6194
|
+
/**
|
|
6195
|
+
* Duck-typed as langchain's own (unexported) `isBaseChatModel`, since an
|
|
6196
|
+
* `instanceof` check fails across copies of `@langchain/core`.
|
|
6197
|
+
*/
|
|
6198
|
+
function isBaseChatModel(model) {
|
|
6199
|
+
return typeof model === "object" && model !== null && "_streamResponseChunks" in model && "_llmType" in model && typeof model._llmType === "function";
|
|
6133
6200
|
}
|
|
6134
6201
|
/**
|
|
6135
6202
|
* Return how `chatModel` is given a tool mid-conversation, or `undefined` if
|
|
6136
6203
|
* it can't be.
|
|
6137
6204
|
*
|
|
6138
|
-
* The
|
|
6139
|
-
*
|
|
6205
|
+
* The profile's `midConversationTools` decides whether, and the provider
|
|
6206
|
+
* decides the block.
|
|
6140
6207
|
*/
|
|
6141
6208
|
function inlineBlockBuilder(chatModel) {
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6209
|
+
if (!chatModel.profile.midConversationTools) return void 0;
|
|
6210
|
+
switch (getModelProvider(chatModel)) {
|
|
6211
|
+
case "anthropic": return anthropicToolAddition;
|
|
6212
|
+
case "openai": return openaiAdditionalTools;
|
|
6213
|
+
default: return;
|
|
6214
|
+
}
|
|
6147
6215
|
}
|
|
6148
6216
|
/**
|
|
6149
6217
|
* Return the definition `ChatAnthropic` sends in `tools` for `tool`, without
|
|
@@ -6274,6 +6342,7 @@ function createSkillsMiddleware(options) {
|
|
|
6274
6342
|
const hasSkillTools = typeof options.tools === "function" || Array.isArray(options.tools) && options.tools.length > 0;
|
|
6275
6343
|
return (0, langchain.createMiddleware)({
|
|
6276
6344
|
name: "SkillsMiddleware",
|
|
6345
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
6277
6346
|
stateSchema: SkillsStateSchema,
|
|
6278
6347
|
async beforeModel(state) {
|
|
6279
6348
|
const needsLoad = state.skillsMetadata === null || state.skillsMetadata === void 0;
|
|
@@ -6328,8 +6397,7 @@ function createSkillsMiddleware(options) {
|
|
|
6328
6397
|
}
|
|
6329
6398
|
});
|
|
6330
6399
|
}
|
|
6331
|
-
|
|
6332
|
-
//#region src/middleware/completion_callback.ts
|
|
6400
|
+
// src/middleware/completion_callback.ts
|
|
6333
6401
|
/**
|
|
6334
6402
|
* Callback middleware for async subagents.
|
|
6335
6403
|
*
|
|
@@ -6546,6 +6614,7 @@ function createCompletionCallbackMiddleware(options) {
|
|
|
6546
6614
|
}
|
|
6547
6615
|
return (0, langchain.createMiddleware)({
|
|
6548
6616
|
name: "CompletionCallbackMiddleware",
|
|
6617
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
6549
6618
|
stateSchema: CompletionCallbackStateSchema,
|
|
6550
6619
|
/**
|
|
6551
6620
|
* After-agent hook: fires when the subagent completes successfully.
|
|
@@ -6577,8 +6646,7 @@ function createCompletionCallbackMiddleware(options) {
|
|
|
6577
6646
|
}
|
|
6578
6647
|
});
|
|
6579
6648
|
}
|
|
6580
|
-
|
|
6581
|
-
//#region src/middleware/async_subagents.ts
|
|
6649
|
+
// src/middleware/async_subagents.ts
|
|
6582
6650
|
function toolCallIdFromRuntime(runtime) {
|
|
6583
6651
|
return runtime.toolCall?.id ?? runtime.toolCallId ?? "";
|
|
6584
6652
|
}
|
|
@@ -7171,7 +7239,13 @@ function finalContent(values) {
|
|
|
7171
7239
|
}];
|
|
7172
7240
|
const last = messages[messages.length - 1];
|
|
7173
7241
|
try {
|
|
7174
|
-
|
|
7242
|
+
const message = (0, _langchain_core_messages.coerceMessageLikeToMessage)(last);
|
|
7243
|
+
const refusal = refusalIn(message);
|
|
7244
|
+
if (refusal) return [{
|
|
7245
|
+
type: "text",
|
|
7246
|
+
text: refusalNotice(refusal)
|
|
7247
|
+
}];
|
|
7248
|
+
return message.contentBlocks;
|
|
7175
7249
|
} catch {
|
|
7176
7250
|
return [{
|
|
7177
7251
|
type: "text",
|
|
@@ -7665,6 +7739,7 @@ function createAsyncSubAgentMiddleware(options) {
|
|
|
7665
7739
|
const fullSystemPrompt = systemPrompt ? `${systemPrompt}\n\nAvailable async subagent types:\n${agentsDescription}` : null;
|
|
7666
7740
|
return (0, langchain.createMiddleware)({
|
|
7667
7741
|
name: "asyncSubAgentMiddleware",
|
|
7742
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
7668
7743
|
stateSchema: AsyncTaskStateSchema,
|
|
7669
7744
|
tools,
|
|
7670
7745
|
beforeAgent: async (state) => {
|
|
@@ -7711,8 +7786,7 @@ function createAsyncSubAgentMiddleware(options) {
|
|
|
7711
7786
|
}
|
|
7712
7787
|
});
|
|
7713
7788
|
}
|
|
7714
|
-
|
|
7715
|
-
//#region src/middleware/cache.ts
|
|
7789
|
+
// src/middleware/cache.ts
|
|
7716
7790
|
/**
|
|
7717
7791
|
* Creates a middleware that places a cache breakpoint at the end of the static
|
|
7718
7792
|
* system prompt content.
|
|
@@ -7742,6 +7816,7 @@ function createAsyncSubAgentMiddleware(options) {
|
|
|
7742
7816
|
function createCacheBreakpointMiddleware() {
|
|
7743
7817
|
return (0, langchain.createMiddleware)({
|
|
7744
7818
|
name: "CacheBreakpointMiddleware",
|
|
7819
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
7745
7820
|
wrapModelCall(request, handler) {
|
|
7746
7821
|
if (!isAnthropicModel(request.model)) return handler(request);
|
|
7747
7822
|
const existingContent = request.systemMessage.content;
|
|
@@ -7761,8 +7836,7 @@ function createCacheBreakpointMiddleware() {
|
|
|
7761
7836
|
}
|
|
7762
7837
|
});
|
|
7763
7838
|
}
|
|
7764
|
-
|
|
7765
|
-
//#region src/middleware/parent_notifier.ts
|
|
7839
|
+
// src/middleware/parent_notifier.ts
|
|
7766
7840
|
/** Whether this is the outermost graph of a task run, not a graph nested in it. */
|
|
7767
7841
|
function isTopLevelGraph(config) {
|
|
7768
7842
|
const configurable = config.configurable ?? {};
|
|
@@ -7795,6 +7869,7 @@ function createParentNotifierMiddleware() {
|
|
|
7795
7869
|
}
|
|
7796
7870
|
return (0, langchain.createMiddleware)({
|
|
7797
7871
|
name: "parentNotifierMiddleware",
|
|
7872
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
7798
7873
|
afterAgent: async (state) => {
|
|
7799
7874
|
await report("success", { result: finalContent(state) });
|
|
7800
7875
|
},
|
|
@@ -7808,8 +7883,7 @@ function createParentNotifierMiddleware() {
|
|
|
7808
7883
|
}
|
|
7809
7884
|
});
|
|
7810
7885
|
}
|
|
7811
|
-
|
|
7812
|
-
//#region src/middleware/tool_exclusion.ts
|
|
7886
|
+
// src/middleware/tool_exclusion.ts
|
|
7813
7887
|
function hasToolName(tool) {
|
|
7814
7888
|
return tool !== null && typeof tool === "object" && "name" in tool && typeof tool.name === "string";
|
|
7815
7889
|
}
|
|
@@ -7823,6 +7897,7 @@ function hasToolName(tool) {
|
|
|
7823
7897
|
function createToolExclusionMiddleware(excludedTools) {
|
|
7824
7898
|
return (0, langchain.createMiddleware)({
|
|
7825
7899
|
name: "_ToolExclusionMiddleware",
|
|
7900
|
+
tracePolicy: { processInputs: _langchain_core_tracers_tracer_langchain.omitPayload },
|
|
7826
7901
|
wrapModelCall(request, handler) {
|
|
7827
7902
|
return handler({
|
|
7828
7903
|
...request,
|
|
@@ -7841,8 +7916,7 @@ function createToolExclusionMiddleware(excludedTools) {
|
|
|
7841
7916
|
}
|
|
7842
7917
|
});
|
|
7843
7918
|
}
|
|
7844
|
-
|
|
7845
|
-
//#region src/profiles/keys.ts
|
|
7919
|
+
// src/profiles/keys.ts
|
|
7846
7920
|
/**
|
|
7847
7921
|
* Normalize and validate a profile registry key.
|
|
7848
7922
|
*
|
|
@@ -7872,8 +7946,7 @@ function validateProfileKey(key) {
|
|
|
7872
7946
|
}
|
|
7873
7947
|
return trimmed;
|
|
7874
7948
|
}
|
|
7875
|
-
|
|
7876
|
-
//#region src/profiles/harness/types.ts
|
|
7949
|
+
// src/profiles/harness/types.ts
|
|
7877
7950
|
/**
|
|
7878
7951
|
* Middleware names that provide essential agent capabilities and cannot
|
|
7879
7952
|
* be excluded via `excludedMiddleware`.
|
|
@@ -7904,8 +7977,7 @@ function resolveMiddleware(middleware) {
|
|
|
7904
7977
|
if (typeof middleware === "function") return middleware();
|
|
7905
7978
|
return middleware;
|
|
7906
7979
|
}
|
|
7907
|
-
|
|
7908
|
-
//#region src/profiles/harness/create.ts
|
|
7980
|
+
// src/profiles/harness/create.ts
|
|
7909
7981
|
/**
|
|
7910
7982
|
* Validate the grammar of an `excludedMiddleware` entry.
|
|
7911
7983
|
*
|
|
@@ -7967,8 +8039,7 @@ function createHarnessProfile(options = {}) {
|
|
|
7967
8039
|
* profile matches. Avoids creating a new object on every miss.
|
|
7968
8040
|
*/
|
|
7969
8041
|
const EMPTY_HARNESS_PROFILE = createHarnessProfile();
|
|
7970
|
-
|
|
7971
|
-
//#region src/profiles/harness/serialization.ts
|
|
8042
|
+
// src/profiles/harness/serialization.ts
|
|
7972
8043
|
const POISONED_KEYS = /* @__PURE__ */ new Set([
|
|
7973
8044
|
"__proto__",
|
|
7974
8045
|
"constructor",
|
|
@@ -8074,8 +8145,7 @@ function serializeProfile(profile) {
|
|
|
8074
8145
|
}
|
|
8075
8146
|
return result;
|
|
8076
8147
|
}
|
|
8077
|
-
|
|
8078
|
-
//#region src/profiles/harness/merge.ts
|
|
8148
|
+
// src/profiles/harness/merge.ts
|
|
8079
8149
|
/**
|
|
8080
8150
|
* Merge two middleware sequences by `.name`.
|
|
8081
8151
|
*
|
|
@@ -8160,8 +8230,7 @@ function mergeProfiles(base, override) {
|
|
|
8160
8230
|
generalPurposeSubagent: mergeGeneralPurposeSubagentConfigs(base.generalPurposeSubagent, override.generalPurposeSubagent)
|
|
8161
8231
|
});
|
|
8162
8232
|
}
|
|
8163
|
-
|
|
8164
|
-
//#region src/profiles/harness/builtins/anthropic-opus-4-7.ts
|
|
8233
|
+
// src/profiles/harness/builtins/anthropic-opus-4-7.ts
|
|
8165
8234
|
const SYSTEM_PROMPT_SUFFIX$3 = `\
|
|
8166
8235
|
<use_parallel_tool_calls>
|
|
8167
8236
|
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 +8266,7 @@ Spawn multiple subagents in the same turn when fanning out across items or readi
|
|
|
8197
8266
|
function register$3() {
|
|
8198
8267
|
registerHarnessProfileImpl("anthropic:claude-opus-4-7", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$3 }));
|
|
8199
8268
|
}
|
|
8200
|
-
|
|
8201
|
-
//#region src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
|
|
8269
|
+
// src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
|
|
8202
8270
|
const SYSTEM_PROMPT_SUFFIX$2 = `\
|
|
8203
8271
|
<use_parallel_tool_calls>
|
|
8204
8272
|
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 +8296,7 @@ After receiving tool results, carefully reflect on their quality and determine o
|
|
|
8228
8296
|
function register$2() {
|
|
8229
8297
|
registerHarnessProfileImpl("anthropic:claude-sonnet-4-6", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$2 }));
|
|
8230
8298
|
}
|
|
8231
|
-
|
|
8232
|
-
//#region src/profiles/harness/builtins/anthropic-haiku-4-5.ts
|
|
8299
|
+
// src/profiles/harness/builtins/anthropic-haiku-4-5.ts
|
|
8233
8300
|
const SYSTEM_PROMPT_SUFFIX$1 = `\
|
|
8234
8301
|
<use_parallel_tool_calls>
|
|
8235
8302
|
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 +8320,7 @@ After receiving tool results, carefully reflect on their quality and determine o
|
|
|
8253
8320
|
function register$1() {
|
|
8254
8321
|
registerHarnessProfileImpl("anthropic:claude-haiku-4-5", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$1 }));
|
|
8255
8322
|
}
|
|
8256
|
-
|
|
8257
|
-
//#region src/profiles/harness/builtins/openai-codex.ts
|
|
8323
|
+
// src/profiles/harness/builtins/openai-codex.ts
|
|
8258
8324
|
/**
|
|
8259
8325
|
* Model specs that receive the Codex harness profile.
|
|
8260
8326
|
*
|
|
@@ -8311,8 +8377,7 @@ function register() {
|
|
|
8311
8377
|
});
|
|
8312
8378
|
for (const spec of CODEX_MODEL_SPECS) registerHarnessProfileImpl(spec, profile);
|
|
8313
8379
|
}
|
|
8314
|
-
|
|
8315
|
-
//#region src/profiles/harness/builtins/index.ts
|
|
8380
|
+
// src/profiles/harness/builtins/index.ts
|
|
8316
8381
|
/**
|
|
8317
8382
|
* Register all built-in harness profiles and snapshot the resulting
|
|
8318
8383
|
* registry keys as the builtin baseline.
|
|
@@ -8330,8 +8395,7 @@ function loadBuiltinProfiles() {
|
|
|
8330
8395
|
register();
|
|
8331
8396
|
snapshotBuiltinKeys();
|
|
8332
8397
|
}
|
|
8333
|
-
|
|
8334
|
-
//#region src/profiles/harness/registry.ts
|
|
8398
|
+
// src/profiles/harness/registry.ts
|
|
8335
8399
|
/**
|
|
8336
8400
|
* Process-global symbol key for the harness profile registry. The `.v1`
|
|
8337
8401
|
* suffix is a version gate — bump it when the {@link HarnessProfileRegistry}
|
|
@@ -8514,8 +8578,7 @@ function applyProfilePrompt(profile, basePrompt) {
|
|
|
8514
8578
|
if (profile.systemPromptSuffix !== void 0) return prompt ? `${prompt}\n\n${profile.systemPromptSuffix}` : profile.systemPromptSuffix;
|
|
8515
8579
|
return prompt;
|
|
8516
8580
|
}
|
|
8517
|
-
|
|
8518
|
-
//#region src/agent.ts
|
|
8581
|
+
// src/agent.ts
|
|
8519
8582
|
function normalizeSystemPrompt(systemPrompt) {
|
|
8520
8583
|
if (systemPrompt === void 0) return {};
|
|
8521
8584
|
if (typeof systemPrompt === "string" || langchain.SystemMessage.isInstance(systemPrompt)) return { prefix: systemPrompt };
|
|
@@ -8668,7 +8731,8 @@ function createDeepAgent(params = {}) {
|
|
|
8668
8731
|
backend,
|
|
8669
8732
|
sources: memory,
|
|
8670
8733
|
addCacheControl: anthropicModel
|
|
8671
|
-
})] : []
|
|
8734
|
+
})] : [],
|
|
8735
|
+
(0, langchain.modelRefusalMiddleware)()
|
|
8672
8736
|
]);
|
|
8673
8737
|
if (subagentProfile.excludedMiddleware.size > 0) subagentMiddleware = subagentMiddleware.filter((middleware) => !subagentProfile.excludedMiddleware.has(middleware.name));
|
|
8674
8738
|
if (subagentProfile.excludedTools.size > 0) subagentMiddleware.push(createToolExclusionMiddleware(subagentProfile.excludedTools));
|
|
@@ -8725,7 +8789,8 @@ function createDeepAgent(params = {}) {
|
|
|
8725
8789
|
...skillsMiddleware,
|
|
8726
8790
|
...cacheMiddleware,
|
|
8727
8791
|
...memoryMiddleware,
|
|
8728
|
-
...interruptOn ? [(0, langchain.humanInTheLoopMiddleware)({ interruptOn })] : []
|
|
8792
|
+
...interruptOn ? [(0, langchain.humanInTheLoopMiddleware)({ interruptOn })] : [],
|
|
8793
|
+
(0, langchain.modelRefusalMiddleware)()
|
|
8729
8794
|
]);
|
|
8730
8795
|
if (harnessProfile.excludedMiddleware.size > 0) {
|
|
8731
8796
|
const excluded = harnessProfile.excludedMiddleware;
|
|
@@ -8763,8 +8828,7 @@ function createDeepAgent(params = {}) {
|
|
|
8763
8828
|
}
|
|
8764
8829
|
});
|
|
8765
8830
|
}
|
|
8766
|
-
|
|
8767
|
-
//#region src/compat.ts
|
|
8831
|
+
// src/compat.ts
|
|
8768
8832
|
/**
|
|
8769
8833
|
* @deprecated Legacy prompt compatibility exports.
|
|
8770
8834
|
*
|
|
@@ -8897,8 +8961,7 @@ const EXECUTION_SYSTEM_PROMPT = langchain.context`
|
|
|
8897
8961
|
|
|
8898
8962
|
- execute: run a shell command in the sandbox (returns output and exit code)
|
|
8899
8963
|
`;
|
|
8900
|
-
|
|
8901
|
-
//#region src/backends/store.ts
|
|
8964
|
+
// src/backends/store.ts
|
|
8902
8965
|
/**
|
|
8903
8966
|
* StoreBackend: Adapter for LangGraph's BaseStore (persistent, cross-thread).
|
|
8904
8967
|
*/
|
|
@@ -9397,8 +9460,7 @@ var StoreBackend = class {
|
|
|
9397
9460
|
return responses;
|
|
9398
9461
|
}
|
|
9399
9462
|
};
|
|
9400
|
-
|
|
9401
|
-
//#region src/backends/context-hub.ts
|
|
9463
|
+
// src/backends/context-hub.ts
|
|
9402
9464
|
/**
|
|
9403
9465
|
* ContextHubBackend: Store files in a LangSmith Hub agent repo (persistent).
|
|
9404
9466
|
*/
|
|
@@ -10168,8 +10230,7 @@ var ContextHubBackend = class ContextHubBackend {
|
|
|
10168
10230
|
});
|
|
10169
10231
|
}
|
|
10170
10232
|
};
|
|
10171
|
-
|
|
10172
|
-
//#region src/backends/sandbox.ts
|
|
10233
|
+
// src/backends/sandbox.ts
|
|
10173
10234
|
/**
|
|
10174
10235
|
* Shell-quote a string using single quotes (POSIX).
|
|
10175
10236
|
* Escapes embedded single quotes with the '\'' technique.
|
|
@@ -10191,17 +10252,18 @@ function globToPathRegex(pattern) {
|
|
|
10191
10252
|
let i = 0;
|
|
10192
10253
|
while (i < pattern.length) {
|
|
10193
10254
|
const c = pattern[i];
|
|
10194
|
-
if (c === "*")
|
|
10195
|
-
i
|
|
10196
|
-
|
|
10197
|
-
|
|
10255
|
+
if (c === "*") {
|
|
10256
|
+
if (i + 1 < pattern.length && pattern[i + 1] === "*") {
|
|
10257
|
+
i += 2;
|
|
10258
|
+
if (i < pattern.length && pattern[i] === "/") {
|
|
10259
|
+
regex += "(.*/)?";
|
|
10260
|
+
i++;
|
|
10261
|
+
} else regex += ".*";
|
|
10262
|
+
} else {
|
|
10263
|
+
regex += "[^/]*";
|
|
10198
10264
|
i++;
|
|
10199
|
-
}
|
|
10200
|
-
} else {
|
|
10201
|
-
regex += "[^/]*";
|
|
10202
|
-
i++;
|
|
10203
|
-
}
|
|
10204
|
-
else if (c === "?") {
|
|
10265
|
+
}
|
|
10266
|
+
} else if (c === "?") {
|
|
10205
10267
|
regex += "[^/]";
|
|
10206
10268
|
i++;
|
|
10207
10269
|
} else if (c === "[") {
|
|
@@ -10663,8 +10725,7 @@ var BaseSandbox = class {
|
|
|
10663
10725
|
};
|
|
10664
10726
|
}
|
|
10665
10727
|
};
|
|
10666
|
-
|
|
10667
|
-
//#region src/backends/langsmith.ts
|
|
10728
|
+
// src/backends/langsmith.ts
|
|
10668
10729
|
/**
|
|
10669
10730
|
* LangSmith Sandbox backend for deepagents.
|
|
10670
10731
|
*
|
|
@@ -10863,7 +10924,6 @@ var LangSmithSandbox = class LangSmithSandbox extends BaseSandbox {
|
|
|
10863
10924
|
});
|
|
10864
10925
|
}
|
|
10865
10926
|
};
|
|
10866
|
-
//#endregion
|
|
10867
10927
|
Object.defineProperty(exports, "ASYNC_TASK_SYSTEM_PROMPT", {
|
|
10868
10928
|
enumerable: true,
|
|
10869
10929
|
get: function() {
|
|
@@ -11225,4 +11285,4 @@ Object.defineProperty(exports, "skillsMetadataValue", {
|
|
|
11225
11285
|
}
|
|
11226
11286
|
});
|
|
11227
11287
|
|
|
11228
|
-
//# sourceMappingURL=langsmith-
|
|
11288
|
+
//# sourceMappingURL=langsmith-D_tzVwxp.cjs.map
|