clavarium 0.2.451-next.1 → 0.2.453-next.1
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/config/launch/claude-code.sh +2 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/web/app.js +68 -3
|
@@ -54,11 +54,11 @@ if [ -f "$chat/server.mjs" ]; then
|
|
|
54
54
|
|| echo "launch: the chat will not say when Claude Code works without a word" >&2
|
|
55
55
|
fi
|
|
56
56
|
# WHAT ITS SCREEN ASKS (02-11), read by the generic screen-watch -- Claude Code's own words, here and only
|
|
57
|
-
# here: not signed in, its sign-in started by itself, its link sent to the person's chat, the code they paste
|
|
57
|
+
# here: not signed in (at its start, or signed out on the way: « Login expired », 15-11), its sign-in started by itself, its link sent to the person's chat, the code they paste
|
|
58
58
|
# there typed back (02-11, tried on a real Claude Code); an update installed told to the agent, which restarts
|
|
59
59
|
# when it suits it (never in the middle of its work). A tool that changes its words: only these lines change.
|
|
60
60
|
node "$(dirname "$0")/screen-watch.mjs" \
|
|
61
|
-
'type:Not logged in
|
|
61
|
+
'type:(Not logged in|Login expired|OAuth token (has )?expired|Invalid API key)[^\n]{0,24}/login=/login' \
|
|
62
62
|
'keys:Select login method:=Enter' \
|
|
63
63
|
'link:https://(claude\.ai|claude\.com|console\.anthropic\.com)/\S*oauth\S*' \
|
|
64
64
|
'code:Paste code here' \
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.453-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.453-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/web/app.js
CHANGED
|
@@ -1993,6 +1993,8 @@
|
|
|
1993
1993
|
paintChips();
|
|
1994
1994
|
paintHealth();
|
|
1995
1995
|
if (!DEVICE) void paintGauge();
|
|
1996
|
+
/* The chats of the others, kept for a switch at once (15-11): what moved, fetched in the background. */
|
|
1997
|
+
if (!DEVICE) void keepChats();
|
|
1996
1998
|
const now = mark(conversations.find((x) => x.name === current));
|
|
1997
1999
|
paintActions();
|
|
1998
2000
|
if (before !== now || now.startsWith('building') || now.startsWith('restarting') || now.startsWith('moving')) enter(true);
|
|
@@ -3564,6 +3566,40 @@
|
|
|
3564
3566
|
send, the words of this device's language, and how a file is opened. */
|
|
3565
3567
|
let talk = { on: false, messages: [] };
|
|
3566
3568
|
let talkOf = '';
|
|
3569
|
+
/* KEPT CHATS (15-11): another conversation opened shows its chat at once, never a blank one while it
|
|
3570
|
+
comes. This page keeps, in memory only, each one's chat state and the end of its thread: fetched in
|
|
3571
|
+
the background, one at a time, for those of the list whose chat is on; again only when the list says
|
|
3572
|
+
it moved, and then only what changed (the server's cursor). The chat open keeps its own copy as it
|
|
3573
|
+
looks again. Opened, the copy is drawn at once, then the whole window is fetched and put in its place. */
|
|
3574
|
+
const KEPT_LAST = 50;
|
|
3575
|
+
const kept = new Map();
|
|
3576
|
+
/* Kept once loaded: an import() asked again resolves only after the next frame, a blank one. */
|
|
3577
|
+
let parleyLoaded = null;
|
|
3578
|
+
const parleyUi = () => (parleyLoaded ? Promise.resolve(parleyLoaded) : import(new URL('vendor/parley-ui.js', new URL(DEVICE ? '/c/' : '/', location.href)).href).then((m) => { parleyLoaded = m; return m; }));
|
|
3579
|
+
const keptOf = (name) => { if (!kept.has(name)) kept.set(name, { state: null, thread: null, mark: '' }); return kept.get(name); };
|
|
3580
|
+
let keeping = false;
|
|
3581
|
+
async function keepChats() {
|
|
3582
|
+
if (DEVICE || keeping || document.hidden) return;
|
|
3583
|
+
keeping = true;
|
|
3584
|
+
try {
|
|
3585
|
+
for (const n of [...kept.keys()]) if (!conversations.some((x) => x.name === n && x.talk)) kept.delete(n);
|
|
3586
|
+
const { since } = await parleyUi();
|
|
3587
|
+
for (const c of [...conversations]) {
|
|
3588
|
+
if (!c.talk || c.phase !== 'ready' || c.name === threadOf) continue;
|
|
3589
|
+
const mark = JSON.stringify(c.talk);
|
|
3590
|
+
const was = kept.get(c.name);
|
|
3591
|
+
if (was?.mark === mark && was.thread) continue;
|
|
3592
|
+
const cursor = typeof was?.thread?.cursor === 'string' && was.thread.cursor ? was.thread.cursor : null;
|
|
3593
|
+
const ask = (params) => fetch(talkPath(c.name, '', params)).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
|
3594
|
+
const [state, got] = await Promise.all([ask({ state: 1 }), ask({ last: KEPT_LAST, ...(cursor ? { since: cursor } : {}) })]);
|
|
3595
|
+
/* Opened meanwhile: its chat keeps its own copy. */
|
|
3596
|
+
if (c.name === threadOf) continue;
|
|
3597
|
+
if (state && state.on !== true) { kept.delete(c.name); continue; }
|
|
3598
|
+
if (!state || !Array.isArray(got?.messages)) continue;
|
|
3599
|
+
kept.set(c.name, { state, thread: cursor ? since(was.thread, got) : got, mark });
|
|
3600
|
+
}
|
|
3601
|
+
} finally { keeping = false; }
|
|
3602
|
+
}
|
|
3567
3603
|
let chatView = 'simple';
|
|
3568
3604
|
try { chatView = localStorage.getItem('clavarium-chat-view') === 'detailed' ? 'detailed' : 'simple'; } catch { /* a private window */ }
|
|
3569
3605
|
/* "Send when I stop", for dictation in the chat: kept by this device. */
|
|
@@ -3605,6 +3641,7 @@
|
|
|
3605
3641
|
/* Asked for the one before, answered once another was open: not taken for this one's. */
|
|
3606
3642
|
if (name !== current) return talk;
|
|
3607
3643
|
talk = got; talkOf = name;
|
|
3644
|
+
if (talk.on) keptOf(name).state = talk; else kept.delete(name);
|
|
3608
3645
|
return talk;
|
|
3609
3646
|
}
|
|
3610
3647
|
async function paintThread() {
|
|
@@ -3639,7 +3676,7 @@
|
|
|
3639
3676
|
thread?.destroy(); thread = null; threadOf = '';
|
|
3640
3677
|
const name = current;
|
|
3641
3678
|
/* From where this page is: a device's page lives under /c/, and nothing else is open to it. */
|
|
3642
|
-
const [{ mount }, words] = await Promise.all([
|
|
3679
|
+
const [{ mount, since }, words] = await Promise.all([parleyUi(), readWords()]);
|
|
3643
3680
|
if (name !== current || (thread && threadOf === current)) return;
|
|
3644
3681
|
threadOf = name;
|
|
3645
3682
|
/* The short-lived secrets live in this conversation now (secret-scan.mjs): the chat shows each as
|
|
@@ -3656,12 +3693,34 @@
|
|
|
3656
3693
|
return data.since === true ? { ...data, messages: [...data.messages.filter((m) => m.from !== 'system'), ...lines.values()] } : data;
|
|
3657
3694
|
};
|
|
3658
3695
|
let first = true;
|
|
3696
|
+
const shaped = (data, asked) => Promise.resolve(withLines(data, asked)).then(machineLines).then((d) => withMachine(d, name)).then((d) => { refreshSecrets(); if (first) { first = false; fadeIn(box); } return d; });
|
|
3697
|
+
/* Kept (15-11): its first look is the copy this page kept, drawn at once; the next one asks the whole
|
|
3698
|
+
window again (the copy may be a shorter one, or old), and it takes its place. Then as before. */
|
|
3699
|
+
let keptFirst = kept.get(name)?.thread ?? null;
|
|
3700
|
+
let whole = false;
|
|
3701
|
+
const keepThread = (data, asked) => {
|
|
3702
|
+
if (!Array.isArray(data?.messages) || asked.before || threadOf !== name) return data;
|
|
3703
|
+
const k = keptOf(name);
|
|
3704
|
+
k.thread = data.since === true ? (k.thread ? since(k.thread, data) : null) : data;
|
|
3705
|
+
k.mark = '';
|
|
3706
|
+
return data;
|
|
3707
|
+
};
|
|
3659
3708
|
thread = mount(box, {
|
|
3660
3709
|
words, view: chatView,
|
|
3661
3710
|
onView: (v) => { chatView = v; try { localStorage.setItem('clavarium-chat-view', v); } catch { /* as above */ } },
|
|
3662
3711
|
/* A part of the thread: its end at first, then what changed, the page before on demand (Parley's window). */
|
|
3663
3712
|
window: windowFor(chatWindow),
|
|
3664
|
-
load: (asked = {}) =>
|
|
3713
|
+
load: (asked = {}) => {
|
|
3714
|
+
if (keptFirst && !asked.since && !asked.before) {
|
|
3715
|
+
const data = keptFirst; keptFirst = null; whole = true;
|
|
3716
|
+
setTimeout(() => { if (thread && threadOf === name) void thread.refresh(); }, 0);
|
|
3717
|
+
return shaped(data, asked);
|
|
3718
|
+
}
|
|
3719
|
+
const { since: _since, ...all } = asked;
|
|
3720
|
+
const ask = whole && asked.since ? all : asked;
|
|
3721
|
+
whole = false;
|
|
3722
|
+
return fetch(talkPath(name, '', ask)).then((r) => r.json()).then((data) => keepThread(data, ask)).then((data) => shaped(data, ask));
|
|
3723
|
+
},
|
|
3665
3724
|
/* The whole thread searched, however little of it is shown. */
|
|
3666
3725
|
search: (q) => fetch(talkPath(name, '/search', { q })).then((r) => (r.ok ? r.json() : { matches: [], count: 0 })),
|
|
3667
3726
|
/* `via: 'voice'`: part of it was dictated, said to the tool. */
|
|
@@ -3892,7 +3951,13 @@
|
|
|
3892
3951
|
if (!current) return;
|
|
3893
3952
|
const name = current;
|
|
3894
3953
|
const mine = ++opening;
|
|
3895
|
-
|
|
3954
|
+
/* Kept (15-11): its chat drawn at once from the copy this page has; its state asked meanwhile, and
|
|
3955
|
+
the chat taken down only if it is off now. */
|
|
3956
|
+
const k = kept.get(name);
|
|
3957
|
+
if (k?.state?.on && k.thread) {
|
|
3958
|
+
talk = k.state; talkOf = name;
|
|
3959
|
+
void readTalk().then(() => { if (mine === opening && name === current && !talk.on) void paintThread(); });
|
|
3960
|
+
} else await readTalk();
|
|
3896
3961
|
if (mine !== opening || name !== current) return;
|
|
3897
3962
|
const want = talk.on || noTerminal() ? true : simplePref;
|
|
3898
3963
|
if (want !== simple) { simple = want; simpleFilesAt = 0; }
|