@vellumai/assistant 0.10.11-dev.202607242023.78fd032 → 0.10.11-dev.202607242127.a6bf2b2

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 (149) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/__tests__/acp-session.test.ts +3 -3
  4. package/src/__tests__/approval-cascade.test.ts +5 -5
  5. package/src/__tests__/approval-routes-http.test.ts +3 -3
  6. package/src/__tests__/assistant-event-hub-self-exclusion.test.ts +16 -16
  7. package/src/__tests__/assistant-event-hub-targeted.test.ts +13 -11
  8. package/src/__tests__/assistant-event-hub.test.ts +13 -11
  9. package/src/__tests__/assistant-event.test.ts +12 -9
  10. package/src/__tests__/assistant-stream-state.test.ts +5 -3
  11. package/src/__tests__/avatar-identity-sync.test.ts +3 -3
  12. package/src/__tests__/channel-approvals.test.ts +0 -27
  13. package/src/__tests__/channel-setup-panel-ack.test.ts +12 -9
  14. package/src/__tests__/chat-reveal-guard-priming.test.ts +28 -28
  15. package/src/__tests__/compaction-events.test.ts +8 -8
  16. package/src/__tests__/config-sounds-sync.test.ts +4 -4
  17. package/src/__tests__/conversation-agent-loop-disk-pressure.test.ts +2 -2
  18. package/src/__tests__/conversation-agent-loop-fatal-cleanup.test.ts +3 -3
  19. package/src/__tests__/conversation-agent-loop-handlers-max-tokens.test.ts +4 -4
  20. package/src/__tests__/conversation-agent-loop-overflow.test.ts +12 -12
  21. package/src/__tests__/conversation-agent-loop.test.ts +29 -29
  22. package/src/__tests__/conversation-confirmation-signals.test.ts +14 -14
  23. package/src/__tests__/conversation-history-web-search.test.ts +1 -1
  24. package/src/__tests__/conversation-key-store-disk-view.test.ts +5 -5
  25. package/src/__tests__/conversation-loop-db-lock-resilience.test.ts +4 -4
  26. package/src/__tests__/conversation-message-sync-tags.test.ts +4 -4
  27. package/src/__tests__/conversation-queue.test.ts +81 -81
  28. package/src/__tests__/conversation-runtime-assembly.test.ts +27 -0
  29. package/src/__tests__/conversation-slash-queue.test.ts +11 -11
  30. package/src/__tests__/conversation-slash-unknown.test.ts +2 -2
  31. package/src/__tests__/conversation-speed-override.test.ts +2 -2
  32. package/src/__tests__/conversation-surfaces-action-delivery.test.ts +18 -16
  33. package/src/__tests__/conversation-surfaces-activation-emit.test.ts +17 -17
  34. package/src/__tests__/conversation-surfaces-app-open.test.ts +7 -4
  35. package/src/__tests__/conversation-surfaces-data-persist.test.ts +7 -7
  36. package/src/__tests__/conversation-surfaces-standalone-payloads.test.ts +9 -9
  37. package/src/__tests__/conversation-surfaces-standalone.test.ts +12 -12
  38. package/src/__tests__/conversation-surfaces-state-update.test.ts +8 -5
  39. package/src/__tests__/conversation-surfaces-table-action.test.ts +6 -3
  40. package/src/__tests__/conversation-surfaces-task-progress.test.ts +46 -46
  41. package/src/__tests__/conversation-sync-tags.test.ts +5 -5
  42. package/src/__tests__/conversation-wait-for-idle.test.ts +2 -2
  43. package/src/__tests__/daemon-assistant-events.test.ts +15 -15
  44. package/src/__tests__/emit-event-signal.test.ts +6 -6
  45. package/src/__tests__/events-tail-route.test.ts +6 -4
  46. package/src/__tests__/helpers/native-web-search-harness.ts +10 -10
  47. package/src/__tests__/host-browser-proxy.test.ts +1 -1
  48. package/src/__tests__/host-transfer-pending-interactions.test.ts +8 -8
  49. package/src/__tests__/list-messages-page-latest.test.ts +2 -2
  50. package/src/__tests__/memory-retrieval-hook.test.ts +4 -4
  51. package/src/__tests__/notification-deep-link.test.ts +12 -12
  52. package/src/__tests__/notification-vellum-adapter.test.ts +8 -8
  53. package/src/__tests__/outbound-slack-persistence.test.ts +8 -8
  54. package/src/__tests__/pending-interactions-resolved-event.test.ts +6 -6
  55. package/src/__tests__/plugin-event-hub-facade.test.ts +18 -15
  56. package/src/__tests__/request-secret-standalone-channel-gate.test.ts +3 -3
  57. package/src/__tests__/runtime-events-sse-parity.test.ts +10 -10
  58. package/src/__tests__/runtime-events-sse.test.ts +1 -1
  59. package/src/__tests__/schedule-routes.test.ts +2 -2
  60. package/src/__tests__/schedule-store.test.ts +3 -3
  61. package/src/__tests__/secret-prompt-log-hygiene.test.ts +3 -3
  62. package/src/__tests__/secret-prompter-channel-fallback.test.ts +3 -3
  63. package/src/__tests__/secret-response-routing.test.ts +3 -3
  64. package/src/__tests__/send-endpoint-busy.test.ts +7 -7
  65. package/src/__tests__/starter-task-flow.test.ts +6 -3
  66. package/src/__tests__/subagent-call-site-routing.test.ts +2 -2
  67. package/src/__tests__/subagent-disposal.test.ts +10 -10
  68. package/src/__tests__/subagent-fork-notifications.test.ts +4 -4
  69. package/src/__tests__/subagent-fork-prompt-role.test.ts +3 -3
  70. package/src/__tests__/subagent-fork-spawn.test.ts +4 -4
  71. package/src/__tests__/subagent-manager-notify.test.ts +10 -10
  72. package/src/__tests__/subagent-spawn-and-await.test.ts +13 -13
  73. package/src/__tests__/sync-message-contract.test.ts +3 -3
  74. package/src/__tests__/tool-preview-lifecycle.test.ts +28 -28
  75. package/src/__tests__/tool-result-metadata-plumbing.test.ts +5 -5
  76. package/src/__tests__/tool-start-timestamp.test.ts +4 -4
  77. package/src/__tests__/ui-choice-copy-surfaces.test.ts +13 -13
  78. package/src/__tests__/ui-work-result-surface.test.ts +3 -3
  79. package/src/__tests__/voice-scoped-grant-consumer.test.ts +6 -6
  80. package/src/__tests__/voice-session-bridge.test.ts +44 -44
  81. package/src/acp/__tests__/client-handler.test.ts +3 -3
  82. package/src/acp/__tests__/session-manager-persistence.test.ts +10 -10
  83. package/src/acp/__tests__/session-manager-resume.test.ts +7 -7
  84. package/src/acp/client-handler.ts +3 -3
  85. package/src/acp/session-manager.ts +8 -8
  86. package/src/api/events/subagent-event.ts +2 -2
  87. package/src/calls/call-controller.ts +27 -27
  88. package/src/calls/voice-session-bridge.ts +7 -7
  89. package/src/cli.ts +2 -2
  90. package/src/daemon/__tests__/channel-ui-capability.test.ts +26 -0
  91. package/src/daemon/__tests__/conversation-surfaces-launch.test.ts +3 -3
  92. package/src/daemon/__tests__/native-web-search-metadata.test.ts +5 -5
  93. package/src/daemon/__tests__/web-search-status-text.test.ts +2 -2
  94. package/src/daemon/channel-ui-capability.ts +23 -0
  95. package/src/daemon/conversation-agent-loop-handlers.ts +3 -3
  96. package/src/daemon/conversation-agent-loop.ts +4 -4
  97. package/src/daemon/conversation-messaging.ts +14 -14
  98. package/src/daemon/conversation-notifiers.ts +2 -2
  99. package/src/daemon/conversation-process.ts +4 -4
  100. package/src/daemon/conversation-queue-manager.ts +7 -7
  101. package/src/daemon/conversation-runtime-assembly.ts +11 -0
  102. package/src/daemon/conversation-surfaces.ts +4 -4
  103. package/src/daemon/conversation-tool-setup.ts +3 -3
  104. package/src/daemon/conversation-usage.ts +11 -11
  105. package/src/daemon/conversation.ts +11 -11
  106. package/src/daemon/host-proxy-base.ts +4 -4
  107. package/src/daemon/message-protocol.ts +7 -13
  108. package/src/daemon/process-message.ts +5 -5
  109. package/src/daemon/tool-side-effects.ts +10 -10
  110. package/src/daemon/wake-conversation-ops.ts +4 -4
  111. package/src/ipc/routes/__tests__/conversation-sync-ipc-routes.test.ts +2 -2
  112. package/src/ipc/routes/events-ipc-routes.ts +3 -3
  113. package/src/notifications/adapters/macos.ts +3 -3
  114. package/src/permissions/confirmation-guardian-request.test.ts +2 -2
  115. package/src/permissions/confirmation-guardian-request.ts +2 -2
  116. package/src/permissions/prompter.ts +5 -5
  117. package/src/permissions/question-prompter.test.ts +8 -8
  118. package/src/permissions/secret-prompter.ts +2 -2
  119. package/src/plugin-api/__tests__/publish-event.test.ts +6 -6
  120. package/src/plugin-api/conversation-turn.ts +4 -4
  121. package/src/plugin-api/event-hub-facade.ts +6 -4
  122. package/src/plugin-api/index.ts +8 -1
  123. package/src/plugin-api/publish-event.ts +2 -2
  124. package/src/plugins/defaults/memory/graph/conversation-graph-memory.ts +28 -28
  125. package/src/plugins/types.ts +2 -2
  126. package/src/runtime/assistant-event-hub.ts +18 -18
  127. package/src/runtime/assistant-event.ts +7 -6
  128. package/src/runtime/assistant-stream-state.ts +4 -4
  129. package/src/runtime/channel-approvals.ts +0 -25
  130. package/src/runtime/channel-retry-sweep.ts +2 -2
  131. package/src/runtime/http-types.ts +2 -2
  132. package/src/runtime/routes/acp-routes.ts +2 -2
  133. package/src/runtime/routes/canned-message-complete.ts +2 -2
  134. package/src/runtime/routes/conversation-routes.ts +2 -2
  135. package/src/runtime/routes/guardian-approval-prompt.ts +2 -2
  136. package/src/runtime/routes/inbound-stages/background-dispatch.ts +4 -4
  137. package/src/runtime/routes/playground/__tests__/inject-failures.test.ts +7 -7
  138. package/src/runtime/routes/playground/__tests__/reset-circuit.test.ts +5 -5
  139. package/src/runtime/routes/workspace-routes.test.ts +2 -2
  140. package/src/runtime/slack-reply-session.test.ts +12 -12
  141. package/src/runtime/slack-reply-session.ts +17 -17
  142. package/src/runtime/sync/sync-publisher.test.ts +7 -5
  143. package/src/signals/emit-event.ts +3 -3
  144. package/src/signals/event-stream.ts +5 -5
  145. package/src/subagent/manager.ts +15 -15
  146. package/src/tools/acp/context.ts +5 -5
  147. package/src/tools/browser/browser-screencast.ts +6 -6
  148. package/src/tools/subagent/spawn.ts +3 -3
  149. package/src/workflows/leaf-runner.ts +5 -5
package/README.md CHANGED
@@ -145,7 +145,7 @@ All approval prompt delivery paths use a **fail-closed** policy -- if the prompt
145
145
 
146
146
  ### Plain-Text Fallback for Non-Rich Channels
147
147
 
148
- Channels that do not support rich inline approval UI (e.g., inline keyboards) receive plain-text instructions embedded in the message body. The `channelSupportsRichApprovalUI()` check determines whether to send the structured `promptText` (for rich channels like Telegram) or the `plainTextFallback` string (for all other channels). The fallback text includes instructions so the user can respond via text; the conversational approval engine then classifies the free-text response.
148
+ Channels that do not support rich inline approval UI (e.g., inline keyboards) receive plain-text instructions embedded in the message body. The `supportsInlineOptions` channel capability (`channelSupportsInlineOptions()`) determines whether to send the structured `promptText` (for channels whose adapter renders inline buttons like Telegram) or the `plainTextFallback` string (for all other channels). The fallback text includes instructions so the user can respond via text; the conversational approval engine then classifies the free-text response.
149
149
 
150
150
  ### Key modules
151
151
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.10.11-dev.202607242023.78fd032",
3
+ "version": "0.10.11-dev.202607242127.a6bf2b2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -2,7 +2,7 @@ import { beforeEach, describe, expect, mock, test } from "bun:test";
2
2
 
3
3
  import { VellumAcpClientHandler } from "../acp/client-handler.js";
4
4
  import { AcpSessionManager } from "../acp/session-manager.js";
5
- import type { ServerMessage } from "../daemon/message-protocol.js";
5
+ import type { AssistantEvent } from "../daemon/message-protocol.js";
6
6
  import * as pendingInteractions from "../runtime/pending-interactions.js";
7
7
 
8
8
  // ---------------------------------------------------------------------------
@@ -10,8 +10,8 @@ import * as pendingInteractions from "../runtime/pending-interactions.js";
10
10
  // ---------------------------------------------------------------------------
11
11
 
12
12
  describe("VellumAcpClientHandler", () => {
13
- let sent: ServerMessage[];
14
- let sendToVellum: (msg: ServerMessage) => void;
13
+ let sent: AssistantEvent[];
14
+ let sendToVellum: (msg: AssistantEvent) => void;
15
15
  let handler: VellumAcpClientHandler;
16
16
 
17
17
  beforeEach(() => {
@@ -11,7 +11,7 @@ import { Minimatch } from "minimatch";
11
11
  import { CompactionCircuit } from "../agent/compaction-circuit.js";
12
12
  import type { AgentEvent } from "../agent/loop.js";
13
13
  import type { ConfirmationStateChangedEvent } from "../api/events/confirmation-state-changed.js";
14
- import type { ServerMessage } from "../daemon/message-protocol.js";
14
+ import type { AssistantEvent } from "../daemon/message-protocol.js";
15
15
  import type { Message, ProviderResponse } from "../providers/types.js";
16
16
  import type { ConfirmationDetails } from "../runtime/pending-interactions.js";
17
17
 
@@ -188,7 +188,7 @@ function makeProvider() {
188
188
  }
189
189
 
190
190
  function makeConversation(
191
- sendToClient?: (msg: ServerMessage) => void,
191
+ sendToClient?: (msg: AssistantEvent) => void,
192
192
  conversationId = CONV_ID,
193
193
  ): Conversation {
194
194
  return new Conversation(
@@ -257,7 +257,7 @@ beforeEach(() => {
257
257
 
258
258
  describe("approval cascading", () => {
259
259
  test("allow (one-time) does NOT cascade", () => {
260
- const emitted: ServerMessage[] = [];
260
+ const emitted: AssistantEvent[] = [];
261
261
  const conversationObj = makeConversation(
262
262
  (msg) => emitted.push(msg),
263
263
  CONV_ID,
@@ -291,7 +291,7 @@ describe("approval cascading", () => {
291
291
  });
292
292
 
293
293
  test("deny (one-time) does NOT cascade", () => {
294
- const emitted: ServerMessage[] = [];
294
+ const emitted: AssistantEvent[] = [];
295
295
  const conversationObj = makeConversation(
296
296
  (msg) => emitted.push(msg),
297
297
  CONV_ID,
@@ -325,7 +325,7 @@ describe("approval cascading", () => {
325
325
  });
326
326
 
327
327
  test("already-resolved request handled gracefully", () => {
328
- const emitted: ServerMessage[] = [];
328
+ const emitted: AssistantEvent[] = [];
329
329
  const conversationObj = makeConversation(
330
330
  (msg) => emitted.push(msg),
331
331
  CONV_ID,
@@ -7,7 +7,7 @@
7
7
  import { beforeEach, describe, expect, mock, test } from "bun:test";
8
8
 
9
9
  import type { Conversation } from "../daemon/conversation.js";
10
- import type { ServerMessage } from "../daemon/message-protocol.js";
10
+ import type { AssistantEvent } from "../daemon/message-protocol.js";
11
11
  import type { SecretPromptResult } from "../permissions/secret-prompt-types.js";
12
12
 
13
13
  mock.module("../config/env.js", () => ({
@@ -123,7 +123,7 @@ function makeIdleSession(opts?: {
123
123
  runAgentLoop: async (
124
124
  _content: string,
125
125
  _messageId: string,
126
- options?: { onEvent?: (msg: ServerMessage) => void },
126
+ options?: { onEvent?: (msg: AssistantEvent) => void },
127
127
  ) => {
128
128
  const onEvent = options?.onEvent ?? (() => {});
129
129
  onEvent({ type: "assistant_text_delta", text: "Hello!" });
@@ -186,7 +186,7 @@ function makeConfirmationEmittingSession(opts?: {
186
186
  runAgentLoop: async (
187
187
  _content: string,
188
188
  _messageId: string,
189
- options?: { onEvent?: (msg: ServerMessage) => void },
189
+ options?: { onEvent?: (msg: AssistantEvent) => void },
190
190
  ) => {
191
191
  const onEvent = options?.onEvent ?? (() => {});
192
192
  // Simulate PermissionPrompter.prompt(): self-register in pendingInteractions
@@ -14,14 +14,14 @@
14
14
  */
15
15
  import { describe, expect, test } from "bun:test";
16
16
 
17
- import type { AssistantEvent } from "../runtime/assistant-event.js";
17
+ import type { AssistantEventEnvelope } from "../runtime/assistant-event.js";
18
18
  import {
19
19
  AssistantEventHub,
20
20
  assistantEventHub,
21
21
  broadcastMessage,
22
22
  } from "../runtime/assistant-event-hub.js";
23
23
 
24
- function makeSyncChangedEvent(originClientId?: string): AssistantEvent {
24
+ function makeSyncChangedEvent(originClientId?: string): AssistantEventEnvelope {
25
25
  return {
26
26
  id: "evt_test_sync",
27
27
  conversationId: undefined,
@@ -37,9 +37,9 @@ function makeSyncChangedEvent(originClientId?: string): AssistantEvent {
37
37
  describe("AssistantEventHub — self-echo suppression (excludeClientId)", () => {
38
38
  test("skips the named client and delivers to every other client", async () => {
39
39
  const hub = new AssistantEventHub();
40
- const receivedA: AssistantEvent[] = [];
41
- const receivedB: AssistantEvent[] = [];
42
- const receivedC: AssistantEvent[] = [];
40
+ const receivedA: AssistantEventEnvelope[] = [];
41
+ const receivedB: AssistantEventEnvelope[] = [];
42
+ const receivedC: AssistantEventEnvelope[] = [];
43
43
 
44
44
  hub.subscribe({
45
45
  type: "client",
@@ -82,8 +82,8 @@ describe("AssistantEventHub — self-echo suppression (excludeClientId)", () =>
82
82
 
83
83
  test("delivers to every subscriber when excludeClientId is omitted", async () => {
84
84
  const hub = new AssistantEventHub();
85
- const receivedA: AssistantEvent[] = [];
86
- const receivedB: AssistantEvent[] = [];
85
+ const receivedA: AssistantEventEnvelope[] = [];
86
+ const receivedB: AssistantEventEnvelope[] = [];
87
87
 
88
88
  hub.subscribe({
89
89
  type: "client",
@@ -112,7 +112,7 @@ describe("AssistantEventHub — self-echo suppression (excludeClientId)", () =>
112
112
 
113
113
  test("excludeClientId does not match process-type subscribers", async () => {
114
114
  const hub = new AssistantEventHub();
115
- const receivedProcess: AssistantEvent[] = [];
115
+ const receivedProcess: AssistantEventEnvelope[] = [];
116
116
 
117
117
  // A process subscriber sits in the same hub as a client whose id
118
118
  // matches `excludeClientId`. It must never be suppressed because
@@ -134,8 +134,8 @@ describe("AssistantEventHub — self-echo suppression (excludeClientId)", () =>
134
134
 
135
135
  test("excludeClientId composes with conversation-scoped subscribers", async () => {
136
136
  const hub = new AssistantEventHub();
137
- const receivedA: AssistantEvent[] = [];
138
- const receivedB: AssistantEvent[] = [];
137
+ const receivedA: AssistantEventEnvelope[] = [];
138
+ const receivedB: AssistantEventEnvelope[] = [];
139
139
 
140
140
  hub.subscribe({
141
141
  type: "client",
@@ -159,7 +159,7 @@ describe("AssistantEventHub — self-echo suppression (excludeClientId)", () =>
159
159
  });
160
160
 
161
161
  // Scoped event for sess_x; both clients filter to sess_x; exclude A.
162
- const event: AssistantEvent = {
162
+ const event: AssistantEventEnvelope = {
163
163
  id: "evt_scoped",
164
164
  conversationId: "sess_x",
165
165
  emittedAt: "2026-05-03T00:00:00.000Z",
@@ -179,8 +179,8 @@ describe("AssistantEventHub — self-echo suppression (excludeClientId)", () =>
179
179
 
180
180
  describe("broadcastMessage — derives excludeClientId from sync_changed.originClientId", () => {
181
181
  test("skips the originating client when originClientId is present", async () => {
182
- const receivedA: AssistantEvent[] = [];
183
- const receivedB: AssistantEvent[] = [];
182
+ const receivedA: AssistantEventEnvelope[] = [];
183
+ const receivedB: AssistantEventEnvelope[] = [];
184
184
 
185
185
  const subA = assistantEventHub.subscribe({
186
186
  type: "client",
@@ -221,8 +221,8 @@ describe("broadcastMessage — derives excludeClientId from sync_changed.originC
221
221
  });
222
222
 
223
223
  test("fans out to every client when originClientId is absent", async () => {
224
- const receivedA: AssistantEvent[] = [];
225
- const receivedB: AssistantEvent[] = [];
224
+ const receivedA: AssistantEventEnvelope[] = [];
225
+ const receivedB: AssistantEventEnvelope[] = [];
226
226
 
227
227
  const subA = assistantEventHub.subscribe({
228
228
  type: "client",
@@ -260,7 +260,7 @@ describe("broadcastMessage — derives excludeClientId from sync_changed.originC
260
260
  });
261
261
 
262
262
  test("ignores an empty-string originClientId (treats as absent)", async () => {
263
- const receivedA: AssistantEvent[] = [];
263
+ const receivedA: AssistantEventEnvelope[] = [];
264
264
 
265
265
  const subA = assistantEventHub.subscribe({
266
266
  type: "client",
@@ -13,10 +13,12 @@
13
13
  */
14
14
  import { describe, expect, test } from "bun:test";
15
15
 
16
- import type { AssistantEvent } from "../runtime/assistant-event.js";
16
+ import type { AssistantEventEnvelope } from "../runtime/assistant-event.js";
17
17
  import { AssistantEventHub } from "../runtime/assistant-event-hub.js";
18
18
 
19
- function makeEvent(overrides: Partial<AssistantEvent> = {}): AssistantEvent {
19
+ function makeEvent(
20
+ overrides: Partial<AssistantEventEnvelope> = {},
21
+ ): AssistantEventEnvelope {
20
22
  return {
21
23
  id: "evt_test",
22
24
  conversationId: "sess_web",
@@ -35,8 +37,8 @@ function makeEvent(overrides: Partial<AssistantEvent> = {}): AssistantEvent {
35
37
  describe("AssistantEventHub — targeted delivery (targetClientId)", () => {
36
38
  test("delivers only to the named client, bypassing conversation filter", async () => {
37
39
  const hub = new AssistantEventHub();
38
- const receivedA: AssistantEvent[] = [];
39
- const receivedB: AssistantEvent[] = [];
40
+ const receivedA: AssistantEventEnvelope[] = [];
41
+ const receivedB: AssistantEventEnvelope[] = [];
40
42
 
41
43
  // client-a is subscribed to "sess_macos" — different from the event's "sess_web"
42
44
  hub.subscribe({
@@ -75,8 +77,8 @@ describe("AssistantEventHub — targeted delivery (targetClientId)", () => {
75
77
 
76
78
  test("does not deliver to a client with a different clientId", async () => {
77
79
  const hub = new AssistantEventHub();
78
- const receivedA: AssistantEvent[] = [];
79
- const receivedB: AssistantEvent[] = [];
80
+ const receivedA: AssistantEventEnvelope[] = [];
81
+ const receivedB: AssistantEventEnvelope[] = [];
80
82
 
81
83
  hub.subscribe({
82
84
  type: "client",
@@ -106,7 +108,7 @@ describe("AssistantEventHub — targeted delivery (targetClientId)", () => {
106
108
 
107
109
  test("targeted delivery with wrong capability does not deliver", async () => {
108
110
  const hub = new AssistantEventHub();
109
- const receivedA: AssistantEvent[] = [];
111
+ const receivedA: AssistantEventEnvelope[] = [];
110
112
 
111
113
  // client-a only has host_file capability, NOT host_bash
112
114
  hub.subscribe({
@@ -130,7 +132,7 @@ describe("AssistantEventHub — targeted delivery (targetClientId)", () => {
130
132
 
131
133
  test("targeted delivery with matching capability delivers", async () => {
132
134
  const hub = new AssistantEventHub();
133
- const receivedA: AssistantEvent[] = [];
135
+ const receivedA: AssistantEventEnvelope[] = [];
134
136
 
135
137
  hub.subscribe({
136
138
  type: "client",
@@ -152,7 +154,7 @@ describe("AssistantEventHub — targeted delivery (targetClientId)", () => {
152
154
 
153
155
  test("process-type subscriber is never matched by targetClientId", async () => {
154
156
  const hub = new AssistantEventHub();
155
- const received: AssistantEvent[] = [];
157
+ const received: AssistantEventEnvelope[] = [];
156
158
 
157
159
  hub.subscribe({
158
160
  type: "process",
@@ -173,8 +175,8 @@ describe("AssistantEventHub — targeted delivery (targetClientId)", () => {
173
175
  describe("AssistantEventHub — untargeted capability targeting is unchanged", () => {
174
176
  test("targetCapability without targetClientId still applies conversation scoping", async () => {
175
177
  const hub = new AssistantEventHub();
176
- const receivedA: AssistantEvent[] = [];
177
- const receivedB: AssistantEvent[] = [];
178
+ const receivedA: AssistantEventEnvelope[] = [];
179
+ const receivedB: AssistantEventEnvelope[] = [];
178
180
 
179
181
  hub.subscribe({
180
182
  type: "client",
@@ -1,6 +1,6 @@
1
1
  import { beforeEach, describe, expect, test } from "bun:test";
2
2
 
3
- import type { AssistantEvent } from "../runtime/assistant-event.js";
3
+ import type { AssistantEventEnvelope } from "../runtime/assistant-event.js";
4
4
  import {
5
5
  AssistantEventHub,
6
6
  broadcastMessage,
@@ -12,7 +12,9 @@ import {
12
12
  } from "../runtime/assistant-stream-state.js";
13
13
  import * as pendingInteractions from "../runtime/pending-interactions.js";
14
14
 
15
- function makeEvent(overrides: Partial<AssistantEvent> = {}): AssistantEvent {
15
+ function makeEvent(
16
+ overrides: Partial<AssistantEventEnvelope> = {},
17
+ ): AssistantEventEnvelope {
16
18
  return {
17
19
  id: "evt_test",
18
20
  conversationId: "sess_1",
@@ -31,7 +33,7 @@ function makeEvent(overrides: Partial<AssistantEvent> = {}): AssistantEvent {
31
33
  describe("AssistantEventHub — fanout", () => {
32
34
  test("delivers event to a single matching subscriber", async () => {
33
35
  const hub = new AssistantEventHub();
34
- const received: AssistantEvent[] = [];
36
+ const received: AssistantEventEnvelope[] = [];
35
37
 
36
38
  hub.subscribe({
37
39
  type: "process",
@@ -75,8 +77,8 @@ describe("AssistantEventHub — fanout", () => {
75
77
 
76
78
  test("conversationId filter further restricts delivery", async () => {
77
79
  const hub = new AssistantEventHub();
78
- const receivedA: AssistantEvent[] = [];
79
- const receivedB: AssistantEvent[] = [];
80
+ const receivedA: AssistantEventEnvelope[] = [];
81
+ const receivedB: AssistantEventEnvelope[] = [];
80
82
 
81
83
  hub.subscribe({
82
84
  type: "process",
@@ -101,7 +103,7 @@ describe("AssistantEventHub — fanout", () => {
101
103
 
102
104
  test("subscriber without conversationId filter receives all conversations", async () => {
103
105
  const hub = new AssistantEventHub();
104
- const received: AssistantEvent[] = [];
106
+ const received: AssistantEventEnvelope[] = [];
105
107
 
106
108
  hub.subscribe({
107
109
  type: "process",
@@ -159,7 +161,7 @@ describe("AssistantEventHub — fanout", () => {
159
161
  describe("AssistantEventHub — unsubscribe cleanup", () => {
160
162
  test("dispose stops event delivery", async () => {
161
163
  const hub = new AssistantEventHub();
162
- const received: AssistantEvent[] = [];
164
+ const received: AssistantEventEnvelope[] = [];
163
165
 
164
166
  const s = hub.subscribe({
165
167
  type: "process",
@@ -234,8 +236,8 @@ describe("AssistantEventHub — unsubscribe cleanup", () => {
234
236
 
235
237
  test("disposing one subscription does not affect others", async () => {
236
238
  const hub = new AssistantEventHub();
237
- const received1: AssistantEvent[] = [];
238
- const received2: AssistantEvent[] = [];
239
+ const received1: AssistantEventEnvelope[] = [];
240
+ const received2: AssistantEventEnvelope[] = [];
239
241
 
240
242
  const s1 = hub.subscribe({
241
243
  type: "process",
@@ -341,7 +343,7 @@ describe("AssistantEventHub — exception isolation", () => {
341
343
  describe("AssistantEventHub — re-entrancy / snapshot isolation", () => {
342
344
  test("subscriber added during publish does not receive the in-flight event", async () => {
343
345
  const hub = new AssistantEventHub();
344
- const lateReceived: AssistantEvent[] = [];
346
+ const lateReceived: AssistantEventEnvelope[] = [];
345
347
 
346
348
  hub.subscribe({
347
349
  type: "process",
@@ -363,7 +365,7 @@ describe("AssistantEventHub — re-entrancy / snapshot isolation", () => {
363
365
 
364
366
  test("subscriber that disposes itself mid-publish does not affect remaining subscribers", async () => {
365
367
  const hub = new AssistantEventHub();
366
- const received: AssistantEvent[] = [];
368
+ const received: AssistantEventEnvelope[] = [];
367
369
  let s: ReturnType<typeof hub.subscribe>;
368
370
 
369
371
  // eslint-disable-next-line prefer-const
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from "bun:test";
2
2
 
3
- import type { AssistantEvent } from "../runtime/assistant-event.js";
3
+ import type { AssistantEventEnvelope } from "../runtime/assistant-event.js";
4
4
  import {
5
5
  formatSseFrame,
6
6
  formatSseHeartbeat,
@@ -8,9 +8,9 @@ import {
8
8
 
9
9
  // ── Type / shape tests ────────────────────────────────────────────────────────
10
10
 
11
- describe("AssistantEvent shape", () => {
11
+ describe("AssistantEventEnvelope shape", () => {
12
12
  test("accepts a minimal valid event", () => {
13
- const event: AssistantEvent = {
13
+ const event: AssistantEventEnvelope = {
14
14
  id: "evt_001",
15
15
  emittedAt: "2026-02-18T21:20:00.000Z",
16
16
  message: {
@@ -27,7 +27,7 @@ describe("AssistantEvent shape", () => {
27
27
  });
28
28
 
29
29
  test("accepts a full event with conversationId", () => {
30
- const event: AssistantEvent = {
30
+ const event: AssistantEventEnvelope = {
31
31
  id: "evt_002",
32
32
  conversationId: "conv_456",
33
33
  emittedAt: "2026-02-18T21:20:00.000Z",
@@ -45,7 +45,7 @@ describe("AssistantEvent shape", () => {
45
45
  // ── SSE framing tests ─────────────────────────────────────────────────────────
46
46
 
47
47
  describe("formatSseFrame", () => {
48
- const baseEvent: AssistantEvent = {
48
+ const baseEvent: AssistantEventEnvelope = {
49
49
  id: "evt_003",
50
50
  conversationId: "sess_xyz",
51
51
  emittedAt: "2026-02-18T00:00:00.000Z",
@@ -73,7 +73,7 @@ describe("formatSseFrame", () => {
73
73
  const dataLine = frame.split("\n").find((l) => l.startsWith("data: "))!;
74
74
  const parsed = JSON.parse(
75
75
  dataLine.slice("data: ".length),
76
- ) as AssistantEvent;
76
+ ) as AssistantEventEnvelope;
77
77
 
78
78
  expect(parsed.id).toBe(baseEvent.id);
79
79
  expect(parsed.conversationId).toBe(baseEvent.conversationId);
@@ -82,13 +82,16 @@ describe("formatSseFrame", () => {
82
82
  });
83
83
 
84
84
  test("id line uses the event id verbatim", () => {
85
- const event: AssistantEvent = { ...baseEvent, id: "unique-evt-id-xyz" };
85
+ const event: AssistantEventEnvelope = {
86
+ ...baseEvent,
87
+ id: "unique-evt-id-xyz",
88
+ };
86
89
  const frame = formatSseFrame(event);
87
90
  expect(frame).toContain("id: unique-evt-id-xyz\n");
88
91
  });
89
92
 
90
93
  test("strips newline characters from event.id to prevent SSE frame injection", () => {
91
- const event: AssistantEvent = {
94
+ const event: AssistantEventEnvelope = {
92
95
  ...baseEvent,
93
96
  id: 'foo\ndata: {"injected":true}',
94
97
  };
@@ -113,7 +116,7 @@ describe("formatSseFrame", () => {
113
116
  });
114
117
 
115
118
  test("seq lands in the JSON payload (envelope) when set, never in SSE id", () => {
116
- const event: AssistantEvent = {
119
+ const event: AssistantEventEnvelope = {
117
120
  ...baseEvent,
118
121
  id: "uuid-event-id",
119
122
  seq: 42,
@@ -8,7 +8,7 @@ import {
8
8
  import { dirname, join } from "node:path";
9
9
  import { beforeEach, describe, expect, test } from "bun:test";
10
10
 
11
- import type { AssistantEvent } from "../runtime/assistant-event.js";
11
+ import type { AssistantEventEnvelope } from "../runtime/assistant-event.js";
12
12
  import type {
13
13
  EventTargeting,
14
14
  ReplaySubscriber,
@@ -26,7 +26,9 @@ import {
26
26
 
27
27
  const CONV = "conv_test";
28
28
 
29
- function mkEvent(overrides: Partial<AssistantEvent> = {}): AssistantEvent {
29
+ function mkEvent(
30
+ overrides: Partial<AssistantEventEnvelope> = {},
31
+ ): AssistantEventEnvelope {
30
32
  const conversationId =
31
33
  "conversationId" in overrides ? overrides.conversationId : CONV;
32
34
  return {
@@ -39,7 +41,7 @@ function mkEvent(overrides: Partial<AssistantEvent> = {}): AssistantEvent {
39
41
  text: "x",
40
42
  },
41
43
  ...overrides,
42
- } as AssistantEvent;
44
+ } as AssistantEventEnvelope;
43
45
  }
44
46
 
45
47
  describe("assistant-stream-state", () => {
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, test } from "bun:test";
2
2
 
3
3
  import { SYNC_TAGS } from "../daemon/message-types/sync.js";
4
- import type { AssistantEvent } from "../runtime/assistant-event.js";
4
+ import type { AssistantEventEnvelope } from "../runtime/assistant-event.js";
5
5
  import { assistantEventHub } from "../runtime/assistant-event-hub.js";
6
6
  import { ROUTES as AVATAR_ROUTES } from "../runtime/routes/avatar-routes.js";
7
7
  import { publishIdentityChanged } from "../runtime/sync/resource-sync-events.js";
@@ -19,7 +19,7 @@ async function waitFor(predicate: () => boolean): Promise<void> {
19
19
 
20
20
  describe("avatar and identity sync events", () => {
21
21
  test("notify_avatar_updated emits legacy avatar event and sync tag", async () => {
22
- const received: AssistantEvent[] = [];
22
+ const received: AssistantEventEnvelope[] = [];
23
23
  const subscription = assistantEventHub.subscribe({
24
24
  type: "process",
25
25
  callback: (event) => {
@@ -50,7 +50,7 @@ describe("avatar and identity sync events", () => {
50
50
  });
51
51
 
52
52
  test("identity changes emit legacy identity event and identity sync tags", async () => {
53
- const received: AssistantEvent[] = [];
53
+ const received: AssistantEventEnvelope[] = [];
54
54
  const subscription = assistantEventHub.subscribe({
55
55
  type: "process",
56
56
  callback: (event) => {
@@ -17,7 +17,6 @@ import type { PendingApprovalInfo } from "../runtime/channel-approvals.js";
17
17
  import {
18
18
  buildApprovalUIMetadata,
19
19
  buildGuardianApprovalPrompt,
20
- channelSupportsRichApprovalUI,
21
20
  getChannelApprovalPrompt,
22
21
  handleChannelDecision,
23
22
  } from "../runtime/channel-approvals.js";
@@ -343,29 +342,3 @@ describe("buildGuardianApprovalPrompt", () => {
343
342
  expect(prompt.actions.map((a) => a.id)).toEqual(["approve_once", "reject"]);
344
343
  });
345
344
  });
346
-
347
- // ═══════════════════════════════════════════════════════════════════════════
348
- // 5. channelSupportsRichApprovalUI
349
- // ═══════════════════════════════════════════════════════════════════════════
350
-
351
- describe("channelSupportsRichApprovalUI", () => {
352
- test("returns true for telegram", () => {
353
- expect(channelSupportsRichApprovalUI("telegram")).toBe(true);
354
- });
355
-
356
- test("returns false for vellum", () => {
357
- expect(channelSupportsRichApprovalUI("vellum")).toBe(false);
358
- });
359
-
360
- test("returns false for voice", () => {
361
- expect(channelSupportsRichApprovalUI("phone")).toBe(false);
362
- });
363
-
364
- test("returns true for slack", () => {
365
- expect(channelSupportsRichApprovalUI("slack")).toBe(true);
366
- });
367
-
368
- test("returns false for unknown channels", () => {
369
- expect(channelSupportsRichApprovalUI("")).toBe(false);
370
- });
371
- });
@@ -18,10 +18,13 @@ import {
18
18
  type SurfaceConversationContext,
19
19
  surfaceProxyResolver,
20
20
  } from "../daemon/conversation-surfaces.js";
21
- import type { ServerMessage, SurfaceType } from "../daemon/message-protocol.js";
21
+ import type {
22
+ AssistantEvent,
23
+ SurfaceType,
24
+ } from "../daemon/message-protocol.js";
22
25
 
23
26
  function makeContext(
24
- sent: ServerMessage[] = [],
27
+ sent: AssistantEvent[] = [],
25
28
  overrides: Partial<SurfaceConversationContext> = {},
26
29
  ): SurfaceConversationContext {
27
30
  return {
@@ -48,12 +51,12 @@ function makeContext(
48
51
  };
49
52
  }
50
53
 
51
- function findOpenPanel(sent: ServerMessage[]): OpenPanelEvent | undefined {
54
+ function findOpenPanel(sent: AssistantEvent[]): OpenPanelEvent | undefined {
52
55
  return sent.find((msg): msg is OpenPanelEvent => msg.type === "open_panel");
53
56
  }
54
57
 
55
58
  async function waitForOpenPanel(
56
- sent: ServerMessage[],
59
+ sent: AssistantEvent[],
57
60
  ): Promise<OpenPanelEvent> {
58
61
  for (let i = 0; i < 20 && !findOpenPanel(sent); i++) {
59
62
  await new Promise((resolve) => setTimeout(resolve, 0));
@@ -65,7 +68,7 @@ async function waitForOpenPanel(
65
68
 
66
69
  describe("ui_show channel_setup acknowledgment", () => {
67
70
  test("emits open_panel with a surfaceId and succeeds once the client acks", async () => {
68
- const sent: ServerMessage[] = [];
71
+ const sent: AssistantEvent[] = [];
69
72
  const ctx = makeContext(sent);
70
73
 
71
74
  const resultPromise = surfaceProxyResolver(ctx, "ui_show", {
@@ -100,7 +103,7 @@ describe("ui_show channel_setup acknowledgment", () => {
100
103
  });
101
104
 
102
105
  test("returns a tool error when the client nacks", async () => {
103
- const sent: ServerMessage[] = [];
106
+ const sent: AssistantEvent[] = [];
104
107
  const ctx = makeContext(sent);
105
108
 
106
109
  const resultPromise = surfaceProxyResolver(ctx, "ui_show", {
@@ -120,7 +123,7 @@ describe("ui_show channel_setup acknowledgment", () => {
120
123
  });
121
124
 
122
125
  test("fails closed without emitting when no interactive client is connected", async () => {
123
- const sent: ServerMessage[] = [];
126
+ const sent: AssistantEvent[] = [];
124
127
  const ctx = makeContext(sent, { hasNoClient: true });
125
128
 
126
129
  const result = await surfaceProxyResolver(ctx, "ui_show", {
@@ -134,7 +137,7 @@ describe("ui_show channel_setup acknowledgment", () => {
134
137
  });
135
138
 
136
139
  test("times out into a tool error when no client acknowledges", async () => {
137
- const sent: ServerMessage[] = [];
140
+ const sent: AssistantEvent[] = [];
138
141
  const ctx = makeContext(sent);
139
142
 
140
143
  const ack = await openChannelSetupPanel(
@@ -155,7 +158,7 @@ describe("ui_show channel_setup acknowledgment", () => {
155
158
  });
156
159
 
157
160
  test("resolves cancelled when the turn is aborted mid-wait", async () => {
158
- const sent: ServerMessage[] = [];
161
+ const sent: AssistantEvent[] = [];
159
162
  const ctx = makeContext(sent);
160
163
  const controller = new AbortController();
161
164