@7ots/cli 0.1.10 → 0.1.11
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 +13 -1
- package/cli/lib/config.mjs +1 -1
- package/cli/lib/i18n.mjs +3 -0
- package/cli/lib/pet-server.mjs +49 -1
- package/cli/pet/electron/main.cjs +16 -1
- package/cli/pet/pet.html +112 -6
- package/cli/pet/settings.html +42 -3
- package/dist/7ots.esm.js +117 -117
- package/dist/7ots.esm.js.map +4 -4
- package/dist/7ots.iife.js +117 -117
- package/dist/7ots.iife.js.map +4 -4
- package/package.json +1 -1
- package/src/character/beat.js +257 -0
- package/src/character/motion.js +190 -0
- package/src/character3d/model.js +90 -1
- package/src/index.js +2 -0
package/cli/7ots.mjs
CHANGED
|
@@ -43,7 +43,7 @@ function parse(argv) {
|
|
|
43
43
|
}
|
|
44
44
|
return { pos, flags };
|
|
45
45
|
}
|
|
46
|
-
const VALUED = new Set(['seed', 'name', 'lang', 'target', 'mode', 'type', 'code', 'cmd', 'tool', 'from', 'port', 'text', 'minutes', 'cancel', 'server']);
|
|
46
|
+
const VALUED = new Set(['seed', 'name', 'lang', 'target', 'mode', 'type', 'code', 'cmd', 'tool', 'from', 'port', 'text', 'minutes', 'cancel', 'server', 'ms', 'dance']);
|
|
47
47
|
|
|
48
48
|
const fail = (msg, code = 1) => {
|
|
49
49
|
console.error(msg);
|
|
@@ -363,6 +363,15 @@ async function cmdCare(cmd, { pos, flags }) {
|
|
|
363
363
|
await cmdStatus();
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
+
async function cmdDance(cmd, { pos, flags }) {
|
|
367
|
+
const { DANCES } = await import('../src/character/motion.js');
|
|
368
|
+
if (flags.list) return console.log(DANCES.join(' '));
|
|
369
|
+
const name = (cmd === 'dance' ? pos[0] : flags.dance) || undefined;
|
|
370
|
+
const body = { name, ms: flags.ms ? Number(flags.ms) : undefined };
|
|
371
|
+
if (flags['no-music'] || flags.music === false) body.music = false;
|
|
372
|
+
if (!(await postPet('/' + cmd, body))) console.log(dim(t('pet.notRunning')));
|
|
373
|
+
}
|
|
374
|
+
|
|
366
375
|
async function cmdStatus({ flags = {} } = {}) {
|
|
367
376
|
const { identity } = loadIdentity();
|
|
368
377
|
let state;
|
|
@@ -529,6 +538,9 @@ async function main() {
|
|
|
529
538
|
case 'ask':
|
|
530
539
|
case 'tell':
|
|
531
540
|
return cmdAsk(args);
|
|
541
|
+
case 'dance':
|
|
542
|
+
case 'entrance':
|
|
543
|
+
return cmdDance(cmd, args);
|
|
532
544
|
case 'reminders':
|
|
533
545
|
return cmdReminders(args);
|
|
534
546
|
case 'config':
|
package/cli/lib/config.mjs
CHANGED
|
@@ -48,7 +48,7 @@ export const CONFIG_DEFAULTS = Object.freeze({
|
|
|
48
48
|
home: { kind: 'local' },
|
|
49
49
|
brain: { kind: 'lines' },
|
|
50
50
|
voice: { kind: 'browser' },
|
|
51
|
-
pet: { mode: 'ask', annoy: 2 },
|
|
51
|
+
pet: { mode: 'ask', annoy: 2, music: 'synth', musicVol: 0.5 },
|
|
52
52
|
access: { agent: true, memory: true, open: true, notify: true, sites: true, screen: false, processes: false, logs: false, inbox: false, vm: false, vmKinds: ['research', 'browse', 'long'] },
|
|
53
53
|
screen: { every: 5 },
|
|
54
54
|
// conversation memory: recent turns up to `tokens` (≈chars/4), older ones compacted into a summary; 0 = off
|
package/cli/lib/i18n.mjs
CHANGED
|
@@ -15,6 +15,7 @@ const M = {
|
|
|
15
15
|
7ots pet [--mode desktop|terminal|browser|auto] [--detach] [--opaque] wake up your virtual pet
|
|
16
16
|
7ots pet --tmux the terminal pet in a tmux side pane
|
|
17
17
|
7ots feed | play | sleep | wake | say <text> | stop
|
|
18
|
+
7ots dance [name] [--ms N] [--no-music] [--list] | entrance [--dance name]
|
|
18
19
|
7ots status [--line|--json] pet state (--line: one line for tmux)
|
|
19
20
|
7ots ask <text> talk to it: "remind me to check email in 10 min", "open my calendar", "remember that…"
|
|
20
21
|
7ots reminders [--cancel <id>] pending reminders and what it remembers
|
|
@@ -205,6 +206,7 @@ Docs: https://7ots.com/llms.txt`,
|
|
|
205
206
|
7ots pet [--mode desktop|terminal|browser|auto] [--detach] [--opaque] despierta tu mascota virtual
|
|
206
207
|
7ots pet --tmux la mascota de terminal en un panel de tmux
|
|
207
208
|
7ots feed | play | sleep | wake | say <texto> | stop
|
|
209
|
+
7ots dance [nombre] [--ms N] [--no-music] [--list] | entrance [--dance nombre]
|
|
208
210
|
7ots status [--line|--json] estado (--line: una línea para tmux)
|
|
209
211
|
7ots ask <texto> háblale: "recuérdame ver el correo en 10 min", "abre mi calendario", "anota que…"
|
|
210
212
|
7ots reminders [--cancel <id>] recordatorios pendientes y lo que recuerda
|
|
@@ -395,6 +397,7 @@ Docs: https://7ots.com/llms.txt`,
|
|
|
395
397
|
7ots pet [--mode desktop|terminal|browser|auto] [--detach] [--opaque] acorda seu bichinho virtual
|
|
396
398
|
7ots pet --tmux o bichinho de terminal num painel do tmux
|
|
397
399
|
7ots feed | play | sleep | wake | say <texto> | stop
|
|
400
|
+
7ots dance [nombre] [--ms N] [--no-music] [--list] | entrance [--dance nombre]
|
|
398
401
|
7ots status [--line|--json] estado (--line: uma linha para tmux)
|
|
399
402
|
7ots ask <texto> fale com ele: "me lembre de ver o e-mail em 10 min", "abra minha agenda", "anote que…"
|
|
400
403
|
7ots reminders [--cancel <id>] lembretes pendentes e o que ele lembra
|
package/cli/lib/pet-server.mjs
CHANGED
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
* POST /notes/forget { at | 'all' }
|
|
29
29
|
* POST /conversation/forget drop the conversation memory (turns + summary)
|
|
30
30
|
* POST /quit X-7ots-Token
|
|
31
|
+
* POST /dance X-7ots-Token { name?, ms?, music? } → dances (DANCES in motion.js) with music (beat.js or ~/.7ots/music)
|
|
32
|
+
* POST /entrance X-7ots-Token { dance? } → a wrestling-style entrance: walks in, spotlights, pyro, its name, a dance
|
|
33
|
+
* GET /music?token=… { files } your own tracks in ~/.7ots/music · GET /music/<file>?token=… plays one
|
|
31
34
|
*
|
|
32
35
|
* Only listens on 127.0.0.1 and only answers to Host 127.0.0.1/localhost (no DNS rebinding).
|
|
33
36
|
* The token lives in ~/.7ots/pet.token (0600): other users of the machine can't drive the pet.
|
|
@@ -35,7 +38,7 @@
|
|
|
35
38
|
|
|
36
39
|
import { createServer } from 'node:http';
|
|
37
40
|
import { createHash, randomBytes, timingSafeEqual } from 'node:crypto';
|
|
38
|
-
import { readFileSync, existsSync, writeFileSync, chmodSync, mkdirSync, symlinkSync } from 'node:fs';
|
|
41
|
+
import { readFileSync, existsSync, writeFileSync, chmodSync, mkdirSync, symlinkSync, readdirSync, statSync, createReadStream } from 'node:fs';
|
|
39
42
|
import { cardShot } from './card-shot.mjs';
|
|
40
43
|
import { join } from 'node:path';
|
|
41
44
|
import { createAssistant, notify, tr } from './assistant.mjs';
|
|
@@ -61,11 +64,23 @@ import { line } from './lines.mjs';
|
|
|
61
64
|
import { defineIdentity, GROK_VOICES, OPENAI_VOICES } from '../../src/identity/schema.js';
|
|
62
65
|
import { normalizeMod, normalizeMods, MAX_MODS } from '../../src/character/mods.js';
|
|
63
66
|
import { MOD_CATALOG } from '../../src/character/mods/index.js';
|
|
67
|
+
import { DANCES } from '../../src/character/motion.js';
|
|
64
68
|
|
|
65
69
|
/** Mods importados en este pet (~/.7ots/mods/library.json), normalizados. */
|
|
66
70
|
// scenes between ots on the same desktop (pet/electron/director.cjs plays them)
|
|
67
71
|
const SCENE_NAMES = ['rocky', 'sf', 'dbz', 'matrix', 'duel', 'sw', 'fight', 'twist'];
|
|
68
72
|
const SCENE_EVERY = ['rare', 'normal', 'often'];
|
|
73
|
+
// dances and their music (pet.html plays them; music: synthesized, your own files in ~/.7ots/music, or none)
|
|
74
|
+
const MUSIC_MODES = ['synth', 'files', 'off'];
|
|
75
|
+
const MUSIC_TYPES = { mp3: 'audio/mpeg', ogg: 'audio/ogg', oga: 'audio/ogg', opus: 'audio/ogg', wav: 'audio/wav', m4a: 'audio/mp4', aac: 'audio/aac', flac: 'audio/flac', webm: 'audio/webm' };
|
|
76
|
+
const MUSIC_FILE = /^[^/\\\0]{1,160}\.(mp3|ogg|oga|opus|wav|m4a|aac|flac|webm)$/i;
|
|
77
|
+
function musicFiles() {
|
|
78
|
+
try {
|
|
79
|
+
return readdirSync(homeFile('music')).filter((f) => MUSIC_FILE.test(f) && !f.startsWith('.') && statSync(homeFile(`music/${f}`)).isFile()).sort();
|
|
80
|
+
} catch {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
69
84
|
const modLibrary = () => (readJson(homeFile('mods/library.json')) || []).map(normalizeMod).filter(Boolean);
|
|
70
85
|
import { ensureHome, homeFile, PET_PORT, PKG_ROOT } from './paths.mjs';
|
|
71
86
|
import { applyEvent, loadPet, need, savePet, tick, view } from './pet-core.mjs';
|
|
@@ -123,6 +138,17 @@ export function startPetServer({ port = PET_PORT, log = () => {} } = {}) {
|
|
|
123
138
|
let config = loadConfig();
|
|
124
139
|
let scenePlay = null; // { scene, at }: asked from settings, taken by the director on its next poll
|
|
125
140
|
const sceneConf = (c = config) => ({ on: true, every: 'normal', list: SCENE_NAMES, ...c.pet?.scenes });
|
|
141
|
+
// a dance to play: its name (or one at random), how long and the music under it, per the pet's music setting
|
|
142
|
+
const musicFor = (d = {}) => {
|
|
143
|
+
const name = DANCES.includes(d.name) ? d.name : DANCES[Math.floor(Math.random() * DANCES.length)];
|
|
144
|
+
const ms = Math.max(1500, Math.min(60000, Number(d.ms) || 8000));
|
|
145
|
+
const mode = d.music === false ? 'off' : config.pet.music || 'synth';
|
|
146
|
+
const vol = Math.max(0, Math.min(1, Number(config.pet.musicVol ?? 0.5)));
|
|
147
|
+
const files = mode === 'files' ? musicFiles() : [];
|
|
148
|
+
const file = typeof d.file === 'string' && files.includes(d.file) ? d.file : files[Math.floor(Math.random() * files.length)];
|
|
149
|
+
const music = mode === 'off' ? null : file ? { file, vol } : { style: typeof d.style === 'string' ? d.style : '', vol };
|
|
150
|
+
return { name, ms, music };
|
|
151
|
+
};
|
|
126
152
|
const annoyOf = (c) => Math.max(0, Math.min(3, Number(c.pet.annoy ?? 2)));
|
|
127
153
|
let annoy = annoyOf(config);
|
|
128
154
|
const { identity } = loadIdentity();
|
|
@@ -557,6 +583,18 @@ export function startPetServer({ port = PET_PORT, log = () => {} } = {}) {
|
|
|
557
583
|
scenePlay = null;
|
|
558
584
|
return json(200, { ...sceneConf(), play });
|
|
559
585
|
}
|
|
586
|
+
if (req.method === 'GET' && p === '/music') return json(200, { files: musicFiles(), dir: homeFile('music') });
|
|
587
|
+
if (req.method === 'GET' && p.startsWith('/music/')) {
|
|
588
|
+
let name = '';
|
|
589
|
+
try {
|
|
590
|
+
name = decodeURIComponent(p.slice(7));
|
|
591
|
+
} catch {}
|
|
592
|
+
if (!musicFiles().includes(name)) return res.writeHead(404).end();
|
|
593
|
+
const f = homeFile(`music/${name}`);
|
|
594
|
+
const type = MUSIC_TYPES[name.split('.').pop().toLowerCase()];
|
|
595
|
+
res.writeHead(200, { 'Content-Type': type, 'Content-Length': statSync(f).size, 'Cache-Control': 'no-cache' });
|
|
596
|
+
return createReadStream(f).pipe(res);
|
|
597
|
+
}
|
|
560
598
|
if (req.method === 'GET' && p === '/inferences') {
|
|
561
599
|
// this ot's calls plus those of the ots visiting this desktop (the host sees all), each tagged with its ot
|
|
562
600
|
const n = Number(url.searchParams.get('n')) || 100;
|
|
@@ -927,6 +965,13 @@ ${keys.map((k) => FIELDS[k]).join('\n')}`;
|
|
|
927
965
|
return json(e.status === 400 ? 400 : 502, { error: e.message });
|
|
928
966
|
}
|
|
929
967
|
}
|
|
968
|
+
if (p === '/dance' || p === '/entrance') {
|
|
969
|
+
const dance = musicFor(data);
|
|
970
|
+
if (p === '/dance') broadcast({ dance });
|
|
971
|
+
else broadcast({ entrance: { ...dance, name: identity.name || 'ot' } });
|
|
972
|
+
log(`${p.slice(1)}: ${dance.name}${dance.music ? ` ♪ ${dance.music.file || dance.music.style}` : ''}`);
|
|
973
|
+
return json(200, { ok: true, dance: dance.name, music: dance.music });
|
|
974
|
+
}
|
|
930
975
|
if (p === '/scenes/play') {
|
|
931
976
|
scenePlay = { scene: SCENE_NAMES.includes(data.scene) ? data.scene : '', at: Date.now() };
|
|
932
977
|
return json(200, { ok: true });
|
|
@@ -957,6 +1002,7 @@ ${keys.map((k) => FIELDS[k]).join('\n')}`;
|
|
|
957
1002
|
otLook: identity.look?.character || null,
|
|
958
1003
|
// the catalog without its 3D models (the page only draws the 2D previews)
|
|
959
1004
|
modLibrary: modLibrary(),
|
|
1005
|
+
musicFiles: musicFiles(),
|
|
960
1006
|
modCatalog: MOD_CATALOG.map((m) => normalizeMod(m)).map((m) => ({ ...m, parts: m.parts.map((x) => ({ ...x, glb: x.glb ? '3d' : '' })) })),
|
|
961
1007
|
integrations: config.integrations,
|
|
962
1008
|
character: config.character,
|
|
@@ -998,6 +1044,8 @@ ${keys.map((k) => FIELDS[k]).join('\n')}`;
|
|
|
998
1044
|
if (d.pet) {
|
|
999
1045
|
if (d.pet.annoy !== undefined) next.pet.annoy = Math.max(0, Math.min(3, Math.round(Number(d.pet.annoy)) || 0));
|
|
1000
1046
|
if (['2d', '3d'].includes(d.pet.view)) next.pet.view = d.pet.view;
|
|
1047
|
+
if (MUSIC_MODES.includes(d.pet.music)) next.pet.music = d.pet.music;
|
|
1048
|
+
if (d.pet.musicVol !== undefined) next.pet.musicVol = Math.max(0, Math.min(1, Math.round(Number(d.pet.musicVol) * 100) / 100 || 0));
|
|
1001
1049
|
if (d.pet.scenes) {
|
|
1002
1050
|
const c = { ...sceneConf(next), ...d.pet.scenes };
|
|
1003
1051
|
next.pet.scenes = {
|
|
@@ -459,6 +459,7 @@ function makeOt(opt = {}) {
|
|
|
459
459
|
if (m.startsWith('\u00a77bye')) return HOST || dismiss();
|
|
460
460
|
if (m.startsWith('\u00a77ctx')) return (FULL ? menu() : guestMenu()).popup({ window: win });
|
|
461
461
|
if (m.startsWith('\u00a77view')) return setView(m.slice(6) === '3d');
|
|
462
|
+
if (m.startsWith('\u00a77enter')) return enter();
|
|
462
463
|
if (!m.startsWith('\u00a77need')) return;
|
|
463
464
|
try {
|
|
464
465
|
need = JSON.parse(m.slice(6));
|
|
@@ -575,6 +576,20 @@ function makeOt(opt = {}) {
|
|
|
575
576
|
place(Math.round(lift));
|
|
576
577
|
}, 16);
|
|
577
578
|
|
|
579
|
+
// ── Entrance (pet.html entrance()): it reappears ~500 px toward the middle of the screen and walks back
|
|
580
|
+
// to where it was, like down the ramp to the ring. Not mid-scene, not pinned or asleep. ──
|
|
581
|
+
let enterUntil = 0;
|
|
582
|
+
function enter() {
|
|
583
|
+
if (plan.mode === 'scene' || plan.mode === 'fling' || still || asleep || Date.now() - dragged < 2000) return;
|
|
584
|
+
enterUntil = Date.now() + 12000;
|
|
585
|
+
const to = { ...pos };
|
|
586
|
+
const mid = area.x + area.width / 2;
|
|
587
|
+
pos.x = Math.max(minX, Math.min(maxX, to.x + (to.x > mid ? -1 : 1) * 520));
|
|
588
|
+
vel.x = vel.y = 0;
|
|
589
|
+
place();
|
|
590
|
+
plan = { mode: 'go', tx: to.x, ty: to.y, speed: 115 };
|
|
591
|
+
}
|
|
592
|
+
|
|
578
593
|
// ── Errands: walk to what needs you and point at it ──
|
|
579
594
|
const minY = area.y + BIG.h;
|
|
580
595
|
const TERM = /terminal|kitty|alacritty|konsole|tilix|wezterm|xterm|ghostty|warp|terminator|code|cursor|windsurf|zed|jetbrains|idea|pycharm|webstorm/i;
|
|
@@ -664,7 +679,7 @@ function makeOt(opt = {}) {
|
|
|
664
679
|
daemon: { url: base, token: opt.token || TOKEN }, // its own daemon (settings there can ask for a scene)
|
|
665
680
|
// for a scene asked from settings: errands (pointing at the terminal while an agent works) may be cut short
|
|
666
681
|
ready: () => alive() && win.isVisible() && !win.webContents.isLoading() && !asleep && Date.now() - dragged > 3000 && Date.now() > hoverUntil + 1500 && plan.mode !== 'scene' && plan.mode !== 'fling',
|
|
667
|
-
free: () => alive() && win.isVisible() && !win.webContents.isLoading() && !still && !asleep && Date.now() - dragged > 8000 && Date.now() > hoverUntil + 1500 && !busy && /idle|go|hop/.test(plan.mode),
|
|
682
|
+
free: () => alive() && win.isVisible() && !win.webContents.isLoading() && !still && !asleep && Date.now() > enterUntil && Date.now() - dragged > 8000 && Date.now() > hoverUntil + 1500 && !busy && /idle|go|hop/.test(plan.mode),
|
|
668
683
|
walkTo: (x, y = pos.y, speed = 120) => (plan = { mode: 'scene', tx: Math.max(minX, Math.min(maxX, x)), ty: Math.max(minY, Math.min(floor, y)), speed, dir: plan.dir || 0 }),
|
|
669
684
|
arrivedAt: () => plan.mode === 'scene' && Math.abs(plan.tx - pos.x) < 6 && Math.abs(plan.ty - pos.y) < 6 && Math.hypot(vel.x, vel.y) < 10,
|
|
670
685
|
face: (dir) => {
|
package/cli/pet/pet.html
CHANGED
|
@@ -140,6 +140,10 @@
|
|
|
140
140
|
.props .ring { top: 34%; width: 18px; height: 18px; margin: -9px; border-radius: 50%; border: 2px solid rgb(180 220 255 / .8); }
|
|
141
141
|
.props .saber { left: 50%; top: 50%; width: 6px; height: 92px; margin-left: -3px; transform-origin: 50% 100%; border-radius: 4px; background: #fff; }
|
|
142
142
|
.props .flash { top: 44%; width: 30px; height: 30px; margin: -15px; border-radius: 50%; background: radial-gradient(#fff, #ffd35a 40%, #ff7a1a 60%, transparent 70%); }
|
|
143
|
+
/* entrances (wrestling style): spotlights from above, pyro columns, the name slammed in */
|
|
144
|
+
.props .spot { left: 50%; bottom: 0; width: 120px; height: 140%; margin-left: -60px; transform-origin: 50% 0; top: -40%; background: linear-gradient(180deg, rgb(255 250 220 / .0), rgb(255 250 220 / .32) 70%, rgb(255 250 220 / .0)); clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%); filter: blur(2px); mix-blend-mode: screen; }
|
|
145
|
+
.props .pyro { bottom: 6%; width: 16px; height: 120px; margin-left: -8px; transform-origin: 50% 100%; border-radius: 8px 8px 4px 4px; background: linear-gradient(0deg, #fff6c0, #ffb627 30%, #ff5a1f 65%, transparent); filter: blur(1px) drop-shadow(0 0 10px #ff8a1f); }
|
|
146
|
+
.props .title { left: 50%; top: 4%; transform: translateX(-50%); font: 900 30px/1 Impact, 'Anton', system-ui, sans-serif; letter-spacing: 2px; text-transform: uppercase; white-space: nowrap; color: #fff; background: linear-gradient(180deg, #fff 30%, #ffd84a 55%, #ff8a1f); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; -webkit-text-stroke: 1.5px #2a0f00; filter: drop-shadow(0 3px 0 #1a0a00) drop-shadow(0 0 12px rgb(255 160 40 / .7)); }
|
|
143
147
|
.props .pow { left: 50%; top: 6%; font: 900 22px/1 system-ui, sans-serif; color: #ffd400; -webkit-text-stroke: 2px #1a1020; transform: translateX(-50%); white-space: nowrap; }
|
|
144
148
|
/* a visiting ot: its own little menu (play, say goodbye, settings, move); feeding, talking and sleep are the host's */
|
|
145
149
|
body.guest .ask, body.guest #talkBtn, body.guest #micBtn, body.guest #sleepBtn { display: none !important; }
|
|
@@ -206,6 +210,7 @@
|
|
|
206
210
|
<button class="act" id="talkBtn" type="button"><svg viewBox="0 0 24 24"><path d="M5 6h14v9H9l-4 3z"/></svg><span data-t="talk"></span></button>
|
|
207
211
|
<button class="act" id="micBtn" type="button"><svg viewBox="0 0 24 24"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21"/></svg><span data-t="listen"></span></button>
|
|
208
212
|
<button class="act" data-act="sleep" id="sleepBtn"><svg viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z"/></svg><span data-t="sleep"></span></button>
|
|
213
|
+
<button class="act" id="danceBtn" type="button"><svg viewBox="0 0 24 24"><path d="M9 18V6l10-2v12"/><circle cx="7" cy="18" r="2"/><circle cx="17" cy="16" r="2"/></svg><span data-t="dance"></span></button>
|
|
209
214
|
<a class="act" id="setBtn" target="_blank" rel="noopener"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.3 5.3l2.1 2.1M16.6 16.6l2.1 2.1M5.3 18.7l2.1-2.1M16.6 7.4l2.1-2.1"/></svg><span data-t="settings"></span></a>
|
|
210
215
|
<button class="act bye" id="byeBtn" type="button"><svg viewBox="0 0 24 24"><path d="M15 4h4v16h-4M10 8l-4 4 4 4M6 12h10"/></svg></button>
|
|
211
216
|
<button class="act grip" id="moveBtn" type="button" title="⇔"><svg viewBox="0 0 24 24"><path d="M12 3v18M3 12h18M12 3l-3 3M12 3l3 3M12 21l-3-3M12 21l3-3M3 12l3-3M3 12l3 3M21 12l-3-3M21 12l-3 3"/></svg></button>
|
|
@@ -222,17 +227,17 @@
|
|
|
222
227
|
<script type="module">
|
|
223
228
|
const BOOT = __BOOT__;
|
|
224
229
|
const T = {
|
|
225
|
-
en: { settings: 'Settings', dismiss: 'Send home', listen: 'Listen', listening: 'Listening… 🎙️', noStt: 'Voice control needs an OpenAI or ElevenLabs key (Settings).', noMic: 'I can’t reach the microphone.', sttErr: 'I didn’t catch that.', talk: 'Talk', askPh: 'Remind me to check email in 10 min…', feed: 'Treat', play: 'Play', sleep: 'Sleep', wake: 'Wake', food: 'Food', energy: 'Energy', fun: 'Fun', level: 'Level {l}', xp: '{x} / {n} xp', live: 'Live', off: 'Reconnecting…', approve: 'Approve', reject: 'Reject',
|
|
230
|
+
en: { dance: 'Dance', settings: 'Settings', dismiss: 'Send home', listen: 'Listen', listening: 'Listening… 🎙️', noStt: 'Voice control needs an OpenAI or ElevenLabs key (Settings).', noMic: 'I can’t reach the microphone.', sttErr: 'I didn’t catch that.', talk: 'Talk', askPh: 'Remind me to check email in 10 min…', feed: 'Treat', play: 'Play', sleep: 'Sleep', wake: 'Wake', food: 'Food', energy: 'Energy', fun: 'Fun', level: 'Level {l}', xp: '{x} / {n} xp', live: 'Live', off: 'Reconnecting…', approve: 'Approve', reject: 'Reject',
|
|
226
231
|
activity: 'Activity', empty: 'Nothing yet. Run a command or ask your coding agent something.', tally: '{ok} ok · {fail} failed · turns {turns}',
|
|
227
232
|
brain: 'Brain: {b}', age: 'Born {d}', lines: 'built-in phrases', now: 'now', m: '{n}m', h: '{n}h',
|
|
228
233
|
moods: { happy: 'Happy', neutral: 'Calm', sad: 'Sad', disgust: 'Bored', sleep: 'Asleep', thinking: 'Thinking' },
|
|
229
234
|
kind: { tool: 'Tool', shell: 'Shell', prompt: 'You asked', stop: 'Turn finished', notify: 'Needs you', start: 'Session started' } },
|
|
230
|
-
es: { settings: 'Ajustes', dismiss: 'Despedir', listen: 'Escuchar', listening: 'Te escucho… 🎙️', noStt: 'Para hablarme por voz falta una key de OpenAI o ElevenLabs (Ajustes).', noMic: 'No puedo usar el micrófono.', sttErr: 'No te entendí.', talk: 'Hablar', askPh: 'Recuérdame ver el correo en 10 min…', feed: 'Mimar', play: 'Jugar', sleep: 'Dormir', wake: 'Despertar', food: 'Comida', energy: 'Energía', fun: 'Diversión', level: 'Nivel {l}', xp: '{x} / {n} xp', live: 'En vivo', off: 'Reconectando…', approve: 'Aprobar', reject: 'Rechazar',
|
|
235
|
+
es: { dance: 'Bailar', settings: 'Ajustes', dismiss: 'Despedir', listen: 'Escuchar', listening: 'Te escucho… 🎙️', noStt: 'Para hablarme por voz falta una key de OpenAI o ElevenLabs (Ajustes).', noMic: 'No puedo usar el micrófono.', sttErr: 'No te entendí.', talk: 'Hablar', askPh: 'Recuérdame ver el correo en 10 min…', feed: 'Mimar', play: 'Jugar', sleep: 'Dormir', wake: 'Despertar', food: 'Comida', energy: 'Energía', fun: 'Diversión', level: 'Nivel {l}', xp: '{x} / {n} xp', live: 'En vivo', off: 'Reconectando…', approve: 'Aprobar', reject: 'Rechazar',
|
|
231
236
|
activity: 'Actividad', empty: 'Nada todavía. Ejecuta un comando o pregúntale algo a tu agente.', tally: '{ok} ok · {fail} fallos · turnos {turns}',
|
|
232
237
|
brain: 'Cerebro: {b}', age: 'Nació {d}', lines: 'frases propias', now: 'ahora', m: '{n} min', h: '{n} h',
|
|
233
238
|
moods: { happy: 'Feliz', neutral: 'Tranquilo', sad: 'Triste', disgust: 'Aburrido', sleep: 'Dormido', thinking: 'Pensando' },
|
|
234
239
|
kind: { tool: 'Herramienta', shell: 'Terminal', prompt: 'Preguntaste', stop: 'Turno terminado', notify: 'Te necesita', start: 'Sesión iniciada' } },
|
|
235
|
-
pt: { settings: 'Ajustes', dismiss: 'Despedir', listen: 'Ouvir', listening: 'Estou ouvindo… 🎙️', noStt: 'Para falar por voz falta uma key da OpenAI ou ElevenLabs (Ajustes).', noMic: 'Não consigo usar o microfone.', sttErr: 'Não entendi.', talk: 'Falar', askPh: 'Me lembre de ver o e-mail em 10 min…', feed: 'Mimar', play: 'Brincar', sleep: 'Dormir', wake: 'Acordar', food: 'Comida', energy: 'Energia', fun: 'Diversão', level: 'Nível {l}', xp: '{x} / {n} xp', live: 'Ao vivo', off: 'Reconectando…', approve: 'Aprovar', reject: 'Recusar',
|
|
240
|
+
pt: { dance: 'Dançar', settings: 'Ajustes', dismiss: 'Despedir', listen: 'Ouvir', listening: 'Estou ouvindo… 🎙️', noStt: 'Para falar por voz falta uma key da OpenAI ou ElevenLabs (Ajustes).', noMic: 'Não consigo usar o microfone.', sttErr: 'Não entendi.', talk: 'Falar', askPh: 'Me lembre de ver o e-mail em 10 min…', feed: 'Mimar', play: 'Brincar', sleep: 'Dormir', wake: 'Acordar', food: 'Comida', energy: 'Energia', fun: 'Diversão', level: 'Nível {l}', xp: '{x} / {n} xp', live: 'Ao vivo', off: 'Reconectando…', approve: 'Aprovar', reject: 'Recusar',
|
|
236
241
|
activity: 'Atividade', empty: 'Nada ainda. Rode um comando ou pergunte algo ao seu agente.', tally: '{ok} ok · {fail} falhas · turnos {turns}',
|
|
237
242
|
brain: 'Cérebro: {b}', age: 'Nasceu {d}', lines: 'frases próprias', now: 'agora', m: '{n} min', h: '{n} h',
|
|
238
243
|
moods: { happy: 'Feliz', neutral: 'Tranquilo', sad: 'Triste', disgust: 'Entediado', sleep: 'Dormindo', thinking: 'Pensando' },
|
|
@@ -265,7 +270,7 @@
|
|
|
265
270
|
$('#brain').innerHTML = '';
|
|
266
271
|
$('#brain').append(t('brain', { b: '' }), Object.assign(document.createElement('b'), { textContent: BOOT.brain === 'lines' ? t('lines') : BOOT.brain }));
|
|
267
272
|
|
|
268
|
-
const { createCharacter, loadCharacter3D } = await import('/dist/7ots.esm.js');
|
|
273
|
+
const { createCharacter, loadCharacter3D, playBeat, DANCES = [], DANCE_STYLE = {} } = await import('/dist/7ots.esm.js');
|
|
269
274
|
const spec = id.look?.character || {};
|
|
270
275
|
let ch = null;
|
|
271
276
|
if (new URLSearchParams(location.search).has('3d')) {
|
|
@@ -287,6 +292,7 @@
|
|
|
287
292
|
let fxUntil = 0;
|
|
288
293
|
let actUntil = 0; // a scene act is playing: it needs actRoom px on each side (a beam, a saber swing)
|
|
289
294
|
let actRoom = 0;
|
|
295
|
+
let actTall = 70; // and that much room above it (an entrance's name card)
|
|
290
296
|
for (const k of ['gesture', 'effect', 'morph']) {
|
|
291
297
|
const f = ch[k]?.bind(ch);
|
|
292
298
|
if (!f) continue;
|
|
@@ -328,7 +334,7 @@
|
|
|
328
334
|
h = Math.max(h, st.height + 6 + b.offsetHeight + 16);
|
|
329
335
|
}
|
|
330
336
|
if (document.body.classList.contains('talking')) (w = Math.max(w, 240)), (h = Math.max(h, st.height + 60));
|
|
331
|
-
if (Date.now() < actUntil) (w = Math.max(w, actRoom * 2)), (h = Math.max(h, st.height +
|
|
337
|
+
if (Date.now() < actUntil) (w = Math.max(w, actRoom * 2)), (h = Math.max(h, st.height + actTall));
|
|
332
338
|
w = Math.max(w, st.width + 2 * 58); // the menu beside it (shown on hover)
|
|
333
339
|
return { w: Math.ceil(w), h: Math.ceil(h) };
|
|
334
340
|
};
|
|
@@ -718,6 +724,8 @@
|
|
|
718
724
|
if (m.morph) ch.morph?.(m.morph);
|
|
719
725
|
if (m.effect) ch.effect?.(m.effect);
|
|
720
726
|
if (m.say) say(m.say, !m.gesture);
|
|
727
|
+
if (m.dance) dance(m.dance);
|
|
728
|
+
if (m.entrance) entrance(m.entrance);
|
|
721
729
|
if (m.point && desktop) window.__goal = m.point; // the desktop shell walks it over there
|
|
722
730
|
};
|
|
723
731
|
}
|
|
@@ -927,10 +935,13 @@
|
|
|
927
935
|
if (d.effect) ch.effect?.(d.effect);
|
|
928
936
|
if (d.act && ACTS[d.act]) {
|
|
929
937
|
actRoom = d.room || 150;
|
|
938
|
+
actTall = 70;
|
|
930
939
|
actUntil = Date.now() + (d.ms || 3600);
|
|
931
940
|
tellNeed();
|
|
932
941
|
requestAnimationFrame(() => ACTS[d.act](d.dir || 1, d));
|
|
933
942
|
}
|
|
943
|
+
if (d.dance) dance(d.dance);
|
|
944
|
+
if (d.entrance) entrance(d.entrance);
|
|
934
945
|
if (d.face != null) {
|
|
935
946
|
if (is3d) ch.character.yaw = -d.face * 0.9;
|
|
936
947
|
else $('#stage').classList.toggle('flip', d.face < 0);
|
|
@@ -939,6 +950,100 @@
|
|
|
939
950
|
}
|
|
940
951
|
});
|
|
941
952
|
|
|
953
|
+
// ── dances with music, and entrances (POST /dance, /entrance on the daemon; `7ots dance`, `7ots entrance`) ──
|
|
954
|
+
// Music: synthesized at the dance's tempo (beat.js, no copyrighted audio) or one of your own files in ~/.7ots/music.
|
|
955
|
+
const any = (a) => a[Math.floor(Math.random() * a.length)];
|
|
956
|
+
let beat = null;
|
|
957
|
+
let tune = null;
|
|
958
|
+
let danceEnd = 0;
|
|
959
|
+
function stopMusic(fade = 0.4) {
|
|
960
|
+
beat?.stop(fade);
|
|
961
|
+
beat = null;
|
|
962
|
+
if (tune) {
|
|
963
|
+
const a = tune;
|
|
964
|
+
tune = null;
|
|
965
|
+
const v0 = a.volume;
|
|
966
|
+
const t0 = Date.now();
|
|
967
|
+
const f = setInterval(() => {
|
|
968
|
+
const k = Math.min(1, (Date.now() - t0) / (fade * 1000 || 1));
|
|
969
|
+
a.volume = Math.max(0, v0 * (1 - k));
|
|
970
|
+
if (k >= 1) (clearInterval(f), a.pause());
|
|
971
|
+
}, 40);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
function music(m, ms, style) {
|
|
975
|
+
stopMusic(0.2);
|
|
976
|
+
if (!m || guest) return; // a visitor dances along to the host's music
|
|
977
|
+
const vol = Math.max(0, Math.min(1, m.vol ?? 0.5));
|
|
978
|
+
if (m.file) {
|
|
979
|
+
const a = new Audio(`/music/${encodeURIComponent(m.file)}?token=${encodeURIComponent(BOOT.token)}`);
|
|
980
|
+
a.volume = vol;
|
|
981
|
+
a.play().catch((e) => console.warn('[7ots pet] music:', e?.message || e));
|
|
982
|
+
tune = a;
|
|
983
|
+
setTimeout(() => tune === a && stopMusic(1.2), Math.max(0, ms - 1200));
|
|
984
|
+
} else beat = playBeat?.(m.style || style || 'hype', { ms, volume: vol });
|
|
985
|
+
}
|
|
986
|
+
function dance(d = {}) {
|
|
987
|
+
if (asleep) stir();
|
|
988
|
+
const name = DANCES.includes(d.name) ? d.name : any(DANCES.length ? DANCES : ['dance']);
|
|
989
|
+
const ms = Math.max(1500, Math.min(60000, Number(d.ms) || 8000));
|
|
990
|
+
danceEnd = Date.now() + ms;
|
|
991
|
+
ch.gesture(name, { ms });
|
|
992
|
+
music(d.music, ms, DANCE_STYLE[name]);
|
|
993
|
+
}
|
|
994
|
+
// a wrestling-style entrance: the crowd, two booms with pyro, spotlights, its name slammed in, then a dance
|
|
995
|
+
let entering = 0;
|
|
996
|
+
function entrance(d = {}) {
|
|
997
|
+
if (Date.now() < entering) return;
|
|
998
|
+
const INTRO = 2200; // the music's intro (crowd + booms) before the riff
|
|
999
|
+
const ms = 12000;
|
|
1000
|
+
entering = Date.now() + ms;
|
|
1001
|
+
stir();
|
|
1002
|
+
music(d.music && !d.music.file ? { ...d.music, style: 'entrance' } : d.music, ms, 'entrance');
|
|
1003
|
+
if (desktop) console.debug('§7enter'); // the shell walks it in from the side
|
|
1004
|
+
actRoom = 190;
|
|
1005
|
+
actTall = 150;
|
|
1006
|
+
actUntil = Date.now() + ms;
|
|
1007
|
+
tellNeed();
|
|
1008
|
+
// walking in under two crossing spotlights
|
|
1009
|
+
for (const k of [-1, 1]) {
|
|
1010
|
+
const sp = prop('spot');
|
|
1011
|
+
gone(sp, sp.animate([{ opacity: 0, transform: `rotate(${k * 28}deg)` }, { opacity: 1, transform: `rotate(${-k * 18}deg)`, offset: 0.25 }, { opacity: 1, transform: `rotate(${k * 12}deg)`, offset: 0.5 }, { opacity: 1, transform: `rotate(${-k * 6}deg)`, offset: 0.75 }, { opacity: 0, transform: 'rotate(0deg)' }], { duration: ms, easing: 'ease-in-out' }));
|
|
1012
|
+
}
|
|
1013
|
+
ch.gesture('groove', { ms: INTRO + 1800 });
|
|
1014
|
+
// pyro on each boom of the music (1.0 s and 1.6 s), both sides
|
|
1015
|
+
const pyro = (at) =>
|
|
1016
|
+
setTimeout(() => {
|
|
1017
|
+
for (const x of [-1, 1]) {
|
|
1018
|
+
const p = prop('pyro', { left: `calc(50% + ${x * (actRoom - 30)}px)` });
|
|
1019
|
+
gone(p, p.animate([{ transform: 'scaleY(0)', opacity: 1 }, { transform: 'scaleY(1.1)', opacity: 1, offset: 0.25 }, { transform: 'scaleY(.8)', opacity: 0.9, offset: 0.6 }, { transform: 'scaleY(.2)', opacity: 0 }], { duration: 1100, easing: 'ease-out' }));
|
|
1020
|
+
}
|
|
1021
|
+
const f = prop('flash', { left: '50%', top: '30%' });
|
|
1022
|
+
gone(f, f.animate([{ opacity: 1, transform: 'scale(.5)' }, { opacity: 0, transform: 'scale(4)' }], { duration: 500 }));
|
|
1023
|
+
ch.effect?.('sparkles');
|
|
1024
|
+
}, at);
|
|
1025
|
+
pyro(1000);
|
|
1026
|
+
pyro(1600);
|
|
1027
|
+
// its name, slammed in on the riff
|
|
1028
|
+
setTimeout(() => {
|
|
1029
|
+
const t = prop('title', {}, String(d.name || id.name || 'ot').slice(0, 24));
|
|
1030
|
+
gone(t, t.animate([{ opacity: 0, transform: 'translateX(-50%) scale(2.6)' }, { opacity: 1, transform: 'translateX(-50%) scale(.95)', offset: 0.06 }, { opacity: 1, transform: 'translateX(-50%) scale(1)', offset: 0.1 }, { opacity: 1, transform: 'translateX(-50%) scale(1.04)', offset: 0.85 }, { opacity: 0, transform: 'translateX(-50%) translateY(-10px) scale(1)' }], { duration: ms - INTRO - 600, easing: 'ease-out' }));
|
|
1031
|
+
ch.gesture('celebrate');
|
|
1032
|
+
ch.effect?.('confetti');
|
|
1033
|
+
}, INTRO);
|
|
1034
|
+
// arrived: points at the crowd, then dances to the end of the music
|
|
1035
|
+
setTimeout(() => (ch.gesture('point'), ch.effect?.('sparkles')), INTRO + 1900);
|
|
1036
|
+
setTimeout(() => {
|
|
1037
|
+
const name = DANCES.includes(d.dance) ? d.dance : any(DANCES.filter((n) => n !== 'dab' && n !== 'dance'));
|
|
1038
|
+
danceEnd = entering;
|
|
1039
|
+
ch.gesture(name, { ms: ms - INTRO - 3600 });
|
|
1040
|
+
}, INTRO + 3400);
|
|
1041
|
+
}
|
|
1042
|
+
$('#danceBtn').title = t('dance');
|
|
1043
|
+
if (!guest)
|
|
1044
|
+
$('#danceBtn')?.addEventListener('click', () => post('/dance', {}).catch(() => dance({})));
|
|
1045
|
+
else $('#danceBtn')?.addEventListener('click', () => dance({}));
|
|
1046
|
+
|
|
942
1047
|
// ── personality: small life between events (glances, fidgets, effects, shape changes) ──
|
|
943
1048
|
const pick = (a) => a[Math.floor(Math.random() * a.length)];
|
|
944
1049
|
const SHAPES = ['round', 'egg', 'pear', 'bean', 'squircle', 'drop', 'ghost', 'cat', 'cloud', 'blob', 'heart', 'mushroom', 'tall', 'wide'].filter((x) => x !== spec.shape);
|
|
@@ -965,6 +1070,7 @@
|
|
|
965
1070
|
[0.6, () => ch.gesture('hiccup')],
|
|
966
1071
|
[0.5, () => (ch.gesture('sneeze'), ch.effect?.('sneeze'))],
|
|
967
1072
|
[happy ? 2.5 : 0.6, () => (ch.gesture('dance'), ch.effect?.('notes'))],
|
|
1073
|
+
[happy ? 0.8 : 0.2, () => ch.gesture(pick(DANCES.length ? DANCES : ['dance']), { ms: 3000 })], // a few silent moves (music only when asked)
|
|
968
1074
|
[happy ? 0.8 : 0.2, () => (ch.gesture('celebrate'), ch.effect?.('sparkles'))],
|
|
969
1075
|
[0.6, () => ch.gesture('spin')],
|
|
970
1076
|
[0.5, () => ch.gesture('clap')],
|
|
@@ -980,7 +1086,7 @@
|
|
|
980
1086
|
}
|
|
981
1087
|
(function life() {
|
|
982
1088
|
setTimeout(() => {
|
|
983
|
-
if (!asleep && !thinking && !rec && !bubble.classList.contains('on') && !document.hidden) fidget();
|
|
1089
|
+
if (!asleep && !thinking && !rec && !bubble.classList.contains('on') && !document.hidden && Date.now() > danceEnd) fidget(); // not over a dance
|
|
984
1090
|
life();
|
|
985
1091
|
}, 4000 + Math.random() * 8000);
|
|
986
1092
|
})();
|
package/cli/pet/settings.html
CHANGED
|
@@ -299,6 +299,18 @@
|
|
|
299
299
|
<button type="button" id="scPlay" data-t="scPlay"></button>
|
|
300
300
|
<span class="msg" id="scMsg" role="status"></span>
|
|
301
301
|
</div>
|
|
302
|
+
<h3 class="sh" data-t="muH"></h3>
|
|
303
|
+
<p class="hint" data-t="muHint"></p>
|
|
304
|
+
<div class="row">
|
|
305
|
+
<div class="chips" id="muMode"></div>
|
|
306
|
+
<input type="range" id="muVol" min="0" max="1" step="0.05" style="max-width:10rem" aria-label="volume">
|
|
307
|
+
</div>
|
|
308
|
+
<p class="hint" id="muFiles"></p>
|
|
309
|
+
<div class="row">
|
|
310
|
+
<button type="button" id="muDance" data-t="muDance"></button>
|
|
311
|
+
<button type="button" id="muEnter" data-t="muEnter"></button>
|
|
312
|
+
<span class="msg" id="muMsg" role="status"></span>
|
|
313
|
+
</div>
|
|
302
314
|
<h3 class="sh" data-t="modsH"></h3>
|
|
303
315
|
<p class="hint" data-t="modsHint"></p>
|
|
304
316
|
<div id="mods"></div>
|
|
@@ -383,7 +395,7 @@
|
|
|
383
395
|
notify: 'Notifications', notifyD: 'A desktop notification when a reminder fires.',
|
|
384
396
|
soon: 'coming soon', screen: 'See your screen', screenD: 'Look at what’s open to help with it.', procs: 'Processes and apps', procsD: 'See which programs run (name, CPU, memory) and wait for one to finish. Command arguments that look like keys are hidden.', inbox: 'Read mail and calendar', inboxD: 'Summaries and replies, not just opening the tab.',
|
|
385
397
|
petH: 'How chatty', annoyHint: 'How often it comments on what you do.', a0: 'Quiet', a1: 'A little', a2: 'Normal', a3: 'Chatty',
|
|
386
|
-
scH: 'Scenes between ots', scHint: 'When two ots share the desktop they meet now and then and act out a famous fight.', scVisitor: 'How often and which ones is set in the main ot\'s settings.', scOn: 'On', scEvery: { rare: 'Rarely', normal: 'Normal', often: 'Often' }, scPlay: '▶ Play one now', scPlayed: 'Done — it starts as soon as two ots are free.', scNames: { rocky: 'Rocky', sf: 'Street Fighter', dbz: 'Dragon Ball', matrix: 'Matrix', duel: 'Western duel', sw: 'Star Wars', fight: 'Fight & hug', twist: 'Twist' },
|
|
398
|
+
muH: 'Dances & music', muHint: 'Your ot dances to a beat it makes itself, or to your own songs. Entrance: it walks in like a wrestler with lights, fireworks and its name.', muMode: { synth: 'Built-in beat', files: 'My songs', off: 'Silent' }, muNone: 'Put .mp3/.ogg/.wav files in {dir} to use your own songs.', muSome: '{n} songs in {dir}', muDance: '▶ Dance', muEnter: '▶ Entrance', muDone: 'Here it goes!', scH: 'Scenes between ots', scHint: 'When two ots share the desktop they meet now and then and act out a famous fight.', scVisitor: 'How often and which ones is set in the main ot\'s settings.', scOn: 'On', scEvery: { rare: 'Rarely', normal: 'Normal', often: 'Often' }, scPlay: '▶ Play one now', scPlayed: 'Done — it starts as soon as two ots are free.', scNames: { rocky: 'Rocky', sf: 'Street Fighter', dbz: 'Dragon Ball', matrix: 'Matrix', duel: 'Western duel', sw: 'Star Wars', fight: 'Fight & hug', twist: 'Twist' },
|
|
387
399
|
view: 'Look:', v2d: '2D', v3d: '3D plush', viewNext: 'Changed — the ot switches right away.',
|
|
388
400
|
notesH: 'What it knows about you', notesHint: 'Its notes. Tell it “remember that…” to add one.', noNotes: 'Nothing yet.', forget: 'Forget', forgetAll: 'Forget everything', sure: 'Click again to forget everything',
|
|
389
401
|
remH: 'Processes', remHint: 'What {name} is doing for you: reminders, alerts and the programs it’s waiting on. Ask it “remind me…”, “let me know if BTC reaches 85k” or “tell me when the build finishes”.', infTotal: 'Last {n} calls: {in} in → {out} out · {all} tokens', petRuns: 'What {name} is running', pcRuns: 'On this computer', refreshPs: 'Refresh', noRems: 'Nothing pending: no reminders or alerts.', psOff: '{name} can’t see your programs. Turn on “Processes and apps” to list them and let it wait for one to finish.', psOn: 'Turn on', screenEvery: 'Looks at your screen every {n} min', lastSeen: 'last: {what}', priceW: '{coin} {op} {value} {vs}', priceNow: 'now {p}', procW: '“{m}” {until}', untilExit: 'when it ends', untilStart: 'when it starts', running: 'running', notRunning: 'not running', remind: 'Reminder', cpu: 'CPU', mem: 'Mem', up: 'Up', prog: 'Program', cancel: 'Cancel',
|
|
@@ -417,7 +429,7 @@
|
|
|
417
429
|
notify: 'Notificaciones', notifyD: 'Una notificación de escritorio cuando suena un recordatorio.',
|
|
418
430
|
soon: 'próximamente', screen: 'Ver tu pantalla', screenD: 'Mirar lo que tienes abierto para ayudarte.', procs: 'Procesos y apps', procsD: 'Ver qué programas corren (nombre, CPU, memoria) y esperar a que uno termine. Los argumentos que parecen claves se ocultan.', inbox: 'Leer correo y calendario', inboxD: 'Resúmenes y respuestas, no solo abrir la pestaña.',
|
|
419
431
|
petH: 'Cuánto habla', annoyHint: 'Qué tan seguido comenta lo que haces.', a0: 'Callado', a1: 'Poco', a2: 'Normal', a3: 'Charlatán',
|
|
420
|
-
scH: 'Escenas entre ots', scHint: 'Cuando dos ots comparten el escritorio, cada tanto se juntan y actúan una pelea famosa.', scVisitor: 'Cada cuánto y cuáles se ajusta en los ajustes del ot principal.', scOn: 'Activadas', scEvery: { rare: 'Poco', normal: 'Normal', often: 'Seguido' }, scPlay: '▶ Jugar una ahora', scPlayed: 'Listo: empieza apenas haya dos ots libres.', scNames: { rocky: 'Rocky', sf: 'Street Fighter', dbz: 'Dragon Ball', matrix: 'Matrix', duel: 'Duelo', sw: 'Star Wars', fight: 'Pelea y abrazo', twist: 'Twist' },
|
|
432
|
+
muH: 'Bailes y música', muHint: 'Tu ot baila con un ritmo que arma solo, o con tus propias canciones. Entrada: llega como luchador, con luces, fuegos y su nombre.', muMode: { synth: 'Ritmo propio', files: 'Mis canciones', off: 'Sin música' }, muNone: 'Pon archivos .mp3/.ogg/.wav en {dir} para usar tus canciones.', muSome: '{n} canciones en {dir}', muDance: '▶ Bailar', muEnter: '▶ Entrada', muDone: '¡Ahí va!', scH: 'Escenas entre ots', scHint: 'Cuando dos ots comparten el escritorio, cada tanto se juntan y actúan una pelea famosa.', scVisitor: 'Cada cuánto y cuáles se ajusta en los ajustes del ot principal.', scOn: 'Activadas', scEvery: { rare: 'Poco', normal: 'Normal', often: 'Seguido' }, scPlay: '▶ Jugar una ahora', scPlayed: 'Listo: empieza apenas haya dos ots libres.', scNames: { rocky: 'Rocky', sf: 'Street Fighter', dbz: 'Dragon Ball', matrix: 'Matrix', duel: 'Duelo', sw: 'Star Wars', fight: 'Pelea y abrazo', twist: 'Twist' },
|
|
421
433
|
view: 'Aspecto:', v2d: '2D', v3d: 'Peluche 3D', viewNext: 'Listo: el ot cambia al instante.',
|
|
422
434
|
notesH: 'Lo que sabe de ti', notesHint: 'Sus notas. Dile “anota que…” para agregar una.', noNotes: 'Nada todavía.', forget: 'Olvidar', forgetAll: 'Olvidar todo', sure: 'Haz clic otra vez para olvidar todo',
|
|
423
435
|
remH: 'Procesos', remHint: 'Lo que {name} está haciendo por ti: recordatorios, alertas y los programas que está esperando. Pídele “recuérdame…”, “avísame si BTC llega a 85 mil” o “avísame cuando termine el build”.', infTotal: 'Últimas {n} llamadas: {in} entrada → {out} salida · {all} tokens', petRuns: 'Lo que {name} tiene corriendo', pcRuns: 'En este computador', refreshPs: 'Actualizar', noRems: 'Nada pendiente: sin recordatorios ni alertas.', psOff: '{name} no ve tus programas. Activa “Procesos y apps” para listarlos y que pueda esperar a que uno termine.', psOn: 'Activar', screenEvery: 'Mira tu pantalla cada {n} min', lastSeen: 'última: {what}', priceW: '{coin} {op} {value} {vs}', priceNow: 'ahora {p}', procW: '“{m}” {until}', untilExit: 'cuando termine', untilStart: 'cuando empiece', running: 'corriendo', notRunning: 'no está corriendo', remind: 'Recordatorio', cpu: 'CPU', mem: 'Mem', up: 'Hace', prog: 'Programa', cancel: 'Cancelar',
|
|
@@ -451,7 +463,7 @@
|
|
|
451
463
|
notify: 'Notificações', notifyD: 'Uma notificação na área de trabalho quando um lembrete toca.',
|
|
452
464
|
soon: 'em breve', screen: 'Ver sua tela', screenD: 'Olhar o que está aberto para ajudar.', procs: 'Processos e apps', procsD: 'Ver quais programas rodam (nome, CPU, memória) e esperar um terminar. Argumentos que parecem chaves ficam ocultos.', inbox: 'Ler e-mail e agenda', inboxD: 'Resumos e respostas, não só abrir a aba.',
|
|
453
465
|
petH: 'Quanto fala', annoyHint: 'Com que frequência comenta o que você faz.', a0: 'Calado', a1: 'Pouco', a2: 'Normal', a3: 'Tagarela',
|
|
454
|
-
scH: 'Cenas entre ots', scHint: 'Quando dois ots dividem a área de trabalho, de vez em quando se encontram e encenam uma luta famosa.', scVisitor: 'Frequência e quais se ajustam nas configurações do ot principal.', scOn: 'Ativadas', scEvery: { rare: 'Pouco', normal: 'Normal', often: 'Frequente' }, scPlay: '▶ Jogar uma agora', scPlayed: 'Pronto: começa assim que houver dois ots livres.', scNames: { rocky: 'Rocky', sf: 'Street Fighter', dbz: 'Dragon Ball', matrix: 'Matrix', duel: 'Duelo', sw: 'Star Wars', fight: 'Briga e abraço', twist: 'Twist' },
|
|
466
|
+
muH: 'Danças e música', muHint: 'Seu ot dança com uma batida que ele mesmo cria, ou com suas músicas. Entrada: chega como lutador, com luzes, fogos e o nome dele.', muMode: { synth: 'Batida própria', files: 'Minhas músicas', off: 'Sem música' }, muNone: 'Coloque arquivos .mp3/.ogg/.wav em {dir} para usar suas músicas.', muSome: '{n} músicas em {dir}', muDance: '▶ Dançar', muEnter: '▶ Entrada', muDone: 'Lá vai!', scH: 'Cenas entre ots', scHint: 'Quando dois ots dividem a área de trabalho, de vez em quando se encontram e encenam uma luta famosa.', scVisitor: 'Frequência e quais se ajustam nas configurações do ot principal.', scOn: 'Ativadas', scEvery: { rare: 'Pouco', normal: 'Normal', often: 'Frequente' }, scPlay: '▶ Jogar uma agora', scPlayed: 'Pronto: começa assim que houver dois ots livres.', scNames: { rocky: 'Rocky', sf: 'Street Fighter', dbz: 'Dragon Ball', matrix: 'Matrix', duel: 'Duelo', sw: 'Star Wars', fight: 'Briga e abraço', twist: 'Twist' },
|
|
455
467
|
view: 'Visual:', v2d: '2D', v3d: 'Pelúcia 3D', viewNext: 'Pronto: o ot muda na hora.',
|
|
456
468
|
notesH: 'O que ele sabe de você', notesHint: 'As notas dele. Diga “anote que…” para adicionar.', noNotes: 'Nada ainda.', forget: 'Esquecer', forgetAll: 'Esquecer tudo', sure: 'Clique de novo para esquecer tudo',
|
|
457
469
|
remH: 'Processos', remHint: 'O que {name} está fazendo por você: lembretes, alertas e os programas que está esperando. Peça “me lembre…”, “me avise se o BTC chegar a 85 mil” ou “me avise quando o build terminar”.', infTotal: 'Últimas {n} chamadas: {in} entrada → {out} saída · {all} tokens', petRuns: 'O que {name} está rodando', pcRuns: 'Neste computador', refreshPs: 'Atualizar', noRems: 'Nada pendente: sem lembretes nem alertas.', psOff: '{name} não vê seus programas. Ative “Processos e apps” para listá-los e esperar um terminar.', psOn: 'Ativar', screenEvery: 'Olha sua tela a cada {n} min', lastSeen: 'última: {what}', priceW: '{coin} {op} {value} {vs}', priceNow: 'agora {p}', procW: '“{m}” {until}', untilExit: 'quando terminar', untilStart: 'quando começar', running: 'rodando', notRunning: 'não está rodando', remind: 'Lembrete', cpu: 'CPU', mem: 'Mem', up: 'Há', prog: 'Programa', cancel: 'Cancelar',
|
|
@@ -1180,6 +1192,32 @@
|
|
|
1180
1192
|
}
|
|
1181
1193
|
});
|
|
1182
1194
|
|
|
1195
|
+
// ── dances and music (POST /dance, /entrance; songs from GET /music) ──
|
|
1196
|
+
function renderMusic() {
|
|
1197
|
+
const p = S.config.pet;
|
|
1198
|
+
const mode = p.music || 'synth';
|
|
1199
|
+
const put = (pet) => save({ pet }, $('#muMsg')).then(() => renderMusic());
|
|
1200
|
+
$('#muMode').replaceChildren(...['synth', 'files', 'off'].map((k) => {
|
|
1201
|
+
const r = el('input', { type: 'radio', name: 'muMode', value: k, checked: mode === k });
|
|
1202
|
+
r.addEventListener('change', () => put({ music: k }));
|
|
1203
|
+
return el('label', { className: 'chip' }, r, (T[lang].muMode || T.en.muMode)[k]);
|
|
1204
|
+
}));
|
|
1205
|
+
$('#muVol').value = p.musicVol ?? 0.5;
|
|
1206
|
+
$('#muVol').onchange = (e) => put({ musicVol: Number(e.target.value) });
|
|
1207
|
+
const n = (S.musicFiles || []).length;
|
|
1208
|
+
$('#muFiles').hidden = mode !== 'files';
|
|
1209
|
+
$('#muFiles').textContent = t(n ? 'muSome' : 'muNone', { n, dir: '~/.7ots/music' });
|
|
1210
|
+
}
|
|
1211
|
+
for (const [id, path] of [['#muDance', '/dance'], ['#muEnter', '/entrance']])
|
|
1212
|
+
$(id).addEventListener('click', async () => {
|
|
1213
|
+
try {
|
|
1214
|
+
await api(path, {});
|
|
1215
|
+
flash($('#muMsg'), t('muDone'));
|
|
1216
|
+
} catch (e) {
|
|
1217
|
+
flash($('#muMsg'), t('err', { e: e.message }), 'err');
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1220
|
+
|
|
1183
1221
|
// ── mods of its look (src/character/mods.js): previews drawn with the 7ots library ──
|
|
1184
1222
|
const modName = (m) => (m.name && typeof m.name === 'object' ? m.name[lang] || m.name.en || Object.values(m.name)[0] : m.name) || m.id;
|
|
1185
1223
|
const modViews = []; // previews 3D vivos (se destruyen al redibujar)
|
|
@@ -1850,6 +1888,7 @@
|
|
|
1850
1888
|
renderAccess();
|
|
1851
1889
|
renderPet();
|
|
1852
1890
|
renderScenes();
|
|
1891
|
+
renderMusic();
|
|
1853
1892
|
renderMods();
|
|
1854
1893
|
renderChar();
|
|
1855
1894
|
renderLang();
|