deepagents 1.16.4 → 1.16.5
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-DOFzksfM.d.cts → agent-Di09Mxb3.d.cts} +34 -1
- package/dist/{agent-BAuGxPZn.d.ts → agent-DiA5yRzO.d.ts} +35 -2
- 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 -1
- 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-DfobOVRO.js → langsmith-CH6GPPud.js} +184 -24
- package/dist/langsmith-CH6GPPud.js.map +1 -0
- package/dist/{langsmith-D_tzVwxp.cjs → langsmith-CR3a2-Z7.cjs} +189 -23
- package/dist/langsmith-CR3a2-Z7.cjs.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-DTOh2Xrc.cjs → src-DeLlHk9u.cjs} +151 -26
- package/dist/src-DeLlHk9u.cjs.map +1 -0
- package/dist/{src-KaJuKnnd.js → src-tRcDW-tU.js} +151 -26
- package/dist/src-tRcDW-tU.js.map +1 -0
- package/package.json +2 -2
- package/dist/langsmith-D_tzVwxp.cjs.map +0 -1
- package/dist/langsmith-DfobOVRO.js.map +0 -1
- package/dist/src-DTOh2Xrc.cjs.map +0 -1
- package/dist/src-KaJuKnnd.js.map +0 -1
|
@@ -6,11 +6,11 @@ import { z } from "zod/v4";
|
|
|
6
6
|
import micromatch from "micromatch";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { AIMessage as AIMessage$1, BaseMessage, HumanMessage as HumanMessage$1, RemoveMessage, SystemMessage as SystemMessage$1, ToolMessage as ToolMessage$1, addNotificationMetadata, coerceMessageLikeToMessage, getBufferString, getNotificationMetadata } from "@langchain/core/messages";
|
|
9
|
+
import { Runnable, RunnableBinding } from "@langchain/core/runnables";
|
|
9
10
|
import * as z$2 from "zod";
|
|
10
11
|
import { z as z$1 } from "zod";
|
|
11
12
|
import { initChatModel } from "langchain/chat_models/universal";
|
|
12
13
|
import yaml from "yaml";
|
|
13
|
-
import { Runnable, RunnableBinding } from "@langchain/core/runnables";
|
|
14
14
|
import { isLangChainTool } from "@langchain/core/tools";
|
|
15
15
|
import { isOpenAITool } from "@langchain/core/language_models/base";
|
|
16
16
|
import { convertToOpenAIFunction } from "@langchain/core/utils/function_calling";
|
|
@@ -34,6 +34,20 @@ function setRealpath(target, fn) {
|
|
|
34
34
|
configurable: true
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
+
// src/backends/pin.ts
|
|
38
|
+
const PIN = Symbol.for("deepagents.pin");
|
|
39
|
+
function getPin(backend) {
|
|
40
|
+
if (typeof backend !== "object" || backend === null) return;
|
|
41
|
+
const fn = backend[PIN];
|
|
42
|
+
return typeof fn === "function" ? fn : void 0;
|
|
43
|
+
}
|
|
44
|
+
function setPin(target, fn) {
|
|
45
|
+
Object.defineProperty(target, PIN, {
|
|
46
|
+
value: fn,
|
|
47
|
+
enumerable: false,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
// src/backends/utils.ts
|
|
38
52
|
/**
|
|
39
53
|
* Shared utility functions for memory backend implementations.
|
|
@@ -667,6 +681,8 @@ function adaptBackendProtocol(backend) {
|
|
|
667
681
|
}
|
|
668
682
|
const realpath = getRealpath(backend);
|
|
669
683
|
if (realpath !== void 0) setRealpath(adapted, realpath);
|
|
684
|
+
const pin = getPin(backend);
|
|
685
|
+
if (pin !== void 0) setPin(adapted, pin);
|
|
670
686
|
const resolveBackendForPath = backend.resolveBackendForPath;
|
|
671
687
|
if (typeof resolveBackendForPath === "function") Object.defineProperty(adapted, "resolveBackendForPath", {
|
|
672
688
|
value: (path) => resolveBackendForPath.call(backend, path),
|
|
@@ -1719,6 +1735,7 @@ var CompositeBackend = class {
|
|
|
1719
1735
|
this.routes = Object.fromEntries(Object.entries(routes).map(([k, v]) => [k.endsWith("/") ? k : `${k}/`, isSandboxProtocol(v) ? adaptSandboxProtocol(v) : adaptBackendProtocol(v)]));
|
|
1720
1736
|
this.sortedRoutes = Object.entries(this.routes).sort((a, b) => b[0].length - a[0].length);
|
|
1721
1737
|
setRealpath(this, (path) => this.resolveRealPath(path));
|
|
1738
|
+
setPin(this, (path, options, authorize, operation) => this.runPinned(path, options, authorize, operation));
|
|
1722
1739
|
}
|
|
1723
1740
|
/** Delegates to default backend's id if it is a sandbox, otherwise empty string. */
|
|
1724
1741
|
get id() {
|
|
@@ -1760,6 +1777,22 @@ var CompositeBackend = class {
|
|
|
1760
1777
|
return realpath === void 0 ? path : await realpath(path);
|
|
1761
1778
|
}
|
|
1762
1779
|
/**
|
|
1780
|
+
* Pin via the backend that owns `path`, re-adding the route prefix to the
|
|
1781
|
+
* real path it authorizes. Runs `operation` unpinned when that backend has
|
|
1782
|
+
* no pin hook.
|
|
1783
|
+
*/
|
|
1784
|
+
runPinned(path, options, authorize, operation) {
|
|
1785
|
+
for (const [routePrefix, backend] of this.sortedRoutes) if (this.isPathWithinRoute(path, routePrefix)) {
|
|
1786
|
+
const pin = getPin(backend);
|
|
1787
|
+
if (pin === void 0) return operation();
|
|
1788
|
+
const prefix = routePrefix.slice(0, -1);
|
|
1789
|
+
const suffix = path.substring(routePrefix.length);
|
|
1790
|
+
return pin(suffix ? "/" + suffix : "/", options, (realPath) => authorize(prefix + realPath), operation);
|
|
1791
|
+
}
|
|
1792
|
+
const pin = getPin(this.default);
|
|
1793
|
+
return pin === void 0 ? operation() : pin(path, options, authorize, operation);
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1763
1796
|
* Determine which backend handles this key and strip prefix.
|
|
1764
1797
|
*
|
|
1765
1798
|
* @param key - Original file path
|
|
@@ -2565,11 +2598,15 @@ async function resolveRealPath(backend, canonical) {
|
|
|
2565
2598
|
/**
|
|
2566
2599
|
* Check whether `path` is permitted under `rules` for `operation`.
|
|
2567
2600
|
*
|
|
2568
|
-
* Returns the canonical path to hand the backend
|
|
2569
|
-
*
|
|
2570
|
-
*
|
|
2571
|
-
* backend has a realpath hook, the
|
|
2572
|
-
* touch. A deny on either blocks the
|
|
2601
|
+
* Returns the canonical path, the `target` to hand the backend for a
|
|
2602
|
+
* single-file operation, or an error string to surface to the model. The
|
|
2603
|
+
* decision covers every form of the target: the lexical canonical path (dot
|
|
2604
|
+
* and empty segments dropped) and, when the backend has a realpath hook, the
|
|
2605
|
+
* symlink-resolved path it would actually touch. A deny on either blocks the
|
|
2606
|
+
* call.
|
|
2607
|
+
*
|
|
2608
|
+
* `target` is the path with its parent resolved once and checked, so a
|
|
2609
|
+
* symlink swapped after the check cannot redirect the operation.
|
|
2573
2610
|
*
|
|
2574
2611
|
* Never throws: an invalid path (non-absolute, or containing `..` or `~`), one
|
|
2575
2612
|
* the backend cannot resolve, or a denied one is a recoverable tool error, not
|
|
@@ -2578,18 +2615,64 @@ async function resolveRealPath(backend, canonical) {
|
|
|
2578
2615
|
* @internal
|
|
2579
2616
|
*/
|
|
2580
2617
|
async function checkPermission(backend, rules, operation, path) {
|
|
2581
|
-
if (rules.length === 0) return {
|
|
2618
|
+
if (rules.length === 0) return {
|
|
2619
|
+
path,
|
|
2620
|
+
target: path
|
|
2621
|
+
};
|
|
2582
2622
|
let canonical;
|
|
2623
|
+
let target;
|
|
2583
2624
|
let real;
|
|
2584
2625
|
try {
|
|
2585
2626
|
canonical = validatePath(path);
|
|
2586
2627
|
if (decidePathAccess(rules, operation, canonical) === "deny") return { error: `Error: permission denied for ${operation} on ${canonical}` };
|
|
2587
|
-
|
|
2628
|
+
target = await resolveParentRealPath(backend, canonical);
|
|
2629
|
+
real = await resolveRealPath(backend, target);
|
|
2588
2630
|
} catch (error) {
|
|
2589
2631
|
return { error: `Error: ${getErrorMessage$1(error)}` };
|
|
2590
2632
|
}
|
|
2633
|
+
if (crossesRoute(backend, canonical, target)) return { error: `Error: ${canonical} resolves to ${target}, which is served by a different backend` };
|
|
2591
2634
|
if (real !== canonical && decidePathAccess(rules, operation, real) === "deny") return { error: `Error: permission denied for ${operation} on ${canonical} (resolves to ${real})` };
|
|
2592
|
-
return {
|
|
2635
|
+
return {
|
|
2636
|
+
path: canonical,
|
|
2637
|
+
target
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
/**
|
|
2641
|
+
* Run a single-path `operation` on `target` through the backend's pin hook when
|
|
2642
|
+
* rules are configured and the backend has one, so the final decision is made
|
|
2643
|
+
* on the directory the operation actually uses. `isDenied` receives the real
|
|
2644
|
+
* path. Without a hook, `operation` runs on the path `checkPermission` resolved.
|
|
2645
|
+
*
|
|
2646
|
+
* Errors raised here, rather than by `operation`, start with `errorPrefix` so
|
|
2647
|
+
* they match how the calling tool formats backend errors.
|
|
2648
|
+
*/
|
|
2649
|
+
async function runBoundToTarget(backend, rules, target, options, isDenied, operation) {
|
|
2650
|
+
const pin = rules.length > 0 ? getPin(backend) : void 0;
|
|
2651
|
+
if (pin === void 0) return operation();
|
|
2652
|
+
const { create, describe, errorPrefix } = options;
|
|
2653
|
+
let operationStarted = false;
|
|
2654
|
+
try {
|
|
2655
|
+
return await pin(target, { create }, (realPath) => {
|
|
2656
|
+
const real = validatePath(realPath);
|
|
2657
|
+
return isDenied(real) ? `${errorPrefix}permission denied for ${describe} (resolves to ${real})` : void 0;
|
|
2658
|
+
}, () => {
|
|
2659
|
+
operationStarted = true;
|
|
2660
|
+
return operation();
|
|
2661
|
+
});
|
|
2662
|
+
} catch (error) {
|
|
2663
|
+
if (operationStarted) throw error;
|
|
2664
|
+
return { error: `${errorPrefix}${describe} failed: ${getErrorMessage$1(error)}` };
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
/**
|
|
2668
|
+
* Whether `target` is served by a different `CompositeBackend` route than
|
|
2669
|
+
* `requested`. Symlink resolution must not move an operation to another
|
|
2670
|
+
* backend.
|
|
2671
|
+
*/
|
|
2672
|
+
function crossesRoute(backend, requested, target) {
|
|
2673
|
+
const resolveBackendForPath = backend.resolveBackendForPath;
|
|
2674
|
+
if (typeof resolveBackendForPath !== "function" || requested === target) return false;
|
|
2675
|
+
return resolveBackendForPath.call(backend, requested)[0] !== resolveBackendForPath.call(backend, target)[0];
|
|
2593
2676
|
}
|
|
2594
2677
|
/**
|
|
2595
2678
|
* Build an error {@link ToolMessage} for a denied path or a failed backend
|
|
@@ -2763,10 +2846,11 @@ function parentPath(path) {
|
|
|
2763
2846
|
return `/${parts.slice(0, -1).join("/")}`;
|
|
2764
2847
|
}
|
|
2765
2848
|
/**
|
|
2766
|
-
* Resolve
|
|
2767
|
-
*
|
|
2849
|
+
* Resolve symlinks in the parent of `target`, keeping its leaf as given.
|
|
2850
|
+
* Backends refuse to follow (or, for delete, unlink) a symlinked leaf, so this
|
|
2851
|
+
* is the path a single-file operation actually touches.
|
|
2768
2852
|
*/
|
|
2769
|
-
async function
|
|
2853
|
+
async function resolveParentRealPath(backend, target) {
|
|
2770
2854
|
const parts = posixParts(target);
|
|
2771
2855
|
if (parts.length === 0) return resolveRealPath(backend, target);
|
|
2772
2856
|
return validatePath(`${await resolveRealPath(backend, parentPath(target))}/${parts[parts.length - 1]}`);
|
|
@@ -2933,7 +3017,11 @@ function createReadFileTool(backend, options) {
|
|
|
2933
3017
|
if (permission.error !== void 0) return toolError(runtime, "read_file", permission.error);
|
|
2934
3018
|
const { file_path, offset: requestedOffset = 0, limit: requestedLimit = 100 } = input;
|
|
2935
3019
|
const { offset, limit } = normalizeReadPagination(requestedOffset, requestedLimit);
|
|
2936
|
-
const readResult = await resolvedBackend
|
|
3020
|
+
const readResult = await runBoundToTarget(resolvedBackend, permissions, permission.target, {
|
|
3021
|
+
create: false,
|
|
3022
|
+
describe: `read on ${permission.path}`,
|
|
3023
|
+
errorPrefix: ""
|
|
3024
|
+
}, (real) => decidePathAccess(permissions, "read", real) === "deny", async () => resolvedBackend.read(permission.target, offset, limit));
|
|
2937
3025
|
if (readResult.error) return toolError(runtime, "read_file", `Error: ${readResult.error}`);
|
|
2938
3026
|
const mimeType = readResult.mimeType ?? getMimeType(file_path);
|
|
2939
3027
|
if (!isTextMimeType(mimeType)) {
|
|
@@ -3017,7 +3105,11 @@ function createWriteFileTool(backend, options) {
|
|
|
3017
3105
|
const permission = await checkPermission(resolvedBackend, permissions, "write", input.file_path);
|
|
3018
3106
|
if (permission.error !== void 0) return toolError(runtime, "write_file", permission.error);
|
|
3019
3107
|
const { file_path, content } = input;
|
|
3020
|
-
const result = await resolvedBackend
|
|
3108
|
+
const result = await runBoundToTarget(resolvedBackend, permissions, permission.target, {
|
|
3109
|
+
create: true,
|
|
3110
|
+
describe: `write on ${permission.path}`,
|
|
3111
|
+
errorPrefix: "Error: "
|
|
3112
|
+
}, (real) => decidePathAccess(permissions, "write", real) === "deny", async () => resolvedBackend.write(permission.target, content));
|
|
3021
3113
|
if (result.error) return toolError(runtime, "write_file", result.error);
|
|
3022
3114
|
const message = new ToolMessage({
|
|
3023
3115
|
content: `Successfully wrote to '${file_path}'`,
|
|
@@ -3049,7 +3141,11 @@ function createEditFileTool(backend, options) {
|
|
|
3049
3141
|
const permission = await checkPermission(resolvedBackend, permissions, "write", input.file_path);
|
|
3050
3142
|
if (permission.error !== void 0) return toolError(runtime, "edit_file", permission.error);
|
|
3051
3143
|
const { file_path, old_string, new_string, replace_all = false } = input;
|
|
3052
|
-
const result = await resolvedBackend
|
|
3144
|
+
const result = await runBoundToTarget(resolvedBackend, permissions, permission.target, {
|
|
3145
|
+
create: false,
|
|
3146
|
+
describe: `write on ${permission.path}`,
|
|
3147
|
+
errorPrefix: "Error: "
|
|
3148
|
+
}, (real) => decidePathAccess(permissions, "write", real) === "deny", async () => resolvedBackend.edit(permission.target, old_string, new_string, replace_all));
|
|
3053
3149
|
if (result.error) return toolError(runtime, "edit_file", result.error);
|
|
3054
3150
|
const message = new ToolMessage({
|
|
3055
3151
|
content: `Successfully replaced ${result.occurrences} occurrence(s) in '${file_path}'`,
|
|
@@ -3089,22 +3185,29 @@ function createDeleteTool(backend, options) {
|
|
|
3089
3185
|
const hasDescendants = await deleteTargetMayHaveDescendants(resolvedBackend, validatedPath, permissions.length > 0);
|
|
3090
3186
|
const denyingPatterns = findDeleteDenyPatterns(permissions, validatedPath, hasDescendants);
|
|
3091
3187
|
if (denyingPatterns.length > 0) return toolError(runtime, "delete", `Error: permission denied for write on ${validatedPath} (matches deny rule(s): ${denyingPatterns.join(", ")})`);
|
|
3188
|
+
let deleteTarget = validatedPath;
|
|
3092
3189
|
if (permissions.length > 0) {
|
|
3093
3190
|
let realTarget;
|
|
3094
3191
|
try {
|
|
3095
|
-
realTarget = await
|
|
3192
|
+
realTarget = await resolveParentRealPath(resolvedBackend, validatedPath);
|
|
3096
3193
|
} catch (error) {
|
|
3097
3194
|
return toolError(runtime, "delete", `Error: ${getErrorMessage$1(error)}`);
|
|
3098
3195
|
}
|
|
3196
|
+
if (crossesRoute(resolvedBackend, validatedPath, realTarget)) return toolError(runtime, "delete", `Error: ${validatedPath} resolves to ${realTarget}, which is served by a different backend`);
|
|
3099
3197
|
if (realTarget !== validatedPath) {
|
|
3100
3198
|
if (findDeleteDenyPatterns(permissions, realTarget, hasDescendants).length > 0) return toolError(runtime, "delete", `Error: permission denied for write on ${validatedPath} (resolves to ${realTarget})`);
|
|
3101
3199
|
}
|
|
3200
|
+
deleteTarget = realTarget;
|
|
3102
3201
|
}
|
|
3103
3202
|
if (!supportsDelete(resolvedBackend)) return toolError(runtime, "delete", `Error: deletion is not available for '${validatedPath}'.`);
|
|
3104
|
-
const result = await resolvedBackend
|
|
3203
|
+
const result = await runBoundToTarget(resolvedBackend, permissions, deleteTarget, {
|
|
3204
|
+
create: false,
|
|
3205
|
+
describe: `write on ${validatedPath}`,
|
|
3206
|
+
errorPrefix: "Error: "
|
|
3207
|
+
}, (real) => findDeleteDenyPatterns(permissions, real, hasDescendants).length > 0, async () => resolvedBackend.delete(deleteTarget));
|
|
3105
3208
|
if (result.error) return toolError(runtime, "delete", result.error);
|
|
3106
3209
|
const message = new ToolMessage({
|
|
3107
|
-
content: `Deleted ${result.path
|
|
3210
|
+
content: `Deleted ${result.path === void 0 || result.path === deleteTarget ? validatedPath : result.path}`,
|
|
3108
3211
|
tool_call_id: runtime.toolCall?.id,
|
|
3109
3212
|
name: "delete",
|
|
3110
3213
|
metadata: result.metadata
|
|
@@ -4540,7 +4643,7 @@ const INVALID_TOOL_MESSAGE_BLOCK_TYPES = [
|
|
|
4540
4643
|
/**
|
|
4541
4644
|
* Create Command with filtered state update from subagent result
|
|
4542
4645
|
*/
|
|
4543
|
-
function returnCommandWithStateUpdate(result, toolCallId) {
|
|
4646
|
+
function returnCommandWithStateUpdate(result, toolCallId, checkpointNs) {
|
|
4544
4647
|
const stateUpdate = filterStateForSubagent(result);
|
|
4545
4648
|
let content;
|
|
4546
4649
|
const refusal = refusalIn(result.messages?.at(-1));
|
|
@@ -4564,10 +4667,66 @@ function returnCommandWithStateUpdate(result, toolCallId) {
|
|
|
4564
4667
|
messages: [new ToolMessage({
|
|
4565
4668
|
content,
|
|
4566
4669
|
tool_call_id: toolCallId,
|
|
4567
|
-
name: "task"
|
|
4670
|
+
name: "task",
|
|
4671
|
+
...checkpointNs ? { artifact: { checkpoint_ns: checkpointNs } } : {}
|
|
4568
4672
|
})]
|
|
4569
4673
|
} });
|
|
4570
4674
|
}
|
|
4675
|
+
function isCompiledGraph(value) {
|
|
4676
|
+
return typeof value === "object" && value !== null && "lg_is_pregel" in value && value.lg_is_pregel === true;
|
|
4677
|
+
}
|
|
4678
|
+
/**
|
|
4679
|
+
* Whether `value` is a plain `RunnableBinding`, such as `withListeners`
|
|
4680
|
+
* returns, and not a subclass. A subclass can override `invoke` with behaviour
|
|
4681
|
+
* that streaming its inner graph would skip, such as the `RunnableRetry` from
|
|
4682
|
+
* `withRetry`.
|
|
4683
|
+
*/
|
|
4684
|
+
function isPlainRunnableBinding(value) {
|
|
4685
|
+
return value?.constructor === RunnableBinding;
|
|
4686
|
+
}
|
|
4687
|
+
/**
|
|
4688
|
+
* The compiled graph behind a subagent: the subagent itself, the `graph` of a
|
|
4689
|
+
* `createAgent` agent, or the graph a plain `RunnableBinding` wraps.
|
|
4690
|
+
* `undefined` for any other runnable.
|
|
4691
|
+
*/
|
|
4692
|
+
function getCompiledGraph(subagent) {
|
|
4693
|
+
const unwrapped = isPlainRunnableBinding(subagent) ? subagent.bound : subagent;
|
|
4694
|
+
if (isCompiledGraph(unwrapped)) return unwrapped;
|
|
4695
|
+
const graph = unwrapped.graph;
|
|
4696
|
+
return isCompiledGraph(graph) ? graph : void 0;
|
|
4697
|
+
}
|
|
4698
|
+
/**
|
|
4699
|
+
* Invoke a subagent, returning its final state and the namespace it
|
|
4700
|
+
* checkpointed under.
|
|
4701
|
+
*
|
|
4702
|
+
* A compiled subagent is streamed rather than invoked so its checkpoint events
|
|
4703
|
+
* report the namespace it saved under. LangGraph changes that namespace from
|
|
4704
|
+
* the `task` call's own for a second run in the same step (`<namespace>|1`)
|
|
4705
|
+
* and for `checkpointer: true` (task ids removed). No checkpoint event means
|
|
4706
|
+
* nothing was saved. Any other runnable is invoked and assumed to save under
|
|
4707
|
+
* the `task` call's namespace.
|
|
4708
|
+
*/
|
|
4709
|
+
async function runSubagent(subagent, state, config) {
|
|
4710
|
+
const graph = getCompiledGraph(subagent);
|
|
4711
|
+
if (graph === void 0) return {
|
|
4712
|
+
result: await subagent.invoke(state, config),
|
|
4713
|
+
checkpointNs: config.configurable?.checkpoint_ns
|
|
4714
|
+
};
|
|
4715
|
+
let result = {};
|
|
4716
|
+
let checkpointNs;
|
|
4717
|
+
const options = {
|
|
4718
|
+
...config,
|
|
4719
|
+
streamMode: ["values", "checkpoints"],
|
|
4720
|
+
outputKeys: graph.outputChannels
|
|
4721
|
+
};
|
|
4722
|
+
const stream = await subagent.stream(state, options);
|
|
4723
|
+
for await (const [mode, chunk] of stream) if (mode === "values") result = chunk;
|
|
4724
|
+
else checkpointNs ??= chunk.config.configurable?.checkpoint_ns;
|
|
4725
|
+
return {
|
|
4726
|
+
result,
|
|
4727
|
+
checkpointNs
|
|
4728
|
+
};
|
|
4729
|
+
}
|
|
4571
4730
|
/** Drop the trailing in-flight AIMessage with unresolved tool_calls. */
|
|
4572
4731
|
function stripInFlightAIMessage(messages) {
|
|
4573
4732
|
const last = messages.at(-1);
|
|
@@ -4755,8 +4914,9 @@ function createTaskTool(options) {
|
|
|
4755
4914
|
}
|
|
4756
4915
|
};
|
|
4757
4916
|
let result;
|
|
4917
|
+
let checkpointNs;
|
|
4758
4918
|
try {
|
|
4759
|
-
result = await subagent
|
|
4919
|
+
({result, checkpointNs} = await runSubagent(subagent, subagentState, subagentConfig));
|
|
4760
4920
|
} catch (error) {
|
|
4761
4921
|
const notice = refusalNoticeFor(error);
|
|
4762
4922
|
if (notice === void 0) throw error;
|
|
@@ -4776,7 +4936,7 @@ function createTaskTool(options) {
|
|
|
4776
4936
|
}
|
|
4777
4937
|
return content;
|
|
4778
4938
|
}
|
|
4779
|
-
return returnCommandWithStateUpdate(result, config.toolCall.id);
|
|
4939
|
+
return returnCommandWithStateUpdate(result, config.toolCall.id, checkpointNs);
|
|
4780
4940
|
}
|
|
4781
4941
|
const taskToolSchema = z.object({
|
|
4782
4942
|
description: z.string().describe("The task to execute with the selected agent"),
|
|
@@ -10901,6 +11061,6 @@ var LangSmithSandbox = class LangSmithSandbox extends BaseSandbox {
|
|
|
10901
11061
|
});
|
|
10902
11062
|
}
|
|
10903
11063
|
};
|
|
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,
|
|
11064
|
+
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, setPin 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, setRealpath as ot, 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 };
|
|
10905
11065
|
|
|
10906
|
-
//# sourceMappingURL=langsmith-
|
|
11066
|
+
//# sourceMappingURL=langsmith-CH6GPPud.js.map
|