@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,40 @@
1
+ /**
2
+ * The one place a unit's form is read: what its fields come to once filled in, what the unit will
3
+ * then give, and the JSON Schema an agent fills. A form is data; nothing here calls the unit.
4
+ */
5
+ import type { FieldValues, Form, Problem, Unit } from "@agentorg/interfaces";
6
+ import type { z } from "zod";
7
+ type TheForm = z.infer<typeof Form>;
8
+ type Values = z.infer<typeof FieldValues>;
9
+ type TheProblem = z.infer<typeof Problem>;
10
+ type TheUnit = z.infer<typeof Unit>;
11
+ /** What is wrong with a form as written: a unit that has one is refused, whatever is filled in. */
12
+ export declare function formProblems(form: TheForm): string[];
13
+ /**
14
+ * What the unit's logic will read: `values` checked against the form, defaults applied, and a
15
+ * field that isn't shown dropped. Problems name the field. A value for a secret field is one.
16
+ */
17
+ export declare function settle(form: TheForm, values: Values, secrets: string[]): {
18
+ values: Values;
19
+ secrets: string[];
20
+ problems: TheProblem[];
21
+ };
22
+ export interface Worked {
23
+ slots: string[];
24
+ /** Each with its files, or none for a skill the unit names by a field. */
25
+ skills: {
26
+ name: string;
27
+ files?: string[];
28
+ }[];
29
+ }
30
+ /** What a unit gives for these settled values: what it always gives, and what its answers add. */
31
+ export declare function workedOut(unit: TheUnit, values: Values): Worked;
32
+ /**
33
+ * The JSON Schema of a form, for an agent to fill: flat strings, numbers, booleans and enums, as
34
+ * MCP's elicitation allows. A secret is left out: an agent can never supply one. A field that shows
35
+ * only after a choice is optional and says so.
36
+ */
37
+ export declare function schemaOf(form: TheForm): Record<string, unknown>;
38
+ /** The JSON Schema of a form's secrets. A field of type `environment` takes secrets by any name. */
39
+ export declare function secretsSchemaOf(form: TheForm): Record<string, unknown>;
40
+ export {};
@@ -0,0 +1,191 @@
1
+ const fits = (field, value) => field.value === "strings"
2
+ ? Array.isArray(value)
3
+ : typeof value === (field.value === "secret" ? "string" : field.value);
4
+ /** What is wrong with a form as written: a unit that has one is refused, whatever is filled in. */
5
+ export function formProblems(form) {
6
+ const problems = [];
7
+ const ids = new Set();
8
+ for (const field of form) {
9
+ if (ids.has(field.id))
10
+ problems.push(`${field.id} is in the form twice.`);
11
+ ids.add(field.id);
12
+ if (field.value === "secret" && field.default !== undefined)
13
+ problems.push(`${field.id} is a secret, which has no default.`);
14
+ else if (field.default !== undefined && !fits(field, field.default))
15
+ problems.push(`${field.id}'s default isn't a ${field.value}.`);
16
+ if (field.min !== undefined && field.max !== undefined && field.min > field.max)
17
+ problems.push(`${field.id}'s min is above its max.`);
18
+ }
19
+ for (const field of form)
20
+ if (field.visible && !ids.has(field.visible.field))
21
+ problems.push(`${field.id} depends on ${field.visible.field}, which isn't in the form.`);
22
+ return problems;
23
+ }
24
+ /** Which fields are shown, given what was filled in and the defaults. */
25
+ function shownFields(form, values) {
26
+ const byId = new Map(form.map((field) => [field.id, field]));
27
+ const seen = new Map();
28
+ const shown = (id) => {
29
+ const known = seen.get(id);
30
+ if (known !== undefined)
31
+ return known;
32
+ seen.set(id, false); // A field that depends on itself, however far round, isn't shown.
33
+ const field = byId.get(id);
34
+ const { visible } = field;
35
+ let answer = true;
36
+ if (visible) {
37
+ const other = byId.get(visible.field);
38
+ const value = other && shown(other.id) ? (values[other.id] ?? other.default) : undefined;
39
+ answer =
40
+ value !== undefined &&
41
+ (Array.isArray(value)
42
+ ? value.some((one) => visible.in.includes(one))
43
+ : visible.in.some((one) => one === value));
44
+ }
45
+ seen.set(id, answer);
46
+ return answer;
47
+ };
48
+ return new Set(form.filter((field) => shown(field.id)).map((field) => field.id));
49
+ }
50
+ /**
51
+ * What the unit's logic will read: `values` checked against the form, defaults applied, and a
52
+ * field that isn't shown dropped. Problems name the field. A value for a secret field is one.
53
+ */
54
+ export function settle(form, values, secrets) {
55
+ const problems = [];
56
+ // An empty answer is no answer: a default applies, and a required field isn't filled in.
57
+ values = Object.fromEntries(Object.entries(values).filter(([, value]) => value !== ""));
58
+ const shown = shownFields(form, values);
59
+ const settled = {};
60
+ const kept = [];
61
+ for (const id of Object.keys(values))
62
+ if (!form.some((field) => field.id === id))
63
+ problems.push({ field: id, message: `This unit has no field ${id}.` });
64
+ for (const name of secrets)
65
+ if (!form.some((field) => field.id === name && field.value === "secret"))
66
+ problems.push({ message: `${name} isn't a secret of this unit.` });
67
+ for (const field of form) {
68
+ if (field.value === "secret") {
69
+ if (values[field.id] !== undefined)
70
+ problems.push({
71
+ field: field.id,
72
+ message: `${field.title} is a secret: it isn't a value.`,
73
+ });
74
+ if (!shown.has(field.id))
75
+ continue;
76
+ if (secrets.includes(field.id))
77
+ kept.push(field.id);
78
+ else if (field.required)
79
+ problems.push({ field: field.id, message: `${field.title} must be given.` });
80
+ continue;
81
+ }
82
+ if (!shown.has(field.id))
83
+ continue;
84
+ const value = values[field.id] ?? field.default;
85
+ if (value === undefined) {
86
+ if (field.required)
87
+ problems.push({ field: field.id, message: `${field.title} must be filled in.` });
88
+ continue;
89
+ }
90
+ if (!fits(field, value)) {
91
+ problems.push({ field: field.id, message: `${field.title} must be a ${field.value}.` });
92
+ continue;
93
+ }
94
+ if (field.options) {
95
+ const offered = new Set(field.options.map((option) => option.value));
96
+ if (![value].flat().every((one) => offered.has(String(one))))
97
+ problems.push({ field: field.id, message: `${field.title} isn't one of its options.` });
98
+ }
99
+ if (typeof value === "number" &&
100
+ ((field.min !== undefined && value < field.min) ||
101
+ (field.max !== undefined && value > field.max)))
102
+ problems.push({ field: field.id, message: `${field.title} is out of range.` });
103
+ settled[field.id] = value;
104
+ }
105
+ return { values: settled, secrets: kept, problems };
106
+ }
107
+ /** What a unit gives for these settled values: what it always gives, and what its answers add. */
108
+ export function workedOut(unit, values) {
109
+ const adds = [unit.gives];
110
+ for (const field of unit.form) {
111
+ const value = values[field.id];
112
+ if (value === undefined)
113
+ continue;
114
+ if (value === true && field.adds)
115
+ adds.push(field.adds);
116
+ for (const option of field.options ?? [])
117
+ if (option.adds && [value].flat().map(String).includes(option.value))
118
+ adds.push(option.adds);
119
+ }
120
+ const nameOf = (from) => {
121
+ const value = values[from.field];
122
+ return typeof value === "string" ? value : undefined;
123
+ };
124
+ const slots = new Set();
125
+ const skills = new Map();
126
+ for (const add of adds) {
127
+ for (const slot of add.slots) {
128
+ const name = "name" in slot ? slot.name : nameOf(slot);
129
+ if (name)
130
+ slots.add(name);
131
+ }
132
+ for (const skill of add.skills) {
133
+ if ("name" in skill)
134
+ skills.set(skill.name, skill);
135
+ else {
136
+ const name = nameOf(skill);
137
+ if (name)
138
+ skills.set(name, { name });
139
+ }
140
+ }
141
+ }
142
+ return { slots: [...slots], skills: [...skills.values()] };
143
+ }
144
+ /**
145
+ * The JSON Schema of a form, for an agent to fill: flat strings, numbers, booleans and enums, as
146
+ * MCP's elicitation allows. A secret is left out: an agent can never supply one. A field that shows
147
+ * only after a choice is optional and says so.
148
+ */
149
+ export function schemaOf(form) {
150
+ const properties = {};
151
+ const required = [];
152
+ for (const field of form) {
153
+ if (field.value === "secret")
154
+ continue;
155
+ const type = { string: "string", number: "number", boolean: "boolean", strings: "array" }[field.value];
156
+ const notes = [
157
+ field.description,
158
+ ...(field.options ?? []).map((option) => option.description ? `${option.value}: ${option.description}` : undefined),
159
+ field.visible
160
+ ? `Only when ${field.visible.field} is ${field.visible.in.join(" or ")}.`
161
+ : undefined,
162
+ ].filter(Boolean);
163
+ const allowed = field.options?.map((option) => option.value);
164
+ properties[field.id] = {
165
+ type,
166
+ title: field.title,
167
+ ...(notes.length ? { description: notes.join(" ") } : {}),
168
+ ...(field.value === "strings"
169
+ ? { items: { type: "string", ...(allowed ? { enum: allowed } : {}) } }
170
+ : allowed
171
+ ? { enum: allowed }
172
+ : {}),
173
+ ...(field.min === undefined ? {} : { minimum: field.min }),
174
+ ...(field.max === undefined ? {} : { maximum: field.max }),
175
+ ...(field.default === undefined ? {} : { default: field.default }),
176
+ };
177
+ if (field.required && !field.visible && field.default === undefined)
178
+ required.push(field.id);
179
+ }
180
+ return { type: "object", properties, required };
181
+ }
182
+ /** The JSON Schema of a form's secrets. A field of type `environment` takes secrets by any name. */
183
+ export function secretsSchemaOf(form) {
184
+ const secrets = form.filter((field) => field.value === "secret");
185
+ if (secrets.some((field) => field.type === "environment"))
186
+ return { type: "object", additionalProperties: { type: "string" } };
187
+ return {
188
+ type: "object",
189
+ properties: Object.fromEntries(secrets.map((field) => [field.id, { type: "string", title: field.title }])),
190
+ };
191
+ }
@@ -0,0 +1 @@
1
+ export { type Manager, type ManagerOptions, startManager } from "./manager.js";
@@ -0,0 +1 @@
1
+ export { startManager } from "./manager.js";
@@ -0,0 +1,25 @@
1
+ import { type Template } from "@agentorg/interfaces";
2
+ import { type Log } from "@agentorg/sdk";
3
+ import type { z } from "zod";
4
+ export interface ManagerOptions {
5
+ hubUrl: string;
6
+ /** Its own Actor, bound to `hub.actors@1`, `hub.grants@1` and `hub.bindings@1`, which make it a manager. */
7
+ actorId: string;
8
+ credential: string;
9
+ /** A private folder of its own, which holds its records and the skills. */
10
+ dir: string;
11
+ /** Templates the app ships. */
12
+ templates?: z.infer<typeof Template>[];
13
+ log?: Log;
14
+ }
15
+ export interface Manager {
16
+ /** Leave the Hub. What it keeps stays. */
17
+ close(): Promise<void>;
18
+ }
19
+ /**
20
+ * Run management as an Actor exporting `agents@1`, `connections@1`, `skills@1` and, as `settings`,
21
+ * `agent.settings@1`. It keeps only what the Hub can't know. A provider is connected by exposing
22
+ * its export to this Actor: the Hub's slots are the list of them, and what is exposed to an agent
23
+ * is the Hub's bindings. No status is stored, and no secret reaches it to keep.
24
+ */
25
+ export declare function startManager(options: ManagerOptions): Promise<Manager>;