feat(agent): 用对话起草巡检(schedule.draft_check + 起草巡检 Skill + 计划页入口与对话卡片)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8eb8a68295
commit
7c4ad901d9
14 files changed
+408
-7
No files matched your search
@@ -5,6 +5,7 @@ import { MediaAsset } from "./assets.ts";
|
||||
import { BrowserController, BrowserDownloadVerification, BrowserSnapshot } from "./browser.ts";
|
||||
import { CAPABILITY_CATALOG, type CapabilitySpec, type KnownCapabilityId } from "./capability.ts";
|
||||
import { Id, JsonObject, NonNegInt } from "./common.ts";
|
||||
import { AgentCheckTrigger } from "./schedules.ts";
|
||||
import { MediaEntity, MediaKind } from "./content.ts";
|
||||
import { AcquisitionPlan, DownloadStatus, DownloadTask, Task, TaskStatus } from "./execution.ts";
|
||||
import { EnrichmentStatus, EnrichSuggestion, EnrichUsage, ExternalEntityType, ExternalIdentity } from "./identity.ts";
|
||||
@@ -909,6 +910,37 @@ export const WebSearchTestResult = z.object({
|
||||
export type WebSearchTestResult = z.infer<typeof WebSearchTestResult>;
|
||||
|
||||
/** 能力 ID → 输入/输出 schema(server 注册处理器、agent 生成工具定义时共用) */
|
||||
// ── schedule.draft_check:按自然语言需求起草巡检(建成未启用,用户在计划页检查后启用) ──
|
||||
|
||||
export const ScheduleDraftCheckInput = z.object({
|
||||
/** 巡检名称,10 字左右 */
|
||||
name: z.string().trim().min(1).max(60),
|
||||
/** 到点发给智能体的目标:写清检查什么、怎么汇报;可用占位符 {{now}} {{date}} {{openDecisions}} {{stalledDownloads}} {{activeSubscriptions}} */
|
||||
goal: z.string().trim().min(4).max(4000),
|
||||
/** 每隔多少小时跑一次(0.25–168) */
|
||||
everyHours: z.number().min(0.25).max(168),
|
||||
/** 需要的只读能力;不填 = 只读类全部 */
|
||||
capabilities: z.array(z.string()).max(40).optional(),
|
||||
/** 条件不满足时跳过、不唤醒模型 */
|
||||
triggerCondition: AgentCheckTrigger.optional(),
|
||||
maxToolCalls: z.number().int().min(1).max(100).optional(),
|
||||
maxDurationSec: z.number().int().min(30).max(1800).optional(),
|
||||
/** 结果写成一条待处理事项 */
|
||||
reportAsDecision: z.boolean().optional(),
|
||||
});
|
||||
export const ScheduleDraftCheckOutput = z.object({
|
||||
/** 建好的巡检(未启用) */
|
||||
jobId: z.string(),
|
||||
name: z.string(),
|
||||
everyHours: z.number(),
|
||||
capabilities: z.array(z.string()),
|
||||
/** 不能用的能力(非只读或不存在)已去掉 */
|
||||
dropped: z.array(z.string()),
|
||||
enabled: z.literal(false),
|
||||
/** 给用户的下一步 */
|
||||
next: z.string(),
|
||||
});
|
||||
|
||||
export const CAPABILITY_IO = {
|
||||
"catalog.lookup": { input: CatalogLookupInput, output: CatalogLookupOutput },
|
||||
"release.search": { input: ReleaseSearchInput, output: ReleaseSearchOutput },
|
||||
@@ -952,6 +984,7 @@ export const CAPABILITY_IO = {
|
||||
"web.fetch": { input: WebFetchInput, output: WebFetchOutput },
|
||||
"metadata.resolve_organize": { input: OrganizeMetadataInput, output: OrganizeMetadataOutput },
|
||||
"metadata.enrich": { input: MetadataEnrichInput, output: MetadataEnrichOutput },
|
||||
"schedule.draft_check": { input: ScheduleDraftCheckInput, output: ScheduleDraftCheckOutput },
|
||||
} as const satisfies Record<KnownCapabilityId, { input: z.ZodType; output: z.ZodType }>;
|
||||
|
||||
type CapabilityIo = typeof CAPABILITY_IO;
|
||||
|
||||
@@ -93,6 +93,7 @@ export const CAPABILITY_IDS = [
|
||||
"web.fetch",
|
||||
"metadata.enrich",
|
||||
"metadata.resolve_organize",
|
||||
"schedule.draft_check",
|
||||
] as const;
|
||||
export const KnownCapabilityId = z.enum(CAPABILITY_IDS);
|
||||
export type KnownCapabilityId = z.infer<typeof KnownCapabilityId>;
|
||||
@@ -604,6 +605,18 @@ export const CAPABILITY_CATALOG: Record<KnownCapabilityId, CapabilityDescriptor>
|
||||
false,
|
||||
"never",
|
||||
),
|
||||
"schedule.draft_check": d(
|
||||
"schedule.draft_check",
|
||||
"起草巡检",
|
||||
"按用户用自然语言描述的需求,建一个未启用的巡检(目标、间隔、能力白名单、触发条件、预算)。只在用户要新建定时检查 / 巡检时用;建好后由用户在计划页检查、修改并启用,不要替用户启用",
|
||||
"propose",
|
||||
"ScheduleDraftCheck",
|
||||
"admin",
|
||||
"low",
|
||||
false,
|
||||
false,
|
||||
"never",
|
||||
),
|
||||
"metadata.enrich": d(
|
||||
"metadata.enrich",
|
||||
"补全元数据",
|
||||
@@ -661,6 +674,7 @@ export const CAPABILITY_ACTIVITY: Record<KnownCapabilityId, CapabilityActivity>
|
||||
"site.health_check": act("检测", "站点", "个"),
|
||||
"site.refresh_login": act("刷新", "站点登录"),
|
||||
"site.user_data": act("查", "站点数据"),
|
||||
"schedule.draft_check": act("起草", "巡检", "个"),
|
||||
"browser.snapshot": act("读", "原站页面", "次"),
|
||||
"browser.navigate": act("打开", "原站页面", "次"),
|
||||
"browser.interact": act("操作", "原站页面", "次"),
|
||||
|
||||
Reference in new issue
Block a user