@superblocksteam/gateway 2.0.0-SNAPSHOT.1d4c72c0ab174c21
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/LICENSE.txt +87 -0
- package/README.md +291 -0
- package/dist/agents/resolve-orchestrator-url.d.ts +22 -0
- package/dist/agents/resolve-orchestrator-url.js +38 -0
- package/dist/agents/resolve-orchestrator-url.js.map +1 -0
- package/dist/capabilities/integration-metadata.d.ts +28 -0
- package/dist/capabilities/integration-metadata.js +174 -0
- package/dist/capabilities/integration-metadata.js.map +1 -0
- package/dist/capabilities/lifecycle.d.ts +93 -0
- package/dist/capabilities/lifecycle.js +3450 -0
- package/dist/capabilities/lifecycle.js.map +1 -0
- package/dist/capabilities/query-integration.d.ts +14 -0
- package/dist/capabilities/query-integration.js +172 -0
- package/dist/capabilities/query-integration.js.map +1 -0
- package/dist/capabilities/source-files-archive.d.ts +11 -0
- package/dist/capabilities/source-files-archive.js +54 -0
- package/dist/capabilities/source-files-archive.js.map +1 -0
- package/dist/capabilities/types.d.ts +542 -0
- package/dist/capabilities/types.js +86 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/capture/browser-contract.d.ts +46 -0
- package/dist/capture/browser-contract.js +34 -0
- package/dist/capture/browser-contract.js.map +1 -0
- package/dist/capture/browser-instructions.d.ts +10 -0
- package/dist/capture/browser-instructions.js +18 -0
- package/dist/capture/browser-instructions.js.map +1 -0
- package/dist/capture/capture-library-probe.d.ts +55 -0
- package/dist/capture/capture-library-probe.js +177 -0
- package/dist/capture/capture-library-probe.js.map +1 -0
- package/dist/capture/capture-library.d.ts +52 -0
- package/dist/capture/capture-library.js +249 -0
- package/dist/capture/capture-library.js.map +1 -0
- package/dist/capture/classify-library-paint.d.ts +21 -0
- package/dist/capture/classify-library-paint.js +13 -0
- package/dist/capture/classify-library-paint.js.map +1 -0
- package/dist/capture/host-mcp-scan.d.ts +16 -0
- package/dist/capture/host-mcp-scan.js +64 -0
- package/dist/capture/host-mcp-scan.js.map +1 -0
- package/dist/capture/library-parent-script.d.ts +35 -0
- package/dist/capture/library-parent-script.js +82 -0
- package/dist/capture/library-parent-script.js.map +1 -0
- package/dist/capture/mode.d.ts +29 -0
- package/dist/capture/mode.js +65 -0
- package/dist/capture/mode.js.map +1 -0
- package/dist/config.d.ts +148 -0
- package/dist/config.js +111 -0
- package/dist/config.js.map +1 -0
- package/dist/debug.d.ts +2 -0
- package/dist/debug.js +9 -0
- package/dist/debug.js.map +1 -0
- package/dist/deps.d.ts +38 -0
- package/dist/deps.js +2 -0
- package/dist/deps.js.map +1 -0
- package/dist/health/readiness.d.ts +99 -0
- package/dist/health/readiness.js +202 -0
- package/dist/health/readiness.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/filters.d.ts +8 -0
- package/dist/integrations/filters.js +40 -0
- package/dist/integrations/filters.js.map +1 -0
- package/dist/integrations/map.d.ts +27 -0
- package/dist/integrations/map.js +43 -0
- package/dist/integrations/map.js.map +1 -0
- package/dist/integrations/profile-key.d.ts +19 -0
- package/dist/integrations/profile-key.js +35 -0
- package/dist/integrations/profile-key.js.map +1 -0
- package/dist/integrations/read-only-postgres-query.d.ts +2 -0
- package/dist/integrations/read-only-postgres-query.js +164 -0
- package/dist/integrations/read-only-postgres-query.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -0
- package/dist/orchestrator/client.d.ts +62 -0
- package/dist/orchestrator/client.js +160 -0
- package/dist/orchestrator/client.js.map +1 -0
- package/dist/playwright/ensure-chromium.d.ts +24 -0
- package/dist/playwright/ensure-chromium.js +60 -0
- package/dist/playwright/ensure-chromium.js.map +1 -0
- package/dist/preview/capture-screenshot.d.ts +67 -0
- package/dist/preview/capture-screenshot.js +179 -0
- package/dist/preview/capture-screenshot.js.map +1 -0
- package/dist/preview/viewer-url.d.ts +82 -0
- package/dist/preview/viewer-url.js +130 -0
- package/dist/preview/viewer-url.js.map +1 -0
- package/dist/process/fault-barrier.d.ts +55 -0
- package/dist/process/fault-barrier.js +113 -0
- package/dist/process/fault-barrier.js.map +1 -0
- package/dist/sabs/agent-facing-text.d.ts +35 -0
- package/dist/sabs/agent-facing-text.js +165 -0
- package/dist/sabs/agent-facing-text.js.map +1 -0
- package/dist/sabs/app-state.d.ts +126 -0
- package/dist/sabs/app-state.js +332 -0
- package/dist/sabs/app-state.js.map +1 -0
- package/dist/sabs/awaited-decision.d.ts +47 -0
- package/dist/sabs/awaited-decision.js +124 -0
- package/dist/sabs/awaited-decision.js.map +1 -0
- package/dist/sabs/browser-context.d.ts +53 -0
- package/dist/sabs/browser-context.js +92 -0
- package/dist/sabs/browser-context.js.map +1 -0
- package/dist/sabs/editor-client-methods.d.ts +164 -0
- package/dist/sabs/editor-client-methods.js +750 -0
- package/dist/sabs/editor-client-methods.js.map +1 -0
- package/dist/sabs/editor-socket.d.ts +84 -0
- package/dist/sabs/editor-socket.js +64 -0
- package/dist/sabs/editor-socket.js.map +1 -0
- package/dist/sabs/recent-tool-runs.d.ts +14 -0
- package/dist/sabs/recent-tool-runs.js +61 -0
- package/dist/sabs/recent-tool-runs.js.map +1 -0
- package/dist/sabs/session-peer.d.ts +392 -0
- package/dist/sabs/session-peer.js +11 -0
- package/dist/sabs/session-peer.js.map +1 -0
- package/dist/sabs/streamed-reply.d.ts +42 -0
- package/dist/sabs/streamed-reply.js +110 -0
- package/dist/sabs/streamed-reply.js.map +1 -0
- package/dist/sabs/turn-collector.d.ts +169 -0
- package/dist/sabs/turn-collector.js +506 -0
- package/dist/sabs/turn-collector.js.map +1 -0
- package/dist/sabs/websocket-session-peer.d.ts +540 -0
- package/dist/sabs/websocket-session-peer.js +3289 -0
- package/dist/sabs/websocket-session-peer.js.map +1 -0
- package/dist/security/constant-time.d.ts +9 -0
- package/dist/security/constant-time.js +13 -0
- package/dist/security/constant-time.js.map +1 -0
- package/dist/server/client.d.ts +405 -0
- package/dist/server/client.js +684 -0
- package/dist/server/client.js.map +1 -0
- package/dist/server/identity-reads.d.ts +76 -0
- package/dist/server/identity-reads.js +209 -0
- package/dist/server/identity-reads.js.map +1 -0
- package/dist/start.d.ts +24 -0
- package/dist/start.js +81 -0
- package/dist/start.js.map +1 -0
- package/dist/stores/memory.d.ts +42 -0
- package/dist/stores/memory.js +121 -0
- package/dist/stores/memory.js.map +1 -0
- package/dist/stores/types.d.ts +74 -0
- package/dist/stores/types.js +11 -0
- package/dist/stores/types.js.map +1 -0
- package/dist/telemetry/mcp-client.d.ts +22 -0
- package/dist/telemetry/mcp-client.js +140 -0
- package/dist/telemetry/mcp-client.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +41 -0
- package/dist/telemetry/metrics.js +103 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/telemetry/runtime.d.ts +9 -0
- package/dist/telemetry/runtime.js +118 -0
- package/dist/telemetry/runtime.js.map +1 -0
- package/dist/transports/mcp/admin-tools.d.ts +56 -0
- package/dist/transports/mcp/admin-tools.js +252 -0
- package/dist/transports/mcp/admin-tools.js.map +1 -0
- package/dist/transports/mcp/app-status-html.d.ts +11 -0
- package/dist/transports/mcp/app-status-html.js +899 -0
- package/dist/transports/mcp/app-status-html.js.map +1 -0
- package/dist/transports/mcp/client-presentation.d.ts +16 -0
- package/dist/transports/mcp/client-presentation.js +13 -0
- package/dist/transports/mcp/client-presentation.js.map +1 -0
- package/dist/transports/mcp/cowork-editor-url.d.ts +6 -0
- package/dist/transports/mcp/cowork-editor-url.js +10 -0
- package/dist/transports/mcp/cowork-editor-url.js.map +1 -0
- package/dist/transports/mcp/decision-card-html.d.ts +26 -0
- package/dist/transports/mcp/decision-card-html.js +876 -0
- package/dist/transports/mcp/decision-card-html.js.map +1 -0
- package/dist/transports/mcp/decision-elicitation.d.ts +116 -0
- package/dist/transports/mcp/decision-elicitation.js +292 -0
- package/dist/transports/mcp/decision-elicitation.js.map +1 -0
- package/dist/transports/mcp/dispatch-probe.d.ts +24 -0
- package/dist/transports/mcp/dispatch-probe.js +48 -0
- package/dist/transports/mcp/dispatch-probe.js.map +1 -0
- package/dist/transports/mcp/editor-document-probe.d.ts +4 -0
- package/dist/transports/mcp/editor-document-probe.js +35 -0
- package/dist/transports/mcp/editor-document-probe.js.map +1 -0
- package/dist/transports/mcp/editor-integration-setup-url.d.ts +8 -0
- package/dist/transports/mcp/editor-integration-setup-url.js +23 -0
- package/dist/transports/mcp/editor-integration-setup-url.js.map +1 -0
- package/dist/transports/mcp/format-tool-content.d.ts +20 -0
- package/dist/transports/mcp/format-tool-content.js +89 -0
- package/dist/transports/mcp/format-tool-content.js.map +1 -0
- package/dist/transports/mcp/instructions/index.d.ts +23 -0
- package/dist/transports/mcp/instructions/index.js +81 -0
- package/dist/transports/mcp/instructions/index.js.map +1 -0
- package/dist/transports/mcp/instructions/result.d.ts +18 -0
- package/dist/transports/mcp/instructions/result.js +58 -0
- package/dist/transports/mcp/instructions/result.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/ask-user.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/ask-user.js +17 -0
- package/dist/transports/mcp/instructions/tools/ask-user.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.js +75 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/check-publish-progress.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/check-publish-progress.js +23 -0
- package/dist/transports/mcp/instructions/tools/check-publish-progress.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/copy.d.ts +14 -0
- package/dist/transports/mcp/instructions/tools/copy.js +35 -0
- package/dist/transports/mcp/instructions/tools/copy.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/create-integration.d.ts +4 -0
- package/dist/transports/mcp/instructions/tools/create-integration.js +41 -0
- package/dist/transports/mcp/instructions/tools/create-integration.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/edit-app.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/edit-app.js +18 -0
- package/dist/transports/mcp/instructions/tools/edit-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/get-app.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/get-app.js +47 -0
- package/dist/transports/mcp/instructions/tools/get-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.js +13 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/index.d.ts +7 -0
- package/dist/transports/mcp/instructions/tools/index.js +26 -0
- package/dist/transports/mcp/instructions/tools/index.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/preview-app.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/preview-app.js +14 -0
- package/dist/transports/mcp/instructions/tools/preview-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/publish-app.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/publish-app.js +23 -0
- package/dist/transports/mcp/instructions/tools/publish-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/start-app.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/start-app.js +22 -0
- package/dist/transports/mcp/instructions/tools/start-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/upload-artifact.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/upload-artifact.js +13 -0
- package/dist/transports/mcp/instructions/tools/upload-artifact.js.map +1 -0
- package/dist/transports/mcp/mcp-app-brand-css.d.ts +1 -0
- package/dist/transports/mcp/mcp-app-brand-css.js +180 -0
- package/dist/transports/mcp/mcp-app-brand-css.js.map +1 -0
- package/dist/transports/mcp/mount.d.ts +22 -0
- package/dist/transports/mcp/mount.js +1040 -0
- package/dist/transports/mcp/mount.js.map +1 -0
- package/dist/transports/mcp/native-browser-presence.d.ts +45 -0
- package/dist/transports/mcp/native-browser-presence.js +158 -0
- package/dist/transports/mcp/native-browser-presence.js.map +1 -0
- package/dist/transports/mcp/plan-approval.d.ts +38 -0
- package/dist/transports/mcp/plan-approval.js +175 -0
- package/dist/transports/mcp/plan-approval.js.map +1 -0
- package/dist/transports/mcp/progress-notifier.d.ts +39 -0
- package/dist/transports/mcp/progress-notifier.js +52 -0
- package/dist/transports/mcp/progress-notifier.js.map +1 -0
- package/dist/transports/mcp/session-directory.d.ts +7 -0
- package/dist/transports/mcp/session-directory.js +18 -0
- package/dist/transports/mcp/session-directory.js.map +1 -0
- package/dist/transports/mcp/tool-names.d.ts +2 -0
- package/dist/transports/mcp/tool-names.js +2 -0
- package/dist/transports/mcp/tool-names.js.map +1 -0
- package/package.json +78 -0
- package/skills/superblocks-build/SKILL.md +59 -0
- package/skills/superblocks-import/SKILL.md +88 -0
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import type { BrowserDriverContract } from "../capture/browser-contract.js";
|
|
2
|
+
import type { CheckpointFailure, CheckpointWarning, TurnUpdate } from "../sabs/session-peer.js";
|
|
3
|
+
export type CallerKind = "mcp";
|
|
4
|
+
/**
|
|
5
|
+
* The caller behind a capability invocation.
|
|
6
|
+
*
|
|
7
|
+
* Identity is optional because MCP hands over only the credential and lets the
|
|
8
|
+
* capability resolve it. Whoever resolves it, it is resolved exactly once —
|
|
9
|
+
* `/users/me` is the most expensive endpoint the Superblocks API exposes.
|
|
10
|
+
*/
|
|
11
|
+
export type Principal = {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
organizationId?: string;
|
|
15
|
+
userId?: string;
|
|
16
|
+
};
|
|
17
|
+
/** A principal whose identity the Superblocks API has confirmed. */
|
|
18
|
+
export type ResolvedPrincipal = Principal & {
|
|
19
|
+
organizationId: string;
|
|
20
|
+
userId: string;
|
|
21
|
+
};
|
|
22
|
+
export type ProgressEvent = {
|
|
23
|
+
message: string;
|
|
24
|
+
type: "progress" | "auth_required" | "completed" | "error";
|
|
25
|
+
};
|
|
26
|
+
export type AuthElicitation = {
|
|
27
|
+
authUrl: string;
|
|
28
|
+
browser?: BrowserDriverContract;
|
|
29
|
+
reason: "idp_step_up";
|
|
30
|
+
turnId: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A failed capability, and the application it was working on when it failed.
|
|
34
|
+
*
|
|
35
|
+
* `start_app` persists an application row before it ever reaches live edit, so
|
|
36
|
+
* a failure past that point leaves the caller owning a resource it was never
|
|
37
|
+
* handed. `applicationId` is that handle, and it is a field because the
|
|
38
|
+
* alternative callers actually resorted to — regex a UUID out of `message`, or
|
|
39
|
+
* else fall back to "the most recent app" — drives another caller's build in
|
|
40
|
+
* any session with more than one of them.
|
|
41
|
+
*/
|
|
42
|
+
export type CapabilityError = {
|
|
43
|
+
/** Absent only when the call failed before it had an application at all. */
|
|
44
|
+
agentInstructions?: string;
|
|
45
|
+
/** Absent only when the call failed before it had an application at all. */
|
|
46
|
+
applicationId?: string;
|
|
47
|
+
code: string;
|
|
48
|
+
kind: "error";
|
|
49
|
+
message: string;
|
|
50
|
+
/** Set when the host has a concrete way to recover from this failure. */
|
|
51
|
+
pendingAction?: PendingAppAction;
|
|
52
|
+
};
|
|
53
|
+
export type CapabilityResult<T> = {
|
|
54
|
+
kind: "ok";
|
|
55
|
+
value: T;
|
|
56
|
+
} | {
|
|
57
|
+
kind: "auth_required";
|
|
58
|
+
elicitation: AuthElicitation;
|
|
59
|
+
} | CapabilityError;
|
|
60
|
+
export type GenerationStatus = "cancelled" | "completed"
|
|
61
|
+
/**
|
|
62
|
+
* Clark took the prompt but pushes nothing the gateway can see, so its
|
|
63
|
+
* progress is only visible in the editor. The job itself keeps running.
|
|
64
|
+
*/
|
|
65
|
+
| "detached"
|
|
66
|
+
/**
|
|
67
|
+
* The turn never ran to an outcome because the live-edit session did not: it
|
|
68
|
+
* went away mid-flight, or it never opened at all. Distinct from `timeout`:
|
|
69
|
+
* the turn did not run out of time, the thing that was to run it was not
|
|
70
|
+
* there. Mid-turn deaths are retryable. Failed opens are not when reconnecting
|
|
71
|
+
* would reach the same wedged session; only a just-created app is safe to
|
|
72
|
+
* recreate.
|
|
73
|
+
*/
|
|
74
|
+
| "live_edit_terminated"
|
|
75
|
+
/** The job ended without writing a file or leaving a draft. */
|
|
76
|
+
| "no_changes" | "needs_decision" | "timeout";
|
|
77
|
+
/**
|
|
78
|
+
* How far a `start_app` / `edit_app` call follows the turn it starts.
|
|
79
|
+
*
|
|
80
|
+
* - `turn`: block until Clark's job is done (HTTP).
|
|
81
|
+
* - `ack`: return as soon as Clark accepts the prompt and let the caller follow
|
|
82
|
+
* the build through `check_app_progress`. The only way an MCP client that
|
|
83
|
+
* sends no `progressToken` — Claude Desktop — can show anything mid-build.
|
|
84
|
+
*/
|
|
85
|
+
export type TurnWait = "ack" | "turn";
|
|
86
|
+
/**
|
|
87
|
+
* Durable org-scoped file returned by `upload_artifact`.
|
|
88
|
+
*
|
|
89
|
+
* `mediaType` is any type Superblocks attachments accept, not only the two
|
|
90
|
+
* archive types: an image or a log uploads as itself rather than being wrapped
|
|
91
|
+
* in a zip it would have to be decoded back out of.
|
|
92
|
+
*/
|
|
93
|
+
export type ArtifactDescriptor = {
|
|
94
|
+
fileName: string;
|
|
95
|
+
id: string;
|
|
96
|
+
mediaType: string;
|
|
97
|
+
storageKey: string;
|
|
98
|
+
};
|
|
99
|
+
export type UploadArtifactInput = {
|
|
100
|
+
files?: Array<{
|
|
101
|
+
content: string;
|
|
102
|
+
path: string;
|
|
103
|
+
}>;
|
|
104
|
+
/** Path or file name on the gateway host. */
|
|
105
|
+
filePath?: string;
|
|
106
|
+
/** Test-fixture transport only; real archives should use filePath. */
|
|
107
|
+
zipBase64?: string;
|
|
108
|
+
};
|
|
109
|
+
export type UploadArtifactResult = {
|
|
110
|
+
artifact: ArtifactDescriptor;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Where a build stands.
|
|
114
|
+
*
|
|
115
|
+
* `unknown` means the gateway is not following a turn for this app: it finished
|
|
116
|
+
* and was already reported, or nothing was ever started here.
|
|
117
|
+
*/
|
|
118
|
+
export type BuildStatus = "building" | "cancelled" | "checkpoint_failed"
|
|
119
|
+
/**
|
|
120
|
+
* Clark is working but out of the gateway's sight — polling cannot report it,
|
|
121
|
+
* and only the editor can. Ends the poll loop instead of running it out.
|
|
122
|
+
*/
|
|
123
|
+
| "detached"
|
|
124
|
+
/**
|
|
125
|
+
* The live-edit session backing the turn died before it finished, or never
|
|
126
|
+
* opened. Nothing was built, and the caller should retry rather than keep
|
|
127
|
+
* polling.
|
|
128
|
+
*/
|
|
129
|
+
| "live_edit_terminated" | "needs_decision"
|
|
130
|
+
/** Clark's job ended having built nothing; there is no app to show. */
|
|
131
|
+
| "no_changes" | "ready" | "timeout" | "unknown";
|
|
132
|
+
/**
|
|
133
|
+
* How a finished turn reads as a build status.
|
|
134
|
+
*
|
|
135
|
+
* Every member is spelled out and the default is unreachable on purpose. A
|
|
136
|
+
* `default: return "ready"` would answer "your app is fine" for any status
|
|
137
|
+
* added later, which is how a dead live edit came to be reported as `ready`
|
|
138
|
+
* in the first place; this way the compiler stops the next one.
|
|
139
|
+
*/
|
|
140
|
+
export declare function buildStatusOf(generationStatus: GenerationStatus, checkpointFailure?: CheckpointFailure): BuildStatus;
|
|
141
|
+
/**
|
|
142
|
+
* How a `check_app_progress` poll reads as a build status.
|
|
143
|
+
*
|
|
144
|
+
* Running and unknown map directly. A finished poll uses {@link buildStatusOf},
|
|
145
|
+
* except a successful checkpoint that paused for missing integrations: that is
|
|
146
|
+
* a decision, even when generationStatus is still `completed`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function progressStatusOf(update: TurnUpdate): BuildStatus;
|
|
149
|
+
export type StartAppInput = {
|
|
150
|
+
artifacts?: ArtifactDescriptor[];
|
|
151
|
+
branch?: string;
|
|
152
|
+
idempotencyKey: string;
|
|
153
|
+
/** Defaults to PLAN (editor parity). Pass BUILD to skip planning. */
|
|
154
|
+
mode?: "BUILD" | "PLAN";
|
|
155
|
+
name?: string;
|
|
156
|
+
prompt: string;
|
|
157
|
+
/** The failed app this one replaces; permits only this one fresh attempt. */
|
|
158
|
+
replacesApplicationId?: string;
|
|
159
|
+
wait?: TurnWait;
|
|
160
|
+
};
|
|
161
|
+
export type DecisionPayload = {
|
|
162
|
+
integrations: Array<{
|
|
163
|
+
configuration: Record<string, unknown>;
|
|
164
|
+
/** The plugin's configuration form, so the host needs no lookup. */
|
|
165
|
+
configurationSchema?: Record<string, unknown>;
|
|
166
|
+
name?: string;
|
|
167
|
+
pluginId: string;
|
|
168
|
+
}>;
|
|
169
|
+
kind: "missing_integrations";
|
|
170
|
+
} | {
|
|
171
|
+
kind: "multi_choice";
|
|
172
|
+
messageId?: string;
|
|
173
|
+
options: string[];
|
|
174
|
+
question: string;
|
|
175
|
+
} | {
|
|
176
|
+
kind: "plan";
|
|
177
|
+
messageId?: string;
|
|
178
|
+
plan: string;
|
|
179
|
+
title?: string;
|
|
180
|
+
};
|
|
181
|
+
export type StartAppResult = {
|
|
182
|
+
/** Clark's chat lines since the previous report, oldest first. */
|
|
183
|
+
activity?: string[];
|
|
184
|
+
applicationId: string;
|
|
185
|
+
branch?: string;
|
|
186
|
+
/** Host-driver steer. Tokens never belong here. */
|
|
187
|
+
browser?: BrowserDriverContract;
|
|
188
|
+
/**
|
|
189
|
+
* Checkpoint the gateway committed for Clark's work. Absent when Clark left
|
|
190
|
+
* nothing to commit or the checkpoint did not land.
|
|
191
|
+
*/
|
|
192
|
+
checkpointCommitId?: string;
|
|
193
|
+
checkpointFailure?: CheckpointFailure;
|
|
194
|
+
checkpointWarning?: CheckpointWarning;
|
|
195
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
196
|
+
reply?: string;
|
|
197
|
+
/** Present when status is needs_decision. */
|
|
198
|
+
decision?: DecisionPayload;
|
|
199
|
+
editUrl: string;
|
|
200
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
201
|
+
generationStatus?: GenerationStatus;
|
|
202
|
+
liveEditId?: string;
|
|
203
|
+
/** Mode this turn ran in, so the caller can say whether Clark is planning. */
|
|
204
|
+
mode?: "BUILD" | "PLAN";
|
|
205
|
+
name: string;
|
|
206
|
+
pendingAction?: PendingAppAction;
|
|
207
|
+
/** Mid-turn testApi / testIntegration outcomes when the turn finished. */
|
|
208
|
+
recentRuns?: RecentToolRun[];
|
|
209
|
+
status: BuildStatus;
|
|
210
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
211
|
+
viewStatus?: "ready" | "unknown";
|
|
212
|
+
};
|
|
213
|
+
export type CheckAppProgressInput = {
|
|
214
|
+
applicationId?: string;
|
|
215
|
+
branch?: string;
|
|
216
|
+
};
|
|
217
|
+
export type CheckAppProgressResult = {
|
|
218
|
+
/** Clark's chat lines since the previous poll, oldest first. */
|
|
219
|
+
activity: string[];
|
|
220
|
+
/**
|
|
221
|
+
* Next step for the calling agent, when present. Produced by a host-specific
|
|
222
|
+
* decision instruction (status needs_decision) or a relay reminder on a
|
|
223
|
+
* building poll that carried new Superblocks lines.
|
|
224
|
+
*/
|
|
225
|
+
agentInstructions?: string;
|
|
226
|
+
applicationId: string;
|
|
227
|
+
branch?: string;
|
|
228
|
+
/** See StartAppResult.checkpointCommitId. */
|
|
229
|
+
checkpointCommitId?: string;
|
|
230
|
+
checkpointFailure?: CheckpointFailure;
|
|
231
|
+
checkpointWarning?: CheckpointWarning;
|
|
232
|
+
/** Present when status is needs_decision. */
|
|
233
|
+
decision?: DecisionPayload;
|
|
234
|
+
editUrl: string;
|
|
235
|
+
/** How long Clark has been on this turn, so a quiet poll still has news. */
|
|
236
|
+
elapsedSeconds: number;
|
|
237
|
+
/** Present once the turn has finished. */
|
|
238
|
+
generationStatus?: GenerationStatus;
|
|
239
|
+
/**
|
|
240
|
+
* Who owes the next move, once the turn is waiting on one. Present on the
|
|
241
|
+
* polling path as well as on `get_app`, because a host without form
|
|
242
|
+
* elicitation answers a decision from this loop and nowhere else.
|
|
243
|
+
*/
|
|
244
|
+
pendingAction?: PendingAppAction;
|
|
245
|
+
/** Recent mid-turn testApi / testIntegration outcomes, oldest first. */
|
|
246
|
+
recentRuns?: RecentToolRun[];
|
|
247
|
+
/**
|
|
248
|
+
* What is left of the turn budget before the gateway gives up on it.
|
|
249
|
+
*
|
|
250
|
+
* Present only while this gateway is following the turn itself and can see
|
|
251
|
+
* its clock, which is the only case where the number means anything. It used
|
|
252
|
+
* to be sent unconditionally, so a poll of an app with no turn at all
|
|
253
|
+
* answered with the full budget next to a zero elapsed - a fresh,
|
|
254
|
+
* fully-funded turn, asserted about nothing (ENG-5808).
|
|
255
|
+
*
|
|
256
|
+
* Absent does not mean "nothing is running": a build read out of the
|
|
257
|
+
* persisted stream reports `building` without a budget, because the turn is
|
|
258
|
+
* running somewhere this process cannot time it.
|
|
259
|
+
*/
|
|
260
|
+
remainingTurnBudgetMs?: number;
|
|
261
|
+
/** Present once the turn has finished. */
|
|
262
|
+
reply?: string;
|
|
263
|
+
/** Emitted once per quiet spell, never in place of a terminal answer. */
|
|
264
|
+
stallHint?: StallHint;
|
|
265
|
+
status: BuildStatus;
|
|
266
|
+
/** Whether this turn has produced content the editor can render. */
|
|
267
|
+
viewStatus?: "ready" | "unknown";
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* A nonterminal warning that a build has gone quiet, raised well before the
|
|
271
|
+
* turn budget runs out so a caller can say something rather than sit on a
|
|
272
|
+
* silent poll loop until it times out.
|
|
273
|
+
*/
|
|
274
|
+
export type StallHint = {
|
|
275
|
+
/** How long the build has been running without saying anything new. */
|
|
276
|
+
quietMs: number;
|
|
277
|
+
reason: "long_quiet";
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* One mid-turn testApi or testIntegration result surfaced to MCP clients.
|
|
281
|
+
* Output/error strings are truncated so tool results stay readable.
|
|
282
|
+
*/
|
|
283
|
+
export type RecentToolRun = {
|
|
284
|
+
kind: "test_api" | "test_integration";
|
|
285
|
+
name: string;
|
|
286
|
+
success: boolean;
|
|
287
|
+
summary: string;
|
|
288
|
+
at: string;
|
|
289
|
+
};
|
|
290
|
+
export type EditAppInput = {
|
|
291
|
+
applicationId?: string;
|
|
292
|
+
artifacts?: ArtifactDescriptor[];
|
|
293
|
+
branch?: string;
|
|
294
|
+
idempotencyKey: string;
|
|
295
|
+
/** Defaults to PLAN. Approve forces BUILD with planContext.approved. */
|
|
296
|
+
mode?: "BUILD" | "PLAN";
|
|
297
|
+
/**
|
|
298
|
+
* Approve or refine a pending Clark plan. When omitted and a plan is pending,
|
|
299
|
+
* a normal prompt is treated as refine feedback. `approve` does not need a
|
|
300
|
+
* prompt — the pending plan is sent as the build prompt.
|
|
301
|
+
*/
|
|
302
|
+
planAction?: "approve" | "refine";
|
|
303
|
+
/** Required unless `planAction` is `approve`. */
|
|
304
|
+
prompt?: string;
|
|
305
|
+
wait?: TurnWait;
|
|
306
|
+
};
|
|
307
|
+
export type EditAppResult = {
|
|
308
|
+
/** Clark's chat lines since the previous report, oldest first. */
|
|
309
|
+
activity?: string[];
|
|
310
|
+
applicationId: string;
|
|
311
|
+
branch?: string;
|
|
312
|
+
/** Host-driver steer. Tokens never belong here. */
|
|
313
|
+
browser?: BrowserDriverContract;
|
|
314
|
+
/** See StartAppResult.checkpointCommitId. */
|
|
315
|
+
checkpointCommitId?: string;
|
|
316
|
+
checkpointFailure?: CheckpointFailure;
|
|
317
|
+
checkpointWarning?: CheckpointWarning;
|
|
318
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
319
|
+
reply?: string;
|
|
320
|
+
/** Present when status is needs_decision. */
|
|
321
|
+
decision?: DecisionPayload;
|
|
322
|
+
editUrl: string;
|
|
323
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
324
|
+
generationStatus?: GenerationStatus;
|
|
325
|
+
/**
|
|
326
|
+
* Mode this turn actually ran in. Follow-ups stay BUILD once a plan was
|
|
327
|
+
* approved, so the caller can see it does not need to re-send mode.
|
|
328
|
+
*/
|
|
329
|
+
mode?: "BUILD" | "PLAN";
|
|
330
|
+
pendingAction?: PendingAppAction;
|
|
331
|
+
/** Mid-turn testApi / testIntegration outcomes when the turn finished. */
|
|
332
|
+
recentRuns?: RecentToolRun[];
|
|
333
|
+
status: BuildStatus;
|
|
334
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
335
|
+
viewStatus?: "ready" | "unknown";
|
|
336
|
+
};
|
|
337
|
+
export type PreviewAppInput = {
|
|
338
|
+
applicationId?: string;
|
|
339
|
+
branch?: string;
|
|
340
|
+
/**
|
|
341
|
+
* Capture a deployed-shell screenshot when the preview is ready. `get_app`
|
|
342
|
+
* sets this false when it will screenshot the live library instead.
|
|
343
|
+
*/
|
|
344
|
+
includeScreenshot?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Whether to wait for the build. See {@link GetAppInput.wait}; `false`
|
|
347
|
+
* starts or observes the build and returns `status: "building"` at once.
|
|
348
|
+
*/
|
|
349
|
+
wait?: boolean;
|
|
350
|
+
};
|
|
351
|
+
export type PreviewAppResult = {
|
|
352
|
+
applicationId: string;
|
|
353
|
+
branch?: string;
|
|
354
|
+
browser?: BrowserDriverContract;
|
|
355
|
+
/**
|
|
356
|
+
* True when preview URLs are returned but Gateway cannot screenshot because
|
|
357
|
+
* there is no Chromium and no host browser MCP.
|
|
358
|
+
*/
|
|
359
|
+
needsBrowserDriver?: boolean;
|
|
360
|
+
/** Commit that was built and is being previewed. */
|
|
361
|
+
commitId: string;
|
|
362
|
+
directoryHash: string;
|
|
363
|
+
/** Editor URL for the same app (MCP App Open editor button). */
|
|
364
|
+
editUrl: string;
|
|
365
|
+
/** Display name, so callers can say more than a UUID. Absent when unknown. */
|
|
366
|
+
name?: string;
|
|
367
|
+
previewUrl: string;
|
|
368
|
+
/**
|
|
369
|
+
* Direct viewer URL used for screenshots (may be http localhost even when
|
|
370
|
+
* `previewUrl` is an https gateway redirect).
|
|
371
|
+
*/
|
|
372
|
+
viewerUrl?: string;
|
|
373
|
+
/**
|
|
374
|
+
* True when `previewUrl` is https and Claude Desktop can openLink it.
|
|
375
|
+
*/
|
|
376
|
+
openableViaHttps?: boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Base64 JPEG of the running preview when capture succeeds. Absent when
|
|
379
|
+
* capture was skipped (still building) or soft-failed.
|
|
380
|
+
*/
|
|
381
|
+
screenshotBase64?: string;
|
|
382
|
+
/** Why a ready preview could not be screenshotted. */
|
|
383
|
+
screenshotUnavailableReason?: string;
|
|
384
|
+
/**
|
|
385
|
+
* `building` means the URL is right but SABS has not finished building it
|
|
386
|
+
* yet; previewing again resumes watching the same build.
|
|
387
|
+
*/
|
|
388
|
+
status: "building" | "ready";
|
|
389
|
+
};
|
|
390
|
+
export type PreviewStatusInput = {
|
|
391
|
+
applicationId: string;
|
|
392
|
+
branch?: string;
|
|
393
|
+
commitId: string;
|
|
394
|
+
directoryHash: string;
|
|
395
|
+
};
|
|
396
|
+
export type PreviewStatusResult = PreviewStatusInput & {
|
|
397
|
+
editUrl: string;
|
|
398
|
+
status: "building" | "failed" | "ready";
|
|
399
|
+
};
|
|
400
|
+
export type GetAppInput = {
|
|
401
|
+
applicationId?: string;
|
|
402
|
+
branch?: string;
|
|
403
|
+
/** Whether to capture a screenshot. Defaults to true. */
|
|
404
|
+
includeScreenshot?: boolean;
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* What has to happen before this app has anything worth previewing. Present
|
|
408
|
+
* only when the gateway declined to build one, and paired with the status that
|
|
409
|
+
* says why.
|
|
410
|
+
*/
|
|
411
|
+
export type PendingAppAction =
|
|
412
|
+
/** Superblocks requested a datasource the MCP host must create. */
|
|
413
|
+
"create_integration"
|
|
414
|
+
/** Clark asked a multi_choice question; answer it with `edit_app`. */
|
|
415
|
+
| "answer_question"
|
|
416
|
+
/** Clark proposed a plan; `edit_app` with `planAction: "approve"` builds it. */
|
|
417
|
+
| "approve_plan"
|
|
418
|
+
/**
|
|
419
|
+
* Clark is waiting on the user, and the gateway cannot say what it is
|
|
420
|
+
* asking: the turn ended on a decision it streamed as ordinary chat text,
|
|
421
|
+
* so nothing structured was captured and no plan was remembered either.
|
|
422
|
+
*
|
|
423
|
+
* A distinct value because the alternative was reporting `answer_question`
|
|
424
|
+
* with no question attached, which told the caller to put a decision to the
|
|
425
|
+
* user that it had no way to see - and re-reading only returned the same
|
|
426
|
+
* thing (ENG-5910). The honest answer is that this one has to be finished in
|
|
427
|
+
* the editor.
|
|
428
|
+
*/
|
|
429
|
+
| "decide_in_editor"
|
|
430
|
+
/** The build finished, but its checkpoint failed; inspect it in the editor. */
|
|
431
|
+
| "open_editor"
|
|
432
|
+
/** A newly created app is wedged; recreate it with `start_app`. */
|
|
433
|
+
| "start_new_app"
|
|
434
|
+
/** The last turn ended without writing anything; `edit_app` starts it over. */
|
|
435
|
+
| "retry_build"
|
|
436
|
+
/** A turn is in flight; follow it with `check_app_progress`. */
|
|
437
|
+
| "wait_for_build";
|
|
438
|
+
export type GetAppResult = {
|
|
439
|
+
applicationId: string;
|
|
440
|
+
branch?: string;
|
|
441
|
+
browser?: BrowserDriverContract;
|
|
442
|
+
checkpointFailure?: CheckpointFailure;
|
|
443
|
+
/** The question or plan Clark is waiting on, when status is needs_decision. */
|
|
444
|
+
decision?: DecisionPayload;
|
|
445
|
+
editUrl: string;
|
|
446
|
+
/** Display name, so callers can say more than a UUID. Absent when unknown. */
|
|
447
|
+
name?: string;
|
|
448
|
+
openableViaHttps?: boolean;
|
|
449
|
+
/** Set whenever no preview was built; says what unblocks one. */
|
|
450
|
+
pendingAction?: PendingAppAction;
|
|
451
|
+
/** Why the last turn left nothing to preview, when that reason is known. */
|
|
452
|
+
reply?: string;
|
|
453
|
+
needsBrowserDriver?: boolean;
|
|
454
|
+
/** Live editor preview opened in fullscreen mode. */
|
|
455
|
+
previewUrl?: string;
|
|
456
|
+
publishUrl?: string;
|
|
457
|
+
screenshotBase64?: string;
|
|
458
|
+
screenshotUnavailableReason?: string;
|
|
459
|
+
/**
|
|
460
|
+
* `cancelled`, `live_edit_terminated`, `no_changes` and `timeout` mean the
|
|
461
|
+
* last turn left nothing to show, so no preview was built for it.
|
|
462
|
+
*/
|
|
463
|
+
status: "building" | "cancelled" | "checkpoint_failed" | "detached" | "live_edit_terminated" | "needs_decision" | "no_changes" | "ready" | "timeout";
|
|
464
|
+
};
|
|
465
|
+
export type AskUserInput = {
|
|
466
|
+
applicationId?: string;
|
|
467
|
+
branch?: string;
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* What the decision card renders. The card cannot read AppState, so the plan
|
|
471
|
+
* or question travels here in full — a form built from a summary would ask the
|
|
472
|
+
* user to approve something other than what Superblocks proposed.
|
|
473
|
+
*/
|
|
474
|
+
export type AskUserResult = {
|
|
475
|
+
applicationId: string;
|
|
476
|
+
branch?: string;
|
|
477
|
+
/** Absent when nothing is waiting on the user; `status` says what is. */
|
|
478
|
+
decision?: DecisionPayload;
|
|
479
|
+
editUrl: string;
|
|
480
|
+
/** Display name, so the card says more than a UUID. */
|
|
481
|
+
name?: string;
|
|
482
|
+
pendingAction?: PendingAppAction;
|
|
483
|
+
/** Superblocks' own words on the turn that stopped. */
|
|
484
|
+
reply?: string;
|
|
485
|
+
status: BuildStatus;
|
|
486
|
+
};
|
|
487
|
+
export type PublishAppInput = {
|
|
488
|
+
applicationId?: string;
|
|
489
|
+
branch?: string;
|
|
490
|
+
commitId?: string;
|
|
491
|
+
idempotencyKey: string;
|
|
492
|
+
prompt: string;
|
|
493
|
+
};
|
|
494
|
+
export type CheckPublishProgressInput = {
|
|
495
|
+
applicationId?: string;
|
|
496
|
+
/**
|
|
497
|
+
* Which commit's deploy to follow. Defaults to the one `publish_app` queued
|
|
498
|
+
* for this application, so a caller that did not carry the id back can still
|
|
499
|
+
* follow its own publish.
|
|
500
|
+
*/
|
|
501
|
+
commitId?: string;
|
|
502
|
+
};
|
|
503
|
+
export type PublishAppResult = {
|
|
504
|
+
applicationId: string;
|
|
505
|
+
commitId: string;
|
|
506
|
+
/** How long the rollout has been running, so a quiet poll still has news. */
|
|
507
|
+
elapsedSeconds?: number;
|
|
508
|
+
publishDetailsUrl: string;
|
|
509
|
+
publishUrl: string;
|
|
510
|
+
/**
|
|
511
|
+
* `deployed` once the app is live. `publishing` means the deploy was
|
|
512
|
+
* accepted and is still running: the publish itself succeeded, and only the
|
|
513
|
+
* rollout is outstanding. It used to be reported as a `publish_timeout`
|
|
514
|
+
* error, because the call blocked on the rollout until it outlived the
|
|
515
|
+
* host's tool-call ceiling (ENG-6172).
|
|
516
|
+
*/
|
|
517
|
+
status: "deployed" | "publishing";
|
|
518
|
+
};
|
|
519
|
+
/**
|
|
520
|
+
* Gateway MCP/HTTP import rejects archives above this size, matching the
|
|
521
|
+
* Superblocks archive attachment upload cap. Larger ZIPs often include
|
|
522
|
+
* `node_modules` (or similar); those belong outside the export — deps are
|
|
523
|
+
* installed on or after import.
|
|
524
|
+
*/
|
|
525
|
+
export declare const IMPORT_ZIP_MAX_BYTES: number;
|
|
526
|
+
/**
|
|
527
|
+
* Ceiling on inline `files` payloads, which the model writes out itself rather
|
|
528
|
+
* than naming a file the gateway reads. It stays well below
|
|
529
|
+
* {@link IMPORT_ZIP_MAX_BYTES} for the same reason `zipBase64` does: an archive
|
|
530
|
+
* cap sized for bytes on disk is meaningless for content a model has to emit
|
|
531
|
+
* one token at a time.
|
|
532
|
+
*/
|
|
533
|
+
export declare const IMPORT_SOURCE_FILES_MAX_BYTES = 1048576;
|
|
534
|
+
/**
|
|
535
|
+
* Ceiling on an inline `zipBase64` payload, far below
|
|
536
|
+
* {@link IMPORT_ZIP_MAX_BYTES} because base64 is not a transport a model can
|
|
537
|
+
* afford: every 3 bytes of archive cost 4 characters it has to write out one
|
|
538
|
+
* token at a time, so even a 42 KB export runs to 57,000 characters and the
|
|
539
|
+
* tool call never gets sent. Real archives arrive by name — this size only
|
|
540
|
+
* carries test fixtures.
|
|
541
|
+
*/
|
|
542
|
+
export declare const IMPORT_ZIP_BASE64_MAX_CHARS = 8192;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a finished turn reads as a build status.
|
|
3
|
+
*
|
|
4
|
+
* Every member is spelled out and the default is unreachable on purpose. A
|
|
5
|
+
* `default: return "ready"` would answer "your app is fine" for any status
|
|
6
|
+
* added later, which is how a dead live edit came to be reported as `ready`
|
|
7
|
+
* in the first place; this way the compiler stops the next one.
|
|
8
|
+
*/
|
|
9
|
+
export function buildStatusOf(generationStatus, checkpointFailure) {
|
|
10
|
+
if (checkpointFailure) {
|
|
11
|
+
return "checkpoint_failed";
|
|
12
|
+
}
|
|
13
|
+
switch (generationStatus) {
|
|
14
|
+
case "cancelled":
|
|
15
|
+
return "cancelled";
|
|
16
|
+
case "completed":
|
|
17
|
+
return "ready";
|
|
18
|
+
case "detached":
|
|
19
|
+
return "detached";
|
|
20
|
+
case "live_edit_terminated":
|
|
21
|
+
return "live_edit_terminated";
|
|
22
|
+
case "needs_decision":
|
|
23
|
+
return "needs_decision";
|
|
24
|
+
case "no_changes":
|
|
25
|
+
return "no_changes";
|
|
26
|
+
case "timeout":
|
|
27
|
+
return "timeout";
|
|
28
|
+
default: {
|
|
29
|
+
const unhandled = generationStatus;
|
|
30
|
+
return unhandled;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* How a `check_app_progress` poll reads as a build status.
|
|
36
|
+
*
|
|
37
|
+
* Running and unknown map directly. A finished poll uses {@link buildStatusOf},
|
|
38
|
+
* except a successful checkpoint that paused for missing integrations: that is
|
|
39
|
+
* a decision, even when generationStatus is still `completed`.
|
|
40
|
+
*/
|
|
41
|
+
export function progressStatusOf(update) {
|
|
42
|
+
switch (update.status) {
|
|
43
|
+
case "running":
|
|
44
|
+
return "building";
|
|
45
|
+
case "unknown":
|
|
46
|
+
return "unknown";
|
|
47
|
+
case "finished":
|
|
48
|
+
return finishedProgressStatus(update);
|
|
49
|
+
default: {
|
|
50
|
+
const unhandled = update;
|
|
51
|
+
return unhandled;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function finishedProgressStatus(update) {
|
|
56
|
+
if (!update.checkpointFailure &&
|
|
57
|
+
update.decision?.kind === "missing_integrations") {
|
|
58
|
+
return "needs_decision";
|
|
59
|
+
}
|
|
60
|
+
return buildStatusOf(update.generationStatus, update.checkpointFailure);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Gateway MCP/HTTP import rejects archives above this size, matching the
|
|
64
|
+
* Superblocks archive attachment upload cap. Larger ZIPs often include
|
|
65
|
+
* `node_modules` (or similar); those belong outside the export — deps are
|
|
66
|
+
* installed on or after import.
|
|
67
|
+
*/
|
|
68
|
+
export const IMPORT_ZIP_MAX_BYTES = 50 * 1024 * 1024;
|
|
69
|
+
/**
|
|
70
|
+
* Ceiling on inline `files` payloads, which the model writes out itself rather
|
|
71
|
+
* than naming a file the gateway reads. It stays well below
|
|
72
|
+
* {@link IMPORT_ZIP_MAX_BYTES} for the same reason `zipBase64` does: an archive
|
|
73
|
+
* cap sized for bytes on disk is meaningless for content a model has to emit
|
|
74
|
+
* one token at a time.
|
|
75
|
+
*/
|
|
76
|
+
export const IMPORT_SOURCE_FILES_MAX_BYTES = 1_048_576;
|
|
77
|
+
/**
|
|
78
|
+
* Ceiling on an inline `zipBase64` payload, far below
|
|
79
|
+
* {@link IMPORT_ZIP_MAX_BYTES} because base64 is not a transport a model can
|
|
80
|
+
* afford: every 3 bytes of archive cost 4 characters it has to write out one
|
|
81
|
+
* token at a time, so even a 42 KB export runs to 57,000 characters and the
|
|
82
|
+
* tool call never gets sent. Real archives arrive by name — this size only
|
|
83
|
+
* carries test fixtures.
|
|
84
|
+
*/
|
|
85
|
+
export const IMPORT_ZIP_BASE64_MAX_CHARS = 8_192;
|
|
86
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/capabilities/types.ts"],"names":[],"mappings":"AA6JA;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,gBAAkC,EAClC,iBAAqC;IAErC,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IACD,QAAQ,gBAAgB,EAAE,CAAC;QACzB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,WAAW;YACd,OAAO,OAAO,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC;QACpB,KAAK,sBAAsB;YACzB,OAAO,sBAAsB,CAAC;QAChC,KAAK,gBAAgB;YACnB,OAAO,gBAAgB,CAAC;QAC1B,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,SAAS,GAAU,gBAAgB,CAAC;YAC1C,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,SAAS;YACZ,OAAO,UAAU,CAAC;QACpB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,UAAU;YACb,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,SAAS,GAAU,MAAM,CAAC;YAChC,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAC7B,MAAmD;IAEnD,IACE,CAAC,MAAM,CAAC,iBAAiB;QACzB,MAAM,CAAC,QAAQ,EAAE,IAAI,KAAK,sBAAsB,EAChD,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,OAAO,aAAa,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC1E,CAAC;AAqZD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,SAAS,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CaptureMode } from "./mode.js";
|
|
2
|
+
/** The host drives its own embedded browser; no driver MCP is involved. */
|
|
3
|
+
export declare const HOST_BROWSER_TOOLS_COWORK: "cowork_embedded";
|
|
4
|
+
/**
|
|
5
|
+
* Nobody looked, rather than nobody found one. The setup-time config scan
|
|
6
|
+
* behind {@link CaptureMode} can lie, so only a transport that knows which
|
|
7
|
+
* client is connected may say anything more definite than this.
|
|
8
|
+
*/
|
|
9
|
+
export declare const HOST_BROWSER_TOOLS_UNKNOWN: "unknown";
|
|
10
|
+
export type HostBrowserTools = typeof HOST_BROWSER_TOOLS_COWORK | typeof HOST_BROWSER_TOOLS_UNKNOWN;
|
|
11
|
+
export declare const MUST_NOT_CLOSE_UNTIL = "the Superblocks task is done (status ready, or the user no longer needs the browser session)";
|
|
12
|
+
export declare const NEEDS_BROWSER_DRIVER_CODE = "needs_browser_driver";
|
|
13
|
+
export declare const NEEDS_BROWSER_DRIVER_MESSAGE = "No browser driver is available for live-canvas capture or IdP step-up. Add a host browser MCP (@playwright/mcp) and re-run mcp setup. Gateway Chromium cannot complete IdP. Config on disk can lie if a listed server fails to start.";
|
|
14
|
+
/**
|
|
15
|
+
* Structured steer for host browser tools. Tokens never belong here.
|
|
16
|
+
*
|
|
17
|
+
* The edit URL may stay open while building only in Claude Cowork's built-in
|
|
18
|
+
* side panel. Other browser drivers can steal the live-edit turn by opening it.
|
|
19
|
+
*/
|
|
20
|
+
export type BrowserDriverContract = {
|
|
21
|
+
captureMode: CaptureMode;
|
|
22
|
+
canvas: {
|
|
23
|
+
editUrl: string;
|
|
24
|
+
openWhileBuilding: "claude_cowork_side_panel_only";
|
|
25
|
+
};
|
|
26
|
+
driver: {
|
|
27
|
+
isolated?: boolean;
|
|
28
|
+
mustNotCloseUntil: string;
|
|
29
|
+
};
|
|
30
|
+
hostBrowserTools: HostBrowserTools;
|
|
31
|
+
uiOrigin: {
|
|
32
|
+
navigate: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare function buildBrowserDriverContract(input: {
|
|
36
|
+
captureMode: CaptureMode;
|
|
37
|
+
editUrl: string;
|
|
38
|
+
hostBrowserTools?: HostBrowserTools;
|
|
39
|
+
isolated?: boolean;
|
|
40
|
+
uiOrigin: string;
|
|
41
|
+
}): BrowserDriverContract;
|
|
42
|
+
export declare function needsBrowserDriverError(): {
|
|
43
|
+
code: typeof NEEDS_BROWSER_DRIVER_CODE;
|
|
44
|
+
kind: "error";
|
|
45
|
+
message: string;
|
|
46
|
+
};
|