dominds 1.25.16 → 1.25.18

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 (127) hide show
  1. package/dist/cli/create.d.ts +1 -1
  2. package/dist/cli/create.js +2 -2
  3. package/dist/cli/disable.d.ts +1 -1
  4. package/dist/cli/disable.js +2 -2
  5. package/dist/cli/doctor.d.ts +1 -1
  6. package/dist/cli/doctor.js +2 -2
  7. package/dist/cli/enable.d.ts +1 -1
  8. package/dist/cli/enable.js +2 -2
  9. package/dist/cli/install.d.ts +1 -1
  10. package/dist/cli/install.js +2 -2
  11. package/dist/cli/manual.d.ts +1 -1
  12. package/dist/cli/manual.js +2 -2
  13. package/dist/cli/read.d.ts +1 -1
  14. package/dist/cli/read.js +1 -2
  15. package/dist/cli/tui.d.ts +1 -1
  16. package/dist/cli/tui.js +2 -2
  17. package/dist/cli/uninstall.d.ts +1 -1
  18. package/dist/cli/uninstall.js +2 -2
  19. package/dist/cli/update.d.ts +1 -1
  20. package/dist/cli/update.js +2 -2
  21. package/dist/cli/validate-team-def.d.ts +1 -1
  22. package/dist/cli/validate-team-def.js +2 -2
  23. package/dist/cli/webui.d.ts +1 -1
  24. package/dist/cli/webui.js +1 -2
  25. package/dist/cli.d.ts +1 -1
  26. package/dist/cli.js +14 -20
  27. package/dist/docs/context-health.md +39 -1
  28. package/dist/docs/context-health.zh.md +30 -1
  29. package/dist/llm/kernel-driver/drive.js +167 -7
  30. package/dist/persistence.js +118 -52
  31. package/dist/server/dominds-self-update.js +7 -5
  32. package/package.json +1 -1
  33. package/webapp/dist/assets/{_basePickBy-bB-pfQPi.js → _basePickBy-DUivPKf7.js} +3 -3
  34. package/webapp/dist/assets/{_basePickBy-bB-pfQPi.js.map → _basePickBy-DUivPKf7.js.map} +1 -1
  35. package/webapp/dist/assets/{_baseUniq-CGrWBZre.js → _baseUniq-hcs024vD.js} +2 -2
  36. package/webapp/dist/assets/{_baseUniq-CGrWBZre.js.map → _baseUniq-hcs024vD.js.map} +1 -1
  37. package/webapp/dist/assets/{arc-I9vbIaKk.js → arc-Dr6-FXp5.js} +2 -2
  38. package/webapp/dist/assets/{arc-I9vbIaKk.js.map → arc-Dr6-FXp5.js.map} +1 -1
  39. package/webapp/dist/assets/{architectureDiagram-2XIMDMQ5-CrwjTxLz.js → architectureDiagram-2XIMDMQ5-DXqcDq4R.js} +7 -7
  40. package/webapp/dist/assets/{architectureDiagram-2XIMDMQ5-CrwjTxLz.js.map → architectureDiagram-2XIMDMQ5-DXqcDq4R.js.map} +1 -1
  41. package/webapp/dist/assets/{blockDiagram-WCTKOSBZ-DTm0qfvP.js → blockDiagram-WCTKOSBZ-IIP6LGXS.js} +7 -7
  42. package/webapp/dist/assets/{blockDiagram-WCTKOSBZ-DTm0qfvP.js.map → blockDiagram-WCTKOSBZ-IIP6LGXS.js.map} +1 -1
  43. package/webapp/dist/assets/{c4Diagram-IC4MRINW-DwRQtzZF.js → c4Diagram-IC4MRINW-D_d3F9XD.js} +3 -3
  44. package/webapp/dist/assets/{c4Diagram-IC4MRINW-DwRQtzZF.js.map → c4Diagram-IC4MRINW-D_d3F9XD.js.map} +1 -1
  45. package/webapp/dist/assets/{channel-BHLOwBnI.js → channel-CWWjsXtU.js} +2 -2
  46. package/webapp/dist/assets/{channel-BHLOwBnI.js.map → channel-CWWjsXtU.js.map} +1 -1
  47. package/webapp/dist/assets/{chunk-4BX2VUAB-C-uXnDVV.js → chunk-4BX2VUAB-BF4yph2W.js} +2 -2
  48. package/webapp/dist/assets/{chunk-4BX2VUAB-C-uXnDVV.js.map → chunk-4BX2VUAB-BF4yph2W.js.map} +1 -1
  49. package/webapp/dist/assets/{chunk-55IACEB6-Dq9BI2N6.js → chunk-55IACEB6-Hn3CmDYz.js} +2 -2
  50. package/webapp/dist/assets/{chunk-55IACEB6-Dq9BI2N6.js.map → chunk-55IACEB6-Hn3CmDYz.js.map} +1 -1
  51. package/webapp/dist/assets/{chunk-FMBD7UC4-DR9kFZOV.js → chunk-FMBD7UC4-C05pl9Ov.js} +2 -2
  52. package/webapp/dist/assets/{chunk-FMBD7UC4-DR9kFZOV.js.map → chunk-FMBD7UC4-C05pl9Ov.js.map} +1 -1
  53. package/webapp/dist/assets/{chunk-JSJVCQXG-xnc6SVE5.js → chunk-JSJVCQXG-BVlq_BAS.js} +2 -2
  54. package/webapp/dist/assets/{chunk-JSJVCQXG-xnc6SVE5.js.map → chunk-JSJVCQXG-BVlq_BAS.js.map} +1 -1
  55. package/webapp/dist/assets/{chunk-KX2RTZJC-rUxlh4aS.js → chunk-KX2RTZJC-BQoaRWif.js} +2 -2
  56. package/webapp/dist/assets/{chunk-KX2RTZJC-rUxlh4aS.js.map → chunk-KX2RTZJC-BQoaRWif.js.map} +1 -1
  57. package/webapp/dist/assets/{chunk-NQ4KR5QH-BGU4PhTQ.js → chunk-NQ4KR5QH-0okCAXtW.js} +4 -4
  58. package/webapp/dist/assets/{chunk-NQ4KR5QH-BGU4PhTQ.js.map → chunk-NQ4KR5QH-0okCAXtW.js.map} +1 -1
  59. package/webapp/dist/assets/{chunk-QZHKN3VN-CAlu4xE7.js → chunk-QZHKN3VN-DEiprgz-.js} +2 -2
  60. package/webapp/dist/assets/{chunk-QZHKN3VN-CAlu4xE7.js.map → chunk-QZHKN3VN-DEiprgz-.js.map} +1 -1
  61. package/webapp/dist/assets/{chunk-WL4C6EOR-zZXRkBBY.js → chunk-WL4C6EOR-B-Xkb3lo.js} +6 -6
  62. package/webapp/dist/assets/{chunk-WL4C6EOR-zZXRkBBY.js.map → chunk-WL4C6EOR-B-Xkb3lo.js.map} +1 -1
  63. package/webapp/dist/assets/{classDiagram-VBA2DB6C-DI1CfOtL.js → classDiagram-VBA2DB6C-DCCQrdwF.js} +7 -7
  64. package/webapp/dist/assets/{classDiagram-VBA2DB6C-DI1CfOtL.js.map → classDiagram-VBA2DB6C-DCCQrdwF.js.map} +1 -1
  65. package/webapp/dist/assets/{classDiagram-v2-RAHNMMFH-DI1CfOtL.js → classDiagram-v2-RAHNMMFH-DCCQrdwF.js} +7 -7
  66. package/webapp/dist/assets/{classDiagram-v2-RAHNMMFH-DI1CfOtL.js.map → classDiagram-v2-RAHNMMFH-DCCQrdwF.js.map} +1 -1
  67. package/webapp/dist/assets/{clone-quTqCNPA.js → clone-Drtik9pk.js} +2 -2
  68. package/webapp/dist/assets/{clone-quTqCNPA.js.map → clone-Drtik9pk.js.map} +1 -1
  69. package/webapp/dist/assets/{cose-bilkent-S5V4N54A-BY28yO7Y.js → cose-bilkent-S5V4N54A-BBWvHErL.js} +2 -2
  70. package/webapp/dist/assets/{cose-bilkent-S5V4N54A-BY28yO7Y.js.map → cose-bilkent-S5V4N54A-BBWvHErL.js.map} +1 -1
  71. package/webapp/dist/assets/{dagre-KLK3FWXG-DLyZ54D-.js → dagre-KLK3FWXG-2qk0ikdt.js} +7 -7
  72. package/webapp/dist/assets/{dagre-KLK3FWXG-DLyZ54D-.js.map → dagre-KLK3FWXG-2qk0ikdt.js.map} +1 -1
  73. package/webapp/dist/assets/{diagram-E7M64L7V-CD-HWZAJ.js → diagram-E7M64L7V-C1DbHDbf.js} +8 -8
  74. package/webapp/dist/assets/{diagram-E7M64L7V-CD-HWZAJ.js.map → diagram-E7M64L7V-C1DbHDbf.js.map} +1 -1
  75. package/webapp/dist/assets/{diagram-IFDJBPK2-BHOQ9HH2.js → diagram-IFDJBPK2-DToz8zk9.js} +7 -7
  76. package/webapp/dist/assets/{diagram-IFDJBPK2-BHOQ9HH2.js.map → diagram-IFDJBPK2-DToz8zk9.js.map} +1 -1
  77. package/webapp/dist/assets/{diagram-P4PSJMXO-OEPgBDcD.js → diagram-P4PSJMXO-B9V-tQMe.js} +7 -7
  78. package/webapp/dist/assets/{diagram-P4PSJMXO-OEPgBDcD.js.map → diagram-P4PSJMXO-B9V-tQMe.js.map} +1 -1
  79. package/webapp/dist/assets/{erDiagram-INFDFZHY-Dcgo204J.js → erDiagram-INFDFZHY-CV68FwGf.js} +5 -5
  80. package/webapp/dist/assets/{erDiagram-INFDFZHY-Dcgo204J.js.map → erDiagram-INFDFZHY-CV68FwGf.js.map} +1 -1
  81. package/webapp/dist/assets/{flowDiagram-PKNHOUZH-CWLo3Lkf.js → flowDiagram-PKNHOUZH-CW06almb.js} +7 -7
  82. package/webapp/dist/assets/{flowDiagram-PKNHOUZH-CWLo3Lkf.js.map → flowDiagram-PKNHOUZH-CW06almb.js.map} +1 -1
  83. package/webapp/dist/assets/{ganttDiagram-A5KZAMGK-DWXL4ZD6.js → ganttDiagram-A5KZAMGK-C96NncCU.js} +3 -3
  84. package/webapp/dist/assets/{ganttDiagram-A5KZAMGK-DWXL4ZD6.js.map → ganttDiagram-A5KZAMGK-C96NncCU.js.map} +1 -1
  85. package/webapp/dist/assets/{gitGraphDiagram-K3NZZRJ6-7iLQbTrH.js → gitGraphDiagram-K3NZZRJ6-CAuIexWi.js} +8 -8
  86. package/webapp/dist/assets/{gitGraphDiagram-K3NZZRJ6-7iLQbTrH.js.map → gitGraphDiagram-K3NZZRJ6-CAuIexWi.js.map} +1 -1
  87. package/webapp/dist/assets/{graph-Bq1MLNWN.js → graph-CvhwAY6w.js} +3 -3
  88. package/webapp/dist/assets/{graph-Bq1MLNWN.js.map → graph-CvhwAY6w.js.map} +1 -1
  89. package/webapp/dist/assets/{index-r4An5YoX.js → index-BOO_zFrI.js} +305 -39
  90. package/webapp/dist/assets/{index-r4An5YoX.js.map → index-BOO_zFrI.js.map} +1 -1
  91. package/webapp/dist/assets/{infoDiagram-LFFYTUFH-CoF5OE3_.js → infoDiagram-LFFYTUFH-C16Sckpz.js} +6 -6
  92. package/webapp/dist/assets/{infoDiagram-LFFYTUFH-CoF5OE3_.js.map → infoDiagram-LFFYTUFH-C16Sckpz.js.map} +1 -1
  93. package/webapp/dist/assets/{ishikawaDiagram-PHBUUO56-iKggfQhA.js → ishikawaDiagram-PHBUUO56-oNG6I0p3.js} +2 -2
  94. package/webapp/dist/assets/{ishikawaDiagram-PHBUUO56-iKggfQhA.js.map → ishikawaDiagram-PHBUUO56-oNG6I0p3.js.map} +1 -1
  95. package/webapp/dist/assets/{journeyDiagram-4ABVD52K-NYDQ7_xv.js → journeyDiagram-4ABVD52K-437hhFHC.js} +5 -5
  96. package/webapp/dist/assets/{journeyDiagram-4ABVD52K-NYDQ7_xv.js.map → journeyDiagram-4ABVD52K-437hhFHC.js.map} +1 -1
  97. package/webapp/dist/assets/{kanban-definition-K7BYSVSG-YWCnJwk0.js → kanban-definition-K7BYSVSG-DsCV_Tpx.js} +3 -3
  98. package/webapp/dist/assets/{kanban-definition-K7BYSVSG-YWCnJwk0.js.map → kanban-definition-K7BYSVSG-DsCV_Tpx.js.map} +1 -1
  99. package/webapp/dist/assets/{layout-CE6gccWy.js → layout-BttZf7fQ.js} +5 -5
  100. package/webapp/dist/assets/{layout-CE6gccWy.js.map → layout-BttZf7fQ.js.map} +1 -1
  101. package/webapp/dist/assets/{linear-12arIJK-.js → linear-B75vD4Ho.js} +2 -2
  102. package/webapp/dist/assets/{linear-12arIJK-.js.map → linear-B75vD4Ho.js.map} +1 -1
  103. package/webapp/dist/assets/{mindmap-definition-YRQLILUH-D_5iNhfP.js → mindmap-definition-YRQLILUH-DA1-XaNi.js} +4 -4
  104. package/webapp/dist/assets/{mindmap-definition-YRQLILUH-D_5iNhfP.js.map → mindmap-definition-YRQLILUH-DA1-XaNi.js.map} +1 -1
  105. package/webapp/dist/assets/{pieDiagram-SKSYHLDU-DCbLQaXM.js → pieDiagram-SKSYHLDU-Bx6hUJ4Q.js} +8 -8
  106. package/webapp/dist/assets/{pieDiagram-SKSYHLDU-DCbLQaXM.js.map → pieDiagram-SKSYHLDU-Bx6hUJ4Q.js.map} +1 -1
  107. package/webapp/dist/assets/{quadrantDiagram-337W2JSQ-CVRDOyty.js → quadrantDiagram-337W2JSQ-zyduIle0.js} +3 -3
  108. package/webapp/dist/assets/{quadrantDiagram-337W2JSQ-CVRDOyty.js.map → quadrantDiagram-337W2JSQ-zyduIle0.js.map} +1 -1
  109. package/webapp/dist/assets/{requirementDiagram-Z7DCOOCP-iBpmayOS.js → requirementDiagram-Z7DCOOCP-BgfjyEJM.js} +4 -4
  110. package/webapp/dist/assets/{requirementDiagram-Z7DCOOCP-iBpmayOS.js.map → requirementDiagram-Z7DCOOCP-BgfjyEJM.js.map} +1 -1
  111. package/webapp/dist/assets/{sankeyDiagram-WA2Y5GQK-DqzWCtib.js → sankeyDiagram-WA2Y5GQK-lmOWaczS.js} +2 -2
  112. package/webapp/dist/assets/{sankeyDiagram-WA2Y5GQK-DqzWCtib.js.map → sankeyDiagram-WA2Y5GQK-lmOWaczS.js.map} +1 -1
  113. package/webapp/dist/assets/{sequenceDiagram-2WXFIKYE-DHzt-u2j.js → sequenceDiagram-2WXFIKYE-DqJz-iYI.js} +4 -4
  114. package/webapp/dist/assets/{sequenceDiagram-2WXFIKYE-DHzt-u2j.js.map → sequenceDiagram-2WXFIKYE-DqJz-iYI.js.map} +1 -1
  115. package/webapp/dist/assets/{stateDiagram-RAJIS63D-D14FagfU.js → stateDiagram-RAJIS63D-CngWYuX-.js} +9 -9
  116. package/webapp/dist/assets/{stateDiagram-RAJIS63D-D14FagfU.js.map → stateDiagram-RAJIS63D-CngWYuX-.js.map} +1 -1
  117. package/webapp/dist/assets/{stateDiagram-v2-FVOUBMTO-CZRolF-A.js → stateDiagram-v2-FVOUBMTO-BxyHvrvU.js} +5 -5
  118. package/webapp/dist/assets/{stateDiagram-v2-FVOUBMTO-CZRolF-A.js.map → stateDiagram-v2-FVOUBMTO-BxyHvrvU.js.map} +1 -1
  119. package/webapp/dist/assets/{timeline-definition-YZTLITO2-L4O4kc8p.js → timeline-definition-YZTLITO2-C7t6WVS3.js} +3 -3
  120. package/webapp/dist/assets/{timeline-definition-YZTLITO2-L4O4kc8p.js.map → timeline-definition-YZTLITO2-C7t6WVS3.js.map} +1 -1
  121. package/webapp/dist/assets/{treemap-KZPCXAKY-CvHKWhtl.js → treemap-KZPCXAKY-BDZ3n5TC.js} +5 -5
  122. package/webapp/dist/assets/{treemap-KZPCXAKY-CvHKWhtl.js.map → treemap-KZPCXAKY-BDZ3n5TC.js.map} +1 -1
  123. package/webapp/dist/assets/{vennDiagram-LZ73GAT5-8sPBS5jq.js → vennDiagram-LZ73GAT5-CEw7GPed.js} +2 -2
  124. package/webapp/dist/assets/{vennDiagram-LZ73GAT5-8sPBS5jq.js.map → vennDiagram-LZ73GAT5-CEw7GPed.js.map} +1 -1
  125. package/webapp/dist/assets/{xychartDiagram-JWTSCODW-CqLmOgCw.js → xychartDiagram-JWTSCODW-DmS8BiaA.js} +3 -3
  126. package/webapp/dist/assets/{xychartDiagram-JWTSCODW-CqLmOgCw.js.map → xychartDiagram-JWTSCODW-DmS8BiaA.js.map} +1 -1
  127. package/webapp/dist/index.html +1 -1
@@ -714,6 +714,146 @@ const TELLASK_SPECIAL_VIRTUAL_TOOLS = [
714
714
  },
715
715
  },
716
716
  ];
717
+ const CONTEXT_HEALTH_TOOL_RESULT_VISIBLE_BYTE_LIMIT = 2000;
718
+ const CONTEXT_HEALTH_LARGE_TOOL_RETURN_UNAVAILABLE_ZH = '这次函数返回内容太大,清理头脑之前当前不可见。';
719
+ const CONTEXT_HEALTH_LARGE_TOOL_RETURN_UNAVAILABLE_EN = 'This function returned too much content, so it is not visible before clear_mind.';
720
+ function getContextHealthRemediationLevel(snapshot) {
721
+ if (snapshot?.kind !== 'available') {
722
+ return undefined;
723
+ }
724
+ return snapshot.level === 'caution' || snapshot.level === 'critical' ? snapshot.level : undefined;
725
+ }
726
+ function pickContextHealthForLargeToolResultVisibility(args) {
727
+ if (args.current?.kind === 'available') {
728
+ return args.current;
729
+ }
730
+ return args.previous;
731
+ }
732
+ function formatContextHealthLargeToolReturnUnavailable(args) {
733
+ const approxBytes = new Intl.NumberFormat(args.language === 'zh' ? 'zh-CN' : 'en-US').format(args.originalBytes);
734
+ if (args.language === 'zh') {
735
+ if (args.dlg instanceof dialog_1.SideDialog) {
736
+ return [
737
+ CONTEXT_HEALTH_LARGE_TOOL_RETURN_UNAVAILABLE_ZH,
738
+ '',
739
+ '不要重试获取这类大段输出。现在先做两件事:',
740
+ '1. 把需要回传给主线对话的结论、证据定位和风险整理清楚。',
741
+ '2. 若还有恢复工作会丢的信息,写入提醒项。',
742
+ '',
743
+ '然后尽快完成当前支线回复;如果你有 clear_mind({}),再调用它开启新一程。',
744
+ '',
745
+ `详情:本次返回约 ${approxBytes} 字节。`,
746
+ ].join('\n');
747
+ }
748
+ return [
749
+ CONTEXT_HEALTH_LARGE_TOOL_RETURN_UNAVAILABLE_ZH,
750
+ '',
751
+ '不要重试获取这类大段输出。现在先做两件事:',
752
+ '1. 把下一程还需要知道的信息写入差遣牒合适章节。',
753
+ '2. 把差遣牒没有覆盖、但恢复工作会丢的信息写入提醒项。',
754
+ '',
755
+ '然后调用 clear_mind({}) 开启新一程。',
756
+ '',
757
+ `详情:本次返回约 ${approxBytes} 字节。`,
758
+ ].join('\n');
759
+ }
760
+ if (args.dlg instanceof dialog_1.SideDialog) {
761
+ return [
762
+ CONTEXT_HEALTH_LARGE_TOOL_RETURN_UNAVAILABLE_EN,
763
+ '',
764
+ 'Do not retry fetching this kind of large output. Do two things now:',
765
+ '1. Organize the conclusion, evidence pointers, and risks that need to go back to the Main Dialog.',
766
+ '2. If any resume-critical details would otherwise be lost, write them into reminders.',
767
+ '',
768
+ 'Then finish the current Side Dialog reply as soon as possible; if you have clear_mind({}), call it to start a new course.',
769
+ '',
770
+ `Detail: this return was about ${approxBytes} bytes.`,
771
+ ].join('\n');
772
+ }
773
+ return [
774
+ CONTEXT_HEALTH_LARGE_TOOL_RETURN_UNAVAILABLE_EN,
775
+ '',
776
+ 'Do not retry fetching this kind of large output. Do two things now:',
777
+ '1. Write the information the next course still needs into the appropriate Taskdoc sections.',
778
+ '2. Write any resume-critical details not covered by Taskdoc into reminders.',
779
+ '',
780
+ 'Then call clear_mind({}) to start a new course.',
781
+ '',
782
+ `Detail: this return was about ${approxBytes} bytes.`,
783
+ ].join('\n');
784
+ }
785
+ function countToolResultVisibleBytes(output) {
786
+ const items = output.contentItems;
787
+ if (!Array.isArray(items) || items.length === 0) {
788
+ return Buffer.byteLength(output.content, 'utf8');
789
+ }
790
+ let bytes = Buffer.byteLength(output.content, 'utf8');
791
+ for (const item of items) {
792
+ switch (item.type) {
793
+ case 'input_text':
794
+ bytes += Buffer.byteLength(item.text, 'utf8');
795
+ break;
796
+ case 'input_image':
797
+ bytes += item.byteLength;
798
+ break;
799
+ default: {
800
+ throw new Error(`Unsupported function result content item: ${String(item.type)}`);
801
+ }
802
+ }
803
+ }
804
+ return bytes;
805
+ }
806
+ function applyContextHealthToolResultVisibilityLimit(args) {
807
+ if (getContextHealthRemediationLevel(args.contextHealth) === undefined) {
808
+ return { output: args.output, largeReturnUnavailable: false };
809
+ }
810
+ const visibleBytes = countToolResultVisibleBytes(args.output);
811
+ if (visibleBytes <= CONTEXT_HEALTH_TOOL_RESULT_VISIBLE_BYTE_LIMIT) {
812
+ return { output: args.output, largeReturnUnavailable: false };
813
+ }
814
+ return {
815
+ output: {
816
+ content: formatContextHealthLargeToolReturnUnavailable({
817
+ dlg: args.dlg,
818
+ originalBytes: visibleBytes,
819
+ language: args.language,
820
+ }),
821
+ outcome: args.output.outcome,
822
+ },
823
+ largeReturnUnavailable: true,
824
+ };
825
+ }
826
+ function isContextHealthLargeToolReturnUnavailableResult(content) {
827
+ return (content.includes(CONTEXT_HEALTH_LARGE_TOOL_RETURN_UNAVAILABLE_ZH) ||
828
+ content.includes(CONTEXT_HEALTH_LARGE_TOOL_RETURN_UNAVAILABLE_EN));
829
+ }
830
+ function latestInputLikeMessageIsContextHealthLargeToolReturnUnavailableResult(messages) {
831
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
832
+ const msg = messages[index];
833
+ if (msg === undefined) {
834
+ continue;
835
+ }
836
+ switch (msg.type) {
837
+ case 'func_result_msg':
838
+ return isContextHealthLargeToolReturnUnavailableResult(msg.content);
839
+ case 'prompting_msg':
840
+ case 'tellask_result_msg':
841
+ case 'tellask_carryover_msg':
842
+ return false;
843
+ case 'environment_msg':
844
+ case 'transient_guide_msg':
845
+ case 'saying_msg':
846
+ case 'thinking_msg':
847
+ case 'func_call_msg':
848
+ break;
849
+ default: {
850
+ const _exhaustive = msg;
851
+ throw new Error(`Unsupported chat message while checking latest input-like message: ${_exhaustive}`);
852
+ }
853
+ }
854
+ }
855
+ return false;
856
+ }
717
857
  function mergeTellaskVirtualTools(baseTools, options) {
718
858
  const merged = [...baseTools];
719
859
  const seen = new Set(merged.map((tool) => tool.name));
@@ -1806,6 +1946,7 @@ async function executeFunctionCalls(args) {
1806
1946
  const functionPromises = preparedCalls.map(async ({ func, originalFunc, callGenseq, argsStr, tool, preparedInvocationArgs, }) => {
1807
1947
  let result;
1808
1948
  let outcome = 'success';
1949
+ let forceImmediateFollowup = false;
1809
1950
  let rethrowError;
1810
1951
  if (!tool) {
1811
1952
  outcome = 'failure';
@@ -1846,16 +1987,24 @@ async function executeFunctionCalls(args) {
1846
1987
  throwIfAborted(args.abortSignal, args.dlg);
1847
1988
  const output = await tool.call(args.dlg, args.agent, preparedInvocationArgs.args);
1848
1989
  throwIfAborted(args.abortSignal, args.dlg);
1849
- outcome = output.outcome;
1990
+ const visibleResult = applyContextHealthToolResultVisibilityLimit({
1991
+ dlg: args.dlg,
1992
+ output,
1993
+ contextHealth: args.contextHealthForToolResultVisibility,
1994
+ language: (0, work_language_1.getWorkLanguage)(),
1995
+ });
1996
+ const visibleOutput = visibleResult.output;
1997
+ forceImmediateFollowup = visibleResult.largeReturnUnavailable;
1998
+ outcome = visibleOutput.outcome;
1850
1999
  result = {
1851
2000
  type: 'func_result_msg',
1852
2001
  id: func.id,
1853
2002
  rawId: func.rawId,
1854
2003
  effectiveId: func.effectiveId,
1855
2004
  name: func.name,
1856
- content: output.content,
1857
- contentItems: Array.isArray(output.contentItems)
1858
- ? [...output.contentItems]
2005
+ content: visibleOutput.content,
2006
+ contentItems: Array.isArray(visibleOutput.contentItems)
2007
+ ? [...visibleOutput.contentItems]
1859
2008
  : undefined,
1860
2009
  role: 'tool',
1861
2010
  genseq: callGenseq,
@@ -1886,7 +2035,7 @@ async function executeFunctionCalls(args) {
1886
2035
  if (rethrowError !== undefined) {
1887
2036
  throw rethrowError;
1888
2037
  }
1889
- return { func, originalFunc, outcome, result };
2038
+ return { func, originalFunc, outcome, forceImmediateFollowup, result };
1890
2039
  });
1891
2040
  return await Promise.all(functionPromises);
1892
2041
  }
@@ -1934,12 +2083,16 @@ async function executeFunctionRound(args) {
1934
2083
  agentTools: args.agentTools,
1935
2084
  funcCalls: tellaskRound.normalCalls,
1936
2085
  abortSignal: args.abortSignal,
2086
+ contextHealthForToolResultVisibility: args.contextHealthForToolResultVisibility,
1937
2087
  });
1938
2088
  const genericExecutionByOriginalCall = new Map(genericExecutions.map((execution) => [execution.originalFunc, execution]));
1939
2089
  const funcToolByName = new Map(args.agentTools
1940
2090
  .filter((tool) => tool.type === 'func')
1941
2091
  .map((tool) => [tool.name, tool]));
1942
2092
  const genericOutcomeByCallId = new Map(genericExecutions.map((execution) => [execution.result.id, execution.outcome]));
2093
+ const forceImmediateFollowupCallIds = new Set(genericExecutions
2094
+ .filter((execution) => execution.forceImmediateFollowup)
2095
+ .map((execution) => execution.result.id));
1943
2096
  const immediateFollowupCallIds = [];
1944
2097
  for (const call of tellaskRound.normalCalls) {
1945
2098
  const tool = funcToolByName.get(call.name);
@@ -1947,7 +2100,8 @@ async function executeFunctionRound(args) {
1947
2100
  if (outcome === undefined) {
1948
2101
  throw new Error(`kernel-driver function outcome invariant violation: missing outcome for call id '${call.id}' (${call.name})`);
1949
2102
  }
1950
- if (shouldImmediatelyFollowUpToolOutcome(tool, outcome)) {
2103
+ if (forceImmediateFollowupCallIds.has(call.id) ||
2104
+ shouldImmediatelyFollowUpToolOutcome(tool, outcome)) {
1951
2105
  immediateFollowupCallIds.push(call.id);
1952
2106
  }
1953
2107
  }
@@ -2364,7 +2518,8 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
2364
2518
  cautionRemediationCadenceGenerations,
2365
2519
  criticalCountdownRemaining,
2366
2520
  });
2367
- if (healthDecision.kind === 'continue') {
2521
+ if (healthDecision.kind === 'continue' &&
2522
+ !latestInputLikeMessageIsContextHealthLargeToolReturnUnavailableResult(dlg.msgs)) {
2368
2523
  if (healthDecision.reason === 'critical_force_new_course') {
2369
2524
  const language = (0, work_language_1.getWorkLanguage)();
2370
2525
  const newCoursePrompt = (0, driver_messages_1.formatNewCourseStartPrompt)(language, {
@@ -3083,6 +3238,7 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
3083
3238
  return { usage: res.usage, llmGenModel: res.llmGenModel };
3084
3239
  };
3085
3240
  const previousAssistantSayingGenseq = lastAssistantSayingGenseq;
3241
+ const contextHealthBeforeGen = dlg.getLastContextHealth();
3086
3242
  const llmOutput = await streamOrBatch();
3087
3243
  if (typeof llmOutput.llmGenModel === 'string' && llmOutput.llmGenModel.trim() !== '') {
3088
3244
  llmGenModelForGen = llmOutput.llmGenModel.trim();
@@ -3279,6 +3435,10 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
3279
3435
  abortSignal,
3280
3436
  allowTellaskFunctions: policy.allowTellaskFunctions,
3281
3437
  activePromptReplyDirective: currentPrompt?.tellaskReplyDirective,
3438
+ contextHealthForToolResultVisibility: pickContextHealthForLargeToolResultVisibility({
3439
+ previous: contextHealthBeforeGen,
3440
+ current: contextHealthForGen,
3441
+ }),
3282
3442
  });
3283
3443
  if (routed.tellaskToolOutputs.length > 0) {
3284
3444
  newMsgs.push(...routed.tellaskToolOutputs);
@@ -345,7 +345,7 @@ async function normalizeIdleWhileReplyObligationPending(dialogId, status, previo
345
345
  executionMarker: healedExecutionMarker,
346
346
  };
347
347
  }
348
- const quarantiningMainDialogs = new Set();
348
+ const quarantiningMainDialogs = new Map();
349
349
  const PERSISTABLE_DIALOG_STATUSES = ['running', 'completed', 'archived'];
350
350
  const RUN_STATUS_DIR = 'run';
351
351
  const DONE_STATUS_DIR = 'done';
@@ -5458,74 +5458,119 @@ class DialogPersistence {
5458
5458
  static async quarantineMalformedDialog(dialogId, status, reason, error) {
5459
5459
  const mainDialogId = dialogId.rootId === dialogId.selfId ? dialogId : new dialog_1.DialogID(dialogId.rootId);
5460
5460
  const quarantineKey = `${status}|${mainDialogId.selfId}`;
5461
- if (quarantiningMainDialogs.has(quarantineKey)) {
5462
- return;
5463
- }
5464
- quarantiningMainDialogs.add(quarantineKey);
5465
- let quarantined = false;
5466
- try {
5467
- await prepareDialogQuarantineHook?.({
5468
- dialogId,
5469
- mainDialogId,
5470
- status,
5471
- reason,
5472
- error,
5473
- });
5474
- this.quarantinedMainDialogScopes.add(this.getMainDialogWriteBackCancelScopeKey(mainDialogId, status));
5475
- this.cancelMainDialogWriteBacks(mainDialogId, status);
5476
- const sourcePath = this.getMainDialogPath(mainDialogId, status);
5477
- if (!(await this.pathExists(sourcePath))) {
5478
- return;
5479
- }
5480
- let destinationPath = this.getMalformedMainDialogPath(mainDialogId, status);
5481
- if (await this.pathExists(destinationPath)) {
5482
- destinationPath = path.join(this.getDialogsRootDir(), this.MALFORMED_DIR, `${mainDialogId.selfId}__${(0, node_crypto_1.randomUUID)()}`);
5483
- }
5484
- await fs.promises.mkdir(path.dirname(destinationPath), { recursive: true });
5485
- await fs.promises.rename(sourcePath, destinationPath);
5486
- quarantined = true;
5487
- log_1.log.warn(`Quarantined malformed dialog ${mainDialogId.selfId}`, undefined, {
5488
- status,
5489
- reason,
5490
- sourcePath,
5491
- destinationPath,
5492
- errorMessage: error.message,
5493
- dialogId: dialogId.valueOf(),
5494
- mainDialogId: mainDialogId.valueOf(),
5495
- });
5496
- dialogsQuarantinedBroadcaster?.({
5497
- type: 'dialogs_quarantined',
5498
- status: 'quarantining',
5499
- fromStatus: assertPersistableDialogStatus(status, 'DialogPersistence.quarantineMalformedDialog(fromStatus)'),
5500
- rootId: mainDialogId.selfId,
5501
- dialogId: dialogId.selfId,
5502
- reason,
5503
- timestamp: (0, time_1.formatUnifiedTimestamp)(new Date()),
5504
- });
5461
+ const activeQuarantine = quarantiningMainDialogs.get(quarantineKey);
5462
+ if (activeQuarantine) {
5463
+ return await activeQuarantine;
5505
5464
  }
5506
- finally {
5465
+ const quarantinePromise = Promise.resolve().then(async () => {
5466
+ let quarantined = false;
5467
+ let writeBackCancelScopeKey = null;
5507
5468
  try {
5508
- await finalizeDialogQuarantineHook?.({
5469
+ await prepareDialogQuarantineHook?.({
5509
5470
  dialogId,
5510
5471
  mainDialogId,
5511
5472
  status,
5512
5473
  reason,
5513
5474
  error,
5514
- quarantined,
5475
+ });
5476
+ writeBackCancelScopeKey = this.getMainDialogWriteBackCancelScopeKey(mainDialogId, status);
5477
+ this.quarantinedMainDialogScopes.add(writeBackCancelScopeKey);
5478
+ this.cancelMainDialogWriteBacks(mainDialogId, status);
5479
+ const sourcePath = this.getMainDialogPath(mainDialogId, status);
5480
+ if (!(await this.pathExists(sourcePath))) {
5481
+ return true;
5482
+ }
5483
+ let destinationPath = this.getMalformedMainDialogPath(mainDialogId, status);
5484
+ if (await this.pathExists(destinationPath)) {
5485
+ destinationPath = path.join(this.getDialogsRootDir(), this.MALFORMED_DIR, `${mainDialogId.selfId}__${(0, node_crypto_1.randomUUID)()}`);
5486
+ }
5487
+ await fs.promises.mkdir(path.dirname(destinationPath), { recursive: true });
5488
+ try {
5489
+ await this.renameWithRetry(sourcePath, destinationPath);
5490
+ }
5491
+ catch (renameError) {
5492
+ log_1.log.error('Failed to quarantine malformed dialog; dialog remains in its source status', renameError, {
5493
+ status,
5494
+ reason,
5495
+ sourcePath,
5496
+ destinationPath,
5497
+ errorMessage: error.message,
5498
+ dialogId: dialogId.valueOf(),
5499
+ mainDialogId: mainDialogId.valueOf(),
5500
+ renameErrorCode: getErrorCode(renameError),
5501
+ });
5502
+ return false;
5503
+ }
5504
+ quarantined = true;
5505
+ log_1.log.warn(`Quarantined malformed dialog ${mainDialogId.selfId}`, undefined, {
5506
+ status,
5507
+ reason,
5508
+ sourcePath,
5509
+ destinationPath,
5510
+ errorMessage: error.message,
5511
+ dialogId: dialogId.valueOf(),
5512
+ mainDialogId: mainDialogId.valueOf(),
5513
+ });
5514
+ dialogsQuarantinedBroadcaster?.({
5515
+ type: 'dialogs_quarantined',
5516
+ status: 'quarantining',
5517
+ fromStatus: assertPersistableDialogStatus(status, 'DialogPersistence.quarantineMalformedDialog(fromStatus)'),
5518
+ rootId: mainDialogId.selfId,
5519
+ dialogId: dialogId.selfId,
5520
+ reason,
5521
+ timestamp: (0, time_1.formatUnifiedTimestamp)(new Date()),
5515
5522
  });
5516
5523
  }
5517
5524
  finally {
5518
- quarantiningMainDialogs.delete(quarantineKey);
5525
+ try {
5526
+ if (!quarantined && writeBackCancelScopeKey) {
5527
+ this.quarantinedMainDialogScopes.delete(writeBackCancelScopeKey);
5528
+ }
5529
+ await finalizeDialogQuarantineHook?.({
5530
+ dialogId,
5531
+ mainDialogId,
5532
+ status,
5533
+ reason,
5534
+ error,
5535
+ quarantined,
5536
+ });
5537
+ }
5538
+ finally {
5539
+ const active = quarantiningMainDialogs.get(quarantineKey);
5540
+ if (active === quarantinePromise) {
5541
+ quarantiningMainDialogs.delete(quarantineKey);
5542
+ }
5543
+ }
5519
5544
  }
5520
- }
5545
+ return quarantined;
5546
+ });
5547
+ quarantiningMainDialogs.set(quarantineKey, quarantinePromise);
5548
+ return await quarantinePromise;
5521
5549
  }
5522
5550
  static async quarantineMalformedRuntimeState(dialogId, status, reason, detail) {
5523
- await this.quarantineMalformedDialog(dialogId, status, reason, new Error(detail));
5551
+ const quarantined = await this.quarantineMalformedDialog(dialogId, status, reason, new Error(detail));
5552
+ if (!quarantined) {
5553
+ throw new Error(`Failed to quarantine malformed runtime state ` +
5554
+ `(rootId=${dialogId.rootId}, selfId=${dialogId.selfId}, status=${status}, reason=${reason}): ` +
5555
+ detail);
5556
+ }
5524
5557
  }
5525
5558
  static async rethrowAfterQuarantiningDialogPersistenceProblem(dialogId, status, reason, error) {
5526
5559
  const persistenceError = (0, persistence_errors_1.findDomindsPersistenceFileError)(error);
5527
5560
  if (persistenceError) {
5528
- await this.quarantineMalformedDialog(dialogId, status, reason, persistenceError);
5561
+ try {
5562
+ await this.quarantineMalformedDialog(dialogId, status, reason, persistenceError);
5563
+ }
5564
+ catch (quarantineError) {
5565
+ log_1.log.error('Failed to complete malformed dialog quarantine', quarantineError, {
5566
+ status,
5567
+ reason,
5568
+ dialogId: dialogId.valueOf(),
5569
+ mainDialogId: dialogId.rootId,
5570
+ persistenceErrorMessage: persistenceError.message,
5571
+ quarantineErrorCode: getErrorCode(quarantineError),
5572
+ });
5573
+ }
5529
5574
  throw persistenceError;
5530
5575
  }
5531
5576
  throw error;
@@ -5664,6 +5709,13 @@ class DialogPersistence {
5664
5709
  }
5665
5710
  }
5666
5711
  catch (error) {
5712
+ if (getErrorCode(error) === 'ENOENT') {
5713
+ log_1.log.debug(`🔍 listDialogs: Directory disappeared while scanning ${dirPath}`, undefined, {
5714
+ status,
5715
+ dirPath,
5716
+ });
5717
+ return;
5718
+ }
5667
5719
  // Directory enumeration failures are filesystem-level access/I/O problems, not evidence
5668
5720
  // that a specific dialog record is malformed. If we cannot even read this directory,
5669
5721
  // attempting to quarantine a child dialog via move/rename is unlikely to be reliable.
@@ -5708,6 +5760,13 @@ class DialogPersistence {
5708
5760
  entries = await fs.promises.readdir(dirPath, { withFileTypes: true });
5709
5761
  }
5710
5762
  catch (error) {
5763
+ if (getErrorCode(error) === 'ENOENT') {
5764
+ log_1.log.debug(`listMainDialogIds: Directory disappeared while scanning ${dirPath}`, undefined, {
5765
+ status,
5766
+ dirPath,
5767
+ });
5768
+ return;
5769
+ }
5711
5770
  log_1.log.warn(`listMainDialogIds: Error reading directory ${dirPath}:`, error);
5712
5771
  return;
5713
5772
  }
@@ -5868,6 +5927,13 @@ class DialogPersistence {
5868
5927
  entries = await fs.promises.readdir(dirPath, { withFileTypes: true });
5869
5928
  }
5870
5929
  catch (err) {
5930
+ if (getErrorCode(err) === 'ENOENT') {
5931
+ log_1.log.debug(`🔍 listAllDialogIds: Directory disappeared while scanning ${dirPath}`, undefined, {
5932
+ status,
5933
+ dirPath,
5934
+ });
5935
+ return;
5936
+ }
5871
5937
  // This is an environment/filesystem failure rather than confirmed dialog corruption. We log
5872
5938
  // loudly and keep enumeration partial instead of fabricating a quarantine target that may
5873
5939
  // not even be reachable through the same broken directory path.
@@ -32,6 +32,8 @@ const PROXY_URL_ENV_KEYS = new Set([
32
32
  'npm_config_https_proxy',
33
33
  ]);
34
34
  const IDLE_RESTART_STATE = { kind: 'idle' };
35
+ const PROCESS_START_ARGV = [...process.argv];
36
+ const PROCESS_START_EXEC_ARGV = [...process.execArgv];
35
37
  const PROCESS_START_CWD = process.cwd();
36
38
  let runtimeConfig = null;
37
39
  let latestObservation = { kind: 'unknown' };
@@ -76,7 +78,7 @@ function compareVersions(a, b) {
76
78
  function detectRunKind(mode) {
77
79
  if (mode !== 'production')
78
80
  return 'disabled';
79
- const scriptPath = (process.argv[1] ?? '').replace(/\\/g, '/');
81
+ const scriptPath = (PROCESS_START_ARGV[1] ?? '').replace(/\\/g, '/');
80
82
  if (scriptPath.includes('/_npx/') && scriptPath.includes('/node_modules/dominds/')) {
81
83
  return 'npx';
82
84
  }
@@ -111,7 +113,7 @@ async function getComparableRealPath(absPath) {
111
113
  }
112
114
  }
113
115
  function getCurrentProcessEntrypoint() {
114
- const entrypoint = process.argv[1];
116
+ const entrypoint = PROCESS_START_ARGV[1];
115
117
  if (typeof entrypoint !== 'string' || entrypoint.trim() === '') {
116
118
  throw new Error('Cannot restart Dominds because the current process entrypoint is unavailable');
117
119
  }
@@ -119,10 +121,10 @@ function getCurrentProcessEntrypoint() {
119
121
  }
120
122
  function buildCurrentProcessRestartArgs() {
121
123
  getCurrentProcessEntrypoint();
122
- return [...process.execArgv, ...process.argv.slice(1)];
124
+ return [...PROCESS_START_EXEC_ARGV, ...PROCESS_START_ARGV.slice(1)];
123
125
  }
124
126
  function buildCurrentDomindsCliArgs() {
125
- return process.argv.slice(2);
127
+ return PROCESS_START_ARGV.slice(2);
126
128
  }
127
129
  function getNpxWorkspaceDirAbs() {
128
130
  const entrypoint = getCurrentProcessEntrypoint().replace(/\\/g, '/');
@@ -683,7 +685,7 @@ async function queryLatestVersion() {
683
685
  }
684
686
  }
685
687
  async function findRunningDomindsPackageRootAbs() {
686
- const scriptPath = process.argv[1];
688
+ const scriptPath = PROCESS_START_ARGV[1];
687
689
  if (typeof scriptPath !== 'string' || scriptPath.trim() === '')
688
690
  return null;
689
691
  const scriptPathAbs = path_1.default.isAbsolute(scriptPath)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dominds",
3
- "version": "1.25.16",
3
+ "version": "1.25.18",
4
4
  "description": "Dominds CLI and aggregation shell for the LongRun AI kernel/runtime packages.",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -1,5 +1,5 @@
1
- import { e as isSymbol, c as baseFlatten, g as baseIteratee, k as keys, h as baseFindIndex, j as baseEach, l as arrayMap, m as hasPath, n as castPath, t as toKey, o as baseGet } from "./_baseUniq-CGrWBZre.js";
2
- import { aU as isObject, aC as baseRest, aV as isIterateeCall, aW as keysIn, aX as eq, aY as isArrayLike, aZ as isArray, a_ as identity, a$ as isIndex, b0 as assignValue } from "./index-r4An5YoX.js";
1
+ import { e as isSymbol, c as baseFlatten, g as baseIteratee, k as keys, h as baseFindIndex, j as baseEach, l as arrayMap, m as hasPath, n as castPath, t as toKey, o as baseGet } from "./_baseUniq-hcs024vD.js";
2
+ import { aU as isObject, aC as baseRest, aV as isIterateeCall, aW as keysIn, aX as eq, aY as isArrayLike, aZ as isArray, a_ as identity, a$ as isIndex, b0 as assignValue } from "./index-BOO_zFrI.js";
3
3
  var reWhitespace = /\s/;
4
4
  function trimmedEndIndex(string) {
5
5
  var index = string.length;
@@ -193,4 +193,4 @@ export {
193
193
  map as m,
194
194
  toFinite as t
195
195
  };
196
- //# sourceMappingURL=_basePickBy-bB-pfQPi.js.map
196
+ //# sourceMappingURL=_basePickBy-DUivPKf7.js.map