pi-roundtable 0.42.0 → 0.44.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.
- package/CHANGELOG.md +35 -0
- package/README.md +1 -0
- package/README.zh-TW.md +1 -0
- package/docs/plugins.md +3 -1
- package/package.json +3 -1
- package/src/characters/catalog.ts +7 -750
- package/src/characters/class-data.ts +56 -0
- package/src/characters/classes-a.ts +235 -0
- package/src/characters/classes-b.ts +242 -0
- package/src/characters/classes-c.ts +241 -0
- package/src/core/agents/agent-claim.ts +6 -2
- package/src/core/agents/agent-group-store.ts +176 -0
- package/src/core/agents/agent-places.ts +197 -0
- package/src/core/agents/agent-schema.ts +37 -3
- package/src/core/agents/agent-statements.ts +14 -12
- package/src/core/agents/agent-store.ts +81 -211
- package/src/core/agents/agent-team-fixture.ts +9 -3
- package/src/core/agents/agent-team.ts +6 -8
- package/src/core/agents/routes.ts +24 -7
- package/src/core/agents/team-options.ts +2 -0
- package/src/core/builtin/agent-server-options.ts +101 -0
- package/src/core/builtin/agent-server.ts +35 -94
- package/src/core/config/config-schema.ts +3 -1
- package/src/core/config/config.ts +5 -0
- package/src/core/config/team.ts +30 -0
- package/src/core/contract/channels.ts +8 -0
- package/src/core/db/legacy-channels.ts +92 -0
- package/src/core/db/team-move.ts +138 -0
- package/src/core/host/define-roundtable.ts +10 -2
- package/src/core/host/drain.ts +46 -0
- package/src/core/host/host.ts +25 -8
- package/src/core/plugin-api/plugin.ts +6 -3
- package/src/core/plugin-api/services.ts +4 -5
- package/src/core/presentation/diagram-text.ts +17 -8
- package/src/core/routing/channel-queue.ts +36 -3
- package/src/core/testing/fake-discord.ts +67 -0
- package/src/core/testing/partial.ts +8 -0
- package/src/core/testing/plugin-stand-ins.ts +95 -0
- package/src/core/testing/service-pair.ts +18 -0
- package/src/core/testing/test-plugin-types.ts +110 -0
- package/src/testing.ts +36 -276
package/src/testing.ts
CHANGED
|
@@ -1,54 +1,26 @@
|
|
|
1
1
|
import { mkdtempSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import type { SQL } from "bun";
|
|
5
4
|
import { CATALOG } from "./characters/index.ts";
|
|
6
5
|
import { agentClaim } from "./core/agents/agent-claim.ts";
|
|
7
6
|
import { ownerAttachmentDir } from "./core/attachments/attachment-dir.ts";
|
|
8
7
|
import { attachmentPort } from "./core/attachments/attachment-port.ts";
|
|
9
8
|
import { DISCORD, type DiscordServices } from "./core/builtin/discord.ts";
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
ConversationPort,
|
|
13
|
-
InboundMessage,
|
|
14
|
-
} from "./core/contract/channels.ts";
|
|
9
|
+
import type { InboundMessage } from "./core/contract/channels.ts";
|
|
15
10
|
import type { Providers } from "./core/contract/providers.ts";
|
|
16
|
-
import type {
|
|
17
|
-
AgentRuntime,
|
|
18
|
-
HeldActionStore,
|
|
19
|
-
RuntimeDeps,
|
|
20
|
-
} from "./core/contract/runtime.ts";
|
|
21
|
-
import type { ServiceKey } from "./core/contract/services.ts";
|
|
22
|
-
import type { ChatSurface, SurfacePort } from "./core/contract/surface.ts";
|
|
23
|
-
import { CommandCollection } from "./core/discord/command-collection.ts";
|
|
24
|
-
import type { ComposedCommands } from "./core/discord/compose-commands.ts";
|
|
25
|
-
import type {
|
|
26
|
-
CommandGuard,
|
|
27
|
-
CommandRegistrar,
|
|
28
|
-
InteractionContribution,
|
|
29
|
-
} from "./core/discord/interaction-module.ts";
|
|
30
|
-
import {
|
|
31
|
-
commandGuard,
|
|
32
|
-
ownerRootCommand,
|
|
33
|
-
} from "./core/discord/owner-command.ts";
|
|
34
|
-
import type { DiscordPoster } from "./core/discord/poster/poster.ts";
|
|
11
|
+
import type { AgentRuntime, RuntimeDeps } from "./core/contract/runtime.ts";
|
|
35
12
|
import { supportOf } from "./core/domain/block-support.ts";
|
|
36
|
-
import type { ClientPart
|
|
37
|
-
import type {
|
|
38
|
-
PendingConfirmation,
|
|
39
|
-
ReplyFile,
|
|
40
|
-
} from "./core/domain/conversation.ts";
|
|
13
|
+
import type { ClientPart } from "./core/domain/client.ts";
|
|
14
|
+
import type { ReplyFile } from "./core/domain/conversation.ts";
|
|
41
15
|
import type { ChannelKey, SessionContext } from "./core/domain/sessions.ts";
|
|
42
16
|
import { EventBus } from "./core/host/events.ts";
|
|
43
|
-
import {
|
|
17
|
+
import { listenerAddress } from "./core/http/listeners.ts";
|
|
44
18
|
import { contactsOf } from "./core/identity/identity-view.ts";
|
|
45
|
-
import
|
|
46
|
-
import { type Speaker, THE_SPEAKER } from "./core/identity/speakers.ts";
|
|
19
|
+
import { THE_SPEAKER } from "./core/identity/speakers.ts";
|
|
47
20
|
import { ConfirmationJudge } from "./core/judging/confirmation-judge.ts";
|
|
48
|
-
import {
|
|
21
|
+
import { PluginError } from "./core/kernel/errors.ts";
|
|
49
22
|
import { silentLogger } from "./core/kernel/log.ts";
|
|
50
23
|
import { ConversationBackgroundTurns } from "./core/modules/background/background-turns.ts";
|
|
51
|
-
import type { HoldCheck } from "./core/plugin-api/holds.ts";
|
|
52
24
|
import type {
|
|
53
25
|
Contribution,
|
|
54
26
|
HostEnv,
|
|
@@ -82,14 +54,25 @@ import {
|
|
|
82
54
|
import { MessageObservers } from "./core/routing/message-observers.ts";
|
|
83
55
|
import { PeerBots } from "./core/routing/peer-bots.ts";
|
|
84
56
|
import { surfacePort } from "./core/routing/surface-port.ts";
|
|
85
|
-
import {
|
|
57
|
+
import { toolTiers } from "./core/runtime/tool-tiers.ts";
|
|
86
58
|
import { PERSONAL_TARGET } from "./core/shared/personal-target.ts";
|
|
87
|
-
import { fakeDiscordPoster } from "./core/testing/fake-poster.ts";
|
|
88
59
|
import { mapIdentity } from "./core/testing/map-identity.ts";
|
|
60
|
+
import { memberOf } from "./core/testing/partial.ts";
|
|
61
|
+
import {
|
|
62
|
+
memoryHeldActions,
|
|
63
|
+
partialService,
|
|
64
|
+
routedConversations,
|
|
65
|
+
unlinked,
|
|
66
|
+
} from "./core/testing/plugin-stand-ins.ts";
|
|
89
67
|
import {
|
|
90
68
|
callRegisteredTool,
|
|
91
69
|
registeredTools,
|
|
92
70
|
} from "./core/testing/run-tool.ts";
|
|
71
|
+
import type {
|
|
72
|
+
RecordedEvent,
|
|
73
|
+
TestPluginOptions,
|
|
74
|
+
TestPluginResult,
|
|
75
|
+
} from "./core/testing/test-plugin-types.ts";
|
|
93
76
|
|
|
94
77
|
// Fixtures for plugin tests.
|
|
95
78
|
|
|
@@ -103,6 +86,8 @@ export {
|
|
|
103
86
|
testDatabaseUrl,
|
|
104
87
|
} from "./core/testing/database.ts";
|
|
105
88
|
export { eagerText, useEagerCatalog } from "./core/testing/eager-catalog.ts";
|
|
89
|
+
export type { FakeDiscord } from "./core/testing/fake-discord.ts";
|
|
90
|
+
export { fakeDiscord } from "./core/testing/fake-discord.ts";
|
|
106
91
|
export type {
|
|
107
92
|
FakeDiscordPoster,
|
|
108
93
|
FakeForum,
|
|
@@ -133,6 +118,8 @@ export type {
|
|
|
133
118
|
RecordingLogger,
|
|
134
119
|
} from "./core/testing/recording-logger.ts";
|
|
135
120
|
export { recordingLogger } from "./core/testing/recording-logger.ts";
|
|
121
|
+
export type { ServicePair } from "./core/testing/service-pair.ts";
|
|
122
|
+
export { servicePair } from "./core/testing/service-pair.ts";
|
|
136
123
|
export type {
|
|
137
124
|
SurfaceContractAnswerer,
|
|
138
125
|
SurfaceContractFailure,
|
|
@@ -146,219 +133,14 @@ export {
|
|
|
146
133
|
} from "./core/testing/surface-contract.ts";
|
|
147
134
|
export type { TestHost, TestHostOptions } from "./core/testing/test-host.ts";
|
|
148
135
|
export { testHost } from "./core/testing/test-host.ts";
|
|
136
|
+
export type {
|
|
137
|
+
RecordedEvent,
|
|
138
|
+
TestPluginOptions,
|
|
139
|
+
TestPluginResult,
|
|
140
|
+
} from "./core/testing/test-plugin-types.ts";
|
|
149
141
|
export type { FakeThreadHost } from "./core/testing/thread-host.ts";
|
|
150
142
|
export { fakeThreads } from "./core/testing/thread-host.ts";
|
|
151
143
|
|
|
152
|
-
/**
|
|
153
|
-
* A service the plugin under test reads, with the members the test gives it, made by `servicePair(KEY,
|
|
154
|
-
* { ... })`. Reading a member the test did not give throws a PluginError that names it.
|
|
155
|
-
*/
|
|
156
|
-
export interface ServicePair {
|
|
157
|
-
readonly key: ServiceKey<unknown>;
|
|
158
|
-
readonly given: object;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/** Pairs a service key with the members the test gives it, for the `services` option of `testPlugin`. */
|
|
162
|
-
export function servicePair<T extends object>(
|
|
163
|
-
key: ServiceKey<T>,
|
|
164
|
-
given: Partial<T>,
|
|
165
|
-
): ServicePair {
|
|
166
|
-
return { key, given };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/** A stand-in for the Discord plugin's `DISCORD` service, made by `fakeDiscord()`. */
|
|
170
|
-
export interface FakeDiscord {
|
|
171
|
-
/** Give this to `testPlugin`'s `services` option: `{ services: [discord.service] }`. */
|
|
172
|
-
readonly service: ServicePair;
|
|
173
|
-
/** What `DISCORD.commands` is to the plugin: the real registrar, which refuses what the Discord plugin refuses. */
|
|
174
|
-
readonly commands: CommandRegistrar;
|
|
175
|
-
/** What `DISCORD.poster` is: the one the test gave, else a `fakeDiscordPoster()`. */
|
|
176
|
-
readonly poster: DiscordPoster;
|
|
177
|
-
/** What `DISCORD.guard` is: the owner, `owner` unless the test gave another id, serving the root command. */
|
|
178
|
-
readonly guard: CommandGuard;
|
|
179
|
-
/** Every contribution the plugin added, in the order it added them. */
|
|
180
|
-
added(): readonly InteractionContribution[];
|
|
181
|
-
/** The tree the Discord plugin would register, composed under the root command the fake was made with. */
|
|
182
|
-
compose(): ComposedCommands;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* A `DISCORD` service for a plugin that adds slash commands, without a Discord connection: the
|
|
187
|
-
* plugin's `commands.add` calls are recorded, and `compose()` shows the tree Discord would get.
|
|
188
|
-
* `rootCommand` is the root command's name, `roundtable` by default. `channelContext` is what
|
|
189
|
-
* `DISCORD.channelContext` answers, by default no context, as on a host with it off. Only
|
|
190
|
-
* `commands`, `guard`, `poster`, and `channelContext` are given; reading another member throws.
|
|
191
|
-
*/
|
|
192
|
-
export function fakeDiscord(
|
|
193
|
-
options: {
|
|
194
|
-
ownerId?: string;
|
|
195
|
-
rootCommand?: string;
|
|
196
|
-
channelContext?: DiscordServices["channelContext"];
|
|
197
|
-
poster?: DiscordPoster;
|
|
198
|
-
} = {},
|
|
199
|
-
): FakeDiscord {
|
|
200
|
-
const collection = new CommandCollection();
|
|
201
|
-
const { rootCommand = "roundtable" } = options;
|
|
202
|
-
const guard = commandGuard({
|
|
203
|
-
ownerId: options.ownerId ?? "owner",
|
|
204
|
-
root: rootCommand,
|
|
205
|
-
logger: silentLogger(),
|
|
206
|
-
});
|
|
207
|
-
const poster = options.poster ?? fakeDiscordPoster();
|
|
208
|
-
return {
|
|
209
|
-
service: servicePair(DISCORD, {
|
|
210
|
-
commands: collection.registrar,
|
|
211
|
-
guard,
|
|
212
|
-
poster,
|
|
213
|
-
channelContext: options.channelContext ?? (async () => undefined),
|
|
214
|
-
}),
|
|
215
|
-
poster,
|
|
216
|
-
commands: collection.registrar,
|
|
217
|
-
guard,
|
|
218
|
-
added: () => collection.added(),
|
|
219
|
-
compose: () => collection.compose(ownerRootCommand(rootCommand)),
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export interface TestPluginOptions {
|
|
224
|
-
/** The host environment the plugin sees; default en and UTC. */
|
|
225
|
-
env?: Partial<HostEnv>;
|
|
226
|
-
/**
|
|
227
|
-
* The owner the runtime's dependencies and the agent server's claim know; default `owner`,
|
|
228
|
-
* named Owner, who is addressed as they.
|
|
229
|
-
*/
|
|
230
|
-
owner?: { id: string; name: string; pronouns?: OwnerIdentity["pronouns"] };
|
|
231
|
-
database?: SQL;
|
|
232
|
-
providers?: Partial<Providers>;
|
|
233
|
-
/**
|
|
234
|
-
* Chat surfaces besides the plugin's own, such as a fake one: they are in `context.surfaces`,
|
|
235
|
-
* started with the plugin's services (their messages reach `conversations`), and stopped last.
|
|
236
|
-
*/
|
|
237
|
-
surfaces?: readonly ChatSurface[];
|
|
238
|
-
/**
|
|
239
|
-
* What the plugin reads from `context.services`, one `servicePair(KEY, { ... })` per service.
|
|
240
|
-
* `servicePair(RUNTIME, runtime)` is the runtime that `context.turns` runs turns on, given
|
|
241
|
-
* whole rather than member by member; `servicePair(AGENTS, { runtime })` still works when no
|
|
242
|
-
* `RUNTIME` is given. Without either, a plugin that fills the `runtime` slot gets the runtime its
|
|
243
|
-
* provider builds, under both keys. A service
|
|
244
|
-
* not given here reads as absent to `find`, and `get` names this option, except for what the
|
|
245
|
-
* host supplies anyway: `BACKGROUND_TURNS`, the real background turns over the test's router,
|
|
246
|
-
* and, once `AGENTS` is given, its `approvals` (the real confirmation judge over
|
|
247
|
-
* `providers.judge`, when the test gives a judge). Giving `AGENTS` a `team` adds the agent
|
|
248
|
-
* server's own claim to the router, answering as the host's would for the `owner`. The router
|
|
249
|
-
* resolves who wrote each message through a given `IDENTITY`; without one only the `owner` is
|
|
250
|
-
* anyone, at the owner tier, their principal their id.
|
|
251
|
-
*/
|
|
252
|
-
services?: readonly ServicePair[];
|
|
253
|
-
/**
|
|
254
|
-
* The plugin's conversations: by default a router over the plugin's own `channels` claims, so a
|
|
255
|
-
* message a surface delivers reaches them. Methods given here replace the router's.
|
|
256
|
-
*/
|
|
257
|
-
conversations?: Partial<ConversationPort>;
|
|
258
|
-
/** Replaces `context.turns`, which by default runs turns over the runtime and the surfaces. */
|
|
259
|
-
turns?: ConversationTurns;
|
|
260
|
-
/** The credentials `context.apiKey` returns, by provider name; a provider not listed reads as having none, as on a host not logged in to it. */
|
|
261
|
-
apiKeys?: Readonly<Record<string, string>>;
|
|
262
|
-
/** How long the router holds a bare forward for the message that follows it; the host option `conversations.forwardJoinMs`. */
|
|
263
|
-
forwardJoinMs?: number;
|
|
264
|
-
/** The peer bots the router answers, as the host option `peerBots` (`discord.peerBots`); default none. */
|
|
265
|
-
peerBots?: PeerBotsConfig;
|
|
266
|
-
/** The addresses `context.listener(id)` reports; a plugin that reads one gets `undefined` for any not listed. */
|
|
267
|
-
listeners?: readonly ListenerConfig[];
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export interface RecordedEvent {
|
|
271
|
-
name: "turnStarted" | "turnEnded" | "changed";
|
|
272
|
-
turn?: TurnEvent | TurnEndEvent;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export interface TestPluginResult {
|
|
276
|
-
contribution: Contribution;
|
|
277
|
-
/** The hold rules the plugin contributed, chained as the host links them: the description of a call that must be approved first, or undefined. `holds.inTurn(tool, input, context, turn)` asks them as a turn does, so a hold that looks things up (and may return a promise) is called with the turn; the plain call has no turn, and counts a hold that declares `turn` as held under `run <tool>`. */
|
|
278
|
-
holds: HoldCheck;
|
|
279
|
-
/** What the plugin sees as `context.conversations`, for a test to drive its claims. */
|
|
280
|
-
conversations: ConversationPort;
|
|
281
|
-
/** What the plugin sees as `context.turns`. */
|
|
282
|
-
turns: ConversationTurns;
|
|
283
|
-
/** What the plugin sees as `context.surfaces`: its own surfaces and the injected ones. */
|
|
284
|
-
surfaces: SurfacePort;
|
|
285
|
-
/** The runtime the plugin's `runtime` provider built, given stand-in dependencies; undefined when it fills no such slot. */
|
|
286
|
-
runtime: AgentRuntime | undefined;
|
|
287
|
-
tools: readonly string[];
|
|
288
|
-
tiers: ToolTierTable;
|
|
289
|
-
events: RecordedEvent[];
|
|
290
|
-
/** Files accepted by successful runTool calls, copied and recorded with their channel. */
|
|
291
|
-
files: { channel: ChannelKey; file: ReplyFile }[];
|
|
292
|
-
/** Images returned by successful runTool calls, with their channel. */
|
|
293
|
-
images: { channel: ChannelKey; image: ClientPart }[];
|
|
294
|
-
runTool(
|
|
295
|
-
name: string,
|
|
296
|
-
args: Record<string, unknown>,
|
|
297
|
-
/** `workspace` gives the session a workspace and scratch dir, as an agent's session has. */
|
|
298
|
-
options?: {
|
|
299
|
-
speaker?: Speaker;
|
|
300
|
-
/** Where the turn's request came from, as `ToolTurn.origin` shows it to the tool. */
|
|
301
|
-
origin?: string;
|
|
302
|
-
/** What the party that started the turn can do for the tool, as `ToolTurn.client` shows it. */
|
|
303
|
-
client?: ClientPort;
|
|
304
|
-
channel?: ChannelKey;
|
|
305
|
-
workspace?: SessionContext["workspace"];
|
|
306
|
-
},
|
|
307
|
-
): Promise<string>;
|
|
308
|
-
stop(): Promise<void>;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/** The same pre-link failures and wording the host exposes during setup. */
|
|
312
|
-
const NOT_LINKED = {
|
|
313
|
-
conversations:
|
|
314
|
-
"conversations are linked once every plugin is set up. Use them from a service's start or from a handler, not during setup.",
|
|
315
|
-
sessions:
|
|
316
|
-
"session parts are linked once every plugin is set up. Call sessions() from a service's start or from a handler, not during setup.",
|
|
317
|
-
surfaces:
|
|
318
|
-
"chat surfaces are linked once every plugin is set up. Use surfaces from a service's start or from a handler, not during setup.",
|
|
319
|
-
turns:
|
|
320
|
-
"conversation turns are linked once every plugin is set up. Use turns from a service's start or from a handler, not during setup.",
|
|
321
|
-
dashboard:
|
|
322
|
-
"dashboard lines are linked once every plugin is set up. Call dashboard() from a service's start or from a handler, not during setup.",
|
|
323
|
-
chatCommands:
|
|
324
|
-
"chat commands are linked once every plugin is set up. Call chatCommands() from a service's start or from a handler, not during setup.",
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
function unlinked(part: keyof typeof NOT_LINKED): never {
|
|
328
|
-
throw new NotLinkedError(NOT_LINKED[part]);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/** Members a probe may ask of any object: a test's partial service is not refused for them. */
|
|
332
|
-
const PROBED = new Set(["then", "toJSON", "asymmetricMatch"]);
|
|
333
|
-
|
|
334
|
-
/** A service the test gave only some members of: reading another names the option that adds it. */
|
|
335
|
-
function partialService<T extends object>(
|
|
336
|
-
key: ServiceKey<unknown>,
|
|
337
|
-
given: T,
|
|
338
|
-
): T {
|
|
339
|
-
return new Proxy(given, {
|
|
340
|
-
get(target, member, receiver) {
|
|
341
|
-
if (member in target || typeof member === "symbol" || PROBED.has(member))
|
|
342
|
-
return Reflect.get(target, member, receiver);
|
|
343
|
-
throw new PluginError(
|
|
344
|
-
`testPlugin gave service ${key.id} no "${member}". Give it in the services option: testPlugin(plugin, { services: [servicePair(KEY, { ${member}: ... })] }).`,
|
|
345
|
-
);
|
|
346
|
-
},
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/** Held actions kept in memory, for the runtime a plugin's provider builds under test. */
|
|
351
|
-
function memoryHeldActions(): HeldActionStore {
|
|
352
|
-
const held = new Map<ChannelKey, PendingConfirmation>();
|
|
353
|
-
return {
|
|
354
|
-
load: async (conversation) => held.get(conversation),
|
|
355
|
-
save: async (conversation, actions) => {
|
|
356
|
-
if (actions) held.set(conversation, actions);
|
|
357
|
-
else held.delete(conversation);
|
|
358
|
-
},
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
|
|
362
144
|
/** Build one plugin without Discord or PostgreSQL, retaining the host's validation and tier logic. */
|
|
363
145
|
// pi-lens-ignore: high-complexity, large-function — one host's context and lifecycle, mirrored end to end
|
|
364
146
|
export async function testPlugin(
|
|
@@ -388,31 +170,10 @@ export async function testPlugin(
|
|
|
388
170
|
let linked: LinkedSessions | undefined;
|
|
389
171
|
let router: ChannelRouter | undefined;
|
|
390
172
|
const queue = new ChannelQueue();
|
|
391
|
-
const conversations
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
(router ?? unlinked("conversations")).messageDeleted(channel, id, space),
|
|
396
|
-
messageEdited: async (message) =>
|
|
397
|
-
(router ?? unlinked("conversations")).messageEdited(message),
|
|
398
|
-
background: async (turn) =>
|
|
399
|
-
(router ?? unlinked("conversations")).background(turn),
|
|
400
|
-
runsAs: async (turn) => (router ?? unlinked("conversations")).runsAs(turn),
|
|
401
|
-
target: (name) => (router ?? unlinked("conversations")).target(name),
|
|
402
|
-
startFresh: async (channel) =>
|
|
403
|
-
(router ?? unlinked("conversations")).startFresh(channel),
|
|
404
|
-
deleteConversation: async (channel) =>
|
|
405
|
-
(router ?? unlinked("conversations")).deleteConversation(channel),
|
|
406
|
-
stop: (channel) => (router ?? unlinked("conversations")).stop(channel),
|
|
407
|
-
postsInPlace: (channel) =>
|
|
408
|
-
(router ?? unlinked("conversations")).postsInPlace(channel),
|
|
409
|
-
owns: (channel) => (router ?? unlinked("conversations")).owns(channel),
|
|
410
|
-
takesBackground: (channel) =>
|
|
411
|
-
(router ?? unlinked("conversations")).takesBackground(channel),
|
|
412
|
-
takesSystemReports: (channel) =>
|
|
413
|
-
(router ?? unlinked("conversations")).takesSystemReports(channel),
|
|
414
|
-
...options.conversations,
|
|
415
|
-
};
|
|
173
|
+
const conversations = routedConversations(
|
|
174
|
+
() => router,
|
|
175
|
+
options.conversations,
|
|
176
|
+
);
|
|
416
177
|
const surfaces = surfacePort(() =>
|
|
417
178
|
linked
|
|
418
179
|
? [...registry.surfaces, ...(options.surfaces ?? [])]
|
|
@@ -587,10 +348,9 @@ export async function testPlugin(
|
|
|
587
348
|
? [
|
|
588
349
|
agentClaim({
|
|
589
350
|
owner,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
>[0]["team"],
|
|
351
|
+
discordGuild: memberOf(agentServer.team, "discordGuild"),
|
|
352
|
+
// SAFETY: the claim reads the concrete team's members (owns, answerOwner, answerGroup, answerBackground, startFresh), which a test that gives a team for it supplies.
|
|
353
|
+
team: agentServer.team as never,
|
|
594
354
|
runtime: {
|
|
595
355
|
steer: (...args) => services.get(AGENTS).runtime.steer(...args),
|
|
596
356
|
stop: (channel) => services.get(AGENTS).runtime.stop(channel),
|