@axiom-lattice/core 2.1.97 → 2.1.98
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 +24 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9858,10 +9858,10 @@ import { tool as tool51 } from "langchain";
|
|
|
9858
9858
|
import z54 from "zod";
|
|
9859
9859
|
var questionSchema = z54.object({
|
|
9860
9860
|
question: z54.string().describe("The question text to ask the user"),
|
|
9861
|
-
options: z54.array(z54.string()).optional().default([]).describe("List of EXACT, selectable values. Maximum 3 options allowed. DO NOT include
|
|
9862
|
-
type: z54.enum(["single", "multiple", "file_upload"]).describe("
|
|
9861
|
+
options: z54.array(z54.string()).optional().default([]).describe("List of EXACT, selectable values. Maximum 3 options allowed. DO NOT include placeholder values like 'Other' or 'Enter manually'. For free-text with predefined choices, use allowOther=true (works with 'single' and 'multiple'). For pure free-text without choices, use type='input' instead. For file_upload and input, pass an empty array."),
|
|
9862
|
+
type: z54.enum(["single", "multiple", "file_upload", "input"]).describe("The question format. 'single' = pick one from options (default, see tool description for guidance). 'multiple' = pick several from options. 'input' = free-text field (only when options cannot express the answer). 'file_upload' = file picker."),
|
|
9863
9863
|
required: z54.boolean().optional().default(false).describe("Whether this question must be answered"),
|
|
9864
|
-
allowOther: z54.boolean().optional().default(true).describe("Set to true to append an 'Other'
|
|
9864
|
+
allowOther: z54.boolean().optional().default(true).describe("Set to true to append an 'Other' checkbox with a free-text input field. Works with 'single' and 'multiple' types. Use for open-ended answers or when the options cannot cover all possibilities. Not applicable for 'input' or 'file_upload' types.")
|
|
9865
9865
|
});
|
|
9866
9866
|
var inputSchema = z54.object({
|
|
9867
9867
|
questions: z54.array(questionSchema).min(1, "At least one question is required").describe("A structured sequence of clarification questions. Use these to gather missing parameters or disambiguate user intent before proceeding.")
|
|
@@ -9873,7 +9873,7 @@ function createAskUserToClarifyTool() {
|
|
|
9873
9873
|
},
|
|
9874
9874
|
{
|
|
9875
9875
|
name: "ask_user_to_clarify",
|
|
9876
|
-
description: "
|
|
9876
|
+
description: "Ask the user clarifying questions using the most appropriate question type. TYPE SELECTION GUIDE (in priority order \u2014 prefer earlier types when possible):\n1. type: 'single' \u2014 DEFAULT for most cases. Use when the user must pick ONE from a known set (e.g., ['Yes', 'No'], ['Standard', 'Express', 'Priority']). Max 3 options. Best UX: click, no typing.\n2. type: 'multiple' \u2014 Use when the user can select SEVERAL from a known set (e.g., ['Email', 'SMS', 'Push']).\n3. type: 'input' \u2014 Use when the answer is purely free-text and CANNOT be enumerated (e.g., name, email, arbitrary description). Only use this when 'single' + options is not feasible.\n4. type: 'file_upload' \u2014 Use ONLY when the user needs to upload a file. Do NOT use for text input.\n\nallowOther: true \u2014 Escape hatch for 'single' and 'multiple' types. Adds an 'Other' checkbox with a text field. Use when the options MIGHT not cover everything. Do NOT set allowOther on 'input' or 'file_upload' types.\n\nANTI-PATTERNS: Never put 'Other' or 'Enter manually' inside the options array. Never use 'input' when 'single' + options would work. Never use 'file_upload' for text input.",
|
|
9877
9877
|
schema: inputSchema
|
|
9878
9878
|
}
|
|
9879
9879
|
);
|
|
@@ -9950,7 +9950,11 @@ function createAskUserClarifyMiddleware() {
|
|
|
9950
9950
|
parts.push(...answer.selectedOptions ?? []);
|
|
9951
9951
|
}
|
|
9952
9952
|
if (answer.otherText && answer.otherText.trim() !== "") {
|
|
9953
|
-
|
|
9953
|
+
if (question.type === "input") {
|
|
9954
|
+
parts.push(answer.otherText.trim());
|
|
9955
|
+
} else {
|
|
9956
|
+
parts.push(`Other: ${answer.otherText.trim()}`);
|
|
9957
|
+
}
|
|
9954
9958
|
}
|
|
9955
9959
|
if (answer.filePath && answer.filePath.trim() !== "") {
|
|
9956
9960
|
parts.push(`File: ${answer.filePath.trim()}`);
|
|
@@ -15946,17 +15950,17 @@ function getAsyncPromptText() {
|
|
|
15946
15950
|
|
|
15947
15951
|
## Async Task Usage
|
|
15948
15952
|
|
|
15949
|
-
|
|
15950
|
-
background tasks. The task returns immediately with a task ID.
|
|
15953
|
+
**IMPORTANT: Only use \`async: true\` when the USER explicitly requests it.** Do NOT set \`async: true\` on your own initiative, even if tasks appear independent or parallelizable. The user must explicitly ask for background/async execution, for example: "run this in the background", "do this asynchronously", "fire and forget", or "let me know when it's done".
|
|
15951
15954
|
|
|
15952
|
-
|
|
15953
|
-
|
|
15955
|
+
If the user does NOT explicitly request async execution, always use \`async: false\` (the default) so the task runs synchronously and the result is available immediately.
|
|
15956
|
+
|
|
15957
|
+
When \`async: true\` IS explicitly requested by the user:
|
|
15958
|
+
- The task returns immediately with a task ID.
|
|
15959
|
+
- Move on immediately after launching. NEVER call check_async_task or list_async_tasks right after starting a task.
|
|
15954
15960
|
- NEVER poll for task completion. The result will arrive as a notification.
|
|
15955
15961
|
- Only check task status when the USER explicitly asks for an update.
|
|
15956
|
-
- If you receive an [Async task completed] notification, read it and incorporate
|
|
15957
|
-
|
|
15958
|
-
- Task statuses in conversation history are stale \u2014 always use fresh tool calls
|
|
15959
|
-
when the user asks.
|
|
15962
|
+
- If you receive an [Async task completed] notification, read it and incorporate the result into your next response. Do not then call check_async_task repeatedly.
|
|
15963
|
+
- Task statuses in conversation history are stale \u2014 always use fresh tool calls when the user asks.
|
|
15960
15964
|
- Use cancel_async_task if the user wants to stop a running task.
|
|
15961
15965
|
- Keep the full task_id: never truncate or abbreviate it.`;
|
|
15962
15966
|
}
|
|
@@ -21848,7 +21852,10 @@ registerToolLattice(
|
|
|
21848
21852
|
},
|
|
21849
21853
|
async (input, exeConfig) => {
|
|
21850
21854
|
try {
|
|
21851
|
-
const
|
|
21855
|
+
const parentRunConfig = exeConfig?.configurable?.runConfig || {};
|
|
21856
|
+
const tenantId = parentRunConfig.tenantId || "default";
|
|
21857
|
+
const workspaceId = parentRunConfig.workspaceId;
|
|
21858
|
+
const projectId = parentRunConfig.projectId;
|
|
21852
21859
|
const { id, message } = input;
|
|
21853
21860
|
const store = getAssistStore();
|
|
21854
21861
|
const existing = await store.getAssistantById(tenantId, id);
|
|
@@ -21859,7 +21866,9 @@ registerToolLattice(
|
|
|
21859
21866
|
const agent = new Agent({
|
|
21860
21867
|
tenant_id: tenantId,
|
|
21861
21868
|
assistant_id: id,
|
|
21862
|
-
thread_id: threadId
|
|
21869
|
+
thread_id: threadId,
|
|
21870
|
+
workspace_id: workspaceId,
|
|
21871
|
+
project_id: projectId
|
|
21863
21872
|
});
|
|
21864
21873
|
const result = await agent.invokeWithState({ input: { message } });
|
|
21865
21874
|
return JSON.stringify({ agentId: id, threadId, result });
|