@superblocksteam/gateway 2.0.0-SNAPSHOT.eb2b4fee8d75a1b5 → 2.0.0-SNAPSHOT.f91d18efcff68198
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/README.md +46 -42
- package/dist/agents/resolve-orchestrator-url.d.ts +37 -1
- package/dist/agents/resolve-orchestrator-url.js +127 -13
- package/dist/agents/resolve-orchestrator-url.js.map +1 -1
- package/dist/capabilities/integration-metadata.d.ts +3 -0
- package/dist/capabilities/integration-metadata.js +34 -11
- package/dist/capabilities/integration-metadata.js.map +1 -1
- package/dist/capabilities/lifecycle.d.ts +23 -1
- package/dist/capabilities/lifecycle.js +168 -46
- package/dist/capabilities/lifecycle.js.map +1 -1
- package/dist/capabilities/query-integration.d.ts +5 -0
- package/dist/capabilities/query-integration.js +61 -18
- package/dist/capabilities/query-integration.js.map +1 -1
- package/dist/capabilities/types.d.ts +19 -22
- package/dist/capabilities/types.js.map +1 -1
- package/dist/capture/browser-contract.d.ts +1 -1
- package/dist/capture/browser-contract.js +1 -1
- package/dist/capture/browser-contract.js.map +1 -1
- package/dist/config.d.ts +2 -10
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/deps.d.ts +5 -13
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/profile-key.d.ts +50 -6
- package/dist/integrations/profile-key.js +101 -22
- package/dist/integrations/profile-key.js.map +1 -1
- package/dist/integrations/resolve-profile.d.ts +30 -0
- package/dist/integrations/resolve-profile.js +104 -0
- package/dist/integrations/resolve-profile.js.map +1 -0
- package/dist/orchestrator/client.d.ts +1 -1
- package/dist/orchestrator/client.js +1 -1
- package/dist/orchestrator/client.js.map +1 -1
- package/dist/preview/capture-screenshot.d.ts +12 -1
- package/dist/preview/capture-screenshot.js +34 -5
- package/dist/preview/capture-screenshot.js.map +1 -1
- package/dist/sabs/app-state.d.ts +1 -0
- package/dist/sabs/app-state.js +8 -0
- package/dist/sabs/app-state.js.map +1 -1
- package/dist/sabs/editor-client-methods.d.ts +7 -3
- package/dist/sabs/editor-client-methods.js +28 -4
- package/dist/sabs/editor-client-methods.js.map +1 -1
- package/dist/sabs/editor-socket.d.ts +2 -1
- package/dist/sabs/editor-socket.js +4 -1
- package/dist/sabs/editor-socket.js.map +1 -1
- package/dist/sabs/recent-tool-runs.d.ts +1 -1
- package/dist/sabs/recent-tool-runs.js +2 -2
- package/dist/sabs/recent-tool-runs.js.map +1 -1
- package/dist/sabs/session-peer.d.ts +1 -0
- package/dist/sabs/turn-collector.d.ts +2 -3
- package/dist/sabs/turn-collector.js +7 -15
- package/dist/sabs/turn-collector.js.map +1 -1
- package/dist/sabs/websocket-session-peer.d.ts +50 -8
- package/dist/sabs/websocket-session-peer.js +330 -76
- package/dist/sabs/websocket-session-peer.js.map +1 -1
- package/dist/server/client.d.ts +72 -15
- package/dist/server/client.js +407 -51
- package/dist/server/client.js.map +1 -1
- package/dist/start.d.ts +11 -3
- package/dist/start.js +102 -20
- package/dist/start.js.map +1 -1
- package/dist/telemetry/mcp-client.d.ts +6 -1
- package/dist/telemetry/mcp-client.js +90 -5
- package/dist/telemetry/mcp-client.js.map +1 -1
- package/dist/telemetry/metrics.d.ts +14 -0
- package/dist/telemetry/metrics.js +25 -0
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry/runtime.d.ts +4 -0
- package/dist/telemetry/runtime.js +21 -9
- package/dist/telemetry/runtime.js.map +1 -1
- package/dist/transports/mcp/admin-tools.d.ts +1 -1
- package/dist/transports/mcp/admin-tools.js +19 -3
- package/dist/transports/mcp/admin-tools.js.map +1 -1
- package/dist/transports/mcp/app-status-html.d.ts +2 -2
- package/dist/transports/mcp/app-status-html.js +8 -6
- package/dist/transports/mcp/app-status-html.js.map +1 -1
- package/dist/transports/mcp/cowork-editor-url.d.ts +1 -1
- package/dist/transports/mcp/cowork-editor-url.js +1 -1
- package/dist/transports/mcp/decision-elicitation.d.ts +2 -2
- package/dist/transports/mcp/decision-elicitation.js +2 -2
- package/dist/transports/mcp/format-tool-content.js +88 -3
- package/dist/transports/mcp/format-tool-content.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/ask-user.js +5 -2
- package/dist/transports/mcp/instructions/tools/ask-user.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/build-app.d.ts +4 -0
- package/dist/transports/mcp/instructions/tools/build-app.js +54 -0
- package/dist/transports/mcp/instructions/tools/build-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.js +11 -2
- package/dist/transports/mcp/instructions/tools/check-app-progress.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/copy.d.ts +8 -2
- package/dist/transports/mcp/instructions/tools/copy.js +47 -3
- package/dist/transports/mcp/instructions/tools/copy.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/create-integration.js +2 -2
- package/dist/transports/mcp/instructions/tools/create-integration.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/edit-app.d.ts +2 -1
- package/dist/transports/mcp/instructions/tools/edit-app.js +6 -3
- package/dist/transports/mcp/instructions/tools/edit-app.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/get-app.js +6 -4
- package/dist/transports/mcp/instructions/tools/get-app.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.js +3 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/index.js +7 -2
- package/dist/transports/mcp/instructions/tools/index.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/start-app.d.ts +2 -1
- package/dist/transports/mcp/instructions/tools/start-app.js +6 -3
- package/dist/transports/mcp/instructions/tools/start-app.js.map +1 -1
- package/dist/transports/mcp/instructions/tools/upload-artifact.js +2 -2
- package/dist/transports/mcp/instructions/tools/upload-artifact.js.map +1 -1
- package/dist/transports/mcp/mount.d.ts +1 -1
- package/dist/transports/mcp/mount.js +391 -137
- package/dist/transports/mcp/mount.js.map +1 -1
- package/dist/transports/mcp/native-browser-presence.d.ts +1 -1
- package/dist/transports/mcp/native-browser-presence.js +1 -1
- package/dist/transports/mcp/plan-approval.d.ts +29 -0
- package/dist/transports/mcp/plan-approval.js +72 -18
- package/dist/transports/mcp/plan-approval.js.map +1 -1
- package/dist/transports/mcp/tool-names.d.ts +1 -1
- package/package.json +9 -5
- package/skills/superblocks-import/SKILL.md +55 -18
- package/dist/transports/mcp/instructions/tools/preview-app.d.ts +0 -3
- package/dist/transports/mcp/instructions/tools/preview-app.js +0 -14
- package/dist/transports/mcp/instructions/tools/preview-app.js.map +0 -1
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@ over **stdio**, running as the Superblocks user authenticated through browser
|
|
|
5
5
|
login or a personal API key.
|
|
6
6
|
|
|
7
7
|
Builder tools (`upload_artifact`, `start_app`, `edit_app`,
|
|
8
|
-
`check_app_progress`, `ask_user`, `get_app`, `
|
|
9
|
-
`
|
|
10
|
-
`@superblocksteam/mcp-server` share this process.
|
|
8
|
+
`check_app_progress`, `ask_user`, `get_app`, `build_app`,
|
|
9
|
+
`get_preview_status`, `get_integration_metadata`, `publish_app`) plus customer
|
|
10
|
+
Admin tools from `@superblocksteam/mcp-server` share this process.
|
|
11
11
|
|
|
12
12
|
The MCP host owns process lifecycle: it spawns `superblocks mcp serve`. The
|
|
13
13
|
unified Gateway has no foreground HTTP `/mcp`, no OAuth resource server, and no
|
|
@@ -35,35 +35,22 @@ Add the Superblocks marketplace and install the plugin from inside Claude Code:
|
|
|
35
35
|
/plugin install superblocks@superblocks
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
The plugin includes Gateway and the `superblocks-import` skill.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
`mcp serve --browser-login`, reuses a saved browser session when possible, and
|
|
43
|
-
opens the browser when sign-in is needed. Your instance must have browser login
|
|
44
|
-
configured as described below. The npm-backed plugin requires Node.js 24 or newer
|
|
45
|
-
and npm 10 or newer.
|
|
38
|
+
The plugin includes Gateway and the `superblocks-import` skill. When prompted,
|
|
39
|
+
enter a Superblocks personal API key and your Superblocks instance URL. Claude
|
|
40
|
+
stores the API key in secure storage. The npm-backed plugin requires Node.js 24
|
|
41
|
+
or newer and npm 10 or newer.
|
|
46
42
|
|
|
47
43
|
## Claude Cowork plugin
|
|
48
44
|
|
|
49
|
-
For
|
|
45
|
+
For a local desktop Cowork session:
|
|
50
46
|
|
|
51
|
-
1.
|
|
47
|
+
1. Install Node.js 24 or newer and npm 10 or newer.
|
|
52
48
|
2. Download [the Cowork plugin](https://unpkg.com/@superblocksteam/cli@beta/dist/superblocks.plugin).
|
|
53
49
|
3. Open `Customize > Plugins`, choose upload, and select the plugin file.
|
|
54
|
-
4. Enter
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
The archive starts `mcp serve --device-login` through an exact public CLI version.
|
|
60
|
-
Its `authenticate` tool returns a browser verification link and code while the
|
|
61
|
-
plugin polls Auth0 in the background. After approval, the same running Gateway
|
|
62
|
-
uses the session; no loopback callback or terminal command is needed. Only the
|
|
63
|
-
link, code, expiration, and status reach Claude, never access or refresh tokens.
|
|
64
|
-
Sessions are stored under `${CLAUDE_PLUGIN_DATA}` and reused while that data persists.
|
|
65
|
-
Device sign-in requires the Auth0 native client device-code grant and API offline
|
|
66
|
-
access. Organization-bound Auth0 deployments are not supported by this flow.
|
|
50
|
+
4. Enter a Superblocks personal API key and your Superblocks instance URL.
|
|
51
|
+
|
|
52
|
+
The plugin starts Gateway on the desktop. It is unavailable in cloud Cowork
|
|
53
|
+
sessions, which cannot run local MCP servers.
|
|
67
54
|
|
|
68
55
|
### Organization-managed rollout
|
|
69
56
|
|
|
@@ -86,8 +73,8 @@ archive in a test marketplace before relying on it.
|
|
|
86
73
|
|
|
87
74
|
Superblocks supplies the archive and Gateway runtime. Claude organization Owners
|
|
88
75
|
control marketplace distribution and installation policy. Each member supplies
|
|
89
|
-
their Superblocks credentials;
|
|
90
|
-
permission to run
|
|
76
|
+
their Superblocks credentials; each desktop still needs Node.js, npm, and
|
|
77
|
+
permission to run local MCP servers. See [Anthropic's organization plugin guide](https://support.claude.com/en/articles/13837433-manage-plugins-for-your-organization).
|
|
91
78
|
|
|
92
79
|
## Internal review
|
|
93
80
|
|
|
@@ -224,8 +211,8 @@ superblocks mcp setup --client claude
|
|
|
224
211
|
```
|
|
225
212
|
|
|
226
213
|
The CLI reads public configuration from `GET /api/v1/mcp/oauth/config`, opens
|
|
227
|
-
the system browser, and receives an authorization code
|
|
228
|
-
`http://127.0.0.1
|
|
214
|
+
the system browser, and receives an authorization code on an OS-assigned
|
|
215
|
+
`http://127.0.0.1:<port>/callback`. It exchanges that code with S256 PKCE and
|
|
229
216
|
requests `openid profile email offline_access`. Gateway uses the resulting
|
|
230
217
|
Server-audience access token directly; it does not retrieve a personal API key.
|
|
231
218
|
The MCP connection stays on stdio. The callback port is used only during login.
|
|
@@ -234,18 +221,23 @@ Credential selection, in order:
|
|
|
234
221
|
|
|
235
222
|
1. Nonblank `SUPERBLOCKS_API_TOKEN` (including a plugin-supplied personal key).
|
|
236
223
|
2. Saved browser login, provided it matches an explicit `SUPERBLOCKS_SERVER_URL`
|
|
237
|
-
or,
|
|
238
|
-
3. With `--
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
identity. Signing in manually or running `superblocks mcp logout` requires
|
|
224
|
+
or `SUPERBLOCKS_BASE_URL`. With neither set, its saved server URL is used.
|
|
225
|
+
3. With `--browser-login`, ask the user to call `Login` explicitly to open
|
|
226
|
+
browser sign-in. Without the flag, use the existing CLI personal-key session.
|
|
227
|
+
|
|
228
|
+
With `--browser-login`, an unusable matching browser session reports that
|
|
229
|
+
`Login` is required. No account-dependent tool opens browser sign-in on its own.
|
|
230
|
+
Without the flag, an unusable session reports an error instead of silently
|
|
231
|
+
changing identity. Signing in manually or running `superblocks mcp logout` requires
|
|
245
232
|
restarting the MCP host. Logout clears the local browser session only; it does
|
|
246
233
|
not clear the legacy CLI personal key, log out the browser, or revoke Auth0
|
|
247
234
|
credentials.
|
|
248
235
|
|
|
236
|
+
The plugin's `set_server` tool signs in to the chosen server, saves its URL with
|
|
237
|
+
the browser session, and updates the current Cowork task. When no browser
|
|
238
|
+
session or explicit server URL exists, browser sign-in defaults to
|
|
239
|
+
`https://app.superblocks.com`.
|
|
240
|
+
|
|
249
241
|
Browser credentials are stored at `~/.superblocks/auth.json.mcp-oauth`, or
|
|
250
242
|
`${SUPERBLOCKS_AUTH_FILE}.mcp-oauth` when the worktree override is set. The file
|
|
251
243
|
contains access and refresh tokens and is written atomically with owner-only
|
|
@@ -268,9 +260,9 @@ Configure each environment before enabling browser login:
|
|
|
268
260
|
1. Create a dedicated first-party native Auth0 application with
|
|
269
261
|
`token_endpoint_auth_method: none`, the `authorization_code` and `refresh_token`
|
|
270
262
|
grants, and callback `http://127.0.0.1:8485/callback`. No client secret belongs
|
|
271
|
-
in the CLI or plugin.
|
|
272
|
-
|
|
273
|
-
|
|
263
|
+
in the CLI or plugin. Auth0's native loopback matching accepts the CLI's
|
|
264
|
+
runtime-selected port for this registered URI. Enable rotating refresh tokens
|
|
265
|
+
with expiration.
|
|
274
266
|
2. Enable offline access on the Server API audience (normally
|
|
275
267
|
`https://superblocks/api`) and enable the sign-in connections this application
|
|
276
268
|
needs. Keep the existing connections' client assignments when adding it.
|
|
@@ -303,7 +295,8 @@ package only the customer Admin surface. Builder tools are not registered.
|
|
|
303
295
|
|
|
304
296
|
After `mcp setup`, restart Claude Code or Cursor and call `upload_artifact`,
|
|
305
297
|
`start_app`, `edit_app`, `check_app_progress`, `ask_user`, `get_app`,
|
|
306
|
-
`
|
|
298
|
+
`build_app`, `get_preview_status`, `get_integration_metadata`, and
|
|
299
|
+
`publish_app`.
|
|
307
300
|
|
|
308
301
|
`upload_artifact` accepts any file the gateway can read through `filePath` -
|
|
309
302
|
an archive, an image, a PDF, or a log - or source the MCP client is writing out
|
|
@@ -323,6 +316,17 @@ instructions require the host to write it out in chat as well - a host that
|
|
|
323
316
|
renders the card shows it instead of the tool text, and one that renders nothing
|
|
324
317
|
shows only the text.
|
|
325
318
|
|
|
319
|
+
`get_app` returns the current live development view without creating a commit or
|
|
320
|
+
starting a build. `build_app` is the explicit versioned-preview operation: use
|
|
321
|
+
it only when the user asks to build a commit preview, never automatically after
|
|
322
|
+
`start_app`, `edit_app`, or `get_app`. It creates a commit and starts or reuses
|
|
323
|
+
the build for that content, but does not publish the app or change its
|
|
324
|
+
permissions. If it returns `building`, carry its `applicationId`, `commitId`,
|
|
325
|
+
`directoryHash`, and optional `branch` into `get_preview_status`; do not call
|
|
326
|
+
`build_app` again to poll. The original `previewUrl` is the URL to use once the
|
|
327
|
+
status becomes `ready`. Call `publish_app` only when the user explicitly asks
|
|
328
|
+
to deploy the app.
|
|
329
|
+
|
|
326
330
|
`get_integration_metadata` reads tables, columns, and types from a connected
|
|
327
331
|
integration; use `search`, `limit`, and `offset` for large results. It needs no
|
|
328
332
|
application: without one it mints an
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
* Picks an orchestrator (agent) base URL the way the browser does: from the
|
|
3
3
|
* Server's agent inventory for the org, filtered by org agent type, Active
|
|
4
4
|
* status, and profile tags. Operators never set this URL.
|
|
5
|
+
*
|
|
6
|
+
* Cloud editor execute then ignores that inventory URL and posts to
|
|
7
|
+
* SUPERBLOCKS_UI_AGENT_BASE_URL (`https://agent.<env>.superblocks.com/` on
|
|
8
|
+
* SaaS, `https://agent.<zone>/` on cloud-prem). The cloud sentinel still
|
|
9
|
+
* advertises `https://<control-plane>/agent`, and nginx on that path returns
|
|
10
|
+
* 405 for POST /v2/execute and /v3/execute. Canonicalize those known-broken
|
|
11
|
+
* paths so Gateway hits the same host the browser uses.
|
|
5
12
|
*/
|
|
6
13
|
export type OrchestratorAgentCandidate = {
|
|
7
14
|
status: string;
|
|
@@ -12,8 +19,37 @@ export type OrchestratorAgentCandidate = {
|
|
|
12
19
|
export type PickOrchestratorBaseUrlInput = {
|
|
13
20
|
agentType: number;
|
|
14
21
|
agents: OrchestratorAgentCandidate[];
|
|
15
|
-
|
|
22
|
+
controlPlaneUrl?: string;
|
|
23
|
+
profileKey?: string;
|
|
16
24
|
};
|
|
25
|
+
/** Matches `@superblocksteam/shared` `AgentType.ONPREMISE`. */
|
|
26
|
+
export declare const AGENT_TYPE_ONPREMISE = 2;
|
|
27
|
+
export declare function cloudOrchestratorBaseUrlFromControlPlane(url: string | undefined): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Rewrites a Superblocks control-plane `/agent` URL to the dedicated
|
|
30
|
+
* orchestrator host. Leaves on-prem, ephemeral `agent-<host>`, and already
|
|
31
|
+
* correct `agent.*` URLs unchanged.
|
|
32
|
+
*
|
|
33
|
+
* Cloud-prem control planes are not in the SaaS host map. Their editor is
|
|
34
|
+
* baked to `https://agent.<zone>/` (`cloudAgentUrl` in dedicated-deployment),
|
|
35
|
+
* so a MULTITENANT org's `/agent` sentinel on an unlisted host gets that
|
|
36
|
+
* prefix. DEDICATED agents advertise a real URL; do not invent a host.
|
|
37
|
+
*/
|
|
38
|
+
export declare function canonicalizeOrchestratorBaseUrl(url: string, agentType?: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether moving between two profile keys can move the orchestrator URL.
|
|
41
|
+
*
|
|
42
|
+
* Only on-prem inventories tag agents by profile. Cloud resolves to one agent
|
|
43
|
+
* host per control plane. A key changing value there picks the same URL
|
|
44
|
+
* so no need to evict the cache.
|
|
45
|
+
*
|
|
46
|
+
* When agent is undefined, the profile key is changing from unset to a value.
|
|
47
|
+
*/
|
|
48
|
+
export declare function orchestratorUrlDependsOnProfile(input: {
|
|
49
|
+
agentType?: number;
|
|
50
|
+
nextProfileKey?: string;
|
|
51
|
+
previousProfileKey?: string;
|
|
52
|
+
}): boolean;
|
|
17
53
|
/**
|
|
18
54
|
* Returns a single orchestrator base URL from Server-reported agents.
|
|
19
55
|
* Throws when none are eligible — same failure mode as the browser's
|
|
@@ -1,9 +1,41 @@
|
|
|
1
|
+
import { isIP } from "node:net";
|
|
2
|
+
const ACTIVE_STATUS = "Active";
|
|
3
|
+
/** Matches `@superblocksteam/shared` `AgentType.MULTITENANT`. */
|
|
4
|
+
const AGENT_TYPE_MULTITENANT = 0;
|
|
5
|
+
/** Matches `@superblocksteam/shared` `AgentType.ONPREMISE`. */
|
|
6
|
+
export const AGENT_TYPE_ONPREMISE = 2;
|
|
1
7
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
8
|
+
* Control-plane hosts whose `/agent` path is not the orchestrator. US prod is
|
|
9
|
+
* the exception to `agent.<control-plane>` (`app.` → `agent.superblocks.com`).
|
|
10
|
+
* EU/staging/dev follow the prefix and are listed so operator overrides that
|
|
11
|
+
* omit `agentType` still rewrite.
|
|
5
12
|
*/
|
|
6
|
-
const
|
|
13
|
+
const CLOUD_ORCHESTRATOR_URL_BY_CONTROL_PLANE_HOST = {
|
|
14
|
+
"app.superblocks.com": "https://agent.superblocks.com/",
|
|
15
|
+
"eu.superblocks.com": "https://agent.eu.superblocks.com/",
|
|
16
|
+
"staging.superblocks.com": "https://agent.staging.superblocks.com/",
|
|
17
|
+
"dev.superblocks.com": "https://agent.dev.superblocks.com/",
|
|
18
|
+
};
|
|
19
|
+
export function cloudOrchestratorBaseUrlFromControlPlane(url) {
|
|
20
|
+
if (!url) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = new URL(url);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (parsed.protocol !== "https:" ||
|
|
31
|
+
parsed.port ||
|
|
32
|
+
parsed.hostname === "localhost" ||
|
|
33
|
+
parsed.hostname.endsWith(".localhost") ||
|
|
34
|
+
isIP(parsed.hostname) !== 0) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return CLOUD_ORCHESTRATOR_URL_BY_CONTROL_PLANE_HOST[parsed.hostname];
|
|
38
|
+
}
|
|
7
39
|
function matchesProfile(tags, profileKey) {
|
|
8
40
|
const profiles = tags.profile;
|
|
9
41
|
if (!profiles || profiles.length === 0) {
|
|
@@ -12,27 +44,109 @@ function matchesProfile(tags, profileKey) {
|
|
|
12
44
|
}
|
|
13
45
|
return profiles.includes("*") || profiles.includes(profileKey);
|
|
14
46
|
}
|
|
47
|
+
function isUniversalProfile(tags) {
|
|
48
|
+
const profiles = tags.profile;
|
|
49
|
+
return !profiles || profiles.length === 0 || profiles.includes("*");
|
|
50
|
+
}
|
|
15
51
|
function withTrailingSlash(url) {
|
|
16
52
|
return url.endsWith("/") ? url : `${url}/`;
|
|
17
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The cloud sentinel helm writes is always `https://<externalUrl>/agent`.
|
|
56
|
+
* Inventory may add a trailing slash; execute paths (`/v2/execute`) are
|
|
57
|
+
* appended later and are not part of this base.
|
|
58
|
+
*/
|
|
59
|
+
function isAgentPath(pathname) {
|
|
60
|
+
return pathname === "/agent" || pathname === "/agent/";
|
|
61
|
+
}
|
|
62
|
+
function hasAgentPath(url) {
|
|
63
|
+
try {
|
|
64
|
+
return isAgentPath(new URL(url).pathname);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function isAlreadyDedicatedAgentHost(hostname) {
|
|
71
|
+
return hostname === "agent" || hostname.startsWith("agent.");
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Rewrites a Superblocks control-plane `/agent` URL to the dedicated
|
|
75
|
+
* orchestrator host. Leaves on-prem, ephemeral `agent-<host>`, and already
|
|
76
|
+
* correct `agent.*` URLs unchanged.
|
|
77
|
+
*
|
|
78
|
+
* Cloud-prem control planes are not in the SaaS host map. Their editor is
|
|
79
|
+
* baked to `https://agent.<zone>/` (`cloudAgentUrl` in dedicated-deployment),
|
|
80
|
+
* so a MULTITENANT org's `/agent` sentinel on an unlisted host gets that
|
|
81
|
+
* prefix. DEDICATED agents advertise a real URL; do not invent a host.
|
|
82
|
+
*/
|
|
83
|
+
export function canonicalizeOrchestratorBaseUrl(url, agentType) {
|
|
84
|
+
let parsed;
|
|
85
|
+
try {
|
|
86
|
+
parsed = new URL(url);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return url;
|
|
90
|
+
}
|
|
91
|
+
if (!isAgentPath(parsed.pathname)) {
|
|
92
|
+
return url;
|
|
93
|
+
}
|
|
94
|
+
const mapped = CLOUD_ORCHESTRATOR_URL_BY_CONTROL_PLANE_HOST[parsed.hostname];
|
|
95
|
+
if (mapped) {
|
|
96
|
+
return mapped;
|
|
97
|
+
}
|
|
98
|
+
if (agentType === AGENT_TYPE_MULTITENANT &&
|
|
99
|
+
!isAlreadyDedicatedAgentHost(parsed.hostname)) {
|
|
100
|
+
return `https://agent.${parsed.hostname}/`;
|
|
101
|
+
}
|
|
102
|
+
return url;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether moving between two profile keys can move the orchestrator URL.
|
|
106
|
+
*
|
|
107
|
+
* Only on-prem inventories tag agents by profile. Cloud resolves to one agent
|
|
108
|
+
* host per control plane. A key changing value there picks the same URL
|
|
109
|
+
* so no need to evict the cache.
|
|
110
|
+
*
|
|
111
|
+
* When agent is undefined, the profile key is changing from unset to a value.
|
|
112
|
+
*/
|
|
113
|
+
export function orchestratorUrlDependsOnProfile(input) {
|
|
114
|
+
if (input.agentType === undefined ||
|
|
115
|
+
input.agentType === AGENT_TYPE_ONPREMISE) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
return Boolean(input.previousProfileKey) !== Boolean(input.nextProfileKey);
|
|
119
|
+
}
|
|
18
120
|
/**
|
|
19
121
|
* Returns a single orchestrator base URL from Server-reported agents.
|
|
20
122
|
* Throws when none are eligible — same failure mode as the browser's
|
|
21
123
|
* "No active agent found".
|
|
22
124
|
*/
|
|
23
125
|
export function pickOrchestratorBaseUrl(input) {
|
|
24
|
-
const
|
|
126
|
+
const active = input.agents.filter((candidate) => candidate.type === input.agentType &&
|
|
25
127
|
candidate.status === ACTIVE_STATUS &&
|
|
26
|
-
Boolean(candidate.url)
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
|
|
128
|
+
Boolean(candidate.url));
|
|
129
|
+
let chosen;
|
|
130
|
+
if (input.agentType !== AGENT_TYPE_ONPREMISE) {
|
|
131
|
+
const mapped = cloudOrchestratorBaseUrlFromControlPlane(input.controlPlaneUrl);
|
|
132
|
+
if (mapped) {
|
|
133
|
+
return mapped;
|
|
134
|
+
}
|
|
135
|
+
chosen = active.find((candidate) => hasAgentPath(candidate.url));
|
|
136
|
+
}
|
|
137
|
+
else if (input.profileKey) {
|
|
138
|
+
const profileKey = input.profileKey;
|
|
139
|
+
chosen = active.find((candidate) => matchesProfile(candidate.tags ?? {}, profileKey));
|
|
140
|
+
}
|
|
141
|
+
if (!chosen && !input.profileKey) {
|
|
142
|
+
chosen = active.find((candidate) => isUniversalProfile(candidate.tags ?? {}));
|
|
143
|
+
}
|
|
144
|
+
if (input.agentType !== AGENT_TYPE_ONPREMISE) {
|
|
145
|
+
chosen ??= active[0];
|
|
30
146
|
}
|
|
31
|
-
// Browser picks randomly among matches; stable first is fine for gateway.
|
|
32
|
-
const chosen = eligible[0];
|
|
33
147
|
if (!chosen) {
|
|
34
|
-
throw new Error(`No active agent found for agentType=${input.agentType} profile=${input.profileKey}`);
|
|
148
|
+
throw new Error(`No active agent found for agentType=${input.agentType} profile=${input.profileKey ?? "<unset>"}`);
|
|
35
149
|
}
|
|
36
|
-
return withTrailingSlash(chosen.url);
|
|
150
|
+
return withTrailingSlash(canonicalizeOrchestratorBaseUrl(chosen.url, input.agentType));
|
|
37
151
|
}
|
|
38
152
|
//# sourceMappingURL=resolve-orchestrator-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-orchestrator-url.js","sourceRoot":"","sources":["../../src/agents/resolve-orchestrator-url.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"resolve-orchestrator-url.js","sourceRoot":"","sources":["../../src/agents/resolve-orchestrator-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AA6BhC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAE/B,iEAAiE;AACjE,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,4CAA4C,GAA2B;IAC3E,qBAAqB,EAAE,gCAAgC;IACvD,oBAAoB,EAAE,mCAAmC;IACzD,yBAAyB,EAAE,wCAAwC;IACnE,qBAAqB,EAAE,oCAAoC;CAC5D,CAAC;AAEF,MAAM,UAAU,wCAAwC,CACtD,GAAuB;IAEvB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IACE,MAAM,CAAC,QAAQ,KAAK,QAAQ;QAC5B,MAAM,CAAC,IAAI;QACX,MAAM,CAAC,QAAQ,KAAK,WAAW;QAC/B,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC3B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,4CAA4C,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,cAAc,CACrB,IAA8B,EAC9B,UAAk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AC,eAAe,CACtB,CAAC;QACF,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;SAAM,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CACjC,cAAc,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,EAAE,UAAU,CAAC,CACjD,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACjC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CACjC,kBAAkB,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CACzC,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,SAAS,KAAK,oBAAoB,EAAE,CAAC;QAC7C,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,uCAAuC,KAAK,CAAC,SAAS,YACpD,KAAK,CAAC,UAAU,IAAI,SACtB,EAAE,CACH,CAAC;IACJ,CAAC;IAED,OAAO,iBAAiB,CACtB,+BAA+B,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ResolvedProfileSummary } from "../integrations/resolve-profile.js";
|
|
1
2
|
import { type CapabilityContext } from "./lifecycle.js";
|
|
2
3
|
import type { CapabilityResult } from "./types.js";
|
|
3
4
|
export type GetIntegrationMetadataInput = {
|
|
@@ -21,6 +22,8 @@ export type GetIntegrationMetadataResult = {
|
|
|
21
22
|
nextOffset: number | null;
|
|
22
23
|
offset: number;
|
|
23
24
|
pluginId: string;
|
|
25
|
+
/** Which profile's data this is, so a later change of profile is explainable. */
|
|
26
|
+
profile: ResolvedProfileSummary;
|
|
24
27
|
returnedCount: number;
|
|
25
28
|
totalCount: number;
|
|
26
29
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { pickOrchestratorBaseUrl } from "../agents/resolve-orchestrator-url.js";
|
|
1
|
+
import { AGENT_TYPE_ONPREMISE, pickOrchestratorBaseUrl, } from "../agents/resolve-orchestrator-url.js";
|
|
2
2
|
import { integrationIsToolSupported } from "../integrations/filters.js";
|
|
3
3
|
import { hasBuildPermission } from "../integrations/map.js";
|
|
4
|
-
import {
|
|
4
|
+
import { describeProfile, profileSummary, profileUnresolvedMessage, resolveProfileForApplication, } from "../integrations/resolve-profile.js";
|
|
5
5
|
import { HttpOrchestratorClient } from "../orchestrator/client.js";
|
|
6
6
|
import { sanitizeAgentFacingText, sanitizeAgentFacingValue, } from "../sabs/agent-facing-text.js";
|
|
7
7
|
import { ensurePrincipal, resolveApplicationId, } from "./lifecycle.js";
|
|
@@ -59,6 +59,7 @@ export async function getIntegrationMetadata(context, input) {
|
|
|
59
59
|
return principal;
|
|
60
60
|
}
|
|
61
61
|
let applicationId;
|
|
62
|
+
let profileResolution;
|
|
62
63
|
// Named for the agent before the integration resolves, so a failure on the
|
|
63
64
|
// way to the metadata still reports which integration it was reaching for.
|
|
64
65
|
let label = sanitizeAgentFacingText(input.integrationId);
|
|
@@ -105,20 +106,41 @@ export async function getIntegrationMetadata(context, input) {
|
|
|
105
106
|
message: `${integrationName} is a ${pluginId} integration, which this tool cannot inspect.`,
|
|
106
107
|
};
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
+
({ resolution: profileResolution } = await resolveProfileForApplication({
|
|
109
110
|
apiKey: principal.value.apiKey,
|
|
111
|
+
applicationId,
|
|
112
|
+
configuredKey: context.config.profileKey,
|
|
110
113
|
organizationId: principal.value.organizationId,
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
scope: "integration_metadata",
|
|
115
|
+
server: context.server,
|
|
116
|
+
}));
|
|
117
|
+
const profileKey = profileResolution.key;
|
|
113
118
|
const inventory = await context.server.getAgentInventory({
|
|
114
119
|
apiKey: principal.value.apiKey,
|
|
115
120
|
organizationId: principal.value.organizationId,
|
|
116
121
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
let orchestratorUrl;
|
|
123
|
+
try {
|
|
124
|
+
orchestratorUrl = pickOrchestratorBaseUrl({
|
|
125
|
+
agentType: inventory.agentType,
|
|
126
|
+
agents: inventory.agents,
|
|
127
|
+
controlPlaneUrl: inventory.controlPlaneUrl,
|
|
128
|
+
profileKey,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
// Only on-prem agents are picked by profile tag, so only there does a
|
|
133
|
+
// missing profile explain a missing agent.
|
|
134
|
+
if (profileKey || inventory.agentType !== AGENT_TYPE_ONPREMISE) {
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
...(applicationId && { applicationId }),
|
|
139
|
+
kind: "error",
|
|
140
|
+
code: "integration_profile_unresolved",
|
|
141
|
+
message: profileUnresolvedMessage(integrationName, profileResolution),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
122
144
|
const scopedToken = await context.server.issueScopedToken(applicationId
|
|
123
145
|
? {
|
|
124
146
|
apiKey: principal.value.apiKey,
|
|
@@ -156,6 +178,7 @@ export async function getIntegrationMetadata(context, input) {
|
|
|
156
178
|
nextOffset,
|
|
157
179
|
offset,
|
|
158
180
|
pluginId,
|
|
181
|
+
profile: profileSummary(profileResolution),
|
|
159
182
|
returnedCount: entries.length,
|
|
160
183
|
totalCount: matched.length,
|
|
161
184
|
},
|
|
@@ -167,7 +190,7 @@ export async function getIntegrationMetadata(context, input) {
|
|
|
167
190
|
...(applicationId && { applicationId }),
|
|
168
191
|
kind: "error",
|
|
169
192
|
code: "integration_metadata_unavailable",
|
|
170
|
-
message: `Could not load metadata for ${label}: ${detail}`,
|
|
193
|
+
message: `Could not load metadata for ${label}${profileResolution ? ` (${describeProfile(profileResolution)})` : ""}: ${detail}`,
|
|
171
194
|
};
|
|
172
195
|
}
|
|
173
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-metadata.js","sourceRoot":"","sources":["../../src/capabilities/integration-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"integration-metadata.js","sourceRoot":"","sources":["../../src/capabilities/integration-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EACL,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,4BAA4B,GAE7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,eAAe,EACf,oBAAoB,GAErB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,aAAa,GAAG,GAAG,CAAC;AA+B1B,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ;QAC9B,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC;QACzC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,KAA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,IAAI,CAAC;QAE5E,OAAO;YACL,IAAI,EAAE,IAAI;YACV,KAAK,EAAE;gBACL,GAAG,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,CAAC;gBACvC,OAAO;gBACP,OAAO,EAAE,UAAU,KAAK,IAAI;gBAC5B,aAAa,EAAE,WAAW,CAAC,EAAE;gBAC7B,eAAe;gBACf,UAAU;gBACV,MAAM;gBACN,QAAQ;gBACR,OAAO,EAAE,cAAc,CAAC,iBAAiB,CAAC;gBAC1C,aAAa,EAAE,OAAO,CAAC,MAAM;gBAC7B,UAAU,EAAE,OAAO,CAAC,MAAM;aAC3B;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,uBAAuB,CACpC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAClE,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC5B,OAAO;YACL,GAAG,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,CAAC;YACvC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,kCAAkC;YACxC,OAAO,EAAE,+BAA+B,KAAK,GAC3C,iBAAiB,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EACnE,KAAK,MAAM,EAAE;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -60,10 +60,25 @@ export declare function resolveApplicationId(ctx: CapabilityContext, principal:
|
|
|
60
60
|
options?: {
|
|
61
61
|
unambiguous?: boolean;
|
|
62
62
|
}): Promise<CapabilityResult<string>>;
|
|
63
|
+
/**
|
|
64
|
+
* Settles a user's plan approval against what became of the prompt it
|
|
65
|
+
* approved.
|
|
66
|
+
*
|
|
67
|
+
* The approval is claimed before the prompt goes out and spent only once
|
|
68
|
+
* Superblocks accepts it. A prompt that never went out hands the approval
|
|
69
|
+
* back, so the retry builds the plan the user already approved instead of
|
|
70
|
+
* failing with `approval_not_from_user`. A prompt that may have reached
|
|
71
|
+
* Superblocks settles neither way: handing the approval back could build the
|
|
72
|
+
* plan twice.
|
|
73
|
+
*/
|
|
74
|
+
export type ApprovalSettlement = {
|
|
75
|
+
onAccepted(): void;
|
|
76
|
+
onNotSent(): void;
|
|
77
|
+
};
|
|
63
78
|
export declare function startApp(ctx: CapabilityContext, input: StartAppInput): Promise<CapabilityResult<StartAppResult>>;
|
|
64
79
|
export declare function uploadArtifact(ctx: CapabilityContext, input: UploadArtifactInput): Promise<CapabilityResult<UploadArtifactResult>>;
|
|
65
80
|
export declare function checkAppProgress(ctx: CapabilityContext, input: CheckAppProgressInput): Promise<CapabilityResult<CheckAppProgressResult>>;
|
|
66
|
-
export declare function editApp(ctx: CapabilityContext, input: EditAppInput, approvedPlan?: object): Promise<CapabilityResult<EditAppResult>>;
|
|
81
|
+
export declare function editApp(ctx: CapabilityContext, input: EditAppInput, approvedPlan?: object, approvalSettlement?: ApprovalSettlement): Promise<CapabilityResult<EditAppResult>>;
|
|
67
82
|
/**
|
|
68
83
|
* Shows the app's current work on a real URL without deploying it - the
|
|
69
84
|
* editor's Preview button, driven from here.
|
|
@@ -91,6 +106,13 @@ export declare function askUser(ctx: CapabilityContext, input: AskUserInput): Pr
|
|
|
91
106
|
* Read the app's current live editor view without committing or building it.
|
|
92
107
|
*/
|
|
93
108
|
export declare function getApp(ctx: CapabilityContext, input: GetAppInput): Promise<CapabilityResult<GetAppResult>>;
|
|
109
|
+
export declare function publishAppInput(input: {
|
|
110
|
+
applicationId?: string;
|
|
111
|
+
branch?: string;
|
|
112
|
+
commitId?: string;
|
|
113
|
+
commitMessage?: string;
|
|
114
|
+
idempotencyKey: string;
|
|
115
|
+
}): CapabilityResult<PublishAppInput>;
|
|
94
116
|
export declare function publishApp(ctx: CapabilityContext, input: PublishAppInput): Promise<CapabilityResult<PublishAppResult>>;
|
|
95
117
|
/**
|
|
96
118
|
* Where a publish handed back as `publishing` has got to.
|