@axiom-lattice/core 2.1.80 → 2.1.82
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/{chunk-FN4TRQK4.mjs → chunk-SGRFQY3E.mjs} +386 -504
- package/dist/chunk-SGRFQY3E.mjs.map +1 -0
- package/dist/compile-4RFYHUBE.mjs +11 -0
- package/dist/index.d.mts +219 -34
- package/dist/index.d.ts +219 -34
- package/dist/index.js +1725 -1299
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1278 -745
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
- package/dist/chunk-FN4TRQK4.mjs.map +0 -1
- package/dist/compile-SYSKVQHB.mjs +0 -9
- /package/dist/{compile-SYSKVQHB.mjs.map → compile-4RFYHUBE.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/workflow/compile.ts","../src/workflow/utils.ts","../src/workflow/parse-yaml.ts","../src/workflow/schema.ts"],"sourcesContent":["/**\n * Workflow DSL → LangGraph StateGraph compiler\n *\n * Takes a YAML workflow string, parses it via parseYaml(),\n * and compiles the resulting InternalDSL into a runnable LangGraph StateGraph.\n */\nimport {\n StateGraph,\n START,\n END,\n type CompiledStateGraph,\n type AnnotationRoot,\n} from \"@langchain/langgraph\";\nimport type { BaseCheckpointSaver } from \"@langchain/langgraph-checkpoint\";\nimport type {\n InternalDSL,\n WorkflowTrackingStore,\n} from \"@axiom-lattice/protocols\";\nimport {\n buildStateAnnotation,\n createNodeHandler,\n resolvePath,\n type ResolveAgentFn,\n} from \"./utils\";\nimport { parseYaml } from \"./parse-yaml\";\n\n/**\n * Compile a YAML workflow string into a LangGraph StateGraph.\n */\nexport function compileWorkflow(\n yamlStr: string,\n resolveAgent: ResolveAgentFn,\n checkpointer: BaseCheckpointSaver,\n trackingStore?: WorkflowTrackingStore\n): CompiledStateGraph<any, any, any, any, any> {\n console.log(`[WF COMPILE] compiling YAML workflow`);\n const ir = parseYaml(yamlStr);\n return compileInternal(ir, resolveAgent, checkpointer, trackingStore);\n}\n\n/**\n * Compile an InternalDSL directly into a LangGraph StateGraph.\n * Used internally by compileWorkflow and for lower-level access.\n */\nexport function compileInternal(\n ir: InternalDSL,\n resolveAgent: ResolveAgentFn,\n checkpointer: BaseCheckpointSaver,\n trackingStore?: WorkflowTrackingStore\n): CompiledStateGraph<any, any, any, any, any> {\n validateAndThrow(ir);\n console.log(`[WF COMPILE] validation passed`);\n\n const StateAnnotation: AnnotationRoot<any> = buildStateAnnotation(ir.state?.fields);\n const builder = new StateGraph(StateAnnotation);\n\n for (const node of ir.nodes) {\n console.log(`[WF COMPILE] registering node: id=${node.id} type=${node.type} name=${node.name}`);\n const handler = createNodeHandler(node, resolveAgent, trackingStore);\n (builder as any).addNode(node.id, handler);\n }\n\n for (const node of ir.nodes) {\n if (node.type === \"terminal\") {\n (builder as any).addEdge(node.id, END);\n }\n }\n\n for (const edge of ir.edges) {\n const from = edge.from === \"START\" ? START : edge.from;\n const targets = Array.isArray(edge.to) ? edge.to : [edge.to!];\n for (const to of targets) {\n (builder as any).addEdge(from, to === \"END\" ? END : to);\n }\n }\n\n const graph = builder.compile({ checkpointer, name: ir.name });\n console.log(`[WF COMPILE] graph compiled successfully`);\n return graph;\n}\n\n// ─── DSL Validation ────────────────────────────────────────────────────────\n\nexport interface WorkflowValidationError {\n type: \"error\" | \"warning\";\n message: string;\n}\n\n/** Validate an expanded InternalDSL for structural correctness. */\nexport function validateDSL(dsl: InternalDSL): WorkflowValidationError[] {\n const errors: WorkflowValidationError[] = [];\n const nodeIds = new Set<string>();\n\n for (const node of dsl.nodes) {\n if (nodeIds.has(node.id)) {\n errors.push({ type: \"error\", message: `Duplicate node id \"${node.id}\"` });\n }\n nodeIds.add(node.id);\n }\n\n const terminalIds = new Set(\n dsl.nodes.filter((n) => n.type === \"terminal\").map((n) => n.id)\n );\n\n for (const edge of dsl.edges) {\n if (edge.from !== \"START\" && !nodeIds.has(edge.from)) {\n errors.push({ type: \"error\", message: `Edge from \"${edge.from}\" references unknown node` });\n }\n if (edge.from !== \"START\" && terminalIds.has(edge.from)) {\n errors.push({ type: \"error\", message: `Terminal node \"${edge.from}\" cannot have outgoing edges` });\n }\n const targets = Array.isArray(edge.to) ? edge.to : edge.to ? [edge.to] : [];\n for (const to of targets) {\n if (to !== \"END\" && !nodeIds.has(to)) {\n errors.push({ type: \"error\", message: `Edge to \"${to}\" references unknown node` });\n }\n }\n }\n\n for (const node of dsl.nodes) {\n if (node.type === \"terminal\") {\n const hasIncoming = dsl.edges.some((e) => {\n const targets = Array.isArray(e.to) ? e.to : e.to ? [e.to] : [];\n return targets.includes(node.id);\n });\n if (!hasIncoming) {\n errors.push({ type: \"warning\", message: `Terminal node \"${node.id}\" has no incoming edge` });\n }\n }\n }\n\n return errors;\n}\n\nfunction validateAndThrow(dsl: InternalDSL): void {\n const errors = validateDSL(dsl);\n const critical = errors.filter((e) => e.type === \"error\");\n if (critical.length > 0) {\n throw new Error(critical.map((e) => e.message).join(\"; \"));\n }\n}\n","/**\n * Workflow DSL compilation utilities\n *\n * State annotation builder, template rendering, input/output handling,\n * and node handler factories for agent, map, terminal, and input nodes.\n */\nimport {\n Annotation,\n} from \"@langchain/langgraph\";\nimport type { AnnotationRoot } from \"@langchain/langgraph\";\nimport { HumanMessage, SystemMessage, type BaseMessage } from \"@langchain/core/messages\";\nimport type { RunnableConfig } from \"@langchain/core/runnables\";\nimport type { AgentClient } from \"../agent_lattice/types\";\nimport type {\n WorkflowTrackingStore,\n WorkflowRunStatus,\n StepType,\n} from \"@axiom-lattice/protocols\";\nimport type {\n InternalStateField,\n InternalNode,\n InternalAgentNode,\n InternalMapNode,\n InternalTerminalNode,\n InternalInputNode,\n InternalInput,\n} from \"@axiom-lattice/protocols\";\nimport { toSafeStateExpr, validateExpression } from \"./parse-yaml\";\n\n// ─── Types ─────────────────────────────────────────────────────────────────\n\nexport type ResolveAgentFn = (ref?: string, responseFormat?: Record<string, unknown>, stepType?: string) => Promise<AgentClient>;\n\n// ─── buildStateAnnotation ──────────────────────────────────────────────────\n\n/**\n * Build a LangGraph Annotation.Root from DSL state.fields.\n * Always adds an implicit `phase` field for progress tracking.\n */\nexport function buildStateAnnotation(\n fields?: Record<string, InternalStateField>\n): AnnotationRoot<any> {\n const annotations: Record<string, any> = {};\n\n if (fields) {\n for (const [key, field] of Object.entries(fields)) {\n annotations[key] = Annotation({\n default: () => field.default ?? defaultValueForType(field.type),\n reducer: buildReducer(field.reducer ?? \"replace\"),\n });\n }\n }\n\n // Implicit messages field — used by Agent.agentExecutor to read result\n if (!annotations[\"messages\"]) {\n annotations[\"messages\"] = Annotation<BaseMessage[]>({\n default: () => [],\n reducer: (prev: BaseMessage[], next: BaseMessage[]) => [...prev, ...next],\n });\n }\n\n // Implicit phase field — written by every node\n annotations[\"phase\"] = Annotation<string>({\n default: () => \"init\",\n reducer: (_prev: string, next: string) => next,\n });\n\n // Implicit status field — written by terminal nodes\n if (!annotations[\"status\"]) {\n annotations[\"status\"] = Annotation<string>({\n default: () => \"\",\n reducer: (_prev: string, next: string) => next,\n });\n }\n\n // Implicit _runId field — set by input node, read by agent/human/map nodes for RunStep tracking\n if (!annotations[\"_runId\"]) {\n annotations[\"_runId\"] = Annotation<string | undefined>({\n default: () => undefined,\n reducer: (_prev: string | undefined, next: string | undefined) => next ?? _prev,\n });\n }\n\n return Annotation.Root(annotations);\n}\n\nfunction defaultValueForType(type: string): unknown {\n switch (type) {\n case \"string\": return \"\";\n case \"number\": return null;\n case \"boolean\": return false;\n case \"object\": return null;\n case \"array\": return [];\n default: return null;\n }\n}\n\nfunction buildReducer(kind: string) {\n switch (kind) {\n case \"append\":\n return (prev: unknown, next: unknown) => {\n const arr = Array.isArray(prev) ? prev : [];\n return arr.concat(Array.isArray(next) ? next : [next]);\n };\n case \"merge\":\n return (prev: unknown, next: unknown) => {\n const obj = (prev && typeof prev === \"object\" && !Array.isArray(prev)) ? prev as Record<string, unknown> : {};\n const merge = (next && typeof next === \"object\" && !Array.isArray(next)) ? next as Record<string, unknown> : {};\n return { ...obj, ...merge };\n };\n case \"replace\":\n default:\n return (_prev: unknown, next: unknown) => next;\n }\n}\n\n// ─── resolvePath ───────────────────────────────────────────────────────────\n\n/**\n * Resolve a dot/bracket path against a state object.\n * Strips leading \"state.\" prefix automatically.\n *\n * @example\n * resolvePath({ a: { b: [{ c: 1 }] } }, \"state.a.b[0].c\") // → 1\n */\nexport function resolvePath(obj: Record<string, unknown>, path: string): unknown {\n const cleanPath = path.startsWith(\"state.\") ? path.slice(6) : path;\n // Split on dots and bracket notation: a.b[0].c → [\"a\", \"b\", \"0\", \"c\"]\n const parts = cleanPath.split(/\\.|\\[|\\]\\.?/).filter(Boolean);\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined) return undefined;\n if (typeof current === \"object\") {\n current = (current as Record<string, unknown>)[part];\n } else {\n return undefined;\n }\n }\n return current;\n}\n\n// ─── renderTemplate ────────────────────────────────────────────────────────\n\n/**\n * Render a template string replacing `${state.path}`, `${item.path}`, and\n * custom item-key shortcuts like `${<key>.path}` (when `<key>` matches a\n * top-level property of the item context).\n *\n * @param template Template string with ${...} placeholders\n * @param state Current workflow state\n * @param item Optional item context (for map nodes). Keys in this object\n * become valid template prefixes (e.g. itemKey=\"row\" → ${row.name}).\n */\nexport function renderTemplate(\n template: string,\n state: Record<string, unknown>,\n item?: Record<string, unknown>\n): string {\n return template.replace(/\\$\\{([^}]+)\\}/g, (_match, expr: string) => {\n const trimmed = expr.trim();\n\n if (trimmed.startsWith(\"state.\")) {\n const val = resolvePath(state, trimmed);\n return val === undefined ? \"\" : formatValue(val);\n }\n\n if (trimmed.startsWith(\"item.\") || trimmed === \"item\") {\n if (!item) return \"\";\n if (trimmed === \"item\") {\n if (typeof item === \"object\" && \"item\" in item) {\n return formatValue((item as Record<string, unknown>).item);\n }\n return formatValue(item);\n }\n const itemPath = trimmed;\n const val = resolvePath({ item } as Record<string, unknown>, itemPath);\n return val === undefined ? \"\" : formatValue(val);\n }\n\n // Custom itemKey shortcut: ${row.name} when item = { row: {...} }\n if (item && typeof item === \"object\") {\n const firstSeg = trimmed.split(\".\")[0];\n if (firstSeg in (item as Record<string, unknown>)) {\n const val = resolvePath({ item } as Record<string, unknown>, `item.${trimmed}`);\n return val === undefined ? \"\" : formatValue(val);\n }\n }\n\n // Unknown prefix — leave placeholder as-is to surface the error\n return `\\${${trimmed}}`;\n });\n}\n\nfunction formatValue(val: unknown): string {\n if (typeof val === \"string\") return val;\n if (val === null || val === undefined) return \"\";\n if (Array.isArray(val)) {\n const parts = val.map((item: Record<string, any>) => {\n const content = item?.content ?? item?.kwargs?.content;\n if (typeof content === \"string\") return content;\n if (Array.isArray(content)) {\n return (content as Array<Record<string, any>>)\n .filter((c: Record<string, any>) => c?.type === \"text\")\n .map((c: Record<string, any>) => String(c.text ?? \"\"))\n .join(\"\\n\");\n }\n if (content && typeof content === \"object\") return JSON.stringify(content, null, 2);\n // Not a message object — render the item itself\n if (item && typeof item === \"object\") return JSON.stringify(item, null, 2);\n return String(item);\n });\n const result = parts.filter(Boolean).join(\"\\n\");\n return result || JSON.stringify(val, null, 2);\n }\n return JSON.stringify(val, null, 2);\n}\n\n// ─── buildInput ────────────────────────────────────────────────────────────\n\n/**\n * Build input for LangGraph agent invocation from DSL input specification.\n * Returns a partial state with messages, suitable for graph.invoke().\n *\n * When outputSchema is provided, it is converted into a readable JSON example\n * and appended to the prompt so the LLM knows exactly what shape to output.\n */\nexport function buildInput(\n input: InternalInput | undefined,\n state: Record<string, unknown>,\n item?: Record<string, unknown>,\n outputSchema?: Record<string, unknown>\n): { messages: BaseMessage[] } {\n let prompt = input?.template\n ? renderTemplate(input.template, state, item)\n : \"\";\n\n if (outputSchema) {\n const example = schemaToExample(outputSchema);\n const schemaInstruction = `\\n\\nOutput must be valid JSON in exactly this shape. Return ONLY the JSON, no other text or markdown:\\n${example}`;\n prompt = prompt + schemaInstruction;\n }\n\n return { messages: [new HumanMessage(prompt)] };\n}\n\n/**\n * Convert a JSON Schema definition into a readable JSON example for the LLM.\n *\n * Handles standard JSON Schema:\n * { \"type\": \"object\", \"properties\": { \"name\": { \"type\": \"string\" } } }\n * → { \"name\": \"<string>\" }\n *\n * { \"type\": \"array\", \"items\": { \"type\": \"object\", \"properties\": { ... } } }\n * → [{ ... }]\n *\n * Also handles legacy shorthand for backward compat:\n * { \"field\": \"string\" } → { \"field\": \"<string>\" }\n * { \"items\": [\"object\"] } → { \"items\": [{ ... }] }\n */\nfunction schemaToExample(schema: Record<string, unknown>): string {\n const example = schemaValueToExample(schema);\n return JSON.stringify(example, null, 2);\n}\n\nfunction schemaValueToExample(value: unknown): unknown {\n if (value === null || value === undefined) return null;\n if (typeof value !== \"object\") return value;\n\n const obj = value as Record<string, unknown>;\n\n if (obj.type === \"string\") return \"<string>\";\n if (obj.type === \"number\") return \"<number>\";\n if (obj.type === \"boolean\") return \"<boolean>\";\n if (obj.type === \"integer\") return \"<integer>\";\n\n if (obj.type === \"array\" && obj.items) {\n return [schemaValueToExample(obj.items)];\n }\n\n if (obj.type === \"object\" && obj.properties && typeof obj.properties === \"object\") {\n const example: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(obj.properties as Record<string, unknown>)) {\n example[k] = schemaValueToExample(v);\n }\n return example;\n }\n\n if (obj.type === \"object\") return {};\n\n if (Array.isArray(value)) {\n if (value.length === 1) {\n return [schemaValueToExample(value[0])];\n }\n return value.map(schemaValueToExample);\n }\n\n const example: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(obj)) {\n example[k] = schemaValueToExample(v);\n }\n return example;\n}\n\n// ─── extractOutput ─────────────────────────────────────────────────────────\n\n/**\n * Extract structured output from a sub-agent invocation result.\n *\n * Priority order:\n * 1. result.structuredResponse — langchain's tool strategy stores parsed output here\n * 2. result.messages — scan backwards for last AIMessage content (native JSON schema /\n * legacy text-based structured output)\n * 3. result itself (minus messages)\n */\nexport function extractOutput(\n result: Record<string, unknown>,\n): unknown {\n // Tool strategy: langchain stores the parsed structured output directly\n if (\"structuredResponse\" in result && result.structuredResponse !== undefined) {\n return result.structuredResponse;\n }\n\n // Scan messages backwards for the last AIMessage\n const messages = result.messages as BaseMessage[] | undefined;\n if (messages && Array.isArray(messages)) {\n for (let i = messages.length - 1; i >= 0; i--) {\n const msg = messages[i];\n if (msg._getType() === \"ai\") {\n const content = msg.content;\n // Already structured (from native json_schema / withStructuredOutput)\n if (typeof content === \"object\" && content !== null && !Array.isArray(content)) {\n return content;\n }\n // Array content — extract text parts and try JSON parse\n if (Array.isArray(content)) {\n const textParts = content\n .filter((c): c is { type: \"text\"; text: string } =>\n typeof c === \"object\" && c !== null && (c as Record<string, unknown>).type === \"text\"\n )\n .map((c) => c.text)\n .join(\"\\n\");\n if (textParts) {\n try { return JSON.parse(textParts); } catch {\n const fenced = extractJsonFromFence(textParts);\n if (fenced !== undefined) return fenced;\n return textParts;\n }\n }\n return content;\n }\n // String — try JSON parse\n if (typeof content === \"string\") {\n try {\n return JSON.parse(content);\n } catch {\n // Try extracting from ```json ... ``` or ``` ... ``` fences\n const fenced = extractJsonFromFence(content);\n if (fenced !== undefined) return fenced;\n return content;\n }\n }\n return content;\n }\n }\n }\n\n // Fallback: return entire result (minus messages for cleanliness)\n const { messages: _msgs, ...rest } = result;\n void _msgs;\n return rest;\n}\n\n/**\n * Extract JSON from a markdown fenced code block.\n * Handles both ```json ... ``` and ``` ... ```.\n */\nfunction extractJsonFromFence(text: string): unknown | undefined {\n const jsonFence = text.match(/```json\\s*\\n([\\s\\S]*?)```/);\n if (jsonFence) {\n try { return JSON.parse(jsonFence[1].trim()); } catch { /* continue */ }\n }\n const plainFence = text.match(/```\\s*\\n([\\s\\S]*?)```/);\n if (plainFence) {\n try { return JSON.parse(plainFence[1].trim()); } catch { /* continue */ }\n }\n return undefined;\n}\n\n// ─── parallelLimit ─────────────────────────────────────────────────────────\n\n/**\n * Process items in parallel with a concurrency limit (simple semaphore).\n */\nexport async function parallelLimit<T, R>(\n items: T[],\n limit: number,\n fn: (item: T, index: number) => Promise<R>\n): Promise<R[]> {\n const results: R[] = new Array(items.length);\n let index = 0;\n\n async function worker(): Promise<void> {\n while (index < items.length) {\n const i = index++;\n results[i] = await fn(items[i], i);\n }\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));\n return results;\n}\n\n// ─── invokeWithRetry ───────────────────────────────────────────────────────\n\n/**\n * Invoke a function with retry logic and optional timeout.\n */\nexport async function invokeWithRetry<T>(\n fn: () => Promise<T>,\n maxRetries: number,\n retryOn?: string[],\n timeoutMs?: number\n): Promise<T> {\n let lastError: unknown;\n for (let i = 0; i <= maxRetries; i++) {\n try {\n const promise = fn();\n if (timeoutMs && timeoutMs > 0) {\n return await withTimeout(promise, timeoutMs);\n }\n return await promise;\n } catch (err) {\n // GraphInterrupt is control flow, never retry it\n if ((err as any)?.name === \"GraphInterrupt\") {\n throw err;\n }\n lastError = err;\n if (i === maxRetries) throw err;\n if (retryOn?.length) {\n const errName = (err as Error)?.name ?? \"\";\n if (!retryOn.includes(errName)) throw err;\n }\n }\n }\n throw lastError;\n}\n\nfunction withTimeout<T>(promise: Promise<T>, ms: number): Promise<T> {\n return Promise.race([\n promise,\n new Promise<T>((_, reject) =>\n setTimeout(() => reject(new Error(`Operation timed out after ${ms}ms`)), ms)\n ),\n ]);\n}\n\n// ─── Node Handler Factories ────────────────────────────────────────────────\n\n/**\n * Create a handler for an `agent` node.\n *\n * Resolves the agent by ref, builds input, invokes with retry,\n * extracts output, and returns a state update.\n */\nexport function createAgentNode(\n node: InternalAgentNode,\n resolveAgent: ResolveAgentFn,\n trackingStore?: WorkflowTrackingStore\n): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>> {\n return async (state, config) => {\n const runId = (state as Record<string, unknown>)._runId as string | undefined;\n const tenantId = config?.configurable?.tenantId as string ?? \"default\";\n\n // Evaluate condition: skip node if expression is falsy\n if (node.condition) {\n try {\n validateExpression(node.condition);\n const safeExpr = toSafeStateExpr(node.condition);\n const fn = new Function(\"state\", `try { return ${safeExpr}; } catch { return false; }`) as (s: any) => unknown;\n const shouldRun = fn(state);\n if (!shouldRun) {\n console.log(`[WF][${node.id}] condition false, skipping \"${node.name}\" (${node.condition})`);\n if (trackingStore && runId) {\n const step = await trackingStore.upsertRunStep({\n runId, tenantId, stepType: node.type as StepType,\n stepName: node.name,\n }).catch(() => null);\n if (step) {\n await trackingStore.updateRunStep(runId, step.id, {\n status: \"skipped\",\n completedAt: new Date(),\n }).catch(() => {});\n }\n }\n return { phase: node.id };\n }\n } catch (condErr) {\n console.error(`[WF][${node.id}] condition eval error: ${(condErr as Error).message}`);\n throw condErr;\n }\n }\n\n const startedAt = Date.now();\n let stepId: string | undefined;\n\n if (trackingStore && runId) {\n trackingStore.updateWorkflowRun(runId, {\n status: \"running\",\n completedAt: null,\n }).catch(() => {});\n }\n\n try {\n console.log(`[WF][${node.id}] START \"${node.name}\" | hasSchema=${!!node.output?.schema}`);\n const responseFormat = node.output?.schema as Record<string, unknown> | undefined;\n console.log(`[WF][${node.id}] resolving agent...`);\n const stepType = node.ask ? \"ask\" : node.type;\n const client = await resolveAgent(node.ref, responseFormat, stepType);\n console.log(`[WF][${node.id}] agent resolved, building input...`);\n\n // When using native structured output, skip text-based schema injection\n const input = buildInput(\n node.input, state, undefined,\n responseFormat ? undefined : (node.output?.schema as Record<string, unknown> | undefined)\n );\n\n // When ask is enabled, prepend SOP system instruction\n if (node.ask) {\n input.messages = [\n new SystemMessage(\n \"Follow this exact procedure. Do NOT skip any step.\\n\\n\" +\n \"STEP 1: Read the prompt. It contains content to present to the user \" +\n \"and a question to ask.\\n\\n\" +\n \"STEP 2: Call ask_user_to_clarify. Your question text MUST contain \" +\n \"the ACTUAL content from the prompt.\\n\\n\" +\n \"STEP 3: The tool will pause. The user will see your questions and \" +\n \"respond. You will receive their answers.\\n\\n\" +\n \"STEP 4: Based on the user's answers, produce your final output.\"\n ),\n ...input.messages,\n ];\n }\n const renderedInput = (input.messages[0]?.content as string) ?? \"\";\n console.log(`[WF][${node.id}] === INPUT (full) ===\\n${renderedInput}\\n=== END INPUT ===`);\n\n const subConfig = {\n ...config,\n configurable: {\n ...(config?.configurable ?? {}),\n thread_id: `${config?.configurable?.thread_id ?? \"default\"}:${node.id}`,\n },\n };\n\n // Create tracking step with rendered input\n if (trackingStore && runId) {\n const step = await trackingStore.upsertRunStep({\n runId, tenantId, stepType: node.type as StepType,\n stepName: node.name,\n threadId: subConfig.configurable.thread_id as string,\n input: { template: node.input?.template, rendered: renderedInput },\n }).catch((e) => { console.warn(\"Failed to upsert run step:\", (e as Error).message); return null; });\n stepId = step?.id;\n // On resume after interrupt, step status was \"interrupted\" — reset to \"running\"\n if (step && (step as any).status === \"interrupted\") {\n trackingStore.updateRunStep(runId, step.id, { status: \"running\" }).catch(() => {});\n }\n }\n\n let result: Record<string, unknown>;\n try {\n console.log(`[WF][${node.id}] invoking agent.invoke()...`);\n result = await invokeWithRetry(\n () => client.invoke(input, subConfig),\n node.config?.maxRetries ?? 0,\n node.config?.retryOn,\n node.config?.timeout\n ) as Record<string, unknown>;\n console.log(`[WF][${node.id}] invoke SUCCESS, extracting output...`);\n } catch (err) {\n // GraphInterrupt is LangGraph's control-flow mechanism for pausing.\n // Mark the step as interrupted and re-throw.\n if ((err as any)?.name === \"GraphInterrupt\") {\n if (trackingStore && runId && stepId) {\n trackingStore.updateRunStep(runId, stepId, { status: \"interrupted\" }).catch(() => {});\n }\n if (trackingStore && runId) {\n trackingStore.updateWorkflowRun(runId, { status: \"interrupted\", completedAt: null }).catch(() => {});\n }\n throw err;\n }\n\n // Fallback: if structured output fails (e.g. thinking mode rejects tool_choice),\n // retry with text-based schema injection using the default agent\n const errMsg = (err as Error)?.message ?? \"\";\n console.log(`[WF][${node.id}] invoke FAILED: ${errMsg}`);\n if (responseFormat && (\n errMsg.includes(\"tool_choice\") ||\n errMsg.includes(\"thinking\") ||\n errMsg.includes(\"reasoning\") ||\n errMsg.includes(\"InvalidParameter\")\n )) {\n console.log(`[WF][${node.id}] attempting fallback (text-based schema injection)...`);\n const fallbackClient = await resolveAgent(node.ref, undefined, node.type);\n const fallbackInput = buildInput(node.input, state, undefined, responseFormat);\n result = await invokeWithRetry(\n () => fallbackClient.invoke(fallbackInput, subConfig),\n node.config?.maxRetries ?? 0,\n node.config?.retryOn,\n node.config?.timeout\n ) as Record<string, unknown>;\n console.log(`[WF][${node.id}] fallback invoke SUCCESS`);\n } else {\n throw err;\n }\n }\n\n const output = extractOutput(result as Record<string, unknown>);\n console.log(`[WF][${node.id}] === OUTPUT (full) | key=${node.output?.key} ===\\n${JSON.stringify(output, null, 2)}\\n=== END OUTPUT ===`);\n const update: Record<string, unknown> = { phase: node.id };\n if (node.output?.key) {\n update[node.output.key] = output;\n }\n\n // Propagate sub-agent AI messages to workflow messages so\n // Agent.agentExecutor → result.messages.map() finds AI replies\n const subMessages = (result as Record<string, unknown>).messages as BaseMessage[] | undefined;\n if (subMessages && Array.isArray(subMessages)) {\n const aiMessages = subMessages.filter((m: any) => {\n const t = typeof m._getType === \"function\" ? m._getType() : (m.role ?? m.type);\n return t === \"ai\";\n });\n if (aiMessages.length > 0) {\n update.messages = aiMessages;\n }\n }\n console.log(`[WF][${node.id}] DONE (${Date.now() - startedAt}ms)`);\n\n if (trackingStore && runId && stepId) {\n trackingStore.updateRunStep(runId, stepId, {\n status: \"completed\",\n output: output as Record<string, any>,\n completedAt: new Date(),\n durationMs: Date.now() - startedAt,\n }).catch((e) => { console.warn(\"Failed to update run step:\", (e as Error).message); });\n }\n\n return update;\n } catch (err) {\n // GraphInterrupt is not an error — let it propagate to LangGraph runtime.\n if ((err as any)?.name === \"GraphInterrupt\") {\n throw err;\n }\n\n if (trackingStore && runId) {\n if (stepId) {\n trackingStore.updateRunStep(runId, stepId, {\n status: \"failed\",\n errorMessage: (err as Error).message,\n completedAt: new Date(),\n durationMs: Date.now() - startedAt,\n }).catch((e) => { console.warn(\"Failed to update run step:\", (e as Error).message); });\n }\n trackingStore.updateWorkflowRun(runId, {\n status: \"failed\",\n errorMessage: (err as Error).message,\n completedAt: new Date(),\n }).catch((e) => { console.warn(\"Failed to finalize WorkflowRun:\", (e as Error).message); });\n }\n throw err;\n }\n };\n}\n\n/**\n * Create a handler for a `map` node.\n *\n * Reads the source array from state, batches items, processes each\n * item through the inner agent in parallel (with concurrency control),\n * and optionally calls a reduce agent to aggregate results.\n */\nexport function createMapNode(\n node: InternalMapNode,\n resolveAgent: ResolveAgentFn,\n trackingStore?: WorkflowTrackingStore\n): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>> {\n return async (state, config) => {\n const runId = (state as Record<string, unknown>)._runId as string | undefined;\n const tenantId = config?.configurable?.tenantId as string ?? \"default\";\n\n // Evaluate condition: skip map if expression is falsy\n if (node.condition) {\n try {\n validateExpression(node.condition);\n const safeExpr = toSafeStateExpr(node.condition);\n const fn = new Function(\"state\", `try { return ${safeExpr}; } catch { return false; }`) as (s: any) => unknown;\n const shouldRun = fn(state);\n if (!shouldRun) {\n console.log(`[WF][${node.id}] condition false, skipping map \"${node.name}\" (${node.condition})`);\n if (trackingStore && runId) {\n const step = await trackingStore.upsertRunStep({\n runId, tenantId, stepType: node.type as StepType,\n stepName: node.name,\n }).catch(() => null);\n if (step) {\n await trackingStore.updateRunStep(runId, step.id, {\n status: \"skipped\",\n completedAt: new Date(),\n }).catch(() => {});\n }\n }\n return { phase: node.id };\n }\n } catch (condErr) {\n console.error(`[WF][${node.id}] condition eval error: ${(condErr as Error).message}`);\n throw condErr;\n }\n }\n\n const startedAt = Date.now();\n let stepId: string | undefined;\n\n if (trackingStore && runId) {\n trackingStore.updateWorkflowRun(runId, {\n status: \"running\",\n completedAt: null,\n }).catch(() => {});\n }\n\n try {\n // 1. Read source array\n const items = resolvePath(state, node.source);\n\n if (trackingStore && runId) {\n const step = await trackingStore.upsertRunStep({\n runId, tenantId, stepType: node.type as StepType,\n stepName: node.name,\n input: { source: node.source, itemCount: Array.isArray(items) ? items.length : 0 },\n }).catch((e) => { console.warn(\"Failed to upsert run step:\", (e as Error).message); return null; });\n stepId = step?.id;\n // On resume after interrupt, step status was \"interrupted\" — reset to \"running\"\n if (step && (step as any).status === \"interrupted\") {\n trackingStore.updateRunStep(runId, step.id, { status: \"running\" }).catch(() => {});\n }\n }\n\n if (!Array.isArray(items)) {\n throw new Error(\n `Map source \"${node.source}\" resolved to ${typeof items}, expected array`\n );\n }\n\n const batchSize = node.config?.batchSize ?? 50;\n const maxConcurrency = node.config?.maxConcurrency ?? 10;\n const innerConcurrency = node.config?.innerConcurrency ?? 5;\n const itemKey = node.itemKey ?? \"item\";\n\n // 2. Resolve inner agent once\n const innerClient = await resolveAgent(node.node.ref, node.node.schema, node.type);\n\n // 3. Batch and process\n const batches = chunk(items, batchSize);\n\n const batchResults = await parallelLimit(batches, maxConcurrency, async (batch) => {\n // Process items within this batch\n const itemResults = await parallelLimit(batch as Record<string, unknown>[], innerConcurrency, async (item, itemIdx) => {\n const itemCtx: Record<string, unknown> = { [itemKey]: item };\n const input = buildInput(node.node.input, state, itemCtx);\n\n const subConfig = {\n ...config,\n configurable: {\n ...(config?.configurable ?? {}),\n thread_id: `${config?.configurable?.thread_id ?? \"default\"}:${node.id}:item:${itemIdx}`,\n },\n };\n\n const result = await invokeWithRetry(\n () => innerClient.invoke(input, subConfig),\n node.config?.maxRetries ?? 0,\n node.config?.retryOn,\n node.config?.timeout\n );\n return extractOutput(result as Record<string, unknown>);\n });\n\n return itemResults;\n });\n\n // 4. Flatten results\n const allResults = batchResults.flat();\n\n // 5. Optional reduce\n let finalOutput: unknown = allResults;\n if (node.reduce) {\n const reduceClient = await resolveAgent(node.reduce.ref, node.reduce.schema, node.type);\n const tempResultsKey = node.output?.key ?? `${node.id}_results`;\n const tempState = { ...state, [tempResultsKey]: allResults };\n const reduceInput = buildInput(node.reduce.input, tempState);\n const reduceResult = await invokeWithRetry(\n () => reduceClient.invoke(reduceInput, {\n ...config,\n configurable: {\n ...(config?.configurable ?? {}),\n thread_id: `${config?.configurable?.thread_id ?? \"default\"}:${node.id}:reduce`,\n },\n }),\n node.config?.maxRetries ?? 0,\n node.config?.retryOn,\n node.config?.timeout\n );\n finalOutput = extractOutput(reduceResult as Record<string, unknown>);\n }\n\n const update: Record<string, unknown> = { phase: node.id };\n if (node.output?.key) {\n update[node.output.key] = finalOutput;\n }\n\n if (trackingStore && runId && stepId) {\n trackingStore.updateRunStep(runId, stepId, {\n status: \"completed\",\n output: finalOutput as Record<string, any>,\n completedAt: new Date(),\n durationMs: Date.now() - startedAt,\n }).catch((e) => { console.warn(\"Failed to update run step:\", (e as Error).message); });\n }\n\n return update;\n } catch (err) {\n // GraphInterrupt is not an error — mark interrupted and let it propagate.\n if ((err as any)?.name === \"GraphInterrupt\") {\n if (trackingStore && runId && stepId) {\n trackingStore.updateRunStep(runId, stepId, { status: \"interrupted\" }).catch(() => {});\n }\n if (trackingStore && runId) {\n trackingStore.updateWorkflowRun(runId, { status: \"interrupted\", completedAt: null }).catch(() => {});\n }\n throw err;\n }\n\n console.error(`[WF][${node.id}] FAILED after ${Date.now() - startedAt}ms:`, (err as Error).stack || (err as Error).message);\n if (trackingStore && runId) {\n if (stepId) {\n trackingStore.updateRunStep(runId, stepId, {\n status: \"failed\",\n errorMessage: (err as Error).message,\n completedAt: new Date(),\n durationMs: Date.now() - startedAt,\n }).catch(() => {});\n }\n trackingStore.updateWorkflowRun(runId, {\n status: \"failed\",\n errorMessage: (err as Error).message,\n completedAt: new Date(),\n }).catch(() => {});\n }\n throw err;\n }\n };\n}\n\n/**\n * Create a handler for an `input` node.\n *\n * Captures the user's initial message into state.input and creates a\n * WorkflowRun tracking record if a tracking store is available.\n * The generated runId flows to downstream step tracking via state._runId.\n */\nexport function createInputNode(\n node: InternalInputNode,\n trackingStore?: WorkflowTrackingStore\n): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>> {\n return async (state, config) => {\n const tenantId = (config?.configurable?.tenantId as string) ?? \"default\";\n const threadId = (config?.configurable?.thread_id as string) ?? \"default\";\n const assistantId = (config?.configurable?.assistantId as string)\n || (config?.configurable?.assistant_id as string)\n || \"unknown\";\n\n const messages = (state as Record<string, unknown>).messages as BaseMessage[] | undefined;\n const humanMsg = messages?.find(m => m._getType() === \"human\");\n const inputText = typeof humanMsg?.content === \"string\"\n ? humanMsg.content\n : JSON.stringify(humanMsg?.content ?? \"\");\n console.log(`[WF][n_input] input captured: \"${inputText.slice(0, 200)}\"`);\n\n const update: Record<string, unknown> = { phase: node.id };\n if (node.output?.key) update[node.output.key] = inputText;\n\n if (trackingStore && !(state as Record<string, unknown>)._runId) {\n try {\n const run = await trackingStore.createWorkflowRun({\n tenantId,\n assistantId,\n threadId,\n topologyEdges: [],\n metadata: { workflowName: node.name },\n });\n update._runId = run.id;\n\n // Also create a RunStep for the input node itself\n await trackingStore.createRunStep({\n runId: run.id,\n tenantId,\n stepType: node.type as StepType,\n stepName: node.name,\n input: { rendered: inputText },\n }).catch((e) => { console.warn(\"Failed to create input run step:\", (e as Error).message); });\n } catch (e) {\n console.warn(\"Failed to create workflow run:\", (e as Error).message);\n }\n }\n\n return update;\n };\n}\n\n/**\n * Map InternalTerminalNode status to WorkflowRunStatus.\n */\nfunction terminalStatusToRunStatus(\n status: InternalTerminalNode[\"status\"]\n): WorkflowRunStatus {\n switch (status) {\n case \"failed\":\n return \"failed\";\n case \"cancelled\":\n return \"cancelled\";\n case \"success\":\n default:\n return \"completed\";\n }\n}\n\n/**\n * Create a handler for a `terminal` node.\n *\n * Sets the status field in state and finalizes the WorkflowRun tracking record.\n * An implicit edge to END is added during graph compilation.\n */\nexport function createTerminalNode(\n node: InternalTerminalNode,\n trackingStore?: WorkflowTrackingStore\n): (state: Record<string, unknown>) => Promise<Partial<Record<string, unknown>>> {\n const runStatus = terminalStatusToRunStatus(node.status);\n\n return async (state: Record<string, unknown>) => {\n const runId = state._runId as string | undefined;\n\n if (trackingStore && runId) {\n try {\n await trackingStore.updateWorkflowRun(runId, {\n status: runStatus,\n completedAt: new Date(),\n });\n } catch (e) {\n console.warn(`[WF][terminal] Failed to finalize WorkflowRun \"${runId}\":`, (e as Error).message);\n }\n\n try {\n await trackingStore.createRunStep({\n runId,\n tenantId: (state._tenantId as string) ?? \"default\",\n stepType: \"terminal\",\n stepName: node.name,\n input: { status: node.status },\n });\n } catch (e) {\n console.warn(`[WF][terminal] Failed to create terminal RunStep:`, (e as Error).message);\n }\n }\n\n return {\n status: node.status,\n phase: node.id,\n };\n };\n}\n\n// ─── Handler Dispatcher ────────────────────────────────────────────────────\n\n/**\n * Dispatch to the correct handler factory based on node type.\n */\nexport function createNodeHandler(\n node: InternalNode,\n resolveAgent: ResolveAgentFn,\n trackingStore?: WorkflowTrackingStore\n): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>> {\n switch (node.type) {\n case \"agent\":\n return createAgentNode(node as InternalAgentNode, resolveAgent, trackingStore);\n case \"map\":\n return createMapNode(node as InternalMapNode, resolveAgent, trackingStore);\n case \"terminal\":\n return createTerminalNode(node as InternalTerminalNode, trackingStore);\n case \"input\":\n return createInputNode(node as InternalInputNode, trackingStore) as any;\n default:\n throw new Error(`Unknown node type: ${(node as InternalNode).type}`);\n }\n}\n\n// ─── Helpers ───────────────────────────────────────────────────────────────\n\nfunction chunk<T>(arr: T[], size: number): T[][] {\n const result: T[][] = [];\n for (let i = 0; i < arr.length; i += size) {\n result.push(arr.slice(i, i + size));\n }\n return result;\n}\n","import * as yaml from \"js-yaml\";\nimport type {\n InternalDSL,\n InternalNode,\n InternalEdge,\n InternalStateField,\n InternalAgentNode,\n} from \"@axiom-lattice/protocols\";\nimport type {\n YamlWorkflow,\n YamlTopLevelStep,\n YamlAgentStep,\n YamlParallelBlock,\n} from \"@axiom-lattice/protocols\";\nimport { toJsonSchema } from \"./schema\";\n\nfunction nodeId(label: string): string { return `n_${label}`; }\nlet _parallelSeq = 0;\nfunction nextParallelLabel(): string { return `parallel_${_parallelSeq++}`; }\n\nfunction translate(template: string): string {\n return template.replace(/\\{\\{([^}]+)\\}\\}/g, (_m, expr: string) => {\n const t = expr.trim();\n if (t === \"item\") return \"${item}\";\n return `\\${state.${t}}`;\n });\n}\n\n/**\n * Convert condition expression's leading identifier to bracket notation\n * so hyphenated step ids don't break JS parsing.\n * \"classify-doc.intent\" → \"state[\\\"classify-doc\\\"].intent\"\n */\nexport function toSafeStateExpr(expr: string): string {\n const match = expr.match(/^([a-zA-Z_][a-zA-Z0-9_-]*)/);\n if (!match) return `state.${expr}`;\n const field = match[0];\n const rest = expr.slice(field.length);\n return `state[\"${field}\"]${rest}`;\n}\n\n/**\n * Validate that a workflow condition expression is safe to evaluate via new Function().\n * Rejects expressions containing code injection vectors like semicolons, blocks,\n * and dangerous keywords.\n */\nexport function validateExpression(expr: string): void {\n if (/;/.test(expr)) {\n throw new Error(`Condition expression must not contain semicolons: \"${expr}\"`);\n }\n if (/[{}]/.test(expr)) {\n throw new Error(`Condition expression must not contain braces: \"${expr}\"`);\n }\n if (/\\bfunction\\b/.test(expr)) {\n throw new Error(`Condition expression must not contain 'function': \"${expr}\"`);\n }\n if (/\\brequire\\b|\\bimport\\b|\\bmodule\\b/.test(expr)) {\n throw new Error(`Condition expression must not contain require/import: \"${expr}\"`);\n }\n if (/\\bprocess\\b|\\bglobal\\b|\\bglobalThis\\b/.test(expr)) {\n throw new Error(`Condition expression must not contain process/global: \"${expr}\"`);\n }\n if (/\\beval\\b|\\bFunction\\b/.test(expr)) {\n throw new Error(`Condition expression must not contain eval/Function: \"${expr}\"`);\n }\n if (/\\bconstructor\\b|\\b__proto__\\b|\\bprototype\\b/.test(expr)) {\n throw new Error(`Condition expression must not contain prototype access: \"${expr}\"`);\n }\n if (/\\bsetTimeout\\b|\\bsetInterval\\b|\\bbuffer\\b/i.test(expr)) {\n throw new Error(`Condition expression must not contain timer or buffer references: \"${expr}\"`);\n }\n}\n\nexport function parseYaml(yamlStr: string): InternalDSL {\n _parallelSeq = 0;\n let raw: any;\n try {\n raw = yaml.load(yamlStr);\n } catch (e: any) {\n const line = e?.mark?.line != null ? ` (line ${e.mark.line + 1})` : \"\";\n throw new Error(`YAML parse error${line}: ${e.message || e}`);\n }\n if (!raw || typeof raw !== \"object\" || !Array.isArray(raw.steps)) {\n throw new Error(\"Workflow YAML must have 'steps' (array)\");\n }\n const name = typeof raw.name === \"string\" ? raw.name : \"workflow\";\n const wf: YamlWorkflow = {\n name,\n steps: raw.steps.map((s: any, i: number) => parseStep(s, i)),\n };\n return normalize(wf);\n}\n\nfunction parseStep(raw: any, index: number): YamlTopLevelStep {\n // parallel block\n if (raw.parallel !== undefined) {\n if (!Array.isArray(raw.parallel)) {\n throw new Error(`Step at position ${index}: parallel must be an array`);\n }\n const children: YamlAgentStep[] = raw.parallel.map((c: any, ci: number) => {\n const entries = Object.entries(c);\n if (entries.length !== 1) {\n throw new Error(`Parallel child at position ${index}.${ci} must be a single-key mapping`);\n }\n const [label, config] = entries[0] as [string, any];\n return {\n label,\n if: config.if !== undefined ? String(config.if) : undefined,\n prompt: String(config.prompt ?? \"\"),\n output: config.output,\n ask: config.ask === true,\n };\n });\n return {\n parallel: children,\n if: raw.if !== undefined ? String(raw.if) : undefined,\n output: raw.output,\n };\n }\n\n // map step (must be a single-key mapping with `map:` key)\n const entries = Object.entries(raw);\n if (entries.length !== 1) {\n throw new Error(`Step at position ${index} must be a single-key mapping`);\n }\n const [key, config] = entries[0] as [string, any];\n\n // Only named map format is supported: - label: { map: { source, each, ... } }\n // Anonymous map (- map:) is rejected for clarity.\n const mapConfig = config?.map;\n if (mapConfig && typeof mapConfig === \"object\") {\n return {\n map: {\n source: mapConfig.source,\n label: key, // always use the YAML key as the label\n if: mapConfig.if !== undefined ? String(mapConfig.if) : undefined,\n each: {\n prompt: String(mapConfig.each?.prompt ?? \"\"),\n output: mapConfig.each?.output,\n },\n output: mapConfig.output,\n batch: mapConfig.batch,\n concurrency: mapConfig.concurrency,\n },\n };\n }\n\n // Reject anonymous map format\n if (key === \"map\") {\n throw new Error(`Map steps must use named format: - <label>: { map: { source, each, ... } }. Anonymous \"- map:\" is not supported.`);\n }\n\n // agent step\n return {\n label: key,\n if: config.if !== undefined ? String(config.if) : undefined,\n prompt: String(config.prompt ?? \"\"),\n output: config.output,\n ask: config.ask === true,\n };\n}\n\nfunction normalize(wf: YamlWorkflow): InternalDSL {\n validate(wf);\n\n for (const step of wf.steps) {\n if (\"label\" in step) {\n const s = step as YamlAgentStep;\n if (s.if) validateExpression(s.if);\n } else if (\"parallel\" in step) {\n const pb = step as YamlParallelBlock;\n if (pb.if) validateExpression(pb.if);\n for (const child of pb.parallel) {\n if (child.if) validateExpression(child.if);\n }\n }\n }\n\n const nodes: InternalNode[] = [];\n const edges: InternalEdge[] = [];\n const fields: Record<string, InternalStateField> = { input: { type: \"string\" } };\n\n nodes.push({ id: \"n_input\", type: \"input\", name: \"input\", output: { key: \"input\" } });\n edges.push({ from: \"START\", to: \"n_input\" });\n\n let prevNodeId: string | string[] = \"n_input\";\n\n for (const step of wf.steps) {\n if (\"label\" in step) {\n const s = step as YamlAgentStep;\n const nid = nodeId(s.label);\n const schema = toJsonSchema(s.output);\n nodes.push({\n id: nid,\n type: \"agent\",\n name: s.label,\n input: { template: translate(s.prompt) },\n output: { key: s.label, ...(schema ? { schema } : {}) },\n ask: s.ask,\n condition: s.if,\n } as InternalAgentNode);\n fields[s.label] = s.output ? { type: \"object\" } : { type: \"string\" };\n addPrevEdges(edges, prevNodeId, nid);\n prevNodeId = nid;\n } else if (\"parallel\" in step) {\n const pb = step as YamlParallelBlock;\n const groupId = nextParallelLabel();\n const groupNodeIds: string[] = [];\n\n for (const child of pb.parallel) {\n const nid = nodeId(child.label);\n const schema = toJsonSchema(child.output);\n nodes.push({\n id: nid,\n type: \"agent\",\n name: child.label,\n input: { template: translate(child.prompt) },\n output: { key: child.label, ...(schema ? { schema } : {}) },\n ask: child.ask,\n condition: child.if,\n parallelGroup: groupId,\n } as InternalAgentNode);\n fields[child.label] = child.output ? { type: \"object\" } : { type: \"string\" };\n groupNodeIds.push(nid);\n }\n\n addPrevEdges(edges, prevNodeId, groupNodeIds);\n prevNodeId = groupNodeIds;\n } else if (\"map\" in step) {\n const ms = step.map;\n const label = ms.label!;\n const nid = nodeId(label);\n const innerSchema = toJsonSchema(ms.each?.output);\n const mapSchema = toJsonSchema(ms.output);\n nodes.push({\n id: nid,\n type: \"map\",\n name: label,\n source: `state.${ms.source}`,\n itemKey: \"item\",\n config: {\n batchSize: ms.batch ?? 50,\n maxConcurrency: ms.concurrency ?? 5,\n innerConcurrency: ms.concurrency ?? 5,\n },\n node: {\n type: \"agent\",\n input: ms.each?.prompt ? { template: translate(ms.each.prompt) } : undefined,\n ...(innerSchema ? { schema: innerSchema } : {}),\n },\n output: { key: label, ...(mapSchema ? { schema: mapSchema } : {}) },\n condition: ms.if,\n } as any);\n fields[label] = { type: \"array\", default: [] };\n addPrevEdges(edges, prevNodeId, nid);\n prevNodeId = nid;\n }\n }\n\n const termNid = nodeId(\"__end\");\n nodes.push({ id: termNid, type: \"terminal\", name: \"__end\", status: \"success\" });\n\n addPrevEdges(edges, prevNodeId, termNid);\n\n return { version: \"1.0\", name: wf.name || \"workflow\", state: { fields }, nodes, edges };\n}\n\nfunction addPrevEdges(\n edges: InternalEdge[],\n fromNodes: string | string[],\n toNodes: string | string[]\n): void {\n const fromList = Array.isArray(fromNodes) ? fromNodes : [fromNodes];\n const toList = Array.isArray(toNodes) ? toNodes : [toNodes];\n for (const from of fromList) {\n for (const to of toList) {\n if (!edges.some((e) => e.from === from && e.to === to)) {\n edges.push({ from, to });\n }\n }\n }\n}\n\nfunction validate(wf: YamlWorkflow): void {\n const labels = new Set<string>();\n\n for (const step of wf.steps) {\n if (\"label\" in step) {\n const s = step as YamlAgentStep;\n if (labels.has(s.label)) throw new Error(`Duplicate step label \"${s.label}\"`);\n labels.add(s.label);\n } else if (\"parallel\" in step) {\n const pb = step as YamlParallelBlock;\n if (pb.parallel.length === 0) {\n throw new Error(\"parallel block must contain at least one child step\");\n }\n for (const child of pb.parallel) {\n if (labels.has(child.label)) throw new Error(`Duplicate step label \"${child.label}\"`);\n labels.add(child.label);\n }\n } else if (\"map\" in step) {\n const ms = step.map;\n if (labels.has(ms.label!)) throw new Error(`Duplicate step label \"${ms.label}\" (map step)`);\n labels.add(ms.label!);\n }\n }\n}\n","/**\n * Convert shorthand schema notation to standard JSON Schema.\n *\n * Shorthand forms:\n * field: string → { type: \"string\" }\n * field: number → { type: \"number\" }\n * field: boolean → { type: \"boolean\" }\n * field: string[] → { type: \"array\", items: { type: \"string\" } }\n * field: number[] → { type: \"array\", items: { type: \"number\" } }\n * field: boolean[] → { type: \"array\", items: { type: \"boolean\" } }\n * field: [{a: string, b: number}] → { type: \"array\", items: { type: \"object\", ... } }\n * field: {a: string} → { type: \"object\", properties: {a: {type: \"string\"}}, required: [\"a\"] }\n *\n * @param fields Shorthand schema definition\n * @returns Standard JSON Schema or undefined if fields is empty/null\n */\nexport function toJsonSchema(\n fields: Record<string, unknown> | undefined\n): Record<string, unknown> | undefined {\n if (!fields || Object.keys(fields).length === 0) return undefined;\n\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const [key, value] of Object.entries(fields)) {\n required.push(key);\n properties[key] = fieldToSchema(value);\n }\n\n return { type: \"object\", properties, required };\n}\n\nfunction fieldToSchema(value: unknown): Record<string, unknown> {\n if (typeof value === \"string\") return stringTypeToSchema(value);\n\n if (\n Array.isArray(value) &&\n value.length > 0 &&\n typeof value[0] === \"object\" &&\n !Array.isArray(value[0])\n ) {\n const nested = toJsonSchema(value[0] as Record<string, unknown>);\n return { type: \"array\", items: nested ?? { type: \"object\" } };\n }\n\n if (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\n const nested = toJsonSchema(value as Record<string, unknown>);\n return nested ?? { type: \"object\" };\n }\n\n return { type: \"string\" };\n}\n\nfunction stringTypeToSchema(type: string): Record<string, unknown> {\n if (type.endsWith(\"[]\")) {\n const inner = type.slice(0, -2);\n return { type: \"array\", items: stringTypeToSchema(inner) };\n }\n if (type === \"string\") return { type: \"string\" };\n if (type === \"number\") return { type: \"number\" };\n if (type === \"boolean\") return { type: \"boolean\" };\n return { type };\n}\n"],"mappings":";AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;;;ACNP;AAAA,EACE;AAAA,OACK;AAEP,SAAS,cAAc,qBAAuC;;;ACV9D,YAAY,UAAU;;;ACgBf,SAAS,aACd,QACqC;AACrC,MAAI,CAAC,UAAU,OAAO,KAAK,MAAM,EAAE,WAAW,EAAG,QAAO;AAExD,QAAM,aAAsC,CAAC;AAC7C,QAAM,WAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,aAAS,KAAK,GAAG;AACjB,eAAW,GAAG,IAAI,cAAc,KAAK;AAAA,EACvC;AAEA,SAAO,EAAE,MAAM,UAAU,YAAY,SAAS;AAChD;AAEA,SAAS,cAAc,OAAyC;AAC9D,MAAI,OAAO,UAAU,SAAU,QAAO,mBAAmB,KAAK;AAE9D,MACE,MAAM,QAAQ,KAAK,KACnB,MAAM,SAAS,KACf,OAAO,MAAM,CAAC,MAAM,YACpB,CAAC,MAAM,QAAQ,MAAM,CAAC,CAAC,GACvB;AACA,UAAM,SAAS,aAAa,MAAM,CAAC,CAA4B;AAC/D,WAAO,EAAE,MAAM,SAAS,OAAO,UAAU,EAAE,MAAM,SAAS,EAAE;AAAA,EAC9D;AAEA,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,GAAG;AACxE,UAAM,SAAS,aAAa,KAAgC;AAC5D,WAAO,UAAU,EAAE,MAAM,SAAS;AAAA,EACpC;AAEA,SAAO,EAAE,MAAM,SAAS;AAC1B;AAEA,SAAS,mBAAmB,MAAuC;AACjE,MAAI,KAAK,SAAS,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,IAAI,OAAO;AAC5B,QAAI,KAAK,SAAS,YAAY;AAC5B,YAAM,cAAc,IAAI,MAAM,KAAK,CAAC,MAAM;AACxC,cAAM,UAAU,MAAM,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC;AAC9D,eAAO,QAAQ,SAAS,KAAK,EAAE;AAAA,MACjC,CAAC;AACD,UAAI,CAAC,aAAa;AAChB,eAAO,KAAK,EAAE,MAAM,WAAW,SAAS,kBAAkB,KAAK,EAAE,yBAAyB,CAAC;AAAA,MAC7F;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,KAAwB;AAChD,QAAM,SAAS,YAAY,GAAG;AAC9B,QAAM,WAAW,OAAO,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO;AACxD,MAAI,SAAS,SAAS,GAAG;AACvB,UAAM,IAAI,MAAM,SAAS,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAAA,EAC3D;AACF;","names":["entries","config","example"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ import { BaseLanguageModelInput, LanguageModelLike, BaseLanguageModel } from '@l
|
|
|
8
8
|
import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
9
9
|
import { ChatResult } from '@langchain/core/outputs';
|
|
10
10
|
import * as _axiom_lattice_protocols from '@axiom-lattice/protocols';
|
|
11
|
-
import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, A2AApiKeyStore, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, InternalStateField, InternalInput, InternalNode, InternalAgentNode,
|
|
11
|
+
import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, TaskStore, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, ChannelAdapter, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL } from '@axiom-lattice/protocols';
|
|
12
12
|
export { _axiom_lattice_protocols as Protocols };
|
|
13
13
|
export { AgentConfig, AgentType, GraphBuildOptions, MemoryType } from '@axiom-lattice/protocols';
|
|
14
14
|
import * as langchain from 'langchain';
|
|
@@ -952,6 +952,12 @@ declare class MetricsServerManager {
|
|
|
952
952
|
* @param key - Server key (optional, uses default if not provided)
|
|
953
953
|
*/
|
|
954
954
|
getConfig(tenantId: string, key?: string): Promise<MetricsServerConfig>;
|
|
955
|
+
/**
|
|
956
|
+
* Ensure server configs are loaded from the store.
|
|
957
|
+
* Public wrapper around the internal lazy-loading mechanism.
|
|
958
|
+
* Safe to call multiple times — loading happens at most once.
|
|
959
|
+
*/
|
|
960
|
+
ensureLoaded(): Promise<void>;
|
|
955
961
|
/**
|
|
956
962
|
* Check if a metrics server is registered for a tenant
|
|
957
963
|
* @param tenantId - Tenant identifier
|
|
@@ -2608,6 +2614,8 @@ interface AddMessageParams {
|
|
|
2608
2614
|
threadId: string;
|
|
2609
2615
|
tenantId: string;
|
|
2610
2616
|
assistantId: string;
|
|
2617
|
+
workspaceId?: string;
|
|
2618
|
+
projectId?: string;
|
|
2611
2619
|
content: PendingMessageContent;
|
|
2612
2620
|
type?: "human" | "system";
|
|
2613
2621
|
priority?: number;
|
|
@@ -2619,6 +2627,8 @@ interface ThreadInfo {
|
|
|
2619
2627
|
tenantId: string;
|
|
2620
2628
|
assistantId: string;
|
|
2621
2629
|
threadId: string;
|
|
2630
|
+
workspaceId?: string;
|
|
2631
|
+
projectId?: string;
|
|
2622
2632
|
}
|
|
2623
2633
|
/**
|
|
2624
2634
|
* Interface for message queue storage
|
|
@@ -2690,7 +2700,9 @@ type StoreTypeMap = {
|
|
|
2690
2700
|
eval: EvalStore;
|
|
2691
2701
|
channelInstallation: ChannelInstallationStore;
|
|
2692
2702
|
channelBinding: BindingRegistry;
|
|
2703
|
+
menu: MenuRegistry;
|
|
2693
2704
|
a2aApiKey: A2AApiKeyStore;
|
|
2705
|
+
task: TaskStore;
|
|
2694
2706
|
};
|
|
2695
2707
|
/**
|
|
2696
2708
|
* Store type keys
|
|
@@ -2893,6 +2905,10 @@ declare class InMemoryAssistantStore implements AssistantStore {
|
|
|
2893
2905
|
* Check if assistant exists
|
|
2894
2906
|
*/
|
|
2895
2907
|
hasAssistant(tenantId: string, id: string): Promise<boolean>;
|
|
2908
|
+
/**
|
|
2909
|
+
* Get assistant by owner user ID
|
|
2910
|
+
*/
|
|
2911
|
+
getByOwner(tenantId: string, userId: string): Promise<Assistant | null>;
|
|
2896
2912
|
/**
|
|
2897
2913
|
* Clear all assistants for a tenant (useful for testing)
|
|
2898
2914
|
*/
|
|
@@ -3277,6 +3293,7 @@ declare class InMemoryChannelInstallationStore implements ChannelInstallationSto
|
|
|
3277
3293
|
* @returns Array of matching {@link ChannelInstallation} objects
|
|
3278
3294
|
*/
|
|
3279
3295
|
getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
3296
|
+
getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
3280
3297
|
/**
|
|
3281
3298
|
* Creates a new channel installation for a tenant.
|
|
3282
3299
|
*
|
|
@@ -3460,6 +3477,63 @@ declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
3460
3477
|
resetProcessingToPending(threadId: string): Promise<number>;
|
|
3461
3478
|
}
|
|
3462
3479
|
|
|
3480
|
+
/**
|
|
3481
|
+
* InMemoryTaskStore
|
|
3482
|
+
*
|
|
3483
|
+
* In-memory implementation of TaskStore
|
|
3484
|
+
* Provides CRUD operations for task data stored in memory
|
|
3485
|
+
*/
|
|
3486
|
+
|
|
3487
|
+
/**
|
|
3488
|
+
* In-memory implementation of TaskStore
|
|
3489
|
+
*/
|
|
3490
|
+
declare class InMemoryTaskStore implements TaskStore {
|
|
3491
|
+
private tasks;
|
|
3492
|
+
/**
|
|
3493
|
+
* Create a new task
|
|
3494
|
+
*/
|
|
3495
|
+
create(params: CreateTaskRequest & {
|
|
3496
|
+
tenantId: string;
|
|
3497
|
+
ownerType: string;
|
|
3498
|
+
ownerId: string;
|
|
3499
|
+
}): Promise<TaskItem>;
|
|
3500
|
+
/**
|
|
3501
|
+
* Get task by ID
|
|
3502
|
+
*/
|
|
3503
|
+
getById(tenantId: string, id: string): Promise<TaskItem | null>;
|
|
3504
|
+
/**
|
|
3505
|
+
* List tasks matching filter criteria
|
|
3506
|
+
*/
|
|
3507
|
+
list(filter: TaskListFilter): Promise<TaskItem[]>;
|
|
3508
|
+
/**
|
|
3509
|
+
* Update an existing task
|
|
3510
|
+
*/
|
|
3511
|
+
update(tenantId: string, id: string, updates: UpdateTaskRequest): Promise<TaskItem | null>;
|
|
3512
|
+
/**
|
|
3513
|
+
* Delete a task by ID
|
|
3514
|
+
*/
|
|
3515
|
+
delete(tenantId: string, id: string): Promise<boolean>;
|
|
3516
|
+
/**
|
|
3517
|
+
* Clear all tasks for a tenant (useful for testing)
|
|
3518
|
+
*/
|
|
3519
|
+
clear(tenantId?: string): void;
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
declare class InMemoryMenuStore implements MenuRegistry {
|
|
3523
|
+
private items;
|
|
3524
|
+
list(params: {
|
|
3525
|
+
tenantId: string;
|
|
3526
|
+
menuTarget?: string;
|
|
3527
|
+
}): Promise<MenuItem[]>;
|
|
3528
|
+
getById(id: string): Promise<MenuItem | null>;
|
|
3529
|
+
create(input: CreateMenuItemInput & {
|
|
3530
|
+
tenantId: string;
|
|
3531
|
+
}): Promise<MenuItem>;
|
|
3532
|
+
update(id: string, patch: UpdateMenuItemInput): Promise<MenuItem>;
|
|
3533
|
+
delete(id: string): Promise<void>;
|
|
3534
|
+
clear(): void;
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3463
3537
|
/**
|
|
3464
3538
|
* Embeddings Lattice Interface
|
|
3465
3539
|
* Defines the structure of an embeddings lattice entry
|
|
@@ -4420,6 +4494,23 @@ declare function buildSandboxMetadataEnv(config?: RunSandboxConfig): Record<stri
|
|
|
4420
4494
|
|
|
4421
4495
|
declare function buildNamedVolumeName(prefix: "s" | "a" | "p", ...parts: Array<string | undefined>): string;
|
|
4422
4496
|
|
|
4497
|
+
/**
|
|
4498
|
+
* Channel connection lifecycle.
|
|
4499
|
+
*
|
|
4500
|
+
* When a gateway starts, it should call {@link connectAllChannels} to
|
|
4501
|
+
* establish persistent connections for every enabled channel installation
|
|
4502
|
+
* across ALL tenants.
|
|
4503
|
+
*
|
|
4504
|
+
* Adapters implement the optional {@link ChannelAdapter.connect} method
|
|
4505
|
+
* which handles connection setup, event ingestion, and message dispatch
|
|
4506
|
+
* internally.
|
|
4507
|
+
*/
|
|
4508
|
+
|
|
4509
|
+
interface ConnectAllChannelsOptions {
|
|
4510
|
+
deps?: unknown;
|
|
4511
|
+
}
|
|
4512
|
+
declare function connectAllChannels(getAdapter: (channel: string) => ChannelAdapter | undefined, options?: ConnectAllChannelsOptions): Promise<void>;
|
|
4513
|
+
|
|
4423
4514
|
/**
|
|
4424
4515
|
* Sets the global {@link BindingRegistry} instance used by the channel message router.
|
|
4425
4516
|
*
|
|
@@ -4458,6 +4549,9 @@ declare function setBindingRegistry(r: BindingRegistry): void;
|
|
|
4458
4549
|
*/
|
|
4459
4550
|
declare function getBindingRegistry(): BindingRegistry;
|
|
4460
4551
|
|
|
4552
|
+
declare function setMenuRegistry(r: MenuRegistry): void;
|
|
4553
|
+
declare function getMenuRegistry(): MenuRegistry;
|
|
4554
|
+
|
|
4461
4555
|
/**
|
|
4462
4556
|
* Agent Team - Store Protocols
|
|
4463
4557
|
*
|
|
@@ -5911,8 +6005,8 @@ declare class Agent {
|
|
|
5911
6005
|
assistant_id: string;
|
|
5912
6006
|
thread_id: string;
|
|
5913
6007
|
tenant_id: string;
|
|
5914
|
-
workspace_id: string
|
|
5915
|
-
project_id: string
|
|
6008
|
+
workspace_id: string;
|
|
6009
|
+
project_id: string;
|
|
5916
6010
|
custom_run_config: any;
|
|
5917
6011
|
queueMode: ThreadQueueConfig;
|
|
5918
6012
|
private isWaitingForQueueEnd;
|
|
@@ -5958,9 +6052,39 @@ declare class Agent {
|
|
|
5958
6052
|
invoke(queueMessage: QueueMessage, signal?: AbortSignal): Promise<{
|
|
5959
6053
|
messages: any;
|
|
5960
6054
|
}>;
|
|
6055
|
+
/**
|
|
6056
|
+
* Like {@link invoke} but returns the full LangGraph state (all annotations)
|
|
6057
|
+
* instead of only messages. Messages are serialized to dicts; other state
|
|
6058
|
+
* fields are returned as-is.
|
|
6059
|
+
*
|
|
6060
|
+
* @remarks
|
|
6061
|
+
* Only call this when you need the full state. Existing callers (gateway,
|
|
6062
|
+
* workflows) should keep using {@link invoke} which returns only messages
|
|
6063
|
+
* to avoid exposing internal annotation data.
|
|
6064
|
+
*/
|
|
6065
|
+
invokeWithState(queueMessage: QueueMessage, signal?: AbortSignal): Promise<{
|
|
6066
|
+
messages: {
|
|
6067
|
+
role: string;
|
|
6068
|
+
content: string;
|
|
6069
|
+
name: string | undefined;
|
|
6070
|
+
tool_call_id: string | undefined;
|
|
6071
|
+
additional_kwargs?: Record<string, any>;
|
|
6072
|
+
response_metadata?: Record<string, any>;
|
|
6073
|
+
id?: string;
|
|
6074
|
+
}[];
|
|
6075
|
+
}>;
|
|
5961
6076
|
private agentExecutor;
|
|
5962
6077
|
getPendingMessages(): Promise<PendingMessage[]>;
|
|
5963
6078
|
private agentStreamExecutor;
|
|
6079
|
+
private consumeAgentStream;
|
|
6080
|
+
/**
|
|
6081
|
+
* Resume LangGraph execution from the last checkpoint.
|
|
6082
|
+
*
|
|
6083
|
+
* Streams with `null` input — this tells LangGraph to continue from
|
|
6084
|
+
* wherever it left off using the checkpointed state for this thread.
|
|
6085
|
+
* All output chunks are buffered via {@link addChunk}.
|
|
6086
|
+
*/
|
|
6087
|
+
private resumeGraphFromCheckpoint;
|
|
5964
6088
|
private waitingForQueueEnd;
|
|
5965
6089
|
private getQueueStore;
|
|
5966
6090
|
private getDefaultQueueConfig;
|
|
@@ -6066,9 +6190,14 @@ declare class Agent {
|
|
|
6066
6190
|
/**
|
|
6067
6191
|
* Resume processing after a server restart.
|
|
6068
6192
|
*
|
|
6069
|
-
*
|
|
6070
|
-
*
|
|
6071
|
-
*
|
|
6193
|
+
* If the graph was mid-execution (BUSY) it resumes from the LangGraph
|
|
6194
|
+
* checkpoint without re-injecting the message — the message has already
|
|
6195
|
+
* been consumed and is in the graph state. Processing messages are removed
|
|
6196
|
+
* rather than replayed.
|
|
6197
|
+
*
|
|
6198
|
+
* Skips threads that are in `INTERRUPTED` state (the interruption was
|
|
6199
|
+
* intentional). IDLE threads simply clean up and restart the queue
|
|
6200
|
+
* processor for any remaining pending messages.
|
|
6072
6201
|
*
|
|
6073
6202
|
* Called during gateway startup to recover threads that were mid-execution
|
|
6074
6203
|
* when the server went down.
|
|
@@ -6426,6 +6555,8 @@ interface UnknownToolHandlerConfig {
|
|
|
6426
6555
|
*/
|
|
6427
6556
|
declare function createUnknownToolHandlerMiddleware(config?: UnknownToolHandlerConfig): AgentMiddleware;
|
|
6428
6557
|
|
|
6558
|
+
declare function createTaskMiddleware(): AgentMiddleware;
|
|
6559
|
+
|
|
6429
6560
|
type ResolveAgentFn = (ref?: string, responseFormat?: Record<string, unknown>, stepType?: string) => Promise<AgentClient>;
|
|
6430
6561
|
/**
|
|
6431
6562
|
* Build a LangGraph Annotation.Root from DSL state.fields.
|
|
@@ -6486,15 +6617,6 @@ declare function invokeWithRetry<T>(fn: () => Promise<T>, maxRetries: number, re
|
|
|
6486
6617
|
* extracts output, and returns a state update.
|
|
6487
6618
|
*/
|
|
6488
6619
|
declare function createAgentNode(node: InternalAgentNode, resolveAgent: ResolveAgentFn, trackingStore?: WorkflowTrackingStore): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>>;
|
|
6489
|
-
/**
|
|
6490
|
-
* Create a handler for a `human_feedback` node.
|
|
6491
|
-
*
|
|
6492
|
-
* Invokes an agent with the rendered prompt. The agent can use the
|
|
6493
|
-
* `ask_user_to_clarify` tool to ask the user structured questions;
|
|
6494
|
-
* the clarify middleware handles the interrupt/resume cycle automatically.
|
|
6495
|
-
* Agent output is extracted and written to state.
|
|
6496
|
-
*/
|
|
6497
|
-
declare function createHumanFeedbackNode(node: InternalHumanFeedbackNode, resolveAgent: ResolveAgentFn, trackingStore?: WorkflowTrackingStore): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>>;
|
|
6498
6620
|
/**
|
|
6499
6621
|
* Create a handler for a `map` node.
|
|
6500
6622
|
*
|
|
@@ -6503,13 +6625,6 @@ declare function createHumanFeedbackNode(node: InternalHumanFeedbackNode, resolv
|
|
|
6503
6625
|
* and optionally calls a reduce agent to aggregate results.
|
|
6504
6626
|
*/
|
|
6505
6627
|
declare function createMapNode(node: InternalMapNode, resolveAgent: ResolveAgentFn, trackingStore?: WorkflowTrackingStore): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>>;
|
|
6506
|
-
/**
|
|
6507
|
-
* Create a handler for a `terminal` node.
|
|
6508
|
-
*
|
|
6509
|
-
* Sets the status field in state and finalizes the WorkflowRun tracking record.
|
|
6510
|
-
* An implicit edge to END is added during graph compilation.
|
|
6511
|
-
*/
|
|
6512
|
-
declare function createTerminalNode(node: InternalTerminalNode, trackingStore?: WorkflowTrackingStore): (state: Record<string, unknown>) => Promise<Partial<Record<string, unknown>>>;
|
|
6513
6628
|
/**
|
|
6514
6629
|
* Dispatch to the correct handler factory based on node type.
|
|
6515
6630
|
*/
|
|
@@ -6518,19 +6633,19 @@ declare function createNodeHandler(node: InternalNode, resolveAgent: ResolveAgen
|
|
|
6518
6633
|
/**
|
|
6519
6634
|
* Workflow DSL → LangGraph StateGraph compiler
|
|
6520
6635
|
*
|
|
6521
|
-
* Takes a
|
|
6522
|
-
* and compiles
|
|
6636
|
+
* Takes a YAML workflow string, parses it via parseYaml(),
|
|
6637
|
+
* and compiles the resulting InternalDSL into a runnable LangGraph StateGraph.
|
|
6523
6638
|
*/
|
|
6524
6639
|
|
|
6525
6640
|
/**
|
|
6526
|
-
* Compile a
|
|
6527
|
-
*
|
|
6528
|
-
* @param dsl The WorkflowDSL definition
|
|
6529
|
-
* @param resolveAgent Function to resolve agent ref → CompiledStateGraph
|
|
6530
|
-
* @param checkpointer Checkpoint saver for state persistence
|
|
6531
|
-
* @returns Compiled LangGraph StateGraph ready for invocation
|
|
6641
|
+
* Compile a YAML workflow string into a LangGraph StateGraph.
|
|
6532
6642
|
*/
|
|
6533
|
-
declare function compileWorkflow(
|
|
6643
|
+
declare function compileWorkflow(yamlStr: string, resolveAgent: ResolveAgentFn, checkpointer: BaseCheckpointSaver, trackingStore?: WorkflowTrackingStore): CompiledStateGraph<any, any, any, any, any>;
|
|
6644
|
+
/**
|
|
6645
|
+
* Compile an InternalDSL directly into a LangGraph StateGraph.
|
|
6646
|
+
* Used internally by compileWorkflow and for lower-level access.
|
|
6647
|
+
*/
|
|
6648
|
+
declare function compileInternal(ir: InternalDSL, resolveAgent: ResolveAgentFn, checkpointer: BaseCheckpointSaver, trackingStore?: WorkflowTrackingStore): CompiledStateGraph<any, any, any, any, any>;
|
|
6534
6649
|
interface WorkflowValidationError {
|
|
6535
6650
|
type: "error" | "warning";
|
|
6536
6651
|
message: string;
|
|
@@ -6539,9 +6654,79 @@ interface WorkflowValidationError {
|
|
|
6539
6654
|
declare function validateDSL(dsl: InternalDSL): WorkflowValidationError[];
|
|
6540
6655
|
|
|
6541
6656
|
/**
|
|
6542
|
-
*
|
|
6657
|
+
* Convert condition expression's leading identifier to bracket notation
|
|
6658
|
+
* so hyphenated step ids don't break JS parsing.
|
|
6659
|
+
* "classify-doc.intent" → "state[\"classify-doc\"].intent"
|
|
6543
6660
|
*/
|
|
6661
|
+
declare function toSafeStateExpr(expr: string): string;
|
|
6662
|
+
declare function parseYaml(yamlStr: string): InternalDSL;
|
|
6544
6663
|
|
|
6545
|
-
|
|
6664
|
+
/**
|
|
6665
|
+
* Convert shorthand schema notation to standard JSON Schema.
|
|
6666
|
+
*
|
|
6667
|
+
* Shorthand forms:
|
|
6668
|
+
* field: string → { type: "string" }
|
|
6669
|
+
* field: number → { type: "number" }
|
|
6670
|
+
* field: boolean → { type: "boolean" }
|
|
6671
|
+
* field: string[] → { type: "array", items: { type: "string" } }
|
|
6672
|
+
* field: number[] → { type: "array", items: { type: "number" } }
|
|
6673
|
+
* field: boolean[] → { type: "array", items: { type: "boolean" } }
|
|
6674
|
+
* field: [{a: string, b: number}] → { type: "array", items: { type: "object", ... } }
|
|
6675
|
+
* field: {a: string} → { type: "object", properties: {a: {type: "string"}}, required: ["a"] }
|
|
6676
|
+
*
|
|
6677
|
+
* @param fields Shorthand schema definition
|
|
6678
|
+
* @returns Standard JSON Schema or undefined if fields is empty/null
|
|
6679
|
+
*/
|
|
6680
|
+
declare function toJsonSchema(fields: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
6681
|
+
|
|
6682
|
+
/**
|
|
6683
|
+
* Global singleton for personal assistant default configuration.
|
|
6684
|
+
*
|
|
6685
|
+
* Holds the base AgentConfig used when users create a personal assistant.
|
|
6686
|
+
* Projects can extend it via `extend()` to add/remove middleware and tools.
|
|
6687
|
+
*
|
|
6688
|
+
* @example
|
|
6689
|
+
* ```ts
|
|
6690
|
+
* import { PersonalAssistantConfig } from "@axiom-lattice/core";
|
|
6691
|
+
*
|
|
6692
|
+
* PersonalAssistantConfig.extend((config) => {
|
|
6693
|
+
* config.middleware.push({ id: "sql", type: "sql", ... });
|
|
6694
|
+
* config.tools.push("my_custom_tool");
|
|
6695
|
+
* config.middleware = config.middleware.filter(m => m.type !== "browser");
|
|
6696
|
+
* });
|
|
6697
|
+
* ```
|
|
6698
|
+
*/
|
|
6699
|
+
declare class PersonalAssistantConfig {
|
|
6700
|
+
private static _config;
|
|
6701
|
+
/**
|
|
6702
|
+
* Get a deep clone of the current default config.
|
|
6703
|
+
* Caller must set `key` before registering as an agent.
|
|
6704
|
+
*/
|
|
6705
|
+
static get(): AgentConfig;
|
|
6706
|
+
/**
|
|
6707
|
+
* Mutate the default config in-place.
|
|
6708
|
+
* Call once at app startup to customize middleware and tools.
|
|
6709
|
+
*
|
|
6710
|
+
* @param fn - Receives the live config object for direct mutation
|
|
6711
|
+
*/
|
|
6712
|
+
static extend(fn: (config: Omit<AgentConfig, "key">) => void): void;
|
|
6713
|
+
/**
|
|
6714
|
+
* Reset config to built-in defaults (useful in tests).
|
|
6715
|
+
*/
|
|
6716
|
+
static reset(): void;
|
|
6717
|
+
/**
|
|
6718
|
+
* Inject name and personality into a config by directly building
|
|
6719
|
+
* the claw middleware's bootstrap file contents.
|
|
6720
|
+
*
|
|
6721
|
+
* IDENTITY.md gets the actual name and personality description.
|
|
6722
|
+
* USER.md gets the user's name pre-filled.
|
|
6723
|
+
* SOUL.md is kept as-is (shared across all personal assistants).
|
|
6724
|
+
*
|
|
6725
|
+
* @param config - The agent config (must be a mutable copy from get())
|
|
6726
|
+
* @param name - Assistant display name (also used as the user's name in USER.md)
|
|
6727
|
+
* @param personality - Personality description for IDENTITY.md
|
|
6728
|
+
*/
|
|
6729
|
+
static render(config: AgentConfig, name: string, personality: string): void;
|
|
6730
|
+
}
|
|
6546
6731
|
|
|
6547
|
-
export { AGENT_TASK_EVENT, type AddMessageParams, Agent, type AgentClient, type AgentExecutor, AgentInstanceManager, type AgentLattice, AgentLatticeManager, type AgentLifecycleEventName, AgentManager, type AgentStreamExecutor, type AgentThreadInterface, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BufferStats, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, type ColumnInfo, CompositeBackend, ConsoleLoggerClient, type CreateProcessingAgentParams, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, InMemoryA2AApiKeyStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryTaskListStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserStore, InMemoryUserTenantLinkStore, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LoggerLattice, LoggerLatticeManager, MAX_LINE_LENGTH, type MailboxMessage, type MailboxStore, type McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MessageCompletedEvent, type MessageFailedEvent, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type PendingMessage, PinoLoggerClient, PostgresDatabase, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, QueueMode, type QueuePendingEvent, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type ResolveAgentFn, type RunSandboxConfig, type RuntimeModelConfig, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxProvider, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskEvent, type TaskListStore, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TopologyEdge, type UnknownToolHandlerConfig, type VectorStoreLatticeInterface, VectorStoreLatticeManager, VolumeFilesystem, type VolumeFsClient, type WorkflowValidationError, type WriteResult, agentInstanceManager, agentLatticeManager, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, checkEmptyContent, clearEncryptionKeyCache, compileWorkflow, computeSandboxName, configureStores, createAgentNode, createAgentTeam, createExecuteSqlQueryTool, createFileData,
|
|
6732
|
+
export { AGENT_TASK_EVENT, type AddMessageParams, Agent, type AgentClient, type AgentExecutor, AgentInstanceManager, type AgentLattice, AgentLatticeManager, type AgentLifecycleEventName, AgentManager, type AgentStreamExecutor, type AgentThreadInterface, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BufferStats, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, type ColumnInfo, CompositeBackend, type ConnectAllChannelsOptions, ConsoleLoggerClient, type CreateProcessingAgentParams, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, InMemoryA2AApiKeyStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryMenuStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserStore, InMemoryUserTenantLinkStore, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LoggerLattice, LoggerLatticeManager, MAX_LINE_LENGTH, type MailboxMessage, type MailboxStore, type McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MessageCompletedEvent, type MessageFailedEvent, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type PendingMessage, PersonalAssistantConfig, PinoLoggerClient, PostgresDatabase, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, QueueMode, type QueuePendingEvent, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type ResolveAgentFn, type RunSandboxConfig, type RuntimeModelConfig, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxProvider, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskEvent, type TaskListStore, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TopologyEdge, type UnknownToolHandlerConfig, type VectorStoreLatticeInterface, VectorStoreLatticeManager, VolumeFilesystem, type VolumeFsClient, type WorkflowValidationError, type WriteResult, agentInstanceManager, agentLatticeManager, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, checkEmptyContent, clearEncryptionKeyCache, compileInternal, compileWorkflow, computeSandboxName, configureStores, connectAllChannels, createAgentNode, createAgentTeam, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createProcessingAgent, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createSandboxProvider, createSchedulerMiddleware, createTaskMiddleware, createTeamMiddleware, createTeammateTools, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, eventBus, eventBus as eventBusDefault, extractFetcherError, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getQueueLattice, getSandBoxManager, getScheduleLattice, getStoreLattice, getToolClient, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, invokeWithRetry, isBuiltInSkill, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, loggerLatticeManager, mcpManager, metricsServerManager, modelLatticeManager, normalizeSandboxName, parallelLimit, parseCronExpression, parseSkillFrontmatter, parseYaml, performStringReplacement, queueLatticeManager, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, renderTemplate, resolvePath, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, setBindingRegistry, setMenuRegistry, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, updateFileData, validateAgentInput, validateDSL, validateEncryptionKey, validatePath, validateSkillName, validateToolInput, vectorStoreLatticeManager };
|