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,5 +1,6 @@
|
|
|
1
|
-
import { AIMessage, HumanMessage, SystemMessage, ToolMessage, anthropicPromptCachingMiddleware, bedrockPromptCachingMiddleware, context, countTokensApproximately, createAgent, createMiddleware, humanInTheLoopMiddleware, todoListMiddleware, tool } from "langchain";
|
|
2
|
-
import {
|
|
1
|
+
import { AIMessage, HumanMessage, SystemMessage, ToolMessage, anthropicPromptCachingMiddleware, bedrockPromptCachingMiddleware, context, countTokensApproximately, createAgent, createMiddleware, humanInTheLoopMiddleware, modelRefusalMiddleware, todoListMiddleware, tool } from "langchain";
|
|
2
|
+
import { omitPayload } from "@langchain/core/tracers/tracer_langchain";
|
|
3
|
+
import { ContextOverflowError, ModelRefusalError } 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";
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2135
|
-
//#region src/middleware/fs.ts
|
|
2130
|
+
// src/middleware/fs.ts
|
|
2136
2131
|
/**
|
|
2137
2132
|
* Middleware for providing filesystem tools to an agent.
|
|
2138
2133
|
*
|
|
@@ -2363,6 +2358,25 @@ function truncatePaginatedRead(body, readResult, options) {
|
|
|
2363
2358
|
*/
|
|
2364
2359
|
const GREP_TRUNCATION_NOTE = "Note: the search stopped early because it hit the maximum match count. The matches above are valid but incomplete. Narrow the search (a more specific pattern or a narrower path), or raise max_count, to see the rest.";
|
|
2365
2360
|
/**
|
|
2361
|
+
* Characters of a grep line shown to the model. Longer lines (minified JSON,
|
|
2362
|
+
* offloaded tool results) show a window around the match instead, so one hit
|
|
2363
|
+
* can't return the whole line.
|
|
2364
|
+
*/
|
|
2365
|
+
const GREP_LINE_CHAR_LIMIT = 2e3;
|
|
2366
|
+
/**
|
|
2367
|
+
* Clip `text` to a `GREP_LINE_CHAR_LIMIT` window centered on `pattern`,
|
|
2368
|
+
* falling back to the head of the line when `pattern` isn't found in it.
|
|
2369
|
+
*/
|
|
2370
|
+
function clipGrepLine(text, pattern) {
|
|
2371
|
+
if (text.length <= 2e3) return text;
|
|
2372
|
+
const center = Math.max(text.indexOf(pattern), 0) + Math.floor(pattern.length / 2);
|
|
2373
|
+
const start = Math.min(Math.max(center - GREP_LINE_CHAR_LIMIT / 2, 0), text.length - GREP_LINE_CHAR_LIMIT);
|
|
2374
|
+
const end = start + GREP_LINE_CHAR_LIMIT;
|
|
2375
|
+
const before = start > 0 ? `[${start} chars clipped] ` : "";
|
|
2376
|
+
const after = end < text.length ? ` [${text.length - end} chars clipped]` : "";
|
|
2377
|
+
return `${before}${text.slice(start, end)}${after}`;
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2366
2380
|
* Default cap on the number of matches the grep tool returns.
|
|
2367
2381
|
* Set to null to disable the cap.
|
|
2368
2382
|
*/
|
|
@@ -3147,7 +3161,10 @@ function createGrepTool(backend, options) {
|
|
|
3147
3161
|
if (result.error) return toolError(runtime, "grep", result.error);
|
|
3148
3162
|
const matches = await filterByPermissions(resolvedBackend, result.matches ?? [], permissions, "read", (m) => m.path);
|
|
3149
3163
|
if (matches.length === 0) return `No matches found for pattern '${pattern}'`;
|
|
3150
|
-
const truncated = truncateIfTooLong(formatGrepMatches(matches
|
|
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,55 @@ function createFilesystemMiddleware(options = {}) {
|
|
|
3522
3540
|
}
|
|
3523
3541
|
});
|
|
3524
3542
|
}
|
|
3525
|
-
|
|
3526
|
-
|
|
3543
|
+
// src/middleware/refusal.ts
|
|
3544
|
+
/**
|
|
3545
|
+
* The task result reported when a model in the subagent refused.
|
|
3546
|
+
*
|
|
3547
|
+
* @param refusal - The refusal block from the model's reply.
|
|
3548
|
+
*/
|
|
3549
|
+
function refusalNotice(refusal) {
|
|
3550
|
+
let notice = "The subagent stopped because a model refused the request.";
|
|
3551
|
+
const category = refusal.extras?.category;
|
|
3552
|
+
if (category) notice += ` Category: ${String(category)}.`;
|
|
3553
|
+
if (refusal.refusal) notice += ` Explanation: "${refusal.refusal}"`;
|
|
3554
|
+
return `${notice} Retrying the same request is unlikely to succeed; rephrase it or continue without it.`;
|
|
3555
|
+
}
|
|
3556
|
+
/**
|
|
3557
|
+
* The refusal block in `message`, if it is a message that refused.
|
|
3558
|
+
*
|
|
3559
|
+
* @param message - The message to check. Callers often take it from an
|
|
3560
|
+
* unchecked cast, so non-messages are treated as no refusal.
|
|
3561
|
+
*/
|
|
3562
|
+
function refusalIn(message) {
|
|
3563
|
+
if (!BaseMessage.isInstance(message)) return void 0;
|
|
3564
|
+
try {
|
|
3565
|
+
return message.contentBlocks.find((block) => block.type === "refusal");
|
|
3566
|
+
} catch {
|
|
3567
|
+
return;
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
/**
|
|
3571
|
+
* The task result for an error caused by a refusal, or `undefined` to rethrow it.
|
|
3572
|
+
*
|
|
3573
|
+
* Middleware wraps errors in `MiddlewareError`, so this walks the `cause` chain.
|
|
3574
|
+
*
|
|
3575
|
+
* @param error - The error the subagent run threw.
|
|
3576
|
+
*/
|
|
3577
|
+
function refusalNoticeFor(error) {
|
|
3578
|
+
let current = error;
|
|
3579
|
+
while (current) {
|
|
3580
|
+
if (ModelRefusalError.isInstance(current)) return refusalNotice(refusalIn(current.rawMessage) ?? {
|
|
3581
|
+
type: "refusal",
|
|
3582
|
+
refusal: current.message
|
|
3583
|
+
});
|
|
3584
|
+
if (typeof current === "object" && "aiMessage" in current) {
|
|
3585
|
+
const refusal = refusalIn(current.aiMessage);
|
|
3586
|
+
if (refusal) return refusalNotice(refusal);
|
|
3587
|
+
}
|
|
3588
|
+
current = typeof current === "object" && "cause" in current ? current.cause : void 0;
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
// src/middleware/summarization.ts
|
|
3527
3592
|
/**
|
|
3528
3593
|
* Summarization middleware with backend support for conversation history offloading.
|
|
3529
3594
|
*
|
|
@@ -4081,10 +4146,7 @@ function createSummarizationMiddleware(options) {
|
|
|
4081
4146
|
</summary>
|
|
4082
4147
|
`;
|
|
4083
4148
|
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
|
-
});
|
|
4149
|
+
return addNotificationMetadata(new HumanMessage({ content }), { source: "summarization" });
|
|
4088
4150
|
}
|
|
4089
4151
|
/**
|
|
4090
4152
|
* Summarize a set of messages using the given model and build the
|
|
@@ -4172,6 +4234,7 @@ function createSummarizationMiddleware(options) {
|
|
|
4172
4234
|
}
|
|
4173
4235
|
return createMiddleware({
|
|
4174
4236
|
name: "SummarizationMiddleware",
|
|
4237
|
+
tracePolicy: { processInputs: omitPayload },
|
|
4175
4238
|
stateSchema: SummarizationStateSchema,
|
|
4176
4239
|
async wrapModelCall(request, handler) {
|
|
4177
4240
|
const effectiveMessages = getEffectiveMessages(request.messages ?? [], request.state);
|
|
@@ -4216,8 +4279,7 @@ function createSummarizationMiddleware(options) {
|
|
|
4216
4279
|
}
|
|
4217
4280
|
});
|
|
4218
4281
|
}
|
|
4219
|
-
|
|
4220
|
-
//#region src/middleware/utils.ts
|
|
4282
|
+
// src/middleware/utils.ts
|
|
4221
4283
|
/**
|
|
4222
4284
|
* Utility functions for middleware.
|
|
4223
4285
|
*
|
|
@@ -4293,8 +4355,7 @@ function appendToSystemMessage(systemMessage, text) {
|
|
|
4293
4355
|
}
|
|
4294
4356
|
return new SystemMessage$1({ content: text });
|
|
4295
4357
|
}
|
|
4296
|
-
|
|
4297
|
-
//#region src/middleware/subagents.ts
|
|
4358
|
+
// src/middleware/subagents.ts
|
|
4298
4359
|
/**
|
|
4299
4360
|
* Config key used by task-tool callers to request dynamic response format.
|
|
4300
4361
|
*
|
|
@@ -4482,7 +4543,9 @@ const INVALID_TOOL_MESSAGE_BLOCK_TYPES = [
|
|
|
4482
4543
|
function returnCommandWithStateUpdate(result, toolCallId) {
|
|
4483
4544
|
const stateUpdate = filterStateForSubagent(result);
|
|
4484
4545
|
let content;
|
|
4546
|
+
const refusal = refusalIn(result.messages?.at(-1));
|
|
4485
4547
|
if (result.structuredResponse != null) content = JSON.stringify(result.structuredResponse);
|
|
4548
|
+
else if (refusal) content = refusalNotice(refusal);
|
|
4486
4549
|
else {
|
|
4487
4550
|
const messages = result.messages ?? [];
|
|
4488
4551
|
content = "Task completed";
|
|
@@ -4514,6 +4577,7 @@ const ForkedContextStateSchema = z.object({ [FORKED_CONTEXT_KEY]: z.boolean().op
|
|
|
4514
4577
|
function createForkTaskToolMiddleware(taskTool) {
|
|
4515
4578
|
return createMiddleware({
|
|
4516
4579
|
name: "forkTaskToolMiddleware",
|
|
4580
|
+
tracePolicy: { processInputs: omitPayload },
|
|
4517
4581
|
stateSchema: ForkedContextStateSchema,
|
|
4518
4582
|
tools: [taskTool],
|
|
4519
4583
|
beforeAgent: () => ({ [FORKED_CONTEXT_KEY]: true })
|
|
@@ -4682,18 +4746,29 @@ function createTaskTool(options) {
|
|
|
4682
4746
|
...config,
|
|
4683
4747
|
metadata: {
|
|
4684
4748
|
...config.metadata,
|
|
4685
|
-
lc_agent_name: subagent_type
|
|
4749
|
+
lc_agent_name: subagent_type,
|
|
4750
|
+
...config.toolCall?.id && { lc_subagent_tool_call_id: config.toolCall.id }
|
|
4686
4751
|
},
|
|
4687
4752
|
configurable: {
|
|
4688
4753
|
...config.configurable,
|
|
4689
4754
|
ls_agent_type: "subagent"
|
|
4690
4755
|
}
|
|
4691
4756
|
};
|
|
4692
|
-
|
|
4757
|
+
let result;
|
|
4758
|
+
try {
|
|
4759
|
+
result = await subagent.invoke(subagentState, subagentConfig);
|
|
4760
|
+
} catch (error) {
|
|
4761
|
+
const notice = refusalNoticeFor(error);
|
|
4762
|
+
if (notice === void 0) throw error;
|
|
4763
|
+
return notice;
|
|
4764
|
+
}
|
|
4693
4765
|
if (!config.toolCall?.id) {
|
|
4694
4766
|
if (result.structuredResponse != null) return JSON.stringify(result.structuredResponse);
|
|
4695
4767
|
const messages = result.messages;
|
|
4696
|
-
|
|
4768
|
+
const lastMessage = messages?.[messages.length - 1];
|
|
4769
|
+
const refusal = refusalIn(lastMessage);
|
|
4770
|
+
if (refusal) return refusalNotice(refusal);
|
|
4771
|
+
let content = lastMessage?.content || "Task completed";
|
|
4697
4772
|
if (Array.isArray(content)) {
|
|
4698
4773
|
content = content.filter((block) => !INVALID_TOOL_MESSAGE_BLOCK_TYPES.includes(block.type));
|
|
4699
4774
|
if (content.length === 0) return "Task completed";
|
|
@@ -4750,6 +4825,7 @@ function createSubAgentMiddleware(options) {
|
|
|
4750
4825
|
});
|
|
4751
4826
|
return createMiddleware({
|
|
4752
4827
|
name: "subAgentMiddleware",
|
|
4828
|
+
tracePolicy: { processInputs: omitPayload },
|
|
4753
4829
|
tools: [taskTool],
|
|
4754
4830
|
wrapModelCall: async (request, handler) => {
|
|
4755
4831
|
if (systemPrompt !== null) return handler({
|
|
@@ -4760,8 +4836,7 @@ function createSubAgentMiddleware(options) {
|
|
|
4760
4836
|
}
|
|
4761
4837
|
});
|
|
4762
4838
|
}
|
|
4763
|
-
|
|
4764
|
-
//#region src/middleware/patch_tool_calls.ts
|
|
4839
|
+
// src/middleware/patch_tool_calls.ts
|
|
4765
4840
|
/**
|
|
4766
4841
|
* Patch tool call / tool response parity in a messages array.
|
|
4767
4842
|
*
|
|
@@ -4855,6 +4930,7 @@ function patchDanglingToolCalls(messages) {
|
|
|
4855
4930
|
function createPatchToolCallsMiddleware() {
|
|
4856
4931
|
return createMiddleware({
|
|
4857
4932
|
name: "patchToolCallsMiddleware",
|
|
4933
|
+
tracePolicy: { processInputs: omitPayload },
|
|
4858
4934
|
beforeAgent: async (state) => {
|
|
4859
4935
|
const messages = state.messages;
|
|
4860
4936
|
if (!messages || messages.length === 0) return;
|
|
@@ -4884,8 +4960,7 @@ function createPatchToolCallsMiddleware() {
|
|
|
4884
4960
|
}
|
|
4885
4961
|
});
|
|
4886
4962
|
}
|
|
4887
|
-
|
|
4888
|
-
//#region src/values.ts
|
|
4963
|
+
// src/values.ts
|
|
4889
4964
|
/**
|
|
4890
4965
|
* Shared state values for use in StateSchema definitions.
|
|
4891
4966
|
*
|
|
@@ -4918,8 +4993,7 @@ const filesValue = new ReducedValue(z$1.record(z$1.string(), FileDataSchema).def
|
|
|
4918
4993
|
inputSchema: z$1.record(z$1.string(), FileDataSchema.nullable()).optional(),
|
|
4919
4994
|
reducer: fileDataReducer
|
|
4920
4995
|
});
|
|
4921
|
-
|
|
4922
|
-
//#region src/utils.ts
|
|
4996
|
+
// src/utils.ts
|
|
4923
4997
|
/**
|
|
4924
4998
|
* Detect whether a model is an Anthropic model.
|
|
4925
4999
|
*
|
|
@@ -5029,8 +5103,7 @@ function getModelProvider(model) {
|
|
|
5029
5103
|
function getModelIdentifier(model) {
|
|
5030
5104
|
return (model.getName() === "ConfigurableModel" ? model._defaultConfig : void 0)?.model ?? model.model_name ?? model.modelName ?? void 0;
|
|
5031
5105
|
}
|
|
5032
|
-
|
|
5033
|
-
//#region src/middleware/memory.ts
|
|
5106
|
+
// src/middleware/memory.ts
|
|
5034
5107
|
/**
|
|
5035
5108
|
* Middleware for loading agent memory/context from AGENTS.md files.
|
|
5036
5109
|
*
|
|
@@ -5216,6 +5289,7 @@ function createMemoryMiddleware(options) {
|
|
|
5216
5289
|
const { backend, sources, addCacheControl = false } = options;
|
|
5217
5290
|
return createMiddleware({
|
|
5218
5291
|
name: "MemoryMiddleware",
|
|
5292
|
+
tracePolicy: { processInputs: omitPayload },
|
|
5219
5293
|
stateSchema: MemoryStateSchema,
|
|
5220
5294
|
async beforeAgent(state) {
|
|
5221
5295
|
if ("memoryContents" in state && state.memoryContents != null) return;
|
|
@@ -5250,8 +5324,7 @@ function createMemoryMiddleware(options) {
|
|
|
5250
5324
|
}
|
|
5251
5325
|
});
|
|
5252
5326
|
}
|
|
5253
|
-
|
|
5254
|
-
//#region src/errors.ts
|
|
5327
|
+
// src/errors.ts
|
|
5255
5328
|
const CONFIGURATION_ERROR_SYMBOL = Symbol.for("deepagents.configuration_error");
|
|
5256
5329
|
/**
|
|
5257
5330
|
* Thrown when `createDeepAgent` receives invalid configuration.
|
|
@@ -5290,8 +5363,7 @@ var ConfigurationError = class ConfigurationError extends Error {
|
|
|
5290
5363
|
return typeof error === "object" && error !== null && error[CONFIGURATION_ERROR_SYMBOL] === true;
|
|
5291
5364
|
}
|
|
5292
5365
|
};
|
|
5293
|
-
|
|
5294
|
-
//#region src/middleware/skills.ts
|
|
5366
|
+
// src/middleware/skills.ts
|
|
5295
5367
|
/**
|
|
5296
5368
|
* Backend-agnostic skills middleware for loading agent skills from any backend.
|
|
5297
5369
|
*
|
|
@@ -5625,9 +5697,10 @@ function parseSkillMetadataFromContent(content, skillPath, directoryName) {
|
|
|
5625
5697
|
}
|
|
5626
5698
|
const rawTools = frontmatterData["allowed-tools"];
|
|
5627
5699
|
let allowedTools;
|
|
5628
|
-
if (rawTools)
|
|
5629
|
-
|
|
5630
|
-
|
|
5700
|
+
if (rawTools) {
|
|
5701
|
+
if (Array.isArray(rawTools)) allowedTools = rawTools.map((t) => String(t).trim()).filter(Boolean);
|
|
5702
|
+
else allowedTools = String(rawTools).split(/\s+/).filter(Boolean);
|
|
5703
|
+
} else allowedTools = [];
|
|
5631
5704
|
let compatibilityStr = String(frontmatterData.compatibility ?? "").trim() || null;
|
|
5632
5705
|
if (compatibilityStr && compatibilityStr.length > 500) {
|
|
5633
5706
|
console.warn(`Compatibility exceeds 500 characters in ${skillPath}, truncating`);
|
|
@@ -5750,17 +5823,15 @@ function buildPinnedSkillMessage(skill, content) {
|
|
|
5750
5823
|
const body = content.replace(FRONTMATTER_PATTERN, "").trimEnd();
|
|
5751
5824
|
const name = escapeXmlAttribute(skill.name);
|
|
5752
5825
|
const path = escapeXmlAttribute(skill.path);
|
|
5753
|
-
|
|
5826
|
+
const message = new HumanMessage$1({
|
|
5754
5827
|
content: `<skill name="${name}" path="${path}">\n${body}\n</skill>`,
|
|
5755
|
-
additional_kwargs: {
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
description: skill.description
|
|
5761
|
-
}
|
|
5762
|
-
}
|
|
5828
|
+
additional_kwargs: { skill: {
|
|
5829
|
+
name: skill.name,
|
|
5830
|
+
path: skill.path,
|
|
5831
|
+
description: skill.description
|
|
5832
|
+
} }
|
|
5763
5833
|
});
|
|
5834
|
+
return addNotificationMetadata(message, { source: "pinned_skill" });
|
|
5764
5835
|
}
|
|
5765
5836
|
/** Escape `value` for a double-quoted XML attribute. */
|
|
5766
5837
|
function escapeXmlAttribute(value) {
|
|
@@ -5828,20 +5899,6 @@ function validateModulePath(raw) {
|
|
|
5828
5899
|
}
|
|
5829
5900
|
/** Tool `extras` key (and provider field) that withholds a tool's schema until searched for. */
|
|
5830
5901
|
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
5902
|
/** Root `input_schema` keys the Anthropic API rejects, failing the whole request. */
|
|
5846
5903
|
const ANTHROPIC_ROOT_COMBINATORS = [
|
|
5847
5904
|
"oneOf",
|
|
@@ -5956,14 +6013,14 @@ async function discloseSkillTools(request, reads, resolver) {
|
|
|
5956
6013
|
record: {}
|
|
5957
6014
|
};
|
|
5958
6015
|
const chatModel = await resolveChatModel(request.model, request.runtime);
|
|
5959
|
-
if (
|
|
6016
|
+
if (chatModel && getModelProvider(chatModel) === "anthropic") withholdRootCombinatorTools(disclosed);
|
|
5960
6017
|
const gatedNames = [...disclosed.keys()].filter((name) => disclosed.get(name).includeName !== void 0).sort();
|
|
5961
6018
|
const record = Object.fromEntries(gatedNames.map((name) => [name, disclosed.get(name).includeName]));
|
|
5962
6019
|
if (disclosed.size === 0) return {
|
|
5963
6020
|
request,
|
|
5964
6021
|
record
|
|
5965
6022
|
};
|
|
5966
|
-
const build = inlineBlockBuilder(chatModel);
|
|
6023
|
+
const build = chatModel && inlineBlockBuilder(chatModel);
|
|
5967
6024
|
if (build !== void 0) return {
|
|
5968
6025
|
request: {
|
|
5969
6026
|
...request,
|
|
@@ -6087,7 +6144,8 @@ function unwrapBinding(model) {
|
|
|
6087
6144
|
return RunnableBinding.isRunnableBinding(model) ? model.bound : model;
|
|
6088
6145
|
}
|
|
6089
6146
|
/**
|
|
6090
|
-
* Return the concrete chat model a request will call
|
|
6147
|
+
* Return the concrete chat model a request will call, or `undefined` if it
|
|
6148
|
+
* isn't a chat model.
|
|
6091
6149
|
*
|
|
6092
6150
|
* Resolves a `ConfigurableModel`, which a string `model` always becomes, to
|
|
6093
6151
|
* the instance it will call with this run's `configurable`. Without
|
|
@@ -6097,29 +6155,40 @@ function unwrapBinding(model) {
|
|
|
6097
6155
|
*/
|
|
6098
6156
|
async function resolveChatModel(model, runtime) {
|
|
6099
6157
|
const current = unwrapBinding(model);
|
|
6100
|
-
if (current
|
|
6158
|
+
if (!isConfigurableModel(current)) return isBaseChatModel(current) ? current : void 0;
|
|
6101
6159
|
const configurable = runtime.configurable ?? {};
|
|
6102
|
-
const overrides = current._modelParams
|
|
6103
|
-
|
|
6160
|
+
const overrides = current._modelParams({ configurable });
|
|
6161
|
+
const instance = unwrapBinding(Object.keys(overrides).length > 0 ? await current._getModelInstance({ configurable }) : await current._getModelInstance());
|
|
6162
|
+
return isBaseChatModel(instance) ? instance : void 0;
|
|
6104
6163
|
}
|
|
6105
|
-
/**
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6164
|
+
/**
|
|
6165
|
+
* Duck-typed as langchain's own (unexported) `isConfigurableModel`, since an
|
|
6166
|
+
* `instanceof` check fails across copies of the package.
|
|
6167
|
+
*/
|
|
6168
|
+
function isConfigurableModel(model) {
|
|
6169
|
+
return typeof model === "object" && model !== null && "_queuedMethodOperations" in model && "_getModelInstance" in model && typeof model._getModelInstance === "function";
|
|
6170
|
+
}
|
|
6171
|
+
/**
|
|
6172
|
+
* Duck-typed as langchain's own (unexported) `isBaseChatModel`, since an
|
|
6173
|
+
* `instanceof` check fails across copies of `@langchain/core`.
|
|
6174
|
+
*/
|
|
6175
|
+
function isBaseChatModel(model) {
|
|
6176
|
+
return typeof model === "object" && model !== null && "_streamResponseChunks" in model && "_llmType" in model && typeof model._llmType === "function";
|
|
6109
6177
|
}
|
|
6110
6178
|
/**
|
|
6111
6179
|
* Return how `chatModel` is given a tool mid-conversation, or `undefined` if
|
|
6112
6180
|
* it can't be.
|
|
6113
6181
|
*
|
|
6114
|
-
* The
|
|
6115
|
-
*
|
|
6182
|
+
* The profile's `midConversationTools` decides whether, and the provider
|
|
6183
|
+
* decides the block.
|
|
6116
6184
|
*/
|
|
6117
6185
|
function inlineBlockBuilder(chatModel) {
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6186
|
+
if (!chatModel.profile.midConversationTools) return void 0;
|
|
6187
|
+
switch (getModelProvider(chatModel)) {
|
|
6188
|
+
case "anthropic": return anthropicToolAddition;
|
|
6189
|
+
case "openai": return openaiAdditionalTools;
|
|
6190
|
+
default: return;
|
|
6191
|
+
}
|
|
6123
6192
|
}
|
|
6124
6193
|
/**
|
|
6125
6194
|
* Return the definition `ChatAnthropic` sends in `tools` for `tool`, without
|
|
@@ -6250,6 +6319,7 @@ function createSkillsMiddleware(options) {
|
|
|
6250
6319
|
const hasSkillTools = typeof options.tools === "function" || Array.isArray(options.tools) && options.tools.length > 0;
|
|
6251
6320
|
return createMiddleware({
|
|
6252
6321
|
name: "SkillsMiddleware",
|
|
6322
|
+
tracePolicy: { processInputs: omitPayload },
|
|
6253
6323
|
stateSchema: SkillsStateSchema,
|
|
6254
6324
|
async beforeModel(state) {
|
|
6255
6325
|
const needsLoad = state.skillsMetadata === null || state.skillsMetadata === void 0;
|
|
@@ -6304,8 +6374,7 @@ function createSkillsMiddleware(options) {
|
|
|
6304
6374
|
}
|
|
6305
6375
|
});
|
|
6306
6376
|
}
|
|
6307
|
-
|
|
6308
|
-
//#region src/middleware/completion_callback.ts
|
|
6377
|
+
// src/middleware/completion_callback.ts
|
|
6309
6378
|
/**
|
|
6310
6379
|
* Callback middleware for async subagents.
|
|
6311
6380
|
*
|
|
@@ -6522,6 +6591,7 @@ function createCompletionCallbackMiddleware(options) {
|
|
|
6522
6591
|
}
|
|
6523
6592
|
return createMiddleware({
|
|
6524
6593
|
name: "CompletionCallbackMiddleware",
|
|
6594
|
+
tracePolicy: { processInputs: omitPayload },
|
|
6525
6595
|
stateSchema: CompletionCallbackStateSchema,
|
|
6526
6596
|
/**
|
|
6527
6597
|
* After-agent hook: fires when the subagent completes successfully.
|
|
@@ -6553,8 +6623,7 @@ function createCompletionCallbackMiddleware(options) {
|
|
|
6553
6623
|
}
|
|
6554
6624
|
});
|
|
6555
6625
|
}
|
|
6556
|
-
|
|
6557
|
-
//#region src/middleware/async_subagents.ts
|
|
6626
|
+
// src/middleware/async_subagents.ts
|
|
6558
6627
|
function toolCallIdFromRuntime(runtime) {
|
|
6559
6628
|
return runtime.toolCall?.id ?? runtime.toolCallId ?? "";
|
|
6560
6629
|
}
|
|
@@ -7147,7 +7216,13 @@ function finalContent(values) {
|
|
|
7147
7216
|
}];
|
|
7148
7217
|
const last = messages[messages.length - 1];
|
|
7149
7218
|
try {
|
|
7150
|
-
|
|
7219
|
+
const message = coerceMessageLikeToMessage(last);
|
|
7220
|
+
const refusal = refusalIn(message);
|
|
7221
|
+
if (refusal) return [{
|
|
7222
|
+
type: "text",
|
|
7223
|
+
text: refusalNotice(refusal)
|
|
7224
|
+
}];
|
|
7225
|
+
return message.contentBlocks;
|
|
7151
7226
|
} catch {
|
|
7152
7227
|
return [{
|
|
7153
7228
|
type: "text",
|
|
@@ -7641,6 +7716,7 @@ function createAsyncSubAgentMiddleware(options) {
|
|
|
7641
7716
|
const fullSystemPrompt = systemPrompt ? `${systemPrompt}\n\nAvailable async subagent types:\n${agentsDescription}` : null;
|
|
7642
7717
|
return createMiddleware({
|
|
7643
7718
|
name: "asyncSubAgentMiddleware",
|
|
7719
|
+
tracePolicy: { processInputs: omitPayload },
|
|
7644
7720
|
stateSchema: AsyncTaskStateSchema,
|
|
7645
7721
|
tools,
|
|
7646
7722
|
beforeAgent: async (state) => {
|
|
@@ -7687,8 +7763,7 @@ function createAsyncSubAgentMiddleware(options) {
|
|
|
7687
7763
|
}
|
|
7688
7764
|
});
|
|
7689
7765
|
}
|
|
7690
|
-
|
|
7691
|
-
//#region src/middleware/cache.ts
|
|
7766
|
+
// src/middleware/cache.ts
|
|
7692
7767
|
/**
|
|
7693
7768
|
* Creates a middleware that places a cache breakpoint at the end of the static
|
|
7694
7769
|
* system prompt content.
|
|
@@ -7718,6 +7793,7 @@ function createAsyncSubAgentMiddleware(options) {
|
|
|
7718
7793
|
function createCacheBreakpointMiddleware() {
|
|
7719
7794
|
return createMiddleware({
|
|
7720
7795
|
name: "CacheBreakpointMiddleware",
|
|
7796
|
+
tracePolicy: { processInputs: omitPayload },
|
|
7721
7797
|
wrapModelCall(request, handler) {
|
|
7722
7798
|
if (!isAnthropicModel(request.model)) return handler(request);
|
|
7723
7799
|
const existingContent = request.systemMessage.content;
|
|
@@ -7737,8 +7813,7 @@ function createCacheBreakpointMiddleware() {
|
|
|
7737
7813
|
}
|
|
7738
7814
|
});
|
|
7739
7815
|
}
|
|
7740
|
-
|
|
7741
|
-
//#region src/middleware/parent_notifier.ts
|
|
7816
|
+
// src/middleware/parent_notifier.ts
|
|
7742
7817
|
/** Whether this is the outermost graph of a task run, not a graph nested in it. */
|
|
7743
7818
|
function isTopLevelGraph(config) {
|
|
7744
7819
|
const configurable = config.configurable ?? {};
|
|
@@ -7771,6 +7846,7 @@ function createParentNotifierMiddleware() {
|
|
|
7771
7846
|
}
|
|
7772
7847
|
return createMiddleware({
|
|
7773
7848
|
name: "parentNotifierMiddleware",
|
|
7849
|
+
tracePolicy: { processInputs: omitPayload },
|
|
7774
7850
|
afterAgent: async (state) => {
|
|
7775
7851
|
await report("success", { result: finalContent(state) });
|
|
7776
7852
|
},
|
|
@@ -7784,8 +7860,7 @@ function createParentNotifierMiddleware() {
|
|
|
7784
7860
|
}
|
|
7785
7861
|
});
|
|
7786
7862
|
}
|
|
7787
|
-
|
|
7788
|
-
//#region src/middleware/tool_exclusion.ts
|
|
7863
|
+
// src/middleware/tool_exclusion.ts
|
|
7789
7864
|
function hasToolName(tool) {
|
|
7790
7865
|
return tool !== null && typeof tool === "object" && "name" in tool && typeof tool.name === "string";
|
|
7791
7866
|
}
|
|
@@ -7799,6 +7874,7 @@ function hasToolName(tool) {
|
|
|
7799
7874
|
function createToolExclusionMiddleware(excludedTools) {
|
|
7800
7875
|
return createMiddleware({
|
|
7801
7876
|
name: "_ToolExclusionMiddleware",
|
|
7877
|
+
tracePolicy: { processInputs: omitPayload },
|
|
7802
7878
|
wrapModelCall(request, handler) {
|
|
7803
7879
|
return handler({
|
|
7804
7880
|
...request,
|
|
@@ -7817,8 +7893,7 @@ function createToolExclusionMiddleware(excludedTools) {
|
|
|
7817
7893
|
}
|
|
7818
7894
|
});
|
|
7819
7895
|
}
|
|
7820
|
-
|
|
7821
|
-
//#region src/profiles/keys.ts
|
|
7896
|
+
// src/profiles/keys.ts
|
|
7822
7897
|
/**
|
|
7823
7898
|
* Normalize and validate a profile registry key.
|
|
7824
7899
|
*
|
|
@@ -7848,8 +7923,7 @@ function validateProfileKey(key) {
|
|
|
7848
7923
|
}
|
|
7849
7924
|
return trimmed;
|
|
7850
7925
|
}
|
|
7851
|
-
|
|
7852
|
-
//#region src/profiles/harness/types.ts
|
|
7926
|
+
// src/profiles/harness/types.ts
|
|
7853
7927
|
/**
|
|
7854
7928
|
* Middleware names that provide essential agent capabilities and cannot
|
|
7855
7929
|
* be excluded via `excludedMiddleware`.
|
|
@@ -7880,8 +7954,7 @@ function resolveMiddleware(middleware) {
|
|
|
7880
7954
|
if (typeof middleware === "function") return middleware();
|
|
7881
7955
|
return middleware;
|
|
7882
7956
|
}
|
|
7883
|
-
|
|
7884
|
-
//#region src/profiles/harness/create.ts
|
|
7957
|
+
// src/profiles/harness/create.ts
|
|
7885
7958
|
/**
|
|
7886
7959
|
* Validate the grammar of an `excludedMiddleware` entry.
|
|
7887
7960
|
*
|
|
@@ -7943,8 +8016,7 @@ function createHarnessProfile(options = {}) {
|
|
|
7943
8016
|
* profile matches. Avoids creating a new object on every miss.
|
|
7944
8017
|
*/
|
|
7945
8018
|
const EMPTY_HARNESS_PROFILE = createHarnessProfile();
|
|
7946
|
-
|
|
7947
|
-
//#region src/profiles/harness/serialization.ts
|
|
8019
|
+
// src/profiles/harness/serialization.ts
|
|
7948
8020
|
const POISONED_KEYS = /* @__PURE__ */ new Set([
|
|
7949
8021
|
"__proto__",
|
|
7950
8022
|
"constructor",
|
|
@@ -8050,8 +8122,7 @@ function serializeProfile(profile) {
|
|
|
8050
8122
|
}
|
|
8051
8123
|
return result;
|
|
8052
8124
|
}
|
|
8053
|
-
|
|
8054
|
-
//#region src/profiles/harness/merge.ts
|
|
8125
|
+
// src/profiles/harness/merge.ts
|
|
8055
8126
|
/**
|
|
8056
8127
|
* Merge two middleware sequences by `.name`.
|
|
8057
8128
|
*
|
|
@@ -8136,8 +8207,7 @@ function mergeProfiles(base, override) {
|
|
|
8136
8207
|
generalPurposeSubagent: mergeGeneralPurposeSubagentConfigs(base.generalPurposeSubagent, override.generalPurposeSubagent)
|
|
8137
8208
|
});
|
|
8138
8209
|
}
|
|
8139
|
-
|
|
8140
|
-
//#region src/profiles/harness/builtins/anthropic-opus-4-7.ts
|
|
8210
|
+
// src/profiles/harness/builtins/anthropic-opus-4-7.ts
|
|
8141
8211
|
const SYSTEM_PROMPT_SUFFIX$3 = `\
|
|
8142
8212
|
<use_parallel_tool_calls>
|
|
8143
8213
|
If you intend to call multiple tools and there are no dependencies between the tool calls, make all of the independent tool calls in parallel. Prioritize calling tools simultaneously whenever the actions can be done in parallel rather than sequentially. For example, when reading 3 files, run 3 tool calls in parallel to read all 3 files into context at the same time. Maximize use of parallel tool calls where possible to increase speed and efficiency. However, if some tool calls depend on previous calls to inform dependent values like the parameters, do NOT call these tools in parallel and instead call them sequentially. Never use placeholders or guess missing parameters in tool calls.
|
|
@@ -8173,8 +8243,7 @@ Spawn multiple subagents in the same turn when fanning out across items or readi
|
|
|
8173
8243
|
function register$3() {
|
|
8174
8244
|
registerHarnessProfileImpl("anthropic:claude-opus-4-7", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$3 }));
|
|
8175
8245
|
}
|
|
8176
|
-
|
|
8177
|
-
//#region src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
|
|
8246
|
+
// src/profiles/harness/builtins/anthropic-sonnet-4-6.ts
|
|
8178
8247
|
const SYSTEM_PROMPT_SUFFIX$2 = `\
|
|
8179
8248
|
<use_parallel_tool_calls>
|
|
8180
8249
|
If you intend to call multiple tools and there are no dependencies between the tool calls, make all of the independent tool calls in parallel. Prioritize calling tools simultaneously whenever the actions can be done in parallel rather than sequentially. For example, when reading 3 files, run 3 tool calls in parallel to read all 3 files into context at the same time. Maximize use of parallel tool calls where possible to increase speed and efficiency. However, if some tool calls depend on previous calls to inform dependent values like the parameters, do NOT call these tools in parallel and instead call them sequentially. Never use placeholders or guess missing parameters in tool calls.
|
|
@@ -8204,8 +8273,7 @@ After receiving tool results, carefully reflect on their quality and determine o
|
|
|
8204
8273
|
function register$2() {
|
|
8205
8274
|
registerHarnessProfileImpl("anthropic:claude-sonnet-4-6", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$2 }));
|
|
8206
8275
|
}
|
|
8207
|
-
|
|
8208
|
-
//#region src/profiles/harness/builtins/anthropic-haiku-4-5.ts
|
|
8276
|
+
// src/profiles/harness/builtins/anthropic-haiku-4-5.ts
|
|
8209
8277
|
const SYSTEM_PROMPT_SUFFIX$1 = `\
|
|
8210
8278
|
<use_parallel_tool_calls>
|
|
8211
8279
|
If you intend to call multiple tools and there are no dependencies between the tool calls, make all of the independent tool calls in parallel. Prioritize calling tools simultaneously whenever the actions can be done in parallel rather than sequentially. For example, when reading 3 files, run 3 tool calls in parallel to read all 3 files into context at the same time. Maximize use of parallel tool calls where possible to increase speed and efficiency. However, if some tool calls depend on previous calls to inform dependent values like the parameters, do NOT call these tools in parallel and instead call them sequentially. Never use placeholders or guess missing parameters in tool calls.
|
|
@@ -8229,8 +8297,7 @@ After receiving tool results, carefully reflect on their quality and determine o
|
|
|
8229
8297
|
function register$1() {
|
|
8230
8298
|
registerHarnessProfileImpl("anthropic:claude-haiku-4-5", createHarnessProfile({ systemPromptSuffix: SYSTEM_PROMPT_SUFFIX$1 }));
|
|
8231
8299
|
}
|
|
8232
|
-
|
|
8233
|
-
//#region src/profiles/harness/builtins/openai-codex.ts
|
|
8300
|
+
// src/profiles/harness/builtins/openai-codex.ts
|
|
8234
8301
|
/**
|
|
8235
8302
|
* Model specs that receive the Codex harness profile.
|
|
8236
8303
|
*
|
|
@@ -8287,8 +8354,7 @@ function register() {
|
|
|
8287
8354
|
});
|
|
8288
8355
|
for (const spec of CODEX_MODEL_SPECS) registerHarnessProfileImpl(spec, profile);
|
|
8289
8356
|
}
|
|
8290
|
-
|
|
8291
|
-
//#region src/profiles/harness/builtins/index.ts
|
|
8357
|
+
// src/profiles/harness/builtins/index.ts
|
|
8292
8358
|
/**
|
|
8293
8359
|
* Register all built-in harness profiles and snapshot the resulting
|
|
8294
8360
|
* registry keys as the builtin baseline.
|
|
@@ -8306,8 +8372,7 @@ function loadBuiltinProfiles() {
|
|
|
8306
8372
|
register();
|
|
8307
8373
|
snapshotBuiltinKeys();
|
|
8308
8374
|
}
|
|
8309
|
-
|
|
8310
|
-
//#region src/profiles/harness/registry.ts
|
|
8375
|
+
// src/profiles/harness/registry.ts
|
|
8311
8376
|
/**
|
|
8312
8377
|
* Process-global symbol key for the harness profile registry. The `.v1`
|
|
8313
8378
|
* suffix is a version gate — bump it when the {@link HarnessProfileRegistry}
|
|
@@ -8490,8 +8555,7 @@ function applyProfilePrompt(profile, basePrompt) {
|
|
|
8490
8555
|
if (profile.systemPromptSuffix !== void 0) return prompt ? `${prompt}\n\n${profile.systemPromptSuffix}` : profile.systemPromptSuffix;
|
|
8491
8556
|
return prompt;
|
|
8492
8557
|
}
|
|
8493
|
-
|
|
8494
|
-
//#region src/agent.ts
|
|
8558
|
+
// src/agent.ts
|
|
8495
8559
|
function normalizeSystemPrompt(systemPrompt) {
|
|
8496
8560
|
if (systemPrompt === void 0) return {};
|
|
8497
8561
|
if (typeof systemPrompt === "string" || SystemMessage.isInstance(systemPrompt)) return { prefix: systemPrompt };
|
|
@@ -8644,7 +8708,8 @@ function createDeepAgent(params = {}) {
|
|
|
8644
8708
|
backend,
|
|
8645
8709
|
sources: memory,
|
|
8646
8710
|
addCacheControl: anthropicModel
|
|
8647
|
-
})] : []
|
|
8711
|
+
})] : [],
|
|
8712
|
+
modelRefusalMiddleware()
|
|
8648
8713
|
]);
|
|
8649
8714
|
if (subagentProfile.excludedMiddleware.size > 0) subagentMiddleware = subagentMiddleware.filter((middleware) => !subagentProfile.excludedMiddleware.has(middleware.name));
|
|
8650
8715
|
if (subagentProfile.excludedTools.size > 0) subagentMiddleware.push(createToolExclusionMiddleware(subagentProfile.excludedTools));
|
|
@@ -8701,7 +8766,8 @@ function createDeepAgent(params = {}) {
|
|
|
8701
8766
|
...skillsMiddleware,
|
|
8702
8767
|
...cacheMiddleware,
|
|
8703
8768
|
...memoryMiddleware,
|
|
8704
|
-
...interruptOn ? [humanInTheLoopMiddleware({ interruptOn })] : []
|
|
8769
|
+
...interruptOn ? [humanInTheLoopMiddleware({ interruptOn })] : [],
|
|
8770
|
+
modelRefusalMiddleware()
|
|
8705
8771
|
]);
|
|
8706
8772
|
if (harnessProfile.excludedMiddleware.size > 0) {
|
|
8707
8773
|
const excluded = harnessProfile.excludedMiddleware;
|
|
@@ -8739,8 +8805,7 @@ function createDeepAgent(params = {}) {
|
|
|
8739
8805
|
}
|
|
8740
8806
|
});
|
|
8741
8807
|
}
|
|
8742
|
-
|
|
8743
|
-
//#region src/compat.ts
|
|
8808
|
+
// src/compat.ts
|
|
8744
8809
|
/**
|
|
8745
8810
|
* @deprecated Legacy prompt compatibility exports.
|
|
8746
8811
|
*
|
|
@@ -8873,8 +8938,7 @@ const EXECUTION_SYSTEM_PROMPT = context`
|
|
|
8873
8938
|
|
|
8874
8939
|
- execute: run a shell command in the sandbox (returns output and exit code)
|
|
8875
8940
|
`;
|
|
8876
|
-
|
|
8877
|
-
//#region src/backends/store.ts
|
|
8941
|
+
// src/backends/store.ts
|
|
8878
8942
|
/**
|
|
8879
8943
|
* StoreBackend: Adapter for LangGraph's BaseStore (persistent, cross-thread).
|
|
8880
8944
|
*/
|
|
@@ -9373,8 +9437,7 @@ var StoreBackend = class {
|
|
|
9373
9437
|
return responses;
|
|
9374
9438
|
}
|
|
9375
9439
|
};
|
|
9376
|
-
|
|
9377
|
-
//#region src/backends/context-hub.ts
|
|
9440
|
+
// src/backends/context-hub.ts
|
|
9378
9441
|
/**
|
|
9379
9442
|
* ContextHubBackend: Store files in a LangSmith Hub agent repo (persistent).
|
|
9380
9443
|
*/
|
|
@@ -10144,8 +10207,7 @@ var ContextHubBackend = class ContextHubBackend {
|
|
|
10144
10207
|
});
|
|
10145
10208
|
}
|
|
10146
10209
|
};
|
|
10147
|
-
|
|
10148
|
-
//#region src/backends/sandbox.ts
|
|
10210
|
+
// src/backends/sandbox.ts
|
|
10149
10211
|
/**
|
|
10150
10212
|
* Shell-quote a string using single quotes (POSIX).
|
|
10151
10213
|
* Escapes embedded single quotes with the '\'' technique.
|
|
@@ -10167,17 +10229,18 @@ function globToPathRegex(pattern) {
|
|
|
10167
10229
|
let i = 0;
|
|
10168
10230
|
while (i < pattern.length) {
|
|
10169
10231
|
const c = pattern[i];
|
|
10170
|
-
if (c === "*")
|
|
10171
|
-
i
|
|
10172
|
-
|
|
10173
|
-
|
|
10232
|
+
if (c === "*") {
|
|
10233
|
+
if (i + 1 < pattern.length && pattern[i + 1] === "*") {
|
|
10234
|
+
i += 2;
|
|
10235
|
+
if (i < pattern.length && pattern[i] === "/") {
|
|
10236
|
+
regex += "(.*/)?";
|
|
10237
|
+
i++;
|
|
10238
|
+
} else regex += ".*";
|
|
10239
|
+
} else {
|
|
10240
|
+
regex += "[^/]*";
|
|
10174
10241
|
i++;
|
|
10175
|
-
}
|
|
10176
|
-
} else {
|
|
10177
|
-
regex += "[^/]*";
|
|
10178
|
-
i++;
|
|
10179
|
-
}
|
|
10180
|
-
else if (c === "?") {
|
|
10242
|
+
}
|
|
10243
|
+
} else if (c === "?") {
|
|
10181
10244
|
regex += "[^/]";
|
|
10182
10245
|
i++;
|
|
10183
10246
|
} else if (c === "[") {
|
|
@@ -10639,8 +10702,7 @@ var BaseSandbox = class {
|
|
|
10639
10702
|
};
|
|
10640
10703
|
}
|
|
10641
10704
|
};
|
|
10642
|
-
|
|
10643
|
-
//#region src/backends/langsmith.ts
|
|
10705
|
+
// src/backends/langsmith.ts
|
|
10644
10706
|
/**
|
|
10645
10707
|
* LangSmith Sandbox backend for deepagents.
|
|
10646
10708
|
*
|
|
@@ -10839,7 +10901,6 @@ var LangSmithSandbox = class LangSmithSandbox extends BaseSandbox {
|
|
|
10839
10901
|
});
|
|
10840
10902
|
}
|
|
10841
10903
|
};
|
|
10842
|
-
//#endregion
|
|
10843
10904
|
export { adaptSandboxProtocol as $, filesValue as A, createFilesystemMiddleware as B, MAX_SKILL_FILE_SIZE as C, skillsMetadataValue as D, pinnedSkillsValue as E, SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY as F, scrubUnsupportedMultimodalContent as G, MULTIMODAL_BLOCK_TYPES as H, createSubAgent as I, applyGrepMaxCount as J, StateBackend as K, createSubAgentMiddleware as L, DEFAULT_GENERAL_PURPOSE_DESCRIPTION as M, DEFAULT_SUBAGENT_PROMPT as N, ConfigurationError as O, GENERAL_PURPOSE_SUBAGENT as P, adaptBackendProtocol as Q, computeSummarizationDefaults as R, MAX_SKILL_DESCRIPTION_LENGTH as S, createSkillsMiddleware as T, createUnsupportedContentMiddleware as U, CompositeBackend as V, multimodalBlockSupported as W, isSandboxProtocol as X, isSandboxBackend as Y, resolveBackend as Z, createHarnessProfile as _, ASYNC_TASK_SYSTEM_PROMPT as a, setRealpath as at, isAsyncSubAgent as b, TASK_SYSTEM_PROMPT as c, registerHarnessProfile as d, checkEmptyContent as et, generalPurposeSubagentConfigSchema as f, EMPTY_HARNESS_PROFILE as g, serializeProfile as h, StoreBackend as i, performStringReplacement as it, createPatchToolCallsMiddleware as j, createMemoryMiddleware as k, createDeepAgent as l, parseHarnessProfileConfig as m, BaseSandbox as n, isTextMimeType as nt, BASE_AGENT_PROMPT as o, harnessProfileConfigSchema as p, SandboxError as q, ContextHubBackend as r, normalizeReadPagination as rt, EXECUTION_SYSTEM_PROMPT as s, LangSmithSandbox as t, getMimeType as tt, getHarnessProfile as u, REQUIRED_MIDDLEWARE_NAMES as v, MAX_SKILL_NAME_LENGTH as w, createCompletionCallbackMiddleware as x, createAsyncSubAgentMiddleware as y, createSummarizationMiddleware as z };
|
|
10844
10905
|
|
|
10845
|
-
//# sourceMappingURL=langsmith-
|
|
10906
|
+
//# sourceMappingURL=langsmith-DfobOVRO.js.map
|