cortico-world-agent-speed 0.2.4 → 0.2.5
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/CHANGELOG.md +1 -1
- package/package.json +1 -1
- package/web/activity-motion.js +86 -93
- package/web/body-host.js +3 -1
- package/web/kit/body.js +14 -9
- package/web/pet-app.js +23 -2
- package/web/pet.css +1 -0
- package/web/pet.html +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
- Fixed configuration saves failing when the page port is left at its default of 0 (automatic).
|
|
4
4
|
- Restored the original Coopanion dressing interface inline in the Agent Speed settings panel. Requires a Coopanion host with Agent Speed dressing support. The preview, saved looks, and imports use Agent Speed's own figure library and settings.
|
|
5
5
|
- Replaced the separate renderer with the pinned Coopanion Desktop Pet World and official Coo figure. The extension has independent settings, runtime, storage, tool names and window lifecycle.
|
|
6
|
-
-
|
|
6
|
+
- The pet's pace and amplitude follow observed aggregate output speed, independent of agent count. Only sustained or marked rises add an occasional supported gesture. Neutral motion covers activity with no output; idle and disconnected feeds settle without completion gestures.
|
|
7
7
|
- DeepSeek Chan artwork is not redistributed; the official dressing page can import separately licensed figure packs.
|
|
8
8
|
|
|
9
9
|
# Upstream Desktop Pet change history
|
package/package.json
CHANGED
package/web/activity-motion.js
CHANGED
|
@@ -1,115 +1,108 @@
|
|
|
1
|
-
//
|
|
1
|
+
// The body visualizes aggregate observed throughput, never an individual session.
|
|
2
2
|
const FRESH_MS = 5000;
|
|
3
|
-
const FINISH_MS = 1200;
|
|
4
3
|
const TAU = Math.PI * 2;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!sample || !Number.isFinite(now) || !Number.isFinite(sample.updatedAtMs) ||
|
|
16
|
-
sample.updatedAtMs > now || now - sample.updatedAtMs > FRESH_MS) return null;
|
|
17
|
-
return sample.generating > 0 ? 'output' : sample.tools > 0 ? 'tools' : 'idle';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Only infer actions whose whole identifier describes a known stationary gesture or
|
|
21
|
-
// expression. Arbitrary pack words may have side effects even when not lasting.
|
|
22
|
-
function customCategory(word) {
|
|
23
|
-
const id = word.id.toLowerCase();
|
|
24
|
-
if (!/^[a-z]+(?:[_-][a-z]+)*$/.test(id)) return null;
|
|
25
|
-
if (word.kind === 'expression') {
|
|
26
|
-
if (/^(?:thinking|focused|curious|determined|confused)(?:[_-](?:face|expression))?$/.test(id)) return 'thought';
|
|
27
|
-
if (/^(?:happy|content|excited|cheerful|joyful|smile|smiling|wink)(?:[_-](?:face|expression))?$/.test(id)) return 'joy';
|
|
28
|
-
}
|
|
29
|
-
if (word.kind === 'motion' && /^(?:(?:small|little|gentle|happy|quick)[_-])?(?:nod|wave|bow|hop|flap|dance|look)(?:[_-](?:once|twice))?$/.test(id)) return 'gesture';
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
4
|
+
const HIGH_ENTER = 135;
|
|
5
|
+
const HIGH_EXIT = 100;
|
|
6
|
+
const HIGH_CONFIRM_MS = 850;
|
|
7
|
+
const CUE_MAX_AGE_MS = 1400;
|
|
8
|
+
const CUE_COOLDOWN_MS = 6000;
|
|
9
|
+
const HIGH_ACCENT_INTERVAL_MS = 16000;
|
|
10
|
+
const HIGH_ACCENTS = ['hop', 'flap', 'spin', 'dance'];
|
|
11
|
+
const SUSTAINED_ACCENTS = ['dance', 'spin', 'flap', 'hop'];
|
|
12
|
+
const SMALL_ACCENTS = ['nod'];
|
|
13
|
+
const STATIONARY_CUSTOM = /^(?:(?:small|little|gentle|quick)[_-])?(?:nod|sway|hop|flap|spin|dance)(?:[_-](?:once|twice))?$/i;
|
|
32
14
|
|
|
33
15
|
export function createActivityMotion() {
|
|
34
16
|
let sample = null;
|
|
35
|
-
let
|
|
36
|
-
let nextCue = 0;
|
|
17
|
+
let higherSince = null, high = false, highSince = 0;
|
|
18
|
+
let accentAt = 0, accentKind = null, nextCue = 0, nextSustained = 0;
|
|
37
19
|
let lastCue = null;
|
|
38
|
-
|
|
39
|
-
const pose = { energy: 0, focus: 0, phase: 0, cue: null };
|
|
20
|
+
const pose = { energy: 0, phase: 0, cue: null, rate: 0, status: 'offline', generating: 0, tools: 0 };
|
|
40
21
|
|
|
41
22
|
return {
|
|
42
23
|
receive(value, now) {
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
if (value && sample && value.updatedAtMs <= sample.updatedAtMs) return;
|
|
25
|
+
const previous = sample;
|
|
26
|
+
if (value && previous && value.updatedAtMs - previous.updatedAtMs > FRESH_MS) {
|
|
27
|
+
higherSince = null;
|
|
28
|
+
high = false;
|
|
29
|
+
accentKind = null;
|
|
30
|
+
nextSustained = 0;
|
|
49
31
|
}
|
|
50
|
-
// Samples must not restart an active clip or reset the scheduler.
|
|
51
32
|
sample = value;
|
|
33
|
+
const rate = value?.outputPerSecond ?? 0;
|
|
34
|
+
if (!(rate > 0) || !value.complete) {
|
|
35
|
+
higherSince = null;
|
|
36
|
+
high = false;
|
|
37
|
+
accentKind = null;
|
|
38
|
+
nextSustained = 0;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (rate < HIGH_EXIT) { high = false; nextSustained = 0; }
|
|
42
|
+
if (!high && rate >= HIGH_ENTER) {
|
|
43
|
+
higherSince ??= value.updatedAtMs;
|
|
44
|
+
if (value.updatedAtMs - higherSince >= HIGH_CONFIRM_MS) {
|
|
45
|
+
high = true;
|
|
46
|
+
highSince = now;
|
|
47
|
+
nextSustained = now + HIGH_ACCENT_INTERVAL_MS;
|
|
48
|
+
accentKind = 'high';
|
|
49
|
+
accentAt = now;
|
|
50
|
+
}
|
|
51
|
+
} else higherSince = null;
|
|
52
|
+
if (!high && rate >= 55 && rate < HIGH_EXIT && previous?.complete && value.complete &&
|
|
53
|
+
previous.outputPerSecond > 0 && previous.outputPerSecond < 40) {
|
|
54
|
+
accentKind = 'small';
|
|
55
|
+
accentAt = now;
|
|
56
|
+
}
|
|
52
57
|
},
|
|
53
58
|
step(now, dt, eligible, canCue, words, reported) {
|
|
54
|
-
const
|
|
55
|
-
const rate =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
const fresh = sample && sample.updatedAtMs <= now && now - sample.updatedAtMs <= FRESH_MS ? sample : null;
|
|
60
|
+
const rate = fresh?.outputPerSecond ?? 0;
|
|
61
|
+
const observed = rate > 0 || !!(fresh?.generating || fresh?.tools);
|
|
62
|
+
pose.rate = rate;
|
|
63
|
+
pose.generating = fresh?.generating ?? 0;
|
|
64
|
+
pose.tools = fresh?.tools ?? 0;
|
|
65
|
+
pose.status = !fresh ? 'offline' : !fresh.complete ? 'partial' : rate > 0 ? 'output' : observed ? 'active' : 'idle';
|
|
66
|
+
const level = rate > 0 ? Math.log1p(rate / 55) / (1.2 + Math.log1p(rate / 55)) : 0;
|
|
67
|
+
const target = rate > 0 ? 0.12 + 1.28 * level : observed ? 0.075 : 0;
|
|
68
|
+
const seconds = Number.isFinite(dt) ? Math.max(0, Math.min(dt, 0.1)) : 0;
|
|
60
69
|
pose.cue = null;
|
|
61
|
-
if (
|
|
62
|
-
pose.energy
|
|
63
|
-
pose.
|
|
64
|
-
pose.
|
|
65
|
-
} else
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
pose.focus += (targetFocus - pose.focus) * blend;
|
|
69
|
-
if (!targetEnergy && pose.energy < .004) pose.energy = 0;
|
|
70
|
-
if (!targetFocus && pose.focus < .004) pose.focus = 0;
|
|
71
|
-
pose.phase = (pose.phase + seconds * (1.5 + pose.energy * 5)) % TAU;
|
|
72
|
-
}
|
|
70
|
+
if (eligible) {
|
|
71
|
+
const tau = target > pose.energy ? 0.2 : 0.7;
|
|
72
|
+
pose.energy += (target - pose.energy) * -Math.expm1(-seconds / tau);
|
|
73
|
+
if (!target && pose.energy < 0.004) pose.energy = 0;
|
|
74
|
+
} else pose.energy = 0;
|
|
75
|
+
// Drive rate and amplitude from the same smoothed value; never restart the phase on a sample.
|
|
76
|
+
pose.phase = (pose.phase + seconds * TAU * (0.22 + 2.25 * pose.energy)) % TAU;
|
|
73
77
|
|
|
74
|
-
if (!
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
if (!fresh || rate <= 0 || !eligible || !canCue) {
|
|
79
|
+
accentKind = null;
|
|
80
|
+
if (!fresh) {
|
|
81
|
+
higherSince = null;
|
|
82
|
+
high = false;
|
|
83
|
+
nextSustained = 0;
|
|
84
|
+
} else if (nextSustained && now >= nextSustained) nextSustained = now + HIGH_ACCENT_INTERVAL_MS;
|
|
78
85
|
return pose;
|
|
79
86
|
}
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (!allowed(word) || STOCK.has(word.id)) continue;
|
|
94
|
-
const category = customCategory(word);
|
|
95
|
-
if (category && (profile === 'tools' ? category === 'thought' : profile === 'done' || profile === 'fast' ? category !== 'thought' : true)) {
|
|
96
|
-
choices.push(word);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
87
|
+
if (accentKind && (now - accentAt > CUE_MAX_AGE_MS || (accentKind === 'high' ? !high : rate < 55))) accentKind = null;
|
|
88
|
+
if (now < nextCue) return pose;
|
|
89
|
+
const sustained = high && rate >= HIGH_EXIT && now >= nextSustained && now - highSince >= HIGH_ACCENT_INTERVAL_MS;
|
|
90
|
+
const family = accentKind === 'small' ? SMALL_ACCENTS : accentKind === 'high' ? HIGH_ACCENTS : sustained ? SUSTAINED_ACCENTS : null;
|
|
91
|
+
if (!family) return pose;
|
|
92
|
+
accentKind = null;
|
|
93
|
+
if (high) nextSustained = now + HIGH_ACCENT_INTERVAL_MS;
|
|
94
|
+
const allowed = (word) => word?.kind === 'motion' && !word.lasting && Number.isFinite(word.seconds) && word.seconds > 0 &&
|
|
95
|
+
word.seconds <= 5 && (reported === null || reported.includes(word.id));
|
|
96
|
+
const supported = family.map((id) => words?.get(id)).filter(allowed);
|
|
97
|
+
for (const word of words?.values() ?? []) {
|
|
98
|
+
if (!allowed(word) || !STATIONARY_CUSTOM.test(word.id) || supported.includes(word)) continue;
|
|
99
|
+
if (family === SMALL_ACCENTS ? /(?:nod|sway)/i.test(word.id) : /(?:hop|flap|spin|dance)/i.test(word.id)) supported.push(word);
|
|
99
100
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (choices.length > 1 && choices[index].id === lastCue) index = (index + 1) % choices.length;
|
|
104
|
-
const word = choices[index];
|
|
101
|
+
if (supported.length) {
|
|
102
|
+
const next = (supported.findIndex((word) => word.id === lastCue) + 1) % supported.length;
|
|
103
|
+
const word = supported[next];
|
|
105
104
|
pose.cue = lastCue = word.id;
|
|
106
|
-
|
|
107
|
-
const interval = activity === 'output' ? 3.8 - rate / 240 * 1.5 : 3.8;
|
|
108
|
-
nextCue = now + 1000 * Math.max(interval, duration + 0.35);
|
|
109
|
-
if (finishing) finishUntil = 0;
|
|
110
|
-
} else {
|
|
111
|
-
nextCue = now + 1000;
|
|
112
|
-
if (finishing) finishUntil = 0;
|
|
105
|
+
nextCue = now + Math.max(CUE_COOLDOWN_MS, 1000 * (word.seconds + .35));
|
|
113
106
|
}
|
|
114
107
|
return pose;
|
|
115
108
|
},
|
package/web/body-host.js
CHANGED
|
@@ -166,7 +166,9 @@ export function loadBody({ layer, pack, start, theme, bounds, onEvent, onSound,
|
|
|
166
166
|
/** Whether stage point `p` is on the body. */
|
|
167
167
|
hit: (p) => onBody(layout, p),
|
|
168
168
|
/** Advances the body `dt` seconds; with `draw` false (the pet window is hidden) it need not draw. */
|
|
169
|
-
tick(dt, draw = true, activity = null) {
|
|
169
|
+
tick(dt, draw = true, activity = null) {
|
|
170
|
+
if (ready) post({ t: 'tick', dt, draw, activity: activity && { energy: activity.energy, phase: activity.phase } });
|
|
171
|
+
},
|
|
170
172
|
do: (word) => post({ t: 'do', word }),
|
|
171
173
|
walk: (x, run, id) => post({ t: 'walk', x, run, id }),
|
|
172
174
|
/** One of the pack's own targets, `{ to, run, params }` as the World checked it. */
|
package/web/kit/body.js
CHANGED
|
@@ -409,13 +409,18 @@ export function createPet(els, opts) {
|
|
|
409
409
|
if (!(dt > 0 && dt < Infinity)) return;
|
|
410
410
|
T += dt; pet.modeT += dt;
|
|
411
411
|
A = anchors();
|
|
412
|
+
const active = (activityPose?.energy ?? 0) > .1 && !press && !pet.listening && !pet.thinking;
|
|
413
|
+
// Wake an autonomous nap, not a user's explicit sit/sleep (those use a lasting duration).
|
|
414
|
+
if (active && (pet.mode === 'sit' || pet.mode === 'sleep') && pet.dur < 1e9) {
|
|
415
|
+
setMode(pet.mode === 'sleep' ? 'wake' : 'idle');
|
|
416
|
+
}
|
|
412
417
|
const m = pet.mode, mt = pet.modeT;
|
|
413
418
|
// an extent that follows the skin, or a lopsided body turning round, can widen the body where it stands; carried and flying bodies keep to the edges on their own
|
|
414
419
|
if (m !== 'drag' && m !== 'air') { pet.x = clamp(pet.x, minX(), maxX()); pet.target = walkEnd(pet.target); }
|
|
415
420
|
let sqT = 0, strideT = 0, liftT = 0, leanT = 0, sitT = 0, bobT = 0, rate = 0, lookT = [0, 0], tiltT = 0;
|
|
416
421
|
let tk = 160, tc = 12, drowseT = 0;
|
|
417
422
|
const still = !!opts.still?.();
|
|
418
|
-
const free = roam !== 'off' && T > hold && !opts.dialogOpen?.() && !still;
|
|
423
|
+
const free = roam !== 'off' && T > hold && !opts.dialogOpen?.() && !still && !active;
|
|
419
424
|
|
|
420
425
|
pet.blinkT -= dt; pet.blinkAge += dt;
|
|
421
426
|
if (pet.blinkT <= 0) { pet.blinkAge = 0; pet.blinkT = Math.random() < .2 ? .28 : rnd(2.2, 5.2); }
|
|
@@ -719,20 +724,20 @@ export function createPet(els, opts) {
|
|
|
719
724
|
// Overlay activity on the existing stance: feet stay anchored and interaction/physics keep control.
|
|
720
725
|
const activity = !press && !pet.listening && !pet.thinking &&
|
|
721
726
|
(pet.mode === 'idle' || pet.mode === 'walk' || pet.mode === 'run') ? activityPose : null;
|
|
722
|
-
const energy = activity?.energy ?? 0
|
|
727
|
+
const energy = activity?.energy ?? 0;
|
|
723
728
|
const beat = energy ? Math.sin(activity.phase) : 0;
|
|
724
729
|
const br = Math.sin(T * (pet.mode === 'sleep' ? 1.7 : 2.4));
|
|
725
730
|
const bounce = beat * energy;
|
|
726
|
-
const sx = (1 + pet.sq * .7) * (1 - .05 * pet.stretch) * (1 - .009 * br - .
|
|
727
|
-
const sy = (1 - pet.sq) * (1 + .09 * pet.stretch) * (1 + .016 * br + .
|
|
731
|
+
const sx = (1 + pet.sq * .7) * (1 - .05 * pet.stretch) * (1 - .009 * br - .065 * bounce);
|
|
732
|
+
const sy = (1 - pet.sq) * (1 + .09 * pet.stretch) * (1 + .016 * br + .13 * bounce);
|
|
728
733
|
const ax = 128, ay = drag ? 36 : 256;
|
|
729
734
|
let AX = drag ? pet.dx : pet.x, AY = drag ? pet.dy : pet.fy;
|
|
730
735
|
if (fc.shake) AX += Math.sin(T * 60) * 1.4;
|
|
731
736
|
else if (pet.pulse?.kind === 'shiver') AX += Math.sin(T * 75) * 1.1 * envelope((T - pet.pulse.t0) / pet.pulse.dur, .08, .85);
|
|
732
737
|
// a figure may keep tilt and lean off the whole group and bend its own parts instead
|
|
733
|
-
const kx = S * pet.faceVis * sx, ky = S * sy, lean = (pet.lean +
|
|
738
|
+
const kx = S * pet.faceVis * sx, ky = S * sy, lean = (pet.lean + 3 * energy) * pet.faceVis;
|
|
734
739
|
const baseRot = custom?.groupTilt ? custom.groupTilt(pet.mode, pet.tilt, lean) : pet.tilt + lean;
|
|
735
|
-
const rot = baseRot +
|
|
740
|
+
const rot = baseRot + 5 * bounce * pet.faceVis;
|
|
736
741
|
pet.xf = { AX, AY, ax, ay, kx, ky, rot };
|
|
737
742
|
const extent = figureExtent();
|
|
738
743
|
if (!drag && extent && Math.min(...sideReach(extent)) < DEFAULT_HALF_WIDTH) {
|
|
@@ -755,9 +760,9 @@ export function createPet(els, opts) {
|
|
|
755
760
|
const face = { ...fc, eyes, gap: pet.gap.map(g => Math.min(64, g + pet.talkK * 12)), blush: pet.blushK };
|
|
756
761
|
const gesture = pet.pulse ? { kind: pet.pulse.kind, k: clamp((T - pet.pulse.t0) / pet.pulse.dur, 0, 1) } : null;
|
|
757
762
|
let look = pet.look;
|
|
758
|
-
if (energy
|
|
759
|
-
activityLook[0] = look[0] + beat * 5 * energy
|
|
760
|
-
activityLook[1] = look[1] - beat * 3 * energy
|
|
763
|
+
if (energy) {
|
|
764
|
+
activityLook[0] = look[0] + beat * 5 * energy;
|
|
765
|
+
activityLook[1] = look[1] - beat * 3 * energy;
|
|
761
766
|
look = activityLook;
|
|
762
767
|
}
|
|
763
768
|
custom.draw(petG, face, {
|
package/web/pet-app.js
CHANGED
|
@@ -37,6 +37,8 @@ document.body.classList.add(host ? 'desk' : 'tab');
|
|
|
37
37
|
const stage = $('#stage');
|
|
38
38
|
const bubble = $('#bubble'), menu = $('#menu');
|
|
39
39
|
const tools = $('#tools'), wheel = $('#wheel');
|
|
40
|
+
const activityTip = $('#agentSpeedActivity');
|
|
41
|
+
let activityHoverAt = null;
|
|
40
42
|
// Coo's drawing classes for the look wheel's pictures; the bubbles and buttons take their colours from Coo's palette
|
|
41
43
|
// another pack's body sets the theme color instead (accentStyle, after skinStyle so it wins)
|
|
42
44
|
const cooStyle = document.createElement('style'), skinStyle = document.createElement('style'), accentStyle = document.createElement('style');
|
|
@@ -2943,6 +2945,7 @@ function frame(steps, now, last) {
|
|
|
2943
2945
|
}
|
|
2944
2946
|
framed = true;
|
|
2945
2947
|
let activityMoving = false;
|
|
2948
|
+
let activity = null;
|
|
2946
2949
|
try {
|
|
2947
2950
|
steps.forEach((dt, i) => {
|
|
2948
2951
|
T += dt;
|
|
@@ -2960,9 +2963,9 @@ function frame(steps, now, last) {
|
|
|
2960
2963
|
!bodyState.dialogOpen && !bodyState.still && !bodyState.thinking && !bodyState.listening && !sliding() &&
|
|
2961
2964
|
!acts.length && T >= actUntil;
|
|
2962
2965
|
const canCue = eligible && figure?.mode === 'idle' && !figure.busy && !figure.moving;
|
|
2963
|
-
|
|
2966
|
+
activity = agentSpeedMotion.step(Date.now(), dt, eligible, canCue, words, body?.words ?? null);
|
|
2964
2967
|
if (activity.cue) body.do(activity.cue);
|
|
2965
|
-
if (activity.energy
|
|
2968
|
+
if (activity.energy) {
|
|
2966
2969
|
pose = activity;
|
|
2967
2970
|
activityMoving = true;
|
|
2968
2971
|
}
|
|
@@ -2979,6 +2982,24 @@ function frame(steps, now, last) {
|
|
|
2979
2982
|
stepFade();
|
|
2980
2983
|
stepLend();
|
|
2981
2984
|
layout(dt);
|
|
2985
|
+
if (host) {
|
|
2986
|
+
const figure = at(), point = cursor.at;
|
|
2987
|
+
const hovering = activity && figure && point && !pressing && !bodyState.dialogOpen && menu.hidden && !sliding() && body?.hit(point);
|
|
2988
|
+
activityHoverAt = hovering ? activityHoverAt ?? now : null;
|
|
2989
|
+
activityTip.hidden = activityHoverAt === null || now - activityHoverAt < 450;
|
|
2990
|
+
if (!activityTip.hidden) {
|
|
2991
|
+
const lang = language(), zh = lang === 'zh' || lang === 'zh-Hant';
|
|
2992
|
+
const rate = `${Math.round(activity.rate)} token/s`;
|
|
2993
|
+
const counts = zh ? `生成 ${activity.generating} · 工具 ${activity.tools}` : `Generating ${activity.generating} · Tools ${activity.tools}`;
|
|
2994
|
+
const text = activity.status === 'offline' ? (zh ? 'Agent Speed 未连接' : 'Agent Speed disconnected')
|
|
2995
|
+
: activity.status === 'partial' ? `${zh ? '部分来源不可用' : 'Some sources unavailable'} · ${rate} · ${counts}`
|
|
2996
|
+
: `${rate} · ${counts}`;
|
|
2997
|
+
if (activityTip.textContent !== text) activityTip.textContent = text;
|
|
2998
|
+
const width = activityTip.offsetWidth;
|
|
2999
|
+
activityTip.style.left = `${clamp(figure.x - width / 2, 6, Math.max(6, innerWidth - width - 6))}px`;
|
|
3000
|
+
activityTip.style.top = `${Math.max(8, figure.box.y - 38)}px`;
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
2982
3003
|
stepInputShape();
|
|
2983
3004
|
// the frame's own time, so the layer shows frames as far apart as they were drawn
|
|
2984
3005
|
if (overlayOn) host.overlayFrame(overlayRect(), performance.timeOrigin + now);
|
package/web/pet.css
CHANGED
|
@@ -108,6 +108,7 @@ body.desk .floor{display:none}
|
|
|
108
108
|
/* the frame's window onto the stage: body-host cuts it down to the body's surroundings while the halo is on */
|
|
109
109
|
.figure-layer .figure-clip{position:absolute; inset:0; pointer-events:none}
|
|
110
110
|
.figure-layer iframe{position:absolute; inset:0; width:100%; height:100%; border:0; background:transparent; color-scheme:normal; pointer-events:none}
|
|
111
|
+
.agent-speed-activity{position:fixed; z-index:2; max-width:calc(100vw - 12px); padding:5px 9px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--text); font:12px/1.35 system-ui,sans-serif; font-variant-numeric:tabular-nums; pointer-events:none; user-select:none}
|
|
111
112
|
|
|
112
113
|
|
|
113
114
|
/* activity borrows the speech bubble, but never takes the pointer or competes with dialogue */
|
package/web/pet.html
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
<div class="menu" id="menu" role="menu" hidden></div>
|
|
17
17
|
<div class="tools" id="tools" hidden></div>
|
|
18
18
|
<div class="wheel" id="wheel" hidden></div>
|
|
19
|
+
<div class="agent-speed-activity" id="agentSpeedActivity" hidden></div>
|
|
19
20
|
<script type="module" src="/web/pet-app.js"></script>
|
|
20
21
|
</body>
|
|
21
22
|
</html>
|