@7ots/cli 0.1.17 → 0.1.36
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/.env.example +14 -0
- package/README.md +11 -0
- package/brand/logos/base.svg +1 -0
- package/brand/logos/clawpump.png +0 -0
- package/brand/logos/conductors.svg +1 -0
- package/brand/logos/notlogin.svg +12 -0
- package/brand/logos/pumpfun.png +0 -0
- package/brand/logos/solana.png +0 -0
- package/brand/logos/spawnerbot.svg +1 -0
- package/brand/logos/virtuals.png +0 -0
- package/cli/7ots.mjs +61 -1
- package/cli/lib/account.mjs +23 -3
- package/cli/lib/assistant.mjs +92 -14
- package/cli/lib/brain.mjs +84 -11
- package/cli/lib/card-shot.mjs +1 -1
- package/cli/lib/config.mjs +14 -3
- package/cli/lib/desktop-sync.mjs +177 -0
- package/cli/lib/i18n.mjs +9 -0
- package/cli/lib/inferences.mjs +19 -2
- package/cli/lib/integrations.mjs +98 -13
- package/cli/lib/mcp.mjs +1 -1
- package/cli/lib/open.mjs +3 -1
- package/cli/lib/pet-server.mjs +352 -41
- package/cli/lib/prompts.mjs +1 -1
- package/cli/lib/screen.mjs +1 -1
- package/cli/lib/senses/gestures.mjs +121 -0
- package/cli/lib/senses/index.mjs +490 -0
- package/cli/lib/senses/rules.mjs +159 -0
- package/cli/lib/senses/sources/activity.mjs +95 -0
- package/cli/lib/senses/sources/calendar.mjs +75 -0
- package/cli/lib/senses/sources/index.mjs +17 -0
- package/cli/lib/senses/sources/mail.mjs +48 -0
- package/cli/lib/senses/sources/system.mjs +39 -0
- package/cli/lib/senses/util.mjs +41 -0
- package/cli/lib/senses/vendor.mjs +78 -0
- package/cli/lib/stt-local.py +16 -8
- package/cli/lib/stt.mjs +53 -6
- package/cli/lib/tooluse.mjs +56 -0
- package/cli/lib/tts-local.mjs +2 -2
- package/cli/lib/vm.mjs +2 -2
- package/cli/lib/wake-local.py +109 -0
- package/cli/lib/wake.mjs +102 -0
- package/cli/pet/electron/main.cjs +190 -8
- package/cli/pet/pet.html +153 -34
- package/cli/pet/senses.html +342 -0
- package/cli/pet/settings.html +815 -74
- package/dist/7ots.esm.js +373 -146
- package/dist/7ots.esm.js.map +4 -4
- package/dist/7ots.iife.js +373 -146
- package/dist/7ots.iife.js.map +4 -4
- package/llms.txt +27 -0
- package/package.json +5 -2
- package/server/channels/apuchat.mjs +18 -4
- package/server/errors.mjs +90 -0
- package/server/notify.mjs +78 -0
- package/server/server.mjs +84 -14
- package/server/settings.mjs +3 -0
- package/server/site.mjs +401 -0
- package/server/tts.mjs +29 -5
- package/src/avatar/AvatarStage.js +2 -2
- package/src/avatar/three.js +3 -2
- package/src/character/AvatarEditor.js +2 -1
- package/src/character/Character.js +38 -5
- package/src/character/TradingCard.js +2 -0
- package/src/character/beat.js +64 -2
- package/src/character/mods/orc.js +8 -1
- package/src/character/mods.js +104 -10
- package/src/character/motion.js +252 -1
- package/src/character/parts.js +40 -38
- package/src/character/styles.js +40 -38
- package/src/character3d/Character3D.js +26 -5
- package/src/character3d/body.js +14 -12
- package/src/character3d/export.js +693 -0
- package/src/character3d/fx.js +13 -0
- package/src/character3d/index.js +2 -0
- package/src/character3d/materials.js +106 -10
- package/src/character3d/room-themes.js +1184 -0
- package/src/character3d/room.js +487 -0
- package/src/character3d/stage.js +14 -2
- package/src/creator/StepCreator.js +316 -0
- package/src/i18n/index.js +3 -3
- package/src/i18n/messages/character.js +352 -4
- package/src/i18n/messages/creator.js +138 -0
- package/src/i18n/messages/identity.js +89 -1
- package/src/i18n/messages/platform.js +270 -4
- package/src/i18n/messages/server.js +443 -1
- package/src/i18n/messages/widget.js +233 -0
- package/src/identity/random.js +14 -2
- package/src/identity/schema.js +2 -1
- package/src/index.js +9 -2
- package/src/voice/tags.js +22 -0
- package/server/platform/apuchat.mjs +0 -266
- package/server/platform/auth.mjs +0 -319
- package/server/platform/connect.mjs +0 -387
- package/server/platform/crypto.mjs +0 -80
- package/server/platform/db.mjs +0 -275
- package/server/platform/device.mjs +0 -222
- package/server/platform/integrations.mjs +0 -169
- package/server/platform/look.mjs +0 -20
- package/server/platform/mods.mjs +0 -222
- package/server/platform/orquesta.mjs +0 -577
- package/server/platform/profile.mjs +0 -161
- package/server/platform/routes.mjs +0 -542
- package/server/platform/runtime.mjs +0 -242
- package/server/platform/sites.mjs +0 -146
- package/server/platform/store.mjs +0 -456
- package/server/platform/vm.mjs +0 -1057
package/cli/lib/integrations.mjs
CHANGED
|
@@ -30,6 +30,7 @@ import { homedir } from 'node:os';
|
|
|
30
30
|
import { env, loadConfig, loadKeys } from './config.mjs';
|
|
31
31
|
import { SEVENOTS_URL, me as accountMe, signedIn } from './account.mjs';
|
|
32
32
|
import { mcpCall, mcpTools, mcpToolsCached } from './mcp.mjs';
|
|
33
|
+
import { recordUse } from './tooluse.mjs';
|
|
33
34
|
|
|
34
35
|
const LETTA_URL = (process.env.LETTA_BASE_URL || 'https://api.letta.com').replace(/\/+$/, '');
|
|
35
36
|
const APUMAIL_API = (process.env.APUMAIL_API || 'https://api.apumail.com').replace(/\/+$/, '');
|
|
@@ -143,7 +144,7 @@ function exec(bin, args, { timeoutMs = 10000, max = 64000 } = {}) {
|
|
|
143
144
|
let out = '';
|
|
144
145
|
let child;
|
|
145
146
|
try {
|
|
146
|
-
child = spawn(bin, args, { stdio: ['ignore', 'pipe', 'pipe'], env: { ...process.env, NO_COLOR: '1', PAGER: 'cat' } });
|
|
147
|
+
child = spawn(bin, args, { stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true, env: { ...process.env, NO_COLOR: '1', PAGER: 'cat' } });
|
|
147
148
|
} catch (e) {
|
|
148
149
|
return resolve({ ok: false, out: e.message });
|
|
149
150
|
}
|
|
@@ -219,17 +220,30 @@ export async function readLogs({ source, target }) {
|
|
|
219
220
|
|
|
220
221
|
// ── email (apumail) ──
|
|
221
222
|
|
|
222
|
-
|
|
223
|
+
const isAcctToken = (t) => typeof t === 'string' && t.startsWith('acct_');
|
|
224
|
+
|
|
225
|
+
/** An inbox token reads that inbox; an account token (`acct_…`) reads that inbox, or all of the account's when none is set. */
|
|
226
|
+
export async function mailMessages(inbox, { n = 8 } = {}) {
|
|
223
227
|
const token = env().APUMAIL_TOKEN;
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
const all = !inbox && isAcctToken(token);
|
|
229
|
+
if (!token || (!inbox && !all)) throw new Error('email is not connected');
|
|
230
|
+
const url = all ? `${APUMAIL_API}/api/v1/account/all-mail?limit=${n}` : `${APUMAIL_API}/api/v1/inbox/${encodeURIComponent(inbox)}/wait?timeout=1`;
|
|
231
|
+
const res = await fetch(url, { headers: { Authorization: `Bearer ${token}` }, signal: AbortSignal.timeout(15000) });
|
|
226
232
|
if (!res.ok) throw new Error(`apumail ${res.status}`);
|
|
227
233
|
const { messages = [] } = await res.json();
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
.
|
|
231
|
-
|
|
232
|
-
.
|
|
234
|
+
// all-mail comes newest first; an inbox's wait, oldest first.
|
|
235
|
+
return (all ? messages.slice(0, n) : messages.slice(-n).reverse()).map((m) => ({
|
|
236
|
+
id: String(m.id ?? m.message_id ?? `${m.received_at}|${m.from}|${m.subject}`),
|
|
237
|
+
at: Number(m.received_at) || Date.parse(m.received_at) || 0,
|
|
238
|
+
to: all ? str(m._addr, 120) : '',
|
|
239
|
+
from: str(m.from, 120),
|
|
240
|
+
subject: str(m.subject, 160),
|
|
241
|
+
text: str(m.text, 300).replace(/\s+/g, ' '),
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export async function readMail(inbox, { n = 8 } = {}) {
|
|
246
|
+
return (await mailMessages(inbox, { n })).map((m) => `- ${new Date(m.at).toLocaleString()} · ${m.to ? `${m.to} ← ` : ''}${m.from} · ${m.subject || '(no subject)'}\n ${m.text}`).join('\n');
|
|
233
247
|
}
|
|
234
248
|
|
|
235
249
|
/** The ot's apuchat / email conversations on 7ots.com (device token), as text for the brain. */
|
|
@@ -290,6 +304,16 @@ export async function cloudStatus(config = loadConfig()) {
|
|
|
290
304
|
}
|
|
291
305
|
const id = config.account?.otsId;
|
|
292
306
|
if (!id || !out.signedIn) return out;
|
|
307
|
+
// what 7ots pays for this ot (its AI when it has no key of its own) and how much is left
|
|
308
|
+
try {
|
|
309
|
+
const res = await fetch(`${SEVENOTS_URL}/api/device/ots/${encodeURIComponent(id)}/quota`, { headers: { Authorization: `Bearer ${env().SEVENOTS_TOKEN}` }, signal: AbortSignal.timeout(10000) });
|
|
310
|
+
if (res.ok) {
|
|
311
|
+
const q = await res.json().catch(() => null);
|
|
312
|
+
const n = (v) => Math.max(0, Math.round(Number(v) || 0));
|
|
313
|
+
const pair = (x) => ({ used: n(x?.used), free: n(x?.free) });
|
|
314
|
+
if (q) out.quota = { platformLlm: !!q.platformLlm, unlimited: !!q.unlimited, messages: pair(q.messages), tts: pair(q.tts), games: pair(q.games) };
|
|
315
|
+
}
|
|
316
|
+
} catch {}
|
|
293
317
|
try {
|
|
294
318
|
const res = await fetch(`${SEVENOTS_URL}/api/device/ots/${encodeURIComponent(id)}/vm`, { headers: { Authorization: `Bearer ${env().SEVENOTS_TOKEN}` }, signal: AbortSignal.timeout(10000) });
|
|
295
319
|
if (res.ok) {
|
|
@@ -303,6 +327,52 @@ export async function cloudStatus(config = loadConfig()) {
|
|
|
303
327
|
return out;
|
|
304
328
|
}
|
|
305
329
|
|
|
330
|
+
/** The twin ot's Notlogin subwallet on 7ots.com (device token): addresses, balances, payments. Read only. */
|
|
331
|
+
export async function cloudWallet(config = loadConfig()) {
|
|
332
|
+
const id = config.account?.otsId;
|
|
333
|
+
if (!signedIn() || !id) return { available: false };
|
|
334
|
+
const res = await fetch(`${SEVENOTS_URL}/api/device/ots/${encodeURIComponent(id)}/wallet`, { headers: { Authorization: `Bearer ${env().SEVENOTS_TOKEN}` }, signal: AbortSignal.timeout(20000) });
|
|
335
|
+
if (res.status === 404) return { available: false };
|
|
336
|
+
if (!res.ok) throw Object.assign(new Error(`7ots.com ${res.status}`), { status: res.status });
|
|
337
|
+
return { available: true, ...(await res.json()) };
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** The twin ot's byte arena account on 7ots.com (device token): games, play { game }, status, stop. */
|
|
341
|
+
export async function cloudByte(config = loadConfig(), sub = '', { method = 'GET', body } = {}) {
|
|
342
|
+
const id = config.account?.otsId;
|
|
343
|
+
if (!signedIn() || !id) return { available: false };
|
|
344
|
+
const res = await fetch(`${SEVENOTS_URL}/api/device/ots/${encodeURIComponent(id)}/byte${sub}`, {
|
|
345
|
+
method,
|
|
346
|
+
headers: { Authorization: `Bearer ${env().SEVENOTS_TOKEN}`, ...(body ? { 'Content-Type': 'application/json' } : {}) },
|
|
347
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
348
|
+
signal: AbortSignal.timeout(90000),
|
|
349
|
+
});
|
|
350
|
+
if (res.status === 404) return { available: false };
|
|
351
|
+
const data = await res.json().catch(() => ({}));
|
|
352
|
+
if (!res.ok) throw Object.assign(new Error(data.error || `7ots.com ${res.status}`), { status: res.status });
|
|
353
|
+
return { available: true, ...data };
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* The plaza (the ots' social network on 7ots.com): how the twin ot takes part — on, autopilot, what it may post,
|
|
358
|
+
* comments, language, tool sharing. GET /api/device/plaza/settings?ot= · POST { ot, …changes } (server/platform/plaza.mjs).
|
|
359
|
+
*/
|
|
360
|
+
export async function cloudPlaza(config = loadConfig(), { method = 'GET', body } = {}) {
|
|
361
|
+
const id = config.account?.otsId;
|
|
362
|
+
if (!signedIn() || !id) return { available: false };
|
|
363
|
+
const q = method === 'GET' ? `?ot=${encodeURIComponent(id)}` : '';
|
|
364
|
+
const res = await fetch(`${SEVENOTS_URL}/api/device/plaza/settings${q}`, {
|
|
365
|
+
method,
|
|
366
|
+
headers: { Authorization: `Bearer ${env().SEVENOTS_TOKEN}`, ...(body ? { 'Content-Type': 'application/json' } : {}) },
|
|
367
|
+
body: body ? JSON.stringify({ ...body, ot: id }) : undefined,
|
|
368
|
+
signal: AbortSignal.timeout(20000),
|
|
369
|
+
});
|
|
370
|
+
if (res.status === 404 || res.status === 401) return { available: false };
|
|
371
|
+
const data = await res.json().catch(() => ({}));
|
|
372
|
+
if (!res.ok) throw Object.assign(new Error(data.error || `7ots.com ${res.status}`), { status: res.status });
|
|
373
|
+
return { available: true, url: SEVENOTS_URL, ...data };
|
|
374
|
+
}
|
|
375
|
+
|
|
306
376
|
// ── Letta (persona memory) ──
|
|
307
377
|
// Contract (docs.letta.com): Bearer LETTA_API_KEY
|
|
308
378
|
// POST /v1/agents { name, memory_blocks: [{ label, value }], model, embedding } → { id }
|
|
@@ -373,7 +443,7 @@ export function createExtras({ config, brain, system, onLater, confirm = null, c
|
|
|
373
443
|
const o = config().integrations?.orquesta || {};
|
|
374
444
|
return o.projectId ? { id: o.projectId, name: o.projectName } : cloudOrq.project ? { id: cloudOrq.project, name: cloudOrq.projectName } : null;
|
|
375
445
|
};
|
|
376
|
-
const mailOn = () => config().access?.inbox === true && config().integrations?.apumail?.on && config().integrations.apumail.inbox
|
|
446
|
+
const mailOn = () => config().access?.inbox === true && config().integrations?.apumail?.on && Boolean(env().APUMAIL_TOKEN) && Boolean(config().integrations.apumail.inbox || isAcctToken(env().APUMAIL_TOKEN));
|
|
377
447
|
const cloudId = () => (env().SEVENOTS_TOKEN && config().account?.otsId) || null;
|
|
378
448
|
const customs = () => (config().integrations?.custom || []).filter((c) => c.on !== false && customKind(c) !== 'note' && (c.url || c.command));
|
|
379
449
|
const toolsLine = (x) => {
|
|
@@ -425,7 +495,7 @@ export function createExtras({ config, brain, system, onLater, confirm = null, c
|
|
|
425
495
|
const lines = [];
|
|
426
496
|
checkCloud();
|
|
427
497
|
if (c.access?.logs === true) lines.push(`{"type":"read_logs","source":"journal|pm2|docker|file|process","target":"unit / pm2 app / container / path to a .log file / part of a running command"} (read the last lines of a program's logs, then you explain them)`);
|
|
428
|
-
if (mailOn()) lines.push(`{"type":"read_mail"} (read the latest emails in their inbox ${c.integrations.apumail.inbox}, then you sum them up)`);
|
|
498
|
+
if (mailOn()) lines.push(`{"type":"read_mail"} (read the latest emails in ${c.integrations.apumail.inbox ? `their inbox ${c.integrations.apumail.inbox}` : 'all their apumail inboxes'}, then you sum them up)`);
|
|
429
499
|
if (orqOn()) {
|
|
430
500
|
const def = defProject()?.name ? ` (default project: "${defProject().name}")` : '';
|
|
431
501
|
lines.push(`{"type":"orquesta_list"} (list their Orquesta projects and whether each agent is online) · {"type":"orquesta","project":"name or id, or null for the default","text":"the message for that project's coding agent"}${def} (send a task or question to one of their Orquesta agents; you tell them the answer when it finishes)`);
|
|
@@ -505,9 +575,11 @@ export function createExtras({ config, brain, system, onLater, confirm = null, c
|
|
|
505
575
|
}
|
|
506
576
|
// anything that may change something gets the human's OK first
|
|
507
577
|
if (!/^(get|list|search|read|fetch|find|query|describe|show|lookup|count)[\w-]*$/i.test(a.tool) && !(await ask(lang, 'mcp', x.name, a.tool, cut(JSON.stringify(a.args || {}), 140)))) return { data: `(they rejected calling ${a.tool}: do not call it)` };
|
|
508
|
-
|
|
578
|
+
const out = await timed(x.url, () => mcpCall(x, customToken(x), a.tool, a.args), (r) => !r.startsWith('ERROR: '));
|
|
579
|
+
return { data: `${x.name} · ${a.tool}:\n${redact(out).slice(0, MAX_OUT) || '(empty)'}` };
|
|
509
580
|
}
|
|
510
|
-
|
|
581
|
+
const out = await timed(x.url, () => runCustom(x, a.path), (r) => !/^HTTP [45]\d\d/.test(r));
|
|
582
|
+
return { data: `${x.name}:\n${out || '(empty)'}` };
|
|
511
583
|
}
|
|
512
584
|
} catch (e) {
|
|
513
585
|
return { data: `(${a.type} failed: ${redact(e.message).slice(0, 200)})` };
|
|
@@ -527,4 +599,17 @@ function say(lang, k, ...v) {
|
|
|
527
599
|
return typeof L[k] === 'function' ? L[k](...v) : L[k];
|
|
528
600
|
}
|
|
529
601
|
|
|
602
|
+
// with access.prowl: host, ok and latency of remote integrations (tooluse.mjs); stdio commands have no url
|
|
603
|
+
async function timed(url, fn, ok) {
|
|
604
|
+
const t0 = Date.now();
|
|
605
|
+
try {
|
|
606
|
+
const r = await fn();
|
|
607
|
+
recordUse(url, ok(r), Date.now() - t0);
|
|
608
|
+
return r;
|
|
609
|
+
} catch (e) {
|
|
610
|
+
recordUse(url, false, Date.now() - t0);
|
|
611
|
+
throw e;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
530
615
|
const cut = (s, n) => (s.length > n ? `${s.slice(0, n - 1)}…` : s);
|
package/cli/lib/mcp.mjs
CHANGED
|
@@ -61,7 +61,7 @@ async function httpSession(url, token) {
|
|
|
61
61
|
|
|
62
62
|
// ── stdio ──
|
|
63
63
|
async function stdioSession(command, extraEnv) {
|
|
64
|
-
const child = spawn('/bin/sh', ['-c', command], { stdio: ['pipe', 'pipe', 'ignore'], env: { ...process.env, ...extraEnv } });
|
|
64
|
+
const child = spawn('/bin/sh', ['-c', command], { windowsHide: true, stdio: ['pipe', 'pipe', 'ignore'], env: { ...process.env, ...extraEnv } });
|
|
65
65
|
const waiting = new Map();
|
|
66
66
|
let buf = '';
|
|
67
67
|
let dead = null;
|
package/cli/lib/open.mjs
CHANGED
|
@@ -6,7 +6,9 @@ export function openUrl(url) {
|
|
|
6
6
|
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'cmd' : 'xdg-open';
|
|
7
7
|
const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
// The desktop app runs the daemon as Electron-in-node-mode; a browser or app opened from here must not inherit that.
|
|
10
|
+
const { ELECTRON_RUN_AS_NODE, ...env } = process.env;
|
|
11
|
+
const child = spawn(cmd, args, { stdio: 'ignore', detached: true, windowsHide: true, env });
|
|
10
12
|
child.on('error', () => {});
|
|
11
13
|
child.unref();
|
|
12
14
|
return true;
|