@easbot/plugin 0.2.0 → 0.2.2
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 +33 -5
- package/dist/index.d.ts +33 -5
- package/dist/index.mjs +1 -1
- package/package.json +24 -26
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",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end"},je=Object.values(o);var l=k.z.string().optional(),C=k.z.object({type:k.z.literal(a.Command),command:k.z.string(),if:l,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:l,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:l,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()}),D=k.z.object({type:k.z.literal(a.Agent),if:l,timeout:k.z.number().positive().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())}),H=k.z.object({type:k.z.literal(a.Function),handler:k.z.function()}),E=k.z.discriminatedUnion("type",[C,v,P,D,H]),w=k.z.object({event:k.z.string(),matcher:k.z.string().optional(),hooks:k.z.array(E)}),Oe=k.z.record(k.z.string(),k.z.array(w)),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"),j=k.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),A=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")}),R=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}),W=k.z.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:c,agent:p,finishReason:j,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")}),B=k.z.object({sessionID:n,reason:k.z.string().describe("Stop reason")}),L=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")}),G=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:G,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")}),_=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")}),d=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:d}),V=k.z.object({sessionID:n,userMessageID:r.optional().describe("User message ID for the current step"),tool:k.z.string(),callID:m,args:d,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:d,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:d.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"),projectID: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()}),le=k.z.object({gatewayID:k.z.string(),messageID:r,message:k.z.unknown(),target:k.z.string().optional().describe("Send target")}),de=k.z.object({sessionID:n.optional(),timestamp:k.z.number().describe("Heartbeat timestamp"),name:k.z.string().optional().describe("Heartbeat name")}),ge=k.z.object({sessionID:n.optional(),timestamp:k.z.number(),duration:k.z.number().nonnegative().optional()}),be=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()}),fe=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()}),b=k.z.enum(["tool","scheduler","cli","api"]),ye=k.z.object({taskId:k.z.string().describe("Task unique identifier"),sessionId:k.z.string().describe("Session ID for this task"),source:b.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"),parentSessionId:k.z.string().optional().describe("Parent session ID if this is a subtask"),timeout:k.z.number().positive().optional().describe("Task timeout in milliseconds")}),Ie=k.z.object({taskId:k.z.string(),sessionId:k.z.string(),source:b,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")}),Se=k.z.object({taskId:k.z.string(),sessionId:k.z.string(),source:b,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")}),he=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")}),xe=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]:A,[o.SessionEnd]:z,[o.SessionCompacting]:R,[o.SessionCompact]:F,[o.StepStart]:O,[o.StepFinish]:W,[o.StepStop]:B,[o.StepStopFailure]:L,[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]:ue,[o.GatewayMessageProcess]:me,[o.GatewayMessageComplete]:ce,[o.GatewayMessageSend]:le,[o.HeartbeatTrigger]:de,[o.HeartbeatComplete]:ge,[o.ScheduledTaskTrigger]:be,[o.ScheduledTaskComplete]:fe,[o.TaskStart]:ye,[o.TaskProgress]:Ie,[o.TaskComplete]:Se,[o.LoopStart]:he,[o.LoopEnd]:xe};function We(s){return f[s]}function Be(s,g){let u=f[s];if(!u)throw new Error(`No schema found for event: ${s}`);return u.parse(g)}function Le(s,g){let u=f[s];return u?u.safeParse(g):{success:false,error:new k.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var Ke=k.z.enum(["command","mcp","skill"]).describe("Command source"),ke=k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments"),Te=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")})]),Je=k.z.object({name:k.z.string().describe("Command name"),description:k.z.string().describe("Command description"),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")}),Qe=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:ke.describe("Command arguments")}),Ce=k.z.record(k.z.string(),k.z.unknown()).describe("Result metadata"),Xe=k.z.object({title:k.z.string().describe("Result title"),metadata:Ce.describe("Result metadata"),output:k.z.string().describe("Result output"),parts:k.z.array(Te).optional().describe("Result parts"),success:k.z.boolean().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}),Ye=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")}),et=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=D;exports.AgentSchema=p;exports.CallIDSchema=m;exports.CommandAfterInputSchema=Q;exports.CommandArgumentsSchema=ke;exports.CommandBeforeInputSchema=J;exports.CommandExecuteResultMetadataSchema=Ce;exports.CommandExecuteResultSchema=Xe;exports.CommandExecutionContextSchema=Qe;exports.CommandExecutorSchema=C;exports.CommandInitContextSchema=Ye;exports.CommandInitResultSchema=et;exports.CommandMetadataSchema=Je;exports.CommandPromptPartSchema=Te;exports.CommandSourceSchema=Ke;exports.ContentPartSchema=S;exports.ContextBuildAfterInputSchema=pe;exports.ContextBuildBeforeInputSchema=ae;exports.CwdSchema=I;exports.EndReasonSchema=M;exports.EventInputSchemas=f;exports.FinishReasonSchema=j;exports.FunctionExecutorSchema=H;exports.GatewayMessageCompleteInputSchema=ce;exports.GatewayMessageProcessInputSchema=me;exports.GatewayMessageReceiveInputSchema=ue;exports.GatewayMessageSendInputSchema=le;exports.HOOK_EVENTS=je;exports.HeartbeatCompleteInputSchema=ge;exports.HeartbeatTriggerInputSchema=de;exports.HookEvent=o;exports.HookExecutorSchema=E;exports.HookMatcherSchema=w;exports.HookType=a;exports.HooksConfigSchema=Oe;exports.HttpExecutorSchema=P;exports.LlmHeadersInputSchema=re;exports.LlmParamsInputSchema=ne;exports.LlmParamsSchema=oe;exports.LlmProviderSchema=x;exports.LoopEndInputSchema=xe;exports.LoopStartInputSchema=he;exports.MessageIDSchema=r;exports.MessageReceiveInputSchema=_;exports.MessageRoleSchema=G;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=fe;exports.ScheduledTaskTriggerInputSchema=be;exports.SessionCompactInputSchema=F;exports.SessionCompactingInputSchema=R;exports.SessionEndInputSchema=z;exports.SessionIDSchema=n;exports.SessionStartInputSchema=A;exports.ShellEnvInputSchema=se;exports.StepFinishInputSchema=W;exports.StepStartInputSchema=O;exports.StepStopFailureInputSchema=L;exports.StepStopInputSchema=B;exports.SystemTransformInputSchema=U;exports.TaskCompleteInputSchema=Se;exports.TaskProgressInputSchema=Ie;exports.TaskSourceSchema=b;exports.TaskStartInputSchema=ye;exports.TextCompleteInputSchema=ie;exports.ToolAfterInputSchema=V;exports.ToolArgsSchema=d;exports.ToolBeforeInputSchema=Z;exports.ToolDefinitionInputSchema=K;exports.ToolFailureInputSchema=$;exports.ToolResultSchema=N;exports.getEventInputSchema=We;exports.safeValidateHookInput=Le;exports.tool=T;exports.validateHookInput=Be;
|
|
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",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.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"},Ae=Object.values(o);var l=k.z.string().optional(),C=k.z.object({type:k.z.literal(a.Command),command:k.z.string(),if:l,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:l,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:l,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()}),D=k.z.object({type:k.z.literal(a.Agent),if:l,timeout:k.z.number().positive().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())}),H=k.z.object({type:k.z.literal(a.Function),handler:k.z.function()}),E=k.z.discriminatedUnion("type",[C,v,P,D,H]),w=k.z.object({event:k.z.string(),matcher:k.z.string().optional(),hooks:k.z.array(E)}),We=k.z.record(k.z.string(),k.z.array(w)),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"),I=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"),y=k.z.string().optional().describe("Working directory path"),M=k.z.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),j=k.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),A=k.z.object({sessionID:n,source:k.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:c,agent:p,cwd:y}),z=k.z.object({sessionID:n,reason:M,duration:k.z.number().positive().optional().describe("Session duration in milliseconds")}),R=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}),W=k.z.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:c,agent:p,finishReason:j,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")}),B=k.z.object({sessionID:n,reason:k.z.string().describe("Stop reason")}),L=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")}),G=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:G,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")}),_=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")}),d=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:d}),V=k.z.object({sessionID:n,userMessageID:r.optional().describe("User message ID for the current step"),tool:k.z.string(),callID:m,args:d,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:d,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:d.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:I,provider:x,params:oe.partial().optional()}),re=k.z.object({sessionID:n,agent:p,model:I,provider:x,headers:k.z.record(k.z.string(),k.z.string()).optional()}),se=k.z.object({cwd:y.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"),projectID: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()}),le=k.z.object({gatewayID:k.z.string(),messageID:r,message:k.z.unknown(),target:k.z.string().optional().describe("Send target")}),de=k.z.object({sessionID:n.optional(),timestamp:k.z.number().describe("Heartbeat timestamp"),name:k.z.string().optional().describe("Heartbeat name")}),ge=k.z.object({sessionID:n.optional(),timestamp:k.z.number(),duration:k.z.number().nonnegative().optional()}),be=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()}),fe=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()}),g=k.z.enum(["tool","scheduler","cli","api"]),Ie=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")}),ye=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")}),Se=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")}),xe=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")}),ke=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]:A,[o.SessionEnd]:z,[o.SessionCompacting]:R,[o.SessionCompact]:F,[o.StepStart]:O,[o.StepFinish]:W,[o.StepStop]:B,[o.StepStopFailure]:L,[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]:ue,[o.GatewayMessageProcess]:me,[o.GatewayMessageComplete]:ce,[o.GatewayMessageSend]:le,[o.HeartbeatTrigger]:de,[o.HeartbeatComplete]:ge,[o.ScheduledTaskTrigger]:be,[o.ScheduledTaskComplete]:fe,[o.TaskStart]:Ie,[o.TaskRunning]:ye,[o.TaskProgress]:Se,[o.TaskComplete]:he,[o.LoopStart]:xe,[o.LoopEnd]:ke};function Be(s){return f[s]}function Le(s,b){let u=f[s];if(!u)throw new Error(`No schema found for event: ${s}`);return u.parse(b)}function Ge(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 Je=k.z.enum(["command","mcp","skill"]).describe("Command source"),Te=k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments"),Ce=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")})]),Qe=k.z.object({name:k.z.string().describe("Command name"),description:k.z.string().describe("Command description"),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")}),Xe=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:Te.describe("Command arguments")}),ve=k.z.record(k.z.string(),k.z.unknown()).describe("Result metadata"),Ye=k.z.object({title:k.z.string().describe("Result title"),metadata:ve.describe("Result metadata"),output:k.z.string().describe("Result output"),parts:k.z.array(Ce).optional().describe("Result parts"),success:k.z.boolean().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}),et=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")}),tt=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=D;exports.AgentSchema=p;exports.CallIDSchema=m;exports.CommandAfterInputSchema=Q;exports.CommandArgumentsSchema=Te;exports.CommandBeforeInputSchema=J;exports.CommandExecuteResultMetadataSchema=ve;exports.CommandExecuteResultSchema=Ye;exports.CommandExecutionContextSchema=Xe;exports.CommandExecutorSchema=C;exports.CommandInitContextSchema=et;exports.CommandInitResultSchema=tt;exports.CommandMetadataSchema=Qe;exports.CommandPromptPartSchema=Ce;exports.CommandSourceSchema=Je;exports.ContentPartSchema=S;exports.ContextBuildAfterInputSchema=pe;exports.ContextBuildBeforeInputSchema=ae;exports.CwdSchema=y;exports.EndReasonSchema=M;exports.EventInputSchemas=f;exports.FinishReasonSchema=j;exports.FunctionExecutorSchema=H;exports.GatewayMessageCompleteInputSchema=ce;exports.GatewayMessageProcessInputSchema=me;exports.GatewayMessageReceiveInputSchema=ue;exports.GatewayMessageSendInputSchema=le;exports.HOOK_EVENTS=Ae;exports.HeartbeatCompleteInputSchema=ge;exports.HeartbeatTriggerInputSchema=de;exports.HookEvent=o;exports.HookExecutorSchema=E;exports.HookMatcherSchema=w;exports.HookType=a;exports.HooksConfigSchema=We;exports.HttpExecutorSchema=P;exports.LlmHeadersInputSchema=re;exports.LlmParamsInputSchema=ne;exports.LlmParamsSchema=oe;exports.LlmProviderSchema=x;exports.LoopEndInputSchema=ke;exports.LoopStartInputSchema=xe;exports.MessageIDSchema=r;exports.MessageReceiveInputSchema=_;exports.MessageRoleSchema=G;exports.MessageSchema=h;exports.MessageTransformInputSchema=q;exports.ModelObjectSchema=I;exports.ModelSchema=c;exports.PermissionAskInputSchema=ee;exports.PermissionDeniedInputSchema=te;exports.PermissionLevelSchema=X;exports.PermissionRequestSchema=Y;exports.PromptExecutorSchema=v;exports.ScheduledTaskCompleteInputSchema=fe;exports.ScheduledTaskTriggerInputSchema=be;exports.SessionCompactInputSchema=F;exports.SessionCompactingInputSchema=R;exports.SessionEndInputSchema=z;exports.SessionIDSchema=n;exports.SessionStartInputSchema=A;exports.ShellEnvInputSchema=se;exports.StepFinishInputSchema=W;exports.StepStartInputSchema=O;exports.StepStopFailureInputSchema=L;exports.StepStopInputSchema=B;exports.SystemTransformInputSchema=U;exports.TaskCompleteInputSchema=he;exports.TaskProgressInputSchema=Se;exports.TaskRunningInputSchema=ye;exports.TaskSourceSchema=g;exports.TaskStartInputSchema=Ie;exports.TextCompleteInputSchema=ie;exports.ToolAfterInputSchema=V;exports.ToolArgsSchema=d;exports.ToolBeforeInputSchema=Z;exports.ToolDefinitionInputSchema=K;exports.ToolFailureInputSchema=$;exports.ToolResultSchema=N;exports.getEventInputSchema=Be;exports.safeValidateHookInput=Ge;exports.tool=T;exports.validateHookInput=Le;
|
package/dist/index.d.cts
CHANGED
|
@@ -59,13 +59,14 @@ declare const HookEvent: {
|
|
|
59
59
|
readonly ContextBuildBefore: "context.build.before";
|
|
60
60
|
readonly ContextBuildAfter: "context.build.after";
|
|
61
61
|
readonly TaskStart: "task.start";
|
|
62
|
+
readonly TaskRunning: "task.running";
|
|
62
63
|
readonly TaskProgress: "task.progress";
|
|
63
64
|
readonly TaskComplete: "task.complete";
|
|
64
65
|
readonly LoopStart: "loop.start";
|
|
65
66
|
readonly LoopEnd: "loop.end";
|
|
66
67
|
};
|
|
67
68
|
type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
|
|
68
|
-
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" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
69
|
+
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" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
69
70
|
interface HookContext {
|
|
70
71
|
sessionID?: string;
|
|
71
72
|
agent?: string;
|
|
@@ -907,10 +908,20 @@ declare const TaskStartInputSchema: z$1.ZodObject<{
|
|
|
907
908
|
agentType: z$1.ZodString;
|
|
908
909
|
description: z$1.ZodString;
|
|
909
910
|
prompt: z$1.ZodString;
|
|
910
|
-
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
911
911
|
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
912
912
|
}, z$1.core.$strip>;
|
|
913
913
|
type TaskStartInput = z$1.infer<typeof TaskStartInputSchema>;
|
|
914
|
+
declare const TaskRunningInputSchema: z$1.ZodObject<{
|
|
915
|
+
taskId: z$1.ZodString;
|
|
916
|
+
sessionId: z$1.ZodString;
|
|
917
|
+
source: z$1.ZodEnum<{
|
|
918
|
+
api: "api";
|
|
919
|
+
tool: "tool";
|
|
920
|
+
scheduler: "scheduler";
|
|
921
|
+
cli: "cli";
|
|
922
|
+
}>;
|
|
923
|
+
}, z$1.core.$strip>;
|
|
924
|
+
type TaskRunningInput = z$1.infer<typeof TaskRunningInputSchema>;
|
|
914
925
|
declare const TaskProgressInputSchema: z$1.ZodObject<{
|
|
915
926
|
taskId: z$1.ZodString;
|
|
916
927
|
sessionId: z$1.ZodString;
|
|
@@ -1358,9 +1369,18 @@ declare const EventInputSchemas: {
|
|
|
1358
1369
|
agentType: z$1.ZodString;
|
|
1359
1370
|
description: z$1.ZodString;
|
|
1360
1371
|
prompt: z$1.ZodString;
|
|
1361
|
-
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
1362
1372
|
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1363
1373
|
}, z$1.core.$strip>;
|
|
1374
|
+
readonly "task.running": z$1.ZodObject<{
|
|
1375
|
+
taskId: z$1.ZodString;
|
|
1376
|
+
sessionId: z$1.ZodString;
|
|
1377
|
+
source: z$1.ZodEnum<{
|
|
1378
|
+
api: "api";
|
|
1379
|
+
tool: "tool";
|
|
1380
|
+
scheduler: "scheduler";
|
|
1381
|
+
cli: "cli";
|
|
1382
|
+
}>;
|
|
1383
|
+
}, z$1.core.$strip>;
|
|
1364
1384
|
readonly "task.progress": z$1.ZodObject<{
|
|
1365
1385
|
taskId: z$1.ZodString;
|
|
1366
1386
|
sessionId: z$1.ZodString;
|
|
@@ -1771,8 +1791,16 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1771
1791
|
agentType: z$1.ZodString;
|
|
1772
1792
|
description: z$1.ZodString;
|
|
1773
1793
|
prompt: z$1.ZodString;
|
|
1774
|
-
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
1775
1794
|
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1795
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1796
|
+
taskId: z$1.ZodString;
|
|
1797
|
+
sessionId: z$1.ZodString;
|
|
1798
|
+
source: z$1.ZodEnum<{
|
|
1799
|
+
api: "api";
|
|
1800
|
+
tool: "tool";
|
|
1801
|
+
scheduler: "scheduler";
|
|
1802
|
+
cli: "cli";
|
|
1803
|
+
}>;
|
|
1776
1804
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1777
1805
|
taskId: z$1.ZodString;
|
|
1778
1806
|
sessionId: z$1.ZodString;
|
|
@@ -2078,4 +2106,4 @@ interface PluginDefinition {
|
|
|
2078
2106
|
'context.build.after'?: (input: ContextBuildAfterInput, output: HookOutputWrapper<ContextBuildAfterInput>) => Promise<void>;
|
|
2079
2107
|
}
|
|
2080
2108
|
|
|
2081
|
-
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, 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, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, 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 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 TaskProgressInput, TaskProgressInputSchema, 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 };
|
|
2109
|
+
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, 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, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, 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 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 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
|
@@ -59,13 +59,14 @@ declare const HookEvent: {
|
|
|
59
59
|
readonly ContextBuildBefore: "context.build.before";
|
|
60
60
|
readonly ContextBuildAfter: "context.build.after";
|
|
61
61
|
readonly TaskStart: "task.start";
|
|
62
|
+
readonly TaskRunning: "task.running";
|
|
62
63
|
readonly TaskProgress: "task.progress";
|
|
63
64
|
readonly TaskComplete: "task.complete";
|
|
64
65
|
readonly LoopStart: "loop.start";
|
|
65
66
|
readonly LoopEnd: "loop.end";
|
|
66
67
|
};
|
|
67
68
|
type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
|
|
68
|
-
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" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
69
|
+
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" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
69
70
|
interface HookContext {
|
|
70
71
|
sessionID?: string;
|
|
71
72
|
agent?: string;
|
|
@@ -907,10 +908,20 @@ declare const TaskStartInputSchema: z$1.ZodObject<{
|
|
|
907
908
|
agentType: z$1.ZodString;
|
|
908
909
|
description: z$1.ZodString;
|
|
909
910
|
prompt: z$1.ZodString;
|
|
910
|
-
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
911
911
|
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
912
912
|
}, z$1.core.$strip>;
|
|
913
913
|
type TaskStartInput = z$1.infer<typeof TaskStartInputSchema>;
|
|
914
|
+
declare const TaskRunningInputSchema: z$1.ZodObject<{
|
|
915
|
+
taskId: z$1.ZodString;
|
|
916
|
+
sessionId: z$1.ZodString;
|
|
917
|
+
source: z$1.ZodEnum<{
|
|
918
|
+
api: "api";
|
|
919
|
+
tool: "tool";
|
|
920
|
+
scheduler: "scheduler";
|
|
921
|
+
cli: "cli";
|
|
922
|
+
}>;
|
|
923
|
+
}, z$1.core.$strip>;
|
|
924
|
+
type TaskRunningInput = z$1.infer<typeof TaskRunningInputSchema>;
|
|
914
925
|
declare const TaskProgressInputSchema: z$1.ZodObject<{
|
|
915
926
|
taskId: z$1.ZodString;
|
|
916
927
|
sessionId: z$1.ZodString;
|
|
@@ -1358,9 +1369,18 @@ declare const EventInputSchemas: {
|
|
|
1358
1369
|
agentType: z$1.ZodString;
|
|
1359
1370
|
description: z$1.ZodString;
|
|
1360
1371
|
prompt: z$1.ZodString;
|
|
1361
|
-
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
1362
1372
|
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1363
1373
|
}, z$1.core.$strip>;
|
|
1374
|
+
readonly "task.running": z$1.ZodObject<{
|
|
1375
|
+
taskId: z$1.ZodString;
|
|
1376
|
+
sessionId: z$1.ZodString;
|
|
1377
|
+
source: z$1.ZodEnum<{
|
|
1378
|
+
api: "api";
|
|
1379
|
+
tool: "tool";
|
|
1380
|
+
scheduler: "scheduler";
|
|
1381
|
+
cli: "cli";
|
|
1382
|
+
}>;
|
|
1383
|
+
}, z$1.core.$strip>;
|
|
1364
1384
|
readonly "task.progress": z$1.ZodObject<{
|
|
1365
1385
|
taskId: z$1.ZodString;
|
|
1366
1386
|
sessionId: z$1.ZodString;
|
|
@@ -1771,8 +1791,16 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1771
1791
|
agentType: z$1.ZodString;
|
|
1772
1792
|
description: z$1.ZodString;
|
|
1773
1793
|
prompt: z$1.ZodString;
|
|
1774
|
-
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
1775
1794
|
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1795
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1796
|
+
taskId: z$1.ZodString;
|
|
1797
|
+
sessionId: z$1.ZodString;
|
|
1798
|
+
source: z$1.ZodEnum<{
|
|
1799
|
+
api: "api";
|
|
1800
|
+
tool: "tool";
|
|
1801
|
+
scheduler: "scheduler";
|
|
1802
|
+
cli: "cli";
|
|
1803
|
+
}>;
|
|
1776
1804
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1777
1805
|
taskId: z$1.ZodString;
|
|
1778
1806
|
sessionId: z$1.ZodString;
|
|
@@ -2078,4 +2106,4 @@ interface PluginDefinition {
|
|
|
2078
2106
|
'context.build.after'?: (input: ContextBuildAfterInput, output: HookOutputWrapper<ContextBuildAfterInput>) => Promise<void>;
|
|
2079
2107
|
}
|
|
2080
2108
|
|
|
2081
|
-
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, 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, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, 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 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 TaskProgressInput, TaskProgressInputSchema, 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 };
|
|
2109
|
+
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, 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, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, 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 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 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",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end"},Ae=Object.values(o);var d=z$1.string().optional(),v=z$1.object({type:z$1.literal(p.Command),command:z$1.string(),if:d,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:d,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())}),D=z$1.object({type:z$1.literal(p.Http),url:z$1.string(),if:d,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()}),H=z$1.object({type:z$1.literal(p.Agent),if:d,timeout:z$1.number().positive().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()}),w=z$1.discriminatedUnion("type",[v,P,D,H,E]),M=z$1.object({event:z$1.string(),matcher:z$1.string().optional(),hooks:z$1.array(w)}),We=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"),l=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"),j=z$1.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),A=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:l,agent:u,cwd:S}),R=z$1.object({sessionID:n,reason:j,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")}),W=z$1.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:l,agent:u}),B=z$1.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:l,agent:u,finishReason:A,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")}),L=z$1.object({sessionID:n,reason:z$1.string().describe("Stop reason")}),G=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:u,model:l,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:l,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"),projectID: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()}),le=z$1.object({gatewayID:z$1.string(),messageID:r,result:z$1.unknown().optional()}),de=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({sessionID:n.optional(),timestamp:z$1.number().describe("Heartbeat timestamp"),name:z$1.string().optional().describe("Heartbeat name")}),be=z$1.object({sessionID:n.optional(),timestamp:z$1.number(),duration:z$1.number().nonnegative().optional()}),fe=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()}),ye=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()}),f=z$1.enum(["tool","scheduler","cli","api"]),Ie=z$1.object({taskId:z$1.string().describe("Task unique identifier"),sessionId:z$1.string().describe("Session ID for this task"),source:f.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"),parentSessionId:z$1.string().optional().describe("Parent session ID if this is a subtask"),timeout:z$1.number().positive().optional().describe("Task timeout in milliseconds")}),Se=z$1.object({taskId:z$1.string(),sessionId:z$1.string(),source:f,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")}),he=z$1.object({taskId:z$1.string(),sessionId:z$1.string(),source:f,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")}),xe=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")}),ke=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]:z,[o.SessionEnd]:R,[o.SessionCompacting]:F,[o.SessionCompact]:O,[o.StepStart]:W,[o.StepFinish]:B,[o.StepStop]:L,[o.StepStopFailure]:G,[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]:ue,[o.GatewayMessageReceive]:me,[o.GatewayMessageProcess]:ce,[o.GatewayMessageComplete]:le,[o.GatewayMessageSend]:de,[o.HeartbeatTrigger]:ge,[o.HeartbeatComplete]:be,[o.ScheduledTaskTrigger]:fe,[o.ScheduledTaskComplete]:ye,[o.TaskStart]:Ie,[o.TaskProgress]:Se,[o.TaskComplete]:he,[o.LoopStart]:xe,[o.LoopEnd]:ke};function Be(s){return y[s]}function Le(s,b){let m=y[s];if(!m)throw new Error(`No schema found for event: ${s}`);return m.parse(b)}function Ge(s,b){let m=y[s];return m?m.safeParse(b):{success:false,error:new z$1.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var Je=z$1.enum(["command","mcp","skill"]).describe("Command source"),Te=z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments"),Ce=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")})]),Qe=z$1.object({name:z$1.string().describe("Command name"),description:z$1.string().describe("Command description"),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")}),Xe=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:Te.describe("Command arguments")}),ve=z$1.record(z$1.string(),z$1.unknown()).describe("Result metadata"),Ye=z$1.object({title:z$1.string().describe("Result title"),metadata:ve.describe("Result metadata"),output:z$1.string().describe("Result output"),parts:z$1.array(Ce).optional().describe("Result parts"),success:z$1.boolean().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}),et=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")}),tt=z$1.object({isEnabled:z$1.boolean().optional().describe("Is enabled check result")});export{H as AgentExecutorSchema,u as AgentSchema,c as CallIDSchema,X as CommandAfterInputSchema,Te as CommandArgumentsSchema,Q as CommandBeforeInputSchema,ve as CommandExecuteResultMetadataSchema,Ye as CommandExecuteResultSchema,Xe as CommandExecutionContextSchema,v as CommandExecutorSchema,et as CommandInitContextSchema,tt as CommandInitResultSchema,Qe as CommandMetadataSchema,Ce as CommandPromptPartSchema,Je as CommandSourceSchema,h as ContentPartSchema,ue as ContextBuildAfterInputSchema,pe as ContextBuildBeforeInputSchema,S as CwdSchema,j as EndReasonSchema,y as EventInputSchemas,A as FinishReasonSchema,E as FunctionExecutorSchema,le as GatewayMessageCompleteInputSchema,ce as GatewayMessageProcessInputSchema,me as GatewayMessageReceiveInputSchema,de as GatewayMessageSendInputSchema,Ae as HOOK_EVENTS,be as HeartbeatCompleteInputSchema,ge as HeartbeatTriggerInputSchema,o as HookEvent,w as HookExecutorSchema,M as HookMatcherSchema,p as HookType,We as HooksConfigSchema,D as HttpExecutorSchema,se as LlmHeadersInputSchema,re as LlmParamsInputSchema,ne as LlmParamsSchema,k as LlmProviderSchema,ke as LoopEndInputSchema,xe as LoopStartInputSchema,r as MessageIDSchema,q as MessageReceiveInputSchema,_ as MessageRoleSchema,x as MessageSchema,U as MessageTransformInputSchema,I as ModelObjectSchema,l as ModelSchema,te as PermissionAskInputSchema,oe as PermissionDeniedInputSchema,Y as PermissionLevelSchema,ee as PermissionRequestSchema,P as PromptExecutorSchema,ye as ScheduledTaskCompleteInputSchema,fe as ScheduledTaskTriggerInputSchema,O as SessionCompactInputSchema,F as SessionCompactingInputSchema,R as SessionEndInputSchema,n as SessionIDSchema,z as SessionStartInputSchema,ie as ShellEnvInputSchema,B as StepFinishInputSchema,W as StepStartInputSchema,G as StepStopFailureInputSchema,L as StepStopInputSchema,N as SystemTransformInputSchema,he as TaskCompleteInputSchema,Se as TaskProgressInputSchema,f as TaskSourceSchema,Ie as TaskStartInputSchema,ae as TextCompleteInputSchema,$ as ToolAfterInputSchema,g as ToolArgsSchema,V as ToolBeforeInputSchema,J as ToolDefinitionInputSchema,K as ToolFailureInputSchema,Z as ToolResultSchema,Be as getEventInputSchema,Ge as safeValidateHookInput,C as tool,Le as validateHookInput};
|
|
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",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.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"},ze=Object.values(o);var d=z$1.string().optional(),v=z$1.object({type:z$1.literal(p.Command),command:z$1.string(),if:d,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:d,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())}),D=z$1.object({type:z$1.literal(p.Http),url:z$1.string(),if:d,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()}),H=z$1.object({type:z$1.literal(p.Agent),if:d,timeout:z$1.number().positive().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()}),w=z$1.discriminatedUnion("type",[v,P,D,H,E]),M=z$1.object({event:z$1.string(),matcher:z$1.string().optional(),hooks:z$1.array(w)}),Be=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"),l=z$1.string().optional().describe("Model identifier"),y=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"),j=z$1.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),A=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:l,agent:u,cwd:S}),R=z$1.object({sessionID:n,reason:j,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")}),W=z$1.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:l,agent:u}),B=z$1.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:l,agent:u,finishReason:A,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")}),L=z$1.object({sessionID:n,reason:z$1.string().describe("Stop reason")}),G=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:u,model:l,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:l,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:y,provider:k,params:ne.partial().optional()}),se=z$1.object({sessionID:n,agent:u,model:y,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"),projectID: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()}),le=z$1.object({gatewayID:z$1.string(),messageID:r,result:z$1.unknown().optional()}),de=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({sessionID:n.optional(),timestamp:z$1.number().describe("Heartbeat timestamp"),name:z$1.string().optional().describe("Heartbeat name")}),be=z$1.object({sessionID:n.optional(),timestamp:z$1.number(),duration:z$1.number().nonnegative().optional()}),fe=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()}),Ie=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()}),b=z$1.enum(["tool","scheduler","cli","api"]),ye=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")}),Se=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")}),xe=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")}),ke=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")}),Te=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")}),I={[o.SessionStart]:z,[o.SessionEnd]:R,[o.SessionCompacting]:F,[o.SessionCompact]:O,[o.StepStart]:W,[o.StepFinish]:B,[o.StepStop]:L,[o.StepStopFailure]:G,[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]:ue,[o.GatewayMessageReceive]:me,[o.GatewayMessageProcess]:ce,[o.GatewayMessageComplete]:le,[o.GatewayMessageSend]:de,[o.HeartbeatTrigger]:ge,[o.HeartbeatComplete]:be,[o.ScheduledTaskTrigger]:fe,[o.ScheduledTaskComplete]:Ie,[o.TaskStart]:ye,[o.TaskRunning]:Se,[o.TaskProgress]:he,[o.TaskComplete]:xe,[o.LoopStart]:ke,[o.LoopEnd]:Te};function Le(s){return I[s]}function Ge(s,f){let m=I[s];if(!m)throw new Error(`No schema found for event: ${s}`);return m.parse(f)}function _e(s,f){let m=I[s];return m?m.safeParse(f):{success:false,error:new z$1.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var Qe=z$1.enum(["command","mcp","skill"]).describe("Command source"),Ce=z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments"),ve=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")})]),Xe=z$1.object({name:z$1.string().describe("Command name"),description:z$1.string().describe("Command description"),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")}),Ye=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:Ce.describe("Command arguments")}),Pe=z$1.record(z$1.string(),z$1.unknown()).describe("Result metadata"),et=z$1.object({title:z$1.string().describe("Result title"),metadata:Pe.describe("Result metadata"),output:z$1.string().describe("Result output"),parts:z$1.array(ve).optional().describe("Result parts"),success:z$1.boolean().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}),tt=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")}),ot=z$1.object({isEnabled:z$1.boolean().optional().describe("Is enabled check result")});export{H as AgentExecutorSchema,u as AgentSchema,c as CallIDSchema,X as CommandAfterInputSchema,Ce as CommandArgumentsSchema,Q as CommandBeforeInputSchema,Pe as CommandExecuteResultMetadataSchema,et as CommandExecuteResultSchema,Ye as CommandExecutionContextSchema,v as CommandExecutorSchema,tt as CommandInitContextSchema,ot as CommandInitResultSchema,Xe as CommandMetadataSchema,ve as CommandPromptPartSchema,Qe as CommandSourceSchema,h as ContentPartSchema,ue as ContextBuildAfterInputSchema,pe as ContextBuildBeforeInputSchema,S as CwdSchema,j as EndReasonSchema,I as EventInputSchemas,A as FinishReasonSchema,E as FunctionExecutorSchema,le as GatewayMessageCompleteInputSchema,ce as GatewayMessageProcessInputSchema,me as GatewayMessageReceiveInputSchema,de as GatewayMessageSendInputSchema,ze as HOOK_EVENTS,be as HeartbeatCompleteInputSchema,ge as HeartbeatTriggerInputSchema,o as HookEvent,w as HookExecutorSchema,M as HookMatcherSchema,p as HookType,Be as HooksConfigSchema,D as HttpExecutorSchema,se as LlmHeadersInputSchema,re as LlmParamsInputSchema,ne as LlmParamsSchema,k as LlmProviderSchema,Te as LoopEndInputSchema,ke as LoopStartInputSchema,r as MessageIDSchema,q as MessageReceiveInputSchema,_ as MessageRoleSchema,x as MessageSchema,U as MessageTransformInputSchema,y as ModelObjectSchema,l as ModelSchema,te as PermissionAskInputSchema,oe as PermissionDeniedInputSchema,Y as PermissionLevelSchema,ee as PermissionRequestSchema,P as PromptExecutorSchema,Ie as ScheduledTaskCompleteInputSchema,fe as ScheduledTaskTriggerInputSchema,O as SessionCompactInputSchema,F as SessionCompactingInputSchema,R as SessionEndInputSchema,n as SessionIDSchema,z as SessionStartInputSchema,ie as ShellEnvInputSchema,B as StepFinishInputSchema,W as StepStartInputSchema,G as StepStopFailureInputSchema,L as StepStopInputSchema,N as SystemTransformInputSchema,xe as TaskCompleteInputSchema,he as TaskProgressInputSchema,Se as TaskRunningInputSchema,b as TaskSourceSchema,ye as TaskStartInputSchema,ae as TextCompleteInputSchema,$ as ToolAfterInputSchema,g as ToolArgsSchema,V as ToolBeforeInputSchema,J as ToolDefinitionInputSchema,K as ToolFailureInputSchema,Z as ToolResultSchema,Le as getEventInputSchema,_e as safeValidateHookInput,C as tool,Ge 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.2",
|
|
4
4
|
"description": "EASBot Plugin for client applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -19,23 +19,6 @@
|
|
|
19
19
|
},
|
|
20
20
|
"./package.json": "./package.json"
|
|
21
21
|
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"dev": "tsup --watch --env.NODE_ENV development",
|
|
24
|
-
"build": "tsup --env.NODE_ENV production",
|
|
25
|
-
"test": "vitest",
|
|
26
|
-
"test:run": "vitest run",
|
|
27
|
-
"lint": "biome check .",
|
|
28
|
-
"lint:fix": "biome check --write .",
|
|
29
|
-
"lint:report": "biome check --reporter=summary .",
|
|
30
|
-
"format": "biome format .",
|
|
31
|
-
"format:fix": "biome format --write .",
|
|
32
|
-
"type-check": "tsc --noEmit",
|
|
33
|
-
"clean": "npx rimraf dist node_modules",
|
|
34
|
-
"prepare": "echo norun",
|
|
35
|
-
"prepublishOnly": "pnpm build",
|
|
36
|
-
"publish:npm": "bash scripts/publish.sh",
|
|
37
|
-
"publish:npm:win": "powershell -ExecutionPolicy Bypass -File scripts/publish.ps1"
|
|
38
|
-
},
|
|
39
22
|
"keywords": [
|
|
40
23
|
"easbot",
|
|
41
24
|
"plugin",
|
|
@@ -60,21 +43,36 @@
|
|
|
60
43
|
"LICENSE"
|
|
61
44
|
],
|
|
62
45
|
"dependencies": {
|
|
63
|
-
"zod": "^4.3
|
|
64
|
-
"@easbot/sdk": "
|
|
65
|
-
"@easbot/types": "
|
|
46
|
+
"zod": "^4.4.3",
|
|
47
|
+
"@easbot/sdk": "0.2.2",
|
|
48
|
+
"@easbot/types": "0.2.2"
|
|
66
49
|
},
|
|
67
50
|
"devDependencies": {
|
|
68
|
-
"@types/node": "^
|
|
51
|
+
"@types/node": "^25.6.2",
|
|
69
52
|
"tsup": "^8.5.1",
|
|
70
|
-
"@biomejs/biome": "^2.4.
|
|
71
|
-
"typescript": "^6.0.
|
|
72
|
-
"vitest": "^4.1.
|
|
53
|
+
"@biomejs/biome": "^2.4.14",
|
|
54
|
+
"typescript": "^6.0.3",
|
|
55
|
+
"vitest": "^4.1.5"
|
|
73
56
|
},
|
|
74
57
|
"engines": {
|
|
75
58
|
"node": ">=22.17.0"
|
|
76
59
|
},
|
|
77
60
|
"publishConfig": {
|
|
78
61
|
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"dev": "tsup --watch --env.NODE_ENV development",
|
|
65
|
+
"build": "tsup --env.NODE_ENV production",
|
|
66
|
+
"test": "vitest",
|
|
67
|
+
"test:run": "vitest run",
|
|
68
|
+
"lint": "biome check .",
|
|
69
|
+
"lint:fix": "biome check --write .",
|
|
70
|
+
"lint:report": "biome check --reporter=summary .",
|
|
71
|
+
"format": "biome format .",
|
|
72
|
+
"format:fix": "biome format --write .",
|
|
73
|
+
"type-check": "tsc --noEmit",
|
|
74
|
+
"clean": "npx rimraf dist node_modules",
|
|
75
|
+
"publish:npm": "bash scripts/publish.sh",
|
|
76
|
+
"publish:npm:win": "powershell -ExecutionPolicy Bypass -File scripts/publish.ps1"
|
|
79
77
|
}
|
|
80
|
-
}
|
|
78
|
+
}
|