clavarium 0.2.397-next.1 → 0.2.398-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,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.397-next.1",
3
+ "version": "0.2.398-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.397-next.1",
9
+ "version": "0.2.398-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -14,7 +14,7 @@
14
14
  "clavarium-binder": "0.1.62-next.1",
15
15
  "clavarium-docket": "0.1.2-next.2",
16
16
  "clavarium-parley": "0.17.91-next.1",
17
- "clavarium-tether": "0.1.0-next.60",
17
+ "clavarium-tether": "0.1.0-next.66",
18
18
  "mammoth": "1.13.0",
19
19
  "mermaid": "11.17.2",
20
20
  "node-pty": "^1.1.0",
@@ -800,9 +800,9 @@
800
800
  }
801
801
  },
802
802
  "node_modules/clavarium-tether": {
803
- "version": "0.1.0-next.60",
804
- "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.60.tgz",
805
- "integrity": "sha512-el+ekbsskuyyy0wAnocvV/VjvpbbnHl/IpPpjZRB+qu9CdyBJHcnfbtK5CcXH84IpUfQgPF+hSdZFB6v/1CSyg==",
803
+ "version": "0.1.0-next.66",
804
+ "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.66.tgz",
805
+ "integrity": "sha512-Q1XPq+wVlZEOPuFNsHm9cATbAsVbr1QObIPa9u6e9V1KhMb1tGPpFsuU15jIflRa6tD/XaZo4VCrUtd1o8iz/w==",
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.397-next.1",
3
+ "version": "0.2.398-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.",
@@ -48,7 +48,7 @@
48
48
  "clavarium-binder": "0.1.62-next.1",
49
49
  "clavarium-docket": "0.1.2-next.2",
50
50
  "clavarium-parley": "0.17.91-next.1",
51
- "clavarium-tether": "0.1.0-next.60",
51
+ "clavarium-tether": "0.1.0-next.66",
52
52
  "mammoth": "1.13.0",
53
53
  "mermaid": "11.17.2",
54
54
  "node-pty": "^1.1.0",
@@ -1097,6 +1097,9 @@ export async function handleExternal(request, response, { keys, status, chats =
1097
1097
  try { id = keys.check(request.headers.authorization); } catch (error) { return refused(error, '/mcp'); }
1098
1098
  let text = '';
1099
1099
  for await (const piece of request) { text += piece; if (text.length > MCP_BODY_MAX) { note(id, 413, '/mcp'); return send(413, { error: 'Too long.' }); } }
1100
+ /* A protocol version said in the header, and none spoken here: refused, as the spec asks (none said: the oldest assumed). */
1101
+ const said = request.headers['mcp-protocol-version'];
1102
+ if (typeof said === 'string' && said && !MCP_VERSIONS.includes(said)) { note(id, 400, '/mcp'); return send(400, { jsonrpc: '2.0', id: null, error: { code: -32600, message: `Unsupported MCP-Protocol-Version: ${said.slice(0, 20)} (spoken: ${MCP_VERSIONS.join(', ')})` } }); }
1100
1103
  let msg;
1101
1104
  try { msg = JSON.parse(text); } catch { note(id, 400, '/mcp'); return send(400, { jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } }); }
1102
1105
  if (!msg || typeof msg !== 'object' || Array.isArray(msg) || msg.jsonrpc !== '2.0' || typeof msg.method !== 'string') {
@@ -1174,6 +1177,7 @@ export async function handleExternal(request, response, { keys, status, chats =
1174
1177
  if (!(error instanceof Refusal)) throw error;
1175
1178
  /* Not given: refused as the API refuses it (too many, too). Anything else is the tool's own failure, said to the caller. */
1176
1179
  if (error.status === 429) { note(id, 429, what); return send(429, { jsonrpc: '2.0', id: msg.id, error: { code: -32002, message: error.message } }, { 'retry-after': String(error.retry ?? 60) }); }
1180
+ /* (An HTTP 403 for a scope not given is what the MCP authorization spec says: kept, MCP review 11-11.) */
1177
1181
  if (error.status === 403) { note(id, 403, what); return send(403, { jsonrpc: '2.0', id: msg.id, error: { code: -32001, message: error.message } }); }
1178
1182
  note(id, error.status, what);
1179
1183
  return send(200, { jsonrpc: '2.0', id: msg.id, result: { content: [{ type: 'text', text: error.message }], isError: true } });