@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/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); }
|
|
@@ -63,6 +70,9 @@
|
|
|
63
70
|
.who { text-align: center; margin-top: 10px; }
|
|
64
71
|
h1 { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 750; letter-spacing: -.025em; }
|
|
65
72
|
.sub { margin-top: 4px; display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
|
|
73
|
+
.cardlink { text-decoration: none; cursor: pointer; }
|
|
74
|
+
.cardlink:hover { border-color: var(--accent); }
|
|
75
|
+
.cardlink svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
|
|
66
76
|
.mood { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 12px; font-weight: 600; }
|
|
67
77
|
.mood::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--mood, var(--muted)); }
|
|
68
78
|
|
|
@@ -130,6 +140,7 @@
|
|
|
130
140
|
/* the 3D ot is framed with room under its feet (~34px at 1x) that grows with the stretch: the figure is drawn
|
|
131
141
|
lower by what that room grew, so a bigger ot still stands where it stood; the stage (hit area) stays put */
|
|
132
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 */
|
|
133
144
|
/* scenes with other ots (electron/director.cjs): the acts move .act; props (fireballs, beams, sabers, bullets) */
|
|
134
145
|
.actor { position: absolute; inset: 0; z-index: 1; transform-origin: 50% 92%; }
|
|
135
146
|
.props { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: visible; }
|
|
@@ -148,22 +159,27 @@
|
|
|
148
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); }
|
|
149
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)); }
|
|
150
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; }
|
|
151
|
-
/* a visiting ot: its own little menu (play, say goodbye, settings
|
|
152
|
-
body.guest .ask, body.guest #talkBtn, body.guest #micBtn, body.guest #sleepBtn { display: none !important; }
|
|
162
|
+
/* a visiting ot: its own little menu (play, say goodbye, settings); feeding, talking and sleep are the host's */
|
|
163
|
+
body.guest .ask, body.guest #gameBtn, body:not(.desktop) #gameBtn, body.guest #talkBtn, body.guest #micBtn, body.guest #sleepBtn { display: none !important; }
|
|
153
164
|
.bye { display: none; }
|
|
154
165
|
body.desktop.guest .bye { display: flex; }
|
|
155
166
|
body.desktop .bubble { max-width: 220px; font-size: 12.5px; padding: 8px 12px; }
|
|
156
|
-
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;
|
|
157
168
|
background: color-mix(in srgb, var(--panel) 86%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px);
|
|
158
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) */
|
|
159
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) */
|
|
160
|
-
|
|
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; }
|
|
161
176
|
body.desktop .act span { display: none; }
|
|
162
|
-
.grip { display: none; }
|
|
163
|
-
body.desktop .grip { display: flex; cursor: grab; touch-action: none; }
|
|
164
|
-
body.desktop .grip:active { cursor: grabbing; }
|
|
165
177
|
body.desktop .act.primary { background: var(--accent); }
|
|
166
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; }
|
|
167
183
|
body.listening #micBtn { background: var(--err); color: #fff; animation: rec 1s ease-in-out infinite; }
|
|
168
184
|
@keyframes rec { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--err) 30%, transparent); } }
|
|
169
185
|
body.desktop .ask { display: none; position: absolute; left: 6px; right: 6px; top: 6px; margin: 0; z-index: 4; -webkit-app-region: no-drag; }
|
|
@@ -175,6 +191,15 @@
|
|
|
175
191
|
body.desktop.opaque { background: var(--panel); }
|
|
176
192
|
|
|
177
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; }
|
|
178
203
|
</style>
|
|
179
204
|
</head>
|
|
180
205
|
<body>
|
|
@@ -193,11 +218,13 @@
|
|
|
193
218
|
<div class="props" id="props" aria-hidden="true"></div>
|
|
194
219
|
<div class="floor" aria-hidden="true"></div>
|
|
195
220
|
<span class="badge" id="badge"></span>
|
|
221
|
+
<span class="wakeDot" id="wakeDot"></span>
|
|
222
|
+
<span class="eye" id="eye" aria-live="polite"></span>
|
|
196
223
|
</div>
|
|
197
224
|
<form class="ask" id="ask" autocomplete="off"><input id="askIn" maxlength="800" enterkeyhint="send"></form>
|
|
198
225
|
<div class="who">
|
|
199
226
|
<h1 id="name"></h1>
|
|
200
|
-
<div class="sub"><span id="role"></span><span class="mood" id="mood"></span></div>
|
|
227
|
+
<div class="sub"><span id="role"></span><span class="mood" id="mood"></span><a class="mood cardlink" id="cardBtn" target="_blank" rel="noopener"><svg viewBox="0 0 24 24"><rect x="5" y="3" width="14" height="18" rx="2.5"/><path d="M12 8.5l1.2 2.4 2.6.4-1.9 1.8.5 2.6-2.4-1.3-2.4 1.3.5-2.6-1.9-1.8 2.6-.4z"/></svg><span data-t="card"></span></a></div>
|
|
201
228
|
</div>
|
|
202
229
|
</section>
|
|
203
230
|
|
|
@@ -214,9 +241,10 @@
|
|
|
214
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>
|
|
215
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>
|
|
216
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>
|
|
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>
|
|
217
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>
|
|
218
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>
|
|
219
|
-
<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>
|
|
220
248
|
</nav>
|
|
221
249
|
|
|
222
250
|
<section class="feed" aria-labelledby="feed-h">
|
|
@@ -230,17 +258,17 @@
|
|
|
230
258
|
<script type="module">
|
|
231
259
|
const BOOT = __BOOT__;
|
|
232
260
|
const T = {
|
|
233
|
-
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',
|
|
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',
|
|
234
262
|
activity: 'Activity', empty: 'Nothing yet. Run a command or ask your coding agent something.', tally: '{ok} ok · {fail} failed · turns {turns}',
|
|
235
263
|
brain: 'Brain: {b}', age: 'Born {d}', lines: 'built-in phrases', now: 'now', m: '{n}m', h: '{n}h',
|
|
236
264
|
moods: { happy: 'Happy', neutral: 'Calm', sad: 'Sad', disgust: 'Bored', sleep: 'Asleep', thinking: 'Thinking' },
|
|
237
265
|
kind: { tool: 'Tool', shell: 'Shell', prompt: 'You asked', stop: 'Turn finished', notify: 'Needs you', start: 'Session started' } },
|
|
238
|
-
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',
|
|
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',
|
|
239
267
|
activity: 'Actividad', empty: 'Nada todavía. Ejecuta un comando o pregúntale algo a tu agente.', tally: '{ok} ok · {fail} fallos · turnos {turns}',
|
|
240
268
|
brain: 'Cerebro: {b}', age: 'Nació {d}', lines: 'frases propias', now: 'ahora', m: '{n} min', h: '{n} h',
|
|
241
269
|
moods: { happy: 'Feliz', neutral: 'Tranquilo', sad: 'Triste', disgust: 'Aburrido', sleep: 'Dormido', thinking: 'Pensando' },
|
|
242
270
|
kind: { tool: 'Herramienta', shell: 'Terminal', prompt: 'Preguntaste', stop: 'Turno terminado', notify: 'Te necesita', start: 'Sesión iniciada' } },
|
|
243
|
-
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',
|
|
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',
|
|
244
272
|
activity: 'Atividade', empty: 'Nada ainda. Rode um comando ou pergunte algo ao seu agente.', tally: '{ok} ok · {fail} falhas · turnos {turns}',
|
|
245
273
|
brain: 'Cérebro: {b}', age: 'Nasceu {d}', lines: 'frases próprias', now: 'agora', m: '{n} min', h: '{n} h',
|
|
246
274
|
moods: { happy: 'Feliz', neutral: 'Tranquilo', sad: 'Triste', disgust: 'Entediado', sleep: 'Dormindo', thinking: 'Pensando' },
|
|
@@ -273,14 +301,14 @@
|
|
|
273
301
|
$('#brain').innerHTML = '';
|
|
274
302
|
$('#brain').append(t('brain', { b: '' }), Object.assign(document.createElement('b'), { textContent: BOOT.brain === 'lines' ? t('lines') : BOOT.brain }));
|
|
275
303
|
|
|
276
|
-
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');
|
|
277
305
|
const spec = id.look?.character || {};
|
|
278
306
|
let ch = null;
|
|
279
307
|
if (new URLSearchParams(location.search).has('3d')) {
|
|
280
308
|
// three comes from the CDN; without WebGL or network the 2D ot takes over
|
|
281
309
|
try {
|
|
282
310
|
const m = await loadCharacter3D();
|
|
283
|
-
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 } });
|
|
284
312
|
if (ch.fallback) console.warn('[7ots pet] no WebGL: 2D ot');
|
|
285
313
|
} catch (err) {
|
|
286
314
|
console.warn('[7ots pet] 3D ot unavailable, using 2D:', err?.message || err);
|
|
@@ -334,11 +362,11 @@
|
|
|
334
362
|
const b = $('#bubble');
|
|
335
363
|
if (b.classList.contains('on')) {
|
|
336
364
|
w = Math.max(w, b.offsetWidth + 24);
|
|
337
|
-
h = Math.max(h, st.height +
|
|
365
|
+
h = Math.max(h, st.height + 18 + b.offsetHeight + 16); // 18: lifted over the 3D head
|
|
338
366
|
}
|
|
339
367
|
if (document.body.classList.contains('talking')) (w = Math.max(w, 240)), (h = Math.max(h, st.height + 60));
|
|
340
368
|
if (Date.now() < actUntil) (w = Math.max(w, actRoom * 2)), (h = Math.max(h, st.height + actTall));
|
|
341
|
-
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)
|
|
342
370
|
return { w: Math.ceil(w), h: Math.ceil(h) };
|
|
343
371
|
};
|
|
344
372
|
// The shell polls __need every 250 ms; when an effect starts it's told at once (a console line it listens
|
|
@@ -410,14 +438,13 @@
|
|
|
410
438
|
});
|
|
411
439
|
// on the document: in 3D the ot is drawn on a canvas above the page, so events don't target #stage
|
|
412
440
|
addEventListener('pointerdown', (e) => {
|
|
413
|
-
// on the ot itself
|
|
414
|
-
|
|
415
|
-
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;
|
|
416
443
|
down = true;
|
|
417
444
|
document.documentElement.setPointerCapture?.(e.pointerId);
|
|
418
|
-
const c =
|
|
445
|
+
const c = cornerAt(e);
|
|
419
446
|
if (c) sizing = { c, x: e.screenX, y: e.screenY, k: scale };
|
|
420
|
-
else
|
|
447
|
+
else {
|
|
421
448
|
const r = $('#stage').getBoundingClientRect();
|
|
422
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;
|
|
423
450
|
pulled = { m: side ? 'squish' : 'stretch', on: false };
|
|
@@ -460,6 +487,12 @@
|
|
|
460
487
|
else (ch.gesture(pokes % 2 ? 'stomp' : 'shake'), ch.effect?.('anger'), pokes >= 6 && ch.effect?.('steam'));
|
|
461
488
|
}
|
|
462
489
|
|
|
490
|
+
// Audio log (pet.log via POST /log): which page said what and when, to debug a voice heard twice. PAGE tells pages apart.
|
|
491
|
+
const PAGE = Math.random().toString(36).slice(2, 8);
|
|
492
|
+
const alog = (msg) => {
|
|
493
|
+
console.log(`[7ots audio] ${PAGE} ${msg}`);
|
|
494
|
+
post('/log', { page: PAGE, msg }).catch(() => {});
|
|
495
|
+
};
|
|
463
496
|
const post = (path, body) => fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-7ots-Token': BOOT.token }, body: JSON.stringify(body) });
|
|
464
497
|
let asleep = false;
|
|
465
498
|
// something urgent while asleep: it wakes up for a moment (says it, walks over), then dozes off again
|
|
@@ -572,14 +605,16 @@
|
|
|
572
605
|
};
|
|
573
606
|
async function speak(text, reply = false) {
|
|
574
607
|
if (BOOT.voice?.kind === 'none') return;
|
|
608
|
+
if (speak.cur) alog(`cut #${speak.turn}`);
|
|
575
609
|
hush();
|
|
576
610
|
const turn = (speak.turn = (speak.turn || 0) + 1);
|
|
611
|
+
alog(`speak #${turn} ${BOOT.voice?.kind || 'browser'} «${clean(text).slice(0, 60)}»`);
|
|
577
612
|
if (BOOT.voice?.kind && BOOT.voice.kind !== 'browser') {
|
|
578
613
|
try {
|
|
579
614
|
const r = await post('/tts', { text });
|
|
580
615
|
if (r.ok) {
|
|
581
616
|
const blob = await r.blob();
|
|
582
|
-
if (turn !== speak.turn) return; // a newer line arrived while this one was synthesizing
|
|
617
|
+
if (turn !== speak.turn) return void alog(`drop #${turn} (a newer line came)`); // a newer line arrived while this one was synthesizing
|
|
583
618
|
const audio = new Audio(URL.createObjectURL(blob));
|
|
584
619
|
speak.cur = audio;
|
|
585
620
|
speak.reply = reply;
|
|
@@ -596,10 +631,14 @@
|
|
|
596
631
|
} catch {}
|
|
597
632
|
talk(true, clean(text), (audio.duration || 0) * 1000);
|
|
598
633
|
};
|
|
599
|
-
audio.onended = audio.onerror = () => ((speak.cur = null), talk(false));
|
|
634
|
+
audio.onended = audio.onerror = (e) => (alog(`${e?.type === 'error' ? 'error' : 'end'} #${turn}`), (speak.cur = null), talk(false));
|
|
635
|
+
alog(`play #${turn} ${blob.size}B`);
|
|
600
636
|
return await audio.play();
|
|
601
637
|
}
|
|
602
|
-
|
|
638
|
+
alog(`tts #${turn} failed ${r.status}`);
|
|
639
|
+
} catch (e) {
|
|
640
|
+
alog(`tts #${turn} threw ${e?.message || e}`);
|
|
641
|
+
}
|
|
603
642
|
}
|
|
604
643
|
if (turn !== speak.turn || !('speechSynthesis' in window)) return;
|
|
605
644
|
const u = new SpeechSynthesisUtterance(clean(text));
|
|
@@ -610,6 +649,7 @@
|
|
|
610
649
|
u.onboundary = (e) => lip?.sync?.(e.charIndex);
|
|
611
650
|
u.onend = u.onerror = () => talk(false);
|
|
612
651
|
speechSynthesis.cancel();
|
|
652
|
+
alog(`browser voice #${turn}`);
|
|
613
653
|
speechSynthesis.speak(u);
|
|
614
654
|
}
|
|
615
655
|
function showBubble(content, ms) {
|
|
@@ -645,10 +685,24 @@
|
|
|
645
685
|
}
|
|
646
686
|
// speech tags ([laugh], <whisper>…: settings → Voice → expressions) go to the voice, never to the bubble (as src/voice/tags.js)
|
|
647
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();
|
|
648
|
-
function say(raw, withFace = false, ambient = false) {
|
|
649
|
-
if (ambient && speak.cur && speak.reply) return; // small talk waits for the answer to finish
|
|
688
|
+
function say(raw, withFace = false, ambient = false, photo = null) {
|
|
689
|
+
if (ambient && speak.cur && speak.reply) return void alog('skip ambient (an answer is playing)'); // small talk waits for the answer to finish
|
|
650
690
|
const text = clean(raw);
|
|
651
|
-
|
|
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();
|
|
652
706
|
talk(true, text); // the mouth moves with the words even without a voice; a real voice re-syncs it
|
|
653
707
|
clearTimeout(say.t);
|
|
654
708
|
say.t = setTimeout(() => talk(false), 500 + text.length * 60);
|
|
@@ -740,17 +794,39 @@
|
|
|
740
794
|
if (m.ask) ask4(m.ask); // before thinking: an approved ask hands the bubble back to the dots
|
|
741
795
|
if ('thinking' in m) setThinking(!!m.thinking);
|
|
742
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
|
|
743
800
|
// asleep (and not stirred by something you asked for): no moving, gestures or talking
|
|
744
|
-
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));
|
|
745
802
|
if (m.gesture) ch.gesture(m.gesture);
|
|
746
803
|
if (m.morph) ch.morph?.(m.morph);
|
|
747
804
|
if (m.effect) ch.effect?.(m.effect);
|
|
748
|
-
if (m.say) 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);
|
|
749
806
|
if (m.dance) dance(m.dance);
|
|
807
|
+
if (m.aura) aura(m.aura);
|
|
750
808
|
if (m.entrance) entrance(m.entrance);
|
|
751
809
|
if (m.point && desktop) window.__goal = m.point; // the desktop shell walks it over there
|
|
752
810
|
};
|
|
753
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
|
+
|
|
754
830
|
live.textContent = t('off');
|
|
755
831
|
connect();
|
|
756
832
|
|
|
@@ -759,10 +835,12 @@
|
|
|
759
835
|
const askIn = $('#askIn');
|
|
760
836
|
askIn.placeholder = t('askPh');
|
|
761
837
|
$('#setBtn').href = `/settings?token=${encodeURIComponent(BOOT.token)}`;
|
|
838
|
+
$('#cardBtn').href = `/card?token=${encodeURIComponent(BOOT.token)}`;
|
|
762
839
|
$('#setBtn').title = t('settings');
|
|
763
840
|
if (!desktop) $('#setBtn').removeAttribute('target'); // in a browser tab, Settings opens in place (its Back returns here); the desktop window opens a tab
|
|
764
841
|
$('#byeBtn').title = t('dismiss');
|
|
765
|
-
$('#byeBtn').addEventListener('click', () => console.debug('\u00a77bye'));
|
|
842
|
+
$('#byeBtn').addEventListener('click', () => console.debug('\u00a77bye'));
|
|
843
|
+
$('#gameBtn').addEventListener('click', () => console.debug('\u00a77game')); // the shell shows byte's games, then the game in a small window // the shell sends the visitor home
|
|
766
844
|
const talking = (on) => {
|
|
767
845
|
document.body.classList.toggle('talking', on);
|
|
768
846
|
if (on) askIn.focus();
|
|
@@ -800,6 +878,7 @@
|
|
|
800
878
|
|
|
801
879
|
// ── voice: record until you stop talking, transcribe (/stt), then it's like typing it (/ask) ──
|
|
802
880
|
let rec = null;
|
|
881
|
+
let lastVoice = { norm: '', at: 0 };
|
|
803
882
|
async function listen() {
|
|
804
883
|
if (rec) return rec.state === 'recording' && rec.stop();
|
|
805
884
|
if (!BOOT.stt) return say(t('noStt'));
|
|
@@ -822,13 +901,17 @@
|
|
|
822
901
|
let heard = false;
|
|
823
902
|
let quiet = t0;
|
|
824
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;
|
|
825
907
|
const iv = setInterval(() => {
|
|
826
908
|
an.getFloatTimeDomainData(buf);
|
|
827
909
|
let sum = 0;
|
|
828
910
|
for (const x of buf) sum += x * x;
|
|
829
911
|
const now = Date.now();
|
|
830
912
|
const level = Math.sqrt(sum / buf.length);
|
|
831
|
-
|
|
913
|
+
floor = Math.min(level, floor === Infinity ? level : floor * 1.002);
|
|
914
|
+
if (level > Math.max(0.015, floor * 3)) (heard = true), (quiet = now);
|
|
832
915
|
peak = Math.max(peak, level);
|
|
833
916
|
// stops after 1.3 s of silence, 6 s without a word, or 15 s in all
|
|
834
917
|
if ((heard && now - quiet > 1300) || (!heard && now - t0 > 6000) || now - t0 > 15000) rec?.state === 'recording' && rec.stop();
|
|
@@ -839,7 +922,7 @@
|
|
|
839
922
|
ac.close().catch(() => {});
|
|
840
923
|
rec = null;
|
|
841
924
|
document.body.classList.remove('listening');
|
|
842
|
-
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 }));
|
|
843
926
|
if (!chunks.length) return bubble.classList.remove('on');
|
|
844
927
|
if (!heard && peak < 0.004) return say(t('noMic')); // silence all along: wrong or muted microphone
|
|
845
928
|
setThinking(true);
|
|
@@ -851,6 +934,10 @@
|
|
|
851
934
|
const text = r?.text?.trim();
|
|
852
935
|
if (!text) return say(r?.error && !/stt/.test(r.error) ? t('noStt') : t('sttErr'));
|
|
853
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() };
|
|
854
941
|
post('/ask', { text });
|
|
855
942
|
};
|
|
856
943
|
rec.onerror = (e) => console.warn('[7ots voice] recorder', e.error?.message || e);
|
|
@@ -866,6 +953,11 @@
|
|
|
866
953
|
ch.lookAt(0, 0);
|
|
867
954
|
}
|
|
868
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);
|
|
869
961
|
|
|
870
962
|
// The desktop shell tells us how we move: facing (walk -1..1), hops, being dropped, following, the cursor.
|
|
871
963
|
addEventListener('message', (e) => {
|
|
@@ -963,6 +1055,7 @@
|
|
|
963
1055
|
requestAnimationFrame(() => ACTS[d.act](d.dir || 1, d));
|
|
964
1056
|
}
|
|
965
1057
|
if (d.dance) dance(d.dance);
|
|
1058
|
+
if (d.aura) aura(d.aura);
|
|
966
1059
|
if (d.entrance) entrance(d.entrance);
|
|
967
1060
|
if (d.face != null) {
|
|
968
1061
|
if (is3d) ch.character.yaw = -d.face * 0.9;
|
|
@@ -995,7 +1088,8 @@
|
|
|
995
1088
|
}
|
|
996
1089
|
function music(m, ms, style) {
|
|
997
1090
|
stopMusic(0.2);
|
|
998
|
-
if (!m || guest) return;
|
|
1091
|
+
if (!m || guest) return;
|
|
1092
|
+
alog(`music ${m.file || m.style || style || 'hype'} ${ms}ms`); // a visitor dances along to the host's music
|
|
999
1093
|
const vol = Math.max(0, Math.min(1, m.vol ?? 0.5));
|
|
1000
1094
|
if (m.file) {
|
|
1001
1095
|
const a = new Audio(`/music/${encodeURIComponent(m.file)}?token=${encodeURIComponent(BOOT.token)}`);
|
|
@@ -1013,6 +1107,27 @@
|
|
|
1013
1107
|
ch.gesture(name, { ms });
|
|
1014
1108
|
music(d.music, ms, DANCE_STYLE[name]);
|
|
1015
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
|
+
}
|
|
1016
1131
|
// a wrestling-style entrance: the crowd, two booms with pyro, spotlights, its name slammed in, then a dance
|
|
1017
1132
|
let entering = 0;
|
|
1018
1133
|
function entrance(d = {}) {
|
|
@@ -1077,6 +1192,9 @@
|
|
|
1077
1192
|
if (!guest)
|
|
1078
1193
|
$('#danceBtn')?.addEventListener('click', () => post('/dance', {}).catch(() => dance({})));
|
|
1079
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({}));
|
|
1080
1198
|
|
|
1081
1199
|
// ── personality: small life between events (glances, fidgets, effects, shape changes) ──
|
|
1082
1200
|
const pick = (a) => a[Math.floor(Math.random() * a.length)];
|
|
@@ -1106,6 +1224,7 @@
|
|
|
1106
1224
|
[happy ? 2.5 : 0.6, () => (ch.gesture('dance'), ch.effect?.('notes'))],
|
|
1107
1225
|
[happy ? 0.8 : 0.2, () => ch.gesture(pick(DANCES.length ? DANCES : ['dance']), { ms: 3000 })], // a few silent moves (music only when asked)
|
|
1108
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)
|
|
1109
1228
|
[0.6, () => ch.gesture('spin')],
|
|
1110
1229
|
[0.5, () => ch.gesture('clap')],
|
|
1111
1230
|
[tired ? 3 : 0.4, () => ch.gesture('yawn')],
|