@easbot/types 0.3.28 → 0.3.32
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 +162 -1
- package/README.md +158 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2737 -892
- package/dist/index.d.ts +2737 -892
- package/dist/index.mjs +2 -2
- package/package.json +5 -6
package/README.en.md
CHANGED
|
@@ -6,7 +6,7 @@ A modern, lightweight, and fast library for shared types in the EASBOT ecosystem
|
|
|
6
6
|
|
|
7
7
|
## Version
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
9
|
+
v0.3.32
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
12
|
- **Type Safety**: Complete TypeScript type definitions
|
|
@@ -33,6 +33,167 @@ const config: AgentConfig = {
|
|
|
33
33
|
};
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
## Agent Types (cross-package single source of truth)
|
|
37
|
+
|
|
38
|
+
`@easbot/types` is the **cross-package single source of truth** for Agent metadata definitions. The two schemas below collapse what used to live in three duplicated locations into a single definition:
|
|
39
|
+
|
|
40
|
+
- `packages/agent/src/agent/agent.ts` — `Agent.Info` (runtime shape; `mode` / `permission` required)
|
|
41
|
+
- `@easbot/types` — `AgentInfo` (config shape; everything optional)
|
|
42
|
+
- `packages/plugin/src/agent/types.ts` — `AgentMetadataSchema` (plugin declaration shape)
|
|
43
|
+
|
|
44
|
+
### `AgentModelSchema` / `type AgentModel`
|
|
45
|
+
|
|
46
|
+
A two-tuple `(provider, modelId)` for model configuration. Naming follows the existing pattern (`AgentModelSchema` + bare `type AgentModel`, same as `packages/plugin/src/agent/types.ts`): **the schema uses the `*Schema` suffix, the type stays `AgentModel` without suffix** — keeping `AgentModel` as a type name avoids rippling renames across cross-package usages (`SubAgentPartInput.model` / `AgentInput.model` / gateway, etc.).
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { AgentModelSchema, type AgentModel } from '@easbot/types';
|
|
50
|
+
|
|
51
|
+
const model: AgentModel = AgentModelSchema.parse({
|
|
52
|
+
providerId: 'openai',
|
|
53
|
+
modelId: 'gpt-4o',
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### `AgentInfoSchema` / `type AgentInfo`
|
|
58
|
+
|
|
59
|
+
Agent metadata. **Only `name` is required**; everything else is optional — both the "config shape" (Config / Plugin typically provide partial fields) and the "runtime shape" (the registry fills in defaults after merging) are subsets of the same schema, so **two schemas are no longer maintained**.
|
|
60
|
+
|
|
61
|
+
| Field | Type | Description |
|
|
62
|
+
| ------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
63
|
+
| `name` | `string` (required, ≥1 char) | Agent unique identifier |
|
|
64
|
+
| `description` | `string?` | What this agent is for |
|
|
65
|
+
| `mode` | `'subagent' \| 'primary' \| 'all'` | Runtime mode (subagent = invoked via task/agent tools; primary = directly responds to the user; all = both); runtime default `'subagent'`, Config custom agent default `'all'` |
|
|
66
|
+
| `native` | `boolean?` | Whether this is a built-in agent (**marked by the registry at runtime, never written in config**) |
|
|
67
|
+
| `hidden` | `boolean?` | Hide from `@` autocomplete and `list` |
|
|
68
|
+
| `topP` | `number?` | Top-p sampling |
|
|
69
|
+
| `temperature` | `number?` | Sampling temperature (clamped to the Provider range at call time) |
|
|
70
|
+
| `color` | hex string (`#RRGGBB`) \| theme color enum | UI display color |
|
|
71
|
+
| `permission` | {@link PermissionRulesetSchema} (flattened) | **Runtime shape** ruleset; **not interchangeable** with the config-shape `PermissionConfigSchema` (`Config.permission` / `PluginAgent.permission`) |
|
|
72
|
+
| `scope` | `'general' \| 'coder' \| ...` | Context-mode scope |
|
|
73
|
+
| `model` | `AgentModel` (object only) | `{ providerId, modelId }`; **no string shorthand** — strings are normalized by `toModel()` in `@easbot/llm` at install time |
|
|
74
|
+
| `variant` | `string?` | Model variant (e.g. `high` / `max`) |
|
|
75
|
+
| `prompt` | `string?` | Agent system prompt |
|
|
76
|
+
| `options` | `Record<string, any>?` | Additional configuration options |
|
|
77
|
+
| `steps` | `number?` (positive integer) | Max agent iterations before forcing a text-only response |
|
|
78
|
+
| `disable` | `boolean?` | Disable this built-in agent (**only effective in `Config.agent[x]`**) |
|
|
79
|
+
| _(catchall)_ | `unknown` | Unknown keys are passed through (not stripped) — `.easbot/agent/*.md` frontmatter / plugin-defined fields |
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { AgentInfoSchema, type AgentInfo } from '@easbot/types';
|
|
83
|
+
|
|
84
|
+
// 1) Config shape — only partial fields
|
|
85
|
+
AgentInfoSchema.parse({ name: 'reviewer', mode: 'subagent' });
|
|
86
|
+
|
|
87
|
+
// 2) Runtime shape — fields filled in after merge
|
|
88
|
+
const info: AgentInfo = AgentInfoSchema.parse({
|
|
89
|
+
name: 'build',
|
|
90
|
+
mode: 'primary',
|
|
91
|
+
options: {},
|
|
92
|
+
permission: [], // flattened shape
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// 3) `model` accepts an object only (string shorthand is normalized by llm's `toModel()` at install time)
|
|
96
|
+
const a: AgentInfo['model'] = { providerId: 'anthropic', modelId: 'claude-sonnet-4-5' };
|
|
97
|
+
const b: AgentInfo['model'] = { providerId: 'openai', modelId: 'gpt-4o' };
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Design notes
|
|
101
|
+
|
|
102
|
+
- **Config + runtime shape unified**: `AgentInfoSchema` is a **single schema for both config and runtime shapes**; everything is optional; runtime defaults (`mode` / `native`) are filled by `@easbot/llm.AgentRegistry.normalize()` on registration
|
|
103
|
+
- **Catchall passthrough**: `.catchall(z.unknown())` keeps frontmatter / plugin-defined keys instead of stripping them, so they can survive merge into `options` or be read out directly
|
|
104
|
+
- **`PermissionRulesetSchema` vs `PermissionConfigSchema` are two different schemas**: the former is the already-flattened runtime shape (values are rule objects); the latter is the config shape (values are `allow | deny | ask` strings). **Not interchangeable.**
|
|
105
|
+
|
|
106
|
+
#### Cross-package usage
|
|
107
|
+
|
|
108
|
+
| Package | Purpose |
|
|
109
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| `@easbot/plugin` | `AgentMetadataSchema` directly aliases `AgentMetadataSchema = AgentInfoSchema` (declaration shape == config shape), then `AgentDefinition extends AgentMetadata` adds the `id?` field |
|
|
111
|
+
| `@easbot/llm` | `AgentRegistry` normalizes every registered entry with `AgentInfoSchema.parse`; `mergeLayers` does field-level merging across all layers |
|
|
112
|
+
| `@easbot/utils` | `Permission.Preset.ruleset()` produces rulesets that feed straight into this schema's `permission` field |
|
|
113
|
+
| `@easbot/sdk` | OpenAPI generator emits `AgentInfo[]` response schemas for `operationId = 'agent.list' / 'agent.create'`, etc. |
|
|
114
|
+
| `@easbot/agent` | `server/routes/agent.ts` does `resolver(AgentInfoSchema)` + `validator('json', AgentInfoSchema)` |
|
|
115
|
+
|
|
116
|
+
## Command contracts (cross-package single source of truth)
|
|
117
|
+
|
|
118
|
+
`native/command.ts` in `@easbot/types` is the **single source of truth** for Command contracts. A Command has **three semantically orthogonal shapes**; their field sets overlap but mean different things, so they are **not duplicate definitions** (`spec/types-standard.md` §3.10.2) — the domain prefix disambiguates them:
|
|
119
|
+
|
|
120
|
+
| Shape | schema / type | OpenAPI component | Description |
|
|
121
|
+
| ------------ | ----------------------------------------------- | ----------------- | --------------------------------------------------------------- |
|
|
122
|
+
| **Config** | `CommandConfigInfoSchema` / `CommandConfigInfo` | `CommandConfig` | The command template a user writes in config (`config.command`) |
|
|
123
|
+
| **Metadata** | `CommandMetadataSchema` / `CommandMetadata` | — | The Markdown frontmatter declaration shape |
|
|
124
|
+
| **Runtime** | `CommandInfoSchema` / `CommandInfo` | `Command` | Command registry entry + HTTP response contract |
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { CommandConfigInfoSchema, CommandInfoSchema, type CommandDefinition } from '@easbot/types';
|
|
128
|
+
|
|
129
|
+
// Config shape — the command template in the config file
|
|
130
|
+
CommandConfigInfoSchema.parse({ template: 'review {{FILE}}', scope: 'coder' });
|
|
131
|
+
|
|
132
|
+
// Runtime shape — registry entry / HTTP response
|
|
133
|
+
CommandInfoSchema.parse({ name: 'review', source: 'command' });
|
|
134
|
+
|
|
135
|
+
// Runtime definition (`execute` required): HTTP contract (CommandInfo) + non-contract fields
|
|
136
|
+
const cmd: CommandDefinition = {
|
|
137
|
+
name: 'review',
|
|
138
|
+
scope: 'coder',
|
|
139
|
+
execute: async (args, ctx) => ({
|
|
140
|
+
title: 'Review',
|
|
141
|
+
metadata: {},
|
|
142
|
+
output: String(args),
|
|
143
|
+
success: true,
|
|
144
|
+
}),
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Design notes
|
|
149
|
+
|
|
150
|
+
- **`execute` / `isEnabled` are functions** — the contract layer cannot express them in JSON Schema, so `z.custom<T>()` puts the **exact function signature** into the type layer: the produced contract is **identical to `z.any()`** (verified: an empty `{}` schema), yet `z.infer` yields the precise signature. types and `@easbot/plugin` stay consistent by construction — no duplicated interface plus mutual `Omit` on both sides
|
|
151
|
+
- **`execute` is optional in the HTTP contract** — it is a function and does not survive JSON serialization; the HTTP response has **no `execute` field**. The runtime shape is `CommandDefinition` (`execute` required)
|
|
152
|
+
- **`CommandDefinition extends Omit<CommandInfo, 'execute'>`** — runtime shape = HTTP contract + three non-contract fields (`scope` / `template` / `init`), with `execute` narrowed to required
|
|
153
|
+
|
|
154
|
+
#### Cross-package usage
|
|
155
|
+
|
|
156
|
+
| Package | Purpose |
|
|
157
|
+
| ---------------- | -------------------------------------------------------------------------------------------------- |
|
|
158
|
+
| `@easbot/plugin` | `command/types.ts` is now a pure re-export of this file (public API surface unchanged) |
|
|
159
|
+
| `@easbot/agent` | `CommandRegistry.Info` re-exports it; `api/command.ts` references `CommandInfo` directly (no cast) |
|
|
160
|
+
| `@easbot/sdk` | OpenAPI emits two components: `Command` (runtime) and `CommandConfig` (config) |
|
|
161
|
+
|
|
162
|
+
## HTTP boolean query / path parameter contract (cross-package single source of truth)
|
|
163
|
+
|
|
164
|
+
`BooleanQuerySchema` in `native/http.ts` is the **single source of truth** for HTTP boolean query / path parameters.
|
|
165
|
+
|
|
166
|
+
HTTP query / path parameters are **always strings on the wire** — `?roots=true` arrives at the server as the string `"true"`. A string → boolean normalization is therefore required before zod validation, and the three common approaches each have a flaw:
|
|
167
|
+
|
|
168
|
+
| Approach | Runtime semantics | OpenAPI output | Verdict |
|
|
169
|
+
| ----------------------------------------------------- | ------------------------------ | --------------- | ------------------------------------------------------------------------------------------------------ |
|
|
170
|
+
| `z.coerce.boolean()` | ❌ `Boolean("false") === true` | `type: boolean` | **Semantic bug** — `?roots=false` is treated as `true` |
|
|
171
|
+
| `z.stringbool()` | ✅ `"false"` → `false` | `type: string` | **Contract regression** — SDK generates `roots?: string`, callers passing a boolean fail to type-check |
|
|
172
|
+
| `BooleanQuerySchema` (`z.preprocess` + `z.boolean()`) | ✅ `"false"` → `false` | `type: boolean` | ✅ Satisfies both |
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
import { BooleanQuerySchema } from '@easbot/types';
|
|
176
|
+
|
|
177
|
+
// query parameter: string-boolean semantics + OpenAPI keeps `type: boolean`
|
|
178
|
+
roots: BooleanQuerySchema.optional().meta({
|
|
179
|
+
description: 'Only return root sessions (no parentId)',
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Usage boundary
|
|
184
|
+
|
|
185
|
+
- ✅ HTTP `query` / `path` parameters (need string-boolean semantics **and** a `type: boolean` contract)
|
|
186
|
+
- ❌ JSON body (real JSON booleans — use `z.boolean()` directly)
|
|
187
|
+
- ❌ Config files / environment variables (use `JSON.parse` or the `truthy()` helper in `Flag`)
|
|
188
|
+
- ⚠️ **Different** from `Schema.booleanLike` in `@easbot/utils`: that one targets LLM tool arguments (JSON body), emits `anyOf: [boolean, string]`, and must **not** be used for query / path
|
|
189
|
+
|
|
190
|
+
#### Cross-package usage
|
|
191
|
+
|
|
192
|
+
| Package | Purpose |
|
|
193
|
+
| --------------- | --------------------------------------------------------------- |
|
|
194
|
+
| `@easbot/agent` | The `roots` query parameter of the `/session` route |
|
|
195
|
+
| `@easbot/sdk` | OpenAPI emits `type: boolean` ⇒ SDK generates `roots?: boolean` |
|
|
196
|
+
|
|
36
197
|
## Development
|
|
37
198
|
|
|
38
199
|
```bash
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ EASBOT 生态系统的共享类型库,现代化、轻量且高效。
|
|
|
6
6
|
|
|
7
7
|
## 版本
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
9
|
+
v0.3.32
|
|
10
10
|
## 特性
|
|
11
11
|
|
|
12
12
|
- **类型安全**: 完整的 TypeScript 类型定义
|
|
@@ -33,6 +33,163 @@ const config: AgentConfig = {
|
|
|
33
33
|
};
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
## Agent 类型(跨包唯一真源)
|
|
37
|
+
|
|
38
|
+
`@easbot/types` 是 Agent 元数据定义层的**跨包唯一真源**。下面两个 schema 把过去在 `packages/agent/src/agent/agent.ts`(运行形态)、`@easbot/types`(配置形态)、`packages/plugin/src/agent/types.ts`(plugin 声明形态)三处重复维护的结构收敛为一份。
|
|
39
|
+
|
|
40
|
+
### `AgentModelSchema` / `type AgentModel`
|
|
41
|
+
|
|
42
|
+
模型配置的 provider / modelId 二元组,命名遵循既有范本(`packages/plugin/src/agent/types.ts` 的同款 `AgentModelSchema` + `type AgentModel`):**schema 用 `*Schema` 后缀,type 保留无后缀的 `AgentModel`**——避免 `AgentModel` 作为类型名的全仓跨包引用(`SubAgentPartInput.model` / `AgentInput.model` / gateway 等)因改名而波及。
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { AgentModelSchema, type AgentModel } from '@easbot/types';
|
|
46
|
+
|
|
47
|
+
const model: AgentModel = AgentModelSchema.parse({
|
|
48
|
+
providerId: 'openai',
|
|
49
|
+
modelId: 'gpt-4o',
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `AgentInfoSchema` / `type AgentInfo`
|
|
54
|
+
|
|
55
|
+
Agent 元数据。**只有 `name` 必填**,其余字段全部可选——「配置形态」(Config / Plugin 通常给部分字段) 与「运行形态」(注册表合并后补齐) 都是它的子集,**不再维护两个 schema**。
|
|
56
|
+
|
|
57
|
+
| 字段 | 类型 | 说明 |
|
|
58
|
+
| ------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
59
|
+
| `name` | `string`(必填,≥1 字符) | Agent 唯一标识 |
|
|
60
|
+
| `description` | `string?` | Agent 用途说明 |
|
|
61
|
+
| `mode` | `'subagent' \| 'primary' \| 'all'` | 运行模式(subagent 被 task/agent 工具调;primary 直接响应用户;all 两者兼具),运行时缺省 `'subagent'`,Config 自定义 agent 缺省 `'all'` |
|
|
62
|
+
| `native` | `boolean?` | 是否内置(**运行态由注册表打标,配置态不应写**) |
|
|
63
|
+
| `hidden` | `boolean?` | 是否在 `@` 自动完成 / `list` 中隐藏 |
|
|
64
|
+
| `topP` | `number?` | 核采样 topP |
|
|
65
|
+
| `temperature` | `number?` | 采样温度(最终会被 clamp 到 Provider 范围) |
|
|
66
|
+
| `color` | hex 字符串(`#RRGGBB`)\| 主题色枚举 | UI 显示色 |
|
|
67
|
+
| `permission` | {@link PermissionRulesetSchema}(已扁平化) | **运行形态** ruleset;与 `Config.permission` / `PluginAgent.permission` 的**配置形态**(`PermissionConfigSchema`)不可互换 |
|
|
68
|
+
| `scope` | `'general' \| 'coder' \| ...` | Agent 生效的 context mode 作用域 |
|
|
69
|
+
| `model` | `AgentModel`(仅对象形态) | `{ providerId, modelId }`;**不接受字符串简写**——字符串由 `@easbot/llm` 的 `toModel()` 在安装期归一 |
|
|
70
|
+
| `variant` | `string?` | 模型变体(high / max 等) |
|
|
71
|
+
| `prompt` | `string?` | Agent 系统提示词 |
|
|
72
|
+
| `options` | `Record<string, any>?` | 额外配置选项 |
|
|
73
|
+
| `steps` | `number?` (正整数) | 强制纯文本响应前的最大 Agent 迭代次数 |
|
|
74
|
+
| `disable` | `boolean?` | 禁用该内置 agent(**仅 `Config.agent[x]` 生效**) |
|
|
75
|
+
| _(catchall)_ | `unknown` | 未知字段透传而非剥离(`.easbot/agent/*.md` frontmatter / plugin 自定义字段) |
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { AgentInfoSchema, type AgentInfo } from '@easbot/types';
|
|
79
|
+
|
|
80
|
+
// 1) 配置态:只给部分字段
|
|
81
|
+
AgentInfoSchema.parse({ name: 'reviewer', mode: 'subagent' });
|
|
82
|
+
|
|
83
|
+
// 2) 运行态:合并后补齐
|
|
84
|
+
const info: AgentInfo = AgentInfoSchema.parse({
|
|
85
|
+
name: 'build',
|
|
86
|
+
mode: 'primary',
|
|
87
|
+
options: {},
|
|
88
|
+
permission: [], // 已扁平化形态
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// 3) model 字段:仅对象形态(字符串简写由 llm 的 toModel() 在安装期归一)
|
|
92
|
+
const a: AgentInfo['model'] = { providerId: 'anthropic', modelId: 'claude-sonnet-4-5' };
|
|
93
|
+
const b: AgentInfo['model'] = { providerId: 'openai', modelId: 'gpt-4o' };
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### 设计要点
|
|
97
|
+
|
|
98
|
+
- **配置 / 运行形态合并**:`AgentInfoSchema` 是**配置形态 + 运行形态**的合并 schema,所有字段全部 optional;运行时缺省(`mode` / `native`)由 `@easbot/llm.AgentRegistry.normalize()` 在注册时补齐
|
|
99
|
+
- **catchall 透传**:`.catchall(z.unknown())` 让 frontmatter / plugin 自定义字段不被 zod 剥掉,注册表合并时可保留到 `options` 或直接读出
|
|
100
|
+
- **`PermissionRulesetSchema` 与 `PermissionConfigSchema`** 是两个不同 schema,前者是已扁平化的「运行形态」(值是 rule 对象数组),后者是配置形态 (值是 `allow | deny | ask` 字符串),**互不可替换**
|
|
101
|
+
|
|
102
|
+
#### 跨包使用
|
|
103
|
+
|
|
104
|
+
| 包 | 用途 |
|
|
105
|
+
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
106
|
+
| `@easbot/plugin` | `AgentMetadataSchema` 直接 `export const = AgentInfoSchema`(声明形态与配置态完全一致),通过 `AgentDefinition extends AgentMetadata` 派生 `id?` 字段 |
|
|
107
|
+
| `@easbot/llm` | `AgentRegistry` 用 `AgentInfoSchema.parse` 规范化每条注册项;`mergeLayers` 字段级合并所有层 |
|
|
108
|
+
| `@easbot/utils` | `Permission.Preset.ruleset()` 产出的 ruleset 直接喂给本 schema 的 `permission` 字段 |
|
|
109
|
+
| `@easbot/sdk` | OpenAPI 生成 `operationId = 'agent.list' / 'agent.create'` 等 `AgentInfo[]` 响应 schema |
|
|
110
|
+
| `@easbot/agent` | `server/routes/agent.ts` 的 `resolver(AgentInfoSchema)` + `validator('json', AgentInfoSchema)` |
|
|
111
|
+
|
|
112
|
+
## Command 契约(跨包唯一真源)
|
|
113
|
+
|
|
114
|
+
`@easbot/types` 的 `native/command.ts` 是 Command 契约的**唯一真源**。Command 有**三个语义正交**的形态,字段集有交集但语义不同,**不是重复定义**(`spec/types-standard.md` §3.10.2),故用领域前缀消歧:
|
|
115
|
+
|
|
116
|
+
| 形态 | schema / 类型 | OpenAPI 组件 | 说明 |
|
|
117
|
+
| ---------- | ----------------------------------------------- | --------------- | ----------------------------------------------------- |
|
|
118
|
+
| **配置态** | `CommandConfigInfoSchema` / `CommandConfigInfo` | `CommandConfig` | 用户写在配置文件里的命令模板(`config.command` 的值) |
|
|
119
|
+
| **元信息** | `CommandMetadataSchema` / `CommandMetadata` | — | Markdown frontmatter 声明形态 |
|
|
120
|
+
| **运行态** | `CommandInfoSchema` / `CommandInfo` | `Command` | 命令注册表条目 + HTTP 响应契约 |
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { CommandConfigInfoSchema, CommandInfoSchema, type CommandDefinition } from '@easbot/types';
|
|
124
|
+
|
|
125
|
+
// 配置态:配置文件里的命令模板
|
|
126
|
+
CommandConfigInfoSchema.parse({ template: '审查 {{FILE}}', scope: 'coder' });
|
|
127
|
+
|
|
128
|
+
// 运行态:注册表条目 / HTTP 响应
|
|
129
|
+
CommandInfoSchema.parse({ name: 'review', source: 'command' });
|
|
130
|
+
|
|
131
|
+
// 运行期定义(execute 必填):HTTP 契约(CommandInfo)+ 非契约字段
|
|
132
|
+
const cmd: CommandDefinition = {
|
|
133
|
+
name: 'review',
|
|
134
|
+
scope: 'coder',
|
|
135
|
+
execute: async (args, ctx) => ({
|
|
136
|
+
title: 'Review',
|
|
137
|
+
metadata: {},
|
|
138
|
+
output: String(args),
|
|
139
|
+
success: true,
|
|
140
|
+
}),
|
|
141
|
+
};
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### 设计要点
|
|
145
|
+
|
|
146
|
+
- **`execute` / `isEnabled` 是函数** —— 契约层无法用 JSON Schema 表达,用 `z.custom<T>()` 把**精确函数签名**写进类型层:契约产物与 `z.any()` **完全一致**(实测为 `{}` 空 schema),但 `z.infer` 出来的类型带签名,types 与 `@easbot/plugin` 天然一致,无需两边各写一份 interface 再互相 `Omit`
|
|
147
|
+
- **`execute` 在 HTTP 契约里是 optional** —— 它是函数,JSON 序列化后不存在;HTTP 响应里**没有** `execute` 字段。运行期形态见 `CommandDefinition`(`execute` 必填)
|
|
148
|
+
- **`CommandDefinition extends Omit<CommandInfo, 'execute'>`** —— 运行期形态 = HTTP 契约 + `scope` / `template` / `init` 三个非契约字段,`execute` 收窄为必填
|
|
149
|
+
|
|
150
|
+
#### 跨包使用
|
|
151
|
+
|
|
152
|
+
| 包 | 用途 |
|
|
153
|
+
| ---------------- | ------------------------------------------------------------------------------------------ |
|
|
154
|
+
| `@easbot/plugin` | `command/types.ts` 全部改为从本文件 re-export(对外 API 面不变) |
|
|
155
|
+
| `@easbot/agent` | `CommandRegistry.Info` 改为 re-export;`api/command.ts` 直接引用 `CommandInfo`(无需强转) |
|
|
156
|
+
| `@easbot/sdk` | OpenAPI 生成 `Command`(运行态)与 `CommandConfig`(配置态)两个组件 |
|
|
157
|
+
|
|
158
|
+
## HTTP 布尔型 query / path 参数契约(跨包唯一真源)
|
|
159
|
+
|
|
160
|
+
`native/http.ts` 的 `BooleanQuerySchema` 是 HTTP 布尔型 query / path 参数的**唯一真源**。
|
|
161
|
+
|
|
162
|
+
HTTP 的 query / path 参数在**传输层永远是字符串** —— `?roots=true` 到达服务端时是 `"true"` 这个字符串。因此 zod 校验前必须做**字符串 → boolean 归一**,而三种常见写法各有缺陷:
|
|
163
|
+
|
|
164
|
+
| 写法 | 运行时语义 | OpenAPI 输出 | 结论 |
|
|
165
|
+
| ------------------------------------------------------ | ------------------------------ | --------------- | ------------------------------------------------------------------------ |
|
|
166
|
+
| `z.coerce.boolean()` | ❌ `Boolean("false") === true` | `type: boolean` | **语义 bug** —— `?roots=false` 反而被当成 true |
|
|
167
|
+
| `z.stringbool()` | ✅ `"false"` → `false` | `type: string` | **契约退化** —— SDK 生成 `roots?: string`,调用方传 boolean 直接类型报错 |
|
|
168
|
+
| `BooleanQuerySchema`(`z.preprocess` + `z.boolean()`) | ✅ `"false"` → `false` | `type: boolean` | ✅ 两者兼顾 |
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { BooleanQuerySchema } from '@easbot/types';
|
|
172
|
+
|
|
173
|
+
// query 参数:字符串布尔语义 + OpenAPI 保持 type: boolean
|
|
174
|
+
roots: BooleanQuerySchema.optional().meta({
|
|
175
|
+
description: 'Only return root sessions (no parentId)',
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### 使用边界
|
|
180
|
+
|
|
181
|
+
- ✅ HTTP `query` / `path` 参数(需要字符串布尔语义 + `type: boolean` 契约)
|
|
182
|
+
- ❌ JSON body(真实 JSON boolean,直接用 `z.boolean()`)
|
|
183
|
+
- ❌ 配置文件 / 环境变量(走 `JSON.parse` 或 `Flag` 的 `truthy()` helper)
|
|
184
|
+
- ⚠️ 与 `@easbot/utils` 的 `Schema.booleanLike` **不同**:后者面向 LLM tool 参数(JSON body),OpenAPI 输出 `anyOf: [boolean, string]`,**不可用于 query / path**
|
|
185
|
+
|
|
186
|
+
#### 跨包使用
|
|
187
|
+
|
|
188
|
+
| 包 | 用途 |
|
|
189
|
+
| --------------- | --------------------------------------------------------- |
|
|
190
|
+
| `@easbot/agent` | `/session` 路由的 `roots` query 参数 |
|
|
191
|
+
| `@easbot/sdk` | OpenAPI 输出 `type: boolean` ⇒ SDK 生成 `roots?: boolean` |
|
|
192
|
+
|
|
36
193
|
## 开发
|
|
37
194
|
|
|
38
195
|
```bash
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var o=require('zod');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);var f={id:"easbot",displayName:"EASBot",description:"\u591A Agent \u534F\u4F5C\u751F\u6001\u7CFB\u7EDF\uFF08\u81EA\u5B66\u4E60 / \u81EA\u8FDB\u5316 / \u6301\u7EED\u6539\u8FDB\u7684 AI Agent \u5E73\u53F0\uFF09",url:"https://www.easbot.cn",domain:"easbot.cn",xdgAppName:"easbot",envPrefix:"EASBOT",dataDirName:"easbot",cacheDirName:"easbot",configDirName:"easbot"};function P(n){return `${f.envPrefix}_${n}`}var a=o__default.default.enum(["ask","allow","deny"]).meta({ref:"PermissionActionConfig"}),l=o__default.default.record(o__default.default.string(),a).meta({ref:"PermissionObjectConfig"}),e=o__default.default.union([a,l]).meta({ref:"PermissionRuleConfig"}),D=n=>typeof n=="object"&&n!==null&&!Array.isArray(n)?{__originalKeys:Object.keys(n),...n}:n,v=n=>{if(typeof n=="string")return {"*":n};let d=n,{__originalKeys:p,...m}=d;if(!p)return m;let b={};for(let r of p)r in m&&(b[r]=m[r]);return b},x=o__default.default.preprocess(D,o__default.default.object({__originalKeys:o__default.default.string().array().optional(),read:e.optional(),edit:e.optional(),glob:e.optional(),grep:e.optional(),list:e.optional(),bash:e.optional(),task:e.optional(),external_directory:e.optional(),todo:a.optional(),question:a.optional(),webfetch:a.optional(),websearch:a.optional(),codesearch:a.optional(),lsp:e.optional(),doom_loop:a.optional(),skill:e.optional(),pty_session:e.optional(),pty_manage:e.optional(),write:e.optional(),multiedit:e.optional(),note:e.optional(),memory:e.optional(),codebase:e.optional(),agent_client:e.optional(),gateway:e.optional(),apply_patch:e.optional(),batch:e.optional(),plan:e.optional()}).catchall(e).or(a)).transform(v).meta({ref:"PermissionConfig"}),y=o__default.default.object({read:e.optional(),edit:e.optional(),write:e.optional(),glob:e.optional(),grep:e.optional(),list:e.optional(),bash:e.optional(),webfetch:e.optional(),websearch:e.optional(),task:e.optional(),todo:a.optional(),question:a.optional(),skill:e.optional(),memory:e.optional(),note:e.optional(),pty_session:e.optional(),pty_manage:e.optional(),external_directory:e.optional(),doom_loop:a.optional()}).catchall(e).meta({ref:"AgentPermission"}),O=a,w=e,_={Action:a,Object:l,Rule:e,AgentPermissionSchema:y,Config:x};var E=(r=>(r.HTTP="http",r.WEBSOCKET="websocket",r.GRPC="grpc",r.TCP="tcp",r.UDP="udp",r))(E||{}),R=(s=>(s.GET="GET",s.POST="POST",s.PUT="PUT",s.DELETE="DELETE",s.PATCH="PATCH",s.HEAD="HEAD",s.OPTIONS="OPTIONS",s))(R||{}),T=(i=>(i[i.OK=200]="OK",i[i.CREATED=201]="CREATED",i[i.NO_CONTENT=204]="NO_CONTENT",i[i.BAD_REQUEST=400]="BAD_REQUEST",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.FORBIDDEN=403]="FORBIDDEN",i[i.NOT_FOUND=404]="NOT_FOUND",i[i.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",i[i.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",i[i.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",i))(T||{}),I=(r=>(r.CONNECTING="connecting",r.OPEN="open",r.CLOSING="closing",r.CLOSED="closed",r.ERROR="error",r))(I||{}),C=(r=>(r.TEXT="text",r.BINARY="binary",r.JSON="json",r.PING="ping",r.PONG="pong",r))(C||{}),A=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t))(A||{});var S=(s=>(s.INITIALIZING="initializing",s.IDLE="idle",s.RUNNING="running",s.SUSPENDED="suspended",s.STOPPING="stopping",s.STOPPED="stopped",s.ERROR="error",s))(S||{});var h=(u=>(u.TEXT="text",u.IMAGE="image",u.FILE="file",u.AUDIO="audio",u.VIDEO="video",u.SYSTEM="system",u))(h||{}),k=(m=>(m.USER="user",m.AGENT="agent",m.SYSTEM="system",m))(k||{});var M={};var L=o__default.default.object({url:o__default.default.string().optional(),override:o__default.default.string().optional(),color:o__default.default.string().optional()}).meta({ref:"ProjectIcon"}),U=o__default.default.object({start:o__default.default.string().optional().describe("Startup script to run when creating a new workspace (worktree)")}).meta({ref:"ProjectCommands"}),G=o__default.default.object({created:o__default.default.number(),updated:o__default.default.number(),initialized:o__default.default.number().optional()}).meta({ref:"ProjectTime"}),be=o__default.default.object({id:o__default.default.string(),worktree:o__default.default.string(),vcs:o__default.default.literal("git").optional(),name:o__default.default.string().optional(),icon:L.optional(),commands:U.optional(),time:G,sandboxes:o__default.default.array(o__default.default.string())}).meta({ref:"Project"});function Re(n){return {description:n.description,args:n.args,execute:n.execute}}var Te=o.z;function Ie(n){return o.z.object(n)}var B={provider:"easbot-local",model:"bge-base-zh-v1.5",batchSize:32},K={maxResults:3,minScore:.1,hybrid:{enabled:true,vectorWeight:.7,textWeight:.3}},F={onBoot:false,onSearch:false,onSessionStart:false,intervalMs:1e3*60*60},z={batchSize:50,ignorePatterns:["node_modules/**","dist/**","build/**",".git/**","__pycache__/**","*.min.js","*.min.ts"],incremental:true},j={languages:["ts","tsx","js","py","rs","go","c","cpp","csharp","java","scala","ruby","php","zig"],lazyLoad:true},q={chunkSize:1024,chunkOverlap:102,minChunkLength:100};function Y(n,d){return `${n}/easbot/${d}`}function W(n,d){return `${n}/.easbot/${d}`}var V=[{type:"person",rule:"A human individual, role holder, or named actor."},{type:"organization",rule:"A company, team, institution, or formal group."},{type:"location",rule:"A place, region, site, facility, or spatial scope."},{type:"concept",rule:"An abstract idea, theme, method, policy, or principle."},{type:"object",rule:"A tangible or digital thing, product, artifact, or resource."},{type:"document",rule:"A report, note, page, paper, guideline, or formal text artifact."},{type:"process",rule:"A workflow, procedure, lifecycle, or repeatable sequence of steps."},{type:"task",rule:"A specific action item, issue, requirement, or objective."},{type:"metric",rule:"A measurable quantity, KPI, target value, or indicator."},{type:"time",rule:"A date, period, schedule marker, deadline, or temporal reference."},{type:"event",rule:"A notable milestone, release, incident, meeting, or time-bounded activity."},{type:"keyword",rule:"A compact fallback term when no stronger category applies."}],Q=[{type:"is_a",rule:"Source is a subtype or instance of target."},{type:"part_of",rule:"Source is a component/subset of target."},{type:"has_attribute",rule:"Source has target as a key property or characteristic."},{type:"located_in",rule:"Source is physically or logically located in target."},{type:"occurs_in",rule:"Source event/process happens during or within target context/time/place."},{type:"causes",rule:"Source contributes to or causes target."},{type:"influences",rule:"Source affects target without strict causality."},{type:"owned_by",rule:"Source belongs to or is controlled by target."},{type:"member_of",rule:"Source person/entity is a member of target group."},{type:"uses",rule:"Source uses target as a dependency or tool."},{type:"depends_on",rule:"Source requires target to work or complete."},{type:"related_to",rule:"Weak but useful semantic relation when others do not fit."},{type:"defines",rule:"Source document or concept defines target entity."},{type:"referenced_in",rule:"Source entity is referenced or mentioned in target document."},{type:"used_by",rule:"Source entity is used by target process or concept."},{type:"relates_to",rule:"Source concept is semantically related to target concept."}],H=["database","fts","vector","schema","lock","disk_space","orphan","backend"],Z="embeddingDims_consistency";
|
|
2
|
-
exports.AgentPermissionSchema=
|
|
1
|
+
'use strict';var t=require('zod');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespace(t);var D={id:"easbot",displayName:"EASBot",description:"\u591A Agent \u534F\u4F5C\u751F\u6001\u7CFB\u7EDF\uFF08\u81EA\u5B66\u4E60 / \u81EA\u8FDB\u5316 / \u6301\u7EED\u6539\u8FDB\u7684 AI Agent \u5E73\u53F0\uFF09",url:"https://www.easbot.cn",domain:"easbot.cn",xdgAppName:"easbot",envPrefix:"EASBOT",dataDirName:"easbot",cacheDirName:"easbot",configDirName:"easbot"};function Ie(c){return `${D.envPrefix}_${c}`}var b=t__namespace.default.enum(["ask","allow","deny"]).meta({ref:"PermissionActionConfig"}),T=t__namespace.default.record(t__namespace.default.string(),b).meta({ref:"PermissionObjectConfig"}),r=t__namespace.default.union([b,T]).meta({ref:"PermissionRuleConfig"}),Pe=c=>typeof c=="object"&&c!==null&&!Array.isArray(c)?{__originalKeys:Object.keys(c),...c}:c,Re=c=>{if(typeof c=="string")return {"*":c};let w=c,{__originalKeys:N,...E}=w;if(!N)return E;let j={};for(let a of N)a in E&&(j[a]=E[a]);return j},v=t__namespace.default.preprocess(Pe,t__namespace.default.object({__originalKeys:t__namespace.default.string().array().optional(),read:r.optional(),edit:r.optional(),glob:r.optional(),grep:r.optional(),list:r.optional(),bash:r.optional(),task:r.optional(),external_directory:r.optional(),todo:b.optional(),question:b.optional(),webfetch:b.optional(),websearch:b.optional(),codesearch:r.optional(),lsp:r.optional(),doom_loop:b.optional(),skill:r.optional(),pty_session:r.optional(),pty_manage:r.optional(),write:r.optional(),multiedit:r.optional(),note:r.optional(),memory:r.optional(),codebase:r.optional(),agent_client:r.optional(),gateway:r.optional(),apply_patch:r.optional(),batch:r.optional(),plan:r.optional(),scheduler:r.optional(),worktree:r.optional()}).catchall(r).or(b)).transform(Re).meta({ref:"PermissionConfig"}),M=t__namespace.default.object({read:r.optional(),edit:r.optional(),write:r.optional(),glob:r.optional(),grep:r.optional(),list:r.optional(),bash:r.optional(),webfetch:r.optional(),websearch:r.optional(),task:r.optional(),todo:b.optional(),question:b.optional(),skill:r.optional(),memory:r.optional(),note:r.optional(),pty_session:r.optional(),pty_manage:r.optional(),external_directory:r.optional(),doom_loop:b.optional()}).strict().meta({ref:"AgentPermission"}),k=t__namespace.default.object({permission:t__namespace.default.string(),pattern:t__namespace.default.string(),action:b}).meta({ref:"PermissionRuntimeRule"}),I=t__namespace.default.array(k).meta({ref:"PermissionRuleset"}),we={Action:b,Object:T,Rule:r,AgentPermissionSchema:M,Config:v,RuntimeRule:k,Ruleset:I};var G=(a=>(a.HTTP="http",a.WEBSOCKET="websocket",a.GRPC="grpc",a.TCP="tcp",a.UDP="udp",a))(G||{}),O=(A=>(A.GET="GET",A.POST="POST",A.PUT="PUT",A.DELETE="DELETE",A.PATCH="PATCH",A.HEAD="HEAD",A.OPTIONS="OPTIONS",A))(O||{}),_=(u=>(u[u.OK=200]="OK",u[u.CREATED=201]="CREATED",u[u.NO_CONTENT=204]="NO_CONTENT",u[u.BAD_REQUEST=400]="BAD_REQUEST",u[u.UNAUTHORIZED=401]="UNAUTHORIZED",u[u.FORBIDDEN=403]="FORBIDDEN",u[u.NOT_FOUND=404]="NOT_FOUND",u[u.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",u[u.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",u[u.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",u))(_||{}),L=(a=>(a.CONNECTING="connecting",a.OPEN="open",a.CLOSING="closing",a.CLOSED="closed",a.ERROR="error",a))(L||{}),F=(a=>(a.TEXT="text",a.BINARY="binary",a.JSON="json",a.PING="ping",a.PONG="pong",a))(F||{}),U=(i=>(i[i.OK=200]="OK",i[i.CREATED=201]="CREATED",i[i.NO_CONTENT=204]="NO_CONTENT",i[i.BAD_REQUEST=400]="BAD_REQUEST",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.FORBIDDEN=403]="FORBIDDEN",i[i.NOT_FOUND=404]="NOT_FOUND",i[i.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",i[i.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",i[i.CONFLICT=409]="CONFLICT",i[i.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",i[i.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",i[i.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",i[i.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",i[i.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",i[i.BAD_GATEWAY=502]="BAD_GATEWAY",i[i.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",i[i.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",i[i.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",i))(U||{});var K=t__namespace.default.object({id:t__namespace.default.string(),name:t__namespace.default.string(),cron:t__namespace.default.string(),enabled:t__namespace.default.boolean(),createdAt:t__namespace.default.number(),updatedAt:t__namespace.default.number(),lastFiredAt:t__namespace.default.number().optional(),nextFireAt:t__namespace.default.number().optional(),timezone:t__namespace.default.string().optional()}).meta({ref:"SchedulerTask"}),Te=t__namespace.default.array(K),ke=t__namespace.default.object({status:t__namespace.default.string()}),Ee=t__namespace.default.object({initialized:t__namespace.default.boolean()}),B=(C=>(C.PENDING="pending",C.RUNNING="running",C.PAUSED="paused",C.COMPLETED="completed",C.FAILED="failed",C.CANCELLED="cancelled",C.TIMEOUT="timeout",C.SKIPPED="skipped",C))(B||{}),Q=(a=>(a[a.LOW=0]="LOW",a[a.NORMAL=1]="NORMAL",a[a.HIGH=2]="HIGH",a[a.URGENT=3]="URGENT",a[a.CRITICAL=4]="CRITICAL",a))(Q||{});var cn=t.z.enum(["telegram","slack","feishu","wechat","weixin","webchat","signal","nostr","dingtalk"]),pn=t.z.enum(["low","medium","high","critical"]),ve=t.z.object({enabled:t.z.boolean().default(true),botToken:t.z.string().describe("Telegram Bot Token"),webhookUrl:t.z.string().optional().describe("Webhook URL for receiving updates"),polling:t.z.object({enabled:t.z.boolean().default(true),interval:t.z.number().int().positive().optional().describe("Polling interval in ms"),timeout:t.z.number().int().positive().optional().default(30).describe("Long polling timeout in seconds")}).refine(c=>c===void 0||c.enabled,{message:"polling.enabled must be true when polling is configured"}).optional(),maxConnections:t.z.number().int().positive().optional().default(100),timeout:t.z.number().int().positive().optional().default(3e4)}),Me=t.z.object({enabled:t.z.boolean().default(true),botToken:t.z.string().describe("Slack Bot Token (xoxb-*)"),appToken:t.z.string().optional().describe("Slack App Token (xapp-*) for Socket Mode"),signingSecret:t.z.string().optional().describe("Slack Signing Secret for webhook verification"),maxConnections:t.z.number().int().positive().optional().default(100),timeout:t.z.number().int().positive().optional().default(3e4)}),ze=t.z.object({enabled:t.z.boolean().default(true),appId:t.z.string().describe("Feishu App ID"),appSecret:t.z.string().describe("Feishu App Secret"),encryptKey:t.z.string().optional().describe("Feishu Encrypt Key for message encryption"),verificationToken:t.z.string().optional().describe("Feishu Verification Token"),maxConnections:t.z.number().int().positive().optional().default(100),timeout:t.z.number().int().positive().optional().default(3e4)}),Ne=t.z.object({enabled:t.z.boolean().default(true),mode:t.z.enum(["official","wecom"]).default("official"),appId:t.z.string().describe("WeChat App ID"),appSecret:t.z.string().describe("WeChat App Secret"),token:t.z.string().optional().describe("WeChat Token for message verification"),encodingAESKey:t.z.string().optional().describe("WeChat Encoding AES Key"),agentId:t.z.string().optional().describe("WeCom Agent ID"),maxConnections:t.z.number().int().positive().optional().default(100),timeout:t.z.number().int().positive().optional().default(3e4)}),je=t.z.object({enabled:t.z.boolean().default(true),stateDir:t.z.string().optional().describe("Override the default account persistence directory (default: ~/.easbot/channels/weixin)"),baseUrl:t.z.string().optional().describe("Override the iLink API baseUrl (default: https://ilinkai.weixin.qq.com)"),cdnBaseUrl:t.z.string().optional().describe("Override the CDN baseUrl (default: https://novac2c.cdn.weixin.qq.com/c2c)"),maxMessageLength:t.z.number().int().positive().optional().default(4e3),timeout:t.z.number().int().positive().optional().default(3e4)}),De=t.z.object({enabled:t.z.boolean().default(true),path:t.z.string().optional().default("/"),heartbeatInterval:t.z.number().int().positive().optional().default(3e4),connectionTimeout:t.z.number().int().positive().optional().default(36e5),maxConnections:t.z.number().int().positive().optional().default(1e3),cors:t.z.boolean().optional().default(true)}),Ge=t.z.object({enabled:t.z.boolean().default(true),serviceUrl:t.z.string().optional().default("https://chat.signal.org"),phoneNumber:t.z.string().describe("Signal phone number"),password:t.z.string().optional().describe("Signal account password"),maxConnections:t.z.number().int().positive().optional().default(100),timeout:t.z.number().int().positive().optional().default(3e4)}),Oe=t.z.object({enabled:t.z.boolean().default(true),relays:t.z.array(t.z.string()).optional().default([]).describe("Nostr relay URLs"),privateKey:t.z.string().optional().describe("Nostr private key (hex)"),publicKey:t.z.string().optional().describe("Nostr public key (hex)"),maxConnections:t.z.number().int().positive().optional().default(100),timeout:t.z.number().int().positive().optional().default(3e4)}),_e=t.z.object({enabled:t.z.boolean().default(true),appKey:t.z.string().describe("DingTalk AppKey"),appSecret:t.z.string().describe("DingTalk AppSecret"),token:t.z.string().optional().describe("DingTalk token for signature verification"),encryptKey:t.z.string().optional().describe("DingTalk encrypt key for message encryption"),webhook:t.z.object({enabled:t.z.boolean().default(true),path:t.z.string().optional().default("/dingtalk/webhook"),port:t.z.number().int().positive().optional().describe("Webhook server port")}).optional(),maxConnections:t.z.number().int().positive().optional().default(100),timeout:t.z.number().int().positive().optional().default(3e4)}),Le=t.z.object({telegram:ve.optional(),slack:Me.optional(),feishu:ze.optional(),wechat:Ne.optional(),weixin:je.optional(),webchat:De.optional(),signal:Ge.optional(),nostr:Oe.optional(),dingtalk:_e.optional()}),Fe=t.z.object({enabled:t.z.boolean().default(false),cert:t.z.string().optional().describe("Path to SSL certificate file (or certPath)"),key:t.z.string().optional().describe("Path to SSL key file (or keyPath)"),certPath:t.z.string().optional().describe("Path to SSL certificate file (alias of cert)"),keyPath:t.z.string().optional().describe("Path to SSL key file (alias of key)"),ca:t.z.string().optional().describe("Path to CA certificate file"),forceRedirect:t.z.boolean().optional().default(false).describe("Force redirect HTTP to HTTPS"),httpPort:t.z.number().int().positive().optional().default(80).describe("HTTP redirect port")}),Ue=t.z.object({name:t.z.string().describe("Token name/description"),value:t.z.string().describe("Token value"),permissions:t.z.array(t.z.string()).default(["*"]).describe("Associated permissions"),expiresAt:t.z.number().int().positive().optional().describe("Expiration timestamp (Unix timestamp)"),description:t.z.string().optional().describe("Token description")}),Ke=t.z.object({enabled:t.z.boolean().default(true),tokens:t.z.array(Ue).default([]).describe("List of valid tokens"),onInvalid:t.z.enum(["reject","anonymous"]).default("reject").describe("Behavior when token validation fails"),allowAnonymous:t.z.boolean().default(false).describe("Allow anonymous access"),defaultPermissions:t.z.array(t.z.string()).default([]).describe("Default permissions for anonymous users")}),Be=t.z.object({enabled:t.z.boolean().default(false),authorizationServer:t.z.string().describe("OAuth2 authorization server URL"),clientId:t.z.string().describe("OAuth2 client clientId"),clientSecret:t.z.string().describe("OAuth2 authorization server client secret"),tokenValidationEndpoint:t.z.string().describe("OAuth2 token validation endpoint"),scope:t.z.array(t.z.string()).default([]).describe("OAuth2 scopes")}),Qe=t.z.object({type:t.z.enum(["token","oauth2"]).default("token"),token:Ke.optional(),oauth2:Be.optional()}),qe=t.z.object({mode:t.z.enum(["pull","push","both"]).default("both"),interval:t.z.number().int().positive().default(3e4),pushEvents:t.z.array(t.z.enum(["register","deregister","heartbeat","status_change"])).default(["register","deregister","status_change"]),conflictResolution:t.z.enum(["latest","local","remote"]).default("latest"),remoteNodes:t.z.array(t.z.object({id:t.z.string().describe("Node ID"),address:t.z.string().describe("Node address"),port:t.z.number().int().positive().describe("Node port")})).default([]).describe("Remote node list")}),We=t.z.object({id:t.z.string().describe("Gateway node ID"),address:t.z.string().describe("Gateway node address (e.g., http://localhost:3001)"),enabled:t.z.boolean().default(true),metadata:t.z.record(t.z.string(),t.z.any()).optional()}),Ve=t.z.object({nodeId:t.z.string().describe("Current gateway node ID"),nodes:t.z.array(We).default([]).describe("Other gateway nodes in the cluster"),sync:qe.optional()}),Ye=t.z.object({maxConnectionsPerChannel:t.z.number().int().positive().default(100),idleTimeout:t.z.number().int().positive().default(3e5),reuseStrategy:t.z.enum(["lru","fifo","random"]).default("lru"),healthCheckInterval:t.z.number().int().positive().default(6e4),acquireTimeout:t.z.number().int().positive().default(5e3),warmupCount:t.z.number().int().nonnegative().default(0).describe("Number of connections to warm up")}),Ze=t.z.object({maxLength:t.z.number().int().positive().default(1e4),concurrency:t.z.number().int().positive().default(100),batchSize:t.z.number().int().positive().default(10),batchTimeout:t.z.number().int().positive().default(100),priorityLevels:t.z.number().int().positive().default(4)}),$e=t.z.object({failureThreshold:t.z.number().int().positive().default(5),successThreshold:t.z.number().int().positive().default(3),timeout:t.z.number().int().positive().default(3e4),halfOpenDuration:t.z.number().int().positive().default(15e3)}),Xe=t.z.object({heartbeatInterval:t.z.number().int().positive().default(6e4),heartbeatTimeout:t.z.number().int().positive().default(3e5),heartbeatCheckInterval:t.z.number().int().positive().default(3e5),autoDeregisterTimeout:t.z.number().int().positive().default(6e5),maxAgents:t.z.number().int().positive().default(100),persistenceFile:t.z.string().optional().describe("Path to persist agent registrations"),maxRegistrations:t.z.number().int().positive().default(1e3)}),He=t.z.object({sessionTimeout:t.z.number().int().positive().default(18e5),resumeGracePeriod:t.z.number().int().positive().default(3e5),maxSessions:t.z.number().int().positive().default(1e4),persistenceFile:t.z.string().optional().describe("Path to persist sessions")}),Je=t.z.object({enabled:t.z.boolean().default(true),port:t.z.number().int().positive().default(8080),hostname:t.z.string().default("localhost"),path:t.z.string().optional().default("/"),maxConnections:t.z.number().int().positive().optional().default(1e3),connectionTimeout:t.z.number().int().positive().optional().default(36e5),heartbeatInterval:t.z.number().int().positive().optional().default(3e4),sessionExpireMs:t.z.number().int().positive().optional().default(36e5),https:Fe.optional(),auth:Qe.optional(),cors:t.z.boolean().default(true),corsOrigins:t.z.array(t.z.string()).optional(),mdns:t.z.boolean().default(false),mdnsDomain:t.z.string().optional().default("gateway.easbot.local")}),et=t.z.object({channel:t.z.string().optional().describe("Default channel ID, used when multiple channels are configured"),fallbackChannels:t.z.array(t.z.string()).optional().describe("Fallback channel list, sorted by priority, used for degraded channel selection")}),tt=t.z.enum(["localAgent","subAgent","both"]),nt=t.z.object({mode:tt.default("localAgent").describe("Agent processing mode: localAgent, subAgent, or both"),localAgentPriority:t.z.number().int().min(1).max(10).default(1).describe("Priority for localAgent (lower = higher priority)"),subAgentPriority:t.z.number().int().min(1).max(10).default(2).describe("Priority for subAgent (lower = higher priority)"),timeout:t.z.number().int().positive().optional().default(3e5).describe("Timeout for agent execution in milliseconds"),retryOnFailure:t.z.boolean().default(true).describe("Retry with subAgent when localAgent fails")}),ot=t.z.object({autoRegister:t.z.boolean().default(true).describe("Whether to auto-register agent on startup"),heartbeatInterval:t.z.number().int().positive().default(3e4).describe("Heartbeat interval in milliseconds"),maxReconnectAttempts:t.z.number().int().min(0).default(5).describe("Maximum reconnect attempts"),reconnectDelay:t.z.number().int().positive().default(3e3).describe("Reconnect delay in milliseconds"),heartbeatTimeout:t.z.number().int().positive().default(9e4).describe("Heartbeat timeout in milliseconds")}),ln=t.z.object({server:Je.optional(),channels:Le.optional(),cluster:Ve.optional(),connectionPool:Ye.optional(),messageQueue:Ze.optional(),circuitBreaker:$e.optional(),agentRegistry:Xe.optional(),session:He.optional(),defaults:et.optional(),agentProcessing:nt.optional(),client:ot.optional().describe("Gateway client config for agent registration"),defaultAgent:t.z.string().optional().describe("Default agent ID for routing"),logLevel:t.z.enum(["DEBUG","INFO","WARN","ERROR"]).optional()}).catchall(t.z.unknown());var rt=t__namespace.default.object({url:t__namespace.default.string().optional(),override:t__namespace.default.string().optional(),color:t__namespace.default.string().optional()}).meta({ref:"ProjectIcon"}),it=t__namespace.default.object({start:t__namespace.default.string().optional().describe("Startup script to run when creating a new workspace (worktree)")}).meta({ref:"ProjectCommands"}),at=t__namespace.default.object({created:t__namespace.default.number(),updated:t__namespace.default.number(),initialized:t__namespace.default.number().optional()}).meta({ref:"ProjectTime"}),q=t__namespace.default.object({id:t__namespace.default.string(),worktree:t__namespace.default.string(),vcs:t__namespace.default.literal("git").optional(),name:t__namespace.default.string().optional(),icon:rt.optional(),commands:it.optional(),time:at,sandboxes:t__namespace.default.array(t__namespace.default.string())}).meta({ref:"Project"});var z=t__namespace.object({file:t__namespace.string(),before:t__namespace.string(),after:t__namespace.string(),additions:t__namespace.number(),deletions:t__namespace.number(),status:t__namespace.enum(["added","deleted","modified","renamed"]).optional(),oldPath:t__namespace.string().optional()}).meta({ref:"FileDiff"}),st=t__namespace.object({start:t__namespace.object({line:t__namespace.number(),character:t__namespace.number()}),end:t__namespace.object({line:t__namespace.number(),character:t__namespace.number()})}).meta({ref:"Range"}),ct=t__namespace.object({path:t__namespace.string(),added:t__namespace.number().int(),removed:t__namespace.number().int(),status:t__namespace.enum(["added","deleted","modified"])}).meta({ref:"File"}),pt=t__namespace.object({name:t__namespace.string(),path:t__namespace.string(),absolute:t__namespace.string(),type:t__namespace.enum(["file","directory"]),ignored:t__namespace.boolean()}).meta({ref:"FileNode"}),lt=t__namespace.object({type:t__namespace.enum(["text","binary"]),content:t__namespace.string(),diff:t__namespace.string().optional(),patch:t__namespace.object({oldFileName:t__namespace.string(),newFileName:t__namespace.string(),oldHeader:t__namespace.string().optional(),newHeader:t__namespace.string().optional(),hunks:t__namespace.array(t__namespace.object({oldStart:t__namespace.number(),oldLines:t__namespace.number(),newStart:t__namespace.number(),newLines:t__namespace.number(),lines:t__namespace.array(t__namespace.string())})),index:t__namespace.string().optional()}).optional(),encoding:t__namespace.literal("base64").optional(),mimeType:t__namespace.string().optional()}).meta({ref:"FileContent"});var W={event:"evt",session:"ses",message:"msg",permission:"per",question:"que",user:"usr",part:"prt",pty:"pty",tool:"tool",workspace:"wrk",command:"cmd",task:"task",heartbeat:"hb",agent:"ag",subagent:"sub",hook:"hok",compaction:"cmp",context:"ctx",experience:"exp",pattern:"pat",knowledge:"knw",evolution:"evo",result:"res",stream:"stm"};function x(c){return t__namespace.default.string().startsWith(W[c])}var V=x("session").meta({ref:"SessionId"}),Y=t__namespace.default.enum(["general","coder"]).meta({ref:"ContextMode"}),gt=["general","coder"],Z=t__namespace.default.object({id:V,slug:t__namespace.default.string(),providerId:t__namespace.default.string(),directory:t__namespace.default.string(),parentId:V.optional(),contextMode:Y.optional(),summary:t__namespace.default.object({additions:t__namespace.default.number(),deletions:t__namespace.default.number(),files:t__namespace.default.number(),diffs:t__namespace.default.array(z).optional(),noSnapshotReason:t__namespace.default.enum(["no-messages","missing-from","missing-to"]).optional()}).optional(),share:t__namespace.default.object({url:t__namespace.default.string()}).optional(),title:t__namespace.default.string(),version:t__namespace.default.string(),time:t__namespace.default.object({created:t__namespace.default.number(),updated:t__namespace.default.number(),compacting:t__namespace.default.number().optional(),archived:t__namespace.default.number().optional()}),permission:I.optional(),revert:t__namespace.default.object({messageId:t__namespace.default.string(),partId:t__namespace.default.string().optional(),snapshot:t__namespace.default.string().regex(/^[0-9a-f]{40}$/,"invalid snapshot hash").optional(),diff:t__namespace.default.string().optional(),backups:t__namespace.default.array(t__namespace.default.object({original:t__namespace.default.string(),backup:t__namespace.default.string().optional()})).optional()}).optional()}).meta({ref:"Session"}),dt=Z.extend({project:q.nullable()}).meta({ref:"GlobalSession"}),ut=t__namespace.default.object({secret:t__namespace.default.string(),url:t__namespace.default.string()}).meta({ref:"SessionShare"}),ft={ContextModeValues:gt,Info:Z,GlobalInfo:dt,ShareInfo:ut};var $={General:"general",Coder:"coder"},kn=Object.values($),En=$.General,X={General:"general",Coder:"coder",All:"all"},P=Object.values(X),vn=X.All;function Dn(c){return {description:c.description,args:c.args,execute:c.execute}}var Gn=t.z;function On(c){return t.z.object(c)}var J=t__namespace.default.object({type:t__namespace.default.literal("local").describe("Type of MCP server connection"),command:t__namespace.default.string().describe("Command to run the MCP server"),args:t__namespace.default.string().array().optional().describe("Arguments to pass to the command"),env:t__namespace.default.record(t__namespace.default.string(),t__namespace.default.string()).optional().describe("Environment variables to set when running the MCP server"),enabled:t__namespace.default.boolean().optional().describe("Enable or disable the MCP server on startup"),timeout:t__namespace.default.number().int().positive().optional().describe("Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified."),description:t__namespace.default.string().optional().describe("Description of the MCP server"),scope:t__namespace.default.enum(P).optional().describe("Context mode scope for the MCP server: all/general/coder. Defaults to all.")}).strict().meta({ref:"McpLocalConfig"}),ee=t__namespace.default.object({clientId:t__namespace.default.string().optional().describe("OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted."),clientSecret:t__namespace.default.string().optional().describe("OAuth client secret (if required by the authorization server)"),scope:t__namespace.default.string().optional().describe("OAuth scopes to request during authorization")}).strict().meta({ref:"McpOAuthConfig"}),te=t__namespace.default.object({type:t__namespace.default.literal("remote").describe("Type of MCP server connection"),url:t__namespace.default.string().describe("URL of the remote MCP server"),enabled:t__namespace.default.boolean().optional().describe("Enable or disable the MCP server on startup"),headers:t__namespace.default.record(t__namespace.default.string(),t__namespace.default.string()).optional().describe("Headers to send with the request"),oauth:t__namespace.default.union([ee,t__namespace.default.literal(false)]).optional().describe("OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection."),timeout:t__namespace.default.number().int().positive().optional().describe("Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified."),description:t__namespace.default.string().optional().describe("Description of the MCP server"),scope:t__namespace.default.enum(P).optional().describe("Context mode scope for the MCP server: all/general/coder. Defaults to all.")}).strict().meta({ref:"McpRemoteConfig"}),bt=t__namespace.default.discriminatedUnion("type",[J,te]);var yt=t__namespace.default.object({template:t__namespace.default.string(),description:t__namespace.default.string().optional(),agent:t__namespace.default.string().optional(),model:t__namespace.default.string().optional().describe("Model identifier in provider/model format, e.g. anthropic/claude-3-5-sonnet"),subtask:t__namespace.default.boolean().optional(),scope:t__namespace.default.enum(P).optional().describe("Context mode scope")}).meta({ref:"CommandConfig"}),ne=t__namespace.default.enum(["command","mcp","skill"]).describe("Command source"),ht=t__namespace.default.object({name:t__namespace.default.string().describe("Command name"),description:t__namespace.default.string().describe("Command description"),scope:t__namespace.default.enum(["general","coder","all"]).optional().describe("Context mode scope"),agent:t__namespace.default.string().optional().describe("Specified agent name"),model:t__namespace.default.string().optional().describe("Specified model in provider/model format"),hints:t__namespace.default.array(t__namespace.default.string()).optional().describe("Argument hints"),commandType:t__namespace.default.enum(["prompt","local"]).optional().describe("Command type"),hidden:t__namespace.default.boolean().optional().describe("Whether hidden")}),oe=t__namespace.default.union([t__namespace.default.string(),t__namespace.default.record(t__namespace.default.string(),t__namespace.default.unknown())]).describe("Command arguments"),re=t__namespace.default.discriminatedUnion("type",[t__namespace.default.object({type:t__namespace.default.literal("text"),text:t__namespace.default.string().describe("Text content")}),t__namespace.default.object({type:t__namespace.default.literal("image"),source:t__namespace.default.object({type:t__namespace.default.enum(["base64","url"]),mime:t__namespace.default.string().describe("File mime type"),data:t__namespace.default.string().describe("File base64 encoding data or url")})}),t__namespace.default.object({type:t__namespace.default.literal("file"),url:t__namespace.default.string().describe("File path"),filename:t__namespace.default.string().describe("File name"),mime:t__namespace.default.string().optional().describe("File mime type")})]),xt=t__namespace.default.object({sessionId:t__namespace.default.string().describe("Session ID"),directory:t__namespace.default.string().describe("Working directory"),model:t__namespace.default.string().optional().describe("Model identifier in provider/model format"),agent:t__namespace.default.string().optional().describe("Agent name"),arguments:oe.describe("Command arguments")}),ie=t__namespace.default.record(t__namespace.default.string(),t__namespace.default.unknown()).describe("Result metadata"),Ct=t__namespace.default.object({title:t__namespace.default.string().describe("Result title"),metadata:ie.describe("Result metadata"),output:t__namespace.default.string().describe("Result output"),parts:t__namespace.default.array(re).optional().describe("Result parts"),success:t__namespace.default.boolean().describe("Whether execution succeeded"),error:t__namespace.default.string().optional().describe("Error message if failed")}),St=t__namespace.default.object({agent:t__namespace.default.object({name:t__namespace.default.string().describe("Agent name"),model:t__namespace.default.string().optional().describe("Agent model in provider/model format")}).optional().describe("Agent context")}),At=t__namespace.default.object({isEnabled:t__namespace.default.boolean().optional().describe("Is enabled check result")}),It=t__namespace.default.object({name:t__namespace.default.string(),description:t__namespace.default.string().optional(),agent:t__namespace.default.string().optional(),model:t__namespace.default.string().optional().describe("Model identifier in provider/model format"),source:ne.optional(),subtask:t__namespace.default.boolean().optional(),hints:t__namespace.default.array(t__namespace.default.string()).optional(),commandType:t__namespace.default.enum(["prompt","local"]).optional(),hidden:t__namespace.default.boolean().optional(),isEnabled:t__namespace.default.custom().optional(),execute:t__namespace.default.custom().optional()}).meta({ref:"Command"});var Pt={provider:"easbot-local",model:"bge-base-zh-v1.5",batchSize:32},Rt={maxResults:3,minScore:.1,hybrid:{enabled:true,vectorWeight:.7,textWeight:.3}},wt={onBoot:false,onSearch:false,onSessionStart:false,intervalMs:1e3*60*60},Tt={batchSize:50,ignorePatterns:["node_modules/**","dist/**","build/**",".git/**","__pycache__/**","*.min.js","*.min.ts"],incremental:true},kt={languages:["ts","tsx","js","py","rs","go","c","cpp","csharp","java","scala","ruby","php","zig"],lazyLoad:true},Et=[{type:"person",rule:"A human individual, role holder, or named actor."},{type:"organization",rule:"A company, team, institution, or formal group."},{type:"location",rule:"A place, region, site, facility, or spatial scope."},{type:"concept",rule:"An abstract idea, theme, method, policy, or principle."},{type:"object",rule:"A tangible or digital thing, product, artifact, or resource."},{type:"document",rule:"A report, note, page, paper, guideline, or formal text artifact."},{type:"process",rule:"A workflow, procedure, lifecycle, or repeatable sequence of steps."},{type:"task",rule:"A specific action item, issue, requirement, or objective."},{type:"metric",rule:"A measurable quantity, KPI, target value, or indicator."},{type:"time",rule:"A date, period, schedule marker, deadline, or temporal reference."},{type:"event",rule:"A notable milestone, release, incident, meeting, or time-bounded activity."},{type:"keyword",rule:"A compact fallback term when no stronger category applies."}],vt=[{type:"is_a",rule:"Source is a subtype or instance of target."},{type:"part_of",rule:"Source is a component/subset of target."},{type:"has_attribute",rule:"Source has target as a key property or characteristic."},{type:"located_in",rule:"Source is physically or logically located in target."},{type:"occurs_in",rule:"Source event/process happens during or within target context/time/place."},{type:"causes",rule:"Source contributes to or causes target."},{type:"influences",rule:"Source affects target without strict causality."},{type:"owned_by",rule:"Source belongs to or is controlled by target."},{type:"member_of",rule:"Source person/entity is a member of target group."},{type:"uses",rule:"Source uses target as a dependency or tool."},{type:"depends_on",rule:"Source requires target to work or complete."},{type:"related_to",rule:"Weak but useful semantic relation when others do not fit."},{type:"defines",rule:"Source document or concept defines target entity."},{type:"referenced_in",rule:"Source entity is referenced or mentioned in target document."},{type:"used_by",rule:"Source entity is used by target process or concept."},{type:"relates_to",rule:"Source concept is semantically related to target concept."}],Mt=["database","fts","vector","schema","lock","disk_space","orphan","backend"],zt="embeddingDims_consistency";var ae={STDIO:"stdio",HTTP:"http",WS:"websocket"},se=t.z.enum(["stdio","http","websocket"]),ce=t.z.object({command:t.z.string(),args:t.z.array(t.z.string())}),pe=t.z.object({baseUrl:t.z.string().url(),timeout:t.z.number().positive().default(6e4)}),le=t.z.object({url:t.z.string().url(),timeout:t.z.number().positive().default(3e4),batchSize:t.z.number().positive().default(10),batchInterval:t.z.number().positive().default(50),heartbeatInterval:t.z.number().positive().default(3e4)}),Nt=t.z.object({stdio:ce.optional(),http:pe.optional(),ws:le.optional()}),jt=t.z.object({id:t.z.string().min(1),options:t.z.record(t.z.string(),t.z.unknown()).optional()}),Dt=t.z.object({agent:t.z.string().optional(),model:jt.optional()}),me=t.z.object({directory:t.z.string().default(process.cwd()),enabled:t.z.boolean().default(true),channel:se.default("websocket"),port:t.z.number().int().min(1).max(65535).default(3e3),hostname:t.z.hostname().default("localhost"),timeout:t.z.number().positive().default(3e4),name:t.z.string().optional(),agentId:t.z.string().optional(),stdio:ce.optional(),http:pe.optional(),ws:le.optional(),agent:Dt.optional()}),Gt=t.z.object({id:t.z.string().min(1),type:t.z.enum(["easbot","custom"]),name:t.z.string().optional(),agentId:t.z.string().optional(),channel:se.optional(),connection:Nt,autoConnect:t.z.boolean().default(false),priority:t.z.number().int().nonnegative().default(0)}),ge=t.z.object({clients:t.z.array(Gt).min(1),defaultClientId:t.z.string().optional()}),Xn=t.z.object({server:me}),Hn=t.z.object({clients:ge}),Ot=t.z.object({autoRegister:t.z.boolean().default(true),gatewayUrl:t.z.url().optional()}).optional(),Jn=t.z.object({server:me.optional(),clients:ge.optional(),client:Ot.optional()}),eo={enabled:true,directory:process.cwd(),channel:ae.WS,port:3e3,hostname:"localhost",timeout:3e4},to={type:"custom",channel:ae.WS,autoConnect:false,priority:0};var _t=t__namespace.default.enum(["text_processing","code_generation","data_analysis","task_execution","workflow_management","monitoring","communication"]),de=t__namespace.default.object({modelId:t__namespace.default.string().min(1).describe("Model ID"),providerId:t__namespace.default.string().min(1).describe("Provider ID")}).meta({ref:"AgentModel"}),Lt=t__namespace.default.object({name:t__namespace.default.string().min(1).describe("Agent name (unique identifier)"),description:t__namespace.default.string().optional().describe("When to use this agent"),mode:t__namespace.default.enum(["subagent","primary","all"]).optional().describe("Agent mode"),native:t__namespace.default.boolean().optional().describe("Whether this is a built-in agent"),hidden:t__namespace.default.boolean().optional().describe("Hide from @ autocomplete menu and agent list"),topP:t__namespace.default.number().optional().describe("Top-p sampling"),temperature:t__namespace.default.number().optional().describe("Sampling temperature"),color:t__namespace.default.union([t__namespace.default.string().regex(/^#[0-9a-fA-F]{6}$/,"Invalid hex color format"),t__namespace.default.enum(["primary","secondary","accent","success","warning","error","info"])]).optional().describe("Hex color code (e.g., #FF5733) or theme color (e.g., primary)"),permission:I.optional().describe("Flattened permission ruleset"),scope:t__namespace.default.enum(P).optional().describe("Agent scope (context mode)"),model:de.optional().describe("Model: { providerId, modelId }"),variant:t__namespace.default.string().optional().describe("Default model variant"),prompt:t__namespace.default.string().optional().describe("Agent system prompt"),options:t__namespace.default.record(t__namespace.default.string(),t__namespace.default.any()).optional().describe("Additional agent options"),steps:t__namespace.default.number().int().positive().optional().describe("Maximum number of agentic iterations before forcing text-only response"),disable:t__namespace.default.boolean().optional().describe("Disable this built-in agent")}).catchall(t__namespace.default.unknown()).meta({ref:"Agent"});var Ft=t__namespace.default.object({id:x("pty"),title:t__namespace.default.string(),command:t__namespace.default.string(),args:t__namespace.default.array(t__namespace.default.string()),cwd:t__namespace.default.string(),status:t__namespace.default.enum(["running","exited"]),pid:t__namespace.default.number()}).meta({ref:"Pty"}),Ut=t__namespace.default.object({command:t__namespace.default.string().optional(),args:t__namespace.default.array(t__namespace.default.string()).optional(),cwd:t__namespace.default.string().optional(),title:t__namespace.default.string().optional(),env:t__namespace.default.record(t__namespace.default.string(),t__namespace.default.string()).optional(),persistent:t__namespace.default.boolean().optional().default(true)}),Kt=t__namespace.default.object({title:t__namespace.default.string().optional(),size:t__namespace.default.object({rows:t__namespace.default.number(),cols:t__namespace.default.number()}).optional()});var ue=t__namespace.default.object({label:t__namespace.default.string().describe("Display text (1-5 words, concise)"),description:t__namespace.default.string().describe("Explanation of choice")}).meta({ref:"QuestionOption"}),fe=t__namespace.default.object({question:t__namespace.default.string().describe("Complete question"),header:t__namespace.default.string().describe("Very short label (max 30 chars)"),options:t__namespace.default.array(ue).describe("Available choices"),multiple:t__namespace.default.boolean().optional().describe("Allow selecting multiple choices"),custom:t__namespace.default.boolean().optional().describe("Allow typing a custom answer (default: true)")}).meta({ref:"QuestionInfo"}),be=t__namespace.default.object({id:x("question"),sessionId:x("session"),questions:t__namespace.default.array(fe).describe("Questions to ask"),tool:t__namespace.default.object({messageId:t__namespace.default.string(),callId:t__namespace.default.string()}).optional()}).meta({ref:"QuestionRequest"}),Bt=t__namespace.default.array(be),ye=t__namespace.default.array(t__namespace.default.string()).meta({ref:"QuestionAnswer"}),Qt=t__namespace.default.object({answers:t__namespace.default.array(ye).describe("User answers in order of questions (each answer is an array of selected labels)")}),qt=t__namespace.default.object({requestId:x("question")}),Wt=t__namespace.default.enum(["user","timeout"]);var Vt=t.z.preprocess(c=>{if(typeof c!="string")return c;let w=c.trim().toLowerCase();return ["true","1","yes","on","y","enabled"].includes(w)?true:["false","0","no","off","n","disabled"].includes(w)?false:c},t.z.boolean());var xe=t__namespace.default.enum(["pending","in_progress","completed","cancelled"]),Ce=t__namespace.default.enum(["high","medium","low"]),Se=t__namespace.default.object({content:t__namespace.default.string().describe("Brief description of the task"),status:xe.describe("Current status of the task: pending, in_progress, completed, cancelled"),priority:Ce.describe("Priority level of the task: high, medium, low"),id:t__namespace.default.string().describe("Unique identifier for the todo item")}).meta({ref:"Todo"}),Yt=t__namespace.default.array(Se);var Ae=t__namespace.default.object({read:t__namespace.default.number(),write:t__namespace.default.number()}).meta({ref:"UsageCache"}),Zt=t__namespace.default.object({total:t__namespace.default.number().optional(),input:t__namespace.default.number(),output:t__namespace.default.number(),reasoning:t__namespace.default.number(),cache:Ae}).meta({ref:"Usage"});
|
|
2
|
+
exports.ACPAgentRuntimeConfigSchema=Dt;exports.ACPChannelTypeSchema=se;exports.ACPClientConfigSchema=Gt;exports.ACPClientRegisterConfigSchema=Ot;exports.ACPClientsConfigSchema=ge;exports.ACPConnectionConfigSchema=Nt;exports.ACPHttpConnectionConfigSchema=pe;exports.ACPInfoACPClientsConfigSchema=Hn;exports.ACPInfoACPConfigSchema=Jn;exports.ACPInfoACPServerConfigSchema=Xn;exports.ACPModelConfigSchema=jt;exports.ACPServerConfigSchema=me;exports.ACPStdioConnectionConfigSchema=ce;exports.ACPWebSocketConnectionConfigSchema=le;exports.ACP_DEFAULT_CLIENT_CONFIG=to;exports.ACP_DEFAULT_SERVER_CONFIG=eo;exports.AgentCapabilitySchema=_t;exports.AgentInfoSchema=Lt;exports.AgentModeSchema=tt;exports.AgentModelSchema=de;exports.AgentPermission=M;exports.AgentPermissionSchema=M;exports.AgentProcessingConfigSchema=nt;exports.AgentRegistryConfigSchema=Xe;exports.AgentSyncConfigSchema=qe;exports.AuthConfigSchema=Qe;exports.BooleanQuerySchema=Vt;exports.Brand=D;exports.ChannelConfigSchema=Le;exports.ChannelType=ae;exports.CircuitBreakerConfigSchema=$e;exports.CommandArgumentsSchema=oe;exports.CommandConfigInfoSchema=yt;exports.CommandExecuteResultMetadataSchema=ie;exports.CommandExecuteResultSchema=Ct;exports.CommandExecutionContextSchema=xt;exports.CommandInfoSchema=It;exports.CommandInitContextSchema=St;exports.CommandInitResultSchema=At;exports.CommandMetadataSchema=ht;exports.CommandPromptPartSchema=re;exports.CommandSourceSchema=ne;exports.ConnectionPoolConfigSchema=Ye;exports.ContextModeEnum=$;exports.ContextModeSchema=Y;exports.ContextModeValues=kn;exports.DEFAULT_EMBEDDING_CONFIG=Pt;exports.DEFAULT_INDEXER_CONFIG=Tt;exports.DEFAULT_PARSER_CONFIG=kt;exports.DEFAULT_SEARCH_CONFIG=Rt;exports.DEFAULT_SYNC_CONFIG=wt;exports.DefaultContextMode=En;exports.DefaultScope=vn;exports.DefaultsConfigSchema=et;exports.DingTalkChannelConfigSchema=_e;exports.EMBEDDING_DIMS_CONSISTENCY_CHECK=zt;exports.FeishuChannelConfigSchema=ze;exports.FileContentSchema=lt;exports.FileDiffSchema=z;exports.FileInfoSchema=ct;exports.FileNodeSchema=pt;exports.GRAPH_ENTITY_TYPE_DEFINITIONS=Et;exports.GRAPH_RELATION_TYPE_DEFINITIONS=vt;exports.GatewayChannelTypeSchema=cn;exports.GatewayClientConfigSchema=ot;exports.GatewayClusterConfigSchema=Ve;exports.GatewayConfigSchema=ln;exports.GatewayMessagePrioritySchema=pn;exports.GatewayNodeConfigSchema=We;exports.GatewayServerConfigSchema=Je;exports.HTTPMethod=O;exports.HTTPSConfigSchema=Fe;exports.HTTPStatusCode=_;exports.HttpStatus=U;exports.KNOWLEDGE_DOCTOR_PUBLIC_CHECKS=Mt;exports.McpLocalConfigSchema=J;exports.McpOAuthConfigSchema=ee;exports.McpRemoteConfigSchema=te;exports.McpSchema=bt;exports.MessageQueueConfigSchema=Ze;exports.NostrChannelConfigSchema=Oe;exports.OAuth2AuthConfigSchema=Be;exports.Permission=we;exports.PermissionAction=b;exports.PermissionActionSchema=b;exports.PermissionConfig=v;exports.PermissionConfigSchema=v;exports.PermissionObject=T;exports.PermissionObjectSchema=T;exports.PermissionRule=r;exports.PermissionRuleSchema=r;exports.PermissionRuleset=I;exports.PermissionRulesetSchema=I;exports.PermissionRuntimeRule=k;exports.PermissionRuntimeRuleSchema=k;exports.ProjectCommandsSchema=it;exports.ProjectIconSchema=rt;exports.ProjectInfoSchema=q;exports.ProjectTimeSchema=at;exports.Protocol=G;exports.PtyCreateInputSchema=Ut;exports.PtyInfoSchema=Ft;exports.PtyUpdateInputSchema=Kt;exports.QuestionAnswerSchema=ye;exports.QuestionInfoSchema=fe;exports.QuestionOptionSchema=ue;exports.QuestionParamSchema=qt;exports.QuestionReplySchema=Qt;exports.QuestionReplySourceSchema=Wt;exports.QuestionRequestListSchema=Bt;exports.QuestionRequestSchema=be;exports.RangeSchema=st;exports.SchedulerInitializedSchema=Ee;exports.SchedulerStatusSchema=ke;exports.SchedulerTaskListSchema=Te;exports.SchedulerTaskSchema=K;exports.ScopeEnum=X;exports.ScopeValues=P;exports.SessionConfigSchema=He;exports.SessionTypes=ft;exports.SignalChannelConfigSchema=Ge;exports.SlackChannelConfigSchema=Me;exports.TaskPriority=Q;exports.TaskStatus=B;exports.TelegramChannelConfigSchema=ve;exports.TodoListSchema=Yt;exports.TodoPrioritySchema=Ce;exports.TodoSchema=Se;exports.TodoStatusSchema=xe;exports.TokenAuthConfigSchema=Ke;exports.TokenAuthItemSchema=Ue;exports.UsageCacheSchema=Ae;exports.UsageSchema=Zt;exports.WeChatChannelConfigSchema=Ne;exports.WebChatChannelConfigSchema=De;exports.WebSocketMessageType=F;exports.WebSocketState=L;exports.WeixinChannelConfigSchema=je;exports.brandEnv=Ie;exports.buildToolArgs=On;exports.createTool=Dn;exports.idPrefixes=W;exports.idSchema=x;exports.toolSchema=Gn;
|