@agentorg/cli 0.0.5 → 0.0.7

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 (260) hide show
  1. package/README.md +23 -104
  2. package/dist/node_modules/@agentorg/computer/LICENSE +201 -0
  3. package/dist/node_modules/@agentorg/computer/NOTICE +2 -0
  4. package/dist/node_modules/@agentorg/computer/dist/THIRD_PARTY_LICENSES.txt +1321 -0
  5. package/dist/node_modules/@agentorg/computer/dist/sdk.js +24909 -0
  6. package/dist/node_modules/@agentorg/computer/dist/types/generated/schema.d.ts +860 -0
  7. package/dist/node_modules/@agentorg/computer/dist/types/sdk.d.ts +242 -0
  8. package/dist/node_modules/@agentorg/computer/package.json +12 -0
  9. package/dist/node_modules/@agentorg/computer-connector/dist/src/index.d.ts +1 -0
  10. package/dist/node_modules/@agentorg/computer-connector/dist/src/index.js +1 -0
  11. package/dist/node_modules/@agentorg/computer-connector/dist/src/provider.d.ts +24 -0
  12. package/dist/node_modules/@agentorg/computer-connector/dist/src/provider.js +482 -0
  13. package/dist/node_modules/@agentorg/computer-connector/dist/src/unit.d.ts +19 -0
  14. package/dist/node_modules/@agentorg/computer-connector/dist/src/unit.js +149 -0
  15. package/dist/node_modules/@agentorg/computer-connector/package.json +33 -0
  16. package/dist/node_modules/@agentorg/computer-connector/skills/browser/SKILL.md +31 -0
  17. package/dist/node_modules/@agentorg/computer-connector/skills/computer/SKILL.md +30 -0
  18. package/dist/node_modules/@agentorg/computer-connector/skills/files/SKILL.md +28 -0
  19. package/dist/node_modules/@agentorg/computer-connector/skills/terminal/SKILL.md +39 -0
  20. package/dist/node_modules/@agentorg/computer-connector/skills/web-research/SKILL.md +29 -0
  21. package/dist/node_modules/@agentorg/hub/dist/src/hub-actor.d.ts +2 -7
  22. package/dist/node_modules/@agentorg/hub/dist/src/hub-actor.js +4 -144
  23. package/dist/node_modules/@agentorg/hub/dist/src/index.d.ts +1 -3
  24. package/dist/node_modules/@agentorg/hub/dist/src/index.js +1 -3
  25. package/dist/node_modules/@agentorg/hub/dist/src/router.d.ts +9 -58
  26. package/dist/node_modules/@agentorg/hub/dist/src/router.js +41 -414
  27. package/dist/node_modules/@agentorg/hub/dist/src/state.d.ts +17 -317
  28. package/dist/node_modules/@agentorg/hub/dist/src/state.js +42 -536
  29. package/dist/node_modules/@agentorg/hub/dist/src/validate.d.ts +1 -3
  30. package/dist/node_modules/@agentorg/hub/dist/src/validate.js +19 -17
  31. package/dist/node_modules/@agentorg/hub/package.json +0 -3
  32. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.d.ts +119 -0
  33. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.js +96 -0
  34. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-settings.d.ts +42 -0
  35. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-settings.js +53 -0
  36. package/dist/node_modules/@agentorg/interfaces/dist/src/chat.d.ts +93 -38
  37. package/dist/node_modules/@agentorg/interfaces/dist/src/chat.js +71 -22
  38. package/dist/node_modules/@agentorg/interfaces/dist/src/connection.d.ts +36 -0
  39. package/dist/node_modules/@agentorg/interfaces/dist/src/connection.js +31 -0
  40. package/dist/node_modules/@agentorg/interfaces/dist/src/folders.d.ts +19 -0
  41. package/dist/node_modules/@agentorg/interfaces/dist/src/folders.js +25 -0
  42. package/dist/node_modules/@agentorg/interfaces/dist/src/hub.d.ts +16 -286
  43. package/dist/node_modules/@agentorg/interfaces/dist/src/hub.js +17 -159
  44. package/dist/node_modules/@agentorg/interfaces/dist/src/index.d.ts +9 -9
  45. package/dist/node_modules/@agentorg/interfaces/dist/src/index.js +9 -9
  46. package/dist/node_modules/@agentorg/interfaces/dist/src/kv.d.ts +2 -2
  47. package/dist/node_modules/@agentorg/interfaces/dist/src/kv.js +2 -2
  48. package/dist/node_modules/@agentorg/interfaces/dist/src/llm-session.d.ts +2 -0
  49. package/dist/node_modules/@agentorg/interfaces/dist/src/llm-session.js +2 -1
  50. package/dist/node_modules/@agentorg/interfaces/dist/src/manager.d.ts +626 -0
  51. package/dist/node_modules/@agentorg/interfaces/dist/src/manager.js +349 -0
  52. package/dist/node_modules/@agentorg/interfaces/dist/src/tools.d.ts +39 -0
  53. package/dist/node_modules/@agentorg/interfaces/dist/src/tools.js +43 -0
  54. package/dist/node_modules/@agentorg/interfaces/dist/src/units.d.ts +460 -0
  55. package/dist/node_modules/@agentorg/interfaces/dist/src/units.js +204 -0
  56. package/dist/node_modules/@agentorg/looper/dist/src/index.d.ts +5 -0
  57. package/dist/node_modules/@agentorg/looper/dist/src/index.js +5 -0
  58. package/dist/node_modules/@agentorg/looper/dist/src/loop.d.ts +75 -0
  59. package/dist/node_modules/@agentorg/looper/dist/src/loop.js +332 -0
  60. package/dist/node_modules/@agentorg/looper/dist/src/looper.d.ts +71 -0
  61. package/dist/node_modules/@agentorg/looper/dist/src/looper.js +282 -0
  62. package/dist/node_modules/@agentorg/looper/dist/src/record.d.ts +99 -0
  63. package/dist/node_modules/@agentorg/looper/dist/src/record.js +278 -0
  64. package/dist/node_modules/@agentorg/looper/dist/src/tools.d.ts +11 -0
  65. package/dist/node_modules/@agentorg/looper/dist/src/tools.js +42 -0
  66. package/dist/node_modules/@agentorg/looper/dist/src/types.d.ts +147 -0
  67. package/dist/node_modules/@agentorg/looper/dist/src/types.js +32 -0
  68. package/dist/node_modules/@agentorg/looper/package.json +24 -0
  69. package/dist/node_modules/@agentorg/manager/dist/src/activity.d.ts +18 -0
  70. package/dist/node_modules/@agentorg/manager/dist/src/activity.js +65 -0
  71. package/dist/node_modules/@agentorg/manager/dist/src/control.d.ts +134 -0
  72. package/dist/node_modules/@agentorg/manager/dist/src/control.js +1115 -0
  73. package/dist/node_modules/@agentorg/manager/dist/src/form.d.ts +40 -0
  74. package/dist/node_modules/@agentorg/manager/dist/src/form.js +191 -0
  75. package/dist/node_modules/@agentorg/manager/dist/src/index.d.ts +1 -0
  76. package/dist/node_modules/@agentorg/manager/dist/src/index.js +1 -0
  77. package/dist/node_modules/@agentorg/manager/dist/src/manager.d.ts +25 -0
  78. package/dist/node_modules/@agentorg/manager/dist/src/manager.js +680 -0
  79. package/dist/node_modules/@agentorg/manager/dist/src/skills.d.ts +27 -0
  80. package/dist/node_modules/@agentorg/manager/dist/src/skills.js +152 -0
  81. package/dist/node_modules/@agentorg/manager/dist/src/stack.d.ts +454 -0
  82. package/dist/node_modules/@agentorg/manager/dist/src/stack.js +917 -0
  83. package/dist/node_modules/@agentorg/manager/package.json +30 -0
  84. package/dist/node_modules/@agentorg/mcp/dist/src/connection.d.ts +34 -0
  85. package/dist/node_modules/@agentorg/mcp/dist/src/connection.js +296 -0
  86. package/dist/node_modules/@agentorg/mcp/dist/src/index.d.ts +4 -0
  87. package/dist/node_modules/@agentorg/mcp/dist/src/index.js +4 -0
  88. package/dist/node_modules/@agentorg/mcp/dist/src/kinds.d.ts +158 -0
  89. package/dist/node_modules/@agentorg/mcp/dist/src/kinds.js +164 -0
  90. package/dist/node_modules/@agentorg/mcp/dist/src/provider.d.ts +22 -0
  91. package/dist/node_modules/@agentorg/mcp/dist/src/provider.js +197 -0
  92. package/dist/node_modules/@agentorg/mcp/dist/src/public.d.ts +6 -0
  93. package/dist/node_modules/@agentorg/mcp/dist/src/public.js +72 -0
  94. package/dist/node_modules/@agentorg/mcp/package.json +31 -0
  95. package/dist/node_modules/@agentorg/sdk/dist/src/cli.js +3 -23
  96. package/dist/node_modules/@agentorg/sdk/dist/src/client.d.ts +4 -25
  97. package/dist/node_modules/@agentorg/sdk/dist/src/client.js +5 -55
  98. package/dist/node_modules/@agentorg/sdk/dist/src/errors.d.ts +1 -1
  99. package/dist/node_modules/@agentorg/sdk/dist/src/errors.js +3 -3
  100. package/dist/node_modules/@agentorg/sdk/dist/src/filled.d.ts +21 -0
  101. package/dist/node_modules/@agentorg/sdk/dist/src/filled.js +24 -0
  102. package/dist/node_modules/@agentorg/sdk/dist/src/index.d.ts +3 -2
  103. package/dist/node_modules/@agentorg/sdk/dist/src/index.js +2 -1
  104. package/dist/node_modules/@agentorg/sdk/dist/src/interface.d.ts +6 -34
  105. package/dist/node_modules/@agentorg/sdk/dist/src/interface.js +3 -24
  106. package/dist/node_modules/@agentorg/sdk/dist/src/module-host.d.ts +8 -17
  107. package/dist/node_modules/@agentorg/sdk/dist/src/module-host.js +15 -87
  108. package/dist/node_modules/@agentorg/sdk/dist/src/module.d.ts +10 -76
  109. package/dist/node_modules/@agentorg/sdk/dist/src/module.js +3 -23
  110. package/dist/node_modules/@agentorg/sdk/dist/src/person-commands.js +0 -5
  111. package/dist/node_modules/@agentorg/sdk/dist/src/runtime.d.ts +3 -27
  112. package/dist/node_modules/@agentorg/sdk/dist/src/runtime.js +5 -100
  113. package/dist/node_modules/@agentorg/sdk/dist/src/testing.d.ts +7 -8
  114. package/dist/node_modules/@agentorg/sdk/dist/src/testing.js +12 -24
  115. package/dist/node_modules/@agentorg/sdk/package.json +4 -37
  116. package/dist/node_modules/@agentorg/shell/dist/app.css +4624 -739
  117. package/dist/node_modules/@agentorg/shell/dist/app.js +245 -202
  118. package/dist/node_modules/@agentorg/shell/package.json +23 -10
  119. package/dist/node_modules/@agentorg/wire/dist/src/frames.d.ts +2 -3
  120. package/dist/node_modules/@agentorg/wire/dist/src/frames.js +2 -3
  121. package/dist/node_modules/@agentorg/wire/dist/src/ops.d.ts +5 -34
  122. package/dist/node_modules/@agentorg/wire/dist/src/ops.js +2 -17
  123. package/dist/node_modules/assistant/dist/src/chats.d.ts +92 -0
  124. package/dist/node_modules/assistant/dist/src/chats.js +357 -0
  125. package/dist/node_modules/assistant/dist/src/engine.d.ts +42 -0
  126. package/dist/node_modules/assistant/dist/src/engine.js +160 -0
  127. package/dist/node_modules/assistant/dist/src/local-store.d.ts +3 -0
  128. package/dist/node_modules/assistant/dist/src/local-store.js +58 -0
  129. package/dist/node_modules/assistant/dist/src/provider.d.ts +21 -0
  130. package/dist/node_modules/assistant/dist/src/provider.js +259 -0
  131. package/dist/node_modules/assistant/dist/src/settings.d.ts +17 -0
  132. package/dist/node_modules/assistant/dist/src/settings.js +43 -0
  133. package/dist/node_modules/assistant/dist/src/tools.d.ts +57 -0
  134. package/dist/node_modules/assistant/dist/src/tools.js +102 -0
  135. package/dist/node_modules/assistant/package.json +30 -0
  136. package/dist/node_modules/chatgpt/dist/src/account.d.ts +52 -0
  137. package/dist/node_modules/chatgpt/dist/src/account.js +270 -0
  138. package/dist/node_modules/chatgpt/dist/src/encoding.d.ts +7 -0
  139. package/dist/node_modules/chatgpt/dist/src/encoding.js +20 -0
  140. package/dist/node_modules/chatgpt/dist/src/file-store.d.ts +9 -0
  141. package/dist/node_modules/chatgpt/dist/src/file-store.js +68 -0
  142. package/dist/node_modules/chatgpt/dist/src/index.d.ts +1 -0
  143. package/dist/node_modules/chatgpt/dist/src/index.js +1 -0
  144. package/dist/node_modules/chatgpt/dist/src/jwt.d.ts +15 -0
  145. package/dist/node_modules/chatgpt/dist/src/jwt.js +37 -0
  146. package/dist/node_modules/chatgpt/dist/src/oauth.d.ts +43 -0
  147. package/dist/node_modules/chatgpt/dist/src/oauth.js +104 -0
  148. package/dist/node_modules/chatgpt/dist/src/program.d.ts +23 -0
  149. package/dist/node_modules/chatgpt/dist/src/program.js +41 -0
  150. package/dist/node_modules/chatgpt/dist/src/responses.d.ts +54 -0
  151. package/dist/node_modules/chatgpt/dist/src/responses.js +300 -0
  152. package/dist/node_modules/chatgpt/dist/src/serve.d.ts +65 -0
  153. package/dist/node_modules/chatgpt/dist/src/serve.js +46 -0
  154. package/dist/node_modules/chatgpt/package.json +33 -0
  155. package/dist/src/api.d.ts +5 -34
  156. package/dist/src/api.js +10 -68
  157. package/dist/src/cli.js +3 -7
  158. package/dist/src/folders.d.ts +2 -0
  159. package/dist/src/folders.js +45 -0
  160. package/dist/src/gateway.d.ts +13 -8
  161. package/dist/src/gateway.js +119 -296
  162. package/dist/src/index.d.ts +4 -5
  163. package/dist/src/index.js +3 -4
  164. package/dist/src/live.d.ts +17 -0
  165. package/dist/src/live.js +109 -0
  166. package/dist/src/notes.d.ts +11 -0
  167. package/dist/src/notes.js +64 -0
  168. package/dist/src/oauth.d.ts +16 -0
  169. package/dist/src/oauth.js +46 -0
  170. package/dist/src/programs.d.ts +36 -0
  171. package/dist/src/programs.js +198 -0
  172. package/dist/src/signin.d.ts +12 -3
  173. package/dist/src/signin.js +30 -6
  174. package/package.json +4 -11
  175. package/dist/bundled/index.json +0 -6
  176. package/dist/bundled/sha256-0e91cc3d0e9762b81abc2427b5496b20f383abcd6fb97d928a8d50e956b54d1f.agentorg +0 -0
  177. package/dist/bundled/sha256-1f64ca62a0209d767d6aa6c4feb50b0653d60f10bebbc301f79bd3a37e0153c1.agentorg +0 -0
  178. package/dist/bundled/sha256-4055f8fddf6b90f3d356543f554b2a9e9a2c4a8827a8774f8f87952dc1692331.agentorg +0 -0
  179. package/dist/bundled/sha256-e356ea3c1899138a8494baf521556831006f38534fa9e92ae873e7e6956c3a46.agentorg +0 -0
  180. package/dist/node_modules/@agentorg/hub/dist/src/build.d.ts +0 -17
  181. package/dist/node_modules/@agentorg/hub/dist/src/build.js +0 -120
  182. package/dist/node_modules/@agentorg/hub/dist/src/logs.d.ts +0 -33
  183. package/dist/node_modules/@agentorg/hub/dist/src/logs.js +0 -162
  184. package/dist/node_modules/@agentorg/hub/dist/src/net.d.ts +0 -41
  185. package/dist/node_modules/@agentorg/hub/dist/src/net.js +0 -265
  186. package/dist/node_modules/@agentorg/hub/dist/src/processes.d.ts +0 -78
  187. package/dist/node_modules/@agentorg/hub/dist/src/processes.js +0 -485
  188. package/dist/node_modules/@agentorg/hub/dist/src/storage.d.ts +0 -38
  189. package/dist/node_modules/@agentorg/hub/dist/src/storage.js +0 -194
  190. package/dist/node_modules/@agentorg/interfaces/dist/src/http-egress.d.ts +0 -6
  191. package/dist/node_modules/@agentorg/interfaces/dist/src/http-egress.js +0 -7
  192. package/dist/node_modules/@agentorg/interfaces/dist/src/installer.d.ts +0 -191
  193. package/dist/node_modules/@agentorg/interfaces/dist/src/installer.js +0 -136
  194. package/dist/node_modules/@agentorg/interfaces/dist/src/layout.d.ts +0 -47
  195. package/dist/node_modules/@agentorg/interfaces/dist/src/layout.js +0 -52
  196. package/dist/node_modules/@agentorg/interfaces/dist/src/rules.d.ts +0 -35
  197. package/dist/node_modules/@agentorg/interfaces/dist/src/rules.js +0 -37
  198. package/dist/node_modules/@agentorg/interfaces/dist/src/storage-admin.d.ts +0 -23
  199. package/dist/node_modules/@agentorg/interfaces/dist/src/storage-admin.js +0 -31
  200. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-shell.d.ts +0 -14
  201. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-shell.js +0 -26
  202. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-view.d.ts +0 -27
  203. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-view.js +0 -26
  204. package/dist/node_modules/@agentorg/kit/dist/src/chat.d.ts +0 -37
  205. package/dist/node_modules/@agentorg/kit/dist/src/chat.js +0 -131
  206. package/dist/node_modules/@agentorg/kit/dist/src/components.d.ts +0 -94
  207. package/dist/node_modules/@agentorg/kit/dist/src/components.js +0 -66
  208. package/dist/node_modules/@agentorg/kit/dist/src/icons.d.ts +0 -17
  209. package/dist/node_modules/@agentorg/kit/dist/src/icons.js +0 -30
  210. package/dist/node_modules/@agentorg/kit/dist/src/index.d.ts +0 -6
  211. package/dist/node_modules/@agentorg/kit/dist/src/index.js +0 -10
  212. package/dist/node_modules/@agentorg/kit/dist/src/markdown.d.ts +0 -9
  213. package/dist/node_modules/@agentorg/kit/dist/src/markdown.js +0 -14
  214. package/dist/node_modules/@agentorg/kit/dist/src/resizable.d.ts +0 -5
  215. package/dist/node_modules/@agentorg/kit/dist/src/resizable.js +0 -8
  216. package/dist/node_modules/@agentorg/kit/dist/src/styles.d.ts +0 -11
  217. package/dist/node_modules/@agentorg/kit/dist/src/styles.js +0 -166
  218. package/dist/node_modules/@agentorg/kit/package.json +0 -44
  219. package/dist/node_modules/@agentorg/sdk/dist/frame/runtime.js +0 -753
  220. package/dist/node_modules/@agentorg/sdk/dist/host/runner.js +0 -21963
  221. package/dist/node_modules/@agentorg/sdk/dist/src/build.d.ts +0 -2
  222. package/dist/node_modules/@agentorg/sdk/dist/src/build.js +0 -2
  223. package/dist/node_modules/@agentorg/sdk/dist/src/client-http.d.ts +0 -24
  224. package/dist/node_modules/@agentorg/sdk/dist/src/client-http.js +0 -247
  225. package/dist/node_modules/@agentorg/sdk/dist/src/describe.d.ts +0 -13
  226. package/dist/node_modules/@agentorg/sdk/dist/src/describe.js +0 -16
  227. package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.d.ts +0 -8
  228. package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.js +0 -64
  229. package/dist/node_modules/@agentorg/sdk/dist/src/frame-entry.d.ts +0 -1
  230. package/dist/node_modules/@agentorg/sdk/dist/src/frame-entry.js +0 -35
  231. package/dist/node_modules/@agentorg/sdk/dist/src/frame-host.d.ts +0 -57
  232. package/dist/node_modules/@agentorg/sdk/dist/src/frame-host.js +0 -293
  233. package/dist/node_modules/@agentorg/sdk/dist/src/frame-protocol.d.ts +0 -124
  234. package/dist/node_modules/@agentorg/sdk/dist/src/frame-protocol.js +0 -16
  235. package/dist/node_modules/@agentorg/sdk/dist/src/frame.d.ts +0 -25
  236. package/dist/node_modules/@agentorg/sdk/dist/src/frame.js +0 -248
  237. package/dist/node_modules/@agentorg/sdk/dist/src/host-main.d.ts +0 -1
  238. package/dist/node_modules/@agentorg/sdk/dist/src/host-main.js +0 -60
  239. package/dist/node_modules/@agentorg/sdk/dist/src/host.d.ts +0 -25
  240. package/dist/node_modules/@agentorg/sdk/dist/src/host.js +0 -92
  241. package/dist/node_modules/@agentorg/sdk/dist/src/manifest-api.d.ts +0 -2
  242. package/dist/node_modules/@agentorg/sdk/dist/src/manifest-api.js +0 -2
  243. package/dist/node_modules/@agentorg/sdk/dist/src/manifest.d.ts +0 -56
  244. package/dist/node_modules/@agentorg/sdk/dist/src/manifest.js +0 -165
  245. package/dist/node_modules/@agentorg/sdk/dist/src/package.d.ts +0 -60
  246. package/dist/node_modules/@agentorg/sdk/dist/src/package.js +0 -538
  247. package/dist/node_modules/@agentorg/sdk/dist/src/tar.d.ts +0 -7
  248. package/dist/node_modules/@agentorg/sdk/dist/src/tar.js +0 -71
  249. package/dist/node_modules/@agentorg/shell/dist/agent-bindings.js +0 -59
  250. package/dist/node_modules/@agentorg/shell/src/agent-bindings.ts +0 -107
  251. package/dist/src/frames.d.ts +0 -23
  252. package/dist/src/frames.js +0 -78
  253. package/dist/src/layout.d.ts +0 -44
  254. package/dist/src/layout.js +0 -90
  255. package/dist/src/model.d.ts +0 -54
  256. package/dist/src/model.js +0 -299
  257. package/dist/src/rules.d.ts +0 -71
  258. package/dist/src/rules.js +0 -157
  259. package/dist/src/transfer.d.ts +0 -30
  260. package/dist/src/transfer.js +0 -110
@@ -0,0 +1,109 @@
1
+ // A live surface of an agent's unit, for a page: the page opens a socket here, same-origin, and
2
+ // this asks management for a one-time ticket, dials it, and pipes the bytes both ways. The ticket
3
+ // and every token stay out of the page.
4
+ import WebSocket from "ws";
5
+ /** What one live frame can be, either way. */
6
+ export const LIVE_MAX = 4 * 1024 * 1024;
7
+ /** The page didn't say its session, or the session is gone. */
8
+ const SIGN_IN_AGAIN = 4401;
9
+ /** The surface couldn't be opened; the reason says why. */
10
+ const NOT_OPENED = 4404;
11
+ const HELLO_TIMEOUT_MS = 10_000;
12
+ /** What a page may send before the surface opens; past it, the socket closes rather than drop. */
13
+ const WAITING_MAX = 1024 * 1024;
14
+ /** Past this much unsent to the page, the surface waits; it goes on below the lower mark. */
15
+ const BEHIND = 8 * 1024 * 1024;
16
+ const CAUGHT_UP = 1024 * 1024;
17
+ /** A close code a page may be given: the peer's when it's an ordinary one. */
18
+ const codeOf = (code) => code === 1000 || code === 1001 || (code >= 3000 && code <= 4999) ? code : 1011;
19
+ /** A close reason fits in 123 bytes. */
20
+ const reasonOf = (text) => {
21
+ let reason = text;
22
+ while (Buffer.byteLength(reason) > 123)
23
+ reason = reason.slice(0, -1);
24
+ return reason;
25
+ };
26
+ /**
27
+ * Pipe a page's socket to a surface. A tab says its session first, as on `/api`, and is then
28
+ * answered `{"op":"live","protocol"}`; after that every frame is the surface's own. The CLI is in
29
+ * by its token.
30
+ */
31
+ export function pipeLive(page, options) {
32
+ let upstream;
33
+ let opening = false;
34
+ const waiting = [];
35
+ let waitingBytes = 0;
36
+ const sizeOf = (data) => Array.isArray(data)
37
+ ? data.reduce((sum, one) => sum + one.length, 0)
38
+ : data.byteLength;
39
+ const open = async () => {
40
+ opening = true;
41
+ let ticket;
42
+ try {
43
+ ticket = await options.ticket();
44
+ }
45
+ catch (error) {
46
+ return page.close(NOT_OPENED, reasonOf(error instanceof Error ? error.message : "Not opened."));
47
+ }
48
+ if (page.readyState !== WebSocket.OPEN)
49
+ return;
50
+ let socket;
51
+ try {
52
+ // A server's socket, dialled from here: no browser Origin goes with it.
53
+ socket = new WebSocket(ticket.url, { maxPayload: LIVE_MAX });
54
+ }
55
+ catch {
56
+ // Its message would hold the ticket.
57
+ return page.close(NOT_OPENED, "The surface didn't open.");
58
+ }
59
+ upstream = socket;
60
+ socket.on("open", () => {
61
+ page.send(JSON.stringify({ op: "live", protocol: ticket.protocol }));
62
+ for (const [data, binary] of waiting.splice(0))
63
+ socket.send(data, { binary });
64
+ });
65
+ socket.on("message", (data, binary) => {
66
+ page.send(data, { binary }, () => {
67
+ if (page.bufferedAmount < CAUGHT_UP)
68
+ socket.resume();
69
+ });
70
+ // A page that can't keep up isn't sent more until it has.
71
+ if (page.bufferedAmount > BEHIND)
72
+ socket.pause();
73
+ });
74
+ socket.on("close", (code, reason) => page.close(codeOf(code), reasonOf(String(reason))));
75
+ socket.on("error", () => page.close(NOT_OPENED, "The surface didn't open."));
76
+ };
77
+ const timer = options.cli
78
+ ? undefined
79
+ : setTimeout(() => page.close(SIGN_IN_AGAIN, "No session"), HELLO_TIMEOUT_MS);
80
+ const opened = () => open().catch(() => page.close(NOT_OPENED, "The surface didn't open."));
81
+ if (options.cli)
82
+ void opened();
83
+ page.on("message", (data, binary) => {
84
+ if (!opening) {
85
+ clearTimeout(timer);
86
+ let hello;
87
+ try {
88
+ hello = binary ? undefined : JSON.parse(String(data));
89
+ }
90
+ catch {
91
+ // Not a hello.
92
+ }
93
+ if (hello?.op !== "hello" || !options.isSession(hello.session))
94
+ return page.close(SIGN_IN_AGAIN, "Sign in again");
95
+ return void opened();
96
+ }
97
+ if (upstream?.readyState === WebSocket.OPEN)
98
+ return upstream.send(data, { binary });
99
+ waitingBytes += sizeOf(data);
100
+ if (waitingBytes > WAITING_MAX)
101
+ return page.close(1009, "Too much before the surface opened.");
102
+ waiting.push([data, binary]);
103
+ });
104
+ page.on("close", () => {
105
+ clearTimeout(timer);
106
+ upstream?.close();
107
+ });
108
+ page.on("error", () => page.terminate());
109
+ }
@@ -0,0 +1,11 @@
1
+ /** A file of JSON values by key, answering as `kv@1` does. Each write replaces it whole. */
2
+ export declare class Notes {
3
+ #private;
4
+ constructor(file: string);
5
+ get(key: string): {
6
+ value?: unknown;
7
+ };
8
+ set(key: string, value: unknown): object;
9
+ /** One `kv@1` call, checked as a call through the Hub would be. */
10
+ call(method: string, input: unknown): unknown;
11
+ }
@@ -0,0 +1,64 @@
1
+ // The app's own notes: what the person's pages and the gateway keep, in one private file.
2
+ import { readFileSync, renameSync, writeFileSync } from "node:fs";
3
+ import { kv } from "@agentorg/interfaces";
4
+ import { Refused } from "@agentorg/sdk";
5
+ /** Keys read at once by a `list`. */
6
+ const PAGE = 1000;
7
+ /** A file of JSON values by key, answering as `kv@1` does. Each write replaces it whole. */
8
+ export class Notes {
9
+ #file;
10
+ #values;
11
+ constructor(file) {
12
+ this.#file = file;
13
+ let raw;
14
+ try {
15
+ raw = readFileSync(file, "utf8");
16
+ }
17
+ catch (error) {
18
+ if (error.code !== "ENOENT")
19
+ throw error;
20
+ }
21
+ this.#values = raw === undefined ? {} : JSON.parse(raw);
22
+ }
23
+ get(key) {
24
+ return Object.hasOwn(this.#values, key) ? { value: this.#values[key] } : {};
25
+ }
26
+ set(key, value) {
27
+ this.#values[key] = value;
28
+ this.#save();
29
+ return {};
30
+ }
31
+ /** One `kv@1` call, checked as a call through the Hub would be. */
32
+ call(method, input) {
33
+ const spec = Object.hasOwn(kv.methods, method)
34
+ ? kv.methods[method]
35
+ : undefined;
36
+ if (!spec)
37
+ throw new Refused("invalid", `store has no method ${method}.`);
38
+ const parsed = spec.input.safeParse(input);
39
+ if (!parsed.success)
40
+ throw new Refused("invalid", `store.${method}: ${parsed.error.message}`);
41
+ const given = parsed.data;
42
+ if (method === "get")
43
+ return this.get(given.key);
44
+ if (method === "set")
45
+ return this.set(given.key, given.value);
46
+ if (method === "delete") {
47
+ const deleted = Object.hasOwn(this.#values, given.key);
48
+ delete this.#values[given.key];
49
+ if (deleted)
50
+ this.#save();
51
+ return { deleted };
52
+ }
53
+ const { prefix = "", after, limit = PAGE } = given;
54
+ const found = Object.keys(this.#values)
55
+ .filter((key) => key.startsWith(prefix) && (after === undefined || key > after))
56
+ .sort();
57
+ const keys = found.slice(0, limit);
58
+ return { keys, next: found.length > limit ? (keys.at(-1) ?? null) : null };
59
+ }
60
+ #save() {
61
+ writeFileSync(`${this.#file}.tmp`, JSON.stringify(this.#values), { mode: 0o600, flush: true });
62
+ renameSync(`${this.#file}.tmp`, this.#file);
63
+ }
64
+ }
@@ -0,0 +1,16 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ /**
3
+ * How the app's parts reach the Hub: the person's own calls, as `/api` makes them. A call that
4
+ * doesn't reach its provider rejects with an error named `NotConnected`, as `/api` names it.
5
+ */
6
+ export interface PersonCalls {
7
+ call(slot: string, method: string, input: unknown): Promise<unknown>;
8
+ }
9
+ /**
10
+ * `/oauth/chatgpt`: where ChatGPT sends the browser back. It hands the whole callback address to
11
+ * the person's `login.complete`, then sends the tab on to `?result=<outcome>`, an address without
12
+ * the sign-in's code, so the code stays out of the tab's address and history; that page says how
13
+ * it went and links back to the shell. The code is never logged or shown, and no page sends a
14
+ * referrer.
15
+ */
16
+ export declare function oauthRoute(person: PersonCalls): (request: IncomingMessage, response: ServerResponse, url: URL) => void;
@@ -0,0 +1,46 @@
1
+ /** What the sign-in tab says, by outcome: `complete`'s refusal code, or `signed_in`. */
2
+ const SAYS = {
3
+ signed_in: "Signed in to ChatGPT. You can close this tab.",
4
+ denied: "You declined on ChatGPT's page. Start again from AgentOrg when you're ready.",
5
+ expired: "This sign-in expired. Start again from AgentOrg.",
6
+ };
7
+ const FAILED = "The sign-in didn't work. Start again from AgentOrg.";
8
+ /**
9
+ * `/oauth/chatgpt`: where ChatGPT sends the browser back. It hands the whole callback address to
10
+ * the person's `login.complete`, then sends the tab on to `?result=<outcome>`, an address without
11
+ * the sign-in's code, so the code stays out of the tab's address and history; that page says how
12
+ * it went and links back to the shell. The code is never logged or shown, and no page sends a
13
+ * referrer.
14
+ */
15
+ export function oauthRoute(person) {
16
+ return (request, response, url) => {
17
+ if (request.method !== "GET")
18
+ return void response.writeHead(405).end();
19
+ const result = url.searchParams.get("result");
20
+ if (result !== null && [...url.searchParams.keys()].length === 1)
21
+ return page(response, result === "signed_in" ? 200 : 400, Object.hasOwn(SAYS, result) ? SAYS[result] : FAILED);
22
+ const after = (outcome) => {
23
+ response.writeHead(303, {
24
+ Location: `${url.pathname}?result=${encodeURIComponent(outcome)}`,
25
+ "Cache-Control": "no-store",
26
+ "Referrer-Policy": "no-referrer",
27
+ });
28
+ response.end();
29
+ };
30
+ void person.call("login", "complete", { callbackUrl: url.href }).then(() => after("signed_in"), (error) => {
31
+ const code = error?.code;
32
+ after(typeof code === "string" && Object.hasOwn(SAYS, code) ? code : "failed");
33
+ });
34
+ };
35
+ }
36
+ function page(response, status, text) {
37
+ response.writeHead(status, {
38
+ "Content-Type": "text/html; charset=utf-8",
39
+ "Cache-Control": "no-store",
40
+ "Referrer-Policy": "no-referrer",
41
+ "Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; frame-ancestors 'none'",
42
+ });
43
+ response.end(`<!doctype html><meta charset="utf-8"><title>AgentOrg</title>` +
44
+ `<style>body{font:15px system-ui,sans-serif;margin:20vh auto;max-width:28rem;padding:0 16px}</style>` +
45
+ `<p>${text}</p><p><a href="/">Back to AgentOrg</a></p>`);
46
+ }
@@ -0,0 +1,36 @@
1
+ import type { PersonCalls } from "./oauth.js";
2
+ export interface ProgramsOptions {
3
+ home: string;
4
+ hubUrl: string;
5
+ /** Where the first run says what it couldn't do. */
6
+ log?: (message: string) => void;
7
+ /** How ChatGPT's requests leave, instead of the network. For tests. */
8
+ fetch?: (request: Request, init: RequestInit) => Promise<Response>;
9
+ /** Where the computer connector looks for a local service, the web unit's server, and agents' folders. For tests. */
10
+ computer?: {
11
+ dataFolder?: string;
12
+ webUrl?: string;
13
+ agentsFolder?: string;
14
+ };
15
+ }
16
+ export interface Programs {
17
+ /** The Actors running now, by program. */
18
+ chatgpt?: string;
19
+ agents?: string;
20
+ mcp?: string;
21
+ computer?: string;
22
+ management?: string;
23
+ /** Leave the Hub, in the order that lets each finish. What each keeps stays. */
24
+ close(): Promise<void>;
25
+ }
26
+ /**
27
+ * Close every Actor that runs a package, as an earlier release's do: the programs replace them.
28
+ * Before the Hub opens. Each stays listed as closed; the files it left in the home stay too, unread.
29
+ */
30
+ export declare function closePackageActors(home: string): void;
31
+ /**
32
+ * Make what is missing and start each program. A program whose Actor exists keeps it and its
33
+ * credential. A step that fails is logged, the programs that don't need it still start, and the
34
+ * next start tries again.
35
+ */
36
+ export declare function startPrograms(person: PersonCalls, options: ProgramsOptions): Promise<Programs>;
@@ -0,0 +1,198 @@
1
+ // The app's programs: ChatGPT, the agent provider, the MCP provider, the computer connector and management, each an Actor
2
+ // of its own that this process runs on its own channel, with its own private folder under the home.
3
+ // Every step reads what is there before it acts, so each start converges on the same system.
4
+ import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ import { startComputerProvider } from "@agentorg/computer-connector";
7
+ import { HubState, PERSON } from "@agentorg/hub";
8
+ import { startManager } from "@agentorg/manager";
9
+ import { startMcpProvider } from "@agentorg/mcp";
10
+ import { startAgentProvider } from "assistant/provider";
11
+ import { startChatGPT } from "chatgpt";
12
+ /**
13
+ * Close every Actor that runs a package, as an earlier release's do: the programs replace them.
14
+ * Before the Hub opens. Each stays listed as closed; the files it left in the home stay too, unread.
15
+ */
16
+ export function closePackageActors(home) {
17
+ if (!existsSync(join(home, "hub.db")))
18
+ return;
19
+ const state = HubState.open(home);
20
+ try {
21
+ for (const { actorId, package: from, state: now } of state.actors())
22
+ if (now !== "closed" && from !== "external" && from !== "builtin")
23
+ state.closeActor(PERSON, actorId);
24
+ }
25
+ finally {
26
+ state.close();
27
+ }
28
+ }
29
+ /** The bundled Assistant: the base, a computer on a service the person chooses, and the web. */
30
+ const ASSISTANT_TEMPLATE = {
31
+ id: "assistant",
32
+ title: "Assistant",
33
+ description: "An agent with a computer of its own and the web.",
34
+ base: { provider: "AgentOrg", creatable: "assistant" },
35
+ units: [
36
+ { provider: "Computers", unit: "computer", values: { access: "terminal", browser: true } },
37
+ { provider: "Computers", unit: "web", values: { service: "exa" } },
38
+ ],
39
+ };
40
+ /** The Hub's exports each program holds. */
41
+ const hubBinding = (name) => ({ slot: name, provider: "hub", export: name });
42
+ /**
43
+ * Make what is missing and start each program. A program whose Actor exists keeps it and its
44
+ * credential. A step that fails is logged, the programs that don't need it still start, and the
45
+ * next start tries again.
46
+ */
47
+ export async function startPrograms(person, options) {
48
+ const log = options.log ?? (() => { });
49
+ const { hubUrl } = options;
50
+ const root = join(options.home, "programs");
51
+ mkdirSync(root, { recursive: true, mode: 0o700 });
52
+ chmodSync(root, 0o700);
53
+ const call = (slot, method, input = {}) => person.call(slot, method, input);
54
+ const programLog = {
55
+ info() { },
56
+ warn() { },
57
+ error: (message) => log(message),
58
+ };
59
+ const dirOf = (name) => join(root, name);
60
+ const identityFile = (name) => join(root, `${name}.identity`);
61
+ /** The program's Actor: the one kept for it unless that is closed, or a new one. */
62
+ const identity = async (name, title, bindings) => {
63
+ let kept;
64
+ try {
65
+ kept = JSON.parse(readFileSync(identityFile(name), "utf8"));
66
+ }
67
+ catch (error) {
68
+ if (error.code !== "ENOENT")
69
+ throw error;
70
+ }
71
+ if (kept) {
72
+ const { actors } = await call("actors", "list");
73
+ const { actorId } = kept;
74
+ if (actors.some((actor) => actor.actorId === actorId && actor.state !== "closed"))
75
+ return kept;
76
+ }
77
+ const made = await call("actors", "create", { name: title, bindings });
78
+ const file = identityFile(name);
79
+ writeFileSync(`${file}.tmp`, JSON.stringify(made), { mode: 0o600, flush: true });
80
+ renameSync(`${file}.tmp`, file);
81
+ return made;
82
+ };
83
+ /** Bind the person's `slot` to `export` of `provider`, unless it is bound already. */
84
+ const personSlot = async (slot, provider, exported) => {
85
+ const { bindings } = await call("bindings", "list", {
86
+ actor: "person",
87
+ });
88
+ if (bindings.some((binding) => binding.consumer === "person" && binding.slot === slot))
89
+ return;
90
+ await call("grants", "bind", { consumer: "person", slot, provider, export: exported });
91
+ };
92
+ const closers = [];
93
+ const attempt = async (what, run) => {
94
+ try {
95
+ return await run();
96
+ }
97
+ catch (error) {
98
+ log(`First run: ${what} didn't work: ${error instanceof Error ? error.message : String(error)}`);
99
+ return undefined;
100
+ }
101
+ };
102
+ const chatgpt = await attempt("ChatGPT", async () => {
103
+ const { actorId, credential } = await identity("chatgpt", "ChatGPT", []);
104
+ const running = await startChatGPT({
105
+ hubUrl,
106
+ actorId,
107
+ credential,
108
+ dir: dirOf("chatgpt"),
109
+ log: programLog,
110
+ ...(options.fetch ? { fetch: options.fetch } : {}),
111
+ });
112
+ closers.unshift(() => running.close());
113
+ await personSlot("login", actorId, "login");
114
+ return actorId;
115
+ });
116
+ // Each agent's binding to the model comes from the provider's own, so ChatGPT goes first.
117
+ const agents = chatgpt &&
118
+ (await attempt("the agent provider", async () => {
119
+ const { actorId, credential } = await identity("agents", "AgentOrg", [
120
+ hubBinding("actors"),
121
+ { slot: "model", provider: chatgpt, export: "session" },
122
+ ]);
123
+ const running = await startAgentProvider({
124
+ hubUrl,
125
+ actorId,
126
+ credential,
127
+ model: { actor: chatgpt, export: "session" },
128
+ dir: dirOf("agents"),
129
+ log: programLog,
130
+ });
131
+ closers.unshift(() => running.close());
132
+ return actorId;
133
+ }));
134
+ const mcp = await attempt("the MCP provider", async () => {
135
+ const { actorId, credential } = await identity("mcp", "Local", [hubBinding("actors")]);
136
+ const running = await startMcpProvider({
137
+ hubUrl,
138
+ actorId,
139
+ credential,
140
+ dir: dirOf("mcp"),
141
+ log: programLog,
142
+ });
143
+ closers.unshift(() => running.close());
144
+ return actorId;
145
+ });
146
+ const computer = await attempt("the computer connector", async () => {
147
+ const { actorId, credential } = await identity("computer", "Computers", [hubBinding("actors")]);
148
+ const running = await startComputerProvider({
149
+ hubUrl,
150
+ actorId,
151
+ credential,
152
+ dir: dirOf("computer"),
153
+ log: programLog,
154
+ ...options.computer,
155
+ });
156
+ closers.unshift(() => running.close());
157
+ return actorId;
158
+ });
159
+ const management = await attempt("management", async () => {
160
+ const { actorId, credential } = await identity("management", "Management", [
161
+ hubBinding("actors"),
162
+ hubBinding("grants"),
163
+ hubBinding("bindings"),
164
+ ]);
165
+ // Management outlasts the providers at the end and is up before they're connected to it.
166
+ const running = await startManager({
167
+ hubUrl,
168
+ actorId,
169
+ credential,
170
+ dir: dirOf("management"),
171
+ log: programLog,
172
+ templates: [ASSISTANT_TEMPLATE],
173
+ });
174
+ closers.push(() => running.close());
175
+ for (const [slot, exported] of [
176
+ ["agents", "agents"],
177
+ ["connections", "connections"],
178
+ ["skills", "skills"],
179
+ ])
180
+ await personSlot(slot, actorId, exported);
181
+ return actorId;
182
+ });
183
+ if (management)
184
+ for (const provider of [agents, mcp, computer])
185
+ if (provider)
186
+ await attempt("connecting a provider to management", () => call("grants", "expose", { provider, export: "provider", to: management }));
187
+ return {
188
+ ...(chatgpt ? { chatgpt } : {}),
189
+ ...(agents ? { agents } : {}),
190
+ ...(mcp ? { mcp } : {}),
191
+ ...(computer ? { computer } : {}),
192
+ ...(management ? { management } : {}),
193
+ async close() {
194
+ for (const close of closers)
195
+ await close().catch((error) => log(`A program didn't stop: ${String(error)}`));
196
+ },
197
+ };
198
+ }
@@ -1,15 +1,24 @@
1
+ /** Where the sessions' hashes outlast the app: read once, when first needed, and written at each sign-in. */
2
+ export interface KeptSessions {
3
+ /** What was written last; anything that isn't a list is read as none. */
4
+ read(): unknown;
5
+ write(hashes: string[]): void;
6
+ }
1
7
  /**
2
8
  * Who may use the gateway: browser tabs with a session, made from a one-time code, and the CLI
3
9
  * with the token in the home. A code works once, within 60 s, and travels only in a URL's
4
- * fragment, which no request carries. A session is a random id the gateway holds in memory, so a
5
- * restart signs every tab out. It is no cookie, which every port on 127.0.0.1 would receive: the
6
- * shell keeps it in its origin's own storage and says it in its socket's first message.
10
+ * fragment, which no request carries. A session is a random id of which the gateway holds only a
11
+ * hash. With `kept`, the hashes outlast the app, so a tab is still signed in when the app starts
12
+ * again; a session ends only when `SESSIONS_MAX` newer ones have been given.
13
+ * It is no cookie, which every port on 127.0.0.1 would receive: the shell keeps it in its origin's
14
+ * own storage and says it in its socket's first message.
7
15
  */
8
16
  export declare class SignIn {
9
17
  #private;
10
18
  readonly cliToken: string;
11
19
  constructor(options?: {
12
20
  now?: () => number;
21
+ kept?: KeptSessions;
13
22
  });
14
23
  /** A new one-time code, for `/signin#<code>`. */
15
24
  code(): string;
@@ -1,10 +1,12 @@
1
- import { randomBytes, timingSafeEqual } from "node:crypto";
1
+ import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
2
2
  /** How long a sign-in code works. */
3
3
  const CODE_TTL_MS = 60_000;
4
4
  /** Codes not yet used; past it, the oldest go, so nothing grows without bound. */
5
5
  const MAX_CODES = 16;
6
6
  const SESSIONS_MAX = 256;
7
7
  const token = () => randomBytes(32).toString("base64url");
8
+ /** What is kept of a session: enough to know it again, and nothing that signs anyone in. */
9
+ const hashOf = (session) => createHash("sha256").update(session).digest("base64url");
8
10
  const same = (a, b) => {
9
11
  const left = Buffer.from(a);
10
12
  const right = Buffer.from(b);
@@ -13,17 +15,34 @@ const same = (a, b) => {
13
15
  /**
14
16
  * Who may use the gateway: browser tabs with a session, made from a one-time code, and the CLI
15
17
  * with the token in the home. A code works once, within 60 s, and travels only in a URL's
16
- * fragment, which no request carries. A session is a random id the gateway holds in memory, so a
17
- * restart signs every tab out. It is no cookie, which every port on 127.0.0.1 would receive: the
18
- * shell keeps it in its origin's own storage and says it in its socket's first message.
18
+ * fragment, which no request carries. A session is a random id of which the gateway holds only a
19
+ * hash. With `kept`, the hashes outlast the app, so a tab is still signed in when the app starts
20
+ * again; a session ends only when `SESSIONS_MAX` newer ones have been given.
21
+ * It is no cookie, which every port on 127.0.0.1 would receive: the shell keeps it in its origin's
22
+ * own storage and says it in its socket's first message.
19
23
  */
20
24
  export class SignIn {
21
25
  cliToken = token();
22
26
  #codes = new Map();
27
+ /** The hash of each session, the oldest first. */
23
28
  #sessions = new Set();
24
29
  #now;
30
+ #kept;
31
+ #restored = false;
25
32
  constructor(options = {}) {
26
33
  this.#now = options.now ?? Date.now;
34
+ this.#kept = options.kept;
35
+ }
36
+ /** Take back what was kept, the first time a session is given or asked about. */
37
+ #restore() {
38
+ if (this.#restored)
39
+ return;
40
+ this.#restored = true;
41
+ const read = this.#kept?.read();
42
+ const hashes = Array.isArray(read) ? read : [];
43
+ for (const hash of hashes.slice(-SESSIONS_MAX))
44
+ if (typeof hash === "string")
45
+ this.#sessions.add(hash);
27
46
  }
28
47
  /** A new one-time code, for `/signin#<code>`. */
29
48
  code() {
@@ -48,17 +67,22 @@ export class SignIn {
48
67
  if (this.#now() > expires)
49
68
  return undefined;
50
69
  const session = token();
51
- this.#sessions.add(session);
70
+ this.#restore();
71
+ this.#sessions.add(hashOf(session));
52
72
  while (this.#sessions.size > SESSIONS_MAX)
53
73
  this.#sessions.delete(this.#sessions.values().next().value);
74
+ // Kept before it is given: a session the tab holds is one a restart still knows.
75
+ this.#kept?.write([...this.#sessions]);
54
76
  return session;
55
77
  }
56
78
  /** Whether a session is live. */
57
79
  isSession(session) {
58
80
  if (typeof session !== "string")
59
81
  return false;
82
+ this.#restore();
83
+ const hash = hashOf(session);
60
84
  for (const known of this.#sessions)
61
- if (same(known, session))
85
+ if (same(known, hash))
62
86
  return true;
63
87
  return false;
64
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentorg/cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "AgentOrg as one app: the Hub, the person's gateway and the shell, on loopback.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,22 +23,15 @@
23
23
  },
24
24
  "files": [
25
25
  "dist/src",
26
- "dist/bundled",
27
26
  "static",
28
27
  "dist/node_modules"
29
28
  ],
30
29
  "dependencies": {
31
- "@assistant-ui/react": "^0.15.32",
30
+ "@modelcontextprotocol/client": "2.4.0",
32
31
  "ajv": "^8.20.0",
33
- "esbuild": "0.28.2",
34
- "radix-ui": "^1.8.1",
35
- "react": "^19.3.1",
36
- "react-dom": "^19.3.1",
37
- "react-markdown": "^10.1.0",
38
- "react-resizable-panels": "^4.19.1",
39
- "remark-gfm": "^4.0.1",
40
- "remend": "^1.4.0",
32
+ "react-diff-view": "3.3.3",
41
33
  "ws": "^8.22.1",
34
+ "yaml": "2.9.1",
42
35
  "zod": "^4.6.7"
43
36
  },
44
37
  "publishConfig": {
@@ -1,6 +0,0 @@
1
- {
2
- "installer": "sha256-4055f8fddf6b90f3d356543f554b2a9e9a2c4a8827a8774f8f87952dc1692331.agentorg",
3
- "chatgpt": "sha256-e356ea3c1899138a8494baf521556831006f38534fa9e92ae873e7e6956c3a46.agentorg",
4
- "assistant": "sha256-1f64ca62a0209d767d6aa6c4feb50b0653d60f10bebbc301f79bd3a37e0153c1.agentorg",
5
- "board": "sha256-0e91cc3d0e9762b81abc2427b5496b20f383abcd6fb97d928a8d50e956b54d1f.agentorg"
6
- }
@@ -1,17 +0,0 @@
1
- /** What a package's source may total, paths and text: it fits in one frame. */
2
- export declare const MAX_SOURCE: number;
3
- /**
4
- * The source as given, checked before anything is written or queued: its paths (no two the same
5
- * but for case, none both a file and a folder), its size.
6
- */
7
- export declare function checkSource(files: unknown): [string, string][];
8
- /**
9
- * Build a package from its source, given as data, and add it with `add`: the files are written to
10
- * a fresh folder in the home, built as `agentorg build` builds (importing by name only the SDK,
11
- * the interfaces, zod, React, react-dom and the kit, and nothing outside the folder; reading no tsconfig; at most 16
12
- * modules and 16 MiB built), and the folder is gone after, whatever happened. A build that fails
13
- * is `Refused("build")` with the build's message, which names no path outside the package.
14
- */
15
- export declare function buildSource<T>(home: string, entries: [string, string][], sandbox: (paths: string[]) => string[], add: (file: string) => T): Promise<T>;
16
- /** Folders of builds a crash interrupted: removed when the Hub opens. */
17
- export declare function sweepBuilds(home: string): void;