eve-hub 0.6.7 → 0.6.8

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,11 @@
1
1
  # eve-hub
2
2
 
3
+ ## 0.6.8
4
+
5
+ ### Patch Changes
6
+
7
+ - The bots' world folds eve's session-limit requests into the hosted hub, so a session parked on its input limit shows its Approve/Stop ask to the human.
8
+
3
9
  ## 0.6.7
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve-hub",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
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/world.mjs CHANGED
@@ -564,6 +564,12 @@ var APP_READS = [
564
564
  ...DASH_READS
565
565
  ];
566
566
 
567
+ // ../../hosted-hub/src/store/requests.ts
568
+ var PENDING_REQUESTS_READ = s(`SELECT r.id, r.session_id, r.thread_id, r.bot, r.kind, r.prompt, r.options, r.allow_freeform, r.tool_name, r.submitted_at, r.created_at,
569
+ (SELECT d.message_id FROM turn_deliveries td JOIN deliveries d ON d.id = td.delivery_id WHERE td.turn_id = r.turn_id ORDER BY d.rowid DESC LIMIT 1) AS message_id
570
+ FROM input_requests r JOIN sessions s ON s.id = r.session_id
571
+ WHERE r.status = 'pending' AND s.ended_at IS NULL ORDER BY r.created_at`);
572
+
567
573
  // ../../hosted-hub/src/store/workspace-state.ts
568
574
  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`);
569
575
 
@@ -27031,6 +27037,20 @@ function fold(state, chunks, now = Date.now()) {
27031
27037
  for (const [eventIndex, event] of events.entries()) {
27032
27038
  const data = event.data ?? {};
27033
27039
  at = Date.parse(event.meta?.at ?? "") || now;
27040
+ if (event.type === "input.requested") {
27041
+ const limits = (data.requests ?? []).filter((r) => r.kind === "session-limit");
27042
+ for (const r of limits)
27043
+ stmts.push(s(`INSERT OR IGNORE INTO input_requests (id, session_id, thread_id, bot, turn_id, kind, prompt, options, allow_freeform, tool_name, created_at)
27044
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, r.requestId, session.id, session.thread, session.bot, open3?.id ?? null, r.kind, r.prompt, JSON.stringify(r.options ?? []), r.allowFreeform ? 1 : 0, r.action?.toolName ?? null, at));
27045
+ if (limits.length) log("request.updated", { requestIds: limits.map((r) => r.requestId) });
27046
+ }
27047
+ if (event.type === "input.resolved") {
27048
+ for (const r of data.resolutions ?? [])
27049
+ stmts.push(s(`UPDATE input_requests SET status = 'resolved', outcome = ?, resolved_at = ?,
27050
+ answer = COALESCE(?, (SELECT json_extract(o.value, '$.label') FROM json_each(input_requests.options) o WHERE json_extract(o.value, '$.id') = ?), ?)
27051
+ WHERE id = ? AND session_id = ? AND status = 'pending'`, r.outcome ?? "answered", at, r.response?.text ?? null, r.response?.optionId ?? null, r.response?.optionId ?? null, r.requestId, session.id));
27052
+ log("request.updated", { requestIds: (data.resolutions ?? []).map((r) => r.requestId) });
27053
+ }
27034
27054
  if (event.type === "turn.started") {
27035
27055
  if (!data.turnId) throw new Error("turn.started must name eve turnId");
27036
27056
  flush();