odant-work 1.0.91 → 1.0.93

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 (732) hide show
  1. package/#system/certs/russian_trusted_root_ca.pem +32 -32
  2. package/#system/mail.json.example +9 -9
  3. package/#system/package-manifest.json +635 -685
  4. package/#system/settings.json.example +3 -3
  5. package/{models/$ai → $server}/$folder/$class/$ai/class.js +11 -11
  6. package/{models/$ai/$folder/$class/$ai/handlers/pages/form/system/$handler/tabs/ai/$handler/ai.js → $server/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js} +384 -430
  7. package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +2158 -0
  8. package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +1377 -0
  9. package/$server/$folder/$class/$domain/class.js +4 -4
  10. package/$server/$folder/$class/$domain/handlers/methods/restore/$handler/class.js +5 -5
  11. package/$server/$folder/$class/$domain/readme.md +1 -1
  12. package/$server/$folder/$class/$handler/$trigger/class.js +3 -3
  13. package/$server/$folder/$class/$handler/class.js +9 -9
  14. package/$server/$folder/$class/$handler/handlers/pages/editor/$handler/class.js +5 -5
  15. package/$server/$folder/$class/$handler/readme.md +23 -23
  16. package/$server/$folder/$class/$module/$mcp/class.js +342 -0
  17. package/$server/$folder/$class/$module/$mcp/handlers/pages/form/system/mcp/$handler/class.js +158 -0
  18. package/{models/$ai/$folder/$class → $server/$folder/$class/$module}/$provider/class.js +1 -1
  19. package/{models/$ai/$folder/$class/$provider/handlers/pages/form/system/$handler/tabs/ai/$handler/ai.js → $server/$folder/$class/$module/$provider/handlers/pages/form/system/ai/$handler/class.js} +156 -166
  20. package/$server/$folder/$class/$module/$provider/readme.md +16 -0
  21. package/$server/$folder/$class/$module/class.js +7 -399
  22. package/$server/$folder/$class/$module/handlers/pages/form/system/{$handler/tabs/modules → modules}/$handler/class.js +1 -0
  23. package/$server/$folder/$class/$structure/$project/$folder/$class/$structure/$project/class.js +4 -0
  24. package/$server/$folder/$class/$structure/{$organization → $project}/$folder/$class/$structure/class.js +1 -1
  25. package/$server/$folder/$class/$structure/$project/class.js +11 -8
  26. package/$server/$folder/$class/$structure/{$organization/handlers/pages/site/$handler/site.js → $project/handlers/pages/site/$handler/class.js} +352 -365
  27. package/$server/$folder/$class/$structure/$project/readme.md +3 -11
  28. package/$server/$folder/$class/$structure/$server/handlers/methods/distro/$handler/class.js +1 -1
  29. package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/{$handler/tabs/license/$handler/license.js → license/$handler/class.js} +104 -103
  30. package/$server/$folder/$class/$structure/$server/handlers/pages/site/$handler/{site.js → class.js} +45 -30
  31. package/$server/$folder/$class/$structure/$user/class.js +2 -2
  32. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +3 -0
  33. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +3 -0
  34. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +3 -0
  35. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/{$handler/tabs/profile/$handler/profile.js → profile/$handler/class.js} +6 -2
  36. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/skills/$handler/class.js +3 -0
  37. package/$server/$folder/$class/$structure/ai/system.md +1 -1
  38. package/$server/$folder/$class/$structure/class.js +39 -1
  39. package/$server/$folder/$class/$structure/handlers/methods/archive/$handler/class.js +3 -3
  40. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +308 -5
  41. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +14 -3
  42. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/class.js +1281 -7
  43. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/readme.md +40 -40
  44. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +2216 -6
  45. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +1304 -6
  46. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +305 -5
  47. package/$server/$folder/$class/$structure/handlers/pages/form/system/{$handler/tabs/agent/$handler/agent.js → agent/$handler/class.js} +329 -320
  48. package/$server/$folder/$class/$structure/handlers/pages/form/system/{$handler/tabs/database/$handler/database.js → database/$handler/class.js} +510 -577
  49. package/$server/$folder/$class/$structure/handlers/pages/form/system/{$handler/tabs/messengers/$handler/messengers.js → messengers/$handler/class.js} +143 -144
  50. package/$server/$folder/$class/$structure/handlers/pages/form/system/modules/$handler/class.js +270 -0
  51. package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js +256 -0
  52. package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +2114 -0
  53. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/class.js +229 -4
  54. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +1 -1
  55. package/$server/$folder/$class/$structure/readme.md +4 -4
  56. package/$server/$folder/$class/ai/agents/builder.md +2 -2
  57. package/$server/$folder/$class/ai/agents/org-architect.md +5 -5
  58. package/$server/$folder/$class/ai/agents/readme.md +2 -2
  59. package/$server/$folder/$class/ai/agents/schema-validator.md +2 -2
  60. package/$server/$folder/$class/ai/config.js +19 -19
  61. package/$server/$folder/$class/ai/prompt/$method/class.js +41 -41
  62. package/$server/$folder/$class/ai/readme.md +1 -1
  63. package/$server/$folder/$class/ai/skills/accounting-design.md +1 -1
  64. package/$server/$folder/$class/ai/skills/approval-flow.md +14 -14
  65. package/$server/$folder/$class/ai/skills/backup-check.md +13 -13
  66. package/$server/$folder/$class/ai/skills/computer.md +27 -27
  67. package/$server/$folder/$class/ai/skills/data-modeling.md +1 -1
  68. package/$server/$folder/$class/ai/skills/delegate-task.md +15 -15
  69. package/$server/$folder/$class/ai/skills/external-signup.md +14 -14
  70. package/$server/$folder/$class/ai/skills/import-table.md +1 -1
  71. package/$server/$folder/$class/ai/skills/onboarding.md +15 -15
  72. package/$server/$folder/$class/ai/skills/orchestration.md +41 -41
  73. package/$server/$folder/$class/ai/skills/org-structure.md +1 -1
  74. package/$server/$folder/$class/ai/skills/work-scenarios.md +9 -9
  75. package/$server/$folder/$class/ai/system.md +36 -36
  76. package/$server/$folder/$class/class.js +0 -3
  77. package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +3 -0
  78. package/$server/$folder/$class/handlers/pages/form/system/$handler/class.js +2 -4
  79. package/$server/$folder/$class/handlers/pages/form/system/{$handler/tabs/files → files}/$handler/class.js +2 -0
  80. package/$server/$folder/$class/handlers/pages/form/system/{$handler/tabs/requisites/$handler/requisites.js → requisites/$handler/class.js} +43 -36
  81. package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +25 -6
  82. package/$server/$folder/$file/$audio/handlers/preview/$handler/class.js +3 -3
  83. package/$server/$folder/$file/$audio/handlers/preview/$handler/preview.js +88 -88
  84. package/$server/$folder/$file/$call/class.js +10 -10
  85. package/$server/$folder/$file/$call/handlers/preview/$handler/class.js +4 -4
  86. package/$server/$folder/$file/$call/triggers/on_save/$trigger/class.js +48 -48
  87. package/$server/$folder/$file/$data/class.js +16 -16
  88. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +31 -4
  89. package/$server/$folder/$file/$devs/$js/class.js +2 -2
  90. package/$server/$folder/$file/$devs/$json/class.js +2 -2
  91. package/$server/$folder/$file/$devs/$ts/class.js +2 -2
  92. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +30 -2
  93. package/$server/$folder/$file/$eml/class.js +17 -17
  94. package/$server/$folder/$file/$ics/class.js +44 -44
  95. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +10 -2
  96. package/$server/$folder/$file/$ics/handlers/preview/$handler/class.js +3 -3
  97. package/$server/$folder/$file/$ics/handlers/preview/$handler/preview.js +67 -67
  98. package/$server/$folder/$file/$ics/readme.md +21 -21
  99. package/$server/$folder/$file/$image/$svg/class.js +11 -11
  100. package/$server/$folder/$file/$image/handlers/preview/$handler/class.js +3 -3
  101. package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +33 -33
  102. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +82 -2
  103. package/$server/$folder/$file/$logs/class.js +39 -39
  104. package/$server/$folder/$file/$logs/handlers/methods/txt-test/$handler/class.js +4 -4
  105. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +60 -2
  106. package/$server/$folder/$file/$office/$outlook/$ics/class.js +227 -227
  107. package/$server/$folder/$file/$office/$word/$rtf/template.rtf +159 -159
  108. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/class.js +1699 -2
  109. package/$server/$folder/$file/$task/class.js +2 -2
  110. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +827 -2
  111. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/readme.md +2 -2
  112. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +17 -0
  113. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/panel.js +7 -1
  114. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/util.js +1 -0
  115. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-policy.js +6 -2
  116. package/$server/$folder/$file/$task/handlers/preview/$handler/class.js +3 -3
  117. package/$server/$folder/$file/$task/readme.md +32 -32
  118. package/$server/$folder/$file/$txt/handlers/preview/$handler/class.js +3 -3
  119. package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +41 -41
  120. package/$server/$folder/$file/$video/handlers/preview/$handler/class.js +4 -4
  121. package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +13 -13
  122. package/$server/$folder/$file/class.js +2 -2
  123. package/$server/$folder/$file/handlers/methods/download/$handler/class.js +2 -2
  124. package/$server/$folder/$file/handlers/methods/download/$handler/download.js +4 -4
  125. package/$server/$folder/$file/handlers/pages/form/$handler/class.js +2 -2
  126. package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +32 -2
  127. package/$server/$folder/$file/handlers/pages/form/folder/$handler/class.js +3 -0
  128. package/$server/$folder/$file/readme.md +31 -31
  129. package/$server/$folder/class.js +11 -11
  130. package/$server/$folder/handlers/methods/create/$handler/class.js +35 -38
  131. package/$server/$folder/handlers/pages/form/$handler/class.js +2469 -5
  132. package/$server/$folder/handlers/pages/form/folder/$handler/class.js +22 -0
  133. package/$server/$folder/handlers/readme.md +1 -1
  134. package/$server/$folder/lib/chat-item/chat-item.js +4 -4
  135. package/$server/$folder/lib/class-picker/class-picker.js +8 -5
  136. package/$server/$folder/lib/consultant/consultant.js +5 -5
  137. package/$server/$folder/lib/email/settings.js +82 -82
  138. package/$server/$folder/lib/file-viewer/file-viewer.js +8 -8
  139. package/$server/$folder/lib/icon/icon.js +1 -1
  140. package/$server/$folder/lib/icon/user/user.js +6 -6
  141. package/$server/$folder/lib/item-data-grid/item-data-grid.js +48 -48
  142. package/$server/$folder/lib/item-data-grid/readme.md +1 -1
  143. package/$server/$folder/lib/item-form/item-form.js +84 -84
  144. package/$server/$folder/lib/item-form/readme.md +1 -1
  145. package/$server/$folder/lib/local-models-transfer/local-models-transfer.js +11 -11
  146. package/$server/$folder/lib/menu/menu.js +3 -2
  147. package/$server/$folder/lib/menu/readme.md +29 -29
  148. package/$server/$folder/lib/messenger-settings/messenger-settings.js +2 -2
  149. package/$server/$folder/lib/node/node.js +62 -25
  150. package/$server/$folder/lib/node/readme.md +29 -29
  151. package/$server/$folder/lib/pack/pack.js +4 -4
  152. package/$server/$folder/lib/prompt-bar/prompt-bar.js +2 -2
  153. package/$server/$folder/lib/site-loc/readme.md +16 -16
  154. package/$server/$folder/lib/site-loc/site-loc.js +3 -3
  155. package/$server/$folder/lib/tree/tree.js +62 -29
  156. package/.github/workflows/ci.yml +39 -39
  157. package/AGENTS.md +6 -6
  158. package/MODULES/$domain/$folder/$class/$module/class.js +5 -6
  159. package/MODULES/$domain/class.js +8 -31
  160. package/MODULES/$domain/handlers/pages/form/system/mcp/$handler/class.js +389 -0
  161. package/MODULES/$domain/readme.md +2 -2
  162. package/MODULES/MCP/.gitkeep +0 -0
  163. package/MODULES/{DaData → /320/224/320/260/320/275/320/275/321/213/320/265/DaData}/$module/class.js +2 -2
  164. package/MODULES/{Geo → /320/224/320/260/320/275/320/275/321/213/320/265/Geo}/$module/readme.md +1 -1
  165. package/MODULES/{Geo → /320/224/320/260/320/275/320/275/321/213/320/265/Geo}//320/223/320/265/320/276/321/202/320/276/321/207/320/272/320/270/$catalog/class.js +1 -1
  166. package/MODULES/{Geo → /320/224/320/260/320/275/320/275/321/213/320/265/Geo}//320/232/320/260/321/200/321/202/320/260/$catalog/class.js +2 -2
  167. package/MODULES/{Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/map.js → /320/224/320/260/320/275/320/275/321/213/320/265/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js} +295 -266
  168. package/MODULES/{KLADR/$module/handlers/pages/form/kladr/$handler/kladr.js → /320/224/320/260/320/275/320/275/321/213/320/265/KLADR/$module/handlers/pages/form/kladr/$handler/class.js} +32 -25
  169. package/MODULES/{KLADR → /320/224/320/260/320/275/320/275/321/213/320/265/KLADR}//320/235/320/260/321/201/320/265/320/273/321/221/320/275/320/275/321/213/320/265 /320/277/321/203/320/275/320/272/321/202/321/213/$catalog/class.js" +1 -1
  170. package/MODULES/{KLADR → /320/224/320/260/320/275/320/275/321/213/320/265/KLADR}//320/243/320/273/320/270/321/206/321/213/$catalog/class.js +1 -1
  171. package/MODULES/{1C → /320/232/320/276/320/275/320/275/320/265/320/272/321/202/320/276/321/200/321/213/1C}/$module/class.js +1 -1
  172. package/MODULES/{Bitrix24 → /320/232/320/276/320/275/320/275/320/265/320/272/321/202/320/276/321/200/321/213/Bitrix24}/$module/class.js +1 -1
  173. package/MODULES/{YandexDisk → /320/232/320/276/320/275/320/275/320/265/320/272/321/202/320/276/321/200/321/213/YandexDisk}/$module/class.js +1 -1
  174. package/MODULES/{Marketplaces/Ozon/$module → /320/234/320/260/321/200/320/272/320/265/321/202/320/277/320/273/320/265/320/271/321/201/321/213/Ozon/$mcp}/class.js +1 -1
  175. package/MODULES/{Marketplaces/Wildberries/$module → /320/234/320/260/321/200/320/272/320/265/321/202/320/277/320/273/320/265/320/271/321/201/321/213/Wildberries/$mcp}/class.js +1 -1
  176. package/MODULES/{Marketplaces/YandexMarket/$module → /320/234/320/260/321/200/320/272/320/265/321/202/320/277/320/273/320/265/320/271/321/201/321/213/YandexMarket/$mcp}/class.js +1 -1
  177. package/{models → MODULES//320/234/320/276/320/264/320/265/320/273/320/270}/GigaChat/$provider/readme.md +24 -24
  178. package/{models → MODULES//320/234/320/276/320/264/320/265/320/273/320/270}/Local/$provider/$folder/$class/$ai/class.js +1 -1
  179. package/{models → MODULES//320/234/320/276/320/264/320/265/320/273/320/270}/Local/$provider/class.js +1 -1
  180. package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/ai/$handler/class.js +3 -0
  181. package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/models/$handler/class.js +1242 -0
  182. package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/training/$handler/class.js +244 -0
  183. package/MODULES/{Process/$module/readme.md → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Process/$module/readme.md" } +1 -1
  184. package/MODULES/{Process → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Process}//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/class.js" +3 -3
  185. package/MODULES/{Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/gantt.js" → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/class.js" } +106 -93
  186. package/MODULES/{Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/scheduler.js" → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/class.js" } +79 -71
  187. package/MODULES/{Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/bpmn.js" → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/class.js" } +297 -185
  188. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/objects/$handler/class.js" +3 -0
  189. package/MODULES/{Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/virtual/$handler/virtual.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/virtual/$handler/class.js" } +413 -390
  190. package/MODULES/{Register/CATALOGS/$catalog/readme.md → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS/$catalog/readme.md" } +1 -1
  191. package/MODULES/{Register/CATALOGS//320/224/320/276/320/263/320/276/320/262/320/276/321/200/321/213/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/224/320/276/320/263/320/276/320/262/320/276/321/200/321/213/$catalog/class.js" } +1 -1
  192. package/MODULES/{Register/CATALOGS//320/232/320/273/320/270/320/265/320/275/321/202/321/213/$virtual/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/232/320/273/320/270/320/265/320/275/321/202/321/213/$virtual/class.js" } +2 -2
  193. package/MODULES/{Register/CATALOGS//320/235/320/276/320/274/320/265/320/275/320/272/320/273/320/260/321/202/321/203/321/200/320/260/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/235/320/276/320/274/320/265/320/275/320/272/320/273/320/260/321/202/321/203/321/200/320/260/$catalog/class.js" } +1 -1
  194. package/MODULES/{Register/CATALOGS//320/237/320/260/321/200/321/202/320/270/320/270/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/237/320/260/321/200/321/202/320/270/320/270/$catalog/class.js" } +2 -2
  195. package/MODULES/{Register/CATALOGS//320/237/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/320/270/$virtual/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/237/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/320/270/$virtual/class.js" } +1 -1
  196. package/MODULES/{Register/CATALOGS//320/241/320/272/320/273/320/260/320/264/321/213/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/241/320/272/320/273/320/260/320/264/321/213/$catalog/class.js" } +2 -2
  197. package/MODULES/{Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/$folder/$class/$data/$catalog/$virtual/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/$folder/$class/$data/$catalog/$virtual/class.js" } +2 -2
  198. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270//320/222 /320/276/321/202/320/277/321/203/321/201/320/272/320/265/$virtual/class.js" +1 -1
  199. package/MODULES/{Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/$folder/$class/$data/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/$folder/$class/$data/$catalog/class.js" } +2 -2
  200. package/MODULES/{Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/230/320/237/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/230/320/237/$catalog/class.js" } +2 -2
  201. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/244/320/270/320/267. /320/273/320/270/321/206/320/260/$catalog/class.js" +2 -2
  202. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/256/321/200. /320/273/320/270/321/206/320/260/$catalog/class.js" +2 -2
  203. package/MODULES/{Register/CATALOGS//320/242/321/200/320/260/320/275/321/201/320/277/320/276/321/200/321/202/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS//320/242/321/200/320/260/320/275/321/201/320/277/320/276/321/200/321/202/$catalog/class.js" } +2 -2
  204. package/MODULES/{Register/OPERATIONS/$operation/readme.md → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS/$operation/readme.md" } +1 -1
  205. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/224/320/276/321/201/321/202/320/260/320/262/320/272/320/260/$operation/class.js" +22 -0
  206. package/MODULES/{Register/OPERATIONS//320/227/320/260/321/200/320/277/320/273/320/260/321/202/320/260/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/227/320/260/321/200/320/277/320/273/320/260/321/202/320/260/$operation/class.js" } +7 -7
  207. package/MODULES/{Register/OPERATIONS//320/230/320/275/320/262/320/265/320/275/321/202/320/260/321/200/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/230/320/275/320/262/320/265/320/275/321/202/320/260/321/200/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js" } +9 -9
  208. package/MODULES/{Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/$folder/$class/$data/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/$folder/$class/$data/$operation/class.js" } +1 -1
  209. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/222/320/265/321/200/320/275/321/203/321/202/321/214 /320/270/320/267 /320/276/321/202/320/277/321/203/321/201/320/272/320/260/$operation/class.js" +14 -0
  210. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/236/321/202/320/277/321/200/320/260/320/262/320/270/321/202/321/214 /320/262 /320/276/321/202/320/277/321/203/321/201/320/272/$operation/class.js" +15 -0
  211. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/237/321/200/320/270/321/221/320/274 /320/275/320/260 /321/200/320/260/320/261/320/276/321/202/321/203/$operation/class.js" +3 -3
  212. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/243/320/262/320/276/320/273/321/214/320/275/320/265/320/275/320/270/320/265/$operation/class.js" +14 -0
  213. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/220/320/262/320/260/320/275/321/201/320/276/320/262/321/213/320/271 /320/276/321/202/321/207/321/221/321/202/$operation/class.js" +17 -0
  214. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/237/320/232/320/236/$operation/class.js" +18 -0
  215. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/240/320/232/320/236/$operation/class.js" +17 -0
  216. package/MODULES/{Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/$folder/$class/$data/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/$folder/$class/$data/$operation/class.js" } +1 -1
  217. package/MODULES/{Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270//320/227/320/262/320/276/320/275/320/276/320/272/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270//320/227/320/262/320/276/320/275/320/276/320/272/$operation/class.js" } +2 -2
  218. package/MODULES/{Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270//320/237/320/270/321/201/321/214/320/274/320/276/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270//320/237/320/270/321/201/321/214/320/274/320/276/$operation/class.js" } +2 -2
  219. package/MODULES/{Register/OPERATIONS//320/232/320/276/320/274/320/277/320/273/320/265/320/272/321/202/320/260/321/206/320/270/321/217/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/232/320/276/320/274/320/277/320/273/320/265/320/272/321/202/320/260/321/206/320/270/321/217/$operation/class.js" } +14 -14
  220. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/235/320/260/321/207/320/270/321/201/320/273/320/265/320/275/320/270/320/265 /320/260/320/274/320/276/321/200/321/202/320/270/320/267/320/260/321/206/320/270/320/270/$operation/class.js" +3 -3
  221. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/320/265 /320/236/320/241/$operation/class.js" +30 -0
  222. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/237/321/200/320/270/320/275/321/217/321/202/320/270/320/265 /320/272 /321/203/321/207/321/221/321/202/321/203 /320/236/320/241/$operation/class.js" +3 -3
  223. package/MODULES/{Register/OPERATIONS//320/237/320/265/321/200/320/265/320/274/320/265/321/211/320/265/320/275/320/270/320/265/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/237/320/265/321/200/320/265/320/274/320/265/321/211/320/265/320/275/320/270/320/265/$operation/class.js" } +7 -7
  224. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/$folder/$class/$data/$operation/class.js" +1 -1
  225. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/227/320/260/321/200/320/277/320/273/320/260/321/202/320/260/$operation/class.js" +8 -0
  226. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/235/320/224/320/241/$operation/class.js" +1 -1
  227. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/235/320/224/320/244/320/233/$operation/class.js" +1 -1
  228. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/237/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/321/203/$operation/class.js" +11 -0
  229. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/241/321/202/321/200/320/260/321/205/320/276/320/262/321/213/320/265 /320/262/320/267/320/275/320/276/321/201/321/213/$operation/class.js" +1 -1
  230. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/320/265 /321/202/320/276/320/262/320/260/321/200/320/260/$operation/class.js" +9 -9
  231. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/$folder/$class/$data/$operation/class.js" +1 -1
  232. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202//320/222/320/276/320/267/320/262/321/200/320/260/321/202 /320/276/321/202 /320/277/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/320/260/$operation/class.js" +11 -0
  233. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202//320/236/321/202 /320/277/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/217/$operation/class.js" +11 -0
  234. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/222/321/213/320/277/321/203/321/201/320/272 /320/263/320/276/321/202/320/276/320/262/320/276/320/271 /320/277/321/200/320/276/320/264/321/203/320/272/321/206/320/270/320/270/$operation/class.js" +4 -4
  235. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/237/320/265/321/200/320/265/320/264/320/260/321/207/320/260 /320/274/320/260/321/202/320/265/321/200/320/270/320/260/320/273/320/276/320/262 /320/262 /320/277/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276/$operation/class.js" +4 -4
  236. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/241/320/277/320/270/321/201/320/260/320/275/320/270/320/265 /320/276/320/261/321/211/320/265/321/205/320/276/320/267/321/217/320/271/321/201/321/202/320/262/320/265/320/275/320/275/321/213/321/205 /320/267/320/260/321/202/321/200/320/260/321/202/$operation/class.js" +6 -6
  237. package/MODULES/{Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/$folder/$class/$data/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/$folder/$class/$data/$operation/class.js" } +5 -5
  238. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/222/320/276/320/267/320/262/321/200/320/260/321/202 /320/276/321/202 /320/277/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/217/$operation/class.js" +32 -0
  239. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/class.js" +32 -0
  240. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/241/321/207/321/221/321/202 /320/275/320/260 /320/276/320/277/320/273/320/260/321/202/321/203.html" +40 -40
  241. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/242/320/276/320/262/320/260/321/200/320/275/320/260/321/217 /320/275/320/260/320/272/320/273/320/260/320/264/320/275/320/260/321/217.html" +56 -56
  242. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/241/320/277/320/270/321/201/320/260/320/275/320/270/320/265 /320/242/320/234/320/246/$operation/class.js" +6 -6
  243. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/243/321/201/321/202/320/260/320/275/320/276/320/262/320/272/320/260 /320/275/320/276/321/200/320/274/320/260/321/202/320/270/320/262/320/260/$operation/class.js" +4 -4
  244. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/244/320/270/320/275/320/260/320/275/321/201/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/321/203/320/273/321/214/321/202/320/260/321/202//320/227/320/260/320/272/321/200/321/213/321/202/320/270/320/265 /320/274/320/265/321/201/321/217/321/206/320/260/$operation/class.js" +2 -2
  245. package/MODULES/{Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/analysis/$handler/analysis.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/analysis/$handler/class.js" } +9 -4
  246. package/MODULES/{Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/postings/$handler/postings.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/postings/$handler/class.js" } +845 -753
  247. package/MODULES/{Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/turnovers/$handler/turnovers.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/turnovers/$handler/class.js" } +9 -4
  248. package/MODULES/{Register/REGISTER/$register/$folder/$class/$data/$register/$account/readme.md → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/$folder/$class/$data/$register/$account/readme.md" } +1 -1
  249. package/MODULES/{Register/REGISTER/$register/ai/skills/register-accounts.md → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/ai/skills/register-accounts.md" } +1 -1
  250. package/MODULES/{Register/REGISTER/$register/handlers/pages/form/journal/$handler/journal.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/handlers/pages/form/journal/$handler/class.js" } +382 -329
  251. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/class.js" +807 -0
  252. package/MODULES/{Register/REGISTER/$register/readme.md → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/readme.md" } +1 -1
  253. package/MODULES/{Register/REGISTER/01/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/01/$account/class.js" } +1 -1
  254. package/MODULES/{Register/REGISTER/02/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/02/$account/class.js" } +1 -1
  255. package/MODULES/{Register/REGISTER/04/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/04/$account/class.js" } +1 -1
  256. package/MODULES/{Register/REGISTER/08/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/08/$account/class.js" } +1 -1
  257. package/MODULES/{Register/REGISTER/10/$account/$folder/$class/$data/$register/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/10/$account/$folder/$class/$data/$register/$account/class.js" } +2 -2
  258. package/MODULES/{Register/REGISTER/10/01/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/10/01/$account/class.js" } +1 -1
  259. package/MODULES/{Register/REGISTER/10/05/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/10/05/$account/class.js" } +1 -1
  260. package/MODULES/{Register/REGISTER/41/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/41/$account/class.js" } +3 -3
  261. package/MODULES/{Register/REGISTER/43/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/43/$account/class.js" } +2 -2
  262. package/MODULES/{Register/REGISTER/44/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/44/$account/class.js" } +1 -1
  263. package/MODULES/{Register/REGISTER/60/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/60/$account/class.js" } +2 -2
  264. package/MODULES/{Register/REGISTER/62/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/62/$account/class.js" } +2 -2
  265. package/MODULES/{Register/REGISTER/68/01/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/68/01/$account/class.js" } +1 -1
  266. package/MODULES/{Register/REGISTER/68/02/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/68/02/$account/class.js" } +1 -1
  267. package/MODULES/{Register/REGISTER/70/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/70/$account/class.js" } +1 -1
  268. package/MODULES/{Register/REGISTER/71/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/71/$account/class.js" } +1 -1
  269. package/MODULES/{Register/REGISTER/73/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/73/$account/class.js" } +1 -1
  270. package/MODULES/{Register/REGISTER/76/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/76/$account/class.js" } +1 -1
  271. package/MODULES/{Register/REGISTER/90/01/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/90/01/$account/class.js" } +1 -1
  272. package/MODULES/{Register/REGISTER/90/02/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/90/02/$account/class.js" } +1 -1
  273. package/MODULES/{Register/REGISTER/90/03/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/90/03/$account/class.js" } +1 -1
  274. package/MODULES/{Register/REGISTER/91/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/91/$account/class.js" } +1 -1
  275. package/MODULES/{Register/REGISTER/94/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/94/$account/class.js" } +2 -2
  276. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/REGISTER//320/232/320/260/320/264/321/200/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/320/265/321/200/320/262/$account/class.js" +1 -1
  277. package/MODULES/{Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/$folder/$class/$data/$register/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/$folder/$class/$data/$register/$account/class.js" } +1 -1
  278. package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/REGISTER//320/232/320/260/320/264/321/200/321/213//320/222 /320/276/321/202/320/277/321/203/321/201/320/272/320/265/$account/class.js" +1 -1
  279. package/MODULES/{Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/240/320/260/320/261/320/276/321/202/320/260/321/216/321/202/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/240/320/260/320/261/320/276/321/202/320/260/321/216/321/202/$account/class.js" } +1 -1
  280. package/MODULES/{Register/REGISTER//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$account/class.js" } +1 -1
  281. package/MODULES/{Register/REGISTER//320/235/320/276/321/200/320/274/320/260/321/202/320/270/320/262/321/213/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER//320/235/320/276/321/200/320/274/320/260/321/202/320/270/320/262/321/213/$account/class.js" } +2 -2
  282. package/MODULES/{Register/REGISTER//320/242/320/265/321/205/320/275/320/270/321/207/320/265/321/201/320/272/320/270/320/271/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER//320/242/320/265/321/205/320/275/320/270/321/207/320/265/321/201/320/272/320/270/320/271/$account/class.js" } +1 -1
  283. package/MODULES/{Register/STRUCTS/$struct/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/STRUCTS/$struct/class.js" } +4 -4
  284. package/MODULES/{Register/STRUCTS//320/237/320/260/321/201/320/277/320/276/321/200/321/202/$struct/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/STRUCTS//320/237/320/260/321/201/320/277/320/276/321/200/321/202/$struct/class.js" } +2 -2
  285. package/NODES/$node/$folder/$class/$node/class.js +35 -35
  286. package/NODES/$node/class.js +5 -5
  287. package/NODES/$node/handlers/pages/form/network/$handler/class.js +121 -4
  288. package/PROJECTS/$domain/$folder/$class/$structure/$project/class.js +1 -2
  289. package/PROJECTS/$domain/readme.md +1 -1
  290. package/oda/benchmarks/dbmon/lib/ENV.js +213 -213
  291. package/oda/benchmarks/dbmon/lib/ga.js +11 -11
  292. package/oda/benchmarks/dbmon/lib/memory-stats.js +105 -105
  293. package/oda/benchmarks/dbmon/lib/monitor.js +69 -69
  294. package/oda/benchmarks/sierpinski/sierpinski.js +149 -149
  295. package/oda/components/editors/code-editor/code-editor.js +387 -387
  296. package/oda/components/editors/code-editor/src/ace.js +16 -16
  297. package/oda/components/editors/code-editor/src/beautify-css.js +1625 -1625
  298. package/oda/components/editors/code-editor/src/beautify-html.js +3122 -3122
  299. package/oda/components/editors/code-editor/src/beautify.js +4005 -4005
  300. package/oda/components/editors/code-editor/src/ext-beautify.js +7 -7
  301. package/oda/components/editors/code-editor/src/ext-code_lens.js +7 -7
  302. package/oda/components/editors/code-editor/src/ext-elastic_tabstops_lite.js +7 -7
  303. package/oda/components/editors/code-editor/src/ext-emmet.js +7 -7
  304. package/oda/components/editors/code-editor/src/ext-error_marker.js +7 -7
  305. package/oda/components/editors/code-editor/src/ext-hardwrap.js +7 -7
  306. package/oda/components/editors/code-editor/src/ext-keybinding_menu.js +7 -7
  307. package/oda/components/editors/code-editor/src/ext-language_tools.js +7 -7
  308. package/oda/components/editors/code-editor/src/ext-linking.js +7 -7
  309. package/oda/components/editors/code-editor/src/ext-modelist.js +7 -7
  310. package/oda/components/editors/code-editor/src/ext-options.js +7 -7
  311. package/oda/components/editors/code-editor/src/ext-prompt.js +7 -7
  312. package/oda/components/editors/code-editor/src/ext-rtl.js +7 -7
  313. package/oda/components/editors/code-editor/src/ext-searchbox.js +7 -7
  314. package/oda/components/editors/code-editor/src/ext-settings_menu.js +7 -7
  315. package/oda/components/editors/code-editor/src/ext-spellcheck.js +7 -7
  316. package/oda/components/editors/code-editor/src/ext-split.js +7 -7
  317. package/oda/components/editors/code-editor/src/ext-static_highlight.js +7 -7
  318. package/oda/components/editors/code-editor/src/ext-statusbar.js +7 -7
  319. package/oda/components/editors/code-editor/src/ext-textarea.js +7 -7
  320. package/oda/components/editors/code-editor/src/ext-themelist.js +7 -7
  321. package/oda/components/editors/code-editor/src/ext-whitespace.js +7 -7
  322. package/oda/components/editors/code-editor/src/keybinding-emacs.js +7 -7
  323. package/oda/components/editors/code-editor/src/keybinding-sublime.js +7 -7
  324. package/oda/components/editors/code-editor/src/keybinding-vim.js +7 -7
  325. package/oda/components/editors/code-editor/src/keybinding-vscode.js +7 -7
  326. package/oda/components/editors/code-editor/src/mode-css.js +7 -7
  327. package/oda/components/editors/code-editor/src/mode-html.js +7 -7
  328. package/oda/components/editors/code-editor/src/mode-javascript.js +7 -7
  329. package/oda/components/editors/code-editor/src/mode-json.js +7 -7
  330. package/oda/components/editors/code-editor/src/mode-markdown.js +7 -7
  331. package/oda/components/editors/code-editor/src/mode-svg.js +7 -7
  332. package/oda/components/editors/code-editor/src/mode-text.js +7 -7
  333. package/oda/components/editors/code-editor/src/mode-xml.js +7 -7
  334. package/oda/components/editors/code-editor/src/mode-xquery.js +7 -7
  335. package/oda/components/editors/code-editor/src/snippets/css.js +7 -7
  336. package/oda/components/editors/code-editor/src/snippets/html.js +7 -7
  337. package/oda/components/editors/code-editor/src/snippets/javascript.js +7 -7
  338. package/oda/components/editors/code-editor/src/snippets/json.js +7 -7
  339. package/oda/components/editors/code-editor/src/snippets/markdown.js +7 -7
  340. package/oda/components/editors/code-editor/src/snippets/svg.js +7 -7
  341. package/oda/components/editors/code-editor/src/snippets/text.js +7 -7
  342. package/oda/components/editors/code-editor/src/snippets/xml.js +7 -7
  343. package/oda/components/editors/code-editor/src/snippets/xquery.js +7 -7
  344. package/oda/components/editors/code-editor/src/theme-solarized_dark.js +7 -7
  345. package/oda/components/editors/code-editor/src/theme-solarized_light.js +7 -7
  346. package/oda/components/editors/markdown/markdown-editor/lib/font-awesome.min.css +3 -3
  347. package/oda/components/editors/markdown/markdown-editor/lib/readme.md +332 -332
  348. package/oda/components/editors/markdown/markdown-editor/markdown-editor.js +78 -78
  349. package/oda/components/editors/markdown/markdown-viewer/test.md +239 -239
  350. package/oda/components/editors/markdown/markdown.js +76 -76
  351. package/oda/components/inputs/block/readme.md +39 -39
  352. package/oda/components/inputs/checkbox/checkbox.js +92 -92
  353. package/oda/components/inputs/color/color.js +83 -83
  354. package/oda/components/inputs/date/date.js +40 -40
  355. package/oda/components/inputs/input/input.js +219 -219
  356. package/oda/components/inputs/link/link.js +1 -1
  357. package/oda/components/inputs/link/readme.md +42 -42
  358. package/oda/components/inputs/markdown-input/markdown-input.js +77 -77
  359. package/oda/components/inputs/numeric/numeric.js +141 -141
  360. package/oda/components/inputs/table-input/readme.md +39 -39
  361. package/oda/components/inputs/text/text.js +88 -88
  362. package/oda/components/inputs/toggle/toggle.js +101 -101
  363. package/oda/components/layouts/hexagon-layout/hexagon-layout.js +218 -218
  364. package/oda/components/menus/menu/index_old.html +140 -140
  365. package/oda/components/structure/controls-map.js +56 -56
  366. package/oda/components/structure/controls.js +29 -29
  367. package/oda/components/structure/readme.md +31 -31
  368. package/oda/components/structure/structure.js +64 -64
  369. package/oda/components/table/index.html +210 -210
  370. package/oda/components/table/lib/coerce.js +68 -68
  371. package/oda/components/table/lib/column.js +568 -568
  372. package/oda/components/table/readme.md +120 -120
  373. package/oda/components/table/router.js +86 -86
  374. package/oda/components/table/settings.js +89 -89
  375. package/oda/index.html +159 -159
  376. package/oda/tools/icons/icons-set/icons-set.js +60 -60
  377. package/oda/tools/icons/lib/svg/_makeSVG.html +41 -41
  378. package/oda/tools/icons/lib/svg/aws.svg +2679 -2679
  379. package/oda/tools/icons/lib/svg/info.json +46 -46
  380. package/oda/tools/jupyter/demo.ipynb +160 -160
  381. package/oda/tools/jupyter/lib/print_elements.js +73 -73
  382. package/oda/tools/jupyter/test-2.ipynb +305 -305
  383. package/oda/tools/jupyter/test.ipynb +603 -603
  384. package/oda/tools/styles/adoptedStyleSheets.js +333 -333
  385. package/oda/tools/tester/device-preview/devices.json +9 -9
  386. package/package.json +1 -1
  387. package/rules/rules.md +445 -445
  388. package/scripts/SYNC-README.md +107 -107
  389. package/scripts/agent-eval.mjs +223 -223
  390. package/scripts/check-architecture.mjs +25 -16
  391. package/scripts/check-ignored-code.mjs +4 -4
  392. package/scripts/demo-seed.mjs +7 -7
  393. package/scripts/dump-svn-chat.mjs +9 -9
  394. package/scripts/extract-chat-day.mjs +21 -21
  395. package/scripts/import-bis.mjs +133 -133
  396. package/scripts/import-delovaya.mjs +94 -94
  397. package/scripts/migrate-tree.mjs +454 -0
  398. package/scripts/rag-bench.mjs +166 -166
  399. package/scripts/restore-chat.mjs +166 -166
  400. package/scripts/sync-svn-git.bat +129 -129
  401. package/scripts/test-merge.mjs +75 -75
  402. package/scripts/work-desktop-bridge.mjs +101 -101
  403. package/sources/client/class.js +3 -0
  404. package/sources/client/field.js +168 -168
  405. package/sources/client/handler.js +68 -32
  406. package/sources/client/index.js +32 -32
  407. package/sources/client/readme.md +16 -16
  408. package/sources/client.js +12 -0
  409. package/sources/core.js +91 -91
  410. package/sources/data/api.js +5 -5
  411. package/sources/data/choices.js +125 -125
  412. package/sources/data/classes.js +3 -3
  413. package/sources/data/db.js +5 -6
  414. package/sources/data/print.js +2 -2
  415. package/sources/data/schema.js +5 -5
  416. package/sources/data/sql-inspector.js +8 -8
  417. package/sources/host/auto-updater.js +6 -10
  418. package/sources/host/babel-merge.js +398 -353
  419. package/sources/host/config.js +48 -48
  420. package/sources/host/index-db.js +94 -94
  421. package/sources/host/net-guard.js +228 -228
  422. package/sources/host/package-install.js +63 -63
  423. package/sources/host/push.js +86 -86
  424. package/sources/host/readme.md +41 -41
  425. package/sources/host/secret-box.js +93 -93
  426. package/sources/host/server-id.js +26 -26
  427. package/sources/host/stun.js +33 -33
  428. package/sources/host/tls-ca.js +60 -60
  429. package/sources/host/vapid.js +14 -14
  430. package/sources/host/watch.js +1 -1
  431. package/sources/index.html +1 -1
  432. package/sources/modules/a2a/server.js +608 -608
  433. package/sources/modules/agent/connections.js +442 -442
  434. package/sources/modules/agent/diff.js +69 -69
  435. package/sources/modules/agent/eval.js +222 -222
  436. package/sources/modules/agent/extensions.js +57 -30
  437. package/sources/modules/agent/hooks.js +131 -131
  438. package/sources/modules/agent/index.js +14 -11
  439. package/sources/modules/agent/log.js +43 -43
  440. package/sources/modules/agent/loop.js +65 -0
  441. package/sources/modules/agent/mcp-pool.js +253 -253
  442. package/sources/modules/agent/node-rules.js +100 -51
  443. package/sources/modules/agent/permissions.js +1 -1
  444. package/sources/modules/agent/plugins.js +4 -3
  445. package/sources/modules/agent/recovery.js +89 -89
  446. package/sources/modules/agent/scope.js +387 -0
  447. package/sources/modules/agent/session.js +350 -15
  448. package/sources/modules/agent/taint.js +100 -100
  449. package/sources/modules/agent/tools/branch.js +311 -311
  450. package/sources/modules/agent/tools/browser.js +254 -254
  451. package/sources/modules/agent/tools/computer.js +120 -120
  452. package/sources/modules/agent/tools/connect.js +316 -316
  453. package/sources/modules/agent/tools/dev/lsp.js +334 -334
  454. package/sources/modules/agent/tools/dev/patch.js +564 -564
  455. package/sources/modules/agent/tools/memory.js +153 -153
  456. package/sources/modules/agent/tools/meta.js +61 -1
  457. package/sources/modules/agent/tools/os-files.js +358 -358
  458. package/sources/modules/agent/tools/plugins.js +80 -80
  459. package/sources/modules/agent/tools/sandbox.js +268 -268
  460. package/sources/modules/agent/tools/services.js +8 -2
  461. package/sources/modules/agent/tools/work/access.js +5 -5
  462. package/sources/modules/agent/tools/work/classes.js +24 -8
  463. package/sources/modules/agent/tools/work/common.js +6 -6
  464. package/sources/modules/agent/tools/work/data.js +2 -2
  465. package/sources/modules/agent/triggers.js +2 -2
  466. package/sources/modules/agent/twin-bus.js +5 -5
  467. package/sources/modules/agent/types.d.ts +183 -183
  468. package/sources/modules/agent/undo.js +254 -254
  469. package/sources/modules/agent/util.js +179 -179
  470. package/sources/modules/agent/voice.js +9 -9
  471. package/sources/modules/contacts/contacts.js +200 -200
  472. package/sources/modules/contacts/index.html +546 -546
  473. package/sources/modules/kladr/index.js +4 -5
  474. package/sources/modules/lan/discovery.js +192 -192
  475. package/sources/modules/lan/store.js +62 -62
  476. package/sources/modules/license/index.js +5 -5
  477. package/sources/modules/mcp/readme.md +70 -70
  478. package/sources/modules/mcp/server.js +525 -525
  479. package/sources/modules/mcp/tokens.js +140 -140
  480. package/sources/modules/nodes/identity.js +123 -123
  481. package/sources/modules/nodes/outbound.js +105 -105
  482. package/sources/modules/nodes/signing.js +71 -71
  483. package/sources/modules/notify/index.js +12 -12
  484. package/sources/modules/rag/embed-worker.js +36 -36
  485. package/sources/modules/rag/embedder.js +3 -3
  486. package/sources/modules/rag/indexer.js +1 -1
  487. package/sources/modules/rag/readme.md +70 -70
  488. package/sources/modules/rag/scope.js +3 -3
  489. package/sources/modules/rag/search.js +1 -1
  490. package/sources/modules/readme.md +21 -21
  491. package/sources/modules/sandbox/config.js +74 -74
  492. package/sources/modules/sandbox/driver.js +100 -100
  493. package/sources/modules/sandbox/images/work-computer/Dockerfile +34 -34
  494. package/sources/modules/sandbox/images/work-computer/entrypoint.sh +24 -24
  495. package/sources/modules/sandbox/manager.js +1089 -1089
  496. package/sources/modules/sandbox/readme.md +63 -63
  497. package/sources/modules/sandbox/vnc-proxy.js +296 -296
  498. package/sources/modules/trainer/dataset.js +8 -8
  499. package/sources/modules/trainer/halogen.js +37 -37
  500. package/sources/modules/trainer/huggingface.js +13 -13
  501. package/sources/modules/trainer/index.js +44 -39
  502. package/sources/modules/trainer/local-engine.js +9 -9
  503. package/sources/modules/trainer/paths.js +9 -2
  504. package/sources/modules/trainer/providers.js +126 -78
  505. package/sources/modules/trainer/runner.js +10 -10
  506. package/sources/modules/trainer/transfer.js +8 -8
  507. package/sources/server/access/audit.js +138 -138
  508. package/sources/server/access/gateway.js +1 -1
  509. package/sources/server/access/links.js +4 -4
  510. package/sources/server/access/refs.js +106 -106
  511. package/sources/server/access/workplaces.js +7 -7
  512. package/sources/server/assert-class-id.js +23 -23
  513. package/sources/server/chat-threads.js +22 -8
  514. package/sources/server/class/archive.js +7 -7
  515. package/sources/server/class/base-template.js +34 -29
  516. package/sources/server/class/distro.js +41 -33
  517. package/sources/server/class/module-status.js +380 -0
  518. package/sources/server/class/scaffold.js +2 -2
  519. package/sources/server/class/search.js +1 -1
  520. package/sources/server/class/security.js +24 -14
  521. package/sources/server/class.js +140 -124
  522. package/sources/server/external-source.js +90 -90
  523. package/sources/server/file.js +1 -1
  524. package/sources/server/folder.js +150 -44
  525. package/sources/server/handler.js +25 -12
  526. package/sources/server/index.js +12 -12
  527. package/sources/server/logs.js +5 -6
  528. package/sources/server/memory-mark.js +34 -34
  529. package/sources/server/node.js +1 -1
  530. package/sources/server/readme.md +110 -110
  531. package/sources/server/safe-node-name.js +67 -67
  532. package/sources/server/server.js +8 -6
  533. package/sources/server/upload-mark.js +24 -24
  534. package/sources/server/user.js +85 -18
  535. package/sources/server/zip-guard.js +81 -81
  536. package/whitepaper.md +568 -568
  537. package/$server/$folder/$class/$module/handlers/pages/form/system/$handler/tabs/mcp/$handler/class.js +0 -9
  538. package/$server/$folder/$class/$module/handlers/pages/form/system/$handler/tabs/mcp/$handler/mcp.js +0 -813
  539. package/$server/$folder/$class/$module/handlers/pages/form/system/$handler/tabs/modules/$handler/modules.js +0 -1
  540. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$catalog/class.js +0 -4
  541. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$operation/class.js +0 -4
  542. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$register/class.js +0 -4
  543. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$struct/class.js +0 -4
  544. package/$server/$folder/$class/$structure/$organization/$folder/$class/$domain/class.js +0 -4
  545. package/$server/$folder/$class/$structure/$organization/$folder/$class/$module/class.js +0 -4
  546. package/$server/$folder/$class/$structure/$organization/$folder/$class/$structure/$organization/class.js +0 -4
  547. package/$server/$folder/$class/$structure/$organization/class.js +0 -19
  548. package/$server/$folder/$class/$structure/$organization/icon.png +0 -0
  549. package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/$handler/tabs/license/$handler/class.js +0 -6
  550. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/tabs/agent/$handler/class.js +0 -3
  551. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/tabs/messengers/$handler/class.js +0 -3
  552. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/tabs/modules/$handler/class.js +0 -3
  553. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/tabs/profile/$handler/class.js +0 -5
  554. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/data.js +0 -313
  555. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/explorer.js +0 -16
  556. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/calendar.js +0 -1226
  557. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +0 -2095
  558. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/email.js +0 -1188
  559. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +0 -289
  560. package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/agent/$handler/class.js +0 -6
  561. package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/database/$handler/class.js +0 -9
  562. package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/messengers/$handler/class.js +0 -6
  563. package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/modules/$handler/class.js +0 -5
  564. package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/modules/$handler/modules.js +0 -281
  565. package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/staff/$handler/class.js +0 -5
  566. package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/staff/$handler/staff.js +0 -2126
  567. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/site.js +0 -240
  568. package/$server/$folder/$class/handlers/pages/form/object/$handler/class.js +0 -32
  569. package/$server/$folder/$class/handlers/pages/form/object/$handler/object.js +0 -1371
  570. package/$server/$folder/$class/handlers/pages/form/objects/$handler/class.js +0 -32
  571. package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +0 -2130
  572. package/$server/$folder/$class/handlers/pages/form/system/$handler/system.js +0 -309
  573. package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/files/$handler/files.js +0 -17
  574. package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/requisites/$handler/class.js +0 -16
  575. package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +0 -21
  576. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +0 -27
  577. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +0 -31
  578. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +0 -10
  579. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/file.js +0 -72
  580. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +0 -63
  581. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +0 -1845
  582. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js +0 -760
  583. package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +0 -29
  584. package/$server/$folder/handlers/pages/form/$handler/form.js +0 -2122
  585. package/MODULES/$domain/handlers/pages/form/system/$handler/tabs/mcp/$handler/class.js +0 -6
  586. package/MODULES/$domain/handlers/pages/form/system/$handler/tabs/mcp/$handler/mcp.js +0 -1
  587. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js +0 -24
  588. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/class.js +0 -7
  589. package/MODULES/Marketplaces/$domain/class.js +0 -9
  590. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/class.js" +0 -6
  591. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/class.js" +0 -6
  592. package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/class.js" +0 -18
  593. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/virtual/$handler/class.js +0 -5
  594. package/MODULES/Register/OPERATIONS//320/224/320/276/321/201/321/202/320/260/320/262/320/272/320/260/$operation/class.js +0 -22
  595. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/222/320/265/321/200/320/275/321/203/321/202/321/214 /320/270/320/267 /320/276/321/202/320/277/321/203/321/201/320/272/320/260/$operation/class.js" +0 -14
  596. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/236/321/202/320/277/321/200/320/260/320/262/320/270/321/202/321/214 /320/262 /320/276/321/202/320/277/321/203/321/201/320/272/$operation/class.js" +0 -15
  597. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/243/320/262/320/276/320/273/321/214/320/275/320/265/320/275/320/270/320/265/$operation/class.js +0 -14
  598. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/220/320/262/320/260/320/275/321/201/320/276/320/262/321/213/320/271 /320/276/321/202/321/207/321/221/321/202/$operation/class.js" +0 -17
  599. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/237/320/232/320/236/$operation/class.js +0 -18
  600. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/240/320/232/320/236/$operation/class.js +0 -17
  601. package/MODULES/Register/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/320/265 /320/236/320/241/$operation/class.js" +0 -30
  602. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/227/320/260/321/200/320/277/320/273/320/260/321/202/320/260/$operation/class.js" +0 -8
  603. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/237/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/321/203/$operation/class.js" +0 -11
  604. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202//320/222/320/276/320/267/320/262/321/200/320/260/321/202 /320/276/321/202 /320/277/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/320/260/$operation/class.js" +0 -11
  605. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202//320/236/321/202 /320/277/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/217/$operation/class.js" +0 -11
  606. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/222/320/276/320/267/320/262/321/200/320/260/321/202 /320/276/321/202 /320/277/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/217/$operation/class.js" +0 -32
  607. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/class.js +0 -32
  608. package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/analysis/$handler/class.js +0 -8
  609. package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/postings/$handler/class.js +0 -8
  610. package/MODULES/Register/REGISTER/$register/$folder/$class/$data/$register/$account/handlers/pages/form/turnovers/$handler/class.js +0 -8
  611. package/MODULES/Register/REGISTER/$register/handlers/pages/form/journal/$handler/class.js +0 -5
  612. package/MODULES/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/class.js +0 -5
  613. package/MODULES/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/sheet.js +0 -808
  614. package/NODES/$node/handlers/pages/form/network/$handler/network.js +0 -110
  615. package/ORGANIZATIONS/$domain/$folder/$class/$structure/$organization/class.js +0 -5
  616. package/ORGANIZATIONS/$domain/class.js +0 -5
  617. package/ORGANIZATIONS/$domain/readme.md +0 -10
  618. package/models/$ai/$folder/$class/$ai/handlers/pages/form/system/$handler/tabs/ai/$handler/class.js +0 -6
  619. package/models/$ai/$folder/$class/$provider/handlers/pages/form/system/$handler/tabs/ai/$handler/class.js +0 -6
  620. package/models/$ai/$folder/$class/$provider/readme.md +0 -16
  621. package/models/$ai/class.js +0 -169
  622. package/models/$ai/handlers/pages/form/system/$handler/tabs/ai/$handler/ai.js +0 -167
  623. package/models/$ai/handlers/pages/form/system/$handler/tabs/ai/$handler/class.js +0 -6
  624. package/models/$ai/readme.md +0 -62
  625. package/models/Local/$provider/handlers/methods/transfer/$handler/class.js +0 -41
  626. package/models/Local/$provider/handlers/pages/form/system/$handler/tabs/ai/$handler/ai.js +0 -1453
  627. package/models/Local/$provider/handlers/pages/form/system/$handler/tabs/ai/$handler/class.js +0 -6
  628. /package/{models/$ai → $server}/$folder/$class/$ai/methods/chat/$method/class.js +0 -0
  629. /package/$server/$folder/$class/$structure/{$organization/handlers/pages/form/system/$handler/tabs → $project/handlers/pages/form/system}/requisites/$handler/class.js +0 -0
  630. /package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/{$handler/tabs/database → database}/$handler/class.js +0 -0
  631. /package/MODULES/{CBR/$module/class.js → /320/224/320/260/320/275/320/275/321/213/320/265/CBR/$module/class.js"} +0 -0
  632. /package/MODULES/{Geo/$module/class.js → /320/224/320/260/320/275/320/275/321/213/320/265/Geo/$module/class.js"} +0 -0
  633. /package/MODULES/{Geo → /320/224/320/260/320/275/320/275/321/213/320/265/Geo}//320/232/320/276/320/276/321/200/320/264/320/270/320/275/320/260/321/202/321/213/$struct/class.js" +0 -0
  634. /package/MODULES/{Geo → /320/224/320/260/320/275/320/275/321/213/320/265/Geo}//320/250/320/265/320/271/320/277/$struct/class.js" +0 -0
  635. /package/MODULES/{KLADR/$module/$folder/$class/$data/$catalog/class.js → /320/224/320/260/320/275/320/275/321/213/320/265/KLADR/$module/$folder/$class/$data/$catalog/class.js"} +0 -0
  636. /package/MODULES/{KLADR/$module/class.js → /320/224/320/260/320/275/320/275/321/213/320/265/KLADR/$module/class.js"} +0 -0
  637. /package/MODULES/{KLADR/$module/readme.md → /320/224/320/260/320/275/320/275/321/213/320/265/KLADR/$module/readme.md"} +0 -0
  638. /package/MODULES/{KLADR → /320/224/320/260/320/275/320/275/321/213/320/265/KLADR}//320/237/320/276/320/264/321/200/320/260/320/267/320/264/320/265/320/273/320/265/320/275/320/270/321/217 /320/234/320/222/320/224/$catalog/class.js" +0 -0
  639. /package/MODULES/{KLADR → /320/224/320/260/320/275/320/275/321/213/320/265/KLADR}//320/240/320/265/320/263/320/270/320/276/320/275/321/213/$catalog/class.js" +0 -0
  640. /package/MODULES/{RuCalendar/$module/class.js → /320/224/320/260/320/275/320/275/321/213/320/265/RuCalendar/$module/class.js"} +0 -0
  641. /package/MODULES/{Weather/$module/class.js → /320/224/320/260/320/275/320/275/321/213/320/265/Weather/$module/class.js"} +0 -0
  642. /package/MODULES/{2GIS/$module/class.js → /320/232/320/276/320/275/320/275/320/265/320/272/321/202/320/276/321/200/321/213/2GIS/$mcp/class.js"} +0 -0
  643. /package/MODULES/{2GIS/$module/readme.md → /320/232/320/276/320/275/320/275/320/265/320/272/321/202/320/276/321/200/321/213/2GIS/$mcp/readme.md"} +0 -0
  644. /package/MODULES/{Telegram/$module/class.js → /320/232/320/276/320/275/320/275/320/265/320/272/321/202/320/276/321/200/321/213/Telegram/$module/class.js"} +0 -0
  645. /package/{models/GigaChat/$provider/$folder/$class/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/GigaChat/$provider/$folder/$class/$ai/class.js"} +0 -0
  646. /package/{models/GigaChat/$provider/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/GigaChat/$provider/class.js"} +0 -0
  647. /package/{models/GigaChat/GigaChat 2 Lite/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/GigaChat/GigaChat 2 Lite/$ai/class.js"} +0 -0
  648. /package/{models/GigaChat/GigaChat 2 Max/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/GigaChat/GigaChat 2 Max/$ai/class.js"} +0 -0
  649. /package/{models/GigaChat/GigaChat 2 Pro/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/GigaChat/GigaChat 2 Pro/$ai/class.js"} +0 -0
  650. /package/{models/GigaChat/GigaChat Embeddings/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/GigaChat/GigaChat Embeddings/$ai/class.js"} +0 -0
  651. /package/{models/MTS-AI/$provider/$folder/$class/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/MTS-AI/$provider/$folder/$class/$ai/class.js"} +0 -0
  652. /package/{models/MTS-AI/$provider/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/MTS-AI/$provider/class.js"} +0 -0
  653. /package/{models/MTS-AI/Cotype Lite/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/MTS-AI/Cotype Lite/$ai/class.js"} +0 -0
  654. /package/{models/MTS-AI/Cotype Pro 2/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/MTS-AI/Cotype Pro 2/$ai/class.js"} +0 -0
  655. /package/{models/MTS-AI/Cotype Vision/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/MTS-AI/Cotype Vision/$ai/class.js"} +0 -0
  656. /package/{models/T-Bank/$provider/$folder/$class/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/T-Bank/$provider/$folder/$class/$ai/class.js"} +0 -0
  657. /package/{models/T-Bank/$provider/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/T-Bank/$provider/class.js"} +0 -0
  658. /package/{models/T-Bank/T-Lite 2.0/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/T-Bank/T-Lite 2.0/$ai/class.js"} +0 -0
  659. /package/{models/T-Bank/T-Pro 2.0/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/T-Bank/T-Pro 2.0/$ai/class.js"} +0 -0
  660. /package/{models/T-Bank/T-VoiceKit ASR/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/T-Bank/T-VoiceKit ASR/$ai/class.js"} +0 -0
  661. /package/{models/T-Bank/T-VoiceKit TTS/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/T-Bank/T-VoiceKit TTS/$ai/class.js"} +0 -0
  662. /package/{models/Yandex/$provider/$folder/$class/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/$provider/$folder/$class/$ai/class.js"} +0 -0
  663. /package/{models/Yandex/$provider/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/$provider/class.js"} +0 -0
  664. /package/{models/Yandex/Alice AI (YandexGPT 5 Pro)/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/Alice AI (YandexGPT 5 Pro)/$ai/class.js"} +0 -0
  665. /package/{models/Yandex/Yandex Embeddings/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/Yandex Embeddings/$ai/class.js"} +0 -0
  666. /package/{models/Yandex/Yandex SpeechKit ASR/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/Yandex SpeechKit ASR/$ai/class.js"} +0 -0
  667. /package/{models/Yandex/Yandex SpeechKit TTS/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/Yandex SpeechKit TTS/$ai/class.js"} +0 -0
  668. /package/{models/Yandex/YandexART/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/YandexART/$ai/class.js"} +0 -0
  669. /package/{models/Yandex/YandexGPT 5 Lite/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/YandexGPT 5 Lite/$ai/class.js"} +0 -0
  670. /package/{models/Yandex/YandexGPT Reasoning/$ai/class.js → MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Yandex/YandexGPT Reasoning/$ai/class.js"} +0 -0
  671. /package/MODULES/{DuckDuckGo/$module/class.js → /320/237/320/276/320/270/321/201/320/272/DuckDuckGo/$module/class.js"} +0 -0
  672. /package/MODULES/{SearXNG/$module/class.js → /320/237/320/276/320/270/321/201/320/272/SearXNG/$module/class.js"} +0 -0
  673. /package/MODULES/{Yandex/$module/class.js → /320/237/320/276/320/270/321/201/320/272/Yandex/$module/class.js"} +0 -0
  674. /package/MODULES/{Process/$module/$folder/$class/$data/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Process/$module/$folder/$class/$data/$catalog/class.js"} +0 -0
  675. /package/MODULES/{Process/$module/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Process/$module/class.js"} +0 -0
  676. /package/MODULES/{Process → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Process}//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/class.js" +0 -0
  677. /package/MODULES/{Register/$module/$folder/$class/$data/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/$module/$folder/$class/$data/$catalog/class.js"} +0 -0
  678. /package/MODULES/{Register/$module/$folder/$class/$data/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/$module/$folder/$class/$data/$operation/class.js"} +0 -0
  679. /package/MODULES/{Register/$module/$folder/$class/$data/$register/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/$module/$folder/$class/$data/$register/class.js"} +0 -0
  680. /package/MODULES/{Register/$module/$folder/$class/$data/$struct/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/$module/$folder/$class/$data/$struct/class.js"} +0 -0
  681. /package/MODULES/{Register/$module/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/$module/class.js"} +0 -0
  682. /package/MODULES/{Register/$module/readme.md → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/$module/readme.md"} +0 -0
  683. /package/MODULES/{Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/$folder/$class/$data/$catalog/$virtual/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/$folder/$class/$data/$catalog/$virtual/class.js"} +0 -0
  684. /package/MODULES/{Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/class.js"} +0 -0
  685. /package/MODULES/{Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/class.js"} +0 -0
  686. /package/MODULES/{Register/CATALOGS/$catalog/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/CATALOGS/$catalog/class.js"} +0 -0
  687. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/CATALOGS//320/222/320/270/320/264/321/213 /320/275/320/276/321/200/320/274/320/260/321/202/320/270/320/262/320/276/320/262/$catalog/class.js" +0 -0
  688. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/CATALOGS//320/224/320/276/320/273/320/266/320/275/320/276/321/201/321/202/320/270/$catalog/class.js" +0 -0
  689. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/class.js" +0 -0
  690. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/class.js" +0 -0
  691. /package/MODULES/{Register/OPERATIONS/$operation/$folder/$class/$data/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS/$operation/$folder/$class/$data/$operation/class.js"} +0 -0
  692. /package/MODULES/{Register/OPERATIONS/$operation/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/OPERATIONS/$operation/class.js"} +0 -0
  693. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/class.js" +0 -0
  694. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/$folder/$class/$data/$operation/class.js" +0 -0
  695. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/class.js" +0 -0
  696. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/class.js" +0 -0
  697. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260/$operation/class.js" +0 -0
  698. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/$folder/$class/$data/$operation/print//320/237/320/273/320/260/321/202/321/221/320/266/320/275/320/276/320/265 /320/277/320/276/321/200/321/203/321/207/320/265/320/275/320/270/320/265.html" +0 -0
  699. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/class.js" +0 -0
  700. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/class.js" +0 -0
  701. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276/$operation/class.js" +0 -0
  702. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js" +0 -0
  703. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/OPERATIONS//320/244/320/270/320/275/320/260/320/275/321/201/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/321/203/320/273/321/214/321/202/320/260/321/202/$operation/class.js" +0 -0
  704. /package/MODULES/{Register/REGISTER/$register/$folder/$class/$data/$register/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/$folder/$class/$data/$register/$account/class.js"} +0 -0
  705. /package/MODULES/{Register/REGISTER/$register/$folder/$class/$data/$register/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/$folder/$class/$data/$register/class.js"} +0 -0
  706. /package/MODULES/{Register/REGISTER/$register/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/$register/class.js"} +0 -0
  707. /package/MODULES/{Register/REGISTER/10/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/10/$account/class.js"} +0 -0
  708. /package/MODULES/{Register/REGISTER/19/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/19/$account/class.js"} +0 -0
  709. /package/MODULES/{Register/REGISTER/20/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/20/$account/class.js"} +0 -0
  710. /package/MODULES/{Register/REGISTER/26/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/26/$account/class.js"} +0 -0
  711. /package/MODULES/{Register/REGISTER/50/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/50/$account/class.js"} +0 -0
  712. /package/MODULES/{Register/REGISTER/51/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/51/$account/class.js"} +0 -0
  713. /package/MODULES/{Register/REGISTER/55/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/55/$account/class.js"} +0 -0
  714. /package/MODULES/{Register/REGISTER/58/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/58/$account/class.js"} +0 -0
  715. /package/MODULES/{Register/REGISTER/66/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/66/$account/class.js"} +0 -0
  716. /package/MODULES/{Register/REGISTER/67/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/67/$account/class.js"} +0 -0
  717. /package/MODULES/{Register/REGISTER/68/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/68/$account/class.js"} +0 -0
  718. /package/MODULES/{Register/REGISTER/68/04/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/68/04/$account/class.js"} +0 -0
  719. /package/MODULES/{Register/REGISTER/69/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/69/$account/class.js"} +0 -0
  720. /package/MODULES/{Register/REGISTER/75/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/75/$account/class.js"} +0 -0
  721. /package/MODULES/{Register/REGISTER/80/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/80/$account/class.js"} +0 -0
  722. /package/MODULES/{Register/REGISTER/84/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/84/$account/class.js"} +0 -0
  723. /package/MODULES/{Register/REGISTER/90/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/90/$account/class.js"} +0 -0
  724. /package/MODULES/{Register/REGISTER/90/09/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/90/09/$account/class.js"} +0 -0
  725. /package/MODULES/{Register/REGISTER/99/$account/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/REGISTER/99/$account/class.js"} +0 -0
  726. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/class.js" +0 -0
  727. /package/MODULES/{Register/STRUCTS/$struct/$folder/$class/$data/$struct/class.js → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/STRUCTS/$struct/$folder/$class/$data/$struct/class.js"} +0 -0
  728. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/STRUCTS//320/220/320/264/321/200/320/265/321/201/$struct/class.js" +0 -0
  729. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/STRUCTS//320/221/320/260/320/275/320/272/320/276/320/262/321/201/320/272/320/270/320/271 /321/201/321/207/321/221/321/202/$struct/class.js" +0 -0
  730. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/STRUCTS//320/225/320/264/320/270/320/275/320/270/321/206/320/260 /320/270/320/267/320/274/320/265/321/200/320/265/320/275/320/270/321/217/$struct/class.js" +0 -0
  731. /package/MODULES/{Register → /320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register}/STRUCTS//320/244/320/230/320/236/$struct/class.js" +0 -0
  732. /package/{users → USERS}/$users/class.js +0 -0
@@ -1,6 +1,2216 @@
1
- /** Мета хендлера form/chat. Визуалка — chat.js. */
2
- export default {
3
- icon: 'icons:question-answer',
4
- label: 'Чат',
5
- order: 1,
6
- }
1
+ import { taskKeyOf, taskDayOf, isCreatedTask, pathOfLog, isChatModel, getUserPreferredModel, setUserPreferredModel } from './chat-task.js';
2
+ const sleep = ms => new Promise(r => setTimeout(r, ms));
3
+ const SORT_TIMES = new WeakMap();
4
+ /** localStorage.workChatDebug = 1 — журнал времён создания задачи в консоли. */
5
+ function chatDebug(...a) {
6
+ try {
7
+ if (globalThis.localStorage?.workChatDebug) console.log('[chat]', Math.round(performance.now()) + 'мс', ...a);
8
+ } catch {/* нет localStorage */}
9
+ }
10
+
11
+ /** Первый лист $ai с chat. Неязыковые модели (image/audio/embedding/asr/tts) отсекаются. */
12
+ async function firstChatLeaf(node) {
13
+ if (!node) return null;
14
+ if (!node.items?.length) {
15
+ if (!isChatModel(node)) return null;
16
+ try {
17
+ const item = node.path ? await WORK.get_item(node.path) : null;
18
+ if (item && !isChatModel(item)) return null;
19
+ } catch {/* лист без доп. данных — проверен по node */}
20
+ return node;
21
+ }
22
+ for (const child of node.items) {
23
+ const found = await firstChatLeaf(child);
24
+ if (found) return found;
25
+ }
26
+ return null;
27
+ }
28
+ ODA({
29
+ is: 'form-chat',
30
+ imports: '/oda//toggle.js, ~/lib//tree.js',
31
+ template: /* html */`
32
+ <style>
33
+ :host {
34
+ @apply --vertical;
35
+ overflow: hidden;
36
+ position: relative;
37
+ }
38
+ </style>
39
+ <oda-chat id="chat" :$item ::model></oda-chat>
40
+ `,
41
+ async attached() {
42
+ if (typeof BroadcastChannel !== 'undefined' && !this._modelBc) {
43
+ try {
44
+ this._modelBc = new BroadcastChannel('work-user-ai-model');
45
+ this._modelBc.onmessage = ev => {
46
+ const m = ev?.data?.model;
47
+ if (m && m !== this.model) this.model = m;
48
+ };
49
+ } catch {/* ignore */}
50
+ }
51
+ await this._hydrateModel();
52
+ if (this._initialNav) {
53
+ const nav = this._initialNav;
54
+ this._initialNav = null;
55
+ this.async(() => this.applyNav(nav), 0);
56
+ }
57
+ },
58
+ _applyNavFields(nav) {
59
+ if (nav?.openTaskPath) {
60
+ this._pendingOpenTaskPath = String(nav.openTaskPath);
61
+ }
62
+ },
63
+ async applyNav(nav) {
64
+ if (!nav || typeof nav !== 'object') return;
65
+ const taskPath = nav.openTaskPath || this._pendingOpenTaskPath;
66
+ if (!taskPath) return;
67
+ this._pendingOpenTaskPath = '';
68
+ let chatEl = this.chat;
69
+ for (let i = 0; i < 20 && !chatEl; i++) {
70
+ await sleep(50);
71
+ chatEl = this.chat;
72
+ }
73
+ if (chatEl) {
74
+ if (chatEl.feedMode !== 'dialog') chatEl.feedMode = 'dialog';
75
+ await chatEl.openMovedTask?.(taskPath);
76
+ }
77
+ },
78
+ detached() {
79
+ try {
80
+ this._modelBc?.close?.();
81
+ this._modelBc = null;
82
+ } catch {/* ignore */}
83
+ },
84
+ last: {
85
+ $def: 0,
86
+ $save: true
87
+ },
88
+ model: {
89
+ $def: '',
90
+ set(n) {
91
+ if (n) setUserPreferredModel(n);
92
+ }
93
+ },
94
+ get $saveKey() {
95
+ return this.$item?.short;
96
+ },
97
+ async _hydrateModel() {
98
+ const userModel = getUserPreferredModel();
99
+ if (userModel && this.model !== userModel) this.model = userModel;
100
+ if (!this.model) {
101
+ try {
102
+ const children = await WORK.children;
103
+ const aiRoot = children?.find(el => el.type === '$ai');
104
+ if (!aiRoot) return;
105
+ const tree = await aiRoot.info({
106
+ deep: -1
107
+ });
108
+ const leaf = await firstChatLeaf(tree);
109
+ const path = leaf?.path;
110
+ if (path) {
111
+ this.model = path;
112
+ setUserPreferredModel(path);
113
+ }
114
+ } catch {}
115
+ }
116
+ },
117
+ get formChat() {
118
+ return this;
119
+ },
120
+ get chat() {
121
+ return this.$('oda-chat');
122
+ },
123
+ get isPrivate() {
124
+ return this.$item?.type === '$user';
125
+ },
126
+ focusInput() {
127
+ this.async(() => {
128
+ this.chat?.focusInput?.();
129
+ });
130
+ },
131
+ receivers: [],
132
+ deptUsers: [],
133
+ operationClasses: [],
134
+ async _loadDepartmentContext($item = this.$item) {
135
+ if (!$item || this.isPrivate) {
136
+ this.deptUsers = [];
137
+ this.operationClasses = [];
138
+ return;
139
+ }
140
+ try {
141
+ const d = await $item.fetch('places').catch(() => null);
142
+ const placeLabels = new Map();
143
+ const uidSet = new Set();
144
+ const opMap = new Map();
145
+ const collectTreeOps = (nodes, parentOpPath = '') => {
146
+ for (const n of nodes || []) {
147
+ if (!n) continue;
148
+ const isOp = n.type === '$operation';
149
+ const hasKids = Array.isArray(n.children) && n.children.length > 0;
150
+ const isOpsRoot = isOp && /(?:^|\/)OPERATIONS$/i.test(n.path || '');
151
+ if (isOp && n.path && !isOpsRoot) {
152
+ const leaf = !hasKids;
153
+ if (!leaf || n.access !== 'read') {
154
+ const prev = opMap.get(n.path);
155
+ const count = Number(n.objectCount ?? n.count) || prev?.count || 0;
156
+ opMap.set(n.path, {
157
+ id: n.path,
158
+ cid: n.path,
159
+ path: n.path,
160
+ parent: parentOpPath || prev?.parent || '',
161
+ label: n.label || n.id || n.path.split('/').pop(),
162
+ type: '$operation',
163
+ icon: n.icon || prev?.icon || 'carbon:task-complete',
164
+ leaf: prev ? prev.leaf && leaf : leaf,
165
+ count,
166
+ hint: n.path
167
+ });
168
+ }
169
+ }
170
+ if (hasKids) {
171
+ const nextParent = isOp && n.path && !isOpsRoot ? n.path : parentOpPath;
172
+ collectTreeOps(n.children, nextParent);
173
+ }
174
+ }
175
+ };
176
+ const walkPlaces = places => {
177
+ for (const p of places || []) {
178
+ if (!p) continue;
179
+ const pLabel = p.label || p.id || '';
180
+ for (const u of p.users || []) {
181
+ if (u && u !== 'GUEST' && u !== 'GUESTS' && u !== 'USERS') {
182
+ uidSet.add(u);
183
+ if (pLabel && !placeLabels.has(u)) placeLabels.set(u, pLabel);
184
+ }
185
+ }
186
+ if (Array.isArray(p.tree)) collectTreeOps(p.tree);
187
+ if (Array.isArray(p.roles)) walkPlaces(p.roles);
188
+ }
189
+ };
190
+ if (d) {
191
+ if (Array.isArray(d.commonTree)) collectTreeOps(d.commonTree);
192
+ walkPlaces(d.places);
193
+ }
194
+ const roleIds = $item.DATA?.roleIds || {};
195
+ for (const [roleKey, list] of Object.entries(roleIds)) {
196
+ for (const u of list || []) {
197
+ if (u && u !== 'GUEST' && u !== 'GUESTS' && u !== 'USERS') {
198
+ uidSet.add(u);
199
+ if (!placeLabels.has(u)) placeLabels.set(u, roleKey === 'BOSS' ? 'Руководитель (BOSS)' : 'Сотрудник');
200
+ }
201
+ }
202
+ }
203
+
204
+ // Если в подразделении ещё не распределены места — подгружаем список пользователей из /USERS
205
+ if (!uidSet.size && WORK.DEV_MODE) {
206
+ const uRoot = await WORK.get_item('/USERS').catch(() => null);
207
+ const all = (await uRoot?.items) || [];
208
+ for (const u of all) {
209
+ if (u?.id && u.id[0] !== '$') uidSet.add(u.id);
210
+ }
211
+ }
212
+
213
+ // Если по дереву ссылок не нашлось листовых $operation, добираем из db_workspace
214
+ if (![...opMap.values()].some(x => x.leaf)) {
215
+ const ws = await $item.fetch('db_workspace').catch(() => null);
216
+ for (const [cid, cls] of Object.entries(ws?.classes || {})) {
217
+ const p = cls?.path || cid;
218
+ if (cls?.type === '$operation' && p && !/(?:^|\/)OPERATIONS$/i.test(p)) {
219
+ const parentPath = /(?:^|\/)OPERATIONS$/i.test(cls.parent || '') ? '' : cls.parent || '';
220
+ opMap.set(p, {
221
+ id: p,
222
+ cid: p,
223
+ path: p,
224
+ parent: parentPath,
225
+ label: cls.label || p.split('/').pop(),
226
+ type: '$operation',
227
+ icon: cls.icon || 'carbon:task-complete',
228
+ leaf: !!cls.leaf,
229
+ count: Number(cls.count ?? cls.objectCount) || 0,
230
+ hint: p
231
+ });
232
+ }
233
+ }
234
+ }
235
+ const users = uidSet.size && typeof WORK.usersByIds === 'function' ? ((await WORK.usersByIds([...uidSet])) || []).filter(Boolean) : [];
236
+ for (const u of users) {
237
+ if (u?.id && placeLabels.has(u.id)) u._placeLabel = placeLabels.get(u.id);
238
+ }
239
+ this.deptUsers = users;
240
+ this.operationClasses = [...opMap.values()];
241
+ } catch (err) {
242
+ console.warn('[chat] _loadDepartmentContext:', err);
243
+ }
244
+ },
245
+ // $item: null
246
+ $item: {
247
+ $def: null,
248
+ set($item) {
249
+ if ($item && this.isPrivate && this.$item.id !== WORK.uid) this.receivers = [$item];else this.receivers = [];
250
+ if ($item) {
251
+ this._hydrateModel();
252
+ this._loadDepartmentContext($item);
253
+ }
254
+ }
255
+ }
256
+ });
257
+ ODA({
258
+ is: 'oda-chat',
259
+ imports: 'oda//button, oda//icon, ~/lib//pack, ~/lib//tree, ~/lib//user, ~/lib//prompt-bar',
260
+ template: /* html */`
261
+ <style>
262
+ :host{
263
+ @apply --flex;
264
+ @apply --vertical;
265
+ overflow: hidden;
266
+ position: relative;
267
+ background: {{background}};
268
+ }
269
+ .back{
270
+ position: absolute;
271
+ top: 0px;
272
+ left: 0px;
273
+ width: 100%;
274
+ height: 100%;
275
+ background-repeat: round;
276
+ background: url({{url}});
277
+ pointer-events: none;
278
+ opacity: .1;
279
+ }
280
+ .mover{
281
+ gap: 4px;
282
+ position: absolute;
283
+ align-self: anchor-center;
284
+ right: 8px;
285
+ opacity: .5;
286
+ }
287
+ .mover>oda-button{
288
+ border-radius: 50%;
289
+ }
290
+ .feed-top-bar {
291
+ position: relative;
292
+ z-index: 8;
293
+ display: flex;
294
+ align-items: center;
295
+ justify-content: flex-end;
296
+ gap: 6px;
297
+ flex-wrap: wrap;
298
+ padding: 6px 12px 4px;
299
+ flex-shrink: 0;
300
+ }
301
+ .feed-mode-bar {
302
+ display: inline-flex;
303
+ align-items: center;
304
+ gap: 2px;
305
+ padding: 2px;
306
+ border-radius: 999px;
307
+ background: var(--content-background, #ffffff);
308
+ border: 1px solid var(--border-color, #cbd5e1);
309
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
310
+ opacity: 0.94;
311
+ }
312
+ .feed-mode-bar:hover {
313
+ opacity: 1;
314
+ }
315
+ .feed-mode-btn {
316
+ border: none;
317
+ background: transparent;
318
+ color: var(--content-color, inherit);
319
+ font: inherit;
320
+ font-size: 11px;
321
+ font-weight: 600;
322
+ padding: 4px 10px;
323
+ border-radius: 999px;
324
+ cursor: pointer;
325
+ white-space: nowrap;
326
+ transition: background 0.15s ease, color 0.15s ease;
327
+ }
328
+ .feed-mode-btn:hover:not(.active) {
329
+ background: var(--subtle-background, rgba(0, 0, 0, 0.05));
330
+ }
331
+ .feed-mode-btn.active {
332
+ background: var(--accent-color, #2563eb);
333
+ color: var(--accent-back, #ffffff);
334
+ }
335
+ .audit-overlay {
336
+ position: absolute;
337
+ inset: 44px 12px 68px 12px;
338
+ z-index: 11;
339
+ background: var(--content-background, #fff);
340
+ border: 1px solid var(--border-color, #cbd5e1);
341
+ border-radius: 10px;
342
+ box-shadow: 0 6px 24px rgba(0,0,0,0.14);
343
+ display: flex;
344
+ overflow: hidden;
345
+ }
346
+ .audit-sidebar {
347
+ width: 260px;
348
+ flex-shrink: 0;
349
+ border-right: 1px solid var(--subtle-border, #e2e8f0);
350
+ overflow-y: auto;
351
+ padding: 8px;
352
+ display: flex;
353
+ flex-direction: column;
354
+ gap: 4px;
355
+ background: var(--subtle-background, #f8fafc);
356
+ box-sizing: border-box;
357
+ }
358
+ .audit-messages {
359
+ flex: 1 1 auto;
360
+ min-width: 0;
361
+ min-height: 0;
362
+ display: flex;
363
+ flex-direction: column;
364
+ overflow-y: auto;
365
+ padding: 12px 16px;
366
+ gap: 8px;
367
+ }
368
+ .participants-popover {
369
+ position: absolute;
370
+ top: 44px;
371
+ right: 12px;
372
+ z-index: 12;
373
+ width: min(280px, calc(100vw - 24px));
374
+ max-height: min(360px, 60dvh);
375
+ overflow-y: auto;
376
+ background: var(--content-background, #fff);
377
+ border: 1px solid var(--border-color, #cbd5e1);
378
+ border-radius: 10px;
379
+ box-shadow: 0 6px 20px rgba(0,0,0,0.16);
380
+ padding: 10px 12px;
381
+ display: flex;
382
+ flex-direction: column;
383
+ gap: 8px;
384
+ font-size: 12.5px;
385
+ box-sizing: border-box;
386
+ }
387
+ .chat-composer {
388
+ z-index: 10;
389
+ max-height: 50%;
390
+ overflow: visible;
391
+ padding-bottom: var(--safe-bottom, 0px);
392
+ }
393
+ @media (max-width: 768px) {
394
+ .feed-top-bar {
395
+ padding: 4px 8px;
396
+ }
397
+ .feed-mode-bar {
398
+ max-width: 100%;
399
+ overflow-x: auto;
400
+ }
401
+ .audit-overlay {
402
+ inset: 42px 6px 64px 6px;
403
+ flex-direction: column;
404
+ }
405
+ .audit-sidebar {
406
+ width: 100%;
407
+ max-height: 36%;
408
+ border-right: none;
409
+ border-bottom: 1px solid var(--subtle-border, #e2e8f0);
410
+ }
411
+ .participants-popover {
412
+ left: 8px;
413
+ right: 8px;
414
+ width: auto;
415
+ }
416
+ }
417
+ </style>
418
+
419
+ <style>
420
+ ::-webkit-scrollbar {
421
+ width: 4px;
422
+ height: 4px;
423
+ }
424
+ ::-webkit-scrollbar-thumb {
425
+ background-color: transparent;
426
+ }
427
+ ::-webkit-scrollbar-thumb:hover {
428
+ background-color: transparent;
429
+ }
430
+ ::-webkit-scrollbar-track {
431
+ background-color: transparent;
432
+ }
433
+ </style>
434
+ <div class="back"></div>
435
+ <div class="feed-top-bar" ~if="showFeedModeToggle || ($item && $item.type !== '$user')">
436
+ <div class="feed-mode-bar" ~if="showFeedModeToggle">
437
+ <button type="button" class="feed-mode-btn" ~class="{ active: feedMode === 'dialog' }" @tap="setFeedMode('dialog')" title="Мой диалог и задачи с Агентом этого узла">Диалог</button>
438
+ <button type="button" class="feed-mode-btn" ~class="{ active: feedMode === 'local' }" @tap="setFeedMode('local')" title="Местный лог открытой точки (доступно только BOSS)">Местный лог</button>
439
+ <button type="button" class="feed-mode-btn" ~class="{ active: feedMode === 'audit' }" @tap="setFeedMode('audit')" title="Взаимодействия пользователей и клиентов с Агентом (доступно только BOSS)">Взаимодействия</button>
440
+ </div>
441
+ <div class="feed-mode-bar" ~if="$item && $item.type !== '$user'">
442
+ <button type="button" class="feed-mode-btn" ~class="{ active: showParticipants }" @tap="toggleParticipants()" title="Участники и рабочие места подразделения">Участники ({{participantsCount}})</button>
443
+ </div>
444
+ </div>
445
+ <div ~if="feedMode === 'audit' && showFeedModeToggle" class="audit-overlay">
446
+ <div class="audit-sidebar">
447
+ <div style="font-size:12px;font-weight:700;padding:4px 6px;color:var(--muted-color);">Диалоги с Агентом ({{auditThreads.length}})</div>
448
+ <div ~if="!auditThreads.length" style="font-size:12.5px;color:var(--muted-color);padding:8px 6px;">Взаимодействий пока нет</div>
449
+ <div ~for="auditThreads" @tap="openAuditThread($for.item)" ~class="{ active: auditSelectedId === $for.item.id }" style="padding:7px 9px;border-radius:7px;cursor:pointer;border:1px solid var(--subtle-border,transparent);background:var(--content-background,#fff);font-size:12.5px;">
450
+ <div style="font-weight:600;display:flex;justify-content:space-between;gap:6px;">
451
+ <span>{{$for.item.peerLabel}}</span>
452
+ <span style="font-size:11px;opacity:0.7;">{{$for.item.messageCount}}</span>
453
+ </div>
454
+ <div ~if="$for.item.lastMessage" style="font-size:11.5px;color:var(--muted-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px;">{{$for.item.lastMessage.content || ($for.item.lastMessage.taskPath ? 'Задача' : 'Вложение')}}</div>
455
+ </div>
456
+ </div>
457
+ <div class="audit-messages">
458
+ <div ~if="!auditSelectedId" style="color:var(--muted-color);font-size:13px;margin:auto;">Выберите пользователя для просмотра истории взаимодействия с Агентом</div>
459
+ <div ~for="auditMessages" style="padding:8px 11px;border-radius:8px;border:1px solid var(--subtle-border,#e2e8f0);background:var(--subtle-background,#f8fafc);font-size:13px;">
460
+ <div style="font-size:11px;color:var(--muted-color);display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:3px;">
461
+ <b>{{$for.item.sender === '$twin' ? 'Агент узла' : $for.item.sender}}</b>
462
+ <span>{{new Date($for.item.created).toLocaleString()}}</span>
463
+ </div>
464
+ <div style="white-space:pre-wrap;word-break:break-word;">{{$for.item.content || ($for.item.taskPath ? 'Задача: ' + $for.item.taskPath : '')}}</div>
465
+ <div ~if="$for.item.kind === 'approval'" style="display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:6px;">
466
+ <span ~if="$for.item.meta?.status === 'approved'" style="font-size:11.5px;font-weight:700;color:#059669;">✓ Утверждено</span>
467
+ <span ~if="$for.item.meta?.status === 'rejected'" style="font-size:11.5px;font-weight:700;color:#dc2626;">✕ Отклонено</span>
468
+ <oda-button ~if="$for.item.meta?.status === 'pending'" icon="icons:check" info-invert @tap="resolveApprovalMsg($for.item, 'approve')">Утвердить</oda-button>
469
+ <oda-button ~if="$for.item.meta?.status === 'pending'" icon="icons:close" @tap="resolveApprovalMsg($for.item, 'reject')">Отклонить</oda-button>
470
+ </div>
471
+ </div>
472
+ </div>
473
+ </div>
474
+ <div ~if="showParticipants && $item && $item.type !== '$user'" class="participants-popover">
475
+ <div style="display:flex;align-items:center;justify-content:space-between;font-weight:700;">
476
+ <span>Участники ({{participantsCount}})</span>
477
+ <oda-button icon="icons:close" :icon-size="14" @tap="showParticipants = false"></oda-button>
478
+ </div>
479
+ <div ~if="!participantsList.length" style="color:var(--muted-color);">Назначенных участников нет</div>
480
+ <div ~for="participantsList" @tap="openParticipant($for.item)" style="display:flex;align-items:center;gap:8px;padding:5px 7px;border-radius:7px;cursor:pointer;border:1px solid var(--subtle-border,transparent);">
481
+ <item-icon :$item="$for.item" icon-size="22" default="icons:person"></item-icon>
482
+ <div style="flex:1;min-width:0;">
483
+ <div style="font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{$for.item.label || $for.item.id}}</div>
484
+ <div ~if="$for.item._placeLabel" style="font-size:11px;color:var(--muted-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{$for.item._placeLabel}}</div>
485
+ </div>
486
+ </div>
487
+ </div>
488
+ <chat-ribbon id="ribbon" :$item @chat-item-expanded="onCardExpanded($event)"></chat-ribbon>
489
+ <div class="mover" vertical hidden>
490
+ <oda-button :hidden="$('#ribbon').scrollTop < 0" content shadow icon="icons:chevron-right:270" @tap="$('#ribbon').scrollTop = -($('#ribbon').scrollHeight)"></oda-button>
491
+ <oda-button :hidden="$('#ribbon').scrollTop > 0" content shadow icon="icons:chevron-right:90" @tap="$('#ribbon').scrollTop = 0"></oda-button>
492
+ </div>
493
+ <div vertical shadow content :hidden="hasExpandedCard" class="chat-composer">
494
+ <div ~if="replyTarget" horizontal accent-invert style="padding: 4px;">
495
+ <div horizontal flex style="overflow: auto; align-self: center;"></div>
496
+ <oda-button icon="icons:close" @tap="clear" style="padding: 0"></oda-button>
497
+ </div>
498
+ <div ~if="replyTarget" light vertical style="overflow-y: auto;" disabled>
499
+ <chat-item reply :$file="replyTarget"></chat-item>
500
+ </div>
501
+ <microchat-voice ~if="voiceOn"></microchat-voice>
502
+ <work-prompt-bar style="margin: 8px;" @tap="focusedItem = null"
503
+ ::value ::files :ai="isAIMode" :placeholder :pending="awaitTask"
504
+ ::model ::tts-mode ::receivers :dept-users="deptUsers" :operation-classes="operationClasses" :show-tts="true"
505
+ @receivers-changed="onReceiversChanged($event)" @create-operation="onCreateOperation($event)"
506
+ @send="onBarSend" @stop="onBarStop" @clear="clear" @prompt-key="_onPromptKey"></work-prompt-bar>
507
+ </div>
508
+ `,
509
+ get background() {
510
+ return `linear-gradient(145deg, var(--info-background), var(--info-color))`;
511
+ },
512
+ get url() {
513
+ if (this.$pdp.$handler) return this.$pdp.$handler.short + '/~/background.jpg';
514
+ },
515
+ files: [],
516
+ hasExpandedCard: false,
517
+ onCardExpanded(e) {
518
+ const detail = e?.detail || {};
519
+ this._expandedCards ??= new Set();
520
+ if (detail.card) {
521
+ if (detail.expanded) this._expandedCards.add(detail.card);else this._expandedCards.delete(detail.card);
522
+ for (const c of [...this._expandedCards]) {
523
+ if (!c.isConnected || !c.expanded) this._expandedCards.delete(c);
524
+ }
525
+ this.hasExpandedCard = this._expandedCards.size > 0;
526
+ } else {
527
+ this.hasExpandedCard = Boolean(detail.expanded);
528
+ }
529
+ },
530
+ get placeholder() {
531
+ if (this.$pdp.receivers.length) return 'Сообщение для ' + this.$pdp.receivers.map(user => user.label).join(', ') + ' ...';
532
+ return 'Новая задача для ИИ ...';
533
+ },
534
+ get isAIMode() {
535
+ const isForeign = this.$pdp?.isPrivate && this.$pdp?.$item?.id !== WORK.uid;
536
+ const hasReceivers = !!this.$pdp?.receivers?.length;
537
+ return !isForeign && !hasReceivers;
538
+ },
539
+ get receivers() {
540
+ return this.$pdp.receivers;
541
+ },
542
+ set receivers(v) {
543
+ if (this.$pdp) this.$pdp.receivers = Array.isArray(v) ? v : [];
544
+ },
545
+ get deptUsers() {
546
+ return this.$pdp?.deptUsers || [];
547
+ },
548
+ get operationClasses() {
549
+ return this.$pdp?.operationClasses || [];
550
+ },
551
+ onReceiversChanged(e) {
552
+ const list = e?.detail?.value ?? e?.detail ?? [];
553
+ if (this.$pdp) this.$pdp.receivers = Array.isArray(list) ? list : [];
554
+ },
555
+ async onCreateOperation(e) {
556
+ const d = e?.detail?.value ?? e?.detail ?? {};
557
+ const path = d.path || d;
558
+ if (!path || typeof path !== 'string') return;
559
+ const clsItem = await WORK.get_item(path).catch(() => null);
560
+ if (!clsItem) return;
561
+ const unit = this.$pdp?.$item?.short || this.$pdp?.$item?.path || '';
562
+ const title = clsItem.DATA?.label || clsItem.label || clsItem.id || path.split('/').pop() || 'Операция';
563
+ const fmtNew = globalThis.__workClassPicker?.formatNewObjectLabel || globalThis.WORK?.formatNewObjectLabel;
564
+ const newLabel = typeof fmtNew === 'function' ? fmtNew(title) : `Новое ${title.toLowerCase()}`;
565
+ const nav = {
566
+ view: 'objects/object',
567
+ create: true,
568
+ unit,
569
+ label: newLabel
570
+ };
571
+ if (window.top && window.top !== window && typeof window.top.execute === 'function') {
572
+ await window.top.execute(clsItem, nav);
573
+ return;
574
+ }
575
+ let formHost = null;
576
+ for (let p = this; p; p = p.parentElement || p.domHost || p.getRootNode?.()?.host) {
577
+ if (typeof p.openInForm === 'function') {
578
+ formHost = p;
579
+ break;
580
+ }
581
+ }
582
+ if (!formHost) {
583
+ const pf = document.querySelector?.('pages-form');
584
+ formHost = pf?.$?.('work-form') || pf || document.querySelector?.('work-form');
585
+ }
586
+ if (formHost && typeof formHost.openInForm === 'function') {
587
+ await formHost.openInForm(clsItem, nav);
588
+ } else if (typeof window.top?.execute === 'function') {
589
+ window.top.execute(clsItem, nav);
590
+ }
591
+ },
592
+ model: {
593
+ $def: '',
594
+ set(n) {
595
+ if (!n) return;
596
+ setUserPreferredModel(n);
597
+ }
598
+ },
599
+ get $saveKey() {
600
+ return this.$item?.short;
601
+ },
602
+ get modelItem() {
603
+ return this.model ? WORK.get_item(this.model) : null;
604
+ },
605
+ clear(e) {
606
+ this.value = '';
607
+ this.files = [];
608
+ this.$pdp.replyTarget = null;
609
+ this.$pdp.files = [];
610
+ this.$('#ribbon').lastIdxHistory = -1;
611
+ this.focusInput();
612
+ },
613
+ $public: {
614
+ showDatePanel: {
615
+ $def: false,
616
+ $save: true
617
+ }
618
+ },
619
+ onBarSend(e) {
620
+ if (this.skillSelectMode) {
621
+ this.value = '@' + this.$('skill-tree').focusedItem.name;
622
+ this.$('skill-tree').executed = true;
623
+ return;
624
+ }
625
+ this.send();
626
+ },
627
+ onBarStop() {
628
+ // Пока send в полёте — стоп не снимает ожидание карточки: это может быть
629
+ // второй клик по send, а не осознанный отказ от ожидания.
630
+ if (this._sending) return;
631
+ this.awaitTask = false;
632
+ this._awaitingLogExpand = false;
633
+ },
634
+ async _onPromptKey(e) {
635
+ e = e?.detail instanceof Event ? e.detail : e;
636
+ if (e.keyCode === 38 || e.code === 'ArrowUp') {
637
+ this.value = await this.$('chat-ribbon').getFromHistory(this.value, -1);
638
+ this.$('work-prompt-bar')?.selectInput();
639
+ } else if (e.keyCode === 40 || e.code === 'ArrowDown') {
640
+ this.value = await this.$('chat-ribbon').getFromHistory(this.value, 1);
641
+ this.$('work-prompt-bar')?.selectInput();
642
+ }
643
+ },
644
+ value: {
645
+ $def: ''
646
+ },
647
+ replyTarget: {
648
+ $der: null,
649
+ set(n) {
650
+ this.focusInput();
651
+ }
652
+ },
653
+ attached() {
654
+ this.async(() => {
655
+ this.focusInput();
656
+ }, 100);
657
+ this.$pdp?._hydrateModel?.();
658
+ this._geo();
659
+ this._bindChatSocket();
660
+ this._bindTaskMoved();
661
+ },
662
+ detached() {
663
+ if (this._onWsChatMsg && globalThis.WORK?.chatEvents) {
664
+ globalThis.WORK.chatEvents.removeEventListener('chat:message', this._onWsChatMsg);
665
+ globalThis.WORK.chatEvents.removeEventListener('chat:action', this._onWsChatMsg);
666
+ globalThis.WORK.chatEvents.removeEventListener('task.moved', this._onWsTaskMoved);
667
+ this._onWsChatMsg = null;
668
+ this._onWsTaskMoved = null;
669
+ }
670
+ if (this._onLocalTaskMoved) {
671
+ this.removeEventListener('work-task-moved', this._onLocalTaskMoved);
672
+ this._onLocalTaskMoved = null;
673
+ }
674
+ },
675
+ _bindTaskMoved() {
676
+ if (!this._onLocalTaskMoved) {
677
+ this._onLocalTaskMoved = ev => this._handleTaskMoved(ev?.detail, {
678
+ navigate: true
679
+ });
680
+ this.addEventListener('work-task-moved', this._onLocalTaskMoved);
681
+ }
682
+ if (!this._onWsTaskMoved) {
683
+ globalThis.WORK.chatEvents ??= new EventTarget();
684
+ this._onWsTaskMoved = ev => this._handleTaskMoved(ev?.detail, {
685
+ navigate: false
686
+ });
687
+ globalThis.WORK.chatEvents.addEventListener('task.moved', this._onWsTaskMoved);
688
+ }
689
+ },
690
+ async _handleTaskMoved(moved, {
691
+ navigate = false
692
+ } = {}) {
693
+ if (!moved?.newPath) return;
694
+ const oldPath = String(moved.oldPath || '');
695
+ const key = oldPath + '->' + moved.newPath;
696
+ const oldKey = taskKeyOf(oldPath);
697
+ const ribbon = this.$('#ribbon');
698
+ const curPath = String(this.$item?.path || '/').replace(/\/+$/, '') || '/';
699
+ const isSourceChat = Boolean(oldPath && (oldPath === curPath || oldPath.startsWith((curPath === '/' ? '' : curPath) + '/')));
700
+ if (isSourceChat || navigate) {
701
+ if (moved.mode === 'move' && oldKey && ribbon) {
702
+ for (const d of ribbon.$$('chat-day') || []) {
703
+ d._adopted?.delete?.(oldKey);
704
+ if (Array.isArray(d.logItems)) d.logItems = d.logItems.filter(it => !d._isMatchingTaskItem?.(it, oldKey));
705
+ }
706
+ }
707
+ await ribbon?.refreshFeed?.();
708
+ }
709
+ if (!navigate || this._navigatedMoveKey === key) return;
710
+ this._navigatedMoveKey = key;
711
+ const targetNodePath = String(moved.targetNodePath || '/').trim() || '/';
712
+ let targetItem = null;
713
+ try {
714
+ targetItem = targetNodePath === '/' ? globalThis.WORK : await globalThis.WORK.get_item(targetNodePath);
715
+ if (Array.isArray(targetItem)) targetItem = targetItem[targetItem.length - 1] || null;
716
+ } catch {
717
+ targetItem = null;
718
+ }
719
+ if (!targetItem) return;
720
+ const nav = {
721
+ view: 'chat',
722
+ openTaskPath: moved.newPath
723
+ };
724
+ if (window.top && window.top !== window && typeof window.top.execute === 'function') {
725
+ await window.top.execute(targetItem, nav);
726
+ return;
727
+ }
728
+ let formHost = null;
729
+ for (let p = this; p; p = p.parentElement || p.domHost || p.getRootNode?.()?.host) {
730
+ if (typeof p.openInForm === 'function') {
731
+ formHost = p;
732
+ break;
733
+ }
734
+ }
735
+ if (!formHost) {
736
+ const pf = document.querySelector?.('pages-form');
737
+ formHost = pf?.$?.('work-form') || pf || document.querySelector?.('work-form');
738
+ }
739
+ if (formHost && typeof formHost.openInForm === 'function') await formHost.openInForm(targetItem, nav);else if (typeof window.execute === 'function') await window.execute(targetItem, nav);
740
+ },
741
+ async openMovedTask(path) {
742
+ if (!path) return;
743
+ const ribbon = this.$('#ribbon');
744
+ if (!ribbon) return;
745
+ await ribbon.refreshDates?.(true);
746
+ await this._openCreated(path);
747
+ },
748
+ _bindChatSocket() {
749
+ if (this._onWsChatMsg) return;
750
+ globalThis.WORK.chatEvents ??= new EventTarget();
751
+ this._onWsChatMsg = ev => {
752
+ const d = ev?.detail;
753
+ const cur = this.$item;
754
+ if (!d || !cur) return;
755
+ const curPath = String(cur.path || '/').replace(/\/+$/, '') || '/';
756
+ const hitTwin = d.kind === 'twin' && d.nodePath === curPath;
757
+ const hitDm = d.kind === 'dm' && cur.type === '$user' && (d.message?.sender === cur.id || d.message?.sender === WORK.uid);
758
+ const hitThread = d.threadId && this.$('#ribbon')?._threadId === d.threadId;
759
+ if (hitTwin || hitDm || hitThread) {
760
+ this.$('#ribbon')?.refreshFeed?.();
761
+ if (d.threadId && ev.type === 'chat:message') {
762
+ cur.fetch?.('chat_mark_read', {
763
+ threadId: d.threadId
764
+ })?.then?.(res => WORK.applyChatReadLocal?.(res || {
765
+ threadId: d.threadId,
766
+ kind: d.kind,
767
+ nodePath: curPath,
768
+ peerId: cur.type === '$user' ? cur.id : ''
769
+ }))?.catch?.(() => {});
770
+ }
771
+ }
772
+ };
773
+ globalThis.WORK.chatEvents.addEventListener('chat:message', this._onWsChatMsg);
774
+ globalThis.WORK.chatEvents.addEventListener('chat:action', this._onWsChatMsg);
775
+ },
776
+ focusInput() {
777
+ this.$('work-prompt-bar')?.focusInput();
778
+ },
779
+ focusedItem: null,
780
+ feedMode: 'dialog',
781
+ showParticipants: false,
782
+ _canLocalFeed: false,
783
+ get participantsList() {
784
+ return Array.isArray(this.$pdp?.deptUsers) ? this.$pdp.deptUsers : [];
785
+ },
786
+ get participantsCount() {
787
+ return this.participantsList.length;
788
+ },
789
+ toggleParticipants() {
790
+ this.showParticipants = !this.showParticipants;
791
+ },
792
+ openParticipant(u) {
793
+ if (!u?.id || typeof window?.execute !== 'function') return;
794
+ this.showParticipants = false;
795
+ window.execute(u);
796
+ },
797
+ get showFeedModeToggle() {
798
+ return Boolean(this.$item && this.$item.type !== '$user' && this._canLocalFeed);
799
+ },
800
+ async _refreshCanLocalFeed(item = this.$item) {
801
+ if (!item || item.type === '$user') {
802
+ this._canLocalFeed = false;
803
+ return;
804
+ }
805
+ if (globalThis.WORK?.DEV_MODE) {
806
+ this._canLocalFeed = true;
807
+ return;
808
+ }
809
+ const key = (item.path || '') + '|' + (item.id || '');
810
+ try {
811
+ const cached = item.myRoles;
812
+ const roles = await Promise.resolve(cached !== undefined ? cached : item.fetch?.('roles')).catch(() => []);
813
+ const curKey = (this.$item?.path || '') + '|' + (this.$item?.id || '');
814
+ if (curKey !== key) return;
815
+ this._canLocalFeed = Array.isArray(roles) && roles.includes('BOSS');
816
+ } catch {
817
+ const curKey = (this.$item?.path || '') + '|' + (this.$item?.id || '');
818
+ if (curKey === key) this._canLocalFeed = false;
819
+ }
820
+ },
821
+ auditThreads: [],
822
+ auditSelectedId: '',
823
+ auditMessages: [],
824
+ setFeedMode(mode) {
825
+ const next = (mode === 'local' || mode === 'audit') && this.showFeedModeToggle ? mode : 'dialog';
826
+ if (this.feedMode === next) return;
827
+ this.feedMode = next;
828
+ if (next === 'audit') {
829
+ this.loadAuditThreads();
830
+ return;
831
+ }
832
+ this.$('#ribbon')?.refreshFeed?.();
833
+ },
834
+ async loadAuditThreads() {
835
+ if (!this.$item?.fetch) return;
836
+ try {
837
+ const list = await this.$item.fetch('chat_threads_list', {
838
+ mode: 'audit'
839
+ });
840
+ const raw = Array.isArray(list) ? list : [];
841
+ const uids = [...new Set(raw.flatMap(t => (t.participants || []).map(p => p.uid)).filter(Boolean))];
842
+ const users = uids.length && typeof WORK.usersByIds === 'function' ? await WORK.usersByIds(uids).catch(() => []) : [];
843
+ const nameMap = Object.fromEntries((users || []).filter(Boolean).map(u => [u.id, u.label || u.DATA?.label || u.id]));
844
+ this.auditThreads = raw.map(t => {
845
+ const peer = (t.participants || []).find(p => p.uid !== '$twin') || t.participants?.[0];
846
+ const roleHint = peer?.role === 'client' ? ' (Клиент)' : '';
847
+ return {
848
+ ...t,
849
+ peerLabel: (nameMap[peer?.uid] || peer?.uid || t.title || t.id) + roleHint
850
+ };
851
+ });
852
+ if (this.auditThreads.length && !this.auditSelectedId) await this.openAuditThread(this.auditThreads[0]);
853
+ } catch {
854
+ this.auditThreads = [];
855
+ }
856
+ },
857
+ async openAuditThread(thread) {
858
+ if (!thread?.id || !this.$item?.fetch) return;
859
+ this.auditSelectedId = thread.id;
860
+ try {
861
+ const res = await this.$item.fetch('chat_messages_list', {
862
+ threadId: thread.id,
863
+ limit: 100
864
+ });
865
+ this.auditMessages = Array.isArray(res?.messages) ? res.messages : [];
866
+ } catch {
867
+ this.auditMessages = [];
868
+ }
869
+ },
870
+ async resolveApprovalMsg(msg, action) {
871
+ if (!msg?.id || !this.auditSelectedId || !this.$item?.fetch) return;
872
+ try {
873
+ await this.$item.fetch('chat_action', {
874
+ threadId: this.auditSelectedId,
875
+ messageId: msg.id,
876
+ action
877
+ });
878
+ await this.openAuditThread({
879
+ id: this.auditSelectedId
880
+ });
881
+ } catch {/* ignore */}
882
+ },
883
+ async _ownCabinet() {
884
+ const uid = globalThis.WORK?.uid;
885
+ if (!uid || typeof globalThis.WORK?.get_item !== 'function') return null;
886
+ return globalThis.WORK.get_item('/USERS//' + uid).catch(() => null);
887
+ },
888
+ _isAccessError(err) {
889
+ return /доступ запрещ|forbidden|\b403\b/i.test(String(err?.message || err || ''));
890
+ },
891
+ async _runWithCabinetFallback(fn) {
892
+ const primary = this.$pdp?.$item || this.$item;
893
+ return {
894
+ target: primary,
895
+ result: await fn(primary)
896
+ };
897
+ },
898
+ $item: {
899
+ $def: null,
900
+ set(n) {
901
+ const changed = Boolean(this._prevItem && this._prevItem !== n);
902
+ this._prevItem = n;
903
+ this.feedMode = 'dialog';
904
+ this._canLocalFeed = false;
905
+ this._refreshCanLocalFeed(n);
906
+ if (changed) this.$('#ribbon')?.refreshFeed?.();
907
+ }
908
+ },
909
+ taskItem: null,
910
+ data: null,
911
+ streams: {},
912
+ status: 'idle',
913
+ __microchatShell: true,
914
+ voiceOn: {
915
+ $def: false,
916
+ set(v) {
917
+ this.async(() => {
918
+ const bar = this.$('work-prompt-bar');
919
+ if (!v || !this._voice) {
920
+ bar?.setDialogLevel?.(0);
921
+ return;
922
+ }
923
+ this._voice.addEventListener('level', e => {
924
+ if (this._voice?.state !== 'speaking') bar?.setDialogLevel?.(e.detail);
925
+ });
926
+ this._voice.addEventListener('speechlevel', e => {
927
+ if (this._voice?.state === 'speaking') bar?.setDialogLevel?.(e.detail);
928
+ });
929
+ });
930
+ }
931
+ },
932
+ get canVoice() {
933
+ return !!(navigator.mediaDevices?.getUserMedia || window.SpeechRecognition || window.webkitSpeechRecognition);
934
+ },
935
+ toast(msg) {
936
+ ODA.showMessage?.(String(msg || ''));
937
+ },
938
+ async toggleVoice(on) {
939
+ const want = typeof on === 'boolean' ? on : !this.voiceOn;
940
+ if (!want) {
941
+ this._voice?.disable();
942
+ this.voiceOn = false;
943
+ return;
944
+ }
945
+ await Promise.all([import('/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-ui.js'), import('/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice.js').then(m => {
946
+ this._VoiceController = m.VoiceController;
947
+ })]);
948
+ if (!this._VoiceController) return;
949
+ this._voice ??= new this._VoiceController(this);
950
+ this.voiceOn = await this._voice.enable();
951
+ },
952
+ async sendVoiceText(text, {
953
+ voice = true,
954
+ interrupt = true,
955
+ spokenText
956
+ } = {}) {
957
+ text = String(text ?? '').trim();
958
+ if (!text) return;
959
+ if (this.taskItem) {
960
+ let tz = '';
961
+ try {
962
+ tz = Intl.DateTimeFormat().resolvedOptions().timeZone || '';
963
+ } catch {/* ignore */}
964
+ const geo = await Promise.race([Promise.resolve(this._geo?.()).catch(() => null), new Promise(r => setTimeout(() => r(this._geoFix || null), 150))]);
965
+ const location = geo && geo.lat != null && geo.lon != null ? {
966
+ lat: geo.lat,
967
+ lon: geo.lon,
968
+ ...(tz ? {
969
+ tz
970
+ } : {})
971
+ } : tz ? {
972
+ tz
973
+ } : null;
974
+ const payload = JSON.stringify({
975
+ prompt: text,
976
+ attachments: [],
977
+ ...(location ? {
978
+ location,
979
+ ...(tz ? {
980
+ tz
981
+ } : {})
982
+ } : {}),
983
+ ...(voice ? {
984
+ voice: true
985
+ } : {}),
986
+ ...(interrupt ? {
987
+ interrupt: true
988
+ } : {}),
989
+ ...(spokenText !== undefined ? {
990
+ spokenText
991
+ } : {})
992
+ });
993
+ await this.taskItem.fetch('prompt', {}, payload);
994
+ return;
995
+ }
996
+ await this._createTask({
997
+ text,
998
+ files: [],
999
+ draft: {
1000
+ value: '',
1001
+ files: [],
1002
+ reply: null
1003
+ },
1004
+ voice: true
1005
+ });
1006
+ },
1007
+ awaitTask: false,
1008
+ ttsMode: {
1009
+ $def: 'off',
1010
+ $save: true
1011
+ },
1012
+ async send() {
1013
+ // Один send за раз: повторные Enter/клики игнорируются, иначе каждый клик создаст свою задачу-дубликат.
1014
+ if (this._sending) return;
1015
+ const files = this.$('work-prompt-bar')?.files ?? this.files;
1016
+ if (!(this.value || files.length)) return;
1017
+ chatDebug('send: клик');
1018
+ this.$('#ribbon').scrollDown = true;
1019
+ const text = String(this.value ?? '').trim();
1020
+ const list = [...files];
1021
+ // Черновик на случай сбоя: поле очищается до сохранения — при ошибке вернуть текст и вложения.
1022
+ const draft = {
1023
+ value: this.value,
1024
+ files: list,
1025
+ reply: this.$pdp.replyTarget
1026
+ };
1027
+ this._sending = true;
1028
+ try {
1029
+ if (this.isAIMode) {
1030
+ // экран «создаю задачу» — сразу, до любых запросов: человек видит, что процесс пошёл
1031
+ this.clear();
1032
+ await this._createTask({
1033
+ text,
1034
+ files: list,
1035
+ draft
1036
+ });
1037
+ } else {
1038
+ const params = {
1039
+ encoding: 'utf-8'
1040
+ };
1041
+ if (WORK.uid) params.sender = WORK.uid;
1042
+ if (this.$pdp.isPrivate && this.$pdp.$item.id !== WORK.uid) params.receivers = [this.$pdp.$item.id];else if (this.$pdp.receivers.length) params.receivers = this.$pdp.receivers.map(u => u.id);
1043
+ const uploadedPaths = [];
1044
+ const isForeignDm = Boolean(this.$pdp.isPrivate && this.$pdp.$item?.id && this.$pdp.$item.id !== WORK.uid);
1045
+ const runWrite = typeof this._runWithCabinetFallback === 'function' ? fn => this._runWithCabinetFallback(fn) : async fn => ({
1046
+ target: this.$pdp.$item,
1047
+ result: await fn(this.$pdp.$item)
1048
+ });
1049
+ await runWrite(async target => {
1050
+ uploadedPaths.length = 0;
1051
+ const uploadTarget = isForeignDm ? (await this._ownCabinet()) || target : target;
1052
+ if (list.length) {
1053
+ const formData = new FormData();
1054
+ for (const file of list) formData.append('file', file, file.name);
1055
+ const fileParams = text || isForeignDm ? {
1056
+ ...params,
1057
+ ignore_save_logs: true
1058
+ } : params;
1059
+ const savedLogs = await uploadTarget.save_files(formData, fileParams);
1060
+ const arr = Array.isArray(savedLogs) ? savedLogs : savedLogs ? [savedLogs] : [];
1061
+ for (const l of arr) {
1062
+ const p = await pathOfLog(l);
1063
+ if (p) uploadedPaths.push(p.startsWith('/') ? p : '/' + p);
1064
+ }
1065
+ }
1066
+ if (text && !isForeignDm) {
1067
+ const msgParams = {
1068
+ ...params,
1069
+ message: text
1070
+ };
1071
+ if (uploadedPaths.length) msgParams.includes = JSON.stringify(uploadedPaths);
1072
+ await target.fetch('save_message', msgParams);
1073
+ }
1074
+ const chatTarget = this.$pdp.$item || target;
1075
+ if (chatTarget?.fetch && (text || uploadedPaths.length)) {
1076
+ const chatPayload = {
1077
+ kind: this.$pdp.isPrivate ? 'dm' : 'twin',
1078
+ ...(this.$pdp.isPrivate ? {
1079
+ peerId: this.$pdp.$item?.id || WORK.uid
1080
+ } : {}),
1081
+ message: text,
1082
+ attachments: uploadedPaths.map(p => ({
1083
+ path: p,
1084
+ name: p.split('/').pop() || 'file'
1085
+ }))
1086
+ };
1087
+ await chatTarget.fetch('chat_send', {}, JSON.stringify(chatPayload))?.catch?.(() => {});
1088
+ }
1089
+ });
1090
+ this.clear();
1091
+ this.$('#ribbon')?.refreshFeed?.();
1092
+ }
1093
+ } catch (err) {
1094
+ console.warn('[chat] send', err);
1095
+ // Сбой — черновик не теряем: текст и вложения обратно в поле.
1096
+ this.value = draft.value;
1097
+ this.files = draft.files;
1098
+ this.$pdp.replyTarget = draft.reply;
1099
+ ODA.showMessage?.('Не удалось отправить: ' + (err?.message || err));
1100
+ this.focusInput();
1101
+ } finally {
1102
+ this._sending = false;
1103
+ }
1104
+ this.$('#ribbon').scrollDown = true;
1105
+ },
1106
+ _collectKnownLogKeys() {
1107
+ const ribbon = this.$('#ribbon');
1108
+ const known = new Set();
1109
+ for (const d of ribbon?.$$?.('chat-day') || []) {
1110
+ for (const it of d.logItems || []) {
1111
+ if (it?.id) known.add(String(it.id));
1112
+ const tk = taskKeyOf(it?.logRow?.path || it?.path || it?.id);
1113
+ if (tk) known.add(tk);
1114
+ }
1115
+ }
1116
+ return known;
1117
+ },
1118
+ /**
1119
+ * Создание задачи: экран «создаю» → вложения → сохранение → явный запуск агента → карточка открыта по пути из ответа.
1120
+ * resume — задача уже создана (повтор запуска после сбоя), второй не создаётся.
1121
+ */
1122
+ async _createTask({
1123
+ text,
1124
+ files,
1125
+ draft,
1126
+ voice = false
1127
+ }) {
1128
+ this.awaitTask = true;
1129
+ this._awaitingLogExpand = false;
1130
+ this._awaitTaskPath = '';
1131
+ this._awaitTaskKey = '';
1132
+ this._awaitKnown = this._collectKnownLogKeys?.() || new Set();
1133
+ clearTimeout(this._awaitTimer);
1134
+ const item = this.$pdp.$item;
1135
+ try {
1136
+ const rawName = String(text || '').trim() || (files || []).map(f => f?.name).filter(Boolean).join(', ');
1137
+ const name = String(rawName).replace(/[<>:"/\\|?*\n\r]/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 90) || 'task';
1138
+ const useVoice = voice || !!this.voiceOn;
1139
+ let tz = '';
1140
+ try {
1141
+ tz = Intl.DateTimeFormat().resolvedOptions().timeZone || '';
1142
+ } catch {/* ignore */}
1143
+ this._geo?.();
1144
+ const root = globalThis.top || globalThis;
1145
+ let geo = this._geoFix || root.__workGeoFix || null;
1146
+ if (!geo) {
1147
+ try {
1148
+ const raw = globalThis.localStorage?.getItem?.('WORK.geo-fix');
1149
+ if (raw) geo = JSON.parse(raw);
1150
+ } catch {/* ignore */}
1151
+ }
1152
+ const location = geo && geo.lat != null && geo.lon != null ? {
1153
+ lat: geo.lat,
1154
+ lon: geo.lon,
1155
+ ...(tz ? {
1156
+ tz
1157
+ } : {})
1158
+ } : tz ? {
1159
+ tz
1160
+ } : null;
1161
+ const body = {
1162
+ name,
1163
+ ...(text ? {} : {
1164
+ prompt: ''
1165
+ }),
1166
+ created: Date.now(),
1167
+ items: [],
1168
+ ...(location ? {
1169
+ location,
1170
+ ...(tz ? {
1171
+ tz
1172
+ } : {})
1173
+ } : {}),
1174
+ ...(useVoice ? {
1175
+ voice: true
1176
+ } : {})
1177
+ };
1178
+ if (this.model) body.model = this.model;
1179
+ const params = {
1180
+ encoding: 'utf-8',
1181
+ ...(text ? {} : {
1182
+ prompt: ''
1183
+ }),
1184
+ ...(location ? {
1185
+ location: JSON.stringify(location),
1186
+ ...(tz ? {
1187
+ tz
1188
+ } : {})
1189
+ } : {}),
1190
+ ...(useVoice ? {
1191
+ voice: true
1192
+ } : {})
1193
+ };
1194
+ if (globalThis.WORK?.uid) params.sender = globalThis.WORK.uid;
1195
+ const canLookupTask = typeof globalThis.WORK?.get_item === 'function';
1196
+ const runWrite = typeof this._runWithCabinetFallback === 'function' ? fn => this._runWithCabinetFallback(fn) : async fn => ({
1197
+ target: item,
1198
+ result: await fn(item)
1199
+ });
1200
+ const {
1201
+ target: writeTarget,
1202
+ result: log
1203
+ } = await runWrite(async targetItem => {
1204
+ const saveParams = {
1205
+ ...params
1206
+ };
1207
+ if (files.length && !canLookupTask) {
1208
+ const preAttachments = [];
1209
+ await Promise.all(files.map(async file => {
1210
+ const fLog = await targetItem.save_file(file, {
1211
+ encoding: 'utf-8',
1212
+ ignore_save_logs: true
1213
+ });
1214
+ const fPath = await pathOfLog(fLog);
1215
+ if (fPath) preAttachments.push({
1216
+ path: fPath.startsWith('/') ? fPath : '/' + fPath,
1217
+ name: file.name
1218
+ });
1219
+ }));
1220
+ if (preAttachments.length) {
1221
+ saveParams.includes = JSON.stringify(preAttachments.map(a => a.path));
1222
+ saveParams.attachments = JSON.stringify(preAttachments);
1223
+ }
1224
+ }
1225
+ // Сначала создаём саму задачу, чтобы прикреплённые и создаваемые файлы размещались в папке этого таска
1226
+ if (files.length && canLookupTask) saveParams.skip_file_handler = true;
1227
+ return targetItem.save_file(new File([JSON.stringify(body, null, 2)], name + '.task', {
1228
+ type: 'application/json'
1229
+ }), saveParams);
1230
+ });
1231
+ const path = await pathOfLog(log);
1232
+ if (path && files.length && canLookupTask) {
1233
+ const createdTask = await globalThis.WORK.get_item(path).catch(() => null);
1234
+ const targetHolder = createdTask || writeTarget || item;
1235
+ const attachments = [];
1236
+ await Promise.all(files.map(async file => {
1237
+ const fLog = await targetHolder.save_file(file, {
1238
+ encoding: 'utf-8',
1239
+ ignore_save_logs: true,
1240
+ mainContext: path
1241
+ });
1242
+ const fPath = await pathOfLog(fLog);
1243
+ if (fPath) attachments.push({
1244
+ path: fPath.startsWith('/') ? fPath : '/' + fPath,
1245
+ name: file.name
1246
+ });
1247
+ }));
1248
+ if (attachments.length && createdTask) {
1249
+ const includePaths = attachments.map(a => a.path);
1250
+ await (writeTarget || item).fetch?.('append_log_includes', {
1251
+ entryPath: path,
1252
+ includePaths
1253
+ })?.catch?.(() => {});
1254
+ await createdTask.fetch?.('prompt', {}, JSON.stringify({
1255
+ prompt: text,
1256
+ attachments
1257
+ }))?.catch?.(() => {});
1258
+ }
1259
+ }
1260
+ if (path) {
1261
+ const threadItem = this.$pdp?.$item || item;
1262
+ threadItem?.fetch?.('chat_send', {}, JSON.stringify({
1263
+ kind: threadItem.type === '$user' ? 'dm' : 'twin',
1264
+ ...(threadItem.type === '$user' ? {
1265
+ peerId: threadItem.id
1266
+ } : {}),
1267
+ message: text,
1268
+ taskPath: path
1269
+ }))?.catch?.(() => {});
1270
+ this._awaitTaskPath = String(path);
1271
+ this._awaitTaskKey = taskKeyOf(path);
1272
+ await this._openCreated(path);
1273
+ if (useVoice && canLookupTask) {
1274
+ const createdTask = await globalThis.WORK.get_item(path).catch(() => null);
1275
+ if (createdTask) this._bindChatVoiceTask(createdTask);
1276
+ }
1277
+ } else {
1278
+ this.awaitTask = true;
1279
+ this._awaitNewTask('');
1280
+ }
1281
+ } catch (err) {
1282
+ console.warn('[chat] создание задачи', err);
1283
+ this.awaitTask = false;
1284
+ this._awaitingLogExpand = false;
1285
+ ODA.showMessage?.('Не удалось отправить: ' + (err?.message || err));
1286
+ this.value = draft.value;
1287
+ this.files = draft.files;
1288
+ this.$pdp.replyTarget = draft.reply;
1289
+ this.focusInput();
1290
+ }
1291
+ },
1292
+ /**
1293
+ * Карточка созданной задачи — раскрыта сразу по пути из ответа сервера: .task-файл кладётся в ленту дня
1294
+ * (chat-day.adoptTask), события ленты не ждём. Не вышло — прежний путь: ждать запись ленты (_awaitNewTask).
1295
+ */
1296
+ async _openCreated(path) {
1297
+ const ribbon = this.$('#ribbon');
1298
+ const day = taskDayOf(path) || new Date().toLocalDay();
1299
+ try {
1300
+ if (!ribbon.dateList.includes(day)) {
1301
+ ribbon.dateList = [...ribbon.dateList, day].sort();
1302
+ ribbon.render();
1303
+ }
1304
+ let dayEl = null;
1305
+ for (let i = 0; i < 40 && !dayEl; i++) {
1306
+ dayEl = [...(ribbon.$$('chat-day') || [])].find(d => d.day === day);
1307
+ if (!dayEl) await sleep(50);
1308
+ }
1309
+ if (!dayEl) throw new Error('нет дня в ленте: ' + day);
1310
+ const file = await WORK.get_item(path);
1311
+ if (!file || Array.isArray(file)) throw new Error('нет файла задачи: ' + path);
1312
+ await dayEl.adoptTask(file);
1313
+ this.awaitTask = false;
1314
+ this._awaitingLogExpand = false;
1315
+ this._awaitTaskPath = '';
1316
+ this._awaitTaskKey = '';
1317
+ this._awaitKnown = null;
1318
+ clearTimeout(this._awaitTimer);
1319
+ } catch (err) {
1320
+ console.warn('[chat] открыть созданную задачу напрямую не вышло — ждём запись ленты:', err?.message || err);
1321
+ if (!this._awaitKnown?.size) this._awaitKnown = this._collectKnownLogKeys();
1322
+ this.awaitTask = true;
1323
+ this._awaitNewTask(path);
1324
+ }
1325
+ },
1326
+ _bindChatVoiceTask(task) {
1327
+ if (this.taskItem && this._chatTaskH) {
1328
+ for (const [k, fn] of Object.entries(this._chatTaskH)) this.taskItem.unlisten?.(k, fn);
1329
+ }
1330
+ this.taskItem = task;
1331
+ this.streams = {};
1332
+ if (!task) return;
1333
+ const reload = async () => {
1334
+ try {
1335
+ const raw = await task.load();
1336
+ const data = typeof raw === 'string' ? JSON.parse(raw || '{}') : raw || {};
1337
+ this.data = data;
1338
+ this.status = data.status || 'idle';
1339
+ this._voice?.onData(data);
1340
+ } catch {/* ignore */}
1341
+ };
1342
+ this._chatTaskH = {
1343
+ 'changed': () => reload(),
1344
+ 'chat.done': () => reload(),
1345
+ 'task.state': e => {
1346
+ const s = e.detail?.value?.status;
1347
+ if (s) this.status = s;
1348
+ },
1349
+ 'task.delta': e => {
1350
+ const d = e.detail?.value;
1351
+ if (!d?.item || !d.token) return;
1352
+ const cur = this.streams[d.item] || {};
1353
+ const field = d.field === 'reasoning' ? 'reasoning' : 'content';
1354
+ this.streams = {
1355
+ ...this.streams,
1356
+ [d.item]: {
1357
+ ...cur,
1358
+ [field]: (cur[field] || '') + d.token
1359
+ }
1360
+ };
1361
+ this.status = 'running';
1362
+ this._voice?.onDelta({
1363
+ item: d.item,
1364
+ field
1365
+ });
1366
+ }
1367
+ };
1368
+ for (const [k, fn] of Object.entries(this._chatTaskH)) task.listen?.(k, fn);
1369
+ reload();
1370
+ },
1371
+ /**
1372
+ * Новая задача сохранена: день — из пути файла (…/YYYY-MM-DD/….task), а не из часов браузера.
1373
+ * Нет дня в ленте — добавить (chat-day раскроет карточку, пока awaitTask). Страховка: 15 с — снять ожидание.
1374
+ * _awaitTaskKey — имя файла задачи: точный ключ карточки (chat-task.js), не зависит от времени и префикса пути.
1375
+ */
1376
+ _awaitNewTask(path) {
1377
+ const day = taskDayOf(path);
1378
+ const ribbon = this.$('#ribbon');
1379
+ if (day && ribbon && !ribbon.dateList.includes(day)) {
1380
+ ribbon.dateList = [...ribbon.dateList, day].sort();
1381
+ ribbon.render();
1382
+ }
1383
+ this._awaitTaskPath = String(path || '');
1384
+ this._awaitTaskKey = taskKeyOf(path);
1385
+ this._awaitingLogExpand = true;
1386
+ // Ретрай: вызываем _expandCreatedTask на всех видимых днях (найдёт по времени).
1387
+ for (const el of ribbon?.$$?.('chat-day') || []) el?._expandCreatedTask?.();
1388
+ clearTimeout(this._awaitTimer);
1389
+ this._awaitTimer = setTimeout(() => {
1390
+ if (!this.awaitTask) return;
1391
+ this.awaitTask = false;
1392
+ this._awaitingLogExpand = false;
1393
+ this._awaitTaskPath = '';
1394
+ this._awaitTaskKey = '';
1395
+ this._awaitKnown = null;
1396
+ ODA.showMessage?.('Задача создана' + (path ? ': ' + path : '') + ' — карточка не появилась в ленте, откройте из журнала');
1397
+ }, 15000);
1398
+ },
1399
+ /**
1400
+ * Геопозиция для запроса: уже известная (30 минут) или запрашивается при открытии чата. Отправку она не держит:
1401
+ * getCurrentPosition не имеет тайм-аута, пока человек не ответил на запрос разрешения, — свои 6 с; отказ помним 30 минут.
1402
+ */
1403
+ _geo() {
1404
+ const now = Date.now();
1405
+ const TTL = 30 * 60 * 1000;
1406
+ if (this._geoFix && now - (this._geoFix.at || 0) < TTL) return this._geoFix;
1407
+ this._geoFix = null;
1408
+ if (!navigator.geolocation || this._geoDeniedAt && now - this._geoDeniedAt < TTL) return null;
1409
+ if (this._geoWait) return this._geoWait;
1410
+ let finished = false;
1411
+ const promise = new Promise(resolve => {
1412
+ const finish = (pos, denied = false) => {
1413
+ if (finished) return;
1414
+ finished = true;
1415
+ clearTimeout(timer);
1416
+ this._geoWait = null;
1417
+ if (pos) {
1418
+ this._geoFix = pos;
1419
+ try {
1420
+ const root = globalThis.top || globalThis;
1421
+ root.__workGeoFix = pos;
1422
+ globalThis.__workGeoFix = pos;
1423
+ globalThis.localStorage?.setItem?.('WORK.geo-fix', JSON.stringify(pos));
1424
+ } catch {/* ignore */}
1425
+ }
1426
+ if (denied) this._geoDeniedAt = Date.now();
1427
+ resolve(pos);
1428
+ };
1429
+ const timer = setTimeout(() => {
1430
+ chatDebug('геопозиция: ответа нет');
1431
+ finish(null);
1432
+ }, 6000);
1433
+ navigator.geolocation.getCurrentPosition(p => finish({
1434
+ lat: p.coords.latitude,
1435
+ lon: p.coords.longitude,
1436
+ at: Date.now()
1437
+ }), err => {
1438
+ chatDebug('геопозиция недоступна:', err?.message || err);
1439
+ finish(null, err?.code === 1);
1440
+ }, {
1441
+ enableHighAccuracy: false,
1442
+ maximumAge: 300000,
1443
+ timeout: 4000
1444
+ });
1445
+ });
1446
+ // колбэк мог сработать синхронно (finished) — тогда запоминать ожидание нельзя: оно залипло бы навсегда
1447
+ if (!finished) this._geoWait = promise;
1448
+ return promise;
1449
+ }
1450
+ });
1451
+ ODA({
1452
+ is: 'chat-ribbon',
1453
+ template: /* html */`
1454
+ <style>
1455
+ :host{
1456
+ position: relative;
1457
+ @apply --light;
1458
+ @apply --vertical;
1459
+ @apply --flex;
1460
+ overflow-x: hidden;
1461
+ overflow-y: auto;
1462
+ scroll-behavior: smooth;
1463
+ flex-direction: column-reverse;
1464
+ background: transparent;
1465
+ --chat-card-max: {{ribbonHeight > 0 ? Math.round(ribbonHeight * 0.9) + 'px' : '90vh'}};
1466
+ }
1467
+ #ribbon{
1468
+ overflow: visible;
1469
+ height: max-content;
1470
+ @apply --vertical;
1471
+ position: relative;
1472
+ gap: 2px;
1473
+ }
1474
+ </style>
1475
+ <div id="ribbon" vertical flex>
1476
+ <div flex></div>
1477
+ <chat-day ~for="dates" :day="$for.item"></chat-day>
1478
+ </div>
1479
+
1480
+ `,
1481
+ $item: {
1482
+ $def: null,
1483
+ set(n) {
1484
+ if (this._prevRibbonItem && this._prevRibbonItem !== n) {
1485
+ this._prevRibbonItem = n;
1486
+ this.refreshFeed();
1487
+ } else {
1488
+ this._prevRibbonItem = n;
1489
+ }
1490
+ }
1491
+ },
1492
+ ribbonHeight: 0,
1493
+ attached() {
1494
+ this.async(() => {
1495
+ this.ribbonHeight = this.clientHeight - 8;
1496
+ });
1497
+ },
1498
+ get lastDay() {
1499
+ return this.$$('chat-day').last;
1500
+ },
1501
+ lastIdxHistory: -1,
1502
+ async getFromHistory(value, direction = -1) {
1503
+ let history = await this.history;
1504
+ let lastInHistory = history[this.lastIdxHistory];
1505
+ if (value && value != lastInHistory) return value;
1506
+ let idx = this.lastIdxHistory + direction;
1507
+ if (idx < 0) idx = history.length - 1;else if (idx > history.length - 1) idx = 0;
1508
+ this.lastIdxHistory = idx;
1509
+ return history[idx];
1510
+ },
1511
+ get history() {
1512
+ return Promise.resolve(this.lastDay?.logs).then(async items => {
1513
+ if (!Array.isArray(items)) return [];
1514
+ const result = [];
1515
+ for (const file of items) {
1516
+ if (typeof file?.load !== 'function') continue;
1517
+ let raw;
1518
+ try {
1519
+ raw = await file.load();
1520
+ } catch {
1521
+ continue;
1522
+ }
1523
+ const body = typeof raw === 'string' ? JSON.parse(raw) : raw;
1524
+ const ext = body?.ext || body?.path?.split('/').pop()?.split('.').pop();
1525
+ if (ext !== 'txt' && ext !== 'prompt' && ext !== 'msg') continue;
1526
+ const text = body.content != null ? String(body.content) : '';
1527
+ if (text && !result.has(text)) result.push(text);
1528
+ }
1529
+ return result;
1530
+ });
1531
+ },
1532
+ $listeners: {
1533
+ scroll(e) {
1534
+ if (this.clientHeight <= 0 || this._restoringScroll || this._wasHidden) return;
1535
+ this._savedScrollTop = this.scrollTop;
1536
+ const down = this.scrollTop > -10;
1537
+ if (this.scrollDown === down) return;
1538
+ this.scrollDown = down;
1539
+ this.render();
1540
+ },
1541
+ resize() {
1542
+ if (this.clientHeight <= 0) {
1543
+ this._wasHidden = true;
1544
+ return;
1545
+ }
1546
+ const nextHeight = this.clientHeight - 8;
1547
+ if (nextHeight > 0 && this.ribbonHeight !== nextHeight) this.ribbonHeight = nextHeight;
1548
+ if (this._wasHidden) {
1549
+ this._wasHidden = false;
1550
+ this.restoreScrollPosition();
1551
+ }
1552
+ }
1553
+ },
1554
+ scrollDown: true,
1555
+ _savedScrollTop: 0,
1556
+ _wasHidden: false,
1557
+ _restoringScroll: false,
1558
+ restoreScrollPosition(targetTop = this._savedScrollTop) {
1559
+ if (typeof targetTop !== 'number' || this.clientHeight <= 0) return;
1560
+ this._wasHidden = false;
1561
+ this._restoringScroll = true;
1562
+ const apply = () => {
1563
+ if (this.clientHeight <= 0) return;
1564
+ const prevBehavior = this.style.scrollBehavior;
1565
+ this.style.scrollBehavior = 'auto';
1566
+ this.scrollTop = targetTop;
1567
+ this.style.scrollBehavior = prevBehavior;
1568
+ };
1569
+ apply();
1570
+ requestAnimationFrame(() => {
1571
+ apply();
1572
+ this._restoringScroll = false;
1573
+ });
1574
+ },
1575
+ get ribbon() {
1576
+ return this;
1577
+ },
1578
+ dateList: [],
1579
+ _datesWatch: null,
1580
+ _lastRole: '',
1581
+ _listenedSource: null,
1582
+ get activeRole() {
1583
+ return this.$item?.role || 'USER';
1584
+ },
1585
+ get isLocalFeed() {
1586
+ return this.$pdp?.feedMode === 'local';
1587
+ },
1588
+ get isDialogFeed() {
1589
+ return !this.isLocalFeed && this.$pdp?.feedMode !== 'audit';
1590
+ },
1591
+ _threadId: '',
1592
+ _threadMessages: [],
1593
+ _threadMessagesByDay: null,
1594
+ _localDayOf(ms) {
1595
+ const dt = new Date(Number(ms) || Date.now());
1596
+ if (typeof dt.toLocalDay === 'function') return dt.toLocalDay();
1597
+ const y = dt.getFullYear();
1598
+ const m = String(dt.getMonth() + 1).padStart(2, '0');
1599
+ const d = String(dt.getDate()).padStart(2, '0');
1600
+ return `${y}-${m}-${d}`;
1601
+ },
1602
+ threadMessagesForDay(day) {
1603
+ if (!day || !(this._threadMessagesByDay instanceof Map)) return [];
1604
+ return this._threadMessagesByDay.get(day) || [];
1605
+ },
1606
+ async _resolveLogsSource() {
1607
+ return this.$item || null;
1608
+ },
1609
+ _syncSourceListeners(source) {
1610
+ if (this._listenedSource === source) return;
1611
+ if (this._listenedSource && this._listenedSource !== this.$item) this._listenedSource.unlisten?.('changed', this.onChanged);
1612
+ this._listenedSource = source || null;
1613
+ if (source && source !== this.$item) source.listen?.('changed', this.onChanged);
1614
+ },
1615
+ async refreshFeed() {
1616
+ this.dateList = [];
1617
+ await this.refreshDates(true);
1618
+ for (const dayEl of this.$$('chat-day') || []) {
1619
+ dayEl._logsInit = false;
1620
+ dayEl._ensureLogsInit?.();
1621
+ }
1622
+ },
1623
+ async refreshDates(force = false) {
1624
+ if (!this.$item) return false;
1625
+ const curRole = this.activeRole;
1626
+ if (this._lastRole && this._lastRole !== curRole) {
1627
+ this.dateList = [];
1628
+ }
1629
+ this._lastRole = curRole;
1630
+ const source = (await this._resolveLogsSource()) || this.$item;
1631
+ this._syncSourceListeners(source);
1632
+ source.invalidate?.('logs_dates');
1633
+ const logsPromise = source.fetch('logs', {
1634
+ mode: 'dates',
1635
+ nonEmpty: 1,
1636
+ ...(this.isLocalFeed ? {
1637
+ local: 1,
1638
+ feedMode: 'local'
1639
+ } : {
1640
+ feedMode: 'dialog'
1641
+ }),
1642
+ role: curRole,
1643
+ uid: WORK.uid || ''
1644
+ }).catch(() => []);
1645
+ const threadPromise = this.isDialogFeed && typeof this.$item.fetch === 'function' ? this.$item.fetch('chat_messages_list', {
1646
+ kind: this.$item.type === '$user' ? 'dm' : 'twin',
1647
+ ...(this.$item.type === '$user' ? {
1648
+ peerId: this.$item.id
1649
+ } : {}),
1650
+ limit: 200
1651
+ }).catch(() => null) : Promise.resolve(null);
1652
+ const [rawDates, threadRes] = await Promise.all([logsPromise, threadPromise]);
1653
+ // dates на сервере — по убыванию; в ленте дни — от старых к новым.
1654
+ const dateSet = new Set((Array.isArray(rawDates) ? rawDates : []).slice().reverse());
1655
+ const byDay = new Map();
1656
+ const msgs = Array.isArray(threadRes?.messages) ? threadRes.messages : [];
1657
+ this._threadId = threadRes?.thread?.id || '';
1658
+ this._threadMessages = msgs;
1659
+ for (const msg of msgs) {
1660
+ const d = this._localDayOf(msg.created);
1661
+ if (!d) continue;
1662
+ dateSet.add(d);
1663
+ let arr = byDay.get(d);
1664
+ if (!arr) {
1665
+ arr = [];
1666
+ byDay.set(d, arr);
1667
+ }
1668
+ arr.push(msg);
1669
+ }
1670
+ this._threadMessagesByDay = byDay;
1671
+ const curPath = String(this.$item.path || '/').replace(/\/+$/, '') || '/';
1672
+ const localUnread = this.$item.type === '$user' ? Number(WORK.chatUnread?.byPeer?.[this.$item.id]) || 0 : Number(WORK.chatUnread?.byNode?.[curPath]) || 0;
1673
+ if ((threadRes?.thread?.unreadCount > 0 || localUnread > 0) && threadRes?.thread?.id) {
1674
+ const fallbackInfo = {
1675
+ threadId: threadRes.thread.id,
1676
+ kind: this.$item.type === '$user' ? 'dm' : 'twin',
1677
+ nodePath: curPath,
1678
+ peerId: this.$item.type === '$user' ? this.$item.id : ''
1679
+ };
1680
+ this.$item.fetch?.('chat_mark_read', {
1681
+ threadId: threadRes.thread.id
1682
+ })?.then?.(res => WORK.applyChatReadLocal?.(res?.threadId ? res : fallbackInfo))?.catch?.(() => {});
1683
+ WORK.applyChatReadLocal?.(fallbackInfo);
1684
+ }
1685
+ let dates = [...dateSet].sort();
1686
+ // Пока создаётся новая задача (awaitTask), не сбрасываем локально добавленный _openCreated день
1687
+ if (!force && this.$pdp?.awaitTask && Array.isArray(this.dateList)) {
1688
+ for (const d of this.dateList) {
1689
+ if (d && !dates.includes(d)) dates.push(d);
1690
+ }
1691
+ dates.sort();
1692
+ }
1693
+ const prevDates = Array.isArray(this.dateList) ? this.dateList : [];
1694
+ if (prevDates.length !== dates.length || prevDates.some((d, i) => d !== dates[i])) {
1695
+ this.dateList = dates;
1696
+ this.render();
1697
+ return true;
1698
+ }
1699
+ return false;
1700
+ },
1701
+ get onChanged() {
1702
+ return () => this.refreshDates();
1703
+ },
1704
+ _ensureDatesWatch() {
1705
+ if (this._datesWatch) return this._datesWatch;
1706
+ this._datesWatch = this.refreshDates().then(() => {
1707
+ this.$item?.listen?.('changed', this.onChanged);
1708
+ });
1709
+ if (!this._rolePollTimer) {
1710
+ this._rolePollTimer = setInterval(() => {
1711
+ if (this.$item && this._lastRole && this.activeRole !== this._lastRole) {
1712
+ this.$pdp?._refreshCanLocalFeed?.();
1713
+ this.refreshFeed();
1714
+ }
1715
+ }, 400);
1716
+ }
1717
+ return this._datesWatch;
1718
+ },
1719
+ get dates() {
1720
+ this._ensureDatesWatch();
1721
+ return this.dateList;
1722
+ },
1723
+ detached() {
1724
+ this.$item?.unlisten?.('changed', this.onChanged);
1725
+ if (this._listenedSource && this._listenedSource !== this.$item) this._listenedSource.unlisten?.('changed', this.onChanged);
1726
+ this._listenedSource = null;
1727
+ if (this._rolePollTimer) {
1728
+ clearInterval(this._rolePollTimer);
1729
+ this._rolePollTimer = 0;
1730
+ }
1731
+ this._datesWatch = null;
1732
+ }
1733
+ });
1734
+ ODA({
1735
+ is: 'chat-day',
1736
+ template: /* html */`
1737
+ <style>
1738
+ :host{
1739
+ @apply --vertical;
1740
+ @apply --no-flex;
1741
+
1742
+ }
1743
+ :host([expanded]) .day-ribbon{
1744
+ transition: opacity 1s ease-in-out;
1745
+ opacity: 1;
1746
+ }
1747
+ .label{
1748
+ cursor: pointer;
1749
+ font-size: x-small;
1750
+ align-self: center;
1751
+ align-items: center;
1752
+ text-align: center;
1753
+ width: 150px;
1754
+ border-radius: 16px;
1755
+ padding: 0px 8px;
1756
+ z-index: 1;
1757
+ }
1758
+ .date-line{
1759
+ top: 4px;
1760
+ position: sticky;
1761
+ align-items: center;
1762
+ width: -webkit-fill-available;
1763
+ }
1764
+ .day-ribbon{
1765
+ gap: 8px;
1766
+ padding: 8px;
1767
+ opacity: 0;
1768
+ }
1769
+ </style>
1770
+ <div flex vertical class="date-line" center>
1771
+ <div class="label" raised dark horizontal :accent-invert="expanded" @tap="expanded = !expanded">
1772
+ <label flex style="padding: 0px 4px;">{{label}}</label>
1773
+ <oda-button icon-size="16" :icon="expanderIcon"></oda-button>
1774
+ </div>
1775
+ </div>
1776
+
1777
+ <div class="day-ribbon" flex vertical ~if="expanded">
1778
+ <chat-item @tap="setFocus" ~for="logs" :$item="$for.item"></chat-item>
1779
+ </div>
1780
+ `,
1781
+ get expanderIcon() {
1782
+ return this.expanded ? 'icons:chevron-right:90' : 'icons:chevron-right';
1783
+ },
1784
+ get last() {
1785
+ let dates = this.$pdp.dates;
1786
+ if (dates?.then) return dates.then(days => days.last === this.day);
1787
+ return dates?.last === this.day;
1788
+ },
1789
+ day: '',
1790
+ setFocus(e) {
1791
+ this.$pdp.focusedItem = e.target.$item;
1792
+ },
1793
+ expanded: {
1794
+ $def: false,
1795
+ $attr: true,
1796
+ get() {
1797
+ return this.last;
1798
+ }
1799
+ },
1800
+ logItems: [],
1801
+ _logsFolder: null,
1802
+ _logsInit: false,
1803
+ _logsInitPromise: null,
1804
+ _logsListenersHooked: false,
1805
+ _dayFolderHooked: false,
1806
+ _expandedTaskKey: '',
1807
+ _logItemTime(f) {
1808
+ if (!f) return 0;
1809
+ const st = SORT_TIMES.get(f);
1810
+ if (Number.isFinite(st) && st > 0) return st;
1811
+ const isProxyItem = Boolean(typeof f.fetch === 'function' || f.short);
1812
+ const rowTime = !isProxyItem ? Number(f.logRow?.time || f.DATA?.logRow?.time || 0) : 0;
1813
+ if (rowTime > 0) return rowTime;
1814
+ const idPrefix = parseInt(String(f.id || '').split('.')[0], 10);
1815
+ if (idPrefix > 0) return idPrefix;
1816
+ const pathMatch = String(f.path || '').match(/\/(\d{10,16})\.[^/]+$/);
1817
+ if (pathMatch) return parseInt(pathMatch[1], 10) || 0;
1818
+ return 0;
1819
+ },
1820
+ _sortLogFiles(files) {
1821
+ return files.slice().sort((a, b) => {
1822
+ const ta = this._logItemTime(a);
1823
+ const tb = this._logItemTime(b);
1824
+ if (ta && tb && ta !== tb) return ta - tb;
1825
+ return String(a?.id || '') < String(b?.id || '') ? -1 : 1;
1826
+ });
1827
+ },
1828
+ _isMatchingTaskItem(it, key, fileId = '') {
1829
+ if (!it) return false;
1830
+ if (fileId && it.id === fileId) return true;
1831
+ if (!key) return false;
1832
+ return taskKeyOf(it.logRow?.path || it.path || it.id) === key || String(it.id || '').replace(/\.logs$/i, '.task') === key;
1833
+ },
1834
+ _syncExpandedTaskCard() {
1835
+ const key = this._expandedTaskKey;
1836
+ const cards = [...(this.$$('chat-item') || [])];
1837
+ if (!key) return;
1838
+ for (const c of cards) {
1839
+ const match = this._isMatchingTaskItem(c.$item, key);
1840
+ if (match && !c.expanded) c.expanded = true;else if (!match && c.expanded) c.expanded = false;
1841
+ }
1842
+ },
1843
+ async _dedupeLogFiles(files) {
1844
+ const seen = new Set();
1845
+ const result = [];
1846
+ for (const f of files) {
1847
+ let key = f?.id;
1848
+ if (typeof f?.load === 'function') {
1849
+ try {
1850
+ const raw = await f.load();
1851
+ const row = typeof raw === 'string' ? JSON.parse(raw) : raw;
1852
+ // Записи файлов из контекста задачи — только внутри её карточки, не отдельными карточками.
1853
+ if (row?.mainContext) continue;
1854
+ // задача, принятая в ленту напрямую (adoptTask), — карточка уже есть; запись журнала о ней не дублируем
1855
+ if (row?.ext === 'task' && this._adopted?.has(taskKeyOf(row.path))) continue;
1856
+ if (row?.path) key = row.path;
1857
+ } catch {/* skip */}
1858
+ }
1859
+ if (!key || seen.has(key)) continue;
1860
+ seen.add(key);
1861
+ result.push(f);
1862
+ }
1863
+ // принятые напрямую задачи в журнале дня могут ещё не появиться — не теряем их при перечитывании ленты
1864
+ for (const f of this._adopted?.values() || []) if (!result.some(r => r?.id === f.id)) result.push(f);
1865
+ return this._sortLogFiles(result);
1866
+ },
1867
+ /**
1868
+ * Принять только что созданную задачу в ленту дня сразу по её файлу: карточка раскрывается, не дожидаясь записи
1869
+ * журнала. Резолвится, когда форма задачи нарисована (до этого чат держит экран «создаю задачу»).
1870
+ */
1871
+ async adoptTask(file) {
1872
+ if (!this._logsInit) this._ensureLogsInit();
1873
+ if (this._logsInitPromise) await Promise.race([this._logsInitPromise, sleep(400)]).catch(() => {});
1874
+ const key = taskKeyOf(file.path) || String(file.id);
1875
+ if (!SORT_TIMES.has(file)) SORT_TIMES.set(file, this._logItemTime(file) || Date.now());
1876
+ this._expandedTaskKey = key;
1877
+ (this._adopted ??= new Map()).set(key, file);
1878
+ const isSameTask = it => this._isMatchingTaskItem(it, key, file.id);
1879
+ const filtered = (this.logItems || []).filter(it => !isSameTask(it));
1880
+ this.logItems = this._sortLogFiles([...filtered, file]);
1881
+ this.expanded = true;
1882
+ this.render();
1883
+ this._scrollRibbonDown();
1884
+ for (let i = 0; i < 60; i++) {
1885
+ const allCards = [...(this.$$('chat-item') || [])];
1886
+ const card = allCards.find(el => isSameTask(el.$item));
1887
+ if (card) {
1888
+ for (const other of allCards) {
1889
+ if (other !== card && other.expanded) other.expanded = false;
1890
+ }
1891
+ card.expanded = true;
1892
+ for (let j = 0; j < 30; j++) {
1893
+ if (card.$('.body > *')?.data) break;
1894
+ await new Promise(r => setTimeout(r, 50));
1895
+ }
1896
+ return true;
1897
+ }
1898
+ await new Promise(r => setTimeout(r, 50));
1899
+ }
1900
+ throw new Error('карточка задачи не появилась в ленте');
1901
+ },
1902
+ _scrollRibbonDown() {
1903
+ if (this.$pdp.ribbon?.scrollDown) {
1904
+ this.async(() => {
1905
+ if (this.$pdp.ribbon) {
1906
+ this.$pdp.ribbon._savedScrollTop = 0;
1907
+ this.$pdp.ribbon.scrollTop = 0;
1908
+ }
1909
+ }, 0);
1910
+ }
1911
+ },
1912
+ _wrapLogRow(row) {
1913
+ if (!row) return row;
1914
+ if (typeof row.load === 'function' && !row.logsFilePath && !row.DATA?.logsFilePath) return row;
1915
+ const rawRow = row.DATA?.logsFilePath ? {
1916
+ ...row.DATA
1917
+ } : row;
1918
+ const uid = rawRow.sender || 'system';
1919
+ const id = `${rawRow.time || 0}.${uid}.logs`;
1920
+ this._wrappedById ??= new Map();
1921
+ const existing = this._wrappedById.get(id);
1922
+ if (existing) {
1923
+ existing.logRow = rawRow;
1924
+ return existing;
1925
+ }
1926
+ const wrapped = {
1927
+ id,
1928
+ name: id,
1929
+ ext: 'logs',
1930
+ path: rawRow.logsFilePath || `/${id}`,
1931
+ logRow: rawRow,
1932
+ load: async () => ({
1933
+ ...(wrapped.logRow || rawRow)
1934
+ })
1935
+ };
1936
+ this._wrappedById.set(id, wrapped);
1937
+ return wrapped;
1938
+ },
1939
+ _wrapThreadMessage(msg) {
1940
+ if (!msg || !msg.id) return null;
1941
+ const id = `chatmsg.${msg.id}.msg`;
1942
+ this._wrappedById ??= new Map();
1943
+ const nodeLabel = this.$pdp?.$item?.DATA?.label || this.$pdp?.$item?.label || this.$pdp?.$item?.id || '';
1944
+ const enriched = {
1945
+ ...msg,
1946
+ nodeLabel
1947
+ };
1948
+ const rawRow = {
1949
+ time: msg.created || Date.now(),
1950
+ sender: msg.sender,
1951
+ content: msg.content || '',
1952
+ kind: msg.kind || 'text',
1953
+ includes: (msg.attachments || []).map(a => a.path).filter(Boolean),
1954
+ chatMessage: enriched
1955
+ };
1956
+ const existing = this._wrappedById.get(id);
1957
+ if (existing) {
1958
+ SORT_TIMES.set(existing, rawRow.time);
1959
+ existing.logRow = rawRow;
1960
+ return existing;
1961
+ }
1962
+ const wrapped = {
1963
+ id,
1964
+ name: id,
1965
+ ext: 'msg',
1966
+ path: '',
1967
+ logRow: rawRow,
1968
+ load: async () => ({
1969
+ ...(wrapped.logRow || rawRow)
1970
+ })
1971
+ };
1972
+ SORT_TIMES.set(wrapped, rawRow.time);
1973
+ this._wrappedById.set(id, wrapped);
1974
+ return wrapped;
1975
+ },
1976
+ async _bindLogsFolder() {
1977
+ const source = await Promise.resolve(this.logsSource);
1978
+ return !!source;
1979
+ },
1980
+ async _fetchLogFiles() {
1981
+ const source = await Promise.resolve(this.logsSource);
1982
+ if (!source) return [];
1983
+ const role = this.$pdp?.$item?.role || 'USER';
1984
+ const uid = WORK.uid || '';
1985
+ const local = this.$pdp?.isLocalFeed ? {
1986
+ local: 1,
1987
+ feedMode: 'local'
1988
+ } : {
1989
+ feedMode: 'dialog'
1990
+ };
1991
+ let rows = [];
1992
+ try {
1993
+ if (typeof source.fetch === 'function') rows = await source.fetch('logs', {
1994
+ mode: 'bodies',
1995
+ day: this.day,
1996
+ role,
1997
+ uid,
1998
+ ...local
1999
+ });else if (typeof source.logs === 'function') rows = await source.logs({
2000
+ mode: 'bodies',
2001
+ day: this.day,
2002
+ role,
2003
+ uid,
2004
+ ...local
2005
+ });
2006
+ } catch {
2007
+ rows = [];
2008
+ }
2009
+ if (!Array.isArray(rows)) rows = [];
2010
+ const hasVisibleRowPayload = r => {
2011
+ if (!r) return false;
2012
+ if (r.path || r.ext || r.chatMessage?.kind === 'approval') return true;
2013
+ if (String(r.content || '').trim()) return true;
2014
+ if (Array.isArray(r.includes) ? r.includes.length > 0 : Boolean(String(r.includes || '').trim())) return true;
2015
+ return false;
2016
+ };
2017
+ const files = rows.filter(hasVisibleRowPayload).map(r => this._wrapLogRow(r)).filter(f => f?.id?.endsWith?.('.logs') || f?.id?.endsWith?.('.task'));
2018
+ if (!this.$pdp?.isLocalFeed && typeof this.$pdp?.threadMessagesForDay === 'function') {
2019
+ const taskKeys = new Set(rows.map(r => taskKeyOf(r?.path)).filter(Boolean));
2020
+ for (const f of this._adopted?.values() || []) {
2021
+ const tk = taskKeyOf(f?.path || f?.id);
2022
+ if (tk) taskKeys.add(tk);
2023
+ }
2024
+ const msgs = this.$pdp.threadMessagesForDay(this.day);
2025
+ for (const m of msgs) {
2026
+ if (m.taskPath && taskKeys.has(taskKeyOf(m.taskPath))) continue;
2027
+ if (!String(m.content || '').trim() && !m.attachments?.length && m.kind !== 'approval') continue;
2028
+ if (m.sender !== '$twin' && m.kind === 'text' && rows.some(r => r?.sender === m.sender && String(r?.content || '').trim() === String(m.content || '').trim() && Math.abs((Number(r?.time) || 0) - (Number(m.created) || 0)) < 5000)) continue;
2029
+ const w = this._wrapThreadMessage(m);
2030
+ if (w) files.push(w);
2031
+ }
2032
+ }
2033
+ return this._dedupeLogFiles(this._sortLogFiles(files));
2034
+ },
2035
+ /**
2036
+ * Раскрыть карточку только что созданной задачи. Строго та, что создана: по имени файла .task;
2037
+ * пока путь неизвестен — только новая запись моего авторства, которой не было в ленте до отправки.
2038
+ * «Ближайшая по времени» не подходит: раскрывалась последняя прежняя задача (см. chat-task.js).
2039
+ */
2040
+ async _expandCreatedTask(file) {
2041
+ const chat = this.$pdp.$pdp;
2042
+ if (!chat?.awaitTask || !chat?._awaitingLogExpand) return;
2043
+ const day = taskDayOf(chat._awaitTaskPath);
2044
+ if (day && this.day !== day) return;
2045
+ const want = {
2046
+ key: chat._awaitTaskKey || '',
2047
+ known: chat._awaitKnown || new Set(),
2048
+ uid: WORK.uid
2049
+ };
2050
+ const loadRow = async f => {
2051
+ try {
2052
+ const raw = await f.load();
2053
+ return typeof raw === 'string' ? JSON.parse(raw) : raw;
2054
+ } catch {
2055
+ return null;
2056
+ }
2057
+ };
2058
+ let hit = null;
2059
+ let hitRow = null;
2060
+ for (const f of file ? [file] : this.logItems) {
2061
+ if (want.known.has(String(f?.id || ''))) continue;
2062
+ const row = await loadRow(f);
2063
+ const rowKey = taskKeyOf(row?.path || f?.path || f?.id);
2064
+ if (rowKey && want.known.has(rowKey)) continue;
2065
+ if (isCreatedTask(f, row, want)) {
2066
+ hit = f;
2067
+ hitRow = row;
2068
+ break;
2069
+ }
2070
+ }
2071
+ if (!hit) return;
2072
+ const hitKey = taskKeyOf(hitRow?.path || hit?.path || hit?.id) || String(hit.id || '').replace(/\.logs$/i, '.task');
2073
+ if (hitKey) this._expandedTaskKey = hitKey;
2074
+ // день мог быть свёрнут, карточка рисуется после render — ждём её появления
2075
+ if (!this.expanded) this.expanded = true;
2076
+ this.render();
2077
+ for (let i = 0; i < 30; i++) {
2078
+ const allCards = [...this.$$('chat-item')];
2079
+ const card = allCards.find(el => el.$item?.id === hit.id || hitKey && this._isMatchingTaskItem(el.$item, hitKey));
2080
+ if (card) {
2081
+ for (const other of allCards) {
2082
+ if (other !== card && other.expanded) other.expanded = false;
2083
+ }
2084
+ card.expanded = true;
2085
+ chat.awaitTask = false;
2086
+ chat._awaitingLogExpand = false;
2087
+ chat._awaitTaskPath = '';
2088
+ chat._awaitTaskKey = '';
2089
+ chat._awaitKnown = null;
2090
+ clearTimeout(chat._awaitTimer);
2091
+ return;
2092
+ }
2093
+ await new Promise(r => setTimeout(r, 50));
2094
+ }
2095
+ },
2096
+ async _onLogsChangedRun() {
2097
+ if (!this._logsInit) return;
2098
+ try {
2099
+ const items = await this._fetchLogFiles();
2100
+ const prev = Array.isArray(this.logItems) ? this.logItems : [];
2101
+ const prevLen = prev.length;
2102
+ const sameList = prev.length === items.length && items.every((it, idx) => it === prev[idx] || it?.id && it.id === prev[idx]?.id);
2103
+ if (!sameList) {
2104
+ this.logItems = items;
2105
+ this.render();
2106
+ this._syncExpandedTaskCard();
2107
+ if (items.length > prevLen) this._scrollRibbonDown();
2108
+ }
2109
+ await this._expandCreatedTask();
2110
+ } catch (err) {
2111
+ console.warn('[chat-day] log changed', err);
2112
+ }
2113
+ },
2114
+ _onLogsChanged(e) {
2115
+ this._lastChangedEvent = e;
2116
+ this.debounce('chat-day-logs', () => this._onLogsChangedRun(this._lastChangedEvent), 30);
2117
+ },
2118
+ _ensureLogsInit() {
2119
+ if (this._logsInit) return this._logsInitPromise;
2120
+ this._logsInit = true;
2121
+ this._wasInit = true;
2122
+ this._logsInitPromise = Promise.resolve(this.logsSource).then(async source => {
2123
+ if (!source) return;
2124
+ if (!this._logsListenersHooked) {
2125
+ this._logsListenersHooked = true;
2126
+ const onChanged = this._onChangedFn = e => this._onLogsChanged(e);
2127
+ this._listened = [source, this.$pdp.$item].filter(Boolean);
2128
+ source?.listen?.('changed', onChanged);
2129
+ if (this.$pdp.$item && this.$pdp.$item !== source) this.$pdp.$item?.listen?.('changed', onChanged);
2130
+ }
2131
+ this.logItems = await this._fetchLogFiles();
2132
+ this.render();
2133
+ this._syncExpandedTaskCard();
2134
+ this._scrollRibbonDown();
2135
+ await this._expandCreatedTask();
2136
+ }).catch(e => {
2137
+ console.warn('[chat-day] logs', e.message);
2138
+ this._logsInit = false;
2139
+ });
2140
+ return this._logsInitPromise;
2141
+ },
2142
+ get logs() {
2143
+ this._ensureLogsInit();
2144
+ return this.logItems;
2145
+ },
2146
+ /** День вернули в DOM после снятия подписок — подписаться заново (день, который не открывали, ленту не грузит). */
2147
+ attached() {
2148
+ if (this._wasInit && !this._logsInit) this._ensureLogsInit();
2149
+ },
2150
+ /** Снять подписки на ленту: день убрали из DOM — события больше не нужны (иначе копятся по числу дней). */
2151
+ detached() {
2152
+ for (const target of this._listened || []) target?.unlisten?.('changed', this._onChangedFn);
2153
+ this._listened = null;
2154
+ this._logsListenersHooked = false;
2155
+ this._logsInit = false;
2156
+ if (this._logsFolder && this._dayFolderHooked) {
2157
+ this._logsFolder.unlisten?.('changed', this._dayHandler);
2158
+ this._dayFolderHooked = false;
2159
+ }
2160
+ },
2161
+ get logsSource() {
2162
+ // По умолчанию всегда показывается личный кабинет (/USERS/<uid>);
2163
+ // местный лог точки (this.$pdp.$item) — только при явном включении режима local для BOSS.
2164
+ const role = this.$pdp?.$item?.role || 'USER';
2165
+ const uid = WORK.uid || '';
2166
+ const local = this.$pdp?.isLocalFeed ? {
2167
+ local: 1
2168
+ } : {};
2169
+ return Promise.resolve(this.$pdp.$item?.fetch?.('chatSource', {
2170
+ role,
2171
+ uid,
2172
+ ...local
2173
+ })).then(path => {
2174
+ if (path && typeof path === 'string') return WORK.get_item(path);
2175
+ return this.$pdp.$item;
2176
+ });
2177
+ },
2178
+ get label() {
2179
+ let date = new Date(this.day);
2180
+ return date.toLocaleDateString(undefined, {
2181
+ weekday: "short",
2182
+ year: "numeric",
2183
+ month: "long",
2184
+ day: "numeric"
2185
+ });
2186
+ }
2187
+ });
2188
+ ODA({
2189
+ is: 'skill-tree',
2190
+ imports: '~/lib//tree.js',
2191
+ extends: 'item-tree',
2192
+ execute($item) {
2193
+ this.$pdp.chat.value = '@' + $item.name;
2194
+ this.focusedItem = $item;
2195
+ this.executed = true;
2196
+ }
2197
+ });
2198
+ export default {
2199
+ icon: 'icons:question-answer',
2200
+ label: 'Чат',
2201
+ order: 1,
2202
+ default: true,
2203
+ component: {
2204
+ imports: '/oda//toggle.js, ~/lib//tree.js, ~/lib//chat-item',
2205
+ template: /* html */`
2206
+ <style>
2207
+ :host{
2208
+ @apply --vertical;
2209
+ overflow: hidden;
2210
+ position: relative;
2211
+ }
2212
+ </style>
2213
+ <form-chat flex :$item></form-chat>
2214
+ `
2215
+ }
2216
+ };