@ykurilov/agent-chat-flows 0.0.0-stage → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/CHANGELOG.md +252 -0
  2. package/LICENSE +21 -0
  3. package/README.md +124 -2
  4. package/agent-flow.schema.json +1020 -0
  5. package/dist/chunk-3PTJI2XY.js +100 -0
  6. package/dist/chunk-3PTJI2XY.js.map +1 -0
  7. package/dist/chunk-BNMQUNSI.js +9 -0
  8. package/dist/chunk-BNMQUNSI.js.map +1 -0
  9. package/dist/chunk-BOV6FJGU.js +1288 -0
  10. package/dist/chunk-BOV6FJGU.js.map +1 -0
  11. package/dist/chunk-CKY5KG7N.js +165 -0
  12. package/dist/chunk-CKY5KG7N.js.map +1 -0
  13. package/dist/chunk-DCTRMCGV.js +34 -0
  14. package/dist/chunk-DCTRMCGV.js.map +1 -0
  15. package/dist/format.js +147 -0
  16. package/dist/format.js.map +1 -0
  17. package/dist/index.js +3197 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/postgres.js +387 -0
  20. package/dist/postgres.js.map +1 -0
  21. package/dist/react.js +2650 -0
  22. package/dist/react.js.map +1 -0
  23. package/dist/sqlite.js +319 -0
  24. package/dist/sqlite.js.map +1 -0
  25. package/dist/types/check/app-checks.d.ts +16 -0
  26. package/dist/types/check/check-flow.d.ts +8 -0
  27. package/dist/types/check/index.d.ts +2 -0
  28. package/dist/types/engine/data-conditions.d.ts +10 -0
  29. package/dist/types/engine/day-frame.d.ts +17 -0
  30. package/dist/types/engine/first-messages.d.ts +21 -0
  31. package/dist/types/engine/flow-days.d.ts +39 -0
  32. package/dist/types/engine/flow-graph.d.ts +26 -0
  33. package/dist/types/engine/flow-run.d.ts +130 -0
  34. package/dist/types/engine/index.d.ts +14 -0
  35. package/dist/types/engine/migrate-run.d.ts +11 -0
  36. package/dist/types/engine/next-transition.d.ts +40 -0
  37. package/dist/types/engine/nudges.d.ts +78 -0
  38. package/dist/types/engine/run-updates.d.ts +37 -0
  39. package/dist/types/engine/side-questions.d.ts +26 -0
  40. package/dist/types/engine/side-tasks.d.ts +44 -0
  41. package/dist/types/engine/targets.d.ts +9 -0
  42. package/dist/types/engine/timers.d.ts +61 -0
  43. package/dist/types/engine/zoned-time.d.ts +27 -0
  44. package/dist/types/format/catalog-events.d.ts +5 -0
  45. package/dist/types/format/compact-flow.d.ts +8 -0
  46. package/dist/types/format/flow-format.d.ts +286 -0
  47. package/dist/types/format/flow-json-schema.d.ts +2 -0
  48. package/dist/types/format/flow-schema.d.ts +605 -0
  49. package/dist/types/format/index.d.ts +7 -0
  50. package/dist/types/format/migrate-flow.d.ts +4 -0
  51. package/dist/types/format/parse-flow.d.ts +6 -0
  52. package/dist/types/format.d.ts +3 -0
  53. package/dist/types/index.d.ts +4 -0
  54. package/dist/types/labels/client-card.d.ts +20 -0
  55. package/dist/types/labels/editor.d.ts +261 -0
  56. package/dist/types/labels/index.d.ts +14 -0
  57. package/dist/types/labels/migrate.d.ts +19 -0
  58. package/dist/types/labels/test-chat.d.ts +28 -0
  59. package/dist/types/not-yet.d.ts +2 -0
  60. package/dist/types/postgres.d.ts +10 -0
  61. package/dist/types/prompt/client-card-block.d.ts +16 -0
  62. package/dist/types/prompt/flow-rules.d.ts +9 -0
  63. package/dist/types/prompt/rules/after-end.d.ts +3 -0
  64. package/dist/types/prompt/rules/client-facts.d.ts +2 -0
  65. package/dist/types/prompt/rules/day-frame.d.ts +2 -0
  66. package/dist/types/prompt/rules/link-views.d.ts +4 -0
  67. package/dist/types/prompt/rules/rule-part.d.ts +3 -0
  68. package/dist/types/prompt/rules/side-tasks.d.ts +2 -0
  69. package/dist/types/prompt/rules/time-zone.d.ts +2 -0
  70. package/dist/types/prompt/state-card.d.ts +14 -0
  71. package/dist/types/react/client-card/client-card-panel.d.ts +8 -0
  72. package/dist/types/react/client-card/index.d.ts +2 -0
  73. package/dist/types/react/client-card/use-client-card.d.ts +19 -0
  74. package/dist/types/react/client-card-skin.d.ts +27 -0
  75. package/dist/types/react/editor/board-space.d.ts +51 -0
  76. package/dist/types/react/editor/board-styles.d.ts +1 -0
  77. package/dist/types/react/editor/editor-model.d.ts +60 -0
  78. package/dist/types/react/editor/exit-text.d.ts +11 -0
  79. package/dist/types/react/editor/flow-board.d.ts +11 -0
  80. package/dist/types/react/editor/flow-editor.d.ts +13 -0
  81. package/dist/types/react/editor/flow-simulation.d.ts +44 -0
  82. package/dist/types/react/editor/index.d.ts +6 -0
  83. package/dist/types/react/editor/schedule-model.d.ts +47 -0
  84. package/dist/types/react/editor/side-task-model.d.ts +18 -0
  85. package/dist/types/react/editor/use-flow-editor.d.ts +120 -0
  86. package/dist/types/react/flow-editor-skin.d.ts +453 -0
  87. package/dist/types/react/flow-labels.d.ts +8 -0
  88. package/dist/types/react/index.d.ts +6 -0
  89. package/dist/types/react/test-chat/flow-test-chat.d.ts +22 -0
  90. package/dist/types/react/test-chat/index.d.ts +2 -0
  91. package/dist/types/react/test-chat/use-flow-test-chat.d.ts +50 -0
  92. package/dist/types/react.d.ts +3 -0
  93. package/dist/types/runtime/admit.d.ts +15 -0
  94. package/dist/types/runtime/agent-flow.d.ts +20 -0
  95. package/dist/types/runtime/client-card.d.ts +9 -0
  96. package/dist/types/runtime/client-facts.d.ts +22 -0
  97. package/dist/types/runtime/close-day-tool.d.ts +3 -0
  98. package/dist/types/runtime/decisions-client.d.ts +33 -0
  99. package/dist/types/runtime/extra-tool.d.ts +16 -0
  100. package/dist/types/runtime/first-message-retry.d.ts +4 -0
  101. package/dist/types/runtime/first-message-rules.d.ts +55 -0
  102. package/dist/types/runtime/first-reasons-notice.d.ts +9 -0
  103. package/dist/types/runtime/flow-delivery.d.ts +53 -0
  104. package/dist/types/runtime/flow-events.d.ts +126 -0
  105. package/dist/types/runtime/flow-finish.d.ts +68 -0
  106. package/dist/types/runtime/flow-known-texts.d.ts +11 -0
  107. package/dist/types/runtime/flow-signals.d.ts +12 -0
  108. package/dist/types/runtime/flow-timers.d.ts +55 -0
  109. package/dist/types/runtime/flow-tools.d.ts +23 -0
  110. package/dist/types/runtime/flow-types.d.ts +547 -0
  111. package/dist/types/runtime/held-messages.d.ts +25 -0
  112. package/dist/types/runtime/index.d.ts +11 -0
  113. package/dist/types/runtime/judge-context.d.ts +36 -0
  114. package/dist/types/runtime/judge.d.ts +21 -0
  115. package/dist/types/runtime/migrate-chats.d.ts +20 -0
  116. package/dist/types/runtime/note-tools.d.ts +15 -0
  117. package/dist/types/runtime/pause.d.ts +21 -0
  118. package/dist/types/runtime/prepare-turn.d.ts +12 -0
  119. package/dist/types/runtime/side-task-tool.d.ts +5 -0
  120. package/dist/types/runtime/step-tail.d.ts +11 -0
  121. package/dist/types/runtime/tail/day-line.d.ts +2 -0
  122. package/dist/types/runtime/tail/frame-line.d.ts +2 -0
  123. package/dist/types/runtime/tail/side-tasks-line.d.ts +2 -0
  124. package/dist/types/runtime/tail/tail-part.d.ts +21 -0
  125. package/dist/types/runtime/test-clock.d.ts +26 -0
  126. package/dist/types/runtime/time-zone-tool.d.ts +3 -0
  127. package/dist/types/runtime/turn-gate.d.ts +8 -0
  128. package/dist/types/sqlite.d.ts +9 -0
  129. package/dist/types/store/flow-store-shared.d.ts +20 -0
  130. package/dist/types/store/flow-store.d.ts +240 -0
  131. package/dist/types/store/memory.d.ts +3 -0
  132. package/dist/types/store/migration-settings.d.ts +7 -0
  133. package/dist/types/store/postgres-schema.d.ts +775 -0
  134. package/dist/types/store/postgres.d.ts +15 -0
  135. package/dist/types/store/sqlite-schema.d.ts +824 -0
  136. package/dist/types/store/sqlite.d.ts +9 -0
  137. package/drizzle/postgres/0000_init.sql +45 -0
  138. package/drizzle/postgres/0001_days_pause_side_tasks.sql +21 -0
  139. package/drizzle/postgres/0002_chat_placement.sql +1 -0
  140. package/drizzle/postgres/meta/0000_snapshot.json +317 -0
  141. package/drizzle/postgres/meta/0001_snapshot.json +439 -0
  142. package/drizzle/postgres/meta/0002_snapshot.json +445 -0
  143. package/drizzle/postgres/meta/_journal.json +27 -0
  144. package/drizzle/sqlite/0000_init.sql +44 -0
  145. package/drizzle/sqlite/0001_days_pause_side_tasks.sql +21 -0
  146. package/drizzle/sqlite/0002_chat_placement.sql +1 -0
  147. package/drizzle/sqlite/meta/0000_snapshot.json +297 -0
  148. package/drizzle/sqlite/meta/0001_snapshot.json +427 -0
  149. package/drizzle/sqlite/meta/0002_snapshot.json +434 -0
  150. package/drizzle/sqlite/meta/_journal.json +27 -0
  151. package/package.json +98 -3
@@ -0,0 +1,605 @@
1
+ import { z } from "zod";
2
+ export declare const DEFAULT_SIDE_QUESTION_EVERY_MESSAGES = 5;
3
+ /** Схема сценария текущей версии формата. Вход — JSON без значений по умолчанию, выход — `AgentFlow`. */
4
+ export declare const agentFlowSchema: z.ZodPipe<z.ZodObject<{
5
+ $schema: z.ZodOptional<z.ZodString>;
6
+ format: z.ZodLiteral<"agent-flow">;
7
+ version: z.ZodLiteral<2>;
8
+ id: z.ZodString;
9
+ name: z.ZodString;
10
+ start: z.ZodDefault<z.ZodNullable<z.ZodString>>;
11
+ common: z.ZodDefault<z.ZodString>;
12
+ pace: z.ZodDefault<z.ZodObject<{
13
+ sideQuestionEveryMessages: z.ZodDefault<z.ZodInt>;
14
+ }, z.core.$strict>>;
15
+ clientCard: z.ZodDefault<z.ZodArray<z.ZodObject<{
16
+ id: z.ZodString;
17
+ name: z.ZodString;
18
+ about: z.ZodDefault<z.ZodString>;
19
+ type: z.ZodDefault<z.ZodEnum<{
20
+ boolean: "boolean";
21
+ choice: "choice";
22
+ number: "number";
23
+ text: "text";
24
+ }>>;
25
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
26
+ refreshAfterMonths: z.ZodDefault<z.ZodNullable<z.ZodInt>>;
27
+ }, z.core.$strict>>>;
28
+ chatNotes: z.ZodDefault<z.ZodArray<z.ZodObject<{
29
+ id: z.ZodString;
30
+ name: z.ZodString;
31
+ about: z.ZodDefault<z.ZodString>;
32
+ type: z.ZodDefault<z.ZodEnum<{
33
+ boolean: "boolean";
34
+ choice: "choice";
35
+ number: "number";
36
+ text: "text";
37
+ }>>;
38
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
39
+ }, z.core.$strict>>>;
40
+ tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
41
+ anyState: z.ZodDefault<z.ZodObject<{
42
+ except: z.ZodDefault<z.ZodArray<z.ZodString>>;
43
+ exits: z.ZodDefault<z.ZodArray<z.ZodObject<{
44
+ id: z.ZodString;
45
+ when: z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ type: z.ZodLiteral<"judge">;
47
+ text: z.ZodString;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ type: z.ZodLiteral<"data">;
50
+ field: z.ZodString;
51
+ op: z.ZodDefault<z.ZodEnum<{
52
+ contains: "contains";
53
+ eq: "eq";
54
+ filled: "filled";
55
+ gt: "gt";
56
+ lt: "lt";
57
+ ne: "ne";
58
+ }>>;
59
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ type: z.ZodLiteral<"event">;
62
+ event: z.ZodEnum<{
63
+ app: "app";
64
+ button: "button";
65
+ message: "message";
66
+ tool: "tool";
67
+ }>;
68
+ name: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
70
+ type: z.ZodLiteral<"timer">;
71
+ from: z.ZodEnum<{
72
+ in_state: "in_state";
73
+ silence: "silence";
74
+ since_start: "since_start";
75
+ }>;
76
+ amount: z.ZodNumber;
77
+ unit: z.ZodEnum<{
78
+ d: "d";
79
+ h: "h";
80
+ min: "min";
81
+ }>;
82
+ }, z.core.$strict>, z.ZodObject<{
83
+ type: z.ZodLiteral<"timer">;
84
+ from: z.ZodLiteral<"time_of_day">;
85
+ at: z.ZodString;
86
+ }, z.core.$strict>, z.ZodObject<{
87
+ type: z.ZodLiteral<"timer">;
88
+ from: z.ZodLiteral<"state_days">;
89
+ days: z.ZodInt;
90
+ }, z.core.$strict>, z.ZodObject<{
91
+ type: z.ZodLiteral<"timer">;
92
+ from: z.ZodLiteral<"program_day">;
93
+ day: z.ZodNumber;
94
+ }, z.core.$strict>], "from">], "type">;
95
+ to: z.ZodDefault<z.ZodNullable<z.ZodString>>;
96
+ }, z.core.$strict>>>;
97
+ }, z.core.$strict>>;
98
+ states: z.ZodArray<z.ZodObject<{
99
+ id: z.ZodString;
100
+ kind: z.ZodDefault<z.ZodLiteral<"state">>;
101
+ title: z.ZodDefault<z.ZodString>;
102
+ instructions: z.ZodDefault<z.ZodString>;
103
+ firstMessage: z.ZodDefault<z.ZodNullable<z.ZodString>>;
104
+ learn: z.ZodDefault<z.ZodArray<z.ZodString>>;
105
+ noSideQuestions: z.ZodDefault<z.ZodBoolean>;
106
+ tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
107
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
108
+ exits: z.ZodDefault<z.ZodArray<z.ZodObject<{
109
+ id: z.ZodString;
110
+ when: z.ZodDiscriminatedUnion<[z.ZodObject<{
111
+ type: z.ZodLiteral<"judge">;
112
+ text: z.ZodString;
113
+ }, z.core.$strict>, z.ZodObject<{
114
+ type: z.ZodLiteral<"data">;
115
+ field: z.ZodString;
116
+ op: z.ZodDefault<z.ZodEnum<{
117
+ contains: "contains";
118
+ eq: "eq";
119
+ filled: "filled";
120
+ gt: "gt";
121
+ lt: "lt";
122
+ ne: "ne";
123
+ }>>;
124
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
125
+ }, z.core.$strict>, z.ZodObject<{
126
+ type: z.ZodLiteral<"event">;
127
+ event: z.ZodEnum<{
128
+ app: "app";
129
+ button: "button";
130
+ message: "message";
131
+ tool: "tool";
132
+ }>;
133
+ name: z.ZodOptional<z.ZodString>;
134
+ }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
135
+ type: z.ZodLiteral<"timer">;
136
+ from: z.ZodEnum<{
137
+ in_state: "in_state";
138
+ silence: "silence";
139
+ since_start: "since_start";
140
+ }>;
141
+ amount: z.ZodNumber;
142
+ unit: z.ZodEnum<{
143
+ d: "d";
144
+ h: "h";
145
+ min: "min";
146
+ }>;
147
+ }, z.core.$strict>, z.ZodObject<{
148
+ type: z.ZodLiteral<"timer">;
149
+ from: z.ZodLiteral<"time_of_day">;
150
+ at: z.ZodString;
151
+ }, z.core.$strict>, z.ZodObject<{
152
+ type: z.ZodLiteral<"timer">;
153
+ from: z.ZodLiteral<"state_days">;
154
+ days: z.ZodInt;
155
+ }, z.core.$strict>, z.ZodObject<{
156
+ type: z.ZodLiteral<"timer">;
157
+ from: z.ZodLiteral<"program_day">;
158
+ day: z.ZodNumber;
159
+ }, z.core.$strict>], "from">], "type">;
160
+ to: z.ZodDefault<z.ZodNullable<z.ZodString>>;
161
+ }, z.core.$strict>>>;
162
+ nudges: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
163
+ afterSilence: z.ZodArray<z.ZodObject<{
164
+ amount: z.ZodNumber;
165
+ unit: z.ZodEnum<{
166
+ d: "d";
167
+ h: "h";
168
+ min: "min";
169
+ }>;
170
+ }, z.core.$strict>>;
171
+ dailyAt: z.ZodOptional<z.ZodArray<z.ZodString>>;
172
+ giveUpAfter: z.ZodOptional<z.ZodObject<{
173
+ amount: z.ZodNumber;
174
+ unit: z.ZodEnum<{
175
+ d: "d";
176
+ h: "h";
177
+ min: "min";
178
+ }>;
179
+ }, z.core.$strict>>;
180
+ days: z.ZodOptional<z.ZodNumber>;
181
+ }, z.core.$strict>, z.ZodLiteral<"off">]>>;
182
+ }, z.core.$strict>>;
183
+ layout: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
184
+ x: z.ZodNumber;
185
+ y: z.ZodNumber;
186
+ }, z.core.$strict>>>;
187
+ schedule: z.ZodOptional<z.ZodObject<{
188
+ dayStart: z.ZodString;
189
+ nightFrom: z.ZodOptional<z.ZodString>;
190
+ lateStartHours: z.ZodDefault<z.ZodNumber>;
191
+ lengthDays: z.ZodOptional<z.ZodInt>;
192
+ deadlineState: z.ZodOptional<z.ZodString>;
193
+ farewellOnDeadline: z.ZodDefault<z.ZodBoolean>;
194
+ farewellText: z.ZodOptional<z.ZodString>;
195
+ firstMessages: z.ZodOptional<z.ZodObject<{
196
+ maxPerDay: z.ZodOptional<z.ZodInt>;
197
+ morning: z.ZodOptional<z.ZodBoolean>;
198
+ skipMorningIfHumanWithinMin: z.ZodOptional<z.ZodInt>;
199
+ }, z.core.$strict>>;
200
+ nudges: z.ZodOptional<z.ZodObject<{
201
+ afterSilence: z.ZodArray<z.ZodObject<{
202
+ amount: z.ZodNumber;
203
+ unit: z.ZodEnum<{
204
+ d: "d";
205
+ h: "h";
206
+ min: "min";
207
+ }>;
208
+ }, z.core.$strict>>;
209
+ dailyAt: z.ZodOptional<z.ZodArray<z.ZodString>>;
210
+ giveUpAfter: z.ZodOptional<z.ZodObject<{
211
+ amount: z.ZodNumber;
212
+ unit: z.ZodEnum<{
213
+ d: "d";
214
+ h: "h";
215
+ min: "min";
216
+ }>;
217
+ }, z.core.$strict>>;
218
+ }, z.core.$strict>>;
219
+ dayFrame: z.ZodOptional<z.ZodObject<{
220
+ softFrom: z.ZodOptional<z.ZodInt>;
221
+ hardAt: z.ZodOptional<z.ZodInt>;
222
+ hardText: z.ZodOptional<z.ZodString>;
223
+ }, z.core.$strict>>;
224
+ }, z.core.$strict>>;
225
+ nudges: z.ZodOptional<z.ZodObject<{
226
+ afterSilence: z.ZodArray<z.ZodObject<{
227
+ amount: z.ZodNumber;
228
+ unit: z.ZodEnum<{
229
+ d: "d";
230
+ h: "h";
231
+ min: "min";
232
+ }>;
233
+ }, z.core.$strict>>;
234
+ dailyAt: z.ZodOptional<z.ZodArray<z.ZodString>>;
235
+ giveUpAfter: z.ZodOptional<z.ZodObject<{
236
+ amount: z.ZodNumber;
237
+ unit: z.ZodEnum<{
238
+ d: "d";
239
+ h: "h";
240
+ min: "min";
241
+ }>;
242
+ }, z.core.$strict>>;
243
+ }, z.core.$strict>>;
244
+ sideTasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
245
+ id: z.ZodString;
246
+ text: z.ZodString;
247
+ when: z.ZodOptional<z.ZodString>;
248
+ field: z.ZodOptional<z.ZodString>;
249
+ maxAttempts: z.ZodDefault<z.ZodInt>;
250
+ perConversation: z.ZodDefault<z.ZodBoolean>;
251
+ }, z.core.$strict>>>;
252
+ afterEnd: z.ZodOptional<z.ZodEnum<{
253
+ reply: "reply";
254
+ silent: "silent";
255
+ }>>;
256
+ }, z.core.$strict>, z.ZodTransform<{
257
+ format: "agent-flow";
258
+ version: 2;
259
+ id: string;
260
+ name: string;
261
+ start: string | null;
262
+ common: string;
263
+ pace: {
264
+ sideQuestionEveryMessages: number;
265
+ };
266
+ clientCard: {
267
+ id: string;
268
+ name: string;
269
+ about: string;
270
+ type: "boolean" | "choice" | "number" | "text";
271
+ options: string[];
272
+ refreshAfterMonths: number | null;
273
+ }[];
274
+ chatNotes: {
275
+ id: string;
276
+ name: string;
277
+ about: string;
278
+ type: "boolean" | "choice" | "number" | "text";
279
+ options: string[];
280
+ }[];
281
+ tools: string[];
282
+ anyState: {
283
+ except: string[];
284
+ exits: {
285
+ id: string;
286
+ when: {
287
+ type: "data";
288
+ field: string;
289
+ op: "contains" | "eq" | "filled" | "gt" | "lt" | "ne";
290
+ value?: string | number | boolean | undefined;
291
+ } | {
292
+ type: "timer";
293
+ from: "in_state" | "silence" | "since_start";
294
+ amount: number;
295
+ unit: "d" | "h" | "min";
296
+ } | {
297
+ type: "timer";
298
+ from: "time_of_day";
299
+ at: string;
300
+ } | {
301
+ type: "timer";
302
+ from: "state_days";
303
+ days: number;
304
+ } | {
305
+ type: "timer";
306
+ from: "program_day";
307
+ day: number;
308
+ } | {
309
+ type: "judge";
310
+ text: string;
311
+ } | {
312
+ type: "event";
313
+ event: "app" | "button" | "message" | "tool";
314
+ name?: string | undefined;
315
+ };
316
+ to: string | null;
317
+ }[];
318
+ };
319
+ states: {
320
+ id: string;
321
+ kind: "state";
322
+ title: string;
323
+ instructions: string;
324
+ firstMessage: string | null;
325
+ learn: string[];
326
+ noSideQuestions: boolean;
327
+ tools: string[];
328
+ tags: string[];
329
+ exits: {
330
+ id: string;
331
+ when: {
332
+ type: "data";
333
+ field: string;
334
+ op: "contains" | "eq" | "filled" | "gt" | "lt" | "ne";
335
+ value?: string | number | boolean | undefined;
336
+ } | {
337
+ type: "timer";
338
+ from: "in_state" | "silence" | "since_start";
339
+ amount: number;
340
+ unit: "d" | "h" | "min";
341
+ } | {
342
+ type: "timer";
343
+ from: "time_of_day";
344
+ at: string;
345
+ } | {
346
+ type: "timer";
347
+ from: "state_days";
348
+ days: number;
349
+ } | {
350
+ type: "timer";
351
+ from: "program_day";
352
+ day: number;
353
+ } | {
354
+ type: "judge";
355
+ text: string;
356
+ } | {
357
+ type: "event";
358
+ event: "app" | "button" | "message" | "tool";
359
+ name?: string | undefined;
360
+ };
361
+ to: string | null;
362
+ }[];
363
+ nudges?: "off" | {
364
+ afterSilence: {
365
+ amount: number;
366
+ unit: "d" | "h" | "min";
367
+ }[];
368
+ dailyAt?: string[] | undefined;
369
+ giveUpAfter?: {
370
+ amount: number;
371
+ unit: "d" | "h" | "min";
372
+ } | undefined;
373
+ days?: number | undefined;
374
+ } | undefined;
375
+ }[];
376
+ layout: Record<string, {
377
+ x: number;
378
+ y: number;
379
+ }>;
380
+ schedule?: {
381
+ dayStart: string;
382
+ nightFrom?: string | undefined;
383
+ lateStartHours: number;
384
+ lengthDays?: number | undefined;
385
+ deadlineState?: string | undefined;
386
+ farewellOnDeadline: boolean;
387
+ farewellText?: string | undefined;
388
+ firstMessages?: {
389
+ maxPerDay?: number | undefined;
390
+ morning?: boolean | undefined;
391
+ skipMorningIfHumanWithinMin?: number | undefined;
392
+ } | undefined;
393
+ nudges?: {
394
+ afterSilence: {
395
+ amount: number;
396
+ unit: "d" | "h" | "min";
397
+ }[];
398
+ dailyAt?: string[] | undefined;
399
+ giveUpAfter?: {
400
+ amount: number;
401
+ unit: "d" | "h" | "min";
402
+ } | undefined;
403
+ } | undefined;
404
+ dayFrame?: {
405
+ softFrom?: number | undefined;
406
+ hardAt?: number | undefined;
407
+ hardText?: string | undefined;
408
+ } | undefined;
409
+ } | undefined;
410
+ nudges?: {
411
+ afterSilence: {
412
+ amount: number;
413
+ unit: "d" | "h" | "min";
414
+ }[];
415
+ dailyAt?: string[] | undefined;
416
+ giveUpAfter?: {
417
+ amount: number;
418
+ unit: "d" | "h" | "min";
419
+ } | undefined;
420
+ } | undefined;
421
+ sideTasks?: {
422
+ id: string;
423
+ text: string;
424
+ when?: string | undefined;
425
+ field?: string | undefined;
426
+ maxAttempts: number;
427
+ perConversation: boolean;
428
+ }[] | undefined;
429
+ afterEnd?: "reply" | "silent" | undefined;
430
+ }, {
431
+ $schema?: string | undefined;
432
+ format: "agent-flow";
433
+ version: 2;
434
+ id: string;
435
+ name: string;
436
+ start: string | null;
437
+ common: string;
438
+ pace: {
439
+ sideQuestionEveryMessages: number;
440
+ };
441
+ clientCard: {
442
+ id: string;
443
+ name: string;
444
+ about: string;
445
+ type: "boolean" | "choice" | "number" | "text";
446
+ options: string[];
447
+ refreshAfterMonths: number | null;
448
+ }[];
449
+ chatNotes: {
450
+ id: string;
451
+ name: string;
452
+ about: string;
453
+ type: "boolean" | "choice" | "number" | "text";
454
+ options: string[];
455
+ }[];
456
+ tools: string[];
457
+ anyState: {
458
+ except: string[];
459
+ exits: {
460
+ id: string;
461
+ when: {
462
+ type: "data";
463
+ field: string;
464
+ op: "contains" | "eq" | "filled" | "gt" | "lt" | "ne";
465
+ value?: string | number | boolean | undefined;
466
+ } | {
467
+ type: "timer";
468
+ from: "in_state" | "silence" | "since_start";
469
+ amount: number;
470
+ unit: "d" | "h" | "min";
471
+ } | {
472
+ type: "timer";
473
+ from: "time_of_day";
474
+ at: string;
475
+ } | {
476
+ type: "timer";
477
+ from: "state_days";
478
+ days: number;
479
+ } | {
480
+ type: "timer";
481
+ from: "program_day";
482
+ day: number;
483
+ } | {
484
+ type: "judge";
485
+ text: string;
486
+ } | {
487
+ type: "event";
488
+ event: "app" | "button" | "message" | "tool";
489
+ name?: string | undefined;
490
+ };
491
+ to: string | null;
492
+ }[];
493
+ };
494
+ states: {
495
+ id: string;
496
+ kind: "state";
497
+ title: string;
498
+ instructions: string;
499
+ firstMessage: string | null;
500
+ learn: string[];
501
+ noSideQuestions: boolean;
502
+ tools: string[];
503
+ tags: string[];
504
+ exits: {
505
+ id: string;
506
+ when: {
507
+ type: "data";
508
+ field: string;
509
+ op: "contains" | "eq" | "filled" | "gt" | "lt" | "ne";
510
+ value?: string | number | boolean | undefined;
511
+ } | {
512
+ type: "timer";
513
+ from: "in_state" | "silence" | "since_start";
514
+ amount: number;
515
+ unit: "d" | "h" | "min";
516
+ } | {
517
+ type: "timer";
518
+ from: "time_of_day";
519
+ at: string;
520
+ } | {
521
+ type: "timer";
522
+ from: "state_days";
523
+ days: number;
524
+ } | {
525
+ type: "timer";
526
+ from: "program_day";
527
+ day: number;
528
+ } | {
529
+ type: "judge";
530
+ text: string;
531
+ } | {
532
+ type: "event";
533
+ event: "app" | "button" | "message" | "tool";
534
+ name?: string | undefined;
535
+ };
536
+ to: string | null;
537
+ }[];
538
+ nudges?: "off" | {
539
+ afterSilence: {
540
+ amount: number;
541
+ unit: "d" | "h" | "min";
542
+ }[];
543
+ dailyAt?: string[] | undefined;
544
+ giveUpAfter?: {
545
+ amount: number;
546
+ unit: "d" | "h" | "min";
547
+ } | undefined;
548
+ days?: number | undefined;
549
+ } | undefined;
550
+ }[];
551
+ layout: Record<string, {
552
+ x: number;
553
+ y: number;
554
+ }>;
555
+ schedule?: {
556
+ dayStart: string;
557
+ nightFrom?: string | undefined;
558
+ lateStartHours: number;
559
+ lengthDays?: number | undefined;
560
+ deadlineState?: string | undefined;
561
+ farewellOnDeadline: boolean;
562
+ farewellText?: string | undefined;
563
+ firstMessages?: {
564
+ maxPerDay?: number | undefined;
565
+ morning?: boolean | undefined;
566
+ skipMorningIfHumanWithinMin?: number | undefined;
567
+ } | undefined;
568
+ nudges?: {
569
+ afterSilence: {
570
+ amount: number;
571
+ unit: "d" | "h" | "min";
572
+ }[];
573
+ dailyAt?: string[] | undefined;
574
+ giveUpAfter?: {
575
+ amount: number;
576
+ unit: "d" | "h" | "min";
577
+ } | undefined;
578
+ } | undefined;
579
+ dayFrame?: {
580
+ softFrom?: number | undefined;
581
+ hardAt?: number | undefined;
582
+ hardText?: string | undefined;
583
+ } | undefined;
584
+ } | undefined;
585
+ nudges?: {
586
+ afterSilence: {
587
+ amount: number;
588
+ unit: "d" | "h" | "min";
589
+ }[];
590
+ dailyAt?: string[] | undefined;
591
+ giveUpAfter?: {
592
+ amount: number;
593
+ unit: "d" | "h" | "min";
594
+ } | undefined;
595
+ } | undefined;
596
+ sideTasks?: {
597
+ id: string;
598
+ text: string;
599
+ when?: string | undefined;
600
+ field?: string | undefined;
601
+ maxAttempts: number;
602
+ perConversation: boolean;
603
+ }[] | undefined;
604
+ afterEnd?: "reply" | "silent" | undefined;
605
+ }>>;
@@ -0,0 +1,7 @@
1
+ export * from "./flow-format.js";
2
+ export { agentFlowSchema, DEFAULT_SIDE_QUESTION_EVERY_MESSAGES } from "./flow-schema.js";
3
+ export { parseFlow } from "./parse-flow.js";
4
+ export { migrateFlow } from "./migrate-flow.js";
5
+ export { catalogEventLabel, catalogEventNames } from "./catalog-events.js";
6
+ export { compactFlow } from "./compact-flow.js";
7
+ export { flowJsonSchema } from "./flow-json-schema.js";
@@ -0,0 +1,4 @@
1
+ type FlowJson = Record<string, unknown>;
2
+ /** Переводит JSON сценария из версии `from` в текущую. Вызывающий проверил, что `from` не новее текущей. */
3
+ export declare function migrateFlow(flow: FlowJson, from: number): FlowJson;
4
+ export {};
@@ -0,0 +1,6 @@
1
+ import { type ParseFlowResult } from "./flow-format.js";
2
+ /**
3
+ * Разбирает сценарий: объект или строку JSON. Старые версии формата переводит в текущую,
4
+ * пропущенные значения дополняет. Проверяет только форму; связи между состояниями проверяет `checkFlow`.
5
+ */
6
+ export declare function parseFlow(input: unknown): ParseFlowResult;
@@ -0,0 +1,3 @@
1
+ export * from "./format/index.js";
2
+ export * from "./engine/index.js";
3
+ export * from "./check/index.js";
@@ -0,0 +1,4 @@
1
+ export * from "./format.js";
2
+ export * from "./runtime/index.js";
3
+ export { memoryFlowStore } from "./store/memory.js";
4
+ export type * from "./store/flow-store.js";
@@ -0,0 +1,20 @@
1
+ /** Надписи экрана карточки клиента. */
2
+ export interface ClientCardLabels {
3
+ title: string;
4
+ empty: string;
5
+ /** «обновлено 12.10.2026». */
6
+ updatedAt: (date: string) => string;
7
+ stale: string;
8
+ /** Название строки свободного факта («ведёт блог») в списке. */
9
+ fact: string;
10
+ forgetField: string;
11
+ forgetAll: string;
12
+ forgetAllConfirm: string;
13
+ confirm: string;
14
+ cancel: string;
15
+ loading: string;
16
+ failed: string;
17
+ retry: string;
18
+ }
19
+ export declare const russianClientCardLabels: ClientCardLabels;
20
+ export declare const englishClientCardLabels: ClientCardLabels;