@tiens.nguyen/gu-cli 1.0.939 → 1.0.941
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 +17 -7
- package/agent-deps-preflight.mjs +1 -1
- package/autocompact.mjs +2 -2
- package/browser-bridge.mjs +2 -2
- package/browser-chrome.mjs +2 -2
- package/browser-command.mjs +4 -4
- package/browser-extension/README.md +6 -6
- package/clear-logs.mjs +3 -3
- package/clear-state.mjs +3 -3
- package/cli-token.mjs +8 -8
- package/client-expert-api.mjs +9 -9
- package/client-expert-run.mjs +7 -7
- package/client-expert-setup.mjs +4 -4
- package/command-allow.mjs +1 -1
- package/conversation-archive.mjs +2 -2
- package/credential-recovery.mjs +1 -1
- package/daemon-control.mjs +4 -4
- package/device-login.mjs +3 -3
- package/free-model.mjs +1 -1
- package/full-log-command.mjs +1 -1
- package/gonext_agent_chat.py +160 -89
- package/gu-cli.mjs +55 -29
- package/gu-home-move.mjs +193 -0
- package/gu-repl.mjs +342 -59
- package/gu_browser.py +3 -3
- package/gu_free_budget.py +2 -2
- package/gu_gif.py +1 -1
- package/gu_hooks.py +1 -1
- package/gu_turn_notes.py +2 -2
- package/gu_turn_trail.py +138 -0
- package/gudb-size.mjs +198 -0
- package/hooks-config.mjs +4 -4
- package/image-paste.mjs +8 -8
- package/install-path.mjs +1 -1
- package/log-level.mjs +1 -1
- package/log-policy.mjs +1 -1
- package/lsp-host.mjs +2 -2
- package/lsp-registry.mjs +9 -9
- package/mcp-command.mjs +1 -1
- package/mcp-config.mjs +5 -5
- package/memory-task.mjs +85 -0
- package/model-doctor.mjs +10 -10
- package/mongo-mac.mjs +2 -2
- package/mongo-windows.mjs +3 -3
- package/next-suggestion.mjs +13 -8
- package/package.json +5 -1
- package/platform-tools.mjs +3 -3
- package/poll-errors.mjs +2 -2
- package/prompt_scaffold_check.py +1 -1
- package/proxy-store.mjs +1 -1
- package/python-unix.mjs +6 -6
- package/python-windows.mjs +1 -1
- package/rag-selftest.mjs +2 -2
- package/resume-memory.mjs +1 -1
- package/scripts/image-paste-check.mjs +1 -1
- package/setup-fixes.mjs +4 -4
- package/shell-details.mjs +2 -2
- package/skill-install.mjs +9 -9
- package/skill-package.mjs +10 -10
- package/skill-source.mjs +4 -4
- package/skills-copy.mjs +15 -15
- package/skills.mjs +4 -4
- package/support-bundle.mjs +6 -6
- package/support-report.mjs +5 -5
- package/terminal-layout.mjs +25 -1
- package/turn-notes.mjs +2 -2
- package/version-check.mjs +1 -1
- package/workspace-revert.mjs +2 -2
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ gu [-v|--verbose] [--log] [--color] [--name <text>] [--license <pro token>]
|
|
|
111
111
|
| Flag | Effect |
|
|
112
112
|
| --- | --- |
|
|
113
113
|
| `-v`, `--verbose` | show RAG index activity in the bottom bar |
|
|
114
|
-
| `--log` | log this run in detail to `~/.
|
|
114
|
+
| `--log` | log this run in detail to `~/.gu/worker.log` (default: starts, stops and errors only) |
|
|
115
115
|
| `--color` | colour the live thought and the thinking spinner |
|
|
116
116
|
| `--name <text>` | show `<text>` instead of the gu logo in the banner (this run only) |
|
|
117
117
|
| `--license <token>` | use a Pro licence on first install |
|
|
@@ -150,7 +150,7 @@ Ctrl-C stops the running turn. Type `/` at the prompt to see every command; Tab
|
|
|
150
150
|
| `/budget` | your API provider budgets and balances (Pro) |
|
|
151
151
|
| `/mcp [list\|tools\|add\|remove\|enable\|disable\|approve\|allow\|disallow\|reconnect]` | MCP servers, and which of their tools run without asking |
|
|
152
152
|
| `/hooks [list\|approve\|unapprove]` | commands gu runs on `onStart`, `onAsk`, `onToolDone`, `onTurnEnd` |
|
|
153
|
-
| `/switch-skill [claude\|gu]` | use Claude Code's (`.claude`) or gu's (`.
|
|
153
|
+
| `/switch-skill [claude\|gu]` | use Claude Code's (`.claude`) or gu's (`.gu`) skills, MCP servers and hooks in this folder |
|
|
154
154
|
| `/skill-pack <name>`, `/skill-install <zip\|folder>` | pack a skill with its MCP servers and hooks into one zip, and install it on another machine (no secrets) |
|
|
155
155
|
| `/resume` | carry on the last unfinished task in this folder, Claude Code's or gu's |
|
|
156
156
|
| `/proxy [show\|set\|on\|off\|clear\|test]` | route model calls through an HTTP proxy (local calls go direct) |
|
|
@@ -162,7 +162,7 @@ Ctrl-C stops the running turn. Type `/` at the prompt to see every command; Tab
|
|
|
162
162
|
| `/support` | send the support team a request with gu's logs attached |
|
|
163
163
|
| `/help`, `/exit` | list commands / quit |
|
|
164
164
|
|
|
165
|
-
Each skill in `~/.
|
|
165
|
+
Each skill in `~/.gu/skills/<name>/SKILL.md` (or the folder's `.gu/skills`) is a slash command too.
|
|
166
166
|
|
|
167
167
|
</details>
|
|
168
168
|
|
|
@@ -185,12 +185,22 @@ gu fix-path | fix-powershell repair PATH / remove PowerShell's `gu` alias
|
|
|
185
185
|
|
|
186
186
|
## Where gu keeps things
|
|
187
187
|
|
|
188
|
+
Everything gu saves is in one folder in your home, `~/.gu` (on Windows `%USERPROFILE%\.gu`), plus a `.gu`
|
|
189
|
+
folder inside a project when that project has its own skills, MCP servers, hooks or notes. Nothing else.
|
|
190
|
+
|
|
188
191
|
| Path | Contents |
|
|
189
192
|
| --- | --- |
|
|
190
|
-
| `~/.
|
|
191
|
-
| `~/.
|
|
192
|
-
| `~/.
|
|
193
|
-
| `~/.
|
|
193
|
+
| `~/.gu/` | your sign-in token, settings, model keys, the built-in database, gu's Python, logs |
|
|
194
|
+
| `~/.gu/sessions/` | conversation history per folder (`archive/` holds old ones) |
|
|
195
|
+
| `~/.gu/worker.log` | log |
|
|
196
|
+
| `~/.gu/mcp.json` | MCP servers and their allow rules |
|
|
197
|
+
| `~/.gu/skills/`, `<folder>/.gu/skills/` | skills: everywhere / this folder only |
|
|
198
|
+
| `<folder>/.gu/` | this project's own gu settings: skills, MCP servers, hooks, notes |
|
|
199
|
+
|
|
200
|
+
**Used gu before?** Older versions kept the same things in a folder named `.gonext`. The first time the new gu
|
|
201
|
+
starts, it renames `~/.gonext` to `~/.gu`, once. Nothing is copied or lost, and you don't need to set up again.
|
|
202
|
+
`~/.gonext` stays as a link to `~/.gu`, so other tools that saved the old path still work. A project's `.gonext` folder
|
|
203
|
+
becomes `.gu` the first time you run gu in it. If you commit that folder, commit the rename too.
|
|
194
204
|
|
|
195
205
|
## Plans
|
|
196
206
|
|
package/agent-deps-preflight.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { dirname, join } from "node:path";
|
|
|
17
17
|
// Warnings are yellow text, no icon (GH #378: "⚠" draws as a broken emoji on Windows 11).
|
|
18
18
|
const yellow = (s) => (process.stdout.isTTY && !process.env.NO_COLOR ? `\x1b[33m${s}\x1b[0m` : String(s));
|
|
19
19
|
|
|
20
|
-
export const DECLINED_FILE = join(homedir(), ".
|
|
20
|
+
export const DECLINED_FILE = join(homedir(), ".gu", "agent-deps-declined");
|
|
21
21
|
|
|
22
22
|
/** Is this start one that should check? Interactive terminals only, and not when a test or script opts out. Pure. */
|
|
23
23
|
export function shouldPreflight({ env = process.env, stdinTTY = Boolean(process.stdin.isTTY), stdoutTTY = Boolean(process.stdout.isTTY), declined = existsSync(DECLINED_FILE) } = {}) {
|
package/autocompact.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* like Claude Code's "Autocompact now defaults to 400k tokens": apply 400k to every model, to the
|
|
8
8
|
* current one only, or keep the old rule. NO ANSWER MEANS 400K FOR ALL MODELS.
|
|
9
9
|
*
|
|
10
|
-
* The choice is ~/.
|
|
10
|
+
* The choice is ~/.gu/autocompact.json, read by the agent on this computer:
|
|
11
11
|
* { "all": 400000 | null, "models": { "<model id>": 400000 | null }, "answeredAt": "…" }
|
|
12
12
|
* A model's own entry wins over "all"; null means "keep" (the 2/3 rule alone). The agent only
|
|
13
13
|
* ever LOWERS its threshold to the cap: a model with a smaller window is unaffected.
|
|
@@ -23,7 +23,7 @@ export const AUTOCOMPACT_MIN = 16_000;
|
|
|
23
23
|
/** The startup question answers itself after this long (no answer = 400k, all models). */
|
|
24
24
|
export const AUTOCOMPACT_ASK_MS = 30_000;
|
|
25
25
|
|
|
26
|
-
export const autocompactPath = (home) => join(home, ".
|
|
26
|
+
export const autocompactPath = (home) => join(home, ".gu", "autocompact.json");
|
|
27
27
|
|
|
28
28
|
const modelKey = (model) => String(model ?? "").trim().toLowerCase();
|
|
29
29
|
const validCap = (v) => (v === null ? null : Number.isFinite(Number(v)) && Number(v) >= AUTOCOMPACT_MIN ? Math.round(Number(v)) : undefined);
|
package/browser-bridge.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// (a web page cannot reach it through DNS rebinding);
|
|
9
9
|
// • the WebSocket is accepted only from an Origin of chrome-extension:// — a web page cannot
|
|
10
10
|
// forge that header;
|
|
11
|
-
// • a command needs the token in ~/.
|
|
11
|
+
// • a command needs the token in ~/.gu/browser-bridge.json, which only this user can read.
|
|
12
12
|
//
|
|
13
13
|
// No dependency: the WebSocket is the few lines of RFC 6455 a single local client needs.
|
|
14
14
|
import { createServer } from "node:http";
|
|
@@ -23,7 +23,7 @@ export const DEFAULT_PORT = 4127;
|
|
|
23
23
|
const WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
24
24
|
|
|
25
25
|
export function statePath() {
|
|
26
|
-
return process.env.GU_BROWSER_STATE || join(homedir(), ".
|
|
26
|
+
return process.env.GU_BROWSER_STATE || join(homedir(), ".gu", "browser-bridge.json");
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// ── WebSocket frames ────────────────────────────────────────────────────────────────────────
|
package/browser-chrome.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Chrome lets no program turn on Developer mode or load an unpacked extension, so without the
|
|
4
4
|
// gu extension the bridge starts a Chrome of its own: a normal, visible window on a separate
|
|
5
|
-
// profile (~/.
|
|
5
|
+
// profile (~/.gu/browser-profile), started with its DevTools port open, and drives it over the
|
|
6
6
|
// DevTools protocol — the same protocol the extension uses through chrome.debugger, through the
|
|
7
7
|
// same actions.js. Nothing in the user's own Chrome is touched; the agent asks the user before it
|
|
8
8
|
// is first used (gu_browser.py).
|
|
@@ -16,7 +16,7 @@ import { join } from "node:path";
|
|
|
16
16
|
import { WebSocket } from "undici";
|
|
17
17
|
import { enableDomains, forgetTab, onCdpEvent, runAction } from "./browser-extension/actions.js";
|
|
18
18
|
|
|
19
|
-
export const profileDir = () => process.env.GU_BROWSER_PROFILE || join(homedir(), ".
|
|
19
|
+
export const profileDir = () => process.env.GU_BROWSER_PROFILE || join(homedir(), ".gu", "browser-profile");
|
|
20
20
|
|
|
21
21
|
/** The Chrome to start: GU_BROWSER_CHROME, else Chrome / Chromium / Edge / Brave where they install. */
|
|
22
22
|
export function findChrome(platform = process.platform, env = process.env, exists = existsSync) {
|
package/browser-command.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// /browser (task #363, GitHub #144): is the gu Chrome extension connected, and how to install it.
|
|
2
2
|
//
|
|
3
|
-
// The extension is loaded from a FIXED folder, ~/.
|
|
3
|
+
// The extension is loaded from a FIXED folder, ~/.gu/browser-extension, not from the npm
|
|
4
4
|
// package: an update moves the package and Chrome would lose an unpacked extension loaded there.
|
|
5
5
|
// The files are copied there (again after an update) every time this runs, as the agent does.
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
@@ -14,7 +14,7 @@ const HERE = dirname(fileURLToPath(import.meta.url));
|
|
|
14
14
|
export const EXT_SRC = join(HERE, "browser-extension");
|
|
15
15
|
export const EXT_FILES = ["manifest.json", "background.js", "actions.js", "popup.html", "popup.js", "icons/icon16.png", "icons/icon48.png", "icons/icon128.png"];
|
|
16
16
|
|
|
17
|
-
const dataDir = () => join(homedir(), ".
|
|
17
|
+
const dataDir = () => join(homedir(), ".gu");
|
|
18
18
|
export const extensionDir = () => process.env.GU_BROWSER_EXT_DIR || join(dataDir(), "browser-extension");
|
|
19
19
|
const statePath = () => process.env.GU_BROWSER_STATE || join(dataDir(), "browser-bridge.json");
|
|
20
20
|
|
|
@@ -157,7 +157,7 @@ export function browserReport({ connected, version, installType, refused = [], r
|
|
|
157
157
|
`gu's browser bridge did not start: ${error}`,
|
|
158
158
|
"This is a problem in gu, not in Chrome — no browser needs installing.",
|
|
159
159
|
"Update gu: npm install -g @tiens.nguyen/gu-cli@latest — then restart gu.",
|
|
160
|
-
"The bridge's log: ~/.
|
|
160
|
+
"The bridge's log: ~/.gu/browser-bridge.log",
|
|
161
161
|
], 2);
|
|
162
162
|
}
|
|
163
163
|
// Two copies installed (the store one next to a developer one): the bridge kept one (#148).
|
|
@@ -334,7 +334,7 @@ export function findDevInstalls({ roots = browserRoots(), extDir = extensionDir(
|
|
|
334
334
|
return found;
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
// gu's own leftovers of the developer install, in ~/.
|
|
337
|
+
// gu's own leftovers of the developer install, in ~/.gu.
|
|
338
338
|
export function localLeftovers() {
|
|
339
339
|
return [extensionDir(), statePath(), seenPath(), logPath()].filter((p) => existsSync(p));
|
|
340
340
|
}
|
|
@@ -5,11 +5,11 @@ The agent's `browser(...)` tool opens a web page, sees it, and clicks and types
|
|
|
5
5
|
**Nothing has to be installed.** The first time a turn uses the browser, gu asks you. After you allow it, the agent works in one of two places:
|
|
6
6
|
|
|
7
7
|
- **Your own Chrome**, through this extension, if the extension is installed. The agent works in its own tabs (the "gu" tab group) and in any tab you share, and it has your logins.
|
|
8
|
-
- **gu's own Chrome window**, if the extension is not installed. The bridge starts a Chrome of its own: a visible window on a separate profile (`~/.
|
|
8
|
+
- **gu's own Chrome window**, if the extension is not installed. The bridge starts a Chrome of its own: a visible window on a separate profile (`~/.gu/browser-profile`), started with its DevTools port open. It is not signed in to your accounts; sign in there once if a test needs it, and the profile keeps it.
|
|
9
9
|
|
|
10
10
|
```
|
|
11
11
|
agent turn (python, a new process each turn) — asks you first (#150)
|
|
12
|
-
│ HTTP + token ~/.
|
|
12
|
+
│ HTTP + token ~/.gu/browser-bridge.json (0600)
|
|
13
13
|
▼
|
|
14
14
|
browser-bridge.mjs 127.0.0.1:4127, started on demand, outlives the turn
|
|
15
15
|
│ the extension when it is connected, else gu's own window
|
|
@@ -31,7 +31,7 @@ browser-bridge.mjs 127.0.0.1:4127, started on demand, outlives the turn
|
|
|
31
31
|
No
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
"Always" adds the folder to `~/.
|
|
34
|
+
"Always" adds the folder to `~/.gu/browser-allow.json`. A "No" holds for the rest of the turn, and the model carries on without the browser.
|
|
35
35
|
- **`/browser`** shows where the agent works and whether it asks in this folder.
|
|
36
36
|
- **`/browser allow` / `/browser forget`** stop or restart the question for this folder.
|
|
37
37
|
- **Share a tab** (extension only): click the gu icon on a tab, then **Let gu use this tab**. The tab joins the "gu" group and the agent can use it. **Stop sharing this tab** takes it back.
|
|
@@ -46,11 +46,11 @@ browser-bridge.mjs 127.0.0.1:4127, started on demand, outlives the turn
|
|
|
46
46
|
Chrome lets no program turn on Developer mode or load an unpacked extension, which is why the default is gu's own window.
|
|
47
47
|
|
|
48
48
|
- **Once the extension is on the Chrome Web Store:** `/browser install` opens its page; click **Add to Chrome**. No toggle is involved. Set `GU_BROWSER_STORE_URL`, then put the link in `STORE_URL` once it is published.
|
|
49
|
-
- **Until then, the developer way** (`/browser install` shows it and copies the folder): turn on **Developer mode** in `chrome://extensions`, click **Load unpacked**, and choose `~/.
|
|
49
|
+
- **Until then, the developer way** (`/browser install` shows it and copies the folder): turn on **Developer mode** in `chrome://extensions`, click **Load unpacked**, and choose `~/.gu/browser-extension` (on a Mac, ⌘⇧G and paste). `/browser` should then say connected.
|
|
50
50
|
|
|
51
51
|
Some notes:
|
|
52
52
|
|
|
53
|
-
- **Why a fixed folder:** the extension is loaded from `~/.
|
|
53
|
+
- **Why a fixed folder:** the extension is loaded from `~/.gu/browser-extension`, not from the npm package, because an update moves the package and Chrome would lose an extension loaded from there. After a gu update, click reload on the extension's card.
|
|
54
54
|
- **Chrome closed or asleep:** the extension reconnects within 30 seconds of Chrome starting, or immediately with its icon's **Connect now** button. It shows a purple `on` badge while connected. Meanwhile the agent uses gu's own window.
|
|
55
55
|
- **The "debugging this browser" bar:** Chrome shows "gu browser started debugging this browser" while the agent works. That is the `chrome.debugger` permission, which is what makes a click a real, trusted click.
|
|
56
56
|
- **Other Chromium browsers** (Edge, Brave, Arc, Chromium) load it the same way. gu's own window uses the first of Chrome, Chromium, Edge or Brave it finds; set `GU_BROWSER_CHROME` to choose.
|
|
@@ -66,7 +66,7 @@ Run this before installing the Chrome Web Store copy (#145):
|
|
|
66
66
|
1. **It lists what it found:**
|
|
67
67
|
- every Chrome, Chrome Beta/Canary, Chromium, Edge and Brave profile with "gu browser" loaded unpacked. It reads each profile's `Preferences` and `Secure Preferences` and never writes them;
|
|
68
68
|
- the connected copy;
|
|
69
|
-
- gu's files in `~/.
|
|
69
|
+
- gu's files in `~/.gu`: `browser-extension/`, `browser-bridge.json`, `browser-extension-seen`, `browser-bridge.log`.
|
|
70
70
|
2. **On "Clean up", the connected developer copy removes itself** with `chrome.management.uninstallSelf`, which needs no extra permission. A store copy is never removed this way.
|
|
71
71
|
3. **Copies in other profiles need your click.** Chrome signs its profile settings, so no other program can uninstall an extension. gu opens `chrome://extensions` (on a Mac) and waits while you click Remove on "gu browser" in each one.
|
|
72
72
|
4. **Then it stops the bridge, deletes gu's files, scans again,** and says either `✓ The developer install is gone` or what is still there.
|
package/clear-logs.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* "clear logs" (#329) — what is taking the disk under ~/.
|
|
2
|
+
* "clear logs" (#329) — what is taking the disk under ~/.gu, and a way to give it back.
|
|
3
3
|
*
|
|
4
4
|
* Asked for after this Mac's disk filled three times in one day and took the local MongoDB down
|
|
5
5
|
* with it (#328). A click on the notice row's "clear logs" (or /clear-logs) DELETES NOTHING at
|
|
@@ -37,7 +37,7 @@ export const LOG_DIRS = ["run-logs", "logs"];
|
|
|
37
37
|
/** The link appears once the logs pass this — below it the row stays quiet. */
|
|
38
38
|
export const LOGS_NOTICE_BYTES = 50 * 1024 * 1024;
|
|
39
39
|
|
|
40
|
-
const guHome = (home = homedir()) => join(home, ".
|
|
40
|
+
const guHome = (home = homedir()) => join(home, ".gu");
|
|
41
41
|
|
|
42
42
|
/** "740 KB", "15 MB", "4.9 GB" — two significant figures, the way `du -h` reads. */
|
|
43
43
|
export function humanSize(bytes) {
|
|
@@ -139,7 +139,7 @@ export async function surveyLogs({ home = homedir() } = {}) {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
|
-
* Every local index: ~/.
|
|
142
|
+
* Every local index: ~/.gu/rag/<folder hash>/<source hash>/. The hashes say nothing to a
|
|
143
143
|
* person, so the name comes from the manifest the agent wrote (`sourceUrl`). `missing` = that
|
|
144
144
|
* source was a folder on this machine and is gone — the index can never be used again.
|
|
145
145
|
*/
|
package/clear-state.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `gu clear` — put this machine back to how it was before gu ran.
|
|
3
3
|
*
|
|
4
|
-
* Written for testing the first-run flow, which is otherwise a one-shot: once ~/.
|
|
4
|
+
* Written for testing the first-run flow, which is otherwise a one-shot: once ~/.gu/
|
|
5
5
|
* worker.env exists the machine is paired, the mode question stops being asked, and Client
|
|
6
6
|
* Expert refuses outright — so there is no way to see the beginning again short of deleting
|
|
7
7
|
* files by hand and guessing which ones.
|
|
@@ -15,10 +15,10 @@ import { readdir, rm, stat } from "node:fs/promises";
|
|
|
15
15
|
import { homedir } from "node:os";
|
|
16
16
|
import { join } from "node:path";
|
|
17
17
|
|
|
18
|
-
export const GONEXT_DIR = join(homedir(), ".
|
|
18
|
+
export const GONEXT_DIR = join(homedir(), ".gu");
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* What lives in ~/.
|
|
21
|
+
* What lives in ~/.gu, and whether a reset should remove it.
|
|
22
22
|
*
|
|
23
23
|
* Grouped by what LOSING it costs, because that is the only thing that helps someone decide.
|
|
24
24
|
* Anything not listed is left alone: a reset that deletes files it does not recognise is not
|
package/cli-token.mjs
CHANGED
|
@@ -55,21 +55,21 @@ export function guHeaders(mode, version = GU_VERSION) {
|
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* An OPT-IN label for OUR OWN machines (e.g. the Windows 11 test VM). Set GU_INTERNAL_LABEL=gu-win11, or put the
|
|
58
|
-
* label in ~/.
|
|
58
|
+
* label in ~/.gu/internal-label. Real users have neither, so nothing changes for them. When set, every request
|
|
59
59
|
* gu makes to a gucli.com host carries `User-Agent: gu/<version> (internal:<label>)` and `x-gu-internal: <label>`,
|
|
60
60
|
* so Cloudflare analytics (filter on User-Agent) and the API can tell our traffic from real users'.
|
|
61
61
|
*/
|
|
62
62
|
export function internalLabel(env = process.env, home = process.env.HOME || process.env.USERPROFILE || "") {
|
|
63
63
|
let v = String(env.GU_INTERNAL_LABEL ?? "").trim();
|
|
64
64
|
if (!v && home) {
|
|
65
|
-
try { v = readFileSync(join(home, ".
|
|
65
|
+
try { v = readFileSync(join(home, ".gu", "internal-label"), "utf8").trim(); } catch { /* none */ }
|
|
66
66
|
}
|
|
67
67
|
return v.replace(/[^A-Za-z0-9._-]/g, "").slice(0, 40);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/** `gu internal [label|off]`: writes (or removes) ~/.
|
|
70
|
+
/** `gu internal [label|off]`: writes (or removes) ~/.gu/internal-label. No label → this computer's host name. */
|
|
71
71
|
export function setInternalLabel(arg, { home = process.env.HOME || process.env.USERPROFILE || "", host = osHostname() } = {}) {
|
|
72
|
-
const file = join(home, ".
|
|
72
|
+
const file = join(home, ".gu", "internal-label");
|
|
73
73
|
if (String(arg ?? "").toLowerCase() === "off") {
|
|
74
74
|
try { unlinkSync(file); } catch { /* already off */ }
|
|
75
75
|
return { label: "", file };
|
|
@@ -180,7 +180,7 @@ const run = (cmd, args) =>
|
|
|
180
180
|
/**
|
|
181
181
|
* The operating system's own id for this machine, or "".
|
|
182
182
|
*
|
|
183
|
-
* NOT ~/.
|
|
183
|
+
* NOT ~/.gu/instance: copying the folder to another computer carries that file along, and
|
|
184
184
|
* `gu clear` makes a new one, which would count one laptop several times. The OS id survives both.
|
|
185
185
|
*/
|
|
186
186
|
export async function osMachineId({ platform = process.platform, read = (p) => readFile(p, "utf8"), exec = run } = {}) {
|
|
@@ -205,7 +205,7 @@ export async function osMachineId({ platform = process.platform, read = (p) => r
|
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
207
|
* This computer for a FREE TRIAL (#305) — or null. Only the OS machine id counts here: the fallback
|
|
208
|
-
* thisDevice() uses when it is missing (~/.
|
|
208
|
+
* thisDevice() uses when it is missing (~/.gu/instance) changes with `gu clear`, which would make
|
|
209
209
|
* the trial once-per-install instead of once-per-computer. No stable id, no trial.
|
|
210
210
|
*/
|
|
211
211
|
export async function trialDevice(opts = {}) {
|
|
@@ -546,7 +546,7 @@ export async function thisDevice({
|
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
// ---------------------------------------------------------------------------
|
|
549
|
-
// STATE: ~/.
|
|
549
|
+
// STATE: ~/.gu/cli-token.json
|
|
550
550
|
// ---------------------------------------------------------------------------
|
|
551
551
|
|
|
552
552
|
export const STATE_FILE = "cli-token.json";
|
|
@@ -663,7 +663,7 @@ export async function renewToken({ mode, apiBase, hostedBase, token, workerKey,
|
|
|
663
663
|
|
|
664
664
|
/**
|
|
665
665
|
* GH #529: "gu ran on this computer today" — POST /api/billing/cli-token/seen with the token, once a
|
|
666
|
-
* UTC day (the day is kept in ~/.
|
|
666
|
+
* UTC day (the day is kept in ~/.gu/cli-token-seen). It is what lets the admin page count users
|
|
667
667
|
* rather than installs. → { ok, why? }. Never throws; a failure is retried at the next hourly tick.
|
|
668
668
|
*/
|
|
669
669
|
export const SEEN_FILE = "cli-token-seen";
|
package/client-expert-api.mjs
CHANGED
|
@@ -34,7 +34,7 @@ import { nodeAtLeast } from "./node-version.mjs";
|
|
|
34
34
|
/** Where the local API listens by default. 4100 keeps clear of the hosted API and of Vite's 5173. */
|
|
35
35
|
export const DEFAULT_LOCAL_API_PORT = 4100;
|
|
36
36
|
/** The port setup had to move to, when 4100 belonged to another program (task #337). */
|
|
37
|
-
export const API_PORT_FILE = join(homedir(), ".
|
|
37
|
+
export const API_PORT_FILE = join(homedir(), ".gu", "local-api.port");
|
|
38
38
|
|
|
39
39
|
const validPort = (v) => {
|
|
40
40
|
const n = Number.parseInt(String(v ?? "").trim(), 10);
|
|
@@ -45,7 +45,7 @@ const validPort = (v) => {
|
|
|
45
45
|
* WHICH PORT THE LOCAL API USES, and why (task #337).
|
|
46
46
|
*
|
|
47
47
|
* env — GONEXT_LOCAL_API_PORT: someone chose it; gu never moves away from it on its own.
|
|
48
|
-
* saved — ~/.
|
|
48
|
+
* saved — ~/.gu/local-api.port: 4100 was taken by ANOTHER PROGRAM when the API was first
|
|
49
49
|
* started, and gu moved. Every later process — `gu`, `gu-cli api …`, the worker's
|
|
50
50
|
* terminal — reads the same file, so they all follow the move.
|
|
51
51
|
* default — 4100. A machine where 4100 was free has no file and behaves exactly as before.
|
|
@@ -84,7 +84,7 @@ export async function useApiPort(port, { save = true } = {}) {
|
|
|
84
84
|
LOCAL_API_PORT = n;
|
|
85
85
|
LOCAL_API_BASE = `http://127.0.0.1:${n}`;
|
|
86
86
|
if (save) {
|
|
87
|
-
await mkdir(join(homedir(), ".
|
|
87
|
+
await mkdir(join(homedir(), ".gu"), { recursive: true });
|
|
88
88
|
await writeFile(API_PORT_FILE, `${n}\n`, "utf8");
|
|
89
89
|
}
|
|
90
90
|
return n;
|
|
@@ -107,7 +107,7 @@ export const LOCAL_DB_NAME = process.env.GONEXT_LOCAL_DB_NAME || "gu";
|
|
|
107
107
|
export function localMongoUri({ env = process.env, home = homedir() } = {}) {
|
|
108
108
|
if (env.GONEXT_LOCAL_MONGO_URI) return env.GONEXT_LOCAL_MONGO_URI;
|
|
109
109
|
try {
|
|
110
|
-
const st = JSON.parse(readFileSync(join(home, ".
|
|
110
|
+
const st = JSON.parse(readFileSync(join(home, ".gu", "client-expert.json"), "utf8"));
|
|
111
111
|
if (typeof st?.localMongoUri === "string" && st.localMongoUri) return st.localMongoUri;
|
|
112
112
|
} catch {
|
|
113
113
|
/* no setup yet, or unreadable — the default is the only thing there is to try */
|
|
@@ -115,7 +115,7 @@ export function localMongoUri({ env = process.env, home = homedir() } = {}) {
|
|
|
115
115
|
return LOCAL_MONGO_URI;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
const GONEXT_DIR = join(homedir(), ".
|
|
118
|
+
const GONEXT_DIR = join(homedir(), ".gu");
|
|
119
119
|
export const API_PID_FILE = join(GONEXT_DIR, "local-api.pid");
|
|
120
120
|
|
|
121
121
|
/**
|
|
@@ -185,7 +185,7 @@ export function generateLocalUserId() {
|
|
|
185
185
|
*/
|
|
186
186
|
// ---------------------------------------------------------------------------------------------
|
|
187
187
|
// gudb (GH #534): Local mode's database without a MongoDB server — one SQLite file the local API
|
|
188
|
-
// opens itself (api/src/gudb). Chosen once per computer and remembered in ~/.
|
|
188
|
+
// opens itself (api/src/gudb). Chosen once per computer and remembered in ~/.gu/local-db, so every
|
|
189
189
|
// later `gu api start|restart|upgrade`, doctor and the terminal's own restart start the API with the
|
|
190
190
|
// same storage. A computer already set up with MongoDB keeps it.
|
|
191
191
|
// ---------------------------------------------------------------------------------------------
|
|
@@ -193,8 +193,8 @@ export function generateLocalUserId() {
|
|
|
193
193
|
export const GUDB_MIN_NODE = "22.5.0";
|
|
194
194
|
/** The first published local API package that contains gudb (api/src/gudb → <apiDir>/gudb/db.js). */
|
|
195
195
|
export const GUDB_MIN_API = "1.0.337";
|
|
196
|
-
export const LOCAL_DB_FILE = join(homedir(), ".
|
|
197
|
-
export const gudbFile = (home = homedir()) => join(home, ".
|
|
196
|
+
export const LOCAL_DB_FILE = join(homedir(), ".gu", "local-db");
|
|
197
|
+
export const gudbFile = (home = homedir()) => join(home, ".gu", "gudb", "gu.db");
|
|
198
198
|
|
|
199
199
|
/** The storage this computer's local API uses: "gudb", "mongo", or "" when not chosen yet. */
|
|
200
200
|
export function readLocalDb({ path = LOCAL_DB_FILE } = {}) {
|
|
@@ -282,7 +282,7 @@ export function apiEnv({
|
|
|
282
282
|
// answer in memory only — so private mode needs internet for a turn, and says so when it has
|
|
283
283
|
// none. No local copy exists to fall back to, by design.
|
|
284
284
|
PROMPT_SCAFFOLD_UPSTREAM: hostedBase,
|
|
285
|
-
GU_CLI_TOKEN_FILE: join(home, ".
|
|
285
|
+
GU_CLI_TOKEN_FILE: join(home, ".gu", "cli-token.json"),
|
|
286
286
|
};
|
|
287
287
|
// gudb: a MONGODB_URI inherited from the shell must not send the API to a MongoDB after all.
|
|
288
288
|
if (localDb === "gudb") {
|
package/client-expert-run.mjs
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
} from "./client-expert-setup.mjs";
|
|
81
81
|
|
|
82
82
|
const run = promisify(execFile);
|
|
83
|
-
const STATE_FILE = join(homedir(), ".
|
|
83
|
+
const STATE_FILE = join(homedir(), ".gu", "client-expert.json");
|
|
84
84
|
|
|
85
85
|
/** Not an error: the machine is already configured, so the question was skipped. */
|
|
86
86
|
class SkipModelQuestion extends Error {}
|
|
@@ -375,7 +375,7 @@ export async function ensureNativeMongoMac(ask, mongo, { log = (l) => console.lo
|
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
/**
|
|
378
|
-
* macOS 13 and older (GH #403): gu's own mongod 8.0.5 in ~/.
|
|
378
|
+
* macOS 13 and older (GH #403): gu's own mongod 8.0.5 in ~/.gu/mongodb, run on 127.0.0.1 —
|
|
379
379
|
* no Homebrew, no service, no sudo. Shown, asked, then done, like the other platforms.
|
|
380
380
|
* Not started at login: gu's start-up check (preflightLocalMongo) starts it again when needed.
|
|
381
381
|
*/
|
|
@@ -499,7 +499,7 @@ export function runInTerminal(cmd, { platform = process.platform, spawnFn = spaw
|
|
|
499
499
|
|
|
500
500
|
/**
|
|
501
501
|
* Windows 11 without the installer (#210): download ONLY mongod.exe (~50 MB of a ~940 MB zip) into
|
|
502
|
-
* ~/.
|
|
502
|
+
* ~/.gu/mongodb and run it from there on 127.0.0.1 — no MSI, no Windows service, no
|
|
503
503
|
* administrator prompt. Shown, asked, then done, like the other platforms. If the download fails
|
|
504
504
|
* the winget commands are printed as the way out.
|
|
505
505
|
*/
|
|
@@ -953,7 +953,7 @@ export const API_PACKAGE_URL =
|
|
|
953
953
|
|
|
954
954
|
/** Where a downloaded API is unpacked: one directory per version, never overwritten. */
|
|
955
955
|
export const apiInstallDir = (version) =>
|
|
956
|
-
join(homedir(), ".
|
|
956
|
+
join(homedir(), ".gu", "api", String(version));
|
|
957
957
|
|
|
958
958
|
/**
|
|
959
959
|
* What the publisher says is current.
|
|
@@ -1063,7 +1063,7 @@ export async function downloadApiPackage(manifest, { onProgress = () => {} } = {
|
|
|
1063
1063
|
// ends in "gzip: stdin: unexpected end of file". A path with no drive letter works for GNU and bsdtar.
|
|
1064
1064
|
await run("tar", ["xzf", "package.tar.gz", "-C", "."], { cwd: staging });
|
|
1065
1065
|
await rm(tmpTar, { force: true });
|
|
1066
|
-
await mkdir(join(homedir(), ".
|
|
1066
|
+
await mkdir(join(homedir(), ".gu", "api"), { recursive: true });
|
|
1067
1067
|
await moveIntoPlace(staging, dir);
|
|
1068
1068
|
onProgress(`installed ${manifest.version} → ${dir}`);
|
|
1069
1069
|
return { dir, version: manifest.version };
|
|
@@ -1079,7 +1079,7 @@ export async function loadState() {
|
|
|
1079
1079
|
|
|
1080
1080
|
export async function saveState(state) {
|
|
1081
1081
|
try {
|
|
1082
|
-
await mkdir(join(homedir(), ".
|
|
1082
|
+
await mkdir(join(homedir(), ".gu"), { recursive: true });
|
|
1083
1083
|
await writeFile(STATE_FILE, JSON.stringify(state, null, 2) + "\n");
|
|
1084
1084
|
} catch {
|
|
1085
1085
|
/* the walkthrough still works without notes; it just re-verifies more */
|
|
@@ -1847,7 +1847,7 @@ export async function prepareLocalStack({ log = (l) => console.log(l), env = pro
|
|
|
1847
1847
|
const skip = (why) => ({ done, skipped: why, ok: true });
|
|
1848
1848
|
try {
|
|
1849
1849
|
const { existsSync } = await import("node:fs");
|
|
1850
|
-
if (existsSync(join(homedir(), ".
|
|
1850
|
+
if (existsSync(join(homedir(), ".gu", "worker.env"))) return skip("this computer is already set up");
|
|
1851
1851
|
if (String(env.GU_LICENSE ?? "").trim()) return skip("a license was given — the mode is chosen at the first gu");
|
|
1852
1852
|
const machine = await probeMachine();
|
|
1853
1853
|
const gate = clientExpertAvailable({ workerEnvExists: false, ...machine });
|
package/client-expert-setup.mjs
CHANGED
|
@@ -159,9 +159,9 @@ export function clientExpertAvailable({
|
|
|
159
159
|
available: false,
|
|
160
160
|
reason: "paired",
|
|
161
161
|
message:
|
|
162
|
-
"This machine is already signed in to the hosted API (~/.
|
|
162
|
+
"This machine is already signed in to the hosted API (~/.gu/worker.env). " +
|
|
163
163
|
"Local mode sets up its own database and identity, so it only runs on a machine " +
|
|
164
|
-
"that has never been paired. To switch, remove ~/.
|
|
164
|
+
"that has never been paired. To switch, remove ~/.gu/worker.env first — you will " +
|
|
165
165
|
"lose the link to your hosted history.",
|
|
166
166
|
};
|
|
167
167
|
}
|
|
@@ -371,7 +371,7 @@ export function abandonPlan(recorded = {}) {
|
|
|
371
371
|
if (done("worker-env")) {
|
|
372
372
|
actions.push({
|
|
373
373
|
id: "worker-env",
|
|
374
|
-
what: "Remove ~/.
|
|
374
|
+
what: "Remove ~/.gu/worker.env",
|
|
375
375
|
why: "it points this terminal at a local API that will no longer be running",
|
|
376
376
|
});
|
|
377
377
|
}
|
|
@@ -584,7 +584,7 @@ export const STEP_FIX = {
|
|
|
584
584
|
},
|
|
585
585
|
"worker-env": {
|
|
586
586
|
mode: "confirm",
|
|
587
|
-
action: "rewrite ~/.
|
|
587
|
+
action: "rewrite ~/.gu/worker.env to point at the local API",
|
|
588
588
|
why: "this file is how the terminal finds its API; rewriting it silently is how a machine ends up pointing somewhere the user did not choose",
|
|
589
589
|
},
|
|
590
590
|
models: { mode: "manual", action: null, why: "model choices are the user's" },
|
package/command-allow.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { createHash } from "node:crypto";
|
|
|
7
7
|
import { dirname, join, sep } from "node:path";
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
|
|
10
|
-
export const commandAllowPath = () => process.env.GU_COMMAND_ALLOW || join(homedir(), ".
|
|
10
|
+
export const commandAllowPath = () => process.env.GU_COMMAND_ALLOW || join(homedir(), ".gu", "command-allow.json");
|
|
11
11
|
const real = (p) => {
|
|
12
12
|
try {
|
|
13
13
|
return realpathSync(p);
|
package/conversation-archive.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* EVERY MESSAGE OF A FOLDER'S CONVERSATION, KEPT (task #278).
|
|
3
3
|
*
|
|
4
|
-
* ~/.
|
|
4
|
+
* ~/.gu/sessions/archive/<folder hash>.jsonl — append-only, one JSON object per line
|
|
5
5
|
*
|
|
6
6
|
* The session file keeps only the last 40 messages (what the model is sent), and /reset used to
|
|
7
7
|
* delete even those — with the folder's settings — and delete the database copy too: no archive,
|
|
@@ -20,7 +20,7 @@ import { appendFile, mkdir, readFile, stat } from "node:fs/promises";
|
|
|
20
20
|
import { homedir } from "node:os";
|
|
21
21
|
import { join } from "node:path";
|
|
22
22
|
|
|
23
|
-
export const archiveDir = (home = homedir()) => join(home, ".
|
|
23
|
+
export const archiveDir = (home = homedir()) => join(home, ".gu", "sessions", "archive");
|
|
24
24
|
|
|
25
25
|
/** The same folder hash the session file uses (gu-repl.mjs sessionFilePath). */
|
|
26
26
|
export function archivePathFor(cwd, home = homedir()) {
|
package/credential-recovery.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WHEN THE CREDENTIALS ON THIS MACHINE NO LONGER WORK (task #240).
|
|
3
3
|
*
|
|
4
4
|
* THE DEAD END THIS EXISTS TO CLOSE, reproduced in a clean Ubuntu container: a machine whose
|
|
5
|
-
* ~/.
|
|
5
|
+
* ~/.gu/worker.env holds a key the API rejects (rotated, revoked, pasted from another
|
|
6
6
|
* account, or written by the wizard for a different server) could not reach the first-run flow
|
|
7
7
|
* at all. `gu` printed one red line and exited — every time, forever. The questions a first run
|
|
8
8
|
* asks were unreachable, and the only route back was `gu clear`, which is a RESET: it deletes
|
package/daemon-control.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import { isLocalApiBase } from "./terminal-layout.mjs";
|
|
|
21
21
|
// Only this user's processes (GH #396): another account's gu daemon is not "ours is running".
|
|
22
22
|
const PROC_LIST = processListCommand(process.platform, { ownUser: true });
|
|
23
23
|
|
|
24
|
-
const DIR = join(homedir(), ".
|
|
24
|
+
const DIR = join(homedir(), ".gu");
|
|
25
25
|
export const PID_FILE = join(DIR, "worker.pid");
|
|
26
26
|
/**
|
|
27
27
|
* What the worker is RUNNING RIGHT NOW, published for other processes (task #209 req 1).
|
|
@@ -120,7 +120,7 @@ export function clientAgentProblem({ accountUrl = "", clientMode = false } = {})
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
* A stable id for THIS MACHINE, generated locally and stored in ~/.
|
|
123
|
+
* A stable id for THIS MACHINE, generated locally and stored in ~/.gu/instance.
|
|
124
124
|
*
|
|
125
125
|
* Deliberately NOT derived from the worker key: client mode exists so a second machine can
|
|
126
126
|
* reuse the same key without logging in, which makes the key — and therefore workerHostId —
|
|
@@ -324,7 +324,7 @@ export async function readBusyState() {
|
|
|
324
324
|
|
|
325
325
|
/**
|
|
326
326
|
* WHOSE DAEMON IS IT (task #257)? The `ps` scan sees every gu worker on the machine, but a worker
|
|
327
|
-
* belongs to ONE ~/.
|
|
327
|
+
* belongs to ONE ~/.gu: it polls that home's API with that home's key. Counting another
|
|
328
328
|
* home's worker as ours meant gu never started its own, and every turn sat "queued — waiting for
|
|
329
329
|
* the worker". Ours = OUR pidfile names it, or its HOME is ours. HOME unknown (Windows, or not
|
|
330
330
|
* readable) → counted, exactly as before: a second poller on a guess is the worse mistake.
|
|
@@ -415,7 +415,7 @@ async function acquireStartLock() {
|
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
/**
|
|
418
|
-
* Start the polling daemon DETACHED (survives the launching shell, logs to ~/.
|
|
418
|
+
* Start the polling daemon DETACHED (survives the launching shell, logs to ~/.gu/
|
|
419
419
|
* worker.log). No-op when one is already running (BC4). Concurrency-safe (L2): a lock
|
|
420
420
|
* serializes the check→spawn window so two simultaneous starts can't both spawn.
|
|
421
421
|
* Returns { started, pid?, pids }.
|
package/device-login.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { join } from "node:path";
|
|
|
9
9
|
import dotenv from "dotenv";
|
|
10
10
|
|
|
11
11
|
export const DEFAULT_API_BASE = "https://chat-api-v2.gucli.com";
|
|
12
|
-
const ENV_FILE = join(homedir(), ".
|
|
12
|
+
const ENV_FILE = join(homedir(), ".gu", "worker.env");
|
|
13
13
|
const POLL_INTERVAL_MS = 2500;
|
|
14
14
|
const POLL_TIMEOUT_MS = 10 * 60_000; // matches the server's pairing TTL
|
|
15
15
|
|
|
@@ -27,7 +27,7 @@ export async function hasWorkerConfig() {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Write ~/.
|
|
30
|
+
* Write ~/.gu/worker.env, PRESERVING every other setting already in it.
|
|
31
31
|
*
|
|
32
32
|
* This used to rewrite the file from scratch, keeping only GONEXT_POLL_MS — so re-running
|
|
33
33
|
* login (or saving a key) silently DELETED anything else the user had put there, e.g.
|
|
@@ -55,7 +55,7 @@ async function writeWorkerEnv(apiBase, workerKey) {
|
|
|
55
55
|
.filter((k) => !head.includes(k))
|
|
56
56
|
.map((k) => `${k}=${merged[k]}`),
|
|
57
57
|
].join("\n");
|
|
58
|
-
await mkdir(join(homedir(), ".
|
|
58
|
+
await mkdir(join(homedir(), ".gu"), { recursive: true });
|
|
59
59
|
await writeFile(ENV_FILE, `${body}\n`, { encoding: "utf8", mode: 0o600 });
|
|
60
60
|
return ENV_FILE;
|
|
61
61
|
}
|
package/free-model.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* the month's allowance is spent. The key is not in gu: the owner can replace it on the admin page,
|
|
8
8
|
* and gu picks the new one up the next time it fetches (each start, and after /voucher).
|
|
9
9
|
*
|
|
10
|
-
* ~/.
|
|
10
|
+
* ~/.gu/free-model.json (0600) — { url, model, keyId, price, period, allowanceMicro, spentMicro }
|
|
11
11
|
*
|
|
12
12
|
* Money is in MICRO-DOLLARS (1 USD = 1,000,000) so the sums are whole numbers, as on the server
|
|
13
13
|
* (api/src/billing/llmAllowance.ts — the same formula and the same levels).
|
package/full-log-command.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { dirname, join } from "node:path";
|
|
|
19
19
|
|
|
20
20
|
export const USAGE = "gu full-log on|off|status [email or account id]";
|
|
21
21
|
/** The daemon's minute tick sees this and re-reads the policy at once (see gu-cli.mjs startLogPolicy). */
|
|
22
|
-
export const REFRESH_FLAG = join(homedir(), ".
|
|
22
|
+
export const REFRESH_FLAG = join(homedir(), ".gu", "log-policy.refresh");
|
|
23
23
|
export const TOKEN_PROMPT = "Admin token (Admin → Full Log → Create CLI token), hidden:";
|
|
24
24
|
|
|
25
25
|
/** → { action: "on"|"off"|"status", account? } | { error } */
|