clavarium 0.2.502-next.1 → 0.2.504-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.
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.502-next.1",
3
+ "version": "0.2.504-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.502-next.1",
9
+ "version": "0.2.504-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
14
  "clavarium-binder": "0.1.66-next.1",
15
15
  "clavarium-docket": "0.1.2-next.3",
16
- "clavarium-parley": "0.17.100-next.1",
16
+ "clavarium-parley": "0.17.101-next.1",
17
17
  "clavarium-tether": "0.1.0-next.79",
18
18
  "mammoth": "1.13.0",
19
19
  "mermaid": "11.17.2",
@@ -787,9 +787,9 @@
787
787
  }
788
788
  },
789
789
  "node_modules/clavarium-parley": {
790
- "version": "0.17.100-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.100-next.1.tgz",
792
- "integrity": "sha512-jgdcST6gGZPeUFG/vXrXKH0PEVRpuI1Cib3QiwPvnohJ+E5+dRiwSBdUoq46DUE7JWntJHeqZJOND/dgVL4owA==",
790
+ "version": "0.17.101-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.101-next.1.tgz",
792
+ "integrity": "sha512-OwQhmMDa8TvYXaDVIHKKBG3x2sKdkdIJUm9A/NTArSSTnAG/liD5iIt+rilcMZM7820ogmywoF8cU+3RUoJZbg==",
793
793
  "license": "MIT",
794
794
  "bin": {
795
795
  "parley": "bin/parley.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.502-next.1",
3
+ "version": "0.2.504-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.",
@@ -47,7 +47,7 @@
47
47
  "@xterm/xterm": "^6.0.0",
48
48
  "clavarium-binder": "0.1.66-next.1",
49
49
  "clavarium-docket": "0.1.2-next.3",
50
- "clavarium-parley": "0.17.100-next.1",
50
+ "clavarium-parley": "0.17.101-next.1",
51
51
  "clavarium-tether": "0.1.0-next.79",
52
52
  "mammoth": "1.13.0",
53
53
  "mermaid": "11.17.2",
@@ -175,14 +175,22 @@ export class Dockets {
175
175
  if (due.length && (fresh.length || this.#idle(name))) {
176
176
  if (await this.#say(name, WAKE).catch(() => false)) for (const e of due) told[e.id] = { count: (told[e.id]?.count ?? 0) + 1, at: now };
177
177
  }
178
+ /* One line per stall (20-11, the owner: a night frozen, 58 lines, one an hour): while one said
179
+ is still unhandled, the next ones are only counted; once none is left, one line says how many. */
180
+ let grouped = record.grouped ?? 0;
178
181
  for (const e of waiting) {
179
182
  const t = told[e.id];
180
183
  if (t && t.count >= TOLD_MAX && !t.said && now - t.at >= AGAIN_MS) {
184
+ if (waiting.some((o) => told[o.id]?.said === true)) { t.said = 'grouped'; grouped += 1; continue; }
181
185
  this.#line(name, { kind: 'docket-unhandled', text: `Not handled, told ${t.count} times: ${e.text}`, tone: 'warn', topic: 'Not handled' });
182
186
  t.said = true;
183
187
  }
184
188
  }
185
- if (JSON.stringify(told) !== JSON.stringify(record.told ?? {})) this.#store.put({ ...record, told });
189
+ if (grouped && !waiting.some((o) => told[o.id]?.said === true)) {
190
+ this.#line(name, { kind: 'docket-unhandled', text: `And ${grouped} more not handled meanwhile.`, tone: 'warn', topic: 'Not handled' });
191
+ grouped = 0;
192
+ }
193
+ if (JSON.stringify(told) !== JSON.stringify(record.told ?? {}) || grouped !== (record.grouped ?? 0)) this.#store.put({ ...record, told, grouped });
186
194
  }
187
195
  } finally { this.#busy = false; }
188
196
  }
package/server/mcpx.mjs CHANGED
@@ -68,6 +68,17 @@ export async function mcpAdd({ tethers, secrets }, body = {}) {
68
68
  return scrub(shown(r.data), key);
69
69
  }
70
70
 
71
+ /* Where a pasted block keeps its servers (20-11, the owner: not all say "mcpServers"): "mcpServers" (Claude, Cursor,
72
+ Windsurf), "servers" (VS Code's mcp.json), "mcp": { "servers" } (VS Code's settings), "mcp" (OpenCode),
73
+ "context_servers" (Zed), or one server by itself ({ "url": ... }). */
74
+ const OBJ = (x) => (x && typeof x === 'object' && !Array.isArray(x) ? x : null);
75
+ export function serversOf(j) {
76
+ if (!OBJ(j)) return null;
77
+ const one = j.url || j.serverUrl || j.httpUrl;
78
+ return OBJ(j.mcpServers) ?? OBJ(j.servers) ?? OBJ(OBJ(j.mcp)?.servers) ?? (OBJ(j.mcp) && !OBJ(j.mcp).servers ? j.mcp : null) ?? OBJ(j.context_servers) ?? (one ? { [j.name || 'mcp']: j } : null);
79
+ }
80
+ /* A program to start, whatever its tool calls it (OpenCode: "type": "local", its command a list). */
81
+ const isProgram = (s) => s.command !== undefined || s.args !== undefined || s.type === 'stdio' || s.type === 'local';
71
82
  /* IMPORT a pasted { "mcpServers": { name: { url, headers: { Authorization: "Bearer ${NAME}" } } } }: each key a
72
83
  reference to a secret of the vault (none written in it), no program to start. -> the targets made. */
73
84
  export async function mcpImport({ tethers, secrets }, body = {}) {
@@ -75,13 +86,13 @@ export async function mcpImport({ tethers, secrets }, body = {}) {
75
86
  if (typeof config === 'string') {
76
87
  try { config = JSON.parse(config); } catch { throw new Refusal(400, 'That is not JSON: paste the whole { "mcpServers": ... } block.'); }
77
88
  }
78
- const all = config && typeof config === 'object' ? (config.mcpServers ?? config.servers) : null;
89
+ const all = serversOf(config);
79
90
  if (!all || typeof all !== 'object' || Array.isArray(all) || !Object.keys(all).length) throw new Refusal(400, 'Paste a block like { "mcpServers": { "name": { "url": "https://...", "headers": { "Authorization": "Bearer ${SECRET}" } } } }.');
80
91
  const servers = {};
81
92
  for (const [name, s] of Object.entries(all)) {
82
93
  const label = String(name).slice(0, 60);
83
94
  if (!s || typeof s !== 'object' || Array.isArray(s)) throw new Refusal(400, `${label}: not a server.`);
84
- if (s.command !== undefined || s.args !== undefined || s.type === 'stdio') throw new Refusal(400, `${label}: a program to start (stdio) is not run here. Only a server reached by its address.`);
95
+ if (isProgram(s)) throw new Refusal(400, `${label}: a program to start (stdio) is not run here. Only a server reached by its address.`);
85
96
  const heads = s.headers && typeof s.headers === 'object' && !Array.isArray(s.headers) ? Object.entries(s.headers) : [];
86
97
  if (heads.length > 1) throw new Refusal(400, `${label}: one header for the key at most.`);
87
98
  for (const [h, v] of heads) {
@@ -91,7 +102,7 @@ export async function mcpImport({ tethers, secrets }, body = {}) {
91
102
  if (!REF.test(m[2]) || !known(secrets, m[2])) throw new Refusal(400, `${label}: no secret named ${m[2].slice(0, 60)} here. Add it in Secrets first.`);
92
103
  }
93
104
  if (s.env && typeof s.env === 'object' && Object.keys(s.env).length) throw new Refusal(400, `${label}: "env" is for a program to start. Only a server reached by its address.`);
94
- servers[name] = { url: s.url ?? s.serverUrl, ...(heads.length ? { headers: Object.fromEntries(heads) } : {}), ...(s.allowHttp === true ? { allowHttp: true } : {}) };
105
+ servers[name] = { url: s.url ?? s.serverUrl ?? s.httpUrl, ...(heads.length ? { headers: Object.fromEntries(heads) } : {}), ...(s.allowHttp === true ? { allowHttp: true } : {}) };
95
106
  }
96
107
  const r = await tethers.act('mcp-import', { config: { mcpServers: servers } }, '');
97
108
  if (!r.ok) throw new Refusal(400, r.text);
package/web/app.js CHANGED
@@ -10905,15 +10905,27 @@
10905
10905
  naming its keys as secrets (${NAME}) is imported as it is; a program to start (stdio) is not run here. */
10906
10906
  const mcpWord = (k, en, v) => uiSaid(k, en, v);
10907
10907
  const mcpMask = (k) => (k.length <= 8 ? '••••' : `${k.slice(0, 4)}••••${k.slice(-3)}`);
10908
+ /* Where a pasted block keeps its servers (20-11, the owner: not all say "mcpServers"): "mcpServers" (Claude, Cursor,
10909
+ Windsurf), "servers" (VS Code's mcp.json), "mcp": { "servers" } (VS Code's settings), "mcp" (OpenCode),
10910
+ "context_servers" (Zed), or one server by itself ({ "url": ... }). */
10911
+ const OBJ = (x) => (x && typeof x === 'object' && !Array.isArray(x) ? x : null);
10912
+ function serversOf(j) {
10913
+ if (!OBJ(j)) return null;
10914
+ const one = j.url || j.serverUrl || j.httpUrl;
10915
+ return OBJ(j.mcpServers) ?? OBJ(j.servers) ?? OBJ(OBJ(j.mcp)?.servers) ?? (OBJ(j.mcp) && !OBJ(j.mcp).servers ? j.mcp : null) ?? OBJ(j.context_servers) ?? (one ? { [j.name || 'mcp']: j } : null);
10916
+ }
10917
+ /* A program to start, whatever its tool calls it (OpenCode: "type": "local", its command a list). */
10918
+ const isProgram = (s) => s.command !== undefined || s.args !== undefined || s.type === 'stdio' || s.type === 'local';
10919
+
10908
10920
  function mcpRead(text) {
10909
10921
  let j;
10910
10922
  try { j = JSON.parse(text); } catch { return { error: mcpWord('set-mcp-notjson', 'Not JSON: paste the whole block.') }; }
10911
- const all = j && typeof j === 'object' ? (j.mcpServers ?? j.servers ?? (j.url || j.serverUrl ? { [j.name || 'mcp']: j } : null)) : null;
10923
+ const all = serversOf(j);
10912
10924
  if (!all || typeof all !== 'object' || Array.isArray(all) || !Object.keys(all).length) return { error: mcpWord('set-mcp-noserver', 'No server in this block.') };
10913
10925
  const servers = []; let refs = false;
10914
10926
  for (const [name, s] of Object.entries(all)) {
10915
10927
  if (!s || typeof s !== 'object') return { error: mcpWord('set-mcp-noserver', 'No server in this block.') };
10916
- if (s.command !== undefined || s.args !== undefined || s.type === 'stdio') return { error: mcpWord('set-mcp-program', '« {name} »: a program to start, refused here.', { name }) };
10928
+ if (isProgram(s)) return { error: mcpWord('set-mcp-program', '« {name} »: a program to start, refused here.', { name }) };
10917
10929
  const heads = s.headers && typeof s.headers === 'object' ? Object.entries(s.headers) : [];
10918
10930
  if (heads.length > 1) return { error: mcpWord('set-mcp-heads', '« {name} »: one header for its key at most.', { name }) };
10919
10931
  let key = '', header = '';
@@ -10924,7 +10936,7 @@
10924
10936
  if (h.toLowerCase() === 'authorization') { if (!bearer) return { error: mcpWord('set-mcp-basic', '« {name} »: not a « Bearer » key, fill in by hand.', { name }) }; key = bearer[1].trim(); }
10925
10937
  else { key = value; header = h; }
10926
10938
  }
10927
- servers.push({ name: String(name).slice(0, 120), url: String(s.url ?? s.serverUrl ?? ''), key, header });
10939
+ servers.push({ name: String(name).slice(0, 120), url: String(s.url ?? s.serverUrl ?? s.httpUrl ?? ''), key, header });
10928
10940
  }
10929
10941
  return { servers, refs };
10930
10942
  }