@7ots/cli 0.1.16 → 0.1.17
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/lib/pet-core.mjs +5 -4
- package/cli/lib/pet-server.mjs +3 -4
- package/cli/pet/pet.html +4 -1
- package/package.json +1 -1
package/cli/lib/pet-core.mjs
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* food, energy, fun 0..100 (100 = full / rested / happy). They decay with time.
|
|
5
5
|
* xp, level grow with work that goes well (passing commands, finished agent turns).
|
|
6
6
|
* asleep while asleep energy recovers and it stays quiet. It sleeps until you wake it
|
|
7
|
-
* (wake, feed, play)
|
|
7
|
+
* (wake, feed, play). The agent's events don't wake it: only what you asked for
|
|
8
|
+
* (a reminder, a watcher, an answer) stirs it for a moment (pet-server).
|
|
8
9
|
*
|
|
9
10
|
* Events come from hooks (Claude Code, the shell) and from the user (feed, play, sleep).
|
|
10
11
|
*/
|
|
@@ -147,16 +148,16 @@ export function applyEvent(p, ev, now = Date.now()) {
|
|
|
147
148
|
p.stats.turns++;
|
|
148
149
|
happy();
|
|
149
150
|
r.levelUp = gainXp(p, 5);
|
|
150
|
-
Object.assign(r, { line: 'stop', gesture: 'jump', important: true
|
|
151
|
+
Object.assign(r, { line: 'stop', gesture: 'jump', important: true }); // background work finished
|
|
151
152
|
break;
|
|
152
153
|
case 'notify':
|
|
153
|
-
Object.assign(r, { line: 'waiting', gesture: 'wave', important: true
|
|
154
|
+
Object.assign(r, { line: 'waiting', gesture: 'wave', important: true });
|
|
154
155
|
break;
|
|
155
156
|
case 'start':
|
|
156
157
|
Object.assign(r, { line: 'hello', gesture: 'wave', important: true });
|
|
157
158
|
break;
|
|
158
159
|
case 'say':
|
|
159
|
-
Object.assign(r, { important: true
|
|
160
|
+
Object.assign(r, { important: true });
|
|
160
161
|
break;
|
|
161
162
|
default:
|
|
162
163
|
break;
|
package/cli/lib/pet-server.mjs
CHANGED
|
@@ -307,13 +307,12 @@ export function startPetServer({ port = PET_PORT, log = () => {} } = {}) {
|
|
|
307
307
|
function onEvent(ev) {
|
|
308
308
|
const act = track(ev);
|
|
309
309
|
if (act) broadcast({ activity: act });
|
|
310
|
+
const r = applyEvent(pet, ev);
|
|
311
|
+
// asleep it sleeps: the agent's events (finished, waiting, failures) don't move it or make it talk
|
|
312
|
+
if (pet.asleep && ev.type !== 'sleep') return broadcast({});
|
|
310
313
|
// Something in the agent's terminal needs you: walk over there and point at it.
|
|
311
314
|
if (ev.type === 'stop' || ev.type === 'notify' || (ev.type === 'shell' && ![0, 130].includes(Number(ev.code)))) broadcast({ point: 'agent' });
|
|
312
|
-
const r = applyEvent(pet, ev);
|
|
313
315
|
if (r.effect || r.morph) broadcast({ effect: r.effect, morph: r.morph });
|
|
314
|
-
// asleep: only urgent things (the agent waiting, finished work, a message) stir it, and it dozes off again
|
|
315
|
-
if (pet.asleep && ev.type !== 'sleep' && !r.stir) return broadcast({});
|
|
316
|
-
if (r.stir) broadcast({ stir: true });
|
|
317
316
|
if (ev.type === 'say' && ev.text) {
|
|
318
317
|
lastSpoke = Date.now();
|
|
319
318
|
broadcast({ say: String(ev.text).slice(0, 300), gesture: 'wave' });
|
package/cli/pet/pet.html
CHANGED
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
const post = (path, body) => fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-7ots-Token': BOOT.token }, body: JSON.stringify(body) });
|
|
464
464
|
let asleep = false;
|
|
465
465
|
// something urgent while asleep: it wakes up for a moment (says it, walks over), then dozes off again
|
|
466
|
-
let stirUntil = 0, stirT = 0;
|
|
466
|
+
let stirUntil = 0, stirT = 0, sleptAt = 0;
|
|
467
467
|
function stir() {
|
|
468
468
|
stirUntil = Date.now() + 30000;
|
|
469
469
|
document.body.classList.remove('asleep');
|
|
@@ -493,6 +493,7 @@
|
|
|
493
493
|
$('#mood').style.setProperty('--mood', MOOD_COLOR[m] || 'var(--muted)');
|
|
494
494
|
}
|
|
495
495
|
function render(s) {
|
|
496
|
+
if (s.asleep && !asleep && last) sleptAt = Date.now(); // just sent to bed: its "good night" still gets said
|
|
496
497
|
last = s;
|
|
497
498
|
asleep = s.asleep;
|
|
498
499
|
const stirred = asleep && Date.now() < stirUntil;
|
|
@@ -739,6 +740,8 @@
|
|
|
739
740
|
if (m.ask) ask4(m.ask); // before thinking: an approved ask hands the bubble back to the dots
|
|
740
741
|
if ('thinking' in m) setThinking(!!m.thinking);
|
|
741
742
|
if (m.activity) addActivity(m.activity);
|
|
743
|
+
// 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 && dance(m.dance));
|
|
742
745
|
if (m.gesture) ch.gesture(m.gesture);
|
|
743
746
|
if (m.morph) ch.morph?.(m.morph);
|
|
744
747
|
if (m.effect) ch.effect?.(m.effect);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7ots/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "7ots.com — your AI companion with a face of its own: a desktop pet that watches over your coding agent (Claude Code and shell hooks), a personal assistant (reminders, alerts, notes, opens sites, sees your screen if allowed) and a reproducible identity (face, personality, voice) for any agent — in apuchat meet calls, Orquesta projects or your own server.",
|
|
5
5
|
"homepage": "https://7ots.com",
|
|
6
6
|
"repository": {
|