dominds 1.6.5 → 1.6.6
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/shared/i18n/driver-messages.js +50 -26
- package/dist/tools/ctrl.js +102 -3
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ function formatReminderItemGuide(language, index, content, options) {
|
|
|
31
31
|
// `options.meta` is persisted JSON coming from tools. Runtime shape checks are unavoidable here
|
|
32
32
|
// to keep reminder ownership/management loosely coupled and extensible.
|
|
33
33
|
const metaValue = options && 'meta' in options ? options.meta : undefined;
|
|
34
|
+
const isContinuationPackageReminder = isRecord(metaValue) && metaValue['kind'] === 'continuation_package';
|
|
34
35
|
const managedByToolRaw = isRecord(metaValue) && typeof metaValue['managedByTool'] === 'string'
|
|
35
36
|
? metaValue['managedByTool'].trim()
|
|
36
37
|
: undefined;
|
|
@@ -60,28 +61,43 @@ function formatReminderItemGuide(language, index, content, options) {
|
|
|
60
61
|
if (managementTool) {
|
|
61
62
|
const updateExampleSafe = updateExample ?? `${managementTool}({ ... })`;
|
|
62
63
|
return [
|
|
63
|
-
`提醒项 #${index}
|
|
64
|
+
`提醒项 #${index}(工具状态)`,
|
|
64
65
|
'',
|
|
65
|
-
'
|
|
66
|
+
'说明:这是由工具维护的提醒展示,可视为当前状态参考;它不自动等于你现在必须立刻执行的指令。',
|
|
66
67
|
'',
|
|
67
|
-
`提示:该提醒项由工具 ${managementTool}
|
|
68
|
+
`提示:该提醒项由工具 ${managementTool} 管理;如需调整,请使用 ${managementTool}(不要用 update_reminder)。`,
|
|
68
69
|
'',
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
`如需更新此提醒项,可执行:${updateExampleSafe}`,
|
|
71
|
+
`如需删除此提醒项,可执行:delete_reminder({ "reminder_no": ${index} })`,
|
|
72
|
+
'',
|
|
73
|
+
'---',
|
|
74
|
+
content,
|
|
75
|
+
].join('\n');
|
|
76
|
+
}
|
|
77
|
+
if (isContinuationPackageReminder) {
|
|
78
|
+
return [
|
|
79
|
+
`提醒项 #${index}(换程接续信息)`,
|
|
80
|
+
'',
|
|
81
|
+
'说明:这是用于换程后快速恢复工作的接续包,不自动等于当前必须立刻执行的指令。',
|
|
82
|
+
'',
|
|
83
|
+
'建议:优先保留下一步行动、关键定位、运行/验证信息、容易丢的临时细节;不要重复差遣牒已覆盖的内容。进入新一程后,尽快以清醒头脑重新审视、整理更新。若目前只是粗略过桥笔记,进入新一程后尽快收敛。',
|
|
84
|
+
'',
|
|
85
|
+
`如需更新此接续包,可执行:update_reminder({ "reminder_no": ${index}, "content": "..." })`,
|
|
86
|
+
`如需删除此提醒项,可执行:delete_reminder({ "reminder_no": ${index} })`,
|
|
72
87
|
'',
|
|
73
88
|
'---',
|
|
74
89
|
content,
|
|
75
90
|
].join('\n');
|
|
76
91
|
}
|
|
77
92
|
return [
|
|
78
|
-
`提醒项 #${index}
|
|
93
|
+
`提醒项 #${index}`,
|
|
79
94
|
'',
|
|
80
|
-
'
|
|
95
|
+
'说明:这是你给自己的显眼提示,用于保留当前对话里容易丢的工作信息;它不自动等于系统下发的下一步动作。',
|
|
81
96
|
'',
|
|
82
|
-
'
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
'建议:保持简洁、及时更新;不再需要时删除。若后续准备换程,也可以把它整理成接续包。',
|
|
98
|
+
'',
|
|
99
|
+
`如需更新此提醒项,可执行:update_reminder({ "reminder_no": ${index}, "content": "..." })`,
|
|
100
|
+
`如需删除此提醒项,可执行:delete_reminder({ "reminder_no": ${index} })`,
|
|
85
101
|
'',
|
|
86
102
|
'---',
|
|
87
103
|
content,
|
|
@@ -89,29 +105,37 @@ function formatReminderItemGuide(language, index, content, options) {
|
|
|
89
105
|
}
|
|
90
106
|
if (managementTool) {
|
|
91
107
|
const updateExampleSafe = updateExample ?? `${managementTool}({ ... })`;
|
|
92
|
-
return `REMINDER ITEM #${index} (
|
|
108
|
+
return `REMINDER ITEM #${index} (TOOL STATE)
|
|
109
|
+
|
|
110
|
+
Note: this is a tool-maintained reminder display. Treat it as state reference, not as an automatic must-do command.
|
|
111
|
+
|
|
112
|
+
This reminder is managed by tool ${managementTool}; if you need to change it, use ${managementTool} instead of update_reminder.
|
|
113
|
+
|
|
114
|
+
If you need to update this reminder, run: ${updateExampleSafe}
|
|
115
|
+
If you need to delete this reminder, run: delete_reminder({ "reminder_no": ${index} })
|
|
116
|
+
---
|
|
117
|
+
${content}`;
|
|
118
|
+
}
|
|
119
|
+
if (isContinuationPackageReminder) {
|
|
120
|
+
return `REMINDER ITEM #${index} (CONTINUATION PACKAGE)
|
|
93
121
|
|
|
94
|
-
|
|
122
|
+
Note: this is resume information for the next course, not an automatic must-do command.
|
|
95
123
|
|
|
96
|
-
|
|
124
|
+
Guidance: keep the next step, key pointers, run/verify info, and easy-to-lose volatile details. Do not duplicate Taskdoc content. In the new course, review this again with a clear head and reorganize it promptly. If this is only a rough bridge note, reconcile it early in the new course.
|
|
97
125
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- Delete: delete_reminder({ "reminder_no": ${index} })
|
|
126
|
+
If you need to update this package, run: update_reminder({ "reminder_no": ${index}, "content": "..." })
|
|
127
|
+
If you need to delete this reminder, run: delete_reminder({ "reminder_no": ${index} })
|
|
101
128
|
---
|
|
102
129
|
${content}`;
|
|
103
130
|
}
|
|
104
|
-
return `REMINDER ITEM #${index}
|
|
131
|
+
return `REMINDER ITEM #${index}
|
|
132
|
+
|
|
133
|
+
Note: this is a conspicuous reminder to yourself for easy-to-lose work details in the current dialog. It is not an automatically assigned next action.
|
|
105
134
|
|
|
106
|
-
|
|
107
|
-
- If this is a pre-clear continuation package, prefer one structured reminder when you are clear-headed.
|
|
108
|
-
- If context is already degraded, multiple rough reminders are acceptable as a bridge; reconcile them quickly in the new course.
|
|
109
|
-
- Still needed: compress and update_reminder (do not grow without bound).
|
|
110
|
-
- Not needed: delete_reminder.
|
|
135
|
+
Guidance: keep it concise, refresh it when needed, and delete it when obsolete. If you are preparing a new course, you can also rewrite it into a continuation package.
|
|
111
136
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
- Delete: delete_reminder({ "reminder_no": ${index} })
|
|
137
|
+
If you need to update this reminder, run: update_reminder({ "reminder_no": ${index}, "content": "..." })
|
|
138
|
+
If you need to delete this reminder, run: delete_reminder({ "reminder_no": ${index} })
|
|
115
139
|
---
|
|
116
140
|
${content}`;
|
|
117
141
|
}
|
package/dist/tools/ctrl.js
CHANGED
|
@@ -71,6 +71,24 @@ const task_package_1 = require("../utils/task-package");
|
|
|
71
71
|
function isRecord(value) {
|
|
72
72
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
73
73
|
}
|
|
74
|
+
function isJsonValue(value) {
|
|
75
|
+
if (value === null ||
|
|
76
|
+
typeof value === 'string' ||
|
|
77
|
+
typeof value === 'number' ||
|
|
78
|
+
typeof value === 'boolean') {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
if (Array.isArray(value)) {
|
|
82
|
+
return value.every((item) => isJsonValue(item));
|
|
83
|
+
}
|
|
84
|
+
if (!isRecord(value)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
return Object.values(value).every((item) => isJsonValue(item));
|
|
88
|
+
}
|
|
89
|
+
function isJsonObject(value) {
|
|
90
|
+
return isRecord(value) && Object.values(value).every((item) => isJsonValue(item));
|
|
91
|
+
}
|
|
74
92
|
function listNumberedReminderIndices(reminders) {
|
|
75
93
|
const indices = [];
|
|
76
94
|
for (let index = 0; index < reminders.length; index += 1) {
|
|
@@ -93,6 +111,60 @@ function listNumberedReminders(reminders) {
|
|
|
93
111
|
return numbered;
|
|
94
112
|
}
|
|
95
113
|
const reminderRoundSnapshots = new WeakMap();
|
|
114
|
+
function getContinuationPackageContextHealthLevel(snapshot) {
|
|
115
|
+
if (snapshot?.kind !== 'available') {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
if (snapshot.level === 'caution' || snapshot.level === 'critical') {
|
|
119
|
+
return snapshot.level;
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
function buildContinuationPackageReminderMeta(args) {
|
|
124
|
+
const baseMeta = {
|
|
125
|
+
kind: 'continuation_package',
|
|
126
|
+
createdBy: args.createdBy,
|
|
127
|
+
...(args.contextHealthLevel === undefined
|
|
128
|
+
? {}
|
|
129
|
+
: { contextHealthLevel: args.contextHealthLevel }),
|
|
130
|
+
};
|
|
131
|
+
if (!isJsonObject(args.existingMeta)) {
|
|
132
|
+
return baseMeta;
|
|
133
|
+
}
|
|
134
|
+
if (args.existingMeta['kind'] === 'continuation_package') {
|
|
135
|
+
const preservedCreatedBy = args.existingMeta['createdBy'] === 'clear_mind' ||
|
|
136
|
+
args.existingMeta['createdBy'] === 'context_health'
|
|
137
|
+
? args.existingMeta['createdBy']
|
|
138
|
+
: args.createdBy;
|
|
139
|
+
const nextMeta = {
|
|
140
|
+
...args.existingMeta,
|
|
141
|
+
kind: 'continuation_package',
|
|
142
|
+
createdBy: preservedCreatedBy,
|
|
143
|
+
...(args.contextHealthLevel === undefined
|
|
144
|
+
? {}
|
|
145
|
+
: { contextHealthLevel: args.contextHealthLevel }),
|
|
146
|
+
};
|
|
147
|
+
return nextMeta;
|
|
148
|
+
}
|
|
149
|
+
const nextMeta = { ...args.existingMeta, ...baseMeta };
|
|
150
|
+
return nextMeta;
|
|
151
|
+
}
|
|
152
|
+
function removeContinuationPackageReminderMeta(existingMeta) {
|
|
153
|
+
if (!isJsonObject(existingMeta) || existingMeta['kind'] !== 'continuation_package') {
|
|
154
|
+
return { changed: false };
|
|
155
|
+
}
|
|
156
|
+
const nextMeta = {};
|
|
157
|
+
for (const [key, value] of Object.entries(existingMeta)) {
|
|
158
|
+
if (key === 'kind' || key === 'createdBy' || key === 'contextHealthLevel') {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
nextMeta[key] = value;
|
|
162
|
+
}
|
|
163
|
+
if (Object.keys(nextMeta).length === 0) {
|
|
164
|
+
return { changed: true, nextMeta: null };
|
|
165
|
+
}
|
|
166
|
+
return { changed: true, nextMeta };
|
|
167
|
+
}
|
|
96
168
|
function getNumberedRemindersForLookup(dlg) {
|
|
97
169
|
const genseq = dlg.activeGenSeqOrUndefined;
|
|
98
170
|
if (typeof genseq !== 'number') {
|
|
@@ -264,7 +336,14 @@ exports.addReminderTool = {
|
|
|
264
336
|
insertIndex = targetIndex;
|
|
265
337
|
}
|
|
266
338
|
}
|
|
267
|
-
dlg.
|
|
339
|
+
const contextHealthLevel = getContinuationPackageContextHealthLevel(dlg.getLastContextHealth());
|
|
340
|
+
const reminderMeta = contextHealthLevel === undefined
|
|
341
|
+
? undefined
|
|
342
|
+
: buildContinuationPackageReminderMeta({
|
|
343
|
+
createdBy: 'context_health',
|
|
344
|
+
contextHealthLevel,
|
|
345
|
+
});
|
|
346
|
+
dlg.addReminder(reminderContent, undefined, reminderMeta, insertIndex);
|
|
268
347
|
return (0, tool_result_messages_1.formatToolActionResult)(language, 'added');
|
|
269
348
|
},
|
|
270
349
|
};
|
|
@@ -323,7 +402,22 @@ exports.updateReminderTool = {
|
|
|
323
402
|
const reminderContent = typeof contentValue === 'string' ? contentValue.trim() : '';
|
|
324
403
|
if (!reminderContent)
|
|
325
404
|
return t.reminderContentEmpty;
|
|
326
|
-
dlg.
|
|
405
|
+
const contextHealthLevel = getContinuationPackageContextHealthLevel(dlg.getLastContextHealth());
|
|
406
|
+
if (contextHealthLevel === undefined) {
|
|
407
|
+
const stripResult = removeContinuationPackageReminderMeta(reminder?.meta);
|
|
408
|
+
if (stripResult.changed) {
|
|
409
|
+
dlg.updateReminder(targetIndex, reminderContent, stripResult.nextMeta);
|
|
410
|
+
return (0, tool_result_messages_1.formatToolActionResult)(language, 'updated');
|
|
411
|
+
}
|
|
412
|
+
dlg.updateReminder(targetIndex, reminderContent);
|
|
413
|
+
return (0, tool_result_messages_1.formatToolActionResult)(language, 'updated');
|
|
414
|
+
}
|
|
415
|
+
const reminderMeta = buildContinuationPackageReminderMeta({
|
|
416
|
+
existingMeta: reminder?.meta,
|
|
417
|
+
createdBy: 'context_health',
|
|
418
|
+
contextHealthLevel,
|
|
419
|
+
});
|
|
420
|
+
dlg.updateReminder(targetIndex, reminderContent, reminderMeta);
|
|
327
421
|
return (0, tool_result_messages_1.formatToolActionResult)(language, 'updated');
|
|
328
422
|
},
|
|
329
423
|
};
|
|
@@ -352,7 +446,12 @@ exports.clearMindTool = {
|
|
|
352
446
|
const reminderValue = args['reminder_content'];
|
|
353
447
|
const reminderContent = typeof reminderValue === 'string' ? reminderValue.trim() : '';
|
|
354
448
|
if (reminderContent) {
|
|
355
|
-
dlg.
|
|
449
|
+
const contextHealthLevel = getContinuationPackageContextHealthLevel(dlg.getLastContextHealth());
|
|
450
|
+
const continuationMeta = buildContinuationPackageReminderMeta({
|
|
451
|
+
createdBy: 'clear_mind',
|
|
452
|
+
contextHealthLevel,
|
|
453
|
+
});
|
|
454
|
+
dlg.addReminder(reminderContent, undefined, continuationMeta);
|
|
356
455
|
}
|
|
357
456
|
await dlg.startNewCourse(t.clearedCoursePrompt(dlg.currentCourse + 1));
|
|
358
457
|
// Context health snapshot is inherently tied to the previous prompt/context.
|