@superblocksteam/gateway 2.0.174 → 2.0.175-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/README.md +43 -18
- package/dist/agents/resolve-orchestrator-url.d.ts +1 -0
- package/dist/agents/resolve-orchestrator-url.d.ts.map +1 -0
- package/dist/capabilities/integration-metadata.d.ts +1 -0
- package/dist/capabilities/integration-metadata.d.ts.map +1 -0
- package/dist/capabilities/lifecycle.d.ts +2 -0
- package/dist/capabilities/lifecycle.d.ts.map +1 -0
- package/dist/capabilities/lifecycle.js +10 -6
- package/dist/capabilities/lifecycle.js.map +1 -1
- package/dist/capabilities/live-state-attaches.d.ts +1 -0
- package/dist/capabilities/live-state-attaches.d.ts.map +1 -0
- package/dist/capabilities/query-integration.d.ts +1 -0
- package/dist/capabilities/query-integration.d.ts.map +1 -0
- package/dist/capabilities/source-files-archive.d.ts +1 -0
- package/dist/capabilities/source-files-archive.d.ts.map +1 -0
- package/dist/capabilities/tool-permission-reply.d.ts +1 -0
- package/dist/capabilities/tool-permission-reply.d.ts.map +1 -0
- package/dist/capabilities/types.d.ts +1 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capture/browser-contract.d.ts +1 -0
- package/dist/capture/browser-contract.d.ts.map +1 -0
- package/dist/capture/browser-instructions.d.ts +1 -0
- package/dist/capture/browser-instructions.d.ts.map +1 -0
- package/dist/capture/capture-library-probe.d.ts +1 -0
- package/dist/capture/capture-library-probe.d.ts.map +1 -0
- package/dist/capture/capture-library.d.ts +1 -0
- package/dist/capture/capture-library.d.ts.map +1 -0
- package/dist/capture/classify-library-paint.d.ts +1 -0
- package/dist/capture/classify-library-paint.d.ts.map +1 -0
- package/dist/capture/cowork-editor-url.d.ts +1 -0
- package/dist/capture/cowork-editor-url.d.ts.map +1 -0
- package/dist/capture/host-mcp-scan.d.ts +1 -0
- package/dist/capture/host-mcp-scan.d.ts.map +1 -0
- package/dist/capture/library-parent-script.d.ts +1 -0
- package/dist/capture/library-parent-script.d.ts.map +1 -0
- package/dist/capture/mode.d.ts +1 -0
- package/dist/capture/mode.d.ts.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/deadline.d.ts +1 -0
- package/dist/deadline.d.ts.map +1 -0
- package/dist/debug.d.ts +1 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/deps.d.ts +4 -3
- package/dist/deps.d.ts.map +1 -0
- package/dist/health/readiness.d.ts +1 -0
- package/dist/health/readiness.d.ts.map +1 -0
- package/dist/http/main.d.ts +3 -0
- package/dist/http/main.d.ts.map +1 -0
- package/dist/http/main.js +8 -0
- package/dist/http/main.js.map +1 -0
- package/dist/http/serve.d.ts +26 -0
- package/dist/http/serve.d.ts.map +1 -0
- package/dist/http/serve.js +255 -0
- package/dist/http/serve.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/integrations/filters.d.ts +1 -0
- package/dist/integrations/filters.d.ts.map +1 -0
- package/dist/integrations/filters.js +1 -16
- package/dist/integrations/filters.js.map +1 -1
- package/dist/integrations/map.d.ts +10 -4
- package/dist/integrations/map.d.ts.map +1 -0
- package/dist/integrations/map.js +8 -6
- package/dist/integrations/map.js.map +1 -1
- package/dist/integrations/profile-key.d.ts +1 -0
- package/dist/integrations/profile-key.d.ts.map +1 -0
- package/dist/integrations/read-only-postgres-query.d.ts +1 -0
- package/dist/integrations/read-only-postgres-query.d.ts.map +1 -0
- package/dist/integrations/resolve-profile.d.ts +1 -0
- package/dist/integrations/resolve-profile.d.ts.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/orchestrator/client.d.ts +1 -0
- package/dist/orchestrator/client.d.ts.map +1 -0
- package/dist/playwright/ensure-chromium.d.ts +1 -0
- package/dist/playwright/ensure-chromium.d.ts.map +1 -0
- package/dist/preview/capture-screenshot.d.ts +1 -0
- package/dist/preview/capture-screenshot.d.ts.map +1 -0
- package/dist/preview/capture-screenshot.js +1 -1
- package/dist/preview/capture-screenshot.js.map +1 -1
- package/dist/preview/viewer-url.d.ts +1 -0
- package/dist/preview/viewer-url.d.ts.map +1 -0
- package/dist/process/fault-barrier.d.ts +1 -0
- package/dist/process/fault-barrier.d.ts.map +1 -0
- package/dist/sabs/agent-facing-text.d.ts +1 -0
- package/dist/sabs/agent-facing-text.d.ts.map +1 -0
- package/dist/sabs/app-state.d.ts +3 -0
- package/dist/sabs/app-state.d.ts.map +1 -0
- package/dist/sabs/app-state.js +5 -0
- package/dist/sabs/app-state.js.map +1 -1
- package/dist/sabs/awaited-decision.d.ts +1 -0
- package/dist/sabs/awaited-decision.d.ts.map +1 -0
- package/dist/sabs/browser-context.d.ts +1 -0
- package/dist/sabs/browser-context.d.ts.map +1 -0
- package/dist/sabs/editor-client-methods.d.ts +1 -0
- package/dist/sabs/editor-client-methods.d.ts.map +1 -0
- package/dist/sabs/editor-client-methods.js +5 -3
- package/dist/sabs/editor-client-methods.js.map +1 -1
- package/dist/sabs/editor-socket.d.ts +1 -0
- package/dist/sabs/editor-socket.d.ts.map +1 -0
- package/dist/sabs/recent-tool-runs.d.ts +1 -0
- package/dist/sabs/recent-tool-runs.d.ts.map +1 -0
- package/dist/sabs/session-peer.d.ts +8 -0
- package/dist/sabs/session-peer.d.ts.map +1 -0
- package/dist/sabs/streamed-reply.d.ts +1 -0
- package/dist/sabs/streamed-reply.d.ts.map +1 -0
- package/dist/sabs/turn-collector.d.ts +1 -0
- package/dist/sabs/turn-collector.d.ts.map +1 -0
- package/dist/sabs/websocket-session-peer.d.ts +2 -0
- package/dist/sabs/websocket-session-peer.d.ts.map +1 -0
- package/dist/sabs/websocket-session-peer.js +5 -0
- package/dist/sabs/websocket-session-peer.js.map +1 -1
- package/dist/security/constant-time.d.ts +1 -0
- package/dist/security/constant-time.d.ts.map +1 -0
- package/dist/server/client.d.ts +10 -0
- package/dist/server/client.d.ts.map +1 -0
- package/dist/server/client.js +9 -0
- package/dist/server/client.js.map +1 -1
- package/dist/server/identity-reads.d.ts +1 -0
- package/dist/server/identity-reads.d.ts.map +1 -0
- package/dist/start.d.ts +6 -1
- package/dist/start.d.ts.map +1 -0
- package/dist/start.js +22 -9
- package/dist/start.js.map +1 -1
- package/dist/stores/memory.d.ts +1 -0
- package/dist/stores/memory.d.ts.map +1 -0
- package/dist/stores/types.d.ts +1 -0
- package/dist/stores/types.d.ts.map +1 -0
- package/dist/telemetry/mcp-client.d.ts +1 -0
- package/dist/telemetry/mcp-client.d.ts.map +1 -0
- package/dist/telemetry/mcp-usage.d.ts +22 -0
- package/dist/telemetry/mcp-usage.d.ts.map +1 -0
- package/dist/telemetry/mcp-usage.js +102 -0
- package/dist/telemetry/mcp-usage.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +4 -0
- package/dist/telemetry/metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics.js +11 -0
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry/runtime.d.ts +3 -1
- package/dist/telemetry/runtime.d.ts.map +1 -0
- package/dist/telemetry/runtime.js +12 -5
- package/dist/telemetry/runtime.js.map +1 -1
- package/dist/transports/mcp/admin-tools.d.ts +4 -7
- package/dist/transports/mcp/admin-tools.d.ts.map +1 -0
- package/dist/transports/mcp/admin-tools.js +5 -51
- package/dist/transports/mcp/admin-tools.js.map +1 -1
- package/dist/transports/mcp/app-status-html.d.ts +1 -0
- package/dist/transports/mcp/app-status-html.d.ts.map +1 -0
- package/dist/transports/mcp/client-presentation.d.ts +1 -0
- package/dist/transports/mcp/client-presentation.d.ts.map +1 -0
- package/dist/transports/mcp/decision-card-html.d.ts +1 -0
- package/dist/transports/mcp/decision-card-html.d.ts.map +1 -0
- package/dist/transports/mcp/decision-elicitation.d.ts +1 -0
- package/dist/transports/mcp/decision-elicitation.d.ts.map +1 -0
- package/dist/transports/mcp/dispatch-probe.d.ts +1 -0
- package/dist/transports/mcp/dispatch-probe.d.ts.map +1 -0
- package/dist/transports/mcp/editor-document-probe.d.ts +1 -0
- package/dist/transports/mcp/editor-document-probe.d.ts.map +1 -0
- package/dist/transports/mcp/editor-integration-setup-url.d.ts +1 -0
- package/dist/transports/mcp/editor-integration-setup-url.d.ts.map +1 -0
- package/dist/transports/mcp/format-tool-content.d.ts +1 -0
- package/dist/transports/mcp/format-tool-content.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/index.d.ts +1 -0
- package/dist/transports/mcp/instructions/index.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/result.d.ts +1 -0
- package/dist/transports/mcp/instructions/result.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/ask-user.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/ask-user.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/build-app.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/build-app.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/check-publish-progress.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/check-publish-progress.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/copy.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/copy.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/create-integration.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/create-integration.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/edit-app.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/edit-app.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/get-app.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/get-app.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/index.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/index.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/publish-app.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/publish-app.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/start-app.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/start-app.d.ts.map +1 -0
- package/dist/transports/mcp/instructions/tools/upload-artifact.d.ts +1 -0
- package/dist/transports/mcp/instructions/tools/upload-artifact.d.ts.map +1 -0
- package/dist/transports/mcp/mcp-app-brand-css.d.ts +1 -0
- package/dist/transports/mcp/mcp-app-brand-css.d.ts.map +1 -0
- package/dist/transports/mcp/mount.d.ts +3 -13
- package/dist/transports/mcp/mount.d.ts.map +1 -0
- package/dist/transports/mcp/mount.js +73 -38
- package/dist/transports/mcp/mount.js.map +1 -1
- package/dist/transports/mcp/native-browser-presence.d.ts +1 -0
- package/dist/transports/mcp/native-browser-presence.d.ts.map +1 -0
- package/dist/transports/mcp/plan-approval.d.ts +1 -0
- package/dist/transports/mcp/plan-approval.d.ts.map +1 -0
- package/dist/transports/mcp/progress-notifier.d.ts +1 -0
- package/dist/transports/mcp/progress-notifier.d.ts.map +1 -0
- package/dist/transports/mcp/session-directory.d.ts +1 -0
- package/dist/transports/mcp/session-directory.d.ts.map +1 -0
- package/dist/transports/mcp/tool-names.d.ts +1 -0
- package/dist/transports/mcp/tool-names.d.ts.map +1 -0
- package/package.json +22 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-integration.d.ts","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/create-integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAEzD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,aAAa,GACrB,MAAM,GAAG,SAAS,CA4BpB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAY3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-app.d.ts","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/edit-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW/C,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,aAAa,GACrB,MAAM,GAAG,SAAS,CA+BpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-app.d.ts","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/get-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS/C,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,aAAa,GACrB,MAAM,GAAG,SAAS,CAapB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-integration-metadata.d.ts","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/get-integration-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,UAAU,GACjB,MAAM,GAAG,SAAS,CAgBpB"}
|
|
@@ -5,3 +5,4 @@ import type { ToolResult } from "../result.js";
|
|
|
5
5
|
export type Instruct = (result: ToolResult, profile: ClientProfile) => string | undefined;
|
|
6
6
|
/** Tools absent from this table send no instructions. */
|
|
7
7
|
export declare const INSTRUCTIONS: Partial<Record<ToolName, Instruct>>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAc/C,2EAA2E;AAC3E,MAAM,MAAM,QAAQ,GAAG,CACrB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,aAAa,KACnB,MAAM,GAAG,SAAS,CAAC;AAExB,yDAAyD;AACzD,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAgB5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-app.d.ts","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/publish-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,aAAa,GACrB,MAAM,GAAG,SAAS,CAOpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-app.d.ts","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/start-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,aAAa,GACrB,MAAM,GAAG,SAAS,CAwBpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-artifact.d.ts","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/upload-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAW7E"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const MCP_APP_BRAND_CSS = "\n :root {\n color-scheme: light dark;\n --sb-app-background: var(\n --color-background-primary,\n light-dark(#ffffff, #1b1c1f)\n );\n --sb-app-background-subtle: var(\n --color-background-secondary,\n light-dark(#f9fafb, #24272b)\n );\n --sb-app-background-hover: var(\n --color-background-tertiary,\n light-dark(#f3f4f6, #2f3437)\n );\n --sb-app-background-inverse: var(\n --color-background-inverse,\n light-dark(#121517, #f9fafb)\n );\n --sb-app-text: var(\n --color-text-primary,\n light-dark(#121517, #f9fafb)\n );\n --sb-app-text-secondary: var(\n --color-text-secondary,\n light-dark(#5a6272, #c6cad2)\n );\n --sb-app-text-tertiary: var(\n --color-text-tertiary,\n light-dark(#6b7280, #a4aab7)\n );\n --sb-app-text-inverse: var(\n --color-text-inverse,\n light-dark(#ffffff, #121517)\n );\n --sb-app-border: var(\n --color-border-primary,\n light-dark(#e8eaed, #454d5f)\n );\n --sb-app-ring: var(\n --color-ring-primary,\n light-dark(#0077b6, #27bbff)\n );\n --sb-app-info-background: var(\n --color-background-info,\n light-dark(#e6f5ff, #083a50)\n );\n --sb-app-info-text: var(\n --color-text-info,\n light-dark(#00679e, #7dd3fc)\n );\n --sb-app-info-border: var(\n --color-border-info,\n light-dark(#c2e7ff, #075985)\n );\n --sb-app-success-background: var(\n --color-background-success,\n light-dark(#e8f8ef, #0a3926)\n );\n --sb-app-success-text: var(\n --color-text-success,\n light-dark(#087a43, #6ee7b7)\n );\n --sb-app-success-border: var(\n --color-border-success,\n light-dark(#b8e8cf, #087a43)\n );\n --sb-app-warning-background: var(\n --color-background-warning,\n light-dark(#fff7e6, #49350a)\n );\n --sb-app-warning-text: var(\n --color-text-warning,\n light-dark(#946200, #fcd34d)\n );\n --sb-app-warning-border: var(\n --color-border-warning,\n light-dark(#f5d996, #946200)\n );\n --sb-app-danger-background: var(\n --color-background-danger,\n light-dark(#fff1f1, #4a1d1d)\n );\n --sb-app-danger-text: var(\n --color-text-danger,\n light-dark(#c54141, #fca5a5)\n );\n --sb-app-danger-border: var(\n --color-border-danger,\n light-dark(#ffcaca, #c54141)\n );\n }\n * {\n box-sizing: border-box;\n }\n body {\n min-width: 0;\n margin: 0;\n overflow-x: hidden;\n background: transparent;\n color: var(--sb-app-text);\n font-family: var(--font-sans, system-ui, -apple-system, sans-serif);\n font-size: var(--font-text-sm-size, 13px);\n line-height: var(--font-text-sm-line-height, 1.45);\n }\n .card {\n display: flex;\n min-width: 0;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border: var(--border-width-regular, 1px) solid var(--sb-app-border);\n border-radius: var(--border-radius-lg, 12px);\n background: var(--sb-app-background);\n box-shadow: var(--shadow-sm, 0 1px 2px rgba(18, 21, 23, 0.08));\n }\n h1,\n .meta,\n .note {\n min-width: 0;\n overflow-wrap: anywhere;\n }\n .note:empty {\n position: absolute;\n }\n button,\n textarea {\n font: inherit;\n }\n button {\n appearance: none;\n min-width: 0;\n padding: 8px 12px;\n border: var(--border-width-regular, 1px) solid var(--sb-app-border);\n border-radius: var(--border-radius-md, 8px);\n background: var(--sb-app-background-subtle);\n color: var(--sb-app-text);\n font-weight: var(--font-weight-medium, 500);\n line-height: var(--font-text-sm-line-height, 1.45);\n cursor: pointer;\n }\n button:hover:not(:disabled) {\n background: var(--sb-app-background-hover);\n }\n .button-primary {\n border-color: var(--sb-app-background-inverse);\n background: var(--sb-app-background-inverse);\n color: var(--sb-app-text-inverse);\n }\n .button-primary:hover:not(:disabled) {\n border-color: var(--sb-app-background-inverse);\n background: var(--sb-app-background-inverse);\n }\n button:focus-visible,\n textarea:focus-visible,\n a:focus-visible {\n outline: 2px solid var(--sb-app-ring);\n outline-offset: 2px;\n }\n button:disabled {\n opacity: 0.48;\n cursor: not-allowed;\n }\n .actions {\n min-width: 0;\n }\n .actions > button {\n overflow-wrap: anywhere;\n }\n @media (max-width: 360px) {\n .actions {\n flex-direction: column;\n flex-wrap: nowrap;\n }\n .actions > button {\n width: 100%;\n }\n }\n";
|
|
2
|
+
//# sourceMappingURL=mcp-app-brand-css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-app-brand-css.d.ts","sourceRoot":"","sources":["../../../src/transports/mcp/mcp-app-brand-css.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,i5JAkL7B,CAAC"}
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { AppDeps } from "../../deps.js";
|
|
3
3
|
import { type EditorDocumentProbe } from "./editor-document-probe.js";
|
|
4
|
+
export declare const SERVER_INSTRUCTIONS: string;
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
* against these tools.
|
|
7
|
-
*
|
|
8
|
-
* People refer to this one system as the product and builder ("Superblocks")
|
|
9
|
-
* or by an older name for that same builder ("Clark"). Listing that accepted
|
|
10
|
-
* alias here is what lets "get Clark to build me a to-do app" reach
|
|
11
|
-
* `start_app`. Recognizing a name and using it are different things: the alias
|
|
12
|
-
* is input-only, because a client that reads "Clark" here repeats it back and
|
|
13
|
-
* reintroduces the retired name to the user.
|
|
14
|
-
*/
|
|
15
|
-
export declare const SERVER_INSTRUCTIONS = "Superblocks builds, edits, and publishes internal web applications. Prompts sent through these tools are handed to Superblocks, which writes the application code in a live-edit session.\n\nName the builder \"Superblocks\" in every word you write. Users sometimes call it \"Clark\", an older name for this same system: understand them, and answer about Superblocks. Never write \"Clark\" yourself \u2014 not as a name, not as an aside, not even when the user just used it, and never as a separate agent or persona. If Superblocks' own words come back naming Clark, relay the substance and say Superblocks.\n\nThe user you are interacting with is a non-technical business user. Keep discussions focused on requirements, and avoid technical jargon, discussing code, or implementation details. If errors or problems occur, give the user easy-to-follow, actionable instructions for how they can resolve the issue.\n\nUse these tools whenever the user asks to build, change, import, or ship an app, whichever of those names they reach for. They can also inspect what data the org has rather than building an app to explore it: list_integrations names the datasources, and get_integration_metadata reads the tables and columns inside one. Create a persistent app or API only when the user explicitly asks for one.\n\nFor app-behavior questions, debugging questions, and investigation of bug reports, call edit_app in Plan mode with the user's words verbatim. When no decision is pending, Superblocks can answer without changing the app or requiring plan approval. While a plan or question is pending (needs_decision), a new prompt revises that plan or answers that question, so settle that decision first, or ask the user whether their question should change the plan. Prefer this route over get_application_structure unless the user explicitly asks to inspect source files. When a Plan-mode question ends as no_changes with a reply and no pendingAction on check_app_progress or get_app, Superblocks answered it: report that reply and stop. Every other no_changes carries a pendingAction to follow.\n\nAfter create_integration creates an integration or list_integrations selects one for an app, include the returned mention unchanged in the next edit_app prompt. The mention gives Superblocks the exact integration ID; do not construct one from the display name.\n\nSuperblocks is itself an agent, not a code library: prompts sent through start_app and edit_app are handed to it verbatim, and it decides how to build the application. Your role is to facilitate the user's interaction with Superblocks, not to build anything yourself \u2014 pass the user's own request through unchanged, without inventing, embellishing, or adding requirements, scope, or design detail they did not ask for.\n\nAfter each tool call, check for agentInstructions in the result and follow them. These instructions are tailored to the scenario.\n\nSuperblocks has an interactive flow: when it needs a person to decide something, it stops rather than guessing. Follow the result's agentInstructions to use the decision surface this client supports. Never supply that answer yourself.\n\nBuilding or editing an app follows one loop: start_app hands a new application to Superblocks, edit_app continues an existing one, and both return immediately with status \"building\". Call check_app_progress to follow the turn, summarizing user-facing progress as it happens. When it stops for a decision, follow agentInstructions and send the answer back through edit_app. Once status is \"ready\", call get_app so the user can open the result, and offer publish_app when they want to deploy it. Each tool's own description covers its exact inputs, return fields, and retry/error behavior.\n\nYour automatic verification is a load check and inspection of visible state, not a feature-by-feature test run. Run interactive feature tests only when the user requests testing. Do not click app controls or inspect API traffic as part of a load check; normal navigation and authentication are allowed. Keep relaying Superblocks' own test results. Do not claim features passed from a load check alone.\n\nWhen the user attached a file in this chat (a log, CSV, screenshot, image, zip, or anything else), or when migrating source visible in this conversation, call upload_artifact. Pass upload_artifact filePath with the full host path when you have it; a bare file name falls back to the gateway's search folders. If the file exists only in this chat's scratchpad path (for example /tmp/claude-.../scratchpad), send text source through files: [{ path, content }] instead of filePath. The gateway reads filePath bytes itself, so an image or PDF costs nothing to send. Only source you are writing out yourself goes in files, which is archived as text - never base64 a file into it. Then pass the returned artifact in start_app or edit_app artifacts. Do not create a Claude artifact or use the host's own file-upload UI.\n\nWhen the source is a readable tree on this machine, archive the source and assets with their original relative paths, excluding .git, node_modules, build output, secrets, and production data. Inspect the archive, upload it with upload_artifact filePath, then pass the returned artifact unchanged in start_app or edit_app artifacts. Local paths and prose descriptions are not a substitute for the source artifact: Superblocks cannot read the host's workspace. Ask Superblocks to read the attached source and preserve its UI and behavior. Reuse the artifact on retries. Follow the superblocks-import skill when available; Superblocks writes the application, not the host.\n\nFor a migrated app with missing integrations, call list_integrations first. Reuse only the same plugin and the same connection: the same REST base URL, or the same host, port, and database. A similar name is not a match. list_integrations and get_integration_metadata do not expose connection URLs or hosts, so do not use them to guess a match. When there is no exact match, follow the result's agentInstructions to create and wire every declared integration.\n\nThis connector is the single Superblocks MCP: Builder tools (upload_artifact, start_app, edit_app, check_app_progress, ask_user, get_app, build_app, publish_app, check_publish_progress) and Admin tools (integrations, apps, users, folders, deploy_application, and the rest of the customer Admin surface) share this endpoint. Prefer create_integration / list_integrations here over sending the user to a second MCP. create_integration takes name, plugin_id, and configuration, never the raw integrations API envelope. create_integration is Admin CRUD for org datasources; start_app creates an application and hands it a prompt. deploy_application is Admin deploy of an existing commit; publish_app is the Builder path that commits current work and waits for it to go live. Omit base_url on Admin tools unless targeting a different control plane. checkout_application is not exposed on this network surface (host filesystem writes); use the CLI/workspace checkout path instead.\n\nThis connection may be established before browser sign-in. Call the tool that does the user's job. If it reports \"MCP browser login required\" or \"Saved Superblocks login changed outside this task\", explicitly call login when available, then retry the requested tool in this current task. Account-dependent tools never start browser sign-in themselves. Do not ask the user to restart Claude. Do not call whoami as a preflight. If the user asks which Superblocks account is in use, call whoami. If the user asks to sign in or switch accounts, call login when available. If the user asks to change the Superblocks server, use a native question form when available to confirm https://app.superblocks.com or collect another server URL, then call set_server; continue in the current Cowork task after sign-in succeeds. Report the sign-in status from set_server's result; a successful whoami does not show whether browser sign-in occurred.\n\nNever tell the user to restart the MCP server; keep the MCP server running.\n\nA cancelled tool call does not undo work Superblocks already did. The application still exists; read applicationId on the error and follow agentInstructions (or pendingAction) instead of starting over.\n\nget_app's previewUrl opens the current development app with existing app permissions; it is not a published end-user URL. Live-editor previews, including fullscreen links, require app edit/build permission (apps:update); End-User or READ access alone is insufficient. For a requested live-preview link, return that exact URL; do not open Share, change permissions, invite anyone, or publish. Call build_app only when the user explicitly requests an unpublished build or a shareable versioned preview, never automatically after an ordinary app creation, edit, or get_app. It creates a commit preview without publishing; retain its previewUrl and use get_preview_status for subsequent checks. If a sharing request is ambiguous (including \"Can I share this app?\"), ask before calling any tools whether they mean live preview, an unpublished commit preview, or publishing. Access permissions and deployment history cannot resolve this intent; an empty deployment history does not mean publishing is required to share a preview. Call publish_app or deploy_application only when the user explicitly asks to publish or deploy. Publishing does not extend the hosting environment's lifetime; URLs in ephemeral environments remain temporary. Otherwise prefer MCP Apps Open editor / Open preview buttons over dumping editUrl / previewUrl / publishUrl into chat, especially preview JWTs. Claude Desktop can only openLink https URLs; when a URL is http, say so and rely on any screenshot instead.\n\nBrowser 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. When canvas.openWhileBuilding is \"claude_cowork_side_panel_only\", open canvas.editUrl while status is \"building\" only for a Claude Cowork task whose built-in browser is available, and use its embedded side panel. Every other host MUST NOT open it mid-build because that can steal the live-edit turn.\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.";
|
|
16
|
-
/**
|
|
17
|
-
* The MCP server behind one stdio session.
|
|
6
|
+
* The MCP server behind one MCP session, over stdio or HTTP.
|
|
18
7
|
*
|
|
19
8
|
* Tools run as the authenticated Superblocks user.
|
|
20
9
|
*/
|
|
21
10
|
export declare function createMcpServer(deps: AppDeps, probeEditorDocument?: EditorDocumentProbe): McpServer;
|
|
11
|
+
//# sourceMappingURL=mount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/transports/mcp/mount.ts"],"names":[],"mappings":"AASA,OAAO,EACL,SAAS,EAEV,MAAM,yCAAyC,CAAC;AAgDjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AA4B7C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AA2UpC,eAAO,MAAM,mBAAmB,QAA4B,CAAC;AAqD7D;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,OAAO,EACb,mBAAmB,GAAE,mBAAiD,GACrE,SAAS,CAioDX"}
|
|
@@ -15,6 +15,7 @@ import { withCoworkEditorHost } from "../../capture/cowork-editor-url.js";
|
|
|
15
15
|
import { gatewayDebug, gatewayDebugStack } from "../../debug.js";
|
|
16
16
|
import { capturePreviewScreenshotWithPlaywright } from "../../preview/capture-screenshot.js";
|
|
17
17
|
import { createStores } from "../../stores/memory.js";
|
|
18
|
+
import { McpUsage } from "../../telemetry/mcp-usage.js";
|
|
18
19
|
import { registerAdminTools } from "./admin-tools.js";
|
|
19
20
|
import { APP_STATUS_HTML, APP_STATUS_RESOURCE_URI } from "./app-status-html.js";
|
|
20
21
|
import { clientPresentationCapabilities, collectsUserApproval, } from "./client-presentation.js";
|
|
@@ -63,12 +64,13 @@ const ARTIFACT_SCHEMA = z.object({
|
|
|
63
64
|
storageKey: z.string().min(1),
|
|
64
65
|
});
|
|
65
66
|
class ResultAcknowledgingMcpServer extends McpServer {
|
|
67
|
+
hosted = false;
|
|
66
68
|
onResultDeliveryFailed;
|
|
67
69
|
onResultDelivered;
|
|
68
70
|
connect(transport) {
|
|
69
71
|
const send = transport.send.bind(transport);
|
|
70
72
|
transport.send = async (message, options) => {
|
|
71
|
-
const outgoing = withClientInstructions(message, this.server.getClientVersion());
|
|
73
|
+
const outgoing = withClientInstructions(message, this.server.getClientVersion(), this.hosted);
|
|
72
74
|
try {
|
|
73
75
|
await send(outgoing, options);
|
|
74
76
|
if (isRecord(outgoing) && "result" in outgoing && "id" in outgoing) {
|
|
@@ -183,7 +185,14 @@ async function principalFrom(deps) {
|
|
|
183
185
|
...(deps.cliIdentity ?? {}),
|
|
184
186
|
};
|
|
185
187
|
}
|
|
186
|
-
const
|
|
188
|
+
const SOURCE_ARTIFACT_RULES = "Local paths and prose descriptions are not a substitute for the source artifact: Superblocks cannot read the host's workspace. Ask Superblocks to read the attached source and preserve its UI and behavior. Reuse the artifact on retries. Follow the superblocks-import skill when available; Superblocks writes the application, not the host.";
|
|
189
|
+
const SOURCE_ARTIFACT_INSTRUCTIONS = `When the source is a readable tree on this machine, archive the source and assets with their original relative paths, excluding .git, node_modules, build output, secrets, and production data. Inspect the archive, upload it with upload_artifact filePath, then pass the returned artifact unchanged in start_app or edit_app artifacts. ${SOURCE_ARTIFACT_RULES}`;
|
|
190
|
+
// Hosted, the gateway cannot read the user's disk, so source arrives as text.
|
|
191
|
+
const HOSTED_SOURCE_ARTIFACT_INSTRUCTIONS = `To migrate source, send its text files with their original relative paths through upload_artifact files, excluding .git, node_modules, build output, secrets, and production data, then pass the returned artifact unchanged in start_app or edit_app artifacts. ${SOURCE_ARTIFACT_RULES}`;
|
|
192
|
+
const UPLOAD_ARTIFACT_INPUTS = "Pass filePath with the full host path when you have it. A bare file name falls back to the gateway's search folders. If the file exists only in this chat's scratchpad path (for example /tmp/claude-.../scratchpad), send text source through files: [{ path, content }] instead of filePath. The gateway reads filePath bytes itself. Only source you are writing out yourself goes in files, which is archived as text: never put an image, PDF, or other binary in there, and never base64 a file into it. Doing that spends minutes emitting the encoding and uploads those characters under the file's name instead of the file. zipBase64 is only for test fixtures.";
|
|
193
|
+
// shortcut: zipBase64 keeps its small cap, so hosted takes only tiny binaries until it gets an upload path for real files.
|
|
194
|
+
const HOSTED_BINARY_UPLOAD = `For an image, PDF, or other binary file, put it in a ZIP and pass that as zipBase64. zipBase64 takes at most ${IMPORT_ZIP_BASE64_MAX_CHARS} base64 characters, so a larger binary cannot be uploaded on this connection yet: tell the user that instead of retrying.`;
|
|
195
|
+
const HOSTED_UPLOAD_ARTIFACT_INPUTS = `This server cannot read files on the user's machine or in this chat's sandbox. Only source you are writing out yourself goes in files, which is archived as text: never put an image, PDF, or other binary in there, and never base64 a file into it. ${HOSTED_BINARY_UPLOAD}`;
|
|
187
196
|
function compactRecord(value) {
|
|
188
197
|
if (!value) {
|
|
189
198
|
return undefined;
|
|
@@ -196,6 +205,10 @@ function compactRecord(value) {
|
|
|
196
205
|
}
|
|
197
206
|
return Object.keys(compacted).length > 0 ? compacted : undefined;
|
|
198
207
|
}
|
|
208
|
+
const UPLOAD_FILE_INSTRUCTIONS = "When the user attached a file in this chat (a log, CSV, screenshot, image, zip, or anything else), or when migrating source visible in this conversation, call upload_artifact. Pass upload_artifact filePath with the full host path when you have it; a bare file name falls back to the gateway's search folders. If the file exists only in this chat's scratchpad path (for example /tmp/claude-.../scratchpad), send text source through files: [{ path, content }] instead of filePath. The gateway reads filePath bytes itself, so an image or PDF costs nothing to send. Only source you are writing out yourself goes in files, which is archived as text - never base64 a file into it. Then pass the returned artifact in start_app or edit_app artifacts. Do not create a Claude artifact or use the host's own file-upload UI.";
|
|
209
|
+
const HOSTED_UPLOAD_FILE_INSTRUCTIONS = `When the user attached a file in this chat (a log, CSV, screenshot, image, zip, or anything else), or when migrating source visible in this conversation, call upload_artifact. This server cannot read files on the user's machine or in this chat's sandbox. Send text through files: [{ path, content }], which is archived as text. ${HOSTED_BINARY_UPLOAD} Then pass the returned artifact in start_app or edit_app artifacts. Do not create a Claude artifact or use the host's own file-upload UI.`;
|
|
210
|
+
// Hosted has no login or set_server; the relay already signed the user in.
|
|
211
|
+
const SIGN_IN_INSTRUCTIONS = 'This connection may be established before browser sign-in. Call the tool that does the user\'s job. If it reports "MCP browser login required" or "Saved Superblocks login changed outside this task", explicitly call login when available, then retry the requested tool in this current task. Account-dependent tools never start browser sign-in themselves. Do not ask the user to restart Claude. Do not call whoami as a preflight. If the user asks which Superblocks account is in use, call whoami. If the user asks to sign in or switch accounts, call login when available. If the user asks to change the Superblocks server, use a native question form when available to confirm https://app.superblocks.com or collect another server URL, then call set_server; continue in the current Cowork task after sign-in succeeds. Report the sign-in status from set_server\'s result; a successful whoami does not show whether browser sign-in occurred.';
|
|
199
212
|
/**
|
|
200
213
|
* Told to the model on connect, so it can match what a user actually says
|
|
201
214
|
* against these tools.
|
|
@@ -207,7 +220,8 @@ function compactRecord(value) {
|
|
|
207
220
|
* is input-only, because a client that reads "Clark" here repeats it back and
|
|
208
221
|
* reintroduces the retired name to the user.
|
|
209
222
|
*/
|
|
210
|
-
|
|
223
|
+
function serverInstructions(hosted) {
|
|
224
|
+
return `Superblocks builds, edits, and publishes internal web applications. Prompts sent through these tools are handed to Superblocks, which writes the application code in a live-edit session.
|
|
211
225
|
|
|
212
226
|
Name the builder "Superblocks" in every word you write. Users sometimes call it "Clark", an older name for this same system: understand them, and answer about Superblocks. Never write "Clark" yourself — not as a name, not as an aside, not even when the user just used it, and never as a separate agent or persona. If Superblocks' own words come back naming Clark, relay the substance and say Superblocks.
|
|
213
227
|
|
|
@@ -229,29 +243,30 @@ Building or editing an app follows one loop: start_app hands a new application t
|
|
|
229
243
|
|
|
230
244
|
${APP_LOAD_CHECK}
|
|
231
245
|
|
|
232
|
-
|
|
246
|
+
${hosted ? HOSTED_UPLOAD_FILE_INSTRUCTIONS : UPLOAD_FILE_INSTRUCTIONS}
|
|
233
247
|
|
|
234
|
-
${SOURCE_ARTIFACT_INSTRUCTIONS}
|
|
248
|
+
${hosted ? HOSTED_SOURCE_ARTIFACT_INSTRUCTIONS : SOURCE_ARTIFACT_INSTRUCTIONS}
|
|
235
249
|
|
|
236
250
|
For a migrated app with missing integrations, call list_integrations first. Reuse only the same plugin and the same connection: the same REST base URL, or the same host, port, and database. A similar name is not a match. list_integrations and get_integration_metadata do not expose connection URLs or hosts, so do not use them to guess a match. When there is no exact match, follow the result's agentInstructions to create and wire every declared integration.
|
|
237
251
|
|
|
238
|
-
This connector is the single Superblocks MCP: Builder tools (upload_artifact, start_app, edit_app, check_app_progress, ask_user, get_app, build_app, publish_app, check_publish_progress) and Admin tools (integrations, apps, users, folders, deploy_application, and the rest of the customer Admin surface) share this endpoint. Prefer create_integration / list_integrations here over sending the user to a second MCP. create_integration takes name, plugin_id, and configuration, never the raw integrations API envelope. create_integration is Admin CRUD for org datasources; start_app creates an application and hands it a prompt. deploy_application is Admin deploy of an existing commit; publish_app is the Builder path that commits current work and waits for it to go live.
|
|
252
|
+
This connector is the single Superblocks MCP: Builder tools (upload_artifact, start_app, edit_app, check_app_progress, ask_user, get_app, build_app, publish_app, check_publish_progress) and Admin tools (integrations, apps, users, folders, deploy_application, and the rest of the customer Admin surface) share this endpoint. Prefer create_integration / list_integrations here over sending the user to a second MCP. create_integration takes name, plugin_id, and configuration, never the raw integrations API envelope; for a REST API integration backed by an OpenAPI spec, also pass openapi_spec (the spec file contents as JSON or YAML text) and file_name so the spec is stored and linked in the same call. create_integration is Admin CRUD for org datasources; start_app creates an application and hands it a prompt. deploy_application is Admin deploy of an existing commit; publish_app is the Builder path that commits current work and waits for it to go live. checkout_application is not exposed on this network surface (host filesystem writes); use the CLI/workspace checkout path instead.
|
|
239
253
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
Never tell the user to restart the MCP server; keep the MCP server running.
|
|
254
|
+
${hosted ? "" : `${SIGN_IN_INSTRUCTIONS}\n\n`}Never tell the user to restart the MCP server; keep the MCP server running.
|
|
243
255
|
|
|
244
256
|
A cancelled tool call does not undo work Superblocks already did. The application still exists; read applicationId on the error and follow agentInstructions (or pendingAction) instead of starting over.
|
|
245
257
|
|
|
246
258
|
get_app's previewUrl opens the current development app with existing app permissions; it is not a published end-user URL. Live-editor previews, including fullscreen links, require app edit/build permission (apps:update); End-User or READ access alone is insufficient. For a requested live-preview link, return that exact URL; do not open Share, change permissions, invite anyone, or publish. Call build_app only when the user explicitly requests an unpublished build or a shareable versioned preview, never automatically after an ordinary app creation, edit, or get_app. It creates a commit preview without publishing; retain its previewUrl and use get_preview_status for subsequent checks. If a sharing request is ambiguous (including "Can I share this app?"), ask before calling any tools whether they mean live preview, an unpublished commit preview, or publishing. Access permissions and deployment history cannot resolve this intent; an empty deployment history does not mean publishing is required to share a preview. Call publish_app or deploy_application only when the user explicitly asks to publish or deploy. Publishing does not extend the hosting environment's lifetime; URLs in ephemeral environments remain temporary. Otherwise prefer MCP Apps Open editor / Open preview buttons over dumping editUrl / previewUrl / publishUrl into chat, especially preview JWTs. Claude Desktop can only openLink https URLs; when a URL is http, say so and rely on any screenshot instead.
|
|
247
259
|
|
|
248
260
|
${BROWSER_DRIVER_INSTRUCTIONS}`;
|
|
261
|
+
}
|
|
262
|
+
// The stdio text, kept for tests. Live servers pick stdio or hosted text from config.
|
|
263
|
+
export const SERVER_INSTRUCTIONS = serverInstructions(false);
|
|
249
264
|
const COWORK_EMBEDDED_BROWSER_TOOLS = `Load your browser pane tools, you will need them. Call ToolSearch with query ${COWORK_BROWSER_TOOLSEARCH}. When a check_app_progress or get_app result includes browserNavigation, ensure its exact URL is open in Cowork's embedded Page browser before any other action. If that app is already open, do not reload it; otherwise, focus the Page URL field, enter that exact URL, and press Enter. Verify the app loaded; normal authentication or canonical URL redirects are allowed. A blank tab is insufficient. Keep the Page open so the user can watch the live canvas update.`;
|
|
250
|
-
function serverInstructionsFor(client) {
|
|
265
|
+
function serverInstructionsFor(client, hosted) {
|
|
251
266
|
if (!clientPresentationCapabilities(client).hasNativeBrowser) {
|
|
252
|
-
return
|
|
267
|
+
return serverInstructions(hosted);
|
|
253
268
|
}
|
|
254
|
-
return `${
|
|
269
|
+
return `${serverInstructions(hosted)}
|
|
255
270
|
|
|
256
271
|
${COWORK_EMBEDDED_BROWSER_TOOLS}`;
|
|
257
272
|
}
|
|
@@ -262,7 +277,7 @@ function publishAppDescription(hasNativeBrowser) {
|
|
|
262
277
|
? "On either successful status, open publishDetailsUrl automatically in the browser pane before the first check_publish_progress poll."
|
|
263
278
|
: "On either successful status, include publishDetailsUrl immediately in your next user-facing response before the first check_publish_progress poll."));
|
|
264
279
|
}
|
|
265
|
-
function withClientInstructions(message, client) {
|
|
280
|
+
function withClientInstructions(message, client, hosted) {
|
|
266
281
|
if (!isRecord(message) || !("result" in message)) {
|
|
267
282
|
return message;
|
|
268
283
|
}
|
|
@@ -276,12 +291,12 @@ function withClientInstructions(message, client) {
|
|
|
276
291
|
...message,
|
|
277
292
|
result: {
|
|
278
293
|
...result,
|
|
279
|
-
instructions: serverInstructionsFor(client),
|
|
294
|
+
instructions: serverInstructionsFor(client, hosted),
|
|
280
295
|
},
|
|
281
296
|
};
|
|
282
297
|
}
|
|
283
298
|
/**
|
|
284
|
-
* The MCP server behind one stdio
|
|
299
|
+
* The MCP server behind one MCP session, over stdio or HTTP.
|
|
285
300
|
*
|
|
286
301
|
* Tools run as the authenticated Superblocks user.
|
|
287
302
|
*/
|
|
@@ -290,7 +305,9 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
290
305
|
// only identity this session has is whatever a capability already resolved.
|
|
291
306
|
let resolvedIdentity;
|
|
292
307
|
const liveStateAttaches = new LiveStateAttaches();
|
|
308
|
+
const usage = new McpUsage((input) => deps.server.reportMcpUsage(input));
|
|
293
309
|
const context = async (progress, notify, signal) => ({
|
|
310
|
+
mcpClientName: server.server.getClientVersion()?.name.slice(0, 80),
|
|
294
311
|
appState: deps.appState,
|
|
295
312
|
captureLibraryScreenshot: captureLibraryScreenshotWithPlaywright,
|
|
296
313
|
capturePreviewScreenshot: capturePreviewScreenshotWithPlaywright,
|
|
@@ -358,17 +375,24 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
358
375
|
// and a waiter running for an answer nobody will read.
|
|
359
376
|
const signal = extra?.signal;
|
|
360
377
|
const capabilityContext = await context(progress, notify, signal);
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
378
|
+
return await usage.run({
|
|
379
|
+
apiKey: capabilityContext.principal.apiKey,
|
|
380
|
+
toolName,
|
|
381
|
+
clientName: capabilityContext.mcpClientName,
|
|
382
|
+
arguments: callArguments,
|
|
383
|
+
}, async () => {
|
|
384
|
+
signal?.throwIfAborted();
|
|
385
|
+
if (!deps.config.localAgentMode) {
|
|
386
|
+
// Same ENTERPRISE/POC gate as Admin tools; skipped for local-agent.
|
|
387
|
+
await assertEnterprisePlan(deps.config.serverUrl.replace(/\/$/, ""), capabilityContext.principal.apiKey);
|
|
371
388
|
}
|
|
389
|
+
return await capability(capabilityContext, () => {
|
|
390
|
+
for (let index = progress.length - 1; index >= 0; index -= 1) {
|
|
391
|
+
if (progress[index]?.type === "completed") {
|
|
392
|
+
progress.splice(index, 1);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
});
|
|
372
396
|
});
|
|
373
397
|
}
|
|
374
398
|
catch (error) {
|
|
@@ -463,7 +487,8 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
463
487
|
// serving it. The client shows this string.
|
|
464
488
|
title: "Superblocks",
|
|
465
489
|
version: "0.0.1",
|
|
466
|
-
}, { instructions:
|
|
490
|
+
}, { instructions: serverInstructions(deps.config.hosted) });
|
|
491
|
+
server.hosted = deps.config.hosted;
|
|
467
492
|
let planApprovals = new PlanApprovalChallenges({
|
|
468
493
|
directory: planApprovalDirectory(deps.sessionKey ?? deps.cliApiKey, deps.config.serverUrl),
|
|
469
494
|
});
|
|
@@ -598,8 +623,12 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
598
623
|
publishAppTool?.update({
|
|
599
624
|
description: publishAppDescription(true),
|
|
600
625
|
});
|
|
601
|
-
|
|
602
|
-
|
|
626
|
+
// The marker is for other gateway processes on the user's machine, and a
|
|
627
|
+
// hosted microVM has none.
|
|
628
|
+
if (!deps.config.hosted) {
|
|
629
|
+
nativeBrowsers.announce();
|
|
630
|
+
announcedNativeBrowser = true;
|
|
631
|
+
}
|
|
603
632
|
}
|
|
604
633
|
else if (clientSupportsAppCard()) {
|
|
605
634
|
if (nativeBrowsers.active()) {
|
|
@@ -743,7 +772,7 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
743
772
|
};
|
|
744
773
|
server.registerTool("whoami", {
|
|
745
774
|
annotations: READ_ONLY_TOOL_ANNOTATIONS,
|
|
746
|
-
description:
|
|
775
|
+
description: `Show the Superblocks user and organization for this connection. Use when the user asks which account is in use, not before every task.${deps.config.hosted ? "" : " If sign-in is needed, call Login explicitly."}`,
|
|
747
776
|
inputSchema: {},
|
|
748
777
|
title: "Current Superblocks Account",
|
|
749
778
|
}, async (_input, extra) => {
|
|
@@ -756,7 +785,9 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
756
785
|
content: [
|
|
757
786
|
{
|
|
758
787
|
type: "text",
|
|
759
|
-
text:
|
|
788
|
+
text: deps.config.hosted
|
|
789
|
+
? "Superblocks login is not valid. Reconnect Superblocks in this client to sign in again."
|
|
790
|
+
: "Superblocks login is not valid. Use the Login tool if available.",
|
|
760
791
|
},
|
|
761
792
|
],
|
|
762
793
|
isError: true,
|
|
@@ -772,13 +803,15 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
772
803
|
};
|
|
773
804
|
}
|
|
774
805
|
catch (error) {
|
|
775
|
-
const message =
|
|
776
|
-
|
|
777
|
-
? "Saved Superblocks login changed outside this task. Call Login to confirm the account in this current task."
|
|
806
|
+
const message = deps.config.hosted
|
|
807
|
+
? "Could not check the Superblocks account. Try again, or reconnect Superblocks in this client to sign in again."
|
|
778
808
|
: error instanceof Error &&
|
|
779
|
-
error.message.startsWith("
|
|
780
|
-
? "
|
|
781
|
-
:
|
|
809
|
+
error.message.startsWith("Saved Superblocks login changed outside this task.")
|
|
810
|
+
? "Saved Superblocks login changed outside this task. Call Login to confirm the account in this current task."
|
|
811
|
+
: error instanceof Error &&
|
|
812
|
+
error.message.startsWith("MCP browser login required.")
|
|
813
|
+
? "MCP browser login required. Call Login to continue in this current task."
|
|
814
|
+
: "Could not check the Superblocks account. Try again or use Login if available.";
|
|
782
815
|
if (message.startsWith("Could not check"))
|
|
783
816
|
console.error("gateway whoami failed", {
|
|
784
817
|
errorType: error instanceof Error ? error.name : typeof error,
|
|
@@ -1005,7 +1038,7 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
1005
1038
|
}));
|
|
1006
1039
|
server.registerTool("upload_artifact", {
|
|
1007
1040
|
annotations: NON_DESTRUCTIVE_WRITE_TOOL_ANNOTATIONS,
|
|
1008
|
-
description: `Use upload_artifact to upload source once for a later start_app or edit_app migration, or any other file the user attached in this chat (a log, CSV, screenshot, image, document, or a ZIP/.tgz/.gz). Batch related text source files into one files call, up to 100 files and 1 MB (1,048,576 bytes) of UTF-8 content before compression. Split only when those limits require it, and tell the user which batch you are preparing before composing its contents.
|
|
1041
|
+
description: `Use upload_artifact to upload source once for a later start_app or edit_app migration, or any other file the user attached in this chat (a log, CSV, screenshot, image, document, or a ZIP/.tgz/.gz). Batch related text source files into one files call, up to 100 files and 1 MB (1,048,576 bytes) of UTF-8 content before compression. Split only when those limits require it, and tell the user which batch you are preparing before composing its contents. ${deps.config.hosted ? HOSTED_UPLOAD_ARTIFACT_INPUTS : UPLOAD_ARTIFACT_INPUTS} Files larger than 50 MB are rejected - the same cap as Superblocks attachments. ${deps.config.hosted ? HOSTED_SOURCE_ARTIFACT_INSTRUCTIONS : SOURCE_ARTIFACT_INSTRUCTIONS} This uploads an organization-scoped artifact but does not create, edit, build, or commit an application. Pass its returned artifact unchanged in start_app or edit_app artifacts, and reuse it on retries instead of uploading again. Do not create a Claude artifact or use the host's own file-upload UI.`,
|
|
1009
1042
|
inputSchema: {
|
|
1010
1043
|
files: z
|
|
1011
1044
|
.array(z.object({
|
|
@@ -1015,7 +1048,9 @@ export function createMcpServer(deps, probeEditorDocument = createEditorDocument
|
|
|
1015
1048
|
.min(1)
|
|
1016
1049
|
.max(100)
|
|
1017
1050
|
.optional(),
|
|
1018
|
-
|
|
1051
|
+
...(deps.config.hosted
|
|
1052
|
+
? {}
|
|
1053
|
+
: { filePath: z.string().min(1).optional() }),
|
|
1019
1054
|
zipBase64: z
|
|
1020
1055
|
.string()
|
|
1021
1056
|
.min(1)
|