shadok-ai 0.17.55 → 0.17.56
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/package.json +1 -1
- package/public/index.html +257 -8
- package/public/shadok-soul.js +74 -0
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -2910,6 +2910,182 @@
|
|
|
2910
2910
|
.rail-pill { transition: none; }
|
|
2911
2911
|
.skel { animation: none; }
|
|
2912
2912
|
}
|
|
2913
|
+
|
|
2914
|
+
/* ══ Fluid layer ═════════════════════════════════════════════════════════
|
|
2915
|
+
The cockpit read as austere: flat grey slabs cut apart by hairlines. This
|
|
2916
|
+
layer keeps the layout and swaps LINES for DEPTH — surfaces are separated
|
|
2917
|
+
by tint, radius and soft shadow, the accent colours the page itself, and
|
|
2918
|
+
state changes glide instead of snapping. Few new details on purpose: the
|
|
2919
|
+
main lever is the tokens (--line fades, --radius grows), so every older
|
|
2920
|
+
rule that draws a border or a corner follows on its own. Placed last so it
|
|
2921
|
+
wins at equal specificity; all motion is off under reduced motion. */
|
|
2922
|
+
:root {
|
|
2923
|
+
--radius: 14px;
|
|
2924
|
+
/* Hairlines fade to a whisper: they stay where a field needs an edge, but
|
|
2925
|
+
stop carving the screen into boxes. */
|
|
2926
|
+
--line: color-mix(in srgb, var(--text) 7%, transparent);
|
|
2927
|
+
--card-shadow: 0 18px 40px -22px rgba(0, 0, 0, .75), 0 2px 6px -2px rgba(0, 0, 0, .35);
|
|
2928
|
+
--soft-shadow: 0 6px 18px -10px rgba(0, 0, 0, .6);
|
|
2929
|
+
--ease-fluid: cubic-bezier(.22, 1, .36, 1);
|
|
2930
|
+
}
|
|
2931
|
+
:root[data-mode="light"] {
|
|
2932
|
+
--radius: 14px;
|
|
2933
|
+
--line: rgba(0, 0, 0, .07);
|
|
2934
|
+
--card-shadow: 0 18px 40px -24px rgba(30, 30, 60, .28), 0 1px 3px rgba(30, 30, 60, .06);
|
|
2935
|
+
--soft-shadow: 0 6px 16px -10px rgba(30, 30, 60, .25);
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
/* The page carries the accent as an ambient glow, so the instance's colour
|
|
2939
|
+
is felt everywhere instead of only on buttons. */
|
|
2940
|
+
body {
|
|
2941
|
+
background:
|
|
2942
|
+
radial-gradient(1100px 620px at -5% -10%, color-mix(in srgb, var(--amber) 22%, transparent), transparent 62%),
|
|
2943
|
+
radial-gradient(900px 620px at 105% 110%, color-mix(in srgb, var(--phosphor) 14%, transparent), transparent 60%),
|
|
2944
|
+
var(--page);
|
|
2945
|
+
}
|
|
2946
|
+
header { background: transparent; }
|
|
2947
|
+
|
|
2948
|
+
/* Everything that changes state glides. */
|
|
2949
|
+
button, .tab, .rail-item, .group-head, .bubble, #composer textarea, .profile-card, .member-tile {
|
|
2950
|
+
transition: background-color .22s var(--ease-fluid), color .22s var(--ease-fluid),
|
|
2951
|
+
border-color .22s var(--ease-fluid), box-shadow .22s var(--ease-fluid), transform .22s var(--ease-fluid);
|
|
2952
|
+
}
|
|
2953
|
+
button { border-radius: 10px; }
|
|
2954
|
+
button:active:not(:disabled) { transform: scale(.97); }
|
|
2955
|
+
header button.icon { border-radius: 10px; }
|
|
2956
|
+
button.primary {
|
|
2957
|
+
border: 0;
|
|
2958
|
+
background: linear-gradient(135deg, var(--amber), var(--phosphor));
|
|
2959
|
+
box-shadow: 0 6px 16px -8px var(--amber);
|
|
2960
|
+
}
|
|
2961
|
+
button.primary:hover { background: linear-gradient(135deg, var(--amber), var(--phosphor)); box-shadow: 0 8px 22px -8px var(--amber); }
|
|
2962
|
+
|
|
2963
|
+
/* Columns become floating cards on the glow (desktop only: the phone keeps
|
|
2964
|
+
its full-bleed sheet). */
|
|
2965
|
+
@media (min-width: 641px) {
|
|
2966
|
+
main { padding: 2px 12px 12px; gap: 12px; }
|
|
2967
|
+
#tabbar { border: 0; box-shadow: var(--card-shadow); }
|
|
2968
|
+
/* The rail and the agents column used to be two halves of one card; with
|
|
2969
|
+
the gap back they are two cards, each fully rounded. */
|
|
2970
|
+
body.has-groups #groupRail { border: 0; border-radius: var(--radius); box-shadow: var(--card-shadow); }
|
|
2971
|
+
body.has-groups #tabbar { border-radius: var(--radius); }
|
|
2972
|
+
.chat-pane {
|
|
2973
|
+
border: 0; border-radius: calc(var(--radius) + 4px);
|
|
2974
|
+
background: var(--pane-main); box-shadow: var(--card-shadow);
|
|
2975
|
+
}
|
|
2976
|
+
#machine, #diffpanel { border: 0; border-radius: calc(var(--radius) + 4px); box-shadow: var(--card-shadow); }
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
/* Lists: soft pills, no rings. The selected agent lifts off the list with a
|
|
2980
|
+
glow in its own colour; the state fills (working / unread / waiting) stay
|
|
2981
|
+
untouched so they keep their meaning. */
|
|
2982
|
+
.tab, .group-head, .rail-item { border-radius: 12px; }
|
|
2983
|
+
.tab:hover, .group-head:hover { background-color: color-mix(in srgb, var(--text) 5%, transparent); }
|
|
2984
|
+
.tab.active,
|
|
2985
|
+
:root:not([data-mode="light"]) .tab.active {
|
|
2986
|
+
background-color: color-mix(in srgb, var(--text) 7%, transparent);
|
|
2987
|
+
box-shadow: 0 8px 20px -14px var(--ac, var(--amber));
|
|
2988
|
+
}
|
|
2989
|
+
:root[data-mode="light"] .tab.active { background-color: var(--bg-raised); box-shadow: var(--soft-shadow); }
|
|
2990
|
+
.tab.unread { border-radius: 12px; }
|
|
2991
|
+
.tav { box-shadow: 0 4px 10px -4px var(--ac, var(--amber)); }
|
|
2992
|
+
.rail-item.active { border-color: transparent; }
|
|
2993
|
+
.rail-pill {
|
|
2994
|
+
border: 0; border-radius: 12px;
|
|
2995
|
+
background: color-mix(in srgb, var(--amber) 16%, var(--bg-raised));
|
|
2996
|
+
box-shadow: var(--soft-shadow);
|
|
2997
|
+
}
|
|
2998
|
+
.group-head .gicon { border-radius: 10px; }
|
|
2999
|
+
|
|
3000
|
+
/* Channel header melts into the conversation instead of a ruled band. */
|
|
3001
|
+
#chanBar { background: transparent; border-bottom: 0; }
|
|
3002
|
+
|
|
3003
|
+
/* Messages: rounder bubbles with a tail corner; yours carry the accent. */
|
|
3004
|
+
.bubble { border-radius: 18px; }
|
|
3005
|
+
.turn.user .bubble {
|
|
3006
|
+
border-bottom-right-radius: 6px;
|
|
3007
|
+
background: linear-gradient(135deg,
|
|
3008
|
+
color-mix(in srgb, var(--amber) 30%, var(--bg-raised)),
|
|
3009
|
+
color-mix(in srgb, var(--phosphor) 16%, var(--bg-raised)));
|
|
3010
|
+
}
|
|
3011
|
+
.turn.user.other .bubble { border-bottom-right-radius: 18px; border-bottom-left-radius: 6px; }
|
|
3012
|
+
.turn.claude .bubble { border: 0; border-bottom-left-radius: 6px; box-shadow: var(--soft-shadow); }
|
|
3013
|
+
.turn.dialog .bubble {
|
|
3014
|
+
border-top: 0; border-radius: 18px;
|
|
3015
|
+
background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 16%, var(--bg-raised)), var(--bg-raised) 70px);
|
|
3016
|
+
box-shadow: var(--soft-shadow);
|
|
3017
|
+
}
|
|
3018
|
+
.turn.dialog.spent .bubble { background: var(--bg-raised); }
|
|
3019
|
+
.bubble.md pre { border: 0; border-radius: 12px; }
|
|
3020
|
+
@keyframes turn-in { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
|
|
3021
|
+
/* Only a message that ARRIVES slides in. Replayed history (.hist) does not:
|
|
3022
|
+
a hidden transcript restarts its animations each time it is shown, so
|
|
3023
|
+
hundreds of old turns would replay at every channel switch — the
|
|
3024
|
+
transcript's own `chat-in` already eases that view in as a whole. */
|
|
3025
|
+
.turn:not(.hist) { animation: turn-in .32s var(--ease-fluid) both; }
|
|
3026
|
+
|
|
3027
|
+
/* Composer: a floating pill that glows on focus. */
|
|
3028
|
+
#composer textarea,
|
|
3029
|
+
#composer textarea:focus-visible {
|
|
3030
|
+
border: 0; border-radius: 22px; padding: 11px 18px;
|
|
3031
|
+
background: var(--bg-raised); box-shadow: var(--soft-shadow);
|
|
3032
|
+
}
|
|
3033
|
+
#composer textarea:focus-visible {
|
|
3034
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber) 45%, transparent), 0 10px 28px -12px var(--amber);
|
|
3035
|
+
}
|
|
3036
|
+
.cmp-attach { border-radius: 50%; }
|
|
3037
|
+
#composer button.primary { border-radius: 22px; }
|
|
3038
|
+
|
|
3039
|
+
/* Floating menus: lifted, not outlined. */
|
|
3040
|
+
#moreMenu, #tabMenu, #verMenu, .slash-menu {
|
|
3041
|
+
border-color: transparent; border-radius: 14px;
|
|
3042
|
+
box-shadow: 0 22px 50px -18px rgba(0, 0, 0, .6), 0 0 0 1px var(--line);
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
/* Scrollbars: thin and rounded, gone until needed. */
|
|
3046
|
+
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 16%, transparent) transparent; }
|
|
3047
|
+
|
|
3048
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3049
|
+
.turn:not(.hist) { animation: none; }
|
|
3050
|
+
button:active:not(:disabled) { transform: none; }
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
/* ══ Shadok soul ═════════════════════════════════════════════════════════
|
|
3054
|
+
The Shadok's voice (shadok-soul.js): the header mark answers a click with a
|
|
3055
|
+
maxim in a speech bubble, the empty states carry a big Shadok and a thought,
|
|
3056
|
+
and the thinking indicator rotates its pump lines. Few pixels, much logic. */
|
|
3057
|
+
header .brand { position: relative; }
|
|
3058
|
+
header .brand-logo { cursor: pointer; outline-offset: 3px; }
|
|
3059
|
+
header .brand-logo.speaking svg { animation: sk-hop .6s var(--ease-fluid); }
|
|
3060
|
+
.sk-say {
|
|
3061
|
+
position: absolute; top: calc(100% + 10px); left: 0; z-index: 60;
|
|
3062
|
+
width: max-content; max-width: 280px;
|
|
3063
|
+
padding: 10px 14px; border-radius: 16px 16px 16px 4px;
|
|
3064
|
+
background: var(--bg-raised); color: var(--text);
|
|
3065
|
+
font-size: 13px; font-weight: 500; line-height: 1.4;
|
|
3066
|
+
box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .55), 0 0 0 1px var(--line);
|
|
3067
|
+
opacity: 0; transform: translateY(-6px) scale(.96); transform-origin: 12px 0;
|
|
3068
|
+
pointer-events: none;
|
|
3069
|
+
transition: opacity .25s var(--ease-fluid), transform .3s var(--ease-fluid);
|
|
3070
|
+
}
|
|
3071
|
+
.sk-say::before {
|
|
3072
|
+
content: ""; position: absolute; top: -6px; left: 12px; width: 12px; height: 12px;
|
|
3073
|
+
background: inherit; transform: rotate(45deg); border-radius: 2px;
|
|
3074
|
+
}
|
|
3075
|
+
.sk-say.show { opacity: 1; transform: none; }
|
|
3076
|
+
|
|
3077
|
+
.es-shadok { display: inline-flex; color: var(--amber); filter: drop-shadow(0 12px 18px color-mix(in srgb, var(--amber) 35%, transparent)); }
|
|
3078
|
+
.es-shadok svg { width: 84px; height: 84px; overflow: visible; }
|
|
3079
|
+
#emptyState .es-shadok { animation: es-float 3.2s ease-in-out infinite; }
|
|
3080
|
+
@keyframes es-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
|
|
3081
|
+
.es-maxim { margin-top: 6px; color: var(--text-dim); font-size: 13px; font-style: italic; max-width: 40ch; }
|
|
3082
|
+
.es-maxim:empty { display: none; }
|
|
3083
|
+
.es-maxim::before { content: "“"; } .es-maxim::after { content: "”"; }
|
|
3084
|
+
|
|
3085
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3086
|
+
#emptyState .es-shadok, header .brand-logo.speaking svg { animation: none; }
|
|
3087
|
+
.sk-say { transition: none; }
|
|
3088
|
+
}
|
|
2913
3089
|
</style>
|
|
2914
3090
|
<!-- Light/dark mode is a per-browser choice (localStorage). Set it BEFORE the
|
|
2915
3091
|
body paints — here in <head> — so a light-preferring viewer never sees a
|
|
@@ -2948,7 +3124,7 @@
|
|
|
2948
3124
|
<body>
|
|
2949
3125
|
|
|
2950
3126
|
<header>
|
|
2951
|
-
<span class="brand"><span class="brand-logo" aria-
|
|
3127
|
+
<span class="brand"><span class="brand-logo" role="button" tabindex="0" aria-label="Ask the Shadok" title="Ask the Shadok"><svg viewBox="0 0 32 32"><g fill="currentColor" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><g class="sk-leg sk-leg-l"><line x1="13" y1="23" x2="12.6" y2="30.6"/><line x1="11" y1="30.7" x2="14.1" y2="30.7"/></g><g class="sk-leg sk-leg-r"><line x1="18.6" y1="23" x2="19" y2="30.6"/><line x1="17.6" y1="30.7" x2="20.7" y2="30.7"/></g><g class="sk-bob"><line class="sk-arm" x1="21.6" y1="17.2" x2="26" y2="20.4"/><g class="sk-ant sk-ant-l" stroke-width="0.9"><line x1="13.8" y1="5.4" x2="11.8" y2="2.8"/><circle cx="11.8" cy="2.8" r="1" stroke="none"/></g><g class="sk-ant sk-ant-r" stroke-width="0.9"><line x1="18.2" y1="5.4" x2="20.2" y2="2.8"/><circle cx="20.2" cy="2.8" r="1" stroke="none"/></g><circle cx="16" cy="16.2" r="8.4" stroke="none"/><path d="M14.4 18.2 L17.6 18.2 L16 21.6 Z" stroke="none"/><g class="sk-eyes" stroke="none"><circle cx="13.1" cy="7.8" r="2.6" fill="#fff"/><circle cx="18.9" cy="7.8" r="2.6" fill="#fff"/><g class="sk-pupils"><circle cx="13.4" cy="8.1" r="1.3"/><circle cx="19.2" cy="8.1" r="1.3"/></g></g></g></g></svg></span><span class="brand-name" id="brandName" title="Rename this cockpit">shadok-ai</span><span class="brand-edit" id="brandEdit" title="Rename this cockpit" aria-hidden="true">✎</span> <span class="ver" id="verView" title="Running version"></span><span class="ver-chan" id="verChan" aria-hidden="true"></span></span>
|
|
2952
3128
|
<span class="spacer"></span>
|
|
2953
3129
|
<div class="quotas">
|
|
2954
3130
|
<div class="quota" id="quota5h" data-window="5h" role="img" aria-label="5h rolling limit" title="5h rolling limit">
|
|
@@ -3821,10 +3997,15 @@
|
|
|
3821
3997
|
<!-- No agent: an invitation, not a pre-filled form. Creation happens in a
|
|
3822
3998
|
popin (#setupOverlay) and only creates the channel on submit — opening it
|
|
3823
3999
|
then backing out no longer leaves a stillborn tab. -->
|
|
4000
|
+
<!-- .es-shadok is filled by the script (`shadokInner`, the favicon's drawing):
|
|
4001
|
+
idle and bobbing here, pumping in #startingState. .es-maxim gets a fresh
|
|
4002
|
+
maxim each time the empty state shows (shadok-soul.js). -->
|
|
3824
4003
|
<div id="emptyState">
|
|
4004
|
+
<span class="es-shadok" aria-hidden="true"></span>
|
|
3825
4005
|
<span class="es-title">No agent open</span>
|
|
3826
4006
|
<p class="es-hint">Every agent is a real Claude Code session with its own directory and its own branch. Start one and it takes the controls.</p>
|
|
3827
4007
|
<button class="primary" id="emptyNewBtn">+ new agent</button>
|
|
4008
|
+
<p class="es-maxim"></p>
|
|
3828
4009
|
</div>
|
|
3829
4010
|
|
|
3830
4011
|
<!-- The same "nothing to show" moment, but one the server has told us is
|
|
@@ -3835,6 +4016,7 @@
|
|
|
3835
4016
|
being born; the two are told apart by GET /first-agent, never guessed
|
|
3836
4017
|
from the tab count. -->
|
|
3837
4018
|
<div id="startingState">
|
|
4019
|
+
<span class="es-shadok pumping" aria-hidden="true"></span>
|
|
3838
4020
|
<span class="es-title">Starting your first agent…</span>
|
|
3839
4021
|
<p class="es-hint">This cockpit has no agent yet, so one is being started for you in the launch directory. It takes a few seconds, then it takes the controls and says hello.</p>
|
|
3840
4022
|
</div>
|
|
@@ -4022,6 +4204,10 @@
|
|
|
4022
4204
|
import { searchEmoji, looksLikeEmoji } from "/emoji-search.js?v=__ASSET_V__";
|
|
4023
4205
|
window.searchEmoji = searchEmoji;
|
|
4024
4206
|
window.looksLikeEmoji = looksLikeEmoji;
|
|
4207
|
+
import { pumpLine, mascotSay, pickMaxim } from "/shadok-soul.js?v=__ASSET_V__";
|
|
4208
|
+
window.pumpLine = pumpLine;
|
|
4209
|
+
window.mascotSay = mascotSay;
|
|
4210
|
+
window.pickMaxim = pickMaxim;
|
|
4025
4211
|
import { uploadFailure } from "/upload.js?v=__ASSET_V__";
|
|
4026
4212
|
window.uploadFailure = uploadFailure;
|
|
4027
4213
|
import { fmtExpiry, expiryWarning, accountExpiryLine } from "/auth-expiry.js?v=__ASSET_V__";
|
|
@@ -4214,6 +4400,11 @@
|
|
|
4214
4400
|
looksLikeEmoji: () => false,
|
|
4215
4401
|
uploadFailure: (status, contentType) =>
|
|
4216
4402
|
/json/i.test(contentType || "") ? null : status === 413 ? "too large (over the server's upload limit)" : `upload failed (HTTP ${status || "?"})`,
|
|
4403
|
+
// The Shadok's voice (shadok-soul.js): before the module lands it says the
|
|
4404
|
+
// classic line, one maxim, and the empty state's thought stays empty (hidden).
|
|
4405
|
+
pumpLine: () => "Shadok is pumping",
|
|
4406
|
+
mascotSay: () => "When in doubt, pump.",
|
|
4407
|
+
pickMaxim: () => "",
|
|
4217
4408
|
};
|
|
4218
4409
|
for (const [name, stub] of Object.entries(BRIDGE_STUBS)) {
|
|
4219
4410
|
if (typeof window[name] !== "function") { stub.__stub = true; window[name] = stub; }
|
|
@@ -6862,13 +7053,66 @@
|
|
|
6862
7053
|
`<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">${shadokInner("currentColor", { lever, bob })}</svg>`;
|
|
6863
7054
|
}
|
|
6864
7055
|
renderTw(0); // populate immediately so it isn't blank on first show
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
7056
|
+
// The empty states get the same Shadok, big: idle in #emptyState (CSS bobs
|
|
7057
|
+
// it), pumping in #startingState — the first agent is being pumped into being.
|
|
7058
|
+
const esIdle = document.querySelector("#emptyState .es-shadok");
|
|
7059
|
+
const esPump = document.querySelector("#startingState .es-shadok");
|
|
7060
|
+
const startingEl = document.getElementById("startingState");
|
|
7061
|
+
const shadokSvg = (pose) => `<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">${shadokInner("currentColor", pose)}</svg>`;
|
|
7062
|
+
if (esIdle) esIdle.innerHTML = shadokSvg({});
|
|
7063
|
+
if (esPump) esPump.innerHTML = shadokSvg(pumpPose(0));
|
|
7064
|
+
// The indicator's words rotate through the Shadok's pump lines (shadok-soul.js)
|
|
7065
|
+
// from the moment a turn shows it; that is text, not motion, so it runs under
|
|
7066
|
+
// reduced motion too — only the pumping frames are gated.
|
|
7067
|
+
const twText = document.querySelector("#thinking .tw-text");
|
|
7068
|
+
const pumpMotion = !(window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches);
|
|
7069
|
+
let twPhase = 0, twSince = 0;
|
|
7070
|
+
setInterval(() => {
|
|
7071
|
+
const thinkingOn = !!thinkingEl && thinkingEl.classList.contains("visible");
|
|
7072
|
+
const startingOn = !!startingEl && startingEl.classList.contains("visible");
|
|
7073
|
+
if (!thinkingOn) twSince = 0;
|
|
7074
|
+
if (!thinkingOn && !startingOn) return;
|
|
7075
|
+
if (thinkingOn && twText && window.pumpLine) {
|
|
7076
|
+
if (!twSince) twSince = Date.now();
|
|
7077
|
+
const line = window.pumpLine(Date.now() - twSince);
|
|
7078
|
+
if (twText.textContent !== line) twText.textContent = line;
|
|
7079
|
+
}
|
|
7080
|
+
if (!pumpMotion) return;
|
|
7081
|
+
twPhase = (twPhase + 1) % PUMP_FRAMES;
|
|
7082
|
+
const p = (Math.sin((twPhase / PUMP_FRAMES) * 2 * Math.PI - Math.PI / 2) + 1) / 2;
|
|
7083
|
+
if (thinkingOn) renderTw(p);
|
|
7084
|
+
if (startingOn && esPump) esPump.innerHTML = shadokSvg(pumpPose(p));
|
|
7085
|
+
}, 95);
|
|
7086
|
+
|
|
7087
|
+
// Click the header mark and the Shadok says something: a maxim, or now and
|
|
7088
|
+
// then a head count of the agents in Shadok numerals. One bubble, re-used; a
|
|
7089
|
+
// second click while it is up just gives a new thought.
|
|
7090
|
+
const brandLogo = document.querySelector("header .brand-logo");
|
|
7091
|
+
let skSay = null, skSayTimer = 0, skLast = null;
|
|
7092
|
+
function shadokSpeak() {
|
|
7093
|
+
if (!brandLogo || !window.mascotSay) return;
|
|
7094
|
+
if (!skSay) {
|
|
7095
|
+
skSay = document.createElement("span");
|
|
7096
|
+
skSay.className = "sk-say";
|
|
7097
|
+
skSay.setAttribute("role", "status");
|
|
7098
|
+
brandLogo.parentElement.appendChild(skSay);
|
|
7099
|
+
}
|
|
7100
|
+
skLast = window.mascotSay(tabs.length, Math.random, skLast);
|
|
7101
|
+
skSay.textContent = skLast;
|
|
7102
|
+
skSay.classList.remove("show");
|
|
7103
|
+
void skSay.offsetWidth; // restart the pop-in on a repeat click
|
|
7104
|
+
skSay.classList.add("show");
|
|
7105
|
+
brandLogo.classList.remove("speaking");
|
|
7106
|
+
void brandLogo.offsetWidth;
|
|
7107
|
+
brandLogo.classList.add("speaking");
|
|
7108
|
+
clearTimeout(skSayTimer);
|
|
7109
|
+
skSayTimer = setTimeout(() => { skSay.classList.remove("show"); brandLogo.classList.remove("speaking"); }, 5200);
|
|
7110
|
+
}
|
|
7111
|
+
if (brandLogo) {
|
|
7112
|
+
brandLogo.addEventListener("click", (e) => { e.stopPropagation(); shadokSpeak(); });
|
|
7113
|
+
brandLogo.addEventListener("keydown", (e) => {
|
|
7114
|
+
if (e.key === "Enter" || e.key === " ") { e.preventDefault(); shadokSpeak(); }
|
|
7115
|
+
});
|
|
6872
7116
|
}
|
|
6873
7117
|
// Coming back must stop the blink at once, not at the next tick. Both signals
|
|
6874
7118
|
// matter: switching tabs fires visibilitychange, switching application only
|
|
@@ -7018,6 +7262,11 @@
|
|
|
7018
7262
|
// second lead agent while theirs is being born.
|
|
7019
7263
|
$("emptyState").classList.toggle("visible", !firstAgentPending);
|
|
7020
7264
|
$("startingState").classList.toggle("visible", firstAgentPending);
|
|
7265
|
+
// A fresh Shadok thought each time the empty panel shows. The bridge may
|
|
7266
|
+
// not be up yet on the very first paint (invariant 10): then the line
|
|
7267
|
+
// stays empty, which is harmless.
|
|
7268
|
+
const esMaxim = document.querySelector("#emptyState .es-maxim");
|
|
7269
|
+
if (esMaxim && window.pickMaxim) esMaxim.textContent = window.pickMaxim(Math.random, esMaxim.textContent);
|
|
7021
7270
|
return;
|
|
7022
7271
|
}
|
|
7023
7272
|
$("emptyState").classList.remove("visible");
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// The Shadok's voice. The cockpit already had the Shadok's BODY (the header
|
|
2
|
+
// mark, the pumping favicon, the thinking indicator); what it lacked was its
|
|
3
|
+
// logic — absurd, stubborn, cheerfully wrong-way-round. This module is that
|
|
4
|
+
// voice, pure and tested: the maxims the mascot says, the lines the thinking
|
|
5
|
+
// indicator cycles through, and counting the Shadok way (base 4: GA BU ZO MEU).
|
|
6
|
+
// Original lines written in the Shadoks' spirit, in English like the rest of
|
|
7
|
+
// the UI. Randomness is injected so every choice is reproducible in tests.
|
|
8
|
+
|
|
9
|
+
/** What the mascot says when you click it, and what the empty states muse. */
|
|
10
|
+
export const MAXIMS = [
|
|
11
|
+
"When in doubt, pump.",
|
|
12
|
+
"Every failed try is one try closer to the one that works.",
|
|
13
|
+
"No solution? Then there was never a problem.",
|
|
14
|
+
"Better to pump for nothing than to stop and find out.",
|
|
15
|
+
"Why one agent when twelve can disagree?",
|
|
16
|
+
"Green tests are suspicious. Pump again.",
|
|
17
|
+
"To go up, you first have to go down.",
|
|
18
|
+
"If it works, don't touch it. Pump it.",
|
|
19
|
+
"Thinking is just pumping with your eyes closed.",
|
|
20
|
+
"Every bug is a feature nobody pumped hard enough.",
|
|
21
|
+
"Pump today what you could pump tomorrow.",
|
|
22
|
+
"A Shadok never waits. It pumps while waiting.",
|
|
23
|
+
"The shortest path is the one with the most pumping.",
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/** The thinking indicator's lines, in order. The first is the classic one, so
|
|
27
|
+
* a short turn still reads exactly as it always did. */
|
|
28
|
+
export const PUMP_LINES = [
|
|
29
|
+
"Shadok is pumping",
|
|
30
|
+
"Pumping harder",
|
|
31
|
+
"Ga… Bu… Zo… Meu…",
|
|
32
|
+
"Pumping, therefore thinking",
|
|
33
|
+
"Still pumping",
|
|
34
|
+
"Pumping with conviction",
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
/** How long each pump line stays up. Long enough to be read, short enough that
|
|
38
|
+
* a minute-long turn shows the rotation. */
|
|
39
|
+
export const PUMP_LINE_MS = 3500;
|
|
40
|
+
|
|
41
|
+
/** The line to show `elapsedMs` into a turn. */
|
|
42
|
+
export function pumpLine(elapsedMs) {
|
|
43
|
+
const i = Math.floor(Math.max(0, elapsedMs || 0) / PUMP_LINE_MS);
|
|
44
|
+
return PUMP_LINES[i % PUMP_LINES.length];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const DIGITS = ["GA", "BU", "ZO", "MEU"];
|
|
48
|
+
|
|
49
|
+
/** `n` in the Shadoks' base 4: 0 → "GA", 4 → "BU GA", 11 → "ZO MEU". */
|
|
50
|
+
export function gabuzomeu(n) {
|
|
51
|
+
let v = Math.max(0, Math.floor(Number(n) || 0));
|
|
52
|
+
if (v === 0) return DIGITS[0];
|
|
53
|
+
const out = [];
|
|
54
|
+
while (v > 0) { out.unshift(DIGITS[v % 4]); v = Math.floor(v / 4); }
|
|
55
|
+
return out.join(" ");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A maxim, never the same one twice in a row (`prev`), so clicking the
|
|
59
|
+
* mascot again always gets a new thought. `rand` is Math.random-shaped. */
|
|
60
|
+
export function pickMaxim(rand = Math.random, prev = null) {
|
|
61
|
+
const pool = MAXIMS.filter((m) => m !== prev);
|
|
62
|
+
return pool[Math.min(pool.length - 1, Math.floor(rand() * pool.length))];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** What the mascot says: usually a maxim, now and then a head count of the
|
|
66
|
+
* agents in Shadok numerals (one draw in five, when there is anyone to count). */
|
|
67
|
+
export function mascotSay(agentCount, rand = Math.random, prev = null) {
|
|
68
|
+
const n = Math.max(0, Math.floor(Number(agentCount) || 0));
|
|
69
|
+
if (n > 0 && rand() < 0.2) {
|
|
70
|
+
const line = `${gabuzomeu(n)} agent${n === 1 ? "" : "s"} pumping. That's ${n}, for the non-Shadoks.`;
|
|
71
|
+
if (line !== prev) return line;
|
|
72
|
+
}
|
|
73
|
+
return pickMaxim(rand, prev);
|
|
74
|
+
}
|