@edspencer/paddock 0.66.2 → 0.68.0
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/README.md +24 -30
- package/package.json +1 -1
- package/packages/server/dist/adoptable.d.ts +57 -0
- package/packages/server/dist/adoptable.js +26 -3
- package/packages/server/dist/agent-errors.js +1 -1
- package/packages/server/dist/claude-home.d.ts +4 -4
- package/packages/server/dist/claude-home.js +4 -4
- package/packages/server/dist/claude-mcp.d.ts +4 -2
- package/packages/server/dist/cli/args.d.ts +41 -2
- package/packages/server/dist/cli/args.js +119 -17
- package/packages/server/dist/cli/paddock.js +87 -96
- package/packages/server/dist/cli/service/backend.d.ts +38 -0
- package/packages/server/dist/cli/service/backend.js +19 -0
- package/packages/server/dist/cli/service/index.d.ts +28 -0
- package/packages/server/dist/cli/service/index.js +179 -0
- package/packages/server/dist/cli/service/launchd.d.ts +47 -0
- package/packages/server/dist/cli/service/launchd.js +206 -0
- package/packages/server/dist/cli/service/spec.d.ts +106 -0
- package/packages/server/dist/cli/service/spec.js +124 -0
- package/packages/server/dist/cli/service/systemd.d.ts +48 -0
- package/packages/server/dist/cli/service/systemd.js +155 -0
- package/packages/server/dist/discover.d.ts +170 -0
- package/packages/server/dist/discover.js +365 -0
- package/packages/server/dist/herdctl.d.ts +25 -2
- package/packages/server/dist/herdctl.js +30 -1
- package/packages/server/dist/routes/chats.js +14 -2
- package/packages/server/dist/routes/discover.d.ts +3 -0
- package/packages/server/dist/routes/discover.js +140 -0
- package/packages/server/dist/routes.d.ts +1 -0
- package/packages/server/dist/routes.js +2 -0
- package/packages/server/dist/session-hub.d.ts +10 -0
- package/packages/server/dist/session-hub.js +16 -2
- package/packages/server/dist/ws-protocol.d.ts +15 -0
- package/packages/server/dist/ws.js +1 -0
- package/packages/server/package.json +1 -1
- package/packages/web/dist/assets/Chip-DIdRqcqU.js +2 -0
- package/packages/web/dist/assets/DiscoverPage-BmCWnkjN.js +2 -0
- package/packages/web/dist/assets/DiscoverView-DwhtBdN2.js +2 -0
- package/packages/web/dist/assets/InstanceConfigPage-D01x1BUg.js +2 -0
- package/packages/web/dist/assets/{MarkdownRenderer-DDVO0zhl.js → MarkdownRenderer-BCheNET2.js} +2 -2
- package/packages/web/dist/assets/ProjectMenu-BqlUQuxM.js +2 -0
- package/packages/web/dist/assets/ProjectRedirect-D8QDxYLG.js +2 -0
- package/packages/web/dist/assets/ProjectView-cevSYdcl.js +13 -0
- package/packages/web/dist/assets/ProjectsGrid-yd18DXdV.js +2 -0
- package/packages/web/dist/assets/RootHome-DZEkOjko.js +2 -0
- package/packages/web/dist/assets/Surfaces-DvRztndg.js +2 -0
- package/packages/web/dist/assets/{arc-DXqVnx_r.js → arc-DFqBni1E.js} +1 -1
- package/packages/web/dist/assets/{architectureDiagram-3BPJPVTR-FgkfD1Bk.js → architectureDiagram-3BPJPVTR-DXFeq3pL.js} +1 -1
- package/packages/web/dist/assets/{blockDiagram-GPEHLZMM-WwkIIJsI.js → blockDiagram-GPEHLZMM-DpeYsIwP.js} +1 -1
- package/packages/web/dist/assets/{c4Diagram-AAUBKEIU-BIzkTibx.js → c4Diagram-AAUBKEIU-Bw5r8wjW.js} +1 -1
- package/packages/web/dist/assets/channel-DU94S7yB.js +2 -0
- package/packages/web/dist/assets/{chunk-2J33WTMH-C4TBH3R6.js → chunk-2J33WTMH-B0SAvGOr.js} +1 -1
- package/packages/web/dist/assets/{chunk-4BX2VUAB-DTKJZlRM.js → chunk-4BX2VUAB-BaUGs1hD.js} +1 -1
- package/packages/web/dist/assets/{chunk-55IACEB6-BC9_Qc8h.js → chunk-55IACEB6-BDHRluF5.js} +1 -1
- package/packages/web/dist/assets/{chunk-727SXJPM-D3gQ4rP3.js → chunk-727SXJPM-BX93DBZO.js} +1 -1
- package/packages/web/dist/assets/{chunk-AQP2D5EJ-My2AXBvz.js → chunk-AQP2D5EJ-3RiQGxW2.js} +1 -1
- package/packages/web/dist/assets/{chunk-FMBD7UC4-D09zE6Ow.js → chunk-FMBD7UC4-DMkjv9SP.js} +1 -1
- package/packages/web/dist/assets/{chunk-ND2GUHAM-CUSgeCLl.js → chunk-ND2GUHAM-CHiQfq4F.js} +1 -1
- package/packages/web/dist/assets/{chunk-QZHKN3VN-B6jVPYgy.js → chunk-QZHKN3VN-B1wCSHbM.js} +1 -1
- package/packages/web/dist/assets/classDiagram-4FO5ZUOK-BcRv1OPp.js +2 -0
- package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-BcRv1OPp.js +2 -0
- package/packages/web/dist/assets/{core-DPY0seI-.js → core-C-49RP59.js} +1 -1
- package/packages/web/dist/assets/{cose-bilkent-S5V4N54A-BasCiARv.js → cose-bilkent-S5V4N54A-BIwwgSTZ.js} +1 -1
- package/packages/web/dist/assets/{dagre-BM42HDAG-Cimn11Qe.js → dagre-BM42HDAG-BN45kshV.js} +1 -1
- package/packages/web/dist/assets/diagram-2AECGRRQ-C5NekbfR.js +44 -0
- package/packages/web/dist/assets/diagram-5GNKFQAL-De7wdssd.js +11 -0
- package/packages/web/dist/assets/{diagram-KO2AKTUF-dLORrSiu.js → diagram-KO2AKTUF-CgG0UA0n.js} +3 -3
- package/packages/web/dist/assets/{diagram-LMA3HP47-iUMeaR-J.js → diagram-LMA3HP47-DC-bDqxV.js} +1 -1
- package/packages/web/dist/assets/{diagram-OG6HWLK6-oEH6olHK.js → diagram-OG6HWLK6-XXfHDMhE.js} +1 -1
- package/packages/web/dist/assets/{erDiagram-TEJ5UH35-VtQqF9SY.js → erDiagram-TEJ5UH35-CHEd8JiS.js} +1 -1
- package/packages/web/dist/assets/{flowDiagram-I6XJVG4X-wvF2EkJa.js → flowDiagram-I6XJVG4X-BbuYxd15.js} +1 -1
- package/packages/web/dist/assets/{ganttDiagram-6RSMTGT7-ng4qJ0E1.js → ganttDiagram-6RSMTGT7-BkF77xn5.js} +1 -1
- package/packages/web/dist/assets/{gitGraphDiagram-PVQCEYII-BV4aWy8k.js → gitGraphDiagram-PVQCEYII-BdL5zVez.js} +2 -2
- package/packages/web/dist/assets/index-C3MdCCzF.js +71 -0
- package/packages/web/dist/assets/index-DYccdR9x.css +1 -0
- package/packages/web/dist/assets/{infoDiagram-5YYISTIA-BpGTxAjU.js → infoDiagram-5YYISTIA-vhTRATYg.js} +1 -1
- package/packages/web/dist/assets/{ishikawaDiagram-YF4QCWOH-Cj36LyoS.js → ishikawaDiagram-YF4QCWOH-CxjN-7YF.js} +2 -2
- package/packages/web/dist/assets/{journeyDiagram-JHISSGLW-0vNlg3um.js → journeyDiagram-JHISSGLW-DJ414TaX.js} +1 -1
- package/packages/web/dist/assets/{kanban-definition-UN3LZRKU-wijkEDaR.js → kanban-definition-UN3LZRKU-gaQeFRvZ.js} +1 -1
- package/packages/web/dist/assets/{linear-LqRymMD_.js → linear-CcvdFgxd.js} +1 -1
- package/packages/web/dist/assets/{mermaid.core-DPrhSs95.js → mermaid.core-Es6hedDB.js} +5 -5
- package/packages/web/dist/assets/{mindmap-definition-RKZ34NQL-en-uGqgC.js → mindmap-definition-RKZ34NQL-Dk7qf3FR.js} +1 -1
- package/packages/web/dist/assets/{pieDiagram-4H26LBE5-DKBZ2Vnx.js → pieDiagram-4H26LBE5-CSWXwU6d.js} +3 -3
- package/packages/web/dist/assets/{quadrantDiagram-W4KKPZXB--g-WtxyL.js → quadrantDiagram-W4KKPZXB-CBVdURbr.js} +1 -1
- package/packages/web/dist/assets/{requirementDiagram-4Y6WPE33-Dl4eYxDI.js → requirementDiagram-4Y6WPE33-CbU18IZA.js} +3 -3
- package/packages/web/dist/assets/{sankeyDiagram-5OEKKPKP-7lt4gqSw.js → sankeyDiagram-5OEKKPKP-BeAlNgjE.js} +4 -4
- package/packages/web/dist/assets/{sequenceDiagram-3UESZ5HK-COgq-dXg.js → sequenceDiagram-3UESZ5HK-CKVKzxTs.js} +1 -1
- package/packages/web/dist/assets/{stateDiagram-AJRCARHV-CL6XC79S.js → stateDiagram-AJRCARHV-B-aSaO4W.js} +1 -1
- package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-TptFh32C.js +2 -0
- package/packages/web/dist/assets/{timeline-definition-PNZ67QCA-C5egKeGT.js → timeline-definition-PNZ67QCA-CP9JHEBr.js} +1 -1
- package/packages/web/dist/assets/{vennDiagram-CIIHVFJN-C_UhtC8u.js → vennDiagram-CIIHVFJN-Dbtwwvvd.js} +1 -1
- package/packages/web/dist/assets/{wardley-L42UT6IY-Bj9chUqz.js → wardley-L42UT6IY-NonvEhoT.js} +1 -1
- package/packages/web/dist/assets/{wardleyDiagram-YWT4CUSO-D7VnZoRp.js → wardleyDiagram-YWT4CUSO-CDnpv9Ws.js} +2 -2
- package/packages/web/dist/assets/{xychartDiagram-2RQKCTM6-VrWLDoi4.js → xychartDiagram-2RQKCTM6-C1i-Wk0H.js} +1 -1
- package/packages/web/dist/fonts/alegreya-latin-italic.woff2 +0 -0
- package/packages/web/dist/fonts/alegreya-latin.woff2 +0 -0
- package/packages/web/dist/fonts/alegreya-sc-latin-500.woff2 +0 -0
- package/packages/web/dist/fonts/alegreya-sc-latin-700.woff2 +0 -0
- package/packages/web/dist/fonts/courier-prime-latin-400.woff2 +0 -0
- package/packages/web/dist/fonts/courier-prime-latin-700.woff2 +0 -0
- package/packages/web/dist/fonts/courier-prime-latin-italic.woff2 +0 -0
- package/packages/web/dist/fonts/iosevka-terminal-400.woff2 +0 -0
- package/packages/web/dist/fonts/iosevka-terminal-700.woff2 +0 -0
- package/packages/web/dist/fonts/martian-mono-latin.woff2 +0 -0
- package/packages/web/dist/fonts/saira-latin.woff2 +0 -0
- package/packages/web/dist/index.html +61 -12
- package/packages/web/dist/sw.js +1 -1
- package/packages/server/dist/cli/here.d.ts +0 -25
- package/packages/server/dist/cli/here.js +0 -104
- package/packages/web/dist/assets/InstanceConfigPage-DKzAHOhx.js +0 -2
- package/packages/web/dist/assets/ProjectRedirect-WczXTV0_.js +0 -2
- package/packages/web/dist/assets/ProjectView-Dd_myWpV.js +0 -13
- package/packages/web/dist/assets/ProjectsGrid-BeJj0q6Y.js +0 -2
- package/packages/web/dist/assets/channel-DUsOl5_p.js +0 -2
- package/packages/web/dist/assets/classDiagram-4FO5ZUOK-CIdDKEqH.js +0 -2
- package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-CIdDKEqH.js +0 -2
- package/packages/web/dist/assets/diagram-2AECGRRQ-fe9cDHyn.js +0 -44
- package/packages/web/dist/assets/diagram-5GNKFQAL-T0tQlfbl.js +0 -11
- package/packages/web/dist/assets/format-CvRqOKZU.js +0 -2
- package/packages/web/dist/assets/index-DGNSeqL-.js +0 -71
- package/packages/web/dist/assets/index-DMRbU1Jl.css +0 -1
- package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-BDlRyphY.js +0 -2
package/packages/web/dist/sw.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* literal token below is the dev/un-built fallback (the SW is not registered in
|
|
28
28
|
* dev, so it never actually runs unreplaced).
|
|
29
29
|
*/
|
|
30
|
-
const CACHE_VERSION = "paddock-0.
|
|
30
|
+
const CACHE_VERSION = "paddock-0.68.0-10eb4c015707";
|
|
31
31
|
const SHELL_URL = "/";
|
|
32
32
|
|
|
33
33
|
// Minimal set precached on install so a cold, offline launch has its shell and
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Directory name that both stores `--here` state and marks the workspace. */
|
|
2
|
-
export declare const HERE_MARKER = ".paddock";
|
|
3
|
-
/** Has this directory been opened with `--here` before? */
|
|
4
|
-
export declare function isHereWorkspace(dir: string): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* How many of `dir`'s existing Claude Code sessions are worth offering.
|
|
7
|
-
*
|
|
8
|
-
* **`encodePathForCli`, not `transcripts.ts`'s `encodeProjectDir`.** The latter
|
|
9
|
-
* omits Claude Code's truncate-and-hash branch for paths over 200 characters,
|
|
10
|
-
* on the explicit assumption that "paddock's project dirs are always short".
|
|
11
|
-
* An arbitrary user directory is exactly where that assumption fails.
|
|
12
|
-
*
|
|
13
|
-
* `MIN_TRANSCRIPT_BYTES` is shared with `AdoptableIndex` so the number quoted
|
|
14
|
-
* here matches what the UI will actually offer to import — a count that
|
|
15
|
-
* disagreed with the import screen would be worse than no count.
|
|
16
|
-
*/
|
|
17
|
-
export declare function countClaudeSessions(claudeHome: string, dir: string): number;
|
|
18
|
-
/**
|
|
19
|
-
* Add `entry` to `dir`'s `.gitignore` if no equivalent line is already there.
|
|
20
|
-
*
|
|
21
|
-
* Mirrors `ProjectStore.ensureRootGitignore`: read, tolerate the equivalent
|
|
22
|
-
* forms, append rather than overwrite. `--here` runs inside somebody's real
|
|
23
|
-
* repository, so clobbering their `.gitignore` is not an option.
|
|
24
|
-
*/
|
|
25
|
-
export declare function ensureGitignored(dir: string, entry: string): void;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `--here` support: opening the user's own directory as a Paddock workspace (#640).
|
|
3
|
-
*
|
|
4
|
-
* ## Why this needs no new concept
|
|
5
|
-
*
|
|
6
|
-
* A *project* cannot live outside `projectsRoot` — `dirFor` joins the key onto
|
|
7
|
-
* the root with no branch, deliberately. But the **root workspace** is a
|
|
8
|
-
* different thing: its key is `""`, so `dirFor("")` resolves to `projectsRoot`
|
|
9
|
-
* itself, and `projectsRoot` is user-configurable. Pointing
|
|
10
|
-
* `PADDOCK_PROJECTS_DIR` at a directory therefore makes that directory the root
|
|
11
|
-
* workspace, named after its own basename, with no schema change anywhere.
|
|
12
|
-
*
|
|
13
|
-
* Session adoption then works by construction: `AdoptableIndex`'s notebook
|
|
14
|
-
* branch matches on exact `cwd === project.workingDir` equality, and in this
|
|
15
|
-
* mode the workspace's working directory IS the user's cwd.
|
|
16
|
-
*
|
|
17
|
-
* ## Why the data dir goes inside the directory
|
|
18
|
-
*
|
|
19
|
-
* `--here` puts state in `<dir>/.paddock` rather than the shared `~/.paddock`.
|
|
20
|
-
* Two reasons, and the second is the important one:
|
|
21
|
-
*
|
|
22
|
-
* 1. **Self-containment.** Opening directory A and later directory B must not
|
|
23
|
-
* have them share one job store, herdctl config and sidecar set — that is
|
|
24
|
-
* how A's run history leaks into B's UI.
|
|
25
|
-
* 2. **It gives us an unambiguous marker.** A second, flagless run in the same
|
|
26
|
-
* directory should resume it (the `git` model: `--here` is `git init`,
|
|
27
|
-
* `.paddock/` is `.git`). Keying that off `project.yaml` would be ambiguous
|
|
28
|
-
* — that filename already exists in the wild, including in every project
|
|
29
|
-
* directory of the `edspencer/projects` notes repo — whereas `.paddock/` is
|
|
30
|
-
* ours and its presence means exactly one thing.
|
|
31
|
-
*/
|
|
32
|
-
import fs from "node:fs";
|
|
33
|
-
import path from "node:path";
|
|
34
|
-
import { encodePathForCli } from "@herdctl/core";
|
|
35
|
-
import { MIN_TRANSCRIPT_BYTES } from "../adoptable.js";
|
|
36
|
-
/** Directory name that both stores `--here` state and marks the workspace. */
|
|
37
|
-
export const HERE_MARKER = ".paddock";
|
|
38
|
-
/** Has this directory been opened with `--here` before? */
|
|
39
|
-
export function isHereWorkspace(dir) {
|
|
40
|
-
try {
|
|
41
|
-
return fs.statSync(path.join(dir, HERE_MARKER)).isDirectory();
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* How many of `dir`'s existing Claude Code sessions are worth offering.
|
|
49
|
-
*
|
|
50
|
-
* **`encodePathForCli`, not `transcripts.ts`'s `encodeProjectDir`.** The latter
|
|
51
|
-
* omits Claude Code's truncate-and-hash branch for paths over 200 characters,
|
|
52
|
-
* on the explicit assumption that "paddock's project dirs are always short".
|
|
53
|
-
* An arbitrary user directory is exactly where that assumption fails.
|
|
54
|
-
*
|
|
55
|
-
* `MIN_TRANSCRIPT_BYTES` is shared with `AdoptableIndex` so the number quoted
|
|
56
|
-
* here matches what the UI will actually offer to import — a count that
|
|
57
|
-
* disagreed with the import screen would be worse than no count.
|
|
58
|
-
*/
|
|
59
|
-
export function countClaudeSessions(claudeHome, dir) {
|
|
60
|
-
const folder = path.join(claudeHome, "projects", encodePathForCli(dir));
|
|
61
|
-
let entries;
|
|
62
|
-
try {
|
|
63
|
-
entries = fs.readdirSync(folder);
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
return 0;
|
|
67
|
-
}
|
|
68
|
-
let n = 0;
|
|
69
|
-
for (const entry of entries) {
|
|
70
|
-
if (!entry.endsWith(".jsonl"))
|
|
71
|
-
continue;
|
|
72
|
-
try {
|
|
73
|
-
if (fs.statSync(path.join(folder, entry)).size >= MIN_TRANSCRIPT_BYTES)
|
|
74
|
-
n++;
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
/* raced or unreadable — not offerable either way */
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return n;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Add `entry` to `dir`'s `.gitignore` if no equivalent line is already there.
|
|
84
|
-
*
|
|
85
|
-
* Mirrors `ProjectStore.ensureRootGitignore`: read, tolerate the equivalent
|
|
86
|
-
* forms, append rather than overwrite. `--here` runs inside somebody's real
|
|
87
|
-
* repository, so clobbering their `.gitignore` is not an option.
|
|
88
|
-
*/
|
|
89
|
-
export function ensureGitignored(dir, entry) {
|
|
90
|
-
const file = path.join(dir, ".gitignore");
|
|
91
|
-
let existing = "";
|
|
92
|
-
try {
|
|
93
|
-
existing = fs.readFileSync(file, "utf8");
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
/* no .gitignore yet */
|
|
97
|
-
}
|
|
98
|
-
const bare = entry.replace(/^\/|\/$/g, "");
|
|
99
|
-
const have = new Set(existing.split("\n").map((l) => l.trim()));
|
|
100
|
-
if (have.has(`/${bare}/`) || have.has(`${bare}/`) || have.has(bare))
|
|
101
|
-
return;
|
|
102
|
-
const body = existing && !existing.endsWith("\n") ? `${existing}\n` : existing;
|
|
103
|
-
fs.writeFileSync(file, `${body}${entry}\n`, "utf8");
|
|
104
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as p,k as Y,b as w,j as t,A as B,l as Z,X as _,m as ee,n as te,p as ne,M as re,q as se}from"./index-DGNSeqL-.js";function ae(){const[e,n]=p.useState(null),[i,o]=p.useState(!0),[s,c]=p.useState(null),[l,h]=p.useState({}),[u,$]=p.useState(!1),[A,y]=p.useState(null),[D,S]=p.useState(!1),[f,q]=p.useState(""),[v,G]=p.useState(!1),[P,O]=p.useState(null),R=p.useRef(null),z=Y("(min-width: 1024px)");p.useEffect(()=>{let r=!0;return o(!0),w.getInstanceConfig().then(a=>{r&&(n(a),c(null))}).catch(a=>r&&c(a instanceof Error?a.message:String(a))).finally(()=>r&&o(!1)),()=>{r=!1}},[]);const H=(r,a)=>{S(!1),y(null),h(d=>({...d,[r]:a}))},K=r=>L(r,l),C=p.useMemo(()=>e?e.groups.flatMap(r=>r.fields):[],[e]),x=p.useMemo(()=>C.filter(r=>r.editable&&!r.envOverridden).filter(r=>Object.prototype.hasOwnProperty.call(l,r.key)).filter(r=>!M(l[r.key],T(r))).map(r=>r.key),[C,l]),I=p.useMemo(()=>new Set(x),[x]),m=p.useMemo(()=>{if(!e)return[];const r=f.trim().toLowerCase(),a=[];for(const d of e.groups){const g=r!==""&&d.label.toLowerCase().includes(r),j=d.fields.filter(b=>{const N=L(b,l);return v&&M(N,b.default)?!1:r===""||g?!0:fe(b).includes(r)});j.length>0&&a.push({...d,fields:j})}return a},[e,f,v,l]),V=m.reduce((r,a)=>r+a.fields.length,0),X=f.trim()!==""||v,J=m.some(r=>r.fields.some(a=>a.envOverridden));p.useEffect(()=>{const r=R.current;if(!r||m.length===0)return;const a=m.map(g=>g.id),d=()=>{const g=r.getBoundingClientRect().top;let j=a[0];for(const b of a){const N=document.getElementById(F(b));if(N)if(N.getBoundingClientRect().top-g<=80)j=b;else break}O(j)};return d(),r.addEventListener("scroll",d,{passive:!0}),()=>r.removeEventListener("scroll",d)},[m]);const Q=r=>{var d;const a=document.getElementById(F(r));(d=a==null?void 0:a.scrollIntoView)==null||d.call(a,{behavior:"smooth",block:"start"}),O(r)},U=async()=>{if(x.length===0||!e)return;const r={};for(const a of x)r[a]=l[a];$(!0),y(null);try{await w.updateInstanceConfig(r,e.configVersion);const a=await w.getInstanceConfig();n(a),h({}),S(!0)}catch(a){if(a instanceof te&&a.status===409)try{n(await w.getInstanceConfig())}catch{}y(a instanceof Error?a.message:String(a))}finally{$(!1)}},W=()=>{h({}),y(null),S(!1)};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex min-h-0 flex-1",children:[e&&t.jsx(ie,{groups:m,active:P,onJump:Q,dirtyCount:be(m,I)}),t.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e&&t.jsx(oe,{query:f,onQuery:q,modifiedOnly:v,onModifiedOnly:G,visibleCount:V,totalCount:C.length,filtering:X,autoFocus:z}),t.jsx("div",{ref:R,className:"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-6",children:t.jsxs("div",{className:"mx-auto max-w-4xl",children:[t.jsx(le,{saved:D,configPath:e==null?void 0:e.configPath,restartRequired:(e==null?void 0:e.restartRequired)??!1,fileError:e==null?void 0:e.configFileError}),i&&t.jsx("p",{className:"text-sm text-paddock-500",children:"Loading…"}),s&&t.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400",role:"alert",children:["Failed to load settings: ",s]}),e&&J&&t.jsx(de,{}),e&&V===0&&t.jsxs("p",{className:"py-8 text-center text-sm text-paddock-500",children:["No settings match"," ",f.trim()?t.jsxs(t.Fragment,{children:["“",t.jsx("span",{className:"font-medium",children:f.trim()}),"”"]}):"this filter","."]}),m.map((r,a)=>t.jsx(ce,{group:r,first:a===0,children:t.jsx("div",{className:"grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2",children:r.fields.map(d=>t.jsx(pe,{field:d,value:K(d),dirty:I.has(d.key),onChange:g=>H(d.key,g)},d.key))})},r.id))]})})]})]}),e&&t.jsxs("footer",{className:"flex items-center gap-3 border-t border-paddock-200 px-4 py-3 dark:border-paddock-800 sm:px-6",children:[A&&t.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] text-red-600 dark:text-red-400",role:"alert",children:[t.jsx(B,{width:14,height:14,className:"shrink-0"}),A]}),t.jsx("span",{className:"ml-auto text-[12px] text-paddock-400",children:x.length>0?`${x.length} unsaved change${x.length===1?"":"s"}`:"No changes"}),t.jsx("button",{type:"button",className:"btn-subtle",onClick:W,disabled:x.length===0||u,children:"Reset"}),t.jsx("button",{type:"button",className:"btn-primary",onClick:U,disabled:x.length===0||u,children:u?"Saving…":"Save changes"})]})]})}function ie({groups:e,active:n,onJump:i,dirtyCount:o}){return t.jsx("nav",{"aria-label":"Config sections",className:"hidden w-52 shrink-0 overflow-y-auto border-r border-paddock-200 px-2 py-4 dark:border-paddock-800 lg:block",children:t.jsx("ul",{className:"space-y-0.5",children:e.map(s=>{const c=s.id===n,l=o[s.id]??0;return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>i(s.id),"aria-current":c?"true":void 0,className:`flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-[13px] transition-colors ${c?"bg-paddock-100 font-medium text-paddock-900 dark:bg-paddock-800 dark:text-paddock-100":"text-paddock-500 hover:bg-paddock-100/60 hover:text-paddock-800 dark:hover:bg-paddock-800/50 dark:hover:text-paddock-200"}`,children:[t.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.label}),l>0&&t.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent","aria-label":`${l} unsaved`}),t.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-paddock-400",children:s.fields.length})]})},s.id)})})})}function oe({query:e,onQuery:n,modifiedOnly:i,onModifiedOnly:o,visibleCount:s,totalCount:c,filtering:l,autoFocus:h}){return t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-paddock-200 px-4 py-2.5 dark:border-paddock-800 sm:px-6",children:[t.jsxs("div",{className:"relative min-w-0 flex-1 sm:max-w-sm",children:[t.jsx(Z,{width:14,height:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-paddock-400"}),t.jsx("input",{type:"search","aria-label":"Search settings",placeholder:"Search settings, keys, env vars…",className:"input h-8 w-full pl-8 pr-7 text-[13px] [&::-webkit-search-cancel-button]:appearance-none",value:e,autoFocus:h,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Escape"&&e!==""&&(u.preventDefault(),n(""))}}),e!==""&&t.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>n(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-paddock-400 hover:text-paddock-700 dark:hover:text-paddock-200",children:t.jsx(_,{width:13,height:13})})]}),t.jsx("button",{type:"button","aria-pressed":i,onClick:()=>o(!i),className:`shrink-0 rounded-md border px-2.5 py-1 text-[12px] transition-colors ${i?"border-accent/60 bg-accent/10 text-accent":"border-paddock-200 text-paddock-500 hover:text-paddock-800 dark:border-paddock-700 dark:hover:text-paddock-200"}`,children:"Modified only"}),t.jsx("span",{className:"shrink-0 text-[12px] tabular-nums text-paddock-400",children:l?`${s} of ${c}`:`${c} settings`})]})}function le({saved:e,configPath:n,restartRequired:i,fileError:o}){const s=o?"red":e?"emerald":"amber";return t.jsxs("div",{role:"status",className:`mb-5 flex items-start gap-2 rounded-lg border px-3 py-2.5 text-[13px] leading-snug ${s==="red"?"border-red-300 bg-red-50 text-red-800 dark:border-red-700/60 dark:bg-red-900/20 dark:text-red-300":s==="emerald"?"border-emerald-300 bg-emerald-50 text-emerald-800 dark:border-emerald-700/60 dark:bg-emerald-900/20 dark:text-emerald-300":"border-amber-300 bg-amber-50 text-amber-800 dark:border-amber-700/60 dark:bg-amber-900/20 dark:text-amber-300"}`,children:[s==="emerald"?t.jsx(ee,{width:15,height:15,className:"mt-0.5 shrink-0"}):t.jsx(B,{width:15,height:15,className:"mt-0.5 shrink-0"}),t.jsx("span",{children:o?t.jsxs(t.Fragment,{children:[t.jsxs("strong",{children:["Could not read ",E(n),"."]})," ",o," — the values below are the running instance's; what a restart would load is unknown until the file parses."]}):e?t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Saved to disk."})," These changes take effect only after the server restarts."]}):i?t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Restart pending."})," ",t.jsx("code",{className:"font-mono text-[12px]",children:E(n)})," holds changes the running instance has not picked up — the fields below marked"," ",t.jsx(k,{tone:"amber",children:"restart"})," differ from what is in force right now."]}):t.jsxs(t.Fragment,{children:["Changes here are written to ",t.jsx("code",{className:"font-mono text-[12px]",children:E(n)})," ","and take effect only after the server restarts — the running instance keeps its current config until then."]})})]})}function de(){return t.jsxs("p",{className:"mb-5 text-[12px] leading-snug text-paddock-500",children:["Settings marked ",t.jsx(k,{tone:"amber",children:"env"})," are overridden by an environment variable, which wins over this file — edit that variable (and restart) to change them."]})}function ce({group:e,first:n,children:i}){return t.jsxs("section",{id:F(e.id),className:`scroll-mt-4 ${n?"":"mt-9 border-t border-paddock-200 pt-7 dark:border-paddock-800"}`,children:[t.jsx("h2",{className:"text-base font-semibold tracking-tight text-paddock-900 dark:text-paddock-50",children:e.label}),e.description&&t.jsx("p",{className:"mt-1 text-[12px] leading-snug text-paddock-500",children:e.description}),t.jsx("div",{className:"mt-4",children:i})]})}function pe({field:e,value:n,dirty:i,onChange:o}){const s=!e.editable||e.envOverridden,c=`cfg-${e.key}`,l=e.type==="boolean";return t.jsxs("div",{className:`min-w-0 ${ge(e,n)?"sm:col-span-2":""} ${i?"-ml-2.5 border-l-2 border-accent pl-2":""}`,children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("label",{htmlFor:s||l?void 0:c,className:"min-w-0 text-[13px] font-medium",children:[t.jsx("span",{className:"align-middle",children:e.label}),e.sensitive&&t.jsx(k,{tone:"amber",children:"sensitive"}),e.envOverridden&&t.jsx(k,{tone:"amber",title:`Overridden by environment variable ${e.envVar} — edit that env var (and restart) to change it.`,children:"env"}),!e.editable&&!e.envOverridden&&t.jsx(k,{tone:"plain",children:"read-only"}),e.pendingRestart&&t.jsx(k,{tone:"amber",title:"The config file and the running instance disagree on this field — restart to apply.",children:"restart"})]}),l&&!s&&t.jsx(ue,{id:c,checked:!!n,onChange:o,label:e.label})]}),e.help&&t.jsx("p",{className:"mt-0.5 text-[12px] leading-snug text-paddock-500",children:e.help}),s?t.jsx(he,{field:e,value:n}):!l&&t.jsx(me,{field:e,value:n,onChange:o,inputId:c}),e.envOverridden&&t.jsx("p",{className:"mt-1 truncate font-mono text-[11px] text-amber-600 dark:text-amber-500/90",children:e.envVar}),e.pendingRestart&&t.jsxs("p",{className:"mt-1 text-[11px] leading-snug text-amber-600 dark:text-amber-500/90",children:["In force now: ",t.jsx("span",{className:"font-mono",children:xe(e.value)})]})]})}function xe(e){if(e==null||e==="")return"(not set)";const i=(Array.isArray(e)?e.join(", "):String(e)).replace(/\s+/g," ").trim();return i.length>60?`${i.slice(0,60)}…`:i}function k({children:e,tone:n,title:i}){return t.jsx("span",{title:i,className:`ml-1.5 rounded px-1 py-px align-middle text-[10px] font-semibold uppercase tracking-wide ${n==="amber"?"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400":"bg-paddock-100 text-paddock-500 dark:bg-paddock-800 dark:text-paddock-400"}`,children:e})}function ue({id:e,checked:n,onChange:i,label:o}){return t.jsxs("label",{htmlFor:e,className:"relative shrink-0 cursor-pointer",children:[t.jsx("input",{id:e,type:"checkbox","aria-label":o,className:"peer sr-only",checked:n,onChange:s=>i(s.target.checked)}),t.jsx("span",{className:"block h-[18px] w-8 rounded-full bg-paddock-300 transition-colors after:absolute after:left-[2px] after:top-[2px] after:h-[14px] after:w-[14px] after:rounded-full after:bg-white after:transition-transform after:content-[''] peer-checked:bg-accent peer-checked:after:translate-x-[14px] peer-focus-visible:ring-2 peer-focus-visible:ring-accent/50 dark:bg-paddock-700"})]})}function me({field:e,value:n,onChange:i,inputId:o}){if(e.type==="enum")return t.jsx("select",{id:o,className:"input mt-1.5",value:String(n??""),onChange:s=>i(s.target.value),children:(e.enumValues??[]).map(s=>t.jsx("option",{value:s,children:s},s))});if(e.type==="number")return t.jsx("input",{id:o,type:"number",className:"input mt-1.5",value:n==null?"":String(n),placeholder:e.default===null?"default":String(e.default),onChange:s=>i(s.target.value===""?null:Number(s.target.value))});if(e.type==="text"){const s=n==null||n===e.default,c=n==null?String(e.default??""):String(n),l=typeof e.default=="string"&&!s;return t.jsxs("div",{className:"mt-1.5",children:[t.jsx("textarea",{id:o,className:"input min-h-[7rem] resize-y font-mono text-[12px] leading-relaxed",rows:6,spellCheck:!1,value:c,onChange:h=>i(h.target.value)}),t.jsxs("div",{className:"mt-1 flex items-center justify-between gap-3 text-[12px] text-paddock-500",children:[t.jsx("span",{children:s?"Using the built-in default.":n===""?"Empty — nothing will be appended.":`${c.length.toLocaleString()} characters.`}),l&&t.jsx("button",{type:"button",className:"shrink-0 underline underline-offset-2 hover:text-paddock-700 dark:hover:text-paddock-300",onClick:()=>i(null),children:"Restore default"})]})]})}if(e.type==="string-list"){const s=Array.isArray(n)?n.join(", "):String(n??"");return t.jsx("input",{id:o,type:"text",className:"input mt-1.5",value:s,onChange:c=>i(c.target.value.split(",").map(l=>l.trim()).filter(Boolean))})}return t.jsx("input",{id:o,type:"text",className:"input mt-1.5",value:n==null?"":String(n),placeholder:e.default===null?"":String(e.default),onChange:s=>i(s.target.value)})}function he({field:e,value:n}){return t.jsx("div",{className:"mt-1 text-[12px] text-paddock-600 dark:text-paddock-300",children:e.type==="boolean"?t.jsx("span",{className:"font-mono",children:n?"true":"false"}):n==null||n===""?t.jsx("span",{className:"italic text-paddock-400",children:e.type==="text"&&n===""?"(empty — nothing appended)":"(not set)"}):e.type==="text"?t.jsx("span",{className:"block max-h-40 overflow-y-auto whitespace-pre-wrap rounded bg-paddock-50 px-2 py-1.5 font-mono text-[12px] leading-relaxed dark:bg-paddock-900/40",children:String(n)}):t.jsx("span",{className:"block break-all font-mono",children:Array.isArray(n)?n.join(", "):String(n)})})}function ge(e,n){return e.type==="text"||e.type==="string-list"?!0:(Array.isArray(n)?n.join(", "):n==null?"":String(n)).length>38}function fe(e){return[e.label,e.key,e.help,e.envVar,...e.enumValues??[]].filter(Boolean).join(" ").toLowerCase()}function be(e,n){const i={};for(const o of e)i[o.id]=o.fields.filter(s=>n.has(s.key)).length;return i}const F=e=>`cfg-section-${e}`;function T(e){return e.pendingValue===void 0?e.value:e.pendingValue}function L(e,n){return Object.prototype.hasOwnProperty.call(n,e.key)?n[e.key]:T(e)}function M(e,n){return Array.isArray(e)&&Array.isArray(n)?e.length===n.length&&e.every((i,o)=>i===n[o]):e===n}function E(e){if(!e)return"paddock.config.yaml";const n=e.split("/");return n[n.length-1]||e}function je(){const e=ne(),n=(e==null?void 0:e.openNav)??(()=>{});return t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-paddock-200 px-3 pb-2.5 dark:border-paddock-800 sm:px-6 lg:py-4",children:[t.jsx("button",{type:"button",onClick:n,"aria-label":"Open menu",className:"btn-subtle -ml-1 shrink-0 px-2 py-1.5 lg:hidden",children:t.jsx(re,{width:20,height:20})}),t.jsx(se,{width:18,height:18,className:"shrink-0 text-paddock-400"}),t.jsx("h1",{className:"text-[15px] font-semibold tracking-tight",children:"Config"})]}),t.jsx(ae,{})]})}export{je as InstanceConfigPage};
|
|
2
|
-
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as u,r as o,b as i,j as n,i as p}from"./index-DGNSeqL-.js";import{r as d,v as h}from"./lastTab-CU1zsF0j.js";function j(){const{slug:t=""}=u(),[s,r]=o.useState(null);return o.useEffect(()=>{let c=!1;const e=d(t);if(!e){r("home");return}if(e==="home"||e.startsWith("chat")){r(e);return}return Promise.all([i.getProjectDetail(t).then(a=>a.project.pinned).catch(()=>[]),i.listProjectFiles(t).catch(()=>[])]).then(([a,l])=>{c||r(h(e,{pinned:a,files:l}))}),()=>{c=!0}},[t]),s===null?n.jsx("div",{className:"p-8 text-sm text-paddock-500",children:"Opening project…"}):n.jsx(p,{to:`/projects/${t}/${s}`,replace:!0})}export{j as ProjectRedirect};
|
|
2
|
-
|