@chatpanel/events 0.89.0 → 0.89.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.
package/mcp-client.js CHANGED
@@ -111,7 +111,7 @@ export class McpClient {
111
111
  'Otherwise check that the command + args run in a terminal.',
112
112
  );
113
113
  }
114
- throw new Error(`Can't reach the ChatPanel Bridge for local MCP (${e.message}). Start it with \`npx @chatpanel/bridge\`.`);
114
+ throw new Error(`Can't reach the ChatPanel Bridge for local MCP (${e.message}). Install ChatPanel — the gateway brings the bridge (npm i -g @chatpanel/gateway && chatpanel-gateway --install) — or start one with \`npx @chatpanel/bridge\`.`);
115
115
  }
116
116
  if (message.id == null) return null; // notification → 202, no body
117
117
  if (!res.ok) throw new Error(`Bridge MCP HTTP ${res.status}: ${(await res.text().catch(() => '')).slice(0, 200)}`);
@@ -137,7 +137,7 @@ export class McpClient {
137
137
  if (e?.name === 'AbortError' || signal?.aborted) {
138
138
  throw new Error('The MCP server didn’t respond in time (proxied through the bridge).');
139
139
  }
140
- throw new Error(`Can't reach the ChatPanel Bridge to proxy this server (${e.message}). Start it with \`npx @chatpanel/bridge\`, or set this server to connect Directly.`);
140
+ throw new Error(`Can't reach the ChatPanel Bridge to proxy this server (${e.message}). Install ChatPanel — the gateway brings the bridge — or start one with \`npx @chatpanel/bridge\`, or set this server to connect Directly.`);
141
141
  }
142
142
  if (!res.ok) {
143
143
  const body = await res.text().catch(() => '');
package/mcp-errors.js CHANGED
@@ -45,7 +45,7 @@ const RULES = [
45
45
  explain: () => ({
46
46
  summary: 'The ChatPanel Bridge is not running.',
47
47
  detail: 'Local MCP servers are launched by the bridge, so nothing can start without it.',
48
- fix: 'Start it with `npx @chatpanel/bridge`, then try again.',
48
+ fix: 'Install ChatPanel — the gateway, which brings the bridge (`npm i -g @chatpanel/gateway && chatpanel-gateway --install`, or https://dl.chatpanel.net/install.sh) — or start a bridge with `npx @chatpanel/bridge`, then try again.',
49
49
  blame: 'setup',
50
50
  }),
51
51
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/events",
3
- "version": "0.89.0",
3
+ "version": "0.89.1",
4
4
  "description": "The canonical ChatPanel event-log and capability contracts \u2014 typed durable facts, clock-free deterministic linearization, schema upcasting, and the invariants the replay harness asserts. Pure, dependency-free ESM shared by the ChatPanel extension, gateway and bridge.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/recruit.js CHANGED
@@ -94,15 +94,20 @@ export function engineRow(candidate, { card = null, minCalls = DEFAULT_MIN_CALLS
94
94
  const capabilities = [...new Set(lower(c.capabilities))].filter((x) => !withdrawn.has(x));
95
95
  if (withdrawn.size && lower(c.capabilities).some((x) => withdrawn.has(x))) observed.push('capabilities');
96
96
  const num = (v) => (v == null || v === '' || !Number.isFinite(Number(v)) ? null : Number(v));
97
+ const reach = REACH_RANK[c.reach] != null ? c.reach : 'any';
98
+ // A model on this machine costs nothing per token — the router's own rule (`costOf`), kept
99
+ // here for a host that has no guess to offer; an unknown cost anywhere else stays unknown
100
+ // and orders as the dearest, so "we did not price it" never reads as "free".
101
+ const costPer1k = override.costPer1k ?? num(c.costPer1k) ?? (reach === 'device' && engine.kind === 'model' ? 0 : null);
97
102
  return {
98
103
  key,
99
104
  engine,
100
105
  label: clip(c.label || c.name || engineName(engine), 120),
101
- reach: REACH_RANK[c.reach] != null ? c.reach : 'any',
106
+ reach,
102
107
  capabilities,
103
108
  quality: override.quality ?? num(c.quality),
104
109
  latencyMs: override.latencyMs ?? num(c.latencyMs),
105
- costPer1k: override.costPer1k ?? num(c.costPer1k),
110
+ costPer1k,
106
111
  costPerTask: num(card?.cost?.perTask),
107
112
  availability: num(card?.availability?.rate),
108
113
  available: override.available ?? (c.available !== false && c.usable !== false),
@@ -390,7 +395,7 @@ export function carveBudget(job, record = null) {
390
395
  * the why — or back to `open`, with the proposal as a decision a person reads.
391
396
  */
392
397
  export function recruitEvents(job, apps, decision, { by = 'evaluator', at = Date.now(), record = null } = {}) {
393
- const events = [{ type: 'job.updated', at, job: { id: job.id, status: 'evaluating', applications: apps }, by }];
398
+ const events = [{ type: 'job.updated', at, job: { id: job.id, status: 'evaluating', applications: (apps || []).map(({ covers: _c, ...a }) => a) }, by }];
394
399
  if (decision?.kind === 'recruit') {
395
400
  const budget = carveBudget(job, record);
396
401
  events.push({ type: 'job.updated', at, job: { id: job.id, status: 'recruited', recruited: { agentId: decision.agentId, engine: decision.engine, ...(budget ? { budget } : {}), by: decision.by || by, at, why: clip(decision.why, 600) } }, by });