@actalk/inkos-core 1.2.0 → 1.3.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 (115) hide show
  1. package/dist/agent/agent-session.d.ts +48 -0
  2. package/dist/agent/agent-session.d.ts.map +1 -0
  3. package/dist/agent/agent-session.js +229 -0
  4. package/dist/agent/agent-session.js.map +1 -0
  5. package/dist/agent/agent-system-prompt.d.ts +2 -0
  6. package/dist/agent/agent-system-prompt.d.ts.map +1 -0
  7. package/dist/agent/agent-system-prompt.js +97 -0
  8. package/dist/agent/agent-system-prompt.js.map +1 -0
  9. package/dist/agent/agent-tools.d.ts +30 -0
  10. package/dist/agent/agent-tools.d.ts.map +1 -0
  11. package/dist/agent/agent-tools.js +280 -0
  12. package/dist/agent/agent-tools.js.map +1 -0
  13. package/dist/agent/index.d.ts +4 -0
  14. package/dist/agent/index.d.ts.map +1 -0
  15. package/dist/agent/index.js +4 -0
  16. package/dist/agent/index.js.map +1 -0
  17. package/dist/agents/architect.js +5 -5
  18. package/dist/agents/architect.js.map +1 -1
  19. package/dist/agents/chapter-analyzer.d.ts.map +1 -1
  20. package/dist/agents/chapter-analyzer.js +32 -4
  21. package/dist/agents/chapter-analyzer.js.map +1 -1
  22. package/dist/agents/consolidator.js +1 -1
  23. package/dist/agents/consolidator.js.map +1 -1
  24. package/dist/agents/continuity.js +1 -1
  25. package/dist/agents/continuity.js.map +1 -1
  26. package/dist/agents/fanfic-canon-importer.js +1 -1
  27. package/dist/agents/fanfic-canon-importer.js.map +1 -1
  28. package/dist/agents/foundation-reviewer.js +1 -1
  29. package/dist/agents/foundation-reviewer.js.map +1 -1
  30. package/dist/agents/radar.js +1 -1
  31. package/dist/agents/radar.js.map +1 -1
  32. package/dist/agents/settler-delta-parser.d.ts.map +1 -1
  33. package/dist/agents/settler-delta-parser.js +6 -1
  34. package/dist/agents/settler-delta-parser.js.map +1 -1
  35. package/dist/agents/state-validator.js +21 -3
  36. package/dist/agents/state-validator.js.map +1 -1
  37. package/dist/agents/writer-prompts.js +13 -13
  38. package/dist/agents/writer-prompts.js.map +1 -1
  39. package/dist/agents/writer.js +1 -1
  40. package/dist/agents/writer.js.map +1 -1
  41. package/dist/index.d.ts +9 -2
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +10 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/interaction/book-session-store.d.ts +6 -0
  46. package/dist/interaction/book-session-store.d.ts.map +1 -0
  47. package/dist/interaction/book-session-store.js +59 -0
  48. package/dist/interaction/book-session-store.js.map +1 -0
  49. package/dist/interaction/draft-directive-parser.d.ts +38 -0
  50. package/dist/interaction/draft-directive-parser.d.ts.map +1 -0
  51. package/dist/interaction/draft-directive-parser.js +208 -0
  52. package/dist/interaction/draft-directive-parser.js.map +1 -0
  53. package/dist/interaction/nl-router.d.ts +1 -0
  54. package/dist/interaction/nl-router.d.ts.map +1 -1
  55. package/dist/interaction/nl-router.js +1 -1
  56. package/dist/interaction/nl-router.js.map +1 -1
  57. package/dist/interaction/project-session-store.d.ts +3 -1
  58. package/dist/interaction/project-session-store.d.ts.map +1 -1
  59. package/dist/interaction/project-session-store.js +19 -1
  60. package/dist/interaction/project-session-store.js.map +1 -1
  61. package/dist/interaction/project-tools.d.ts +2 -0
  62. package/dist/interaction/project-tools.d.ts.map +1 -1
  63. package/dist/interaction/project-tools.js +186 -126
  64. package/dist/interaction/project-tools.js.map +1 -1
  65. package/dist/interaction/runtime.d.ts.map +1 -1
  66. package/dist/interaction/runtime.js +14 -1
  67. package/dist/interaction/runtime.js.map +1 -1
  68. package/dist/interaction/session.d.ts +725 -6
  69. package/dist/interaction/session.d.ts.map +1 -1
  70. package/dist/interaction/session.js +65 -0
  71. package/dist/interaction/session.js.map +1 -1
  72. package/dist/llm/config-migration.d.ts +5 -0
  73. package/dist/llm/config-migration.d.ts.map +1 -0
  74. package/dist/llm/config-migration.js +51 -0
  75. package/dist/llm/config-migration.js.map +1 -0
  76. package/dist/llm/provider.d.ts +4 -4
  77. package/dist/llm/provider.d.ts.map +1 -1
  78. package/dist/llm/provider.js +472 -540
  79. package/dist/llm/provider.js.map +1 -1
  80. package/dist/llm/secrets.d.ts +9 -0
  81. package/dist/llm/secrets.d.ts.map +1 -0
  82. package/dist/llm/secrets.js +31 -0
  83. package/dist/llm/secrets.js.map +1 -0
  84. package/dist/llm/service-presets.d.ts +37 -0
  85. package/dist/llm/service-presets.d.ts.map +1 -0
  86. package/dist/llm/service-presets.js +123 -0
  87. package/dist/llm/service-presets.js.map +1 -0
  88. package/dist/llm/service-resolver.d.ts +10 -0
  89. package/dist/llm/service-resolver.d.ts.map +1 -0
  90. package/dist/llm/service-resolver.js +46 -0
  91. package/dist/llm/service-resolver.js.map +1 -0
  92. package/dist/models/project.d.ts +158 -30
  93. package/dist/models/project.d.ts.map +1 -1
  94. package/dist/models/project.js +13 -0
  95. package/dist/models/project.js.map +1 -1
  96. package/dist/pipeline/chapter-persistence.d.ts.map +1 -1
  97. package/dist/pipeline/chapter-persistence.js +5 -1
  98. package/dist/pipeline/chapter-persistence.js.map +1 -1
  99. package/dist/pipeline/chapter-truth-validation.d.ts.map +1 -1
  100. package/dist/pipeline/chapter-truth-validation.js +27 -1
  101. package/dist/pipeline/chapter-truth-validation.js.map +1 -1
  102. package/dist/pipeline/runner.d.ts.map +1 -1
  103. package/dist/pipeline/runner.js +9 -3
  104. package/dist/pipeline/runner.js.map +1 -1
  105. package/dist/state/manager.d.ts +2 -0
  106. package/dist/state/manager.d.ts.map +1 -1
  107. package/dist/state/manager.js +10 -3
  108. package/dist/state/manager.js.map +1 -1
  109. package/dist/state/state-validator.d.ts.map +1 -1
  110. package/dist/state/state-validator.js +44 -33
  111. package/dist/state/state-validator.js.map +1 -1
  112. package/dist/utils/config-loader.d.ts.map +1 -1
  113. package/dist/utils/config-loader.js +149 -32
  114. package/dist/utils/config-loader.js.map +1 -1
  115. package/package.json +4 -3
@@ -18,18 +18,169 @@ export declare const PendingDecisionSchema: z.ZodObject<{
18
18
  chapterNumber?: number | undefined;
19
19
  }>;
20
20
  export type PendingDecision = z.infer<typeof PendingDecisionSchema>;
21
+ export declare const PipelineStageSchema: z.ZodObject<{
22
+ label: z.ZodString;
23
+ status: z.ZodEnum<["pending", "active", "completed"]>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ status: "active" | "completed" | "pending";
26
+ label: string;
27
+ }, {
28
+ status: "active" | "completed" | "pending";
29
+ label: string;
30
+ }>;
31
+ export type PipelineStage = z.infer<typeof PipelineStageSchema>;
32
+ export declare const ToolExecutionSchema: z.ZodObject<{
33
+ id: z.ZodString;
34
+ tool: z.ZodString;
35
+ agent: z.ZodOptional<z.ZodString>;
36
+ label: z.ZodString;
37
+ status: z.ZodEnum<["running", "processing", "completed", "error"]>;
38
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ result: z.ZodOptional<z.ZodString>;
40
+ error: z.ZodOptional<z.ZodString>;
41
+ stages: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
+ label: z.ZodString;
43
+ status: z.ZodEnum<["pending", "active", "completed"]>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ status: "active" | "completed" | "pending";
46
+ label: string;
47
+ }, {
48
+ status: "active" | "completed" | "pending";
49
+ label: string;
50
+ }>, "many">>;
51
+ startedAt: z.ZodNumber;
52
+ completedAt: z.ZodOptional<z.ZodNumber>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ status: "completed" | "error" | "running" | "processing";
55
+ id: string;
56
+ tool: string;
57
+ label: string;
58
+ startedAt: number;
59
+ error?: string | undefined;
60
+ agent?: string | undefined;
61
+ args?: Record<string, unknown> | undefined;
62
+ result?: string | undefined;
63
+ stages?: {
64
+ status: "active" | "completed" | "pending";
65
+ label: string;
66
+ }[] | undefined;
67
+ completedAt?: number | undefined;
68
+ }, {
69
+ status: "completed" | "error" | "running" | "processing";
70
+ id: string;
71
+ tool: string;
72
+ label: string;
73
+ startedAt: number;
74
+ error?: string | undefined;
75
+ agent?: string | undefined;
76
+ args?: Record<string, unknown> | undefined;
77
+ result?: string | undefined;
78
+ stages?: {
79
+ status: "active" | "completed" | "pending";
80
+ label: string;
81
+ }[] | undefined;
82
+ completedAt?: number | undefined;
83
+ }>;
84
+ export type ToolExecution = z.infer<typeof ToolExecutionSchema>;
21
85
  export declare const InteractionMessageSchema: z.ZodObject<{
22
86
  role: z.ZodEnum<["user", "assistant", "system"]>;
23
87
  content: z.ZodString;
88
+ thinking: z.ZodOptional<z.ZodString>;
89
+ toolExecutions: z.ZodOptional<z.ZodArray<z.ZodObject<{
90
+ id: z.ZodString;
91
+ tool: z.ZodString;
92
+ agent: z.ZodOptional<z.ZodString>;
93
+ label: z.ZodString;
94
+ status: z.ZodEnum<["running", "processing", "completed", "error"]>;
95
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
96
+ result: z.ZodOptional<z.ZodString>;
97
+ error: z.ZodOptional<z.ZodString>;
98
+ stages: z.ZodOptional<z.ZodArray<z.ZodObject<{
99
+ label: z.ZodString;
100
+ status: z.ZodEnum<["pending", "active", "completed"]>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ status: "active" | "completed" | "pending";
103
+ label: string;
104
+ }, {
105
+ status: "active" | "completed" | "pending";
106
+ label: string;
107
+ }>, "many">>;
108
+ startedAt: z.ZodNumber;
109
+ completedAt: z.ZodOptional<z.ZodNumber>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ status: "completed" | "error" | "running" | "processing";
112
+ id: string;
113
+ tool: string;
114
+ label: string;
115
+ startedAt: number;
116
+ error?: string | undefined;
117
+ agent?: string | undefined;
118
+ args?: Record<string, unknown> | undefined;
119
+ result?: string | undefined;
120
+ stages?: {
121
+ status: "active" | "completed" | "pending";
122
+ label: string;
123
+ }[] | undefined;
124
+ completedAt?: number | undefined;
125
+ }, {
126
+ status: "completed" | "error" | "running" | "processing";
127
+ id: string;
128
+ tool: string;
129
+ label: string;
130
+ startedAt: number;
131
+ error?: string | undefined;
132
+ agent?: string | undefined;
133
+ args?: Record<string, unknown> | undefined;
134
+ result?: string | undefined;
135
+ stages?: {
136
+ status: "active" | "completed" | "pending";
137
+ label: string;
138
+ }[] | undefined;
139
+ completedAt?: number | undefined;
140
+ }>, "many">>;
24
141
  timestamp: z.ZodNumber;
25
142
  }, "strip", z.ZodTypeAny, {
26
143
  content: string;
27
- role: "system" | "user" | "assistant";
28
144
  timestamp: number;
145
+ role: "system" | "user" | "assistant";
146
+ thinking?: string | undefined;
147
+ toolExecutions?: {
148
+ status: "completed" | "error" | "running" | "processing";
149
+ id: string;
150
+ tool: string;
151
+ label: string;
152
+ startedAt: number;
153
+ error?: string | undefined;
154
+ agent?: string | undefined;
155
+ args?: Record<string, unknown> | undefined;
156
+ result?: string | undefined;
157
+ stages?: {
158
+ status: "active" | "completed" | "pending";
159
+ label: string;
160
+ }[] | undefined;
161
+ completedAt?: number | undefined;
162
+ }[] | undefined;
29
163
  }, {
30
164
  content: string;
31
- role: "system" | "user" | "assistant";
32
165
  timestamp: number;
166
+ role: "system" | "user" | "assistant";
167
+ thinking?: string | undefined;
168
+ toolExecutions?: {
169
+ status: "completed" | "error" | "running" | "processing";
170
+ id: string;
171
+ tool: string;
172
+ label: string;
173
+ startedAt: number;
174
+ error?: string | undefined;
175
+ agent?: string | undefined;
176
+ args?: Record<string, unknown> | undefined;
177
+ result?: string | undefined;
178
+ stages?: {
179
+ status: "active" | "completed" | "pending";
180
+ label: string;
181
+ }[] | undefined;
182
+ completedAt?: number | undefined;
183
+ }[] | undefined;
33
184
  }>;
34
185
  export type InteractionMessage = z.infer<typeof InteractionMessageSchema>;
35
186
  export declare const BookCreationDraftSchema: z.ZodObject<{
@@ -97,6 +248,29 @@ export declare const BookCreationDraftSchema: z.ZodObject<{
97
248
  readyToCreate?: boolean | undefined;
98
249
  }>;
99
250
  export type BookCreationDraft = z.infer<typeof BookCreationDraftSchema>;
251
+ export declare const DraftRoundSchema: z.ZodObject<{
252
+ roundId: z.ZodNumber;
253
+ userMessage: z.ZodString;
254
+ assistantRaw: z.ZodString;
255
+ fieldsUpdated: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
256
+ summary: z.ZodDefault<z.ZodString>;
257
+ timestamp: z.ZodNumber;
258
+ }, "strip", z.ZodTypeAny, {
259
+ timestamp: number;
260
+ summary: string;
261
+ roundId: number;
262
+ userMessage: string;
263
+ assistantRaw: string;
264
+ fieldsUpdated: string[];
265
+ }, {
266
+ timestamp: number;
267
+ roundId: number;
268
+ userMessage: string;
269
+ assistantRaw: string;
270
+ summary?: string | undefined;
271
+ fieldsUpdated?: string[] | undefined;
272
+ }>;
273
+ export type DraftRound = z.infer<typeof DraftRoundSchema>;
100
274
  export declare const InteractionSessionSchema: z.ZodObject<{
101
275
  sessionId: z.ZodString;
102
276
  projectRoot: z.ZodString;
@@ -166,19 +340,128 @@ export declare const InteractionSessionSchema: z.ZodObject<{
166
340
  missingFields?: string[] | undefined;
167
341
  readyToCreate?: boolean | undefined;
168
342
  }>>;
343
+ draftRounds: z.ZodDefault<z.ZodArray<z.ZodObject<{
344
+ roundId: z.ZodNumber;
345
+ userMessage: z.ZodString;
346
+ assistantRaw: z.ZodString;
347
+ fieldsUpdated: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
348
+ summary: z.ZodDefault<z.ZodString>;
349
+ timestamp: z.ZodNumber;
350
+ }, "strip", z.ZodTypeAny, {
351
+ timestamp: number;
352
+ summary: string;
353
+ roundId: number;
354
+ userMessage: string;
355
+ assistantRaw: string;
356
+ fieldsUpdated: string[];
357
+ }, {
358
+ timestamp: number;
359
+ roundId: number;
360
+ userMessage: string;
361
+ assistantRaw: string;
362
+ summary?: string | undefined;
363
+ fieldsUpdated?: string[] | undefined;
364
+ }>, "many">>;
169
365
  automationMode: z.ZodDefault<z.ZodEnum<["auto", "semi", "manual"]>>;
170
366
  messages: z.ZodDefault<z.ZodArray<z.ZodObject<{
171
367
  role: z.ZodEnum<["user", "assistant", "system"]>;
172
368
  content: z.ZodString;
369
+ thinking: z.ZodOptional<z.ZodString>;
370
+ toolExecutions: z.ZodOptional<z.ZodArray<z.ZodObject<{
371
+ id: z.ZodString;
372
+ tool: z.ZodString;
373
+ agent: z.ZodOptional<z.ZodString>;
374
+ label: z.ZodString;
375
+ status: z.ZodEnum<["running", "processing", "completed", "error"]>;
376
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
377
+ result: z.ZodOptional<z.ZodString>;
378
+ error: z.ZodOptional<z.ZodString>;
379
+ stages: z.ZodOptional<z.ZodArray<z.ZodObject<{
380
+ label: z.ZodString;
381
+ status: z.ZodEnum<["pending", "active", "completed"]>;
382
+ }, "strip", z.ZodTypeAny, {
383
+ status: "active" | "completed" | "pending";
384
+ label: string;
385
+ }, {
386
+ status: "active" | "completed" | "pending";
387
+ label: string;
388
+ }>, "many">>;
389
+ startedAt: z.ZodNumber;
390
+ completedAt: z.ZodOptional<z.ZodNumber>;
391
+ }, "strip", z.ZodTypeAny, {
392
+ status: "completed" | "error" | "running" | "processing";
393
+ id: string;
394
+ tool: string;
395
+ label: string;
396
+ startedAt: number;
397
+ error?: string | undefined;
398
+ agent?: string | undefined;
399
+ args?: Record<string, unknown> | undefined;
400
+ result?: string | undefined;
401
+ stages?: {
402
+ status: "active" | "completed" | "pending";
403
+ label: string;
404
+ }[] | undefined;
405
+ completedAt?: number | undefined;
406
+ }, {
407
+ status: "completed" | "error" | "running" | "processing";
408
+ id: string;
409
+ tool: string;
410
+ label: string;
411
+ startedAt: number;
412
+ error?: string | undefined;
413
+ agent?: string | undefined;
414
+ args?: Record<string, unknown> | undefined;
415
+ result?: string | undefined;
416
+ stages?: {
417
+ status: "active" | "completed" | "pending";
418
+ label: string;
419
+ }[] | undefined;
420
+ completedAt?: number | undefined;
421
+ }>, "many">>;
173
422
  timestamp: z.ZodNumber;
174
423
  }, "strip", z.ZodTypeAny, {
175
424
  content: string;
176
- role: "system" | "user" | "assistant";
177
425
  timestamp: number;
426
+ role: "system" | "user" | "assistant";
427
+ thinking?: string | undefined;
428
+ toolExecutions?: {
429
+ status: "completed" | "error" | "running" | "processing";
430
+ id: string;
431
+ tool: string;
432
+ label: string;
433
+ startedAt: number;
434
+ error?: string | undefined;
435
+ agent?: string | undefined;
436
+ args?: Record<string, unknown> | undefined;
437
+ result?: string | undefined;
438
+ stages?: {
439
+ status: "active" | "completed" | "pending";
440
+ label: string;
441
+ }[] | undefined;
442
+ completedAt?: number | undefined;
443
+ }[] | undefined;
178
444
  }, {
179
445
  content: string;
180
- role: "system" | "user" | "assistant";
181
446
  timestamp: number;
447
+ role: "system" | "user" | "assistant";
448
+ thinking?: string | undefined;
449
+ toolExecutions?: {
450
+ status: "completed" | "error" | "running" | "processing";
451
+ id: string;
452
+ tool: string;
453
+ label: string;
454
+ startedAt: number;
455
+ error?: string | undefined;
456
+ agent?: string | undefined;
457
+ args?: Record<string, unknown> | undefined;
458
+ result?: string | undefined;
459
+ stages?: {
460
+ status: "active" | "completed" | "pending";
461
+ label: string;
462
+ }[] | undefined;
463
+ completedAt?: number | undefined;
464
+ }[] | undefined;
182
465
  }>, "many">>;
183
466
  events: z.ZodDefault<z.ZodArray<z.ZodObject<{
184
467
  kind: z.ZodString;
@@ -245,11 +528,36 @@ export declare const InteractionSessionSchema: z.ZodObject<{
245
528
  }[];
246
529
  messages: {
247
530
  content: string;
248
- role: "system" | "user" | "assistant";
249
531
  timestamp: number;
532
+ role: "system" | "user" | "assistant";
533
+ thinking?: string | undefined;
534
+ toolExecutions?: {
535
+ status: "completed" | "error" | "running" | "processing";
536
+ id: string;
537
+ tool: string;
538
+ label: string;
539
+ startedAt: number;
540
+ error?: string | undefined;
541
+ agent?: string | undefined;
542
+ args?: Record<string, unknown> | undefined;
543
+ result?: string | undefined;
544
+ stages?: {
545
+ status: "active" | "completed" | "pending";
546
+ label: string;
547
+ }[] | undefined;
548
+ completedAt?: number | undefined;
549
+ }[] | undefined;
250
550
  }[];
251
551
  sessionId: string;
252
552
  projectRoot: string;
553
+ draftRounds: {
554
+ timestamp: number;
555
+ summary: string;
556
+ roundId: number;
557
+ userMessage: string;
558
+ assistantRaw: string;
559
+ fieldsUpdated: string[];
560
+ }[];
253
561
  automationMode: "auto" | "semi" | "manual";
254
562
  activeBookId?: string | undefined;
255
563
  activeChapterNumber?: number | undefined;
@@ -300,8 +608,25 @@ export declare const InteractionSessionSchema: z.ZodObject<{
300
608
  }[] | undefined;
301
609
  messages?: {
302
610
  content: string;
303
- role: "system" | "user" | "assistant";
304
611
  timestamp: number;
612
+ role: "system" | "user" | "assistant";
613
+ thinking?: string | undefined;
614
+ toolExecutions?: {
615
+ status: "completed" | "error" | "running" | "processing";
616
+ id: string;
617
+ tool: string;
618
+ label: string;
619
+ startedAt: number;
620
+ error?: string | undefined;
621
+ agent?: string | undefined;
622
+ args?: Record<string, unknown> | undefined;
623
+ result?: string | undefined;
624
+ stages?: {
625
+ status: "active" | "completed" | "pending";
626
+ label: string;
627
+ }[] | undefined;
628
+ completedAt?: number | undefined;
629
+ }[] | undefined;
305
630
  }[] | undefined;
306
631
  activeBookId?: string | undefined;
307
632
  activeChapterNumber?: number | undefined;
@@ -327,6 +652,14 @@ export declare const InteractionSessionSchema: z.ZodObject<{
327
652
  missingFields?: string[] | undefined;
328
653
  readyToCreate?: boolean | undefined;
329
654
  } | undefined;
655
+ draftRounds?: {
656
+ timestamp: number;
657
+ roundId: number;
658
+ userMessage: string;
659
+ assistantRaw: string;
660
+ summary?: string | undefined;
661
+ fieldsUpdated?: string[] | undefined;
662
+ }[] | undefined;
330
663
  automationMode?: "auto" | "semi" | "manual" | undefined;
331
664
  pendingDecision?: {
332
665
  bookId: string;
@@ -342,6 +675,392 @@ export declare const InteractionSessionSchema: z.ZodObject<{
342
675
  } | undefined;
343
676
  }>;
344
677
  export type InteractionSession = z.infer<typeof InteractionSessionSchema>;
678
+ export declare const BookSessionSchema: z.ZodObject<{
679
+ sessionId: z.ZodString;
680
+ bookId: z.ZodNullable<z.ZodString>;
681
+ messages: z.ZodDefault<z.ZodArray<z.ZodObject<{
682
+ role: z.ZodEnum<["user", "assistant", "system"]>;
683
+ content: z.ZodString;
684
+ thinking: z.ZodOptional<z.ZodString>;
685
+ toolExecutions: z.ZodOptional<z.ZodArray<z.ZodObject<{
686
+ id: z.ZodString;
687
+ tool: z.ZodString;
688
+ agent: z.ZodOptional<z.ZodString>;
689
+ label: z.ZodString;
690
+ status: z.ZodEnum<["running", "processing", "completed", "error"]>;
691
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
692
+ result: z.ZodOptional<z.ZodString>;
693
+ error: z.ZodOptional<z.ZodString>;
694
+ stages: z.ZodOptional<z.ZodArray<z.ZodObject<{
695
+ label: z.ZodString;
696
+ status: z.ZodEnum<["pending", "active", "completed"]>;
697
+ }, "strip", z.ZodTypeAny, {
698
+ status: "active" | "completed" | "pending";
699
+ label: string;
700
+ }, {
701
+ status: "active" | "completed" | "pending";
702
+ label: string;
703
+ }>, "many">>;
704
+ startedAt: z.ZodNumber;
705
+ completedAt: z.ZodOptional<z.ZodNumber>;
706
+ }, "strip", z.ZodTypeAny, {
707
+ status: "completed" | "error" | "running" | "processing";
708
+ id: string;
709
+ tool: string;
710
+ label: string;
711
+ startedAt: number;
712
+ error?: string | undefined;
713
+ agent?: string | undefined;
714
+ args?: Record<string, unknown> | undefined;
715
+ result?: string | undefined;
716
+ stages?: {
717
+ status: "active" | "completed" | "pending";
718
+ label: string;
719
+ }[] | undefined;
720
+ completedAt?: number | undefined;
721
+ }, {
722
+ status: "completed" | "error" | "running" | "processing";
723
+ id: string;
724
+ tool: string;
725
+ label: string;
726
+ startedAt: number;
727
+ error?: string | undefined;
728
+ agent?: string | undefined;
729
+ args?: Record<string, unknown> | undefined;
730
+ result?: string | undefined;
731
+ stages?: {
732
+ status: "active" | "completed" | "pending";
733
+ label: string;
734
+ }[] | undefined;
735
+ completedAt?: number | undefined;
736
+ }>, "many">>;
737
+ timestamp: z.ZodNumber;
738
+ }, "strip", z.ZodTypeAny, {
739
+ content: string;
740
+ timestamp: number;
741
+ role: "system" | "user" | "assistant";
742
+ thinking?: string | undefined;
743
+ toolExecutions?: {
744
+ status: "completed" | "error" | "running" | "processing";
745
+ id: string;
746
+ tool: string;
747
+ label: string;
748
+ startedAt: number;
749
+ error?: string | undefined;
750
+ agent?: string | undefined;
751
+ args?: Record<string, unknown> | undefined;
752
+ result?: string | undefined;
753
+ stages?: {
754
+ status: "active" | "completed" | "pending";
755
+ label: string;
756
+ }[] | undefined;
757
+ completedAt?: number | undefined;
758
+ }[] | undefined;
759
+ }, {
760
+ content: string;
761
+ timestamp: number;
762
+ role: "system" | "user" | "assistant";
763
+ thinking?: string | undefined;
764
+ toolExecutions?: {
765
+ status: "completed" | "error" | "running" | "processing";
766
+ id: string;
767
+ tool: string;
768
+ label: string;
769
+ startedAt: number;
770
+ error?: string | undefined;
771
+ agent?: string | undefined;
772
+ args?: Record<string, unknown> | undefined;
773
+ result?: string | undefined;
774
+ stages?: {
775
+ status: "active" | "completed" | "pending";
776
+ label: string;
777
+ }[] | undefined;
778
+ completedAt?: number | undefined;
779
+ }[] | undefined;
780
+ }>, "many">>;
781
+ creationDraft: z.ZodOptional<z.ZodObject<{
782
+ concept: z.ZodString;
783
+ title: z.ZodOptional<z.ZodString>;
784
+ genre: z.ZodOptional<z.ZodString>;
785
+ platform: z.ZodOptional<z.ZodString>;
786
+ language: z.ZodOptional<z.ZodEnum<["zh", "en"]>>;
787
+ targetChapters: z.ZodOptional<z.ZodNumber>;
788
+ chapterWordCount: z.ZodOptional<z.ZodNumber>;
789
+ blurb: z.ZodOptional<z.ZodString>;
790
+ worldPremise: z.ZodOptional<z.ZodString>;
791
+ settingNotes: z.ZodOptional<z.ZodString>;
792
+ protagonist: z.ZodOptional<z.ZodString>;
793
+ supportingCast: z.ZodOptional<z.ZodString>;
794
+ conflictCore: z.ZodOptional<z.ZodString>;
795
+ volumeOutline: z.ZodOptional<z.ZodString>;
796
+ constraints: z.ZodOptional<z.ZodString>;
797
+ authorIntent: z.ZodOptional<z.ZodString>;
798
+ currentFocus: z.ZodOptional<z.ZodString>;
799
+ nextQuestion: z.ZodOptional<z.ZodString>;
800
+ missingFields: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
801
+ readyToCreate: z.ZodDefault<z.ZodBoolean>;
802
+ }, "strip", z.ZodTypeAny, {
803
+ concept: string;
804
+ missingFields: string[];
805
+ readyToCreate: boolean;
806
+ title?: string | undefined;
807
+ platform?: string | undefined;
808
+ genre?: string | undefined;
809
+ targetChapters?: number | undefined;
810
+ chapterWordCount?: number | undefined;
811
+ language?: "zh" | "en" | undefined;
812
+ protagonist?: string | undefined;
813
+ authorIntent?: string | undefined;
814
+ currentFocus?: string | undefined;
815
+ volumeOutline?: string | undefined;
816
+ blurb?: string | undefined;
817
+ worldPremise?: string | undefined;
818
+ settingNotes?: string | undefined;
819
+ supportingCast?: string | undefined;
820
+ conflictCore?: string | undefined;
821
+ constraints?: string | undefined;
822
+ nextQuestion?: string | undefined;
823
+ }, {
824
+ concept: string;
825
+ title?: string | undefined;
826
+ platform?: string | undefined;
827
+ genre?: string | undefined;
828
+ targetChapters?: number | undefined;
829
+ chapterWordCount?: number | undefined;
830
+ language?: "zh" | "en" | undefined;
831
+ protagonist?: string | undefined;
832
+ authorIntent?: string | undefined;
833
+ currentFocus?: string | undefined;
834
+ volumeOutline?: string | undefined;
835
+ blurb?: string | undefined;
836
+ worldPremise?: string | undefined;
837
+ settingNotes?: string | undefined;
838
+ supportingCast?: string | undefined;
839
+ conflictCore?: string | undefined;
840
+ constraints?: string | undefined;
841
+ nextQuestion?: string | undefined;
842
+ missingFields?: string[] | undefined;
843
+ readyToCreate?: boolean | undefined;
844
+ }>>;
845
+ draftRounds: z.ZodDefault<z.ZodArray<z.ZodObject<{
846
+ roundId: z.ZodNumber;
847
+ userMessage: z.ZodString;
848
+ assistantRaw: z.ZodString;
849
+ fieldsUpdated: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
850
+ summary: z.ZodDefault<z.ZodString>;
851
+ timestamp: z.ZodNumber;
852
+ }, "strip", z.ZodTypeAny, {
853
+ timestamp: number;
854
+ summary: string;
855
+ roundId: number;
856
+ userMessage: string;
857
+ assistantRaw: string;
858
+ fieldsUpdated: string[];
859
+ }, {
860
+ timestamp: number;
861
+ roundId: number;
862
+ userMessage: string;
863
+ assistantRaw: string;
864
+ summary?: string | undefined;
865
+ fieldsUpdated?: string[] | undefined;
866
+ }>, "many">>;
867
+ events: z.ZodDefault<z.ZodArray<z.ZodObject<{
868
+ kind: z.ZodString;
869
+ timestamp: z.ZodNumber;
870
+ status: z.ZodEnum<["idle", "planning", "composing", "writing", "assessing", "repairing", "persisting", "waiting_human", "blocked", "completed", "failed"]>;
871
+ bookId: z.ZodOptional<z.ZodString>;
872
+ chapterNumber: z.ZodOptional<z.ZodNumber>;
873
+ detail: z.ZodOptional<z.ZodString>;
874
+ }, "strip", z.ZodTypeAny, {
875
+ status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
876
+ kind: string;
877
+ timestamp: number;
878
+ detail?: string | undefined;
879
+ bookId?: string | undefined;
880
+ chapterNumber?: number | undefined;
881
+ }, {
882
+ status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
883
+ kind: string;
884
+ timestamp: number;
885
+ detail?: string | undefined;
886
+ bookId?: string | undefined;
887
+ chapterNumber?: number | undefined;
888
+ }>, "many">>;
889
+ currentExecution: z.ZodOptional<z.ZodObject<{
890
+ status: z.ZodEnum<["idle", "planning", "composing", "writing", "assessing", "repairing", "persisting", "waiting_human", "blocked", "completed", "failed"]>;
891
+ bookId: z.ZodOptional<z.ZodString>;
892
+ chapterNumber: z.ZodOptional<z.ZodNumber>;
893
+ stageLabel: z.ZodOptional<z.ZodString>;
894
+ }, "strip", z.ZodTypeAny, {
895
+ status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
896
+ bookId?: string | undefined;
897
+ chapterNumber?: number | undefined;
898
+ stageLabel?: string | undefined;
899
+ }, {
900
+ status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
901
+ bookId?: string | undefined;
902
+ chapterNumber?: number | undefined;
903
+ stageLabel?: string | undefined;
904
+ }>>;
905
+ createdAt: z.ZodNumber;
906
+ updatedAt: z.ZodNumber;
907
+ }, "strip", z.ZodTypeAny, {
908
+ createdAt: number;
909
+ updatedAt: number;
910
+ events: {
911
+ status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
912
+ kind: string;
913
+ timestamp: number;
914
+ detail?: string | undefined;
915
+ bookId?: string | undefined;
916
+ chapterNumber?: number | undefined;
917
+ }[];
918
+ messages: {
919
+ content: string;
920
+ timestamp: number;
921
+ role: "system" | "user" | "assistant";
922
+ thinking?: string | undefined;
923
+ toolExecutions?: {
924
+ status: "completed" | "error" | "running" | "processing";
925
+ id: string;
926
+ tool: string;
927
+ label: string;
928
+ startedAt: number;
929
+ error?: string | undefined;
930
+ agent?: string | undefined;
931
+ args?: Record<string, unknown> | undefined;
932
+ result?: string | undefined;
933
+ stages?: {
934
+ status: "active" | "completed" | "pending";
935
+ label: string;
936
+ }[] | undefined;
937
+ completedAt?: number | undefined;
938
+ }[] | undefined;
939
+ }[];
940
+ bookId: string | null;
941
+ sessionId: string;
942
+ draftRounds: {
943
+ timestamp: number;
944
+ summary: string;
945
+ roundId: number;
946
+ userMessage: string;
947
+ assistantRaw: string;
948
+ fieldsUpdated: string[];
949
+ }[];
950
+ creationDraft?: {
951
+ concept: string;
952
+ missingFields: string[];
953
+ readyToCreate: boolean;
954
+ title?: string | undefined;
955
+ platform?: string | undefined;
956
+ genre?: string | undefined;
957
+ targetChapters?: number | undefined;
958
+ chapterWordCount?: number | undefined;
959
+ language?: "zh" | "en" | undefined;
960
+ protagonist?: string | undefined;
961
+ authorIntent?: string | undefined;
962
+ currentFocus?: string | undefined;
963
+ volumeOutline?: string | undefined;
964
+ blurb?: string | undefined;
965
+ worldPremise?: string | undefined;
966
+ settingNotes?: string | undefined;
967
+ supportingCast?: string | undefined;
968
+ conflictCore?: string | undefined;
969
+ constraints?: string | undefined;
970
+ nextQuestion?: string | undefined;
971
+ } | undefined;
972
+ currentExecution?: {
973
+ status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
974
+ bookId?: string | undefined;
975
+ chapterNumber?: number | undefined;
976
+ stageLabel?: string | undefined;
977
+ } | undefined;
978
+ }, {
979
+ createdAt: number;
980
+ updatedAt: number;
981
+ bookId: string | null;
982
+ sessionId: string;
983
+ events?: {
984
+ status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
985
+ kind: string;
986
+ timestamp: number;
987
+ detail?: string | undefined;
988
+ bookId?: string | undefined;
989
+ chapterNumber?: number | undefined;
990
+ }[] | undefined;
991
+ messages?: {
992
+ content: string;
993
+ timestamp: number;
994
+ role: "system" | "user" | "assistant";
995
+ thinking?: string | undefined;
996
+ toolExecutions?: {
997
+ status: "completed" | "error" | "running" | "processing";
998
+ id: string;
999
+ tool: string;
1000
+ label: string;
1001
+ startedAt: number;
1002
+ error?: string | undefined;
1003
+ agent?: string | undefined;
1004
+ args?: Record<string, unknown> | undefined;
1005
+ result?: string | undefined;
1006
+ stages?: {
1007
+ status: "active" | "completed" | "pending";
1008
+ label: string;
1009
+ }[] | undefined;
1010
+ completedAt?: number | undefined;
1011
+ }[] | undefined;
1012
+ }[] | undefined;
1013
+ creationDraft?: {
1014
+ concept: string;
1015
+ title?: string | undefined;
1016
+ platform?: string | undefined;
1017
+ genre?: string | undefined;
1018
+ targetChapters?: number | undefined;
1019
+ chapterWordCount?: number | undefined;
1020
+ language?: "zh" | "en" | undefined;
1021
+ protagonist?: string | undefined;
1022
+ authorIntent?: string | undefined;
1023
+ currentFocus?: string | undefined;
1024
+ volumeOutline?: string | undefined;
1025
+ blurb?: string | undefined;
1026
+ worldPremise?: string | undefined;
1027
+ settingNotes?: string | undefined;
1028
+ supportingCast?: string | undefined;
1029
+ conflictCore?: string | undefined;
1030
+ constraints?: string | undefined;
1031
+ nextQuestion?: string | undefined;
1032
+ missingFields?: string[] | undefined;
1033
+ readyToCreate?: boolean | undefined;
1034
+ } | undefined;
1035
+ draftRounds?: {
1036
+ timestamp: number;
1037
+ roundId: number;
1038
+ userMessage: string;
1039
+ assistantRaw: string;
1040
+ summary?: string | undefined;
1041
+ fieldsUpdated?: string[] | undefined;
1042
+ }[] | undefined;
1043
+ currentExecution?: {
1044
+ status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
1045
+ bookId?: string | undefined;
1046
+ chapterNumber?: number | undefined;
1047
+ stageLabel?: string | undefined;
1048
+ } | undefined;
1049
+ }>;
1050
+ export type BookSession = z.infer<typeof BookSessionSchema>;
1051
+ export declare const GlobalSessionSchema: z.ZodObject<{
1052
+ activeBookId: z.ZodOptional<z.ZodString>;
1053
+ automationMode: z.ZodDefault<z.ZodEnum<["auto", "semi", "manual"]>>;
1054
+ }, "strip", z.ZodTypeAny, {
1055
+ automationMode: "auto" | "semi" | "manual";
1056
+ activeBookId?: string | undefined;
1057
+ }, {
1058
+ activeBookId?: string | undefined;
1059
+ automationMode?: "auto" | "semi" | "manual" | undefined;
1060
+ }>;
1061
+ export type GlobalSession = z.infer<typeof GlobalSessionSchema>;
1062
+ export declare function createBookSession(bookId: string | null): BookSession;
1063
+ export declare function appendBookSessionMessage(session: BookSession, message: InteractionMessage): BookSession;
345
1064
  export declare function bindActiveBook(session: InteractionSession, bookId: string, chapterNumber?: number): InteractionSession;
346
1065
  export declare function clearPendingDecision(session: InteractionSession): InteractionSession;
347
1066
  export declare function updateCreationDraft(session: InteractionSession, draft: BookCreationDraft): InteractionSession;