pi-roundtable 0.47.2 → 0.48.0

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.
@@ -22,6 +22,7 @@ import type {
22
22
  } from "../discord/interaction-module.ts";
23
23
  import { commandGuard, ownerRootCommand } from "../discord/owner-command.ts";
24
24
  import type { DiscordPoster } from "../discord/poster/poster.ts";
25
+ import type { DiscordVoice } from "../discord/voice/voice.ts";
25
26
  import type {
26
27
  AgentTurnScope,
27
28
  ChannelKey,
@@ -72,6 +73,8 @@ export interface TestHostOptions {
72
73
  > & {
73
74
  /** What `DISCORD.poster` is; by default a `fakeDiscordPoster()`. */
74
75
  poster?: DiscordPoster;
76
+ /** What `DISCORD.voice` is, such as a `fakeDiscordVoice()`; by default none, as with `discord.voice` off. */
77
+ voice?: DiscordVoice;
75
78
  });
76
79
  }
77
80
 
@@ -202,7 +205,7 @@ export function standInDiscord(
202
205
  replaces: [DISCORD],
203
206
  setup: ({ services, dashboard }) => {
204
207
  const identity = services.find(IDENTITY);
205
- const { poster, ...overrides } = given ?? {};
208
+ const { poster, voice, ...overrides } = given ?? {};
206
209
  const ownerChannel =
207
210
  overrides.ownerChannel ?? (async () => "discord:owner-dm" as const);
208
211
  // Each person's direct messages, as the Discord plugin's provider reaches them; the owner's is the owner channel.
@@ -229,6 +232,7 @@ export function standInDiscord(
229
232
  threads: { open: async () => undefined, sweep: async () => undefined },
230
233
  poster: poster ?? fakeDiscordPoster(),
231
234
  channelContext,
235
+ ...(voice ? { voice } : {}),
232
236
  } as unknown as DiscordServices);
233
237
  // Discord's side of the agent guild, as the built-in plugin contributes it with one, over a board that shows nothing.
234
238
  const guild = agentGuild
@@ -118,5 +118,19 @@ export {
118
118
  DiscordPosterError,
119
119
  ROLE_LIMITS,
120
120
  } from "../core/discord/poster/poster.ts";
121
+ export type {
122
+ DiscordVoice,
123
+ VoiceDisconnectEvent,
124
+ VoiceDisconnectReason,
125
+ VoiceJoinFailure,
126
+ VoiceJoinOptions,
127
+ VoiceJoinResult,
128
+ VoiceMember,
129
+ VoiceMemberEvent,
130
+ VoiceSession,
131
+ VoiceSpeakingEvent,
132
+ VoiceUtterance,
133
+ } from "../core/discord/voice/voice.ts";
134
+ export { VOICE_PCM } from "../core/discord/voice/voice.ts";
121
135
  export type { OwnerOperations } from "../core/modules/discord-admin/discord-admin.ts";
122
136
  export { DISCORD_ADMIN_TOOLS } from "../core/modules/discord-admin/discord-admin.ts";
package/src/testing.ts CHANGED
@@ -26,9 +26,6 @@ import type {
26
26
  HostEnv,
27
27
  LinkedSessions,
28
28
  RoundtablePlugin,
29
- TurnEndEvent,
30
- TurnEvent,
31
- TurnProgressEvent,
32
29
  } from "./core/plugin-api/plugin.ts";
33
30
  import {
34
31
  AGENTS,
@@ -61,6 +58,7 @@ import { memberOf } from "./core/testing/partial.ts";
61
58
  import {
62
59
  memoryHeldActions,
63
60
  partialService,
61
+ recordedSink,
64
62
  routedConversations,
65
63
  unlinked,
66
64
  } from "./core/testing/plugin-stand-ins.ts";
@@ -97,6 +95,11 @@ export type {
97
95
  FakeRoleChange,
98
96
  } from "./core/testing/fake-poster.ts";
99
97
  export { fakeDiscordPoster } from "./core/testing/fake-poster.ts";
98
+ export type {
99
+ FakeDiscordVoice,
100
+ FakeVoiceChannel,
101
+ } from "./core/testing/fake-voice.ts";
102
+ export { fakeDiscordVoice } from "./core/testing/fake-voice.ts";
100
103
  export type { TestLocale } from "./core/testing/locale.ts";
101
104
  export { useTestLocale } from "./core/testing/locale.ts";
102
105
  export { OWNER_SPEAKER } from "./core/testing/owner.ts";
@@ -190,22 +193,7 @@ export async function testPlugin(
190
193
  : unlinked("surfaces"),
191
194
  );
192
195
  const observers = new MessageObservers(logger, () => surfaces.roomSurfaces());
193
- const sink = {
194
- turnStarted: (turn: TurnEvent) => {
195
- events.push({ name: "turnStarted", turn });
196
- bus.sink.turnStarted(turn);
197
- },
198
- turnEnded: (turn: TurnEndEvent) => {
199
- events.push({ name: "turnEnded", turn });
200
- bus.sink.turnEnded(turn);
201
- },
202
- // Delivered to the plugin's handlers, not recorded: a turn reports many.
203
- turnProgress: (event: TurnProgressEvent) => bus.sink.turnProgress?.(event),
204
- changed: () => {
205
- events.push({ name: "changed" });
206
- bus.sink.changed();
207
- },
208
- };
196
+ const sink = recordedSink(events, bus.sink);
209
197
  const turns: ConversationTurns =
210
198
  options.turns ??
211
199
  conversationTurns({