eve-hub 0.6.21 → 0.6.23
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 +12 -0
- package/package.json +1 -1
- package/schedules/dash-classify.mjs +4 -4
- package/schedules/dash-rules.mjs +1 -1
- package/schedules/hub.d.mts +1 -1
- package/schedules/hub.mjs +3 -3
- package/tools/dash_update.js +1 -1
- package/tools/restart_hub.js +1 -1
- package/world.mjs +16 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# eve-hub
|
|
2
2
|
|
|
3
|
+
## 0.6.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- A bot's world folds queued messages: a turn that ends releases the messages held for it.
|
|
8
|
+
|
|
9
|
+
## 0.6.22
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Move shared hub code (dash, hitl, delta) out of registry/ into hosted-hub/src/domain.
|
|
14
|
+
|
|
3
15
|
## 0.6.21
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve-hub",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.23",
|
|
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",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The threads part of main's dash pass (schedules/dash-pass.mjs): gives
|
|
2
|
-
// every open thread, busy or idle, a Dash entry (
|
|
2
|
+
// every open thread, busy or idle, a Dash entry (hosted-hub/src/domain/dash.mjs: importance,
|
|
3
3
|
// lane, reason) and writes them back through POST /api/dash/entries.
|
|
4
4
|
//
|
|
5
5
|
// targets open threads (not DMs, schedule threads or archived) that aren't
|
|
@@ -41,8 +41,8 @@ const working = (t) => Object.values(t?.status ?? {}).includes("working");
|
|
|
41
41
|
// What a classification was made from: the last message, the live status
|
|
42
42
|
// class (waiting / working / idle) and the project and issue type tags. The entry
|
|
43
43
|
// keeps it (entry.basis); a thread is classified again once it differs. Kept
|
|
44
|
-
// in step with
|
|
45
|
-
// The input version (
|
|
44
|
+
// in step with hosted-hub/src/domain/dash.mjs classifyBasis (test/dash-entries.test.mjs).
|
|
45
|
+
// The input version (hosted-hub/src/domain/dash.mjs BASIS_VERSION): bumped when what the
|
|
46
46
|
// model reads changes, so every entry made from the older input is
|
|
47
47
|
// classified once more, then stays quiet.
|
|
48
48
|
export const BASIS_VERSION = "v:lanes1";
|
|
@@ -131,7 +131,7 @@ export const DECISION_MODEL = "openai/gpt-6-luna-decisions";
|
|
|
131
131
|
|
|
132
132
|
// What the thread is doing for the human, as one pick. Each state is one lane
|
|
133
133
|
// (the entry's `lane`); `ready` isn't here, the hub derives it from the reviewer's
|
|
134
|
-
// ship verdict on the PR's current head (entriesOf,
|
|
134
|
+
// ship verdict on the PR's current head (entriesOf, hosted-hub/src/domain/dash.mjs).
|
|
135
135
|
export const STATES = {
|
|
136
136
|
"asks-you": "needs-you",
|
|
137
137
|
stuck: "running", // a stall is a bot's to steer; it shows on the thread's own row, not as the human's task
|
package/schedules/dash-rules.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { said, lastSaid } from "./thread-brief.mjs";
|
|
|
14
14
|
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
16
16
|
// dash: what changed since the last scan that could put something on the
|
|
17
|
-
// human's Dash (
|
|
17
|
+
// human's Dash (hosted-hub/src/domain/dash.mjs), with no model call. Four parts, each kept
|
|
18
18
|
// exactly (by id, not time) in the saved state:
|
|
19
19
|
// p the human's PRs: CI, review, draft, merge conflicts, open/merged/closed,
|
|
20
20
|
// and every PR a Dash item waits on, whoever wrote it. A PR that leaves
|
package/schedules/hub.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Types for hub.mjs: main's schedules' client of the hub's HTTP API. Bodies
|
|
2
2
|
// the schedules only pass through are `unknown`.
|
|
3
|
-
import type { DashEntries } from '../../../
|
|
3
|
+
import type { DashEntries } from '../../../hosted-hub/src/domain/dash.mjs';
|
|
4
4
|
|
|
5
5
|
type Notice = { schedule: string; text: string; clientId?: string };
|
|
6
6
|
type Post = { text: string; clientId?: string };
|
package/schedules/hub.mjs
CHANGED
|
@@ -42,14 +42,14 @@ export function createHub({ base = registryBase(), agent = "main", fetchImpl = f
|
|
|
42
42
|
// With `report` ({ trigger, reportTo: "<bot>/<schedule>" }) the hub posts
|
|
43
43
|
// this compaction's report lines into that schedule's thread itself.
|
|
44
44
|
compact: (threadId, bot, by, report = {}) => call(`/api/threads/${encodeURIComponent(threadId)}/compact`, { method: "POST", body: JSON.stringify({ agent: bot, by, ...report }) }),
|
|
45
|
-
// The Dash was scanned now (
|
|
45
|
+
// The Dash was scanned now (hosted-hub/src/domain/dash.mjs checkedAt), changed or not.
|
|
46
46
|
// `prFacts` ({ "owner/repo#12": { head, ci } }): what the scan's GitHub query said of the PRs reviews are about.
|
|
47
47
|
dashChecked: (prFacts = {}) => must("/api/dash/checked", { method: "POST", body: JSON.stringify({ by: agent, prFacts }) }),
|
|
48
48
|
// A track's summary (set_summary's endpoint, as main).
|
|
49
49
|
setSummary: (path, text) => must("/api/summaries", { method: "POST", body: JSON.stringify({ by: agent, scope: `path:${path}`, text }) }),
|
|
50
|
-
// A classifier pass finished (
|
|
50
|
+
// A classifier pass finished (hosted-hub/src/domain/dash.mjs classifiedAt).
|
|
51
51
|
dashClassified: () => must("/api/dash/classified", { method: "POST", body: JSON.stringify({ by: agent }) }),
|
|
52
|
-
// Dash entries from the classifier (
|
|
52
|
+
// Dash entries from the classifier (hosted-hub/src/domain/dash.mjs), merged per field.
|
|
53
53
|
// File an unfiled thread into a track (the classifier's pick), as a bot:
|
|
54
54
|
// the hub refuses a thread that's already filed and doesn't lock it.
|
|
55
55
|
fileThread: (threadId, path) => must(`/api/threads/${encodeURIComponent(threadId)}/track`, { method: "POST", body: JSON.stringify({ by: agent, path }) }),
|
package/tools/dash_update.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defineTool } from "eve/tools";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { registryFetch } from "../registry-fetch.mjs";
|
|
4
4
|
// main only (the registry refuses other bots). Writes Dash entries
|
|
5
|
-
// (
|
|
5
|
+
// (hosted-hub/src/domain/dash.mjs): importance / lane / reason / deferred on existing,
|
|
6
6
|
// non-archived threads, merged field by field (POST /api/dash/entries). The
|
|
7
7
|
// dash schedule classifies idle threads on its own; this is for corrections.
|
|
8
8
|
const entry = z.object({
|
package/tools/restart_hub.js
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { registryFetch } from "../registry-fetch.mjs";
|
|
4
4
|
// main only (the registry refuses anyone else). The registry hands the restart
|
|
5
5
|
// to a detached `hub restart`, which replaces the registry and keeps each bot
|
|
6
|
-
// whose inputs are unchanged (
|
|
6
|
+
// whose inputs are unchanged (lib/fingerprint.mjs); a turn the restart
|
|
7
7
|
// cuts off is re-delivered, so it can't strand the turn that asked for it
|
|
8
8
|
// (packages/agent-kit/self-restart.mjs).
|
|
9
9
|
export default defineTool({
|
package/world.mjs
CHANGED
|
@@ -430,12 +430,13 @@ var OPEN_TURN_STATUSES = "('streaming','cancelling')";
|
|
|
430
430
|
// ../../hosted-hub/src/domain/wake.ts
|
|
431
431
|
var escape = (s2) => s2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
432
432
|
var mentioned = (roster, text) => roster.filter((bot) => new RegExp(`(^|[^\\w@])@${escape(bot)}(?![\\w-])`, "i").test(text));
|
|
433
|
-
|
|
433
|
+
var hasAll = (text) => /(^|[^\w@])@all(?![\w-])/i.test(text);
|
|
434
|
+
function recipients(roster, text, from, threadId2 = "", participants = []) {
|
|
434
435
|
if (threadId2.startsWith("dm-")) {
|
|
435
436
|
const bot = threadId2.slice(3);
|
|
436
437
|
return bot !== from.name && roster.includes(bot) ? [bot] : [];
|
|
437
438
|
}
|
|
438
|
-
const named = mentioned(roster, text).filter((bot) => bot !== from.name);
|
|
439
|
+
const named = [.../* @__PURE__ */ new Set([...mentioned(roster, text), ...hasAll(text) ? participants.filter((b) => roster.includes(b)) : []])].filter((bot) => bot !== from.name);
|
|
439
440
|
if (from.kind === "agent") return named;
|
|
440
441
|
return named.length ? named : roster.slice(0, 1);
|
|
441
442
|
}
|
|
@@ -462,7 +463,8 @@ var deliveryId = (message, bot) => `dlv_${message}_${bot}`;
|
|
|
462
463
|
var turnId = (session, chunkIndex) => `trn_${session}_${chunkIndex}`;
|
|
463
464
|
|
|
464
465
|
// ../../hosted-hub/src/store/routing.ts
|
|
465
|
-
|
|
466
|
+
var PARTICIPANTS = (thread) => `SELECT bot FROM sessions WHERE thread_id = ${thread} UNION SELECT author FROM messages WHERE thread_id = ${thread} AND author_kind = 'agent'`;
|
|
467
|
+
function routingStatements(messageId2, threadId2, bots, now, held = {}, steer = false) {
|
|
466
468
|
const fresh = "EXISTS (SELECT 1 FROM messages WHERE id = ?)";
|
|
467
469
|
return [
|
|
468
470
|
...bots.flatMap((bot) => [
|
|
@@ -477,7 +479,9 @@ function routingStatements(messageId2, threadId2, bots, now) {
|
|
|
477
479
|
threadId2,
|
|
478
480
|
bot,
|
|
479
481
|
messageId2
|
|
480
|
-
)
|
|
482
|
+
),
|
|
483
|
+
...steer ? [s("UPDATE deliveries SET steer = 1 WHERE id = ? AND accepted_at IS NULL", deliveryId(messageId2, bot))] : [],
|
|
484
|
+
...held[bot] ? [s("UPDATE deliveries SET held_at = ?, held_scope = ? WHERE id = ? AND accepted_at IS NULL", now, held[bot], deliveryId(messageId2, bot))] : []
|
|
481
485
|
])
|
|
482
486
|
];
|
|
483
487
|
}
|
|
@@ -26962,10 +26966,13 @@ var DELIVERY_STATUS = `CASE WHEN d.accepted_at IS NOT NULL OR ${LINKED} THEN COA
|
|
|
26962
26966
|
WHERE r.session_id = d.session_id AND r.status = 'pending' AND rs.ended_at IS NULL
|
|
26963
26967
|
AND r.created_at <= COALESCE((SELECT t.started_at FROM turn_deliveries td JOIN turns t ON t.id = td.turn_id WHERE td.delivery_id = d.id), d.accepted_at) LIMIT 1),
|
|
26964
26968
|
CASE WHEN ${LINKED} THEN 'seen' ELSE 'delivered' END)
|
|
26965
|
-
WHEN d.failed_at IS NOT NULL THEN 'failed' WHEN d.revoked_at IS NOT NULL THEN 'skipped'
|
|
26969
|
+
WHEN d.failed_at IS NOT NULL THEN 'failed' WHEN d.revoked_at IS NOT NULL THEN 'skipped'
|
|
26970
|
+
WHEN d.held_at IS NOT NULL THEN CASE d.held_scope WHEN 'bot' THEN 'queued until free' ELSE 'queued' END ELSE 'pending' END`;
|
|
26966
26971
|
|
|
26967
26972
|
// ../../hosted-hub/src/store/fold.ts
|
|
26968
26973
|
var FOLD_STATE_SQL = `SELECT s.id, s.thread_id, s.bot, COALESCE(f.folded_index, -1) AS folded_index, (SELECT json_group_array(name) FROM (SELECT name FROM bots ORDER BY position)) AS roster,
|
|
26974
|
+
(SELECT json_group_array(bot) FROM (${PARTICIPANTS("s.thread_id")})) AS participants,
|
|
26975
|
+
(SELECT d.message_id FROM deliveries d WHERE d.bot = s.bot AND d.held_at IS NOT NULL AND d.held_paused IS NOT 1 AND d.accepted_at IS NULL AND d.failed_at IS NULL AND d.revoked_at IS NULL ORDER BY d.rowid LIMIT 1) AS held,
|
|
26969
26976
|
(SELECT json_object('status', t.status, 'id', t.id, 'text', t.reply_text, 'lastStep', json(t.last_step), 'activity', json(t.activity)) FROM turns t WHERE t.session_id = s.id AND t.status IN ${OPEN_TURN_STATUSES}
|
|
26970
26977
|
ORDER BY t.started_at DESC LIMIT 1) AS open_turn
|
|
26971
26978
|
FROM sessions s LEFT JOIN session_folds f ON f.session_id = s.id WHERE s.id = ?`;
|
|
@@ -26974,6 +26981,8 @@ function foldState(row) {
|
|
|
26974
26981
|
return {
|
|
26975
26982
|
session: { id: String(row.id), thread: String(row.thread_id), bot: String(row.bot) },
|
|
26976
26983
|
roster: JSON.parse(String(row.roster)),
|
|
26984
|
+
participants: JSON.parse(String(row.participants)),
|
|
26985
|
+
held: row.held == null ? null : String(row.held),
|
|
26977
26986
|
foldedIndex: Number(row.folded_index),
|
|
26978
26987
|
open: row.open_turn ? JSON.parse(String(row.open_turn)) : null
|
|
26979
26988
|
};
|
|
@@ -27007,6 +27016,7 @@ function fold(state, chunks, now = Date.now()) {
|
|
|
27007
27016
|
const reset = (t) => log("turn.delta", { turnId: t.id, index, reset: true, delta: t.text });
|
|
27008
27017
|
const end = (status, error63 = null) => {
|
|
27009
27018
|
if (!open3) return;
|
|
27019
|
+
if (state.held) deliver.push(state.held);
|
|
27010
27020
|
reduceActivity(open3.activity, { type: "turn.cancelled" }, at, cutOff(open3, "turn.cancelled"));
|
|
27011
27021
|
Object.assign(open3, { status: open3.status === "cancelling" ? "cancelled" : status, endedAt: at, error: error63 });
|
|
27012
27022
|
touched.set(open3.id, open3);
|
|
@@ -27103,7 +27113,7 @@ function fold(state, chunks, now = Date.now()) {
|
|
|
27103
27113
|
SELECT ?, ?, ?, 'agent', ?, ?, ? WHERE ? <> ''
|
|
27104
27114
|
AND EXISTS (SELECT 1 FROM turns WHERE id = ? AND status NOT IN ('cancelling','cancelled') AND NOT (${REVOKED_TURN}))`, messageId2, session.thread, session.bot, text, open3.id, at, text, open3.id));
|
|
27105
27115
|
log("message.created", { messageId: messageId2, author: session.bot, authorKind: "agent" }, IF_INSERTED);
|
|
27106
|
-
const to = recipients(state.roster, text, { name: session.bot, kind: "agent" }, session.thread);
|
|
27116
|
+
const to = recipients(state.roster, text, { name: session.bot, kind: "agent" }, session.thread, state.participants);
|
|
27107
27117
|
stmts.push(...routingStatements(messageId2, session.thread, to, at));
|
|
27108
27118
|
deliver.push(messageId2);
|
|
27109
27119
|
}
|