@ai-sdk/harness-deepagents 1.0.71 → 1.0.73
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/CHANGELOG.md +21 -0
- package/dist/bridge/index.mjs +229 -64
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +171 -76
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/bridge/create-emit-stream-event.ts +4 -0
- package/src/bridge/index.ts +54 -1
- package/src/deepagents-auth.ts +58 -2
- package/src/deepagents-bootstrap.ts +87 -0
- package/src/deepagents-harness.ts +94 -94
package/dist/bridge/index.mjs
CHANGED
|
@@ -57,7 +57,6 @@ async function runBridge(options) {
|
|
|
57
57
|
let currentBoundPort = 0;
|
|
58
58
|
let currentTurnState = "init";
|
|
59
59
|
let activeSocket;
|
|
60
|
-
let activeSocketReadyForLiveEvents = false;
|
|
61
60
|
let isFirstTurn = true;
|
|
62
61
|
let turnAbort;
|
|
63
62
|
let currentUserMessages;
|
|
@@ -141,14 +140,6 @@ async function runBridge(options) {
|
|
|
141
140
|
} catch {
|
|
142
141
|
}
|
|
143
142
|
};
|
|
144
|
-
const sendControl = (msg) => {
|
|
145
|
-
if (activeSocket?.readyState === WS_OPEN) {
|
|
146
|
-
try {
|
|
147
|
-
activeSocket.send(JSON.stringify(msg));
|
|
148
|
-
} catch {
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
143
|
const emit = (event) => {
|
|
153
144
|
const seq = ++seqCounter;
|
|
154
145
|
const line = JSON.stringify({ ...event, seq });
|
|
@@ -156,7 +147,7 @@ async function runBridge(options) {
|
|
|
156
147
|
diskBuffer += `${line}
|
|
157
148
|
`;
|
|
158
149
|
scheduleEventFlush();
|
|
159
|
-
if (
|
|
150
|
+
if (activeSocket?.readyState === WS_OPEN) {
|
|
160
151
|
try {
|
|
161
152
|
activeSocket.send(line);
|
|
162
153
|
} catch {
|
|
@@ -259,8 +250,7 @@ async function runBridge(options) {
|
|
|
259
250
|
const handleInbound = async (msg, ws) => {
|
|
260
251
|
switch (msg.type) {
|
|
261
252
|
case "start": {
|
|
262
|
-
|
|
263
|
-
activeSocketReadyForLiveEvents = true;
|
|
253
|
+
activeSocket = ws;
|
|
264
254
|
const firstTurn = isFirstTurn;
|
|
265
255
|
isFirstTurn = false;
|
|
266
256
|
eventLog = [];
|
|
@@ -340,9 +330,8 @@ async function runBridge(options) {
|
|
|
340
330
|
turnAbort?.abort();
|
|
341
331
|
return;
|
|
342
332
|
case "resume":
|
|
343
|
-
|
|
333
|
+
activeSocket = ws;
|
|
344
334
|
replay(ws, msg.lastSeenEventId);
|
|
345
|
-
activeSocketReadyForLiveEvents = true;
|
|
346
335
|
return;
|
|
347
336
|
case "destroy":
|
|
348
337
|
currentTurnState = "done";
|
|
@@ -354,7 +343,7 @@ async function runBridge(options) {
|
|
|
354
343
|
currentTurnState = "done";
|
|
355
344
|
void writeBridgeMeta("done");
|
|
356
345
|
const data = await onStop?.() ?? {};
|
|
357
|
-
sendControl({ type: "bridge-stop", data });
|
|
346
|
+
sendControl(ws, { type: "bridge-stop", data });
|
|
358
347
|
drainThenExit(ws, 1e3, "stop");
|
|
359
348
|
return;
|
|
360
349
|
}
|
|
@@ -407,9 +396,7 @@ async function runBridge(options) {
|
|
|
407
396
|
ws.close(1008, "unauthorized");
|
|
408
397
|
return;
|
|
409
398
|
}
|
|
410
|
-
|
|
411
|
-
activeSocketReadyForLiveEvents = false;
|
|
412
|
-
sendControl({
|
|
399
|
+
sendControl(ws, {
|
|
413
400
|
type: "bridge-hello",
|
|
414
401
|
state: currentTurnState,
|
|
415
402
|
lastSeq: seqCounter
|
|
@@ -420,7 +407,7 @@ async function runBridge(options) {
|
|
|
420
407
|
const text = typeof raw === "string" ? raw : Buffer.from(raw).toString("utf8");
|
|
421
408
|
parsed = JSON.parse(text);
|
|
422
409
|
} catch (err) {
|
|
423
|
-
sendControl({
|
|
410
|
+
sendControl(ws, {
|
|
424
411
|
type: "error",
|
|
425
412
|
error: `protocol parse error: ${err.message}`
|
|
426
413
|
});
|
|
@@ -431,7 +418,6 @@ async function runBridge(options) {
|
|
|
431
418
|
ws.on("close", () => {
|
|
432
419
|
if (activeSocket === ws) {
|
|
433
420
|
activeSocket = void 0;
|
|
434
|
-
activeSocketReadyForLiveEvents = false;
|
|
435
421
|
}
|
|
436
422
|
});
|
|
437
423
|
ws.on("error", () => {
|
|
@@ -458,6 +444,14 @@ async function runBridge(options) {
|
|
|
458
444
|
})
|
|
459
445
|
};
|
|
460
446
|
}
|
|
447
|
+
function sendControl(socket, message) {
|
|
448
|
+
if (socket?.readyState === WS_OPEN) {
|
|
449
|
+
try {
|
|
450
|
+
socket.send(JSON.stringify(message));
|
|
451
|
+
} catch {
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
461
455
|
function serialiseError(err) {
|
|
462
456
|
if (err instanceof Error) {
|
|
463
457
|
return { name: err.name, message: err.message, stack: err.stack };
|
|
@@ -474,7 +468,7 @@ import {
|
|
|
474
468
|
} from "@langchain/mcp-adapters";
|
|
475
469
|
import { createDeepAgent } from "deepagents";
|
|
476
470
|
|
|
477
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
471
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/chat_models/universal.js
|
|
478
472
|
import { BaseChatModel } from "@langchain/core/language_models/chat_models";
|
|
479
473
|
import { RunnableBinding, ensureConfig } from "@langchain/core/runnables";
|
|
480
474
|
import { AsyncGeneratorWithSetup, IterableReadableStream } from "@langchain/core/utils/stream";
|
|
@@ -564,33 +558,171 @@ var MODEL_PROVIDER_CONFIG = {
|
|
|
564
558
|
};
|
|
565
559
|
var SUPPORTED_PROVIDERS = Object.keys(MODEL_PROVIDER_CONFIG);
|
|
566
560
|
|
|
567
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
561
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/tools/headless.js
|
|
568
562
|
import { tool } from "@langchain/core/tools";
|
|
569
563
|
|
|
570
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
564
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/errors.js
|
|
571
565
|
import { isGraphBubbleUp } from "@langchain/langgraph";
|
|
566
|
+
var StructuredOutputParsingError = class extends Error {
|
|
567
|
+
toolName;
|
|
568
|
+
errors;
|
|
569
|
+
constructor(toolName, errors) {
|
|
570
|
+
super(`Failed to parse structured output for tool '${toolName}':${errors.map((e) => `
|
|
571
|
+
- ${e}`).join("")}.`);
|
|
572
|
+
this.toolName = toolName;
|
|
573
|
+
this.errors = errors;
|
|
574
|
+
}
|
|
575
|
+
};
|
|
572
576
|
|
|
573
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
577
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/model.js
|
|
578
|
+
function isBaseChatModel(model) {
|
|
579
|
+
return "invoke" in model && typeof model.invoke === "function" && "_streamResponseChunks" in model;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/responses.js
|
|
574
583
|
import { isInteropZodObject, isInteropZodSchema } from "@langchain/core/utils/types";
|
|
575
584
|
import { Validator, toJsonSchema } from "@langchain/core/utils/json_schema";
|
|
576
585
|
import { isSerializableSchema } from "@langchain/core/utils/standard_schema";
|
|
586
|
+
var PROVIDER_STRATEGY_DEFAULT_STRICT = true;
|
|
587
|
+
var bindingIdentifier = 0;
|
|
588
|
+
var ToolStrategy = class ToolStrategy2 {
|
|
589
|
+
constructor(schema, tool4, options) {
|
|
590
|
+
this.schema = schema;
|
|
591
|
+
this.tool = tool4;
|
|
592
|
+
this.options = options;
|
|
593
|
+
}
|
|
594
|
+
get name() {
|
|
595
|
+
return this.tool.function.name;
|
|
596
|
+
}
|
|
597
|
+
static fromSchema(schema, outputOptions) {
|
|
598
|
+
function getFunctionName(name) {
|
|
599
|
+
return name ?? `extract-${++bindingIdentifier}`;
|
|
600
|
+
}
|
|
601
|
+
if (isSerializableSchema(schema) || isInteropZodSchema(schema)) {
|
|
602
|
+
const asJsonSchema = toJsonSchema(schema);
|
|
603
|
+
return new ToolStrategy2(asJsonSchema, {
|
|
604
|
+
type: "function",
|
|
605
|
+
function: {
|
|
606
|
+
name: getFunctionName(asJsonSchema.title),
|
|
607
|
+
strict: false,
|
|
608
|
+
description: asJsonSchema.description ?? "Tool for extracting structured output from the model's response.",
|
|
609
|
+
parameters: asJsonSchema
|
|
610
|
+
}
|
|
611
|
+
}, outputOptions);
|
|
612
|
+
}
|
|
613
|
+
let functionDefinition;
|
|
614
|
+
if (typeof schema.name === "string" && typeof schema.parameters === "object" && schema.parameters != null) functionDefinition = schema;
|
|
615
|
+
else functionDefinition = {
|
|
616
|
+
name: getFunctionName(schema.title),
|
|
617
|
+
description: schema.description ?? "",
|
|
618
|
+
parameters: schema.schema || schema
|
|
619
|
+
};
|
|
620
|
+
return new ToolStrategy2(toJsonSchema(schema), {
|
|
621
|
+
type: "function",
|
|
622
|
+
function: functionDefinition
|
|
623
|
+
}, outputOptions);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Parse tool arguments according to the schema.
|
|
627
|
+
*
|
|
628
|
+
* @throws {StructuredOutputParsingError} if the response is not valid
|
|
629
|
+
* @param toolArgs - The arguments from the tool call
|
|
630
|
+
* @returns The parsed response according to the schema type
|
|
631
|
+
*/
|
|
632
|
+
parse(toolArgs) {
|
|
633
|
+
const result = new Validator(this.schema).validate(toolArgs);
|
|
634
|
+
if (!result.valid) throw new StructuredOutputParsingError(this.name, result.errors.map((e) => e.error));
|
|
635
|
+
return toolArgs;
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
var ProviderStrategy = class ProviderStrategy2 {
|
|
639
|
+
_schemaType;
|
|
640
|
+
/**
|
|
641
|
+
* The schema to use for the provider strategy
|
|
642
|
+
*/
|
|
643
|
+
schema;
|
|
644
|
+
/**
|
|
645
|
+
* Whether to use strict mode for the provider strategy
|
|
646
|
+
*/
|
|
647
|
+
strict;
|
|
648
|
+
constructor(schemaOrOptions, strict) {
|
|
649
|
+
if ("schema" in schemaOrOptions && typeof schemaOrOptions.schema === "object" && schemaOrOptions.schema !== null && !("type" in schemaOrOptions)) {
|
|
650
|
+
const options = schemaOrOptions;
|
|
651
|
+
this.schema = options.schema;
|
|
652
|
+
this.strict = options.strict ?? PROVIDER_STRATEGY_DEFAULT_STRICT;
|
|
653
|
+
} else {
|
|
654
|
+
this.schema = schemaOrOptions;
|
|
655
|
+
this.strict = strict ?? PROVIDER_STRATEGY_DEFAULT_STRICT;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
static fromSchema(schema, strict) {
|
|
659
|
+
return new ProviderStrategy2(toJsonSchema(schema), strict);
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Parse tool arguments according to the schema. If the response is not valid, return undefined.
|
|
663
|
+
*
|
|
664
|
+
* @param response - The AI message response to parse
|
|
665
|
+
* @returns The parsed response according to the schema type
|
|
666
|
+
*/
|
|
667
|
+
parse(response) {
|
|
668
|
+
let textContent;
|
|
669
|
+
if (typeof response.content === "string") textContent = response.content;
|
|
670
|
+
else if (Array.isArray(response.content)) {
|
|
671
|
+
for (const block of response.content) if (typeof block === "object" && block !== null && "type" in block && block.type === "text" && "text" in block && typeof block.text === "string") {
|
|
672
|
+
textContent = block.text;
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (!textContent || textContent === "") return;
|
|
677
|
+
try {
|
|
678
|
+
const content = JSON.parse(textContent);
|
|
679
|
+
if (!new Validator(this.schema).validate(content).valid) return;
|
|
680
|
+
return content;
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
function transformResponseFormat(responseFormat, options, model) {
|
|
686
|
+
if (!responseFormat) return [];
|
|
687
|
+
if (typeof responseFormat === "object" && responseFormat !== null && "__responseFormatUndefined" in responseFormat) return [];
|
|
688
|
+
if (Array.isArray(responseFormat)) {
|
|
689
|
+
if (responseFormat.every((item) => item instanceof ToolStrategy || item instanceof ProviderStrategy)) return responseFormat;
|
|
690
|
+
if (responseFormat.every((item) => isSerializableSchema(item))) return responseFormat.map((item) => ToolStrategy.fromSchema(item, options));
|
|
691
|
+
if (responseFormat.every((item) => isInteropZodObject(item))) return responseFormat.map((item) => ToolStrategy.fromSchema(item, options));
|
|
692
|
+
if (responseFormat.every((item) => typeof item === "object" && item !== null && !isInteropZodObject(item) && !isSerializableSchema(item))) return responseFormat.map((item) => ToolStrategy.fromSchema(item, options));
|
|
693
|
+
throw new Error("Invalid response format: list contains mixed types.\nAll items must be either InteropZodObject, Standard Schema, or plain JSON schema objects.");
|
|
694
|
+
}
|
|
695
|
+
if (responseFormat instanceof ToolStrategy || responseFormat instanceof ProviderStrategy) return [responseFormat];
|
|
696
|
+
const useProviderStrategy = hasSupportForJsonSchemaOutput(model);
|
|
697
|
+
if (isSerializableSchema(responseFormat)) return useProviderStrategy ? [ProviderStrategy.fromSchema(responseFormat)] : [ToolStrategy.fromSchema(responseFormat, options)];
|
|
698
|
+
if (isInteropZodObject(responseFormat)) return useProviderStrategy ? [ProviderStrategy.fromSchema(responseFormat)] : [ToolStrategy.fromSchema(responseFormat, options)];
|
|
699
|
+
if (typeof responseFormat === "object" && responseFormat !== null && "properties" in responseFormat) return useProviderStrategy ? [ProviderStrategy.fromSchema(responseFormat)] : [ToolStrategy.fromSchema(responseFormat, options)];
|
|
700
|
+
throw new Error(`Invalid response format: ${String(responseFormat)}`);
|
|
701
|
+
}
|
|
702
|
+
function toolStrategy(responseFormat, options) {
|
|
703
|
+
return transformResponseFormat(responseFormat, options);
|
|
704
|
+
}
|
|
705
|
+
function hasSupportForJsonSchemaOutput(model) {
|
|
706
|
+
if (!model || !isBaseChatModel(model) || !("profile" in model) || typeof model.profile !== "object" || !model.profile) return false;
|
|
707
|
+
return "structuredOutput" in model.profile && model.profile.structuredOutput === true;
|
|
708
|
+
}
|
|
577
709
|
|
|
578
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
710
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/utils.js
|
|
579
711
|
import { AIMessage, ToolMessage } from "@langchain/core/messages";
|
|
580
712
|
import { isLangChainTool } from "@langchain/core/tools";
|
|
581
713
|
import { convertToOpenAITool } from "@langchain/core/utils/function_calling";
|
|
582
714
|
|
|
583
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
715
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/transformers/tool-call.js
|
|
584
716
|
import { ToolMessage as ToolMessage2 } from "@langchain/core/messages";
|
|
585
717
|
import { StreamChannel } from "@langchain/langgraph";
|
|
586
718
|
|
|
587
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
719
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/transformers/subagent.js
|
|
588
720
|
import { StreamChannel as StreamChannel2, createMessagesTransformer } from "@langchain/langgraph";
|
|
589
721
|
|
|
590
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
722
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/types.js
|
|
591
723
|
var MIDDLEWARE_BRAND = /* @__PURE__ */ Symbol.for("AgentMiddleware");
|
|
592
724
|
|
|
593
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
725
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware.js
|
|
594
726
|
function createMiddleware(config) {
|
|
595
727
|
return {
|
|
596
728
|
[MIDDLEWARE_BRAND]: true,
|
|
@@ -608,25 +740,25 @@ function createMiddleware(config) {
|
|
|
608
740
|
};
|
|
609
741
|
}
|
|
610
742
|
|
|
611
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
743
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/tests/utils.js
|
|
612
744
|
import { AIMessage as AIMessage2, HumanMessage } from "@langchain/core/messages";
|
|
613
745
|
import { BaseChatModel as BaseChatModel2 } from "@langchain/core/language_models/chat_models";
|
|
614
746
|
import { RunnableLambda } from "@langchain/core/runnables";
|
|
615
747
|
import "@langchain/core/tools";
|
|
616
748
|
|
|
617
|
-
// ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.1.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@
|
|
749
|
+
// ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.1.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@o_6f3022e4f3a119ed905d664b3d3736ca/node_modules/@langchain/langgraph-checkpoint/dist/id.js
|
|
618
750
|
import { v5, v6 } from "@langchain/core/utils/uuid";
|
|
619
751
|
|
|
620
|
-
// ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.1.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@
|
|
752
|
+
// ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.1.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@o_6f3022e4f3a119ed905d664b3d3736ca/node_modules/@langchain/langgraph-checkpoint/dist/serde/types.js
|
|
621
753
|
var ERROR = "__error__";
|
|
622
754
|
var SCHEDULED = "__scheduled__";
|
|
623
755
|
var INTERRUPT = "__interrupt__";
|
|
624
756
|
var RESUME = "__resume__";
|
|
625
757
|
|
|
626
|
-
// ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.1.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@
|
|
758
|
+
// ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.1.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@o_6f3022e4f3a119ed905d664b3d3736ca/node_modules/@langchain/langgraph-checkpoint/dist/serde/jsonplus.js
|
|
627
759
|
import { load } from "@langchain/core/load";
|
|
628
760
|
|
|
629
|
-
// ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.1.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@
|
|
761
|
+
// ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.1.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@o_6f3022e4f3a119ed905d664b3d3736ca/node_modules/@langchain/langgraph-checkpoint/dist/base.js
|
|
630
762
|
var WRITES_IDX_MAP = {
|
|
631
763
|
[ERROR]: -1,
|
|
632
764
|
[SCHEDULED]: -2,
|
|
@@ -634,52 +766,52 @@ var WRITES_IDX_MAP = {
|
|
|
634
766
|
[RESUME]: -4
|
|
635
767
|
};
|
|
636
768
|
|
|
637
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
769
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/tests/utils.js
|
|
638
770
|
import "zod/v3";
|
|
639
771
|
|
|
640
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
772
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/annotation.js
|
|
641
773
|
import { MessagesValue, ReducedValue, StateSchema, UntrackedValue } from "@langchain/langgraph";
|
|
642
774
|
import { schemaMetaRegistry } from "@langchain/langgraph/zod";
|
|
643
775
|
import { getInteropZodObjectShape, isInteropZodObject as isInteropZodObject2, isZodSchemaV4 } from "@langchain/core/utils/types";
|
|
644
776
|
|
|
645
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
777
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/utils.js
|
|
646
778
|
import { AIMessage as AIMessage3, AIMessageChunk, SystemMessage, ToolMessage as ToolMessage3 } from "@langchain/core/messages";
|
|
647
779
|
import { Runnable, RunnableBinding as RunnableBinding2, RunnableSequence } from "@langchain/core/runnables";
|
|
648
780
|
import { StateSchema as StateSchema2, isCommand } from "@langchain/langgraph";
|
|
649
781
|
import { interopParse, isInteropZodSchema as isInteropZodSchema2 } from "@langchain/core/utils/types";
|
|
650
782
|
|
|
651
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
783
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/nodes/utils.js
|
|
652
784
|
import { END, ReducedValue as ReducedValue2, StateSchema as StateSchema3 } from "@langchain/langgraph";
|
|
653
785
|
import { getInteropZodObjectShape as getInteropZodObjectShape2, interopSafeParseAsync, interopZodObjectMakeFieldsOptional, interopZodObjectPartial, isInteropZodObject as isInteropZodObject3, isZodSchemaV4 as isZodSchemaV42 } from "@langchain/core/utils/types";
|
|
654
786
|
import { z } from "zod/v4";
|
|
655
787
|
|
|
656
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
788
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/RunnableCallable.js
|
|
657
789
|
import { Runnable as Runnable2, mergeConfigs } from "@langchain/core/runnables";
|
|
658
790
|
import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
|
|
659
791
|
|
|
660
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
792
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/withAgentName.js
|
|
661
793
|
import { RunnableLambda as RunnableLambda2, RunnableSequence as RunnableSequence2 } from "@langchain/core/runnables";
|
|
662
794
|
|
|
663
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
795
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/nodes/AgentNode.js
|
|
664
796
|
import { AIMessage as AIMessage4, SystemMessage as SystemMessage2, ToolMessage as ToolMessage4 } from "@langchain/core/messages";
|
|
665
797
|
import { raceWithSignal } from "@langchain/core/runnables";
|
|
666
798
|
import { Command, isCommand as isCommand2 } from "@langchain/langgraph";
|
|
667
799
|
import { getSchemaDescription, interopParse as interopParse2 } from "@langchain/core/utils/types";
|
|
668
800
|
|
|
669
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
801
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/nodes/ToolNode.js
|
|
670
802
|
import { AIMessage as AIMessage5, BaseMessage, ToolMessage as ToolMessage5 } from "@langchain/core/messages";
|
|
671
803
|
import { ToolInputParsingException } from "@langchain/core/tools";
|
|
672
804
|
import { Command as Command2, Send, isCommand as isCommand3, isGraphInterrupt } from "@langchain/langgraph";
|
|
673
805
|
|
|
674
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
806
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/nodes/middleware.js
|
|
675
807
|
import { getInteropZodObjectShape as getInteropZodObjectShape3, interopParse as interopParse3, isInteropZodObject as isInteropZodObject4 } from "@langchain/core/utils/types";
|
|
676
808
|
|
|
677
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
809
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/ReactAgent.js
|
|
678
810
|
import { AIMessage as AIMessage6, ToolMessage as ToolMessage6 } from "@langchain/core/messages";
|
|
679
811
|
import { mergeConfigs as mergeConfigs2 } from "@langchain/core/runnables";
|
|
680
812
|
import { Command as Command3, END as END2, START, Send as Send2, StateGraph } from "@langchain/langgraph";
|
|
681
813
|
|
|
682
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
814
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/hitl.js
|
|
683
815
|
import { AIMessage as AIMessage7, ToolMessage as ToolMessage7 } from "@langchain/core/messages";
|
|
684
816
|
import { interrupt } from "@langchain/langgraph";
|
|
685
817
|
import { interopParse as interopParse4 } from "@langchain/core/utils/types";
|
|
@@ -789,7 +921,7 @@ var contextSchema = z2.object({
|
|
|
789
921
|
descriptionPrefix: z2.string().default("Tool execution requires approval")
|
|
790
922
|
});
|
|
791
923
|
|
|
792
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
924
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/summarization.js
|
|
793
925
|
import { AIMessage as AIMessage8, HumanMessage as HumanMessage2, RemoveMessage, SystemMessage as SystemMessage3, ToolMessage as ToolMessage8, getBufferString, trimMessages } from "@langchain/core/messages";
|
|
794
926
|
import { mergeConfigs as mergeConfigs3, pickRunnableConfigKeys } from "@langchain/core/runnables";
|
|
795
927
|
import { REMOVE_ALL_MESSAGES } from "@langchain/langgraph";
|
|
@@ -916,10 +1048,10 @@ var contextSchema2 = z$1.object({
|
|
|
916
1048
|
messagesToKeep: z$1.number().optional()
|
|
917
1049
|
});
|
|
918
1050
|
|
|
919
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1051
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/dynamicSystemPrompt.js
|
|
920
1052
|
import { SystemMessage as SystemMessage4 } from "@langchain/core/messages";
|
|
921
1053
|
|
|
922
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1054
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/llmToolSelector.js
|
|
923
1055
|
import { HumanMessage as HumanMessage3 } from "@langchain/core/messages";
|
|
924
1056
|
import { mergeConfigs as mergeConfigs4, pickRunnableConfigKeys as pickRunnableConfigKeys2 } from "@langchain/core/runnables";
|
|
925
1057
|
import { z as z4 } from "zod/v3";
|
|
@@ -945,7 +1077,7 @@ var LLMToolSelectorOptionsSchema = z4.object({
|
|
|
945
1077
|
alwaysInclude: z4.array(z4.string()).optional()
|
|
946
1078
|
});
|
|
947
1079
|
|
|
948
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1080
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/pii.js
|
|
949
1081
|
import { AIMessage as AIMessage9, HumanMessage as HumanMessage4, ToolMessage as ToolMessage9 } from "@langchain/core/messages";
|
|
950
1082
|
import { z as z5 } from "zod/v3";
|
|
951
1083
|
import { sha256 } from "@langchain/core/utils/hash";
|
|
@@ -964,7 +1096,7 @@ var contextSchema3 = z5.object({
|
|
|
964
1096
|
applyToToolResults: z5.boolean().optional()
|
|
965
1097
|
});
|
|
966
1098
|
|
|
967
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1099
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/piiRedaction.js
|
|
968
1100
|
import { AIMessage as AIMessage10, HumanMessage as HumanMessage5, RemoveMessage as RemoveMessage2, SystemMessage as SystemMessage5, ToolMessage as ToolMessage10 } from "@langchain/core/messages";
|
|
969
1101
|
import { z as z6 } from "zod/v3";
|
|
970
1102
|
var contextSchema4 = z6.object({
|
|
@@ -975,10 +1107,10 @@ var contextSchema4 = z6.object({
|
|
|
975
1107
|
rules: z6.record(z6.string(), z6.instanceof(RegExp).describe("Regular expression pattern to match PII")).optional()
|
|
976
1108
|
});
|
|
977
1109
|
|
|
978
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1110
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/contextEditing.js
|
|
979
1111
|
import { AIMessage as AIMessage11, SystemMessage as SystemMessage6, ToolMessage as ToolMessage11 } from "@langchain/core/messages";
|
|
980
1112
|
|
|
981
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1113
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/toolCallLimit.js
|
|
982
1114
|
import { AIMessage as AIMessage12, ToolMessage as ToolMessage12 } from "@langchain/core/messages";
|
|
983
1115
|
import { z as z7 } from "zod/v4";
|
|
984
1116
|
import { z as z$12 } from "zod/v3";
|
|
@@ -1021,7 +1153,7 @@ var stateSchema = z$12.object({
|
|
|
1021
1153
|
runToolCallCount: z$12.record(z$12.string(), z$12.number()).default({})
|
|
1022
1154
|
});
|
|
1023
1155
|
|
|
1024
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1156
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/todoListMiddleware.js
|
|
1025
1157
|
import { AIMessage as AIMessage13, ToolMessage as ToolMessage13 } from "@langchain/core/messages";
|
|
1026
1158
|
import { tool as tool2 } from "@langchain/core/tools";
|
|
1027
1159
|
import { Command as Command4 } from "@langchain/langgraph";
|
|
@@ -1037,7 +1169,7 @@ var TodoSchema = z8.object({
|
|
|
1037
1169
|
});
|
|
1038
1170
|
var stateSchema2 = z8.object({ todos: z8.array(TodoSchema).default([]) });
|
|
1039
1171
|
|
|
1040
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1172
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/modelCallLimit.js
|
|
1041
1173
|
import { AIMessage as AIMessage14 } from "@langchain/core/messages";
|
|
1042
1174
|
import { z as z9 } from "zod/v3";
|
|
1043
1175
|
var contextSchema5 = z9.object({
|
|
@@ -1062,7 +1194,7 @@ var stateSchema3 = z9.object({
|
|
|
1062
1194
|
runModelCallCount: z9.number().default(0)
|
|
1063
1195
|
});
|
|
1064
1196
|
|
|
1065
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1197
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/constants.js
|
|
1066
1198
|
import { z as z10 } from "zod/v3";
|
|
1067
1199
|
var RetrySchema = z10.object({
|
|
1068
1200
|
/**
|
|
@@ -1098,10 +1230,10 @@ var RetrySchema = z10.object({
|
|
|
1098
1230
|
jitter: z10.boolean().default(true)
|
|
1099
1231
|
});
|
|
1100
1232
|
|
|
1101
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1233
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/error.js
|
|
1102
1234
|
import { z as z11 } from "zod/v4";
|
|
1103
1235
|
|
|
1104
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1236
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/modelRetry.js
|
|
1105
1237
|
import { AIMessage as AIMessage15 } from "@langchain/core/messages";
|
|
1106
1238
|
import { z as z12 } from "zod/v3";
|
|
1107
1239
|
var ModelRetryMiddlewareOptionsSchema = z12.object({
|
|
@@ -1120,7 +1252,7 @@ var ModelRetryMiddlewareOptionsSchema = z12.object({
|
|
|
1120
1252
|
]).default("continue")
|
|
1121
1253
|
}).merge(RetrySchema);
|
|
1122
1254
|
|
|
1123
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1255
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/toolRetry.js
|
|
1124
1256
|
import { ToolMessage as ToolMessage14 } from "@langchain/core/messages";
|
|
1125
1257
|
import { z as z13 } from "zod/v3";
|
|
1126
1258
|
var ToolRetryMiddlewareOptionsSchema = z13.object({
|
|
@@ -1155,16 +1287,16 @@ var ToolRetryMiddlewareOptionsSchema = z13.object({
|
|
|
1155
1287
|
]).default("continue")
|
|
1156
1288
|
}).merge(RetrySchema);
|
|
1157
1289
|
|
|
1158
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1290
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/toolEmulator.js
|
|
1159
1291
|
import { HumanMessage as HumanMessage6, ToolMessage as ToolMessage15 } from "@langchain/core/messages";
|
|
1160
1292
|
|
|
1161
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1293
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/providerToolSearch.js
|
|
1162
1294
|
import { isLangChainTool as isLangChainTool2 } from "@langchain/core/utils/function_calling";
|
|
1163
1295
|
|
|
1164
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1296
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/provider/openai/moderation.js
|
|
1165
1297
|
import { AIMessage as AIMessage16, HumanMessage as HumanMessage7, ToolMessage as ToolMessage16 } from "@langchain/core/messages";
|
|
1166
1298
|
|
|
1167
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1299
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/provider/anthropic/promptCaching.js
|
|
1168
1300
|
import { z as z14 } from "zod/v3";
|
|
1169
1301
|
var contextSchema6 = z14.object({
|
|
1170
1302
|
/**
|
|
@@ -1196,7 +1328,7 @@ var contextSchema6 = z14.object({
|
|
|
1196
1328
|
]).optional()
|
|
1197
1329
|
});
|
|
1198
1330
|
|
|
1199
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1331
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/agents/middleware/provider/aws/promptCaching.js
|
|
1200
1332
|
import { z as z15 } from "zod/v3";
|
|
1201
1333
|
var contextSchema7 = z15.object({
|
|
1202
1334
|
/**
|
|
@@ -1228,7 +1360,7 @@ var contextSchema7 = z15.object({
|
|
|
1228
1360
|
]).optional()
|
|
1229
1361
|
});
|
|
1230
1362
|
|
|
1231
|
-
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-
|
|
1363
|
+
// ../../node_modules/.pnpm/langchain@1.5.3_@langchain+core@1.2.3_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_a0dbd4fc7a66247dcd0e899a4ff3ea34/node_modules/langchain/dist/index.js
|
|
1232
1364
|
import { AIMessage as AIMessage17, AIMessageChunk as AIMessageChunk2, BaseMessage as BaseMessage2, BaseMessageChunk, HumanMessage as HumanMessage8, HumanMessageChunk, SystemMessage as SystemMessage7, SystemMessageChunk, ToolMessage as ToolMessage17, ToolMessageChunk, filterMessages, trimMessages as trimMessages2 } from "@langchain/core/messages";
|
|
1233
1365
|
import { DynamicStructuredTool, DynamicTool, StructuredTool, Tool } from "@langchain/core/tools";
|
|
1234
1366
|
import { context } from "@langchain/core/utils/context";
|
|
@@ -1321,6 +1453,7 @@ function createEmitStreamEvent({
|
|
|
1321
1453
|
configuredModel,
|
|
1322
1454
|
hostToolNames,
|
|
1323
1455
|
mcpToolNames: mcpToolNames2,
|
|
1456
|
+
structuredOutputToolNames = /* @__PURE__ */ new Set(),
|
|
1324
1457
|
emit
|
|
1325
1458
|
}) {
|
|
1326
1459
|
return (event) => {
|
|
@@ -1391,6 +1524,7 @@ function createEmitStreamEvent({
|
|
|
1391
1524
|
}
|
|
1392
1525
|
} else if (kind === "on_tool_start") {
|
|
1393
1526
|
const toolName = event.name ?? "unknown";
|
|
1527
|
+
if (structuredOutputToolNames.has(toolName)) return;
|
|
1394
1528
|
const runId = event.run_id ?? "";
|
|
1395
1529
|
if (!nested && !hostToolNames.has(toolName)) {
|
|
1396
1530
|
const isMcpTool = mcpToolNames2.has(toolName);
|
|
@@ -1415,6 +1549,7 @@ function createEmitStreamEvent({
|
|
|
1415
1549
|
}
|
|
1416
1550
|
} else if (kind === "on_tool_end") {
|
|
1417
1551
|
const toolName = event.name ?? "unknown";
|
|
1552
|
+
if (structuredOutputToolNames.has(toolName)) return;
|
|
1418
1553
|
const runId = event.run_id ?? "";
|
|
1419
1554
|
if (!nested && !hostToolNames.has(toolName)) {
|
|
1420
1555
|
const dynamic = state.dynamicToolRunIds.delete(runId);
|
|
@@ -1732,6 +1867,16 @@ var agent;
|
|
|
1732
1867
|
var currentTurn;
|
|
1733
1868
|
var mcpClient;
|
|
1734
1869
|
var mcpToolNames = /* @__PURE__ */ new Set();
|
|
1870
|
+
var currentResponseFormat;
|
|
1871
|
+
var responseFormatMiddleware = createMiddleware({
|
|
1872
|
+
name: "HarnessResponseFormat",
|
|
1873
|
+
wrapModelCall(request, handler) {
|
|
1874
|
+
return handler({
|
|
1875
|
+
...request,
|
|
1876
|
+
...currentResponseFormat == null ? {} : { responseFormat: currentResponseFormat }
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
});
|
|
1735
1880
|
function buildHostTools(toolSchemas) {
|
|
1736
1881
|
return (toolSchemas ?? []).map(
|
|
1737
1882
|
(schema) => tool3(
|
|
@@ -1759,6 +1904,7 @@ function buildHostTools(toolSchemas) {
|
|
|
1759
1904
|
}
|
|
1760
1905
|
async function runTurn(start, turn) {
|
|
1761
1906
|
currentTurn = turn;
|
|
1907
|
+
currentResponseFormat = start.responseFormat?.type === "json" && start.responseFormat.schema != null ? toolStrategy(start.responseFormat.schema) : void 0;
|
|
1762
1908
|
const emit = (event) => turn.emit(event);
|
|
1763
1909
|
const interruptOn = buildInterruptOn(
|
|
1764
1910
|
start.permissionMode,
|
|
@@ -1785,6 +1931,7 @@ async function runTurn(start, turn) {
|
|
|
1785
1931
|
}
|
|
1786
1932
|
);
|
|
1787
1933
|
const middleware = [
|
|
1934
|
+
responseFormatMiddleware,
|
|
1788
1935
|
...reasoningMiddleware ? [reasoningMiddleware] : [],
|
|
1789
1936
|
...builtinToolFilteringMiddleware ? [builtinToolFilteringMiddleware] : []
|
|
1790
1937
|
];
|
|
@@ -1819,6 +1966,9 @@ async function runTurn(start, turn) {
|
|
|
1819
1966
|
configuredModel: start.model,
|
|
1820
1967
|
hostToolNames,
|
|
1821
1968
|
mcpToolNames,
|
|
1969
|
+
structuredOutputToolNames: new Set(
|
|
1970
|
+
currentResponseFormat?.map((format) => format.name) ?? []
|
|
1971
|
+
),
|
|
1822
1972
|
emit
|
|
1823
1973
|
});
|
|
1824
1974
|
const config = {
|
|
@@ -1842,10 +1992,25 @@ async function runTurn(start, turn) {
|
|
|
1842
1992
|
let resumeInput = {
|
|
1843
1993
|
messages: [{ role: "user", content: start.prompt }]
|
|
1844
1994
|
};
|
|
1995
|
+
let emittedStructuredOutput = false;
|
|
1845
1996
|
while (true) {
|
|
1846
1997
|
const stream = await agent.streamEvents(resumeInput, config);
|
|
1847
1998
|
for await (const event of stream) {
|
|
1848
1999
|
emitStreamEvent(event);
|
|
2000
|
+
const streamEvent = event;
|
|
2001
|
+
const namespace = streamEvent.metadata?.langgraph_checkpoint_ns ?? "";
|
|
2002
|
+
const output = streamEvent.data?.output;
|
|
2003
|
+
if (!emittedStructuredOutput && streamEvent.event === "on_chain_end" && !namespace.includes("|") && output?.structuredResponse !== void 0) {
|
|
2004
|
+
const id = `structured-output-${randomUUID2()}`;
|
|
2005
|
+
emit({ type: "text-start", id });
|
|
2006
|
+
emit({
|
|
2007
|
+
type: "text-delta",
|
|
2008
|
+
id,
|
|
2009
|
+
delta: JSON.stringify(output.structuredResponse)
|
|
2010
|
+
});
|
|
2011
|
+
emit({ type: "text-end", id });
|
|
2012
|
+
emittedStructuredOutput = true;
|
|
2013
|
+
}
|
|
1849
2014
|
}
|
|
1850
2015
|
const actionRequests = await readPendingApprovals();
|
|
1851
2016
|
if (actionRequests.length === 0) break;
|