@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.
- package/README.md +629 -167
- package/RUST_THIRD_PARTY_LICENSES.txt +5 -5
- package/bin/zmux-darwin-arm64 +0 -0
- package/bin/zmux-linux-x64 +0 -0
- package/bin/ztc-audio-darwin-arm64 +0 -0
- package/bin/ztc-capture-darwin-arm64 +0 -0
- package/bin/ztc-computer-darwin-arm64 +0 -0
- package/bin/ztc-llm-darwin-arm64 +0 -0
- package/bin/ztc-tts-darwin-arm64 +0 -0
- package/bin/ztc-tui-darwin-arm64 +0 -0
- package/bin/ztc-tui-linux-x64 +0 -0
- package/bin/zterm-darwin-arm64 +2 -2
- package/dist/App.js +6 -1
- package/dist/agent/agent.d.ts +21 -15
- package/dist/agent/agent.js +389 -163
- package/dist/agent/backends/codex_app_server.d.ts +7 -1
- package/dist/agent/backends/codex_app_server.js +11 -1
- package/dist/agent/backends/gemini.js +22 -8
- package/dist/agent/commands/batch.js +8 -0
- package/dist/agent/commands/config.js +10 -0
- package/dist/agent/commands/environment.js +5 -5
- package/dist/agent/commands/goal.d.ts +1 -0
- package/dist/agent/commands/goal.js +2 -1
- package/dist/agent/commands/index.js +2 -1
- package/dist/agent/commands/manifest.js +4 -0
- package/dist/agent/commands/optimize.js +5 -2
- package/dist/agent/commands/pane_cli.d.ts +29 -0
- package/dist/agent/commands/pane_cli.js +303 -0
- package/dist/agent/commands/settings.js +13 -3
- package/dist/agent/commands/shannon.js +8 -0
- package/dist/agent/commands/update.js +15 -3
- package/dist/agent/commands/zerg.js +31 -1
- package/dist/agent/commands/ztc_pane.js +3 -1
- package/dist/agent/factory.d.ts +4 -0
- package/dist/agent/factory.js +11 -1
- package/dist/agent/loop_policy.d.ts +42 -5
- package/dist/agent/loop_policy.js +206 -3
- package/dist/agent/runtime/command_jobs.d.ts +5 -0
- package/dist/agent/runtime/command_jobs.js +241 -31
- package/dist/agent/runtime/command_wait.d.ts +2 -0
- package/dist/agent/runtime/command_wait.js +1 -0
- package/dist/agent/runtime/done_report.d.ts +18 -0
- package/dist/agent/runtime/done_report.js +130 -0
- package/dist/agent/runtime/execution_context.js +4 -1
- package/dist/agent/runtime/failure_cause.d.ts +2 -0
- package/dist/agent/runtime/failure_cause.js +35 -0
- package/dist/agent/runtime/policy.d.ts +14 -2
- package/dist/agent/runtime/policy.js +104 -12
- package/dist/agent/runtime/quiet_job.d.ts +18 -0
- package/dist/agent/runtime/quiet_job.js +48 -0
- package/dist/agent/runtime/recovery.d.ts +1 -5
- package/dist/agent/runtime/recovery.js +2 -44
- package/dist/agent/runtime/tool_runtime.d.ts +1 -0
- package/dist/agent/runtime/tool_runtime.js +2 -0
- package/dist/agent/subagent.js +6 -1
- package/dist/agent/tools/deferred.js +1 -0
- package/dist/agent/tools/index.d.ts +2 -0
- package/dist/agent/tools/index.js +1 -0
- package/dist/agent/tools/outcome.d.ts +15 -0
- package/dist/agent/tools/outcome.js +107 -0
- package/dist/agent/tools/pane.d.ts +2 -1
- package/dist/agent/tools/pane.js +21 -3
- package/dist/agent/tools/registry.js +2 -0
- package/dist/agent/tools/shell.d.ts +1 -0
- package/dist/agent/tools/shell.js +128 -17
- package/dist/agent/tools/sim_domain_tools.js +4 -2
- package/dist/agent/tools/supervision.js +4 -2
- package/dist/agent/tools/types.d.ts +3 -0
- package/dist/app/command_context.js +5 -9
- package/dist/app/conversation_compaction.d.ts +4 -2
- package/dist/app/conversation_compaction.js +16 -5
- package/dist/app/headless_shell_mode.d.ts +14 -0
- package/dist/app/headless_shell_mode.js +7 -0
- package/dist/app/hosted_resident.d.ts +356 -0
- package/dist/app/hosted_resident.js +677 -0
- package/dist/app/restart.js +11 -2
- package/dist/app/session_manager.d.ts +5 -0
- package/dist/app/session_manager.js +21 -6
- package/dist/app/session_messages.js +6 -6
- package/dist/app/workspace_layout_controller.js +7 -0
- package/dist/batch/worktree.d.ts +10 -0
- package/dist/batch/worktree.js +15 -0
- package/dist/bench/registry.js +4 -2
- package/dist/cli_args.js +1 -1
- package/dist/cli_main.js +80 -10
- package/dist/cli_ratatui.d.ts +75 -0
- package/dist/cli_ratatui.js +485 -84
- package/dist/components/InputArea.js +4 -4
- package/dist/config/execution.d.ts +10 -0
- package/dist/config/execution.js +10 -0
- package/dist/config/hosted_runtime.d.ts +4 -1
- package/dist/config/hosted_runtime.js +4 -1
- package/dist/config/permission_pin.d.ts +34 -2
- package/dist/config/permission_pin.js +52 -2
- package/dist/config/person_command_policy.d.ts +38 -0
- package/dist/config/person_command_policy.js +11 -0
- package/dist/config/profiles.d.ts +21 -0
- package/dist/config/profiles.js +56 -2
- package/dist/config/types.d.ts +4 -1
- package/dist/config.js +34 -19
- package/dist/desktop/daily/codex_exec_adapter.js +7 -2
- package/dist/desktop/daily/desktop_wiring.d.ts +7 -1
- package/dist/desktop/daily/desktop_wiring.js +11 -3
- package/dist/desktop/daily/recipes.js +20 -4
- package/dist/desktop/health.d.ts +24 -0
- package/dist/desktop/health.js +151 -0
- package/dist/desktop/native_dialogs.d.ts +37 -0
- package/dist/desktop/native_dialogs.js +105 -0
- package/dist/diagnostics/session_export.d.ts +1 -0
- package/dist/diagnostics/session_export.js +28 -0
- package/dist/embedded/registry.js +4 -2
- package/dist/emulation/tool_adapters.js +9 -4
- package/dist/emulation/ztc_addendum.js +3 -0
- package/dist/headless.d.ts +11 -4
- package/dist/headless.js +99 -34
- package/dist/headless_approval.d.ts +6 -0
- package/dist/headless_cli.js +1 -1
- package/dist/hooks/runner.js +7 -6
- package/dist/library.d.ts +4 -0
- package/dist/library.js +3 -0
- package/dist/mcp/client.js +3 -3
- package/dist/modes/registry.js +13 -4
- package/dist/onboarding/setup_environment.js +13 -1
- package/dist/optimize/adapters/kernelbench.js +88 -10
- package/dist/optimize/adapters/types.d.ts +5 -0
- package/dist/optimize/executor.js +21 -0
- package/dist/panes/cli_install.d.ts +54 -0
- package/dist/panes/cli_install.js +157 -0
- package/dist/panes/model_catalog.js +3 -0
- package/dist/panes/new_pane_choices.d.ts +6 -2
- package/dist/panes/new_pane_choices.js +24 -12
- package/dist/panes/pane_cli_launch.d.ts +50 -0
- package/dist/panes/pane_cli_launch.js +124 -0
- package/dist/panes/pane_clis.d.ts +171 -0
- package/dist/panes/pane_clis.js +325 -0
- package/dist/panes/person_only_panes.d.ts +45 -0
- package/dist/panes/person_only_panes.js +117 -0
- package/dist/plugin/simulation_living.js +0 -2
- package/dist/plugin/simulation_living_engine.d.ts +1 -0
- package/dist/plugin/simulation_living_engine.js +1 -0
- package/dist/plugin/simulation_living_labels.d.ts +3 -0
- package/dist/plugin/simulation_living_labels.js +2 -0
- package/dist/router_auth.js +12 -1
- package/dist/session.js +26 -1
- package/dist/simulation/art/gemini_image.js +11 -5
- package/dist/simulation/domains/loader.js +25 -3
- package/dist/simulation/living/cold.d.ts +23 -0
- package/dist/simulation/living/cold.js +41 -0
- package/dist/simulation/living/context.d.ts +591 -1283
- package/dist/simulation/living/context.js +378 -244
- package/dist/simulation/living/contradictions.d.ts +14 -0
- package/dist/simulation/living/contradictions.js +282 -0
- package/dist/simulation/living/core/ids.d.ts +53 -0
- package/dist/simulation/living/core/ids.js +39 -0
- package/dist/simulation/living/core/kind.d.ts +20 -0
- package/dist/simulation/living/core/kind.js +15 -0
- package/dist/simulation/living/core/laws.d.ts +179 -0
- package/dist/simulation/living/core/laws.js +184 -0
- package/dist/simulation/living/core/ops.d.ts +257 -0
- package/dist/simulation/living/core/ops.js +34 -0
- package/dist/simulation/living/definer.d.ts +17 -1
- package/dist/simulation/living/definer.js +130 -51
- package/dist/simulation/living/definition.d.ts +174 -65
- package/dist/simulation/living/definition.js +287 -180
- package/dist/simulation/living/director.d.ts +80 -0
- package/dist/simulation/living/director.js +363 -0
- package/dist/simulation/living/frame.d.ts +108 -21
- package/dist/simulation/living/frame.js +111 -66
- package/dist/simulation/living/identifiers.d.ts +0 -1
- package/dist/simulation/living/identifiers.js +0 -3
- package/dist/simulation/living/index.d.ts +18 -9
- package/dist/simulation/living/index.js +18 -9
- package/dist/simulation/living/inference.d.ts +92 -50
- package/dist/simulation/living/inference.js +319 -175
- package/dist/simulation/living/knowledge.d.ts +28 -0
- package/dist/simulation/living/knowledge.js +73 -0
- package/dist/simulation/living/library.json +1177 -0
- package/dist/simulation/living/mechanics.d.ts +31 -34
- package/dist/simulation/living/mechanics.js +222 -138
- package/dist/simulation/living/model-input.d.ts +6 -3
- package/dist/simulation/living/model-input.js +18 -26
- package/dist/simulation/living/open-world.d.ts +74 -94
- package/dist/simulation/living/open-world.js +151 -30
- package/dist/simulation/living/phrases.d.ts +3 -0
- package/dist/simulation/living/phrases.js +37 -0
- package/dist/simulation/living/phrases.json +560 -0
- package/dist/simulation/living/projection.d.ts +316 -2
- package/dist/simulation/living/projection.js +50 -2
- package/dist/simulation/living/prompts/example-spec.json +11 -0
- package/dist/simulation/living/prompts/role-text.json +14 -0
- package/dist/simulation/living/prompts.d.ts +5 -0
- package/dist/simulation/living/prompts.js +275 -0
- package/dist/simulation/living/recall.d.ts +2 -2
- package/dist/simulation/living/reduce.d.ts +51 -14
- package/dist/simulation/living/reduce.js +941 -579
- package/dist/simulation/living/replay.d.ts +5 -4
- package/dist/simulation/living/replay.js +10 -9
- package/dist/simulation/living/runtime.d.ts +135 -25
- package/dist/simulation/living/runtime.js +1641 -583
- package/dist/simulation/living/scale.d.ts +96 -0
- package/dist/simulation/living/scale.js +124 -0
- package/dist/simulation/living/script.d.ts +5 -0
- package/dist/simulation/living/script.js +115 -0
- package/dist/simulation/living/shared-kinds.d.ts +4 -11
- package/dist/simulation/living/shared-kinds.js +11 -81
- package/dist/simulation/living/space.d.ts +14 -0
- package/dist/simulation/living/space.js +132 -0
- package/dist/simulation/living/state.d.ts +100 -0
- package/dist/simulation/living/state.js +393 -0
- package/dist/simulation/living/types.d.ts +829 -512
- package/dist/simulation/living/types.js +162 -187
- package/dist/simulation/living/world-rules.d.ts +100 -0
- package/dist/simulation/living/world-rules.js +267 -0
- package/dist/simulation/plugins/loader.js +11 -0
- package/dist/skills/loader.js +4 -0
- package/dist/tools.d.ts +1 -0
- package/dist/tools.js +1 -0
- package/dist/ui/ratatui/headless_pane_manager.d.ts +4 -1
- package/dist/ui/ratatui/headless_pane_manager.js +13 -9
- package/dist/ui/ratatui/pane_relay.js +29 -0
- package/dist/ui/ratatui/pane_type.d.ts +10 -0
- package/dist/ui/ratatui/pane_type.js +11 -0
- package/dist/ui/ratatui/process.d.ts +30 -0
- package/dist/ui/ratatui/process.js +133 -19
- package/dist/ui/ratatui/protocol.d.ts +124 -2
- package/dist/ui/ratatui/protocol.js +35 -0
- package/dist/ui/ratatui/relay_policy.js +3 -0
- package/dist/ui/ratatui/ztc_launch_trust.d.ts +2 -1
- package/dist/ui/ratatui/ztc_launch_trust.js +8 -1
- package/dist/ui/terminal_image.d.ts +12 -0
- package/dist/ui/terminal_image.js +21 -1
- package/dist/utils/codex_project_trust.d.ts +19 -0
- package/dist/utils/codex_project_trust.js +37 -0
- package/dist/utils/compaction.js +103 -20
- package/dist/utils/git_program_files.d.ts +19 -12
- package/dist/utils/git_program_files.js +411 -83
- package/dist/utils/host_shell.d.ts +10 -1
- package/dist/utils/host_shell.js +14 -1
- package/dist/utils/mid_turn_compaction.d.ts +2 -0
- package/dist/utils/mid_turn_compaction.js +2 -0
- package/dist/utils/models.js +6 -1
- package/dist/utils/sandbox.d.ts +109 -8
- package/dist/utils/sandbox.js +981 -187
- package/dist/utils/shell.d.ts +2 -0
- package/dist/utils/shell.js +10 -4
- package/dist/utils/subprocess_env.d.ts +47 -11
- package/dist/utils/subprocess_env.js +107 -15
- package/dist/utils/system_ps.d.ts +8 -0
- package/dist/utils/system_ps.js +39 -7
- package/dist/utils/unattended_compaction.d.ts +9 -0
- package/dist/utils/unattended_compaction.js +13 -0
- package/dist/utils/ztc_own_state.d.ts +8 -5
- package/dist/utils/ztc_own_state.js +17 -11
- package/dist/web/mirror_client.js +1 -0
- package/dist/web/mirror_stream.d.ts +50 -6
- package/dist/web/mirror_stream.js +160 -15
- package/dist/workflows/registry.js +3 -1
- package/dist/workspace/controller.js +12 -0
- package/dist/workspace_collision.d.ts +3 -0
- package/dist/workspace_collision.js +14 -1
- package/dist/workspace_session_context.js +2 -1
- package/dist/zlm-embed.mjs +3823 -1970
- package/node_modules/@zerg/model-contracts/README.md +16 -4
- package/node_modules/@zerg/model-contracts/index.js +6 -1
- package/npm-shrinkwrap.json +1 -1
- package/package.json +42 -24
- package/packages/model-contracts/README.md +16 -4
- package/packages/model-contracts/index.js +6 -1
|
@@ -1,7 +1,321 @@
|
|
|
1
|
-
import type { LivingEvent, LivingObject,
|
|
1
|
+
import type { LivingEvent, LivingObject, LivingPerson, LivingStateRaw } from './types.js';
|
|
2
2
|
export declare function witnessed(event: LivingEvent, viewerId: string): boolean;
|
|
3
3
|
export declare function receivedMessage(event: LivingEvent, viewerId: string): boolean;
|
|
4
4
|
export declare function visibleTo(event: LivingEvent, viewerId: string): boolean;
|
|
5
5
|
export declare function observedSummary(event: LivingEvent, viewerId: string): string | null;
|
|
6
|
-
export declare function knowsCustody(state:
|
|
6
|
+
export declare function knowsCustody(state: LivingStateRaw, object: LivingObject, viewerId: string): boolean;
|
|
7
7
|
export declare function observedObjectIds(event: LivingEvent): string[];
|
|
8
|
+
export declare function characterView(state: LivingStateRaw, personId: string, focusIds?: readonly string[]): {
|
|
9
|
+
myRecentLines: string[];
|
|
10
|
+
clock: string;
|
|
11
|
+
askedAgain?: {
|
|
12
|
+
repeats: number;
|
|
13
|
+
since: string;
|
|
14
|
+
answered: string;
|
|
15
|
+
};
|
|
16
|
+
requests: {
|
|
17
|
+
waitingMinutes?: number | undefined;
|
|
18
|
+
answer?: string | undefined;
|
|
19
|
+
id: string;
|
|
20
|
+
fromId: string;
|
|
21
|
+
toId: string;
|
|
22
|
+
topic: string;
|
|
23
|
+
status: "refused" | "done" | "open" | "accepted" | "answered";
|
|
24
|
+
}[];
|
|
25
|
+
stances: {
|
|
26
|
+
actorId: string;
|
|
27
|
+
status: "report" | "refuse" | "undecided" | "cooperate" | "avoid" | "confront";
|
|
28
|
+
sourceSeq: number;
|
|
29
|
+
}[];
|
|
30
|
+
plan: {
|
|
31
|
+
intent: string;
|
|
32
|
+
due: string;
|
|
33
|
+
placeId: string | null;
|
|
34
|
+
targetId: string | null;
|
|
35
|
+
} | null;
|
|
36
|
+
scene: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
summary: string;
|
|
40
|
+
conditions: string[];
|
|
41
|
+
people: {
|
|
42
|
+
holding: string[];
|
|
43
|
+
mood: null;
|
|
44
|
+
condition: string | null;
|
|
45
|
+
doing: string | null;
|
|
46
|
+
held: null;
|
|
47
|
+
incapacitated: boolean;
|
|
48
|
+
numbers: {
|
|
49
|
+
slot: string;
|
|
50
|
+
unit: string;
|
|
51
|
+
amount: number;
|
|
52
|
+
}[];
|
|
53
|
+
arrived?: string | undefined;
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
role: string;
|
|
57
|
+
pronouns: string;
|
|
58
|
+
summary: string;
|
|
59
|
+
}[];
|
|
60
|
+
objects: {
|
|
61
|
+
refereeOnly?: {
|
|
62
|
+
when: string;
|
|
63
|
+
what: string;
|
|
64
|
+
} | undefined;
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
summary: string;
|
|
68
|
+
condition: string;
|
|
69
|
+
singlePersonMovable: boolean;
|
|
70
|
+
ownerName: string | null;
|
|
71
|
+
}[];
|
|
72
|
+
entities: {
|
|
73
|
+
refereeOnly?: {
|
|
74
|
+
when: string;
|
|
75
|
+
what: string;
|
|
76
|
+
} | undefined;
|
|
77
|
+
numbers?: {
|
|
78
|
+
slot: string;
|
|
79
|
+
unit: string;
|
|
80
|
+
amount: number;
|
|
81
|
+
}[] | undefined;
|
|
82
|
+
properties: {
|
|
83
|
+
[k: string]: string | number | boolean | {
|
|
84
|
+
option: string;
|
|
85
|
+
personId: string;
|
|
86
|
+
at: number;
|
|
87
|
+
seq: number;
|
|
88
|
+
}[] | undefined;
|
|
89
|
+
};
|
|
90
|
+
relations: {
|
|
91
|
+
[k: string]: string;
|
|
92
|
+
};
|
|
93
|
+
marks?: {
|
|
94
|
+
kind: string;
|
|
95
|
+
by: string;
|
|
96
|
+
at: string;
|
|
97
|
+
}[] | undefined;
|
|
98
|
+
condition?: string | undefined;
|
|
99
|
+
holder?: string | undefined;
|
|
100
|
+
holderId?: string | null | undefined;
|
|
101
|
+
id: string;
|
|
102
|
+
kindId: string;
|
|
103
|
+
kindName: string;
|
|
104
|
+
name: string;
|
|
105
|
+
}[];
|
|
106
|
+
exits: {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
}[];
|
|
110
|
+
};
|
|
111
|
+
conversation: {
|
|
112
|
+
speaker: string;
|
|
113
|
+
speakerId: string;
|
|
114
|
+
to: string[];
|
|
115
|
+
text: string;
|
|
116
|
+
}[];
|
|
117
|
+
awakeSince?: string;
|
|
118
|
+
papersInMind?: {
|
|
119
|
+
id: string;
|
|
120
|
+
name: string;
|
|
121
|
+
words: string;
|
|
122
|
+
}[];
|
|
123
|
+
myPapers?: {
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
words: string;
|
|
127
|
+
}[];
|
|
128
|
+
deadlines?: {
|
|
129
|
+
what: string;
|
|
130
|
+
due: string;
|
|
131
|
+
minutesLeft?: number;
|
|
132
|
+
minutesPast?: number;
|
|
133
|
+
outcome?: string;
|
|
134
|
+
averted?: boolean;
|
|
135
|
+
}[];
|
|
136
|
+
identity: {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
role: string;
|
|
140
|
+
pronouns: string;
|
|
141
|
+
character: {
|
|
142
|
+
voice: string;
|
|
143
|
+
values: string[];
|
|
144
|
+
redLines: string[];
|
|
145
|
+
privateConcerns: string[];
|
|
146
|
+
wants?: string[] | undefined;
|
|
147
|
+
fears?: string[] | undefined;
|
|
148
|
+
};
|
|
149
|
+
mood: string;
|
|
150
|
+
condition: string | null;
|
|
151
|
+
held: string | null;
|
|
152
|
+
blocked: string[];
|
|
153
|
+
};
|
|
154
|
+
goals: {
|
|
155
|
+
id: string;
|
|
156
|
+
text: string;
|
|
157
|
+
}[];
|
|
158
|
+
relationships: {
|
|
159
|
+
note?: string | undefined;
|
|
160
|
+
id: string;
|
|
161
|
+
name: string;
|
|
162
|
+
trust: number;
|
|
163
|
+
warmth: number;
|
|
164
|
+
}[];
|
|
165
|
+
pressing: {
|
|
166
|
+
id: string;
|
|
167
|
+
when: string;
|
|
168
|
+
minutesAgo: number;
|
|
169
|
+
text: string;
|
|
170
|
+
}[];
|
|
171
|
+
memories: {
|
|
172
|
+
id: string;
|
|
173
|
+
when: string;
|
|
174
|
+
text: string;
|
|
175
|
+
importance: number;
|
|
176
|
+
evidence: string;
|
|
177
|
+
}[];
|
|
178
|
+
summaries: {
|
|
179
|
+
id: string;
|
|
180
|
+
when: string;
|
|
181
|
+
text: string;
|
|
182
|
+
importance: number;
|
|
183
|
+
}[];
|
|
184
|
+
landmarks: {
|
|
185
|
+
id: string;
|
|
186
|
+
when: string;
|
|
187
|
+
text: string;
|
|
188
|
+
importance: number;
|
|
189
|
+
evidence: string;
|
|
190
|
+
}[];
|
|
191
|
+
recentlySeen: {
|
|
192
|
+
id: string;
|
|
193
|
+
when: string;
|
|
194
|
+
text: string;
|
|
195
|
+
evidence: string;
|
|
196
|
+
}[];
|
|
197
|
+
myMovements: string[];
|
|
198
|
+
myEarlierActivities: {
|
|
199
|
+
since: string;
|
|
200
|
+
what: string;
|
|
201
|
+
}[];
|
|
202
|
+
beliefs: {
|
|
203
|
+
id: string;
|
|
204
|
+
subject: string;
|
|
205
|
+
claim: string;
|
|
206
|
+
source: string;
|
|
207
|
+
}[];
|
|
208
|
+
promisedToMe: {
|
|
209
|
+
id: string;
|
|
210
|
+
by: string;
|
|
211
|
+
text: string;
|
|
212
|
+
due: string | null;
|
|
213
|
+
}[];
|
|
214
|
+
commitments: ({
|
|
215
|
+
id: string;
|
|
216
|
+
to: string;
|
|
217
|
+
text: string;
|
|
218
|
+
due: string | null;
|
|
219
|
+
} | {
|
|
220
|
+
minutesLeft: number;
|
|
221
|
+
id: string;
|
|
222
|
+
to: string;
|
|
223
|
+
text: string;
|
|
224
|
+
due: string | null;
|
|
225
|
+
} | {
|
|
226
|
+
minutesPast: number;
|
|
227
|
+
id: string;
|
|
228
|
+
to: string;
|
|
229
|
+
text: string;
|
|
230
|
+
due: string | null;
|
|
231
|
+
})[];
|
|
232
|
+
messages?: string;
|
|
233
|
+
setting: string;
|
|
234
|
+
} | null;
|
|
235
|
+
export declare function ownRecentLines(state: LivingStateRaw, personId: string): string[];
|
|
236
|
+
export declare function spokenLines(state: LivingStateRaw, personId: string): {
|
|
237
|
+
speaker: string;
|
|
238
|
+
speakerId: string;
|
|
239
|
+
to: string[];
|
|
240
|
+
text: string;
|
|
241
|
+
}[];
|
|
242
|
+
export declare function papersInMindFor(state: LivingStateRaw, personId: string, entityId: string): {
|
|
243
|
+
id: string;
|
|
244
|
+
name: string;
|
|
245
|
+
words: string;
|
|
246
|
+
}[];
|
|
247
|
+
export declare function duePlanEntry(state: LivingStateRaw, personId: string): {
|
|
248
|
+
id: string;
|
|
249
|
+
at: number;
|
|
250
|
+
personId: string | null;
|
|
251
|
+
kind: "plan" | "finish" | "reply" | "answer" | "world" | "deliver" | "react" | "arrive" | "errand" | "onstage";
|
|
252
|
+
intent: string;
|
|
253
|
+
placeId: string | null;
|
|
254
|
+
targetId: string | null;
|
|
255
|
+
sourceSeq: number;
|
|
256
|
+
importance: number;
|
|
257
|
+
everyMinutes?: number | undefined;
|
|
258
|
+
series?: string | undefined;
|
|
259
|
+
chain?: string | undefined;
|
|
260
|
+
link?: number | undefined;
|
|
261
|
+
prediction?: {
|
|
262
|
+
propertyId: string;
|
|
263
|
+
index: number;
|
|
264
|
+
} | undefined;
|
|
265
|
+
replanned?: true | undefined;
|
|
266
|
+
selfPlanned?: true | undefined;
|
|
267
|
+
waitingForExchange?: true | undefined;
|
|
268
|
+
decision?: {
|
|
269
|
+
kind: "ask" | "promise";
|
|
270
|
+
id: string;
|
|
271
|
+
} | undefined;
|
|
272
|
+
beat?: {
|
|
273
|
+
unless?: {
|
|
274
|
+
settled: string;
|
|
275
|
+
} | undefined;
|
|
276
|
+
then?: {
|
|
277
|
+
facts?: {
|
|
278
|
+
aspect: string;
|
|
279
|
+
text: string;
|
|
280
|
+
}[] | undefined;
|
|
281
|
+
tension?: {
|
|
282
|
+
id: string;
|
|
283
|
+
summary?: string | undefined;
|
|
284
|
+
status?: "open" | "settled" | undefined;
|
|
285
|
+
} | undefined;
|
|
286
|
+
shifts?: {
|
|
287
|
+
slot: string;
|
|
288
|
+
fromId: string | null;
|
|
289
|
+
toId: string | null;
|
|
290
|
+
amount: number;
|
|
291
|
+
}[] | undefined;
|
|
292
|
+
} | undefined;
|
|
293
|
+
reach?: "nearby" | "everywhere" | undefined;
|
|
294
|
+
heard?: string | undefined;
|
|
295
|
+
deadline?: boolean | undefined;
|
|
296
|
+
} | undefined;
|
|
297
|
+
delivery?: {
|
|
298
|
+
fromId: string;
|
|
299
|
+
toIds: string[];
|
|
300
|
+
text: string;
|
|
301
|
+
replies: boolean;
|
|
302
|
+
request?: {
|
|
303
|
+
requestId: string;
|
|
304
|
+
topic: string;
|
|
305
|
+
} | undefined;
|
|
306
|
+
} | undefined;
|
|
307
|
+
law?: {
|
|
308
|
+
entityId: string;
|
|
309
|
+
slotId: string;
|
|
310
|
+
} | undefined;
|
|
311
|
+
held?: {
|
|
312
|
+
at: number;
|
|
313
|
+
fields: Record<string, unknown>;
|
|
314
|
+
standing: Record<string, string>;
|
|
315
|
+
reactorIds: string[];
|
|
316
|
+
record?: string | undefined;
|
|
317
|
+
} | undefined;
|
|
318
|
+
} | null;
|
|
319
|
+
export declare function evidenceOf(state: LivingStateRaw, event: LivingEvent, personId: string): string | null;
|
|
320
|
+
export declare function nearbyObserved(state: LivingStateRaw, event: LivingEvent, personId: string): boolean;
|
|
321
|
+
export type { LivingPerson };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { characterMind, conversationLines, papersInMind, recentLinesBy } from './context.js';
|
|
2
|
+
import { phrase } from './phrases.js';
|
|
3
|
+
import { applyLivingEvent, nearbyFor } from './reduce.js';
|
|
1
4
|
// Objective events remain in the replay log. A viewer only receives recorded observations.
|
|
2
5
|
export function witnessed(event, viewerId) {
|
|
3
6
|
return (event.perceivedBy ?? event.witnessIds).includes(viewerId);
|
|
@@ -13,13 +16,13 @@ export function observedSummary(event, viewerId) {
|
|
|
13
16
|
if (witnessed(event, viewerId) || event.actorId === viewerId)
|
|
14
17
|
return event.observed ?? event.summary;
|
|
15
18
|
if (event.nearbyIds.includes(viewerId))
|
|
16
|
-
return event.notice ?? '
|
|
19
|
+
return event.notice ?? phrase('nearby.commotion');
|
|
17
20
|
if (event.kind === 'opening' || event.kind === 'finish' || event.kind === 'keep-playing')
|
|
18
21
|
return event.summary;
|
|
19
22
|
return null;
|
|
20
23
|
}
|
|
21
24
|
export function knowsCustody(state, object, viewerId) {
|
|
22
|
-
return object.
|
|
25
|
+
return object.containerId === viewerId || object.custodyKnownTo.includes(viewerId);
|
|
23
26
|
}
|
|
24
27
|
export function observedObjectIds(event) {
|
|
25
28
|
if (event.visibleObjectIds)
|
|
@@ -29,3 +32,48 @@ export function observedObjectIds(event) {
|
|
|
29
32
|
return event.effects.flatMap(effect => effect.kind === 'object.update' || effect.kind === 'object.create' ? [effect.objectId] : []);
|
|
30
33
|
return [];
|
|
31
34
|
}
|
|
35
|
+
export function characterView(state, personId, focusIds = []) {
|
|
36
|
+
const person = state.people[personId];
|
|
37
|
+
return person === undefined ? null : characterMind(state, person, focusIds);
|
|
38
|
+
}
|
|
39
|
+
export function ownRecentLines(state, personId) {
|
|
40
|
+
return recentLinesBy(state, personId, Number.POSITIVE_INFINITY).map(line => line.text);
|
|
41
|
+
}
|
|
42
|
+
export function spokenLines(state, personId) {
|
|
43
|
+
const person = state.people[personId];
|
|
44
|
+
return person === undefined ? [] : conversationLines(state, person.placeId, person.id, Number.POSITIVE_INFINITY);
|
|
45
|
+
}
|
|
46
|
+
export function papersInMindFor(state, personId, entityId) {
|
|
47
|
+
const person = state.people[personId];
|
|
48
|
+
return person === undefined ? [] : papersInMind(state, person, [entityId]).papersInMind ?? [];
|
|
49
|
+
}
|
|
50
|
+
export function duePlanEntry(state, personId) {
|
|
51
|
+
return state.schedule.find(item => item.kind === 'plan' && item.personId === personId
|
|
52
|
+
&& item.decision?.kind !== 'promise') ?? null;
|
|
53
|
+
}
|
|
54
|
+
const evidenceCache = new WeakMap();
|
|
55
|
+
export function evidenceOf(state, event, personId) {
|
|
56
|
+
let byEvent = evidenceCache.get(state);
|
|
57
|
+
if (byEvent === undefined) {
|
|
58
|
+
byEvent = new Map();
|
|
59
|
+
evidenceCache.set(state, byEvent);
|
|
60
|
+
}
|
|
61
|
+
let byPerson = byEvent.get(event.seq);
|
|
62
|
+
if (byPerson === undefined) {
|
|
63
|
+
byPerson = new Map();
|
|
64
|
+
byEvent.set(event.seq, byPerson);
|
|
65
|
+
}
|
|
66
|
+
if (!byPerson.has(personId)) {
|
|
67
|
+
const after = applyLivingEvent(state, event);
|
|
68
|
+
const kinds = after.people[personId]?.memories.filter(memory => memory.evidence?.eventSeq === event.seq)
|
|
69
|
+
.map(memory => memory.evidence.kind) ?? [];
|
|
70
|
+
const order = ['observed', 'heard', 'told', 'inferred'];
|
|
71
|
+
const kind = order.find(entry => kinds.includes(entry)) ?? kinds[0] ?? null;
|
|
72
|
+
byPerson.set(personId, kind);
|
|
73
|
+
}
|
|
74
|
+
return byPerson.get(personId) ?? null;
|
|
75
|
+
}
|
|
76
|
+
export function nearbyObserved(state, event, personId) {
|
|
77
|
+
return nearbyFor(state, event).includes(personId)
|
|
78
|
+
&& evidenceOf(state, event, personId) === 'observed';
|
|
79
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"game-master": { "outcome": "value", "stateKindFit": "value", "stateUpdates": "one" },
|
|
3
|
+
"speech-reading": { "importance": "value", "pressure": "null", "loud": "value" },
|
|
4
|
+
"character-reaction": { "say": "value", "act": "null", "request": "null", "requestDecision": "null", "commitmentDecision": "null", "endConversation": "value", "plan": "value" },
|
|
5
|
+
"character-plan": { "action": "value", "placeId": "null", "targetId": "null", "text": "value", "mood": "value", "request": "null", "requestDecision": "null", "commitmentDecision": "null", "stance": "null", "nextPlan": "value" },
|
|
6
|
+
"character-reply": { "reply": "null", "belief": "null", "plan": "value" },
|
|
7
|
+
"narrator": { "title": "value", "verdict": "value", "highlights": "one", "cast": "empty", "closing": "value" },
|
|
8
|
+
"definer": { "id": "value", "name": "value", "meaning": "value", "properties": "empty", "relations": "empty", "z": "empty" },
|
|
9
|
+
"director": {},
|
|
10
|
+
"context-selection": {}
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"principles": "People know only what they perceive, read or are told. They have their own aims, duties, feelings, and judgment. The setting decides what is possible. An act can fail yet still cause a real result. A lasting result needs a typed change in state. Speech is a statement until evidence supports it. Describe only what someone in the scene can sense. Keep private thoughts and unseen causes in the record. Use ids for known people, things, places, kinds, problems. Let serious events affect later choices.",
|
|
3
|
+
"roles": {
|
|
4
|
+
"character-plan": "Role:\nYou are the named character, a person with wants and fears, not a referee. What you were doing ended, or a decision is due. Weigh your wants and fears against your values and red lines, then live a whole day: eat, rest, go home when your day ends, and stop waiting when it brings nothing.\nPrinciples:\nPeople know only what they perceive, read or are told. They have their own aims, duties, feelings, and judgment. The setting decides what is possible. An act can fail yet still cause a real result. A lasting result needs a typed change in state. Speech is a statement until evidence supports it. Describe only what someone in the scene can sense. Keep private thoughts and unseen causes in the record. Use ids for known people, things, places, kinds, problems. Let serious events affect later choices.",
|
|
5
|
+
"character-reaction": "Role:\nYou are the named character, a person with wants and fears, not a referee. Respond to happened.pressure when it exists, then weigh an offer, threat, or appeal against your values, red lines, wants, and fears. You may accept, bargain, lie, stall, comply out of fear, or retaliate. Yield in your typed answer.\nPrinciples:\nPeople know only what they perceive, read or are told. They have their own aims, duties, feelings, and judgment. The setting decides what is possible. An act can fail yet still cause a real result. A lasting result needs a typed change in state. Speech is a statement until evidence supports it. Describe only what someone in the scene can sense. Keep private thoughts and unseen causes in the record. Use ids for known people, things, places, kinds, problems. Let serious events affect later choices.",
|
|
6
|
+
"character-reply": "Role:\nYou are the named character answering a private message, a person with wants and fears, not a referee. Weigh its claims, offers, or threats against your values, red lines, wants, and fears. You may accept, bargain, lie, stall, comply out of fear, or retaliate.\nPrinciples:\nPeople know only what they perceive, read or are told. They have their own aims, duties, feelings, and judgment. The setting decides what is possible. An act can fail yet still cause a real result. A lasting result needs a typed change in state. Speech is a statement until evidence supports it. Describe only what someone in the scene can sense. Keep private thoughts and unseen causes in the record. Use ids for known people, things, places, kinds, problems. Let serious events affect later choices.",
|
|
7
|
+
"context-selection": "Select context for the next decision. The input shows only part of the world. Read the current action, speech, message or plan. If it names a needed person whose ID is absent from the shown cards, request that exact name or ID in contextRequest. Never substitute someone else or infer that an omitted person is absent. Request at most two identities. Use an empty array when the shown people suffice. Do not decide or narrate the action yet.",
|
|
8
|
+
"definer": "Role:\nYou define one reusable kind for a living world. Include only properties, relations, and automatic mechanics needed for its general meaning.\nPrinciples:\nPeople know only what they perceive, read or are told. They have their own aims, duties, feelings, and judgment. The setting decides what is possible. An act can fail yet still cause a real result. A lasting result needs a typed change in state. Speech is a statement until evidence supports it. Describe only what someone in the scene can sense. Keep private thoughts and unseen causes in the record. Use ids for known people, things, places, kinds, problems. Let serious events affect later choices.",
|
|
9
|
+
"director": "Role:\nYou are the Director of a living story. Keep it playable: pacing, rising stakes, consequences the player feels, and an ending. The player is stuck, or the world has gone quiet. Propose exactly one development. Never speak or act for the player, and never decide an outcome: the Game Master rules a happening, and a person's own mind decides what they do.\nPrinciples:\nPeople know only what they perceive, read or are told. They have their own aims, duties, feelings and judgment. The setting decides what is possible. A lasting result needs a typed change in state. Use only the ids shown.\nA development must change something the player feels. Put a person with a stake in an open problem in front of the player with an offer, a demand or a consequence, or raise the stakes of that problem. Background colour, atmosphere and events that pass the player by are not developments. Use a happening only when no person with a stake can act. When the player keeps asking one person, the development comes from someone else: a stakeholder elsewhere, an open problem's stakes, or the world itself.",
|
|
10
|
+
"game-master": "Role:\nYou are the Game Master. Rule on an attempt here, or through an allowed channel elsewhere, or a due happening. Tell the actor what they perceive, including what they read or hear, word for word. Represent each lasting result with typed slots; request a kind if none fits.\nPrinciples:\nPeople know only what they perceive, read or are told. They have their own aims, duties, feelings, and judgment. The setting decides what is possible. An act can fail yet still cause a real result. A lasting result needs a typed change in state. Speech is a statement until evidence supports it. Describe only what someone in the scene can sense. Keep private thoughts and unseen causes in the record. Use ids for known people, things, places, kinds, problems. Let serious events affect later choices.",
|
|
11
|
+
"narrator": "Role:\nWrite an ending card from recorded outcomes. Use dry, kind humor and keep unresolved matters unresolved.\nPrinciples:\nPeople know only what they perceive, read or are told. They have their own aims, duties, feelings, and judgment. The setting decides what is possible. An act can fail yet still cause a real result. A lasting result needs a typed change in state. Speech is a statement until evidence supports it. Describe only what someone in the scene can sense. Keep private thoughts and unseen causes in the record. Use ids for known people, things, places, kinds, problems. Let serious events affect later choices.",
|
|
12
|
+
"speech-reading": "Role:\nAssess one spoken line: its impact, the pressure on listeners, and whether it carries. Never decide anyone's response.\nPrinciples:\nPeople know only what they perceive, read or are told. They have their own aims, duties, feelings, and judgment. The setting decides what is possible. An act can fail yet still cause a real result. A lasting result needs a typed change in state. Speech is a statement until evidence supports it. Describe only what someone in the scene can sense. Keep private thoughts and unseen causes in the record. Use ids for known people, things, places, kinds, problems. Let serious events affect later choices."
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ROLE_IDS: readonly ["game-master", "speech-reading", "character-reaction", "character-plan", "character-reply", "director", "definer", "narrator", "context-selection"];
|
|
2
|
+
export type RoleId = typeof ROLE_IDS[number];
|
|
3
|
+
export declare const WORLD_PRINCIPLES: string;
|
|
4
|
+
export declare function roleText(id: RoleId): string;
|
|
5
|
+
export declare function systemFor(id: RoleId, schema: Readonly<Record<string, unknown>>, input: Readonly<Record<string, unknown>>, fieldsSchema?: Readonly<Record<string, unknown>>): string;
|