@zergai/ztc 0.26.6-dev.202611240947 → 0.27.0-beta.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.
Files changed (268) hide show
  1. package/README.md +629 -167
  2. package/RUST_THIRD_PARTY_LICENSES.txt +5 -5
  3. package/bin/zmux-darwin-arm64 +0 -0
  4. package/bin/zmux-linux-x64 +0 -0
  5. package/bin/ztc-audio-darwin-arm64 +0 -0
  6. package/bin/ztc-capture-darwin-arm64 +0 -0
  7. package/bin/ztc-computer-darwin-arm64 +0 -0
  8. package/bin/ztc-llm-darwin-arm64 +0 -0
  9. package/bin/ztc-tts-darwin-arm64 +0 -0
  10. package/bin/ztc-tui-darwin-arm64 +0 -0
  11. package/bin/ztc-tui-linux-x64 +0 -0
  12. package/bin/zterm-darwin-arm64 +2 -2
  13. package/dist/App.js +6 -1
  14. package/dist/agent/agent.d.ts +21 -15
  15. package/dist/agent/agent.js +389 -163
  16. package/dist/agent/backends/codex_app_server.d.ts +7 -1
  17. package/dist/agent/backends/codex_app_server.js +11 -1
  18. package/dist/agent/backends/gemini.js +22 -8
  19. package/dist/agent/commands/batch.js +8 -0
  20. package/dist/agent/commands/config.js +10 -0
  21. package/dist/agent/commands/environment.js +5 -5
  22. package/dist/agent/commands/goal.d.ts +1 -0
  23. package/dist/agent/commands/goal.js +2 -1
  24. package/dist/agent/commands/index.js +2 -1
  25. package/dist/agent/commands/manifest.js +4 -0
  26. package/dist/agent/commands/optimize.js +5 -2
  27. package/dist/agent/commands/pane_cli.d.ts +29 -0
  28. package/dist/agent/commands/pane_cli.js +303 -0
  29. package/dist/agent/commands/settings.js +13 -3
  30. package/dist/agent/commands/shannon.js +8 -0
  31. package/dist/agent/commands/update.js +15 -3
  32. package/dist/agent/commands/zerg.js +31 -1
  33. package/dist/agent/commands/ztc_pane.js +3 -1
  34. package/dist/agent/factory.d.ts +4 -0
  35. package/dist/agent/factory.js +11 -1
  36. package/dist/agent/loop_policy.d.ts +42 -5
  37. package/dist/agent/loop_policy.js +206 -3
  38. package/dist/agent/runtime/command_jobs.d.ts +5 -0
  39. package/dist/agent/runtime/command_jobs.js +241 -31
  40. package/dist/agent/runtime/command_wait.d.ts +2 -0
  41. package/dist/agent/runtime/command_wait.js +1 -0
  42. package/dist/agent/runtime/done_report.d.ts +18 -0
  43. package/dist/agent/runtime/done_report.js +130 -0
  44. package/dist/agent/runtime/execution_context.js +4 -1
  45. package/dist/agent/runtime/failure_cause.d.ts +2 -0
  46. package/dist/agent/runtime/failure_cause.js +35 -0
  47. package/dist/agent/runtime/policy.d.ts +14 -2
  48. package/dist/agent/runtime/policy.js +104 -12
  49. package/dist/agent/runtime/quiet_job.d.ts +18 -0
  50. package/dist/agent/runtime/quiet_job.js +48 -0
  51. package/dist/agent/runtime/recovery.d.ts +1 -5
  52. package/dist/agent/runtime/recovery.js +2 -44
  53. package/dist/agent/runtime/tool_runtime.d.ts +1 -0
  54. package/dist/agent/runtime/tool_runtime.js +2 -0
  55. package/dist/agent/subagent.js +6 -1
  56. package/dist/agent/tools/deferred.js +1 -0
  57. package/dist/agent/tools/index.d.ts +2 -0
  58. package/dist/agent/tools/index.js +1 -0
  59. package/dist/agent/tools/outcome.d.ts +15 -0
  60. package/dist/agent/tools/outcome.js +107 -0
  61. package/dist/agent/tools/pane.d.ts +2 -1
  62. package/dist/agent/tools/pane.js +21 -3
  63. package/dist/agent/tools/registry.js +2 -0
  64. package/dist/agent/tools/shell.d.ts +1 -0
  65. package/dist/agent/tools/shell.js +128 -17
  66. package/dist/agent/tools/sim_domain_tools.js +4 -2
  67. package/dist/agent/tools/supervision.js +4 -2
  68. package/dist/agent/tools/types.d.ts +3 -0
  69. package/dist/app/command_context.js +5 -9
  70. package/dist/app/conversation_compaction.d.ts +4 -2
  71. package/dist/app/conversation_compaction.js +16 -5
  72. package/dist/app/headless_shell_mode.d.ts +14 -0
  73. package/dist/app/headless_shell_mode.js +7 -0
  74. package/dist/app/hosted_resident.d.ts +356 -0
  75. package/dist/app/hosted_resident.js +677 -0
  76. package/dist/app/restart.js +11 -2
  77. package/dist/app/session_manager.d.ts +5 -0
  78. package/dist/app/session_manager.js +21 -6
  79. package/dist/app/session_messages.js +6 -6
  80. package/dist/app/workspace_layout_controller.js +7 -0
  81. package/dist/batch/worktree.d.ts +10 -0
  82. package/dist/batch/worktree.js +15 -0
  83. package/dist/bench/registry.js +4 -2
  84. package/dist/cli_args.js +1 -1
  85. package/dist/cli_main.js +80 -10
  86. package/dist/cli_ratatui.d.ts +75 -0
  87. package/dist/cli_ratatui.js +485 -84
  88. package/dist/components/InputArea.js +4 -4
  89. package/dist/config/execution.d.ts +10 -0
  90. package/dist/config/execution.js +10 -0
  91. package/dist/config/hosted_runtime.d.ts +4 -1
  92. package/dist/config/hosted_runtime.js +4 -1
  93. package/dist/config/permission_pin.d.ts +34 -2
  94. package/dist/config/permission_pin.js +52 -2
  95. package/dist/config/person_command_policy.d.ts +38 -0
  96. package/dist/config/person_command_policy.js +11 -0
  97. package/dist/config/profiles.d.ts +21 -0
  98. package/dist/config/profiles.js +56 -2
  99. package/dist/config/types.d.ts +4 -1
  100. package/dist/config.js +34 -19
  101. package/dist/desktop/daily/codex_exec_adapter.js +7 -2
  102. package/dist/desktop/daily/desktop_wiring.d.ts +7 -1
  103. package/dist/desktop/daily/desktop_wiring.js +11 -3
  104. package/dist/desktop/daily/recipes.js +20 -4
  105. package/dist/desktop/health.d.ts +24 -0
  106. package/dist/desktop/health.js +151 -0
  107. package/dist/desktop/native_dialogs.d.ts +37 -0
  108. package/dist/desktop/native_dialogs.js +105 -0
  109. package/dist/diagnostics/session_export.d.ts +1 -0
  110. package/dist/diagnostics/session_export.js +28 -0
  111. package/dist/embedded/registry.js +4 -2
  112. package/dist/emulation/tool_adapters.js +9 -4
  113. package/dist/emulation/ztc_addendum.js +3 -0
  114. package/dist/headless.d.ts +11 -4
  115. package/dist/headless.js +99 -34
  116. package/dist/headless_approval.d.ts +6 -0
  117. package/dist/headless_cli.js +1 -1
  118. package/dist/hooks/runner.js +7 -6
  119. package/dist/library.d.ts +4 -0
  120. package/dist/library.js +3 -0
  121. package/dist/mcp/client.js +3 -3
  122. package/dist/modes/registry.js +13 -4
  123. package/dist/onboarding/setup_environment.js +13 -1
  124. package/dist/optimize/adapters/kernelbench.js +88 -10
  125. package/dist/optimize/adapters/types.d.ts +5 -0
  126. package/dist/optimize/executor.js +21 -0
  127. package/dist/panes/cli_install.d.ts +54 -0
  128. package/dist/panes/cli_install.js +157 -0
  129. package/dist/panes/model_catalog.js +3 -0
  130. package/dist/panes/new_pane_choices.d.ts +6 -2
  131. package/dist/panes/new_pane_choices.js +24 -12
  132. package/dist/panes/pane_cli_launch.d.ts +50 -0
  133. package/dist/panes/pane_cli_launch.js +124 -0
  134. package/dist/panes/pane_clis.d.ts +171 -0
  135. package/dist/panes/pane_clis.js +325 -0
  136. package/dist/panes/person_only_panes.d.ts +45 -0
  137. package/dist/panes/person_only_panes.js +117 -0
  138. package/dist/plugin/simulation_living.js +0 -2
  139. package/dist/plugin/simulation_living_engine.d.ts +1 -0
  140. package/dist/plugin/simulation_living_engine.js +1 -0
  141. package/dist/plugin/simulation_living_labels.d.ts +3 -0
  142. package/dist/plugin/simulation_living_labels.js +2 -0
  143. package/dist/router_auth.js +12 -1
  144. package/dist/session.js +26 -1
  145. package/dist/simulation/art/gemini_image.js +11 -5
  146. package/dist/simulation/domains/loader.js +25 -3
  147. package/dist/simulation/living/cold.d.ts +23 -0
  148. package/dist/simulation/living/cold.js +41 -0
  149. package/dist/simulation/living/context.d.ts +591 -1283
  150. package/dist/simulation/living/context.js +378 -244
  151. package/dist/simulation/living/contradictions.d.ts +14 -0
  152. package/dist/simulation/living/contradictions.js +282 -0
  153. package/dist/simulation/living/core/ids.d.ts +53 -0
  154. package/dist/simulation/living/core/ids.js +39 -0
  155. package/dist/simulation/living/core/kind.d.ts +20 -0
  156. package/dist/simulation/living/core/kind.js +15 -0
  157. package/dist/simulation/living/core/laws.d.ts +179 -0
  158. package/dist/simulation/living/core/laws.js +184 -0
  159. package/dist/simulation/living/core/ops.d.ts +257 -0
  160. package/dist/simulation/living/core/ops.js +34 -0
  161. package/dist/simulation/living/definer.d.ts +17 -1
  162. package/dist/simulation/living/definer.js +130 -51
  163. package/dist/simulation/living/definition.d.ts +174 -65
  164. package/dist/simulation/living/definition.js +287 -180
  165. package/dist/simulation/living/director.d.ts +80 -0
  166. package/dist/simulation/living/director.js +363 -0
  167. package/dist/simulation/living/frame.d.ts +108 -21
  168. package/dist/simulation/living/frame.js +111 -66
  169. package/dist/simulation/living/identifiers.d.ts +0 -1
  170. package/dist/simulation/living/identifiers.js +0 -3
  171. package/dist/simulation/living/index.d.ts +18 -9
  172. package/dist/simulation/living/index.js +18 -9
  173. package/dist/simulation/living/inference.d.ts +92 -50
  174. package/dist/simulation/living/inference.js +319 -175
  175. package/dist/simulation/living/knowledge.d.ts +28 -0
  176. package/dist/simulation/living/knowledge.js +73 -0
  177. package/dist/simulation/living/library.json +1177 -0
  178. package/dist/simulation/living/mechanics.d.ts +31 -34
  179. package/dist/simulation/living/mechanics.js +222 -138
  180. package/dist/simulation/living/model-input.d.ts +6 -3
  181. package/dist/simulation/living/model-input.js +18 -26
  182. package/dist/simulation/living/open-world.d.ts +74 -94
  183. package/dist/simulation/living/open-world.js +151 -30
  184. package/dist/simulation/living/phrases.d.ts +3 -0
  185. package/dist/simulation/living/phrases.js +37 -0
  186. package/dist/simulation/living/phrases.json +560 -0
  187. package/dist/simulation/living/projection.d.ts +316 -2
  188. package/dist/simulation/living/projection.js +50 -2
  189. package/dist/simulation/living/prompts/example-spec.json +11 -0
  190. package/dist/simulation/living/prompts/role-text.json +14 -0
  191. package/dist/simulation/living/prompts.d.ts +5 -0
  192. package/dist/simulation/living/prompts.js +275 -0
  193. package/dist/simulation/living/recall.d.ts +2 -2
  194. package/dist/simulation/living/reduce.d.ts +51 -14
  195. package/dist/simulation/living/reduce.js +941 -579
  196. package/dist/simulation/living/replay.d.ts +5 -4
  197. package/dist/simulation/living/replay.js +10 -9
  198. package/dist/simulation/living/runtime.d.ts +135 -25
  199. package/dist/simulation/living/runtime.js +1641 -583
  200. package/dist/simulation/living/scale.d.ts +96 -0
  201. package/dist/simulation/living/scale.js +124 -0
  202. package/dist/simulation/living/script.d.ts +5 -0
  203. package/dist/simulation/living/script.js +115 -0
  204. package/dist/simulation/living/shared-kinds.d.ts +4 -11
  205. package/dist/simulation/living/shared-kinds.js +11 -81
  206. package/dist/simulation/living/space.d.ts +14 -0
  207. package/dist/simulation/living/space.js +132 -0
  208. package/dist/simulation/living/state.d.ts +100 -0
  209. package/dist/simulation/living/state.js +393 -0
  210. package/dist/simulation/living/types.d.ts +829 -512
  211. package/dist/simulation/living/types.js +162 -187
  212. package/dist/simulation/living/world-rules.d.ts +100 -0
  213. package/dist/simulation/living/world-rules.js +267 -0
  214. package/dist/simulation/plugins/loader.js +11 -0
  215. package/dist/skills/loader.js +4 -0
  216. package/dist/tools.d.ts +1 -0
  217. package/dist/tools.js +1 -0
  218. package/dist/ui/ratatui/headless_pane_manager.d.ts +4 -1
  219. package/dist/ui/ratatui/headless_pane_manager.js +13 -9
  220. package/dist/ui/ratatui/pane_relay.js +29 -0
  221. package/dist/ui/ratatui/pane_type.d.ts +10 -0
  222. package/dist/ui/ratatui/pane_type.js +11 -0
  223. package/dist/ui/ratatui/process.d.ts +30 -0
  224. package/dist/ui/ratatui/process.js +133 -19
  225. package/dist/ui/ratatui/protocol.d.ts +124 -2
  226. package/dist/ui/ratatui/protocol.js +35 -0
  227. package/dist/ui/ratatui/relay_policy.js +3 -0
  228. package/dist/ui/ratatui/ztc_launch_trust.d.ts +2 -1
  229. package/dist/ui/ratatui/ztc_launch_trust.js +8 -1
  230. package/dist/ui/terminal_image.d.ts +12 -0
  231. package/dist/ui/terminal_image.js +21 -1
  232. package/dist/utils/codex_project_trust.d.ts +19 -0
  233. package/dist/utils/codex_project_trust.js +37 -0
  234. package/dist/utils/compaction.js +103 -20
  235. package/dist/utils/git_program_files.d.ts +19 -12
  236. package/dist/utils/git_program_files.js +411 -83
  237. package/dist/utils/host_shell.d.ts +10 -1
  238. package/dist/utils/host_shell.js +14 -1
  239. package/dist/utils/mid_turn_compaction.d.ts +2 -0
  240. package/dist/utils/mid_turn_compaction.js +2 -0
  241. package/dist/utils/models.js +6 -1
  242. package/dist/utils/sandbox.d.ts +109 -8
  243. package/dist/utils/sandbox.js +981 -187
  244. package/dist/utils/shell.d.ts +2 -0
  245. package/dist/utils/shell.js +10 -4
  246. package/dist/utils/subprocess_env.d.ts +47 -11
  247. package/dist/utils/subprocess_env.js +107 -15
  248. package/dist/utils/system_ps.d.ts +8 -0
  249. package/dist/utils/system_ps.js +39 -7
  250. package/dist/utils/unattended_compaction.d.ts +9 -0
  251. package/dist/utils/unattended_compaction.js +13 -0
  252. package/dist/utils/ztc_own_state.d.ts +8 -5
  253. package/dist/utils/ztc_own_state.js +17 -11
  254. package/dist/web/mirror_client.js +1 -0
  255. package/dist/web/mirror_stream.d.ts +50 -6
  256. package/dist/web/mirror_stream.js +160 -15
  257. package/dist/workflows/registry.js +3 -1
  258. package/dist/workspace/controller.js +12 -0
  259. package/dist/workspace_collision.d.ts +3 -0
  260. package/dist/workspace_collision.js +14 -1
  261. package/dist/workspace_session_context.js +2 -1
  262. package/dist/zlm-embed.mjs +3823 -1970
  263. package/node_modules/@zerg/model-contracts/README.md +16 -4
  264. package/node_modules/@zerg/model-contracts/index.js +6 -1
  265. package/npm-shrinkwrap.json +1 -1
  266. package/package.json +42 -24
  267. package/packages/model-contracts/README.md +16 -4
  268. package/packages/model-contracts/index.js +6 -1
@@ -1,50 +1,94 @@
1
1
  import { z } from 'zod';
2
- import { WORLD_PRINCIPLES } from './context.js';
3
- import { kindFirst, responseFieldLines } from './inference.js';
4
- import { kindDefinitionSchema, valueMatchesType } from './open-world.js';
2
+ import { kindFirst, livingAnswerTokens, LIVING_INFERENCE_LIMITS } from './inference.js';
3
+ import { kindDefinitionSchema, lawProblems, valueMatchesType } from './open-world.js';
5
4
  import { assertLivingModelCall, LIVING_INPUT_BUDGETS } from './model-input.js';
5
+ import { systemFor } from './prompts.js';
6
6
  import { LivingWorldError } from './types.js';
7
- // What each mechanic means, shown beside its settings.
8
- const MECHANIC_MEANINGS = {
9
- spread: 'propertyId, a level, moves along relationId, weaker with each step.',
10
- signal: 'While propertyId is set, people where relationId points perceive it on channel, such as sight, sound, smell or touch.',
11
- change: 'propertyId, a number, changes by deltaPerMinute; or, with deltaPerMinute 0 and onEvent, takes its value when the one its id property subjectPropertyId names moves.',
12
- trigger: 'When propertyId, a number, crosses threshold in direction, the happening in intent follows after delayMinutes, at least minImportance.',
13
- gate: 'While propertyId holds (at least atLeast when it is a level), the one its id property subjectPropertyId names cannot take blockedActionKinds.',
14
- norm: 'actionKind is forbidden for roleId, or for everyone when null; breaking it is a norm violation.',
15
- authority: 'roleId may change propertyId or relationId on others.',
16
- };
7
+ import { lawSchema } from './core/laws.js';
8
+ import { parseKindRevision } from './definition.js';
9
+ function withSettings(arm, key) {
10
+ const properties = arm.properties ?? {};
11
+ const { [key]: discriminator, ...fields } = properties;
12
+ return { type: 'object', additionalProperties: false, required: [key, 'settings'], properties: { [key]: discriminator,
13
+ settings: { type: 'object', additionalProperties: false, required: (arm.required ?? []).filter(name => name !== key),
14
+ properties: Object.fromEntries(Object.entries(fields).map(([name, child]) => [name, shapeFirst(child)])) } } };
15
+ }
16
+ function shapeFirst(node) {
17
+ const arms = node.anyOf ?? node.oneOf;
18
+ if (arms !== undefined) {
19
+ const key = arms.every(arm => arm.properties?.kind?.const !== undefined) ? 'kind'
20
+ : arms.every(arm => arm.properties?.op?.const !== undefined) ? 'op' : null;
21
+ if (key !== null)
22
+ return { anyOf: arms.map(arm => withSettings(arm, key)) };
23
+ const firsts = arms.map(arm => Object.keys(arm.properties ?? {})[0]);
24
+ if (firsts.every(name => name !== undefined) && new Set(firsts).size === arms.length) {
25
+ return { anyOf: arms.map((arm, index) => {
26
+ const name = firsts[index];
27
+ const { [name]: value, ...others } = arm.properties;
28
+ return { type: 'object', additionalProperties: false, required: ['kind', 'settings'], properties: { kind: { const: name },
29
+ settings: { type: 'object', additionalProperties: false, required: [name, ...(arm.required ?? []).filter(field => field !== name)],
30
+ properties: { [name]: shapeFirst(value), ...others } } } };
31
+ }) };
32
+ }
33
+ return { ...node, anyOf: arms.map(shapeFirst) };
34
+ }
35
+ if (node.properties !== undefined)
36
+ return { ...node, properties: Object.fromEntries(Object.entries(node.properties).map(([name, child]) => [name, shapeFirst(child)])) };
37
+ if (node.items !== undefined)
38
+ return { ...node, items: shapeFirst(node.items) };
39
+ return node;
40
+ }
41
+ function capIntent(node) {
42
+ if (node.properties?.intent?.type === 'string')
43
+ node.properties.intent.maxLength = 600;
44
+ for (const child of Object.values(node.properties ?? {}))
45
+ capIntent(child);
46
+ for (const arm of node.anyOf ?? [])
47
+ capIntent(arm);
48
+ if (node.items !== undefined)
49
+ capIntent(node.items);
50
+ }
17
51
  function modelKindSchema() {
18
52
  const schema = structuredClone(z.toJSONSchema(kindDefinitionSchema));
19
- const { mechanics, ...slots } = schema.properties;
53
+ const { mechanics, laws, library, neverHeld, ...slots } = schema.properties;
20
54
  const items = mechanics.items;
21
- const shapes = (items.anyOf ?? items.oneOf ?? []).map(shape => kindFirst('settings')({ required: shape.required,
22
- properties: { ...shape.properties, kind: { ...shape.properties.kind, description: MECHANIC_MEANINGS[shape.properties.kind.const] } } }));
23
- return { ...schema, properties: { ...slots, rules: { type: 'array', description: mechanics.description, items: { anyOf: shapes } } },
24
- required: [...schema.required.filter(name => name !== 'mechanics'), 'rules'] };
55
+ const shapes = (items.anyOf ?? items.oneOf ?? []).map(shape => kindFirst('settings')({ required: shape.required, properties: shape.properties }));
56
+ const lawsSchema = shapeFirst(z.toJSONSchema(lawSchema));
57
+ capIntent(lawsSchema);
58
+ const lawShapes = lawsSchema.anyOf ?? [];
59
+ return { ...schema, properties: { ...slots, z: { type: 'array', description: mechanics.description, items: { anyOf: [...shapes, ...lawShapes] } } },
60
+ required: [...schema.required.filter(name => name !== 'mechanics'), 'z'] };
25
61
  }
26
62
  function fromModelKind(answer) {
27
63
  if (answer === null || typeof answer !== 'object' || Array.isArray(answer))
28
64
  return answer;
29
- const { rules, ...rest } = answer;
30
- if (!Array.isArray(rules))
31
- return answer;
32
- return { ...rest, mechanics: rules.map(rule => {
33
- if (rule === null || typeof rule !== 'object' || Array.isArray(rule))
34
- return rule;
35
- const { settings, ...named } = rule;
36
- return settings !== null && typeof settings === 'object' && !Array.isArray(settings) ? { ...settings, ...named } : rule;
37
- }) };
65
+ const unwrapped = unwrapModel(answer);
66
+ const { rules, z, l, ...rest } = unwrapped;
67
+ const items = Array.isArray(z) ? z : Array.isArray(rules) ? rules : [];
68
+ const isLaw = (item) => item !== null && typeof item === 'object' && ['react', 'forbid'].includes(String(item.kind));
69
+ const mechanics = items.filter(item => !isLaw(item));
70
+ const laws = [...items.filter(isLaw), ...(Array.isArray(l) ? l : [])];
71
+ return { ...rest, mechanics, ...(laws.length === 0 ? {} : { laws }) };
72
+ }
73
+ function unwrapModel(value) {
74
+ if (Array.isArray(value))
75
+ return value.map(unwrapModel);
76
+ if (value === null || typeof value !== 'object')
77
+ return value;
78
+ const record = value;
79
+ const settings = record.settings;
80
+ if (settings !== null && typeof settings === 'object' && !Array.isArray(settings)) {
81
+ const fields = settings;
82
+ if (typeof record.kind === 'string' && ['changed', 'added', 'created', 'every', 'attempted'].includes(record.kind) && 'slot' in fields) {
83
+ const { slot, ...others } = fields;
84
+ return { [record.kind]: slot, ...others };
85
+ }
86
+ const { settings: _settings, ...rest } = record;
87
+ return unwrapModel({ ...fields, ...rest });
88
+ }
89
+ return Object.fromEntries(Object.entries(record).map(([name, child]) => [name, unwrapModel(child)]));
38
90
  }
39
91
  export const kindDefinitionResponseSchema = modelKindSchema();
40
- export const DEFINER_SYSTEM = `Role:
41
- You define one reusable kind for a living world. Include only properties, relations, and automatic mechanics needed for its general meaning.
42
- Principles:
43
- ${WORLD_PRINCIPLES}
44
- Fields:
45
- ${responseFieldLines(kindDefinitionResponseSchema)}
46
- Example:
47
- {"id":"new-kind","meaning":"A general thing.","name":"New kind","properties":[],"relations":[],"rules":[]}`;
48
92
  function responseSchemaFor(request, existing) {
49
93
  const schema = structuredClone(kindDefinitionResponseSchema);
50
94
  const properties = schema.properties;
@@ -102,11 +146,13 @@ export async function defineLivingKind(options) {
102
146
  errors.push(last.slice(0, end));
103
147
  }
104
148
  }
149
+ const responseSchema = responseSchemaFor(options.request, selected);
150
+ const built = input();
105
151
  const call = { reserveRetry,
106
- role: 'definer', phase: 'define', system: DEFINER_SYSTEM,
107
- input: input(),
108
- responseSchema: responseSchemaFor(options.request, selected),
109
- maxTokens: 700, timeoutMs: 45_000, ...(options.stillWanted ? { stillWanted: options.stillWanted } : {}),
152
+ role: 'definer', phase: 'define', system: systemFor('definer', responseSchema, built, kindDefinitionResponseSchema),
153
+ input: built,
154
+ responseSchema,
155
+ maxTokens: Math.max(700, livingAnswerTokens(responseSchema)), timeoutMs: 45_000, ...(options.stillWanted ? { stillWanted: options.stillWanted } : {}),
110
156
  };
111
157
  assertLivingModelCall(call);
112
158
  const answer = await options.inference.complete(call);
@@ -143,12 +189,8 @@ function ruleProblems(mechanic, definition) {
143
189
  problems.push(`${mechanic.kind} rule names unknown property ${on}`);
144
190
  if ('relationId' in mechanic && mechanic.relationId !== null && !relations.has(mechanic.relationId))
145
191
  problems.push(`${mechanic.kind} rule names unknown relation ${mechanic.relationId}`);
146
- if (mechanic.kind === 'authority' && (mechanic.propertyId === null) === (mechanic.relationId === null))
147
- problems.push(`authority rule for ${mechanic.roleId} needs exactly one of propertyId or relationId`);
148
192
  if (mechanic.kind === 'spread' && onType !== undefined && onType !== 'level')
149
193
  problems.push(`spread rule on ${on}: it must be a level property, not ${onType}`);
150
- if (mechanic.kind === 'trigger' && onType !== undefined && onType !== 'number')
151
- problems.push(`trigger rule on ${on}: it must be a number property, not ${onType}`);
152
194
  if (mechanic.kind === 'change' && !mechanic.onEvent && onType !== undefined && onType !== 'number')
153
195
  problems.push(`change rule on ${on}: it must be a number property, not ${onType}`);
154
196
  if (mechanic.kind === 'change' && mechanic.onEvent) {
@@ -160,13 +202,6 @@ function ruleProblems(mechanic, definition) {
160
202
  if (typeOf(subject) !== 'id')
161
203
  problems.push(`change rule on ${on}: onEvent.subjectPropertyId ${subject} is ${typeOf(subject) === undefined ? 'not a property' : `a ${typeOf(subject)} property`}; it must name an id property`);
162
204
  }
163
- if (mechanic.kind === 'gate') {
164
- const subject = mechanic.subjectPropertyId;
165
- if (typeOf(subject) !== 'id')
166
- problems.push(`gate rule on ${on}: subjectPropertyId ${subject} is ${typeOf(subject) === undefined ? 'not a property' : `a ${typeOf(subject)} property`}; it must name an id property`);
167
- if (mechanic.atLeast !== undefined && onType !== undefined && onType !== 'level')
168
- problems.push(`gate rule on ${on}: atLeast needs a level property, not ${onType}`);
169
- }
170
205
  return problems;
171
206
  }
172
207
  // What is wrong with a proposed kind, each problem naming the slot or rule at fault.
@@ -192,6 +227,8 @@ function definitionProblems(answer, request, existing) {
192
227
  problem(`Relation ${id} appears twice`);
193
228
  if (new Set(definition.mechanics.map(mechanic => JSON.stringify(mechanic))).size !== definition.mechanics.length)
194
229
  problem('A kind repeats a mechanic');
230
+ if (new Set((definition.laws ?? []).map(law => JSON.stringify(law))).size !== (definition.laws ?? []).length)
231
+ problem('A kind repeats a law');
195
232
  for (const relation of definition.relations) {
196
233
  if (propertyIds.includes(relation.id))
197
234
  problem(`Slot ${relation.id} is both a property and a relation; give the relation another id or drop it`);
@@ -202,6 +239,9 @@ function definitionProblems(answer, request, existing) {
202
239
  for (const mechanic of definition.mechanics)
203
240
  for (const message of ruleProblems(mechanic, definition))
204
241
  problem(message);
242
+ for (const law of definition.laws ?? [])
243
+ for (const message of lawProblems(law, definition))
244
+ problem(message);
205
245
  return problems;
206
246
  }
207
247
  // The part of a proposed kind that holds: every slot that is sound and every rule that fits its
@@ -218,6 +258,45 @@ function soundPart(answer, request, existing) {
218
258
  const slots = { ...definition, properties, relations };
219
259
  const mechanics = definition.mechanics.filter((mechanic, index, all) => all.findIndex(other => JSON.stringify(other) === JSON.stringify(mechanic)) === index
220
260
  && ruleProblems(mechanic, slots).length === 0);
221
- const kept = { ...slots, mechanics };
261
+ const laws = (definition.laws ?? []).filter((law, index, all) => all.findIndex(other => JSON.stringify(other) === JSON.stringify(law)) === index
262
+ && lawProblems(law, slots).length === 0);
263
+ const kept = { ...slots, mechanics, ...(definition.laws === undefined ? {} : { laws }) };
222
264
  return definitionProblems(kept, request, existing).length === 0 ? kept : null;
223
265
  }
266
+ export const REVISION_CALLS = 2;
267
+ export async function reviseLivingKind(options) {
268
+ const existing = definitionContext(options.library.filter(kind => kind.id !== options.kind.id));
269
+ let previousErrors = [];
270
+ let spent = 0;
271
+ const reserveRetry = () => {
272
+ if (spent >= REVISION_CALLS)
273
+ return false;
274
+ spent += 1;
275
+ return true;
276
+ };
277
+ for (let attempt = 0; attempt < REVISION_CALLS && reserveRetry(); attempt += 1) {
278
+ const input = () => ({ kind: options.kind, facets: options.facets.slice(0, 8), requests: (options.requests ?? []).slice(0, 4),
279
+ existing: existing.map(kind => ({ id: kind.id, meaning: kind.meaning })),
280
+ ...(previousErrors.length ? { previousErrors } : {}) });
281
+ const responseSchema = kindDefinitionResponseSchema;
282
+ const built = input();
283
+ const call = { reserveRetry, role: 'definer', phase: 'revise',
284
+ system: systemFor('definer', responseSchema, built, kindDefinitionResponseSchema),
285
+ input: built, responseSchema, ...LIVING_INFERENCE_LIMITS.revise,
286
+ maxTokens: Math.max(LIVING_INFERENCE_LIMITS.revise.maxTokens, livingAnswerTokens(responseSchema)),
287
+ ...(options.stillWanted ? { stillWanted: options.stillWanted } : {}) };
288
+ assertLivingModelCall(call);
289
+ const answer = await options.inference.complete(call);
290
+ try {
291
+ return parseKindRevision(options.kind, fromModelKind(answer));
292
+ }
293
+ catch (error) {
294
+ if (!(error instanceof LivingWorldError))
295
+ throw error;
296
+ if (spent >= REVISION_CALLS)
297
+ throw error;
298
+ previousErrors = [error.message.slice(0, DEFINER_ERROR_BUDGET)];
299
+ }
300
+ }
301
+ throw new LivingWorldError('inference-invalid', 'The steward could not revise the kind');
302
+ }
@@ -1,11 +1,76 @@
1
1
  import { z } from 'zod';
2
- import { type LivingState } from './types.js';
2
+ import { type LivingStateRaw } from './types.js';
3
+ import { type LivingKindDefinition } from './open-world.js';
4
+ import { type LivingCalendar } from './scale.js';
5
+ import type { CellTable, EntityId, KindId, Minutes, PersonId, PlaceId, PropertyId, RelationId } from './core/ids.js';
3
6
  export declare const definitionSchema: z.ZodObject<{
4
7
  kind: z.ZodString;
8
+ look: z.ZodOptional<z.ZodObject<{
9
+ map: z.ZodOptional<z.ZodObject<{
10
+ name: z.ZodString;
11
+ terrain: z.ZodString;
12
+ palette: z.ZodObject<{
13
+ ground: z.ZodString;
14
+ path: z.ZodString;
15
+ wall: z.ZodString;
16
+ floor: z.ZodString;
17
+ ink: z.ZodString;
18
+ accent: z.ZodString;
19
+ }, z.core.$strip>;
20
+ paths: z.ZodArray<z.ZodString>;
21
+ locations: z.ZodArray<z.ZodObject<{
22
+ id: z.ZodString;
23
+ name: z.ZodString;
24
+ x: z.ZodNumber;
25
+ y: z.ZodNumber;
26
+ w: z.ZodNumber;
27
+ h: z.ZodNumber;
28
+ station: z.ZodObject<{
29
+ x: z.ZodNumber;
30
+ y: z.ZodNumber;
31
+ }, z.core.$strip>;
32
+ props: z.ZodArray<z.ZodObject<{
33
+ kind: z.ZodString;
34
+ x: z.ZodNumber;
35
+ y: z.ZodNumber;
36
+ rotate: z.ZodOptional<z.ZodNumber>;
37
+ scale: z.ZodOptional<z.ZodNumber>;
38
+ }, z.core.$strip>>;
39
+ }, z.core.$strip>>;
40
+ trees: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
41
+ }, z.core.$strip>>;
42
+ art: z.ZodOptional<z.ZodString>;
43
+ icon: z.ZodOptional<z.ZodString>;
44
+ catalog: z.ZodOptional<z.ZodObject<{
45
+ shortTitle: z.ZodString;
46
+ eyebrow: z.ZodString;
47
+ fantasy: z.ZodString;
48
+ primaryVerb: z.ZodString;
49
+ verbs: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
50
+ palette: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
51
+ texture: z.ZodString;
52
+ }, z.core.$strip>>;
53
+ }, z.core.$strip>>;
5
54
  title: z.ZodString;
6
55
  tagline: z.ZodString;
7
56
  setting: z.ZodString;
8
57
  startClock: z.ZodNumber;
58
+ calendar: z.ZodDefault<z.ZodObject<{
59
+ beat: z.ZodNumber;
60
+ day: z.ZodNumber;
61
+ hours: z.ZodDefault<z.ZodNumber>;
62
+ minutes: z.ZodDefault<z.ZodNumber>;
63
+ rest: z.ZodDefault<z.ZodNullable<z.ZodObject<{
64
+ from: z.ZodNumber;
65
+ until: z.ZodNumber;
66
+ span: z.ZodOptional<z.ZodNumber>;
67
+ action: z.ZodString;
68
+ why: z.ZodString;
69
+ }, z.core.$strip>>>;
70
+ }, z.core.$strip>>;
71
+ travel: z.ZodDefault<z.ZodObject<{
72
+ steps: z.ZodNumber;
73
+ }, z.core.$strip>>;
9
74
  clock: z.ZodOptional<z.ZodObject<{
10
75
  rate: z.ZodNumber;
11
76
  }, z.core.$strip>>;
@@ -13,29 +78,33 @@ export declare const definitionSchema: z.ZodObject<{
13
78
  minutes: z.ZodNumber;
14
79
  how: z.ZodString;
15
80
  }, z.core.$strip>>;
16
- currency: z.ZodNullable<z.ZodObject<{
17
- symbol: z.ZodString;
18
- name: z.ZodString;
19
- }, z.core.$strip>>;
20
- accounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
81
+ units: z.ZodDefault<z.ZodArray<z.ZodObject<{
21
82
  id: z.ZodString;
22
83
  name: z.ZodString;
23
- holderId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
24
- balance: z.ZodNumber;
25
- allowsDebt: z.ZodDefault<z.ZodBoolean>;
84
+ symbol: z.ZodDefault<z.ZodNullable<z.ZodString>>;
85
+ }, z.core.$strip>>>;
86
+ numbers: z.ZodDefault<z.ZodArray<z.ZodObject<{
87
+ id: z.ZodString;
88
+ unit: z.ZodString;
89
+ min: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
90
+ max: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
91
+ }, z.core.$strip>>>;
92
+ channels: z.ZodDefault<z.ZodArray<z.ZodObject<{
93
+ id: z.ZodString;
94
+ notice: z.ZodString;
95
+ reach: z.ZodNumber;
96
+ namesKind: z.ZodOptional<z.ZodBoolean>;
97
+ heard: z.ZodOptional<z.ZodBoolean>;
26
98
  }, z.core.$strip>>>;
27
99
  places: z.ZodArray<z.ZodObject<{
28
100
  id: z.ZodString;
29
101
  name: z.ZodString;
30
- kind: z.ZodEnum<{
31
- private: "private";
32
- transit: "transit";
33
- room: "room";
34
- outdoors: "outdoors";
35
- }>;
36
102
  summary: z.ZodString;
103
+ containerId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
37
104
  connections: z.ZodArray<z.ZodString>;
105
+ edgeCosts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
38
106
  conditions: z.ZodDefault<z.ZodArray<z.ZodString>>;
107
+ numbers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
39
108
  }, z.core.$strip>>;
40
109
  player: z.ZodObject<{
41
110
  id: z.ZodString;
@@ -45,7 +114,7 @@ export declare const definitionSchema: z.ZodObject<{
45
114
  summary: z.ZodString;
46
115
  pronouns: z.ZodOptional<z.ZodString>;
47
116
  placeId: z.ZodString;
48
- money: z.ZodNullable<z.ZodNumber>;
117
+ numbers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
49
118
  }, z.core.$strip>;
50
119
  cast: z.ZodArray<z.ZodObject<{
51
120
  id: z.ZodString;
@@ -59,10 +128,13 @@ export declare const definitionSchema: z.ZodObject<{
59
128
  values: z.ZodArray<z.ZodString>;
60
129
  redLines: z.ZodArray<z.ZodString>;
61
130
  privateConcerns: z.ZodArray<z.ZodString>;
131
+ wants: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
+ fears: z.ZodOptional<z.ZodArray<z.ZodString>>;
62
133
  }, z.core.$strip>>;
63
134
  pronouns: z.ZodOptional<z.ZodString>;
64
135
  placeId: z.ZodString;
65
- money: z.ZodNullable<z.ZodNumber>;
136
+ knownPlaceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
137
+ numbers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
66
138
  mood: z.ZodString;
67
139
  goals: z.ZodArray<z.ZodString>;
68
140
  beliefs: z.ZodArray<z.ZodObject<{
@@ -87,8 +159,7 @@ export declare const definitionSchema: z.ZodObject<{
87
159
  id: z.ZodString;
88
160
  name: z.ZodString;
89
161
  summary: z.ZodString;
90
- placeId: z.ZodNullable<z.ZodString>;
91
- holderId: z.ZodNullable<z.ZodString>;
162
+ containerId: z.ZodNullable<z.ZodString>;
92
163
  ownerId: z.ZodNullable<z.ZodString>;
93
164
  condition: z.ZodString;
94
165
  singlePersonMovable: z.ZodDefault<z.ZodBoolean>;
@@ -108,8 +179,13 @@ export declare const definitionSchema: z.ZodObject<{
108
179
  flag: "flag";
109
180
  level: "level";
110
181
  time: "time";
182
+ series: "series";
111
183
  }>;
184
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
185
+ perActor: z.ZodOptional<z.ZodBoolean>;
186
+ sealedBy: z.ZodOptional<z.ZodString>;
112
187
  requiredOnCreate: z.ZodOptional<z.ZodBoolean>;
188
+ target: z.ZodOptional<z.ZodLiteral<"tension">>;
113
189
  }, z.core.$strip>>;
114
190
  relations: z.ZodArray<z.ZodObject<{
115
191
  id: z.ZodString;
@@ -136,63 +212,38 @@ export declare const definitionSchema: z.ZodObject<{
136
212
  low: "low";
137
213
  medium: "medium";
138
214
  high: "high";
139
- }>, z.ZodString]>;
215
+ }>, z.ZodString, z.ZodArray<z.ZodObject<{
216
+ option: z.ZodString;
217
+ personId: z.ZodString;
218
+ at: z.ZodNumber;
219
+ seq: z.ZodNumber;
220
+ }, z.core.$strip>>]>;
140
221
  }, z.core.$strip>>;
141
- }, z.core.$strip>, z.ZodObject<{
142
- kind: z.ZodLiteral<"trigger">;
143
- propertyId: z.ZodString;
144
- threshold: z.ZodNumber;
145
- direction: z.ZodEnum<{
146
- "at-least": "at-least";
147
- "at-most": "at-most";
148
- }>;
149
- intent: z.ZodString;
150
- delayMinutes: z.ZodNumber;
151
- minImportance: z.ZodOptional<z.ZodNumber>;
152
- }, z.core.$strip>, z.ZodObject<{
153
- kind: z.ZodLiteral<"gate">;
154
- propertyId: z.ZodString;
155
- subjectPropertyId: z.ZodString;
156
- atLeast: z.ZodOptional<z.ZodEnum<{
157
- none: "none";
158
- low: "low";
159
- medium: "medium";
160
- high: "high";
161
- }>>;
162
- blockedActionKinds: z.ZodArray<z.ZodString>;
163
- }, z.core.$strip>, z.ZodObject<{
164
- kind: z.ZodLiteral<"norm">;
165
- actionKind: z.ZodString;
166
- roleId: z.ZodNullable<z.ZodString>;
167
- forbidden: z.ZodBoolean;
168
- }, z.core.$strip>, z.ZodObject<{
169
- kind: z.ZodLiteral<"authority">;
170
- roleId: z.ZodString;
171
- relationId: z.ZodNullable<z.ZodString>;
172
- propertyId: z.ZodNullable<z.ZodString>;
173
222
  }, z.core.$strip>], "kind">>;
223
+ laws: z.ZodOptional<z.ZodArray<z.ZodType<import("./core/laws.js").Law, unknown, z.core.$ZodTypeInternals<import("./core/laws.js").Law, unknown>>>>;
224
+ library: z.ZodOptional<z.ZodBoolean>;
225
+ neverHeld: z.ZodOptional<z.ZodBoolean>;
174
226
  }, z.core.$strip>>>;
175
227
  entities: z.ZodDefault<z.ZodArray<z.ZodObject<{
176
228
  id: z.ZodString;
177
229
  kindId: z.ZodString;
178
230
  name: z.ZodString;
179
- placeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
231
+ containerId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
180
232
  properties: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodEnum<{
181
233
  none: "none";
182
234
  low: "low";
183
235
  medium: "medium";
184
236
  high: "high";
185
- }>, z.ZodString]>>>;
237
+ }>, z.ZodString, z.ZodArray<z.ZodObject<{
238
+ option: z.ZodString;
239
+ personId: z.ZodString;
240
+ at: z.ZodNumber;
241
+ seq: z.ZodNumber;
242
+ }, z.core.$strip>>]>>>;
186
243
  relations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
187
- members: z.ZodOptional<z.ZodArray<z.ZodString>>;
188
- settles: z.ZodOptional<z.ZodString>;
244
+ numbers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
189
245
  knownTo: z.ZodOptional<z.ZodArray<z.ZodString>>;
190
246
  hidden: z.ZodOptional<z.ZodBoolean>;
191
- transfers: z.ZodOptional<z.ZodArray<z.ZodObject<{
192
- fromId: z.ZodNullable<z.ZodString>;
193
- toId: z.ZodNullable<z.ZodString>;
194
- amount: z.ZodNumber;
195
- }, z.core.$strip>>>;
196
247
  }, z.core.$strip>>>;
197
248
  facts: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
198
249
  aspect: z.ZodString;
@@ -231,7 +282,8 @@ export declare const definitionSchema: z.ZodObject<{
231
282
  settled: "settled";
232
283
  }>>;
233
284
  }, z.core.$strip>>;
234
- transfers: z.ZodOptional<z.ZodArray<z.ZodObject<{
285
+ shifts: z.ZodOptional<z.ZodArray<z.ZodObject<{
286
+ slot: z.ZodString;
235
287
  fromId: z.ZodNullable<z.ZodString>;
236
288
  toId: z.ZodNullable<z.ZodString>;
237
289
  amount: z.ZodNumber;
@@ -251,7 +303,64 @@ export declare const definitionSchema: z.ZodObject<{
251
303
  concerns: z.ZodOptional<z.ZodString>;
252
304
  }, z.core.$strip>>>;
253
305
  }, z.core.$strip>;
254
- export type LivingWorldDefinition = z.infer<typeof definitionSchema>;
306
+ export declare function definitionJsonSchema(): Record<string, unknown>;
307
+ export type LivingWorldDefinitionRaw = z.infer<typeof definitionSchema>;
255
308
  export type LivingWorldDefinitionInput = z.input<typeof definitionSchema>;
256
- export declare function parseLivingWorldDefinition(value: unknown): LivingWorldDefinition;
257
- export declare function createLivingState(definition: LivingWorldDefinition, seed: string, engine?: number): LivingState;
309
+ type RawDefinition = LivingWorldDefinitionRaw;
310
+ type RawDefinitionKind = RawDefinition['kinds'][number];
311
+ type RawDefinitionEntity = RawDefinition['entities'][number];
312
+ type RawDefinitionPlace = RawDefinition['places'][number];
313
+ type RawDefinitionPerson = RawDefinition['cast'][number];
314
+ type RawDefinitionObject = RawDefinition['objects'][number];
315
+ export type LivingWorldDefinition = Omit<RawDefinition, 'startClock' | 'places' | 'player' | 'cast' | 'objects' | 'kinds' | 'entities' | 'tension' | 'beats'> & {
316
+ startClock: Minutes;
317
+ calendar: LivingCalendar;
318
+ places: (Omit<RawDefinitionPlace, 'id' | 'connections' | 'containerId'> & {
319
+ id: PlaceId;
320
+ containerId: PlaceId | null;
321
+ connections: PlaceId[];
322
+ })[];
323
+ player: Omit<RawDefinition['player'], 'id' | 'placeId'> & {
324
+ id: PersonId;
325
+ placeId: PlaceId;
326
+ };
327
+ cast: (Omit<RawDefinitionPerson, 'id' | 'placeId'> & {
328
+ id: PersonId;
329
+ placeId: PlaceId;
330
+ })[];
331
+ objects: (Omit<RawDefinitionObject, 'id' | 'containerId' | 'ownerId'> & {
332
+ id: EntityId;
333
+ containerId: PlaceId | PersonId | null;
334
+ ownerId: PersonId | null;
335
+ })[];
336
+ kinds: (Omit<RawDefinitionKind, 'id' | 'properties' | 'relations'> & {
337
+ id: KindId;
338
+ properties: (Omit<RawDefinitionKind['properties'][number], 'id'> & {
339
+ id: PropertyId;
340
+ })[];
341
+ relations: (Omit<RawDefinitionKind['relations'][number], 'id' | 'targetKindId'> & {
342
+ id: RelationId;
343
+ targetKindId: KindId;
344
+ })[];
345
+ })[];
346
+ entities: (Omit<RawDefinitionEntity, 'id' | 'kindId' | 'containerId' | 'properties' | 'relations'> & {
347
+ id: EntityId;
348
+ kindId: KindId;
349
+ containerId: PlaceId | PersonId | null;
350
+ properties: CellTable<PropertyId, unknown>;
351
+ relations: CellTable<RelationId, EntityId>;
352
+ })[];
353
+ tension: Omit<RawDefinition['tension'], 'id' | 'participantIds'> & {
354
+ id: EntityId;
355
+ participantIds: PersonId[];
356
+ };
357
+ beats: (Omit<RawDefinition['beats'][number], 'id' | 'placeId' | 'concerns'> & {
358
+ id: EntityId;
359
+ placeId: PlaceId;
360
+ concerns?: EntityId;
361
+ })[];
362
+ };
363
+ export declare function parseLivingWorldDefinition(value: unknown): LivingWorldDefinitionRaw;
364
+ export declare function parseKindRevision(previous: LivingKindDefinition, proposed: unknown): LivingKindDefinition;
365
+ export declare function createLivingState(definition: LivingWorldDefinitionRaw, seed: string): LivingStateRaw;
366
+ export {};