@tbox.cn/app-template-agent 1.0.0-alpha.8 → 1.0.0-alpha.9
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/.gitignore +7 -0
- package/.tbox/app.json +1 -1
- package/.tbox/default-modules.json +1 -1
- package/.tbox/factory/chat.json +9 -0
- package/.tbox/miniapp-containers.json +1 -1
- package/AGENTS.md +4 -2
- package/apps/client/package.json +1 -0
- package/apps/client/scripts/._color-scan.test.mjs +0 -0
- package/apps/client/scripts/._experience-checks.mjs +0 -0
- package/apps/client/scripts/._geometry-kernel.test.mjs +0 -0
- package/apps/client/scripts/._in-process-checks.mjs +0 -0
- package/apps/client/scripts/._probe-checks.mjs +0 -0
- package/apps/client/scripts/._sample-entries.test.mjs +0 -0
- package/apps/client/scripts/._storyboard.test.mjs +0 -0
- package/apps/client/scripts/._theme-kernel.mjs +0 -0
- package/apps/client/scripts/._theme-kernel.test.mjs +0 -0
- package/apps/client/scripts/acceptance-changes.test.mjs +97 -0
- package/apps/client/scripts/check-evidence.mjs +361 -94
- package/apps/client/scripts/color-scan.mjs +66 -0
- package/apps/client/scripts/color-scan.test.mjs +25 -0
- package/apps/client/scripts/evidence-gate.mjs +248 -46
- package/apps/client/scripts/evidence-gate.test.mjs +63 -5
- package/apps/client/scripts/experience-checks.mjs +163 -0
- package/apps/client/scripts/geometry-kernel.test.mjs +92 -0
- package/apps/client/scripts/in-process-checks.mjs +51 -0
- package/apps/client/scripts/lib/._card-registry.mjs +0 -0
- package/apps/client/scripts/lib/._card-registry.test.mjs +0 -0
- package/apps/client/scripts/lib/._evidence-inputs.mjs +0 -0
- package/apps/client/scripts/lib/._evidence-inputs.test.mjs +0 -0
- package/apps/client/scripts/lib/._static-render.mjs +0 -0
- package/apps/client/scripts/lib/._static-render.test.mjs +0 -0
- package/apps/client/scripts/lib/card-registry.mjs +81 -0
- package/apps/client/scripts/lib/card-registry.test.mjs +59 -0
- package/apps/client/scripts/lib/evidence-inputs.mjs +91 -0
- package/apps/client/scripts/lib/evidence-inputs.test.mjs +27 -0
- package/apps/client/scripts/lib/static-render.mjs +35 -0
- package/apps/client/scripts/lib/static-render.test.mjs +21 -0
- package/apps/client/scripts/probe-checks.mjs +85 -0
- package/apps/client/scripts/render-card.mjs +76 -60
- package/apps/client/scripts/sample-entries.test.mjs +31 -0
- package/apps/client/scripts/storyboard.test.mjs +149 -0
- package/apps/client/scripts/surface-css.mjs +5 -2
- package/apps/client/scripts/theme-kernel.mjs +236 -0
- package/apps/client/scripts/theme-kernel.test.mjs +136 -0
- package/apps/client/src/styles/brand.css +11 -11
- package/apps/client/src/styles/tailwind.css +3 -4
- package/apps/client/vite.config.ts +2 -1
- package/apps/server/scripts/probe.mjs +6 -1
- package/apps/server/scripts/scenario-lib.mjs +54 -7
- package/apps/server/scripts/scenario.mjs +41 -7
- package/config/AGENTS.md +1 -0
- package/config/chat.json +21 -9
- package/docs/agent/card.md +1 -0
- package/docs/agent/kit.md +1 -1
- package/docs/agent/shell.md +1 -0
- package/docs/agent/style.md +3 -1
- package/docs/agent/verify.md +37 -8
- package/package.json +9 -6
- package/packages/agent-ui-kit/README.md +21 -1
- package/packages/agent-ui-kit/catalog.json +1 -1
- package/packages/agent-ui-kit/package.json +9 -1
- package/packages/agent-ui-kit/src/ChatPage.tsx +30 -1
- package/packages/agent-ui-kit/src/card/primitives.test.tsx +10 -0
- package/packages/agent-ui-kit/src/card/primitives.tsx +14 -10
- package/packages/agent-ui-kit/src/card/view-card.tsx +6 -1
- package/packages/agent-ui-kit/src/chat-config.ts +11 -7
- package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.test.tsx +3 -0
- package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.tsx +2 -7
- package/packages/agent-ui-kit/src/components/BottomSheet/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/index.test.tsx +90 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/index.tsx +129 -0
- package/packages/agent-ui-kit/src/components/ChatInput/index.test.tsx +2 -2
- package/packages/agent-ui-kit/src/components/ChatInput/index.tsx +21 -16
- package/packages/agent-ui-kit/src/components/HistoryEntry/index.tsx +1 -0
- package/packages/agent-ui-kit/src/components/QuickCommands/index.tsx +2 -2
- package/packages/agent-ui-kit/src/components/ScrollToBottomButton/index.tsx +7 -3
- package/packages/agent-ui-kit/src/components/ToolCallBlock/index.tsx +4 -2
- package/packages/agent-ui-kit/src/index.ts +4 -0
- package/packages/agent-ui-kit/src/shell.contract.json +9 -0
- package/packages/agent-ui-kit/src/shell.test.ts +10 -0
- package/packages/agent-ui-kit/src/shell.ts +15 -0
- package/packages/agent-ui-kit/src/theme/contract.json +78 -1
- package/packages/agent-ui-kit/src/theme/theme-contract.test.ts +16 -0
- package/packages/agent-ui-kit/src/theme/tokens.css +1 -1
- package/pnpm-lock.template.yaml +97 -91
- package/pnpm-workspace.template.yaml +10 -10
- package/profiles/mall/._chat.overrides.json +0 -0
- package/profiles/mall/chat.overrides.json +12 -0
- package/profiles/mall/config/chat.json +14 -6
- package/profiles/mall.json +1 -1
- package/scripts/._deliver.mjs +0 -0
- package/scripts/._shell-probe.mjs +0 -0
- package/scripts/._storyboard.mjs +0 -0
- package/scripts/check-fast.mjs +1 -0
- package/scripts/checks.json +294 -17
- package/scripts/deliver.mjs +183 -0
- package/scripts/lib/._chrome-pipe.mjs +0 -0
- package/scripts/lib/._geometry-kernel.mjs +0 -0
- package/scripts/lib/chrome-pipe.mjs +95 -0
- package/scripts/lib/geometry-kernel.mjs +137 -0
- package/scripts/shell-probe.mjs +283 -0
- package/scripts/storyboard.mjs +350 -0
- package/profiles/mall/config/llm_provider.json +0 -5
- package/profiles/mall/config/plugins.json +0 -3
- package/scripts/gen-tailwind-sources.mjs +0 -55
- /package/{profiles/mall/config/._llm_provider.json → .tbox/factory/._chat.json} +0 -0
- /package/{profiles/mall/config/._plugins.json → apps/client/scripts/._acceptance-changes.test.mjs} +0 -0
- /package/{scripts/._gen-tailwind-sources.mjs → apps/client/scripts/._color-scan.mjs} +0 -0
package/.gitignore
CHANGED
package/.tbox/app.json
CHANGED
package/AGENTS.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- 卡片默认写视图卡:`defineViewCard` + `view(data)`,一张卡只有服务端一个文件(客户端由 app-build 派生);只有需要局部自定义图形或富交互时才写 `defineCard` + tsx 三件套。
|
|
12
12
|
- **动手前先跑一次 `pnpm exec tbox-app brief`**:应用现状、核心 API 签名、基元、壳契约、样式变量、命令、配方索引都在里面。
|
|
13
13
|
- **不读源码**:`packages/agent-ui-kit/src`、`apps/server/src/app.ts`、`README.md`、`.tbox-gen`、`tgz` 都不必读——装配由平台生成,写法以简报与配方为准。
|
|
14
|
-
- **交付纪律**:实现前先把需求拆成 `scenarios/acceptance.jsonc`
|
|
14
|
+
- **交付纪律**:实现前先把需求拆成 `scenarios/acceptance.jsonc` 的验收项;开发期用 `pnpm check:fast`,交付时用 `pnpm deliver`(裁决 + 摘要 + DELIVERY.md)。`verdict: "deliverable"` 即交付,交付后不再逐行复审;`reopened` 表示交付后内容又变了,重跑确认再交付。摘要里的 `handoff`、`notRun` 与 `delivery.deferred` 是当前策略验不了的项——原样写进交付说明,不要用读代码代替验证。
|
|
15
15
|
- 用户说「不要测试」「快速交付」指不起 dev server、不开浏览器、不写测试文件;`check:fast` 属于构建,照常运行。
|
|
16
16
|
|
|
17
17
|
## 我要做什么
|
|
@@ -91,6 +91,8 @@ export const clientModule = { cards: {}, register(ctx) {} } satisfies ClientModu
|
|
|
91
91
|
|
|
92
92
|
```sh
|
|
93
93
|
pnpm check:fast # 生成 → 类型 → lint 修复 → 结构 → 证据包(样式/原语/真渲染/场景;开发期主力,秒级)
|
|
94
|
+
pnpm probe:shell # 壳体验探针(390 宽空态;无 Chrome 记 not-run)
|
|
95
|
+
pnpm deliver # 交付:裁决 + 摘要 + DELIVERY.md(交付唯一入口)
|
|
94
96
|
pnpm scenario # 跑 scenarios/*.json(进程内,零端口零模型)
|
|
95
97
|
pnpm generate # 生成 manifest/registry/entries
|
|
96
98
|
pnpm typecheck
|
|
@@ -98,7 +100,7 @@ pnpm test
|
|
|
98
100
|
pnpm lint
|
|
99
101
|
pnpm check # 结构、workspace、inspector
|
|
100
102
|
pnpm smoke
|
|
101
|
-
pnpm verify #
|
|
103
|
+
pnpm verify # 发布前全量(人/CI):typecheck + test + lint + build + smoke + generated
|
|
102
104
|
pnpm dev # 单端口 8000(Vite + server)
|
|
103
105
|
```
|
|
104
106
|
|
package/apps/client/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { acceptanceChangesOf, defaultModuleDrift, matchFrame, summarizeAcceptanceChanges } from './evidence-gate.mjs';
|
|
3
|
+
|
|
4
|
+
const digest = (entries) => Object.fromEntries(entries.map(([id, text, handoff, coveredBy]) => [id, { text, handoff, coveredBy }]));
|
|
5
|
+
|
|
6
|
+
describe('验收变更(D4)', () => {
|
|
7
|
+
it('首轮没有基线 → 不报变更', () => {
|
|
8
|
+
const result = acceptanceChangesOf(undefined, digest([['a', 'h1', false, ['s1']]]));
|
|
9
|
+
expect(result.changes).toEqual([]);
|
|
10
|
+
expect(result.cumulative).toEqual([]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('六类变更各按语义分类,弱化标记正确', () => {
|
|
14
|
+
const prev = { acceptanceDigest: digest([
|
|
15
|
+
['keep', 'h1', false, ['s1']],
|
|
16
|
+
['shrink', 'h2', false, ['s1', 's2']],
|
|
17
|
+
['reword', 'h3', false, []],
|
|
18
|
+
['handoff', 'h4', false, []],
|
|
19
|
+
['gone', 'h5', false, []],
|
|
20
|
+
]) };
|
|
21
|
+
const next = digest([
|
|
22
|
+
['keep', 'h1', false, ['s1']],
|
|
23
|
+
['shrink', 'h2', false, ['s1']],
|
|
24
|
+
['reword', 'h3x', false, []],
|
|
25
|
+
['handoff', 'h4', true, []],
|
|
26
|
+
['new', 'h6', false, []],
|
|
27
|
+
]);
|
|
28
|
+
const { changes } = acceptanceChangesOf(prev, next);
|
|
29
|
+
const byId = Object.fromEntries(changes.map((item) => [item.id, item]));
|
|
30
|
+
expect(byId.shrink).toMatchObject({ kind: 'covers-shrunk', weakening: true, before: '2', after: '1' });
|
|
31
|
+
expect(byId.reword).toMatchObject({ kind: 'item-reworded', weakening: true });
|
|
32
|
+
expect(byId.handoff).toMatchObject({ kind: 'handoff-added', weakening: true });
|
|
33
|
+
expect(byId.gone).toMatchObject({ kind: 'item-removed', weakening: true });
|
|
34
|
+
expect(byId.new).toMatchObject({ kind: 'item-added', weakening: false });
|
|
35
|
+
expect(byId.keep).toBeUndefined();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('跨轮累计:同 id 同 kind 只留最早一次', () => {
|
|
39
|
+
const prev = { acceptanceDigest: digest([['a', 'h1', false, ['s1', 's2']]]), acceptanceChanges: [] };
|
|
40
|
+
const first = acceptanceChangesOf(prev, digest([['a', 'h1', false, ['s1']]]));
|
|
41
|
+
expect(first.cumulative).toHaveLength(1);
|
|
42
|
+
const second = acceptanceChangesOf({ ...prev, acceptanceDigest: digest([['a', 'h1', false, ['s1']]]), acceptanceChanges: first.cumulative }, digest([['a', 'h1', false, ['s1']]]));
|
|
43
|
+
expect(second.changes).toEqual([]);
|
|
44
|
+
expect(second.cumulative).toHaveLength(1);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('恢复原状后该条目从累计里移除', () => {
|
|
48
|
+
const cumulative = [{ id: 'a', kind: 'covers-shrunk', weakening: true, before: '2', after: '0', firstSeenAt: 1 }];
|
|
49
|
+
const prev = { acceptanceDigest: digest([['a', 'h1', false, []]]), acceptanceChanges: cumulative };
|
|
50
|
+
const result = acceptanceChangesOf(prev, digest([['a', 'h1', false, ['s1', 's2']]]));
|
|
51
|
+
expect(result.cumulative).toEqual([]);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('删掉的验收项又加回来 → 这条账出账(不留永久噪声)', () => {
|
|
55
|
+
const prev = {
|
|
56
|
+
acceptanceDigest: digest([['a', 'h1', false, []]]),
|
|
57
|
+
acceptanceChanges: [{ id: 'a', kind: 'item-removed', weakening: true, firstSeenAt: 1 }],
|
|
58
|
+
};
|
|
59
|
+
const result = acceptanceChangesOf(prev, digest([['a', 'h1', false, []]]));
|
|
60
|
+
expect(result.cumulative).toEqual([]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('摘要只列弱化项,带前后数量', () => {
|
|
64
|
+
const summary = summarizeAcceptanceChanges([
|
|
65
|
+
{ id: 'parking.rule', kind: 'covers-shrunk', weakening: true, before: '2', after: '0' },
|
|
66
|
+
{ id: 'ui.mobile', kind: 'handoff-added', weakening: true },
|
|
67
|
+
{ id: 'new', kind: 'item-added', weakening: false },
|
|
68
|
+
]);
|
|
69
|
+
expect(summary).toEqual(['parking.rule 覆盖 2→0', 'ui.mobile 改为移交']);
|
|
70
|
+
expect(summarizeAcceptanceChanges([
|
|
71
|
+
{ id: 'x', kind: 'item-reworded', weakening: true },
|
|
72
|
+
{ id: 'x', kind: 'handoff-added', weakening: true },
|
|
73
|
+
])).toEqual(['x 文本改写、改为移交']);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe('出厂模块偏离(D4)', () => {
|
|
78
|
+
it('少了出厂模块 → module-removed;新增 → module-added', () => {
|
|
79
|
+
const drift = defaultModuleDrift({
|
|
80
|
+
factory: [{ package: '@tbox.cn/app-module-ai-payment', version: '1.0.0' }],
|
|
81
|
+
actual: [{ package: '@tbox.cn/app-module-custom' }],
|
|
82
|
+
});
|
|
83
|
+
expect(drift.skipped).toBe(false);
|
|
84
|
+
expect(drift.items.map((item) => item.kind)).toEqual(['module-removed', 'module-added']);
|
|
85
|
+
expect(drift.items[0].key).toBe('@tbox.cn/app-module-ai-payment');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('出厂快照没有模块时跳过,不误报', () => {
|
|
89
|
+
expect(defaultModuleDrift({ factory: [], actual: [] }).skipped).toBe(true);
|
|
90
|
+
expect(defaultModuleDrift({ factory: undefined, actual: [{ package: 'x' }] }).skipped).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('当前文件缺失或为空数组时,出厂模块全部算移除', () => {
|
|
94
|
+
const drift = defaultModuleDrift({ factory: [{ package: 'a' }, { package: 'b' }], actual: [] });
|
|
95
|
+
expect(drift.items).toHaveLength(2);
|
|
96
|
+
});
|
|
97
|
+
});
|