@easbot/plugin 0.1.13 → 0.1.15
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/README.en.md +116 -0
- package/README.md +116 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +220 -2
- package/dist/index.d.ts +220 -2
- package/dist/index.mjs +1 -1
- package/package.json +21 -19
package/README.en.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
[中文](./README.md) | English
|
|
2
|
+
|
|
3
|
+
# @easbot/plugin
|
|
4
|
+
|
|
5
|
+
EASBot Plugin System - Hooks, Commands, and Tool Management
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Hook System**: Event-driven hook mechanism for extending Agent behavior
|
|
10
|
+
- **Command System**: Extensible command registration and execution
|
|
11
|
+
- **Tool System**: Plugin tools with permission control
|
|
12
|
+
- **Shell Integration**: Shell command execution support
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @easbot/plugin
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### Hook System
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { createHookRegistry, HOOK_EVENTS } from '@easbot/plugin';
|
|
26
|
+
|
|
27
|
+
// Create hook registry
|
|
28
|
+
const hooks = createHookRegistry();
|
|
29
|
+
|
|
30
|
+
// Register a hook
|
|
31
|
+
hooks.register(HOOK_EVENTS.BEFORE_TOOL_CALL, async (tool, context) => {
|
|
32
|
+
console.log('Tool called:', tool.name);
|
|
33
|
+
return context;
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Command System
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { createCommandRegistry } from '@easbot/plugin';
|
|
41
|
+
|
|
42
|
+
const commands = createCommandRegistry();
|
|
43
|
+
|
|
44
|
+
// Register a command
|
|
45
|
+
commands.register({
|
|
46
|
+
name: 'hello',
|
|
47
|
+
description: 'Say hello',
|
|
48
|
+
execute: async (args, session) => {
|
|
49
|
+
await session.send('Hello!');
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Tool System
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { createTool } from '@easbot/plugin';
|
|
58
|
+
|
|
59
|
+
const tool = createTool({
|
|
60
|
+
name: 'my-tool',
|
|
61
|
+
description: 'A custom tool',
|
|
62
|
+
parameters: z.object({
|
|
63
|
+
input: z.string()
|
|
64
|
+
}),
|
|
65
|
+
execute: async ({ input }) => {
|
|
66
|
+
return { result: input.toUpperCase() };
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## API
|
|
72
|
+
|
|
73
|
+
### HookRegistry
|
|
74
|
+
|
|
75
|
+
| Method | Description |
|
|
76
|
+
|--------|-------------|
|
|
77
|
+
| `register(event, handler)` | Register a hook handler |
|
|
78
|
+
| `unregister(event, handler)` | Remove a hook handler |
|
|
79
|
+
| `clear(event)` | Clear all handlers for an event |
|
|
80
|
+
|
|
81
|
+
### CommandRegistry
|
|
82
|
+
|
|
83
|
+
| Method | Description |
|
|
84
|
+
|--------|-------------|
|
|
85
|
+
| `register(command)` | Register a command |
|
|
86
|
+
| `get(name)` | Get a command |
|
|
87
|
+
| `execute(name, args)` | Execute a command |
|
|
88
|
+
|
|
89
|
+
### createTool
|
|
90
|
+
|
|
91
|
+
| Property | Type | Description |
|
|
92
|
+
|----------|------|-------------|
|
|
93
|
+
| name | string | Tool name |
|
|
94
|
+
| description | string | Tool description |
|
|
95
|
+
| parameters | ZodSchema | Parameter schema |
|
|
96
|
+
| execute | function | Tool implementation |
|
|
97
|
+
|
|
98
|
+
## Development
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Install dependencies
|
|
102
|
+
pnpm install
|
|
103
|
+
|
|
104
|
+
# Build
|
|
105
|
+
pnpm build
|
|
106
|
+
|
|
107
|
+
# Test
|
|
108
|
+
pnpm test
|
|
109
|
+
|
|
110
|
+
# Type check
|
|
111
|
+
pnpm type-check
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
MIT
|
package/README.md
CHANGED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
[English](./README.en.md) | 中文
|
|
2
|
+
|
|
3
|
+
# @easbot/plugin
|
|
4
|
+
|
|
5
|
+
EASBot 插件系统 - Hook、命令和工具管理
|
|
6
|
+
|
|
7
|
+
## 特性
|
|
8
|
+
|
|
9
|
+
- **Hook 系统**:事件驱动的 Hook 机制,扩展 Agent 行为
|
|
10
|
+
- **命令系统**:可扩展的命令注册和执行
|
|
11
|
+
- **工具系统**:插件工具与权限控制
|
|
12
|
+
- **Shell 集成**:Shell 命令执行支持
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @easbot/plugin
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 快速开始
|
|
21
|
+
|
|
22
|
+
### Hook 系统
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { createHookRegistry, HOOK_EVENTS } from '@easbot/plugin';
|
|
26
|
+
|
|
27
|
+
// 创建 Hook 注册表
|
|
28
|
+
const hooks = createHookRegistry();
|
|
29
|
+
|
|
30
|
+
// 注册 Hook
|
|
31
|
+
hooks.register(HOOK_EVENTS.BEFORE_TOOL_CALL, async (tool, context) => {
|
|
32
|
+
console.log('Tool called:', tool.name);
|
|
33
|
+
return context;
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 命令系统
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { createCommandRegistry } from '@easbot/plugin';
|
|
41
|
+
|
|
42
|
+
const commands = createCommandRegistry();
|
|
43
|
+
|
|
44
|
+
// 注册命令
|
|
45
|
+
commands.register({
|
|
46
|
+
name: 'hello',
|
|
47
|
+
description: '打招呼',
|
|
48
|
+
execute: async (args, session) => {
|
|
49
|
+
await session.send('你好!');
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 工具系统
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { createTool } from '@easbot/plugin';
|
|
58
|
+
|
|
59
|
+
const tool = createTool({
|
|
60
|
+
name: 'my-tool',
|
|
61
|
+
description: '自定义工具',
|
|
62
|
+
parameters: z.object({
|
|
63
|
+
input: z.string()
|
|
64
|
+
}),
|
|
65
|
+
execute: async ({ input }) => {
|
|
66
|
+
return { result: input.toUpperCase() };
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## API
|
|
72
|
+
|
|
73
|
+
### HookRegistry
|
|
74
|
+
|
|
75
|
+
| 方法 | 说明 |
|
|
76
|
+
|------|------|
|
|
77
|
+
| `register(event, handler)` | 注册 Hook 处理器 |
|
|
78
|
+
| `unregister(event, handler)` | 移除 Hook 处理器 |
|
|
79
|
+
| `clear(event)` | 清除事件的所有处理器 |
|
|
80
|
+
|
|
81
|
+
### CommandRegistry
|
|
82
|
+
|
|
83
|
+
| 方法 | 说明 |
|
|
84
|
+
|------|------|
|
|
85
|
+
| `register(command)` | 注册命令 |
|
|
86
|
+
| `get(name)` | 获取命令 |
|
|
87
|
+
| `execute(name, args)` | 执行命令 |
|
|
88
|
+
|
|
89
|
+
### createTool
|
|
90
|
+
|
|
91
|
+
| 属性 | 类型 | 说明 |
|
|
92
|
+
|------|------|------|
|
|
93
|
+
| name | string | 工具名称 |
|
|
94
|
+
| description | string | 工具描述 |
|
|
95
|
+
| parameters | ZodSchema | 参数模式 |
|
|
96
|
+
| execute | function | 工具实现 |
|
|
97
|
+
|
|
98
|
+
## 开发
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# 安装依赖
|
|
102
|
+
pnpm install
|
|
103
|
+
|
|
104
|
+
# 构建
|
|
105
|
+
pnpm build
|
|
106
|
+
|
|
107
|
+
# 测试
|
|
108
|
+
pnpm test
|
|
109
|
+
|
|
110
|
+
# 类型检查
|
|
111
|
+
pnpm type-check
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 许可证
|
|
115
|
+
|
|
116
|
+
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var x=require('zod'),types=require('@easbot/types');require('@easbot/sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var x__default=/*#__PURE__*/_interopDefault(x);function k(r){return {description:r.description,args:r.args,execute:r.execute}}k.schema=x__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"},Pe=Object.values(o);var l=x.z.string().optional(),C=x.z.object({type:x.z.literal(a.Command),command:x.z.string(),if:l,shell:x.z.enum(["bash","powershell"]).optional(),timeout:x.z.number().positive().optional(),statusMessage:x.z.string().optional(),once:x.z.boolean().optional(),async:x.z.boolean().optional()}),T=x.z.object({type:x.z.literal(a.Prompt),if:l,timeout:x.z.number().positive().optional(),model:x.z.string().optional(),statusMessage:x.z.string().optional(),once:x.z.boolean().optional(),runMode:x.z.enum(["session","fork"]).optional(),system:x.z.string().optional(),parts:x.z.array(x.z.unknown())}),v=x.z.object({type:x.z.literal(a.Http),url:x.z.string(),if:l,timeout:x.z.number().positive().optional(),method:x.z.enum(["GET","POST","PUT","DELETE"]).optional(),headers:x.z.record(x.z.string(),x.z.string()).optional(),allowedEnvVars:x.z.array(x.z.string()).optional(),statusMessage:x.z.string().optional(),once:x.z.boolean().optional()}),P=x.z.object({type:x.z.literal(a.Agent),if:l,timeout:x.z.number().positive().optional(),model:x.z.string().optional(),statusMessage:x.z.string().optional(),once:x.z.boolean().optional(),system:x.z.string().optional(),parts:x.z.array(x.z.unknown())}),H=x.z.object({type:x.z.literal(a.Function),handler:x.z.function()}),D=x.z.discriminatedUnion("type",[C,T,v,P,H]),E=x.z.object({event:x.z.string(),matcher:x.z.string().optional(),hooks:x.z.array(D)}),Me=x.z.record(x.z.string(),x.z.array(E)),n=x.z.string().min(1).describe("Session unique identifier"),s=x.z.string().min(1).describe("Message unique identifier"),m=x.z.string().min(1).describe("Tool call unique identifier"),p=x.z.string().optional().describe("Agent name"),c=x.z.string().optional().describe("Model identifier"),y=x.z.object({providerID:x.z.string().describe("Provider ID"),modelID:x.z.string().describe("Model ID"),api:x.z.object({id:x.z.string().describe("API ID"),npm:x.z.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),b=x.z.string().optional().describe("Working directory path"),w=x.z.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),M=x.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),j=x.z.object({sessionID:n,source:x.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:c,agent:p,cwd:b}),A=x.z.object({sessionID:n,reason:w,duration:x.z.number().positive().optional().describe("Session duration in milliseconds")}),z=x.z.object({sessionID:n,trigger:x.z.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:x.z.number().positive().describe("Current context length"),threshold:x.z.number().positive().describe("Trigger threshold")}),R=x.z.object({sessionID:n,summary:x.z.string().describe("Compaction summary"),previousLength:x.z.number().positive().describe("Previous context length"),newLength:x.z.number().positive().describe("New context length")}),F=x.z.object({sessionID:n,messageID:s,model:c,agent:p}),O=x.z.object({sessionID:n,messageID:s,model:c,agent:p,finishReason:M,tokens:x.z.object({input:x.z.number().int().nonnegative().optional(),output:x.z.number().int().nonnegative().optional(),total:x.z.number().int().nonnegative().optional()}).optional().describe("Token usage statistics")}),W=x.z.object({sessionID:n,reason:x.z.string().describe("Stop reason")}),B=x.z.object({sessionID:n,error:x.z.string().describe("Error message"),errorType:x.z.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),G=x.z.enum(["user","assistant","system","tool"]),S=x.z.discriminatedUnion("type",[x.z.object({type:x.z.literal("text"),text:x.z.string().describe("Text content")}),x.z.object({type:x.z.literal("image"),source:x.z.object({type:x.z.enum(["base64","url"]),mime:x.z.string().optional().describe("File mime type"),data:x.z.string().describe("File base64 encoding data or url")})}),x.z.object({type:x.z.literal("file"),url:x.z.string().describe("File path"),filename:x.z.string().describe("File name"),mime:x.z.string().optional().describe("File mime type")})]),I=x.z.object({id:s,role:G,content:x.z.union([x.z.string(),x.z.array(S)]),name:x.z.string().optional().describe("Message sender name"),tool_call_id:m.optional().describe("Related tool call ID")}),L=x.z.object({sessionID:n,agent:p,model:c,messageID:s,message:x.z.object({id:s,role:x.z.literal("user"),content:x.z.union([x.z.string(),x.z.array(S)])}).describe("User message")}),_=x.z.object({sessionID:n,messages:x.z.array(I).describe("Messages to transform")}),q=x.z.object({sessionID:n,model:c,system:x.z.array(x.z.string()).describe("Current system prompt")}),d=x.z.record(x.z.string(),x.z.unknown()).describe("Tool call arguments"),N=x.z.object({title:x.z.string().optional().describe("Result title"),content:x.z.string().describe("Result content"),is_error:x.z.boolean().optional().describe("Is error result"),metadata:x.z.record(x.z.string(),x.z.unknown()).optional().describe("Extra metadata")}),U=x.z.object({sessionID:n,tool:x.z.string().describe("Tool name"),callID:m,args:d}),Z=x.z.object({sessionID:n,tool:x.z.string(),callID:m,args:d,result:N,duration:x.z.number().nonnegative().optional().describe("Execution duration in milliseconds")}),V=x.z.object({sessionID:n,tool:x.z.string(),callID:m,args:d,error:x.z.string().describe("Error message"),errorType:x.z.enum(["timeout","invalid_args","execution_error","permission_denied"])}),$=x.z.object({sessionID:n,toolID:x.z.string().describe("Tool ID"),definition:x.z.object({name:x.z.string(),description:x.z.string().optional(),parameters:x.z.record(x.z.string(),x.z.unknown()).optional()}).describe("Tool definition")}),K=x.z.object({sessionID:n,command:x.z.string().describe("Command name"),arguments:x.z.union([x.z.string(),x.z.record(x.z.string(),x.z.unknown())]).describe("Command arguments")}),J=x.z.object({sessionID:n,command:x.z.string().describe("Command name"),arguments:x.z.union([x.z.string(),x.z.record(x.z.string(),x.z.unknown())]).optional(),result:x.z.object({info:x.z.unknown().optional().describe("Message info"),parts:x.z.array(x.z.unknown()).optional().describe("Message parts"),title:x.z.string().optional().describe("Result title"),metadata:x.z.record(x.z.string(),x.z.unknown()).optional().describe("Result metadata"),output:x.z.string().optional().describe("Result output"),success:x.z.boolean().optional().describe("Whether execution succeeded"),error:x.z.string().optional().describe("Error message if failed")}).describe("Command execution result")}),Q=x.z.enum(["read","write","exec","admin"]),X=x.z.object({tool:x.z.string().describe("Tool name requesting permission"),args:d.optional(),level:Q.optional(),reason:x.z.string().optional().describe("Reason for permission request")}),Y=x.z.object({sessionID:n,request:X}),ee=x.z.object({sessionID:n,tool:x.z.string(),reason:x.z.string().optional()}),h=x.z.enum(["openai","anthropic","google","azure","custom"]),te=x.z.object({temperature:x.z.number().min(0).max(2).optional(),topP:x.z.number().min(0).max(1).optional(),topK:x.z.number().int().positive().optional(),maxTokens:x.z.number().int().positive().optional(),stopSequences:x.z.array(x.z.string()).optional(),responseFormat:x.z.enum(["text","json_object"]).optional()}),oe=x.z.object({sessionID:n,agent:p,model:y,provider:h,params:te.partial().optional()}),ne=x.z.object({sessionID:n,agent:p,model:y,provider:h,headers:x.z.record(x.z.string(),x.z.string()).optional()}),re=x.z.object({cwd:b.describe("Working directory"),sessionID:n.optional(),callID:m.optional()}),se=x.z.object({sessionID:n,messageID:s,partID:x.z.string().describe("Text part ID"),text:x.z.string().describe("Completed text")}),ie=x.z.object({sessionID:n,mode:x.z.enum(["agent","chat","query"]).describe("Build mode"),projectID:x.z.string().optional()}),ae=x.z.object({sessionID:n,context:x.z.object({messages:x.z.array(I),system:x.z.array(x.z.string()),metadata:x.z.record(x.z.string(),x.z.unknown())}).describe("Built context")}),pe=x.z.object({gatewayID:x.z.string().describe("Gateway ID"),messageID:s,message:x.z.unknown().describe("Received message")}),ue=x.z.object({gatewayID:x.z.string(),messageID:s,message:x.z.unknown(),sessionID:n.optional()}),me=x.z.object({gatewayID:x.z.string(),messageID:s,result:x.z.unknown().optional()}),ce=x.z.object({gatewayID:x.z.string(),messageID:s,message:x.z.unknown(),target:x.z.string().optional().describe("Send target")}),le=x.z.object({sessionID:n.optional(),timestamp:x.z.number().describe("Heartbeat timestamp"),name:x.z.string().optional().describe("Heartbeat name")}),de=x.z.object({sessionID:n.optional(),timestamp:x.z.number(),duration:x.z.number().nonnegative().optional()}),ge=x.z.object({taskID:x.z.string().describe("Task ID"),taskName:x.z.string().optional(),timestamp:x.z.number(),payload:x.z.record(x.z.string(),x.z.unknown()).optional()}),fe=x.z.object({taskID:x.z.string(),timestamp:x.z.number(),success:x.z.boolean(),result:x.z.record(x.z.string(),x.z.unknown()).optional(),error:x.z.string().optional()}),f={[o.SessionStart]:j,[o.SessionEnd]:A,[o.SessionCompacting]:z,[o.SessionCompact]:R,[o.StepStart]:F,[o.StepFinish]:O,[o.StepStop]:W,[o.StepStopFailure]:B,[o.MessageReceive]:L,[o.MessageTransform]:_,[o.SystemTransform]:q,[o.ToolBefore]:U,[o.ToolAfter]:Z,[o.ToolFailure]:V,[o.ToolDefinition]:$,[o.CommandBefore]:K,[o.CommandAfter]:J,[o.PermissionAsk]:Y,[o.PermissionDenied]:ee,[o.LlmParams]:oe,[o.LlmHeaders]:ne,[o.ShellEnv]:re,[o.TextComplete]:se,[o.ContextBuildBefore]:ie,[o.ContextBuildAfter]:ae,[o.GatewayMessageReceive]:pe,[o.GatewayMessageProcess]:ue,[o.GatewayMessageComplete]:me,[o.GatewayMessageSend]:ce,[o.HeartbeatTrigger]:le,[o.HeartbeatComplete]:de,[o.ScheduledTaskTrigger]:ge,[o.ScheduledTaskComplete]:fe};function je(r){return f[r]}function Ae(r,g){let u=f[r];if(!u)throw new Error(`No schema found for event: ${r}`);return u.parse(g)}function ze(r,g){let u=f[r];return u?u.safeParse(g):{success:false,error:new x.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${r}`}])}}var qe=x.z.enum(["command","mcp","skill"]).describe("Command source"),ye=x.z.union([x.z.string(),x.z.record(x.z.string(),x.z.unknown())]).describe("Command arguments"),be=x.z.discriminatedUnion("type",[x.z.object({type:x.z.literal("text"),text:x.z.string().describe("Text content")}),x.z.object({type:x.z.literal("image"),source:x.z.object({type:x.z.enum(["base64","url"]),mime:x.z.string().describe("File mime type"),data:x.z.string().describe("File base64 encoding data or url")})}),x.z.object({type:x.z.literal("file"),url:x.z.string().describe("File path"),filename:x.z.string().describe("File name"),mime:x.z.string().optional().describe("File mime type")})]),Ne=x.z.object({name:x.z.string().describe("Command name"),description:x.z.string().describe("Command description"),agent:x.z.string().optional().describe("Specified agent name"),model:x.z.string().optional().describe("Specified model"),hints:x.z.array(x.z.string()).optional().describe("Argument hints"),commandType:x.z.enum(["prompt","local"]).optional().describe("Command type"),hidden:x.z.boolean().optional().describe("Whether hidden")}),Ue=x.z.object({sessionID:x.z.string().describe("Session ID"),directory:x.z.string().describe("Working directory"),model:x.z.string().optional().describe("Model identifier"),agent:x.z.string().optional().describe("Agent name"),arguments:ye.describe("Command arguments")}),Se=x.z.record(x.z.string(),x.z.unknown()).describe("Result metadata"),Ze=x.z.object({title:x.z.string().describe("Result title"),metadata:Se.describe("Result metadata"),output:x.z.string().describe("Result output"),parts:x.z.array(be).optional().describe("Result parts"),success:x.z.boolean().describe("Whether execution succeeded"),error:x.z.string().optional().describe("Error message if failed")}),Ve=x.z.object({agent:x.z.object({name:x.z.string().describe("Agent name"),model:x.z.string().optional().describe("Agent model")}).optional().describe("Agent context")}),$e=x.z.object({isEnabled:x.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=J;exports.CommandArgumentsSchema=ye;exports.CommandBeforeInputSchema=K;exports.CommandExecuteResultMetadataSchema=Se;exports.CommandExecuteResultSchema=Ze;exports.CommandExecutionContextSchema=Ue;exports.CommandExecutorSchema=C;exports.CommandInitContextSchema=Ve;exports.CommandInitResultSchema=$e;exports.CommandMetadataSchema=Ne;exports.CommandPromptPartSchema=be;exports.CommandSourceSchema=qe;exports.ContentPartSchema=S;exports.ContextBuildAfterInputSchema=ae;exports.ContextBuildBeforeInputSchema=ie;exports.CwdSchema=b;exports.EndReasonSchema=w;exports.EventInputSchemas=f;exports.FinishReasonSchema=M;exports.FunctionExecutorSchema=H;exports.GatewayMessageCompleteInputSchema=me;exports.GatewayMessageProcessInputSchema=ue;exports.GatewayMessageReceiveInputSchema=pe;exports.GatewayMessageSendInputSchema=ce;exports.HOOK_EVENTS=Pe;exports.HeartbeatCompleteInputSchema=de;exports.HeartbeatTriggerInputSchema=le;exports.HookEvent=o;exports.HookExecutorSchema=D;exports.HookMatcherSchema=E;exports.HookType=a;exports.HooksConfigSchema=Me;exports.HttpExecutorSchema=v;exports.LlmHeadersInputSchema=ne;exports.LlmParamsInputSchema=oe;exports.LlmParamsSchema=te;exports.LlmProviderSchema=h;exports.MessageIDSchema=s;exports.MessageReceiveInputSchema=L;exports.MessageRoleSchema=G;exports.MessageSchema=I;exports.MessageTransformInputSchema=_;exports.ModelObjectSchema=y;exports.ModelSchema=c;exports.PermissionAskInputSchema=Y;exports.PermissionDeniedInputSchema=ee;exports.PermissionLevelSchema=Q;exports.PermissionRequestSchema=X;exports.PromptExecutorSchema=T;exports.ScheduledTaskCompleteInputSchema=fe;exports.ScheduledTaskTriggerInputSchema=ge;exports.SessionCompactInputSchema=R;exports.SessionCompactingInputSchema=z;exports.SessionEndInputSchema=A;exports.SessionIDSchema=n;exports.SessionStartInputSchema=j;exports.ShellEnvInputSchema=re;exports.StepFinishInputSchema=O;exports.StepStartInputSchema=F;exports.StepStopFailureInputSchema=B;exports.StepStopInputSchema=W;exports.SystemTransformInputSchema=q;exports.TextCompleteInputSchema=se;exports.ToolAfterInputSchema=Z;exports.ToolArgsSchema=d;exports.ToolBeforeInputSchema=U;exports.ToolDefinitionInputSchema=$;exports.ToolFailureInputSchema=V;exports.ToolResultSchema=N;exports.getEventInputSchema=je;exports.safeValidateHookInput=ze;exports.tool=k;exports.validateHookInput=Ae;
|
|
1
|
+
'use strict';var k=require('zod'),types=require('@easbot/types');require('@easbot/sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var k__default=/*#__PURE__*/_interopDefault(k);function T(s){return {description:s.description,args:s.args,execute:s.execute}}T.schema=k__default.default;var a={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end"},je=Object.values(o);var l=k.z.string().optional(),C=k.z.object({type:k.z.literal(a.Command),command:k.z.string(),if:l,shell:k.z.enum(["bash","powershell"]).optional(),timeout:k.z.number().positive().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),async:k.z.boolean().optional()}),v=k.z.object({type:k.z.literal(a.Prompt),if:l,timeout:k.z.number().positive().optional(),model:k.z.string().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),runMode:k.z.enum(["session","fork"]).optional(),system:k.z.string().optional(),parts:k.z.array(k.z.unknown())}),P=k.z.object({type:k.z.literal(a.Http),url:k.z.string(),if:l,timeout:k.z.number().positive().optional(),method:k.z.enum(["GET","POST","PUT","DELETE"]).optional(),headers:k.z.record(k.z.string(),k.z.string()).optional(),allowedEnvVars:k.z.array(k.z.string()).optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional()}),D=k.z.object({type:k.z.literal(a.Agent),if:l,timeout:k.z.number().positive().optional(),model:k.z.string().optional(),statusMessage:k.z.string().optional(),once:k.z.boolean().optional(),system:k.z.string().optional(),parts:k.z.array(k.z.unknown())}),H=k.z.object({type:k.z.literal(a.Function),handler:k.z.function()}),E=k.z.discriminatedUnion("type",[C,v,P,D,H]),w=k.z.object({event:k.z.string(),matcher:k.z.string().optional(),hooks:k.z.array(E)}),Oe=k.z.record(k.z.string(),k.z.array(w)),n=k.z.string().min(1).describe("Session unique identifier"),r=k.z.string().min(1).describe("Message unique identifier"),m=k.z.string().min(1).describe("Tool call unique identifier"),p=k.z.string().optional().describe("Agent name"),c=k.z.string().optional().describe("Model identifier"),y=k.z.object({providerID:k.z.string().describe("Provider ID"),modelID:k.z.string().describe("Model ID"),api:k.z.object({id:k.z.string().describe("API ID"),npm:k.z.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),I=k.z.string().optional().describe("Working directory path"),M=k.z.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),j=k.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),A=k.z.object({sessionID:n,source:k.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:c,agent:p,cwd:I}),z=k.z.object({sessionID:n,reason:M,duration:k.z.number().positive().optional().describe("Session duration in milliseconds")}),R=k.z.object({sessionID:n,trigger:k.z.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:k.z.number().positive().describe("Current context length"),threshold:k.z.number().positive().describe("Trigger threshold")}),F=k.z.object({sessionID:n,summary:k.z.string().describe("Compaction summary"),previousLength:k.z.number().positive().describe("Previous context length"),newLength:k.z.number().positive().describe("New context length")}),O=k.z.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:c,agent:p}),W=k.z.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:c,agent:p,finishReason:j,tokens:k.z.object({input:k.z.number().int().nonnegative().optional(),output:k.z.number().int().nonnegative().optional(),total:k.z.number().int().nonnegative().optional()}).optional().describe("Token usage statistics")}),B=k.z.object({sessionID:n,reason:k.z.string().describe("Stop reason")}),L=k.z.object({sessionID:n,error:k.z.string().describe("Error message"),errorType:k.z.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),G=k.z.enum(["user","assistant","system","tool"]),S=k.z.discriminatedUnion("type",[k.z.object({type:k.z.literal("text"),text:k.z.string().describe("Text content")}),k.z.object({type:k.z.literal("image"),source:k.z.object({type:k.z.enum(["base64","url"]),mime:k.z.string().optional().describe("File mime type"),data:k.z.string().describe("File base64 encoding data or url")})}),k.z.object({type:k.z.literal("file"),url:k.z.string().describe("File path"),filename:k.z.string().describe("File name"),mime:k.z.string().optional().describe("File mime type")})]),h=k.z.object({id:r,role:G,content:k.z.union([k.z.string(),k.z.array(S)]),name:k.z.string().optional().describe("Message sender name"),tool_call_id:m.optional().describe("Related tool call ID")}),_=k.z.object({sessionID:n,agent:p,model:c,messageID:r,message:k.z.object({id:r,role:k.z.literal("user"),content:k.z.union([k.z.string(),k.z.array(S)])}).describe("User message")}),q=k.z.object({sessionID:n,messages:k.z.array(h).describe("Messages to transform")}),U=k.z.object({sessionID:n,model:c,system:k.z.array(k.z.string()).describe("Current system prompt")}),d=k.z.record(k.z.string(),k.z.unknown()).describe("Tool call arguments"),N=k.z.object({title:k.z.string().optional().describe("Result title"),content:k.z.string().describe("Result content"),is_error:k.z.boolean().optional().describe("Is error result"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Extra metadata")}),Z=k.z.object({sessionID:n,userMessageID:r.optional().describe("User message ID for the current step"),tool:k.z.string().describe("Tool name"),callID:m,args:d}),V=k.z.object({sessionID:n,userMessageID:r.optional().describe("User message ID for the current step"),tool:k.z.string(),callID:m,args:d,result:N,duration:k.z.number().nonnegative().optional().describe("Execution duration in milliseconds")}),$=k.z.object({sessionID:n,tool:k.z.string(),callID:m,args:d,error:k.z.string().describe("Error message"),errorType:k.z.enum(["timeout","invalid_args","execution_error","permission_denied"])}),K=k.z.object({sessionID:n,toolID:k.z.string().describe("Tool ID"),definition:k.z.object({name:k.z.string(),description:k.z.string().optional(),parameters:k.z.record(k.z.string(),k.z.unknown()).optional()}).describe("Tool definition")}),J=k.z.object({sessionID:n,command:k.z.string().describe("Command name"),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments")}),Q=k.z.object({sessionID:n,command:k.z.string().describe("Command name"),arguments:k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).optional(),result:k.z.object({info:k.z.unknown().optional().describe("Message info"),parts:k.z.array(k.z.unknown()).optional().describe("Message parts"),title:k.z.string().optional().describe("Result title"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Result metadata"),output:k.z.string().optional().describe("Result output"),success:k.z.boolean().optional().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}).describe("Command execution result")}),X=k.z.enum(["read","write","exec","admin"]),Y=k.z.object({tool:k.z.string().describe("Tool name requesting permission"),args:d.optional(),level:X.optional(),reason:k.z.string().optional().describe("Reason for permission request")}),ee=k.z.object({sessionID:n,request:Y}),te=k.z.object({sessionID:n,tool:k.z.string(),reason:k.z.string().optional()}),x=k.z.enum(["openai","anthropic","google","azure","custom"]),oe=k.z.object({temperature:k.z.number().min(0).max(2).optional(),topP:k.z.number().min(0).max(1).optional(),topK:k.z.number().int().positive().optional(),maxTokens:k.z.number().int().positive().optional(),stopSequences:k.z.array(k.z.string()).optional(),responseFormat:k.z.enum(["text","json_object"]).optional()}),ne=k.z.object({sessionID:n,agent:p,model:y,provider:x,params:oe.partial().optional()}),re=k.z.object({sessionID:n,agent:p,model:y,provider:x,headers:k.z.record(k.z.string(),k.z.string()).optional()}),se=k.z.object({cwd:I.describe("Working directory"),sessionID:n.optional(),callID:m.optional()}),ie=k.z.object({sessionID:n,messageID:r,partID:k.z.string().describe("Text part ID"),text:k.z.string().describe("Completed text")}),ae=k.z.object({sessionID:n,mode:k.z.enum(["agent","chat","query"]).describe("Build mode"),projectID:k.z.string().optional()}),pe=k.z.object({sessionID:n,context:k.z.object({messages:k.z.array(h),system:k.z.array(k.z.string()),metadata:k.z.record(k.z.string(),k.z.unknown())}).describe("Built context")}),ue=k.z.object({gatewayID:k.z.string().describe("Gateway ID"),messageID:r,message:k.z.unknown().describe("Received message")}),me=k.z.object({gatewayID:k.z.string(),messageID:r,message:k.z.unknown(),sessionID:n.optional()}),ce=k.z.object({gatewayID:k.z.string(),messageID:r,result:k.z.unknown().optional()}),le=k.z.object({gatewayID:k.z.string(),messageID:r,message:k.z.unknown(),target:k.z.string().optional().describe("Send target")}),de=k.z.object({sessionID:n.optional(),timestamp:k.z.number().describe("Heartbeat timestamp"),name:k.z.string().optional().describe("Heartbeat name")}),ge=k.z.object({sessionID:n.optional(),timestamp:k.z.number(),duration:k.z.number().nonnegative().optional()}),be=k.z.object({taskID:k.z.string().describe("Task ID"),taskName:k.z.string().optional(),timestamp:k.z.number(),payload:k.z.record(k.z.string(),k.z.unknown()).optional()}),fe=k.z.object({taskID:k.z.string(),timestamp:k.z.number(),success:k.z.boolean(),result:k.z.record(k.z.string(),k.z.unknown()).optional(),error:k.z.string().optional()}),b=k.z.enum(["tool","scheduler","cli","api"]),ye=k.z.object({taskId:k.z.string().describe("Task unique identifier"),sessionId:k.z.string().describe("Session ID for this task"),source:b.describe("Task source: tool, scheduler, cli, api"),agentType:k.z.string().describe("Agent type to execute this task"),description:k.z.string().describe("Task description"),prompt:k.z.string().describe("Task prompt content"),parentSessionId:k.z.string().optional().describe("Parent session ID if this is a subtask"),timeout:k.z.number().positive().optional().describe("Task timeout in milliseconds")}),Ie=k.z.object({taskId:k.z.string(),sessionId:k.z.string(),source:b,step:k.z.number().describe("Current step number"),totalSteps:k.z.number().optional().describe("Total number of steps"),output:k.z.string().describe("Progress output content"),timestamp:k.z.number().describe("Progress timestamp")}),Se=k.z.object({taskId:k.z.string(),sessionId:k.z.string(),source:b,result:k.z.string().describe("Task result content"),duration:k.z.number().nonnegative().describe("Task duration in milliseconds"),attachments:k.z.array(k.z.unknown()).optional().describe("Task result attachments"),error:k.z.string().optional().describe("Error message if task failed"),agentType:k.z.string().optional().describe("Agent type that executed the task"),metadata:k.z.record(k.z.string(),k.z.unknown()).optional().describe("Additional metadata for the task result")}),he=k.z.object({sessionID:k.z.string().describe("Session ID"),step:k.z.number().describe("Current step number"),lastUserId:k.z.string().describe("Last user message ID"),result:k.z.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),xe=k.z.object({sessionID:k.z.string().describe("Session ID"),step:k.z.number().describe("Current step number"),lastUserId:k.z.string().describe("Last user message ID"),result:k.z.enum(["stop","continue"]).describe("Loop result: stop or continue")}),f={[o.SessionStart]:A,[o.SessionEnd]:z,[o.SessionCompacting]:R,[o.SessionCompact]:F,[o.StepStart]:O,[o.StepFinish]:W,[o.StepStop]:B,[o.StepStopFailure]:L,[o.MessageReceive]:_,[o.MessageTransform]:q,[o.SystemTransform]:U,[o.ToolBefore]:Z,[o.ToolAfter]:V,[o.ToolFailure]:$,[o.ToolDefinition]:K,[o.CommandBefore]:J,[o.CommandAfter]:Q,[o.PermissionAsk]:ee,[o.PermissionDenied]:te,[o.LlmParams]:ne,[o.LlmHeaders]:re,[o.ShellEnv]:se,[o.TextComplete]:ie,[o.ContextBuildBefore]:ae,[o.ContextBuildAfter]:pe,[o.GatewayMessageReceive]:ue,[o.GatewayMessageProcess]:me,[o.GatewayMessageComplete]:ce,[o.GatewayMessageSend]:le,[o.HeartbeatTrigger]:de,[o.HeartbeatComplete]:ge,[o.ScheduledTaskTrigger]:be,[o.ScheduledTaskComplete]:fe,[o.TaskStart]:ye,[o.TaskProgress]:Ie,[o.TaskComplete]:Se,[o.LoopStart]:he,[o.LoopEnd]:xe};function We(s){return f[s]}function Be(s,g){let u=f[s];if(!u)throw new Error(`No schema found for event: ${s}`);return u.parse(g)}function Le(s,g){let u=f[s];return u?u.safeParse(g):{success:false,error:new k.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var Ke=k.z.enum(["command","mcp","skill"]).describe("Command source"),ke=k.z.union([k.z.string(),k.z.record(k.z.string(),k.z.unknown())]).describe("Command arguments"),Te=k.z.discriminatedUnion("type",[k.z.object({type:k.z.literal("text"),text:k.z.string().describe("Text content")}),k.z.object({type:k.z.literal("image"),source:k.z.object({type:k.z.enum(["base64","url"]),mime:k.z.string().describe("File mime type"),data:k.z.string().describe("File base64 encoding data or url")})}),k.z.object({type:k.z.literal("file"),url:k.z.string().describe("File path"),filename:k.z.string().describe("File name"),mime:k.z.string().optional().describe("File mime type")})]),Je=k.z.object({name:k.z.string().describe("Command name"),description:k.z.string().describe("Command description"),agent:k.z.string().optional().describe("Specified agent name"),model:k.z.string().optional().describe("Specified model"),hints:k.z.array(k.z.string()).optional().describe("Argument hints"),commandType:k.z.enum(["prompt","local"]).optional().describe("Command type"),hidden:k.z.boolean().optional().describe("Whether hidden")}),Qe=k.z.object({sessionID:k.z.string().describe("Session ID"),directory:k.z.string().describe("Working directory"),model:k.z.string().optional().describe("Model identifier"),agent:k.z.string().optional().describe("Agent name"),arguments:ke.describe("Command arguments")}),Ce=k.z.record(k.z.string(),k.z.unknown()).describe("Result metadata"),Xe=k.z.object({title:k.z.string().describe("Result title"),metadata:Ce.describe("Result metadata"),output:k.z.string().describe("Result output"),parts:k.z.array(Te).optional().describe("Result parts"),success:k.z.boolean().describe("Whether execution succeeded"),error:k.z.string().optional().describe("Error message if failed")}),Ye=k.z.object({agent:k.z.object({name:k.z.string().describe("Agent name"),model:k.z.string().optional().describe("Agent model")}).optional().describe("Agent context")}),et=k.z.object({isEnabled:k.z.boolean().optional().describe("Is enabled check result")});Object.defineProperty(exports,"buildToolArgs",{enumerable:true,get:function(){return types.buildToolArgs}});Object.defineProperty(exports,"createTool",{enumerable:true,get:function(){return types.createTool}});Object.defineProperty(exports,"schema",{enumerable:true,get:function(){return types.toolSchema}});exports.AgentExecutorSchema=D;exports.AgentSchema=p;exports.CallIDSchema=m;exports.CommandAfterInputSchema=Q;exports.CommandArgumentsSchema=ke;exports.CommandBeforeInputSchema=J;exports.CommandExecuteResultMetadataSchema=Ce;exports.CommandExecuteResultSchema=Xe;exports.CommandExecutionContextSchema=Qe;exports.CommandExecutorSchema=C;exports.CommandInitContextSchema=Ye;exports.CommandInitResultSchema=et;exports.CommandMetadataSchema=Je;exports.CommandPromptPartSchema=Te;exports.CommandSourceSchema=Ke;exports.ContentPartSchema=S;exports.ContextBuildAfterInputSchema=pe;exports.ContextBuildBeforeInputSchema=ae;exports.CwdSchema=I;exports.EndReasonSchema=M;exports.EventInputSchemas=f;exports.FinishReasonSchema=j;exports.FunctionExecutorSchema=H;exports.GatewayMessageCompleteInputSchema=ce;exports.GatewayMessageProcessInputSchema=me;exports.GatewayMessageReceiveInputSchema=ue;exports.GatewayMessageSendInputSchema=le;exports.HOOK_EVENTS=je;exports.HeartbeatCompleteInputSchema=ge;exports.HeartbeatTriggerInputSchema=de;exports.HookEvent=o;exports.HookExecutorSchema=E;exports.HookMatcherSchema=w;exports.HookType=a;exports.HooksConfigSchema=Oe;exports.HttpExecutorSchema=P;exports.LlmHeadersInputSchema=re;exports.LlmParamsInputSchema=ne;exports.LlmParamsSchema=oe;exports.LlmProviderSchema=x;exports.LoopEndInputSchema=xe;exports.LoopStartInputSchema=he;exports.MessageIDSchema=r;exports.MessageReceiveInputSchema=_;exports.MessageRoleSchema=G;exports.MessageSchema=h;exports.MessageTransformInputSchema=q;exports.ModelObjectSchema=y;exports.ModelSchema=c;exports.PermissionAskInputSchema=ee;exports.PermissionDeniedInputSchema=te;exports.PermissionLevelSchema=X;exports.PermissionRequestSchema=Y;exports.PromptExecutorSchema=v;exports.ScheduledTaskCompleteInputSchema=fe;exports.ScheduledTaskTriggerInputSchema=be;exports.SessionCompactInputSchema=F;exports.SessionCompactingInputSchema=R;exports.SessionEndInputSchema=z;exports.SessionIDSchema=n;exports.SessionStartInputSchema=A;exports.ShellEnvInputSchema=se;exports.StepFinishInputSchema=W;exports.StepStartInputSchema=O;exports.StepStopFailureInputSchema=L;exports.StepStopInputSchema=B;exports.SystemTransformInputSchema=U;exports.TaskCompleteInputSchema=Se;exports.TaskProgressInputSchema=Ie;exports.TaskSourceSchema=b;exports.TaskStartInputSchema=ye;exports.TextCompleteInputSchema=ie;exports.ToolAfterInputSchema=V;exports.ToolArgsSchema=d;exports.ToolBeforeInputSchema=Z;exports.ToolDefinitionInputSchema=K;exports.ToolFailureInputSchema=$;exports.ToolResultSchema=N;exports.getEventInputSchema=We;exports.safeValidateHookInput=Le;exports.tool=T;exports.validateHookInput=Be;
|
package/dist/index.d.cts
CHANGED
|
@@ -58,9 +58,14 @@ declare const HookEvent: {
|
|
|
58
58
|
readonly ScheduledTaskComplete: "scheduler.task.complete";
|
|
59
59
|
readonly ContextBuildBefore: "context.build.before";
|
|
60
60
|
readonly ContextBuildAfter: "context.build.after";
|
|
61
|
+
readonly TaskStart: "task.start";
|
|
62
|
+
readonly TaskProgress: "task.progress";
|
|
63
|
+
readonly TaskComplete: "task.complete";
|
|
64
|
+
readonly LoopStart: "loop.start";
|
|
65
|
+
readonly LoopEnd: "loop.end";
|
|
61
66
|
};
|
|
62
67
|
type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
|
|
63
|
-
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")[];
|
|
68
|
+
declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "step.start" | "step.finish" | "step.stop" | "step.stop.failure" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "text.complete" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
64
69
|
interface HookContext {
|
|
65
70
|
sessionID?: string;
|
|
66
71
|
agent?: string;
|
|
@@ -72,6 +77,7 @@ interface HookContext {
|
|
|
72
77
|
interface HookOutputWrapper<T = unknown> {
|
|
73
78
|
modified: boolean;
|
|
74
79
|
input: T;
|
|
80
|
+
output?: Record<string, unknown>;
|
|
75
81
|
}
|
|
76
82
|
type HookHandler<T = unknown> = (input: T, context: HookContext) => Promise<HookOutputWrapper<T>> | HookOutputWrapper<T>;
|
|
77
83
|
interface HookResult {
|
|
@@ -418,6 +424,7 @@ type SessionCompactInput = z$1.infer<typeof SessionCompactInputSchema>;
|
|
|
418
424
|
declare const StepStartInputSchema: z$1.ZodObject<{
|
|
419
425
|
sessionID: z$1.ZodString;
|
|
420
426
|
messageID: z$1.ZodString;
|
|
427
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
421
428
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
422
429
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
423
430
|
}, z$1.core.$strip>;
|
|
@@ -425,6 +432,7 @@ type StepStartInput = z$1.infer<typeof StepStartInputSchema>;
|
|
|
425
432
|
declare const StepFinishInputSchema: z$1.ZodObject<{
|
|
426
433
|
sessionID: z$1.ZodString;
|
|
427
434
|
messageID: z$1.ZodString;
|
|
435
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
428
436
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
429
437
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
430
438
|
finishReason: z$1.ZodEnum<{
|
|
@@ -592,6 +600,7 @@ declare const ToolResultSchema: z$1.ZodObject<{
|
|
|
592
600
|
}, z$1.core.$strip>;
|
|
593
601
|
declare const ToolBeforeInputSchema: z$1.ZodObject<{
|
|
594
602
|
sessionID: z$1.ZodString;
|
|
603
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
595
604
|
tool: z$1.ZodString;
|
|
596
605
|
callID: z$1.ZodString;
|
|
597
606
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -599,6 +608,7 @@ declare const ToolBeforeInputSchema: z$1.ZodObject<{
|
|
|
599
608
|
type ToolBeforeInput = z$1.infer<typeof ToolBeforeInputSchema>;
|
|
600
609
|
declare const ToolAfterInputSchema: z$1.ZodObject<{
|
|
601
610
|
sessionID: z$1.ZodString;
|
|
611
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
602
612
|
tool: z$1.ZodString;
|
|
603
613
|
callID: z$1.ZodString;
|
|
604
614
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -878,6 +888,82 @@ declare const ScheduledTaskCompleteInputSchema: z$1.ZodObject<{
|
|
|
878
888
|
error: z$1.ZodOptional<z$1.ZodString>;
|
|
879
889
|
}, z$1.core.$strip>;
|
|
880
890
|
type ScheduledTaskCompleteInput = z$1.infer<typeof ScheduledTaskCompleteInputSchema>;
|
|
891
|
+
declare const TaskSourceSchema: z$1.ZodEnum<{
|
|
892
|
+
api: "api";
|
|
893
|
+
tool: "tool";
|
|
894
|
+
scheduler: "scheduler";
|
|
895
|
+
cli: "cli";
|
|
896
|
+
}>;
|
|
897
|
+
type TaskSource = z$1.infer<typeof TaskSourceSchema>;
|
|
898
|
+
declare const TaskStartInputSchema: z$1.ZodObject<{
|
|
899
|
+
taskId: z$1.ZodString;
|
|
900
|
+
sessionId: z$1.ZodString;
|
|
901
|
+
source: z$1.ZodEnum<{
|
|
902
|
+
api: "api";
|
|
903
|
+
tool: "tool";
|
|
904
|
+
scheduler: "scheduler";
|
|
905
|
+
cli: "cli";
|
|
906
|
+
}>;
|
|
907
|
+
agentType: z$1.ZodString;
|
|
908
|
+
description: z$1.ZodString;
|
|
909
|
+
prompt: z$1.ZodString;
|
|
910
|
+
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
911
|
+
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
912
|
+
}, z$1.core.$strip>;
|
|
913
|
+
type TaskStartInput = z$1.infer<typeof TaskStartInputSchema>;
|
|
914
|
+
declare const TaskProgressInputSchema: z$1.ZodObject<{
|
|
915
|
+
taskId: z$1.ZodString;
|
|
916
|
+
sessionId: z$1.ZodString;
|
|
917
|
+
source: z$1.ZodEnum<{
|
|
918
|
+
api: "api";
|
|
919
|
+
tool: "tool";
|
|
920
|
+
scheduler: "scheduler";
|
|
921
|
+
cli: "cli";
|
|
922
|
+
}>;
|
|
923
|
+
step: z$1.ZodNumber;
|
|
924
|
+
totalSteps: z$1.ZodOptional<z$1.ZodNumber>;
|
|
925
|
+
output: z$1.ZodString;
|
|
926
|
+
timestamp: z$1.ZodNumber;
|
|
927
|
+
}, z$1.core.$strip>;
|
|
928
|
+
type TaskProgressInput = z$1.infer<typeof TaskProgressInputSchema>;
|
|
929
|
+
declare const TaskCompleteInputSchema: z$1.ZodObject<{
|
|
930
|
+
taskId: z$1.ZodString;
|
|
931
|
+
sessionId: z$1.ZodString;
|
|
932
|
+
source: z$1.ZodEnum<{
|
|
933
|
+
api: "api";
|
|
934
|
+
tool: "tool";
|
|
935
|
+
scheduler: "scheduler";
|
|
936
|
+
cli: "cli";
|
|
937
|
+
}>;
|
|
938
|
+
result: z$1.ZodString;
|
|
939
|
+
duration: z$1.ZodNumber;
|
|
940
|
+
attachments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
941
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
942
|
+
agentType: z$1.ZodOptional<z$1.ZodString>;
|
|
943
|
+
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
944
|
+
}, z$1.core.$strip>;
|
|
945
|
+
type TaskCompleteInput = z$1.infer<typeof TaskCompleteInputSchema>;
|
|
946
|
+
declare const LoopStartInputSchema: z$1.ZodObject<{
|
|
947
|
+
sessionID: z$1.ZodString;
|
|
948
|
+
step: z$1.ZodNumber;
|
|
949
|
+
lastUserId: z$1.ZodString;
|
|
950
|
+
result: z$1.ZodOptional<z$1.ZodEnum<{
|
|
951
|
+
stop: "stop";
|
|
952
|
+
start: "start";
|
|
953
|
+
continue: "continue";
|
|
954
|
+
}>>;
|
|
955
|
+
}, z$1.core.$strip>;
|
|
956
|
+
type LoopStartInput = z$1.infer<typeof LoopStartInputSchema>;
|
|
957
|
+
declare const LoopEndInputSchema: z$1.ZodObject<{
|
|
958
|
+
sessionID: z$1.ZodString;
|
|
959
|
+
step: z$1.ZodNumber;
|
|
960
|
+
lastUserId: z$1.ZodString;
|
|
961
|
+
result: z$1.ZodEnum<{
|
|
962
|
+
stop: "stop";
|
|
963
|
+
continue: "continue";
|
|
964
|
+
}>;
|
|
965
|
+
}, z$1.core.$strip>;
|
|
966
|
+
type LoopEndInput = z$1.infer<typeof LoopEndInputSchema>;
|
|
881
967
|
declare const EventInputSchemas: {
|
|
882
968
|
readonly "session.start": z$1.ZodObject<{
|
|
883
969
|
sessionID: z$1.ZodString;
|
|
@@ -922,12 +1008,14 @@ declare const EventInputSchemas: {
|
|
|
922
1008
|
readonly "step.start": z$1.ZodObject<{
|
|
923
1009
|
sessionID: z$1.ZodString;
|
|
924
1010
|
messageID: z$1.ZodString;
|
|
1011
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
925
1012
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
926
1013
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
927
1014
|
}, z$1.core.$strip>;
|
|
928
1015
|
readonly "step.finish": z$1.ZodObject<{
|
|
929
1016
|
sessionID: z$1.ZodString;
|
|
930
1017
|
messageID: z$1.ZodString;
|
|
1018
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
931
1019
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
932
1020
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
933
1021
|
finishReason: z$1.ZodEnum<{
|
|
@@ -1027,12 +1115,14 @@ declare const EventInputSchemas: {
|
|
|
1027
1115
|
}, z$1.core.$strip>;
|
|
1028
1116
|
readonly "tool.before": z$1.ZodObject<{
|
|
1029
1117
|
sessionID: z$1.ZodString;
|
|
1118
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1030
1119
|
tool: z$1.ZodString;
|
|
1031
1120
|
callID: z$1.ZodString;
|
|
1032
1121
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1033
1122
|
}, z$1.core.$strip>;
|
|
1034
1123
|
readonly "tool.after": z$1.ZodObject<{
|
|
1035
1124
|
sessionID: z$1.ZodString;
|
|
1125
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1036
1126
|
tool: z$1.ZodString;
|
|
1037
1127
|
callID: z$1.ZodString;
|
|
1038
1128
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -1256,6 +1346,70 @@ declare const EventInputSchemas: {
|
|
|
1256
1346
|
result: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1257
1347
|
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1258
1348
|
}, z$1.core.$strip>;
|
|
1349
|
+
readonly "task.start": z$1.ZodObject<{
|
|
1350
|
+
taskId: z$1.ZodString;
|
|
1351
|
+
sessionId: z$1.ZodString;
|
|
1352
|
+
source: z$1.ZodEnum<{
|
|
1353
|
+
api: "api";
|
|
1354
|
+
tool: "tool";
|
|
1355
|
+
scheduler: "scheduler";
|
|
1356
|
+
cli: "cli";
|
|
1357
|
+
}>;
|
|
1358
|
+
agentType: z$1.ZodString;
|
|
1359
|
+
description: z$1.ZodString;
|
|
1360
|
+
prompt: z$1.ZodString;
|
|
1361
|
+
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
1362
|
+
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1363
|
+
}, z$1.core.$strip>;
|
|
1364
|
+
readonly "task.progress": z$1.ZodObject<{
|
|
1365
|
+
taskId: z$1.ZodString;
|
|
1366
|
+
sessionId: z$1.ZodString;
|
|
1367
|
+
source: z$1.ZodEnum<{
|
|
1368
|
+
api: "api";
|
|
1369
|
+
tool: "tool";
|
|
1370
|
+
scheduler: "scheduler";
|
|
1371
|
+
cli: "cli";
|
|
1372
|
+
}>;
|
|
1373
|
+
step: z$1.ZodNumber;
|
|
1374
|
+
totalSteps: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1375
|
+
output: z$1.ZodString;
|
|
1376
|
+
timestamp: z$1.ZodNumber;
|
|
1377
|
+
}, z$1.core.$strip>;
|
|
1378
|
+
readonly "task.complete": z$1.ZodObject<{
|
|
1379
|
+
taskId: z$1.ZodString;
|
|
1380
|
+
sessionId: z$1.ZodString;
|
|
1381
|
+
source: z$1.ZodEnum<{
|
|
1382
|
+
api: "api";
|
|
1383
|
+
tool: "tool";
|
|
1384
|
+
scheduler: "scheduler";
|
|
1385
|
+
cli: "cli";
|
|
1386
|
+
}>;
|
|
1387
|
+
result: z$1.ZodString;
|
|
1388
|
+
duration: z$1.ZodNumber;
|
|
1389
|
+
attachments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
1390
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1391
|
+
agentType: z$1.ZodOptional<z$1.ZodString>;
|
|
1392
|
+
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1393
|
+
}, z$1.core.$strip>;
|
|
1394
|
+
readonly "loop.start": z$1.ZodObject<{
|
|
1395
|
+
sessionID: z$1.ZodString;
|
|
1396
|
+
step: z$1.ZodNumber;
|
|
1397
|
+
lastUserId: z$1.ZodString;
|
|
1398
|
+
result: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1399
|
+
stop: "stop";
|
|
1400
|
+
start: "start";
|
|
1401
|
+
continue: "continue";
|
|
1402
|
+
}>>;
|
|
1403
|
+
}, z$1.core.$strip>;
|
|
1404
|
+
readonly "loop.end": z$1.ZodObject<{
|
|
1405
|
+
sessionID: z$1.ZodString;
|
|
1406
|
+
step: z$1.ZodNumber;
|
|
1407
|
+
lastUserId: z$1.ZodString;
|
|
1408
|
+
result: z$1.ZodEnum<{
|
|
1409
|
+
stop: "stop";
|
|
1410
|
+
continue: "continue";
|
|
1411
|
+
}>;
|
|
1412
|
+
}, z$1.core.$strip>;
|
|
1259
1413
|
};
|
|
1260
1414
|
declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
1261
1415
|
sessionID: z$1.ZodString;
|
|
@@ -1301,11 +1455,13 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1301
1455
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1302
1456
|
sessionID: z$1.ZodString;
|
|
1303
1457
|
messageID: z$1.ZodString;
|
|
1458
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1304
1459
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
1305
1460
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
1306
1461
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1307
1462
|
sessionID: z$1.ZodString;
|
|
1308
1463
|
messageID: z$1.ZodString;
|
|
1464
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1309
1465
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
1310
1466
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
1311
1467
|
finishReason: z$1.ZodEnum<{
|
|
@@ -1399,11 +1555,13 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1399
1555
|
system: z$1.ZodArray<z$1.ZodString>;
|
|
1400
1556
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1401
1557
|
sessionID: z$1.ZodString;
|
|
1558
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1402
1559
|
tool: z$1.ZodString;
|
|
1403
1560
|
callID: z$1.ZodString;
|
|
1404
1561
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1405
1562
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1406
1563
|
sessionID: z$1.ZodString;
|
|
1564
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1407
1565
|
tool: z$1.ZodString;
|
|
1408
1566
|
callID: z$1.ZodString;
|
|
1409
1567
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -1601,6 +1759,65 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1601
1759
|
system: z$1.ZodArray<z$1.ZodString>;
|
|
1602
1760
|
metadata: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1603
1761
|
}, z$1.core.$strip>;
|
|
1762
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1763
|
+
taskId: z$1.ZodString;
|
|
1764
|
+
sessionId: z$1.ZodString;
|
|
1765
|
+
source: z$1.ZodEnum<{
|
|
1766
|
+
api: "api";
|
|
1767
|
+
tool: "tool";
|
|
1768
|
+
scheduler: "scheduler";
|
|
1769
|
+
cli: "cli";
|
|
1770
|
+
}>;
|
|
1771
|
+
agentType: z$1.ZodString;
|
|
1772
|
+
description: z$1.ZodString;
|
|
1773
|
+
prompt: z$1.ZodString;
|
|
1774
|
+
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
1775
|
+
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1776
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1777
|
+
taskId: z$1.ZodString;
|
|
1778
|
+
sessionId: z$1.ZodString;
|
|
1779
|
+
source: z$1.ZodEnum<{
|
|
1780
|
+
api: "api";
|
|
1781
|
+
tool: "tool";
|
|
1782
|
+
scheduler: "scheduler";
|
|
1783
|
+
cli: "cli";
|
|
1784
|
+
}>;
|
|
1785
|
+
step: z$1.ZodNumber;
|
|
1786
|
+
totalSteps: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1787
|
+
output: z$1.ZodString;
|
|
1788
|
+
timestamp: z$1.ZodNumber;
|
|
1789
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1790
|
+
taskId: z$1.ZodString;
|
|
1791
|
+
sessionId: z$1.ZodString;
|
|
1792
|
+
source: z$1.ZodEnum<{
|
|
1793
|
+
api: "api";
|
|
1794
|
+
tool: "tool";
|
|
1795
|
+
scheduler: "scheduler";
|
|
1796
|
+
cli: "cli";
|
|
1797
|
+
}>;
|
|
1798
|
+
result: z$1.ZodString;
|
|
1799
|
+
duration: z$1.ZodNumber;
|
|
1800
|
+
attachments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
1801
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1802
|
+
agentType: z$1.ZodOptional<z$1.ZodString>;
|
|
1803
|
+
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1804
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1805
|
+
sessionID: z$1.ZodString;
|
|
1806
|
+
step: z$1.ZodNumber;
|
|
1807
|
+
lastUserId: z$1.ZodString;
|
|
1808
|
+
result: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1809
|
+
stop: "stop";
|
|
1810
|
+
start: "start";
|
|
1811
|
+
continue: "continue";
|
|
1812
|
+
}>>;
|
|
1813
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1814
|
+
sessionID: z$1.ZodString;
|
|
1815
|
+
step: z$1.ZodNumber;
|
|
1816
|
+
lastUserId: z$1.ZodString;
|
|
1817
|
+
result: z$1.ZodEnum<{
|
|
1818
|
+
stop: "stop";
|
|
1819
|
+
continue: "continue";
|
|
1820
|
+
}>;
|
|
1604
1821
|
}, z$1.core.$strip>;
|
|
1605
1822
|
declare function validateHookInput<T extends HookEvent>(event: T, input: unknown): unknown;
|
|
1606
1823
|
declare function safeValidateHookInput<T extends HookEvent>(event: T, input: unknown): {
|
|
@@ -1711,6 +1928,7 @@ interface CommandDefinition extends Command {
|
|
|
1711
1928
|
model?: string;
|
|
1712
1929
|
subtask?: boolean;
|
|
1713
1930
|
hidden?: boolean;
|
|
1931
|
+
scope?: 'general' | 'coder' | 'all';
|
|
1714
1932
|
execute: (args: CommandArguments, context: CommandExecutionContext) => Promise<CommandExecuteResult>;
|
|
1715
1933
|
isEnabled?: () => boolean | Promise<boolean>;
|
|
1716
1934
|
init?: (context?: CommandInitContext) => Promise<CommandInitResult>;
|
|
@@ -1860,4 +2078,4 @@ interface PluginDefinition {
|
|
|
1860
2078
|
'context.build.after'?: (input: ContextBuildAfterInput, output: HookOutputWrapper<ContextBuildAfterInput>) => Promise<void>;
|
|
1861
2079
|
}
|
|
1862
2080
|
|
|
1863
|
-
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, 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 TextCompleteInput, TextCompleteInputSchema, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, safeValidateHookInput, tool, validateHookInput };
|
|
2081
|
+
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, type CommandDefinition, type CommandExecuteResult, type CommandExecuteResultMetadata, CommandExecuteResultMetadataSchema, CommandExecuteResultSchema, type CommandExecutionContext, CommandExecutionContextSchema, CommandExecutorSchema, type CommandHookDefinition, type CommandInitContext, CommandInitContextSchema, type CommandInitResult, CommandInitResultSchema, type CommandMetadata, CommandMetadataSchema, type CommandPromptPart, CommandPromptPartSchema, type CommandSource, CommandSourceSchema, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, type HeartbeatTriggerInput, HeartbeatTriggerInputSchema, type HookChainResult, type HookContext, type HookDefinition, type HookError, HookEvent, type HookExecutionDetail, HookExecutorSchema, type HookHandler, type HookMatcher, HookMatcherSchema, type HookOutputWrapper, type HookResult, HookType, type HooksConfig, HooksConfigSchema, HttpExecutorSchema, type HttpHookDefinition, type LlmHeadersInput, LlmHeadersInputSchema, type LlmParamsInput, LlmParamsInputSchema, LlmParamsSchema, LlmProviderSchema, type LoopEndInput, LoopEndInputSchema, type LoopStartInput, LoopStartInputSchema, MessageIDSchema, type MessageReceiveInput, MessageReceiveInputSchema, MessageRoleSchema, MessageSchema, type MessageTransformInput, MessageTransformInputSchema, ModelObjectSchema, ModelSchema, type PermissionAskInput, PermissionAskInputSchema, type PermissionDeniedInput, PermissionDeniedInputSchema, PermissionLevelSchema, PermissionRequestSchema, type Plugin, type PluginDefinition, type PluginInput, PromptExecutorSchema, type PromptHookDefinition, type ScheduledTaskCompleteInput, ScheduledTaskCompleteInputSchema, type ScheduledTaskTriggerInput, ScheduledTaskTriggerInputSchema, type SessionCompactInput, SessionCompactInputSchema, type SessionCompactingInput, SessionCompactingInputSchema, type SessionEndInput, SessionEndInputSchema, SessionIDSchema, type SessionStartInput, SessionStartInputSchema, type ShellEnvInput, ShellEnvInputSchema, type StepFinishInput, StepFinishInputSchema, type StepStartInput, StepStartInputSchema, type StepStopFailureInput, StepStopFailureInputSchema, type StepStopInput, StepStopInputSchema, type SystemTransformInput, SystemTransformInputSchema, type TaskCompleteInput, TaskCompleteInputSchema, type TaskProgressInput, TaskProgressInputSchema, type TaskSource, TaskSourceSchema, type TaskStartInput, TaskStartInputSchema, type TextCompleteInput, TextCompleteInputSchema, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, safeValidateHookInput, tool, validateHookInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -58,9 +58,14 @@ declare const HookEvent: {
|
|
|
58
58
|
readonly ScheduledTaskComplete: "scheduler.task.complete";
|
|
59
59
|
readonly ContextBuildBefore: "context.build.before";
|
|
60
60
|
readonly ContextBuildAfter: "context.build.after";
|
|
61
|
+
readonly TaskStart: "task.start";
|
|
62
|
+
readonly TaskProgress: "task.progress";
|
|
63
|
+
readonly TaskComplete: "task.complete";
|
|
64
|
+
readonly LoopStart: "loop.start";
|
|
65
|
+
readonly LoopEnd: "loop.end";
|
|
61
66
|
};
|
|
62
67
|
type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
|
|
63
|
-
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")[];
|
|
68
|
+
declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "step.start" | "step.finish" | "step.stop" | "step.stop.failure" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "text.complete" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.progress" | "task.complete" | "loop.start" | "loop.end")[];
|
|
64
69
|
interface HookContext {
|
|
65
70
|
sessionID?: string;
|
|
66
71
|
agent?: string;
|
|
@@ -72,6 +77,7 @@ interface HookContext {
|
|
|
72
77
|
interface HookOutputWrapper<T = unknown> {
|
|
73
78
|
modified: boolean;
|
|
74
79
|
input: T;
|
|
80
|
+
output?: Record<string, unknown>;
|
|
75
81
|
}
|
|
76
82
|
type HookHandler<T = unknown> = (input: T, context: HookContext) => Promise<HookOutputWrapper<T>> | HookOutputWrapper<T>;
|
|
77
83
|
interface HookResult {
|
|
@@ -418,6 +424,7 @@ type SessionCompactInput = z$1.infer<typeof SessionCompactInputSchema>;
|
|
|
418
424
|
declare const StepStartInputSchema: z$1.ZodObject<{
|
|
419
425
|
sessionID: z$1.ZodString;
|
|
420
426
|
messageID: z$1.ZodString;
|
|
427
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
421
428
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
422
429
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
423
430
|
}, z$1.core.$strip>;
|
|
@@ -425,6 +432,7 @@ type StepStartInput = z$1.infer<typeof StepStartInputSchema>;
|
|
|
425
432
|
declare const StepFinishInputSchema: z$1.ZodObject<{
|
|
426
433
|
sessionID: z$1.ZodString;
|
|
427
434
|
messageID: z$1.ZodString;
|
|
435
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
428
436
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
429
437
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
430
438
|
finishReason: z$1.ZodEnum<{
|
|
@@ -592,6 +600,7 @@ declare const ToolResultSchema: z$1.ZodObject<{
|
|
|
592
600
|
}, z$1.core.$strip>;
|
|
593
601
|
declare const ToolBeforeInputSchema: z$1.ZodObject<{
|
|
594
602
|
sessionID: z$1.ZodString;
|
|
603
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
595
604
|
tool: z$1.ZodString;
|
|
596
605
|
callID: z$1.ZodString;
|
|
597
606
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -599,6 +608,7 @@ declare const ToolBeforeInputSchema: z$1.ZodObject<{
|
|
|
599
608
|
type ToolBeforeInput = z$1.infer<typeof ToolBeforeInputSchema>;
|
|
600
609
|
declare const ToolAfterInputSchema: z$1.ZodObject<{
|
|
601
610
|
sessionID: z$1.ZodString;
|
|
611
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
602
612
|
tool: z$1.ZodString;
|
|
603
613
|
callID: z$1.ZodString;
|
|
604
614
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -878,6 +888,82 @@ declare const ScheduledTaskCompleteInputSchema: z$1.ZodObject<{
|
|
|
878
888
|
error: z$1.ZodOptional<z$1.ZodString>;
|
|
879
889
|
}, z$1.core.$strip>;
|
|
880
890
|
type ScheduledTaskCompleteInput = z$1.infer<typeof ScheduledTaskCompleteInputSchema>;
|
|
891
|
+
declare const TaskSourceSchema: z$1.ZodEnum<{
|
|
892
|
+
api: "api";
|
|
893
|
+
tool: "tool";
|
|
894
|
+
scheduler: "scheduler";
|
|
895
|
+
cli: "cli";
|
|
896
|
+
}>;
|
|
897
|
+
type TaskSource = z$1.infer<typeof TaskSourceSchema>;
|
|
898
|
+
declare const TaskStartInputSchema: z$1.ZodObject<{
|
|
899
|
+
taskId: z$1.ZodString;
|
|
900
|
+
sessionId: z$1.ZodString;
|
|
901
|
+
source: z$1.ZodEnum<{
|
|
902
|
+
api: "api";
|
|
903
|
+
tool: "tool";
|
|
904
|
+
scheduler: "scheduler";
|
|
905
|
+
cli: "cli";
|
|
906
|
+
}>;
|
|
907
|
+
agentType: z$1.ZodString;
|
|
908
|
+
description: z$1.ZodString;
|
|
909
|
+
prompt: z$1.ZodString;
|
|
910
|
+
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
911
|
+
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
912
|
+
}, z$1.core.$strip>;
|
|
913
|
+
type TaskStartInput = z$1.infer<typeof TaskStartInputSchema>;
|
|
914
|
+
declare const TaskProgressInputSchema: z$1.ZodObject<{
|
|
915
|
+
taskId: z$1.ZodString;
|
|
916
|
+
sessionId: z$1.ZodString;
|
|
917
|
+
source: z$1.ZodEnum<{
|
|
918
|
+
api: "api";
|
|
919
|
+
tool: "tool";
|
|
920
|
+
scheduler: "scheduler";
|
|
921
|
+
cli: "cli";
|
|
922
|
+
}>;
|
|
923
|
+
step: z$1.ZodNumber;
|
|
924
|
+
totalSteps: z$1.ZodOptional<z$1.ZodNumber>;
|
|
925
|
+
output: z$1.ZodString;
|
|
926
|
+
timestamp: z$1.ZodNumber;
|
|
927
|
+
}, z$1.core.$strip>;
|
|
928
|
+
type TaskProgressInput = z$1.infer<typeof TaskProgressInputSchema>;
|
|
929
|
+
declare const TaskCompleteInputSchema: z$1.ZodObject<{
|
|
930
|
+
taskId: z$1.ZodString;
|
|
931
|
+
sessionId: z$1.ZodString;
|
|
932
|
+
source: z$1.ZodEnum<{
|
|
933
|
+
api: "api";
|
|
934
|
+
tool: "tool";
|
|
935
|
+
scheduler: "scheduler";
|
|
936
|
+
cli: "cli";
|
|
937
|
+
}>;
|
|
938
|
+
result: z$1.ZodString;
|
|
939
|
+
duration: z$1.ZodNumber;
|
|
940
|
+
attachments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
941
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
942
|
+
agentType: z$1.ZodOptional<z$1.ZodString>;
|
|
943
|
+
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
944
|
+
}, z$1.core.$strip>;
|
|
945
|
+
type TaskCompleteInput = z$1.infer<typeof TaskCompleteInputSchema>;
|
|
946
|
+
declare const LoopStartInputSchema: z$1.ZodObject<{
|
|
947
|
+
sessionID: z$1.ZodString;
|
|
948
|
+
step: z$1.ZodNumber;
|
|
949
|
+
lastUserId: z$1.ZodString;
|
|
950
|
+
result: z$1.ZodOptional<z$1.ZodEnum<{
|
|
951
|
+
stop: "stop";
|
|
952
|
+
start: "start";
|
|
953
|
+
continue: "continue";
|
|
954
|
+
}>>;
|
|
955
|
+
}, z$1.core.$strip>;
|
|
956
|
+
type LoopStartInput = z$1.infer<typeof LoopStartInputSchema>;
|
|
957
|
+
declare const LoopEndInputSchema: z$1.ZodObject<{
|
|
958
|
+
sessionID: z$1.ZodString;
|
|
959
|
+
step: z$1.ZodNumber;
|
|
960
|
+
lastUserId: z$1.ZodString;
|
|
961
|
+
result: z$1.ZodEnum<{
|
|
962
|
+
stop: "stop";
|
|
963
|
+
continue: "continue";
|
|
964
|
+
}>;
|
|
965
|
+
}, z$1.core.$strip>;
|
|
966
|
+
type LoopEndInput = z$1.infer<typeof LoopEndInputSchema>;
|
|
881
967
|
declare const EventInputSchemas: {
|
|
882
968
|
readonly "session.start": z$1.ZodObject<{
|
|
883
969
|
sessionID: z$1.ZodString;
|
|
@@ -922,12 +1008,14 @@ declare const EventInputSchemas: {
|
|
|
922
1008
|
readonly "step.start": z$1.ZodObject<{
|
|
923
1009
|
sessionID: z$1.ZodString;
|
|
924
1010
|
messageID: z$1.ZodString;
|
|
1011
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
925
1012
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
926
1013
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
927
1014
|
}, z$1.core.$strip>;
|
|
928
1015
|
readonly "step.finish": z$1.ZodObject<{
|
|
929
1016
|
sessionID: z$1.ZodString;
|
|
930
1017
|
messageID: z$1.ZodString;
|
|
1018
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
931
1019
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
932
1020
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
933
1021
|
finishReason: z$1.ZodEnum<{
|
|
@@ -1027,12 +1115,14 @@ declare const EventInputSchemas: {
|
|
|
1027
1115
|
}, z$1.core.$strip>;
|
|
1028
1116
|
readonly "tool.before": z$1.ZodObject<{
|
|
1029
1117
|
sessionID: z$1.ZodString;
|
|
1118
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1030
1119
|
tool: z$1.ZodString;
|
|
1031
1120
|
callID: z$1.ZodString;
|
|
1032
1121
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1033
1122
|
}, z$1.core.$strip>;
|
|
1034
1123
|
readonly "tool.after": z$1.ZodObject<{
|
|
1035
1124
|
sessionID: z$1.ZodString;
|
|
1125
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1036
1126
|
tool: z$1.ZodString;
|
|
1037
1127
|
callID: z$1.ZodString;
|
|
1038
1128
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -1256,6 +1346,70 @@ declare const EventInputSchemas: {
|
|
|
1256
1346
|
result: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1257
1347
|
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1258
1348
|
}, z$1.core.$strip>;
|
|
1349
|
+
readonly "task.start": z$1.ZodObject<{
|
|
1350
|
+
taskId: z$1.ZodString;
|
|
1351
|
+
sessionId: z$1.ZodString;
|
|
1352
|
+
source: z$1.ZodEnum<{
|
|
1353
|
+
api: "api";
|
|
1354
|
+
tool: "tool";
|
|
1355
|
+
scheduler: "scheduler";
|
|
1356
|
+
cli: "cli";
|
|
1357
|
+
}>;
|
|
1358
|
+
agentType: z$1.ZodString;
|
|
1359
|
+
description: z$1.ZodString;
|
|
1360
|
+
prompt: z$1.ZodString;
|
|
1361
|
+
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
1362
|
+
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1363
|
+
}, z$1.core.$strip>;
|
|
1364
|
+
readonly "task.progress": z$1.ZodObject<{
|
|
1365
|
+
taskId: z$1.ZodString;
|
|
1366
|
+
sessionId: z$1.ZodString;
|
|
1367
|
+
source: z$1.ZodEnum<{
|
|
1368
|
+
api: "api";
|
|
1369
|
+
tool: "tool";
|
|
1370
|
+
scheduler: "scheduler";
|
|
1371
|
+
cli: "cli";
|
|
1372
|
+
}>;
|
|
1373
|
+
step: z$1.ZodNumber;
|
|
1374
|
+
totalSteps: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1375
|
+
output: z$1.ZodString;
|
|
1376
|
+
timestamp: z$1.ZodNumber;
|
|
1377
|
+
}, z$1.core.$strip>;
|
|
1378
|
+
readonly "task.complete": z$1.ZodObject<{
|
|
1379
|
+
taskId: z$1.ZodString;
|
|
1380
|
+
sessionId: z$1.ZodString;
|
|
1381
|
+
source: z$1.ZodEnum<{
|
|
1382
|
+
api: "api";
|
|
1383
|
+
tool: "tool";
|
|
1384
|
+
scheduler: "scheduler";
|
|
1385
|
+
cli: "cli";
|
|
1386
|
+
}>;
|
|
1387
|
+
result: z$1.ZodString;
|
|
1388
|
+
duration: z$1.ZodNumber;
|
|
1389
|
+
attachments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
1390
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1391
|
+
agentType: z$1.ZodOptional<z$1.ZodString>;
|
|
1392
|
+
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1393
|
+
}, z$1.core.$strip>;
|
|
1394
|
+
readonly "loop.start": z$1.ZodObject<{
|
|
1395
|
+
sessionID: z$1.ZodString;
|
|
1396
|
+
step: z$1.ZodNumber;
|
|
1397
|
+
lastUserId: z$1.ZodString;
|
|
1398
|
+
result: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1399
|
+
stop: "stop";
|
|
1400
|
+
start: "start";
|
|
1401
|
+
continue: "continue";
|
|
1402
|
+
}>>;
|
|
1403
|
+
}, z$1.core.$strip>;
|
|
1404
|
+
readonly "loop.end": z$1.ZodObject<{
|
|
1405
|
+
sessionID: z$1.ZodString;
|
|
1406
|
+
step: z$1.ZodNumber;
|
|
1407
|
+
lastUserId: z$1.ZodString;
|
|
1408
|
+
result: z$1.ZodEnum<{
|
|
1409
|
+
stop: "stop";
|
|
1410
|
+
continue: "continue";
|
|
1411
|
+
}>;
|
|
1412
|
+
}, z$1.core.$strip>;
|
|
1259
1413
|
};
|
|
1260
1414
|
declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
1261
1415
|
sessionID: z$1.ZodString;
|
|
@@ -1301,11 +1455,13 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1301
1455
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1302
1456
|
sessionID: z$1.ZodString;
|
|
1303
1457
|
messageID: z$1.ZodString;
|
|
1458
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1304
1459
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
1305
1460
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
1306
1461
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1307
1462
|
sessionID: z$1.ZodString;
|
|
1308
1463
|
messageID: z$1.ZodString;
|
|
1464
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1309
1465
|
model: z$1.ZodOptional<z$1.ZodString>;
|
|
1310
1466
|
agent: z$1.ZodOptional<z$1.ZodString>;
|
|
1311
1467
|
finishReason: z$1.ZodEnum<{
|
|
@@ -1399,11 +1555,13 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1399
1555
|
system: z$1.ZodArray<z$1.ZodString>;
|
|
1400
1556
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1401
1557
|
sessionID: z$1.ZodString;
|
|
1558
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1402
1559
|
tool: z$1.ZodString;
|
|
1403
1560
|
callID: z$1.ZodString;
|
|
1404
1561
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1405
1562
|
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1406
1563
|
sessionID: z$1.ZodString;
|
|
1564
|
+
userMessageID: z$1.ZodOptional<z$1.ZodString>;
|
|
1407
1565
|
tool: z$1.ZodString;
|
|
1408
1566
|
callID: z$1.ZodString;
|
|
1409
1567
|
args: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -1601,6 +1759,65 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
|
|
|
1601
1759
|
system: z$1.ZodArray<z$1.ZodString>;
|
|
1602
1760
|
metadata: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1603
1761
|
}, z$1.core.$strip>;
|
|
1762
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1763
|
+
taskId: z$1.ZodString;
|
|
1764
|
+
sessionId: z$1.ZodString;
|
|
1765
|
+
source: z$1.ZodEnum<{
|
|
1766
|
+
api: "api";
|
|
1767
|
+
tool: "tool";
|
|
1768
|
+
scheduler: "scheduler";
|
|
1769
|
+
cli: "cli";
|
|
1770
|
+
}>;
|
|
1771
|
+
agentType: z$1.ZodString;
|
|
1772
|
+
description: z$1.ZodString;
|
|
1773
|
+
prompt: z$1.ZodString;
|
|
1774
|
+
parentSessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
1775
|
+
timeout: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1776
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1777
|
+
taskId: z$1.ZodString;
|
|
1778
|
+
sessionId: z$1.ZodString;
|
|
1779
|
+
source: z$1.ZodEnum<{
|
|
1780
|
+
api: "api";
|
|
1781
|
+
tool: "tool";
|
|
1782
|
+
scheduler: "scheduler";
|
|
1783
|
+
cli: "cli";
|
|
1784
|
+
}>;
|
|
1785
|
+
step: z$1.ZodNumber;
|
|
1786
|
+
totalSteps: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1787
|
+
output: z$1.ZodString;
|
|
1788
|
+
timestamp: z$1.ZodNumber;
|
|
1789
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1790
|
+
taskId: z$1.ZodString;
|
|
1791
|
+
sessionId: z$1.ZodString;
|
|
1792
|
+
source: z$1.ZodEnum<{
|
|
1793
|
+
api: "api";
|
|
1794
|
+
tool: "tool";
|
|
1795
|
+
scheduler: "scheduler";
|
|
1796
|
+
cli: "cli";
|
|
1797
|
+
}>;
|
|
1798
|
+
result: z$1.ZodString;
|
|
1799
|
+
duration: z$1.ZodNumber;
|
|
1800
|
+
attachments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
1801
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
1802
|
+
agentType: z$1.ZodOptional<z$1.ZodString>;
|
|
1803
|
+
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1804
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1805
|
+
sessionID: z$1.ZodString;
|
|
1806
|
+
step: z$1.ZodNumber;
|
|
1807
|
+
lastUserId: z$1.ZodString;
|
|
1808
|
+
result: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1809
|
+
stop: "stop";
|
|
1810
|
+
start: "start";
|
|
1811
|
+
continue: "continue";
|
|
1812
|
+
}>>;
|
|
1813
|
+
}, z$1.core.$strip> | z$1.ZodObject<{
|
|
1814
|
+
sessionID: z$1.ZodString;
|
|
1815
|
+
step: z$1.ZodNumber;
|
|
1816
|
+
lastUserId: z$1.ZodString;
|
|
1817
|
+
result: z$1.ZodEnum<{
|
|
1818
|
+
stop: "stop";
|
|
1819
|
+
continue: "continue";
|
|
1820
|
+
}>;
|
|
1604
1821
|
}, z$1.core.$strip>;
|
|
1605
1822
|
declare function validateHookInput<T extends HookEvent>(event: T, input: unknown): unknown;
|
|
1606
1823
|
declare function safeValidateHookInput<T extends HookEvent>(event: T, input: unknown): {
|
|
@@ -1711,6 +1928,7 @@ interface CommandDefinition extends Command {
|
|
|
1711
1928
|
model?: string;
|
|
1712
1929
|
subtask?: boolean;
|
|
1713
1930
|
hidden?: boolean;
|
|
1931
|
+
scope?: 'general' | 'coder' | 'all';
|
|
1714
1932
|
execute: (args: CommandArguments, context: CommandExecutionContext) => Promise<CommandExecuteResult>;
|
|
1715
1933
|
isEnabled?: () => boolean | Promise<boolean>;
|
|
1716
1934
|
init?: (context?: CommandInitContext) => Promise<CommandInitResult>;
|
|
@@ -1860,4 +2078,4 @@ interface PluginDefinition {
|
|
|
1860
2078
|
'context.build.after'?: (input: ContextBuildAfterInput, output: HookOutputWrapper<ContextBuildAfterInput>) => Promise<void>;
|
|
1861
2079
|
}
|
|
1862
2080
|
|
|
1863
|
-
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, 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 TextCompleteInput, TextCompleteInputSchema, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, safeValidateHookInput, tool, validateHookInput };
|
|
2081
|
+
export { AgentExecutorSchema, type AgentHookDefinition, AgentSchema, type AuthHook, type AuthOuathResult, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandArguments, CommandArgumentsSchema, type CommandBeforeInput, CommandBeforeInputSchema, type CommandDefinition, type CommandExecuteResult, type CommandExecuteResultMetadata, CommandExecuteResultMetadataSchema, CommandExecuteResultSchema, type CommandExecutionContext, CommandExecutionContextSchema, CommandExecutorSchema, type CommandHookDefinition, type CommandInitContext, CommandInitContextSchema, type CommandInitResult, CommandInitResultSchema, type CommandMetadata, CommandMetadataSchema, type CommandPromptPart, CommandPromptPartSchema, type CommandSource, CommandSourceSchema, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, CwdSchema, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, type HeartbeatTriggerInput, HeartbeatTriggerInputSchema, type HookChainResult, type HookContext, type HookDefinition, type HookError, HookEvent, type HookExecutionDetail, HookExecutorSchema, type HookHandler, type HookMatcher, HookMatcherSchema, type HookOutputWrapper, type HookResult, HookType, type HooksConfig, HooksConfigSchema, HttpExecutorSchema, type HttpHookDefinition, type LlmHeadersInput, LlmHeadersInputSchema, type LlmParamsInput, LlmParamsInputSchema, LlmParamsSchema, LlmProviderSchema, type LoopEndInput, LoopEndInputSchema, type LoopStartInput, LoopStartInputSchema, MessageIDSchema, type MessageReceiveInput, MessageReceiveInputSchema, MessageRoleSchema, MessageSchema, type MessageTransformInput, MessageTransformInputSchema, ModelObjectSchema, ModelSchema, type PermissionAskInput, PermissionAskInputSchema, type PermissionDeniedInput, PermissionDeniedInputSchema, PermissionLevelSchema, PermissionRequestSchema, type Plugin, type PluginDefinition, type PluginInput, PromptExecutorSchema, type PromptHookDefinition, type ScheduledTaskCompleteInput, ScheduledTaskCompleteInputSchema, type ScheduledTaskTriggerInput, ScheduledTaskTriggerInputSchema, type SessionCompactInput, SessionCompactInputSchema, type SessionCompactingInput, SessionCompactingInputSchema, type SessionEndInput, SessionEndInputSchema, SessionIDSchema, type SessionStartInput, SessionStartInputSchema, type ShellEnvInput, ShellEnvInputSchema, type StepFinishInput, StepFinishInputSchema, type StepStartInput, StepStartInputSchema, type StepStopFailureInput, StepStopFailureInputSchema, type StepStopInput, StepStopInputSchema, type SystemTransformInput, SystemTransformInputSchema, type TaskCompleteInput, TaskCompleteInputSchema, type TaskProgressInput, TaskProgressInputSchema, type TaskSource, TaskSourceSchema, type TaskStartInput, TaskStartInputSchema, type TextCompleteInput, TextCompleteInputSchema, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, safeValidateHookInput, tool, validateHookInput };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import k,{z as z$1}from'zod';export{buildToolArgs,createTool,toolSchema as schema}from'@easbot/types';import'@easbot/sdk';function C(r){return {description:r.description,args:r.args,execute:r.execute}}C.schema=k;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"},He=Object.values(o);var d=z$1.string().optional(),T=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()}),v=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())}),D=z$1.object({type:z$1.literal(p.Function),handler:z$1.function()}),E=z$1.discriminatedUnion("type",[T,v,P,H,D]),w=z$1.object({event:z$1.string(),matcher:z$1.string().optional(),hooks:z$1.array(E)}),je=z$1.record(z$1.string(),z$1.array(w)),n=z$1.string().min(1).describe("Session unique identifier"),s=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"),b=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"),M=z$1.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),j=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:M,duration:z$1.number().positive().optional().describe("Session duration in milliseconds")}),R=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")}),F=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")}),O=z$1.object({sessionID:n,messageID:s,model:l,agent:u}),W=z$1.object({sessionID:n,messageID:s,model:l,agent:u,finishReason:j,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")}),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")}),L=z$1.enum(["user","assistant","system","tool"]),I=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")})]),h=z$1.object({id:s,role:L,content:z$1.union([z$1.string(),z$1.array(I)]),name:z$1.string().optional().describe("Message sender name"),tool_call_id:c.optional().describe("Related tool call ID")}),_=z$1.object({sessionID:n,agent:u,model:l,messageID:s,message:z$1.object({id:s,role:z$1.literal("user"),content:z$1.union([z$1.string(),z$1.array(I)])}).describe("User message")}),q=z$1.object({sessionID:n,messages:z$1.array(h).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"),U=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")}),Z=z$1.object({sessionID:n,tool:z$1.string().describe("Tool name"),callID:c,args:g}),V=z$1.object({sessionID:n,tool:z$1.string(),callID:c,args:g,result:U,duration:z$1.number().nonnegative().optional().describe("Execution duration in milliseconds")}),$=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"])}),K=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")}),J=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")}),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())]).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")}),X=z$1.enum(["read","write","exec","admin"]),Y=z$1.object({tool:z$1.string().describe("Tool name requesting permission"),args:g.optional(),level:X.optional(),reason:z$1.string().optional().describe("Reason for permission request")}),ee=z$1.object({sessionID:n,request:Y}),te=z$1.object({sessionID:n,tool:z$1.string(),reason:z$1.string().optional()}),x=z$1.enum(["openai","anthropic","google","azure","custom"]),oe=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()}),ne=z$1.object({sessionID:n,agent:u,model:b,provider:x,params:oe.partial().optional()}),re=z$1.object({sessionID:n,agent:u,model:b,provider:x,headers:z$1.record(z$1.string(),z$1.string()).optional()}),se=z$1.object({cwd:S.describe("Working directory"),sessionID:n.optional(),callID:c.optional()}),ie=z$1.object({sessionID:n,messageID:s,partID:z$1.string().describe("Text part ID"),text:z$1.string().describe("Completed text")}),ae=z$1.object({sessionID:n,mode:z$1.enum(["agent","chat","query"]).describe("Build mode"),projectID:z$1.string().optional()}),pe=z$1.object({sessionID:n,context:z$1.object({messages:z$1.array(h),system:z$1.array(z$1.string()),metadata:z$1.record(z$1.string(),z$1.unknown())}).describe("Built context")}),ue=z$1.object({gatewayID:z$1.string().describe("Gateway ID"),messageID:s,message:z$1.unknown().describe("Received message")}),me=z$1.object({gatewayID:z$1.string(),messageID:s,message:z$1.unknown(),sessionID:n.optional()}),ce=z$1.object({gatewayID:z$1.string(),messageID:s,result:z$1.unknown().optional()}),le=z$1.object({gatewayID:z$1.string(),messageID:s,message:z$1.unknown(),target:z$1.string().optional().describe("Send target")}),de=z$1.object({sessionID:n.optional(),timestamp:z$1.number().describe("Heartbeat timestamp"),name:z$1.string().optional().describe("Heartbeat name")}),ge=z$1.object({sessionID:n.optional(),timestamp:z$1.number(),duration:z$1.number().nonnegative().optional()}),fe=z$1.object({taskID:z$1.string().describe("Task ID"),taskName:z$1.string().optional(),timestamp:z$1.number(),payload:z$1.record(z$1.string(),z$1.unknown()).optional()}),ye=z$1.object({taskID:z$1.string(),timestamp:z$1.number(),success:z$1.boolean(),result:z$1.record(z$1.string(),z$1.unknown()).optional(),error:z$1.string().optional()}),y={[o.SessionStart]:A,[o.SessionEnd]:z,[o.SessionCompacting]:R,[o.SessionCompact]:F,[o.StepStart]:O,[o.StepFinish]:W,[o.StepStop]:B,[o.StepStopFailure]:G,[o.MessageReceive]:_,[o.MessageTransform]:q,[o.SystemTransform]:N,[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]:fe,[o.ScheduledTaskComplete]:ye};function Ae(r){return y[r]}function ze(r,f){let m=y[r];if(!m)throw new Error(`No schema found for event: ${r}`);return m.parse(f)}function Re(r,f){let m=y[r];return m?m.safeParse(f):{success:false,error:new z$1.ZodError([{code:"custom",path:[],message:`No schema found for event: ${r}`}])}}var Ne=z$1.enum(["command","mcp","skill"]).describe("Command source"),be=z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments"),Se=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")})]),Ue=z$1.object({name:z$1.string().describe("Command name"),description:z$1.string().describe("Command description"),agent:z$1.string().optional().describe("Specified agent name"),model:z$1.string().optional().describe("Specified model"),hints:z$1.array(z$1.string()).optional().describe("Argument hints"),commandType:z$1.enum(["prompt","local"]).optional().describe("Command type"),hidden:z$1.boolean().optional().describe("Whether hidden")}),Ze=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:be.describe("Command arguments")}),Ie=z$1.record(z$1.string(),z$1.unknown()).describe("Result metadata"),Ve=z$1.object({title:z$1.string().describe("Result title"),metadata:Ie.describe("Result metadata"),output:z$1.string().describe("Result output"),parts:z$1.array(Se).optional().describe("Result parts"),success:z$1.boolean().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}),$e=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")}),Ke=z$1.object({isEnabled:z$1.boolean().optional().describe("Is enabled check result")});export{H as AgentExecutorSchema,u as AgentSchema,c as CallIDSchema,Q as CommandAfterInputSchema,be as CommandArgumentsSchema,J as CommandBeforeInputSchema,Ie as CommandExecuteResultMetadataSchema,Ve as CommandExecuteResultSchema,Ze as CommandExecutionContextSchema,T as CommandExecutorSchema,$e as CommandInitContextSchema,Ke as CommandInitResultSchema,Ue as CommandMetadataSchema,Se as CommandPromptPartSchema,Ne as CommandSourceSchema,I as ContentPartSchema,pe as ContextBuildAfterInputSchema,ae as ContextBuildBeforeInputSchema,S as CwdSchema,M as EndReasonSchema,y as EventInputSchemas,j as FinishReasonSchema,D as FunctionExecutorSchema,ce as GatewayMessageCompleteInputSchema,me as GatewayMessageProcessInputSchema,ue as GatewayMessageReceiveInputSchema,le as GatewayMessageSendInputSchema,He as HOOK_EVENTS,ge as HeartbeatCompleteInputSchema,de as HeartbeatTriggerInputSchema,o as HookEvent,E as HookExecutorSchema,w as HookMatcherSchema,p as HookType,je as HooksConfigSchema,P as HttpExecutorSchema,re as LlmHeadersInputSchema,ne as LlmParamsInputSchema,oe as LlmParamsSchema,x as LlmProviderSchema,s as MessageIDSchema,_ as MessageReceiveInputSchema,L as MessageRoleSchema,h as MessageSchema,q as MessageTransformInputSchema,b as ModelObjectSchema,l as ModelSchema,ee as PermissionAskInputSchema,te as PermissionDeniedInputSchema,X as PermissionLevelSchema,Y as PermissionRequestSchema,v as PromptExecutorSchema,ye as ScheduledTaskCompleteInputSchema,fe as ScheduledTaskTriggerInputSchema,F as SessionCompactInputSchema,R as SessionCompactingInputSchema,z as SessionEndInputSchema,n as SessionIDSchema,A as SessionStartInputSchema,se as ShellEnvInputSchema,W as StepFinishInputSchema,O as StepStartInputSchema,G as StepStopFailureInputSchema,B as StepStopInputSchema,N as SystemTransformInputSchema,ie as TextCompleteInputSchema,V as ToolAfterInputSchema,g as ToolArgsSchema,Z as ToolBeforeInputSchema,K as ToolDefinitionInputSchema,$ as ToolFailureInputSchema,U as ToolResultSchema,Ae as getEventInputSchema,Re as safeValidateHookInput,C as tool,ze as validateHookInput};
|
|
1
|
+
import T,{z as z$1}from'zod';export{buildToolArgs,createTool,toolSchema as schema}from'@easbot/types';import'@easbot/sdk';function C(s){return {description:s.description,args:s.args,execute:s.execute}}C.schema=T;var p={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},o={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",StepStart:"step.start",StepFinish:"step.finish",StepStop:"step.stop",StepStopFailure:"step.stop.failure",MessageReceive:"message.receive",MessageTransform:"message.transform",SystemTransform:"system.transform",ToolBefore:"tool.before",ToolAfter:"tool.after",ToolFailure:"tool.failure",ToolDefinition:"tool.definition",CommandBefore:"command.before",CommandAfter:"command.after",PermissionAsk:"permission.ask",PermissionDenied:"permission.denied",LlmParams:"llm.params",LlmHeaders:"llm.headers",ShellEnv:"shell.env",TextComplete:"text.complete",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end"},Ae=Object.values(o);var d=z$1.string().optional(),v=z$1.object({type:z$1.literal(p.Command),command:z$1.string(),if:d,shell:z$1.enum(["bash","powershell"]).optional(),timeout:z$1.number().positive().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),async:z$1.boolean().optional()}),P=z$1.object({type:z$1.literal(p.Prompt),if:d,timeout:z$1.number().positive().optional(),model:z$1.string().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),runMode:z$1.enum(["session","fork"]).optional(),system:z$1.string().optional(),parts:z$1.array(z$1.unknown())}),D=z$1.object({type:z$1.literal(p.Http),url:z$1.string(),if:d,timeout:z$1.number().positive().optional(),method:z$1.enum(["GET","POST","PUT","DELETE"]).optional(),headers:z$1.record(z$1.string(),z$1.string()).optional(),allowedEnvVars:z$1.array(z$1.string()).optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional()}),H=z$1.object({type:z$1.literal(p.Agent),if:d,timeout:z$1.number().positive().optional(),model:z$1.string().optional(),statusMessage:z$1.string().optional(),once:z$1.boolean().optional(),system:z$1.string().optional(),parts:z$1.array(z$1.unknown())}),E=z$1.object({type:z$1.literal(p.Function),handler:z$1.function()}),w=z$1.discriminatedUnion("type",[v,P,D,H,E]),M=z$1.object({event:z$1.string(),matcher:z$1.string().optional(),hooks:z$1.array(w)}),We=z$1.record(z$1.string(),z$1.array(M)),n=z$1.string().min(1).describe("Session unique identifier"),r=z$1.string().min(1).describe("Message unique identifier"),c=z$1.string().min(1).describe("Tool call unique identifier"),u=z$1.string().optional().describe("Agent name"),l=z$1.string().optional().describe("Model identifier"),I=z$1.object({providerID:z$1.string().describe("Provider ID"),modelID:z$1.string().describe("Model ID"),api:z$1.object({id:z$1.string().describe("API ID"),npm:z$1.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),S=z$1.string().optional().describe("Working directory path"),j=z$1.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),A=z$1.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),z=z$1.object({sessionID:n,source:z$1.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:l,agent:u,cwd:S}),R=z$1.object({sessionID:n,reason:j,duration:z$1.number().positive().optional().describe("Session duration in milliseconds")}),F=z$1.object({sessionID:n,trigger:z$1.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:z$1.number().positive().describe("Current context length"),threshold:z$1.number().positive().describe("Trigger threshold")}),O=z$1.object({sessionID:n,summary:z$1.string().describe("Compaction summary"),previousLength:z$1.number().positive().describe("Previous context length"),newLength:z$1.number().positive().describe("New context length")}),W=z$1.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:l,agent:u}),B=z$1.object({sessionID:n,messageID:r,userMessageID:r.optional().describe("User message ID for the current step"),model:l,agent:u,finishReason:A,tokens:z$1.object({input:z$1.number().int().nonnegative().optional(),output:z$1.number().int().nonnegative().optional(),total:z$1.number().int().nonnegative().optional()}).optional().describe("Token usage statistics")}),L=z$1.object({sessionID:n,reason:z$1.string().describe("Stop reason")}),G=z$1.object({sessionID:n,error:z$1.string().describe("Error message"),errorType:z$1.enum(["rate_limit","auth_error","network_error","timeout","invalid_request","server_error"]).describe("Error type")}),_=z$1.enum(["user","assistant","system","tool"]),h=z$1.discriminatedUnion("type",[z$1.object({type:z$1.literal("text"),text:z$1.string().describe("Text content")}),z$1.object({type:z$1.literal("image"),source:z$1.object({type:z$1.enum(["base64","url"]),mime:z$1.string().optional().describe("File mime type"),data:z$1.string().describe("File base64 encoding data or url")})}),z$1.object({type:z$1.literal("file"),url:z$1.string().describe("File path"),filename:z$1.string().describe("File name"),mime:z$1.string().optional().describe("File mime type")})]),x=z$1.object({id:r,role:_,content:z$1.union([z$1.string(),z$1.array(h)]),name:z$1.string().optional().describe("Message sender name"),tool_call_id:c.optional().describe("Related tool call ID")}),q=z$1.object({sessionID:n,agent:u,model:l,messageID:r,message:z$1.object({id:r,role:z$1.literal("user"),content:z$1.union([z$1.string(),z$1.array(h)])}).describe("User message")}),U=z$1.object({sessionID:n,messages:z$1.array(x).describe("Messages to transform")}),N=z$1.object({sessionID:n,model:l,system:z$1.array(z$1.string()).describe("Current system prompt")}),g=z$1.record(z$1.string(),z$1.unknown()).describe("Tool call arguments"),Z=z$1.object({title:z$1.string().optional().describe("Result title"),content:z$1.string().describe("Result content"),is_error:z$1.boolean().optional().describe("Is error result"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Extra metadata")}),V=z$1.object({sessionID:n,userMessageID:r.optional().describe("User message ID for the current step"),tool:z$1.string().describe("Tool name"),callID:c,args:g}),$=z$1.object({sessionID:n,userMessageID:r.optional().describe("User message ID for the current step"),tool:z$1.string(),callID:c,args:g,result:Z,duration:z$1.number().nonnegative().optional().describe("Execution duration in milliseconds")}),K=z$1.object({sessionID:n,tool:z$1.string(),callID:c,args:g,error:z$1.string().describe("Error message"),errorType:z$1.enum(["timeout","invalid_args","execution_error","permission_denied"])}),J=z$1.object({sessionID:n,toolID:z$1.string().describe("Tool ID"),definition:z$1.object({name:z$1.string(),description:z$1.string().optional(),parameters:z$1.record(z$1.string(),z$1.unknown()).optional()}).describe("Tool definition")}),Q=z$1.object({sessionID:n,command:z$1.string().describe("Command name"),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments")}),X=z$1.object({sessionID:n,command:z$1.string().describe("Command name"),arguments:z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).optional(),result:z$1.object({info:z$1.unknown().optional().describe("Message info"),parts:z$1.array(z$1.unknown()).optional().describe("Message parts"),title:z$1.string().optional().describe("Result title"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Result metadata"),output:z$1.string().optional().describe("Result output"),success:z$1.boolean().optional().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}).describe("Command execution result")}),Y=z$1.enum(["read","write","exec","admin"]),ee=z$1.object({tool:z$1.string().describe("Tool name requesting permission"),args:g.optional(),level:Y.optional(),reason:z$1.string().optional().describe("Reason for permission request")}),te=z$1.object({sessionID:n,request:ee}),oe=z$1.object({sessionID:n,tool:z$1.string(),reason:z$1.string().optional()}),k=z$1.enum(["openai","anthropic","google","azure","custom"]),ne=z$1.object({temperature:z$1.number().min(0).max(2).optional(),topP:z$1.number().min(0).max(1).optional(),topK:z$1.number().int().positive().optional(),maxTokens:z$1.number().int().positive().optional(),stopSequences:z$1.array(z$1.string()).optional(),responseFormat:z$1.enum(["text","json_object"]).optional()}),re=z$1.object({sessionID:n,agent:u,model:I,provider:k,params:ne.partial().optional()}),se=z$1.object({sessionID:n,agent:u,model:I,provider:k,headers:z$1.record(z$1.string(),z$1.string()).optional()}),ie=z$1.object({cwd:S.describe("Working directory"),sessionID:n.optional(),callID:c.optional()}),ae=z$1.object({sessionID:n,messageID:r,partID:z$1.string().describe("Text part ID"),text:z$1.string().describe("Completed text")}),pe=z$1.object({sessionID:n,mode:z$1.enum(["agent","chat","query"]).describe("Build mode"),projectID:z$1.string().optional()}),ue=z$1.object({sessionID:n,context:z$1.object({messages:z$1.array(x),system:z$1.array(z$1.string()),metadata:z$1.record(z$1.string(),z$1.unknown())}).describe("Built context")}),me=z$1.object({gatewayID:z$1.string().describe("Gateway ID"),messageID:r,message:z$1.unknown().describe("Received message")}),ce=z$1.object({gatewayID:z$1.string(),messageID:r,message:z$1.unknown(),sessionID:n.optional()}),le=z$1.object({gatewayID:z$1.string(),messageID:r,result:z$1.unknown().optional()}),de=z$1.object({gatewayID:z$1.string(),messageID:r,message:z$1.unknown(),target:z$1.string().optional().describe("Send target")}),ge=z$1.object({sessionID:n.optional(),timestamp:z$1.number().describe("Heartbeat timestamp"),name:z$1.string().optional().describe("Heartbeat name")}),be=z$1.object({sessionID:n.optional(),timestamp:z$1.number(),duration:z$1.number().nonnegative().optional()}),fe=z$1.object({taskID:z$1.string().describe("Task ID"),taskName:z$1.string().optional(),timestamp:z$1.number(),payload:z$1.record(z$1.string(),z$1.unknown()).optional()}),ye=z$1.object({taskID:z$1.string(),timestamp:z$1.number(),success:z$1.boolean(),result:z$1.record(z$1.string(),z$1.unknown()).optional(),error:z$1.string().optional()}),f=z$1.enum(["tool","scheduler","cli","api"]),Ie=z$1.object({taskId:z$1.string().describe("Task unique identifier"),sessionId:z$1.string().describe("Session ID for this task"),source:f.describe("Task source: tool, scheduler, cli, api"),agentType:z$1.string().describe("Agent type to execute this task"),description:z$1.string().describe("Task description"),prompt:z$1.string().describe("Task prompt content"),parentSessionId:z$1.string().optional().describe("Parent session ID if this is a subtask"),timeout:z$1.number().positive().optional().describe("Task timeout in milliseconds")}),Se=z$1.object({taskId:z$1.string(),sessionId:z$1.string(),source:f,step:z$1.number().describe("Current step number"),totalSteps:z$1.number().optional().describe("Total number of steps"),output:z$1.string().describe("Progress output content"),timestamp:z$1.number().describe("Progress timestamp")}),he=z$1.object({taskId:z$1.string(),sessionId:z$1.string(),source:f,result:z$1.string().describe("Task result content"),duration:z$1.number().nonnegative().describe("Task duration in milliseconds"),attachments:z$1.array(z$1.unknown()).optional().describe("Task result attachments"),error:z$1.string().optional().describe("Error message if task failed"),agentType:z$1.string().optional().describe("Agent type that executed the task"),metadata:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Additional metadata for the task result")}),xe=z$1.object({sessionID:z$1.string().describe("Session ID"),step:z$1.number().describe("Current step number"),lastUserId:z$1.string().describe("Last user message ID"),result:z$1.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),ke=z$1.object({sessionID:z$1.string().describe("Session ID"),step:z$1.number().describe("Current step number"),lastUserId:z$1.string().describe("Last user message ID"),result:z$1.enum(["stop","continue"]).describe("Loop result: stop or continue")}),y={[o.SessionStart]:z,[o.SessionEnd]:R,[o.SessionCompacting]:F,[o.SessionCompact]:O,[o.StepStart]:W,[o.StepFinish]:B,[o.StepStop]:L,[o.StepStopFailure]:G,[o.MessageReceive]:q,[o.MessageTransform]:U,[o.SystemTransform]:N,[o.ToolBefore]:V,[o.ToolAfter]:$,[o.ToolFailure]:K,[o.ToolDefinition]:J,[o.CommandBefore]:Q,[o.CommandAfter]:X,[o.PermissionAsk]:te,[o.PermissionDenied]:oe,[o.LlmParams]:re,[o.LlmHeaders]:se,[o.ShellEnv]:ie,[o.TextComplete]:ae,[o.ContextBuildBefore]:pe,[o.ContextBuildAfter]:ue,[o.GatewayMessageReceive]:me,[o.GatewayMessageProcess]:ce,[o.GatewayMessageComplete]:le,[o.GatewayMessageSend]:de,[o.HeartbeatTrigger]:ge,[o.HeartbeatComplete]:be,[o.ScheduledTaskTrigger]:fe,[o.ScheduledTaskComplete]:ye,[o.TaskStart]:Ie,[o.TaskProgress]:Se,[o.TaskComplete]:he,[o.LoopStart]:xe,[o.LoopEnd]:ke};function Be(s){return y[s]}function Le(s,b){let m=y[s];if(!m)throw new Error(`No schema found for event: ${s}`);return m.parse(b)}function Ge(s,b){let m=y[s];return m?m.safeParse(b):{success:false,error:new z$1.ZodError([{code:"custom",path:[],message:`No schema found for event: ${s}`}])}}var Je=z$1.enum(["command","mcp","skill"]).describe("Command source"),Te=z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.unknown())]).describe("Command arguments"),Ce=z$1.discriminatedUnion("type",[z$1.object({type:z$1.literal("text"),text:z$1.string().describe("Text content")}),z$1.object({type:z$1.literal("image"),source:z$1.object({type:z$1.enum(["base64","url"]),mime:z$1.string().describe("File mime type"),data:z$1.string().describe("File base64 encoding data or url")})}),z$1.object({type:z$1.literal("file"),url:z$1.string().describe("File path"),filename:z$1.string().describe("File name"),mime:z$1.string().optional().describe("File mime type")})]),Qe=z$1.object({name:z$1.string().describe("Command name"),description:z$1.string().describe("Command description"),agent:z$1.string().optional().describe("Specified agent name"),model:z$1.string().optional().describe("Specified model"),hints:z$1.array(z$1.string()).optional().describe("Argument hints"),commandType:z$1.enum(["prompt","local"]).optional().describe("Command type"),hidden:z$1.boolean().optional().describe("Whether hidden")}),Xe=z$1.object({sessionID:z$1.string().describe("Session ID"),directory:z$1.string().describe("Working directory"),model:z$1.string().optional().describe("Model identifier"),agent:z$1.string().optional().describe("Agent name"),arguments:Te.describe("Command arguments")}),ve=z$1.record(z$1.string(),z$1.unknown()).describe("Result metadata"),Ye=z$1.object({title:z$1.string().describe("Result title"),metadata:ve.describe("Result metadata"),output:z$1.string().describe("Result output"),parts:z$1.array(Ce).optional().describe("Result parts"),success:z$1.boolean().describe("Whether execution succeeded"),error:z$1.string().optional().describe("Error message if failed")}),et=z$1.object({agent:z$1.object({name:z$1.string().describe("Agent name"),model:z$1.string().optional().describe("Agent model")}).optional().describe("Agent context")}),tt=z$1.object({isEnabled:z$1.boolean().optional().describe("Is enabled check result")});export{H as AgentExecutorSchema,u as AgentSchema,c as CallIDSchema,X as CommandAfterInputSchema,Te as CommandArgumentsSchema,Q as CommandBeforeInputSchema,ve as CommandExecuteResultMetadataSchema,Ye as CommandExecuteResultSchema,Xe as CommandExecutionContextSchema,v as CommandExecutorSchema,et as CommandInitContextSchema,tt as CommandInitResultSchema,Qe as CommandMetadataSchema,Ce as CommandPromptPartSchema,Je as CommandSourceSchema,h as ContentPartSchema,ue as ContextBuildAfterInputSchema,pe as ContextBuildBeforeInputSchema,S as CwdSchema,j as EndReasonSchema,y as EventInputSchemas,A as FinishReasonSchema,E as FunctionExecutorSchema,le as GatewayMessageCompleteInputSchema,ce as GatewayMessageProcessInputSchema,me as GatewayMessageReceiveInputSchema,de as GatewayMessageSendInputSchema,Ae as HOOK_EVENTS,be as HeartbeatCompleteInputSchema,ge as HeartbeatTriggerInputSchema,o as HookEvent,w as HookExecutorSchema,M as HookMatcherSchema,p as HookType,We as HooksConfigSchema,D as HttpExecutorSchema,se as LlmHeadersInputSchema,re as LlmParamsInputSchema,ne as LlmParamsSchema,k as LlmProviderSchema,ke as LoopEndInputSchema,xe as LoopStartInputSchema,r as MessageIDSchema,q as MessageReceiveInputSchema,_ as MessageRoleSchema,x as MessageSchema,U as MessageTransformInputSchema,I as ModelObjectSchema,l as ModelSchema,te as PermissionAskInputSchema,oe as PermissionDeniedInputSchema,Y as PermissionLevelSchema,ee as PermissionRequestSchema,P as PromptExecutorSchema,ye as ScheduledTaskCompleteInputSchema,fe as ScheduledTaskTriggerInputSchema,O as SessionCompactInputSchema,F as SessionCompactingInputSchema,R as SessionEndInputSchema,n as SessionIDSchema,z as SessionStartInputSchema,ie as ShellEnvInputSchema,B as StepFinishInputSchema,W as StepStartInputSchema,G as StepStopFailureInputSchema,L as StepStopInputSchema,N as SystemTransformInputSchema,he as TaskCompleteInputSchema,Se as TaskProgressInputSchema,f as TaskSourceSchema,Ie as TaskStartInputSchema,ae as TextCompleteInputSchema,$ as ToolAfterInputSchema,g as ToolArgsSchema,V as ToolBeforeInputSchema,J as ToolDefinitionInputSchema,K as ToolFailureInputSchema,Z as ToolResultSchema,Be as getEventInputSchema,Ge as safeValidateHookInput,C as tool,Le as validateHookInput};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "EASBot Plugin for client applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -19,6 +19,23 @@
|
|
|
19
19
|
},
|
|
20
20
|
"./package.json": "./package.json"
|
|
21
21
|
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "tsup --watch --env.NODE_ENV development",
|
|
24
|
+
"build": "tsup --env.NODE_ENV production",
|
|
25
|
+
"test": "vitest",
|
|
26
|
+
"test:run": "vitest run",
|
|
27
|
+
"lint": "biome check .",
|
|
28
|
+
"lint:fix": "biome check --write .",
|
|
29
|
+
"lint:report": "biome check --reporter=summary .",
|
|
30
|
+
"format": "biome format .",
|
|
31
|
+
"format:fix": "biome format --write .",
|
|
32
|
+
"type-check": "tsc --noEmit",
|
|
33
|
+
"clean": "npx rimraf dist node_modules",
|
|
34
|
+
"prepare": "echo norun",
|
|
35
|
+
"prepublishOnly": "pnpm build",
|
|
36
|
+
"publish:npm": "bash scripts/publish.sh",
|
|
37
|
+
"publish:npm:win": "powershell -ExecutionPolicy Bypass -File scripts/publish.ps1"
|
|
38
|
+
},
|
|
22
39
|
"keywords": [
|
|
23
40
|
"easbot",
|
|
24
41
|
"plugin",
|
|
@@ -44,8 +61,8 @@
|
|
|
44
61
|
],
|
|
45
62
|
"dependencies": {
|
|
46
63
|
"zod": "^4.3.6",
|
|
47
|
-
"@easbot/sdk": "
|
|
48
|
-
"@easbot/types": "
|
|
64
|
+
"@easbot/sdk": "workspace:*",
|
|
65
|
+
"@easbot/types": "workspace:*"
|
|
49
66
|
},
|
|
50
67
|
"devDependencies": {
|
|
51
68
|
"@types/node": "^22.17.0",
|
|
@@ -59,20 +76,5 @@
|
|
|
59
76
|
},
|
|
60
77
|
"publishConfig": {
|
|
61
78
|
"access": "public"
|
|
62
|
-
},
|
|
63
|
-
"scripts": {
|
|
64
|
-
"dev": "tsup --watch --env.NODE_ENV development",
|
|
65
|
-
"build": "tsup --env.NODE_ENV production",
|
|
66
|
-
"test": "vitest",
|
|
67
|
-
"test:run": "vitest run",
|
|
68
|
-
"lint": "biome check .",
|
|
69
|
-
"lint:fix": "biome check --write .",
|
|
70
|
-
"lint:report": "biome check --reporter=summary .",
|
|
71
|
-
"format": "biome format .",
|
|
72
|
-
"format:fix": "biome format --write .",
|
|
73
|
-
"type-check": "tsc --noEmit",
|
|
74
|
-
"clean": "npx rimraf dist node_modules",
|
|
75
|
-
"publish:npm": "bash scripts/publish.sh",
|
|
76
|
-
"publish:npm:win": "powershell -ExecutionPolicy Bypass -File scripts/publish.ps1"
|
|
77
79
|
}
|
|
78
|
-
}
|
|
80
|
+
}
|