@superblocksteam/gateway 2.0.166 → 2.0.168-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.
Files changed (86) hide show
  1. package/README.md +163 -28
  2. package/dist/agents/resolve-orchestrator-url.js +1 -2
  3. package/dist/agents/resolve-orchestrator-url.js.map +1 -1
  4. package/dist/capabilities/lifecycle.d.ts +3 -0
  5. package/dist/capabilities/lifecycle.js +330 -128
  6. package/dist/capabilities/lifecycle.js.map +1 -1
  7. package/dist/capabilities/live-state-attaches.d.ts +26 -0
  8. package/dist/capabilities/live-state-attaches.js +41 -0
  9. package/dist/capabilities/live-state-attaches.js.map +1 -0
  10. package/dist/capabilities/tool-permission-reply.d.ts +28 -0
  11. package/dist/capabilities/tool-permission-reply.js +55 -0
  12. package/dist/capabilities/tool-permission-reply.js.map +1 -0
  13. package/dist/capabilities/types.d.ts +19 -1
  14. package/dist/capabilities/types.js.map +1 -1
  15. package/dist/deadline.d.ts +6 -0
  16. package/dist/deadline.js +23 -0
  17. package/dist/deadline.js.map +1 -0
  18. package/dist/deps.d.ts +7 -0
  19. package/dist/health/readiness.js +1 -17
  20. package/dist/health/readiness.js.map +1 -1
  21. package/dist/integrations/filters.js +2 -2
  22. package/dist/integrations/filters.js.map +1 -1
  23. package/dist/orchestrator/client.d.ts +2 -1
  24. package/dist/orchestrator/client.js +4 -2
  25. package/dist/orchestrator/client.js.map +1 -1
  26. package/dist/sabs/app-state.d.ts +1 -0
  27. package/dist/sabs/app-state.js +9 -0
  28. package/dist/sabs/app-state.js.map +1 -1
  29. package/dist/sabs/awaited-decision.d.ts +24 -1
  30. package/dist/sabs/awaited-decision.js +40 -9
  31. package/dist/sabs/awaited-decision.js.map +1 -1
  32. package/dist/sabs/editor-client-methods.d.ts +21 -10
  33. package/dist/sabs/editor-client-methods.js +48 -24
  34. package/dist/sabs/editor-client-methods.js.map +1 -1
  35. package/dist/sabs/session-peer.d.ts +47 -14
  36. package/dist/sabs/session-peer.js.map +1 -1
  37. package/dist/sabs/turn-collector.d.ts +27 -1
  38. package/dist/sabs/turn-collector.js +38 -2
  39. package/dist/sabs/turn-collector.js.map +1 -1
  40. package/dist/sabs/websocket-session-peer.d.ts +27 -3
  41. package/dist/sabs/websocket-session-peer.js +466 -66
  42. package/dist/sabs/websocket-session-peer.js.map +1 -1
  43. package/dist/server/client.d.ts +3 -0
  44. package/dist/server/client.js +7 -3
  45. package/dist/server/client.js.map +1 -1
  46. package/dist/start.d.ts +13 -2
  47. package/dist/start.js +112 -12
  48. package/dist/start.js.map +1 -1
  49. package/dist/telemetry/metrics.js +8 -21
  50. package/dist/telemetry/metrics.js.map +1 -1
  51. package/dist/telemetry/runtime.d.ts +5 -0
  52. package/dist/telemetry/runtime.js +22 -8
  53. package/dist/telemetry/runtime.js.map +1 -1
  54. package/dist/transports/mcp/admin-tools.d.ts +2 -1
  55. package/dist/transports/mcp/admin-tools.js +19 -2
  56. package/dist/transports/mcp/admin-tools.js.map +1 -1
  57. package/dist/transports/mcp/client-presentation.d.ts +9 -1
  58. package/dist/transports/mcp/client-presentation.js +10 -0
  59. package/dist/transports/mcp/client-presentation.js.map +1 -1
  60. package/dist/transports/mcp/decision-card-html.d.ts +4 -2
  61. package/dist/transports/mcp/decision-card-html.js +107 -25
  62. package/dist/transports/mcp/decision-card-html.js.map +1 -1
  63. package/dist/transports/mcp/decision-elicitation.d.ts +3 -2
  64. package/dist/transports/mcp/decision-elicitation.js +67 -2
  65. package/dist/transports/mcp/decision-elicitation.js.map +1 -1
  66. package/dist/transports/mcp/format-tool-content.d.ts +7 -0
  67. package/dist/transports/mcp/format-tool-content.js +3 -3
  68. package/dist/transports/mcp/format-tool-content.js.map +1 -1
  69. package/dist/transports/mcp/instructions/result.js +1 -0
  70. package/dist/transports/mcp/instructions/result.js.map +1 -1
  71. package/dist/transports/mcp/instructions/tools/ask-user.d.ts +2 -1
  72. package/dist/transports/mcp/instructions/tools/ask-user.js +9 -2
  73. package/dist/transports/mcp/instructions/tools/ask-user.js.map +1 -1
  74. package/dist/transports/mcp/instructions/tools/copy.d.ts +5 -2
  75. package/dist/transports/mcp/instructions/tools/copy.js +20 -5
  76. package/dist/transports/mcp/instructions/tools/copy.js.map +1 -1
  77. package/dist/transports/mcp/instructions/tools/edit-app.d.ts +1 -1
  78. package/dist/transports/mcp/instructions/tools/edit-app.js +11 -1
  79. package/dist/transports/mcp/instructions/tools/edit-app.js.map +1 -1
  80. package/dist/transports/mcp/mount.d.ts +2 -3
  81. package/dist/transports/mcp/mount.js +395 -112
  82. package/dist/transports/mcp/mount.js.map +1 -1
  83. package/dist/transports/mcp/plan-approval.d.ts +23 -13
  84. package/dist/transports/mcp/plan-approval.js +39 -26
  85. package/dist/transports/mcp/plan-approval.js.map +1 -1
  86. package/package.json +5 -5
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # Gateway v0
2
2
 
3
3
  Standalone Superblocks entry point for a **single MCP connector** (Admin + Builder)
4
- over **stdio**, running as the already-logged-in Superblocks CLI user.
4
+ over **stdio**, running as the Superblocks user authenticated through browser
5
+ login or a personal API key.
5
6
 
6
7
  Builder tools (`upload_artifact`, `start_app`, `edit_app`,
7
8
  `check_app_progress`, `ask_user`, `get_app`, `build_app`,
@@ -10,13 +11,15 @@ Admin tools from `@superblocksteam/mcp-server` share this process.
10
11
 
11
12
  The MCP host owns process lifecycle: it spawns `superblocks mcp serve`. The
12
13
  unified Gateway has no foreground HTTP `/mcp`, no OAuth resource server, and no
13
- linked-grant exchange. Personal API keys here are the CLI session
14
- (`~/.superblocks/auth.json` / `SUPERBLOCKS_AUTH_FILE` / `just worktree auth`).
14
+ linked-grant exchange. Browser login uses authorization code + PKCE to obtain
15
+ Server-audience access tokens. Personal API keys remain supported through
16
+ `SUPERBLOCKS_API_TOKEN` or the CLI session (`~/.superblocks/auth.json` /
17
+ `SUPERBLOCKS_AUTH_FILE` / `just worktree auth`).
15
18
 
16
19
  Scope notes:
17
20
 
18
21
  - In-memory stores only; no Redis (ENG-5594).
19
- - CLI identity only. Linked MCP grants, static `GATEWAY_DEV_SUPERBLOCKS_API_KEY`,
22
+ - One authenticated user per process. Linked MCP grants, static `GATEWAY_DEV_SUPERBLOCKS_API_KEY`,
20
23
  and on-behalf-of exchange are not supported.
21
24
  - Missing Playwright Chromium does not block start (ENG-5796). Screenshots fail
22
25
  closed when Chromium is absent.
@@ -76,8 +79,8 @@ permission to run local MCP servers. See [Anthropic's organization plugin guide]
76
79
  ## Internal review
77
80
 
78
81
  ```bash
79
- # Log in if needed (same CLI session the Gateway will use)
80
- superblocks login
82
+ # Sign in through the browser for this Server origin
83
+ superblocks mcp login --server-url https://app.superblocks.com
81
84
 
82
85
  # Write a stdio MCP entry into the client config
83
86
  superblocks mcp setup --client claude
@@ -97,8 +100,8 @@ Published `bin/run.js` is the MCP `command` (its `node` shebang applies).
97
100
  Worktree `bin/dev.js` is launched with `tsx` and without `--watch`: the
98
101
  dev shebang is a file-watcher, which would kill stdio on source edits and
99
102
  corrupt JSON-RPC on stdout. When `SUPERBLOCKS_AUTH_FILE` is set (worktree
100
- auth), it is copied into the MCP `env` block. Gateway derives both control
101
- plane and remote UI URLs from `superblocksBaseUrl` in that auth file.
103
+ auth), it is copied into the MCP `env` block. Gateway derives control plane and
104
+ remote UI URLs from the selected browser or personal-key session.
102
105
 
103
106
  Optional: `mcp setup --with-screenshots` downloads Playwright Chromium for
104
107
  preview captures. Omit it; MCP setup still succeeds.
@@ -117,13 +120,15 @@ Against a remote Superblocks domain (EE / SaaS IR):
117
120
 
118
121
  ```bash
119
122
  cd packages/cli/packages/cli
120
- ./bin/dev.js config set domain <host>
121
- ./bin/dev.js login
123
+ ./bin/dev.js mcp login --server-url https://<host>
122
124
  ./bin/dev.js mcp setup --client claude
123
125
  ```
124
126
 
125
127
  Against a local control plane, start the stack first (`just up <worktree>`),
126
- then login and `mcp setup` the same way.
128
+ then use its Server origin with `mcp login --server-url <origin>` and run
129
+ `mcp setup`. Browser login requires the Server/Auth0 setup below. Existing
130
+ `superblocks login` and worktree personal keys still work when browser login
131
+ is not configured.
127
132
 
128
133
  The standalone `superblocks-mcp` Admin-only server is deprecated; prefer
129
134
  `superblocks mcp setup`.
@@ -135,8 +140,7 @@ Log in and run setup from the worktree CLI (not a globally installed `superblock
135
140
 
136
141
  ```bash
137
142
  cd packages/cli/packages/cli
138
- ./bin/dev.js config set domain <host>
139
- ./bin/dev.js login
143
+ ./bin/dev.js mcp login --server-url https://<host>
140
144
  ./bin/dev.js mcp setup --client cursor
141
145
  # or: --client claude
142
146
  ```
@@ -165,7 +169,8 @@ for Cursor, `~/.claude.json` for Claude Code):
165
169
  `command` is `tsx` without `--watch`: the `bin/dev.js` shebang is a file
166
170
  watcher, which would kill stdio on source edits and corrupt JSON-RPC on
167
171
  stdout. `env` only copies the worktree CLI session path
168
- (`SUPERBLOCKS_AUTH_FILE`). Gateway reads `superblocksBaseUrl` from that file.
172
+ (`SUPERBLOCKS_AUTH_FILE`). Gateway reads the selected browser session from the
173
+ adjacent `.mcp-oauth` file, or `superblocksBaseUrl` from the personal-key file.
169
174
  Do not add `SUPERBLOCKS_GATEWAY_FROM_SOURCE`.
170
175
  Optional stderr tees (`2>> ~/.cursor/superblocks-gateway.err`) are host
171
176
  specific; `setup` does not write them.
@@ -194,12 +199,95 @@ at boot. A crash that `@superblocksteam/shared` does not export
194
199
 
195
200
  ## Authentication
196
201
 
197
- Gateway tools call the Superblocks control plane with the personal API key from
198
- the CLI session. Log in first (`superblocks login`). There is no issuer env, no
199
- consent page, and no second PAT.
202
+ Desktop-local Claude Code plugins launch `mcp serve --browser-login` automatically. Leave
203
+ the plugin's API token blank to use browser sign-in. Other MCP hosts can opt in
204
+ by adding `--browser-login` to their launch arguments, or sign in explicitly
205
+ before setup:
206
+
207
+ ```bash
208
+ superblocks mcp login --server-url https://app.superblocks.com
209
+ superblocks mcp setup --client claude
210
+ # Restart the MCP host after setup.
211
+ ```
212
+
213
+ The CLI reads public configuration from `GET /api/v1/mcp/oauth/config`, opens
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
216
+ requests `openid profile email offline_access`. Gateway uses the resulting
217
+ Server-audience access token directly; it does not retrieve a personal API key.
218
+ The MCP connection stays on stdio. The callback port is used only during login.
219
+
220
+ Credential selection, in order:
221
+
222
+ 1. Nonblank `SUPERBLOCKS_API_TOKEN` (including a plugin-supplied personal key).
223
+ 2. Saved browser login, provided it matches an explicit `SUPERBLOCKS_SERVER_URL`
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
232
+ restarting the MCP host. Logout clears the local browser session only; it does
233
+ not clear the legacy CLI personal key, log out the browser, or revoke Auth0
234
+ credentials.
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
+
241
+ Browser credentials are stored at `~/.superblocks/auth.json.mcp-oauth`, or
242
+ `${SUPERBLOCKS_AUTH_FILE}.mcp-oauth` when the worktree override is set. The file
243
+ contains access and refresh tokens and is written atomically with owner-only
244
+ `0600` permissions; newly created parent directories use `0700`. A file lock
245
+ coordinates refresh-token rotation across Gateway processes. A persistent random
246
+ session ID keeps plan approvals and native-browser presence shared across those
247
+ processes when the access token changes. A new login gets a new session ID.
248
+
249
+ Server calls, Admin tools, orchestrator requests, and telemetry obtain the current
250
+ credential before sending authenticated requests. New screenshots and Clark
251
+ browser contexts receive the current credential as well. An already-running
252
+ isolated browser holds a snapshot and cannot renew that token during its run;
253
+ browser actions can fail if it expires before the run finishes. Existing scoped
254
+ JWTs for live edit, previews, and integration execution retain their own lifetimes.
255
+
256
+ ### Server and Auth0 setup
257
+
258
+ Configure each environment before enabling browser login:
259
+
260
+ 1. Create a dedicated first-party native Auth0 application with
261
+ `token_endpoint_auth_method: none`, the `authorization_code` and `refresh_token`
262
+ grants, and callback `http://127.0.0.1:8485/callback`. No client secret belongs
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.
266
+ 2. Enable offline access on the Server API audience (normally
267
+ `https://superblocks/api`) and enable the sign-in connections this application
268
+ needs. Keep the existing connections' client assignments when adding it.
269
+ 3. Set Server's `SUPERBLOCKS_SERVER_AUTH_NATIVE_CLIENT_ID` to the new client ID.
270
+ `SUPERBLOCKS_SERVER_AUTH_ISSUER_URL` and `SUPERBLOCKS_SERVER_AUTH_AUDIENCE` must
271
+ identify that environment's issuer and Server API. Cloud-Prem configuration
272
+ also includes `SUPERBLOCKS_CLOUD_PREM_AUTH0_ORG_ID` when configured.
273
+
274
+ The public configuration route returns only the issuer, audience, native client
275
+ ID, and optional organization ID, wrapped in `data`. It returns HTTP 503 when
276
+ browser login is not configured. The system browser must be able to reach the
277
+ loopback callback in the environment running the desktop plugin or `mcp login`;
278
+ logging in on the host does not authenticate a separate VM or container
279
+ filesystem.
280
+
281
+ The CLI accepts Superblocks' first-party native clients only for known
282
+ Superblocks server origins. A Cloud-Prem server on a custom domain needs a
283
+ personal API key; its organization ID alone does not establish that the domain
284
+ can safely receive first-party tokens.
200
285
 
201
286
  ## Cloud-Prem laptop agent
202
287
 
288
+ On-prem deployments with signing enabled still require a personal API key.
289
+ Their signing RPCs do not accept identity-provider access tokens.
290
+
203
291
  Set `GATEWAY_LOCAL_AGENT=true` for a single-user corp laptop process. Stores are
204
292
  always in-memory; suspended turns and progress cursors do not survive a restart.
205
293
  `SUPERBLOCKS_SERVER_URL` (or `GATEWAY_SERVER_URL`) points at the in-VPC control
@@ -259,23 +347,70 @@ plugin Clark cannot use as a tool.
259
347
  ## Env
260
348
 
261
349
  See `.env.example`. Stores are in-memory only. Identity comes from the CLI
262
- session, not from these variables.
263
-
264
- | Variable | Purpose |
265
- | ---------------------------- | ---------------------------------------------------------- |
266
- | `SUPERBLOCKS_SERVER_URL` | Control plane URL (default from `auth.json` or localhost). |
267
- | `GATEWAY_PROFILE_KEY` | Integration profile key (default `default`). |
268
- | `GATEWAY_LOCAL_AGENT` | Cloud-Prem laptop agent mode. |
269
- | `GATEWAY_ADMIN_TOOLS_ONLY` | Admin tools only; skip Builder surface. |
270
- | `GATEWAY_IMPORT_SEARCH_DIRS` | Fallback folders for bare or sandbox attachment paths. |
271
- | `SUPERBLOCKS_AUTH_FILE` | Worktree-local CLI session (from `just worktree auth`). |
272
- | `NODE_DEBUG=gateway` | Tool call stacks and conditional-flow logs on stderr. |
350
+ session or `SUPERBLOCKS_API_TOKEN`.
351
+
352
+ | Variable | Purpose |
353
+ | ---------------------------- | ----------------------------------------------------------- |
354
+ | `SUPERBLOCKS_API_TOKEN` | Personal API key; takes precedence over saved sessions. |
355
+ | `SUPERBLOCKS_SERVER_URL` | Control plane URL; browser sessions must match this origin. |
356
+ | `GATEWAY_PROFILE_KEY` | Integration profile key (default `default`). |
357
+ | `GATEWAY_LOCAL_AGENT` | Cloud-Prem laptop agent mode. |
358
+ | `GATEWAY_ADMIN_TOOLS_ONLY` | Admin tools only; skip Builder surface. |
359
+ | `GATEWAY_IMPORT_SEARCH_DIRS` | Fallback folders for bare or sandbox attachment paths. |
360
+ | `SUPERBLOCKS_AUTH_FILE` | Worktree-local CLI session (from `just worktree auth`). |
361
+ | `NODE_DEBUG=gateway` | Tool call stacks and conditional-flow logs on stderr. |
273
362
 
274
363
  Gateway debug logs include tool names, result states, decision branches, and
275
364
  entry-point stacks. They intentionally omit credentials, prompts, answers, and
276
365
  result payloads. Run `superblocks mcp setup --client <client> --debug`, then
277
366
  restart the MCP host. Re-run setup without `--debug` to turn them off.
278
367
 
368
+ ## Metrics
369
+
370
+ `startGatewayTelemetry` registers the OpenTelemetry MeterProvider through
371
+ `@superblocksteam/telemetry`, so every counter in `src/telemetry/metrics.ts`
372
+ exports over OTLP through the authenticated Server `/api/v1/metrics` proxy
373
+ (same path and policy as traces). `service.name=gateway` and
374
+ `deployment.environment.name` ride on the SDK resource, not on each data point.
375
+
376
+ | Metric | Labels |
377
+ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
378
+ | `gateway.identity.read.outcomes` | `gateway.outcome`: `cached`, `resolved`, `refused`, `credential_error`, `breaker_open`, `caller_timeout`, `outage` |
379
+ | `gateway.server.read_retry.outcomes` | `gateway.server.read_retry.outcome`, `gateway.server.read_retry.cause`, `gateway.server.read_retry.operation` |
380
+ | `gateway.clark.facts_flag_bootstrap.outcomes` | `gateway.clark.facts_flag_bootstrap.outcome`: `enabled`, `disabled`, `invalid` |
381
+ | `gateway.integration_profile.resolutions` | `gateway.profile.source`, `gateway.profile.reason`, `gateway.profile.scope` |
382
+ | `gateway.mcp.tool_calls` | `tool.name`, `tool.status`, `mcp.client.name` |
383
+ | `gateway.mcp.tool_call_duration_seconds` | same as `gateway.mcp.tool_calls` |
384
+ | `gateway.checkpoint.outcomes` | `gateway.checkpoint.outcome` |
385
+ | `gateway.process.faults` | `gateway.fault.kind`, `gateway.fault.fatal` |
386
+ | `gateway.readiness.verdicts` | `gateway.readiness.probe`, `gateway.readiness.ready`, `gateway.readiness.dispatch`, `gateway.readiness.upstream` |
387
+
388
+ Locally, the Server forwards the proxy to the OTel collector on `:4318`. The
389
+ workspace `just up` (any profile) starts the LGTM stack from
390
+ `profiles/lib/otel-lgtm.yaml`, whose collector writes to Mimir. The monorepo's
391
+ own `docker-compose.yml` collector (`local-otel.yaml`) exports to Datadog
392
+ instead, so the queries below assume the workspace stack. Prometheus naming applies:
393
+ dots become underscores and counters gain `_total`. Query in Grafana
394
+ (`http://localhost:4000`, datasource `mimir`):
395
+
396
+ ```promql
397
+ # Identity-read outcome ratio: how much traffic is served from cache versus
398
+ # failing fast on an open breaker or timing out on the caller side.
399
+ sum by (gateway_outcome) (
400
+ rate(gateway_identity_read_outcomes_total{
401
+ service_name="gateway",
402
+ gateway_outcome=~"cached|breaker_open|caller_timeout"
403
+ }[5m])
404
+ )
405
+ / ignoring(gateway_outcome) group_left
406
+ sum(rate(gateway_identity_read_outcomes_total{service_name="gateway"}[5m]))
407
+ ```
408
+
409
+ A `breaker_open` or `caller_timeout` share that climbs while `cached` falls is
410
+ the ENG-5806 signature: the identity endpoint is failing and the cache is not
411
+ absorbing it. Add a `deployment_environment_name` matcher to scope the panel to
412
+ one environment.
413
+
279
414
  ## Remote traceability
280
415
 
281
416
  Gateway exports one OpenTelemetry trace per MCP process through the authenticated
@@ -7,14 +7,13 @@ export const AGENT_TYPE_ONPREMISE = 2;
7
7
  /**
8
8
  * Control-plane hosts whose `/agent` path is not the orchestrator. US prod is
9
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
10
+ * EU/staging follow the prefix and are listed so operator overrides that
11
11
  * omit `agentType` still rewrite.
12
12
  */
13
13
  const CLOUD_ORCHESTRATOR_URL_BY_CONTROL_PLANE_HOST = {
14
14
  "app.superblocks.com": "https://agent.superblocks.com/",
15
15
  "eu.superblocks.com": "https://agent.eu.superblocks.com/",
16
16
  "staging.superblocks.com": "https://agent.staging.superblocks.com/",
17
- "dev.superblocks.com": "https://agent.dev.superblocks.com/",
18
17
  };
19
18
  export function cloudOrchestratorBaseUrlFromControlPlane(url) {
20
19
  if (!url) {
@@ -1 +1 @@
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,iEA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C,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"}
@@ -6,6 +6,7 @@ import type { AppState } from "../sabs/app-state.js";
6
6
  import { type SessionPeer } from "../sabs/session-peer.js";
7
7
  import type { SuperblocksServerClient } from "../server/client.js";
8
8
  import type { ProgressStore, RecentAppStore, StepUpTurnStore } from "../stores/types.js";
9
+ import type { LiveStateAttaches } from "./live-state-attaches.js";
9
10
  import type { CapabilityResult, CheckAppProgressInput, CheckAppProgressResult, CheckPublishProgressInput, EditAppInput, EditAppResult, AskUserInput, AskUserResult, GetAppInput, GetAppResult, PreviewAppInput, PreviewAppResult, PreviewStatusInput, PreviewStatusResult, Principal, ProgressEvent, PublishAppInput, PublishAppResult, ResolvedPrincipal, StartAppInput, StartAppResult, UploadArtifactInput, UploadArtifactResult } from "./types.js";
10
11
  export { IMPORT_ZIP_MAX_BYTES } from "./types.js";
11
12
  export type CapabilityContext = {
@@ -17,6 +18,8 @@ export type CapabilityContext = {
17
18
  principal: Principal;
18
19
  /** Per-application facts that outlive any one turn. */
19
20
  appState: AppState;
21
+ /** Live-edit attaches still in flight, shared by every call to the process. */
22
+ liveStateAttaches: LiveStateAttaches;
20
23
  /** When each build last spoke, and whether its silence was reported. */
21
24
  progress?: ProgressStore;
22
25
  recentApps: RecentAppStore;