@superblocksteam/gateway 2.0.0-SNAPSHOT.2161f9a02a4eb5d8
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 +284 -0
- package/dist/agents/resolve-orchestrator-url.d.ts +22 -0
- package/dist/agents/resolve-orchestrator-url.js +38 -0
- package/dist/agents/resolve-orchestrator-url.js.map +1 -0
- package/dist/capabilities/integration-metadata.d.ts +28 -0
- package/dist/capabilities/integration-metadata.js +174 -0
- package/dist/capabilities/integration-metadata.js.map +1 -0
- package/dist/capabilities/lifecycle.d.ts +93 -0
- package/dist/capabilities/lifecycle.js +3417 -0
- package/dist/capabilities/lifecycle.js.map +1 -0
- package/dist/capabilities/query-integration.d.ts +14 -0
- package/dist/capabilities/query-integration.js +172 -0
- package/dist/capabilities/query-integration.js.map +1 -0
- package/dist/capabilities/source-files-archive.d.ts +11 -0
- package/dist/capabilities/source-files-archive.js +54 -0
- package/dist/capabilities/source-files-archive.js.map +1 -0
- package/dist/capabilities/types.d.ts +542 -0
- package/dist/capabilities/types.js +86 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/capture/browser-contract.d.ts +46 -0
- package/dist/capture/browser-contract.js +34 -0
- package/dist/capture/browser-contract.js.map +1 -0
- package/dist/capture/browser-instructions.d.ts +10 -0
- package/dist/capture/browser-instructions.js +18 -0
- package/dist/capture/browser-instructions.js.map +1 -0
- package/dist/capture/capture-library-probe.d.ts +55 -0
- package/dist/capture/capture-library-probe.js +177 -0
- package/dist/capture/capture-library-probe.js.map +1 -0
- package/dist/capture/capture-library.d.ts +52 -0
- package/dist/capture/capture-library.js +249 -0
- package/dist/capture/capture-library.js.map +1 -0
- package/dist/capture/classify-library-paint.d.ts +21 -0
- package/dist/capture/classify-library-paint.js +13 -0
- package/dist/capture/classify-library-paint.js.map +1 -0
- package/dist/capture/host-mcp-scan.d.ts +16 -0
- package/dist/capture/host-mcp-scan.js +64 -0
- package/dist/capture/host-mcp-scan.js.map +1 -0
- package/dist/capture/library-parent-script.d.ts +35 -0
- package/dist/capture/library-parent-script.js +82 -0
- package/dist/capture/library-parent-script.js.map +1 -0
- package/dist/capture/mode.d.ts +29 -0
- package/dist/capture/mode.js +65 -0
- package/dist/capture/mode.js.map +1 -0
- package/dist/config.d.ts +148 -0
- package/dist/config.js +112 -0
- package/dist/config.js.map +1 -0
- package/dist/debug.d.ts +2 -0
- package/dist/debug.js +9 -0
- package/dist/debug.js.map +1 -0
- package/dist/deps.d.ts +38 -0
- package/dist/deps.js +2 -0
- package/dist/deps.js.map +1 -0
- package/dist/health/readiness.d.ts +99 -0
- package/dist/health/readiness.js +202 -0
- package/dist/health/readiness.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/filters.d.ts +8 -0
- package/dist/integrations/filters.js +40 -0
- package/dist/integrations/filters.js.map +1 -0
- package/dist/integrations/map.d.ts +27 -0
- package/dist/integrations/map.js +43 -0
- package/dist/integrations/map.js.map +1 -0
- package/dist/integrations/profile-key.d.ts +19 -0
- package/dist/integrations/profile-key.js +35 -0
- package/dist/integrations/profile-key.js.map +1 -0
- package/dist/integrations/read-only-postgres-query.d.ts +2 -0
- package/dist/integrations/read-only-postgres-query.js +164 -0
- package/dist/integrations/read-only-postgres-query.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -0
- package/dist/orchestrator/client.d.ts +62 -0
- package/dist/orchestrator/client.js +160 -0
- package/dist/orchestrator/client.js.map +1 -0
- package/dist/playwright/ensure-chromium.d.ts +23 -0
- package/dist/playwright/ensure-chromium.js +59 -0
- package/dist/playwright/ensure-chromium.js.map +1 -0
- package/dist/preview/capture-screenshot.d.ts +67 -0
- package/dist/preview/capture-screenshot.js +179 -0
- package/dist/preview/capture-screenshot.js.map +1 -0
- package/dist/preview/viewer-url.d.ts +82 -0
- package/dist/preview/viewer-url.js +130 -0
- package/dist/preview/viewer-url.js.map +1 -0
- package/dist/process/fault-barrier.d.ts +55 -0
- package/dist/process/fault-barrier.js +113 -0
- package/dist/process/fault-barrier.js.map +1 -0
- package/dist/sabs/agent-facing-text.d.ts +35 -0
- package/dist/sabs/agent-facing-text.js +165 -0
- package/dist/sabs/agent-facing-text.js.map +1 -0
- package/dist/sabs/app-state.d.ts +133 -0
- package/dist/sabs/app-state.js +347 -0
- package/dist/sabs/app-state.js.map +1 -0
- package/dist/sabs/awaited-decision.d.ts +47 -0
- package/dist/sabs/awaited-decision.js +124 -0
- package/dist/sabs/awaited-decision.js.map +1 -0
- package/dist/sabs/browser-context.d.ts +53 -0
- package/dist/sabs/browser-context.js +92 -0
- package/dist/sabs/browser-context.js.map +1 -0
- package/dist/sabs/editor-client-methods.d.ts +164 -0
- package/dist/sabs/editor-client-methods.js +749 -0
- package/dist/sabs/editor-client-methods.js.map +1 -0
- package/dist/sabs/editor-socket.d.ts +84 -0
- package/dist/sabs/editor-socket.js +64 -0
- package/dist/sabs/editor-socket.js.map +1 -0
- package/dist/sabs/recent-tool-runs.d.ts +14 -0
- package/dist/sabs/recent-tool-runs.js +61 -0
- package/dist/sabs/recent-tool-runs.js.map +1 -0
- package/dist/sabs/session-peer.d.ts +386 -0
- package/dist/sabs/session-peer.js +11 -0
- package/dist/sabs/session-peer.js.map +1 -0
- package/dist/sabs/streamed-reply.d.ts +42 -0
- package/dist/sabs/streamed-reply.js +110 -0
- package/dist/sabs/streamed-reply.js.map +1 -0
- package/dist/sabs/turn-collector.d.ts +169 -0
- package/dist/sabs/turn-collector.js +512 -0
- package/dist/sabs/turn-collector.js.map +1 -0
- package/dist/sabs/websocket-session-peer.d.ts +533 -0
- package/dist/sabs/websocket-session-peer.js +3241 -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 +400 -0
- package/dist/server/client.js +649 -0
- package/dist/server/client.js.map +1 -0
- package/dist/server/identity-reads.d.ts +76 -0
- package/dist/server/identity-reads.js +209 -0
- package/dist/server/identity-reads.js.map +1 -0
- package/dist/start.d.ts +24 -0
- package/dist/start.js +81 -0
- package/dist/start.js.map +1 -0
- package/dist/stores/memory.d.ts +42 -0
- package/dist/stores/memory.js +121 -0
- package/dist/stores/memory.js.map +1 -0
- package/dist/stores/types.d.ts +74 -0
- package/dist/stores/types.js +11 -0
- package/dist/stores/types.js.map +1 -0
- package/dist/telemetry/mcp-client.d.ts +22 -0
- package/dist/telemetry/mcp-client.js +140 -0
- package/dist/telemetry/mcp-client.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +41 -0
- package/dist/telemetry/metrics.js +103 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/telemetry/runtime.d.ts +9 -0
- package/dist/telemetry/runtime.js +118 -0
- package/dist/telemetry/runtime.js.map +1 -0
- package/dist/transports/mcp/admin-tools.d.ts +51 -0
- package/dist/transports/mcp/admin-tools.js +211 -0
- package/dist/transports/mcp/admin-tools.js.map +1 -0
- package/dist/transports/mcp/app-status-html.d.ts +11 -0
- package/dist/transports/mcp/app-status-html.js +899 -0
- package/dist/transports/mcp/app-status-html.js.map +1 -0
- package/dist/transports/mcp/client-presentation.d.ts +16 -0
- package/dist/transports/mcp/client-presentation.js +13 -0
- package/dist/transports/mcp/client-presentation.js.map +1 -0
- package/dist/transports/mcp/decision-card-html.d.ts +26 -0
- package/dist/transports/mcp/decision-card-html.js +876 -0
- package/dist/transports/mcp/decision-card-html.js.map +1 -0
- package/dist/transports/mcp/decision-elicitation.d.ts +116 -0
- package/dist/transports/mcp/decision-elicitation.js +292 -0
- package/dist/transports/mcp/decision-elicitation.js.map +1 -0
- package/dist/transports/mcp/dispatch-probe.d.ts +24 -0
- package/dist/transports/mcp/dispatch-probe.js +48 -0
- package/dist/transports/mcp/dispatch-probe.js.map +1 -0
- package/dist/transports/mcp/format-tool-content.d.ts +20 -0
- package/dist/transports/mcp/format-tool-content.js +89 -0
- package/dist/transports/mcp/format-tool-content.js.map +1 -0
- package/dist/transports/mcp/instructions/index.d.ts +23 -0
- package/dist/transports/mcp/instructions/index.js +81 -0
- package/dist/transports/mcp/instructions/index.js.map +1 -0
- package/dist/transports/mcp/instructions/result.d.ts +18 -0
- package/dist/transports/mcp/instructions/result.js +58 -0
- package/dist/transports/mcp/instructions/result.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/ask-user.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/ask-user.js +17 -0
- package/dist/transports/mcp/instructions/tools/ask-user.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.js +72 -0
- package/dist/transports/mcp/instructions/tools/check-app-progress.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/check-publish-progress.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/check-publish-progress.js +14 -0
- package/dist/transports/mcp/instructions/tools/check-publish-progress.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/copy.d.ts +8 -0
- package/dist/transports/mcp/instructions/tools/copy.js +19 -0
- package/dist/transports/mcp/instructions/tools/copy.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/create-integration.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/create-integration.js +32 -0
- package/dist/transports/mcp/instructions/tools/create-integration.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/edit-app.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/edit-app.js +14 -0
- package/dist/transports/mcp/instructions/tools/edit-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/get-app.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/get-app.js +47 -0
- package/dist/transports/mcp/instructions/tools/get-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.js +13 -0
- package/dist/transports/mcp/instructions/tools/get-integration-metadata.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/index.d.ts +7 -0
- package/dist/transports/mcp/instructions/tools/index.js +26 -0
- package/dist/transports/mcp/instructions/tools/index.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/preview-app.d.ts +3 -0
- package/dist/transports/mcp/instructions/tools/preview-app.js +14 -0
- package/dist/transports/mcp/instructions/tools/preview-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/publish-app.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/publish-app.js +11 -0
- package/dist/transports/mcp/instructions/tools/publish-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/start-app.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/start-app.js +18 -0
- package/dist/transports/mcp/instructions/tools/start-app.js.map +1 -0
- package/dist/transports/mcp/instructions/tools/upload-artifact.d.ts +2 -0
- package/dist/transports/mcp/instructions/tools/upload-artifact.js +13 -0
- package/dist/transports/mcp/instructions/tools/upload-artifact.js.map +1 -0
- package/dist/transports/mcp/mcp-app-brand-css.d.ts +1 -0
- package/dist/transports/mcp/mcp-app-brand-css.js +180 -0
- package/dist/transports/mcp/mcp-app-brand-css.js.map +1 -0
- package/dist/transports/mcp/mount.d.ts +21 -0
- package/dist/transports/mcp/mount.js +968 -0
- package/dist/transports/mcp/mount.js.map +1 -0
- package/dist/transports/mcp/native-browser-presence.d.ts +45 -0
- package/dist/transports/mcp/native-browser-presence.js +158 -0
- package/dist/transports/mcp/native-browser-presence.js.map +1 -0
- package/dist/transports/mcp/plan-approval.d.ts +38 -0
- package/dist/transports/mcp/plan-approval.js +175 -0
- package/dist/transports/mcp/plan-approval.js.map +1 -0
- package/dist/transports/mcp/progress-notifier.d.ts +39 -0
- package/dist/transports/mcp/progress-notifier.js +52 -0
- package/dist/transports/mcp/progress-notifier.js.map +1 -0
- package/dist/transports/mcp/session-directory.d.ts +7 -0
- package/dist/transports/mcp/session-directory.js +18 -0
- package/dist/transports/mcp/session-directory.js.map +1 -0
- package/dist/transports/mcp/tool-names.d.ts +2 -0
- package/dist/transports/mcp/tool-names.js +2 -0
- package/dist/transports/mcp/tool-names.js.map +1 -0
- package/package.json +78 -0
- package/skills/superblocks-build/SKILL.md +59 -0
- package/skills/superblocks-import/SKILL.md +87 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What to tell the calling agent after a tool call.
|
|
3
|
+
*
|
|
4
|
+
* One file per tool under `tools/` holds that tool's rules; `readResult`
|
|
5
|
+
* flattens a capability result so those rules read as a plain list of
|
|
6
|
+
* conditions. Callers only need the three functions below.
|
|
7
|
+
*/
|
|
8
|
+
import { isRecord, readResult } from "./result.js";
|
|
9
|
+
import { INSTRUCTIONS } from "./tools/index.js";
|
|
10
|
+
/** The agent's next step after `tool` returned `result`, if it needs one. */
|
|
11
|
+
export function instructionFor(tool, result, profile) {
|
|
12
|
+
return INSTRUCTIONS[tool]?.(readResult(result), profile);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Writes `agentInstructions` onto a capability result, leaving any the
|
|
16
|
+
* capability set itself in place (activity relay and similar).
|
|
17
|
+
*/
|
|
18
|
+
export function attachAgentInstructions(tool, result, profile) {
|
|
19
|
+
const agentInstructions = instructionFor(tool, result, profile);
|
|
20
|
+
if (!agentInstructions) {
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
if (result.kind === "error") {
|
|
24
|
+
return result.agentInstructions ? result : { ...result, agentInstructions };
|
|
25
|
+
}
|
|
26
|
+
if (result.kind !== "ok" || !isRecord(result.value)) {
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
if (typeof result.value.agentInstructions === "string" &&
|
|
30
|
+
result.value.agentInstructions) {
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
return { kind: "ok", value: { ...result.value, agentInstructions } };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The same, for Admin tools: they return MCP `CallToolResult` JSON rather than
|
|
37
|
+
* a capability result, so the payload is parsed and rewritten.
|
|
38
|
+
*/
|
|
39
|
+
export function attachAdminAgentInstructions(tool, result, profile) {
|
|
40
|
+
if (result.isError) {
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
const block = result.content[0];
|
|
44
|
+
if (!block || block.type !== "text") {
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
let parsed;
|
|
48
|
+
try {
|
|
49
|
+
parsed = JSON.parse(block.text);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
if (!isRecord(parsed)) {
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
if (typeof parsed.agentInstructions === "string" &&
|
|
58
|
+
parsed.agentInstructions) {
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
const agentInstructions = instructionFor(tool, { kind: "ok", value: parsed }, profile);
|
|
62
|
+
if (!agentInstructions) {
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
const nextValue = { ...parsed, agentInstructions };
|
|
66
|
+
const existingStructured = isRecord(result.structuredContent)
|
|
67
|
+
? result.structuredContent
|
|
68
|
+
: undefined;
|
|
69
|
+
return {
|
|
70
|
+
...result,
|
|
71
|
+
content: [
|
|
72
|
+
{ type: "text", text: JSON.stringify(nextValue) },
|
|
73
|
+
...result.content.slice(1),
|
|
74
|
+
],
|
|
75
|
+
structuredContent: {
|
|
76
|
+
...(existingStructured ?? nextValue),
|
|
77
|
+
agentInstructions,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/transports/mcp/instructions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,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IAAI,SAAS,CAAC;YACpC,iBAAiB;SAClB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CapabilityResult, DecisionPayload, PendingAppAction } from "../../../capabilities/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A capability result flattened into the handful of fields the tool files
|
|
4
|
+
* branch on. Reading happens once here so no tool file digs through
|
|
5
|
+
* `CapabilityResult`'s ok/error split or a nested `decision` object.
|
|
6
|
+
*/
|
|
7
|
+
export type ToolResult = {
|
|
8
|
+
/** Error code, or undefined when the call succeeded. */
|
|
9
|
+
code?: string;
|
|
10
|
+
decisionKind?: DecisionPayload["kind"];
|
|
11
|
+
ok: boolean;
|
|
12
|
+
pendingAction?: PendingAppAction;
|
|
13
|
+
status?: string;
|
|
14
|
+
/** Remaining response fields, for the few tools with their own signals. */
|
|
15
|
+
value: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
export declare function readResult(result: CapabilityResult<unknown>): ToolResult;
|
|
18
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function readResult(result) {
|
|
2
|
+
if (result.kind === "error") {
|
|
3
|
+
return {
|
|
4
|
+
code: result.code,
|
|
5
|
+
ok: false,
|
|
6
|
+
...(result.pendingAction ? { pendingAction: result.pendingAction } : {}),
|
|
7
|
+
value: {},
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
// auth_required is the host's to resolve, not the agent's; it carries no fields to branch on.
|
|
11
|
+
if (result.kind !== "ok") {
|
|
12
|
+
return { ok: false, value: {} };
|
|
13
|
+
}
|
|
14
|
+
const value = isRecord(result.value) ? result.value : {};
|
|
15
|
+
const decisionKind = decisionKindOf(value);
|
|
16
|
+
const pendingAction = pendingActionOf(value);
|
|
17
|
+
const { status } = value;
|
|
18
|
+
return {
|
|
19
|
+
...(decisionKind ? { decisionKind } : {}),
|
|
20
|
+
ok: true,
|
|
21
|
+
...(pendingAction ? { pendingAction } : {}),
|
|
22
|
+
...(typeof status === "string" ? { status } : {}),
|
|
23
|
+
value,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function isRecord(value) {
|
|
27
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28
|
+
}
|
|
29
|
+
function decisionKindOf(value) {
|
|
30
|
+
const decision = value.decision;
|
|
31
|
+
if (!isRecord(decision)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
switch (decision.kind) {
|
|
35
|
+
case "missing_integrations":
|
|
36
|
+
case "multi_choice":
|
|
37
|
+
case "plan":
|
|
38
|
+
return decision.kind;
|
|
39
|
+
default:
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function pendingActionOf(value) {
|
|
44
|
+
switch (value.pendingAction) {
|
|
45
|
+
case "answer_question":
|
|
46
|
+
case "approve_plan":
|
|
47
|
+
case "create_integration":
|
|
48
|
+
case "decide_in_editor":
|
|
49
|
+
case "open_editor":
|
|
50
|
+
case "retry_build":
|
|
51
|
+
case "start_new_app":
|
|
52
|
+
case "wait_for_build":
|
|
53
|
+
return value.pendingAction;
|
|
54
|
+
default:
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../../../src/transports/mcp/instructions/result.ts"],"names":[],"mappings":"AAsBA,MAAM,UAAU,UAAU,CAAC,MAAiC;IAC1D,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,EAAE,EAAE,KAAK;YACT,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC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B,KAAK,sBAAsB,CAAC;QAC5B,KAAK,cAAc,CAAC;QACpB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CACtB,KAA8B;IAE9B,QAAQ,KAAK,CAAC,aAAa,EAAE,CAAC;QAC5B,KAAK,iBAAiB,CAAC;QACvB,KAAK,cAAc,CAAC;QACpB,KAAK,oBAAoB,CAAC;QAC1B,KAAK,kBAAkB,CAAC;QACxB,KAAK,aAAa,CAAC;QACnB,KAAK,aAAa,CAAC;QACnB,KAAK,eAAe,CAAC;QACrB,KAAK,gBAAgB;YACnB,OAAO,KAAK,CAAC,aAAa,CAAC;QAC7B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SHOW_PLAN_VERBATIM } from "./copy.js";
|
|
2
|
+
export function instructAskUser(result) {
|
|
3
|
+
if (!result.ok) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
if (result.decisionKind === "plan") {
|
|
7
|
+
return `Show this plan to the user. ${SHOW_PLAN_VERBATIM}`;
|
|
8
|
+
}
|
|
9
|
+
if (result.decisionKind === "multi_choice") {
|
|
10
|
+
return "Present `decision.question` and every entry of `decision.options`, none dropped or merged, as an affordance (picker/suggested replies) if your host supports one. Never type a numbered menu as a stand-in for a picker that's already showing the same options.";
|
|
11
|
+
}
|
|
12
|
+
if (!result.decisionKind) {
|
|
13
|
+
return "Nothing is waiting on the user right now. Follow the build instead: call `check_app_progress` or `get_app` rather than asking again.";
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ask-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask-user.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/ask-user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,UAAU,eAAe,CAAC,MAAkB;IAChD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;QACnC,OAAO,+BAA+B,kBAAkB,EAAE,CAAC;IAC7D,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,KAAK,cAAc,EAAE,CAAC;QAC3C,OAAO,kQAAkQ,CAAC;IAC5Q,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO,sIAAsI,CAAC;IAChJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CHECKPOINT_FAILED, instructUserDecision, REPLACE_WEDGED_APP, } from "./copy.js";
|
|
2
|
+
export function instructCheckAppProgress(result, profile) {
|
|
3
|
+
const navigation = profile.hasNativeBrowser
|
|
4
|
+
? result.value.browserNavigation
|
|
5
|
+
: undefined;
|
|
6
|
+
if (!isBrowserNavigation(navigation)) {
|
|
7
|
+
return resultInstructions(result, profile);
|
|
8
|
+
}
|
|
9
|
+
const instructions = resultInstructions(result, profile);
|
|
10
|
+
const browserInstructions = `CRITICAL DO NOT IGNORE: viewStatus is ready, before any other action, ensure ${navigation.url} is open in Cowork's embedded Page browser and verify the app loaded.`;
|
|
11
|
+
return instructions
|
|
12
|
+
? `${browserInstructions}\n\n${instructions}`
|
|
13
|
+
: browserInstructions;
|
|
14
|
+
}
|
|
15
|
+
function resultInstructions(result, profile) {
|
|
16
|
+
if (result.decisionKind === "missing_integrations") {
|
|
17
|
+
return "Create every entry in `decision.integrations`; do not call `ask_user` or relay manual setup steps. Call `create_integration` with each entry's name, pluginId, and configuration. When `configurationSchema` is present, use it directly and skip `get_integration_config_schema`; when it is absent, call `get_integration_config_schema` first. Follow each `create_integration` result's agentInstructions for configuration and app wiring.";
|
|
18
|
+
}
|
|
19
|
+
const decisionInstructions = instructUserDecision(result, profile);
|
|
20
|
+
if (decisionInstructions) {
|
|
21
|
+
return decisionInstructions;
|
|
22
|
+
}
|
|
23
|
+
if (result.pendingAction === "start_new_app") {
|
|
24
|
+
return REPLACE_WEDGED_APP;
|
|
25
|
+
}
|
|
26
|
+
if (result.status === "checkpoint_failed") {
|
|
27
|
+
return CHECKPOINT_FAILED;
|
|
28
|
+
}
|
|
29
|
+
if (result.status === "live_edit_terminated") {
|
|
30
|
+
return "This is terminal. Report the reply to the user and stop - do not retry `edit_app` or create another application for this turn.";
|
|
31
|
+
}
|
|
32
|
+
if (result.pendingAction === "retry_build" &&
|
|
33
|
+
(result.status === "cancelled" ||
|
|
34
|
+
result.status === "no_changes" ||
|
|
35
|
+
result.status === "timeout")) {
|
|
36
|
+
return "Call `edit_app` again on this `applicationId` - the last turn ended without writing anything, but the application itself is fine to retry.";
|
|
37
|
+
}
|
|
38
|
+
if (result.status === "building") {
|
|
39
|
+
const lines = superblocksActivity(result);
|
|
40
|
+
if (lines.length > 0) {
|
|
41
|
+
const them = lines.length === 1 ? "it" : "all of them";
|
|
42
|
+
return `The build is still running. Superblocks sent ${lines.length} new activity ${lines.length === 1 ? "line" : "lines"} in this result. CRITICAL DO NOT IGNORE: Between polls, write ${them} into your own reply, oldest first, verbatim. Then, call check_app_progress again.`;
|
|
43
|
+
}
|
|
44
|
+
return `Superblocks is still working. This is a long poll, as soon as any activity is available it will be relayed to you. Do not sleep, immediately call check_app_progress again.`;
|
|
45
|
+
}
|
|
46
|
+
if (result.status === "unknown") {
|
|
47
|
+
return "Tell the user that Superblocks progress tracking was interrupted and ask whether they want to continue. Only if the user says to continue, call `edit_app` on the same `applicationId` with their instruction.";
|
|
48
|
+
}
|
|
49
|
+
if (result.status === "ready") {
|
|
50
|
+
return "The app is ready. Call get_app to get the editor and preview URLs. Do not call check_app_progress again.";
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
function isBrowserNavigation(value) {
|
|
55
|
+
return (typeof value === "object" &&
|
|
56
|
+
value !== null &&
|
|
57
|
+
"action" in value &&
|
|
58
|
+
value.action === "open_editor" &&
|
|
59
|
+
"url" in value &&
|
|
60
|
+
typeof value.url === "string" &&
|
|
61
|
+
value.url.length > 0);
|
|
62
|
+
}
|
|
63
|
+
/** Gateway heartbeats are not Superblocks chat and must not trigger a relay. */
|
|
64
|
+
function superblocksActivity(result) {
|
|
65
|
+
const activity = result.value.activity;
|
|
66
|
+
if (!Array.isArray(activity)) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
return activity.filter((line) => typeof line === "string" &&
|
|
70
|
+
!/^Superblocks is still generating \(\d+s\)$/.test(line));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=check-app-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-app-progress.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/check-app-progress.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,MAAM,UAAU,wBAAwB,CACtC,MAAkB,EAClB,OAAsB;IAEtB,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB;QACzC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB;QAChC,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC;QACrC,OAAO,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,YAAY,GAAG,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,mBAAmB,GAAG,gFAAgF,UAAU,CAAC,GAAG,uEAAuE,CAAC;IAClM,OAAO,YAAY;QACjB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CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAChC,iEAAiE,IAAI,oFAAoF,CAAC;QAC5J,CAAC;QACD,OAAO,6KAA6K,CAAC;IACvL,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,gNAAgN,CAAC;IAC1N,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QAC9B,OAAO,0GAA0G,CAAC;IACpH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,mBAAmB,CAC1B,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,QAAQ,IAAI,KAAK;QACjB,KAAK,CAAC,MAAM,KAAK,aAAa;QAC9B,KAAK,IAAI,KAAK;QACd,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;QAC7B,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CACrB,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,SAAS,mBAAmB,CAAC,MAAkB;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;IACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,IAAI,EAAkB,EAAE,CACvB,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,4CAA4C,CAAC,IAAI,CAAC,IAAI,CAAC,CAC3D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function instructCheckPublishProgress(result) {
|
|
2
|
+
if (result.code === "publish_not_started") {
|
|
3
|
+
return "The publish cursor was not available. Retry `check_publish_progress` with both the `applicationId` and `commitId` returned by `publish_app`. Call `publish_app` only if nothing was ever queued.";
|
|
4
|
+
}
|
|
5
|
+
if (result.status === "publishing") {
|
|
6
|
+
const elapsedSeconds = result.value.elapsedSeconds;
|
|
7
|
+
const elapsed = typeof elapsedSeconds === "number" && Number.isFinite(elapsedSeconds)
|
|
8
|
+
? ` for ${Math.max(0, Math.floor(elapsedSeconds))} seconds`
|
|
9
|
+
: "";
|
|
10
|
+
return `The rollout is still running${elapsed}, so the app is not live yet - do not tell the user it is. Continue to call \`check_publish_progress\` until the app is live. Do not call \`publish_app\` again.`;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=check-publish-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-publish-progress.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/check-publish-progress.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,4BAA4B,CAC1C,MAAkB;IAElB,IAAI,MAAM,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;QAC1C,OAAO,kMAAkM,CAAC;IAC5M,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;QACnC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;QACnD,MAAM,OAAO,GACX,OAAO,cAAc,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;YACnE,CAAC,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,UAAU;YAC3D,CAAC,CAAC,EAAE,CAAC;QACT,OAAO,+BAA+B,OAAO,kKAAkK,CAAC;IAClN,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Instructions shared verbatim by more than one tool. */
|
|
2
|
+
import type { ClientProfile } from "../../client-presentation.js";
|
|
3
|
+
import type { ToolResult } from "../result.js";
|
|
4
|
+
export declare const BUILDING_FOLLOW_UP = "Call `check_app_progress` with this `applicationId` to follow the turn. Relay each new activity line to the user as it arrives. CRITICAL: Load your embedded browser tools.";
|
|
5
|
+
export declare const CHECKPOINT_FAILED = "The build finished but did not save. Do not tell the user the app was saved, and do not poll again - open the editor via this result's `editUrl` and report that the checkpoint failed.";
|
|
6
|
+
export declare const REPLACE_WEDGED_APP = "This application is wedged and cannot be recovered. Call `start_app` once more with the same prompt and artifacts, and set `replacesApplicationId` to this result's `applicationId`. Do not upload the source again.";
|
|
7
|
+
export declare const SHOW_PLAN_VERBATIM = "Lead with `decision.title` when it is present, then show the entire `decision.plan` markdown, verbatim, laid out as markdown. Do not paraphrase, summarize, shorten, reorder, or re-level its headings - the user is approving exactly this text.";
|
|
8
|
+
export declare function instructUserDecision(result: ToolResult, profile: ClientProfile): string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Instructions shared verbatim by more than one tool. */
|
|
2
|
+
export const BUILDING_FOLLOW_UP = "Call `check_app_progress` with this `applicationId` to follow the turn. Relay each new activity line to the user as it arrives. CRITICAL: Load your embedded browser tools.";
|
|
3
|
+
export const CHECKPOINT_FAILED = "The build finished but did not save. Do not tell the user the app was saved, and do not poll again - open the editor via this result's `editUrl` and report that the checkpoint failed.";
|
|
4
|
+
export const REPLACE_WEDGED_APP = "This application is wedged and cannot be recovered. Call `start_app` once more with the same prompt and artifacts, and set `replacesApplicationId` to this result's `applicationId`. Do not upload the source again.";
|
|
5
|
+
export const SHOW_PLAN_VERBATIM = "Lead with `decision.title` when it is present, then show the entire `decision.plan` markdown, verbatim, laid out as markdown. Do not paraphrase, summarize, shorten, reorder, or re-level its headings - the user is approving exactly this text.";
|
|
6
|
+
export function instructUserDecision(result, profile) {
|
|
7
|
+
if (result.decisionKind === "plan") {
|
|
8
|
+
return profile.hasNativeAskForm
|
|
9
|
+
? `Use your native ask form to put this plan decision to the user. Do not call ask_user. Output the plan markdown as text, not in the native form. ${SHOW_PLAN_VERBATIM} In your native form, present exactly two choices labeled \`Approve\` and \`Refine\`. In \`Refine\`'s description, refer to the form's built-in free-text field only as \`Something else\`. Do not answer the decision yourself and do not call check_app_progress again until they have answered. If the user chooses \`Approve\`, call edit_app with the applicationId from this result and planAction "approve" with no prompt. If the form returns text in its \`response\` field, call edit_app with that applicationId, planAction "refine", and the exact \`response\` as prompt. If the user chooses \`Refine\` without feedback, ask the user for further instructions`
|
|
10
|
+
: "Call ask_user now to put this plan decision to the user. Do not answer it yourself and do not call check_app_progress again until they have answered.";
|
|
11
|
+
}
|
|
12
|
+
if (result.decisionKind === "multi_choice") {
|
|
13
|
+
return profile.hasNativeAskForm
|
|
14
|
+
? "Use your native ask form to put this multi-choice decision to the user. Do not call ask_user. Present the available options and ask the user to choose one. Do not answer the decision yourself and do not call check_app_progress again until they have answered. Send their answer through edit_app, using the chosen option as the prompt. Provide their answer EXACTLY as they provided it to edit_app."
|
|
15
|
+
: "Call ask_user now to put this multi-choice decision to the user. Do not answer it yourself and do not call check_app_progress again until they have answered.";
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/copy.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAK1D,MAAM,CAAC,MAAM,kBAAkB,GAC7B,6KAA6K,CAAC;AAEhL,MAAM,CAAC,MAAM,iBAAiB,GAC5B,yLAAyL,CAAC;AAE5L,MAAM,CAAC,MAAM,kBAAkB,GAC7B,sNAAsN,CAAC;AAEzN,MAAM,CAAC,MAAM,kBAAkB,GAC7B,mPAAmP,CAAC;AAEtP,MAAM,UAAU,oBAAoB,CAClC,MAAkB,EAClB,OAAsB;IAEtB,IAAI,MAAM,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC,gBAAgB;YAC7B,CAAC,CAAC,mJAAmJ,kBAAkB,ipBAAipB;YACxzB,CAAC,CAAC,uJAAuJ,CAAC;IAC9J,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,KAAK,cAAc,EAAE,CAAC;QAC3C,OAAO,OAAO,CAAC,gBAAgB;YAC7B,CAAC,CAAC,6YAA6Y;YAC/Y,CAAC,CAAC,+JAA+J,CAAC;IACtK,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isRecord } from "../result.js";
|
|
2
|
+
export function instructCreateIntegration(result, profile) {
|
|
3
|
+
const url = result.value.integration_url;
|
|
4
|
+
const integrationId = result.value.integration_id;
|
|
5
|
+
if (typeof integrationId !== "string" || !integrationId) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const opening = typeof url === "string" && url
|
|
9
|
+
? profile.hasNativeBrowser
|
|
10
|
+
? `Open the exact returned URL ${url} in Cowork's embedded browser side panel.`
|
|
11
|
+
: "Show `integration_url` to the user and ask them to open it in Superblocks. Do not open it yourself."
|
|
12
|
+
: "Tell the user to open the integration in Superblocks, but do not invent a URL.";
|
|
13
|
+
const wiring = `Call \`edit_app\` with returned integration_id \`${integrationId}\` and tell Superblocks to wire it into every affected API, test those APIs, and remove temporary setup instructions.`;
|
|
14
|
+
if (isPublicIntegration(result)) {
|
|
15
|
+
return `${opening} This result confirms the integration uses public/no-auth access, so do not wait for credential confirmation. ${wiring}`;
|
|
16
|
+
}
|
|
17
|
+
return `${opening} Never ask the user to put passwords, API tokens, or other secrets in chat. Wait for the user to confirm configuration is complete, then ${wiring}`;
|
|
18
|
+
}
|
|
19
|
+
function isPublicIntegration(result) {
|
|
20
|
+
const integration = result.value.integration;
|
|
21
|
+
if (!isRecord(integration) || !Array.isArray(integration.configurations)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return integration.configurations.some((entry) => {
|
|
25
|
+
if (!isRecord(entry) || !isRecord(entry.configuration)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const authType = entry.configuration.authType;
|
|
29
|
+
return typeof authType === "string" && authType.toLowerCase() === "none";
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=create-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-integration.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/create-integration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,cAAc,CAAC;AAEzD,MAAM,UAAU,yBAAyB,CACvC,MAAkB,EAClB,OAAsB;IAEtB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC;IACzC,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;IAClD,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,CAAC,aAAa,EAAE,CAAC;QACxD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GACX,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG;QAC5B,CAAC,CAAC,OAAO,CAAC,gBAAgB;YACxB,CAAC,CAAC,+BAA+B,GAAG,2CAA2C;YAC/E,CAAC,CAAC,qGAAqG;QACzG,CAAC,CAAC,gFAAgF,CAAC;IACvF,MAAM,MAAM,GAAG,oDAAoD,aAAa,uHAAuH,CAAC;IAExM,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,GAAG,OAAO,iHAAiH,MAAM,EAAE,CAAC;IAC7I,CAAC;IACD,OAAO,GAAG,OAAO,4IAA4I,MAAM,EAAE,CAAC;AACxK,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAkB;IAC7C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;IAC7C,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC;QACzE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;QAC/C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC;QAC9C,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BUILDING_FOLLOW_UP, REPLACE_WEDGED_APP } from "./copy.js";
|
|
2
|
+
export function instructEditApp(result) {
|
|
3
|
+
if (result.pendingAction === "start_new_app") {
|
|
4
|
+
return REPLACE_WEDGED_APP;
|
|
5
|
+
}
|
|
6
|
+
if (result.code === "live_edit_unavailable") {
|
|
7
|
+
return "This application's live-edit session is wedged, but it already has committed work - do not start a new application. Report to the user that this application needs manual recovery and stop.";
|
|
8
|
+
}
|
|
9
|
+
if (result.status === "building") {
|
|
10
|
+
return BUILDING_FOLLOW_UP;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=edit-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-app.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/edit-app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,UAAU,eAAe,CAAC,MAAkB;IAChD,IAAI,MAAM,CAAC,aAAa,KAAK,eAAe,EAAE,CAAC;QAC7C,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;QAC5C,OAAO,8LAA8L,CAAC;IACxM,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CHECKPOINT_FAILED, instructUserDecision, REPLACE_WEDGED_APP, } from "./copy.js";
|
|
2
|
+
export function instructGetApp(result, profile) {
|
|
3
|
+
const instructions = resultInstructions(result, profile);
|
|
4
|
+
const navigation = result.value.browserNavigation;
|
|
5
|
+
if (!profile.hasNativeBrowser || !isBrowserNavigation(navigation)) {
|
|
6
|
+
return instructions;
|
|
7
|
+
}
|
|
8
|
+
const browserInstructions = `Before any other action, ensure ${navigation.url} is open in Cowork's embedded Page browser and verify the app loaded.`;
|
|
9
|
+
return instructions
|
|
10
|
+
? `${browserInstructions}\n\n${instructions}`
|
|
11
|
+
: browserInstructions;
|
|
12
|
+
}
|
|
13
|
+
function resultInstructions(result, profile) {
|
|
14
|
+
const screenshot = result.value.screenshotBase64;
|
|
15
|
+
if (result.status === "ready" &&
|
|
16
|
+
typeof screenshot === "string" &&
|
|
17
|
+
screenshot) {
|
|
18
|
+
return "Inspect the screenshot before telling the user the app looks correct. A skeleton, spinner, empty table/chart, or 'Loading...' is not a defect - call `get_app` again in a few seconds. A problem a user would plainly recognize as wrong warrants one `edit_app` call with a concrete correction, then inspect the next screenshot.";
|
|
19
|
+
}
|
|
20
|
+
if (result.pendingAction === "start_new_app") {
|
|
21
|
+
return REPLACE_WEDGED_APP;
|
|
22
|
+
}
|
|
23
|
+
if (result.pendingAction === "open_editor") {
|
|
24
|
+
return CHECKPOINT_FAILED;
|
|
25
|
+
}
|
|
26
|
+
if (result.pendingAction === "decide_in_editor") {
|
|
27
|
+
return "Open the app's `editUrl` so the user can answer in the Superblocks editor. Do not call `ask_user`.";
|
|
28
|
+
}
|
|
29
|
+
const decisionInstructions = instructUserDecision(result, profile);
|
|
30
|
+
if (decisionInstructions) {
|
|
31
|
+
return decisionInstructions;
|
|
32
|
+
}
|
|
33
|
+
if (result.status === "needs_decision") {
|
|
34
|
+
return "Call `ask_user` now - do not answer this decision yourself from `get_app`'s output.";
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
function isBrowserNavigation(value) {
|
|
39
|
+
return (typeof value === "object" &&
|
|
40
|
+
value !== null &&
|
|
41
|
+
"action" in value &&
|
|
42
|
+
value.action === "open_editor" &&
|
|
43
|
+
"url" in value &&
|
|
44
|
+
typeof value.url === "string" &&
|
|
45
|
+
value.url.length > 0);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=get-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-app.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/get-app.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,MAAM,UAAU,cAAc,CAC5B,MAAkB,EAClB,OAAsB;IAEtB,MAAM,YAAY,GAAG,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAClD,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClE,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,MAAM,mBAAmB,GAAG,mCAAmC,UAAU,CAAC,GAAG,uEAAuE,CAAC;IACrJ,OAAO,YAAY;QACjB,CAAC,CAAC,GAAG,mBAAmB,OAAO,YAAY,EAAE;QAC7C,CAAC,CAAC,mBAAmB,CAAC;AAC1B,CAAC;AAED,SAAS,kBAAkB,CACzB,MAAkB,EAClB,OAAsB;IAEtB,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC;IACjD,IACE,MAAM,CAAC,MAAM,KAAK,OAAO;QACzB,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,EACV,CAAC;QACD,OAAO,qUAAqU,CAAC;IAC/U,CAAC;IACD,IAAI,MAAM,CAAC,aAAa,KAAK,eAAe,EAAE,CAAC;QAC7C,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,IAAI,MAAM,CAAC,aAAa,KAAK,aAAa,EAAE,CAAC;QAC3C,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,IAAI,MAAM,CAAC,aAAa,KAAK,kBAAkB,EAAE,CAAC;QAChD,OAAO,oGAAoG,CAAC;IAC9G,CAAC;IACD,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnE,IAAI,oBAAoB,EAAE,CAAC;QACzB,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,gBAAgB,EAAE,CAAC;QACvC,OAAO,qFAAqF,CAAC;IAC/F,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,mBAAmB,CAC1B,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,QAAQ,IAAI,KAAK;QACjB,KAAK,CAAC,MAAM,KAAK,aAAa;QAC9B,KAAK,IAAI,KAAK;QACd,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;QAC7B,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function instructGetIntegrationMetadata(result) {
|
|
2
|
+
if (result.code === "integration_not_supported") {
|
|
3
|
+
return "This integration's plugin type can't be introspected by this tool. Ask the user directly what data it exposes, or proceed without inspecting schema.";
|
|
4
|
+
}
|
|
5
|
+
const entries = result.value.entries;
|
|
6
|
+
if (result.value.totalCount === 0 &&
|
|
7
|
+
Array.isArray(entries) &&
|
|
8
|
+
entries.length === 0) {
|
|
9
|
+
return "No columns/tables matched that search term. Retry with a narrower or different `search`, or omit it to see everything, before concluding the integration has no usable data.";
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=get-integration-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-integration-metadata.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/get-integration-metadata.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,8BAA8B,CAC5C,MAAkB;IAElB,IAAI,MAAM,CAAC,IAAI,KAAK,2BAA2B,EAAE,CAAC;QAChD,OAAO,sJAAsJ,CAAC;IAChK,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;IACrC,IACE,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC;QAC7B,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACtB,OAAO,CAAC,MAAM,KAAK,CAAC,EACpB,CAAC;QACD,OAAO,8KAA8K,CAAC;IACxL,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClientProfile } from "../../client-presentation.js";
|
|
2
|
+
import type { ToolName } from "../../tool-names.js";
|
|
3
|
+
import type { ToolResult } from "../result.js";
|
|
4
|
+
/** One tool's whole rule set: its result in, the agent's next step out. */
|
|
5
|
+
export type Instruct = (result: ToolResult, profile: ClientProfile) => string | undefined;
|
|
6
|
+
/** Tools absent from this table send no instructions. */
|
|
7
|
+
export declare const INSTRUCTIONS: Partial<Record<ToolName, Instruct>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { instructAskUser } from "./ask-user.js";
|
|
2
|
+
import { instructCheckAppProgress } from "./check-app-progress.js";
|
|
3
|
+
import { instructCheckPublishProgress } from "./check-publish-progress.js";
|
|
4
|
+
import { instructCreateIntegration } from "./create-integration.js";
|
|
5
|
+
import { instructEditApp } from "./edit-app.js";
|
|
6
|
+
import { instructGetApp } from "./get-app.js";
|
|
7
|
+
import { instructGetIntegrationMetadata } from "./get-integration-metadata.js";
|
|
8
|
+
import { instructPreviewApp } from "./preview-app.js";
|
|
9
|
+
import { instructPublishApp } from "./publish-app.js";
|
|
10
|
+
import { instructStartApp } from "./start-app.js";
|
|
11
|
+
import { instructUploadArtifact } from "./upload-artifact.js";
|
|
12
|
+
/** Tools absent from this table send no instructions. */
|
|
13
|
+
export const INSTRUCTIONS = {
|
|
14
|
+
ask_user: instructAskUser,
|
|
15
|
+
check_app_progress: instructCheckAppProgress,
|
|
16
|
+
check_publish_progress: instructCheckPublishProgress,
|
|
17
|
+
create_integration: instructCreateIntegration,
|
|
18
|
+
edit_app: instructEditApp,
|
|
19
|
+
get_app: instructGetApp,
|
|
20
|
+
get_integration_metadata: instructGetIntegrationMetadata,
|
|
21
|
+
preview_app: instructPreviewApp,
|
|
22
|
+
publish_app: instructPublishApp,
|
|
23
|
+
start_app: instructStartApp,
|
|
24
|
+
upload_artifact: instructUploadArtifact,
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAQ9D,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAwC;IAC/D,QAAQ,EAAE,eAAe;IACzB,kBAAkB,EAAE,wBAAwB;IAC5C,sBAAsB,EAAE,4BAA4B;IACpD,kBAAkB,EAAE,yBAAyB;IAC7C,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,cAAc;IACvB,wBAAwB,EAAE,8BAA8B;IACxD,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,kBAAkB;IAC/B,SAAS,EAAE,gBAAgB;IAC3B,eAAe,EAAE,sBAAsB;CACxC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function instructPreviewApp(result, profile) {
|
|
2
|
+
const { previewUrl } = result.value;
|
|
3
|
+
if (profile.hasNativeBrowser &&
|
|
4
|
+
result.status === "ready" &&
|
|
5
|
+
typeof previewUrl === "string" &&
|
|
6
|
+
previewUrl) {
|
|
7
|
+
return `Before any other action, ensure ${previewUrl} is open in Cowork's embedded Page browser and verify the preview loaded.`;
|
|
8
|
+
}
|
|
9
|
+
if (result.status === "ready" && result.value.needsBrowserDriver === true) {
|
|
10
|
+
return "No local browser is available to screenshot this preview. Share `previewUrl` directly and skip the screenshot rather than reporting a failure.";
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=preview-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-app.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/preview-app.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,kBAAkB,CAChC,MAAkB,EAClB,OAAsB;IAEtB,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IACpC,IACE,OAAO,CAAC,gBAAgB;QACxB,MAAM,CAAC,MAAM,KAAK,OAAO;QACzB,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,EACV,CAAC;QACD,OAAO,mCAAmC,UAAU,2EAA2E,CAAC;IAClI,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,kBAAkB,KAAK,IAAI,EAAE,CAAC;QAC1E,OAAO,gJAAgJ,CAAC;IAC1J,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function instructPublishApp(result) {
|
|
2
|
+
// `publishing` rather than `deployed` reads as a half-failure to the caller.
|
|
3
|
+
if (result.status === "publishing") {
|
|
4
|
+
return "Superblocks has started the publish. Tell the user the publish is rolling out, then call `check_publish_progress` until status is `deployed`. Do not call `publish_app` again.";
|
|
5
|
+
}
|
|
6
|
+
if (result.code === "publish_needs_acknowledgement") {
|
|
7
|
+
return "A policy gate requires explicit acknowledgement before this can roll out. Tell the user what the gate flagged and ask whether to proceed, rather than retrying automatically.";
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=publish-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-app.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/publish-app.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,MAAkB;IACnD,6EAA6E;IAC7E,IAAI,MAAM,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;QACnC,OAAO,gLAAgL,CAAC;IAC1L,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,+BAA+B,EAAE,CAAC;QACpD,OAAO,+KAA+K,CAAC;IACzL,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BUILDING_FOLLOW_UP, REPLACE_WEDGED_APP } from "./copy.js";
|
|
2
|
+
export function instructStartApp(result) {
|
|
3
|
+
if (result.pendingAction === "start_new_app") {
|
|
4
|
+
return REPLACE_WEDGED_APP;
|
|
5
|
+
}
|
|
6
|
+
if (result.code === "replacement_not_allowed") {
|
|
7
|
+
return "`replacesApplicationId` can only be used once, immediately after a `start_new_app` pendingAction. Call `check_app_progress` on the original application instead of retrying start_app.";
|
|
8
|
+
}
|
|
9
|
+
// No `start_new_app` to recover with: this call was already the replacement.
|
|
10
|
+
if (result.code === "live_edit_unavailable") {
|
|
11
|
+
return "Superblocks could not start the replacement application's live-edit session. One fresh application has already been tried, so do not create another application or retry this build. Stop and report that Superblocks' live-edit service needs recovery.";
|
|
12
|
+
}
|
|
13
|
+
if (result.status === "building") {
|
|
14
|
+
return BUILDING_FOLLOW_UP;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=start-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-app.js","sourceRoot":"","sources":["../../../../../src/transports/mcp/instructions/tools/start-app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,IAAI,MAAM,CAAC,aAAa,KAAK,eAAe,EAAE,CAAC;QAC7C,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,yBAAyB,EAAE,CAAC;QAC9C,OAAO,wLAAwL,CAAC;IAClM,CAAC;IACD,6EAA6E;IAC7E,IAAI,MAAM,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;QAC5C,OAAO,0PAA0P,CAAC;IACpQ,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|