@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,460 @@
1
+ import { z } from "zod";
2
+ /** A unit's id, unique within its provider. */
3
+ export declare const UnitId: z.ZodString;
4
+ /** A field's id: the key of its value. */
5
+ export declare const FieldId: z.ZodString;
6
+ /** What a result is, such as `computer`. Only a unit of the same provider can take one for now. */
7
+ export declare const ResultKind: z.ZodString;
8
+ /** A field's value. */
9
+ export declare const FieldValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>;
10
+ /** What was filled in, by field id. A field with no value isn't here. */
11
+ export declare const FieldValues: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
12
+ /**
13
+ * One field of a unit's form, as data. `type` names a control in the host's catalogue (`text`,
14
+ * `number`, `toggle`, `choice`, `choices`, `directory`, `secret`, `connection`) and is open: a host
15
+ * that doesn't know a type draws the plain control for `value`, the kind of value it holds.
16
+ *
17
+ * `value: "secret"` is what makes a field secret, whatever its type: it has no `default`, is read
18
+ * apart, is never saved in a template and is never read back; management refuses a value for one
19
+ * anywhere but a stack's `secrets`.
20
+ *
21
+ * `visible` shows it only when another field has one of the given values, or, for a field holding
22
+ * a list, includes one. A field that isn't shown has no value. `description` is written once, for a
23
+ * person and an agent alike.
24
+ *
25
+ * `adds`, on a choice's option or on a toggle (when on), is what that adds to what the unit gives.
26
+ * What a unit will give is worked out from this and the values, with no call to its logic. Field ids are unique in a form, and management refuses a form that isn't
27
+ * well made: a default of the wrong kind, a `visible` naming no field.
28
+ */
29
+ export declare const Field: z.ZodObject<{
30
+ id: z.ZodString;
31
+ type: z.ZodString;
32
+ value: z.ZodEnum<{
33
+ boolean: "boolean";
34
+ number: "number";
35
+ secret: "secret";
36
+ string: "string";
37
+ strings: "strings";
38
+ }>;
39
+ title: z.ZodString;
40
+ description: z.ZodOptional<z.ZodString>;
41
+ required: z.ZodOptional<z.ZodLiteral<true>>;
42
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
43
+ authority: z.ZodOptional<z.ZodEnum<{
44
+ contacts: "contacts";
45
+ holds: "holds";
46
+ instructs: "instructs";
47
+ runs: "runs";
48
+ setting: "setting";
49
+ }>>;
50
+ placeholder: z.ZodOptional<z.ZodString>;
51
+ visible: z.ZodOptional<z.ZodObject<{
52
+ field: z.ZodString;
53
+ in: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
54
+ }, z.core.$strip>>;
55
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
+ value: z.ZodString;
57
+ title: z.ZodString;
58
+ description: z.ZodOptional<z.ZodString>;
59
+ adds: z.ZodOptional<z.ZodObject<{
60
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
61
+ name: z.ZodString;
62
+ }, z.core.$strict>, z.ZodObject<{
63
+ field: z.ZodString;
64
+ }, z.core.$strict>]>>;
65
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
66
+ name: z.ZodString;
67
+ files: z.ZodArray<z.ZodString>;
68
+ }, z.core.$strict>, z.ZodObject<{
69
+ field: z.ZodString;
70
+ }, z.core.$strict>]>>;
71
+ }, z.core.$strip>>;
72
+ }, z.core.$strip>>>;
73
+ adds: z.ZodOptional<z.ZodObject<{
74
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
75
+ name: z.ZodString;
76
+ }, z.core.$strict>, z.ZodObject<{
77
+ field: z.ZodString;
78
+ }, z.core.$strict>]>>;
79
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
80
+ name: z.ZodString;
81
+ files: z.ZodArray<z.ZodString>;
82
+ }, z.core.$strict>, z.ZodObject<{
83
+ field: z.ZodString;
84
+ }, z.core.$strict>]>>;
85
+ }, z.core.$strip>>;
86
+ min: z.ZodOptional<z.ZodNumber>;
87
+ max: z.ZodOptional<z.ZodNumber>;
88
+ step: z.ZodOptional<z.ZodNumber>;
89
+ unit: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$strip>;
91
+ export declare const Form: z.ZodArray<z.ZodObject<{
92
+ id: z.ZodString;
93
+ type: z.ZodString;
94
+ value: z.ZodEnum<{
95
+ boolean: "boolean";
96
+ number: "number";
97
+ secret: "secret";
98
+ string: "string";
99
+ strings: "strings";
100
+ }>;
101
+ title: z.ZodString;
102
+ description: z.ZodOptional<z.ZodString>;
103
+ required: z.ZodOptional<z.ZodLiteral<true>>;
104
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
105
+ authority: z.ZodOptional<z.ZodEnum<{
106
+ contacts: "contacts";
107
+ holds: "holds";
108
+ instructs: "instructs";
109
+ runs: "runs";
110
+ setting: "setting";
111
+ }>>;
112
+ placeholder: z.ZodOptional<z.ZodString>;
113
+ visible: z.ZodOptional<z.ZodObject<{
114
+ field: z.ZodString;
115
+ in: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
116
+ }, z.core.$strip>>;
117
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
118
+ value: z.ZodString;
119
+ title: z.ZodString;
120
+ description: z.ZodOptional<z.ZodString>;
121
+ adds: z.ZodOptional<z.ZodObject<{
122
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
123
+ name: z.ZodString;
124
+ }, z.core.$strict>, z.ZodObject<{
125
+ field: z.ZodString;
126
+ }, z.core.$strict>]>>;
127
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
128
+ name: z.ZodString;
129
+ files: z.ZodArray<z.ZodString>;
130
+ }, z.core.$strict>, z.ZodObject<{
131
+ field: z.ZodString;
132
+ }, z.core.$strict>]>>;
133
+ }, z.core.$strip>>;
134
+ }, z.core.$strip>>>;
135
+ adds: z.ZodOptional<z.ZodObject<{
136
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
137
+ name: z.ZodString;
138
+ }, z.core.$strict>, z.ZodObject<{
139
+ field: z.ZodString;
140
+ }, z.core.$strict>]>>;
141
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
142
+ name: z.ZodString;
143
+ files: z.ZodArray<z.ZodString>;
144
+ }, z.core.$strict>, z.ZodObject<{
145
+ field: z.ZodString;
146
+ }, z.core.$strict>]>>;
147
+ }, z.core.$strip>>;
148
+ min: z.ZodOptional<z.ZodNumber>;
149
+ max: z.ZodOptional<z.ZodNumber>;
150
+ step: z.ZodOptional<z.ZodNumber>;
151
+ unit: z.ZodOptional<z.ZodString>;
152
+ }, z.core.$strip>>;
153
+ /**
154
+ * A unit of an agent's stack: its form, what it needs from units above it, and what it gives
155
+ * whatever is filled in; a field's `adds` says what its answer gives on top.
156
+ */
157
+ export declare const Unit: z.ZodObject<{
158
+ id: z.ZodString;
159
+ title: z.ZodString;
160
+ description: z.ZodString;
161
+ form: z.ZodArray<z.ZodObject<{
162
+ id: z.ZodString;
163
+ type: z.ZodString;
164
+ value: z.ZodEnum<{
165
+ boolean: "boolean";
166
+ number: "number";
167
+ secret: "secret";
168
+ string: "string";
169
+ strings: "strings";
170
+ }>;
171
+ title: z.ZodString;
172
+ description: z.ZodOptional<z.ZodString>;
173
+ required: z.ZodOptional<z.ZodLiteral<true>>;
174
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
175
+ authority: z.ZodOptional<z.ZodEnum<{
176
+ contacts: "contacts";
177
+ holds: "holds";
178
+ instructs: "instructs";
179
+ runs: "runs";
180
+ setting: "setting";
181
+ }>>;
182
+ placeholder: z.ZodOptional<z.ZodString>;
183
+ visible: z.ZodOptional<z.ZodObject<{
184
+ field: z.ZodString;
185
+ in: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
186
+ }, z.core.$strip>>;
187
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
188
+ value: z.ZodString;
189
+ title: z.ZodString;
190
+ description: z.ZodOptional<z.ZodString>;
191
+ adds: z.ZodOptional<z.ZodObject<{
192
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
193
+ name: z.ZodString;
194
+ }, z.core.$strict>, z.ZodObject<{
195
+ field: z.ZodString;
196
+ }, z.core.$strict>]>>;
197
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
198
+ name: z.ZodString;
199
+ files: z.ZodArray<z.ZodString>;
200
+ }, z.core.$strict>, z.ZodObject<{
201
+ field: z.ZodString;
202
+ }, z.core.$strict>]>>;
203
+ }, z.core.$strip>>;
204
+ }, z.core.$strip>>>;
205
+ adds: z.ZodOptional<z.ZodObject<{
206
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
207
+ name: z.ZodString;
208
+ }, z.core.$strict>, z.ZodObject<{
209
+ field: z.ZodString;
210
+ }, z.core.$strict>]>>;
211
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
212
+ name: z.ZodString;
213
+ files: z.ZodArray<z.ZodString>;
214
+ }, z.core.$strict>, z.ZodObject<{
215
+ field: z.ZodString;
216
+ }, z.core.$strict>]>>;
217
+ }, z.core.$strip>>;
218
+ min: z.ZodOptional<z.ZodNumber>;
219
+ max: z.ZodOptional<z.ZodNumber>;
220
+ step: z.ZodOptional<z.ZodNumber>;
221
+ unit: z.ZodOptional<z.ZodString>;
222
+ }, z.core.$strip>>;
223
+ needs: z.ZodArray<z.ZodString>;
224
+ gives: z.ZodObject<{
225
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
226
+ name: z.ZodString;
227
+ }, z.core.$strict>, z.ZodObject<{
228
+ field: z.ZodString;
229
+ }, z.core.$strict>]>>;
230
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
231
+ name: z.ZodString;
232
+ files: z.ZodArray<z.ZodString>;
233
+ }, z.core.$strict>, z.ZodObject<{
234
+ field: z.ZodString;
235
+ }, z.core.$strict>]>>;
236
+ results: z.ZodArray<z.ZodString>;
237
+ }, z.core.$strip>;
238
+ }, z.core.$strip>;
239
+ /** A result of an applied unit, for units below it: an opaque handle. */
240
+ export declare const UnitResult: z.ZodObject<{
241
+ kind: z.ZodString;
242
+ handle: z.ZodString;
243
+ }, z.core.$strip>;
244
+ /** A problem with what was filled in: on one field, or, with no `field`, on the whole. */
245
+ export declare const Problem: z.ZodObject<{
246
+ field: z.ZodOptional<z.ZodString>;
247
+ message: z.ZodString;
248
+ }, z.core.$strip>;
249
+ /** Something of an instance that can be watched or operated live, in a protocol the page knows. */
250
+ export declare const LiveSurface: z.ZodObject<{
251
+ surface: z.ZodString;
252
+ protocol: z.ZodString;
253
+ operate: z.ZodBoolean;
254
+ unavailable: z.ZodOptional<z.ZodString>;
255
+ }, z.core.$strip>;
256
+ export declare const LiveMode: z.ZodEnum<{
257
+ operate: "operate";
258
+ watch: "watch";
259
+ }>;
260
+ /** A one-time ticket to open a surface: a socket address that is its own authority, briefly. */
261
+ export declare const LiveTicket: z.ZodObject<{
262
+ url: z.ZodString;
263
+ protocol: z.ZodString;
264
+ expiresAt: z.ZodString;
265
+ }, z.core.$strip>;
266
+ /**
267
+ * `unit.provider@1`: a program that offers units. Running one yields connections and the skills
268
+ * it declared; management exposes them and records the instance, and removes instances last first.
269
+ *
270
+ * Management checks `values` against the form before `check` or `apply` see them: defaults are
271
+ * applied and a field that isn't shown has no value. `secrets` reach `apply` only, once, and are
272
+ * never saved or read back. `status` and `remove` are refused `unknown` for an instance this
273
+ * provider doesn't hold. A unit removes only what it created.
274
+ */
275
+ export declare const unitProvider: import("@agentorg/sdk").RpcInterface<"unit.provider", {
276
+ units: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
277
+ units: z.ZodArray<z.ZodObject<{
278
+ id: z.ZodString;
279
+ title: z.ZodString;
280
+ description: z.ZodString;
281
+ form: z.ZodArray<z.ZodObject<{
282
+ id: z.ZodString;
283
+ type: z.ZodString;
284
+ value: z.ZodEnum<{
285
+ boolean: "boolean";
286
+ number: "number";
287
+ secret: "secret";
288
+ string: "string";
289
+ strings: "strings";
290
+ }>;
291
+ title: z.ZodString;
292
+ description: z.ZodOptional<z.ZodString>;
293
+ required: z.ZodOptional<z.ZodLiteral<true>>;
294
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
295
+ authority: z.ZodOptional<z.ZodEnum<{
296
+ contacts: "contacts";
297
+ holds: "holds";
298
+ instructs: "instructs";
299
+ runs: "runs";
300
+ setting: "setting";
301
+ }>>;
302
+ placeholder: z.ZodOptional<z.ZodString>;
303
+ visible: z.ZodOptional<z.ZodObject<{
304
+ field: z.ZodString;
305
+ in: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
306
+ }, z.core.$strip>>;
307
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
308
+ value: z.ZodString;
309
+ title: z.ZodString;
310
+ description: z.ZodOptional<z.ZodString>;
311
+ adds: z.ZodOptional<z.ZodObject<{
312
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
313
+ name: z.ZodString;
314
+ }, z.core.$strict>, z.ZodObject<{
315
+ field: z.ZodString;
316
+ }, z.core.$strict>]>>;
317
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
318
+ name: z.ZodString;
319
+ files: z.ZodArray<z.ZodString>;
320
+ }, z.core.$strict>, z.ZodObject<{
321
+ field: z.ZodString;
322
+ }, z.core.$strict>]>>;
323
+ }, z.core.$strip>>;
324
+ }, z.core.$strip>>>;
325
+ adds: z.ZodOptional<z.ZodObject<{
326
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
327
+ name: z.ZodString;
328
+ }, z.core.$strict>, z.ZodObject<{
329
+ field: z.ZodString;
330
+ }, z.core.$strict>]>>;
331
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
332
+ name: z.ZodString;
333
+ files: z.ZodArray<z.ZodString>;
334
+ }, z.core.$strict>, z.ZodObject<{
335
+ field: z.ZodString;
336
+ }, z.core.$strict>]>>;
337
+ }, z.core.$strip>>;
338
+ min: z.ZodOptional<z.ZodNumber>;
339
+ max: z.ZodOptional<z.ZodNumber>;
340
+ step: z.ZodOptional<z.ZodNumber>;
341
+ unit: z.ZodOptional<z.ZodString>;
342
+ }, z.core.$strip>>;
343
+ needs: z.ZodArray<z.ZodString>;
344
+ gives: z.ZodObject<{
345
+ slots: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
346
+ name: z.ZodString;
347
+ }, z.core.$strict>, z.ZodObject<{
348
+ field: z.ZodString;
349
+ }, z.core.$strict>]>>;
350
+ skills: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
351
+ name: z.ZodString;
352
+ files: z.ZodArray<z.ZodString>;
353
+ }, z.core.$strict>, z.ZodObject<{
354
+ field: z.ZodString;
355
+ }, z.core.$strict>]>>;
356
+ results: z.ZodArray<z.ZodString>;
357
+ }, z.core.$strip>;
358
+ }, z.core.$strip>>;
359
+ }, z.core.$strip>>;
360
+ /** A file of a skill a unit comes with. Refused `unknown` when there is no such file. */
361
+ skill: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
362
+ unit: z.ZodString;
363
+ name: z.ZodString;
364
+ path: z.ZodString;
365
+ }, z.core.$strip>, z.ZodObject<{
366
+ text: z.ZodString;
367
+ }, z.core.$strip>>;
368
+ /**
369
+ * The unit's own validation of what was filled in. It changes nothing. `secrets` names the
370
+ * secret fields filled in, never their values.
371
+ */
372
+ check: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
373
+ unit: z.ZodString;
374
+ values: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
375
+ secrets: z.ZodArray<z.ZodString>;
376
+ }, z.core.$strip>, z.ZodObject<{
377
+ problems: z.ZodArray<z.ZodObject<{
378
+ field: z.ZodOptional<z.ZodString>;
379
+ message: z.ZodString;
380
+ }, z.core.$strip>>;
381
+ }, z.core.$strip>>;
382
+ /**
383
+ * Run a unit for an agent. `needs` holds the handle of each result it needs, by kind. `name` is
384
+ * for what it makes to show: an Actor's name. Each connection is an Actor exporting `tools@1`
385
+ * as `tools`, for management to expose under `slot`. The slots must be those the description
386
+ * and the values work out to, or management undoes the creation. `agent` is `person` for a
387
+ * connection the person makes for no agent yet.
388
+ */
389
+ apply: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
390
+ unit: z.ZodString;
391
+ values: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
392
+ secrets: z.ZodRecord<z.ZodString, z.ZodString>;
393
+ needs: z.ZodRecord<z.ZodString, z.ZodString>;
394
+ agent: z.ZodString;
395
+ name: z.ZodString;
396
+ agentName: z.ZodOptional<z.ZodString>;
397
+ }, z.core.$strip>, z.ZodObject<{
398
+ instance: z.ZodString;
399
+ connections: z.ZodArray<z.ZodObject<{
400
+ slot: z.ZodString;
401
+ connection: z.ZodString;
402
+ target: z.ZodString;
403
+ }, z.core.$strip>>;
404
+ results: z.ZodArray<z.ZodObject<{
405
+ kind: z.ZodString;
406
+ handle: z.ZodString;
407
+ }, z.core.$strip>>;
408
+ }, z.core.$strip>>;
409
+ /** How the instance stands now, with each of its connections' own. */
410
+ status: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
411
+ instance: z.ZodString;
412
+ }, z.core.$strip>, z.ZodObject<{
413
+ state: z.ZodEnum<{
414
+ connected: "connected";
415
+ connecting: "connecting";
416
+ down: "down";
417
+ }>;
418
+ detail: z.ZodOptional<z.ZodString>;
419
+ connections: z.ZodArray<z.ZodObject<{
420
+ state: z.ZodEnum<{
421
+ connected: "connected";
422
+ connecting: "connecting";
423
+ down: "down";
424
+ }>;
425
+ detail: z.ZodOptional<z.ZodString>;
426
+ tools: z.ZodArray<z.ZodObject<{
427
+ name: z.ZodString;
428
+ description: z.ZodOptional<z.ZodString>;
429
+ }, z.core.$strip>>;
430
+ connection: z.ZodString;
431
+ }, z.core.$strip>>;
432
+ surfaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
433
+ surface: z.ZodString;
434
+ protocol: z.ZodString;
435
+ operate: z.ZodBoolean;
436
+ unavailable: z.ZodOptional<z.ZodString>;
437
+ }, z.core.$strip>>>;
438
+ }, z.core.$strip>>;
439
+ /**
440
+ * A one-time ticket to open one of its surfaces live. Only the person's gateway asks for one,
441
+ * and it dials the url itself: no ticket reaches a page. Refused `unknown` for a surface the
442
+ * instance doesn't have.
443
+ */
444
+ live: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
445
+ instance: z.ZodString;
446
+ surface: z.ZodString;
447
+ mode: z.ZodEnum<{
448
+ operate: "operate";
449
+ watch: "watch";
450
+ }>;
451
+ }, z.core.$strip>, z.ZodObject<{
452
+ url: z.ZodString;
453
+ protocol: z.ZodString;
454
+ expiresAt: z.ZodString;
455
+ }, z.core.$strip>>;
456
+ /** Final: it undoes what this instance made, and nothing the person pointed it at. */
457
+ remove: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
458
+ instance: z.ZodString;
459
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
460
+ }, {}, 1>;
@@ -0,0 +1,204 @@
1
+ import { defineInterface, method } from "@agentorg/sdk";
2
+ import { z } from "zod";
3
+ import { SKILL_FILE_MAX, SkillName, SkillPath } from "./agent-settings.js";
4
+ import { ConnectionSecrets, ConnectionStatus, ConnectionTarget } from "./connection.js";
5
+ import { Id, SlotName } from "./hub.js";
6
+ const Slug = z
7
+ .string()
8
+ .regex(/^[a-z][a-z0-9-]*$/)
9
+ .max(64);
10
+ const Title = z.string().min(1).max(128);
11
+ const Description = z.string().max(2000);
12
+ /** A unit's id, unique within its provider. */
13
+ export const UnitId = Slug;
14
+ /** A field's id: the key of its value. */
15
+ export const FieldId = z
16
+ .string()
17
+ .regex(/^[a-z][A-Za-z0-9_]*$/)
18
+ .max(64);
19
+ /** What a result is, such as `computer`. Only a unit of the same provider can take one for now. */
20
+ export const ResultKind = Slug;
21
+ /** A field's value. */
22
+ export const FieldValue = z.union([
23
+ z.string().max(4096),
24
+ z.number(),
25
+ z.boolean(),
26
+ z.array(z.string().max(4096)).max(256),
27
+ ]);
28
+ /** What was filled in, by field id. A field with no value isn't here. */
29
+ export const FieldValues = z.record(FieldId, FieldValue);
30
+ /** Slots and skills. A slot's or a skill's name is fixed, or, with `field`, that field's value. */
31
+ const Gives = z.object({
32
+ slots: z
33
+ .array(z.union([z.strictObject({ name: SlotName }), z.strictObject({ field: FieldId })]))
34
+ .max(32),
35
+ skills: z
36
+ .array(z.union([
37
+ z.strictObject({ name: SkillName, files: z.array(SkillPath).min(1).max(256) }),
38
+ z.strictObject({ field: FieldId }),
39
+ ]))
40
+ .max(64),
41
+ });
42
+ /**
43
+ * One field of a unit's form, as data. `type` names a control in the host's catalogue (`text`,
44
+ * `number`, `toggle`, `choice`, `choices`, `directory`, `secret`, `connection`) and is open: a host
45
+ * that doesn't know a type draws the plain control for `value`, the kind of value it holds.
46
+ *
47
+ * `value: "secret"` is what makes a field secret, whatever its type: it has no `default`, is read
48
+ * apart, is never saved in a template and is never read back; management refuses a value for one
49
+ * anywhere but a stack's `secrets`.
50
+ *
51
+ * `visible` shows it only when another field has one of the given values, or, for a field holding
52
+ * a list, includes one. A field that isn't shown has no value. `description` is written once, for a
53
+ * person and an agent alike.
54
+ *
55
+ * `adds`, on a choice's option or on a toggle (when on), is what that adds to what the unit gives.
56
+ * What a unit will give is worked out from this and the values, with no call to its logic. Field ids are unique in a form, and management refuses a form that isn't
57
+ * well made: a default of the wrong kind, a `visible` naming no field.
58
+ */
59
+ export const Field = z.object({
60
+ id: FieldId,
61
+ type: Slug,
62
+ value: z.enum(["string", "number", "boolean", "strings", "secret"]),
63
+ title: Title,
64
+ description: Description.optional(),
65
+ required: z.literal(true).optional(),
66
+ default: FieldValue.optional(),
67
+ /**
68
+ * What an agent may do with this field, by what it says. `setting`: how the unit works, within
69
+ * bounds. `holds`: something the person already has. `contacts`: an address to reach. `instructs`:
70
+ * text that will steer an agent. `runs`: a program to start with someone's rights, which an
71
+ * agent may never set. With none, no agent may set it.
72
+ */
73
+ authority: z.enum(["setting", "holds", "contacts", "instructs", "runs"]).optional(),
74
+ /** Greyed text of an empty field, saying what leaving it empty does. `{name}` is the agent's name. */
75
+ placeholder: z.string().max(256).optional(),
76
+ visible: z.object({ field: FieldId, in: z.array(FieldValue).min(1).max(64) }).optional(),
77
+ options: z
78
+ .array(z.object({
79
+ value: z.string().max(256),
80
+ title: Title,
81
+ description: Description.optional(),
82
+ adds: Gives.optional(),
83
+ }))
84
+ .max(256)
85
+ .optional(),
86
+ adds: Gives.optional(),
87
+ min: z.number().optional(),
88
+ max: z.number().optional(),
89
+ step: z.number().optional(),
90
+ unit: z.string().max(32).optional(),
91
+ });
92
+ export const Form = z.array(Field).max(64);
93
+ /**
94
+ * A unit of an agent's stack: its form, what it needs from units above it, and what it gives
95
+ * whatever is filled in; a field's `adds` says what its answer gives on top.
96
+ */
97
+ export const Unit = z.object({
98
+ id: UnitId,
99
+ title: Title,
100
+ description: Description,
101
+ form: Form,
102
+ needs: z.array(ResultKind).max(16),
103
+ gives: Gives.extend({ results: z.array(ResultKind).max(16) }),
104
+ });
105
+ /** A result of an applied unit, for units below it: an opaque handle. */
106
+ export const UnitResult = z.object({ kind: ResultKind, handle: z.string().min(1).max(4096) });
107
+ /** A problem with what was filled in: on one field, or, with no `field`, on the whole. */
108
+ export const Problem = z.object({ field: FieldId.optional(), message: z.string().max(2000) });
109
+ const OnInstance = z.object({ instance: Id });
110
+ /** Something of an instance that can be watched or operated live, in a protocol the page knows. */
111
+ export const LiveSurface = z.object({
112
+ surface: Slug,
113
+ /** The frames it speaks, such as `terminal@1`, `files@1` or `screencast@1`. */
114
+ protocol: z.string().min(1).max(64),
115
+ /** Whether it can be operated, not only watched. */
116
+ operate: z.boolean(),
117
+ /** Why it can't be opened here, if it can't. */
118
+ unavailable: z.string().max(2000).optional(),
119
+ });
120
+ export const LiveMode = z.enum(["watch", "operate"]);
121
+ /** A one-time ticket to open a surface: a socket address that is its own authority, briefly. */
122
+ export const LiveTicket = z.object({
123
+ url: z.string().min(1).max(4096),
124
+ protocol: z.string().min(1).max(64),
125
+ expiresAt: z.string().max(64),
126
+ });
127
+ /**
128
+ * `unit.provider@1`: a program that offers units. Running one yields connections and the skills
129
+ * it declared; management exposes them and records the instance, and removes instances last first.
130
+ *
131
+ * Management checks `values` against the form before `check` or `apply` see them: defaults are
132
+ * applied and a field that isn't shown has no value. `secrets` reach `apply` only, once, and are
133
+ * never saved or read back. `status` and `remove` are refused `unknown` for an instance this
134
+ * provider doesn't hold. A unit removes only what it created.
135
+ */
136
+ export const unitProvider = defineInterface({
137
+ name: "unit.provider",
138
+ major: 1,
139
+ kind: "rpc",
140
+ methods: {
141
+ units: method({ input: z.object({}), output: z.object({ units: z.array(Unit) }) }),
142
+ /** A file of a skill a unit comes with. Refused `unknown` when there is no such file. */
143
+ skill: method({
144
+ input: z.object({ unit: UnitId, name: SkillName, path: SkillPath }),
145
+ output: z.object({ text: z.string().max(SKILL_FILE_MAX) }),
146
+ }),
147
+ /**
148
+ * The unit's own validation of what was filled in. It changes nothing. `secrets` names the
149
+ * secret fields filled in, never their values.
150
+ */
151
+ check: method({
152
+ input: z.object({ unit: UnitId, values: FieldValues, secrets: z.array(FieldId).max(64) }),
153
+ output: z.object({ problems: z.array(Problem).max(64) }),
154
+ }),
155
+ /**
156
+ * Run a unit for an agent. `needs` holds the handle of each result it needs, by kind. `name` is
157
+ * for what it makes to show: an Actor's name. Each connection is an Actor exporting `tools@1`
158
+ * as `tools`, for management to expose under `slot`. The slots must be those the description
159
+ * and the values work out to, or management undoes the creation. `agent` is `person` for a
160
+ * connection the person makes for no agent yet.
161
+ */
162
+ apply: method({
163
+ input: z.object({
164
+ unit: UnitId,
165
+ values: FieldValues,
166
+ secrets: ConnectionSecrets,
167
+ needs: z.record(ResultKind, z.string().min(1).max(4096)),
168
+ agent: Id,
169
+ name: Title,
170
+ /** The name the person gave the agent. None for an agent an agent made, or for no agent. */
171
+ agentName: Title.optional(),
172
+ }),
173
+ output: z.object({
174
+ instance: Id,
175
+ connections: z
176
+ .array(z.object({ slot: SlotName, connection: Id, target: ConnectionTarget }))
177
+ .max(32),
178
+ results: z.array(UnitResult).max(16),
179
+ }),
180
+ }),
181
+ /** How the instance stands now, with each of its connections' own. */
182
+ status: method({
183
+ input: OnInstance,
184
+ output: z.object({
185
+ state: ConnectionStatus.shape.state,
186
+ detail: z.string().max(2000).optional(),
187
+ connections: z.array(ConnectionStatus.extend({ connection: Id })).max(32),
188
+ /** What of it can be opened live now. */
189
+ surfaces: z.array(LiveSurface).max(16).optional(),
190
+ }),
191
+ }),
192
+ /**
193
+ * A one-time ticket to open one of its surfaces live. Only the person's gateway asks for one,
194
+ * and it dials the url itself: no ticket reaches a page. Refused `unknown` for a surface the
195
+ * instance doesn't have.
196
+ */
197
+ live: method({
198
+ input: OnInstance.extend({ surface: Slug, mode: LiveMode }),
199
+ output: LiveTicket,
200
+ }),
201
+ /** Final: it undoes what this instance made, and nothing the person pointed it at. */
202
+ remove: method({ input: OnInstance, output: z.object({}) }),
203
+ },
204
+ });
@@ -0,0 +1,5 @@
1
+ export { MAX_CALLS } from "./loop.js";
2
+ export { createLooper, type Looper, type LooperOut, PLACES, WAITING } from "./looper.js";
3
+ export { Entry, INPUT_BUDGET, textOf } from "./record.js";
4
+ export { capped, MAX_OUTPUT } from "./tools.js";
5
+ export { Item, type Json, type Log, type Model, type Outcome, type OutputItem, Refusal, type Shown, type Status, type Store, type Tool, type ToolSpec, } from "./types.js";
@@ -0,0 +1,5 @@
1
+ export { MAX_CALLS } from "./loop.js";
2
+ export { createLooper, PLACES, WAITING } from "./looper.js";
3
+ export { Entry, INPUT_BUDGET, textOf } from "./record.js";
4
+ export { capped, MAX_OUTPUT } from "./tools.js";
5
+ export { Item, Refusal, } from "./types.js";