@zq-silk/yui 0.6.10 → 0.6.12

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.
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { hasRecentTurnId, rememberRecentTurnId, validatePendingTurnCompletion, validateRecentTurnIds } from "./turnCompletion.js";
3
3
  import { effectiveLaunchSnapshotsCompatible, effectiveLaunchSnapshotsCompatibleForTaskMain, validateEffectiveLaunchSnapshot } from "./effectiveLaunch.js";
4
4
  import { validateProviderRuntimeBinding } from "../runtime/providerRuntimeIdentity.js";
5
+ import { builtinDriverIdForAdapter } from "../runtime/builtinAgentDrivers.js";
5
6
  export function createRoleSessionSet(owner, activeAgentId, now) {
6
7
  const base = {
7
8
  owner: normalizeOwner(owner),
@@ -573,7 +574,7 @@ export function validateRoleSessionSet(set) {
573
574
  if (session === undefined) {
574
575
  throw new Error("Provider Runtime Binding has no active Role Agent session.");
575
576
  }
576
- if (providerBinding.providerNamespace !== session.adapterId) {
577
+ if (providerBinding.providerNamespace !== builtinDriverIdForAdapter(session.adapterId)) {
577
578
  throw new Error("Provider Runtime Binding namespace does not match the Agent adapter.");
578
579
  }
579
580
  }
@@ -529,7 +529,6 @@ function hashPayloadTable(db, sql) {
529
529
  const rows = db.prepare(sql).all();
530
530
  return hashRecords(rows.map((row) => JSON.parse(row.payload)));
531
531
  }
532
- /** Reconstruct a WorkMailbox from the normalised mailboxes table columns. */
533
532
  export function rowToMailbox(row) {
534
533
  let target;
535
534
  switch (row.target_kind) {
@@ -551,13 +550,25 @@ export function rowToMailbox(row) {
551
550
  default:
552
551
  target = { kind: row.target_kind };
553
552
  }
554
- return {
555
- schemaVersion: 1,
553
+ const common = {
556
554
  target,
557
555
  nextSequence: row.next_sequence,
558
556
  processing: row.processing === null ? null : JSON.parse(row.processing),
559
557
  pending: row.pending === null ? null : JSON.parse(row.pending)
560
558
  };
559
+ return Object.hasOwn(row, "input_delivery")
560
+ ? {
561
+ schemaVersion: 2,
562
+ ...common,
563
+ inputDelivery: row.input_delivery === null
564
+ ? null
565
+ : JSON.parse(row.input_delivery)
566
+ }
567
+ : { schemaVersion: 1, ...common };
568
+ }
569
+ function readWorkMailboxRows(db) {
570
+ const hasInputDelivery = db.prepare("PRAGMA table_info(mailboxes)").all().some(({ name }) => name === "input_delivery");
571
+ return db.prepare(`SELECT target_kind, task_id, role_name, next_sequence, processing, pending${hasInputDelivery ? ", input_delivery" : ""} FROM mailboxes ORDER BY target_key`).all();
561
572
  }
562
573
  /**
563
574
  * Compute per-family checksums from the SQLite database. The database is
@@ -603,7 +614,7 @@ export function computeDbFamilyChecksums(home, databaseFilename) {
603
614
  checksums.capabilityGrant = hashPayloadTable(db, "SELECT payload FROM capability_grants");
604
615
  checksums.releaseWorkflow = hashPayloadTable(db, "SELECT payload FROM release_workflows");
605
616
  // Mailboxes are reconstructed from typed columns (no payload column).
606
- const mailboxRows = db.prepare("SELECT target_kind, task_id, role_name, next_sequence, processing, pending FROM mailboxes ORDER BY target_key").all();
617
+ const mailboxRows = readWorkMailboxRows(db);
607
618
  checksums.workMailbox = hashRecords(mailboxRows.map(rowToMailbox));
608
619
  return checksums;
609
620
  }
@@ -774,7 +785,7 @@ export function readStateFromSqlite(home) {
774
785
  stored.idHighWaterMarks[row.kind] = row.high_water;
775
786
  }
776
787
  // Work mailboxes: reconstructed from typed columns (no payload column).
777
- const mailboxRows = db.prepare("SELECT target_kind, task_id, role_name, next_sequence, processing, pending FROM mailboxes ORDER BY target_key").all();
788
+ const mailboxRows = readWorkMailboxRows(db);
778
789
  const mailboxes = state.mailboxes;
779
790
  for (const row of mailboxRows) {
780
791
  const mailbox = rowToMailbox(row);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "0.6.10",
3
+ "version": "0.6.12",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,