@spacefast/common 0.0.26 → 0.2.2

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 (302) hide show
  1. package/dist/agents/connect-targets.d.ts +6 -146
  2. package/dist/agents/connect-targets.js +63 -295
  3. package/dist/agents/private-key-oauth.d.ts +31 -1
  4. package/dist/agents/private-key-oauth.js +124 -33
  5. package/dist/agents/registry/core.d.ts +292 -0
  6. package/dist/agents/registry/core.js +1388 -0
  7. package/dist/agents/registry/deeplink-probes.d.ts +23 -0
  8. package/dist/agents/registry/deeplink-probes.js +18 -0
  9. package/dist/agents/registry/node.d.ts +56 -0
  10. package/dist/agents/registry/node.js +339 -0
  11. package/dist/brand-assets-build.js +1 -2
  12. package/dist/brand-assets.js +4 -7
  13. package/dist/brand.d.ts +17 -0
  14. package/dist/brand.js +24 -4
  15. package/dist/config/domains.d.ts +55 -28
  16. package/dist/config/domains.js +85 -41
  17. package/dist/config/index.js +1 -2
  18. package/dist/contracts/abuse.js +9 -24
  19. package/dist/contracts/access-profiles.d.ts +86 -0
  20. package/dist/contracts/access-profiles.js +89 -0
  21. package/dist/contracts/access.d.ts +21 -27
  22. package/dist/contracts/access.js +33 -64
  23. package/dist/contracts/activity.d.ts +18 -1
  24. package/dist/contracts/activity.js +70 -26
  25. package/dist/contracts/analytics.js +8 -10
  26. package/dist/contracts/api-keys.d.ts +77 -52
  27. package/dist/contracts/api-keys.js +44 -24
  28. package/dist/contracts/application-journal.d.ts +216 -0
  29. package/dist/contracts/application-journal.js +167 -0
  30. package/dist/contracts/auth.d.ts +90 -17
  31. package/dist/contracts/auth.js +86 -17
  32. package/dist/contracts/beta.d.ts +9 -4
  33. package/dist/contracts/beta.js +20 -16
  34. package/dist/contracts/billing.js +7 -11
  35. package/dist/contracts/bootstrap.d.ts +791 -0
  36. package/dist/contracts/bootstrap.js +51 -0
  37. package/dist/contracts/builds.d.ts +192 -7
  38. package/dist/contracts/builds.js +84 -21
  39. package/dist/contracts/channels.d.ts +43 -0
  40. package/dist/contracts/channels.js +25 -9
  41. package/dist/contracts/cli.d.ts +7 -0
  42. package/dist/contracts/cli.js +6 -0
  43. package/dist/contracts/collab-public.d.ts +1 -1
  44. package/dist/contracts/collab-public.js +5 -8
  45. package/dist/contracts/comments.d.ts +45 -35
  46. package/dist/contracts/comments.js +107 -77
  47. package/dist/contracts/commerce.d.ts +165 -0
  48. package/dist/contracts/commerce.js +146 -0
  49. package/dist/contracts/common.d.ts +3 -3
  50. package/dist/contracts/common.js +18 -29
  51. package/dist/contracts/content-contract-verification.d.ts +521 -0
  52. package/dist/contracts/content-contract-verification.js +320 -0
  53. package/dist/contracts/content-platform-fixture.d.ts +1278 -0
  54. package/dist/contracts/content-platform-fixture.js +44 -0
  55. package/dist/contracts/content-program.d.ts +994 -0
  56. package/dist/contracts/content-program.js +658 -0
  57. package/dist/contracts/content-sync.d.ts +290 -0
  58. package/dist/contracts/content-sync.js +167 -0
  59. package/dist/contracts/content.d.ts +432 -0
  60. package/dist/contracts/content.js +303 -0
  61. package/dist/contracts/continuation.d.ts +17 -1
  62. package/dist/contracts/continuation.js +23 -23
  63. package/dist/contracts/countries.js +3 -4
  64. package/dist/contracts/crons.d.ts +17 -0
  65. package/dist/contracts/crons.js +33 -15
  66. package/dist/contracts/dashboard-prefs.d.ts +56 -0
  67. package/dist/contracts/dashboard-prefs.js +51 -0
  68. package/dist/contracts/device-auth.d.ts +234 -37
  69. package/dist/contracts/device-auth.js +267 -53
  70. package/dist/contracts/docs.d.ts +6 -10
  71. package/dist/contracts/docs.js +5 -13
  72. package/dist/contracts/domains.d.ts +499 -102
  73. package/dist/contracts/domains.js +169 -58
  74. package/dist/contracts/email-preferences.d.ts +3 -3
  75. package/dist/contracts/email-preferences.js +6 -7
  76. package/dist/contracts/enums.d.ts +26 -26
  77. package/dist/contracts/enums.js +61 -54
  78. package/dist/contracts/error-code-meta.d.ts +273 -7
  79. package/dist/contracts/error-code-meta.js +81 -5
  80. package/dist/contracts/error-codes.d.ts +5 -5
  81. package/dist/contracts/error-codes.js +79 -16
  82. package/dist/contracts/events.d.ts +100 -20
  83. package/dist/contracts/events.js +107 -20
  84. package/dist/contracts/execution.d.ts +47 -66
  85. package/dist/contracts/execution.js +51 -64
  86. package/dist/contracts/feature-lifecycle.d.ts +70 -14
  87. package/dist/contracts/feature-lifecycle.js +86 -15
  88. package/dist/contracts/features.d.ts +100 -37
  89. package/dist/contracts/features.js +21 -27
  90. package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
  91. package/dist/contracts/frame-session.d.ts +192 -0
  92. package/dist/contracts/frame-session.js +164 -0
  93. package/dist/contracts/functions.d.ts +218 -211
  94. package/dist/contracts/functions.js +273 -260
  95. package/dist/contracts/grant-copy.d.ts +43 -0
  96. package/dist/contracts/grant-copy.js +44 -0
  97. package/dist/contracts/grants.d.ts +64 -56
  98. package/dist/contracts/grants.js +124 -23
  99. package/dist/contracts/ids.d.ts +4 -1
  100. package/dist/contracts/ids.js +4 -1
  101. package/dist/contracts/internal.d.ts +5 -4
  102. package/dist/contracts/internal.js +12 -3
  103. package/dist/contracts/mcp.d.ts +17 -0
  104. package/dist/contracts/mcp.js +23 -0
  105. package/dist/contracts/me.d.ts +6 -1
  106. package/dist/contracts/me.js +12 -6
  107. package/dist/contracts/notifications.d.ts +27 -29
  108. package/dist/contracts/notifications.js +9 -4
  109. package/dist/contracts/oauth-resources.d.ts +121 -10
  110. package/dist/contracts/oauth-resources.js +130 -11
  111. package/dist/contracts/oauth-scope-actions.d.ts +90 -0
  112. package/dist/contracts/oauth-scope-actions.js +126 -0
  113. package/dist/contracts/operations.d.ts +27 -4
  114. package/dist/contracts/operations.js +11 -5
  115. package/dist/contracts/pages.d.ts +29 -5
  116. package/dist/contracts/pages.js +22 -5
  117. package/dist/contracts/partner-notifications.d.ts +3 -0
  118. package/dist/contracts/partner-notifications.js +65 -0
  119. package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
  120. package/dist/contracts/{platform.js → partner.js} +27 -40
  121. package/dist/contracts/plan-policy.d.ts +1 -1
  122. package/dist/contracts/principal-assertion.d.ts +43 -0
  123. package/dist/contracts/principal-assertion.js +67 -0
  124. package/dist/contracts/principals.d.ts +73 -0
  125. package/dist/contracts/principals.js +59 -0
  126. package/dist/contracts/privacy.d.ts +11 -0
  127. package/dist/contracts/privacy.js +17 -0
  128. package/dist/contracts/problem-document.js +3 -4
  129. package/dist/contracts/publish-archive.d.ts +116 -18
  130. package/dist/contracts/publish-archive.js +6 -3
  131. package/dist/contracts/push-new.d.ts +4 -4
  132. package/dist/contracts/quotas.js +3 -3
  133. package/dist/contracts/realtime.d.ts +52 -0
  134. package/dist/contracts/realtime.js +54 -0
  135. package/dist/contracts/repository-connections.d.ts +1 -1
  136. package/dist/contracts/repository-connections.js +6 -2
  137. package/dist/contracts/resources.d.ts +105 -14
  138. package/dist/contracts/resources.js +145 -21
  139. package/dist/contracts/route-inventory.d.ts +358 -0
  140. package/dist/contracts/route-inventory.js +141 -0
  141. package/dist/contracts/runtime-api.d.ts +112 -35
  142. package/dist/contracts/runtime-api.js +86 -66
  143. package/dist/contracts/runtime-app.d.ts +11 -21
  144. package/dist/contracts/runtime-app.js +39 -24
  145. package/dist/contracts/runtime-components.d.ts +143 -0
  146. package/dist/contracts/runtime-components.js +199 -0
  147. package/dist/contracts/runtime-db.d.ts +45 -19
  148. package/dist/contracts/runtime-db.js +85 -20
  149. package/dist/contracts/runtime-purge.js +3 -5
  150. package/dist/contracts/runtime-services.d.ts +43 -75
  151. package/dist/contracts/runtime-services.js +29 -49
  152. package/dist/contracts/runtime-storage.d.ts +14 -14
  153. package/dist/contracts/runtime-storage.js +28 -13
  154. package/dist/contracts/sf-config-v1.d.ts +14 -18
  155. package/dist/contracts/slugs.js +13 -4
  156. package/dist/contracts/space-config.d.ts +235 -28
  157. package/dist/contracts/space-config.js +246 -91
  158. package/dist/contracts/spaces.d.ts +360 -255
  159. package/dist/contracts/spaces.js +190 -122
  160. package/dist/contracts/superadmin-activity.d.ts +3 -43
  161. package/dist/contracts/superadmin-activity.js +6 -30
  162. package/dist/contracts/superadmin-emails.d.ts +1 -0
  163. package/dist/contracts/superadmin-emails.js +17 -1
  164. package/dist/contracts/superadmin-runtime.d.ts +199 -0
  165. package/dist/contracts/superadmin-runtime.js +141 -0
  166. package/dist/contracts/superadmin-search.d.ts +22 -2
  167. package/dist/contracts/superadmin-search.js +14 -6
  168. package/dist/contracts/superadmin-spaces.d.ts +435 -186
  169. package/dist/contracts/superadmin-spaces.js +131 -25
  170. package/dist/contracts/superadmin-teams.d.ts +3 -0
  171. package/dist/contracts/superadmin-teams.js +1 -2
  172. package/dist/contracts/superadmin-tenants.d.ts +627 -6
  173. package/dist/contracts/superadmin-tenants.js +32 -7
  174. package/dist/contracts/superadmin.d.ts +98 -16
  175. package/dist/contracts/superadmin.js +63 -10
  176. package/dist/contracts/tags.d.ts +85 -58
  177. package/dist/contracts/tags.js +44 -34
  178. package/dist/contracts/teams.d.ts +72 -9
  179. package/dist/contracts/teams.js +84 -25
  180. package/dist/contracts/tenants.d.ts +135 -0
  181. package/dist/contracts/tenants.js +120 -0
  182. package/dist/contracts/test-triggers.d.ts +70 -0
  183. package/dist/contracts/test-triggers.js +116 -0
  184. package/dist/contracts/theme-json.js +3 -8
  185. package/dist/contracts/transfers.d.ts +1 -0
  186. package/dist/contracts/transfers.js +1 -0
  187. package/dist/contracts/usage.d.ts +209 -0
  188. package/dist/contracts/usage.js +124 -12
  189. package/dist/contracts/variables.d.ts +2 -2
  190. package/dist/contracts/variables.js +9 -13
  191. package/dist/contracts/webhooks.d.ts +13 -5
  192. package/dist/contracts/webhooks.js +3 -1
  193. package/dist/contracts/zero.d.ts +57 -64
  194. package/dist/contracts/zero.js +68 -66
  195. package/dist/dashboard-paths/index.d.ts +24 -21
  196. package/dist/dashboard-paths/index.js +35 -47
  197. package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
  198. package/dist/dashboard-paths/route-reservations.generated.js +36 -0
  199. package/dist/docs/agent-arrival.d.ts +92 -0
  200. package/dist/docs/agent-arrival.js +227 -0
  201. package/dist/docs/agent-output-policy.d.ts +6 -0
  202. package/dist/docs/agent-output-policy.js +22 -0
  203. package/dist/docs/agent-prose.d.ts +11 -17
  204. package/dist/docs/agent-prose.js +62 -37
  205. package/dist/docs/agent-setup.d.ts +72 -41
  206. package/dist/docs/agent-setup.js +336 -436
  207. package/dist/docs/catalog.d.ts +147 -89
  208. package/dist/docs/catalog.js +157 -42
  209. package/dist/docs/error-docs.d.ts +2102 -1
  210. package/dist/docs/error-docs.js +285 -16
  211. package/dist/docs/index-build.d.ts +0 -1
  212. package/dist/docs/index-build.js +2 -3
  213. package/dist/docs/page-context-prompt.d.ts +77 -0
  214. package/dist/docs/page-context-prompt.js +131 -0
  215. package/dist/docs/reference-urls.d.ts +46 -0
  216. package/dist/docs/reference-urls.js +79 -0
  217. package/dist/docs/search.d.ts +6 -8
  218. package/dist/docs/search.js +10 -13
  219. package/dist/docs/skill-distribution.d.ts +4 -1
  220. package/dist/docs/skill-distribution.js +10 -5
  221. package/dist/docs/skills.d.ts +117 -117
  222. package/dist/docs/skills.js +120 -72
  223. package/dist/docs/start-prompts.d.ts +45 -0
  224. package/dist/docs/start-prompts.js +62 -0
  225. package/dist/domain-exploration.js +9 -13
  226. package/dist/og-template.d.ts +56 -0
  227. package/dist/og-template.js +56 -0
  228. package/dist/slug-policy/index.js +5 -11
  229. package/dist/utils/browser-credential.d.ts +13 -6
  230. package/dist/utils/browser-credential.js +14 -7
  231. package/dist/utils/build-settings.d.ts +16 -0
  232. package/dist/utils/build-settings.js +63 -17
  233. package/dist/utils/canonical-json.d.ts +3 -5
  234. package/dist/utils/canonical-json.js +3 -5
  235. package/dist/utils/cast-transport.d.ts +5 -17
  236. package/dist/utils/cast-transport.js +6 -19
  237. package/dist/utils/claim-token.js +1 -2
  238. package/dist/utils/comment-avatars.js +4 -6
  239. package/dist/utils/concurrency.js +2 -3
  240. package/dist/utils/content-type.d.ts +7 -6
  241. package/dist/utils/content-type.js +73 -51
  242. package/dist/utils/credential-policy.d.ts +50 -6
  243. package/dist/utils/credential-policy.js +123 -57
  244. package/dist/utils/egress-policy.fixtures.json +1 -1
  245. package/dist/utils/generate-space-name.d.ts +3 -8
  246. package/dist/utils/generate-space-name.js +3 -8
  247. package/dist/utils/grants.d.ts +0 -1
  248. package/dist/utils/grants.js +4 -7
  249. package/dist/utils/gravatar.d.ts +2 -4
  250. package/dist/utils/gravatar.js +6 -12
  251. package/dist/utils/id-hints.js +14 -23
  252. package/dist/utils/idempotency.d.ts +3 -3
  253. package/dist/utils/idempotency.js +6 -7
  254. package/dist/utils/local-space-state.d.ts +15 -15
  255. package/dist/utils/local-space-state.js +34 -23
  256. package/dist/utils/oauth-signed-query.d.ts +3 -5
  257. package/dist/utils/oauth-signed-query.js +6 -9
  258. package/dist/utils/one-shot-replay.d.ts +3 -5
  259. package/dist/utils/one-shot-replay.js +3 -5
  260. package/dist/utils/page-colors.d.ts +4 -10
  261. package/dist/utils/page-colors.js +11 -35
  262. package/dist/utils/page-fonts.js +6 -11
  263. package/dist/utils/page-preview.d.ts +0 -1
  264. package/dist/utils/page-preview.js +0 -1
  265. package/dist/utils/pages.d.ts +22 -11
  266. package/dist/utils/pages.js +70 -30
  267. package/dist/utils/privacy-regions.d.ts +19 -0
  268. package/dist/utils/privacy-regions.js +91 -0
  269. package/dist/utils/publish-form-data.d.ts +4 -5
  270. package/dist/utils/publish-form-data.js +2 -3
  271. package/dist/utils/publish-policy.d.ts +10 -23
  272. package/dist/utils/publish-policy.js +63 -116
  273. package/dist/utils/query-client.d.ts +2 -0
  274. package/dist/utils/query-client.js +10 -1
  275. package/dist/utils/runtime-paths.d.ts +4 -4
  276. package/dist/utils/runtime-paths.js +6 -8
  277. package/dist/utils/runtime-upload.d.ts +4 -0
  278. package/dist/utils/runtime-upload.js +5 -0
  279. package/dist/utils/secure-local-file.d.ts +3 -3
  280. package/dist/utils/secure-local-file.js +18 -24
  281. package/dist/utils/space-config.d.ts +11 -14
  282. package/dist/utils/space-config.js +10 -16
  283. package/dist/utils/static-runtime-policy.d.ts +5 -8
  284. package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
  285. package/dist/utils/static-runtime-policy.generated.js +70 -0
  286. package/dist/utils/static-runtime-policy.js +17 -84
  287. package/dist/utils/storage-policy.js +1 -2
  288. package/dist/utils/upload-session.js +8 -14
  289. package/dist/utils/version-path.js +11 -19
  290. package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
  291. package/dist/utils/wpcom-auth-redirects.js +1 -4
  292. package/dist/vocabulary.d.ts +7 -7
  293. package/dist/vocabulary.js +30 -16
  294. package/package.json +14 -2
  295. package/dist/agents/client-registry.d.ts +0 -22
  296. package/dist/agents/client-registry.js +0 -41
  297. package/dist/docs/agent-handoff-document.d.ts +0 -15
  298. package/dist/docs/agent-handoff-document.js +0 -180
  299. package/dist/docs/agent-solutions.d.ts +0 -110
  300. package/dist/docs/agent-solutions.js +0 -183
  301. package/dist/utils/query-keys.d.ts +0 -84
  302. package/dist/utils/query-keys.js +0 -108
@@ -1,141 +1,10 @@
1
- import { type ConnectTargetId } from "./client-registry.js";
2
- export { CONNECT_TARGET_IDS } from "./client-registry.js";
3
- export type { ConnectTargetId } from "./client-registry.js";
1
+ import { type AgentId } from "./registry/core.js";
2
+ export declare const CONNECT_TARGET_IDS: readonly ["claude-code", "claude-app", "claude-desktop", "cursor", "codex", "chatgpt", "vscode", "github-copilot", "devin-desktop", "devin-cloud", "zed", "gemini-cli", "opencode", "amp", "warp", "factory-droid", "cline", "continue", "raycast", "poke", "pi", "indent", "hermes", "openclaw"];
3
+ export type ConnectTargetId = AgentId;
4
4
  export declare const LOCAL_MCP_PACKAGE = "spacefast";
5
5
  export declare const LOCAL_MCP_COMMAND = "npx";
6
6
  export declare const LOCAL_MCP_ARGS: readonly ["-y", "spacefast", "mcp"];
7
- /** The copy-paste one-liner for the fixed On-Device product surface. */
8
7
  export declare const LOCAL_MCP_COMMAND_LINE: string;
9
- /**
10
- * base64 of a UTF-8 string, without Buffer. Byte-identical to
11
- * `Buffer.from(value, "utf8").toString("base64")`, so deeplinks stay stable
12
- * whether they are built at the Astro build (Node) or in the dashboard (browser).
13
- */
14
- export declare function base64Utf8(value: string): string;
15
- /** The on-device MCP server entry, byte-identical to the committed plugin `.mcp.json`. */
16
- export declare function localMcpServersJson(): {
17
- mcpServers: {
18
- spacefast: {
19
- command: string;
20
- args: ("mcp" | "spacefast" | "-y")[];
21
- env: {};
22
- };
23
- };
24
- };
25
- /**
26
- * VS Code's `.vscode/mcp.json` uses a top-level `servers` key (not the
27
- * `mcpServers` key Cursor/Claude Code use), so it gets its own generator —
28
- * single-sourced from the same command/args/package so it can never drift.
29
- * See https://code.visualstudio.com/docs/agent-customization/mcp-servers.
30
- */
31
- export declare function vscodeMcpServersJson(): {
32
- servers: {
33
- spacefast: {
34
- type: string;
35
- command: string;
36
- args: ("mcp" | "spacefast" | "-y")[];
37
- };
38
- };
39
- };
40
- export declare function cursorHostedMcpDeeplink(mcpEndpoint: string): string;
41
- export declare function vscodeHostedMcpDeeplink(mcpEndpoint: string): string;
42
- export declare function pokeHostedMcpDeeplink(mcpEndpoint: string): string;
43
- /**
44
- * The hosted server entry for the Pi coding agent's `pi-mcp-extension`
45
- * (`~/.pi/agent/mcp.json` or a project `.pi/mcp.json`). Pi has no built-in
46
- * MCP; the extension (`pi install npm:pi-mcp-extension`) adds it with a
47
- * `transport: "streamable-http"` entry — its own key names, not the
48
- * `type: "http"` shape Claude Code and VS Code use.
49
- */
50
- export declare function piHostedMcpConfig(mcpEndpoint: string): {
51
- mcpServers: {
52
- spacefast: {
53
- transport: string;
54
- url: string;
55
- };
56
- };
57
- };
58
- export declare function claudeHostedConnectorInstallUrl(mcpEndpoint: string): string;
59
- export declare function claudeOrgConnectorInstallUrl(mcpEndpoint: string): string;
60
- /**
61
- * The hosted server entry for Claude Code's `.mcp.json`. Claude Code rejects a
62
- * bare `{ url }` as invalid, so the entry carries `type: "http"` — byte-identical
63
- * to the committed `plugins/claude-code/.mcp.json`.
64
- */
65
- export declare function hostedMcpServersJson(mcpEndpoint: string): {
66
- mcpServers: {
67
- spacefast: {
68
- type: string;
69
- url: string;
70
- };
71
- };
72
- };
73
- /**
74
- * The hosted server entry for Cursor's `~/.cursor/mcp.json`. Cursor's known-good
75
- * shape is a bare `{ url }` (no `type`) — matching the committed
76
- * `plugins/cursor/.mcp.json`. Kept separate from the Claude Code generator
77
- * rather than adding `type` everywhere, since `type: "http"` in Cursor's file is
78
- * untested territory.
79
- */
80
- export declare function cursorHostedMcpServersJson(mcpEndpoint: string): {
81
- mcpServers: {
82
- spacefast: {
83
- url: string;
84
- };
85
- };
86
- };
87
- /** The hosted server entry for VS Code's `.vscode/mcp.json` (`servers` + `type: http`). */
88
- export declare function vscodeHostedMcpServersJson(mcpEndpoint: string): {
89
- servers: {
90
- spacefast: {
91
- type: string;
92
- url: string;
93
- };
94
- };
95
- };
96
- /**
97
- * A complete, schema-pinned OpenCode V2 config for the hosted MCP server.
98
- * OpenCode's `mcp` key is a flat map keyed by server name (no `servers` level) —
99
- * the same shape `sf mcp install` writes (packages/cli/src/agent-setup.ts).
100
- */
101
- export declare function opencodeHostedMcpConfig(mcpEndpoint: string): {
102
- $schema: string;
103
- mcp: {
104
- spacefast: {
105
- type: string;
106
- url: string;
107
- enabled: boolean;
108
- };
109
- };
110
- };
111
- export declare function codexHostedMcpToml(mcpEndpoint: string): string;
112
- export declare const CODEX_MCP_TOML: string;
113
- /**
114
- * Claude Code's one-command hosted-MCP connect (`claude mcp add`). Parameterized
115
- * by the hosted endpoint so the dashboard can point it at the runtime-derived
116
- * endpoint while the marketing site passes the prod constant.
117
- */
118
- export declare function buildClaudeMcpAddCommand(mcpEndpoint: string): string;
119
- /**
120
- * Codex's hosted-MCP connect. `codex mcp add` registers the server; OAuth is a
121
- * separate `codex mcp login` step, so both are chained — a bare `add` leaves the
122
- * connection unauthenticated and the tools 401.
123
- */
124
- export declare function buildCodexMcpAddCommand(mcpEndpoint: string): string;
125
- /**
126
- * Hermes's hosted-MCP connect (`hermes mcp add --url`), the form NousResearch's
127
- * hermes-agent MCP guide documents. `--auth oauth` opts the hosted server into
128
- * the browser sign-in flow; unlike Codex there is no separate login command.
129
- */
130
- export declare function buildHermesMcpAddCommand(mcpEndpoint: string): string;
131
- /**
132
- * OpenClaw's hosted-MCP connect (`openclaw mcp add`), the form
133
- * docs.openclaw.ai/cli/mcp documents: `--transport streamable-http` is required
134
- * (no auto-detection), `--auth oauth` opts into OAuth. Sign-in is a separate
135
- * two-step `openclaw mcp login <name>` (prints an auth URL, then `--code`), so
136
- * setup copy must not promise a single-command flow.
137
- */
138
- export declare function buildOpenclawMcpAddCommand(mcpEndpoint: string): string;
139
8
  export type ConnectCopyLanguage = "bash" | "json" | "toml" | "text";
140
9
  export type ConnectCopy = Readonly<{
141
10
  /** Short label for the affordance and the copied-value toast. */
@@ -153,11 +22,7 @@ export type ConnectDownload = Readonly<{
153
22
  href: string;
154
23
  label: string;
155
24
  }>;
156
- /**
157
- * A single connect card: one agent, one primary action (a one-click deeplink or
158
- * a copy of the command/endpoint that wires it), plus an optional secondary
159
- * "copy the client config file" affordance.
160
- */
25
+ /** A single connect card: one agent, one primary action, optional extras. */
161
26
  export type ConnectTarget = Readonly<{
162
27
  id: ConnectTargetId;
163
28
  name: string;
@@ -172,15 +37,10 @@ export type ConnectTarget = Readonly<{
172
37
  /** A downloadable installer for clients that ship one (Claude Desktop). */
173
38
  download?: ConnectDownload;
174
39
  }>;
175
- /**
176
- * The per-agent connect catalog, parameterized by the hosted MCP endpoint.
177
- * Every one-click and copy-config path carries the hosted endpoint (OAuth,
178
- * nothing to install); on-device stdio is the CLI users' alternative and
179
- * lives in the docs/marketing setup lanes, not here.
180
- */
40
+ /** The per-agent connect catalog, parameterized by the hosted MCP endpoint. */
181
41
  export declare function buildConnectTargets({ mcpEndpoint }: {
182
42
  mcpEndpoint: string;
183
43
  }): ConnectTarget[];
184
- export declare function getConnectTarget(id: ConnectTargetId, options: {
44
+ export declare function getConnectTarget(id: string, options: {
185
45
  mcpEndpoint: string;
186
46
  }): ConnectTarget;
@@ -1,307 +1,75 @@
1
1
  /*
2
- * Shared, browser-safe agent connect catalog.
2
+ * The connect-card projection of the agent registry.
3
3
  *
4
- * One source of truth for "add Spacefast to your agent": the MCP launch config,
5
- * the one-click deeplinks, and the per-agent connect entries. Both the marketing
6
- * standalone website (with the hardcoded prod
7
- * endpoint) and the Team Developer dashboard (with the runtime-derived
8
- * hosted endpoint) consume these, so every "connect an agent" surface advertises
9
- * the identical command, package, and config — they can never drift apart.
4
+ * This file used to hand-maintain a second copy of every deeplink, MCP config
5
+ * shape, and `mcp add` command. Those builders are gone: the registry
6
+ * (./registry/core.ts) owns the data, and this module is only the card shape the
7
+ * handoff document and the dashboard's connect surfaces render. A builder that
8
+ * lives here again is a fork waiting to happen.
10
9
  *
11
- * ISOMORPHIC ON PURPOSE: no Buffer, no process, no Node-only APIs. The dashboard
12
- * renders this in the browser, so base64 goes through TextEncoder + btoa (both
13
- * standard in browsers, Node 16+, and Bun) rather than Buffer.
10
+ * Isomorphic on purpose: no Buffer, no process, no Node-only APIs.
14
11
  */
15
- import { spacefastClaudePluginAddCommand, spacefastClaudePluginInstallCommand, spacefastCodexPluginAddCommand, spacefastCodexPluginInstallCommand, } from "../docs/skill-distribution.js";
16
- import { agentProductName } from "./client-registry.js";
17
- export { CONNECT_TARGET_IDS } from "./client-registry.js";
12
+ import { AGENT_IDS, AGENT_REGISTRY, presentAgentEntry, } from "./registry/core.js";
13
+ export const CONNECT_TARGET_IDS = AGENT_IDS;
18
14
  export const LOCAL_MCP_PACKAGE = "spacefast";
19
15
  export const LOCAL_MCP_COMMAND = "npx";
20
16
  export const LOCAL_MCP_ARGS = ["-y", LOCAL_MCP_PACKAGE, "mcp"];
21
- /** The copy-paste one-liner for the fixed On-Device product surface. */
22
17
  export const LOCAL_MCP_COMMAND_LINE = `${LOCAL_MCP_COMMAND} ${LOCAL_MCP_ARGS.join(" ")}`;
23
- /**
24
- * base64 of a UTF-8 string, without Buffer. Byte-identical to
25
- * `Buffer.from(value, "utf8").toString("base64")`, so deeplinks stay stable
26
- * whether they are built at the Astro build (Node) or in the dashboard (browser).
27
- */
28
- export function base64Utf8(value) {
29
- const bytes = new TextEncoder().encode(value);
30
- let binary = "";
31
- for (const byte of bytes) {
32
- binary += String.fromCharCode(byte);
33
- }
34
- return btoa(binary);
35
- }
36
- /** The on-device MCP server entry, byte-identical to the committed plugin `.mcp.json`. */
37
- export function localMcpServersJson() {
38
- return {
39
- mcpServers: {
40
- [LOCAL_MCP_PACKAGE]: {
41
- command: LOCAL_MCP_COMMAND,
42
- args: [...LOCAL_MCP_ARGS],
43
- env: {},
44
- },
45
- },
46
- };
47
- }
48
- /**
49
- * VS Code's `.vscode/mcp.json` uses a top-level `servers` key (not the
50
- * `mcpServers` key Cursor/Claude Code use), so it gets its own generator —
51
- * single-sourced from the same command/args/package so it can never drift.
52
- * See https://code.visualstudio.com/docs/agent-customization/mcp-servers.
53
- */
54
- export function vscodeMcpServersJson() {
55
- return {
56
- servers: {
57
- [LOCAL_MCP_PACKAGE]: {
58
- type: "stdio",
59
- command: LOCAL_MCP_COMMAND,
60
- args: [...LOCAL_MCP_ARGS],
61
- },
62
- },
63
- };
64
- }
65
- /*
66
- * ONE-CLICK PATHS ARE ALWAYS HOSTED. Policy: hosted MCP for cloud agents,
67
- * on-device for local ones — but a one-click install must never depend on the
68
- * user having npm/npx. The hosted URL server needs no runtime at all (the
69
- * client speaks HTTP + OAuth), so every deeplink and every primary action
70
- * carries the hosted endpoint. On-device stdio (`npx -y spacefast mcp`) stays
71
- * available as the explicitly-labeled alternative for people who run the CLI —
72
- * their environment already provides npx.
73
- */
74
- // Cursor one-click MCP install link — the canonical form Cursor's own directory
75
- // badges emit is the HTTPS web link (`https://cursor.com/install-mcp`), which
76
- // renders as a normal anchor everywhere; the `cursor://` scheme still works but
77
- // isn't what Cursor advertises. The inner config is the hosted URL entry
78
- // (base64-encoded); Cursor handles the OAuth dance itself.
79
- export function cursorHostedMcpDeeplink(mcpEndpoint) {
80
- return `https://cursor.com/install-mcp?name=${LOCAL_MCP_PACKAGE}&config=${encodeURIComponent(base64Utf8(JSON.stringify({ url: mcpEndpoint })))}`;
81
- }
82
- // VS Code one-click MCP install link — the HTTPS redirect service, which 302s
83
- // into the documented `vscode:mcp/install?<uriencoded JSON>` URL handler. Host
84
- // is `vscode.dev` (NOT the badge-era `insiders.vscode.dev`, which emits the
85
- // same stable-VS-Code Location header today but reads as "insiders" to users
86
- // and breaks if the redirect ever honors its host). The config is the server
87
- // object WITHOUT the name (the service merges the `name` param into the JSON),
88
- // plain URI-encoded — base64 is Cursor's rule, not VS Code's. `type: "http"`
89
- // is mandatory: VS Code treats a bare `url` as a stdio command and fails
90
- // confusingly.
91
- export function vscodeHostedMcpDeeplink(mcpEndpoint) {
92
- return `https://vscode.dev/redirect/mcp/install?name=${LOCAL_MCP_PACKAGE}&config=${encodeURIComponent(JSON.stringify({ type: "http", url: mcpEndpoint }))}`;
93
- }
94
- // Poke one-click MCP install link — a plain HTTPS page that prefills the
95
- // new-integration form (https://poke.com/docs/mcp-servers): ordinary
96
- // URI-encoded query params, no JSON blob, no base64. All params stay
97
- // user-editable in the form; the user reviews and hits Create. `apiKey` is
98
- // also accepted but must NEVER appear in a public link — our hosted server
99
- // authenticates via OAuth.
100
- export function pokeHostedMcpDeeplink(mcpEndpoint) {
101
- return `https://poke.com/integrations/new?name=Spacefast&url=${encodeURIComponent(mcpEndpoint)}`;
102
- }
103
- /**
104
- * The hosted server entry for the Pi coding agent's `pi-mcp-extension`
105
- * (`~/.pi/agent/mcp.json` or a project `.pi/mcp.json`). Pi has no built-in
106
- * MCP; the extension (`pi install npm:pi-mcp-extension`) adds it with a
107
- * `transport: "streamable-http"` entry — its own key names, not the
108
- * `type: "http"` shape Claude Code and VS Code use.
109
- */
110
- export function piHostedMcpConfig(mcpEndpoint) {
111
- return {
112
- mcpServers: {
113
- [LOCAL_MCP_PACKAGE]: { transport: "streamable-http", url: mcpEndpoint },
114
- },
115
- };
116
- }
117
- // Claude custom-connector install link — opens claude.ai's "Add custom
118
- // connector" dialog with name and URL prefilled (documented under "Share an
119
- // install link", claude.com/docs/connectors/building/directory-vs-custom).
120
- // Plain percent-encoded params, no JSON blob; the dialog shows the values came
121
- // from an external link and the user confirms before anything is added. The
122
- // connector then syncs to every Claude client (web, Desktop, mobile). Signed-out
123
- // users get the sign-in first, then land on the prefilled dialog.
124
- export function claudeHostedConnectorInstallUrl(mcpEndpoint) {
125
- return `https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=Spacefast&connectorUrl=${encodeURIComponent(mcpEndpoint)}`;
126
- }
127
- // The same documented params on the admin path: prefills the ORG-WIDE custom
128
- // connector dialog for Team/Enterprise Owners. Adding it org-wide connects
129
- // nobody by itself — each member still clicks Connect on the rolled-out
130
- // connector — so copy around this link must address the admin, not the member.
131
- export function claudeOrgConnectorInstallUrl(mcpEndpoint) {
132
- return `https://claude.ai/admin-settings/connectors?modal=add-custom-connector&connectorName=Spacefast&connectorUrl=${encodeURIComponent(mcpEndpoint)}`;
133
- }
134
- /**
135
- * The hosted server entry for Claude Code's `.mcp.json`. Claude Code rejects a
136
- * bare `{ url }` as invalid, so the entry carries `type: "http"` — byte-identical
137
- * to the committed `plugins/claude-code/.mcp.json`.
138
- */
139
- export function hostedMcpServersJson(mcpEndpoint) {
140
- return {
141
- mcpServers: {
142
- [LOCAL_MCP_PACKAGE]: { type: "http", url: mcpEndpoint },
143
- },
144
- };
145
- }
146
- /**
147
- * The hosted server entry for Cursor's `~/.cursor/mcp.json`. Cursor's known-good
148
- * shape is a bare `{ url }` (no `type`) — matching the committed
149
- * `plugins/cursor/.mcp.json`. Kept separate from the Claude Code generator
150
- * rather than adding `type` everywhere, since `type: "http"` in Cursor's file is
151
- * untested territory.
152
- */
153
- export function cursorHostedMcpServersJson(mcpEndpoint) {
154
- return {
155
- mcpServers: {
156
- [LOCAL_MCP_PACKAGE]: { url: mcpEndpoint },
157
- },
158
- };
159
- }
160
- /** The hosted server entry for VS Code's `.vscode/mcp.json` (`servers` + `type: http`). */
161
- export function vscodeHostedMcpServersJson(mcpEndpoint) {
162
- return {
163
- servers: {
164
- [LOCAL_MCP_PACKAGE]: { type: "http", url: mcpEndpoint },
165
- },
166
- };
167
- }
168
- /**
169
- * A complete, schema-pinned OpenCode V2 config for the hosted MCP server.
170
- * OpenCode's `mcp` key is a flat map keyed by server name (no `servers` level) —
171
- * the same shape `sf mcp install` writes (packages/cli/src/agent-setup.ts).
172
- */
173
- export function opencodeHostedMcpConfig(mcpEndpoint) {
174
- return {
175
- $schema: "https://opencode.ai/config.json",
176
- mcp: {
177
- [LOCAL_MCP_PACKAGE]: {
178
- type: "remote",
179
- url: mcpEndpoint,
180
- enabled: true,
181
- },
182
- },
183
- };
184
- }
185
- // Codex reads MCP servers from `~/.codex/config.toml`; the hosted entry is a
186
- // bare streamable-HTTP url (same lane the committed codex plugin ships).
187
- export function codexHostedMcpToml(mcpEndpoint) {
188
- return [`[mcp_servers.${LOCAL_MCP_PACKAGE}]`, `url = ${JSON.stringify(mcpEndpoint)}`].join("\n");
189
- }
190
- // The on-device stdio TOML, for CLI users whose environment provides npx.
191
- export const CODEX_MCP_TOML = [
192
- `[mcp_servers.${LOCAL_MCP_PACKAGE}]`,
193
- `command = ${JSON.stringify(LOCAL_MCP_COMMAND)}`,
194
- `args = [${LOCAL_MCP_ARGS.map((arg) => JSON.stringify(arg)).join(", ")}]`,
195
- ].join("\n");
196
- /**
197
- * Claude Code's one-command hosted-MCP connect (`claude mcp add`). Parameterized
198
- * by the hosted endpoint so the dashboard can point it at the runtime-derived
199
- * endpoint while the marketing site passes the prod constant.
200
- */
201
- export function buildClaudeMcpAddCommand(mcpEndpoint) {
202
- return `claude mcp add --transport http ${LOCAL_MCP_PACKAGE} ${mcpEndpoint}`;
203
- }
204
- /**
205
- * Codex's hosted-MCP connect. `codex mcp add` registers the server; OAuth is a
206
- * separate `codex mcp login` step, so both are chained — a bare `add` leaves the
207
- * connection unauthenticated and the tools 401.
208
- */
209
- export function buildCodexMcpAddCommand(mcpEndpoint) {
210
- return `codex mcp add ${LOCAL_MCP_PACKAGE} --url ${mcpEndpoint} && codex mcp login ${LOCAL_MCP_PACKAGE}`;
211
- }
212
- /**
213
- * Hermes's hosted-MCP connect (`hermes mcp add --url`), the form NousResearch's
214
- * hermes-agent MCP guide documents. `--auth oauth` opts the hosted server into
215
- * the browser sign-in flow; unlike Codex there is no separate login command.
216
- */
217
- export function buildHermesMcpAddCommand(mcpEndpoint) {
218
- return `hermes mcp add ${LOCAL_MCP_PACKAGE} --url ${mcpEndpoint} --auth oauth`;
219
- }
220
- /**
221
- * OpenClaw's hosted-MCP connect (`openclaw mcp add`), the form
222
- * docs.openclaw.ai/cli/mcp documents: `--transport streamable-http` is required
223
- * (no auto-detection), `--auth oauth` opts into OAuth. Sign-in is a separate
224
- * two-step `openclaw mcp login <name>` (prints an auth URL, then `--code`), so
225
- * setup copy must not promise a single-command flow.
226
- */
227
- export function buildOpenclawMcpAddCommand(mcpEndpoint) {
228
- return `openclaw mcp add ${LOCAL_MCP_PACKAGE} --url ${mcpEndpoint} --transport streamable-http --auth oauth`;
229
- }
230
- /**
231
- * The per-agent connect catalog, parameterized by the hosted MCP endpoint.
232
- * Every one-click and copy-config path carries the hosted endpoint (OAuth,
233
- * nothing to install); on-device stdio is the CLI users' alternative and
234
- * lives in the docs/marketing setup lanes, not here.
235
- */
18
+ /** The per-agent connect catalog, parameterized by the hosted MCP endpoint. */
236
19
  export function buildConnectTargets({ mcpEndpoint }) {
237
- const cursorConfigJson = JSON.stringify(cursorHostedMcpServersJson(mcpEndpoint), null, 2);
238
- const vscodeHostedConfigJson = JSON.stringify(vscodeHostedMcpServersJson(mcpEndpoint), null, 2);
239
- return [
240
- {
241
- // The plugin is the recommended lane for CLI agents that support one:
242
- // one paste ships the publish skill AND the MCP servers (hosted primary)
243
- // and stays updated through the marketplace. `claude mcp add` remains
244
- // the minimal MCP-only path in the config slot and on /agents.
245
- id: "claude-code",
246
- name: agentProductName("claude-code"),
247
- blurb: "One paste installs the plugin: publish skill plus MCP, updated from the marketplace.",
248
- primary: {
249
- label: "Install plugin",
250
- value: `${spacefastClaudePluginAddCommand} && ${spacefastClaudePluginInstallCommand}`,
251
- language: "bash",
252
- },
253
- config: {
254
- label: "MCP only: claude mcp add",
255
- value: buildClaudeMcpAddCommand(mcpEndpoint),
256
- language: "bash",
257
- },
258
- },
259
- {
260
- id: "cursor",
261
- name: agentProductName("cursor"),
262
- blurb: "One click adds hosted MCP. Approve once in the browser, nothing to install.",
263
- deeplink: { href: cursorHostedMcpDeeplink(mcpEndpoint), label: "Add to Cursor" },
264
- config: { label: "~/.cursor/mcp.json", value: cursorConfigJson, language: "json" },
265
- },
266
- {
267
- id: "vscode",
268
- name: agentProductName("vscode"),
269
- blurb: "One click adds hosted MCP for Copilot agent mode.",
270
- deeplink: { href: vscodeHostedMcpDeeplink(mcpEndpoint), label: "Add to VS Code" },
271
- config: { label: ".vscode/mcp.json", value: vscodeHostedConfigJson, language: "json" },
272
- },
273
- {
274
- id: "codex",
275
- name: agentProductName("codex"),
276
- blurb: "One paste installs the plugin: publish skill plus MCP, updated from the marketplace.",
277
- primary: {
278
- label: "Install plugin",
279
- value: `${spacefastCodexPluginAddCommand} && ${spacefastCodexPluginInstallCommand}`,
280
- language: "bash",
281
- },
282
- config: {
283
- label: "MCP only: codex mcp add",
284
- value: buildCodexMcpAddCommand(mcpEndpoint),
285
- language: "bash",
286
- },
287
- },
288
- {
289
- id: "claude",
290
- name: agentProductName("claude"),
291
- blurb: "Settings → Connectors → Add custom connector, paste this endpoint. Or grab the desktop extension.",
292
- primary: { label: "MCP endpoint", value: mcpEndpoint, language: "text" },
293
- download: {
294
- href: "https://github.com/spacefast/plugins/releases/latest/download/claude-desktop.mcpb",
295
- label: "Download desktop extension",
296
- },
297
- },
298
- {
299
- id: "chatgpt",
300
- name: agentProductName("chatgpt"),
301
- blurb: "Turn on Developer mode (Settings → Apps & Connectors → Advanced), then Connectors → Create with this endpoint.",
302
- primary: { label: "MCP endpoint", value: mcpEndpoint, language: "text" },
303
- },
304
- ];
20
+ const context = {
21
+ apiOrigin: "https://api.spacefast.com",
22
+ dashboardOrigin: "https://my.spacefast.com",
23
+ mcpEndpoint,
24
+ wwwOrigin: "https://spacefast.com",
25
+ };
26
+ return AGENT_REGISTRY.map((agent) => {
27
+ const presented = presentAgentEntry(agent.id, context);
28
+ // The registry already ranks the interactive lane, and it never leads with a
29
+ // listing that has nothing to run, so the first method is the card's action.
30
+ const primaryMethod = presented.methods[0];
31
+ const action = primaryMethod?.action;
32
+ const configMethod = agent.methods.find((method) => method.kind === "config");
33
+ const downloadMethod = agent.methods.find((method) => method.kind === "download");
34
+ const target = {
35
+ id: agent.id,
36
+ name: agent.name,
37
+ blurb: agent.description,
38
+ };
39
+ if (action?.kind === "link") {
40
+ target.deeplink = { href: action.value, label: action.label };
41
+ }
42
+ else if (action?.kind === "copy") {
43
+ target.primary = {
44
+ label: action.label,
45
+ value: action.value,
46
+ language: connectCopyLanguage(primaryMethod?.language),
47
+ };
48
+ }
49
+ if (configMethod?.kind === "config") {
50
+ target.config = {
51
+ label: configMethod.label,
52
+ value: configMethod.build(context),
53
+ language: connectCopyLanguage(configMethod.language),
54
+ };
55
+ }
56
+ if (downloadMethod?.kind === "download") {
57
+ target.download = {
58
+ href: downloadMethod.url(context),
59
+ label: downloadMethod.label,
60
+ };
61
+ }
62
+ return target;
63
+ });
64
+ }
65
+ function connectCopyLanguage(language) {
66
+ if (language === "json" || language === "jsonc")
67
+ return "json";
68
+ if (language === "toml")
69
+ return "toml";
70
+ if (language === "bash")
71
+ return "bash";
72
+ return "text";
305
73
  }
306
74
  export function getConnectTarget(id, options) {
307
75
  const target = buildConnectTargets(options).find((entry) => entry.id === id);
@@ -19,7 +19,7 @@ export type AgentTokenExchangeResult = {
19
19
  accessToken: string;
20
20
  expiresIn: number;
21
21
  };
22
- /** Parse private-key agent credentials using the established bundled-over-split env precedence. */
22
+ /** Parse private-key agent credentials using the bundled-over-split env precedence. */
23
23
  export declare function readAgentAuthConfig(env: AgentAuthEnvironment, apiUrl: string): AgentAuthConfig | null;
24
24
  export declare function resolveAgentApiAuthorization(config: AgentAuthConfig, apiUrl: string): {
25
25
  resources: string[];
@@ -34,3 +34,33 @@ export declare function exchangeAgentAccessToken(input: {
34
34
  createInvalidConfigError?: ((message: string) => Error) | undefined;
35
35
  fetch?: typeof globalThis.fetch | undefined;
36
36
  }): Promise<AgentTokenExchangeResult>;
37
+ export type CachedAgentTokenRequest = {
38
+ apiUrl: string;
39
+ /** `x-spacefast-client` attribution for the exchange. Not part of the cache key. */
40
+ client: string;
41
+ config: AgentAuthConfig;
42
+ signal: AbortSignal;
43
+ };
44
+ export type CachedAgentTokenProvider = {
45
+ /** The cached access token for this authorization, exchanging one when needed. */
46
+ accessToken: (request: CachedAgentTokenRequest) => Promise<string>;
47
+ /** Drop the cached token so the next call re-exchanges. Call this on a 401. */
48
+ invalidate: () => void;
49
+ };
50
+ /**
51
+ * One agent access token held across calls instead of re-exchanged per request.
52
+ *
53
+ * The client-credentials grant is a signed round trip to the token endpoint, and
54
+ * an agent identity issues the same token for the same authorization until it
55
+ * expires: paying for it on every command (the CLI) or every tool call (the MCP
56
+ * server) buys nothing. The cache key is the authorization itself — client,
57
+ * endpoint, and the scope/resources {@link resolveAgentApiAuthorization} settled
58
+ * on — so pointing a process at a second API never replays the first one's
59
+ * bearer.
60
+ */
61
+ export declare function createCachedAgentTokenProvider(options: {
62
+ createError: (input: AgentTokenExchangeErrorInput) => Error;
63
+ createInvalidConfigError?: ((message: string) => Error) | undefined;
64
+ fetch?: typeof globalThis.fetch | undefined;
65
+ now?: (() => number) | undefined;
66
+ }): CachedAgentTokenProvider;