Archived
MVP底座⑤:自定义工具导入路由 —— 与第一方同门两审
顺手补两处底座:试运行审此前传空连接,靠 endpoint 干活的工具一律过不了门(这道门 只对不需要连接的工具有效);现传本次申报的连接值。未注册第一方处理器的工具走通用 HTTP 实现 —— 导入的工具由此可真调、可真审:端点不通就是不通,不入目录。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -278,6 +278,45 @@ export const saveWorkGroupRoute = {
|
||||
output: z.object({ group: workGroupSchema }),
|
||||
} as const satisfies RouteContract;
|
||||
|
||||
/* ── 工具管理 · 导入自定义工具 ─────────────────────────────────────── */
|
||||
|
||||
/**
|
||||
* 导入自定义工具 —— 与第一方工具走**同一条门**:静态审 + 试运行审。
|
||||
*
|
||||
* 工具承载权力,约束严于活动包:契约对活动、实现对系统、凭证对治理台(OS 7.3)。
|
||||
* 连接配置**只声明键**;值随本次导入送到治理台加密落库,此后只读得到「是否已绑定」。
|
||||
*/
|
||||
export const registerToolRoute = {
|
||||
method: 'POST',
|
||||
path: '/api/gov/tools',
|
||||
body: z.object({
|
||||
contract: z.object({
|
||||
name: z.string().min(1),
|
||||
version: z.string().min(1),
|
||||
description: z.string().min(1),
|
||||
input: z.record(z.string(), z.unknown()),
|
||||
output: z.record(z.string(), z.unknown()),
|
||||
effect: z.enum(['read', 'write']),
|
||||
errors: z
|
||||
.array(z.object({ code: z.string(), retryable: z.boolean(), message: z.string() }))
|
||||
.default([]),
|
||||
idempotent: z.boolean().default(true),
|
||||
timeoutMs: z.number().int().positive().default(10_000),
|
||||
retries: z.number().int().min(0).default(1),
|
||||
connectionKeys: z.array(z.string()).default([]),
|
||||
}),
|
||||
/** 连接值只写不读 —— 键在契约里,值密封在治理台 */
|
||||
connectionValues: z.record(z.string(), z.string()).optional(),
|
||||
/** 契约测试集:没有样例就没有试运行审,门形同虚设 */
|
||||
samples: z.array(z.object({ input: z.record(z.string(), z.unknown()) })).min(1),
|
||||
}),
|
||||
output: z.object({
|
||||
accepted: z.boolean(),
|
||||
findings: z.array(z.object({ code: z.string(), severity: z.string(), message: z.string() })),
|
||||
trialRun: z.object({ ran: z.number().int(), passed: z.number().int(), failures: z.array(z.string()) }),
|
||||
}),
|
||||
} as const satisfies RouteContract;
|
||||
|
||||
/* ── 活动库管理:两维分类 × 包版本 × 资产版本 ─────────────────────────── */
|
||||
|
||||
export const listActivitiesRoute = {
|
||||
|
||||
Reference in New Issue
Block a user