@easbot/plugin 0.3.32 → 0.3.37
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 +128 -60
- package/README.md +116 -47
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +193 -205
- package/dist/index.d.ts +193 -205
- package/dist/index.mjs +1 -1
- package/package.json +8 -8
package/README.en.md
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
# @easbot/plugin
|
|
4
4
|
|
|
5
|
-
EASBot Plugin System
|
|
5
|
+
EASBot Plugin System — type contracts, manifest validation, and extension point definitions
|
|
6
6
|
|
|
7
7
|
## Version
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
9
|
+
v0.3.37
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
12
|
+
- **Plugin contract**: `Plugin` / `PluginInput` / `PluginDefinition` (single source of truth for all extension points)
|
|
13
|
+
- **Hook contract**: `HookEvent` / `HOOK_EVENTS` / `HookMatcher` (with `priority` / `timeoutMs` / `failurePolicy`) / 5 executor schemas / event input validation
|
|
14
|
+
- **Auth contract**: `AuthHook` / `AuthMethod` / `AuthPrompt` / `AuthOAuthResult` (OAuth and API methods)
|
|
15
|
+
- **Command & tool contract**: re-exports `CommandDefinition` / `ToolDefinition` from `@easbot/types` plus the `createTool` factory
|
|
16
|
+
- **Manifest & validation**: `PluginManifestSchema` / `validatePluginManifest` / `validatePluginDefinition` (closed top-level fields, at least one capability, bidirectional `capabilities` check)
|
|
17
|
+
- **No marketplace**: the install-source catalog belongs to the `@easbot/agent` CLI layer; `PluginDefinition` does not declare this field
|
|
18
|
+
|
|
19
|
+
> ⚠️ This is a **contract-only package**: no HookRegistry implementation, no plugin loading, no capability registration. Loading and registration live in `@easbot/agent/src/plugin/plugin.ts`; see [`spec/plugin-standard.md`](../../spec/plugin-standard.md).
|
|
16
20
|
|
|
17
21
|
## Installation
|
|
18
22
|
|
|
@@ -22,29 +26,49 @@ pnpm add @easbot/plugin
|
|
|
22
26
|
|
|
23
27
|
## Quick Start
|
|
24
28
|
|
|
25
|
-
###
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
import { createHookRegistry, HOOK_EVENTS } from '@easbot/plugin';
|
|
29
|
+
### Plugin entry
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
const hooks = createHookRegistry();
|
|
31
|
+
A plugin entry MUST export one of `default` / `Plugin` / `plugin`, with the signature `Plugin = (input: PluginInput) => Promise<PluginDefinition>`.
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
```typescript
|
|
34
|
+
import { HookEvent, tool, type Plugin, type PluginDefinition } from '@easbot/plugin';
|
|
35
|
+
|
|
36
|
+
export const MyPlugin: Plugin = async (input): Promise<PluginDefinition> => ({
|
|
37
|
+
hooks: [
|
|
38
|
+
{
|
|
39
|
+
event: HookEvent.ToolBefore,
|
|
40
|
+
hooks: [
|
|
41
|
+
{
|
|
42
|
+
type: 'function',
|
|
43
|
+
handler: async (hookInput, context) => ({
|
|
44
|
+
modified: false,
|
|
45
|
+
input: hookInput,
|
|
46
|
+
output: { directory: input.directory },
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
tools: {
|
|
53
|
+
echo: tool({
|
|
54
|
+
description: 'Echo the input text',
|
|
55
|
+
args: { text: tool.schema.string() },
|
|
56
|
+
execute: async (args) => String(args.text ?? ''),
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
37
59
|
});
|
|
60
|
+
|
|
61
|
+
export default MyPlugin;
|
|
62
|
+
export { MyPlugin as Plugin };
|
|
38
63
|
```
|
|
39
64
|
|
|
40
|
-
### Command
|
|
65
|
+
### Command system
|
|
41
66
|
|
|
42
|
-
The **contract types** for commands (`CommandDefinition` / `CommandInfo` / `CommandArguments` / `CommandExecutionContext` / `CommandExecuteResult` …) have their **single source of truth in `@easbot/types`** (`native/command.ts`); this package only re-exports them
|
|
67
|
+
The **contract types** for commands (`CommandDefinition` / `CommandInfo` / `CommandArguments` / `CommandExecutionContext` / `CommandExecuteResult` …) have their **single source of truth in `@easbot/types`** (`native/command.ts`); this package only re-exports them.
|
|
43
68
|
|
|
44
69
|
```typescript
|
|
45
70
|
import type { CommandDefinition } from '@easbot/plugin';
|
|
46
71
|
|
|
47
|
-
// Declare commands inside PluginDefinition.commands (map shape, key = command id)
|
|
48
72
|
const myPlugin = async (): Promise<PluginDefinition> => ({
|
|
49
73
|
commands: {
|
|
50
74
|
hello: {
|
|
@@ -61,71 +85,115 @@ const myPlugin = async (): Promise<PluginDefinition> => ({
|
|
|
61
85
|
});
|
|
62
86
|
```
|
|
63
87
|
|
|
64
|
-
> ⚠️ The command **registry** (`register` / `
|
|
88
|
+
> ⚠️ The command **registry** (`register` / `list`) lives in `CommandRegistry` of `@easbot/agent`; this package only provides type declarations.
|
|
65
89
|
|
|
66
|
-
### Tool
|
|
90
|
+
### Tool system
|
|
91
|
+
|
|
92
|
+
The real signature of `createTool` / `tool()` is `{ description, args, execute }` — there are **no** `name` / `parameters` fields. `args` is a Zod schema map and `execute` returns `Promise<string>`.
|
|
67
93
|
|
|
68
94
|
```typescript
|
|
69
95
|
import { createTool } from '@easbot/plugin';
|
|
96
|
+
import { z } from 'zod';
|
|
70
97
|
|
|
71
98
|
const tool = createTool({
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
99
|
+
description: 'Uppercase the input text',
|
|
100
|
+
args: { input: z.string() },
|
|
101
|
+
execute: async ({ input }) => input.toUpperCase(),
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Manifest & Validation
|
|
106
|
+
|
|
107
|
+
Contract and executable checks for `plugin.json` (`spec/plugin-standard.md` §2.1 / §6):
|
|
108
|
+
|
|
109
|
+
| API | Description |
|
|
110
|
+
| ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| `PluginManifestSchema` / `PluginManifest` | Zod schema and type for `plugin.json` (`name` required) |
|
|
112
|
+
| `validatePluginManifest(input)` | Returns `{ ok: true; manifest }` or `{ ok: false; errors: string[] }` |
|
|
113
|
+
| `validatePluginDefinition(def, options?)` | Validates the `PluginDefinition` returned by an entry (MUST be called by the host loader); `options.capabilities` enables the bidirectional manifest check |
|
|
114
|
+
| `PLUGIN_CAPABILITIES` / `PLUGIN_DEFINITION_KEYS` | 8 capability types and the closed set of `PluginDefinition` top-level fields |
|
|
115
|
+
| `PLUGIN_HOOK_FAILURE_POLICIES` | `fail-open` / `fail-closed` |
|
|
116
|
+
| `isValidPluginId(id)` / `PLUGIN_ID_PATTERN` | Plugin id naming: `^[a-z0-9][a-z0-9._-]{1,63}$` |
|
|
117
|
+
| `isValidPluginEntry(entry)` / `PLUGIN_ENTRY_EXTENSIONS` | Entry path safety (`./` prefix, no `..`, only `.mjs/.js/.cjs`) |
|
|
118
|
+
| `PLUGIN_ENTRY_NAMES` | Entry export allowlist `default` / `Plugin` / `plugin` |
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { HookEvent, validatePluginManifest, validatePluginDefinition } from '@easbot/plugin';
|
|
122
|
+
|
|
123
|
+
const manifest = validatePluginManifest({
|
|
124
|
+
name: 'memory',
|
|
125
|
+
entry: './index.mjs',
|
|
126
|
+
capabilities: ['hooks', 'tools'],
|
|
80
127
|
});
|
|
128
|
+
if (!manifest.ok) throw new Error(manifest.errors.join('; '));
|
|
129
|
+
|
|
130
|
+
const definition = validatePluginDefinition(
|
|
131
|
+
{
|
|
132
|
+
hooks: [
|
|
133
|
+
{
|
|
134
|
+
event: HookEvent.SessionStart,
|
|
135
|
+
hooks: [{ type: 'function', handler: async (input) => ({ modified: false, input }) }],
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
tools: { memory: { description: 'Memory tool', args: {}, execute: async () => 'ok' } },
|
|
139
|
+
},
|
|
140
|
+
{ capabilities: manifest.manifest.capabilities },
|
|
141
|
+
);
|
|
81
142
|
```
|
|
82
143
|
|
|
144
|
+
> `PluginDefinition` is a closed set: it MUST declare at least one capability; `marketplace`, dotted inline hook keys and any unknown top-level field are rejected.
|
|
145
|
+
|
|
83
146
|
## API
|
|
84
147
|
|
|
85
|
-
###
|
|
148
|
+
### Hook contract
|
|
86
149
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
150
|
+
| Symbol | Description |
|
|
151
|
+
| --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
152
|
+
| `HookEvent` | Event constants (`domain.action.phase`, e.g. `HookEvent.SessionStart`) |
|
|
153
|
+
| `HOOK_EVENTS` | **Array** of event names (`Object.values(HookEvent)`), not an enum object |
|
|
154
|
+
| `HookMatcher` | `{ event, matcher?, hooks, priority?, timeoutMs?, failurePolicy? }`; `event` MUST be in `HOOK_EVENTS` |
|
|
155
|
+
| `HookDefinition` | Union of 5 executors: `command` / `prompt` / `http` / `agent` / `function` |
|
|
156
|
+
| `HookOutputWrapper` | `{ modified, input, output? }`; executors MUST return `{ success: false }` instead of throwing |
|
|
157
|
+
| `validateHookInput` / `safeValidateHookInput` / `getEventInputSchema` | Event input schema validation |
|
|
92
158
|
|
|
93
159
|
### Command types
|
|
94
160
|
|
|
95
|
-
|
|
161
|
+
See "Command system" above; single source of truth is `@easbot/types/native/command.ts`.
|
|
162
|
+
|
|
163
|
+
| Type | Description |
|
|
164
|
+
| ------------------------- | ------------------------------------------------------------ |
|
|
165
|
+
| `CommandDefinition` | Runtime command definition (`execute` required) |
|
|
166
|
+
| `CommandInfo` | Registry entry / HTTP response contract (`execute` optional) |
|
|
167
|
+
| `CommandConfigInfo` | Config-shape command template (value of `config.command`) |
|
|
168
|
+
| `CommandMetadata` | Markdown frontmatter declaration shape |
|
|
169
|
+
| `CommandArguments` | Command arguments (string / record) |
|
|
170
|
+
| `CommandExecutionContext` | Command execution context (sessionId / directory / …) |
|
|
171
|
+
| `CommandExecuteResult` | Command execution result |
|
|
96
172
|
|
|
97
|
-
|
|
98
|
-
| ------------------------- | -------------------------------------------------------------------- |
|
|
99
|
-
| `CommandDefinition` | Runtime command definition (`execute` required) |
|
|
100
|
-
| `CommandInfo` | Command registry entry / HTTP response contract (`execute` optional) |
|
|
101
|
-
| `CommandConfigInfo` | Config-shape command template (value of `config.command`) |
|
|
102
|
-
| `CommandMetadata` | Markdown frontmatter declaration shape |
|
|
103
|
-
| `CommandArguments` | Command arguments (string / record) |
|
|
104
|
-
| `CommandExecutionContext` | Command execution context (sessionId / directory / …) |
|
|
105
|
-
| `CommandExecuteResult` | Command execution result |
|
|
173
|
+
### createTool / tool
|
|
106
174
|
|
|
107
|
-
|
|
175
|
+
| Property | Type | Required | Description |
|
|
176
|
+
| ------------- | ------------------------------------ | ----------- | ----------------------------------------- |
|
|
177
|
+
| `description` | `string` | ✅ | Tool description |
|
|
178
|
+
| `args` | `Record<string, z.ZodTypeAny>` | ✅ | Zod schema map for arguments |
|
|
179
|
+
| `execute` | `(args, context) => Promise<string>` | ✅ required | Implementation; enforced by the validator |
|
|
108
180
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
181
|
+
### Marketplace (outside this contract)
|
|
182
|
+
|
|
183
|
+
`marketplace` is an **install-source catalog**, not a runtime plugin capability. `PluginDefinition` does not declare it, and this package no longer exports `MarketplaceEntry` / `MarketplaceDefinition` / `registerMarketplace()` registry APIs. The types live in `@easbot/agent/src/cli/plugin/type.ts`; metadata lives in `.easbot-plugin/marketplace.json`.
|
|
184
|
+
|
|
185
|
+
## Reference Implementation
|
|
186
|
+
|
|
187
|
+
- `packages/memory/src/plugin/` — first plugin built on this contract (4 hooks + 1 tool)
|
|
188
|
+
- `plugins/memory/` — plugin directory in the repository-root distribution area, installable via `easbot plugins install`
|
|
189
|
+
- `plugins/.easbot-plugin/marketplace.json` — the single repo-wide marketplace manifest (install source: `easbot plugins marketplace add ./plugins`)
|
|
115
190
|
|
|
116
191
|
## Development
|
|
117
192
|
|
|
118
193
|
```bash
|
|
119
|
-
# Install dependencies
|
|
120
194
|
pnpm install
|
|
121
|
-
|
|
122
|
-
# Build
|
|
123
195
|
pnpm build
|
|
124
|
-
|
|
125
|
-
# Test
|
|
126
|
-
pnpm test
|
|
127
|
-
|
|
128
|
-
# Type check
|
|
196
|
+
pnpm test:run # vitest run (manifest / definition / auth / hook closed-set contracts)
|
|
129
197
|
pnpm type-check
|
|
130
198
|
```
|
|
131
199
|
|
package/README.md
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
# @easbot/plugin
|
|
4
4
|
|
|
5
|
-
EASBot 插件系统
|
|
5
|
+
EASBot 插件系统 —— 类型契约、清单校验与扩展点定义
|
|
6
6
|
|
|
7
7
|
## 版本
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
9
|
+
v0.3.37
|
|
10
10
|
## 特性
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
12
|
+
- **插件契约**:`Plugin` / `PluginInput` / `PluginDefinition`(8 类能力字段的闭集,唯一真值源)
|
|
13
|
+
- **Hook 契约**:`HookEvent` / `HOOK_EVENTS` / `HookMatcher`(含 `priority` / `timeoutMs` / `failurePolicy`)/ 5 类执行器 Schema / 事件输入校验
|
|
14
|
+
- **Auth 契约**:`AuthHook` / `AuthMethod` / `AuthPrompt` / `AuthOAuthResult`(OAuth 与 API 两种认证方法)
|
|
15
|
+
- **命令与工具契约**:re-export `@easbot/types` 的 `CommandDefinition` / `ToolDefinition`(`execute` 必填)+ `createTool` 工厂
|
|
16
|
+
- **清单与校验**:`PluginManifestSchema` / `validatePluginManifest` / `validatePluginDefinition`(顶层闭集、至少一能力、`capabilities` 双向交叉校验)
|
|
17
|
+
- **不含 marketplace**:安装源 catalog 归 `@easbot/agent` CLI 层,`PluginDefinition` 不声明该字段
|
|
18
|
+
|
|
19
|
+
> ⚠️ 本包是**纯契约包**:不提供 HookRegistry 实现、不加载插件、不注册能力。加载与注册由 `@easbot/agent/src/plugin/plugin.ts` 负责;完整规范见 [`spec/plugin-standard.md`](../../spec/plugin-standard.md)。
|
|
16
20
|
|
|
17
21
|
## 安装
|
|
18
22
|
|
|
@@ -22,19 +26,40 @@ pnpm add @easbot/plugin
|
|
|
22
26
|
|
|
23
27
|
## 快速开始
|
|
24
28
|
|
|
25
|
-
###
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
import { createHookRegistry, HOOK_EVENTS } from '@easbot/plugin';
|
|
29
|
+
### 插件入口
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
const hooks = createHookRegistry();
|
|
31
|
+
插件入口 MUST 导出 `default` / `Plugin` / `plugin` 之一,签名为 `Plugin = (input: PluginInput) => Promise<PluginDefinition>`。
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
```typescript
|
|
34
|
+
import { HookEvent, tool, type Plugin, type PluginDefinition } from '@easbot/plugin';
|
|
35
|
+
|
|
36
|
+
export const MyPlugin: Plugin = async (input): Promise<PluginDefinition> => ({
|
|
37
|
+
hooks: [
|
|
38
|
+
{
|
|
39
|
+
event: HookEvent.ToolBefore,
|
|
40
|
+
hooks: [
|
|
41
|
+
{
|
|
42
|
+
type: 'function',
|
|
43
|
+
handler: async (hookInput, context) => ({
|
|
44
|
+
modified: false,
|
|
45
|
+
input: hookInput,
|
|
46
|
+
output: { directory: input.directory },
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
tools: {
|
|
53
|
+
echo: tool({
|
|
54
|
+
description: 'Echo the input text',
|
|
55
|
+
args: { text: tool.schema.string() },
|
|
56
|
+
execute: async (args) => String(args.text ?? ''),
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
37
59
|
});
|
|
60
|
+
|
|
61
|
+
export default MyPlugin;
|
|
62
|
+
export { MyPlugin as Plugin };
|
|
38
63
|
```
|
|
39
64
|
|
|
40
65
|
### 命令系统
|
|
@@ -61,38 +86,80 @@ const myPlugin = async (): Promise<PluginDefinition> => ({
|
|
|
61
86
|
});
|
|
62
87
|
```
|
|
63
88
|
|
|
64
|
-
> ⚠️ 命令的**注册表**(`register` / `
|
|
89
|
+
> ⚠️ 命令的**注册表**(`register` / `list`)在 `@easbot/agent` 的 `CommandRegistry`,本包只提供类型声明。
|
|
65
90
|
|
|
66
91
|
### 工具系统
|
|
67
92
|
|
|
93
|
+
`createTool` / `tool()` 的真实签名是 `{ description, args, execute }`,**没有** `name` / `parameters` 字段;`args` 是 Zod schema map,`execute` 返回 `Promise<string>`。
|
|
94
|
+
|
|
68
95
|
```typescript
|
|
69
96
|
import { createTool } from '@easbot/plugin';
|
|
97
|
+
import { z } from 'zod';
|
|
70
98
|
|
|
71
99
|
const tool = createTool({
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
input: z.string(),
|
|
76
|
-
}),
|
|
77
|
-
execute: async ({ input }) => {
|
|
78
|
-
return { result: input.toUpperCase() };
|
|
79
|
-
},
|
|
100
|
+
description: 'Uppercase the input text',
|
|
101
|
+
args: { input: z.string() },
|
|
102
|
+
execute: async ({ input }) => input.toUpperCase(),
|
|
80
103
|
});
|
|
81
104
|
```
|
|
82
105
|
|
|
106
|
+
## 插件清单与校验
|
|
107
|
+
|
|
108
|
+
`plugin.json` 的契约与可执行检查(对应 `spec/plugin-standard.md` §2.1 / §6):
|
|
109
|
+
|
|
110
|
+
| API | 说明 |
|
|
111
|
+
| ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
112
|
+
| `PluginManifestSchema` / `PluginManifest` | `plugin.json` 的 Zod schema 与类型(`name` 必填) |
|
|
113
|
+
| `validatePluginManifest(input)` | 返回 `{ ok: true; manifest }` 或 `{ ok: false; errors: string[] }` |
|
|
114
|
+
| `validatePluginDefinition(def, options?)` | 校验入口返回的 `PluginDefinition`(宿主加载器 MUST 调用);`options.capabilities` 触发与 manifest 的双向交叉校验 |
|
|
115
|
+
| `isValidPluginId(id)` / `PLUGIN_ID_PATTERN` | 插件 id 命名:`^[a-z0-9][a-z0-9._-]{1,63}$` |
|
|
116
|
+
| `isValidPluginEntry(entry)` / `PLUGIN_ENTRY_EXTENSIONS` | 入口路径安全(`./` 开头、无 `..`、仅 `.mjs/.js/.cjs`) |
|
|
117
|
+
| `PLUGIN_ENTRY_NAMES` | 入口导出白名单 `default` / `Plugin` / `plugin` |
|
|
118
|
+
| `PLUGIN_CAPABILITIES` / `PLUGIN_DEFINITION_KEYS` | 8 类能力枚举与 `PluginDefinition` 顶层字段闭集 |
|
|
119
|
+
| `PLUGIN_HOOK_FAILURE_POLICIES` | hook 失败策略 `fail-open` / `fail-closed` |
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { HookEvent, validatePluginManifest, validatePluginDefinition } from '@easbot/plugin';
|
|
123
|
+
|
|
124
|
+
const manifest = validatePluginManifest({
|
|
125
|
+
name: 'memory',
|
|
126
|
+
entry: './index.mjs',
|
|
127
|
+
capabilities: ['hooks', 'tools'],
|
|
128
|
+
});
|
|
129
|
+
if (!manifest.ok) throw new Error(manifest.errors.join('; '));
|
|
130
|
+
|
|
131
|
+
const definition = validatePluginDefinition(
|
|
132
|
+
{
|
|
133
|
+
hooks: [
|
|
134
|
+
{
|
|
135
|
+
event: HookEvent.SessionStart,
|
|
136
|
+
hooks: [{ type: 'function', handler: async (input) => ({ modified: false, input }) }],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
tools: { memory: { description: 'Memory tool', args: {}, execute: async () => 'ok' } },
|
|
140
|
+
},
|
|
141
|
+
{ capabilities: manifest.manifest.capabilities },
|
|
142
|
+
);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
> `PluginDefinition` 是闭集:MUST 至少声明一个能力字段;`marketplace`、点分内联 hook 键与任何未知顶层字段一律被拒绝。
|
|
146
|
+
|
|
83
147
|
## API
|
|
84
148
|
|
|
85
|
-
###
|
|
149
|
+
### Hook 契约
|
|
86
150
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
151
|
+
| 符号 | 说明 |
|
|
152
|
+
| --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
153
|
+
| `HookEvent` | 事件常量(`domain.action.phase` 三段式,如 `HookEvent.SessionStart`) |
|
|
154
|
+
| `HOOK_EVENTS` | 事件名**数组**(`Object.values(HookEvent)`,不是枚举对象) |
|
|
155
|
+
| `HookMatcher` | `{ event, matcher?, hooks, priority?, timeoutMs?, failurePolicy? }`;`event` MUST 命中 `HOOK_EVENTS` |
|
|
156
|
+
| `HookDefinition` | 5 类执行器联合:`command` / `prompt` / `http` / `agent` / `function` |
|
|
157
|
+
| `HookOutputWrapper` | `{ modified, input, output? }`;`output.denied: true` 表达 `fail-closed` 拒绝;禁止用 throw 表达业务拒绝 |
|
|
158
|
+
| `validateHookInput` / `safeValidateHookInput` / `getEventInputSchema` | 事件输入 Schema 校验 |
|
|
92
159
|
|
|
93
160
|
### Command 类型
|
|
94
161
|
|
|
95
|
-
|
|
162
|
+
见上文「命令系统」,唯一真源为 `@easbot/types/native/command.ts`。
|
|
96
163
|
|
|
97
164
|
| 类型 | 说明 |
|
|
98
165
|
| ------------------------- | ------------------------------------------------ |
|
|
@@ -104,28 +171,30 @@ const tool = createTool({
|
|
|
104
171
|
| `CommandExecutionContext` | 命令执行上下文(sessionId / directory / …) |
|
|
105
172
|
| `CommandExecuteResult` | 命令执行结果 |
|
|
106
173
|
|
|
107
|
-
### createTool
|
|
174
|
+
### createTool / tool
|
|
175
|
+
|
|
176
|
+
| 属性 | 类型 | 必填 | 说明 |
|
|
177
|
+
| ------------- | ------------------------------------ | ------- | ------------------------ |
|
|
178
|
+
| `description` | `string` | ✅ | 工具描述 |
|
|
179
|
+
| `args` | `Record<string, z.ZodTypeAny>` | ✅ | 参数 schema map |
|
|
180
|
+
| `execute` | `(args, context) => Promise<string>` | ✅ 必填 | 工具实现;validator 强制 |
|
|
108
181
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
182
|
+
### Marketplace(不属于本包契约)
|
|
183
|
+
|
|
184
|
+
`marketplace` 是**安装源 catalog**,不是插件运行时能力:`PluginDefinition` 不声明该字段,本包也不再导出 `MarketplaceEntry` / `MarketplaceDefinition` / `registerMarketplace()` 等注册中心 API。相关类型位于 `@easbot/agent/src/cli/plugin/type.ts`,元数据载体为 `.easbot-plugin/marketplace.json`。
|
|
185
|
+
|
|
186
|
+
## 落地样板
|
|
187
|
+
|
|
188
|
+
- `packages/memory/src/plugin/` —— 首个按本契约实现的插件(3 个 hook + 1 个 tool)
|
|
189
|
+
- `plugins/memory/` —— 仓根统一分发区的插件目录,可被 `easbot plugins install` 安装
|
|
190
|
+
- `plugins/.easbot-plugin/marketplace.json` —— 仓内唯一 marketplace 清单(安装源:`easbot plugins marketplace add ./plugins`)
|
|
115
191
|
|
|
116
192
|
## 开发
|
|
117
193
|
|
|
118
194
|
```bash
|
|
119
|
-
# 安装依赖
|
|
120
195
|
pnpm install
|
|
121
|
-
|
|
122
|
-
# 构建
|
|
123
196
|
pnpm build
|
|
124
|
-
|
|
125
|
-
# 测试
|
|
126
|
-
pnpm test
|
|
127
|
-
|
|
128
|
-
# 类型检查
|
|
197
|
+
pnpm test:run # vitest run(覆盖 manifest / definition / auth / hook 闭集契约)
|
|
129
198
|
pnpm type-check
|
|
130
199
|
```
|
|
131
200
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var v=require('zod'),types=require('@easbot/types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var v__default=/*#__PURE__*/_interopDefault(v);function E(o){return {description:o.description,args:o.args,execute:o.execute}}E.schema=v__default.default;var m={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},t={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",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",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",GatewayMessageDelivered:"gateway.message.delivered",GatewayMessageRead:"gateway.message.read",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",CommandTrigger:"scheduler.command.trigger",CommandComplete:"scheduler.command.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskRunning:"task.running",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end",ProcessorStart:"processor.start",ProcessorStepStart:"processor.step.start",ProcessorReasoningStart:"processor.reasoning.start",ProcessorReasoningDelta:"processor.reasoning.delta",ProcessorReasoningEnd:"processor.reasoning.end",ProcessorToolInputStart:"processor.tool.input.start",ProcessorToolCall:"processor.tool.call",ProcessorToolResult:"processor.tool.result",ProcessorToolError:"processor.tool.error",ProcessorStepFinish:"processor.step.finish",ProcessorTextStart:"processor.text.start",ProcessorTextDelta:"processor.text.delta",ProcessorTextEnd:"processor.text.end",ProcessorError:"processor.error",ProcessorFinish:"processor.finish",CreationRequest:"creation.request",CreationComplete:"creation.complete",EvolutionRequest:"evolution.request",EvolutionComplete:"evolution.complete"},nt=Object.values(t);var f=v.z.string().optional(),M=v.z.object({type:v.z.literal(m.Command),command:v.z.string(),if:f,shell:v.z.enum(["bash","powershell"]).optional(),timeout:v.z.number().positive().optional(),statusMessage:v.z.string().optional(),once:v.z.boolean().optional(),async:v.z.boolean().optional(),allowedEnvVars:v.z.array(v.z.string()).optional()}),w=v.z.object({type:v.z.literal(m.Prompt),if:f,timeout:v.z.number().positive().optional(),model:v.z.string().optional().describe("Model identifier in provider/model format"),statusMessage:v.z.string().optional(),once:v.z.boolean().optional(),runMode:v.z.enum(["session","fork"]).optional(),system:v.z.string().optional(),parts:v.z.array(v.z.unknown()),onMessage:v.z.custom(o=>typeof o=="function").optional()}),R=v.z.object({type:v.z.literal(m.Http),url:v.z.string(),if:f,timeout:v.z.number().positive().optional(),method:v.z.enum(["GET","POST","PUT","DELETE"]).optional(),headers:v.z.record(v.z.string(),v.z.string()).optional(),allowedEnvVars:v.z.array(v.z.string()).optional(),statusMessage:v.z.string().optional(),once:v.z.boolean().optional()}),D=v.z.object({type:v.z.literal(m.Agent),if:f,timeout:v.z.number().positive().optional(),agent:v.z.string().optional(),model:v.z.string().optional().describe("Model identifier in provider/model format"),statusMessage:v.z.string().optional(),once:v.z.boolean().optional(),system:v.z.string().optional(),parts:v.z.array(v.z.unknown()),onMessage:v.z.custom(o=>typeof o=="function").optional()}),A=v.z.object({type:v.z.literal(m.Function),handler:v.z.function()}),z=v.z.discriminatedUnion("type",[M,w,R,D,A]),j=v.z.object({event:v.z.string(),matcher:v.z.string().optional(),hooks:v.z.array(z)}),ct=v.z.record(v.z.string(),v.z.array(j)),n=v.z.string().min(1).describe("Session unique identifier"),O=v.z.string().min(1).describe("Part unique identifier"),i=v.z.string().min(1).describe("Message unique identifier"),c=v.z.string().min(1).describe("Tool call unique identifier"),b=v.z.string().optional().describe("Agent name"),y=v.z.string().optional().describe("Model identifier"),h=v.z.object({providerId:v.z.string().describe("Provider ID"),modelId:v.z.string().describe("Model ID"),api:v.z.object({id:v.z.string().describe("API ID"),npm:v.z.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),S=v.z.string().optional().describe("Working directory path"),G=v.z.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),ut=v.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),B=v.z.object({sessionId:n,source:v.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:y,agent:b,cwd:S}),F=v.z.object({sessionId:n,reason:G,duration:v.z.number().positive().optional().describe("Session duration in milliseconds")}),W=v.z.object({sessionId:n,trigger:v.z.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:v.z.number().positive().describe("Current context length"),threshold:v.z.number().positive().describe("Trigger threshold")}),L=v.z.object({sessionId:n,summary:v.z.string().describe("Compaction summary"),previousLength:v.z.number().positive().describe("Previous context length"),newLength:v.z.number().positive().describe("New context length")}),q=v.z.enum(["user","assistant","system","tool"]),k=v.z.discriminatedUnion("type",[v.z.object({type:v.z.literal("text"),text:v.z.string().describe("Text content")}),v.z.object({type:v.z.literal("image"),source:v.z.object({type:v.z.enum(["base64","url"]),mime:v.z.string().optional().describe("File mime type"),data:v.z.string().describe("File base64 encoding data or url")})}),v.z.object({type:v.z.literal("file"),url:v.z.string().describe("File path"),filename:v.z.string().describe("File name"),mime:v.z.string().optional().describe("File mime type")})]),T=v.z.object({id:i,role:q,content:v.z.union([v.z.string(),v.z.array(k)]),name:v.z.string().optional().describe("Message sender name"),tool_call_id:c.optional().describe("Related tool call ID")}),N=v.z.object({sessionId:n,agent:b,model:y,messageId:i,message:v.z.object({id:i,role:v.z.literal("user"),content:v.z.union([v.z.string(),v.z.array(k)])}).describe("User message")}),U=v.z.object({sessionId:n,messages:v.z.array(T).describe("Messages to transform")}),_=v.z.object({sessionId:n,model:y,system:v.z.array(v.z.string()).describe("Current system prompt")}),u=v.z.record(v.z.string(),v.z.unknown()).describe("Tool call arguments"),V=v.z.object({title:v.z.string().optional().describe("Result title"),content:v.z.string().describe("Result content"),is_error:v.z.boolean().optional().describe("Is error result"),metadata:v.z.record(v.z.string(),v.z.unknown()).optional().describe("Extra metadata")}),Z=v.z.object({sessionId:n,userMessageId:i.optional().describe("User message ID for the current step"),tool:v.z.string().describe("Tool name"),callId:c,args:u}),$=v.z.object({sessionId:n,userMessageId:i.optional().describe("User message ID for the current step"),tool:v.z.string(),callId:c,args:u,result:V,duration:v.z.number().nonnegative().optional().describe("Execution duration in milliseconds")}),K=v.z.object({sessionId:n,tool:v.z.string(),callId:c,args:u,error:v.z.string().describe("Error message"),errorType:v.z.enum(["timeout","invalid_args","execution_error","permission_denied"])}),J=v.z.object({sessionId:n,toolID:v.z.string().describe("Tool ID"),definition:v.z.object({name:v.z.string(),description:v.z.string().optional(),parameters:v.z.record(v.z.string(),v.z.unknown()).optional()}).describe("Tool definition")}),Q=v.z.object({sessionId:n,command:v.z.string().describe("Command name"),arguments:v.z.union([v.z.string(),v.z.record(v.z.string(),v.z.unknown())]).describe("Command arguments")}),X=v.z.object({sessionId:n,command:v.z.string().describe("Command name"),arguments:v.z.union([v.z.string(),v.z.record(v.z.string(),v.z.unknown())]).optional(),result:v.z.object({info:v.z.unknown().optional().describe("Message info"),parts:v.z.array(v.z.unknown()).optional().describe("Message parts"),title:v.z.string().optional().describe("Result title"),metadata:v.z.record(v.z.string(),v.z.unknown()).optional().describe("Result metadata"),output:v.z.string().optional().describe("Result output"),success:v.z.boolean().optional().describe("Whether execution succeeded"),error:v.z.string().optional().describe("Error message if failed")}).describe("Command execution result")}),Y=v.z.enum(["read","write","exec","admin"]),ee=v.z.object({tool:v.z.string().describe("Tool name requesting permission"),args:u.optional(),level:Y.optional(),reason:v.z.string().optional().describe("Reason for permission request")}),te=v.z.object({sessionId:n,request:ee}),oe=v.z.object({sessionId:n,tool:v.z.string(),reason:v.z.string().optional()}),C=v.z.enum(["openai","anthropic","google","azure","custom"]),ne=v.z.object({temperature:v.z.number().min(0).max(2).optional(),topP:v.z.number().min(0).max(1).optional(),topK:v.z.number().int().positive().optional(),maxTokens:v.z.number().int().positive().optional(),stopSequences:v.z.array(v.z.string()).optional(),responseFormat:v.z.enum(["text","json_object"]).optional()}),re=v.z.object({sessionId:n,agent:b,model:h,provider:C,params:ne.partial().optional()}),se=v.z.object({sessionId:n,agent:b,model:h,provider:C,headers:v.z.record(v.z.string(),v.z.string()).optional()}),ie=v.z.object({cwd:S.describe("Working directory"),sessionId:n.optional(),callId:c.optional()}),ae=v.z.object({sessionId:n,mode:v.z.enum(["agent","chat","query"]).describe("Build mode"),providerId:v.z.string().optional()}),pe=v.z.object({sessionId:n,context:v.z.object({messages:v.z.array(T),system:v.z.array(v.z.string()),metadata:v.z.record(v.z.string(),v.z.unknown())}).describe("Built context")}),ce=v.z.object({gatewayID:v.z.string().describe("Gateway ID"),messageId:i,message:v.z.unknown().describe("Received message")}),ue=v.z.object({gatewayID:v.z.string(),messageId:i,message:v.z.unknown(),sessionId:n.optional()}),me=v.z.object({gatewayID:v.z.string(),messageId:i,result:v.z.unknown().optional()}),le=v.z.object({gatewayID:v.z.string(),messageId:i,message:v.z.unknown(),target:v.z.string().optional().describe("Send target")}),de=v.z.object({gatewayID:v.z.string(),messageId:i,sessionId:n.optional(),channel:v.z.object({platform:v.z.string(),channelId:v.z.string()}),timestamp:v.z.number().describe("Delivery timestamp")}),ge=v.z.object({gatewayID:v.z.string(),messageId:i,sessionId:n.optional(),channel:v.z.object({platform:v.z.string(),channelId:v.z.string()}),timestamp:v.z.number().describe("Read timestamp")}),fe=v.z.object({type:v.z.literal("command"),config:v.z.object({command:v.z.string(),arguments:v.z.union([v.z.string(),v.z.record(v.z.string(),v.z.unknown())]).optional()})}),be=v.z.object({type:v.z.literal("heartbeat"),parts:v.z.array(v.z.unknown()),system:v.z.string().optional(),config:v.z.object({session:v.z.string().optional(),mode:v.z.enum(["session","fork"]).optional(),agent:v.z.string().optional(),model:v.z.string().optional().describe("Model identifier in provider/model format"),tools:v.z.record(v.z.string(),v.z.boolean()).optional()}).optional()}),ye=v.z.object({type:v.z.literal("scheduler"),parts:v.z.array(v.z.unknown()),system:v.z.string().optional(),config:v.z.object({agentType:v.z.string().optional(),transport:v.z.enum(["stdio","http","websocket","cli"]).optional(),model:v.z.string().optional(),tools:v.z.record(v.z.string(),v.z.boolean()).optional()}).optional()}),Ie=v.z.object({taskId:v.z.string().describe("Heartbeat task ID"),timestamp:v.z.number().describe("Heartbeat timestamp"),name:v.z.string().optional().describe("Heartbeat name"),definition:be.optional()}),xe=v.z.object({taskId:v.z.string().describe("Heartbeat task ID"),sessionId:n.optional(),timestamp:v.z.number(),duration:v.z.number().nonnegative().optional(),success:v.z.boolean().optional(),error:v.z.string().optional()}),he=v.z.object({taskId:v.z.string().describe("Task ID"),taskName:v.z.string().optional(),timestamp:v.z.number(),payload:v.z.record(v.z.string(),v.z.unknown()).optional(),definition:ye.optional()}),Se=v.z.object({taskId:v.z.string(),timestamp:v.z.number(),success:v.z.boolean(),result:v.z.record(v.z.string(),v.z.unknown()).optional(),error:v.z.string().optional()}),ke=v.z.object({taskId:v.z.string().describe("Command task unique identifier"),taskName:v.z.string().describe("Command task name"),command:v.z.string().describe("Command name"),arguments:v.z.union([v.z.string(),v.z.record(v.z.string(),v.z.unknown())]).optional().describe("Command arguments"),timestamp:v.z.number().describe("Trigger timestamp"),definition:fe.optional()}),Te=v.z.object({taskId:v.z.string(),timestamp:v.z.number(),success:v.z.boolean(),output:v.z.string().optional(),error:v.z.string().optional(),duration:v.z.number().describe("Execution duration in milliseconds")}),I=v.z.enum(["tool","scheduler","cli","api"]),Ce=v.z.object({taskId:v.z.string().describe("Task unique identifier"),sessionId:v.z.string().describe("Session ID for this task"),source:I.describe("Task source: tool, scheduler, cli, api"),agentType:v.z.string().describe("Agent type to execute this task"),description:v.z.string().describe("Task description"),prompt:v.z.string().describe("Task prompt content"),timeout:v.z.number().positive().optional().describe("Task timeout in milliseconds")}),Pe=v.z.object({taskId:v.z.string().describe("Task unique identifier"),sessionId:v.z.string().describe("Session ID for this task"),source:I.describe("Task source: tool, scheduler, cli, api")}),ve=v.z.object({taskId:v.z.string(),sessionId:v.z.string(),source:I,step:v.z.number().describe("Current step number"),totalSteps:v.z.number().optional().describe("Total number of steps"),output:v.z.string().describe("Progress output content"),timestamp:v.z.number().describe("Progress timestamp")}),Ee=v.z.object({taskId:v.z.string(),sessionId:v.z.string(),source:I,result:v.z.string().describe("Task result content"),duration:v.z.number().nonnegative().describe("Task duration in milliseconds"),attachments:v.z.array(v.z.unknown()).optional().describe("Task result attachments"),error:v.z.string().optional().describe("Error message if task failed"),agentType:v.z.string().optional().describe("Agent type that executed the task"),metadata:v.z.record(v.z.string(),v.z.unknown()).optional().describe("Additional metadata for the task result")}),He=v.z.object({sessionId:v.z.string().describe("Session ID"),step:v.z.number().describe("Current step number"),lastUserId:v.z.string().describe("Last user message ID"),result:v.z.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),Me=v.z.object({sessionId:v.z.string().describe("Session ID"),step:v.z.number().describe("Current step number"),lastUserId:v.z.string().describe("Last user message ID"),result:v.z.enum(["stop","continue"]).describe("Loop result: stop or continue")}),we=v.z.object({requestId:v.z.string(),kind:v.z.enum(["create-skill","create-workflow","create-bundle"]),requirement:v.z.string(),hints:v.z.array(v.z.string()),origin:v.z.object({source:v.z.enum(["human","tool","scheduler","namespace"]).optional(),timestamp:v.z.number().int().nonnegative()})}),Re=v.z.object({requestId:v.z.string(),status:v.z.enum(["success","failed"]),specId:v.z.string().optional(),durationMs:v.z.number().int().nonnegative(),error:v.z.string().optional()}),De=v.z.object({dryRun:v.z.boolean()}),Ae=v.z.object({status:v.z.enum(["success","failed","awaiting-approval"]),applied:v.z.number().int().nonnegative().optional(),awaitingApproval:v.z.number().int().nonnegative().optional(),error:v.z.string().optional()}),r=v.z.object({streamId:v.z.string().describe("Unique id of one stream invocation"),step:v.z.number().int().nonnegative().describe("Step index (1-based, 0 before first step)"),agent:v.z.string().describe("Agent name that initiated this stream invocation"),sessionId:v.z.string().describe("Session id passed in by the application layer"),messageId:i.describe("Assistant message id created by the processor, constant within one process() call"),userMessageId:i.describe("User message id that triggered this response, equals assistant.parentId"),model:y}),a={partId:O.describe("Part id allocated and maintained by the processor")},ze=r,je=r.extend(a),Oe=r.extend({...a,reasoningId:v.z.string().describe("Provider-side reasoning block id"),text:v.z.string().describe("Reasoning text so far (empty at start)")}),Ge=r.extend({...a,reasoningId:v.z.string().describe("Provider-side reasoning block id"),delta:v.z.string().describe("Incremental reasoning text"),text:v.z.string().describe("Accumulated reasoning text")}),Be=r.extend({...a,reasoningId:v.z.string().describe("Provider-side reasoning block id"),text:v.z.string().describe("Accumulated reasoning text (trimmed)")}),Fe=r.extend({...a,callId:c,tool:v.z.string().describe("Tool name")}),We=r.extend({...a,callId:c,tool:v.z.string().describe("Tool name"),args:u}),Le=r.extend({...a,callId:c,tool:v.z.string().describe("Tool name"),args:u,title:v.z.string().optional().describe("Result title"),output:v.z.unknown().describe("Tool output payload"),metadata:v.z.record(v.z.string(),v.z.unknown()).optional(),durationMs:v.z.number().nonnegative().describe("Tool execution duration")}),qe=r.extend({...a,callId:c,tool:v.z.string().describe("Tool name"),args:u,error:v.z.string().describe("Error message"),errorName:v.z.string().optional().describe("Named error name"),durationMs:v.z.number().nonnegative().describe("Tool execution duration")}),Ne=r.extend({...a,reason:v.z.string().optional().describe("Finish reason reported by provider"),tokens:types.UsageSchema.optional().describe("Normalized token usage"),cost:v.z.number().nonnegative().optional().describe("Estimated cost of this step")}),Ue=r.extend({...a,text:v.z.string().describe("Text so far (empty at start)")}),_e=r.extend({...a,delta:v.z.string().describe("Incremental text"),text:v.z.string().describe("Accumulated text")}),Ve=r.extend({...a,text:v.z.string().describe("Accumulated text (trimmed)")}),Ze=r.extend({error:v.z.string().describe("Error message"),errorName:v.z.string().optional().describe("Named error name"),aborted:v.z.boolean().optional().describe("Whether aborted by signal")}),$e=r.extend({result:v.z.enum(["stop","continue","compact"]).describe("Processor loop verdict"),cost:v.z.number().nonnegative().optional().describe("Accumulated cost of this stream"),tokens:v.z.number().nonnegative().optional().describe("Accumulated tokens of this stream")}),x={[t.SessionStart]:B,[t.SessionEnd]:F,[t.SessionCompacting]:W,[t.SessionCompact]:L,[t.MessageReceive]:N,[t.MessageTransform]:U,[t.SystemTransform]:_,[t.ToolBefore]:Z,[t.ToolAfter]:$,[t.ToolFailure]:K,[t.ToolDefinition]:J,[t.CommandBefore]:Q,[t.CommandAfter]:X,[t.PermissionAsk]:te,[t.PermissionDenied]:oe,[t.LlmParams]:re,[t.LlmHeaders]:se,[t.ShellEnv]:ie,[t.ContextBuildBefore]:ae,[t.ContextBuildAfter]:pe,[t.GatewayMessageReceive]:ce,[t.GatewayMessageProcess]:ue,[t.GatewayMessageComplete]:me,[t.GatewayMessageSend]:le,[t.GatewayMessageDelivered]:de,[t.GatewayMessageRead]:ge,[t.HeartbeatTrigger]:Ie,[t.HeartbeatComplete]:xe,[t.ScheduledTaskTrigger]:he,[t.ScheduledTaskComplete]:Se,[t.CommandTrigger]:ke,[t.CommandComplete]:Te,[t.TaskStart]:Ce,[t.TaskRunning]:Pe,[t.TaskProgress]:ve,[t.TaskComplete]:Ee,[t.LoopStart]:He,[t.LoopEnd]:Me,[t.ProcessorStart]:ze,[t.ProcessorStepStart]:je,[t.ProcessorReasoningStart]:Oe,[t.ProcessorReasoningDelta]:Ge,[t.ProcessorReasoningEnd]:Be,[t.ProcessorToolInputStart]:Fe,[t.ProcessorToolCall]:We,[t.ProcessorToolResult]:Le,[t.ProcessorToolError]:qe,[t.ProcessorStepFinish]:Ne,[t.ProcessorTextStart]:Ue,[t.ProcessorTextDelta]:_e,[t.ProcessorTextEnd]:Ve,[t.ProcessorError]:Ze,[t.ProcessorFinish]:$e,[t.CreationRequest]:we,[t.CreationComplete]:Re,[t.EvolutionRequest]:De,[t.EvolutionComplete]:Ae};function mt(o){return x[o]}function lt(o,d){let g=x[o];if(!g)throw new Error(`No schema found for event: ${o}`);return g.parse(d)}function dt(o,d){let g=x[o];return g?g.safeParse(d):{success:false,error:new v.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${o}`}])}}var Nt=v.z.enum(["subagent","primary","all"]),Ut=v.z.enum(["general","coder","all"]),_t=types.AgentInfoSchema;var Xt=v.z.object({name:v.z.string().min(1).describe("Unique skill name"),description:v.z.string().min(1).describe("When to use this skill"),scope:v.z.enum(["general","coder","all"]).optional().describe("Context mode scope")}),Yt=v.z.object({agent:v.z.object({name:v.z.string().describe("Agent name"),model:v.z.string().optional().describe("Agent model in provider/model format")}).optional().describe("Agent context")}),eo=v.z.object({isEnabled:v.z.boolean().optional().describe("Is enabled check result")});var l=new Map;function ao(o){if(l.has(o.id))throw new Error(`Marketplace with id "${o.id}" already registered`);l.set(o.id,o);}function po(o){return l.delete(o)}function co(){return Array.from(l.values()).map(o=>o)}function uo(o){return l.get(o)??null}function mo(o){return Array.from(l.values()).filter(d=>d.category===o)}Object.defineProperty(exports,"AgentInfoSchema",{enumerable:true,get:function(){return types.AgentInfoSchema}});Object.defineProperty(exports,"AgentModelSchema",{enumerable:true,get:function(){return types.AgentModelSchema}});Object.defineProperty(exports,"AgentPermissionSchema",{enumerable:true,get:function(){return types.AgentPermissionSchema}});Object.defineProperty(exports,"CommandArgumentsSchema",{enumerable:true,get:function(){return types.CommandArgumentsSchema}});Object.defineProperty(exports,"CommandConfigInfoSchema",{enumerable:true,get:function(){return types.CommandConfigInfoSchema}});Object.defineProperty(exports,"CommandExecuteResultMetadataSchema",{enumerable:true,get:function(){return types.CommandExecuteResultMetadataSchema}});Object.defineProperty(exports,"CommandExecuteResultSchema",{enumerable:true,get:function(){return types.CommandExecuteResultSchema}});Object.defineProperty(exports,"CommandExecutionContextSchema",{enumerable:true,get:function(){return types.CommandExecutionContextSchema}});Object.defineProperty(exports,"CommandInfoSchema",{enumerable:true,get:function(){return types.CommandInfoSchema}});Object.defineProperty(exports,"CommandInitContextSchema",{enumerable:true,get:function(){return types.CommandInitContextSchema}});Object.defineProperty(exports,"CommandInitResultSchema",{enumerable:true,get:function(){return types.CommandInitResultSchema}});Object.defineProperty(exports,"CommandMetadataSchema",{enumerable:true,get:function(){return types.CommandMetadataSchema}});Object.defineProperty(exports,"CommandPromptPartSchema",{enumerable:true,get:function(){return types.CommandPromptPartSchema}});Object.defineProperty(exports,"CommandSourceSchema",{enumerable:true,get:function(){return types.CommandSourceSchema}});Object.defineProperty(exports,"PermissionActionSchema",{enumerable:true,get:function(){return types.PermissionActionSchema}});Object.defineProperty(exports,"PermissionRuleSchema",{enumerable:true,get:function(){return types.PermissionRuleSchema}});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.AgentMetadataSchema=_t;exports.AgentModeSchema=Nt;exports.AgentSchema=b;exports.AgentScopeSchema=Ut;exports.CallIDSchema=c;exports.CommandAfterInputSchema=X;exports.CommandBeforeInputSchema=Q;exports.CommandCompleteInputSchema=Te;exports.CommandExecutorSchema=M;exports.CommandTaskDefinitionSchema=fe;exports.CommandTriggerInputSchema=ke;exports.ContentPartSchema=k;exports.ContextBuildAfterInputSchema=pe;exports.ContextBuildBeforeInputSchema=ae;exports.CreationCompleteInputSchema=Re;exports.CreationRequestInputSchema=we;exports.CwdSchema=S;exports.EndReasonSchema=G;exports.EventInputSchemas=x;exports.EvolutionCompleteInputSchema=Ae;exports.EvolutionRequestInputSchema=De;exports.FinishReasonSchema=ut;exports.FunctionExecutorSchema=A;exports.GatewayMessageCompleteInputSchema=me;exports.GatewayMessageDeliveredInputSchema=de;exports.GatewayMessageProcessInputSchema=ue;exports.GatewayMessageReadInputSchema=ge;exports.GatewayMessageReceiveInputSchema=ce;exports.GatewayMessageSendInputSchema=le;exports.HOOK_EVENTS=nt;exports.HeartbeatCompleteInputSchema=xe;exports.HeartbeatTaskDefinitionSchema=be;exports.HeartbeatTriggerInputSchema=Ie;exports.HookEvent=t;exports.HookExecutorSchema=z;exports.HookMatcherSchema=j;exports.HookType=m;exports.HooksConfigSchema=ct;exports.HttpExecutorSchema=R;exports.LlmHeadersInputSchema=se;exports.LlmParamsInputSchema=re;exports.LlmParamsSchema=ne;exports.LlmProviderSchema=C;exports.LoopEndInputSchema=Me;exports.LoopStartInputSchema=He;exports.MessageIDSchema=i;exports.MessageReceiveInputSchema=N;exports.MessageRoleSchema=q;exports.MessageSchema=T;exports.MessageTransformInputSchema=U;exports.ModelObjectSchema=h;exports.ModelSchema=y;exports.PartIDSchema=O;exports.PermissionAskInputSchema=te;exports.PermissionDeniedInputSchema=oe;exports.PermissionLevelSchema=Y;exports.PermissionRequestSchema=ee;exports.ProcessorErrorInputSchema=Ze;exports.ProcessorFinishInputSchema=$e;exports.ProcessorReasoningDeltaInputSchema=Ge;exports.ProcessorReasoningEndInputSchema=Be;exports.ProcessorReasoningStartInputSchema=Oe;exports.ProcessorStartInputSchema=ze;exports.ProcessorStepFinishInputSchema=Ne;exports.ProcessorStepStartInputSchema=je;exports.ProcessorTextDeltaInputSchema=_e;exports.ProcessorTextEndInputSchema=Ve;exports.ProcessorTextStartInputSchema=Ue;exports.ProcessorToolCallInputSchema=We;exports.ProcessorToolErrorInputSchema=qe;exports.ProcessorToolInputStartInputSchema=Fe;exports.ProcessorToolResultInputSchema=Le;exports.PromptExecutorSchema=w;exports.ScheduledTaskCompleteInputSchema=Se;exports.ScheduledTaskTriggerInputSchema=he;exports.SchedulerTaskDefinitionSchema=ye;exports.SessionCompactInputSchema=L;exports.SessionCompactingInputSchema=W;exports.SessionEndInputSchema=F;exports.SessionIDSchema=n;exports.SessionStartInputSchema=B;exports.ShellEnvInputSchema=ie;exports.SkillInitContextSchema=Yt;exports.SkillInitResultSchema=eo;exports.SkillMetadataSchema=Xt;exports.SystemTransformInputSchema=_;exports.TaskCompleteInputSchema=Ee;exports.TaskProgressInputSchema=ve;exports.TaskRunningInputSchema=Pe;exports.TaskSourceSchema=I;exports.TaskStartInputSchema=Ce;exports.ToolAfterInputSchema=$;exports.ToolArgsSchema=u;exports.ToolBeforeInputSchema=Z;exports.ToolDefinitionInputSchema=J;exports.ToolFailureInputSchema=K;exports.ToolResultSchema=V;exports.findMarketplace=uo;exports.findMarketplacesByCategory=mo;exports.getEventInputSchema=mt;exports.listMarketplaces=co;exports.registerMarketplace=ao;exports.safeValidateHookInput=dt;exports.tool=E;exports.unregisterMarketplace=po;exports.validateHookInput=lt;
|
|
1
|
+
'use strict';var f=require('zod'),types=require('@easbot/types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var f__default=/*#__PURE__*/_interopDefault(f);function $(t){return {description:t.description,args:t.args,execute:t.execute}}$.schema=f__default.default;var h={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},r={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",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",GatewayMessageReceive:"gateway.message.receive",GatewayMessageProcess:"gateway.message.process",GatewayMessageComplete:"gateway.message.complete",GatewayMessageSend:"gateway.message.send",GatewayMessageDelivered:"gateway.message.delivered",GatewayMessageRead:"gateway.message.read",HeartbeatTrigger:"scheduler.heartbeat.trigger",HeartbeatComplete:"scheduler.heartbeat.complete",ScheduledTaskTrigger:"scheduler.task.trigger",ScheduledTaskComplete:"scheduler.task.complete",CommandTrigger:"scheduler.command.trigger",CommandComplete:"scheduler.command.complete",ContextBuildBefore:"context.build.before",ContextBuildAfter:"context.build.after",TaskStart:"task.start",TaskRunning:"task.running",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end",ProcessorStart:"processor.start",ProcessorStepStart:"processor.step.start",ProcessorReasoningStart:"processor.reasoning.start",ProcessorReasoningDelta:"processor.reasoning.delta",ProcessorReasoningEnd:"processor.reasoning.end",ProcessorToolInputStart:"processor.tool.input.start",ProcessorToolCall:"processor.tool.call",ProcessorToolResult:"processor.tool.result",ProcessorToolError:"processor.tool.error",ProcessorStepFinish:"processor.step.finish",ProcessorTextStart:"processor.text.start",ProcessorTextDelta:"processor.text.delta",ProcessorTextEnd:"processor.text.end",ProcessorError:"processor.error",ProcessorFinish:"processor.finish",CreationRequest:"creation.request",CreationComplete:"creation.complete",EvolutionRequest:"evolution.request",EvolutionComplete:"evolution.complete"},A=Object.values(r);var S=f.z.string().optional(),O=f.z.object({type:f.z.literal(h.Command),command:f.z.string(),if:S,shell:f.z.enum(["bash","powershell"]).optional(),timeout:f.z.number().positive().optional(),statusMessage:f.z.string().optional(),once:f.z.boolean().optional(),async:f.z.boolean().optional(),allowedEnvVars:f.z.array(f.z.string()).optional()}),F=f.z.object({type:f.z.literal(h.Prompt),if:S,timeout:f.z.number().positive().optional(),model:f.z.string().optional().describe("Model identifier in provider/model format"),statusMessage:f.z.string().optional(),once:f.z.boolean().optional(),runMode:f.z.enum(["session","fork"]).optional(),system:f.z.string().optional(),parts:f.z.array(f.z.unknown()),onMessage:f.z.custom(t=>typeof t=="function").optional()}),_=f.z.object({type:f.z.literal(h.Http),url:f.z.string(),if:S,timeout:f.z.number().positive().optional(),method:f.z.enum(["GET","POST","PUT","DELETE"]).optional(),headers:f.z.record(f.z.string(),f.z.string()).optional(),allowedEnvVars:f.z.array(f.z.string()).optional(),statusMessage:f.z.string().optional(),once:f.z.boolean().optional()}),G=f.z.object({type:f.z.literal(h.Agent),if:S,timeout:f.z.number().positive().optional(),agent:f.z.string().optional(),model:f.z.string().optional().describe("Model identifier in provider/model format"),statusMessage:f.z.string().optional(),once:f.z.boolean().optional(),system:f.z.string().optional(),parts:f.z.array(f.z.unknown()),onMessage:f.z.custom(t=>typeof t=="function").optional()}),N=f.z.object({type:f.z.literal(h.Function),handler:f.z.function()}),q=f.z.discriminatedUnion("type",[O,F,_,G,N]),B=f.z.object({event:f.z.string(),matcher:f.z.string().optional(),hooks:f.z.array(q),priority:f.z.number().optional(),timeoutMs:f.z.number().nonnegative().optional(),failurePolicy:f.z.enum(["fail-open","fail-closed"]).optional()}),Lt=f.z.record(f.z.string(),f.z.array(B)),i=f.z.string().min(1).describe("Session unique identifier"),U=f.z.string().min(1).describe("Part unique identifier"),u=f.z.string().min(1).describe("Message unique identifier"),g=f.z.string().min(1).describe("Tool call unique identifier"),I=f.z.string().optional().describe("Agent name"),k=f.z.string().optional().describe("Model identifier"),v=f.z.object({providerId:f.z.string().describe("Provider ID"),modelId:f.z.string().describe("Model ID"),api:f.z.object({id:f.z.string().describe("API ID"),npm:f.z.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),R=f.z.string().optional().describe("Working directory path"),V=f.z.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),Ot=f.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),W=f.z.object({sessionId:i,source:f.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:k,agent:I,cwd:R}),K=f.z.object({sessionId:i,reason:V,duration:f.z.number().positive().optional().describe("Session duration in milliseconds")}),Z=f.z.object({sessionId:i,trigger:f.z.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:f.z.number().positive().describe("Current context length"),threshold:f.z.number().positive().describe("Trigger threshold")}),Y=f.z.object({sessionId:i,summary:f.z.string().describe("Compaction summary"),previousLength:f.z.number().positive().describe("Previous context length"),newLength:f.z.number().positive().describe("New context length")}),X=f.z.enum(["user","assistant","system","tool"]),M=f.z.discriminatedUnion("type",[f.z.object({type:f.z.literal("text"),text:f.z.string().describe("Text content")}),f.z.object({type:f.z.literal("image"),source:f.z.object({type:f.z.enum(["base64","url"]),mime:f.z.string().optional().describe("File mime type"),data:f.z.string().describe("File base64 encoding data or url")})}),f.z.object({type:f.z.literal("file"),url:f.z.string().describe("File path"),filename:f.z.string().describe("File name"),mime:f.z.string().optional().describe("File mime type")})]),w=f.z.object({id:u,role:X,content:f.z.union([f.z.string(),f.z.array(M)]),name:f.z.string().optional().describe("Message sender name"),tool_call_id:g.optional().describe("Related tool call ID")}),J=f.z.object({sessionId:i,agent:I,model:k,messageId:u,message:f.z.object({id:u,role:f.z.literal("user"),content:f.z.union([f.z.string(),f.z.array(M)])}).describe("User message")}),Q=f.z.object({sessionId:i,messages:f.z.array(w).describe("Messages to transform")}),ee=f.z.object({sessionId:i,model:k,system:f.z.array(f.z.string()).describe("Current system prompt")}),b=f.z.record(f.z.string(),f.z.unknown()).describe("Tool call arguments"),te=f.z.object({title:f.z.string().optional().describe("Result title"),content:f.z.string().describe("Result content"),is_error:f.z.boolean().optional().describe("Is error result"),metadata:f.z.record(f.z.string(),f.z.unknown()).optional().describe("Extra metadata")}),oe=f.z.object({sessionId:i,userMessageId:u.optional().describe("User message ID for the current step"),tool:f.z.string().describe("Tool name"),callId:g,args:b}),ne=f.z.object({sessionId:i,userMessageId:u.optional().describe("User message ID for the current step"),tool:f.z.string(),callId:g,args:b,result:te,duration:f.z.number().nonnegative().optional().describe("Execution duration in milliseconds")}),re=f.z.object({sessionId:i,tool:f.z.string(),callId:g,args:b,error:f.z.string().describe("Error message"),errorType:f.z.enum(["timeout","invalid_args","execution_error","permission_denied"])}),se=f.z.object({sessionId:i,toolID:f.z.string().describe("Tool ID"),definition:f.z.object({name:f.z.string(),description:f.z.string().optional(),parameters:f.z.record(f.z.string(),f.z.unknown()).optional()}).describe("Tool definition")}),ie=f.z.object({sessionId:i,command:f.z.string().describe("Command name"),arguments:f.z.union([f.z.string(),f.z.record(f.z.string(),f.z.unknown())]).describe("Command arguments")}),ae=f.z.object({sessionId:i,command:f.z.string().describe("Command name"),arguments:f.z.union([f.z.string(),f.z.record(f.z.string(),f.z.unknown())]).optional(),result:f.z.object({info:f.z.unknown().optional().describe("Message info"),parts:f.z.array(f.z.unknown()).optional().describe("Message parts"),title:f.z.string().optional().describe("Result title"),metadata:f.z.record(f.z.string(),f.z.unknown()).optional().describe("Result metadata"),output:f.z.string().optional().describe("Result output"),success:f.z.boolean().optional().describe("Whether execution succeeded"),error:f.z.string().optional().describe("Error message if failed")}).describe("Command execution result")}),pe=f.z.enum(["read","write","exec","admin"]),ce=f.z.object({tool:f.z.string().describe("Tool name requesting permission"),args:b.optional(),level:pe.optional(),reason:f.z.string().optional().describe("Reason for permission request")}),ue=f.z.object({sessionId:i,request:ce}),me=f.z.object({sessionId:i,tool:f.z.string(),reason:f.z.string().optional()}),j=f.z.enum(["openai","anthropic","google","azure","custom"]),le=f.z.object({temperature:f.z.number().min(0).max(2).optional(),topP:f.z.number().min(0).max(1).optional(),topK:f.z.number().int().positive().optional(),maxTokens:f.z.number().int().positive().optional(),stopSequences:f.z.array(f.z.string()).optional(),responseFormat:f.z.enum(["text","json_object"]).optional()}),de=f.z.object({sessionId:i,agent:I,model:v,provider:j,params:le.partial().optional()}),ge=f.z.object({sessionId:i,agent:I,model:v,provider:j,headers:f.z.record(f.z.string(),f.z.string()).optional()}),fe=f.z.object({cwd:R.describe("Working directory"),sessionId:i.optional(),callId:g.optional()}),be=f.z.object({sessionId:i,mode:f.z.enum(["agent","chat","query"]).describe("Build mode"),providerId:f.z.string().optional()}),he=f.z.object({sessionId:i,context:f.z.object({messages:f.z.array(w),system:f.z.array(f.z.string()),metadata:f.z.record(f.z.string(),f.z.unknown())}).describe("Built context")}),ye=f.z.object({gatewayID:f.z.string().describe("Gateway ID"),messageId:u,message:f.z.unknown().describe("Received message")}),xe=f.z.object({gatewayID:f.z.string(),messageId:u,message:f.z.unknown(),sessionId:i.optional()}),Se=f.z.object({gatewayID:f.z.string(),messageId:u,result:f.z.unknown().optional()}),Ie=f.z.object({gatewayID:f.z.string(),messageId:u,message:f.z.unknown(),target:f.z.string().optional().describe("Send target")}),ke=f.z.object({gatewayID:f.z.string(),messageId:u,sessionId:i.optional(),channel:f.z.object({platform:f.z.string(),channelId:f.z.string()}),timestamp:f.z.number().describe("Delivery timestamp")}),Te=f.z.object({gatewayID:f.z.string(),messageId:u,sessionId:i.optional(),channel:f.z.object({platform:f.z.string(),channelId:f.z.string()}),timestamp:f.z.number().describe("Read timestamp")}),Pe=f.z.object({type:f.z.literal("command"),config:f.z.object({command:f.z.string(),arguments:f.z.union([f.z.string(),f.z.record(f.z.string(),f.z.unknown())]).optional()})}),Ce=f.z.object({type:f.z.literal("heartbeat"),parts:f.z.array(f.z.unknown()),system:f.z.string().optional(),config:f.z.object({session:f.z.string().optional(),mode:f.z.enum(["session","fork"]).optional(),agent:f.z.string().optional(),model:f.z.string().optional().describe("Model identifier in provider/model format"),tools:f.z.record(f.z.string(),f.z.boolean()).optional()}).optional()}),Ee=f.z.object({type:f.z.literal("scheduler"),parts:f.z.array(f.z.unknown()),system:f.z.string().optional(),config:f.z.object({agentType:f.z.string().optional(),transport:f.z.enum(["stdio","http","websocket","cli"]).optional(),model:f.z.string().optional(),tools:f.z.record(f.z.string(),f.z.boolean()).optional()}).optional()}),Ae=f.z.object({taskId:f.z.string().describe("Heartbeat task ID"),timestamp:f.z.number().describe("Heartbeat timestamp"),name:f.z.string().optional().describe("Heartbeat name"),definition:Ce.optional()}),ve=f.z.object({taskId:f.z.string().describe("Heartbeat task ID"),sessionId:i.optional(),timestamp:f.z.number(),duration:f.z.number().nonnegative().optional(),success:f.z.boolean().optional(),error:f.z.string().optional()}),Re=f.z.object({taskId:f.z.string().describe("Task ID"),taskName:f.z.string().optional(),timestamp:f.z.number(),payload:f.z.record(f.z.string(),f.z.unknown()).optional(),definition:Ee.optional()}),Me=f.z.object({taskId:f.z.string(),timestamp:f.z.number(),success:f.z.boolean(),result:f.z.record(f.z.string(),f.z.unknown()).optional(),error:f.z.string().optional()}),we=f.z.object({taskId:f.z.string().describe("Command task unique identifier"),taskName:f.z.string().describe("Command task name"),command:f.z.string().describe("Command name"),arguments:f.z.union([f.z.string(),f.z.record(f.z.string(),f.z.unknown())]).optional().describe("Command arguments"),timestamp:f.z.number().describe("Trigger timestamp"),definition:Pe.optional()}),je=f.z.object({taskId:f.z.string(),timestamp:f.z.number(),success:f.z.boolean(),output:f.z.string().optional(),error:f.z.string().optional(),duration:f.z.number().describe("Execution duration in milliseconds")}),T=f.z.enum(["tool","scheduler","cli","api"]),He=f.z.object({taskId:f.z.string().describe("Task unique identifier"),sessionId:f.z.string().describe("Session ID for this task"),source:T.describe("Task source: tool, scheduler, cli, api"),agentType:f.z.string().describe("Agent type to execute this task"),description:f.z.string().describe("Task description"),prompt:f.z.string().describe("Task prompt content"),timeout:f.z.number().positive().optional().describe("Task timeout in milliseconds")}),De=f.z.object({taskId:f.z.string().describe("Task unique identifier"),sessionId:f.z.string().describe("Session ID for this task"),source:T.describe("Task source: tool, scheduler, cli, api")}),ze=f.z.object({taskId:f.z.string(),sessionId:f.z.string(),source:T,step:f.z.number().describe("Current step number"),totalSteps:f.z.number().optional().describe("Total number of steps"),output:f.z.string().describe("Progress output content"),timestamp:f.z.number().describe("Progress timestamp")}),$e=f.z.object({taskId:f.z.string(),sessionId:f.z.string(),source:T,result:f.z.string().describe("Task result content"),duration:f.z.number().nonnegative().describe("Task duration in milliseconds"),attachments:f.z.array(f.z.unknown()).optional().describe("Task result attachments"),error:f.z.string().optional().describe("Error message if task failed"),agentType:f.z.string().optional().describe("Agent type that executed the task"),metadata:f.z.record(f.z.string(),f.z.unknown()).optional().describe("Additional metadata for the task result")}),Le=f.z.object({sessionId:f.z.string().describe("Session ID"),step:f.z.number().describe("Current step number"),lastUserId:f.z.string().describe("Last user message ID"),result:f.z.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),Oe=f.z.object({sessionId:f.z.string().describe("Session ID"),step:f.z.number().describe("Current step number"),lastUserId:f.z.string().describe("Last user message ID"),result:f.z.enum(["stop","continue"]).describe("Loop result: stop or continue")}),Fe=f.z.object({requestId:f.z.string(),kind:f.z.enum(["create-skill","create-workflow","create-bundle"]),requirement:f.z.string(),hints:f.z.array(f.z.string()),origin:f.z.object({source:f.z.enum(["human","tool","scheduler","namespace"]).optional(),timestamp:f.z.number().int().nonnegative()})}),_e=f.z.object({requestId:f.z.string(),status:f.z.enum(["success","failed"]),specId:f.z.string().optional(),durationMs:f.z.number().int().nonnegative(),error:f.z.string().optional()}),Ge=f.z.object({dryRun:f.z.boolean()}),Ne=f.z.object({status:f.z.enum(["success","failed","awaiting-approval"]),applied:f.z.number().int().nonnegative().optional(),awaitingApproval:f.z.number().int().nonnegative().optional(),error:f.z.string().optional()}),p=f.z.object({streamId:f.z.string().describe("Unique id of one stream invocation"),step:f.z.number().int().nonnegative().describe("Step index (1-based, 0 before first step)"),agent:f.z.string().describe("Agent name that initiated this stream invocation"),sessionId:f.z.string().describe("Session id passed in by the application layer"),messageId:u.describe("Assistant message id created by the processor, constant within one process() call"),userMessageId:u.describe("User message id that triggered this response, equals assistant.parentId"),model:k}),l={partId:U.describe("Part id allocated and maintained by the processor")},qe=p,Be=p.extend(l),Ue=p.extend({...l,reasoningId:f.z.string().describe("Provider-side reasoning block id"),text:f.z.string().describe("Reasoning text so far (empty at start)")}),Ve=p.extend({...l,reasoningId:f.z.string().describe("Provider-side reasoning block id"),delta:f.z.string().describe("Incremental reasoning text"),text:f.z.string().describe("Accumulated reasoning text")}),We=p.extend({...l,reasoningId:f.z.string().describe("Provider-side reasoning block id"),text:f.z.string().describe("Accumulated reasoning text (trimmed)")}),Ke=p.extend({...l,callId:g,tool:f.z.string().describe("Tool name")}),Ze=p.extend({...l,callId:g,tool:f.z.string().describe("Tool name"),args:b}),Ye=p.extend({...l,callId:g,tool:f.z.string().describe("Tool name"),args:b,title:f.z.string().optional().describe("Result title"),output:f.z.unknown().describe("Tool output payload"),metadata:f.z.record(f.z.string(),f.z.unknown()).optional(),durationMs:f.z.number().nonnegative().describe("Tool execution duration")}),Xe=p.extend({...l,callId:g,tool:f.z.string().describe("Tool name"),args:b,error:f.z.string().describe("Error message"),errorName:f.z.string().optional().describe("Named error name"),durationMs:f.z.number().nonnegative().describe("Tool execution duration")}),Je=p.extend({...l,reason:f.z.string().optional().describe("Finish reason reported by provider"),tokens:types.UsageSchema.optional().describe("Normalized token usage"),cost:f.z.number().nonnegative().optional().describe("Estimated cost of this step")}),Qe=p.extend({...l,text:f.z.string().describe("Text so far (empty at start)")}),et=p.extend({...l,delta:f.z.string().describe("Incremental text"),text:f.z.string().describe("Accumulated text")}),tt=p.extend({...l,text:f.z.string().describe("Accumulated text (trimmed)")}),ot=p.extend({error:f.z.string().describe("Error message"),errorName:f.z.string().optional().describe("Named error name"),aborted:f.z.boolean().optional().describe("Whether aborted by signal")}),nt=p.extend({result:f.z.enum(["stop","continue","compact"]).describe("Processor loop verdict"),cost:f.z.number().nonnegative().optional().describe("Accumulated cost of this stream"),tokens:f.z.number().nonnegative().optional().describe("Accumulated tokens of this stream")}),P={[r.SessionStart]:W,[r.SessionEnd]:K,[r.SessionCompacting]:Z,[r.SessionCompact]:Y,[r.MessageReceive]:J,[r.MessageTransform]:Q,[r.SystemTransform]:ee,[r.ToolBefore]:oe,[r.ToolAfter]:ne,[r.ToolFailure]:re,[r.ToolDefinition]:se,[r.CommandBefore]:ie,[r.CommandAfter]:ae,[r.PermissionAsk]:ue,[r.PermissionDenied]:me,[r.LlmParams]:de,[r.LlmHeaders]:ge,[r.ShellEnv]:fe,[r.ContextBuildBefore]:be,[r.ContextBuildAfter]:he,[r.GatewayMessageReceive]:ye,[r.GatewayMessageProcess]:xe,[r.GatewayMessageComplete]:Se,[r.GatewayMessageSend]:Ie,[r.GatewayMessageDelivered]:ke,[r.GatewayMessageRead]:Te,[r.HeartbeatTrigger]:Ae,[r.HeartbeatComplete]:ve,[r.ScheduledTaskTrigger]:Re,[r.ScheduledTaskComplete]:Me,[r.CommandTrigger]:we,[r.CommandComplete]:je,[r.TaskStart]:He,[r.TaskRunning]:De,[r.TaskProgress]:ze,[r.TaskComplete]:$e,[r.LoopStart]:Le,[r.LoopEnd]:Oe,[r.ProcessorStart]:qe,[r.ProcessorStepStart]:Be,[r.ProcessorReasoningStart]:Ue,[r.ProcessorReasoningDelta]:Ve,[r.ProcessorReasoningEnd]:We,[r.ProcessorToolInputStart]:Ke,[r.ProcessorToolCall]:Ze,[r.ProcessorToolResult]:Ye,[r.ProcessorToolError]:Xe,[r.ProcessorStepFinish]:Je,[r.ProcessorTextStart]:Qe,[r.ProcessorTextDelta]:et,[r.ProcessorTextEnd]:tt,[r.ProcessorError]:ot,[r.ProcessorFinish]:nt,[r.CreationRequest]:Fe,[r.CreationComplete]:_e,[r.EvolutionRequest]:Ge,[r.EvolutionComplete]:Ne};function Ft(t){return P[t]}function _t(t,n){let o=P[t];if(!o)throw new Error(`No schema found for event: ${t}`);return o.parse(n)}function Gt(t,n){let o=P[t];return o?o.safeParse(n):{success:false,error:new f.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${t}`}])}}var yo=f.z.enum(["subagent","primary","all"]),xo=f.z.enum(["general","coder","all"]),So=types.AgentInfoSchema;var Ao=f.z.object({name:f.z.string().min(1).describe("Unique skill name"),description:f.z.string().min(1).describe("When to use this skill"),scope:f.z.enum(["general","coder","all"]).optional().describe("Context mode scope")}),vo=f.z.object({agent:f.z.object({name:f.z.string().describe("Agent name"),model:f.z.string().optional().describe("Agent model in provider/model format")}).optional().describe("Agent context")}),Ro=f.z.object({isEnabled:f.z.boolean().optional().describe("Is enabled check result")});var D=/^[a-z0-9][a-z0-9._-]{1,63}$/,st=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,C=["hooks","commands","tools","agents","skills","auth","event","config"],it=C,at=["fail-open","fail-closed"],pt=[".mjs",".js",".cjs"],Oo=["default","Plugin","plugin"],ct=["command","prompt","http","agent","function"],ut=["commands","tools","agents","skills"],mt=["event","config"];function y(t){return typeof t=="string"&&D.test(t)}function lt(t){if(typeof t!="string"||!t.startsWith("./"))return false;let n=t.slice(2);return n.length===0||n.includes("\\")||n.split("/").some(s=>s.length===0||s==="."||s==="..")?false:pt.some(s=>n.endsWith(s))}var dt=f__default.default.object({name:f__default.default.string().regex(D,"plugin name must match ^[a-z0-9][a-z0-9._-]{1,63}$"),version:f__default.default.string().regex(st,"plugin version must be SemVer x.y.z").optional(),description:f__default.default.string().max(200,"plugin description must be at most 200 characters").optional(),entry:f__default.default.string().refine(lt,"plugin entry must be a safe relative .mjs/.js/.cjs path").optional(),capabilities:f__default.default.array(f__default.default.enum(C)).optional(),skills:f__default.default.array(f__default.default.string()).optional()});function Fo(t){let n=dt.safeParse(t);return n.success?{ok:true,manifest:n.data}:{ok:false,errors:n.error.issues.map(o=>`${o.path.length>0?o.path.join("."):"<root>"}: ${o.message}`)}}function c(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function gt(t){return c(t)&&typeof t.safeParse=="function"}function ft(t){return typeof t=="number"&&Number.isFinite(t)&&t>=0}function bt(t){if(!Array.isArray(t))return "plugin.hooks must be an array";for(let[n,o]of t.entries()){if(!c(o))return `plugin.hooks[${n}] must be an object`;if(typeof o.event!="string"||!A.includes(o.event))return `plugin.hooks[${n}].event must be a HookEvent value`;if(o.matcher!==void 0&&typeof o.matcher!="string")return `plugin.hooks[${n}].matcher must be a string`;if(o.priority!==void 0&&typeof o.priority!="number")return `plugin.hooks[${n}].priority must be a number`;if(o.timeoutMs!==void 0&&!ft(o.timeoutMs))return `plugin.hooks[${n}].timeoutMs must be a non-negative number`;if(o.failurePolicy!==void 0&&!at.includes(o.failurePolicy))return `plugin.hooks[${n}].failurePolicy must be fail-open or fail-closed`;if(!Array.isArray(o.hooks))return `plugin.hooks[${n}].hooks must be an array`;if(o.hooks.length===0)return `plugin.hooks[${n}].hooks must not be empty`;for(let[s,a]of o.hooks.entries()){if(!c(a)||typeof a.type!="string")return `plugin.hooks[${n}].hooks[${s}] must be a hook executor object`;if(!ct.includes(a.type))return `plugin.hooks[${n}].hooks[${s}].type is unknown: ${a.type}`;if(a.type==="function"&&typeof a.handler!="function")return `plugin.hooks[${n}].hooks[${s}].handler must be a function`}}return null}function ht(t){for(let[n,o]of Object.entries(t)){if(!y(n))return `plugin.tools key "${n}" must match the plugin id pattern`;if(!c(o))return `plugin.tools.${n} must be an object`;if(typeof o.description!="string"||o.description.length===0)return `plugin.tools.${n}.description must be a non-empty string`;if(!c(o.args))return `plugin.tools.${n}.args must be a Zod schema map`;for(let[s,a]of Object.entries(o.args))if(!gt(a))return `plugin.tools.${n}.args.${s} must be a Zod schema`;if(typeof o.execute!="function")return `plugin.tools.${n}.execute must be a function`}return null}function yt(t){for(let[n,o]of Object.entries(t)){if(!y(n))return `plugin.commands key "${n}" must match the plugin id pattern`;if(!c(o))return `plugin.commands.${n} must be an object`;if(typeof o.name!="string"||o.name.length===0)return `plugin.commands.${n}.name must be a non-empty string`;if(o.name!==n)return `plugin.commands.${n}.name must equal its map key`;if(typeof o.execute!="function")return `plugin.commands.${n}.execute must be a function`}return null}function xt(t){for(let[n,o]of Object.entries(t)){if(!y(n))return `plugin.agents key "${n}" must match the plugin id pattern`;if(!c(o)||typeof o.name!="string"||o.name.length===0)return `plugin.agents.${n}.name must be a non-empty string`}return null}function St(t){for(let[n,o]of Object.entries(t)){if(!y(n))return `plugin.skills key "${n}" must match the plugin id pattern`;if(!c(o))return `plugin.skills.${n} must be an object`;if(typeof o.name!="string"||o.name.length===0)return `plugin.skills.${n}.name must be a non-empty string`;if(o.name!==n)return `plugin.skills.${n}.name must equal its map key`;if(typeof o.description!="string"||o.description.length===0)return `plugin.skills.${n}.description must be a non-empty string`}return null}function It(t,n){if(!c(t))return `${n} must be an object`;if(t.type!=="text"&&t.type!=="select")return `${n}.type must be text or select`;if(typeof t.key!="string"||t.key.length===0)return `${n}.key must be a non-empty string`;if(typeof t.message!="string"||t.message.length===0)return `${n}.message must be a non-empty string`;if(t.type==="text"&&t.validate!==void 0&&typeof t.validate!="function")return `${n}.validate must be a function`;if(t.type==="select"){if(!Array.isArray(t.options))return `${n}.options must be an array`;for(let o of t.options)if(!c(o)||typeof o.label!="string"||typeof o.value!="string")return `${n}.options entries must have string label and value`}return t.condition!==void 0&&typeof t.condition!="function"?`${n}.condition must be a function`:null}function kt(t){if(!c(t))return "plugin.auth must be an object";if(typeof t.provider!="string"||!y(t.provider))return "plugin.auth.provider must be a non-empty plugin id";if(t.loader!==void 0&&typeof t.loader!="function")return "plugin.auth.loader must be a function";if(!Array.isArray(t.methods))return "plugin.auth.methods must be an array";for(let[n,o]of t.methods.entries()){let s=`plugin.auth.methods[${n}]`;if(!c(o))return `${s} must be an object`;if(o.type!=="oauth"&&o.type!=="api")return `${s}.type must be oauth or api`;if(typeof o.label!="string"||o.label.length===0)return `${s}.label must be a non-empty string`;if(o.prompts!==void 0){if(!Array.isArray(o.prompts))return `${s}.prompts must be an array`;for(let[a,x]of o.prompts.entries()){let E=It(x,`${s}.prompts[${a}]`);if(E)return E}}if(o.type==="oauth"&&typeof o.authorize!="function")return `${s}.authorize must be a function for oauth methods`;if(o.type==="api"&&o.authorize!==void 0&&typeof o.authorize!="function")return `${s}.authorize must be a function`}return null}var Tt={commands:yt,tools:ht,agents:xt,skills:St};function Pt(t){return C.filter(n=>t[n]!==void 0)}function _o(t,n){if(!c(t))return {ok:false,reason:"plugin returned non-object value"};for(let s of Object.keys(t))if(!it.includes(s))return {ok:false,reason:`plugin.${s} is not a supported definition field`};let o=Pt(t);if(o.length===0)return {ok:false,reason:"plugin definition must declare at least one capability"};if(t.hooks!==void 0){let s=bt(t.hooks);if(s)return {ok:false,reason:s}}for(let s of ut){let a=t[s];if(a===void 0)continue;if(!c(a))return {ok:false,reason:`plugin.${s} must be a plain object map`};let x=Tt[s](a);if(x)return {ok:false,reason:x}}for(let s of mt){let a=t[s];if(a!==void 0&&typeof a!="function")return {ok:false,reason:`plugin.${s} must be a function`}}if(t.auth!==void 0){let s=kt(t.auth);if(s)return {ok:false,reason:s}}if(n?.capabilities!==void 0){let s=new Set(n.capabilities);for(let a of o)if(!s.has(a))return {ok:false,reason:`plugin.${a} is not declared in plugin.json capabilities`};for(let a of s)if(!o.includes(a))return {ok:false,reason:`plugin.json declares capability ${a} but definition omits it`}}return {ok:true}}Object.defineProperty(exports,"AgentInfoSchema",{enumerable:true,get:function(){return types.AgentInfoSchema}});Object.defineProperty(exports,"AgentModelSchema",{enumerable:true,get:function(){return types.AgentModelSchema}});Object.defineProperty(exports,"AgentPermissionSchema",{enumerable:true,get:function(){return types.AgentPermissionSchema}});Object.defineProperty(exports,"CommandArgumentsSchema",{enumerable:true,get:function(){return types.CommandArgumentsSchema}});Object.defineProperty(exports,"CommandConfigInfoSchema",{enumerable:true,get:function(){return types.CommandConfigInfoSchema}});Object.defineProperty(exports,"CommandExecuteResultMetadataSchema",{enumerable:true,get:function(){return types.CommandExecuteResultMetadataSchema}});Object.defineProperty(exports,"CommandExecuteResultSchema",{enumerable:true,get:function(){return types.CommandExecuteResultSchema}});Object.defineProperty(exports,"CommandExecutionContextSchema",{enumerable:true,get:function(){return types.CommandExecutionContextSchema}});Object.defineProperty(exports,"CommandInfoSchema",{enumerable:true,get:function(){return types.CommandInfoSchema}});Object.defineProperty(exports,"CommandInitContextSchema",{enumerable:true,get:function(){return types.CommandInitContextSchema}});Object.defineProperty(exports,"CommandInitResultSchema",{enumerable:true,get:function(){return types.CommandInitResultSchema}});Object.defineProperty(exports,"CommandMetadataSchema",{enumerable:true,get:function(){return types.CommandMetadataSchema}});Object.defineProperty(exports,"CommandPromptPartSchema",{enumerable:true,get:function(){return types.CommandPromptPartSchema}});Object.defineProperty(exports,"CommandSourceSchema",{enumerable:true,get:function(){return types.CommandSourceSchema}});Object.defineProperty(exports,"PermissionActionSchema",{enumerable:true,get:function(){return types.PermissionActionSchema}});Object.defineProperty(exports,"PermissionRuleSchema",{enumerable:true,get:function(){return types.PermissionRuleSchema}});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=G;exports.AgentMetadataSchema=So;exports.AgentModeSchema=yo;exports.AgentSchema=I;exports.AgentScopeSchema=xo;exports.CallIDSchema=g;exports.CommandAfterInputSchema=ae;exports.CommandBeforeInputSchema=ie;exports.CommandCompleteInputSchema=je;exports.CommandExecutorSchema=O;exports.CommandTaskDefinitionSchema=Pe;exports.CommandTriggerInputSchema=we;exports.ContentPartSchema=M;exports.ContextBuildAfterInputSchema=he;exports.ContextBuildBeforeInputSchema=be;exports.CreationCompleteInputSchema=_e;exports.CreationRequestInputSchema=Fe;exports.CwdSchema=R;exports.EndReasonSchema=V;exports.EventInputSchemas=P;exports.EvolutionCompleteInputSchema=Ne;exports.EvolutionRequestInputSchema=Ge;exports.FinishReasonSchema=Ot;exports.FunctionExecutorSchema=N;exports.GatewayMessageCompleteInputSchema=Se;exports.GatewayMessageDeliveredInputSchema=ke;exports.GatewayMessageProcessInputSchema=xe;exports.GatewayMessageReadInputSchema=Te;exports.GatewayMessageReceiveInputSchema=ye;exports.GatewayMessageSendInputSchema=Ie;exports.HOOK_EVENTS=A;exports.HeartbeatCompleteInputSchema=ve;exports.HeartbeatTaskDefinitionSchema=Ce;exports.HeartbeatTriggerInputSchema=Ae;exports.HookEvent=r;exports.HookExecutorSchema=q;exports.HookMatcherSchema=B;exports.HookType=h;exports.HooksConfigSchema=Lt;exports.HttpExecutorSchema=_;exports.LlmHeadersInputSchema=ge;exports.LlmParamsInputSchema=de;exports.LlmParamsSchema=le;exports.LlmProviderSchema=j;exports.LoopEndInputSchema=Oe;exports.LoopStartInputSchema=Le;exports.MessageIDSchema=u;exports.MessageReceiveInputSchema=J;exports.MessageRoleSchema=X;exports.MessageSchema=w;exports.MessageTransformInputSchema=Q;exports.ModelObjectSchema=v;exports.ModelSchema=k;exports.PLUGIN_CAPABILITIES=C;exports.PLUGIN_DEFINITION_KEYS=it;exports.PLUGIN_ENTRY_EXTENSIONS=pt;exports.PLUGIN_ENTRY_NAMES=Oo;exports.PLUGIN_HOOK_EXECUTOR_TYPES=ct;exports.PLUGIN_HOOK_FAILURE_POLICIES=at;exports.PLUGIN_ID_PATTERN=D;exports.PLUGIN_VERSION_PATTERN=st;exports.PartIDSchema=U;exports.PermissionAskInputSchema=ue;exports.PermissionDeniedInputSchema=me;exports.PermissionLevelSchema=pe;exports.PermissionRequestSchema=ce;exports.PluginManifestSchema=dt;exports.ProcessorErrorInputSchema=ot;exports.ProcessorFinishInputSchema=nt;exports.ProcessorReasoningDeltaInputSchema=Ve;exports.ProcessorReasoningEndInputSchema=We;exports.ProcessorReasoningStartInputSchema=Ue;exports.ProcessorStartInputSchema=qe;exports.ProcessorStepFinishInputSchema=Je;exports.ProcessorStepStartInputSchema=Be;exports.ProcessorTextDeltaInputSchema=et;exports.ProcessorTextEndInputSchema=tt;exports.ProcessorTextStartInputSchema=Qe;exports.ProcessorToolCallInputSchema=Ze;exports.ProcessorToolErrorInputSchema=Xe;exports.ProcessorToolInputStartInputSchema=Ke;exports.ProcessorToolResultInputSchema=Ye;exports.PromptExecutorSchema=F;exports.ScheduledTaskCompleteInputSchema=Me;exports.ScheduledTaskTriggerInputSchema=Re;exports.SchedulerTaskDefinitionSchema=Ee;exports.SessionCompactInputSchema=Y;exports.SessionCompactingInputSchema=Z;exports.SessionEndInputSchema=K;exports.SessionIDSchema=i;exports.SessionStartInputSchema=W;exports.ShellEnvInputSchema=fe;exports.SkillInitContextSchema=vo;exports.SkillInitResultSchema=Ro;exports.SkillMetadataSchema=Ao;exports.SystemTransformInputSchema=ee;exports.TaskCompleteInputSchema=$e;exports.TaskProgressInputSchema=ze;exports.TaskRunningInputSchema=De;exports.TaskSourceSchema=T;exports.TaskStartInputSchema=He;exports.ToolAfterInputSchema=ne;exports.ToolArgsSchema=b;exports.ToolBeforeInputSchema=oe;exports.ToolDefinitionInputSchema=se;exports.ToolFailureInputSchema=re;exports.ToolResultSchema=te;exports.getEventInputSchema=Ft;exports.isValidPluginEntry=lt;exports.isValidPluginId=y;exports.safeValidateHookInput=Gt;exports.tool=$;exports.validateHookInput=_t;exports.validatePluginDefinition=_o;exports.validatePluginManifest=Fo;
|