@lunora/agent 1.0.0-alpha.152 → 1.0.0-alpha.153
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/channels.d.mts +2 -2
- package/dist/channels.d.ts +2 -2
- package/dist/inbound.d.mts +1 -1
- package/dist/inbound.d.ts +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/jsCodeTool-BLOvjXGF.mjs +18 -0
- package/dist/packem_shared/{types.d-B_VV-x4x.d.mts → types.d-DS2wmzMe.d.mts} +1 -1
- package/dist/packem_shared/{types.d-B_VV-x4x.d.ts → types.d-DS2wmzMe.d.ts} +1 -1
- package/dist/reply.d.mts +1 -1
- package/dist/reply.d.ts +1 -1
- package/dist/sandbox.d.mts +54 -2
- package/dist/sandbox.d.ts +54 -2
- package/dist/sandbox.mjs +1 -1
- package/dist/skill-markdown.d.mts +1 -1
- package/dist/skill-markdown.d.ts +1 -1
- package/package.json +3 -3
package/dist/channels.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentDefinition } from "./packem_shared/types.d-
|
|
2
|
-
export type { I as InboundChannelEvent } from "./packem_shared/types.d-
|
|
1
|
+
import { A as AgentDefinition } from "./packem_shared/types.d-DS2wmzMe.mjs";
|
|
2
|
+
export type { I as InboundChannelEvent } from "./packem_shared/types.d-DS2wmzMe.mjs";
|
|
3
3
|
import '@lunora/mail/inbound';
|
|
4
4
|
import 'ai';
|
|
5
5
|
/**
|
package/dist/channels.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentDefinition } from "./packem_shared/types.d-
|
|
2
|
-
export type { I as InboundChannelEvent } from "./packem_shared/types.d-
|
|
1
|
+
import { A as AgentDefinition } from "./packem_shared/types.d-DS2wmzMe.js";
|
|
2
|
+
export type { I as InboundChannelEvent } from "./packem_shared/types.d-DS2wmzMe.js";
|
|
3
3
|
import '@lunora/mail/inbound';
|
|
4
4
|
import 'ai';
|
|
5
5
|
/**
|
package/dist/inbound.d.mts
CHANGED
package/dist/inbound.d.ts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as AgentDefinition, e as AgentCompact, f as AgentEpisodeExtract, g as AgentGraphExtract, h as AgentGenerate, i as AgentTokenSink, j as AgentRunInput, k as AgentFunctionPaths, l as AgentRunFunction, m as AgentStepLike, n as AgentStreamGenerate, o as AgentRunResult, p as AgentMessageRow, q as AgentConfig,
|
|
2
|
-
export type { B as AgentApprovalContext, C as AgentEmailMapper, D as AgentEmailRun, E as AgentGenerateOptions, F as AgentGenerateResult, G as AgentInstructionsContext, H as AgentLiveEvent, J as AgentMemoryOptions, K as AgentMemorySource, L as AgentMessageStatus, M as AgentOnReply, N as AgentOnStepFinish, O as AgentPrepareStep, P as AgentPrepareStepInput, Q as AgentPrepareStepResult, R as AgentProgressEvent, T as AgentReplyInfo, a as AgentReplyRef, U as AgentRunHandle, V as AgentRunOptions, W as AgentStepFinishInfo, X as AgentStepInfo, Y as AgentThreadStatus, Z as AgentTokenDelta, _ as AgentToolCall,
|
|
1
|
+
import { A as AgentDefinition, e as AgentCompact, f as AgentEpisodeExtract, g as AgentGraphExtract, h as AgentGenerate, i as AgentTokenSink, j as AgentRunInput, k as AgentFunctionPaths, l as AgentRunFunction, m as AgentStepLike, n as AgentStreamGenerate, o as AgentRunResult, p as AgentMessageRow, q as AgentConfig, b as SkillDefinition, r as AnyAgentTool, s as AgentAsToolOptions, t as AgentSubToolInput, c as AgentToolDefinition, u as AgentBindingSpec, v as AgentHandle, w as AgentToolConfig, x as AgentFunctionReference, y as AgentModelInput, z as SkillConfig } from "./packem_shared/types.d-DS2wmzMe.mjs";
|
|
2
|
+
export type { B as AgentApprovalContext, C as AgentEmailMapper, D as AgentEmailRun, E as AgentGenerateOptions, F as AgentGenerateResult, G as AgentInstructionsContext, H as AgentLiveEvent, J as AgentMemoryOptions, K as AgentMemorySource, L as AgentMessageStatus, M as AgentOnReply, N as AgentOnStepFinish, O as AgentPrepareStep, P as AgentPrepareStepInput, Q as AgentPrepareStepResult, R as AgentProgressEvent, T as AgentReplyInfo, a as AgentReplyRef, U as AgentRunHandle, V as AgentRunOptions, W as AgentStepFinishInfo, X as AgentStepInfo, Y as AgentThreadStatus, Z as AgentTokenDelta, _ as AgentToolCall, d as AgentToolContext, $ as AgentUsage, a0 as AgentVoiceConfig, a1 as AgentWorkflowBindingLike, a2 as AgentWorkflowInstanceLike, a3 as EnsureThreadOutcome } from "./packem_shared/types.d-DS2wmzMe.mjs";
|
|
3
3
|
export { type AgentComponent, agentComponent, agentExtension } from "./component.mjs";
|
|
4
4
|
import { FlexibleSchema, LanguageModel, ModelMessage } from 'ai';
|
|
5
|
+
export { type BrowserRenderResult, type BrowserToolInput, type BrowserToolOptions, type ContainerToolInput, type ContainerToolOptions, type FsToolInput, type FsToolOptions, type JsCodeToolInput, type JsCodeToolOptions, type JsCodeToolResult, browserTool, containerTool, fsTool, jsCodeTool } from "./sandbox.mjs";
|
|
5
6
|
export { agentBindingName, agentClassName, agentDefaultName, voiceBindingName, voiceClassName } from "./naming.mjs";
|
|
6
|
-
export { type BrowserRenderResult, type BrowserToolInput, type BrowserToolOptions, type ContainerToolInput, type ContainerToolOptions, type FsToolInput, type FsToolOptions, browserTool, containerTool, fsTool } from "./sandbox.mjs";
|
|
7
7
|
import { createAi } from '@lunora/ai';
|
|
8
8
|
import { WorkflowDefinition } from '@lunora/workflow';
|
|
9
9
|
import '@lunora/mail/inbound';
|
|
@@ -229,8 +229,8 @@ interface CodeToolOptions {
|
|
|
229
229
|
* SCRIPT that composes several of the tools you hand `codeTool` — chaining a
|
|
230
230
|
* later call's input to an earlier call's output — and the whole thing runs in a
|
|
231
231
|
* single turn. This is a SAFE interpreted data-flow between whitelisted tools
|
|
232
|
-
* (no `eval`, no isolate), so it runs natively in workerd; arbitrary
|
|
233
|
-
*
|
|
232
|
+
* (no `eval`, no isolate), so it runs natively in workerd; for arbitrary code
|
|
233
|
+
* in a Worker Loader isolate, see `jsCodeTool`.
|
|
234
234
|
*
|
|
235
235
|
* Each composed tool dispatches through the same durable context a normal call
|
|
236
236
|
* gets (inheriting RLS), with a per-step idempotency key. A code-mode script runs
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as AgentDefinition, e as AgentCompact, f as AgentEpisodeExtract, g as AgentGraphExtract, h as AgentGenerate, i as AgentTokenSink, j as AgentRunInput, k as AgentFunctionPaths, l as AgentRunFunction, m as AgentStepLike, n as AgentStreamGenerate, o as AgentRunResult, p as AgentMessageRow, q as AgentConfig,
|
|
2
|
-
export type { B as AgentApprovalContext, C as AgentEmailMapper, D as AgentEmailRun, E as AgentGenerateOptions, F as AgentGenerateResult, G as AgentInstructionsContext, H as AgentLiveEvent, J as AgentMemoryOptions, K as AgentMemorySource, L as AgentMessageStatus, M as AgentOnReply, N as AgentOnStepFinish, O as AgentPrepareStep, P as AgentPrepareStepInput, Q as AgentPrepareStepResult, R as AgentProgressEvent, T as AgentReplyInfo, a as AgentReplyRef, U as AgentRunHandle, V as AgentRunOptions, W as AgentStepFinishInfo, X as AgentStepInfo, Y as AgentThreadStatus, Z as AgentTokenDelta, _ as AgentToolCall,
|
|
1
|
+
import { A as AgentDefinition, e as AgentCompact, f as AgentEpisodeExtract, g as AgentGraphExtract, h as AgentGenerate, i as AgentTokenSink, j as AgentRunInput, k as AgentFunctionPaths, l as AgentRunFunction, m as AgentStepLike, n as AgentStreamGenerate, o as AgentRunResult, p as AgentMessageRow, q as AgentConfig, b as SkillDefinition, r as AnyAgentTool, s as AgentAsToolOptions, t as AgentSubToolInput, c as AgentToolDefinition, u as AgentBindingSpec, v as AgentHandle, w as AgentToolConfig, x as AgentFunctionReference, y as AgentModelInput, z as SkillConfig } from "./packem_shared/types.d-DS2wmzMe.js";
|
|
2
|
+
export type { B as AgentApprovalContext, C as AgentEmailMapper, D as AgentEmailRun, E as AgentGenerateOptions, F as AgentGenerateResult, G as AgentInstructionsContext, H as AgentLiveEvent, J as AgentMemoryOptions, K as AgentMemorySource, L as AgentMessageStatus, M as AgentOnReply, N as AgentOnStepFinish, O as AgentPrepareStep, P as AgentPrepareStepInput, Q as AgentPrepareStepResult, R as AgentProgressEvent, T as AgentReplyInfo, a as AgentReplyRef, U as AgentRunHandle, V as AgentRunOptions, W as AgentStepFinishInfo, X as AgentStepInfo, Y as AgentThreadStatus, Z as AgentTokenDelta, _ as AgentToolCall, d as AgentToolContext, $ as AgentUsage, a0 as AgentVoiceConfig, a1 as AgentWorkflowBindingLike, a2 as AgentWorkflowInstanceLike, a3 as EnsureThreadOutcome } from "./packem_shared/types.d-DS2wmzMe.js";
|
|
3
3
|
export { type AgentComponent, agentComponent, agentExtension } from "./component.js";
|
|
4
4
|
import { FlexibleSchema, LanguageModel, ModelMessage } from 'ai';
|
|
5
|
+
export { type BrowserRenderResult, type BrowserToolInput, type BrowserToolOptions, type ContainerToolInput, type ContainerToolOptions, type FsToolInput, type FsToolOptions, type JsCodeToolInput, type JsCodeToolOptions, type JsCodeToolResult, browserTool, containerTool, fsTool, jsCodeTool } from "./sandbox.js";
|
|
5
6
|
export { agentBindingName, agentClassName, agentDefaultName, voiceBindingName, voiceClassName } from "./naming.js";
|
|
6
|
-
export { type BrowserRenderResult, type BrowserToolInput, type BrowserToolOptions, type ContainerToolInput, type ContainerToolOptions, type FsToolInput, type FsToolOptions, browserTool, containerTool, fsTool } from "./sandbox.js";
|
|
7
7
|
import { createAi } from '@lunora/ai';
|
|
8
8
|
import { WorkflowDefinition } from '@lunora/workflow';
|
|
9
9
|
import '@lunora/mail/inbound';
|
|
@@ -229,8 +229,8 @@ interface CodeToolOptions {
|
|
|
229
229
|
* SCRIPT that composes several of the tools you hand `codeTool` — chaining a
|
|
230
230
|
* later call's input to an earlier call's output — and the whole thing runs in a
|
|
231
231
|
* single turn. This is a SAFE interpreted data-flow between whitelisted tools
|
|
232
|
-
* (no `eval`, no isolate), so it runs natively in workerd; arbitrary
|
|
233
|
-
*
|
|
232
|
+
* (no `eval`, no isolate), so it runs natively in workerd; for arbitrary code
|
|
233
|
+
* in a Worker Loader isolate, see `jsCodeTool`.
|
|
234
234
|
*
|
|
235
235
|
* Each composed tool dispatches through the same durable context a normal call
|
|
236
236
|
* gets (inheriting RLS), with a per-step idempotency key. A code-mode script runs
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,s as r}from"./packem_shared/agent-loop-CR27O7MC.mjs";import{collectAgenticMemoryTools as a,toSearchResults as
|
|
1
|
+
import{r as t,s as r}from"./packem_shared/agent-loop-CR27O7MC.mjs";import{collectAgenticMemoryTools as a,toSearchResults as f}from"./packem_shared/collectAgenticMemoryTools-BeMWT2qt.mjs";import{agentAsTool as l}from"./packem_shared/agentAsTool-CgZb6ycK.mjs";import{codeTool as m}from"./packem_shared/codeTool-BQb-K3my.mjs";import{agentComponent as c,agentExtension as x}from"./component.mjs";import{default as A}from"./packem_shared/createAgentContext-BVy7RzqD.mjs";import{defineAgent as d,defineAgentTool as u,isAgentDefinition as N}from"./packem_shared/defineAgent-uEeT0WuM.mjs";import{functionTool as D}from"./packem_shared/functionTool-D3CP4f8-.mjs";import{createAgentGenerate as C,createEpisodeExtract as M,createGraphExtract as O,createStreamGenerate as _,resolveAgentModel as G}from"./packem_shared/createAgentGenerate-BOILDUZj.mjs";import{jsCodeTool as F}from"./packem_shared/jsCodeTool-BLOvjXGF.mjs";import{adaptMcpResult as U,mcpTools as k}from"./packem_shared/adaptMcpResult-CVlq-_TO.mjs";import{buildModelMessages as R}from"./packem_shared/buildModelMessages-Y4tGo1T9.mjs";import{agentBindingName as b,agentClassName as h,agentDefaultName as w,voiceBindingName as H,voiceClassName as I}from"./naming.mjs";import{AGENT_MODULE as X,DEFAULT_AGENT_FUNCTION_PATHS as j,SANDBOX_INVOKE_PATH as y,SANDBOX_MODULE as K,toFunctionReference as W}from"./packem_shared/AGENT_MODULE-M4D1EejI.mjs";import{browserTool as z,containerTool as J,fsTool as Q}from"./sandbox.mjs";import{defineSkill as Z,isSkillDefinition as $}from"./packem_shared/defineSkill-DGGvDWNq.mjs";import{default as oe}from"./packem_shared/VoiceSessionDO-BkPBpwRR.mjs";import{r as re}from"./packem_shared/voice-turn-7a1NoDHS.mjs";import{default as ae}from"./packem_shared/compileAgentWorkflow-D3BN5OWk.mjs";export{X as AGENT_MODULE,j as DEFAULT_AGENT_FUNCTION_PATHS,y as SANDBOX_INVOKE_PATH,K as SANDBOX_MODULE,oe as VoiceSessionDO,U as adaptMcpResult,l as agentAsTool,b as agentBindingName,h as agentClassName,c as agentComponent,w as agentDefaultName,x as agentExtension,z as browserTool,R as buildModelMessages,m as codeTool,a as collectAgenticMemoryTools,ae as compileAgentWorkflow,J as containerTool,A as createAgentContext,C as createAgentGenerate,M as createEpisodeExtract,O as createGraphExtract,_ as createStreamGenerate,d as defineAgent,u as defineAgentTool,Z as defineSkill,Q as fsTool,D as functionTool,N as isAgentDefinition,$ as isSkillDefinition,F as jsCodeTool,k as mcpTools,G as resolveAgentModel,t as runAgentLoop,re as runVoiceTurn,r as splitForCompaction,W as toFunctionReference,f as toSearchResults,H as voiceBindingName,I as voiceClassName};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{LunoraError as m}from"@lunora/errors";import{jsonSchema as y}from"ai";const u="LOADER",b="2026-04-07",S=1e3,f=100,v=2e3,g=256*1024,p=3e4,T="Run JavaScript in an isolated sandbox and get its result. Provide `code`: the body of an async function — `return` the answer. Use it for calculation, parsing and data transformation. The sandbox has no network, no bindings and no tools; `console.log` output is returned as `logs`.",h=y({additionalProperties:!1,properties:{code:{description:"The body of an async function. `return` the result; it must be JSON-serializable.",type:"string"}},required:["code"],type:"object"}),w=e=>`const logs = [];
|
|
2
|
+
const format = (value) => { if (typeof value === "string") return value; try { return JSON.stringify(value); } catch { return String(value); } };
|
|
3
|
+
const record = (...values) => { if (logs.length < ${String(f)}) logs.push(values.map(format).join(" ")); };
|
|
4
|
+
const sandboxConsole = { debug: record, error: record, info: record, log: record, warn: record };
|
|
5
|
+
const run = async (console) => {
|
|
6
|
+
${e}
|
|
7
|
+
};
|
|
8
|
+
export default {
|
|
9
|
+
async fetch() {
|
|
10
|
+
try {
|
|
11
|
+
const value = await run(sandboxConsole);
|
|
12
|
+
return new Response(JSON.stringify({ logs, value: value === undefined ? null : value }));
|
|
13
|
+
} catch (error) {
|
|
14
|
+
return new Response(JSON.stringify({ error: error instanceof Error ? (error.stack ?? error.message) : String(error), logs }));
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
`,E=e=>e instanceof Error?e.message:String(e),_=async(e,r)=>{const o=e.body?.getReader();if(o===void 0)return"";const t=new TextDecoder;let n="",a=0;for(;;){const{done:s,value:i}=await o.read();if(s)break;if(a+=i.byteLength,a>r){await o.cancel();return}n+=t.decode(i,{stream:!0})}return n+t.decode()},L=e=>(Array.isArray(e)?e:[]).slice(0,f).map(r=>String(r).slice(0,v)),A=async(e,r,o)=>{let t;const n=new Promise(s=>{t=setTimeout(()=>{s({error:`the script did not finish within ${String(p)} ms`,logs:[]})},p)}),a=async()=>{const i=await e.load({compatibilityDate:b,env:{},globalOutbound:null,limits:{cpuMs:o,subRequests:0},mainModule:"main.js",modules:{"main.js":w(r)}}).getEntrypoint().fetch("https://sandbox/"),l=await _(i,g);if(l===void 0)return{error:`the script's result is over ${String(g)} bytes — return less`,logs:[]};const c=JSON.parse(l),d=L(c.logs);return typeof c.error=="string"?{error:c.error,logs:d}:{logs:d,value:c.value}};try{return await Promise.race([a(),n])}catch(s){return{error:E(s),logs:[]}}finally{clearTimeout(t)}},M=(e={})=>{const r=e.cpuMs??S;if(!Number.isInteger(r)||r<=0)throw new m("INTERNAL","@lunora/agent: jsCodeTool `cpuMs` must be a positive integer");return{description:e.description??T,execute:async(o,t)=>{const n=t.env[u];return typeof n?.load!="function"?{error:`jsCodeTool: no Worker Loader binding "${u}" on env — declare \`"worker_loaders": [{ "binding": "${u}" }]\` in wrangler.jsonc`,logs:[]}:A(n,o.code,r)},inputSchema:h,isLunoraAgentTool:!0}};export{M as jsCodeTool};
|
|
@@ -1370,4 +1370,4 @@ interface AgentHandle {
|
|
|
1370
1370
|
/** Read a run's workflow status by instance id. */
|
|
1371
1371
|
status: (id: string) => Promise<unknown>;
|
|
1372
1372
|
}
|
|
1373
|
-
export { AgentUsage as $, AgentDefinition as A, AgentApprovalContext as B, AgentEmailMapper as C, AgentEmailRun as D, AgentGenerateOptions as E, AgentGenerateResult as F, AgentInstructionsContext as G, AgentLiveEvent as H, InboundChannelEvent as I, AgentMemoryOptions as J, AgentMemorySource as K, AgentMessageStatus as L, AgentOnReply as M, AgentOnStepFinish as N, AgentPrepareStep as O, AgentPrepareStepInput as P, AgentPrepareStepResult as Q, AgentProgressEvent as R, SkillMarkdownExtras as S, AgentReplyInfo as T, AgentRunHandle as U, AgentRunOptions as V, AgentStepFinishInfo as W, AgentStepInfo as X, AgentThreadStatus as Y, AgentTokenDelta as Z, AgentToolCall as _, AgentReplyRef as a, AgentVoiceConfig as a0, AgentWorkflowBindingLike as a1, AgentWorkflowInstanceLike as a2, EnsureThreadOutcome as a3,
|
|
1373
|
+
export { AgentUsage as $, AgentDefinition as A, AgentApprovalContext as B, AgentEmailMapper as C, AgentEmailRun as D, AgentGenerateOptions as E, AgentGenerateResult as F, AgentInstructionsContext as G, AgentLiveEvent as H, InboundChannelEvent as I, AgentMemoryOptions as J, AgentMemorySource as K, AgentMessageStatus as L, AgentOnReply as M, AgentOnStepFinish as N, AgentPrepareStep as O, AgentPrepareStepInput as P, AgentPrepareStepResult as Q, AgentProgressEvent as R, SkillMarkdownExtras as S, AgentReplyInfo as T, AgentRunHandle as U, AgentRunOptions as V, AgentStepFinishInfo as W, AgentStepInfo as X, AgentThreadStatus as Y, AgentTokenDelta as Z, AgentToolCall as _, AgentReplyRef as a, AgentVoiceConfig as a0, AgentWorkflowBindingLike as a1, AgentWorkflowInstanceLike as a2, EnsureThreadOutcome as a3, SkillDefinition as b, AgentToolDefinition as c, AgentToolContext as d, AgentCompact as e, AgentEpisodeExtract as f, AgentGraphExtract as g, AgentGenerate as h, AgentTokenSink as i, AgentRunInput as j, AgentFunctionPaths as k, AgentRunFunction as l, AgentStepLike as m, AgentStreamGenerate as n, AgentRunResult as o, AgentMessageRow as p, AgentConfig as q, AnyAgentTool as r, AgentAsToolOptions as s, AgentSubToolInput as t, AgentBindingSpec as u, AgentHandle as v, AgentToolConfig as w, AgentFunctionReference as x, AgentModelInput as y, SkillConfig as z };
|
|
@@ -1370,4 +1370,4 @@ interface AgentHandle {
|
|
|
1370
1370
|
/** Read a run's workflow status by instance id. */
|
|
1371
1371
|
status: (id: string) => Promise<unknown>;
|
|
1372
1372
|
}
|
|
1373
|
-
export { AgentUsage as $, AgentDefinition as A, AgentApprovalContext as B, AgentEmailMapper as C, AgentEmailRun as D, AgentGenerateOptions as E, AgentGenerateResult as F, AgentInstructionsContext as G, AgentLiveEvent as H, InboundChannelEvent as I, AgentMemoryOptions as J, AgentMemorySource as K, AgentMessageStatus as L, AgentOnReply as M, AgentOnStepFinish as N, AgentPrepareStep as O, AgentPrepareStepInput as P, AgentPrepareStepResult as Q, AgentProgressEvent as R, SkillMarkdownExtras as S, AgentReplyInfo as T, AgentRunHandle as U, AgentRunOptions as V, AgentStepFinishInfo as W, AgentStepInfo as X, AgentThreadStatus as Y, AgentTokenDelta as Z, AgentToolCall as _, AgentReplyRef as a, AgentVoiceConfig as a0, AgentWorkflowBindingLike as a1, AgentWorkflowInstanceLike as a2, EnsureThreadOutcome as a3,
|
|
1373
|
+
export { AgentUsage as $, AgentDefinition as A, AgentApprovalContext as B, AgentEmailMapper as C, AgentEmailRun as D, AgentGenerateOptions as E, AgentGenerateResult as F, AgentInstructionsContext as G, AgentLiveEvent as H, InboundChannelEvent as I, AgentMemoryOptions as J, AgentMemorySource as K, AgentMessageStatus as L, AgentOnReply as M, AgentOnStepFinish as N, AgentPrepareStep as O, AgentPrepareStepInput as P, AgentPrepareStepResult as Q, AgentProgressEvent as R, SkillMarkdownExtras as S, AgentReplyInfo as T, AgentRunHandle as U, AgentRunOptions as V, AgentStepFinishInfo as W, AgentStepInfo as X, AgentThreadStatus as Y, AgentTokenDelta as Z, AgentToolCall as _, AgentReplyRef as a, AgentVoiceConfig as a0, AgentWorkflowBindingLike as a1, AgentWorkflowInstanceLike as a2, EnsureThreadOutcome as a3, SkillDefinition as b, AgentToolDefinition as c, AgentToolContext as d, AgentCompact as e, AgentEpisodeExtract as f, AgentGraphExtract as g, AgentGenerate as h, AgentTokenSink as i, AgentRunInput as j, AgentFunctionPaths as k, AgentRunFunction as l, AgentStepLike as m, AgentStreamGenerate as n, AgentRunResult as o, AgentMessageRow as p, AgentConfig as q, AnyAgentTool as r, AgentAsToolOptions as s, AgentSubToolInput as t, AgentBindingSpec as u, AgentHandle as v, AgentToolConfig as w, AgentFunctionReference as x, AgentModelInput as y, SkillConfig as z };
|
package/dist/reply.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Mailer } from '@lunora/mail';
|
|
2
2
|
import { InboundEmail } from '@lunora/mail/inbound';
|
|
3
|
-
import { a as AgentReplyRef } from "./packem_shared/types.d-
|
|
3
|
+
import { a as AgentReplyRef } from "./packem_shared/types.d-DS2wmzMe.mjs";
|
|
4
4
|
import 'ai';
|
|
5
5
|
/** The email arm of {@link AgentReplyRef}, narrowed for the helpers below. */
|
|
6
6
|
type EmailReplyRef = Extract<AgentReplyRef, {
|
package/dist/reply.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Mailer } from '@lunora/mail';
|
|
2
2
|
import { InboundEmail } from '@lunora/mail/inbound';
|
|
3
|
-
import { a as AgentReplyRef } from "./packem_shared/types.d-
|
|
3
|
+
import { a as AgentReplyRef } from "./packem_shared/types.d-DS2wmzMe.js";
|
|
4
4
|
import 'ai';
|
|
5
5
|
/** The email arm of {@link AgentReplyRef}, narrowed for the helpers below. */
|
|
6
6
|
type EmailReplyRef = Extract<AgentReplyRef, {
|
package/dist/sandbox.d.mts
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as AgentToolDefinition, d as AgentToolContext } from "./packem_shared/types.d-DS2wmzMe.mjs";
|
|
2
2
|
import '@lunora/mail/inbound';
|
|
3
3
|
import 'ai';
|
|
4
|
+
/**
|
|
5
|
+
* The model-provided input to a {@link jsCodeTool} call.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
interface JsCodeToolInput {
|
|
9
|
+
/** The body of an `async` function. Its `return` value is the result. */
|
|
10
|
+
code: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* What a {@link jsCodeTool} call resolves to. `error` is set instead of `value`
|
|
14
|
+
* when the script threw, did not parse, returned something that is not JSON,
|
|
15
|
+
* or ran out of time.
|
|
16
|
+
* @experimental
|
|
17
|
+
*/
|
|
18
|
+
interface JsCodeToolResult {
|
|
19
|
+
error?: string;
|
|
20
|
+
/** `console.*` output, one entry per call, at most {@link MAX_LOG_ENTRIES}. */
|
|
21
|
+
logs: string[];
|
|
22
|
+
value?: unknown;
|
|
23
|
+
}
|
|
24
|
+
/** Options for {@link jsCodeTool}. */
|
|
25
|
+
interface JsCodeToolOptions {
|
|
26
|
+
/** CPU budget per run, enforced by the loader. Default 1000 ms. */
|
|
27
|
+
cpuMs?: number;
|
|
28
|
+
/** Tool description shown to the model. */
|
|
29
|
+
description?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A batteries-included agent tool that runs model-written JavaScript in a
|
|
33
|
+
* Worker Loader isolate — Cloudflare's Dynamic Workers, which celld implements
|
|
34
|
+
* too. The script gets no network (`globalOutbound: null`), no bindings, no
|
|
35
|
+
* tools and a CPU budget, so it is for computation: arithmetic, parsing,
|
|
36
|
+
* reshaping data the model already has. It returns the script's JSON result
|
|
37
|
+
* and its `console` output. A failure comes back as a result with `error` set,
|
|
38
|
+
* not a throw, so the durable step does not retry a script that will fail the
|
|
39
|
+
* same way again.
|
|
40
|
+
*
|
|
41
|
+
* Importing the tool makes codegen provision the `worker_loaders` binding
|
|
42
|
+
* (`LOADER`) and refuse a target whose matrix rates `workerLoaders`
|
|
43
|
+
* `unsupported`.
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { defineAgent, jsCodeTool } from "@lunora/agent";
|
|
47
|
+
*
|
|
48
|
+
* export const analyst = defineAgent({
|
|
49
|
+
* model: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
|
|
50
|
+
* tools: { js: jsCodeTool() },
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
declare const jsCodeTool: (options?: JsCodeToolOptions) => AgentToolDefinition<JsCodeToolInput, JsCodeToolResult>;
|
|
4
56
|
/**
|
|
5
57
|
* What a byte-returning browser op resolves to. The render is written to R2 and
|
|
6
58
|
* its key comes back — never the bytes, which would be truncated to the model's
|
|
@@ -247,4 +299,4 @@ declare const containerTool: (name: string, options?: ContainerToolOptions) => A
|
|
|
247
299
|
* @experimental
|
|
248
300
|
*/
|
|
249
301
|
declare const fsTool: (bucket: string, options?: FsToolOptions) => AgentToolDefinition<FsToolInput>;
|
|
250
|
-
export { type BrowserRenderResult, type BrowserToolInput, type BrowserToolOptions, type ContainerToolInput, type ContainerToolOptions, type FsToolInput, type FsToolOptions, browserTool, containerTool, fsTool };
|
|
302
|
+
export { type BrowserRenderResult, type BrowserToolInput, type BrowserToolOptions, type ContainerToolInput, type ContainerToolOptions, type FsToolInput, type FsToolOptions, type JsCodeToolInput, type JsCodeToolOptions, type JsCodeToolResult, browserTool, containerTool, fsTool, jsCodeTool };
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as AgentToolDefinition, d as AgentToolContext } from "./packem_shared/types.d-DS2wmzMe.js";
|
|
2
2
|
import '@lunora/mail/inbound';
|
|
3
3
|
import 'ai';
|
|
4
|
+
/**
|
|
5
|
+
* The model-provided input to a {@link jsCodeTool} call.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
interface JsCodeToolInput {
|
|
9
|
+
/** The body of an `async` function. Its `return` value is the result. */
|
|
10
|
+
code: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* What a {@link jsCodeTool} call resolves to. `error` is set instead of `value`
|
|
14
|
+
* when the script threw, did not parse, returned something that is not JSON,
|
|
15
|
+
* or ran out of time.
|
|
16
|
+
* @experimental
|
|
17
|
+
*/
|
|
18
|
+
interface JsCodeToolResult {
|
|
19
|
+
error?: string;
|
|
20
|
+
/** `console.*` output, one entry per call, at most {@link MAX_LOG_ENTRIES}. */
|
|
21
|
+
logs: string[];
|
|
22
|
+
value?: unknown;
|
|
23
|
+
}
|
|
24
|
+
/** Options for {@link jsCodeTool}. */
|
|
25
|
+
interface JsCodeToolOptions {
|
|
26
|
+
/** CPU budget per run, enforced by the loader. Default 1000 ms. */
|
|
27
|
+
cpuMs?: number;
|
|
28
|
+
/** Tool description shown to the model. */
|
|
29
|
+
description?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A batteries-included agent tool that runs model-written JavaScript in a
|
|
33
|
+
* Worker Loader isolate — Cloudflare's Dynamic Workers, which celld implements
|
|
34
|
+
* too. The script gets no network (`globalOutbound: null`), no bindings, no
|
|
35
|
+
* tools and a CPU budget, so it is for computation: arithmetic, parsing,
|
|
36
|
+
* reshaping data the model already has. It returns the script's JSON result
|
|
37
|
+
* and its `console` output. A failure comes back as a result with `error` set,
|
|
38
|
+
* not a throw, so the durable step does not retry a script that will fail the
|
|
39
|
+
* same way again.
|
|
40
|
+
*
|
|
41
|
+
* Importing the tool makes codegen provision the `worker_loaders` binding
|
|
42
|
+
* (`LOADER`) and refuse a target whose matrix rates `workerLoaders`
|
|
43
|
+
* `unsupported`.
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { defineAgent, jsCodeTool } from "@lunora/agent";
|
|
47
|
+
*
|
|
48
|
+
* export const analyst = defineAgent({
|
|
49
|
+
* model: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
|
|
50
|
+
* tools: { js: jsCodeTool() },
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
declare const jsCodeTool: (options?: JsCodeToolOptions) => AgentToolDefinition<JsCodeToolInput, JsCodeToolResult>;
|
|
4
56
|
/**
|
|
5
57
|
* What a byte-returning browser op resolves to. The render is written to R2 and
|
|
6
58
|
* its key comes back — never the bytes, which would be truncated to the model's
|
|
@@ -247,4 +299,4 @@ declare const containerTool: (name: string, options?: ContainerToolOptions) => A
|
|
|
247
299
|
* @experimental
|
|
248
300
|
*/
|
|
249
301
|
declare const fsTool: (bucket: string, options?: FsToolOptions) => AgentToolDefinition<FsToolInput>;
|
|
250
|
-
export { type BrowserRenderResult, type BrowserToolInput, type BrowserToolOptions, type ContainerToolInput, type ContainerToolOptions, type FsToolInput, type FsToolOptions, browserTool, containerTool, fsTool };
|
|
302
|
+
export { type BrowserRenderResult, type BrowserToolInput, type BrowserToolOptions, type ContainerToolInput, type ContainerToolOptions, type FsToolInput, type FsToolOptions, type JsCodeToolInput, type JsCodeToolOptions, type JsCodeToolResult, browserTool, containerTool, fsTool, jsCodeTool };
|
package/dist/sandbox.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LunoraError as a}from"@lunora/errors";import{jsonSchema as s}from"ai";import{toFunctionReference as h,SANDBOX_INVOKE_PATH as u}from"./packem_shared/AGENT_MODULE-M4D1EejI.mjs";import{S as l,a as T}from"./packem_shared/sandbox-budgets-DDvj4Orr.mjs";const i=h(u),f=e=>{if(e.op==="pdf")return"pdf";if(e.op==="screenshot")return e.type==="jpeg"?"jpeg":"png"},
|
|
1
|
+
import{LunoraError as a}from"@lunora/errors";import{jsonSchema as s}from"ai";import{toFunctionReference as h,SANDBOX_INVOKE_PATH as u}from"./packem_shared/AGENT_MODULE-M4D1EejI.mjs";import{S as l,a as T}from"./packem_shared/sandbox-budgets-DDvj4Orr.mjs";import{jsCodeTool as k}from"./packem_shared/jsCodeTool-BLOvjXGF.mjs";const i=h(u),f=e=>{if(e.op==="pdf")return"pdf";if(e.op==="screenshot")return e.type==="jpeg"?"jpeg":"png"},m=new Set(["bucket","path","root"]),g='Drive a headless browser: screenshot a page, render it to PDF, read its HTML content, or scrape it. Set `op` to "screenshot" | "pdf" | "content" | "scrape" and pass the target `url`.',E='Talk to a sandboxed container: `fetch` an HTTP path on it, or `exec` a command inside it. Set `op` to "fetch" (with `path`) or "exec" (with `command`).',y='Read and write files in a persistent sandbox filesystem. Set `op` to "ls" (list a directory), "read", "write" (with `content`), "rm", or "stat", and pass `path`.',S=e=>e.op==="write"||e.op==="rm",A=s({properties:{content:{description:"write: the file contents.",type:"string"},op:{description:"The filesystem operation to run.",enum:["ls","read","write","rm","stat"],type:"string"},path:{description:"The file or directory path, relative to the sandbox root.",type:"string"}},required:["op"],type:"object"}),O=s({properties:{fullPage:{description:"screenshot: capture the full scrollable page rather than just the viewport.",type:"boolean"},op:{description:"The browser operation to run.",enum:["screenshot","scrape","pdf","content"],type:"string"},selector:{description:"scrape: optional CSS selector hint to narrow the extraction.",type:"string"},type:{description:"screenshot: image encoding (default png).",enum:["png","jpeg"],type:"string"},url:{description:"The URL to operate on.",type:"string"}},required:["op","url"],type:"object"}),_=new Set(["DELETE","PATCH","POST","PUT"]),b=e=>e.op==="exec"||_.has((e.method??"GET").toUpperCase()),w=s({properties:{args:{description:"exec: command arguments.",items:{type:"string"},type:"array"},body:{description:"fetch: request body.",type:"string"},command:{description:"exec: the command to run.",type:"string"},method:{description:"fetch: HTTP method (default GET).",type:"string"},op:{description:"The container operation to run.",enum:["fetch","exec"],type:"string"},path:{description:"fetch: request path on the container (e.g. /health).",type:"string"}},required:["op"],type:"object"}),v=(e={})=>{const t=e.bucket!==void 0&&e.bucket.length>0?e.bucket:void 0;return{description:e.description??g,execute:async(n,o)=>{const r=f(n);if(r!==void 0&&t===void 0)return`Cannot run a "${n.op}": this browser tool has no \`bucket\` configured, so the render has nowhere to go. Use "content" or "scrape" for page text, or ask the operator to pass \`browserTool({ bucket })\`.`;const c=r===void 0?{}:{bucket:t,path:`${o.threadKey}/${o.toolCallId}.${r}`,...e.root===void 0?{}:{root:e.root}},p=Object.fromEntries(Object.entries(n).filter(([d])=>!m.has(d)));return await o.run(i,{...p,...c,kind:"browser"},{timeoutMs:l})},inputSchema:O,isLunoraAgentTool:!0,...e.needsApproval===void 0?{}:{needsApproval:e.needsApproval}}},C=(e,t={})=>{if(typeof e!="string"||e.length===0)throw new a("INTERNAL","@lunora/agent: containerTool requires a container `name` (the ctx.containers.<name> key from lunora/containers.ts)");const n=t.needsApproval??b;return{description:t.description??E,execute:(o,r)=>r.run(i,{...o,instance:r.threadKey,kind:"container",name:e},{timeoutMs:T}),inputSchema:w,isLunoraAgentTool:!0,needsApproval:n}},x=(e,t={})=>{if(typeof e!="string"||e.length===0)throw new a("INTERNAL","@lunora/agent: fsTool requires an R2 `bucket` binding name (the r2_bucket declared in wrangler.jsonc)");return{description:t.description??y,execute:(n,o)=>{const r=typeof t.root=="function"?t.root(o):t.root??"";return o.run(i,{...n,bucket:e,kind:"fs",root:r})},inputSchema:A,isLunoraAgentTool:!0,needsApproval:t.needsApproval??S}};export{v as browserTool,C as containerTool,x as fsTool,k as jsCodeTool};
|
package/dist/skill-markdown.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/agent",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.153",
|
|
4
4
|
"description": "Durable AI agents for Lunora: defineAgent compiles a replay-safe tool-loop onto Cloudflare Workflows, with DO SQLite threads and live message subscriptions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -84,10 +84,10 @@
|
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@lunora/ai": "1.0.0-alpha.
|
|
87
|
+
"@lunora/ai": "1.0.0-alpha.103",
|
|
88
88
|
"@lunora/errors": "1.0.0-alpha.47",
|
|
89
89
|
"@lunora/mail": "1.0.0-alpha.93",
|
|
90
|
-
"@lunora/server": "1.0.0-alpha.
|
|
90
|
+
"@lunora/server": "1.0.0-alpha.160",
|
|
91
91
|
"@lunora/values": "1.0.0-alpha.57",
|
|
92
92
|
"@lunora/workflow": "1.0.0-alpha.68",
|
|
93
93
|
"@modelcontextprotocol/sdk": "^1.30.0",
|