@vellumai/plugin-api 0.11.3-dev.202608110433.eba8e13 → 0.11.3-dev.202608111333.7065e2a

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 (2) hide show
  1. package/index.d.ts +86 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -4000,6 +4000,41 @@ declare interface BaseSubscriberEntry {
4000
4000
  */
4001
4001
  export declare function buildMessageExcerpt(rawContent: string, query: string): Promise<string>;
4002
4002
 
4003
+ /**
4004
+ * Canonical channel-id vocabulary shared between the assistant daemon and the
4005
+ * gateway.
4006
+ *
4007
+ * A "channel" is an external messaging surface an actor can reach the
4008
+ * assistant through (Slack, Telegram, WhatsApp, phone, …) plus a couple of
4009
+ * internal ids (`vellum` for native app conversations, `platform` for the
4010
+ * internal control plane). This is the single source of truth for that set:
4011
+ *
4012
+ * One id, `plugin`, does not name a surface: it names *every* surface a plugin
4013
+ * brings. A plugin channel's real identity is the plugin, which is workspace
4014
+ * state and cannot be a compile-time union member, so the plugin name travels
4015
+ * in `sourceMetadata.plugin` and is prefixed onto every external id the gateway
4016
+ * forwards (`imessage:+15551234567`). Two plugins therefore share a channel
4017
+ * row — one admission floor, one set of channel-wide defaults — while their
4018
+ * conversations, contacts, and trust records stay disjoint. See
4019
+ * `gateway/src/channels/plugin-inbound.ts` for what that concedes.
4020
+ *
4021
+ * the assistant adopts it wholesale as its `ChannelId`, and the gateway
4022
+ * asserts its own (narrower) inbound list is a subset of it so the two sides
4023
+ * cannot silently drift.
4024
+ *
4025
+ * Both packages depend on `@vellumai/service-contracts`, so hoisting the set
4026
+ * here (rather than maintaining a copy on each side) means adding or renaming
4027
+ * a channel happens in exactly one place.
4028
+ *
4029
+ * Note that a consumer may legitimately handle only a *subset* of these — the
4030
+ * gateway, for example, never ingresses `platform`. Use a local list guarded
4031
+ * by `satisfies readonly ChannelId[]` for those cases rather than redefining
4032
+ * the union.
4033
+ */
4034
+ declare const CHANNEL_IDS: readonly ["telegram", "phone", "vellum", "whatsapp", "slack", "email", "platform", "a2a", "discord", "plugin"];
4035
+
4036
+ declare type ChannelId = (typeof CHANNEL_IDS)[number];
4037
+
4003
4038
  export declare const CLI_COMMAND_HELP: readonly CliCommandHelp[];
4004
4039
 
4005
4040
  declare interface CliArgumentHelp {
@@ -4105,6 +4140,43 @@ declare type ConfiguredProviderOptions = Pick<ResolveCallSiteOpts, "overrideProf
4105
4140
 
4106
4141
  export declare type ContentBlock = TextContent | ThinkingContent | RedactedThinkingContent | ImageContent | FileContent | ToolUseContent | ToolResultContent | ServerToolUseContent | WebSearchToolResultContent | UiSurfaceContent;
4107
4142
 
4143
+ /**
4144
+ * The chat a turn belongs to, in the channel's own terms.
4145
+ *
4146
+ * Supplied instead of a `conversationId` when the caller knows where the
4147
+ * message came from but not which conversation that is. The pair resolves to
4148
+ * the same conversation an inbound message on those coordinates would land
4149
+ * in, because it resolves through the same binding.
4150
+ *
4151
+ * That sameness is the reason this exists at all. A caller could keep its own
4152
+ * `externalChatId -> conversationId` map and pass the id, and turns would run
4153
+ * in the right place. What it could not do is make the rest of the assistant
4154
+ * agree: conversation reset is addressed by channel coordinates
4155
+ * (`handleDeleteConversation`), the deny lanes attach an access-request card
4156
+ * by them (`findInboundConversationId`), and the conversation and session
4157
+ * APIs read the channel, chat name and sender off the external binding. A
4158
+ * private map is a second name for the same conversation, and everything
4159
+ * keyed on the public one quietly misses.
4160
+ */
4161
+ export declare interface ConversationChannelAddress {
4162
+ /** Channel the message arrived on. */
4163
+ sourceChannel: ChannelId;
4164
+ /** The chat, in the channel's own id space. */
4165
+ externalChatId: string;
4166
+ /**
4167
+ * Thread within the chat, where the channel has threads. Only Slack and
4168
+ * Telegram scope a conversation by thread; elsewhere this is carried as
4169
+ * binding metadata and does not split the conversation.
4170
+ */
4171
+ externalThreadId?: string | null;
4172
+ /** Human-readable chat name, for the conversation list. */
4173
+ externalChatName?: string | null;
4174
+ /** Who sent it, in the channel's id space. */
4175
+ externalUserId?: string | null;
4176
+ displayName?: string | null;
4177
+ username?: string | null;
4178
+ }
4179
+
4108
4180
  /** How a conversation was created / its execution mode. */
4109
4181
  declare type ConversationCreateType = "standard" | "background" | "scheduled";
4110
4182
 
@@ -6029,9 +6101,22 @@ export declare function runConversationTurn(options: RunConversationTurnOptions)
6029
6101
  export declare interface RunConversationTurnOptions {
6030
6102
  /**
6031
6103
  * Conversation to run the turn in. If omitted, a new conversation is
6032
- * created (its ID is generated with `uuidv7` and returned in the result).
6104
+ * created (its ID is generated with `uuidv7` and returned in the result),
6105
+ * unless {@link RunConversationTurnOptions.channel} says which chat this
6106
+ * belongs to, in which case that chat's conversation is used.
6033
6107
  */
6034
6108
  conversationId?: string;
6109
+ /**
6110
+ * The chat this turn belongs to, resolved to a conversation and bound to
6111
+ * the channel. See {@link ConversationChannelAddress}.
6112
+ *
6113
+ * Ignored when `conversationId` is given: an explicit conversation is the
6114
+ * caller saying which one, and re-resolving would overrule it. A caller
6115
+ * that wants both the binding and a conversation of its own choosing is
6116
+ * describing two different conversations, which is a bug worth surfacing
6117
+ * as one rather than silently picking a winner.
6118
+ */
6119
+ channel?: ConversationChannelAddress;
6035
6120
  /**
6036
6121
  * User message content blocks for this turn. Text blocks become the
6037
6122
  * user message body; image/file blocks are resolved to inline
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.11.3-dev.202608110433.eba8e13",
3
+ "version": "0.11.3-dev.202608111333.7065e2a",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",