shadok-ai 0.19.77 → 0.19.79
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/README.md +3 -3
- package/package.json +1 -1
- package/public/bar-overflow.js +62 -0
- package/public/index.html +95 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<h3>Many Claude Codes. One cockpit. And it wrote itself.</h3>
|
|
6
6
|
|
|
7
|
-
<p>Run <b>real</b> Claude Code sessions side by side,
|
|
7
|
+
<p>Run <b>real</b> Claude Code sessions side by side,
|
|
8
8
|
on the Claude subscription you already pay for. When one of them has a question,
|
|
9
9
|
you answer it with a click — in the browser, or from Telegram when you are not
|
|
10
10
|
at the desk.</p>
|
|
@@ -22,7 +22,7 @@ at the desk.</p>
|
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
24
|
**It does not stop at one.** An agent can start other agents — each with its own
|
|
25
|
-
|
|
25
|
+
branch and role — and it is told when one of its own finishes, blocks on
|
|
26
26
|
a question, or dies. Nothing else wakes it.
|
|
27
27
|
|
|
28
28
|
**It keeps working when you are not there.** Mirror an agent to a Telegram topic
|
|
@@ -37,7 +37,7 @@ windows, and can hold an agent back when it is burning faster than the window
|
|
|
37
37
|
elapses.
|
|
38
38
|
|
|
39
39
|
**It wrote itself.** shadok-ai is largely built by agents running inside shadok-ai,
|
|
40
|
-
in
|
|
40
|
+
in isolation, landed as reviewed pull requests. The section below is what
|
|
41
41
|
that produced.
|
|
42
42
|
|
|
43
43
|
## Quick start
|
package/package.json
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Pure core of the phone header overflow: when a bar row does not fit, its
|
|
2
|
+
// icons go to that bar's ⋯ menu, one at a time, in a fixed order, until it fits.
|
|
3
|
+
// The DOM glue (measuring, moving) lives in index.html; this file only decides,
|
|
4
|
+
// so it is tested without a browser.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Show every item, then hide them one by one, in `items` order, until `fits()`
|
|
8
|
+
* says the row fits (or nothing is left to hide). Returns how many were hidden.
|
|
9
|
+
* Starting from "all shown" every time is what makes it reversible: a wider
|
|
10
|
+
* screen, a shorter agent name or a badge going away brings the icons back.
|
|
11
|
+
*/
|
|
12
|
+
export function shrinkToFit(items, { show, hide, fits }) {
|
|
13
|
+
for (const it of items) show(it);
|
|
14
|
+
let hidden = 0;
|
|
15
|
+
for (const it of items) {
|
|
16
|
+
if (fits()) break;
|
|
17
|
+
hide(it);
|
|
18
|
+
hidden++;
|
|
19
|
+
}
|
|
20
|
+
return hidden;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Does a name that may ellipsize still read? It does when it is not cut at all,
|
|
25
|
+
* or when it keeps at least `minPx` on screen (a long name cut after a dozen
|
|
26
|
+
* letters is fine; "ca…" is not).
|
|
27
|
+
*/
|
|
28
|
+
export function nameReads({ clientWidth, scrollWidth }, minPx) {
|
|
29
|
+
return scrollWidth <= clientWidth || clientWidth >= minPx;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The agent bar's icons, in the order they leave the row: least used first,
|
|
34
|
+
* the chat/terminal switch last. Schedule and Webhooks are already items of the
|
|
35
|
+
* agent menu, so hiding them needs no extra entry (`menu: null`).
|
|
36
|
+
*/
|
|
37
|
+
export const CHAN_OVERFLOW = [
|
|
38
|
+
{ id: "chanWebhooks", menu: null },
|
|
39
|
+
{ id: "chanGallery", menu: "🖼 Media gallery" },
|
|
40
|
+
{ id: "chanCron", menu: null },
|
|
41
|
+
{ id: "chanInfo", menu: "ℹ About this agent" },
|
|
42
|
+
{ id: "chanTerm", menu: "⌨ Terminal", menuOn: "💬 Back to the chat" },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
/** The agent bar's overflowable icon ids, in the order they leave the row. */
|
|
46
|
+
export function chanOverflowIds() {
|
|
47
|
+
return CHAN_OVERFLOW.map((it) => it.id);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The entries the agent menu gains for the icons hidden from the bar, in the
|
|
52
|
+
* order they left it. `hidden` is the set of hidden ids, `on` the set of toggles currently
|
|
53
|
+
* pressed (the terminal view).
|
|
54
|
+
*/
|
|
55
|
+
export function chanOverflowItems(hidden, on = new Set()) {
|
|
56
|
+
const out = [];
|
|
57
|
+
for (const it of CHAN_OVERFLOW) {
|
|
58
|
+
if (!it.menu || !hidden.has(it.id)) continue;
|
|
59
|
+
out.push({ id: it.id, label: on.has(it.id) && it.menuOn ? it.menuOn : it.menu });
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
package/public/index.html
CHANGED
|
@@ -538,6 +538,16 @@
|
|
|
538
538
|
Hidden entirely when nothing overflowed. */
|
|
539
539
|
.mm-tools { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
|
|
540
540
|
.mm-tools:empty { display: none; }
|
|
541
|
+
/* An agent-bar icon with no room on a phone: it lives in the agent ⋯ menu
|
|
542
|
+
instead (reflowChanBar, bar-overflow.js). */
|
|
543
|
+
#chanBar .chan-actions .bar-ovf { display: none !important; }
|
|
544
|
+
/* A badge-carrying header icon (Security, Reports) pushed into ⋯ for lack of
|
|
545
|
+
room: its badge must still be seen, so ⋯ wears a dot. */
|
|
546
|
+
.more-wrap:has(#overflowTools .sec-badge:not([hidden])) #moreBtn { position: relative; }
|
|
547
|
+
.more-wrap:has(#overflowTools .sec-badge:not([hidden])) #moreBtn::after {
|
|
548
|
+
content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px;
|
|
549
|
+
border-radius: 50%; background: var(--err);
|
|
550
|
+
}
|
|
541
551
|
#moreMenu .mm-tools button { width: auto; } /* override #moreMenu button width:100% */
|
|
542
552
|
#moreMenu .mm-sep { height: 1px; background: var(--line); margin: 4px 2px; }
|
|
543
553
|
#moreMenu .mm-label { padding: 2px 4px; font-size: 12px; font-weight: 500; color: var(--text-dim); }
|
|
@@ -2072,6 +2082,10 @@
|
|
|
2072
2082
|
#chanBar #dirGauge, #chanBar #branchGauge { display: none !important; }
|
|
2073
2083
|
#chanBar .gauge .label { display: none; } /* values only, more compact */
|
|
2074
2084
|
#chanBar { gap: 6px; padding: 6px 10px; }
|
|
2085
|
+
/* The status word ("idle", "working") never yields to the name: squeezed, it
|
|
2086
|
+
read as a bare "…". The agent's name is the elastic item, and when it gets
|
|
2087
|
+
too short reflowChanBar moves icons into the ⋯ menu instead. */
|
|
2088
|
+
#chanBar .gauge:has(#state) { flex-shrink: 0; }
|
|
2075
2089
|
/* One header row: brand + dials + ⋯. reflowHeaderTools (JS) moves ALL tool
|
|
2076
2090
|
icons into the ⋯ menu, and `nowrap` makes the brand — the one elastic item
|
|
2077
2091
|
— ABSORB the squeeze instead of shoving a dial onto a second line. Before
|
|
@@ -4698,6 +4712,7 @@
|
|
|
4698
4712
|
applyReadonlyPreset, isManagedProfile, profileSaveBody, secretUsers, secretDeleteConfirmText } from "/profile-card.js?v=__ASSET_V__";
|
|
4699
4713
|
import { secretsPanelMode, secretSections, keyGroups, shareTargets, auditLine, panelGroupOptions, publicWriteTarget, secretChipPick, secretReceivers, plusReloadPlan } from "/secrets-panel.js?v=__ASSET_V__";
|
|
4700
4714
|
import { notifyState, BLINK_MS } from "/notify.js?v=__ASSET_V__";
|
|
4715
|
+
import { shrinkToFit, nameReads, chanOverflowIds, chanOverflowItems } from "/bar-overflow.js?v=__ASSET_V__";
|
|
4701
4716
|
import { echoAuthor, isOwnPrompt } from "/echo-author.js?v=__ASSET_V__";
|
|
4702
4717
|
import { dialPos, dialColor, dialTitle } from "/gauge-dial.js?v=__ASSET_V__";
|
|
4703
4718
|
import { TOUR_STEPS, bubblePlacement, unionRect, visibleSteps } from "/tour-steps.js?v=__ASSET_V__";
|
|
@@ -4800,6 +4815,12 @@
|
|
|
4800
4815
|
window.defaultAgentName = defaultAgentName;
|
|
4801
4816
|
window.secretUsers = secretUsers;
|
|
4802
4817
|
window.secretDeleteConfirmText = secretDeleteConfirmText;
|
|
4818
|
+
window.shrinkToFit = shrinkToFit;
|
|
4819
|
+
window.nameReads = nameReads;
|
|
4820
|
+
window.chanOverflowIds = chanOverflowIds;
|
|
4821
|
+
window.chanOverflowItems = chanOverflowItems;
|
|
4822
|
+
// The module is deferred: the first reflow ran on the stubs, so run it again.
|
|
4823
|
+
window.scheduleBarReflow?.();
|
|
4803
4824
|
window.secretsPanelMode = secretsPanelMode;
|
|
4804
4825
|
window.secretSections = secretSections;
|
|
4805
4826
|
window.panelGroupOptions = panelGroupOptions;
|
|
@@ -4960,6 +4981,11 @@
|
|
|
4960
4981
|
profileSaveBody: (form) => ({ ...form }),
|
|
4961
4982
|
secretUsers: () => [],
|
|
4962
4983
|
secretDeleteConfirmText: (name) => "Remove the secret " + name + " from the vault?",
|
|
4984
|
+
// Before the module lands: hide nothing, report "fits" — the bars keep their icons.
|
|
4985
|
+
shrinkToFit: () => 0,
|
|
4986
|
+
nameReads: () => true,
|
|
4987
|
+
chanOverflowIds: () => [],
|
|
4988
|
+
chanOverflowItems: () => [],
|
|
4963
4989
|
// Before the module lands: the flat list (today's look) and no groups.
|
|
4964
4990
|
secretsPanelMode: () => "flat",
|
|
4965
4991
|
secretSections: () => ({ own: [], sharedIn: [], inheritedMain: [] }),
|
|
@@ -6178,7 +6204,7 @@
|
|
|
6178
6204
|
} catch { return ""; }
|
|
6179
6205
|
}
|
|
6180
6206
|
|
|
6181
|
-
function openTabMenu(tab, x, y) {
|
|
6207
|
+
function openTabMenu(tab, x, y, extra = []) {
|
|
6182
6208
|
tabMenu.replaceChildren();
|
|
6183
6209
|
if (tab.roomId) return openRoomMenu(tab, x, y);
|
|
6184
6210
|
// Header: WHO this agent is. The profile is what qualifies it (role,
|
|
@@ -6237,6 +6263,7 @@
|
|
|
6237
6263
|
}
|
|
6238
6264
|
tabMenu.appendChild(head);
|
|
6239
6265
|
const items = [
|
|
6266
|
+
...extra,
|
|
6240
6267
|
[tab.muted ? "🔔 Unmute notifications" : "🔕 Mute notifications",
|
|
6241
6268
|
() => setMuted(tab, !tab.muted)],
|
|
6242
6269
|
["↻ Reload agent", () => reloadTab(tab)],
|
|
@@ -12919,7 +12946,12 @@
|
|
|
12919
12946
|
e.stopPropagation();
|
|
12920
12947
|
if (!active) return;
|
|
12921
12948
|
const r = e.currentTarget.getBoundingClientRect();
|
|
12922
|
-
|
|
12949
|
+
// The bar icons hidden for lack of room come back as menu entries, at the
|
|
12950
|
+
// top (bar-overflow.js): clicking one clicks the real button.
|
|
12951
|
+
const hidden = new Set(window.chanOverflowIds().filter((id) => $(id)?.classList.contains("bar-ovf")));
|
|
12952
|
+
const on = new Set(window.chanOverflowIds().filter((id) => $(id)?.classList.contains("on")));
|
|
12953
|
+
const extra = window.chanOverflowItems(hidden, on).map((it) => [it.label, () => $(it.id).click()]);
|
|
12954
|
+
openTabMenu(active, r.right, r.bottom + 4, extra);
|
|
12923
12955
|
});
|
|
12924
12956
|
|
|
12925
12957
|
// "⋯" overflow menu (rarely-used actions, e.g. Diff). stopPropagation on the
|
|
@@ -12964,15 +12996,74 @@
|
|
|
12964
12996
|
if (el) overflow.appendChild(el);
|
|
12965
12997
|
}
|
|
12966
12998
|
}
|
|
12999
|
+
// Then, on a phone, the icons that stay on the row (Security, Reports, Users
|
|
13000
|
+
// — kept for their badge) still leave it when the row does not fit: the
|
|
13001
|
+
// instance name is the one elastic item, and it was squeezed to nothing.
|
|
13002
|
+
// Moved in this order; a badge on a moved one shows as a dot on ⋯ (CSS).
|
|
13003
|
+
const SQUEEZE_TOOLS = ["usersBtn", "reportsBtn", "securityBtn"];
|
|
13004
|
+
const NAME_MIN_PX = 64;
|
|
13005
|
+
// The agent's name is what tells two agents apart: it gets more room.
|
|
13006
|
+
const AGENT_NAME_MIN_PX = 120;
|
|
13007
|
+
function reflowHeaderSqueeze() {
|
|
13008
|
+
const hdrTools = document.querySelector(".hdr-tools");
|
|
13009
|
+
const moreWrap = document.querySelector(".more-wrap");
|
|
13010
|
+
const overflow = $("overflowTools");
|
|
13011
|
+
if (!hdrTools || !moreWrap || !overflow) return;
|
|
13012
|
+
const back = (id) => { const el = $(id); if (el) hdrTools.insertBefore(el, moreWrap); };
|
|
13013
|
+
if (!matchMedia("(max-width: 640px)").matches) {
|
|
13014
|
+
// Desktop: back in the header, in their original order.
|
|
13015
|
+
for (const id of [...SQUEEZE_TOOLS].reverse()) back(id);
|
|
13016
|
+
return;
|
|
13017
|
+
}
|
|
13018
|
+
const name = $("brandName");
|
|
13019
|
+
window.shrinkToFit([...SQUEEZE_TOOLS], {
|
|
13020
|
+
show: back,
|
|
13021
|
+
hide: (id) => { const el = $(id); if (el) overflow.prepend(el); },
|
|
13022
|
+
fits: () => !name || window.nameReads(name, NAME_MIN_PX),
|
|
13023
|
+
});
|
|
13024
|
+
}
|
|
13025
|
+
// The agent bar: same rule, the agent's name in the picker is what must stay
|
|
13026
|
+
// readable. Hidden icons get `.bar-ovf` (display: none) and reappear as items
|
|
13027
|
+
// of the agent ⋯ menu — they are not moved, so their own state (`.on`) stays.
|
|
13028
|
+
function reflowChanBar() {
|
|
13029
|
+
const items = window.chanOverflowIds();
|
|
13030
|
+
const name = $("pickerName");
|
|
13031
|
+
const mobile = matchMedia("(max-width: 640px)").matches;
|
|
13032
|
+
window.shrinkToFit(items, {
|
|
13033
|
+
show: (id) => $(id)?.classList.remove("bar-ovf"),
|
|
13034
|
+
hide: (id) => $(id)?.classList.add("bar-ovf"),
|
|
13035
|
+
fits: () => !mobile || !name || $("chanBar").hidden || window.nameReads(name, AGENT_NAME_MIN_PX),
|
|
13036
|
+
});
|
|
13037
|
+
}
|
|
12967
13038
|
let reflowPending = false;
|
|
12968
13039
|
function scheduleReflow() {
|
|
12969
13040
|
if (reflowPending) return;
|
|
12970
13041
|
reflowPending = true;
|
|
12971
|
-
requestAnimationFrame(() => {
|
|
13042
|
+
requestAnimationFrame(() => {
|
|
13043
|
+
reflowPending = false;
|
|
13044
|
+
reflowHeaderTools();
|
|
13045
|
+
reflowHeaderSqueeze();
|
|
13046
|
+
reflowChanBar();
|
|
13047
|
+
});
|
|
12972
13048
|
}
|
|
13049
|
+
window.scheduleBarReflow = scheduleReflow;
|
|
12973
13050
|
window.addEventListener("resize", scheduleReflow);
|
|
12974
|
-
document.addEventListener("DOMContentLoaded",
|
|
13051
|
+
document.addEventListener("DOMContentLoaded", scheduleReflow);
|
|
12975
13052
|
reflowHeaderTools();
|
|
13053
|
+
// What changes the room without resizing the window: the agent switched or
|
|
13054
|
+
// renamed, the cockpit renamed, a badge-carrying icon shown or hidden, the bar
|
|
13055
|
+
// itself shown. Our own moves touch none of these, so this cannot loop.
|
|
13056
|
+
{
|
|
13057
|
+
const mo = new MutationObserver(scheduleReflow);
|
|
13058
|
+
for (const id of ["pickerName", "brandName", "verView", "state"]) {
|
|
13059
|
+
const el = $(id);
|
|
13060
|
+
if (el) mo.observe(el, { childList: true, characterData: true, subtree: true });
|
|
13061
|
+
}
|
|
13062
|
+
for (const id of [...SQUEEZE_TOOLS, "chanBar", "chanUpdate", "branchGauge"]) {
|
|
13063
|
+
const el = $(id);
|
|
13064
|
+
if (el) mo.observe(el, { attributes: true, attributeFilter: ["hidden"] });
|
|
13065
|
+
}
|
|
13066
|
+
}
|
|
12976
13067
|
|
|
12977
13068
|
// ── Diff panel ──────────────────────────────────────────
|
|
12978
13069
|
function colorDiff(text) {
|