eve-hub 0.6.66 → 0.6.67

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.67
4
+
5
+ ### Patch Changes
6
+
7
+ - Failed turns: a bot's latest failure is its card until it posts, with Retry on any unresolved failure.
8
+
3
9
  ## 0.6.66
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.66",
3
+ "version": "0.6.67",
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
@@ -20380,16 +20380,16 @@ var failureId = (trigger, bot) => `evt_fail_${trigger}_${bot}`;
20380
20380
  var cardLog = (idSql, now, ...args) => s(`INSERT INTO log (thread_id, type, data, at) SELECT thread_id, 'message.updated', json_object('threadId', thread_id, 'messageId', id), ? FROM messages WHERE id = (${idSql}) AND changes() > 0`, now, ...args);
20381
20381
  function failureStatements(t, now) {
20382
20382
  if (!t.trigger) return [];
20383
- const id = failureId(t.trigger, t.bot), detail = t.error ?? "unknown error";
20383
+ const id = failureId(t.trigger, t.bot), detail = t.error ?? "unknown error", failedAt = new Date(now).toISOString();
20384
20384
  const turn = (status) => s("EXISTS (SELECT 1 FROM turns WHERE id = ? AND status = ?)", t.id, status);
20385
20385
  const failed = turn("failed"), settled = (status, next) => {
20386
20386
  const when = turn(status);
20387
20387
  return [s(`UPDATE messages SET event = json_set(event, '$.state', ?) WHERE id = ? AND ${STATE2} = 'retrying' AND ${when.sql}`, next, id, ...when.args), cardLog("?", now, id)];
20388
20388
  };
20389
20389
  return [
20390
- ...eventStatements(t.threadId, { kind: "turn_failed", agent: t.bot, triggerId: t.trigger, state: "failed", retries: 0, turnId: t.id, detail }, `${t.bot}'s turn failed: ${detail}`, now, id, failed),
20391
- s(`UPDATE messages SET text = ?, event = json_set(event, '$.state', 'failed', '$.detail', ?, '$.turnId', ?, '$.retries', json_extract(event, '$.retries') + 1)
20392
- WHERE id = ? AND ${STATE2} = 'retrying' AND json_extract(event, '$.turnId') <> ? AND ${failed.sql}`, `${t.bot}'s turn failed: ${detail}`, detail, t.id, id, t.id, ...failed.args),
20390
+ ...eventStatements(t.threadId, { kind: "turn_failed", agent: t.bot, triggerId: t.trigger, state: "failed", retries: 0, turnId: t.id, detail, failedAt }, `${t.bot}'s turn failed: ${detail}`, now, id, failed),
20391
+ s(`UPDATE messages SET text = ?, event = json_set(event, '$.state', 'failed', '$.detail', ?, '$.turnId', ?, '$.failedAt', ?, '$.retries', json_extract(event, '$.retries') + 1)
20392
+ WHERE id = ? AND ${STATE2} = 'retrying' AND json_extract(event, '$.turnId') <> ? AND ${failed.sql}`, `${t.bot}'s turn failed: ${detail}`, detail, t.id, failedAt, id, t.id, ...failed.args),
20393
20393
  cardLog("?", now, id),
20394
20394
  ...settled("done", "resolved"),
20395
20395
  ...settled("cancelled", "failed")
@@ -26806,7 +26806,8 @@ var MessageEvent = object2({
26806
26806
  /** "login" means signing in is the fix. */
26807
26807
  action: maybe(string5()),
26808
26808
  retries: maybe(int2()),
26809
- auto: maybe(boolean5())
26809
+ /** When the latest failure happened (ISO). */
26810
+ failedAt: maybe(string5())
26810
26811
  }).meta({ id: "MessageEvent" });
26811
26812
  var Attachment = object2({ id: string5(), name: string5() }).meta({ id: "Attachment" });
26812
26813
  var Decision = object2({