pi-roundtable 0.44.0 → 0.45.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/docs/plugins.md +36 -2
  3. package/package.json +2 -2
  4. package/src/core/agents/agent-claim.ts +15 -21
  5. package/src/core/agents/agent-messages.ts +10 -10
  6. package/src/core/agents/agent-prompt.ts +7 -8
  7. package/src/core/agents/agent-rules.ts +9 -2
  8. package/src/core/agents/agent-store.ts +16 -0
  9. package/src/core/agents/agent-team-fake-channels.ts +105 -0
  10. package/src/core/agents/agent-team-fixture.ts +30 -105
  11. package/src/core/agents/agent-team.ts +20 -21
  12. package/src/core/agents/group-turns.ts +8 -15
  13. package/src/core/agents/helper-modes.ts +7 -13
  14. package/src/core/agents/helper-work.ts +7 -6
  15. package/src/core/agents/message-target.ts +24 -12
  16. package/src/core/agents/room-progress.ts +8 -6
  17. package/src/core/agents/routes.ts +24 -47
  18. package/src/core/agents/team-editing.ts +5 -8
  19. package/src/core/agents/team-keys.ts +5 -190
  20. package/src/core/agents/team-lifecycle.ts +23 -39
  21. package/src/core/agents/team-options.ts +1 -1
  22. package/src/core/agents/team-places.ts +335 -0
  23. package/src/core/agents/team-posts.ts +157 -0
  24. package/src/core/agents/team-prompt.ts +3 -3
  25. package/src/core/agents/team-status.ts +18 -10
  26. package/src/core/agents/team-turn-types.ts +5 -8
  27. package/src/core/agents/team-turns.ts +26 -169
  28. package/src/core/builtin/agent-server-test-kit.ts +29 -0
  29. package/src/core/builtin/agent-server.ts +19 -12
  30. package/src/core/builtin/discord.ts +6 -0
  31. package/src/core/contract/places.ts +141 -0
  32. package/src/core/discord/agent-places.ts +215 -0
  33. package/src/core/discord/discord-surface.ts +13 -0
  34. package/src/core/host/define-roundtable.ts +1 -0
  35. package/src/core/plugin-api/agent-assets.ts +36 -0
  36. package/src/core/plugin-api/plugin-context.ts +30 -0
  37. package/src/core/plugin-api/plugin.ts +10 -28
  38. package/src/core/plugin-api/services.ts +20 -39
  39. package/src/core/registry/claims.ts +120 -0
  40. package/src/core/registry/contributions.ts +36 -118
  41. package/src/core/registry/place-port.ts +94 -0
  42. package/src/core/registry/places.ts +43 -0
  43. package/src/core/testing/fake-pager-places.ts +120 -0
  44. package/src/core/testing/fake-room-surface.ts +60 -0
  45. package/src/core/testing/modules.ts +5 -5
  46. package/src/core/testing/place-contract.ts +481 -0
  47. package/src/core/testing/team-places.ts +121 -0
  48. package/src/core/testing/test-host.ts +36 -10
  49. package/src/discord/index.ts +2 -0
  50. package/src/index.ts +12 -0
  51. package/src/testing.ts +15 -3
package/src/index.ts CHANGED
@@ -35,6 +35,7 @@ export {
35
35
  export type {
36
36
  AgentStatus as TeamAgentStatus,
37
37
  GroupStatus,
38
+ TeamPlace,
38
39
  TeamStatus,
39
40
  } from "./core/agents/team-status.ts";
40
41
  export { MAX_ATTACHMENT_BYTES } from "./core/attachments/attachment-fetcher.ts";
@@ -114,6 +115,17 @@ export type {
114
115
  } from "./core/contract/channels.ts";
115
116
  export { QUEUED_MARK, STEERED_MARK } from "./core/contract/channels.ts";
116
117
  export type { ChatCommand } from "./core/contract/chat-command.ts";
118
+ export type {
119
+ PlaceAuthor,
120
+ PlaceCheck,
121
+ PlaceKind,
122
+ PlacePort,
123
+ PlacePost,
124
+ PlaceProvider,
125
+ PlaceRef,
126
+ PlaceSpec,
127
+ ToolArgument,
128
+ } from "./core/contract/places.ts";
117
129
  export type {
118
130
  ImageDrawer,
119
131
  Judge,
package/src/testing.ts CHANGED
@@ -25,7 +25,6 @@ import type {
25
25
  Contribution,
26
26
  HostEnv,
27
27
  LinkedSessions,
28
- PluginContext,
29
28
  RoundtablePlugin,
30
29
  TurnEndEvent,
31
30
  TurnEvent,
@@ -40,6 +39,7 @@ import {
40
39
  RUNTIME,
41
40
  } from "./core/plugin-api/services.ts";
42
41
  import {
42
+ type ContributionBase,
43
43
  collectContributions,
44
44
  linkSessions,
45
45
  } from "./core/registry/contributions.ts";
@@ -68,6 +68,7 @@ import {
68
68
  callRegisteredTool,
69
69
  registeredTools,
70
70
  } from "./core/testing/run-tool.ts";
71
+ import { discordSpaceOf } from "./core/testing/team-places.ts";
71
72
  import type {
72
73
  RecordedEvent,
73
74
  TestPluginOptions,
@@ -100,6 +101,15 @@ export type { TestLocale } from "./core/testing/locale.ts";
100
101
  export { useTestLocale } from "./core/testing/locale.ts";
101
102
  export { OWNER_SPEAKER } from "./core/testing/owner.ts";
102
103
  export { partial } from "./core/testing/partial.ts";
104
+ export type {
105
+ PlaceContractFailure,
106
+ PlaceContractSubject,
107
+ PlaceSeen,
108
+ } from "./core/testing/place-contract.ts";
109
+ export {
110
+ checkPlaceProviderContract,
111
+ placeProviderContract,
112
+ } from "./core/testing/place-contract.ts";
103
113
  export type { UsePostgresOptions } from "./core/testing/postgres.ts";
104
114
  export { usePostgresForTests } from "./core/testing/postgres.ts";
105
115
  export type {
@@ -296,7 +306,7 @@ export async function testPlugin(
296
306
  );
297
307
  services.checkRequires();
298
308
  const attachmentDir = mkdtempSync(join(tmpdir(), "roundtable-test-plugin-"));
299
- const context: Omit<PluginContext, "services" | "directChannels"> = {
309
+ const context: ContributionBase = {
300
310
  logger,
301
311
  env,
302
312
  sessions: () => linked ?? unlinked("sessions"),
@@ -348,7 +358,9 @@ export async function testPlugin(
348
358
  ? [
349
359
  agentClaim({
350
360
  owner,
351
- discordGuild: memberOf(agentServer.team, "discordGuild"),
361
+ spaceOf: discordSpaceOf(
362
+ memberOf(agentServer.team, "discordGuild"),
363
+ ),
352
364
  // 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
365
  team: agentServer.team as never,
354
366
  runtime: {