personal-bot 0.2.13 → 0.2.14
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/docs/claude-code-design.md +1 -1
- package/docs/release.md +3 -3
- package/docs/technical-design.md +3 -3
- package/lib/common/schema.d.ts +2 -0
- package/lib/common/schema.js +10 -0
- package/lib/common/validation.d.ts +0 -2
- package/lib/common/validation.js +0 -10
- package/lib/extension/dsh/command.js +2 -1
- package/lib/extension/dsh/management.js +2 -1
- package/lib/tools/agents/dsh-tool.js +2 -1
- package/lib/tools/history/contract.js +2 -1
- package/lib/tools/history/dsh-tool.js +2 -1
- package/lib/tools/teams/dsh-tool.js +2 -1
- package/package.json +1 -2
- package/scripts/README.md +5 -5
- package/src/common/schema.ts +11 -0
- package/src/common/validation.ts +0 -11
- package/src/extension/dsh/command.ts +2 -1
- package/src/extension/dsh/management.ts +2 -1
- package/src/tools/agents/dsh-tool.ts +2 -1
- package/src/tools/agents/tool.ts +2 -1
- package/src/tools/history/contract.ts +2 -1
- package/src/tools/history/dsh-tool.ts +2 -1
- package/src/tools/teams/dsh-tool.ts +2 -1
- package/src/tools/teams/tool.ts +2 -1
- package/npm-shrinkwrap.json +0 -13544
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"plugins": [
|
|
7
7
|
{
|
|
8
8
|
"name": "personal-bot",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.14",
|
|
10
10
|
"description": "Workspace materials, skills, native experts, and shared Python.",
|
|
11
11
|
"source": {
|
|
12
12
|
"source": "npm",
|
|
13
13
|
"package": "personal-bot",
|
|
14
|
-
"version": "0.2.
|
|
14
|
+
"version": "0.2.14"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
]
|
package/README.md
CHANGED
|
@@ -166,7 +166,7 @@ Existing layouts and agreements take precedence. Fetch queryable data when neede
|
|
|
166
166
|
|
|
167
167
|
## Updates and operating scope
|
|
168
168
|
|
|
169
|
-
Current release: **0.2.
|
|
169
|
+
Current release: **0.2.14**. Update through the host's native package manager. For a local Pi source, update the checkout, run `npm ci --ignore-scripts` when dependencies change, then reload or restart. Stop active specialists before changing versions. Recreate specialists across compatibility lines; existing materials, history, and backups are preserved.
|
|
170
170
|
|
|
171
171
|
Operations follow the user's request, existing agreements, and required confirmations. Bash, Python, MCP, and extensions use the actual account and credential permissions. Enforce hard limits through read-only credentials, service controls, or restricted environments. Trades, transfers, and ledger changes require authorization for those operations. After cancellation, timeout, or disconnection, query native status before retrying to avoid duplicate execution.
|
|
172
172
|
|
package/README.zh-CN.md
CHANGED
|
@@ -166,7 +166,7 @@ Pi 主会话恢复用 `pi --resume` 明确选择;`pi --continue` 可能选中
|
|
|
166
166
|
|
|
167
167
|
## 更新与操作范围
|
|
168
168
|
|
|
169
|
-
当前版本为 **0.2.
|
|
169
|
+
当前版本为 **0.2.14**。通过宿主原生包管理更新;本地 Pi 来源更新源码,依赖变化后运行 `npm ci --ignore-scripts`,再重载或重启。更换版本前停止活动专家;不同兼容线的专家需重新创建,旧资料、历史和备份保留。
|
|
170
170
|
|
|
171
171
|
操作按用户请求、已有约定和必要确认执行。Bash、Python、MCP 和扩展使用实际账户与凭据权限;硬限制应由只读凭据、服务端控制或受限环境提供。交易、转账和账本修改需要相应授权。取消、超时或断连后,先查原生状态再决定是否重试,避免重复执行。
|
|
172
172
|
|
|
@@ -40,6 +40,6 @@ Claude 插件不实现 pbot 面板、历史采集与检索、摘要、ACP 委派
|
|
|
40
40
|
|
|
41
41
|
最低及当前原生检查基线是 Claude Code 2.1.325;Node 消费基线为 22.19+,完整开发使用 Linux、Node 24.9+。后续升级检查公开 hook 输入/输出、manifest、技能与专家发现,不再维护 Claude 内部记录版本白名单或大型宿主声明快照。
|
|
42
42
|
|
|
43
|
-
本地测试使用真实临时目录、Node/Python 进程及共用服务,核对固定根、停用无副作用、配置保留、错误处理和结构化 hook 输出。消费检查安装实际 tarball
|
|
43
|
+
本地测试使用真实临时目录、Node/Python 进程及共用服务,核对固定根、停用无副作用、配置保留、错误处理和结构化 hook 输出。消费检查安装实际 tarball 并执行原生 `claude plugin validate`,另将 tarball 直接解压,在没有 node_modules 的条件下执行确定性命令、hook 和启用工作区的资料读取。原生 marketplace 缓存不安装 npm 依赖,因此解包后的 Node 入口必须独立运行。
|
|
44
44
|
|
|
45
45
|
真实模型验收在已批准且不含个人凭据的环境完成,核对:首任务资料与环境可见;工作区资料修改在下一轮生效;技能加载;原生专家职责与继续;用户选择的原生团队行为;Python 完整路径执行。无模型的进程测试与静态校验只报告实际覆盖范围,不替代这些模型行为检查。结果写任务、PR 或 CI,不维护验证日记。
|
package/docs/release.md
CHANGED
|
@@ -40,11 +40,11 @@ npm pack
|
|
|
40
40
|
|
|
41
41
|
prepack 依次执行 check、build:cli、build:dsh、build:claude;CLI 构建清理 lib,因此保持该顺序。build:claude 用 tsc 编译 Node hook/CLI,从共享职责生成原生 agent,并同步根插件与 marketplace 的发布版本,发布前核对它们与 package.json 一致。
|
|
42
42
|
|
|
43
|
-
核对包清单包含 bin、lib(安装 CLI、dsh Host/Web、Claude Node 与 Pi/dsh ACP worker)、src、resources(含 dsh patch、Claude 原生 pbot 技能与 agent、ACP 仅技能插件)、Python 锁文件、setup
|
|
43
|
+
核对包清单包含 bin、lib(安装 CLI、dsh Host/Web、Claude Node 与 Pi/dsh ACP worker)、src、resources(含 dsh patch、Claude 原生 pbot 技能与 agent、ACP 仅技能插件)、Python 锁文件、setup 脚本,以及隐藏的 .claude-plugin/plugin.json、marketplace.json 和 hooks/hooks.json。npm-shrinkwrap.json 仅保留在仓库用于开发和 CI;从发布包排除完整开发锁,避免 registry 安装展开开发宿主与构建依赖。另排除 dist、node_modules、凭据、原生测试会话与运行数据。核对 dsh 导出和元数据,以及 Claude command hooks 的 command/args、技能与 agent 路径;Claude 插件不发布 MCP 声明、mod 或类型快照。
|
|
44
44
|
|
|
45
45
|
依赖与产物规则见[技术设计](technical-design.md#工具与分发),安装包检查入口见[维护脚本](../scripts/README.md)。
|
|
46
46
|
|
|
47
|
-
使用隔离用户目录、宿主配置和临时工作区检查实际 tarball,避免 Python 准备影响日常环境。Pi 检查扩展、技能、工具和初始化,dsh 检查 Host、Web 与 Remote。Claude consumer 脚本在独立 npm 目录实际安装 tarball
|
|
47
|
+
使用隔离用户目录、宿主配置和临时工作区检查实际 tarball,避免 Python 准备影响日常环境。Pi 检查扩展、技能、工具和初始化,dsh 检查 Host、Web 与 Remote。Claude consumer 脚本在独立 npm 目录实际安装 tarball 并执行原生 plugin validate,同时将包直接解压到另一个空目录,在没有 node_modules 的条件下执行 hooks、CLI 和启用工作区的资料读取,以覆盖原生 marketplace 缓存的运行方式。检查无需模型认证或宿主 SDK,不依赖仓库开发目录。
|
|
48
48
|
|
|
49
49
|
Claude 的实际首任务上下文、原生 pbot 与工作方法技能、`personal-bot:general-purpose` 专家仍需在明确批准的原生模型环境验证。使用专用认证、隔离配置和临时工作区;原生团队开关由运行者管理。默认 Node 测试及 plugin validate 的结果与模型验证分别报告,当前尚未完成原生模型验证。范围见[Claude 接入设计](claude-code-design.md)。
|
|
50
50
|
|
|
@@ -97,7 +97,7 @@ npm view "personal-bot@$VERSION" version --registry=https://registry.npmjs.org
|
|
|
97
97
|
npm view personal-bot dist-tags --json --registry=https://registry.npmjs.org
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
运行 `node scripts/check-consumer.mjs npm:personal-bot@<version>`,在独立用户目录、npm cache 和消费目录中从公开 registry 按包名安装,核对宿主 SDK 未被连带安装,再检查 CLI 与 Pi 扩展加载、技能、工具和初始化。记录实际 Node/npm 版本;本地 tarball 与 registry 安装分别验证。另在独立 prefix 检查 npx 与全局 pbot 命令,并在独立 Pi 配置和临时工作区执行 `pi install --local npm:personal-bot`,核对原生安装版本与 `/pbot status`。
|
|
101
101
|
|
|
102
102
|
按[dsh 使用说明](dsh.md),在独立 profile 安装公开 registry 的目标版本,核对 Host 启用、Web 管理页和 Remote 查询。
|
|
103
103
|
|
package/docs/technical-design.md
CHANGED
|
@@ -35,7 +35,7 @@ src/extension/setup-cli.ts 装配独立 Pi 安装命令;`pbot setup` 通过原
|
|
|
35
35
|
|
|
36
36
|
服务不依赖宿主 SDK、工具或 UI。共享进程执行可直接使用,其他宿主能力通过窄接口传入。接入层可引用服务类型;命令和工具通过服务执行状态变更。模型层用 interface/type 描述普通数据和窄能力契约;数据以普通对象进入 JSON、存储和工具结果。
|
|
37
37
|
|
|
38
|
-
Claude command hook 是独立 Node 进程,只使用 Node 内置模块和共用资料/Python
|
|
38
|
+
Claude command hook 是独立 Node 进程,只使用 Node 内置模块和共用资料/Python 服务。通用断言保留在 common/validation,依赖 Ajv 的 JSON Schema 编译放在 common/schema,由 Pi/dsh 工具适配显式引用,避免资料和配置读取加载第三方模块。hook 的 stdout 输出标准 JSON,诊断写 stderr;不加载宿主 SDK、mod API 或内部 MCP。
|
|
39
39
|
|
|
40
40
|
| 主体 | 管理内容 |
|
|
41
41
|
| --- | --- |
|
|
@@ -159,9 +159,9 @@ Pi/dsh 在当前宿主进程激活 PATH、VIRTUAL_ENV 和 Python 路径变量,
|
|
|
159
159
|
|
|
160
160
|
Pi 将工具纳入 pbot namespace,codemode 按契约组合;dsh 注册原生工具,并在宿主可表达的 schema 之外继续校验完整领域契约。原生 CLI/MCP 与可选 Task Conductor 的接入和授权见[工具与执行](capability-design.md)。
|
|
161
161
|
|
|
162
|
-
Pi 入口指向 src,由宿主加载 TypeScript 源码;独立 CLI、dsh Host/Web、Claude Node hooks 编译到 lib,dist 供测试使用。Claude 的 hooks/hooks.json 指向 lib/claude.js;根 manifest 声明技能与原生专家,marketplace 指向同版本 npm
|
|
162
|
+
Pi 入口指向 src,由宿主加载 TypeScript 源码;独立 CLI、dsh Host/Web、Claude Node hooks 编译到 lib,dist 供测试使用。Claude 的 hooks/hooks.json 指向 lib/claude.js;根 manifest 声明技能与原生专家,marketplace 指向同版本 npm 包。原生 marketplace 将包解压到插件缓存,不安装 npm 依赖;Claude hook/CLI 在没有 node_modules 的包目录中直接运行,资源路径相对包内模块定位。
|
|
163
163
|
|
|
164
|
-
宿主 SDK 使用 optional peer,dsh SDK 范围为 "*",最低宿主版本由 engines.dsh
|
|
164
|
+
宿主 SDK 使用 optional peer,dsh SDK 范围为 "*",最低宿主版本由 engines.dsh 声明;开发依赖和仓库锁文件保留精确版本。完整开发 npm-shrinkwrap.json 不进入发布包,消费者按正常运行依赖安装,避免 registry 安装展开开发锁中的宿主 SDK。TypeBox 同样为 optional peer:Pi 通过宿主加载器提供,dsh 构建携带库及许可证。Claude 插件使用 Node 命令与共用服务,不加载宿主 SDK;Claude SDK 可选依赖仅供 Pi/dsh 的 Claude ACP 目标使用。
|
|
165
165
|
|
|
166
166
|
Pi、CLI 与 Claude hooks 支持 Node.js 22.19+,Claude 原生 CLI 最低与当前验证基线为 2.1.325;dsh 与 Linux 完整开发使用 Node.js 24.9+。安装检查发现真实宿主后,在子进程中使用其 SDK。包内组件共用 package.json 发布版本,build:claude 同步插件与 marketplace 版本并生成原生专家文件。构建顺序为 dist → build:cli → build:dsh → build:claude;build:cli 会清理 lib。子会话兼容线在 1.0 前按次版本、之后按主版本判断。
|
|
167
167
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ajv } from "ajv";
|
|
2
|
+
import addFormats from "ajv-formats";
|
|
3
|
+
import { object } from "./json.js";
|
|
4
|
+
export function schema(value) {
|
|
5
|
+
if (!object(value))
|
|
6
|
+
throw new Error("需要对象形式的 JSON Schema。");
|
|
7
|
+
const ajv = new Ajv({ strict: false, allErrors: false, validateFormats: true, coerceTypes: false, useDefaults: false, removeAdditional: false });
|
|
8
|
+
addFormats.default(ajv);
|
|
9
|
+
return ajv.compile(value);
|
|
10
|
+
}
|
package/lib/common/validation.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { Ajv } from "ajv";
|
|
2
|
-
import addFormats from "ajv-formats";
|
|
3
|
-
import { object } from "./json.js";
|
|
4
|
-
export function schema(value) {
|
|
5
|
-
if (!object(value))
|
|
6
|
-
throw new Error("需要对象形式的 JSON Schema。");
|
|
7
|
-
const ajv = new Ajv({ strict: false, allErrors: false, validateFormats: true, coerceTypes: false, useDefaults: false, removeAdditional: false });
|
|
8
|
-
addFormats.default(ajv);
|
|
9
|
-
return ajv.compile(value);
|
|
10
|
-
}
|
|
11
1
|
export function requireThat(condition, message) {
|
|
12
2
|
if (!condition)
|
|
13
3
|
throw new Error(message);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type } from "../../common/typebox.js";
|
|
2
2
|
import { object, json } from "../../common/json.js";
|
|
3
|
-
import { requireThat
|
|
3
|
+
import { requireThat } from "../../common/validation.js";
|
|
4
|
+
import { schema } from "../../common/schema.js";
|
|
4
5
|
import { executeAgent } from "../../tools/agents/actions.js";
|
|
5
6
|
import { dshAgentActionSchema } from "../../tools/agents/dsh-contract.js";
|
|
6
7
|
import { executeTeam, executeTeamMessage } from "../../tools/teams/actions.js";
|
|
@@ -89,7 +89,8 @@ import { SessionId } from "@deepseek-ai/dsh-session";
|
|
|
89
89
|
import { extractSessionEventText } from "@deepseek-ai/dsh-session-query";
|
|
90
90
|
import { Type } from "../../common/typebox.js";
|
|
91
91
|
import { json } from "../../common/json.js";
|
|
92
|
-
import { requireThat
|
|
92
|
+
import { requireThat } from "../../common/validation.js";
|
|
93
|
+
import { schema } from "../../common/schema.js";
|
|
93
94
|
import { packageVersion } from "../../common/version.js";
|
|
94
95
|
import { historyInput } from "../../tools/history/contract.js";
|
|
95
96
|
import { executeHistory } from "../../tools/history/actions.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dshParameters, dshOutputSchema } from "../../integrations/dsh/schema.js";
|
|
2
2
|
import { object, json } from "../../common/json.js";
|
|
3
|
-
import { requireThat
|
|
3
|
+
import { requireThat } from "../../common/validation.js";
|
|
4
|
+
import { schema } from "../../common/schema.js";
|
|
4
5
|
import { markdownFields } from "../../common/markdown.js";
|
|
5
6
|
import { executeAgent } from "./actions.js";
|
|
6
7
|
import { agentDescription, agentResultSchema } from "./contract.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Type } from "../../common/typebox.js";
|
|
2
|
-
import { requireThat
|
|
2
|
+
import { requireThat } from "../../common/validation.js";
|
|
3
|
+
import { schema } from "../../common/schema.js";
|
|
3
4
|
const host = Type.Union([Type.Literal("pi"), Type.Literal("dsh"), Type.Literal("claude")]);
|
|
4
5
|
const nullableOffset = Type.Union([Type.Integer(), Type.Null()]);
|
|
5
6
|
const node = Type.Object({ host, id: Type.String(), kind: Type.Union([Type.Literal("session"), Type.Literal("exchange"), Type.Literal("summary")]),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dshParameters, dshOutputSchema } from "../../integrations/dsh/schema.js";
|
|
2
|
-
import { requireThat
|
|
2
|
+
import { requireThat } from "../../common/validation.js";
|
|
3
|
+
import { schema } from "../../common/schema.js";
|
|
3
4
|
import { json } from "../../common/json.js";
|
|
4
5
|
import { markdownFields } from "../../common/markdown.js";
|
|
5
6
|
import { historyDescription, historyInput, historyParameters, historyResultSchema } from "./contract.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dshParameters, dshOutputSchema } from "../../integrations/dsh/schema.js";
|
|
2
2
|
import { object } from "../../common/json.js";
|
|
3
|
-
import { requireThat
|
|
3
|
+
import { requireThat } from "../../common/validation.js";
|
|
4
|
+
import { schema } from "../../common/schema.js";
|
|
4
5
|
import { markdownFields } from "../../common/markdown.js";
|
|
5
6
|
import { teamMessagesMarkdown } from "../../integrations/team-context.js";
|
|
6
7
|
import { executeTeam, executeTeamMessage } from "./actions.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "personal-bot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/realqiyan/personal-bot.git"
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"./*": "./*"
|
|
56
56
|
},
|
|
57
57
|
"files": [
|
|
58
|
-
"npm-shrinkwrap.json",
|
|
59
58
|
"bin",
|
|
60
59
|
"lib",
|
|
61
60
|
"src",
|
package/scripts/README.md
CHANGED
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
|
|
14
14
|
## 安装包检查
|
|
15
15
|
|
|
16
|
-
先 `npm pack`,使用生成的实际 tarball 检查交付路径;`npm pack --dry-run`
|
|
16
|
+
先 `npm pack`,使用生成的实际 tarball 检查交付路径;`npm pack --dry-run` 仅用于查看清单。完整开发 npm-shrinkwrap.json 留在仓库,不进入发布包;消费者按正常运行依赖安装。
|
|
17
17
|
|
|
18
18
|
| 命令 | 检查内容 | 环境 |
|
|
19
19
|
| --- | --- | --- |
|
|
20
|
-
| `node scripts/check-consumer.mjs <tarball>` | 独立 CLI、Pi
|
|
20
|
+
| `node scripts/check-consumer.mjs <tarball>` | 独立 CLI、Pi 扩展、技能、工具与资料初始化;安装 Pi 前核对消费根和包内均未安装宿主依赖 | CI 使用 Node.js 22.19.0,脚本安装锁定的 Pi SDK |
|
|
21
21
|
| `node scripts/check-dsh-consumer.mjs <tarball>` | dsh 原生插件安装、独立 CLI 与 Host 导入;检查无需单独安装 TypeBox 或宿主 SDK | Node.js 24.9+、仓库开发依赖和 PATH 中的 pnpm |
|
|
22
|
-
| `node scripts/check-claude-consumer.mjs <tarball>` | 实际 tarball
|
|
22
|
+
| `node scripts/check-claude-consumer.mjs <tarball>` | 实际 tarball 安装与原生 plugin validate;另在直接解包且没有 node_modules 的目录执行 hook、CLI 和资料读取 | Node.js 22.19+、Python 3.11+、Claude Code 2.1.325+;PBOT_CLAUDE_COMMAND 可指定 CLI |
|
|
23
23
|
|
|
24
|
-
上述脚本使用隔离用户目录、宿主配置与工作目录,结束后清理临时目录,不调用模型。Pi 使用预置故障目录跳过 Python 下载,dsh 通过原生 schema 收集导入 Host。Claude 在独立 npm 消费目录安装实际 tarball,核对版本、原生资源与 hook
|
|
24
|
+
上述脚本使用隔离用户目录、宿主配置与工作目录,结束后清理临时目录,不调用模型。Pi 使用预置故障目录跳过 Python 下载,dsh 通过原生 schema 收集导入 Host。Claude 在独立 npm 消费目录安装实际 tarball,核对版本、原生资源与 hook 参数;再从直接解包目录运行未启用工作区的 hook/status,以及已启用工作区的专家资料与 Python 只读检查,覆盖原生 marketplace 不安装 npm 依赖的缓存目录。不访问日常会话或凭据。
|
|
25
25
|
|
|
26
26
|
Claude 包内路径包括 `.claude-plugin/plugin.json`、marketplace、`hooks/hooks.json`、`lib/claude.js`、`resources/claude/skills/pbot/SKILL.md`、原生 Markdown agent、共享资料与工作方法技能。`resources/skills/.claude-plugin/plugin.json` 保留给 Pi/dsh 的 Claude ACP 目标。可对实际安装包执行原生校验:
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ Claude 包内路径包括 `.claude-plugin/plugin.json`、marketplace、`hooks/ho
|
|
|
29
29
|
claude plugin validate /absolute/path/to/installed/package/.claude-plugin/plugin.json
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
消费环境不依赖仓库 cwd、dist 或开发 node_modules
|
|
32
|
+
消费环境不依赖仓库 cwd、dist 或开发 node_modules。发布后运行 `node scripts/check-consumer.mjs npm:personal-bot@<version>`,通过公开 registry 按包名安装再执行相同检查;分别记录实际 Node/npm 版本,不能用本地 tarball 安装代替这条路径。只有实际执行的项目才记录为通过,版本与未执行项写在任务、PR 或 CI。
|
|
33
33
|
|
|
34
34
|
## 本地 Node hook 检查
|
|
35
35
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ajv } from "ajv";
|
|
2
|
+
import addFormats from "ajv-formats";
|
|
3
|
+
import type { ValidateFunction } from "ajv";
|
|
4
|
+
import { object } from "./json.js";
|
|
5
|
+
|
|
6
|
+
export function schema(value: unknown): ValidateFunction {
|
|
7
|
+
if (!object(value)) throw new Error("需要对象形式的 JSON Schema。");
|
|
8
|
+
const ajv = new Ajv({ strict: false, allErrors: false, validateFormats: true, coerceTypes: false, useDefaults: false, removeAdditional: false });
|
|
9
|
+
addFormats.default(ajv);
|
|
10
|
+
return ajv.compile(value);
|
|
11
|
+
}
|
package/src/common/validation.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import { Ajv } from "ajv";
|
|
2
|
-
import addFormats from "ajv-formats";
|
|
3
|
-
import type { ValidateFunction } from "ajv";
|
|
4
|
-
import { object } from "./json.js";
|
|
5
|
-
|
|
6
|
-
export function schema(value: unknown): ValidateFunction {
|
|
7
|
-
if (!object(value)) throw new Error("需要对象形式的 JSON Schema。");
|
|
8
|
-
const ajv = new Ajv({ strict: false, allErrors: false, validateFormats: true, coerceTypes: false, useDefaults: false, removeAdditional: false });
|
|
9
|
-
addFormats.default(ajv);
|
|
10
|
-
return ajv.compile(value);
|
|
11
|
-
}
|
|
12
1
|
export function requireThat(condition: unknown, message: string): asserts condition {
|
|
13
2
|
if (!condition) throw new Error(message);
|
|
14
3
|
}
|
|
@@ -2,7 +2,8 @@ import type { Context } from "@deepseek-ai/cordis";
|
|
|
2
2
|
import type {} from "@deepseek-ai/dsh-commands";
|
|
3
3
|
import { Type, type Static } from "typebox";
|
|
4
4
|
import { object, json } from "../../common/json.js";
|
|
5
|
-
import { requireThat
|
|
5
|
+
import { requireThat } from "../../common/validation.js";
|
|
6
|
+
import { schema } from "../../common/schema.js";
|
|
6
7
|
import { executeAgent, type AgentInput } from "../../tools/agents/actions.js";
|
|
7
8
|
import { dshAgentActionSchema } from "../../tools/agents/dsh-contract.js";
|
|
8
9
|
import { executeTeam, executeTeamMessage } from "../../tools/teams/actions.js";
|
|
@@ -6,7 +6,8 @@ import { SessionId } from "@deepseek-ai/dsh-session";
|
|
|
6
6
|
import { extractSessionEventText } from "@deepseek-ai/dsh-session-query";
|
|
7
7
|
import { Type, type Static } from "typebox";
|
|
8
8
|
import { json, type Json } from "../../common/json.js";
|
|
9
|
-
import { requireThat
|
|
9
|
+
import { requireThat } from "../../common/validation.js";
|
|
10
|
+
import { schema } from "../../common/schema.js";
|
|
10
11
|
import { packageVersion } from "../../common/version.js";
|
|
11
12
|
import { historyInput } from "../../tools/history/contract.js";
|
|
12
13
|
import { executeHistory } from "../../tools/history/actions.js";
|
|
@@ -4,7 +4,8 @@ import { dshParameters, dshOutputSchema } from "../../integrations/dsh/schema.js
|
|
|
4
4
|
import type { AgentService } from "../../services/agents/agent-service.js";
|
|
5
5
|
import type { AgentOwner } from "../../model/agent.js";
|
|
6
6
|
import { object, json } from "../../common/json.js";
|
|
7
|
-
import { requireThat
|
|
7
|
+
import { requireThat } from "../../common/validation.js";
|
|
8
|
+
import { schema } from "../../common/schema.js";
|
|
8
9
|
import { markdownFields } from "../../common/markdown.js";
|
|
9
10
|
import { executeAgent, type AgentInput } from "./actions.js";
|
|
10
11
|
import { agentDescription, agentResultSchema } from "./contract.js";
|
package/src/tools/agents/tool.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
|
2
2
|
import type { AgentService } from "../../services/agents/agent-service.js";
|
|
3
3
|
import { agentOwner } from "../../integrations/pi/agent-context.js";
|
|
4
4
|
import type { CallAccess } from "../access.js";
|
|
5
|
-
import { requireThat
|
|
5
|
+
import { requireThat } from "../../common/validation.js";
|
|
6
|
+
import { schema } from "../../common/schema.js";
|
|
6
7
|
import { executeAgent } from "./actions.js";
|
|
7
8
|
import { agentDescription, agentActionSchema, agentParametersSchema, agentResultSchema } from "./contract.js";
|
|
8
9
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Type, type Static } from "typebox";
|
|
2
|
-
import { requireThat
|
|
2
|
+
import { requireThat } from "../../common/validation.js";
|
|
3
|
+
import { schema } from "../../common/schema.js";
|
|
3
4
|
|
|
4
5
|
const host = Type.Union([Type.Literal("pi"), Type.Literal("dsh"), Type.Literal("claude")]);
|
|
5
6
|
const nullableOffset = Type.Union([Type.Integer(), Type.Null()]);
|
|
@@ -2,7 +2,8 @@ import type { Context } from "@deepseek-ai/cordis";
|
|
|
2
2
|
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
3
3
|
import type { HistoryService } from "../../services/history/history-service.js";
|
|
4
4
|
import { dshParameters, dshOutputSchema } from "../../integrations/dsh/schema.js";
|
|
5
|
-
import { requireThat
|
|
5
|
+
import { requireThat } from "../../common/validation.js";
|
|
6
|
+
import { schema } from "../../common/schema.js";
|
|
6
7
|
import { json } from "../../common/json.js";
|
|
7
8
|
import { markdownFields } from "../../common/markdown.js";
|
|
8
9
|
import { historyDescription, historyInput, historyParameters, historyResultSchema } from "./contract.js";
|
|
@@ -7,7 +7,8 @@ import type { AgentService } from "../../services/agents/agent-service.js";
|
|
|
7
7
|
import type { AgentOwner } from "../../model/agent.js";
|
|
8
8
|
import type { TeamActor } from "../../model/team.js";
|
|
9
9
|
import { object } from "../../common/json.js";
|
|
10
|
-
import { requireThat
|
|
10
|
+
import { requireThat } from "../../common/validation.js";
|
|
11
|
+
import { schema } from "../../common/schema.js";
|
|
11
12
|
import { markdownFields } from "../../common/markdown.js";
|
|
12
13
|
import { teamMessagesMarkdown } from "../../integrations/team-context.js";
|
|
13
14
|
import { executeTeam, executeTeamMessage } from "./actions.js";
|
package/src/tools/teams/tool.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { TeamService } from "../../services/agents/team-service.js";
|
|
|
3
3
|
import type { AgentService } from "../../services/agents/agent-service.js";
|
|
4
4
|
import type { TeamActor } from "../../model/team.js";
|
|
5
5
|
import { agentOwner } from "../../integrations/pi/agent-context.js";
|
|
6
|
-
import { requireThat
|
|
6
|
+
import { requireThat } from "../../common/validation.js";
|
|
7
|
+
import { schema } from "../../common/schema.js";
|
|
7
8
|
import type { CallAccess } from "../access.js";
|
|
8
9
|
import { executeTeam, executeTeamMessage } from "./actions.js";
|
|
9
10
|
import { teamDescription, teamMessageDescription, teamParametersSchema, teamActionSchema, teamResultSchema, teamMessageParametersSchema, teamMessageActionSchema, teamMessageResultSchema } from "./contract.js";
|