eve-hub 0.6.6 → 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/world.mjs +23 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+
9
+ ## 0.6.7
10
+
11
+ ### Patch Changes
12
+
13
+ - The hub's "updated" record carries the commit it pushed (`HostedUpdate.commit`).
14
+
3
15
  ## 0.6.6
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.6",
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
 
@@ -26796,6 +26802,8 @@ var HostedUpdate = object2({
26796
26802
  state: string5(),
26797
26803
  to: string5(),
26798
26804
  at: maybe(string5()),
26805
+ /** `updated`: the commit the hub pushed (or redeployed) to move the bots; absent for an upload or a move the hub did not make. */
26806
+ commit: maybe(string5()),
26799
26807
  /** `kind`: sign-in (the owner signs in again) | build (`url` is the failed build) | other. */
26800
26808
  error: maybe(object2({ kind: string5(), message: string5(), url: maybe(string5()) }))
26801
26809
  }).meta({ id: "HostedUpdate" });
@@ -26966,7 +26974,7 @@ var StoredHosted = HostedWorkspace.omit({ eveHub: true, commits: true, update: t
26966
26974
  workspace: DeployedWorkspace.nullable().default(null),
26967
26975
  attempt: Attempt.nullable().default(null),
26968
26976
  upgrade: Upgrade.nullable().default(null),
26969
- updated: external_exports.object({ to: external_exports.string(), at: external_exports.string() }).nullable().default(null)
26977
+ updated: external_exports.object({ to: external_exports.string(), at: external_exports.string(), commit: external_exports.string().nullable().default(null) }).nullable().default(null)
26970
26978
  });
26971
26979
  var REPO_READ = s("SELECT metadata FROM workspace_repo WHERE id = 1");
26972
26980
 
@@ -27029,6 +27037,20 @@ function fold(state, chunks, now = Date.now()) {
27029
27037
  for (const [eventIndex, event] of events.entries()) {
27030
27038
  const data = event.data ?? {};
27031
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
+ }
27032
27054
  if (event.type === "turn.started") {
27033
27055
  if (!data.turnId) throw new Error("turn.started must name eve turnId");
27034
27056
  flush();