@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,6 +1,7 @@
1
- import { type LivingWorldDefinition } from './definition.js';
2
- import { type LivingEvent, type LivingState } from './types.js';
3
- export declare function replayLivingWorld(definition: LivingWorldDefinition, seed: string, events: readonly LivingEvent[], engine?: number): LivingState;
4
- export declare function verifyLivingWorld(definition: LivingWorldDefinition, saved: LivingState, events: readonly LivingEvent[]): {
1
+ import { type LivingWorldDefinitionRaw } from './definition.js';
2
+ import { type LivingEvent, type LivingStateRaw } from './types.js';
3
+ import { type ColdStore } from './cold.js';
4
+ export declare function replayLivingWorld(definition: LivingWorldDefinitionRaw, seed: string, events: readonly LivingEvent[], cold?: ColdStore, admissionCapsFrom?: number): LivingStateRaw;
5
+ export declare function verifyLivingWorld(definition: LivingWorldDefinitionRaw, saved: LivingStateRaw, events: readonly LivingEvent[], cold?: ColdStore): {
5
6
  exact: boolean;
6
7
  };
@@ -1,20 +1,21 @@
1
1
  import { createLivingState } from './definition.js';
2
2
  import { foldLivingEvents } from './reduce.js';
3
+ import { capsBoundaryOf } from './state.js';
3
4
  import { LIVING_ENGINE_VERSION, LivingWorldError } from './types.js';
5
+ import { MemoryColdStore } from './cold.js';
4
6
  // Replay folds the saved events over the authored definition. It never asks a model
5
7
  // and never invents an outcome; a saved state that differs from the fold is rejected.
6
- // A state written by an older engine still has to load and replay without error, but
7
- // its rebuilt state may differ, so the comparison is made only within one engine version.
8
- // Replay folds under the engine version the save was made with, so version-gated rules match it.
9
- export function replayLivingWorld(definition, seed, events, engine = LIVING_ENGINE_VERSION) {
10
- return foldLivingEvents(createLivingState(definition, seed, engine), events);
8
+ export function replayLivingWorld(definition, seed, events, cold = new MemoryColdStore(), admissionCapsFrom = 1) {
9
+ const initial = createLivingState(definition, seed);
10
+ initial.admissionCapsFrom = admissionCapsFrom;
11
+ return foldLivingEvents(initial, events, cold);
11
12
  }
12
- export function verifyLivingWorld(definition, saved, events) {
13
- const replayed = replayLivingWorld(definition, saved.seed, events, saved.engine);
13
+ export function verifyLivingWorld(definition, saved, events, cold = new MemoryColdStore()) {
14
+ if (saved.engine !== LIVING_ENGINE_VERSION)
15
+ throw new LivingWorldError('engine-retired', `This world was made by engine ${saved.engine}; only engine ${LIVING_ENGINE_VERSION} worlds open.`);
16
+ const replayed = replayLivingWorld(definition, saved.seed, events, cold, capsBoundaryOf(saved));
14
17
  if (replayed.revision !== saved.revision)
15
18
  throw new LivingWorldError('replay-mismatch', `Replay reached revision ${replayed.revision}, saved state is at ${saved.revision}`);
16
- if (saved.engine !== LIVING_ENGINE_VERSION)
17
- return { exact: false };
18
19
  if (!isDeepStrictEqual(replayed, saved))
19
20
  throw new LivingWorldError('replay-mismatch', 'Replayed state differs from the saved state');
20
21
  return { exact: true };
@@ -1,7 +1,12 @@
1
- import { type LivingWorldDefinition } from './definition.js';
1
+ import { type LivingWorldDefinitionRaw } from './definition.js';
2
2
  import { type GmEffectRecord, type LivingInference, type LivingInferenceCall } from './inference.js';
3
3
  import type { LivingKindDefinition } from './open-world.js';
4
- import { type LivingEffect, type LivingEvent, type LivingState } from './types.js';
4
+ import { peopleAt } from './reduce.js';
5
+ import { type LivingCalendar } from './scale.js';
6
+ import { type LivingEffect, type LivingEvent, type LivingPerson, type LivingStateRaw } from './types.js';
7
+ import type { LivingState } from './types.js';
8
+ import type { ColdStore } from './cold.js';
9
+ export type LivingStateView = LivingState;
5
10
  export type LivingCommand = {
6
11
  kind: 'move';
7
12
  placeId: string;
@@ -23,9 +28,10 @@ export type LivingCommand = {
23
28
  } | {
24
29
  kind: 'finish';
25
30
  } | {
26
- kind: 'vote';
27
- decisionId: string;
28
- choice: 'yes' | 'no' | 'abstain';
31
+ kind: 'choose';
32
+ entityId: string;
33
+ slotId: string;
34
+ option: string;
29
35
  };
30
36
  export type LivingAuditRecord = {
31
37
  phase: LivingInferenceCall['phase'];
@@ -33,12 +39,13 @@ export type LivingAuditRecord = {
33
39
  actorId: string | null;
34
40
  status: 'accepted' | 'rejected' | 'failed';
35
41
  failureCode: string | null;
42
+ reasons?: string[];
36
43
  inputSha256: string;
37
44
  outputSha256: string | null;
38
45
  latencyMs: number;
39
46
  };
40
47
  export type LivingStep = {
41
- state: LivingState;
48
+ state: LivingStateRaw;
42
49
  events: LivingEvent[];
43
50
  audit: LivingAuditRecord[];
44
51
  modelCalls: number;
@@ -49,53 +56,74 @@ type DecisionTurn = {
49
56
  done: Promise<void>;
50
57
  end: () => void;
51
58
  };
59
+ type TurnGate = {
60
+ session: object;
61
+ count: number;
62
+ done: Promise<void>;
63
+ end: () => void;
64
+ };
52
65
  export type LivingWorldCell = {
53
- state: LivingState;
66
+ state: LivingStateRaw;
54
67
  readonly log?: LivingEvent[];
55
68
  turns?: Map<string, DecisionTurn>;
69
+ turnPriority?: Map<string, TurnGate>;
70
+ cold?: ColdStore;
71
+ onCommit?: (event: LivingEvent) => void;
72
+ onAnswering?: (personId: string, answering: boolean) => void;
56
73
  };
57
74
  export type LivingWork = {
58
75
  kind: 'recover';
59
76
  personId: string;
60
77
  } | {
61
78
  kind: 'due';
62
- item: LivingState['schedule'][number];
79
+ item: LivingStateRaw['schedule'][number];
63
80
  } | {
64
81
  kind: 'decide';
65
82
  personId: string;
83
+ } | {
84
+ kind: 'steward';
85
+ facet: string;
86
+ kindId: string;
66
87
  };
67
88
  export declare const MAX_DUE_ITEMS_PER_STEP = 2;
68
89
  export declare const MAX_DUE_ERRANDS_PER_STEP = 4;
69
90
  export declare const MAX_REACTORS = 2;
70
91
  export declare const MAX_MODEL_CALLS_PER_COMMAND = 6;
71
- export declare const MAX_NONPLAYER_MINUTES_PER_COMMAND = 20;
72
92
  export declare const SHOCK_IMPORTANCE = 7;
73
- export declare const SHOCK_PLAN_DELAY_MINUTES = 5;
74
- export declare const OTHERS_MAX_MINUTES = 10;
75
- export declare const LONG_ACT_MINUTES = 10;
76
- export declare const DEADLINE_GRACE_MINUTES = 15;
77
- export declare const ERRAND_DELAY_MINUTES = 3;
78
- export declare const SPEECH_MINUTES = 1;
79
- export declare const MESSAGE_MINUTES = 1;
80
- export declare const MESSAGE_REPLY_DELAY_MINUTES = 10;
81
- export declare const IDLE_WAIT_MINUTES = 60;
82
- export declare const OVERDUE_WAIT_MINUTES = 15;
83
93
  export declare const PLAYER_MAX_TEXT_BYTES = 2000;
84
- export declare const DEFAULT_ACTIVITY_MINUTES = 30;
94
+ export declare const OBJECTIVE_EFFECT_KINDS: ReadonlySet<string>;
95
+ export declare const EFFECT_KINDS: Readonly<{
96
+ say: "say";
97
+ message: "message";
98
+ requestOpen: "request.open";
99
+ requestUpdate: "request.update";
100
+ stance: "stance";
101
+ normViolation: "norm.violation";
102
+ }>;
103
+ export declare const EVENT_KINDS: Readonly<{
104
+ message: "message";
105
+ }>;
106
+ export declare const SCHEDULE_KINDS: Readonly<{
107
+ plan: "plan";
108
+ }>;
109
+ export declare const PLAN_OVERDUE_PACE: "defaultActivity";
110
+ export declare function planOverdueAfter(calendar: LivingCalendar): number;
85
111
  export declare function cleanMood(value: unknown, fallback: string): string;
86
- export declare function startLivingWorld(definition: LivingWorldDefinition, seed: string, nowMs?: number): LivingStep;
87
- export declare function livingClockTarget(state: LivingState, nowMs: number): number;
112
+ export declare function validateLivingWorldDefinition(value: unknown): LivingWorldDefinitionRaw;
113
+ export declare function startLivingWorld(definition: LivingWorldDefinitionRaw, seed: string, nowMs?: number): LivingStep;
114
+ export declare function livingClockTarget(state: LivingStateRaw, nowMs: number): number;
88
115
  export declare function setLivingClock(options: {
89
116
  cell: LivingWorldCell;
90
117
  paused?: boolean;
91
118
  rate?: number;
92
119
  nowMs: number;
120
+ hold?: boolean;
93
121
  }): LivingStep;
94
122
  export declare function tickLivingWorld(cell: LivingWorldCell, nowMs: number, options?: {
95
123
  limit?: number;
96
124
  idleMinutes?: number;
97
125
  }): LivingEvent | null;
98
- export declare function livingDueWork(state: LivingState): LivingWork[];
126
+ export declare function livingDueWork(state: LivingStateRaw): LivingWork[];
99
127
  type WorkOptions = {
100
128
  cell: LivingWorldCell;
101
129
  inference: LivingInference;
@@ -119,7 +147,7 @@ export declare function advanceLivingWorld(options: WorkOptions & {
119
147
  nowMs: number;
120
148
  }): Promise<LivingStep>;
121
149
  export declare function runLivingCommand(options: ({
122
- state: LivingState;
150
+ state: LivingStateRaw;
123
151
  cell?: undefined;
124
152
  } | {
125
153
  cell: LivingWorldCell;
@@ -132,9 +160,91 @@ export declare function runLivingCommand(options: ({
132
160
  tickLimit?: number;
133
161
  takenEntityIds?: (ids: readonly string[]) => Promise<ReadonlySet<string>>;
134
162
  }): Promise<LivingStep>;
135
- export declare function translateGmEffect(state: LivingState, record: GmEffectRecord, seq: number, index: number, placeId?: string | null, usedCreationIds?: ReadonlySet<string>): {
163
+ export declare function translateGmEffect(state: LivingStateRaw, record: GmEffectRecord, seq: number, index: number, placeId?: string | null, usedCreationIds?: ReadonlySet<string>): {
136
164
  effect: LivingEffect;
165
+ also?: LivingEffect[];
137
166
  } | {
138
167
  error: string;
139
168
  };
169
+ type Plan = {
170
+ intent: string;
171
+ seen?: string;
172
+ placeId: string | null;
173
+ targetId: string | null;
174
+ inMinutes: number;
175
+ };
176
+ export type Reaction = {
177
+ say: string | null;
178
+ request: {
179
+ topic: string;
180
+ receiverId: string;
181
+ priorId: string | null;
182
+ } | null;
183
+ requestDecision: {
184
+ id: string;
185
+ status: 'answered' | 'accepted' | 'refused' | 'done';
186
+ } | null;
187
+ commitmentDecision: {
188
+ id: string;
189
+ status: 'kept' | 'broken';
190
+ } | null;
191
+ answered: string | null;
192
+ act: string | null;
193
+ toIds: string[];
194
+ waitingOnIds: string[];
195
+ mood: string;
196
+ leaveToPlaceId: string | null;
197
+ trust: number;
198
+ warmth: number;
199
+ relationshipNote: string | null;
200
+ belief: {
201
+ subject: string;
202
+ claim: string;
203
+ } | null;
204
+ commitment: {
205
+ toId: string;
206
+ text: string;
207
+ dueInMinutes: number | null;
208
+ placeId: string | null;
209
+ } | null;
210
+ newGoal: string | null;
211
+ goalDone: string | null;
212
+ weight: number;
213
+ stance: 'undecided' | 'cooperate' | 'refuse' | 'report' | 'avoid' | 'confront' | null;
214
+ plan: Plan | null;
215
+ tell: {
216
+ targetId: string;
217
+ text: string;
218
+ } | null;
219
+ suggestedReplies: string[];
220
+ endConversation: boolean;
221
+ };
222
+ export declare function changesSomething(reaction: Reaction): boolean;
223
+ export type ReactionProblemFacts = {
224
+ phase: string;
225
+ causeSeq: number;
226
+ trigger: {
227
+ kind: string;
228
+ actorId: string | null;
229
+ };
230
+ budgetAllows: boolean;
231
+ };
232
+ export declare function reactionAnswerProblems(reaction: Reaction, state: Parameters<typeof reactionProblems>[1], personId: string, facts: ReactionProblemFacts): (ReactionProblem | string)[];
233
+ export type ReactionProblem = {
234
+ kind: 'unknown-request' | 'request-already-made' | 'request-not-open' | 'request-not-yours' | 'person-absent';
235
+ requestId: string | null;
236
+ status: string | null;
237
+ personId?: string;
238
+ };
239
+ export declare function presenceProblems(reaction: Reaction, state: Parameters<typeof peopleAt>[0], personId: string): ReactionProblem[];
240
+ export declare function reactionProblems(reaction: Reaction, state: LivingStateRaw, personId: string): ReactionProblem[];
241
+ export declare function parseReaction(answer: unknown, state: {
242
+ calendar: LivingCalendar;
243
+ }): Reaction;
244
+ export declare function duePlanCard(state: LivingStateRaw, person: LivingPerson, entry: LivingStateRaw['schedule'][number]): {
245
+ intent: string;
246
+ overdueMinutes?: number;
247
+ placeId?: string | null;
248
+ targetId?: string | null;
249
+ };
140
250
  export {};