@marimo-team/islands 0.23.16-dev31 → 0.23.16-dev34
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/{common-DF6Pmj89.js → common-CZKqr-N4.js} +1 -1
- package/dist/main.js +2 -2
- package/dist/{reveal-component-Cjz1dhi5.js → reveal-component-CJHfXZXF.js} +1 -1
- package/package.json +1 -1
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +99 -18
- package/src/components/editor/actions/pair-with-agent-commands.ts +21 -10
- package/src/components/editor/actions/pair-with-agent-modal.tsx +2 -2
|
@@ -36344,7 +36344,7 @@ ${d}`,
|
|
|
36344
36344
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
36345
36345
|
}
|
|
36346
36346
|
}
|
|
36347
|
-
marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.16-
|
|
36347
|
+
marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.16-dev34");
|
|
36348
36348
|
showCodeInRunModeAtom = atom(true);
|
|
36349
36349
|
atom(null);
|
|
36350
36350
|
var import_compiler_runtime = require_compiler_runtime();
|
package/dist/main.js
CHANGED
|
@@ -26,7 +26,7 @@ import { $ as notebookOutline, A as ChevronDownIcon, Bn as Eye, Bt as DATA_TYPE_
|
|
|
26
26
|
import { __tla as __tla_1 } from "./chunk-5FQGJX7Z-B9WoXK1R.js";
|
|
27
27
|
import { o as useSize, s as Root$1, u as createLucideIcon } from "./dist-DIlxLFXG.js";
|
|
28
28
|
import { A as SquareFunction, C as DEFAULT_COLOR_SCHEME, D as SCALE_TYPE_DESCRIPTIONS, E as EMPTY_VALUE$1, O as TIME_UNIT_DESCRIPTIONS, S as DEFAULT_AGGREGATION, T as DEFAULT_TIME_UNIT, _ as AGGREGATION_TYPE_DESCRIPTIONS, a as AGGREGATION_FNS$1, b as COLOR_SCHEMES, c as COLOR_BY_FIELDS, d as NONE_VALUE, f as SELECTABLE_DATA_TYPES, g as TIME_UNITS, h as STRING_AGGREGATION_FNS, i as convertDataTypeToSelectable, j as ChartColumn, k as escapeFieldName, l as COMBINED_TIME_UNITS, m as SORT_TYPES, n as createSpecWithoutData, o as BIN_AGGREGATION, p as SINGLE_TIME_UNITS, r as isFieldSet, s as CHART_TYPES, t as augmentSpecWithData, u as ChartType, v as AGGREGATION_TYPE_ICON, w as DEFAULT_MAX_BINS_FACET, x as COUNT_FIELD, y as CHART_TYPE_ICON } from "./spec-CQKL_D3i.js";
|
|
29
|
-
import { $ as CommandSeparator, $t as Kbd, A as ErrorState, At as getPageIndexForRow, B as ContextMenuTrigger, Bt as dateToLocalISODate, C as downloadHTMLAsImage, Ct as inferFieldTypes, D as ColumnName, Dt as DelayMount, E as downloadSizeLimitAtom, Et as ColumnChartSpecModel, F as getUserColumnVisibilityCounts, Ft as TOO_MANY_ROWS, G as DateRangePicker, Gt as TabsList, H as useSelectList, Ht as dateToLocalISOTime, I as ContextMenu, It as toFieldTypes, J as Command, Jt as ChartInfoState, K as Combobox, Kt as TabsTrigger, L as ContextMenuContent, Lt as getMimeValues, M as prettifyRowColumnCount, Mt as loadTableData, N as prettifyRowCount, Nt as INDEX_COLUMN_NAME, O as ColumnPreviewContainer, Ot as useIntersectionObserver, P as getColumnCountForDisplay, Pt as SELECT_COLUMN_ID, Q as CommandList, Qt as RenderTextWithLinks, R as ContextMenuItem, Rt as isNullishFilter, S as downloadExportedFile, St as generateColumns, T as Filenames, Tt as ColumnChartContext, U as CompactChipRow, Ut as Tabs, V as useInternalStateWithSync, Vt as dateToLocalISODateTime, W as DatePicker, Wt as TabsContent, X as CommandInput, Xt as LazyVegaEmbed, Y as CommandEmpty, Yt as ChartLoadingState, Z as CommandItem, Zt as useOverflowDetection, _ as DataTable, _n as ChevronsLeft, _t as TableCell, an as $fae977aafc393c5c$export$588937bcd60ade55, at as contextAwarePanelType, b as downloadBlob, bn as ArrowDownWideNarrow, bt as TableRow, c as SLIDE_TYPE_OPTIONS_BY_VALUE, cn as GripHorizontal, ct as slotsController, d as Switch, en as HtmlOutput, et as smartMatch, f as RadioGroup, fn as Ellipsis, g as OutputRenderer, gn as ChevronsRight, gt as TableBody, h as OutputArea, hn as ChevronsUpDown, ht as Table, i as showCodeInRunModeAtom, in as isRecord, it as contextAwarePanelOwner, j as LoadingState, jt as loadTableAndRawData, k as EmptyState, kt as usePrevious$1, ln as Funnel, lt as Toggle, m as JsonOutput, mn as Code, mt as Provider$1, n as useNotebookCodeAvailable, nn as safeLocale, nt as PANEL_TYPES, on as $fae977aafc393c5c$export$6b862160d295c8e, ot as isCellAwareAtom, p as RadioGroupItem, pn as Download, pt as Fill, q as ComboboxItem, qt as ChartErrorState, r as marimoVersionAtom, rn as hasFunctionProperty, rt as contextAwarePanelOpen, sn as TextWrap, st as SlotNames, t as cellDomProps, tn as EmotionCacheProvider, tt as ContextAwarePanelItem, u as Slide, un as EyeOff, v as InstallPackageButton, vn as ChevronsDownUp, vt as TableHead, w as Progress, wt as renderCellValue, x as downloadByURL, xt as NAMELESS_COLUMN_PREFIX, y as ADD_PRINTING_CLASS, yn as ChevronLeft, yt as TableHeader, z as ContextMenuSeparator, zt as Maps, __tla as __tla_2 } from "./common-
|
|
29
|
+
import { $ as CommandSeparator, $t as Kbd, A as ErrorState, At as getPageIndexForRow, B as ContextMenuTrigger, Bt as dateToLocalISODate, C as downloadHTMLAsImage, Ct as inferFieldTypes, D as ColumnName, Dt as DelayMount, E as downloadSizeLimitAtom, Et as ColumnChartSpecModel, F as getUserColumnVisibilityCounts, Ft as TOO_MANY_ROWS, G as DateRangePicker, Gt as TabsList, H as useSelectList, Ht as dateToLocalISOTime, I as ContextMenu, It as toFieldTypes, J as Command, Jt as ChartInfoState, K as Combobox, Kt as TabsTrigger, L as ContextMenuContent, Lt as getMimeValues, M as prettifyRowColumnCount, Mt as loadTableData, N as prettifyRowCount, Nt as INDEX_COLUMN_NAME, O as ColumnPreviewContainer, Ot as useIntersectionObserver, P as getColumnCountForDisplay, Pt as SELECT_COLUMN_ID, Q as CommandList, Qt as RenderTextWithLinks, R as ContextMenuItem, Rt as isNullishFilter, S as downloadExportedFile, St as generateColumns, T as Filenames, Tt as ColumnChartContext, U as CompactChipRow, Ut as Tabs, V as useInternalStateWithSync, Vt as dateToLocalISODateTime, W as DatePicker, Wt as TabsContent, X as CommandInput, Xt as LazyVegaEmbed, Y as CommandEmpty, Yt as ChartLoadingState, Z as CommandItem, Zt as useOverflowDetection, _ as DataTable, _n as ChevronsLeft, _t as TableCell, an as $fae977aafc393c5c$export$588937bcd60ade55, at as contextAwarePanelType, b as downloadBlob, bn as ArrowDownWideNarrow, bt as TableRow, c as SLIDE_TYPE_OPTIONS_BY_VALUE, cn as GripHorizontal, ct as slotsController, d as Switch, en as HtmlOutput, et as smartMatch, f as RadioGroup, fn as Ellipsis, g as OutputRenderer, gn as ChevronsRight, gt as TableBody, h as OutputArea, hn as ChevronsUpDown, ht as Table, i as showCodeInRunModeAtom, in as isRecord, it as contextAwarePanelOwner, j as LoadingState, jt as loadTableAndRawData, k as EmptyState, kt as usePrevious$1, ln as Funnel, lt as Toggle, m as JsonOutput, mn as Code, mt as Provider$1, n as useNotebookCodeAvailable, nn as safeLocale, nt as PANEL_TYPES, on as $fae977aafc393c5c$export$6b862160d295c8e, ot as isCellAwareAtom, p as RadioGroupItem, pn as Download, pt as Fill, q as ComboboxItem, qt as ChartErrorState, r as marimoVersionAtom, rn as hasFunctionProperty, rt as contextAwarePanelOpen, sn as TextWrap, st as SlotNames, t as cellDomProps, tn as EmotionCacheProvider, tt as ContextAwarePanelItem, u as Slide, un as EyeOff, v as InstallPackageButton, vn as ChevronsDownUp, vt as TableHead, w as Progress, wt as renderCellValue, x as downloadByURL, xt as NAMELESS_COLUMN_PREFIX, y as ADD_PRINTING_CLASS, yn as ChevronLeft, yt as TableHeader, z as ContextMenuSeparator, zt as Maps, __tla as __tla_2 } from "./common-CZKqr-N4.js";
|
|
30
30
|
import { c as Calendar, i as createReducerAndAtoms, n as useOnUnmount, o as ToggleLeft, t as useOnMount } from "./useLifecycle-CMJGqBaY.js";
|
|
31
31
|
import { t as Check } from "./check-DP7U0H0G.js";
|
|
32
32
|
import { A as Icon, C as logNever, D as $18f2051aff69b9bf$export$a54013f0d02a8f82, E as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7, F as createCollection, I as X, M as clamp$2, N as usePrevious$2, P as useDirection, R as ChevronDown, S as assertNever, a as SelectGroup, c as SelectSeparator, d as NativeSelect, i as SelectContent, j as Trigger$1, l as SelectTrigger, n as capitalize, o as SelectItem, r as Select, s as SelectLabel, t as Strings, u as SelectValue, w as $a916eb452884faea$export$b7a616150fdb9f44 } from "./strings-DIy9NAmg.js";
|
|
@@ -38147,7 +38147,7 @@ ${c}
|
|
|
38147
38147
|
function _temp2$2(e) {
|
|
38148
38148
|
e.target === e.currentTarget && e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), e.currentTarget.click());
|
|
38149
38149
|
}
|
|
38150
|
-
var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-
|
|
38150
|
+
var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-CJHfXZXF.js"));
|
|
38151
38151
|
const SlidesLayoutRenderer = ({ layout: e, setLayout: r, cells: c, mode: l }) => {
|
|
38152
38152
|
var _a5;
|
|
38153
38153
|
let u = useAtomValue(kioskModeAtom), d = l === "read" || u, f = useAtomValue(numColumnsAtom) > 1, [p, m] = (0, import_react.useState)(null), { slideCells: h, skippedIds: g, noOutputIds: _, slideTypes: v, startCellIndex: y } = (0, import_react.useMemo)(() => computeSlideCellsInfo(c, e), [
|
|
@@ -9,7 +9,7 @@ import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
|
|
|
9
9
|
import { ut as outputIsStale } from "./html-to-image-Bza3T2dl.js";
|
|
10
10
|
import "./chunk-5FQGJX7Z-B9WoXK1R.js";
|
|
11
11
|
import { u as createLucideIcon } from "./dist-DIlxLFXG.js";
|
|
12
|
-
import { a as DEFAULT_DECK_TRANSITION, dn as Expand, dt as PanelGroup, ft as PanelResizeHandle, l as SlideSidebar, mn as Code, n as useNotebookCodeAvailable, o as DEFAULT_DECK_VERTICAL_ALIGN, s as DEFAULT_SLIDE_TYPE, t as cellDomProps, u as Slide, un as EyeOff, ut as Panel } from "./common-
|
|
12
|
+
import { a as DEFAULT_DECK_TRANSITION, dn as Expand, dt as PanelGroup, ft as PanelResizeHandle, l as SlideSidebar, mn as Code, n as useNotebookCodeAvailable, o as DEFAULT_DECK_VERTICAL_ALIGN, s as DEFAULT_SLIDE_TYPE, t as cellDomProps, u as Slide, un as EyeOff, ut as Panel } from "./common-CZKqr-N4.js";
|
|
13
13
|
import { R as ChevronDown } from "./strings-DIy9NAmg.js";
|
|
14
14
|
import { X as useDebouncedCallback } from "./input-C5K4VBvB.js";
|
|
15
15
|
import { v as kioskModeAtom } from "./toDate-CqhBWjvO.js";
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
4
|
import {
|
|
5
5
|
type ConnectionInfo,
|
|
6
|
+
getFileFromURL,
|
|
6
7
|
getMarimoCommand,
|
|
7
8
|
getRawPrompt,
|
|
8
9
|
getTerminalCommand,
|
|
@@ -12,7 +13,11 @@ import {
|
|
|
12
13
|
|
|
13
14
|
const CONNECTION: ConnectionInfo = {
|
|
14
15
|
url: "http://localhost:8000",
|
|
15
|
-
|
|
16
|
+
file: "notebooks/example.py",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const CONNECTION_WITHOUT_FILE: ConnectionInfo = {
|
|
20
|
+
url: "http://localhost:8000",
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
describe("shellQuote", () => {
|
|
@@ -22,7 +27,7 @@ describe("shellQuote", () => {
|
|
|
22
27
|
|
|
23
28
|
it("leaves shell-safe values untouched", () => {
|
|
24
29
|
expect(shellQuote("http://localhost:8000")).toBe("http://localhost:8000");
|
|
25
|
-
expect(shellQuote("
|
|
30
|
+
expect(shellQuote("notebooks/example.py")).toBe("notebooks/example.py");
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
it("quotes values with shell metacharacters", () => {
|
|
@@ -37,6 +42,49 @@ describe("shellQuote", () => {
|
|
|
37
42
|
// Closes the quote, emits a literal ' via "'", then reopens: '"'"'
|
|
38
43
|
expect(shellQuote("a'b")).toBe(`'a'"'"'b'`);
|
|
39
44
|
});
|
|
45
|
+
|
|
46
|
+
it.each([
|
|
47
|
+
["/tmp/my notebook.py", "'/tmp/my notebook.py'"],
|
|
48
|
+
[
|
|
49
|
+
String.raw`C:\Users\Jane Doe\notebook.py`,
|
|
50
|
+
String.raw`'C:\Users\Jane Doe\notebook.py'`,
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
String.raw`\\server\share\my notebook.py`,
|
|
54
|
+
String.raw`'\\server\share\my notebook.py'`,
|
|
55
|
+
],
|
|
56
|
+
])("quotes non-portable path %s as one argument", (path, expected) => {
|
|
57
|
+
expect(shellQuote(path)).toBe(expected);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe("getFileFromURL", () => {
|
|
62
|
+
it("returns undefined when the file query parameter is absent or empty", () => {
|
|
63
|
+
expect(getFileFromURL("http://localhost:8000")).toBeUndefined();
|
|
64
|
+
expect(getFileFromURL("http://localhost:8000?file=")).toBeUndefined();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("decodes spaces and literal plus signs", () => {
|
|
68
|
+
expect(
|
|
69
|
+
getFileFromURL(
|
|
70
|
+
"http://localhost:8000?file=relative%2Fmy%20notebook%2Bdata.py",
|
|
71
|
+
),
|
|
72
|
+
).toBe("relative/my notebook+data.py");
|
|
73
|
+
expect(getFileFromURL("http://localhost:8000?file=my+notebook.py")).toBe(
|
|
74
|
+
"my notebook.py",
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("preserves decoded Windows paths and uses the first duplicate value", () => {
|
|
79
|
+
expect(
|
|
80
|
+
getFileFromURL(
|
|
81
|
+
"http://localhost:8000?file=C%3A%5CUsers%5CJane%20Doe%5Cnotebook.py",
|
|
82
|
+
),
|
|
83
|
+
).toBe(String.raw`C:\Users\Jane Doe\notebook.py`);
|
|
84
|
+
expect(
|
|
85
|
+
getFileFromURL("http://localhost:8000?file=first.py&file=second.py"),
|
|
86
|
+
).toBe("first.py");
|
|
87
|
+
});
|
|
40
88
|
});
|
|
41
89
|
|
|
42
90
|
describe("getMarimoCommand", () => {
|
|
@@ -56,30 +104,56 @@ describe("getMarimoCommand", () => {
|
|
|
56
104
|
});
|
|
57
105
|
|
|
58
106
|
describe("getTerminalCommand", () => {
|
|
59
|
-
it("includes the url and
|
|
107
|
+
it("includes the url and file for each agent", () => {
|
|
60
108
|
expect(getTerminalCommand("claude", CONNECTION, false)).toBe(
|
|
61
|
-
`claude "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
109
|
+
`claude "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --claude)"`,
|
|
62
110
|
);
|
|
63
111
|
expect(getTerminalCommand("codex", CONNECTION, false)).toBe(
|
|
64
|
-
`codex "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
112
|
+
`codex "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --codex)"`,
|
|
65
113
|
);
|
|
66
114
|
expect(getTerminalCommand("opencode", CONNECTION, false)).toBe(
|
|
67
|
-
`opencode --prompt "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
115
|
+
`opencode --prompt "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --opencode)"`,
|
|
68
116
|
);
|
|
69
117
|
});
|
|
70
118
|
|
|
71
|
-
it("
|
|
72
|
-
const command = getTerminalCommand(
|
|
73
|
-
|
|
119
|
+
it("omits the file flag when the page URL has no file", () => {
|
|
120
|
+
const command = getTerminalCommand(
|
|
121
|
+
"claude",
|
|
122
|
+
CONNECTION_WITHOUT_FILE,
|
|
123
|
+
false,
|
|
124
|
+
);
|
|
125
|
+
expect(command).not.toContain("--file");
|
|
126
|
+
expect(command).not.toContain("--session");
|
|
74
127
|
});
|
|
75
128
|
|
|
76
129
|
it("shell-escapes a url containing metacharacters", () => {
|
|
77
130
|
const command = getTerminalCommand(
|
|
78
131
|
"claude",
|
|
79
|
-
{ url: "http://host:8000?
|
|
132
|
+
{ url: "http://host:8000?auth=a&b", file: "notebook.py" },
|
|
80
133
|
false,
|
|
81
134
|
);
|
|
82
|
-
expect(command).toContain("--url 'http://host:8000?
|
|
135
|
+
expect(command).toContain("--url 'http://host:8000?auth=a&b'");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it.each([
|
|
139
|
+
["relative/my notebook.py", "--file 'relative/my notebook.py'"],
|
|
140
|
+
["/tmp/my notebook.py", "--file '/tmp/my notebook.py'"],
|
|
141
|
+
[
|
|
142
|
+
String.raw`C:\Users\Jane Doe\notebook.py`,
|
|
143
|
+
String.raw`--file 'C:\Users\Jane Doe\notebook.py'`,
|
|
144
|
+
],
|
|
145
|
+
[
|
|
146
|
+
String.raw`\\server\share\my notebook.py`,
|
|
147
|
+
String.raw`--file '\\server\share\my notebook.py'`,
|
|
148
|
+
],
|
|
149
|
+
["notebooks/it's.py", `--file 'notebooks/it'"'"'s.py'`],
|
|
150
|
+
])("shell-escapes file path %s", (file, expected) => {
|
|
151
|
+
const command = getTerminalCommand(
|
|
152
|
+
"claude",
|
|
153
|
+
{ url: CONNECTION.url, file },
|
|
154
|
+
false,
|
|
155
|
+
);
|
|
156
|
+
expect(command).toContain(expected);
|
|
83
157
|
});
|
|
84
158
|
|
|
85
159
|
it("adds --with-token before the agent flag when requested", () => {
|
|
@@ -95,26 +169,33 @@ describe("getTerminalCommand", () => {
|
|
|
95
169
|
});
|
|
96
170
|
|
|
97
171
|
describe("getRawPrompt", () => {
|
|
98
|
-
it("references the
|
|
172
|
+
it("references the file-scoped execute-code command", () => {
|
|
99
173
|
const prompt = getRawPrompt(CONNECTION, null);
|
|
100
174
|
expect(prompt).toContain(
|
|
101
|
-
"execute-code.sh --url http://localhost:8000 --
|
|
175
|
+
"execute-code.sh --url http://localhost:8000 --file notebooks/example.py",
|
|
102
176
|
);
|
|
103
177
|
expect(prompt).toContain(
|
|
104
|
-
"Connect to the notebook at: http://localhost:8000 (
|
|
178
|
+
"Connect to the notebook at: http://localhost:8000 (file notebooks/example.py)",
|
|
105
179
|
);
|
|
106
180
|
});
|
|
107
181
|
|
|
182
|
+
it("omits file targeting when the page URL has no file", () => {
|
|
183
|
+
const prompt = getRawPrompt(CONNECTION_WITHOUT_FILE, null);
|
|
184
|
+
expect(prompt).toContain("execute-code.sh --url http://localhost:8000");
|
|
185
|
+
expect(prompt).not.toContain("--file");
|
|
186
|
+
expect(prompt).not.toContain("--session");
|
|
187
|
+
});
|
|
188
|
+
|
|
108
189
|
it("omits the token hint when there is no token", () => {
|
|
109
190
|
const prompt = getRawPrompt(CONNECTION, null);
|
|
110
191
|
expect(prompt).not.toContain("--token");
|
|
111
192
|
expect(prompt).not.toContain("auth token");
|
|
112
193
|
});
|
|
113
194
|
|
|
114
|
-
it("includes a
|
|
195
|
+
it("includes a file-scoped token hint when a token is present", () => {
|
|
115
196
|
const prompt = getRawPrompt(CONNECTION, "secret-token");
|
|
116
197
|
expect(prompt).toContain(
|
|
117
|
-
"execute-code.sh --url http://localhost:8000 --
|
|
198
|
+
"execute-code.sh --url http://localhost:8000 --file notebooks/example.py --token secret-token",
|
|
118
199
|
);
|
|
119
200
|
});
|
|
120
201
|
|
|
@@ -128,9 +209,9 @@ describe("getRawPrompt", () => {
|
|
|
128
209
|
expect(prompt).toMatchInlineSnapshot(`
|
|
129
210
|
"Use the /marimo-pair skill to pair-program on a running marimo notebook.
|
|
130
211
|
|
|
131
|
-
Connect to the notebook at: http://localhost:8000 (
|
|
212
|
+
Connect to the notebook at: http://localhost:8000 (file notebooks/example.py)
|
|
132
213
|
|
|
133
|
-
Use \`execute-code.sh --url http://localhost:8000 --
|
|
214
|
+
Use \`execute-code.sh --url http://localhost:8000 --file notebooks/example.py\` from the marimo-pair skill to execute code in the notebook.
|
|
134
215
|
|
|
135
216
|
Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair."
|
|
136
217
|
`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { assertNever } from "@/utils/assertNever";
|
|
4
|
+
import { KnownQueryParams } from "@/core/constants";
|
|
4
5
|
|
|
5
6
|
export type AgentTab = "claude" | "codex" | "opencode" | "prompt";
|
|
6
7
|
|
|
@@ -43,14 +44,21 @@ export function shellQuote(value: string): string {
|
|
|
43
44
|
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/** Return the server file key from a page URL, preserving its decoded value. */
|
|
48
|
+
export function getFileFromURL(href: string): string | undefined {
|
|
49
|
+
const file = new URL(href).searchParams.get(KnownQueryParams.filePath);
|
|
50
|
+
return file === null || file === "" ? undefined : file;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getFileFlag(file: string | undefined): string {
|
|
54
|
+
return file ? ` --file ${shellQuote(file)}` : "";
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
/** Identifies the specific running notebook to pair on. */
|
|
47
58
|
export interface ConnectionInfo {
|
|
48
59
|
url: string;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
* guessing when multiple sessions are open on the same server.
|
|
52
|
-
*/
|
|
53
|
-
sessionId: string;
|
|
60
|
+
/** The server's file key, when the page URL identifies a notebook. */
|
|
61
|
+
file?: string;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
/**
|
|
@@ -59,11 +67,12 @@ export interface ConnectionInfo {
|
|
|
59
67
|
*/
|
|
60
68
|
export function getTerminalCommand(
|
|
61
69
|
agent: Exclude<AgentTab, "prompt">,
|
|
62
|
-
{ url,
|
|
70
|
+
{ url, file }: ConnectionInfo,
|
|
63
71
|
withToken: boolean,
|
|
64
72
|
): string {
|
|
73
|
+
const fileFlag = getFileFlag(file);
|
|
65
74
|
const tokenFlag = withToken ? " --with-token" : "";
|
|
66
|
-
const base = `${getMarimoCommand()} pair prompt --url ${shellQuote(url)}
|
|
75
|
+
const base = `${getMarimoCommand()} pair prompt --url ${shellQuote(url)}${fileFlag}${tokenFlag}`;
|
|
67
76
|
switch (agent) {
|
|
68
77
|
case "claude":
|
|
69
78
|
return `claude "$(${base} --claude)"`;
|
|
@@ -82,17 +91,19 @@ export function getTerminalCommand(
|
|
|
82
91
|
* an agent behaves the same as the terminal commands.
|
|
83
92
|
*/
|
|
84
93
|
export function getRawPrompt(
|
|
85
|
-
{ url,
|
|
94
|
+
{ url, file }: ConnectionInfo,
|
|
86
95
|
token: string | null,
|
|
87
96
|
): string {
|
|
88
|
-
const
|
|
97
|
+
const fileFlag = getFileFlag(file);
|
|
98
|
+
const fileHint = file ? ` (file ${file})` : "";
|
|
99
|
+
const executeCmd = `execute-code.sh --url ${shellQuote(url)}${fileFlag}`;
|
|
89
100
|
const tokenHint = token
|
|
90
101
|
? `\n\nUse this auth token when calling \`execute-code.sh\`: \`${executeCmd} --token ${shellQuote(token)}\`.`
|
|
91
102
|
: "";
|
|
92
103
|
return [
|
|
93
104
|
"Use the /marimo-pair skill to pair-program on a running marimo notebook.",
|
|
94
105
|
"",
|
|
95
|
-
`Connect to the notebook at: ${url}
|
|
106
|
+
`Connect to the notebook at: ${url}${fileHint}`,
|
|
96
107
|
"",
|
|
97
108
|
`Use \`${executeCmd}\` from the marimo-pair skill to execute code in the notebook.${tokenHint}`,
|
|
98
109
|
"",
|
|
@@ -16,12 +16,12 @@ import { Events } from "@/utils/events";
|
|
|
16
16
|
import { Tooltip } from "@/components/ui/tooltip";
|
|
17
17
|
import { asRemoteURL, useRuntimeManager } from "@/core/runtime/config";
|
|
18
18
|
import { API } from "@/core/network/api";
|
|
19
|
-
import { getSessionId } from "@/core/kernel/session";
|
|
20
19
|
import {
|
|
21
20
|
AGENT_LABELS,
|
|
22
21
|
AGENT_TABS,
|
|
23
22
|
type AgentTab,
|
|
24
23
|
type ConnectionInfo,
|
|
24
|
+
getFileFromURL,
|
|
25
25
|
getRawPrompt,
|
|
26
26
|
getTerminalCommand,
|
|
27
27
|
maskToken,
|
|
@@ -53,7 +53,7 @@ export const PairWithAgentModal: React.FC<{
|
|
|
53
53
|
const hasToken = Boolean(authToken);
|
|
54
54
|
const connection: ConnectionInfo = {
|
|
55
55
|
url: runtimeManager.httpURL.toString(),
|
|
56
|
-
|
|
56
|
+
file: getFileFromURL(window.location.href),
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
return (
|