@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
@@ -1,59 +0,0 @@
1
- const AGENT_GRANTS = [
2
- { slot: "model", what: "ChatGPT", iface: "llm.session@1", fixed: true },
3
- { slot: "store", what: "its own storage", iface: "kv@1", fixed: true },
4
- { slot: "layout", what: "your home", iface: "layout@1", fixed: false },
5
- { slot: "packages", what: "install packages", iface: "hub.packages@1", fixed: false },
6
- { slot: "actors", what: "create and run Actors", iface: "hub.actors@1", fixed: false },
7
- { slot: "grants", what: "ask for connections", iface: "hub.grants@1", fixed: false },
8
- { slot: "exports", what: "see what's offered", iface: "hub.exports@1", fixed: false },
9
- {
10
- slot: "installer",
11
- what: "install Actors",
12
- iface: "installer@1",
13
- fixed: false,
14
- needs: "actors"
15
- }
16
- ];
17
- const FIRST_RUN = "app/first-run";
18
- const PROVIDERS = {
19
- model: (ids) => ({ provider: ids.chatgpt, export: "model.session" }),
20
- store: () => ({ provider: "storage", export: "kv" }),
21
- layout: () => ({ provider: "person", export: "layout" }),
22
- packages: () => ({ provider: "hub", export: "packages" }),
23
- actors: () => ({ provider: "hub", export: "actors" }),
24
- grants: () => ({ provider: "hub", export: "grants" }),
25
- exports: () => ({ provider: "hub", export: "exports" }),
26
- installer: (ids) => ({ provider: ids.installer, export: "installer.installer" })
27
- };
28
- function agentConnections(ids, off = /* @__PURE__ */ new Set()) {
29
- return Object.fromEntries(
30
- AGENT_GRANTS.filter((grant) => grant.fixed || !off.has(grant.slot)).map((grant) => {
31
- const { provider, export: name } = PROVIDERS[grant.slot](ids);
32
- return [`logic.${grant.slot}`, { actor: provider, export: name }];
33
- })
34
- );
35
- }
36
- async function agentProviders(call) {
37
- const { bindings } = await call("bindings", "list", { actor: "person" });
38
- const of = (slot) => bindings.find((b) => b.consumer === "person" && b.slot === slot)?.provider;
39
- const chatgpt = of("login");
40
- const installer = of("installer");
41
- if (!chatgpt || !installer)
42
- throw new Error("AgentOrg isn't set up yet. Restart it to finish setting up.");
43
- return { chatgpt, installer };
44
- }
45
- async function installAgent(call, agent) {
46
- return await call("installer", "install", {
47
- package: agent.assistant,
48
- name: agent.name,
49
- connections: agentConnections(await agentProviders(call), agent.off),
50
- start: true
51
- });
52
- }
53
- export {
54
- AGENT_GRANTS,
55
- FIRST_RUN,
56
- agentConnections,
57
- agentProviders,
58
- installAgent
59
- };
@@ -1,107 +0,0 @@
1
- /**
2
- * What a new agent gets: the assistant package's slots, each bound at creation (step 5, §4). The
3
- * slots are its `logic` module's; `model` and `store` it always gets, and the person decides the
4
- * rest in New agent's dialog. A grant that `needs` another is off while that one is: installing
5
- * creates and starts Actors.
6
- */
7
- export const AGENT_GRANTS = [
8
- { slot: "model", what: "ChatGPT", iface: "llm.session@1", fixed: true },
9
- { slot: "store", what: "its own storage", iface: "kv@1", fixed: true },
10
- { slot: "layout", what: "your home", iface: "layout@1", fixed: false },
11
- { slot: "packages", what: "install packages", iface: "hub.packages@1", fixed: false },
12
- { slot: "actors", what: "create and run Actors", iface: "hub.actors@1", fixed: false },
13
- { slot: "grants", what: "ask for connections", iface: "hub.grants@1", fixed: false },
14
- { slot: "exports", what: "see what's offered", iface: "hub.exports@1", fixed: false },
15
- {
16
- slot: "installer",
17
- what: "install Actors",
18
- iface: "installer@1",
19
- fixed: false,
20
- needs: "actors",
21
- },
22
- ] as const;
23
-
24
- export type AgentSlot = (typeof AGENT_GRANTS)[number]["slot"];
25
-
26
- /**
27
- * Where the app's first run records what it made, in the person's store: its `assistant` is the
28
- * package New agent installs, by hash, never a package found by its name.
29
- */
30
- export const FIRST_RUN = "app/first-run";
31
-
32
- /**
33
- * The Actors a new agent's slots reach beside the built-ins: the person's own ChatGPT (what its
34
- * `login` is bound to) and installer (what its `installer` is bound to).
35
- */
36
- export interface AgentProviders {
37
- chatgpt: string;
38
- installer: string;
39
- }
40
-
41
- /** Where each slot is served: ChatGPT's session, the installer, the built-ins, the person's layout. */
42
- const PROVIDERS: Record<AgentSlot, (ids: AgentProviders) => { provider: string; export: string }> =
43
- {
44
- model: (ids) => ({ provider: ids.chatgpt, export: "model.session" }),
45
- store: () => ({ provider: "storage", export: "kv" }),
46
- layout: () => ({ provider: "person", export: "layout" }),
47
- packages: () => ({ provider: "hub", export: "packages" }),
48
- actors: () => ({ provider: "hub", export: "actors" }),
49
- grants: () => ({ provider: "hub", export: "grants" }),
50
- exports: () => ({ provider: "hub", export: "exports" }),
51
- installer: (ids) => ({ provider: ids.installer, export: "installer.installer" }),
52
- };
53
-
54
- /**
55
- * A new agent's connections for `installer.install`: every grant but the ones switched off, which
56
- * can't be `model` or `store`.
57
- */
58
- export function agentConnections(
59
- ids: AgentProviders,
60
- off: ReadonlySet<string> = new Set(),
61
- ): Record<string, { actor: string; export: string }> {
62
- return Object.fromEntries(
63
- AGENT_GRANTS.filter((grant) => grant.fixed || !off.has(grant.slot)).map((grant) => {
64
- const { provider, export: name } = PROVIDERS[grant.slot](ids);
65
- return [`logic.${grant.slot}`, { actor: provider, export: name }];
66
- }),
67
- );
68
- }
69
-
70
- type Call = (slot: string, method: string, input: unknown) => Promise<unknown>;
71
-
72
- /**
73
- * The person's ChatGPT and installer: the Actors the person's `login` and `installer` are bound to,
74
- * as the app's first run binds them (never an Actor found by its package's name).
75
- */
76
- export async function agentProviders(call: Call): Promise<AgentProviders> {
77
- const { bindings } = (await call("bindings", "list", { actor: "person" })) as {
78
- bindings: { consumer: string; slot: string; provider: string }[];
79
- };
80
- const of = (slot: string) =>
81
- bindings.find((b) => b.consumer === "person" && b.slot === slot)?.provider;
82
- const chatgpt = of("login");
83
- const installer = of("installer");
84
- // Both are bound by the app's first run at its start; one that didn't finish tries again then.
85
- if (!chatgpt || !installer)
86
- throw new Error("AgentOrg isn't set up yet. Restart it to finish setting up.");
87
- return { chatgpt, installer };
88
- }
89
-
90
- /**
91
- * New agent itself: install the assistant package `assistant` named `name` through the person's
92
- * `installer`, with `agentConnections` to the person's own ChatGPT and installer, and start it, all
93
- * or nothing. `call` is the person's call (the shell's `/api`, or a test's). Returns the installer's
94
- * answer: its id, the slots left unbound (the switched-off ones among them) and the seeds that
95
- * didn't land.
96
- */
97
- export async function installAgent(
98
- call: Call,
99
- agent: { assistant: string; name: string; off?: ReadonlySet<string> },
100
- ): Promise<{ actorId: string; unbound: string[]; unseeded: string[] }> {
101
- return (await call("installer", "install", {
102
- package: agent.assistant,
103
- name: agent.name,
104
- connections: agentConnections(await agentProviders(call), agent.off),
105
- start: true,
106
- })) as { actorId: string; unbound: string[]; unseeded: string[] };
107
- }
@@ -1,23 +0,0 @@
1
- export interface Served {
2
- status: number;
3
- headers: Record<string, string>;
4
- body: string | Uint8Array;
5
- }
6
- /** Where a view module's bundle is: its file, if `module` is a `view` module of that package. */
7
- export type ViewBundle = (hash: string, module: string) => string | undefined;
8
- /**
9
- * A frame's policy, on every `/frames/` response: sandboxed with scripts only, so its origin is
10
- * opaque however it is loaded, and nothing in it can reach the shell origin's storage, where the
11
- * session is. Scripts only from the gateway's `/frames/`, nothing fetched, no forms, no frames
12
- * inside. The origin being opaque, `'self'` would match nothing: the gateway's is named. Styles may
13
- * be inline, as a view sets its own.
14
- */
15
- export declare const frameCsp: (origin: string) => string;
16
- /**
17
- * Serve `/frames/`: the runtime, a view's frame document and its bundle. A frame has an opaque
18
- * origin, so a module script it loads is a CORS request from `Origin: null`: only that one is
19
- * answered `Access-Control-Allow-Origin: null`, and no other origin is allowed to read a script.
20
- * No request here reads or needs the session. A bundle is served only for a `view` module, by
21
- * hash, and never changes. `from` is the request's `Origin` header.
22
- */
23
- export declare function serveFrame(path: string, origin: string, bundle: ViewBundle, from?: string): Served | undefined;
@@ -1,78 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { createRequire } from "node:module";
3
- const HASH = /^sha256-[0-9a-f]{64}$/;
4
- const MODULE = /^[a-z][A-Za-z0-9_]{0,63}$/;
5
- /** The SDK's frame runtime, the one script every frame loads first. */
6
- const runtime = () => readFileSync(createRequire(import.meta.url).resolve("@agentorg/sdk/frame/runtime.js"));
7
- /**
8
- * A frame's policy, on every `/frames/` response: sandboxed with scripts only, so its origin is
9
- * opaque however it is loaded, and nothing in it can reach the shell origin's storage, where the
10
- * session is. Scripts only from the gateway's `/frames/`, nothing fetched, no forms, no frames
11
- * inside. The origin being opaque, `'self'` would match nothing: the gateway's is named. Styles may
12
- * be inline, as a view sets its own.
13
- */
14
- export const frameCsp = (origin) => [
15
- "default-src 'none'",
16
- `script-src ${origin}/frames/`,
17
- "style-src 'unsafe-inline'",
18
- "img-src data: blob:",
19
- "font-src data:",
20
- "connect-src 'none'",
21
- "form-action 'none'",
22
- "base-uri 'none'",
23
- `frame-ancestors ${origin}`,
24
- // However it's loaded, top-level included, its origin is opaque: nothing runs as the shell's.
25
- "sandbox allow-scripts",
26
- ].join("; ");
27
- /**
28
- * The frame document: nothing but the runtime, which waits for the shell's port, and the shell's
29
- * base text, from the theme's tokens once the view is mounted.
30
- */
31
- const DOCUMENT = '<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0}body{font:14px/1.45 var(--font, ui-sans-serif, system-ui, sans-serif);color:var(--fg)}</style><script type="module" src="/frames/runtime.js"></script></head><body></body></html>';
32
- /**
33
- * Serve `/frames/`: the runtime, a view's frame document and its bundle. A frame has an opaque
34
- * origin, so a module script it loads is a CORS request from `Origin: null`: only that one is
35
- * answered `Access-Control-Allow-Origin: null`, and no other origin is allowed to read a script.
36
- * No request here reads or needs the session. A bundle is served only for a `view` module, by
37
- * hash, and never changes. `from` is the request's `Origin` header.
38
- */
39
- export function serveFrame(path, origin, bundle, from) {
40
- const base = {
41
- "Content-Security-Policy": frameCsp(origin),
42
- "X-Content-Type-Options": "nosniff",
43
- "Referrer-Policy": "no-referrer",
44
- };
45
- const script = {
46
- ...base,
47
- "Content-Type": "text/javascript; charset=utf-8",
48
- // A sandboxed frame's own request: nothing else needs to read a script across origins.
49
- ...(from === "null" ? { "Access-Control-Allow-Origin": "null" } : {}),
50
- Vary: "Origin",
51
- };
52
- if (path === "/frames/runtime.js")
53
- return { status: 200, headers: { ...script, "Cache-Control": "no-cache" }, body: runtime() };
54
- const match = /^\/frames\/([^/]+)\/([^/]+)\.(html|js)$/.exec(path);
55
- if (!match)
56
- return undefined;
57
- const [, hash = "", module = "", kind] = match;
58
- if (!HASH.test(hash) || !MODULE.test(module))
59
- return undefined;
60
- const file = bundle(hash, module);
61
- if (!file)
62
- return undefined;
63
- if (kind === "html")
64
- return {
65
- status: 200,
66
- headers: {
67
- ...base,
68
- "Content-Type": "text/html; charset=utf-8",
69
- "Cache-Control": "no-cache",
70
- },
71
- body: DOCUMENT,
72
- };
73
- return {
74
- status: 200,
75
- headers: { ...script, "Cache-Control": "public, max-age=31536000, immutable" },
76
- body: readFileSync(file),
77
- };
78
- }
@@ -1,44 +0,0 @@
1
- import type { Placement } from "@agentorg/interfaces";
2
- import type { z } from "zod";
3
- export type PlacementRecord = z.output<typeof Placement>;
4
- /** Where the layout is kept: the person's `kv@1` slot, under one key. */
5
- export interface LayoutStore {
6
- get(key: string): Promise<{
7
- value?: unknown;
8
- }>;
9
- set(key: string, value: unknown): Promise<unknown>;
10
- }
11
- /** The key the layout is kept under, in the person's store. */
12
- export declare const LAYOUT_KEY = "layout";
13
- /**
14
- * `layout@1`'s logic: what the person has placed, in order, kept in its own store, so it is state
15
- * like any other Actor's. Writes run one at a time; each one tells `changed`. `isView` says whether
16
- * a module is a `view` module of an Actor's package, the only thing `place` accepts.
17
- */
18
- export declare class Layout {
19
- #private;
20
- constructor(options: {
21
- store: () => LayoutStore;
22
- isView(actor: string, module: string): boolean;
23
- changed(): void;
24
- });
25
- get(): Promise<{
26
- home: PlacementRecord[];
27
- }>;
28
- /** Place a view, recording `by`, the Actor that asked, as the call's caller says. */
29
- place(input: {
30
- actor: string;
31
- module: string;
32
- title?: string;
33
- after?: string;
34
- }, by: string): Promise<{
35
- id: string;
36
- }>;
37
- remove(input: {
38
- id: string;
39
- }): Promise<{}>;
40
- move(input: {
41
- id: string;
42
- after?: string;
43
- }): Promise<{}>;
44
- }
@@ -1,90 +0,0 @@
1
- import { randomBytes } from "node:crypto";
2
- import { Refused } from "@agentorg/sdk";
3
- /** The key the layout is kept under, in the person's store. */
4
- export const LAYOUT_KEY = "layout";
5
- /** Placements one layout holds; past it, `place` is refused. */
6
- const MAX_PLACEMENTS = 200;
7
- /**
8
- * `layout@1`'s logic: what the person has placed, in order, kept in its own store, so it is state
9
- * like any other Actor's. Writes run one at a time; each one tells `changed`. `isView` says whether
10
- * a module is a `view` module of an Actor's package, the only thing `place` accepts.
11
- */
12
- export class Layout {
13
- #store;
14
- #isView;
15
- #changed;
16
- #queue = Promise.resolve();
17
- constructor(options) {
18
- this.#store = options.store;
19
- this.#isView = options.isView;
20
- this.#changed = options.changed;
21
- }
22
- async get() {
23
- return { home: await this.#read() };
24
- }
25
- /** Place a view, recording `by`, the Actor that asked, as the call's caller says. */
26
- place(input, by) {
27
- return this.#write((home) => {
28
- if (!this.#isView(input.actor, input.module))
29
- throw new Refused("invalid", `${input.actor}.${input.module} isn't a view module of a running package Actor.`);
30
- if (home.length >= MAX_PLACEMENTS)
31
- throw new Refused("quota", `A layout holds ${MAX_PLACEMENTS} placements at most.`);
32
- const placement = {
33
- id: randomBytes(9).toString("base64url"),
34
- actor: input.actor,
35
- module: input.module,
36
- ...(input.title === undefined ? {} : { title: input.title }),
37
- by,
38
- };
39
- return { home: insert(home, placement, input.after), result: { id: placement.id } };
40
- });
41
- }
42
- remove(input) {
43
- return this.#write((home) => {
44
- at(home, input.id);
45
- return { home: home.filter((placement) => placement.id !== input.id), result: {} };
46
- });
47
- }
48
- move(input) {
49
- return this.#write((home) => {
50
- const placement = at(home, input.id);
51
- if (input.after === input.id)
52
- throw new Refused("invalid", "A placement can't follow itself.");
53
- const rest = home.filter((other) => other.id !== input.id);
54
- // Moved with no `after`, it goes first; placed with none, last.
55
- return { home: insert(rest, placement, input.after ?? null), result: {} };
56
- });
57
- }
58
- async #read() {
59
- const { value } = await this.#store().get(LAYOUT_KEY);
60
- return Array.isArray(value) ? value : [];
61
- }
62
- /** One write at a time: read, change, write back, then tell. */
63
- #write(change) {
64
- const run = this.#queue.then(async () => {
65
- const { home, result } = change(await this.#read());
66
- await this.#store().set(LAYOUT_KEY, home);
67
- this.#changed();
68
- return result;
69
- });
70
- this.#queue = run.catch(() => { });
71
- return run;
72
- }
73
- }
74
- function at(home, id) {
75
- const found = home.find((placement) => placement.id === id);
76
- if (!found)
77
- throw new Refused("unknown", `No placement ${id}.`);
78
- return found;
79
- }
80
- /** `placement` after the one with id `after`: first for `null`, last for `undefined`. */
81
- function insert(home, placement, after) {
82
- if (after === undefined)
83
- return [...home, placement];
84
- if (after === null)
85
- return [placement, ...home];
86
- const index = home.findIndex((other) => other.id === after);
87
- if (index < 0)
88
- throw new Refused("unknown", `No placement ${after}.`);
89
- return [...home.slice(0, index + 1), placement, ...home.slice(index + 1)];
90
- }
@@ -1,54 +0,0 @@
1
- import type { IncomingMessage, ServerResponse } from "node:http";
2
- /**
3
- * How the first run reaches 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
- /** An export of a running Actor. */
10
- export interface Target {
11
- actor: string;
12
- export: string;
13
- }
14
- export interface FirstRunOptions {
15
- /** Where the bundled archives and their `index.json` are; the app's own by default. */
16
- bundled?: string;
17
- /** What the model Actor's `web` connects to: the built-in `net`'s `egress` by default. */
18
- egress?: Target;
19
- /** Where the first run says what it did, and what it couldn't. */
20
- log?: (message: string) => void;
21
- /**
22
- * Whether an Actor's process is connected (the Hub's `connected`): the first run waits for the
23
- * installer's before it installs through it. Without it, it installs at once.
24
- */
25
- connected?: (actorId: string) => boolean;
26
- }
27
- export interface FirstRun {
28
- /** The bundled packages by name, each added. */
29
- packages: Record<string, string>;
30
- /** The installer Actor and the model Actor, when they exist. */
31
- installer?: string;
32
- chatgpt?: string;
33
- }
34
- /**
35
- * The first run, at every start after the person's store is bound: add the bundled packages,
36
- * ensure the installer (made by the person, with its bindings, started), bind the person's
37
- * `installer` to it, ensure the model Actor installed through it (`web` to `egress`, `store` to
38
- * storage's `kv`, started), and bind the person's `login` to the model's. What earlier runs made
39
- * (recorded in the person's store) is kept and brought to this build: an installer or model Actor
40
- * on another package is upgraded in place, with its id, its store and its bindings; so is an agent
41
- * on an assistant build an earlier run bundled (by the hashes recorded, never by a package's
42
- * name). A binding an upgrade drops, its interface having changed, is made again where its ends
43
- * match now. A step that fails is logged and the rest still runs where it can; the next start
44
- * tries again.
45
- */
46
- export declare function firstRun(person: PersonCalls, options?: FirstRunOptions): Promise<FirstRun>;
47
- /**
48
- * `/oauth/chatgpt`: where ChatGPT sends the browser back. It hands the whole callback address to
49
- * the person's `login.complete`, then sends the tab on to `?result=<outcome>`, an address without
50
- * the sign-in's code, so the code stays out of the tab's address and history; that page says how
51
- * it went and links back to the shell. The code is never logged or shown, and no page sends a
52
- * referrer.
53
- */
54
- export declare function oauthRoute(person: PersonCalls): (request: IncomingMessage, response: ServerResponse, url: URL) => void;