@easbot/plugin 0.3.37 → 0.3.40
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 +105 -19
- package/README.md +112 -28
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +452 -79
- package/dist/index.d.ts +452 -79
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/README.en.md
CHANGED
|
@@ -6,17 +6,18 @@ EASBot Plugin System — type contracts, manifest validation, and extension poin
|
|
|
6
6
|
|
|
7
7
|
## Version
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
9
|
+
v0.3.40
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- **Plugin contract**: `Plugin` / `PluginInput` / `PluginDefinition` (single source of truth for all extension points)
|
|
12
|
+
- **Plugin contract**: `Plugin` / `PluginInput` / `PluginDefinition` (single source of truth for all extension points; 10 capability fields + `extensions` escape hatch, see ADR 0155)
|
|
13
|
+
- **Lifecycle**: `PluginDefinition.setup?(ctx)` + `ctx.dispose(cb)` (initialize after capabilities are registered; host runs registered cleanups in reverse order on resetState)
|
|
13
14
|
- **Hook contract**: `HookEvent` / `HOOK_EVENTS` / `HookMatcher` (with `priority` / `timeoutMs` / `failurePolicy`) / 5 executor schemas / event input validation
|
|
14
15
|
- **Auth contract**: `AuthHook` / `AuthMethod` / `AuthPrompt` / `AuthOAuthResult` (OAuth and API methods)
|
|
15
|
-
- **Command & tool contract**: re-exports `CommandDefinition` / `ToolDefinition` from `@easbot/types
|
|
16
|
+
- **Command & tool contract**: re-exports `CommandDefinition` / `ToolDefinition` from `@easbot/types`; the `createTool` / `tool()` factories are **implemented in this package** (`args` accepts either a shape map or a full zod schema)
|
|
16
17
|
- **Manifest & validation**: `PluginManifestSchema` / `validatePluginManifest` / `validatePluginDefinition` (closed top-level fields, at least one capability, bidirectional `capabilities` check)
|
|
17
18
|
- **No marketplace**: the install-source catalog belongs to the `@easbot/agent` CLI layer; `PluginDefinition` does not declare this field
|
|
18
19
|
|
|
19
|
-
> ⚠️ This is
|
|
20
|
+
> ⚠️ This package is **contract-first**: type contracts are re-exported from `@easbot/types`, while the **implementation** of the `createTool` / `tool()` factories lives here (the types package must not carry function implementations — see [`spec/types-standard.md`](../../spec/types-standard.md) §3.8). 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).
|
|
20
21
|
|
|
21
22
|
## Installation
|
|
22
23
|
|
|
@@ -89,7 +90,20 @@ const myPlugin = async (): Promise<PluginDefinition> => ({
|
|
|
89
90
|
|
|
90
91
|
### Tool system
|
|
91
92
|
|
|
92
|
-
The real signature of `createTool` / `tool()` is `{ description, args, execute }` — there are **no** `name` / `parameters` fields.
|
|
93
|
+
The real signature of `createTool` / `tool()` is `{ description, args, execute }` — there are **no** `name` / `parameters` fields.
|
|
94
|
+
|
|
95
|
+
- **Two shapes for `args`**:
|
|
96
|
+
- **shape map** (`{ input: z.string() }`) — the host wraps it into `z.object(...)`;
|
|
97
|
+
- **full zod schema** (e.g. `z.discriminatedUnion('operation', [...])`) — the host forwards it
|
|
98
|
+
**as-is** to the model layer, so per-op required fields / ranges / `refine` cross-field rules
|
|
99
|
+
are enforced at parse time with no secondary validation inside the plugin.
|
|
100
|
+
- **Two return shapes for `execute`**:
|
|
101
|
+
- a bare `string` — the host normalizes it to `{ output: <string>, title: <toolId>, metadata: {} }`;
|
|
102
|
+
- a `ToolResult` (`{ output, title?, metadata? }`) — `title` / `metadata` are preserved.
|
|
103
|
+
|
|
104
|
+
> ⚠️ The tool definition **factories** (`createTool` / `tool()`) are implemented in this package
|
|
105
|
+
> rather than `@easbot/types`: `spec/types-standard.md` §3.8 forbids function implementations
|
|
106
|
+
> in the types package (the only exception being zero-logic schema factories).
|
|
93
107
|
|
|
94
108
|
```typescript
|
|
95
109
|
import { createTool } from '@easbot/plugin';
|
|
@@ -102,6 +116,22 @@ const tool = createTool({
|
|
|
102
116
|
});
|
|
103
117
|
```
|
|
104
118
|
|
|
119
|
+
Full zod schema shape (multi-operation dispatcher):
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { createTool } from '@easbot/plugin';
|
|
123
|
+
import { z } from 'zod';
|
|
124
|
+
|
|
125
|
+
const tool = createTool({
|
|
126
|
+
description: 'Operation dispatcher',
|
|
127
|
+
args: z.discriminatedUnion('operation', [
|
|
128
|
+
z.object({ operation: z.literal('read'), path: z.string() }),
|
|
129
|
+
z.object({ operation: z.literal('write'), path: z.string(), body: z.string() }),
|
|
130
|
+
]),
|
|
131
|
+
execute: async (args) => ({ output: `run ${args.operation}`, title: 'op' }),
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
105
135
|
## Manifest & Validation
|
|
106
136
|
|
|
107
137
|
Contract and executable checks for `plugin.json` (`spec/plugin-standard.md` §2.1 / §6):
|
|
@@ -111,7 +141,10 @@ Contract and executable checks for `plugin.json` (`spec/plugin-standard.md` §2.
|
|
|
111
141
|
| `PluginManifestSchema` / `PluginManifest` | Zod schema and type for `plugin.json` (`name` required) |
|
|
112
142
|
| `validatePluginManifest(input)` | Returns `{ ok: true; manifest }` or `{ ok: false; errors: string[] }` |
|
|
113
143
|
| `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` |
|
|
144
|
+
| `PLUGIN_CAPABILITIES` / `PLUGIN_DEFINITION_KEYS` | 10 capability types (incl. `mcpServers` / `setup`) and the closed set of `PluginDefinition` top-level fields (+ `extensions` escape hatch; see ADR 0155) |
|
|
145
|
+
| `PLUGIN_API_VERSION` / `satisfiesApiVersion` | Host contract version (currently `1.0.0`) and compatibility check against a plugin's `manifest.apiVersion` |
|
|
146
|
+
| `HOOK_EVENT_ALIASES` / `normalizeHookEvent` | Ecosystem event name normalization: strict equivalents (`PreToolUse` → `tool.before`); `UserPromptSubmit` / `Stop` map to native chain events (see below) |
|
|
147
|
+
| `HookEvent.UserPromptSubmit` / `HookEvent.Stop` | Claude Code compatible native events (chain): prompt submit (inject context / block) and turn end (`continue` for another round) |
|
|
115
148
|
| `PLUGIN_HOOK_FAILURE_POLICIES` | `fail-open` / `fail-closed` |
|
|
116
149
|
| `isValidPluginId(id)` / `PLUGIN_ID_PATTERN` | Plugin id naming: `^[a-z0-9][a-z0-9._-]{1,63}$` |
|
|
117
150
|
| `isValidPluginEntry(entry)` / `PLUGIN_ENTRY_EXTENSIONS` | Entry path safety (`./` prefix, no `..`, only `.mjs/.js/.cjs`) |
|
|
@@ -147,14 +180,67 @@ const definition = validatePluginDefinition(
|
|
|
147
180
|
|
|
148
181
|
### Hook contract
|
|
149
182
|
|
|
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
|
|
183
|
+
| Symbol | Description |
|
|
184
|
+
| --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
185
|
+
| `HookEvent` | Event constants (`domain.action.phase`, e.g. `HookEvent.SessionStart`) |
|
|
186
|
+
| `HOOK_EVENTS` | **Array** of event names (`Object.values(HookEvent)`), not an enum object |
|
|
187
|
+
| `HookMatcher` | `{ event, matcher?, hooks, priority?, timeoutMs?, failurePolicy? }`; `event` MUST be in `HOOK_EVENTS` |
|
|
188
|
+
| `HookDefinition` | Union of 5 executors: `command` / `prompt` / `http` / `agent` / `function` |
|
|
189
|
+
| `HookOutputWrapper` | `{ modified, input, output? }`; executors MUST return `{ success: false }` instead of throwing |
|
|
190
|
+
| `validateHookInput` / `safeValidateHookInput` / `getEventInputSchema` | Event input schema validation |
|
|
191
|
+
| `HookContext` | Host-injected execution context: base fields (`sessionId` / `agent` …) plus two **host capability entry points** `session(sessionId)` / `identity()` |
|
|
192
|
+
|
|
193
|
+
### Contract event admission (decision 0159)
|
|
194
|
+
|
|
195
|
+
**Contract event set ≡ host trigger point set** — every event in the contract has exactly one host
|
|
196
|
+
trigger point with a consumable payload. In other words: an event the host never triggers will **not**
|
|
197
|
+
appear in `HookEvent` (events with neither a trigger point nor a consumer are removed).
|
|
198
|
+
|
|
199
|
+
Before adding a contract event, MUST answer three questions:
|
|
200
|
+
|
|
201
|
+
| Question | If the answer is "no" |
|
|
202
|
+
| ---------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
203
|
+
| ① Where is the **single** trigger point? (multiple triggers = ambiguous semantics) | Converge to one trigger point |
|
|
204
|
+
| ② What can the host do with it? (**no payload = pure noise**) | Add the trigger point + payload |
|
|
205
|
+
| ③ What happens when the consumer fails / is not installed / does not apply? | Define the degradation (fail-open / fail-closed) |
|
|
206
|
+
|
|
207
|
+
The invariant is enforced by the host's `event-liveness` guard test
|
|
208
|
+
(`packages/agent/src/hook/__tests__/event-liveness.test.ts`): **adding a contract event without a
|
|
209
|
+
matching trigger point turns the test red**.
|
|
210
|
+
|
|
211
|
+
### Identity field semantics (`context.collect` channel)
|
|
212
|
+
|
|
213
|
+
The host exposes both **protocol ids** and **human-readable names** — plugins MUST pick the field that matches the meaning:
|
|
214
|
+
|
|
215
|
+
| Field | Meaning | Example | Typical use |
|
|
216
|
+
| ------------------------------- | --------------------------------------- | --------------------------- | -------------------------------- |
|
|
217
|
+
| `input.agentId` / `ctx.agentId` | Protocol-level agent **id** | `peer-xiao-mo` | Exact ownership (recall / write) |
|
|
218
|
+
| `input.agentName` / `ctx.agent` | Agent **name** | `小莫` | Display / per-name routing |
|
|
219
|
+
| `input.providerId` | Model **provider** id | `anthropic` | Per-vendor routing |
|
|
220
|
+
| `input.modelId` / `ctx.model` | **Model identifier** (`provider/model`) | `anthropic/claude-sonnet-4` | Per-model routing |
|
|
221
|
+
|
|
222
|
+
⚠️ `ctx.agent` is the **name** (not the id) and `ctx.model` is the **model identifier** (not the provider) — the host injects them with this meaning, and picking the wrong field breaks routing.
|
|
223
|
+
|
|
224
|
+
### Fragment id semantics (`context.collect`)
|
|
225
|
+
|
|
226
|
+
The host merges context fragments by `id` **globally** (across plugins): the same id is **overwritten** by the later one, different ids are appended in order.
|
|
227
|
+
Fragment ids MUST therefore be **globally unique** — name them `<plugin>:<purpose>` (e.g. `memory:recall`); two plugins using the same id overwrite each other (the earlier content is silently dropped — the host warns, but the content is already lost).
|
|
228
|
+
|
|
229
|
+
### Host capability entry points (`HookContext`)
|
|
230
|
+
|
|
231
|
+
Plugins cannot reach the agent core, but they can ask the host for capabilities through two **optional** entry points on `HookContext` — the contract lives in `@easbot/types` (pure interfaces, zero runtime dependencies) and the implementation is injected by the application layer (`@easbot/agent`) at the hook execution boundary.
|
|
232
|
+
|
|
233
|
+
| Entry point | Returns | Capability |
|
|
234
|
+
| --------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
235
|
+
| `ctx.session(sessionId)` | `SessionHandle` | Session read/write: `get` / `message` / `messagesByParent` / `stream` / `updateMessage` / `updatePart` |
|
|
236
|
+
| `ctx.session(id).lastAgent(msg?)` | `string` | The agent name behind the most recent turn; a passed current-turn user message wins |
|
|
237
|
+
| `ctx.session(id).lastModel(msg?)` | `AgentModel` | The model identifier of the most recent turn; a passed current-turn user message wins |
|
|
238
|
+
| `ctx.session(id).tools(opts?)` | `SessionTools` | The tool set **actually available** in this session (AI SDK shape): scope + permission filtering already applied, and each `execute` already carries the session context — hand it straight to `@easbot/llm`'s `generate({ tools })` |
|
|
239
|
+
| `ctx.identity()` | `IdentityHandle` | Identity capabilities: `protocol()` (identity protocol metadata + init state) / `staticPrompt()` (static prompt sections) / `environment()` (environment info fragments) |
|
|
240
|
+
|
|
241
|
+
⚠️ Both entry points are **optional** (`/undefined`) — legacy plugins and unit tests may not provide them, so hooks should degrade gracefully instead of dereferencing directly.
|
|
242
|
+
|
|
243
|
+
> **Why tool capabilities live on the session rather than a top-level `ctx.tools()`**: tool availability is decided by **session context** — scope filtering reads `session.contextMode`, permission filtering reads the session-level ruleset, and the execution context needs sessionId / directory. `@easbot/llm` only carries **pure tool definitions** (`Tool.Resolved`) and has no notion of a session, so the context has to be assembled by the host and is inseparable from the current session. Tools are therefore part of the session, not a separate top-level capability surface.
|
|
158
244
|
|
|
159
245
|
### Command types
|
|
160
246
|
|
|
@@ -172,11 +258,11 @@ See "Command system" above; single source of truth is `@easbot/types/native/comm
|
|
|
172
258
|
|
|
173
259
|
### createTool / tool
|
|
174
260
|
|
|
175
|
-
| Property | Type
|
|
176
|
-
| ------------- |
|
|
177
|
-
| `description` | `string`
|
|
178
|
-
| `args` | `
|
|
179
|
-
| `execute` | `(args, context) => Promise<string>` | ✅ required | Implementation;
|
|
261
|
+
| Property | Type | Required | Description |
|
|
262
|
+
| ------------- | -------------------------------------------------- | ----------- | ---------------------------------------------------------------------- |
|
|
263
|
+
| `description` | `string` | ✅ | Tool description |
|
|
264
|
+
| `args` | `ToolArgs` (shape map or full zod schema) | ✅ | Argument contract; a full schema is forwarded as-is, never flattened |
|
|
265
|
+
| `execute` | `(args, context) => Promise<string \| ToolResult>` | ✅ required | Implementation; returns a bare string or `{ output, title, metadata }` |
|
|
180
266
|
|
|
181
267
|
### Marketplace (outside this contract)
|
|
182
268
|
|
package/README.md
CHANGED
|
@@ -6,17 +6,18 @@ EASBot 插件系统 —— 类型契约、清单校验与扩展点定义
|
|
|
6
6
|
|
|
7
7
|
## 版本
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
9
|
+
v0.3.40
|
|
10
10
|
## 特性
|
|
11
11
|
|
|
12
|
-
- **插件契约**:`Plugin` / `PluginInput` / `PluginDefinition`(
|
|
12
|
+
- **插件契约**:`Plugin` / `PluginInput` / `PluginDefinition`(10 类能力字段的闭集 + `extensions` 逃生舱,唯一真值源;见 ADR 0155)
|
|
13
|
+
- **生命周期**:`PluginDefinition.setup?(ctx)` + `ctx.dispose(cb)`(能力注册完成后初始化,宿主 resetState 时逆序释放清理回调)
|
|
13
14
|
- **Hook 契约**:`HookEvent` / `HOOK_EVENTS` / `HookMatcher`(含 `priority` / `timeoutMs` / `failurePolicy`)/ 5 类执行器 Schema / 事件输入校验
|
|
14
15
|
- **Auth 契约**:`AuthHook` / `AuthMethod` / `AuthPrompt` / `AuthOAuthResult`(OAuth 与 API 两种认证方法)
|
|
15
|
-
- **命令与工具契约**:re-export `@easbot/types` 的 `CommandDefinition` / `ToolDefinition`(`execute`
|
|
16
|
+
- **命令与工具契约**:re-export `@easbot/types` 的 `CommandDefinition` / `ToolDefinition`(`execute` 必填);**本包实现** `createTool` / `tool()` 工具定义工厂(`args` 支持 shape map 与完整 zod schema 两种形态)
|
|
16
17
|
- **清单与校验**:`PluginManifestSchema` / `validatePluginManifest` / `validatePluginDefinition`(顶层闭集、至少一能力、`capabilities` 双向交叉校验)
|
|
17
18
|
- **不含 marketplace**:安装源 catalog 归 `@easbot/agent` CLI 层,`PluginDefinition` 不声明该字段
|
|
18
19
|
|
|
19
|
-
> ⚠️
|
|
20
|
+
> ⚠️ 本包以**契约**为主:类型契约 re-export 自 `@easbot/types`;工具定义工厂 `createTool` / `tool()` 的**实现**在本包(types 包不承载函数实现,见 [`spec/types-standard.md`](../../spec/types-standard.md) §3.8)。本包不提供 HookRegistry 实现、不加载插件、不注册能力。加载与注册由 `@easbot/agent/src/plugin/plugin.ts` 负责;完整规范见 [`spec/plugin-standard.md`](../../spec/plugin-standard.md)。
|
|
20
21
|
|
|
21
22
|
## 安装
|
|
22
23
|
|
|
@@ -90,7 +91,18 @@ const myPlugin = async (): Promise<PluginDefinition> => ({
|
|
|
90
91
|
|
|
91
92
|
### 工具系统
|
|
92
93
|
|
|
93
|
-
`createTool` / `tool()` 的真实签名是 `{ description, args, execute }`,**没有** `name` / `parameters`
|
|
94
|
+
`createTool` / `tool()` 的真实签名是 `{ description, args, execute }`,**没有** `name` / `parameters` 字段。
|
|
95
|
+
|
|
96
|
+
- **`args` 两种形态**:
|
|
97
|
+
- **shape map**(`{ input: z.string() }`)—— 宿主包装为 `z.object(...)`;
|
|
98
|
+
- **完整 zod schema**(如 `z.discriminatedUnion('operation', [...])`)—— 宿主**原样下发**给模型层,
|
|
99
|
+
per-op 的必填 / 取值范围 / `refine` 跨字段约束在参数解析阶段即生效,无需插件侧二次校验。
|
|
100
|
+
- **`execute` 两种返回形态**:
|
|
101
|
+
- 裸 `string` —— 宿主归一为 `{ output: <string>, title: <toolId>, metadata: {} }`;
|
|
102
|
+
- `ToolResult`(`{ output, title?, metadata? }`)—— 保留 `title` / `metadata`。
|
|
103
|
+
|
|
104
|
+
> ⚠️ 工具定义**工厂函数**(`createTool` / `tool()`)实现于本包而非 `@easbot/types`:
|
|
105
|
+
> `spec/types-standard.md` §3.8 规定 types 包不得承载函数实现(唯一例外是零逻辑的 schema 工厂)。
|
|
94
106
|
|
|
95
107
|
```typescript
|
|
96
108
|
import { createTool } from '@easbot/plugin';
|
|
@@ -103,20 +115,39 @@ const tool = createTool({
|
|
|
103
115
|
});
|
|
104
116
|
```
|
|
105
117
|
|
|
118
|
+
完整 zod schema 形态(多 op 分发):
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { createTool } from '@easbot/plugin';
|
|
122
|
+
import { z } from 'zod';
|
|
123
|
+
|
|
124
|
+
const tool = createTool({
|
|
125
|
+
description: 'Operation dispatcher',
|
|
126
|
+
args: z.discriminatedUnion('operation', [
|
|
127
|
+
z.object({ operation: z.literal('read'), path: z.string() }),
|
|
128
|
+
z.object({ operation: z.literal('write'), path: z.string(), body: z.string() }),
|
|
129
|
+
]),
|
|
130
|
+
execute: async (args) => ({ output: `run ${args.operation}`, title: 'op' }),
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
106
134
|
## 插件清单与校验
|
|
107
135
|
|
|
108
136
|
`plugin.json` 的契约与可执行检查(对应 `spec/plugin-standard.md` §2.1 / §6):
|
|
109
137
|
|
|
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` |
|
|
119
|
-
| `
|
|
138
|
+
| API | 说明 |
|
|
139
|
+
| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
140
|
+
| `PluginManifestSchema` / `PluginManifest` | `plugin.json` 的 Zod schema 与类型(`name` 必填) |
|
|
141
|
+
| `validatePluginManifest(input)` | 返回 `{ ok: true; manifest }` 或 `{ ok: false; errors: string[] }` |
|
|
142
|
+
| `validatePluginDefinition(def, options?)` | 校验入口返回的 `PluginDefinition`(宿主加载器 MUST 调用);`options.capabilities` 触发与 manifest 的双向交叉校验 |
|
|
143
|
+
| `isValidPluginId(id)` / `PLUGIN_ID_PATTERN` | 插件 id 命名:`^[a-z0-9][a-z0-9._-]{1,63}$` |
|
|
144
|
+
| `isValidPluginEntry(entry)` / `PLUGIN_ENTRY_EXTENSIONS` | 入口路径安全(`./` 开头、无 `..`、仅 `.mjs/.js/.cjs`) |
|
|
145
|
+
| `PLUGIN_ENTRY_NAMES` | 入口导出白名单 `default` / `Plugin` / `plugin` |
|
|
146
|
+
| `PLUGIN_CAPABILITIES` / `PLUGIN_DEFINITION_KEYS` | 10 类能力枚举(含 `mcpServers` / `setup`)与 `PluginDefinition` 顶层字段闭集(+ `extensions` 逃生舱) |
|
|
147
|
+
| `PLUGIN_API_VERSION` / `satisfiesApiVersion` | 宿主契约版本(当前 `1.0.0`)与插件 `manifest.apiVersion` 的兼容性判定 |
|
|
148
|
+
| `HOOK_EVENT_ALIASES` / `normalizeHookEvent` | 生态事件名归一化:`PreToolUse` → `tool.before` 等严格等价别名;`UserPromptSubmit` / `Stop` → 原生 chain 事件(见下) |
|
|
149
|
+
| `HookEvent.UserPromptSubmit` / `HookEvent.Stop` | Claude Code 兼容原生事件(chain 语义):prompt 提交(可注入上下文 / 阻止)、本轮结束(可 `continue` 再跑一轮) |
|
|
150
|
+
| `PLUGIN_HOOK_FAILURE_POLICIES` | hook 失败策略 `fail-open` / `fail-closed` |
|
|
120
151
|
|
|
121
152
|
```typescript
|
|
122
153
|
import { HookEvent, validatePluginManifest, validatePluginDefinition } from '@easbot/plugin';
|
|
@@ -148,14 +179,67 @@ const definition = validatePluginDefinition(
|
|
|
148
179
|
|
|
149
180
|
### Hook 契约
|
|
150
181
|
|
|
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 校验
|
|
182
|
+
| 符号 | 说明 |
|
|
183
|
+
| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
184
|
+
| `HookEvent` | 事件常量(`domain.action.phase` 三段式,如 `HookEvent.SessionStart`) |
|
|
185
|
+
| `HOOK_EVENTS` | 事件名**数组**(`Object.values(HookEvent)`,不是枚举对象) |
|
|
186
|
+
| `HookMatcher` | `{ event, matcher?, hooks, priority?, timeoutMs?, failurePolicy? }`;`event` MUST 命中 `HOOK_EVENTS` |
|
|
187
|
+
| `HookDefinition` | 5 类执行器联合:`command` / `prompt` / `http` / `agent` / `function` |
|
|
188
|
+
| `HookOutputWrapper` | `{ modified, input, output? }`;`output.denied: true` 表达 `fail-closed` 拒绝;禁止用 throw 表达业务拒绝 |
|
|
189
|
+
| `validateHookInput` / `safeValidateHookInput` / `getEventInputSchema` | 事件输入 Schema 校验 |
|
|
190
|
+
| `HookContext` | 宿主注入的执行上下文:基础字段(`sessionId` / `agent` …)+ 两个**宿主能力入口** `session(sessionId)` / `identity()` |
|
|
191
|
+
|
|
192
|
+
### 契约事件准入(决策 0159)
|
|
193
|
+
|
|
194
|
+
**契约事件集 ≡ 宿主触发点集** —— 契约里存在的事件,宿主必有唯一、正确、产物可消费的触发点。
|
|
195
|
+
反过来说:**宿主没有触发点的事件,不会出现在 `HookEvent` 里**(无埋点且无消费方的事件直接移除)。
|
|
196
|
+
|
|
197
|
+
新增契约事件前 MUST 回答三问:
|
|
198
|
+
|
|
199
|
+
| 问题 | 不合格的处理 |
|
|
200
|
+
| --------------------------------------------- | ----------------------------------- |
|
|
201
|
+
| ① **唯一时点**在哪?(多处触发 = 语义歧义) | 收敛到唯一触发点 |
|
|
202
|
+
| ② 宿主拿到它能做什么?(**无产物 = 纯噪音**) | 补埋点 + 补载荷 |
|
|
203
|
+
| ③ 消费方失败 / 未装 / 不适用时怎么办? | 定义降级(fail-open / fail-closed) |
|
|
204
|
+
|
|
205
|
+
该不变式由宿主的 `event-liveness` 守卫测试固化(`packages/agent/src/hook/__tests__/event-liveness.test.ts`):
|
|
206
|
+
**新增契约事件却没同步埋点 → 测试红灯**。
|
|
207
|
+
|
|
208
|
+
### 身份类字段语义(`context.collect` 通道)
|
|
209
|
+
|
|
210
|
+
宿主同时提供**协议 id** 与**人类可读名称**,插件 MUST 按语义取用,不要混用:
|
|
211
|
+
|
|
212
|
+
| 字段 | 语义 | 取值示例 | 典型用途 |
|
|
213
|
+
| ------------------------------- | -------------------------------- | --------------------------- | ----------------------- |
|
|
214
|
+
| `input.agentId` / `ctx.agentId` | 协议级 agent **id** | `peer-xiao-mo` | 精确归属(召回 / 写入) |
|
|
215
|
+
| `input.agentName` / `ctx.agent` | Agent **名称** | `小莫` | 展示 / 按名字分流 |
|
|
216
|
+
| `input.providerId` | 模型**提供商** id | `anthropic` | 按厂商分流 |
|
|
217
|
+
| `input.modelId` / `ctx.model` | **模型标识**(`provider/model`) | `anthropic/claude-sonnet-4` | 按模型分流 |
|
|
218
|
+
|
|
219
|
+
⚠️ `ctx.agent` = **名称**(不是 id)、`ctx.model` = **模型标识**(不是 provider)——
|
|
220
|
+
宿主按此口径注入,插件侧取错字段会导致分流判断失效。
|
|
221
|
+
|
|
222
|
+
### 片段 id 语义(`context.collect`)
|
|
223
|
+
|
|
224
|
+
宿主按片段 `id` **全局合并**(跨插件生效):同 id **后者覆盖**前者,不同 id 按序追加。
|
|
225
|
+
因此片段 id MUST **全局唯一**,建议按 `<插件名>:<用途>` 命名(如 `memory:recall`)——
|
|
226
|
+
同 id 跨插件会互相覆盖(先到者被静默丢弃,宿主会告警但内容仍已丢失)。
|
|
227
|
+
|
|
228
|
+
### 宿主能力入口(`HookContext`)
|
|
229
|
+
|
|
230
|
+
插件拿不到 agent 内核,但可以通过 `HookContext` 上的两个**可选**入口向宿主要能力 —— 契约在 `@easbot/types`(纯接口、零运行时依赖),实现由应用层(`@easbot/agent`)在 hook 执行边界统一注入。
|
|
231
|
+
|
|
232
|
+
| 入口 | 返回 | 能力 |
|
|
233
|
+
| --------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
234
|
+
| `ctx.session(sessionId)` | `SessionHandle` | 会话读写:`get` / `message` / `messagesByParent` / `stream` / `updateMessage` / `updatePart` |
|
|
235
|
+
| `ctx.session(id).lastAgent(msg?)` | `string` | 最近一次驱动会话的 agent 名;传入当前轮 user message 时优先取其携带值 |
|
|
236
|
+
| `ctx.session(id).lastModel(msg?)` | `AgentModel` | 最近一次使用的模型标识;传入当前轮 user message 时优先取其携带值 |
|
|
237
|
+
| `ctx.session(id).tools(opts?)` | `SessionTools` | 该会话**实际可用**的工具集(AI SDK 格式):已完成 scope + 权限过滤,`execute` 已装配会话上下文,可直接交给 `@easbot/llm` 的 `generate({ tools })` |
|
|
238
|
+
| `ctx.identity()` | `IdentityHandle` | 身份能力:`protocol()`(身份协议元数据 + 初始化状态)/ `staticPrompt()`(静态提示词段落)/ `environment()`(环境信息片段) |
|
|
239
|
+
|
|
240
|
+
⚠️ 两个入口都是**可选**(`/undefined`)—— 老插件与单测环境可能未提供,hook 应按业务需要降级处理,不要直接解引用。
|
|
241
|
+
|
|
242
|
+
> **为什么工具能力挂在 session 上,而不是顶层 `ctx.tools()`**:工具的可用性由**会话上下文**决定 —— scope 过滤看 `session.contextMode`、权限过滤看 session 级 ruleset、执行上下文要 sessionId / directory。`@easbot/llm` 只有**纯工具定义**(`Tool.Resolved`),没有 session 概念,上下文装配必须在宿主完成且离不开当前会话。因此工具是 session 的一部分,而非独立的顶层能力面。
|
|
159
243
|
|
|
160
244
|
### Command 类型
|
|
161
245
|
|
|
@@ -173,11 +257,11 @@ const definition = validatePluginDefinition(
|
|
|
173
257
|
|
|
174
258
|
### createTool / tool
|
|
175
259
|
|
|
176
|
-
| 属性 | 类型
|
|
177
|
-
| ------------- |
|
|
178
|
-
| `description` | `string`
|
|
179
|
-
| `args` | `
|
|
180
|
-
| `execute` | `(args, context) => Promise<string>` | ✅ 必填 |
|
|
260
|
+
| 属性 | 类型 | 必填 | 说明 |
|
|
261
|
+
| ------------- | -------------------------------------------------- | ------- | -------------------------------------------------------- |
|
|
262
|
+
| `description` | `string` | ✅ | 工具描述 |
|
|
263
|
+
| `args` | `ToolArgs`(shape map 或完整 zod schema) | ✅ | 参数契约;完整 schema 原样下发模型,不被压平 |
|
|
264
|
+
| `execute` | `(args, context) => Promise<string \| ToolResult>` | ✅ 必填 | 工具实现;返回裸 string 或 `{ output, title, metadata }` |
|
|
181
265
|
|
|
182
266
|
### Marketplace(不属于本包契约)
|
|
183
267
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
'use strict';var b=require('zod'),types=require('@easbot/types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var b__default=/*#__PURE__*/_interopDefault(b);function Kt(o){return {description:o.description,args:o.args,execute:o.execute,isEnabled:o.isEnabled}}function W(o){return {description:o.description,args:o.args,execute:o.execute,isEnabled:o.isEnabled}}W.schema=b__default.default;var k={Command:"command",Prompt:"prompt",Http:"http",Agent:"agent",Function:"function"},t={SessionStart:"session.start",SessionEnd:"session.end",SessionCompacting:"session.compacting",SessionCompact:"session.compact",SessionInterrupt:"session.interrupt",MessageReceive:"message.receive",UserPromptSubmit:"user.prompt.submit",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",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",ContextCollect:"context.collect",Stop:"agent.stop",TaskStart:"task.start",TaskRunning:"task.running",TaskProgress:"task.progress",TaskComplete:"task.complete",LoopStart:"loop.start",LoopEnd:"loop.end",SubagentStart:"subagent.start",SubagentStop:"subagent.stop",Notification:"notification",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",ProjectTrust:"project.trust",CreationRequest:"creation.request",CreationComplete:"creation.complete"},Z={UserPromptSubmit:t.UserPromptSubmit,Stop:t.Stop,PreToolUse:t.ToolBefore,PostToolUse:t.ToolAfter,PostToolUseFailure:t.ToolFailure,SessionStart:t.SessionStart,SessionEnd:t.SessionEnd,PreCompact:t.SessionCompacting,PostCompact:t.SessionCompact,SubagentStart:t.SubagentStart,SubagentStop:t.SubagentStop,Notification:t.Notification,StopCancelled:t.SessionInterrupt};function j(o){return R.includes(o)?o:Z[o]??o}var R=Object.values(t),z={[t.SessionStart]:"chain",[t.SessionEnd]:"collect",[t.SessionCompacting]:"chain",[t.SessionCompact]:"chain",[t.SessionInterrupt]:"collect",[t.MessageReceive]:"collect",[t.UserPromptSubmit]:"chain",[t.MessageTransform]:"chain",[t.SystemTransform]:"chain",[t.ToolBefore]:"chain",[t.ToolAfter]:"chain",[t.ToolFailure]:"collect",[t.ToolDefinition]:"chain",[t.CommandBefore]:"chain",[t.CommandAfter]:"chain",[t.PermissionAsk]:"chain",[t.LlmParams]:"chain",[t.LlmHeaders]:"chain",[t.ShellEnv]:"chain",[t.GatewayMessageReceive]:"collect",[t.GatewayMessageProcess]:"chain",[t.GatewayMessageComplete]:"collect",[t.GatewayMessageSend]:"chain",[t.GatewayMessageDelivered]:"collect",[t.GatewayMessageRead]:"collect",[t.HeartbeatTrigger]:"chain",[t.HeartbeatComplete]:"chain",[t.ScheduledTaskTrigger]:"chain",[t.ScheduledTaskComplete]:"chain",[t.CommandTrigger]:"chain",[t.CommandComplete]:"chain",[t.ContextBuildBefore]:"chain",[t.ContextBuildAfter]:"chain",[t.ContextCollect]:"collect",[t.Stop]:"chain",[t.TaskStart]:"chain",[t.TaskRunning]:"chain",[t.TaskProgress]:"chain",[t.TaskComplete]:"chain",[t.LoopStart]:"chain",[t.LoopEnd]:"chain",[t.SubagentStart]:"collect",[t.SubagentStop]:"collect",[t.Notification]:"collect",[t.ProcessorStart]:"chain",[t.ProcessorStepStart]:"chain",[t.ProcessorReasoningStart]:"collect",[t.ProcessorReasoningDelta]:"collect",[t.ProcessorReasoningEnd]:"collect",[t.ProcessorToolInputStart]:"collect",[t.ProcessorToolCall]:"collect",[t.ProcessorToolResult]:"collect",[t.ProcessorToolError]:"chain",[t.ProcessorStepFinish]:"chain",[t.ProcessorTextStart]:"collect",[t.ProcessorTextDelta]:"collect",[t.ProcessorTextEnd]:"collect",[t.ProcessorError]:"chain",[t.ProcessorFinish]:"chain",[t.ProjectTrust]:"collect",[t.CreationRequest]:"chain",[t.CreationComplete]:"chain"};function Qt(o){return z[o]}function eo(o){return z[o]==="collect"}var v=b.z.string().optional(),J=b.z.object({type:b.z.literal(k.Command),command:b.z.string(),if:v,shell:b.z.enum(["bash","powershell"]).optional(),timeout:b.z.number().positive().optional(),statusMessage:b.z.string().optional(),once:b.z.boolean().optional(),async:b.z.boolean().optional(),allowedEnvVars:b.z.array(b.z.string()).optional()}),Q=b.z.object({type:b.z.literal(k.Prompt),if:v,timeout:b.z.number().positive().optional(),model:b.z.string().optional().describe("Model identifier in provider/model format"),statusMessage:b.z.string().optional(),once:b.z.boolean().optional(),runMode:b.z.enum(["session","fork"]).optional(),system:b.z.string().optional(),parts:b.z.array(b.z.unknown()),onMessage:b.z.custom(o=>typeof o=="function").optional()}),ee=b.z.object({type:b.z.literal(k.Http),url:b.z.string(),if:v,timeout:b.z.number().positive().optional(),method:b.z.enum(["GET","POST","PUT","DELETE"]).optional(),headers:b.z.record(b.z.string(),b.z.string()).optional(),allowedEnvVars:b.z.array(b.z.string()).optional(),statusMessage:b.z.string().optional(),once:b.z.boolean().optional()}),te=b.z.object({type:b.z.literal(k.Agent),if:v,timeout:b.z.number().positive().optional(),agent:b.z.string().optional(),model:b.z.string().optional().describe("Model identifier in provider/model format"),statusMessage:b.z.string().optional(),once:b.z.boolean().optional(),system:b.z.string().optional(),parts:b.z.array(b.z.unknown()),onMessage:b.z.custom(o=>typeof o=="function").optional()}),oe=b.z.object({type:b.z.literal(k.Function),handler:b.z.function()}),ne=b.z.discriminatedUnion("type",[J,Q,ee,te,oe]),re=b.z.object({event:b.z.string(),matcher:b.z.string().optional(),hooks:b.z.array(ne),priority:b.z.number().optional(),timeoutMs:b.z.number().nonnegative().optional(),failurePolicy:b.z.enum(["fail-open","fail-closed"]).optional()}),io=b.z.record(b.z.string(),b.z.array(re)),i=b.z.string().min(1).describe("Session unique identifier"),se=b.z.string().min(1).describe("Part unique identifier"),l=b.z.string().min(1).describe("Message unique identifier"),S=b.z.string().min(1).describe("Tool call unique identifier"),T=b.z.string().optional().describe("Agent name"),P=b.z.string().optional().describe("Model identifier"),O=b.z.object({providerId:b.z.string().describe("Provider ID"),modelId:b.z.string().describe("Model ID"),api:b.z.object({id:b.z.string().describe("API ID"),npm:b.z.string().optional().describe("NPM package name")}).optional().describe("API information")}).optional().describe("Model object"),A=b.z.string().optional().describe("Working directory path"),ie=b.z.enum(["user_request","max_tokens","stop","error","timeout","cancelled"]).describe("Session end reason"),ao=b.z.enum(["stop","max_tokens","end_turn","stop_sequence"]).describe("Step finish reason"),ae=b.z.object({sessionId:i,source:b.z.enum(["user","agent","system","scheduled"]).optional().describe("Session source"),model:P,agent:T,cwd:A}),pe=b.z.object({sessionId:i,reason:ie,duration:b.z.number().positive().optional().describe("Session duration in milliseconds")}),ce=b.z.object({sessionId:i,trigger:b.z.enum(["manual","auto","threshold"]).describe("Compaction trigger"),contextLength:b.z.number().positive().describe("Current context length"),threshold:b.z.number().positive().describe("Trigger threshold")}),ue=b.z.object({sessionId:i,summary:b.z.string().describe("Compaction summary"),previousLength:b.z.number().positive().describe("Previous context length"),newLength:b.z.number().positive().describe("New context length")}),le=b.z.enum(["user","assistant","system","tool"]),N=b.z.discriminatedUnion("type",[b.z.object({type:b.z.literal("text"),text:b.z.string().describe("Text content")}),b.z.object({type:b.z.literal("image"),source:b.z.object({type:b.z.enum(["base64","url"]),mime:b.z.string().optional().describe("File mime type"),data:b.z.string().describe("File base64 encoding data or url")})}),b.z.object({type:b.z.literal("file"),url:b.z.string().describe("File path"),filename:b.z.string().describe("File name"),mime:b.z.string().optional().describe("File mime type")})]),L=b.z.object({id:l,role:le,content:b.z.union([b.z.string(),b.z.array(N)]),name:b.z.string().optional().describe("Message sender name"),tool_call_id:S.optional().describe("Related tool call ID")}),me=b.z.object({sessionId:i,agent:T,model:P,messageId:l,message:b.z.object({id:l,role:b.z.literal("user"),content:b.z.union([b.z.string(),b.z.array(N)])}).describe("User message")}),de=b.z.object({sessionId:i,agent:T,model:P.optional(),userMessageId:l,prompt:b.z.string(),cwd:A.optional(),transcriptPath:b.z.string().optional()}),po=b.z.object({additionalContext:b.z.string().optional().describe("Context to inject into this turn"),block:b.z.boolean().optional().describe("Block this prompt submission"),reason:b.z.string().optional().describe("Reason shown to user when blocked")}),ge=b.z.object({sessionId:i,messages:b.z.array(L).describe("Messages to transform")}),fe=b.z.object({sessionId:i,model:P,system:b.z.array(b.z.string()).describe("Current system prompt")}),x=b.z.record(b.z.string(),b.z.unknown()).describe("Tool call arguments"),be=b.z.object({title:b.z.string().optional().describe("Result title"),content:b.z.string().describe("Result content"),is_error:b.z.boolean().optional().describe("Is error result"),metadata:b.z.record(b.z.string(),b.z.unknown()).optional().describe("Extra metadata")}),he=b.z.object({sessionId:i,userMessageId:l.optional().describe("User message ID for the current step"),tool:b.z.string().describe("Tool name"),callId:S,args:x}),ye=b.z.object({sessionId:i,userMessageId:l.optional().describe("User message ID for the current step"),tool:b.z.string(),callId:S,args:x,result:be,duration:b.z.number().nonnegative().optional().describe("Execution duration in milliseconds")}),Se=b.z.object({sessionId:i,tool:b.z.string(),callId:S,args:x,error:b.z.string().describe("Error message"),errorType:b.z.enum(["timeout","invalid_args","execution_error","permission_denied"])}),xe=b.z.object({sessionId:i,toolID:b.z.string().describe("Tool ID"),definition:b.z.object({name:b.z.string(),description:b.z.string().optional(),parameters:b.z.record(b.z.string(),b.z.unknown()).optional()}).describe("Tool definition")}),Ie=b.z.object({sessionId:i,command:b.z.string().describe("Command name"),arguments:b.z.union([b.z.string(),b.z.record(b.z.string(),b.z.unknown())]).describe("Command arguments")}),ke=b.z.object({sessionId:i,command:b.z.string().describe("Command name"),arguments:b.z.union([b.z.string(),b.z.record(b.z.string(),b.z.unknown())]).optional(),result:b.z.object({info:b.z.unknown().optional().describe("Message info"),parts:b.z.array(b.z.unknown()).optional().describe("Message parts"),title:b.z.string().optional().describe("Result title"),metadata:b.z.record(b.z.string(),b.z.unknown()).optional().describe("Result metadata"),output:b.z.string().optional().describe("Result output"),success:b.z.boolean().optional().describe("Whether execution succeeded"),error:b.z.string().optional().describe("Error message if failed")}).describe("Command execution result")}),Te=b.z.enum(["read","write","exec","admin"]),Pe=b.z.object({tool:b.z.string().describe("Tool name requesting permission"),args:x.optional(),level:Te.optional(),reason:b.z.string().optional().describe("Reason for permission request")}),Ce=b.z.object({sessionId:i,request:Pe}),F=b.z.enum(["openai","anthropic","google","azure","custom"]),Ee=b.z.object({temperature:b.z.number().min(0).max(2).optional(),topP:b.z.number().min(0).max(1).optional(),topK:b.z.number().int().positive().optional(),maxTokens:b.z.number().int().positive().optional(),stopSequences:b.z.array(b.z.string()).optional(),responseFormat:b.z.enum(["text","json_object"]).optional()}),ve=b.z.object({sessionId:i,agent:T,model:O,provider:F,params:Ee.partial().optional()}),Ae=b.z.object({sessionId:i,agent:T,model:O,provider:F,headers:b.z.record(b.z.string(),b.z.string()).optional()}),He=b.z.object({cwd:A.describe("Working directory"),sessionId:i.optional(),callId:S.optional()}),Re=b.z.object({sessionId:i,mode:b.z.enum(types.ContextModeValues).optional().describe("Host capability profile (ContextMode)"),scene:b.z.enum(types.ContextBuildSceneValues).optional().describe("Context build scene (ContextBuildScene)"),providerId:b.z.string().optional()}),Me=b.z.object({sessionId:i,context:b.z.object({messages:b.z.array(L),system:b.z.array(b.z.string()),metadata:b.z.record(b.z.string(),b.z.unknown())}).describe("Built context")}),we=b.z.object({id:b.z.string().describe("Fragment id (globally unique across plugins)"),title:b.z.string().optional().describe("Section title"),content:b.z.string().describe("Fragment body"),source:b.z.string().optional().describe("Fragment source"),tokens:b.z.number().nonnegative().optional().describe("Estimated token count"),order:b.z.number().int().optional().describe("Sort weight, smaller first"),markers:b.z.tuple([b.z.string(),b.z.string()]).optional().describe("Start/end markers")}),co=b.z.object({fragments:b.z.array(we)}),je=b.z.object({sessionId:i,mode:b.z.enum(types.ContextModeValues).describe("Host capability profile (ContextMode)"),scene:b.z.enum(types.ContextBuildSceneValues).optional().describe("Context build scene"),providerId:b.z.string().optional(),agentId:b.z.string().optional(),agentName:b.z.string().optional().describe("Agent name (human-readable)"),modelId:b.z.string().optional().describe("Model identifier (provider/model)"),query:b.z.string().optional().describe("Current user query for relevance-based retrieval"),maxTokens:b.z.number().positive().optional().describe("Fragment token budget granted by host"),trimOrder:b.z.array(b.z.enum(types.ContextSourceValues)).optional().describe("Source-level trim priority")}),ze=b.z.object({gatewayID:b.z.string().describe("Gateway ID"),messageId:l,message:b.z.unknown().describe("Received message")}),De=b.z.object({gatewayID:b.z.string(),messageId:l,message:b.z.unknown(),sessionId:i.optional()}),$e=b.z.object({gatewayID:b.z.string(),messageId:l,result:b.z.unknown().optional()}),Oe=b.z.object({gatewayID:b.z.string(),messageId:l,message:b.z.unknown(),target:b.z.string().optional().describe("Send target")}),Ne=b.z.object({gatewayID:b.z.string(),messageId:l,sessionId:i.optional(),channel:b.z.object({platform:b.z.string(),channelId:b.z.string()}),timestamp:b.z.number().describe("Delivery timestamp")}),Le=b.z.object({gatewayID:b.z.string(),messageId:l,sessionId:i.optional(),channel:b.z.object({platform:b.z.string(),channelId:b.z.string()}),timestamp:b.z.number().describe("Read timestamp")}),Fe=b.z.object({type:b.z.literal("command"),config:b.z.object({command:b.z.string(),arguments:b.z.union([b.z.string(),b.z.record(b.z.string(),b.z.unknown())]).optional()})}),_e=b.z.object({type:b.z.literal("heartbeat"),parts:b.z.array(b.z.unknown()),system:b.z.string().optional(),config:b.z.object({session:b.z.string().optional(),mode:b.z.enum(["session","fork"]).optional(),agent:b.z.string().optional(),model:b.z.string().optional().describe("Model identifier in provider/model format"),tools:b.z.record(b.z.string(),b.z.boolean()).optional()}).optional()}),Ge=b.z.object({type:b.z.literal("scheduler"),parts:b.z.array(b.z.unknown()),system:b.z.string().optional(),config:b.z.object({agentType:b.z.string().optional(),transport:b.z.enum(["stdio","http","websocket","cli"]).optional(),model:b.z.string().optional(),tools:b.z.record(b.z.string(),b.z.boolean()).optional()}).optional()}),Ue=b.z.object({taskId:b.z.string().describe("Heartbeat task ID"),timestamp:b.z.number().describe("Heartbeat timestamp"),name:b.z.string().optional().describe("Heartbeat name"),definition:_e.optional()}),Be=b.z.object({taskId:b.z.string().describe("Heartbeat task ID"),sessionId:i.optional(),timestamp:b.z.number(),duration:b.z.number().nonnegative().optional(),success:b.z.boolean().optional(),error:b.z.string().optional()}),Ve=b.z.object({taskId:b.z.string().describe("Task ID"),taskName:b.z.string().optional(),timestamp:b.z.number(),payload:b.z.record(b.z.string(),b.z.unknown()).optional(),definition:Ge.optional()}),qe=b.z.object({taskId:b.z.string(),timestamp:b.z.number(),success:b.z.boolean(),result:b.z.record(b.z.string(),b.z.unknown()).optional(),error:b.z.string().optional()}),Ke=b.z.object({taskId:b.z.string().describe("Command task unique identifier"),taskName:b.z.string().describe("Command task name"),command:b.z.string().describe("Command name"),arguments:b.z.union([b.z.string(),b.z.record(b.z.string(),b.z.unknown())]).optional().describe("Command arguments"),timestamp:b.z.number().describe("Trigger timestamp"),definition:Fe.optional()}),We=b.z.object({taskId:b.z.string(),timestamp:b.z.number(),success:b.z.boolean(),output:b.z.string().optional(),error:b.z.string().optional(),duration:b.z.number().describe("Execution duration in milliseconds")}),H=b.z.enum(["tool","scheduler","cli","api"]),Ze=b.z.object({taskId:b.z.string().describe("Task unique identifier"),sessionId:b.z.string().describe("Session ID for this task"),source:H.describe("Task source: tool, scheduler, cli, api"),agentType:b.z.string().describe("Agent type to execute this task"),description:b.z.string().describe("Task description"),prompt:b.z.string().describe("Task prompt content"),timeout:b.z.number().positive().optional().describe("Task timeout in milliseconds")}),Ye=b.z.object({taskId:b.z.string().describe("Task unique identifier"),sessionId:b.z.string().describe("Session ID for this task"),source:H.describe("Task source: tool, scheduler, cli, api")}),Xe=b.z.object({taskId:b.z.string(),sessionId:b.z.string(),source:H,step:b.z.number().describe("Current step number"),totalSteps:b.z.number().optional().describe("Total number of steps"),output:b.z.string().describe("Progress output content"),timestamp:b.z.number().describe("Progress timestamp")}),Je=b.z.object({taskId:b.z.string(),sessionId:b.z.string(),source:H,result:b.z.string().describe("Task result content"),duration:b.z.number().nonnegative().describe("Task duration in milliseconds"),attachments:b.z.array(b.z.unknown()).optional().describe("Task result attachments"),error:b.z.string().optional().describe("Error message if task failed"),agentType:b.z.string().optional().describe("Agent type that executed the task"),metadata:b.z.record(b.z.string(),b.z.unknown()).optional().describe("Additional metadata for the task result")}),Qe=b.z.object({sessionId:b.z.string().describe("Session ID"),step:b.z.number().describe("Current step number"),userMessageId:b.z.string().describe("User message ID driving this loop step"),result:b.z.enum(["start","continue","stop"]).optional().describe("Loop result: start, continue, or stop")}),et=b.z.object({sessionId:b.z.string().describe("Session ID"),step:b.z.number().describe("Current step number"),userMessageId:b.z.string().describe("User message ID that drove this loop step"),messageId:b.z.string().optional().describe("Assistant message id of this step (absent when stopped before an assistant reply)"),result:b.z.enum(["stop","continue"]).describe("Loop result: stop or continue")}),tt=b.z.object({requestId:b.z.string(),kind:b.z.enum(["create-skill","create-workflow","create-bundle"]),requirement:b.z.string(),hints:b.z.array(b.z.string()),subcommand:b.z.string().optional(),origin:b.z.object({source:b.z.enum(["human","tool","scheduler","namespace"]).optional(),timestamp:b.z.number().int().nonnegative()})}),ot=b.z.object({requestId:b.z.string(),status:b.z.enum(["success","failed"]),specId:b.z.string().optional(),subcommand:b.z.string().optional(),durationMs:b.z.number().int().nonnegative(),error:b.z.string().optional()}),u=b.z.object({streamId:b.z.string().describe("Unique id of one stream invocation"),step:b.z.number().int().nonnegative().describe("Step index (1-based, 0 before first step)"),agent:b.z.string().describe("Agent name that initiated this stream invocation"),sessionId:b.z.string().describe("Session id passed in by the application layer"),messageId:l.describe("Assistant message id created by the processor, constant within one process() call"),userMessageId:l.describe("User message id that triggered this response, equals assistant.parentId"),model:P}),d={partId:se.describe("Part id allocated and maintained by the processor")},nt=u,rt=u.extend(d),st=u.extend({...d,reasoningId:b.z.string().describe("Provider-side reasoning block id"),text:b.z.string().describe("Reasoning text so far (empty at start)")}),it=u.extend({...d,reasoningId:b.z.string().describe("Provider-side reasoning block id"),delta:b.z.string().describe("Incremental reasoning text"),text:b.z.string().describe("Accumulated reasoning text")}),at=u.extend({...d,reasoningId:b.z.string().describe("Provider-side reasoning block id"),text:b.z.string().describe("Accumulated reasoning text (trimmed)")}),pt=u.extend({...d,callId:S,tool:b.z.string().describe("Tool name")}),ct=u.extend({...d,callId:S,tool:b.z.string().describe("Tool name"),args:x}),ut=u.extend({...d,callId:S,tool:b.z.string().describe("Tool name"),args:x,title:b.z.string().optional().describe("Result title"),output:b.z.unknown().describe("Tool output payload"),metadata:b.z.record(b.z.string(),b.z.unknown()).optional(),durationMs:b.z.number().nonnegative().describe("Tool execution duration")}),lt=u.extend({...d,callId:S,tool:b.z.string().describe("Tool name"),args:x,error:b.z.string().describe("Error message"),errorName:b.z.string().optional().describe("Named error name"),durationMs:b.z.number().nonnegative().describe("Tool execution duration")}),mt=u.extend({...d,reason:b.z.string().optional().describe("Finish reason reported by provider"),tokens:types.UsageSchema.optional().describe("Normalized token usage"),cost:b.z.number().nonnegative().optional().describe("Estimated cost of this step")}),dt=u.extend({...d,text:b.z.string().describe("Text so far (empty at start)")}),gt=u.extend({...d,delta:b.z.string().describe("Incremental text"),text:b.z.string().describe("Accumulated text")}),ft=u.extend({...d,text:b.z.string().describe("Accumulated text (trimmed)")}),bt=u.extend({error:b.z.string().describe("Error message"),errorName:b.z.string().optional().describe("Named error name"),aborted:b.z.boolean().optional().describe("Whether aborted by signal")}),ht=u.extend({result:b.z.enum(["stop","continue","compact"]).describe("Processor loop verdict"),cost:b.z.number().nonnegative().optional().describe("Accumulated cost of this stream"),tokens:b.z.number().nonnegative().optional().describe("Accumulated tokens of this stream")}),yt=b.z.object({sessionId:i,cwd:A.optional(),transcriptPath:b.z.string().optional(),stopHookActive:b.z.boolean().optional(),result:b.z.enum(["stop","continue","compact"]).optional()}),uo=b.z.object({continue:b.z.boolean().optional(),reason:b.z.string().optional()}),St=b.z.object({sessionId:i,reason:b.z.string().optional().describe("Interruption reason")}),xt=b.z.object({sessionId:i.optional(),agentId:b.z.string().describe("Sub agent id"),agentName:b.z.string().optional(),prompt:b.z.string().optional()}),It=b.z.object({sessionId:i.optional(),agentId:b.z.string(),agentName:b.z.string().optional(),success:b.z.boolean().describe("Whether the sub agent finished successfully"),durationMs:b.z.number().nonnegative().optional(),error:b.z.string().optional()}),kt=b.z.object({sessionId:i.optional(),message:b.z.string().describe("Notification body"),level:b.z.enum(["info","warn","error"]).optional(),source:b.z.string().optional()}),Tt=b.z.object({cwd:b.z.string().describe("Project directory"),trusted:b.z.boolean().describe("Trust decision")}),M={[t.SessionStart]:ae,[t.SessionEnd]:pe,[t.SessionCompacting]:ce,[t.SessionCompact]:ue,[t.SessionInterrupt]:St,[t.MessageReceive]:me,[t.UserPromptSubmit]:de,[t.MessageTransform]:ge,[t.SystemTransform]:fe,[t.ToolBefore]:he,[t.ToolAfter]:ye,[t.ToolFailure]:Se,[t.ToolDefinition]:xe,[t.CommandBefore]:Ie,[t.CommandAfter]:ke,[t.PermissionAsk]:Ce,[t.LlmParams]:ve,[t.LlmHeaders]:Ae,[t.ShellEnv]:He,[t.ContextBuildBefore]:Re,[t.ContextBuildAfter]:Me,[t.ContextCollect]:je,[t.Stop]:yt,[t.GatewayMessageReceive]:ze,[t.GatewayMessageProcess]:De,[t.GatewayMessageComplete]:$e,[t.GatewayMessageSend]:Oe,[t.GatewayMessageDelivered]:Ne,[t.GatewayMessageRead]:Le,[t.HeartbeatTrigger]:Ue,[t.HeartbeatComplete]:Be,[t.ScheduledTaskTrigger]:Ve,[t.ScheduledTaskComplete]:qe,[t.CommandTrigger]:Ke,[t.CommandComplete]:We,[t.TaskStart]:Ze,[t.TaskRunning]:Ye,[t.TaskProgress]:Xe,[t.TaskComplete]:Je,[t.LoopStart]:Qe,[t.LoopEnd]:et,[t.SubagentStart]:xt,[t.SubagentStop]:It,[t.Notification]:kt,[t.ProcessorStart]:nt,[t.ProcessorStepStart]:rt,[t.ProcessorReasoningStart]:st,[t.ProcessorReasoningDelta]:it,[t.ProcessorReasoningEnd]:at,[t.ProcessorToolInputStart]:pt,[t.ProcessorToolCall]:ct,[t.ProcessorToolResult]:ut,[t.ProcessorToolError]:lt,[t.ProcessorStepFinish]:mt,[t.ProcessorTextStart]:dt,[t.ProcessorTextDelta]:gt,[t.ProcessorTextEnd]:ft,[t.ProcessorError]:bt,[t.ProcessorFinish]:ht,[t.ProjectTrust]:Tt,[t.CreationRequest]:tt,[t.CreationComplete]:ot};function lo(o){return M[o]}function mo(o,r){let n=M[o];if(!n)throw new Error(`No schema found for event: ${o}`);return n.parse(r)}function go(o,r){let n=M[o];return n?n.safeParse(r):{success:false,error:new b.z.ZodError([{code:"custom",path:[],message:`No schema found for event: ${o}`}])}}var Bo=b.z.enum(["subagent","primary","all"]),Vo=b.z.enum(["general","coder","all"]),qo=types.AgentInfoSchema;var Qo=b.z.object({name:b.z.string().min(1).describe("Unique skill name"),description:b.z.string().min(1).describe("When to use this skill"),scope:b.z.enum(["general","coder","all"]).optional().describe("Context mode scope")}),en=b.z.object({agent:b.z.object({name:b.z.string().describe("Agent name"),model:b.z.string().optional().describe("Agent model in provider/model format")}).optional().describe("Agent context")}),tn=b.z.object({isEnabled:b.z.boolean().optional().describe("Is enabled check result")});var V=/^[a-z0-9][a-z0-9._-]{1,63}$/,G=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Ct="1.0.0";function U(o){let r=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(o);if(r)return {major:Number(r[1]),minor:Number(r[2]),patch:Number(r[3]),prerelease:r[4]?r[4].split("."):[]}}function Et(o,r){let n=U(o),s=U(r);if(!n||!s)return o===r?0:o<r?-1:1;if(n.major!==s.major)return n.major<s.major?-1:1;if(n.minor!==s.minor)return n.minor<s.minor?-1:1;if(n.patch!==s.patch)return n.patch<s.patch?-1:1;if(n.prerelease.length===0&&s.prerelease.length===0)return 0;if(n.prerelease.length===0)return 1;if(s.prerelease.length===0)return -1;let a=Math.max(n.prerelease.length,s.prerelease.length);for(let p=0;p<a;p++){let g=n.prerelease[p],h=s.prerelease[p];if(g===void 0)return -1;if(h===void 0)return 1;let y=/^\d+$/.test(g),I=/^\d+$/.test(h);if(y&&I){let E=Number(g)-Number(h);if(E!==0)return E<0?-1:1;continue}if(y!==I)return y?-1:1;if(g!==h)return g<h?-1:1}return 0}function ln(o,r=Ct){return o?Et(r,o)>=0:true}var w=["hooks","commands","tools","agents","skills","auth","event","config","mcpServers","setup"],vt=[...w,"extensions"],At=["fail-open","fail-closed"],Ht=[".mjs",".js",".cjs"],mn=["default","Plugin","plugin"],Rt=["command","prompt","http","agent","function"],Mt=["commands","tools","agents","skills","mcpServers"],wt=["event","config","setup"];function C(o){return typeof o=="string"&&V.test(o)}function jt(o){if(typeof o!="string"||!o.startsWith("./"))return false;let r=o.slice(2);return r.length===0||r.includes("\\")||r.split("/").some(s=>s.length===0||s==="."||s==="..")?false:Ht.some(s=>r.endsWith(s))}var zt=b__default.default.object({name:b__default.default.string().regex(V,"plugin name must match ^[a-z0-9][a-z0-9._-]{1,63}$"),version:b__default.default.string().regex(G,"plugin version must be SemVer x.y.z").optional(),description:b__default.default.string().max(200,"plugin description must be at most 200 characters").optional(),entry:b__default.default.string().refine(jt,"plugin entry must be a safe relative .mjs/.js/.cjs path").optional(),apiVersion:b__default.default.string().regex(G,"plugin apiVersion must be SemVer x.y.z").optional(),capabilities:b__default.default.array(b__default.default.enum(w)).optional(),skills:b__default.default.array(b__default.default.string()).optional()});function dn(o){let r=zt.safeParse(o);return r.success?{ok:true,manifest:r.data}:{ok:false,errors:r.error.issues.map(n=>`${n.path.length>0?n.path.join("."):"<root>"}: ${n.message}`)}}function c(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function B(o){return c(o)&&typeof o.safeParse=="function"}function Dt(o){return typeof o=="number"&&Number.isFinite(o)&&o>=0}function $t(o){if(!Array.isArray(o))return "plugin.hooks must be an array";for(let[r,n]of o.entries()){if(!c(n))return `plugin.hooks[${r}] must be an object`;let s=typeof n.event=="string"?j(n.event):n.event;if(typeof s!="string"||!R.includes(s))return `plugin.hooks[${r}].event must be a HookEvent value (or a supported ecosystem alias)`;if(n.matcher!==void 0&&typeof n.matcher!="string")return `plugin.hooks[${r}].matcher must be a string`;if(n.priority!==void 0&&typeof n.priority!="number")return `plugin.hooks[${r}].priority must be a number`;if(n.timeoutMs!==void 0&&!Dt(n.timeoutMs))return `plugin.hooks[${r}].timeoutMs must be a non-negative number`;if(n.failurePolicy!==void 0&&!At.includes(n.failurePolicy))return `plugin.hooks[${r}].failurePolicy must be fail-open or fail-closed`;if(!Array.isArray(n.hooks))return `plugin.hooks[${r}].hooks must be an array`;if(n.hooks.length===0)return `plugin.hooks[${r}].hooks must not be empty`;for(let[a,p]of n.hooks.entries()){if(!c(p)||typeof p.type!="string")return `plugin.hooks[${r}].hooks[${a}] must be a hook executor object`;if(!Rt.includes(p.type))return `plugin.hooks[${r}].hooks[${a}].type is unknown: ${p.type}`;if(p.type==="function"&&typeof p.handler!="function")return `plugin.hooks[${r}].hooks[${a}].handler must be a function`}}return null}function Ot(o){for(let[r,n]of Object.entries(o)){if(!C(r))return `plugin.tools key "${r}" must match the plugin id pattern`;if(!c(n))return `plugin.tools.${r} must be an object`;if(typeof n.description!="string"||n.description.length===0)return `plugin.tools.${r}.description must be a non-empty string`;if(!B(n.args)){if(!c(n.args))return `plugin.tools.${r}.args must be a Zod schema or a Zod schema map`;for(let[s,a]of Object.entries(n.args))if(!B(a))return `plugin.tools.${r}.args.${s} must be a Zod schema`}if(typeof n.execute!="function")return `plugin.tools.${r}.execute must be a function`}return null}function Nt(o){for(let[r,n]of Object.entries(o)){if(!C(r))return `plugin.commands key "${r}" must match the plugin id pattern`;if(!c(n))return `plugin.commands.${r} must be an object`;if(typeof n.name!="string"||n.name.length===0)return `plugin.commands.${r}.name must be a non-empty string`;if(n.name!==r)return `plugin.commands.${r}.name must equal its map key`;if(typeof n.execute!="function")return `plugin.commands.${r}.execute must be a function`}return null}function Lt(o){for(let[r,n]of Object.entries(o)){if(!C(r))return `plugin.agents key "${r}" must match the plugin id pattern`;if(!c(n)||typeof n.name!="string"||n.name.length===0)return `plugin.agents.${r}.name must be a non-empty string`}return null}function Ft(o){for(let[r,n]of Object.entries(o)){if(!C(r))return `plugin.skills key "${r}" must match the plugin id pattern`;if(!c(n))return `plugin.skills.${r} must be an object`;if(typeof n.name!="string"||n.name.length===0)return `plugin.skills.${r}.name must be a non-empty string`;if(n.name!==r)return `plugin.skills.${r}.name must equal its map key`;if(typeof n.description!="string"||n.description.length===0)return `plugin.skills.${r}.description must be a non-empty string`}return null}function _t(o){for(let[r,n]of Object.entries(o)){let s=`plugin.mcpServers.${r}`;if(!c(n))return `${s} must be an object`;let a=n.type;if(a!==void 0&&a!=="local"&&a!=="remote")return `${s}.type must be local or remote`;let p=Array.isArray(n.command)&&n.command.length>0,g=typeof n.url=="string"&&n.url.length>0;if(n.command!==void 0&&(!Array.isArray(n.command)||n.command.some(y=>typeof y!="string")))return `${s}.command must be an array of strings`;if(n.url!==void 0&&typeof n.url!="string")return `${s}.url must be a string`;let h=a??(p?"local":g?"remote":void 0);if(h===void 0)return `${s} must declare command (local) or url (remote)`;if(h==="local"&&!p)return `${s}.command must be a non-empty array for local servers`;if(h==="remote"&&!g)return `${s}.url must be a non-empty string for remote servers`;if(n.timeout!==void 0&&(typeof n.timeout!="number"||n.timeout<=0))return `${s}.timeout must be a positive number`;if(n.enabled!==void 0&&typeof n.enabled!="boolean")return `${s}.enabled must be a boolean`;for(let y of ["environment","headers"]){let I=n[y];if(I!==void 0){if(!c(I))return `${s}.${y} must be an object of string values`;for(let[E,q]of Object.entries(I))if(typeof q!="string")return `${s}.${y}.${E} must be a string`}}}return null}function Gt(o,r){if(!c(o))return `${r} must be an object`;if(o.type!=="text"&&o.type!=="select")return `${r}.type must be text or select`;if(typeof o.key!="string"||o.key.length===0)return `${r}.key must be a non-empty string`;if(typeof o.message!="string"||o.message.length===0)return `${r}.message must be a non-empty string`;if(o.type==="text"&&o.validate!==void 0&&typeof o.validate!="function")return `${r}.validate must be a function`;if(o.type==="select"){if(!Array.isArray(o.options))return `${r}.options must be an array`;for(let n of o.options)if(!c(n)||typeof n.label!="string"||typeof n.value!="string")return `${r}.options entries must have string label and value`}return o.condition!==void 0&&typeof o.condition!="function"?`${r}.condition must be a function`:null}function Ut(o){if(!c(o))return "plugin.auth must be an object";if(typeof o.provider!="string"||!C(o.provider))return "plugin.auth.provider must be a non-empty plugin id";if(o.loader!==void 0&&typeof o.loader!="function")return "plugin.auth.loader must be a function";if(!Array.isArray(o.methods))return "plugin.auth.methods must be an array";for(let[r,n]of o.methods.entries()){let s=`plugin.auth.methods[${r}]`;if(!c(n))return `${s} must be an object`;if(n.type!=="oauth"&&n.type!=="api")return `${s}.type must be oauth or api`;if(typeof n.label!="string"||n.label.length===0)return `${s}.label must be a non-empty string`;if(n.prompts!==void 0){if(!Array.isArray(n.prompts))return `${s}.prompts must be an array`;for(let[a,p]of n.prompts.entries()){let g=Gt(p,`${s}.prompts[${a}]`);if(g)return g}}if(n.type==="oauth"&&typeof n.authorize!="function")return `${s}.authorize must be a function for oauth methods`;if(n.type==="api"&&n.authorize!==void 0&&typeof n.authorize!="function")return `${s}.authorize must be a function`}return null}var Bt={commands:Nt,tools:Ot,agents:Lt,skills:Ft,mcpServers:_t};function Vt(o){return w.filter(r=>o[r]!==void 0)}function gn(o,r){if(!c(o))return {ok:false,reason:"plugin returned non-object value"};for(let s of Object.keys(o))if(!vt.includes(s))return {ok:false,reason:`plugin.${s} is not a supported definition field`};if(o.extensions!==void 0&&!c(o.extensions))return {ok:false,reason:"plugin.extensions must be a plain object map"};let n=Vt(o);if(n.length===0)return {ok:false,reason:"plugin definition must declare at least one capability"};if(o.hooks!==void 0){let s=$t(o.hooks);if(s)return {ok:false,reason:s}}for(let s of Mt){let a=o[s];if(a===void 0)continue;if(!c(a))return {ok:false,reason:`plugin.${s} must be a plain object map`};let p=Bt[s](a);if(p)return {ok:false,reason:p}}for(let s of wt){let a=o[s];if(a!==void 0&&typeof a!="function")return {ok:false,reason:`plugin.${s} must be a function`}}if(o.auth!==void 0){let s=Ut(o.auth);if(s)return {ok:false,reason:s}}if(r?.capabilities!==void 0){let s=new Set(r.capabilities);for(let a of n)if(!s.has(a))return {ok:false,reason:`plugin.${a} is not declared in plugin.json capabilities`};for(let a of s)if(!n.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,"schema",{enumerable:true,get:function(){return types.toolSchema}});exports.AgentExecutorSchema=te;exports.AgentMetadataSchema=qo;exports.AgentModeSchema=Bo;exports.AgentSchema=T;exports.AgentScopeSchema=Vo;exports.CallIDSchema=S;exports.CommandAfterInputSchema=ke;exports.CommandBeforeInputSchema=Ie;exports.CommandCompleteInputSchema=We;exports.CommandExecutorSchema=J;exports.CommandTaskDefinitionSchema=Fe;exports.CommandTriggerInputSchema=Ke;exports.ContentPartSchema=N;exports.ContextBuildAfterInputSchema=Me;exports.ContextBuildBeforeInputSchema=Re;exports.ContextCollectInputSchema=je;exports.ContextCollectOutputSchema=co;exports.ContextFragmentSchema=we;exports.CreationCompleteInputSchema=ot;exports.CreationRequestInputSchema=tt;exports.CwdSchema=A;exports.EndReasonSchema=ie;exports.EventInputSchemas=M;exports.FinishReasonSchema=ao;exports.FunctionExecutorSchema=oe;exports.GatewayMessageCompleteInputSchema=$e;exports.GatewayMessageDeliveredInputSchema=Ne;exports.GatewayMessageProcessInputSchema=De;exports.GatewayMessageReadInputSchema=Le;exports.GatewayMessageReceiveInputSchema=ze;exports.GatewayMessageSendInputSchema=Oe;exports.HOOK_EVENTS=R;exports.HOOK_EVENT_ALIASES=Z;exports.HOOK_EVENT_SEMANTICS=z;exports.HeartbeatCompleteInputSchema=Be;exports.HeartbeatTaskDefinitionSchema=_e;exports.HeartbeatTriggerInputSchema=Ue;exports.HookEvent=t;exports.HookExecutorSchema=ne;exports.HookMatcherSchema=re;exports.HookType=k;exports.HooksConfigSchema=io;exports.HttpExecutorSchema=ee;exports.LlmHeadersInputSchema=Ae;exports.LlmParamsInputSchema=ve;exports.LlmParamsSchema=Ee;exports.LlmProviderSchema=F;exports.LoopEndInputSchema=et;exports.LoopStartInputSchema=Qe;exports.MessageIDSchema=l;exports.MessageReceiveInputSchema=me;exports.MessageRoleSchema=le;exports.MessageSchema=L;exports.MessageTransformInputSchema=ge;exports.ModelObjectSchema=O;exports.ModelSchema=P;exports.NotificationInputSchema=kt;exports.PLUGIN_API_VERSION=Ct;exports.PLUGIN_CAPABILITIES=w;exports.PLUGIN_DEFINITION_KEYS=vt;exports.PLUGIN_ENTRY_EXTENSIONS=Ht;exports.PLUGIN_ENTRY_NAMES=mn;exports.PLUGIN_HOOK_EXECUTOR_TYPES=Rt;exports.PLUGIN_HOOK_FAILURE_POLICIES=At;exports.PLUGIN_ID_PATTERN=V;exports.PLUGIN_VERSION_PATTERN=G;exports.PartIDSchema=se;exports.PermissionAskInputSchema=Ce;exports.PermissionLevelSchema=Te;exports.PermissionRequestSchema=Pe;exports.PluginManifestSchema=zt;exports.ProcessorErrorInputSchema=bt;exports.ProcessorFinishInputSchema=ht;exports.ProcessorReasoningDeltaInputSchema=it;exports.ProcessorReasoningEndInputSchema=at;exports.ProcessorReasoningStartInputSchema=st;exports.ProcessorStartInputSchema=nt;exports.ProcessorStepFinishInputSchema=mt;exports.ProcessorStepStartInputSchema=rt;exports.ProcessorTextDeltaInputSchema=gt;exports.ProcessorTextEndInputSchema=ft;exports.ProcessorTextStartInputSchema=dt;exports.ProcessorToolCallInputSchema=ct;exports.ProcessorToolErrorInputSchema=lt;exports.ProcessorToolInputStartInputSchema=pt;exports.ProcessorToolResultInputSchema=ut;exports.ProjectTrustInputSchema=Tt;exports.PromptExecutorSchema=Q;exports.ScheduledTaskCompleteInputSchema=qe;exports.ScheduledTaskTriggerInputSchema=Ve;exports.SchedulerTaskDefinitionSchema=Ge;exports.SessionCompactInputSchema=ue;exports.SessionCompactingInputSchema=ce;exports.SessionEndInputSchema=pe;exports.SessionIDSchema=i;exports.SessionInterruptInputSchema=St;exports.SessionStartInputSchema=ae;exports.ShellEnvInputSchema=He;exports.SkillInitContextSchema=en;exports.SkillInitResultSchema=tn;exports.SkillMetadataSchema=Qo;exports.StopInputSchema=yt;exports.StopOutputSchema=uo;exports.SubagentStartInputSchema=xt;exports.SubagentStopInputSchema=It;exports.SystemTransformInputSchema=fe;exports.TaskCompleteInputSchema=Je;exports.TaskProgressInputSchema=Xe;exports.TaskRunningInputSchema=Ye;exports.TaskSourceSchema=H;exports.TaskStartInputSchema=Ze;exports.ToolAfterInputSchema=ye;exports.ToolArgsSchema=x;exports.ToolBeforeInputSchema=he;exports.ToolDefinitionInputSchema=xe;exports.ToolFailureInputSchema=Se;exports.ToolResultSchema=be;exports.UserPromptSubmitInputSchema=de;exports.UserPromptSubmitOutputSchema=po;exports.compareSemVer=Et;exports.createTool=Kt;exports.getEventInputSchema=lo;exports.getEventSemantics=Qt;exports.isCollectEvent=eo;exports.isValidPluginEntry=jt;exports.isValidPluginId=C;exports.isZodSchema=B;exports.normalizeHookEvent=j;exports.safeValidateHookInput=go;exports.satisfiesApiVersion=ln;exports.tool=W;exports.validateHookInput=mo;exports.validatePluginDefinition=gn;exports.validatePluginManifest=dn;
|