dominds 1.24.3 → 1.24.4

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.
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.resolveUserMessageLanguageCodeForTest = resolveUserMessageLanguageCodeForTest;
6
7
  exports.shouldQueueUserSupplementAtGenerationBoundary = shouldQueueUserSupplementAtGenerationBoundary;
8
+ exports.wrapCriticalUserInterjectionPromptAtIngress = wrapCriticalUserInterjectionPromptAtIngress;
7
9
  exports.handleWebSocketMessage = handleWebSocketMessage;
8
10
  exports.setupWebSocketServer = setupWebSocketServer;
9
11
  exports.cleanupEventSystems = cleanupEventSystems;
@@ -30,6 +32,7 @@ const dialog_instance_registry_1 = require("../dialog-instance-registry");
30
32
  const dialog_latest_state_1 = require("../dialog-latest-state");
31
33
  const evt_registry_1 = require("../evt-registry");
32
34
  const kernel_driver_1 = require("../llm/kernel-driver");
35
+ const context_health_1 = require("../llm/kernel-driver/context-health");
33
36
  const runtime_2 = require("../llm/kernel-driver/runtime");
34
37
  const log_1 = require("../log");
35
38
  const persistence_1 = require("../persistence");
@@ -294,6 +297,9 @@ function resolveUserLanguageCode(ws, raw, fallbackDialog) {
294
297
  return fallbackDialog.getLastUserLanguageCode();
295
298
  return (0, work_language_1.getWorkLanguage)();
296
299
  }
300
+ function resolveUserMessageLanguageCodeForTest(args) {
301
+ return resolveUserLanguageCode(args.ws, args.raw, args.fallbackDialog);
302
+ }
297
303
  function syncDialogLanguagePreference(dialog, language, options) {
298
304
  const previousLanguage = dialog.getLastUserLanguageCode();
299
305
  dialog.setUiLanguage(language);
@@ -349,6 +355,29 @@ async function queueUserSupplementAtGenerationBoundary(dialog, prompt) {
349
355
  });
350
356
  return true;
351
357
  }
358
+ function wrapCriticalUserInterjectionPromptAtIngress(dialog, prompt) {
359
+ if ((0, driver_messages_1.isAgentFacingCriticalUserInterjectionRemediationGuideContent)(prompt.content)) {
360
+ return prompt;
361
+ }
362
+ const snapshot = dialog.getLastContextHealth();
363
+ if (snapshot?.kind !== 'available' || snapshot.level !== 'critical') {
364
+ return prompt;
365
+ }
366
+ const remaining = (0, context_health_1.resolveCriticalCountdownRemaining)(dialog.id.key(), snapshot);
367
+ if (remaining <= 0) {
368
+ return prompt;
369
+ }
370
+ const language = prompt.userLanguageCode ?? dialog.getLastUserLanguageCode();
371
+ const dialogScope = dialog instanceof dialog_1.MainDialog ? 'mainDialog' : 'sideDialog';
372
+ const prefix = (0, driver_messages_1.formatAgentFacingCriticalUserInterjectionRemediationGuide)(language, {
373
+ dialogScope,
374
+ promptsRemainingAfterThis: (0, context_health_1.consumeCriticalCountdown)(dialog.id.key()),
375
+ });
376
+ return {
377
+ ...prompt,
378
+ content: `${prefix}\n\n${prompt.content}`,
379
+ };
380
+ }
352
381
  /**
353
382
  * Get error code from unknown error
354
383
  */
@@ -1267,7 +1296,8 @@ async function handleUserMsg2Dlg(ws, packet) {
1267
1296
  try {
1268
1297
  const { dialog: dialogIdent, content, msgId } = packet;
1269
1298
  const attachments = parseUserImageAttachments(packet.attachments);
1270
- const userLanguageCode = resolveUserLanguageCode(ws, packet.userLanguageCode);
1299
+ const rawUserLanguageCode = packet
1300
+ .userLanguageCode;
1271
1301
  // Basic validation
1272
1302
  if (!dialogIdent || !content || !msgId) {
1273
1303
  ws.send(JSON.stringify({
@@ -1296,11 +1326,10 @@ async function handleUserMsg2Dlg(ws, packet) {
1296
1326
  }));
1297
1327
  return;
1298
1328
  }
1299
- const effectivePrompt = {
1329
+ let effectivePrompt = {
1300
1330
  content,
1301
1331
  msgId,
1302
1332
  grammar: 'markdown',
1303
- userLanguageCode,
1304
1333
  };
1305
1334
  const preparedAttachments = prepareUserImageAttachments(attachments);
1306
1335
  // If the dialog is already active for this WebSocket, runnable (status === 'running'),
@@ -1320,11 +1349,16 @@ async function handleUserMsg2Dlg(ws, packet) {
1320
1349
  existingDialog.status === 'running' &&
1321
1350
  existingSub &&
1322
1351
  existingSub.dialogKey === existingDialog.id.valueOf()) {
1352
+ effectivePrompt = {
1353
+ ...effectivePrompt,
1354
+ userLanguageCode: resolveUserLanguageCode(ws, rawUserLanguageCode, existingDialog),
1355
+ };
1323
1356
  const contentItems = await persistPreparedUserImageAttachments({
1324
1357
  dialog: existingDialog,
1325
1358
  msgId: effectivePrompt.msgId,
1326
1359
  attachments: preparedAttachments,
1327
1360
  });
1361
+ effectivePrompt = wrapCriticalUserInterjectionPromptAtIngress(existingDialog, effectivePrompt);
1328
1362
  const queuedAtBoundary = await queueUserSupplementAtGenerationBoundary(existingDialog, {
1329
1363
  ...effectivePrompt,
1330
1364
  contentItems,
@@ -1362,11 +1396,16 @@ async function handleUserMsg2Dlg(ws, packet) {
1362
1396
  return;
1363
1397
  }
1364
1398
  await setupWebSocketSubscription(ws, dialog);
1399
+ effectivePrompt = {
1400
+ ...effectivePrompt,
1401
+ userLanguageCode: resolveUserLanguageCode(ws, rawUserLanguageCode, dialog),
1402
+ };
1365
1403
  const contentItems = await persistPreparedUserImageAttachments({
1366
1404
  dialog,
1367
1405
  msgId: effectivePrompt.msgId,
1368
1406
  attachments: preparedAttachments,
1369
1407
  });
1408
+ effectivePrompt = wrapCriticalUserInterjectionPromptAtIngress(dialog, effectivePrompt);
1370
1409
  const queuedAtBoundary = await queueUserSupplementAtGenerationBoundary(dialog, {
1371
1410
  ...effectivePrompt,
1372
1411
  contentItems,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dominds",
3
- "version": "1.24.3",
3
+ "version": "1.24.4",
4
4
  "description": "Dominds CLI and aggregation shell for the LongRun AI kernel/runtime packages.",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -52,9 +52,9 @@
52
52
  "ws": "^8.19.0",
53
53
  "yaml": "^2.8.2",
54
54
  "zod": "^4.3.6",
55
- "@longrun-ai/codex-auth": "0.13.0",
56
- "@longrun-ai/shell": "1.14.0",
57
- "@longrun-ai/kernel": "1.14.0"
55
+ "@longrun-ai/kernel": "1.14.1",
56
+ "@longrun-ai/shell": "1.14.1",
57
+ "@longrun-ai/codex-auth": "0.13.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "^25.3.5",