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,33 @@
1
+ export const supportedLanguageCodes = ['en', 'zh'] as const;
2
+
3
+ export type LanguageCode = (typeof supportedLanguageCodes)[number];
4
+
5
+ export function isLanguageCode(value: string): value is LanguageCode {
6
+ return (supportedLanguageCodes as readonly string[]).includes(value);
7
+ }
8
+
9
+ export function normalizeLanguageCode(input: string): LanguageCode | null {
10
+ const raw = input.trim();
11
+ if (raw === '') return null;
12
+
13
+ const lowered = raw.replace(/_/g, '-').toLowerCase();
14
+ if (lowered === 'en' || lowered.startsWith('en-')) return 'en';
15
+ if (lowered === 'zh' || lowered.startsWith('zh-')) return 'zh';
16
+
17
+ return null;
18
+ }
19
+
20
+ export function formatLanguageName(lang: LanguageCode, inLanguage: LanguageCode): string {
21
+ switch (inLanguage) {
22
+ case 'en': {
23
+ return lang === 'en' ? 'English' : 'Simplified Chinese';
24
+ }
25
+ case 'zh': {
26
+ return lang === 'en' ? '英语' : '简体中文';
27
+ }
28
+ default: {
29
+ const exhaustiveCheck: never = inLanguage;
30
+ throw new Error(`Unsupported inLanguage: ${exhaustiveCheck}`);
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,69 @@
1
+ import type { DialogStatusKind } from './wire';
2
+
3
+ export type PrimingScriptScope = 'individual' | 'team_shared';
4
+
5
+ export type PrimingScriptSummary = {
6
+ ref: string;
7
+ scope: PrimingScriptScope;
8
+ slug: string;
9
+ title?: string;
10
+ path: string;
11
+ updatedAt: string;
12
+ ownerAgentId?: string;
13
+ };
14
+
15
+ export type PrimingScriptLoadWarning = {
16
+ path: string;
17
+ error: string;
18
+ };
19
+
20
+ export type PrimingScriptWarningSummary = {
21
+ skippedCount: number;
22
+ samples: PrimingScriptLoadWarning[];
23
+ };
24
+
25
+ export type ListPrimingScriptsResponse =
26
+ | {
27
+ success: true;
28
+ recent: PrimingScriptSummary[];
29
+ warningSummary?: PrimingScriptWarningSummary;
30
+ }
31
+ | {
32
+ success: false;
33
+ error: string;
34
+ };
35
+
36
+ export type SearchPrimingScriptsResponse =
37
+ | {
38
+ success: true;
39
+ scripts: PrimingScriptSummary[];
40
+ warningSummary?: PrimingScriptWarningSummary;
41
+ }
42
+ | {
43
+ success: false;
44
+ error: string;
45
+ };
46
+
47
+ export type SaveCurrentCoursePrimingRequest = {
48
+ dialog: {
49
+ rootId: string;
50
+ selfId: string;
51
+ status?: DialogStatusKind;
52
+ };
53
+ course: number;
54
+ slug: string;
55
+ overwrite?: boolean;
56
+ };
57
+
58
+ export type SaveCurrentCoursePrimingResponse =
59
+ | {
60
+ success: true;
61
+ script: PrimingScriptSummary;
62
+ messageCount: number;
63
+ path: string;
64
+ }
65
+ | {
66
+ success: false;
67
+ error: string;
68
+ errorCode?: 'ALREADY_EXISTS' | 'INVALID_REQUEST' | 'INTERNAL_ERROR';
69
+ };
@@ -0,0 +1,144 @@
1
+ export type ProblemSeverity = 'info' | 'warning' | 'error';
2
+
3
+ export type WorkspaceProblemLifecycle = Readonly<{
4
+ occurredAt?: string;
5
+ resolved?: boolean;
6
+ resolvedAt?: string | null;
7
+ }>;
8
+
9
+ export type WorkspaceProblem =
10
+ | {
11
+ kind: 'mcp_workspace_config_error';
12
+ source: 'mcp';
13
+ id: string;
14
+ severity: 'error';
15
+ timestamp: string;
16
+ message: string;
17
+ detail: {
18
+ filePath: string;
19
+ errorText: string;
20
+ };
21
+ }
22
+ | {
23
+ kind: 'team_workspace_config_error';
24
+ source: 'team';
25
+ id: string;
26
+ severity: 'error' | 'warning';
27
+ timestamp: string;
28
+ message: string;
29
+ detail: {
30
+ filePath: string;
31
+ errorText: string;
32
+ };
33
+ }
34
+ | {
35
+ kind: 'mcp_server_error';
36
+ source: 'mcp';
37
+ id: string;
38
+ severity: 'error';
39
+ timestamp: string;
40
+ message: string;
41
+ detail: {
42
+ serverId: string;
43
+ errorText: string;
44
+ };
45
+ }
46
+ | {
47
+ kind: 'mcp_tool_collision';
48
+ source: 'mcp';
49
+ id: string;
50
+ severity: 'warning';
51
+ timestamp: string;
52
+ message: string;
53
+ detail: {
54
+ serverId: string;
55
+ toolName: string;
56
+ domindsToolName: string;
57
+ };
58
+ }
59
+ | {
60
+ kind: 'mcp_tool_blacklisted';
61
+ source: 'mcp';
62
+ id: string;
63
+ severity: 'info' | 'warning';
64
+ timestamp: string;
65
+ message: string;
66
+ detail: {
67
+ serverId: string;
68
+ toolName: string;
69
+ pattern: string;
70
+ };
71
+ }
72
+ | {
73
+ kind: 'mcp_tool_not_whitelisted';
74
+ source: 'mcp';
75
+ id: string;
76
+ severity: 'info' | 'warning';
77
+ timestamp: string;
78
+ message: string;
79
+ detail: {
80
+ serverId: string;
81
+ toolName: string;
82
+ pattern: string;
83
+ };
84
+ }
85
+ | {
86
+ kind: 'mcp_tool_invalid_name';
87
+ source: 'mcp';
88
+ id: string;
89
+ severity: 'warning';
90
+ timestamp: string;
91
+ message: string;
92
+ detail: {
93
+ serverId: string;
94
+ toolName: string;
95
+ rule: string;
96
+ };
97
+ }
98
+ | {
99
+ kind: 'llm_provider_rejected_request';
100
+ source: 'llm';
101
+ id: string;
102
+ severity: 'error';
103
+ timestamp: string;
104
+ message: string;
105
+ detail: {
106
+ dialogId: string;
107
+ provider: string;
108
+ errorText: string;
109
+ };
110
+ }
111
+ | {
112
+ kind: 'generic_problem';
113
+ source: 'system';
114
+ id: string;
115
+ severity: ProblemSeverity;
116
+ timestamp: string;
117
+ message: string;
118
+ detail: {
119
+ text: string;
120
+ };
121
+ };
122
+
123
+ export type WorkspaceProblemRecord = WorkspaceProblem & WorkspaceProblemLifecycle;
124
+
125
+ export interface GetProblemsRequest {
126
+ type: 'get_problems';
127
+ }
128
+
129
+ export interface ClearResolvedProblemsRequest {
130
+ type: 'clear_resolved_problems';
131
+ }
132
+
133
+ export interface ClearResolvedProblemsResultMessage {
134
+ type: 'clear_resolved_problems_result';
135
+ removedCount: number;
136
+ timestamp: string;
137
+ }
138
+
139
+ export interface ProblemsSnapshotMessage {
140
+ type: 'problems_snapshot';
141
+ version: number;
142
+ problems: WorkspaceProblemRecord[];
143
+ timestamp: string;
144
+ }
@@ -0,0 +1,11 @@
1
+ import type { HumanQuestion } from './storage';
2
+
3
+ export type { HumanQuestion } from './storage';
4
+
5
+ export interface Q4HDialogContext {
6
+ readonly selfId: string;
7
+ readonly rootId: string;
8
+ readonly agentId: string;
9
+ readonly taskDocPath: string;
10
+ readonly questions: HumanQuestion[];
11
+ }
@@ -0,0 +1,140 @@
1
+ export type SetupRequirement =
2
+ | { kind: 'ok' }
3
+ | { kind: 'missing_team_yaml'; teamYamlPath: string }
4
+ | { kind: 'invalid_team_yaml'; teamYamlPath: string; errorText: string }
5
+ | {
6
+ kind: 'missing_member_defaults_fields';
7
+ teamYamlPath: string;
8
+ missing: Array<'provider' | 'model'>;
9
+ }
10
+ | { kind: 'unknown_provider'; provider: string }
11
+ | { kind: 'unknown_model'; provider: string; model: string }
12
+ | { kind: 'missing_provider_env'; provider: string; envVar: string };
13
+
14
+ export type SetupShellInfo = {
15
+ platform: 'windows' | 'macos' | 'linux' | 'other';
16
+ env: string | null;
17
+ kind: 'bash' | 'zsh' | 'other';
18
+ defaultRc: 'bashrc' | 'zshrc' | 'unknown';
19
+ };
20
+
21
+ export type SetupRcFileInfo = {
22
+ path: string;
23
+ exists: boolean;
24
+ writable: boolean;
25
+ };
26
+
27
+ export type SetupTeamYamlInfo = {
28
+ path: string;
29
+ exists: boolean;
30
+ parseError?: string;
31
+ memberDefaults?: { provider?: string; model?: string };
32
+ };
33
+
34
+ export type SetupRtwsLlmYamlInfo = {
35
+ path: string;
36
+ exists: boolean;
37
+ parseError?: string;
38
+ providerKeys?: string[];
39
+ };
40
+
41
+ export type SetupProviderModelSummary = {
42
+ key: string;
43
+ name?: string;
44
+ contextWindow?: string;
45
+ contextLength?: number;
46
+ inputLength?: number;
47
+ outputLength?: number;
48
+ verified: boolean;
49
+ };
50
+
51
+ export type SetupProminentModelParamNamespace = 'general' | 'codex' | 'openai' | 'anthropic';
52
+
53
+ export type SetupProminentEnumModelParam = {
54
+ namespace: SetupProminentModelParamNamespace;
55
+ key: string;
56
+ description: string;
57
+ values: string[];
58
+ valueLabels?: Record<string, string>;
59
+ defaultValue?: string;
60
+ };
61
+
62
+ export type SetupProviderSummary = {
63
+ providerKey: string;
64
+ name: string;
65
+ apiType: 'codex' | 'anthropic' | 'mock' | 'openai' | 'openai-compatible';
66
+ baseUrl: string;
67
+ apiKeyEnvVar: string;
68
+ techSpecUrl?: string;
69
+ apiMgmtUrl?: string;
70
+ envVar: { isSet: boolean; envLocalHas: boolean; bashrcHas: boolean; zshrcHas: boolean };
71
+ models: SetupProviderModelSummary[];
72
+ prominentModelParams?: SetupProminentEnumModelParam[];
73
+ };
74
+
75
+ export type SetupStatusResponse =
76
+ | {
77
+ success: true;
78
+ requirement: SetupRequirement;
79
+ shell: SetupShellInfo;
80
+ envLocal: SetupRcFileInfo;
81
+ rc: { bashrc: SetupRcFileInfo; zshrc: SetupRcFileInfo };
82
+ teamYaml: SetupTeamYamlInfo;
83
+ rtwsLlmYaml: SetupRtwsLlmYamlInfo;
84
+ providers: SetupProviderSummary[];
85
+ }
86
+ | {
87
+ success: false;
88
+ requirement: SetupRequirement;
89
+ shell: SetupShellInfo;
90
+ envLocal: SetupRcFileInfo;
91
+ rc: { bashrc: SetupRcFileInfo; zshrc: SetupRcFileInfo };
92
+ teamYaml: SetupTeamYamlInfo;
93
+ rtwsLlmYaml: SetupRtwsLlmYamlInfo;
94
+ providers: SetupProviderSummary[];
95
+ error: string;
96
+ };
97
+
98
+ export type SetupWriteShellEnvTarget = 'env_local' | 'bashrc' | 'zshrc';
99
+
100
+ export type SetupWriteShellEnvRequest = {
101
+ envVar: string;
102
+ value: string;
103
+ target: SetupWriteShellEnvTarget;
104
+ };
105
+
106
+ export type SetupWriteShellEnvOutcome = {
107
+ target: SetupWriteShellEnvTarget;
108
+ path: string;
109
+ result: 'created' | 'updated';
110
+ };
111
+
112
+ export type SetupWriteShellEnvResponse =
113
+ | { success: true; outcome: SetupWriteShellEnvOutcome }
114
+ | { success: false; error: string };
115
+
116
+ export type SetupFileKind = 'defaults_yaml' | 'rtws_llm_yaml';
117
+
118
+ export type SetupFileResponse =
119
+ | { success: true; kind: SetupFileKind; path: string; raw: string }
120
+ | { success: false; kind: SetupFileKind; path: string; error: string };
121
+
122
+ export type SetupWriteTeamYamlRequest = {
123
+ provider: string;
124
+ model: string;
125
+ overwrite: boolean;
126
+ modelParams?: Partial<Record<SetupProminentModelParamNamespace, Record<string, string>>>;
127
+ };
128
+
129
+ export type SetupWriteTeamYamlResponse =
130
+ | { success: true; path: string; action: 'created' | 'overwritten' }
131
+ | { success: false; path: string; error: string };
132
+
133
+ export type SetupWriteRtwsLlmYamlRequest = {
134
+ raw: string;
135
+ overwrite: boolean;
136
+ };
137
+
138
+ export type SetupWriteRtwsLlmYamlResponse =
139
+ | { success: true; path: string; action: 'created' | 'overwritten' }
140
+ | { success: false; path: string; error: string };
@@ -0,0 +1,55 @@
1
+ export type SnippetTemplateSource = 'builtin' | 'rtws';
2
+
3
+ export type SnippetTemplate = {
4
+ id: string;
5
+ name: string;
6
+ description?: string;
7
+ content: string;
8
+ source: SnippetTemplateSource;
9
+ path?: string;
10
+ };
11
+
12
+ export type SnippetTemplateGroup = {
13
+ key: string;
14
+ titleI18n: { en: string; zh: string };
15
+ templates: SnippetTemplate[];
16
+ };
17
+
18
+ export type SnippetCatalogResponse =
19
+ | { success: true; groups: SnippetTemplateGroup[] }
20
+ | { success: false; error: string };
21
+
22
+ export type SnippetTemplatesResponse =
23
+ | { success: true; templates: SnippetTemplate[] }
24
+ | { success: false; error: string };
25
+
26
+ export type SaveRtwsSnippetTemplateRequest = {
27
+ groupKey: string;
28
+ fileName?: string;
29
+ uiLanguage: 'en' | 'zh';
30
+ name: string;
31
+ description?: string;
32
+ content: string;
33
+ };
34
+
35
+ export type SaveRtwsSnippetTemplateResponse =
36
+ | { success: true; template: SnippetTemplate }
37
+ | { success: false; error: string };
38
+
39
+ export type CreateRtwsSnippetGroupRequest = {
40
+ title: string;
41
+ uiLanguage: 'en' | 'zh';
42
+ };
43
+
44
+ export type CreateRtwsSnippetGroupResponse =
45
+ | { success: true; groupKey: string }
46
+ | { success: false; error: string };
47
+
48
+ export type TeamMgmtManualRequest = {
49
+ topics?: ReadonlyArray<string>;
50
+ uiLanguage: 'en' | 'zh';
51
+ };
52
+
53
+ export type TeamMgmtManualResponse =
54
+ | { success: true; markdown: string }
55
+ | { success: false; error: string };