@galda/cli 0.10.113 → 0.10.114

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/LICENSE.md ADDED
@@ -0,0 +1,33 @@
1
+ # Galda CLI license
2
+
3
+ Copyright (c) 2026 Kodo Inc. All rights reserved.
4
+
5
+ This software is proprietary and source-available. The source is distributed
6
+ so that you can read, audit, and verify what runs on your machine. It is not
7
+ open source.
8
+
9
+ ## You may
10
+
11
+ - Install and run this software, for personal or commercial purposes, subject
12
+ to a valid Galda subscription where one is required.
13
+ - Read, inspect, and audit the source code, including for security review.
14
+ - Modify it locally for your own use.
15
+
16
+ ## You may not
17
+
18
+ - Redistribute, resell, sublicense, or host this software, in whole or in
19
+ part, whether modified or unmodified.
20
+ - Use the source code to build or operate a competing product or service.
21
+ - Remove or obscure this notice.
22
+
23
+ ## No warranty
24
+
25
+ This software is provided "as is", without warranty of any kind, express or
26
+ implied, including but not limited to the warranties of merchantability,
27
+ fitness for a particular purpose, and non-infringement. In no event shall the
28
+ copyright holder be liable for any claim, damages, or other liability arising
29
+ from, out of, or in connection with this software or its use.
30
+
31
+ ## Contact
32
+
33
+ https://galda.app
package/app/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
6
6
  <title>Galda</title>
7
7
  <script>
8
8
  // app/index.html is a server-backed SPA, not a standalone artifact. Rendering the
@@ -31,7 +31,7 @@
31
31
  /* Design tokens + light/dark palette live in app/theme.css (design/CDO role).
32
32
  Everything below consumes those tokens; never hard-code colors here. */
33
33
  *{box-sizing:border-box}
34
- html,body{height:100%}
34
+ html,body{height:100%;overflow-x:hidden;overscroll-behavior:none}
35
35
  body{margin:0;background:var(--canvas);color:var(--ink);font-family:var(--ui);
36
36
  font-size:14px;font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased;display:flex;flex-direction:column;overflow:hidden}
37
37
  button{font:inherit}
@@ -333,6 +333,14 @@
333
333
  color:var(--ink2);font:inherit;font-size:12px;cursor:pointer;text-align:left;width:100%}
334
334
  .appopt:hover{background:rgba(var(--tint),.06);color:var(--ink)}
335
335
  .appopt.active{color:var(--ink);background:var(--hair2)}
336
+ /* A chooser is already open somewhere: dim the glyph, no surface, and no hover
337
+ answer — the row must not look pressable while it cannot open a second one. */
338
+ .appopt:disabled{cursor:default}
339
+ .appopt:disabled,.appopt:disabled .nm{color:var(--ink3)}
340
+ .appopt:disabled:hover{background:transparent}
341
+ /* the row's own rule sets .nm to full --ink, so say it again at that weight */
342
+ .ctxmenu .appopt.ctxopen:disabled .nm{color:var(--ink3)}
343
+ .ctxmenu .appopt.ctxopen:disabled svg{opacity:.45}
336
344
  .appopt svg{width:13px;height:13px;stroke:currentColor;stroke-width:1.7;fill:none;stroke-linecap:round;stroke-linejoin:round}
337
345
  .modelsel{position:relative}
338
346
  .modelbtn{font-family:var(--mono);font-size:10.5px;text-transform:capitalize}
@@ -2582,7 +2590,7 @@
2582
2590
  magnification / uniform brighten (§5.5: whole-panel uniform, no dark tint).
2583
2591
  DOM panel backgrounds/shadows/blur are stripped; text reads via R2 "wells"
2584
2592
  (local re-blur + tint behind dense text groups) + --tsh. ---- */
2585
- #glassgl{position:fixed;inset:0;width:100vw;height:100vh;display:none;z-index:-1;pointer-events:none}
2593
+ #glassgl{position:fixed;inset:0;width:100dvw;height:100dvh;display:none;z-index:-1;pointer-events:none}
2586
2594
  body[data-theme="glass"]{background:#0a0a0b}
2587
2595
  body[data-theme="glass"][data-layout="flagship"]{background:transparent} /* WebGL draws the bg (photo is NOT the CSS #themebg here) */
2588
2596
  body[data-theme="glass"][data-layout="flagship"] #glassgl{display:block}
@@ -2654,7 +2662,7 @@
2654
2662
  /* ---- TB縁アニメ canvas (§6.5 確定: 既定=パルス×2番目色・TBのみ周回・Queは含まない).
2655
2663
  Same overlay recipe as the flagship #fx: fixed, pointer-transparent, drawn by the
2656
2664
  TBEDGE rAF loop (JS) which runs only while an animation is selected. ---- */
2657
- #fx{position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;z-index:9}
2665
+ #fx{position:fixed;inset:0;width:100dvw;height:100dvh;pointer-events:none;z-index:9}
2658
2666
  /* ---- TB面 (compbg) × flagship: the layout/theme base rules above outrank the generic
2659
2667
  preset rule (cascade order), so re-layer the tint over each base surface here at the
2660
2668
  end of the sheet. §6.5: TB面は全テーマに重ねられる. ---- */
@@ -2834,7 +2842,7 @@
2834
2842
  moves Review/To Do into a right drawer, and exposes project switching from
2835
2843
  the top-left current-project button. Desktop flagship (>640px) is untouched. ---- */
2836
2844
  @media (max-width: 640px){
2837
- html,body{height:100dvh}
2845
+ html,body{height:100dvh;overflow:hidden;overscroll-behavior:none;touch-action:pan-y}
2838
2846
  body[data-layout="flagship"]{overflow:hidden}
2839
2847
  body[data-layout="flagship"] #fsRoot{height:100dvh;flex-direction:column;padding:8px 24px max(14px, calc(env(safe-area-inset-bottom) + 10px));gap:8px;
2840
2848
  overflow:hidden;position:relative;--fscenterw:100%} /* Masa: side margins — narrower cards (8→18px) */
@@ -2886,7 +2894,7 @@
2886
2894
  /* Masa: composer was too tall — compact it (ChatGPT-like). Controls + send stay on ONE row
2887
2895
  (nowrap; the model/agent chips shrink first, the send never shrinks). */
2888
2896
  body[data-layout="flagship"] #fsRoot .composer{padding:8px 10px;gap:6px;border-radius:14px}
2889
- body[data-layout="flagship"] #fsRoot .composer textarea{font-size:15px;line-height:1.3;padding:1px 2px 0;max-height:90px}
2897
+ body[data-layout="flagship"] #fsRoot .composer textarea{font-size:16px;line-height:1.3;padding:1px 2px 0;max-height:90px}
2890
2898
  body[data-layout="flagship"] #fsRoot .crow{flex-wrap:nowrap;gap:6px}
2891
2899
  /* collapse the agent button to its icon (drop the "Claude Code" label) so the row fits
2892
2900
  one line with the send fully visible; model + effort keep their text. */
@@ -11476,7 +11484,9 @@ function renderCtxBar(){
11476
11484
  // LRM, so the rtl clipping trims the HEAD of the path without reversing the text
11477
11485
  + `<span class="pt">\u200e${esc(folderShort(r.dir))}</span></button>`)
11478
11486
  .join('');
11479
- const openRow = `<button type="button" class="appopt ctxopen" id="ctxopenfolder" title="Open the OS folder chooser"><svg viewBox="0 0 24 24"><path d="M3 7a2 2 0 012-2h4l2 2h8a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"/><path d="M12 11v6M9 14h6"/></svg><span class="nm">Open folder…</span></button>`;
11487
+ // Redrawing the menu must not hand back a second chooser: carry the disabled
11488
+ // state that setFolderPickerBusy() put on the live button.
11489
+ const openRow = `<button type="button" class="appopt ctxopen${folderPickerBusy ? ' busy' : ''}" id="ctxopenfolder"${folderPickerBusy ? ' disabled' : ''} title="Open the OS folder chooser"><svg viewBox="0 0 24 24"><path d="M3 7a2 2 0 012-2h4l2 2h8a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"/><path d="M12 11v6M9 14h6"/></svg><span class="nm">Open folder…</span></button>`;
11480
11490
  menu.innerHTML = `${opts}${openRow}<div class="ctxmsg" id="ctxdirmsg"></div>`;
11481
11491
  }
11482
11492
  // Workspace mode is fixed to the isolated worktree (clean separate checkout). The
@@ -11522,9 +11532,22 @@ async function setProjectFolder(dir){
11522
11532
  // project at the chosen path. This is also correct through the authenticated
11523
11533
  // relay: it forwards the request to the account owner's loopback engine, so the
11524
11534
  // picker opens on that owner's Mac rather than on the hosted relay.
11535
+ // One chooser at a time. The dialog opens over in the engine process and can take
11536
+ // a moment to appear (and may not come to the front at all), so a second tap used
11537
+ // to open a second dialog: ten taps left someone with ten dialogs to dismiss. The
11538
+ // request stays in flight for as long as the dialog is up, so "a request is out"
11539
+ // is exactly "a dialog is open" — no timer to guess with.
11540
+ let folderPickerBusy = false;
11541
+ function setFolderPickerBusy(busy){
11542
+ folderPickerBusy = busy;
11543
+ const btn = $('ctxopenfolder');
11544
+ if (btn) { btn.disabled = busy; btn.classList.toggle('busy', busy); }
11545
+ }
11525
11546
  async function openFolderNative(){
11547
+ if (folderPickerBusy) return;
11526
11548
  const msg = $('ctxdirmsg');
11527
11549
  const say = (t, bad) => { if (msg) { msg.textContent = t; msg.classList.toggle('bad', Boolean(bad)); } };
11550
+ setFolderPickerBusy(true);
11528
11551
  say('Opening the folder chooser…');
11529
11552
  try {
11530
11553
  const r = await fetch(withKey('/api/choose-folder'), { method: 'POST' });
@@ -11534,6 +11557,7 @@ async function openFolderNative(){
11534
11557
  if (body.unsupported) { say('This engine can’t open a folder dialog on this system.', true); return; }
11535
11558
  say(body.error || 'Could not open the folder chooser.', true);
11536
11559
  } catch { say('Could not reach the engine.', true); }
11560
+ finally { setFolderPickerBusy(false); }
11537
11561
  }
11538
11562
  $('ctxdirbtn').onclick = (e) => {
11539
11563
  e.stopPropagation();
@@ -149,21 +149,56 @@ await import(pathToFileURL(join(ROOT, 'engine', 'server.mjs')).href);
149
149
  // stable `<id>.<domain>` from any device. Local-first is preserved — the agent
150
150
  // still runs here; the relay is only a door. Opt-in via RELAY_URL for now; the
151
151
  // public build will default it to the deployed relay. See relay/DEPLOY.md.
152
+ // The user can turn remote access OFF in Settings (docs/SECURITY.md). That is
153
+ // the discoverable form of `RELAY_URL=`: no relay child, no outbound socket.
154
+ // The switch is written by the SERVER process, so we read the file here and
155
+ // watch it, letting the toggle take effect without restarting the CLI.
156
+ const { readRelayPref, resolveRelayEnabled, RELAY_PREF_FILE } =
157
+ await import(pathToFileURL(join(ROOT, 'engine', 'relay-pref.mjs')).href);
158
+ // Same resolution the server and relay-client use, spelled out here because the
159
+ // DATA_DIR above is scoped to the single-instance check.
160
+ const RELAY_DATA_DIR = process.env.MANAGER_HOME
161
+ ?? (existsSync(join(ROOT, '.git')) ? join(ROOT, 'engine') : join(homedir(), '.manager-for-ai'));
162
+
152
163
  if (process.env.RELAY_URL) {
153
164
  const { spawn } = await import('node:child_process');
154
165
  const { superviseRelay } = await import(pathToFileURL(join(ROOT, 'engine', 'relay-supervisor.mjs')).href);
166
+ const { watch } = await import('node:fs');
167
+
168
+ let sup = null; // non-null exactly while the relay child is supervised
169
+
155
170
  // Supervise the relay-client: if the CHILD exits (uncaught throw, single-
156
171
  // instance lock refuse) we bring it back with backoff, otherwise the app goes
157
172
  // silently offline ("Unsent"). A tight crash loop (a config/lock error) trips a
158
173
  // circuit breaker so we stop hammering and say why. relay-client heals its own
159
174
  // dropped socket; this heals the whole process dying. See engine/relay-supervisor.mjs.
160
- const sup = superviseRelay({
161
- spawn: () => spawn(process.execPath, [join(ROOT, 'engine', 'relay-client.mjs')], { stdio: 'inherit', env: process.env }),
162
- log: ({ code, signal, delayMs }) => say(`relay-client exited (code ${code ?? 'n/a'}${signal ? `, ${signal}` : ''}) — restarting in ${Math.round(delayMs / 1000)}s`),
163
- onGiveUp: () => say('relay-client keeps exiting immediately giving up; run `npx @galda/cli --signin` or check RELAY_URL'),
164
- });
165
- const stop = () => sup.stop();
166
- process.on('exit', stop);
167
- for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => { stop(); process.exit(0); });
168
- say(`relay: connecting to ${process.env.RELAY_URL} — your fixed URL goes live once you sign in`);
175
+ const startRelay = () => {
176
+ if (sup) return;
177
+ sup = superviseRelay({
178
+ spawn: () => spawn(process.execPath, [join(ROOT, 'engine', 'relay-client.mjs')], { stdio: 'inherit', env: process.env }),
179
+ log: ({ code, signal, delayMs }) => say(`relay-client exited (code ${code ?? 'n/a'}${signal ? `, ${signal}` : ''}) — restarting in ${Math.round(delayMs / 1000)}s`),
180
+ onGiveUp: () => say('relay-client keeps exiting immediately — giving up; run `npx @galda/cli --signin` or check RELAY_URL'),
181
+ });
182
+ say(`relay: connecting to ${process.env.RELAY_URL} your fixed URL goes live once you sign in`);
183
+ };
184
+ const stopRelay = () => { sup?.stop(); sup = null; };
185
+
186
+ const applyPref = () => {
187
+ const want = resolveRelayEnabled({ relayUrl: process.env.RELAY_URL, pref: readRelayPref(RELAY_DATA_DIR) });
188
+ if (want && !sup) startRelay();
189
+ else if (!want && sup) { stopRelay(); say('relay: remote access turned off in Settings — no outbound connection'); }
190
+ };
191
+
192
+ applyPref();
193
+ if (!sup) say('relay: remote access is off (Settings) — running fully local');
194
+
195
+ // The switch is written by the SERVER process (POST /api/relay-pref), so the
196
+ // only way we learn about a click is to watch the file. Same cross-process
197
+ // idiom as relay-status.json / relay-takeover.req.
198
+ try {
199
+ watch(RELAY_DATA_DIR, (_e, name) => { if (name === RELAY_PREF_FILE) applyPref(); }).unref();
200
+ } catch { /* watching is a nicety: the choice still applies on next start */ }
201
+
202
+ process.on('exit', stopRelay);
203
+ for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => { stopRelay(); process.exit(0); });
169
204
  }
@@ -0,0 +1,183 @@
1
+ # Security and permissions
2
+
3
+ What Galda runs on your machine, what it can touch, and what leaves it.
4
+
5
+ Every claim below is a statement about the code in this package. Source
6
+ references are given so you can check them yourself in the published tarball
7
+ (`npm pack @galda/cli`).
8
+
9
+ 日本語の要約は末尾の「日本語」節にあります。
10
+
11
+ ## What Galda is
12
+
13
+ Galda does not contain an AI model and does not talk to one. It starts the
14
+ Claude Code or Codex CLI that is already installed and signed in on your
15
+ machine, and gives you a place to queue work and review the result.
16
+
17
+ That has a direct consequence for your code: **your code is never uploaded to
18
+ Galda for inference.** Claude Code and Codex connect to Anthropic or OpenAI
19
+ directly, on your own subscription. Galda is not in that path and never sees
20
+ that traffic.
21
+
22
+ ## Installation
23
+
24
+ **Galda has no install scripts.** `package.json` declares only `start` and
25
+ `test`; there is no `preinstall`, `install`, `postinstall`, or `prepare`.
26
+ Nothing in this package executes as a side effect of `npm install` or `npx`.
27
+ Code runs only when you start Galda yourself.
28
+
29
+ To read the code before running it:
30
+
31
+ ```
32
+ npm pack @galda/cli # downloads the tarball, runs nothing
33
+ tar -xzf galda-cli-*.tgz # everything Galda ships is plain JavaScript
34
+ ```
35
+
36
+ ## The local server
37
+
38
+ Galda runs an HTTP server on your machine.
39
+
40
+ - It binds to **loopback only** (`127.0.0.1` and `::1`), so it is not reachable
41
+ from your network. See `engine/server.mjs`.
42
+ - Every request requires an access key stored at `~/.manager-for-ai/secret.key`.
43
+ - All state lives in `~/.manager-for-ai/`. Nothing is written elsewhere.
44
+
45
+ To remove Galda completely:
46
+
47
+ ```
48
+ rm -rf ~/.manager-for-ai
49
+ ```
50
+
51
+ That is the whole uninstall. Galda installs no daemons, no login items, no
52
+ kernel extensions, and no browser extensions.
53
+
54
+ ## What the agent is allowed to do
55
+
56
+ Galda does not hand Claude Code or Codex a blank cheque. The tool set is an
57
+ explicit allowlist (`engine/lib.mjs`, `WORKER_TOOLS`).
58
+
59
+ **The agent can:**
60
+
61
+ - Read and edit files, through the `Edit` / `Write` / `Read` / `Glob` / `Grep`
62
+ tools, inside the working copy for the task
63
+ - Run named commands only: language runtimes and package managers (`node`,
64
+ `npm`, `npx`, `pnpm`, `yarn`, `bun`, `deno`, `python`, `pip`, `go`, `cargo`,
65
+ `ruby`, `make`), test and lint runners (`pytest`, `jest`, `vitest`, `tsc`,
66
+ `eslint`, `prettier`), and read-only shell utilities (`cat`, `ls`, `grep`,
67
+ `find`, `diff`, and similar)
68
+ - Read the web (`WebFetch`, `WebSearch`)
69
+
70
+ **The agent cannot:**
71
+
72
+ - Run arbitrary shell commands. `Bash` is not granted; only the named commands
73
+ above are, each as an explicit allowlist entry
74
+ - **Commit, push, checkout, reset, or otherwise change your repository state.**
75
+ Git is granted read-only: `git status`, `git log`, `git diff`, `git show`,
76
+ `git branch`, `git blame`, `git ls-files`, `git rev-parse`. Nothing else
77
+ - Edit files through the shell. File changes go through the `Edit` / `Write`
78
+ tools, so every change appears in the diff you review
79
+
80
+ **Work is isolated from your working tree.** Each task runs in a throwaway git
81
+ worktree, not in the checkout you have open. Your branch, your staged changes,
82
+ and your uncommitted work are not touched.
83
+
84
+ ## What leaves your machine
85
+
86
+ Three separate paths. They are worth keeping apart.
87
+
88
+ ### 1. Model traffic — does not involve Galda
89
+
90
+ Claude Code and Codex talk to Anthropic and OpenAI directly, using the
91
+ subscription already configured on your machine. Galda neither proxies nor
92
+ observes this. Their data handling is governed by their terms, not ours.
93
+
94
+ ### 2. The relay — on by default, and you can turn it off
95
+
96
+ By default Galda opens an outbound WebSocket to `app.galda.app`. This is what
97
+ lets you open your board from your phone without a tunnel, port forwarding, or
98
+ ngrok.
99
+
100
+ Be clear about what this means. The relay is a reverse HTTP tunnel: a request
101
+ made from `app.galda.app` is forwarded over that socket, replayed against your
102
+ local server, and the response body is streamed back
103
+ (`engine/relay-client.mjs`).
104
+
105
+ **Therefore everything your board displays passes through Galda's relay
106
+ server:** task text, activity logs, review summaries, diffs, and proof
107
+ screenshots.
108
+
109
+ The connection is TLS-encrypted in transit. **It is not end-to-end encrypted**,
110
+ which means Galda's relay server is in the path and could read what crosses it.
111
+ We would rather write that down than let you assume otherwise. End-to-end
112
+ encryption is on the roadmap and is not implemented today.
113
+
114
+ **To turn the relay off entirely:**
115
+
116
+ ```
117
+ RELAY_URL= npx @galda/cli
118
+ ```
119
+
120
+ With no relay URL, the relay client is never started and no outbound socket is
121
+ opened (`bin/manager-for-ai.mjs`). You lose remote access from your phone.
122
+ Everything else works exactly the same.
123
+
124
+ ### 3. Your Galda account — licensing
125
+
126
+ Galda checks your license. The verifying public key is compiled into the
127
+ package, so the check itself is offline, but the token is refreshed
128
+ periodically against the billing API. This carries your account identity, not
129
+ your code.
130
+
131
+ ## Analytics
132
+
133
+ Galda records a small set of product events so we can see how the tool is
134
+ actually used and improve it. The list is exhaustive. If it is not named here,
135
+ we do not collect it.
136
+
137
+ **What we record:**
138
+
139
+ | Event | Purpose |
140
+ |---|---|
141
+ | `signup`, `signin` | Account lifecycle |
142
+ | `task_created`, `task_completed`, `task_failed`, `task_interrupted` | Completion and failure rates, so we can find what breaks |
143
+ | `review_approved`, `review_dismissed` | Whether results are actually usable |
144
+ | Which agent ran (Claude Code or Codex) | Where to spend engineering time |
145
+ | App version, OS, Node version | Compatibility and regression tracking |
146
+ | Crash and error events | Fixing crashes |
147
+
148
+ Each carries a timestamp and a pseudonymous account id, and nothing else.
149
+
150
+ **What we never record:**
151
+
152
+ - The text of your requests
153
+ - Your code, diffs, file contents, or file names
154
+ - Repository names or paths
155
+ - Proof screenshots and recordings
156
+
157
+ **Paid business plans: analytics are off.** On business plans no product events
158
+ are collected at all, the way Cursor forces Privacy Mode on for teams. You do
159
+ not have to configure anything.
160
+
161
+ **With the relay off, nothing is collected.** Not reduced, not anonymized:
162
+ nothing. A mode sold as "nothing leaves your machine" that quietly reported
163
+ usage would invalidate every other claim on this page, so it does not.
164
+
165
+ ## Reporting a vulnerability
166
+
167
+ <!-- TODO(Masa): security contact address. -->
168
+
169
+ ## 日本語
170
+
171
+ - Galda は AI モデルを内蔵せず、モデルと通信もしません。すでにあなたのマシンに
172
+ 入っている Claude Code / Codex を起動するだけです。**あなたのコードが推論の
173
+ ために Galda へ送られることはありません。**
174
+ - **インストール時に何も実行しません**(`postinstall` 等が存在しません)。
175
+ - ローカルサーバは **`127.0.0.1` と `::1` にのみ bind** し、ネットワークからは
176
+ 到達できません。アクセスキーが必須です。
177
+ - エージェントに渡している **git は読み取り専用**です。`commit` `push`
178
+ `checkout` `reset` を持ちません。任意のシェル実行もできません。
179
+ - 各タスクは**使い捨ての git worktree** で動き、あなたの作業ツリーには触れません。
180
+ - 既定では、スマホから使えるように **ボードの表示内容が `app.galda.app` の
181
+ relay を通ります**(TLS 保護、**E2E 暗号化は未実装**=経路上に Galda の
182
+ サーバがいます)。`RELAY_URL= npx @galda/cli` で relay を完全に切れます。
183
+ - アンインストールは `rm -rf ~/.manager-for-ai` だけです。
@@ -0,0 +1,57 @@
1
+ // Agent Manager — remote-access preference (the relay on/off switch)
2
+ //
3
+ // WHY THIS EXISTS: the relay is what lets you open your board from your phone,
4
+ // and it is on by default. But everything the board displays crosses Galda's
5
+ // relay server (see docs/SECURITY.md), so some people cannot or will not run
6
+ // it — a security policy that forbids outbound connections, or simply not
7
+ // wanting a third party in the path.
8
+ //
9
+ // That escape hatch already existed as `RELAY_URL= npx @galda/cli`, which is
10
+ // an env var nobody discovers. This makes it a setting, the way Cursor puts
11
+ // Privacy Mode in Settings rather than on the command line.
12
+ //
13
+ // The preference lives in a file in DATA_DIR because the two halves are
14
+ // SEPARATE PROCESSES: the server (:4400) takes the click, the launcher owns
15
+ // the relay child. Same idiom as relay-status.json / relay-takeover.req.
16
+
17
+ import { readFileSync, writeFileSync } from 'node:fs';
18
+ import { join } from 'node:path';
19
+
20
+ export const RELAY_PREF_FILE = 'relay-pref.json';
21
+
22
+ export function relayPrefPath(dataDir) {
23
+ return join(dataDir, RELAY_PREF_FILE);
24
+ }
25
+
26
+ // Should the relay run? Pure — no clock, no I/O, no env.
27
+ //
28
+ // relayUrl : the configured relay endpoint ('' / undefined = none built in)
29
+ // pref : the user's saved choice (true | false | null when never set)
30
+ //
31
+ // Default is ON: a fresh install gets remote access, because that is the
32
+ // product. Only an explicit `false` turns it off, so a corrupt or missing
33
+ // preference file can never silently disable the feature.
34
+ export function resolveRelayEnabled({ relayUrl, pref } = {}) {
35
+ if (!relayUrl) return false;
36
+ return pref !== false;
37
+ }
38
+
39
+ // Read the saved preference. Returns null when the user has never chosen, so
40
+ // callers can tell "unset" from "explicitly on" — resolveRelayEnabled treats
41
+ // both as on, but the UI may want to say so differently.
42
+ export function readRelayPref(dataDir) {
43
+ try {
44
+ const raw = JSON.parse(readFileSync(relayPrefPath(dataDir), 'utf8'));
45
+ return typeof raw?.enabled === 'boolean' ? raw.enabled : null;
46
+ } catch {
47
+ return null; // never set, unreadable, or corrupt — all mean "no choice made"
48
+ }
49
+ }
50
+
51
+ // Save the preference. Throws on a real write failure so the endpoint can
52
+ // report it rather than telling the user it saved something it did not.
53
+ export function writeRelayPref(dataDir, enabled) {
54
+ const value = enabled === true;
55
+ writeFileSync(relayPrefPath(dataDir), JSON.stringify({ enabled: value, at: Date.now() }) + '\n');
56
+ return value;
57
+ }
package/engine/server.mjs CHANGED
@@ -24,6 +24,7 @@ import { needsProjectFolder, folderLabel, chooseFolderScript, parseChosenFolder,
24
24
  import { parseStreamEvents, parseCodexEvents, buildCodexArgs, parsePlan, refinePlanTasks, canEditGoal, canDeleteGoal, shouldAskClarification, workerExitReason, classifyWorkerFailure, isForcedStop, taskStatusAfterVerify, workerResultText, taskCountsAsComplete, resolveWantsPR, resolveGoalSource, buildGoalSummary, buildReviewAttemptLedger, latestGoalOutcomeTask, buildDirtyWorkspacePrBlock, buildGoalProofMd, buildGoalPrBody, buildReviewSummaryPrompt, parseReviewSummary, buildReviewRuleSection, nextGoalStatus, isPrMerged, isPrApproved, reviewToDoneStatus, advanceReviewGoal, revertReviewGoal, approveGoal, dismissGoal, rejectGoal, reopenGoal, permissionModeFor, isPlanReview, nextAfterPlanApprove, GOAL_MODES, parseSkillFrontmatter, collectSkills, retestGoal, cancelRetestGoal, computeRetestOutcome, revertGoal, planRevertActions, archiveGoal, unarchiveGoal, undismissGoal, parseNumstat, truncateDiffText, sumUsage, resolveEntryUrl, rebasePreviewUrl, shouldCreateGoalPR, normalizePullRequestUrl, parseGitLog, diffNewCommits, replayQueueLog, reconcileOrphanGoals, reorderQueue, sortQueueByPriority, TASK_PRIORITIES, validateWorkflowColumns, DEFAULT_WORKFLOW_COLUMNS, validateReviewDefinition, DEFAULT_REVIEW_DEFINITION, resolveTestGate, buildEphemeralSeedLog, buildEphemeralSeedProjects, trimTaskActivityForState, buildAskContext, WORKER_TOOLS, workerPrompt, verifyCfAccessJwt, resolveIdentity, goalVisibleTo, clampParallelLimit, canStartMore, buildQueueWaits, nextRunnableTasks, goalsConflict, detectConflicts, pickFoldTarget, autoFoldReviewsEnabled, parseGitUnifiedDiffLocations, hasTestRelevantChanges, parseFailingTestNames, classifyTestGate, classifyPrSafety, isInconclusiveTestRun, countInfraFlakes, classifyRunFailures, classifyVerifyGate, buildVerificationInfraError, verificationInfraErrorFrom, buildExecutionPlan, buildContextHandoffSummary, buildFailurePostmortem, appendFailureMemory, latestFailurePolicy, classifyChangeRisk, checkRunBudget, usageBudgetTokens, isRateLimited, nextResumeDelay, checkFreeTierLimit, resolveEntitlement, resolveCachedEntitlement, FREE_TIER_LIMITS, QUEUED_GOAL_STATUSES, verifyLicenseToken, licenseTokenPayload, shouldRefreshLicense, shouldEmitSetupCompleted, pickAnalyticsUid, shouldEmitFreeExhausted, detectRequestLanguage, testFailureReason, manualTestRetryPrompt, isNothingVerifiable, isNothingVerifiableForPR, isSuspiciouslyIncompleteDone, classifyComposerIntentHeuristic, detectPauseIntent, buildIntentPrompt, parseIntentResponse, buildBoardSnapshot, validateBoardSnapshot, boardIsEmpty, decideBoardPull, resolveConnectedAgents, pickAvailableAgent, pickUtilityAgent, utilityModel, liveTakeoverDecision, shouldOpenBrowserOnBoot, goalTaskTitle, buildGoalTask, shouldUsePlannerForGoal, RUN_DECL_FILE, REQUIREMENT_EVIDENCE_FILE, parseRequirementEvidenceDocument, parseRunDeclaration, SHOT_DIR, collectShotNames, parseGoalAddress, REPLY_OUTCOMES, buildGoalMessage, serializeGoalMessage, parseGoalMessages, computeInternalQualityMetrics, classifyInternalQualityTaskError, resolveWorkspaceMode, goalSessionFor, setGoalAgentSession, switchGoalAgentSession, parseApprovalRequest } from './lib.mjs';
25
25
  import { migrateRequirementModel, validateRequirementModel } from './requirement-model.mjs';
26
26
  import { buildManagerVerificationChecks, buildRequirementVerificationEvidence, mergeRequirementVerificationEvidence } from './requirement-verification.mjs';
27
+ import { readRelayPref, writeRelayPref, resolveRelayEnabled } from './relay-pref.mjs';
27
28
  import { createSerialQueue } from './lib.mjs';
28
29
  import { wantsPullRequest } from './lib.mjs';
29
30
  import { parseRequirementEvidence, unmappedChangedFiles, previewOpensSomethingElse } from './lib.mjs';
@@ -4436,6 +4437,41 @@ const server = createServer(async (req, res) => {
4436
4437
  catch (e) { return json(res, 500, { error: String(e?.message ?? e) }); }
4437
4438
  return json(res, 200, { ok: true });
4438
4439
  }
4440
+ // GET/POST /api/relay-pref — the remote-access switch in Settings.
4441
+ // Remote access (the relay) is ON by default. Turning it off is the
4442
+ // discoverable form of `RELAY_URL= npx @galda/cli`: with it off no outbound
4443
+ // socket is opened and nothing your board displays crosses our server
4444
+ // (docs/SECURITY.md). The launcher owns the relay child in ANOTHER process,
4445
+ // so we persist the choice to a file it watches — same shape as
4446
+ // relay-takeover.req above.
4447
+ if (url.pathname === '/api/relay-pref' && req.method === 'GET') {
4448
+ const pref = readRelayPref(DATA_DIR);
4449
+ return json(res, 200, {
4450
+ pref,
4451
+ enabled: resolveRelayEnabled({ relayUrl: process.env.RELAY_URL, pref }),
4452
+ configured: Boolean(process.env.RELAY_URL),
4453
+ });
4454
+ }
4455
+ if (url.pathname === '/api/relay-pref' && req.method === 'POST') {
4456
+ let body = '';
4457
+ req.on('data', (d) => { body += d; });
4458
+ req.on('end', () => {
4459
+ let input;
4460
+ try { input = JSON.parse(body || '{}'); } catch { return json(res, 400, { error: 'bad json' }); }
4461
+ // A boolean and nothing else. "off"/0/undefined are how a security
4462
+ // setting silently becomes the opposite of what was clicked.
4463
+ if (typeof input?.enabled !== 'boolean') return json(res, 400, { error: 'enabled must be a boolean' });
4464
+ let saved;
4465
+ try { saved = writeRelayPref(DATA_DIR, input.enabled); }
4466
+ catch (e) { return json(res, 500, { error: String(e?.message ?? e) }); }
4467
+ return json(res, 200, {
4468
+ pref: saved,
4469
+ enabled: resolveRelayEnabled({ relayUrl: process.env.RELAY_URL, pref: saved }),
4470
+ configured: Boolean(process.env.RELAY_URL),
4471
+ });
4472
+ });
4473
+ return;
4474
+ }
4439
4475
  // POST /api/signout — forget the local license so the settings panel can
4440
4476
  // offer a plain "Log out" instead of requiring the `--signin` CLI flag to
4441
4477
  // switch Google accounts. Clears the on-disk token and the in-memory cache;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galda/cli",
3
- "version": "0.10.113",
3
+ "version": "0.10.114",
4
4
  "type": "module",
5
5
  "description": "Galda - hand off work to Claude Code or Codex, get proof back. Runs on your existing subscription, no extra API cost.",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "puppeteer-core": "^23.11.1",
12
12
  "ws": "^8.21.0"
13
13
  },
14
- "license": "UNLICENSED",
14
+ "license": "SEE LICENSE IN LICENSE.md",
15
15
  "bin": {
16
16
  "cli": "bin/manager-for-ai.mjs",
17
17
  "galda": "bin/manager-for-ai.mjs",
@@ -26,6 +26,8 @@
26
26
  "SKILL.md",
27
27
  ".mcp.json",
28
28
  "README.md",
29
+ "LICENSE.md",
30
+ "docs/SECURITY.md",
29
31
  "CLAUDE.md",
30
32
  "!engine/chat-runs",
31
33
  "!engine/test",
@@ -41,10 +43,6 @@
41
43
  "engines": {
42
44
  "node": ">=20"
43
45
  },
44
- "repository": {
45
- "type": "git",
46
- "url": "https://github.com/kodo-inc/agent-manager.git"
47
- },
48
46
  "keywords": [
49
47
  "claude",
50
48
  "claude-code",
@@ -53,5 +51,9 @@
53
51
  "manager",
54
52
  "verification",
55
53
  "proof"
56
- ]
54
+ ],
55
+ "homepage": "https://galda.app",
56
+ "bugs": {
57
+ "url": "https://galda.app/support"
58
+ }
57
59
  }