@7ots/cli 0.1.19 → 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/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 +59 -1
- package/cli/lib/account.mjs +23 -3
- package/cli/lib/assistant.mjs +88 -13
- package/cli/lib/brain.mjs +76 -8
- 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 +61 -6
- package/cli/lib/pet-server.mjs +316 -41
- package/cli/lib/prompts.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/vm.mjs +1 -1
- package/cli/lib/wake-local.py +109 -0
- package/cli/lib/wake.mjs +102 -0
- package/cli/pet/electron/main.cjs +137 -13
- package/cli/pet/pet.html +125 -26
- package/cli/pet/senses.html +342 -0
- package/cli/pet/settings.html +787 -86
- 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 +2 -0
- package/server/errors.mjs +90 -0
- package/server/notify.mjs +78 -0
- package/server/server.mjs +68 -12
- 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 +1 -1
- 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 +162 -0
- 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 +2 -1
- 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 +255 -1
- 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 -337
- package/server/platform/byte.mjs +0 -291
- package/server/platform/connect.mjs +0 -391
- package/server/platform/crypto.mjs +0 -80
- package/server/platform/db.mjs +0 -293
- package/server/platform/device.mjs +0 -247
- 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 -611
- package/server/platform/profile.mjs +0 -182
- package/server/platform/routes.mjs +0 -589
- package/server/platform/runtime.mjs +0 -286
- package/server/platform/sites.mjs +0 -146
- package/server/platform/stage3d.mjs +0 -82
- package/server/platform/store.mjs +0 -469
- package/server/platform/vm.mjs +0 -1057
- package/server/platform/wallet.mjs +0 -255
package/cli/pet/pet.html
CHANGED
|
@@ -40,13 +40,20 @@
|
|
|
40
40
|
.stage { position: relative; width: 168px; height: 176px; }
|
|
41
41
|
.face { position: relative; z-index: 1; width: 100%; height: 100%; transition: transform .3s; }
|
|
42
42
|
.floor { position: absolute; left: 50%; bottom: 2px; width: 110px; height: 14px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgb(0 0 0 / .18), transparent); }
|
|
43
|
-
.bubble { position: absolute; z-index:
|
|
43
|
+
.bubble { position: absolute; z-index: 4; /* above the 3D ot's canvas (z 3): under it the ot covered the bubble */ left: 50%; bottom: calc(100% - 4px); width: max-content; max-width: min(300px, 86vw); padding: 10px 14px; border-radius: 16px;
|
|
44
44
|
background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13.5px; line-height: 1.4; text-align: left;
|
|
45
45
|
opacity: 0; transform: translate(-50%, 6px) scale(.97); transform-origin: 50% 100%; transition: opacity .22s, transform .22s; pointer-events: none; }
|
|
46
|
+
/* farmeo de aura: el «+N aura» que sube sobre el ot (2D y 3D) con el total debajo */
|
|
47
|
+
.aurapop { position: absolute; z-index: 4; left: 50%; bottom: calc(100% - 10px); transform: translate(-50%, 0); pointer-events: none; text-align: center; white-space: nowrap; font-weight: 900; color: #7c3aed;
|
|
48
|
+
text-shadow: 0 0 2px #fff, 0 0 6px #fff, 0 0 14px #c4b5fd; animation: aurapop 2.6s ease-out forwards; }
|
|
49
|
+
.aurapop b { display: block; font-size: 22px; letter-spacing: -.02em; }
|
|
50
|
+
.aurapop small { font-size: 11px; font-weight: 750; opacity: .85; }
|
|
51
|
+
@keyframes aurapop { 0% { opacity: 0; transform: translate(-50%, 12px) scale(.8); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -38px) scale(1); } }
|
|
46
52
|
.bubble.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
|
|
47
53
|
.bubble::after { content: ''; position: absolute; left: 50%; top: 100%; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: inherit; border: inherit; border-width: 0 1px 1px 0; transform: rotate(45deg); }
|
|
48
54
|
.bubble.asking { pointer-events: auto; -webkit-app-region: no-drag; border-color: var(--accent); }
|
|
49
55
|
.bubble .q { display: block; margin-bottom: 8px; }
|
|
56
|
+
.bubble .shot { display: block; width: 132px; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; margin-bottom: 6px; border: 1px solid var(--line); } /* what it saw when you asked it to look at you */
|
|
50
57
|
.bubble .yn { display: flex; gap: 6px; justify-content: flex-end; }
|
|
51
58
|
.bubble .yn button { font: inherit; font-size: 12.5px; font-weight: 650; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
|
|
52
59
|
.bubble .yn button.ok { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
|
|
@@ -133,6 +140,7 @@
|
|
|
133
140
|
/* the 3D ot is framed with room under its feet (~34px at 1x) that grows with the stretch: the figure is drawn
|
|
134
141
|
lower by what that room grew, so a bigger ot still stands where it stood; the stage (hit area) stays put */
|
|
135
142
|
body.desktop.ot3d .face { top: calc(34px * (var(--pet-scale, 1) - 1)); }
|
|
143
|
+
body.desktop.ot3d .bubble { bottom: calc(100% + 8px); } /* the 3D head reaches the stage's top edge */
|
|
136
144
|
/* scenes with other ots (electron/director.cjs): the acts move .act; props (fireballs, beams, sabers, bullets) */
|
|
137
145
|
.actor { position: absolute; inset: 0; z-index: 1; transform-origin: 50% 92%; }
|
|
138
146
|
.props { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: visible; }
|
|
@@ -151,22 +159,27 @@
|
|
|
151
159
|
.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); }
|
|
152
160
|
.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)); }
|
|
153
161
|
.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; }
|
|
154
|
-
/* a visiting ot: its own little menu (play, say goodbye, settings
|
|
162
|
+
/* a visiting ot: its own little menu (play, say goodbye, settings); feeding, talking and sleep are the host's */
|
|
155
163
|
body.guest .ask, body.guest #gameBtn, body:not(.desktop) #gameBtn, body.guest #talkBtn, body.guest #micBtn, body.guest #sleepBtn { display: none !important; }
|
|
156
164
|
.bye { display: none; }
|
|
157
165
|
body.desktop.guest .bye { display: flex; }
|
|
158
166
|
body.desktop .bubble { max-width: 220px; font-size: 12.5px; padding: 8px 12px; }
|
|
159
|
-
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:
|
|
167
|
+
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: grid; grid-template-columns: repeat(2, 30px); gap: 3px; padding: 4px; /* two columns: one ran taller than the ot */ border-radius: 18px;
|
|
160
168
|
background: color-mix(in srgb, var(--panel) 86%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px);
|
|
161
169
|
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) */
|
|
162
170
|
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) */
|
|
163
|
-
|
|
171
|
+
/* part of the window off screen (the shell sets --off-below / .menu-left): the menu stays in view */
|
|
172
|
+
body.desktop .actions { bottom: calc(14px + var(--off-below, 0px)); }
|
|
173
|
+
body.desktop.menu-left .actions { left: auto; right: calc(50% + 70px * var(--pet-scale, 1) - 4px); transform: translateX(-6px); }
|
|
174
|
+
body.desktop.menu-left.hover .actions, body.desktop.menu-left.menu .actions { transform: none; }
|
|
175
|
+
body.desktop .act { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 0; background: transparent; }
|
|
164
176
|
body.desktop .act span { display: none; }
|
|
165
|
-
.grip { display: none; }
|
|
166
|
-
body.desktop .grip { display: flex; cursor: grab; touch-action: none; }
|
|
167
|
-
body.desktop .grip:active { cursor: grabbing; }
|
|
168
177
|
body.desktop .act.primary { background: var(--accent); }
|
|
169
178
|
body.desktop .badge { display: flex; }
|
|
179
|
+
/* "oye <name>" is on: a small ear that shows the mic is being read for the wake word */
|
|
180
|
+
.wakeDot { display: none; position: absolute; z-index: 2; right: -4px; bottom: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); opacity: .75; pointer-events: none; }
|
|
181
|
+
body.wakeword .wakeDot { display: block; }
|
|
182
|
+
body.wakeword.listening .wakeDot { background: var(--err); opacity: 1; }
|
|
170
183
|
body.listening #micBtn { background: var(--err); color: #fff; animation: rec 1s ease-in-out infinite; }
|
|
171
184
|
@keyframes rec { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--err) 30%, transparent); } }
|
|
172
185
|
body.desktop .ask { display: none; position: absolute; left: 6px; right: 6px; top: 6px; margin: 0; z-index: 4; -webkit-app-region: no-drag; }
|
|
@@ -178,6 +191,15 @@
|
|
|
178
191
|
body.desktop.opaque { background: var(--panel); }
|
|
179
192
|
|
|
180
193
|
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
|
|
194
|
+
/* senses: the camera is on (a small eye, like a webcam light) and what a gesture did */
|
|
195
|
+
.eye { position: absolute; z-index: 2; right: 2px; top: 6px; display: none; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 99px; font: 600 11px/1.4 var(--font, system-ui); background: color-mix(in srgb, var(--panel, #fff) 85%, transparent); color: var(--muted, #8a8399); box-shadow: 0 1px 3px rgb(0 0 0 / .15); pointer-events: none; }
|
|
196
|
+
.eye.on { display: inline-flex; }
|
|
197
|
+
/* desktop: centered over its head and above the 3D canvas (z 3), not in a corner the ot covers; a bubble moves up over it */
|
|
198
|
+
body.desktop .eye { z-index: 4; right: auto; left: 50%; top: auto; bottom: calc(100% + 2px); transform: translateX(-50%); white-space: nowrap; }
|
|
199
|
+
body.desktop .stage:has(.eye.on) .bubble { bottom: calc(100% + 30px); }
|
|
200
|
+
.eye::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #e5484d; }
|
|
201
|
+
.eye.paused::before { background: var(--muted, #8a8399); }
|
|
202
|
+
.eye.armed { color: #fff; background: #6d5dfc; }
|
|
181
203
|
</style>
|
|
182
204
|
</head>
|
|
183
205
|
<body>
|
|
@@ -196,6 +218,8 @@
|
|
|
196
218
|
<div class="props" id="props" aria-hidden="true"></div>
|
|
197
219
|
<div class="floor" aria-hidden="true"></div>
|
|
198
220
|
<span class="badge" id="badge"></span>
|
|
221
|
+
<span class="wakeDot" id="wakeDot"></span>
|
|
222
|
+
<span class="eye" id="eye" aria-live="polite"></span>
|
|
199
223
|
</div>
|
|
200
224
|
<form class="ask" id="ask" autocomplete="off"><input id="askIn" maxlength="800" enterkeyhint="send"></form>
|
|
201
225
|
<div class="who">
|
|
@@ -217,10 +241,10 @@
|
|
|
217
241
|
<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>
|
|
218
242
|
<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>
|
|
219
243
|
<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>
|
|
244
|
+
<button class="act" id="auraBtn" type="button"><svg viewBox="0 0 24 24"><path d="M12 21c-4 0-6.5-2.6-6.5-6 0-3.5 3-5.5 3.5-9 2 1.5 3 3.5 3 5.5 1-.8 1.6-2 1.8-3.4 2.2 1.8 3.7 4.3 3.7 6.9 0 3.4-2.5 6-5.5 6z"/><path d="M12 21c-1.6 0-2.6-1.1-2.6-2.6 0-1.6 1.3-2.4 1.6-3.9 1.3.9 2.2 2 2.2 3.4.6-.3.9-.8 1-1.4.4.6.4 1.3.4 1.9 0 1.5-1.1 2.6-2.6 2.6z"/></svg><span data-t="aura"></span></button>
|
|
220
245
|
<button class="act" id="gameBtn" type="button"><svg viewBox="0 0 24 24"><path d="M7 8.5h10a4 4 0 0 1 4 4v1.5a3 3 0 0 1-5.4 1.8L14.5 14h-5l-1.1 1.8A3 3 0 0 1 3 14v-1.5a4 4 0 0 1 4-4z"/><path d="M7.5 11v2.5M6.25 12.25h2.5"/></svg><span data-t="game"></span></button>
|
|
221
246
|
<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>
|
|
222
247
|
<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>
|
|
223
|
-
<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>
|
|
224
248
|
</nav>
|
|
225
249
|
|
|
226
250
|
<section class="feed" aria-labelledby="feed-h">
|
|
@@ -234,17 +258,17 @@
|
|
|
234
258
|
<script type="module">
|
|
235
259
|
const BOOT = __BOOT__;
|
|
236
260
|
const T = {
|
|
237
|
-
en: { game: 'Play byte', dance: 'Dance', settings: 'Settings', card: 'Card', 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',
|
|
261
|
+
en: { wakeOn: 'Say “hey {name}” and I listen', game: 'Play byte', dance: 'Dance', aura: 'Farm aura', settings: 'Settings', card: 'Card', 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',
|
|
238
262
|
activity: 'Activity', empty: 'Nothing yet. Run a command or ask your coding agent something.', tally: '{ok} ok · {fail} failed · turns {turns}',
|
|
239
263
|
brain: 'Brain: {b}', age: 'Born {d}', lines: 'built-in phrases', now: 'now', m: '{n}m', h: '{n}h',
|
|
240
264
|
moods: { happy: 'Happy', neutral: 'Calm', sad: 'Sad', disgust: 'Bored', sleep: 'Asleep', thinking: 'Thinking' },
|
|
241
265
|
kind: { tool: 'Tool', shell: 'Shell', prompt: 'You asked', stop: 'Turn finished', notify: 'Needs you', start: 'Session started' } },
|
|
242
|
-
es: { game: 'Jugar byte', dance: 'Bailar', settings: 'Ajustes', card: 'Tarjeta', 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',
|
|
266
|
+
es: { wakeOn: 'Di “oye {name}” y te escucho', game: 'Jugar byte', dance: 'Bailar', aura: 'Farmear aura', settings: 'Ajustes', card: 'Tarjeta', 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',
|
|
243
267
|
activity: 'Actividad', empty: 'Nada todavía. Ejecuta un comando o pregúntale algo a tu agente.', tally: '{ok} ok · {fail} fallos · turnos {turns}',
|
|
244
268
|
brain: 'Cerebro: {b}', age: 'Nació {d}', lines: 'frases propias', now: 'ahora', m: '{n} min', h: '{n} h',
|
|
245
269
|
moods: { happy: 'Feliz', neutral: 'Tranquilo', sad: 'Triste', disgust: 'Aburrido', sleep: 'Dormido', thinking: 'Pensando' },
|
|
246
270
|
kind: { tool: 'Herramienta', shell: 'Terminal', prompt: 'Preguntaste', stop: 'Turno terminado', notify: 'Te necesita', start: 'Sesión iniciada' } },
|
|
247
|
-
pt: { game: 'Jogar byte', dance: 'Dançar', settings: 'Ajustes', card: 'Carta', 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',
|
|
271
|
+
pt: { wakeOn: 'Diga “ei {name}” e eu ouço', game: 'Jogar byte', dance: 'Dançar', aura: 'Farmar aura', settings: 'Ajustes', card: 'Carta', 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',
|
|
248
272
|
activity: 'Atividade', empty: 'Nada ainda. Rode um comando ou pergunte algo ao seu agente.', tally: '{ok} ok · {fail} falhas · turnos {turns}',
|
|
249
273
|
brain: 'Cérebro: {b}', age: 'Nasceu {d}', lines: 'frases próprias', now: 'agora', m: '{n} min', h: '{n} h',
|
|
250
274
|
moods: { happy: 'Feliz', neutral: 'Tranquilo', sad: 'Triste', disgust: 'Entediado', sleep: 'Dormindo', thinking: 'Pensando' },
|
|
@@ -277,14 +301,14 @@
|
|
|
277
301
|
$('#brain').innerHTML = '';
|
|
278
302
|
$('#brain').append(t('brain', { b: '' }), Object.assign(document.createElement('b'), { textContent: BOOT.brain === 'lines' ? t('lines') : BOOT.brain }));
|
|
279
303
|
|
|
280
|
-
const { createCharacter, loadCharacter3D, playBeat, DANCES = [], DANCE_STYLE = {} } = await import('/dist/7ots.esm.js');
|
|
304
|
+
const { createCharacter, loadCharacter3D, playBeat, DANCES = [], DANCE_STYLE = {}, AURA_MOVES = [], AURA_STYLE = {} } = await import('/dist/7ots.esm.js');
|
|
281
305
|
const spec = id.look?.character || {};
|
|
282
306
|
let ch = null;
|
|
283
307
|
if (new URLSearchParams(location.search).has('3d')) {
|
|
284
308
|
// three comes from the CDN; without WebGL or network the 2D ot takes over
|
|
285
309
|
try {
|
|
286
310
|
const m = await loadCharacter3D();
|
|
287
|
-
ch = m.createCharacter3D($('#face'), spec, { material: 'plush', backdrop: !desktop && BOOT.backdrop !== false, orbit: !desktop, bleed: desktop ? 'window' : 0, stage: { key: 'pet', zIndex: 3, maxDpr: 2, minDpr: 1.25, supersample: desktop } });
|
|
311
|
+
ch = m.createCharacter3D($('#face'), spec, { material: id.look?.material || 'plush', backdrop: !desktop && BOOT.backdrop !== false, orbit: !desktop, bleed: desktop ? 'window' : 0, stage: { key: 'pet', zIndex: 3, maxDpr: 2, minDpr: 1.25, supersample: desktop } });
|
|
288
312
|
if (ch.fallback) console.warn('[7ots pet] no WebGL: 2D ot');
|
|
289
313
|
} catch (err) {
|
|
290
314
|
console.warn('[7ots pet] 3D ot unavailable, using 2D:', err?.message || err);
|
|
@@ -338,11 +362,11 @@
|
|
|
338
362
|
const b = $('#bubble');
|
|
339
363
|
if (b.classList.contains('on')) {
|
|
340
364
|
w = Math.max(w, b.offsetWidth + 24);
|
|
341
|
-
h = Math.max(h, st.height +
|
|
365
|
+
h = Math.max(h, st.height + 18 + b.offsetHeight + 16); // 18: lifted over the 3D head
|
|
342
366
|
}
|
|
343
367
|
if (document.body.classList.contains('talking')) (w = Math.max(w, 240)), (h = Math.max(h, st.height + 60));
|
|
344
368
|
if (Date.now() < actUntil) (w = Math.max(w, actRoom * 2)), (h = Math.max(h, st.height + actTall));
|
|
345
|
-
w = Math.max(w, st.width + 2 *
|
|
369
|
+
w = Math.max(w, st.width + 2 * 82); // the menu beside it (shown on hover, two columns)
|
|
346
370
|
return { w: Math.ceil(w), h: Math.ceil(h) };
|
|
347
371
|
};
|
|
348
372
|
// The shell polls __need every 250 ms; when an effect starts it's told at once (a console line it listens
|
|
@@ -414,14 +438,13 @@
|
|
|
414
438
|
});
|
|
415
439
|
// on the document: in 3D the ot is drawn on a canvas above the page, so events don't target #stage
|
|
416
440
|
addEventListener('pointerdown', (e) => {
|
|
417
|
-
// on the ot itself
|
|
418
|
-
|
|
419
|
-
if (e.button !== 0 || (!grip && (e.target.closest?.('.actions, .ask, a, button') || !onOt(e)))) return;
|
|
441
|
+
// on the ot itself
|
|
442
|
+
if (e.button !== 0 || e.target.closest?.('.actions, .ask, a, button') || !onOt(e)) return;
|
|
420
443
|
down = true;
|
|
421
444
|
document.documentElement.setPointerCapture?.(e.pointerId);
|
|
422
|
-
const c =
|
|
445
|
+
const c = cornerAt(e);
|
|
423
446
|
if (c) sizing = { c, x: e.screenX, y: e.screenY, k: scale };
|
|
424
|
-
else
|
|
447
|
+
else {
|
|
425
448
|
const r = $('#stage').getBoundingClientRect();
|
|
426
449
|
const side = Math.abs(e.clientX - (r.left + r.width / 2)) / r.width > Math.abs(e.clientY - (r.top + r.height / 2)) / r.height;
|
|
427
450
|
pulled = { m: side ? 'squish' : 'stretch', on: false };
|
|
@@ -662,10 +685,24 @@
|
|
|
662
685
|
}
|
|
663
686
|
// speech tags ([laugh], <whisper>…: settings → Voice → expressions) go to the voice, never to the bubble (as src/voice/tags.js)
|
|
664
687
|
const clean = (t) => String(t ?? '').replace(/<\/?(loud|soft|whisper|fast|slow|singing)>/gi, '').replace(/\s*\[(pause|long-pause|laugh|cry|mouth-click|breath|sigh)\]\s*/gi, ' ').replace(/\s{2,}/g, ' ').trim();
|
|
665
|
-
function say(raw, withFace = false, ambient = false) {
|
|
688
|
+
function say(raw, withFace = false, ambient = false, photo = null) {
|
|
666
689
|
if (ambient && speak.cur && speak.reply) return void alog('skip ambient (an answer is playing)'); // small talk waits for the answer to finish
|
|
667
690
|
const text = clean(raw);
|
|
668
|
-
|
|
691
|
+
let content = document.createTextNode(text);
|
|
692
|
+
if (photo && desktop) console.debug('\u00a77photo' + JSON.stringify({ photo })); // the shell opens it in a window beside the ot; the words stay in the bubble
|
|
693
|
+
else if (photo) {
|
|
694
|
+
// the frame it looked at (asked for: "¿cómo me ves?"), only in this bubble, never saved
|
|
695
|
+
const img = new Image();
|
|
696
|
+
img.className = 'shot';
|
|
697
|
+
img.alt = '';
|
|
698
|
+
img.onload = tellNeed;
|
|
699
|
+
img.src = photo;
|
|
700
|
+
const box = document.createElement('div');
|
|
701
|
+
box.append(img, content);
|
|
702
|
+
content = box;
|
|
703
|
+
}
|
|
704
|
+
showBubble(content, Math.max(photo && !desktop ? 12000 : 4500, text.length * 90));
|
|
705
|
+
tellNeed();
|
|
669
706
|
talk(true, text); // the mouth moves with the words even without a voice; a real voice re-syncs it
|
|
670
707
|
clearTimeout(say.t);
|
|
671
708
|
say.t = setTimeout(() => talk(false), 500 + text.length * 60);
|
|
@@ -757,17 +794,39 @@
|
|
|
757
794
|
if (m.ask) ask4(m.ask); // before thinking: an approved ask hands the bubble back to the dots
|
|
758
795
|
if ('thinking' in m) setThinking(!!m.thinking);
|
|
759
796
|
if (m.activity) addActivity(m.activity);
|
|
797
|
+
if (m.senses) senses(m.senses);
|
|
798
|
+
if (m.wakeState) wakeShow(m.wakeState);
|
|
799
|
+
if (m.wake && !rec) (hush(), stir(), listen()); // "oye <name>": it stops talking and listens
|
|
760
800
|
// asleep (and not stirred by something you asked for): no moving, gestures or talking
|
|
761
|
-
if (asleep && Date.now() >= stirUntil && Date.now() - sleptAt > 15000) return void (m.dance
|
|
801
|
+
if (asleep && Date.now() >= stirUntil && Date.now() - sleptAt > 15000) return void (m.dance ? dance(m.dance) : m.aura && aura(m.aura));
|
|
762
802
|
if (m.gesture) ch.gesture(m.gesture);
|
|
763
803
|
if (m.morph) ch.morph?.(m.morph);
|
|
764
804
|
if (m.effect) ch.effect?.(m.effect);
|
|
765
|
-
if (m.say) alog(`got say${m.ambient ? ' (ambient)' : ''} «${clean(m.say).slice(0, 40)}»`), say(m.say, !m.gesture, !!m.ambient);
|
|
805
|
+
if (m.say) alog(`got say${m.ambient ? ' (ambient)' : ''} «${clean(m.say).slice(0, 40)}»`), say(m.say, !m.gesture, !!m.ambient, /^data:image\/jpeg;base64,/.test(m.photo || '') ? m.photo : null);
|
|
766
806
|
if (m.dance) dance(m.dance);
|
|
807
|
+
if (m.aura) aura(m.aura);
|
|
767
808
|
if (m.entrance) entrance(m.entrance);
|
|
768
809
|
if (m.point && desktop) window.__goal = m.point; // the desktop shell walks it over there
|
|
769
810
|
};
|
|
770
811
|
}
|
|
812
|
+
// ── senses (camera on, a gesture seen, what it did): a small chip on the stage, never a spoken line ──
|
|
813
|
+
const eye = $('#eye');
|
|
814
|
+
let eyeT = 0;
|
|
815
|
+
const GLYPH = { thumb_up: '👍', thumb_down: '👎', open_palm: '✋', closed_fist: '✊', victory: '✌️', pointing_up: '☝️', iloveyou: '🤟' };
|
|
816
|
+
function senses(s) {
|
|
817
|
+
if (s.camera) {
|
|
818
|
+
eye.classList.toggle('on', s.camera === 'on' || s.camera === 'paused');
|
|
819
|
+
eye.classList.toggle('paused', s.camera === 'paused');
|
|
820
|
+
eye.textContent = '';
|
|
821
|
+
}
|
|
822
|
+
if (!s.gesture && !s.hint) return;
|
|
823
|
+
eye.classList.add('on');
|
|
824
|
+
eye.classList.toggle('armed', Boolean(s.armed));
|
|
825
|
+
eye.textContent = [GLYPH[s.gesture] || '', s.did || '', s.hint || ''].filter(Boolean).join(' ');
|
|
826
|
+
clearTimeout(eyeT);
|
|
827
|
+
eyeT = setTimeout(() => (eye.classList.remove('armed'), (eye.textContent = ''), s.camera === 'paused' && eye.classList.remove('on')), s.armed ? Math.max(1500, s.armed - Date.now()) : 2500);
|
|
828
|
+
}
|
|
829
|
+
|
|
771
830
|
live.textContent = t('off');
|
|
772
831
|
connect();
|
|
773
832
|
|
|
@@ -819,6 +878,7 @@
|
|
|
819
878
|
|
|
820
879
|
// ── voice: record until you stop talking, transcribe (/stt), then it's like typing it (/ask) ──
|
|
821
880
|
let rec = null;
|
|
881
|
+
let lastVoice = { norm: '', at: 0 };
|
|
822
882
|
async function listen() {
|
|
823
883
|
if (rec) return rec.state === 'recording' && rec.stop();
|
|
824
884
|
if (!BOOT.stt) return say(t('noStt'));
|
|
@@ -841,13 +901,17 @@
|
|
|
841
901
|
let heard = false;
|
|
842
902
|
let quiet = t0;
|
|
843
903
|
let peak = 0;
|
|
904
|
+
// A fan or a noisy room sits above any fixed level: speech is measured against the room's own floor
|
|
905
|
+
// (the quietest it has been, rising slowly), so the pause after you talk is still a pause.
|
|
906
|
+
let floor = Infinity;
|
|
844
907
|
const iv = setInterval(() => {
|
|
845
908
|
an.getFloatTimeDomainData(buf);
|
|
846
909
|
let sum = 0;
|
|
847
910
|
for (const x of buf) sum += x * x;
|
|
848
911
|
const now = Date.now();
|
|
849
912
|
const level = Math.sqrt(sum / buf.length);
|
|
850
|
-
|
|
913
|
+
floor = Math.min(level, floor === Infinity ? level : floor * 1.002);
|
|
914
|
+
if (level > Math.max(0.015, floor * 3)) (heard = true), (quiet = now);
|
|
851
915
|
peak = Math.max(peak, level);
|
|
852
916
|
// stops after 1.3 s of silence, 6 s without a word, or 15 s in all
|
|
853
917
|
if ((heard && now - quiet > 1300) || (!heard && now - t0 > 6000) || now - t0 > 15000) rec?.state === 'recording' && rec.stop();
|
|
@@ -858,7 +922,7 @@
|
|
|
858
922
|
ac.close().catch(() => {});
|
|
859
923
|
rec = null;
|
|
860
924
|
document.body.classList.remove('listening');
|
|
861
|
-
console.log('[7ots voice] stopped', { heard, peak: peak.toFixed(3), chunks: chunks.length, ms: Date.now() - t0 });
|
|
925
|
+
console.log('[7ots voice] stopped', JSON.stringify({ heard, peak: +peak.toFixed(3), floor: +floor.toFixed(4), chunks: chunks.length, ms: Date.now() - t0 }));
|
|
862
926
|
if (!chunks.length) return bubble.classList.remove('on');
|
|
863
927
|
if (!heard && peak < 0.004) return say(t('noMic')); // silence all along: wrong or muted microphone
|
|
864
928
|
setThinking(true);
|
|
@@ -870,6 +934,10 @@
|
|
|
870
934
|
const text = r?.text?.trim();
|
|
871
935
|
if (!text) return say(r?.error && !/stt/.test(r.error) ? t('noStt') : t('sttErr'));
|
|
872
936
|
showBubble(document.createTextNode(`🎙️ “${text}”`), 2500);
|
|
937
|
+
// said again while the first one was still transcribing ("escuchas" … "Escuchas."): answer once
|
|
938
|
+
const norm = text.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, ' ').trim();
|
|
939
|
+
if (norm === lastVoice.norm && Date.now() - lastVoice.at < 20000) return;
|
|
940
|
+
lastVoice = { norm, at: Date.now() };
|
|
873
941
|
post('/ask', { text });
|
|
874
942
|
};
|
|
875
943
|
rec.onerror = (e) => console.warn('[7ots voice] recorder', e.error?.message || e);
|
|
@@ -885,6 +953,11 @@
|
|
|
885
953
|
ch.lookAt(0, 0);
|
|
886
954
|
}
|
|
887
955
|
$('#micBtn').addEventListener('click', listen);
|
|
956
|
+
function wakeShow(w) {
|
|
957
|
+
document.body.classList.toggle('wakeword', w.state === 'on');
|
|
958
|
+
$('#wakeDot').title = w.state === 'on' ? t('wakeOn', { name: BOOT.identity?.name || '' }) : '';
|
|
959
|
+
}
|
|
960
|
+
if (BOOT.wake) wakeShow(BOOT.wake);
|
|
888
961
|
|
|
889
962
|
// The desktop shell tells us how we move: facing (walk -1..1), hops, being dropped, following, the cursor.
|
|
890
963
|
addEventListener('message', (e) => {
|
|
@@ -982,6 +1055,7 @@
|
|
|
982
1055
|
requestAnimationFrame(() => ACTS[d.act](d.dir || 1, d));
|
|
983
1056
|
}
|
|
984
1057
|
if (d.dance) dance(d.dance);
|
|
1058
|
+
if (d.aura) aura(d.aura);
|
|
985
1059
|
if (d.entrance) entrance(d.entrance);
|
|
986
1060
|
if (d.face != null) {
|
|
987
1061
|
if (is3d) ch.character.yaw = -d.face * 0.9;
|
|
@@ -1033,6 +1107,27 @@
|
|
|
1033
1107
|
ch.gesture(name, { ms });
|
|
1034
1108
|
music(d.music, ms, DANCE_STYLE[name]);
|
|
1035
1109
|
}
|
|
1110
|
+
// farmeo de aura (POST /aura; `7ots aura`, su botón): no es un baile. Su pose de meme, su música (phonk o
|
|
1111
|
+
// montagem, o tus temas de ~/.7ots/music/aura) y el «+N aura» con el total que lleva este ot
|
|
1112
|
+
function aura(d = {}) {
|
|
1113
|
+
if (asleep) stir();
|
|
1114
|
+
const name = AURA_MOVES.includes(d.name) ? d.name : AURA_MOVES.length ? any(AURA_MOVES) : 'celebrate';
|
|
1115
|
+
const ms = Math.max(1500, Math.min(60000, Number(d.ms) || 8000));
|
|
1116
|
+
danceEnd = Date.now() + ms;
|
|
1117
|
+
ch.gesture(name, { ms });
|
|
1118
|
+
music(d.music, ms, AURA_STYLE[name] || 'phonk');
|
|
1119
|
+
if (!(d.points > 0)) return;
|
|
1120
|
+
const pop = () => {
|
|
1121
|
+
const el = document.createElement('div');
|
|
1122
|
+
el.className = 'aurapop';
|
|
1123
|
+
const fmt = (n) => Math.round(n).toLocaleString('en-US');
|
|
1124
|
+
el.innerHTML = `<b>+${fmt(d.points)} aura</b>${d.total > 0 ? `<small>${fmt(d.total)}</small>` : ''}`;
|
|
1125
|
+
$('#stage').append(el);
|
|
1126
|
+
setTimeout(() => el.remove(), 2700);
|
|
1127
|
+
};
|
|
1128
|
+
pop();
|
|
1129
|
+
setTimeout(() => Date.now() < danceEnd && pop(), ms * 0.55);
|
|
1130
|
+
}
|
|
1036
1131
|
// a wrestling-style entrance: the crowd, two booms with pyro, spotlights, its name slammed in, then a dance
|
|
1037
1132
|
let entering = 0;
|
|
1038
1133
|
function entrance(d = {}) {
|
|
@@ -1097,6 +1192,9 @@
|
|
|
1097
1192
|
if (!guest)
|
|
1098
1193
|
$('#danceBtn')?.addEventListener('click', () => post('/dance', {}).catch(() => dance({})));
|
|
1099
1194
|
else $('#danceBtn')?.addEventListener('click', () => dance({}));
|
|
1195
|
+
$('#auraBtn').title = t('aura');
|
|
1196
|
+
if (!guest) $('#auraBtn')?.addEventListener('click', () => post('/aura', {}).catch(() => aura({})));
|
|
1197
|
+
else $('#auraBtn')?.addEventListener('click', () => aura({}));
|
|
1100
1198
|
|
|
1101
1199
|
// ── personality: small life between events (glances, fidgets, effects, shape changes) ──
|
|
1102
1200
|
const pick = (a) => a[Math.floor(Math.random() * a.length)];
|
|
@@ -1126,6 +1224,7 @@
|
|
|
1126
1224
|
[happy ? 2.5 : 0.6, () => (ch.gesture('dance'), ch.effect?.('notes'))],
|
|
1127
1225
|
[happy ? 0.8 : 0.2, () => ch.gesture(pick(DANCES.length ? DANCES : ['dance']), { ms: 3000 })], // a few silent moves (music only when asked)
|
|
1128
1226
|
[happy ? 0.8 : 0.2, () => (ch.gesture('celebrate'), ch.effect?.('sparkles'))],
|
|
1227
|
+
[happy && !guest ? 0.35 : 0, () => post('/aura', { music: false }).catch(() => {})], // feliz, a veces farmea aura solo (en silencio, pero suma)
|
|
1129
1228
|
[0.6, () => ch.gesture('spin')],
|
|
1130
1229
|
[0.5, () => ch.gesture('clap')],
|
|
1131
1230
|
[tired ? 3 : 0.4, () => ch.gesture('yawn')],
|