dominds-kernel 1.8.5

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 (72) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +3 -0
  3. package/dist/app-host-contract.d.ts +87 -0
  4. package/dist/app-host-contract.js +2 -0
  5. package/dist/app-json.d.ts +139 -0
  6. package/dist/app-json.js +234 -0
  7. package/dist/diligence.d.ts +3 -0
  8. package/dist/diligence.js +64 -0
  9. package/dist/evt.d.ts +40 -0
  10. package/dist/evt.js +142 -0
  11. package/dist/index.d.ts +6 -0
  12. package/dist/index.js +25 -0
  13. package/dist/team-mgmt-manual.d.ts +20 -0
  14. package/dist/team-mgmt-manual.js +121 -0
  15. package/dist/types/context-health.d.ts +33 -0
  16. package/dist/types/context-health.js +2 -0
  17. package/dist/types/dialog.d.ts +398 -0
  18. package/dist/types/dialog.js +8 -0
  19. package/dist/types/display-state.d.ts +43 -0
  20. package/dist/types/display-state.js +2 -0
  21. package/dist/types/i18n.d.ts +2 -0
  22. package/dist/types/i18n.js +2 -0
  23. package/dist/types/language.d.ts +5 -0
  24. package/dist/types/language.js +35 -0
  25. package/dist/types/priming.d.ts +55 -0
  26. package/dist/types/priming.js +2 -0
  27. package/dist/types/problems.d.ts +128 -0
  28. package/dist/types/problems.js +2 -0
  29. package/dist/types/q4h.d.ts +9 -0
  30. package/dist/types/q4h.js +2 -0
  31. package/dist/types/setup.d.ts +170 -0
  32. package/dist/types/setup.js +2 -0
  33. package/dist/types/snippets.d.ts +68 -0
  34. package/dist/types/snippets.js +2 -0
  35. package/dist/types/storage.d.ts +561 -0
  36. package/dist/types/storage.js +85 -0
  37. package/dist/types/tools-registry.d.ts +19 -0
  38. package/dist/types/tools-registry.js +2 -0
  39. package/dist/types/wire.d.ts +227 -0
  40. package/dist/types/wire.js +18 -0
  41. package/dist/types.d.ts +112 -0
  42. package/dist/types.js +28 -0
  43. package/dist/utils/html.d.ts +2 -0
  44. package/dist/utils/html.js +20 -0
  45. package/dist/utils/id.d.ts +1 -0
  46. package/dist/utils/id.js +6 -0
  47. package/dist/utils/time.d.ts +1 -0
  48. package/dist/utils/time.js +13 -0
  49. package/package.json +84 -0
  50. package/src/app-host-contract.ts +105 -0
  51. package/src/app-json.ts +401 -0
  52. package/src/diligence.ts +64 -0
  53. package/src/evt.ts +156 -0
  54. package/src/index.ts +48 -0
  55. package/src/team-mgmt-manual.ts +151 -0
  56. package/src/types/context-health.ts +39 -0
  57. package/src/types/dialog.ts +487 -0
  58. package/src/types/display-state.ts +21 -0
  59. package/src/types/i18n.ts +3 -0
  60. package/src/types/language.ts +33 -0
  61. package/src/types/priming.ts +69 -0
  62. package/src/types/problems.ts +144 -0
  63. package/src/types/q4h.ts +11 -0
  64. package/src/types/setup.ts +140 -0
  65. package/src/types/snippets.ts +55 -0
  66. package/src/types/storage.ts +682 -0
  67. package/src/types/tools-registry.ts +24 -0
  68. package/src/types/wire.ts +335 -0
  69. package/src/types.ts +133 -0
  70. package/src/utils/html.ts +17 -0
  71. package/src/utils/id.ts +3 -0
  72. package/src/utils/time.ts +10 -0
@@ -0,0 +1,151 @@
1
+ export const TEAM_MGMT_MANUAL_TOPIC_KEYS = [
2
+ 'topics',
3
+ 'llm',
4
+ 'model-params',
5
+ 'builtin-defaults',
6
+ 'mcp',
7
+ 'team',
8
+ 'member-properties',
9
+ 'minds',
10
+ 'skills',
11
+ 'priming',
12
+ 'env',
13
+ 'permissions',
14
+ 'toolsets',
15
+ 'troubleshooting',
16
+ ] as const;
17
+
18
+ export type TeamMgmtManualTopicKey = (typeof TEAM_MGMT_MANUAL_TOPIC_KEYS)[number];
19
+ export type TeamMgmtManualLanguageCode = 'en' | 'zh';
20
+
21
+ export type TeamMgmtManualTopicMeta = Readonly<{
22
+ titleI18n: Readonly<{ en: string; zh: string }>;
23
+ }>;
24
+
25
+ export const TEAM_MGMT_MANUAL_TOPIC_META: Readonly<
26
+ Record<TeamMgmtManualTopicKey, TeamMgmtManualTopicMeta>
27
+ > = {
28
+ topics: { titleI18n: { zh: '索引', en: 'Index' } },
29
+ team: { titleI18n: { zh: 'Team(team.yaml)', en: 'Team (team.yaml)' } },
30
+ 'member-properties': {
31
+ titleI18n: { zh: '成员字段(members.<id>)', en: 'Member Properties (members.<id>)' },
32
+ },
33
+ permissions: { titleI18n: { zh: '权限(permissions)', en: 'Permissions' } },
34
+ toolsets: { titleI18n: { zh: '工具集(toolsets)', en: 'Toolsets' } },
35
+ llm: { titleI18n: { zh: 'LLM(llm.yaml)', en: 'LLM (llm.yaml)' } },
36
+ 'builtin-defaults': { titleI18n: { zh: '内置 Defaults(LLM)', en: 'Built-in Defaults (LLM)' } },
37
+ 'model-params': {
38
+ titleI18n: { zh: '模型参数(model_params)', en: 'Model Params (model_params)' },
39
+ },
40
+ mcp: { titleI18n: { zh: 'MCP(mcp.yaml)', en: 'MCP (mcp.yaml)' } },
41
+ minds: {
42
+ titleI18n: { zh: '角色资产(.minds/team/<id>/*)', en: 'Minds Assets (.minds/team/<id>/*)' },
43
+ },
44
+ skills: {
45
+ titleI18n: { zh: '技能(.minds/skills/*)', en: 'Skills (.minds/skills/*)' },
46
+ },
47
+ priming: {
48
+ titleI18n: {
49
+ zh: '启动脚本(.minds/priming/*)',
50
+ en: 'Startup Scripts (.minds/priming/*)',
51
+ },
52
+ },
53
+ env: { titleI18n: { zh: '环境提示(env.*.md)', en: 'Environment Intro (env.*.md)' } },
54
+ troubleshooting: { titleI18n: { zh: '排障(troubleshooting)', en: 'Troubleshooting' } },
55
+ };
56
+
57
+ const TEAM_MGMT_MANUAL_TOPIC_KEY_SET: ReadonlySet<string> = new Set(
58
+ TEAM_MGMT_MANUAL_TOPIC_KEYS as readonly string[],
59
+ );
60
+
61
+ export function isTeamMgmtManualTopicKey(value: string): value is TeamMgmtManualTopicKey {
62
+ return TEAM_MGMT_MANUAL_TOPIC_KEY_SET.has(value);
63
+ }
64
+
65
+ export function getTeamMgmtManualTopicTitle(
66
+ lang: TeamMgmtManualLanguageCode,
67
+ key: TeamMgmtManualTopicKey,
68
+ ): string {
69
+ const meta = TEAM_MGMT_MANUAL_TOPIC_META[key];
70
+ return lang === 'zh' ? meta.titleI18n.zh : meta.titleI18n.en;
71
+ }
72
+
73
+ export const TEAM_MGMT_MANUAL_UI_TOPIC_ORDER: readonly TeamMgmtManualTopicKey[] = [
74
+ 'topics',
75
+ 'team',
76
+ 'member-properties',
77
+ 'permissions',
78
+ 'toolsets',
79
+ 'llm',
80
+ 'model-params',
81
+ 'builtin-defaults',
82
+ 'mcp',
83
+ 'minds',
84
+ 'skills',
85
+ 'priming',
86
+ 'env',
87
+ 'troubleshooting',
88
+ ];
89
+
90
+ export const TEAM_MGMT_MANUAL_UI_TOOL_TOPICS_BY_KEY: Readonly<
91
+ Record<TeamMgmtManualTopicKey, readonly TeamMgmtManualTopicKey[]>
92
+ > = {
93
+ topics: ['topics'],
94
+ team: ['team'],
95
+ 'member-properties': ['team', 'member-properties'],
96
+ permissions: ['permissions'],
97
+ toolsets: ['toolsets'],
98
+ llm: ['llm'],
99
+ 'model-params': ['llm', 'model-params'],
100
+ 'builtin-defaults': ['llm', 'builtin-defaults'],
101
+ mcp: ['mcp'],
102
+ minds: ['minds'],
103
+ skills: ['skills'],
104
+ priming: ['priming'],
105
+ env: ['env'],
106
+ troubleshooting: ['troubleshooting'],
107
+ };
108
+
109
+ export type TeamMgmtManualPanelTopicKey = 'index' | 'permissions' | 'team' | 'toolsets' | 'skills';
110
+
111
+ export const TEAM_MGMT_MANUAL_PANEL_TOPIC_ORDER: readonly TeamMgmtManualPanelTopicKey[] = [
112
+ 'index',
113
+ 'permissions',
114
+ 'team',
115
+ 'toolsets',
116
+ 'skills',
117
+ ];
118
+
119
+ const EMPTY_TOOL_TOPICS: readonly TeamMgmtManualTopicKey[] = [];
120
+
121
+ export const TEAM_MGMT_MANUAL_PANEL_TOOL_TOPICS_BY_KEY: Readonly<
122
+ Record<TeamMgmtManualPanelTopicKey, readonly TeamMgmtManualTopicKey[]>
123
+ > = {
124
+ index: EMPTY_TOOL_TOPICS,
125
+ permissions: ['permissions'],
126
+ team: ['team'],
127
+ toolsets: ['toolsets'],
128
+ skills: ['skills'],
129
+ };
130
+
131
+ export function isTeamMgmtManualPanelTopicKey(value: string): value is TeamMgmtManualPanelTopicKey {
132
+ return Object.prototype.hasOwnProperty.call(TEAM_MGMT_MANUAL_PANEL_TOOL_TOPICS_BY_KEY, value);
133
+ }
134
+
135
+ export const TEAM_MGMT_MANUAL_PANEL_TOPIC_META: Readonly<
136
+ Record<TeamMgmtManualPanelTopicKey, TeamMgmtManualTopicMeta>
137
+ > = {
138
+ index: { titleI18n: { zh: '索引', en: 'Index' } },
139
+ permissions: TEAM_MGMT_MANUAL_TOPIC_META.permissions,
140
+ team: TEAM_MGMT_MANUAL_TOPIC_META.team,
141
+ toolsets: TEAM_MGMT_MANUAL_TOPIC_META.toolsets,
142
+ skills: TEAM_MGMT_MANUAL_TOPIC_META.skills,
143
+ };
144
+
145
+ export function getTeamMgmtManualPanelTopicTitle(
146
+ lang: TeamMgmtManualLanguageCode,
147
+ key: TeamMgmtManualPanelTopicKey,
148
+ ): string {
149
+ const meta = TEAM_MGMT_MANUAL_PANEL_TOPIC_META[key];
150
+ return lang === 'zh' ? meta.titleI18n.zh : meta.titleI18n.en;
151
+ }
@@ -0,0 +1,39 @@
1
+ export type LlmUsageStats =
2
+ | {
3
+ kind: 'unavailable';
4
+ }
5
+ | {
6
+ kind: 'available';
7
+ promptTokens: number;
8
+ completionTokens: number;
9
+ totalTokens?: number;
10
+ };
11
+
12
+ export type ContextHealthLevel = 'healthy' | 'caution' | 'critical';
13
+
14
+ export type ContextHealthSnapshot =
15
+ | {
16
+ kind: 'unavailable';
17
+ reason: 'usage_unavailable' | 'model_limit_unavailable';
18
+ modelContextWindowText?: string;
19
+ modelContextLimitTokens?: number;
20
+ effectiveOptimalMaxTokens?: number;
21
+ optimalMaxTokensConfigured?: number;
22
+ effectiveCriticalMaxTokens?: number;
23
+ criticalMaxTokensConfigured?: number;
24
+ }
25
+ | {
26
+ kind: 'available';
27
+ promptTokens: number;
28
+ completionTokens: number;
29
+ totalTokens?: number;
30
+ modelContextWindowText?: string;
31
+ modelContextLimitTokens: number;
32
+ effectiveOptimalMaxTokens: number;
33
+ optimalMaxTokensConfigured?: number;
34
+ effectiveCriticalMaxTokens: number;
35
+ criticalMaxTokensConfigured?: number;
36
+ hardUtil: number;
37
+ optimalUtil: number;
38
+ level: ContextHealthLevel;
39
+ };
@@ -0,0 +1,487 @@
1
+ /**
2
+ * Module: kernel/types/dialog
3
+ *
4
+ * Strongly typed discriminated unions for dialog events.
5
+ * These types are shared between backend and frontend for real-time dialog communication.
6
+ */
7
+
8
+ import type { ContextHealthSnapshot } from './context-health';
9
+ import type { DialogDisplayState, DialogInterruptionReason } from './display-state';
10
+ import type { LanguageCode } from './language';
11
+ import type {
12
+ AssignmentCourseNumber,
13
+ AssignmentGenerationSeqNumber,
14
+ CalleeCourseNumber,
15
+ CalleeGenerationSeqNumber,
16
+ CallerCourseNumber,
17
+ CallingCourseNumber,
18
+ CallingGenerationSeqNumber,
19
+ DialogCourseNumber,
20
+ FuncResultContentItem,
21
+ } from './storage';
22
+
23
+ export interface DialogDisplayStateEvent {
24
+ type: 'dlg_display_state_evt';
25
+ displayState: DialogDisplayState;
26
+ }
27
+
28
+ export interface DialogTouchedEvent {
29
+ type: 'dlg_touched_evt';
30
+ sourceType: string;
31
+ }
32
+
33
+ export interface DiligenceBudgetEvent {
34
+ type: 'diligence_budget_evt';
35
+ maxInjectCount: number;
36
+ injectedCount: number;
37
+ remainingCount: number;
38
+ disableDiligencePush: boolean;
39
+ }
40
+
41
+ export interface DialogDisplayStateMarkerEvent {
42
+ type: 'dlg_display_state_marker_evt';
43
+ kind: 'interrupted' | 'resumed';
44
+ reason?: DialogInterruptionReason;
45
+ }
46
+
47
+ export interface SubdialogEvent extends DialogEventBase {
48
+ type: 'subdialog_created_evt';
49
+ course: number;
50
+ parentDialog: {
51
+ selfId: string;
52
+ rootId: string;
53
+ };
54
+ subDialog: {
55
+ selfId: string;
56
+ rootId: string;
57
+ };
58
+ targetAgentId: string;
59
+ callName: 'tellask' | 'tellaskSessionless' | 'freshBootsReasoning';
60
+ mentionList?: string[];
61
+ tellaskContent: string;
62
+ subDialogNode: {
63
+ selfId: string;
64
+ rootId: string;
65
+ supdialogId: string;
66
+ agentId: string;
67
+ taskDocPath: string;
68
+ status: 'running' | 'completed' | 'archived';
69
+ currentCourse: number;
70
+ createdAt: string;
71
+ lastModified: string;
72
+ displayState?: DialogDisplayState;
73
+ sessionSlug?: string;
74
+ assignmentFromSup?: {
75
+ callName: 'tellask' | 'tellaskSessionless' | 'freshBootsReasoning';
76
+ mentionList?: string[];
77
+ tellaskContent: string;
78
+ originMemberId: string;
79
+ callerDialogId: string;
80
+ callId: string;
81
+ };
82
+ };
83
+ genseq?: number;
84
+ }
85
+
86
+ export interface StreamErrorEvent {
87
+ type: 'stream_error_evt';
88
+ course: number;
89
+ error: string;
90
+ genseq?: number;
91
+ }
92
+
93
+ export type LlmRetryEvent = LlmGenDlgEvent & {
94
+ type: 'llm_retry_evt';
95
+ phase: 'waiting' | 'running' | 'exhausted';
96
+ provider: string;
97
+ attempt: number;
98
+ totalAttempts: number;
99
+ maxRetries: number;
100
+ retriesRemaining: number;
101
+ backoffMs?: number;
102
+ failureKind: 'retriable' | 'rejected' | 'fatal';
103
+ status?: number;
104
+ code?: string;
105
+ error: string;
106
+ suggestion?: string;
107
+ };
108
+
109
+ export type GeneratingStartEvent = LlmGenDlgEvent & {
110
+ type: 'generating_start_evt';
111
+ msgId?: string;
112
+ };
113
+
114
+ export type GeneratingFinishEvent = LlmGenDlgEvent & {
115
+ type: 'generating_finish_evt';
116
+ llmGenModel?: string;
117
+ };
118
+
119
+ export type ContextHealthEvent = LlmGenDlgEvent & {
120
+ type: 'context_health_evt';
121
+ contextHealth: ContextHealthSnapshot;
122
+ };
123
+
124
+ export type ThinkingStartEvent = LlmGenDlgEvent & {
125
+ type: 'thinking_start_evt';
126
+ };
127
+
128
+ export type ThinkingChunkEvent = LlmGenDlgEvent & {
129
+ type: 'thinking_chunk_evt';
130
+ chunk: string;
131
+ };
132
+
133
+ export type ThinkingFinishEvent = LlmGenDlgEvent & {
134
+ type: 'thinking_finish_evt';
135
+ };
136
+
137
+ export type SayingStartEvent = LlmGenDlgEvent & {
138
+ type: 'saying_start_evt';
139
+ };
140
+
141
+ export type SayingFinishEvent = LlmGenDlgEvent & {
142
+ type: 'saying_finish_evt';
143
+ };
144
+
145
+ export type MarkdownStartEvent = LlmGenDlgEvent & {
146
+ type: 'markdown_start_evt';
147
+ };
148
+
149
+ export type MarkdownChunkEvent = LlmGenDlgEvent & {
150
+ type: 'markdown_chunk_evt';
151
+ chunk: string;
152
+ };
153
+
154
+ export type MarkdownFinishEvent = LlmGenDlgEvent & {
155
+ type: 'markdown_finish_evt';
156
+ };
157
+
158
+ export type FuncCallStartEvent = LlmGenDlgEvent & {
159
+ type: 'func_call_requested_evt';
160
+ funcName: string;
161
+ funcId: string;
162
+ arguments: string;
163
+ course: number;
164
+ genseq: number;
165
+ };
166
+
167
+ export interface FunctionResultEvent {
168
+ type: 'func_result_evt';
169
+ id: string;
170
+ name: string;
171
+ content: string;
172
+ contentItems?: FuncResultContentItem[];
173
+ course: number;
174
+ genseq?: number;
175
+ }
176
+
177
+ export type WebSearchCallAction =
178
+ | { type: 'search'; query?: string }
179
+ | { type: 'open_page'; url?: string }
180
+ | { type: 'find_in_page'; url?: string; pattern?: string };
181
+
182
+ export type WebSearchCallEvent = LlmGenDlgEvent & {
183
+ type: 'web_search_call_evt';
184
+ phase: 'added' | 'done';
185
+ itemId: string;
186
+ status?: string;
187
+ action?: WebSearchCallAction;
188
+ };
189
+
190
+ export type GenerationDiscardEvent = LlmGenDlgEvent & {
191
+ type: 'genseq_discard_evt';
192
+ reason: 'retry';
193
+ };
194
+
195
+ export type TellaskCallStartEvent =
196
+ | (LlmGenDlgEvent & {
197
+ type: 'tellask_call_start_evt';
198
+ callName: 'tellask';
199
+ callId: string;
200
+ mentionList: string[];
201
+ sessionSlug: string;
202
+ tellaskContent: string;
203
+ })
204
+ | (LlmGenDlgEvent & {
205
+ type: 'tellask_call_start_evt';
206
+ callName: 'tellaskSessionless';
207
+ callId: string;
208
+ mentionList: string[];
209
+ tellaskContent: string;
210
+ })
211
+ | (LlmGenDlgEvent & {
212
+ type: 'tellask_call_start_evt';
213
+ callName: 'tellaskBack' | 'askHuman' | 'freshBootsReasoning';
214
+ callId: string;
215
+ tellaskContent: string;
216
+ });
217
+
218
+ export type TellaskCallResultEvent =
219
+ | {
220
+ type: 'tellask_call_result_evt';
221
+ course: number;
222
+ calling_genseq?: CallingGenerationSeqNumber;
223
+ responderId: string;
224
+ callName: 'tellask' | 'tellaskSessionless';
225
+ mentionList: string[];
226
+ tellaskContent: string;
227
+ status: 'completed' | 'failed';
228
+ result: string;
229
+ callId: string;
230
+ }
231
+ | {
232
+ type: 'tellask_call_result_evt';
233
+ course: number;
234
+ calling_genseq?: CallingGenerationSeqNumber;
235
+ responderId: string;
236
+ callName: 'tellaskBack' | 'askHuman' | 'freshBootsReasoning';
237
+ tellaskContent: string;
238
+ status: 'completed' | 'failed';
239
+ result: string;
240
+ callId: string;
241
+ };
242
+
243
+ export interface TellaskCallCarryoverEvent {
244
+ type: 'tellask_call_carryover_evt';
245
+ course: number;
246
+ responderId: string;
247
+ status: 'completed' | 'failed';
248
+ callId: string;
249
+ carryoverCourse: DialogCourseNumber;
250
+ }
251
+
252
+ export interface TellaskCallAnchorEvent {
253
+ type: 'tellask_call_anchor_evt';
254
+ course: number;
255
+ genseq: number;
256
+ anchorRole: 'assignment' | 'response';
257
+ callId: string;
258
+ assignmentCourse?: AssignmentCourseNumber;
259
+ assignmentGenseq?: AssignmentGenerationSeqNumber;
260
+ callerDialogId?: string;
261
+ callerCourse?: CallerCourseNumber;
262
+ }
263
+
264
+ export interface ReminderContent {
265
+ content: string;
266
+ meta?: Record<string, unknown>;
267
+ reminder_no?: number;
268
+ echoback?: boolean;
269
+ }
270
+
271
+ export interface FullRemindersEvent {
272
+ type: 'full_reminders_update';
273
+ reminders: ReminderContent[];
274
+ }
275
+
276
+ export type TellaskResponseEvent =
277
+ | {
278
+ type: 'tellask_response_evt';
279
+ course: number;
280
+ calling_genseq?: CallingGenerationSeqNumber;
281
+ responderId: string;
282
+ calleeDialogId?: string;
283
+ calleeCourse?: CalleeCourseNumber;
284
+ calleeGenseq?: CalleeGenerationSeqNumber;
285
+ callName: 'tellask';
286
+ sessionSlug: string;
287
+ mentionList: string[];
288
+ tellaskContent: string;
289
+ status: 'completed' | 'failed';
290
+ response: string;
291
+ agentId: string;
292
+ callId: string;
293
+ originMemberId: string;
294
+ }
295
+ | {
296
+ type: 'tellask_response_evt';
297
+ course: number;
298
+ calling_genseq?: CallingGenerationSeqNumber;
299
+ responderId: string;
300
+ calleeDialogId?: string;
301
+ calleeCourse?: CalleeCourseNumber;
302
+ calleeGenseq?: CalleeGenerationSeqNumber;
303
+ callName: 'tellaskSessionless';
304
+ mentionList: string[];
305
+ tellaskContent: string;
306
+ status: 'completed' | 'failed';
307
+ response: string;
308
+ agentId: string;
309
+ callId: string;
310
+ originMemberId: string;
311
+ }
312
+ | {
313
+ type: 'tellask_response_evt';
314
+ course: number;
315
+ calling_genseq?: CallingGenerationSeqNumber;
316
+ responderId: string;
317
+ calleeDialogId?: string;
318
+ calleeCourse?: CalleeCourseNumber;
319
+ calleeGenseq?: CalleeGenerationSeqNumber;
320
+ callName: 'tellaskBack' | 'freshBootsReasoning';
321
+ tellaskContent: string;
322
+ status: 'completed' | 'failed';
323
+ response: string;
324
+ agentId: string;
325
+ callId: string;
326
+ originMemberId: string;
327
+ };
328
+
329
+ export type TellaskCarryoverResultEvent =
330
+ | {
331
+ type: 'tellask_carryover_result_evt';
332
+ course: number;
333
+ originCourse: CallingCourseNumber;
334
+ responderId: string;
335
+ callName: 'tellask';
336
+ sessionSlug: string;
337
+ mentionList: string[];
338
+ tellaskContent: string;
339
+ status: 'completed' | 'failed';
340
+ response: string;
341
+ content: string;
342
+ agentId: string;
343
+ callId: string;
344
+ originMemberId: string;
345
+ calleeDialogId?: string;
346
+ calleeCourse?: CalleeCourseNumber;
347
+ calleeGenseq?: CalleeGenerationSeqNumber;
348
+ }
349
+ | {
350
+ type: 'tellask_carryover_result_evt';
351
+ course: number;
352
+ originCourse: CallingCourseNumber;
353
+ responderId: string;
354
+ callName: 'tellaskSessionless';
355
+ mentionList: string[];
356
+ tellaskContent: string;
357
+ status: 'completed' | 'failed';
358
+ response: string;
359
+ content: string;
360
+ agentId: string;
361
+ callId: string;
362
+ originMemberId: string;
363
+ calleeDialogId?: string;
364
+ calleeCourse?: CalleeCourseNumber;
365
+ calleeGenseq?: CalleeGenerationSeqNumber;
366
+ }
367
+ | {
368
+ type: 'tellask_carryover_result_evt';
369
+ course: number;
370
+ originCourse: CallingCourseNumber;
371
+ responderId: string;
372
+ callName: 'freshBootsReasoning';
373
+ tellaskContent: string;
374
+ status: 'completed' | 'failed';
375
+ response: string;
376
+ content: string;
377
+ agentId: string;
378
+ callId: string;
379
+ originMemberId: string;
380
+ calleeDialogId?: string;
381
+ calleeCourse?: CalleeCourseNumber;
382
+ calleeGenseq?: CalleeGenerationSeqNumber;
383
+ };
384
+
385
+ export interface EndOfUserSayingEvent {
386
+ type: 'end_of_user_saying_evt';
387
+ course: number;
388
+ genseq: number;
389
+ msgId: string;
390
+ content: string;
391
+ grammar: 'markdown';
392
+ origin: 'user' | 'diligence_push' | 'runtime';
393
+ userLanguageCode?: LanguageCode;
394
+ q4hAnswerCallIds?: string[];
395
+ }
396
+
397
+ export interface QueueUserMsgEvent {
398
+ type: 'queue_user_msg_evt';
399
+ course: number;
400
+ msgId: string;
401
+ content: string;
402
+ grammar: 'markdown';
403
+ origin?: 'user' | 'diligence_push' | 'runtime';
404
+ userLanguageCode?: LanguageCode;
405
+ }
406
+
407
+ export interface CourseEvent {
408
+ type: 'course_update';
409
+ course: number;
410
+ totalCourses: number;
411
+ }
412
+
413
+ export interface NewQ4HAskedEvent {
414
+ type: 'new_q4h_asked';
415
+ question: {
416
+ id: string;
417
+ selfId: string;
418
+ tellaskContent: string;
419
+ askedAt: string;
420
+ callId?: string;
421
+ remainingCallIds?: string[];
422
+ callSiteRef: {
423
+ course: number;
424
+ messageIndex: number;
425
+ };
426
+ rootId: string;
427
+ agentId: string;
428
+ taskDocPath: string;
429
+ };
430
+ }
431
+
432
+ export interface Q4HAnsweredEvent {
433
+ type: 'q4h_answered';
434
+ questionId: string;
435
+ selfId: string;
436
+ }
437
+
438
+ export interface DialogEventBase {
439
+ dialog: {
440
+ selfId: string;
441
+ rootId: string;
442
+ };
443
+ timestamp: string;
444
+ }
445
+
446
+ export interface LlmGenDlgEvent {
447
+ course: number;
448
+ genseq: number;
449
+ }
450
+
451
+ export type TypedDialogEvent = DialogEvent & DialogEventBase;
452
+
453
+ export type DialogEvent =
454
+ | DialogTouchedEvent
455
+ | GeneratingStartEvent
456
+ | GeneratingFinishEvent
457
+ | ContextHealthEvent
458
+ | DialogDisplayStateEvent
459
+ | DialogDisplayStateMarkerEvent
460
+ | DiligenceBudgetEvent
461
+ | ThinkingStartEvent
462
+ | ThinkingChunkEvent
463
+ | ThinkingFinishEvent
464
+ | SayingStartEvent
465
+ | SayingFinishEvent
466
+ | MarkdownStartEvent
467
+ | MarkdownChunkEvent
468
+ | MarkdownFinishEvent
469
+ | FuncCallStartEvent
470
+ | FunctionResultEvent
471
+ | WebSearchCallEvent
472
+ | GenerationDiscardEvent
473
+ | TellaskCallStartEvent
474
+ | TellaskCallResultEvent
475
+ | TellaskCallCarryoverEvent
476
+ | TellaskCallAnchorEvent
477
+ | TellaskResponseEvent
478
+ | TellaskCarryoverResultEvent
479
+ | SubdialogEvent
480
+ | QueueUserMsgEvent
481
+ | EndOfUserSayingEvent
482
+ | FullRemindersEvent
483
+ | CourseEvent
484
+ | NewQ4HAskedEvent
485
+ | Q4HAnsweredEvent
486
+ | StreamErrorEvent
487
+ | LlmRetryEvent;
@@ -0,0 +1,21 @@
1
+ export type DialogInterruptionReason =
2
+ | { kind: 'user_stop' }
3
+ | { kind: 'emergency_stop' }
4
+ | { kind: 'server_restart' }
5
+ | { kind: 'system_stop'; detail: string };
6
+
7
+ export type DialogBlockedReason =
8
+ | { kind: 'needs_human_input' }
9
+ | { kind: 'waiting_for_subdialogs' }
10
+ | { kind: 'needs_human_input_and_subdialogs' };
11
+
12
+ export type DialogDeadReason = { kind: 'declared_by_user' } | { kind: 'system'; detail: string };
13
+
14
+ export type DialogDisplayState =
15
+ | { kind: 'idle_waiting_user' }
16
+ | { kind: 'proceeding' }
17
+ | { kind: 'proceeding_stop_requested'; reason: 'user_stop' | 'emergency_stop' }
18
+ | { kind: 'interrupted'; reason: DialogInterruptionReason }
19
+ | { kind: 'blocked'; reason: DialogBlockedReason }
20
+ | { kind: 'dead'; reason: DialogDeadReason }
21
+ | { kind: 'terminal'; status: 'completed' | 'archived' };
@@ -0,0 +1,3 @@
1
+ import type { LanguageCode } from './language';
2
+
3
+ export type I18nText = Record<LanguageCode, string>;