dominds 1.23.4 → 1.23.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.
- package/dist/dialog.d.ts +20 -0
- package/dist/dialog.js +60 -0
- package/dist/llm/kernel-driver/flow.js +37 -7
- package/dist/persistence.d.ts +1 -0
- package/dist/persistence.js +12 -0
- package/dist/runtime/driver-messages.js +12 -8
- package/package.json +3 -3
package/dist/dialog.d.ts
CHANGED
|
@@ -354,6 +354,25 @@ export declare abstract class Dialog {
|
|
|
354
354
|
skipTaskdoc?: boolean;
|
|
355
355
|
sideDialogReplyTarget: DialogSideDialogReplyTarget;
|
|
356
356
|
}): DialogQueuedPromptState;
|
|
357
|
+
private persistPendingRuntimePrompt;
|
|
358
|
+
private runtimePromptCommon;
|
|
359
|
+
queueRuntimeReplyPrompt(options: {
|
|
360
|
+
prompt: string;
|
|
361
|
+
msgId: string;
|
|
362
|
+
grammar: 'markdown';
|
|
363
|
+
userLanguageCode?: LanguageCode;
|
|
364
|
+
tellaskReplyDirective: TellaskReplyDirective;
|
|
365
|
+
skipTaskdoc?: boolean;
|
|
366
|
+
}): Promise<DialogQueuedPromptState>;
|
|
367
|
+
queueRuntimeSideDialogPrompt(options: {
|
|
368
|
+
prompt: string;
|
|
369
|
+
msgId: string;
|
|
370
|
+
grammar: 'markdown';
|
|
371
|
+
userLanguageCode?: LanguageCode;
|
|
372
|
+
tellaskReplyDirective: TellaskReplyDirective;
|
|
373
|
+
skipTaskdoc?: boolean;
|
|
374
|
+
sideDialogReplyTarget: DialogSideDialogReplyTarget;
|
|
375
|
+
}): Promise<DialogQueuedPromptState>;
|
|
357
376
|
hasUpNext(): boolean;
|
|
358
377
|
peekUpNext(): DialogQueuedPromptState | undefined;
|
|
359
378
|
takeUpNext(): DialogQueuedPromptState | undefined;
|
|
@@ -678,6 +697,7 @@ export declare abstract class DialogStore {
|
|
|
678
697
|
* Start a new course in storage
|
|
679
698
|
*/
|
|
680
699
|
startNewCourse(_dialog: Dialog, _newCoursePrompt: DialogRuntimePrompt): Promise<void>;
|
|
700
|
+
persistPendingRuntimePrompt(_dialog: Dialog, _prompt: DialogRuntimePrompt): Promise<void>;
|
|
681
701
|
/**
|
|
682
702
|
* Handle stream error
|
|
683
703
|
*/
|
package/dist/dialog.js
CHANGED
|
@@ -1018,6 +1018,65 @@ class Dialog {
|
|
|
1018
1018
|
this._updatedAt = (0, time_1.formatUnifiedTimestamp)(new Date());
|
|
1019
1019
|
return merged;
|
|
1020
1020
|
}
|
|
1021
|
+
async persistPendingRuntimePrompt(prompt) {
|
|
1022
|
+
await this.dlgStore.persistPendingRuntimePrompt(this, prompt);
|
|
1023
|
+
}
|
|
1024
|
+
runtimePromptCommon(options) {
|
|
1025
|
+
const trimmed = options.prompt.trim();
|
|
1026
|
+
if (!trimmed) {
|
|
1027
|
+
throw new Error('Prompt is required to queue runtime prompt');
|
|
1028
|
+
}
|
|
1029
|
+
return {
|
|
1030
|
+
prompt: trimmed,
|
|
1031
|
+
msgId: options.msgId,
|
|
1032
|
+
grammar: options.grammar,
|
|
1033
|
+
userLanguageCode: options.userLanguageCode ?? this._lastUserLanguageCode,
|
|
1034
|
+
origin: 'runtime',
|
|
1035
|
+
runControl: undefined,
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
async queueRuntimeReplyPrompt(options) {
|
|
1039
|
+
const common = this.runtimePromptCommon(options);
|
|
1040
|
+
const created = {
|
|
1041
|
+
...common,
|
|
1042
|
+
kind: 'new_course_runtime_reply',
|
|
1043
|
+
tellaskReplyDirective: options.tellaskReplyDirective,
|
|
1044
|
+
skipTaskdoc: options.skipTaskdoc,
|
|
1045
|
+
};
|
|
1046
|
+
this.enqueueQueuedPromptState(created);
|
|
1047
|
+
await this.persistPendingRuntimePrompt({
|
|
1048
|
+
content: created.prompt,
|
|
1049
|
+
msgId: created.msgId,
|
|
1050
|
+
grammar: created.grammar ?? 'markdown',
|
|
1051
|
+
userLanguageCode: created.userLanguageCode,
|
|
1052
|
+
origin: 'runtime',
|
|
1053
|
+
tellaskReplyDirective: created.tellaskReplyDirective,
|
|
1054
|
+
skipTaskdoc: created.skipTaskdoc,
|
|
1055
|
+
});
|
|
1056
|
+
return created;
|
|
1057
|
+
}
|
|
1058
|
+
async queueRuntimeSideDialogPrompt(options) {
|
|
1059
|
+
const common = this.runtimePromptCommon(options);
|
|
1060
|
+
const created = {
|
|
1061
|
+
...common,
|
|
1062
|
+
kind: 'new_course_runtime_sideDialog',
|
|
1063
|
+
tellaskReplyDirective: options.tellaskReplyDirective,
|
|
1064
|
+
skipTaskdoc: options.skipTaskdoc,
|
|
1065
|
+
sideDialogReplyTarget: options.sideDialogReplyTarget,
|
|
1066
|
+
};
|
|
1067
|
+
this.enqueueQueuedPromptState(created);
|
|
1068
|
+
await this.persistPendingRuntimePrompt({
|
|
1069
|
+
content: created.prompt,
|
|
1070
|
+
msgId: created.msgId,
|
|
1071
|
+
grammar: created.grammar ?? 'markdown',
|
|
1072
|
+
userLanguageCode: created.userLanguageCode,
|
|
1073
|
+
origin: 'runtime',
|
|
1074
|
+
tellaskReplyDirective: created.tellaskReplyDirective,
|
|
1075
|
+
skipTaskdoc: created.skipTaskdoc,
|
|
1076
|
+
sideDialogReplyTarget: created.sideDialogReplyTarget,
|
|
1077
|
+
});
|
|
1078
|
+
return created;
|
|
1079
|
+
}
|
|
1021
1080
|
hasUpNext() {
|
|
1022
1081
|
return this._upNextQueue.length > 0;
|
|
1023
1082
|
}
|
|
@@ -1905,6 +1964,7 @@ class DialogStore {
|
|
|
1905
1964
|
* Start a new course in storage
|
|
1906
1965
|
*/
|
|
1907
1966
|
async startNewCourse(_dialog, _newCoursePrompt) { }
|
|
1967
|
+
async persistPendingRuntimePrompt(_dialog, _prompt) { }
|
|
1908
1968
|
/**
|
|
1909
1969
|
* Handle stream error
|
|
1910
1970
|
*/
|
|
@@ -23,6 +23,28 @@ const idle_reminder_wake_1 = require("./idle-reminder-wake");
|
|
|
23
23
|
const reply_guidance_1 = require("./reply-guidance");
|
|
24
24
|
const sideDialog_1 = require("./sideDialog");
|
|
25
25
|
const tellask_special_1 = require("./tellask-special");
|
|
26
|
+
async function queueReplyReminderFollowUp(args) {
|
|
27
|
+
if (args.followUp.kind === 'runtime_sideDialog_reply_reminder') {
|
|
28
|
+
await args.dialog.queueRuntimeSideDialogPrompt({
|
|
29
|
+
prompt: args.followUp.prompt,
|
|
30
|
+
msgId: args.followUp.msgId,
|
|
31
|
+
grammar: args.followUp.grammar ?? 'markdown',
|
|
32
|
+
userLanguageCode: args.followUp.userLanguageCode,
|
|
33
|
+
tellaskReplyDirective: args.followUp.tellaskReplyDirective,
|
|
34
|
+
skipTaskdoc: args.followUp.skipTaskdoc,
|
|
35
|
+
sideDialogReplyTarget: args.followUp.sideDialogReplyTarget,
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
await args.dialog.queueRuntimeReplyPrompt({
|
|
40
|
+
prompt: args.followUp.prompt,
|
|
41
|
+
msgId: args.followUp.msgId,
|
|
42
|
+
grammar: args.followUp.grammar ?? 'markdown',
|
|
43
|
+
userLanguageCode: args.followUp.userLanguageCode,
|
|
44
|
+
tellaskReplyDirective: args.followUp.tellaskReplyDirective,
|
|
45
|
+
skipTaskdoc: args.followUp.skipTaskdoc,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
26
48
|
function isReplyToolReminderPrompt(prompt) {
|
|
27
49
|
return typeof prompt?.content === 'string' && (0, reply_prompt_copy_1.isReplyToolReminderPromptContent)(prompt.content);
|
|
28
50
|
}
|
|
@@ -1084,6 +1106,18 @@ async function executeDriveRound(args) {
|
|
|
1084
1106
|
}
|
|
1085
1107
|
}
|
|
1086
1108
|
if (followUp) {
|
|
1109
|
+
if (followUp.kind === 'runtime_reply_reminder' ||
|
|
1110
|
+
followUp.kind === 'runtime_sideDialog_reply_reminder') {
|
|
1111
|
+
await queueReplyReminderFollowUp({ dialog, followUp });
|
|
1112
|
+
args.scheduleDrive(dialog, {
|
|
1113
|
+
waitInQue: true,
|
|
1114
|
+
driveOptions: {
|
|
1115
|
+
source: 'kernel_driver_follow_up',
|
|
1116
|
+
reason: 'follow_up_prompt',
|
|
1117
|
+
},
|
|
1118
|
+
});
|
|
1119
|
+
return driveResult;
|
|
1120
|
+
}
|
|
1087
1121
|
args.scheduleDrive(dialog, {
|
|
1088
1122
|
waitInQue: true,
|
|
1089
1123
|
driveOptions: {
|
|
@@ -1116,9 +1150,7 @@ async function executeDriveRound(args) {
|
|
|
1116
1150
|
case 'registered_assignment_update':
|
|
1117
1151
|
case 'new_course_runtime_guide':
|
|
1118
1152
|
case 'new_course_runtime_reply':
|
|
1119
|
-
case 'new_course_runtime_sideDialog':
|
|
1120
|
-
case 'runtime_reply_reminder':
|
|
1121
|
-
case 'runtime_sideDialog_reply_reminder': {
|
|
1153
|
+
case 'new_course_runtime_sideDialog': {
|
|
1122
1154
|
const runtimeCommon = {
|
|
1123
1155
|
...common,
|
|
1124
1156
|
origin: 'runtime',
|
|
@@ -1127,8 +1159,7 @@ async function executeDriveRound(args) {
|
|
|
1127
1159
|
: { skipTaskdoc: followUp.skipTaskdoc }),
|
|
1128
1160
|
};
|
|
1129
1161
|
if (followUp.kind === 'registered_assignment_update' ||
|
|
1130
|
-
followUp.kind === 'new_course_runtime_sideDialog'
|
|
1131
|
-
followUp.kind === 'runtime_sideDialog_reply_reminder') {
|
|
1162
|
+
followUp.kind === 'new_course_runtime_sideDialog') {
|
|
1132
1163
|
const prompt = {
|
|
1133
1164
|
...runtimeCommon,
|
|
1134
1165
|
tellaskReplyDirective: followUp.tellaskReplyDirective,
|
|
@@ -1136,8 +1167,7 @@ async function executeDriveRound(args) {
|
|
|
1136
1167
|
};
|
|
1137
1168
|
return prompt;
|
|
1138
1169
|
}
|
|
1139
|
-
if (followUp.kind === 'new_course_runtime_reply'
|
|
1140
|
-
followUp.kind === 'runtime_reply_reminder') {
|
|
1170
|
+
if (followUp.kind === 'new_course_runtime_reply') {
|
|
1141
1171
|
const prompt = {
|
|
1142
1172
|
...runtimeCommon,
|
|
1143
1173
|
tellaskReplyDirective: followUp.tellaskReplyDirective,
|
package/dist/persistence.d.ts
CHANGED
|
@@ -131,6 +131,7 @@ export declare class DiskFileDialogStore extends DialogStore {
|
|
|
131
131
|
* Start new course (append-only JSONL + exceptional reminder persistence)
|
|
132
132
|
*/
|
|
133
133
|
startNewCourse(dialog: Dialog, newCoursePrompt: DialogRuntimePrompt): Promise<void>;
|
|
134
|
+
persistPendingRuntimePrompt(dialog: Dialog, prompt: DialogRuntimePrompt): Promise<void>;
|
|
134
135
|
/**
|
|
135
136
|
* Persist reminder state (exceptional overwrite pattern)
|
|
136
137
|
* Note: Event emission is handled by processReminderUpdates() in Dialog
|
package/dist/persistence.js
CHANGED
|
@@ -2639,6 +2639,18 @@ class DiskFileDialogStore extends dialog_1.DialogStore {
|
|
|
2639
2639
|
};
|
|
2640
2640
|
(0, evt_registry_1.postDialogEvent)(dialog, courseUpdateEvt);
|
|
2641
2641
|
}
|
|
2642
|
+
async persistPendingRuntimePrompt(dialog, prompt) {
|
|
2643
|
+
if (prompt.origin !== 'runtime') {
|
|
2644
|
+
throw new Error(`persistPendingRuntimePrompt invariant violation: pending prompt must have runtime origin for dialog=${dialog.id.valueOf()}`);
|
|
2645
|
+
}
|
|
2646
|
+
await DialogPersistence.mutateDialogLatest(dialog.id, () => ({
|
|
2647
|
+
kind: 'patch',
|
|
2648
|
+
patch: {
|
|
2649
|
+
needsDrive: true,
|
|
2650
|
+
pendingCourseStartPrompt: prompt,
|
|
2651
|
+
},
|
|
2652
|
+
}), dialog.status);
|
|
2653
|
+
}
|
|
2642
2654
|
/**
|
|
2643
2655
|
* Persist reminder state (exceptional overwrite pattern)
|
|
2644
2656
|
* Note: Event emission is handled by processReminderUpdates() in Dialog
|
|
@@ -217,14 +217,14 @@ function formatReminderContextGuide(language) {
|
|
|
217
217
|
if (language === 'zh') {
|
|
218
218
|
return [
|
|
219
219
|
`${formatSystemNoticePrefix(language)} 提醒项上下文块开始`,
|
|
220
|
-
'以下是当前可见提醒项的运行时上下文投影。由于当前 LLM Provider 通常不支持 role=environment,Dominds 默认把系统运行时提醒包装投影为 role=user;个别提醒项可由其 owner 按自身契约选择 role。无论最终 role
|
|
220
|
+
'以下是当前可见提醒项的运行时上下文投影。由于当前 LLM Provider 通常不支持 role=environment,Dominds 默认把系统运行时提醒包装投影为 role=user;个别提醒项可由其 owner 按自身契约选择 role。无论最终 role 如何,它们都不是用户的新诉求/指令,也不是聊天正文。',
|
|
221
221
|
'在 WebUI 中,用户通过独立的 Reminder 小组件/面板项看到这些提醒,并能把它们和聊天正文区分开。',
|
|
222
222
|
'请把提醒项作为工作集/状态参考;只有实际改变你的判断、计划或风险的信息,才需要提炼进后续有实质内容的对外回复。不要为了提醒项单独回复“收到/已了解/静默吸收”。',
|
|
223
223
|
].join('\n');
|
|
224
224
|
}
|
|
225
225
|
return [
|
|
226
226
|
`${formatSystemNoticePrefix(language)} Reminder context block begins`,
|
|
227
|
-
'The following visible reminders are runtime-added context projections. Because current LLM providers usually do not support role=environment, Dominds projects default system-runtime reminder wrappers as role=user; individual reminder owners may choose the role required by their own contract. Regardless of their final role, these reminders are not new user instructions
|
|
227
|
+
'The following visible reminders are runtime-added context projections. Because current LLM providers usually do not support role=environment, Dominds projects default system-runtime reminder wrappers as role=user; individual reminder owners may choose the role required by their own contract. Regardless of their final role, these reminders are not new user requests/instructions, and not chat transcript text.',
|
|
228
228
|
'In the WebUI, the user sees these reminders through a separate Reminder widget/panel item and can distinguish them from the chat transcript.',
|
|
229
229
|
'Use reminders as workset/state references; only carry information into a later substantive outward reply when it materially changes your current judgment, plan, or risk. Do not send a standalone "acknowledged/noted/silently absorbed" reply for reminder items.',
|
|
230
230
|
].join('\n');
|
|
@@ -234,23 +234,27 @@ function formatReminderItemProjectionNote(language) {
|
|
|
234
234
|
}
|
|
235
235
|
function formatReminderContextFooter(language, followingState) {
|
|
236
236
|
if (language === 'zh') {
|
|
237
|
-
const base = `${formatSystemNoticePrefix(language)}
|
|
237
|
+
const base = `${formatSystemNoticePrefix(language)} 提醒项上下文块结束。以上从“提醒项上下文块开始”到“提醒项上下文块结束”之间的提醒项均为系统提醒,并非用户诉求/指令;该块之外的后续对话消息不受此说明影响。`;
|
|
238
238
|
if (followingState === 'user_message') {
|
|
239
|
-
return `${base}
|
|
239
|
+
return (`${base}本轮提醒项块之后会紧接一条本轮真实的新用户消息;后续消息是用户的新诉求/指令,不是提醒项投影。` +
|
|
240
|
+
'提醒项块说明到此为止,不得外溢到那条消息:不要把后续用户消息称为“系统提示/没有新消息”,也不要因为本块说明而降低它的指令优先级。' +
|
|
241
|
+
'请按那条用户消息的原始语义继续处理;若它要求更新你的职责、偏好或心智资产,应照常落实。');
|
|
240
242
|
}
|
|
241
243
|
if (followingState === 'runtime_notice') {
|
|
242
|
-
return `${base}
|
|
244
|
+
return `${base}本轮提醒项块之后会接着出现一条运行时提示;它不是用户的新诉求/指令,请按其中的运行时要求继续推进。`;
|
|
243
245
|
}
|
|
244
246
|
return `${base}本轮没有新的用户消息或运行时提示;这是工具调用后的自动续推,请基于已有任务状态继续推进,不要把“没有新消息”理解为空系统提示。`;
|
|
245
247
|
}
|
|
246
248
|
const base = `${formatSystemNoticePrefix(language)} Reminder context block ends. The reminder items between ` +
|
|
247
249
|
'"Reminder context block begins" and "Reminder context block ends" are system reminders, ' +
|
|
248
|
-
'not user instructions; this
|
|
250
|
+
'not user requests/instructions; this reminder-block guidance does not apply to subsequent dialog messages outside this block. ';
|
|
249
251
|
if (followingState === 'user_message') {
|
|
250
|
-
return `${base}A new user message for this round follows this reminder block;
|
|
252
|
+
return (`${base}A real new user message for this round immediately follows this reminder block; the following message is a new user request/instruction, not a reminder projection. ` +
|
|
253
|
+
'The reminder-block guidance ends here and must not spill over onto that message: do not label the following user message as a "system notice" or "no new message", and do not lower its instruction priority because of this block. ' +
|
|
254
|
+
'Handle that user message according to its original meaning; if it asks you to update your responsibilities, preferences, or mind assets, carry that out normally.');
|
|
251
255
|
}
|
|
252
256
|
if (followingState === 'runtime_notice') {
|
|
253
|
-
return `${base}A runtime notice follows this reminder block in this round; it is not a new user request, so follow that runtime guidance and continue the work.`;
|
|
257
|
+
return `${base}A runtime notice follows this reminder block in this round; it is not a new user request/instruction, so follow that runtime guidance and continue the work.`;
|
|
254
258
|
}
|
|
255
259
|
return `${base}There is no new user message or runtime notice in this round; this is an automatic continuation after a tool call. Continue from the existing task state, and do not interpret the absence of a new message as an empty system notice.`;
|
|
256
260
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dominds",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.5",
|
|
4
4
|
"description": "Dominds CLI and aggregation shell for the LongRun AI kernel/runtime packages.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"publishConfig": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"yaml": "^2.8.2",
|
|
54
54
|
"zod": "^4.3.6",
|
|
55
55
|
"@longrun-ai/codex-auth": "0.13.0",
|
|
56
|
-
"@longrun-ai/kernel": "1.13.
|
|
57
|
-
"@longrun-ai/shell": "1.13.
|
|
56
|
+
"@longrun-ai/kernel": "1.13.2",
|
|
57
|
+
"@longrun-ai/shell": "1.13.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/node": "^25.3.5",
|