dominds 1.16.1 → 1.16.2

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 (175) hide show
  1. package/dist/dialog-display-state.d.ts +4 -0
  2. package/dist/dialog-display-state.js +138 -19
  3. package/dist/dialog-fork.js +13 -5
  4. package/dist/dialog-interruption.d.ts +18 -0
  5. package/dist/dialog-interruption.js +34 -0
  6. package/dist/docs/dominds-agent-collaboration.zh.md +401 -0
  7. package/dist/llm/api-quirks.d.ts +11 -0
  8. package/dist/llm/api-quirks.js +322 -24
  9. package/dist/llm/defaults.yaml +2 -1
  10. package/dist/llm/gen/mock.d.ts +1 -1
  11. package/dist/llm/gen/mock.js +12 -0
  12. package/dist/llm/gen/openai-compatible.d.ts +1 -1
  13. package/dist/llm/gen/openai-compatible.js +9 -1
  14. package/dist/llm/gen/openai.d.ts +1 -1
  15. package/dist/llm/gen/openai.js +16 -2
  16. package/dist/llm/gen.d.ts +10 -0
  17. package/dist/llm/gen.js +10 -0
  18. package/dist/llm/kernel-driver/drive.js +994 -866
  19. package/dist/llm/kernel-driver/runtime.d.ts +16 -2
  20. package/dist/llm/kernel-driver/runtime.js +75 -10
  21. package/dist/llm/stop-reason-i18n.d.ts +9 -0
  22. package/dist/llm/stop-reason-i18n.js +114 -0
  23. package/dist/persistence-errors.d.ts +26 -0
  24. package/dist/persistence-errors.js +68 -0
  25. package/dist/persistence.d.ts +119 -82
  26. package/dist/persistence.js +1055 -426
  27. package/dist/server/api-routes.js +174 -58
  28. package/dist/server/websocket-handler.js +125 -21
  29. package/dist/tools/team_mgmt.js +2 -2
  30. package/package.json +3 -3
  31. package/webapp/dist/assets/{_basePickBy-C0MXVhMo.js → _basePickBy-BJWCmtUm.js} +3 -3
  32. package/webapp/dist/assets/_basePickBy-BJWCmtUm.js.map +1 -0
  33. package/webapp/dist/assets/{_baseUniq-CRygl41M.js → _baseUniq-D6k_lGfs.js} +2 -2
  34. package/webapp/dist/assets/_baseUniq-D6k_lGfs.js.map +1 -0
  35. package/webapp/dist/assets/{arc-BeHJtnt2.js → arc-DYDaESgj.js} +2 -2
  36. package/webapp/dist/assets/arc-DYDaESgj.js.map +1 -0
  37. package/webapp/dist/assets/{architectureDiagram-2XIMDMQ5-CGdo5TVi.js → architectureDiagram-VXUJARFQ-DZMT7dqc.js} +8 -26
  38. package/webapp/dist/assets/architectureDiagram-VXUJARFQ-DZMT7dqc.js.map +1 -0
  39. package/webapp/dist/assets/{blockDiagram-WCTKOSBZ-C59VaSGw.js → blockDiagram-VD42YOAC-CABpgVAa.js} +170 -187
  40. package/webapp/dist/assets/blockDiagram-VD42YOAC-CABpgVAa.js.map +1 -0
  41. package/webapp/dist/assets/{c4Diagram-IC4MRINW-B3YCBmTx.js → c4Diagram-YG6GDRKO-COLZS8Ul.js} +4 -4
  42. package/webapp/dist/assets/c4Diagram-YG6GDRKO-COLZS8Ul.js.map +1 -0
  43. package/webapp/dist/assets/{channel-Dn4i8EAY.js → channel-CYFm9Cri.js} +2 -2
  44. package/webapp/dist/assets/channel-CYFm9Cri.js.map +1 -0
  45. package/webapp/dist/assets/{chunk-4BX2VUAB-CQbB3HlW.js → chunk-4BX2VUAB-CX_-XbaN.js} +2 -2
  46. package/webapp/dist/assets/chunk-4BX2VUAB-CX_-XbaN.js.map +1 -0
  47. package/webapp/dist/assets/{chunk-55IACEB6-CkQR_Qu9.js → chunk-55IACEB6-ByD-NdBC.js} +2 -2
  48. package/webapp/dist/assets/chunk-55IACEB6-ByD-NdBC.js.map +1 -0
  49. package/webapp/dist/assets/{chunk-WL4C6EOR-Bjl-j3bf.js → chunk-B4BG7PRW-BANemsDD.js} +121 -171
  50. package/webapp/dist/assets/chunk-B4BG7PRW-BANemsDD.js.map +1 -0
  51. package/webapp/dist/assets/{chunk-NQ4KR5QH-DBxY8LL2.js → chunk-DI55MBZ5-DV7sdJmQ.js} +7 -9
  52. package/webapp/dist/assets/chunk-DI55MBZ5-DV7sdJmQ.js.map +1 -0
  53. package/webapp/dist/assets/{chunk-FMBD7UC4-YSIOuaST.js → chunk-FMBD7UC4-DYGviJnf.js} +2 -2
  54. package/webapp/dist/assets/chunk-FMBD7UC4-DYGviJnf.js.map +1 -0
  55. package/webapp/dist/assets/{chunk-KX2RTZJC-DFiwgnFf.js → chunk-QN33PNHL-B8DWRL9f.js} +2 -2
  56. package/webapp/dist/assets/chunk-QN33PNHL-B8DWRL9f.js.map +1 -0
  57. package/webapp/dist/assets/{chunk-QZHKN3VN-BAdR6lLc.js → chunk-QZHKN3VN-B1aYIzMR.js} +2 -2
  58. package/webapp/dist/assets/chunk-QZHKN3VN-B1aYIzMR.js.map +1 -0
  59. package/webapp/dist/assets/{chunk-JSJVCQXG-CWDLRawz.js → chunk-TZMSLE5B-_HISzxl3.js} +6 -14
  60. package/webapp/dist/assets/chunk-TZMSLE5B-_HISzxl3.js.map +1 -0
  61. package/webapp/dist/assets/{classDiagram-VBA2DB6C-KBeS6WXD.js → classDiagram-2ON5EDUG-CpyYj1Rc.js} +6 -7
  62. package/webapp/dist/assets/classDiagram-2ON5EDUG-CpyYj1Rc.js.map +1 -0
  63. package/webapp/dist/assets/{classDiagram-v2-RAHNMMFH-KBeS6WXD.js → classDiagram-v2-WZHVMYZB-CpyYj1Rc.js} +6 -7
  64. package/webapp/dist/assets/classDiagram-v2-WZHVMYZB-CpyYj1Rc.js.map +1 -0
  65. package/webapp/dist/assets/{clone-C7-aS2vm.js → clone-B_9AxWIU.js} +2 -2
  66. package/webapp/dist/assets/clone-B_9AxWIU.js.map +1 -0
  67. package/webapp/dist/assets/{cose-bilkent-S5V4N54A-Bo5IsL-5.js → cose-bilkent-S5V4N54A-17ECLfPR.js} +2 -2
  68. package/webapp/dist/assets/cose-bilkent-S5V4N54A-17ECLfPR.js.map +1 -0
  69. package/webapp/dist/assets/cytoscape.esm-Bm8DJGmZ.js.map +1 -1
  70. package/webapp/dist/assets/{dagre-KLK3FWXG-C3FeHj7D.js → dagre-6UL2VRFP-DhRqcF1o.js} +7 -7
  71. package/webapp/dist/assets/dagre-6UL2VRFP-DhRqcF1o.js.map +1 -0
  72. package/webapp/dist/assets/defaultLocale-B2RvLBDe.js.map +1 -1
  73. package/webapp/dist/assets/{diagram-E7M64L7V-0HfiRW0u.js → diagram-PSM6KHXK-lpDT6Wwb.js} +10 -10
  74. package/webapp/dist/assets/diagram-PSM6KHXK-lpDT6Wwb.js.map +1 -0
  75. package/webapp/dist/assets/{diagram-IFDJBPK2-DJwh7SMO.js → diagram-QEK2KX5R-ohxbPpDH.js} +8 -9
  76. package/webapp/dist/assets/diagram-QEK2KX5R-ohxbPpDH.js.map +1 -0
  77. package/webapp/dist/assets/{diagram-P4PSJMXO-Y0RbvUZX.js → diagram-S2PKOQOG-DAFFGfch.js} +8 -8
  78. package/webapp/dist/assets/diagram-S2PKOQOG-DAFFGfch.js.map +1 -0
  79. package/webapp/dist/assets/{erDiagram-INFDFZHY-B183xyLa.js → erDiagram-Q2GNP2WA-BH-7rI43.js} +75 -96
  80. package/webapp/dist/assets/erDiagram-Q2GNP2WA-BH-7rI43.js.map +1 -0
  81. package/webapp/dist/assets/{flowDiagram-PKNHOUZH-C_BR3Y3J.js → flowDiagram-NV44I4VS-CdEjFbz4.js} +81 -98
  82. package/webapp/dist/assets/flowDiagram-NV44I4VS-CdEjFbz4.js.map +1 -0
  83. package/webapp/dist/assets/{ganttDiagram-A5KZAMGK-CHLgkuJT.js → ganttDiagram-JELNMOA3-Cju2t-lK.js} +3 -28
  84. package/webapp/dist/assets/ganttDiagram-JELNMOA3-Cju2t-lK.js.map +1 -0
  85. package/webapp/dist/assets/{gitGraphDiagram-K3NZZRJ6-D6C_HU1q.js → gitGraphDiagram-V2S2FVAM-CUJ5oxCg.js} +46 -38
  86. package/webapp/dist/assets/gitGraphDiagram-V2S2FVAM-CUJ5oxCg.js.map +1 -0
  87. package/webapp/dist/assets/graph-mhcc7ldf.js +425 -0
  88. package/webapp/dist/assets/graph-mhcc7ldf.js.map +1 -0
  89. package/webapp/dist/assets/{index-CLoNHmSQ.js → index-BLnM-uON.js} +2098 -1841
  90. package/webapp/dist/assets/{index-CLoNHmSQ.js.map → index-BLnM-uON.js.map} +1 -1
  91. package/webapp/dist/assets/{index-YaxF76or.css → index-xvYYeHuy.css} +1 -1
  92. package/webapp/dist/assets/{infoDiagram-LFFYTUFH-mnMS61NO.js → infoDiagram-HS3SLOUP-Df8p0okQ.js} +7 -7
  93. package/webapp/dist/assets/infoDiagram-HS3SLOUP-Df8p0okQ.js.map +1 -0
  94. package/webapp/dist/assets/init-ZxktEp_H.js.map +1 -1
  95. package/webapp/dist/assets/{journeyDiagram-4ABVD52K-BdeERn0r.js → journeyDiagram-XKPGCS4Q-BXMl8H-d.js} +5 -5
  96. package/webapp/dist/assets/journeyDiagram-XKPGCS4Q-BXMl8H-d.js.map +1 -0
  97. package/webapp/dist/assets/{kanban-definition-K7BYSVSG-MLeCGcYg.js → kanban-definition-3W4ZIXB7-Cc5RwCEh.js} +3 -5
  98. package/webapp/dist/assets/kanban-definition-3W4ZIXB7-Cc5RwCEh.js.map +1 -0
  99. package/webapp/dist/assets/{layout-DY9VEQ9M.js → layout-BB2SvQcE.js} +5 -5
  100. package/webapp/dist/assets/layout-BB2SvQcE.js.map +1 -0
  101. package/webapp/dist/assets/{linear-D-T1xRsr.js → linear-Cj50lA0a.js} +2 -2
  102. package/webapp/dist/assets/linear-Cj50lA0a.js.map +1 -0
  103. package/webapp/dist/assets/{mindmap-definition-YRQLILUH-CrVm8vj2.js → mindmap-definition-VGOIOE7T-BLBklJVX.js} +5 -7
  104. package/webapp/dist/assets/mindmap-definition-VGOIOE7T-BLBklJVX.js.map +1 -0
  105. package/webapp/dist/assets/ordinal-CxptdPJm.js.map +1 -1
  106. package/webapp/dist/assets/{pieDiagram-SKSYHLDU-GtLLV0r1.js → pieDiagram-ADFJNKIX-BQrOgSc-.js} +8 -8
  107. package/webapp/dist/assets/pieDiagram-ADFJNKIX-BQrOgSc-.js.map +1 -0
  108. package/webapp/dist/assets/{quadrantDiagram-337W2JSQ-BCgk_2LP.js → quadrantDiagram-AYHSOK5B-C62TxtsO.js} +3 -3
  109. package/webapp/dist/assets/quadrantDiagram-AYHSOK5B-C62TxtsO.js.map +1 -0
  110. package/webapp/dist/assets/{requirementDiagram-Z7DCOOCP-DYUKHWKR.js → requirementDiagram-UZGBJVZJ-Is6Q3osM.js} +6 -16
  111. package/webapp/dist/assets/requirementDiagram-UZGBJVZJ-Is6Q3osM.js.map +1 -0
  112. package/webapp/dist/assets/{sankeyDiagram-WA2Y5GQK-CFAH8OaY.js → sankeyDiagram-TZEHDZUN-CCAW8Dr2.js} +2 -2
  113. package/webapp/dist/assets/sankeyDiagram-TZEHDZUN-CCAW8Dr2.js.map +1 -0
  114. package/webapp/dist/assets/{sequenceDiagram-2WXFIKYE-BTnhbv6w.js → sequenceDiagram-WL72ISMW-DpODpbl6.js} +201 -601
  115. package/webapp/dist/assets/sequenceDiagram-WL72ISMW-DpODpbl6.js.map +1 -0
  116. package/webapp/dist/assets/{stateDiagram-RAJIS63D-DWUnJTwO.js → stateDiagram-FKZM4ZOC-B8LHaf5T.js} +9 -9
  117. package/webapp/dist/assets/stateDiagram-FKZM4ZOC-B8LHaf5T.js.map +1 -0
  118. package/webapp/dist/assets/{stateDiagram-v2-FVOUBMTO-B-fc52bp.js → stateDiagram-v2-4FDKWEC3-4FzTkpgz.js} +5 -5
  119. package/webapp/dist/assets/stateDiagram-v2-4FDKWEC3-4FzTkpgz.js.map +1 -0
  120. package/webapp/dist/assets/{timeline-definition-YZTLITO2-BMZ52QaG.js → timeline-definition-IT6M3QCI-Ckxc4qZe.js} +3 -3
  121. package/webapp/dist/assets/timeline-definition-IT6M3QCI-Ckxc4qZe.js.map +1 -0
  122. package/webapp/dist/assets/{treemap-KZPCXAKY-fgSrze0S.js → treemap-GDKQZRPO-QQa4vKMv.js} +24 -37
  123. package/webapp/dist/assets/treemap-GDKQZRPO-QQa4vKMv.js.map +1 -0
  124. package/webapp/dist/assets/{xychartDiagram-JWTSCODW-D6aviLtC.js → xychartDiagram-PRI3JC2R-Ba2uJcs6.js} +4 -4
  125. package/webapp/dist/assets/xychartDiagram-PRI3JC2R-Ba2uJcs6.js.map +1 -0
  126. package/webapp/dist/index.html +2 -2
  127. package/webapp/dist/assets/_basePickBy-C0MXVhMo.js.map +0 -1
  128. package/webapp/dist/assets/_baseUniq-CRygl41M.js.map +0 -1
  129. package/webapp/dist/assets/arc-BeHJtnt2.js.map +0 -1
  130. package/webapp/dist/assets/architectureDiagram-2XIMDMQ5-CGdo5TVi.js.map +0 -1
  131. package/webapp/dist/assets/blockDiagram-WCTKOSBZ-C59VaSGw.js.map +0 -1
  132. package/webapp/dist/assets/c4Diagram-IC4MRINW-B3YCBmTx.js.map +0 -1
  133. package/webapp/dist/assets/channel-Dn4i8EAY.js.map +0 -1
  134. package/webapp/dist/assets/chunk-4BX2VUAB-CQbB3HlW.js.map +0 -1
  135. package/webapp/dist/assets/chunk-55IACEB6-CkQR_Qu9.js.map +0 -1
  136. package/webapp/dist/assets/chunk-FMBD7UC4-YSIOuaST.js.map +0 -1
  137. package/webapp/dist/assets/chunk-JSJVCQXG-CWDLRawz.js.map +0 -1
  138. package/webapp/dist/assets/chunk-KX2RTZJC-DFiwgnFf.js.map +0 -1
  139. package/webapp/dist/assets/chunk-NQ4KR5QH-DBxY8LL2.js.map +0 -1
  140. package/webapp/dist/assets/chunk-QZHKN3VN-BAdR6lLc.js.map +0 -1
  141. package/webapp/dist/assets/chunk-WL4C6EOR-Bjl-j3bf.js.map +0 -1
  142. package/webapp/dist/assets/classDiagram-VBA2DB6C-KBeS6WXD.js.map +0 -1
  143. package/webapp/dist/assets/classDiagram-v2-RAHNMMFH-KBeS6WXD.js.map +0 -1
  144. package/webapp/dist/assets/clone-C7-aS2vm.js.map +0 -1
  145. package/webapp/dist/assets/cose-bilkent-S5V4N54A-Bo5IsL-5.js.map +0 -1
  146. package/webapp/dist/assets/dagre-KLK3FWXG-C3FeHj7D.js.map +0 -1
  147. package/webapp/dist/assets/diagram-E7M64L7V-0HfiRW0u.js.map +0 -1
  148. package/webapp/dist/assets/diagram-IFDJBPK2-DJwh7SMO.js.map +0 -1
  149. package/webapp/dist/assets/diagram-P4PSJMXO-Y0RbvUZX.js.map +0 -1
  150. package/webapp/dist/assets/erDiagram-INFDFZHY-B183xyLa.js.map +0 -1
  151. package/webapp/dist/assets/flowDiagram-PKNHOUZH-C_BR3Y3J.js.map +0 -1
  152. package/webapp/dist/assets/ganttDiagram-A5KZAMGK-CHLgkuJT.js.map +0 -1
  153. package/webapp/dist/assets/gitGraphDiagram-K3NZZRJ6-D6C_HU1q.js.map +0 -1
  154. package/webapp/dist/assets/graph-D0hgB-X8.js +0 -782
  155. package/webapp/dist/assets/graph-D0hgB-X8.js.map +0 -1
  156. package/webapp/dist/assets/infoDiagram-LFFYTUFH-mnMS61NO.js.map +0 -1
  157. package/webapp/dist/assets/ishikawaDiagram-PHBUUO56-XFIJsnJj.js +0 -966
  158. package/webapp/dist/assets/ishikawaDiagram-PHBUUO56-XFIJsnJj.js.map +0 -1
  159. package/webapp/dist/assets/journeyDiagram-4ABVD52K-BdeERn0r.js.map +0 -1
  160. package/webapp/dist/assets/kanban-definition-K7BYSVSG-MLeCGcYg.js.map +0 -1
  161. package/webapp/dist/assets/layout-DY9VEQ9M.js.map +0 -1
  162. package/webapp/dist/assets/linear-D-T1xRsr.js.map +0 -1
  163. package/webapp/dist/assets/mindmap-definition-YRQLILUH-CrVm8vj2.js.map +0 -1
  164. package/webapp/dist/assets/pieDiagram-SKSYHLDU-GtLLV0r1.js.map +0 -1
  165. package/webapp/dist/assets/quadrantDiagram-337W2JSQ-BCgk_2LP.js.map +0 -1
  166. package/webapp/dist/assets/requirementDiagram-Z7DCOOCP-DYUKHWKR.js.map +0 -1
  167. package/webapp/dist/assets/sankeyDiagram-WA2Y5GQK-CFAH8OaY.js.map +0 -1
  168. package/webapp/dist/assets/sequenceDiagram-2WXFIKYE-BTnhbv6w.js.map +0 -1
  169. package/webapp/dist/assets/stateDiagram-RAJIS63D-DWUnJTwO.js.map +0 -1
  170. package/webapp/dist/assets/stateDiagram-v2-FVOUBMTO-B-fc52bp.js.map +0 -1
  171. package/webapp/dist/assets/timeline-definition-YZTLITO2-BMZ52QaG.js.map +0 -1
  172. package/webapp/dist/assets/treemap-KZPCXAKY-fgSrze0S.js.map +0 -1
  173. package/webapp/dist/assets/vennDiagram-LZ73GAT5-D5DmDY9l.js +0 -2487
  174. package/webapp/dist/assets/vennDiagram-LZ73GAT5-D5DmDY9l.js.map +0 -1
  175. package/webapp/dist/assets/xychartDiagram-JWTSCODW-D6aviLtC.js.map +0 -1
@@ -8,11 +8,28 @@ import type { ContextHealthSnapshot } from '@longrun-ai/kernel/types/context-hea
8
8
  import type { NativeToolCallPayload, WebSearchCallAction, WebSearchCallSource } from '@longrun-ai/kernel/types/dialog';
9
9
  import type { LanguageCode } from '@longrun-ai/kernel/types/language';
10
10
  import type { DialogLatestFile, DialogMetadataFile, HumanQuestion, PendingSubdialogStateRecord, PersistedDialogRecord, ProviderData, ReasoningPayload, ReconciledRecordWriteTarget, RootDialogMetadataFile, RootGenerationAnchor, SubdialogMetadataFile, SubdialogRegistryStateRecord, SubdialogResponseStateRecord, TellaskCallRecordName, TellaskReplyDirective } from '@longrun-ai/kernel/types/storage';
11
+ import type { DialogsQuarantinedMessage, DialogStatusKind } from '@longrun-ai/kernel/types/wire';
11
12
  import { WebSocket } from 'ws';
12
13
  import type { PendingSubdialog } from './dialog';
13
14
  import { Dialog, DialogID, DialogStore, RootDialog, SubDialog } from './dialog';
14
15
  import { ChatMessage, FuncResultMsg, TellaskCarryoverMsg, TellaskResultMsg } from './llm/client';
15
16
  import { Reminder } from './tool';
17
+ export declare function setDialogsQuarantinedBroadcaster(fn: ((msg: DialogsQuarantinedMessage) => void) | null): void;
18
+ export declare function setPrepareDialogQuarantineHook(fn: ((args: {
19
+ dialogId: DialogID;
20
+ rootDialogId: DialogID;
21
+ status: DialogStatusKind;
22
+ reason: string;
23
+ error: Error;
24
+ }) => Promise<void> | void) | null): void;
25
+ export declare function setFinalizeDialogQuarantineHook(fn: ((args: {
26
+ dialogId: DialogID;
27
+ rootDialogId: DialogID;
28
+ status: DialogStatusKind;
29
+ reason: string;
30
+ error: Error;
31
+ quarantined: boolean;
32
+ }) => Promise<void> | void) | null): void;
16
33
  export interface DialogPersistenceState {
17
34
  metadata: DialogMetadataFile;
18
35
  currentCourse: number;
@@ -150,16 +167,16 @@ export declare class DiskFileDialogStore extends DialogStore {
150
167
  /**
151
168
  * Load Questions for Human state from storage
152
169
  */
153
- loadQuestions4Human(dialogId: DialogID, status: 'running' | 'completed' | 'archived'): Promise<HumanQuestion[]>;
154
- loadDialogMetadata(dialogId: DialogID, status: 'running' | 'completed' | 'archived'): Promise<DialogMetadataFile | null>;
155
- loadPendingSubdialogs(rootDialogId: DialogID, status: 'running' | 'completed' | 'archived'): Promise<PendingSubdialog[]>;
170
+ loadQuestions4Human(dialogId: DialogID, status: DialogStatusKind): Promise<HumanQuestion[]>;
171
+ loadDialogMetadata(dialogId: DialogID, status: DialogStatusKind): Promise<DialogMetadataFile | null>;
172
+ loadPendingSubdialogs(rootDialogId: DialogID, status: DialogStatusKind): Promise<PendingSubdialog[]>;
156
173
  saveSubdialogRegistry(dialog: RootDialog, rootDialogId: DialogID, entries: Array<{
157
174
  key: string;
158
175
  subdialogId: DialogID;
159
176
  agentId: string;
160
177
  sessionSlug?: string;
161
- }>, status: 'running' | 'completed' | 'archived'): Promise<void>;
162
- loadSubdialogRegistry(rootDialog: RootDialog, status: 'running' | 'completed' | 'archived'): Promise<void>;
178
+ }>, status: DialogStatusKind): Promise<void>;
179
+ loadSubdialogRegistry(rootDialog: RootDialog, status: DialogStatusKind): Promise<void>;
163
180
  /**
164
181
  * Clear Questions for Human state in storage
165
182
  */
@@ -185,7 +202,7 @@ export declare class DiskFileDialogStore extends DialogStore {
185
202
  * @param course - Optional course number (uses dialog.currentCourse if not provided)
186
203
  * @param totalCourses - Optional total courses count (defaults to course/currentCourse)
187
204
  */
188
- sendDialogEventsDirectly(ws: WebSocket, dialog: Dialog, course?: number, totalCourses?: number, status?: 'running' | 'completed' | 'archived', options?: {
205
+ sendDialogEventsDirectly(ws: WebSocket, dialog: Dialog, course?: number, totalCourses?: number, status?: DialogStatusKind, options?: {
189
206
  showPrimingEventsInUi?: boolean;
190
207
  }): Promise<void>;
191
208
  /**
@@ -253,6 +270,12 @@ type DialogLatestMutation = {
253
270
  kind: 'replace';
254
271
  next: DialogLatestFile;
255
272
  };
273
+ type RootDialogWriteBackCancellationToken = Readonly<{
274
+ scopeKey: string;
275
+ generation: number;
276
+ rootDialogId: string;
277
+ status: DialogStatusKind;
278
+ }>;
256
279
  /**
257
280
  * Utility class for managing dialog persistence
258
281
  */
@@ -263,6 +286,7 @@ export declare class DialogPersistence {
263
286
  private static readonly DONE_DIR;
264
287
  private static readonly ARCHIVE_DIR;
265
288
  private static readonly SUBDIALOGS_DIR;
289
+ private static readonly quarantinedRootDialogScopes;
266
290
  private static readonly LATEST_WRITEBACK_WINDOW_MS;
267
291
  private static readonly Q4H_WRITEBACK_WINDOW_MS;
268
292
  private static readonly PENDING_SUBDIALOGS_WRITEBACK_WINDOW_MS;
@@ -273,6 +297,7 @@ export declare class DialogPersistence {
273
297
  private static readonly pendingSubdialogsWriteBackMutexes;
274
298
  private static readonly pendingSubdialogsWriteBack;
275
299
  private static readonly courseAppendMutexes;
300
+ private static readonly rootDialogWriteBackCancelGenerations;
276
301
  private static getLatestWriteBackMutex;
277
302
  private static getQ4HWriteBackMutex;
278
303
  private static getCourseAppendMutex;
@@ -281,116 +306,129 @@ export declare class DialogPersistence {
281
306
  private static getLatestWriteBackKey;
282
307
  private static getQ4HWriteBackKey;
283
308
  private static getPendingSubdialogsWriteBackKey;
309
+ private static getRootDialogWriteBackCancelScopeKey;
310
+ private static createRootDialogWriteBackCancellationToken;
311
+ private static assertRootDialogWriteBackNotCanceled;
312
+ private static rethrowWriteBackPathMissingAsCanceled;
313
+ private static cancelRootDialogWriteBacks;
314
+ private static getDialogMetadataPath;
315
+ private static assertDialogMetadataExistsForAppend;
316
+ private static cleanupCanceledAppendPlaceholder;
284
317
  private static clonePendingSubdialogRecords;
285
318
  private static cloneQuestions4Human;
286
319
  private static cloneRegistryEntries;
287
320
  private static cloneSubdialogResponses;
288
- static appendRemindersReconciledRecord(dialogId: DialogID, reminders: readonly Reminder[], writeTarget: ReconciledRecordWriteTarget, status: 'running' | 'completed' | 'archived'): Promise<void>;
289
- static appendQuestions4HumanReconciledRecord(dialogId: DialogID, questions: readonly HumanQuestion[], writeTarget: ReconciledRecordWriteTarget, status: 'running' | 'completed' | 'archived'): Promise<void>;
290
- static appendPendingSubdialogsReconciledRecord(dialogId: DialogID, pendingSubdialogs: readonly PendingSubdialogStateRecord[], writeTarget: ReconciledRecordWriteTarget, status: 'running' | 'completed' | 'archived'): Promise<void>;
291
- static appendSubdialogRegistryReconciledRecord(dialogId: DialogID, entries: readonly SubdialogRegistryStateRecord[], writeTarget: ReconciledRecordWriteTarget, status: 'running' | 'completed' | 'archived'): Promise<void>;
292
- static appendSubdialogResponsesReconciledRecord(dialogId: DialogID, responses: readonly SubdialogResponseStateRecord[], writeTarget: ReconciledRecordWriteTarget, status: 'running' | 'completed' | 'archived'): Promise<void>;
321
+ static appendRemindersReconciledRecord(dialogId: DialogID, reminders: readonly Reminder[], writeTarget: ReconciledRecordWriteTarget, status: DialogStatusKind): Promise<void>;
322
+ static appendQuestions4HumanReconciledRecord(dialogId: DialogID, questions: readonly HumanQuestion[], writeTarget: ReconciledRecordWriteTarget, status: DialogStatusKind): Promise<void>;
323
+ static appendPendingSubdialogsReconciledRecord(dialogId: DialogID, pendingSubdialogs: readonly PendingSubdialogStateRecord[], writeTarget: ReconciledRecordWriteTarget, status: DialogStatusKind): Promise<void>;
324
+ static appendSubdialogRegistryReconciledRecord(dialogId: DialogID, entries: readonly SubdialogRegistryStateRecord[], writeTarget: ReconciledRecordWriteTarget, status: DialogStatusKind): Promise<void>;
325
+ static appendSubdialogResponsesReconciledRecord(dialogId: DialogID, responses: readonly SubdialogResponseStateRecord[], writeTarget: ReconciledRecordWriteTarget, status: DialogStatusKind): Promise<void>;
293
326
  /**
294
327
  * Get the base dialogs directory path
295
328
  */
296
329
  static getDialogsRootDir(): string;
297
- /**
298
- * Save dialog state to JSON file for persistence (internal use only)
299
- */
300
- private static saveDialogState;
301
- /**
302
- * Load dialog state from JSON file
303
- */
304
- static loadDialogState(dialogId: DialogID): Promise<DialogPersistenceState | null>;
305
330
  /**
306
331
  * Get the full path for a dialog directory
307
332
  */
308
- static getRootDialogPath(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): string;
333
+ static getRootDialogPath(dialogId: DialogID, status?: DialogStatusKind): string;
309
334
  /**
310
335
  * Get the events/state directory for a dialog (composite ID for subdialogs)
311
336
  */
312
- static getDialogEventsPath(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): string;
337
+ static getDialogEventsPath(dialogId: DialogID, status?: DialogStatusKind): string;
313
338
  /**
314
339
  * Get the path for a subdialog within a supdialog
315
340
  */
316
- static getSubdialogPath(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): string;
317
- private static isMalformedDialogLoadError;
341
+ static getSubdialogPath(dialogId: DialogID, status?: DialogStatusKind): string;
318
342
  private static getMalformedRootDialogPath;
343
+ private static inferRootDialogIdFromMetadataRelativeDir;
344
+ private static inferExpectedDialogIdFromMetadataRelativeDir;
345
+ private static listSubdialogIdsUnderRoot;
319
346
  private static pathExists;
320
347
  private static clearLatestWriteBackState;
321
- private static quarantineMalformedRootDialog;
348
+ private static clearWriteBackEntriesForRootDialog;
349
+ private static quarantineMalformedDialog;
350
+ private static rethrowAfterQuarantiningDialogPersistenceProblem;
322
351
  private static parseDialogLatestYaml;
323
352
  /**
324
353
  * Ensure dialog directory structure exists
325
354
  */
326
- static ensureRootDialogDirectory(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<string>;
355
+ static ensureRootDialogDirectory(dialogId: DialogID, status?: DialogStatusKind): Promise<string>;
327
356
  /**
328
357
  * Ensure subdialog directory structure exists
329
358
  */
330
- static ensureSubdialogDirectory(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<string>;
359
+ static ensureSubdialogDirectory(dialogId: DialogID, status?: DialogStatusKind): Promise<string>;
331
360
  /**
332
361
  * Mark a dialog as completed
333
362
  */
334
363
  static markDialogCompleted(dialogId: DialogID): Promise<void>;
335
364
  /**
336
- * List all dialog IDs by scanning for dialog.yaml files and validating their IDs
365
+ * List candidate root dialog IDs by scanning `dialog.yaml`.
366
+ *
367
+ * This scanner intentionally stays lightweight: it only validates the path<->id identity needed
368
+ * for safe enumeration, and leaves full metadata shape validation to the subsequent lazy-load
369
+ * step. Callers iterating these candidate IDs must therefore tolerate per-dialog load failures
370
+ * and continue after a malformed dialog is quarantined.
337
371
  */
338
- static listDialogs(status?: 'running' | 'completed' | 'archived'): Promise<string[]>;
372
+ static listDialogs(status?: DialogStatusKind): Promise<string[]>;
339
373
  /**
340
374
  * List all dialog IDs (root + subdialogs) together with their root IDs.
341
375
  * This is the only safe way to enumerate subdialogs because their directory names
342
376
  * are not guaranteed to be their selfId.
377
+ *
378
+ * Like `listDialogs()`, this is a candidate scanner rather than a full metadata validator.
379
+ * Callers must treat later metadata/latest loads as lazy, per-dialog operations that can still
380
+ * quarantine one dialog without invalidating the rest of the enumeration.
343
381
  */
344
- static listAllDialogIds(status?: 'running' | 'completed' | 'archived'): Promise<DialogID[]>;
382
+ static listAllDialogIds(status?: DialogStatusKind): Promise<DialogID[]>;
345
383
  /**
346
384
  * Append event to course JSONL file (append-only pattern)
347
385
  */
348
- static appendEvents(dialogId: DialogID, course: number, events: readonly PersistedDialogRecord[], status?: 'running' | 'completed' | 'archived'): Promise<void>;
349
- static appendEvent(dialogId: DialogID, course: number, event: PersistedDialogRecord, status?: 'running' | 'completed' | 'archived'): Promise<void>;
386
+ static appendEvents(dialogId: DialogID, course: number, events: readonly PersistedDialogRecord[], status?: DialogStatusKind): Promise<void>;
387
+ static appendEvent(dialogId: DialogID, course: number, event: PersistedDialogRecord, status?: DialogStatusKind): Promise<void>;
350
388
  static persistRuntimeGuide(dialog: Dialog, content: string, genseq: number): Promise<void>;
351
389
  /**
352
390
  * Capture the current byte offset of a course JSONL file.
353
391
  * Used as rollback checkpoint before a streaming LLM attempt.
354
392
  */
355
- static captureCourseFileOffset(dialogId: DialogID, course: number, status?: 'running' | 'completed' | 'archived'): Promise<number>;
393
+ static captureCourseFileOffset(dialogId: DialogID, course: number, status?: DialogStatusKind): Promise<number>;
356
394
  /**
357
395
  * Rollback a course JSONL file to a previously captured byte offset.
358
396
  * This is used to discard partial streaming artifacts before retrying.
359
397
  */
360
- static rollbackCourseFileToOffset(dialogId: DialogID, course: number, offset: number, status?: 'running' | 'completed' | 'archived'): Promise<void>;
398
+ static rollbackCourseFileToOffset(dialogId: DialogID, course: number, offset: number, status?: DialogStatusKind): Promise<void>;
361
399
  /**
362
400
  * Read all events from course JSONL file
363
401
  */
364
- static readCourseEvents(dialogId: DialogID, course: number, status?: 'running' | 'completed' | 'archived'): Promise<PersistedDialogRecord[]>;
402
+ static readCourseEvents(dialogId: DialogID, course: number, status?: DialogStatusKind): Promise<PersistedDialogRecord[]>;
365
403
  /**
366
404
  * Compute next sequence number for a course by scanning existing events
367
405
  */
368
- static getNextSeq(dialogId: DialogID, course: number, status?: 'running' | 'completed' | 'archived'): Promise<number>;
406
+ static getNextSeq(dialogId: DialogID, course: number, status?: DialogStatusKind): Promise<number>;
369
407
  /**
370
408
  * Get current course number from latest.yaml (performance optimization)
371
409
  * UI navigation can assume natural numbering schema back to 1
372
410
  */
373
- static getCurrentCourseNumber(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<number>;
411
+ static getCurrentCourseNumber(dialogId: DialogID, status?: DialogStatusKind): Promise<number>;
374
412
  /**
375
413
  * Save reminder state (exceptional overwrite pattern) (internal use only)
376
414
  */
377
- static _saveReminderState(dialogId: DialogID, reminders: Reminder[], status?: 'running' | 'completed' | 'archived'): Promise<void>;
415
+ static _saveReminderState(dialogId: DialogID, reminders: Reminder[], status?: DialogStatusKind): Promise<void>;
378
416
  /**
379
417
  * Load reminder state
380
418
  */
381
- static loadReminderState(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<Reminder[]>;
419
+ static loadReminderState(dialogId: DialogID, status?: DialogStatusKind): Promise<Reminder[]>;
382
420
  /**
383
421
  * Save questions for human state (exceptional overwrite pattern) (internal use only)
384
422
  */
385
- static _saveQuestions4HumanState(dialogId: DialogID, questions: HumanQuestion[], status?: 'running' | 'completed' | 'archived'): Promise<void>;
423
+ static _saveQuestions4HumanState(dialogId: DialogID, questions: HumanQuestion[], status?: DialogStatusKind): Promise<void>;
386
424
  /**
387
425
  * Load questions for human state
388
426
  */
389
- static loadQuestions4HumanState(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<HumanQuestion[]>;
427
+ static loadQuestions4HumanState(dialogId: DialogID, status?: DialogStatusKind): Promise<HumanQuestion[]>;
390
428
  private static loadQuestions4HumanStateFromDisk;
391
- static mutateQuestions4HumanState(dialogId: DialogID, mutator: (previous: HumanQuestion[]) => Q4HMutation, status?: 'running' | 'completed' | 'archived'): Promise<Q4HMutateOutcome>;
392
- static appendQuestion4HumanState(dialogId: DialogID, question: HumanQuestion, status?: 'running' | 'completed' | 'archived'): Promise<void>;
393
- static removeQuestion4HumanState(dialogId: DialogID, questionId: string, status?: 'running' | 'completed' | 'archived'): Promise<{
429
+ static mutateQuestions4HumanState(dialogId: DialogID, mutator: (previous: HumanQuestion[]) => Q4HMutation, status?: DialogStatusKind): Promise<Q4HMutateOutcome>;
430
+ static appendQuestion4HumanState(dialogId: DialogID, question: HumanQuestion, status?: DialogStatusKind): Promise<void>;
431
+ static removeQuestion4HumanState(dialogId: DialogID, questionId: string, status?: DialogStatusKind): Promise<{
394
432
  found: boolean;
395
433
  remainingQuestions: HumanQuestion[];
396
434
  removedQuestion?: HumanQuestion;
@@ -415,41 +453,41 @@ export declare class DialogPersistence {
415
453
  messageIndex: number;
416
454
  };
417
455
  }>>;
418
- static clearQuestions4HumanState(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<void>;
456
+ static clearQuestions4HumanState(dialogId: DialogID, status?: DialogStatusKind): Promise<void>;
419
457
  /**
420
458
  * Save pending subdialogs for Type A supply mechanism.
421
459
  * Tracks subdialogs that were created but not yet completed.
422
460
  */
423
- static savePendingSubdialogs(rootDialogId: DialogID, pendingSubdialogs: PendingSubdialogStateRecord[], rootAnchor?: RootGenerationAnchor, status?: 'running' | 'completed' | 'archived'): Promise<void>;
461
+ static savePendingSubdialogs(rootDialogId: DialogID, pendingSubdialogs: PendingSubdialogStateRecord[], rootAnchor?: RootGenerationAnchor, status?: DialogStatusKind): Promise<void>;
424
462
  /**
425
463
  * Load pending subdialogs for Type A supply mechanism.
426
464
  */
427
- static loadPendingSubdialogs(rootDialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<PendingSubdialogStateRecord[]>;
465
+ static loadPendingSubdialogs(rootDialogId: DialogID, status?: DialogStatusKind): Promise<PendingSubdialogStateRecord[]>;
428
466
  private static isPendingSubdialogRecord;
429
467
  private static loadPendingSubdialogsFromDisk;
430
- static mutatePendingSubdialogs(rootDialogId: DialogID, mutator: (previous: PendingSubdialogStateRecord[]) => PendingSubdialogsMutation, rootAnchor?: RootGenerationAnchor, status?: 'running' | 'completed' | 'archived'): Promise<PendingSubdialogsMutateOutcome>;
431
- static appendPendingSubdialog(rootDialogId: DialogID, record: PendingSubdialogStateRecord, rootAnchor?: RootGenerationAnchor, status?: 'running' | 'completed' | 'archived'): Promise<void>;
432
- static removePendingSubdialog(rootDialogId: DialogID, subdialogId: string, rootAnchor?: RootGenerationAnchor, status?: 'running' | 'completed' | 'archived'): Promise<void>;
433
- static clearPendingSubdialogs(rootDialogId: DialogID, rootAnchor?: RootGenerationAnchor, status?: 'running' | 'completed' | 'archived'): Promise<void>;
468
+ static mutatePendingSubdialogs(rootDialogId: DialogID, mutator: (previous: PendingSubdialogStateRecord[]) => PendingSubdialogsMutation, rootAnchor?: RootGenerationAnchor, status?: DialogStatusKind): Promise<PendingSubdialogsMutateOutcome>;
469
+ static appendPendingSubdialog(rootDialogId: DialogID, record: PendingSubdialogStateRecord, rootAnchor?: RootGenerationAnchor, status?: DialogStatusKind): Promise<void>;
470
+ static removePendingSubdialog(rootDialogId: DialogID, subdialogId: string, rootAnchor?: RootGenerationAnchor, status?: DialogStatusKind): Promise<void>;
471
+ static clearPendingSubdialogs(rootDialogId: DialogID, rootAnchor?: RootGenerationAnchor, status?: DialogStatusKind): Promise<void>;
434
472
  private static flushPendingSubdialogsWriteBack;
435
473
  private static writePendingSubdialogsToDisk;
436
474
  /**
437
475
  * Get the path for storing subdialog responses (supports both root and subdialog parents).
438
476
  * For Type C subdialogs created inside another subdialog, responses are stored at the parent's level.
439
477
  */
440
- static getDialogResponsesPath(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): string;
478
+ static getDialogResponsesPath(dialogId: DialogID, status?: DialogStatusKind): string;
441
479
  /**
442
480
  * Save subdialog responses for Type A supply mechanism.
443
481
  * Tracks responses from completed subdialogs.
444
482
  */
445
- static saveSubdialogResponses(rootDialogId: DialogID, responses: SubdialogResponseStateRecord[], rootAnchor?: RootGenerationAnchor, status?: 'running' | 'completed' | 'archived'): Promise<void>;
483
+ static saveSubdialogResponses(rootDialogId: DialogID, responses: SubdialogResponseStateRecord[], rootAnchor?: RootGenerationAnchor, status?: DialogStatusKind): Promise<void>;
446
484
  /**
447
485
  * Load subdialog responses for Type A supply mechanism.
448
486
  */
449
- static loadSubdialogResponses(rootDialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<SubdialogResponseStateRecord[]>;
450
- static loadSubdialogResponsesQueue(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<SubdialogResponseStateRecord[]>;
451
- static appendSubdialogResponse(dialogId: DialogID, response: SubdialogResponseStateRecord, rootAnchor?: RootGenerationAnchor, status?: 'running' | 'completed' | 'archived'): Promise<void>;
452
- static takeSubdialogResponses(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<Array<{
487
+ static loadSubdialogResponses(rootDialogId: DialogID, status?: DialogStatusKind): Promise<SubdialogResponseStateRecord[]>;
488
+ static loadSubdialogResponsesQueue(dialogId: DialogID, status?: DialogStatusKind): Promise<SubdialogResponseStateRecord[]>;
489
+ static appendSubdialogResponse(dialogId: DialogID, response: SubdialogResponseStateRecord, rootAnchor?: RootGenerationAnchor, status?: DialogStatusKind): Promise<void>;
490
+ static takeSubdialogResponses(dialogId: DialogID, status?: DialogStatusKind): Promise<Array<{
453
491
  responseId: string;
454
492
  subdialogId: string;
455
493
  response: string;
@@ -463,38 +501,37 @@ export declare class DialogPersistence {
463
501
  originMemberId: string;
464
502
  callId: string;
465
503
  }>>;
466
- static commitTakenSubdialogResponses(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<void>;
467
- static rollbackTakenSubdialogResponses(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<void>;
504
+ static commitTakenSubdialogResponses(dialogId: DialogID, status?: DialogStatusKind): Promise<void>;
505
+ static rollbackTakenSubdialogResponses(dialogId: DialogID, status?: DialogStatusKind): Promise<void>;
468
506
  /**
469
507
  * Save root dialog metadata (write-once pattern)
470
508
  */
471
- static saveRootDialogMetadata(dialogId: DialogID, metadata: RootDialogMetadataFile, status?: 'running' | 'completed' | 'archived'): Promise<void>;
509
+ static saveRootDialogMetadata(dialogId: DialogID, metadata: RootDialogMetadataFile, status?: DialogStatusKind): Promise<void>;
472
510
  /**
473
511
  * Save dialog metadata (universal - works with any DialogID)
474
512
  */
475
- static saveDialogMetadata(dialogId: DialogID, metadata: DialogMetadataFile, status?: 'running' | 'completed' | 'archived'): Promise<void>;
513
+ static saveDialogMetadata(dialogId: DialogID, metadata: DialogMetadataFile, status?: DialogStatusKind): Promise<void>;
476
514
  /**
477
515
  * Save dialog metadata (legacy - use saveRootDialogMetadata instead)
478
516
  * @deprecated
479
517
  */
480
- static _saveDialogMetadata(dialogId: DialogID, metadata: RootDialogMetadataFile, status?: 'running' | 'completed' | 'archived'): Promise<void>;
518
+ static _saveDialogMetadata(dialogId: DialogID, metadata: RootDialogMetadataFile, status?: DialogStatusKind): Promise<void>;
481
519
  /**
482
520
  * Save subdialog metadata under the supdialog's .subdialogs directory
483
521
  */
484
- static saveSubdialogMetadata(dialogId: DialogID, metadata: SubdialogMetadataFile, status?: 'running' | 'completed' | 'archived'): Promise<void>;
522
+ static saveSubdialogMetadata(dialogId: DialogID, metadata: SubdialogMetadataFile, status?: DialogStatusKind): Promise<void>;
485
523
  /**
486
524
  * Update assignmentFromSup for an existing subdialog.
487
- * Persists both subdialog metadata locations for consistency.
488
525
  */
489
- static updateSubdialogAssignment(dialogId: DialogID, assignment: SubdialogMetadataFile['assignmentFromSup'], status?: 'running' | 'completed' | 'archived'): Promise<void>;
526
+ static updateSubdialogAssignment(dialogId: DialogID, assignment: SubdialogMetadataFile['assignmentFromSup'], status?: DialogStatusKind): Promise<void>;
490
527
  /**
491
528
  * Load root dialog metadata
492
529
  */
493
- static loadRootDialogMetadata(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<DialogMetadataFile | null>;
530
+ static loadRootDialogMetadata(dialogId: DialogID, status?: DialogStatusKind): Promise<DialogMetadataFile | null>;
494
531
  /**
495
532
  * Load dialog metadata (universal - works with any DialogID)
496
533
  */
497
- static loadDialogMetadata(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<DialogMetadataFile | null>;
534
+ static loadDialogMetadata(dialogId: DialogID, status?: DialogStatusKind): Promise<DialogMetadataFile | null>;
498
535
  /**
499
536
  * Save latest.yaml with current course and lastModified info
500
537
  */
@@ -506,7 +543,7 @@ export declare class DialogPersistence {
506
543
  /**
507
544
  * Load latest.yaml for current course and lastModified info
508
545
  */
509
- static loadDialogLatest(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<DialogLatestFile | null>;
546
+ static loadDialogLatest(dialogId: DialogID, status?: DialogStatusKind): Promise<DialogLatestFile | null>;
510
547
  /**
511
548
  * Delta-only latest.yaml update API.
512
549
  *
@@ -514,13 +551,13 @@ export declare class DialogPersistence {
514
551
  * staged state (or disk fallback). This avoids read-modify-write races in user code
515
552
  * and allows lock-free-ish coalescing to disk via the write-back buffer.
516
553
  */
517
- static mutateDialogLatest(dialogId: DialogID, mutator: (previous: DialogLatestFile) => DialogLatestMutation, status?: 'running' | 'completed' | 'archived'): Promise<DialogLatestFile>;
554
+ static mutateDialogLatest(dialogId: DialogID, mutator: (previous: DialogLatestFile) => DialogLatestMutation, status?: DialogStatusKind, cancellationToken?: RootDialogWriteBackCancellationToken): Promise<DialogLatestFile>;
518
555
  private static loadDialogLatestFromDisk;
519
556
  private static flushLatestWriteBack;
520
- static setNeedsDrive(dialogId: DialogID, needsDrive: boolean, status?: 'running' | 'completed' | 'archived'): Promise<void>;
521
- static getNeedsDrive(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<boolean>;
522
- static setDeferredReplyReassertion(dialogId: DialogID, deferredReplyReassertion: DialogLatestFile['deferredReplyReassertion'], status?: 'running' | 'completed' | 'archived'): Promise<void>;
523
- static getDeferredReplyReassertion(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<DialogLatestFile['deferredReplyReassertion']>;
557
+ static setNeedsDrive(dialogId: DialogID, needsDrive: boolean, status?: DialogStatusKind): Promise<void>;
558
+ static getNeedsDrive(dialogId: DialogID, status?: DialogStatusKind): Promise<boolean>;
559
+ static setDeferredReplyReassertion(dialogId: DialogID, deferredReplyReassertion: DialogLatestFile['deferredReplyReassertion'], status?: DialogStatusKind): Promise<void>;
560
+ static getDeferredReplyReassertion(dialogId: DialogID, status?: DialogStatusKind): Promise<DialogLatestFile['deferredReplyReassertion']>;
524
561
  /**
525
562
  * Get course filename from course number
526
563
  */
@@ -532,16 +569,16 @@ export declare class DialogPersistence {
532
569
  /**
533
570
  * Get dialog status from file system path
534
571
  */
535
- static getStatusFromPath(dialogPath: string): 'running' | 'completed' | 'archived';
536
- static loadQuestions4Human(dialogId: DialogID, course: number, status?: 'running' | 'completed' | 'archived'): Promise<Questions4Human | null>;
572
+ static getStatusFromPath(dialogPath: string): DialogStatusKind;
573
+ static loadQuestions4Human(dialogId: DialogID, course: number, status?: DialogStatusKind): Promise<Questions4Human | null>;
537
574
  /**
538
575
  * Count subdialogs under a root dialog (no single-layer listing exposed)
539
576
  */
540
- static countAllSubdialogsUnderRoot(rootDialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<number>;
577
+ static countAllSubdialogsUnderRoot(rootDialogId: DialogID, status?: DialogStatusKind): Promise<number>;
541
578
  /**
542
579
  * Restore complete dialog tree from disk
543
580
  */
544
- static restoreDialogTree(rootDialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<DialogPersistenceState | null>;
581
+ static restoreDialogTree(rootDialogId: DialogID, status?: DialogStatusKind): Promise<DialogPersistenceState | null>;
545
582
  /**
546
583
  * Restore dialog from disk using JSONL events (optimized: only latest course loaded).
547
584
  * Historical-course ask/tellask context that still matters to the current round must already be
@@ -549,11 +586,11 @@ export declare class DialogPersistence {
549
586
  * LLM context during restore. For historical courses, use loadCourseEvents() on-demand for UI
550
587
  * navigation.
551
588
  */
552
- static restoreDialog(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<DialogPersistenceState | null>;
589
+ static restoreDialog(dialogId: DialogID, status?: DialogStatusKind): Promise<DialogPersistenceState | null>;
553
590
  /**
554
591
  * Load specific course events for UI navigation (on-demand)
555
592
  */
556
- static loadCourseEvents(dialogId: DialogID, course: number, status?: 'running' | 'completed' | 'archived'): Promise<PersistedDialogRecord[]>;
593
+ static loadCourseEvents(dialogId: DialogID, course: number, status?: DialogStatusKind): Promise<PersistedDialogRecord[]>;
557
594
  /**
558
595
  * Reconstruct dialog state from JSONL events (optimized: only latest course needed).
559
596
  */
@@ -561,12 +598,12 @@ export declare class DialogPersistence {
561
598
  /**
562
599
  * Move dialog between status directories (run/done/archive)
563
600
  */
564
- static moveDialogStatus(dialogId: DialogID, fromStatus: 'running' | 'completed' | 'archived', toStatus: 'running' | 'completed' | 'archived'): Promise<void>;
601
+ static moveDialogStatus(dialogId: DialogID, fromStatus: DialogStatusKind, toStatus: DialogStatusKind): Promise<void>;
565
602
  /**
566
603
  * Delete a root dialog directory (including subdialogs) from disk.
567
604
  * Caller must provide the source status explicitly.
568
605
  */
569
- static deleteRootDialog(rootDialogId: DialogID, fromStatus: 'running' | 'completed' | 'archived'): Promise<boolean>;
606
+ static deleteRootDialog(rootDialogId: DialogID, fromStatus: DialogStatusKind): Promise<boolean>;
570
607
  /**
571
608
  * Save subdialog registry (TYPE B entries).
572
609
  */
@@ -575,11 +612,11 @@ export declare class DialogPersistence {
575
612
  subdialogId: DialogID;
576
613
  agentId: string;
577
614
  sessionSlug?: string;
578
- }>, status?: 'running' | 'completed' | 'archived'): Promise<void>;
615
+ }>, status?: DialogStatusKind): Promise<void>;
579
616
  /**
580
617
  * Load subdialog registry.
581
618
  */
582
- static loadSubdialogRegistry(rootDialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<Array<{
619
+ static loadSubdialogRegistry(rootDialogId: DialogID, status?: DialogStatusKind): Promise<Array<{
583
620
  key: string;
584
621
  subdialogId: DialogID;
585
622
  agentId: string;