@marimo-team/islands 0.19.8-dev10 → 0.19.8-dev11
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/dist/main.js
CHANGED
|
@@ -73178,7 +73178,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
|
|
|
73178
73178
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
73179
73179
|
}
|
|
73180
73180
|
}
|
|
73181
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.8-
|
|
73181
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.8-dev11"), showCodeInRunModeAtom = atom(true);
|
|
73182
73182
|
atom(null);
|
|
73183
73183
|
var import_compiler_runtime$88 = require_compiler_runtime();
|
|
73184
73184
|
function useKeydownOnElement(e, r) {
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type ExternalAgentId,
|
|
10
10
|
getAgentConnectionCommand,
|
|
11
11
|
getAgentDisplayName,
|
|
12
|
+
getAgentWebSocketUrl,
|
|
12
13
|
getSessionsByAgent,
|
|
13
14
|
removeSession,
|
|
14
15
|
type TabId,
|
|
@@ -697,4 +698,72 @@ describe("state utility functions", () => {
|
|
|
697
698
|
`);
|
|
698
699
|
});
|
|
699
700
|
});
|
|
701
|
+
|
|
702
|
+
describe("getAgentWebSocketUrl", () => {
|
|
703
|
+
const originalLocation = window.location;
|
|
704
|
+
|
|
705
|
+
afterEach(() => {
|
|
706
|
+
// Restore original window.location
|
|
707
|
+
Object.defineProperty(window, "location", {
|
|
708
|
+
value: originalLocation,
|
|
709
|
+
writable: true,
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
it("should return ws:// URL with localhost for http protocol", () => {
|
|
714
|
+
Object.defineProperty(window, "location", {
|
|
715
|
+
value: {
|
|
716
|
+
hostname: "localhost",
|
|
717
|
+
protocol: "http:",
|
|
718
|
+
},
|
|
719
|
+
writable: true,
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
expect(getAgentWebSocketUrl("claude")).toMatchInlineSnapshot(
|
|
723
|
+
`"ws://localhost:3017/message"`,
|
|
724
|
+
);
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
it("should return wss:// URL for https protocol", () => {
|
|
728
|
+
Object.defineProperty(window, "location", {
|
|
729
|
+
value: {
|
|
730
|
+
hostname: "example.com",
|
|
731
|
+
protocol: "https:",
|
|
732
|
+
},
|
|
733
|
+
writable: true,
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
expect(getAgentWebSocketUrl("claude")).toMatchInlineSnapshot(
|
|
737
|
+
`"wss://example.com:3017/message"`,
|
|
738
|
+
);
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
it("should work with IP addresses", () => {
|
|
742
|
+
Object.defineProperty(window, "location", {
|
|
743
|
+
value: {
|
|
744
|
+
hostname: "192.168.1.100",
|
|
745
|
+
protocol: "http:",
|
|
746
|
+
},
|
|
747
|
+
writable: true,
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
expect(getAgentWebSocketUrl("claude")).toMatchInlineSnapshot(
|
|
751
|
+
`"ws://192.168.1.100:3017/message"`,
|
|
752
|
+
);
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
it("should work with remote hostnames", () => {
|
|
756
|
+
Object.defineProperty(window, "location", {
|
|
757
|
+
value: {
|
|
758
|
+
hostname: "marimo.example.com",
|
|
759
|
+
protocol: "https:",
|
|
760
|
+
},
|
|
761
|
+
writable: true,
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
expect(getAgentWebSocketUrl("gemini")).toMatchInlineSnapshot(
|
|
765
|
+
`"wss://marimo.example.com:3019/message"`,
|
|
766
|
+
);
|
|
767
|
+
});
|
|
768
|
+
});
|
|
700
769
|
});
|
|
@@ -233,13 +233,17 @@ export function getAgentDisplayName(agentId: ExternalAgentId): string {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
export function getAgentWebSocketUrl(agentId: ExternalAgentId): string {
|
|
236
|
-
|
|
236
|
+
const port = AGENT_CONFIG[agentId].port;
|
|
237
|
+
// Use the current page's hostname so the agent is reachable when
|
|
238
|
+
// marimo is accessed remotely (e.g. via direct IP or reverse proxy).
|
|
239
|
+
const hostname = window.location.hostname;
|
|
240
|
+
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
241
|
+
return `${protocol}//${hostname}:${port}/message` as const;
|
|
237
242
|
}
|
|
238
243
|
|
|
239
244
|
interface AgentConfig {
|
|
240
245
|
port: number;
|
|
241
246
|
command: string;
|
|
242
|
-
webSocketUrl: string;
|
|
243
247
|
sessionSupport: SessionSupportType;
|
|
244
248
|
}
|
|
245
249
|
|
|
@@ -247,25 +251,21 @@ const AGENT_CONFIG: Record<ExternalAgentId, AgentConfig> = {
|
|
|
247
251
|
claude: {
|
|
248
252
|
port: 3017,
|
|
249
253
|
command: "npx @zed-industries/claude-code-acp",
|
|
250
|
-
webSocketUrl: "ws://localhost:3017/message",
|
|
251
254
|
sessionSupport: "single",
|
|
252
255
|
},
|
|
253
256
|
gemini: {
|
|
254
257
|
port: 3019,
|
|
255
258
|
command: "npx @google/gemini-cli --experimental-acp",
|
|
256
|
-
webSocketUrl: "ws://localhost:3019/message",
|
|
257
259
|
sessionSupport: "single",
|
|
258
260
|
},
|
|
259
261
|
codex: {
|
|
260
262
|
port: 3021,
|
|
261
263
|
command: "npx @zed-industries/codex-acp",
|
|
262
|
-
webSocketUrl: "ws://localhost:3021/message",
|
|
263
264
|
sessionSupport: "single",
|
|
264
265
|
},
|
|
265
266
|
opencode: {
|
|
266
267
|
port: 3023,
|
|
267
268
|
command: "npx opencode-ai acp",
|
|
268
|
-
webSocketUrl: "ws://localhost:3023/message",
|
|
269
269
|
sessionSupport: "single",
|
|
270
270
|
},
|
|
271
271
|
};
|