clavarium 0.2.264-next.1 → 0.2.267-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.
@@ -53,10 +53,10 @@ if [ -f "$chat/server.mjs" ]; then
53
53
  || echo "launch: the chat will not say when Claude Code works without a word" >&2
54
54
  fi
55
55
  # WHAT ITS SCREEN ASKS (02-11), read by the generic screen-watch -- Claude Code's own words, here and only
56
- # here: its sign-in link sent to the person's chat; "restart to apply" an update asked of the server (done
57
- # when its turn ends). A tool that changes its words: only these lines change.
56
+ # here: its sign-in link sent to the person's chat; an update installed told to the agent, which restarts
57
+ # when it suits it (never in the middle of its work). A tool that changes its words: only these lines change.
58
58
  node "$(dirname "$0")/screen-watch.mjs" \
59
59
  'link:https://(claude\.ai|claude\.com|console\.anthropic\.com)/[^ ]*oauth[^ ]*' \
60
- 'restart:(update|updated|installed)[^\n]{0,80}restart' \
60
+ 'notice:(update|updated|installed)[^\n]{0,80}restart=Your tool was updated: when nothing runs, touch /work/.parley/restart-asked to take it up.' \
61
61
  </dev/null >/dev/null 2>&1 &
62
62
  exec "$@"
@@ -0,0 +1,36 @@
1
+ #!/bin/sh
2
+ # THE LAUNCHER OF CODEX (OpenAI), run by Clavarium in its machine at each start (config/tools.json,
3
+ # "launch"), from the read-only /tools. Arguments: the rights chosen by the owner (full, ask), then the
4
+ # command to run, as Clavarium made it. All that is Codex's own is here, and only here (02-11).
5
+ mode="$1"; shift
6
+ case "$mode" in full|ask) ;; *) echo "launch: the first argument is full or ask" >&2; exit 64 ;; esac
7
+ [ $# -gt 0 ] || { echo "launch: no command to run" >&2; exit 64; }
8
+ here="$(dirname "$0")"; relay="$here/mcp-relay.mjs"
9
+ chat="${PARLEY_DIR:-/work/.parley}"; docket="/work/.docket"; tether="/work/.tether"
10
+ # ITS SETTINGS (~/.codex/config.toml), in a block of their own, the rest kept: its work folder trusted (no
11
+ # question at its first start), and its tools (MCP) each through the relay -- a tool updated on the
12
+ # machine taken up between two requests, never a restart.
13
+ block='[projects."/work"]
14
+ trust_level = "trusted"'
15
+ if [ -f "$chat/server.mjs" ] && command -v parley-mcp >/dev/null 2>&1; then block="$block
16
+ [mcp_servers.parley]
17
+ command = \"node\"
18
+ args = [\"$relay\", \"parley-mcp\", \"--dir\", \"$chat\"]"; fi
19
+ if [ -f "$chat/server.mjs" ] && command -v docket-mcp >/dev/null 2>&1; then block="$block
20
+ [mcp_servers.docket]
21
+ command = \"node\"
22
+ args = [\"$relay\", \"docket-mcp\", \"--dir\", \"$docket\"]"; fi
23
+ if command -v tether-mcp >/dev/null 2>&1; then block="$block
24
+ [mcp_servers.tether]
25
+ command = \"node\"
26
+ args = [\"$relay\", \"tether-mcp\", \"--dir\", \"$tether\"]"; fi
27
+ node "$here/toml-block.mjs" .codex/config.toml tools "$block" \
28
+ || echo "launch: Codex may ask its first questions, and has not its tools (MCP)" >&2
29
+ # WHAT ITS SCREEN ASKS, read by the generic screen-watch -- Codex's own words: its sign-in link (and the
30
+ # code beside it) sent to the person's chat; an update told to the agent, which restarts when it suits it.
31
+ node "$here/screen-watch.mjs" \
32
+ 'link:https://auth\.openai\.com/[^ ]+' \
33
+ 'link:https://chatgpt\.com/[^ ]*auth[^ ]*' \
34
+ 'notice:update available[^\n]{0,120}=Your tool has an update: when nothing runs, touch /work/.parley/restart-asked to take it up.' \
35
+ </dev/null >/dev/null 2>&1 &
36
+ exec "$@"
@@ -6,21 +6,22 @@
6
6
  * A rule: KIND:PATTERN[=VALUE], PATTERN a JavaScript regular expression (flag i).
7
7
  * link:PATTERN a link on the screen (the match): sent in the chat, to be opened by the person
8
8
  * (a sign-in, say); once per link.
9
- * restart:PATTERN the tool asks to be restarted (an update to apply): asked of the server, which does it
10
- * once the tool's turn has ended (/work/.parley/restart-asked); once per screen.
9
+ * notice:PATTERN=TEXT something the agent should know (an update installed, to be taken up by a
10
+ * restart): TEXT given to the agent, as a reminder it is woken by (docket); once per screen.
11
+ * The agent decides when it suits it -- never restarted in the middle of its work (02-11).
11
12
  * keys:PATTERN=K a question with one answer always: the keys K typed (Enter, Down, Up, Escape, 1, y...),
12
13
  * once per screen. Only what its launcher wrote: nothing else is ever typed.
13
14
  * Only the last LINES lines are read: what the tool prints of its own work above never counts.
14
15
  */
15
16
  import { spawnSync } from 'node:child_process';
16
- import { writeFileSync, existsSync } from 'node:fs';
17
17
 
18
18
  const LINES = 12; const EVERY_MS = 3000;
19
19
  const KEYS = new Set(['Enter', 'Down', 'Up', 'Left', 'Right', 'Escape', 'Tab', 'y', 'n', '1', '2', '3']);
20
20
  export function rulesOf(args) {
21
21
  return args.flatMap((a) => {
22
- const m = /^(link|restart|keys):(.+)$/s.exec(a); if (!m) return [];
22
+ const m = /^(link|notice|keys):(.+)$/s.exec(a); if (!m) return [];
23
23
  let pattern = m[2]; let value = null;
24
+ if (m[1] === 'notice') { const at = pattern.lastIndexOf('='); if (at < 1) return []; value = pattern.slice(at + 1).trim().slice(0, 300); pattern = pattern.slice(0, at); if (!value) return []; }
24
25
  if (m[1] === 'keys') { const at = pattern.lastIndexOf('='); if (at < 1) return []; value = pattern.slice(at + 1).split(',').filter((k) => KEYS.has(k)); pattern = pattern.slice(0, at); if (!value.length) return []; }
25
26
  try { return [{ kind: m[1], re: new RegExp(pattern, 'i'), value }]; } catch { return []; }
26
27
  });
@@ -33,7 +34,13 @@ export function actionsOn(screen, rules, seen) {
33
34
  const m = r.re.exec(bottom); if (!m) continue;
34
35
  const key = `${r.kind}:${r.kind === 'link' ? m[0] : bottom}`;
35
36
  if (seen.has(key)) continue;
36
- seen.add(key); out.push({ kind: r.kind, match: m[0], value: r.value });
37
+ /* A notice once an hour at most: its own words on the screen never bring it back in a loop. */
38
+ if (r.kind === 'notice' && Date.now() - (r.last ?? 0) < 60 * 60_000) { seen.add(key); continue; }
39
+ if (r.kind === 'notice') r.last = Date.now();
40
+ /* With a link, the lines around it (a code to type there, often): the person sees what the tool said. */
41
+ const lines = bottom.split('\n'); const i = lines.findIndex((l) => l.includes(m[0].split('\n')[0]));
42
+ const around = r.kind === 'link' && i >= 0 ? lines.slice(Math.max(0, i - 2), i + 4).map((l) => l.trim()).filter(Boolean).join('\n') : '';
43
+ seen.add(key); out.push({ kind: r.kind, match: m[0], value: r.value, around });
37
44
  }
38
45
  if (seen.size > 200) for (const k of [...seen].slice(0, 100)) seen.delete(k);
39
46
  return out;
@@ -50,8 +57,8 @@ if (main) {
50
57
  const r = spawnSync('tmux', [...tmux, 'capture-pane', '-p', '-t', pane], { encoding: 'utf8', timeout: 5000 });
51
58
  if (r.status !== 0) return;
52
59
  for (const a of actionsOn(r.stdout, rules, seen)) {
53
- if (a.kind === 'link') spawnSync('parley', ['tell', `Your tool asks you to open this link: ${a.match}`, '--dir', chat], { timeout: 10_000 });
54
- if (a.kind === 'restart' && existsSync(chat)) { try { writeFileSync(`${chat}/restart-asked`, ''); } catch { /* the chat is not there */ } }
60
+ if (a.kind === 'link') spawnSync('parley', ['tell', `Your tool asks you to open this link: ${a.match}${a.around && a.around !== a.match ? `\n\n\`\`\`\n${a.around}\n\`\`\`` : ''}`, '--dir', chat], { timeout: 10_000 });
61
+ if (a.kind === 'notice') spawnSync('docket', ['remind', '--in', '1m', a.value, '--dir', process.env.DOCKET_DIR ?? '/work/.docket'], { timeout: 10_000 });
55
62
  if (a.kind === 'keys') for (const k of a.value) spawnSync('tmux', [...tmux, 'send-keys', '-t', pane, k], { timeout: 5000 });
56
63
  }
57
64
  };
@@ -0,0 +1,26 @@
1
+ /* toml-block FILE NAME [TEXT]: keeps, in the TOML file FILE of the home, one block of its own --
2
+ * "# >>> clavarium NAME" ... "# <<< clavarium NAME" -- written anew with TEXT (its tables), every other
3
+ * line kept as the person or the tool wrote it. No TEXT: the block taken out. Written only when it
4
+ * changes, readable by its owner alone (02-11: Codex, Vibe -- their settings are TOML).
5
+ * Only tables go in a block (a key outside a table would land in the table above it).
6
+ */
7
+ import { readFileSync, writeFileSync, mkdirSync, renameSync } from 'node:fs';
8
+ import { dirname, join, isAbsolute } from 'node:path';
9
+ import { homedir } from 'node:os';
10
+
11
+ const [file, name, text = ''] = process.argv.slice(2);
12
+ if (!file || !name || isAbsolute(file) || file.split('/').includes('..') || !/^[a-z0-9-]+$/.test(name)) { console.error('usage: toml-block <file in the home> <name> [text]'); process.exit(64); }
13
+ const at = join(homedir(), file);
14
+ let was = '';
15
+ try { was = readFileSync(at, 'utf8'); } catch (error) { if (error.code !== 'ENOENT') { console.error(`toml-block: ${file} cannot be read`); process.exit(3); } }
16
+ const open = `# >>> clavarium ${name}`; const close = `# <<< clavarium ${name}`;
17
+ const lines = was.split('\n'); const kept = []; let inside = false;
18
+ for (const l of lines) { if (l === open) { inside = true; continue; } if (l === close) { inside = false; continue; } if (!inside) kept.push(l); }
19
+ let out = kept.join('\n').replace(/\n+$/, '');
20
+ if (text.trim()) out = `${out ? `${out}\n\n` : ''}${open}\n${text.trim()}\n${close}`;
21
+ out = out ? `${out}\n` : '';
22
+ if (out !== was) {
23
+ mkdirSync(dirname(at), { recursive: true, mode: 0o700 });
24
+ writeFileSync(`${at}.new`, out, { mode: 0o600 });
25
+ renameSync(`${at}.new`, at);
26
+ }
@@ -0,0 +1,39 @@
1
+ #!/bin/sh
2
+ # THE LAUNCHER OF VIBE (Mistral), run by Clavarium in its machine at each start (config/tools.json,
3
+ # "launch"), from the read-only /tools. Arguments: the rights chosen by the owner (full, ask), then the
4
+ # command to run, as Clavarium made it. All that is Vibe's own is here, and only here (02-11).
5
+ mode="$1"; shift
6
+ case "$mode" in full|ask) ;; *) echo "launch: the first argument is full or ask" >&2; exit 64 ;; esac
7
+ [ $# -gt 0 ] || { echo "launch: no command to run" >&2; exit 64; }
8
+ here="$(dirname "$0")"; relay="$here/mcp-relay.mjs"
9
+ chat="${PARLEY_DIR:-/work/.parley}"; docket="/work/.docket"; tether="/work/.tether"
10
+ # ITS KEY: a secret named MISTRAL_API_KEY given to the conversation is in its environment; Vibe reads it
11
+ # there, and asks nothing. Without it, Vibe asks for it in its terminal at its first start.
12
+ # ITS TOOLS (MCP) in its settings (~/.vibe/config.toml), a block of their own, each through the relay.
13
+ block=''
14
+ if [ -f "$chat/server.mjs" ] && command -v parley-mcp >/dev/null 2>&1; then block="$block
15
+ [[mcp_servers]]
16
+ name = \"parley\"
17
+ transport = \"stdio\"
18
+ command = \"node\"
19
+ args = [\"$relay\", \"parley-mcp\", \"--dir\", \"$chat\"]"; fi
20
+ if [ -f "$chat/server.mjs" ] && command -v docket-mcp >/dev/null 2>&1; then block="$block
21
+ [[mcp_servers]]
22
+ name = \"docket\"
23
+ transport = \"stdio\"
24
+ command = \"node\"
25
+ args = [\"$relay\", \"docket-mcp\", \"--dir\", \"$docket\"]"; fi
26
+ if command -v tether-mcp >/dev/null 2>&1; then block="$block
27
+ [[mcp_servers]]
28
+ name = \"tether\"
29
+ transport = \"stdio\"
30
+ command = \"node\"
31
+ args = [\"$relay\", \"tether-mcp\", \"--dir\", \"$tether\"]"; fi
32
+ node "$here/toml-block.mjs" .vibe/config.toml tools "$block" \
33
+ || echo "launch: Vibe has not its tools (MCP)" >&2
34
+ # WHAT ITS SCREEN ASKS, read by the generic screen-watch -- Vibe's own words: an update told to the
35
+ # agent, which restarts when it suits it.
36
+ node "$here/screen-watch.mjs" \
37
+ 'notice:(new version|update) (is )?available[^\n]{0,120}=Your tool has an update: when nothing runs, touch /work/.parley/restart-asked to take it up.' \
38
+ </dev/null >/dev/null 2>&1 &
39
+ exec "$@"
package/config/tools.json CHANGED
@@ -174,6 +174,63 @@
174
174
  "@openai/codex"
175
175
  ],
176
176
  "npm-writable"
177
+ ],
178
+ "launch": "codex.sh"
179
+ },
180
+ {
181
+ "id": "vibe",
182
+ "instructions": ".vibe/AGENTS.md",
183
+ "label": "Mistral Vibe",
184
+ "launch": "vibe.sh",
185
+ "command": [
186
+ "vibe"
187
+ ],
188
+ "resume": [
189
+ "vibe",
190
+ "--continue"
191
+ ],
192
+ "memoryMb": 2048,
193
+ "rights": {
194
+ "full": [
195
+ "--auto-approve"
196
+ ]
197
+ },
198
+ "install": [
199
+ [
200
+ "sudo",
201
+ "-n",
202
+ "apt-get",
203
+ "install",
204
+ "-y",
205
+ "-q",
206
+ "--no-install-recommends",
207
+ "python3-venv"
208
+ ],
209
+ [
210
+ "sudo",
211
+ "-n",
212
+ "python3",
213
+ "-m",
214
+ "venv",
215
+ "/opt/vibe"
216
+ ],
217
+ [
218
+ "sudo",
219
+ "-n",
220
+ "/opt/vibe/bin/pip",
221
+ "install",
222
+ "-q",
223
+ "--disable-pip-version-check",
224
+ "mistral-vibe"
225
+ ],
226
+ [
227
+ "sudo",
228
+ "-n",
229
+ "ln",
230
+ "-sf",
231
+ "/opt/vibe/bin/vibe",
232
+ "/usr/local/bin/vibe"
233
+ ]
177
234
  ]
178
235
  },
179
236
  {
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.264-next.1",
3
+ "version": "0.2.267-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.264-next.1",
9
+ "version": "0.2.267-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
- "clavarium-binder": "0.1.55-next.1",
15
- "clavarium-docket": "0.1.1",
16
- "clavarium-parley": "0.17.38-next.1",
17
- "clavarium-tether": "0.1.0-next.46",
14
+ "clavarium-binder": "0.1.57-next.1",
15
+ "clavarium-docket": "0.1.2-next.2",
16
+ "clavarium-parley": "0.17.43-next.1",
17
+ "clavarium-tether": "0.1.0-next.48",
18
18
  "mammoth": "1.13.0",
19
19
  "mermaid": "11.17.2",
20
20
  "node-pty": "^1.1.0",
@@ -761,9 +761,9 @@
761
761
  }
762
762
  },
763
763
  "node_modules/clavarium-binder": {
764
- "version": "0.1.55-next.1",
765
- "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.55-next.1.tgz",
766
- "integrity": "sha512-YmLM425F1WrGwIUxXeeiaL6ffkgusiPhVnMehOrJV8ZZIfxtJAhP+DbqPHQGA9vqr1bTjmHvn/5j9b6/HtkwHw==",
764
+ "version": "0.1.57-next.1",
765
+ "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.57-next.1.tgz",
766
+ "integrity": "sha512-FvIgcCM7hJMDs1P1aQjwYqs2YypDgDKL54CL34rCaf0VejsUGHMYukSZgzDLQ4y8Bw/m8884p7Ap+j3jyZF31w==",
767
767
  "license": "MIT",
768
768
  "bin": {
769
769
  "binder": "bin/binder.mjs",
@@ -774,9 +774,9 @@
774
774
  }
775
775
  },
776
776
  "node_modules/clavarium-docket": {
777
- "version": "0.1.1",
778
- "resolved": "https://registry.npmjs.org/clavarium-docket/-/clavarium-docket-0.1.1.tgz",
779
- "integrity": "sha512-ssmnIfkBmOeKaHXBrL97qsaBp6Tc6OwX08WksQjpBGZx/QklwRvZqXgOYZ/Nk7Hk3HO0xXrJy5EyHbFcLVXfiA==",
777
+ "version": "0.1.2-next.2",
778
+ "resolved": "https://registry.npmjs.org/clavarium-docket/-/clavarium-docket-0.1.2-next.2.tgz",
779
+ "integrity": "sha512-d1D7BX+g3UkiIebom9+F61wGJHVwiV/H02sg7Y9AIzd3UwSvmJC3ZwdHTQC3ELBnCmRuth6/bNt0fB3u79lKtQ==",
780
780
  "license": "MIT",
781
781
  "bin": {
782
782
  "docket": "bin/docket.mjs",
@@ -787,9 +787,9 @@
787
787
  }
788
788
  },
789
789
  "node_modules/clavarium-parley": {
790
- "version": "0.17.38-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.38-next.1.tgz",
792
- "integrity": "sha512-dDY+0cVKY5IWnuWnNalYDnwPOWEt58a/f3tzrBHtwk9nYk4dp8b8jOvqnFTld4t+os7bB3VBRZyf1q4JP0hVyQ==",
790
+ "version": "0.17.43-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.43-next.1.tgz",
792
+ "integrity": "sha512-jMpEPwn6gUPrdQM0pzXBSnDIaX7CHDO5bYWYSZLxuVT7vOvbd5GbRGrFfDNUnEB/ZJQHcLnpBH+A08vnTIGCgQ==",
793
793
  "license": "MIT",
794
794
  "bin": {
795
795
  "parley": "bin/parley.mjs",
@@ -800,9 +800,9 @@
800
800
  }
801
801
  },
802
802
  "node_modules/clavarium-tether": {
803
- "version": "0.1.0-next.46",
804
- "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.46.tgz",
805
- "integrity": "sha512-p6B9kM1A4CUN/OyLWf5IpsKvQ5SiTir7P+X2BcnRQBml+S9z/1nS0Xs7vxhk4ekDui/x0Dh5xMOO4IvaCLhaeA==",
803
+ "version": "0.1.0-next.48",
804
+ "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.48.tgz",
805
+ "integrity": "sha512-1u20NVKTNEWpBBj7gA80ig1LOO3cMpZkdw7U//yjXoKAMVoHWkYn7TZOLQZlSJwS7VYrC2cYhlAX96D18DDEgA==",
806
806
  "license": "MIT",
807
807
  "bin": {
808
808
  "tether": "bin/cli.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.264-next.1",
3
+ "version": "0.2.267-next.1",
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,10 +44,10 @@
44
44
  "dependencies": {
45
45
  "@xterm/addon-fit": "^0.11.0",
46
46
  "@xterm/xterm": "^6.0.0",
47
- "clavarium-binder": "0.1.55-next.1",
48
- "clavarium-docket": "0.1.1",
49
- "clavarium-parley": "0.17.38-next.1",
50
- "clavarium-tether": "0.1.0-next.46",
47
+ "clavarium-binder": "0.1.57-next.1",
48
+ "clavarium-docket": "0.1.2-next.2",
49
+ "clavarium-parley": "0.17.43-next.1",
50
+ "clavarium-tether": "0.1.0-next.48",
51
51
  "mammoth": "1.13.0",
52
52
  "mermaid": "11.17.2",
53
53
  "node-pty": "^1.1.0",
package/server/api.mjs CHANGED
@@ -398,7 +398,24 @@ export async function handleApi(request, response, conversations, headers, resou
398
398
  const body = await readBody(request, pathname === '/api/setup/preview' || pathname === '/api/setup/import' ? SETUP_BODY_MAX : BODY_MAX);
399
399
  /* What was done, once it was done: said in What happened (events.mjs), for those worth saying. */
400
400
  if (events) { const answer = send; send = (status, out) => { if (status < 300) { try { events.fromRequest(pathname, body, identity, out); } catch { /* never in the way */ } } answer(status, out); }; }
401
- if (pathname === '/api/conversations') { await conversations.admit?.(body); return send(201, conversations.create(body)), true; }
401
+ if (pathname === '/api/conversations') {
402
+ await conversations.admit?.(body);
403
+ const made = conversations.create(body);
404
+ /* Its chat on from the start (02-11), unless asked otherwise ("More": Chat off); a work folder on the
405
+ machine's disk has no place for it. */
406
+ if (body?.chat !== false && talk) {
407
+ /* Its work folder exists once it is built: the chat is put in then (a few minutes at most). */
408
+ const name = made.name; const until = Date.now() + 30 * 60_000;
409
+ const tryOn = async () => {
410
+ const c = conversations.list().find((x) => x.name === name);
411
+ if (!c || Date.now() > until) return;
412
+ if (c.phase === 'ready') { try { await talk.set(name, true); void guide?.changed(name).catch(() => {}); } catch { /* left off: its settings turn it on */ } return; }
413
+ setTimeout(() => { void tryOn(); }, 2000).unref?.();
414
+ };
415
+ void tryOn();
416
+ }
417
+ return send(201, made), true;
418
+ }
402
419
  /* The lists: every answer is 200, a refusal said in it ({ ok: false, text }), as the keeper says it to a tool. */
403
420
  if (pathname === '/api/binder' && binders) return send(200, binders.act(body.op, body.args, identity)), true;
404
421
  /* Quick actions on a card: suggested from its content (suggest.mjs), done by the page. */
package/web/app.js CHANGED
@@ -1659,9 +1659,9 @@
1659
1659
  newError('', '');
1660
1660
  creating = true; $('newconv-create').disabled = true;
1661
1661
  try {
1662
- const made = await post(`${API}/conversations`, { title, ...(id ? { name: id } : {}), ...(group ? { group } : {}), tool: chosenTool, workOnDisk: newOnDisk(), ...(memoryMb && memoryMb !== least ? { memoryMb } : {}), ...(cpus && cpus !== 1 ? { cpus } : {}), ...(diskGb && diskGb !== 8 ? { diskGb } : {}) });
1662
+ const made = await post(`${API}/conversations`, { title, ...(id ? { name: id } : {}), ...(group ? { group } : {}), tool: chosenTool, workOnDisk: newOnDisk(), ...(document.getElementById('newconv-chat')?.checked === false ? { chat: false } : {}), ...(memoryMb && memoryMb !== least ? { memoryMb } : {}), ...(cpus && cpus !== 1 ? { cpus } : {}), ...(diskGb && diskGb !== 8 ? { diskGb } : {}) });
1663
1663
  $('newconv-name').value = ''; $('newconv-id').value = ''; $('newconv-id').placeholder = 'website-redesign'; $('newconv-group').value = '';
1664
- $('newconv-work').querySelector('[data-work="kept"]').click(); $('newconv-more').open = false;
1664
+ $('newconv-work').querySelector('[data-work="kept"]').click(); $('newconv-more').open = false; { const ch = document.getElementById('newconv-chat'); if (ch) ch.checked = true; }
1665
1665
  await refresh();
1666
1666
  /* The new one is selected: the page gives way to it, with no step of it left behind. */
1667
1667
  select(made.name);
@@ -4959,6 +4959,46 @@
4959
4959
  await paintAssets();
4960
4960
  }
4961
4961
  async function openAssets() { await openAssetsPlace(); }
4962
+ /* ---------- the conversations as cards (02-11) ---------- */
4963
+ /* ONE CONVERSATION AS A CARD, as a playing card: its name and its state on a plate, a picture of its own
4964
+ (its colours drawn from its name, its initial), its agent and its tool, its last word. Reusable: any
4965
+ page that shows conversations as things to pick or move takes it. `onOpen(c)`. */
4966
+ function convCard(c, onOpen) {
4967
+ let h = 0; for (const ch of String(c.name)) h = (h * 31 + ch.codePointAt(0)) >>> 0;
4968
+ const hue = h % 360;
4969
+ const card = el('button', 'conv-card'); card.type = 'button'; card.dataset.name = c.name;
4970
+ const state = c.asleep ? 'asleep' : c.talk?.state === 'waiting' || (c.talk?.waiting ?? 0) > 0 ? 'waits' : c.phase === 'ready' ? 'ready' : 'busy';
4971
+ const plate = el('span', 'conv-card-plate'); const dot = el('span', 'conv-card-dot'); dot.dataset.state = state;
4972
+ plate.append(dot, el('b', '', shownName(c)));
4973
+ const art = el('span', 'conv-card-art'); art.style.setProperty('--h', String(hue));
4974
+ art.append(el('span', 'conv-card-initial', (shownName(c).trim()[0] ?? '?').toUpperCase()));
4975
+ const kind = el('span', 'conv-card-type', [c.chatName, c.toolLabel ?? c.tool].filter(Boolean).join(' · '));
4976
+ const text = el('span', 'conv-card-text');
4977
+ if (c.talk?.lastText) text.append(el('i', '', c.talk.lastText));
4978
+ text.append(el('small', '', c.asleep ? 'Asleep' : state === 'waits' ? 'Waits for you' : c.talk?.lastAt ? cardAgo(c.talk.lastAt) : c.phase === 'ready' ? 'Ready' : (c.step || c.phase || '')));
4979
+ card.append(plate, art, kind, text);
4980
+ card.setAttribute('aria-label', `${shownName(c)}, ${kind.textContent}`);
4981
+ card.addEventListener('click', () => onOpen(c));
4982
+ return card;
4983
+ }
4984
+ const cardAgo = (at) => { const s = Math.max(0, (Date.now() - Date.parse(at)) / 1000); return s < 90 ? 'Just now' : s < 5400 ? `${Math.round(s / 60)} min ago` : s < 129600 ? `${Math.round(s / 3600)} h ago` : `${Math.round(s / 86400)} days ago`; };
4985
+ function paintDeck() {
4986
+ $('deck-title').textContent = appName;
4987
+ const list = [...conversations];
4988
+ const add = el('button', 'conv-card conv-card-new'); add.type = 'button';
4989
+ add.append(el('span', 'conv-card-plus', '+'), el('small', '', 'New conversation'));
4990
+ add.addEventListener('click', () => { void openNew(); });
4991
+ $('deck-cards').replaceChildren(...list.map((c) => convCard(c, (x) => { leavePlace(); select(x.name); })), add);
4992
+ $('deck-cards').hidden = list.length === 0; $('deck-empty').hidden = list.length > 0;
4993
+ }
4994
+ function openDeck(push = true) { if (DEVICE) return; enterPlace('deck', push); paintDeck(); }
4995
+ $('deck-close').addEventListener('click', () => leavePlace());
4996
+ $('deck-empty-new').addEventListener('click', () => { void openNew(); });
4997
+ /* Import a configuration: the import of the map (Access, Flows), a file chosen at once. */
4998
+ $('deck-empty-import').addEventListener('click', () => { void openAccessPage('map', { mode: 'flows' }).then(() => document.getElementById('flows-import')?.click()).catch(() => {}); });
4999
+ $('list-title').addEventListener('click', () => openDeck());
5000
+ $('list-title').setAttribute('role', 'button'); $('list-title').tabIndex = 0;
5001
+ $('list-title').addEventListener('keydown', (e) => { if (e.key === 'Enter') openDeck(); });
4962
5002
  /* ---------- private repositories: how this server gets in ---------- */
4963
5003
  /* The host of an address, whatever its form (user@host:path has no URL form). */
4964
5004
  const hostOf = (from) => { try { return new URL(from).hostname; } catch { return /@([^:/]+):/.exec(String(from))?.[1] ?? String(from); } };
@@ -5130,6 +5170,7 @@
5130
5170
  $('access').hidden = which !== 'access';
5131
5171
  $('settings').hidden = which !== 'settings';
5132
5172
  $('assets').hidden = which !== 'assets';
5173
+ $('deck').hidden = which !== 'deck';
5133
5174
  $('newconv').hidden = which !== 'new';
5134
5175
  if (which !== 'access') composing = false;
5135
5176
  /* What the conversation had open (its tab) waits under the place, as it was. */
@@ -5445,6 +5486,7 @@
5445
5486
  if (home && wanted !== current && conversations.some((c) => c.name === wanted)) select(wanted);
5446
5487
  const open = q.get('open') ?? '';
5447
5488
  if (open === 'new') { await openNew({ push: false }); return; }
5489
+ if (open === 'deck') { openDeck(false); return; }
5448
5490
  if (open === 'settings') {
5449
5491
  await openSettings({ push: false });
5450
5492
  /* A link to one chapter of Settings (?open=settings&at=resources): that one opened, and shown. */
package/web/index.html CHANGED
@@ -480,6 +480,11 @@
480
480
  right: who uses it, its state, its settings. The forms that make
481
481
  one, and a repository's remote, wait in #assets-forms and are moved
482
482
  into the detail when asked for. -->
483
+ <div id="deck" class="sheet as-place" hidden>
484
+ <div class="panel-top"><b id="deck-title">Conversations</b><button type="button" id="deck-close" class="as-link place-back">&lsaquo; Back</button></div>
485
+ <div id="deck-cards" class="deck"></div>
486
+ <div id="deck-empty" class="deck-empty" hidden><p>No conversation yet.</p><div class="deck-empty-acts"><button type="button" id="deck-empty-new" class="primary">+ Create a conversation</button><button type="button" id="deck-empty-import">Import a configuration</button></div></div>
487
+ </div>
483
488
  <div id="assets" class="sheet as-place" hidden>
484
489
  <div class="panel-top"><b>Assets</b><button type="button" id="assets-close" class="as-link place-back">&lsaquo; Conversations</button></div>
485
490
  <p id="assets-error" class="error" role="alert" hidden></p>
@@ -1019,12 +1024,13 @@
1019
1024
  <details class="more"><summary>Which one?</summary>A code project that installs packages: its disk. Can be changed later.</details>
1020
1025
  </div>
1021
1026
  <details class="chapter" id="newconv-more">
1022
- <summary><span class="chapter-title">More</span><span class="chapter-about">Identifier, memory, cores, disk.</span></summary>
1027
+ <summary><span class="chapter-title">More</span><span class="chapter-about">Identifier, memory, cores, disk, chat.</span></summary>
1023
1028
  <div class="chapter-body">
1024
1029
  <div class="set-row"><div class="set-what"><label for="newconv-id">Identifier</label><small>Its machine and address. Never changes</small><span id="newconv-id-error" class="err" role="alert" hidden></span></div><div class="set-control"><input id="newconv-id" maxlength="32" pattern="[a-z]([a-z0-9\-]{0,30}[a-z0-9])?" placeholder="website-redesign" spellcheck="false" autocapitalize="none"></div></div>
1025
1030
  <div class="set-row"><div class="set-what"><label for="newconv-memory">Memory</label><small id="newconv-memory-least"></small><span id="newconv-memory-error" class="err" role="alert" hidden></span></div><div class="set-control"><select id="newconv-memory"></select></div></div>
1026
1031
  <div class="set-row"><div class="set-what"><label for="newconv-cpus">Cores</label><small>Shared with the server's machines</small></div><div class="set-control"><select id="newconv-cpus"></select></div></div>
1027
1032
  <div class="set-row"><div class="set-what"><label for="newconv-disk">Disk</label><small>For code kept on the machine; a disk only grows</small></div><div class="set-control"><select id="newconv-disk"></select></div></div>
1033
+ <div class="set-row"><div class="set-what"><label for="newconv-chat">Chat</label><small>Talk with its tool in a chat. Off: its terminal only</small></div><div class="set-control"><input type="checkbox" id="newconv-chat" checked></div></div>
1028
1034
  </div>
1029
1035
  </details>
1030
1036
  </div>
package/web/style.css CHANGED
@@ -23,7 +23,7 @@ body { height: 100dvh; padding: env(safe-area-inset-top, 0) 0 env(safe-area-inse
23
23
  [hidden] { display: none !important; }
24
24
  button { font: 600 .8125rem var(--sans); color: var(--ink); background: var(--button, #222c38); border: 1px solid var(--line); border-radius: 7px; padding: 7px 11px; cursor: pointer; }
25
25
  /* The main button (02-11): its words and outline in brass, no fill -- quieter, like a suggestion. */
26
- button.primary { background: transparent; border-color: var(--brass); color: var(--brass); }
26
+ button.primary { background: transparent; border-color: var(--brass); color: var(--brass-ink); }
27
27
  button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brass) 12%, transparent); }
28
28
  button:focus-visible, input:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
29
29
  /* The list on the left, the three places under it, the conversation beside them. */
@@ -111,7 +111,7 @@ main { position: relative; flex: 1; min-height: 0; }
111
111
  #notice button { padding: 10px 18px; font-size: .9375rem; }
112
112
  footer { display: flex; gap: 6px; padding: 6px 8px; background: var(--bar); border-top: 1px solid var(--line); overflow-x: auto; }
113
113
  footer button { flex: 0 0 auto; min-width: 44px; padding: 9px 12px; }
114
- footer button.wide { flex: 1 0 auto; background: transparent; border-color: var(--brass); color: var(--brass); }
114
+ footer button.wide { flex: 1 0 auto; background: transparent; border-color: var(--brass); color: var(--brass-ink); }
115
115
  @media (max-width: 700px) {
116
116
  #app { grid-template-columns: minmax(0, 1fr); }
117
117
  #list, #room { grid-column: 1; grid-row: 1; border-right: 0; }
@@ -194,7 +194,7 @@ html[data-door="device"] #room { height: 100%; }
194
194
  .chip[data-access="offline"] { color: var(--warn); border-color: var(--warn); }
195
195
  #signin-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: rgba(210, 169, 78, .14); border-bottom: 1px solid var(--brass); font-size: .8125rem; }
196
196
  #signin-text { flex: 1; min-width: 160px; }
197
- a.button { font: 600 .8125rem var(--sans); text-decoration: none; border-radius: 7px; padding: 7px 11px; background: transparent; border: 1px solid var(--brass); color: var(--brass); }
197
+ a.button { font: 600 .8125rem var(--sans); text-decoration: none; border-radius: 7px; padding: 7px 11px; background: transparent; border: 1px solid var(--brass); color: var(--brass-ink); }
198
198
  #signin-form input { flex: 1; min-width: 130px; font: .875rem var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; }
199
199
  /* On a narrow screen the key row wraps instead of hiding its end, and
200
200
  dictation comes first: by voice is how a phone is used. */
@@ -245,7 +245,7 @@ footer button.careful { border-style: dashed; color: var(--ink2); }
245
245
  #viewer .row { align-items: center; gap: 8px; flex-wrap: wrap; }
246
246
  #viewer .sp { flex: 1; }
247
247
  #viewer #preview-name { overflow-wrap: anywhere; }
248
- #viewer a.button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 8px; background: transparent; border: 1px solid var(--brass); color: var(--brass); font-weight: 600; text-decoration: none; }
248
+ #viewer a.button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 8px; background: transparent; border: 1px solid var(--brass); color: var(--brass-ink); font-weight: 600; text-decoration: none; }
249
249
  #viewer button { min-height: 40px; }
250
250
  #viewer p { margin: 0; }
251
251
  #preview-body { overflow: auto; flex: 1; min-height: 0; }
@@ -379,7 +379,7 @@ footer button.careful { border-style: dashed; color: var(--ink2); }
379
379
  #viewer .md-switch button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink2); font-weight: 600; }
380
380
  #viewer .md-switch button[aria-pressed="true"] { background: var(--bar); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
381
381
  #preview-body .md-view { display: block; container: none; min-height: 0; padding: 0 2px 24px; font-size: .9375rem; line-height: 1.55;
382
- --parley-bg: var(--panel); --parley-text: var(--ink); --parley-dim: var(--ink2); --parley-line: var(--line); --parley-agent: var(--bar); --parley-action: var(--brass); --parley-measure: 80ch; }
382
+ --parley-bg: var(--panel); --parley-text: var(--ink); --parley-dim: var(--ink2); --parley-line: var(--line); --parley-agent: var(--bar); --parley-action: var(--brass-ink); --parley-measure: 80ch; }
383
383
  :root[data-theme="light"] #preview-body .md-view { --parley-action: #8a5d00; }
384
384
  #preview-body .md-view .parley-md { max-width: 80ch; }
385
385
  #preview-body .md-view .parley-md > * + * { margin-top: .8em; }
@@ -446,7 +446,7 @@ footer button.careful { border-style: dashed; color: var(--ink2); }
446
446
  #chat-off p { margin: 0 0 10px; font-size: 1rem; }
447
447
  #chat-off p + p { color: var(--ink2); }
448
448
  #simple[data-chat] { display: flex; flex-direction: column; overflow: hidden; padding: 10px 14px 12px; }
449
- #simple-thread { flex: 1; min-height: 0; --parley-bg: var(--bg); --parley-text: var(--ink); --parley-dim: var(--ink2); --parley-line: var(--line); --parley-agent: var(--panel); --parley-person: var(--bar); --parley-ask: var(--brass); --parley-action: var(--brass); --parley-on-action: #1b1405; --parley-live: var(--danger); }
449
+ #simple-thread { flex: 1; min-height: 0; --parley-bg: var(--bg); --parley-text: var(--ink); --parley-dim: var(--ink2); --parley-line: var(--line); --parley-agent: var(--panel); --parley-person: var(--bar); --parley-ask: var(--brass-ink); --parley-action: var(--brass-ink); --parley-on-action: #1b1405; --parley-live: var(--danger); }
450
450
 
451
451
 
452
452
  /* Private repositories: how the server gets in, and the keys made here. */
@@ -1953,7 +1953,7 @@ details.chapter[data-attention] > summary .chapter-title::after, #settings-nav b
1953
1953
  /* Its whole height: a long card neither runs past its ground nor under what follows it (Assets). */
1954
1954
  .binder-holder > .binder, .as-binder { flex-shrink: 0; }
1955
1955
  body .binder-holder .binder { --binder-bg: var(--bg); --binder-text: var(--ink); --binder-dim: var(--ink2); --binder-line: var(--line); --binder-panel: var(--panel);
1956
- --binder-action: var(--brass); --binder-on-action: #1b1405; --binder-ok: var(--ok); --binder-ask: var(--warn); --binder-danger: var(--danger); }
1956
+ --binder-action: var(--brass-ink); --binder-on-action: #1b1405; --binder-ok: var(--ok); --binder-ask: var(--warn); --binder-danger: var(--danger); }
1957
1957
  .binder-holder .binder-new-list, .binder-holder .binder-empty .binder-primary { display: none; }
1958
1958
  /* One list opened in Assets: no row of tabs for it alone. */
1959
1959
  .as-binder .binder-top { display: none; }
@@ -2021,7 +2021,7 @@ details.commit > pre { margin: 6px 0 0 1.6em; white-space: pre-wrap; overflow-wr
2021
2021
  Download stands out. Full screen: the file takes the whole screen. */
2022
2022
  #viewer .ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; min-width: 38px; height: 34px; padding: 0; }
2023
2023
  #viewer .ico svg { width: 18px; height: 18px; }
2024
- #viewer .ico.primary { background: transparent; border-color: var(--brass); color: var(--brass); }
2024
+ #viewer .ico.primary { background: transparent; border-color: var(--brass); color: var(--brass-ink); }
2025
2025
  #viewer #preview-copy[data-done="true"] { color: var(--ok); border-color: currentColor; }
2026
2026
  #viewer #preview-full[aria-pressed="true"] { border-color: var(--brass); }
2027
2027
  #viewer.viewer-full { padding: 0; }
@@ -2169,3 +2169,25 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
2169
2169
  .sheet-table th { position: sticky; background: var(--bar); color: var(--ink2); font-weight: 600; }
2170
2170
  .sheet-table thead th { top: 0; z-index: 1; } .sheet-table tbody th { left: 0; }
2171
2171
  .doc-frame { width: 100%; min-height: 70vh; border: 0; border-radius: 8px; background: transparent; }
2172
+
2173
+ /* THE CONVERSATIONS AS CARDS (02-11): playing cards, one per conversation, and one to add. */
2174
+ #list-title { cursor: pointer; }
2175
+ #deck { overflow-y: auto; }
2176
+ .deck { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; padding: 14px 2px 24px; }
2177
+ .conv-card { position: relative; aspect-ratio: 63 / 88; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(160deg, var(--bar), var(--panel)); color: var(--ink); text-align: left; font: inherit; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); cursor: pointer; transition: transform .15s, border-color .15s; min-height: 0; }
2178
+ .conv-card:hover, .conv-card:focus-visible { transform: translateY(-3px); border-color: var(--brass); }
2179
+ .conv-card-plate { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
2180
+ .conv-card-plate b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
2181
+ .conv-card-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ink2); }
2182
+ .conv-card-dot[data-state="ready"] { background: var(--ok); } .conv-card-dot[data-state="waits"] { background: var(--wait); } .conv-card-dot[data-state="busy"] { background: var(--ink2); }
2183
+ .conv-card-dot[data-state="asleep"] { background: transparent; border: 1.5px solid var(--ink2); } .conv-card-dot[data-state="problem"] { background: var(--danger); }
2184
+ .conv-card-art { flex: 1.2; min-height: 0; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: linear-gradient(135deg, hsl(var(--h) 38% 30%), hsl(calc(var(--h) + 40) 42% 14%)); }
2185
+ .conv-card-initial { font: 700 2.4rem/1 var(--sans); color: rgba(255, 255, 255, .82); }
2186
+ .conv-card-type { font-size: .74rem; color: var(--ink2); padding: 2px 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2187
+ .conv-card-text { flex: .9; min-height: 0; display: flex; flex-direction: column; gap: 3px; padding: 2px 6px; font-size: .78rem; color: var(--ink2); overflow: hidden; }
2188
+ .conv-card-text i { font-style: normal; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
2189
+ .conv-card-new { align-items: center; justify-content: center; border-style: dashed; border-width: 1.5px; background: transparent; box-shadow: none; color: var(--ink2); }
2190
+ .conv-card-plus { font-size: 2.6rem; line-height: 1; color: var(--brass); }
2191
+ .deck-empty { text-align: center; padding: 48px 16px; color: var(--ink2); }
2192
+ .deck-empty-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
2193
+ @media (max-width: 520px) { .deck { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }