@getcatalystiq/agent-plane-ui 0.1.18 → 0.1.20
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/agent-identity-tab-ETPM6LQN.js +2 -0
- package/dist/agent-identity-tab-F4MU2HP2.cjs +11 -0
- package/dist/chunk-CE2RHDPY.js +422 -0
- package/dist/chunk-CHJL4MZI.cjs +277 -0
- package/dist/chunk-L45SI32F.js +275 -0
- package/dist/chunk-VZ43ATC5.cjs +454 -0
- package/dist/{chunk-P4N2P42X.js → chunk-XFI227OB.js} +77 -46
- package/dist/{chunk-4XBBDUSZ.cjs → chunk-XXF4U7WL.cjs} +93 -64
- package/dist/editor.cjs +26 -387
- package/dist/editor.d.cts +50 -1
- package/dist/editor.d.ts +50 -1
- package/dist/editor.js +7 -374
- package/dist/index.cjs +583 -666
- package/dist/index.d.cts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +19 -125
- package/package.json +1 -1
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkXXF4U7WL_cjs = require('./chunk-XXF4U7WL.cjs');
|
|
4
|
+
var useSWR = require('swr');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var CodeMirror = require('@uiw/react-codemirror');
|
|
8
|
+
var langMarkdown = require('@codemirror/lang-markdown');
|
|
9
|
+
var langJavascript = require('@codemirror/lang-javascript');
|
|
10
|
+
var langJson = require('@codemirror/lang-json');
|
|
11
|
+
var themeOneDark = require('@codemirror/theme-one-dark');
|
|
12
|
+
|
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var useSWR__default = /*#__PURE__*/_interopDefault(useSWR);
|
|
34
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
35
|
+
var CodeMirror__default = /*#__PURE__*/_interopDefault(CodeMirror);
|
|
36
|
+
|
|
37
|
+
function useApi(key, fetcher, options) {
|
|
38
|
+
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
39
|
+
const onAuthError = chunkXXF4U7WL_cjs.useAuthError();
|
|
40
|
+
return useSWR__default.default(
|
|
41
|
+
key,
|
|
42
|
+
() => fetcher(client),
|
|
43
|
+
{
|
|
44
|
+
revalidateOnFocus: false,
|
|
45
|
+
errorRetryCount: 3,
|
|
46
|
+
onError: (err) => {
|
|
47
|
+
if (onAuthError && err && typeof err === "object" && "status" in err && err.status === 401) {
|
|
48
|
+
onAuthError(err instanceof Error ? err : new Error(String(err)));
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
...options
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
var Card = React__namespace.forwardRef(
|
|
56
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkXXF4U7WL_cjs.cn("rounded-xl border bg-card text-card-foreground shadow", className), ...props })
|
|
57
|
+
);
|
|
58
|
+
Card.displayName = "Card";
|
|
59
|
+
var CardHeader = React__namespace.forwardRef(
|
|
60
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkXXF4U7WL_cjs.cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
61
|
+
);
|
|
62
|
+
CardHeader.displayName = "CardHeader";
|
|
63
|
+
var CardTitle = React__namespace.forwardRef(
|
|
64
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkXXF4U7WL_cjs.cn("font-semibold leading-none tracking-tight", className), ...props })
|
|
65
|
+
);
|
|
66
|
+
CardTitle.displayName = "CardTitle";
|
|
67
|
+
var CardDescription = React__namespace.forwardRef(
|
|
68
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkXXF4U7WL_cjs.cn("text-sm text-muted-foreground", className), ...props })
|
|
69
|
+
);
|
|
70
|
+
CardDescription.displayName = "CardDescription";
|
|
71
|
+
var CardContent = React__namespace.forwardRef(
|
|
72
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkXXF4U7WL_cjs.cn("p-6 pt-0", className), ...props })
|
|
73
|
+
);
|
|
74
|
+
CardContent.displayName = "CardContent";
|
|
75
|
+
function Skeleton({ className, ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkXXF4U7WL_cjs.cn("animate-pulse rounded-md bg-muted/50", className), ...props });
|
|
77
|
+
}
|
|
78
|
+
function getLanguageExtension(filename) {
|
|
79
|
+
const ext = filename.split(".").pop()?.toLowerCase();
|
|
80
|
+
switch (ext) {
|
|
81
|
+
case "md":
|
|
82
|
+
return [langMarkdown.markdown()];
|
|
83
|
+
case "json":
|
|
84
|
+
return [langJson.json()];
|
|
85
|
+
case "js":
|
|
86
|
+
case "ts":
|
|
87
|
+
case "jsx":
|
|
88
|
+
case "tsx":
|
|
89
|
+
return [langJavascript.javascript({ typescript: ext === "ts" || ext === "tsx", jsx: ext === "jsx" || ext === "tsx" })];
|
|
90
|
+
default:
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function buildTree(files) {
|
|
95
|
+
const rootFiles = [];
|
|
96
|
+
const dirMap = /* @__PURE__ */ new Map();
|
|
97
|
+
function ensureDir(dirPath) {
|
|
98
|
+
const existing = dirMap.get(dirPath);
|
|
99
|
+
if (existing) return existing;
|
|
100
|
+
const parts = dirPath.split("/");
|
|
101
|
+
const node = {
|
|
102
|
+
name: parts[parts.length - 1] ?? dirPath,
|
|
103
|
+
fullPath: dirPath,
|
|
104
|
+
children: [],
|
|
105
|
+
files: []
|
|
106
|
+
};
|
|
107
|
+
dirMap.set(dirPath, node);
|
|
108
|
+
if (parts.length > 1) {
|
|
109
|
+
const parentPath = parts.slice(0, -1).join("/");
|
|
110
|
+
const parent = ensureDir(parentPath);
|
|
111
|
+
if (!parent.children.some((c) => c.fullPath === dirPath)) {
|
|
112
|
+
parent.children.push(node);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return node;
|
|
116
|
+
}
|
|
117
|
+
for (const file of files) {
|
|
118
|
+
const slashIdx = file.path.lastIndexOf("/");
|
|
119
|
+
if (slashIdx === -1) {
|
|
120
|
+
rootFiles.push(file);
|
|
121
|
+
} else {
|
|
122
|
+
const dirPath = file.path.slice(0, slashIdx);
|
|
123
|
+
const dir = ensureDir(dirPath);
|
|
124
|
+
dir.files.push(file);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const topLevel = [];
|
|
128
|
+
for (const node of dirMap.values()) {
|
|
129
|
+
if (!node.fullPath.includes("/")) {
|
|
130
|
+
topLevel.push(node);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function sortNode(node) {
|
|
134
|
+
node.children.sort((a, b) => a.name.localeCompare(b.name));
|
|
135
|
+
node.files.sort((a, b) => a.path.localeCompare(b.path));
|
|
136
|
+
node.children.forEach(sortNode);
|
|
137
|
+
}
|
|
138
|
+
topLevel.forEach(sortNode);
|
|
139
|
+
topLevel.sort((a, b) => a.name.localeCompare(b.name));
|
|
140
|
+
rootFiles.sort((a, b) => a.path.localeCompare(b.path));
|
|
141
|
+
return { rootFiles, rootDirs: topLevel };
|
|
142
|
+
}
|
|
143
|
+
function collectAllDirPaths(nodes) {
|
|
144
|
+
const paths = /* @__PURE__ */ new Set();
|
|
145
|
+
function walk(node) {
|
|
146
|
+
paths.add(node.fullPath);
|
|
147
|
+
node.children.forEach(walk);
|
|
148
|
+
}
|
|
149
|
+
nodes.forEach(walk);
|
|
150
|
+
return paths;
|
|
151
|
+
}
|
|
152
|
+
function FileTreeEditor({
|
|
153
|
+
initialFiles,
|
|
154
|
+
onSave,
|
|
155
|
+
onChange,
|
|
156
|
+
readOnly = false,
|
|
157
|
+
hideSave = false,
|
|
158
|
+
title = "Files",
|
|
159
|
+
saveLabel = "Save",
|
|
160
|
+
addFolderLabel = "Folder",
|
|
161
|
+
newFileTemplate = { filename: "SKILL.md", content: "# New\n\nDescribe this...\n" },
|
|
162
|
+
savedVersion
|
|
163
|
+
}) {
|
|
164
|
+
const [files, setFiles] = React.useState(initialFiles);
|
|
165
|
+
const [selectedPath, setSelectedPath] = React.useState(
|
|
166
|
+
initialFiles.length > 0 ? initialFiles[0]?.path ?? null : null
|
|
167
|
+
);
|
|
168
|
+
const [saving, setSaving] = React.useState(false);
|
|
169
|
+
const [expanded, setExpanded] = React.useState(() => {
|
|
170
|
+
const { rootDirs } = buildTree(initialFiles);
|
|
171
|
+
return collectAllDirPaths(rootDirs);
|
|
172
|
+
});
|
|
173
|
+
const [showAddFolder, setShowAddFolder] = React.useState(false);
|
|
174
|
+
const [newFolderName, setNewFolderName] = React.useState("");
|
|
175
|
+
const [addingFileInDir, setAddingFileInDir] = React.useState(null);
|
|
176
|
+
const [newFileName, setNewFileName] = React.useState("");
|
|
177
|
+
const [savedSnapshot, setSavedSnapshot] = React.useState(() => JSON.stringify(initialFiles));
|
|
178
|
+
React.useEffect(() => {
|
|
179
|
+
const snap = JSON.stringify(initialFiles);
|
|
180
|
+
setSavedSnapshot(snap);
|
|
181
|
+
setFiles(initialFiles);
|
|
182
|
+
const { rootDirs } = buildTree(initialFiles);
|
|
183
|
+
setExpanded(collectAllDirPaths(rootDirs));
|
|
184
|
+
}, [initialFiles]);
|
|
185
|
+
React.useEffect(() => {
|
|
186
|
+
if (savedVersion !== void 0 && savedVersion > 0) {
|
|
187
|
+
setSavedSnapshot(JSON.stringify(files));
|
|
188
|
+
}
|
|
189
|
+
}, [savedVersion]);
|
|
190
|
+
const onChangeRef = React.useRef(onChange);
|
|
191
|
+
onChangeRef.current = onChange;
|
|
192
|
+
React.useEffect(() => {
|
|
193
|
+
if (onChangeRef.current && JSON.stringify(files) !== savedSnapshot) {
|
|
194
|
+
onChangeRef.current(files);
|
|
195
|
+
}
|
|
196
|
+
}, [files, savedSnapshot]);
|
|
197
|
+
const isDirty = React.useMemo(
|
|
198
|
+
() => JSON.stringify(files) !== savedSnapshot,
|
|
199
|
+
[files, savedSnapshot]
|
|
200
|
+
);
|
|
201
|
+
const tree = React.useMemo(() => buildTree(files), [files]);
|
|
202
|
+
const activeFile = React.useMemo(
|
|
203
|
+
() => selectedPath ? files.find((f) => f.path === selectedPath) ?? null : null,
|
|
204
|
+
[files, selectedPath]
|
|
205
|
+
);
|
|
206
|
+
const handleEditorChange = React.useCallback((value) => {
|
|
207
|
+
if (readOnly || !selectedPath) return;
|
|
208
|
+
setFiles((prev) => prev.map((f) => f.path === selectedPath ? { ...f, content: value } : f));
|
|
209
|
+
}, [readOnly, selectedPath]);
|
|
210
|
+
function toggleExpand(dirPath) {
|
|
211
|
+
setExpanded((prev) => {
|
|
212
|
+
const next = new Set(prev);
|
|
213
|
+
if (next.has(dirPath)) {
|
|
214
|
+
next.delete(dirPath);
|
|
215
|
+
} else {
|
|
216
|
+
next.add(dirPath);
|
|
217
|
+
}
|
|
218
|
+
return next;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function addFolder() {
|
|
222
|
+
const name = newFolderName.trim();
|
|
223
|
+
if (!name) return;
|
|
224
|
+
const filePath = `${name}/${newFileTemplate.filename}`;
|
|
225
|
+
if (files.some((f) => f.path === filePath)) return;
|
|
226
|
+
const content = newFileTemplate.content.replace("# New", `# ${name}`);
|
|
227
|
+
setFiles((prev) => [...prev, { path: filePath, content }]);
|
|
228
|
+
setSelectedPath(filePath);
|
|
229
|
+
setExpanded((prev) => /* @__PURE__ */ new Set([...prev, name]));
|
|
230
|
+
setNewFolderName("");
|
|
231
|
+
setShowAddFolder(false);
|
|
232
|
+
}
|
|
233
|
+
function removeDir(dirPath) {
|
|
234
|
+
const prefix = dirPath + "/";
|
|
235
|
+
const affectedFiles = files.filter((f) => f.path.startsWith(prefix));
|
|
236
|
+
if (affectedFiles.length === 0) return;
|
|
237
|
+
if (!confirm(`Remove "${dirPath}" and all ${affectedFiles.length} file(s)?`)) return;
|
|
238
|
+
setFiles((prev) => prev.filter((f) => !f.path.startsWith(prefix)));
|
|
239
|
+
if (selectedPath && selectedPath.startsWith(prefix)) {
|
|
240
|
+
setSelectedPath(null);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function removeFile(filePath) {
|
|
244
|
+
const fileName = filePath.split("/").pop() ?? filePath;
|
|
245
|
+
if (!confirm(`Remove file "${fileName}"?`)) return;
|
|
246
|
+
setFiles((prev) => prev.filter((f) => f.path !== filePath));
|
|
247
|
+
if (selectedPath === filePath) {
|
|
248
|
+
setSelectedPath(null);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function addFileInDir(dirPath) {
|
|
252
|
+
const name = newFileName.trim();
|
|
253
|
+
if (!name) return;
|
|
254
|
+
const filePath = dirPath ? `${dirPath}/${name}` : name;
|
|
255
|
+
if (files.some((f) => f.path === filePath)) return;
|
|
256
|
+
setFiles((prev) => [...prev, { path: filePath, content: "" }]);
|
|
257
|
+
setSelectedPath(filePath);
|
|
258
|
+
setNewFileName("");
|
|
259
|
+
setAddingFileInDir(null);
|
|
260
|
+
}
|
|
261
|
+
async function handleSave() {
|
|
262
|
+
setSaving(true);
|
|
263
|
+
try {
|
|
264
|
+
await onSave(files);
|
|
265
|
+
} finally {
|
|
266
|
+
setSaving(false);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function renderTreeNode(node, depth) {
|
|
270
|
+
const isExpanded = expanded.has(node.fullPath);
|
|
271
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
272
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
273
|
+
"div",
|
|
274
|
+
{
|
|
275
|
+
className: `flex items-center justify-between cursor-pointer hover:bg-muted/50 py-1 pr-2`,
|
|
276
|
+
style: { paddingLeft: `${depth * 16 + 8}px` },
|
|
277
|
+
onClick: () => toggleExpand(node.fullPath),
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium text-xs truncate flex items-center gap-1", children: [
|
|
280
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: isExpanded ? "\u25BE" : "\u25B8" }),
|
|
281
|
+
node.name,
|
|
282
|
+
"/"
|
|
283
|
+
] }),
|
|
284
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
285
|
+
"button",
|
|
286
|
+
{
|
|
287
|
+
onClick: (e) => {
|
|
288
|
+
e.stopPropagation();
|
|
289
|
+
removeDir(node.fullPath);
|
|
290
|
+
},
|
|
291
|
+
className: "text-muted-foreground hover:text-destructive text-xs ml-1 shrink-0",
|
|
292
|
+
children: "\xD7"
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
isExpanded && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
299
|
+
node.children.map((child) => renderTreeNode(child, depth + 1)),
|
|
300
|
+
node.files.map((file) => {
|
|
301
|
+
const fileName = file.path.split("/").pop() ?? file.path;
|
|
302
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
className: `flex items-center justify-between cursor-pointer hover:bg-muted/30 py-1 pr-2 ${selectedPath === file.path ? "bg-primary/10 text-primary" : ""}`,
|
|
306
|
+
style: { paddingLeft: `${(depth + 1) * 16 + 8}px` },
|
|
307
|
+
onClick: () => setSelectedPath(file.path),
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs truncate", children: fileName }),
|
|
310
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
311
|
+
"button",
|
|
312
|
+
{
|
|
313
|
+
onClick: (e) => {
|
|
314
|
+
e.stopPropagation();
|
|
315
|
+
removeFile(file.path);
|
|
316
|
+
},
|
|
317
|
+
className: "text-muted-foreground hover:text-destructive text-xs ml-1 shrink-0",
|
|
318
|
+
children: "\xD7"
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
file.path
|
|
324
|
+
);
|
|
325
|
+
}),
|
|
326
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { paddingLeft: `${(depth + 1) * 16 + 8}px` }, className: "py-1 pr-2", children: addingFileInDir === node.fullPath ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
|
|
327
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
328
|
+
chunkXXF4U7WL_cjs.Input,
|
|
329
|
+
{
|
|
330
|
+
value: newFileName,
|
|
331
|
+
onChange: (e) => setNewFileName(e.target.value),
|
|
332
|
+
placeholder: "file.md",
|
|
333
|
+
className: "h-6 text-xs",
|
|
334
|
+
onKeyDown: (e) => e.key === "Enter" && addFileInDir(node.fullPath),
|
|
335
|
+
autoFocus: true
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Button, { onClick: () => addFileInDir(node.fullPath), size: "sm", className: "h-6 text-xs px-2", children: "+" })
|
|
339
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
340
|
+
"button",
|
|
341
|
+
{
|
|
342
|
+
onClick: () => {
|
|
343
|
+
setAddingFileInDir(node.fullPath);
|
|
344
|
+
setNewFileName("");
|
|
345
|
+
},
|
|
346
|
+
className: "text-xs text-primary hover:underline",
|
|
347
|
+
children: "+ File"
|
|
348
|
+
}
|
|
349
|
+
) })
|
|
350
|
+
] })
|
|
351
|
+
] }, node.fullPath);
|
|
352
|
+
}
|
|
353
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
|
|
355
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
356
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold", children: title }),
|
|
357
|
+
isDirty && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Badge, { variant: "destructive", className: "text-xs", children: "Unsaved changes" }),
|
|
358
|
+
readOnly && /* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Badge, { variant: "secondary", className: "text-xs", children: "Read-only" })
|
|
359
|
+
] }),
|
|
360
|
+
!readOnly && !hideSave && /* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Button, { onClick: handleSave, disabled: saving || !isDirty, size: "sm", children: saving ? "Saving..." : saveLabel })
|
|
361
|
+
] }),
|
|
362
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 min-h-[500px]", children: [
|
|
363
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-64 shrink-0 border border-border rounded-md overflow-hidden", children: [
|
|
364
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 bg-muted/50 border-b border-border flex items-center justify-between", children: [
|
|
365
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground", children: title }),
|
|
366
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
367
|
+
"button",
|
|
368
|
+
{
|
|
369
|
+
onClick: () => setShowAddFolder(!showAddFolder),
|
|
370
|
+
className: "text-xs text-primary hover:underline",
|
|
371
|
+
children: [
|
|
372
|
+
"+ ",
|
|
373
|
+
addFolderLabel
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
)
|
|
377
|
+
] }),
|
|
378
|
+
showAddFolder && !readOnly && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 border-b border-border flex gap-1", children: [
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
380
|
+
chunkXXF4U7WL_cjs.Input,
|
|
381
|
+
{
|
|
382
|
+
value: newFolderName,
|
|
383
|
+
onChange: (e) => setNewFolderName(e.target.value),
|
|
384
|
+
placeholder: "folder-name",
|
|
385
|
+
className: "h-7 text-xs",
|
|
386
|
+
onKeyDown: (e) => e.key === "Enter" && addFolder(),
|
|
387
|
+
autoFocus: true
|
|
388
|
+
}
|
|
389
|
+
),
|
|
390
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Button, { onClick: addFolder, size: "sm", className: "h-7 text-xs px-2", children: "Add" })
|
|
391
|
+
] }),
|
|
392
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm overflow-y-auto", children: [
|
|
393
|
+
tree.rootFiles.map((file) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
394
|
+
"div",
|
|
395
|
+
{
|
|
396
|
+
className: `flex items-center justify-between cursor-pointer hover:bg-muted/30 py-1 pr-2 ${selectedPath === file.path ? "bg-primary/10 text-primary" : ""}`,
|
|
397
|
+
style: { paddingLeft: "8px" },
|
|
398
|
+
onClick: () => setSelectedPath(file.path),
|
|
399
|
+
children: [
|
|
400
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs truncate", children: file.path }),
|
|
401
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
402
|
+
"button",
|
|
403
|
+
{
|
|
404
|
+
onClick: (e) => {
|
|
405
|
+
e.stopPropagation();
|
|
406
|
+
removeFile(file.path);
|
|
407
|
+
},
|
|
408
|
+
className: "text-muted-foreground hover:text-destructive text-xs ml-1 shrink-0",
|
|
409
|
+
children: "\xD7"
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
]
|
|
413
|
+
},
|
|
414
|
+
file.path
|
|
415
|
+
)),
|
|
416
|
+
tree.rootDirs.map((node) => renderTreeNode(node, 0)),
|
|
417
|
+
files.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "p-3 text-xs text-muted-foreground", children: readOnly ? "No files." : `No ${title.toLowerCase()} yet. Add a ${addFolderLabel.toLowerCase()} to get started.` })
|
|
418
|
+
] })
|
|
419
|
+
] }),
|
|
420
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 border border-border rounded-md overflow-hidden", children: activeFile ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full flex flex-col", children: [
|
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-1.5 bg-muted/50 border-b border-border text-xs text-muted-foreground", children: activeFile.path }),
|
|
422
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
+
CodeMirror__default.default,
|
|
424
|
+
{
|
|
425
|
+
value: activeFile.content,
|
|
426
|
+
onChange: handleEditorChange,
|
|
427
|
+
readOnly,
|
|
428
|
+
theme: themeOneDark.oneDark,
|
|
429
|
+
extensions: getLanguageExtension(activeFile.path),
|
|
430
|
+
height: "100%",
|
|
431
|
+
className: "flex-1 overflow-auto",
|
|
432
|
+
basicSetup: {
|
|
433
|
+
lineNumbers: true,
|
|
434
|
+
foldGutter: true,
|
|
435
|
+
bracketMatching: true
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: [
|
|
440
|
+
"Select a file to ",
|
|
441
|
+
readOnly ? "view" : "edit"
|
|
442
|
+
] }) })
|
|
443
|
+
] }) })
|
|
444
|
+
] });
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
exports.Card = Card;
|
|
448
|
+
exports.CardContent = CardContent;
|
|
449
|
+
exports.CardDescription = CardDescription;
|
|
450
|
+
exports.CardHeader = CardHeader;
|
|
451
|
+
exports.CardTitle = CardTitle;
|
|
452
|
+
exports.FileTreeEditor = FileTreeEditor;
|
|
453
|
+
exports.Skeleton = Skeleton;
|
|
454
|
+
exports.useApi = useApi;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React4 from 'react';
|
|
2
2
|
import { createContext, useRef, useMemo, useContext } from 'react';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import useSWR from 'swr';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
4
|
import { clsx } from 'clsx';
|
|
6
5
|
import { twMerge } from 'tailwind-merge';
|
|
7
6
|
import { cva } from 'class-variance-authority';
|
|
@@ -75,24 +74,6 @@ function useNavigation() {
|
|
|
75
74
|
}
|
|
76
75
|
return ctx;
|
|
77
76
|
}
|
|
78
|
-
function useApi(key, fetcher, options) {
|
|
79
|
-
const client = useAgentPlaneClient();
|
|
80
|
-
const onAuthError = useAuthError();
|
|
81
|
-
return useSWR(
|
|
82
|
-
key,
|
|
83
|
-
() => fetcher(client),
|
|
84
|
-
{
|
|
85
|
-
revalidateOnFocus: false,
|
|
86
|
-
errorRetryCount: 3,
|
|
87
|
-
onError: (err) => {
|
|
88
|
-
if (onAuthError && err && typeof err === "object" && "status" in err && err.status === 401) {
|
|
89
|
-
onAuthError(err instanceof Error ? err : new Error(String(err)));
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
...options
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
77
|
function cn(...inputs) {
|
|
97
78
|
return twMerge(clsx(inputs));
|
|
98
79
|
}
|
|
@@ -124,7 +105,7 @@ var buttonVariants = cva(
|
|
|
124
105
|
}
|
|
125
106
|
}
|
|
126
107
|
);
|
|
127
|
-
var Button =
|
|
108
|
+
var Button = React4.forwardRef(
|
|
128
109
|
({ className, variant, size, ...props }, ref) => {
|
|
129
110
|
return /* @__PURE__ */ jsx(
|
|
130
111
|
"button",
|
|
@@ -137,26 +118,6 @@ var Button = React3.forwardRef(
|
|
|
137
118
|
}
|
|
138
119
|
);
|
|
139
120
|
Button.displayName = "Button";
|
|
140
|
-
var Card = React3.forwardRef(
|
|
141
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("rounded-xl border bg-card text-card-foreground shadow", className), ...props })
|
|
142
|
-
);
|
|
143
|
-
Card.displayName = "Card";
|
|
144
|
-
var CardHeader = React3.forwardRef(
|
|
145
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
146
|
-
);
|
|
147
|
-
CardHeader.displayName = "CardHeader";
|
|
148
|
-
var CardTitle = React3.forwardRef(
|
|
149
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("font-semibold leading-none tracking-tight", className), ...props })
|
|
150
|
-
);
|
|
151
|
-
CardTitle.displayName = "CardTitle";
|
|
152
|
-
var CardDescription = React3.forwardRef(
|
|
153
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
|
|
154
|
-
);
|
|
155
|
-
CardDescription.displayName = "CardDescription";
|
|
156
|
-
var CardContent = React3.forwardRef(
|
|
157
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
158
|
-
);
|
|
159
|
-
CardContent.displayName = "CardContent";
|
|
160
121
|
var badgeVariants = cva(
|
|
161
122
|
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
162
123
|
{
|
|
@@ -176,7 +137,7 @@ var badgeVariants = cva(
|
|
|
176
137
|
function Badge({ className, variant, ...props }) {
|
|
177
138
|
return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
178
139
|
}
|
|
179
|
-
var Input =
|
|
140
|
+
var Input = React4.forwardRef(
|
|
180
141
|
({ className, type, ...props }, ref) => {
|
|
181
142
|
return /* @__PURE__ */ jsx(
|
|
182
143
|
"input",
|
|
@@ -193,8 +154,78 @@ var Input = React3.forwardRef(
|
|
|
193
154
|
}
|
|
194
155
|
);
|
|
195
156
|
Input.displayName = "Input";
|
|
196
|
-
function
|
|
197
|
-
return /* @__PURE__ */
|
|
157
|
+
function FormField({ label, children, error, hint }) {
|
|
158
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
159
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: label }),
|
|
160
|
+
children,
|
|
161
|
+
hint && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: hint }),
|
|
162
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive mt-1", children: error })
|
|
163
|
+
] });
|
|
164
|
+
}
|
|
165
|
+
function Dialog({ open, onOpenChange, children }) {
|
|
166
|
+
React4.useEffect(() => {
|
|
167
|
+
if (!open) return;
|
|
168
|
+
function onKeyDown(e) {
|
|
169
|
+
if (e.key === "Escape") onOpenChange(false);
|
|
170
|
+
}
|
|
171
|
+
document.addEventListener("keydown", onKeyDown);
|
|
172
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
173
|
+
}, [open, onOpenChange]);
|
|
174
|
+
React4.useEffect(() => {
|
|
175
|
+
if (!open) return;
|
|
176
|
+
const prev = document.body.style.overflow;
|
|
177
|
+
document.body.style.overflow = "hidden";
|
|
178
|
+
return () => {
|
|
179
|
+
document.body.style.overflow = prev;
|
|
180
|
+
};
|
|
181
|
+
}, [open]);
|
|
182
|
+
if (!open) return null;
|
|
183
|
+
return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
|
|
184
|
+
/* @__PURE__ */ jsx(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
className: "absolute inset-0 bg-black/60 animate-dialog-overlay",
|
|
188
|
+
onClick: () => onOpenChange(false)
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
children
|
|
192
|
+
] });
|
|
193
|
+
}
|
|
194
|
+
function DialogContent({ className, children, ...props }) {
|
|
195
|
+
return /* @__PURE__ */ jsx(
|
|
196
|
+
"div",
|
|
197
|
+
{
|
|
198
|
+
className: cn(
|
|
199
|
+
"relative z-10 w-full bg-background border border-border rounded-xl shadow-2xl mx-4 max-h-[85vh] overflow-y-auto animate-dialog-content",
|
|
200
|
+
className
|
|
201
|
+
),
|
|
202
|
+
onClick: (e) => e.stopPropagation(),
|
|
203
|
+
...props,
|
|
204
|
+
children
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function DialogHeader({ className, children, ...props }) {
|
|
209
|
+
return /* @__PURE__ */ jsx("div", { className: cn("px-6 pt-6 pb-0", className), ...props, children });
|
|
210
|
+
}
|
|
211
|
+
function DialogBody({ className, children, ...props }) {
|
|
212
|
+
return /* @__PURE__ */ jsx("div", { className: cn("px-6 py-4", className), ...props, children });
|
|
213
|
+
}
|
|
214
|
+
function DialogFooter({ className, children, ...props }) {
|
|
215
|
+
return /* @__PURE__ */ jsx(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
className: cn("flex items-center justify-end gap-2 px-6 py-4 border-t border-border bg-muted/30 rounded-b-xl", className),
|
|
219
|
+
...props,
|
|
220
|
+
children
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
function DialogTitle({ className, children, ...props }) {
|
|
225
|
+
return /* @__PURE__ */ jsx("h2", { className: cn("text-base font-semibold", className), ...props, children });
|
|
226
|
+
}
|
|
227
|
+
function DialogDescription({ className, children, ...props }) {
|
|
228
|
+
return /* @__PURE__ */ jsx("p", { className: cn("text-sm text-muted-foreground mt-1", className), ...props, children });
|
|
198
229
|
}
|
|
199
230
|
|
|
200
|
-
export { AgentPlaneProvider, Badge, Button,
|
|
231
|
+
export { AgentPlaneProvider, Badge, Button, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, FormField, Input, badgeVariants, buttonVariants, cn, supportsClaudeRunner, useAgentPlaneClient, useAuthError, useNavigation };
|