odant-work 1.0.90 → 1.0.92

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 (326) hide show
  1. package/#system/package-manifest.json +275 -246
  2. package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/$virtual/class.js +4 -0
  3. package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/class.js +4 -0
  4. package/$server/$folder/$class/$data/$catalog/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +4 -0
  5. package/$server/$folder/$class/$data/$catalog/$virtual/class.js +8 -0
  6. package/{MODULES/Register/CATALOGS/$catalog/$folder/$class → $server/$folder/$class/$data}/$catalog/class.js +1 -0
  7. package/$server/$folder/$class/$data/$operation/$folder/$class/$data/$operation/class.js +4 -0
  8. package/{MODULES/Register/OPERATIONS/$operation/$folder/$class → $server/$folder/$class/$data}/$operation/class.js +1 -0
  9. package/$server/$folder/$class/$data/$register/$account/$folder/$class/$data/$register/$account/class.js +4 -0
  10. package/$server/$folder/$class/$data/$register/$account/class.js +8 -0
  11. package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/$account/class.js +4 -0
  12. package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/class.js +4 -0
  13. package/$server/$folder/$class/$data/$register/class.js +8 -0
  14. package/$server/$folder/$class/$data/$struct/$folder/$class/$data/$struct/class.js +4 -0
  15. package/$server/$folder/$class/$data/$struct/class.js +5 -0
  16. package/$server/$folder/$class/$data/class.js +5 -0
  17. package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +2158 -0
  18. package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +1377 -0
  19. package/$server/$folder/$class/$domain/$folder/$class/$domain/class.js +4 -0
  20. package/$server/$folder/$class/$domain/handlers/methods/restore/$handler/class.js +5 -5
  21. package/$server/$folder/$class/$domain/readme.md +1 -1
  22. package/$server/$folder/$class/$handler/$method/class.js +4 -0
  23. package/$server/$folder/$class/$handler/$timer/class.js +4 -0
  24. package/$server/$folder/$class/$module/$folder/$class/$data/$catalog/class.js +4 -0
  25. package/$server/$folder/$class/$module/$folder/$class/$data/$operation/class.js +4 -0
  26. package/$server/$folder/$class/$module/$folder/$class/$data/$register/class.js +4 -0
  27. package/$server/$folder/$class/$module/$folder/$class/$data/$struct/class.js +4 -0
  28. package/$server/$folder/$class/$module/$folder/$class/$domain/class.js +4 -0
  29. package/$server/$folder/$class/$module/$folder/$class/$module/class.js +4 -0
  30. package/$server/$folder/$class/$module/class.js +418 -6
  31. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/mcp.js → $module/handlers/pages/form/system/mcp/$handler/class.js} +261 -220
  32. package/$server/$folder/$class/$module/handlers/pages/form/system/modules/$handler/class.js +7 -0
  33. package/$server/$folder/$class/$structure/$folder/$class/$structure/class.js +4 -0
  34. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$catalog/class.js +4 -0
  35. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$operation/class.js +4 -0
  36. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$register/class.js +4 -0
  37. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$struct/class.js +4 -0
  38. package/$server/$folder/$class/$structure/$organization/$folder/$class/$domain/class.js +4 -0
  39. package/$server/$folder/$class/$structure/$organization/$folder/$class/$module/class.js +4 -0
  40. package/{ORGANIZATIONS/$domain/$folder/$class/$base → $server/$folder/$class/$structure/$organization/$folder/$class/$structure/$organization}/class.js +4 -5
  41. package/$server/$folder/$class/$structure/$organization/$folder/$class/$structure/class.js +4 -0
  42. package/{ORGANIZATIONS/$domain/$folder/$class/$base/$folder/$class/$structure/$base → $server/$folder/$class/$structure/$organization}/class.js +19 -17
  43. package/$server/$folder/$class/$structure/$organization/handlers/pages/form/system/requisites/$handler/class.js +3 -0
  44. package/$server/$folder/$class/$structure/{$base/handlers/pages/site/$handler/site.js → $organization/handlers/pages/site/$handler/class.js} +352 -365
  45. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$catalog/class.js +4 -0
  46. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$operation/class.js +4 -0
  47. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$register/class.js +4 -0
  48. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$struct/class.js +4 -0
  49. package/$server/$folder/$class/$structure/$project/$folder/$class/$domain/class.js +4 -0
  50. package/$server/$folder/$class/$structure/$project/$folder/$class/$module/class.js +4 -0
  51. package/$server/$folder/$class/$structure/$project/class.js +1 -0
  52. package/$server/$folder/$class/$structure/$project/readme.md +1 -1
  53. package/$server/$folder/$class/$structure/$server/$folder/$class/$domain/class.js +4 -0
  54. package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/database/$handler/class.js +3 -0
  55. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/license.js → $structure/$server/handlers/pages/form/system/license/$handler/class.js} +104 -103
  56. package/$server/$folder/$class/$structure/$server/handlers/pages/site/$handler/{site.js → class.js} +45 -30
  57. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +3 -0
  58. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +3 -0
  59. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +3 -0
  60. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/profile/$handler/class.js +18 -0
  61. package/$server/$folder/$class/$structure/ai/system.md +1 -1
  62. package/$server/$folder/$class/$structure/class.js +1 -1
  63. package/$server/$folder/$class/$structure/handlers/methods/archive/$handler/class.js +3 -3
  64. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +309 -8
  65. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +15 -4
  66. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/class.js +1281 -7
  67. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +2216 -6
  68. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +1304 -6
  69. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/methods/refresh/$method/class.js +1 -1
  70. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +305 -9
  71. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/agent.js → $structure/handlers/pages/form/system/agent/$handler/class.js} +329 -320
  72. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/database.js → $structure/handlers/pages/form/system/database/$handler/class.js} +510 -577
  73. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/messengers.js → $structure/handlers/pages/form/system/messengers/$handler/class.js} +143 -144
  74. package/$server/$folder/$class/$structure/handlers/pages/form/system/modules/$handler/class.js +270 -0
  75. package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +2114 -0
  76. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/class.js +229 -4
  77. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +1 -1
  78. package/$server/$folder/$class/$structure/readme.md +3 -3
  79. package/$server/$folder/$class/$users/$folder/$class/$structure/$user/class.js +4 -0
  80. package/$server/$folder/$class/$users/class.js +4 -0
  81. package/$server/$folder/$class/ai/agents/integrator-1c.md +1 -1
  82. package/$server/$folder/$class/ai/agents/it-admin.md +1 -1
  83. package/$server/$folder/$class/ai/agents/org-architect.md +4 -4
  84. package/$server/$folder/$class/ai/agents/readme.md +1 -1
  85. package/$server/$folder/$class/ai/agents/schema-validator.md +2 -2
  86. package/$server/$folder/$class/ai/skills/lan-inventory.md +2 -2
  87. package/$server/$folder/$class/ai/skills/org-structure.md +1 -1
  88. package/$server/$folder/$class/ai/skills/printer-setup.md +1 -1
  89. package/$server/$folder/$class/ai/skills/telegram-notify.md +2 -2
  90. package/$server/$folder/$class/ai/skills/work-scenarios.md +3 -3
  91. package/$server/$folder/$class/ai/system.md +14 -8
  92. package/$server/$folder/$class/class.js +2 -6
  93. package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +3 -0
  94. package/$server/$folder/$class/handlers/pages/form/system/$handler/class.js +2 -4
  95. package/$server/$folder/$class/handlers/pages/form/system/files/$handler/class.js +7 -0
  96. package/$server/$folder/$class/handlers/pages/form/system/requisites/$handler/class.js +100 -0
  97. package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +25 -6
  98. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +32 -5
  99. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +31 -3
  100. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +11 -3
  101. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +83 -3
  102. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +61 -3
  103. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/class.js +1699 -2
  104. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +827 -2
  105. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/readme.md +1 -1
  106. package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +33 -3
  107. package/$server/$folder/$file/handlers/pages/form/folder/$handler/class.js +3 -0
  108. package/$server/$folder/handlers/methods/create/$handler/class.js +5 -5
  109. package/$server/$folder/handlers/pages/form/$handler/class.js +2467 -3
  110. package/$server/$folder/handlers/pages/form/folder/$handler/class.js +22 -0
  111. package/$server/$folder/handlers/readme.md +1 -1
  112. package/$server/$folder/lib/chat-item/chat-item.js +5 -10
  113. package/$server/$folder/lib/consultant/consultant.js +7 -10
  114. package/$server/$folder/lib/explorer/explorer.js +1 -1
  115. package/$server/$folder/lib/icon/icon.js +1 -1
  116. package/$server/$folder/lib/menu/menu.js +3 -2
  117. package/$server/$folder/lib/messenger-settings/messenger-settings.js +4 -4
  118. package/$server/$folder/lib/node/node.js +3 -3
  119. package/$server/$folder/lib/prompt-bar/prompt-bar.js +2 -2
  120. package/$server/$folder/lib/role/role.js +1 -2
  121. package/$server/$folder/lib/security/admin/admin.js +3 -3
  122. package/$server/$folder/lib/security/security.js +4 -4
  123. package/$server/$folder/lib/security/users/users.js +2 -5
  124. package/$server/$folder/lib/site-loc/site-loc.js +3 -3
  125. package/$server/$folder/lib/tree/tree.js +14 -22
  126. package/$server/class.js +1 -0
  127. package/AGENTS.md +21 -13
  128. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-model.js → MODELS/$ai/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js} +385 -425
  129. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-provider.js → MODELS/$ai/$folder/$class/$provider/handlers/pages/form/system/ai/$handler/class.js} +157 -161
  130. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-root.js → MODELS/$ai/handlers/pages/form/system/ai/$handler/class.js} +34 -33
  131. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-local.js → MODELS/Local/$provider/handlers/pages/form/system/ai/$handler/class.js} +572 -622
  132. package/MODULES/$domain/class.js +85 -4
  133. package/MODULES/$domain/handlers/pages/form/system/mcp/$handler/class.js +7 -0
  134. package/MODULES/$domain/readme.md +7 -6
  135. package/{SERVICES/1C/$service → MODULES/1C/$module}/class.js +7 -1
  136. package/MODULES/2GIS/$module/class.js +32 -0
  137. package/MODULES/2GIS/$module/readme.md +57 -0
  138. package/{SERVICES/Bitrix24/$service → MODULES/Bitrix24/$module}/class.js +7 -2
  139. package/{SERVICES/CBR/$service → MODULES/CBR/$module}/class.js +5 -0
  140. package/{SERVICES/DaData/$service → MODULES/DaData/$module}/class.js +9 -3
  141. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js +648 -21
  142. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/class.js +140 -6
  143. package/{SERVICES/Marketplaces/$service → MODULES/Marketplaces/$domain}/class.js +1 -1
  144. package/{SERVICES/Marketplaces/Ozon/$service → MODULES/Marketplaces/Ozon/$module}/class.js +1 -1
  145. package/{SERVICES/Marketplaces/Wildberries/$service → MODULES/Marketplaces/Wildberries/$module}/class.js +1 -1
  146. package/{SERVICES/Marketplaces/YandexMarket/$service → MODULES/Marketplaces/YandexMarket/$module}/class.js +1 -1
  147. package/MODULES/Process/$module/readme.md +1 -1
  148. 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" +305 -6
  149. 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" +241 -6
  150. 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" +515 -16
  151. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual → $data/$catalog/$virtual}/class.js +3 -0
  152. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/objects/$handler/class.js +3 -0
  153. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual/handlers/pages/form/virtual/$handler/virtual.js → $data/$catalog/$virtual/handlers/pages/form/virtual/$handler/class.js} +413 -390
  154. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/class.js +14 -0
  155. package/MODULES/Register/CATALOGS/$catalog/class.js +7 -14
  156. 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 +9 -0
  157. 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/class.js +0 -7
  158. 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 +11 -0
  159. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/class.js +0 -9
  160. package/MODULES/Register/OPERATIONS/$operation/$folder/$class/$data/$operation/class.js +16 -0
  161. package/MODULES/Register/OPERATIONS/$operation/class.js +0 -9
  162. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/$folder/$class/$data/$operation/class.js +8 -0
  163. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/class.js +4 -10
  164. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/$folder/$class/$data/$operation/class.js +8 -0
  165. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/class.js +0 -6
  166. 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 +8 -0
  167. 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/class.js +4 -10
  168. 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/$operation/$folder/$class/$data/$operation/class.js" +10 -0
  169. 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/$operation/class.js" +4 -12
  170. 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/$operation/$folder/$class/$data/$operation/class.js" +10 -0
  171. 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/$operation/class.js" +4 -12
  172. 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 +24 -0
  173. 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/class.js +0 -22
  174. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/analysis/$handler/analysis.js → $data/$register/$account/handlers/pages/form/analysis/$handler/class.js} +9 -4
  175. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/postings/$handler/postings.js → $data/$register/$account/handlers/pages/form/postings/$handler/class.js} +845 -753
  176. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/turnovers/$handler/turnovers.js → $data/$register/$account/handlers/pages/form/turnovers/$handler/class.js} +9 -4
  177. package/MODULES/Register/REGISTER/$register/{$folder/$class/$register/handlers/pages/form/journal/$handler/journal.js → handlers/pages/form/journal/$handler/class.js} +382 -329
  178. package/MODULES/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/class.js +807 -0
  179. package/MODULES/Register/REGISTER/10/$account/$folder/$class/$data/$register/$account/class.js +21 -0
  180. package/MODULES/Register/REGISTER/10/$account/class.js +0 -19
  181. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/$folder/$class/$data/$register/$account/class.js +14 -0
  182. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/class.js +4 -16
  183. package/{SERVICES/SearXNG/$service → MODULES/SearXNG/$module}/class.js +5 -0
  184. package/{SERVICES/Yandex/$service → MODULES/Yandex/$module}/class.js +7 -0
  185. package/{SERVICES/YandexDisk/$service → MODULES/YandexDisk/$module}/class.js +8 -2
  186. package/NODES/$node/handlers/pages/form/network/$handler/class.js +122 -5
  187. package/ORGANIZATIONS/$domain/$folder/$class/$structure/$organization/class.js +5 -0
  188. package/ORGANIZATIONS/$domain/class.js +5 -5
  189. package/oda/components/inputs/link/link.js +1 -1
  190. package/package.json +1 -1
  191. package/readme.md +6 -7
  192. package/scripts/check-architecture.mjs +541 -0
  193. package/scripts/cleanup-storage.mjs +1 -1
  194. package/scripts/demo-seed.mjs +3 -3
  195. package/scripts/import-bis.mjs +33 -15
  196. package/scripts/import-delovaya.mjs +26 -14
  197. package/sources/client/class.js +19 -10
  198. package/sources/client/folder.js +10 -22
  199. package/sources/client/handler.js +75 -33
  200. package/sources/data/api.js +9 -10
  201. package/sources/data/classes.js +85 -9
  202. package/sources/data/db.js +10 -6
  203. package/sources/data/print.js +15 -41
  204. package/sources/data/readme.md +5 -5
  205. package/sources/data/schema.js +206 -118
  206. package/sources/data/sql-inspector.js +7 -7
  207. package/sources/host/auth-methods.js +2 -5
  208. package/sources/host/auto-updater.js +1 -2
  209. package/sources/host/babel-merge.js +174 -129
  210. package/sources/host/prewarm.js +1 -1
  211. package/sources/host/watch.js +1 -1
  212. package/sources/index.html +1 -1
  213. package/sources/modules/agent/extensions.js +48 -38
  214. package/sources/modules/agent/index.js +1 -1
  215. package/sources/modules/agent/node-rules.js +69 -41
  216. package/sources/modules/agent/permissions.js +1 -1
  217. package/sources/modules/agent/plugins.js +11 -11
  218. package/sources/modules/agent/resources.js +96 -52
  219. package/sources/modules/agent/tools/net.js +1 -1
  220. package/sources/modules/agent/tools/services.js +7 -7
  221. package/sources/modules/agent/tools/work/access.js +10 -8
  222. package/sources/modules/agent/tools/work/classes.js +26 -47
  223. package/sources/modules/agent/tools/work/common.js +8 -10
  224. package/sources/modules/agent/tools/work/data.js +4 -4
  225. package/sources/modules/agent/triggers.js +1 -1
  226. package/sources/modules/agent/twin-bus.js +4 -4
  227. package/sources/modules/agent/voice.js +1 -1
  228. package/sources/modules/call/call.js +4 -4
  229. package/sources/modules/kladr/index.js +3 -3
  230. package/sources/modules/lan/register.js +7 -7
  231. package/sources/modules/mcp-marketplaces/ozon.js +1 -1
  232. package/sources/modules/mcp-marketplaces/wildberries.js +1 -1
  233. package/sources/modules/mcp-marketplaces/yandex-market.js +1 -1
  234. package/sources/modules/nodes/mount.js +2 -4
  235. package/sources/modules/notify/index.js +18 -18
  236. package/sources/modules/rag/extract.js +9 -2
  237. package/sources/modules/rag/indexer.js +1 -1
  238. package/sources/modules/rag/scope.js +7 -33
  239. package/sources/modules/trainer/dataset.js +2 -2
  240. package/sources/modules/trainer/local-engine.js +1 -1
  241. package/sources/page.html +2 -2
  242. package/sources/readme.md +1 -1
  243. package/sources/server/access/gateway.js +19 -19
  244. package/sources/server/access/invites.js +4 -5
  245. package/sources/server/access/links.js +10 -8
  246. package/sources/server/access/policy.js +65 -39
  247. package/sources/server/access/workplaces.js +20 -14
  248. package/sources/server/chat-threads.js +4 -4
  249. package/sources/server/class/archive.js +15 -15
  250. package/sources/server/class/base-template.js +13 -9
  251. package/sources/server/class/distro.js +3 -4
  252. package/sources/server/class/feed.js +3 -3
  253. package/sources/server/class/mail-calendar.js +9 -8
  254. package/sources/server/class/scaffold.js +110 -60
  255. package/sources/server/class/search.js +2 -2
  256. package/sources/server/class/security.js +76 -94
  257. package/sources/server/class.js +181 -64
  258. package/sources/server/file.js +2 -2
  259. package/sources/server/folder.js +376 -191
  260. package/sources/server/handler.js +52 -13
  261. package/sources/server/logs.js +7 -7
  262. package/sources/server/node.js +12 -43
  263. package/sources/server/server.js +16 -17
  264. package/$server/$folder/$class/$device/class.js +0 -3
  265. package/$server/$folder/$class/$handler/$task/class.js +0 -3
  266. package/$server/$folder/$class/$service/$class/$service/class.js +0 -4
  267. package/$server/$folder/$class/$structure/$base/class.js +0 -10
  268. package/$server/$folder/$class/$structure/$base/roots_1/roots.test +0 -0
  269. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/data.js +0 -313
  270. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/explorer.js +0 -16
  271. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/calendar.js +0 -1226
  272. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +0 -2217
  273. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/email.js +0 -1188
  274. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +0 -289
  275. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/site.js +0 -240
  276. package/$server/$folder/$class/handlers/pages/form/object/$handler/class.js +0 -33
  277. package/$server/$folder/$class/handlers/pages/form/object/$handler/object.js +0 -1371
  278. package/$server/$folder/$class/handlers/pages/form/objects/$handler/class.js +0 -33
  279. package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +0 -2130
  280. package/$server/$folder/$class/handlers/pages/form/system/$handler/system.js +0 -384
  281. package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/modules.js +0 -244
  282. package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/staff.js +0 -2126
  283. package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +0 -21
  284. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +0 -27
  285. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +0 -31
  286. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +0 -10
  287. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/file.js +0 -72
  288. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +0 -63
  289. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +0 -1845
  290. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js +0 -785
  291. package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +0 -29
  292. package/$server/$folder/handlers/pages/form/$handler/form.js +0 -2122
  293. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/map.js +0 -623
  294. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/kladr.js +0 -134
  295. 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" +0 -293
  296. 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" +0 -234
  297. 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" +0 -406
  298. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$virtual/handlers/pages/form/virtual/$handler/class.js +0 -6
  299. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/analysis/$handler/class.js +0 -9
  300. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/postings/$handler/class.js +0 -9
  301. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/turnovers/$handler/class.js +0 -9
  302. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/journal/$handler/class.js +0 -6
  303. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/sheet/$handler/class.js +0 -6
  304. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/sheet/$handler/sheet.js +0 -808
  305. package/NODES/$node/handlers/pages/form/network/$handler/network.js +0 -110
  306. package/SERVICES/$service/$folder/$storage/$service/class.js +0 -8
  307. package/SERVICES/$service/class.js +0 -442
  308. package/SERVICES/readme.md +0 -36
  309. /package/$server/$folder/$class/$structure/{$base → $organization}/icon.png +0 -0
  310. /package/{SERVICES/DuckDuckGo/$service → MODULES/DuckDuckGo/$module}/class.js +0 -0
  311. /package/MODULES/KLADR/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  312. /package/MODULES/Process/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  313. /package/MODULES/Register/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  314. /package/MODULES/Register/$module/$folder/$class/{$operation → $data/$operation}/class.js +0 -0
  315. /package/MODULES/Register/$module/$folder/$class/{$register → $data/$register}/class.js +0 -0
  316. /package/MODULES/Register/$module/$folder/$class/{$struct → $data/$struct}/class.js +0 -0
  317. /package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual/$folder/$class → $data/$catalog/$virtual/$folder/$class/$data/$catalog}/$virtual/class.js +0 -0
  318. /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/$operation/{print → $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
  319. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$account → $data/$register/$account}/class.js +0 -0
  320. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$account → $data/$register/$account}/readme.md +0 -0
  321. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$register → $data/$register}/class.js +0 -0
  322. /package/MODULES/Register/STRUCTS/$struct/$folder/$class/{$struct → $data/$struct}/class.js +0 -0
  323. /package/{SERVICES/RuCalendar/$service → MODULES/RuCalendar/$module}/class.js +0 -0
  324. /package/{SERVICES/Telegram/$service → MODULES/Telegram/$module}/class.js +0 -0
  325. /package/{SERVICES/Weather/$service → MODULES/Weather/$module}/class.js +0 -0
  326. /package/PROJECTS/$domain/$folder/$class/{$project → $structure/$project}/class.js +0 -0
@@ -1,785 +0,0 @@
1
- /**
2
- * Форма .task (v2): одна шапка (заголовок, статус, кольцо контекста — показ/скрытие доков),
3
- * лента агента, план, композер; справа — доки (вкладка «Контекст» + файлы, отчёты, сводки).
4
- * Шапка: развёрнутая в чате (chat-item) — своя, внешняя полоса скрывается (событие own-header, закрытие — close-view);
5
- * в странице form (work-form) — встраивается в её шапку (slot top-panel), своей нет.
6
- * Данные — файл задачи (перечитывается по changed), стрим — task.delta в streams[id].
7
- * Действия ленты вызывают методы шелла (findShell из ui/util.js).
8
- */
9
- import './ui/feed.js';
10
- import './ui/panel.js';
11
- import './ui/dock.js';
12
- import './ui/voice-ui.js';
13
- import { VoiceController } from './ui/voice.js';
14
- import { collectDocs, computeStats, stableDocs, activityOf, taskFiles, computerUse, realPathOfSnapshot } from './ui/docs.js';
15
- import { pathOfWorkHref, workHref } from './ui/util.js';
16
-
17
- /**
18
- * Клик по WORK-ссылке в markdown (событие md-link от oda-markdown-viewer):
19
- * всегда открывает документ/файл/класс через стандартное представление в форме (execute / work-form),
20
- * а не в боковой панели доков.
21
- */
22
- function onMdLink(e) {
23
- const { href, ctrl } = e.detail || {};
24
- const path = !ctrl && pathOfWorkHref(href);
25
- if (!path)
26
- return;
27
- e.preventDefault();
28
- this.openWorkPath(path);
29
- }
30
-
31
- export default {
32
- imports: 'oda//button, oda//icon, oda//splitter',
33
- template: /* html */`
34
- <style>
35
- :host {
36
- @apply --horizontal;
37
- @apply --content;
38
- overflow: hidden;
39
- position: relative;
40
- font-size: 15px;
41
- }
42
- .main { min-width: 0; overflow: hidden; position: relative; }
43
- .scroller { overflow-y: auto; overflow-x: hidden; min-height: 0; }
44
- .col { width: 100%; max-width: 820px; margin: 0 auto; padding: 16px 16px 8px; box-sizing: border-box; }
45
- .down.attn { width: auto; padding: 0 14px 0 10px; border-radius: 999px; gap: 6px; font-size: small; }
46
- .working { @apply --horizontal; @apply --muted; align-items: center; gap: 8px; font-size: small; padding: 10px 0 4px; }
47
- .bottom { width: 100%; max-width: 820px; margin: 0 auto; padding: 4px 16px 10px; box-sizing: border-box; gap: 8px; position: relative; }
48
- .down {
49
- position: absolute; top: -44px; left: 50%; transform: translateX(-50%); z-index: 5;
50
- width: 34px; height: 34px; border-radius: 50%; @apply --content; @apply --raised; border: 1px solid var(--subtle-border);
51
- }
52
- .toast {
53
- position: absolute; left: 50%; bottom: 130px; transform: translateX(-50%); z-index: 10;
54
- padding: 6px 14px; border-radius: 999px; font-size: small; @apply --raised; @apply --content;
55
- }
56
- .legacy { @apply --muted; font-size: x-small; text-align: center; padding-bottom: 12px; }
57
- </style>
58
- <div class="main" flex vertical ~if="showMain">
59
- <microchat-header no-flex ~if="!inForm"></microchat-header>
60
- <div class="scroller" flex vertical @scroll="onScroll">
61
- <div class="col">
62
- <div class="legacy" ~if="data?.legacy">Задача из прежней версии агента — показана упрощённо; продолжить можно как обычно.</div>
63
- <microchat-feed :items="feedItems"></microchat-feed>
64
- <div class="working" ~if="activity">
65
- <oda-icon icon="spinners:3-dots-scale" :icon-size="16"></oda-icon><span>{{activity.text}}</span>
66
- </div>
67
- </div>
68
- </div>
69
- <div class="bottom" vertical no-flex>
70
- <oda-button class="down" ~if="!pinned && !needsHuman" icon="carbon:arrow-down" :icon-size="18" title="К последнему" @tap="toBottom"></oda-button>
71
- <oda-button class="down attn" ~if="!pinned && needsHuman" accent-invert icon="carbon:arrow-down" :icon-size="16" label="Агент ждёт вас" title="Перейти к вопросу или разрешению" @tap="toBottom"></oda-button>
72
- <microchat-todos ~if="showTodos" :todos="data.todos"></microchat-todos>
73
- <microchat-voice ~if="voiceOn"></microchat-voice>
74
- <microchat-panel :data :$item></microchat-panel>
75
- </div>
76
- <div class="toast" ~if="toastText">{{toastText}}</div>
77
- </div>
78
- <oda-splitter ~if="dockOpen && !mobile" left ::width="dockWidth"></oda-splitter>
79
- <microchat-dock no-flex ~if="dockOpen" ~style="dockStyle"></microchat-dock>
80
- `,
81
- data: null,
82
- streams: {},
83
- status: 'idle',
84
- optimistic: null,
85
- toastText: '',
86
- pinned: true,
87
- groupOpen: {},
88
- dockOpen: { $def: false, $save: true },
89
- /** Вкладка дока: context | monitor | results | files. Выбранный результат — resultKey. */
90
- dockTab: { $def: 'context' },
91
- resultKey: '',
92
- resultKeyAt: 0,
93
- dockWidth: { $def: 520, $save: true },
94
- freshDocs: 0,
95
- /** Голосовой режим включён; полосы кнопки в шапке задачи подключаются к голосу при смене. */
96
- voiceOn: {
97
- $def: false,
98
- set(v) {
99
- this.async(() => (this.$('microchat-header') || this._formHeader)?.bindVoice?.(v ? this._voice : null));
100
- },
101
- },
102
- inForm: false,
103
- closable: false,
104
- /** Внешний вид персонажа (ai/config.js dot); грузится один раз. */
105
- look: null,
106
- __microchatShell: true,
107
- $item: {
108
- $def: null,
109
- set(n) {
110
- this._bindItem(n);
111
- },
112
- },
113
- /** Подписки на события задачи: прежний элемент отписывается (иначе чужие task.state/delta попадают в эту ленту). */
114
- _bindItem(n) {
115
- const prev = this._bound;
116
- this._unbindItem();
117
- if (prev && prev !== n) {
118
- this._voice?.disable();
119
- this.voiceOn = false;
120
- this.data = null;
121
- this.streams = {};
122
- this.optimistic = null;
123
- this.status = 'idle';
124
- this._docKeys = undefined;
125
- this._docsList = undefined;
126
- this._filesList = undefined;
127
- this._resultsList = undefined;
128
- this.dockTab = 'context';
129
- this.resultKey = '';
130
- this._monitorOpenedFor = '';
131
- this._cuFor = null;
132
- this._cu = null;
133
- this.computerState = 'missing';
134
- this.computerChecked = false;
135
- }
136
- this._bound = n || null;
137
- if (!n)
138
- return;
139
- this._h = {
140
- 'changed': () => this._reload(),
141
- 'task.delta': e => this._onDelta(e.detail?.value),
142
- 'task.state': e => {
143
- const s = e.detail?.value?.status;
144
- if (s) {
145
- this.status = s;
146
- this._lastDelta = Date.now();
147
- }
148
- },
149
- 'task.moved': e => this._handleTaskMoved(e.detail?.value || e.detail),
150
- 'chat.done': () => this._reload(),
151
- };
152
- for (const [k, fn] of Object.entries(this._h))
153
- n.listen(k, fn);
154
- this._reload();
155
- n.fetch('dot_look').then(l => { if (this._bound === n && l) this.look = l; }).catch(() => {});
156
- },
157
- _unbindItem() {
158
- const n = this._bound;
159
- if (n && this._h)
160
- for (const [k, fn] of Object.entries(this._h))
161
- n.unlisten(k, fn);
162
- this._bound = null;
163
- this._h = null;
164
- },
165
- /**
166
- * Задача на экране (вкладка активна, форма видна) — просим service worker закрыть
167
- * висящее уведомление по ней: человек уже смотрит запрос, пуш только сбивает.
168
- */
169
- _watchPresence() {
170
- this._presenceIO ??= new IntersectionObserver(entries => {
171
- if (entries.some(e => e.isIntersecting))
172
- this._notifyPresence();
173
- });
174
- this._presenceIO.observe(this);
175
- this._presenceOnVis = () => this._notifyPresence();
176
- document.addEventListener('visibilitychange', this._presenceOnVis);
177
- // service worker перед показом пуша спрашивает, видна ли задача на экране
178
- // (в чате адрес не содержит путь задачи — сравнивать URL недостаточно)
179
- this._presenceOnSw = e => {
180
- const msg = e?.data;
181
- const mine = this._bound?.path || this.$item?.path;
182
- if (msg?.type !== 'work:is-task-visible' || !msg.port || !mine || msg.path !== mine)
183
- return;
184
- if (this._isOnScreen())
185
- try { msg.port.postMessage({ visible: true }); } catch { /* порт закрыт */ }
186
- };
187
- navigator.serviceWorker?.addEventListener?.('message', this._presenceOnSw);
188
- this.async(() => this._notifyPresence(), 150);
189
- },
190
- _unwatchPresence() {
191
- this._presenceIO?.disconnect();
192
- this._presenceIO = null;
193
- if (this._presenceOnVis)
194
- document.removeEventListener('visibilitychange', this._presenceOnVis);
195
- this._presenceOnVis = null;
196
- if (this._presenceOnSw)
197
- navigator.serviceWorker?.removeEventListener?.('message', this._presenceOnSw);
198
- this._presenceOnSw = null;
199
- },
200
- /** Форма задачи действительно видна на экране (а не просто в DOM скрытой вкладки). */
201
- _isOnScreen() {
202
- if (document.visibilityState !== 'visible' || !this.isConnected)
203
- return false;
204
- const r = this.getBoundingClientRect?.();
205
- if (!r || r.width < 2 || r.height < 2)
206
- return false;
207
- const w = window.innerWidth || 0, h = window.innerHeight || 0;
208
- return r.bottom > 0 && r.right > 0 && r.top < h && r.left < w;
209
- },
210
- _notifyPresence() {
211
- const path = this._bound?.path || this.$item?.path;
212
- if (!path || document.visibilityState !== 'visible')
213
- return;
214
- try {
215
- navigator.serviceWorker?.ready
216
- ?.then(reg => reg.active?.postMessage({ type: 'work:task-visible', path }))
217
- .catch(() => { /* sw недоступен — не ошибка */ });
218
- }
219
- catch { /* ignore */ }
220
- },
221
- $listeners: {
222
- resize() {
223
- if (this._lastMobile !== ODA.states.mobileMode) {
224
- this._lastMobile = ODA.states.mobileMode;
225
- this.invalidate('mobile');
226
- }
227
- },
228
- keydown(e) {
229
- // композер сам обрабатывает Esc (стоп/очистка) и гасит событие: второй стоп не нужен
230
- if (e.key === 'Escape' && !e.defaultPrevented && this.status === 'running')
231
- this.$item?.fetch('stop', {});
232
- },
233
- },
234
- attached() {
235
- if (this.$item && !this._bound)
236
- this._bindItem(this.$item);
237
- this.addEventListener('md-link', onMdLink);
238
- // Где открыта форма: страница form (work-form) — шапка в её top-panel; развёрнутый chat-item — своя шапка вместо его полосы
239
- if (WORK.DEV_MODE)
240
- window.__microchat = this; // отладка UI (scripts/ui-shot.mjs)
241
- const host = this.getRootNode?.()?.host;
242
- const form = this.parentElement?.localName === 'work-form' ? this.parentElement : null;
243
- this.inForm = !!form;
244
- this.closable = host?.localName === 'chat-item';
245
- if (form && !this._formHeader) {
246
- // work-form (extends oda-app-layout) держит шапку в light DOM: <slot name="top-panel"> там — просто место вставки
247
- this._formHeader = ODA.createComponent('microchat-header', { shell: this, inline: true });
248
- const anchor = form.querySelector('slot[name="top-panel"]');
249
- if (anchor)
250
- anchor.parentNode.insertBefore(this._formHeader, anchor);
251
- else
252
- form.appendChild(this._formHeader);
253
- }
254
- if (this.closable)
255
- this.async(() => this.fire('own-header'));
256
- this._ro ??= new ResizeObserver(() => this._stick());
257
- // тикер строки активности: пока running — раз в секунду обновляем «Жду ответ… N с»
258
- this._activityTimer ??= setInterval(() => {
259
- if (this.status === 'running')
260
- this._clock = Date.now();
261
- }, 1000);
262
- this.async(() => {
263
- const col = this.$('.col');
264
- if (col)
265
- this._ro.observe(col);
266
- }, 50);
267
- this._startPcPoll();
268
- this._watchPresence();
269
- },
270
- detached() {
271
- this._unbindItem();
272
- this._unwatchPresence();
273
- this._voice?.disable();
274
- this.voiceOn = false;
275
- this.removeEventListener('md-link', onMdLink);
276
- this._ro?.disconnect();
277
- clearInterval(this._activityTimer);
278
- this._activityTimer = null;
279
- this._formHeader?.remove();
280
- this._formHeader = null;
281
- this._stopPcPoll();
282
- },
283
- get mobile() { return ODA.states.mobileMode; },
284
- get showMain() { return !(this.dockOpen && this.mobile); },
285
- get dockStyle() {
286
- return this.mobile ? { width: '100%' } : { width: this.dockWidth + 'px', maxWidth: '70%', minWidth: '320px' };
287
- },
288
- get items() { return this.data?.items || []; },
289
- /** Новая задача без реплик: показать подсказку, с чего начать. */
290
-
291
- /** Агент остановился и ждёт человека (вопрос, разрешение, подключение). */
292
- get needsHuman() { return this.status === 'waiting'; },
293
- /** Своя реплика видна сразу, до перечитывания файла. */
294
- /**
295
- * Задача только что создана чатом и ещё не получила первую реплику (агент запускается): показываем запрос и «Запускаю…»,
296
- * а не пустую задачу. Не дольше 20 с — потом это обычная пустая задача.
297
- */
298
- get starting() {
299
- // все зависимости читаются сразу, без короткого замыкания: иначе кэш геттера запомнит только data и не увидит смену status/items
300
- const d = this.data, count = this.items.length, optimistic = this.optimistic, status = this.status;
301
- return !!d && !count && !optimistic && status === 'idle' && !!d.name && Date.now() - (+d.created || 0) < 20000;
302
- },
303
- get feedItems() {
304
- const o = this.optimistic;
305
- if (this.starting)
306
- return [{ id: 'starting', type: 'user', content: this.data.name, time: +this.data.created || Date.now() }];
307
- const queue = this.data?.queue || [];
308
- const list = (!o || this.items.some(i => i.type === 'user' && i.content === o.content && i.time >= o.time - 5000))
309
- ? this.items
310
- : [...this.items, o];
311
- return queue.length ? [...list, ...queue] : list;
312
- },
313
- async unqueue(item) {
314
- const res = await this.$item?.fetch('unqueue', { id: item.id });
315
- if (!res?.ok)
316
- this.toast('Сообщение уже передано агенту');
317
- },
318
- get title() { return this.data?.title || this.data?.name || this.$item?.name || 'Задача'; },
319
- get busy() { return this.status === 'running'; },
320
- /** Отчёты субагентов и файлы (прежний набор доков); файлы для вкладки «Файлы» — files. */
321
- get docs() {
322
- const list = collectDocs(this.items, (this.data?.results || []).map(r => r?.snapshot).filter(Boolean));
323
- // тот же набор — те же объекты: вкладки и iframe/video не пересоздаются и не моргают
324
- const { docs } = stableDocs(this._docsList, list);
325
- this._docsList = docs;
326
- return docs;
327
- },
328
- /** Стабилизированный список опубликованных результатов (data.results) без пересоздания объектов при _reload. */
329
- get results() {
330
- const list = (this.data?.results || []).filter(r => r?.snapshot).map(r => {
331
- const real = realPathOfSnapshot(r.snapshot) || r.snapshot;
332
- return {
333
- key: 'result:' + r.snapshot,
334
- kind: 'file',
335
- path: real,
336
- snapshot: r.snapshot,
337
- title: r.title || (real ? String(real).split('/').pop() : 'Результат'),
338
- time: r.time,
339
- published: true,
340
- };
341
- });
342
- const { docs } = stableDocs(this._resultsList, list);
343
- this._resultsList = docs;
344
- return docs;
345
- },
346
- /** Все файлы задачи: вложения человека, созданное агентом, опубликованное. */
347
- get files() {
348
- const list = taskFiles(this.items, this.data?.results || []);
349
- const { docs } = stableDocs(this._filesList, list);
350
- this._filesList = docs;
351
- return docs;
352
- },
353
- /** Компьютер в задаче: использовался ли (даже если уже удалён), имя, команды, скриншоты. */
354
- get computer() {
355
- const items = this.items;
356
- if (this._cuFor !== items) {
357
- this._cuFor = items;
358
- this._cu = computerUse(items);
359
- }
360
- return this._cu;
361
- },
362
- get stats() {
363
- const m = this.data?.model || '';
364
- if (m && m !== this._limitFor) {
365
- this._limitFor = m;
366
- this._loadLimit(m);
367
- }
368
- return computeStats(this.data, this.modelLimit);
369
- },
370
- /** Лимит контекста модели — для задач без body.context (старые/ещё не запускавшиеся). */
371
- modelLimit: 0,
372
- async _loadLimit(path) {
373
- try {
374
- const item = await WORK.get_item(path);
375
- const v = Number(await item?.maxTokens) || 0;
376
- if (this._limitFor === path)
377
- this.modelLimit = v;
378
- }
379
- catch { /* нет модели */ }
380
- },
381
- get activity() {
382
- if (this.starting)
383
- return { kind: 'start', text: 'Запускаю агента…' };
384
- return activityOf({ status: this.status, items: this.items, streams: this.streams, nowMs: this._clock || Date.now(), lastDeltaMs: this._lastDelta });
385
- },
386
- /** Статус компьютера: running|stopped|missing. */
387
- computerState: 'missing',
388
- /** Статус компьютера уже получен (до первого ответа монитор пишет «проверяю…», а не «удалён»). */
389
- computerChecked: false,
390
- get computerName() { return this.computer.name; },
391
- get computerOwner() {
392
- const m = /(\d{10,16})\.([0-9A-F]{16})\.task$/i.exec(String(this.$item?.id || this.$item?.path || ''));
393
- return m ? m[2].toUpperCase() : '';
394
- },
395
- get computerQuery() {
396
- return this.computerOwner ? '?owner=' + encodeURIComponent(this.computerOwner) : '';
397
- },
398
- _pcPoll: null,
399
- /** Проверка компьютера через пассивный статус: running|stopped|missing. */
400
- async _checkComputer() {
401
- // задача компьютером не пользовалась — не опрашиваем его статус каждые 10 с
402
- if (!this.computer.used)
403
- return;
404
- try {
405
- const r = await fetch('/~computer/' + encodeURIComponent(this.computerName) + '/status' + this.computerQuery, { credentials: 'same-origin', signal: AbortSignal.timeout(6000) });
406
- const data = await r.json().catch(() => ({}));
407
- const state = data.state || 'missing';
408
- const prevState = this.computerState;
409
- if (state !== this.computerState)
410
- this.computerState = state;
411
- if (state === 'running' && prevState !== 'running')
412
- this._openMonitorOnce();
413
- }
414
- catch {
415
- if (this.computerState !== 'missing')
416
- this.computerState = 'missing';
417
- }
418
- this.computerChecked = true;
419
- },
420
- _openMonitorOnce() {
421
- const taskKey = this.$item?.path || this.$item?.id || '_';
422
- if (this._monitorOpenedFor === taskKey)
423
- return;
424
- this._monitorOpenedFor = taskKey;
425
- this.dockOpen = true;
426
- this.dockTab = 'monitor';
427
- },
428
- _startPcPoll() {
429
- if (this._pcPoll)
430
- return;
431
- this._checkComputer();
432
- this._pcPoll = setInterval(() => this._checkComputer(), 10000);
433
- },
434
- _stopPcPoll() {
435
- clearInterval(this._pcPoll);
436
- this._pcPoll = null;
437
- },
438
- get showTodos() {
439
- const t = this.data?.todos;
440
- return Array.isArray(t) && t.length && t.some(x => x.status !== 'completed');
441
- },
442
- _onDelta(d) {
443
- if (!d?.item)
444
- return;
445
- const cur = this.streams[d.item] || {};
446
- if (d.field === 'tool') {
447
- this.streams = {
448
- ...this.streams,
449
- [d.item]: { ...cur, tool: { name: d.name || '', target: d.target || '', chars: Number(d.chars) || 0 } },
450
- };
451
- this._lastDelta = Date.now();
452
- if (this.status !== 'running')
453
- this.status = 'running';
454
- if (/^(?:computer_|sandbox_)/.test(String(d.name || '')) && d.name !== 'computer_destroy')
455
- this._openMonitorOnce();
456
- this._stick();
457
- return;
458
- }
459
- if (!d.token)
460
- return;
461
- const field = d.field === 'reasoning' ? 'reasoning' : 'content';
462
- const next = { ...cur, [field]: (cur[field] || '') + d.token };
463
- if (next.tool)
464
- delete next.tool;
465
- this.streams = { ...this.streams, [d.item]: next };
466
- this._lastDelta = Date.now();
467
- if (this.status !== 'running')
468
- this.status = 'running';
469
- this._stick();
470
- this._voice?.onDelta({ item: d.item, field });
471
- },
472
- /** Перечитывание файла: не больше одной загрузки в полёте, события во время загрузки схлопываются. */
473
- _reload() {
474
- if (this._loading) {
475
- this._again = true;
476
- return;
477
- }
478
- this._loading = (async () => {
479
- let tries = 0;
480
- try {
481
- do {
482
- this._again = false;
483
- try {
484
- const raw = await this.$item?.load();
485
- const data = typeof raw === 'string' ? JSON.parse(raw || '{}') : (raw || {});
486
- const done = new Set((data.items || []).filter(i => i.type === 'assistant' && (i.durationMs || i.stopped || i.interrupted)).map(i => i.id));
487
- if (Object.keys(this.streams).some(id => done.has(id))) {
488
- const s = {};
489
- for (const [id, v] of Object.entries(this.streams))
490
- if (!done.has(id))
491
- s[id] = v;
492
- this.streams = s;
493
- }
494
- const before = this._docKeys;
495
- const prevComputerUsed = Boolean(this._cu?.used);
496
- this.data = data;
497
- this.status = data.status || 'idle';
498
- this._lastDelta = Date.now();
499
- this._noticeDocs(before);
500
- if (this.computer.used) {
501
- if (!prevComputerUsed && this.status === 'running')
502
- this._openMonitorOnce();
503
- this._checkComputer();
504
- }
505
- if (this.starting)
506
- this.async(() => this.invalidate?.('starting', 'feedItems', 'activity'), Math.max(50, 20100 - (Date.now() - (+data.created || 0))));
507
- this._stick();
508
- this._voice?.onData(data);
509
- tries = 0;
510
- }
511
- catch (e) {
512
- if (++tries > 5)
513
- break;
514
- this._again = true;
515
- await new Promise(r => setTimeout(r, 300 * tries));
516
- }
517
- } while (this._again);
518
- }
519
- finally {
520
- this._loading = null;
521
- }
522
- })();
523
- },
524
- /**
525
- * Новый результат (publish / data.results) или файл во время работы:
526
- * - если размещён результат (publish / data.results) — сразу открываем правую панель
527
- * и переключаемся на вкладку «Результаты»;
528
- * - если создан обычный файл: при открытом доке показываем список файлов, при закрытом — индикатор на кольце.
529
- */
530
- _noticeDocs(before) {
531
- const resultKeys = (this.data?.results || []).filter(r => r?.snapshot).map(r => 'result:' + r.snapshot);
532
- const fileKeys = this.files.map(f => f.key);
533
- const keys = [...resultKeys, ...fileKeys];
534
- this._docKeys = keys;
535
- if (!before) {
536
- if (resultKeys.length) {
537
- this.dockOpen = true;
538
- this.dockTab = 'results';
539
- this.resultKey = resultKeys.at(-1);
540
- this.resultKeyAt = Date.now();
541
- this.freshDocs = 0;
542
- }
543
- return;
544
- }
545
- const added = keys.filter(k => !before.includes(k));
546
- const newResultKeys = added.filter(k => k.startsWith('result:'));
547
- const files = added.map(k => this.files.find(f => f.key === k)).filter(f => f && f.source !== 'user');
548
- if (!newResultKeys.length && !files.length)
549
- return;
550
- if (newResultKeys.length) {
551
- this.dockOpen = true;
552
- this.dockTab = 'results';
553
- this.resultKey = newResultKeys.at(-1);
554
- this.resultKeyAt = Date.now();
555
- this.freshDocs = 0;
556
- return;
557
- }
558
- if (!this.dockOpen) {
559
- this.freshDocs += files.length;
560
- return;
561
- }
562
- if (files.length && ['context', 'files'].includes(this.dockTab))
563
- this.dockTab = 'files';
564
- else
565
- this.freshDocs += files.length;
566
- },
567
- onScroll(e) {
568
- if (this._sticking)
569
- return;
570
- const el = e.target;
571
- if (!el || el.clientHeight <= 0)
572
- return;
573
- const dist = el.scrollHeight - el.scrollTop - el.clientHeight;
574
- const movedUp = this._lastScrollTop != null && el.scrollTop < this._lastScrollTop - 4;
575
- this._lastScrollTop = el.scrollTop;
576
- if (dist < 80) {
577
- if (!this.pinned)
578
- this.pinned = true;
579
- }
580
- else if (movedUp && this.pinned) {
581
- this.pinned = false;
582
- }
583
- },
584
- /** Прилипание к низу, пока пользователь не отмотал вверх. */
585
- _stick() {
586
- if (!this.pinned)
587
- return;
588
- cancelAnimationFrame(this._raf);
589
- this._raf = requestAnimationFrame(() => {
590
- const el = this.$('.scroller');
591
- if (!el || !this.pinned)
592
- return;
593
- this._sticking = true;
594
- el.scrollTop = el.scrollHeight;
595
- this._lastScrollTop = el.scrollTop;
596
- requestAnimationFrame(() => {
597
- if (this.pinned && el) {
598
- el.scrollTop = el.scrollHeight;
599
- this._lastScrollTop = el.scrollTop;
600
- }
601
- this._sticking = false;
602
- });
603
- });
604
- },
605
- toBottom() {
606
- this.pinned = true;
607
- const el = this.$('.scroller');
608
- if (el) {
609
- el.scrollTo({ top: el.scrollHeight, behavior: 'smooth' });
610
- this._lastScrollTop = el.scrollHeight;
611
- }
612
- },
613
- /** Голосовой режим: вкл/выкл (включение просит микрофон — только по клику человека). */
614
- async toggleVoice(on) {
615
- const want = on ?? !this.voiceOn;
616
- if (!want) {
617
- this._voice?.disable();
618
- this.voiceOn = false;
619
- return;
620
- }
621
- this._voice ??= new VoiceController(this);
622
- this.voiceOn = await this._voice.enable();
623
- },
624
- optimisticUser(text, attachments, voice = false) {
625
- if (!text && !attachments?.length)
626
- return;
627
- this.optimistic = { id: 'optimistic', type: 'user', content: text, attachments, time: Date.now(), ...(voice ? { voice: true } : {}) };
628
- this.pinned = true;
629
- this.status = 'running';
630
- this._stick();
631
- },
632
- toast(text) {
633
- this.toastText = String(text || '');
634
- clearTimeout(this._toastT);
635
- this._toastT = setTimeout(() => this.toastText = '', 3500);
636
- },
637
- /** Ответ на вызов: подтверждение ({accept, always, content}) или ответ на вопрос ({content, values}). */
638
- async reply(callId, payload = {}) {
639
- const res = await this.$item?.fetch('approve', {}, JSON.stringify({ call: callId, ...payload }));
640
- if (res && res.ok === false)
641
- this.toast(res.error || 'Не удалось отправить ответ');
642
- else if (res?.moved)
643
- await this._handleTaskMoved(res.moved);
644
- else if (this.$item?.path && navigator.serviceWorker?.controller) {
645
- try {
646
- navigator.serviceWorker.controller.postMessage({ type: 'work:task-visible', task: this.$item.path });
647
- }
648
- catch { /* ignore */ }
649
- }
650
- },
651
- async _handleTaskMoved(moved) {
652
- if (!moved?.newPath || this._movedHandledPath === moved.newPath)
653
- return;
654
- this._movedHandledPath = moved.newPath;
655
- let inChat = false;
656
- for (let p = this.parentElement || this.getRootNode?.()?.host; p; p = p.parentElement || p.getRootNode?.()?.host) {
657
- if (p.localName === 'chat-item' || p.localName === 'oda-chat' || p.localName === 'form-chat') {
658
- inChat = true;
659
- break;
660
- }
661
- }
662
- if (inChat) {
663
- this.dispatchEvent(new CustomEvent('work-task-moved', {
664
- bubbles: true,
665
- composed: true,
666
- detail: moved,
667
- }));
668
- return;
669
- }
670
- if (typeof location !== 'undefined')
671
- location.href = encodeURI(moved.newPath + '/~/handlers//form/index.html');
672
- },
673
- /** Кратко объяснить действие и последствия ожидающего подтверждения с помощью быстрой модели. */
674
- async explainCall(callId) {
675
- return this.$item?.fetch('explain_call', {}, JSON.stringify({ call: callId }));
676
- },
677
- async revert(item) {
678
- if (!item?.id || item.id === 'optimistic')
679
- return;
680
- // про файлы спрашиваем только если агент в откатываемом диапазоне реально что-то менял
681
- const dry = await this.$item?.fetch('revert', { id: item.id, dry: 1 });
682
- const changed = dry?.files || [];
683
- let withFiles = false;
684
- if (changed.length) {
685
- const list = changed.slice(0, 6).map(f => '• ' + f.path).join('\n') + (changed.length > 6 ? '\n… и ещё ' + (changed.length - 6) : '');
686
- const manual = dry?.manual?.length ? '\n\nЕщё ' + dry.manual.length + ' изменений агента автоматически не откатываются.' : '';
687
- withFiles = confirm('После этого сообщения агент менял файлы (' + changed.length + '):\n' + list + manual
688
- + '\n\nОК — откатить ленту и вернуть файлы\nОтмена — откатить только ленту (файлы останутся как есть)');
689
- }
690
- const res = await this.$item?.fetch('revert', { id: item.id, ...(withFiles ? { files: 1 } : {}) });
691
- if (!res || res.ok === false)
692
- return this.toast(res?.error || 'Откат не удался');
693
- this.optimistic = null;
694
- this.$('microchat-panel')?.prefill(res.prompt ? res : { prompt: item.content, attachments: item.attachments });
695
- if (res.files) {
696
- const skipped = res.files.skipped || [];
697
- this.toast('Файлы возвращены: ' + (res.files.reverted || []).length
698
- + (skipped.length ? '. Не тронуты (' + skipped.length + '): ' + skipped.slice(0, 2).map(s => s.path.split('/').pop() + ' — ' + s.reason).join('; ') : ''));
699
- }
700
- },
701
- toggleGroup(id, open) {
702
- this.groupOpen = { ...this.groupOpen, [id]: open };
703
- },
704
- toggleDock(open) {
705
- this.dockOpen = open ?? !this.dockOpen;
706
- if (this.dockOpen)
707
- this.freshDocs = 0;
708
- },
709
- /** Выбор вкладки в правой панели доков. */
710
- selectTab(key) {
711
- const tab = ['context', 'monitor', 'results', 'files'].includes(key) ? key : 'context';
712
- this.dockTab = tab;
713
- if (this.dockOpen)
714
- this.freshDocs = 0;
715
- },
716
- /**
717
- * Открыть док: опубликованный результат (key result:…) → вкладка «Результаты»;
718
- * любой файл → штатное открытие в форме WORK (work-form / execute).
719
- */
720
- openDoc(doc = {}) {
721
- if (String(doc.key || '').startsWith('result:')) {
722
- this.resultKey = doc.key;
723
- this.resultKeyAt = Date.now();
724
- this.dockTab = 'results';
725
- this.dockOpen = true;
726
- this.freshDocs = 0;
727
- return;
728
- }
729
- const path = doc.real || doc.path || '';
730
- if (path)
731
- this.openWorkPath(path, doc.snapshot || doc.path);
732
- },
733
- /** Сохранить текстовый док файлом в класс задачи → путь. */
734
- async saveDoc(name, text) {
735
- try {
736
- const owner = await Promise.resolve(this.$item.$owner);
737
- const log = await owner.save_file(new File([String(text || '')], name, { type: 'text/markdown' }));
738
- const path = log?.logFullPath || log?.path || name;
739
- this.toast('Сохранено: ' + path);
740
- return path;
741
- }
742
- catch (e) {
743
- this.toast('Не удалось сохранить: ' + (e?.message || e));
744
- return '';
745
- }
746
- },
747
- /** Путь WORK: всегда открывает существующий элемент (включая файлы и документы) в стандартном представлении формы; при отсутствии показывает toast вместо битой вкладки. */
748
- async openWorkPath(path, fallbackPath = '') {
749
- const raw = String(path || '').trim();
750
- if (!raw)
751
- return;
752
- const targetPath = realPathOfSnapshot(raw) || raw;
753
- const candidates = [targetPath];
754
- for (const alt of [raw, String(fallbackPath || '').trim()]) {
755
- if (alt && !candidates.includes(alt))
756
- candidates.push(alt);
757
- }
758
- let item = null;
759
- for (const p of candidates) {
760
- try {
761
- let found = await WORK.get_item(p);
762
- if (Array.isArray(found))
763
- found = found.at(-1) || null;
764
- if (found) {
765
- item = found;
766
- break;
767
- }
768
- }
769
- catch { /* пробуем следующий вариант */ }
770
- }
771
- if (!item) {
772
- this.toast('Файл или элемент не найден: ' + targetPath);
773
- return;
774
- }
775
- const exec = window.top?.execute || window.execute;
776
- if (typeof exec === 'function') {
777
- await exec(item);
778
- return;
779
- }
780
- window.open(workHref(item.path || targetPath), '_blank');
781
- },
782
- closeView() {
783
- this.fire('close-view');
784
- },
785
- };