@robinpath/agent
Advanced tools
| import type { BuiltinHandler, FunctionMetadata, ModuleHost, ModuleMetadata } from "@robinpath/core"; | ||
| export declare function configureAgent(h: ModuleHost): void; | ||
| export declare const AgentFunctions: Record<string, BuiltinHandler>; | ||
| export declare const AgentFunctionMetadata: Record<string, FunctionMetadata>; | ||
| export declare const AgentModuleMetadata: ModuleMetadata; | ||
| //# sourceMappingURL=agent.d.ts.map |
| {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,cAAc,EAGf,MAAM,iBAAiB,CAAC;AAOzB,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAAoB;AA62BvE,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAGzD,CAAC;AAsBF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA+blE,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,cAsBjC,CAAC"} |
+1249
| import { execFileSync } from "child_process"; | ||
| import { createHash } from "crypto"; | ||
| import { appendFileSync, readFileSync, existsSync } from "fs"; | ||
| // ── Module host (unused; agent has no credentials) ───────────────────── | ||
| const state = {}; | ||
| export function configureAgent(h) { state.host = h; } | ||
| // ── Internal State ────────────────────────────────────────────────── | ||
| let pipelineConfig = { | ||
| debug: 0, | ||
| retries: 3, | ||
| budget: 0, | ||
| session: "", | ||
| cache: true, | ||
| timeout: 120_000, | ||
| rateLimit: 0, | ||
| fallback: "", | ||
| onError: "throw", | ||
| dryRun: false, | ||
| keepTemp: false, | ||
| model: "", | ||
| }; | ||
| const stepHistory = []; | ||
| const responseCache = new Map(); | ||
| const contexts = new Map(); | ||
| let debugLevel = 0; | ||
| let logPath = ""; | ||
| let lastRateLimitTime = 0; | ||
| let notifyConfig = { | ||
| enabled: false, | ||
| onError: false, | ||
| onComplete: false, | ||
| transport: "", | ||
| to: "", | ||
| }; | ||
| // ── Internal Helpers ──────────────────────────────────────────────── | ||
| function debugLog(level, ...parts) { | ||
| if (debugLevel >= level) { | ||
| const msg = `[agent:debug:${level}] ${parts.map((p) => (typeof p === "object" ? JSON.stringify(p) : String(p))).join(" ")}`; | ||
| console.error(msg); | ||
| if (logPath) { | ||
| try { | ||
| appendFileSync(logPath, msg + "\n"); | ||
| } | ||
| catch { /* ignore log write errors */ } | ||
| } | ||
| } | ||
| } | ||
| function cacheKey(question, attachments) { | ||
| const data = question + (attachments ? attachments.join("|") : ""); | ||
| return createHash("sha256").update(data).digest("hex"); | ||
| } | ||
| function stripFences(text) { | ||
| const trimmed = text.trim(); | ||
| const match = trimmed.match(/^```(?:\w+)?\s*\n([\s\S]*?)\n\s*```$/); | ||
| if (match) | ||
| return match[1].trim(); | ||
| return trimmed; | ||
| } | ||
| function parseCsvLine(line) { | ||
| const fields = []; | ||
| let current = ""; | ||
| let inQuotes = false; | ||
| for (let i = 0; i < line.length; i++) { | ||
| const ch = line[i]; | ||
| if (inQuotes) { | ||
| if (ch === '"') { | ||
| if (i + 1 < line.length && line[i + 1] === '"') { | ||
| current += '"'; | ||
| i++; | ||
| } | ||
| else { | ||
| inQuotes = false; | ||
| } | ||
| } | ||
| else { | ||
| current += ch; | ||
| } | ||
| } | ||
| else { | ||
| if (ch === '"') { | ||
| inQuotes = true; | ||
| } | ||
| else if (ch === ",") { | ||
| fields.push(current.trim()); | ||
| current = ""; | ||
| } | ||
| else { | ||
| current += ch; | ||
| } | ||
| } | ||
| } | ||
| fields.push(current.trim()); | ||
| return fields; | ||
| } | ||
| function parseResponse(raw, format) { | ||
| const cleaned = stripFences(raw); | ||
| switch (format) { | ||
| case "TEXT": | ||
| case "MARKDOWN": | ||
| case "CODE": | ||
| case "HTML": | ||
| case "XML": | ||
| case "YAML": | ||
| return cleaned; | ||
| case "NUMBER": { | ||
| // Extract first number-like sequence from the response | ||
| const numMatch = cleaned.match(/-?\d+(?:\.\d+)?/); | ||
| if (!numMatch) | ||
| throw new Error(`Could not parse NUMBER from response: "${cleaned.slice(0, 100)}"`); | ||
| const num = parseFloat(numMatch[0]); | ||
| if (isNaN(num)) | ||
| throw new Error(`Could not parse NUMBER from response: "${cleaned.slice(0, 100)}"`); | ||
| return num; | ||
| } | ||
| case "BOOLEAN": { | ||
| const lower = cleaned.toLowerCase().trim(); | ||
| if (lower === "true" || lower === "yes" || lower === "1") | ||
| return true; | ||
| if (lower === "false" || lower === "no" || lower === "0") | ||
| return false; | ||
| throw new Error(`Could not parse BOOLEAN from response: "${cleaned.slice(0, 100)}"`); | ||
| } | ||
| case "JSON": { | ||
| try { | ||
| return JSON.parse(cleaned); | ||
| } | ||
| catch { | ||
| // Try to extract JSON object/array from the response | ||
| const jsonMatch = cleaned.match(/(\{[\s\S]*\}|\[[\s\S]*\])/); | ||
| if (jsonMatch) | ||
| return JSON.parse(jsonMatch[1]); | ||
| throw new Error(`Could not parse JSON from response: "${cleaned.slice(0, 100)}"`); | ||
| } | ||
| } | ||
| case "ARRAY": { | ||
| try { | ||
| const parsed = JSON.parse(cleaned); | ||
| if (Array.isArray(parsed)) | ||
| return parsed; | ||
| throw new Error("Parsed value is not an array"); | ||
| } | ||
| catch { | ||
| const arrMatch = cleaned.match(/\[[\s\S]*\]/); | ||
| if (arrMatch) { | ||
| const parsed = JSON.parse(arrMatch[0]); | ||
| if (Array.isArray(parsed)) | ||
| return parsed; | ||
| } | ||
| throw new Error(`Could not parse ARRAY from response: "${cleaned.slice(0, 100)}"`); | ||
| } | ||
| } | ||
| case "CSV": { | ||
| const lines = cleaned.split("\n").map((l) => l.trim()).filter(Boolean); | ||
| return lines.map(parseCsvLine); | ||
| } | ||
| default: | ||
| return cleaned; | ||
| } | ||
| } | ||
| function buildPrompt(question, format, retryAttempt) { | ||
| let prompt = question; | ||
| const formatInstructions = { | ||
| TEXT: "", | ||
| CSV: "\n\nRespond ONLY with CSV data. No headers unless asked. No explanation.", | ||
| JSON: "\n\nRespond ONLY with valid JSON. No explanation, no markdown fences.", | ||
| BOOLEAN: "\n\nRespond with exactly one word: true or false. Nothing else.", | ||
| NUMBER: "\n\nRespond with exactly one number. No units, no explanation.", | ||
| ARRAY: "\n\nRespond ONLY with a JSON array. No explanation, no markdown fences.", | ||
| MARKDOWN: "\n\nRespond in Markdown format.", | ||
| CODE: "\n\nRespond ONLY with code. No explanation.", | ||
| HTML: "\n\nRespond ONLY with HTML. No explanation.", | ||
| XML: "\n\nRespond ONLY with XML. No explanation.", | ||
| YAML: "\n\nRespond ONLY with YAML. No explanation, no markdown fences.", | ||
| }; | ||
| const instruction = formatInstructions[format]; | ||
| if (instruction) | ||
| prompt += instruction; | ||
| // Stricter instructions on retries | ||
| if (retryAttempt > 0) { | ||
| switch (format) { | ||
| case "JSON": | ||
| prompt += " CRITICAL: Output must be parseable by JSON.parse(). Start with { or [."; | ||
| break; | ||
| case "ARRAY": | ||
| prompt += " CRITICAL: Output must be a JSON array parseable by JSON.parse(). Start with [."; | ||
| break; | ||
| case "BOOLEAN": | ||
| prompt += " CRITICAL: Reply with ONLY the word true or false."; | ||
| break; | ||
| case "NUMBER": | ||
| prompt += " CRITICAL: Reply with ONLY a number like 42 or 3.14."; | ||
| break; | ||
| case "CSV": | ||
| prompt += " CRITICAL: Output raw CSV lines only. No markdown fences."; | ||
| break; | ||
| } | ||
| } | ||
| return prompt; | ||
| } | ||
| function executeCliCommand(provider, prompt, attachments, modelOverride) { | ||
| const args = []; | ||
| const model = modelOverride || pipelineConfig.model; | ||
| if (provider === "claude") { | ||
| args.push("-p", prompt, "--output-format", "text"); | ||
| if (model) | ||
| args.push("--model", model); | ||
| if (attachments) { | ||
| for (const att of attachments) { | ||
| if (existsSync(att)) { | ||
| args.push("--file", att); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| else { | ||
| // codex: use --quiet and pass prompt as positional | ||
| args.push("--quiet", prompt); | ||
| if (model) | ||
| args.push("--model", model); | ||
| if (attachments) { | ||
| for (const att of attachments) { | ||
| if (existsSync(att)) { | ||
| args.push("--file", att); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| debugLog(2, `Executing: ${provider}`, model ? `[model:${model}]` : "", args.join(" ").slice(0, 200)); | ||
| const result = execFileSync(provider, args, { | ||
| encoding: "utf-8", | ||
| timeout: pipelineConfig.timeout, | ||
| maxBuffer: 10 * 1024 * 1024, | ||
| windowsHide: true, | ||
| }); | ||
| return result; | ||
| } | ||
| function applyRateLimit() { | ||
| if (pipelineConfig.rateLimit <= 0) | ||
| return; | ||
| const now = Date.now(); | ||
| const minInterval = pipelineConfig.rateLimit; | ||
| const elapsed = now - lastRateLimitTime; | ||
| if (elapsed < minInterval && lastRateLimitTime > 0) { | ||
| const waitMs = minInterval - elapsed; | ||
| debugLog(2, `Rate limiting: waiting ${waitMs}ms`); | ||
| // Blocking sleep using Atomics | ||
| const buf = new SharedArrayBuffer(4); | ||
| const arr = new Int32Array(buf); | ||
| Atomics.wait(arr, 0, 0, waitMs); | ||
| } | ||
| lastRateLimitTime = Date.now(); | ||
| } | ||
| function executeAgentStep(provider, stepName, opts) { | ||
| const question = String(opts.question ?? ""); | ||
| const format = (String(opts.expectedOutput ?? "TEXT").toUpperCase()); | ||
| const condition = opts.condition; | ||
| const attachments = Array.isArray(opts.attachments) | ||
| ? opts.attachments.map(String) | ||
| : opts.attachment | ||
| ? [String(opts.attachment)] | ||
| : undefined; | ||
| const maxRetries = opts.retries != null ? Number(opts.retries) : pipelineConfig.retries; | ||
| const stepModel = opts.model ? String(opts.model) : undefined; | ||
| // Condition check | ||
| if (condition !== undefined && condition !== null && condition !== true && condition !== "true" && condition !== 1) { | ||
| debugLog(1, `Step "${stepName}" skipped: condition is falsy`); | ||
| return null; | ||
| } | ||
| if (!question) | ||
| throw new Error(`agent.${provider}: "question" is required`); | ||
| // Context: prepend conversation history | ||
| const contextId = opts.context ? String(opts.context) : undefined; | ||
| let contextPrefix = ""; | ||
| if (contextId && contexts.has(contextId)) { | ||
| const messages = contexts.get(contextId); | ||
| contextPrefix = messages.map((m) => m.role === "user" ? `User: ${m.content}` : `Assistant: ${m.content}`).join("\n\n") + "\n\nUser: "; | ||
| } | ||
| // Dry run | ||
| if (pipelineConfig.dryRun) { | ||
| debugLog(1, `[DRY RUN] Step "${stepName}": ${provider} prompt="${question.slice(0, 80)}..." format=${format}`); | ||
| return `[DRY_RUN:${format}]`; | ||
| } | ||
| // Cache check | ||
| const key = cacheKey(question, attachments); | ||
| if (pipelineConfig.cache && responseCache.has(key)) { | ||
| debugLog(1, `Cache hit for step "${stepName}"`); | ||
| const cached = responseCache.get(key); | ||
| stepHistory.push({ | ||
| step: stepName, provider, question, format, | ||
| durationMs: 0, cached: true, retries: 0, error: null, | ||
| }); | ||
| return cached; | ||
| } | ||
| // Rate limit | ||
| applyRateLimit(); | ||
| // Execute with retries | ||
| let lastError = null; | ||
| const startTime = Date.now(); | ||
| for (let attempt = 0; attempt <= maxRetries; attempt++) { | ||
| try { | ||
| if (attempt > 0) { | ||
| const backoff = Math.pow(2, attempt - 1) * 1000; | ||
| debugLog(1, `Retry ${attempt}/${maxRetries} for step "${stepName}" (backoff: ${backoff}ms)`); | ||
| const buf = new SharedArrayBuffer(4); | ||
| const arr = new Int32Array(buf); | ||
| Atomics.wait(arr, 0, 0, backoff); | ||
| } | ||
| const basePrompt = buildPrompt(question, format, attempt); | ||
| const prompt = contextPrefix ? contextPrefix + basePrompt : basePrompt; | ||
| const raw = executeCliCommand(provider, prompt, attachments, stepModel); | ||
| debugLog(3, `Raw response: ${raw.slice(0, 500)}`); | ||
| const parsed = parseResponse(raw, format); | ||
| const durationMs = Date.now() - startTime; | ||
| // Record in context | ||
| if (contextId) { | ||
| if (!contexts.has(contextId)) | ||
| contexts.set(contextId, []); | ||
| const msgs = contexts.get(contextId); | ||
| msgs.push({ role: "user", content: question }); | ||
| msgs.push({ role: "assistant", content: raw.trim() }); | ||
| } | ||
| // Cache result | ||
| if (pipelineConfig.cache) { | ||
| responseCache.set(key, parsed); | ||
| } | ||
| stepHistory.push({ | ||
| step: stepName, provider, question, format, | ||
| durationMs, cached: false, retries: attempt, error: null, | ||
| }); | ||
| debugLog(1, `Step "${stepName}" completed in ${durationMs}ms (${attempt} retries)`); | ||
| return parsed; | ||
| } | ||
| catch (err) { | ||
| lastError = err instanceof Error ? err : new Error(String(err)); | ||
| debugLog(1, `Step "${stepName}" attempt ${attempt} failed: ${lastError.message}`); | ||
| } | ||
| } | ||
| // All retries exhausted — handle error based on onError config | ||
| const durationMs = Date.now() - startTime; | ||
| const errorMsg = lastError?.message ?? "Unknown error"; | ||
| stepHistory.push({ | ||
| step: stepName, provider, question, format, | ||
| durationMs, cached: false, retries: maxRetries, error: errorMsg, | ||
| }); | ||
| const errorMode = opts.onError ?? pipelineConfig.onError; | ||
| if (errorMode === "fallback" || (errorMode === "throw" && pipelineConfig.fallback)) { | ||
| const fallbackProvider = pipelineConfig.fallback; | ||
| if (fallbackProvider && fallbackProvider !== provider) { | ||
| debugLog(1, `Falling back to ${fallbackProvider} for step "${stepName}"`); | ||
| try { | ||
| return executeAgentStep(fallbackProvider, stepName + ":fallback", { | ||
| ...opts, | ||
| onError: "throw", // Don't recurse fallback | ||
| }); | ||
| } | ||
| catch (fbErr) { | ||
| debugLog(1, `Fallback also failed: ${fbErr instanceof Error ? fbErr.message : String(fbErr)}`); | ||
| } | ||
| } | ||
| } | ||
| if (errorMode === "skip") { | ||
| debugLog(1, `Step "${stepName}" failed, skipping (onError=skip)`); | ||
| return "__SKIPPED__"; | ||
| } | ||
| throw new Error(`agent.${provider} step "${stepName}" failed after ${maxRetries + 1} attempts: ${errorMsg}`); | ||
| } | ||
| // ── Function Handlers ─────────────────────────────────────────────── | ||
| const pipeline = (args) => { | ||
| const opts = (typeof args[0] === "object" && args[0] !== null ? args[0] : {}); | ||
| if (opts.debug !== undefined) | ||
| pipelineConfig.debug = Number(opts.debug); | ||
| if (opts.retries !== undefined) | ||
| pipelineConfig.retries = Number(opts.retries); | ||
| if (opts.budget !== undefined) | ||
| pipelineConfig.budget = Number(opts.budget); | ||
| if (opts.session !== undefined) | ||
| pipelineConfig.session = String(opts.session); | ||
| if (opts.cache !== undefined) | ||
| pipelineConfig.cache = Boolean(opts.cache); | ||
| if (opts.timeout !== undefined) | ||
| pipelineConfig.timeout = Number(opts.timeout); | ||
| if (opts.rateLimit !== undefined) | ||
| pipelineConfig.rateLimit = Number(opts.rateLimit); | ||
| if (opts.fallback !== undefined) | ||
| pipelineConfig.fallback = String(opts.fallback); | ||
| if (opts.onError !== undefined) | ||
| pipelineConfig.onError = String(opts.onError); | ||
| if (opts.dryRun !== undefined) | ||
| pipelineConfig.dryRun = Boolean(opts.dryRun); | ||
| if (opts.keepTemp !== undefined) | ||
| pipelineConfig.keepTemp = Boolean(opts.keepTemp); | ||
| if (opts.model !== undefined) | ||
| pipelineConfig.model = String(opts.model); | ||
| // Sync debug level | ||
| if (opts.debug !== undefined) | ||
| debugLevel = pipelineConfig.debug; | ||
| debugLog(1, "Pipeline configured:", pipelineConfig); | ||
| return { ...pipelineConfig }; | ||
| }; | ||
| const claude = (args) => { | ||
| const stepName = String(args[0] ?? "unnamed"); | ||
| const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {}); | ||
| return executeAgentStep("claude", stepName, opts); | ||
| }; | ||
| const codex = (args) => { | ||
| const stepName = String(args[0] ?? "unnamed"); | ||
| const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {}); | ||
| return executeAgentStep("codex", stepName, opts); | ||
| }; | ||
| const debug = (args) => { | ||
| const level = Number(args[0] ?? 0); | ||
| debugLevel = Math.max(0, Math.min(3, level)); | ||
| pipelineConfig.debug = debugLevel; | ||
| return debugLevel; | ||
| }; | ||
| const log = (args) => { | ||
| const path = String(args[0] ?? ""); | ||
| logPath = path; | ||
| debugLog(1, `Log file set to: ${path}`); | ||
| return path; | ||
| }; | ||
| const cost = () => { | ||
| const totalMs = stepHistory.reduce((sum, s) => sum + s.durationMs, 0); | ||
| const totalRetries = stepHistory.reduce((sum, s) => sum + s.retries, 0); | ||
| const cacheHits = stepHistory.filter((s) => s.cached).length; | ||
| const errors = stepHistory.filter((s) => s.error !== null).length; | ||
| return { | ||
| steps: stepHistory.length, | ||
| totalMs, | ||
| totalRetries, | ||
| cacheHits, | ||
| errors, | ||
| history: stepHistory.map((s) => ({ | ||
| step: s.step, | ||
| provider: s.provider, | ||
| format: s.format, | ||
| durationMs: s.durationMs, | ||
| cached: s.cached, | ||
| retries: s.retries, | ||
| error: s.error, | ||
| })), | ||
| }; | ||
| }; | ||
| const notify = (args) => { | ||
| const opts = (typeof args[0] === "object" && args[0] !== null ? args[0] : {}); | ||
| if (opts.enabled !== undefined) | ||
| notifyConfig.enabled = Boolean(opts.enabled); | ||
| if (opts.onError !== undefined) | ||
| notifyConfig.onError = Boolean(opts.onError); | ||
| if (opts.onComplete !== undefined) | ||
| notifyConfig.onComplete = Boolean(opts.onComplete); | ||
| if (opts.transport !== undefined) | ||
| notifyConfig.transport = String(opts.transport); | ||
| if (opts.to !== undefined) | ||
| notifyConfig.to = String(opts.to); | ||
| debugLog(1, "Notification configured:", notifyConfig); | ||
| return { ...notifyConfig }; | ||
| }; | ||
| // ── Model Selection ───────────────────────────────────────────────── | ||
| const model = (args) => { | ||
| const modelName = String(args[0] ?? ""); | ||
| if (!modelName) | ||
| return pipelineConfig.model || "default"; | ||
| pipelineConfig.model = modelName; | ||
| debugLog(1, `Default model set to: ${modelName}`); | ||
| return modelName; | ||
| }; | ||
| // ── Prompt Loading ────────────────────────────────────────────────── | ||
| const prompt = (args) => { | ||
| const filePath = String(args[0] ?? ""); | ||
| const vars = (typeof args[1] === "object" && args[1] !== null ? args[1] : {}); | ||
| if (!filePath) | ||
| throw new Error('agent.prompt: file path is required'); | ||
| if (!existsSync(filePath)) | ||
| throw new Error(`agent.prompt: file not found: "${filePath}"`); | ||
| let content = readFileSync(filePath, "utf-8"); | ||
| // Replace {{varName}} placeholders with values | ||
| for (const [key, val] of Object.entries(vars)) { | ||
| const placeholder = new RegExp(`\\{\\{\\s*${key}\\s*\\}\\}`, "g"); | ||
| content = content.replace(placeholder, typeof val === "object" ? JSON.stringify(val) : String(val)); | ||
| } | ||
| debugLog(2, `Loaded prompt from "${filePath}" (${content.length} chars, ${Object.keys(vars).length} vars)`); | ||
| return content; | ||
| }; | ||
| // ── Context Management ────────────────────────────────────────────── | ||
| const context = (args) => { | ||
| const action = String(args[0] ?? "create"); | ||
| const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {}); | ||
| switch (action) { | ||
| case "create": | ||
| case "start": { | ||
| const id = opts.id ? String(opts.id) : `ctx_${Date.now()}`; | ||
| const messages = []; | ||
| // System prompt becomes first "user" message as context framing | ||
| if (opts.system) { | ||
| messages.push({ role: "user", content: `System instructions: ${String(opts.system)}` }); | ||
| messages.push({ role: "assistant", content: "Understood. I will follow these instructions." }); | ||
| } | ||
| contexts.set(id, messages); | ||
| debugLog(1, `Context "${id}" created (${messages.length} initial messages)`); | ||
| return id; | ||
| } | ||
| case "clear": { | ||
| const id = String(opts.id ?? args[1] ?? ""); | ||
| if (contexts.has(id)) { | ||
| contexts.get(id).length = 0; | ||
| debugLog(1, `Context "${id}" cleared`); | ||
| } | ||
| return true; | ||
| } | ||
| case "delete": { | ||
| const id = String(opts.id ?? args[1] ?? ""); | ||
| contexts.delete(id); | ||
| debugLog(1, `Context "${id}" deleted`); | ||
| return true; | ||
| } | ||
| case "get": { | ||
| const id = String(opts.id ?? args[1] ?? ""); | ||
| const msgs = contexts.get(id); | ||
| if (!msgs) | ||
| return null; | ||
| return { id, messages: msgs.length, history: msgs }; | ||
| } | ||
| case "list": { | ||
| const result = {}; | ||
| for (const [id, msgs] of contexts) { | ||
| result[id] = msgs.length; | ||
| } | ||
| return result; | ||
| } | ||
| default: | ||
| throw new Error(`agent.context: unknown action "${action}". Use: create, clear, delete, get, list`); | ||
| } | ||
| }; | ||
| // ── Batch Processing ──────────────────────────────────────────────── | ||
| const batch = (args) => { | ||
| const stepName = String(args[0] ?? "batch"); | ||
| const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {}); | ||
| const items = Array.isArray(opts.items) ? opts.items : []; | ||
| const questionTemplate = String(opts.question ?? ""); | ||
| const format = (String(opts.expectedOutput ?? "TEXT").toUpperCase()); | ||
| const provider = (String(opts.provider ?? "claude")); | ||
| const stepModel = opts.model ? String(opts.model) : undefined; | ||
| const maxRetries = opts.retries != null ? Number(opts.retries) : pipelineConfig.retries; | ||
| if (!questionTemplate) | ||
| throw new Error('agent.batch: "question" template is required'); | ||
| if (items.length === 0) | ||
| return []; | ||
| debugLog(1, `Batch "${stepName}": ${items.length} items, format=${format}`); | ||
| const results = []; | ||
| for (let index = 0; index < items.length; index++) { | ||
| const item = items[index]; | ||
| const itemStr = typeof item === "object" ? JSON.stringify(item) : String(item); | ||
| // Replace {{item}} and {{index}} in the template | ||
| let question = questionTemplate | ||
| .replace(/\{\{\s*item\s*\}\}/g, itemStr) | ||
| .replace(/\{\{\s*index\s*\}\}/g, String(index)); | ||
| // Also replace {{item.field}} for object items | ||
| if (typeof item === "object" && item !== null) { | ||
| const obj = item; | ||
| for (const [key, val] of Object.entries(obj)) { | ||
| const ph = new RegExp(`\\{\\{\\s*item\\.${key}\\s*\\}\\}`, "g"); | ||
| question = question.replace(ph, typeof val === "object" ? JSON.stringify(val) : String(val)); | ||
| } | ||
| } | ||
| const batchStepName = `${stepName}[${index}]`; | ||
| if (pipelineConfig.dryRun) { | ||
| results.push(`[DRY_RUN:${format}]`); | ||
| continue; | ||
| } | ||
| // Cache check | ||
| const key = cacheKey(question); | ||
| if (pipelineConfig.cache && responseCache.has(key)) { | ||
| debugLog(2, `Batch "${batchStepName}" cache hit`); | ||
| results.push(responseCache.get(key)); | ||
| stepHistory.push({ | ||
| step: batchStepName, provider, question, format, | ||
| durationMs: 0, cached: true, retries: 0, error: null, | ||
| }); | ||
| continue; | ||
| } | ||
| // Rate limit | ||
| applyRateLimit(); | ||
| const startTime = Date.now(); | ||
| let lastError = null; | ||
| let success = false; | ||
| for (let attempt = 0; attempt <= maxRetries; attempt++) { | ||
| try { | ||
| if (attempt > 0) { | ||
| const backoff = Math.pow(2, attempt - 1) * 1000; | ||
| const buf = new SharedArrayBuffer(4); | ||
| const arr = new Int32Array(buf); | ||
| Atomics.wait(arr, 0, 0, backoff); | ||
| } | ||
| const fullPrompt = buildPrompt(question, format, attempt); | ||
| const raw = executeCliCommand(provider, fullPrompt, undefined, stepModel); | ||
| const parsed = parseResponse(raw, format); | ||
| if (pipelineConfig.cache) | ||
| responseCache.set(key, parsed); | ||
| results.push(parsed); | ||
| const durationMs = Date.now() - startTime; | ||
| stepHistory.push({ | ||
| step: batchStepName, provider, question, format, | ||
| durationMs, cached: false, retries: attempt, error: null, | ||
| }); | ||
| debugLog(2, `Batch "${batchStepName}" completed (${index + 1}/${items.length})`); | ||
| success = true; | ||
| break; | ||
| } | ||
| catch (err) { | ||
| lastError = err instanceof Error ? err : new Error(String(err)); | ||
| } | ||
| } | ||
| if (!success) { | ||
| const errorMsg = lastError?.message ?? "Unknown error"; | ||
| stepHistory.push({ | ||
| step: batchStepName, provider, question, format, | ||
| durationMs: Date.now() - startTime, cached: false, retries: maxRetries, error: errorMsg, | ||
| }); | ||
| const errorMode = opts.onError ?? pipelineConfig.onError; | ||
| if (errorMode === "skip") { | ||
| results.push("__SKIPPED__"); | ||
| } | ||
| else { | ||
| throw new Error(`agent.batch step "${batchStepName}" failed: ${errorMsg}`); | ||
| } | ||
| } | ||
| } | ||
| debugLog(1, `Batch "${stepName}" complete: ${results.length}/${items.length} items`); | ||
| return results; | ||
| }; | ||
| // ── Classify (sugar) ──────────────────────────────────────────────── | ||
| const classify = (args) => { | ||
| const stepName = String(args[0] ?? "classify"); | ||
| const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {}); | ||
| const text = String(opts.text ?? ""); | ||
| const categories = Array.isArray(opts.categories) ? opts.categories.map(String) : []; | ||
| const provider = (String(opts.provider ?? "claude")); | ||
| if (!text) | ||
| throw new Error('agent.classify: "text" is required'); | ||
| if (categories.length < 2) | ||
| throw new Error('agent.classify: at least 2 "categories" required'); | ||
| const question = `Classify the following text into exactly one of these categories: ${categories.join(", ")}.\n\nText: ${text}\n\nRespond with ONLY the category name. Nothing else.`; | ||
| const result = executeAgentStep(provider, stepName, { | ||
| question, | ||
| expectedOutput: "TEXT", | ||
| model: opts.model, | ||
| context: opts.context, | ||
| }); | ||
| // Fuzzy match to nearest category | ||
| const raw = String(result).trim().toLowerCase(); | ||
| for (const cat of categories) { | ||
| if (raw === cat.toLowerCase() || raw.includes(cat.toLowerCase())) { | ||
| return cat; | ||
| } | ||
| } | ||
| // If no exact match, return raw (best effort) | ||
| debugLog(1, `Classify "${stepName}": no exact category match for "${raw}", returning raw`); | ||
| return String(result).trim(); | ||
| }; | ||
| // ── Extract (sugar) ───────────────────────────────────────────────── | ||
| const extract = (args) => { | ||
| const stepName = String(args[0] ?? "extract"); | ||
| const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {}); | ||
| const text = String(opts.text ?? ""); | ||
| const fields = Array.isArray(opts.fields) ? opts.fields.map(String) : []; | ||
| const provider = (String(opts.provider ?? "claude")); | ||
| if (!text) | ||
| throw new Error('agent.extract: "text" is required'); | ||
| if (fields.length === 0) | ||
| throw new Error('agent.extract: at least one "fields" entry required'); | ||
| const fieldList = fields.map((f) => `"${f}"`).join(", "); | ||
| const question = `Extract the following fields from the text: ${fieldList}.\n\nText: ${text}\n\nRespond with a JSON object containing only these keys: ${fieldList}. If a field is not found, use null.`; | ||
| return executeAgentStep(provider, stepName, { | ||
| question, | ||
| expectedOutput: "JSON", | ||
| model: opts.model, | ||
| context: opts.context, | ||
| }); | ||
| }; | ||
| // ── Guard (validate AI output) ────────────────────────────────────── | ||
| const guard = (args) => { | ||
| const value = args[0]; | ||
| const rules = (typeof args[1] === "object" && args[1] !== null ? args[1] : {}); | ||
| const errors = []; | ||
| // Type check | ||
| if (rules.type) { | ||
| const expectedType = String(rules.type); | ||
| if (expectedType === "array") { | ||
| if (!Array.isArray(value)) | ||
| errors.push(`Expected array, got ${typeof value}`); | ||
| } | ||
| else if (expectedType === "object") { | ||
| if (typeof value !== "object" || value === null || Array.isArray(value)) { | ||
| errors.push(`Expected object, got ${Array.isArray(value) ? "array" : typeof value}`); | ||
| } | ||
| } | ||
| else if (typeof value !== expectedType) { | ||
| errors.push(`Expected ${expectedType}, got ${typeof value}`); | ||
| } | ||
| } | ||
| // Number range | ||
| if (rules.min !== undefined && typeof value === "number") { | ||
| if (value < Number(rules.min)) | ||
| errors.push(`Value ${value} is below minimum ${rules.min}`); | ||
| } | ||
| if (rules.max !== undefined && typeof value === "number") { | ||
| if (value > Number(rules.max)) | ||
| errors.push(`Value ${value} is above maximum ${rules.max}`); | ||
| } | ||
| // String length | ||
| if (rules.minLength !== undefined && typeof value === "string") { | ||
| if (value.length < Number(rules.minLength)) | ||
| errors.push(`String length ${value.length} is below minimum ${rules.minLength}`); | ||
| } | ||
| if (rules.maxLength !== undefined && typeof value === "string") { | ||
| if (value.length > Number(rules.maxLength)) | ||
| errors.push(`String length ${value.length} is above maximum ${rules.maxLength}`); | ||
| } | ||
| // Pattern match | ||
| if (rules.pattern && typeof value === "string") { | ||
| const regex = new RegExp(String(rules.pattern)); | ||
| if (!regex.test(value)) | ||
| errors.push(`Value does not match pattern: ${rules.pattern}`); | ||
| } | ||
| // Enum check | ||
| if (Array.isArray(rules.enum)) { | ||
| const allowed = rules.enum.map(String); | ||
| if (!allowed.includes(String(value))) { | ||
| errors.push(`Value "${value}" is not in allowed values: ${allowed.join(", ")}`); | ||
| } | ||
| } | ||
| // Required fields (for objects) | ||
| if (Array.isArray(rules.required) && typeof value === "object" && value !== null && !Array.isArray(value)) { | ||
| const obj = value; | ||
| for (const field of rules.required) { | ||
| const key = String(field); | ||
| if (obj[key] === undefined || obj[key] === null) { | ||
| errors.push(`Missing required field: "${key}"`); | ||
| } | ||
| } | ||
| } | ||
| // Not empty | ||
| if (rules.notEmpty) { | ||
| if (value === null || value === undefined || value === "" || | ||
| (Array.isArray(value) && value.length === 0) || | ||
| (typeof value === "object" && value !== null && Object.keys(value).length === 0)) { | ||
| errors.push("Value is empty"); | ||
| } | ||
| } | ||
| if (errors.length > 0) { | ||
| const mode = String(rules.onFail ?? "throw"); | ||
| const errorMsg = `Guard failed: ${errors.join("; ")}`; | ||
| debugLog(1, errorMsg); | ||
| if (mode === "default" && rules.defaultValue !== undefined) { | ||
| return rules.defaultValue; | ||
| } | ||
| if (mode === "null") | ||
| return null; | ||
| throw new Error(errorMsg); | ||
| } | ||
| return value; | ||
| }; | ||
| // ── Exports ───────────────────────────────────────────────────────── | ||
| export const AgentFunctions = { | ||
| pipeline, claude, codex, debug, log, cost, notify, | ||
| model, prompt, context, batch, classify, extract, guard, | ||
| }; | ||
| // ── Function metadata (rich PHP-shape) ─────────────────────────────── | ||
| const stepParam = { | ||
| name: "step", | ||
| title: "Step name", | ||
| description: "Identifier used in logs, cost reports, and cache keys.", | ||
| dataType: "string", | ||
| formInputType: "text", | ||
| required: true, | ||
| allowExpression: true, | ||
| placeholder: "my-step", | ||
| }; | ||
| const pipelineErrors = { | ||
| cli_not_found: "The `claude` or `codex` binary is not on PATH.", | ||
| parse_error: "The CLI response could not be parsed into the requested format.", | ||
| guard_failed: "A `guard` rule rejected the value.", | ||
| timeout: "The CLI exceeded the configured timeout.", | ||
| }; | ||
| export const AgentFunctionMetadata = { | ||
| pipeline: { | ||
| title: "Configure pipeline", | ||
| summary: "Set retries, cache, timeouts, fallback, and default model", | ||
| description: "Configure agent execution knobs. All keys are optional; unset values keep their previous value. Call this once near the top of a script.", | ||
| group: "setup", | ||
| action: "write", | ||
| icon: "settings", | ||
| capability: "manage_options", | ||
| sideEffects: [], | ||
| idempotent: false, | ||
| since: "1.0.0", | ||
| tags: ["agent", "pipeline", "config"], | ||
| parameters: [ | ||
| { | ||
| name: "options", | ||
| title: "Options", | ||
| description: "Recognized keys:\n debug : 0..3\n retries : int (default 3)\n budget : USD cap (0 = no cap)\n session : string id\n cache : bool (default true)\n timeout : ms per CLI call (default 120000)\n rateLimit : ms between calls\n fallback : 'claude' | 'codex'\n onError : 'throw' | 'skip' | 'fallback'\n dryRun : bool\n keepTemp : bool\n model : default model id", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 6, | ||
| }, | ||
| ], | ||
| returnType: "object", | ||
| returnDescription: "The merged config.", | ||
| errors: pipelineErrors, | ||
| example: 'agent.pipeline {retries: 3, cache: true, model: "claude-haiku-4-5-20251001"}', | ||
| }, | ||
| claude: { | ||
| title: "Run Claude step", | ||
| summary: "Send a prompt to the Claude Code CLI and parse the response", | ||
| description: "Shells out to the local `claude` CLI with the given prompt and parses the output to `expectedOutput`. Honors the pipeline config (retries, cache, fallback, dryRun).", | ||
| group: "execute", | ||
| action: "write", | ||
| icon: "bot", | ||
| capability: "execute_cli", | ||
| sideEffects: ["spawns_process", "charges_money"], | ||
| idempotent: false, | ||
| since: "1.0.0", | ||
| tags: ["agent", "claude", "llm", "cli"], | ||
| parameters: [ | ||
| stepParam, | ||
| { | ||
| name: "options", | ||
| title: "Options", | ||
| description: "Recognized keys:\n question : prompt (required)\n expectedOutput : TEXT|JSON|ARRAY|NUMBER|BOOLEAN|CSV|MARKDOWN|CODE|HTML|XML|YAML\n model : override default model\n attachments : array of file paths to attach\n attachment : single file shortcut\n condition : if falsy, the step is skipped\n retries : override pipeline.retries\n onError : 'throw' | 'skip' | 'fallback'\n context : context id from agent.context", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 8, | ||
| }, | ||
| ], | ||
| returnType: "any", | ||
| returnDescription: "Parsed output in the requested shape.", | ||
| errors: pipelineErrors, | ||
| example: 'agent.claude "analyze" {question: "What is 2+2?", expectedOutput: "NUMBER"}', | ||
| }, | ||
| codex: { | ||
| title: "Run Codex step", | ||
| summary: "Send a prompt to the OpenAI Codex CLI and parse the response", | ||
| description: "Same contract as `agent.claude` but shells out to `codex` instead of `claude`.", | ||
| group: "execute", | ||
| action: "write", | ||
| icon: "bot", | ||
| capability: "execute_cli", | ||
| sideEffects: ["spawns_process", "charges_money"], | ||
| idempotent: false, | ||
| since: "1.0.0", | ||
| tags: ["agent", "codex", "openai", "cli"], | ||
| parameters: [ | ||
| stepParam, | ||
| { | ||
| name: "options", | ||
| title: "Options", | ||
| description: "Same keys as `agent.claude`.", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 8, | ||
| }, | ||
| ], | ||
| returnType: "any", | ||
| returnDescription: "Parsed output in the requested shape.", | ||
| errors: pipelineErrors, | ||
| example: 'agent.codex "gen" {question: "Write hello world in Python", expectedOutput: "CODE"}', | ||
| }, | ||
| debug: { | ||
| title: "Set debug level", | ||
| summary: "Control verbosity of agent logging", | ||
| description: "0 = silent, 1 = info, 2 = verbose, 3 = trace. Debug lines are written to stderr and (optionally) a log file.", | ||
| group: "diagnostics", | ||
| action: "write", | ||
| icon: "bug", | ||
| capability: "manage_options", | ||
| sideEffects: [], | ||
| idempotent: true, | ||
| since: "1.0.0", | ||
| tags: ["agent", "debug"], | ||
| parameters: [ | ||
| { | ||
| name: "level", | ||
| title: "Level", | ||
| description: "Integer 0–3.", | ||
| dataType: "number", | ||
| formInputType: "number", | ||
| required: true, | ||
| allowExpression: true, | ||
| defaultValue: 0, | ||
| }, | ||
| ], | ||
| returnType: "number", | ||
| returnDescription: "The clamped level.", | ||
| errors: {}, | ||
| example: "agent.debug 1", | ||
| }, | ||
| log: { | ||
| title: "Set log file", | ||
| summary: "Also append debug output to a file", | ||
| description: "Absolute or script-relative path. Existing contents are preserved; new lines are appended.", | ||
| group: "diagnostics", | ||
| action: "write", | ||
| icon: "file-text", | ||
| capability: "upload_files", | ||
| sideEffects: ["modifies_filesystem"], | ||
| idempotent: true, | ||
| since: "1.0.0", | ||
| tags: ["agent", "log"], | ||
| parameters: [ | ||
| { | ||
| name: "path", | ||
| title: "Path", | ||
| description: "Where to append log lines.", | ||
| dataType: "string", | ||
| formInputType: "text", | ||
| required: true, | ||
| allowExpression: true, | ||
| placeholder: "./agent.log", | ||
| }, | ||
| ], | ||
| returnType: "string", | ||
| returnDescription: "The path that was set.", | ||
| errors: {}, | ||
| example: 'agent.log "pipeline.log"', | ||
| }, | ||
| cost: { | ||
| title: "Cost and timing report", | ||
| summary: "Aggregate stats across every executed step", | ||
| description: "Returns a summary of all step executions so far, including total time, cache hits, retries, and errors.", | ||
| group: "diagnostics", | ||
| action: "read", | ||
| icon: "bar-chart", | ||
| capability: "manage_options", | ||
| sideEffects: [], | ||
| idempotent: true, | ||
| since: "1.0.0", | ||
| tags: ["agent", "cost", "report"], | ||
| parameters: [], | ||
| returnType: "object", | ||
| returnDescription: "{ steps, totalMs, totalRetries, cacheHits, errors, history }", | ||
| errors: {}, | ||
| example: "agent.cost", | ||
| }, | ||
| notify: { | ||
| title: "Configure notifications", | ||
| summary: "Pick where pipeline events are sent", | ||
| description: "Stores notification preferences. The pipeline itself does not dispatch notifications — hosts read this config to decide what to do.", | ||
| group: "setup", | ||
| action: "write", | ||
| icon: "bell", | ||
| capability: "manage_options", | ||
| sideEffects: [], | ||
| idempotent: false, | ||
| since: "1.0.0", | ||
| tags: ["agent", "notify"], | ||
| parameters: [ | ||
| { | ||
| name: "options", | ||
| title: "Options", | ||
| description: "{ enabled, onError, onComplete, transport, to }", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 5, | ||
| }, | ||
| ], | ||
| returnType: "object", | ||
| returnDescription: "The merged notify config.", | ||
| errors: {}, | ||
| example: 'agent.notify {enabled: true, onError: true, transport: "gmail", to: "admin@example.com"}', | ||
| }, | ||
| model: { | ||
| title: "Get/set default model", | ||
| summary: "Read or change the fallback model used by steps without an explicit `model`", | ||
| description: "Call with no arg to read; pass a name to set.", | ||
| group: "setup", | ||
| action: "write", | ||
| icon: "cpu", | ||
| capability: "manage_options", | ||
| sideEffects: [], | ||
| idempotent: false, | ||
| since: "1.0.0", | ||
| tags: ["agent", "model"], | ||
| parameters: [ | ||
| { | ||
| name: "modelName", | ||
| title: "Model name", | ||
| description: "e.g. 'claude-haiku-4-5-20251001'. Omit to read the current value.", | ||
| dataType: "string", | ||
| formInputType: "text", | ||
| required: false, | ||
| allowExpression: true, | ||
| }, | ||
| ], | ||
| returnType: "string", | ||
| returnDescription: "The effective model name.", | ||
| errors: {}, | ||
| example: 'agent.model "claude-haiku-4-5-20251001"', | ||
| }, | ||
| prompt: { | ||
| title: "Load prompt template", | ||
| summary: "Read a prompt file and substitute {{variables}}", | ||
| description: "Reads a local file and replaces `{{name}}` placeholders with values from the second argument. Useful for keeping long system prompts out of scripts.", | ||
| group: "helpers", | ||
| action: "read", | ||
| icon: "file-text", | ||
| capability: "read", | ||
| sideEffects: [], | ||
| idempotent: true, | ||
| since: "1.0.0", | ||
| tags: ["agent", "prompt", "template"], | ||
| parameters: [ | ||
| { | ||
| name: "filePath", | ||
| title: "File path", | ||
| description: "Path to the template file.", | ||
| dataType: "string", | ||
| formInputType: "text", | ||
| required: true, | ||
| allowExpression: true, | ||
| }, | ||
| { | ||
| name: "variables", | ||
| title: "Variables", | ||
| description: "{ key: value } substitutions. Objects are JSON-stringified.", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: false, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 4, | ||
| }, | ||
| ], | ||
| returnType: "string", | ||
| returnDescription: "The rendered prompt.", | ||
| errors: {}, | ||
| example: 'agent.prompt "./prompts/analyze.md" {data: $csv}', | ||
| }, | ||
| context: { | ||
| title: "Manage context", | ||
| summary: "Create, inspect, clear, or delete a multi-turn conversation context", | ||
| description: "Pass the returned id to `agent.claude` / `agent.codex` via their `context` option to chain turns.", | ||
| group: "helpers", | ||
| action: "write", | ||
| icon: "layers", | ||
| capability: "manage_options", | ||
| sideEffects: [], | ||
| idempotent: false, | ||
| since: "1.0.0", | ||
| tags: ["agent", "context"], | ||
| parameters: [ | ||
| { | ||
| name: "action", | ||
| title: "Action", | ||
| description: "One of: create, clear, delete, get, list.", | ||
| dataType: "string", | ||
| formInputType: "text", | ||
| required: true, | ||
| allowExpression: true, | ||
| defaultValue: "create", | ||
| }, | ||
| { | ||
| name: "options", | ||
| title: "Options", | ||
| description: "{ id, system }", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: false, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 3, | ||
| }, | ||
| ], | ||
| returnType: "any", | ||
| returnDescription: "The context id (create), map (list), object (get), or boolean (clear/delete).", | ||
| errors: {}, | ||
| example: 'agent.context "create" {system: "You are a data analyst"}', | ||
| }, | ||
| batch: { | ||
| title: "Batch step", | ||
| summary: "Run one prompt per item in an array", | ||
| description: "The question template supports `{{item}}`, `{{index}}`, and `{{item.field}}` placeholders. Honors pipeline cache / rate limit / retries.", | ||
| group: "execute", | ||
| action: "write", | ||
| icon: "layers", | ||
| capability: "execute_cli", | ||
| sideEffects: ["spawns_process", "charges_money"], | ||
| idempotent: false, | ||
| since: "1.0.0", | ||
| tags: ["agent", "batch"], | ||
| parameters: [ | ||
| stepParam, | ||
| { | ||
| name: "options", | ||
| title: "Options", | ||
| description: "Recognized keys:\n items : array\n question : template string with {{item}} / {{index}} / {{item.field}}\n expectedOutput : TEXT|JSON|ARRAY|...\n provider : 'claude' (default) | 'codex'\n model : override\n retries : int\n onError : 'throw' | 'skip'", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 8, | ||
| }, | ||
| ], | ||
| returnType: "array", | ||
| returnDescription: "Array of parsed results (one per input item).", | ||
| errors: pipelineErrors, | ||
| example: 'agent.batch "route" {items: $tickets, question: "Classify: {{item}}", expectedOutput: "JSON"}', | ||
| }, | ||
| classify: { | ||
| title: "Classify step (sugar)", | ||
| summary: "Pick exactly one of the given categories", | ||
| description: "Wraps a Claude/Codex step with a strict classification prompt and fuzzy-matches the answer to the nearest category.", | ||
| group: "helpers", | ||
| action: "write", | ||
| icon: "tag", | ||
| capability: "execute_cli", | ||
| sideEffects: ["spawns_process", "charges_money"], | ||
| idempotent: true, | ||
| since: "1.0.0", | ||
| tags: ["agent", "classify"], | ||
| parameters: [ | ||
| stepParam, | ||
| { | ||
| name: "options", | ||
| title: "Options", | ||
| description: "{ text, categories[], provider, model, context }", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 5, | ||
| }, | ||
| ], | ||
| returnType: "string", | ||
| returnDescription: "The matching category name.", | ||
| errors: pipelineErrors, | ||
| example: 'agent.classify "route" {text: $email, categories: ["billing","support","sales","spam"]}', | ||
| }, | ||
| extract: { | ||
| title: "Extract step (sugar)", | ||
| summary: "Pull named fields out of unstructured text", | ||
| description: "Returns a JSON object with the requested keys. Missing fields become null.", | ||
| group: "helpers", | ||
| action: "write", | ||
| icon: "box-select", | ||
| capability: "execute_cli", | ||
| sideEffects: ["spawns_process", "charges_money"], | ||
| idempotent: true, | ||
| since: "1.0.0", | ||
| tags: ["agent", "extract"], | ||
| parameters: [ | ||
| stepParam, | ||
| { | ||
| name: "options", | ||
| title: "Options", | ||
| description: "{ text, fields[], provider, model, context }", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 5, | ||
| }, | ||
| ], | ||
| returnType: "object", | ||
| returnDescription: "Parsed JSON object.", | ||
| errors: pipelineErrors, | ||
| example: 'agent.extract "parse" {text: $resume, fields: ["name","email","years"]}', | ||
| }, | ||
| guard: { | ||
| title: "Validate value", | ||
| summary: "Enforce type / range / pattern rules on a value", | ||
| description: "Runs a lightweight validator over the value. On failure the handler throws, or returns null / a default value depending on `rules.onFail`.", | ||
| group: "helpers", | ||
| action: "read", | ||
| icon: "shield-check", | ||
| capability: "manage_options", | ||
| sideEffects: [], | ||
| idempotent: true, | ||
| since: "1.0.0", | ||
| tags: ["agent", "guard", "validate"], | ||
| parameters: [ | ||
| { | ||
| name: "value", | ||
| title: "Value", | ||
| description: "The value to check.", | ||
| dataType: "any", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 3, | ||
| }, | ||
| { | ||
| name: "rules", | ||
| title: "Rules", | ||
| description: "Recognized keys:\n type : 'string' | 'number' | 'boolean' | 'object' | 'array'\n min / max : number bounds\n minLength / maxLength : string bounds\n pattern : regex\n enum : allowed values array\n required : array of required object keys\n notEmpty : boolean\n onFail : 'throw' | 'null' | 'default'\n defaultValue : fallback when onFail='default'", | ||
| dataType: "object", | ||
| formInputType: "json", | ||
| required: true, | ||
| allowExpression: true, | ||
| language: "json", | ||
| rows: 6, | ||
| }, | ||
| ], | ||
| returnType: "any", | ||
| returnDescription: "The input value if valid, or null / default on failure.", | ||
| errors: pipelineErrors, | ||
| example: 'agent.guard $score {type: "number", min: 0, max: 100}', | ||
| }, | ||
| }; | ||
| export const AgentModuleMetadata = { | ||
| slug: "agent", | ||
| title: "AI Agent (Claude / Codex CLI)", | ||
| summary: "Drive the local claude and codex CLIs — prompts, parsing, caching, retries, batching, and guards", | ||
| description: "Orchestrate agent-style pipelines on top of the local `claude` and `codex` CLI binaries. Each step is typed (JSON / NUMBER / BOOLEAN / ...), cached by prompt hash, retried with exponential backoff, and tracked in a cost/timing report.\n\nThis module spawns external processes; for hosted LLM calls use the `ai`, `openai`, or `anthropic` modules instead.", | ||
| category: "ai", | ||
| icon: "icon.svg", | ||
| color: "#F97316", | ||
| version: "0.2.0", | ||
| docsUrl: "https://docs.robinpath.com/modules/agent", | ||
| status: "stable", | ||
| requires: [], | ||
| minNodeVersion: "18.0.0", | ||
| credentialsType: null, | ||
| operationGroups: { | ||
| setup: { title: "Setup", description: "Pipeline config and notifications.", order: 1 }, | ||
| execute: { title: "Execute", description: "Run prompts against claude / codex.", order: 2 }, | ||
| helpers: { title: "Helpers", description: "Prompt templating, classify, extract, guard.", order: 3 }, | ||
| diagnostics: { title: "Diagnostics", description: "Debug, log, cost reporting.", order: 4 }, | ||
| }, | ||
| methods: Object.keys(AgentFunctions), | ||
| }; | ||
| //# sourceMappingURL=agent.js.map |
| {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAE9D,0EAA0E;AAC1E,MAAM,KAAK,GAA0B,EAAE,CAAC;AACxC,MAAM,UAAU,cAAc,CAAC,CAAa,IAAU,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;AA6CvE,uEAAuE;AAEvE,IAAI,cAAc,GAAmB;IACnC,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,MAAM,WAAW,GAAiB,EAAE,CAAC;AACrC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;AACjD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;AACrD,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,IAAI,OAAO,GAAG,EAAE,CAAC;AACjB,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAE1B,IAAI,YAAY,GAAi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,OAAO,EAAE,0CAA0C;IACnD,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,QAAQ;IACxB,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE;QACf,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,oCAAoC,EAAE,KAAK,EAAE,CAAC,EAAE;QACtF,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,qCAAqC,EAAE,KAAK,EAAE,CAAC,EAAE;QAC3F,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,8CAA8C,EAAE,KAAK,EAAE,CAAC,EAAE;QACpG,WAAW,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,6BAA6B,EAAE,KAAK,EAAE,CAAC,EAAE;KAC5F;IACD,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;CACrC,CAAC"} |
| import type { ModuleAdapter } from "@robinpath/core"; | ||
| declare const AgentModule: ModuleAdapter; | ||
| export default AgentModule; | ||
| export { AgentModule }; | ||
| export { AgentFunctions, AgentFunctionMetadata, AgentModuleMetadata, configureAgent, } from "./agent.js"; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQrD,QAAA,MAAM,WAAW,EAAE,aASlB,CAAC;AAEF,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACf,MAAM,YAAY,CAAC"} |
| import { AgentFunctions, AgentFunctionMetadata, AgentModuleMetadata, configureAgent, } from "./agent.js"; | ||
| const AgentModule = { | ||
| name: "agent", | ||
| functions: AgentFunctions, | ||
| functionMetadata: AgentFunctionMetadata, | ||
| moduleMetadata: AgentModuleMetadata, | ||
| // No credentials — agent shells out to the local CLIs. | ||
| credentialTypes: [], | ||
| configure: configureAgent, | ||
| global: false, | ||
| }; | ||
| export default AgentModule; | ||
| export { AgentModule }; | ||
| export { AgentFunctions, AgentFunctionMetadata, AgentModuleMetadata, configureAgent, } from "./agent.js"; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,GAAkB;IACjC,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,cAAc;IACzB,gBAAgB,EAAE,qBAAqB;IACvC,cAAc,EAAE,mBAAmB;IACnC,uDAAuD;IACvD,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE,cAAc;IACzB,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACf,MAAM,YAAY,CAAC"} |
+15
-6
| { | ||
| "name": "@robinpath/agent", | ||
| "version": "0.1.2", | ||
| "description": "AI agent integration (Claude Code, OpenAI Codex) for RobinPath pipelines", | ||
| "version": "0.3.0", | ||
| "description": "AI agent pipelines on top of the local Claude Code and OpenAI Codex CLIs — typed outputs, caching, retries, batching.", | ||
| "publishConfig": { | ||
@@ -25,6 +25,6 @@ "access": "public" | ||
| "peerDependencies": { | ||
| "@robinpath/core": ">=0.20.0" | ||
| "@robinpath/core": ">=0.40.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@robinpath/core": "^0.30.1", | ||
| "@robinpath/core": "^0.40.0", | ||
| "tsx": "^4.19.0", | ||
@@ -35,3 +35,5 @@ "typescript": "^5.6.0" | ||
| "agent", | ||
| "ai" | ||
| "ai", | ||
| "claude", | ||
| "codex" | ||
| ], | ||
@@ -43,4 +45,11 @@ "license": "MIT", | ||
| "auth": "none", | ||
| "functionCount": 14 | ||
| "functionCount": 14, | ||
| "runtime": "node", | ||
| "runtimeReason": "Spawns local `claude` and `codex` CLI binaries via child_process.", | ||
| "language": "nodejs", | ||
| "platforms": [ | ||
| "cli", | ||
| "desktop" | ||
| ] | ||
| } | ||
| } |
+1
-1
@@ -22,3 +22,3 @@ # @robinpath/agent | ||
| ```bash | ||
| npm install @robinpath/agent | ||
| robinpath add @robinpath/agent | ||
| ``` | ||
@@ -25,0 +25,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
101655
1986.51%10
400%1276
Infinity%3
200%