@vellumai/assistant 0.12.3 → 0.12.4-dev.202609231715.8da971c

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 (229) hide show
  1. package/Dockerfile +7 -0
  2. package/README.md +12 -12
  3. package/docker/mousepad/90-vellum.gschema.override +4 -0
  4. package/node_modules/@vellumai/avatar-manifest/src/__tests__/notification-avatar.test.ts +48 -4
  5. package/node_modules/@vellumai/avatar-manifest/src/notification-avatar.ts +12 -8
  6. package/openapi.yaml +97 -4
  7. package/package.json +1 -1
  8. package/src/__tests__/approval-routes-http.test.ts +4 -2
  9. package/src/__tests__/call-routes-http.test.ts +4 -2
  10. package/src/__tests__/channel-readiness-discord.test.ts +8 -0
  11. package/src/__tests__/channel-readiness-slack-remote.test.ts +8 -0
  12. package/src/__tests__/config-loader-backfill.test.ts +1 -0
  13. package/src/__tests__/conversation-pairing.test.ts +10 -0
  14. package/src/__tests__/conversation-resurface-done.test.ts +289 -0
  15. package/src/__tests__/default-profile-catalog-fallback.test.ts +1 -0
  16. package/src/__tests__/gemini-provider.test.ts +31 -0
  17. package/src/__tests__/inference-profile-validation-jev.test.ts +17 -0
  18. package/src/__tests__/job-handler-registration-guard.test.ts +1 -0
  19. package/src/__tests__/llm-catalog-parity.test.ts +4 -0
  20. package/src/__tests__/llm-resolver-override-or-default.test.ts +43 -0
  21. package/src/__tests__/openai-responses-prompt-cache.test.ts +3 -1
  22. package/src/__tests__/platform-callback-registration.test.ts +46 -1
  23. package/src/__tests__/plugin-api-model-profiles.test.ts +7 -0
  24. package/src/__tests__/plugin-import-boundary-guard.test.ts +3 -0
  25. package/src/__tests__/pricing.test.ts +33 -0
  26. package/src/__tests__/provider-error-scenarios.test.ts +46 -0
  27. package/src/__tests__/provider-platform-proxy-integration.test.ts +45 -15
  28. package/src/__tests__/retry-fallback-escalation.test.ts +22 -0
  29. package/src/__tests__/runtime-attachment-metadata.test.ts +4 -2
  30. package/src/__tests__/scaffold-managed-skill-tool.test.ts +116 -66
  31. package/src/__tests__/secret-routes-platform-proxy.test.ts +1 -0
  32. package/src/__tests__/send-endpoint-busy.test.ts +4 -2
  33. package/src/__tests__/skill-load-inline-command.test.ts +35 -0
  34. package/src/__tests__/skill-load-tool.test.ts +42 -11
  35. package/src/__tests__/skill-tool-factory.test.ts +50 -2
  36. package/src/__tests__/steer-on-enqueue-question.test.ts +265 -34
  37. package/src/__tests__/validate-input.test.ts +73 -0
  38. package/src/__tests__/workspace-migration-159-rename-colliding-jev-profile-name.test.ts +197 -0
  39. package/src/api/ask-question-tool.ts +50 -0
  40. package/src/api/events/tool-result.ts +11 -0
  41. package/src/api/index.ts +7 -0
  42. package/src/api/requests/dictation.ts +2 -2
  43. package/src/api/responses/home.ts +27 -0
  44. package/src/avatar/notification-avatar.test.ts +42 -34
  45. package/src/avatar/notification-avatar.ts +1 -0
  46. package/src/calls/__tests__/call-controller.test.ts +18 -0
  47. package/src/calls/__tests__/voice-control-protocol.test.ts +6 -1
  48. package/src/calls/__tests__/voice-leg-coordinator.test.ts +42 -0
  49. package/src/calls/__tests__/voice-session-bridge.test.ts +97 -4
  50. package/src/calls/__tests__/voice-triage-escalate.test.ts +69 -11
  51. package/src/calls/call-controller.ts +3 -1
  52. package/src/calls/voice-control-protocol.ts +9 -4
  53. package/src/calls/voice-escalation-judge.ts +7 -6
  54. package/src/calls/voice-leg-coordinator.ts +15 -4
  55. package/src/calls/voice-screen-annotation.ts +44 -0
  56. package/src/calls/voice-session-bridge.ts +50 -20
  57. package/src/calls/voice-triage-escalate.ts +61 -26
  58. package/src/cli/commands/__tests__/plugins.test.ts +29 -1
  59. package/src/cli/commands/channel-verification-sessions.help.ts +12 -2
  60. package/src/cli/commands/oauth/index.help.ts +8 -2
  61. package/src/cli/commands/oauth/request.test.ts +32 -0
  62. package/src/cli/commands/platform/index.help.ts +2 -1
  63. package/src/cli/commands/platform/index.ts +8 -2
  64. package/src/cli/commands/plugins.ts +16 -0
  65. package/src/cli/lib/__tests__/inspect-plugin.test.ts +29 -0
  66. package/src/cli/lib/__tests__/plugin-catalog-cache.test.ts +92 -2
  67. package/src/cli/lib/__tests__/plugin-catalog-local.test.ts +15 -0
  68. package/src/cli/lib/__tests__/plugin-catalog-platform.test.ts +66 -2
  69. package/src/cli/lib/__tests__/plugin-catalog-resolve.test.ts +21 -0
  70. package/src/cli/lib/__tests__/plugin-catalog-visibility.test.ts +65 -0
  71. package/src/cli/lib/__tests__/plugin-details.test.ts +43 -0
  72. package/src/cli/lib/__tests__/plugins-install-offline.test.ts +26 -0
  73. package/src/cli/lib/bundled-marketplace.json +4 -4
  74. package/src/cli/lib/inspect-plugin.ts +5 -0
  75. package/src/cli/lib/plugin-catalog-cache.ts +41 -4
  76. package/src/cli/lib/plugin-catalog-local.ts +9 -0
  77. package/src/cli/lib/plugin-catalog-platform.ts +48 -9
  78. package/src/cli/lib/plugin-catalog-visibility.ts +41 -0
  79. package/src/cli/lib/plugin-details.ts +10 -7
  80. package/src/cli/lib/search-plugins.ts +2 -0
  81. package/src/config/__tests__/default-profile-catalog.test.ts +61 -1
  82. package/src/config/__tests__/jev-managed-profile.test.ts +82 -0
  83. package/src/config/__tests__/platform-identity.test.ts +59 -0
  84. package/src/config/__tests__/sync-gated-profiles.test.ts +71 -0
  85. package/src/config/bundled-skills/screen-annotation/SKILL.md +6 -3
  86. package/src/config/call-site-defaults.ts +17 -11
  87. package/src/config/default-profile-catalog.ts +118 -19
  88. package/src/config/default-profile-names.ts +69 -0
  89. package/src/config/feature-flag-registry.json +25 -9
  90. package/src/config/inference-profile-validation.ts +7 -6
  91. package/src/config/llm-resolver.ts +16 -0
  92. package/src/config/platform-identity.ts +22 -5
  93. package/src/config/profile-text-generation.test.ts +9 -0
  94. package/src/config/schemas/call-site-catalog.ts +8 -1
  95. package/src/config/schemas/llm.ts +70 -9
  96. package/src/config/sidebar-done-gate.ts +27 -0
  97. package/src/config/sync-gated-profiles.ts +96 -44
  98. package/src/daemon/__tests__/auto-profile-router.test.ts +228 -0
  99. package/src/daemon/auto-profile-router.ts +220 -0
  100. package/src/daemon/conversation-agent-loop.ts +77 -4
  101. package/src/daemon/conversation-slash.ts +2 -2
  102. package/src/daemon/conversation-turn-finalize.ts +12 -0
  103. package/src/daemon/dictation-text-processing.ts +4 -4
  104. package/src/daemon/handlers/__tests__/conversation-history-search.test.ts +61 -0
  105. package/src/daemon/handlers/config-channels.ts +3 -1
  106. package/src/daemon/handlers/conversation-history.ts +11 -1
  107. package/src/daemon/handlers/conversations.ts +118 -10
  108. package/src/daemon/pkb-reminder-builder.test.ts +10 -3
  109. package/src/daemon/pkb-reminder-builder.ts +1 -1
  110. package/src/desktop/desktop-browser-endpoint.ts +1 -0
  111. package/src/home/feed-types.ts +2 -0
  112. package/src/inbound/platform-callback-registration.ts +19 -6
  113. package/src/ipc/routes/__tests__/conversation-sync-ipc-routes.test.ts +49 -1
  114. package/src/ipc/routes/conversation-sync-ipc-routes.ts +38 -2
  115. package/src/live-voice/__tests__/live-voice-agent-turn.test.ts +27 -0
  116. package/src/live-voice/__tests__/live-voice-triage-escalate.test.ts +37 -1
  117. package/src/live-voice/__tests__/live-voice-vad.test.ts +34 -2
  118. package/src/live-voice/__tests__/protocol.test.ts +22 -0
  119. package/src/live-voice/continuation-judge.ts +1 -1
  120. package/src/live-voice/live-voice-session.ts +17 -14
  121. package/src/live-voice/protocol.ts +16 -5
  122. package/src/messaging/providers/gmail/client.ts +4 -0
  123. package/src/notifications/README.md +11 -3
  124. package/src/notifications/__tests__/assistant-reply-producer.test.ts +13 -0
  125. package/src/notifications/__tests__/home-feed-side-effect.test.ts +87 -3
  126. package/src/notifications/conversation-pairing.ts +23 -8
  127. package/src/notifications/home-feed-mirror.ts +39 -0
  128. package/src/notifications/home-feed-side-effect.ts +46 -19
  129. package/src/oauth/AGENTS.md +9 -1
  130. package/src/oauth/byo-connection.test.ts +28 -0
  131. package/src/permissions/question-prompter.ts +14 -4
  132. package/src/persistence/conversation-crud.ts +116 -3
  133. package/src/persistence/conversation-queries.ts +48 -3
  134. package/src/persistence/conversation-types.ts +6 -2
  135. package/src/persistence/embeddings/__tests__/embedding-local-lifecycle.test.ts +228 -32
  136. package/src/persistence/embeddings/embedding-backend-shutdown.test.ts +47 -0
  137. package/src/persistence/embeddings/embedding-backend.ts +23 -41
  138. package/src/persistence/embeddings/embedding-gemini.test.ts +17 -0
  139. package/src/persistence/embeddings/embedding-gemini.ts +3 -1
  140. package/src/persistence/embeddings/embedding-local.ts +72 -17
  141. package/src/persistence/embeddings/embedding-types.ts +0 -19
  142. package/src/persistence/jobs-store.ts +229 -0
  143. package/src/persistence/migrations/383-normalize-opencode-host-connections.ts +44 -0
  144. package/src/persistence/migrations/__tests__/383-normalize-opencode-host-connections.test.ts +102 -0
  145. package/src/persistence/steps.ts +12 -0
  146. package/src/platform/sync-avatar.test.ts +29 -0
  147. package/src/plugin-api/model-profiles.ts +5 -3
  148. package/src/plugins/defaults/memory/AGENTS.md +5 -3
  149. package/src/plugins/defaults/memory/__tests__/memory-retrospective-skill-card.test.ts +2 -0
  150. package/src/plugins/defaults/memory/__tests__/skill-update-receipt-boundary-guard.test.ts +45 -0
  151. package/src/plugins/defaults/memory/__tests__/skill-update-receipt-job.test.ts +580 -0
  152. package/src/plugins/defaults/memory/graph/tools.ts +9 -5
  153. package/src/plugins/defaults/memory/hooks/conversation-deleted.ts +4 -0
  154. package/src/plugins/defaults/memory/job-handlers.ts +8 -2
  155. package/src/plugins/defaults/memory/memory-retrospective-skill-card.ts +5 -0
  156. package/src/plugins/defaults/memory/skill-update-receipt-job.ts +334 -0
  157. package/src/plugins/defaults/memory/substrate/skill-content.ts +1 -1
  158. package/src/plugins/defaults/memory/tools.test.ts +17 -0
  159. package/src/plugins/defaults/memory/v3/__tests__/render-injection.test.ts +3 -0
  160. package/src/providers/__tests__/connection-model-compat.test.ts +2 -0
  161. package/src/providers/__tests__/search-provider-catalog.test.ts +8 -0
  162. package/src/providers/anthropic/client.ts +2 -2
  163. package/src/providers/gemini/client.ts +17 -1
  164. package/src/providers/inference/auth.ts +25 -0
  165. package/src/providers/jev/ask.test.ts +66 -0
  166. package/src/{calls/typesafe-noul.ts → providers/jev/ask.ts} +75 -36
  167. package/src/providers/malformed-tool-call.ts +55 -0
  168. package/src/providers/model-catalog.ts +257 -4
  169. package/src/providers/openai/__tests__/chat-completions-malformed-tool-call.test.ts +105 -0
  170. package/src/providers/openai/chat-completions-provider.ts +30 -0
  171. package/src/providers/openai/codex-models.ts +2 -0
  172. package/src/providers/platform-proxy/constants.ts +5 -0
  173. package/src/providers/retry.ts +68 -36
  174. package/src/providers/search-provider-catalog.ts +10 -0
  175. package/src/providers/vellum-model-routing.test.ts +1 -0
  176. package/src/runtime/__tests__/agent-wake-archived-gate.test.ts +90 -0
  177. package/src/runtime/__tests__/question-resolution.test.ts +32 -0
  178. package/src/runtime/agent-wake.ts +9 -2
  179. package/src/runtime/auth/__tests__/middleware.test.ts +138 -0
  180. package/src/runtime/auth/middleware.ts +15 -11
  181. package/src/runtime/middleware/auth.ts +7 -1
  182. package/src/runtime/pending-interactions.ts +8 -8
  183. package/src/runtime/question-resolution.ts +54 -8
  184. package/src/runtime/routes/__tests__/conversation-list-routes.test.ts +146 -0
  185. package/src/runtime/routes/__tests__/dictation-processing.test.ts +174 -0
  186. package/src/runtime/routes/__tests__/global-search-routes.test.ts +74 -1
  187. package/src/runtime/routes/__tests__/inference-provider-connection-routes.test.ts +60 -0
  188. package/src/runtime/routes/__tests__/llm-call-sites-routes.test.ts +16 -1
  189. package/src/runtime/routes/__tests__/oauth-proxy-routes.test.ts +61 -3
  190. package/src/runtime/routes/__tests__/plugins-routes.test.ts +8 -0
  191. package/src/runtime/routes/conversation-list-routes.ts +16 -14
  192. package/src/runtime/routes/conversation-query-routes.ts +4 -0
  193. package/src/runtime/routes/conversation-routes.ts +4 -2
  194. package/src/runtime/routes/diagnostics-routes.ts +66 -229
  195. package/src/runtime/routes/global-search-routes.ts +22 -7
  196. package/src/runtime/routes/inference-provider-connection-routes.ts +25 -8
  197. package/src/runtime/routes/llm-call-sites-routes.ts +19 -10
  198. package/src/runtime/routes/oauth-proxy-passthrough.test.ts +32 -0
  199. package/src/runtime/routes/platform-routes.ts +6 -1
  200. package/src/runtime/routes/plugins-routes.ts +5 -2
  201. package/src/runtime/sync/documents-sidecar-publish.test.ts +50 -4
  202. package/src/runtime/sync/resource-sync-events.ts +11 -0
  203. package/src/runtime/sync/worker-daemon-notify.test.ts +30 -0
  204. package/src/runtime/sync/worker-daemon-notify.ts +44 -0
  205. package/src/runtime/verification-outbound-actions.ts +2 -2
  206. package/src/skills/validate-input.ts +75 -11
  207. package/src/telegram/__tests__/webhook-health.test.ts +8 -0
  208. package/src/tools/ask-question/ask-question-tool.test.ts +38 -0
  209. package/src/tools/ask-question/ask-question-tool.ts +12 -1
  210. package/src/tools/network/__tests__/web-fetch-firecrawl.test.ts +28 -1
  211. package/src/tools/network/__tests__/web-fetch-metadata.test.ts +34 -0
  212. package/src/tools/network/__tests__/web-fetch-tinyfish.test.ts +35 -1
  213. package/src/tools/network/__tests__/web-search.test.ts +96 -0
  214. package/src/tools/network/web-fetch.ts +30 -9
  215. package/src/tools/network/web-search.ts +235 -4
  216. package/src/tools/skills/execute.ts +1 -1
  217. package/src/tools/skills/format-input-schema.ts +15 -0
  218. package/src/tools/skills/load.ts +15 -43
  219. package/src/tools/skills/scaffold-managed.ts +86 -71
  220. package/src/tools/skills/skill-tool-factory.ts +2 -1
  221. package/src/tools/workflows/manage-workflows.ts +4 -2
  222. package/src/util/oauth-request-body.test.ts +5 -1
  223. package/src/util/worker-pipe.test.ts +146 -0
  224. package/src/util/worker-pipe.ts +49 -0
  225. package/src/workspace/migrations/158-repoint-opencode-host-provider-fragments.ts +163 -0
  226. package/src/workspace/migrations/159-rename-colliding-jev-profile-name.ts +344 -0
  227. package/src/workspace/migrations/__tests__/158-repoint-opencode-host-provider-fragments.test.ts +188 -0
  228. package/src/workspace/migrations/registry.ts +4 -0
  229. package/src/runtime/routes/__tests__/dictation-cleanup-guard.test.ts +0 -107
@@ -957,6 +957,19 @@ describe("emitAssistantReplyNotification", () => {
957
957
  });
958
958
  }
959
959
 
960
+ test("pushes the reply to a hidden voice continuation result", async () => {
961
+ initiatingRow = makeMessage({
962
+ metadata: JSON.stringify({
963
+ hidden: true,
964
+ voiceContinuationResult: true,
965
+ }),
966
+ });
967
+
968
+ await run();
969
+
970
+ expect(emitCalls).toHaveLength(1);
971
+ });
972
+
960
973
  // A pointer turn fact-checks the rows it generated only after the turn ends
961
974
  // and deletes them when validation fails, so a push at turn end would have
962
975
  // already carried a call outcome the deterministic fallback then replaces.
@@ -20,7 +20,7 @@ const messageAppends: Array<{
20
20
  conversationId: string;
21
21
  role: string;
22
22
  content: string;
23
- options?: { skipIndexing?: boolean };
23
+ options?: { skipIndexing?: boolean; skipResurface?: boolean };
24
24
  }> = [];
25
25
  const messageRewrites: Array<{ messageId: string; content: string }> = [];
26
26
  /** messageId -> the conversation it belongs to, for the scoped lookup. */
@@ -86,7 +86,7 @@ mock.module("../../persistence/conversation-crud.js", () => ({
86
86
  conversationId: string,
87
87
  role: string,
88
88
  content: string,
89
- options?: { skipIndexing?: boolean },
89
+ options?: { skipIndexing?: boolean; skipResurface?: boolean },
90
90
  ) => {
91
91
  if (messageAppendShouldThrow) {
92
92
  throw new Error("simulated message write failure");
@@ -1039,6 +1039,88 @@ describe("writeHomeFeedItemForSignal", () => {
1039
1039
  expect(appendCalls).toHaveLength(1);
1040
1040
  });
1041
1041
 
1042
+ // ── skill-update receipts ───────────────────────────────────────────
1043
+
1044
+ const RECEIPT_UPDATES = [
1045
+ {
1046
+ skillId: "skill-a",
1047
+ name: "Skill A",
1048
+ summary: "Changed a step.",
1049
+ conversationId: "conv-source-1",
1050
+ },
1051
+ { skillId: "skill-b", name: "Skill B", summary: "Changed another." },
1052
+ ];
1053
+
1054
+ test("a receipt's entries land as the typed updates, out of metadata, under the list panel", async () => {
1055
+ conversationRow = { conversationType: "background" };
1056
+ const signal = makeSignal({
1057
+ sourceChannel: "assistant_tool",
1058
+ sourceEventName: "activity.complete",
1059
+ contextPayload: {
1060
+ title: "2 skills updated",
1061
+ body: "- Skill A: Changed a step.\n- Skill B: Changed another.",
1062
+ updates: RECEIPT_UPDATES,
1063
+ skillId: "skill-a",
1064
+ },
1065
+ });
1066
+
1067
+ const item = await writeHomeFeedItemForSignal(signal, makeDecision());
1068
+
1069
+ expect(item?.updates).toEqual(RECEIPT_UPDATES);
1070
+ expect(item?.detailPanel).toEqual({ kind: "updatesList" });
1071
+ expect(item?.metadata).not.toHaveProperty("updates");
1072
+ expect(item?.metadata?.skillId).toBe("skill-a");
1073
+ });
1074
+
1075
+ test("a receipt's summary is the payload body, never model copy", async () => {
1076
+ // The pipeline's seed message and body win for every other item; a
1077
+ // paraphrase of a receipt can drop an entry, so the list is kept.
1078
+ conversationRow = { conversationType: "background" };
1079
+ const signal = makeSignal({
1080
+ sourceChannel: "assistant_tool",
1081
+ sourceEventName: "activity.complete",
1082
+ contextPayload: {
1083
+ title: "2 skills updated",
1084
+ body: "- Skill A: Changed a step.\n- Skill B: Changed another.",
1085
+ updates: RECEIPT_UPDATES,
1086
+ },
1087
+ });
1088
+ const decision = makeDecision({
1089
+ selectedChannels: ["vellum"],
1090
+ renderedCopy: {
1091
+ vellum: {
1092
+ title: "Skills refreshed",
1093
+ body: "Two skills were refreshed.",
1094
+ conversationSeedMessage:
1095
+ "The assistant refreshed two of your skills after reviewing recent work.",
1096
+ },
1097
+ },
1098
+ });
1099
+
1100
+ const item = await writeHomeFeedItemForSignal(signal, decision);
1101
+
1102
+ expect(item?.summary).toBe(
1103
+ "- Skill A: Changed a step.\n- Skill B: Changed another.",
1104
+ );
1105
+ });
1106
+
1107
+ test("a malformed or empty updates list leaves the item an ordinary notification", async () => {
1108
+ conversationRow = { conversationType: "background" };
1109
+ for (const updates of [[], [{ name: "no id" }], "not a list"]) {
1110
+ appendCalls.length = 0;
1111
+ const signal = makeSignal({
1112
+ sourceChannel: "assistant_tool",
1113
+ sourceEventName: "activity.complete",
1114
+ contextPayload: { title: "Skill updated", body: "Body", updates },
1115
+ });
1116
+
1117
+ const item = await writeHomeFeedItemForSignal(signal, makeDecision());
1118
+
1119
+ expect(item?.updates).toBeUndefined();
1120
+ expect(item?.detailPanel).toBeUndefined();
1121
+ }
1122
+ });
1123
+
1042
1124
  // ── noteworthy derivation ────────────────────────────────────────────
1043
1125
 
1044
1126
  test("assistant_tool source marks the feed item noteworthy", async () => {
@@ -1264,7 +1346,9 @@ describe("writeHomeFeedItemForSignal", () => {
1264
1346
  conversationId: "conv-source-1",
1265
1347
  role: "assistant",
1266
1348
  content: "Three things today.",
1267
- options: { skipIndexing: true },
1349
+ // Bookkeeping about the conversation, so it never resurfaces a
1350
+ // chat the user marked Done.
1351
+ options: { skipIndexing: true, skipResurface: true },
1268
1352
  });
1269
1353
  expect(item?.metadata?.notificationConversationMessageId).toBe("msg-1");
1270
1354
  // A client with the conversation open refetches only on the messages
@@ -61,6 +61,7 @@ import {
61
61
  isConversationSeedSane,
62
62
  } from "./conversation-seed-composer.js";
63
63
  import { isGuardianRequestSignalEvent } from "./guardian-feed-projection.js";
64
+ import { signalMirrorsToHomeFeed } from "./home-feed-mirror.js";
64
65
  import type { NotificationSignal } from "./signal.js";
65
66
  import type {
66
67
  ConversationAction,
@@ -274,7 +275,7 @@ export async function pairDeliveryWithConversation(
274
275
  signal.sourceEventName === ASSISTANT_REPLY_EVENT
275
276
  ) {
276
277
  return {
277
- conversationId: resolveSourceConversationId(signal),
278
+ conversationId: resolveSourceConversation(signal)?.id ?? null,
278
279
  messageId: null,
279
280
  strategy,
280
281
  createdNewConversation: false,
@@ -767,12 +768,15 @@ async function resolveChannelDeliveryHome(params: {
767
768
  * Indexing is skipped for parity with the other notification write paths:
768
769
  * notification copy is delivery audit, not conversational memory.
769
770
  */
770
- function resolveSourceConversationId(signal: NotificationSignal): string | null {
771
+ function resolveSourceConversation(
772
+ signal: NotificationSignal,
773
+ ): { id: string; conversationType?: string } | null {
771
774
  if (!signal.sourceContextId) {
772
775
  return null;
773
776
  }
774
777
  try {
775
- return getConversation(signal.sourceContextId)?.id ?? null;
778
+ const row = getConversation(signal.sourceContextId);
779
+ return row ? { id: row.id, conversationType: row.conversationType } : null;
776
780
  } catch {
777
781
  return null;
778
782
  }
@@ -783,14 +787,25 @@ async function appendBodyToSourceConversation(
783
787
  channel: NotificationChannel,
784
788
  messageContent: string,
785
789
  ): Promise<{ conversationId: string; messageId: string } | null> {
786
- const conversationId = resolveSourceConversationId(signal);
787
- if (!conversationId) {
790
+ const source = resolveSourceConversation(signal);
791
+ if (!source) {
788
792
  return null;
789
793
  }
794
+ const conversationId = source.id;
790
795
 
791
- const message = await addMessage(conversationId, "assistant", messageContent, {
792
- skipIndexing: true,
793
- });
796
+ const message = await addMessage(
797
+ conversationId,
798
+ "assistant",
799
+ messageContent,
800
+ {
801
+ skipIndexing: true,
802
+ // A notification the bell carries is bookkeeping about the
803
+ // conversation, not activity in it, so it must not bounce a chat the
804
+ // user just marked Done back into the sidebar. One the bell does not
805
+ // carry has this transcript as its only home, and the chat resurfaces.
806
+ skipResurface: signalMirrorsToHomeFeed(signal, source.conversationType),
807
+ },
808
+ );
794
809
  // `addMessage` projects attention metadata alone, so a client with this
795
810
  // conversation open needs the messages tag to refetch the transcript. A
796
811
  // notification the user taps through to has every chance of landing on an
@@ -0,0 +1,39 @@
1
+ import { isBackgroundConversationType } from "../persistence/conversation-types.js";
2
+ import { readChannelAllowlist } from "./channel-allowlist.js";
3
+ import type { NotificationSignal } from "./signal.js";
4
+
5
+ /**
6
+ * Whether the home feed carries a card for `signal`, judged from the signal
7
+ * and the conversation it names. The feed side effect's mirror decision is
8
+ * this plus two checks only it can make (a guardian request always mirrors;
9
+ * a delivery that materialized an assistant-initiated thread never does).
10
+ *
11
+ * The one other reader is the passive vellum append: a notification the
12
+ * bell carries is bookkeeping about the conversation it is appended to, so
13
+ * that append must not resurface a Done chat, while a notification the bell
14
+ * does not carry has the transcript as its only home and must.
15
+ *
16
+ * `assistant_tool` mirrors unconditionally because the documented
17
+ * `notifications send` skill (and background-job failure emits) deliberately
18
+ * target the home feed, unless an exclusive channel allowlist leaves vellum
19
+ * out; `chat.assistant_reply` follows the same rule. An async-background
20
+ * hint or a background-typed source conversation mirrors as well.
21
+ */
22
+ export function signalMirrorsToHomeFeed(
23
+ signal: NotificationSignal,
24
+ sourceConversationType: string | undefined,
25
+ ): boolean {
26
+ if (
27
+ signal.sourceChannel === "assistant_tool" ||
28
+ signal.sourceEventName === "chat.assistant_reply"
29
+ ) {
30
+ const allowlist = readChannelAllowlist(signal.contextPayload);
31
+ if (!allowlist || allowlist.includes("vellum")) {
32
+ return true;
33
+ }
34
+ }
35
+ if (signal.attentionHints.isAsyncBackground) {
36
+ return true;
37
+ }
38
+ return isBackgroundConversationType(sourceConversationType);
39
+ }
@@ -15,6 +15,8 @@ import {
15
15
  type FeedItemCategory,
16
16
  type FeedItemDetailPanelKind,
17
17
  feedItemSchema,
18
+ type FeedItemUpdate,
19
+ feedItemUpdateSchema,
18
20
  } from "../home/feed-types.js";
19
21
  import { appendFeedItem } from "../home/feed-writer.js";
20
22
  import {
@@ -23,14 +25,11 @@ import {
23
25
  getMessageById,
24
26
  updateMessageContent,
25
27
  } from "../persistence/conversation-crud.js";
26
- import {
27
- ASSISTANT_INITIATED_SOURCE,
28
- isBackgroundConversationType,
29
- } from "../persistence/conversation-types.js";
28
+ import { ASSISTANT_INITIATED_SOURCE } from "../persistence/conversation-types.js";
30
29
  import { publishConversationMessagesChanged } from "../runtime/sync/resource-sync-events.js";
31
30
  import { getLogger } from "../util/logger.js";
31
+ import { isPlainObject } from "../util/object.js";
32
32
  import { normalizeTitle, stripMarkdown } from "../util/short-title.js";
33
- import { readChannelAllowlist } from "./channel-allowlist.js";
34
33
  import { isConversationSeedSane } from "./conversation-seed-composer.js";
35
34
  import { deriveTitle } from "./copy-composer.js";
36
35
  import {
@@ -39,6 +38,7 @@ import {
39
38
  isGuardianRequestSignalEvent,
40
39
  receiptGuardianFeedItemIfRequestTerminal,
41
40
  } from "./guardian-feed-projection.js";
41
+ import { signalMirrorsToHomeFeed } from "./home-feed-mirror.js";
42
42
  import { readPayloadString } from "./notification-utils.js";
43
43
  import type { NotificationSignal } from "./signal.js";
44
44
  import type {
@@ -65,6 +65,30 @@ const log = getLogger("home-feed-side-effect");
65
65
  */
66
66
  const CONVERSATION_MESSAGE_ID_KEY = "notificationConversationMessageId";
67
67
 
68
+ /**
69
+ * Payload key a skill-update receipt carries its entries under. Read here
70
+ * through the wire schema and mapped onto the item's typed `updates`, so the
71
+ * panel the client opens is decided by the shape, never by copy.
72
+ */
73
+ const UPDATES_KEY = "updates";
74
+
75
+ /**
76
+ * The receipt entries in `contextPayload`, when it carries a non-empty list
77
+ * that parses as the wire shape; otherwise undefined, and the item renders
78
+ * as an ordinary notification. A malformed list is dropped rather than
79
+ * mirrored, since a client would render whatever survived.
80
+ */
81
+ function readUpdates(contextPayload: unknown): FeedItemUpdate[] | undefined {
82
+ if (!isPlainObject(contextPayload)) {
83
+ return undefined;
84
+ }
85
+ const parsed = feedItemUpdateSchema
86
+ .array()
87
+ .min(1)
88
+ .safeParse(contextPayload[UPDATES_KEY]);
89
+ return parsed.success ? parsed.data : undefined;
90
+ }
91
+
68
92
  /**
69
93
  * Append a `FeedItem` for the given notification signal when the
70
94
  * filter criteria pass.
@@ -106,12 +130,19 @@ export async function writeHomeFeedItemForSignal(
106
130
  readPayloadString(signal.contextPayload, "body") ??
107
131
  readPayloadString(signal.contextPayload, "requestedMessage");
108
132
 
133
+ // A receipt's summary is the producer's own list of what changed, which
134
+ // the panel renders from the typed entries and a client without the panel
135
+ // reads as-is. Model copy is not allowed to rewrite it: a paraphrase can
136
+ // drop an entry, and the list is the receipt's whole point.
137
+ const updates = readUpdates(signal.contextPayload);
138
+
109
139
  // Prefer conversationSeedMessage over body for the home feed: the seed
110
140
  // message is richer and may contain structured markdown (lists, headers,
111
141
  // bold) that the detail panel renders. The popup-oriented `body` is
112
142
  // intentionally short (≤ 2 sentences) and loses formatting.
113
143
  const seedCandidate = renderedCopy?.conversationSeedMessage;
114
144
  const resolvedSummary =
145
+ (updates ? payloadBody?.trim() : undefined) ||
115
146
  (isConversationSeedSane(seedCandidate)
116
147
  ? seedCandidate.trim()
117
148
  : undefined) ||
@@ -146,7 +177,7 @@ export async function writeHomeFeedItemForSignal(
146
177
  const now = new Date().toISOString();
147
178
 
148
179
  const category = deriveCategory(signal);
149
- const panelKind = deriveDetailPanelKind(signal);
180
+ const panelKind = updates ? "updatesList" : deriveDetailPanelKind(signal);
150
181
 
151
182
  const baseMetadata =
152
183
  signal.contextPayload &&
@@ -157,6 +188,9 @@ export async function writeHomeFeedItemForSignal(
157
188
  // Producer payloads reach the card verbatim, and this key addresses a
158
189
  // message row for rewriting, so only this module may set it.
159
190
  delete baseMetadata?.[CONVERSATION_MESSAGE_ID_KEY];
191
+ // The entries ride on the item as its typed `updates`, not in the
192
+ // free-form bag, so a client reads them from one place.
193
+ delete baseMetadata?.[UPDATES_KEY];
160
194
 
161
195
  // Link scheduled-run notifications back to their schedule. `notify`-mode
162
196
  // jobs put `scheduleId` directly in the context payload; `execute`-mode (and
@@ -205,6 +239,7 @@ export async function writeHomeFeedItemForSignal(
205
239
  ...(urgency ? { urgency } : {}),
206
240
  ...(sourceConversationId ? { conversationId: sourceConversationId } : {}),
207
241
  ...(panelKind ? { detailPanel: { kind: panelKind } } : {}),
242
+ ...(updates ? { updates } : {}),
208
243
  ...(metadata ? { metadata } : {}),
209
244
  };
210
245
 
@@ -322,6 +357,10 @@ async function appendSummaryToFeedTarget(
322
357
  try {
323
358
  const message = await addMessage(conversationId, "assistant", summary, {
324
359
  skipIndexing: true,
360
+ // The body is bookkeeping about the conversation, not activity in it:
361
+ // a receipt for work the conversation already saw must not bounce a
362
+ // chat the user just marked Done back into the sidebar.
363
+ skipResurface: true,
325
364
  });
326
365
  publishConversationMessagesChanged(conversationId);
327
366
  log.info(
@@ -553,19 +592,7 @@ function resolveHomeFeedMirror(
553
592
  if (isAssistantInitiatedThreadDelivery(fallbackConversationId)) {
554
593
  return { mirror: false };
555
594
  }
556
- if (
557
- signal.sourceChannel === "assistant_tool" ||
558
- signal.sourceEventName === "chat.assistant_reply"
559
- ) {
560
- const allowlist = readChannelAllowlist(signal.contextPayload);
561
- if (!allowlist || allowlist.includes("vellum")) {
562
- return { mirror: true, sourceConversationId, sourceScheduleJobId };
563
- }
564
- }
565
- if (signal.attentionHints.isAsyncBackground) {
566
- return { mirror: true, sourceConversationId, sourceScheduleJobId };
567
- }
568
- if (isBackgroundConversationType(sourceRow?.conversationType)) {
595
+ if (signalMirrorsToHomeFeed(signal, sourceRow?.conversationType)) {
569
596
  return { mirror: true, sourceConversationId, sourceScheduleJobId };
570
597
  }
571
598
  return { mirror: false };
@@ -14,6 +14,12 @@ Add an entry to `PROVIDER_SEED_DATA`. Required fields: `provider`, `authorizeUrl
14
14
 
15
15
  If the provider will support managed mode, set `managedServiceConfigKey` to a slug matching the key you will add to `ServicesSchema` (e.g. `"acme-oauth"`).
16
16
 
17
+ #### Scopes: your-own vs. managed
18
+
19
+ `defaultScopes` here is requested only by the user's own OAuth client. A managed connection authorizes against Vellum's OAuth app, whose defaults live in the platform's `provider_registry.json`. Google shows users warnings or errors for scopes not approved for the app, so the managed start endpoint rejects anything outside the platform registry's `extra_config.allowed_scopes`. Managed Google, for example, grants Gmail only as `https://mail.google.com/`, never `gmail.readonly` / `gmail.modify` / `gmail.send`.
20
+
21
+ So anything that names scopes for a managed connection (a hardcoded constant, a client hook, `requestedScopes` on an `oauth_connect` surface, a `--scopes` example in a skill) must use scopes from that approved list, not the `defaultScopes` names. A required-scope check that runs against managed grants must accept the approved equivalent: `grantedScopeCoversRequiredScope` in `scope-utils.ts` treats `mail.google.com` as covering `gmail.readonly`. Adding a scope to a managed flow means getting it approved in the provider console and adding it to `allowed_scopes` first.
22
+
17
23
  ### 2. _(managed only)_ Add a service schema — `../config/schemas/services.ts`
18
24
 
19
25
  Create a schema and export its type:
@@ -77,6 +83,8 @@ Only the HTTP adapter supplies the wire-exact URL the route forwards, so an IPC
77
83
 
78
84
  Wire semantics live in `../runtime/routes/oauth-proxy-passthrough.ts`. The remainder path reaches the provider as the caller wrote it: `.` and `..` collapse, an absolute URL, `//host`, or an empty segment is a 400, and no segment is decoded or re-encoded, so a `%2F` survives. No `baseUrl` is passed to the connection, so its own API base is the only host ever targeted.
79
85
 
86
+ The minted base is that path prefix, not a host root. Stock clients resolve a leading `/` against the origin (`/upload/gmail/...`, `/v1/charges`), which would otherwise miss the daemon catch-all. The gateway's runtime-proxy remaps those host-absolute paths onto `/v1/oauth/proxy/<segment>` when the bearer is an `oauth_proxy_v1` grant (`gateway/src/http/routes/oauth-proxy-path.ts`). An already-prefixed path, including one naming a different provider, is left alone so the daemon's subject check still applies. Traversal and `//host` stay in the remainder for `normalizeProxyPath` to reject.
87
+
80
88
  ### Provider segment
81
89
 
82
90
  The first segment is `provider` or `provider@account`, the account pinning one connection when a provider has several. Proxy provider keys contain only ASCII letters, digits, `.`, `_`, `~`, and `-`, and cannot be `.` or `..`. Encoding and parsing share this validation so URL delimiters, percent escapes, and normalization cannot change the provider or grant subject. Accounts are percent-encoded for the same reason. When several accounts are connected and none is pinned, both answer 409, but they say different things. The mint names the accounts, because the caller is the local operator choosing one. Unlabeled BYO connections can be selected with their exact connection ID; account-label matches take precedence, and provider, client, and active-status filters apply to either selector. The proxy names none, because its caller is the third-party binary holding the grant; it says to mint a grant pinned with `--account`, which is the only thing that resolves it. Rewriting the segment would not, since the subject check runs before resolution.
@@ -98,7 +106,7 @@ A grant is pinned when the caller passed `--account` or the resolved connection
98
106
 
99
107
  The grant carries one scope for one route, and four checks hold it there:
100
108
 
101
- - **Gateway edge auth** (`gateway/src/http/middleware/auth.ts`) refuses it on every gateway-native route, with no loopback fallback. `isSingleRouteGrant` calls `isNarrowScopeProfile` from `gateway/src/auth/scopes.ts`, and also catches a proxy subject carrying some other profile. The passthrough itself never passes through edge auth: it falls to the runtime-proxy catch-all, which re-mints the grant's own subject and profile for the daemon. That holds whether or not the gateway requires client-facing auth (`gateway.runtimeProxyRequireAuth`, off under `dev:proxy`): a presented grant is validated the same way in both modes and only a caller presenting no valid grant is answered with the gateway's own service token, so the minted URL works in either and neither mode hands the grant more than `oauth.proxy`.
109
+ - **Gateway edge auth** (`gateway/src/http/middleware/auth.ts`) refuses it on every gateway-native route, with no loopback fallback. `isSingleRouteGrant` calls `isNarrowScopeProfile` from `gateway/src/auth/scopes.ts`, and also catches a proxy subject carrying some other profile. The passthrough itself never passes through edge auth: it falls to the runtime-proxy catch-all, which re-mints the grant's own subject and profile for the daemon. That holds whether or not the gateway requires client-facing auth (`gateway.runtimeProxyRequireAuth`): a presented grant is validated the same way in both modes and only a caller presenting no valid grant is answered with the gateway's own service token, so the minted URL works in either and neither mode hands the grant more than `oauth.proxy`.
102
110
  - **The gateway's IPC fast path** (`gateway/src/http/routes/ipc-runtime-proxy.ts`) refuses it against any daemon route naming no scope. The daemon's IPC server runs no policy check of its own, so this is the only enforcement an IPC-served request gets.
103
111
  - **`enforcePolicy`** (`../runtime/auth/route-policy.ts`) refuses the same on the HTTP path, then applies the route's own scopes. `oauth.proxy` reaches the passthrough and nothing else. It runs wherever `routeRequest` dispatches through the router, which is every `/v1` route and the shareable-pages path bar three groups that earlier branches answer first, each carrying a gate of its own: `GET /v1/audio/:audioId`, deliberately public and served before `authenticateRequest` runs at all because Twilio fetches it directly; the Twilio webhook paths (`TWILIO_WEBHOOK_RE`), also pre-auth and gated on Twilio's request signature; and the WebSocket upgrades in the next bullet, which never reach the route table. A route added anywhere else is covered.
104
112
  - **WebSocket upgrades** (`/v1/calls/media-stream`, `/v1/stt/stream`, `/v1/live-voice`, `/v1/watch/stream`) are handled before the route table on both hops, so neither edge auth nor `enforcePolicy` sees them, and each carries its own identity gate. The daemon admits only a private-network peer presenting a gateway service token; at the edge it is an actor principal on `runtime-audio-stream` and `live-voice`, the `speech.relay` scope on the relay, and the relay-token identity on `twilio-media-websocket`.
@@ -504,6 +504,34 @@ describe("BYOOAuthConnection", () => {
504
504
  expect(headers.get("Content-Type")).toBe("application/pdf");
505
505
  });
506
506
 
507
+ test("joins a Gmail media upload onto the host-only Google API base", async () => {
508
+ await setupCredential("google");
509
+ const conn = new BYOOAuthConnection({
510
+ id: "conn-google",
511
+ provider: "google",
512
+ baseUrl: "https://www.googleapis.com",
513
+ accountInfo: null,
514
+ });
515
+ const rfc822 =
516
+ "From: user@example.com\r\nTo: user@example.com\r\nSubject: Draft\r\n\r\nHello\r\n";
517
+
518
+ await conn.request({
519
+ method: "POST",
520
+ path: "/upload/gmail/v1/users/me/drafts",
521
+ query: { uploadType: "media" },
522
+ headers: { "Content-Type": "message/rfc822" },
523
+ body: rfc822,
524
+ });
525
+
526
+ expect(mockFetch.mock.calls[0][0]).toBe(
527
+ "https://www.googleapis.com/upload/gmail/v1/users/me/drafts?uploadType=media",
528
+ );
529
+ const [, init] = mockFetch.mock.calls[0];
530
+ expect((init as RequestInit).body).toBe(rfc822);
531
+ const headers = (init as RequestInit).headers as Headers;
532
+ expect(headers.get("Content-Type")).toBe("message/rfc822");
533
+ });
534
+
507
535
  test("sends a string body verbatim under the caller's Content-Type", async () => {
508
536
  await setupCredential("google");
509
537
  const conn = createConnection();
@@ -58,6 +58,14 @@ export interface QuestionPromptEntryResult {
58
58
  export interface QuestionPromptResult {
59
59
  entries: QuestionPromptEntryResult[];
60
60
  overall: "completed" | "closed" | "timed_out" | "aborted";
61
+ /**
62
+ * True when the answer arrived as a message typed into the chat while the
63
+ * card was still open, rather than through the card itself. Only the first
64
+ * question carries the typed text; the rest stay `skipped`. The
65
+ * `ask_question` tool says so in the model-facing result, so the model can
66
+ * map the reply onto the questions itself.
67
+ */
68
+ answeredInChat?: boolean;
61
69
  }
62
70
 
63
71
  /**
@@ -178,10 +186,12 @@ export interface QuestionBatchMetadata {
178
186
  *
179
187
  * The idle timeout is a backstop (`getConfig().timeouts.questionResponseTimeoutSec`,
180
188
  * default 30 min), not the primary way a prompt is dismissed. An interactive
181
- * user who moves on instead of answering enqueues another message, which
182
- * supersedes the open prompt at the enqueue handler (see conversation-routes.ts);
183
- * a non-interactive turn resolves immediately at the tool. The backstop only
184
- * fires when a prompt is left open with no response and no follow-up message.
189
+ * user who types into the chat instead of using the card settles the prompt at
190
+ * the enqueue handler: the typed text answers it, or, when it cannot stand in
191
+ * for an answer, supersedes it (see
192
+ * `daemon/handlers/conversations.ts`). A non-interactive turn resolves
193
+ * immediately at the tool. The backstop only fires when a prompt is left open
194
+ * with no response and no follow-up message.
185
195
  */
186
196
  export class QuestionPrompter {
187
197
  async prompt(params: QuestionPromptParams): Promise<QuestionPromptOutcome> {