@marimo-team/islands 0.22.1-dev44 → 0.22.1-dev49

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
@@ -65540,7 +65540,7 @@ ${c}
65540
65540
  return Logger.warn("Failed to get version from mount config"), null;
65541
65541
  }
65542
65542
  }
65543
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.1-dev44"), showCodeInRunModeAtom = atom(true);
65543
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.1-dev49"), showCodeInRunModeAtom = atom(true);
65544
65544
  atom(null);
65545
65545
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
65546
65546
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.22.1-dev44",
3
+ "version": "0.22.1-dev49",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -1,8 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- import { useAtomValue } from "jotai";
4
3
  import { CheckIcon, CopyIcon } from "lucide-react";
5
- import React, { useState } from "react";
4
+ import React, { useEffect, useState } from "react";
6
5
  import { Button } from "@/components/ui/button";
7
6
  import {
8
7
  DialogContent,
@@ -12,25 +11,25 @@ import {
12
11
  DialogTitle,
13
12
  } from "@/components/ui/dialog";
14
13
  import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
15
- import { runtimeConfigAtom } from "@/core/runtime/config";
16
14
  import { copyToClipboard } from "@/utils/copy";
17
15
  import { Events } from "@/utils/events";
18
16
  import { Tooltip } from "@/components/ui/tooltip";
19
- import type { RuntimeConfig } from "@/core/runtime/types";
17
+ import { assertNever } from "@/utils/assertNever";
18
+ import { asRemoteURL, useRuntimeManager } from "@/core/runtime/config";
20
19
 
21
20
  type AgentTab = "claude" | "codex" | "opencode";
22
21
 
23
- function buildRemoteUrl(config: RuntimeConfig) {
24
- const url = new URL(config.url);
25
- if (config.authToken) {
26
- url.searchParams.set("auth", config.authToken);
27
- }
28
- return url.toString();
22
+ function getMarimoCommand(): string {
23
+ return import.meta.env.DEV ? "uv run marimo" : "uvx marimo@latest";
29
24
  }
30
25
 
31
- function getPromptCommand(agent: AgentTab, remoteUrl: string): string {
32
- const command = import.meta.env.DEV ? "uv run marimo" : "uvx marimo@latest";
33
- const base = `${command} pair prompt --url '${remoteUrl}'`;
26
+ function getPromptCommand(
27
+ agent: AgentTab,
28
+ url: string,
29
+ withToken: boolean,
30
+ ): string {
31
+ const tokenFlag = withToken ? " --with-token" : "";
32
+ const base = `${getMarimoCommand()} pair prompt --url '${url}'${tokenFlag}`;
34
33
  switch (agent) {
35
34
  case "claude":
36
35
  return `claude "$(${base} --claude)"`;
@@ -38,18 +37,42 @@ function getPromptCommand(agent: AgentTab, remoteUrl: string): string {
38
37
  return `codex "$(${base} --codex)"`;
39
38
  case "opencode":
40
39
  return `opencode "$(${base} --opencode)"`;
40
+ default:
41
+ assertNever(agent);
42
+ }
43
+ }
44
+
45
+ function maskToken(token: string): string {
46
+ if (token.length <= 4) {
47
+ return "****";
41
48
  }
49
+ return `${"*".repeat(Math.min(token.length - 4, 8))}${token.slice(-4)}`;
42
50
  }
43
51
 
44
52
  const SKILL_INSTALL = "npx skills add marimo-team/marimo-pair";
45
53
 
54
+ function useAuthToken(): string | null {
55
+ const [token, setToken] = useState<string | null>(null);
56
+ useEffect(() => {
57
+ fetch(asRemoteURL("/auth/token").href, { credentials: "include" })
58
+ .then((res) =>
59
+ res.ok ? (res.json() as Promise<{ token: string | null }>) : null,
60
+ )
61
+ .then((data) => setToken(data?.token ?? null))
62
+ .catch(() => setToken(null));
63
+ }, []);
64
+ return token;
65
+ }
66
+
46
67
  export const PairWithAgentModal: React.FC<{
47
68
  onClose: () => void;
48
69
  }> = ({ onClose }) => {
49
70
  const [activeTab, setActiveTab] = useState<AgentTab>("claude");
50
- const runtimeConfig = useAtomValue(runtimeConfigAtom);
51
- const remoteUrl = buildRemoteUrl(runtimeConfig);
52
- const promptCommand = getPromptCommand(activeTab, remoteUrl);
71
+ const runtimeManager = useRuntimeManager();
72
+ const authToken = useAuthToken();
73
+ const hasToken = Boolean(authToken);
74
+ const remoteUrl = runtimeManager.httpURL.toString();
75
+ const promptCommand = getPromptCommand(activeTab, remoteUrl, hasToken);
53
76
 
54
77
  return (
55
78
  <DialogContent className="sm:max-w-lg">
@@ -104,6 +127,15 @@ export const PairWithAgentModal: React.FC<{
104
127
  </TabsContent>
105
128
  </Tabs>
106
129
  </div>
130
+
131
+ {hasToken && authToken && (
132
+ <div className="flex flex-col gap-2">
133
+ <span className="text-sm font-medium">
134
+ 3. Paste when prompted for token
135
+ </span>
136
+ <CommandBlock command={authToken} display={maskToken(authToken)} />
137
+ </div>
138
+ )}
107
139
  </div>
108
140
 
109
141
  <DialogFooter>
@@ -115,7 +147,10 @@ export const PairWithAgentModal: React.FC<{
115
147
  );
116
148
  };
117
149
 
118
- const CommandBlock: React.FC<{ command: string }> = ({ command }) => {
150
+ const CommandBlock: React.FC<{ command: string; display?: string }> = ({
151
+ command,
152
+ display,
153
+ }) => {
119
154
  const [copied, setCopied] = useState(false);
120
155
 
121
156
  const copy = Events.stopPropagation(async (e) => {
@@ -127,7 +162,9 @@ const CommandBlock: React.FC<{ command: string }> = ({ command }) => {
127
162
 
128
163
  return (
129
164
  <div className="flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs">
130
- <code className="flex-1 select-all break-words">{command}</code>
165
+ <code className="flex-1 select-all break-words">
166
+ {display ?? command}
167
+ </code>
131
168
  <Tooltip content="Copied!" open={copied}>
132
169
  <Button onClick={copy} size="xs" variant="ghost">
133
170
  {copied ? (