@marimo-team/islands 0.15.3 → 0.15.5
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/{ConnectedDataExplorerComponent-DfvW3rBn.js → ConnectedDataExplorerComponent-CBeIYi8p.js} +2 -2
- package/dist/{ImageComparisonComponent-XaJshw7d.js → ImageComparisonComponent-Bk0a0xBq.js} +1 -1
- package/dist/{_baseUniq-dN9WKF9m.js → _baseUniq-utU5_Vu-.js} +1 -1
- package/dist/{any-language-editor-CpFniVi-.js → any-language-editor-PrUUh2lr.js} +1 -1
- package/dist/{architectureDiagram-W76B3OCA-Bpg85ZKv.js → architectureDiagram-W76B3OCA-D-vOp0UU.js} +4 -4
- package/dist/assets/{worker-Y-Q4G-N2.js → worker-BcG8m3h5.js} +3 -3
- package/dist/{blockDiagram-QIGZ2CNN-DS1kOHlW.js → blockDiagram-QIGZ2CNN-IG-z8q8A.js} +5 -5
- package/dist/{c4Diagram-FPNF74CW-CyRVKssw.js → c4Diagram-FPNF74CW-5AEXIX3t.js} +2 -2
- package/dist/{channel-BilGXox7.js → channel-ECVsTGGL.js} +1 -1
- package/dist/{chunk-4BX2VUAB-CZR39zCO.js → chunk-4BX2VUAB-DfJcd9e-.js} +1 -1
- package/dist/{chunk-55IACEB6-BIH-MYov.js → chunk-55IACEB6-BwT8MejR.js} +1 -1
- package/dist/{chunk-FMBD7UC4-4PZXFZE8.js → chunk-FMBD7UC4-DW7uxNR6.js} +1 -1
- package/dist/{chunk-K7UQS3LO-CEvWKznk.js → chunk-K7UQS3LO-BGn2ZPDQ.js} +4 -4
- package/dist/{chunk-QN33PNHL-D5LO5Jq_.js → chunk-QN33PNHL-BcIbOumv.js} +1 -1
- package/dist/{chunk-QZHKN3VN-6gwUonWI.js → chunk-QZHKN3VN-CMSnhk6x.js} +1 -1
- package/dist/{chunk-TVAH2DTR-3gm06QdU.js → chunk-TVAH2DTR-CZF2JRya.js} +3 -3
- package/dist/{chunk-TZMSLE5B-Cm8Iy9bO.js → chunk-TZMSLE5B-BHzN_BY6.js} +1 -1
- package/dist/{classDiagram-v2-RKCZMP56-DC529O_z.js → classDiagram-KNZD7YFC-2H7MseyB.js} +2 -2
- package/dist/{classDiagram-KNZD7YFC-DC529O_z.js → classDiagram-v2-RKCZMP56-2H7MseyB.js} +2 -2
- package/dist/{clone-CLoRX3j6.js → clone-DKQcSK7N.js} +1 -1
- package/dist/{cose-bilkent-S5V4N54A-qf5DlS6Y.js → cose-bilkent-S5V4N54A-CgvKFxTr.js} +2 -2
- package/dist/{dagre-5GWH7T2D-Ceocls0m.js → dagre-5GWH7T2D-VNFIipzt.js} +6 -6
- package/dist/{data-grid-overlay-editor-AqDS_UKe.js → data-grid-overlay-editor-XdqkKCVx.js} +2 -2
- package/dist/{diagram-N5W7TBWH-CP66oSiv.js → diagram-N5W7TBWH-D1s8h-eH.js} +5 -5
- package/dist/{diagram-QEK2KX5R-_YD4kxxi.js → diagram-QEK2KX5R-DOa-AstT.js} +3 -3
- package/dist/{diagram-S2PKOQOG-Cnj8T-OP.js → diagram-S2PKOQOG-CFZ-Y2zi.js} +3 -3
- package/dist/{dockerfile-Cm8cRYCN.js → dockerfile-zE-2DWBS.js} +1 -1
- package/dist/{erDiagram-AWTI2OKA-CGnvoHx6.js → erDiagram-AWTI2OKA-WxUYJfbS.js} +4 -4
- package/dist/{flowDiagram-PVAE7QVJ-DG-pr9R9.js → flowDiagram-PVAE7QVJ-dDZH2O1W.js} +5 -5
- package/dist/{ganttDiagram-OWAHRB6G-JmChtxvn.js → ganttDiagram-OWAHRB6G-D3CCqPQq.js} +4 -4
- package/dist/{gitGraphDiagram-NY62KEGX-D8wLfOPd.js → gitGraphDiagram-NY62KEGX-BHFylEwc.js} +4 -4
- package/dist/{glide-data-editor-9nC3iCIZ.js → glide-data-editor-D0aJSGV_.js} +3 -3
- package/dist/{graph-CoRe7vAN.js → graph-BPGEu6c8.js} +3 -3
- package/dist/{index-6qYeHHjQ.js → index-Bx2b23rX.js} +3 -3
- package/dist/{index-BthgsgYX.js → index-DotQhzoN.js} +1 -1
- package/dist/{index-jkm77Jrz.js → index-HtOEKQ3O.js} +1 -1
- package/dist/{index-BpzLh4Qe.js → index-eDB61tLS.js} +1 -1
- package/dist/{infoDiagram-STP46IZ2-BlXxvOrR.js → infoDiagram-STP46IZ2-DWhhqGPi.js} +2 -2
- package/dist/{journeyDiagram-BIP6EPQ6-CNRYs_Fc.js → journeyDiagram-BIP6EPQ6-CU8FpryL.js} +3 -3
- package/dist/{kanban-definition-6OIFK2YF-B9HeMAuP.js → kanban-definition-6OIFK2YF-CWhF_a4g.js} +2 -2
- package/dist/{layout-m2vOUiW1.js → layout-DGonEvAZ.js} +4 -4
- package/dist/{linear-DU6Q5CX3.js → linear-Cww2a6nQ.js} +1 -1
- package/dist/{main-BD2KGFpU.js → main-Bc0LY9fB.js} +20636 -20608
- package/dist/main.js +1 -1
- package/dist/{mermaid-HVCtvbyx.js → mermaid-DpJuOhRr.js} +30 -30
- package/dist/{min-DcGMA4e_.js → min-CFQjsG4L.js} +2 -2
- package/dist/{mindmap-definition-Q6HEUPPD-BW8UmIDQ.js → mindmap-definition-Q6HEUPPD-K513Ef1t.js} +3 -3
- package/dist/{number-overlay-editor-D8Hl0Syo.js → number-overlay-editor-DuSchUfE.js} +2 -2
- package/dist/{pieDiagram-ADFJNKIX-Bg-3zg5U.js → pieDiagram-ADFJNKIX-DAIIUJJO.js} +3 -3
- package/dist/{quadrantDiagram-LMRXKWRM-BO4IG6Yz.js → quadrantDiagram-LMRXKWRM-yuf-j7Os.js} +2 -2
- package/dist/{react-plotly-dkvHVuRb.js → react-plotly-B378DZ9U.js} +1 -1
- package/dist/{requirementDiagram-4UW4RH46-5sdTguSM.js → requirementDiagram-4UW4RH46-BBWvEl6q.js} +3 -3
- package/dist/{sankeyDiagram-GR3RE2ED-Buhlv9OI.js → sankeyDiagram-GR3RE2ED-B_TwV-dS.js} +1 -1
- package/dist/{sequenceDiagram-C3RYC4MD-C3qsM2UP.js → sequenceDiagram-C3RYC4MD-BVC6lltp.js} +3 -3
- package/dist/{slides-component-D209A0-s.js → slides-component-CPX3S0Y9.js} +1 -1
- package/dist/{stateDiagram-KXAO66HF-CopJ7G6P.js → stateDiagram-KXAO66HF-BCU1tYTD.js} +4 -4
- package/dist/{stateDiagram-v2-UMBNRL4Z-CejL8AKf.js → stateDiagram-v2-UMBNRL4Z-BdvN6wTu.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{time-BwSBitlN.js → time-CSIip6fV.js} +2 -2
- package/dist/{timeline-definition-XQNQX7LJ-DzMNTX-C.js → timeline-definition-XQNQX7LJ-CCxCPNQI.js} +1 -1
- package/dist/{treemap-75Q7IDZK-zeJG07dk.js → treemap-75Q7IDZK-Du6v0BzD.js} +5 -5
- package/dist/{vega-component-CUkiTayd.js → vega-component-Da93sTnp.js} +2 -2
- package/dist/{xychartDiagram-6GGTOJPD-DiENNXMS.js → xychartDiagram-6GGTOJPD-Oq6xaZKR.js} +2 -2
- package/package.json +6 -3
- package/src/components/ai/ai-provider-icon.tsx +5 -1
- package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +304 -0
- package/src/components/chat/acp/__tests__/atoms.test.ts +56 -0
- package/src/components/chat/acp/__tests__/prompt.test.ts +12 -0
- package/src/components/chat/acp/__tests__/state.test.ts +621 -0
- package/src/components/chat/acp/agent-docs.tsx +78 -0
- package/src/components/chat/acp/agent-panel.css +23 -0
- package/src/components/chat/acp/agent-panel.tsx +715 -0
- package/src/components/chat/acp/agent-selector.tsx +138 -0
- package/src/components/chat/acp/blocks.tsx +664 -0
- package/src/components/chat/acp/common.tsx +198 -0
- package/src/components/chat/acp/prompt.ts +284 -0
- package/src/components/chat/acp/scroll-to-bottom-button.tsx +50 -0
- package/src/components/chat/acp/session-tabs.tsx +138 -0
- package/src/components/chat/acp/state.ts +263 -0
- package/src/components/chat/acp/thread.tsx +121 -0
- package/src/components/chat/acp/types.ts +63 -0
- package/src/components/chat/acp/utils.ts +45 -0
- package/src/components/chat/tool-call-accordion.tsx +1 -1
- package/src/components/editor/chrome/types.ts +10 -0
- package/src/components/editor/chrome/wrapper/app-chrome.tsx +17 -3
- package/src/core/config/feature-flag.tsx +2 -0
- package/src/plugins/impl/vega/vega.css +121 -0
- package/src/utils/Logger.ts +5 -6
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { useAtom, useSetAtom } from "jotai";
|
|
4
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
5
|
+
import React, { memo, useState } from "react";
|
|
6
|
+
import useEvent from "react-use-event-hook";
|
|
7
|
+
import { AiProviderIcon } from "@/components/ai/ai-provider-icon";
|
|
8
|
+
import { Button } from "@/components/ui/button";
|
|
9
|
+
import {
|
|
10
|
+
DropdownMenu,
|
|
11
|
+
DropdownMenuContent,
|
|
12
|
+
DropdownMenuItem,
|
|
13
|
+
DropdownMenuSeparator,
|
|
14
|
+
DropdownMenuTrigger,
|
|
15
|
+
} from "@/components/ui/dropdown-menu";
|
|
16
|
+
import { cn } from "@/utils/cn";
|
|
17
|
+
import { AgentDocs } from "./agent-docs";
|
|
18
|
+
import {
|
|
19
|
+
type AgentSession,
|
|
20
|
+
addSession,
|
|
21
|
+
agentSessionStateAtom,
|
|
22
|
+
type ExternalAgentId,
|
|
23
|
+
getAgentSessionSupport,
|
|
24
|
+
selectedTabAtom,
|
|
25
|
+
} from "./state";
|
|
26
|
+
|
|
27
|
+
interface AgentSelectorProps {
|
|
28
|
+
onSessionCreated?: (agentId: ExternalAgentId) => void;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const AVAILABLE_AGENTS = [
|
|
33
|
+
{
|
|
34
|
+
id: "claude",
|
|
35
|
+
displayName: "Claude",
|
|
36
|
+
iconId: "anthropic",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "gemini",
|
|
40
|
+
displayName: "Gemini",
|
|
41
|
+
iconId: "google",
|
|
42
|
+
},
|
|
43
|
+
] as const;
|
|
44
|
+
|
|
45
|
+
interface AgentMenuItemProps {
|
|
46
|
+
agent: (typeof AVAILABLE_AGENTS)[number];
|
|
47
|
+
onSelect: (agentId: ExternalAgentId) => void;
|
|
48
|
+
existingSessions: AgentSession[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const AgentMenuItem = memo<AgentMenuItemProps>(
|
|
52
|
+
({ agent, onSelect, existingSessions }) => {
|
|
53
|
+
const sessionSupport = getAgentSessionSupport(agent.id);
|
|
54
|
+
const hasExistingSession = existingSessions.some(
|
|
55
|
+
(s) => s.agentId === agent.id,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const getText = () => {
|
|
59
|
+
if (sessionSupport === "single" && hasExistingSession) {
|
|
60
|
+
return `Reset ${agent.displayName} session`;
|
|
61
|
+
}
|
|
62
|
+
return `New ${agent.displayName} session`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<DropdownMenuItem
|
|
67
|
+
onClick={() => onSelect(agent.id)}
|
|
68
|
+
className="cursor-pointer"
|
|
69
|
+
>
|
|
70
|
+
<div className="flex items-center w-full">
|
|
71
|
+
<AiProviderIcon provider={agent.iconId} className="h-3 w-3 mr-2" />
|
|
72
|
+
<span>{getText()}</span>
|
|
73
|
+
</div>
|
|
74
|
+
</DropdownMenuItem>
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
AgentMenuItem.displayName = "AgentMenuItem";
|
|
79
|
+
|
|
80
|
+
export const AgentSelector: React.FC<AgentSelectorProps> = memo(
|
|
81
|
+
({ onSessionCreated, className }) => {
|
|
82
|
+
const [sessionState, setSessionState] = useAtom(agentSessionStateAtom);
|
|
83
|
+
const setActiveTab = useSetAtom(selectedTabAtom);
|
|
84
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
85
|
+
|
|
86
|
+
const handleCreateSession = useEvent(async (agentId: ExternalAgentId) => {
|
|
87
|
+
const newState = addSession(sessionState, {
|
|
88
|
+
agentId,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
setSessionState(newState);
|
|
92
|
+
setActiveTab(newState.activeTabId);
|
|
93
|
+
setIsOpen(false);
|
|
94
|
+
|
|
95
|
+
onSessionCreated?.(agentId);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
|
|
100
|
+
<DropdownMenuTrigger asChild={true}>
|
|
101
|
+
<Button
|
|
102
|
+
variant="ghost"
|
|
103
|
+
size="sm"
|
|
104
|
+
className={cn(
|
|
105
|
+
"h-6 gap-1 px-2 text-xs bg-muted/30 hover:bg-muted/50 border border-border border-y-0 rounded-none focus-visible:ring-0",
|
|
106
|
+
className,
|
|
107
|
+
)}
|
|
108
|
+
>
|
|
109
|
+
<span>New session</span>
|
|
110
|
+
<ChevronDownIcon className="h-3 w-3" />
|
|
111
|
+
</Button>
|
|
112
|
+
</DropdownMenuTrigger>
|
|
113
|
+
<DropdownMenuContent align="start" className="w-fit">
|
|
114
|
+
{AVAILABLE_AGENTS.map((agent) => (
|
|
115
|
+
<AgentMenuItem
|
|
116
|
+
key={agent.id}
|
|
117
|
+
agent={agent}
|
|
118
|
+
onSelect={handleCreateSession}
|
|
119
|
+
existingSessions={sessionState.sessions}
|
|
120
|
+
/>
|
|
121
|
+
))}
|
|
122
|
+
<DropdownMenuSeparator />
|
|
123
|
+
<div className="px-2 py-2">
|
|
124
|
+
<div className="text-xs font-medium text-muted-foreground mb-3">
|
|
125
|
+
To start an external agent, run the following command in your
|
|
126
|
+
terminal:
|
|
127
|
+
</div>
|
|
128
|
+
<AgentDocs
|
|
129
|
+
agents={AVAILABLE_AGENTS.map((agent) => agent.id)}
|
|
130
|
+
showCopy={true}
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
</DropdownMenuContent>
|
|
134
|
+
</DropdownMenu>
|
|
135
|
+
);
|
|
136
|
+
},
|
|
137
|
+
);
|
|
138
|
+
AgentSelector.displayName = "AgentSelector";
|