llmtab-desktop 2.0.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 +48 -0
- package/bin.mjs +70 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# llmtab-desktop
|
|
2
|
+
|
|
3
|
+
Menu-bar / tray app for [LLMTab](https://github.com/naninanides/llmtab-v2).
|
|
4
|
+
|
|
5
|
+
This package is a thin launcher. All the application code lives in the
|
|
6
|
+
[`llmtab`](https://www.npmjs.com/package/llmtab) package; `llmtab-desktop`
|
|
7
|
+
only adds the Electron runtime, which is ~200 MB and therefore not something
|
|
8
|
+
to force on people who just want the CLI.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm i -g llmtab-desktop # tray app (pulls llmtab + electron)
|
|
14
|
+
llmtab-desktop
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
To get the `llmtab` CLI command on your PATH as well, install both — npm only
|
|
18
|
+
links the bins of the package you name:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm i -g llmtab llmtab-desktop
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Platform support
|
|
25
|
+
|
|
26
|
+
| OS | status |
|
|
27
|
+
| ------- | -------------------------------------------------------------- |
|
|
28
|
+
| macOS | supported — template-image tray icon, popover under the icon |
|
|
29
|
+
| Linux | runs, untested; tray appearance depends on your desktop's tray |
|
|
30
|
+
| Windows | runs, untested; tray appearance not tuned |
|
|
31
|
+
|
|
32
|
+
The shell uses macOS tray idioms (`setTemplateImage`, popover positioning
|
|
33
|
+
relative to the menu-bar item). It should start on Linux and Windows but is
|
|
34
|
+
not yet tuned for them. Bug reports with screenshots are welcome.
|
|
35
|
+
|
|
36
|
+
If you only need the dashboard, `npm i -g llmtab` and run `llmtab` — it serves
|
|
37
|
+
the same UI in your browser with no Electron dependency.
|
|
38
|
+
|
|
39
|
+
## Uninstall
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
npm rm -g llmtab-desktop
|
|
43
|
+
llmtab uninstall # optional: also remove ~/.llmtab data
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT
|
package/bin.mjs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* llmtab-desktop — launches the LLMTab menu-bar shell.
|
|
4
|
+
*
|
|
5
|
+
* The shell itself lives in the `llmtab` package (`dist/shell/main.js`); this
|
|
6
|
+
* package exists only to add the Electron runtime, which is far too large to
|
|
7
|
+
* force on people who just want the CLI. We locate the installed `llmtab` via
|
|
8
|
+
* normal Node resolution, so npm/pnpm/yarn layouts all work without guessing
|
|
9
|
+
* at node_modules paths.
|
|
10
|
+
*/
|
|
11
|
+
import { createRequire } from "node:module";
|
|
12
|
+
import { spawn } from "node:child_process";
|
|
13
|
+
import { existsSync } from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
|
|
16
|
+
const require = createRequire(import.meta.url);
|
|
17
|
+
|
|
18
|
+
function die(message, hint) {
|
|
19
|
+
console.error(`llmtab-desktop: ${message}`);
|
|
20
|
+
if (hint) console.error(` ${hint}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function resolveShellEntry() {
|
|
25
|
+
let pkgJsonPath;
|
|
26
|
+
try {
|
|
27
|
+
pkgJsonPath = require.resolve("llmtab/package.json");
|
|
28
|
+
} catch {
|
|
29
|
+
die("cannot find the `llmtab` package.", "Reinstall with: npm i -g llmtab-desktop");
|
|
30
|
+
}
|
|
31
|
+
const entry = path.join(path.dirname(pkgJsonPath), "dist", "shell", "main.js");
|
|
32
|
+
if (!existsSync(entry)) {
|
|
33
|
+
die(
|
|
34
|
+
`the installed llmtab has no shell build at ${entry}.`,
|
|
35
|
+
"This usually means llmtab was installed from source without running its build.",
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return entry;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function resolveElectron() {
|
|
42
|
+
let electronPath;
|
|
43
|
+
try {
|
|
44
|
+
electronPath = require("electron");
|
|
45
|
+
} catch {
|
|
46
|
+
die("cannot find the `electron` runtime.", "Reinstall with: npm i -g llmtab-desktop");
|
|
47
|
+
}
|
|
48
|
+
// electron's main export is the path to its binary; inside an Electron
|
|
49
|
+
// runtime it is the API object instead, which means we were run wrong.
|
|
50
|
+
if (typeof electronPath !== "string") {
|
|
51
|
+
die("`electron` did not resolve to a binary path.");
|
|
52
|
+
}
|
|
53
|
+
if (!existsSync(electronPath)) {
|
|
54
|
+
die(
|
|
55
|
+
`the electron binary is missing at ${electronPath}.`,
|
|
56
|
+
"Its postinstall download may have been skipped or blocked by a proxy.",
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return electronPath;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const child = spawn(resolveElectron(), [resolveShellEntry(), ...process.argv.slice(2)], {
|
|
63
|
+
stdio: "inherit",
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
child.on("error", (err) => die(`failed to launch Electron: ${err.message}`));
|
|
67
|
+
child.on("exit", (code, signal) => {
|
|
68
|
+
if (signal) process.kill(process.pid, signal);
|
|
69
|
+
else process.exit(code ?? 0);
|
|
70
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "llmtab-desktop",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Menu-bar / tray app for LLMTab — adds the Electron shell to the llmtab CLI.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "naninanides",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"llm",
|
|
10
|
+
"tokens",
|
|
11
|
+
"usage",
|
|
12
|
+
"cost",
|
|
13
|
+
"tracker",
|
|
14
|
+
"menubar",
|
|
15
|
+
"tray",
|
|
16
|
+
"electron",
|
|
17
|
+
"llmtab"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/naninanides/llmtab-v2.git",
|
|
22
|
+
"directory": "packages/desktop"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/naninanides/llmtab-v2#readme",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/naninanides/llmtab-v2/issues"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20"
|
|
30
|
+
},
|
|
31
|
+
"bin": {
|
|
32
|
+
"llmtab-desktop": "./bin.mjs"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"bin.mjs",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"electron": "^44.0.0",
|
|
40
|
+
"llmtab": "^2.0.0"
|
|
41
|
+
}
|
|
42
|
+
}
|