@iniesta8888/agent-live 0.3.0

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.
Files changed (182) hide show
  1. package/CODE_OF_CONDUCT.md +7 -0
  2. package/CONTRIBUTING.md +56 -0
  3. package/LICENSE +21 -0
  4. package/README.md +92 -0
  5. package/SECURITY.md +13 -0
  6. package/dist/adapter-sdk/index.d.ts +45 -0
  7. package/dist/adapter-sdk/index.d.ts.map +1 -0
  8. package/dist/adapter-sdk/index.js +106 -0
  9. package/dist/adapter-sdk/index.js.map +1 -0
  10. package/dist/content/compiler.d.ts +31 -0
  11. package/dist/content/compiler.d.ts.map +1 -0
  12. package/dist/content/compiler.js +218 -0
  13. package/dist/content/compiler.js.map +1 -0
  14. package/dist/content/graph-validator.d.ts +56 -0
  15. package/dist/content/graph-validator.d.ts.map +1 -0
  16. package/dist/content/graph-validator.js +226 -0
  17. package/dist/content/graph-validator.js.map +1 -0
  18. package/dist/content/library.d.ts +4 -0
  19. package/dist/content/library.d.ts.map +1 -0
  20. package/dist/content/library.js +45 -0
  21. package/dist/content/library.js.map +1 -0
  22. package/dist/content/registry.d.ts +34 -0
  23. package/dist/content/registry.d.ts.map +1 -0
  24. package/dist/content/registry.js +130 -0
  25. package/dist/content/registry.js.map +1 -0
  26. package/dist/content/runtime-content.d.ts +63 -0
  27. package/dist/content/runtime-content.d.ts.map +1 -0
  28. package/dist/content/runtime-content.js +78 -0
  29. package/dist/content/runtime-content.js.map +1 -0
  30. package/dist/content/schema.d.ts +142 -0
  31. package/dist/content/schema.d.ts.map +1 -0
  32. package/dist/content/schema.js +280 -0
  33. package/dist/content/schema.js.map +1 -0
  34. package/dist/content/validator.d.ts +35 -0
  35. package/dist/content/validator.d.ts.map +1 -0
  36. package/dist/content/validator.js +205 -0
  37. package/dist/content/validator.js.map +1 -0
  38. package/dist/core/agents.d.ts +56 -0
  39. package/dist/core/agents.d.ts.map +1 -0
  40. package/dist/core/agents.js +148 -0
  41. package/dist/core/agents.js.map +1 -0
  42. package/dist/core/limits.d.ts +15 -0
  43. package/dist/core/limits.d.ts.map +1 -0
  44. package/dist/core/limits.js +16 -0
  45. package/dist/core/limits.js.map +1 -0
  46. package/dist/core/mapping.d.ts +17 -0
  47. package/dist/core/mapping.d.ts.map +1 -0
  48. package/dist/core/mapping.js +94 -0
  49. package/dist/core/mapping.js.map +1 -0
  50. package/dist/core/protocol.d.ts +105 -0
  51. package/dist/core/protocol.d.ts.map +1 -0
  52. package/dist/core/protocol.js +6 -0
  53. package/dist/core/protocol.js.map +1 -0
  54. package/dist/core/state.d.ts +49 -0
  55. package/dist/core/state.d.ts.map +1 -0
  56. package/dist/core/state.js +216 -0
  57. package/dist/core/state.js.map +1 -0
  58. package/dist/creator/commands.d.ts +19 -0
  59. package/dist/creator/commands.d.ts.map +1 -0
  60. package/dist/creator/commands.js +44 -0
  61. package/dist/creator/commands.js.map +1 -0
  62. package/dist/creator/mode.d.ts +10 -0
  63. package/dist/creator/mode.d.ts.map +1 -0
  64. package/dist/creator/mode.js +23 -0
  65. package/dist/creator/mode.js.map +1 -0
  66. package/dist/creator/service.d.ts +199 -0
  67. package/dist/creator/service.d.ts.map +1 -0
  68. package/dist/creator/service.js +159 -0
  69. package/dist/creator/service.js.map +1 -0
  70. package/dist/index.d.ts +14 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +10 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/runtime/agent-live-runtime.d.ts +17 -0
  75. package/dist/runtime/agent-live-runtime.d.ts.map +1 -0
  76. package/dist/runtime/agent-live-runtime.js +50 -0
  77. package/dist/runtime/agent-live-runtime.js.map +1 -0
  78. package/dist/runtime/content-service.d.ts +75 -0
  79. package/dist/runtime/content-service.d.ts.map +1 -0
  80. package/dist/runtime/content-service.js +60 -0
  81. package/dist/runtime/content-service.js.map +1 -0
  82. package/dist/runtime/resource-guard.d.ts +17 -0
  83. package/dist/runtime/resource-guard.d.ts.map +1 -0
  84. package/dist/runtime/resource-guard.js +54 -0
  85. package/dist/runtime/resource-guard.js.map +1 -0
  86. package/dist/runtime/server.d.ts +39 -0
  87. package/dist/runtime/server.d.ts.map +1 -0
  88. package/dist/runtime/server.js +286 -0
  89. package/dist/runtime/server.js.map +1 -0
  90. package/dist/web/app.d.ts +1 -0
  91. package/dist/web/app.js +1317 -0
  92. package/dist/web/index.html +45 -0
  93. package/dist/web/office.js +350 -0
  94. package/dist/web/sprites.js +185 -0
  95. package/dist/web/style.css +288 -0
  96. package/dist/web/v2/bootstrap.js +276 -0
  97. package/dist/web/v2/content/README.md +17 -0
  98. package/dist/web/v2/content/agent-skins/studio-team.json +33 -0
  99. package/dist/web/v2/content/agent-skins/tiny-developers.json +33 -0
  100. package/dist/web/v2/content/atmospheres/default.json +13 -0
  101. package/dist/web/v2/content/atmospheres/rainy-night.json +37 -0
  102. package/dist/web/v2/content/catalog.json +14 -0
  103. package/dist/web/v2/content/component-library/activity-implementations.json +873 -0
  104. package/dist/web/v2/content/component-library/activity-recipes.json +25 -0
  105. package/dist/web/v2/content/component-library/agent-profile-templates.json +18 -0
  106. package/dist/web/v2/content/component-library/catalog.json +38 -0
  107. package/dist/web/v2/content/component-library/npc-templates.json +42 -0
  108. package/dist/web/v2/content/component-library/props.json +41 -0
  109. package/dist/web/v2/content/environments/local-office.json +31 -0
  110. package/dist/web/v2/content/environments/rainy-night.json +28 -0
  111. package/dist/web/v2/content/environments/static-office.json +27 -0
  112. package/dist/web/v2/content/layouts/boardroom-office.json +122 -0
  113. package/dist/web/v2/content/layouts/demo-office.json +88 -0
  114. package/dist/web/v2/content/layouts/lively-office.json +96 -0
  115. package/dist/web/v2/content/layouts/old-school-office.json +154 -0
  116. package/dist/web/v2/content/layouts/tech-open-office.json +132 -0
  117. package/dist/web/v2/content/life-activities/boardroom-routines.json +67 -0
  118. package/dist/web/v2/content/life-activities/none.json +10 -0
  119. package/dist/web/v2/content/life-activities/office-basics.json +39 -0
  120. package/dist/web/v2/content/life-activities/old-school-routines.json +74 -0
  121. package/dist/web/v2/content/life-activities/tech-office-routines.json +148 -0
  122. package/dist/web/v2/content/npcs/boardroom-staff.json +54 -0
  123. package/dist/web/v2/content/npcs/none.json +10 -0
  124. package/dist/web/v2/content/npcs/office-staff.json +25 -0
  125. package/dist/web/v2/content/npcs/old-school-staff.json +39 -0
  126. package/dist/web/v2/content/npcs/tech-office-staff.json +40 -0
  127. package/dist/web/v2/content/official-offices/boardroom-office.json +25 -0
  128. package/dist/web/v2/content/official-offices/old-school-office.json +25 -0
  129. package/dist/web/v2/content/official-offices/tech-open-office.json +25 -0
  130. package/dist/web/v2/content/presets/boardroom-office.json +21 -0
  131. package/dist/web/v2/content/presets/cozy-studio.json +19 -0
  132. package/dist/web/v2/content/presets/demo-office.json +19 -0
  133. package/dist/web/v2/content/presets/lively-office.json +19 -0
  134. package/dist/web/v2/content/presets/night-shift.json +19 -0
  135. package/dist/web/v2/content/presets/old-school-office.json +20 -0
  136. package/dist/web/v2/content/presets/refined-demo.json +20 -0
  137. package/dist/web/v2/content/presets/tech-open-office.json +21 -0
  138. package/dist/web/v2/content/props/default-office.json +23 -0
  139. package/dist/web/v2/content/props/extended-office.json +39 -0
  140. package/dist/web/v2/content/props/tech-office.json +28 -0
  141. package/dist/web/v2/content/styles/pixel-classic.json +160 -0
  142. package/dist/web/v2/content/styles/warm-studio.json +150 -0
  143. package/dist/web/v2/environment-runtime.d.ts +1 -0
  144. package/dist/web/v2/environment-runtime.js +138 -0
  145. package/dist/web/v2/graph-validator.d.ts +55 -0
  146. package/dist/web/v2/graph-validator.js +225 -0
  147. package/dist/web/v2/i18n.js +54 -0
  148. package/dist/web/v2/locales/en.json +209 -0
  149. package/dist/web/v2/locales/zh-CN.json +52 -0
  150. package/dist/web/v2/office-engine.d.ts +1 -0
  151. package/dist/web/v2/office-engine.js +145 -0
  152. package/dist/web/v2/office-renderer.d.ts +1 -0
  153. package/dist/web/v2/office-renderer.js +843 -0
  154. package/dist/web/v2/parity.html +10 -0
  155. package/dist/web/v2/parity.js +82 -0
  156. package/dist/web/v2/sprite-renderer.d.ts +1 -0
  157. package/dist/web/v2/sprite-renderer.js +242 -0
  158. package/dist/web/v2/static-content.js +48 -0
  159. package/dist/web/v2/style.css +140 -0
  160. package/dist/web/v2.html +68 -0
  161. package/docs/ADAPTER-DEVELOPMENT.md +328 -0
  162. package/docs/ADAPTER-SDK.md +109 -0
  163. package/docs/ARCHITECTURE.md +223 -0
  164. package/docs/COMPONENT-LIBRARY.md +212 -0
  165. package/docs/CUSTOMIZATION.md +163 -0
  166. package/docs/DEVELOPER.md +186 -0
  167. package/docs/DSH-ADAPTER-DESIGN.md +173 -0
  168. package/docs/OFFICE-THEMES.md +516 -0
  169. package/docs/PRESET-CONFIG.md +460 -0
  170. package/docs/RELEASE-CHECK.md +23 -0
  171. package/docs/TECHNICAL.md +515 -0
  172. package/docs/USING-CODEX.md +24 -0
  173. package/docs/USING-DSH.md +44 -0
  174. package/docs/USING-PI.md +50 -0
  175. package/docs/VISION.md +146 -0
  176. package/examples/adapter/local-office.mjs +52 -0
  177. package/package.json +89 -0
  178. package/skills/agent-live-adapter-builder/SKILL.md +30 -0
  179. package/skills/agent-live-adapter-builder/agents/openai.yaml +4 -0
  180. package/skills/agent-live-adapter-builder/references/investigation.md +9 -0
  181. package/skills/agent-live-adapter-builder/references/review.md +7 -0
  182. package/skills/agent-live-adapter-builder/scripts/create-adapter.mjs +26 -0
@@ -0,0 +1,460 @@
1
+ # Office Preset 配置手册
2
+
3
+ > 面向直接修改本地内容的开发者 · 2026-09-07
4
+
5
+ 本手册记录浏览器兼容层仍可读取的打包配置格式,用于源码维护、官方内容制作和冻结 Demo 回归,不是普通用户的配置入口。主线内容架构已经统一为 [基础组件库](COMPONENT-LIBRARY.md) 与 Office Spec;普通用户只能选择官方 Preset,自然语言创作必须通过受约束的 Creator 流程,并遵守 [自定义能力边界](CUSTOMIZATION.md)。
6
+
7
+ ## 1. 配置在哪里
8
+
9
+ 所有内容都在 `plugins/agent-live/web/v2/content/`,不依赖后端服务:
10
+
11
+ ```text
12
+ plugins/agent-live/web/v2/content/
13
+ ├── catalog.json # 顶部选择器中显示哪些 Preset
14
+ ├── presets/ # Preset:只负责组合其他模块
15
+ ├── styles/ # 整体美术风格与 UI / Canvas tokens
16
+ ├── layouts/ # 房间、座位、通道、物件实例和行为目标点
17
+ ├── agent-skins/ # 真实 Agent 的外观和职位配色
18
+ ├── props/ # 可用物件类型及能力
19
+ ├── npcs/ # NPC 身份、外观和出生点
20
+ ├── life-activities/ # Agent / NPC 的本地生活行为
21
+ ├── atmospheres/ # 环境的视觉覆盖、特效和声音
22
+ └── environments/ # 时钟、天气输入、灯光和 NPC 班次
23
+ ```
24
+
25
+ 修改配置后刷新页面即可生效。开发服务不会缓存这些 JSON。
26
+
27
+ ## 2. 最安全的新建方式
28
+
29
+ 不要直接覆盖 `demo-office`。它是原版的逐像素回归基准。
30
+
31
+ 新建一个 Preset 时:
32
+
33
+ 1. 复制最接近的现有模块,只修改真正需要变化的部分。
34
+ 2. 在 `presets/` 新建组合文件,例如 `my-office.json`。
35
+ 3. 在 `catalog.json` 登记它,让顶部选择器可以看到。
36
+ 4. 执行 `npm run validate:content`。
37
+ 5. 打开 `/v2.html?demo=1&preset=my-office` 预览。
38
+
39
+ 默认端口是 7788;被占用时会自动顺延,以终端实际输出为准。
40
+
41
+ ## 3. 当前 Preset 组合
42
+
43
+ | 文件名 / URL 参数 | Style | Layout | Agent Skin | NPC | Life | Atmosphere | Environment |
44
+ | --- | --- | --- | --- | --- | --- | --- | --- |
45
+ | `tech-open-office` | `pixel-classic` | `tech-open-office` | `tiny-developers` | `tech-office-staff` | `tech-office-routines` | `default` | `local-office` |
46
+ | `boardroom-office` | `pixel-classic` | `boardroom-office` | `tiny-developers` | `boardroom-staff` | `boardroom-routines` | `default` | `local-office` |
47
+ | `old-school-office` | `warm-studio` | `old-school-office` | `studio-team` | `old-school-staff` | `old-school-routines` | `default` | `local-office` |
48
+ | `refined-demo` | `pixel-classic` | `demo-office` | `tiny-developers` | `none` | `none` | `default` | `static-office` |
49
+ | `demo-office` | `pixel-classic` | `demo-office` | `tiny-developers` | `none` | `none` | `default` | `static-office` |
50
+ | `lively-office` | `pixel-classic` | `lively-office` | `tiny-developers` | `office-staff` | `office-basics` | `default` | `static-office` |
51
+ | `night-shift` | `pixel-classic` | `lively-office` | `tiny-developers` | `office-staff` | `office-basics` | `rainy-night` | `rainy-night` |
52
+ | `cozy-studio` | `warm-studio` | `lively-office` | `studio-team` | `office-staff` | `office-basics` | `default` | `static-office` |
53
+
54
+ 前三项是顶部选择器中的正式 Preset,其余五项只用于历史原型与回归验证。
55
+
56
+ 这些组合说明了两种常用方式:
57
+
58
+ - Atmosphere 控制雨夜的视觉覆盖,Environment 控制固定 22:00、降雨输入和 NPC 班次。
59
+ - 同时换 Style 和 Agent Skin:`lively-office` → `cozy-studio`。
60
+ - 换掉整个空间组织:`old-school-office` 使用格子间、经理室、档案 / 复印区与机房;`boardroom-office` 把一张长会议桌变成全部 Agent 的固定工作现场。
61
+
62
+ ## 4. Preset:组合入口
63
+
64
+ 文件位置:`plugins/agent-live/web/v2/content/presets/<文件名>.json`
65
+
66
+ ```json
67
+ {
68
+ "schemaVersion": 1,
69
+ "kind": "preset",
70
+ "id": "builtin/my-office",
71
+ "name": "我的办公室",
72
+ "version": "1.0.0",
73
+ "engine": { "min": "0.2.0" },
74
+ "contract": "single-office-v1",
75
+ "content": {
76
+ "style": "pixel-classic",
77
+ "layout": "lively-office",
78
+ "agentSkin": "tiny-developers",
79
+ "props": "default-office",
80
+ "npcs": "office-staff",
81
+ "lifeActivities": "office-basics",
82
+ "atmosphere": "default",
83
+ "environment": "local-office"
84
+ }
85
+ }
86
+ ```
87
+
88
+ `content` 中填写的是对应 JSON 的**文件名,不带 `.json`**。文件内部的 `id` 是稳定内容 ID,两者含义不同。
89
+
90
+ 把新 Preset 加到 `catalog.json`:
91
+
92
+ ```json
93
+ {
94
+ "id": "my-office",
95
+ "name": "我的办公室"
96
+ }
97
+ ```
98
+
99
+ `catalog.json` 的顺序就是顶部选择器的显示顺序。
100
+
101
+ ## 5. Style:整体美术风格
102
+
103
+ 文件位置:`plugins/agent-live/web/v2/content/styles/`
104
+
105
+ Style 当前分为四组 token:
106
+
107
+ ```json
108
+ {
109
+ "tokens": {
110
+ "css": {},
111
+ "canvas": {},
112
+ "character": {
113
+ "pips": {},
114
+ "particles": {}
115
+ },
116
+ "motion": {}
117
+ }
118
+ }
119
+ ```
120
+
121
+ - `css`:页面背景、侧栏、边框、文字、强调色和状态色。
122
+ - `canvas`:地板、墙面、家具、屏幕、植物、饮水机等场景颜色。
123
+ - `character`:人物基础颜色、状态灯和粒子颜色。
124
+ - `motion`:预留的移动与气泡节奏配置。
125
+
126
+ 当前 Style 不支持 `extends`。新建 Style 时应复制完整的 `pixel-classic.json` 或 `warm-studio.json` 再改颜色,避免遗漏 renderer 使用的 token。
127
+
128
+ Style 只改变“怎么画”,不要在这里放座位、坐标、NPC 或行为规则。
129
+
130
+ ## 6. Layout:办公室空间(内容作者概念)
131
+
132
+ 文件位置:`plugins/agent-live/web/v2/content/layouts/`
133
+
134
+ Layout 描述房间的几何:画布、座位、导航通道、走位目标点、工作能力工位、道具槽位和 NPC 出生点。它是**内容作者的概念**——用户和 Creator 都不选择、也不更换它。一个 Office 自带房间;想换房间就是换一个 Preset Office(`/agent-live preset <number or name>`),或者编辑那个 Preset Office 得到一份内容完整继承的副本。
135
+
136
+ 第一版必须遵守 `single-office-v1`:
137
+
138
+ - 逻辑画布固定为 384×216。
139
+ - 固定单层俯视、全办公室同屏。
140
+ - 保留 8 个可分配座位。
141
+ - 所有目标点必须能通过横向通道和纵向连接到达。
142
+ - 必须提供 `research/create/compute/plan/communicate/collaborate` 六种工作能力。
143
+
144
+ 核心结构:
145
+
146
+ ```json
147
+ {
148
+ "navigation": {
149
+ "lanes": [46, 100, 162],
150
+ "connectors": [76, 140, 204, 276]
151
+ },
152
+ "seats": [],
153
+ "targets": {
154
+ "water": { "x": 338, "y": 190, "dir": "right", "lane": 2 }
155
+ },
156
+ "stations": {
157
+ "research": { "kind": "target", "target": "archive" },
158
+ "create": { "kind": "seat" }
159
+ },
160
+ "propInstances": [
161
+ { "id": "water-main", "type": "water-cooler", "x": 346, "y": 172 }
162
+ ]
163
+ }
164
+ ```
165
+
166
+ 注意:
167
+
168
+ - `lane` 是 `navigation.lanes` 的数组下标,不是实际 y 坐标。
169
+ - `targets` 是角色站立的位置,不是家具左上角坐标。
170
+ - `dir` 可用 `up/down/left/right`,表示到达后的朝向。
171
+ - `propInstances[].type` 必须存在于当前 Props registry。
172
+ - `propInstances[].id` 在同一个 Layout 内必须唯一。
173
+ - 新增 NPC 时,其 `spawn` 也必须是这里已有的 target。
174
+ - Life Activity 的每一个 step 同样只能引用这里已有的 target。
175
+ - `seats[].renderer` 可选;省略时是标准 `workstation`。内置扩展布局还使用 `cubicle-workstation`、`executive-seat` 和 `boardroom-seat`,让座位能够面向不同方向并贴合对应家具。
176
+
177
+ 当前内置 Layout:
178
+
179
+ | Layout | 空间结构 | 座位组织 | 主要工作映射 |
180
+ | --- | --- | --- | --- |
181
+ | `demo-office` | 原版单层办公室 | 两排独立工位 | 档案柜、服务器、白板、电话桌、会议桌 |
182
+ | `lively-office` | 原版空间的生活化版本 | 两排独立工位 | 增加饮水、保洁与会议区生活目标点 |
183
+ | `old-school-office` | 格子间 + 经理室 + 正式会议室 + 后勤区 | 6 个格子间、1 个经理席、1 个会议席 | 档案 / 复印、机房、会议白板、前台电话 |
184
+ | `boardroom-office` | 一间大会议室 | 8 个两侧席,老板 NPC 在桌首 | Agent 坐席工作、老板统一指挥、会务沿桌外服务 |
185
+
186
+ ## 7. Props:物件类型
187
+
188
+ 文件位置:`plugins/agent-live/web/v2/content/props/`
189
+
190
+ ```json
191
+ {
192
+ "types": {
193
+ "water-cooler": {
194
+ "size": { "width": 16, "height": 26 },
195
+ "capabilities": ["water"],
196
+ "renderer": "water-cooler"
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ - `size`:默认绘制尺寸。
203
+ - `capabilities`:该物件能承载的行为,例如 `research`、`compute`、`water`。
204
+ - `renderer`:`office-renderer.js` 中已有的绘制类型。
205
+
206
+ 只增加同类型物件实例时,修改 Layout 即可。增加全新的 `renderer` 名称时,还必须在 `plugins/agent-live/web/v2/office-renderer.js` 实现一次画法。
207
+
208
+ 当前已有 renderer:
209
+
210
+ ```text
211
+ rug, door, window, workstation, whiteboard, phone-table,
212
+ archive-cabinet, server-rack, coffee-machine, water-cooler,
213
+ meeting-table, plant, venetian-window, cubicle-cell,
214
+ executive-desk, copy-station, reception-desk, presentation-screen,
215
+ boardroom-table, av-console, sideboard, vending-machine,
216
+ office-clock, service-cart,
217
+ notice-board, wall-calendar, coat-rack, floor-fan,
218
+ lounge-sofa, dumbbell, restroom-door, boss-desk
219
+ ```
220
+
221
+ `default-office.json` 只包含原版物件;`extended-office.json` 在保留这些物件的同时加入格子间、老派后勤设施和长桌会议室所需的 renderer。新布局若引用这些扩展物件,Preset 的 `props` 必须选择 `extended-office`。
222
+
223
+ ## 8. Agent Skin:真实 Agent 外观
224
+
225
+ 文件位置:`plugins/agent-live/web/v2/content/agent-skins/`
226
+
227
+ ```json
228
+ {
229
+ "animations": ["idle", "walk", "sit", "type", "reach", "talk"],
230
+ "palettes": {
231
+ "skin": ["#f0cba3"],
232
+ "hair": ["#2f2418"],
233
+ "fallbackShirts": ["#4a78c8"],
234
+ "defaultTrim": "#2b3242",
235
+ "leadBadge": "#ffcc4d",
236
+ "agentBadge": "#8fb8ff"
237
+ },
238
+ "roles": {
239
+ "planner": {
240
+ "title": "规划师",
241
+ "shirt": "#4a78c8",
242
+ "trim": "#33569a"
243
+ }
244
+ }
245
+ }
246
+ ```
247
+
248
+ `roles` 的 key 按宿主传入的 Agent 名称小写匹配。没有匹配项时使用 `fallbackShirts` 稳定生成外观。
249
+
250
+ 当前 renderer 是程序化像素人物。只改颜色和职位不需要改代码;要换成人物图片或增加新的骨骼/帧动画,需要扩展 `sprite-renderer.js`。
251
+
252
+ ## 9. NPC:办公室角色
253
+
254
+ 文件位置:`plugins/agent-live/web/v2/content/npcs/`
255
+
256
+ ```json
257
+ {
258
+ "entries": [
259
+ {
260
+ "id": "cleaner-lin",
261
+ "name": "林姨",
262
+ "role": "cleaner",
263
+ "title": "保洁",
264
+ "spawn": "cleaner-entry",
265
+ "appearance": {
266
+ "skin": "#d69f70",
267
+ "hair": "#30333b",
268
+ "shirt": "#4f9d88",
269
+ "trim": "#347264",
270
+ "badge": "#b7eadb"
271
+ }
272
+ }
273
+ ]
274
+ }
275
+ ```
276
+
277
+ - `id` 必须唯一。
278
+ - `spawn` 引用 Layout target。
279
+ - `role` 用于匹配 Life Activity 的参与者。
280
+ - `appearance` 可直接覆盖程序化人物的 palette。
281
+ - `shift` 可覆盖 Environment 中按角色或全局定义的班次,例如 `{ "start": "20:00", "end": "08:00" }`。
282
+
283
+ NPC 只存在于本地办公室,不会进入真实 Agent、工具、任务、Token 或成本统计。
284
+
285
+ ## 10. Life Activities:办公室生活
286
+
287
+ 文件位置:`plugins/agent-live/web/v2/content/life-activities/`
288
+
289
+ Agent 接水示例:
290
+
291
+ ```json
292
+ {
293
+ "id": "get-water",
294
+ "name": "接水",
295
+ "participant": { "kind": "agent", "states": ["idle"] },
296
+ "requires": [{ "capability": "water" }],
297
+ "onlyWhenSessionIdle": true,
298
+ "interruptible": true,
299
+ "startBubble": "去接杯水",
300
+ "initialDelayMs": [4500, 7500],
301
+ "cooldownMs": [22000, 36000],
302
+ "steps": [
303
+ {
304
+ "target": "water",
305
+ "durationMs": 3200,
306
+ "pose": "stand",
307
+ "bubble": "接杯水,歇一下",
308
+ "hot": "water"
309
+ }
310
+ ]
311
+ }
312
+ ```
313
+
314
+ NPC 多步骤巡检示例:
315
+
316
+ ```json
317
+ {
318
+ "participant": { "kind": "npc", "roles": ["cleaner"] },
319
+ "steps": [
320
+ { "target": "clean-north", "durationMs": 2300, "pose": "reach", "bubble": "擦擦桌面", "particle": "spark" },
321
+ { "target": "clean-south", "durationMs": 2600, "pose": "reach", "bubble": "这边也收拾一下", "particle": "spark" }
322
+ ]
323
+ }
324
+ ```
325
+
326
+ 字段说明:
327
+
328
+ - `participant.kind`:`agent` 或 `npc`。
329
+ - `states`:允许参与的真实 Agent 状态;生活行为建议只使用 `idle`。
330
+ - `roles`:允许参与的 NPC role。
331
+ - `requires`:活动需要的道具依赖,两种写法都合法,**内置实现默认用能力需求**。
332
+ - 能力需求:`{ "capability": "water" }` —— 由编译器解析成当前办公室中第一个提供该能力的道具(Layout 里的实例在前,Office Spec 新加的放置在后),跨 Layout 复用同一份实现,也让"把水冷机换成没有 water 能力的道具"变成明确的校验失败而不是静默失效。取水、接咖啡、白板、复印、会议室、出口门(`entry`)和洗手间门(`restroom`)都用这一种;道具能力以 `component-library/props.json` 的 `capabilities` 为准。
333
+ - 具名实例:`"water-main"` 或 `{ "prop": "water-main" }` —— 绑定到指定的 Prop Instance ID,只在房间里有多个同类道具、必须固定用某一个时才需要(例如三台水冷机只允许用靠门那台);该实例改名或被删掉,活动就会失效。
334
+ - 两种写法的解析结果都会记录在编译产物的 `bindings` 里,排查"到底绑到了哪一台"时看它。
335
+ - 能力需求只决定"这个活动能不能在当前办公室跑",**人走到哪仍由布局的 `targets` 决定**(作者手写的站位)。所以提供该能力的道具必须放在布局为这个能力准备的槽位里 —— 也就是布局中那台内置道具所在的 `placementSlots`;可以**原地换同类**(换新 id 也行,只要槽位不变),但不能挪到别的槽位,否则活动照旧走旧位置。这条由校验器拦下(`capability-prop-slot`)。
336
+ - `onlyWhenSessionIdle`:整个真实会话空闲时才允许开始。
337
+ - `interruptible`:是否允许工作事件打断;Agent Life 必须设置为 `true`。
338
+ - `initialDelayMs` / `cooldownMs`:可以是固定数字,也可以是 `[最小值, 最大值]`。
339
+ - `steps`:按顺序执行的目标点与停留动作。
340
+ - `pose`:当前支持 `stand/reach/talk/sit/type/phone`。
341
+ - `hot`:让对应设施进入工作动画状态,例如饮水机使用 `water`。
342
+ - `particle`:当前可使用 `key/paper/spark/check/cross/bang`。
343
+
344
+ Life Activity 只产生画面行为和绿色生活气泡,不写入动态日志,也不改变真实 Token、成本或工具统计。新的 Work Event 会优先抢占 Agent 的生活行为。
345
+
346
+ ## 11. Environment:公共运行环境
347
+
348
+ 文件位置:`plugins/agent-live/web/v2/content/environments/`
349
+
350
+ Environment 统一管理所有 Preset 都会用到的运行规则:
351
+
352
+ - `clock.mode`:`local` 使用用户本地时间,`fixed` 使用 `fixedTime`。
353
+ - `clock.phases`:定义上午、中午、傍晚和夜晚的边界。
354
+ - `clock.preview`:演示模式是否压缩播放一天。
355
+ - `weather`:天气来源、默认条件和允许值。
356
+ - `lighting`:哪些时间阶段开启室内灯光。
357
+ - `npcSchedule`:NPC 默认班次、按角色覆盖和上下班气泡。
358
+
359
+ 正式三个 Preset 共用 `local-office.json`,所以修改一次即可统一调整时间、天气和 06:00–18:00 的 NPC 作息。优先级为:单个 NPC `shift` > `roleOverrides` > `defaultShift`。
360
+
361
+ 外部天气由宿主传入,核心不会自行联网:
362
+
363
+ ```text
364
+ /v2.html?preset=tech-open-office&weather=rain&time=19:00
365
+ ```
366
+
367
+ ```js
368
+ window.OfficeEnvironment.update({ weather: "snow" });
369
+ window.dispatchEvent(new CustomEvent("agent-live:environment", {
370
+ detail: { weather: "cloudy" }
371
+ }));
372
+ ```
373
+
374
+ 支持 `clear/cloudy/rain/snow`。详细接入方式见 [开发者接入指南](DEVELOPER.md)。
375
+
376
+ ## 12. Atmosphere:环境视觉
377
+
378
+ 文件位置:`plugins/agent-live/web/v2/content/atmospheres/`
379
+
380
+ ```json
381
+ {
382
+ "styleOverrides": {
383
+ "css": {
384
+ "bg": "#070a12",
385
+ "panel": "#101724"
386
+ },
387
+ "canvas": {
388
+ "floorA": "#202c3a",
389
+ "glass": "#254867",
390
+ "rain": "#8bc8f2"
391
+ },
392
+ "character": {}
393
+ },
394
+ "windowScene": "rainy-night",
395
+ "ambientEffects": ["rain-window"],
396
+ "audio": null
397
+ }
398
+ ```
399
+
400
+ Atmosphere 是对 Style 的局部覆盖,所以不需要复制完整 token。它回答“雨夜画成什么颜色”,Environment 回答“现在是不是雨夜”。当前窗口天气已支持晴、阴、雨、雪;新的视觉表现仍需先在 renderer 中实现。
401
+
402
+ ## 13. 哪些只改配置,哪些需要代码
403
+
404
+ | 修改内容 | 只改 JSON | 需要扩展代码 |
405
+ | --- | --- | --- |
406
+ | 调整颜色、职位配色和状态色 | 是 | 否 |
407
+ | 移动物件、目标点、NPC 出生点 | 是 | 否 |
408
+ | 添加已有类型的家具 | 是 | 否 |
409
+ | 添加使用现有人物画法的 NPC | 是 | 否 |
410
+ | 组合已有模块成为新 Preset | 是 | 否 |
411
+ | 修改时间阶段、天气输入、灯光和 NPC 班次 | 是 | 否 |
412
+ | 编排已有 pose / particle 的生活行为 | 是 | 否 |
413
+ | 新家具画法 | 声明部分 | `office-renderer.js` |
414
+ | 新人物动画或图片角色 | 声明部分 | `sprite-renderer.js` |
415
+ | 新 Life step 类型或交互机制 | 声明部分 | `app.js` Runtime |
416
+ | 新天气特效或声音系统 | 声明部分 | renderer / Runtime |
417
+ | 新真实工作语义 | 否 | protocol、mapping、Runtime 与内容共同修改 |
418
+
419
+ 判断标准:**配置负责组合和参数,renderer / Runtime 负责系统尚未具备的能力。**
420
+
421
+ ## 14. 校验与预览
422
+
423
+ 修改完先运行:
424
+
425
+ ```bash
426
+ npm run validate:content
427
+ npm run validate:environment
428
+ npm run check
429
+ ```
430
+
431
+ 校验会检查:
432
+
433
+ - Catalog 是否包含所有 Preset。
434
+ - 八类引用文件是否存在,manifest 是否正确。
435
+ - Layout 是否满足 `single-office-v1`。
436
+ - 座位、工作能力、Target 和 Prop 引用是否有效。
437
+ - NPC 的出生点是否存在。
438
+ - Life Activity 所需物件和步骤目标是否存在。
439
+ - Environment 的时间模式、天气条件和默认 NPC 班次是否完整。
440
+ - `demo-office` 是否仍保持无 NPC、无 Life Activity 的基准合同。
441
+
442
+ 启动预览:
443
+
444
+ ```bash
445
+ npm run preview
446
+ ```
447
+
448
+ 浏览器地址:
449
+
450
+ ```text
451
+ http://localhost:7788/v2.html?demo=1&preset=my-office
452
+ ```
453
+
454
+ 原版像素回归页:
455
+
456
+ ```text
457
+ http://localhost:7788/v2/parity.html
458
+ ```
459
+
460
+ 只有 `PASS 15 pixel parity cases` 时,才说明 `demo-office` 的原版画面没有被新配置影响。
@@ -0,0 +1,23 @@
1
+ # Release verification
2
+
3
+ The current development target is 0.3.0, not a published release. Keep CHANGELOG marked Unreleased until the release is actually cut.
4
+
5
+ Run npm run check:ci for deterministic contract, types, builds and package validation. Run npm run test:integration:codex separately on a machine with a configured Codex CLI; it creates an ephemeral test thread and the session test sends one small model request, so it is intentionally not a public-PR CI requirement. Failures must be recorded, not treated as an automatic pass.
6
+
7
+ Run `node scripts/browser-smoke.mjs` when Playwright and its Chromium browser are available. You may set PLAYWRIGHT_MODULE to an existing Playwright module file and BROWSER_EXECUTABLE to an existing Chrome binary. This optional check uses temporary data and an ephemeral local port, tests all three rooms with signage and extra furniture, verifies selection/reopen, and cleans up its browser and service. It never calls a model or changes a real user Office.
8
+
9
+ Set `CHECK_DSH_FRAME=1` after installing the DSH build dependencies to additionally build and test the real embedded frame with custom time, weather and NPC hours. This checks the bundled renderer in a browser without starting DSH; it does not replace the host installation tests below.
10
+
11
+ For each official host, record the host version and validate this user path before a release:
12
+
13
+ 1. Install from the intended distribution source into a disposable host profile.
14
+ 2. Open Agent Live and run a short task; verify the lead Agent, work events and completion.
15
+ 3. List Offices and select meetingroom; verify both the scene and Creator use it.
16
+ 4. Customize a name, add an NPC and plant, and set company/notice/slogan text. In Codex invoke the explicit customization Skill; in Pi/DSH use custom.
17
+ 5. Exit custom (Pi/DSH), then run an unrelated coding task.
18
+ 6. Reopen the viewer and start a new host session; verify the saved Office is selected and text remains.
19
+ 7. Delegate a task; verify the child appears and departs when complete.
20
+ 8. Close Agent Live's standalone viewer; verify its resources close. An embedded DSH view must not stop DSH.
21
+ 9. Disable/remove the plugin through the host; verify the host still starts.
22
+
23
+ After these checks pass, merge the reviewed branch, confirm repository visibility and install links, date the changelog and create the matching version tag. The tag workflow packs the Core, Pi Adapter and DSH Adapter into the GitHub Release; npm publication of those three packages is a separate decision. Codex is distributed only through the repository Marketplace.