eve-hub 0.6.30 → 0.6.32
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/host-sandbox.js +21 -3
- package/image-limits.d.mts +5 -0
- package/package.json +1 -1
- package/tools/view_image.d.ts +6 -6
- package/world.mjs +19 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# eve-hub
|
|
2
2
|
|
|
3
|
+
## 0.6.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The hosted bots' world carries the hub's image attachments: uploads are stored and handed to bots with a message.
|
|
8
|
+
|
|
9
|
+
## 0.6.31
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- A bot's sandbox reads its session's git worktree from the file in HUB_SESSION_WORKTREE_DIR when it is set (a bot run by the Mac runner).
|
|
14
|
+
|
|
3
15
|
## 0.6.30
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/host-sandbox.js
CHANGED
|
@@ -28,16 +28,16 @@ export function hostEnvironment(options) {
|
|
|
28
28
|
return { root };
|
|
29
29
|
},
|
|
30
30
|
async start(ctx, _open, artifact) {
|
|
31
|
-
const worktree = await sessionWorktree(ctx.session.id);
|
|
32
31
|
const rootSessionId = ctx.session.parent?.rootSessionId;
|
|
32
|
+
const worktree = await sessionWorktree(ctx.session.id, rootSessionId);
|
|
33
33
|
const state = { ...(worktree ? { root: worktree.path, worktree } : { root: artifact.root }), version: 1, ...(rootSessionId ? { rootSessionId } : {}) };
|
|
34
34
|
return { handle: hostHandle(state, ctx.session.id), state };
|
|
35
35
|
},
|
|
36
36
|
async resume(ctx, _artifact, state) {
|
|
37
37
|
// Asked again: the registry restores a worktree whose directory went
|
|
38
38
|
// missing. A session that started on the shared checkout stays there.
|
|
39
|
-
const worktree = state.worktree ? ((await sessionWorktree(ctx.session.id)) ?? state.worktree) : undefined;
|
|
40
39
|
const rootSessionId = state.rootSessionId ?? ctx.session.parent?.rootSessionId;
|
|
40
|
+
const worktree = state.worktree ? ((await sessionWorktree(ctx.session.id, rootSessionId)) ?? state.worktree) : undefined;
|
|
41
41
|
const next = { ...(worktree ? { ...state, root: worktree.path, worktree } : state), ...(rootSessionId ? { rootSessionId } : {}) };
|
|
42
42
|
if (!worktree)
|
|
43
43
|
await mkdir(next.root, { recursive: true }); // never fake a missing worktree with an empty dir
|
|
@@ -59,7 +59,25 @@ export const HostSandbox = defineSandboxProvider({
|
|
|
59
59
|
// checkout stays there. Any other failure: the shared checkout.
|
|
60
60
|
class WorkspaceUnavailable extends Error {
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
// HUB_SESSION_WORKTREE_DIR (the Mac runner sets it): the runner writes
|
|
63
|
+
// <dir>/<sessionId>.json before it delivers to the session, so there is nothing
|
|
64
|
+
// to ask or wait for. An `agent` copy has no file of its own and uses its root session's.
|
|
65
|
+
async function sessionWorktree(sessionId, rootSessionId) {
|
|
66
|
+
const dir = process.env.HUB_SESSION_WORKTREE_DIR;
|
|
67
|
+
if (dir) {
|
|
68
|
+
for (const id of [sessionId, rootSessionId]) {
|
|
69
|
+
if (!id)
|
|
70
|
+
continue;
|
|
71
|
+
try {
|
|
72
|
+
return JSON.parse(await readFile(join(dir, `${id}.json`), "utf8"));
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (error.code !== "ENOENT")
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
63
81
|
if (process.env.HUB_SESSION_WORKTREES !== "1")
|
|
64
82
|
return undefined;
|
|
65
83
|
const deadline = Date.now() + 15_000;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const MAX_BYTES: number;
|
|
2
|
+
export const MODEL_MAX_EDGE: number;
|
|
3
|
+
export function sniffImage(bytes: Uint8Array): string | null;
|
|
4
|
+
export function imageSize(bytes: Uint8Array, mediaType: string): { width: number; height: number } | null;
|
|
5
|
+
export function modelUnsafe(bytes: Uint8Array): string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve-hub",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.32",
|
|
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/tools/view_image.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function prepareImage(bytes: Uint8Array, name: string, { resize }
|
|
|
13
13
|
resize?: Resize;
|
|
14
14
|
}): Promise<{
|
|
15
15
|
name: string;
|
|
16
|
-
mediaType:
|
|
16
|
+
mediaType: string;
|
|
17
17
|
original: string | undefined;
|
|
18
18
|
unsafe: string;
|
|
19
19
|
data?: undefined;
|
|
@@ -23,7 +23,7 @@ export declare function prepareImage(bytes: Uint8Array, name: string, { resize }
|
|
|
23
23
|
unsafe?: undefined;
|
|
24
24
|
data: string;
|
|
25
25
|
name: string;
|
|
26
|
-
mediaType:
|
|
26
|
+
mediaType: string;
|
|
27
27
|
bytes: number;
|
|
28
28
|
original: string | undefined;
|
|
29
29
|
shown: string | undefined;
|
|
@@ -35,7 +35,7 @@ declare const _default: import("eve/tools").ToolDefinition<{
|
|
|
35
35
|
screenshot?: boolean | undefined;
|
|
36
36
|
}, {
|
|
37
37
|
name: string;
|
|
38
|
-
mediaType:
|
|
38
|
+
mediaType: string;
|
|
39
39
|
original: string | undefined;
|
|
40
40
|
unsafe: string;
|
|
41
41
|
data?: undefined;
|
|
@@ -45,7 +45,7 @@ declare const _default: import("eve/tools").ToolDefinition<{
|
|
|
45
45
|
unsafe?: undefined;
|
|
46
46
|
data: string;
|
|
47
47
|
name: string;
|
|
48
|
-
mediaType:
|
|
48
|
+
mediaType: string;
|
|
49
49
|
bytes: number;
|
|
50
50
|
original: string | undefined;
|
|
51
51
|
shown: string | undefined;
|
|
@@ -55,7 +55,7 @@ declare const _default: import("eve/tools").ToolDefinition<{
|
|
|
55
55
|
screenshot?: boolean | undefined;
|
|
56
56
|
}, ctx: import("eve/tools").ToolContext): Promise<{
|
|
57
57
|
name: string;
|
|
58
|
-
mediaType:
|
|
58
|
+
mediaType: string;
|
|
59
59
|
original: string | undefined;
|
|
60
60
|
unsafe: string;
|
|
61
61
|
data?: undefined;
|
|
@@ -65,7 +65,7 @@ declare const _default: import("eve/tools").ToolDefinition<{
|
|
|
65
65
|
unsafe?: undefined;
|
|
66
66
|
data: string;
|
|
67
67
|
name: string;
|
|
68
|
-
mediaType:
|
|
68
|
+
mediaType: string;
|
|
69
69
|
bytes: number;
|
|
70
70
|
original: string | undefined;
|
|
71
71
|
shown: string | undefined;
|
package/world.mjs
CHANGED
|
@@ -596,6 +596,14 @@ var PENDING_REQUESTS_READ = s(`SELECT r.id, r.session_id, r.thread_id, r.bot, r.
|
|
|
596
596
|
// ../../hosted-hub/src/store/workspace-state.ts
|
|
597
597
|
var LIVE_TURNS_READ = s(`SELECT thread_id,bot,started_at,reply_text,activity FROM turns WHERE status IN ${OPEN_TURN_STATUSES} ORDER BY started_at`);
|
|
598
598
|
|
|
599
|
+
// ../../hosted-hub/src/store/attachments.ts
|
|
600
|
+
var ATTACHMENTS_READ = s("SELECT message_id, upload_id, name FROM message_attachments ORDER BY message_id, position");
|
|
601
|
+
var unseenBy = (bot, thread, mid) => {
|
|
602
|
+
const end = `COALESCE((SELECT rowid FROM messages WHERE id = ${mid}), 9223372036854775807)`;
|
|
603
|
+
return `a.message_id = e.id AND e.thread_id = ${thread} AND e.author <> ${bot} AND e.rowid < ${end}
|
|
604
|
+
AND e.rowid > COALESCE((SELECT MAX(p.rowid) FROM deliveries dd JOIN messages p ON p.id = dd.message_id WHERE p.thread_id = e.thread_id AND dd.bot = ${bot} AND p.rowid < ${end}), 0)`;
|
|
605
|
+
};
|
|
606
|
+
|
|
599
607
|
// ../../hosted-hub/src/store/threads.ts
|
|
600
608
|
var SUMMARY_READ = s("SELECT scope,text,by,at FROM summaries");
|
|
601
609
|
|
|
@@ -26999,6 +27007,11 @@ var SESSION_WORK_DELIVERY = `busy.accepted_at IS NOT NULL AND busy.failed_at IS
|
|
|
26999
27007
|
WHERE td.delivery_id = busy.id AND t.status NOT IN ('streaming','cancelling'))`;
|
|
27000
27008
|
var SESSION_BUSY = `s.ended_at IS NULL AND EXISTS (SELECT 1 FROM deliveries busy
|
|
27001
27009
|
WHERE busy.session_id = s.id AND ${SESSION_WORK_DELIVERY})`;
|
|
27010
|
+
var PENDING_FROM = `SELECT d.id, d.message_id, d.session_id, d.bot, m.thread_id, t.title, m.author, m.author_kind, m.text, m.status, m.status_from, m.metadata, d.steer,
|
|
27011
|
+
EXISTS (SELECT 1 FROM deliveries a WHERE a.session_id = d.session_id AND a.accepted_at IS NOT NULL) AS session_started,
|
|
27012
|
+
s.ended_at IS NOT NULL AS session_ended, ${onLocal("d.bot")} AS on_local,
|
|
27013
|
+
(SELECT json_group_array(json_object('id', a.upload_id, 'name', a.name, 'size', a.size)) FROM (SELECT * FROM message_attachments WHERE message_id = m.id ORDER BY position) a) AS attachments
|
|
27014
|
+
FROM deliveries d JOIN messages m ON m.id = d.message_id JOIN threads t ON t.id = m.thread_id JOIN sessions s ON s.id = d.session_id`;
|
|
27002
27015
|
var TASK_CARD = `(SELECT CASE WHEN json_array_length(json_extract(t.activity, '$.taskCard.tasks')) > 0 THEN json_extract(t.activity, '$.taskCard') END
|
|
27003
27016
|
FROM turns t WHERE t.id = m.turn_id AND m.author_kind = 'agent' AND t.status NOT IN ${OPEN_TURN_STATUSES}
|
|
27004
27017
|
AND m.rowid = (SELECT MAX(x.rowid) FROM messages x WHERE x.turn_id = m.turn_id))`;
|
|
@@ -27010,7 +27023,12 @@ var DELIVERY_STATUS = `CASE WHEN d.accepted_at IS NOT NULL OR ${LINKED} THEN COA
|
|
|
27010
27023
|
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),
|
|
27011
27024
|
CASE WHEN ${LINKED} THEN 'seen' ELSE 'delivered' END)
|
|
27012
27025
|
WHEN d.failed_at IS NOT NULL THEN 'failed' WHEN d.revoked_at IS NOT NULL THEN 'skipped'
|
|
27013
|
-
WHEN d.held_at IS NOT NULL THEN CASE d.held_scope WHEN 'bot' THEN 'queued until free' ELSE 'queued' END
|
|
27026
|
+
WHEN d.held_at IS NOT NULL THEN CASE d.held_scope WHEN 'bot' THEN 'queued until free' ELSE 'queued' END
|
|
27027
|
+
WHEN ${onLocal("d.bot")} AND EXISTS (SELECT 1 FROM local_runner WHERE id = 1 AND device IS NOT NULL AND attachments = 0)
|
|
27028
|
+
AND (EXISTS (SELECT 1 FROM message_attachments o WHERE o.message_id = d.message_id)
|
|
27029
|
+
OR EXISTS (SELECT 1 FROM message_attachments a, messages e WHERE ${unseenBy("d.bot", "(SELECT thread_id FROM messages WHERE id = d.message_id)", "d.message_id")}))
|
|
27030
|
+
THEN 'waiting: the Mac app running this bot is too old to carry images; update it'
|
|
27031
|
+
ELSE 'pending' END`;
|
|
27014
27032
|
|
|
27015
27033
|
// ../../hosted-hub/src/store/fold.ts
|
|
27016
27034
|
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,
|