@songsid/agend 2.4.0-beta.27 → 2.4.0-beta.28

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 (141) hide show
  1. package/dist/agent-cli-instructions.md +2 -1
  2. package/dist/agent-cli.js +6 -0
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/build-provenance.json +1 -1
  5. package/dist/channel/mcp-tools.js +1 -1
  6. package/dist/channel/mcp-tools.js.map +1 -1
  7. package/dist/claude-turn-boundaries.d.ts +15 -0
  8. package/dist/claude-turn-boundaries.js +88 -0
  9. package/dist/claude-turn-boundaries.js.map +1 -0
  10. package/dist/contact-auth-service.js +3 -0
  11. package/dist/contact-auth-service.js.map +1 -1
  12. package/dist/contact-auth-store.d.ts +16 -0
  13. package/dist/contact-auth-store.js +61 -1
  14. package/dist/contact-auth-store.js.map +1 -1
  15. package/dist/daemon.d.ts +12 -1
  16. package/dist/daemon.js +130 -19
  17. package/dist/daemon.js.map +1 -1
  18. package/dist/delivery-outbox.d.ts +38 -0
  19. package/dist/delivery-outbox.js +81 -1
  20. package/dist/delivery-outbox.js.map +1 -1
  21. package/dist/fleet-manager.d.ts +17 -1
  22. package/dist/fleet-manager.js +239 -16
  23. package/dist/fleet-manager.js.map +1 -1
  24. package/dist/general-knowledge/skills/concepts/SKILL.md +5 -0
  25. package/dist/general-knowledge/skills/task-board/SKILL.md +14 -0
  26. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +1 -1
  27. package/dist/hub/group-policy/resources.d.ts +1 -1
  28. package/dist/hub/roles/clock.d.ts +1 -1
  29. package/dist/hub/roles/clock.js +3 -2
  30. package/dist/hub/roles/clock.js.map +1 -1
  31. package/dist/hub/roles/read.d.ts +2 -0
  32. package/dist/hub/roles/read.js +15 -6
  33. package/dist/hub/roles/read.js.map +1 -1
  34. package/dist/hub/settings-directory-decision.js +11 -5
  35. package/dist/hub/settings-directory-decision.js.map +1 -1
  36. package/dist/hub/settings-member-address-decision.js +1 -1
  37. package/dist/hub/settings-member-address-decision.js.map +1 -1
  38. package/dist/hub/store.d.ts +4 -0
  39. package/dist/hub/store.js +19 -4
  40. package/dist/hub/store.js.map +1 -1
  41. package/dist/locale.js +17 -1
  42. package/dist/locale.js.map +1 -1
  43. package/dist/outbound-schemas.d.ts +3 -0
  44. package/dist/outbound-schemas.js +4 -2
  45. package/dist/outbound-schemas.js.map +1 -1
  46. package/dist/request-context-activation.js +14 -3
  47. package/dist/request-context-activation.js.map +1 -1
  48. package/dist/request-context-call.d.ts +1 -0
  49. package/dist/request-context-call.js.map +1 -1
  50. package/dist/request-context-compatibility.js +10 -2
  51. package/dist/request-context-compatibility.js.map +1 -1
  52. package/dist/request-context-control-api.d.ts +18 -0
  53. package/dist/request-context-control-api.js +4 -2
  54. package/dist/request-context-control-api.js.map +1 -1
  55. package/dist/request-context-drain-projection.d.ts +8 -0
  56. package/dist/request-context-drain-projection.js +40 -0
  57. package/dist/request-context-drain-projection.js.map +1 -0
  58. package/dist/request-context-drain.d.ts +9 -0
  59. package/dist/request-context-drain.js +63 -4
  60. package/dist/request-context-drain.js.map +1 -1
  61. package/dist/request-context-human.d.ts +6 -0
  62. package/dist/request-context-human.js +24 -1
  63. package/dist/request-context-human.js.map +1 -1
  64. package/dist/request-context-migration.d.ts +11 -0
  65. package/dist/request-context-migration.js +16 -3
  66. package/dist/request-context-migration.js.map +1 -1
  67. package/dist/request-context-reply-pending.d.ts +16 -0
  68. package/dist/request-context-reply-pending.js +77 -0
  69. package/dist/request-context-reply-pending.js.map +1 -0
  70. package/dist/request-context-resolution.d.ts +35 -0
  71. package/dist/request-context-resolution.js +86 -0
  72. package/dist/request-context-resolution.js.map +1 -0
  73. package/dist/request-context-retirement.d.ts +2 -0
  74. package/dist/request-context-retirement.js.map +1 -1
  75. package/dist/runtime-build-info.js +1 -1
  76. package/dist/runtime-build-info.js.map +1 -1
  77. package/dist/scheduler/db.js +9 -0
  78. package/dist/scheduler/db.js.map +1 -1
  79. package/dist/scheduler/task-board-text.d.ts +3 -6
  80. package/dist/scheduler/task-board-text.js +15 -10
  81. package/dist/scheduler/task-board-text.js.map +1 -1
  82. package/dist/scheduler/task-board-unread.d.ts +90 -0
  83. package/dist/scheduler/task-board-unread.js +192 -0
  84. package/dist/scheduler/task-board-unread.js.map +1 -0
  85. package/dist/scheduler/task-board.d.ts +324 -6
  86. package/dist/scheduler/task-board.js +786 -47
  87. package/dist/scheduler/task-board.js.map +1 -1
  88. package/dist/settings-effect.js +17 -2
  89. package/dist/settings-effect.js.map +1 -1
  90. package/dist/task-board-tool.js +24 -3
  91. package/dist/task-board-tool.js.map +1 -1
  92. package/dist/task-board-waker.d.ts +53 -2
  93. package/dist/task-board-waker.js +183 -12
  94. package/dist/task-board-waker.js.map +1 -1
  95. package/dist/transcript-monitor.d.ts +6 -1
  96. package/dist/transcript-monitor.js +59 -4
  97. package/dist/transcript-monitor.js.map +1 -1
  98. package/dist/transcript-turns.d.ts +3 -0
  99. package/dist/transcript-turns.js +5 -0
  100. package/dist/transcript-turns.js.map +1 -1
  101. package/dist/ui/fleet-task-activity.js +164 -24
  102. package/dist/ui/fleet-task-card.js +77 -13
  103. package/dist/ui/fleet-task-common.js +14 -0
  104. package/dist/ui/fleet-task-flow.js +353 -0
  105. package/dist/ui/fleet-task-md.js +1 -1
  106. package/dist/ui/fleet-task-run.js +98 -22
  107. package/dist/ui/fleet-task-thread.js +245 -0
  108. package/dist/ui/fleet-task-unread.js +100 -0
  109. package/dist/ui/fleet-task-view.js +6 -5
  110. package/dist/ui/fleet-task-wake.js +140 -0
  111. package/dist/ui/fleet-tasks.js +13 -6
  112. package/dist/ui/panel-windows-cli.js +2 -2
  113. package/dist/ui/request-context-control.js +51 -13
  114. package/dist/ui/shared/access-overview.css +1 -1
  115. package/dist/ui/shared/app-i18n.js +2 -2
  116. package/dist/ui/shared/app-shell.js +4 -1
  117. package/dist/ui/shared/app-stream.js +3 -1
  118. package/dist/ui/shared/app.css +8 -2
  119. package/dist/ui/shared/app.js +3 -0
  120. package/dist/ui/shared/task-board.css +164 -0
  121. package/dist/ui/shared/ui-icons.js +3 -0
  122. package/dist/ui/task-unread.js +70 -0
  123. package/dist/ui/windows-cli-catalog.js +33 -6
  124. package/dist/update-goback.js +3 -1
  125. package/dist/update-goback.js.map +1 -1
  126. package/dist/web-api.d.ts +45 -1
  127. package/dist/web-api.js +184 -6
  128. package/dist/web-api.js.map +1 -1
  129. package/dist/windows-cli-api.js +4 -2
  130. package/dist/windows-cli-api.js.map +1 -1
  131. package/dist/windows-cli.d.ts +40 -1
  132. package/dist/windows-cli.js +93 -11
  133. package/dist/windows-cli.js.map +1 -1
  134. package/dist/windows-shortcuts.d.ts +3 -22
  135. package/dist/windows-shortcuts.js +5 -45
  136. package/dist/windows-shortcuts.js.map +1 -1
  137. package/dist/workflow-templates/default.md +3 -2
  138. package/dist/wsl-host.d.ts +52 -0
  139. package/dist/wsl-host.js +97 -0
  140. package/dist/wsl-host.js.map +1 -0
  141. package/package.json +1 -1
@@ -148,6 +148,21 @@ export declare const SYSTEM_NOTICE_KIND = "system_notice";
148
148
  * Ordinary deliveries keep DURABLE_DELIVERY_MAX_AGE_MS.
149
149
  */
150
150
  export declare const SYSTEM_NOTICE_MAX_AGE_MS: number;
151
+ /** How far one of AgEnD's own notices has got (DeliveryOutbox.noticeProgress). */
152
+ export interface NoticeProgress {
153
+ target: string;
154
+ state: OutboxState;
155
+ createdAt: string;
156
+ finishedAt: string | null;
157
+ /** When the CLI's transcript showed the instance took it up (#1201); null until then. */
158
+ consumedAt: string | null;
159
+ /** M-3908: why a `failed` notice failed, as a category (noticeFailure); absent for any other state. */
160
+ failure?: NoticeFailure;
161
+ }
162
+ /** Why one of AgEnD's own notices failed, for a person to read: the instance stayed unavailable until the notice expired, several tries did not get through, or the submission itself failed. */
163
+ export type NoticeFailure = "expired" | "attempts" | "other";
164
+ /** The category of a failed notice's recorded error (the categories safeErrorSummary reads); never the recorded text itself. */
165
+ export declare function noticeFailure(lastError: string | null): NoticeFailure;
151
166
  export interface DeliveryStatusItem {
152
167
  request_provenance?: import("./request-context-view.js").RequestProvenanceView;
153
168
  delivery_id: string;
@@ -345,6 +360,13 @@ export declare class DeliveryOutbox extends EventEmitter {
345
360
  withdrawWaitingNotices(prefix: string, stale: (sourceKey: string, createdAt: string) => boolean, reason: string): string[];
346
361
  /** #3647: the state of AgEnD's notice with this key (delivered, queued, cancelled…), or null when there is none. */
347
362
  noticeStateByKey(sourceKey: string): string | null;
363
+ /**
364
+ * How far AgEnD's own notices with these keys have got (the task board's comment status, docs/design/task-board.md, "Comment
365
+ * status"): the row's state, when it was admitted and finished, when the CLI's transcript showed it consumed (#1201: the
366
+ * instance has read it). One read for any number of keys; a key with no row is absent. Only what a page may say of a notice —
367
+ * never its text, and not the failure's cause (the state says it: failed, unconfirmed, or withdrawn because its card moved on).
368
+ */
369
+ noticeProgress(keys: readonly string[]): Map<string, NoticeProgress>;
348
370
  /** #3647: when `source` last sent anyone a message through the outbox (epoch ms), or null. */
349
371
  latestSentAt(source: string): number | null;
350
372
  private noteWorkingReferences;
@@ -429,6 +451,18 @@ export declare class DeliveryOutbox extends EventEmitter {
429
451
  private requireInstalledRecoveryFence;
430
452
  /** L owns activation and drain intent on this same connection; constructing it installs no schema. */
431
453
  requestContextInstallation(): RequestContextInstallationStore;
454
+ requestContextUncertainHumanImages(root: string): {
455
+ receiptId: string;
456
+ inputSha256: string;
457
+ receiptSha256: string;
458
+ }[];
459
+ /** Exact owned stop only. No receipt is marked delivered and no uncertain effect is discarded. */
460
+ resolveRequestContextStoppedWork(root: string, epoch: string, confirmed: Readonly<{
461
+ ownerBinding: string;
462
+ blockerSha256: string;
463
+ receipts: import("./request-context-resolution.js").RequestContextResolution["receipts"];
464
+ pointers: ReadonlyArray<import("./request-context-turns.js").RequestContextRecoveryPointer>;
465
+ }>, drain: import("./request-context-drain.js").RequestContextDrain, retired: () => boolean, current: () => boolean): void;
432
466
  /** Bounded read-only controller inventory. These rows are evidence, never input/approval authority. */
433
467
  requestContextControlInventory(roots?: ReadonlySet<string>): {
434
468
  deliveries: {
@@ -574,6 +608,10 @@ export declare class DeliveryOutbox extends EventEmitter {
574
608
  * proof), or does not exist. A write error throws; nothing is remembered as acknowledged elsewhere.
575
609
  */
576
610
  acknowledge(deliveryId: string, by: string, atIso?: string): boolean;
611
+ /** Same existing acknowledgement, with an exact legacy image for Settings/retirement CAS. */
612
+ private requestContextLegacyAcknowledgementRow;
613
+ requestContextLegacyAcknowledgementImage(id: string): string;
614
+ acknowledgeRequestContextLegacyDelivery(id: string, imageSha256: string, by: string, current: () => boolean): boolean;
577
615
  countForTarget(target: string, states: readonly OutboxState[]): number;
578
616
  nextRetryAt(): string | null;
579
617
  /** Claim the earliest eligible target row; one caller owns each target lane. */
@@ -1,3 +1,4 @@
1
+ import { requestUncertainHumanImages } from "./request-context-human.js";
1
2
  import { labelHubRequest } from "./request-hub-context.js";
2
3
  import { labelUnprovedRequest } from "./request-context-unproved-label.js";
3
4
  import { labelOutsideRequest } from "./request-context-outside-label.js";
@@ -87,6 +88,15 @@ function payloadMessageId(payload) {
87
88
  const id = meta && typeof meta === "object" ? meta.message_id : undefined;
88
89
  return typeof id === "string" && id.length > 0 ? id : null;
89
90
  }
91
+ /** The category of a failed notice's recorded error (the categories safeErrorSummary reads); never the recorded text itself. */
92
+ export function noticeFailure(lastError) {
93
+ const e = (lastError ?? "").toLowerCase();
94
+ if (e.includes("ttl expired"))
95
+ return "expired";
96
+ if (e.includes("attempt limit"))
97
+ return "attempts";
98
+ return "other";
99
+ }
90
100
  function runtimeAttemptReference(value, evidence) {
91
101
  const ref = validateRuntimeTranscriptReference(value);
92
102
  if (evidence.transcriptPath !== null || evidence.backend !== ref.provider || evidence.windowId !== ref.paneId
@@ -457,6 +467,32 @@ export class DeliveryOutbox extends EventEmitter {
457
467
  const row = this.db.prepare("SELECT state FROM deliveries WHERE source_key=?").get(sourceKey);
458
468
  return row?.state ?? null;
459
469
  }
470
+ /**
471
+ * How far AgEnD's own notices with these keys have got (the task board's comment status, docs/design/task-board.md, "Comment
472
+ * status"): the row's state, when it was admitted and finished, when the CLI's transcript showed it consumed (#1201: the
473
+ * instance has read it). One read for any number of keys; a key with no row is absent. Only what a page may say of a notice —
474
+ * never its text, and not the failure's cause (the state says it: failed, unconfirmed, or withdrawn because its card moved on).
475
+ */
476
+ noticeProgress(keys) {
477
+ const out = new Map();
478
+ if (!keys.length)
479
+ return out;
480
+ const consumed = hasColumn(this.db, "deliveries", "consumed_at") ? "consumed_at" : "NULL";
481
+ for (let i = 0; i < keys.length; i += 200) {
482
+ const chunk = keys.slice(i, i + 200);
483
+ const rows = this.db.prepare(`SELECT source_key, target_instance, state, reconciliation_pending, created_at, finished_at, ${consumed} AS consumed_at, last_error
484
+ FROM deliveries WHERE kind=? AND source_key IN (${chunk.map(() => "?").join(",")})`).all(SYSTEM_NOTICE_KIND, ...chunk);
485
+ for (const r of rows) {
486
+ out.set(r.source_key, {
487
+ target: r.target_instance,
488
+ state: r.state === "submission_started" && r.reconciliation_pending === 1 ? "reconciliation_pending" : r.state,
489
+ createdAt: r.created_at, finishedAt: r.finished_at, consumedAt: r.consumed_at,
490
+ ...(r.state === "failed" ? { failure: noticeFailure(r.last_error) } : {}),
491
+ });
492
+ }
493
+ }
494
+ return out;
495
+ }
460
496
  /** #3647: when `source` last sent anyone a message through the outbox (epoch ms), or null. */
461
497
  latestSentAt(source) {
462
498
  const row = this.db.prepare("SELECT MAX(created_at) AS at FROM deliveries WHERE source_instance=?").get(source);
@@ -987,6 +1023,25 @@ export class DeliveryOutbox extends EventEmitter {
987
1023
  }
988
1024
  /** L owns activation and drain intent on this same connection; constructing it installs no schema. */
989
1025
  requestContextInstallation() { return new RequestContextInstallationStore(this.db); }
1026
+ requestContextUncertainHumanImages(root) { return requestUncertainHumanImages(this.db, root); }
1027
+ /** Exact owned stop only. No receipt is marked delivered and no uncertain effect is discarded. */
1028
+ resolveRequestContextStoppedWork(root, epoch, confirmed, drain, retired, current) {
1029
+ this.db.transaction(() => {
1030
+ const check = () => { if (!current() || !retired())
1031
+ throw Error("Stopped work owner changed"); };
1032
+ check();
1033
+ const selected = new Set(confirmed.receipts.map(row => `human-input:hmsg-${row.receiptId}`));
1034
+ const clearable = () => { check(); return drain.inspect(root, epoch).blockers.every(value => value === "recovery-pointer" || selected.has(value)); };
1035
+ for (const pointer of confirmed.pointers) {
1036
+ const context = this.requestContext(pointer.contextId);
1037
+ if (context?.ref.rootContextId !== root)
1038
+ throw Error("Stopped work pointer changed");
1039
+ this.requestContextRecovery.clear(pointer, clearable);
1040
+ }
1041
+ drain.recordStoppedWork(root, epoch, confirmed, retired, current);
1042
+ check();
1043
+ })();
1044
+ }
990
1045
  /** Bounded read-only controller inventory. These rows are evidence, never input/approval authority. */
991
1046
  requestContextControlInventory(roots) {
992
1047
  const has = (name) => hasTable(this.db, name), limit = 10001;
@@ -994,7 +1049,7 @@ export class DeliveryOutbox extends EventEmitter {
994
1049
  new RequestContextStore(this.db).context("00000000-0000-4000-8000-000000000000");
995
1050
  const deliveries = this.db.prepare(`SELECT d.delivery_id id,d.source_instance source,d.target_instance target,d.state,${scoped ? "o.context_id" : "NULL"} root
996
1051
  FROM deliveries d ${scoped ? "LEFT JOIN request_context_operations_v1 o ON o.delivery_id=d.delivery_id" : ""}
997
- WHERE d.state IN ('queued','delivering','submission_started','retry_wait','uncertain') ORDER BY d.created_seq LIMIT ?`).all(limit);
1052
+ WHERE d.state IN ('queued','delivering','submission_started','retry_wait','uncertain') AND (d.state<>'uncertain' OR d.acknowledged_at IS NULL OR ${scoped ? "o.delivery_id IS NOT NULL" : "0"}) ORDER BY d.created_seq LIMIT ?`).all(limit);
998
1053
  const recoveries = [];
999
1054
  if (has("request_context_recovery_v1"))
1000
1055
  for (const row of this.db.prepare("SELECT instance FROM request_context_recovery_v1 ORDER BY instance LIMIT ?").all(limit)) {
@@ -1530,6 +1585,31 @@ export class DeliveryOutbox extends EventEmitter {
1530
1585
  `).run(atIso, by, deliveryId);
1531
1586
  return result.changes === 1;
1532
1587
  }
1588
+ /** Same existing acknowledgement, with an exact legacy image for Settings/retirement CAS. */
1589
+ requestContextLegacyAcknowledgementRow(id) {
1590
+ const row = this.db.prepare("SELECT * FROM deliveries WHERE delivery_id=?").get(id);
1591
+ if (!row || !["uncertain", "failed"].includes(String(row.state)) || this.requestContextForDelivery(id))
1592
+ throw Error("stale");
1593
+ return row;
1594
+ }
1595
+ requestContextLegacyAcknowledgementImage(id) { return requestContextDigest(this.requestContextLegacyAcknowledgementRow(id)); }
1596
+ acknowledgeRequestContextLegacyDelivery(id, imageSha256, by, current) {
1597
+ return this.db.transaction(() => {
1598
+ if (!current() || !by || by.length > 512)
1599
+ throw Error("owner-required");
1600
+ const row = this.requestContextLegacyAcknowledgementRow(id);
1601
+ if (requestContextDigest(row) !== imageSha256)
1602
+ throw Error("stale");
1603
+ if (row.acknowledged_at !== null)
1604
+ return false;
1605
+ const at = new Date().toISOString();
1606
+ if (!this.acknowledge(id, by, at))
1607
+ throw Error("stale");
1608
+ if (!current() || requestContextDigest(this.requestContextLegacyAcknowledgementRow(id)) !== requestContextDigest({ ...row, acknowledged_at: at, acknowledged_by: by }))
1609
+ throw Error("stale");
1610
+ return true;
1611
+ })();
1612
+ }
1533
1613
  countForTarget(target, states) {
1534
1614
  if (states.length === 0)
1535
1615
  return 0;