@superblocksteam/gateway 2.0.155-next.0
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 +170 -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/import-prompt.d.ts +11 -0
- package/dist/capabilities/import-prompt.js +96 -0
- package/dist/capabilities/import-prompt.js.map +1 -0
- package/dist/capabilities/lifecycle.d.ts +73 -0
- package/dist/capabilities/lifecycle.js +2531 -0
- package/dist/capabilities/lifecycle.js.map +1 -0
- package/dist/capabilities/persisted-progress.d.ts +46 -0
- package/dist/capabilities/persisted-progress.js +246 -0
- package/dist/capabilities/persisted-progress.js.map +1 -0
- package/dist/capabilities/types.d.ts +446 -0
- package/dist/capabilities/types.js +47 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/capture/browser-contract.d.ts +36 -0
- package/dist/capture/browser-contract.js +24 -0
- package/dist/capture/browser-contract.js.map +1 -0
- package/dist/capture/browser-instructions.d.ts +9 -0
- package/dist/capture/browser-instructions.js +17 -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 +34 -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 +22 -0
- package/dist/capture/mode.js +45 -0
- package/dist/capture/mode.js.map +1 -0
- package/dist/config.d.ts +141 -0
- package/dist/config.js +109 -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 +36 -0
- package/dist/deps.js +2 -0
- package/dist/deps.js.map +1 -0
- package/dist/events/cursor.d.ts +43 -0
- package/dist/events/cursor.js +78 -0
- package/dist/events/cursor.js.map +1 -0
- package/dist/events/memory-event-store.d.ts +34 -0
- package/dist/events/memory-event-store.js +110 -0
- package/dist/events/memory-event-store.js.map +1 -0
- package/dist/events/merge.d.ts +23 -0
- package/dist/events/merge.js +97 -0
- package/dist/events/merge.js.map +1 -0
- package/dist/events/normalized-collector.d.ts +62 -0
- package/dist/events/normalized-collector.js +156 -0
- package/dist/events/normalized-collector.js.map +1 -0
- package/dist/events/schema.d.ts +9 -0
- package/dist/events/schema.js +93 -0
- package/dist/events/schema.js.map +1 -0
- package/dist/events/snapshot.d.ts +32 -0
- package/dist/events/snapshot.js +57 -0
- package/dist/events/snapshot.js.map +1 -0
- package/dist/events/stream-key.d.ts +2 -0
- package/dist/events/stream-key.js +31 -0
- package/dist/events/stream-key.js.map +1 -0
- package/dist/events/types.d.ts +179 -0
- package/dist/events/types.js +66 -0
- package/dist/events/types.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 +10 -0
- package/dist/index.js +10 -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 +26 -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/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 +26 -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 +52 -0
- package/dist/preview/capture-screenshot.js +158 -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 +128 -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/resume/memory-progress-store.d.ts +39 -0
- package/dist/resume/memory-progress-store.js +82 -0
- package/dist/resume/memory-progress-store.js.map +1 -0
- package/dist/resume/memory-recent-app-store.d.ts +14 -0
- package/dist/resume/memory-recent-app-store.js +27 -0
- package/dist/resume/memory-recent-app-store.js.map +1 -0
- package/dist/resume/memory-turn-store.d.ts +18 -0
- package/dist/resume/memory-turn-store.js +73 -0
- package/dist/resume/memory-turn-store.js.map +1 -0
- package/dist/resume/progress-key.d.ts +21 -0
- package/dist/resume/progress-key.js +58 -0
- package/dist/resume/progress-key.js.map +1 -0
- package/dist/resume/stores.d.ts +14 -0
- package/dist/resume/stores.js +18 -0
- package/dist/resume/stores.js.map +1 -0
- package/dist/resume/types.d.ts +124 -0
- package/dist/resume/types.js +13 -0
- package/dist/resume/types.js.map +1 -0
- package/dist/sabs/agent-facing-text.d.ts +33 -0
- package/dist/sabs/agent-facing-text.js +125 -0
- package/dist/sabs/agent-facing-text.js.map +1 -0
- package/dist/sabs/browser-context.d.ts +53 -0
- package/dist/sabs/browser-context.js +91 -0
- package/dist/sabs/browser-context.js.map +1 -0
- package/dist/sabs/editor-client-methods.d.ts +147 -0
- package/dist/sabs/editor-client-methods.js +715 -0
- package/dist/sabs/editor-client-methods.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 +351 -0
- package/dist/sabs/session-peer.js +2 -0
- package/dist/sabs/session-peer.js.map +1 -0
- package/dist/sabs/turn-collector.d.ts +152 -0
- package/dist/sabs/turn-collector.js +573 -0
- package/dist/sabs/turn-collector.js.map +1 -0
- package/dist/sabs/websocket-session-peer.d.ts +514 -0
- package/dist/sabs/websocket-session-peer.js +2487 -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 +371 -0
- package/dist/server/client.js +572 -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 +14 -0
- package/dist/start.js +75 -0
- package/dist/start.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +32 -0
- package/dist/telemetry/metrics.js +57 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/transports/mcp/admin-tools.d.ts +47 -0
- package/dist/transports/mcp/admin-tools.js +164 -0
- package/dist/transports/mcp/admin-tools.js.map +1 -0
- package/dist/transports/mcp/app-status-html.d.ts +15 -0
- package/dist/transports/mcp/app-status-html.js +563 -0
- package/dist/transports/mcp/app-status-html.js.map +1 -0
- package/dist/transports/mcp/decision-elicitation.d.ts +74 -0
- package/dist/transports/mcp/decision-elicitation.js +233 -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/format-tool-content.d.ts +25 -0
- package/dist/transports/mcp/format-tool-content.js +48 -0
- package/dist/transports/mcp/format-tool-content.js.map +1 -0
- package/dist/transports/mcp/mount.d.ts +9 -0
- package/dist/transports/mcp/mount.js +469 -0
- package/dist/transports/mcp/mount.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/package.json +72 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import type { BrowserDriverContract } from "../capture/browser-contract.js";
|
|
2
|
+
import type { EventCursor } from "../events/cursor.js";
|
|
3
|
+
import type { LostEventRange } from "../events/types.js";
|
|
4
|
+
export type { CallerChannel, CallerRef } from "../resume/types.js";
|
|
5
|
+
export type CallerKind = "mcp";
|
|
6
|
+
/**
|
|
7
|
+
* The caller behind a capability invocation.
|
|
8
|
+
*
|
|
9
|
+
* Identity is optional because MCP hands over only the credential and lets the
|
|
10
|
+
* capability resolve it. Whoever resolves it, it is resolved exactly once —
|
|
11
|
+
* `/users/me` is the most expensive endpoint the Superblocks API exposes.
|
|
12
|
+
*/
|
|
13
|
+
export type Principal = {
|
|
14
|
+
apiKey: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
organizationId?: string;
|
|
17
|
+
userId?: string;
|
|
18
|
+
};
|
|
19
|
+
/** A principal whose identity the Superblocks API has confirmed. */
|
|
20
|
+
export type ResolvedPrincipal = Principal & {
|
|
21
|
+
organizationId: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
};
|
|
24
|
+
export type ProgressEvent = {
|
|
25
|
+
message: string;
|
|
26
|
+
type: "progress" | "auth_required" | "completed" | "error";
|
|
27
|
+
};
|
|
28
|
+
export type AuthElicitation = {
|
|
29
|
+
authUrl: string;
|
|
30
|
+
browser?: BrowserDriverContract;
|
|
31
|
+
reason: "idp_step_up";
|
|
32
|
+
turnId: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A failed capability, and the application it was working on when it failed.
|
|
36
|
+
*
|
|
37
|
+
* `start_app` persists an application row before it ever reaches live edit, so
|
|
38
|
+
* a failure past that point leaves the caller owning a resource it was never
|
|
39
|
+
* handed. `applicationId` is that handle, and it is a field because the
|
|
40
|
+
* alternative callers actually resorted to — regex a UUID out of `message`, or
|
|
41
|
+
* else fall back to "the most recent app" — drives another caller's build in
|
|
42
|
+
* any session with more than one of them.
|
|
43
|
+
*/
|
|
44
|
+
export type CapabilityError = {
|
|
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 resending the prompt is what recovers this application. */
|
|
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, and retrying is the right response.
|
|
71
|
+
*/
|
|
72
|
+
| "live_edit_terminated"
|
|
73
|
+
/** The job ended without writing a file or leaving a draft. */
|
|
74
|
+
| "no_changes" | "needs_decision" | "timeout";
|
|
75
|
+
/**
|
|
76
|
+
* How far a `start_app` / `edit_app` call follows the turn it starts.
|
|
77
|
+
*
|
|
78
|
+
* - `turn`: block until Clark's job is done (HTTP).
|
|
79
|
+
* - `ack`: return as soon as Clark accepts the prompt and let the caller follow
|
|
80
|
+
* the build through `check_app_progress`. The only way an MCP client that
|
|
81
|
+
* sends no `progressToken` — Claude Desktop — can show anything mid-build.
|
|
82
|
+
*/
|
|
83
|
+
export type TurnWait = "ack" | "turn";
|
|
84
|
+
/**
|
|
85
|
+
* Where a build stands.
|
|
86
|
+
*
|
|
87
|
+
* `unknown` means the gateway is not following a turn for this app: it finished
|
|
88
|
+
* and was already reported, or nothing was ever started here.
|
|
89
|
+
*/
|
|
90
|
+
export type BuildStatus = "building" | "cancelled"
|
|
91
|
+
/**
|
|
92
|
+
* Clark is working but out of the gateway's sight — polling cannot report it,
|
|
93
|
+
* and only the editor can. Ends the poll loop instead of running it out.
|
|
94
|
+
*/
|
|
95
|
+
| "detached"
|
|
96
|
+
/**
|
|
97
|
+
* The live-edit session backing the turn died before it finished, or never
|
|
98
|
+
* opened. Nothing was built, and the caller should retry rather than keep
|
|
99
|
+
* polling.
|
|
100
|
+
*/
|
|
101
|
+
| "live_edit_terminated" | "needs_decision"
|
|
102
|
+
/** Clark's job ended having built nothing; there is no app to show. */
|
|
103
|
+
| "no_changes" | "ready" | "timeout" | "unknown";
|
|
104
|
+
/**
|
|
105
|
+
* How a finished turn reads as a build status.
|
|
106
|
+
*
|
|
107
|
+
* Every member is spelled out and the default is unreachable on purpose. A
|
|
108
|
+
* `default: return "ready"` would answer "your app is fine" for any status
|
|
109
|
+
* added later, which is how a dead live edit came to be reported as `ready`
|
|
110
|
+
* in the first place; this way the compiler stops the next one.
|
|
111
|
+
*/
|
|
112
|
+
export declare function buildStatusOf(generationStatus: GenerationStatus): BuildStatus;
|
|
113
|
+
export type StartAppInput = {
|
|
114
|
+
branch?: string;
|
|
115
|
+
idempotencyKey: string;
|
|
116
|
+
/** Defaults to PLAN (editor parity). Pass BUILD to skip planning. */
|
|
117
|
+
mode?: "BUILD" | "PLAN";
|
|
118
|
+
name?: string;
|
|
119
|
+
prompt: string;
|
|
120
|
+
wait?: TurnWait;
|
|
121
|
+
};
|
|
122
|
+
export type DecisionPayload = {
|
|
123
|
+
kind: "multi_choice";
|
|
124
|
+
messageId?: string;
|
|
125
|
+
options: string[];
|
|
126
|
+
question: string;
|
|
127
|
+
} | {
|
|
128
|
+
kind: "plan";
|
|
129
|
+
messageId?: string;
|
|
130
|
+
plan: string;
|
|
131
|
+
title?: string;
|
|
132
|
+
};
|
|
133
|
+
export type StartAppResult = {
|
|
134
|
+
/** Clark's chat lines since the previous report, oldest first. */
|
|
135
|
+
activity?: string[];
|
|
136
|
+
applicationId: string;
|
|
137
|
+
/** Host-driver steer. Tokens never belong here. */
|
|
138
|
+
browser?: BrowserDriverContract;
|
|
139
|
+
/**
|
|
140
|
+
* Checkpoint the gateway committed for Clark's work. Absent when Clark left
|
|
141
|
+
* nothing to commit or the checkpoint did not land.
|
|
142
|
+
*/
|
|
143
|
+
checkpointCommitId?: string;
|
|
144
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
145
|
+
reply?: string;
|
|
146
|
+
/** Present when status is needs_decision. */
|
|
147
|
+
decision?: DecisionPayload;
|
|
148
|
+
editUrl: string;
|
|
149
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
150
|
+
generationStatus?: GenerationStatus;
|
|
151
|
+
liveEditId?: string;
|
|
152
|
+
/** Mode this turn ran in, so the caller can say whether Clark is planning. */
|
|
153
|
+
mode?: "BUILD" | "PLAN";
|
|
154
|
+
name: string;
|
|
155
|
+
/** Mid-turn testApi / testIntegration outcomes when the turn finished. */
|
|
156
|
+
recentRuns?: RecentToolRun[];
|
|
157
|
+
status: BuildStatus;
|
|
158
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
159
|
+
viewStatus?: "ready" | "unknown";
|
|
160
|
+
};
|
|
161
|
+
export type CheckAppProgressInput = {
|
|
162
|
+
applicationId?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Resume from an explicit position instead of the one stored for this
|
|
165
|
+
* caller. Only needed when a caller keeps its own place — an omitted cursor
|
|
166
|
+
* reads from wherever the gateway last left this caller.
|
|
167
|
+
*/
|
|
168
|
+
cursor?: EventCursor;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Machine-readable pacing, so a caller polls on the gateway's terms rather
|
|
172
|
+
* than on a number the model invented.
|
|
173
|
+
*
|
|
174
|
+
* Every long-running result carries a poll interval whether or not the host
|
|
175
|
+
* supports progress notifications: a host that ignores progress still has to be
|
|
176
|
+
* told when to come back.
|
|
177
|
+
*/
|
|
178
|
+
export type PollPacing = {
|
|
179
|
+
/** Cursor to resume from. Stable JSON; hand it back verbatim. */
|
|
180
|
+
cursor?: EventCursor;
|
|
181
|
+
/** How long to wait before asking again. Zero once nothing is in flight. */
|
|
182
|
+
nextPollAfterMs: number;
|
|
183
|
+
/**
|
|
184
|
+
* What is left of the turn budget before the gateway gives up on it.
|
|
185
|
+
*
|
|
186
|
+
* Present only while this gateway is following the turn itself and can see
|
|
187
|
+
* its clock, which is the only case where the number means anything. It used
|
|
188
|
+
* to be sent unconditionally, so a poll of an app with no turn at all
|
|
189
|
+
* answered with the full budget next to a zero elapsed - a fresh,
|
|
190
|
+
* fully-funded turn, asserted about nothing (ENG-5808).
|
|
191
|
+
*
|
|
192
|
+
* Absent does not mean "nothing is running": a build read out of the
|
|
193
|
+
* persisted stream reports `building` without a budget, because the turn is
|
|
194
|
+
* running somewhere this process cannot time it.
|
|
195
|
+
* {@link PollPacing.nextPollAfterMs} and the status are what say whether to
|
|
196
|
+
* keep polling.
|
|
197
|
+
*/
|
|
198
|
+
remainingTurnBudgetMs?: number;
|
|
199
|
+
/**
|
|
200
|
+
* Producers whose retained history had already passed the resumed cursor.
|
|
201
|
+
* Present only when something was actually lost.
|
|
202
|
+
*/
|
|
203
|
+
staleStreams?: LostEventRange[];
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* A nonterminal warning that a build has gone quiet, raised well before the
|
|
207
|
+
* turn budget runs out so a caller can say something rather than sit on a
|
|
208
|
+
* silent poll loop until it times out.
|
|
209
|
+
*/
|
|
210
|
+
export type StallHint = {
|
|
211
|
+
/** How long the build has been running without saying anything new. */
|
|
212
|
+
quietMs: number;
|
|
213
|
+
reason: "long_quiet";
|
|
214
|
+
};
|
|
215
|
+
export type CheckAppProgressResult = PollPacing & {
|
|
216
|
+
/** Clark's chat lines since the previous poll, oldest first. */
|
|
217
|
+
activity: string[];
|
|
218
|
+
applicationId: string;
|
|
219
|
+
/** How long Clark has been on this turn, so a quiet poll still has news. */
|
|
220
|
+
elapsedSeconds: number;
|
|
221
|
+
/** See StartAppResult.checkpointCommitId. */
|
|
222
|
+
checkpointCommitId?: string;
|
|
223
|
+
/** Present once the turn has finished. */
|
|
224
|
+
reply?: string;
|
|
225
|
+
/** Present when status is needs_decision. */
|
|
226
|
+
decision?: DecisionPayload;
|
|
227
|
+
editUrl: string;
|
|
228
|
+
/** Present once the turn has finished. */
|
|
229
|
+
generationStatus?: GenerationStatus;
|
|
230
|
+
/** Recent mid-turn testApi / testIntegration outcomes, oldest first. */
|
|
231
|
+
recentRuns?: RecentToolRun[];
|
|
232
|
+
/** Emitted once per quiet spell, never in place of a terminal answer. */
|
|
233
|
+
stallHint?: StallHint;
|
|
234
|
+
status: BuildStatus;
|
|
235
|
+
/** Present once the turn has finished. */
|
|
236
|
+
viewStatus?: "ready" | "unknown";
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* One mid-turn testApi or testIntegration result surfaced to MCP clients.
|
|
240
|
+
* Output/error strings are truncated so tool results stay readable.
|
|
241
|
+
*/
|
|
242
|
+
export type RecentToolRun = {
|
|
243
|
+
kind: "test_api" | "test_integration";
|
|
244
|
+
name: string;
|
|
245
|
+
success: boolean;
|
|
246
|
+
summary: string;
|
|
247
|
+
at: string;
|
|
248
|
+
};
|
|
249
|
+
export type EditAppInput = {
|
|
250
|
+
applicationId?: string;
|
|
251
|
+
branch?: string;
|
|
252
|
+
idempotencyKey: string;
|
|
253
|
+
/** Defaults to PLAN. Approve forces BUILD with planContext.approved. */
|
|
254
|
+
mode?: "BUILD" | "PLAN";
|
|
255
|
+
/**
|
|
256
|
+
* Approve or refine a pending Clark plan. When omitted and a plan is pending,
|
|
257
|
+
* a normal prompt is treated as refine feedback. `approve` does not need a
|
|
258
|
+
* prompt — the pending plan is sent as the build prompt.
|
|
259
|
+
*/
|
|
260
|
+
planAction?: "approve" | "refine";
|
|
261
|
+
/** Required unless `planAction` is `approve`. */
|
|
262
|
+
prompt?: string;
|
|
263
|
+
wait?: TurnWait;
|
|
264
|
+
};
|
|
265
|
+
export type EditAppResult = {
|
|
266
|
+
/** Clark's chat lines since the previous report, oldest first. */
|
|
267
|
+
activity?: string[];
|
|
268
|
+
applicationId: string;
|
|
269
|
+
/** Host-driver steer. Tokens never belong here. */
|
|
270
|
+
browser?: BrowserDriverContract;
|
|
271
|
+
/** See StartAppResult.checkpointCommitId. */
|
|
272
|
+
checkpointCommitId?: string;
|
|
273
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
274
|
+
reply?: string;
|
|
275
|
+
/** Present when status is needs_decision. */
|
|
276
|
+
decision?: DecisionPayload;
|
|
277
|
+
editUrl: string;
|
|
278
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
279
|
+
generationStatus?: GenerationStatus;
|
|
280
|
+
/**
|
|
281
|
+
* Mode this turn actually ran in. Follow-ups stay BUILD once a plan was
|
|
282
|
+
* approved, so the caller can see it does not need to re-send mode.
|
|
283
|
+
*/
|
|
284
|
+
mode?: "BUILD" | "PLAN";
|
|
285
|
+
/** Mid-turn testApi / testIntegration outcomes when the turn finished. */
|
|
286
|
+
recentRuns?: RecentToolRun[];
|
|
287
|
+
status: BuildStatus;
|
|
288
|
+
/** Absent while the build is still running (`wait: "ack"`). */
|
|
289
|
+
viewStatus?: "ready" | "unknown";
|
|
290
|
+
};
|
|
291
|
+
export type PreviewAppInput = {
|
|
292
|
+
applicationId?: string;
|
|
293
|
+
branch?: string;
|
|
294
|
+
/**
|
|
295
|
+
* Capture a deployed-shell screenshot when the preview is ready. `get_app`
|
|
296
|
+
* sets this false when it will screenshot the live library instead.
|
|
297
|
+
*/
|
|
298
|
+
includeScreenshot?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Whether to wait for the build. See {@link GetAppInput.wait}; `false`
|
|
301
|
+
* starts or observes the build and returns `status: "building"` at once.
|
|
302
|
+
*/
|
|
303
|
+
wait?: boolean;
|
|
304
|
+
};
|
|
305
|
+
export type PreviewAppResult = {
|
|
306
|
+
applicationId: string;
|
|
307
|
+
browser?: BrowserDriverContract;
|
|
308
|
+
/**
|
|
309
|
+
* True when preview URLs are returned but Gateway cannot screenshot because
|
|
310
|
+
* there is no Chromium and no host browser MCP.
|
|
311
|
+
*/
|
|
312
|
+
needsBrowserDriver?: boolean;
|
|
313
|
+
/** Commit that was built and is being previewed. */
|
|
314
|
+
commitId: string;
|
|
315
|
+
/** Editor URL for the same app (MCP App Open editor button). */
|
|
316
|
+
editUrl: string;
|
|
317
|
+
/** Display name, so callers can say more than a UUID. Absent when unknown. */
|
|
318
|
+
name?: string;
|
|
319
|
+
previewUrl: string;
|
|
320
|
+
/**
|
|
321
|
+
* Direct viewer URL used for screenshots (may be http localhost even when
|
|
322
|
+
* `previewUrl` is an https gateway redirect).
|
|
323
|
+
*/
|
|
324
|
+
viewerUrl?: string;
|
|
325
|
+
/**
|
|
326
|
+
* True when `previewUrl` is https and Claude Desktop can openLink it.
|
|
327
|
+
*/
|
|
328
|
+
openableViaHttps?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Base64 JPEG of the running preview when capture succeeds. Absent when
|
|
331
|
+
* capture was skipped (still building) or soft-failed.
|
|
332
|
+
*/
|
|
333
|
+
screenshotBase64?: string;
|
|
334
|
+
/**
|
|
335
|
+
* `building` means the URL is right but SABS has not finished building it
|
|
336
|
+
* yet; previewing again resumes watching the same build.
|
|
337
|
+
*/
|
|
338
|
+
status: "building" | "ready";
|
|
339
|
+
};
|
|
340
|
+
export type GetAppInput = {
|
|
341
|
+
applicationId?: string;
|
|
342
|
+
branch?: string;
|
|
343
|
+
/** When true, ensure a preview build exists and return preview URLs. */
|
|
344
|
+
ensurePreview?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Whether to wait for the preview build.
|
|
347
|
+
*
|
|
348
|
+
* A boolean, and deliberately not the {@link TurnWait} the prompt
|
|
349
|
+
* capabilities take: this decides how long *this call* blocks on a build,
|
|
350
|
+
* while `wait: "ack"` decides how far a prompt follows the turn it starts.
|
|
351
|
+
* Conflating them would make `wait: "ack"` mean something here, where there
|
|
352
|
+
* is no turn to acknowledge.
|
|
353
|
+
*
|
|
354
|
+
* `false` starts or observes the build and returns straight away with
|
|
355
|
+
* `status: "building"` and pacing to poll on. `true` (the default) waits,
|
|
356
|
+
* but never past the host's tool-call ceiling — it returns `building` with
|
|
357
|
+
* the same pacing rather than holding the call open.
|
|
358
|
+
*/
|
|
359
|
+
wait?: boolean;
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* What has to happen before this app has anything worth previewing. Present
|
|
363
|
+
* only when the gateway declined to build one, and paired with the status that
|
|
364
|
+
* says why.
|
|
365
|
+
*/
|
|
366
|
+
export type PendingAppAction =
|
|
367
|
+
/** Clark asked a multi_choice question; answer it with `edit_app`. */
|
|
368
|
+
"answer_question"
|
|
369
|
+
/** Clark proposed a plan; `edit_app` with `planAction: "approve"` builds it. */
|
|
370
|
+
| "approve_plan"
|
|
371
|
+
/** The last turn ended without writing anything; `edit_app` starts it over. */
|
|
372
|
+
| "retry_build"
|
|
373
|
+
/** A turn is in flight; follow it with `check_app_progress`. */
|
|
374
|
+
| "wait_for_build";
|
|
375
|
+
export type GetAppResult = Partial<PollPacing> & {
|
|
376
|
+
applicationId: string;
|
|
377
|
+
browser?: BrowserDriverContract;
|
|
378
|
+
commitId?: string;
|
|
379
|
+
/** The question or plan Clark is waiting on, when status is needs_decision. */
|
|
380
|
+
decision?: DecisionPayload;
|
|
381
|
+
editUrl: string;
|
|
382
|
+
/** Display name, so callers can say more than a UUID. Absent when unknown. */
|
|
383
|
+
name?: string;
|
|
384
|
+
openableViaHttps?: boolean;
|
|
385
|
+
/** Set whenever no preview was built; says what unblocks one. */
|
|
386
|
+
pendingAction?: PendingAppAction;
|
|
387
|
+
needsBrowserDriver?: boolean;
|
|
388
|
+
previewUrl?: string;
|
|
389
|
+
publishUrl?: string;
|
|
390
|
+
screenshotBase64?: string;
|
|
391
|
+
/**
|
|
392
|
+
* `cancelled`, `live_edit_terminated`, `no_changes` and `timeout` mean the
|
|
393
|
+
* last turn left nothing to show, so no preview was built for it.
|
|
394
|
+
*/
|
|
395
|
+
status: "building" | "cancelled" | "live_edit_terminated" | "needs_decision" | "no_changes" | "ready" | "timeout" | "unknown";
|
|
396
|
+
viewerUrl?: string;
|
|
397
|
+
};
|
|
398
|
+
export type PublishAppInput = {
|
|
399
|
+
applicationId?: string;
|
|
400
|
+
branch?: string;
|
|
401
|
+
commitId?: string;
|
|
402
|
+
idempotencyKey: string;
|
|
403
|
+
prompt: string;
|
|
404
|
+
};
|
|
405
|
+
export type PublishAppResult = {
|
|
406
|
+
applicationId: string;
|
|
407
|
+
commitId: string;
|
|
408
|
+
/** Present when the deploy response carried an id. */
|
|
409
|
+
deploymentId?: string;
|
|
410
|
+
publishUrl: string;
|
|
411
|
+
status: "deployed";
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Gateway MCP/HTTP import rejects archives above this size. Larger ZIPs almost
|
|
415
|
+
* certainly include `node_modules` (or similar); those belong outside the
|
|
416
|
+
* export — deps are installed on or after import. Stricter than the browser
|
|
417
|
+
* migration UI (50 MB) on purpose.
|
|
418
|
+
*/
|
|
419
|
+
export declare const IMPORT_ZIP_MAX_BYTES = 1048576;
|
|
420
|
+
/**
|
|
421
|
+
* Ceiling on an inline `zipBase64` payload, far below
|
|
422
|
+
* {@link IMPORT_ZIP_MAX_BYTES} because base64 is not a transport a model can
|
|
423
|
+
* afford: every 3 bytes of archive cost 4 characters it has to write out one
|
|
424
|
+
* token at a time, so even a 42 KB export runs to 57,000 characters and the
|
|
425
|
+
* tool call never gets sent. Real archives arrive by name — this size only
|
|
426
|
+
* carries test fixtures.
|
|
427
|
+
*/
|
|
428
|
+
export declare const IMPORT_ZIP_BASE64_MAX_CHARS = 8192;
|
|
429
|
+
/** Third-party import source ids Clark uses for migration prompts and billing. */
|
|
430
|
+
export type ImportAppSource = "chatgpt" | "claude" | "claude-design" | "lovable" | "replit" | "streamlit" | "v0" | "zip";
|
|
431
|
+
export type ImportAppInput = {
|
|
432
|
+
branch?: string;
|
|
433
|
+
idempotencyKey: string;
|
|
434
|
+
/** Defaults to PLAN. */
|
|
435
|
+
mode?: "BUILD" | "PLAN";
|
|
436
|
+
name?: string;
|
|
437
|
+
/** Extra intent appended after the migration template (e.g. harden security). */
|
|
438
|
+
prompt?: string;
|
|
439
|
+
source?: ImportAppSource | string;
|
|
440
|
+
wait?: TurnWait;
|
|
441
|
+
/** Absolute path on the gateway host; mutually exclusive with zipBase64. */
|
|
442
|
+
zipBase64?: string;
|
|
443
|
+
zipPath?: string;
|
|
444
|
+
};
|
|
445
|
+
/** Same shape as {@link StartAppResult}: import creates an app then starts Clark. */
|
|
446
|
+
export type ImportAppResult = StartAppResult;
|
|
@@ -0,0 +1,47 @@
|
|
|
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) {
|
|
10
|
+
switch (generationStatus) {
|
|
11
|
+
case "cancelled":
|
|
12
|
+
return "cancelled";
|
|
13
|
+
case "completed":
|
|
14
|
+
return "ready";
|
|
15
|
+
case "detached":
|
|
16
|
+
return "detached";
|
|
17
|
+
case "live_edit_terminated":
|
|
18
|
+
return "live_edit_terminated";
|
|
19
|
+
case "needs_decision":
|
|
20
|
+
return "needs_decision";
|
|
21
|
+
case "no_changes":
|
|
22
|
+
return "no_changes";
|
|
23
|
+
case "timeout":
|
|
24
|
+
return "timeout";
|
|
25
|
+
default: {
|
|
26
|
+
const unhandled = generationStatus;
|
|
27
|
+
return unhandled;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gateway MCP/HTTP import rejects archives above this size. Larger ZIPs almost
|
|
33
|
+
* certainly include `node_modules` (or similar); those belong outside the
|
|
34
|
+
* export — deps are installed on or after import. Stricter than the browser
|
|
35
|
+
* migration UI (50 MB) on purpose.
|
|
36
|
+
*/
|
|
37
|
+
export const IMPORT_ZIP_MAX_BYTES = 1_048_576;
|
|
38
|
+
/**
|
|
39
|
+
* Ceiling on an inline `zipBase64` payload, far below
|
|
40
|
+
* {@link IMPORT_ZIP_MAX_BYTES} because base64 is not a transport a model can
|
|
41
|
+
* afford: every 3 bytes of archive cost 4 characters it has to write out one
|
|
42
|
+
* token at a time, so even a 42 KB export runs to 57,000 characters and the
|
|
43
|
+
* tool call never gets sent. Real archives arrive by name — this size only
|
|
44
|
+
* carries test fixtures.
|
|
45
|
+
*/
|
|
46
|
+
export const IMPORT_ZIP_BASE64_MAX_CHARS = 8_192;
|
|
47
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/capabilities/types.ts"],"names":[],"mappings":"AA0HA;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,gBAAkC;IAC9D,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;AAyUD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CaptureMode } from "./mode.js";
|
|
2
|
+
export declare const HOST_BROWSER_TOOLS_UNKNOWN: "unknown";
|
|
3
|
+
export declare const MUST_NOT_CLOSE_UNTIL = "the Superblocks task is done (status ready, or the user no longer needs the browser session)";
|
|
4
|
+
export declare const NEEDS_BROWSER_DRIVER_CODE = "needs_browser_driver";
|
|
5
|
+
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 gateway setup. Gateway Chromium cannot complete IdP. Config on disk can lie if a listed server fails to start.";
|
|
6
|
+
/**
|
|
7
|
+
* Structured steer for host browser tools. Tokens never belong here.
|
|
8
|
+
*
|
|
9
|
+
* Until a loopback capture URL exists, live canvas is not a navigate target:
|
|
10
|
+
* `canvas.doNotOpen` is the edit URL (opening it mid-build steals the turn).
|
|
11
|
+
*/
|
|
12
|
+
export type BrowserDriverContract = {
|
|
13
|
+
captureMode: CaptureMode;
|
|
14
|
+
canvas: {
|
|
15
|
+
doNotOpen: string;
|
|
16
|
+
};
|
|
17
|
+
driver: {
|
|
18
|
+
isolated?: boolean;
|
|
19
|
+
mustNotCloseUntil: string;
|
|
20
|
+
};
|
|
21
|
+
hostBrowserTools: typeof HOST_BROWSER_TOOLS_UNKNOWN;
|
|
22
|
+
uiOrigin: {
|
|
23
|
+
navigate: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function buildBrowserDriverContract(input: {
|
|
27
|
+
captureMode: CaptureMode;
|
|
28
|
+
editUrl: string;
|
|
29
|
+
isolated?: boolean;
|
|
30
|
+
uiOrigin: string;
|
|
31
|
+
}): BrowserDriverContract;
|
|
32
|
+
export declare function needsBrowserDriverError(): {
|
|
33
|
+
code: typeof NEEDS_BROWSER_DRIVER_CODE;
|
|
34
|
+
kind: "error";
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const HOST_BROWSER_TOOLS_UNKNOWN = "unknown";
|
|
2
|
+
export const MUST_NOT_CLOSE_UNTIL = "the Superblocks task is done (status ready, or the user no longer needs the browser session)";
|
|
3
|
+
export const NEEDS_BROWSER_DRIVER_CODE = "needs_browser_driver";
|
|
4
|
+
export 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 gateway setup. Gateway Chromium cannot complete IdP. Config on disk can lie if a listed server fails to start.";
|
|
5
|
+
export function buildBrowserDriverContract(input) {
|
|
6
|
+
return {
|
|
7
|
+
captureMode: input.captureMode,
|
|
8
|
+
canvas: { doNotOpen: input.editUrl },
|
|
9
|
+
driver: {
|
|
10
|
+
...(input.isolated ? { isolated: true } : {}),
|
|
11
|
+
mustNotCloseUntil: MUST_NOT_CLOSE_UNTIL,
|
|
12
|
+
},
|
|
13
|
+
hostBrowserTools: HOST_BROWSER_TOOLS_UNKNOWN,
|
|
14
|
+
uiOrigin: { navigate: input.uiOrigin },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function needsBrowserDriverError() {
|
|
18
|
+
return {
|
|
19
|
+
code: NEEDS_BROWSER_DRIVER_CODE,
|
|
20
|
+
kind: "error",
|
|
21
|
+
message: NEEDS_BROWSER_DRIVER_MESSAGE,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=browser-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-contract.js","sourceRoot":"","sources":["../../src/capture/browser-contract.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG,SAAkB,CAAC;AAE7D,MAAM,CAAC,MAAM,oBAAoB,GAC/B,8FAA8F,CAAC;AAEjG,MAAM,CAAC,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAEhE,MAAM,CAAC,MAAM,4BAA4B,GACvC,2OAA2O,CAAC;AAmB9O,MAAM,UAAU,0BAA0B,CAAC,KAK1C;IACC,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,MAAM,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE;QACpC,MAAM,EAAE;YACN,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,iBAAiB,EAAE,oBAAoB;SACxC;QACD,gBAAgB,EAAE,0BAA0B;QAC5C,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;KACvC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB;IAKrC,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,4BAA4B;KACtC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numbered MUSTs for host browser drivers. Appended to MCP server
|
|
3
|
+
* instructions so a model that already has Playwright MCP (or agent-browser)
|
|
4
|
+
* does not open the edit URL mid-build or paste tokens into evaluate.
|
|
5
|
+
*
|
|
6
|
+
* Detecting that this turn actually has those tools is ENG-5858's sibling
|
|
7
|
+
* concern; these lines only steer when the tools exist.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BROWSER_DRIVER_INSTRUCTIONS = "Browser capture (MUST):\n1. Prefer host browser tools (Playwright MCP, chrome-devtools, agent-browser) over opening Superblocks URLs yourself. Honor the structured \"browser\" field on start_app / get_app / idp_step_up; do not paraphrase it into a different URL.\n2. NEVER open canvas.doNotOpen (the edit URL) while status is \"building\". That tab steals the live-edit turn and the gateway goes \"detached\".\n3. NEVER paste tokens, JWTs, or API keys into browser evaluate or fill. Tokens are not in tool JSON; do not invent them.\n4. Playwright MCP MUST NOT use --isolated for Superblocks IdP. Cookies must survive the session.\n5. MUST NOT call browser_close until the Superblocks task is done (see driver.mustNotCloseUntil).\n6. agent-browser MUST always pass --profile and a stable --session for the same Superblocks origin.\n7. Claude-in-Chrome is not a mid-turn canvas. Do not use it to screenshot the live Vite app while a Gateway turn is held.";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numbered MUSTs for host browser drivers. Appended to MCP server
|
|
3
|
+
* instructions so a model that already has Playwright MCP (or agent-browser)
|
|
4
|
+
* does not open the edit URL mid-build or paste tokens into evaluate.
|
|
5
|
+
*
|
|
6
|
+
* Detecting that this turn actually has those tools is ENG-5858's sibling
|
|
7
|
+
* concern; these lines only steer when the tools exist.
|
|
8
|
+
*/
|
|
9
|
+
export const BROWSER_DRIVER_INSTRUCTIONS = `Browser capture (MUST):
|
|
10
|
+
1. Prefer host browser tools (Playwright MCP, chrome-devtools, agent-browser) over opening Superblocks URLs yourself. Honor the structured "browser" field on start_app / get_app / idp_step_up; do not paraphrase it into a different URL.
|
|
11
|
+
2. NEVER open canvas.doNotOpen (the edit URL) while status is "building". That tab steals the live-edit turn and the gateway goes "detached".
|
|
12
|
+
3. NEVER paste tokens, JWTs, or API keys into browser evaluate or fill. Tokens are not in tool JSON; do not invent them.
|
|
13
|
+
4. Playwright MCP MUST NOT use --isolated for Superblocks IdP. Cookies must survive the session.
|
|
14
|
+
5. MUST NOT call browser_close until the Superblocks task is done (see driver.mustNotCloseUntil).
|
|
15
|
+
6. agent-browser MUST always pass --profile and a stable --session for the same Superblocks origin.
|
|
16
|
+
7. Claude-in-Chrome is not a mid-turn canvas. Do not use it to screenshot the live Vite app while a Gateway turn is held.`;
|
|
17
|
+
//# sourceMappingURL=browser-instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-instructions.js","sourceRoot":"","sources":["../../src/capture/browser-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;0HAO+E,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stderr probe for live-library capture when canvas execute is unhealthy.
|
|
3
|
+
* Used to tell CORS / 401 / pending-abort apart from Clark testApi. Do not
|
|
4
|
+
* log tokens. Success (v3/execute POST 200) stays quiet. CORS preflight is
|
|
5
|
+
* not execute.
|
|
6
|
+
*/
|
|
7
|
+
export type CaptureParentEvent = {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
export type CaptureExecuteProbe = {
|
|
11
|
+
failure?: string;
|
|
12
|
+
method: string;
|
|
13
|
+
path: string;
|
|
14
|
+
pending?: boolean;
|
|
15
|
+
status?: number;
|
|
16
|
+
};
|
|
17
|
+
export type CaptureProbeInput = {
|
|
18
|
+
agentUrl?: string;
|
|
19
|
+
consoleText: string[];
|
|
20
|
+
execute: CaptureExecuteProbe[];
|
|
21
|
+
pageErrors: string[];
|
|
22
|
+
parentEvents: CaptureParentEvent[];
|
|
23
|
+
paintInnerText: string;
|
|
24
|
+
paintKind: string;
|
|
25
|
+
};
|
|
26
|
+
export type CaptureProbeSummary = {
|
|
27
|
+
agentHost?: string;
|
|
28
|
+
console: string[];
|
|
29
|
+
execute: CaptureExecuteProbe[];
|
|
30
|
+
pageErrors: string[];
|
|
31
|
+
paint: {
|
|
32
|
+
innerText: string;
|
|
33
|
+
kind: string;
|
|
34
|
+
};
|
|
35
|
+
parent: string[];
|
|
36
|
+
unanswered: string[];
|
|
37
|
+
};
|
|
38
|
+
export declare function isLibraryExecuteUrl(url: string): boolean;
|
|
39
|
+
export declare function redactCaptureUrl(url: string): string;
|
|
40
|
+
export declare function redactCaptureSecrets(text: string): string;
|
|
41
|
+
export declare function executeStillInFlight(execute: CaptureExecuteProbe[]): boolean;
|
|
42
|
+
export declare function shouldKeepCaptureConsole(text: string): boolean;
|
|
43
|
+
export declare function summarizeCaptureProbe(input: CaptureProbeInput): CaptureProbeSummary;
|
|
44
|
+
export type CaptureProbeCollector = {
|
|
45
|
+
consoleText: string[];
|
|
46
|
+
execute: CaptureExecuteProbe[];
|
|
47
|
+
pageErrors: string[];
|
|
48
|
+
};
|
|
49
|
+
type ProbePage = {
|
|
50
|
+
on: (event: string, handler: (arg: unknown) => void) => void;
|
|
51
|
+
};
|
|
52
|
+
export declare function attachLibraryCaptureProbe(page: ProbePage, collector: CaptureProbeCollector): void;
|
|
53
|
+
export declare function shouldLogCaptureProbe(summary: CaptureProbeSummary): boolean;
|
|
54
|
+
export declare function logCaptureProbe(summary: CaptureProbeSummary): void;
|
|
55
|
+
export {};
|