clavarium 0.2.263-next.1 → 0.2.266-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.
@@ -17,6 +17,10 @@ esac
17
17
  [ $# -gt 0 ] || { echo "launch: no command to run" >&2; exit 64; }
18
18
  node "$(dirname "$0")/json-set.mjs" .claude/settings.json "$keys" \
19
19
  || echo "launch: the settings of Claude Code were not changed: it may ask before acting" >&2
20
+ # ITS FIRST QUESTIONS ANSWERED BEFORE THEY ARE ASKED (02-11): the welcome (theme, tips) taken as seen, and its
21
+ # work folder trusted -- in its own file, as it records them itself; nothing to answer in the terminal.
22
+ node "$(dirname "$0")/json-set.mjs" .claude.json '{"hasCompletedOnboarding": true, "projects": {"/work": {"hasTrustDialogAccepted": true}}}' \
23
+ || echo "launch: Claude Code may ask its first questions in the terminal" >&2
20
24
  # ITS TOOLS (MCP), EACH THROUGH THE RELAY (02-11): a tool updated on the machine is taken up between two of
21
25
  # its requests -- whatever the tool, the session never restarted, nothing for the agent to do. Declared
22
26
  # once, by Claude Code itself (its other servers kept); an older declaration without the relay is replaced.
@@ -48,4 +52,11 @@ if [ -f "$chat/server.mjs" ]; then
48
52
  node "$(dirname "$0")/claude-pulse.mjs" "$chat" \
49
53
  || echo "launch: the chat will not say when Claude Code works without a word" >&2
50
54
  fi
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; 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
+ node "$(dirname "$0")/screen-watch.mjs" \
59
+ 'link:https://(claude\.ai|claude\.com|console\.anthropic\.com)/[^ ]*oauth[^ ]*' \
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
+ </dev/null >/dev/null 2>&1 &
51
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 "$@"
@@ -1,5 +1,6 @@
1
1
  /* json-set FILE KEYS: sets KEYS (a JSON object; null takes a key out) in the
2
- * JSON file FILE of the home, every other key kept. Written only when it
2
+ * JSON file FILE of the home, every other key kept -- inside objects too (02-11:
3
+ * {"projects": {"/work": {...}}} keeps the other projects and their other keys). Written only when it
3
4
  * changes, readable by its owner alone. A file that is not a JSON object is
4
5
  * not touched (exit 3): a person's settings are never overwritten by a guess.
5
6
  *
@@ -21,7 +22,9 @@ try { data = JSON.parse(readFileSync(at, 'utf8')); } catch (error) {
21
22
  }
22
23
  if (!data || typeof data !== 'object' || Array.isArray(data)) { console.error(`json-set: ${file} is not a JSON object: left as it is`); process.exit(3); }
23
24
  const was = JSON.stringify(data);
24
- for (const [k, v] of Object.entries(keys)) { if (v === null) delete data[k]; else data[k] = v; }
25
+ const plain = (v) => v && typeof v === 'object' && !Array.isArray(v);
26
+ const merge = (into, from) => { for (const [k, v] of Object.entries(from)) { if (v === null) delete into[k]; else if (plain(v) && plain(into[k])) merge(into[k], v); else into[k] = v; } };
27
+ merge(data, keys);
25
28
  if (JSON.stringify(data) !== was) {
26
29
  mkdirSync(dirname(at), { recursive: true, mode: 0o700 });
27
30
  writeFileSync(`${at}.new`, `${JSON.stringify(data, null, 2)}\n`, { mode: 0o600 });
@@ -0,0 +1,69 @@
1
+ /* screen-watch RULE... : a generic reader of the tool's terminal (02-11). Every few seconds it reads the
2
+ * bottom of the screen of the tool (tmux) and acts on what a launcher said to look for -- nothing here
3
+ * knows a tool: its launcher (claude-code.sh, a codex.sh...) gives the rules, so a tool that changes its
4
+ * words is followed by changing its launcher alone.
5
+ *
6
+ * A rule: KIND:PATTERN[=VALUE], PATTERN a JavaScript regular expression (flag i).
7
+ * link:PATTERN a link on the screen (the match): sent in the chat, to be opened by the person
8
+ * (a sign-in, say); once per link.
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).
12
+ * keys:PATTERN=K a question with one answer always: the keys K typed (Enter, Down, Up, Escape, 1, y...),
13
+ * once per screen. Only what its launcher wrote: nothing else is ever typed.
14
+ * Only the last LINES lines are read: what the tool prints of its own work above never counts.
15
+ */
16
+ import { spawnSync } from 'node:child_process';
17
+
18
+ const LINES = 12; const EVERY_MS = 3000;
19
+ const KEYS = new Set(['Enter', 'Down', 'Up', 'Left', 'Right', 'Escape', 'Tab', 'y', 'n', '1', '2', '3']);
20
+ export function rulesOf(args) {
21
+ return args.flatMap((a) => {
22
+ const m = /^(link|notice|keys):(.+)$/s.exec(a); if (!m) return [];
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 []; }
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 []; }
26
+ try { return [{ kind: m[1], re: new RegExp(pattern, 'i'), value }]; } catch { return []; }
27
+ });
28
+ }
29
+ /* -> what to do on this screen: [{ kind, match, value }], each once (seen: a Set kept between looks). */
30
+ export function actionsOn(screen, rules, seen) {
31
+ const bottom = String(screen).replace(/\s+$/u, '').split('\n').slice(-LINES).join('\n');
32
+ const out = [];
33
+ for (const r of rules) {
34
+ const m = r.re.exec(bottom); if (!m) continue;
35
+ const key = `${r.kind}:${r.kind === 'link' ? m[0] : bottom}`;
36
+ if (seen.has(key)) continue;
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 });
44
+ }
45
+ if (seen.size > 200) for (const k of [...seen].slice(0, 100)) seen.delete(k);
46
+ return out;
47
+ }
48
+
49
+ const main = process.argv[1]?.endsWith('screen-watch.mjs');
50
+ if (main) {
51
+ const rules = rulesOf(process.argv.slice(2));
52
+ const tmux = ['-L', process.env.SCREEN_WATCH_SOCKET ?? 'clavarium'];
53
+ const pane = process.env.SCREEN_WATCH_PANE ?? '=main:';
54
+ const chat = process.env.PARLEY_DIR ?? '/work/.parley';
55
+ const seen = new Set();
56
+ const look = () => {
57
+ const r = spawnSync('tmux', [...tmux, 'capture-pane', '-p', '-t', pane], { encoding: 'utf8', timeout: 5000 });
58
+ if (r.status !== 0) return;
59
+ for (const a of actionsOn(r.stdout, rules, seen)) {
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 });
62
+ if (a.kind === 'keys') for (const k of a.value) spawnSync('tmux', [...tmux, 'send-keys', '-t', pane, k], { timeout: 5000 });
63
+ }
64
+ };
65
+ /* Its life is the tool's: started just before the launcher becomes the tool (exec), it ends with it. */
66
+ const tool = process.ppid;
67
+ const alive = () => { try { process.kill(tool, 0); return true; } catch { return false; } };
68
+ if (rules.length) setInterval(() => { if (!alive()) process.exit(0); look(); }, EVERY_MS);
69
+ }
@@ -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.263-next.1",
3
+ "version": "0.2.266-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.263-next.1",
9
+ "version": "0.2.266-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.263-next.1",
3
+ "version": "0.2.266-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);
package/web/index.html CHANGED
@@ -1019,12 +1019,13 @@
1019
1019
  <details class="more"><summary>Which one?</summary>A code project that installs packages: its disk. Can be changed later.</details>
1020
1020
  </div>
1021
1021
  <details class="chapter" id="newconv-more">
1022
- <summary><span class="chapter-title">More</span><span class="chapter-about">Identifier, memory, cores, disk.</span></summary>
1022
+ <summary><span class="chapter-title">More</span><span class="chapter-about">Identifier, memory, cores, disk, chat.</span></summary>
1023
1023
  <div class="chapter-body">
1024
1024
  <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
1025
  <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
1026
  <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
1027
  <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>
1028
+ <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
1029
  </div>
1029
1030
  </details>
1030
1031
  </div>