hd-garden 0.11.0 → 0.12.1
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/.agents/skills/garden-ui/SKILL.md +27 -21
- package/app/lib/garden-docs-meta.ts +2 -0
- package/docs/handbook/components/compose.md +11 -231
- package/docs/handbook/en/components/compose.md +43 -272
- package/docs/handbook/en/reference/compose-icons.md +863 -0
- package/docs/handbook/en/reference/compose.md +153 -75
- package/docs/handbook/en/reference.md +1 -0
- package/docs/handbook/reference/compose-icons.md +863 -0
- package/docs/handbook/reference/compose.md +156 -78
- package/docs/handbook/reference.md +2 -1
- package/editors/dist/typora/main.js +234 -234
- package/editors/dist/vscode/garden-ui-0.1.1.vsix +0 -0
- package/package.json +1 -1
- package/scripts/gen-compose-handbook.mjs +427 -0
- package/scripts/gen-compose-icons.mjs +236 -0
- package/templates/garden-blocks.md +1 -1
- package/templates/skills-en/garden-ui/SKILL.md +45 -39
- package/ui/README.md +1 -1
- package/ui/compose/compose.css +530 -12
- package/ui/compose/icons.mjs +774 -0
- package/ui/compose/index.mjs +2 -1
- package/ui/compose/markup.mjs +392 -29
- package/ui/compose/parse.mjs +8 -1
- package/ui/compose/prompt-catalog.mjs +99 -0
- package/ui/compose/render.mjs +155 -17
- package/ui/compose/tokens.mjs +50 -0
- package/ui/core/catalog.mjs +6 -1
- package/ui/core/cli-locale.mjs +4 -4
- package/ui/core/garden-fence.mjs +1 -1
- package/ui/core/scan.mjs +1 -1
- package/ui/garden/catalog.mjs +2 -2
- package/ui/preview/dist/garden-ui.esm.js +235 -235
- package/ui/preview/dist/garden-ui.iife.js +235 -235
- package/ui/prompt/build.mjs +12 -3
- package/ui/prompt/recipes/compose.md +48 -13
- package/ui/prompt/rules.md +2 -2
- package/editors/dist/vscode/garden-ui-0.1.0.vsix +0 -0
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
name: garden-ui
|
|
3
3
|
description: >-
|
|
4
4
|
Compiles the `garden` idea blocks in one Garden post into garden components
|
|
5
|
-
(garden compose, or card / stat / compare / ... , or prose, or garden
|
|
5
|
+
(garden compose DIL, or card / stat / compare / ... , or prose, or garden
|
|
6
6
|
html), fixes broken garden compose blocks, and suggests where a post could
|
|
7
|
-
use interaction. Older intent / ui blocks are handled the same
|
|
8
|
-
the user says 编译这篇 / 编译想法 / 重编译 <id> / 这篇哪里适合交互,
|
|
9
|
-
garden ui check fix prompt.
|
|
7
|
+
use interaction. Older intent / ui / interactive blocks are handled the same
|
|
8
|
+
way. Use when the user says 编译这篇 / 编译想法 / 重编译 <id> / 这篇哪里适合交互,
|
|
9
|
+
or pastes a garden ui check fix prompt.
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# 编译 Garden 交互块
|
|
13
13
|
|
|
14
|
-
作者在稿里用不带名字的 `garden` 围栏写一句想法,这个 skill 把它变成 `garden compose
|
|
14
|
+
作者在稿里用不带名字的 `garden` 围栏写一句想法,这个 skill 把它变成 `garden compose`、别的 `garden` 组件,或写回正文。
|
|
15
|
+
|
|
16
|
+
**`garden compose` 写的是 DIL,不是 YAML:** 叶子是 Markdown,结构是 compose 目录里的**小写标签** + 设计 token。作者原话放进 `<intent>`(或块头 `intent:`)。围栏类型始终是 `garden compose`——静态说明图与可调 play 都是它。不要发明 YAML 槽,不要用 interactive 的 PascalCase 当作者输入。
|
|
17
|
+
|
|
18
|
+
交互组件、compose 目录和设计规则在 `npx garden ui prompt` 的输出里;各 `garden` 组件的用途和示例在 `node_modules/hd-garden/templates/garden-blocks.md`(在引擎仓库里是 `templates/garden-blocks.md`)。以这两份为准,不凭记忆写组件。改完引擎后若本 skill 或 prompt 过期,先 `npx garden ui prompt` 再写。
|
|
15
19
|
|
|
16
20
|
作者提交时,提交前钩子跑的是同一个 `npx garden ui check`。你用来找块、写回、自查的命令,和拦住作者提交的命令是同一套。
|
|
17
21
|
|
|
@@ -42,22 +46,23 @@ description: >-
|
|
|
42
46
|
npx garden ui prompt
|
|
43
47
|
```
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
里面是 compose 目录(小写标签 + token)、interactive PascalCase 参考(兼容)、配方和设计规则。按配方的骨架写,不发明目录里没有的组件或属性。
|
|
46
50
|
|
|
47
51
|
3. 每块读原话和所在小节,三选一:
|
|
48
52
|
- **写回正文**:一句话、一张表或一张 Mermaid 就能说清时。
|
|
49
|
-
- **写 `garden compose
|
|
53
|
+
- **写 `garden compose`(说明图)**:读者需要看见结构、关系、重点时。Markdown 叶子 + 小写目录标签;不要 YAML。
|
|
54
|
+
- **写 `garden compose`(play)**:读者需要拖、点、翻才能看懂时。仍用 `garden compose`;可用 `{@body}`、`{expr}`、`{#if}`/`{#each}` 与小写控件(`slider`/`choice`/`button`/`stat`…)。遗留 `garden interactive` + PascalCase 仅作兼容。
|
|
50
55
|
- **写一段 `diff`**:想法紧跟在一段完整代码后面,说的是「和上一版比改了什么」时。按原话写出 diff,用一段普通 Markdown 写回(只有这一个 `diff` 围栏)。写回后它紧挨着那段代码,页面会合成「代码 / 对比上一版」切换;diff 里的新行要和上面的完整代码一致。
|
|
51
|
-
- **写别的 `garden` 组件**:一张或多张资源卡(`card` / `cards`)、几个指标(`stat`)、两种做法并排或好坏对照(`compare` / `verdict: good|bad`)、一条时间线(`timeline`)、一张静态图表(`chart
|
|
52
|
-
-
|
|
56
|
+
- **写别的 `garden` 组件**:一张或多张资源卡(`card` / `cards`)、几个指标(`stat`)、两种做法并排或好坏对照(`compare` / `verdict: good|bad`)、一条时间线(`timeline`)、一张静态图表(`chart`)、一份下载文件(`file`)、3~6 个要素的关系图(`relations`)、紧凑图标列表或分步列表(`list`)、两三个选项的选择卡(`choice`)。字段与校验约束见 `npx garden ui prompt` 与 `templates/garden-blocks.md`。
|
|
57
|
+
- **编译已有 `garden compose`**:`lang` 是 `garden-compose` 且 `status` 是 `uncompiled` 时,围栏头保持 `garden compose`。把扫描到的原话原样放进 `<intent>`(或块头 `intent:`),正文写成 DIL(Markdown + 小写标签;play 时加 `{@body}` 等)。不要改成 interactive,不要写任意 HTML、SVG 或脚本。配方在 `npx garden ui prompt` 的说明图一节。
|
|
53
58
|
- **写 `garden html`**:目录表达不了的画布动画、音频、物理模拟等。按 [garden-interactive-chart](../garden-interactive-chart/SKILL.md) 在同名目录写 HTML,用 `title` 写下判断。
|
|
54
59
|
|
|
55
60
|
4. 写 `garden compose` 时:
|
|
56
|
-
- 格式:围栏头写 `garden compose
|
|
57
|
-
- 原话原样放进
|
|
58
|
-
- `
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
+
- 格式:围栏头写 `garden compose`(可选 `#<id>`);作者原话进 `<intent>…</intent>` 或块头 `intent:`;静态说明图直接写 Markdown + 标签树;play 可在 `---` 块头写 `caption` / `intent`,正文用 `{@body}` 与小写控件。
|
|
62
|
+
- 原话原样放进 intent,一个字都不改。
|
|
63
|
+
- 芯片内部 `gap={0}`/`gap={1}`;章节堆叠 `gap={2}`/`gap={3}`;日横幅等宽;phrasing 叶子保留前导 `*`。
|
|
64
|
+
- play 时:`caption` 摘原话里的判断;原话有已知点可写 `expect`(若引擎/校验支持)。
|
|
65
|
+
- 不要写色值、宽度、任意 HTML/SVG/脚本;图标用 `<icon name="…"/>`(名字须在目录里)。
|
|
61
66
|
- 块太大就拆成两块,各自就近放在要讲的段落旁边,不挪到别的文件。
|
|
62
67
|
|
|
63
68
|
5. 每块用 `apply` 写回,新内容从标准输入给:
|
|
@@ -65,17 +70,16 @@ description: >-
|
|
|
65
70
|
````bash
|
|
66
71
|
npx garden ui apply content/posts/路径.md --id <id> --base <hash> <<'GARDEN_UI'
|
|
67
72
|
```garden compose #id
|
|
68
|
-
|
|
69
|
-
intent: |
|
|
70
|
-
...
|
|
71
|
-
---
|
|
73
|
+
<intent>
|
|
72
74
|
...
|
|
75
|
+
</intent>
|
|
76
|
+
<row gap={2}>...</row>
|
|
73
77
|
```
|
|
74
78
|
GARDEN_UI
|
|
75
79
|
````
|
|
76
80
|
|
|
77
81
|
- 想法块没有 id,用 `--intent-hash <intentHash>` 定位;原话重复时改用 `--at <startLine>`。
|
|
78
|
-
- 新内容可以是一个 `garden` 组件围栏(interactive、card、stat……),或一段普通 Markdown(写回正文时)。旧稿里的 `ui` 块也可以按原格式写回。
|
|
82
|
+
- 新内容可以是一个 `garden` 组件围栏(compose、interactive、card、stat……),或一段普通 Markdown(写回正文时)。旧稿里的 `ui` 块也可以按原格式写回。
|
|
79
83
|
- 新内容里不能再有没编译的想法。
|
|
80
84
|
- 成功时 stdout 是 `{"ok":true,...}`。失败时 stderr 是 JSON,按 `code` 处理:
|
|
81
85
|
- `apply-invalid`:新内容没通过校验,按 `diagnostics` 改了再写。
|
|
@@ -96,7 +100,7 @@ description: >-
|
|
|
96
100
|
|
|
97
101
|
| id | 选择 | 配方 | 假设 | expect |
|
|
98
102
|
| --- | --- | --- | --- | --- |
|
|
99
|
-
| kv-memory | garden compose | 参数台 | 默认序列取 4K | batch 1 时 512 MiB |
|
|
103
|
+
| kv-memory | garden compose play | 参数台 | 默认序列取 4K | batch 1 时 512 MiB |
|
|
100
104
|
|
|
101
105
|
"假设"写原话没说、你替作者定下的东西(默认值、范围、补的 caption)。没有就写"无"。
|
|
102
106
|
|
|
@@ -106,14 +110,16 @@ description: >-
|
|
|
106
110
|
- 编造原话里没有的数字。需要数字但原话没给时,用原话里的公式算,或者问作者。
|
|
107
111
|
- 使用远程地址(图片、脚本、数据)。
|
|
108
112
|
- 改动目标块之外的正文。
|
|
113
|
+
- 把 compose 写成 YAML 槽,或禁止作者/模型使用合法的 `{@body}` / `{expr}` / `{#if}` / `{#each}`(play 需要时)。
|
|
109
114
|
|
|
110
115
|
## 建议模式:这篇哪里适合交互
|
|
111
116
|
|
|
112
117
|
只读,不改稿。先运行 `npx garden ui prompt` 读设计规则,再通读全文,挑出纯文字或贴图说不清的段落:
|
|
113
118
|
|
|
114
|
-
-
|
|
119
|
+
- 公式或数字随参数变化(compose play / 参数台)
|
|
115
120
|
- 多步过程(步进器、流程)
|
|
116
121
|
- 两种做法的差别(对比)
|
|
117
122
|
- 一组格子、字节或内存布局(格子图)
|
|
123
|
+
- 结构关系说明图(compose 静态 DIL)
|
|
118
124
|
|
|
119
125
|
每处给出:所在小节、为什么文字不够、一段可以直接粘贴到该段落后面的 `garden` 想法块草稿。草稿只写读者要做什么、看到什么,以及原文里已有的数字,不写组件名。最多 5 处;没有合适的就说没有。
|
|
@@ -96,6 +96,7 @@ export const COMPONENT_BADGE: Record<string, string> = {
|
|
|
96
96
|
"reference/timeline": "timeline",
|
|
97
97
|
"reference/chart": "chart",
|
|
98
98
|
"reference/compose": "compose",
|
|
99
|
+
"reference/compose-icons": "compose",
|
|
99
100
|
"reference/html": "html",
|
|
100
101
|
"reference/interactive": "interactive",
|
|
101
102
|
"reference/file": "file",
|
|
@@ -118,6 +119,7 @@ export const NAV_SHORT_TITLE: Record<string, string> = {
|
|
|
118
119
|
"components/timeline": "时间线",
|
|
119
120
|
"components/chart": "条形图表",
|
|
120
121
|
"components/compose": "说明图",
|
|
122
|
+
"reference/compose-icons": "compose 图标",
|
|
121
123
|
"components/html": "嵌入网页片段",
|
|
122
124
|
"components/interactive": "可调公式与参数",
|
|
123
125
|
"components/file": "文件下载与预览",
|
|
@@ -20,17 +20,15 @@ badge: compose
|
|
|
20
20
|
- **谁连谁**:谁先到谁、从一处散开,还是几处收到一起。没有先后顺序,就直接写「这几块没有先后」。
|
|
21
21
|
- **哪块是重点**:直接点名,比如「中间那列是重点」「下面一行才是重点」。
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
不要写颜色、圆角、灰胶囊、字重、间距、阴影、要不要撑满。外观由组件默认样式决定,写了反而乱。
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
**完整标签与属性**见 [组件参考 · compose](/garden/reference/compose);**全部图标名**见 [compose 图标](/garden/reference/compose-icons)。
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## 写法对照
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
只写「画一张权限图」,AI 不知道分几列、每列放什么;写成「三列等宽,中间用浅灰圆角,字重轻一点」,又全在规定外观。
|
|
29
|
+
写围栏时,最常见的失误有两个:一是只写一个主题词,没给结构;二是把精力花在规定颜色、圆角和字重上。下面按五种常见结构,列出改写后的写法。
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
**三列并排,中间接起来**
|
|
34
32
|
|
|
35
33
|
````markdown
|
|
36
34
|
```garden compose
|
|
@@ -42,8 +40,6 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
42
40
|
|
|
43
41
|
**先到一处,再散开**
|
|
44
42
|
|
|
45
|
-
不要写「画个单点登录,箭头好看一点,间距均匀」。把谁先连向哪里、再同时分给哪几个系统写清楚:
|
|
46
|
-
|
|
47
43
|
````markdown
|
|
48
44
|
```garden compose
|
|
49
45
|
用户浏览器先到身份提供方,再同时连到 HR、Finance、Project 三个系统。
|
|
@@ -53,8 +49,6 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
53
49
|
|
|
54
50
|
**自上而下分层**
|
|
55
51
|
|
|
56
|
-
不要写「五张通栏卡片,第二张和第五张上色,箭头画细」。直接列出五层的名字、哪两层需要突出,以及是不是每次请求都按顺序走完:
|
|
57
|
-
|
|
58
52
|
````markdown
|
|
59
53
|
```garden compose
|
|
60
54
|
从上到下五层:浏览器、身份服务、BFF、业务服务、授权决策。
|
|
@@ -65,8 +59,6 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
65
59
|
|
|
66
60
|
**一件事的多个切面**
|
|
67
61
|
|
|
68
|
-
不要写「两行两列加下面两张卡片,标题不要加粗」。把六个切面的短名、每块要回答的问题,以及「没有先后顺序」交代清楚:
|
|
69
|
-
|
|
70
62
|
````markdown
|
|
71
63
|
```garden compose
|
|
72
64
|
用户发起请求后,先看四件事:认证(你是谁)、凭证(怎么证明)、
|
|
@@ -77,8 +69,6 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
77
69
|
|
|
78
70
|
**上下两行对比**
|
|
79
71
|
|
|
80
|
-
不要写「上面无框,下面灰色胶囊,贴着内容,不要撑满」。直接写哪一行是常规背景、哪一行是真正要强调的循环:
|
|
81
|
-
|
|
82
72
|
````markdown
|
|
83
73
|
```garden compose
|
|
84
74
|
上面一行是常规交付:理解需求 → 设计方案 → 开发上线。
|
|
@@ -87,13 +77,13 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
87
77
|
```
|
|
88
78
|
````
|
|
89
79
|
|
|
90
|
-
##
|
|
80
|
+
## 图标与表面
|
|
91
81
|
|
|
92
|
-
|
|
82
|
+
状态符号用 `<icon name="check-circle"/>` 一类具名图标,不要塞 emoji。小格子、浅底、圆角用 `padding`、`background`、`radius` 组合,不要为单张图发明专用标签。
|
|
93
83
|
|
|
94
|
-
|
|
84
|
+
## 一张示例
|
|
95
85
|
|
|
96
|
-
|
|
86
|
+
下面只留一张图;更多对照见仓库示例文,标签全表见参考页。
|
|
97
87
|
|
|
98
88
|
```garden compose
|
|
99
89
|
<intent>
|
|
@@ -120,218 +110,9 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
120
110
|
<text tone="muted" align="center">概念关系:User ↔ Role ↔ Permission</text>
|
|
121
111
|
```
|
|
122
112
|
|
|
123
|
-
### 先汇再散
|
|
124
|
-
|
|
125
|
-
先流向中间那一层,再用 `<fan>` 同时分到下面几列。
|
|
126
|
-
|
|
127
|
-
```garden compose
|
|
128
|
-
<intent>
|
|
129
|
-
用户浏览器先到身份提供方。身份提供方再同时连到 HR、Finance、Project。三个系统信任同一个身份提供方。身份提供方是要先看见的一层。
|
|
130
|
-
</intent>
|
|
131
|
-
<stack align="center">
|
|
132
|
-
<pill>用户浏览器</pill>
|
|
133
|
-
<arrow dir="down"/>
|
|
134
|
-
<band tone="accent" align="center">
|
|
135
|
-
<title>Identity Provider(IdP)</title>
|
|
136
|
-
<text>统一完成身份验证、维护登录状态、签发身份断言</text>
|
|
137
|
-
</band>
|
|
138
|
-
<fan n="3"/>
|
|
139
|
-
<row align="center">
|
|
140
|
-
<title>HR 系统</title>
|
|
141
|
-
<title>Finance 系统</title>
|
|
142
|
-
<title>Project 系统</title>
|
|
143
|
-
</row>
|
|
144
|
-
<text tone="muted" align="center">三个系统都信任同一个身份提供方</text>
|
|
145
|
-
</stack>
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### 自上而下分层
|
|
149
|
-
|
|
150
|
-
几层按顺序往下走,重点层用 `<band>`,经过的层只留文字。
|
|
151
|
-
|
|
152
|
-
```garden compose
|
|
153
|
-
<intent>
|
|
154
|
-
从上到下五层:浏览器、身份服务、BFF、业务服务、授权决策。身份服务和授权决策是要强调的两层,其余是经过的路径。不是每次请求都按这个顺序走完。
|
|
155
|
-
</intent>
|
|
156
|
-
<stack align="center">
|
|
157
|
-
<box frame="text" align="center">
|
|
158
|
-
<badge>①</badge>
|
|
159
|
-
<title>浏览器 / App</title>
|
|
160
|
-
<text>Cookie、Session、OAuth Client</text>
|
|
161
|
-
</box>
|
|
162
|
-
<arrow dir="down"/>
|
|
163
|
-
<band tone="accent" align="center">
|
|
164
|
-
<badge>②</badge>
|
|
165
|
-
<title>身份服务 IdP / IAM</title>
|
|
166
|
-
<text>Passkey、MFA、OIDC、会话管理</text>
|
|
167
|
-
</band>
|
|
168
|
-
<arrow dir="down"/>
|
|
169
|
-
<box frame="text" align="center">
|
|
170
|
-
<badge>③</badge>
|
|
171
|
-
<title>BFF / API Gateway</title>
|
|
172
|
-
<text>会话验证、Token 校验、入口授权控制</text>
|
|
173
|
-
</box>
|
|
174
|
-
<arrow dir="down"/>
|
|
175
|
-
<box frame="text" align="center">
|
|
176
|
-
<badge>④</badge>
|
|
177
|
-
<title>业务服务</title>
|
|
178
|
-
<text>订单、支付、账户、资源对象</text>
|
|
179
|
-
</box>
|
|
180
|
-
<arrow dir="down"/>
|
|
181
|
-
<band tone="tip" align="center">
|
|
182
|
-
<badge>⑤</badge>
|
|
183
|
-
<title>授权决策系统</title>
|
|
184
|
-
<text>RBAC + ABAC + ReBAC + Policy Engine</text>
|
|
185
|
-
</band>
|
|
186
|
-
<text tone="muted" align="start">逻辑职责示意:并非所有请求都按此顺序经过各层。身份服务通常在登录阶段交互,业务服务则在请求执行时调用授权决策能力。</text>
|
|
187
|
-
</stack>
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### 一件事的多个切面
|
|
191
|
-
|
|
192
|
-
没有严格先后的几块内容,用 `<row>` 和 `<box>` 分成上下两组并排摆开。
|
|
193
|
-
|
|
194
|
-
```garden compose
|
|
195
|
-
<intent>
|
|
196
|
-
用户要改订单地址。先分成认证、凭证、授权、验证,每块一个问题。然后再看传输和保密。这六块不是严格的先后步骤。
|
|
197
|
-
</intent>
|
|
198
|
-
<stack align="center">
|
|
199
|
-
<title>用户发起 API 请求</title>
|
|
200
|
-
<text tone="muted">例如:修改订单收货地址</text>
|
|
201
|
-
</stack>
|
|
202
|
-
<arrow dir="down"/>
|
|
203
|
-
<row>
|
|
204
|
-
<box>
|
|
205
|
-
<title>认证</title>
|
|
206
|
-
<text>你是谁?</text>
|
|
207
|
-
<text tone="muted">Authentication</text>
|
|
208
|
-
</box>
|
|
209
|
-
<box>
|
|
210
|
-
<title>凭证</title>
|
|
211
|
-
<text>如何证明你的身份?</text>
|
|
212
|
-
<text tone="muted">Credential</text>
|
|
213
|
-
</box>
|
|
214
|
-
</row>
|
|
215
|
-
<row>
|
|
216
|
-
<box>
|
|
217
|
-
<title>授权</title>
|
|
218
|
-
<text>你有权修改这笔订单吗?</text>
|
|
219
|
-
<text tone="muted">Authorization</text>
|
|
220
|
-
</box>
|
|
221
|
-
<box>
|
|
222
|
-
<title>验证</title>
|
|
223
|
-
<text>提交的数据是否合法?</text>
|
|
224
|
-
<text tone="muted">Verification</text>
|
|
225
|
-
</box>
|
|
226
|
-
</row>
|
|
227
|
-
<arrow dir="down"/>
|
|
228
|
-
<stack align="center">
|
|
229
|
-
<title>业务操作与数据存储</title>
|
|
230
|
-
</stack>
|
|
231
|
-
<row>
|
|
232
|
-
<box>
|
|
233
|
-
<title>传输</title>
|
|
234
|
-
<text>网络中能否被窃听、篡改、冒充?</text>
|
|
235
|
-
</box>
|
|
236
|
-
<box>
|
|
237
|
-
<title>保密</title>
|
|
238
|
-
<text>敏感数据泄露后能否被读取?</text>
|
|
239
|
-
</box>
|
|
240
|
-
</row>
|
|
241
|
-
<text tone="muted">概念示意:六者并不是严格串行的执行阶段,传输保护贯穿网络通信,保密措施也可能覆盖客户端与服务端。</text>
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### 外框套子项
|
|
245
|
-
|
|
246
|
-
大框里再摆一排徽章或两列要点,适合画「一层里面包含几条检查」。
|
|
247
|
-
|
|
248
|
-
```garden compose
|
|
249
|
-
<intent>
|
|
250
|
-
用户意图经过 Agent,再经过策略执行点,最后到工具执行器。策略点里是四条约束。策略点是要先看见的一层。
|
|
251
|
-
</intent>
|
|
252
|
-
<stack align="center">
|
|
253
|
-
<title>User Intent + Authorization</title>
|
|
254
|
-
<text tone="muted">明确任务目标、用户身份与授权范围</text>
|
|
255
|
-
<arrow dir="down"/>
|
|
256
|
-
<band align="center">
|
|
257
|
-
<title>Agent / LLM</title>
|
|
258
|
-
<text>负责理解、推理、规划和提出执行意图</text>
|
|
259
|
-
<row align="center">
|
|
260
|
-
<badge>Untrusted Context</badge>
|
|
261
|
-
<badge>Memory</badge>
|
|
262
|
-
<badge>Tool Results</badge>
|
|
263
|
-
</row>
|
|
264
|
-
</band>
|
|
265
|
-
<arrow dir="down"/>
|
|
266
|
-
<box align="center" mark="shield">
|
|
267
|
-
<title>Policy Enforcement Point</title>
|
|
268
|
-
<text tone="muted" align="center">独立于 LLM 的确定性执行控制</text>
|
|
269
|
-
<row align="center">
|
|
270
|
-
<text>权限与资源范围</text>
|
|
271
|
-
<text>操作参数校验</text>
|
|
272
|
-
</row>
|
|
273
|
-
<row align="center">
|
|
274
|
-
<text>任务意图约束</text>
|
|
275
|
-
<text>高风险操作审批</text>
|
|
276
|
-
</row>
|
|
277
|
-
</box>
|
|
278
|
-
<arrow dir="down"/>
|
|
279
|
-
<title>Tool Executor</title>
|
|
280
|
-
<text tone="muted">按最小权限执行、记录审计、支持中断</text>
|
|
281
|
-
</stack>
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### 多角色来回交互
|
|
285
|
-
|
|
286
|
-
几个角色按先后发消息、退回结果时,用 `<lanes>` 画成泳道。
|
|
287
|
-
|
|
288
|
-
```garden compose
|
|
289
|
-
<intent>
|
|
290
|
-
用户、客户端、授权服务器三条泳道,六步授权码加 PKCE。
|
|
291
|
-
</intent>
|
|
292
|
-
<lanes>
|
|
293
|
-
<actor>用户</actor>
|
|
294
|
-
<actor>客户端</actor>
|
|
295
|
-
<actor>授权服务器</actor>
|
|
296
|
-
<message from="1" to="2" tone="forward">点击登录 / 授权</message>
|
|
297
|
-
<message from="2" to="3" tone="forward">发起授权请求 + PKCE</message>
|
|
298
|
-
<message from="3" to="1" tone="back">用户身份验证与授权</message>
|
|
299
|
-
<message from="3" to="2" tone="back">重定向返回 Code</message>
|
|
300
|
-
<message from="2" to="3" tone="forward">Code + Verifier 换 Token</message>
|
|
301
|
-
<message from="3" to="2" tone="back">返回 Token</message>
|
|
302
|
-
</lanes>
|
|
303
|
-
<text tone="muted">简化示意:真实流程还包含浏览器跳转、回调绑定、授权码及令牌校验等细节。</text>
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
### 两行流程对比
|
|
307
|
-
|
|
308
|
-
上面一行放常规做法当背景,中间加 `<divider/>`,下面一行用胶囊突出真正想讲的循环。
|
|
309
|
-
|
|
310
|
-
```garden compose
|
|
311
|
-
<intent>
|
|
312
|
-
上面一行是交付顺序:理解需求、设计方案、开发上线。下面一行才是要强调的决策循环:提出假设、低成本验证、迭代或放弃。上面是背景,下面是重点。
|
|
313
|
-
</intent>
|
|
314
|
-
<row align="center">
|
|
315
|
-
<title align="center">理解需求</title>
|
|
316
|
-
<arrow dir="right"/>
|
|
317
|
-
<title align="center">设计方案</title>
|
|
318
|
-
<arrow dir="right"/>
|
|
319
|
-
<title align="center">开发上线</title>
|
|
320
|
-
</row>
|
|
321
|
-
<divider/>
|
|
322
|
-
<row align="center">
|
|
323
|
-
<pill tone="muted">提出假设</pill>
|
|
324
|
-
<arrow dir="right"/>
|
|
325
|
-
<pill tone="muted">低成本验证</pill>
|
|
326
|
-
<arrow dir="right"/>
|
|
327
|
-
<pill tone="muted">迭代或放弃</pill>
|
|
328
|
-
</row>
|
|
329
|
-
<text tone="muted">第二行才是产品探索更强调的决策循环。</text>
|
|
330
|
-
```
|
|
331
|
-
|
|
332
113
|
## 可调参数(play)
|
|
333
114
|
|
|
334
|
-
静态说明图还差一步、读者要拧参数时,仍写 `garden compose
|
|
115
|
+
静态说明图还差一步、读者要拧参数时,仍写 `garden compose`:
|
|
335
116
|
|
|
336
117
|
- `{@body const [n, setN] = DIL.useState(3)}` 声明状态
|
|
337
118
|
- `{@body const total = n * 24}` 派生值
|
|
@@ -339,7 +120,7 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
339
120
|
- `{#if …}{:else}{/if}`、`{#each … as item, i}{/each}` 控制流
|
|
340
121
|
- 小写控件:`<slider>`、`<choice>`、`<button>`、`<pie>` / `<chart>`、`<stat>`
|
|
341
122
|
|
|
342
|
-
旧的 `garden interactive` 与 PascalCase
|
|
123
|
+
旧的 `garden interactive` 与 PascalCase 仅作兼容。完整映射见仓库 `docs/compose-dil.md`。
|
|
343
124
|
|
|
344
125
|
```garden compose #compose-play-demo
|
|
345
126
|
caption: 拧一下席位,看月费。
|
|
@@ -351,4 +132,3 @@ intent: |
|
|
|
351
132
|
<slider min={1} max={12} value={seats} onChange={setSeats} label="席位" />
|
|
352
133
|
<stat label="月费" value={total} unit="USD" />
|
|
353
134
|
```
|
|
354
|
-
|