@easbot/plugin 0.2.26 → 0.2.27
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 +64 -2
- package/dist/index.d.ts +64 -2
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var k=require('zod'),types=require('@easbot/types');require('@easbot/sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var k__default=/*#__PURE__*/_interopDefault(k);function T(s){return {description:s.description,args:s.args,execute:s.execute}}T.schema=k__default.default;var a={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",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"),scope:k.z.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:k.z.string().optional().describe("Specified agent name"),model:k.z.string().optional().describe("Specified model"),hints:k.z.array(k.z.string()).optional().describe("Argument hints"),commandType:k.z.enum(["prompt","local"]).optional().describe("Command type"),hidden:k.z.boolean().optional().describe("Whether hidden")}),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;
|
|
1
|
+
'use strict';var k=require('zod'),types=require('@easbot/types');require('@easbot/sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var k__default=/*#__PURE__*/_interopDefault(k);function T(s){return {description:s.description,args:s.args,execute:s.execute}}T.schema=k__default.default;var a={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",GatewayMessageDelivered:"gateway.message.delivered",GatewayMessageRead:"gateway.message.read",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",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 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())}),D=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()}),P=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()}),w=k.z.discriminatedUnion("type",[C,v,D,P,H]),E=k.z.object({event:k.z.string(),matcher:k.z.string().optional(),hooks:k.z.array(w)}),Be=k.z.record(k.z.string(),k.z.array(E)),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"),f=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"),R=k.z.object({sessionID:n,source:k.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:c,agent:p,cwd:I}),A=k.z.object({sessionID:n,reason:M,duration:k.z.number().positive().optional().describe("Session duration in milliseconds")}),z=k.z.object({sessionID:n,trigger:k.z.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:k.z.number().positive().describe("Current context length"),threshold:k.z.number().positive().describe("Trigger threshold")}),F=k.z.object({sessionID:n,summary:k.z.string().describe("Compaction summary"),previousLength:k.z.number().positive().describe("Previous context length"),newLength:k.z.number().positive().describe("New context length")}),O=k.z.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:c,agent:p}),G=k.z.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:c,agent:p,finishReason: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")}),W=k.z.object({sessionID:n,reason:k.z.string().describe("Stop reason")}),B=k.z.object({sessionID:n,error:k.z.string().describe("Error message"),errorType:k.z.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),L=k.z.enum(["user","assistant","system","tool"]),S=k.z.discriminatedUnion("type",[k.z.object({type:k.z.literal("text"),text:k.z.string().describe("Text content")}),k.z.object({type:k.z.literal("image"),source:k.z.object({type:k.z.enum(["base64","url"]),mime:k.z.string().optional().describe("File mime type"),data:k.z.string().describe("File base64 encoding data or url")})}),k.z.object({type:k.z.literal("file"),url:k.z.string().describe("File path"),filename:k.z.string().describe("File name"),mime:k.z.string().optional().describe("File mime type")})]),h=k.z.object({id:r,role:L,content:k.z.union([k.z.string(),k.z.array(S)]),name:k.z.string().optional().describe("Message sender name"),tool_call_id:m.optional().describe("Related tool call ID")}),_=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:f,provider:x,params:oe.partial().optional()}),re=k.z.object({sessionID:n,agent:p,model:f,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({gatewayID:k.z.string(),messageID:r,sessionID:n.optional(),channel:k.z.object({platform:k.z.string(),channelId:k.z.string()}),timestamp:k.z.number().describe("Delivery timestamp")}),ge=k.z.object({gatewayID:k.z.string(),messageID:r,sessionID:n.optional(),channel:k.z.object({platform:k.z.string(),channelId:k.z.string()}),timestamp:k.z.number().describe("Read timestamp")}),be=k.z.object({sessionID:n.optional(),timestamp:k.z.number().describe("Heartbeat timestamp"),name:k.z.string().optional().describe("Heartbeat name")}),ye=k.z.object({sessionID:n.optional(),timestamp:k.z.number(),duration:k.z.number().nonnegative().optional()}),fe=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()}),Ie=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"]),Se=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")}),he=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")}),xe=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")}),ke=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")}),Te=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")}),Ce=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")}),y={[o.SessionStart]:R,[o.SessionEnd]:A,[o.SessionCompacting]:z,[o.SessionCompact]:F,[o.StepStart]:O,[o.StepFinish]:G,[o.StepStop]:W,[o.StepStopFailure]:B,[o.MessageReceive]:_,[o.MessageTransform]:q,[o.SystemTransform]:U,[o.ToolBefore]:Z,[o.ToolAfter]:V,[o.ToolFailure]:$,[o.ToolDefinition]:K,[o.CommandBefore]:J,[o.CommandAfter]:Q,[o.PermissionAsk]:ee,[o.PermissionDenied]:te,[o.LlmParams]:ne,[o.LlmHeaders]:re,[o.ShellEnv]:se,[o.TextComplete]:ie,[o.ContextBuildBefore]:ae,[o.ContextBuildAfter]:pe,[o.GatewayMessageReceive]:ue,[o.GatewayMessageProcess]:me,[o.GatewayMessageComplete]:ce,[o.GatewayMessageSend]:le,[o.GatewayMessageDelivered]:de,[o.GatewayMessageRead]:ge,[o.HeartbeatTrigger]:be,[o.HeartbeatComplete]:ye,[o.ScheduledTaskTrigger]:fe,[o.ScheduledTaskComplete]:Ie,[o.TaskStart]:Se,[o.TaskRunning]:he,[o.TaskProgress]:xe,[o.TaskComplete]:ke,[o.LoopStart]:Te,[o.LoopEnd]:Ce};function Le(s){return y[s]}function _e(s,b){let u=y[s];if(!u)throw new Error(`No schema found for event: ${s}`);return u.parse(b)}function qe(s,b){let u=y[s];return u?u.safeParse(b):{success:false,error:new k.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var Xe=k.z.enum(["command","mcp","skill"]).describe("Command source"),ve=k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments"),De=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")})]),Ye=k.z.object({name:k.z.string().describe("Command name"),description:k.z.string().describe("Command description"),scope:k.z.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:k.z.string().optional().describe("Specified agent name"),model:k.z.string().optional().describe("Specified model"),hints:k.z.array(k.z.string()).optional().describe("Argument hints"),commandType:k.z.enum(["prompt","local"]).optional().describe("Command type"),hidden:k.z.boolean().optional().describe("Whether hidden")}),et=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:ve.describe("Command arguments")}),Pe=k.z.record(k.z.string(),k.z.unknown()).describe("Result metadata"),tt=k.z.object({title:k.z.string().describe("Result title"),metadata:Pe.describe("Result metadata"),output:k.z.string().describe("Result output"),parts:k.z.array(De).optional().describe("Result parts"),success:k.z.boolean().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}),ot=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")}),nt=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=P;exports.AgentSchema=p;exports.CallIDSchema=m;exports.CommandAfterInputSchema=Q;exports.CommandArgumentsSchema=ve;exports.CommandBeforeInputSchema=J;exports.CommandExecuteResultMetadataSchema=Pe;exports.CommandExecuteResultSchema=tt;exports.CommandExecutionContextSchema=et;exports.CommandExecutorSchema=C;exports.CommandInitContextSchema=ot;exports.CommandInitResultSchema=nt;exports.CommandMetadataSchema=Ye;exports.CommandPromptPartSchema=De;exports.CommandSourceSchema=Xe;exports.ContentPartSchema=S;exports.ContextBuildAfterInputSchema=pe;exports.ContextBuildBeforeInputSchema=ae;exports.CwdSchema=I;exports.EndReasonSchema=M;exports.EventInputSchemas=y;exports.FinishReasonSchema=j;exports.FunctionExecutorSchema=H;exports.GatewayMessageCompleteInputSchema=ce;exports.GatewayMessageDeliveredInputSchema=de;exports.GatewayMessageProcessInputSchema=me;exports.GatewayMessageReadInputSchema=ge;exports.GatewayMessageReceiveInputSchema=ue;exports.GatewayMessageSendInputSchema=le;exports.HOOK_EVENTS=ze;exports.HeartbeatCompleteInputSchema=ye;exports.HeartbeatTriggerInputSchema=be;exports.HookEvent=o;exports.HookExecutorSchema=w;exports.HookMatcherSchema=E;exports.HookType=a;exports.HooksConfigSchema=Be;exports.HttpExecutorSchema=D;exports.LlmHeadersInputSchema=re;exports.LlmParamsInputSchema=ne;exports.LlmParamsSchema=oe;exports.LlmProviderSchema=x;exports.LoopEndInputSchema=Ce;exports.LoopStartInputSchema=Te;exports.MessageIDSchema=r;exports.MessageReceiveInputSchema=_;exports.MessageRoleSchema=L;exports.MessageSchema=h;exports.MessageTransformInputSchema=q;exports.ModelObjectSchema=f;exports.ModelSchema=c;exports.PermissionAskInputSchema=ee;exports.PermissionDeniedInputSchema=te;exports.PermissionLevelSchema=X;exports.PermissionRequestSchema=Y;exports.PromptExecutorSchema=v;exports.ScheduledTaskCompleteInputSchema=Ie;exports.ScheduledTaskTriggerInputSchema=fe;exports.SessionCompactInputSchema=F;exports.SessionCompactingInputSchema=z;exports.SessionEndInputSchema=A;exports.SessionIDSchema=n;exports.SessionStartInputSchema=R;exports.ShellEnvInputSchema=se;exports.StepFinishInputSchema=G;exports.StepStartInputSchema=O;exports.StepStopFailureInputSchema=B;exports.StepStopInputSchema=W;exports.SystemTransformInputSchema=U;exports.TaskCompleteInputSchema=ke;exports.TaskProgressInputSchema=xe;exports.TaskRunningInputSchema=he;exports.TaskSourceSchema=g;exports.TaskStartInputSchema=Se;exports.TextCompleteInputSchema=ie;exports.ToolAfterInputSchema=V;exports.ToolArgsSchema=d;exports.ToolBeforeInputSchema=Z;exports.ToolDefinitionInputSchema=K;exports.ToolFailureInputSchema=$;exports.ToolResultSchema=N;exports.getEventInputSchema=Le;exports.safeValidateHookInput=qe;exports.tool=T;exports.validateHookInput=_e;
|
package/dist/index.d.cts
CHANGED
|
@@ -52,6 +52,8 @@ declare const HookEvent: {
|
|
|
52
52
|
readonly GatewayMessageProcess: "gateway.message.process";
|
|
53
53
|
readonly GatewayMessageComplete: "gateway.message.complete";
|
|
54
54
|
readonly GatewayMessageSend: "gateway.message.send";
|
|
55
|
+
readonly GatewayMessageDelivered: "gateway.message.delivered";
|
|
56
|
+
readonly GatewayMessageRead: "gateway.message.read";
|
|
55
57
|
readonly HeartbeatTrigger: "scheduler.heartbeat.trigger";
|
|
56
58
|
readonly HeartbeatComplete: "scheduler.heartbeat.complete";
|
|
57
59
|
readonly ScheduledTaskTrigger: "scheduler.task.trigger";
|
|
@@ -66,7 +68,7 @@ declare const HookEvent: {
|
|
|
66
68
|
readonly LoopEnd: "loop.end";
|
|
67
69
|
};
|
|
68
70
|
type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
|
|
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")[];
|
|
71
|
+
declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "step.start" | "step.finish" | "step.stop" | "step.stop.failure" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "text.complete" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "gateway.message.delivered" | "gateway.message.read" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
70
72
|
interface HookContext {
|
|
71
73
|
sessionID?: string;
|
|
72
74
|
agent?: string;
|
|
@@ -862,6 +864,28 @@ declare const GatewayMessageSendInputSchema: z$1.ZodObject<{
|
|
|
862
864
|
target: z$1.ZodOptional<z$1.ZodString>;
|
|
863
865
|
}, z$1.core.$strip>;
|
|
864
866
|
type GatewayMessageSendInput = z$1.infer<typeof GatewayMessageSendInputSchema>;
|
|
867
|
+
declare const GatewayMessageDeliveredInputSchema: z$1.ZodObject<{
|
|
868
|
+
gatewayID: z$1.ZodString;
|
|
869
|
+
messageID: z$1.ZodString;
|
|
870
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
871
|
+
channel: z$1.ZodObject<{
|
|
872
|
+
platform: z$1.ZodString;
|
|
873
|
+
channelId: z$1.ZodString;
|
|
874
|
+
}, z$1.core.$strip>;
|
|
875
|
+
timestamp: z$1.ZodNumber;
|
|
876
|
+
}, z$1.core.$strip>;
|
|
877
|
+
type GatewayMessageDeliveredInput = z$1.infer<typeof GatewayMessageDeliveredInputSchema>;
|
|
878
|
+
declare const GatewayMessageReadInputSchema: z$1.ZodObject<{
|
|
879
|
+
gatewayID: z$1.ZodString;
|
|
880
|
+
messageID: z$1.ZodString;
|
|
881
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
882
|
+
channel: z$1.ZodObject<{
|
|
883
|
+
platform: z$1.ZodString;
|
|
884
|
+
channelId: z$1.ZodString;
|
|
885
|
+
}, z$1.core.$strip>;
|
|
886
|
+
timestamp: z$1.ZodNumber;
|
|
887
|
+
}, z$1.core.$strip>;
|
|
888
|
+
type GatewayMessageReadInput = z$1.infer<typeof GatewayMessageReadInputSchema>;
|
|
865
889
|
declare const HeartbeatTriggerInputSchema: z$1.ZodObject<{
|
|
866
890
|
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
867
891
|
timestamp: z$1.ZodNumber;
|
|
@@ -1334,6 +1358,26 @@ declare const EventInputSchemas: {
|
|
|
1334
1358
|
message: z$1.ZodUnknown;
|
|
1335
1359
|
target: z$1.ZodOptional<z$1.ZodString>;
|
|
1336
1360
|
}, z$1.core.$strip>;
|
|
1361
|
+
readonly "gateway.message.delivered": z$1.ZodObject<{
|
|
1362
|
+
gatewayID: z$1.ZodString;
|
|
1363
|
+
messageID: z$1.ZodString;
|
|
1364
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1365
|
+
channel: z$1.ZodObject<{
|
|
1366
|
+
platform: z$1.ZodString;
|
|
1367
|
+
channelId: z$1.ZodString;
|
|
1368
|
+
}, z$1.core.$strip>;
|
|
1369
|
+
timestamp: z$1.ZodNumber;
|
|
1370
|
+
}, z$1.core.$strip>;
|
|
1371
|
+
readonly "gateway.message.read": z$1.ZodObject<{
|
|
1372
|
+
gatewayID: z$1.ZodString;
|
|
1373
|
+
messageID: z$1.ZodString;
|
|
1374
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1375
|
+
channel: z$1.ZodObject<{
|
|
1376
|
+
platform: z$1.ZodString;
|
|
1377
|
+
channelId: z$1.ZodString;
|
|
1378
|
+
}, z$1.core.$strip>;
|
|
1379
|
+
timestamp: z$1.ZodNumber;
|
|
1380
|
+
}, z$1.core.$strip>;
|
|
1337
1381
|
readonly "scheduler.heartbeat.trigger": z$1.ZodObject<{
|
|
1338
1382
|
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1339
1383
|
timestamp: z$1.ZodNumber;
|
|
@@ -1779,6 +1823,24 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1779
1823
|
system: z$1.ZodArray<z$1.ZodString>;
|
|
1780
1824
|
metadata: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1781
1825
|
}, z$1.core.$strip>;
|
|
1826
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1827
|
+
gatewayID: z$1.ZodString;
|
|
1828
|
+
messageID: z$1.ZodString;
|
|
1829
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1830
|
+
channel: z$1.ZodObject<{
|
|
1831
|
+
platform: z$1.ZodString;
|
|
1832
|
+
channelId: z$1.ZodString;
|
|
1833
|
+
}, z$1.core.$strip>;
|
|
1834
|
+
timestamp: z$1.ZodNumber;
|
|
1835
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1836
|
+
gatewayID: z$1.ZodString;
|
|
1837
|
+
messageID: z$1.ZodString;
|
|
1838
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1839
|
+
channel: z$1.ZodObject<{
|
|
1840
|
+
platform: z$1.ZodString;
|
|
1841
|
+
channelId: z$1.ZodString;
|
|
1842
|
+
}, z$1.core.$strip>;
|
|
1843
|
+
timestamp: z$1.ZodNumber;
|
|
1782
1844
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1783
1845
|
taskId: z$1.ZodString;
|
|
1784
1846
|
sessionId: z$1.ZodString;
|
|
@@ -2111,4 +2173,4 @@ interface PluginDefinition {
|
|
|
2111
2173
|
'context.build.after'?: (input: ContextBuildAfterInput, output: HookOutputWrapper<ContextBuildAfterInput>) => Promise<void>;
|
|
2112
2174
|
}
|
|
2113
2175
|
|
|
2114
|
-
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 };
|
|
2176
|
+
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 GatewayMessageDeliveredInput, GatewayMessageDeliveredInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReadInput, GatewayMessageReadInputSchema, 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
|
@@ -52,6 +52,8 @@ declare const HookEvent: {
|
|
|
52
52
|
readonly GatewayMessageProcess: "gateway.message.process";
|
|
53
53
|
readonly GatewayMessageComplete: "gateway.message.complete";
|
|
54
54
|
readonly GatewayMessageSend: "gateway.message.send";
|
|
55
|
+
readonly GatewayMessageDelivered: "gateway.message.delivered";
|
|
56
|
+
readonly GatewayMessageRead: "gateway.message.read";
|
|
55
57
|
readonly HeartbeatTrigger: "scheduler.heartbeat.trigger";
|
|
56
58
|
readonly HeartbeatComplete: "scheduler.heartbeat.complete";
|
|
57
59
|
readonly ScheduledTaskTrigger: "scheduler.task.trigger";
|
|
@@ -66,7 +68,7 @@ declare const HookEvent: {
|
|
|
66
68
|
readonly LoopEnd: "loop.end";
|
|
67
69
|
};
|
|
68
70
|
type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
|
|
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")[];
|
|
71
|
+
declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "step.start" | "step.finish" | "step.stop" | "step.stop.failure" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "text.complete" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "gateway.message.delivered" | "gateway.message.read" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
70
72
|
interface HookContext {
|
|
71
73
|
sessionID?: string;
|
|
72
74
|
agent?: string;
|
|
@@ -862,6 +864,28 @@ declare const GatewayMessageSendInputSchema: z$1.ZodObject<{
|
|
|
862
864
|
target: z$1.ZodOptional<z$1.ZodString>;
|
|
863
865
|
}, z$1.core.$strip>;
|
|
864
866
|
type GatewayMessageSendInput = z$1.infer<typeof GatewayMessageSendInputSchema>;
|
|
867
|
+
declare const GatewayMessageDeliveredInputSchema: z$1.ZodObject<{
|
|
868
|
+
gatewayID: z$1.ZodString;
|
|
869
|
+
messageID: z$1.ZodString;
|
|
870
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
871
|
+
channel: z$1.ZodObject<{
|
|
872
|
+
platform: z$1.ZodString;
|
|
873
|
+
channelId: z$1.ZodString;
|
|
874
|
+
}, z$1.core.$strip>;
|
|
875
|
+
timestamp: z$1.ZodNumber;
|
|
876
|
+
}, z$1.core.$strip>;
|
|
877
|
+
type GatewayMessageDeliveredInput = z$1.infer<typeof GatewayMessageDeliveredInputSchema>;
|
|
878
|
+
declare const GatewayMessageReadInputSchema: z$1.ZodObject<{
|
|
879
|
+
gatewayID: z$1.ZodString;
|
|
880
|
+
messageID: z$1.ZodString;
|
|
881
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
882
|
+
channel: z$1.ZodObject<{
|
|
883
|
+
platform: z$1.ZodString;
|
|
884
|
+
channelId: z$1.ZodString;
|
|
885
|
+
}, z$1.core.$strip>;
|
|
886
|
+
timestamp: z$1.ZodNumber;
|
|
887
|
+
}, z$1.core.$strip>;
|
|
888
|
+
type GatewayMessageReadInput = z$1.infer<typeof GatewayMessageReadInputSchema>;
|
|
865
889
|
declare const HeartbeatTriggerInputSchema: z$1.ZodObject<{
|
|
866
890
|
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
867
891
|
timestamp: z$1.ZodNumber;
|
|
@@ -1334,6 +1358,26 @@ declare const EventInputSchemas: {
|
|
|
1334
1358
|
message: z$1.ZodUnknown;
|
|
1335
1359
|
target: z$1.ZodOptional<z$1.ZodString>;
|
|
1336
1360
|
}, z$1.core.$strip>;
|
|
1361
|
+
readonly "gateway.message.delivered": z$1.ZodObject<{
|
|
1362
|
+
gatewayID: z$1.ZodString;
|
|
1363
|
+
messageID: z$1.ZodString;
|
|
1364
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1365
|
+
channel: z$1.ZodObject<{
|
|
1366
|
+
platform: z$1.ZodString;
|
|
1367
|
+
channelId: z$1.ZodString;
|
|
1368
|
+
}, z$1.core.$strip>;
|
|
1369
|
+
timestamp: z$1.ZodNumber;
|
|
1370
|
+
}, z$1.core.$strip>;
|
|
1371
|
+
readonly "gateway.message.read": z$1.ZodObject<{
|
|
1372
|
+
gatewayID: z$1.ZodString;
|
|
1373
|
+
messageID: z$1.ZodString;
|
|
1374
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1375
|
+
channel: z$1.ZodObject<{
|
|
1376
|
+
platform: z$1.ZodString;
|
|
1377
|
+
channelId: z$1.ZodString;
|
|
1378
|
+
}, z$1.core.$strip>;
|
|
1379
|
+
timestamp: z$1.ZodNumber;
|
|
1380
|
+
}, z$1.core.$strip>;
|
|
1337
1381
|
readonly "scheduler.heartbeat.trigger": z$1.ZodObject<{
|
|
1338
1382
|
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1339
1383
|
timestamp: z$1.ZodNumber;
|
|
@@ -1779,6 +1823,24 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1779
1823
|
system: z$1.ZodArray<z$1.ZodString>;
|
|
1780
1824
|
metadata: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1781
1825
|
}, z$1.core.$strip>;
|
|
1826
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1827
|
+
gatewayID: z$1.ZodString;
|
|
1828
|
+
messageID: z$1.ZodString;
|
|
1829
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1830
|
+
channel: z$1.ZodObject<{
|
|
1831
|
+
platform: z$1.ZodString;
|
|
1832
|
+
channelId: z$1.ZodString;
|
|
1833
|
+
}, z$1.core.$strip>;
|
|
1834
|
+
timestamp: z$1.ZodNumber;
|
|
1835
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1836
|
+
gatewayID: z$1.ZodString;
|
|
1837
|
+
messageID: z$1.ZodString;
|
|
1838
|
+
sessionID: z$1.ZodOptional<z$1.ZodString>;
|
|
1839
|
+
channel: z$1.ZodObject<{
|
|
1840
|
+
platform: z$1.ZodString;
|
|
1841
|
+
channelId: z$1.ZodString;
|
|
1842
|
+
}, z$1.core.$strip>;
|
|
1843
|
+
timestamp: z$1.ZodNumber;
|
|
1782
1844
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1783
1845
|
taskId: z$1.ZodString;
|
|
1784
1846
|
sessionId: z$1.ZodString;
|
|
@@ -2111,4 +2173,4 @@ interface PluginDefinition {
|
|
|
2111
2173
|
'context.build.after'?: (input: ContextBuildAfterInput, output: HookOutputWrapper<ContextBuildAfterInput>) => Promise<void>;
|
|
2112
2174
|
}
|
|
2113
2175
|
|
|
2114
|
-
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 };
|
|
2176
|
+
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 GatewayMessageDeliveredInput, GatewayMessageDeliveredInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReadInput, GatewayMessageReadInputSchema, 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",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"),scope:z$1.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:z$1.string().optional().describe("Specified agent name"),model:z$1.string().optional().describe("Specified model"),hints:z$1.array(z$1.string()).optional().describe("Argument hints"),commandType:z$1.enum(["prompt","local"]).optional().describe("Command type"),hidden:z$1.boolean().optional().describe("Whether hidden")}),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};
|
|
1
|
+
import T,{z as z$1}from'zod';export{buildToolArgs,createTool,toolSchema as schema}from'@easbot/types';import'@easbot/sdk';function C(s){return {description:s.description,args:s.args,execute:s.execute}}C.schema=T;var p={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",GatewayMessageDelivered:"gateway.message.delivered",GatewayMessageRead:"gateway.message.read",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",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"},Fe=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()}),D=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())}),P=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())}),w=z$1.object({type:z$1.literal(p.Function),handler:z$1.function()}),E=z$1.discriminatedUnion("type",[v,D,P,H,w]),M=z$1.object({event:z$1.string(),matcher:z$1.string().optional(),hooks:z$1.array(E)}),Le=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"),R=z$1.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),A=z$1.object({sessionID:n,source:z$1.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:l,agent:u,cwd:S}),z=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")}),G=z$1.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:l,agent:u}),W=z$1.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:l,agent:u,finishReason:R,tokens:z$1.object({input:z$1.number().int().nonnegative().optional(),output:z$1.number().int().nonnegative().optional(),total:z$1.number().int().nonnegative().optional()}).optional().describe("Token usage statistics")}),B=z$1.object({sessionID:n,reason:z$1.string().describe("Stop reason")}),L=z$1.object({sessionID:n,error:z$1.string().describe("Error message"),errorType:z$1.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),_=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({gatewayID:z$1.string(),messageID:r,sessionID:n.optional(),channel:z$1.object({platform:z$1.string(),channelId:z$1.string()}),timestamp:z$1.number().describe("Delivery timestamp")}),be=z$1.object({gatewayID:z$1.string(),messageID:r,sessionID:n.optional(),channel:z$1.object({platform:z$1.string(),channelId:z$1.string()}),timestamp:z$1.number().describe("Read timestamp")}),ye=z$1.object({sessionID:n.optional(),timestamp:z$1.number().describe("Heartbeat timestamp"),name:z$1.string().optional().describe("Heartbeat name")}),fe=z$1.object({sessionID:n.optional(),timestamp:z$1.number(),duration:z$1.number().nonnegative().optional()}),Ie=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()}),Se=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"]),he=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")}),xe=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")}),ke=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")}),Te=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")}),Ce=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")}),ve=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")}),f={[o.SessionStart]:A,[o.SessionEnd]:z,[o.SessionCompacting]:F,[o.SessionCompact]:O,[o.StepStart]:G,[o.StepFinish]:W,[o.StepStop]:B,[o.StepStopFailure]:L,[o.MessageReceive]:q,[o.MessageTransform]:U,[o.SystemTransform]:N,[o.ToolBefore]:V,[o.ToolAfter]:$,[o.ToolFailure]:K,[o.ToolDefinition]:J,[o.CommandBefore]:Q,[o.CommandAfter]:X,[o.PermissionAsk]:te,[o.PermissionDenied]:oe,[o.LlmParams]:re,[o.LlmHeaders]:se,[o.ShellEnv]:ie,[o.TextComplete]:ae,[o.ContextBuildBefore]:pe,[o.ContextBuildAfter]:ue,[o.GatewayMessageReceive]:me,[o.GatewayMessageProcess]:ce,[o.GatewayMessageComplete]:le,[o.GatewayMessageSend]:de,[o.GatewayMessageDelivered]:ge,[o.GatewayMessageRead]:be,[o.HeartbeatTrigger]:ye,[o.HeartbeatComplete]:fe,[o.ScheduledTaskTrigger]:Ie,[o.ScheduledTaskComplete]:Se,[o.TaskStart]:he,[o.TaskRunning]:xe,[o.TaskProgress]:ke,[o.TaskComplete]:Te,[o.LoopStart]:Ce,[o.LoopEnd]:ve};function _e(s){return f[s]}function qe(s,y){let m=f[s];if(!m)throw new Error(`No schema found for event: ${s}`);return m.parse(y)}function Ue(s,y){let m=f[s];return m?m.safeParse(y):{success:false,error:new z$1.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var Ye=z$1.enum(["command","mcp","skill"]).describe("Command source"),De=z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments"),Pe=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")})]),et=z$1.object({name:z$1.string().describe("Command name"),description:z$1.string().describe("Command description"),scope:z$1.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:z$1.string().optional().describe("Specified agent name"),model:z$1.string().optional().describe("Specified model"),hints:z$1.array(z$1.string()).optional().describe("Argument hints"),commandType:z$1.enum(["prompt","local"]).optional().describe("Command type"),hidden:z$1.boolean().optional().describe("Whether hidden")}),tt=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:De.describe("Command arguments")}),He=z$1.record(z$1.string(),z$1.unknown()).describe("Result metadata"),ot=z$1.object({title:z$1.string().describe("Result title"),metadata:He.describe("Result metadata"),output:z$1.string().describe("Result output"),parts:z$1.array(Pe).optional().describe("Result parts"),success:z$1.boolean().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}),nt=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")}),rt=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,De as CommandArgumentsSchema,Q as CommandBeforeInputSchema,He as CommandExecuteResultMetadataSchema,ot as CommandExecuteResultSchema,tt as CommandExecutionContextSchema,v as CommandExecutorSchema,nt as CommandInitContextSchema,rt as CommandInitResultSchema,et as CommandMetadataSchema,Pe as CommandPromptPartSchema,Ye as CommandSourceSchema,h as ContentPartSchema,ue as ContextBuildAfterInputSchema,pe as ContextBuildBeforeInputSchema,S as CwdSchema,j as EndReasonSchema,f as EventInputSchemas,R as FinishReasonSchema,w as FunctionExecutorSchema,le as GatewayMessageCompleteInputSchema,ge as GatewayMessageDeliveredInputSchema,ce as GatewayMessageProcessInputSchema,be as GatewayMessageReadInputSchema,me as GatewayMessageReceiveInputSchema,de as GatewayMessageSendInputSchema,Fe as HOOK_EVENTS,fe as HeartbeatCompleteInputSchema,ye as HeartbeatTriggerInputSchema,o as HookEvent,E as HookExecutorSchema,M as HookMatcherSchema,p as HookType,Le as HooksConfigSchema,P as HttpExecutorSchema,se as LlmHeadersInputSchema,re as LlmParamsInputSchema,ne as LlmParamsSchema,k as LlmProviderSchema,ve as LoopEndInputSchema,Ce 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,D as PromptExecutorSchema,Se as ScheduledTaskCompleteInputSchema,Ie as ScheduledTaskTriggerInputSchema,O as SessionCompactInputSchema,F as SessionCompactingInputSchema,z as SessionEndInputSchema,n as SessionIDSchema,A as SessionStartInputSchema,ie as ShellEnvInputSchema,W as StepFinishInputSchema,G as StepStartInputSchema,L as StepStopFailureInputSchema,B as StepStopInputSchema,N as SystemTransformInputSchema,Te as TaskCompleteInputSchema,ke as TaskProgressInputSchema,xe as TaskRunningInputSchema,b as TaskSourceSchema,he as TaskStartInputSchema,ae as TextCompleteInputSchema,$ as ToolAfterInputSchema,g as ToolArgsSchema,V as ToolBeforeInputSchema,J as ToolDefinitionInputSchema,K as ToolFailureInputSchema,Z as ToolResultSchema,_e as getEventInputSchema,Ue as safeValidateHookInput,C as tool,qe 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.27",
|
|
4
4
|
"description": "EASBot Plugin for client applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"axios": "^1.16.1",
|
|
47
47
|
"zod": "^4.4.3",
|
|
48
|
-
"@easbot/sdk": "0.2.
|
|
49
|
-
"@easbot/types": "0.2.
|
|
48
|
+
"@easbot/sdk": "0.2.27",
|
|
49
|
+
"@easbot/types": "0.2.27"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^25.6.2",
|