@celljs/ta 4.14.0 → 4.15.0

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 (319) hide show
  1. package/dist/cli.mjs +29 -4
  2. package/dist/gateway.mjs +156 -46
  3. package/dist/pi/CHANGELOG.md +6 -0
  4. package/dist/pi/package.json +1 -1
  5. package/dist/pi/packages/ta-agents/extension/index.mjs +50 -21
  6. package/dist/pi/packages/ta-agents/lib/texts.d.ts +43 -22
  7. package/dist/pi/packages/ta-agents/lib/texts.js +54 -21
  8. package/dist/pi/packages/ta-agents/package.json +7 -3
  9. package/dist/pi/packages/ta-bots/extension/index.mjs +81 -10
  10. package/dist/pi/packages/ta-bots/host/index.mjs +132 -49
  11. package/dist/pi/packages/ta-bots/lib/i18n.d.ts +3 -0
  12. package/dist/pi/packages/ta-bots/lib/i18n.js +167 -2
  13. package/dist/pi/packages/ta-bots/lib/server-texts.d.ts +0 -1
  14. package/dist/pi/packages/ta-bots/lib/server-texts.js +45 -12
  15. package/dist/pi/packages/ta-bots/package.json +7 -3
  16. package/dist/pi/packages/ta-bots/web/index.js +203 -1
  17. package/dist/pi/packages/ta-changes/lib/i18n.d.ts +3 -0
  18. package/dist/pi/packages/ta-changes/lib/i18n.js +51 -2
  19. package/dist/pi/packages/ta-changes/package.json +7 -3
  20. package/dist/pi/packages/ta-changes/web/index.js +87 -1
  21. package/dist/pi/packages/ta-channels/extension/index.mjs +78 -13
  22. package/dist/pi/packages/ta-channels/host/index.mjs +121 -56
  23. package/dist/pi/packages/ta-channels/lib/agent-cards.d.ts +2 -1
  24. package/dist/pi/packages/ta-channels/lib/agent-cards.js +4 -3
  25. package/dist/pi/packages/ta-channels/lib/handoff.d.ts +5 -4
  26. package/dist/pi/packages/ta-channels/lib/handoff.js +22 -6
  27. package/dist/pi/packages/ta-channels/lib/i18n.d.ts +3 -0
  28. package/dist/pi/packages/ta-channels/lib/i18n.js +361 -2
  29. package/dist/pi/packages/ta-channels/lib/team-ask.d.ts +2 -1
  30. package/dist/pi/packages/ta-channels/lib/team-ask.js +19 -7
  31. package/dist/pi/packages/ta-channels/lib/team.d.ts +2 -2
  32. package/dist/pi/packages/ta-channels/lib/team.js +1 -1
  33. package/dist/pi/packages/ta-channels/package.json +7 -3
  34. package/dist/pi/packages/ta-channels/web/index.js +482 -47
  35. package/dist/pi/packages/ta-computer-use/extension/index.mjs +11 -1
  36. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.js +20 -2
  37. package/dist/pi/packages/ta-computer-use/package.json +7 -3
  38. package/dist/pi/packages/ta-cron/extension/index.mjs +82 -8
  39. package/dist/pi/packages/ta-cron/host/index.mjs +67 -3
  40. package/dist/pi/packages/ta-cron/lib/editor.js +1 -1
  41. package/dist/pi/packages/ta-cron/lib/i18n.d.ts +3 -0
  42. package/dist/pi/packages/ta-cron/lib/i18n.js +217 -2
  43. package/dist/pi/packages/ta-cron/lib/page.js +14 -4
  44. package/dist/pi/packages/ta-cron/lib/schedule-util.js +29 -3
  45. package/dist/pi/packages/ta-cron/lib/server-texts.d.ts +2 -1
  46. package/dist/pi/packages/ta-cron/lib/server-texts.js +16 -9
  47. package/dist/pi/packages/ta-cron/package.json +7 -3
  48. package/dist/pi/packages/ta-cron/web/index.js +294 -10
  49. package/dist/pi/packages/ta-extensions/lib/i18n.d.ts +3 -0
  50. package/dist/pi/packages/ta-extensions/lib/i18n.js +240 -2
  51. package/dist/pi/packages/ta-extensions/package.json +7 -3
  52. package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +1 -0
  53. package/dist/pi/packages/ta-extensions/web/index.js +329 -42
  54. package/dist/pi/packages/ta-games/README.en.md +1 -1
  55. package/dist/pi/packages/ta-games/README.md +1 -1
  56. package/dist/pi/packages/ta-games/lib/i18n.d.ts +3 -0
  57. package/dist/pi/packages/ta-games/lib/i18n.js +61 -2
  58. package/dist/pi/packages/ta-games/package.json +7 -3
  59. package/dist/pi/packages/ta-games/skills/ta-game/SKILL.md +41 -3
  60. package/dist/pi/packages/ta-games/web/index.js +97 -1
  61. package/dist/pi/packages/ta-glance/extension/index.mjs +31 -13
  62. package/dist/pi/packages/ta-glance/lib/glance-json.d.ts +2 -0
  63. package/dist/pi/packages/ta-glance/lib/glance-json.js +38 -16
  64. package/dist/pi/packages/ta-glance/lib/i18n.d.ts +3 -0
  65. package/dist/pi/packages/ta-glance/lib/i18n.js +31 -2
  66. package/dist/pi/packages/ta-glance/package.json +7 -3
  67. package/dist/pi/packages/ta-glance/web/index.js +98 -14
  68. package/dist/pi/packages/ta-initiative/extension/index.mjs +89 -9
  69. package/dist/pi/packages/ta-initiative/host/index.mjs +120 -19
  70. package/dist/pi/packages/ta-initiative/lib/chat-kinds.js +15 -3
  71. package/dist/pi/packages/ta-initiative/lib/cron-proposals.js +20 -3
  72. package/dist/pi/packages/ta-initiative/lib/event-proposals.d.ts +2 -1
  73. package/dist/pi/packages/ta-initiative/lib/event-proposals.js +20 -6
  74. package/dist/pi/packages/ta-initiative/lib/i18n.d.ts +3 -0
  75. package/dist/pi/packages/ta-initiative/lib/i18n.js +151 -2
  76. package/dist/pi/packages/ta-initiative/lib/inbox.js +2 -1
  77. package/dist/pi/packages/ta-initiative/lib/initiative-protocol.d.ts +13 -4
  78. package/dist/pi/packages/ta-initiative/lib/initiative-protocol.js +11 -1
  79. package/dist/pi/packages/ta-initiative/lib/initiative-service.js +1 -1
  80. package/dist/pi/packages/ta-initiative/lib/material-util.d.ts +2 -1
  81. package/dist/pi/packages/ta-initiative/lib/material-util.js +9 -3
  82. package/dist/pi/packages/ta-initiative/lib/review-service.js +1 -1
  83. package/dist/pi/packages/ta-initiative/lib/server-texts.d.ts +2 -1
  84. package/dist/pi/packages/ta-initiative/lib/server-texts.js +11 -4
  85. package/dist/pi/packages/ta-initiative/lib/settings.js +2 -3
  86. package/dist/pi/packages/ta-initiative/package.json +7 -3
  87. package/dist/pi/packages/ta-initiative/web/index.js +197 -5
  88. package/dist/pi/packages/ta-launcher/lib/i18n.d.ts +3 -0
  89. package/dist/pi/packages/ta-launcher/lib/i18n.js +71 -2
  90. package/dist/pi/packages/ta-launcher/package.json +7 -3
  91. package/dist/pi/packages/ta-launcher/web/index.js +107 -1
  92. package/dist/pi/packages/ta-manual/README.en.md +1 -1
  93. package/dist/pi/packages/ta-manual/README.md +1 -1
  94. package/dist/pi/packages/ta-manual/lib/i18n.d.ts +3 -0
  95. package/dist/pi/packages/ta-manual/lib/i18n.js +21 -2
  96. package/dist/pi/packages/ta-manual/lib/manual-util.js +2 -1
  97. package/dist/pi/packages/ta-manual/lib/pictures-c.js +30 -0
  98. package/dist/pi/packages/ta-manual/lib/topics.d.ts +4 -0
  99. package/dist/pi/packages/ta-manual/lib/topics.js +188 -71
  100. package/dist/pi/packages/ta-manual/package.json +7 -3
  101. package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +9 -0
  102. package/dist/pi/packages/ta-manual/web/index.js +405 -119
  103. package/dist/pi/packages/ta-moments/extension/index.mjs +242 -102
  104. package/dist/pi/packages/ta-moments/host/index.mjs +268 -115
  105. package/dist/pi/packages/ta-moments/lib/i18n.d.ts +3 -0
  106. package/dist/pi/packages/ta-moments/lib/i18n.js +170 -3
  107. package/dist/pi/packages/ta-moments/lib/moments-host.js +24 -11
  108. package/dist/pi/packages/ta-moments/lib/page.js +4 -2
  109. package/dist/pi/packages/ta-moments/lib/server-texts.d.ts +10 -12
  110. package/dist/pi/packages/ta-moments/lib/server-texts.js +128 -62
  111. package/dist/pi/packages/ta-moments/lib/talk-host.js +29 -8
  112. package/dist/pi/packages/ta-moments/package.json +7 -3
  113. package/dist/pi/packages/ta-moments/web/index.js +260 -43
  114. package/dist/pi/packages/ta-nearby/extension/index.mjs +229 -32
  115. package/dist/pi/packages/ta-nearby/host/index.mjs +248 -35
  116. package/dist/pi/packages/ta-nearby/lib/i18n.d.ts +3 -0
  117. package/dist/pi/packages/ta-nearby/lib/i18n.js +173 -2
  118. package/dist/pi/packages/ta-nearby/lib/nearby-service.d.ts +2 -4
  119. package/dist/pi/packages/ta-nearby/lib/nearby-service.js +21 -3
  120. package/dist/pi/packages/ta-nearby/lib/page.js +5 -4
  121. package/dist/pi/packages/ta-nearby/lib/server-texts.d.ts +5 -13
  122. package/dist/pi/packages/ta-nearby/lib/server-texts.js +194 -42
  123. package/dist/pi/packages/ta-nearby/package.json +7 -3
  124. package/dist/pi/packages/ta-nearby/web/index.js +213 -5
  125. package/dist/pi/packages/ta-notify/extension/index.mjs +54 -5
  126. package/dist/pi/packages/ta-notify/lib/i18n.d.ts +3 -0
  127. package/dist/pi/packages/ta-notify/lib/i18n.js +53 -2
  128. package/dist/pi/packages/ta-notify/lib/server-texts.d.ts +2 -1
  129. package/dist/pi/packages/ta-notify/lib/server-texts.js +16 -5
  130. package/dist/pi/packages/ta-notify/package.json +7 -3
  131. package/dist/pi/packages/ta-notify/web/index.js +89 -1
  132. package/dist/pi/packages/ta-recall/extension/index.mjs +52 -2
  133. package/dist/pi/packages/ta-recall/host/index.mjs +136 -55
  134. package/dist/pi/packages/ta-recall/lib/brief-util.d.ts +6 -3
  135. package/dist/pi/packages/ta-recall/lib/brief-util.js +26 -5
  136. package/dist/pi/packages/ta-recall/lib/extension-util.d.ts +2 -1
  137. package/dist/pi/packages/ta-recall/lib/extension-util.js +7 -1
  138. package/dist/pi/packages/ta-recall/lib/i18n.d.ts +3 -0
  139. package/dist/pi/packages/ta-recall/lib/i18n.js +89 -2
  140. package/dist/pi/packages/ta-recall/lib/keep-util.d.ts +2 -1
  141. package/dist/pi/packages/ta-recall/lib/keep-util.js +8 -1
  142. package/dist/pi/packages/ta-recall/lib/recall-service.js +5 -3
  143. package/dist/pi/packages/ta-recall/lib/server-texts.d.ts +2 -3
  144. package/dist/pi/packages/ta-recall/lib/server-texts.js +15 -8
  145. package/dist/pi/packages/ta-recall/package.json +7 -3
  146. package/dist/pi/packages/ta-recall/web/index.js +164 -9
  147. package/dist/pi/packages/ta-rooms/extension/index.mjs +60 -3
  148. package/dist/pi/packages/ta-rooms/host/index.mjs +284 -37
  149. package/dist/pi/packages/ta-rooms/lib/dialogs.js +2 -1
  150. package/dist/pi/packages/ta-rooms/lib/double-agents.js +31 -7
  151. package/dist/pi/packages/ta-rooms/lib/double-grants.js +57 -13
  152. package/dist/pi/packages/ta-rooms/lib/double-host.js +31 -5
  153. package/dist/pi/packages/ta-rooms/lib/double-i18n.d.ts +3 -0
  154. package/dist/pi/packages/ta-rooms/lib/double-i18n.js +201 -2
  155. package/dist/pi/packages/ta-rooms/lib/double-tasks.d.ts +2 -1
  156. package/dist/pi/packages/ta-rooms/lib/double-tasks.js +93 -21
  157. package/dist/pi/packages/ta-rooms/lib/double-user.js +1 -1
  158. package/dist/pi/packages/ta-rooms/lib/double-util.d.ts +1 -1
  159. package/dist/pi/packages/ta-rooms/lib/double-util.js +22 -3
  160. package/dist/pi/packages/ta-rooms/lib/doubles-store.js +2 -1
  161. package/dist/pi/packages/ta-rooms/lib/friend-notices.js +27 -8
  162. package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +3 -0
  163. package/dist/pi/packages/ta-rooms/lib/i18n.js +243 -2
  164. package/dist/pi/packages/ta-rooms/package.json +7 -3
  165. package/dist/pi/packages/ta-rooms/web/index.js +479 -4
  166. package/dist/pi/packages/ta-share/extension/index.mjs +98 -23
  167. package/dist/pi/packages/ta-share/lib/i18n.d.ts +3 -0
  168. package/dist/pi/packages/ta-share/lib/i18n.js +203 -2
  169. package/dist/pi/packages/ta-share/lib/page.js +1 -1
  170. package/dist/pi/packages/ta-share/lib/server-texts.d.ts +2 -1
  171. package/dist/pi/packages/ta-share/lib/server-texts.js +60 -29
  172. package/dist/pi/packages/ta-share/package.json +7 -3
  173. package/dist/pi/packages/ta-share/web/index.js +240 -2
  174. package/dist/pi/packages/ta-sync/host/index.mjs +170 -25
  175. package/dist/pi/packages/ta-sync/lib/i18n.d.ts +3 -0
  176. package/dist/pi/packages/ta-sync/lib/i18n.js +173 -2
  177. package/dist/pi/packages/ta-sync/lib/migrate-i18n.d.ts +3 -0
  178. package/dist/pi/packages/ta-sync/lib/migrate-i18n.js +183 -2
  179. package/dist/pi/packages/ta-sync/lib/server-texts.d.ts +0 -1
  180. package/dist/pi/packages/ta-sync/lib/server-texts.js +132 -35
  181. package/dist/pi/packages/ta-sync/package.json +7 -3
  182. package/dist/pi/packages/ta-sync/web/index.js +389 -2
  183. package/dist/pi/packages/ta-sync-cloud/host/index.mjs +52 -23
  184. package/dist/pi/packages/ta-sync-cloud/lib/host.js +49 -20
  185. package/dist/pi/packages/ta-sync-cloud/package.json +7 -3
  186. package/dist/pi/packages/ta-team/README.en.md +1 -1
  187. package/dist/pi/packages/ta-team/README.md +1 -1
  188. package/dist/pi/packages/ta-team/extension/index.mjs +86 -37
  189. package/dist/pi/packages/ta-team/host/index.mjs +130 -43
  190. package/dist/pi/packages/ta-team/lib/dialogs.js +62 -6
  191. package/dist/pi/packages/ta-team/lib/i18n.d.ts +7 -1
  192. package/dist/pi/packages/ta-team/lib/i18n.js +431 -8
  193. package/dist/pi/packages/ta-team/lib/member-dialog.js +30 -25
  194. package/dist/pi/packages/ta-team/lib/page.js +5 -1
  195. package/dist/pi/packages/ta-team/lib/style.d.ts +1 -1
  196. package/dist/pi/packages/ta-team/lib/style.js +11 -4
  197. package/dist/pi/packages/ta-team/lib/team-invites.d.ts +14 -8
  198. package/dist/pi/packages/ta-team/lib/team-invites.js +38 -6
  199. package/dist/pi/packages/ta-team/package.json +7 -3
  200. package/dist/pi/packages/ta-team/web/index.js +677 -96
  201. package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +3 -0
  202. package/dist/pi/packages/ta-workspace/lib/i18n.js +417 -1
  203. package/dist/pi/packages/ta-workspace/package.json +7 -3
  204. package/dist/pi/packages/ta-workspace/web/index.js +504 -40
  205. package/dist/public/assets/GLTFLoader-C8PT6dAj.js +1 -0
  206. package/dist/public/assets/SkeletonUtils-BBAzQdty.js +1 -0
  207. package/dist/public/assets/{abnfDiagram-S7VZAUFO-DMceNIR5.js → abnfDiagram-S7VZAUFO-sclOP11q.js} +1 -1
  208. package/dist/public/assets/{architecture-WOLXFQ4H-5AdYeEv8.js → architecture-WOLXFQ4H-Bitg4Dpy.js} +1 -1
  209. package/dist/public/assets/{architectureDiagram-YGSQEFNW-CqkJHg0A.js → architectureDiagram-YGSQEFNW-Hc0W5khF.js} +1 -1
  210. package/dist/public/assets/{blockDiagram-APKKGZFW-BtuHdIjQ.js → blockDiagram-APKKGZFW-D2ZWatLV.js} +1 -1
  211. package/dist/public/assets/{browser-Ds5TwWWr.js → browser-D-etIMuL.js} +1 -1
  212. package/dist/public/assets/{c4Diagram-KJ2TOQU5-eebbjTgZ.js → c4Diagram-KJ2TOQU5-CWEcyfwV.js} +1 -1
  213. package/dist/public/assets/{chunk-6MUBBAK2-BjMKSfTf.js → chunk-6MUBBAK2-CWbrJHxK.js} +1 -1
  214. package/dist/public/assets/{chunk-AXFCVDMN-BElluw_7.js → chunk-AXFCVDMN-DJQdD4iX.js} +1 -1
  215. package/dist/public/assets/{chunk-BG4553SI-CUDwpWNL.js → chunk-BG4553SI-CYiiJcBj.js} +1 -1
  216. package/dist/public/assets/{chunk-DQASFODM-B-92o8Uj.js → chunk-DQASFODM-NrNC1UeX.js} +1 -1
  217. package/dist/public/assets/{chunk-HFQBQIA3-pveEMcXK.js → chunk-HFQBQIA3-BIHXOwS2.js} +1 -1
  218. package/dist/public/assets/{chunk-KQLB2F66-m7DKNjYW.js → chunk-KQLB2F66-CcU_AFwQ.js} +1 -1
  219. package/dist/public/assets/{chunk-KS47KZWR-CnSSETdj.js → chunk-KS47KZWR-DGfNbbcL.js} +1 -1
  220. package/dist/public/assets/{chunk-LEVMRMFU-Ds7OnJrC.js → chunk-LEVMRMFU-B4PSS_Pp.js} +1 -1
  221. package/dist/public/assets/{chunk-M57EVK23-PJSYCuUh.js → chunk-M57EVK23-1555_mm4.js} +1 -1
  222. package/dist/public/assets/{chunk-OY52VR5R-C3ygRwSC.js → chunk-OY52VR5R-zbNEbYJ8.js} +1 -1
  223. package/dist/public/assets/{chunk-QB3YPZ4I-DcFtmZh7.js → chunk-QB3YPZ4I-C-nNDGuN.js} +1 -1
  224. package/dist/public/assets/{chunk-R3KSYZAL-B4BOidE6.js → chunk-R3KSYZAL-DcXXuhbl.js} +1 -1
  225. package/dist/public/assets/{chunk-STOXU5M4-DcXfwN7k.js → chunk-STOXU5M4-Bb77QkUj.js} +1 -1
  226. package/dist/public/assets/{chunk-TU62E6Q5-B-rpQQxX.js → chunk-TU62E6Q5-D8IJkNq5.js} +1 -1
  227. package/dist/public/assets/{chunk-X4PVCEUW-BBtlFSw1.js → chunk-X4PVCEUW-BzejexgB.js} +1 -1
  228. package/dist/public/assets/{chunk-XXDRQBXY-Do8BIocv.js → chunk-XXDRQBXY-D2GPHyll.js} +1 -1
  229. package/dist/public/assets/{classDiagram-v2-L25IHNXF-bhGAODMS.js → classDiagram-v2-L25IHNXF-CUEzxxI8.js} +1 -1
  230. package/dist/public/assets/{cose-bilkent-JH36ORCC-B7Qv6Hv_.js → cose-bilkent-JH36ORCC-CJdgJyUw.js} +1 -1
  231. package/dist/public/assets/cynefin-EF2NZ3EQ-DBnkPRHn.js +1 -0
  232. package/dist/public/assets/{cynefinDiagram-L36ESFBY-BX-R5Z6L.js → cynefinDiagram-L36ESFBY-D0F_9jN8.js} +1 -1
  233. package/dist/public/assets/{d3-selection-D3xgEEla.js → d3-selection-BoARy1rP.js} +1 -1
  234. package/dist/public/assets/{dagre-SPEB5RXH-MfJ9yO0v.js → dagre-SPEB5RXH-CzI5gZOv.js} +1 -1
  235. package/dist/public/assets/{diagram-3B7GL73J-DxFRc2vC.js → diagram-3B7GL73J-BCtNcE7M.js} +1 -1
  236. package/dist/public/assets/{diagram-DNEMPZML-BcBwOLbM.js → diagram-DNEMPZML-DV9U4KeH.js} +1 -1
  237. package/dist/public/assets/{diagram-L3MUGCDN--Rw-isPI.js → diagram-L3MUGCDN-DHU45Sd4.js} +1 -1
  238. package/dist/public/assets/{diagram-LA4NIPWU-DXkY85UN.js → diagram-LA4NIPWU-Ba5oVP56.js} +1 -1
  239. package/dist/public/assets/{diagram-MHCOC4E2-CbNmfAid.js → diagram-MHCOC4E2-B1Nk6qet.js} +1 -1
  240. package/dist/public/assets/{diagram-XPFHEONP-D1nGQjzf.js → diagram-XPFHEONP-DFwA3q09.js} +1 -1
  241. package/dist/public/assets/{dist-B1JMTrET.js → dist-Col1xVDT.js} +1 -1
  242. package/dist/public/assets/{ebnfDiagram-UZSYDL2S-DGXbVfke.js → ebnfDiagram-UZSYDL2S-BuBgxBJ2.js} +1 -1
  243. package/dist/public/assets/{editor.api-e3yQoo1r.js → editor.api-BLlyFz5x.js} +1 -1
  244. package/dist/public/assets/{elk-XV6XMXQE-pA-iT6fg.js → elk-XV6XMXQE-BPEI--zX.js} +1 -1
  245. package/dist/public/assets/{erDiagram-EYBAPDEH-BpgBun7y.js → erDiagram-EYBAPDEH-Cci0kYUw.js} +1 -1
  246. package/dist/public/assets/{eventmodeling-K75KTNOO-CVfyCcul.js → eventmodeling-K75KTNOO-B0eT5X1_.js} +1 -1
  247. package/dist/public/assets/flowDiagram-MALGAFMO-CmMdmAxj.js +1 -0
  248. package/dist/public/assets/{freemarker2-dYGec-fT.js → freemarker2-CAZGFA3W.js} +1 -1
  249. package/dist/public/assets/{ganttDiagram-23REXITY-DjLTTWwA.js → ganttDiagram-23REXITY-DEm85e1I.js} +1 -1
  250. package/dist/public/assets/gitGraph-VSP46ZUC-DKo3OVhR.js +1 -0
  251. package/dist/public/assets/{gitGraphDiagram-STJD7YCW-D9m7IVyJ.js → gitGraphDiagram-STJD7YCW-DJAZD2LR.js} +1 -1
  252. package/dist/public/assets/{handlebars-Bxerz7ci.js → handlebars-Agkl4nGr.js} +1 -1
  253. package/dist/public/assets/{html-DlVnGsdp.js → html-Cu-CsqZI.js} +1 -1
  254. package/dist/public/assets/{index-CZmGe9gc.js → index-TeLHaE4u.js} +2 -2
  255. package/dist/public/assets/info-OHQRW6UA-tKl26QqM.js +1 -0
  256. package/dist/public/assets/{infoDiagram-KBXO4MBG-DoYdhkAy.js → infoDiagram-KBXO4MBG-4zHsBnIy.js} +1 -1
  257. package/dist/public/assets/{ishikawaDiagram-M35NCXHK-Bc0GAInW.js → ishikawaDiagram-M35NCXHK-Bg8OYLGr.js} +1 -1
  258. package/dist/public/assets/ja-BHBiml1x.js +12 -0
  259. package/dist/public/assets/{javascript-DZrowo_I.js → javascript-BdMDRX8l.js} +1 -1
  260. package/dist/public/assets/{journeyDiagram-OPLOXDXO-BM7Dwstu.js → journeyDiagram-OPLOXDXO-B2xtzmpE.js} +1 -1
  261. package/dist/public/assets/{jsonMode-Bs30wPr5.js → jsonMode-Dg92qQvX.js} +1 -1
  262. package/dist/public/assets/{kanban-definition-BZKZHSQY-CO-Crrdu.js → kanban-definition-BZKZHSQY-DQ4N7t_w.js} +1 -1
  263. package/dist/public/assets/{liquid-dLz9d3ax.js → liquid-BydEnYkh.js} +1 -1
  264. package/dist/public/assets/{mdx-DO0x92Kn.js → mdx-XZXeM7ll.js} +1 -1
  265. package/dist/public/assets/{mermaid-parser.core-BXwArNvw.js → mermaid-parser.core-H24--uw9.js} +3 -3
  266. package/dist/public/assets/{mermaid.core-C6mppfDC.js → mermaid.core-BmCrSjUU.js} +4 -4
  267. package/dist/public/assets/meshopt_decoder.module-DXTYc6wn.js +1 -0
  268. package/dist/public/assets/{mindmap-definition-I2QAS2VK-vcQ2EU4T.js → mindmap-definition-I2QAS2VK-CGQXKItp.js} +1 -1
  269. package/dist/public/assets/module-1mERtQ0Z.js +1 -0
  270. package/dist/public/assets/module-BxIQdJqY.js +2449 -0
  271. package/dist/public/assets/{monaco-J_Pr5zjk.js → monaco-DP8M_Ttp.js} +3 -3
  272. package/dist/public/assets/packet-JDAUHWVQ-CnBx3hR7.js +1 -0
  273. package/dist/public/assets/{pegDiagram-FD4XPPHP-DPDrbtS2.js → pegDiagram-FD4XPPHP-CXKRGFUs.js} +1 -1
  274. package/dist/public/assets/pie-XZMESJXO-hogxgeR2.js +1 -0
  275. package/dist/public/assets/{pieDiagram-J4AKIIQI-DXuaepGJ.js → pieDiagram-J4AKIIQI-9XEDP1wR.js} +1 -1
  276. package/dist/public/assets/{python-nnmIOv4s.js → python-C-0PA82u.js} +1 -1
  277. package/dist/public/assets/{quadrantDiagram-XTYBLID2-BuD_-coZ.js → quadrantDiagram-XTYBLID2-C-uxTp-5.js} +1 -1
  278. package/dist/public/assets/radar-ABXABTNO-CdWiN8Cw.js +1 -0
  279. package/dist/public/assets/railroad-I3PHUGI6-DnYOBI5V.js +1 -0
  280. package/dist/public/assets/{railroad-abnf-LNEFI6M7-CkCl68xY.js → railroad-abnf-LNEFI6M7-CTft_ST0.js} +1 -1
  281. package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-DO3GiRv6.js → railroad-ebnf-DWYD2UWJ-DfRJhL7G.js} +1 -1
  282. package/dist/public/assets/{railroad-peg-JR7BVNR7-DZBsKy4P.js → railroad-peg-JR7BVNR7-DFePx4YD.js} +1 -1
  283. package/dist/public/assets/{railroadDiagram-MRQ6NCDL-BeLq7Mqp.js → railroadDiagram-MRQ6NCDL-BmK1KUsT.js} +1 -1
  284. package/dist/public/assets/{razor-l2rRITgB.js → razor-DEKNSiT7.js} +1 -1
  285. package/dist/public/assets/{requirementDiagram-Y7LWUY3S-BBizkrON.js → requirementDiagram-Y7LWUY3S-Ds27pS9Y.js} +1 -1
  286. package/dist/public/assets/{sankeyDiagram-WGJFYUXA-tyo-p7oc.js → sankeyDiagram-WGJFYUXA-e2OTzBma.js} +1 -1
  287. package/dist/public/assets/{sequenceDiagram-5NDRBG5M-BSGPbeJX.js → sequenceDiagram-5NDRBG5M-BcoIpxF6.js} +1 -1
  288. package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-Dcdy66MQ.js → stateDiagram-v2-FJ4FJNEA-CNr67mC9.js} +1 -1
  289. package/dist/public/assets/{swimlanes-UMQ2AFYF-BJfgQyQo.js → swimlanes-UMQ2AFYF-DKPgHCev.js} +1 -1
  290. package/dist/public/assets/swimlanesDiagram-OMPLPG4O-U0uzjboz.js +8 -0
  291. package/dist/public/assets/{timeline-definition-SEUHKTQE-Ch8aQwF6.js → timeline-definition-SEUHKTQE-BcCmuE6C.js} +1 -1
  292. package/dist/public/assets/treeView-D4JQ5SDB-4ppY0Rs5.js +1 -0
  293. package/dist/public/assets/treemap-SAJKECNS-CAvLAs7q.js +1 -0
  294. package/dist/public/assets/{typescript-LasX-M7S.js → typescript-B1Uk3m6A.js} +1 -1
  295. package/dist/public/assets/{usecaseDiagram-AFA6YXN4-BzlSB4R4.js → usecaseDiagram-AFA6YXN4-BpCD8dP7.js} +1 -1
  296. package/dist/public/assets/{vennDiagram-NNMJR3RB-4xaWLrMk.js → vennDiagram-NNMJR3RB-CQjX5_-8.js} +1 -1
  297. package/dist/public/assets/wardley-7MLQ67FV-D_F3qmRJ.js +1 -0
  298. package/dist/public/assets/{wardleyDiagram-S7YFUSEH-C-iK1p-O.js → wardleyDiagram-S7YFUSEH-D7gYo9fV.js} +1 -1
  299. package/dist/public/assets/{xml-CGhYQUqn.js → xml-DBh_LekU.js} +1 -1
  300. package/dist/public/assets/{xychartDiagram-GGNKY7IX-CFsnisdM.js → xychartDiagram-GGNKY7IX-B_1aOZKU.js} +1 -1
  301. package/dist/public/assets/{yaml-BcOaPfuH.js → yaml-BE55tHva.js} +1 -1
  302. package/dist/public/assets/zh-tw-7q-tizR0.js +12 -0
  303. package/dist/public/index.html +1 -1
  304. package/dist/serve/index.mjs +814 -160
  305. package/package.json +37 -37
  306. package/dist/public/assets/cynefin-EF2NZ3EQ-Dfu5k3iG.js +0 -1
  307. package/dist/public/assets/flowDiagram-MALGAFMO-BHlXeeVG.js +0 -1
  308. package/dist/public/assets/gitGraph-VSP46ZUC-CFVSDv3q.js +0 -1
  309. package/dist/public/assets/info-OHQRW6UA-C_Db4yjo.js +0 -1
  310. package/dist/public/assets/module-C0tELrcJ.js +0 -1
  311. package/dist/public/assets/module-CteT9pTP.js +0 -2405
  312. package/dist/public/assets/packet-JDAUHWVQ-Bw7hmDUU.js +0 -1
  313. package/dist/public/assets/pie-XZMESJXO-cb_eq1B6.js +0 -1
  314. package/dist/public/assets/radar-ABXABTNO-Dqy-xoY_.js +0 -1
  315. package/dist/public/assets/railroad-I3PHUGI6-CBPVCTd3.js +0 -1
  316. package/dist/public/assets/swimlanesDiagram-OMPLPG4O-BWvcVkFg.js +0 -8
  317. package/dist/public/assets/treeView-D4JQ5SDB--XUqgqA6.js +0 -1
  318. package/dist/public/assets/treemap-SAJKECNS-CfrNtG7H.js +0 -1
  319. package/dist/public/assets/wardley-7MLQ67FV-BXBG-txR.js +0 -1
@@ -13,10 +13,10 @@ import { createBrotliDecompress, createGunzip, createInflate } from "zlib";
13
13
  import { EventEmitter } from "node:events";
14
14
  import { createReadStream as createReadStream$1, existsSync as existsSync$1, stat } from "fs";
15
15
  import { join as join$1, normalize, resolve as resolve$1, sep as sep$1 } from "path";
16
+ import { appendFile, mkdir, open, readFile, readdir, rename, rm, rmdir, stat as stat$1, writeFile } from "node:fs/promises";
16
17
  import { homedir, hostname, userInfo } from "node:os";
17
18
  import { spawn } from "node:child_process";
18
19
  import { connect, createServer as createServer$2 } from "node:net";
19
- import { appendFile, mkdir, open, readFile, readdir, rename, rm, rmdir, stat as stat$1, writeFile } from "node:fs/promises";
20
20
  // \0rolldown/runtime.js
21
21
  var __defProp = Object.defineProperty;
22
22
  var __esmMin = (fn, res, err) => () => {
@@ -14755,12 +14755,78 @@ var init_access_protocol = __esmMin((() => {
14755
14755
  TA_SIGN_IN_PATH = "/sign-in";
14756
14756
  }));
14757
14757
  // ../../ta-packages/ta-protocol/esm/common/auth-protocol.js
14758
- var TaAuthServer;
14758
+ var TaAuthServer, TA_CUSTOM_APIS;
14759
14759
  var init_auth_protocol = __esmMin((() => {
14760
14760
  TaAuthServer = Symbol("TaAuthServer");
14761
+ TA_CUSTOM_APIS = [
14762
+ "openai-completions",
14763
+ "openai-responses",
14764
+ "anthropic-messages",
14765
+ "google-generative-ai"
14766
+ ];
14761
14767
  }));
14762
14768
  // ../../ta-packages/ta-protocol/esm/common/gateway-protocol.js
14763
14769
  var init_gateway_protocol = __esmMin((() => {}));
14770
+ // ../../ta-packages/ta-protocol/esm/common/language.js
14771
+ var TaLanguageUtil;
14772
+ var init_language = __esmMin((() => {
14773
+ (function(TaLanguageUtil) {
14774
+ /** In the order the settings list them. */
14775
+ TaLanguageUtil.ALL = [
14776
+ "zh-CN",
14777
+ "zh-TW",
14778
+ "en-US",
14779
+ "ja-JP"
14780
+ ];
14781
+ /** The name of each, in itself. */
14782
+ TaLanguageUtil.NAMES = {
14783
+ "zh-CN": "简体中文",
14784
+ "zh-TW": "繁體中文",
14785
+ "en-US": "English",
14786
+ "ja-JP": "日本語"
14787
+ };
14788
+ /**
14789
+ * The language of a tag (`zh-HK`, `ja`, `zh_TW.UTF-8` of `LANG`): Traditional Chinese for Taiwan, Hong Kong,
14790
+ * Macau and `Hant`, Simplified for other Chinese, Japanese for Japanese, English for the rest.
14791
+ */
14792
+ function of(tag) {
14793
+ const said = (tag !== null && tag !== void 0 ? tag : "").toLowerCase().replace(/_/g, "-");
14794
+ if (/^zh(\b|-)/.test(said)) return /-hant\b/.test(said) || !/-hans\b/.test(said) && /-(tw|hk|mo)\b/.test(said) ? "zh-TW" : "zh-CN";
14795
+ return /^ja(\b|-)/.test(said) ? "ja-JP" : "en-US";
14796
+ }
14797
+ TaLanguageUtil.of = of;
14798
+ /** The language of what the server says: that of Ta's pages (`TA_LANGUAGE`, see TaSettingsServer.setLanguage), else the computer's. */
14799
+ function server(env = typeof process === "undefined" ? {} : process.env) {
14800
+ return of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG);
14801
+ }
14802
+ TaLanguageUtil.server = server;
14803
+ /** The words of a language, of one for each. */
14804
+ function pick(language, words) {
14805
+ return words[of(language)];
14806
+ }
14807
+ TaLanguageUtil.pick = pick;
14808
+ /** The words of the language of the server (`server()`), of one for each. */
14809
+ function say(words) {
14810
+ return words[server()];
14811
+ }
14812
+ TaLanguageUtil.say = say;
14813
+ /** Chinese, either. */
14814
+ function chinese(language) {
14815
+ return of(language).startsWith("zh");
14816
+ }
14817
+ TaLanguageUtil.chinese = chinese;
14818
+ /** Chinese or Japanese: words go without spaces, lists join with 、, a colon is :. */
14819
+ function cjk(language) {
14820
+ return of(language) !== "en-US";
14821
+ }
14822
+ TaLanguageUtil.cjk = cjk;
14823
+ /** A list of names in a language: `a、b`, `a, b`. */
14824
+ function list(language, items) {
14825
+ return items.join(cjk(language) ? "、" : ", ");
14826
+ }
14827
+ TaLanguageUtil.list = list;
14828
+ })(TaLanguageUtil || (TaLanguageUtil = {}));
14829
+ }));
14764
14830
  // ../../ta-packages/ta-protocol/esm/common/location.js
14765
14831
  var TaLocation;
14766
14832
  var init_location = __esmMin((() => {
@@ -14927,11 +14993,16 @@ var TaPackageServer, TaPackageTextUtil;
14927
14993
  var init_package_protocol = __esmMin((() => {
14928
14994
  TaPackageServer = Symbol("TaPackageServer");
14929
14995
  (function(TaPackageTextUtil) {
14930
- /** The text in a language such as `zh-CN`: that language, else its first part (`zh`), else English, else the first there is. */
14996
+ /**
14997
+ * The text in a language such as `zh-TW`: that language, else its first part (`zh`), else another of that part
14998
+ * (`zh-CN` for `zh-TW`), else English, else the first there is.
14999
+ */
14931
15000
  function pick(text, language) {
14932
- var _a, _b, _c, _d;
15001
+ var _a, _b, _c, _d, _e;
14933
15002
  if (text === void 0 || typeof text === "string") return text;
14934
- return (_d = (_c = (_b = (_a = text[language]) !== null && _a !== void 0 ? _a : text[language.split("-")[0]]) !== null && _b !== void 0 ? _b : text.en) !== null && _c !== void 0 ? _c : text["en-US"]) !== null && _d !== void 0 ? _d : Object.values(text)[0];
15003
+ const base = language.split("-")[0];
15004
+ const kin = Object.keys(text).find((key) => key.split("-")[0] === base);
15005
+ return (_e = (_d = (_c = (_b = (_a = text[language]) !== null && _a !== void 0 ? _a : text[base]) !== null && _b !== void 0 ? _b : kin === void 0 ? void 0 : text[kin]) !== null && _c !== void 0 ? _c : text.en) !== null && _d !== void 0 ? _d : text["en-US"]) !== null && _e !== void 0 ? _e : Object.values(text)[0];
14935
15006
  }
14936
15007
  TaPackageTextUtil.pick = pick;
14937
15008
  })(TaPackageTextUtil || (TaPackageTextUtil = {}));
@@ -15444,6 +15515,7 @@ var init_ta_extension_host = __esmMin((() => {
15444
15515
  })(TaAskUtil || (TaAskUtil = {}));
15445
15516
  })), TA_OWNER, TA_UNDECLARED, TaPermissionUtil, action, TA_ACTIONS, TaActionUtil;
15446
15517
  var init_team_protocol$1 = __esmMin((() => {
15518
+ init_language();
15447
15519
  TA_OWNER = "owner";
15448
15520
  TA_UNDECLARED = "extensions.install";
15449
15521
  (function(TaPermissionUtil) {
@@ -15468,55 +15540,57 @@ var init_team_protocol$1 = __esmMin((() => {
15468
15540
  }
15469
15541
  TaPermissionUtil.host = host;
15470
15542
  })(TaPermissionUtil || (TaPermissionUtil = {}));
15471
- action = (id, en, zh, more = {}) => ({
15543
+ action = (id, en, zh, tw, ja, more = {}) => ({
15472
15544
  id,
15473
15545
  area: id.split(".")[0],
15474
15546
  title: {
15475
15547
  en,
15476
- "zh-CN": zh
15548
+ "zh-CN": zh,
15549
+ ...tw ? { "zh-TW": tw } : {},
15550
+ ...ja ? { "ja-JP": ja } : {}
15477
15551
  },
15478
15552
  ...more
15479
15553
  });
15480
15554
  TA_ACTIONS = [
15481
- action("chat.view", "See conversations", "查看对话"),
15482
- action("chat.send", "Send in conversations", "在对话里发消息"),
15483
- action("chat.create", "Start conversations", "新建对话"),
15484
- action("chat.stop", "Stop a reply", "停止回复"),
15485
- action("chat.manage", "Rename, archive and close conversations", "改名、归档、关闭对话"),
15486
- action("chat.share", "Share by a link", "生成分享链接"),
15487
- action("agent.view", "See agents", "查看智能体"),
15488
- action("agent.use", "Talk with agents", "和智能体对话"),
15489
- action("agent.edit", "Create, change and remove agents", "新建、修改、删除智能体"),
15490
- action("channel.view", "See channels", "查看频道"),
15491
- action("channel.post", "Post in channels", "在频道里发言"),
15492
- action("channel.manage", "Create and change channels", "新建、管理频道"),
15493
- action("task.view", "See tasks", "查看任务"),
15494
- action("task.create", "Hand out tasks", "派任务"),
15495
- action("task.manage", "Take over and stop tasks", "接管、停止任务"),
15496
- action("files.read", "Read files", "读文件", { scoped: true }),
15497
- action("files.write", "Change files", "改文件", { scoped: true }),
15498
- action("commands.run", "Let Ta run commands", "让 Ta 运行命令", {
15555
+ action("chat.view", "See conversations", "查看对话", "檢視對話", "会話を確認"),
15556
+ action("chat.send", "Send in conversations", "在对话里发消息", "在對話裡發訊息", "会話にメッセージを送信"),
15557
+ action("chat.create", "Start conversations", "新建对话", "新建對話", "新しい会話を開始"),
15558
+ action("chat.stop", "Stop a reply", "停止回复", "停止回覆", "返信を停止"),
15559
+ action("chat.manage", "Rename, archive and close conversations", "改名、归档、关闭对话", "改名、歸檔、關閉對話", "会話の名前変更、アーカイブ、クローズ"),
15560
+ action("chat.share", "Share by a link", "生成分享链接", "生成分享連結", "共有リンクで共有"),
15561
+ action("agent.view", "See agents", "查看智能体", "檢視智慧體", "エージェントを確認"),
15562
+ action("agent.use", "Talk with agents", "和智能体对话", "和智慧體對話", "エージェントと対話"),
15563
+ action("agent.edit", "Create, change and remove agents", "新建、修改、删除智能体", "新建、修改、刪除智慧體", "エージェントを作成・変更・削除"),
15564
+ action("channel.view", "See channels", "查看频道", "檢視頻道", "チャネルを確認"),
15565
+ action("channel.post", "Post in channels", "在频道里发言", "在頻道里發言", "チャネルに投稿"),
15566
+ action("channel.manage", "Create and change channels", "新建、管理频道", "新建、管理頻道", "チャネルを作成・管理"),
15567
+ action("task.view", "See tasks", "查看任务", "檢視任務", "タスクを確認"),
15568
+ action("task.create", "Hand out tasks", "派任务", "派任務", "タスクを割り当て"),
15569
+ action("task.manage", "Take over and stop tasks", "接管、停止任务", "接管、停止任務", "タスクを引き継ぎ・停止"),
15570
+ action("files.read", "Read files", "读文件", "讀檔案", "ファイルを読取", { scoped: true }),
15571
+ action("files.write", "Change files", "改文件", "改檔案", "ファイルを変更", { scoped: true }),
15572
+ action("commands.run", "Let Ta run commands", "让 Ta 运行命令", "讓 Ta 執行命令", "Ta にコマンド実行を許可", {
15499
15573
  scoped: true,
15500
15574
  risky: true
15501
15575
  }),
15502
- action("commands.terminal", "Open terminals", "打开终端", {
15576
+ action("commands.terminal", "Open terminals", "打开终端", "開啟終端機", "ターミナルを開く", {
15503
15577
  scoped: true,
15504
15578
  risky: true
15505
15579
  }),
15506
- action("hosts.use", "Use remote hosts", "使用远程主机", { risky: true }),
15507
- action("models.use", "Use the models", "使用模型"),
15508
- action("models.manage", "Sign in to models", "登录和更换模型账号"),
15509
- action("cron.view", "See scheduled tasks", "查看定时任务"),
15510
- action("cron.manage", "Change scheduled tasks", "管理定时任务"),
15511
- action("extensions.use", "Use extensions", "使用扩展"),
15512
- action("extensions.install", "Install and turn off extensions", "安装、停用扩展"),
15513
- action("settings.view", "See settings", "查看设置"),
15514
- action("settings.manage", "Change settings", "修改设置"),
15515
- action("members.view", "See members", "查看成员"),
15516
- action("members.invite", "Invite people", "邀请别人"),
15517
- action("members.approve", "Answer requests", "处理申请"),
15518
- action("members.roles", "Change roles and members", "管理角色和成员"),
15519
- action("audit.view", "See the record", "查看记录")
15580
+ action("hosts.use", "Use remote hosts", "使用远程主机", "使用遠端主機", "リモートホストを使用", { risky: true }),
15581
+ action("models.use", "Use the models", "使用模型", "使用模型", "モデルを使用"),
15582
+ action("models.manage", "Sign in to models", "登录和更换模型账号", "登入和更換模型帳號", "モデルアカウントにサインイン・変更"),
15583
+ action("cron.view", "See scheduled tasks", "查看定时任务", "檢視定時任務", "スケジュールタスクを確認"),
15584
+ action("cron.manage", "Change scheduled tasks", "管理定时任务", "管理定時任務", "スケジュールタスクを管理"),
15585
+ action("extensions.use", "Use extensions", "使用扩展", "使用擴充功能", "拡張機能を使用"),
15586
+ action("extensions.install", "Install and turn off extensions", "安装、停用扩展", "安裝、停用擴充功能", "拡張機能をインストール・無効化"),
15587
+ action("settings.view", "See settings", "查看设置", "檢視設定", "設定を確認"),
15588
+ action("settings.manage", "Change settings", "修改设置", "修改設定", "設定を変更"),
15589
+ action("members.view", "See members", "查看成员", "檢視成員", "メンバーを確認"),
15590
+ action("members.invite", "Invite people", "邀请别人", "邀請別人", "メンバーを招待"),
15591
+ action("members.approve", "Answer requests", "处理申请", "處理申請", "リクエストに対応"),
15592
+ action("members.roles", "Change roles and members", "管理角色和成员", "管理角色和成員", "ロールとメンバーを管理"),
15593
+ action("audit.view", "See the record", "查看记录", "檢視記錄", "レコードを確認")
15520
15594
  ];
15521
15595
  (function(TaActionUtil) {
15522
15596
  const byId = new Map(TA_ACTIONS.map((one) => [one.id, one]));
@@ -15526,8 +15600,16 @@ var init_team_protocol$1 = __esmMin((() => {
15526
15600
  TaActionUtil.info = info;
15527
15601
  /** Its title in a language such as `zh-CN`; the id for an action of no catalog. */
15528
15602
  function title(id, language) {
15529
- const found = byId.get(id);
15530
- return found ? language.startsWith("zh") ? found.title["zh-CN"] : found.title.en : id;
15603
+ var _a;
15604
+ var _b, _c;
15605
+ const title = (_a = byId.get(id)) === null || _a === void 0 ? void 0 : _a.title;
15606
+ if (!title) return id;
15607
+ return TaLanguageUtil.pick(language, {
15608
+ "zh-CN": title["zh-CN"],
15609
+ "zh-TW": (_b = title["zh-TW"]) !== null && _b !== void 0 ? _b : title["zh-CN"],
15610
+ "en-US": title.en,
15611
+ "ja-JP": (_c = title["ja-JP"]) !== null && _c !== void 0 ? _c : title.en
15612
+ });
15531
15613
  }
15532
15614
  TaActionUtil.title = title;
15533
15615
  /** Whether `path` is `dir` or inside it; both absolute, `/` separated. */
@@ -15568,6 +15650,7 @@ var init_common$1 = __esmMin((() => {
15568
15650
  init_access_protocol();
15569
15651
  init_auth_protocol();
15570
15652
  init_gateway_protocol();
15653
+ init_language();
15571
15654
  init_location();
15572
15655
  init_package_protocol();
15573
15656
  init_pi_types$1();
@@ -15581,7 +15664,393 @@ var init_common$1 = __esmMin((() => {
15581
15664
  init_team_protocol$1();
15582
15665
  init_workspace_protocol$1();
15583
15666
  }));
15667
+ // ../../ta-packages/ta-host/esm/node/ta-errors.js
15668
+ var TaError, NOT_SIGNED_IN, KNOWN, TaErrors;
15669
+ var init_ta_errors = __esmMin((() => {
15670
+ init_common$6();
15671
+ init_common$1();
15672
+ TaError = ApplicationError.declare(TA_RPC_ERROR_CODE, (code, message, hint) => ({
15673
+ message,
15674
+ data: {
15675
+ code,
15676
+ hint
15677
+ }
15678
+ }));
15679
+ NOT_SIGNED_IN = /^(No (API key found for|model selected|models available)|Authentication failed for)\b/;
15680
+ KNOWN = [
15681
+ {
15682
+ pattern: /^Nothing to compact\b/,
15683
+ code: TaErrorCode.NOTHING_TO_COMPACT,
15684
+ hint: "Compact once the conversation is longer."
15685
+ },
15686
+ {
15687
+ pattern: /^Already compacted$/,
15688
+ code: TaErrorCode.ALREADY_COMPACTED,
15689
+ hint: "Compact again once more has been said."
15690
+ },
15691
+ {
15692
+ pattern: /^(Cannot submit a prompt while compaction is in progress|Wait for the current (response|compaction))\b/,
15693
+ code: TaErrorCode.SESSION_BUSY,
15694
+ hint: "Try again once the session is idle."
15695
+ },
15696
+ {
15697
+ pattern: /^Compaction cancelled$/,
15698
+ code: TaErrorCode.CANCELLED,
15699
+ hint: "It was stopped; nothing to do."
15700
+ }
15701
+ ];
15702
+ (function(TaErrors) {
15703
+ function sessionNotFound(sessionId) {
15704
+ return TaError(TaErrorCode.SESSION_NOT_FOUND, `No open session has the id ${sessionId}.`, "Open it again with openSession and its session file: idle sessions are closed, their files stay.");
15705
+ }
15706
+ TaErrors.sessionNotFound = sessionNotFound;
15707
+ function sessionLocked(sessionFile) {
15708
+ return TaError(TaErrorCode.SESSION_LOCKED, `The session ${sessionFile} is open elsewhere.`, "Close it there first: a session has one writer.");
15709
+ }
15710
+ TaErrors.sessionLocked = sessionLocked;
15711
+ function tooManySessions(max) {
15712
+ return TaError(TaErrorCode.TOO_MANY_SESSIONS, `${max} sessions are open, the limit of this server.`, "Close a session, or raise ta.host.maxSessions.");
15713
+ }
15714
+ TaErrors.tooManySessions = tooManySessions;
15715
+ function messageConflict(clientMessageId) {
15716
+ return TaError(TaErrorCode.MESSAGE_CONFLICT, `The message id ${clientMessageId} was used for a different message.`, "Use a new clientMessageId for each message.");
15717
+ }
15718
+ TaErrors.messageConflict = messageConflict;
15719
+ function modelNotFound(model) {
15720
+ return TaError(TaErrorCode.MODEL_NOT_FOUND, `The model ${model} is not known or has no credentials.`, "Use <provider>/<model id>; getAvailableModels lists the ones that work.");
15721
+ }
15722
+ TaErrors.modelNotFound = modelNotFound;
15723
+ function limit(running) {
15724
+ return TaError(TaErrorCode.LIMIT, `${running} runs of people let in are going, as many as the owner of this Ta lets at once.`, "Try again once one ended; the owner sets the limit in Members.");
15725
+ }
15726
+ TaErrors.limit = limit;
15727
+ function invalidArgument(message, hint) {
15728
+ return TaError(TaErrorCode.INVALID_ARGUMENT, message, hint);
15729
+ }
15730
+ TaErrors.invalidArgument = invalidArgument;
15731
+ /** Runs a call of a service of ta serve, so that what it throws reaches the client with its message (commandFailed). */
15732
+ async function guard(command) {
15733
+ try {
15734
+ return await command();
15735
+ } catch (error) {
15736
+ throw commandFailed(error);
15737
+ }
15738
+ }
15739
+ TaErrors.guard = guard;
15740
+ /** A command that pi refused or that failed. Other errors would lose their message on the way out. */
15741
+ function commandFailed(cause) {
15742
+ if (ApplicationError.is(cause)) return cause;
15743
+ const message = cause instanceof Error ? cause.message : String(cause);
15744
+ if (NOT_SIGNED_IN.test(message)) return TaError(TaErrorCode.NOT_SIGNED_IN, message.split(/\n| (Use |Run ')\/login/)[0].trim(), "Sign in to a provider of models (TaAuthServer.login), then send it again.");
15745
+ const known = KNOWN.find(({ pattern }) => pattern.test(message));
15746
+ if (known) return TaError(known.code, message, known.hint);
15747
+ return TaError(TaErrorCode.COMMAND_FAILED, message, "The message comes from the agent; fix what it says and send the command again.");
15748
+ }
15749
+ TaErrors.commandFailed = commandFailed;
15750
+ })(TaErrors || (TaErrors = {}));
15751
+ }));
15752
+ // ../../ta-packages/ta-host/esm/node/custom-providers.js
15753
+ var OPTION_KEYS, HEADER_NAME, MAX_TOKENS, NO_KEY, CustomProviderUtil;
15754
+ var init_custom_providers = __esmMin((() => {
15755
+ init_common$1();
15756
+ init_ta_errors();
15757
+ OPTION_KEYS = [
15758
+ "contextWindow",
15759
+ "maxTokens",
15760
+ "reasoning",
15761
+ "images"
15762
+ ];
15763
+ HEADER_NAME = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
15764
+ MAX_TOKENS = 1e8;
15765
+ NO_KEY = "none";
15766
+ (function(CustomProviderUtil) {
15767
+ function object(value) {
15768
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
15769
+ }
15770
+ function api(value) {
15771
+ return TA_CUSTOM_APIS.find((each) => each === value);
15772
+ }
15773
+ /** What a model of models.json says of an option. */
15774
+ function option(model, key) {
15775
+ switch (key) {
15776
+ case "reasoning": return model.reasoning === true;
15777
+ case "images": return Array.isArray(model.input) && model.input.includes("image");
15778
+ default: return typeof model[key] === "number" ? model[key] : void 0;
15779
+ }
15780
+ }
15781
+ /** The options every model has alike, and those they do not. */
15782
+ function options(models) {
15783
+ const options = {};
15784
+ const mixed = [];
15785
+ for (const key of OPTION_KEYS) {
15786
+ const values = new Set(models.map((model) => option(model, key)));
15787
+ if (values.size > 1) mixed.push(key);
15788
+ else if (values.size === 1) {
15789
+ const [value] = values;
15790
+ if (value !== void 0) options[key] = value;
15791
+ }
15792
+ }
15793
+ return {
15794
+ options,
15795
+ mixed
15796
+ };
15797
+ }
15798
+ CustomProviderUtil.options = options;
15799
+ /** A model with the options set: left out keeps, null or false removes. */
15800
+ function withOptions(model, given) {
15801
+ const next = { ...model };
15802
+ for (const key of OPTION_KEYS) {
15803
+ const value = given[key];
15804
+ if (value === void 0) continue;
15805
+ const field = key === "images" ? "input" : key;
15806
+ if (value === null || value === false) delete next[field];
15807
+ else if (key === "images") next.input = ["text", "image"];
15808
+ else next[field] = value;
15809
+ }
15810
+ return next;
15811
+ }
15812
+ CustomProviderUtil.withOptions = withOptions;
15813
+ /** A value pi resolves to itself (one Ta wrote), unescaped; undefined for a variable or a command. */
15814
+ function plain(value) {
15815
+ if (value.startsWith("!")) return;
15816
+ let text = "";
15817
+ for (let at = 0; at < value.length; at++) if (value[at] !== "$") text += value[at];
15818
+ else if (value[at + 1] === "$" || value[at + 1] === "!") text += value[++at];
15819
+ else return;
15820
+ return text;
15821
+ }
15822
+ CustomProviderUtil.plain = plain;
15823
+ /** The headers a provider sends that are plain values, by name. */
15824
+ function storedHeaders(entry) {
15825
+ var _a;
15826
+ var _b;
15827
+ const headers = (_b = object((_a = object(entry)) === null || _a === void 0 ? void 0 : _a.headers)) !== null && _b !== void 0 ? _b : {};
15828
+ const found = {};
15829
+ for (const [name, value] of Object.entries(headers)) {
15830
+ const resolved = typeof value === "string" ? plain(value) : void 0;
15831
+ if (resolved !== void 0) found[name] = resolved;
15832
+ }
15833
+ return found;
15834
+ }
15835
+ CustomProviderUtil.storedHeaders = storedHeaders;
15836
+ /** The headers given, with an empty value taking the one kept of that name. */
15837
+ function headersWith(given, kept) {
15838
+ const headers = {};
15839
+ for (const [name, value] of Object.entries(given !== null && given !== void 0 ? given : {})) {
15840
+ const resolved = value || kept[name];
15841
+ if (resolved) headers[name] = resolved;
15842
+ }
15843
+ return headers;
15844
+ }
15845
+ CustomProviderUtil.headersWith = headersWith;
15846
+ /** The entries of models.json, by id. */
15847
+ function entries(data) {
15848
+ var _a;
15849
+ return (_a = object(data.providers)) !== null && _a !== void 0 ? _a : {};
15850
+ }
15851
+ CustomProviderUtil.entries = entries;
15852
+ /** An entry Ta shows as one added by its address: an address, an API of the list and models of its own. */
15853
+ function read(id, value) {
15854
+ var _a;
15855
+ const entry = object(value);
15856
+ const kind = api(entry === null || entry === void 0 ? void 0 : entry.api);
15857
+ if (!entry || !kind || typeof entry.baseUrl !== "string" || !Array.isArray(entry.models)) return;
15858
+ const entries = entry.models.map((model) => object(model)).filter((model) => typeof (model === null || model === void 0 ? void 0 : model.id) === "string");
15859
+ const models = entries.map((model) => model.id);
15860
+ const key = entry.apiKey;
15861
+ return {
15862
+ id,
15863
+ name: typeof entry.name === "string" && entry.name ? entry.name : id,
15864
+ api: kind,
15865
+ baseUrl: entry.baseUrl,
15866
+ hasKey: typeof key === "string" && key !== "" && key !== "none",
15867
+ models,
15868
+ ...options(entries),
15869
+ headers: Object.keys((_a = object(entry.headers)) !== null && _a !== void 0 ? _a : {})
15870
+ };
15871
+ }
15872
+ CustomProviderUtil.read = read;
15873
+ function list(data) {
15874
+ return Object.entries(entries(data)).map(([id, value]) => read(id, value)).filter((provider) => !!provider).sort((a, b) => a.name.localeCompare(b.name));
15875
+ }
15876
+ CustomProviderUtil.list = list;
15877
+ /**
15878
+ * A key as pi reads it literally: pi runs a value that starts with `!` as a command and puts in the variable of
15879
+ * `$NAME`, so `$` is written `$$` and a first `!` `$!`.
15880
+ */
15881
+ function literal(key) {
15882
+ const escaped = key.replace(/\$/g, "$$$$");
15883
+ return escaped.startsWith("!") ? `$${escaped}` : escaped;
15884
+ }
15885
+ CustomProviderUtil.literal = literal;
15886
+ /** The input made plain, or the reason it is not one. */
15887
+ function clean(input) {
15888
+ const kind = api(input === null || input === void 0 ? void 0 : input.api);
15889
+ if (!kind) throw TaErrors.invalidArgument(`${String(input === null || input === void 0 ? void 0 : input.api)} is not an API Ta takes.`, `Use one of ${TA_CUSTOM_APIS.join(", ")}.`);
15890
+ const baseUrl = typeof input.baseUrl === "string" ? input.baseUrl.trim().replace(/\/+$/, "") : "";
15891
+ let url;
15892
+ try {
15893
+ url = new URL(baseUrl);
15894
+ } catch (_a) {
15895
+ url = void 0;
15896
+ }
15897
+ if (!url || url.protocol !== "http:" && url.protocol !== "https:") throw TaErrors.invalidArgument(`${baseUrl || "An empty address"} is not an address of a service.`, "Give its http(s) URL, e.g. https://api.example.com/v1.");
15898
+ const models = [...new Set((Array.isArray(input.models) ? input.models : []).map((model) => String(model).trim()).filter(Boolean))];
15899
+ const name = typeof input.name === "string" && input.name.trim() ? input.name.trim() : url.host;
15900
+ const apiKey = typeof input.apiKey === "string" ? input.apiKey.trim() : void 0;
15901
+ return {
15902
+ ...input,
15903
+ name,
15904
+ api: kind,
15905
+ baseUrl,
15906
+ apiKey,
15907
+ models,
15908
+ options: cleanOptions(input.options),
15909
+ headers: cleanHeaders(input.headers)
15910
+ };
15911
+ }
15912
+ CustomProviderUtil.clean = clean;
15913
+ function cleanOptions(given) {
15914
+ const options = object(given);
15915
+ if (!options) return;
15916
+ const clean = {};
15917
+ for (const key of OPTION_KEYS) {
15918
+ const value = options[key];
15919
+ if (value === void 0 || value === null) clean[key] = value;
15920
+ else if (key === "reasoning" || key === "images") {
15921
+ if (typeof value !== "boolean") throw TaErrors.invalidArgument(`${key} is ${JSON.stringify(value)}, not true or false.`, "Give a boolean, or null to remove it.");
15922
+ clean[key] = value;
15923
+ } else if (typeof value === "number" && Number.isInteger(value) && value > 0 && value <= MAX_TOKENS) clean[key] = value;
15924
+ else throw TaErrors.invalidArgument(`${key} is ${JSON.stringify(value)}, not a number of tokens.`, "Give a whole number above 0, or null to remove it.");
15925
+ }
15926
+ return clean;
15927
+ }
15928
+ function cleanHeaders(given) {
15929
+ const headers = object(given);
15930
+ if (!headers) return;
15931
+ const clean = {};
15932
+ for (const [raw, value] of Object.entries(headers)) {
15933
+ const name = raw.trim();
15934
+ if (!name) continue;
15935
+ if (!HEADER_NAME.test(name) || typeof value !== "string" || /[\r\n]/.test(value)) throw TaErrors.invalidArgument(`${name} is not a header Ta sends.`, "Give a name of letters, digits and dashes, and a value of one line.");
15936
+ clean[name] = value.trim();
15937
+ }
15938
+ return clean;
15939
+ }
15940
+ /** An id for a new provider of that name: of letters, digits and dashes, and none that is taken. */
15941
+ function newId(name, taken) {
15942
+ const base = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || "custom";
15943
+ let id = base;
15944
+ for (let n = 2; taken(id); n++) id = `${base}-${n}`;
15945
+ return id;
15946
+ }
15947
+ CustomProviderUtil.newId = newId;
15948
+ /** models.json with the provider saved; its other entries, and what Ta does not change of this one, stay. */
15949
+ function save(data, id, input) {
15950
+ var _a, _b;
15951
+ const providers = { ...entries(data) };
15952
+ const before = (_a = object(providers[id])) !== null && _a !== void 0 ? _a : {};
15953
+ const models = Array.isArray(before.models) ? before.models : [];
15954
+ const entry = {
15955
+ ...before,
15956
+ name: input.name,
15957
+ baseUrl: input.baseUrl,
15958
+ api: input.api,
15959
+ models: input.models.map((model) => {
15960
+ var _a, _b;
15961
+ return withOptions((_a = object(models.find((each) => {
15962
+ var _a;
15963
+ return ((_a = object(each)) === null || _a === void 0 ? void 0 : _a.id) === model;
15964
+ }))) !== null && _a !== void 0 ? _a : { id: model }, (_b = input.options) !== null && _b !== void 0 ? _b : {});
15965
+ })
15966
+ };
15967
+ if (input.headers) {
15968
+ const kept = (_b = object(before.headers)) !== null && _b !== void 0 ? _b : {};
15969
+ const headers = {};
15970
+ for (const [name, value] of Object.entries(input.headers)) if (value) headers[name] = literal(value);
15971
+ else if (typeof kept[name] === "string") headers[name] = kept[name];
15972
+ if (Object.keys(headers).length > 0) entry.headers = headers;
15973
+ else delete entry.headers;
15974
+ }
15975
+ if (input.apiKey) entry.apiKey = literal(input.apiKey);
15976
+ else if (input.apiKey === "" || typeof before.apiKey !== "string") entry.apiKey = NO_KEY;
15977
+ providers[id] = entry;
15978
+ return {
15979
+ ...data,
15980
+ providers
15981
+ };
15982
+ }
15983
+ CustomProviderUtil.save = save;
15984
+ function remove(data, id) {
15985
+ const providers = { ...entries(data) };
15986
+ delete providers[id];
15987
+ return {
15988
+ ...data,
15989
+ providers
15990
+ };
15991
+ }
15992
+ CustomProviderUtil.remove = remove;
15993
+ /** Where a service lists its models, and the headers that carry the key, by its API. */
15994
+ function modelsRequest(kind, baseUrl, key, extra = {}) {
15995
+ const request = authRequest(kind, baseUrl, key);
15996
+ return {
15997
+ url: request.url,
15998
+ headers: {
15999
+ ...request.headers,
16000
+ ...extra
16001
+ }
16002
+ };
16003
+ }
16004
+ CustomProviderUtil.modelsRequest = modelsRequest;
16005
+ function authRequest(kind, baseUrl, key) {
16006
+ const base = baseUrl.replace(/\/+$/, "");
16007
+ const real = key && key !== "none" ? key : void 0;
16008
+ switch (kind) {
16009
+ case "anthropic-messages": return {
16010
+ url: /\/v\d+$/.test(base) ? `${base}/models` : `${base}/v1/models`,
16011
+ headers: {
16012
+ "anthropic-version": "2023-06-01",
16013
+ ...real ? { "x-api-key": real } : {}
16014
+ }
16015
+ };
16016
+ case "google-generative-ai": return {
16017
+ url: `${base}/models`,
16018
+ headers: real ? { "x-goog-api-key": real } : {}
16019
+ };
16020
+ default: return {
16021
+ url: `${base}/models`,
16022
+ headers: real ? { Authorization: `Bearer ${real}` } : {}
16023
+ };
16024
+ }
16025
+ }
16026
+ /** The ids of a list of models: OpenAI's and Anthropic's `data[].id`, Google's `models[].name` without `models/`. */
16027
+ function modelIds(body) {
16028
+ var _a;
16029
+ const json = (_a = object(body)) !== null && _a !== void 0 ? _a : {};
16030
+ const ids = [...(Array.isArray(json.data) ? json.data : []).map((model) => {
16031
+ var _a;
16032
+ return (_a = object(model)) === null || _a === void 0 ? void 0 : _a.id;
16033
+ }), ...(Array.isArray(json.models) ? json.models : []).map((model) => {
16034
+ var _a, _b;
16035
+ const item = object(model);
16036
+ const name = (_b = (_a = item === null || item === void 0 ? void 0 : item.name) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.id) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.model;
16037
+ return typeof name === "string" ? name.replace(/^models\//, "") : void 0;
16038
+ })];
16039
+ return [...new Set(ids.filter((id) => typeof id === "string" && id !== ""))].sort((a, b) => a.localeCompare(b));
16040
+ }
16041
+ CustomProviderUtil.modelIds = modelIds;
16042
+ })(CustomProviderUtil || (CustomProviderUtil = {}));
16043
+ }));
15584
16044
  // ../../ta-packages/ta-harness/esm/node/bug-report.js
16045
+ /**
16046
+ * Resolves a language tag to one of the four supported languages.
16047
+ * Rules: zh with -tw/-hk/-mo/-hant suffix → zh-TW; other zh → zh-CN; ja → ja-JP; others → en-US.
16048
+ */
16049
+ function ofLanguage(tag) {
16050
+ if (/^zh/i.test(tag)) return /(?:tw|hk|mo|hant)/i.test(tag) ? "zh-TW" : "zh-CN";
16051
+ if (/^ja/i.test(tag)) return "ja-JP";
16052
+ return "en-US";
16053
+ }
15585
16054
  var BugReport;
15586
16055
  var init_bug_report = __esmMin((() => {
15587
16056
  (function(BugReport) {
@@ -15633,7 +16102,8 @@ var init_bug_report = __esmMin((() => {
15633
16102
  BugReport.open = open;
15634
16103
  /** What `/bug` says, in the language of Ta's pages (`TA_LANGUAGE`) or the computer's. */
15635
16104
  function notice(url, env = process.env) {
15636
- return /^zh/i.test(env.TA_LANGUAGE || env.LC_ALL || env.LANG || "") ? `一个新的 Ta 问题(只带版本、模型和平台信息)会在浏览器里打开。如果没有打开:\n${url}` : `A new issue for Ta, with its version, the model and the platform and nothing else, opens in the browser. If it did not:\n${url}`;
16105
+ const language = ofLanguage(env.TA_LANGUAGE || env.LC_ALL || env.LANG || "");
16106
+ return language === "zh-CN" ? `一个新的 Ta 问题(只带版本、模型和平台信息)会在浏览器里打开。如果没有打开:\n${url}` : language === "zh-TW" ? `一個新的 Ta 問題(只帶版本、模型和平台資訊)會在瀏覽器裡開啟。如果沒有開啟:\n${url}` : language === "ja-JP" ? `Ta の新しい問題(バージョン、モデル、プラットフォーム情報のみ)がブラウザで開きます。開かない場合:\n${url}` : `A new issue for Ta, with its version, the model and the platform and nothing else, opens in the browser. If it did not:\n${url}`;
15637
16107
  }
15638
16108
  BugReport.notice = notice;
15639
16109
  })(BugReport || (BugReport = {}));
@@ -18769,17 +19239,18 @@ var init_relay_team = __esmMin((() => {
18769
19239
  r: link.role
18770
19240
  });
18771
19241
  if (link.what) fragment.set("w", link.what);
19242
+ if (link.language) fragment.set("l", link.language);
18772
19243
  return `${link.relay.replace(/\/+$/, "")}/j#${fragment}`;
18773
19244
  }
18774
19245
  RelayTeamLinkUtil.format = format;
18775
19246
  /** Undefined for text that is not such a link. */
18776
19247
  function parse(text) {
18777
19248
  var _a;
18778
- var _b, _c;
19249
+ var _b, _c, _d;
18779
19250
  let url;
18780
19251
  try {
18781
19252
  url = new URL(text.trim());
18782
- } catch (_d) {
19253
+ } catch (_e) {
18783
19254
  return;
18784
19255
  }
18785
19256
  const fragment = new URLSearchParams(url.hash.slice(1));
@@ -18793,14 +19264,16 @@ var init_relay_team = __esmMin((() => {
18793
19264
  });
18794
19265
  if (!/^https?:$/.test(url.protocol) || url.pathname !== "/j" || fragment.get("v") !== "1" || !ID.test(host) || !ID.test(device) || !/^[A-Za-z0-9_-]{43}$/.test(key)) return;
18795
19266
  const what = (_a = fragment.get("w")) === null || _a === void 0 ? void 0 : _a.slice(0, 80);
19267
+ const language = (_b = fragment.get("l")) !== null && _b !== void 0 ? _b : "";
18796
19268
  return {
18797
19269
  relay: url.origin,
18798
19270
  host,
18799
19271
  device,
18800
19272
  key,
18801
- owner: (_b = fragment.get("o")) !== null && _b !== void 0 ? _b : "",
18802
- role: (_c = fragment.get("r")) !== null && _c !== void 0 ? _c : "",
18803
- ...what ? { what } : {}
19273
+ owner: (_c = fragment.get("o")) !== null && _c !== void 0 ? _c : "",
19274
+ role: (_d = fragment.get("r")) !== null && _d !== void 0 ? _d : "",
19275
+ ...what ? { what } : {},
19276
+ .../^[a-z]{2}(-[A-Za-z]{2,4})?$/.test(language) ? { language } : {}
18804
19277
  };
18805
19278
  }
18806
19279
  RelayTeamLinkUtil.parse = parse;
@@ -18839,7 +19312,7 @@ var init_relay_team = __esmMin((() => {
18839
19312
  }
18840
19313
  RelayTeamLinkUtil.web = web;
18841
19314
  })(RelayTeamLinkUtil || (RelayTeamLinkUtil = {}));
18842
- (class {
19315
+ (class RelayTeamJoining {
18843
19316
  constructor(link) {
18844
19317
  this.closed = false;
18845
19318
  this.calls = new RelayHostCalls({
@@ -18855,19 +19328,24 @@ var init_relay_team = __esmMin((() => {
18855
19328
  return this.own;
18856
19329
  }
18857
19330
  /**
18858
- * How to say who one is. A Ta of before has no accounts for those asking (its link may not call `ways`): none needed;
18859
- * a Ta that cannot be reached says so when asked.
19331
+ * How to say who one is. A Ta of before has no accounts for those asking (its link may not call `ways`): none needed.
19332
+ * A Ta that cannot be reached throws, so that the page says so rather than hide the ways to sign in.
18860
19333
  */
18861
19334
  async ways(via) {
18862
19335
  try {
18863
19336
  return await this.calls.callHost("ways", via ? { via } : {});
18864
- } catch (_a) {
19337
+ } catch (failure) {
19338
+ if (RelayTeamJoining.unreachable(failure)) throw failure;
18865
19339
  return {
18866
19340
  providers: [],
18867
19341
  required: false
18868
19342
  };
18869
19343
  }
18870
19344
  }
19345
+ /** A call the relay or the Ta did not answer: the Ta is off, or the connection was lost. */
19346
+ static unreachable(failure) {
19347
+ return /did not answer|was lost/i.test(failure instanceof Error ? failure.message : String(failure));
19348
+ }
18871
19349
  /** Where the browser goes to sign in with a provider, and the state it comes back with to the page of the link; for the app, its handoff. */
18872
19350
  async signIn(provider, handoff) {
18873
19351
  return await this.calls.callHost("signIn", {
@@ -18877,10 +19355,29 @@ var init_relay_team = __esmMin((() => {
18877
19355
  }
18878
19356
  /** The browser came back signed in for the Ta app: the Ta verifies the account and keeps it for the app. */
18879
19357
  async signedIn(state, code) {
18880
- return await this.calls.callHost("signedIn", {
19358
+ return { account: (await this.calls.callHost("signedIn", {
18881
19359
  state,
18882
19360
  code
18883
- });
19361
+ })).account };
19362
+ }
19363
+ /**
19364
+ * Waits for the code of a sign-in (`device` of {@link signIn}) to be typed at the provider, asking again till it was
19365
+ * (the account, kept by the Ta under the handoff of the sign-in, or its state), this stops or `until` passes. A call
19366
+ * the relay or the Ta did not answer (a phone away while the code was typed) is asked again; one refused throws.
19367
+ */
19368
+ async typed(state, until = Date.now() + 9e5) {
19369
+ while (!this.closed && Date.now() < until) {
19370
+ let answer;
19371
+ try {
19372
+ answer = await this.calls.callHost("signedIn", { state });
19373
+ } catch (failure) {
19374
+ if (this.closed) return;
19375
+ if (!RelayTeamJoining.unreachable(failure)) throw failure;
19376
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
19377
+ continue;
19378
+ }
19379
+ if (answer.status === "done" && answer.account) return answer.account;
19380
+ }
18884
19381
  }
18885
19382
  /**
18886
19383
  * Waits for the browser to sign in for the app, asking again till it did (the account), this stops or `until`
@@ -21808,91 +22305,6 @@ var init_host_protocol = __esmMin((() => {
21808
22305
  TA_HOST_OPTIONS = "ta.host";
21809
22306
  TA_EXEC_OPTIONS = "ta.exec";
21810
22307
  }));
21811
- // ../../ta-packages/ta-host/esm/node/ta-errors.js
21812
- var TaError, NOT_SIGNED_IN, KNOWN, TaErrors;
21813
- var init_ta_errors = __esmMin((() => {
21814
- init_common$6();
21815
- init_common$1();
21816
- TaError = ApplicationError.declare(TA_RPC_ERROR_CODE, (code, message, hint) => ({
21817
- message,
21818
- data: {
21819
- code,
21820
- hint
21821
- }
21822
- }));
21823
- NOT_SIGNED_IN = /^(No (API key found for|model selected|models available)|Authentication failed for)\b/;
21824
- KNOWN = [
21825
- {
21826
- pattern: /^Nothing to compact\b/,
21827
- code: TaErrorCode.NOTHING_TO_COMPACT,
21828
- hint: "Compact once the conversation is longer."
21829
- },
21830
- {
21831
- pattern: /^Already compacted$/,
21832
- code: TaErrorCode.ALREADY_COMPACTED,
21833
- hint: "Compact again once more has been said."
21834
- },
21835
- {
21836
- pattern: /^(Cannot submit a prompt while compaction is in progress|Wait for the current (response|compaction))\b/,
21837
- code: TaErrorCode.SESSION_BUSY,
21838
- hint: "Try again once the session is idle."
21839
- },
21840
- {
21841
- pattern: /^Compaction cancelled$/,
21842
- code: TaErrorCode.CANCELLED,
21843
- hint: "It was stopped; nothing to do."
21844
- }
21845
- ];
21846
- (function(TaErrors) {
21847
- function sessionNotFound(sessionId) {
21848
- return TaError(TaErrorCode.SESSION_NOT_FOUND, `No open session has the id ${sessionId}.`, "Open it again with openSession and its session file: idle sessions are closed, their files stay.");
21849
- }
21850
- TaErrors.sessionNotFound = sessionNotFound;
21851
- function sessionLocked(sessionFile) {
21852
- return TaError(TaErrorCode.SESSION_LOCKED, `The session ${sessionFile} is open elsewhere.`, "Close it there first: a session has one writer.");
21853
- }
21854
- TaErrors.sessionLocked = sessionLocked;
21855
- function tooManySessions(max) {
21856
- return TaError(TaErrorCode.TOO_MANY_SESSIONS, `${max} sessions are open, the limit of this server.`, "Close a session, or raise ta.host.maxSessions.");
21857
- }
21858
- TaErrors.tooManySessions = tooManySessions;
21859
- function messageConflict(clientMessageId) {
21860
- return TaError(TaErrorCode.MESSAGE_CONFLICT, `The message id ${clientMessageId} was used for a different message.`, "Use a new clientMessageId for each message.");
21861
- }
21862
- TaErrors.messageConflict = messageConflict;
21863
- function modelNotFound(model) {
21864
- return TaError(TaErrorCode.MODEL_NOT_FOUND, `The model ${model} is not known or has no credentials.`, "Use <provider>/<model id>; getAvailableModels lists the ones that work.");
21865
- }
21866
- TaErrors.modelNotFound = modelNotFound;
21867
- function limit(running) {
21868
- return TaError(TaErrorCode.LIMIT, `${running} runs of people let in are going, as many as the owner of this Ta lets at once.`, "Try again once one ended; the owner sets the limit in Members.");
21869
- }
21870
- TaErrors.limit = limit;
21871
- function invalidArgument(message, hint) {
21872
- return TaError(TaErrorCode.INVALID_ARGUMENT, message, hint);
21873
- }
21874
- TaErrors.invalidArgument = invalidArgument;
21875
- /** Runs a call of a service of ta serve, so that what it throws reaches the client with its message (commandFailed). */
21876
- async function guard(command) {
21877
- try {
21878
- return await command();
21879
- } catch (error) {
21880
- throw commandFailed(error);
21881
- }
21882
- }
21883
- TaErrors.guard = guard;
21884
- /** A command that pi refused or that failed. Other errors would lose their message on the way out. */
21885
- function commandFailed(cause) {
21886
- if (ApplicationError.is(cause)) return cause;
21887
- const message = cause instanceof Error ? cause.message : String(cause);
21888
- if (NOT_SIGNED_IN.test(message)) return TaError(TaErrorCode.NOT_SIGNED_IN, message.split(/\n| (Use |Run ')\/login/)[0].trim(), "Sign in to a provider of models (TaAuthServer.login), then send it again.");
21889
- const known = KNOWN.find(({ pattern }) => pattern.test(message));
21890
- if (known) return TaError(known.code, message, known.hint);
21891
- return TaError(TaErrorCode.COMMAND_FAILED, message, "The message comes from the agent; fix what it says and send the command again.");
21892
- }
21893
- TaErrors.commandFailed = commandFailed;
21894
- })(TaErrors || (TaErrors = {}));
21895
- }));
21896
22308
  // ../../ta-packages/ta-host/esm/node/auth-server-impl.js
21897
22309
  var __decorate$44, __metadata$40, CANCELLED, Login, AuthServerUtil, TaAuthServerImpl;
21898
22310
  var init_auth_server_impl = __esmMin((() => {
@@ -21901,6 +22313,7 @@ var init_auth_server_impl = __esmMin((() => {
21901
22313
  init_common$2();
21902
22314
  init_node$5();
21903
22315
  init_common$1();
22316
+ init_custom_providers();
21904
22317
  init_extension_providers();
21905
22318
  init_host_protocol();
21906
22319
  init_ta_errors();
@@ -21974,7 +22387,7 @@ var init_auth_server_impl = __esmMin((() => {
21974
22387
  };
21975
22388
  (function(AuthServerUtil) {
21976
22389
  /** The ways to sign in, as pi's `/login` lists them, by name. */
21977
- function providers(runtime, stored) {
22390
+ function providers(runtime, stored, custom = /* @__PURE__ */ new Set()) {
21978
22391
  var _a;
21979
22392
  var _b;
21980
22393
  const list = [];
@@ -21991,6 +22404,15 @@ var init_auth_server_impl = __esmMin((() => {
21991
22404
  stored: stored.has(provider.id),
21992
22405
  subscription: ((_a = provider.auth.oauth) === null || _a === void 0 ? void 0 : _a.isSubscription) === true
21993
22406
  };
22407
+ if (custom.has(provider.id)) {
22408
+ list.push({
22409
+ ...base,
22410
+ type: "api_key",
22411
+ interactive: true,
22412
+ custom: true
22413
+ });
22414
+ continue;
22415
+ }
21994
22416
  if (provider.auth.oauth) list.push({
21995
22417
  ...base,
21996
22418
  type: "oauth",
@@ -22039,6 +22461,8 @@ var init_auth_server_impl = __esmMin((() => {
22039
22461
  TaAuthServerImpl = class TaAuthServerImpl {
22040
22462
  constructor() {
22041
22463
  this.logins = /* @__PURE__ */ new Map();
22464
+ /** Writes of models.json, one after another. */
22465
+ this.writing = Promise.resolve();
22042
22466
  this.watched = /* @__PURE__ */ new WeakSet();
22043
22467
  }
22044
22468
  listProviders() {
@@ -22046,7 +22470,9 @@ var init_auth_server_impl = __esmMin((() => {
22046
22470
  const runtime = await this.modelRuntimeProvider.provide();
22047
22471
  await this.extensionProviders.ensure();
22048
22472
  const stored = new Set((await runtime.listCredentials()).map((credential) => credential.providerId));
22049
- return AuthServerUtil.providers(runtime, stored);
22473
+ const models = await this.readModels().catch(() => ({}));
22474
+ const custom = new Set(CustomProviderUtil.list(models).map((provider) => provider.id));
22475
+ return AuthServerUtil.providers(runtime, stored, custom);
22050
22476
  });
22051
22477
  }
22052
22478
  login(providerId, type) {
@@ -22077,6 +22503,83 @@ var init_auth_server_impl = __esmMin((() => {
22077
22503
  logout(providerId) {
22078
22504
  return TaErrors.guard(async () => (await this.modelRuntimeProvider.provide()).logout(providerId));
22079
22505
  }
22506
+ listCustomProviders() {
22507
+ return TaErrors.guard(async () => CustomProviderUtil.list(await this.readModels()));
22508
+ }
22509
+ saveCustomProvider(input) {
22510
+ return TaErrors.guard(async () => {
22511
+ const clean = CustomProviderUtil.clean(input);
22512
+ if (clean.models.length === 0) throw TaErrors.invalidArgument("A provider needs a model.", "Give the id of at least one model of the service.");
22513
+ const runtime = await this.modelRuntimeProvider.provide();
22514
+ await this.extensionProviders.ensure();
22515
+ const id = await this.writeModels((data) => {
22516
+ var _a;
22517
+ const entries = CustomProviderUtil.entries(data);
22518
+ if (clean.id !== void 0 && !CustomProviderUtil.read(clean.id, entries[clean.id])) throw TaErrors.invalidArgument(`${clean.id} is not a provider added by its address.`, "Pick one of listCustomProviders, or leave out the id to add one.");
22519
+ const id = (_a = clean.id) !== null && _a !== void 0 ? _a : CustomProviderUtil.newId(clean.name, (taken) => taken in entries || !!runtime.getProvider(taken));
22520
+ return [CustomProviderUtil.save(data, id, clean), id];
22521
+ });
22522
+ await runtime.refresh({ providers: [id] });
22523
+ await this.giveModels(runtime, id);
22524
+ const saved = CustomProviderUtil.read(id, CustomProviderUtil.entries(await this.readModels())[id]);
22525
+ if (!saved) throw TaErrors.invalidArgument(`${id} could not be saved.`, "Look at models.json of the agent directory.");
22526
+ return saved;
22527
+ });
22528
+ }
22529
+ removeCustomProvider(id) {
22530
+ return TaErrors.guard(async () => {
22531
+ await this.writeModels((data) => {
22532
+ if (!CustomProviderUtil.read(id, CustomProviderUtil.entries(data)[id])) throw TaErrors.invalidArgument(`${id} is not a provider added by its address.`, "Pick one of listCustomProviders.");
22533
+ return [CustomProviderUtil.remove(data, id), id];
22534
+ });
22535
+ await (await this.modelRuntimeProvider.provide()).refresh({ providers: [id] });
22536
+ });
22537
+ }
22538
+ fetchCustomModels(input) {
22539
+ return TaErrors.guard(async () => {
22540
+ var _a;
22541
+ const clean = CustomProviderUtil.clean({
22542
+ ...input,
22543
+ models: []
22544
+ });
22545
+ const key = clean.apiKey || (clean.id ? (_a = await (await this.modelRuntimeProvider.provide()).getAuth(clean.id)) === null || _a === void 0 ? void 0 : _a.auth.apiKey : void 0);
22546
+ const kept = clean.id ? CustomProviderUtil.storedHeaders(CustomProviderUtil.entries(await this.readModels())[clean.id]) : {};
22547
+ const headers = clean.headers ? CustomProviderUtil.headersWith(clean.headers, kept) : kept;
22548
+ const request = CustomProviderUtil.modelsRequest(clean.api, clean.baseUrl, key, headers);
22549
+ const response = await fetch(request.url, {
22550
+ headers: request.headers,
22551
+ signal: AbortSignal.timeout(15e3)
22552
+ });
22553
+ if (!response.ok) throw TaErrors.invalidArgument(`${request.url} answered ${response.status} ${response.statusText}`.trim(), "Check the address and the key, or type the ids of the models.");
22554
+ return CustomProviderUtil.modelIds(await response.json());
22555
+ });
22556
+ }
22557
+ async modelsFile() {
22558
+ var _a;
22559
+ var _b;
22560
+ const agentDir = (_b = (_a = this.codingAgentOptions) === null || _a === void 0 ? void 0 : _a.agentDir) !== null && _b !== void 0 ? _b : (await PiSdkUtil.load()).getAgentDir();
22561
+ return join(agentDir, "models.json");
22562
+ }
22563
+ async readModels() {
22564
+ try {
22565
+ return JSON.parse(await readFile(await this.modelsFile(), "utf8"));
22566
+ } catch (error) {
22567
+ if (error.code === "ENOENT") return {};
22568
+ throw error;
22569
+ }
22570
+ }
22571
+ /** models.json changed by `change`, written whole and only the user may read it: it holds keys. */
22572
+ writeModels(change) {
22573
+ const write = this.writing.then(async () => {
22574
+ const file = await this.modelsFile();
22575
+ const [data, result] = change(await this.readModels());
22576
+ await writeFile(`${file}.tmp`, `${JSON.stringify(data, null, 2)}\n`, { mode: 384 });
22577
+ await rename(`${file}.tmp`, file);
22578
+ return result;
22579
+ });
22580
+ this.writing = write.catch(() => void 0);
22581
+ return write;
22582
+ }
22080
22583
  async run(runtime, login, providerId, type) {
22081
22584
  try {
22082
22585
  const settings = await this.settingsManager();
@@ -27631,7 +28134,7 @@ var init_access_store = __esmMin((() => {
27631
28134
  };
27632
28135
  }));
27633
28136
  // ../../ta-packages/ta-host/esm/node/sign-in/sign-in-provider.js
27634
- var SignInError, TIMEOUT_MS, SignInHttp, GitHubSignIn, OidcSignIn, WeChatSignIn, SignInProviders;
28137
+ var SignInError, TIMEOUT_MS, SignInHttp, GitHubSignIn, GitHubDeviceSignIn, OidcSignIn, WeChatSignIn, SignInProviders;
27635
28138
  var init_sign_in_provider = __esmMin((() => {
27636
28139
  SignInError = class extends Error {
27637
28140
  static {
@@ -27684,7 +28187,22 @@ var init_sign_in_provider = __esmMin((() => {
27684
28187
  return {
27685
28188
  authorize: `${base}/login/oauth/authorize`,
27686
28189
  token: `${base}/login/oauth/access_token`,
27687
- user: `${api}/user`
28190
+ user: `${api}/user`,
28191
+ device: `${base}/login/device/code`
28192
+ };
28193
+ }
28194
+ /** Who a token of GitHub is. */
28195
+ static async user(endpoints, token) {
28196
+ const user = await SignInHttp.json(endpoints.user, { headers: {
28197
+ Authorization: `Bearer ${token}`,
28198
+ Accept: "application/vnd.github+json",
28199
+ "User-Agent": "Ta"
28200
+ } });
28201
+ if (!user.login) throw new SignInError("GitHub: the user has no login");
28202
+ return {
28203
+ id: `github:${user.login.toLowerCase()}`,
28204
+ name: user.name || user.login,
28205
+ avatar: user.avatar_url
27688
28206
  };
27689
28207
  }
27690
28208
  constructor(clientId, clientSecret, endpoints = GitHubSignIn.endpoints()) {
@@ -27715,25 +28233,59 @@ var init_sign_in_provider = __esmMin((() => {
27715
28233
  code_verifier: verifier
27716
28234
  }));
27717
28235
  if (!token.access_token) throw new SignInError(`GitHub: ${(_b = (_a = token.error_description) !== null && _a !== void 0 ? _a : token.error) !== null && _b !== void 0 ? _b : "no access token"}`);
27718
- const user = await SignInHttp.json(this.endpoints.user, { headers: {
27719
- Authorization: `Bearer ${token.access_token}`,
27720
- Accept: "application/vnd.github+json",
27721
- "User-Agent": "Ta"
27722
- } });
27723
- if (!user.login) throw new SignInError("GitHub: the user has no login");
28236
+ return GitHubSignIn.user(this.endpoints, token.access_token);
28237
+ }
28238
+ static {
28239
+ Object.defineProperty(this, "name", {
28240
+ value: "GitHubSignIn",
28241
+ configurable: true
28242
+ });
28243
+ }
28244
+ };
28245
+ GitHubDeviceSignIn = class GitHubDeviceSignIn {
28246
+ constructor(clientId = GitHubDeviceSignIn.CLIENT_ID, endpoints = GitHubSignIn.endpoints()) {
28247
+ this.clientId = clientId;
28248
+ this.endpoints = endpoints;
28249
+ this.id = "github";
28250
+ this.name = "GitHub";
28251
+ this.device = true;
28252
+ }
28253
+ async code() {
28254
+ var _a, _b, _c, _d;
28255
+ const answer = await SignInHttp.json(this.endpoints.device, SignInHttp.form({
28256
+ client_id: this.clientId,
28257
+ scope: "read:user"
28258
+ }));
28259
+ if (!answer.device_code || !answer.user_code || !answer.verification_uri || !/^https?:\/\//.test(answer.verification_uri)) throw new SignInError(`GitHub: ${(_b = (_a = answer.error_description) !== null && _a !== void 0 ? _a : answer.error) !== null && _b !== void 0 ? _b : "no code"}`);
27724
28260
  return {
27725
- id: `github:${user.login.toLowerCase()}`,
27726
- name: user.name || user.login,
27727
- avatar: user.avatar_url
28261
+ deviceCode: answer.device_code,
28262
+ userCode: answer.user_code,
28263
+ uri: answer.verification_uri,
28264
+ interval: Number((_c = answer.interval) !== null && _c !== void 0 ? _c : 5),
28265
+ expiresIn: Number((_d = answer.expires_in) !== null && _d !== void 0 ? _d : 900)
27728
28266
  };
27729
28267
  }
28268
+ async poll(deviceCode) {
28269
+ var _a, _b;
28270
+ const token = await SignInHttp.json(this.endpoints.token, SignInHttp.form({
28271
+ client_id: this.clientId,
28272
+ device_code: deviceCode,
28273
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code"
28274
+ }));
28275
+ if (token.access_token) return GitHubSignIn.user(this.endpoints, token.access_token);
28276
+ if (token.error === "authorization_pending") return "pending";
28277
+ if (token.error === "slow_down") return "slowDown";
28278
+ throw new SignInError(`GitHub: ${(_b = (_a = token.error_description) !== null && _a !== void 0 ? _a : token.error) !== null && _b !== void 0 ? _b : "no access token"}`);
28279
+ }
27730
28280
  static {
27731
28281
  Object.defineProperty(this, "name", {
27732
- value: "GitHubSignIn",
28282
+ value: "GitHubDeviceSignIn",
27733
28283
  configurable: true
27734
28284
  });
27735
28285
  }
27736
28286
  };
28287
+ /** Ta's own OAuth app on GitHub.com, its device flow on: a client id is public, and the device flow needs no secret. */
28288
+ GitHubDeviceSignIn.CLIENT_ID = "Ov23lip46sRQDlDM1xt7";
27737
28289
  OidcSignIn = class OidcSignIn {
27738
28290
  static google(clientId, clientSecret) {
27739
28291
  return new OidcSignIn({
@@ -27974,6 +28526,22 @@ var init_sign_in_provider = __esmMin((() => {
27974
28526
  }
27975
28527
  SignInProviders.withConfig = withConfig;
27976
28528
  /**
28529
+ * GitHub by a code, for those asking to come in, when GitHub is not set up with its secret (which goes there and back
28530
+ * instead): `TA_GITHUB_DEVICE` is `off`, or `<client id>` or `<client id>@<address of GitHub>` of an OAuth app of
28531
+ * one's own with its device flow on; by default Ta's own, on GitHub.com.
28532
+ */
28533
+ function device(env) {
28534
+ var _a;
28535
+ var _b;
28536
+ const value = (_b = (_a = env.TA_GITHUB_DEVICE) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
28537
+ if (value === "off" || env.TA_GITHUB_CLIENT_ID && env.TA_GITHUB_CLIENT_SECRET) return;
28538
+ const at = value.indexOf("@");
28539
+ const clientId = at < 0 ? value : value.slice(0, at);
28540
+ const url = at < 0 ? void 0 : value.slice(at + 1);
28541
+ return new GitHubDeviceSignIn(clientId || GitHubDeviceSignIn.CLIENT_ID, GitHubSignIn.endpoints(url || void 0));
28542
+ }
28543
+ SignInProviders.device = device;
28544
+ /**
27977
28545
  * The providers the operator configured in the environment of ta serve: a provider is offered when it
27978
28546
  * has its id and its secret.
27979
28547
  */
@@ -28165,9 +28733,14 @@ var init_ta_sign_in = __esmMin((() => {
28165
28733
  TaSignIn = class TaSignIn extends SignInFlow {
28166
28734
  constructor() {
28167
28735
  super(SignInProviders.fromEnv(SignInProviders.withConfig(process.env, config())), new AccessStore(join(TaBrand.agentDir(), "access.json"), AccessUtil.parseList(process.env.TA_ALLOWED_USERS)), SignInProviders.publicUrl(process.env));
28736
+ this.device = SignInProviders.device(SignInProviders.withConfig(process.env, config()));
28168
28737
  }
28169
28738
  setups() {
28170
- return SignInProviders.setups(process.env, config());
28739
+ const device = this.device;
28740
+ return SignInProviders.setups(process.env, config()).map((setup) => (device === null || device === void 0 ? void 0 : device.id) === setup.id && !setup.configured ? {
28741
+ ...setup,
28742
+ device: true
28743
+ } : setup);
28171
28744
  }
28172
28745
  /** Sets a kind up in sign-in.json (readable by the user alone), offered at once; not one the environment sets. */
28173
28746
  setProvider(id, fields) {
@@ -28176,6 +28749,7 @@ var init_ta_sign_in = __esmMin((() => {
28176
28749
  const next = SignInProviders.withProvider(config(), id, fields);
28177
28750
  writeFileSync(file(), `${JSON.stringify(next, null, 2)}\n`, { mode: 384 });
28178
28751
  this.providers = SignInProviders.fromEnv(SignInProviders.withConfig(process.env, next));
28752
+ this.device = SignInProviders.device(SignInProviders.withConfig(process.env, next));
28179
28753
  }
28180
28754
  static {
28181
28755
  Object.defineProperty(this, "name", {
@@ -33741,7 +34315,8 @@ var init_host_team = __esmMin((() => {
33741
34315
  accounts: {
33742
34316
  providers: () => this.accounts.providers(),
33743
34317
  start: (provider, redirectUri) => this.accounts.start(provider, redirectUri),
33744
- verify: (state, code) => this.accounts.verify(state, code)
34318
+ verify: (state, code) => this.accounts.verify(state, code),
34319
+ typed: (state, waitMs) => this.accounts.typed(state, waitMs)
33745
34320
  }
33746
34321
  };
33747
34322
  }
@@ -33763,9 +34338,10 @@ var init_host_team = __esmMin((() => {
33763
34338
  DefaultTaHostTeamProvider = __decorate$14([Component(TaHostTeamProvider)], DefaultTaHostTeamProvider);
33764
34339
  }));
33765
34340
  // ../../ta-packages/ta-host/esm/node/team/member-accounts.js
33766
- var __decorate$13, __metadata$12, DefaultTaMemberAccounts;
34341
+ var __decorate$13, __metadata$12, MAX_TYPING, WAIT_MS, DefaultTaMemberAccounts;
33767
34342
  var init_member_accounts = __esmMin((() => {
33768
34343
  init_common$6();
34344
+ init_sign_in_provider();
33769
34345
  init_ta_sign_in();
33770
34346
  init_team_protocol();
33771
34347
  __decorate$13 = function(decorators, target, key, desc) {
@@ -33777,19 +34353,92 @@ var init_member_accounts = __esmMin((() => {
33777
34353
  __metadata$12 = function(k, v) {
33778
34354
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33779
34355
  };
34356
+ MAX_TYPING = 200;
34357
+ WAIT_MS = 25e3;
33780
34358
  DefaultTaMemberAccounts = class DefaultTaMemberAccounts {
34359
+ constructor() {
34360
+ this.typing = /* @__PURE__ */ new Map();
34361
+ }
33781
34362
  providers() {
33782
- return this.flow.providers.map(({ id, name }) => ({
34363
+ const own = this.flow.providers.map(({ id, name }) => ({
33783
34364
  id,
33784
34365
  name
33785
34366
  }));
34367
+ const device = this.device();
34368
+ return device ? [...own, {
34369
+ id: device.id,
34370
+ name: device.name,
34371
+ device: true
34372
+ }] : own;
33786
34373
  }
33787
- start(provider, redirectUri) {
34374
+ async start(provider, redirectUri) {
34375
+ const device = this.device();
34376
+ if ((device === null || device === void 0 ? void 0 : device.id) === provider) return this.startTyping(device);
33788
34377
  if (!/^https?:\/\/[^/?#]+\/[^?#]*$/.test(redirectUri)) throw new Error(`Not an address to come back to: ${redirectUri}`);
33789
34378
  return this.flow.startVerify(provider, redirectUri);
33790
34379
  }
33791
34380
  async verify(state, code) {
33792
- const { id, name, avatar } = await this.flow.verify(state, code);
34381
+ return this.of(await this.flow.verify(state, code));
34382
+ }
34383
+ async typed(state, waitMs = WAIT_MS) {
34384
+ const typing = this.typing.get(state);
34385
+ if (!typing) throw new SignInError("The sign-in expired or was not started here");
34386
+ const until = Date.now() + Math.min(Math.max(0, waitMs), WAIT_MS);
34387
+ while (!typing.account) {
34388
+ if (Date.now() >= typing.expiresAt) {
34389
+ this.typing.delete(state);
34390
+ throw new SignInError("The code ran out: sign in again");
34391
+ }
34392
+ const sleep = typing.next - Date.now();
34393
+ if (Date.now() + Math.max(0, sleep) > until) return;
34394
+ if (sleep > 0) {
34395
+ await new Promise((resolve) => setTimeout(resolve, sleep));
34396
+ continue;
34397
+ }
34398
+ typing.next = Date.now() + typing.interval;
34399
+ let answer;
34400
+ try {
34401
+ answer = await typing.provider.poll(typing.deviceCode);
34402
+ } catch (failure) {
34403
+ if (failure instanceof SignInError) this.typing.delete(state);
34404
+ throw failure;
34405
+ }
34406
+ if (answer === "slowDown") {
34407
+ typing.interval += 5e3;
34408
+ typing.next = Date.now() + typing.interval;
34409
+ } else if (answer !== "pending") typing.account = this.of(answer);
34410
+ }
34411
+ return typing.account;
34412
+ }
34413
+ /** GitHub by a code, when ta serve has no GitHub of its own. */
34414
+ device() {
34415
+ const device = this.flow.device;
34416
+ return device && !this.flow.providers.some((one) => one.id === device.id) ? device : void 0;
34417
+ }
34418
+ async startTyping(device) {
34419
+ const now = Date.now();
34420
+ for (const [state, typing] of this.typing) if (now >= typing.expiresAt || this.typing.size >= MAX_TYPING) this.typing.delete(state);
34421
+ const code = await device.code();
34422
+ const state = randomBytes(18).toString("base64url");
34423
+ const interval = Math.max(0, code.interval) * 1e3;
34424
+ const expiresAt = now + code.expiresIn * 1e3;
34425
+ this.typing.set(state, {
34426
+ provider: device,
34427
+ deviceCode: code.deviceCode,
34428
+ interval,
34429
+ next: now + interval,
34430
+ expiresAt
34431
+ });
34432
+ return {
34433
+ state,
34434
+ device: {
34435
+ code: code.userCode,
34436
+ uri: code.uri,
34437
+ expiresAt
34438
+ }
34439
+ };
34440
+ }
34441
+ of({ id, name, avatar }) {
33793
34442
  return {
33794
34443
  id,
33795
34444
  ...name ? { name } : {},
@@ -34389,7 +35038,11 @@ var init_team_calls = __esmMin((() => {
34389
35038
  login: fixed("models.manage"),
34390
35039
  answer: fixed("models.manage"),
34391
35040
  cancel: fixed("models.manage"),
34392
- logout: fixed("models.manage")
35041
+ logout: fixed("models.manage"),
35042
+ listCustomProviders: fixed("models.manage"),
35043
+ saveCustomProvider: fixed("models.manage"),
35044
+ removeCustomProvider: fixed("models.manage"),
35045
+ fetchCustomModels: fixed("models.manage")
34393
35046
  },
34394
35047
  TaAccessServer: {
34395
35048
  getSignInConfig: owner,
@@ -34688,6 +35341,7 @@ var init_web_extension_util = __esmMin((() => {
34688
35341
  origin: pkg.origin,
34689
35342
  enabled: (_e = pkg.enabled) !== null && _e !== void 0 ? _e : true,
34690
35343
  source: pkg.source,
35344
+ root: pkg.root,
34691
35345
  entry,
34692
35346
  hash: hash(readFileSync(join(pkg.root, entry), "utf8")),
34693
35347
  title: text((_a = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _a === void 0 ? void 0 : _a.title),