eve-hub 0.8.1 → 0.9.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # eve-hub
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - The bots no longer write the hub's tables. A bot's append goes to its own session stream, and the hub folds that stream into turns and replies after a wake (`/api/fold`). Needs a hub that serves `/api/fold`.
8
+
9
+ ## 0.8.2
10
+
11
+ ### Patch Changes
12
+
13
+ - The per-bot mention gate is gone: the hub decides who a bot's message wakes (wake router), so the `hooks/mention-gate` hook is removed from the kit.
14
+
3
15
  ## 0.8.1
4
16
 
5
17
  ### Patch Changes
package/kit-modules.json CHANGED
@@ -2,7 +2,6 @@
2
2
  "channels/eve",
3
3
  "channels/eve-roster-user",
4
4
  "connections/vercel-kit",
5
- "hooks/mention-gate",
6
5
  "hooks/sandbox",
7
6
  "instructions/engineering",
8
7
  "instructions/main",
@@ -2,5 +2,4 @@ export type GateConfig = { enabled: boolean; model: string; api: 'chat' | 'decis
2
2
  export function gateConfig(env?: Record<string, string | undefined>, file?: unknown): GateConfig;
3
3
  export function opensWithHandle(text: string, agent: string): boolean;
4
4
  export function cleanReason(reason: unknown): string;
5
- export function screenInbound(input: { text: string; sessionId: string; agent?: string; registryUrl: string; credential: (opts?: { refresh?: boolean }) => Promise<{ token: string; teamId?: string | null } | null>; instructions?: string; fetchImpl?: typeof fetch; log?: ((line: string) => void) | null }): Promise<{ cancel: boolean; result?: unknown }>;
6
5
  export function hubCredentialLoader(fetchHub: (path: string, init: { headers?: Record<string, string> }) => Promise<Response>): (opts?: { refresh?: boolean }) => Promise<{ ok: boolean; token?: string; error?: string }>;
package/mention-gate.mjs CHANGED
@@ -1,19 +1,7 @@
1
- // Mention gate: when a bot's turn is woken by an @-mention or a DM, the bot
2
- // itself (its message.received hook, hooks/mention-gate.ts) asks a cheap
3
- // model, through AI Gateway, whether a reply is needed, before its main model
4
- // runs. The model reads the bot's own instructions and the delivery the bot
5
- // just received. A handle inside code (codeRanges) is dropped by
6
- // parseMentions before it joins or wakes anyone; the gate catches the other
7
- // incidental ones: a quote or a recap, or an ack that asks nothing.
8
- //
9
- // The hub decides which wakes are gated (gatedWake, registry/server.mjs) and
10
- // owns the outcome: the hook asks it first (POST /api/mention-gate/check),
11
- // then reports the decision (POST /api/mention-gate/report); on a skip the
12
- // hub posts the system line and records the usage, and the hook cancels the
13
- // turn. Biased to answering: the model only classifies the message (how the
14
- // handle is used, what it asks of the bot); skipFor decides, and any error,
15
- // timeout or unreadable verdict answers. Only bots' messages are gated: the
16
- // human's always wake.
1
+ // The decision-model helpers the registry's mention gate (registry/server.mjs, frozen until its removal) and the hosted hub's wake
2
+ // router and closing check share: the gateway config (gateConfig), the Mac bot credential loader and the response parsing. The bot-side
3
+ // hook is gone; the hosted hub decides who a message wakes (hosted-hub/src/store/wake-router.ts). A handle inside code (codeRanges)
4
+ // is dropped by parseMentions before it joins or wakes anyone.
17
5
  //
18
6
  // Config (the hub's, sent to the hook with each check): `mentionGate` in
19
7
  // hub.workspace.json ({ enabled, model, reasoningEffort, timeoutMs }),
@@ -21,7 +9,6 @@
21
9
  // HUB_MENTION_GATE_REASONING, HUB_MENTION_GATE_TIMEOUT_MS and
22
10
  // HUB_MENTION_GATE_URL (tests).
23
11
  import { codeRanges } from "./mention-tokens.mjs";
24
- import { hubHeaders } from "./registry-fetch.mjs";
25
12
  import { createHash } from "node:crypto";
26
13
 
27
14
  export { codeRanges };
@@ -395,45 +382,6 @@ export function credentialCache(load, { ttlMs = 10 * 60e3, failMs = 60e3, now =
395
382
  return get;
396
383
  }
397
384
 
398
- // --- The bot's side (hooks/mention-gate.ts).
399
-
400
- const HUB_CALL_MS = 2000;
401
-
402
- async function hubCall(fetchImpl, url, body) {
403
- const res = await fetchImpl(url, { method: "POST", headers: await hubHeaders({ "content-type": "application/json" }), body: JSON.stringify(body), signal: AbortSignal.timeout(HUB_CALL_MS) });
404
- if (!res.ok) throw new Error(`hub ${res.status}`);
405
- return res.json();
406
- }
407
-
408
- // One inbound delivery, screened. Never throws; { cancel: true } only when the
409
- // hub accepted a skip (it posted the system line and expects the turn to
410
- // end cancelled). Anything that fails on the way answers.
411
- // text: the delivery (message.received's data.message)
412
- // credential: ({ refresh }) → { token, teamId? } | null (credentialCache)
413
- // `agent` is optional: left out, the hub names the bot from its session and sends its instructions.
414
- export async function screenInbound({ text, sessionId, agent, registryUrl, instructions = "", credential, fetchImpl = fetch, log = console.warn }) {
415
- const messageId = triggerId(text);
416
- if (!registryUrl || !messageId) return { cancel: false };
417
- let check;
418
- try {
419
- check = await hubCall(fetchImpl, `${registryUrl}/api/mention-gate/check`, { ...(agent ? { agent } : {}), messageId, sessionId });
420
- } catch (error) {
421
- log?.(`[mention-gate] check for ${messageId} failed, answering: ${error?.message ?? error}`);
422
- return { cancel: false };
423
- }
424
- if (!check?.gate || !check.config) return { cancel: false };
425
- agent ??= check.agent;
426
- instructions ||= check.instructions ?? "";
427
- const r = await decide({ config: check.config, credential, prompt: promptFor(check.config, { agent, human: check.humanName ?? "the human", instructions, envelope: text, broadcast: Boolean(check.broadcast) }), addressed: Boolean(check.addressed), fetchImpl });
428
- try {
429
- const ack = await hubCall(fetchImpl, `${registryUrl}/api/mention-gate/report`, { ...(agent ? { agent } : {}), messageId, sessionId, skip: r.skip, reason: r.reason, verdict: r.verdict ?? null, usage: r.usage ?? null, ms: r.ms, error: r.error ?? null });
430
- return { cancel: Boolean(r.skip && ack?.skip), result: r };
431
- } catch (error) {
432
- log?.(`[mention-gate] report for ${messageId} failed, answering: ${error?.message ?? error}`);
433
- return { cancel: false, result: r };
434
- }
435
- }
436
-
437
385
  // A Mac bot's AI Gateway credential: the hub mints an OIDC token for the workspace's bots project, asked for with the bot's HUB_TOKEN.
438
386
  // `fetchHub(path, init)` is registryFetch. On a refresh it names the token AI Gateway refused, as eve's served credential does.
439
387
  export function hubCredentialLoader(fetchHub) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve-hub",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Bot-side code shared by every hub agent: registry tools, the roster hook, the eve channel, the host sandbox and browser, and model helpers.",
6
6
  "type": "module",
package/stubs.mjs CHANGED
@@ -4,7 +4,6 @@
4
4
  export const KIT_FILES = {
5
5
  "channels/eve.ts": ["Queued eve channel that resolves the registry's human as a user.", "channels/eve-roster-user.ts"],
6
6
  "hooks/sandbox.ts": ["Migrates legacy Docker sessions to the host sandbox."],
7
- "hooks/mention-gate.ts": ["Mention gate: a cheap model decides whether an inbound @-mention or DM needs a turn."],
8
7
  "tools/bash.ts": ["eve's bash with a default time limit (kills the process group) and the workspace's code location."],
9
8
  "tools/react.ts": ["React to a message with an emoji."],
10
9
  "tools/show.ts": ["Move the human's screen to a thread, DM, or message."],
@@ -52,7 +51,6 @@ export const MAIN_KIT_FILES = {
52
51
  // main's dash schedule stays: off the hub's machine it has no PR data (its lookup runs `gh`).
53
52
  export const DEPLOYED_KIT_FILES = new Set([
54
53
  "channels/eve.ts",
55
- "hooks/mention-gate.ts",
56
54
  "schedules/dash.ts",
57
55
  "skills/onboarding-profile.ts",
58
56
  "tools/onboarding_scripts.ts",