@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 CHANGED
@@ -11619,10 +11619,10 @@ var import_langchain56 = require("langchain");
11619
11619
  var import_zod56 = __toESM(require("zod"));
11620
11620
  var questionSchema = import_zod56.default.object({
11621
11621
  question: import_zod56.default.string().describe("The question text to ask the user"),
11622
- options: import_zod56.default.array(import_zod56.default.string()).optional().default([]).describe("List of EXACT, selectable values. Maximum 3 options allowed. DO NOT include any 'placeholder' options that require the user to type (e.g., do NOT add 'Enter manual value'). If manual input is needed, set allowOther to true instead. For file_upload questions, pass an empty array."),
11623
- type: import_zod56.default.enum(["single", "multiple", "file_upload"]).describe("Whether the question allows single selection, multiple selections, or expects a file upload. file_upload questions render a file picker component and the uploaded file path is returned as the answer."),
11622
+ options: import_zod56.default.array(import_zod56.default.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."),
11623
+ type: import_zod56.default.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."),
11624
11624
  required: import_zod56.default.boolean().optional().default(false).describe("Whether this question must be answered"),
11625
- allowOther: import_zod56.default.boolean().optional().default(true).describe("Set to true to append an 'Other' option that opens a free-text input field. Use this for open-ended answers or when the 3 options cannot cover all possibilities.")
11625
+ allowOther: import_zod56.default.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.")
11626
11626
  });
11627
11627
  var inputSchema = import_zod56.default.object({
11628
11628
  questions: import_zod56.default.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.")
@@ -11634,7 +11634,7 @@ function createAskUserToClarifyTool() {
11634
11634
  },
11635
11635
  {
11636
11636
  name: "ask_user_to_clarify",
11637
- description: "Prompts the user to choose from a list of predefined values, provide custom input, or upload a file. USE CASES: 1. Use 'options' ONLY for distinct, mutually exclusive choices (e.g., ['Standard', 'Express']). 2. Set 'allowOther: true' ONLY when you need to capture free-text information that doesn't fit into the predefined options. 3. Use type: 'file_upload' to ask the user to upload a file \u2014 options can be an empty array for this type. IMPORTANT: Never put placeholders like 'Please specify' or 'Other' inside the 'options' list. ",
11637
+ 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.",
11638
11638
  schema: inputSchema
11639
11639
  }
11640
11640
  );
@@ -11711,7 +11711,11 @@ function createAskUserClarifyMiddleware() {
11711
11711
  parts.push(...answer.selectedOptions ?? []);
11712
11712
  }
11713
11713
  if (answer.otherText && answer.otherText.trim() !== "") {
11714
- parts.push(`Other: ${answer.otherText.trim()}`);
11714
+ if (question.type === "input") {
11715
+ parts.push(answer.otherText.trim());
11716
+ } else {
11717
+ parts.push(`Other: ${answer.otherText.trim()}`);
11718
+ }
11715
11719
  }
11716
11720
  if (answer.filePath && answer.filePath.trim() !== "") {
11717
11721
  parts.push(`File: ${answer.filePath.trim()}`);
@@ -17682,17 +17686,17 @@ function getAsyncPromptText() {
17682
17686
 
17683
17687
  ## Async Task Usage
17684
17688
 
17685
- When tasks are independent and can run in parallel, use \`async: true\` to launch
17686
- background tasks. The task returns immediately with a task ID.
17689
+ **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".
17687
17690
 
17688
- CRITICAL: After launching with \`async: true\`, move on immediately.
17689
- - NEVER call check_async_task or list_async_tasks right after starting a task.
17691
+ 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.
17692
+
17693
+ When \`async: true\` IS explicitly requested by the user:
17694
+ - The task returns immediately with a task ID.
17695
+ - Move on immediately after launching. NEVER call check_async_task or list_async_tasks right after starting a task.
17690
17696
  - NEVER poll for task completion. The result will arrive as a notification.
17691
17697
  - Only check task status when the USER explicitly asks for an update.
17692
- - If you receive an [Async task completed] notification, read it and incorporate
17693
- the result into your next response. Do not then call check_async_task repeatedly.
17694
- - Task statuses in conversation history are stale \u2014 always use fresh tool calls
17695
- when the user asks.
17698
+ - 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.
17699
+ - Task statuses in conversation history are stale \u2014 always use fresh tool calls when the user asks.
17696
17700
  - Use cancel_async_task if the user wants to stop a running task.
17697
17701
  - Keep the full task_id: never truncate or abbreviate it.`;
17698
17702
  }
@@ -23584,7 +23588,10 @@ registerToolLattice(
23584
23588
  },
23585
23589
  async (input, exeConfig) => {
23586
23590
  try {
23587
- const tenantId = getTenantId(exeConfig);
23591
+ const parentRunConfig = exeConfig?.configurable?.runConfig || {};
23592
+ const tenantId = parentRunConfig.tenantId || "default";
23593
+ const workspaceId = parentRunConfig.workspaceId;
23594
+ const projectId = parentRunConfig.projectId;
23588
23595
  const { id, message } = input;
23589
23596
  const store = getAssistStore();
23590
23597
  const existing = await store.getAssistantById(tenantId, id);
@@ -23595,7 +23602,9 @@ registerToolLattice(
23595
23602
  const agent = new Agent({
23596
23603
  tenant_id: tenantId,
23597
23604
  assistant_id: id,
23598
- thread_id: threadId
23605
+ thread_id: threadId,
23606
+ workspace_id: workspaceId,
23607
+ project_id: projectId
23599
23608
  });
23600
23609
  const result = await agent.invokeWithState({ input: { message } });
23601
23610
  return JSON.stringify({ agentId: id, threadId, result });