@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,28 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "kind": "props",
4
+ "id": "builtin/tech-office",
5
+ "name": "Tech 开放式办公室物件",
6
+ "version": "1.0.0",
7
+ "engine": { "min": "0.2.0" },
8
+ "contract": "single-office-v1",
9
+ "types": {
10
+ "rug": { "size": { "width": 146, "height": 42 }, "capabilities": [], "renderer": "rug" },
11
+ "door": { "size": { "width": 36, "height": 30 }, "capabilities": ["entry"], "renderer": "door" },
12
+ "restroom-door": { "size": { "width": 28, "height": 30 }, "capabilities": ["restroom"], "renderer": "restroom-door" },
13
+ "window": { "size": { "width": 44, "height": 22 }, "capabilities": [], "renderer": "window" },
14
+ "office-clock": { "size": { "width": 14, "height": 14 }, "capabilities": [], "renderer": "office-clock" },
15
+ "boss-desk": { "size": { "width": 36, "height": 16 }, "capabilities": [], "renderer": "boss-desk" },
16
+ "lounge-sofa": { "size": { "width": 112, "height": 26 }, "capabilities": ["collaborate"], "renderer": "lounge-sofa" },
17
+ "dumbbell": { "size": { "width": 16, "height": 7 }, "capabilities": [], "renderer": "dumbbell" },
18
+ "workstation": { "size": { "width": 48, "height": 16 }, "capabilities": ["create", "research", "compute", "communicate"], "renderer": "workstation" },
19
+ "whiteboard": { "size": { "width": 72, "height": 26 }, "capabilities": ["plan"], "renderer": "whiteboard" },
20
+ "phone-table": { "size": { "width": 32, "height": 14 }, "capabilities": ["communicate"], "renderer": "phone-table" },
21
+ "archive-cabinet": { "size": { "width": 44, "height": 32 }, "capabilities": ["research"], "renderer": "archive-cabinet" },
22
+ "server-rack": { "size": { "width": 48, "height": 32 }, "capabilities": ["compute"], "renderer": "server-rack" },
23
+ "coffee-machine": { "size": { "width": 26, "height": 22 }, "capabilities": ["coffee"], "renderer": "coffee-machine" },
24
+ "water-cooler": { "size": { "width": 16, "height": 26 }, "capabilities": ["water"], "renderer": "water-cooler" },
25
+ "meeting-table": { "size": { "width": 112, "height": 26 }, "capabilities": ["collaborate"], "renderer": "meeting-table" },
26
+ "plant": { "size": { "width": 12, "height": 21 }, "capabilities": [], "renderer": "plant" }
27
+ }
28
+ }
@@ -0,0 +1,160 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "kind": "style",
4
+ "id": "builtin/pixel-classic",
5
+ "name": "经典像素",
6
+ "version": "1.0.0",
7
+ "engine": { "min": "0.2.0" },
8
+ "contract": "office-2d-style-v1",
9
+ "tokens": {
10
+ "css": {
11
+ "bg": "#0d1017",
12
+ "panel": "#151a24",
13
+ "panel-2": "#1c2230",
14
+ "line": "#2a3243",
15
+ "ink": "#d7dee9",
16
+ "dim": "#7c8798",
17
+ "accent": "#ffcc4d",
18
+ "ok": "#6ee7a8",
19
+ "warn": "#ff8f6b",
20
+ "think": "#8fb8ff"
21
+ },
22
+ "canvas": {
23
+ "outline": "#171c25",
24
+ "objectShadow": "rgba(0,0,0,0.3)",
25
+ "floorA": "#2f3a45",
26
+ "floorB": "#334050",
27
+ "floorC": "#2b3542",
28
+ "floorLine": "#28313b",
29
+ "floorGrain": "#405066",
30
+ "rug": "#3a3150",
31
+ "rugEdge": "#4b3f63",
32
+ "wall": "#222b39",
33
+ "wallTop": "#1a222e",
34
+ "wallTrim": "#39455c",
35
+ "wallShade": "#1c2531",
36
+ "wallSeam": "#303b4d",
37
+ "wallHighlight": "#46546c",
38
+ "wallBase": "#151c26",
39
+ "wood": "#7d5b3a",
40
+ "woodDark": "#5d4229",
41
+ "woodGrain": "#b08659",
42
+ "deskTop": "#8d6a44",
43
+ "deskLite": "#a07d54",
44
+ "screen": "#0f1620",
45
+ "screenGlow": "#4a86e2",
46
+ "chair": "#43506b",
47
+ "chairLite": "#596986",
48
+ "chairDark": "#333d52",
49
+ "metal": "#57616f",
50
+ "metalDark": "#3f4854",
51
+ "rack": "#232b3a",
52
+ "board": "#dde3ec",
53
+ "boardFrame": "#8f9aab",
54
+ "glass": "#5f87a8",
55
+ "glassLite": "#7fa8c9",
56
+ "glassShine": "#a7d8f0",
57
+ "skyMorning": "#79a9c5",
58
+ "skyNoon": "#8bc7dc",
59
+ "skyEvening": "#c87863",
60
+ "skyNight": "#17243c",
61
+ "skyNightLite": "#243754",
62
+ "skyHorizon": "#e09a68",
63
+ "skySun": "#ffe09a",
64
+ "skyStar": "#f5dfa0",
65
+ "skyBuilding": "#111a2b",
66
+ "skyWindow": "#ffd26f",
67
+ "roomLightEvening": "rgba(255,220,150,0.07)",
68
+ "roomLightNight": "rgba(255,210,112,0.13)",
69
+ "plant": "#3f7d52",
70
+ "plantDark": "#2f5e3e",
71
+ "plantLite": "#579768",
72
+ "plantHighlight": "#78b283",
73
+ "pot": "#8a5a3c",
74
+ "paper": "#e8e2d0",
75
+ "door": "#6b4a2f",
76
+ "doorDark": "#4c3421",
77
+ "doorPanel": "#7d5738",
78
+ "doorLite": "#9d7048",
79
+ "windowSpark": "#ffe9a8",
80
+ "boardText": "#5f6b7d",
81
+ "boardTextDim": "#7f8b9d",
82
+ "boardIdle": "#a4aebd",
83
+ "activeRed": "#e2564a",
84
+ "activeBlue": "#4a86e2",
85
+ "activeGreen": "#4fd6a0",
86
+ "activeThink": "#8fb8ff",
87
+ "activeAccent": "#ffcc4d",
88
+ "screenIdle": "#2c3a4c",
89
+ "paperLine": "#c9c2ad",
90
+ "metalLite": "#697485",
91
+ "drawerLite": "#727d8e",
92
+ "drawerHandle": "#8b95a5",
93
+ "drawerOpen": "#2a323c",
94
+ "rackTrim": "#3a4557",
95
+ "rackPanel": "#1a212c",
96
+ "rackLine": "#2f3a49",
97
+ "signalOn": "#6ee7a8",
98
+ "signalOff": "#24513c",
99
+ "coffeePanel": "#1c2330",
100
+ "coffeeHot": "#c98a4b",
101
+ "coffeeIdle": "#2a3340",
102
+ "steam": "#8fa3b8",
103
+ "waterBody": "#d6dde8",
104
+ "waterDark": "#596779",
105
+ "waterGlass": "#91c9e8",
106
+ "waterLevel": "#57a9d6",
107
+ "waterActive": "#8fe3ff",
108
+ "rain": "#9ac7e8",
109
+ "phoneTop": "#96704a",
110
+ "phoneDevice": "#1f2735",
111
+ "phoneIdle": "#39455c",
112
+ "meetingPaper": "#cfd6e2",
113
+ "meetingDevice": "#4a5668",
114
+ "potLite": "#a06c48",
115
+ "keyboard": "#1f2735",
116
+ "keyboardKey": "#6d7a8d",
117
+ "mug": "#e2564a",
118
+ "mugLite": "#ff8f6b"
119
+ },
120
+ "character": {
121
+ "outline": "#151923",
122
+ "shadow": "rgba(0,0,0,0.28)",
123
+ "pants": "#2b3242",
124
+ "shoes": "#1b202b",
125
+ "shirtShade": "#252c3a",
126
+ "shirtLite": "rgba(255,255,255,0.2)",
127
+ "skinShade": "#b87964",
128
+ "hairLite": "rgba(255,255,255,0.18)",
129
+ "eyeLite": "#ffe9c9",
130
+ "faceInk": "#232a36",
131
+ "mouth": "#8d4a44",
132
+ "pips": {
133
+ "thinking": "#8fb8ff",
134
+ "working": "#ffcc4d",
135
+ "waiting": "#c79bff",
136
+ "talking": "#6ee7a8",
137
+ "done": "#6ee7a8",
138
+ "error": "#ff8f6b",
139
+ "idle": null
140
+ },
141
+ "particles": {
142
+ "key": "#8fb8ff",
143
+ "keyInset": "#0f1620",
144
+ "paper": "#e8e2d0",
145
+ "paperLine": "#b9b3a1",
146
+ "check": "#6ee7a8",
147
+ "bang": "#ffcc4d",
148
+ "cross": "#ff8f6b",
149
+ "spark": "#6ee7a8",
150
+ "fallback": "#d7dee9"
151
+ }
152
+ },
153
+ "motion": {
154
+ "actorSpeed": 44,
155
+ "bubbleThinkMs": 4200,
156
+ "bubbleSayMs": 6000,
157
+ "bubbleActionMs": 2800
158
+ }
159
+ }
160
+ }
@@ -0,0 +1,150 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "kind": "style",
4
+ "id": "builtin/warm-studio",
5
+ "name": "暖调创意工作室",
6
+ "version": "1.0.0",
7
+ "engine": { "min": "0.2.0" },
8
+ "contract": "office-2d-style-v1",
9
+ "tokens": {
10
+ "render": { "detail": "rich", "staticFloorCache": true },
11
+ "css": {
12
+ "bg": "#17110f",
13
+ "panel": "#241a17",
14
+ "panel-2": "#30231e",
15
+ "line": "#4d382f",
16
+ "ink": "#f1dfc2",
17
+ "dim": "#ad9277",
18
+ "accent": "#f2bd5b",
19
+ "ok": "#72c6a0",
20
+ "warn": "#ef8065",
21
+ "think": "#75b7c2"
22
+ },
23
+ "canvas": {
24
+ "outline": "#3b2a24",
25
+ "objectShadow": "rgba(55,31,24,0.28)",
26
+ "floorA": "#b99467",
27
+ "floorB": "#c19f72",
28
+ "floorC": "#ad895f",
29
+ "floorLine": "#a4815a",
30
+ "floorGrain": "#cba879",
31
+ "rug": "#6d4e58",
32
+ "rugEdge": "#8b6670",
33
+ "wall": "#e0cda9",
34
+ "wallTop": "#c9ae82",
35
+ "wallTrim": "#8b6b4d",
36
+ "wallShade": "#c2aa82",
37
+ "wallSeam": "#bda57f",
38
+ "wallHighlight": "#ecdcbc",
39
+ "wallBase": "#76563f",
40
+ "wood": "#8a5638",
41
+ "woodDark": "#603a2a",
42
+ "woodGrain": "#c38255",
43
+ "deskTop": "#a86945",
44
+ "deskLite": "#c98958",
45
+ "screen": "#183031",
46
+ "screenGlow": "#5aa3aa",
47
+ "chair": "#41676a",
48
+ "chairLite": "#66878a",
49
+ "chairDark": "#2e4b4f",
50
+ "metal": "#79867f",
51
+ "metalDark": "#56625e",
52
+ "rack": "#293d3f",
53
+ "board": "#f0e8d5",
54
+ "boardFrame": "#8b765e",
55
+ "glass": "#7bb0b7",
56
+ "glassLite": "#9fd0d1",
57
+ "glassShine": "#cdf0ec",
58
+ "plant": "#4f8b62",
59
+ "plantDark": "#356746",
60
+ "plantLite": "#70a970",
61
+ "plantHighlight": "#9ac77e",
62
+ "pot": "#aa6248",
63
+ "paper": "#fff0cd",
64
+ "door": "#88573a",
65
+ "doorDark": "#5b3828",
66
+ "doorPanel": "#a36c47",
67
+ "doorLite": "#ce8a5d",
68
+ "windowSpark": "#fff0a8",
69
+ "boardText": "#766858",
70
+ "boardTextDim": "#9b8872",
71
+ "boardIdle": "#b3a58f",
72
+ "activeRed": "#d65c55",
73
+ "activeBlue": "#438da0",
74
+ "activeGreen": "#54b78b",
75
+ "activeThink": "#75b7c2",
76
+ "activeAccent": "#f2bd5b",
77
+ "screenIdle": "#315457",
78
+ "paperLine": "#d4bd91",
79
+ "metalLite": "#94a39a",
80
+ "drawerLite": "#98a69d",
81
+ "drawerHandle": "#bdc6bd",
82
+ "drawerOpen": "#46504d",
83
+ "rackTrim": "#456064",
84
+ "rackPanel": "#1e3032",
85
+ "rackLine": "#385154",
86
+ "signalOn": "#78d5a5",
87
+ "signalOff": "#315d47",
88
+ "coffeePanel": "#3e3028",
89
+ "coffeeHot": "#efb35e",
90
+ "coffeeIdle": "#69503e",
91
+ "steam": "#d8d4c4",
92
+ "waterBody": "#efe5d2",
93
+ "waterDark": "#6d7f7c",
94
+ "waterGlass": "#8cced0",
95
+ "waterLevel": "#4fa6b2",
96
+ "waterActive": "#a4ece7",
97
+ "rain": "#9ad7d9",
98
+ "phoneTop": "#b7794f",
99
+ "phoneDevice": "#294447",
100
+ "phoneIdle": "#507174",
101
+ "meetingPaper": "#f3dfb8",
102
+ "meetingDevice": "#526d6f",
103
+ "potLite": "#ce8060",
104
+ "keyboard": "#294447",
105
+ "keyboardKey": "#789397",
106
+ "mug": "#d65c55",
107
+ "mugLite": "#ee9a72"
108
+ },
109
+ "character": {
110
+ "detail": "rich",
111
+ "outline": "#2a2020",
112
+ "shadow": "rgba(55,31,24,0.28)",
113
+ "pants": "#343b42",
114
+ "shoes": "#242529",
115
+ "shirtShade": "#30383d",
116
+ "shirtLite": "rgba(255,255,255,0.22)",
117
+ "skinShade": "#bd8066",
118
+ "hairLite": "rgba(255,255,255,0.20)",
119
+ "eyeLite": "#fff1d0",
120
+ "faceInk": "#3b2924",
121
+ "mouth": "#a2524b",
122
+ "pips": {
123
+ "thinking": "#75b7c2",
124
+ "working": "#f2bd5b",
125
+ "waiting": "#bd8fc5",
126
+ "talking": "#72c6a0",
127
+ "done": "#72c6a0",
128
+ "error": "#ef8065",
129
+ "idle": null
130
+ },
131
+ "particles": {
132
+ "key": "#75b7c2",
133
+ "keyInset": "#183031",
134
+ "paper": "#fff0cd",
135
+ "paperLine": "#c9a978",
136
+ "check": "#72c6a0",
137
+ "bang": "#f2bd5b",
138
+ "cross": "#ef8065",
139
+ "spark": "#72c6a0",
140
+ "fallback": "#f1dfc2"
141
+ }
142
+ },
143
+ "motion": {
144
+ "actorSpeed": 44,
145
+ "bubbleThinkMs": 4200,
146
+ "bubbleSayMs": 6000,
147
+ "bubbleActionMs": 2800
148
+ }
149
+ }
150
+ }
@@ -0,0 +1 @@
1
+ export function createEnvironmentRuntime(environment: any): any;
@@ -0,0 +1,138 @@
1
+ const MINUTES_PER_DAY = 24 * 60;
2
+ const DEFAULT_PHASES = [
3
+ { id: "morning", start: "06:00" },
4
+ { id: "noon", start: "11:00" },
5
+ { id: "evening", start: "17:00" },
6
+ { id: "night", start: "20:00" },
7
+ ];
8
+ const DEFAULT_WEATHER = ["clear", "cloudy", "rain", "snow"];
9
+
10
+ function parseClock(value, fallback = 0) {
11
+ if (typeof value !== "string" || !/^\d{1,2}:\d{2}$/.test(value)) return fallback;
12
+ const [hour, minute] = value.split(":").map(Number);
13
+ if (hour < 0 || hour > 23 || minute < 0 || minute > 59) return fallback;
14
+ return hour * 60 + minute;
15
+ }
16
+
17
+ function phaseAt(minutes, phases) {
18
+ const ordered = phases
19
+ .map((phase) => ({ ...phase, minute: parseClock(phase.start) }))
20
+ .sort((a, b) => a.minute - b.minute);
21
+ let selected = ordered[ordered.length - 1]?.id ?? "noon";
22
+ for (const phase of ordered) {
23
+ if (minutes < phase.minute) break;
24
+ selected = phase.id;
25
+ }
26
+ return selected;
27
+ }
28
+
29
+ function stableHash(value) {
30
+ let hash = 2166136261;
31
+ for (let index = 0; index < value.length; index += 1) {
32
+ hash ^= value.charCodeAt(index);
33
+ hash = Math.imul(hash, 16777619);
34
+ }
35
+ return hash >>> 0;
36
+ }
37
+
38
+ /** Shared local clock, weather and NPC scheduling for every Office Preset. */
39
+ export function createEnvironmentRuntime(config) {
40
+ const clock = config.clock ?? {};
41
+ const weather = config.weather ?? {};
42
+ const lighting = config.lighting ?? {};
43
+ const npcSchedule = config.npcSchedule ?? {};
44
+ const allowedWeather = new Set(weather.allowedConditions ?? DEFAULT_WEATHER);
45
+ let preview = null;
46
+ let timeOverride = null;
47
+ let weatherOverride = null;
48
+
49
+ function officeDate() {
50
+ const now = new Date();
51
+ let minutes = now.getHours() * 60 + now.getMinutes();
52
+ if (preview) {
53
+ const elapsed = (performance.now() - preview.startedAt) % preview.durationMs;
54
+ minutes = (preview.startMinute + (elapsed / preview.durationMs) * MINUTES_PER_DAY) % MINUTES_PER_DAY;
55
+ } else if (timeOverride != null) {
56
+ minutes = timeOverride;
57
+ } else if (clock.mode === "fixed") {
58
+ minutes = parseClock(clock.fixedTime, minutes);
59
+ }
60
+ now.setHours(Math.floor(minutes / 60), Math.floor(minutes % 60), 0, 0);
61
+ return now;
62
+ }
63
+
64
+ function snapshot() {
65
+ const now = officeDate();
66
+ const minutes = now.getHours() * 60 + now.getMinutes();
67
+ const phase = phaseAt(minutes, clock.phases ?? DEFAULT_PHASES);
68
+ const condition = weatherOverride ?? weather.condition ?? weather.fallback ?? "clear";
69
+ return Object.freeze({
70
+ now,
71
+ hour: now.getHours(),
72
+ minute: now.getMinutes(),
73
+ minutes,
74
+ phase,
75
+ weather: condition,
76
+ dynamicTime: config.render?.dynamicTime === true,
77
+ dynamicWeather: config.render?.dynamicWeather === true,
78
+ lightingOn: lighting.enabled === true && (lighting.activePhases ?? ["evening", "night"]).includes(phase),
79
+ previewing: Boolean(preview),
80
+ });
81
+ }
82
+
83
+ function startPreview(durationMs) {
84
+ const settings = clock.preview ?? {};
85
+ if (settings.enabled !== true || timeOverride != null) return false;
86
+ preview = {
87
+ startedAt: performance.now(),
88
+ durationMs: Math.max(8000, Number(durationMs ?? settings.durationMs ?? 24000)),
89
+ startMinute: parseClock(settings.startTime, 6 * 60),
90
+ };
91
+ return true;
92
+ }
93
+
94
+ function update(overrides = {}) {
95
+ if (Object.hasOwn(overrides, "time")) {
96
+ if (overrides.time == null || overrides.time === "") {
97
+ timeOverride = null;
98
+ } else {
99
+ const parsed = parseClock(String(overrides.time), -1);
100
+ if (parsed < 0) throw new Error(`无效的时间:${overrides.time}`);
101
+ timeOverride = parsed;
102
+ }
103
+ preview = null;
104
+ }
105
+ if (Object.hasOwn(overrides, "weather")) {
106
+ const condition = overrides.weather == null || overrides.weather === "" ? null : String(overrides.weather);
107
+ if (condition != null && !allowedWeather.has(condition)) throw new Error(`不支持的天气:${condition}`);
108
+ weatherOverride = condition;
109
+ }
110
+ return snapshot();
111
+ }
112
+
113
+ function isNpcOnDuty(role, entryShift, identity = role) {
114
+ if (npcSchedule.enabled === false) return true;
115
+ const shift = {
116
+ ...(npcSchedule.defaultShift ?? { start: "06:00", end: "18:00" }),
117
+ ...(npcSchedule.roleOverrides?.[role] ?? {}),
118
+ ...(entryShift ?? {}),
119
+ };
120
+ if (shift.enabled === false) return true;
121
+ const start = parseClock(shift.start, 6 * 60);
122
+ const earliestEnd = parseClock(shift.end, 18 * 60);
123
+ const latestEnd = parseClock(shift.endLatest, earliestEnd);
124
+ const currentSnapshot = snapshot();
125
+ const dayKey = `${currentSnapshot.now.getFullYear()}-${currentSnapshot.now.getMonth() + 1}-${currentSnapshot.now.getDate()}`;
126
+ const spread = Math.max(0, latestEnd - earliestEnd);
127
+ const end = earliestEnd + (spread ? stableHash(`${dayKey}:${identity}`) % (spread + 1) : 0);
128
+ const current = currentSnapshot.minutes;
129
+ if (start === end) return true;
130
+ return start < end ? current >= start && current < end : current >= start || current < end;
131
+ }
132
+
133
+ function shiftLabel(kind) {
134
+ return kind === "arrival" ? (npcSchedule.labels?.arrival ?? "上班啦") : (npcSchedule.labels?.departure ?? "下班啦");
135
+ }
136
+
137
+ return Object.freeze({ config, snapshot, startPreview, update, isNpcOnDuty, shiftLabel });
138
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Structural rules for a renderable content graph — the single source of truth.
3
+ *
4
+ * Two consumers share this module:
5
+ * - the browser imports the generated `web/v2/graph-validator.js`
6
+ * (see `tsconfig.web-validator.json` and `scripts/web-validator.mjs`);
7
+ * - the local server imports the TypeScript module directly, so the same rules
8
+ * gate saving an Office Spec and serving `/api/office-content`.
9
+ *
10
+ * Keep this file dependency-free, platform-neutral, and side-effect-free: it is
11
+ * compiled for the browser and bundled into every host integration.
12
+ */
13
+ /** Capabilities every layout must expose as a walkable work station. */
14
+ export declare const WORK_CAPABILITIES: readonly ["research", "create", "compute", "plan", "communicate", "collaborate"];
15
+ /** Renderer-resolved destinations that deliberately do not belong to a layout. */
16
+ export declare const DYNAMIC_ACTIVITY_TARGETS: Set<string>;
17
+ export interface ContentIssue {
18
+ code: string;
19
+ path: string;
20
+ message: string;
21
+ }
22
+ /**
23
+ * What an activity needs to be staged: a named prop instance, or a capability
24
+ * any matching prop type can provide. The named form is the legacy syntax;
25
+ * capability requirements let the same implementation be reused across layouts
26
+ * and stop a prop swap from satisfying an activity by id alone.
27
+ */
28
+ export type ActivityRequirement = string | {
29
+ prop: string;
30
+ } | {
31
+ capability: string;
32
+ };
33
+ export interface ResolvedRequirements {
34
+ /** Resolved instance id per requirement, aligned by index; null when unresolved. */
35
+ bindings: (string | null)[];
36
+ issues: ContentIssue[];
37
+ }
38
+ /**
39
+ * Resolves activity requirements against the props actually present, so both
40
+ * syntaxes stay valid while content migrates.
41
+ */
42
+ export declare function resolveActivityRequirements(requires: readonly unknown[] | undefined, instances: Iterable<readonly [string, string]>, capabilitiesOf: (type: string) => readonly string[], activity: string): ResolvedRequirements;
43
+ export declare function assertManifest(value: unknown, kind: string): void;
44
+ /**
45
+ * Layout structure rules. `propTypeNames` are the type names a layout may
46
+ * reference; the library stores props namespaced while the rendered graph does
47
+ * not, so both callers normalize before calling.
48
+ */
49
+ export declare function layoutIssues(layout: any, propTypeNames: Iterable<string>): ContentIssue[];
50
+ /** Every reason the browser would refuse to render this resolved content graph. */
51
+ export declare function graphIssues(content: any): ContentIssue[];
52
+ /** Browser entry point: refuse the first structural problem, exactly as rendered. */
53
+ export declare function validateRegistry(content: unknown): void;
54
+ /** Server entry point: report every problem at once for the Creator surface. */
55
+ export declare function graphIssueMessages(content: unknown): string[];