@agentorg/cli 0.0.4 → 0.0.6

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 (206) hide show
  1. package/README.md +18 -102
  2. package/dist/node_modules/@agentorg/hub/dist/src/hub-actor.d.ts +2 -7
  3. package/dist/node_modules/@agentorg/hub/dist/src/hub-actor.js +4 -111
  4. package/dist/node_modules/@agentorg/hub/dist/src/index.d.ts +1 -3
  5. package/dist/node_modules/@agentorg/hub/dist/src/index.js +1 -3
  6. package/dist/node_modules/@agentorg/hub/dist/src/router.d.ts +6 -57
  7. package/dist/node_modules/@agentorg/hub/dist/src/router.js +38 -413
  8. package/dist/node_modules/@agentorg/hub/dist/src/state.d.ts +20 -298
  9. package/dist/node_modules/@agentorg/hub/dist/src/state.js +73 -456
  10. package/dist/node_modules/@agentorg/hub/dist/src/validate.d.ts +1 -3
  11. package/dist/node_modules/@agentorg/hub/dist/src/validate.js +3 -15
  12. package/dist/node_modules/@agentorg/hub/package.json +0 -3
  13. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.d.ts +132 -0
  14. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.js +105 -0
  15. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-settings.d.ts +42 -0
  16. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-settings.js +53 -0
  17. package/dist/node_modules/@agentorg/interfaces/dist/src/chat.d.ts +15 -0
  18. package/dist/node_modules/@agentorg/interfaces/dist/src/chat.js +14 -0
  19. package/dist/node_modules/@agentorg/interfaces/dist/src/hub.d.ts +16 -267
  20. package/dist/node_modules/@agentorg/interfaces/dist/src/hub.js +17 -145
  21. package/dist/node_modules/@agentorg/interfaces/dist/src/index.d.ts +6 -8
  22. package/dist/node_modules/@agentorg/interfaces/dist/src/index.js +6 -8
  23. package/dist/node_modules/@agentorg/interfaces/dist/src/kv.d.ts +2 -2
  24. package/dist/node_modules/@agentorg/interfaces/dist/src/kv.js +2 -2
  25. package/dist/node_modules/@agentorg/interfaces/dist/src/manager.d.ts +272 -0
  26. package/dist/node_modules/@agentorg/interfaces/dist/src/manager.js +185 -0
  27. package/dist/node_modules/@agentorg/interfaces/dist/src/mcp-provider.d.ts +88 -0
  28. package/dist/node_modules/@agentorg/interfaces/dist/src/mcp-provider.js +78 -0
  29. package/dist/node_modules/@agentorg/interfaces/dist/src/tools.d.ts +39 -0
  30. package/dist/node_modules/@agentorg/interfaces/dist/src/tools.js +43 -0
  31. package/dist/node_modules/@agentorg/manager/dist/src/index.d.ts +1 -0
  32. package/dist/node_modules/@agentorg/manager/dist/src/index.js +1 -0
  33. package/dist/node_modules/@agentorg/manager/dist/src/manager.d.ts +21 -0
  34. package/dist/node_modules/@agentorg/manager/dist/src/manager.js +528 -0
  35. package/dist/node_modules/@agentorg/manager/dist/src/skills.d.ts +25 -0
  36. package/dist/node_modules/@agentorg/manager/dist/src/skills.js +145 -0
  37. package/dist/node_modules/@agentorg/manager/package.json +30 -0
  38. package/dist/node_modules/@agentorg/mcp/dist/src/connection.d.ts +33 -0
  39. package/dist/node_modules/@agentorg/mcp/dist/src/connection.js +290 -0
  40. package/dist/node_modules/@agentorg/mcp/dist/src/index.d.ts +1 -0
  41. package/dist/node_modules/@agentorg/mcp/dist/src/index.js +1 -0
  42. package/dist/node_modules/@agentorg/mcp/dist/src/kinds.d.ts +50 -0
  43. package/dist/node_modules/@agentorg/mcp/dist/src/kinds.js +69 -0
  44. package/dist/node_modules/@agentorg/mcp/dist/src/provider.d.ts +22 -0
  45. package/dist/node_modules/@agentorg/mcp/dist/src/provider.js +167 -0
  46. package/dist/node_modules/@agentorg/mcp/package.json +31 -0
  47. package/dist/node_modules/@agentorg/sdk/dist/src/cli.js +3 -23
  48. package/dist/node_modules/@agentorg/sdk/dist/src/client.d.ts +4 -25
  49. package/dist/node_modules/@agentorg/sdk/dist/src/client.js +5 -55
  50. package/dist/node_modules/@agentorg/sdk/dist/src/errors.d.ts +1 -1
  51. package/dist/node_modules/@agentorg/sdk/dist/src/errors.js +3 -3
  52. package/dist/node_modules/@agentorg/sdk/dist/src/index.d.ts +2 -2
  53. package/dist/node_modules/@agentorg/sdk/dist/src/index.js +1 -1
  54. package/dist/node_modules/@agentorg/sdk/dist/src/interface.d.ts +6 -34
  55. package/dist/node_modules/@agentorg/sdk/dist/src/interface.js +3 -24
  56. package/dist/node_modules/@agentorg/sdk/dist/src/module-host.d.ts +8 -17
  57. package/dist/node_modules/@agentorg/sdk/dist/src/module-host.js +15 -87
  58. package/dist/node_modules/@agentorg/sdk/dist/src/module.d.ts +10 -76
  59. package/dist/node_modules/@agentorg/sdk/dist/src/module.js +3 -23
  60. package/dist/node_modules/@agentorg/sdk/dist/src/person-commands.js +0 -5
  61. package/dist/node_modules/@agentorg/sdk/dist/src/runtime.d.ts +3 -27
  62. package/dist/node_modules/@agentorg/sdk/dist/src/runtime.js +5 -100
  63. package/dist/node_modules/@agentorg/sdk/dist/src/testing.d.ts +7 -8
  64. package/dist/node_modules/@agentorg/sdk/dist/src/testing.js +12 -24
  65. package/dist/node_modules/@agentorg/sdk/package.json +4 -37
  66. package/dist/node_modules/@agentorg/shell/dist/app.css +3435 -739
  67. package/dist/node_modules/@agentorg/shell/dist/app.js +204 -202
  68. package/dist/node_modules/@agentorg/shell/package.json +18 -10
  69. package/dist/node_modules/@agentorg/wire/dist/src/frames.d.ts +2 -3
  70. package/dist/node_modules/@agentorg/wire/dist/src/frames.js +2 -3
  71. package/dist/node_modules/@agentorg/wire/dist/src/ops.d.ts +5 -34
  72. package/dist/node_modules/@agentorg/wire/dist/src/ops.js +2 -17
  73. package/dist/node_modules/assistant/dist/src/agent.d.ts +62 -0
  74. package/dist/node_modules/assistant/dist/src/agent.js +226 -0
  75. package/dist/node_modules/assistant/dist/src/engine.d.ts +23 -0
  76. package/dist/node_modules/assistant/dist/src/engine.js +88 -0
  77. package/dist/node_modules/assistant/dist/src/history.d.ts +97 -0
  78. package/dist/node_modules/assistant/dist/src/history.js +235 -0
  79. package/dist/node_modules/assistant/dist/src/local-store.d.ts +3 -0
  80. package/dist/node_modules/assistant/dist/src/local-store.js +58 -0
  81. package/dist/node_modules/assistant/dist/src/provider.d.ts +21 -0
  82. package/dist/node_modules/assistant/dist/src/provider.js +231 -0
  83. package/dist/node_modules/assistant/dist/src/settings.d.ts +17 -0
  84. package/dist/node_modules/assistant/dist/src/settings.js +43 -0
  85. package/dist/node_modules/assistant/dist/src/tools.d.ts +74 -0
  86. package/dist/node_modules/assistant/dist/src/tools.js +123 -0
  87. package/dist/node_modules/assistant/package.json +29 -0
  88. package/dist/node_modules/chatgpt/dist/src/account.d.ts +52 -0
  89. package/dist/node_modules/chatgpt/dist/src/account.js +270 -0
  90. package/dist/node_modules/chatgpt/dist/src/encoding.d.ts +7 -0
  91. package/dist/node_modules/chatgpt/dist/src/encoding.js +20 -0
  92. package/dist/node_modules/chatgpt/dist/src/file-store.d.ts +9 -0
  93. package/dist/node_modules/chatgpt/dist/src/file-store.js +68 -0
  94. package/dist/node_modules/chatgpt/dist/src/index.d.ts +1 -0
  95. package/dist/node_modules/chatgpt/dist/src/index.js +1 -0
  96. package/dist/node_modules/chatgpt/dist/src/jwt.d.ts +15 -0
  97. package/dist/node_modules/chatgpt/dist/src/jwt.js +37 -0
  98. package/dist/node_modules/chatgpt/dist/src/oauth.d.ts +43 -0
  99. package/dist/node_modules/chatgpt/dist/src/oauth.js +104 -0
  100. package/dist/node_modules/chatgpt/dist/src/program.d.ts +23 -0
  101. package/dist/node_modules/chatgpt/dist/src/program.js +41 -0
  102. package/dist/node_modules/chatgpt/dist/src/responses.d.ts +54 -0
  103. package/dist/node_modules/chatgpt/dist/src/responses.js +300 -0
  104. package/dist/node_modules/chatgpt/dist/src/serve.d.ts +65 -0
  105. package/dist/node_modules/chatgpt/dist/src/serve.js +46 -0
  106. package/dist/node_modules/chatgpt/package.json +33 -0
  107. package/dist/src/api.d.ts +5 -34
  108. package/dist/src/api.js +6 -68
  109. package/dist/src/cli.js +3 -7
  110. package/dist/src/gateway.d.ts +6 -7
  111. package/dist/src/gateway.js +39 -285
  112. package/dist/src/index.d.ts +4 -5
  113. package/dist/src/index.js +3 -4
  114. package/dist/src/notes.d.ts +11 -0
  115. package/dist/src/notes.js +64 -0
  116. package/dist/src/oauth.d.ts +16 -0
  117. package/dist/src/oauth.js +46 -0
  118. package/dist/src/programs.d.ts +29 -0
  119. package/dist/src/programs.js +171 -0
  120. package/package.json +3 -11
  121. package/dist/bundled/index.json +0 -6
  122. package/dist/bundled/sha256-01d69bc3888c2a53963f4413d47de909d129ad27c78e9af6d830bb50c3478419.agentorg +0 -0
  123. package/dist/bundled/sha256-84165e3be5c904fc971d983dab31102e07cca725d8629a6fd7d118fa3a0a88b8.agentorg +0 -0
  124. package/dist/bundled/sha256-ade9132b3f34b4c39db92adeadc7e540dc745e4a81b5b54f5d45bf9ec92bca75.agentorg +0 -0
  125. package/dist/bundled/sha256-f4330f5987f37d8cf3aeb44d2f831b573641a87186daa2f811f0c35ba04804f0.agentorg +0 -0
  126. package/dist/node_modules/@agentorg/hub/dist/src/build.d.ts +0 -17
  127. package/dist/node_modules/@agentorg/hub/dist/src/build.js +0 -120
  128. package/dist/node_modules/@agentorg/hub/dist/src/logs.d.ts +0 -33
  129. package/dist/node_modules/@agentorg/hub/dist/src/logs.js +0 -162
  130. package/dist/node_modules/@agentorg/hub/dist/src/net.d.ts +0 -41
  131. package/dist/node_modules/@agentorg/hub/dist/src/net.js +0 -265
  132. package/dist/node_modules/@agentorg/hub/dist/src/processes.d.ts +0 -78
  133. package/dist/node_modules/@agentorg/hub/dist/src/processes.js +0 -485
  134. package/dist/node_modules/@agentorg/hub/dist/src/storage.d.ts +0 -38
  135. package/dist/node_modules/@agentorg/hub/dist/src/storage.js +0 -194
  136. package/dist/node_modules/@agentorg/interfaces/dist/src/http-egress.d.ts +0 -6
  137. package/dist/node_modules/@agentorg/interfaces/dist/src/http-egress.js +0 -7
  138. package/dist/node_modules/@agentorg/interfaces/dist/src/installer.d.ts +0 -191
  139. package/dist/node_modules/@agentorg/interfaces/dist/src/installer.js +0 -136
  140. package/dist/node_modules/@agentorg/interfaces/dist/src/layout.d.ts +0 -47
  141. package/dist/node_modules/@agentorg/interfaces/dist/src/layout.js +0 -52
  142. package/dist/node_modules/@agentorg/interfaces/dist/src/rules.d.ts +0 -35
  143. package/dist/node_modules/@agentorg/interfaces/dist/src/rules.js +0 -37
  144. package/dist/node_modules/@agentorg/interfaces/dist/src/storage-admin.d.ts +0 -23
  145. package/dist/node_modules/@agentorg/interfaces/dist/src/storage-admin.js +0 -31
  146. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-shell.d.ts +0 -14
  147. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-shell.js +0 -26
  148. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-view.d.ts +0 -27
  149. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-view.js +0 -26
  150. package/dist/node_modules/@agentorg/kit/dist/src/chat.d.ts +0 -37
  151. package/dist/node_modules/@agentorg/kit/dist/src/chat.js +0 -131
  152. package/dist/node_modules/@agentorg/kit/dist/src/components.d.ts +0 -94
  153. package/dist/node_modules/@agentorg/kit/dist/src/components.js +0 -66
  154. package/dist/node_modules/@agentorg/kit/dist/src/icons.d.ts +0 -17
  155. package/dist/node_modules/@agentorg/kit/dist/src/icons.js +0 -30
  156. package/dist/node_modules/@agentorg/kit/dist/src/index.d.ts +0 -6
  157. package/dist/node_modules/@agentorg/kit/dist/src/index.js +0 -10
  158. package/dist/node_modules/@agentorg/kit/dist/src/markdown.d.ts +0 -9
  159. package/dist/node_modules/@agentorg/kit/dist/src/markdown.js +0 -14
  160. package/dist/node_modules/@agentorg/kit/dist/src/resizable.d.ts +0 -5
  161. package/dist/node_modules/@agentorg/kit/dist/src/resizable.js +0 -8
  162. package/dist/node_modules/@agentorg/kit/dist/src/styles.d.ts +0 -11
  163. package/dist/node_modules/@agentorg/kit/dist/src/styles.js +0 -166
  164. package/dist/node_modules/@agentorg/kit/package.json +0 -44
  165. package/dist/node_modules/@agentorg/sdk/dist/frame/runtime.js +0 -753
  166. package/dist/node_modules/@agentorg/sdk/dist/host/runner.js +0 -21963
  167. package/dist/node_modules/@agentorg/sdk/dist/src/build.d.ts +0 -2
  168. package/dist/node_modules/@agentorg/sdk/dist/src/build.js +0 -2
  169. package/dist/node_modules/@agentorg/sdk/dist/src/client-http.d.ts +0 -24
  170. package/dist/node_modules/@agentorg/sdk/dist/src/client-http.js +0 -247
  171. package/dist/node_modules/@agentorg/sdk/dist/src/describe.d.ts +0 -13
  172. package/dist/node_modules/@agentorg/sdk/dist/src/describe.js +0 -16
  173. package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.d.ts +0 -8
  174. package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.js +0 -64
  175. package/dist/node_modules/@agentorg/sdk/dist/src/frame-entry.d.ts +0 -1
  176. package/dist/node_modules/@agentorg/sdk/dist/src/frame-entry.js +0 -35
  177. package/dist/node_modules/@agentorg/sdk/dist/src/frame-host.d.ts +0 -57
  178. package/dist/node_modules/@agentorg/sdk/dist/src/frame-host.js +0 -293
  179. package/dist/node_modules/@agentorg/sdk/dist/src/frame-protocol.d.ts +0 -124
  180. package/dist/node_modules/@agentorg/sdk/dist/src/frame-protocol.js +0 -16
  181. package/dist/node_modules/@agentorg/sdk/dist/src/frame.d.ts +0 -25
  182. package/dist/node_modules/@agentorg/sdk/dist/src/frame.js +0 -248
  183. package/dist/node_modules/@agentorg/sdk/dist/src/host-main.d.ts +0 -1
  184. package/dist/node_modules/@agentorg/sdk/dist/src/host-main.js +0 -60
  185. package/dist/node_modules/@agentorg/sdk/dist/src/host.d.ts +0 -25
  186. package/dist/node_modules/@agentorg/sdk/dist/src/host.js +0 -92
  187. package/dist/node_modules/@agentorg/sdk/dist/src/manifest-api.d.ts +0 -2
  188. package/dist/node_modules/@agentorg/sdk/dist/src/manifest-api.js +0 -2
  189. package/dist/node_modules/@agentorg/sdk/dist/src/manifest.d.ts +0 -56
  190. package/dist/node_modules/@agentorg/sdk/dist/src/manifest.js +0 -165
  191. package/dist/node_modules/@agentorg/sdk/dist/src/package.d.ts +0 -60
  192. package/dist/node_modules/@agentorg/sdk/dist/src/package.js +0 -538
  193. package/dist/node_modules/@agentorg/sdk/dist/src/tar.d.ts +0 -7
  194. package/dist/node_modules/@agentorg/sdk/dist/src/tar.js +0 -71
  195. package/dist/node_modules/@agentorg/shell/dist/agent-bindings.js +0 -59
  196. package/dist/node_modules/@agentorg/shell/src/agent-bindings.ts +0 -107
  197. package/dist/src/frames.d.ts +0 -23
  198. package/dist/src/frames.js +0 -78
  199. package/dist/src/layout.d.ts +0 -44
  200. package/dist/src/layout.js +0 -90
  201. package/dist/src/model.d.ts +0 -51
  202. package/dist/src/model.js +0 -230
  203. package/dist/src/rules.d.ts +0 -71
  204. package/dist/src/rules.js +0 -157
  205. package/dist/src/transfer.d.ts +0 -30
  206. package/dist/src/transfer.js +0 -110
@@ -1,12 +1,10 @@
1
1
  export { Account, accountLogin, LoginState } from "./account-login.js";
2
+ export { AgentStatus, Answers, agentProvider, Creatable, CreatableId, } from "./agent-provider.js";
3
+ export { agentSettings, SKILL_FILE_MAX, SkillEntry, SkillName, SkillPath, } from "./agent-settings.js";
2
4
  export { ChatMessage, ChatState, ChatStatus, ChatTool, chat } from "./chat.js";
3
- export { httpEgress } from "./http-egress.js";
4
- export { Actor, ActorState, AuditEntry, Binding, BindingRequest, ExportEntry, hubActors, hubAudit, hubBindings, hubExports, hubGrants, hubPackages, LogLine, Package, } from "./hub.js";
5
- export { Composition, installer } from "./installer.js";
5
+ export { Actor, ActorState, AuditEntry, Binding, ExportEntry, hubActors, hubAudit, hubBindings, hubExports, hubGrants, } from "./hub.js";
6
6
  export { kv } from "./kv.js";
7
- export { layout, Placement } from "./layout.js";
8
7
  export { Item, llmSession, OutputItem, Tool } from "./llm-session.js";
9
- export { appRules, Rule } from "./rules.js";
10
- export { storageAdmin } from "./storage-admin.js";
11
- export { uiShell } from "./ui-shell.js";
12
- export { uiView } from "./ui-view.js";
8
+ export { agents, ConnectionOrigin, connections, skills } from "./manager.js";
9
+ export { ConnectionKind, ConnectionParams, ConnectionSecrets, ConnectionState, ConnectionStatus, ConnectionTarget, ConnectionTool, mcpProvider, } from "./mcp-provider.js";
10
+ export { ToolEntry, tools } from "./tools.js";
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  /**
3
- * `kv@1`: a key-value store of JSON values, the state slot a host module uses. A storage provider
4
- * keeps one store per consumer slot, so the store is the slot's own; `list` pages through its keys.
3
+ * `kv@1`: a key-value store of JSON values, the shape of the engine's and the app's local stores;
4
+ * `list` pages through its keys.
5
5
  */
6
6
  export declare const kv: import("@agentorg/sdk").RpcInterface<"kv", {
7
7
  /** The value under `key`; `value` is absent when there is none, and a stored `null` is `null`. */
@@ -2,8 +2,8 @@ import { defineInterface, method } from "@agentorg/sdk";
2
2
  import { z } from "zod";
3
3
  const Key = z.string().min(1).max(1024);
4
4
  /**
5
- * `kv@1`: a key-value store of JSON values, the state slot a host module uses. A storage provider
6
- * keeps one store per consumer slot, so the store is the slot's own; `list` pages through its keys.
5
+ * `kv@1`: a key-value store of JSON values, the shape of the engine's and the app's local stores;
6
+ * `list` pages through its keys.
7
7
  */
8
8
  export const kv = defineInterface({
9
9
  name: "kv",
@@ -0,0 +1,272 @@
1
+ import { z } from "zod";
2
+ /** Where a connection came from, written once when it was made. */
3
+ export declare const ConnectionOrigin: z.ZodObject<{
4
+ provider: z.ZodString;
5
+ kind: z.ZodString;
6
+ target: z.ZodString;
7
+ madeBy: z.ZodString;
8
+ madeFor: z.ZodOptional<z.ZodString>;
9
+ at: z.ZodString;
10
+ }, z.core.$strip>;
11
+ /**
12
+ * `agents@1`: the agents the person has, each made from a creatable a connected agent provider
13
+ * offers. What each agent is doing is read from the agent's own `chat@1`.
14
+ */
15
+ export declare const agents: import("@agentorg/sdk").RpcInterface<"agents", {
16
+ /** What every connected agent provider offers. */
17
+ creatable: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
18
+ creatables: z.ZodArray<z.ZodObject<{
19
+ id: z.ZodString;
20
+ title: z.ZodString;
21
+ description: z.ZodString;
22
+ instructions: z.ZodString;
23
+ asks: z.ZodArray<z.ZodObject<{
24
+ id: z.ZodString;
25
+ title: z.ZodString;
26
+ description: z.ZodOptional<z.ZodString>;
27
+ optional: z.ZodOptional<z.ZodLiteral<true>>;
28
+ }, z.core.$strip>>;
29
+ skills: z.ZodArray<z.ZodObject<{
30
+ name: z.ZodString;
31
+ files: z.ZodArray<z.ZodString>;
32
+ }, z.core.$strip>>;
33
+ mcp: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
34
+ how: z.ZodLiteral<"pick">;
35
+ slot: z.ZodString;
36
+ title: z.ZodString;
37
+ }, z.core.$strip>, z.ZodObject<{
38
+ how: z.ZodLiteral<"create">;
39
+ slot: z.ZodString;
40
+ title: z.ZodString;
41
+ kind: z.ZodString;
42
+ params: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
43
+ fromAnswers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
44
+ }, z.core.$strip>], "how">>;
45
+ provider: z.ZodString;
46
+ }, z.core.$strip>>;
47
+ }, z.core.$strip>>;
48
+ /** The agent providers connected now. */
49
+ providers: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
50
+ providers: z.ZodArray<z.ZodObject<{
51
+ provider: z.ZodString;
52
+ name: z.ZodString;
53
+ }, z.core.$strip>>;
54
+ }, z.core.$strip>>;
55
+ /**
56
+ * Make an agent of a creatable, with what it asks and a connection for each of its `pick`
57
+ * needs, by slot. All or none: if any step fails, what this creation made is removed. A skill
58
+ * it comes with whose name is already here keeps the one here.
59
+ */
60
+ create: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
61
+ provider: z.ZodString;
62
+ creatable: z.ZodString;
63
+ name: z.ZodString;
64
+ answers: z.ZodRecord<z.ZodString, z.ZodString>;
65
+ connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ agent: z.ZodString;
68
+ }, z.core.$strip>>;
69
+ list: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
70
+ agents: z.ZodArray<z.ZodObject<{
71
+ agent: z.ZodString;
72
+ name: z.ZodString;
73
+ status: z.ZodObject<{
74
+ state: z.ZodEnum<{
75
+ down: "down";
76
+ running: "running";
77
+ starting: "starting";
78
+ stopped: "stopped";
79
+ }>;
80
+ detail: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$strip>;
82
+ provider: z.ZodString;
83
+ creatable: z.ZodString;
84
+ }, z.core.$strip>>;
85
+ }, z.core.$strip>>;
86
+ /** What the agent is made of, in one read. */
87
+ get: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
88
+ agent: z.ZodString;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ agent: z.ZodString;
91
+ name: z.ZodString;
92
+ status: z.ZodObject<{
93
+ state: z.ZodEnum<{
94
+ down: "down";
95
+ running: "running";
96
+ starting: "starting";
97
+ stopped: "stopped";
98
+ }>;
99
+ detail: z.ZodOptional<z.ZodString>;
100
+ }, z.core.$strip>;
101
+ provider: z.ZodString;
102
+ creatable: z.ZodString;
103
+ instructions: z.ZodString;
104
+ skills: z.ZodArray<z.ZodObject<{
105
+ name: z.ZodString;
106
+ description: z.ZodString;
107
+ }, z.core.$strip>>;
108
+ mcp: z.ZodArray<z.ZodObject<{
109
+ slot: z.ZodString;
110
+ connection: z.ZodString;
111
+ origin: z.ZodOptional<z.ZodObject<{
112
+ provider: z.ZodString;
113
+ kind: z.ZodString;
114
+ target: z.ZodString;
115
+ madeBy: z.ZodString;
116
+ madeFor: z.ZodOptional<z.ZodString>;
117
+ at: z.ZodString;
118
+ }, z.core.$strip>>;
119
+ status: z.ZodObject<{
120
+ state: z.ZodEnum<{
121
+ connected: "connected";
122
+ connecting: "connecting";
123
+ down: "down";
124
+ }>;
125
+ detail: z.ZodOptional<z.ZodString>;
126
+ tools: z.ZodArray<z.ZodObject<{
127
+ name: z.ZodString;
128
+ description: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strip>>;
130
+ }, z.core.$strip>;
131
+ }, z.core.$strip>>;
132
+ }, z.core.$strip>>;
133
+ start: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
134
+ agent: z.ZodString;
135
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
136
+ /** Ends the agent's process, and a turn in progress with it; all else about it stays. */
137
+ stop: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
138
+ agent: z.ZodString;
139
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
140
+ /** Expose a skill or a connection to the agent; `as` names a connection's slot. */
141
+ expose: import("@agentorg/sdk").MethodSpec<z.ZodUnion<readonly [z.ZodObject<{
142
+ agent: z.ZodString;
143
+ skill: z.ZodString;
144
+ }, z.core.$strict>, z.ZodObject<{
145
+ agent: z.ZodString;
146
+ connection: z.ZodString;
147
+ as: z.ZodOptional<z.ZodString>;
148
+ }, z.core.$strict>]>, z.ZodObject<{
149
+ slot: z.ZodOptional<z.ZodString>;
150
+ }, z.core.$strip>>;
151
+ unexpose: import("@agentorg/sdk").MethodSpec<z.ZodUnion<readonly [z.ZodObject<{
152
+ agent: z.ZodString;
153
+ skill: z.ZodString;
154
+ }, z.core.$strict>, z.ZodObject<{
155
+ agent: z.ZodString;
156
+ slot: z.ZodString;
157
+ }, z.core.$strict>]>, z.ZodObject<{}, z.core.$strip>>;
158
+ /** Final: removes the agent and the connections made for it. */
159
+ remove: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
160
+ agent: z.ZodString;
161
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
162
+ }, {}, 1>;
163
+ /** `connections@1`: the person's connections to MCP servers, through the connected providers. */
164
+ export declare const connections: import("@agentorg/sdk").RpcInterface<"connections", {
165
+ /** The MCP providers connected now, each with the kinds it offers. */
166
+ providers: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
167
+ providers: z.ZodArray<z.ZodObject<{
168
+ provider: z.ZodString;
169
+ name: z.ZodString;
170
+ kinds: z.ZodArray<z.ZodObject<{
171
+ kind: z.ZodString;
172
+ title: z.ZodString;
173
+ params: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
174
+ secrets: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
175
+ }, z.core.$strip>>;
176
+ }, z.core.$strip>>;
177
+ }, z.core.$strip>>;
178
+ /** `secrets` go to the provider and nowhere else: they are never read back. */
179
+ create: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
180
+ provider: z.ZodString;
181
+ kind: z.ZodString;
182
+ params: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
183
+ secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
184
+ name: z.ZodString;
185
+ }, z.core.$strip>, z.ZodObject<{
186
+ connection: z.ZodString;
187
+ }, z.core.$strip>>;
188
+ list: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
189
+ connections: z.ZodArray<z.ZodObject<{
190
+ connection: z.ZodString;
191
+ name: z.ZodString;
192
+ state: z.ZodEnum<{
193
+ connected: "connected";
194
+ connecting: "connecting";
195
+ down: "down";
196
+ }>;
197
+ origin: z.ZodOptional<z.ZodObject<{
198
+ provider: z.ZodString;
199
+ kind: z.ZodString;
200
+ target: z.ZodString;
201
+ madeBy: z.ZodString;
202
+ madeFor: z.ZodOptional<z.ZodString>;
203
+ at: z.ZodString;
204
+ }, z.core.$strip>>;
205
+ }, z.core.$strip>>;
206
+ }, z.core.$strip>>;
207
+ get: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
208
+ connection: z.ZodString;
209
+ }, z.core.$strip>, z.ZodObject<{
210
+ connection: z.ZodString;
211
+ name: z.ZodString;
212
+ origin: z.ZodOptional<z.ZodObject<{
213
+ provider: z.ZodString;
214
+ kind: z.ZodString;
215
+ target: z.ZodString;
216
+ madeBy: z.ZodString;
217
+ madeFor: z.ZodOptional<z.ZodString>;
218
+ at: z.ZodString;
219
+ }, z.core.$strip>>;
220
+ status: z.ZodObject<{
221
+ state: z.ZodEnum<{
222
+ connected: "connected";
223
+ connecting: "connecting";
224
+ down: "down";
225
+ }>;
226
+ detail: z.ZodOptional<z.ZodString>;
227
+ tools: z.ZodArray<z.ZodObject<{
228
+ name: z.ZodString;
229
+ description: z.ZodOptional<z.ZodString>;
230
+ }, z.core.$strip>>;
231
+ }, z.core.$strip>;
232
+ }, z.core.$strip>>;
233
+ /** Final: every exposure of it goes with it. */
234
+ remove: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
235
+ connection: z.ZodString;
236
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
237
+ }, {}, 1>;
238
+ /** `skills@1`: the person's skills, each a `SKILL.md` folder. */
239
+ export declare const skills: import("@agentorg/sdk").RpcInterface<"skills", {
240
+ /**
241
+ * Add a skill from a folder on the Hub's machine or as files; its name and description come
242
+ * from `SKILL.md`. The same name replaces the skill, for every agent it's exposed to.
243
+ */
244
+ add: import("@agentorg/sdk").MethodSpec<z.ZodUnion<readonly [z.ZodObject<{
245
+ path: z.ZodString;
246
+ }, z.core.$strict>, z.ZodObject<{
247
+ files: z.ZodRecord<z.ZodString, z.ZodString>;
248
+ }, z.core.$strict>]>, z.ZodObject<{
249
+ name: z.ZodString;
250
+ description: z.ZodString;
251
+ }, z.core.$strip>>;
252
+ list: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
253
+ skills: z.ZodArray<z.ZodObject<{
254
+ name: z.ZodString;
255
+ description: z.ZodString;
256
+ }, z.core.$strip>>;
257
+ }, z.core.$strip>>;
258
+ /** The skill: its `SKILL.md`, the paths of its files, and the agents it's exposed to. */
259
+ get: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
260
+ name: z.ZodString;
261
+ }, z.core.$strip>, z.ZodObject<{
262
+ name: z.ZodString;
263
+ description: z.ZodString;
264
+ text: z.ZodString;
265
+ files: z.ZodArray<z.ZodString>;
266
+ agents: z.ZodArray<z.ZodString>;
267
+ }, z.core.$strip>>;
268
+ /** Final: it is taken off every agent it's exposed to. */
269
+ remove: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
270
+ name: z.ZodString;
271
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
272
+ }, {}, 1>;
@@ -0,0 +1,185 @@
1
+ import { defineInterface, method } from "@agentorg/sdk";
2
+ import { z } from "zod";
3
+ import { AgentStatus, Answers, Creatable, CreatableId } from "./agent-provider.js";
4
+ import { SKILL_FILE_MAX, SkillEntry, SkillName, SkillPath } from "./agent-settings.js";
5
+ import { Id, SlotName } from "./hub.js";
6
+ import { ConnectionKind, ConnectionParams, ConnectionSecrets, ConnectionState, ConnectionStatus, ConnectionTarget, } from "./mcp-provider.js";
7
+ const Time = z.string().max(64);
8
+ const ActorName = z.string().min(1).max(128);
9
+ const OnAgent = z.object({ agent: Id });
10
+ const OnConnection = z.object({ connection: Id });
11
+ const OnSkill = z.object({ name: SkillName });
12
+ /** Where a connection came from, written once when it was made. */
13
+ export const ConnectionOrigin = z.object({
14
+ provider: Id,
15
+ kind: ConnectionKind,
16
+ target: ConnectionTarget,
17
+ /** The Actor that asked for it. */
18
+ madeBy: Id,
19
+ /** The agent it was made for, which it goes with; none when the person connected it. */
20
+ madeFor: Id.optional(),
21
+ at: Time,
22
+ });
23
+ /** An agent as the list shows it: its status is its provider's. */
24
+ const AgentEntry = z.object({
25
+ agent: Id,
26
+ name: ActorName,
27
+ status: AgentStatus,
28
+ provider: Id,
29
+ creatable: CreatableId,
30
+ });
31
+ /**
32
+ * `agents@1`: the agents the person has, each made from a creatable a connected agent provider
33
+ * offers. What each agent is doing is read from the agent's own `chat@1`.
34
+ */
35
+ export const agents = defineInterface({
36
+ name: "agents",
37
+ major: 1,
38
+ kind: "rpc",
39
+ methods: {
40
+ /** What every connected agent provider offers. */
41
+ creatable: method({
42
+ input: z.object({}),
43
+ output: z.object({ creatables: z.array(Creatable.extend({ provider: Id })) }),
44
+ }),
45
+ /** The agent providers connected now. */
46
+ providers: method({
47
+ input: z.object({}),
48
+ output: z.object({ providers: z.array(z.object({ provider: Id, name: ActorName })) }),
49
+ }),
50
+ /**
51
+ * Make an agent of a creatable, with what it asks and a connection for each of its `pick`
52
+ * needs, by slot. All or none: if any step fails, what this creation made is removed. A skill
53
+ * it comes with whose name is already here keeps the one here.
54
+ */
55
+ create: method({
56
+ input: z.object({
57
+ provider: Id,
58
+ creatable: CreatableId,
59
+ name: ActorName,
60
+ answers: Answers,
61
+ connections: z.record(SlotName, Id).optional(),
62
+ }),
63
+ output: OnAgent,
64
+ }),
65
+ list: method({ input: z.object({}), output: z.object({ agents: z.array(AgentEntry) }) }),
66
+ /** What the agent is made of, in one read. */
67
+ get: method({
68
+ input: OnAgent,
69
+ output: AgentEntry.extend({
70
+ instructions: z.string().max(200_000),
71
+ skills: z.array(SkillEntry),
72
+ mcp: z.array(z.object({
73
+ slot: SlotName,
74
+ connection: Id,
75
+ origin: ConnectionOrigin.optional(),
76
+ status: ConnectionStatus,
77
+ })),
78
+ }),
79
+ }),
80
+ start: method({ input: OnAgent, output: z.object({}) }),
81
+ /** Ends the agent's process, and a turn in progress with it; all else about it stays. */
82
+ stop: method({ input: OnAgent, output: z.object({}) }),
83
+ /** Expose a skill or a connection to the agent; `as` names a connection's slot. */
84
+ expose: method({
85
+ input: z.union([
86
+ z.strictObject({ agent: Id, skill: SkillName }),
87
+ z.strictObject({ agent: Id, connection: Id, as: SlotName.optional() }),
88
+ ]),
89
+ output: z.object({ slot: SlotName.optional() }),
90
+ }),
91
+ unexpose: method({
92
+ input: z.union([
93
+ z.strictObject({ agent: Id, skill: SkillName }),
94
+ z.strictObject({ agent: Id, slot: SlotName }),
95
+ ]),
96
+ output: z.object({}),
97
+ }),
98
+ /** Final: removes the agent and the connections made for it. */
99
+ remove: method({ input: OnAgent, output: z.object({}) }),
100
+ },
101
+ });
102
+ /** A connection as the list shows it. */
103
+ const ConnectionEntry = z.object({
104
+ connection: Id,
105
+ name: ActorName,
106
+ state: ConnectionState,
107
+ origin: ConnectionOrigin.optional(),
108
+ });
109
+ /** `connections@1`: the person's connections to MCP servers, through the connected providers. */
110
+ export const connections = defineInterface({
111
+ name: "connections",
112
+ major: 1,
113
+ kind: "rpc",
114
+ methods: {
115
+ /** The MCP providers connected now, each with the kinds it offers. */
116
+ providers: method({
117
+ input: z.object({}),
118
+ output: z.object({
119
+ providers: z.array(z.object({
120
+ provider: Id,
121
+ name: ActorName,
122
+ kinds: z.array(z.object({
123
+ kind: ConnectionKind,
124
+ title: z.string().min(1).max(128),
125
+ params: z.record(z.string(), z.json()),
126
+ secrets: z.record(z.string(), z.json()),
127
+ })),
128
+ })),
129
+ }),
130
+ }),
131
+ /** `secrets` go to the provider and nowhere else: they are never read back. */
132
+ create: method({
133
+ input: z.object({
134
+ provider: Id,
135
+ kind: ConnectionKind,
136
+ params: ConnectionParams,
137
+ secrets: ConnectionSecrets.optional(),
138
+ name: ActorName,
139
+ }),
140
+ output: OnConnection,
141
+ }),
142
+ list: method({
143
+ input: z.object({}),
144
+ output: z.object({ connections: z.array(ConnectionEntry) }),
145
+ }),
146
+ get: method({
147
+ input: OnConnection,
148
+ output: ConnectionEntry.omit({ state: true }).extend({ status: ConnectionStatus }),
149
+ }),
150
+ /** Final: every exposure of it goes with it. */
151
+ remove: method({ input: OnConnection, output: z.object({}) }),
152
+ },
153
+ });
154
+ const SkillFiles = z.record(SkillPath, z.string().max(SKILL_FILE_MAX));
155
+ /** `skills@1`: the person's skills, each a `SKILL.md` folder. */
156
+ export const skills = defineInterface({
157
+ name: "skills",
158
+ major: 1,
159
+ kind: "rpc",
160
+ methods: {
161
+ /**
162
+ * Add a skill from a folder on the Hub's machine or as files; its name and description come
163
+ * from `SKILL.md`. The same name replaces the skill, for every agent it's exposed to.
164
+ */
165
+ add: method({
166
+ input: z.union([
167
+ z.strictObject({ path: z.string().min(1).max(4096) }),
168
+ z.strictObject({ files: SkillFiles }),
169
+ ]),
170
+ output: SkillEntry,
171
+ }),
172
+ list: method({ input: z.object({}), output: z.object({ skills: z.array(SkillEntry) }) }),
173
+ /** The skill: its `SKILL.md`, the paths of its files, and the agents it's exposed to. */
174
+ get: method({
175
+ input: OnSkill,
176
+ output: SkillEntry.extend({
177
+ text: z.string().max(SKILL_FILE_MAX),
178
+ files: z.array(SkillPath),
179
+ agents: z.array(Id),
180
+ }),
181
+ }),
182
+ /** Final: it is taken off every agent it's exposed to. */
183
+ remove: method({ input: OnSkill, output: z.object({}) }),
184
+ },
185
+ });
@@ -0,0 +1,88 @@
1
+ import { z } from "zod";
2
+ /** A way a provider makes connections, such as `url` or `command`. */
3
+ export declare const ConnectionKind: z.ZodString;
4
+ /** `connecting` before its first success, `connected`, or `down` and being tried again. */
5
+ export declare const ConnectionState: z.ZodEnum<{
6
+ connected: "connected";
7
+ connecting: "connecting";
8
+ down: "down";
9
+ }>;
10
+ /** A connection's tools, for people to read; a provider cuts a long description to fit. */
11
+ export declare const ConnectionTool: z.ZodObject<{
12
+ name: z.ZodString;
13
+ description: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ /** How a connection stands now: `detail` says why it is down, and never holds a secret. */
16
+ export declare const ConnectionStatus: z.ZodObject<{
17
+ state: z.ZodEnum<{
18
+ connected: "connected";
19
+ connecting: "connecting";
20
+ down: "down";
21
+ }>;
22
+ detail: z.ZodOptional<z.ZodString>;
23
+ tools: z.ZodArray<z.ZodObject<{
24
+ name: z.ZodString;
25
+ description: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>>;
27
+ }, z.core.$strip>;
28
+ /** The parameters of a connection, fitting its kind's `params` schema. */
29
+ export declare const ConnectionParams: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
30
+ /**
31
+ * What a server needs and shouldn't be seen, by name, such as a bearer token. Write-only: the values
32
+ * cross once, in `create`, and go only to the provider's own private file.
33
+ */
34
+ export declare const ConnectionSecrets: z.ZodRecord<z.ZodString, z.ZodString>;
35
+ /** What a connection attaches to or runs, for people to read: never a secret. */
36
+ export declare const ConnectionTarget: z.ZodString;
37
+ /**
38
+ * `mcp.provider@1`: a program that makes connections to MCP servers. Each connection joins the
39
+ * Hub as its own Actor, whose id is `connection`, exporting `tools@1` as `tools`. MCP itself stays
40
+ * behind this interface.
41
+ *
42
+ * A secret a server needs is given once, in `create`'s `secrets`, and stays with the provider: its
43
+ * value is never in `params`, `target`, `detail`, or anything else read back. `status` and `remove` are refused `unknown` for a connection the
44
+ * provider doesn't hold.
45
+ */
46
+ export declare const mcpProvider: import("@agentorg/sdk").RpcInterface<"mcp.provider", {
47
+ /** The kinds it offers; `params` and `secrets` are the JSON Schemas of what each one takes. */
48
+ kinds: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
49
+ kinds: z.ZodArray<z.ZodObject<{
50
+ kind: z.ZodString;
51
+ title: z.ZodString;
52
+ params: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
53
+ secrets: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>>;
56
+ /**
57
+ * Make a connection and its Actor, named `name`. It returns once the Actor has joined the Hub,
58
+ * whether or not the server has answered yet; `status` says how it stands. Refused `invalid`
59
+ * when `kind` isn't offered or `params` or `secrets` don't fit it.
60
+ */
61
+ create: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
62
+ kind: z.ZodString;
63
+ params: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
64
+ secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
65
+ name: z.ZodString;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ connection: z.ZodString;
68
+ target: z.ZodString;
69
+ }, z.core.$strip>>;
70
+ status: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
71
+ connection: z.ZodString;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ state: z.ZodEnum<{
74
+ connected: "connected";
75
+ connecting: "connecting";
76
+ down: "down";
77
+ }>;
78
+ detail: z.ZodOptional<z.ZodString>;
79
+ tools: z.ZodArray<z.ZodObject<{
80
+ name: z.ZodString;
81
+ description: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strip>>;
83
+ }, z.core.$strip>>;
84
+ /** End the connection and close its Actor, which removes what was bound to it. */
85
+ remove: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
86
+ connection: z.ZodString;
87
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
88
+ }, {}, 1>;
@@ -0,0 +1,78 @@
1
+ import { defineInterface, method } from "@agentorg/sdk";
2
+ import { z } from "zod";
3
+ import { Id } from "./hub.js";
4
+ /** A way a provider makes connections, such as `url` or `command`. */
5
+ export const ConnectionKind = z
6
+ .string()
7
+ .regex(/^[a-z][a-z0-9-]*$/)
8
+ .max(64);
9
+ /** `connecting` before its first success, `connected`, or `down` and being tried again. */
10
+ export const ConnectionState = z.enum(["connecting", "connected", "down"]);
11
+ /** A connection's tools, for people to read; a provider cuts a long description to fit. */
12
+ export const ConnectionTool = z.object({
13
+ name: z.string().min(1).max(128),
14
+ description: z.string().max(512).optional(),
15
+ });
16
+ /** How a connection stands now: `detail` says why it is down, and never holds a secret. */
17
+ export const ConnectionStatus = z.object({
18
+ state: ConnectionState,
19
+ detail: z.string().max(2000).optional(),
20
+ tools: z.array(ConnectionTool),
21
+ });
22
+ /** The parameters of a connection, fitting its kind's `params` schema. */
23
+ export const ConnectionParams = z.record(z.string(), z.json());
24
+ /**
25
+ * What a server needs and shouldn't be seen, by name, such as a bearer token. Write-only: the values
26
+ * cross once, in `create`, and go only to the provider's own private file.
27
+ */
28
+ export const ConnectionSecrets = z.record(z
29
+ .string()
30
+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/)
31
+ .max(256), z.string().min(1).max(16_384));
32
+ /** What a connection attaches to or runs, for people to read: never a secret. */
33
+ export const ConnectionTarget = z.string().min(1).max(4096);
34
+ /**
35
+ * `mcp.provider@1`: a program that makes connections to MCP servers. Each connection joins the
36
+ * Hub as its own Actor, whose id is `connection`, exporting `tools@1` as `tools`. MCP itself stays
37
+ * behind this interface.
38
+ *
39
+ * A secret a server needs is given once, in `create`'s `secrets`, and stays with the provider: its
40
+ * value is never in `params`, `target`, `detail`, or anything else read back. `status` and `remove` are refused `unknown` for a connection the
41
+ * provider doesn't hold.
42
+ */
43
+ export const mcpProvider = defineInterface({
44
+ name: "mcp.provider",
45
+ major: 1,
46
+ kind: "rpc",
47
+ methods: {
48
+ /** The kinds it offers; `params` and `secrets` are the JSON Schemas of what each one takes. */
49
+ kinds: method({
50
+ input: z.object({}),
51
+ output: z.object({
52
+ kinds: z.array(z.object({
53
+ kind: ConnectionKind,
54
+ title: z.string().min(1).max(128),
55
+ params: z.record(z.string(), z.json()),
56
+ secrets: z.record(z.string(), z.json()),
57
+ })),
58
+ }),
59
+ }),
60
+ /**
61
+ * Make a connection and its Actor, named `name`. It returns once the Actor has joined the Hub,
62
+ * whether or not the server has answered yet; `status` says how it stands. Refused `invalid`
63
+ * when `kind` isn't offered or `params` or `secrets` don't fit it.
64
+ */
65
+ create: method({
66
+ input: z.object({
67
+ kind: ConnectionKind,
68
+ params: ConnectionParams,
69
+ secrets: ConnectionSecrets.optional(),
70
+ name: z.string().min(1).max(128),
71
+ }),
72
+ output: z.object({ connection: Id, target: ConnectionTarget }),
73
+ }),
74
+ status: method({ input: z.object({ connection: Id }), output: ConnectionStatus }),
75
+ /** End the connection and close its Actor, which removes what was bound to it. */
76
+ remove: method({ input: z.object({ connection: Id }), output: z.object({}) }),
77
+ },
78
+ });