@7ots/cli 0.1.8 → 0.1.10
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/cli/7ots.mjs +15 -3
- package/cli/lib/hooks.mjs +3 -1
- package/cli/lib/pet-server.mjs +1 -1
- package/cli/pet/pet.html +1 -1
- package/package.json +1 -1
package/cli/7ots.mjs
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { spawn, spawnSync } from 'node:child_process';
|
|
8
|
-
import { existsSync, mkdirSync, openSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { existsSync, mkdirSync, openSync, statSync, writeFileSync } from 'node:fs';
|
|
9
9
|
import { createRequire } from 'node:module';
|
|
10
|
-
import { join } from 'node:path';
|
|
10
|
+
import { dirname, join } from 'node:path';
|
|
11
11
|
import { createIdentity, describe, identityPrompt, loadIdentity, cleanSeed } from './lib/identity.mjs';
|
|
12
12
|
import { loadConfig } from './lib/config.mjs';
|
|
13
13
|
import { t, cliLang } from './lib/i18n.mjs';
|
|
@@ -190,12 +190,24 @@ function menuLang() {
|
|
|
190
190
|
return pick(process.env.SEVENOTS_LANG) || pick(lang) || pick(String(process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || '').slice(0, 2).toLowerCase()) || cliLang();
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
// Electron installed per user (~/.7ots/electron) has a chrome-sandbox that is not root:4755, and Ubuntu 24.04+
|
|
194
|
+
// blocks unprivileged user namespaces (AppArmor), so Chromium aborts with SIGTRAP before showing a window.
|
|
195
|
+
// Without a usable setuid helper, run unsandboxed: the window only loads the pet's own 127.0.0.1 page.
|
|
196
|
+
function electronSandboxArgs(bin) {
|
|
197
|
+
if (process.platform !== 'linux') return [];
|
|
198
|
+
try {
|
|
199
|
+
const st = statSync(join(dirname(bin), 'chrome-sandbox'));
|
|
200
|
+
if (st.uid === 0 && st.mode & 0o4000) return [];
|
|
201
|
+
} catch {}
|
|
202
|
+
return ['--no-sandbox'];
|
|
203
|
+
}
|
|
204
|
+
|
|
193
205
|
function openDesktop({ opaque = false, view3d = false } = {}) {
|
|
194
206
|
console.log(dim(t('pet.electron')));
|
|
195
207
|
const { bin, error } = ensureElectron();
|
|
196
208
|
if (!bin) return Promise.resolve({ ok: false, error });
|
|
197
209
|
const log = openSync(homeFile('electron.log'), 'a');
|
|
198
|
-
const child = spawn(bin, [join(PKG_ROOT, 'cli', 'pet', 'electron', 'main.cjs')], {
|
|
210
|
+
const child = spawn(bin, [join(PKG_ROOT, 'cli', 'pet', 'electron', 'main.cjs'), ...electronSandboxArgs(bin)], {
|
|
199
211
|
stdio: ['ignore', log, log],
|
|
200
212
|
detached: true,
|
|
201
213
|
env: { ...process.env, SEVENOTS_PET_URL: `http://127.0.0.1:${PET_PORT}`, SEVENOTS_PET_TOKEN: petToken(), SEVENOTS_PET_OPAQUE: opaque ? '1' : '', SEVENOTS_PET_3D: view3d ? '1' : '', SEVENOTS_PET_LANG: menuLang() },
|
package/cli/lib/hooks.mjs
CHANGED
|
@@ -23,8 +23,10 @@ const RC_LINE = '[ -f "$HOME/.7ots/shell.sh" ] && . "$HOME/.7ots/shell.sh" # 7ot
|
|
|
23
23
|
|
|
24
24
|
/** How hooks should call us: the global `7ots`, this checkout, or npx. */
|
|
25
25
|
export function selfCommand() {
|
|
26
|
+
// under npx, PATH holds npx's own cache bin dir: that `7ots` is gone once npx exits
|
|
26
27
|
const which = spawnSync('which', ['7ots'], { encoding: 'utf8' });
|
|
27
|
-
|
|
28
|
+
const bin = which.status === 0 ? which.stdout.trim() : '';
|
|
29
|
+
if (bin && !/[\\/]_npx[\\/]/.test(bin)) return '7ots';
|
|
28
30
|
if (!/[\\/]_npx[\\/]/.test(PKG_ROOT)) return `node ${JSON.stringify(join(PKG_ROOT, 'cli', '7ots.mjs'))}`;
|
|
29
31
|
return 'npx -y @7ots/cli';
|
|
30
32
|
}
|
package/cli/lib/pet-server.mjs
CHANGED
|
@@ -86,7 +86,7 @@ export function petToken() {
|
|
|
86
86
|
/** Is a daemon already running? */
|
|
87
87
|
export async function petAlive(port = PET_PORT) {
|
|
88
88
|
try {
|
|
89
|
-
const r = await fetch(`http://127.0.0.1:${port}/health`, { signal: AbortSignal.timeout(
|
|
89
|
+
const r = await fetch(`http://127.0.0.1:${port}/health`, { signal: AbortSignal.timeout(2500) });
|
|
90
90
|
return r.ok ? await r.json() : null;
|
|
91
91
|
} catch {
|
|
92
92
|
return null;
|
package/cli/pet/pet.html
CHANGED
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
body.desktop .actions { position: absolute; right: auto; left: calc(50% + 70px * var(--pet-scale, 1) - 4px); /* beside the ot at any size: over it, it hid the corners that stretch it */ bottom: 14px; transform: translateX(6px); display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 99px;
|
|
150
150
|
background: color-mix(in srgb, var(--panel) 86%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px);
|
|
151
151
|
opacity: 0; transition: none; /* a transition here never finished painting in the transparent window: the menu stayed invisible */ -webkit-app-region: no-drag; z-index: 5; } /* above the 3D stage canvas (z 3) */
|
|
152
|
-
body.desktop
|
|
152
|
+
body.desktop.hover .actions, body.desktop.menu .actions { opacity: 1; transform: none; } /* .hover: set by the shell, which sees the cursor even when no mouse event reaches the page (no CSS :hover: it sticks in a click-through window that never gets the mouseleave) */
|
|
153
153
|
body.desktop .act { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 0; background: transparent; }
|
|
154
154
|
body.desktop .act span { display: none; }
|
|
155
155
|
.grip { display: none; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7ots/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "7ots.com — your AI companion with a face of its own: a desktop pet that watches over your coding agent (Claude Code and shell hooks), a personal assistant (reminders, alerts, notes, opens sites, sees your screen if allowed) and a reproducible identity (face, personality, voice) for any agent — in apuchat meet calls, Orquesta projects or your own server.",
|
|
5
5
|
"homepage": "https://7ots.com",
|
|
6
6
|
"repository": {
|