@7ots/cli 0.1.41 → 0.1.42
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 +6 -2
- package/cli/pet/electron/main.cjs +4 -4
- package/package.json +1 -1
package/cli/7ots.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { spawn, spawnSync } from 'node:child_process';
|
|
8
|
-
import { existsSync, mkdirSync, openSync, statSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { existsSync, mkdirSync, openSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
9
9
|
import { createRequire } from 'node:module';
|
|
10
10
|
import { dirname, join } from 'node:path';
|
|
11
11
|
import { createIdentity, describe, identityPrompt, loadIdentity, cleanSeed } from './lib/identity.mjs';
|
|
@@ -19,7 +19,9 @@ import { detectProject, findHtml, installHtml, platformLink, pretty, snippet } f
|
|
|
19
19
|
import { llmsTxt, promptText } from './lib/prompts.mjs';
|
|
20
20
|
import { openUrl, graphical } from './lib/open.mjs';
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
// Same version as desktop/package.json (the installers). A different one in ~/.7ots/electron is replaced.
|
|
23
|
+
const ELECTRON_VERSION = '44.11.3';
|
|
24
|
+
const ELECTRON = `electron@${ELECTRON_VERSION}`;
|
|
23
25
|
const tty = process.stdout.isTTY;
|
|
24
26
|
const bold = (s) => (tty ? `\x1b[1m${s}\x1b[0m` : s);
|
|
25
27
|
const dim = (s) => (tty ? `\x1b[2m${s}\x1b[0m` : s);
|
|
@@ -147,6 +149,8 @@ function petUrl(desktop = false, view3d = false) {
|
|
|
147
149
|
/** Path to the Electron binary, or null. `electron`'s index.js throws if its postinstall download never finished. */
|
|
148
150
|
function electronBin(dir) {
|
|
149
151
|
try {
|
|
152
|
+
const pkg = JSON.parse(readFileSync(join(dir, 'node_modules', 'electron', 'package.json'), 'utf8')); // not require: cached
|
|
153
|
+
if (pkg.version !== ELECTRON_VERSION) return null; // an older one: npm install replaces it
|
|
150
154
|
const bin = createRequire(join(dir, 'package.json'))('electron');
|
|
151
155
|
return typeof bin === 'string' && existsSync(bin) ? bin : null;
|
|
152
156
|
} catch {
|
|
@@ -187,7 +187,7 @@ async function syncSenses() {
|
|
|
187
187
|
}
|
|
188
188
|
sensesWin = new BrowserWindow({ show: false, width: 640, height: 480, skipTaskbar: true, webPreferences: { contextIsolation: true, sandbox: true, backgroundThrottling: false } });
|
|
189
189
|
sensesWin.webContents.on('will-navigate', (e) => e.preventDefault());
|
|
190
|
-
sensesWin.webContents.on('console-message', (e
|
|
190
|
+
sensesWin.webContents.on('console-message', (e) => ['warning', 'error'].includes(e.level) && console.log(`[7ots senses] ${e.message}`)); // Electron ≥ 35: the event carries them
|
|
191
191
|
sensesWin.on('closed', () => (sensesWin = null));
|
|
192
192
|
sensesWin.loadURL(`${URL_}/senses?token=${encodeURIComponent(TOKEN)}`).catch(() => {});
|
|
193
193
|
}
|
|
@@ -282,7 +282,7 @@ function makeOt(opt = {}) {
|
|
|
282
282
|
// location.reload() through will-navigate too, so blocking everything froze the old look until a restart).
|
|
283
283
|
win.webContents.on('will-navigate', (e, url) => String(url || e?.url || '').startsWith(`${base}/pet?`) || e.preventDefault());
|
|
284
284
|
win.webContents.on('did-finish-load', () => ((offTold = ''), alive() && tellOff(win.getBounds()))); // a reload forgets it
|
|
285
|
-
win.webContents.on('console-message', (e
|
|
285
|
+
win.webContents.on('console-message', (e) => /\[7ots/.test(e.message) && console.log(e.message)); // to ~/.7ots/electron.log
|
|
286
286
|
// The microphone, only for our own page (voice control).
|
|
287
287
|
const ours = (u) => /^http:\/\/127\.0\.0\.1:\d+\//.test(String(u || '')); // our daemons
|
|
288
288
|
session.defaultSession.setPermissionRequestHandler((wc, perm, cb, d) => cb(perm === 'media' && ours(d?.requestingUrl || wc.getURL())));
|
|
@@ -762,8 +762,8 @@ function makeOt(opt = {}) {
|
|
|
762
762
|
if (alive()) win.loadURL(petURL());
|
|
763
763
|
}
|
|
764
764
|
// An effect just started: the page says how much room it needs right away (see tellNeed in pet.html).
|
|
765
|
-
win.webContents.on('console-message', (e
|
|
766
|
-
const m = String(e
|
|
765
|
+
win.webContents.on('console-message', (e) => {
|
|
766
|
+
const m = String(e.message ?? '');
|
|
767
767
|
if (m.startsWith('\u00a77drag')) {
|
|
768
768
|
const d = JSON.parse(m.slice(6));
|
|
769
769
|
return grab(d.on, d.resize);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7ots/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
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": {
|