@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.
- package/dist/agents/connect-targets.d.ts +6 -146
- package/dist/agents/connect-targets.js +63 -295
- package/dist/agents/private-key-oauth.d.ts +31 -1
- package/dist/agents/private-key-oauth.js +124 -33
- package/dist/agents/registry/core.d.ts +292 -0
- package/dist/agents/registry/core.js +1388 -0
- package/dist/agents/registry/deeplink-probes.d.ts +23 -0
- package/dist/agents/registry/deeplink-probes.js +18 -0
- package/dist/agents/registry/node.d.ts +56 -0
- package/dist/agents/registry/node.js +339 -0
- package/dist/brand-assets-build.js +1 -2
- package/dist/brand-assets.js +4 -7
- package/dist/brand.d.ts +17 -0
- package/dist/brand.js +24 -4
- package/dist/config/domains.d.ts +55 -28
- package/dist/config/domains.js +85 -41
- package/dist/config/index.js +1 -2
- package/dist/contracts/abuse.js +9 -24
- package/dist/contracts/access-profiles.d.ts +86 -0
- package/dist/contracts/access-profiles.js +89 -0
- package/dist/contracts/access.d.ts +21 -27
- package/dist/contracts/access.js +33 -64
- package/dist/contracts/activity.d.ts +18 -1
- package/dist/contracts/activity.js +70 -26
- package/dist/contracts/analytics.js +8 -10
- package/dist/contracts/api-keys.d.ts +77 -52
- package/dist/contracts/api-keys.js +44 -24
- package/dist/contracts/application-journal.d.ts +216 -0
- package/dist/contracts/application-journal.js +167 -0
- package/dist/contracts/auth.d.ts +90 -17
- package/dist/contracts/auth.js +86 -17
- package/dist/contracts/beta.d.ts +9 -4
- package/dist/contracts/beta.js +20 -16
- package/dist/contracts/billing.js +7 -11
- package/dist/contracts/bootstrap.d.ts +791 -0
- package/dist/contracts/bootstrap.js +51 -0
- package/dist/contracts/builds.d.ts +192 -7
- package/dist/contracts/builds.js +84 -21
- package/dist/contracts/channels.d.ts +43 -0
- package/dist/contracts/channels.js +25 -9
- package/dist/contracts/cli.d.ts +7 -0
- package/dist/contracts/cli.js +6 -0
- package/dist/contracts/collab-public.d.ts +1 -1
- package/dist/contracts/collab-public.js +5 -8
- package/dist/contracts/comments.d.ts +45 -35
- package/dist/contracts/comments.js +107 -77
- package/dist/contracts/commerce.d.ts +165 -0
- package/dist/contracts/commerce.js +146 -0
- package/dist/contracts/common.d.ts +3 -3
- package/dist/contracts/common.js +18 -29
- package/dist/contracts/content-contract-verification.d.ts +521 -0
- package/dist/contracts/content-contract-verification.js +320 -0
- package/dist/contracts/content-platform-fixture.d.ts +1278 -0
- package/dist/contracts/content-platform-fixture.js +44 -0
- package/dist/contracts/content-program.d.ts +994 -0
- package/dist/contracts/content-program.js +658 -0
- package/dist/contracts/content-sync.d.ts +290 -0
- package/dist/contracts/content-sync.js +167 -0
- package/dist/contracts/content.d.ts +432 -0
- package/dist/contracts/content.js +303 -0
- package/dist/contracts/continuation.d.ts +17 -1
- package/dist/contracts/continuation.js +23 -23
- package/dist/contracts/countries.js +3 -4
- package/dist/contracts/crons.d.ts +17 -0
- package/dist/contracts/crons.js +33 -15
- package/dist/contracts/dashboard-prefs.d.ts +56 -0
- package/dist/contracts/dashboard-prefs.js +51 -0
- package/dist/contracts/device-auth.d.ts +234 -37
- package/dist/contracts/device-auth.js +267 -53
- package/dist/contracts/docs.d.ts +6 -10
- package/dist/contracts/docs.js +5 -13
- package/dist/contracts/domains.d.ts +499 -102
- package/dist/contracts/domains.js +169 -58
- package/dist/contracts/email-preferences.d.ts +3 -3
- package/dist/contracts/email-preferences.js +6 -7
- package/dist/contracts/enums.d.ts +26 -26
- package/dist/contracts/enums.js +61 -54
- package/dist/contracts/error-code-meta.d.ts +273 -7
- package/dist/contracts/error-code-meta.js +81 -5
- package/dist/contracts/error-codes.d.ts +5 -5
- package/dist/contracts/error-codes.js +79 -16
- package/dist/contracts/events.d.ts +100 -20
- package/dist/contracts/events.js +107 -20
- package/dist/contracts/execution.d.ts +47 -66
- package/dist/contracts/execution.js +51 -64
- package/dist/contracts/feature-lifecycle.d.ts +70 -14
- package/dist/contracts/feature-lifecycle.js +86 -15
- package/dist/contracts/features.d.ts +100 -37
- package/dist/contracts/features.js +21 -27
- package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
- package/dist/contracts/frame-session.d.ts +192 -0
- package/dist/contracts/frame-session.js +164 -0
- package/dist/contracts/functions.d.ts +218 -211
- package/dist/contracts/functions.js +273 -260
- package/dist/contracts/grant-copy.d.ts +43 -0
- package/dist/contracts/grant-copy.js +44 -0
- package/dist/contracts/grants.d.ts +64 -56
- package/dist/contracts/grants.js +124 -23
- package/dist/contracts/ids.d.ts +4 -1
- package/dist/contracts/ids.js +4 -1
- package/dist/contracts/internal.d.ts +5 -4
- package/dist/contracts/internal.js +12 -3
- package/dist/contracts/mcp.d.ts +17 -0
- package/dist/contracts/mcp.js +23 -0
- package/dist/contracts/me.d.ts +6 -1
- package/dist/contracts/me.js +12 -6
- package/dist/contracts/notifications.d.ts +27 -29
- package/dist/contracts/notifications.js +9 -4
- package/dist/contracts/oauth-resources.d.ts +121 -10
- package/dist/contracts/oauth-resources.js +130 -11
- package/dist/contracts/oauth-scope-actions.d.ts +90 -0
- package/dist/contracts/oauth-scope-actions.js +126 -0
- package/dist/contracts/operations.d.ts +27 -4
- package/dist/contracts/operations.js +11 -5
- package/dist/contracts/pages.d.ts +29 -5
- package/dist/contracts/pages.js +22 -5
- package/dist/contracts/partner-notifications.d.ts +3 -0
- package/dist/contracts/partner-notifications.js +65 -0
- package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
- package/dist/contracts/{platform.js → partner.js} +27 -40
- package/dist/contracts/plan-policy.d.ts +1 -1
- package/dist/contracts/principal-assertion.d.ts +43 -0
- package/dist/contracts/principal-assertion.js +67 -0
- package/dist/contracts/principals.d.ts +73 -0
- package/dist/contracts/principals.js +59 -0
- package/dist/contracts/privacy.d.ts +11 -0
- package/dist/contracts/privacy.js +17 -0
- package/dist/contracts/problem-document.js +3 -4
- package/dist/contracts/publish-archive.d.ts +116 -18
- package/dist/contracts/publish-archive.js +6 -3
- package/dist/contracts/push-new.d.ts +4 -4
- package/dist/contracts/quotas.js +3 -3
- package/dist/contracts/realtime.d.ts +52 -0
- package/dist/contracts/realtime.js +54 -0
- package/dist/contracts/repository-connections.d.ts +1 -1
- package/dist/contracts/repository-connections.js +6 -2
- package/dist/contracts/resources.d.ts +105 -14
- package/dist/contracts/resources.js +145 -21
- package/dist/contracts/route-inventory.d.ts +358 -0
- package/dist/contracts/route-inventory.js +141 -0
- package/dist/contracts/runtime-api.d.ts +112 -35
- package/dist/contracts/runtime-api.js +86 -66
- package/dist/contracts/runtime-app.d.ts +11 -21
- package/dist/contracts/runtime-app.js +39 -24
- package/dist/contracts/runtime-components.d.ts +143 -0
- package/dist/contracts/runtime-components.js +199 -0
- package/dist/contracts/runtime-db.d.ts +45 -19
- package/dist/contracts/runtime-db.js +85 -20
- package/dist/contracts/runtime-purge.js +3 -5
- package/dist/contracts/runtime-services.d.ts +43 -75
- package/dist/contracts/runtime-services.js +29 -49
- package/dist/contracts/runtime-storage.d.ts +14 -14
- package/dist/contracts/runtime-storage.js +28 -13
- package/dist/contracts/sf-config-v1.d.ts +14 -18
- package/dist/contracts/slugs.js +13 -4
- package/dist/contracts/space-config.d.ts +235 -28
- package/dist/contracts/space-config.js +246 -91
- package/dist/contracts/spaces.d.ts +360 -255
- package/dist/contracts/spaces.js +190 -122
- package/dist/contracts/superadmin-activity.d.ts +3 -43
- package/dist/contracts/superadmin-activity.js +6 -30
- package/dist/contracts/superadmin-emails.d.ts +1 -0
- package/dist/contracts/superadmin-emails.js +17 -1
- package/dist/contracts/superadmin-runtime.d.ts +199 -0
- package/dist/contracts/superadmin-runtime.js +141 -0
- package/dist/contracts/superadmin-search.d.ts +22 -2
- package/dist/contracts/superadmin-search.js +14 -6
- package/dist/contracts/superadmin-spaces.d.ts +435 -186
- package/dist/contracts/superadmin-spaces.js +131 -25
- package/dist/contracts/superadmin-teams.d.ts +3 -0
- package/dist/contracts/superadmin-teams.js +1 -2
- package/dist/contracts/superadmin-tenants.d.ts +627 -6
- package/dist/contracts/superadmin-tenants.js +32 -7
- package/dist/contracts/superadmin.d.ts +98 -16
- package/dist/contracts/superadmin.js +63 -10
- package/dist/contracts/tags.d.ts +85 -58
- package/dist/contracts/tags.js +44 -34
- package/dist/contracts/teams.d.ts +72 -9
- package/dist/contracts/teams.js +84 -25
- package/dist/contracts/tenants.d.ts +135 -0
- package/dist/contracts/tenants.js +120 -0
- package/dist/contracts/test-triggers.d.ts +70 -0
- package/dist/contracts/test-triggers.js +116 -0
- package/dist/contracts/theme-json.js +3 -8
- package/dist/contracts/transfers.d.ts +1 -0
- package/dist/contracts/transfers.js +1 -0
- package/dist/contracts/usage.d.ts +209 -0
- package/dist/contracts/usage.js +124 -12
- package/dist/contracts/variables.d.ts +2 -2
- package/dist/contracts/variables.js +9 -13
- package/dist/contracts/webhooks.d.ts +13 -5
- package/dist/contracts/webhooks.js +3 -1
- package/dist/contracts/zero.d.ts +57 -64
- package/dist/contracts/zero.js +68 -66
- package/dist/dashboard-paths/index.d.ts +24 -21
- package/dist/dashboard-paths/index.js +35 -47
- package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
- package/dist/dashboard-paths/route-reservations.generated.js +36 -0
- package/dist/docs/agent-arrival.d.ts +92 -0
- package/dist/docs/agent-arrival.js +227 -0
- package/dist/docs/agent-output-policy.d.ts +6 -0
- package/dist/docs/agent-output-policy.js +22 -0
- package/dist/docs/agent-prose.d.ts +11 -17
- package/dist/docs/agent-prose.js +62 -37
- package/dist/docs/agent-setup.d.ts +72 -41
- package/dist/docs/agent-setup.js +336 -436
- package/dist/docs/catalog.d.ts +147 -89
- package/dist/docs/catalog.js +157 -42
- package/dist/docs/error-docs.d.ts +2102 -1
- package/dist/docs/error-docs.js +285 -16
- package/dist/docs/index-build.d.ts +0 -1
- package/dist/docs/index-build.js +2 -3
- package/dist/docs/page-context-prompt.d.ts +77 -0
- package/dist/docs/page-context-prompt.js +131 -0
- package/dist/docs/reference-urls.d.ts +46 -0
- package/dist/docs/reference-urls.js +79 -0
- package/dist/docs/search.d.ts +6 -8
- package/dist/docs/search.js +10 -13
- package/dist/docs/skill-distribution.d.ts +4 -1
- package/dist/docs/skill-distribution.js +10 -5
- package/dist/docs/skills.d.ts +117 -117
- package/dist/docs/skills.js +120 -72
- package/dist/docs/start-prompts.d.ts +45 -0
- package/dist/docs/start-prompts.js +62 -0
- package/dist/domain-exploration.js +9 -13
- package/dist/og-template.d.ts +56 -0
- package/dist/og-template.js +56 -0
- package/dist/slug-policy/index.js +5 -11
- package/dist/utils/browser-credential.d.ts +13 -6
- package/dist/utils/browser-credential.js +14 -7
- package/dist/utils/build-settings.d.ts +16 -0
- package/dist/utils/build-settings.js +63 -17
- package/dist/utils/canonical-json.d.ts +3 -5
- package/dist/utils/canonical-json.js +3 -5
- package/dist/utils/cast-transport.d.ts +5 -17
- package/dist/utils/cast-transport.js +6 -19
- package/dist/utils/claim-token.js +1 -2
- package/dist/utils/comment-avatars.js +4 -6
- package/dist/utils/concurrency.js +2 -3
- package/dist/utils/content-type.d.ts +7 -6
- package/dist/utils/content-type.js +73 -51
- package/dist/utils/credential-policy.d.ts +50 -6
- package/dist/utils/credential-policy.js +123 -57
- package/dist/utils/egress-policy.fixtures.json +1 -1
- package/dist/utils/generate-space-name.d.ts +3 -8
- package/dist/utils/generate-space-name.js +3 -8
- package/dist/utils/grants.d.ts +0 -1
- package/dist/utils/grants.js +4 -7
- package/dist/utils/gravatar.d.ts +2 -4
- package/dist/utils/gravatar.js +6 -12
- package/dist/utils/id-hints.js +14 -23
- package/dist/utils/idempotency.d.ts +3 -3
- package/dist/utils/idempotency.js +6 -7
- package/dist/utils/local-space-state.d.ts +15 -15
- package/dist/utils/local-space-state.js +34 -23
- package/dist/utils/oauth-signed-query.d.ts +3 -5
- package/dist/utils/oauth-signed-query.js +6 -9
- package/dist/utils/one-shot-replay.d.ts +3 -5
- package/dist/utils/one-shot-replay.js +3 -5
- package/dist/utils/page-colors.d.ts +4 -10
- package/dist/utils/page-colors.js +11 -35
- package/dist/utils/page-fonts.js +6 -11
- package/dist/utils/page-preview.d.ts +0 -1
- package/dist/utils/page-preview.js +0 -1
- package/dist/utils/pages.d.ts +22 -11
- package/dist/utils/pages.js +70 -30
- package/dist/utils/privacy-regions.d.ts +19 -0
- package/dist/utils/privacy-regions.js +91 -0
- package/dist/utils/publish-form-data.d.ts +4 -5
- package/dist/utils/publish-form-data.js +2 -3
- package/dist/utils/publish-policy.d.ts +10 -23
- package/dist/utils/publish-policy.js +63 -116
- package/dist/utils/query-client.d.ts +2 -0
- package/dist/utils/query-client.js +10 -1
- package/dist/utils/runtime-paths.d.ts +4 -4
- package/dist/utils/runtime-paths.js +6 -8
- package/dist/utils/runtime-upload.d.ts +4 -0
- package/dist/utils/runtime-upload.js +5 -0
- package/dist/utils/secure-local-file.d.ts +3 -3
- package/dist/utils/secure-local-file.js +18 -24
- package/dist/utils/space-config.d.ts +11 -14
- package/dist/utils/space-config.js +10 -16
- package/dist/utils/static-runtime-policy.d.ts +5 -8
- package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
- package/dist/utils/static-runtime-policy.generated.js +70 -0
- package/dist/utils/static-runtime-policy.js +17 -84
- package/dist/utils/storage-policy.js +1 -2
- package/dist/utils/upload-session.js +8 -14
- package/dist/utils/version-path.js +11 -19
- package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
- package/dist/utils/wpcom-auth-redirects.js +1 -4
- package/dist/vocabulary.d.ts +7 -7
- package/dist/vocabulary.js +30 -16
- package/package.json +14 -2
- package/dist/agents/client-registry.d.ts +0 -22
- package/dist/agents/client-registry.js +0 -41
- package/dist/docs/agent-handoff-document.d.ts +0 -15
- package/dist/docs/agent-handoff-document.js +0 -180
- package/dist/docs/agent-solutions.d.ts +0 -110
- package/dist/docs/agent-solutions.js +0 -183
- package/dist/utils/query-keys.d.ts +0 -84
- package/dist/utils/query-keys.js +0 -108
|
@@ -1,141 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export
|
|
3
|
-
export type
|
|
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:
|
|
44
|
+
export declare function getConnectTarget(id: string, options: {
|
|
185
45
|
mcpEndpoint: string;
|
|
186
46
|
}): ConnectTarget;
|
|
@@ -1,307 +1,75 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
2
|
+
* The connect-card projection of the agent registry.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
-
*
|
|
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 {
|
|
16
|
-
|
|
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
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
{
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
{
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
|
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;
|