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,227 @@
1
+ import type { TypedDialogEvent } from './dialog';
2
+ import type { LanguageCode } from './language';
3
+ import type { ClearResolvedProblemsRequest, ClearResolvedProblemsResultMessage, GetProblemsRequest, ProblemsSnapshotMessage } from './problems';
4
+ export type { ClearResolvedProblemsRequest, ClearResolvedProblemsResultMessage, GetProblemsRequest, ProblemsSnapshotMessage, } from './problems';
5
+ export type DialogStatusKind = 'running' | 'completed' | 'archived';
6
+ export interface DialogIdent {
7
+ selfId: string;
8
+ rootId: string;
9
+ status?: DialogStatusKind;
10
+ }
11
+ export interface AssignmentFromSup {
12
+ callName: 'tellask' | 'tellaskSessionless' | 'freshBootsReasoning';
13
+ mentionList?: string[];
14
+ tellaskContent: string;
15
+ originMemberId: string;
16
+ callerDialogId: string;
17
+ callId: string;
18
+ collectiveTargets?: string[];
19
+ }
20
+ export declare function createDialogIdent(selfId: string, rootId?: string, status?: DialogStatusKind): DialogIdent;
21
+ export type WebSocketMessage = WelcomeMessage | ErrorMessage | SetUiLanguageRequest | UiLanguageSetMessage | TeamConfigUpdatedMessage | GetProblemsRequest | ClearResolvedProblemsRequest | ProblemsSnapshotMessage | ClearResolvedProblemsResultMessage | CreateDialogRequest | DisplayDialogRequest | SetDiligencePushRequest | RefillDiligencePushBudgetRequest | DiligencePushUpdatedMessage | GetQ4HStateRequest | Q4HStateResponse | DialogsMovedMessage | DialogsDeletedMessage | DialogsCreatedMessage | RunControlRefreshMessage | RunControlCountsMessage | InterruptDialogRequest | EmergencyStopRequest | ResumeDialogRequest | ResumeAllRequest | DeclareSubdialogDeadRequest | DisplayRemindersRequest | DisplayCourseRequest | DriveDialogRequest | DriveDialogByUserAnswer | DialogReadyMessage | TypedDialogEvent;
22
+ export interface WelcomeMessage {
23
+ type: 'welcome';
24
+ message: string;
25
+ serverWorkLanguage: LanguageCode;
26
+ supportedLanguageCodes: LanguageCode[];
27
+ timestamp: string;
28
+ }
29
+ export interface ErrorMessage {
30
+ type: 'error';
31
+ message: string;
32
+ }
33
+ export interface SetUiLanguageRequest {
34
+ type: 'set_ui_language';
35
+ uiLanguage: LanguageCode;
36
+ }
37
+ export interface UiLanguageSetMessage {
38
+ type: 'ui_language_set';
39
+ uiLanguage: LanguageCode;
40
+ }
41
+ export interface TeamConfigUpdatedMessage {
42
+ type: 'team_config_updated';
43
+ path: string;
44
+ exists: boolean;
45
+ timestamp: string;
46
+ trigger?: string;
47
+ }
48
+ export type CreateDialogErrorCode = 'TEAM_NOT_READY' | 'TEAM_MEMBER_INVALID' | 'TASKDOC_INVALID' | 'AUTH_REQUIRED' | 'CREATE_FAILED';
49
+ export interface DialogPrimingInput {
50
+ scriptRefs: string[];
51
+ showInUi: boolean;
52
+ }
53
+ export interface CreateDialogInput {
54
+ requestId: string;
55
+ agentId: string;
56
+ taskDocPath: string;
57
+ priming?: DialogPrimingInput;
58
+ }
59
+ export interface CreateDialogRequest extends CreateDialogInput {
60
+ type: 'create_dialog';
61
+ }
62
+ export interface CreateDialogSuccess {
63
+ kind: 'success';
64
+ requestId: string;
65
+ selfId: string;
66
+ rootId: string;
67
+ agentId: string;
68
+ taskDocPath: string;
69
+ }
70
+ export interface CreateDialogFailure {
71
+ kind: 'failure';
72
+ requestId: string;
73
+ errorCode: CreateDialogErrorCode;
74
+ error: string;
75
+ }
76
+ export type CreateDialogResult = CreateDialogSuccess | CreateDialogFailure;
77
+ export interface DisplayDialogRequest {
78
+ type: 'display_dialog';
79
+ dialog: DialogIdent;
80
+ }
81
+ export interface SetDiligencePushRequest {
82
+ type: 'set_diligence_push';
83
+ dialog: DialogIdent;
84
+ disableDiligencePush: boolean;
85
+ }
86
+ export interface RefillDiligencePushBudgetRequest {
87
+ type: 'refill_diligence_push_budget';
88
+ dialog: DialogIdent;
89
+ }
90
+ export interface DiligencePushUpdatedMessage {
91
+ type: 'diligence_push_updated';
92
+ dialog: DialogIdent;
93
+ disableDiligencePush: boolean;
94
+ timestamp: string;
95
+ }
96
+ export interface DriveDialogRequest {
97
+ type: 'drive_dlg_by_user_msg';
98
+ dialog: DialogIdent;
99
+ content: string;
100
+ msgId: string;
101
+ userLanguageCode: LanguageCode;
102
+ }
103
+ export interface DriveDialogByUserAnswer {
104
+ type: 'drive_dialog_by_user_answer';
105
+ dialog: DialogIdent;
106
+ content: string;
107
+ msgId: string;
108
+ questionId: string;
109
+ continuationType: 'answer' | 'followup' | 'retry' | 'new_message';
110
+ userLanguageCode: LanguageCode;
111
+ }
112
+ export interface InterruptDialogRequest {
113
+ type: 'interrupt_dialog';
114
+ dialog: DialogIdent;
115
+ }
116
+ export interface EmergencyStopRequest {
117
+ type: 'emergency_stop';
118
+ }
119
+ export interface ResumeDialogRequest {
120
+ type: 'resume_dialog';
121
+ dialog: DialogIdent;
122
+ }
123
+ export interface ResumeAllRequest {
124
+ type: 'resume_all';
125
+ }
126
+ export interface DeclareSubdialogDeadRequest {
127
+ type: 'declare_subdialog_dead';
128
+ dialog: DialogIdent;
129
+ note?: string;
130
+ }
131
+ export interface DisplayRemindersRequest {
132
+ type: 'display_reminders';
133
+ dialog: DialogIdent;
134
+ }
135
+ export interface DisplayCourseRequest {
136
+ type: 'display_course';
137
+ dialog: DialogIdent;
138
+ course: number;
139
+ }
140
+ export interface GetQ4HStateRequest {
141
+ type: 'get_q4h_state';
142
+ }
143
+ export interface Q4HStateResponse {
144
+ type: 'q4h_state_response';
145
+ questions: Array<{
146
+ id: string;
147
+ selfId: string;
148
+ rootId: string;
149
+ agentId: string;
150
+ taskDocPath: string;
151
+ tellaskContent: string;
152
+ askedAt: string;
153
+ callId?: string;
154
+ remainingCallIds?: string[];
155
+ callSiteRef: {
156
+ course: number;
157
+ messageIndex: number;
158
+ };
159
+ }>;
160
+ }
161
+ export type DialogsMovedScope = {
162
+ kind: 'root';
163
+ rootId: string;
164
+ } | {
165
+ kind: 'task';
166
+ taskDocPath: string;
167
+ };
168
+ export interface DialogsMovedMessage {
169
+ type: 'dialogs_moved';
170
+ scope: DialogsMovedScope;
171
+ fromStatus: DialogStatusKind;
172
+ toStatus: DialogStatusKind;
173
+ movedRootIds: string[];
174
+ timestamp: string;
175
+ }
176
+ export type DialogsDeletedScope = {
177
+ kind: 'root';
178
+ rootId: string;
179
+ } | {
180
+ kind: 'task';
181
+ taskDocPath: string;
182
+ };
183
+ export interface DialogsDeletedMessage {
184
+ type: 'dialogs_deleted';
185
+ scope: DialogsDeletedScope;
186
+ fromStatus: DialogStatusKind;
187
+ deletedRootIds: string[];
188
+ timestamp: string;
189
+ }
190
+ export type DialogsCreatedScope = {
191
+ kind: 'root';
192
+ rootId: string;
193
+ } | {
194
+ kind: 'task';
195
+ taskDocPath: string;
196
+ };
197
+ export interface DialogsCreatedMessage {
198
+ type: 'dialogs_created';
199
+ scope: DialogsCreatedScope;
200
+ status: DialogStatusKind;
201
+ createdRootIds: string[];
202
+ timestamp: string;
203
+ }
204
+ export type RunControlRefreshReason = 'resume_all' | 'emergency_stop' | 'run_state_marker_resumed' | 'run_state_marker_interrupted';
205
+ export interface RunControlRefreshMessage {
206
+ type: 'run_control_refresh';
207
+ reason: RunControlRefreshReason;
208
+ timestamp: string;
209
+ }
210
+ export interface RunControlCountsMessage {
211
+ type: 'run_control_counts_evt';
212
+ proceeding: number;
213
+ resumable: number;
214
+ timestamp: string;
215
+ }
216
+ export interface DialogReadyMessage {
217
+ type: 'dialog_ready';
218
+ dialog: DialogIdent;
219
+ agentId: string;
220
+ taskDocPath: string;
221
+ supdialogId?: string;
222
+ sessionSlug?: string;
223
+ assignmentFromSup?: AssignmentFromSup;
224
+ disableDiligencePush?: boolean;
225
+ diligencePushMax?: number;
226
+ diligencePushRemainingBudget?: number;
227
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // Wire Protocol Types for Dominds WebUI
3
+ // Network communication protocols and message definitions
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.createDialogIdent = createDialogIdent;
6
+ // Utility function to create DialogIdent from various formats
7
+ function createDialogIdent(selfId, rootId, status) {
8
+ return status
9
+ ? {
10
+ selfId,
11
+ rootId: rootId || selfId,
12
+ status,
13
+ }
14
+ : {
15
+ selfId,
16
+ rootId: rootId || selfId,
17
+ };
18
+ }
@@ -0,0 +1,112 @@
1
+ export * from './types/context-health';
2
+ export * from './types/dialog';
3
+ export * from './types/display-state';
4
+ export * from './types/i18n';
5
+ export * from './types/language';
6
+ export * from './types/priming';
7
+ export type { ProblemSeverity, WorkspaceProblem, WorkspaceProblemLifecycle, WorkspaceProblemRecord, } from './types/problems';
8
+ export * from './types/q4h';
9
+ export * from './types/setup';
10
+ export * from './types/snippets';
11
+ export * from './types/storage';
12
+ export * from './types/tools-registry';
13
+ export * from './types/wire';
14
+ import type { DialogDisplayState } from './types/display-state';
15
+ import type { AssignmentFromSup, DialogStatusKind } from './types/wire';
16
+ export interface DialogInfo {
17
+ selfId: string;
18
+ rootId: string;
19
+ agentId: string;
20
+ agentName: string;
21
+ taskDocPath: string;
22
+ status?: DialogStatusKind;
23
+ supdialogId?: string;
24
+ sessionSlug?: string;
25
+ assignmentFromSup?: AssignmentFromSup;
26
+ }
27
+ export interface ApiRootDialogResponse {
28
+ rootId: string;
29
+ selfId?: string;
30
+ agentId: string;
31
+ taskDocPath: string;
32
+ status: 'running' | 'completed' | 'archived';
33
+ currentCourse: number;
34
+ createdAt: string;
35
+ lastModified: string;
36
+ displayState?: DialogDisplayState;
37
+ supdialogId?: string;
38
+ sessionSlug?: string;
39
+ assignmentFromSup?: AssignmentFromSup;
40
+ subdialogCount?: number;
41
+ }
42
+ export interface ApiSubdialogResponse {
43
+ selfId: string;
44
+ rootId: string;
45
+ supdialogId?: string;
46
+ agentId: string;
47
+ taskDocPath: string;
48
+ status: 'running' | 'completed' | 'archived';
49
+ currentCourse: number;
50
+ createdAt: string;
51
+ lastModified: string;
52
+ displayState?: DialogDisplayState;
53
+ sessionSlug?: string;
54
+ assignmentFromSup?: AssignmentFromSup;
55
+ }
56
+ export interface ApiDialogHierarchyResponse {
57
+ success: boolean;
58
+ hierarchy: {
59
+ root: {
60
+ id: string;
61
+ agentId: string;
62
+ taskDocPath: string;
63
+ status: 'running' | 'completed' | 'archived';
64
+ currentCourse: number;
65
+ createdAt: string;
66
+ lastModified: string;
67
+ displayState?: DialogDisplayState;
68
+ };
69
+ subdialogs: ApiSubdialogResponse[];
70
+ };
71
+ }
72
+ export interface ApiDialogListResponse {
73
+ success: boolean;
74
+ dialogs: ApiRootDialogResponse[];
75
+ }
76
+ export type ApiMoveDialogsRequest = {
77
+ kind: 'root';
78
+ rootId: string;
79
+ fromStatus: DialogStatusKind;
80
+ toStatus: DialogStatusKind;
81
+ } | {
82
+ kind: 'task';
83
+ taskDocPath: string;
84
+ fromStatus: DialogStatusKind;
85
+ toStatus: DialogStatusKind;
86
+ };
87
+ export interface ApiMoveDialogsResponse {
88
+ success: boolean;
89
+ movedRootIds?: string[];
90
+ error?: string;
91
+ }
92
+ export interface ApiForkDialogRequest {
93
+ course: number;
94
+ genseq: number;
95
+ status?: DialogStatusKind;
96
+ }
97
+ export type ApiForkDialogAction = {
98
+ kind: 'draft_user_text';
99
+ userText: string;
100
+ } | {
101
+ kind: 'restore_pending';
102
+ pendingQ4H: boolean;
103
+ pendingSubdialogs: boolean;
104
+ } | {
105
+ kind: 'auto_continue';
106
+ };
107
+ export interface ApiForkDialogResponse {
108
+ success: boolean;
109
+ dialog?: DialogInfo;
110
+ action?: ApiForkDialogAction;
111
+ error?: string;
112
+ }
package/dist/types.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/context-health"), exports);
18
+ __exportStar(require("./types/dialog"), exports);
19
+ __exportStar(require("./types/display-state"), exports);
20
+ __exportStar(require("./types/i18n"), exports);
21
+ __exportStar(require("./types/language"), exports);
22
+ __exportStar(require("./types/priming"), exports);
23
+ __exportStar(require("./types/q4h"), exports);
24
+ __exportStar(require("./types/setup"), exports);
25
+ __exportStar(require("./types/snippets"), exports);
26
+ __exportStar(require("./types/storage"), exports);
27
+ __exportStar(require("./types/tools-registry"), exports);
28
+ __exportStar(require("./types/wire"), exports);
@@ -0,0 +1,2 @@
1
+ export declare function escapeHtml(text: string): string;
2
+ export declare function escapeHtmlAttr(text: string): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.escapeHtml = escapeHtml;
4
+ exports.escapeHtmlAttr = escapeHtmlAttr;
5
+ function escapeHtml(text) {
6
+ return text
7
+ .replace(/&/g, '&amp;')
8
+ .replace(/</g, '&lt;')
9
+ .replace(/>/g, '&gt;')
10
+ .replace(/"/g, '&quot;')
11
+ .replace(/'/g, '&#39;');
12
+ }
13
+ function escapeHtmlAttr(text) {
14
+ return text
15
+ .replace(/&/g, '&amp;')
16
+ .replace(/"/g, '&quot;')
17
+ .replace(/'/g, '&#39;')
18
+ .replace(/</g, '&lt;')
19
+ .replace(/>/g, '&gt;');
20
+ }
@@ -0,0 +1 @@
1
+ export declare function generateShortId(): string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateShortId = generateShortId;
4
+ function generateShortId() {
5
+ return Math.random().toString(36).substring(2, 8);
6
+ }
@@ -0,0 +1 @@
1
+ export declare function formatUnifiedTimestamp(date: Date): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatUnifiedTimestamp = formatUnifiedTimestamp;
4
+ function formatUnifiedTimestamp(date) {
5
+ const pad = (n) => (n < 10 ? `0${n}` : String(n));
6
+ const year = date.getFullYear();
7
+ const month = pad(date.getMonth() + 1);
8
+ const day = pad(date.getDate());
9
+ const hours = pad(date.getHours());
10
+ const minutes = pad(date.getMinutes());
11
+ const seconds = pad(date.getSeconds());
12
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
13
+ }
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "dominds-kernel",
3
+ "version": "1.8.5",
4
+ "description": "Dominds kernel public contracts for app handshake/runtime integration.",
5
+ "type": "commonjs",
6
+ "private": false,
7
+ "packageManager": "pnpm@10.30.3",
8
+ "main": "dist/index.js",
9
+ "types": "src/index.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./src/index.ts",
13
+ "require": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./app-json": {
17
+ "types": "./src/app-json.ts",
18
+ "require": "./dist/app-json.js",
19
+ "default": "./dist/app-json.js"
20
+ },
21
+ "./app-host-contract": {
22
+ "types": "./src/app-host-contract.ts",
23
+ "require": "./dist/app-host-contract.js",
24
+ "default": "./dist/app-host-contract.js"
25
+ },
26
+ "./evt": {
27
+ "types": "./src/evt.ts",
28
+ "require": "./dist/evt.js",
29
+ "default": "./dist/evt.js"
30
+ },
31
+ "./diligence": {
32
+ "types": "./src/diligence.ts",
33
+ "require": "./dist/diligence.js",
34
+ "default": "./dist/diligence.js"
35
+ },
36
+ "./team-mgmt-manual": {
37
+ "types": "./src/team-mgmt-manual.ts",
38
+ "require": "./dist/team-mgmt-manual.js",
39
+ "default": "./dist/team-mgmt-manual.js"
40
+ },
41
+ "./types": {
42
+ "types": "./src/types.ts",
43
+ "require": "./dist/types.js",
44
+ "default": "./dist/types.js"
45
+ },
46
+ "./types/*": {
47
+ "types": "./src/types/*.ts",
48
+ "require": "./dist/types/*.js",
49
+ "default": "./dist/types/*.js"
50
+ },
51
+ "./utils/time": {
52
+ "types": "./src/utils/time.ts",
53
+ "require": "./dist/utils/time.js",
54
+ "default": "./dist/utils/time.js"
55
+ },
56
+ "./utils/html": {
57
+ "types": "./src/utils/html.ts",
58
+ "require": "./dist/utils/html.js",
59
+ "default": "./dist/utils/html.js"
60
+ },
61
+ "./utils/id": {
62
+ "types": "./src/utils/id.ts",
63
+ "require": "./dist/utils/id.js",
64
+ "default": "./dist/utils/id.js"
65
+ }
66
+ },
67
+ "files": [
68
+ "src/**/*",
69
+ "dist/**/*",
70
+ "README.md",
71
+ "LICENSE"
72
+ ],
73
+ "scripts": {
74
+ "build": "tsc -p tsconfig.json",
75
+ "clean": "rm -rf dist",
76
+ "lint:types": "tsc -p tsconfig.json --noEmit"
77
+ },
78
+ "engines": {
79
+ "node": ">=24 <25",
80
+ "npm": ">=11.9.0",
81
+ "pnpm": ">=10.30.3"
82
+ },
83
+ "license": "LGPL-3.0-or-later"
84
+ }
@@ -0,0 +1,105 @@
1
+ import type { DomindsAppFrontendJson, DomindsAppHostReminderUpdateResult, DomindsAppHostToolHandler, DomindsAppReminderApplyRequest, DomindsAppReminderApplyResult, DomindsAppReminderState } from './app-json';
2
+ import type { LanguageCode } from './types/language';
3
+
4
+ export type ChatMessage = Readonly<Record<string, unknown>>;
5
+
6
+ export type DomindsAppRunControlContext = Readonly<{
7
+ dialog: Readonly<{
8
+ selfId: string;
9
+ rootId: string;
10
+ }>;
11
+ agentId: string;
12
+ taskDocPath: string;
13
+ genIterNo: number;
14
+ prompt?: Readonly<{
15
+ content: string;
16
+ msgId: string;
17
+ grammar: 'markdown';
18
+ userLanguageCode: LanguageCode;
19
+ origin?: 'user' | 'diligence_push' | 'runtime';
20
+ }>;
21
+ source: 'drive_dlg_by_user_msg' | 'drive_dialog_by_user_answer';
22
+ input: Readonly<Record<string, unknown>>;
23
+ q4h?: Readonly<{
24
+ questionId: string;
25
+ continuationType: 'answer' | 'followup' | 'retry' | 'new_message';
26
+ }>;
27
+ }>;
28
+
29
+ export type DomindsAppRunControlResult = Readonly<{ kind: 'continue' } | { kind: 'reject'; errorText: string }>;
30
+ export type DomindsAppRunControlHandler = (
31
+ ctx: DomindsAppRunControlContext,
32
+ ) => Promise<DomindsAppRunControlResult>;
33
+
34
+ export type DomindsAppReminderOwnerApplyContext = Readonly<{
35
+ dialogId: string;
36
+ ownedReminders: ReadonlyArray<DomindsAppReminderState>;
37
+ }>;
38
+
39
+ export type DomindsAppReminderOwnerUpdateContext = Readonly<{
40
+ dialogId: string;
41
+ reminder: DomindsAppReminderState;
42
+ }>;
43
+
44
+ export type DomindsAppReminderOwnerRenderContext = Readonly<{
45
+ dialogId: string;
46
+ reminder: DomindsAppReminderState;
47
+ reminderNo: number;
48
+ workLanguage: LanguageCode;
49
+ }>;
50
+
51
+ export type DomindsAppDynamicToolsetsContext = Readonly<{
52
+ memberId: string;
53
+ taskDocPath: string;
54
+ dialogId?: string;
55
+ rootDialogId?: string;
56
+ agentId?: string;
57
+ sessionSlug?: string;
58
+ }>;
59
+
60
+ export type DomindsAppReminderOwnerHandler = Readonly<{
61
+ apply: (
62
+ request: DomindsAppReminderApplyRequest,
63
+ ctx: DomindsAppReminderOwnerApplyContext,
64
+ ) => Promise<DomindsAppReminderApplyResult>;
65
+ updateReminder: (
66
+ ctx: DomindsAppReminderOwnerUpdateContext,
67
+ ) => Promise<DomindsAppHostReminderUpdateResult>;
68
+ renderReminder: (ctx: DomindsAppReminderOwnerRenderContext) => Promise<ChatMessage>;
69
+ }>;
70
+
71
+ export type DomindsAppDynamicToolsetsHandler = (
72
+ ctx: DomindsAppDynamicToolsetsContext,
73
+ ) => Promise<readonly string[]>;
74
+
75
+ export type DomindsAppHostStartResult = Readonly<{
76
+ port: number;
77
+ baseUrl: string;
78
+ wsUrl: string | null;
79
+ }>;
80
+
81
+ export type DomindsAppHostInstance = Readonly<{
82
+ tools: Readonly<Record<string, DomindsAppHostToolHandler>>;
83
+ runControls?: Readonly<Record<string, DomindsAppRunControlHandler>>;
84
+ reminderOwners?: Readonly<Record<string, DomindsAppReminderOwnerHandler>>;
85
+ dynamicToolsets?: DomindsAppDynamicToolsetsHandler;
86
+ start?: (
87
+ params: Readonly<{ runtimePort: number | null; frontend?: DomindsAppFrontendJson }>,
88
+ ) => Promise<DomindsAppHostStartResult>;
89
+ shutdown?: () => Promise<void>;
90
+ }>;
91
+
92
+ export type CreateDomindsAppFn = (
93
+ ctx: Readonly<{
94
+ appId: string;
95
+ rtwsRootAbs: string;
96
+ rtwsAppDirAbs: string;
97
+ packageRootAbs: string;
98
+ kernel: Readonly<{ host: string; port: number }>;
99
+ log: (
100
+ level: 'info' | 'warn' | 'error',
101
+ msg: string,
102
+ data?: Readonly<Record<string, unknown>>,
103
+ ) => void;
104
+ }>,
105
+ ) => DomindsAppHostInstance | Promise<DomindsAppHostInstance>;