@vellumai/assistant 0.10.4-dev.202607011307.b79a0c5 → 0.10.4-dev.202607011653.a5dd422

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 (65) hide show
  1. package/bun.lock +0 -1
  2. package/node_modules/@vellumai/gateway-client/src/index.ts +4 -0
  3. package/node_modules/@vellumai/gateway-client/src/outbound-contract.ts +77 -0
  4. package/openapi.yaml +62 -0
  5. package/package.json +1 -2
  6. package/src/__tests__/assistant-attachments.test.ts +62 -4
  7. package/src/__tests__/call-controller.test.ts +292 -35
  8. package/src/__tests__/channel-retry-sweep.test.ts +76 -64
  9. package/src/__tests__/relay-server.test.ts +0 -4
  10. package/src/__tests__/voice-scoped-grant-consumer.test.ts +1 -7
  11. package/src/__tests__/voice-session-bridge-processing-wait.test.ts +27 -0
  12. package/src/__tests__/voice-session-bridge.test.ts +1 -10
  13. package/src/calls/call-controller.ts +75 -8
  14. package/src/calls/call-pointer-messages.ts +3 -2
  15. package/src/calls/relay-server.ts +2 -10
  16. package/src/calls/voice-session-bridge.ts +21 -31
  17. package/src/channels/slack-thread-store.ts +12 -0
  18. package/src/cli/commands/__tests__/conversations-slack.test.ts +1 -0
  19. package/src/config/feature-flag-registry.json +8 -0
  20. package/src/config/schemas/__tests__/memory-v3.test.ts +52 -0
  21. package/src/config/schemas/memory-v3.ts +76 -0
  22. package/src/daemon/abort-watchdog.ts +7 -0
  23. package/src/daemon/assistant-attachments.ts +42 -0
  24. package/src/daemon/conversation-agent-loop.ts +19 -21
  25. package/src/daemon/lifecycle.ts +0 -26
  26. package/src/home/__tests__/feed-writer.test.ts +247 -1
  27. package/src/home/feed-writer.ts +61 -0
  28. package/src/messaging/providers/__tests__/transport-dispatch.test.ts +20 -0
  29. package/src/messaging/providers/channel-transport.ts +6 -0
  30. package/src/messaging/providers/index.ts +3 -0
  31. package/src/messaging/providers/slack/api.ts +105 -0
  32. package/src/messaging/providers/slack/send.test.ts +6 -0
  33. package/src/messaging/providers/slack/send.ts +54 -1
  34. package/src/messaging/providers/slack/transport.ts +7 -0
  35. package/src/persistence/conversation-crud.ts +108 -96
  36. package/src/persistence/delivery-channels.ts +0 -82
  37. package/src/persistence/delivery-crud.ts +27 -6
  38. package/src/persistence/llm-request-log-store.ts +35 -19
  39. package/src/plugins/defaults/memory/v3/__tests__/carry-integration.test.ts +6 -0
  40. package/src/plugins/defaults/memory/v3/__tests__/dense.test.ts +76 -1
  41. package/src/plugins/defaults/memory/v3/__tests__/gate-flag.test.ts +56 -0
  42. package/src/plugins/defaults/memory/v3/__tests__/gate.test.ts +181 -0
  43. package/src/plugins/defaults/memory/v3/__tests__/live-integration.test.ts +6 -0
  44. package/src/plugins/defaults/memory/v3/__tests__/orchestrate.test.ts +230 -3
  45. package/src/plugins/defaults/memory/v3/__tests__/section-needle.test.ts +64 -0
  46. package/src/plugins/defaults/memory/v3/__tests__/shadow-integration.test.ts +9 -0
  47. package/src/plugins/defaults/memory/v3/__tests__/shadow-plugin.test.ts +43 -1
  48. package/src/plugins/defaults/memory/v3/dense.ts +44 -9
  49. package/src/plugins/defaults/memory/v3/gate-flag.ts +15 -0
  50. package/src/plugins/defaults/memory/v3/gate.ts +158 -0
  51. package/src/plugins/defaults/memory/v3/orchestrate.ts +154 -25
  52. package/src/plugins/defaults/memory/v3/section-needle.ts +27 -7
  53. package/src/plugins/defaults/memory/v3/shadow-plugin.ts +8 -0
  54. package/src/runtime/channel-retry-sweep.ts +18 -24
  55. package/src/runtime/finalize-event-delivery.ts +30 -16
  56. package/src/runtime/routes/__tests__/home-feed-routes.test.ts +142 -1
  57. package/src/runtime/routes/home-feed-routes.ts +60 -1
  58. package/src/runtime/routes/inbound-stages/background-dispatch.test.ts +76 -270
  59. package/src/runtime/routes/inbound-stages/background-dispatch.ts +17 -113
  60. package/src/runtime/slack-no-response.ts +47 -0
  61. package/src/runtime/slack-reply-session.test.ts +506 -0
  62. package/src/runtime/slack-reply-session.ts +359 -0
  63. package/src/runtime/slack-task-progress.ts +95 -0
  64. package/src/tools/terminal/safe-env.ts +1 -0
  65. package/src/runtime/slack-dm-text-delivery.ts +0 -177
package/bun.lock CHANGED
@@ -37,7 +37,6 @@
37
37
  "pino": "9.14.0",
38
38
  "pino-pretty": "13.1.3",
39
39
  "playwright": "1.58.2",
40
- "postgres": "3.4.8",
41
40
  "quickjs-emscripten": "0.32.0",
42
41
  "re2js": "2.8.3",
43
42
  "remark-gfm": "4.0.1",
@@ -27,6 +27,8 @@ export {
27
27
  ChannelDeliveryResultSchema,
28
28
  ChannelReplyPayloadSchema,
29
29
  PermissionRequestDetailsSchema,
30
+ SlackStreamOpSchema,
31
+ SlackStreamTaskSchema,
30
32
  } from "./outbound-contract.js";
31
33
 
32
34
  export type {
@@ -36,6 +38,8 @@ export type {
36
38
  ChannelDeliveryResult,
37
39
  ChannelReplyPayload,
38
40
  PermissionRequestDetails,
41
+ SlackStreamOp,
42
+ SlackStreamTask,
39
43
  } from "./outbound-contract.js";
40
44
 
41
45
  // Inbound contract (gateway → daemon) — Zod schemas + derived types
@@ -61,6 +61,81 @@ export const ApprovalUIMetadataSchema = z.object({
61
61
 
62
62
  export type ApprovalUIMetadata = z.infer<typeof ApprovalUIMetadataSchema>;
63
63
 
64
+ // ---------------------------------------------------------------------------
65
+ // Slack streaming operations
66
+ // ---------------------------------------------------------------------------
67
+
68
+ /**
69
+ * One task card in a Slack streamed plan. Mirrors the `task_update` chunk of
70
+ * the Slack streaming API: an ordered, status-bearing step the assistant is
71
+ * working through. `title` is capped at 256 characters by Slack.
72
+ *
73
+ * @see https://docs.slack.dev/reference/methods/chat.appendStream/
74
+ */
75
+ export const SlackStreamTaskSchema = z.object({
76
+ id: z.string(),
77
+ title: z.string(),
78
+ status: z.enum(["pending", "in_progress", "complete", "error"]),
79
+ details: z.string().optional(),
80
+ output: z.string().optional(),
81
+ });
82
+
83
+ export type SlackStreamTask = z.infer<typeof SlackStreamTaskSchema>;
84
+
85
+ /**
86
+ * A single Slack streaming operation, mapping directly onto the
87
+ * `chat.startStream` / `chat.appendStream` / `chat.stopStream` Web API methods.
88
+ *
89
+ * `start` opens a streamed reply on a thread and returns the stream `ts`;
90
+ * `append` adds markdown (and optional task cards) to that stream; `stop`
91
+ * finalizes it, optionally rendering rich Block Kit blocks below the streamed
92
+ * body. Blocks are only accepted on `stop` — during the stream, Slack renders
93
+ * the `markdownText` natively.
94
+ *
95
+ * @see https://docs.slack.dev/reference/methods/chat.startStream/
96
+ * @see https://docs.slack.dev/reference/methods/chat.appendStream/
97
+ * @see https://docs.slack.dev/reference/methods/chat.stopStream/
98
+ */
99
+ export const SlackStreamOpSchema = z
100
+ .discriminatedUnion("action", [
101
+ z.object({
102
+ action: z.literal("start"),
103
+ threadTs: z.string(),
104
+ markdownText: z.string().optional(),
105
+ taskDisplayMode: z.literal("plan").optional(),
106
+ tasks: z.array(SlackStreamTaskSchema).optional(),
107
+ }),
108
+ z.object({
109
+ action: z.literal("append"),
110
+ streamTs: z.string(),
111
+ markdownText: z.string().optional(),
112
+ tasks: z.array(SlackStreamTaskSchema).optional(),
113
+ }),
114
+ z.object({
115
+ action: z.literal("stop"),
116
+ streamTs: z.string(),
117
+ markdownText: z.string().optional(),
118
+ blocks: z.array(z.custom<KnownBlock>()).optional(),
119
+ tasks: z.array(SlackStreamTaskSchema).optional(),
120
+ }),
121
+ ])
122
+ .superRefine((op, ctx) => {
123
+ // Slack requires either `markdown_text` or `chunks` on `start`/`append`; a
124
+ // task-only operation advances the plan block without new body text.
125
+ if (
126
+ (op.action === "start" || op.action === "append") &&
127
+ op.markdownText === undefined &&
128
+ op.tasks === undefined
129
+ ) {
130
+ ctx.addIssue({
131
+ code: z.ZodIssueCode.custom,
132
+ message: `${op.action} requires markdownText or tasks`,
133
+ });
134
+ }
135
+ });
136
+
137
+ export type SlackStreamOp = z.infer<typeof SlackStreamOpSchema>;
138
+
64
139
  // ---------------------------------------------------------------------------
65
140
  // Channel reply payload — the full outbound wire format
66
141
  // ---------------------------------------------------------------------------
@@ -103,6 +178,8 @@ export const ChannelReplyPayloadSchema = z.object({
103
178
  loadingMessages: z.array(z.string()).optional(),
104
179
  })
105
180
  .optional(),
181
+ /** When provided, perform one Slack streaming operation (start/append/stop). */
182
+ slackStream: SlackStreamOpSchema.optional(),
106
183
  });
107
184
 
108
185
  export type ChannelReplyPayload = z.infer<typeof ChannelReplyPayloadSchema>;
package/openapi.yaml CHANGED
@@ -12834,6 +12834,68 @@ paths:
12834
12834
  description: Feed item or action not found
12835
12835
  "500":
12836
12836
  description: Failed to create conversation
12837
+ /v1/home/feed/mark-all:
12838
+ post:
12839
+ operationId: home_feed_markall_post
12840
+ summary: Bulk update home feed item statuses
12841
+ description:
12842
+ Flip every home feed item currently at one of the `from` statuses to the single `to` status. Returns the
12843
+ count of items whose status actually changed (items already at `to`, or outside `from`, are left untouched).
12844
+ Used to implement 'Mark all as read' (from=['new'], to='seen') and 'Clear all' (from=['new','seen','acted_on'],
12845
+ to='dismissed').
12846
+ tags:
12847
+ - home
12848
+ requestBody:
12849
+ required: true
12850
+ content:
12851
+ application/json:
12852
+ schema:
12853
+ type: object
12854
+ properties:
12855
+ from:
12856
+ minItems: 1
12857
+ type: array
12858
+ items:
12859
+ type: string
12860
+ enum:
12861
+ - new
12862
+ - seen
12863
+ - acted_on
12864
+ - dismissed
12865
+ to:
12866
+ type: string
12867
+ enum:
12868
+ - new
12869
+ - seen
12870
+ - acted_on
12871
+ - dismissed
12872
+ ids:
12873
+ type: array
12874
+ items:
12875
+ type: string
12876
+ required:
12877
+ - from
12878
+ - to
12879
+ responses:
12880
+ "200":
12881
+ description: Successful response
12882
+ content:
12883
+ application/json:
12884
+ schema:
12885
+ type: object
12886
+ properties:
12887
+ updatedCount:
12888
+ type: integer
12889
+ minimum: 0
12890
+ maximum: 9007199254740991
12891
+ updatedAt:
12892
+ type: string
12893
+ required:
12894
+ - updatedCount
12895
+ - updatedAt
12896
+ additionalProperties: false
12897
+ "500":
12898
+ description: Failed to persist bulk status update
12837
12899
  /v1/home/feed/query:
12838
12900
  post:
12839
12901
  operationId: home_feed_query_post
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.10.4-dev.202607011307.b79a0c5",
3
+ "version": "0.10.4-dev.202607011653.a5dd422",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -66,7 +66,6 @@
66
66
  "pino": "9.14.0",
67
67
  "pino-pretty": "13.1.3",
68
68
  "playwright": "1.58.2",
69
- "postgres": "3.4.8",
70
69
  "quickjs-emscripten": "0.32.0",
71
70
  "re2js": "2.8.3",
72
71
  "remark-gfm": "4.0.1",
@@ -9,6 +9,7 @@ import {
9
9
  drainDirectiveDisplayBuffer,
10
10
  estimateBase64Bytes,
11
11
  extractVellumLinks,
12
+ incompleteVellumLinkSuffixLength,
12
13
  inferMimeType,
13
14
  MAX_ASSISTANT_ATTACHMENT_BYTES,
14
15
  stripVellumLinks,
@@ -386,8 +387,7 @@ describe("extractVellumLinks", () => {
386
387
  });
387
388
 
388
389
  test("decodes URL-encoded spaces in host paths", () => {
389
- const text =
390
- "[my file.pdf](vellum://host/Users/me/my%20file.pdf)";
390
+ const text = "[my file.pdf](vellum://host/Users/me/my%20file.pdf)";
391
391
  const result = extractVellumLinks(text);
392
392
 
393
393
  expect(result.directiveRequests).toHaveLength(1);
@@ -406,8 +406,7 @@ describe("extractVellumLinks", () => {
406
406
  });
407
407
 
408
408
  test("warns on malformed percent-encoding and skips the link", () => {
409
- const text =
410
- "[bad file](vellum://workspace/scratch/100%complete.txt)";
409
+ const text = "[bad file](vellum://workspace/scratch/100%complete.txt)";
411
410
  const result = extractVellumLinks(text);
412
411
 
413
412
  expect(result.directiveRequests).toHaveLength(0);
@@ -484,6 +483,65 @@ describe("stripVellumLinks", () => {
484
483
  });
485
484
  });
486
485
 
486
+ // ---------------------------------------------------------------------------
487
+ // incompleteVellumLinkSuffixLength
488
+ // ---------------------------------------------------------------------------
489
+
490
+ describe("incompleteVellumLinkSuffixLength", () => {
491
+ const suffix = (text: string) =>
492
+ text.slice(text.length - incompleteVellumLinkSuffixLength(text));
493
+
494
+ test("returns 0 for text with no trailing link", () => {
495
+ expect(incompleteVellumLinkSuffixLength("all done, no links here")).toBe(0);
496
+ });
497
+
498
+ test("returns 0 for a completed vellum link", () => {
499
+ expect(
500
+ incompleteVellumLinkSuffixLength(
501
+ "see [report.pdf](vellum://workspace/scratch/report.pdf)",
502
+ ),
503
+ ).toBe(0);
504
+ });
505
+
506
+ test("returns 0 for a completed link followed by trailing text", () => {
507
+ expect(
508
+ incompleteVellumLinkSuffixLength(
509
+ "[a.pdf](vellum://host/tmp/a.pdf) and more",
510
+ ),
511
+ ).toBe(0);
512
+ });
513
+
514
+ test.each([
515
+ ["mid path", "grab [a.pdf](vellum://host/tmp/a"],
516
+ ["at slash", "grab [a.pdf](vellum://host/"],
517
+ ["at authority", "grab [a.pdf](vellum://host"],
518
+ ["partial authority", "grab [a.pdf](vellum://ho"],
519
+ ["partial scheme", "grab [a.pdf](vel"],
520
+ ["open paren", "grab [a.pdf]("],
521
+ ["closed label", "grab [a.pdf]"],
522
+ ["open label", "grab [a.pd"],
523
+ ])("withholds an in-progress vellum link (%s)", (_name, text) => {
524
+ expect(suffix(text).startsWith("[")).toBe(true);
525
+ expect(
526
+ stripVellumLinks(
527
+ text.slice(0, text.length - incompleteVellumLinkSuffixLength(text)),
528
+ ),
529
+ ).not.toContain("vellum://");
530
+ });
531
+
532
+ test("withholds only the trailing in-progress link, not an earlier complete one", () => {
533
+ const text =
534
+ "[done.pdf](vellum://host/tmp/done.pdf) then [next](vellum://workspace/scratch/n";
535
+ expect(suffix(text)).toBe("[next](vellum://workspace/scratch/n");
536
+ });
537
+
538
+ test("stops withholding once the URL diverges from the vellum scheme", () => {
539
+ expect(
540
+ incompleteVellumLinkSuffixLength("see [site](https://example.com"),
541
+ ).toBe(0);
542
+ });
543
+ });
544
+
487
545
  // ---------------------------------------------------------------------------
488
546
  // cleanAssistantContent — vellum:// links
489
547
  // ---------------------------------------------------------------------------