@puddle-code/cli 0.0.7 → 0.0.9
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/CHANGELOG.md +15 -4
- package/dist/index.js +71 -5
- package/dist/public/assets/Dashboard-CAM3cXGU.js +1 -0
- package/dist/public/assets/{EditorTabClose-DziQNlDZ.js → EditorTabClose-CnJvqROE.js} +1 -1
- package/dist/public/assets/{ModelRefcount-BD4m7wnM.js → ModelRefcount-DxceM9Ni.js} +1 -1
- package/dist/public/assets/PaneEditorBody-Xz_NA7oS.js +1 -0
- package/dist/public/assets/SettingsDialog-CGLXP6AW.js +1 -0
- package/dist/public/assets/{Terminal-DP-hFsEc.js → Terminal-DwGMsU4j.js} +2 -2
- package/dist/public/assets/Workspace-vM9qSoWV.js +7 -0
- package/dist/public/assets/api-MnOKfpqf.js +73 -0
- package/dist/public/assets/{buffer-store-C23koXgg.js → buffer-store-BLJJ5bBb.js} +3 -3
- package/dist/public/assets/context-menu-DDQiarCp.js +1 -0
- package/dist/public/assets/{cssMode-BBQ4UYhd.js → cssMode-BRkqXiJB.js} +1 -1
- package/dist/public/assets/dist-VDiYuPKw.js +1 -0
- package/dist/public/assets/{editor-tabs-CFnvx1pN.js → editor-tabs-DHrvhXUq.js} +1 -1
- package/dist/public/assets/{htmlMode-CiqvxxB5.js → htmlMode-BqZkTR1f.js} +1 -1
- package/dist/public/assets/index-B3xVOA2-.css +2 -0
- package/dist/public/assets/index-QU4DiDhV.js +10 -0
- package/dist/public/assets/{jsonMode-B7C2cbcC.js → jsonMode-CyukyrLW.js} +1 -1
- package/dist/public/assets/session-seed-CRfTF2sq.js +1 -0
- package/dist/public/assets/ssh-mode-d5hq-vUb.js +1 -0
- package/dist/public/assets/{tsMode-ByErjETq.js → tsMode-ClBkYZNn.js} +1 -1
- package/dist/public/index.html +3 -3
- package/package.json +1 -1
- package/dist/public/assets/Dashboard-DHkzWFd7.js +0 -1
- package/dist/public/assets/PaneEditorBody-6h7v53Gs.js +0 -1
- package/dist/public/assets/SettingsDialog-DEVVkj7N.js +0 -1
- package/dist/public/assets/Workspace-BoKA3JKo.js +0 -6
- package/dist/public/assets/api-L5qtWa7E.js +0 -73
- package/dist/public/assets/context-menu-0Mq8MFLs.js +0 -1
- package/dist/public/assets/dist-fdPAlKke.js +0 -1
- package/dist/public/assets/index-Dg2mfzDf.css +0 -2
- package/dist/public/assets/index-bqEa9yZh.js +0 -10
- package/dist/public/assets/session-seed-BafHkB3F.js +0 -1
- package/dist/public/assets/ssh-mode-DIXigRzL.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,20 @@ Past releases: see docs/changelogs/.
|
|
|
7
7
|
|
|
8
8
|
# Changelog
|
|
9
9
|
|
|
10
|
-
## [0.0.
|
|
10
|
+
## [0.0.9] — 2026-07-21
|
|
11
11
|
|
|
12
|
-
###
|
|
12
|
+
### Added
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
14
|
+
- **Settings → Sync**: export a profile's machine-agnostic settings (Appearance, Profile glyph, Sessions, Editor, Hotkeys — never accounts, repos, or paths) as one opaque string and import it on another machine, updating only the fields it carries. A collapsible checklist chooses what to include; the string is gzip+base64 with a CRC-32 integrity check and a random Caesar shuffle (decoded via the known gzip `H` prefix).
|
|
15
|
+
- Customisable **keyboard shortcuts** (Settings → Hotkeys), stored per profile. Rebind the global/layout actions — command palette, close tab (⌃⌥W), toggle left/right sidebar (⌥⌘, / ⌥⌘.), open a navigator (⌥⌘E/F/V/B), new agent (⌃⌥\`), new terminal (⌃\`), toggle Scratchpad (⌥⌘S), editor save/word-wrap — with a key recorder, reset-to-default, and conflict + browser-reserved warnings. Filetree and terminal line-edit keys stay fixed. (protocol 7.6)
|
|
16
|
+
- The session lifecycle menu gains "Spawn agent in worktree" — a submenu of the profile's logged-in accounts (the default account first, so opening it and pressing Enter spawns the default) that starts an agent joining the session's existing worktree, alongside the existing "Open terminal in worktree".
|
|
17
|
+
- The homescreen gains two action tiles in the projects grid: "Open project" (the new-project dialogue) and "Open terminal" — a shell at `~` on the daemon host in a heading-less bottom pane that exists only on the homescreen, for cloning repositories before opening them as projects. One shell at a time: while it lives, opening reattaches to it (the tile reads "Close terminal", which ends it). Protocol 7.5: the `home` PTY stream and the `kill-shell` WS message.
|
|
18
|
+
- Storm-navy is now a profile icon colour (the theme-aware primary ink — navy in light, near-white in dark).
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Protocol bumped to **8.0** (a deliberate major bump with no schema change) so every connected daemon hits a major mismatch on the next handshake and auto-upgrades onto this build, picking up the accumulated 7.x daemon-side changes.
|
|
23
|
+
- The profile icon picker is now a small curated set of ~60 lucide glyphs in a simple grid, all statically imported — no lazy-loaded per-icon chunks, no search, no scroll. This replaces the full searchable set, which relied on lazy chunks that could 404 behind a stale shell and never scrolled reliably in the popover.
|
|
24
|
+
- The profile icon "Default" now renders a neutral grey glyph rather than the navy heading ink (navy is its own explicit swatch), and the near-duplicate amber and accent swatches were dropped from the picker.
|
|
25
|
+
- Scratchpad entries drag from anywhere on the row (the grip handle is gone, reclaiming the left gutter), and editing now happens in a modal opened by clicking the row (or the `+`/pencil) rather than expanding inline.
|
|
26
|
+
- Deleting a Scratchpad entry now asks for confirmation inline — a warning line with Delete/Cancel — instead of removing it on the first click, since there is no undo.
|
package/dist/index.js
CHANGED
|
@@ -4167,7 +4167,7 @@ function openBrowser(url2, platform = process.platform) {
|
|
|
4167
4167
|
}
|
|
4168
4168
|
|
|
4169
4169
|
// ../shared/src/protocol.ts
|
|
4170
|
-
var PROTOCOL_VERSION = { major:
|
|
4170
|
+
var PROTOCOL_VERSION = { major: 8, minor: 0 };
|
|
4171
4171
|
|
|
4172
4172
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
4173
4173
|
var external_exports = {};
|
|
@@ -18768,6 +18768,10 @@ var profileSchema = external_exports.object({
|
|
|
18768
18768
|
id: profileId,
|
|
18769
18769
|
name: fsSafeName,
|
|
18770
18770
|
branch_prefix: external_exports.string(),
|
|
18771
|
+
/** Lucide icon name (kebab-case, e.g. `rocket`); null → the default person glyph. */
|
|
18772
|
+
icon: external_exports.string().nullable().default(null),
|
|
18773
|
+
/** A `PROFILE_ICON_COLOURS` key; null → the default heading colour. */
|
|
18774
|
+
icon_colour: external_exports.string().nullable().default(null),
|
|
18771
18775
|
created_at: isoTimestamp
|
|
18772
18776
|
});
|
|
18773
18777
|
var createProfileRequestSchema = external_exports.object({
|
|
@@ -18776,7 +18780,11 @@ var createProfileRequestSchema = external_exports.object({
|
|
|
18776
18780
|
});
|
|
18777
18781
|
var patchProfileRequestSchema = external_exports.object({
|
|
18778
18782
|
name: fsSafeName.optional(),
|
|
18779
|
-
branch_prefix: external_exports.string().max(64).optional()
|
|
18783
|
+
branch_prefix: external_exports.string().max(64).optional(),
|
|
18784
|
+
/** Set/clear the profile's lucide icon (kebab-case name); null clears it. */
|
|
18785
|
+
icon: external_exports.string().max(64).nullable().optional(),
|
|
18786
|
+
/** Set/clear the icon colour (a `PROFILE_ICON_COLOURS` key); null clears it. */
|
|
18787
|
+
icon_colour: external_exports.string().max(32).nullable().optional()
|
|
18780
18788
|
});
|
|
18781
18789
|
var sessionSeedSchema = external_exports.looseObject({
|
|
18782
18790
|
baseBranch: external_exports.string().optional(),
|
|
@@ -18821,7 +18829,13 @@ var profileSettingsSchema = external_exports.looseObject({
|
|
|
18821
18829
|
* absent or empty means the repository's default base branch. The modal
|
|
18822
18830
|
* still enforces that a separate branch always gets its own directory.
|
|
18823
18831
|
*/
|
|
18824
|
-
sessionDefaults: sessionDefaultsSchema.optional()
|
|
18832
|
+
sessionDefaults: sessionDefaultsSchema.optional(),
|
|
18833
|
+
/**
|
|
18834
|
+
* Per-profile keyboard-shortcut overrides (SPEC §11): action-id → canonical
|
|
18835
|
+
* binding string (e.g. `meta+shift+KeyE`). Absent keys use the app default;
|
|
18836
|
+
* the web owns the action registry and the binding format.
|
|
18837
|
+
*/
|
|
18838
|
+
hotkeys: external_exports.record(external_exports.string(), external_exports.string()).optional()
|
|
18825
18839
|
});
|
|
18826
18840
|
var patchProfileSettingsRequestSchema = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
18827
18841
|
|
|
@@ -19104,6 +19118,41 @@ var projectDetailSchema = external_exports.object({
|
|
|
19104
19118
|
sessions: external_exports.array(sessionSchema)
|
|
19105
19119
|
});
|
|
19106
19120
|
|
|
19121
|
+
// ../shared/src/api/scratchpad.ts
|
|
19122
|
+
var scratchpadScopeSchema = external_exports.enum(["project", "profile"]);
|
|
19123
|
+
var scratchpadEntrySchema = external_exports.object({
|
|
19124
|
+
id: rowId,
|
|
19125
|
+
profile_id: profileId,
|
|
19126
|
+
scope: scratchpadScopeSchema,
|
|
19127
|
+
/** Set iff `scope === 'project'` — the project the entry belongs to. */
|
|
19128
|
+
project_id: projectId.nullable(),
|
|
19129
|
+
title: external_exports.string().nullable(),
|
|
19130
|
+
body: external_exports.string(),
|
|
19131
|
+
tags: external_exports.array(external_exports.string()),
|
|
19132
|
+
agent_type: external_exports.string().nullable(),
|
|
19133
|
+
position: external_exports.number(),
|
|
19134
|
+
created_at: isoTimestamp,
|
|
19135
|
+
updated_at: isoTimestamp
|
|
19136
|
+
});
|
|
19137
|
+
var createScratchpadRequestSchema = external_exports.object({
|
|
19138
|
+
profile_id: profileId,
|
|
19139
|
+
scope: scratchpadScopeSchema,
|
|
19140
|
+
project_id: projectId.optional(),
|
|
19141
|
+
title: external_exports.string().max(200).optional(),
|
|
19142
|
+
body: external_exports.string().min(1),
|
|
19143
|
+
tags: external_exports.array(external_exports.string()).optional(),
|
|
19144
|
+
agent_type: external_exports.string().optional()
|
|
19145
|
+
});
|
|
19146
|
+
var patchScratchpadRequestSchema = external_exports.object({
|
|
19147
|
+
scope: scratchpadScopeSchema.optional(),
|
|
19148
|
+
project_id: projectId.nullable().optional(),
|
|
19149
|
+
title: external_exports.string().max(200).nullable().optional(),
|
|
19150
|
+
body: external_exports.string().min(1).optional(),
|
|
19151
|
+
tags: external_exports.array(external_exports.string()).optional(),
|
|
19152
|
+
agent_type: external_exports.string().nullable().optional(),
|
|
19153
|
+
position: external_exports.number().optional()
|
|
19154
|
+
});
|
|
19155
|
+
|
|
19107
19156
|
// ../shared/src/api/ui-state.ts
|
|
19108
19157
|
var editorTabRefSchema = external_exports.object({
|
|
19109
19158
|
session: sessionId,
|
|
@@ -19155,6 +19204,12 @@ var uiStateSnapshotSchema = external_exports.looseObject({
|
|
|
19155
19204
|
sidebar_collapsed: external_exports.boolean().default(false),
|
|
19156
19205
|
/** Whether the right sessions sidebar is collapsed to a slim rail. */
|
|
19157
19206
|
sessions_collapsed: external_exports.boolean().default(false),
|
|
19207
|
+
/**
|
|
19208
|
+
* Which view the right sidebar shows: the session list or the Scratchpad
|
|
19209
|
+
* panel (SPEC §8/§11). A loose extension key — an older daemon that omits it
|
|
19210
|
+
* reads as `sessions`.
|
|
19211
|
+
*/
|
|
19212
|
+
right_panel: external_exports.enum(["sessions", "scratchpad"]).default("sessions"),
|
|
19158
19213
|
/**
|
|
19159
19214
|
* User-chosen order of the sessions sidebar (session ids). Sessions not
|
|
19160
19215
|
* listed here (newly created ones) sort to the top; the list is otherwise
|
|
@@ -19197,9 +19252,18 @@ var resolvePathResponseSchema = external_exports.object({
|
|
|
19197
19252
|
// ../shared/src/api/worktree-files.ts
|
|
19198
19253
|
var treeEntrySchema = external_exports.object({
|
|
19199
19254
|
name: external_exports.string(),
|
|
19255
|
+
/**
|
|
19256
|
+
* The *resolved* kind: a symlink to a directory is `dir` (so it's explorable)
|
|
19257
|
+
* and a symlink to a file is `file` (so it opens); `symlink` is reserved for a
|
|
19258
|
+
* link that is broken or whose target escapes the worktree — a non-expandable
|
|
19259
|
+
* leaf. Pair with `symlink` to know whether the entry is itself a link.
|
|
19260
|
+
*/
|
|
19200
19261
|
type: external_exports.enum(["file", "dir", "symlink"]),
|
|
19201
19262
|
/** Bytes on disk; null for directories and symlinks (size is meaningless there). */
|
|
19202
|
-
size: external_exports.number().int().nonnegative().nullable()
|
|
19263
|
+
size: external_exports.number().int().nonnegative().nullable(),
|
|
19264
|
+
/** The entry is a symbolic link — the tree shows the link icon at its root,
|
|
19265
|
+
* regardless of the resolved `type`. Optional for wire back-compat. */
|
|
19266
|
+
symlink: external_exports.boolean().default(false)
|
|
19203
19267
|
});
|
|
19204
19268
|
var treeResponseSchema = external_exports.object({
|
|
19205
19269
|
path: external_exports.string(),
|
|
@@ -19364,6 +19428,8 @@ var wsClientMessageSchema = external_exports.discriminatedUnion("t", [
|
|
|
19364
19428
|
external_exports.object({ t: external_exports.literal("resize"), session: external_exports.string(), term: termId, ...dims }),
|
|
19365
19429
|
external_exports.object({ t: external_exports.literal("detach"), session: external_exports.string(), term: termId }),
|
|
19366
19430
|
external_exports.object({ t: external_exports.literal("spawn-shell"), session: external_exports.string() }),
|
|
19431
|
+
/** Terminate a shell PTY (never the agent term); viewers learn via `exit`. */
|
|
19432
|
+
external_exports.object({ t: external_exports.literal("kill-shell"), session: external_exports.string(), term: termId }),
|
|
19367
19433
|
external_exports.object({ t: external_exports.literal("subscribe-status") })
|
|
19368
19434
|
]);
|
|
19369
19435
|
|
|
@@ -19540,7 +19606,7 @@ import { readFileSync } from "node:fs";
|
|
|
19540
19606
|
import { dirname, join as join2 } from "node:path";
|
|
19541
19607
|
import { fileURLToPath } from "node:url";
|
|
19542
19608
|
function cliVersion() {
|
|
19543
|
-
if (true) return "0.0.
|
|
19609
|
+
if (true) return "0.0.9";
|
|
19544
19610
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
19545
19611
|
for (const candidate of [
|
|
19546
19612
|
join2(here, "..", "..", "package.json"),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{b as r,i}from"./api-MnOKfpqf.js";import{a,g as o,i as s,n as c,o as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./utils-B6KiDbIe.js";import{A as f,O as p,c as m,j as h,k as g,n as _,r as v,t as y}from"./context-menu-DDQiarCp.js";import{i as b,r as x}from"./dist-VDiYuPKw.js";import{Ct as S,Ft as C,K as w,Mt as T,O as E,Ot as D,P as O,Pt as k,T as A,U as j,_t as M,bt as N,gt as P,nn as F,u as I,z as L}from"./index-QU4DiDhV.js";var R=e(t(),1),z=n(),B=!1;function V(){let[e,t]=(0,R.useState)(B),[n,r]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e)return;let t=!1;return E.spawnShell(i).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let a=()=>{B=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&E.killShell(i,n),a()):(B=!0,t(!0))},onExit:a}}function H({term:e,onExit:t}){return(0,z.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,z.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,z.jsx)(I,{stream:`home`,term:e,onExit:t})})})}var U=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function W({projectId:e}){let t=T(e),n=(0,R.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),U.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function G({icon:e,label:t,onClick:n}){return(0,z.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,z.jsx)(e,{className:`size-4`})})}function K({project:e,repoPath:t,draggable:n,dragging:i,onDragStart:p,onDragEnd:g,onDragOver:b}){let x=M(),[S,w]=(0,R.useState)(!1),[T,E]=(0,R.useState)(e.name),D=t=>x.mutate({id:e.id,archived:t},{onError:e=>r.error(e.message)}),O=()=>{let t=T.trim();if(!t||t===e.name){w(!1);return}x.mutate({id:e.id,name:t},{onSuccess:()=>w(!1),onError:e=>r.error(e.message)})};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(y,{children:[(0,z.jsx)(m,{asChild:!0,children:(0,z.jsxs)(`div`,{draggable:n,onDragStart:p,onDragEnd:g,onDragOver:b,className:d(`group relative transition-opacity`,i&&`opacity-50`),children:[(0,z.jsxs)(F,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,z.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{projectId:e.id})})]}),(0,z.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex`,children:e.archived?(0,z.jsx)(G,{icon:h,label:`Reopen project`,onClick:()=>D(!1)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(G,{icon:j,label:`Rename project`,onClick:()=>{E(e.name),w(!0)}}),(0,z.jsx)(G,{icon:f,label:`Archive project`,onClick:()=>D(!0)})]})})]})}),(0,z.jsx)(_,{children:e.archived?(0,z.jsxs)(v,{onSelect:()=>D(!1),children:[(0,z.jsx)(h,{}),` Reopen`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(v,{onSelect:()=>{E(e.name),w(!0)},children:[(0,z.jsx)(j,{}),` Rename`]}),(0,z.jsxs)(v,{onSelect:()=>D(!0),children:[(0,z.jsx)(f,{}),` Archive`]})]})})]}),(0,z.jsx)(u,{open:S,onOpenChange:w,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(a,{children:(0,z.jsx)(l,{children:`Rename project`})}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),O()},children:[(0,z.jsx)(C,{value:T,onChange:e=>E(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(k,{className:`text-fg-muted`,children:`Path`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>w(!1),children:`Cancel`}),(0,z.jsx)(o,{type:`submit`,disabled:!T.trim()||x.isPending,children:`Rename`})]})]})]})})]})}function q({icon:e,label:t,hint:n,onClick:r}){return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,z.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function J(){let e=O(),t=S(e??void 0),n=D(),r=N(e??void 0),i=P(e??``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1),m=V(),h=e=>n.data?.find(t=>t.id===e)?.path,_=t.data??[],v=r.data?.projectOrder??[],y=p(_.filter(e=>!e.archived),v),C=_.filter(e=>e.archived),T=(e,t)=>{e!==t&&i.mutate({projectOrder:g(y.map(e=>e.id),e,t)})};return(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[_.length===0&&(0,z.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,z.jsx)(x,{className:`size-8 text-fg-muted`}),(0,z.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No projects yet — open one below, or press ⌘K.`})]}),(0,z.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[y.map(e=>(0,z.jsx)(K,{project:e,repoPath:h(e.repo_id),draggable:!0,dragging:s===e.id,onDragStart:()=>c(e.id),onDragEnd:()=>c(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&T(s,e.id)}},e.id)),(0,z.jsx)(q,{icon:w,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>o(!0)}),(0,z.jsx)(q,{icon:L,label:m.open?`Close terminal`:`Open terminal`,hint:m.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:m.toggle})]}),C.length>0&&(0,z.jsxs)(`div`,{className:`mt-6`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,z.jsx)(b,{className:d(`size-3 transition-transform`,l&&`rotate-90`)}),(0,z.jsx)(f,{className:`size-3`}),(0,z.jsx)(`span`,{children:`Archived`}),(0,z.jsx)(`span`,{className:`tabular-nums`,children:C.length})]}),l&&(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:C.map(e=>(0,z.jsx)(K,{project:e,repoPath:h(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),m.open&&(0,z.jsx)(H,{term:m.term,onExit:m.onExit}),e!==null&&(0,z.jsx)(A,{profileId:e,open:a,onOpenChange:o})]})}export{J as Dashboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-BLJJ5bBb.js";import{s as h,t as g}from"./editor-sync-F3Wyveaa.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t){let n=m(e,t);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>f(n,e),[n]),()=>p(n))}function x({session:e,path:t,kind:n,label:d,onClose:f}){let p=b(e,t)&&n!==`commit`,[m,x]=(0,v.useState)(!1),S=()=>p?x(!0):f();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,"aria-label":`Close ${d}`,children:p?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_,{className:`size-2 fill-current group-hover:hidden`}),(0,y.jsx)(a,{className:`hidden size-3 group-hover:block`})]}):(0,y.jsx)(a,{className:`size-3 opacity-0 group-hover:opacity-100`})}),(0,y.jsx)(u,{open:m,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(s,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(c,{children:[`Discard changes to `,d,`?`]}),(0,y.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(o,{children:[(0,y.jsx)(i,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(i,{variant:`danger`,onClick:()=>{h(e,t),g(e,t),x(!1),f()},children:`Discard`})]})]})})]})}export{x as EditorTabClose};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-BLJJ5bBb.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path))),o=t.current;for(let e of a)o.has(e)||(r(e),o.add(e));for(let e of[...o])a.has(e)||(n(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)n(e);t.current.clear()},[]),null}export{o as ModelRefcount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{c as r,d as i,f as a,h as o,m as s,n as c,p as l,r as u,t as d}from"./editor-tabs-DHrvhXUq.js";import{b as f,r as p,t as m}from"./api-MnOKfpqf.js";import{t as h}from"./createLucideIcon-DyMAgLa3.js";import{S as g,a as _,o as v,s as y}from"./index-QU4DiDhV.js";import{i as b,r as x}from"./editor.api2-4X9Vh9Zw.js";import{a as S,c as C,d as w,f as T,i as E,l as ee,n as te,o as ne,r as D,s as O,t as k,u as A}from"./buffer-store-BLJJ5bBb.js";import{a as re,c as ie,i as j,l as M,n as N,o as P,r as F,s as I}from"./editor-sync-F3Wyveaa.js";import{r as L}from"./buffer-logic-BrpRsL1b.js";var R=h(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),z=e(t(),1);function B(e){return!e}function V(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=b.CtrlCmd:e===`ctrl`?r|=b.WinCtrl:e===`alt`?r|=b.Alt:e===`shift`&&(r|=b.Shift);let i=x[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function ae(e,t){let n=V(g(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=V(g(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>v({editorWordWrap:B(_().editorWordWrap)})})}function H(e,t,n){let r=k(e,t),i=o(e,t),a=l(e),[s,c]=(0,z.useState)(null),[u,d]=(0,z.useState)(!1),p=(0,z.useRef)(!1),h=(0,z.useRef)(null),g=(0,z.useRef)(null),_=(0,z.useRef)(n);_.current=n;let v=(0,z.useRef)(!1),y=(0,z.useCallback)((e,t)=>{g.current?.cancel(),v.current=!0;try{ne(r,e,t)}finally{v.current=!1}},[r]),b=(0,z.useSyncExternalStore)((0,z.useCallback)(e=>ee(r,e),[r]),()=>D(r)),x=(0,z.useSyncExternalStore)((0,z.useCallback)(e=>P(r,e),[r]),()=>re(r));(0,z.useEffect)(()=>{let n=i.data;if(!n||n.binary||n.content===null||p.current)return;p.current=!0;let a=C(r)!==void 0,o=te(e,t,n.content,n.mtime_ms);c(o),!a&&M(e,t).then(e=>{e&&(e.base_mtime_ms===n.mtime_ms?L(o,e.content)&&d(!0):f(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{L(o,e.content)&&d(!0)}}}))})},[i.data,r,e,t]),(0,z.useEffect)(()=>{if(!s)return;let n=ie(e,t);g.current=n;let i=s.onDidChangeContent(()=>{v.current||(n(s.getValue(),C(r)??0),N(e,t))});return()=>{n.flush(),i.dispose(),g.current=null}},[s,r,e,t]),(0,z.useEffect)(()=>{!s||!x.savedElsewhere||D(r)||i.refetch().then(e=>{D(r)||(e.data&&e.data.content!==null&&y(e.data.content,e.data.mtime_ms),j(r))})},[x.savedElsewhere,s,r]),(0,z.useEffect)(()=>{let e=i.data;!s||!e||e.content===null||!D(r)&&e.mtime_ms!==C(r)&&y(e.content,e.mtime_ms)},[i.data,s,r]);let S=(0,z.useCallback)((n,i)=>{E(r,n,i),g.current?.cancel(),I(e,t),F(e,t,i),d(!1)},[r,e,t]),w=(0,z.useCallback)(()=>{i.refetch().then(n=>{n.data&&n.data.content!==null&&y(n.data.content,n.data.mtime_ms),I(e,t),d(!1)})},[r,e,t,y]),T=(0,z.useCallback)((e,n)=>{a.mutate({path:t,content:e},{onSuccess:e=>S(n,e.mtime_ms),onError:e=>f.error(e instanceof Error?e.message:`Overwrite failed`)})},[a,t,S]),O=(0,z.useCallback)(()=>{if(!s||!D(r))return;let e=s.getValue(),n=s.getAlternativeVersionId();a.mutate({path:t,content:e,expected_mtime_ms:C(r)},{onSuccess:e=>S(n,e.mtime_ms),onError:t=>{t instanceof m&&t.status===409&&t.code===`stale_file`?f.error(`File changed on disk (probably the agent)`,{duration:1/0,action:{label:`Reload`,onClick:()=>w()},cancel:{label:`Overwrite`,onClick:()=>T(e,n)}}):f.error(t instanceof Error?t.message:`Save failed`)}})},[s,r,a,t,S,w,T]),A=(0,z.useRef)(O);A.current=O;let R=(0,z.useCallback)(()=>{let n=h.current,r=_.current;!n||!r||r.session!==e||r.path!==t||(n.revealLineInCenter(r.line),n.setPosition({lineNumber:r.line,column:r.column??1}),n.focus())},[e,t]),B=(0,z.useCallback)(e=>{h.current=e,ae(e,{onSave:()=>A.current()}),R()},[R]);(0,z.useEffect)(()=>{R()},[n,s,R]);let V=(0,z.useCallback)(()=>{w()},[w]),H,U=null;i.data?.binary?H=`binary`:i.error?i.error instanceof m&&i.error.status===413?H=`too-large`:(H=`error`,U=i.error instanceof Error?i.error.message:`Failed to load file`):H=s?`ready`:`loading`;let W=b&&x.savedElsewhere?`saved-elsewhere`:b&&x.dirtyElsewhere?`dirty-elsewhere`:null;return{status:H,errorMessage:U,model:s,dirty:b,restoredNotice:u,discardRestore:V,peerBadge:W,save:O,onMount:B}}var U=n();function W({message:e,session:t,path:n,download:i}){return(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,U.jsx)(`span`,{children:e}),i&&(0,U.jsxs)(`button`,{type:`button`,onClick:()=>void r(t,n).catch(e=>f.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,U.jsx)(R,{className:`size-4`}),`Download`]})]})}function G({session:e,path:t,reveal:n}){let r=y(),i=H(e,t,n),a=(0,z.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(i.status===`binary`)return(0,U.jsx)(W,{message:`Binary file — use Download`,session:e,path:t,download:!0});if(i.status===`too-large`)return(0,U.jsx)(W,{message:`File too large to edit — use Download`,session:e,path:t,download:!0});if(i.status===`error`)return(0,U.jsx)(W,{message:i.errorMessage??`Failed to load file`,session:e,path:t});let o=i.peerBadge===`saved-elsewhere`?`Saved in another window`:i.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,U.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[i.restoredNotice&&(0,U.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,U.jsx)(`span`,{children:`Restored unsaved changes`}),(0,U.jsx)(`button`,{type:`button`,onClick:i.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),o&&(0,U.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:o}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1`,children:i.model&&(0,U.jsx)(w,{path:i.model.uri.toString(),defaultValue:i.model.getValue(),theme:`puddle`,keepCurrentModel:!0,onMount:e=>i.onMount(e),loading:(0,U.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:a,tabSize:r.editorTabSize,wordWrap:r.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function K({children:e}){return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function q(e,t){let n=(0,z.useRef)(t);n.current=t,(0,z.useEffect)(()=>(O(e),()=>{n.current?.(),S(e)}),[e])}function J(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function Y({session:e,refName:t,path:n,content:r}){let i=(0,z.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,U.jsx)(w,{path:J(`puddle-view`,e,t,n),defaultValue:r,theme:A,loading:(0,U.jsx)(K,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:i,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function X({session:e,against:t,path:n}){let r=a(e,t,n);return r.isPending?(0,U.jsx)(K,{children:`…`}):r.error?(0,U.jsx)(K,{children:r.error instanceof Error?r.error.message:`Failed to load`}):r.data.binary?(0,U.jsx)(K,{children:`Binary file — deleted`}):(0,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,U.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,U.jsx)(Y,{session:e,refName:t,path:n,content:r.data.content??``})})]})}function oe({session:e,against:t,path:n,basePath:r}){let i=y(),o=H(e,n,null),s=a(e,t,r),c=(0,z.useRef)(null);q(k(e,n),()=>{let e=c.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),c.current=null});let l=(0,z.useRef)(o.save);l.current=o.save;let u=(0,z.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),d=s.error instanceof m&&s.error.status===404;return o.status===`binary`||s.data?.binary?(0,U.jsx)(K,{children:`Binary file`}):o.status===`too-large`?(0,U.jsx)(K,{children:`File too large to show`}):o.status===`error`?(0,U.jsx)(K,{children:o.errorMessage??`Failed to load file`}):d?(0,U.jsx)(G,{session:e,path:n,reveal:null}):s.isPending||!o.model?(0,U.jsx)(K,{children:`…`}):s.error?(0,U.jsx)(K,{children:s.error instanceof Error?s.error.message:`Failed to load base`}):(0,U.jsx)(T,{modifiedModelPath:o.model.uri.toString(),originalModelPath:J(`puddle-base`,e,t,r),original:s.data.content??``,language:o.model.getLanguageId(),theme:A,keepCurrentModifiedModel:!0,loading:(0,U.jsx)(K,{children:`…`}),onMount:e=>{c.current=e,e.onDidDispose(()=>{c.current=null}),e.getModifiedEditor().addCommand(b.CtrlCmd|x.KeyS,()=>l.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:u,wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function se({session:e,path:t}){return q(k(e,t)),(0,U.jsx)(G,{session:e,path:t,reveal:null})}function ce({session:e,against:t,entry:n}){switch(n.status){case`added`:return(0,U.jsx)(se,{session:e,path:n.path});case`deleted`:return(0,U.jsx)(X,{session:e,against:t,path:n.path});case`modified`:case`renamed`:return(0,U.jsx)(oe,{session:e,against:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function Z({session:e,sha:t,path:n}){let r=a(e,t,n);return r.isPending?(0,U.jsx)(K,{children:`…`}):r.error?(0,U.jsx)(K,{children:r.error instanceof Error?r.error.message:`Failed to load file`}):r.data.binary?(0,U.jsx)(K,{children:`Binary file`}):(0,U.jsx)(Y,{session:e,refName:t,path:n,content:r.data.content??``})}function le({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o}){let s=(0,z.useRef)(null),c=(0,z.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,z.useEffect)(()=>()=>{let e=s.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),s.current=null},[]),(0,U.jsx)(T,{originalModelPath:J(`puddle-hist-orig`,e,t,n),modifiedModelPath:J(`puddle-hist-mod`,e,i,a),original:r,modified:o,theme:A,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,U.jsx)(K,{children:`…`}),onMount:e=>{s.current=e,e.onDidDispose(()=>{s.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:c,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function ue({session:e,sha:t,path:n,basePath:r}){let i=a(e,`${t}^`,r),o=a(e,t,n);return i.error instanceof m&&i.error.status===404?(0,U.jsx)(Z,{session:e,sha:t,path:n}):i.isPending||o.isPending?(0,U.jsx)(K,{children:`…`}):i.error?(0,U.jsx)(K,{children:i.error instanceof Error?i.error.message:`Failed to load original`}):o.error?(0,U.jsx)(K,{children:o.error instanceof Error?o.error.message:`Failed to load file`}):i.data.binary||o.data.binary?(0,U.jsx)(K,{children:`Binary file`}):(0,U.jsx)(le,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:i.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:o.data.content??``})}function de({session:e,sha:t,entry:n,isRootCommit:r}){switch(u(n.status,r)){case`added`:return(0,U.jsx)(Z,{session:e,sha:t,path:n.path});case`deleted`:return(0,U.jsx)(X,{session:e,against:`${t}^`,path:n.path});case`modified`:case`renamed`:return(0,U.jsx)(ue,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function fe({session:e,sha:t,path:n}){let r=i(e,t);if(r.isPending)return(0,U.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(r.error)return(0,U.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load commit`});let a=r.data.files.find(e=>e.path===n);return a?(0,U.jsx)(`div`,{className:`h-full`,children:(0,U.jsx)(de,{session:e,sha:t,entry:a,isRootCommit:r.data.parents.length===0})}):(0,U.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:n}),` is not part of `,t.slice(0,7),`.`]})}function pe({session:e,path:t}){let n=s(e);if(n.isPending)return(0,U.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(n.error)return(0,U.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:n.error instanceof Error?n.error.message:`Failed to load diff`});let r=n.data.entries.find(e=>e.path===t);return r?(0,U.jsx)(`div`,{className:`h-full`,children:(0,U.jsx)(ce,{session:e,against:n.data.against,entry:r})}):(0,U.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,U.jsx)(`span`,{className:`mx-1 font-mono`,children:t}),` against the base.`]})}var me={png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,bmp:`image`,ico:`image`,avif:`image`,svg:`image`,mp4:`video`,m4v:`video`,webm:`video`,mov:`video`,mkv:`video`,avi:`video`,mp3:`audio`,wav:`audio`,ogg:`audio`,m4a:`audio`,flac:`audio`,aac:`audio`,pdf:`pdf`};function Q(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0?null:me[t.slice(n+1).toLowerCase()]??null}function he({session:e,path:t,kind:n}){let{url:r,error:i}=_e(e,t);return i?(0,U.jsxs)($,{children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Couldn’t load this file.`}),(0,U.jsx)(ge,{session:e,path:t})]}):r?n===`image`?(0,U.jsx)($,{children:(0,U.jsx)(`img`,{src:r,alt:t,className:`max-h-full max-w-full object-contain`})}):n===`video`?(0,U.jsx)($,{children:(0,U.jsx)(`video`,{src:r,controls:!0,className:`max-h-full max-w-full`})}):n===`audio`?(0,U.jsx)($,{children:(0,U.jsx)(`audio`,{src:r,controls:!0,className:`w-full max-w-xl`})}):(0,U.jsx)(`iframe`,{src:r,title:t,className:`h-full w-full border-0 bg-ground`}):(0,U.jsx)($,{children:(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`…`})})}function $({children:e}){return(0,U.jsx)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-3 overflow-auto bg-ground p-4`,children:e})}function ge({session:e,path:t}){return(0,U.jsx)(`button`,{type:`button`,onClick:()=>void r(e,t).catch(e=>f.error(e instanceof Error?e.message:`Download failed`)),className:`rounded-md bg-elevated px-3 py-1.5 text-sm text-fg transition-colors hover:bg-border/70`,children:`Download`})}function _e(e,t){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{let n=null,i=!1;return r(null),a(!1),p(`GET`,`/api/worktrees/${e}/media?path=${encodeURIComponent(t)}`).then(e=>e.blob()).then(e=>{i||(n=URL.createObjectURL(e),r(n))}).catch(()=>{i||a(!0)}),()=>{i=!0,n&&URL.revokeObjectURL(n)}},[e,t]),{url:n,error:i}}function ve({tab:e,reveal:t}){let n=c(e);if(n===`diff`)return(0,U.jsx)(pe,{session:e.session,path:e.path},d(e));if(n===`commit`&&e.sha)return(0,U.jsx)(fe,{session:e.session,sha:e.sha,path:e.path},d(e));let r=Q(e.path);return r?(0,U.jsx)(he,{session:e.session,path:e.path,kind:r},d(e)):(0,U.jsx)(G,{session:e.session,path:e.path,reveal:t},d(e))}export{ve as PaneEditorBody};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{b as r,d as i,f as a,h as o,l as s,m as c,p as l,u}from"./api-MnOKfpqf.js";import{a as d,g as f,i as p,n as m,o as h,r as g,t as _}from"./dialog-B43iKmfK.js";import{t as v}from"./utils-B6KiDbIe.js";import{t as y}from"./createLucideIcon-DyMAgLa3.js";import{a as b,c as x,d as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k,u as ee}from"./session-seed-CRfTF2sq.js";import{i as te,r as ne}from"./dist-VDiYuPKw.js";import{A as re,C as ie,Ct as ae,D as oe,E as se,F as ce,Ft as A,G as le,H as ue,I as de,It as j,L as fe,N as pe,Ot as me,P as M,Pt as he,R as ge,V as _e,W as ve,X as ye,Xt as N,Z as be,a as xe,b as Se,bt as P,ct as Ce,dt as F,en as we,et as Te,f as Ee,g as De,gt as I,ht as L,i as Oe,it as ke,j as Ae,k as je,l as Me,lt as Ne,m as Pe,mt as R,o as z,ot as Fe,p as Ie,pt as Le,s as B,tt as Re,v as ze,vt as Be,x as Ve,xt as V,y as He}from"./index-QU4DiDhV.js";var Ue=y(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),We=y(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ge=y(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ke=y(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),qe=y(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Je=y(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ye=y(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Xe=y(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Ze=y(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),H=e(t(),1),U=n();function W({label:e,description:t,descriptionClassName:n,htmlFor:r,children:i,className:a}){return(0,U.jsxs)(`div`,{className:v(`flex items-center gap-4 py-2.5`,a),children:[(0,U.jsxs)(`label`,{htmlFor:r,className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`text-sm text-fg`,children:e}),t&&(0,U.jsx)(`span`,{className:v(`text-xs text-fg-muted`,n),children:t})]}),(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:i})]})}function G({children:e,note:t}){return(0,U.jsxs)(`div`,{className:`mb-2 flex flex-col gap-0.5`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e}),t&&(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t})]})}function Qe(){let e=B(),[t,n]=(0,H.useState)(we());return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{note:`This browser only`,children:`Appearance`}),(0,U.jsx)(W,{label:`Theme`,description:`Chrome, terminal, and editor restyle together.`,children:(0,U.jsxs)(D,{value:t,onValueChange:e=>{n(e),N(e)},children:[(0,U.jsx)(E,{className:`w-32`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(C,{children:[(0,U.jsx)(b,{value:`dark`,children:`Dark`}),(0,U.jsx)(b,{value:`light`,children:`Light`}),(0,U.jsx)(b,{value:`system`,children:`System`})]})]})}),(0,U.jsx)(W,{label:`UI font size`,htmlFor:`ui-font-size`,children:(0,U.jsx)(A,{id:`ui-font-size`,type:`number`,min:12,max:24,step:.5,className:`w-20 tabular-nums`,value:e.uiFontSize,onChange:e=>z({uiFontSize:Number(e.target.value)||Oe.uiFontSize})})}),(0,U.jsx)(W,{label:`Terminal font size`,htmlFor:`terminal-font-size`,children:(0,U.jsx)(A,{id:`terminal-font-size`,type:`number`,min:9,max:24,className:`w-20 tabular-nums`,value:e.terminalFontSize,onChange:e=>z({terminalFontSize:Number(e.target.value)||13})})}),(0,U.jsx)(W,{label:`Density`,children:(0,U.jsxs)(D,{value:e.density,onValueChange:e=>z({density:e}),children:[(0,U.jsx)(E,{className:`w-36`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(C,{children:[(0,U.jsx)(b,{value:`compact`,children:`Compact`}),(0,U.jsx)(b,{value:`comfortable`,children:`Comfortable`})]})]})}),(0,U.jsx)(W,{label:`Reduced motion`,description:`Status ripples become static dots.`,htmlFor:`reduced-motion`,children:(0,U.jsx)(T,{id:`reduced-motion`,checked:e.reducedMotion,onCheckedChange:e=>z({reducedMotion:e})})}),(0,U.jsx)(W,{label:`All projects in the sidebar`,description:`Show every project's sessions in the right sidebar, grouped by project.`,htmlFor:`all-project-sessions`,children:(0,U.jsx)(T,{id:`all-project-sessions`,checked:e.showAllProjectSessions,onCheckedChange:e=>z({showAllProjectSessions:e})})})]})}function $e({profile:e}){let t=L(),[n,i]=(0,H.useState)(!1),a=n=>{t.mutate({id:e.id,icon:n},{onError:e=>r.error(e.message)}),i(!1)},o=n=>t.mutate({id:e.id,icon_colour:n},{onError:e=>r.error(e.message)});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(W,{label:`Icon`,description:`The glyph shown wherever this profile appears.`,children:(0,U.jsxs)(Ee,{open:n,onOpenChange:i,children:[(0,U.jsx)(Pe,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex size-9 items-center justify-center rounded-md text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,U.jsx)(ce,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Choose an icon`})]})}),(0,U.jsx)(Ie,{align:`end`,className:`w-72`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-8 gap-1`,children:[(0,U.jsx)(`button`,{type:`button`,title:`Default`,onClick:()=>a(null),className:v(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,!e.icon&&`bg-elevated text-fg`),children:(0,U.jsx)(ce,{icon:null,colour:null,className:`size-4`})}),fe.map(({name:t,Icon:n})=>(0,U.jsx)(`button`,{type:`button`,title:t,onClick:()=>a(t),className:v(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,e.icon===t&&`bg-elevated text-fg`),children:(0,U.jsx)(n,{className:`size-4`})},t))]})})]})}),(0,U.jsx)(W,{label:`Icon colour`,description:`Any theme colour; recolours with light/dark.`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,U.jsxs)(`button`,{type:`button`,title:`Default`,onClick:()=>o(null),className:v(`flex size-7 items-center justify-center rounded-md transition-colors hover:bg-elevated`,!e.icon_colour&&`bg-elevated`),children:[(0,U.jsx)(`span`,{className:`size-3.5 rounded-full bg-fg-muted`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Default colour`})]}),c.map(t=>(0,U.jsxs)(`button`,{type:`button`,title:t,onClick:()=>o(t),className:v(`flex size-7 items-center justify-center rounded-md transition-colors hover:bg-elevated`,e.icon_colour===t&&`bg-elevated`),children:[(0,U.jsx)(`span`,{className:v(`size-3.5 rounded-full bg-current`,de(t))}),(0,U.jsx)(`span`,{className:`sr-only`,children:t})]},t))]})})]})}var K=`__none__`;function et(){let e=M(),t=V().data?.find(t=>t.id===e),n=ye(e??void 0),i=P(e??void 0),a=L(),o=I(e??``),c=Fe(),[l,u]=(0,H.useState)(``),[v,y]=(0,H.useState)(``),[x,S]=(0,H.useState)(!1),[w,T]=(0,H.useState)(``);if((0,H.useEffect)(()=>{t&&(u(t.name),y(t.branch_prefix))},[t]),!t)return null;let k=i.data?.default_account_id;return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Profile`}),(0,U.jsxs)(W,{label:`Name`,description:`A display label. Letters, digits, dot, underscore and hyphen; must be unique.`,htmlFor:`profile-name`,children:[(0,U.jsx)(A,{id:`profile-name`,value:l,onChange:e=>u(e.target.value),className:`w-44 font-mono`}),(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:l===t.name||l.trim()===``||a.isPending,onClick:()=>a.mutate({id:t.id,name:l},{onError:e=>r.error(e.message)}),children:`Save`})]}),(0,U.jsxs)(W,{label:`Branch prefix`,description:`Session branches become <prefix><slug(title)>.`,htmlFor:`branch-prefix`,children:[(0,U.jsx)(A,{id:`branch-prefix`,value:v,onChange:e=>y(e.target.value),placeholder:s,className:`w-44 font-mono`}),(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:v===t.branch_prefix||a.isPending,onClick:()=>a.mutate({id:t.id,branch_prefix:v},{onError:e=>r.error(e.message)}),children:`Save`})]}),(0,U.jsx)($e,{profile:t}),(0,U.jsx)(W,{label:`Default account`,description:`Preselected in the new-session modal.`,children:(0,U.jsxs)(D,{value:typeof k==`number`?String(k):K,onValueChange:e=>o.mutate({default_account_id:e===K?null:Number(e)},{onError:e=>r.error(e.message)}),children:[(0,U.jsx)(E,{className:`w-56`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(C,{children:[(0,U.jsx)(b,{value:K,children:`First available`}),n.data?.map(e=>(0,U.jsx)(b,{value:String(e.id),children:(0,U.jsxs)(`span`,{className:`font-mono`,children:[e.agent_type,`/`,e.label]})},e.id))]})]})}),(0,U.jsx)(W,{label:`Delete profile`,description:`Removes its projects, accounts (logging them out), and archived history. Non-archived sessions block deletion.`,className:`mt-4`,children:(0,U.jsx)(f,{variant:`danger`,size:`sm`,onClick:()=>S(!0),children:`Delete…`})}),(0,U.jsx)(_,{open:x,onOpenChange:e=>{e||(S(!1),T(``))},children:(0,U.jsxs)(m,{children:[(0,U.jsxs)(d,{children:[(0,U.jsxs)(h,{children:[`Delete profile `,(0,U.jsx)(`span`,{className:`font-mono`,children:t.name}),`?`]}),(0,U.jsx)(g,{children:`Everything this profile owns goes with it: projects, workspace layouts, accounts and their credential directories, and archived session history. Branches, repositories, and terminal logs on disk are untouched. This cannot be undone.`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(he,{htmlFor:`delete-confirm-name`,children:[`Type `,(0,U.jsx)(`span`,{className:`font-mono text-fg`,children:t.name}),` to confirm`]}),(0,U.jsx)(A,{id:`delete-confirm-name`,value:w,onChange:e=>T(e.target.value),className:`font-mono`,autoFocus:!0})]}),(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{variant:`ghost`,onClick:()=>{S(!1),T(``)},children:`Cancel`}),(0,U.jsx)(f,{variant:`danger`,disabled:w!==t.name||c.isPending,onClick:()=>c.mutate(t.id,{onSuccess:()=>{je(),pe.set(null)},onError:e=>{S(!1),T(``),r.error(e.message)}}),children:`Delete profile`})]})]})})]})}function tt({agentId:e,profileId:t,onClose:n}){let i=Re(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(``),l=Ce(se(s,150)),u=a.trim()!==``&&(s.startsWith(`/`)||s.startsWith(`~`));return(0,U.jsx)(_,{open:!0,onOpenChange:e=>!e&&n(),children:(0,U.jsxs)(m,{children:[(0,U.jsxs)(d,{children:[(0,U.jsx)(h,{children:`Import an existing account`}),(0,U.jsx)(g,{children:`The directory is copied into a puddle-owned account; the original is never touched. If credentials do not travel (macOS keychain), log in once afterwards.`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(A,{placeholder:`label, e.g. personal`,value:a,onChange:e=>o(e.target.value),className:`font-mono`}),(0,U.jsx)(oe,{value:s,onValueChange:c,placeholder:`config dir on the host, e.g. ~/.claude`,hints:(l.data?.entries??[]).map(e=>({value:e.path,label:e.name})),className:`font-mono`})]}),(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,U.jsxs)(f,{disabled:!u||i.isPending,onClick:()=>i.mutate({profile_id:t,agent_type:e,label:a.trim(),import_dir:s.trim()},{onSuccess:e=>{n(),e.logged_in||r.info(`Imported without credentials — press Login to authenticate.`)},onError:e=>r.error(e.message)}),children:[(0,U.jsx)(Ge,{}),`Import`]})]})]})})}function nt({account:e,gateOpen:t}){let n=F(),i=Le(),a=ke(),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(!1),[u,v]=(0,H.useState)(e.label);return(0,H.useEffect)(()=>v(e.label),[e.label]),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md bg-surface px-3 py-2`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`input`,{value:u,onChange:e=>v(e.target.value),onBlur:()=>{let t=u.trim();if(t!==e.label){if(t===``){v(e.label);return}i.mutate({id:e.id,label:t},{onError:t=>{r.error(t.message),v(e.label)}})}},onKeyDown:t=>{t.key===`Enter`?t.currentTarget.blur():t.key===`Escape`&&(v(e.label),t.currentTarget.blur())},"aria-label":`Account name`,className:`-mx-1 block w-full truncate rounded-sm bg-transparent px-1 py-0.5 font-mono text-sm text-fg transition-colors hover:bg-elevated focus:bg-elevated focus:outline-none`}),(0,U.jsx)(`span`,{className:`text-2xs ${e.logged_in?`text-running`:`text-waiting`}`,children:e.logged_in?`logged in`:`not logged in`})]}),t&&(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-secondary`,children:[`skip prompts`,(0,U.jsx)(T,{checked:e.skip_permissions_default,onCheckedChange:t=>i.mutate({id:e.id,skip_permissions_default:t},{onError:e=>r.error(e.message)})})]}),(0,U.jsxs)(f,{size:`sm`,variant:`secondary`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:e=>s(e.stream),onError:e=>r.error(e.message)}),children:[(0,U.jsx)(le,{}),e.logged_in?`Re-login`:`Login`]}),(0,U.jsxs)(f,{size:`icon`,variant:`ghost`,className:`size-7 text-fg-muted hover:text-danger`,onClick:()=>l(!0),children:[(0,U.jsx)(x,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Delete account`})]}),o&&(0,U.jsx)(Me,{stream:o,label:`${e.agent_type}/${e.label}`,onClose:()=>s(null)}),(0,U.jsx)(_,{open:c,onOpenChange:l,children:(0,U.jsxs)(m,{children:[(0,U.jsxs)(d,{children:[(0,U.jsxs)(h,{children:[`Delete `,(0,U.jsx)(`span`,{className:`font-mono`,children:e.label}),`?`]}),(0,U.jsx)(g,{children:`Removes the account, its archived session history, and its credential directory — this logs the account out. Non-archived sessions block deletion.`})]}),(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,U.jsx)(f,{variant:`danger`,disabled:a.isPending,onClick:()=>a.mutate(e.id,{onSuccess:()=>l(!1),onError:e=>{l(!1),r.error(e.message)}}),children:`Delete account`})]})]})})]})}function rt(){let e=M(),t=be(),n=ye(e??void 0),i=P(e??void 0),a=Re(),o=F(),[s,c]=(0,H.useState)({}),[l,u]=(0,H.useState)(null),[d,p]=(0,H.useState)(null),m=i.data?.allowSkipPermissions===!0,h=t=>{let n=(s[t]??``).trim();!n||e===null||a.mutate({profile_id:e,agent_type:t,label:n},{onSuccess:e=>{c(e=>({...e,[t]:``})),o.mutate(e.id,{onSuccess:n=>u({stream:n.stream,label:`${t}/${e.label}`})})},onError:e=>r.error(e.message)})};return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Accounts`}),t.data?.map(e=>{let t=n.data?.filter(t=>t.agent_type===e.id)??[];return(0,U.jsxs)(`div`,{className:`mb-5`,children:[(0,U.jsx)(W,{label:e.display_name,description:`Accounts are isolated config dirs under this profile.`,className:`py-1`,children:(0,U.jsx)(`span`,{className:`font-mono text-2xs text-fg-muted`,children:e.id})}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t.map(t=>(0,U.jsx)(nt,{account:t,gateOpen:m&&e.capabilities.skip_permissions},t.id)),(0,U.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),h(e.id)},children:[(0,U.jsx)(A,{placeholder:`label, e.g. personal`,value:s[e.id]??``,onChange:t=>c(n=>({...n,[e.id]:t.target.value})),className:`w-48 font-mono`}),(0,U.jsxs)(f,{type:`submit`,size:`sm`,variant:`secondary`,disabled:!(s[e.id]??``).trim()||a.isPending,children:[(0,U.jsx)(ue,{}),`Add account`]}),(0,U.jsxs)(f,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>p(e.id),children:[(0,U.jsx)(Ge,{}),`Import existing…`]})]})]})]},e.id)}),l&&(0,U.jsx)(Me,{stream:l.stream,label:l.label,onClose:()=>u(null)}),d!==null&&e!==null&&(0,U.jsx)(tt,{agentId:d,profileId:e,onClose:()=>p(null)})]})}function it(){let e=Te(),t=R(),[n,r]=(0,H.useState)(``);return(0,H.useEffect)(()=>{e.data&&r(e.data.agentPath)},[e.data]),(0,U.jsx)(W,{label:`Agent search path (host-wide)`,description:`Colon-separated dirs the daemon prepends to PATH to find agent CLIs like claude (e.g. ~/.local/bin). Applies after the daemon restarts.`,htmlFor:`agent-path`,children:(0,U.jsx)(A,{id:`agent-path`,type:`text`,className:`w-64 font-mono text-2xs`,value:n,onChange:e=>r(e.target.value),onBlur:()=>{e.data&&n!==e.data.agentPath&&t.mutate({agentPath:n})}})})}function at({kind:e,heading:t,settings:n,onSave:r,pending:i}){let a=k(e,n),o=n.sessionDefaults??{},[s,c]=(0,H.useState)(a.baseBranch),l=t=>r({...o,[e]:{...o[e],...t}});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`mb-1 mt-4 text-xs font-medium uppercase tracking-wide text-fg-gold`,children:t}),(0,U.jsx)(W,{label:`Base branch`,description:`Blank = the repository's default base branch.`,htmlFor:`${e}-default-base`,children:(0,U.jsx)(A,{id:`${e}-default-base`,type:`text`,placeholder:`repository default`,className:`w-48 font-mono`,value:s,onChange:e=>c(e.target.value),onBlur:()=>{s.trim()!==a.baseBranch&&l({baseBranch:s.trim()})}})}),(0,U.jsx)(W,{label:`Separate branch`,description:`Start on a fresh branch off the base, in its own directory.`,htmlFor:`${e}-default-branch`,children:(0,U.jsx)(T,{id:`${e}-default-branch`,checked:a.separateBranch,disabled:i,onCheckedChange:e=>l({separateBranch:e})})}),(0,U.jsx)(W,{label:`Separate directory`,description:a.separateBranch?`Always on while a separate branch is used.`:`An own working copy of the base branch, instead of sharing one.`,htmlFor:`${e}-default-dir`,children:(0,U.jsx)(T,{id:`${e}-default-dir`,checked:a.separateWorktree,disabled:i||a.separateBranch,onCheckedChange:e=>l({separateWorktree:e})})})]})}function ot(){return(0,U.jsx)(W,{label:`Terminal scrollback`,description:`Lines kept per terminal. This browser only.`,htmlFor:`scrollback`,children:(0,U.jsx)(A,{id:`scrollback`,type:`number`,min:500,max:1e5,step:500,className:`w-28 tabular-nums`,value:B().terminalScrollback,onChange:e=>z({terminalScrollback:Number(e.target.value)||5e3})})})}function q({id:e,label:t,description:n,initial:r,defaultText:i,onSave:a,pending:o}){let[s,c]=(0,H.useState)(r);return(0,U.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,U.jsxs)(`label`,{htmlFor:e,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[t,(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n})]}),(0,U.jsx)(j,{id:e,value:s,onChange:e=>c(e.target.value),rows:6,className:`font-mono`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:s===r||o,onClick:()=>a(s),children:`Save`}),(0,U.jsx)(f,{size:`sm`,variant:`ghost`,disabled:s===i||o,onClick:()=>{c(i),a(i)},children:`Reset to default`})]})]})}var st={id:`4f3c2b1a-7e6d-5c4b-3a2f-1e0d9c8b7a6f`,title:null,agent_title:`Refactor the auth flow`,osc_title:`claude`,branch:`alice/refactor-auth`,worktree_path:`/home/alice/code/app--refactor-auth`,status:`waiting_input`,agent_type:`claude-code`};function ct({initial:e,onSave:t,pending:n}){let[r,i]=(0,H.useState)(e),a=r.length>0?r:l;return(0,U.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,U.jsxs)(`label`,{htmlFor:`tab-title-template`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Template`,(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Compose the label from the parts below. Empty falls back to the default.`})]}),(0,U.jsx)(A,{id:`tab-title-template`,value:r,onChange:e=>i(e.target.value),className:`font-mono`,placeholder:l}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Preview`,` `,(0,U.jsx)(`span`,{className:`ml-1 font-sans text-fg`,children:De(st,a)})]}),(0,U.jsx)(`dl`,{className:`mt-1 flex flex-col gap-0.5 text-xs`,children:o.map(([e,t])=>(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`dt`,{className:`w-24 shrink-0 font-mono text-fg-secondary`,children:`\${${e}}`}),(0,U.jsx)(`dd`,{className:`text-fg-muted`,children:t})]},e))}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:r===e||n,onClick:()=>t(r),children:`Save`}),(0,U.jsx)(f,{size:`sm`,variant:`ghost`,disabled:r==="${name}"||n,onClick:()=>{i(l),t(l)},children:`Reset to default`})]})]})}function lt(){let e=M(),t=V().data?.find(t=>t.id===e),n=P(e??void 0),o=I(e??``),[s,c]=(0,H.useState)(!1),[l,v]=(0,H.useState)(``),y=n.data?.allowSkipPermissions===!0,b=e=>o.mutate({allowSkipPermissions:e},{onSuccess:()=>{c(!1),v(``)},onError:e=>r.error(e.message)}),x=e=>t=>o.mutate({[e]:t},{onError:e=>r.error(e.message)});return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Sessions`}),(0,U.jsx)(`p`,{className:`mb-3 text-xs text-fg-secondary`,children:`Permission prompts are on by default, everywhere. Skipping them requires this profile gate, a per-account opt-in, and a per-session toggle — and the daemon re-checks all three on every launch, resume, and hand-off.`}),(0,U.jsx)(W,{label:`Allow skipping permission prompts`,description:y?`The gate is open: opted-in accounts can start prompt-free sessions.`:`The gate is closed: every session keeps its permission prompts.`,htmlFor:`gate`,children:(0,U.jsx)(T,{id:`gate`,checked:y,onCheckedChange:e=>{e?c(!0):b(!1)}})}),(0,U.jsx)(it,{}),(0,U.jsx)(ot,{}),(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(G,{note:`What the new-agent and new-terminal modals open with — everything stays editable per session.`,children:`New session defaults`}),n.data&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(at,{kind:`agent`,heading:`New agents`,settings:n.data,onSave:e=>o.mutate({sessionDefaults:e},{onError:e=>r.error(e.message)}),pending:o.isPending},`${e}:agent-seed`),(0,U.jsx)(at,{kind:`terminal`,heading:`New terminals`,settings:n.data,onSave:e=>o.mutate({sessionDefaults:e},{onError:e=>r.error(e.message)}),pending:o.isPending},`${e}:terminal-seed`)]})]}),(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(G,{note:`Sent to the agent as its opening message when a session starts. Leave a box empty to send no preamble.`,children:`Launch text`}),n.data&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(q,{id:`onboarding-template`,label:`New worktree`,description:`For a freshly created worktree. Use {{rules}} where the repo's onboarding notes should appear.`,initial:n.data.onboardingTemplate??i,defaultText:i,onSave:x(`onboardingTemplate`),pending:o.isPending},`${e}:onboarding`),(0,U.jsx)(q,{id:`concurrent-template`,label:`Existing / shared worktree`,description:`For a session joining a worktree other agents may already be working in.`,initial:n.data.concurrentTemplate??u,defaultText:u,onSave:x(`concurrentTemplate`),pending:o.isPending},`${e}:concurrent`),(0,U.jsx)(q,{id:`restart-template`,label:`Resume after restart`,description:`Sent when a session resumes after a daemon restart or machine reboot — its processes are gone.`,initial:n.data.restartTemplate??a,defaultText:a,onSave:x(`restartTemplate`),pending:o.isPending},`${e}:restart`)]})]}),(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(G,{note:`How each session's tab and sidebar label is composed from its parts.`,children:`Tab title`}),n.data&&(0,U.jsx)(ct,{initial:n.data.tabTitleTemplate??"${name}",onSave:x(`tabTitleTemplate`),pending:o.isPending},`${e}:tab-title`)]}),(0,U.jsx)(_,{open:s,onOpenChange:e=>{e||(c(!1),v(``))},children:(0,U.jsxs)(m,{children:[(0,U.jsxs)(d,{children:[(0,U.jsxs)(h,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Ye,{className:`size-5 text-danger`}),`Run agents without permission prompts?`]}),(0,U.jsx)(g,{asChild:!0,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,U.jsx)(`p`,{children:`A prompt-free agent acts unattended, with your credentials, inside its worktree — and nothing technically stops a shell command from reaching outside it. It can:`}),(0,U.jsxs)(`ul`,{className:`list-disc pl-5 text-fg-secondary`,children:[(0,U.jsx)(`li`,{children:`run any shell command without asking first,`}),(0,U.jsx)(`li`,{children:`modify, delete, or exfiltrate files your user can reach,`}),(0,U.jsx)(`li`,{children:`install dependencies and execute the network requests they make,`}),(0,U.jsx)(`li`,{children:`push branches or call remote APIs with the credentials it finds.`})]}),(0,U.jsx)(`p`,{children:`Only open this gate if every account you opt in runs work you would trust a colleague to run unsupervised on this machine.`}),(0,U.jsx)(`p`,{className:`text-fg-muted`,children:`Opening it also records the agent’s own bypass-permissions acceptance for this profile’s accounts, so the skip actually takes effect.`})]})})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(he,{htmlFor:`confirm-name`,children:[`Type `,(0,U.jsx)(`span`,{className:`font-mono text-fg`,children:t?.name}),` to confirm`]}),(0,U.jsx)(A,{id:`confirm-name`,value:l,onChange:e=>v(e.target.value),className:`font-mono`,autoFocus:!0})]}),(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{variant:`ghost`,onClick:()=>{c(!1),v(``)},children:`Cancel`}),(0,U.jsx)(f,{variant:`danger`,disabled:l!==t?.name||o.isPending,onClick:()=>b(!0),children:`Open the gate`})]})]})})]})}var ut={desktop:!0,sound:!1,muted_projects:[]};function dt(){let e=M(),t=P(e??void 0),n=I(e??``),i=ae(e??void 0),a={...ut,...t.data?.notifications??{}},o=e=>n.mutate({notifications:e},{onError:e=>r.error(e.message)});return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{note:`Delivery lands in a later phase`,children:`Notifications`}),(0,U.jsx)(W,{label:`Desktop notification on waiting`,description:`When a session flips to waiting for input.`,htmlFor:`notify-desktop`,children:(0,U.jsx)(T,{id:`notify-desktop`,checked:a.desktop,onCheckedChange:e=>o({...a,desktop:e})})}),(0,U.jsx)(W,{label:`Sound`,htmlFor:`notify-sound`,children:(0,U.jsx)(T,{id:`notify-sound`,checked:a.sound,onCheckedChange:e=>o({...a,sound:e})})}),(0,U.jsx)(W,{label:`Muted projects`,description:`No notifications from these projects.`,children:(0,U.jsxs)(`span`,{className:`text-2xs text-fg-muted tabular-nums`,children:[a.muted_projects.length,` muted`]})}),(0,U.jsx)(`div`,{className:`flex flex-col gap-1`,children:i.data?.map(e=>(0,U.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-secondary hover:bg-elevated`,children:[(0,U.jsx)(T,{checked:a.muted_projects.includes(e.id),onCheckedChange:t=>o({...a,muted_projects:t?[...a.muted_projects,e.id]:a.muted_projects.filter(t=>t!==e.id)})}),e.name]},e.id))})]})}function ft(){let e=B();return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{note:`This browser only`,children:`Editor`}),(0,U.jsx)(W,{label:`Tab size`,description:`Spaces per indent level.`,htmlFor:`tab-size`,children:(0,U.jsx)(A,{id:`tab-size`,type:`number`,min:1,max:8,className:`w-20 tabular-nums`,value:e.editorTabSize,onChange:e=>z({editorTabSize:Number(e.target.value)||2})})}),(0,U.jsx)(W,{label:`Word wrap`,htmlFor:`word-wrap`,children:(0,U.jsx)(T,{id:`word-wrap`,checked:e.editorWordWrap,onCheckedChange:e=>z({editorWordWrap:e})})}),(0,U.jsx)(W,{label:`SSH host for editor links`,description:`Used for vscode:// and cursor:// remote links until the CLI supplies it automatically.`,htmlFor:`editor-link-host`,children:(0,U.jsx)(A,{id:`editor-link-host`,type:`text`,placeholder:`user@host`,className:`w-48`,value:e.editorLinkSshHost,onChange:e=>z({editorLinkSshHost:e.target.value})})})]})}function pt({value:e,isDefault:t,onRecord:n,onReset:r}){let[i,a]=(0,H.useState)(!1);return(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>a(!0),onBlur:()=>a(!1),onKeyDown:e=>{if(!i)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Se(e.nativeEvent);t&&(n(t),a(!1))},className:v(`min-w-24 rounded-md px-2 py-1 text-center font-mono text-xs transition-colors`,i?`bg-action text-action-ink`:`bg-elevated text-fg hover:bg-border/70`),children:i?`Press keys…`:Ve(e)}),!t&&(0,U.jsxs)(`button`,{type:`button`,title:`Reset to default`,onClick:r,className:`rounded-md p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,U.jsx)(qe,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Reset to default`})]})]})}function mt(){let e=M(),t=P(e??void 0),n=I(e??``),i=t.data?.hotkeys??{},a=(e,t)=>i[e]||t,o=new Map;for(let e of ze){let t=a(e.id,e.defaultBinding);o.set(t,(o.get(t)??0)+1)}let s=(e,t)=>n.mutate({hotkeys:{...i,[e]:t}},{onError:e=>r.error(e.message)}),c=e=>{let t={...i};delete t[e],n.mutate({hotkeys:t},{onError:e=>r.error(e.message)})};return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Hotkeys`}),(0,U.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:`Per-profile keyboard shortcuts. Filetree navigation and terminal line-edits are fixed. Browser-reserved combos (⌘W, ⌘T, ⌘⇧B, …) can’t be captured by a web tab.`}),He.map(e=>{let t=ze.filter(t=>t.group===e);return t.length===0?null:(0,U.jsxs)(`div`,{className:`mb-5`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:e}),t.map(e=>{let t=a(e.id,e.defaultBinding),n=(o.get(t)??0)>1,r=ie(t)?`Browser-reserved — won’t fire in a tab.`:n?`Conflicts with another shortcut.`:void 0;return(0,U.jsx)(W,{label:e.label,description:r,descriptionClassName:r?`text-interrupted`:void 0,children:(0,U.jsx)(pt,{value:t,isDefault:!i[e.id],onRecord:t=>s(e.id,t),onReset:()=>c(e.id)})},e.id)})]},e)})]})}var ht=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,J=65,Y=Object.fromEntries([...ht].map((e,t)=>[e,t])),gt=`H`,_t=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function vt(e){let t=4294967295;for(let n of e)t=_t[(t^n)&255]^t>>>8;return((t^4294967295)>>>0).toString(16).padStart(8,`0`)}function yt(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function bt(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}async function xt(e){let t=new Blob([new TextEncoder().encode(e)]).stream().pipeThrough(new CompressionStream(`gzip`));return new Uint8Array(await new Response(t).arrayBuffer())}async function St(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream(`gzip`));return new Response(t).text()}function X(e,t){let n=(t%J+J)%J,r=``;for(let t of e){let e=Y[t];r+=e===void 0?t:ht[(e+n)%J]}return r}async function Ct(e){let t=await xt(JSON.stringify(e));return X(yt(t)+vt(t),1+Math.floor(Math.random()*(J-1)))}async function wt(e){let t=e.trim(),n=t[0];if(!n||Y[n]===void 0)throw Error(`Not a settings export.`);let r=X(t,-((Y[n]-Y[gt]+J)%J));if(r.length<9||r[0]!==gt)throw Error(`Not a settings export.`);let i=r.slice(0,-8),a=r.slice(-8),o=bt(i);if(vt(o)!==a)throw Error(`Settings export is corrupt (checksum mismatch).`);return JSON.parse(await St(o))}var Z=[{id:`appearance`,label:`Appearance`,fields:[{key:`theme`,store:`theme`},{key:`uiFontSize`,store:`client`},{key:`terminalFontSize`,store:`client`},{key:`density`,store:`client`},{key:`reducedMotion`,store:`client`},{key:`terminalScrollback`,store:`client`},{key:`showAllProjectSessions`,store:`client`}]},{id:`profile`,label:`Profile`,fields:[{key:`branch_prefix`,store:`profileColumn`},{key:`icon`,store:`profileColumn`},{key:`icon_colour`,store:`profileColumn`}]},{id:`sessions`,label:`Sessions`,fields:[{key:`onboardingTemplate`,store:`profileSettings`},{key:`concurrentTemplate`,store:`profileSettings`},{key:`restartTemplate`,store:`profileSettings`},{key:`tabTitleTemplate`,store:`profileSettings`},{key:`sessionDefaults`,store:`profileSettings`},{key:`allowSkipPermissions`,store:`profileSettings`}]},{id:`editor`,label:`Editor`,fields:[{key:`editorTabSize`,store:`client`},{key:`editorWordWrap`,store:`client`},{key:`editorLinkSshHost`,store:`client`}]},{id:`hotkeys`,label:`Hotkeys`,fields:[{key:`hotkeys`,store:`profileSettings`}]}];function Tt(e,t){switch(e.store){case`client`:return t.client[e.key];case`theme`:return t.theme;case`profileSettings`:return t.profileSettings[e.key];case`profileColumn`:return t.profile[e.key]}}function Et(e,t){let n={};for(let r of Z){if(!e.includes(r.id))continue;let i={};for(let e of r.fields){let n=Tt(e,t);n!==void 0&&(i[e.key]=n)}Object.keys(i).length>0&&(n[r.id]=i)}return n}function Dt(e,t){if(!e||typeof e!=`object`)return[];let n=e,r={},i={},a={},o=[];for(let e of Z){let s=n[e.id];if(!s||typeof s!=`object`)continue;let c=s,l=!1;for(let n of e.fields){if(!(n.key in c))continue;l=!0;let e=c[n.key];n.store===`client`?r[n.key]=e:n.store===`theme`?t.setTheme(e):n.store===`profileSettings`?i[n.key]=e:a[n.key]=e}l&&o.push(e.label)}return Object.keys(r).length>0&&t.setClient(r),Object.keys(i).length>0&&t.patchProfileSettings(i),Object.keys(a).length>0&&t.patchProfileColumns(a),o}function Ot(){let e=M(),t=P(e??void 0),n=V().data?.find(t=>t.id===e),i=I(e??``),a=L(),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(!1),[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(()=>Object.fromEntries(Z.map(e=>[e.id,!0]))),y=async()=>{g(!0);try{let t=Dt(await wt(o.trim()),{setClient:e=>z(e),setTheme:e=>{typeof e==`string`&&N(e)},patchProfileSettings:e=>i.mutate(e,{onError:e=>r.error(e.message)}),patchProfileColumns:t=>{e&&a.mutate({id:e,...t},{onError:e=>r.error(e.message)})}});t.length===0?r.error(`Nothing recognised to import.`):(r.success(`Imported ${t.join(`, `)}.`),s(``))}catch(e){r.error(e.message)}finally{g(!1)}},b=async()=>{g(!0);try{let e=Et(Z.filter(e=>_[e.id]).map(e=>e.id),{client:xe(),theme:we(),profileSettings:t.data??{},profile:n??{}});l(await Ct(e)),d(!1)}finally{g(!1)}};return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Sync`}),(0,U.jsx)(`p`,{className:`mb-5 text-xs text-fg-muted`,children:`Carry your settings between machines as one string. Accounts, repositories, and anything machine-specific are never included. Applies to this profile.`}),(0,U.jsxs)(`div`,{className:`mb-6`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Import`}),(0,U.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:`Paste an exported string — only the settings it carries are updated.`}),(0,U.jsx)(j,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Paste a settings export…`,rows:3,spellCheck:!1,className:`resize-y font-mono text-xs`}),(0,U.jsx)(`div`,{className:`mt-2`,children:(0,U.jsx)(f,{size:`sm`,disabled:!o.trim()||h,onClick:()=>void y(),children:`Import`})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Export`}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>m(e=>!e),className:`mb-2 mt-1 flex items-center gap-1 text-xs text-fg-secondary transition-colors hover:text-fg`,children:[p?(0,U.jsx)(ee,{className:`size-3.5`}):(0,U.jsx)(te,{className:`size-3.5`}),`Choose what to include`]}),p&&(0,U.jsx)(`div`,{className:`mb-3 flex flex-col gap-2 pl-1`,children:Z.map(e=>(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(T,{checked:_[e.id]??!1,onCheckedChange:t=>v(n=>({...n,[e.id]:t}))}),e.label]},e.id))}),(0,U.jsx)(f,{size:`sm`,disabled:h,onClick:()=>void b(),children:`Export`}),c&&(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(j,{readOnly:!0,value:c,rows:3,spellCheck:!1,onFocus:e=>e.currentTarget.select(),className:`resize-y font-mono text-xs`}),(0,U.jsx)(`div`,{className:`mt-2`,children:(0,U.jsxs)(f,{size:`sm`,variant:`secondary`,onClick:()=>{navigator.clipboard?.writeText(c),d(!0)},children:[u?(0,U.jsx)(S,{}):(0,U.jsx)(w,{}),u?`Copied`:`Copy`]})})]})]})]})}function kt({repo:e}){let t=Be(),n=Ne(),[i,a]=(0,H.useState)(e.default_base_branch),[o,s]=(0,H.useState)(e.onboarding_notes??``),c=e=>r.error(e.message);return(0,U.jsxs)(`div`,{className:`mb-4 rounded-lg bg-surface p-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-fg`,children:e.path}),(0,U.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted tabular-nums`,children:e.last_fetched_at?`fetched ${new Date(e.last_fetched_at).toLocaleString()}`:`never fetched`}),(0,U.jsxs)(f,{size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:()=>r.success(`Fetched.`),onError:c}),children:[(0,U.jsx)(_e,{}),`Fetch now`]})]}),(0,U.jsxs)(W,{label:`Default base branch`,htmlFor:`base-${e.id}`,className:`py-1.5`,children:[(0,U.jsx)(A,{id:`base-${e.id}`,value:i,onChange:e=>a(e.target.value),className:`w-40 font-mono`}),(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:i===e.default_base_branch||t.isPending,onClick:()=>t.mutate({id:e.id,default_base_branch:i},{onError:c}),children:`Save`})]}),(0,U.jsx)(W,{label:`Periodic fetch`,description:`Fetched on open and on the daemon's interval while sessions are active.`,htmlFor:`fetch-${e.id}`,className:`py-1.5`,children:(0,U.jsx)(T,{id:`fetch-${e.id}`,checked:e.fetch_enabled,onCheckedChange:n=>t.mutate({id:e.id,fetch_enabled:n},{onError:c})})}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,U.jsxs)(`label`,{htmlFor:`notes-${e.id}`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Onboarding notes`,(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Standing setup rules, injected into every fresh worktree. Agents update them via .puddle/onboarding-notes.md.`})]}),(0,U.jsx)(j,{id:`notes-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:4,className:`font-mono`}),(0,U.jsx)(`div`,{children:(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:o===(e.onboarding_notes??``)||t.isPending,onClick:()=>t.mutate({id:e.id,onboarding_notes:o},{onError:c}),children:`Save notes`})})]}),e.orphan_worktrees.length>0&&(0,U.jsxs)(`div`,{className:`mt-3 rounded-md bg-elevated p-2`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-secondary`,children:`Orphan worktrees — directories no session claims. Puddle never deletes these automatically; remove them by hand if unwanted.`}),(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5`,children:e.orphan_worktrees.map(e=>(0,U.jsx)(`li`,{className:`truncate font-mono text-2xs text-fg-muted`,children:e},e))})]})]})}function At(){let e=me();return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Repositories`}),e.data?.length===0&&(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`No repositories yet — register one from the new-project flow on the dashboard.`}),e.data?.map(e=>(0,U.jsx)(kt,{repo:e},e.id))]})}function Q({label:e,description:t,field:n,config:i,min:a,step:o=1}){let s=R();return(0,U.jsx)(W,{label:e,description:t,htmlFor:`host-${n}`,children:(0,U.jsx)(A,{id:`host-${n}`,type:`number`,min:a,step:o,className:`w-32 tabular-nums`,defaultValue:i[n],onBlur:e=>{let t=Number(e.target.value);Number.isFinite(t)&&t!==i[n]&&s.mutate({[n]:t},{onError:e=>r.error(e.message)})}})})}function jt(){let e=Te(),t=R();return e.data?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{note:`Affects all profiles on this host`,children:`Host`}),(0,U.jsx)(Q,{label:`Fetch interval (minutes)`,description:`Periodic git fetch for repos with active sessions.`,field:`fetchIntervalMinutes`,config:e.data,min:1}),(0,U.jsx)(Q,{label:`Log size cap (bytes)`,description:`Per-terminal on-disk log cap.`,field:`logMaxBytes`,config:e.data,min:65536,step:1048576}),(0,U.jsx)(Q,{label:`Replay size (bytes)`,description:`Log tail sent to a terminal on attach.`,field:`replayBytes`,config:e.data,min:1024,step:65536}),(0,U.jsx)(Q,{label:`UI-state retention (days)`,description:`Stale workspace snapshots are swept at boot.`,field:`uiStateRetentionDays`,config:e.data,min:1}),(0,U.jsx)(W,{label:`Auto-resume`,description:`Resume interrupted sessions automatically after a daemon restart.`,htmlFor:`host-autoResume`,children:(0,U.jsx)(T,{id:`host-autoResume`,checked:e.data.autoResume,onCheckedChange:e=>t.mutate({autoResume:e},{onError:e=>r.error(e.message)})})})]}):null}var $=[{id:`appearance`,label:`Appearance`,icon:ve,render:()=>(0,U.jsx)(Qe,{})},{id:`profile`,label:`Profile`,icon:ge,render:()=>(0,U.jsx)(et,{})},{id:`accounts`,label:`Accounts`,icon:Ze,render:()=>(0,U.jsx)(rt,{})},{id:`sessions`,label:`Sessions`,icon:Xe,render:()=>(0,U.jsx)(lt,{})},{id:`editor`,label:`Editor`,icon:We,render:()=>(0,U.jsx)(ft,{})},{id:`hotkeys`,label:`Hotkeys`,icon:Ke,render:()=>(0,U.jsx)(mt,{})},{id:`notifications`,label:`Notifications`,icon:Ue,render:()=>(0,U.jsx)(dt,{})},{id:`repositories`,label:`Repositories`,icon:ne,render:()=>(0,U.jsx)(At,{})},{id:`host`,label:`Host`,icon:Je,render:()=>(0,U.jsx)(jt,{})},{id:`sync`,label:`Sync`,icon:_e,render:()=>(0,U.jsx)(Ot,{})}],Mt={terminal:`sessions`};function Nt(){let e=Ae(),t=e===null?null:Mt[e]??e,n=$.find(e=>e.id===t)??$[0];return(0,U.jsx)(_,{open:e!==null,onOpenChange:e=>!e&&je(),children:(0,U.jsxs)(m,{wide:!0,className:`grid h-[34rem] grid-cols-[14rem_1fr] gap-0 overflow-hidden p-0`,children:[(0,U.jsx)(h,{className:`sr-only`,children:`Settings`}),(0,U.jsxs)(`nav`,{className:`flex flex-col gap-1 bg-surface p-2.5 pr-6`,children:[(0,U.jsx)(`span`,{className:`px-2.5 py-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`Settings`}),$.map(({id:e,label:t,icon:r})=>(0,U.jsxs)(`button`,{onClick:()=>re(e),className:v(`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors`,e===n.id?`bg-elevated text-fg`:`text-fg-secondary hover:bg-elevated hover:text-fg`),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),t]},e))]}),(0,U.jsx)(`div`,{className:`overflow-y-auto p-5`,children:n.render()})]})})}export{Nt as SettingsDialog};
|