@vellumai/assistant 0.11.2-dev.202608071330.b91b7a0 → 0.11.2-dev.202608071425.368249e

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
@@ -4017,8 +4017,8 @@ paths:
4017
4017
  summary: Get available channels
4018
4018
  description:
4019
4019
  Return the channels this assistant can surface to clients, with display metadata (label, icon, verification
4020
- capability, setup copy). Today this is a fixed base list plus `email` when an inbox is registered; will become
4021
- plugin/skill-driven in future.
4020
+ capability, setup copy). A fixed base list plus `email` when an inbox is registered, plus the channels installed
4021
+ plugins bring by declaring ingress routes. Each carries a `source` saying which of those it is.
4022
4022
  tags:
4023
4023
  - channels
4024
4024
  responses:
@@ -4036,16 +4036,9 @@ paths:
4036
4036
  properties:
4037
4037
  id:
4038
4038
  type: string
4039
- enum:
4040
- - telegram
4041
- - phone
4042
- - vellum
4043
- - whatsapp
4044
- - slack
4045
- - email
4046
- - platform
4047
- - a2a
4048
- - discord
4039
+ source:
4040
+ type: string
4041
+ description: "`default` for a channel the assistant ships, `plugin:<name>` for one an installed plugin brings"
4049
4042
  label:
4050
4043
  type: string
4051
4044
  subtitle:
@@ -4067,13 +4060,16 @@ paths:
4067
4060
  additionalProperties: false
4068
4061
  required:
4069
4062
  - id
4063
+ - source
4070
4064
  - label
4071
4065
  - subtitle
4072
4066
  - icon
4073
4067
  - supportsVerification
4074
4068
  - setupMessages
4075
4069
  additionalProperties: false
4076
- description: Available channels in display order
4070
+ description:
4071
+ "Available channels in display order: the ones the assistant ships, then the ones installed plugins bring
4072
+ by declaring ingress routes. `source` distinguishes them."
4077
4073
  required:
4078
4074
  - channels
4079
4075
  additionalProperties: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.11.2-dev.202608071330.b91b7a0",
3
+ "version": "0.11.2-dev.202608071425.368249e",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -57,6 +57,8 @@ const handler = ROUTES[0]!.handler;
57
57
 
58
58
  interface ChannelEntry {
59
59
  id: string;
60
+ /** `default` here, `plugin:<name>` for a channel a plugin brings. */
61
+ source: string;
60
62
  label: string;
61
63
  subtitle: string;
62
64
  icon: string;
@@ -173,10 +175,21 @@ describe("channels/available", () => {
173
175
  for (const channel of result.channels) {
174
176
  const expected = (CHANNEL_METADATA as any)[channel.id];
175
177
  expect(expected).toBeDefined();
176
- expect(channel).toEqual(expected);
178
+ // Plus `source`, which the metadata does not carry: it says who
179
+ // contributes the row, and every row here comes from the assistant.
180
+ expect(channel).toEqual({ ...expected, source: "default" });
177
181
  }
178
182
  });
179
183
 
184
+ test("marks every channel the assistant ships as its own", async () => {
185
+ // The base list is what a client compares a plugin-contributed row
186
+ // against, so the marker has to be present rather than implied by an
187
+ // absent field.
188
+ const result = (await handler({})) as HandlerResult;
189
+
190
+ expect(result.channels.every((c) => c.source === "default")).toBe(true);
191
+ });
192
+
180
193
  test("email metadata: not verification-capable, mail icon", async () => {
181
194
  mockEmailAddressesResponse = {
182
195
  ok: true,
@@ -209,8 +209,8 @@ describe("credentials/prompt route", () => {
209
209
  test("stores a non-slack credential to secure storage and reports the value as received", async () => {
210
210
  /**
211
211
  * The default delivery persists the value to secure storage and runs the
212
- * manual-token connection sync. The message must name the outcome — the
213
- * value is in hand — so a bare `ok: true` cannot be misread as "the prompt
212
+ * manual-token connection sync. The message must name the outcome (the
213
+ * value is in hand) so a bare `ok: true` cannot be misread as "the prompt
214
214
  * opened".
215
215
  */
216
216
  // GIVEN a standard store-delivery prompt for a non-slack credential
@@ -236,15 +236,12 @@ describe("credentials/prompt route", () => {
236
236
 
237
237
  test("every successful outcome states that the prompt has closed", async () => {
238
238
  /**
239
- * The prompt blocks until answered, so a caller reads the result only after
240
- * the secure input is gone. Without an explicit close signal a model
241
- * follows up with "the prompt is open, paste it there" and the user
242
- * re-submits into a surface that never reappears — the loop reported in
243
- * the Aug 2026 Claude Code auth feedback. Every success path must say so,
244
- * not just the plain vault write.
239
+ * The prompt blocks until answered, so a caller reads the result only once
240
+ * the secure input is gone. Every success path states the close, not just
241
+ * the plain vault write, so the result cannot be read as "the prompt is
242
+ * open, paste it there".
245
243
  */
246
- const closed =
247
- "The secure prompt has closed — do not ask the user to enter this value again.";
244
+ const closed = "The secure prompt has closed.";
248
245
 
249
246
  // GIVEN a plain vault write
250
247
  const stored = (await promptRoute!.handler({
@@ -825,6 +825,38 @@ describe("always-candidate frontmatter parsing", () => {
825
825
  .map(({ id, chars }) => `${id}: ${chars}`);
826
826
  expect(overrun).toEqual([]);
827
827
  });
828
+
829
+ test("the bundled acp skill's card fits the default budget", async () => {
830
+ // `acp` owns Claude Code and Codex setup, sign-in, and delegation, and the
831
+ // terms that route those turns to it live in this card. The card is
832
+ // hard-truncated at the default budget, so an overrun drops the trailing
833
+ // hints and the whole avoid-when list from what the selector sees.
834
+ const { DEFAULT_CARD_CHARS, buildSkillContent } =
835
+ await import("../plugins/defaults/memory/substrate/skill-content.js");
836
+ const acp = loadSkillCatalog().find((skill) => skill.id === "acp");
837
+ expect(acp).toBeDefined();
838
+
839
+ // A card that overran is cut to exactly the budget, so staying under it is
840
+ // what proves nothing was dropped. `avoid-when` is appended last and is
841
+ // therefore the first content a truncation eats.
842
+ const card = buildSkillContent(acp!);
843
+ expect(card.length).toBeLessThan(DEFAULT_CARD_CHARS);
844
+ expect(card).toContain("Avoid when:");
845
+ });
846
+
847
+ test("the bundled acp card carries its setup and sign-in vocabulary", async () => {
848
+ // A "configure Claude Code" or "let's do the auth" turn only reaches this
849
+ // skill if the card actually says it covers setup and authentication;
850
+ // delegation-only wording routes those turns to a terminal skill instead.
851
+ const { buildSkillContent } =
852
+ await import("../plugins/defaults/memory/substrate/skill-content.js");
853
+ const acp = loadSkillCatalog().find((skill) => skill.id === "acp");
854
+ const card = buildSkillContent(acp!).toLowerCase();
855
+
856
+ for (const term of ["set up", "install", "authenticate", "connect"]) {
857
+ expect(card).toContain(term);
858
+ }
859
+ });
828
860
  });
829
861
 
830
862
  describe("bundled skill categories", () => {
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Channels that installed plugins bring.
3
+ *
4
+ * `getWorkspacePluginsDir` is mocked to a scratch directory so these read real
5
+ * files off disk without touching the machine's workspace.
6
+ */
7
+
8
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
9
+ import { tmpdir } from "node:os";
10
+ import { join } from "node:path";
11
+ import { afterAll, beforeEach, describe, expect, mock, test } from "bun:test";
12
+
13
+ const workspacePluginsDir = mkdtempSync(join(tmpdir(), "plugin-channels-"));
14
+
15
+ const realPlatform = await import("../../util/platform.js");
16
+
17
+ mock.module("../../util/platform.js", () => ({
18
+ ...realPlatform,
19
+ getWorkspacePluginsDir: () => workspacePluginsDir,
20
+ }));
21
+
22
+ const { discoverPluginChannels } = await import(
23
+ "../plugin-channel-declarations.js"
24
+ );
25
+
26
+ interface PluginOptions {
27
+ /** Contents of `channels/ingress.json`; omit for a plugin with no ingress. */
28
+ ingress?: string;
29
+ manifest?: Record<string, unknown>;
30
+ }
31
+
32
+ const INGRESS = JSON.stringify({
33
+ routes: [{ path: "events", kind: "http", description: "inbound" }],
34
+ });
35
+
36
+ function writePlugin(name: string, options: PluginOptions = {}): string {
37
+ const dir = join(workspacePluginsDir, name);
38
+ mkdirSync(dir, { recursive: true });
39
+ writeFileSync(
40
+ join(dir, "package.json"),
41
+ JSON.stringify({ name, ...options.manifest }),
42
+ );
43
+ if (options.ingress !== undefined) {
44
+ mkdirSync(join(dir, "channels"), { recursive: true });
45
+ writeFileSync(join(dir, "channels", "ingress.json"), options.ingress);
46
+ }
47
+ return dir;
48
+ }
49
+
50
+ beforeEach(() => {
51
+ rmSync(workspacePluginsDir, { recursive: true, force: true });
52
+ mkdirSync(workspacePluginsDir, { recursive: true });
53
+ });
54
+
55
+ afterAll(() => {
56
+ rmSync(workspacePluginsDir, { recursive: true, force: true });
57
+ });
58
+
59
+ describe("discoverPluginChannels", () => {
60
+ test("a plugin is a channel because it declares ingress", async () => {
61
+ writePlugin("courier", {
62
+ ingress: INGRESS,
63
+ manifest: {
64
+ displayName: "Courier",
65
+ description: "Reach the assistant by carrier pigeon.",
66
+ icon: "send",
67
+ },
68
+ });
69
+
70
+ expect(await discoverPluginChannels()).toEqual([
71
+ {
72
+ id: "courier",
73
+ source: "plugin:courier",
74
+ label: "Courier",
75
+ subtitle: "Reach the assistant by carrier pigeon.",
76
+ icon: "send",
77
+ supportsVerification: false,
78
+ setupMessages: {
79
+ guardian: "I want to set up Courier. Can you help me?",
80
+ contact:
81
+ "I'd like to reach you on Courier. Can you help me get set up?",
82
+ },
83
+ },
84
+ ]);
85
+ });
86
+
87
+ test("ignores a plugin that declares no ingress", async () => {
88
+ // Presentation alone does not make a channel: reaching the assistant from
89
+ // outside is what one is, and ingress is where that is declared.
90
+ writePlugin("notes", { manifest: { displayName: "Notes", icon: "send" } });
91
+
92
+ expect(await discoverPluginChannels()).toEqual([]);
93
+ });
94
+
95
+ test("surfaces a channel whose ingress the gateway would reject", async () => {
96
+ // Validation belongs to the gateway, which owns the schema. A plugin with
97
+ // a broken declaration is a channel with broken ingress, and saying so
98
+ // beats dropping it off the page a guardian would look at.
99
+ writePlugin("courier", {
100
+ ingress: "{ not json",
101
+ manifest: { displayName: "Courier" },
102
+ });
103
+
104
+ expect((await discoverPluginChannels())[0]?.label).toBe("Courier");
105
+ });
106
+
107
+ test("skips a disabled plugin", async () => {
108
+ // Same source of truth the loader uses for hooks, tools and routes: a
109
+ // disabled plugin would otherwise offer a setup flow that cannot run.
110
+ const dir = writePlugin("courier", { ingress: INGRESS });
111
+ writeFileSync(join(dir, ".disabled"), "");
112
+
113
+ expect(await discoverPluginChannels()).toEqual([]);
114
+ });
115
+
116
+ test("refuses to let a plugin take a built-in channel's id", async () => {
117
+ // Two rows sharing an id would be ambiguous to any client keying on one,
118
+ // and letting the plugin win would let it impersonate a built-in.
119
+ writePlugin("slack", {
120
+ ingress: INGRESS,
121
+ manifest: { displayName: "Slack" },
122
+ });
123
+
124
+ expect(await discoverPluginChannels()).toEqual([]);
125
+ });
126
+
127
+ test("titles a plugin that names no display name", async () => {
128
+ // Presentation is best-effort, so a bare manifest costs a nicer title and
129
+ // never the row itself.
130
+ writePlugin("meeting-bot", { ingress: INGRESS });
131
+
132
+ expect(await discoverPluginChannels()).toMatchObject([
133
+ {
134
+ id: "meeting-bot",
135
+ source: "plugin:meeting-bot",
136
+ label: "Meeting Bot",
137
+ subtitle: "Provided by the Meeting Bot plugin",
138
+ icon: "message-square",
139
+ },
140
+ ]);
141
+ });
142
+
143
+ test("still lists a channel whose manifest cannot be read", async () => {
144
+ // The directory is the plugin's identity, so an unparseable manifest
145
+ // costs its presentation and not its existence.
146
+ const dir = writePlugin("courier", { ingress: INGRESS });
147
+ writeFileSync(join(dir, "package.json"), "{ not json");
148
+
149
+ expect((await discoverPluginChannels())[0]?.label).toBe("Courier");
150
+ });
151
+
152
+ test("never claims a plugin channel supports verification", async () => {
153
+ // There is no client-side verification flow for one, so clients render it
154
+ // display-only rather than pre-warming a status that cannot arrive.
155
+ writePlugin("courier", { ingress: INGRESS });
156
+
157
+ expect((await discoverPluginChannels())[0]?.supportsVerification).toBe(
158
+ false,
159
+ );
160
+ });
161
+ });
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Channels that installed plugins bring.
3
+ *
4
+ * A plugin is a channel because it declares ingress: `channels/ingress.json`
5
+ * is the list of routes the outside world may reach it on, and reaching the
6
+ * assistant from outside is what being a channel means. There is no second
7
+ * file saying so, and nothing a plugin can set to claim the status without
8
+ * declaring the reach that constitutes it.
9
+ *
10
+ * What the gateway does with that file is a separate matter, and stays the
11
+ * gateway's: validating the routes, digesting them, holding them behind a
12
+ * guardian's approval. This reads its presence and nothing else, so a
13
+ * declaration the gateway rejects still surfaces here. That is the honest
14
+ * report, the plugin is a channel and its ingress is broken, and it keeps a
15
+ * schema this module does not own from deciding what a settings page lists.
16
+ *
17
+ * Presentation comes from the plugin's own manifest, where a plugin's title,
18
+ * description and icon already belong. All three are optional and none gate
19
+ * anything: a plugin with ingress and a bare `package.json` still appears,
20
+ * titled from its directory.
21
+ */
22
+
23
+ import { statSync } from "node:fs";
24
+ import { join } from "node:path";
25
+
26
+ import { isPluginDisabled } from "../plugins/disabled-state.js";
27
+ import { parsePluginPresentation } from "../plugins/external-plugin-loader.js";
28
+ import { listInstalledPluginDirs } from "../plugins/installed-plugin-dirs.js";
29
+ import { type AvailableChannel, isChannelId } from "./types.js";
30
+
31
+ /**
32
+ * The declaration that makes a plugin a channel. Owned by the gateway, which
33
+ * parses it; named here only to test for it.
34
+ */
35
+ export const PLUGIN_INGRESS_MANIFEST_RELPATH = "channels/ingress.json";
36
+
37
+ /** Icon for a plugin naming none. The generic "a message arrives here" glyph. */
38
+ const FALLBACK_ICON = "message-square";
39
+
40
+ /**
41
+ * Title for a plugin with no `displayName`.
42
+ *
43
+ * Derived rather than defaulted to the raw directory name so `meeting-bot`
44
+ * reads as "Meeting Bot" beside "Slack" and "Telegram". A plugin whose casing
45
+ * matters sets `displayName` and this never runs.
46
+ */
47
+ function titleFromDirectory(name: string): string {
48
+ return name
49
+ .split(/[-_]/)
50
+ .filter((part) => part.length > 0)
51
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
52
+ .join(" ");
53
+ }
54
+
55
+ /** True when the plugin declares ingress routes. */
56
+ function declaresIngress(pluginDir: string): boolean {
57
+ return (
58
+ statSync(join(pluginDir, PLUGIN_INGRESS_MANIFEST_RELPATH), {
59
+ throwIfNoEntry: false,
60
+ })?.isFile() === true
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Every channel brought by an installed, enabled plugin.
66
+ *
67
+ * A plugin whose directory name is one of the assistant's own channels is
68
+ * skipped: two rows sharing an id would be ambiguous to any client keying on
69
+ * one, and the resolution that lets a plugin win would let it impersonate a
70
+ * built-in channel. The assistant's keep the name.
71
+ *
72
+ * Disabled plugins are skipped too, matching the source of truth the loader
73
+ * uses for hooks, tools and routes: a disabled plugin holds no ingress either,
74
+ * and one that reappeared here would offer a setup flow that cannot run.
75
+ *
76
+ * Order follows the plugins directory, and is stable for a stable install set.
77
+ */
78
+ export async function discoverPluginChannels(): Promise<AvailableChannel[]> {
79
+ const channels: AvailableChannel[] = [];
80
+
81
+ for (const { name, dir } of listInstalledPluginDirs()) {
82
+ if (isPluginDisabled(name) || isChannelId(name) || !declaresIngress(dir)) {
83
+ continue;
84
+ }
85
+ const presentation = await parsePluginPresentation(dir);
86
+ const label = presentation?.displayName ?? titleFromDirectory(name);
87
+ channels.push({
88
+ id: name,
89
+ source: `plugin:${name}`,
90
+ label,
91
+ subtitle: presentation?.description ?? `Provided by the ${label} plugin`,
92
+ icon: presentation?.icon ?? FALLBACK_ICON,
93
+ // No client-side verification flow exists for a plugin channel, so
94
+ // clients render it display-only and never pre-warm a status for it.
95
+ supportsVerification: false,
96
+ // Openers for a setup conversation, which is what this field is for.
97
+ // Deliberately not the verification copy the built-ins carry: there is
98
+ // no identity to verify here, and inventing that wording would send
99
+ // someone down a flow that does not exist.
100
+ setupMessages: {
101
+ guardian: `I want to set up ${label}. Can you help me?`,
102
+ contact: `I'd like to reach you on ${label}. Can you help me get set up?`,
103
+ },
104
+ });
105
+ }
106
+
107
+ return channels;
108
+ }
@@ -51,6 +51,32 @@ export interface ChannelInfo {
51
51
  };
52
52
  }
53
53
 
54
+ /**
55
+ * Source that contributes a channel, in the `<kind>[:<id>]` form the tool
56
+ * catalog and process tree already use: `default` for one the assistant ships,
57
+ * `plugin:<name>` for one an installed plugin brings.
58
+ *
59
+ * Composed from the plugin's install directory rather than from anything it
60
+ * declares, so a manifest cannot claim to be another source or pass itself off
61
+ * as built in.
62
+ */
63
+ export type ChannelSource = "default" | `plugin:${string}`;
64
+
65
+ /**
66
+ * A channel as `/v1/channels/available` reports it: the display metadata plus
67
+ * where it came from.
68
+ *
69
+ * `id` widens to a string here because a plugin channel's id is its plugin
70
+ * name, which is not a member of the closed {@link ChannelId} union. The union
71
+ * still governs everything the assistant routes, verifies and applies
72
+ * admission policy to; `source` is what tells a client which kind it is
73
+ * holding, so nothing has to infer it from the id.
74
+ */
75
+ export interface AvailableChannel extends Omit<ChannelInfo, "id"> {
76
+ id: string;
77
+ source: ChannelSource;
78
+ }
79
+
54
80
  /**
55
81
  * Per-channel display metadata for the channels the gateway can currently
56
82
  * surface to clients. Add an entry here when surfacing a new channel via
@@ -293,8 +293,8 @@ encrypted vault with the specified metadata.
293
293
  Requires the assistant to be running with at least one connected client.
294
294
 
295
295
  This command BLOCKS until the user answers the prompt, so it returns only once
296
- the prompt has already closed. Tell the user what to paste BEFORE running it —
297
- anything said afterwards reaches them after the input is gone, and pointing
296
+ the prompt has already closed. Tell the user what to paste BEFORE running it.
297
+ Anything said afterwards reaches them after the input is gone, and pointing
298
298
  them at a closed prompt makes them re-submit a value that was already received.
299
299
  The --label and --description text renders inside the prompt itself, so put the
300
300
  instructions there rather than in a follow-up message.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: acp
3
- description: Spawn external coding agents via the Agent Client Protocol (ACP)
3
+ description: Set up, authenticate, and run external coding agents (Claude Code, Codex) via the Agent Client Protocol
4
4
  compatibility: "Designed for Vellum personal assistants"
5
5
  metadata:
6
6
  emoji: "🔗"
@@ -8,13 +8,12 @@ metadata:
8
8
  display-name: "ACP"
9
9
  category: "development"
10
10
  activation-hints:
11
- - "User asks to use Claude Code or Codex to do something"
12
- - "User wants to delegate a coding task to Claude Code, Codex, or another ACP agent"
13
- - "User wants to hand a coding task to another agent and check on it later"
14
- - "User wants to spawn an external coding agent that runs autonomously and streams results back"
15
- - "User mentions ACP, claude-agent-acp, codex-acp, or running multiple coding agents in parallel"
11
+ - "User wants to set up, install, configure, authenticate, or connect Claude Code or Codex"
12
+ - "User asks to use Claude Code or Codex, or delegate a coding task to an ACP agent"
13
+ - "User wants an agent to work autonomously and report back later"
14
+ - "User mentions ACP, claude-agent-acp, or codex-acp"
16
15
  avoid-when:
17
- - "Task is small enough to do inline with the assistant's own tools - no need for an external agent"
16
+ - "The task is small enough to do inline"
18
17
  ---
19
18
 
20
19
  ACP agent orchestration - spawn external coding agents (Claude Code, Codex) to work on tasks via the Agent Client Protocol. Each agent runs as its own subprocess speaking ACP over stdio and streams results back into the conversation.
@@ -22,6 +22,13 @@ export interface SkillCapabilityInput {
22
22
  */
23
23
  export const ALWAYS_CANDIDATE_CARD_CHARS = 900;
24
24
 
25
+ /**
26
+ * Character budget for an ordinary skill's capability statement. A statement
27
+ * that overruns is hard-truncated, dropping its trailing activation hints and
28
+ * its entire avoid-when list from what the selector sees.
29
+ */
30
+ export const DEFAULT_CARD_CHARS = 500;
31
+
25
32
  /**
26
33
  * Render the prose-style capability statement embedded into the unified
27
34
  * `memory_v2_concept_pages` Qdrant collection (under the `skills/<id>` slug
@@ -32,7 +39,7 @@ export const ALWAYS_CANDIDATE_CARD_CHARS = 900;
32
39
  */
33
40
  export function buildSkillContent(
34
41
  input: SkillCapabilityInput,
35
- maxChars = 500,
42
+ maxChars: number = DEFAULT_CARD_CHARS,
36
43
  ): string {
37
44
  const list = maxChars > 500;
38
45
  let content = `The "${input.displayName}" skill (${input.id}) is available. ${input.description}.`;
@@ -92,6 +92,12 @@ const PluginPackageJsonSchema = z
92
92
  version: z.string().optional(),
93
93
  peerDependencies: z.record(z.string(), z.string()).optional(),
94
94
  credentialKeyPatterns: z.unknown().optional(),
95
+ /** Human title, when the package name is not one ("@vellumai/imessage"). */
96
+ displayName: z.string().min(1).optional(),
97
+ /** Standard npm field, reused as the one-line description clients show. */
98
+ description: z.string().min(1).optional(),
99
+ /** Lucide icon name without the `lucide-` prefix, matching `ChannelInfo`. */
100
+ icon: z.string().min(1).optional(),
95
101
  })
96
102
  .passthrough();
97
103
 
@@ -466,6 +472,47 @@ export async function loadExternalPlugin(
466
472
  * surface the failure through their own channel (e.g. the schedule
467
473
  * reconciler's per-day deduped notification).
468
474
  */
475
+ /**
476
+ * How a plugin presents itself: its title, its one line, its glyph.
477
+ *
478
+ * Every field is optional and none of them gate anything. A surface that
479
+ * shows a plugin falls back rather than hiding it, so a missing `icon`
480
+ * costs an icon and not the row.
481
+ */
482
+ export interface PluginPresentation {
483
+ displayName?: string;
484
+ description?: string;
485
+ icon?: string;
486
+ }
487
+
488
+ /**
489
+ * Read a plugin's presentation fields from its manifest.
490
+ *
491
+ * Separate from {@link parsePluginManifest} because the two answer different
492
+ * questions: that one decides whether a plugin is loadable, this one only
493
+ * dresses it for display. An unreadable or invalid manifest yields `undefined`
494
+ * here rather than an error, since a caller showing a plugin has already
495
+ * established it exists.
496
+ */
497
+ export async function parsePluginPresentation(
498
+ pluginDir: string,
499
+ ): Promise<PluginPresentation | undefined> {
500
+ let rawPkg: unknown;
501
+ try {
502
+ rawPkg = JSON.parse(
503
+ await readFile(join(pluginDir, "package.json"), "utf8"),
504
+ );
505
+ } catch {
506
+ return undefined;
507
+ }
508
+ const parsed = PluginPackageJsonSchema.safeParse(rawPkg);
509
+ if (!parsed.success) {
510
+ return undefined;
511
+ }
512
+ const { displayName, description, icon } = parsed.data;
513
+ return { displayName, description, icon };
514
+ }
515
+
469
516
  export async function parsePluginManifest(
470
517
  pluginDir: string,
471
518
  opts: { quiet?: boolean } = {},
@@ -4,11 +4,11 @@
4
4
  * GET /v1/channels/available — return the channels this assistant can
5
5
  * surface to clients (Contacts / GuardianChannels views, etc.) along with
6
6
  * their display metadata (label, subtitle, icon, verification capability,
7
- * setup-message copy). Today this is a fixed base list plus `email` when
8
- * an inbox is registered; eventually the list will be driven by
9
- * plugins/skills the assistant has loaded. Clients should treat the
10
- * response as authoritative and stop carrying their own per-channel
11
- * switches.
7
+ * setup-message copy). A fixed base list, plus `email` when an inbox is
8
+ * registered, plus the channels installed plugins bring by declaring
9
+ * ingress. One list, because a plugin channel is a channel; each row's
10
+ * `source` says who contributes it. Clients should treat the response as
11
+ * authoritative and stop carrying their own per-channel switches.
12
12
  *
13
13
  * Distinct from `/v1/channels/readiness` (which answers "is this channel
14
14
  * configured and working?"). Availability answers "could this channel be
@@ -18,8 +18,9 @@
18
18
  import { z } from "zod";
19
19
 
20
20
  import { isA2AEnabled } from "../../a2a/feature-gate.js";
21
+ import { discoverPluginChannels } from "../../channels/plugin-channel-declarations.js";
21
22
  import {
22
- CHANNEL_IDS,
23
+ type AvailableChannel,
23
24
  CHANNEL_METADATA,
24
25
  type ChannelId,
25
26
  type ChannelInfo,
@@ -73,7 +74,7 @@ async function hasRegisteredInbox(): Promise<boolean> {
73
74
 
74
75
  async function handleGetChannelAvailability(
75
76
  _args: RouteHandlerArgs,
76
- ): Promise<{ channels: ChannelInfo[] }> {
77
+ ): Promise<{ channels: AvailableChannel[] }> {
77
78
  const ids: ChannelId[] = [...BASE_AVAILABLE_CHANNELS];
78
79
  if (await hasRegisteredInbox()) {
79
80
  ids.push("email");
@@ -86,14 +87,26 @@ async function handleGetChannelAvailability(
86
87
  // contains channels that BASE_AVAILABLE_CHANNELS / the email branch
87
88
  // explicitly chose, so the lookup is always defined — filter to satisfy
88
89
  // the type system without a non-null assertion.
89
- const channels = ids
90
+ const builtIn: AvailableChannel[] = ids
90
91
  .map((id) => CHANNEL_METADATA[id])
91
- .filter((info): info is ChannelInfo => info !== undefined);
92
- return { channels };
92
+ .filter((info): info is ChannelInfo => info !== undefined)
93
+ .map((info) => ({ ...info, source: "default" as const }));
94
+ // One list, because a plugin channel is a channel: what differs is who
95
+ // contributes it, which is what `source` says. Built-ins lead, so a client
96
+ // rendering in order gets a stable list that plugin installs append to.
97
+ return { channels: [...builtIn, ...(await discoverPluginChannels())] };
93
98
  }
94
99
 
95
100
  const channelInfoSchema = z.object({
96
- id: z.enum(CHANNEL_IDS),
101
+ // A string rather than the channel enum: a plugin channel's id is its
102
+ // plugin name, and `source` is what says which kind a row is.
103
+ id: z.string(),
104
+ source: z
105
+ .string()
106
+ .describe(
107
+ "`default` for a channel the assistant ships, `plugin:<name>` for one " +
108
+ "an installed plugin brings",
109
+ ),
97
110
  label: z.string(),
98
111
  subtitle: z.string(),
99
112
  icon: z.string(),
@@ -117,14 +130,19 @@ export const ROUTES: RouteDefinition[] = [
117
130
  description:
118
131
  "Return the channels this assistant can surface to clients, with " +
119
132
  "display metadata (label, icon, verification capability, setup " +
120
- "copy). Today this is a fixed base list plus `email` when an inbox " +
121
- "is registered; will become plugin/skill-driven in future.",
133
+ "copy). A fixed base list plus `email` when an inbox is registered, " +
134
+ "plus the channels installed plugins bring by declaring ingress " +
135
+ "routes. Each carries a `source` saying which of those it is.",
122
136
  tags: ["channels"],
123
137
  handler: handleGetChannelAvailability,
124
138
  responseBody: z.object({
125
139
  channels: z
126
140
  .array(channelInfoSchema)
127
- .describe("Available channels in display order"),
141
+ .describe(
142
+ "Available channels in display order: the ones the assistant " +
143
+ "ships, then the ones installed plugins bring by declaring " +
144
+ "ingress routes. `source` distinguishes them.",
145
+ ),
128
146
  }),
129
147
  },
130
148
  ];
@@ -55,14 +55,11 @@ const CredentialPromptParams = z.object({
55
55
  *
56
56
  * The prompt blocks until the user answers, so by the time a caller reads the
57
57
  * result the secure input is already gone from the UI. A bare `ok: true` reads
58
- * as "the prompt opened successfully", which leads a model to follow up with
59
- * "the prompt is open, paste your value there" — pointing the user at a surface
60
- * that has already closed. The user, having just submitted, re-answers a prompt
61
- * that never reappears, and the flow loops. State the close explicitly so the
62
- * only available reading is the correct one.
58
+ * as "the prompt opened successfully", which invites a follow-up telling the
59
+ * user to paste into a surface that has already closed. Stating the close
60
+ * leaves only the correct reading.
63
61
  */
64
- const PROMPT_CLOSED_NOTICE =
65
- "The secure prompt has closed — do not ask the user to enter this value again.";
62
+ const PROMPT_CLOSED_NOTICE = "The secure prompt has closed.";
66
63
 
67
64
  export type CredentialPromptResult = {
68
65
  ok: boolean;