Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/extension/src/chat_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ export class ChatPanel {
* serverAuthToken(). The app adopts it for its authenticated-fetch path and
* strips it from the URL (entry-level history.replaceState). One value per
* activation, so revealing an existing panel never needs a re-render. */
/** amicode#200 AC6: deep-link the framed app into the defaults capsule's
* Company Compute connect flow. Posted twice (now + 1.5s) because a freshly
* created panel's iframe may not be listening yet; the app side treats the
* request as idempotent within its freshness window. */
postComputeConnect(): void {
const envelope = { source: "amicode", kind: "open-compute-connect" };
void this.panel.webview.postMessage(envelope);
setTimeout(() => void this.panel.webview.postMessage(envelope), 1500);
}

static openOrReveal(ctx: vscode.ExtensionContext, opencodeUrl: URL, authToken?: string): ChatPanel {
if (ChatPanel.current) {
ChatPanel.current.panel.reveal(vscode.ViewColumn.One);
Expand Down Expand Up @@ -286,7 +296,7 @@ export class ChatPanel {
// Lane 2 — extension → iframe (theme): posted by the extension host
// (webview-internal origin, never the opencode origin). Forward only
// our own theme envelope, pinned to the opencode origin.
if (d && d.source === "amicode" && (d.kind === "theme" || d.kind === "clipboard")) {
if (d && d.source === "amicode" && (d.kind === "theme" || d.kind === "clipboard" || d.kind === "open-compute-connect")) {
var f = document.querySelector("iframe");
if (f && f.contentWindow) f.contentWindow.postMessage(d, ${origin});
}
Expand Down
15 changes: 14 additions & 1 deletion packages/extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,20 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
: undefined,
log: (line) => opencodeChannel.appendLine(line),
});
ctx.subscriptions.push(vscode.commands.registerCommand("amicode.setCloudKey", () => void runSetCloudKey()));
// amicode#200 AC6: the solver toggle owns the connect flow — the palette
// command deep-links the chat's defaults capsule into it, so command, panel,
// and agent copy converge on ONE ui flow. The legacy input-box prompt stays
// only as the fallback when no ready server exists to host the panel.
ctx.subscriptions.push(
vscode.commands.registerCommand("amicode.setCloudKey", () => {
const readyUrl = opencodeReadyUrl;
if (readyUrl) {
ChatPanel.openOrReveal(ctx, readyUrl, serverAuthToken(serverPassword)).postComputeConnect();
return;
}
void runSetCloudKey();
}),
);

// 5. Commands
ctx.subscriptions.push(
Expand Down
6 changes: 4 additions & 2 deletions packages/extension/src/opencode_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,10 @@ function solverModeSection(): string {
: "The cloud is NOT connected (no API key). High-Performance + Cloud is a PAID cloud tier and CANNOT " +
"run locally — do NOT attempt a local Piccolissimo solve (it will fail: the private package can't be " +
"instantiated in a sandbox, and the gate rejects a local hpc run). Instead, STOP and tell the user: " +
'"High-Performance + Cloud needs a cloud connection — run **Amico: Connect Cloud** to enter your API ' +
"key.\" Offer to switch back to the free local Piccolo solver if they'd rather not connect now.";
'"High-Performance + Cloud needs a cloud connection — click **Piccolissimo + Altissimo** in the ' +
"model · solver control on the dashboard and connect there (or run **Amico: Connect Cloud**, which " +
'opens the same flow)." Offer to switch back to the free local Piccolo solver if they\'d rather not ' +
"connect now.";
return (
"\n\n## Solver mode\n" +
"**HIGH-PERFORMANCE + CLOUD (Piccolissimo + Altissimo).** The user selected the paid " +
Expand Down
Loading