@tbox.cn/app-template-agent 1.0.0-alpha.6 → 1.0.0-alpha.7
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/.tbox/app.json +1 -1
- package/.tbox/default-modules.json +1 -1
- package/.tbox/evidence/gate.json +1 -1
- package/.tbox/evidence/last-gate.json +1 -1
- package/.tbox/miniapp-containers.json +1 -1
- package/AGENTS.md +2 -2
- package/apps/client/.tbox-gen/._app-registry.ts +0 -0
- package/apps/client/.tbox-gen/app-registry.ts +3 -0
- package/apps/client/scripts/check-evidence.mjs +149 -6
- package/apps/server/scripts/scenario-lib.mjs +26 -2
- package/apps/server/src/tools/AGENTS.md +12 -9
- package/docs/agent/tool-emits-card.md +1 -1
- package/docs/agent/verify.md +21 -5
- package/package.json +4 -4
- package/packages/agent-ui-kit/AGENTS.md +1 -1
- package/packages/agent-ui-kit/package.json +1 -1
- package/pnpm-lock.template.yaml +91 -91
- package/pnpm-workspace.template.yaml +10 -10
- package/scenarios/README.md +1 -1
- package/scripts/check-fast.mjs +5 -0
- package/scripts/checks.json +48 -0
package/.tbox/app.json
CHANGED
package/.tbox/evidence/gate.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"verdict":"deliverable","at":
|
|
1
|
+
{"verdict":"deliverable","at":1795155059252,"changedFiles":11,"runs":12}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"ok":true,"durationMs":
|
|
1
|
+
{"ok":true,"durationMs":77,"steps":[{"name":"vite","ok":true,"ms":17},{"name":"styles","ok":true,"ms":23},{"name":"primitives","ok":true,"ms":3},{"name":"tailwind","ok":true,"ms":24,"files":67},{"name":"scenarios","ok":true,"ms":10,"scenarios":0,"skipped":true},{"name":"coverage","ok":true,"ms":0,"instances":0},{"name":"render","ok":true,"ms":0,"cards":0,"rendered":0,"skipped":true}],"registry":{"tools":[],"cards":[],"actions":[]},"warnings":[],"notRun":["scenarios"],"evidence":{"cards":0,"scenarios":0,"instances":0},"verdict":"deliverable","next":"交付条件已满足:总结并结束。不要继续复审或打磨。","policy":"static","coverage":{"structure":"已验证:生成 / 类型 / 结构 / 原语","logic":"未运行:没有场景(先按 verify.md 写一条)","render":"未运行:没有卡片","visual":"未运行:当前策略 static(任务要求快速交付,不起浏览器)","routing":"未运行:当前策略不要求模型级验收"},"capabilities":{"declared":{"tools":0,"actions":0,"cards":0},"missing":{"tools":[],"actions":[],"cards":[]}},"handoff":[],"acceptance":{"items":0,"covered":0,"review":0,"handoff":0,"uncovered":[]},"sinceDeliverable":{"runs":12,"changedFiles":11}}
|
package/AGENTS.md
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
- **能力建在平台上**:对话能力 = `apps/server/src/tools/*.tool.ts` 的工具 + 成对卡片,首页用 `ChatPage` 渲染。不要用前端规则引擎、自写聊天组件或本地意图匹配替代平台引擎——那样对话不经过模型,卡片与状态也不再可用。
|
|
8
8
|
- **模型由平台托管**:需求里的「不需要 API Key」指不用自配密钥,不等于不用模型。
|
|
9
9
|
- **不读 `node_modules`**:API 形状查 `docs/agent/` 或 `pnpm exec tbox-app api <符号>`,约定查 `docs/agent/`。读构建产物反推是最慢的路径。
|
|
10
|
-
-
|
|
10
|
+
- 按层批量写:领域与状态 → schema 与卡片声明 → 客户端卡片 → 工具与动作 → 场景,每层一次写完再进入下一层。每步都有固定成本(首 token 等待),一次只写一个文件是最贵的写法;开发期不跑 `pnpm build`,改完先跑 `pnpm check:fast`。
|
|
11
11
|
- **动手前先跑一次 `pnpm exec tbox-app brief`**:应用现状、核心 API 签名、基元、壳契约、样式变量、命令、配方索引都在里面。
|
|
12
12
|
- **不读源码**:`packages/agent-ui-kit/src`、`apps/server/src/app.ts`、`README.md`、`.tbox-gen`、`tgz` 都不必读——装配由平台生成,写法以简报与配方为准。
|
|
13
|
-
- **交付纪律**:实现前先把需求拆成 `scenarios/acceptance.jsonc` 的验收项;`pnpm check:fast` 输出里的 `next` 就是下一步;`verdict: "deliverable"`
|
|
13
|
+
- **交付纪律**:实现前先把需求拆成 `scenarios/acceptance.jsonc` 的验收项;`pnpm check:fast` 输出里的 `next` 就是下一步;`verdict: "deliverable"` 即交付,交付后不再逐行复审。摘要里的 `handoff` 是当前策略验不了的项——原样写进交付说明,不要用读代码代替验证。
|
|
14
14
|
- 用户说「不要测试」「快速交付」指不起 dev server、不开浏览器、不写测试文件;`check:fast` 属于构建,照常运行。
|
|
15
15
|
|
|
16
16
|
## 我要做什么
|
|
Binary file
|
|
@@ -534,19 +534,111 @@ function readJsonc(file) {
|
|
|
534
534
|
return JSON.parse(raw);
|
|
535
535
|
}
|
|
536
536
|
|
|
537
|
+
/**
|
|
538
|
+
* 模块声明面(C3):`modules/<id>/tbox.module.json` 的 declare.tools/cards/actions。
|
|
539
|
+
* 生成 registry 的 tools/cards 只含应用目录;模块能力在运行时由模块 register 装配,
|
|
540
|
+
* 能力图必须把它们算进来,否则 profile/mall 应用的缺口会永远显示「缺工具」。
|
|
541
|
+
*/
|
|
542
|
+
function moduleDeclaredSurface(appDir) {
|
|
543
|
+
const surface = { tools: new Set(), cards: new Set(), actions: new Set() };
|
|
544
|
+
const root = path.join(appDir, 'modules');
|
|
545
|
+
if (!existsSync(root)) return surface;
|
|
546
|
+
for (const name of readdirSync(root)) {
|
|
547
|
+
const file = path.join(root, name, 'tbox.module.json');
|
|
548
|
+
if (!existsSync(file)) continue;
|
|
549
|
+
try {
|
|
550
|
+
// tbox.module.json 是严格 JSON:直接 parse,避免 readJsonc 的注释剥离误伤字符串
|
|
551
|
+
const declare = JSON.parse(readFileSync(file, 'utf8')).declare ?? {};
|
|
552
|
+
for (const tool of declare.tools ?? []) surface.tools.add(typeof tool === 'string' ? tool : tool?.id);
|
|
553
|
+
for (const card of declare.cards ?? []) surface.cards.add(typeof card === 'string' ? card : card?.cardType);
|
|
554
|
+
for (const action of declare.actions ?? []) surface.actions.add(typeof action === 'string' ? action : action?.id);
|
|
555
|
+
} catch {
|
|
556
|
+
// 模块清单坏掉由 build 扫描器报错;这里只做能力图,不重复报
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
for (const set of [surface.tools, surface.cards, surface.actions]) set.delete(undefined);
|
|
560
|
+
return surface;
|
|
561
|
+
}
|
|
562
|
+
|
|
537
563
|
function gateVerdict() {
|
|
538
564
|
const file = ['scenarios/acceptance.jsonc', 'scenarios/acceptance.json'].map((name) => path.join(appDir, name)).find((name) => existsSync(name));
|
|
539
|
-
const
|
|
565
|
+
const doc = file ? readJsonc(file) : {};
|
|
566
|
+
const items = doc.items ?? [];
|
|
540
567
|
const scenarioItems = items.filter((item) => (item.by ?? 'scenario') === 'scenario');
|
|
541
|
-
|
|
568
|
+
// E1:review 改名为 handoff(旧名保留为别名)。名字本身不再邀请复审。
|
|
569
|
+
// E2:证据策略声明本任务允许验证到哪一级;handoff 只接受策略判为不可验的维度。
|
|
570
|
+
const policy = ['static', 'visual', 'flow'].includes(doc.policy) ? doc.policy : 'static';
|
|
571
|
+
if (doc.policy && !['static', 'visual', 'flow'].includes(doc.policy)) {
|
|
572
|
+
warn('policy-unknown', `scenarios/acceptance.jsonc 的 policy=${JSON.stringify(doc.policy)} 不支持(static / visual / flow),按 static 处理`, {
|
|
573
|
+
fix: '改成三档之一,或删掉 policy 使用缺省 static',
|
|
574
|
+
recipe: 'verify',
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
const handoffItems = items.filter((item) => item.by === 'handoff' || item.by === 'review');
|
|
542
578
|
const covered = new Set();
|
|
543
579
|
for (const result of scenarioResults) {
|
|
544
580
|
if (!result.ok) continue;
|
|
545
581
|
for (const id of result.covers ?? []) covered.add(id);
|
|
546
582
|
}
|
|
547
|
-
|
|
583
|
+
// 策略允许场景验证的项不能借 handoff 绕过:没有 reason 的 handoff 计入 incomplete。
|
|
584
|
+
// 旧名 review 不要求 reason(历史应用平滑);新名 handoff 必须写清为什么当前策略验不了。
|
|
585
|
+
const handoffWithoutReason = handoffItems.filter((item) => item.by === 'handoff' && !item.reason);
|
|
586
|
+
const uncovered = [
|
|
587
|
+
...scenarioItems.filter((item) => !covered.has(item.id)).map((item) => item.id),
|
|
588
|
+
...handoffWithoutReason.map((item) => item.id),
|
|
589
|
+
];
|
|
590
|
+
if (handoffWithoutReason.length > 0) {
|
|
591
|
+
warn('handoff-misuse', `handoff 项缺 reason:${handoffWithoutReason.map((item) => item.id).join('、')}(能由场景判定的项不要标 handoff)`, {
|
|
592
|
+
fix: '补一条场景并写 covers,或给 handoff 项加 reason 说明为什么当前策略验不了',
|
|
593
|
+
recipe: 'verify',
|
|
594
|
+
});
|
|
595
|
+
}
|
|
548
596
|
const hasSurface = (registryServer?.tools?.length ?? 0) + (registryServer?.actions?.length ?? 0) > 0;
|
|
549
597
|
|
|
598
|
+
// C3 能力图:验收项上的 tool/action/card 名字键声明「这件事经由什么实现」。
|
|
599
|
+
// 声明了但还没注册 = 缺口;门禁把它列出来,完成的定义从第三分钟起就存在。
|
|
600
|
+
const declaredTools = new Set(items.map((item) => item.tool).filter(Boolean));
|
|
601
|
+
const declaredActions = new Set(items.map((item) => item.action).filter(Boolean));
|
|
602
|
+
const declaredCards = new Set(
|
|
603
|
+
items.flatMap((item) => (Array.isArray(item.on) ? item.on : item.card ? [item.card] : [])).filter(Boolean),
|
|
604
|
+
);
|
|
605
|
+
const registeredTools = new Set((registryServer?.tools ?? []).map((tool) => tool.id));
|
|
606
|
+
const registeredActions = new Set(Object.keys(registryServer?.actions ?? {}));
|
|
607
|
+
const registeredCards = new Set(Object.keys(registryServer?.cards ?? {}));
|
|
608
|
+
const moduleSurface = moduleDeclaredSurface(appDir);
|
|
609
|
+
for (const id of moduleSurface.tools) registeredTools.add(id);
|
|
610
|
+
for (const id of moduleSurface.actions) registeredActions.add(id);
|
|
611
|
+
for (const id of moduleSurface.cards) registeredCards.add(id);
|
|
612
|
+
const missingTools = [...declaredTools].filter((id) => !registeredTools.has(id));
|
|
613
|
+
const missingActions = [...declaredActions].filter((id) => !registeredActions.has(id));
|
|
614
|
+
const missingCards = [...declaredCards].filter((id) => !registeredCards.has(id));
|
|
615
|
+
const capabilities = {
|
|
616
|
+
declared: { tools: declaredTools.size, actions: declaredActions.size, cards: declaredCards.size },
|
|
617
|
+
missing: { tools: missingTools, actions: missingActions, cards: missingCards },
|
|
618
|
+
};
|
|
619
|
+
const missingCapabilityText = [
|
|
620
|
+
...missingTools.map((id) => `工具 ${id}`),
|
|
621
|
+
...missingActions.map((id) => `动作 ${id}`),
|
|
622
|
+
...missingCards.map((id) => `卡片 ${id}`),
|
|
623
|
+
];
|
|
624
|
+
|
|
625
|
+
// 每个验收维度一个状态:已验证 / 未运行(带原因)。验不了的进 handoff,不留作疑问。
|
|
626
|
+
const scenarioSteps = scenarioResults.reduce((sum, item) => sum + (item.steps ?? 0), 0);
|
|
627
|
+
const coverage = {
|
|
628
|
+
structure: '已验证:生成 / 类型 / 结构 / 原语',
|
|
629
|
+
logic:
|
|
630
|
+
scenarioResults.length > 0
|
|
631
|
+
? `已验证:${scenarioResults.length} 个场景 / ${scenarioSteps} 步 / ${covered.size} 项`
|
|
632
|
+
: '未运行:没有场景(先按 verify.md 写一条)',
|
|
633
|
+
render:
|
|
634
|
+
cardDigests.length > 0
|
|
635
|
+
? `已验证:${cardDigests.length} 张卡 / ${scenarioInstances.length + cardDigests.length} 份样例`
|
|
636
|
+
: '未运行:没有卡片',
|
|
637
|
+
visual: policy === 'static' ? '未运行:当前策略 static(任务要求快速交付,不起浏览器)' : '未运行:本轮未执行浏览器(需要 --visual / dev server)',
|
|
638
|
+
routing: policy === 'flow' ? '未运行:本轮未跑模型级验收' : '未运行:当前策略不要求模型级验收',
|
|
639
|
+
};
|
|
640
|
+
const handoff = handoffItems.map((item) => `${item.id} ${item.text ?? ''}`.trim());
|
|
641
|
+
|
|
550
642
|
let verdict;
|
|
551
643
|
let next;
|
|
552
644
|
if (errors.length > 0) {
|
|
@@ -557,12 +649,18 @@ function gateVerdict() {
|
|
|
557
649
|
next = hasSurface
|
|
558
650
|
? '先把需求拆成 scenarios/acceptance.jsonc 的验收项(id + text),再让场景用 covers 声明覆盖'
|
|
559
651
|
: '交付条件已满足:总结并结束。不要继续复审或打磨。';
|
|
652
|
+
} else if (missingCapabilityText.length > 0) {
|
|
653
|
+
verdict = 'incomplete';
|
|
654
|
+
next = `能力图还缺:${missingCapabilityText.join('、')};先在 acceptance.jsonc 声明,再补对应文件(new tool / new card / new action)`;
|
|
560
655
|
} else if (uncovered.length > 0) {
|
|
561
656
|
verdict = 'incomplete';
|
|
562
|
-
next = `未覆盖验收项:${uncovered.join('、')};补场景并在 covers
|
|
657
|
+
next = `未覆盖验收项:${uncovered.join('、')};补场景并在 covers 里登记,或给确实无法自动判定的项标 by: "handoff" 并写 reason`;
|
|
563
658
|
} else {
|
|
564
659
|
verdict = 'deliverable';
|
|
565
|
-
next =
|
|
660
|
+
next =
|
|
661
|
+
handoff.length > 0
|
|
662
|
+
? `把 handoff 的 ${handoff.length} 项原样写进交付说明,然后结束。这些项在当前策略(${policy})下无法验证,继续读代码不会改变它们的状态。`
|
|
663
|
+
: '交付条件已满足:总结并结束。不要继续复审或打磨。';
|
|
566
664
|
}
|
|
567
665
|
|
|
568
666
|
const gateFile = path.join(appDir, '.tbox/evidence/gate.json');
|
|
@@ -592,10 +690,16 @@ function gateVerdict() {
|
|
|
592
690
|
return {
|
|
593
691
|
verdict,
|
|
594
692
|
next,
|
|
693
|
+
policy,
|
|
694
|
+
coverage,
|
|
695
|
+
capabilities,
|
|
696
|
+
handoff,
|
|
595
697
|
acceptance: {
|
|
596
698
|
items: items.length,
|
|
597
699
|
covered: covered.size,
|
|
598
|
-
review
|
|
700
|
+
// 旧名保留一版(读取方可能仍看 review);新代码用 handoff。
|
|
701
|
+
review: handoffItems.length,
|
|
702
|
+
handoff: handoffItems.length,
|
|
599
703
|
uncovered,
|
|
600
704
|
...(file ? { file: path.relative(appDir, file) } : {}),
|
|
601
705
|
},
|
|
@@ -603,6 +707,44 @@ function gateVerdict() {
|
|
|
603
707
|
};
|
|
604
708
|
}
|
|
605
709
|
|
|
710
|
+
// ── 3.5 渲染与路由的启发式告警(E3) ─────────────────────────────
|
|
711
|
+
// 交付后最常见的两类复审是「界面看不见」与「模型会不会调用工具」。这里把能机器判断的
|
|
712
|
+
// 形态问题变成告警(不阻断):空渲染、状态样例渲染完全相同、工具描述缺失/重复。
|
|
713
|
+
function checkRenderSignals() {
|
|
714
|
+
const empty = cardDigests.filter((item) => !item.text || item.text.trim().length < 6);
|
|
715
|
+
if (empty.length > 0) {
|
|
716
|
+
warn('render-empty', `${empty.length} 份卡片渲染结果为空:${empty.map((item) => `${item.cardType}/${item.label}`).join('、')}`, {
|
|
717
|
+
fix: '检查组件是否按 cardType 注册、样例数据是否为空',
|
|
718
|
+
recipe: 'card',
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
const byCard = new Map();
|
|
722
|
+
for (const item of cardDigests) byCard.set(item.cardType, [...(byCard.get(item.cardType) ?? []), item]);
|
|
723
|
+
for (const [cardType, list] of byCard) {
|
|
724
|
+
if (list.length >= 2 && new Set(list.map((item) => item.text)).size === 1) {
|
|
725
|
+
warn('render-identical', `${cardType} 的 ${list.length} 份样例渲染结果完全相同——状态没有真正区分`, {
|
|
726
|
+
fix: '给不同状态不同的可见内容(状态标签/按钮/提示),或删掉重复样例',
|
|
727
|
+
recipe: 'card',
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
const tools = registryServer?.tools ?? [];
|
|
732
|
+
const byDescription = new Map();
|
|
733
|
+
for (const tool of tools) {
|
|
734
|
+
const description = String(tool.description ?? '').trim();
|
|
735
|
+
if (!description) {
|
|
736
|
+
warn('tool-description-empty', `工具 ${tool.id} 的 description 为空——模型没有依据选择它`, { fix: '写「什么时候用」,不要写「做什么」', recipe: 'tool' });
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
const duplicate = byDescription.get(description);
|
|
740
|
+
if (duplicate) {
|
|
741
|
+
warn('tool-description-duplicate', `工具 ${duplicate} 与 ${tool.id} 的 description 完全相同——模型无法区分`, { fix: '让两个工具的描述各自说明触发场景', recipe: 'tool' });
|
|
742
|
+
} else {
|
|
743
|
+
byDescription.set(description, tool.id);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
|
|
606
748
|
// ── 4.5 状态覆盖(声明样例 + 场景实例) ──────────────────────────
|
|
607
749
|
function checkCoverage() {
|
|
608
750
|
const started = performance.now();
|
|
@@ -639,6 +781,7 @@ checkTailwindClasses();
|
|
|
639
781
|
await checkScenarios();
|
|
640
782
|
if (registryServer) checkCoverage();
|
|
641
783
|
await checkRender();
|
|
784
|
+
checkRenderSignals();
|
|
642
785
|
const verdict = gateVerdict();
|
|
643
786
|
try {
|
|
644
787
|
const dir = path.join(appDir, '.tbox/evidence');
|
|
@@ -194,13 +194,24 @@ export async function recordScenario({ registry, name, steps, user }) {
|
|
|
194
194
|
for (const step of steps) {
|
|
195
195
|
const kind = step.action ? 'action' : 'tool';
|
|
196
196
|
const id = step.action ?? step.tool;
|
|
197
|
-
const
|
|
197
|
+
const stepUser = step.user ?? scenarioUser;
|
|
198
|
+
const ctx = { user: stepUser };
|
|
199
|
+
// C2:录制同时记「这一步改了哪些状态」,产物带 expect.state。
|
|
200
|
+
// 状态断言是需求不变量的证据(入会 → member/points),手写时最容易漏掉。
|
|
201
|
+
const before = mergedState(harness, stepUser);
|
|
198
202
|
if (kind === 'action') {
|
|
199
203
|
const result = await harness.act(id, step.input ?? {}, ctx);
|
|
200
|
-
|
|
204
|
+
const state = changedLeaves(before, mergedState(harness, stepUser));
|
|
205
|
+
out.steps.push({
|
|
206
|
+
action: id,
|
|
207
|
+
...(step.input ? { input: step.input } : {}),
|
|
208
|
+
...(step.user ? { user: step.user } : {}),
|
|
209
|
+
expect: { result: pick(result, step.keys), ...(Object.keys(state).length > 0 ? { state } : {}) },
|
|
210
|
+
});
|
|
201
211
|
continue;
|
|
202
212
|
}
|
|
203
213
|
const result = await harness.call(id, step.input ?? {}, ctx);
|
|
214
|
+
const state = changedLeaves(before, mergedState(harness, stepUser));
|
|
204
215
|
out.steps.push({
|
|
205
216
|
tool: id,
|
|
206
217
|
...(step.input ? { input: step.input } : {}),
|
|
@@ -208,12 +219,25 @@ export async function recordScenario({ registry, name, steps, user }) {
|
|
|
208
219
|
expect: {
|
|
209
220
|
output: pick(result.output, step.keys),
|
|
210
221
|
...(result.cards.length > 0 ? { cards: result.cards.map((card) => card.cardType) } : {}),
|
|
222
|
+
...(Object.keys(state).length > 0 ? { state } : {}),
|
|
211
223
|
},
|
|
212
224
|
});
|
|
213
225
|
}
|
|
214
226
|
return out;
|
|
215
227
|
}
|
|
216
228
|
|
|
229
|
+
/**
|
|
230
|
+
* 前后状态的顶层差异:录制 expect.state 用。
|
|
231
|
+
* 取整段顶层值(对象/数组原样),与 `diffPath` 的子集语义兼容——不写点号键。
|
|
232
|
+
*/
|
|
233
|
+
function changedLeaves(before, after) {
|
|
234
|
+
const out = {};
|
|
235
|
+
for (const key of Object.keys(after ?? {})) {
|
|
236
|
+
if (JSON.stringify(before?.[key]) !== JSON.stringify(after[key])) out[key] = after[key];
|
|
237
|
+
}
|
|
238
|
+
return out;
|
|
239
|
+
}
|
|
240
|
+
|
|
217
241
|
function pick(value, keys) {
|
|
218
242
|
if (!Array.isArray(keys) || keys.length === 0) return value;
|
|
219
243
|
if (value === null || typeof value !== 'object') return value;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
# apps/server/src/tools
|
|
2
2
|
|
|
3
|
-
每个 `*.tool.ts` 导出 `export const tool =
|
|
3
|
+
每个 `*.tool.ts` 导出 `export const tool = defineTool({...})`:
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
|
-
|
|
6
|
+
import { cardOf, defineTool } from '@tbox.cn/app-agent-sdk-server';
|
|
7
|
+
import { card as orderStatusCard } from '../cards/order-status.card';
|
|
8
|
+
|
|
9
|
+
export const tool = defineTool({
|
|
7
10
|
id: 'order-status', // 字符串字面量,扫描器读静态值
|
|
8
11
|
description: '…命中数据时结果附可展示卡片(cards)。',
|
|
9
12
|
inputSchema: z.object({}),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
return { ...facts, cards: [
|
|
13
|
+
execute: async (_args, { userId, identity }) => {
|
|
14
|
+
// 用户身份从 execute 第二参取;不要兜底成固定 id。
|
|
15
|
+
const facts = { title: 'order-status', userId, source: identity.source };
|
|
16
|
+
return { ...facts, cards: [cardOf(orderStatusCard, facts, '一句话摘要')] };
|
|
14
17
|
},
|
|
15
18
|
});
|
|
16
19
|
```
|
|
17
20
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
+
- 出卡用 `cardOf(meta, data, note)`:`cardType` 由卡片 meta 推导,不写字符串。
|
|
22
|
+
- 不要声明 `outputSchema`:出参解析会剥掉保留字段 `cards`(详见 `docs/agent/tool-emits-card.md`)。
|
|
23
|
+
- 完整示例见 `docs/agent/tool.md`;新增工具优先 `pnpm exec tbox-app new feature <name>`(连带生成配套卡片)。
|
|
@@ -41,7 +41,7 @@ return { ...facts, cards: [{ cardType: 'order-status', data: facts, note: '一
|
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
43
|
// ① 出卡工具不声明 outputSchema(推荐,最简单)
|
|
44
|
-
export const tool =
|
|
44
|
+
export const tool = defineTool({ id, description, inputSchema, execute });
|
|
45
45
|
|
|
46
46
|
// ② 需要约束出参时,用 passthrough 并显式保留 cards
|
|
47
47
|
outputSchema: z.object({ message: z.string(), cards: z.array(z.record(z.unknown())).optional() }).passthrough(),
|
package/docs/agent/verify.md
CHANGED
|
@@ -29,7 +29,10 @@
|
|
|
29
29
|
"registry": { "tools": ["query-points"], "cards": ["points-card"], "actions": ["pay-parking"] },
|
|
30
30
|
"warnings": [{ "id": "card-sample-coverage", "message": "parking-card.status 的状态 [\"paid\"] 没有样例" }],
|
|
31
31
|
"verdict": "deliverable",
|
|
32
|
-
"acceptance": { "items": 3, "covered": 3, "
|
|
32
|
+
"acceptance": { "items": 3, "covered": 3, "handoff": 0, "uncovered": [] },
|
|
33
|
+
"policy": "static",
|
|
34
|
+
"coverage": { "logic": "已验证:2 个场景 / 12 步 / 3 项", "visual": "未运行:当前策略 static" },
|
|
35
|
+
"handoff": [],
|
|
33
36
|
"next": "交付条件已满足:总结并结束。不要继续复审或打磨。",
|
|
34
37
|
"notRun": [] }
|
|
35
38
|
```
|
|
@@ -45,16 +48,21 @@
|
|
|
45
48
|
|
|
46
49
|
```jsonc
|
|
47
50
|
{
|
|
51
|
+
// 证据策略:本任务允许验到哪一级(static / visual / flow);缺省 static
|
|
52
|
+
"policy": "static",
|
|
48
53
|
"items": [
|
|
49
54
|
{ "id": "join.reward", "text": "入会后获得 100 积分和一张满100减20券" },
|
|
50
55
|
{ "id": "parking.pay", "text": "用停车券抵 10 元,实付 5 元,得 5 积分" },
|
|
51
|
-
{ "id": "ui.mobile", "text": "移动端为主,其它尺寸可用", "by": "
|
|
56
|
+
{ "id": "ui.mobile", "text": "移动端为主,其它尺寸可用", "by": "handoff",
|
|
57
|
+
"reason": "当前任务要求快速交付,不起浏览器" }
|
|
52
58
|
]
|
|
53
59
|
}
|
|
54
60
|
```
|
|
55
61
|
|
|
56
62
|
- 一个验收项算覆盖,当且仅当至少一个**通过**的场景在 `covers` 里列了它;
|
|
57
|
-
- `by: "
|
|
63
|
+
- `by: "handoff"`(旧名 `review` 仍可用)表示**当前策略下验不了**,必须写 `reason`;门禁把它列进 `handoff`,
|
|
64
|
+
并在 `next` 里要求原样写进交付说明——它不再是一个「待复审」的邀请;
|
|
65
|
+
- 能由场景判定却标 `handoff` 的项(缺 `reason`)计入 `incomplete`,不能用来绕过覆盖;
|
|
58
66
|
- 场景里可写 `expect.state`(对登记状态做子集匹配)验证需求里写明的不变量,例如 `{ "member": true, "points": 100 }`;
|
|
59
67
|
- 场景缺省按文件隔离用户,需要共享时在场景顶层写 `user`。
|
|
60
68
|
|
|
@@ -65,9 +73,11 @@
|
|
|
65
73
|
| `failing` | 有检查失败 | 首个根因与修复建议 |
|
|
66
74
|
| `incomplete` | 检查通过但有未覆盖验收项 | 未覆盖的 id |
|
|
67
75
|
| `unspecified` | 有工具/动作但没写验收项 | 先拆验收项 |
|
|
68
|
-
| `deliverable` | 全部覆盖 |
|
|
76
|
+
| `deliverable` | 全部覆盖 | 交付;有 handoff 时先写进交付说明 |
|
|
69
77
|
|
|
70
|
-
|
|
78
|
+
摘要里的 `coverage` 给每个维度一个状态(结构 / 逻辑 / 渲染 / 视觉 / 模型路由),`handoff` 是当前策略
|
|
79
|
+
验不了的清单。视觉与模型级验收只在 `policy` 允许时运行;`static` 下它们明确写「未运行」,不留作疑问。
|
|
80
|
+
已经 `deliverable` 之后再跑,`sinceDeliverable` 给出其后的门禁次数与改动文件数。
|
|
71
81
|
|
|
72
82
|
## 试跑
|
|
73
83
|
|
|
@@ -108,6 +118,12 @@ pnpm exec tbox-app probe "query-points{}" --user u1 --save points-baseline
|
|
|
108
118
|
| `font-size-off-scale`(错误) | 字号越档(只有 12/14/16/18/20/24/30 六档) | 用 `text-xs/sm/base/lg/xl/2xl/3xl`([style](style.md)) |
|
|
109
119
|
| `class-before-interpolation`(错误) | 类名紧贴 `${`,扫描器拿不到完整候选(样式静默不生效) | 在 `${` 前留空格:`text-xs ${cond ? … : …}`([style](style.md)) |
|
|
110
120
|
| `element-asset-declaration`(错误) | 在元素上声明 `--tbox-asset-*`(截断主题覆写继承) | 素材变量归主题包,元素只消费 `var(--tbox-asset-*, 兜底)`([style](style.md)) |
|
|
121
|
+
| `handoff-misuse`(告警) | handoff 项没有 reason(可能借移交绕过覆盖) | 补 reason 说明当前策略为什么验不了,或补一条场景并写 covers([verify](verify.md)) |
|
|
122
|
+
| `policy-unknown`(告警) | acceptance.jsonc 的 policy 值不支持 | 改成 static / visual / flow 之一,或删掉 policy 使用缺省 static([verify](verify.md)) |
|
|
123
|
+
| `render-empty`(告警) | 卡片渲染结果为空 | 检查组件是否按 cardType 注册、样例数据是否为空([card](card.md)) |
|
|
124
|
+
| `render-identical`(告警) | 同一卡片的多份样例渲染结果完全相同 | 给不同状态不同的可见内容,或删掉重复样例([card](card.md)) |
|
|
125
|
+
| `tool-description-empty`(告警) | 工具 description 为空 | 写「什么时候用」,不要写「做什么」([tool](tool.md)) |
|
|
126
|
+
| `tool-description-duplicate`(告警) | 两个工具的 description 完全相同 | 让两个工具的描述各自说明触发场景([tool](tool.md)) |
|
|
111
127
|
<!-- check-docs:errors end -->
|
|
112
128
|
|
|
113
129
|
## 用户说「不要测试」时
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-template-agent",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "tbox AI Agent 全栈模板(多包 pnpm workspace):apps/client + apps/server。唯一模板(W4 单一模板统一化:缺省带 AI 支付体验的 chat 形态;mall 能力经 profiles/mall 加装),能力经 CLI module add 模块扩展(shopping-guide/member 等)。",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0 <25.0.0"
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"typescript-eslint": "8.67.0",
|
|
42
42
|
"eslint-plugin-react-hooks": "5.2.0",
|
|
43
43
|
"vite": "6.4.3",
|
|
44
|
-
"@tbox.cn/app-sdk-server": "1.0.0-alpha.
|
|
45
|
-
"@tbox.cn/app-build": "1.0.0-alpha.
|
|
46
|
-
"@tbox.cn/app-cli": "1.0.0-alpha.
|
|
44
|
+
"@tbox.cn/app-sdk-server": "1.0.0-alpha.7",
|
|
45
|
+
"@tbox.cn/app-build": "1.0.0-alpha.7",
|
|
46
|
+
"@tbox.cn/app-cli": "1.0.0-alpha.7"
|
|
47
47
|
},
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"publishConfig": {
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
对话壳与卡片基元的源码包(应用内副本由 `scripts/sync-agent-ui-kit.mjs` 派生,手改会被覆盖)。
|
|
4
4
|
|
|
5
5
|
- 用基元与壳配置,不读本包源码:基元目录、图标、主题变量、壳可改范围见应用内 `docs/agent/kit.md`。
|
|
6
|
-
- 卡片一律 `defineCard` + 基元拼装;确有应用级样式时写在 `apps/client/src/styles/brand.
|
|
6
|
+
- 卡片一律 `defineCard` + 基元拼装;确有应用级样式时写在 `apps/client/src/styles/brand.css`(只改变量)或同目录 `cards.less`。
|
|
7
7
|
- 壳内部结构(MessageBubble / ChatInput / 卡片渲染器)不承诺稳定,不要按类名覆写。
|
|
8
8
|
- 本包的契约与测试是真源:改壳要同步 `src/shell.contract.json` 与 `src/shell.test.ts`,并跑 `pnpm gen:kit-catalog` 重生成 `catalog.json` 与 `docs/agent/kit.md`。
|
package/pnpm-lock.template.yaml
CHANGED
|
@@ -19,23 +19,23 @@ catalogs:
|
|
|
19
19
|
specifier: 0.1.0
|
|
20
20
|
version: 0.1.0
|
|
21
21
|
'@tbox.cn/app-agent-sdk-client':
|
|
22
|
-
specifier: 1.0.0-alpha.
|
|
23
|
-
version: 1.0.0-alpha.
|
|
22
|
+
specifier: 1.0.0-alpha.7
|
|
23
|
+
version: 1.0.0-alpha.7
|
|
24
24
|
'@tbox.cn/app-agent-sdk-server':
|
|
25
|
-
specifier: 1.0.0-alpha.
|
|
26
|
-
version: 1.0.0-alpha.
|
|
25
|
+
specifier: 1.0.0-alpha.7
|
|
26
|
+
version: 1.0.0-alpha.7
|
|
27
27
|
'@tbox.cn/app-contracts':
|
|
28
|
-
specifier: 1.0.0-alpha.
|
|
29
|
-
version: 1.0.0-alpha.
|
|
28
|
+
specifier: 1.0.0-alpha.7
|
|
29
|
+
version: 1.0.0-alpha.7
|
|
30
30
|
'@tbox.cn/app-contracts-mall':
|
|
31
|
-
specifier: 1.0.0-alpha.
|
|
32
|
-
version: 1.0.0-alpha.
|
|
31
|
+
specifier: 1.0.0-alpha.7
|
|
32
|
+
version: 1.0.0-alpha.7
|
|
33
33
|
'@tbox.cn/app-sdk-client':
|
|
34
|
-
specifier: 1.0.0-alpha.
|
|
35
|
-
version: 1.0.0-alpha.
|
|
34
|
+
specifier: 1.0.0-alpha.7
|
|
35
|
+
version: 1.0.0-alpha.7
|
|
36
36
|
'@tbox.cn/app-theme-tbox':
|
|
37
|
-
specifier: 1.0.0-alpha.
|
|
38
|
-
version: 1.0.0-alpha.
|
|
37
|
+
specifier: 1.0.0-alpha.7
|
|
38
|
+
version: 1.0.0-alpha.7
|
|
39
39
|
'@types/express':
|
|
40
40
|
specifier: 4.17.25
|
|
41
41
|
version: 4.17.25
|
|
@@ -106,14 +106,14 @@ importers:
|
|
|
106
106
|
.:
|
|
107
107
|
devDependencies:
|
|
108
108
|
'@tbox.cn/app-build':
|
|
109
|
-
specifier: 1.0.0-alpha.
|
|
110
|
-
version: 1.0.0-alpha.
|
|
109
|
+
specifier: 1.0.0-alpha.7
|
|
110
|
+
version: 1.0.0-alpha.7(vite@6.4.3(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.11)(yaml@2.9.0))
|
|
111
111
|
'@tbox.cn/app-cli':
|
|
112
|
-
specifier: 1.0.0-alpha.
|
|
113
|
-
version: 1.0.0-alpha.
|
|
112
|
+
specifier: 1.0.0-alpha.7
|
|
113
|
+
version: 1.0.0-alpha.7(vite@6.4.3(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.11)(yaml@2.9.0))
|
|
114
114
|
'@tbox.cn/app-sdk-server':
|
|
115
|
-
specifier: 1.0.0-alpha.
|
|
116
|
-
version: 1.0.0-alpha.
|
|
115
|
+
specifier: 1.0.0-alpha.7
|
|
116
|
+
version: 1.0.0-alpha.7(supports-color@7.2.0)
|
|
117
117
|
eslint:
|
|
118
118
|
specifier: 9.39.5
|
|
119
119
|
version: 9.39.5(jiti@2.7.0)(supports-color@7.2.0)
|
|
@@ -137,19 +137,19 @@ importers:
|
|
|
137
137
|
version: link:../../packages/shared
|
|
138
138
|
'@tbox.cn/app-agent-sdk-client':
|
|
139
139
|
specifier: 'catalog:'
|
|
140
|
-
version: 1.0.0-alpha.
|
|
140
|
+
version: 1.0.0-alpha.7(@types/react@18.3.31)
|
|
141
141
|
'@tbox.cn/app-agent-ui-kit':
|
|
142
142
|
specifier: link:../../packages/agent-ui-kit
|
|
143
143
|
version: link:../../packages/agent-ui-kit
|
|
144
144
|
'@tbox.cn/app-contracts':
|
|
145
145
|
specifier: 'catalog:'
|
|
146
|
-
version: 1.0.0-alpha.
|
|
146
|
+
version: 1.0.0-alpha.7
|
|
147
147
|
'@tbox.cn/app-sdk-client':
|
|
148
148
|
specifier: 'catalog:'
|
|
149
|
-
version: 1.0.0-alpha.
|
|
149
|
+
version: 1.0.0-alpha.7
|
|
150
150
|
'@tbox.cn/app-theme-tbox':
|
|
151
151
|
specifier: 'catalog:'
|
|
152
|
-
version: 1.0.0-alpha.
|
|
152
|
+
version: 1.0.0-alpha.7
|
|
153
153
|
react:
|
|
154
154
|
specifier: 'catalog:'
|
|
155
155
|
version: 18.3.1
|
|
@@ -165,7 +165,7 @@ importers:
|
|
|
165
165
|
version: 4.3.5(vite@6.4.3(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.11)(yaml@2.9.0))
|
|
166
166
|
'@tbox.cn/app-agent-sdk-server':
|
|
167
167
|
specifier: 'catalog:'
|
|
168
|
-
version: 1.0.0-alpha.
|
|
168
|
+
version: 1.0.0-alpha.7(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)(supports-color@7.2.0)
|
|
169
169
|
'@types/node':
|
|
170
170
|
specifier: 'catalog:'
|
|
171
171
|
version: 24.13.3
|
|
@@ -200,11 +200,11 @@ importers:
|
|
|
200
200
|
specifier: ^3.0.14
|
|
201
201
|
version: 3.0.14
|
|
202
202
|
'@tbox.cn/app-sdk-client':
|
|
203
|
-
specifier: 1.0.0-alpha.
|
|
204
|
-
version: 1.0.0-alpha.
|
|
203
|
+
specifier: 1.0.0-alpha.7
|
|
204
|
+
version: 1.0.0-alpha.7
|
|
205
205
|
'@tbox.cn/app-sdk-server':
|
|
206
|
-
specifier: 1.0.0-alpha.
|
|
207
|
-
version: 1.0.0-alpha.
|
|
206
|
+
specifier: 1.0.0-alpha.7
|
|
207
|
+
version: 1.0.0-alpha.7(supports-color@7.2.0)
|
|
208
208
|
typescript:
|
|
209
209
|
specifier: 5.9.3
|
|
210
210
|
version: 5.9.3
|
|
@@ -228,10 +228,10 @@ importers:
|
|
|
228
228
|
version: 0.1.0(@mastra/core@1.59.0(ai@6.0.246(zod@3.25.76))(express@4.22.2(supports-color@7.2.0))(rxjs@7.8.1)(supports-color@7.2.0)(zod@3.25.76))(@tbox-dev-js/sdk@0.1.18)(zod@3.25.76)
|
|
229
229
|
'@tbox.cn/app-agent-sdk-server':
|
|
230
230
|
specifier: 'catalog:'
|
|
231
|
-
version: 1.0.0-alpha.
|
|
231
|
+
version: 1.0.0-alpha.7(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)(supports-color@7.2.0)
|
|
232
232
|
'@tbox.cn/app-contracts':
|
|
233
233
|
specifier: 'catalog:'
|
|
234
|
-
version: 1.0.0-alpha.
|
|
234
|
+
version: 1.0.0-alpha.7
|
|
235
235
|
express:
|
|
236
236
|
specifier: 'catalog:'
|
|
237
237
|
version: 4.22.2(supports-color@7.2.0)
|
|
@@ -267,17 +267,17 @@ importers:
|
|
|
267
267
|
specifier: 2.1.10
|
|
268
268
|
version: 2.1.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
|
269
269
|
'@tbox.cn/app-agent-sdk-client':
|
|
270
|
-
specifier: 1.0.0-alpha.
|
|
271
|
-
version: 1.0.0-alpha.
|
|
270
|
+
specifier: 1.0.0-alpha.7
|
|
271
|
+
version: 1.0.0-alpha.7(@types/react@18.3.31)
|
|
272
272
|
'@tbox.cn/app-agent-sdk-server':
|
|
273
|
-
specifier: 1.0.0-alpha.
|
|
274
|
-
version: 1.0.0-alpha.
|
|
273
|
+
specifier: 1.0.0-alpha.7
|
|
274
|
+
version: 1.0.0-alpha.7(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)(supports-color@7.2.0)
|
|
275
275
|
'@tbox.cn/app-contracts':
|
|
276
|
-
specifier: 1.0.0-alpha.
|
|
277
|
-
version: 1.0.0-alpha.
|
|
276
|
+
specifier: 1.0.0-alpha.7
|
|
277
|
+
version: 1.0.0-alpha.7
|
|
278
278
|
'@tbox.cn/app-contracts-mall':
|
|
279
|
-
specifier: 1.0.0-alpha.
|
|
280
|
-
version: 1.0.0-alpha.
|
|
279
|
+
specifier: 1.0.0-alpha.7
|
|
280
|
+
version: 1.0.0-alpha.7
|
|
281
281
|
react:
|
|
282
282
|
specifier: 18.3.1
|
|
283
283
|
version: 18.3.1
|
|
@@ -314,13 +314,13 @@ importers:
|
|
|
314
314
|
dependencies:
|
|
315
315
|
'@tbox.cn/app-agent-sdk-client':
|
|
316
316
|
specifier: 'catalog:'
|
|
317
|
-
version: 1.0.0-alpha.
|
|
317
|
+
version: 1.0.0-alpha.7(@types/react@18.3.31)
|
|
318
318
|
'@tbox.cn/app-agent-sdk-server':
|
|
319
319
|
specifier: 'catalog:'
|
|
320
|
-
version: 1.0.0-alpha.
|
|
320
|
+
version: 1.0.0-alpha.7(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)(supports-color@7.2.0)
|
|
321
321
|
'@tbox.cn/app-contracts':
|
|
322
322
|
specifier: 'catalog:'
|
|
323
|
-
version: 1.0.0-alpha.
|
|
323
|
+
version: 1.0.0-alpha.7
|
|
324
324
|
devDependencies:
|
|
325
325
|
'@app/contracts-mall':
|
|
326
326
|
specifier: workspace:*
|
|
@@ -345,10 +345,10 @@ importers:
|
|
|
345
345
|
version: 2.1.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
|
346
346
|
'@tbox.cn/app-agent-sdk-client':
|
|
347
347
|
specifier: 'catalog:'
|
|
348
|
-
version: 1.0.0-alpha.
|
|
348
|
+
version: 1.0.0-alpha.7(@types/react@18.3.31)
|
|
349
349
|
'@tbox.cn/app-contracts':
|
|
350
350
|
specifier: 'catalog:'
|
|
351
|
-
version: 1.0.0-alpha.
|
|
351
|
+
version: 1.0.0-alpha.7
|
|
352
352
|
antd-mobile:
|
|
353
353
|
specifier: 'catalog:'
|
|
354
354
|
version: 5.42.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
|
@@ -394,7 +394,7 @@ importers:
|
|
|
394
394
|
dependencies:
|
|
395
395
|
'@tbox.cn/app-contracts-mall':
|
|
396
396
|
specifier: 'catalog:'
|
|
397
|
-
version: 1.0.0-alpha.
|
|
397
|
+
version: 1.0.0-alpha.7
|
|
398
398
|
devDependencies:
|
|
399
399
|
'@types/node':
|
|
400
400
|
specifier: 24.13.3
|
|
@@ -1514,16 +1514,16 @@ packages:
|
|
|
1514
1514
|
'@tbox-dev-js/sdk': '>=0.1.18 <0.2.0'
|
|
1515
1515
|
zod: '>=3.24.0 <4.0.0'
|
|
1516
1516
|
|
|
1517
|
-
'@tbox.cn/app-agent-sdk-client@1.0.0-alpha.
|
|
1518
|
-
resolution: {integrity: sha512-
|
|
1517
|
+
'@tbox.cn/app-agent-sdk-client@1.0.0-alpha.7':
|
|
1518
|
+
resolution: {integrity: sha512-IAuJK2tjJWS9V4CzKIV2nMWGIz7YholRy4jkK/gTACbSs4MM/A2nmmO/lRhhZ2+Qdevmd82hihPksb7PBC4I+Q==}
|
|
1519
1519
|
engines: {node: '>=20.0.0'}
|
|
1520
1520
|
|
|
1521
|
-
'@tbox.cn/app-agent-sdk-server@1.0.0-alpha.
|
|
1522
|
-
resolution: {integrity: sha512-
|
|
1521
|
+
'@tbox.cn/app-agent-sdk-server@1.0.0-alpha.7':
|
|
1522
|
+
resolution: {integrity: sha512-P807PEpMFYdO3usxe6NGyj/DLtMdJwu94pXLx+KKfolE/a7V7UPp/6UUUytwxx7uvtjV1F2+PZFJvoSFjTS12Q==}
|
|
1523
1523
|
engines: {node: '>=20.0.0'}
|
|
1524
1524
|
|
|
1525
|
-
'@tbox.cn/app-build@1.0.0-alpha.
|
|
1526
|
-
resolution: {integrity: sha512-
|
|
1525
|
+
'@tbox.cn/app-build@1.0.0-alpha.7':
|
|
1526
|
+
resolution: {integrity: sha512-xBCi0amLPHY9tW4wH7mc8i5BnTYu1eFCXnizfvH2qtMersICvCb4ifZx755doA1AE9fCQFmxgpvgtMG3KFsaQA==}
|
|
1527
1527
|
engines: {node: '>=20.0.0'}
|
|
1528
1528
|
peerDependencies:
|
|
1529
1529
|
vite: 6.4.3
|
|
@@ -1531,37 +1531,37 @@ packages:
|
|
|
1531
1531
|
vite:
|
|
1532
1532
|
optional: true
|
|
1533
1533
|
|
|
1534
|
-
'@tbox.cn/app-cli@1.0.0-alpha.
|
|
1535
|
-
resolution: {integrity: sha512-
|
|
1534
|
+
'@tbox.cn/app-cli@1.0.0-alpha.7':
|
|
1535
|
+
resolution: {integrity: sha512-3E26diAPwZOnGO4DzlE5mgRk5guACW3S1csod8JehXBcT/GfklueQRWjgrmK7Sv9K6IPf6i6mgpa6RfdruqBJA==}
|
|
1536
1536
|
engines: {node: '>=20.0.0'}
|
|
1537
1537
|
hasBin: true
|
|
1538
1538
|
|
|
1539
|
-
'@tbox.cn/app-contracts-mall@1.0.0-alpha.
|
|
1540
|
-
resolution: {integrity: sha512-
|
|
1539
|
+
'@tbox.cn/app-contracts-mall@1.0.0-alpha.7':
|
|
1540
|
+
resolution: {integrity: sha512-CQzyYPjStHegM9eaDjliHgTxhwB8h65eXepBiJ+hPv6k32phFQpXmbuAGYl8GmSLT+kJSpmasZid+8QABir0Vw==}
|
|
1541
1541
|
engines: {node: '>=20.0.0'}
|
|
1542
1542
|
|
|
1543
|
-
'@tbox.cn/app-contracts@1.0.0-alpha.
|
|
1544
|
-
resolution: {integrity: sha512-
|
|
1543
|
+
'@tbox.cn/app-contracts@1.0.0-alpha.7':
|
|
1544
|
+
resolution: {integrity: sha512-H6pnUKPJEDFd/SDsfJfzq9c9OY/3szEG0GEUiMY43SLgoWII3bqUuBgF6LVQaOAZRJnPh0rEtC5waJmMhmaY6A==}
|
|
1545
1545
|
engines: {node: '>=20.0.0'}
|
|
1546
1546
|
|
|
1547
|
-
'@tbox.cn/app-sdk-client@1.0.0-alpha.
|
|
1548
|
-
resolution: {integrity: sha512-
|
|
1547
|
+
'@tbox.cn/app-sdk-client@1.0.0-alpha.7':
|
|
1548
|
+
resolution: {integrity: sha512-eb6FHaz5O7AOQy8mqAAT+6SPEOC8XRoHkKE+yMfetyqsAp12cxc9Lk6uWdHJyo3tO+kBcKeJZxMJl6R0nX7j0w==}
|
|
1549
1549
|
engines: {node: '>=20.0.0'}
|
|
1550
1550
|
|
|
1551
|
-
'@tbox.cn/app-sdk-core@1.0.0-alpha.
|
|
1552
|
-
resolution: {integrity: sha512-
|
|
1551
|
+
'@tbox.cn/app-sdk-core@1.0.0-alpha.7':
|
|
1552
|
+
resolution: {integrity: sha512-6orR+2CPMZm04wFK+PbvgkaXZbakFPTtTG1d9wQWo++85KfdtMjapW4C6I7ZdlxKsr+1fh6hobk0/u9ndLhk/w==}
|
|
1553
1553
|
engines: {node: '>=20.0.0'}
|
|
1554
1554
|
|
|
1555
|
-
'@tbox.cn/app-sdk-server@1.0.0-alpha.
|
|
1556
|
-
resolution: {integrity: sha512-
|
|
1555
|
+
'@tbox.cn/app-sdk-server@1.0.0-alpha.7':
|
|
1556
|
+
resolution: {integrity: sha512-o30nXrbPgHNdJQMlPiB0Szcu+lQHMGniPuXqkupgpRTc8xE+DNg8jhaqRHXocp1BevQLkHd2ooQ7RLnjMmyDCA==}
|
|
1557
1557
|
engines: {node: '>=20.0.0'}
|
|
1558
1558
|
hasBin: true
|
|
1559
1559
|
|
|
1560
|
-
'@tbox.cn/app-theme-tbox@1.0.0-alpha.
|
|
1561
|
-
resolution: {integrity: sha512-
|
|
1560
|
+
'@tbox.cn/app-theme-tbox@1.0.0-alpha.7':
|
|
1561
|
+
resolution: {integrity: sha512-tJwwaNWuLdemWXa0uXczHACQHlfSR1wsBmW3vY2ZXgOAcIg7KQAOAumrOYhLMsCG57c4uaruv890tM4KWjtSNA==}
|
|
1562
1562
|
|
|
1563
|
-
'@tbox.cn/app-toolkit@1.0.0-alpha.
|
|
1564
|
-
resolution: {integrity: sha512-
|
|
1563
|
+
'@tbox.cn/app-toolkit@1.0.0-alpha.7':
|
|
1564
|
+
resolution: {integrity: sha512-j6rkCAFiCvze9P9ZxR37LXM1UaWQAHFxBQrrVT9YGjsYrgH7A8F1k3v1jIEFV8a8uKrzHxDTe+B1LODbuI7Chw==}
|
|
1565
1565
|
engines: {node: '>=20.0.0'}
|
|
1566
1566
|
|
|
1567
1567
|
'@types/babel__core@7.20.5':
|
|
@@ -4384,12 +4384,12 @@ snapshots:
|
|
|
4384
4384
|
'@tbox-dev-js/sdk': 0.1.18
|
|
4385
4385
|
zod: 3.25.76
|
|
4386
4386
|
|
|
4387
|
-
'@tbox.cn/app-agent-sdk-client@1.0.0-alpha.
|
|
4387
|
+
'@tbox.cn/app-agent-sdk-client@1.0.0-alpha.7(@types/react@18.3.31)':
|
|
4388
4388
|
dependencies:
|
|
4389
4389
|
'@phosphor-icons/react': 2.1.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
|
4390
|
-
'@tbox.cn/app-contracts': 1.0.0-alpha.
|
|
4391
|
-
'@tbox.cn/app-sdk-client': 1.0.0-alpha.
|
|
4392
|
-
'@tbox.cn/app-sdk-core': 1.0.0-alpha.
|
|
4390
|
+
'@tbox.cn/app-contracts': 1.0.0-alpha.7
|
|
4391
|
+
'@tbox.cn/app-sdk-client': 1.0.0-alpha.7
|
|
4392
|
+
'@tbox.cn/app-sdk-core': 1.0.0-alpha.7
|
|
4393
4393
|
react: 18.3.1
|
|
4394
4394
|
react-dom: 18.3.1(react@18.3.1)
|
|
4395
4395
|
zustand: 4.5.7(@types/react@18.3.31)(react@18.3.1)
|
|
@@ -4397,7 +4397,7 @@ snapshots:
|
|
|
4397
4397
|
- '@types/react'
|
|
4398
4398
|
- immer
|
|
4399
4399
|
|
|
4400
|
-
'@tbox.cn/app-agent-sdk-server@1.0.0-alpha.
|
|
4400
|
+
'@tbox.cn/app-agent-sdk-server@1.0.0-alpha.7(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)(supports-color@7.2.0)':
|
|
4401
4401
|
dependencies:
|
|
4402
4402
|
'@ag-ui/core': 0.0.47
|
|
4403
4403
|
'@ai-sdk/openai-compatible': 2.0.68(zod@3.25.76)
|
|
@@ -4405,9 +4405,9 @@ snapshots:
|
|
|
4405
4405
|
'@mastra/core': 1.59.0(ai@6.0.246(zod@3.25.76))(express@4.22.2(supports-color@7.2.0))(rxjs@7.8.1)(supports-color@7.2.0)(zod@3.25.76)
|
|
4406
4406
|
'@mastra/observability': 1.16.5(@mastra/core@1.59.0(ai@6.0.246(zod@3.25.76))(express@4.22.2(supports-color@7.2.0))(rxjs@7.8.1)(supports-color@7.2.0)(zod@3.25.76))(zod@3.25.76)
|
|
4407
4407
|
'@tbox.cn/agent-plugin': 0.1.0(@mastra/core@1.59.0(ai@6.0.246(zod@3.25.76))(express@4.22.2(supports-color@7.2.0))(rxjs@7.8.1)(supports-color@7.2.0)(zod@3.25.76))(@tbox-dev-js/sdk@0.1.18)(zod@3.25.76)
|
|
4408
|
-
'@tbox.cn/app-contracts': 1.0.0-alpha.
|
|
4409
|
-
'@tbox.cn/app-sdk-core': 1.0.0-alpha.
|
|
4410
|
-
'@tbox.cn/app-sdk-server': 1.0.0-alpha.
|
|
4408
|
+
'@tbox.cn/app-contracts': 1.0.0-alpha.7
|
|
4409
|
+
'@tbox.cn/app-sdk-core': 1.0.0-alpha.7
|
|
4410
|
+
'@tbox.cn/app-sdk-server': 1.0.0-alpha.7(supports-color@7.2.0)
|
|
4411
4411
|
ai: 6.0.246(zod@3.25.76)
|
|
4412
4412
|
express: 4.22.2(supports-color@7.2.0)
|
|
4413
4413
|
gray-matter: 4.0.3
|
|
@@ -4425,16 +4425,16 @@ snapshots:
|
|
|
4425
4425
|
- utf-8-validate
|
|
4426
4426
|
- workflow
|
|
4427
4427
|
|
|
4428
|
-
'@tbox.cn/app-build@1.0.0-alpha.
|
|
4428
|
+
'@tbox.cn/app-build@1.0.0-alpha.7(vite@6.4.3(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.11)(yaml@2.9.0))':
|
|
4429
4429
|
dependencies:
|
|
4430
4430
|
typescript: 5.9.3
|
|
4431
4431
|
optionalDependencies:
|
|
4432
4432
|
vite: 6.4.3(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.11)(yaml@2.9.0)
|
|
4433
4433
|
|
|
4434
|
-
'@tbox.cn/app-cli@1.0.0-alpha.
|
|
4434
|
+
'@tbox.cn/app-cli@1.0.0-alpha.7(vite@6.4.3(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.11)(yaml@2.9.0))':
|
|
4435
4435
|
dependencies:
|
|
4436
|
-
'@tbox.cn/app-build': 1.0.0-alpha.
|
|
4437
|
-
'@tbox.cn/app-toolkit': 1.0.0-alpha.
|
|
4436
|
+
'@tbox.cn/app-build': 1.0.0-alpha.7(vite@6.4.3(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.11)(yaml@2.9.0))
|
|
4437
|
+
'@tbox.cn/app-toolkit': 1.0.0-alpha.7
|
|
4438
4438
|
commander: 12.1.0
|
|
4439
4439
|
diff: 7.0.0
|
|
4440
4440
|
jsonc-parser: 3.3.1
|
|
@@ -4445,43 +4445,43 @@ snapshots:
|
|
|
4445
4445
|
transitivePeerDependencies:
|
|
4446
4446
|
- vite
|
|
4447
4447
|
|
|
4448
|
-
'@tbox.cn/app-contracts-mall@1.0.0-alpha.
|
|
4448
|
+
'@tbox.cn/app-contracts-mall@1.0.0-alpha.7':
|
|
4449
4449
|
dependencies:
|
|
4450
|
-
'@tbox.cn/app-contracts': 1.0.0-alpha.
|
|
4450
|
+
'@tbox.cn/app-contracts': 1.0.0-alpha.7
|
|
4451
4451
|
zod: 3.25.76
|
|
4452
4452
|
|
|
4453
|
-
'@tbox.cn/app-contracts@1.0.0-alpha.
|
|
4453
|
+
'@tbox.cn/app-contracts@1.0.0-alpha.7':
|
|
4454
4454
|
dependencies:
|
|
4455
4455
|
'@ag-ui/core': 0.0.47
|
|
4456
4456
|
react: 18.3.1
|
|
4457
4457
|
zod: 3.25.76
|
|
4458
4458
|
|
|
4459
|
-
'@tbox.cn/app-sdk-client@1.0.0-alpha.
|
|
4459
|
+
'@tbox.cn/app-sdk-client@1.0.0-alpha.7':
|
|
4460
4460
|
dependencies:
|
|
4461
|
-
'@tbox.cn/app-contracts': 1.0.0-alpha.
|
|
4462
|
-
'@tbox.cn/app-sdk-core': 1.0.0-alpha.
|
|
4461
|
+
'@tbox.cn/app-contracts': 1.0.0-alpha.7
|
|
4462
|
+
'@tbox.cn/app-sdk-core': 1.0.0-alpha.7
|
|
4463
4463
|
react: 18.3.1
|
|
4464
4464
|
react-dom: 18.3.1(react@18.3.1)
|
|
4465
4465
|
|
|
4466
|
-
'@tbox.cn/app-sdk-core@1.0.0-alpha.
|
|
4466
|
+
'@tbox.cn/app-sdk-core@1.0.0-alpha.7':
|
|
4467
4467
|
dependencies:
|
|
4468
|
-
'@tbox.cn/app-contracts': 1.0.0-alpha.
|
|
4468
|
+
'@tbox.cn/app-contracts': 1.0.0-alpha.7
|
|
4469
4469
|
|
|
4470
|
-
'@tbox.cn/app-sdk-server@1.0.0-alpha.
|
|
4470
|
+
'@tbox.cn/app-sdk-server@1.0.0-alpha.7(supports-color@7.2.0)':
|
|
4471
4471
|
dependencies:
|
|
4472
4472
|
'@ag-ui/core': 0.0.47
|
|
4473
|
-
'@tbox.cn/app-contracts': 1.0.0-alpha.
|
|
4474
|
-
'@tbox.cn/app-sdk-core': 1.0.0-alpha.
|
|
4475
|
-
'@tbox.cn/app-toolkit': 1.0.0-alpha.
|
|
4473
|
+
'@tbox.cn/app-contracts': 1.0.0-alpha.7
|
|
4474
|
+
'@tbox.cn/app-sdk-core': 1.0.0-alpha.7
|
|
4475
|
+
'@tbox.cn/app-toolkit': 1.0.0-alpha.7
|
|
4476
4476
|
express: 4.22.2(supports-color@7.2.0)
|
|
4477
4477
|
jose: 6.2.8
|
|
4478
4478
|
zod: 3.25.76
|
|
4479
4479
|
transitivePeerDependencies:
|
|
4480
4480
|
- supports-color
|
|
4481
4481
|
|
|
4482
|
-
'@tbox.cn/app-theme-tbox@1.0.0-alpha.
|
|
4482
|
+
'@tbox.cn/app-theme-tbox@1.0.0-alpha.7': {}
|
|
4483
4483
|
|
|
4484
|
-
'@tbox.cn/app-toolkit@1.0.0-alpha.
|
|
4484
|
+
'@tbox.cn/app-toolkit@1.0.0-alpha.7':
|
|
4485
4485
|
dependencies:
|
|
4486
4486
|
ajv: 8.20.0
|
|
4487
4487
|
zod: 3.25.76
|
|
@@ -39,16 +39,16 @@ catalog:
|
|
|
39
39
|
ws: 8.21.3
|
|
40
40
|
"@types/ws": 8.18.1
|
|
41
41
|
"@tbox.cn/agent-plugin": 0.1.0
|
|
42
|
-
"@tbox.cn/app-sdk-core": 1.0.0-alpha.
|
|
43
|
-
"@tbox.cn/app-sdk-client": 1.0.0-alpha.
|
|
44
|
-
"@tbox.cn/app-sdk-server": 1.0.0-alpha.
|
|
45
|
-
"@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.
|
|
46
|
-
"@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.
|
|
47
|
-
"@tbox.cn/app-contracts": 1.0.0-alpha.
|
|
48
|
-
"@tbox.cn/app-contracts-mall": 1.0.0-alpha.
|
|
49
|
-
"@tbox.cn/app-theme-tbox": 1.0.0-alpha.
|
|
50
|
-
"@tbox.cn/app-build": 1.0.0-alpha.
|
|
51
|
-
"@tbox.cn/app-cli": 1.0.0-alpha.
|
|
42
|
+
"@tbox.cn/app-sdk-core": 1.0.0-alpha.7
|
|
43
|
+
"@tbox.cn/app-sdk-client": 1.0.0-alpha.7
|
|
44
|
+
"@tbox.cn/app-sdk-server": 1.0.0-alpha.7
|
|
45
|
+
"@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.7
|
|
46
|
+
"@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.7
|
|
47
|
+
"@tbox.cn/app-contracts": 1.0.0-alpha.7
|
|
48
|
+
"@tbox.cn/app-contracts-mall": 1.0.0-alpha.7
|
|
49
|
+
"@tbox.cn/app-theme-tbox": 1.0.0-alpha.7
|
|
50
|
+
"@tbox.cn/app-build": 1.0.0-alpha.7
|
|
51
|
+
"@tbox.cn/app-cli": 1.0.0-alpha.7
|
|
52
52
|
zustand: 4.5.7
|
|
53
53
|
eslint: 9.39.5
|
|
54
54
|
typescript-eslint: 8.67.0
|
package/scenarios/README.md
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
联动链路的可执行断言:一个 JSON 一个场景,`pnpm scenario` 与 `pnpm check:fast` 都会跑。
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- 写法、`policy` 与 `handoff` 见 `docs/agent/verify.md`;录制用 `pnpm exec tbox-app scenario record <名称> --steps "tool-id{} action:action-id{}"`。
|
|
6
6
|
- 断言只写稳定字段(业务结果、卡片序列),不要写时间戳、随机 id。
|
|
7
7
|
- 场景直调工具与动作,不连端口、不调模型、不开浏览器——它是构建自检的一部分。
|
package/scripts/check-fast.mjs
CHANGED
|
@@ -73,6 +73,11 @@ async function main() {
|
|
|
73
73
|
registry: parsed?.registry ?? {},
|
|
74
74
|
warnings: parsed?.warnings ?? [],
|
|
75
75
|
...(parsed?.verdict ? { verdict: parsed.verdict, acceptance: parsed.acceptance, next: parsed.next } : {}),
|
|
76
|
+
// E1/E2/C3:覆盖面、证据策略、能力图缺口与移交清单都随摘要向上传(调用方与 harness 只读这一行)。
|
|
77
|
+
...(parsed?.policy ? { policy: parsed.policy } : {}),
|
|
78
|
+
...(parsed?.coverage ? { coverage: parsed.coverage } : {}),
|
|
79
|
+
...(parsed?.capabilities ? { capabilities: parsed.capabilities } : {}),
|
|
80
|
+
...(parsed?.handoff ? { handoff: parsed.handoff } : {}),
|
|
76
81
|
...(parsed?.sinceDeliverable ? { sinceDeliverable: parsed.sinceDeliverable } : {}),
|
|
77
82
|
...(parsed?.notRun?.length ? { notRun: parsed.notRun } : {}),
|
|
78
83
|
};
|
package/scripts/checks.json
CHANGED
|
@@ -200,6 +200,54 @@
|
|
|
200
200
|
"symptom": "在元素上声明 `--tbox-asset-*`(截断主题覆写继承)",
|
|
201
201
|
"fix": "素材变量归主题包,元素只消费 `var(--tbox-asset-*, 兜底)`",
|
|
202
202
|
"recipe": "style"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"id": "handoff-misuse",
|
|
206
|
+
"level": "warning",
|
|
207
|
+
"source": "evidence",
|
|
208
|
+
"symptom": "handoff 项没有 reason(可能借移交绕过覆盖)",
|
|
209
|
+
"fix": "补 reason 说明当前策略为什么验不了,或补一条场景并写 covers",
|
|
210
|
+
"recipe": "verify"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"id": "policy-unknown",
|
|
214
|
+
"level": "warning",
|
|
215
|
+
"source": "evidence",
|
|
216
|
+
"symptom": "acceptance.jsonc 的 policy 值不支持",
|
|
217
|
+
"fix": "改成 static / visual / flow 之一,或删掉 policy 使用缺省 static",
|
|
218
|
+
"recipe": "verify"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"id": "render-empty",
|
|
222
|
+
"level": "warning",
|
|
223
|
+
"source": "evidence",
|
|
224
|
+
"symptom": "卡片渲染结果为空",
|
|
225
|
+
"fix": "检查组件是否按 cardType 注册、样例数据是否为空",
|
|
226
|
+
"recipe": "card"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"id": "render-identical",
|
|
230
|
+
"level": "warning",
|
|
231
|
+
"source": "evidence",
|
|
232
|
+
"symptom": "同一卡片的多份样例渲染结果完全相同",
|
|
233
|
+
"fix": "给不同状态不同的可见内容,或删掉重复样例",
|
|
234
|
+
"recipe": "card"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"id": "tool-description-empty",
|
|
238
|
+
"level": "warning",
|
|
239
|
+
"source": "evidence",
|
|
240
|
+
"symptom": "工具 description 为空",
|
|
241
|
+
"fix": "写「什么时候用」,不要写「做什么」",
|
|
242
|
+
"recipe": "tool"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"id": "tool-description-duplicate",
|
|
246
|
+
"level": "warning",
|
|
247
|
+
"source": "evidence",
|
|
248
|
+
"symptom": "两个工具的 description 完全相同",
|
|
249
|
+
"fix": "让两个工具的描述各自说明触发场景",
|
|
250
|
+
"recipe": "tool"
|
|
203
251
|
}
|
|
204
252
|
]
|
|
205
253
|
}
|