@axiom-lattice/core 2.1.22 → 2.1.23
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/index.js +36 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5331,7 +5331,7 @@ function returnCommandWithStateUpdate(result, toolCallId) {
|
|
|
5331
5331
|
...stateUpdate,
|
|
5332
5332
|
messages: [
|
|
5333
5333
|
new import_langchain37.ToolMessage({
|
|
5334
|
-
content: lastMessage?.content || "Task
|
|
5334
|
+
content: lastMessage?.content || "Task Failed to complete",
|
|
5335
5335
|
tool_call_id: toolCallId,
|
|
5336
5336
|
name: "task"
|
|
5337
5337
|
})
|
|
@@ -5412,28 +5412,42 @@ function createTaskTool(options) {
|
|
|
5412
5412
|
return (0, import_langchain37.tool)(
|
|
5413
5413
|
async (input, config) => {
|
|
5414
5414
|
const { description, subagent_type } = input;
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5415
|
+
try {
|
|
5416
|
+
if (!(subagent_type in subagentGraphs)) {
|
|
5417
|
+
const allowedTypes = Object.keys(subagentGraphs).map((k) => `\`${k}\``).join(", ");
|
|
5418
|
+
throw new Error(
|
|
5419
|
+
`Error: invoked agent of type ${subagent_type}, the only allowed types are ${allowedTypes}`
|
|
5420
|
+
);
|
|
5421
|
+
}
|
|
5422
|
+
const subagent = subagentGraphs[subagent_type];
|
|
5423
|
+
const currentState = (0, import_langgraph6.getCurrentTaskInput)();
|
|
5424
|
+
const subagentState = filterStateForSubagent(currentState);
|
|
5425
|
+
subagentState.messages = [new import_messages.HumanMessage({ content: description })];
|
|
5426
|
+
const subagent_thread_id = config.configurable?.thread_id + "____" + subagent_type + "_" + config.toolCall.id;
|
|
5427
|
+
console.log(subagent_thread_id);
|
|
5428
|
+
const workerResult = await agentWorkerGraph.invoke({
|
|
5429
|
+
assistant_id: subagent_type,
|
|
5430
|
+
thread_id: subagent_thread_id,
|
|
5431
|
+
input: { ...subagentState, message: description }
|
|
5432
|
+
});
|
|
5433
|
+
const result = workerResult.finalState?.values;
|
|
5434
|
+
if (!config.toolCall?.id) {
|
|
5435
|
+
throw new Error("Tool call ID is required for subagent invocation");
|
|
5436
|
+
}
|
|
5437
|
+
return returnCommandWithStateUpdate(result, config.toolCall.id);
|
|
5438
|
+
} catch (error) {
|
|
5439
|
+
return new import_langgraph6.Command({
|
|
5440
|
+
update: {
|
|
5441
|
+
messages: [
|
|
5442
|
+
new import_langchain37.ToolMessage({
|
|
5443
|
+
content: error instanceof Error ? error.message : "Task Failed to complete",
|
|
5444
|
+
tool_call_id: config.toolCall.id,
|
|
5445
|
+
name: "task"
|
|
5446
|
+
})
|
|
5447
|
+
]
|
|
5448
|
+
}
|
|
5449
|
+
});
|
|
5435
5450
|
}
|
|
5436
|
-
return returnCommandWithStateUpdate(result, config.toolCall.id);
|
|
5437
5451
|
},
|
|
5438
5452
|
{
|
|
5439
5453
|
name: "task",
|