@actalk/inkos-core 1.5.0 → 1.6.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 (187) hide show
  1. package/dist/agent/agent-session.d.ts +4 -0
  2. package/dist/agent/agent-session.d.ts.map +1 -1
  3. package/dist/agent/agent-session.js +78 -5
  4. package/dist/agent/agent-session.js.map +1 -1
  5. package/dist/agent/agent-system-prompt.d.ts +2 -0
  6. package/dist/agent/agent-system-prompt.d.ts.map +1 -1
  7. package/dist/agent/agent-system-prompt.js +181 -16
  8. package/dist/agent/agent-system-prompt.js.map +1 -1
  9. package/dist/agent/agent-tools.d.ts +97 -1
  10. package/dist/agent/agent-tools.d.ts.map +1 -1
  11. package/dist/agent/agent-tools.js +434 -3
  12. package/dist/agent/agent-tools.js.map +1 -1
  13. package/dist/agent/film-authoring-tools.d.ts +89 -0
  14. package/dist/agent/film-authoring-tools.d.ts.map +1 -0
  15. package/dist/agent/film-authoring-tools.js +336 -0
  16. package/dist/agent/film-authoring-tools.js.map +1 -0
  17. package/dist/agent/index.d.ts +2 -1
  18. package/dist/agent/index.d.ts.map +1 -1
  19. package/dist/agent/index.js +2 -1
  20. package/dist/agent/index.js.map +1 -1
  21. package/dist/agent/llm-stub.d.ts +19 -0
  22. package/dist/agent/llm-stub.d.ts.map +1 -0
  23. package/dist/agent/llm-stub.js +134 -0
  24. package/dist/agent/llm-stub.js.map +1 -0
  25. package/dist/agents/composer.d.ts.map +1 -1
  26. package/dist/agents/composer.js +24 -12
  27. package/dist/agents/composer.js.map +1 -1
  28. package/dist/agents/researcher.d.ts +38 -0
  29. package/dist/agents/researcher.d.ts.map +1 -0
  30. package/dist/agents/researcher.js +164 -0
  31. package/dist/agents/researcher.js.map +1 -0
  32. package/dist/agents/script-storyboard.d.ts +51 -0
  33. package/dist/agents/script-storyboard.d.ts.map +1 -0
  34. package/dist/agents/script-storyboard.js +368 -0
  35. package/dist/agents/script-storyboard.js.map +1 -0
  36. package/dist/index.d.ts +23 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +24 -2
  39. package/dist/index.js.map +1 -1
  40. package/dist/interaction/action-envelope.d.ts +669 -1
  41. package/dist/interaction/action-envelope.d.ts.map +1 -1
  42. package/dist/interaction/action-envelope.js +87 -0
  43. package/dist/interaction/action-envelope.js.map +1 -1
  44. package/dist/interaction/edit-controller.d.ts.map +1 -1
  45. package/dist/interaction/edit-controller.js +91 -1
  46. package/dist/interaction/edit-controller.js.map +1 -1
  47. package/dist/interaction/intents.d.ts +2 -2
  48. package/dist/interaction/project-control.d.ts +1 -1
  49. package/dist/interaction/session-transcript-schema.d.ts +22 -22
  50. package/dist/interaction/session.d.ts +14 -14
  51. package/dist/interaction/session.d.ts.map +1 -1
  52. package/dist/interaction/session.js +1 -1
  53. package/dist/interaction/session.js.map +1 -1
  54. package/dist/interactive-film/authoring-generate.d.ts +4 -0
  55. package/dist/interactive-film/authoring-generate.d.ts.map +1 -0
  56. package/dist/interactive-film/authoring-generate.js +16 -0
  57. package/dist/interactive-film/authoring-generate.js.map +1 -0
  58. package/dist/interactive-film/authoring-store.d.ts +35 -0
  59. package/dist/interactive-film/authoring-store.d.ts.map +1 -0
  60. package/dist/interactive-film/authoring-store.js +114 -0
  61. package/dist/interactive-film/authoring-store.js.map +1 -0
  62. package/dist/interactive-film/authoring-tools.d.ts +9 -0
  63. package/dist/interactive-film/authoring-tools.d.ts.map +1 -0
  64. package/dist/interactive-film/authoring-tools.js +19 -0
  65. package/dist/interactive-film/authoring-tools.js.map +1 -0
  66. package/dist/interactive-film/delta.d.ts +591 -0
  67. package/dist/interactive-film/delta.d.ts.map +1 -0
  68. package/dist/interactive-film/delta.js +54 -0
  69. package/dist/interactive-film/delta.js.map +1 -0
  70. package/dist/interactive-film/emotion.d.ts +20 -0
  71. package/dist/interactive-film/emotion.d.ts.map +1 -0
  72. package/dist/interactive-film/emotion.js +57 -0
  73. package/dist/interactive-film/emotion.js.map +1 -0
  74. package/dist/interactive-film/evaluator.d.ts +7 -0
  75. package/dist/interactive-film/evaluator.d.ts.map +1 -0
  76. package/dist/interactive-film/evaluator.js +40 -0
  77. package/dist/interactive-film/evaluator.js.map +1 -0
  78. package/dist/interactive-film/export-html.d.ts +6 -0
  79. package/dist/interactive-film/export-html.d.ts.map +1 -0
  80. package/dist/interactive-film/export-html.js +84 -0
  81. package/dist/interactive-film/export-html.js.map +1 -0
  82. package/dist/interactive-film/export-ink.d.ts +3 -0
  83. package/dist/interactive-film/export-ink.d.ts.map +1 -0
  84. package/dist/interactive-film/export-ink.js +51 -0
  85. package/dist/interactive-film/export-ink.js.map +1 -0
  86. package/dist/interactive-film/film-context.d.ts +4 -0
  87. package/dist/interactive-film/film-context.d.ts.map +1 -0
  88. package/dist/interactive-film/film-context.js +30 -0
  89. package/dist/interactive-film/film-context.js.map +1 -0
  90. package/dist/interactive-film/generate.d.ts +13 -0
  91. package/dist/interactive-film/generate.d.ts.map +1 -0
  92. package/dist/interactive-film/generate.js +32 -0
  93. package/dist/interactive-film/generate.js.map +1 -0
  94. package/dist/interactive-film/graph-schema.d.ts +819 -0
  95. package/dist/interactive-film/graph-schema.d.ts.map +1 -0
  96. package/dist/interactive-film/graph-schema.js +84 -0
  97. package/dist/interactive-film/graph-schema.js.map +1 -0
  98. package/dist/interactive-film/graph-store.d.ts +5 -0
  99. package/dist/interactive-film/graph-store.d.ts.map +1 -0
  100. package/dist/interactive-film/graph-store.js +24 -0
  101. package/dist/interactive-film/graph-store.js.map +1 -0
  102. package/dist/interactive-film/memory-link.d.ts +9 -0
  103. package/dist/interactive-film/memory-link.d.ts.map +1 -0
  104. package/dist/interactive-film/memory-link.js +15 -0
  105. package/dist/interactive-film/memory-link.js.map +1 -0
  106. package/dist/interactive-film/node-image.d.ts +29 -0
  107. package/dist/interactive-film/node-image.d.ts.map +1 -0
  108. package/dist/interactive-film/node-image.js +52 -0
  109. package/dist/interactive-film/node-image.js.map +1 -0
  110. package/dist/interactive-film/paths.d.ts +14 -0
  111. package/dist/interactive-film/paths.d.ts.map +1 -0
  112. package/dist/interactive-film/paths.js +60 -0
  113. package/dist/interactive-film/paths.js.map +1 -0
  114. package/dist/interactive-film/validation.d.ts +14 -0
  115. package/dist/interactive-film/validation.d.ts.map +1 -0
  116. package/dist/interactive-film/validation.js +292 -0
  117. package/dist/interactive-film/validation.js.map +1 -0
  118. package/dist/llm/provider.d.ts.map +1 -1
  119. package/dist/llm/provider.js +53 -16
  120. package/dist/llm/provider.js.map +1 -1
  121. package/dist/models/book.d.ts +13 -0
  122. package/dist/models/book.d.ts.map +1 -1
  123. package/dist/models/book.js +3 -0
  124. package/dist/models/book.js.map +1 -1
  125. package/dist/models/input-governance.d.ts +14 -5
  126. package/dist/models/input-governance.d.ts.map +1 -1
  127. package/dist/models/input-governance.js +3 -0
  128. package/dist/models/input-governance.js.map +1 -1
  129. package/dist/models/project.d.ts +63 -10
  130. package/dist/models/project.d.ts.map +1 -1
  131. package/dist/models/project.js +11 -0
  132. package/dist/models/project.js.map +1 -1
  133. package/dist/pipeline/runner.js +1 -1
  134. package/dist/pipeline/runner.js.map +1 -1
  135. package/dist/pipeline/script-storyboard-runner.d.ts +127 -0
  136. package/dist/pipeline/script-storyboard-runner.d.ts.map +1 -0
  137. package/dist/pipeline/script-storyboard-runner.js +446 -0
  138. package/dist/pipeline/script-storyboard-runner.js.map +1 -0
  139. package/dist/play/play-agents.d.ts.map +1 -1
  140. package/dist/play/play-agents.js +5 -2
  141. package/dist/play/play-agents.js.map +1 -1
  142. package/dist/play/play-store.d.ts +2 -2
  143. package/dist/skills/builtin-prompts.d.ts +10 -0
  144. package/dist/skills/builtin-prompts.d.ts.map +1 -0
  145. package/dist/skills/builtin-prompts.js +152 -0
  146. package/dist/skills/builtin-prompts.js.map +1 -0
  147. package/dist/skills/builtin.d.ts +3 -0
  148. package/dist/skills/builtin.d.ts.map +1 -0
  149. package/dist/skills/builtin.js +252 -0
  150. package/dist/skills/builtin.js.map +1 -0
  151. package/dist/skills/context-planner.d.ts +17 -0
  152. package/dist/skills/context-planner.d.ts.map +1 -0
  153. package/dist/skills/context-planner.js +48 -0
  154. package/dist/skills/context-planner.js.map +1 -0
  155. package/dist/skills/external-loader.d.ts +20 -0
  156. package/dist/skills/external-loader.d.ts.map +1 -0
  157. package/dist/skills/external-loader.js +126 -0
  158. package/dist/skills/external-loader.js.map +1 -0
  159. package/dist/skills/index.d.ts +8 -0
  160. package/dist/skills/index.d.ts.map +1 -0
  161. package/dist/skills/index.js +8 -0
  162. package/dist/skills/index.js.map +1 -0
  163. package/dist/skills/prompt-pack.d.ts +33 -0
  164. package/dist/skills/prompt-pack.d.ts.map +1 -0
  165. package/dist/skills/prompt-pack.js +82 -0
  166. package/dist/skills/prompt-pack.js.map +1 -0
  167. package/dist/skills/registry.d.ts +6 -0
  168. package/dist/skills/registry.d.ts.map +1 -0
  169. package/dist/skills/registry.js +101 -0
  170. package/dist/skills/registry.js.map +1 -0
  171. package/dist/skills/types.d.ts +146 -0
  172. package/dist/skills/types.d.ts.map +1 -0
  173. package/dist/skills/types.js +32 -0
  174. package/dist/skills/types.js.map +1 -0
  175. package/dist/state/manager.d.ts +8 -2
  176. package/dist/state/manager.d.ts.map +1 -1
  177. package/dist/state/manager.js +58 -5
  178. package/dist/state/manager.js.map +1 -1
  179. package/dist/utils/context-assembly.d.ts +3 -0
  180. package/dist/utils/context-assembly.d.ts.map +1 -1
  181. package/dist/utils/context-assembly.js +3 -0
  182. package/dist/utils/context-assembly.js.map +1 -1
  183. package/dist/utils/web-search.d.ts +6 -1
  184. package/dist/utils/web-search.d.ts.map +1 -1
  185. package/dist/utils/web-search.js +8 -4
  186. package/dist/utils/web-search.js.map +1 -1
  187. package/package.json +14 -3
@@ -0,0 +1,591 @@
1
+ import { z } from "zod";
2
+ import { type StoryGraph } from "./graph-schema.js";
3
+ export declare const StoryGraphDeltaSchema: z.ZodObject<{
4
+ worldAnchor: z.ZodOptional<z.ZodObject<{
5
+ storyCore: z.ZodOptional<z.ZodDefault<z.ZodString>>;
6
+ theme: z.ZodOptional<z.ZodDefault<z.ZodString>>;
7
+ genre: z.ZodOptional<z.ZodDefault<z.ZodString>>;
8
+ worldRules: z.ZodOptional<z.ZodDefault<z.ZodString>>;
9
+ durationMinutes: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ genre?: string | undefined;
12
+ storyCore?: string | undefined;
13
+ theme?: string | undefined;
14
+ worldRules?: string | undefined;
15
+ durationMinutes?: number | undefined;
16
+ }, {
17
+ genre?: string | undefined;
18
+ storyCore?: string | undefined;
19
+ theme?: string | undefined;
20
+ worldRules?: string | undefined;
21
+ durationMinutes?: number | undefined;
22
+ }>>;
23
+ characters: z.ZodOptional<z.ZodObject<{
24
+ upsert: z.ZodDefault<z.ZodArray<z.ZodObject<{
25
+ id: z.ZodString;
26
+ name: z.ZodString;
27
+ role: z.ZodDefault<z.ZodEnum<["protagonist", "antagonist", "support", "other"]>>;
28
+ motivation: z.ZodDefault<z.ZodString>;
29
+ voiceProfile: z.ZodOptional<z.ZodObject<{
30
+ speakingRhythm: z.ZodDefault<z.ZodString>;
31
+ vocabulary: z.ZodDefault<z.ZodString>;
32
+ sampleLines: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ speakingRhythm: string;
35
+ vocabulary: string;
36
+ sampleLines: string[];
37
+ }, {
38
+ speakingRhythm?: string | undefined;
39
+ vocabulary?: string | undefined;
40
+ sampleLines?: string[] | undefined;
41
+ }>>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ id: string;
44
+ name: string;
45
+ role: "other" | "protagonist" | "antagonist" | "support";
46
+ motivation: string;
47
+ voiceProfile?: {
48
+ speakingRhythm: string;
49
+ vocabulary: string;
50
+ sampleLines: string[];
51
+ } | undefined;
52
+ }, {
53
+ id: string;
54
+ name: string;
55
+ role?: "other" | "protagonist" | "antagonist" | "support" | undefined;
56
+ motivation?: string | undefined;
57
+ voiceProfile?: {
58
+ speakingRhythm?: string | undefined;
59
+ vocabulary?: string | undefined;
60
+ sampleLines?: string[] | undefined;
61
+ } | undefined;
62
+ }>, "many">>;
63
+ remove: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ upsert: {
66
+ id: string;
67
+ name: string;
68
+ role: "other" | "protagonist" | "antagonist" | "support";
69
+ motivation: string;
70
+ voiceProfile?: {
71
+ speakingRhythm: string;
72
+ vocabulary: string;
73
+ sampleLines: string[];
74
+ } | undefined;
75
+ }[];
76
+ remove: string[];
77
+ }, {
78
+ upsert?: {
79
+ id: string;
80
+ name: string;
81
+ role?: "other" | "protagonist" | "antagonist" | "support" | undefined;
82
+ motivation?: string | undefined;
83
+ voiceProfile?: {
84
+ speakingRhythm?: string | undefined;
85
+ vocabulary?: string | undefined;
86
+ sampleLines?: string[] | undefined;
87
+ } | undefined;
88
+ }[] | undefined;
89
+ remove?: string[] | undefined;
90
+ }>>;
91
+ nodes: z.ZodOptional<z.ZodObject<{
92
+ upsert: z.ZodDefault<z.ZodArray<z.ZodObject<{
93
+ id: z.ZodString;
94
+ title: z.ZodDefault<z.ZodString>;
95
+ type: z.ZodEnum<["start", "normal", "branch", "merge", "ending", "explore"]>;
96
+ sceneDesc: z.ZodDefault<z.ZodString>;
97
+ dialogue: z.ZodDefault<z.ZodArray<z.ZodObject<{
98
+ speaker: z.ZodString;
99
+ text: z.ZodString;
100
+ emotion: z.ZodDefault<z.ZodString>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ text: string;
103
+ speaker: string;
104
+ emotion: string;
105
+ }, {
106
+ text: string;
107
+ speaker: string;
108
+ emotion?: string | undefined;
109
+ }>, "many">>;
110
+ choices: z.ZodDefault<z.ZodArray<z.ZodObject<{
111
+ id: z.ZodString;
112
+ text: z.ZodString;
113
+ targetNodeId: z.ZodString;
114
+ condition: z.ZodOptional<z.ZodObject<{
115
+ var: z.ZodString;
116
+ op: z.ZodEnum<[">=", "<=", ">", "<", "==", "!="]>;
117
+ value: z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean]>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ value: string | number | boolean;
120
+ var: string;
121
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
122
+ }, {
123
+ value: string | number | boolean;
124
+ var: string;
125
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
126
+ }>>;
127
+ effects: z.ZodDefault<z.ZodArray<z.ZodObject<{
128
+ var: z.ZodString;
129
+ op: z.ZodEnum<["set", "add", "sub"]>;
130
+ value: z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean]>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ value: string | number | boolean;
133
+ var: string;
134
+ op: "set" | "sub" | "add";
135
+ }, {
136
+ value: string | number | boolean;
137
+ var: string;
138
+ op: "set" | "sub" | "add";
139
+ }>, "many">>;
140
+ weight: z.ZodOptional<z.ZodEnum<["light", "heavy", "critical"]>>;
141
+ }, "strip", z.ZodTypeAny, {
142
+ id: string;
143
+ text: string;
144
+ targetNodeId: string;
145
+ effects: {
146
+ value: string | number | boolean;
147
+ var: string;
148
+ op: "set" | "sub" | "add";
149
+ }[];
150
+ condition?: {
151
+ value: string | number | boolean;
152
+ var: string;
153
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
154
+ } | undefined;
155
+ weight?: "light" | "heavy" | "critical" | undefined;
156
+ }, {
157
+ id: string;
158
+ text: string;
159
+ targetNodeId: string;
160
+ condition?: {
161
+ value: string | number | boolean;
162
+ var: string;
163
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
164
+ } | undefined;
165
+ effects?: {
166
+ value: string | number | boolean;
167
+ var: string;
168
+ op: "set" | "sub" | "add";
169
+ }[] | undefined;
170
+ weight?: "light" | "heavy" | "critical" | undefined;
171
+ }>, "many">>;
172
+ imageSlot: z.ZodOptional<z.ZodObject<{
173
+ prompt: z.ZodDefault<z.ZodString>;
174
+ assetRef: z.ZodOptional<z.ZodString>;
175
+ }, "strip", z.ZodTypeAny, {
176
+ prompt: string;
177
+ assetRef?: string | undefined;
178
+ }, {
179
+ prompt?: string | undefined;
180
+ assetRef?: string | undefined;
181
+ }>>;
182
+ act: z.ZodDefault<z.ZodString>;
183
+ position: z.ZodOptional<z.ZodObject<{
184
+ x: z.ZodNumber;
185
+ y: z.ZodNumber;
186
+ }, "strip", z.ZodTypeAny, {
187
+ x: number;
188
+ y: number;
189
+ }, {
190
+ x: number;
191
+ y: number;
192
+ }>>;
193
+ }, "strip", z.ZodTypeAny, {
194
+ type: "start" | "branch" | "ending" | "normal" | "merge" | "explore";
195
+ id: string;
196
+ title: string;
197
+ sceneDesc: string;
198
+ dialogue: {
199
+ text: string;
200
+ speaker: string;
201
+ emotion: string;
202
+ }[];
203
+ choices: {
204
+ id: string;
205
+ text: string;
206
+ targetNodeId: string;
207
+ effects: {
208
+ value: string | number | boolean;
209
+ var: string;
210
+ op: "set" | "sub" | "add";
211
+ }[];
212
+ condition?: {
213
+ value: string | number | boolean;
214
+ var: string;
215
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
216
+ } | undefined;
217
+ weight?: "light" | "heavy" | "critical" | undefined;
218
+ }[];
219
+ act: string;
220
+ imageSlot?: {
221
+ prompt: string;
222
+ assetRef?: string | undefined;
223
+ } | undefined;
224
+ position?: {
225
+ x: number;
226
+ y: number;
227
+ } | undefined;
228
+ }, {
229
+ type: "start" | "branch" | "ending" | "normal" | "merge" | "explore";
230
+ id: string;
231
+ title?: string | undefined;
232
+ sceneDesc?: string | undefined;
233
+ dialogue?: {
234
+ text: string;
235
+ speaker: string;
236
+ emotion?: string | undefined;
237
+ }[] | undefined;
238
+ choices?: {
239
+ id: string;
240
+ text: string;
241
+ targetNodeId: string;
242
+ condition?: {
243
+ value: string | number | boolean;
244
+ var: string;
245
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
246
+ } | undefined;
247
+ effects?: {
248
+ value: string | number | boolean;
249
+ var: string;
250
+ op: "set" | "sub" | "add";
251
+ }[] | undefined;
252
+ weight?: "light" | "heavy" | "critical" | undefined;
253
+ }[] | undefined;
254
+ imageSlot?: {
255
+ prompt?: string | undefined;
256
+ assetRef?: string | undefined;
257
+ } | undefined;
258
+ act?: string | undefined;
259
+ position?: {
260
+ x: number;
261
+ y: number;
262
+ } | undefined;
263
+ }>, "many">>;
264
+ remove: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ upsert: {
267
+ type: "start" | "branch" | "ending" | "normal" | "merge" | "explore";
268
+ id: string;
269
+ title: string;
270
+ sceneDesc: string;
271
+ dialogue: {
272
+ text: string;
273
+ speaker: string;
274
+ emotion: string;
275
+ }[];
276
+ choices: {
277
+ id: string;
278
+ text: string;
279
+ targetNodeId: string;
280
+ effects: {
281
+ value: string | number | boolean;
282
+ var: string;
283
+ op: "set" | "sub" | "add";
284
+ }[];
285
+ condition?: {
286
+ value: string | number | boolean;
287
+ var: string;
288
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
289
+ } | undefined;
290
+ weight?: "light" | "heavy" | "critical" | undefined;
291
+ }[];
292
+ act: string;
293
+ imageSlot?: {
294
+ prompt: string;
295
+ assetRef?: string | undefined;
296
+ } | undefined;
297
+ position?: {
298
+ x: number;
299
+ y: number;
300
+ } | undefined;
301
+ }[];
302
+ remove: string[];
303
+ }, {
304
+ upsert?: {
305
+ type: "start" | "branch" | "ending" | "normal" | "merge" | "explore";
306
+ id: string;
307
+ title?: string | undefined;
308
+ sceneDesc?: string | undefined;
309
+ dialogue?: {
310
+ text: string;
311
+ speaker: string;
312
+ emotion?: string | undefined;
313
+ }[] | undefined;
314
+ choices?: {
315
+ id: string;
316
+ text: string;
317
+ targetNodeId: string;
318
+ condition?: {
319
+ value: string | number | boolean;
320
+ var: string;
321
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
322
+ } | undefined;
323
+ effects?: {
324
+ value: string | number | boolean;
325
+ var: string;
326
+ op: "set" | "sub" | "add";
327
+ }[] | undefined;
328
+ weight?: "light" | "heavy" | "critical" | undefined;
329
+ }[] | undefined;
330
+ imageSlot?: {
331
+ prompt?: string | undefined;
332
+ assetRef?: string | undefined;
333
+ } | undefined;
334
+ act?: string | undefined;
335
+ position?: {
336
+ x: number;
337
+ y: number;
338
+ } | undefined;
339
+ }[] | undefined;
340
+ remove?: string[] | undefined;
341
+ }>>;
342
+ variables: z.ZodOptional<z.ZodObject<{
343
+ upsert: z.ZodDefault<z.ZodArray<z.ZodObject<{
344
+ name: z.ZodString;
345
+ type: z.ZodEnum<["flag", "counter", "relationship", "item"]>;
346
+ default: z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean]>;
347
+ desc: z.ZodDefault<z.ZodString>;
348
+ }, "strip", z.ZodTypeAny, {
349
+ type: "item" | "flag" | "relationship" | "counter";
350
+ name: string;
351
+ default: string | number | boolean;
352
+ desc: string;
353
+ }, {
354
+ type: "item" | "flag" | "relationship" | "counter";
355
+ name: string;
356
+ default: string | number | boolean;
357
+ desc?: string | undefined;
358
+ }>, "many">>;
359
+ remove: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
360
+ }, "strip", z.ZodTypeAny, {
361
+ upsert: {
362
+ type: "item" | "flag" | "relationship" | "counter";
363
+ name: string;
364
+ default: string | number | boolean;
365
+ desc: string;
366
+ }[];
367
+ remove: string[];
368
+ }, {
369
+ upsert?: {
370
+ type: "item" | "flag" | "relationship" | "counter";
371
+ name: string;
372
+ default: string | number | boolean;
373
+ desc?: string | undefined;
374
+ }[] | undefined;
375
+ remove?: string[] | undefined;
376
+ }>>;
377
+ endings: z.ZodOptional<z.ZodObject<{
378
+ upsert: z.ZodDefault<z.ZodArray<z.ZodObject<{
379
+ id: z.ZodString;
380
+ nodeId: z.ZodString;
381
+ title: z.ZodString;
382
+ type: z.ZodEnum<["good", "bad", "neutral", "secret"]>;
383
+ description: z.ZodDefault<z.ZodString>;
384
+ }, "strip", z.ZodTypeAny, {
385
+ type: "secret" | "good" | "bad" | "neutral";
386
+ id: string;
387
+ title: string;
388
+ description: string;
389
+ nodeId: string;
390
+ }, {
391
+ type: "secret" | "good" | "bad" | "neutral";
392
+ id: string;
393
+ title: string;
394
+ nodeId: string;
395
+ description?: string | undefined;
396
+ }>, "many">>;
397
+ remove: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
398
+ }, "strip", z.ZodTypeAny, {
399
+ upsert: {
400
+ type: "secret" | "good" | "bad" | "neutral";
401
+ id: string;
402
+ title: string;
403
+ description: string;
404
+ nodeId: string;
405
+ }[];
406
+ remove: string[];
407
+ }, {
408
+ upsert?: {
409
+ type: "secret" | "good" | "bad" | "neutral";
410
+ id: string;
411
+ title: string;
412
+ nodeId: string;
413
+ description?: string | undefined;
414
+ }[] | undefined;
415
+ remove?: string[] | undefined;
416
+ }>>;
417
+ notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
418
+ }, "strip", z.ZodTypeAny, {
419
+ notes: string[];
420
+ characters?: {
421
+ upsert: {
422
+ id: string;
423
+ name: string;
424
+ role: "other" | "protagonist" | "antagonist" | "support";
425
+ motivation: string;
426
+ voiceProfile?: {
427
+ speakingRhythm: string;
428
+ vocabulary: string;
429
+ sampleLines: string[];
430
+ } | undefined;
431
+ }[];
432
+ remove: string[];
433
+ } | undefined;
434
+ worldAnchor?: {
435
+ genre?: string | undefined;
436
+ storyCore?: string | undefined;
437
+ theme?: string | undefined;
438
+ worldRules?: string | undefined;
439
+ durationMinutes?: number | undefined;
440
+ } | undefined;
441
+ variables?: {
442
+ upsert: {
443
+ type: "item" | "flag" | "relationship" | "counter";
444
+ name: string;
445
+ default: string | number | boolean;
446
+ desc: string;
447
+ }[];
448
+ remove: string[];
449
+ } | undefined;
450
+ nodes?: {
451
+ upsert: {
452
+ type: "start" | "branch" | "ending" | "normal" | "merge" | "explore";
453
+ id: string;
454
+ title: string;
455
+ sceneDesc: string;
456
+ dialogue: {
457
+ text: string;
458
+ speaker: string;
459
+ emotion: string;
460
+ }[];
461
+ choices: {
462
+ id: string;
463
+ text: string;
464
+ targetNodeId: string;
465
+ effects: {
466
+ value: string | number | boolean;
467
+ var: string;
468
+ op: "set" | "sub" | "add";
469
+ }[];
470
+ condition?: {
471
+ value: string | number | boolean;
472
+ var: string;
473
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
474
+ } | undefined;
475
+ weight?: "light" | "heavy" | "critical" | undefined;
476
+ }[];
477
+ act: string;
478
+ imageSlot?: {
479
+ prompt: string;
480
+ assetRef?: string | undefined;
481
+ } | undefined;
482
+ position?: {
483
+ x: number;
484
+ y: number;
485
+ } | undefined;
486
+ }[];
487
+ remove: string[];
488
+ } | undefined;
489
+ endings?: {
490
+ upsert: {
491
+ type: "secret" | "good" | "bad" | "neutral";
492
+ id: string;
493
+ title: string;
494
+ description: string;
495
+ nodeId: string;
496
+ }[];
497
+ remove: string[];
498
+ } | undefined;
499
+ }, {
500
+ notes?: string[] | undefined;
501
+ characters?: {
502
+ upsert?: {
503
+ id: string;
504
+ name: string;
505
+ role?: "other" | "protagonist" | "antagonist" | "support" | undefined;
506
+ motivation?: string | undefined;
507
+ voiceProfile?: {
508
+ speakingRhythm?: string | undefined;
509
+ vocabulary?: string | undefined;
510
+ sampleLines?: string[] | undefined;
511
+ } | undefined;
512
+ }[] | undefined;
513
+ remove?: string[] | undefined;
514
+ } | undefined;
515
+ worldAnchor?: {
516
+ genre?: string | undefined;
517
+ storyCore?: string | undefined;
518
+ theme?: string | undefined;
519
+ worldRules?: string | undefined;
520
+ durationMinutes?: number | undefined;
521
+ } | undefined;
522
+ variables?: {
523
+ upsert?: {
524
+ type: "item" | "flag" | "relationship" | "counter";
525
+ name: string;
526
+ default: string | number | boolean;
527
+ desc?: string | undefined;
528
+ }[] | undefined;
529
+ remove?: string[] | undefined;
530
+ } | undefined;
531
+ nodes?: {
532
+ upsert?: {
533
+ type: "start" | "branch" | "ending" | "normal" | "merge" | "explore";
534
+ id: string;
535
+ title?: string | undefined;
536
+ sceneDesc?: string | undefined;
537
+ dialogue?: {
538
+ text: string;
539
+ speaker: string;
540
+ emotion?: string | undefined;
541
+ }[] | undefined;
542
+ choices?: {
543
+ id: string;
544
+ text: string;
545
+ targetNodeId: string;
546
+ condition?: {
547
+ value: string | number | boolean;
548
+ var: string;
549
+ op: ">=" | "<=" | ">" | "<" | "==" | "!=";
550
+ } | undefined;
551
+ effects?: {
552
+ value: string | number | boolean;
553
+ var: string;
554
+ op: "set" | "sub" | "add";
555
+ }[] | undefined;
556
+ weight?: "light" | "heavy" | "critical" | undefined;
557
+ }[] | undefined;
558
+ imageSlot?: {
559
+ prompt?: string | undefined;
560
+ assetRef?: string | undefined;
561
+ } | undefined;
562
+ act?: string | undefined;
563
+ position?: {
564
+ x: number;
565
+ y: number;
566
+ } | undefined;
567
+ }[] | undefined;
568
+ remove?: string[] | undefined;
569
+ } | undefined;
570
+ endings?: {
571
+ upsert?: {
572
+ type: "secret" | "good" | "bad" | "neutral";
573
+ id: string;
574
+ title: string;
575
+ nodeId: string;
576
+ description?: string | undefined;
577
+ }[] | undefined;
578
+ remove?: string[] | undefined;
579
+ } | undefined;
580
+ }>;
581
+ export type StoryGraphDelta = z.infer<typeof StoryGraphDeltaSchema>;
582
+ /**
583
+ * Returns a new StoryGraph with the delta applied. The returned graph shares
584
+ * element references with the input; callers must treat it as immutable —
585
+ * do not mutate nodes/arrays in place.
586
+ */
587
+ export declare function applyStoryGraphDelta(params: {
588
+ graph: StoryGraph;
589
+ delta: StoryGraphDelta;
590
+ }): StoryGraph;
591
+ //# sourceMappingURL=delta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta.d.ts","sourceRoot":"","sources":["../../src/interactive-film/delta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAOL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAQ3B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAcpE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,eAAe,CAAC;CACxB,GAAG,UAAU,CA0Bb"}
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ import { StoryGraphSchema, WorldAnchorSchema, CharacterSchema, StoryNodeSchema, VariableSchema, EndingSchema, } from "./graph-schema.js";
3
+ const upsertRemove = (item) => z.object({
4
+ upsert: z.array(item).default([]),
5
+ remove: z.array(z.string()).default([]),
6
+ });
7
+ export const StoryGraphDeltaSchema = z.object({
8
+ worldAnchor: WorldAnchorSchema.partial().optional(),
9
+ characters: upsertRemove(CharacterSchema).optional(),
10
+ nodes: upsertRemove(StoryNodeSchema).optional(),
11
+ variables: upsertRemove(VariableSchema).optional(),
12
+ endings: upsertRemove(EndingSchema).optional(),
13
+ notes: z.array(z.string()).default([]),
14
+ });
15
+ function applyUpsertRemove(current, ops, key) {
16
+ if (!ops)
17
+ return [...current];
18
+ const map = new Map(current.map((item) => [key(item), item]));
19
+ for (const id of ops.remove)
20
+ map.delete(id);
21
+ for (const item of ops.upsert)
22
+ map.set(key(item), item);
23
+ return [...map.values()];
24
+ }
25
+ /**
26
+ * Returns a new StoryGraph with the delta applied. The returned graph shares
27
+ * element references with the input; callers must treat it as immutable —
28
+ * do not mutate nodes/arrays in place.
29
+ */
30
+ export function applyStoryGraphDelta(params) {
31
+ const graph = StoryGraphSchema.parse(params.graph);
32
+ const delta = StoryGraphDeltaSchema.parse(params.delta);
33
+ const worldAnchor = delta.worldAnchor
34
+ ? WorldAnchorSchema.parse({ ...(graph.worldAnchor ?? {}), ...delta.worldAnchor })
35
+ : graph.worldAnchor;
36
+ const next = StoryGraphSchema.parse({
37
+ ...graph,
38
+ worldAnchor,
39
+ characters: applyUpsertRemove(graph.characters, delta.characters, (c) => c.id),
40
+ nodes: applyUpsertRemove(graph.nodes, delta.nodes, (n) => n.id),
41
+ variables: applyUpsertRemove(graph.variables, delta.variables, (v) => v.name),
42
+ endings: applyUpsertRemove(graph.endings, delta.endings, (e) => e.id),
43
+ });
44
+ // Referential integrity (blocking): every ending must point at an existing node.
45
+ // choice.targetNodeId dangling is left advisory to validateStoryGraph (Phase 1).
46
+ const nodeIds = new Set(next.nodes.map((n) => n.id));
47
+ for (const ending of next.endings) {
48
+ if (!nodeIds.has(ending.nodeId)) {
49
+ throw new Error(`ending ${ending.id} references missing node ${ending.nodeId}`);
50
+ }
51
+ }
52
+ return next;
53
+ }
54
+ //# sourceMappingURL=delta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta.js","sourceRoot":"","sources":["../../src/interactive-film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AI,CAAC;QAC7E,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtE,CAAC,CAAC;IAEH,iFAAiF;IACjF,iFAAiF;IACjF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,UAAU,MAAM,CAAC,EAAE,4BAA4B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { StoryGraph, StoryNode } from "./graph-schema.js";
2
+ export declare function emotionScore(word: string): number;
3
+ export declare function nodeEmotion(node: StoryNode): number;
4
+ export declare function analyzeEmotionalArcs(graph: StoryGraph): {
5
+ arcs: {
6
+ endingId: string | null;
7
+ points: {
8
+ nodeId: string;
9
+ score: number;
10
+ }[];
11
+ }[];
12
+ truncated: boolean;
13
+ };
14
+ export declare function analyzePathDistribution(graph: StoryGraph): {
15
+ total: number;
16
+ truncated: boolean;
17
+ byEnding: Record<string, number>;
18
+ lengthHistogram: Record<number, number>;
19
+ };
20
+ //# sourceMappingURL=emotion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emotion.d.ts","sourceRoot":"","sources":["../../src/interactive-film/emotion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAS/D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgBjD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAKnD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG;IACvD,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,EAAE,CAAC;IACjF,SAAS,EAAE,OAAO,CAAC;CACpB,CAWA;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,CAUA"}