@easbot/plugin 0.2.47 → 0.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +132 -2
- package/dist/index.d.ts +132 -2
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var k=require('zod'),types=require('@easbot/types');require('@easbot/sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var k__default=/*#__PURE__*/_interopDefault(k);function T(s){return {description:s.description,args:s.args,execute:s.execute}}T.schema=k__default.default;var a={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",GatewayMessageDelivered:"gateway.message.delivered",GatewayMessageRead:"gateway.message.read",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",CommandTrigger:"scheduler.command.trigger",CommandComplete:"scheduler.command.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskRunning:"task.running",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end"},Be=Object.values(o);var d=k.z.string().optional(),C=k.z.object({type:k.z.literal(a.Command),command:k.z.string(),if:d,shell:k.z.enum(["bash","powershell"]).optional(),timeout:k.z.number().positive().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),async:k.z.boolean().optional()}),v=k.z.object({type:k.z.literal(a.Prompt),if:d,timeout:k.z.number().positive().optional(),model:k.z.string().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),runMode:k.z.enum(["session","fork"]).optional(),system:k.z.string().optional(),parts:k.z.array(k.z.unknown())}),P=k.z.object({type:k.z.literal(a.Http),url:k.z.string(),if:d,timeout:k.z.number().positive().optional(),method:k.z.enum(["GET","POST","PUT","DELETE"]).optional(),headers:k.z.record(k.z.string(),k.z.string()).optional(),allowedEnvVars:k.z.array(k.z.string()).optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional()}),H=k.z.object({type:k.z.literal(a.Agent),if:d,timeout:k.z.number().positive().optional(),agent:k.z.string().optional(),model:k.z.string().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),system:k.z.string().optional(),parts:k.z.array(k.z.unknown())}),w=k.z.object({type:k.z.literal(a.Function),handler:k.z.function()}),E=k.z.discriminatedUnion("type",[C,v,P,H,w]),M=k.z.object({event:k.z.string(),matcher:k.z.string().optional(),hooks:k.z.array(E)}),Ne=k.z.record(k.z.string(),k.z.array(M)),n=k.z.string().min(1).describe("Session unique identifier"),r=k.z.string().min(1).describe("Message unique identifier"),u=k.z.string().min(1).describe("Tool call unique identifier"),p=k.z.string().optional().describe("Agent name"),c=k.z.string().optional().describe("Model identifier"),y=k.z.object({providerId:k.z.string().describe("Provider ID"),modelId:k.z.string().describe("Model ID"),api:k.z.object({id:k.z.string().describe("API ID"),npm:k.z.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),I=k.z.string().optional().describe("Working directory path"),j=k.z.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),D=k.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),z=k.z.object({sessionId:n,source:k.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:c,agent:p,cwd:I}),R=k.z.object({sessionId:n,reason:j,duration:k.z.number().positive().optional().describe("Session duration in milliseconds")}),A=k.z.object({sessionId:n,trigger:k.z.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:k.z.number().positive().describe("Current context length"),threshold:k.z.number().positive().describe("Trigger threshold")}),F=k.z.object({sessionId:n,summary:k.z.string().describe("Compaction summary"),previousLength:k.z.number().positive().describe("Previous context length"),newLength:k.z.number().positive().describe("New context length")}),O=k.z.object({sessionId:n,messageId:r,userMessageId:r.optional().describe("User message ID for the current step"),model:c,agent:p}),G=k.z.object({sessionId:n,messageId:r,userMessageId:r.optional().describe("User message ID for the current step"),model:c,agent:p,finishReason:D,tokens:k.z.object({input:k.z.number().int().nonnegative().optional(),output:k.z.number().int().nonnegative().optional(),total:k.z.number().int().nonnegative().optional()}).optional().describe("Token usage statistics")}),W=k.z.object({sessionId:n,reason:k.z.string().describe("Stop reason")}),B=k.z.object({sessionId:n,error:k.z.string().describe("Error message"),errorType:k.z.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),L=k.z.enum(["user","assistant","system","tool"]),S=k.z.discriminatedUnion("type",[k.z.object({type:k.z.literal("text"),text:k.z.string().describe("Text content")}),k.z.object({type:k.z.literal("image"),source:k.z.object({type:k.z.enum(["base64","url"]),mime:k.z.string().optional().describe("File mime type"),data:k.z.string().describe("File base64 encoding data or url")})}),k.z.object({type:k.z.literal("file"),url:k.z.string().describe("File path"),filename:k.z.string().describe("File name"),mime:k.z.string().optional().describe("File mime type")})]),h=k.z.object({id:r,role:L,content:k.z.union([k.z.string(),k.z.array(S)]),name:k.z.string().optional().describe("Message sender name"),tool_call_id:u.optional().describe("Related tool call ID")}),_=k.z.object({sessionId:n,agent:p,model:c,messageId:r,message:k.z.object({id:r,role:k.z.literal("user"),content:k.z.union([k.z.string(),k.z.array(S)])}).describe("User message")}),q=k.z.object({sessionId:n,messages:k.z.array(h).describe("Messages to transform")}),U=k.z.object({sessionId:n,model:c,system:k.z.array(k.z.string()).describe("Current system prompt")}),l=k.z.record(k.z.string(),k.z.unknown()).describe("Tool call arguments"),N=k.z.object({title:k.z.string().optional().describe("Result title"),content:k.z.string().describe("Result content"),is_error:k.z.boolean().optional().describe("Is error result"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Extra metadata")}),Z=k.z.object({sessionId:n,userMessageId:r.optional().describe("User message ID for the current step"),tool:k.z.string().describe("Tool name"),callId:u,args:l}),V=k.z.object({sessionId:n,userMessageId:r.optional().describe("User message ID for the current step"),tool:k.z.string(),callId:u,args:l,result:N,duration:k.z.number().nonnegative().optional().describe("Execution duration in milliseconds")}),$=k.z.object({sessionId:n,tool:k.z.string(),callId:u,args:l,error:k.z.string().describe("Error message"),errorType:k.z.enum(["timeout","invalid_args","execution_error","permission_denied"])}),K=k.z.object({sessionId:n,toolID:k.z.string().describe("Tool ID"),definition:k.z.object({name:k.z.string(),description:k.z.string().optional(),parameters:k.z.record(k.z.string(),k.z.unknown()).optional()}).describe("Tool definition")}),J=k.z.object({sessionId:n,command:k.z.string().describe("Command name"),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments")}),Q=k.z.object({sessionId:n,command:k.z.string().describe("Command name"),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).optional(),result:k.z.object({info:k.z.unknown().optional().describe("Message info"),parts:k.z.array(k.z.unknown()).optional().describe("Message parts"),title:k.z.string().optional().describe("Result title"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Result metadata"),output:k.z.string().optional().describe("Result output"),success:k.z.boolean().optional().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}).describe("Command execution result")}),X=k.z.enum(["read","write","exec","admin"]),Y=k.z.object({tool:k.z.string().describe("Tool name requesting permission"),args:l.optional(),level:X.optional(),reason:k.z.string().optional().describe("Reason for permission request")}),ee=k.z.object({sessionId:n,request:Y}),te=k.z.object({sessionId:n,tool:k.z.string(),reason:k.z.string().optional()}),x=k.z.enum(["openai","anthropic","google","azure","custom"]),oe=k.z.object({temperature:k.z.number().min(0).max(2).optional(),topP:k.z.number().min(0).max(1).optional(),topK:k.z.number().int().positive().optional(),maxTokens:k.z.number().int().positive().optional(),stopSequences:k.z.array(k.z.string()).optional(),responseFormat:k.z.enum(["text","json_object"]).optional()}),ne=k.z.object({sessionId:n,agent:p,model:y,provider:x,params:oe.partial().optional()}),re=k.z.object({sessionId:n,agent:p,model:y,provider:x,headers:k.z.record(k.z.string(),k.z.string()).optional()}),se=k.z.object({cwd:I.describe("Working directory"),sessionId:n.optional(),callId:u.optional()}),ie=k.z.object({sessionId:n,messageId:r,partId:k.z.string().describe("Text part ID"),text:k.z.string().describe("Completed text")}),ae=k.z.object({sessionId:n,mode:k.z.enum(["agent","chat","query"]).describe("Build mode"),providerId:k.z.string().optional()}),pe=k.z.object({sessionId:n,context:k.z.object({messages:k.z.array(h),system:k.z.array(k.z.string()),metadata:k.z.record(k.z.string(),k.z.unknown())}).describe("Built context")}),me=k.z.object({gatewayID:k.z.string().describe("Gateway ID"),messageId:r,message:k.z.unknown().describe("Received message")}),ue=k.z.object({gatewayID:k.z.string(),messageId:r,message:k.z.unknown(),sessionId:n.optional()}),ce=k.z.object({gatewayID:k.z.string(),messageId:r,result:k.z.unknown().optional()}),de=k.z.object({gatewayID:k.z.string(),messageId:r,message:k.z.unknown(),target:k.z.string().optional().describe("Send target")}),le=k.z.object({gatewayID:k.z.string(),messageId:r,sessionId:n.optional(),channel:k.z.object({platform:k.z.string(),channelId:k.z.string()}),timestamp:k.z.number().describe("Delivery timestamp")}),ge=k.z.object({gatewayID:k.z.string(),messageId:r,sessionId:n.optional(),channel:k.z.object({platform:k.z.string(),channelId:k.z.string()}),timestamp:k.z.number().describe("Read timestamp")}),be=k.z.object({type:k.z.literal("command"),config:k.z.object({command:k.z.string(),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).optional()})}),fe=k.z.object({type:k.z.literal("heartbeat"),parts:k.z.array(k.z.unknown()),system:k.z.string().optional(),config:k.z.object({session:k.z.string().optional(),mode:k.z.enum(["session","fork"]).optional(),agent:k.z.string().optional(),model:k.z.string().optional(),tools:k.z.record(k.z.string(),k.z.boolean()).optional()}).optional()}),ye=k.z.object({type:k.z.literal("scheduler"),parts:k.z.array(k.z.unknown()),system:k.z.string().optional(),config:k.z.object({agentType:k.z.string().optional(),transport:k.z.enum(["stdio","http","websocket","cli"]).optional(),model:k.z.string().optional(),tools:k.z.record(k.z.string(),k.z.boolean()).optional()}).optional()}),Ie=k.z.object({taskId:k.z.string().describe("Heartbeat task ID"),timestamp:k.z.number().describe("Heartbeat timestamp"),name:k.z.string().optional().describe("Heartbeat name"),definition:fe.optional()}),Se=k.z.object({taskId:k.z.string().describe("Heartbeat task ID"),sessionId:n.optional(),timestamp:k.z.number(),duration:k.z.number().nonnegative().optional(),success:k.z.boolean().optional(),error:k.z.string().optional()}),he=k.z.object({taskId:k.z.string().describe("Task ID"),taskName:k.z.string().optional(),timestamp:k.z.number(),payload:k.z.record(k.z.string(),k.z.unknown()).optional(),definition:ye.optional()}),xe=k.z.object({taskId:k.z.string(),timestamp:k.z.number(),success:k.z.boolean(),result:k.z.record(k.z.string(),k.z.unknown()).optional(),error:k.z.string().optional()}),ke=k.z.object({taskId:k.z.string().describe("Command task unique identifier"),taskName:k.z.string().describe("Command task name"),command:k.z.string().describe("Command name"),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).optional().describe("Command arguments"),timestamp:k.z.number().describe("Trigger timestamp"),definition:be.optional()}),Te=k.z.object({taskId:k.z.string(),timestamp:k.z.number(),success:k.z.boolean(),output:k.z.string().optional(),error:k.z.string().optional(),duration:k.z.number().describe("Execution duration in milliseconds")}),g=k.z.enum(["tool","scheduler","cli","api"]),Ce=k.z.object({taskId:k.z.string().describe("Task unique identifier"),sessionId:k.z.string().describe("Session ID for this task"),source:g.describe("Task source: tool, scheduler, cli, api"),agentType:k.z.string().describe("Agent type to execute this task"),description:k.z.string().describe("Task description"),prompt:k.z.string().describe("Task prompt content"),timeout:k.z.number().positive().optional().describe("Task timeout in milliseconds")}),ve=k.z.object({taskId:k.z.string().describe("Task unique identifier"),sessionId:k.z.string().describe("Session ID for this task"),source:g.describe("Task source: tool, scheduler, cli, api")}),Pe=k.z.object({taskId:k.z.string(),sessionId:k.z.string(),source:g,step:k.z.number().describe("Current step number"),totalSteps:k.z.number().optional().describe("Total number of steps"),output:k.z.string().describe("Progress output content"),timestamp:k.z.number().describe("Progress timestamp")}),He=k.z.object({taskId:k.z.string(),sessionId:k.z.string(),source:g,result:k.z.string().describe("Task result content"),duration:k.z.number().nonnegative().describe("Task duration in milliseconds"),attachments:k.z.array(k.z.unknown()).optional().describe("Task result attachments"),error:k.z.string().optional().describe("Error message if task failed"),agentType:k.z.string().optional().describe("Agent type that executed the task"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Additional metadata for the task result")}),we=k.z.object({sessionId:k.z.string().describe("Session ID"),step:k.z.number().describe("Current step number"),lastUserId:k.z.string().describe("Last user message ID"),result:k.z.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),Ee=k.z.object({sessionId:k.z.string().describe("Session ID"),step:k.z.number().describe("Current step number"),lastUserId:k.z.string().describe("Last user message ID"),result:k.z.enum(["stop","continue"]).describe("Loop result: stop or continue")}),f={[o.SessionStart]:z,[o.SessionEnd]:R,[o.SessionCompacting]:A,[o.SessionCompact]:F,[o.StepStart]:O,[o.StepFinish]:G,[o.StepStop]:W,[o.StepStopFailure]:B,[o.MessageReceive]:_,[o.MessageTransform]:q,[o.SystemTransform]:U,[o.ToolBefore]:Z,[o.ToolAfter]:V,[o.ToolFailure]:$,[o.ToolDefinition]:K,[o.CommandBefore]:J,[o.CommandAfter]:Q,[o.PermissionAsk]:ee,[o.PermissionDenied]:te,[o.LlmParams]:ne,[o.LlmHeaders]:re,[o.ShellEnv]:se,[o.TextComplete]:ie,[o.ContextBuildBefore]:ae,[o.ContextBuildAfter]:pe,[o.GatewayMessageReceive]:me,[o.GatewayMessageProcess]:ue,[o.GatewayMessageComplete]:ce,[o.GatewayMessageSend]:de,[o.GatewayMessageDelivered]:le,[o.GatewayMessageRead]:ge,[o.HeartbeatTrigger]:Ie,[o.HeartbeatComplete]:Se,[o.ScheduledTaskTrigger]:he,[o.ScheduledTaskComplete]:xe,[o.CommandTrigger]:ke,[o.CommandComplete]:Te,[o.TaskStart]:Ce,[o.TaskRunning]:ve,[o.TaskProgress]:Pe,[o.TaskComplete]:He,[o.LoopStart]:we,[o.LoopEnd]:Ee};function Ze(s){return f[s]}function Ve(s,b){let m=f[s];if(!m)throw new Error(`No schema found for event: ${s}`);return m.parse(b)}function $e(s,b){let m=f[s];return m?m.safeParse(b):{success:false,error:new k.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var nt=k.z.enum(["command","mcp","skill"]).describe("Command source"),Me=k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments"),je=k.z.discriminatedUnion("type",[k.z.object({type:k.z.literal("text"),text:k.z.string().describe("Text content")}),k.z.object({type:k.z.literal("image"),source:k.z.object({type:k.z.enum(["base64","url"]),mime:k.z.string().describe("File mime type"),data:k.z.string().describe("File base64 encoding data or url")})}),k.z.object({type:k.z.literal("file"),url:k.z.string().describe("File path"),filename:k.z.string().describe("File name"),mime:k.z.string().optional().describe("File mime type")})]),rt=k.z.object({name:k.z.string().describe("Command name"),description:k.z.string().describe("Command description"),scope:k.z.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:k.z.string().optional().describe("Specified agent name"),model:k.z.string().optional().describe("Specified model"),hints:k.z.array(k.z.string()).optional().describe("Argument hints"),commandType:k.z.enum(["prompt","local"]).optional().describe("Command type"),hidden:k.z.boolean().optional().describe("Whether hidden")}),st=k.z.object({sessionId:k.z.string().describe("Session ID"),directory:k.z.string().describe("Working directory"),model:k.z.string().optional().describe("Model identifier"),agent:k.z.string().optional().describe("Agent name"),arguments:Me.describe("Command arguments")}),De=k.z.record(k.z.string(),k.z.unknown()).describe("Result metadata"),it=k.z.object({title:k.z.string().describe("Result title"),metadata:De.describe("Result metadata"),output:k.z.string().describe("Result output"),parts:k.z.array(je).optional().describe("Result parts"),success:k.z.boolean().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}),at=k.z.object({agent:k.z.object({name:k.z.string().describe("Agent name"),model:k.z.string().optional().describe("Agent model")}).optional().describe("Agent context")}),pt=k.z.object({isEnabled:k.z.boolean().optional().describe("Is enabled check result")});Object.defineProperty(exports,"buildToolArgs",{enumerable:true,get:function(){return types.buildToolArgs}});Object.defineProperty(exports,"createTool",{enumerable:true,get:function(){return types.createTool}});Object.defineProperty(exports,"schema",{enumerable:true,get:function(){return types.toolSchema}});exports.AgentExecutorSchema=H;exports.AgentSchema=p;exports.CallIDSchema=u;exports.CommandAfterInputSchema=Q;exports.CommandArgumentsSchema=Me;exports.CommandBeforeInputSchema=J;exports.CommandCompleteInputSchema=Te;exports.CommandExecuteResultMetadataSchema=De;exports.CommandExecuteResultSchema=it;exports.CommandExecutionContextSchema=st;exports.CommandExecutorSchema=C;exports.CommandInitContextSchema=at;exports.CommandInitResultSchema=pt;exports.CommandMetadataSchema=rt;exports.CommandPromptPartSchema=je;exports.CommandSourceSchema=nt;exports.CommandTaskDefinitionSchema=be;exports.CommandTriggerInputSchema=ke;exports.ContentPartSchema=S;exports.ContextBuildAfterInputSchema=pe;exports.ContextBuildBeforeInputSchema=ae;exports.CwdSchema=I;exports.EndReasonSchema=j;exports.EventInputSchemas=f;exports.FinishReasonSchema=D;exports.FunctionExecutorSchema=w;exports.GatewayMessageCompleteInputSchema=ce;exports.GatewayMessageDeliveredInputSchema=le;exports.GatewayMessageProcessInputSchema=ue;exports.GatewayMessageReadInputSchema=ge;exports.GatewayMessageReceiveInputSchema=me;exports.GatewayMessageSendInputSchema=de;exports.HOOK_EVENTS=Be;exports.HeartbeatCompleteInputSchema=Se;exports.HeartbeatTaskDefinitionSchema=fe;exports.HeartbeatTriggerInputSchema=Ie;exports.HookEvent=o;exports.HookExecutorSchema=E;exports.HookMatcherSchema=M;exports.HookType=a;exports.HooksConfigSchema=Ne;exports.HttpExecutorSchema=P;exports.LlmHeadersInputSchema=re;exports.LlmParamsInputSchema=ne;exports.LlmParamsSchema=oe;exports.LlmProviderSchema=x;exports.LoopEndInputSchema=Ee;exports.LoopStartInputSchema=we;exports.MessageIDSchema=r;exports.MessageReceiveInputSchema=_;exports.MessageRoleSchema=L;exports.MessageSchema=h;exports.MessageTransformInputSchema=q;exports.ModelObjectSchema=y;exports.ModelSchema=c;exports.PermissionAskInputSchema=ee;exports.PermissionDeniedInputSchema=te;exports.PermissionLevelSchema=X;exports.PermissionRequestSchema=Y;exports.PromptExecutorSchema=v;exports.ScheduledTaskCompleteInputSchema=xe;exports.ScheduledTaskTriggerInputSchema=he;exports.SchedulerTaskDefinitionSchema=ye;exports.SessionCompactInputSchema=F;exports.SessionCompactingInputSchema=A;exports.SessionEndInputSchema=R;exports.SessionIDSchema=n;exports.SessionStartInputSchema=z;exports.ShellEnvInputSchema=se;exports.StepFinishInputSchema=G;exports.StepStartInputSchema=O;exports.StepStopFailureInputSchema=B;exports.StepStopInputSchema=W;exports.SystemTransformInputSchema=U;exports.TaskCompleteInputSchema=He;exports.TaskProgressInputSchema=Pe;exports.TaskRunningInputSchema=ve;exports.TaskSourceSchema=g;exports.TaskStartInputSchema=Ce;exports.TextCompleteInputSchema=ie;exports.ToolAfterInputSchema=V;exports.ToolArgsSchema=l;exports.ToolBeforeInputSchema=Z;exports.ToolDefinitionInputSchema=K;exports.ToolFailureInputSchema=$;exports.ToolResultSchema=N;exports.getEventInputSchema=Ze;exports.safeValidateHookInput=$e;exports.tool=T;exports.validateHookInput=Ve;
|
|
1
|
+
'use strict';var k=require('zod'),types=require('@easbot/types');require('@easbot/sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var k__default=/*#__PURE__*/_interopDefault(k);function C(s){return {description:s.description,args:s.args,execute:s.execute}}C.schema=k__default.default;var a={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",GatewayMessageDelivered:"gateway.message.delivered",GatewayMessageRead:"gateway.message.read",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",CommandTrigger:"scheduler.command.trigger",CommandComplete:"scheduler.command.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskRunning:"task.running",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end",CreationRequest:"creation.request",CreationComplete:"creation.complete",EvolutionRequest:"evolution.request",EvolutionComplete:"evolution.complete"},Ue=Object.values(o);var d=k.z.string().optional(),T=k.z.object({type:k.z.literal(a.Command),command:k.z.string(),if:d,shell:k.z.enum(["bash","powershell"]).optional(),timeout:k.z.number().positive().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),async:k.z.boolean().optional()}),v=k.z.object({type:k.z.literal(a.Prompt),if:d,timeout:k.z.number().positive().optional(),model:k.z.string().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),runMode:k.z.enum(["session","fork"]).optional(),system:k.z.string().optional(),parts:k.z.array(k.z.unknown())}),P=k.z.object({type:k.z.literal(a.Http),url:k.z.string(),if:d,timeout:k.z.number().positive().optional(),method:k.z.enum(["GET","POST","PUT","DELETE"]).optional(),headers:k.z.record(k.z.string(),k.z.string()).optional(),allowedEnvVars:k.z.array(k.z.string()).optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional()}),H=k.z.object({type:k.z.literal(a.Agent),if:d,timeout:k.z.number().positive().optional(),agent:k.z.string().optional(),model:k.z.string().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),system:k.z.string().optional(),parts:k.z.array(k.z.unknown())}),w=k.z.object({type:k.z.literal(a.Function),handler:k.z.function()}),E=k.z.discriminatedUnion("type",[T,v,P,H,w]),j=k.z.object({event:k.z.string(),matcher:k.z.string().optional(),hooks:k.z.array(E)}),Ke=k.z.record(k.z.string(),k.z.array(j)),n=k.z.string().min(1).describe("Session unique identifier"),r=k.z.string().min(1).describe("Message unique identifier"),m=k.z.string().min(1).describe("Tool call unique identifier"),p=k.z.string().optional().describe("Agent name"),c=k.z.string().optional().describe("Model identifier"),y=k.z.object({providerId:k.z.string().describe("Provider ID"),modelId:k.z.string().describe("Model ID"),api:k.z.object({id:k.z.string().describe("API ID"),npm:k.z.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),I=k.z.string().optional().describe("Working directory path"),M=k.z.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),D=k.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),R=k.z.object({sessionId:n,source:k.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:c,agent:p,cwd:I}),z=k.z.object({sessionId:n,reason:M,duration:k.z.number().positive().optional().describe("Session duration in milliseconds")}),A=k.z.object({sessionId:n,trigger:k.z.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:k.z.number().positive().describe("Current context length"),threshold:k.z.number().positive().describe("Trigger threshold")}),F=k.z.object({sessionId:n,summary:k.z.string().describe("Compaction summary"),previousLength:k.z.number().positive().describe("Previous context length"),newLength:k.z.number().positive().describe("New context length")}),O=k.z.object({sessionId:n,messageId:r,userMessageId:r.optional().describe("User message ID for the current step"),model:c,agent:p}),G=k.z.object({sessionId:n,messageId:r,userMessageId:r.optional().describe("User message ID for the current step"),model:c,agent:p,finishReason:D,tokens:k.z.object({input:k.z.number().int().nonnegative().optional(),output:k.z.number().int().nonnegative().optional(),total:k.z.number().int().nonnegative().optional()}).optional().describe("Token usage statistics")}),W=k.z.object({sessionId:n,reason:k.z.string().describe("Stop reason")}),B=k.z.object({sessionId:n,error:k.z.string().describe("Error message"),errorType:k.z.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),L=k.z.enum(["user","assistant","system","tool"]),S=k.z.discriminatedUnion("type",[k.z.object({type:k.z.literal("text"),text:k.z.string().describe("Text content")}),k.z.object({type:k.z.literal("image"),source:k.z.object({type:k.z.enum(["base64","url"]),mime:k.z.string().optional().describe("File mime type"),data:k.z.string().describe("File base64 encoding data or url")})}),k.z.object({type:k.z.literal("file"),url:k.z.string().describe("File path"),filename:k.z.string().describe("File name"),mime:k.z.string().optional().describe("File mime type")})]),h=k.z.object({id:r,role:L,content:k.z.union([k.z.string(),k.z.array(S)]),name:k.z.string().optional().describe("Message sender name"),tool_call_id:m.optional().describe("Related tool call ID")}),q=k.z.object({sessionId:n,agent:p,model:c,messageId:r,message:k.z.object({id:r,role:k.z.literal("user"),content:k.z.union([k.z.string(),k.z.array(S)])}).describe("User message")}),_=k.z.object({sessionId:n,messages:k.z.array(h).describe("Messages to transform")}),U=k.z.object({sessionId:n,model:c,system:k.z.array(k.z.string()).describe("Current system prompt")}),l=k.z.record(k.z.string(),k.z.unknown()).describe("Tool call arguments"),N=k.z.object({title:k.z.string().optional().describe("Result title"),content:k.z.string().describe("Result content"),is_error:k.z.boolean().optional().describe("Is error result"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Extra metadata")}),Z=k.z.object({sessionId:n,userMessageId:r.optional().describe("User message ID for the current step"),tool:k.z.string().describe("Tool name"),callId:m,args:l}),V=k.z.object({sessionId:n,userMessageId:r.optional().describe("User message ID for the current step"),tool:k.z.string(),callId:m,args:l,result:N,duration:k.z.number().nonnegative().optional().describe("Execution duration in milliseconds")}),$=k.z.object({sessionId:n,tool:k.z.string(),callId:m,args:l,error:k.z.string().describe("Error message"),errorType:k.z.enum(["timeout","invalid_args","execution_error","permission_denied"])}),K=k.z.object({sessionId:n,toolID:k.z.string().describe("Tool ID"),definition:k.z.object({name:k.z.string(),description:k.z.string().optional(),parameters:k.z.record(k.z.string(),k.z.unknown()).optional()}).describe("Tool definition")}),J=k.z.object({sessionId:n,command:k.z.string().describe("Command name"),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments")}),Q=k.z.object({sessionId:n,command:k.z.string().describe("Command name"),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).optional(),result:k.z.object({info:k.z.unknown().optional().describe("Message info"),parts:k.z.array(k.z.unknown()).optional().describe("Message parts"),title:k.z.string().optional().describe("Result title"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Result metadata"),output:k.z.string().optional().describe("Result output"),success:k.z.boolean().optional().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}).describe("Command execution result")}),X=k.z.enum(["read","write","exec","admin"]),Y=k.z.object({tool:k.z.string().describe("Tool name requesting permission"),args:l.optional(),level:X.optional(),reason:k.z.string().optional().describe("Reason for permission request")}),ee=k.z.object({sessionId:n,request:Y}),te=k.z.object({sessionId:n,tool:k.z.string(),reason:k.z.string().optional()}),x=k.z.enum(["openai","anthropic","google","azure","custom"]),oe=k.z.object({temperature:k.z.number().min(0).max(2).optional(),topP:k.z.number().min(0).max(1).optional(),topK:k.z.number().int().positive().optional(),maxTokens:k.z.number().int().positive().optional(),stopSequences:k.z.array(k.z.string()).optional(),responseFormat:k.z.enum(["text","json_object"]).optional()}),ne=k.z.object({sessionId:n,agent:p,model:y,provider:x,params:oe.partial().optional()}),re=k.z.object({sessionId:n,agent:p,model:y,provider:x,headers:k.z.record(k.z.string(),k.z.string()).optional()}),se=k.z.object({cwd:I.describe("Working directory"),sessionId:n.optional(),callId:m.optional()}),ie=k.z.object({sessionId:n,messageId:r,partId:k.z.string().describe("Text part ID"),text:k.z.string().describe("Completed text")}),ae=k.z.object({sessionId:n,mode:k.z.enum(["agent","chat","query"]).describe("Build mode"),providerId:k.z.string().optional()}),pe=k.z.object({sessionId:n,context:k.z.object({messages:k.z.array(h),system:k.z.array(k.z.string()),metadata:k.z.record(k.z.string(),k.z.unknown())}).describe("Built context")}),ue=k.z.object({gatewayID:k.z.string().describe("Gateway ID"),messageId:r,message:k.z.unknown().describe("Received message")}),me=k.z.object({gatewayID:k.z.string(),messageId:r,message:k.z.unknown(),sessionId:n.optional()}),ce=k.z.object({gatewayID:k.z.string(),messageId:r,result:k.z.unknown().optional()}),de=k.z.object({gatewayID:k.z.string(),messageId:r,message:k.z.unknown(),target:k.z.string().optional().describe("Send target")}),le=k.z.object({gatewayID:k.z.string(),messageId:r,sessionId:n.optional(),channel:k.z.object({platform:k.z.string(),channelId:k.z.string()}),timestamp:k.z.number().describe("Delivery timestamp")}),ge=k.z.object({gatewayID:k.z.string(),messageId:r,sessionId:n.optional(),channel:k.z.object({platform:k.z.string(),channelId:k.z.string()}),timestamp:k.z.number().describe("Read timestamp")}),be=k.z.object({type:k.z.literal("command"),config:k.z.object({command:k.z.string(),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).optional()})}),fe=k.z.object({type:k.z.literal("heartbeat"),parts:k.z.array(k.z.unknown()),system:k.z.string().optional(),config:k.z.object({session:k.z.string().optional(),mode:k.z.enum(["session","fork"]).optional(),agent:k.z.string().optional(),model:k.z.string().optional(),tools:k.z.record(k.z.string(),k.z.boolean()).optional()}).optional()}),ye=k.z.object({type:k.z.literal("scheduler"),parts:k.z.array(k.z.unknown()),system:k.z.string().optional(),config:k.z.object({agentType:k.z.string().optional(),transport:k.z.enum(["stdio","http","websocket","cli"]).optional(),model:k.z.string().optional(),tools:k.z.record(k.z.string(),k.z.boolean()).optional()}).optional()}),Ie=k.z.object({taskId:k.z.string().describe("Heartbeat task ID"),timestamp:k.z.number().describe("Heartbeat timestamp"),name:k.z.string().optional().describe("Heartbeat name"),definition:fe.optional()}),Se=k.z.object({taskId:k.z.string().describe("Heartbeat task ID"),sessionId:n.optional(),timestamp:k.z.number(),duration:k.z.number().nonnegative().optional(),success:k.z.boolean().optional(),error:k.z.string().optional()}),he=k.z.object({taskId:k.z.string().describe("Task ID"),taskName:k.z.string().optional(),timestamp:k.z.number(),payload:k.z.record(k.z.string(),k.z.unknown()).optional(),definition:ye.optional()}),xe=k.z.object({taskId:k.z.string(),timestamp:k.z.number(),success:k.z.boolean(),result:k.z.record(k.z.string(),k.z.unknown()).optional(),error:k.z.string().optional()}),ke=k.z.object({taskId:k.z.string().describe("Command task unique identifier"),taskName:k.z.string().describe("Command task name"),command:k.z.string().describe("Command name"),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).optional().describe("Command arguments"),timestamp:k.z.number().describe("Trigger timestamp"),definition:be.optional()}),Ce=k.z.object({taskId:k.z.string(),timestamp:k.z.number(),success:k.z.boolean(),output:k.z.string().optional(),error:k.z.string().optional(),duration:k.z.number().describe("Execution duration in milliseconds")}),g=k.z.enum(["tool","scheduler","cli","api"]),Te=k.z.object({taskId:k.z.string().describe("Task unique identifier"),sessionId:k.z.string().describe("Session ID for this task"),source:g.describe("Task source: tool, scheduler, cli, api"),agentType:k.z.string().describe("Agent type to execute this task"),description:k.z.string().describe("Task description"),prompt:k.z.string().describe("Task prompt content"),timeout:k.z.number().positive().optional().describe("Task timeout in milliseconds")}),ve=k.z.object({taskId:k.z.string().describe("Task unique identifier"),sessionId:k.z.string().describe("Session ID for this task"),source:g.describe("Task source: tool, scheduler, cli, api")}),Pe=k.z.object({taskId:k.z.string(),sessionId:k.z.string(),source:g,step:k.z.number().describe("Current step number"),totalSteps:k.z.number().optional().describe("Total number of steps"),output:k.z.string().describe("Progress output content"),timestamp:k.z.number().describe("Progress timestamp")}),He=k.z.object({taskId:k.z.string(),sessionId:k.z.string(),source:g,result:k.z.string().describe("Task result content"),duration:k.z.number().nonnegative().describe("Task duration in milliseconds"),attachments:k.z.array(k.z.unknown()).optional().describe("Task result attachments"),error:k.z.string().optional().describe("Error message if task failed"),agentType:k.z.string().optional().describe("Agent type that executed the task"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Additional metadata for the task result")}),we=k.z.object({sessionId:k.z.string().describe("Session ID"),step:k.z.number().describe("Current step number"),lastUserId:k.z.string().describe("Last user message ID"),result:k.z.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),Ee=k.z.object({sessionId:k.z.string().describe("Session ID"),step:k.z.number().describe("Current step number"),lastUserId:k.z.string().describe("Last user message ID"),result:k.z.enum(["stop","continue"]).describe("Loop result: stop or continue")}),je=k.z.object({requestId:k.z.string(),kind:k.z.enum(["create-skill","create-workflow","create-bundle"]),requirement:k.z.string(),hints:k.z.array(k.z.string()),origin:k.z.object({source:k.z.enum(["human","tool","scheduler","namespace"]).optional(),timestamp:k.z.number().int().nonnegative()})}),Me=k.z.object({requestId:k.z.string(),status:k.z.enum(["success","failed"]),specId:k.z.string().optional(),durationMs:k.z.number().int().nonnegative(),error:k.z.string().optional()}),De=k.z.object({dryRun:k.z.boolean()}),Re=k.z.object({status:k.z.enum(["success","failed","awaiting-approval"]),applied:k.z.number().int().nonnegative().optional(),awaitingApproval:k.z.number().int().nonnegative().optional(),error:k.z.string().optional()}),f={[o.SessionStart]:R,[o.SessionEnd]:z,[o.SessionCompacting]:A,[o.SessionCompact]:F,[o.StepStart]:O,[o.StepFinish]:G,[o.StepStop]:W,[o.StepStopFailure]:B,[o.MessageReceive]:q,[o.MessageTransform]:_,[o.SystemTransform]:U,[o.ToolBefore]:Z,[o.ToolAfter]:V,[o.ToolFailure]:$,[o.ToolDefinition]:K,[o.CommandBefore]:J,[o.CommandAfter]:Q,[o.PermissionAsk]:ee,[o.PermissionDenied]:te,[o.LlmParams]:ne,[o.LlmHeaders]:re,[o.ShellEnv]:se,[o.TextComplete]:ie,[o.ContextBuildBefore]:ae,[o.ContextBuildAfter]:pe,[o.GatewayMessageReceive]:ue,[o.GatewayMessageProcess]:me,[o.GatewayMessageComplete]:ce,[o.GatewayMessageSend]:de,[o.GatewayMessageDelivered]:le,[o.GatewayMessageRead]:ge,[o.HeartbeatTrigger]:Ie,[o.HeartbeatComplete]:Se,[o.ScheduledTaskTrigger]:he,[o.ScheduledTaskComplete]:xe,[o.CommandTrigger]:ke,[o.CommandComplete]:Ce,[o.TaskStart]:Te,[o.TaskRunning]:ve,[o.TaskProgress]:Pe,[o.TaskComplete]:He,[o.LoopStart]:we,[o.LoopEnd]:Ee,[o.CreationRequest]:je,[o.CreationComplete]:Me,[o.EvolutionRequest]:De,[o.EvolutionComplete]:Re};function Je(s){return f[s]}function Qe(s,b){let u=f[s];if(!u)throw new Error(`No schema found for event: ${s}`);return u.parse(b)}function Xe(s,b){let u=f[s];return u?u.safeParse(b):{success:false,error:new k.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var at=k.z.enum(["command","mcp","skill"]).describe("Command source"),ze=k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments"),Ae=k.z.discriminatedUnion("type",[k.z.object({type:k.z.literal("text"),text:k.z.string().describe("Text content")}),k.z.object({type:k.z.literal("image"),source:k.z.object({type:k.z.enum(["base64","url"]),mime:k.z.string().describe("File mime type"),data:k.z.string().describe("File base64 encoding data or url")})}),k.z.object({type:k.z.literal("file"),url:k.z.string().describe("File path"),filename:k.z.string().describe("File name"),mime:k.z.string().optional().describe("File mime type")})]),pt=k.z.object({name:k.z.string().describe("Command name"),description:k.z.string().describe("Command description"),scope:k.z.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:k.z.string().optional().describe("Specified agent name"),model:k.z.string().optional().describe("Specified model"),hints:k.z.array(k.z.string()).optional().describe("Argument hints"),commandType:k.z.enum(["prompt","local"]).optional().describe("Command type"),hidden:k.z.boolean().optional().describe("Whether hidden")}),ut=k.z.object({sessionId:k.z.string().describe("Session ID"),directory:k.z.string().describe("Working directory"),model:k.z.string().optional().describe("Model identifier"),agent:k.z.string().optional().describe("Agent name"),arguments:ze.describe("Command arguments")}),Fe=k.z.record(k.z.string(),k.z.unknown()).describe("Result metadata"),mt=k.z.object({title:k.z.string().describe("Result title"),metadata:Fe.describe("Result metadata"),output:k.z.string().describe("Result output"),parts:k.z.array(Ae).optional().describe("Result parts"),success:k.z.boolean().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}),ct=k.z.object({agent:k.z.object({name:k.z.string().describe("Agent name"),model:k.z.string().optional().describe("Agent model")}).optional().describe("Agent context")}),dt=k.z.object({isEnabled:k.z.boolean().optional().describe("Is enabled check result")});Object.defineProperty(exports,"buildToolArgs",{enumerable:true,get:function(){return types.buildToolArgs}});Object.defineProperty(exports,"createTool",{enumerable:true,get:function(){return types.createTool}});Object.defineProperty(exports,"schema",{enumerable:true,get:function(){return types.toolSchema}});exports.AgentExecutorSchema=H;exports.AgentSchema=p;exports.CallIDSchema=m;exports.CommandAfterInputSchema=Q;exports.CommandArgumentsSchema=ze;exports.CommandBeforeInputSchema=J;exports.CommandCompleteInputSchema=Ce;exports.CommandExecuteResultMetadataSchema=Fe;exports.CommandExecuteResultSchema=mt;exports.CommandExecutionContextSchema=ut;exports.CommandExecutorSchema=T;exports.CommandInitContextSchema=ct;exports.CommandInitResultSchema=dt;exports.CommandMetadataSchema=pt;exports.CommandPromptPartSchema=Ae;exports.CommandSourceSchema=at;exports.CommandTaskDefinitionSchema=be;exports.CommandTriggerInputSchema=ke;exports.ContentPartSchema=S;exports.ContextBuildAfterInputSchema=pe;exports.ContextBuildBeforeInputSchema=ae;exports.CreationCompleteInputSchema=Me;exports.CreationRequestInputSchema=je;exports.CwdSchema=I;exports.EndReasonSchema=M;exports.EventInputSchemas=f;exports.EvolutionCompleteInputSchema=Re;exports.EvolutionRequestInputSchema=De;exports.FinishReasonSchema=D;exports.FunctionExecutorSchema=w;exports.GatewayMessageCompleteInputSchema=ce;exports.GatewayMessageDeliveredInputSchema=le;exports.GatewayMessageProcessInputSchema=me;exports.GatewayMessageReadInputSchema=ge;exports.GatewayMessageReceiveInputSchema=ue;exports.GatewayMessageSendInputSchema=de;exports.HOOK_EVENTS=Ue;exports.HeartbeatCompleteInputSchema=Se;exports.HeartbeatTaskDefinitionSchema=fe;exports.HeartbeatTriggerInputSchema=Ie;exports.HookEvent=o;exports.HookExecutorSchema=E;exports.HookMatcherSchema=j;exports.HookType=a;exports.HooksConfigSchema=Ke;exports.HttpExecutorSchema=P;exports.LlmHeadersInputSchema=re;exports.LlmParamsInputSchema=ne;exports.LlmParamsSchema=oe;exports.LlmProviderSchema=x;exports.LoopEndInputSchema=Ee;exports.LoopStartInputSchema=we;exports.MessageIDSchema=r;exports.MessageReceiveInputSchema=q;exports.MessageRoleSchema=L;exports.MessageSchema=h;exports.MessageTransformInputSchema=_;exports.ModelObjectSchema=y;exports.ModelSchema=c;exports.PermissionAskInputSchema=ee;exports.PermissionDeniedInputSchema=te;exports.PermissionLevelSchema=X;exports.PermissionRequestSchema=Y;exports.PromptExecutorSchema=v;exports.ScheduledTaskCompleteInputSchema=xe;exports.ScheduledTaskTriggerInputSchema=he;exports.SchedulerTaskDefinitionSchema=ye;exports.SessionCompactInputSchema=F;exports.SessionCompactingInputSchema=A;exports.SessionEndInputSchema=z;exports.SessionIDSchema=n;exports.SessionStartInputSchema=R;exports.ShellEnvInputSchema=se;exports.StepFinishInputSchema=G;exports.StepStartInputSchema=O;exports.StepStopFailureInputSchema=B;exports.StepStopInputSchema=W;exports.SystemTransformInputSchema=U;exports.TaskCompleteInputSchema=He;exports.TaskProgressInputSchema=Pe;exports.TaskRunningInputSchema=ve;exports.TaskSourceSchema=g;exports.TaskStartInputSchema=Te;exports.TextCompleteInputSchema=ie;exports.ToolAfterInputSchema=V;exports.ToolArgsSchema=l;exports.ToolBeforeInputSchema=Z;exports.ToolDefinitionInputSchema=K;exports.ToolFailureInputSchema=$;exports.ToolResultSchema=N;exports.getEventInputSchema=Je;exports.safeValidateHookInput=Xe;exports.tool=C;exports.validateHookInput=Qe;
|
package/dist/index.d.cts
CHANGED
|
@@ -68,9 +68,13 @@ declare const HookEvent: {
|
|
|
68
68
|
readonly TaskComplete: "task.complete";
|
|
69
69
|
readonly LoopStart: "loop.start";
|
|
70
70
|
readonly LoopEnd: "loop.end";
|
|
71
|
+
readonly CreationRequest: "creation.request";
|
|
72
|
+
readonly CreationComplete: "creation.complete";
|
|
73
|
+
readonly EvolutionRequest: "evolution.request";
|
|
74
|
+
readonly EvolutionComplete: "evolution.complete";
|
|
71
75
|
};
|
|
72
76
|
type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
|
|
73
|
-
declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "step.start" | "step.finish" | "step.stop" | "step.stop.failure" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "text.complete" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "gateway.message.delivered" | "gateway.message.read" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "scheduler.command.trigger" | "scheduler.command.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
77
|
+
declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "step.start" | "step.finish" | "step.stop" | "step.stop.failure" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "text.complete" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "gateway.message.delivered" | "gateway.message.read" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "scheduler.command.trigger" | "scheduler.command.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end" | "creation.request" | "creation.complete" | "evolution.request" | "evolution.complete")[];
|
|
74
78
|
interface HookContext {
|
|
75
79
|
sessionId?: string;
|
|
76
80
|
agent?: string;
|
|
@@ -1105,6 +1109,52 @@ declare const LoopEndInputSchema: z$1.ZodObject<{
|
|
|
1105
1109
|
}>;
|
|
1106
1110
|
}, z$1.core.$strip>;
|
|
1107
1111
|
type LoopEndInput = z$1.infer<typeof LoopEndInputSchema>;
|
|
1112
|
+
declare const CreationRequestInputSchema: z$1.ZodObject<{
|
|
1113
|
+
requestId: z$1.ZodString;
|
|
1114
|
+
kind: z$1.ZodEnum<{
|
|
1115
|
+
"create-skill": "create-skill";
|
|
1116
|
+
"create-workflow": "create-workflow";
|
|
1117
|
+
"create-bundle": "create-bundle";
|
|
1118
|
+
}>;
|
|
1119
|
+
requirement: z$1.ZodString;
|
|
1120
|
+
hints: z$1.ZodArray<z$1.ZodString>;
|
|
1121
|
+
origin: z$1.ZodObject<{
|
|
1122
|
+
source: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1123
|
+
tool: "tool";
|
|
1124
|
+
scheduler: "scheduler";
|
|
1125
|
+
human: "human";
|
|
1126
|
+
namespace: "namespace";
|
|
1127
|
+
}>>;
|
|
1128
|
+
timestamp: z$1.ZodNumber;
|
|
1129
|
+
}, z$1.core.$strip>;
|
|
1130
|
+
}, z$1.core.$strip>;
|
|
1131
|
+
type CreationRequestInput = z$1.infer<typeof CreationRequestInputSchema>;
|
|
1132
|
+
declare const CreationCompleteInputSchema: z$1.ZodObject<{
|
|
1133
|
+
requestId: z$1.ZodString;
|
|
1134
|
+
status: z$1.ZodEnum<{
|
|
1135
|
+
success: "success";
|
|
1136
|
+
failed: "failed";
|
|
1137
|
+
}>;
|
|
1138
|
+
specId: z$1.ZodOptional<z$1.ZodString>;
|
|
1139
|
+
durationMs: z$1.ZodNumber;
|
|
1140
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1141
|
+
}, z$1.core.$strip>;
|
|
1142
|
+
type CreationCompleteInput = z$1.infer<typeof CreationCompleteInputSchema>;
|
|
1143
|
+
declare const EvolutionRequestInputSchema: z$1.ZodObject<{
|
|
1144
|
+
dryRun: z$1.ZodBoolean;
|
|
1145
|
+
}, z$1.core.$strip>;
|
|
1146
|
+
type EvolutionRequestInput = z$1.infer<typeof EvolutionRequestInputSchema>;
|
|
1147
|
+
declare const EvolutionCompleteInputSchema: z$1.ZodObject<{
|
|
1148
|
+
status: z$1.ZodEnum<{
|
|
1149
|
+
success: "success";
|
|
1150
|
+
failed: "failed";
|
|
1151
|
+
"awaiting-approval": "awaiting-approval";
|
|
1152
|
+
}>;
|
|
1153
|
+
applied: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1154
|
+
awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1155
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1156
|
+
}, z$1.core.$strip>;
|
|
1157
|
+
type EvolutionCompleteInput = z$1.infer<typeof EvolutionCompleteInputSchema>;
|
|
1108
1158
|
declare const EventInputSchemas: {
|
|
1109
1159
|
readonly "session.start": z$1.ZodObject<{
|
|
1110
1160
|
sessionId: z$1.ZodString;
|
|
@@ -1636,6 +1686,48 @@ declare const EventInputSchemas: {
|
|
|
1636
1686
|
continue: "continue";
|
|
1637
1687
|
}>;
|
|
1638
1688
|
}, z$1.core.$strip>;
|
|
1689
|
+
readonly "creation.request": z$1.ZodObject<{
|
|
1690
|
+
requestId: z$1.ZodString;
|
|
1691
|
+
kind: z$1.ZodEnum<{
|
|
1692
|
+
"create-skill": "create-skill";
|
|
1693
|
+
"create-workflow": "create-workflow";
|
|
1694
|
+
"create-bundle": "create-bundle";
|
|
1695
|
+
}>;
|
|
1696
|
+
requirement: z$1.ZodString;
|
|
1697
|
+
hints: z$1.ZodArray<z$1.ZodString>;
|
|
1698
|
+
origin: z$1.ZodObject<{
|
|
1699
|
+
source: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1700
|
+
tool: "tool";
|
|
1701
|
+
scheduler: "scheduler";
|
|
1702
|
+
human: "human";
|
|
1703
|
+
namespace: "namespace";
|
|
1704
|
+
}>>;
|
|
1705
|
+
timestamp: z$1.ZodNumber;
|
|
1706
|
+
}, z$1.core.$strip>;
|
|
1707
|
+
}, z$1.core.$strip>;
|
|
1708
|
+
readonly "creation.complete": z$1.ZodObject<{
|
|
1709
|
+
requestId: z$1.ZodString;
|
|
1710
|
+
status: z$1.ZodEnum<{
|
|
1711
|
+
success: "success";
|
|
1712
|
+
failed: "failed";
|
|
1713
|
+
}>;
|
|
1714
|
+
specId: z$1.ZodOptional<z$1.ZodString>;
|
|
1715
|
+
durationMs: z$1.ZodNumber;
|
|
1716
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1717
|
+
}, z$1.core.$strip>;
|
|
1718
|
+
readonly "evolution.request": z$1.ZodObject<{
|
|
1719
|
+
dryRun: z$1.ZodBoolean;
|
|
1720
|
+
}, z$1.core.$strip>;
|
|
1721
|
+
readonly "evolution.complete": z$1.ZodObject<{
|
|
1722
|
+
status: z$1.ZodEnum<{
|
|
1723
|
+
success: "success";
|
|
1724
|
+
failed: "failed";
|
|
1725
|
+
"awaiting-approval": "awaiting-approval";
|
|
1726
|
+
}>;
|
|
1727
|
+
applied: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1728
|
+
awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1729
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1730
|
+
}, z$1.core.$strip>;
|
|
1639
1731
|
};
|
|
1640
1732
|
declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
1641
1733
|
sessionId: z$1.ZodString;
|
|
@@ -2124,6 +2216,44 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
2124
2216
|
stop: "stop";
|
|
2125
2217
|
continue: "continue";
|
|
2126
2218
|
}>;
|
|
2219
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
2220
|
+
requestId: z$1.ZodString;
|
|
2221
|
+
kind: z$1.ZodEnum<{
|
|
2222
|
+
"create-skill": "create-skill";
|
|
2223
|
+
"create-workflow": "create-workflow";
|
|
2224
|
+
"create-bundle": "create-bundle";
|
|
2225
|
+
}>;
|
|
2226
|
+
requirement: z$1.ZodString;
|
|
2227
|
+
hints: z$1.ZodArray<z$1.ZodString>;
|
|
2228
|
+
origin: z$1.ZodObject<{
|
|
2229
|
+
source: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2230
|
+
tool: "tool";
|
|
2231
|
+
scheduler: "scheduler";
|
|
2232
|
+
human: "human";
|
|
2233
|
+
namespace: "namespace";
|
|
2234
|
+
}>>;
|
|
2235
|
+
timestamp: z$1.ZodNumber;
|
|
2236
|
+
}, z$1.core.$strip>;
|
|
2237
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
2238
|
+
requestId: z$1.ZodString;
|
|
2239
|
+
status: z$1.ZodEnum<{
|
|
2240
|
+
success: "success";
|
|
2241
|
+
failed: "failed";
|
|
2242
|
+
}>;
|
|
2243
|
+
specId: z$1.ZodOptional<z$1.ZodString>;
|
|
2244
|
+
durationMs: z$1.ZodNumber;
|
|
2245
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
2246
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
2247
|
+
dryRun: z$1.ZodBoolean;
|
|
2248
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
2249
|
+
status: z$1.ZodEnum<{
|
|
2250
|
+
success: "success";
|
|
2251
|
+
failed: "failed";
|
|
2252
|
+
"awaiting-approval": "awaiting-approval";
|
|
2253
|
+
}>;
|
|
2254
|
+
applied: z$1.ZodOptional<z$1.ZodNumber>;
|
|
2255
|
+
awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
|
|
2256
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
2127
2257
|
}, z$1.core.$strip>;
|
|
2128
2258
|
declare function validateHookInput<T extends HookEvent>(event: T, input: unknown): unknown;
|
|
2129
2259
|
declare function safeValidateHookInput<T extends HookEvent>(event: T, input: unknown): {
|
|
@@ -2389,4 +2519,4 @@ interface PluginDefinition {
|
|
|
2389
2519
|
'context.build.after'?: (input: ContextBuildAfterInput, output: HookOutputWrapper<ContextBuildAfterInput>) => Promise<void>;
|
|
2390
2520
|
}
|
|
2391
2521
|
|
|
2392
|
-
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, type CommandCompleteInput, CommandCompleteInputSchema, type CommandDefinition, type CommandExecuteResult, type CommandExecuteResultMetadata, CommandExecuteResultMetadataSchema, CommandExecuteResultSchema, type CommandExecutionContext, CommandExecutionContextSchema, CommandExecutorSchema, type CommandHookDefinition, type CommandInitContext, CommandInitContextSchema, type CommandInitResult, CommandInitResultSchema, type CommandMetadata, CommandMetadataSchema, type CommandPromptPart, CommandPromptPartSchema, type CommandSource, CommandSourceSchema, type CommandTaskDefinition, CommandTaskDefinitionSchema, type CommandTriggerInput, CommandTriggerInputSchema, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageDeliveredInput, GatewayMessageDeliveredInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReadInput, GatewayMessageReadInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, type HeartbeatTaskDefinition, HeartbeatTaskDefinitionSchema, type HeartbeatTriggerInput, HeartbeatTriggerInputSchema, type HookChainResult, type HookContext, type HookDefinition, type HookError, HookEvent, type HookExecutionDetail, HookExecutorSchema, type HookHandler, type HookMatcher, HookMatcherSchema, type HookOutputWrapper, type HookResult, HookType, type HooksConfig, HooksConfigSchema, HttpExecutorSchema, type HttpHookDefinition, type LlmHeadersInput, LlmHeadersInputSchema, type LlmParamsInput, LlmParamsInputSchema, LlmParamsSchema, LlmProviderSchema, type LoopEndInput, LoopEndInputSchema, type LoopStartInput, LoopStartInputSchema, MessageIDSchema, type MessageReceiveInput, MessageReceiveInputSchema, MessageRoleSchema, MessageSchema, type MessageTransformInput, MessageTransformInputSchema, ModelObjectSchema, ModelSchema, type PermissionAskInput, PermissionAskInputSchema, type PermissionDeniedInput, PermissionDeniedInputSchema, PermissionLevelSchema, PermissionRequestSchema, type Plugin, type PluginDefinition, type PluginInput, PromptExecutorSchema, type PromptHookDefinition, type ScheduledTaskCompleteInput, ScheduledTaskCompleteInputSchema, type ScheduledTaskTriggerInput, ScheduledTaskTriggerInputSchema, type SchedulerTaskDefinition, SchedulerTaskDefinitionSchema, type SessionCompactInput, SessionCompactInputSchema, type SessionCompactingInput, SessionCompactingInputSchema, type SessionEndInput, SessionEndInputSchema, SessionIDSchema, type SessionStartInput, SessionStartInputSchema, type ShellEnvInput, ShellEnvInputSchema, type StepFinishInput, StepFinishInputSchema, type StepStartInput, StepStartInputSchema, type StepStopFailureInput, StepStopFailureInputSchema, type StepStopInput, StepStopInputSchema, type SystemTransformInput, SystemTransformInputSchema, type TaskCompleteInput, TaskCompleteInputSchema, type TaskDefinition, type TaskProgressInput, TaskProgressInputSchema, type TaskRunningInput, TaskRunningInputSchema, type TaskSource, TaskSourceSchema, type TaskStartInput, TaskStartInputSchema, type TextCompleteInput, TextCompleteInputSchema, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, safeValidateHookInput, tool, validateHookInput };
|
|
2522
|
+
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, type CommandCompleteInput, CommandCompleteInputSchema, type CommandDefinition, type CommandExecuteResult, type CommandExecuteResultMetadata, CommandExecuteResultMetadataSchema, CommandExecuteResultSchema, type CommandExecutionContext, CommandExecutionContextSchema, CommandExecutorSchema, type CommandHookDefinition, type CommandInitContext, CommandInitContextSchema, type CommandInitResult, CommandInitResultSchema, type CommandMetadata, CommandMetadataSchema, type CommandPromptPart, CommandPromptPartSchema, type CommandSource, CommandSourceSchema, type CommandTaskDefinition, CommandTaskDefinitionSchema, type CommandTriggerInput, CommandTriggerInputSchema, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, type CreationCompleteInput, CreationCompleteInputSchema, type CreationRequestInput, CreationRequestInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, type EvolutionCompleteInput, EvolutionCompleteInputSchema, type EvolutionRequestInput, EvolutionRequestInputSchema, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageDeliveredInput, GatewayMessageDeliveredInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReadInput, GatewayMessageReadInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, type HeartbeatTaskDefinition, HeartbeatTaskDefinitionSchema, type HeartbeatTriggerInput, HeartbeatTriggerInputSchema, type HookChainResult, type HookContext, type HookDefinition, type HookError, HookEvent, type HookExecutionDetail, HookExecutorSchema, type HookHandler, type HookMatcher, HookMatcherSchema, type HookOutputWrapper, type HookResult, HookType, type HooksConfig, HooksConfigSchema, HttpExecutorSchema, type HttpHookDefinition, type LlmHeadersInput, LlmHeadersInputSchema, type LlmParamsInput, LlmParamsInputSchema, LlmParamsSchema, LlmProviderSchema, type LoopEndInput, LoopEndInputSchema, type LoopStartInput, LoopStartInputSchema, MessageIDSchema, type MessageReceiveInput, MessageReceiveInputSchema, MessageRoleSchema, MessageSchema, type MessageTransformInput, MessageTransformInputSchema, ModelObjectSchema, ModelSchema, type PermissionAskInput, PermissionAskInputSchema, type PermissionDeniedInput, PermissionDeniedInputSchema, PermissionLevelSchema, PermissionRequestSchema, type Plugin, type PluginDefinition, type PluginInput, PromptExecutorSchema, type PromptHookDefinition, type ScheduledTaskCompleteInput, ScheduledTaskCompleteInputSchema, type ScheduledTaskTriggerInput, ScheduledTaskTriggerInputSchema, type SchedulerTaskDefinition, SchedulerTaskDefinitionSchema, type SessionCompactInput, SessionCompactInputSchema, type SessionCompactingInput, SessionCompactingInputSchema, type SessionEndInput, SessionEndInputSchema, SessionIDSchema, type SessionStartInput, SessionStartInputSchema, type ShellEnvInput, ShellEnvInputSchema, type StepFinishInput, StepFinishInputSchema, type StepStartInput, StepStartInputSchema, type StepStopFailureInput, StepStopFailureInputSchema, type StepStopInput, StepStopInputSchema, type SystemTransformInput, SystemTransformInputSchema, type TaskCompleteInput, TaskCompleteInputSchema, type TaskDefinition, type TaskProgressInput, TaskProgressInputSchema, type TaskRunningInput, TaskRunningInputSchema, type TaskSource, TaskSourceSchema, type TaskStartInput, TaskStartInputSchema, type TextCompleteInput, TextCompleteInputSchema, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, safeValidateHookInput, tool, validateHookInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -68,9 +68,13 @@ declare const HookEvent: {
|
|
|
68
68
|
readonly TaskComplete: "task.complete";
|
|
69
69
|
readonly LoopStart: "loop.start";
|
|
70
70
|
readonly LoopEnd: "loop.end";
|
|
71
|
+
readonly CreationRequest: "creation.request";
|
|
72
|
+
readonly CreationComplete: "creation.complete";
|
|
73
|
+
readonly EvolutionRequest: "evolution.request";
|
|
74
|
+
readonly EvolutionComplete: "evolution.complete";
|
|
71
75
|
};
|
|
72
76
|
type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
|
|
73
|
-
declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "step.start" | "step.finish" | "step.stop" | "step.stop.failure" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "text.complete" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "gateway.message.delivered" | "gateway.message.read" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "scheduler.command.trigger" | "scheduler.command.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
77
|
+
declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "step.start" | "step.finish" | "step.stop" | "step.stop.failure" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "text.complete" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "gateway.message.delivered" | "gateway.message.read" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "scheduler.command.trigger" | "scheduler.command.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end" | "creation.request" | "creation.complete" | "evolution.request" | "evolution.complete")[];
|
|
74
78
|
interface HookContext {
|
|
75
79
|
sessionId?: string;
|
|
76
80
|
agent?: string;
|
|
@@ -1105,6 +1109,52 @@ declare const LoopEndInputSchema: z$1.ZodObject<{
|
|
|
1105
1109
|
}>;
|
|
1106
1110
|
}, z$1.core.$strip>;
|
|
1107
1111
|
type LoopEndInput = z$1.infer<typeof LoopEndInputSchema>;
|
|
1112
|
+
declare const CreationRequestInputSchema: z$1.ZodObject<{
|
|
1113
|
+
requestId: z$1.ZodString;
|
|
1114
|
+
kind: z$1.ZodEnum<{
|
|
1115
|
+
"create-skill": "create-skill";
|
|
1116
|
+
"create-workflow": "create-workflow";
|
|
1117
|
+
"create-bundle": "create-bundle";
|
|
1118
|
+
}>;
|
|
1119
|
+
requirement: z$1.ZodString;
|
|
1120
|
+
hints: z$1.ZodArray<z$1.ZodString>;
|
|
1121
|
+
origin: z$1.ZodObject<{
|
|
1122
|
+
source: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1123
|
+
tool: "tool";
|
|
1124
|
+
scheduler: "scheduler";
|
|
1125
|
+
human: "human";
|
|
1126
|
+
namespace: "namespace";
|
|
1127
|
+
}>>;
|
|
1128
|
+
timestamp: z$1.ZodNumber;
|
|
1129
|
+
}, z$1.core.$strip>;
|
|
1130
|
+
}, z$1.core.$strip>;
|
|
1131
|
+
type CreationRequestInput = z$1.infer<typeof CreationRequestInputSchema>;
|
|
1132
|
+
declare const CreationCompleteInputSchema: z$1.ZodObject<{
|
|
1133
|
+
requestId: z$1.ZodString;
|
|
1134
|
+
status: z$1.ZodEnum<{
|
|
1135
|
+
success: "success";
|
|
1136
|
+
failed: "failed";
|
|
1137
|
+
}>;
|
|
1138
|
+
specId: z$1.ZodOptional<z$1.ZodString>;
|
|
1139
|
+
durationMs: z$1.ZodNumber;
|
|
1140
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1141
|
+
}, z$1.core.$strip>;
|
|
1142
|
+
type CreationCompleteInput = z$1.infer<typeof CreationCompleteInputSchema>;
|
|
1143
|
+
declare const EvolutionRequestInputSchema: z$1.ZodObject<{
|
|
1144
|
+
dryRun: z$1.ZodBoolean;
|
|
1145
|
+
}, z$1.core.$strip>;
|
|
1146
|
+
type EvolutionRequestInput = z$1.infer<typeof EvolutionRequestInputSchema>;
|
|
1147
|
+
declare const EvolutionCompleteInputSchema: z$1.ZodObject<{
|
|
1148
|
+
status: z$1.ZodEnum<{
|
|
1149
|
+
success: "success";
|
|
1150
|
+
failed: "failed";
|
|
1151
|
+
"awaiting-approval": "awaiting-approval";
|
|
1152
|
+
}>;
|
|
1153
|
+
applied: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1154
|
+
awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1155
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1156
|
+
}, z$1.core.$strip>;
|
|
1157
|
+
type EvolutionCompleteInput = z$1.infer<typeof EvolutionCompleteInputSchema>;
|
|
1108
1158
|
declare const EventInputSchemas: {
|
|
1109
1159
|
readonly "session.start": z$1.ZodObject<{
|
|
1110
1160
|
sessionId: z$1.ZodString;
|
|
@@ -1636,6 +1686,48 @@ declare const EventInputSchemas: {
|
|
|
1636
1686
|
continue: "continue";
|
|
1637
1687
|
}>;
|
|
1638
1688
|
}, z$1.core.$strip>;
|
|
1689
|
+
readonly "creation.request": z$1.ZodObject<{
|
|
1690
|
+
requestId: z$1.ZodString;
|
|
1691
|
+
kind: z$1.ZodEnum<{
|
|
1692
|
+
"create-skill": "create-skill";
|
|
1693
|
+
"create-workflow": "create-workflow";
|
|
1694
|
+
"create-bundle": "create-bundle";
|
|
1695
|
+
}>;
|
|
1696
|
+
requirement: z$1.ZodString;
|
|
1697
|
+
hints: z$1.ZodArray<z$1.ZodString>;
|
|
1698
|
+
origin: z$1.ZodObject<{
|
|
1699
|
+
source: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1700
|
+
tool: "tool";
|
|
1701
|
+
scheduler: "scheduler";
|
|
1702
|
+
human: "human";
|
|
1703
|
+
namespace: "namespace";
|
|
1704
|
+
}>>;
|
|
1705
|
+
timestamp: z$1.ZodNumber;
|
|
1706
|
+
}, z$1.core.$strip>;
|
|
1707
|
+
}, z$1.core.$strip>;
|
|
1708
|
+
readonly "creation.complete": z$1.ZodObject<{
|
|
1709
|
+
requestId: z$1.ZodString;
|
|
1710
|
+
status: z$1.ZodEnum<{
|
|
1711
|
+
success: "success";
|
|
1712
|
+
failed: "failed";
|
|
1713
|
+
}>;
|
|
1714
|
+
specId: z$1.ZodOptional<z$1.ZodString>;
|
|
1715
|
+
durationMs: z$1.ZodNumber;
|
|
1716
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1717
|
+
}, z$1.core.$strip>;
|
|
1718
|
+
readonly "evolution.request": z$1.ZodObject<{
|
|
1719
|
+
dryRun: z$1.ZodBoolean;
|
|
1720
|
+
}, z$1.core.$strip>;
|
|
1721
|
+
readonly "evolution.complete": z$1.ZodObject<{
|
|
1722
|
+
status: z$1.ZodEnum<{
|
|
1723
|
+
success: "success";
|
|
1724
|
+
failed: "failed";
|
|
1725
|
+
"awaiting-approval": "awaiting-approval";
|
|
1726
|
+
}>;
|
|
1727
|
+
applied: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1728
|
+
awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1729
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1730
|
+
}, z$1.core.$strip>;
|
|
1639
1731
|
};
|
|
1640
1732
|
declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
1641
1733
|
sessionId: z$1.ZodString;
|
|
@@ -2124,6 +2216,44 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
2124
2216
|
stop: "stop";
|
|
2125
2217
|
continue: "continue";
|
|
2126
2218
|
}>;
|
|
2219
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
2220
|
+
requestId: z$1.ZodString;
|
|
2221
|
+
kind: z$1.ZodEnum<{
|
|
2222
|
+
"create-skill": "create-skill";
|
|
2223
|
+
"create-workflow": "create-workflow";
|
|
2224
|
+
"create-bundle": "create-bundle";
|
|
2225
|
+
}>;
|
|
2226
|
+
requirement: z$1.ZodString;
|
|
2227
|
+
hints: z$1.ZodArray<z$1.ZodString>;
|
|
2228
|
+
origin: z$1.ZodObject<{
|
|
2229
|
+
source: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2230
|
+
tool: "tool";
|
|
2231
|
+
scheduler: "scheduler";
|
|
2232
|
+
human: "human";
|
|
2233
|
+
namespace: "namespace";
|
|
2234
|
+
}>>;
|
|
2235
|
+
timestamp: z$1.ZodNumber;
|
|
2236
|
+
}, z$1.core.$strip>;
|
|
2237
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
2238
|
+
requestId: z$1.ZodString;
|
|
2239
|
+
status: z$1.ZodEnum<{
|
|
2240
|
+
success: "success";
|
|
2241
|
+
failed: "failed";
|
|
2242
|
+
}>;
|
|
2243
|
+
specId: z$1.ZodOptional<z$1.ZodString>;
|
|
2244
|
+
durationMs: z$1.ZodNumber;
|
|
2245
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
2246
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
2247
|
+
dryRun: z$1.ZodBoolean;
|
|
2248
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
2249
|
+
status: z$1.ZodEnum<{
|
|
2250
|
+
success: "success";
|
|
2251
|
+
failed: "failed";
|
|
2252
|
+
"awaiting-approval": "awaiting-approval";
|
|
2253
|
+
}>;
|
|
2254
|
+
applied: z$1.ZodOptional<z$1.ZodNumber>;
|
|
2255
|
+
awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
|
|
2256
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
2127
2257
|
}, z$1.core.$strip>;
|
|
2128
2258
|
declare function validateHookInput<T extends HookEvent>(event: T, input: unknown): unknown;
|
|
2129
2259
|
declare function safeValidateHookInput<T extends HookEvent>(event: T, input: unknown): {
|
|
@@ -2389,4 +2519,4 @@ interface PluginDefinition {
|
|
|
2389
2519
|
'context.build.after'?: (input: ContextBuildAfterInput, output: HookOutputWrapper<ContextBuildAfterInput>) => Promise<void>;
|
|
2390
2520
|
}
|
|
2391
2521
|
|
|
2392
|
-
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, type CommandCompleteInput, CommandCompleteInputSchema, type CommandDefinition, type CommandExecuteResult, type CommandExecuteResultMetadata, CommandExecuteResultMetadataSchema, CommandExecuteResultSchema, type CommandExecutionContext, CommandExecutionContextSchema, CommandExecutorSchema, type CommandHookDefinition, type CommandInitContext, CommandInitContextSchema, type CommandInitResult, CommandInitResultSchema, type CommandMetadata, CommandMetadataSchema, type CommandPromptPart, CommandPromptPartSchema, type CommandSource, CommandSourceSchema, type CommandTaskDefinition, CommandTaskDefinitionSchema, type CommandTriggerInput, CommandTriggerInputSchema, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageDeliveredInput, GatewayMessageDeliveredInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReadInput, GatewayMessageReadInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, type HeartbeatTaskDefinition, HeartbeatTaskDefinitionSchema, type HeartbeatTriggerInput, HeartbeatTriggerInputSchema, type HookChainResult, type HookContext, type HookDefinition, type HookError, HookEvent, type HookExecutionDetail, HookExecutorSchema, type HookHandler, type HookMatcher, HookMatcherSchema, type HookOutputWrapper, type HookResult, HookType, type HooksConfig, HooksConfigSchema, HttpExecutorSchema, type HttpHookDefinition, type LlmHeadersInput, LlmHeadersInputSchema, type LlmParamsInput, LlmParamsInputSchema, LlmParamsSchema, LlmProviderSchema, type LoopEndInput, LoopEndInputSchema, type LoopStartInput, LoopStartInputSchema, MessageIDSchema, type MessageReceiveInput, MessageReceiveInputSchema, MessageRoleSchema, MessageSchema, type MessageTransformInput, MessageTransformInputSchema, ModelObjectSchema, ModelSchema, type PermissionAskInput, PermissionAskInputSchema, type PermissionDeniedInput, PermissionDeniedInputSchema, PermissionLevelSchema, PermissionRequestSchema, type Plugin, type PluginDefinition, type PluginInput, PromptExecutorSchema, type PromptHookDefinition, type ScheduledTaskCompleteInput, ScheduledTaskCompleteInputSchema, type ScheduledTaskTriggerInput, ScheduledTaskTriggerInputSchema, type SchedulerTaskDefinition, SchedulerTaskDefinitionSchema, type SessionCompactInput, SessionCompactInputSchema, type SessionCompactingInput, SessionCompactingInputSchema, type SessionEndInput, SessionEndInputSchema, SessionIDSchema, type SessionStartInput, SessionStartInputSchema, type ShellEnvInput, ShellEnvInputSchema, type StepFinishInput, StepFinishInputSchema, type StepStartInput, StepStartInputSchema, type StepStopFailureInput, StepStopFailureInputSchema, type StepStopInput, StepStopInputSchema, type SystemTransformInput, SystemTransformInputSchema, type TaskCompleteInput, TaskCompleteInputSchema, type TaskDefinition, type TaskProgressInput, TaskProgressInputSchema, type TaskRunningInput, TaskRunningInputSchema, type TaskSource, TaskSourceSchema, type TaskStartInput, TaskStartInputSchema, type TextCompleteInput, TextCompleteInputSchema, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, safeValidateHookInput, tool, validateHookInput };
|
|
2522
|
+
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, type CommandCompleteInput, CommandCompleteInputSchema, type CommandDefinition, type CommandExecuteResult, type CommandExecuteResultMetadata, CommandExecuteResultMetadataSchema, CommandExecuteResultSchema, type CommandExecutionContext, CommandExecutionContextSchema, CommandExecutorSchema, type CommandHookDefinition, type CommandInitContext, CommandInitContextSchema, type CommandInitResult, CommandInitResultSchema, type CommandMetadata, CommandMetadataSchema, type CommandPromptPart, CommandPromptPartSchema, type CommandSource, CommandSourceSchema, type CommandTaskDefinition, CommandTaskDefinitionSchema, type CommandTriggerInput, CommandTriggerInputSchema, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, type CreationCompleteInput, CreationCompleteInputSchema, type CreationRequestInput, CreationRequestInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, type EvolutionCompleteInput, EvolutionCompleteInputSchema, type EvolutionRequestInput, EvolutionRequestInputSchema, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageDeliveredInput, GatewayMessageDeliveredInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReadInput, GatewayMessageReadInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, type HeartbeatTaskDefinition, HeartbeatTaskDefinitionSchema, type HeartbeatTriggerInput, HeartbeatTriggerInputSchema, type HookChainResult, type HookContext, type HookDefinition, type HookError, HookEvent, type HookExecutionDetail, HookExecutorSchema, type HookHandler, type HookMatcher, HookMatcherSchema, type HookOutputWrapper, type HookResult, HookType, type HooksConfig, HooksConfigSchema, HttpExecutorSchema, type HttpHookDefinition, type LlmHeadersInput, LlmHeadersInputSchema, type LlmParamsInput, LlmParamsInputSchema, LlmParamsSchema, LlmProviderSchema, type LoopEndInput, LoopEndInputSchema, type LoopStartInput, LoopStartInputSchema, MessageIDSchema, type MessageReceiveInput, MessageReceiveInputSchema, MessageRoleSchema, MessageSchema, type MessageTransformInput, MessageTransformInputSchema, ModelObjectSchema, ModelSchema, type PermissionAskInput, PermissionAskInputSchema, type PermissionDeniedInput, PermissionDeniedInputSchema, PermissionLevelSchema, PermissionRequestSchema, type Plugin, type PluginDefinition, type PluginInput, PromptExecutorSchema, type PromptHookDefinition, type ScheduledTaskCompleteInput, ScheduledTaskCompleteInputSchema, type ScheduledTaskTriggerInput, ScheduledTaskTriggerInputSchema, type SchedulerTaskDefinition, SchedulerTaskDefinitionSchema, type SessionCompactInput, SessionCompactInputSchema, type SessionCompactingInput, SessionCompactingInputSchema, type SessionEndInput, SessionEndInputSchema, SessionIDSchema, type SessionStartInput, SessionStartInputSchema, type ShellEnvInput, ShellEnvInputSchema, type StepFinishInput, StepFinishInputSchema, type StepStartInput, StepStartInputSchema, type StepStopFailureInput, StepStopFailureInputSchema, type StepStopInput, StepStopInputSchema, type SystemTransformInput, SystemTransformInputSchema, type TaskCompleteInput, TaskCompleteInputSchema, type TaskDefinition, type TaskProgressInput, TaskProgressInputSchema, type TaskRunningInput, TaskRunningInputSchema, type TaskSource, TaskSourceSchema, type TaskStartInput, TaskStartInputSchema, type TextCompleteInput, TextCompleteInputSchema, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, safeValidateHookInput, tool, validateHookInput };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import T,{z as z$1}from'zod';export{buildToolArgs,createTool,toolSchema as schema}from'@easbot/types';import'@easbot/sdk';function C(s){return {description:s.description,args:s.args,execute:s.execute}}C.schema=T;var p={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",GatewayMessageDelivered:"gateway.message.delivered",GatewayMessageRead:"gateway.message.read",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",CommandTrigger:"scheduler.command.trigger",CommandComplete:"scheduler.command.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskRunning:"task.running",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end"},Le=Object.values(o);var l=z$1.string().optional(),v=z$1.object({type:z$1.literal(p.Command),command:z$1.string(),if:l,shell:z$1.enum(["bash","powershell"]).optional(),timeout:z$1.number().positive().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),async:z$1.boolean().optional()}),P=z$1.object({type:z$1.literal(p.Prompt),if:l,timeout:z$1.number().positive().optional(),model:z$1.string().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),runMode:z$1.enum(["session","fork"]).optional(),system:z$1.string().optional(),parts:z$1.array(z$1.unknown())}),H=z$1.object({type:z$1.literal(p.Http),url:z$1.string(),if:l,timeout:z$1.number().positive().optional(),method:z$1.enum(["GET","POST","PUT","DELETE"]).optional(),headers:z$1.record(z$1.string(),z$1.string()).optional(),allowedEnvVars:z$1.array(z$1.string()).optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional()}),w=z$1.object({type:z$1.literal(p.Agent),if:l,timeout:z$1.number().positive().optional(),agent:z$1.string().optional(),model:z$1.string().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),system:z$1.string().optional(),parts:z$1.array(z$1.unknown())}),E=z$1.object({type:z$1.literal(p.Function),handler:z$1.function()}),M=z$1.discriminatedUnion("type",[v,P,H,w,E]),j=z$1.object({event:z$1.string(),matcher:z$1.string().optional(),hooks:z$1.array(M)}),Ze=z$1.record(z$1.string(),z$1.array(j)),n=z$1.string().min(1).describe("Session unique identifier"),r=z$1.string().min(1).describe("Message unique identifier"),c=z$1.string().min(1).describe("Tool call unique identifier"),m=z$1.string().optional().describe("Agent name"),d=z$1.string().optional().describe("Model identifier"),I=z$1.object({providerId:z$1.string().describe("Provider ID"),modelId:z$1.string().describe("Model ID"),api:z$1.object({id:z$1.string().describe("API ID"),npm:z$1.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),S=z$1.string().optional().describe("Working directory path"),D=z$1.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),z=z$1.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),R=z$1.object({sessionId:n,source:z$1.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:d,agent:m,cwd:S}),A=z$1.object({sessionId:n,reason:D,duration:z$1.number().positive().optional().describe("Session duration in milliseconds")}),F=z$1.object({sessionId:n,trigger:z$1.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:z$1.number().positive().describe("Current context length"),threshold:z$1.number().positive().describe("Trigger threshold")}),O=z$1.object({sessionId:n,summary:z$1.string().describe("Compaction summary"),previousLength:z$1.number().positive().describe("Previous context length"),newLength:z$1.number().positive().describe("New context length")}),G=z$1.object({sessionId:n,messageId:r,userMessageId:r.optional().describe("User message ID for the current step"),model:d,agent:m}),W=z$1.object({sessionId:n,messageId:r,userMessageId:r.optional().describe("User message ID for the current step"),model:d,agent:m,finishReason:z,tokens:z$1.object({input:z$1.number().int().nonnegative().optional(),output:z$1.number().int().nonnegative().optional(),total:z$1.number().int().nonnegative().optional()}).optional().describe("Token usage statistics")}),B=z$1.object({sessionId:n,reason:z$1.string().describe("Stop reason")}),L=z$1.object({sessionId:n,error:z$1.string().describe("Error message"),errorType:z$1.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),_=z$1.enum(["user","assistant","system","tool"]),h=z$1.discriminatedUnion("type",[z$1.object({type:z$1.literal("text"),text:z$1.string().describe("Text content")}),z$1.object({type:z$1.literal("image"),source:z$1.object({type:z$1.enum(["base64","url"]),mime:z$1.string().optional().describe("File mime type"),data:z$1.string().describe("File base64 encoding data or url")})}),z$1.object({type:z$1.literal("file"),url:z$1.string().describe("File path"),filename:z$1.string().describe("File name"),mime:z$1.string().optional().describe("File mime type")})]),x=z$1.object({id:r,role:_,content:z$1.union([z$1.string(),z$1.array(h)]),name:z$1.string().optional().describe("Message sender name"),tool_call_id:c.optional().describe("Related tool call ID")}),q=z$1.object({sessionId:n,agent:m,model:d,messageId:r,message:z$1.object({id:r,role:z$1.literal("user"),content:z$1.union([z$1.string(),z$1.array(h)])}).describe("User message")}),U=z$1.object({sessionId:n,messages:z$1.array(x).describe("Messages to transform")}),N=z$1.object({sessionId:n,model:d,system:z$1.array(z$1.string()).describe("Current system prompt")}),g=z$1.record(z$1.string(),z$1.unknown()).describe("Tool call arguments"),Z=z$1.object({title:z$1.string().optional().describe("Result title"),content:z$1.string().describe("Result content"),is_error:z$1.boolean().optional().describe("Is error result"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Extra metadata")}),V=z$1.object({sessionId:n,userMessageId:r.optional().describe("User message ID for the current step"),tool:z$1.string().describe("Tool name"),callId:c,args:g}),$=z$1.object({sessionId:n,userMessageId:r.optional().describe("User message ID for the current step"),tool:z$1.string(),callId:c,args:g,result:Z,duration:z$1.number().nonnegative().optional().describe("Execution duration in milliseconds")}),K=z$1.object({sessionId:n,tool:z$1.string(),callId:c,args:g,error:z$1.string().describe("Error message"),errorType:z$1.enum(["timeout","invalid_args","execution_error","permission_denied"])}),J=z$1.object({sessionId:n,toolID:z$1.string().describe("Tool ID"),definition:z$1.object({name:z$1.string(),description:z$1.string().optional(),parameters:z$1.record(z$1.string(),z$1.unknown()).optional()}).describe("Tool definition")}),Q=z$1.object({sessionId:n,command:z$1.string().describe("Command name"),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments")}),X=z$1.object({sessionId:n,command:z$1.string().describe("Command name"),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).optional(),result:z$1.object({info:z$1.unknown().optional().describe("Message info"),parts:z$1.array(z$1.unknown()).optional().describe("Message parts"),title:z$1.string().optional().describe("Result title"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Result metadata"),output:z$1.string().optional().describe("Result output"),success:z$1.boolean().optional().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}).describe("Command execution result")}),Y=z$1.enum(["read","write","exec","admin"]),ee=z$1.object({tool:z$1.string().describe("Tool name requesting permission"),args:g.optional(),level:Y.optional(),reason:z$1.string().optional().describe("Reason for permission request")}),te=z$1.object({sessionId:n,request:ee}),oe=z$1.object({sessionId:n,tool:z$1.string(),reason:z$1.string().optional()}),k=z$1.enum(["openai","anthropic","google","azure","custom"]),ne=z$1.object({temperature:z$1.number().min(0).max(2).optional(),topP:z$1.number().min(0).max(1).optional(),topK:z$1.number().int().positive().optional(),maxTokens:z$1.number().int().positive().optional(),stopSequences:z$1.array(z$1.string()).optional(),responseFormat:z$1.enum(["text","json_object"]).optional()}),re=z$1.object({sessionId:n,agent:m,model:I,provider:k,params:ne.partial().optional()}),se=z$1.object({sessionId:n,agent:m,model:I,provider:k,headers:z$1.record(z$1.string(),z$1.string()).optional()}),ie=z$1.object({cwd:S.describe("Working directory"),sessionId:n.optional(),callId:c.optional()}),ae=z$1.object({sessionId:n,messageId:r,partId:z$1.string().describe("Text part ID"),text:z$1.string().describe("Completed text")}),pe=z$1.object({sessionId:n,mode:z$1.enum(["agent","chat","query"]).describe("Build mode"),providerId:z$1.string().optional()}),me=z$1.object({sessionId:n,context:z$1.object({messages:z$1.array(x),system:z$1.array(z$1.string()),metadata:z$1.record(z$1.string(),z$1.unknown())}).describe("Built context")}),ue=z$1.object({gatewayID:z$1.string().describe("Gateway ID"),messageId:r,message:z$1.unknown().describe("Received message")}),ce=z$1.object({gatewayID:z$1.string(),messageId:r,message:z$1.unknown(),sessionId:n.optional()}),de=z$1.object({gatewayID:z$1.string(),messageId:r,result:z$1.unknown().optional()}),le=z$1.object({gatewayID:z$1.string(),messageId:r,message:z$1.unknown(),target:z$1.string().optional().describe("Send target")}),ge=z$1.object({gatewayID:z$1.string(),messageId:r,sessionId:n.optional(),channel:z$1.object({platform:z$1.string(),channelId:z$1.string()}),timestamp:z$1.number().describe("Delivery timestamp")}),be=z$1.object({gatewayID:z$1.string(),messageId:r,sessionId:n.optional(),channel:z$1.object({platform:z$1.string(),channelId:z$1.string()}),timestamp:z$1.number().describe("Read timestamp")}),fe=z$1.object({type:z$1.literal("command"),config:z$1.object({command:z$1.string(),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).optional()})}),ye=z$1.object({type:z$1.literal("heartbeat"),parts:z$1.array(z$1.unknown()),system:z$1.string().optional(),config:z$1.object({session:z$1.string().optional(),mode:z$1.enum(["session","fork"]).optional(),agent:z$1.string().optional(),model:z$1.string().optional(),tools:z$1.record(z$1.string(),z$1.boolean()).optional()}).optional()}),Ie=z$1.object({type:z$1.literal("scheduler"),parts:z$1.array(z$1.unknown()),system:z$1.string().optional(),config:z$1.object({agentType:z$1.string().optional(),transport:z$1.enum(["stdio","http","websocket","cli"]).optional(),model:z$1.string().optional(),tools:z$1.record(z$1.string(),z$1.boolean()).optional()}).optional()}),Se=z$1.object({taskId:z$1.string().describe("Heartbeat task ID"),timestamp:z$1.number().describe("Heartbeat timestamp"),name:z$1.string().optional().describe("Heartbeat name"),definition:ye.optional()}),he=z$1.object({taskId:z$1.string().describe("Heartbeat task ID"),sessionId:n.optional(),timestamp:z$1.number(),duration:z$1.number().nonnegative().optional(),success:z$1.boolean().optional(),error:z$1.string().optional()}),xe=z$1.object({taskId:z$1.string().describe("Task ID"),taskName:z$1.string().optional(),timestamp:z$1.number(),payload:z$1.record(z$1.string(),z$1.unknown()).optional(),definition:Ie.optional()}),ke=z$1.object({taskId:z$1.string(),timestamp:z$1.number(),success:z$1.boolean(),result:z$1.record(z$1.string(),z$1.unknown()).optional(),error:z$1.string().optional()}),Te=z$1.object({taskId:z$1.string().describe("Command task unique identifier"),taskName:z$1.string().describe("Command task name"),command:z$1.string().describe("Command name"),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).optional().describe("Command arguments"),timestamp:z$1.number().describe("Trigger timestamp"),definition:fe.optional()}),Ce=z$1.object({taskId:z$1.string(),timestamp:z$1.number(),success:z$1.boolean(),output:z$1.string().optional(),error:z$1.string().optional(),duration:z$1.number().describe("Execution duration in milliseconds")}),b=z$1.enum(["tool","scheduler","cli","api"]),ve=z$1.object({taskId:z$1.string().describe("Task unique identifier"),sessionId:z$1.string().describe("Session ID for this task"),source:b.describe("Task source: tool, scheduler, cli, api"),agentType:z$1.string().describe("Agent type to execute this task"),description:z$1.string().describe("Task description"),prompt:z$1.string().describe("Task prompt content"),timeout:z$1.number().positive().optional().describe("Task timeout in milliseconds")}),Pe=z$1.object({taskId:z$1.string().describe("Task unique identifier"),sessionId:z$1.string().describe("Session ID for this task"),source:b.describe("Task source: tool, scheduler, cli, api")}),He=z$1.object({taskId:z$1.string(),sessionId:z$1.string(),source:b,step:z$1.number().describe("Current step number"),totalSteps:z$1.number().optional().describe("Total number of steps"),output:z$1.string().describe("Progress output content"),timestamp:z$1.number().describe("Progress timestamp")}),we=z$1.object({taskId:z$1.string(),sessionId:z$1.string(),source:b,result:z$1.string().describe("Task result content"),duration:z$1.number().nonnegative().describe("Task duration in milliseconds"),attachments:z$1.array(z$1.unknown()).optional().describe("Task result attachments"),error:z$1.string().optional().describe("Error message if task failed"),agentType:z$1.string().optional().describe("Agent type that executed the task"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Additional metadata for the task result")}),Ee=z$1.object({sessionId:z$1.string().describe("Session ID"),step:z$1.number().describe("Current step number"),lastUserId:z$1.string().describe("Last user message ID"),result:z$1.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),Me=z$1.object({sessionId:z$1.string().describe("Session ID"),step:z$1.number().describe("Current step number"),lastUserId:z$1.string().describe("Last user message ID"),result:z$1.enum(["stop","continue"]).describe("Loop result: stop or continue")}),y={[o.SessionStart]:R,[o.SessionEnd]:A,[o.SessionCompacting]:F,[o.SessionCompact]:O,[o.StepStart]:G,[o.StepFinish]:W,[o.StepStop]:B,[o.StepStopFailure]:L,[o.MessageReceive]:q,[o.MessageTransform]:U,[o.SystemTransform]:N,[o.ToolBefore]:V,[o.ToolAfter]:$,[o.ToolFailure]:K,[o.ToolDefinition]:J,[o.CommandBefore]:Q,[o.CommandAfter]:X,[o.PermissionAsk]:te,[o.PermissionDenied]:oe,[o.LlmParams]:re,[o.LlmHeaders]:se,[o.ShellEnv]:ie,[o.TextComplete]:ae,[o.ContextBuildBefore]:pe,[o.ContextBuildAfter]:me,[o.GatewayMessageReceive]:ue,[o.GatewayMessageProcess]:ce,[o.GatewayMessageComplete]:de,[o.GatewayMessageSend]:le,[o.GatewayMessageDelivered]:ge,[o.GatewayMessageRead]:be,[o.HeartbeatTrigger]:Se,[o.HeartbeatComplete]:he,[o.ScheduledTaskTrigger]:xe,[o.ScheduledTaskComplete]:ke,[o.CommandTrigger]:Te,[o.CommandComplete]:Ce,[o.TaskStart]:ve,[o.TaskRunning]:Pe,[o.TaskProgress]:He,[o.TaskComplete]:we,[o.LoopStart]:Ee,[o.LoopEnd]:Me};function Ve(s){return y[s]}function $e(s,f){let u=y[s];if(!u)throw new Error(`No schema found for event: ${s}`);return u.parse(f)}function Ke(s,f){let u=y[s];return u?u.safeParse(f):{success:false,error:new z$1.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var rt=z$1.enum(["command","mcp","skill"]).describe("Command source"),je=z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments"),De=z$1.discriminatedUnion("type",[z$1.object({type:z$1.literal("text"),text:z$1.string().describe("Text content")}),z$1.object({type:z$1.literal("image"),source:z$1.object({type:z$1.enum(["base64","url"]),mime:z$1.string().describe("File mime type"),data:z$1.string().describe("File base64 encoding data or url")})}),z$1.object({type:z$1.literal("file"),url:z$1.string().describe("File path"),filename:z$1.string().describe("File name"),mime:z$1.string().optional().describe("File mime type")})]),st=z$1.object({name:z$1.string().describe("Command name"),description:z$1.string().describe("Command description"),scope:z$1.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:z$1.string().optional().describe("Specified agent name"),model:z$1.string().optional().describe("Specified model"),hints:z$1.array(z$1.string()).optional().describe("Argument hints"),commandType:z$1.enum(["prompt","local"]).optional().describe("Command type"),hidden:z$1.boolean().optional().describe("Whether hidden")}),it=z$1.object({sessionId:z$1.string().describe("Session ID"),directory:z$1.string().describe("Working directory"),model:z$1.string().optional().describe("Model identifier"),agent:z$1.string().optional().describe("Agent name"),arguments:je.describe("Command arguments")}),ze=z$1.record(z$1.string(),z$1.unknown()).describe("Result metadata"),at=z$1.object({title:z$1.string().describe("Result title"),metadata:ze.describe("Result metadata"),output:z$1.string().describe("Result output"),parts:z$1.array(De).optional().describe("Result parts"),success:z$1.boolean().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}),pt=z$1.object({agent:z$1.object({name:z$1.string().describe("Agent name"),model:z$1.string().optional().describe("Agent model")}).optional().describe("Agent context")}),mt=z$1.object({isEnabled:z$1.boolean().optional().describe("Is enabled check result")});export{w as AgentExecutorSchema,m as AgentSchema,c as CallIDSchema,X as CommandAfterInputSchema,je as CommandArgumentsSchema,Q as CommandBeforeInputSchema,Ce as CommandCompleteInputSchema,ze as CommandExecuteResultMetadataSchema,at as CommandExecuteResultSchema,it as CommandExecutionContextSchema,v as CommandExecutorSchema,pt as CommandInitContextSchema,mt as CommandInitResultSchema,st as CommandMetadataSchema,De as CommandPromptPartSchema,rt as CommandSourceSchema,fe as CommandTaskDefinitionSchema,Te as CommandTriggerInputSchema,h as ContentPartSchema,me as ContextBuildAfterInputSchema,pe as ContextBuildBeforeInputSchema,S as CwdSchema,D as EndReasonSchema,y as EventInputSchemas,z as FinishReasonSchema,E as FunctionExecutorSchema,de as GatewayMessageCompleteInputSchema,ge as GatewayMessageDeliveredInputSchema,ce as GatewayMessageProcessInputSchema,be as GatewayMessageReadInputSchema,ue as GatewayMessageReceiveInputSchema,le as GatewayMessageSendInputSchema,Le as HOOK_EVENTS,he as HeartbeatCompleteInputSchema,ye as HeartbeatTaskDefinitionSchema,Se as HeartbeatTriggerInputSchema,o as HookEvent,M as HookExecutorSchema,j as HookMatcherSchema,p as HookType,Ze as HooksConfigSchema,H as HttpExecutorSchema,se as LlmHeadersInputSchema,re as LlmParamsInputSchema,ne as LlmParamsSchema,k as LlmProviderSchema,Me as LoopEndInputSchema,Ee as LoopStartInputSchema,r as MessageIDSchema,q as MessageReceiveInputSchema,_ as MessageRoleSchema,x as MessageSchema,U as MessageTransformInputSchema,I as ModelObjectSchema,d as ModelSchema,te as PermissionAskInputSchema,oe as PermissionDeniedInputSchema,Y as PermissionLevelSchema,ee as PermissionRequestSchema,P as PromptExecutorSchema,ke as ScheduledTaskCompleteInputSchema,xe as ScheduledTaskTriggerInputSchema,Ie as SchedulerTaskDefinitionSchema,O as SessionCompactInputSchema,F as SessionCompactingInputSchema,A as SessionEndInputSchema,n as SessionIDSchema,R as SessionStartInputSchema,ie as ShellEnvInputSchema,W as StepFinishInputSchema,G as StepStartInputSchema,L as StepStopFailureInputSchema,B as StepStopInputSchema,N as SystemTransformInputSchema,we as TaskCompleteInputSchema,He as TaskProgressInputSchema,Pe as TaskRunningInputSchema,b as TaskSourceSchema,ve as TaskStartInputSchema,ae as TextCompleteInputSchema,$ as ToolAfterInputSchema,g as ToolArgsSchema,V as ToolBeforeInputSchema,J as ToolDefinitionInputSchema,K as ToolFailureInputSchema,Z as ToolResultSchema,Ve as getEventInputSchema,Ke as safeValidateHookInput,C as tool,$e as validateHookInput};
|
|
1
|
+
import C,{z as z$1}from'zod';export{buildToolArgs,createTool,toolSchema as schema}from'@easbot/types';import'@easbot/sdk';function T(s){return {description:s.description,args:s.args,execute:s.execute}}T.schema=C;var p={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",GatewayMessageDelivered:"gateway.message.delivered",GatewayMessageRead:"gateway.message.read",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",CommandTrigger:"scheduler.command.trigger",CommandComplete:"scheduler.command.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskRunning:"task.running",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end",CreationRequest:"creation.request",CreationComplete:"creation.complete",EvolutionRequest:"evolution.request",EvolutionComplete:"evolution.complete"},Ne=Object.values(o);var l=z$1.string().optional(),v=z$1.object({type:z$1.literal(p.Command),command:z$1.string(),if:l,shell:z$1.enum(["bash","powershell"]).optional(),timeout:z$1.number().positive().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),async:z$1.boolean().optional()}),P=z$1.object({type:z$1.literal(p.Prompt),if:l,timeout:z$1.number().positive().optional(),model:z$1.string().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),runMode:z$1.enum(["session","fork"]).optional(),system:z$1.string().optional(),parts:z$1.array(z$1.unknown())}),H=z$1.object({type:z$1.literal(p.Http),url:z$1.string(),if:l,timeout:z$1.number().positive().optional(),method:z$1.enum(["GET","POST","PUT","DELETE"]).optional(),headers:z$1.record(z$1.string(),z$1.string()).optional(),allowedEnvVars:z$1.array(z$1.string()).optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional()}),w=z$1.object({type:z$1.literal(p.Agent),if:l,timeout:z$1.number().positive().optional(),agent:z$1.string().optional(),model:z$1.string().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),system:z$1.string().optional(),parts:z$1.array(z$1.unknown())}),E=z$1.object({type:z$1.literal(p.Function),handler:z$1.function()}),j=z$1.discriminatedUnion("type",[v,P,H,w,E]),M=z$1.object({event:z$1.string(),matcher:z$1.string().optional(),hooks:z$1.array(j)}),Je=z$1.record(z$1.string(),z$1.array(M)),n=z$1.string().min(1).describe("Session unique identifier"),r=z$1.string().min(1).describe("Message unique identifier"),c=z$1.string().min(1).describe("Tool call unique identifier"),u=z$1.string().optional().describe("Agent name"),d=z$1.string().optional().describe("Model identifier"),I=z$1.object({providerId:z$1.string().describe("Provider ID"),modelId:z$1.string().describe("Model ID"),api:z$1.object({id:z$1.string().describe("API ID"),npm:z$1.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),S=z$1.string().optional().describe("Working directory path"),D=z$1.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),R=z$1.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),z=z$1.object({sessionId:n,source:z$1.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:d,agent:u,cwd:S}),A=z$1.object({sessionId:n,reason:D,duration:z$1.number().positive().optional().describe("Session duration in milliseconds")}),F=z$1.object({sessionId:n,trigger:z$1.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:z$1.number().positive().describe("Current context length"),threshold:z$1.number().positive().describe("Trigger threshold")}),O=z$1.object({sessionId:n,summary:z$1.string().describe("Compaction summary"),previousLength:z$1.number().positive().describe("Previous context length"),newLength:z$1.number().positive().describe("New context length")}),G=z$1.object({sessionId:n,messageId:r,userMessageId:r.optional().describe("User message ID for the current step"),model:d,agent:u}),W=z$1.object({sessionId:n,messageId:r,userMessageId:r.optional().describe("User message ID for the current step"),model:d,agent:u,finishReason:R,tokens:z$1.object({input:z$1.number().int().nonnegative().optional(),output:z$1.number().int().nonnegative().optional(),total:z$1.number().int().nonnegative().optional()}).optional().describe("Token usage statistics")}),B=z$1.object({sessionId:n,reason:z$1.string().describe("Stop reason")}),L=z$1.object({sessionId:n,error:z$1.string().describe("Error message"),errorType:z$1.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),q=z$1.enum(["user","assistant","system","tool"]),h=z$1.discriminatedUnion("type",[z$1.object({type:z$1.literal("text"),text:z$1.string().describe("Text content")}),z$1.object({type:z$1.literal("image"),source:z$1.object({type:z$1.enum(["base64","url"]),mime:z$1.string().optional().describe("File mime type"),data:z$1.string().describe("File base64 encoding data or url")})}),z$1.object({type:z$1.literal("file"),url:z$1.string().describe("File path"),filename:z$1.string().describe("File name"),mime:z$1.string().optional().describe("File mime type")})]),x=z$1.object({id:r,role:q,content:z$1.union([z$1.string(),z$1.array(h)]),name:z$1.string().optional().describe("Message sender name"),tool_call_id:c.optional().describe("Related tool call ID")}),_=z$1.object({sessionId:n,agent:u,model:d,messageId:r,message:z$1.object({id:r,role:z$1.literal("user"),content:z$1.union([z$1.string(),z$1.array(h)])}).describe("User message")}),U=z$1.object({sessionId:n,messages:z$1.array(x).describe("Messages to transform")}),N=z$1.object({sessionId:n,model:d,system:z$1.array(z$1.string()).describe("Current system prompt")}),g=z$1.record(z$1.string(),z$1.unknown()).describe("Tool call arguments"),Z=z$1.object({title:z$1.string().optional().describe("Result title"),content:z$1.string().describe("Result content"),is_error:z$1.boolean().optional().describe("Is error result"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Extra metadata")}),V=z$1.object({sessionId:n,userMessageId:r.optional().describe("User message ID for the current step"),tool:z$1.string().describe("Tool name"),callId:c,args:g}),$=z$1.object({sessionId:n,userMessageId:r.optional().describe("User message ID for the current step"),tool:z$1.string(),callId:c,args:g,result:Z,duration:z$1.number().nonnegative().optional().describe("Execution duration in milliseconds")}),K=z$1.object({sessionId:n,tool:z$1.string(),callId:c,args:g,error:z$1.string().describe("Error message"),errorType:z$1.enum(["timeout","invalid_args","execution_error","permission_denied"])}),J=z$1.object({sessionId:n,toolID:z$1.string().describe("Tool ID"),definition:z$1.object({name:z$1.string(),description:z$1.string().optional(),parameters:z$1.record(z$1.string(),z$1.unknown()).optional()}).describe("Tool definition")}),Q=z$1.object({sessionId:n,command:z$1.string().describe("Command name"),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments")}),X=z$1.object({sessionId:n,command:z$1.string().describe("Command name"),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).optional(),result:z$1.object({info:z$1.unknown().optional().describe("Message info"),parts:z$1.array(z$1.unknown()).optional().describe("Message parts"),title:z$1.string().optional().describe("Result title"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Result metadata"),output:z$1.string().optional().describe("Result output"),success:z$1.boolean().optional().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}).describe("Command execution result")}),Y=z$1.enum(["read","write","exec","admin"]),ee=z$1.object({tool:z$1.string().describe("Tool name requesting permission"),args:g.optional(),level:Y.optional(),reason:z$1.string().optional().describe("Reason for permission request")}),te=z$1.object({sessionId:n,request:ee}),oe=z$1.object({sessionId:n,tool:z$1.string(),reason:z$1.string().optional()}),k=z$1.enum(["openai","anthropic","google","azure","custom"]),ne=z$1.object({temperature:z$1.number().min(0).max(2).optional(),topP:z$1.number().min(0).max(1).optional(),topK:z$1.number().int().positive().optional(),maxTokens:z$1.number().int().positive().optional(),stopSequences:z$1.array(z$1.string()).optional(),responseFormat:z$1.enum(["text","json_object"]).optional()}),re=z$1.object({sessionId:n,agent:u,model:I,provider:k,params:ne.partial().optional()}),se=z$1.object({sessionId:n,agent:u,model:I,provider:k,headers:z$1.record(z$1.string(),z$1.string()).optional()}),ie=z$1.object({cwd:S.describe("Working directory"),sessionId:n.optional(),callId:c.optional()}),ae=z$1.object({sessionId:n,messageId:r,partId:z$1.string().describe("Text part ID"),text:z$1.string().describe("Completed text")}),pe=z$1.object({sessionId:n,mode:z$1.enum(["agent","chat","query"]).describe("Build mode"),providerId:z$1.string().optional()}),ue=z$1.object({sessionId:n,context:z$1.object({messages:z$1.array(x),system:z$1.array(z$1.string()),metadata:z$1.record(z$1.string(),z$1.unknown())}).describe("Built context")}),me=z$1.object({gatewayID:z$1.string().describe("Gateway ID"),messageId:r,message:z$1.unknown().describe("Received message")}),ce=z$1.object({gatewayID:z$1.string(),messageId:r,message:z$1.unknown(),sessionId:n.optional()}),de=z$1.object({gatewayID:z$1.string(),messageId:r,result:z$1.unknown().optional()}),le=z$1.object({gatewayID:z$1.string(),messageId:r,message:z$1.unknown(),target:z$1.string().optional().describe("Send target")}),ge=z$1.object({gatewayID:z$1.string(),messageId:r,sessionId:n.optional(),channel:z$1.object({platform:z$1.string(),channelId:z$1.string()}),timestamp:z$1.number().describe("Delivery timestamp")}),be=z$1.object({gatewayID:z$1.string(),messageId:r,sessionId:n.optional(),channel:z$1.object({platform:z$1.string(),channelId:z$1.string()}),timestamp:z$1.number().describe("Read timestamp")}),fe=z$1.object({type:z$1.literal("command"),config:z$1.object({command:z$1.string(),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).optional()})}),ye=z$1.object({type:z$1.literal("heartbeat"),parts:z$1.array(z$1.unknown()),system:z$1.string().optional(),config:z$1.object({session:z$1.string().optional(),mode:z$1.enum(["session","fork"]).optional(),agent:z$1.string().optional(),model:z$1.string().optional(),tools:z$1.record(z$1.string(),z$1.boolean()).optional()}).optional()}),Ie=z$1.object({type:z$1.literal("scheduler"),parts:z$1.array(z$1.unknown()),system:z$1.string().optional(),config:z$1.object({agentType:z$1.string().optional(),transport:z$1.enum(["stdio","http","websocket","cli"]).optional(),model:z$1.string().optional(),tools:z$1.record(z$1.string(),z$1.boolean()).optional()}).optional()}),Se=z$1.object({taskId:z$1.string().describe("Heartbeat task ID"),timestamp:z$1.number().describe("Heartbeat timestamp"),name:z$1.string().optional().describe("Heartbeat name"),definition:ye.optional()}),he=z$1.object({taskId:z$1.string().describe("Heartbeat task ID"),sessionId:n.optional(),timestamp:z$1.number(),duration:z$1.number().nonnegative().optional(),success:z$1.boolean().optional(),error:z$1.string().optional()}),xe=z$1.object({taskId:z$1.string().describe("Task ID"),taskName:z$1.string().optional(),timestamp:z$1.number(),payload:z$1.record(z$1.string(),z$1.unknown()).optional(),definition:Ie.optional()}),ke=z$1.object({taskId:z$1.string(),timestamp:z$1.number(),success:z$1.boolean(),result:z$1.record(z$1.string(),z$1.unknown()).optional(),error:z$1.string().optional()}),Ce=z$1.object({taskId:z$1.string().describe("Command task unique identifier"),taskName:z$1.string().describe("Command task name"),command:z$1.string().describe("Command name"),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).optional().describe("Command arguments"),timestamp:z$1.number().describe("Trigger timestamp"),definition:fe.optional()}),Te=z$1.object({taskId:z$1.string(),timestamp:z$1.number(),success:z$1.boolean(),output:z$1.string().optional(),error:z$1.string().optional(),duration:z$1.number().describe("Execution duration in milliseconds")}),b=z$1.enum(["tool","scheduler","cli","api"]),ve=z$1.object({taskId:z$1.string().describe("Task unique identifier"),sessionId:z$1.string().describe("Session ID for this task"),source:b.describe("Task source: tool, scheduler, cli, api"),agentType:z$1.string().describe("Agent type to execute this task"),description:z$1.string().describe("Task description"),prompt:z$1.string().describe("Task prompt content"),timeout:z$1.number().positive().optional().describe("Task timeout in milliseconds")}),Pe=z$1.object({taskId:z$1.string().describe("Task unique identifier"),sessionId:z$1.string().describe("Session ID for this task"),source:b.describe("Task source: tool, scheduler, cli, api")}),He=z$1.object({taskId:z$1.string(),sessionId:z$1.string(),source:b,step:z$1.number().describe("Current step number"),totalSteps:z$1.number().optional().describe("Total number of steps"),output:z$1.string().describe("Progress output content"),timestamp:z$1.number().describe("Progress timestamp")}),we=z$1.object({taskId:z$1.string(),sessionId:z$1.string(),source:b,result:z$1.string().describe("Task result content"),duration:z$1.number().nonnegative().describe("Task duration in milliseconds"),attachments:z$1.array(z$1.unknown()).optional().describe("Task result attachments"),error:z$1.string().optional().describe("Error message if task failed"),agentType:z$1.string().optional().describe("Agent type that executed the task"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Additional metadata for the task result")}),Ee=z$1.object({sessionId:z$1.string().describe("Session ID"),step:z$1.number().describe("Current step number"),lastUserId:z$1.string().describe("Last user message ID"),result:z$1.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),je=z$1.object({sessionId:z$1.string().describe("Session ID"),step:z$1.number().describe("Current step number"),lastUserId:z$1.string().describe("Last user message ID"),result:z$1.enum(["stop","continue"]).describe("Loop result: stop or continue")}),Me=z$1.object({requestId:z$1.string(),kind:z$1.enum(["create-skill","create-workflow","create-bundle"]),requirement:z$1.string(),hints:z$1.array(z$1.string()),origin:z$1.object({source:z$1.enum(["human","tool","scheduler","namespace"]).optional(),timestamp:z$1.number().int().nonnegative()})}),De=z$1.object({requestId:z$1.string(),status:z$1.enum(["success","failed"]),specId:z$1.string().optional(),durationMs:z$1.number().int().nonnegative(),error:z$1.string().optional()}),Re=z$1.object({dryRun:z$1.boolean()}),ze=z$1.object({status:z$1.enum(["success","failed","awaiting-approval"]),applied:z$1.number().int().nonnegative().optional(),awaitingApproval:z$1.number().int().nonnegative().optional(),error:z$1.string().optional()}),y={[o.SessionStart]:z,[o.SessionEnd]:A,[o.SessionCompacting]:F,[o.SessionCompact]:O,[o.StepStart]:G,[o.StepFinish]:W,[o.StepStop]:B,[o.StepStopFailure]:L,[o.MessageReceive]:_,[o.MessageTransform]:U,[o.SystemTransform]:N,[o.ToolBefore]:V,[o.ToolAfter]:$,[o.ToolFailure]:K,[o.ToolDefinition]:J,[o.CommandBefore]:Q,[o.CommandAfter]:X,[o.PermissionAsk]:te,[o.PermissionDenied]:oe,[o.LlmParams]:re,[o.LlmHeaders]:se,[o.ShellEnv]:ie,[o.TextComplete]:ae,[o.ContextBuildBefore]:pe,[o.ContextBuildAfter]:ue,[o.GatewayMessageReceive]:me,[o.GatewayMessageProcess]:ce,[o.GatewayMessageComplete]:de,[o.GatewayMessageSend]:le,[o.GatewayMessageDelivered]:ge,[o.GatewayMessageRead]:be,[o.HeartbeatTrigger]:Se,[o.HeartbeatComplete]:he,[o.ScheduledTaskTrigger]:xe,[o.ScheduledTaskComplete]:ke,[o.CommandTrigger]:Ce,[o.CommandComplete]:Te,[o.TaskStart]:ve,[o.TaskRunning]:Pe,[o.TaskProgress]:He,[o.TaskComplete]:we,[o.LoopStart]:Ee,[o.LoopEnd]:je,[o.CreationRequest]:Me,[o.CreationComplete]:De,[o.EvolutionRequest]:Re,[o.EvolutionComplete]:ze};function Qe(s){return y[s]}function Xe(s,f){let m=y[s];if(!m)throw new Error(`No schema found for event: ${s}`);return m.parse(f)}function Ye(s,f){let m=y[s];return m?m.safeParse(f):{success:false,error:new z$1.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var pt=z$1.enum(["command","mcp","skill"]).describe("Command source"),Ae=z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments"),Fe=z$1.discriminatedUnion("type",[z$1.object({type:z$1.literal("text"),text:z$1.string().describe("Text content")}),z$1.object({type:z$1.literal("image"),source:z$1.object({type:z$1.enum(["base64","url"]),mime:z$1.string().describe("File mime type"),data:z$1.string().describe("File base64 encoding data or url")})}),z$1.object({type:z$1.literal("file"),url:z$1.string().describe("File path"),filename:z$1.string().describe("File name"),mime:z$1.string().optional().describe("File mime type")})]),ut=z$1.object({name:z$1.string().describe("Command name"),description:z$1.string().describe("Command description"),scope:z$1.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:z$1.string().optional().describe("Specified agent name"),model:z$1.string().optional().describe("Specified model"),hints:z$1.array(z$1.string()).optional().describe("Argument hints"),commandType:z$1.enum(["prompt","local"]).optional().describe("Command type"),hidden:z$1.boolean().optional().describe("Whether hidden")}),mt=z$1.object({sessionId:z$1.string().describe("Session ID"),directory:z$1.string().describe("Working directory"),model:z$1.string().optional().describe("Model identifier"),agent:z$1.string().optional().describe("Agent name"),arguments:Ae.describe("Command arguments")}),Oe=z$1.record(z$1.string(),z$1.unknown()).describe("Result metadata"),ct=z$1.object({title:z$1.string().describe("Result title"),metadata:Oe.describe("Result metadata"),output:z$1.string().describe("Result output"),parts:z$1.array(Fe).optional().describe("Result parts"),success:z$1.boolean().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}),dt=z$1.object({agent:z$1.object({name:z$1.string().describe("Agent name"),model:z$1.string().optional().describe("Agent model")}).optional().describe("Agent context")}),lt=z$1.object({isEnabled:z$1.boolean().optional().describe("Is enabled check result")});export{w as AgentExecutorSchema,u as AgentSchema,c as CallIDSchema,X as CommandAfterInputSchema,Ae as CommandArgumentsSchema,Q as CommandBeforeInputSchema,Te as CommandCompleteInputSchema,Oe as CommandExecuteResultMetadataSchema,ct as CommandExecuteResultSchema,mt as CommandExecutionContextSchema,v as CommandExecutorSchema,dt as CommandInitContextSchema,lt as CommandInitResultSchema,ut as CommandMetadataSchema,Fe as CommandPromptPartSchema,pt as CommandSourceSchema,fe as CommandTaskDefinitionSchema,Ce as CommandTriggerInputSchema,h as ContentPartSchema,ue as ContextBuildAfterInputSchema,pe as ContextBuildBeforeInputSchema,De as CreationCompleteInputSchema,Me as CreationRequestInputSchema,S as CwdSchema,D as EndReasonSchema,y as EventInputSchemas,ze as EvolutionCompleteInputSchema,Re as EvolutionRequestInputSchema,R as FinishReasonSchema,E as FunctionExecutorSchema,de as GatewayMessageCompleteInputSchema,ge as GatewayMessageDeliveredInputSchema,ce as GatewayMessageProcessInputSchema,be as GatewayMessageReadInputSchema,me as GatewayMessageReceiveInputSchema,le as GatewayMessageSendInputSchema,Ne as HOOK_EVENTS,he as HeartbeatCompleteInputSchema,ye as HeartbeatTaskDefinitionSchema,Se as HeartbeatTriggerInputSchema,o as HookEvent,j as HookExecutorSchema,M as HookMatcherSchema,p as HookType,Je as HooksConfigSchema,H as HttpExecutorSchema,se as LlmHeadersInputSchema,re as LlmParamsInputSchema,ne as LlmParamsSchema,k as LlmProviderSchema,je as LoopEndInputSchema,Ee as LoopStartInputSchema,r as MessageIDSchema,_ as MessageReceiveInputSchema,q as MessageRoleSchema,x as MessageSchema,U as MessageTransformInputSchema,I as ModelObjectSchema,d as ModelSchema,te as PermissionAskInputSchema,oe as PermissionDeniedInputSchema,Y as PermissionLevelSchema,ee as PermissionRequestSchema,P as PromptExecutorSchema,ke as ScheduledTaskCompleteInputSchema,xe as ScheduledTaskTriggerInputSchema,Ie as SchedulerTaskDefinitionSchema,O as SessionCompactInputSchema,F as SessionCompactingInputSchema,A as SessionEndInputSchema,n as SessionIDSchema,z as SessionStartInputSchema,ie as ShellEnvInputSchema,W as StepFinishInputSchema,G as StepStartInputSchema,L as StepStopFailureInputSchema,B as StepStopInputSchema,N as SystemTransformInputSchema,we as TaskCompleteInputSchema,He as TaskProgressInputSchema,Pe as TaskRunningInputSchema,b as TaskSourceSchema,ve as TaskStartInputSchema,ae as TextCompleteInputSchema,$ as ToolAfterInputSchema,g as ToolArgsSchema,V as ToolBeforeInputSchema,J as ToolDefinitionInputSchema,K as ToolFailureInputSchema,Z as ToolResultSchema,Qe as getEventInputSchema,Ye as safeValidateHookInput,T as tool,Xe as validateHookInput};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.48",
|
|
4
4
|
"description": "EASBot Plugin for client applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"axios": "^1.16.1",
|
|
47
47
|
"zod": "^4.4.3",
|
|
48
|
-
"@easbot/sdk": "0.2.
|
|
49
|
-
"@easbot/types": "0.2.
|
|
48
|
+
"@easbot/sdk": "0.2.48",
|
|
49
|
+
"@easbot/types": "0.2.48"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^25.6.2",
|