clavarium 0.2.19 → 0.2.20-next.2

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 CHANGED
@@ -70,10 +70,12 @@ Built slice by slice; the plan is in `blueprint/architecture.html`, tab
70
70
  Settings; the message is encrypted for that device alone.
71
71
 
72
72
  - **11 - the simple screen**: each conversation can be shown without its
73
- terminal, for whoever does not read one: a box to say what is wanted,
74
- what is ready to read, and what the tool says now as plain text, read by
75
- the page from its own screen. What is written is typed into the same
76
- terminal; the server reads nothing more.
73
+ terminal, for whoever does not read one: its chat (12). While its chat is
74
+ off, its Chat tab says so, with the one button that turns it on and asks
75
+ its tool to use it. A device given its terminal but not its chat keeps
76
+ the plain screen: a box to say what is wanted, what is ready to read, and
77
+ what the tool says now as plain text, read by the page from its own
78
+ screen; what is written is typed into the same terminal.
77
79
 
78
80
  - **12 - talk through the app**: a branching on Clavarium Parley, a project
79
81
  of its own (an npm dependency at an exact version, `clavarium-parley`). Every machine has a
@@ -176,6 +178,14 @@ send"): the server fetches the commits into a copy of its own, shows them, and
176
178
  pushes exactly what was shown with a key it keeps sealed (`server/gitpush.mjs`).
177
179
  The tool never holds that key.
178
180
 
181
+ "To send", first in a conversation's Assets, shows every repository of that
182
+ conversation on one screen: each one its agent committed to is ticked, with
183
+ its branch and where it goes, and its checks run by themselves. One review
184
+ shows the changes of all those ticked; one button sends them one after the
185
+ other, each exactly as its own review would (the same commit, the same
186
+ target, the same guards). One refused, for example because its remote moved,
187
+ does not hold the others back, and each says what became of it.
188
+
179
189
  A repository may also be cloned from a private remote (`server/gitaccess.mjs`),
180
190
  over SSH (`user@host:path`, `ssh://...`) or HTTPS. The safest way in comes
181
191
  first: an SSH key made by the server, whose private half is sealed in the vault
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.19",
3
+ "version": "0.2.20-next.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.19",
9
+ "version": "0.2.20-next.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
- "clavarium-parley": "0.13.0",
14
+ "clavarium-parley": "0.13.1-next.1",
15
15
  "mermaid": "11.17.2",
16
16
  "node-pty": "^1.1.0",
17
17
  "pdfjs-dist": "6.4.299",
@@ -686,9 +686,9 @@
686
686
  }
687
687
  },
688
688
  "node_modules/clavarium-parley": {
689
- "version": "0.13.0",
690
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.13.0.tgz",
691
- "integrity": "sha512-ZBoPVCucWaaY59bodXznl29Fh7Ig2cTiMIyftUnLYq5F+tqulHzXdTaY53/5s45VBz+ylT6XbbdG55eVjBSbDA==",
689
+ "version": "0.13.1-next.1",
690
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.13.1-next.1.tgz",
691
+ "integrity": "sha512-PMjSH3i2NiYYLsQCqrfPp/kgJsOPXgFJOFHcYbuZuqMXgy5oaWVcI4h0p3XCduS5ffYgV5B/iMwRnQCX+8E36Q==",
692
692
  "license": "MIT",
693
693
  "bin": {
694
694
  "parley": "bin/parley.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.19",
3
+ "version": "0.2.20-next.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@xterm/addon-fit": "^0.11.0",
46
46
  "@xterm/xterm": "^6.0.0",
47
- "clavarium-parley": "0.13.0",
47
+ "clavarium-parley": "0.13.1-next.1",
48
48
  "mermaid": "11.17.2",
49
49
  "node-pty": "^1.1.0",
50
50
  "pdfjs-dist": "6.4.299",
package/web/app.js CHANGED
@@ -2262,15 +2262,23 @@
2262
2262
  const wanted = talk.on && talkOf === current;
2263
2263
  box.hidden = !wanted;
2264
2264
  /* Where the tool talks through the app, the chat is the whole screen: one box to write in. */
2265
- $('simple-plain').hidden = wanted;
2265
+ /* Its chat off, on this server's own page: said, with the button that turns it on (a device's page keeps the plain screen). */
2266
+ const offer = !DEVICE && !wanted && !noTerminal();
2267
+ $('simple-plain').hidden = wanted || offer;
2268
+ $('chat-turn').hidden = !offer;
2269
+ if (offer) {
2270
+ const possible = !(talkOf === current && talk.possible === false);
2271
+ $('chat-turn-on').hidden = !possible;
2272
+ $('chat-turn-why').textContent = possible ? 'Turned on, its tool talks with you here, as in a messaging app. Its terminal stays one click away.' : 'This conversation works on the disk of its machine: its chat needs its work folder kept here.';
2273
+ }
2266
2274
  $('simple').toggleAttribute('data-chat', wanted);
2267
2275
  /* The ready-made answers type into the terminal: not under a chat. */
2268
- $('room').toggleAttribute('data-chat', wanted && simple);
2276
+ $('room').toggleAttribute('data-chat', (wanted || offer) && simple);
2269
2277
  /* Its chat alone was given, and the owner has not turned it on: said, not left blank. */
2270
2278
  $('chat-off').hidden = !(noTerminal() && !wanted);
2271
2279
  if (noTerminal()) { $('room').setAttribute('data-chat', ''); keysForChat(); say(wanted ? 'chat' : 'chat off', wanted ? 'live' : 'waiting'); }
2272
2280
  /* The bar's dictation types into the terminal: not while the chat is in front, which has its own. */
2273
- if (wanted && simple && stopListening) stopVoice();
2281
+ if ((wanted || offer) && simple && stopListening) stopVoice();
2274
2282
  paintSimple();
2275
2283
  if (!wanted) { thread?.destroy(); thread = null; threadOf = ''; return; }
2276
2284
  if (thread && threadOf === current) { void thread.refresh(); return; }
@@ -2491,6 +2499,23 @@
2491
2499
  catch (error) { $('panel-error').textContent = error.message; $('panel-error').hidden = false; }
2492
2500
  });
2493
2501
  }
2502
+ /* From the Chat tab: on, then its tool is asked to use it -- the same two steps as in its settings. */
2503
+ $('chat-turn-on').addEventListener('click', async () => {
2504
+ const name = current; const button = $('chat-turn-on');
2505
+ if (button.dataset.open) { delete button.dataset.open; button.textContent = 'Turn the chat on'; $('chat-turn-said').textContent = ''; await readTalk(); await paintThread(); return; }
2506
+ button.disabled = true; $('chat-turn-said').textContent = '';
2507
+ try { await post(`${API}/conversations/${encodeURIComponent(name)}/talk`, { on: true }); }
2508
+ catch (error) { $('chat-turn-said').textContent = error.message; button.disabled = false; return; }
2509
+ let asked = '';
2510
+ try { await post(`${API}/conversations/${encodeURIComponent(name)}/talk/invite`, { lang: deviceLang() }); }
2511
+ catch (error) { asked = error.message; }
2512
+ button.disabled = false;
2513
+ if (name !== current) return;
2514
+ void paintGuide(conversations.find((x) => x.name === name));
2515
+ /* Its tool could not be asked: the chat is on all the same; said here, the chat one click away. */
2516
+ if (asked) { $('chat-turn-said').textContent = `The chat is on, but its tool could not be asked to use it: ${asked}`; button.textContent = 'Open the chat'; button.dataset.open = 'yes'; return; }
2517
+ await readTalk(); await paintThread();
2518
+ });
2494
2519
  $('talk-invite').addEventListener('click', async () => {
2495
2520
  try { await post(`${API}/conversations/${encodeURIComponent(current)}/talk/invite`, { lang: deviceLang() }); $('talk-invite').textContent = 'Asked'; setTimeout(() => { $('talk-invite').textContent = 'Ask the tool to use it'; }, 2500); }
2496
2521
  catch (error) { $('panel-error').textContent = error.message; $('panel-error').hidden = false; }
@@ -2769,7 +2794,7 @@
2769
2794
  const ASSET_KINDS = [['git', 'Git repositories', 'git-branch'], ['folder', 'Folders', 'folder'], ['mailbox', 'Mailboxes', 'mail'], ['secret', 'Secrets', 'key-round']];
2770
2795
  const getJson = (path, fallback) => fetch(`${API}${path}`).then((r) => (r.ok ? r.json() : fallback)).catch(() => fallback);
2771
2796
  const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text !== undefined) e.textContent = text; return e; };
2772
- const kindIcon = (kind) => { const name = ASSET_KINDS.find((k) => k[0] === kind)?.[2]; const holder = el('span', 'as-ic'); holder.dataset.kind = kind; const svg = name ? window.clavariumIcons?.icon(name) : null; if (svg) holder.append(svg); return holder; };
2797
+ const kindIcon = (kind) => { const name = kind === 'send' ? 'arrow-up' : ASSET_KINDS.find((k) => k[0] === kind)?.[2]; const holder = el('span', 'as-ic'); holder.dataset.kind = kind; const svg = name ? window.clavariumIcons?.icon(name) : null; if (svg) holder.append(svg); return holder; };
2773
2798
  const roundPlus = (label, onclick) => { const b = el('button', 'as-add', '+'); b.type = 'button'; b.setAttribute('aria-label', label); b.title = label; b.addEventListener('click', onclick); return b; };
2774
2799
  /* The rows, by kind. items: [{key, kind, name, sub, badge, badgeTitle, tone}]. */
2775
2800
  function paintAsList(holder, items, { chosen, choose, add, empty }) {
@@ -2811,7 +2836,7 @@
2811
2836
  const gitSub = (r) => (r.from ? `from ${hostOf(r.from)}` : 'repository');
2812
2837
 
2813
2838
  /* A repository, on the right: its branch, what would go, the diagram. */
2814
- async function gitDetail(holder, name, { place = false } = {}) {
2839
+ async function gitDetail(holder, name, { place = false, others = false } = {}) {
2815
2840
  const facts = el('div', 'as-facts'); facts.append(el('p', 'hint busy', 'Looking at its branches...'));
2816
2841
  const acts = el('div', 'as-acts');
2817
2842
  const review = el('button', '', 'Open the review'); review.type = 'button'; review.dataset.act = 'review';
@@ -2838,7 +2863,7 @@
2838
2863
  facts.append(line, cards);
2839
2864
  const last = lastFor(keep?.last, out);
2840
2865
  if (last) facts.append(lastChecksCard(name, { ...last, outdated: moved(last, out) }, back));
2841
- if (out.state === 'ahead' && out.target) { send.hidden = false; send.textContent = `Send to ${out.target}...`; send.addEventListener('click', () => { void openGit(name, { back, target: out.target, branch: out.branch ?? '' }); }); }
2866
+ if (out.state === 'ahead' && out.target) { send.hidden = false; send.textContent = `Send to ${out.target}...`; send.addEventListener('click', () => { if (others) pickRoomAsset('send:all'); else void openGit(name, { back, target: out.target, branch: out.branch ?? '' }); }); }
2842
2867
  }
2843
2868
  diagram.replaceChildren(graph ? window.clavariumGraph.draw(graph, { pick: (c) => { void openGit(name, { commit: c.id, back }); } }) : el('p', 'hint', 'The branches could not be read.'));
2844
2869
  }
@@ -2878,6 +2903,219 @@
2878
2903
  box.append(head, line, acts);
2879
2904
  return box;
2880
2905
  }
2906
+ /* TO SEND: every repository of a conversation on one screen. What its
2907
+ agent committed, ticked when there is something to send; the checks run
2908
+ by themselves; one review of them all; one button sends them one after
2909
+ the other, each by the same route as its own review (the same commit,
2910
+ the same target, the same guards). One refused does not hold the
2911
+ others back: each says what became of it. */
2912
+ const STATE_SAID = { 'up-to-date': 'up to date', diverged: 'behind: its agent must pull first', 'no-remote': 'no remote', unreachable: 'remote not answering', empty: 'empty' };
2913
+ async function sendDetail(holder, names) {
2914
+ const list = el('div', 'ts-rows'); list.append(el('p', 'hint busy', 'Looking at every repository...'));
2915
+ const bar = el('div', 'as-acts ts-bar');
2916
+ const together = el('button', '', 'Review together'); together.type = 'button'; together.dataset.act = 'send-review';
2917
+ const go = el('button', 'primary', 'Send'); go.type = 'button'; go.dataset.act = 'send-all';
2918
+ const why = el('span', 'hint ts-why');
2919
+ bar.append(together, go, why);
2920
+ const said = el('p', 'ts-said'); said.hidden = true; said.setAttribute('role', 'status');
2921
+ const review = el('div', 'ts-review'); review.hidden = true;
2922
+ holder.append(el('p', 'hint', 'What its agent committed, in every repository of this conversation. The checks run by themselves.'), list, bar, said, review);
2923
+ const rows = names.map((name) => ({ name, out: null, keep: null, branch: '', target: '', picked: false, check: null, sent: null }));
2924
+ let sending = false;
2925
+ let sure = '';
2926
+ const picked = () => rows.filter((r) => r.picked && r.out?.state === 'ahead');
2927
+ /* One row looked at again: its branch and target as chosen; its checks run when it has something to send. */
2928
+ async function look(r) {
2929
+ const query = new URLSearchParams();
2930
+ if (r.branch) query.set('branch', r.branch);
2931
+ if (r.target) query.set('target', r.target);
2932
+ const [out, keep] = await Promise.all([fetch(`${API}/git/${r.name}/outgoing${query.size ? `?${query}` : ''}`).then(async (x) => { const j = await x.json().catch(() => ({})); return x.ok ? j : { state: 'error', message: j.error || 'It could not be read.' }; }).catch(() => ({ state: 'error', message: 'It could not be read.' })), r.keep ? r.keep : getJson(`/git/${r.name}/keep`, null)]);
2933
+ r.out = out; r.keep = keep; r.branch = out.branch ?? r.branch; r.target = out.target ?? r.target; r.check = null;
2934
+ if (out.state !== 'ahead') r.picked = false;
2935
+ paint();
2936
+ if (out.state === 'ahead') void checkRow(r, out.head, out.target);
2937
+ }
2938
+ async function checkRow(r, head, target) {
2939
+ r.check = { status: 'running' }; paint();
2940
+ let result;
2941
+ try { result = await post(`${API}/git/${r.name}/check`, { head, target }); }
2942
+ catch (error) { result = { status: 'unavailable', output: error.message }; }
2943
+ if (r.out?.head !== head || r.out?.target !== target) return;
2944
+ r.check = result; paint();
2945
+ }
2946
+ const stopped = (r) => Boolean(r.keep?.settings?.requireForSend) && r.check?.status !== 'passed';
2947
+ function paintButtons() {
2948
+ const p = picked();
2949
+ const targets = [...new Set(p.map((r) => r.target))];
2950
+ const where = targets.length === 1 ? ` to ${targets[0]}` : '';
2951
+ together.disabled = p.length === 0;
2952
+ together.textContent = p.length > 1 ? `Review the ${p.length} together` : 'Review';
2953
+ const running = p.filter((r) => r.check?.status === 'running');
2954
+ const held = p.filter((r) => r.check?.status !== 'running' && stopped(r));
2955
+ const failed = p.filter((r) => r.check?.status === 'failed');
2956
+ const word = p.length > 1 ? `the ${p.length}` : 'it';
2957
+ go.disabled = sending || p.length === 0 || running.length > 0 || held.length > 0;
2958
+ why.textContent = p.length === 0 ? 'Nothing ticked.' : running.length ? 'Waits for the checks.' : held.length ? `Its owner asked for passing checks: ${held.map((r) => r.name).join(', ')}.` : failed.length ? `Checks failed in ${failed.map((r) => r.name).join(', ')}.` : '';
2959
+ if (sending) { go.textContent = 'Sending...'; return; }
2960
+ const all = p.some((r) => r.out?.guards?.confirm);
2961
+ go.textContent = sure === 'yes' ? (all ? `Not all of it could be shown here: send ${word}${where} anyway` : `Yes, send ${word}${where}: this cannot be undone`) : sure === 'all' ? `Yes, send ${word}${where}: this cannot be undone` : `Send ${word}${where}${failed.length ? ' anyway' : ''}`;
2962
+ }
2963
+ function paint() {
2964
+ list.replaceChildren();
2965
+ for (const r of rows) {
2966
+ const row = el('div', 'ts-row'); row.dataset.repo = r.name;
2967
+ const out = r.out;
2968
+ const ahead = out?.state === 'ahead';
2969
+ row.classList.toggle('off', !ahead);
2970
+ const tick = el('input'); tick.type = 'checkbox'; tick.checked = r.picked; tick.disabled = !ahead || sending; tick.setAttribute('aria-label', `Send ${r.name}`);
2971
+ tick.addEventListener('change', () => { r.picked = tick.checked; sure = ''; paintButtons(); if (!review.hidden) paintReview(); });
2972
+ const who = el('div', 'ts-who'); who.append(el('b', '', r.name), el('small', 'hint', out?.remote ? hostOf(out.remote) : out ? 'no remote' : ''));
2973
+ const way = el('div', 'ts-way');
2974
+ if (out?.branch) {
2975
+ const branches = out.agentBranches ?? [];
2976
+ if (branches.length > 1) {
2977
+ const pick = el('select'); pick.setAttribute('aria-label', `The branch of ${r.name}`); pick.disabled = sending;
2978
+ for (const b of branches) { const o = el('option', '', b.name); o.value = b.name; pick.append(o); }
2979
+ pick.value = out.branch;
2980
+ pick.addEventListener('change', () => { r.branch = pick.value; r.target = ''; sure = ''; void look(r); });
2981
+ way.append(pick);
2982
+ } else way.append(el('code', 'ts-branch', out.branch));
2983
+ if (['ahead', 'up-to-date', 'diverged'].includes(out.state) && out.target) {
2984
+ way.append(el('span', 'ts-arrow', '→'));
2985
+ const to = el('select'); to.setAttribute('aria-label', `Where ${r.name} goes`); to.disabled = sending;
2986
+ const names2 = [...(out.branches ?? [])]; if (!names2.includes(out.target)) names2.unshift(out.target);
2987
+ for (const b of names2) { const o = el('option', '', b === out.target && !out.targetExists ? `${b} (new branch)` : b); o.value = b; to.append(o); }
2988
+ to.value = out.target;
2989
+ to.addEventListener('change', () => { r.target = to.value; sure = ''; void look(r); });
2990
+ way.append(to);
2991
+ }
2992
+ }
2993
+ const size = el('div', 'ts-size');
2994
+ if (!out) size.append(el('span', 'hint busy', 'Looking...'));
2995
+ else if (ahead) {
2996
+ const files = diffFiles(out.diff);
2997
+ size.append(el('span', '', out.count === null || out.count === undefined ? 'some commits' : `${out.count} commit${out.count === 1 ? '' : 's'}`), el('br'),
2998
+ el('span', 'plus', `+${files.reduce((n, f) => n + f.added, 0)}`), ' ', el('span', 'minus', `−${files.reduce((n, f) => n + f.removed, 0)}`));
2999
+ } else size.append(el('span', 'hint', out.state === 'up-to-date' ? 'nothing' : '-'));
3000
+ const state = el('div', 'ts-state');
3001
+ if (r.sent) state.append(el('b', r.sent.ok ? 'ok' : 'bad', r.sent.ok ? r.sent.text : '\u2717 Not sent'));
3002
+ else if (!out) state.append('');
3003
+ else if (!ahead) state.append(el('span', out.state === 'diverged' || out.state === 'unreachable' || out.state === 'error' ? 'bad' : 'hint', STATE_SAID[out.state] ?? out.message ?? out.state));
3004
+ else if (!r.check || r.check.status === 'running') state.append(el('span', 'warn', 'Checks running...'));
3005
+ else {
3006
+ const [word, tone] = CHECK_WORDS[r.check.status] ?? [String(r.check.status), ''];
3007
+ state.append(el('b', tone || 'quiet', r.check.status === 'passed' ? '✓ Checks passed' : r.check.status === 'failed' ? '✗ Checks failed' : word));
3008
+ }
3009
+ row.append(tick, who, way, size, state);
3010
+ if (r.sent && !r.sent.ok) row.append(el('p', 'ts-note bad', r.sent.text));
3011
+ list.append(row);
3012
+ }
3013
+ if (rows.length === 0) list.append(el('p', 'hint', 'No repository is given to it.'));
3014
+ paintButtons();
3015
+ }
3016
+ /* ONE REVIEW of them all: the files of each under its name, then each one's changes, commits and checks. */
3017
+ let tab = 'changes';
3018
+ function paintReview() {
3019
+ review.replaceChildren();
3020
+ const p = picked();
3021
+ if (p.length === 0) { review.hidden = true; return; }
3022
+ const all = p.map((r) => ({ r, files: diffFiles(r.out.diff) }));
3023
+ const nFiles = all.reduce((n, x) => n + x.files.length, 0);
3024
+ const added = all.reduce((n, x) => n + x.files.reduce((m, f) => m + f.added, 0), 0);
3025
+ const removed = all.reduce((n, x) => n + x.files.reduce((m, f) => m + f.removed, 0), 0);
3026
+ const commits = p.reduce((n, r) => n + (r.out.count ?? r.out.commits.length), 0);
3027
+ const head = el('div', 'ts-review-head');
3028
+ head.append(el('h3', '', `${p.length} repositor${p.length === 1 ? 'y' : 'ies'}`), el('p', 'as-line', `${commits} commit${commits === 1 ? '' : 's'} · ${nFiles} file${nFiles === 1 ? '' : 's'} · `));
3029
+ head.lastChild.append(el('span', 'plus', `+${added}`), ' ', el('span', 'minus', `−${removed}`));
3030
+ const tabs = el('div', 'rv-tabs ts-tabs'); tabs.setAttribute('role', 'tablist');
3031
+ const passed = p.filter((r) => r.check?.status === 'passed').length;
3032
+ for (const [key, word] of [['changes', `Changes ${nFiles}`], ['commits', `Commits ${commits}`], ['checks', `Checks ${passed}/${p.length}`]]) {
3033
+ const b = el('button', '', word); b.type = 'button'; b.dataset.tab = key; b.setAttribute('role', 'tab'); b.setAttribute('aria-selected', String(key === tab));
3034
+ b.addEventListener('click', () => { tab = key; paintReview(); });
3035
+ tabs.append(b);
3036
+ }
3037
+ const body = el('div', 'ts-review-body');
3038
+ review.append(head, tabs, body);
3039
+ if (tab === 'changes') {
3040
+ const tree = el('div', 'rv-tree ts-tree'); const diffs = el('div', 'rv-diff ts-diffs');
3041
+ for (const { r, files } of all) {
3042
+ tree.append(el('small', 'ts-tree-repo', r.name));
3043
+ const box = el('div', 'ts-diff'); box.dataset.repo = r.name;
3044
+ box.append(el('h4', '', `${r.name}: ${r.out.branch} → ${r.out.target}`));
3045
+ const inner = el('div'); box.append(inner);
3046
+ files.forEach((f, i) => {
3047
+ const b = el('button'); b.type = 'button'; b.dataset.how = f.how;
3048
+ b.append(el('span', 'rv-path', f.path), el('small', 'plus', `+${f.added}`), el('small', 'minus', `−${f.removed}`));
3049
+ b.addEventListener('click', () => { inner.querySelectorAll('.d2h-file-wrapper')[i]?.scrollIntoView({ block: 'start' }); });
3050
+ tree.append(b);
3051
+ });
3052
+ const Ui = window.Diff2HtmlUI;
3053
+ if (!r.out.diff) inner.append(el('p', 'hint', 'No change to show.'));
3054
+ else if (!Ui) inner.append(el('pre', '', r.out.diff));
3055
+ else {
3056
+ const ui = new Ui(inner, r.out.diff, { outputFormat: 'line-by-line', drawFileList: false, matching: 'lines', diffStyle: 'word', fileContentToggle: false, stickyFileHeaders: false, highlight: true, colorScheme: document.documentElement.dataset.theme === 'light' ? 'light' : 'dark' });
3057
+ ui.draw();
3058
+ try { ui.highlightCode(); } catch { /* the plain diff stays */ }
3059
+ }
3060
+ if (r.out.cut) inner.append(el('p', 'hint', '... (the rest is not shown here: too long)'));
3061
+ diffs.append(box);
3062
+ }
3063
+ body.append(tree, diffs);
3064
+ } else if (tab === 'commits') {
3065
+ for (const r of p) {
3066
+ body.append(el('h4', '', `${r.name}: ${r.out.branch} → ${r.out.target}`));
3067
+ for (const c of r.out.commits) { const line = el('div', 'commit'); line.append(el('code', '', c.id.slice(0, 8)), el('b', '', c.subject), el('small', '', `${c.author}, ${new Date(c.date).toLocaleString()}`)); body.append(line); }
3068
+ if ((r.out.count ?? 0) > r.out.commits.length) body.append(el('p', 'hint', `Only the last ${r.out.commits.length} of ${r.out.count} are listed.`));
3069
+ }
3070
+ } else {
3071
+ for (const r of p) {
3072
+ const [word] = CHECK_WORDS[r.check?.status] ?? [r.check?.status === 'running' ? 'Running...' : 'Not run'];
3073
+ body.append(el('h4', '', `${r.name}: ${word}`));
3074
+ if (r.check?.output) body.append(el('pre', 'ts-output', r.check.output));
3075
+ }
3076
+ }
3077
+ }
3078
+ let reviewStep = null;
3079
+ together.addEventListener('click', () => {
3080
+ if (!review.hidden) { review.scrollIntoView({ block: 'start' }); return; }
3081
+ review.hidden = false; tab = 'changes'; paintReview();
3082
+ reviewStep = nav.over('send-review', () => { review.hidden = true; reviewStep = null; });
3083
+ review.scrollIntoView({ block: 'start' });
3084
+ });
3085
+ go.addEventListener('click', async () => {
3086
+ const p = picked();
3087
+ if (p.length === 0 || go.disabled) return;
3088
+ /* Two clicks: what leaves cannot be called back. Three when a review could not show it all. */
3089
+ const all = p.some((r) => r.out?.guards?.confirm);
3090
+ if (!sure) { sure = 'yes'; paintButtons(); return; }
3091
+ if (all && sure === 'yes') { sure = 'all'; paintButtons(); return; }
3092
+ sending = true; sure = ''; said.hidden = true;
3093
+ for (const r of rows) r.sent = null;
3094
+ paint();
3095
+ for (const r of p) {
3096
+ try {
3097
+ const sent = await post(`${API}/git/${r.name}/push`, { head: r.out.head, target: r.out.target, ...(r.out.guards?.confirm ? { sure: true } : {}) });
3098
+ r.sent = { ok: true, text: sent.already ? `✓ Already in ${sent.branch}` : sent.commits > 0 ? `✓ Sent to ${sent.branch}` : `✓ Made ${sent.branch}` };
3099
+ } catch (error) { r.sent = { ok: false, text: /^Not sent/.test(error.message) ? error.message : `Not sent: ${error.message}` }; }
3100
+ paint();
3101
+ }
3102
+ sending = false; paint();
3103
+ const ok = p.filter((r) => r.sent?.ok).length;
3104
+ said.textContent = ok === p.length ? `Sent: ${ok === 1 ? 'it went' : `all ${ok} went`}.` : `${ok} of ${p.length} sent; the others say why.`;
3105
+ said.className = `ts-said ${ok === p.length ? 'ok' : 'bad'}`; said.hidden = false;
3106
+ if (reviewStep) nav.drop(reviewStep);
3107
+ /* What is left to send, read again; what became of each stays said. */
3108
+ const kept = new Map(rows.map((r) => [r.name, r.sent]));
3109
+ await Promise.all(rows.map((r) => look(r)));
3110
+ for (const r of rows) r.sent = kept.get(r.name);
3111
+ paint();
3112
+ });
3113
+ paint();
3114
+ await Promise.all(rows.map(async (r) => { await look(r); }));
3115
+ /* Ticked at first: each one with something to send. */
3116
+ for (const r of rows) r.picked = r.out?.state === 'ahead';
3117
+ paint();
3118
+ }
2881
3119
  /* The files of a folder or a mailbox, in a conversation: the Files sheet, moved into the detail. */
2882
3120
  let filesHome = null;
2883
3121
  function embedFiles(holder, name) {
@@ -2914,11 +3152,22 @@
2914
3152
  sub: kind === 'git' ? gitSub(r) : kind === 'mailbox' ? boxSub(box) : 'folder', tone: box?.failure ? 'bad' : '' });
2915
3153
  }
2916
3154
  for (const s2 of secrets.filter((x) => x.conversations.includes(current))) items.push({ key: `secret:${s2.name}`, kind: 'secret', name: s2.name, secret: s2, sub: 'name only · used by its agent' });
2917
- const chosen = items.find((i) => i.key === roomPick) ?? null;
3155
+ /* TO SEND, above them all, once it has a repository: every one of them on one screen. */
3156
+ const gits = items.filter((i) => i.kind === 'git').map((i) => i.name);
3157
+ const outbox = gits.length ? { key: 'send:all', kind: 'send', name: 'To send', sub: 'every repository, reviewed and sent at once' } : null;
3158
+ const chosen = (outbox && roomPick === outbox.key ? outbox : null) ?? items.find((i) => i.key === roomPick) ?? null;
2918
3159
  const as = $('cassets-as');
2919
3160
  as.dataset.open = chosen ? 'detail' : 'list';
2920
3161
  paintAsList($('cassets-rows'), items, { chosen: chosen?.key, choose: (key) => pickRoomAsset(key), empty: 'Nothing is given to it yet.' });
2921
3162
  const top = el('div', 'as-kind-head as-list-top'); top.append(el('h3', '', 'This conversation'), roundPlus('Attach an asset', () => { void openAccess(true); }));
3163
+ if (outbox) {
3164
+ const row = el('button', 'as-row ts-entry'); row.type = 'button'; row.dataset.asset = outbox.key;
3165
+ if (chosen === outbox) row.setAttribute('aria-current', 'true');
3166
+ const words = el('span', 'as-words'); words.append(el('b', '', outbox.name), el('small', 'as-sub', outbox.sub));
3167
+ row.append(kindIcon('send'), words);
3168
+ row.addEventListener('click', () => pickRoomAsset(outbox.key));
3169
+ $('cassets-rows').prepend(row);
3170
+ }
2922
3171
  $('cassets-rows').prepend(top);
2923
3172
  if (c?.work === 'disk') $('cassets-rows').append(el('p', 'hint as-disk', 'Its work is on the disk of its machine: nothing of it is kept here.'));
2924
3173
  const detail = $('cassets-detail');
@@ -2932,7 +3181,8 @@
2932
3181
  if (chosen.kind === 'folder' || chosen.kind === 'mailbox') {
2933
3182
  if (chosen.kind === 'mailbox') detail.append(el('p', chosen.box?.failure ? 'error' : 'hint', boxSub(chosen.box)));
2934
3183
  embedFiles(detail, chosen.name);
2935
- } else if (chosen.kind === 'git') await gitDetail(detail, chosen.name);
3184
+ } else if (chosen.kind === 'send') await sendDetail(detail, gits);
3185
+ else if (chosen.kind === 'git') await gitDetail(detail, chosen.name, { others: gits.length > 1 });
2936
3186
  else {
2937
3187
  detail.append(el('p', 'hint', 'Handed to its tool as a variable and a file, the next time it starts. Its value is never shown.'), chapter('Used by'));
2938
3188
  const list = el('div', 'as-chips');
package/web/index.html CHANGED
@@ -97,6 +97,8 @@
97
97
  drawn by Parley, from what the tool posted, never from its screen. -->
98
98
  <div id="simple" hidden>
99
99
  <div id="simple-thread" hidden></div>
100
+ <!-- ITS CHAT TURNED OFF: said, with the one button that turns it on (and asks its tool to use it). -->
101
+ <div id="chat-turn" hidden><p><b>The chat is off for this conversation.</b></p><p id="chat-turn-why">Turned on, its tool talks with you here, as in a messaging app. Its terminal stays one click away.</p><button type="button" class="primary" id="chat-turn-on">Turn the chat on</button><p class="hint" id="chat-turn-said" role="status"></p></div>
100
102
  <div id="simple-plain">
101
103
  <p id="simple-state" role="status"></p>
102
104
  <form id="simple-say" autocomplete="off">
package/web/style.css CHANGED
@@ -385,6 +385,10 @@ footer button.careful { border-style: dashed; color: var(--ink2); }
385
385
  /* The chat takes the whole screen: its box stays at the bottom, the messages scroll above it. */
386
386
  /* On a light screen, brass text is too pale to read: the words in that colour are darker; the buttons keep it. */
387
387
  :root[data-theme="light"] #simple-thread { --parley-ask: #8a5d00; }
388
+ #chat-turn { margin: auto; max-width: 40ch; text-align: center; padding: 32px 8px; }
389
+ #chat-turn p { margin: 0 0 12px; font-size: 1rem; }
390
+ #chat-turn p + p { color: var(--ink2); }
391
+ #chat-turn .hint { margin-top: 10px; font-size: .875rem; }
388
392
  #chat-off { margin: auto; max-width: 36ch; text-align: center; padding: 24px 8px; }
389
393
  #chat-off p { margin: 0 0 10px; font-size: 1rem; }
390
394
  #chat-off p + p { color: var(--ink2); }
@@ -1363,6 +1367,8 @@ select.pill { appearance: auto; }
1363
1367
  @media (pointer: coarse) { #list-resize { width: 18px; margin-right: -9px; } }
1364
1368
  @media (max-width: 700px) { #list-resize { display: none; } }
1365
1369
  #app[data-list="folded"] #list-resize { display: none; }
1370
+ /* A picture open over the page (the chat's viewer, its drawing): nothing of the page under it is grabbed. */
1371
+ #app:has(.parley-zoom:not([hidden])) #list-resize { display: none; }
1366
1372
  /* "Seen" stands apart from what acts on the machine: in the colour of what is fine. */
1367
1373
  .parley-act[data-act="seen"], #health-dismiss { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
1368
1374
  .parley-act[data-act="seen"]:hover, #health-dismiss:hover { background: color-mix(in srgb, var(--ok) 14%, transparent); }
@@ -1383,3 +1389,39 @@ button.inline.more-recent { text-decoration: none; }
1383
1389
  .wifi-lock { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
1384
1390
  .wifi-join { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }
1385
1391
  .wifi-join p { margin: 0; }
1392
+
1393
+ /* TO SEND: every repository of a conversation, one row each, then one review of those ticked. */
1394
+ .ts-entry .as-ic { color: var(--brass); }
1395
+ .ts-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
1396
+ .ts-row { display: grid; grid-template-columns: 24px minmax(0, 1.1fr) minmax(0, 1.7fr) minmax(0, .8fr) minmax(0, 1.1fr); gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
1397
+ .ts-row.off { opacity: .6; }
1398
+ .ts-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brass); }
1399
+ .ts-who { display: flex; flex-direction: column; min-width: 0; }
1400
+ .ts-who b { overflow-wrap: anywhere; }
1401
+ .ts-way { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
1402
+ .ts-way select { max-width: 100%; font: .875rem var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; }
1403
+ .ts-bar button:disabled { opacity: .5; cursor: default; }
1404
+ .ts-state .quiet { color: var(--ink2); font-weight: 400; }
1405
+ .ts-branch { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--brass); overflow-wrap: anywhere; }
1406
+ .ts-size .plus, .ts-review-head .plus { color: var(--ok); } .ts-size .minus, .ts-review-head .minus { color: var(--danger); }
1407
+ .ts-state .ok { color: var(--ok); } .ts-state .bad { color: var(--danger); } .ts-state .warn { color: var(--warn); }
1408
+ .ts-bar { align-items: center; margin-top: 14px; }
1409
+ .ts-why { font-size: .875rem; }
1410
+ .ts-said { margin: 10px 0 0; font-weight: 700; }
1411
+ .ts-said.ok { color: var(--ok); } .ts-said.bad { color: var(--danger); }
1412
+ .ts-review { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
1413
+ .ts-review-head h3 { margin: 0; }
1414
+ .ts-tree-repo { padding: 8px 8px 2px; color: var(--ink2); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .75rem; overflow-wrap: anywhere; }
1415
+ .ts-diff h4, .ts-review h4 { margin: 12px 0 8px; }
1416
+ .ts-diff:first-child h4 { margin-top: 0; }
1417
+ .ts-tree { position: static; max-height: none; margin-bottom: 12px; }
1418
+ .ts-diffs { min-width: 0; }
1419
+ .ts-diffs .d2h-code-linenumber { position: static; }
1420
+ .ts-note { grid-column: 2 / -1; margin: 0; font-size: .875rem; }
1421
+ .ts-note.bad { color: var(--danger); }
1422
+ .ts-output { white-space: pre-wrap; max-height: 40vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: .8125rem; }
1423
+ @media (max-width: 700px) {
1424
+ .ts-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
1425
+ .ts-way { grid-column: 2 / -1; }
1426
+ .ts-size { grid-column: 2; } .ts-state { grid-column: 3; text-align: right; }
1427
+ }