@vellumai/assistant 0.10.6-dev.202607062136.26c976d → 0.10.6-dev.202607062232.05707c8

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/openapi.yaml CHANGED
@@ -27307,6 +27307,18 @@ paths:
27307
27307
  description: List Slack channels, groups, and DMs for the channel picker.
27308
27308
  tags:
27309
27309
  - integrations
27310
+ parameters:
27311
+ - name: memberOnly
27312
+ in: query
27313
+ required: false
27314
+ schema:
27315
+ type: string
27316
+ enum:
27317
+ - "true"
27318
+ - "false"
27319
+ description:
27320
+ "When 'true', only return conversations the connected identity is in: channels/groups with is_member, plus
27321
+ all DMs and group DMs"
27310
27322
  responses:
27311
27323
  "200":
27312
27324
  description: Successful response
@@ -27332,11 +27344,29 @@ paths:
27332
27344
  - dm
27333
27345
  isPrivate:
27334
27346
  type: boolean
27347
+ isMember:
27348
+ type: boolean
27349
+ memberCount:
27350
+ anyOf:
27351
+ - type: number
27352
+ - type: "null"
27353
+ topic:
27354
+ anyOf:
27355
+ - type: string
27356
+ - type: "null"
27357
+ imageUrl:
27358
+ anyOf:
27359
+ - type: string
27360
+ - type: "null"
27335
27361
  required:
27336
27362
  - id
27337
27363
  - name
27338
27364
  - type
27339
27365
  - isPrivate
27366
+ - isMember
27367
+ - memberCount
27368
+ - topic
27369
+ - imageUrl
27340
27370
  additionalProperties: false
27341
27371
  required:
27342
27372
  - channels
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.10.6-dev.202607062136.26c976d",
3
+ "version": "0.10.6-dev.202607062232.05707c8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -303,9 +303,9 @@ describe("Slack edit propagation", () => {
303
303
 
304
304
  test("a content-changing edit enqueues a lexical reindex for the message", async () => {
305
305
  // Regression: channel edits update the row in-place via
306
- // updateMessageContentAndMetadata / updateMessageContent, bypassing
307
- // onMessagePersisted. The lexical index must be refreshed so the old Qdrant
308
- // point does not go stale against the edited (FTS-updated) content.
306
+ // updateMessageContentAndMetadata / updateMessageContent, bypassing the
307
+ // addMessage persist path. The lexical index must be refreshed so the old
308
+ // Qdrant point does not go stale against the edited (FTS-updated) content.
309
309
  const seeded = await seedSlackMessage({
310
310
  conversationExternalId: "C0123CHANNEL",
311
311
  channelTs: "1234.5678",
@@ -31,11 +31,11 @@ mock.module("../util/logger.js", () => ({
31
31
  getLogger: () => makeMockLogger(),
32
32
  }));
33
33
 
34
- // Stub the segment indexer so `onMessagePersisted` runs cheaply. The lexical
35
- // enqueue in the hook is a separate call and still fires. Other exports are
36
- // provided so any transitive importer of this module resolves. `throwFromIndex`
37
- // lets a test simulate a transient segment-indexing failure to prove the
38
- // lexical enqueue survives it.
34
+ // Stub the segment indexer so the persist path's memory indexing runs cheaply.
35
+ // The lexical enqueue is a separate call on the persist path and still fires.
36
+ // Other exports are provided so any transitive importer of this module
37
+ // resolves. `throwFromIndex` lets a test simulate a transient segment-indexing
38
+ // failure to prove the lexical enqueue survives it.
39
39
  let throwFromIndex = false;
40
40
  mock.module("../plugins/defaults/memory/indexer.js", () => ({
41
41
  MIN_SEGMENT_CHARS: 50,
@@ -176,7 +176,8 @@ describe("messages lexical-index dual-write", () => {
176
176
  test("lexical job is still enqueued when segment indexing (indexMessageNow) throws", async () => {
177
177
  // The sparse lexical job is independent of the dense embedding path, so a
178
178
  // transient segment-indexing failure must not leave the message missing
179
- // from the lexical index. `addMessage` catches the hook throw as non-fatal.
179
+ // from the lexical index. `addMessage` catches the indexing throw as
180
+ // non-fatal.
180
181
  throwFromIndex = true;
181
182
  const conv = createConversation("Segment failure thread");
182
183
  const message = await addMessage(
@@ -216,7 +217,8 @@ describe("messages lexical-index dual-write", () => {
216
217
  const beforeFork = countJobs("index_message_lexical");
217
218
  expect(beforeFork).toBe(3);
218
219
 
219
- // The fork copies every source row directly, bypassing onMessagePersisted.
220
+ // The fork copies every source row directly, bypassing the addMessage
221
+ // persist path (and its lexical enqueue).
220
222
  const fork = forkConversation({ conversationId: source.id });
221
223
  expect(fork.id).not.toBe(source.id);
222
224
 
@@ -41,11 +41,14 @@ const MEMORY_DIR = join(ASSISTANT_SRC, "plugins", "defaults", "memory");
41
41
  * a NEW back-import is introduced. Do not add an entry without a decoupling
42
42
  * plan.
43
43
  *
44
- * Current entry: the conversation write paths invoke the memory plugin's
45
- * persistence-lifecycle handlers (`memory/persistence-hooks.ts`) at each
46
- * lifecycle point — every event on that surface is memory-domain.
47
- * Decoupling plan: the per-event lifecycle notifications migrate to the
48
- * first-class `hooks` system, retiring the entry.
44
+ * Current entries, both on the conversation write paths:
45
+ * - `persistence-hooks` — the memory plugin's fork-time state carry, invoked
46
+ * synchronously inside the fork transaction (see the module docstring for
47
+ * why it resists the `hooks`-system migration the other lifecycle events
48
+ * took).
49
+ * - `indexer` — the plain `addMessage` path invokes `indexMessageNow` to feed
50
+ * the persisted message into memory segment indexing, matching the other
51
+ * (non-persistence) write seams that already call it directly.
49
52
  *
50
53
  * Keyed by the importing persistence file (relative to repo root); the value
51
54
  * is the set of allowed `memory/<specifier>` module paths it may import.
@@ -53,6 +56,7 @@ const MEMORY_DIR = join(ASSISTANT_SRC, "plugins", "defaults", "memory");
53
56
  const PERSISTENCE_TO_MEMORY_ALLOWLIST: Record<string, ReadonlySet<string>> = {
54
57
  "assistant/src/persistence/conversation-crud.ts": new Set([
55
58
  "persistence-hooks",
59
+ "indexer",
56
60
  ]),
57
61
  };
58
62
 
@@ -0,0 +1,350 @@
1
+ import { beforeEach, describe, expect, mock, test } from "bun:test";
2
+
3
+ import { ServiceUnavailableError } from "../runtime/routes/errors.js";
4
+
5
+ // ---------------------------------------------------------------------------
6
+ // Mocks — must be declared before any imports that pull in mocked modules
7
+ // ---------------------------------------------------------------------------
8
+
9
+ const secureKeyValues = new Map<string, string>();
10
+ mock.module("../security/secure-keys.js", () => ({
11
+ getSecureKeyAsync: async (key: string) => secureKeyValues.get(key),
12
+ setSecureKeyAsync: async () => {},
13
+ }));
14
+
15
+ let connectionByProvider: Record<string, unknown> = {};
16
+ mock.module("../oauth/oauth-store.js", () => ({
17
+ getConnectionByProvider: (key: string) =>
18
+ connectionByProvider[key] ?? undefined,
19
+ }));
20
+
21
+ let listConversationsResult: unknown = { ok: true, channels: [] };
22
+ let userInfoResults: Map<string, unknown> = new Map();
23
+
24
+ mock.module("../messaging/providers/slack/client.js", () => ({
25
+ listConversations: async () => listConversationsResult,
26
+ userInfo: async (_token: string, userId: string) => {
27
+ const result = userInfoResults.get(userId);
28
+ if (result) {
29
+ return result;
30
+ }
31
+ throw new Error(`User not found: ${userId}`);
32
+ },
33
+ }));
34
+
35
+ // ---------------------------------------------------------------------------
36
+ // Import under test (after mocks)
37
+ // ---------------------------------------------------------------------------
38
+
39
+ const { handleListSlackChannels } =
40
+ await import("../runtime/routes/integrations/slack/channels.js");
41
+
42
+ // ---------------------------------------------------------------------------
43
+ // Tests
44
+ // ---------------------------------------------------------------------------
45
+
46
+ function configureToken() {
47
+ connectionByProvider["slack"] = { id: "conn-slack-1" };
48
+ secureKeyValues.set(
49
+ "oauth_connection/conn-slack-1/access_token",
50
+ "xoxb-test",
51
+ );
52
+ }
53
+
54
+ beforeEach(() => {
55
+ secureKeyValues.clear();
56
+ connectionByProvider = {};
57
+ listConversationsResult = { ok: true, channels: [] };
58
+ userInfoResults = new Map();
59
+ });
60
+
61
+ describe("handleListSlackChannels", () => {
62
+ test("throws ServiceUnavailableError when no token is configured", async () => {
63
+ expect(handleListSlackChannels()).rejects.toThrow(ServiceUnavailableError);
64
+ });
65
+
66
+ test("returns channels sorted by type then name", async () => {
67
+ configureToken();
68
+
69
+ listConversationsResult = {
70
+ ok: true,
71
+ channels: [
72
+ {
73
+ id: "D1",
74
+ name: undefined,
75
+ is_im: true,
76
+ user: "U1",
77
+ is_private: true,
78
+ },
79
+ { id: "C2", name: "beta-channel", is_channel: true },
80
+ { id: "C1", name: "alpha-channel", is_channel: true },
81
+ { id: "G1", name: "group-chat", is_mpim: true, is_private: true },
82
+ ],
83
+ };
84
+
85
+ userInfoResults.set("U1", {
86
+ ok: true,
87
+ user: {
88
+ id: "U1",
89
+ name: "alice",
90
+ profile: { display_name: "Alice Smith" },
91
+ },
92
+ });
93
+
94
+ const result = (await handleListSlackChannels()) as {
95
+ channels: Array<Record<string, unknown>>;
96
+ };
97
+
98
+ expect(result.channels).toHaveLength(4);
99
+ expect(result.channels[0]).toEqual({
100
+ id: "C1",
101
+ name: "alpha-channel",
102
+ type: "channel",
103
+ isPrivate: false,
104
+ isMember: false,
105
+ memberCount: null,
106
+ topic: null,
107
+ imageUrl: null,
108
+ });
109
+ expect(result.channels[1]).toEqual({
110
+ id: "C2",
111
+ name: "beta-channel",
112
+ type: "channel",
113
+ isPrivate: false,
114
+ isMember: false,
115
+ memberCount: null,
116
+ topic: null,
117
+ imageUrl: null,
118
+ });
119
+ expect(result.channels[2]).toEqual({
120
+ id: "G1",
121
+ name: "group-chat",
122
+ type: "group",
123
+ isPrivate: true,
124
+ isMember: true,
125
+ memberCount: null,
126
+ topic: null,
127
+ imageUrl: null,
128
+ });
129
+ expect(result.channels[3]).toEqual({
130
+ id: "D1",
131
+ name: "Alice Smith",
132
+ type: "dm",
133
+ isPrivate: true,
134
+ isMember: true,
135
+ memberCount: null,
136
+ topic: null,
137
+ imageUrl: null,
138
+ });
139
+ });
140
+
141
+ test("maps isMember, memberCount, topic, and purpose fallback from the raw payload", async () => {
142
+ configureToken();
143
+
144
+ listConversationsResult = {
145
+ ok: true,
146
+ channels: [
147
+ {
148
+ id: "C1",
149
+ name: "with-topic",
150
+ is_channel: true,
151
+ is_member: true,
152
+ num_members: 42,
153
+ topic: { value: "P2 incident triage" },
154
+ purpose: { value: "unused purpose" },
155
+ },
156
+ {
157
+ id: "C2",
158
+ name: "purpose-fallback",
159
+ is_channel: true,
160
+ num_members: 7,
161
+ topic: { value: "" },
162
+ purpose: { value: "Escalation hand-offs" },
163
+ },
164
+ {
165
+ id: "C3",
166
+ name: "bare-channel",
167
+ is_channel: true,
168
+ },
169
+ ],
170
+ };
171
+
172
+ const result = (await handleListSlackChannels()) as {
173
+ channels: Array<Record<string, unknown>>;
174
+ };
175
+
176
+ expect(result.channels[0]).toEqual({
177
+ id: "C3",
178
+ name: "bare-channel",
179
+ type: "channel",
180
+ isPrivate: false,
181
+ isMember: false,
182
+ memberCount: null,
183
+ topic: null,
184
+ imageUrl: null,
185
+ });
186
+ expect(result.channels[1]).toEqual({
187
+ id: "C2",
188
+ name: "purpose-fallback",
189
+ type: "channel",
190
+ isPrivate: false,
191
+ isMember: false,
192
+ memberCount: 7,
193
+ topic: "Escalation hand-offs",
194
+ imageUrl: null,
195
+ });
196
+ expect(result.channels[2]).toEqual({
197
+ id: "C1",
198
+ name: "with-topic",
199
+ type: "channel",
200
+ isPrivate: false,
201
+ isMember: true,
202
+ memberCount: 42,
203
+ topic: "P2 incident triage",
204
+ imageUrl: null,
205
+ });
206
+ });
207
+
208
+ test("populates imageUrl on DM rows from the userInfo profile", async () => {
209
+ configureToken();
210
+
211
+ listConversationsResult = {
212
+ ok: true,
213
+ channels: [
214
+ { id: "D1", is_im: true, user: "U1", is_private: true },
215
+ { id: "D2", is_im: true, user: "U2", is_private: true },
216
+ ],
217
+ };
218
+
219
+ userInfoResults.set("U1", {
220
+ ok: true,
221
+ user: {
222
+ id: "U1",
223
+ name: "alice",
224
+ profile: {
225
+ display_name: "Alice Smith",
226
+ image_48: "https://avatars.example.com/u1_48.png",
227
+ },
228
+ },
229
+ });
230
+ userInfoResults.set("U2", {
231
+ ok: true,
232
+ user: {
233
+ id: "U2",
234
+ name: "bob",
235
+ profile: { display_name: "Bob Jones" },
236
+ },
237
+ });
238
+
239
+ const result = (await handleListSlackChannels()) as {
240
+ channels: Array<Record<string, unknown>>;
241
+ };
242
+
243
+ expect(result.channels[0]).toEqual({
244
+ id: "D1",
245
+ name: "Alice Smith",
246
+ type: "dm",
247
+ isPrivate: true,
248
+ isMember: true,
249
+ memberCount: null,
250
+ topic: null,
251
+ imageUrl: "https://avatars.example.com/u1_48.png",
252
+ });
253
+ expect(result.channels[1]).toEqual({
254
+ id: "D2",
255
+ name: "Bob Jones",
256
+ type: "dm",
257
+ isPrivate: true,
258
+ isMember: true,
259
+ memberCount: null,
260
+ topic: null,
261
+ imageUrl: null,
262
+ });
263
+ });
264
+
265
+ test("memberOnly=true filters out non-member channels before normalizing", async () => {
266
+ configureToken();
267
+
268
+ listConversationsResult = {
269
+ ok: true,
270
+ channels: [
271
+ { id: "C1", name: "member-channel", is_channel: true, is_member: true },
272
+ { id: "C2", name: "other-channel", is_channel: true, is_member: false },
273
+ { id: "C3", name: "bare-channel", is_channel: true },
274
+ ],
275
+ };
276
+
277
+ const result = (await handleListSlackChannels({
278
+ queryParams: { memberOnly: "true" },
279
+ })) as { channels: Array<Record<string, unknown>> };
280
+
281
+ expect(result.channels).toHaveLength(1);
282
+ expect(result.channels[0]).toEqual({
283
+ id: "C1",
284
+ name: "member-channel",
285
+ type: "channel",
286
+ isPrivate: false,
287
+ isMember: true,
288
+ memberCount: null,
289
+ topic: null,
290
+ imageUrl: null,
291
+ });
292
+ });
293
+
294
+ test("memberOnly=true keeps DMs and group DMs despite missing is_member", async () => {
295
+ configureToken();
296
+
297
+ listConversationsResult = {
298
+ ok: true,
299
+ channels: [
300
+ { id: "C2", name: "other-channel", is_channel: true, is_member: false },
301
+ { id: "D1", is_im: true, user: "U1", is_private: true },
302
+ { id: "G1", name: "group-chat", is_mpim: true, is_private: true },
303
+ ],
304
+ };
305
+
306
+ userInfoResults.set("U1", {
307
+ ok: true,
308
+ user: {
309
+ id: "U1",
310
+ name: "alice",
311
+ profile: { display_name: "Alice Smith" },
312
+ },
313
+ });
314
+
315
+ const result = (await handleListSlackChannels({
316
+ queryParams: { memberOnly: "true" },
317
+ })) as { channels: Array<Record<string, unknown>> };
318
+
319
+ expect(result.channels.map((c) => c.id)).toEqual(["G1", "D1"]);
320
+ expect(result.channels.every((c) => c.isMember === true)).toBe(true);
321
+ expect(result.channels[1]).toEqual({
322
+ id: "D1",
323
+ name: "Alice Smith",
324
+ type: "dm",
325
+ isPrivate: true,
326
+ isMember: true,
327
+ memberCount: null,
328
+ topic: null,
329
+ imageUrl: null,
330
+ });
331
+ });
332
+
333
+ test("omitting memberOnly returns all conversations", async () => {
334
+ configureToken();
335
+
336
+ listConversationsResult = {
337
+ ok: true,
338
+ channels: [
339
+ { id: "C1", name: "member-channel", is_channel: true, is_member: true },
340
+ { id: "C2", name: "other-channel", is_channel: true, is_member: false },
341
+ ],
342
+ };
343
+
344
+ const result = (await handleListSlackChannels({})) as {
345
+ channels: Array<Record<string, unknown>>;
346
+ };
347
+
348
+ expect(result.channels).toHaveLength(2);
349
+ });
350
+ });
@@ -22,28 +22,20 @@ mock.module("../oauth/oauth-store.js", () => ({
22
22
  connectionByProvider[key] ?? undefined,
23
23
  }));
24
24
 
25
- let listConversationsResult: unknown = { ok: true, channels: [] };
26
25
  let postMessageResult: unknown = {
27
26
  ok: true,
28
27
  ts: "1234567890.123456",
29
28
  channel: "C123",
30
29
  message: { ts: "1234567890.123456", text: "", type: "message" },
31
30
  };
32
- let userInfoResults: Map<string, unknown> = new Map();
33
31
 
34
32
  mock.module("../messaging/providers/slack/client.js", () => ({
35
- listConversations: async () => listConversationsResult,
36
33
  postMessage: async (
37
34
  _token: string,
38
35
  _channel: string,
39
36
  _text: string,
40
37
  _opts?: unknown,
41
38
  ) => postMessageResult,
42
- userInfo: async (_token: string, userId: string) => {
43
- const result = userInfoResults.get(userId);
44
- if (result) return result;
45
- throw new Error(`User not found: ${userId}`);
46
- },
47
39
  }));
48
40
 
49
41
  let appStoreResult: unknown = null;
@@ -75,7 +67,7 @@ mock.module("../util/logger.js", () => ({
75
67
  // Import under test (after mocks)
76
68
  // ---------------------------------------------------------------------------
77
69
 
78
- const { handleListSlackChannels, handleShareToSlackChannel } =
70
+ const { handleShareToSlackChannel } =
79
71
  await import("../runtime/routes/integrations/slack/share.js");
80
72
 
81
73
  // ---------------------------------------------------------------------------
@@ -85,8 +77,6 @@ const { handleListSlackChannels, handleShareToSlackChannel } =
85
77
  beforeEach(() => {
86
78
  secureKeyValues.clear();
87
79
  connectionByProvider = {};
88
- listConversationsResult = { ok: true, channels: [] };
89
- userInfoResults = new Map();
90
80
  appStoreResult = null;
91
81
  postMessageResult = {
92
82
  ok: true,
@@ -96,80 +86,6 @@ beforeEach(() => {
96
86
  };
97
87
  });
98
88
 
99
- describe("handleListSlackChannels", () => {
100
- test("throws ServiceUnavailableError when no token is configured", async () => {
101
- expect(handleListSlackChannels()).rejects.toThrow(ServiceUnavailableError);
102
- });
103
-
104
- test("returns channels sorted by type then name", async () => {
105
- connectionByProvider["slack"] = { id: "conn-slack-1" };
106
- secureKeyValues.set(
107
- "oauth_connection/conn-slack-1/access_token",
108
- "xoxb-test",
109
- );
110
-
111
- listConversationsResult = {
112
- ok: true,
113
- channels: [
114
- {
115
- id: "D1",
116
- name: undefined,
117
- is_im: true,
118
- user: "U1",
119
- is_private: true,
120
- },
121
- { id: "C2", name: "beta-channel", is_channel: true },
122
- { id: "C1", name: "alpha-channel", is_channel: true },
123
- { id: "G1", name: "group-chat", is_mpim: true, is_private: true },
124
- ],
125
- };
126
-
127
- userInfoResults.set("U1", {
128
- ok: true,
129
- user: {
130
- id: "U1",
131
- name: "alice",
132
- profile: { display_name: "Alice Smith" },
133
- },
134
- });
135
-
136
- const result = (await handleListSlackChannels()) as {
137
- channels: Array<{
138
- id: string;
139
- name: string;
140
- type: string;
141
- isPrivate: boolean;
142
- }>;
143
- };
144
-
145
- expect(result.channels).toHaveLength(4);
146
- expect(result.channels[0]).toEqual({
147
- id: "C1",
148
- name: "alpha-channel",
149
- type: "channel",
150
- isPrivate: false,
151
- });
152
- expect(result.channels[1]).toEqual({
153
- id: "C2",
154
- name: "beta-channel",
155
- type: "channel",
156
- isPrivate: false,
157
- });
158
- expect(result.channels[2]).toEqual({
159
- id: "G1",
160
- name: "group-chat",
161
- type: "group",
162
- isPrivate: true,
163
- });
164
- expect(result.channels[3]).toEqual({
165
- id: "D1",
166
- name: "Alice Smith",
167
- type: "dm",
168
- isPrivate: true,
169
- });
170
- });
171
- });
172
-
173
89
  describe("handleShareToSlackChannel", () => {
174
90
  test("throws ServiceUnavailableError when no token is configured", async () => {
175
91
  expect(
@@ -2,45 +2,8 @@ import { readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { describe, expect, test } from "bun:test";
4
4
 
5
- import type { SlackConversation } from "../messaging/providers/slack/types.js";
6
-
7
5
  const REPO_SKILLS_DIR = join(import.meta.dir, "..", "..", "..", "skills");
8
6
 
9
- describe("slack adapter isPrivate mapping", () => {
10
- // Inline the mapping logic to test it independently of the adapter module
11
- function mapIsPrivate(conv: Partial<SlackConversation>): boolean {
12
- return conv.is_private ?? conv.is_group ?? false;
13
- }
14
-
15
- test("public channel is not private", () => {
16
- expect(mapIsPrivate({ is_channel: true, is_private: false })).toBe(false);
17
- });
18
-
19
- test("private channel with is_private flag", () => {
20
- expect(mapIsPrivate({ is_channel: true, is_private: true })).toBe(true);
21
- });
22
-
23
- test("private channel via is_group (legacy)", () => {
24
- expect(mapIsPrivate({ is_group: true })).toBe(true);
25
- });
26
-
27
- test("is_private takes precedence over is_group", () => {
28
- expect(mapIsPrivate({ is_private: false, is_group: true })).toBe(false);
29
- });
30
-
31
- test("DM defaults to not private when flags absent", () => {
32
- expect(mapIsPrivate({ is_im: true })).toBe(false);
33
- });
34
-
35
- test("mpim (group DM) defaults to not private when is_private absent", () => {
36
- expect(mapIsPrivate({ is_mpim: true })).toBe(false);
37
- });
38
-
39
- test("undefined flags default to false", () => {
40
- expect(mapIsPrivate({})).toBe(false);
41
- });
42
- });
43
-
44
7
  describe("slack skill has no TOOLS.json (uses Web API via CLI)", () => {
45
8
  const toolsPath = join(REPO_SKILLS_DIR, "slack", "TOOLS.json");
46
9
 
@@ -1370,8 +1370,8 @@ export async function finalizePendingToolResultRow(
1370
1370
  );
1371
1371
  }
1372
1372
  // Dual-write the finalized tool-result content into the lexical index. The
1373
- // reserve+finalize path bypasses `onMessagePersisted`, so enqueue here to
1374
- // keep the lexical index in lockstep with the segment index.
1373
+ // reserve+finalize path bypasses the `addMessage` persist path, so enqueue
1374
+ // here to keep the lexical index in lockstep with the segment index.
1375
1375
  enqueueLexicalIndexForMessage(rowId);
1376
1376
  }
1377
1377
  for (const id of state.pendingToolResults.keys()) {
@@ -98,8 +98,8 @@ export function buildDeferredFinalizeEffect(params: {
98
98
  );
99
99
  }
100
100
  // Dual-write the finalized assistant content into the lexical index. The
101
- // reserve+finalize path bypasses `onMessagePersisted`, so enqueue here to
102
- // keep the lexical index in lockstep with the segment index.
101
+ // reserve+finalize path bypasses the `addMessage` persist path, so enqueue
102
+ // here to keep the lexical index in lockstep with the segment index.
103
103
  enqueueLexicalIndexForMessage(assistantMessageId);
104
104
  try {
105
105
  const attentionStateChanged = projectAssistantMessage({