pi-roundtable 0.33.0 → 0.35.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 (261) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -1
  3. package/README.zh-TW.md +1 -1
  4. package/docs/plugins.md +2 -2
  5. package/package.json +1 -2
  6. package/src/cli/checks/configuration.ts +2 -2
  7. package/src/cli/checks/database.ts +2 -2
  8. package/src/cli/checks/identity.ts +1 -1
  9. package/src/cli/checks/model.ts +1 -1
  10. package/src/cli/cli.ts +2 -2
  11. package/src/cli/principal.ts +1 -1
  12. package/src/cli/project.ts +2 -2
  13. package/src/cli/runtime.ts +3 -3
  14. package/src/cli/start.ts +1 -1
  15. package/src/core/agents/agent-claim.ts +4 -4
  16. package/src/core/agents/agent-dashboard.ts +3 -3
  17. package/src/core/agents/agent-messages.ts +2 -2
  18. package/src/core/agents/agent-outbox.ts +1 -1
  19. package/src/core/agents/agent-ports.ts +1 -1
  20. package/src/core/agents/agent-prompt.ts +4 -4
  21. package/src/core/agents/agent-rules.ts +1 -1
  22. package/src/core/agents/agent-schema.ts +4 -1
  23. package/src/core/agents/agent-settings.ts +2 -2
  24. package/src/core/agents/agent-store.ts +9 -9
  25. package/src/core/agents/agent-team-fixture.ts +4 -3
  26. package/src/core/agents/agent-team.ts +12 -16
  27. package/src/core/agents/agent-tools.ts +15 -15
  28. package/src/core/agents/avatar-refresh.ts +1 -1
  29. package/src/core/agents/avatar-studio.ts +2 -2
  30. package/src/core/agents/group-round.ts +2 -2
  31. package/src/core/agents/group-turns.ts +1 -1
  32. package/src/core/agents/helper-create.ts +24 -40
  33. package/src/core/agents/helper-modes.ts +2 -2
  34. package/src/core/agents/helper-preset-ops.ts +207 -0
  35. package/src/core/agents/helper-preset-tools.ts +109 -0
  36. package/src/core/agents/helper-presets.ts +128 -0
  37. package/src/core/agents/helper-test-kit.ts +1 -1
  38. package/src/core/agents/helper-tools.ts +42 -22
  39. package/src/core/agents/helper-work.ts +1 -1
  40. package/src/core/agents/message-target.ts +1 -1
  41. package/src/core/agents/routes.ts +1 -1
  42. package/src/core/agents/team-approval.ts +2 -2
  43. package/src/core/agents/team-editing.ts +2 -2
  44. package/src/core/agents/team-keys.ts +1 -1
  45. package/src/core/agents/team-layout.ts +1 -1
  46. package/src/core/agents/team-options.ts +4 -4
  47. package/src/core/agents/team-selection.ts +1 -1
  48. package/src/core/agents/team-status.ts +1 -1
  49. package/src/core/agents/team-text.ts +3 -3
  50. package/src/core/agents/team-turn-types.ts +7 -7
  51. package/src/core/agents/team-turns.ts +3 -3
  52. package/src/core/attachments/attachment-fetcher.ts +1 -1
  53. package/src/core/attachments/attachment-port.ts +2 -2
  54. package/src/core/attachments/attachment-retention.ts +3 -3
  55. package/src/core/attachments/attachment-store.ts +2 -2
  56. package/src/core/attachments/model-images.ts +1 -1
  57. package/src/core/attachments/turn-attachments.ts +1 -1
  58. package/src/core/builtin/agent-server.ts +17 -10
  59. package/src/core/builtin/channel-context.ts +2 -2
  60. package/src/core/builtin/discord-admin.ts +2 -2
  61. package/src/core/builtin/discord.ts +4 -3
  62. package/src/core/{identity/identity-plugin.ts → builtin/identity.ts} +15 -12
  63. package/src/core/builtin/modules.ts +12 -12
  64. package/src/core/builtin/prompts.ts +3 -3
  65. package/src/core/builtin/seeds.ts +1 -1
  66. package/src/core/builtin/session-tool.ts +1 -1
  67. package/src/core/builtin/skills.ts +3 -3
  68. package/src/core/builtin/stores.ts +10 -5
  69. package/src/core/builtin/threads.ts +2 -2
  70. package/src/core/builtin/worker-sessions.ts +3 -3
  71. package/src/core/config/access.ts +3 -3
  72. package/src/core/config/adapters.ts +1 -1
  73. package/src/core/config/config-schema.ts +9 -3
  74. package/src/core/config/config.ts +9 -10
  75. package/src/core/config/ops.ts +1 -1
  76. package/src/core/config/peer-bots.ts +74 -0
  77. package/src/core/config/routing.ts +1 -1
  78. package/src/core/contract/attachments.ts +1 -1
  79. package/src/core/contract/channels.ts +3 -5
  80. package/src/core/contract/runtime.ts +6 -6
  81. package/src/core/contract/surface.ts +3 -3
  82. package/src/core/conversations/conversation-registry.ts +1 -1
  83. package/src/core/conversations/conversation-retention.ts +2 -2
  84. package/src/core/conversations/conversation-store.ts +1 -1
  85. package/src/core/conversations/conversations-plugin.ts +2 -2
  86. package/src/core/db/migrations.ts +2 -2
  87. package/src/core/discord/agent-commands.ts +2 -2
  88. package/src/core/discord/agent-discord.ts +1 -1
  89. package/src/core/discord/agent-panel.ts +1 -1
  90. package/src/core/discord/card-audience.ts +1 -1
  91. package/src/core/discord/card-copies.ts +1 -1
  92. package/src/core/discord/channel-context.ts +1 -1
  93. package/src/core/discord/channel-executor.ts +1 -1
  94. package/src/core/discord/channel-operations.ts +1 -1
  95. package/src/core/discord/command-collection.ts +1 -1
  96. package/src/core/discord/compose-commands.ts +1 -1
  97. package/src/core/discord/context-images.ts +1 -1
  98. package/src/core/discord/discord-owners.ts +2 -2
  99. package/src/core/discord/discord-surface.ts +2 -2
  100. package/src/core/discord/member-events.ts +2 -2
  101. package/src/core/discord/message-changes.ts +1 -1
  102. package/src/core/discord/owner-cards.ts +1 -1
  103. package/src/core/discord/owner-command.ts +1 -1
  104. package/src/core/discord/schedule-commands.ts +1 -1
  105. package/src/core/domain/conversation.ts +5 -3
  106. package/src/core/{models.ts → domain/models.ts} +1 -1
  107. package/src/core/domain/ports.ts +2 -2
  108. package/src/core/{sessions.ts → domain/sessions.ts} +6 -6
  109. package/src/core/{define-roundtable.ts → host/define-roundtable.ts} +29 -29
  110. package/src/core/{drain.ts → host/drain.ts} +2 -7
  111. package/src/core/{events.ts → host/events.ts} +2 -2
  112. package/src/core/{host-background.ts → host/host-background.ts} +3 -3
  113. package/src/core/{host-registration.ts → host/host-registration.ts} +30 -30
  114. package/src/core/{host.ts → host/host.ts} +19 -15
  115. package/src/core/http/listeners.ts +2 -2
  116. package/src/core/http/websocket.ts +1 -1
  117. package/src/core/identity/access-policy.ts +8 -8
  118. package/src/core/identity/actor-facts.ts +1 -1
  119. package/src/core/identity/caching-principal-store.ts +1 -1
  120. package/src/core/identity/config-owner.ts +1 -1
  121. package/src/core/identity/contact.ts +2 -2
  122. package/src/core/identity/identity-links.ts +2 -2
  123. package/src/core/identity/identity-port.ts +2 -2
  124. package/src/core/identity/identity-schema.ts +1 -1
  125. package/src/core/identity/identity-service.ts +3 -3
  126. package/src/core/identity/identity-view.ts +1 -1
  127. package/src/core/{identity.ts → identity/owner-identity.ts} +1 -1
  128. package/src/core/identity/person-profiles.ts +1 -1
  129. package/src/core/identity/plugin-identities.ts +2 -2
  130. package/src/core/identity/principal-reads.ts +1 -1
  131. package/src/core/identity/principal-store.ts +1 -1
  132. package/src/core/identity/principal-types.ts +1 -1
  133. package/src/core/identity/seen-throttle.ts +1 -1
  134. package/src/core/{speakers.ts → identity/speakers.ts} +3 -6
  135. package/src/core/images/codex-images-plugin.ts +3 -3
  136. package/src/core/interactions/prompts.ts +1 -1
  137. package/src/core/judging/confirmation-judge.ts +1 -1
  138. package/src/core/judging/effort-judge.ts +2 -2
  139. package/src/core/judging/model-judge.ts +1 -1
  140. package/src/core/modes/conversation-modes.ts +4 -4
  141. package/src/core/modes/mode-inheritance.ts +1 -1
  142. package/src/core/modes/modes-plugin.ts +2 -2
  143. package/src/core/modules/background/background-turns.ts +4 -4
  144. package/src/core/modules/delegation/delegate.ts +3 -3
  145. package/src/core/modules/delegation/delegator.ts +4 -4
  146. package/src/core/modules/delegation/web-research-worker.ts +2 -2
  147. package/src/core/modules/delegation/worker-session.ts +5 -2
  148. package/src/core/modules/discord-admin/discord-admin.ts +1 -1
  149. package/src/core/modules/host-shell/shell-policy.ts +1 -1
  150. package/src/core/modules/memory/owner-memory-store.ts +1 -1
  151. package/src/core/modules/memory/owner-memory.ts +6 -3
  152. package/src/core/modules/notify/notify.ts +4 -1
  153. package/src/core/modules/notify/session-notify.ts +3 -3
  154. package/src/core/modules/prompts/prompt-documents.ts +1 -1
  155. package/src/core/modules/schedules/precheck-tools.ts +4 -4
  156. package/src/core/modules/schedules/prechecks.ts +2 -2
  157. package/src/core/modules/schedules/recurrence.ts +6 -1
  158. package/src/core/modules/schedules/schedule-prechecks.ts +4 -4
  159. package/src/core/modules/schedules/schedule-store.ts +2 -2
  160. package/src/core/modules/schedules/schedule-tools.ts +4 -4
  161. package/src/core/modules/schedules/scheduled-turn-text.ts +1 -1
  162. package/src/core/modules/schedules/scheduler.ts +3 -3
  163. package/src/core/modules/schedules/schedules.ts +5 -5
  164. package/src/core/modules/skills/missing-warning.ts +1 -1
  165. package/src/core/modules/skills/package-skills.ts +1 -1
  166. package/src/core/modules/skills/skill-registry.ts +2 -2
  167. package/src/core/modules/skills/skill-rules.ts +1 -1
  168. package/src/core/modules/skills/skill-tools.ts +1 -1
  169. package/src/core/ops/error-reporter.ts +2 -2
  170. package/src/core/ops/ops-alerts.ts +1 -1
  171. package/src/core/{define.ts → plugin-api/define.ts} +18 -20
  172. package/src/core/{event-types.ts → plugin-api/event-types.ts} +1 -1
  173. package/src/core/{holds.ts → plugin-api/holds.ts} +3 -3
  174. package/src/core/{plugin-removed.ts → plugin-api/plugin-removed.ts} +2 -2
  175. package/src/core/{plugin.ts → plugin-api/plugin.ts} +26 -26
  176. package/src/core/{services.ts → plugin-api/services.ts} +28 -28
  177. package/src/core/{tool-turn.ts → plugin-api/tool-turn.ts} +12 -5
  178. package/src/core/presence/delivery-router.ts +1 -1
  179. package/src/core/presence/direct-channels.ts +1 -1
  180. package/src/core/registry/chat-commands.ts +1 -1
  181. package/src/core/registry/contributions.ts +11 -11
  182. package/src/core/registry/providers.ts +2 -2
  183. package/src/core/registry/services.ts +2 -2
  184. package/src/core/registry/surface-service.ts +1 -1
  185. package/src/core/routing/actor-of.ts +1 -1
  186. package/src/core/routing/channel-queue.ts +2 -2
  187. package/src/core/routing/channel-router.ts +3 -3
  188. package/src/core/routing/claim-events.ts +2 -2
  189. package/src/core/routing/conversation-turns.ts +10 -6
  190. package/src/core/routing/forward-join.ts +1 -1
  191. package/src/core/routing/message-observers.ts +1 -1
  192. package/src/core/routing/message-text.ts +1 -1
  193. package/src/core/routing/peer-bots.ts +6 -74
  194. package/src/core/routing/queued-messages.ts +2 -2
  195. package/src/core/routing/settle-turn.ts +1 -1
  196. package/src/core/routing/surface-port.ts +3 -3
  197. package/src/core/runtime/ask-questions.ts +1 -1
  198. package/src/core/runtime/bridge-guard.ts +5 -5
  199. package/src/core/runtime/chat-only.ts +1 -1
  200. package/src/core/runtime/conversation-sessions.ts +2 -2
  201. package/src/core/runtime/extensions/agent-prompt.ts +1 -1
  202. package/src/core/runtime/extensions/ask-user-text.ts +5 -1
  203. package/src/core/runtime/extensions/ask-user.ts +4 -1
  204. package/src/core/runtime/extensions/card-ask.ts +1 -1
  205. package/src/core/runtime/extensions/confirmation-fixture.ts +1 -1
  206. package/src/core/runtime/extensions/confirmation-gate-extension.ts +1 -1
  207. package/src/core/runtime/extensions/confirmation-gate.ts +5 -5
  208. package/src/core/runtime/extensions/gate-refusals.ts +5 -2
  209. package/src/core/runtime/extensions/held-calls.ts +2 -2
  210. package/src/core/runtime/extensions/hold-describer.ts +3 -3
  211. package/src/core/runtime/extensions/hold-lookups.ts +4 -4
  212. package/src/core/runtime/extensions/persona-prompt.ts +1 -1
  213. package/src/core/runtime/extensions/prompt-read.ts +1 -1
  214. package/src/core/runtime/extensions/yolo.ts +1 -1
  215. package/src/core/runtime/interim-text.ts +1 -1
  216. package/src/core/runtime/pi-agent-runtime.ts +4 -4
  217. package/src/core/runtime/running-turn.ts +1 -1
  218. package/src/core/runtime/runtime-plugin.ts +13 -8
  219. package/src/core/runtime/runtime-types.ts +14 -10
  220. package/src/core/runtime/session-conversation.ts +3 -3
  221. package/src/core/runtime/session-factory.ts +5 -5
  222. package/src/core/runtime/thinking-level.ts +2 -2
  223. package/src/core/{tool-tiers.ts → runtime/tool-tiers.ts} +5 -5
  224. package/src/core/runtime/turn-answer.ts +1 -1
  225. package/src/core/runtime/turn-budget.ts +1 -1
  226. package/src/core/runtime/turn-limits.ts +1 -1
  227. package/src/core/runtime/turn-tools.ts +2 -2
  228. package/src/core/runtime/worker-task.ts +1 -1
  229. package/src/core/shared/attach-file-tool.ts +1 -1
  230. package/src/core/shared/child-env.ts +3 -5
  231. package/src/core/shared/delegate-tool.ts +1 -1
  232. package/src/core/shared/generate-image-tool.ts +1 -1
  233. package/src/core/{modules/background → shared}/personal-target.ts +2 -2
  234. package/src/core/{reply-files.ts → shared/reply-files.ts} +1 -1
  235. package/src/core/testing/eager-catalog.ts +1 -1
  236. package/src/core/testing/locale.ts +1 -1
  237. package/src/core/testing/map-identity.ts +5 -1
  238. package/src/core/testing/module-sessions.ts +3 -3
  239. package/src/core/testing/modules.ts +17 -13
  240. package/src/core/testing/owner.ts +2 -2
  241. package/src/core/testing/recording-logger.ts +1 -1
  242. package/src/core/testing/run-tool.ts +2 -2
  243. package/src/core/testing/surface-contract-support.ts +1 -1
  244. package/src/core/testing/surface-contract.ts +2 -2
  245. package/src/core/testing/test-host.ts +12 -12
  246. package/src/core/testing/thread-host.ts +1 -1
  247. package/src/core/testing/tool-set.ts +3 -3
  248. package/src/core/threads/dispatch-threads.ts +1 -1
  249. package/src/core/tool-set.snapshot.json +12 -0
  250. package/src/index.ts +76 -72
  251. package/src/kit/domain.ts +9 -9
  252. package/src/kit/holds.ts +4 -1
  253. package/src/kit/jev-judge.ts +1 -1
  254. package/src/kit/jev.ts +1 -1
  255. package/src/kit/presentation.ts +1 -1
  256. package/src/kit/support.ts +3 -3
  257. package/src/testing.ts +21 -20
  258. /package/src/core/{errors.ts → kernel/errors.ts} +0 -0
  259. /package/src/core/{freeze.ts → kernel/freeze.ts} +0 -0
  260. /package/src/core/{log.ts → kernel/log.ts} +0 -0
  261. /package/src/core/{time.ts → kernel/time.ts} +0 -0
@@ -4,49 +4,49 @@ import {
4
4
  CharacterError,
5
5
  checkSkins,
6
6
  type Hex,
7
- } from "../characters/index.ts";
8
- import { attachmentPort } from "./attachments/attachment-port.ts";
9
- import { retentionServices } from "./attachments/attachment-retention.ts";
10
- import type { AttachmentPort } from "./contract/attachments.ts";
11
- import type { ConversationPort } from "./contract/channels.ts";
12
- import type { ResolvedProviders } from "./contract/providers.ts";
13
- import type { SurfacePort } from "./contract/surface.ts";
14
- import { ConfigError } from "./domain/errors.ts";
15
- import { NotLinkedError } from "./errors.ts";
16
- import { EventBus } from "./events.ts";
17
- import type { RoundtableOptions } from "./host.ts";
18
- import { HttpListeners, listenerAddress } from "./http/listeners.ts";
19
- import { setLocale } from "./i18n/index.ts";
20
- import { contactsOf } from "./identity/identity-view.ts";
7
+ } from "../../characters/index.ts";
8
+ import { attachmentPort } from "../attachments/attachment-port.ts";
9
+ import { retentionServices } from "../attachments/attachment-retention.ts";
10
+ import type { AttachmentPort } from "../contract/attachments.ts";
11
+ import type { ConversationPort } from "../contract/channels.ts";
12
+ import type { ResolvedProviders } from "../contract/providers.ts";
13
+ import type { SurfacePort } from "../contract/surface.ts";
14
+ import { ConfigError } from "../domain/errors.ts";
15
+ import { HttpListeners, listenerAddress } from "../http/listeners.ts";
16
+ import { setLocale } from "../i18n/index.ts";
17
+ import { contactsOf } from "../identity/identity-view.ts";
18
+ import { NotLinkedError } from "../kernel/errors.ts";
19
+ import { setTimeZone } from "../kernel/time.ts";
21
20
  import type {
22
21
  HostEnv,
23
22
  LinkedSessions,
24
23
  RoundtablePlugin,
25
24
  Service,
26
- } from "./plugin.ts";
27
- import { refuseRemovedFields } from "./plugin.ts";
25
+ } from "../plugin-api/plugin.ts";
26
+ import { refuseRemovedFields } from "../plugin-api/plugin.ts";
27
+ import { CONVERSATIONS, IDENTITY, RUNTIME } from "../plugin-api/services.ts";
28
28
  import {
29
29
  collectContributions,
30
30
  emptyRegistry,
31
31
  linkSessions,
32
32
  type Registry,
33
- } from "./registry/contributions.ts";
34
- import { resolveProviders } from "./registry/providers.ts";
35
- import { replaceServices, ServiceRegistry } from "./registry/services.ts";
36
- import { ChannelQueue } from "./routing/channel-queue.ts";
37
- import { ChannelRouter } from "./routing/channel-router.ts";
33
+ } from "../registry/contributions.ts";
34
+ import { resolveProviders } from "../registry/providers.ts";
35
+ import { replaceServices, ServiceRegistry } from "../registry/services.ts";
36
+ import { ChannelQueue } from "../routing/channel-queue.ts";
37
+ import { ChannelRouter } from "../routing/channel-router.ts";
38
38
  import {
39
39
  type ConversationTurns,
40
40
  conversationTurns,
41
- } from "./routing/conversation-turns.ts";
42
- import { MessageObservers } from "./routing/message-observers.ts";
43
- import { PeerBots } from "./routing/peer-bots.ts";
44
- import { surfacePort } from "./routing/surface-port.ts";
45
- import { refuseHostAccess } from "./runtime/chat-only.ts";
46
- import { CONVERSATIONS, IDENTITY, RUNTIME } from "./services.ts";
47
- import { frozenShellEnv } from "./shared/child-env.ts";
48
- import { setTimeZone } from "./time.ts";
49
- import { type ToolTierTable, toolTiers } from "./tool-tiers.ts";
41
+ } from "../routing/conversation-turns.ts";
42
+ import { MessageObservers } from "../routing/message-observers.ts";
43
+ import { PeerBots } from "../routing/peer-bots.ts";
44
+ import { surfacePort } from "../routing/surface-port.ts";
45
+ import { refuseHostAccess } from "../runtime/chat-only.ts";
46
+ import { type ToolTierTable, toolTiers } from "../runtime/tool-tiers.ts";
47
+ import { frozenShellEnv } from "../shared/child-env.ts";
48
+ import { EventBus } from "./events.ts";
49
+ import type { RoundtableOptions } from "./host.ts";
50
50
 
51
51
  /** The skin tones the host's environment names, checked, or the package's own; a bad set refuses the start. */
52
52
  function characterSkinsOf(skins: readonly Hex[] | undefined): readonly Hex[] {
@@ -1,22 +1,26 @@
1
1
  import type { SQL } from "bun";
2
- import type { Hex } from "../characters/index.ts";
3
- import type { AttachmentRetention } from "./attachments/attachment-retention.ts";
4
- import { checkDatabase } from "./db/check-database.ts";
5
- import { openPool, runMigrations } from "./db/migrations.ts";
2
+ import type { Hex } from "../../characters/index.ts";
3
+ import type { AttachmentRetention } from "../attachments/attachment-retention.ts";
4
+ import type { PeerBotsConfig } from "../config/peer-bots.ts";
5
+ import { checkDatabase } from "../db/check-database.ts";
6
+ import { openPool, runMigrations } from "../db/migrations.ts";
7
+ import type { ChannelKey } from "../domain/sessions.ts";
8
+ import type { HttpListeners, ListenerConfig } from "../http/listeners.ts";
9
+ import type { Locale } from "../i18n/index.ts";
10
+ import type { JudgeModel } from "../judging/model-judge.ts";
11
+ import { MigrationError, PluginError } from "../kernel/errors.ts";
12
+ import type { Logger } from "../kernel/log.ts";
13
+ import type {
14
+ AgentTools,
15
+ RoundtablePlugin,
16
+ Service,
17
+ } from "../plugin-api/plugin.ts";
18
+ import { RUNTIME } from "../plugin-api/services.ts";
19
+ import type { ToolTierTable } from "../runtime/tool-tiers.ts";
20
+ import type { ShellEnvConfig } from "../shared/child-env.ts";
6
21
  import { type DrainOptions, drainWork, stopTurns } from "./drain.ts";
7
- import { MigrationError, PluginError } from "./errors.ts";
8
22
  import { attempt, startInBackground } from "./host-background.ts";
9
23
  import { Linkage, type RegistrationReport } from "./host-registration.ts";
10
- import type { HttpListeners, ListenerConfig } from "./http/listeners.ts";
11
- import type { Locale } from "./i18n/index.ts";
12
- import type { JudgeModel } from "./judging/model-judge.ts";
13
- import type { Logger } from "./log.ts";
14
- import type { AgentTools, RoundtablePlugin, Service } from "./plugin.ts";
15
- import type { PeerBotsConfig } from "./routing/peer-bots.ts";
16
- import { RUNTIME } from "./services.ts";
17
- import type { ChannelKey } from "./sessions.ts";
18
- import type { ShellEnvConfig } from "./shared/child-env.ts";
19
- import type { ToolTierTable } from "./tool-tiers.ts";
20
24
 
21
25
  /**
22
26
  * What differs between hosts: the words and time the process speaks in, and the Pi agent
@@ -1,7 +1,7 @@
1
1
  import { chmodSync } from "node:fs";
2
2
  import type { Server, WebSocketHandler } from "bun";
3
- import { PluginError } from "../errors.ts";
4
- import type { Logger } from "../log.ts";
3
+ import { PluginError } from "../kernel/errors.ts";
4
+ import type { Logger } from "../kernel/log.ts";
5
5
  import { serveUnix } from "../shared/unix-server.ts";
6
6
  import {
7
7
  type Connection,
@@ -1,5 +1,5 @@
1
1
  import type { Server, ServerWebSocket, WebSocketHandler } from "bun";
2
- import type { Logger } from "../log.ts";
2
+ import type { Logger } from "../kernel/log.ts";
3
3
 
4
4
  /**
5
5
  * What became of one `send`: written to the connection, `"queued"` behind a client that reads
@@ -1,13 +1,6 @@
1
1
  import type { Pronouns } from "../config/config.ts";
2
2
  import { ConfigError } from "../domain/errors.ts";
3
- import type { ChannelKey } from "../sessions.ts";
4
- import type {
5
- SpeakerFacts,
6
- SpeakerMap,
7
- SpeakerPolicy,
8
- Tier,
9
- TierMembers,
10
- } from "../speakers.ts";
3
+ import type { ChannelKey } from "../domain/sessions.ts";
11
4
  import {
12
5
  type ActorFacts,
13
6
  identityOf,
@@ -15,6 +8,13 @@ import {
15
8
  surfaceOf,
16
9
  } from "./actor-facts.ts";
17
10
  import { SYSTEM_PRINCIPAL } from "./principal-store.ts";
11
+ import type {
12
+ SpeakerFacts,
13
+ SpeakerMap,
14
+ SpeakerPolicy,
15
+ Tier,
16
+ TierMembers,
17
+ } from "./speakers.ts";
18
18
 
19
19
  /** One owner the configuration names: whom they are, and the identities that are theirs. */
20
20
  export interface AccessOwner {
@@ -1,5 +1,5 @@
1
1
  import { parseChannelKey } from "../contract/surface.ts";
2
- import type { ChannelKey } from "../sessions.ts";
2
+ import type { ChannelKey } from "../domain/sessions.ts";
3
3
  import type { IdentityRef } from "./principal-store.ts";
4
4
 
5
5
  /**
@@ -1,4 +1,3 @@
1
- import type { Tier } from "../speakers.ts";
2
1
  import type {
3
2
  IdentityRef,
4
3
  LinkSource,
@@ -7,6 +6,7 @@ import type {
7
6
  Pronouns,
8
7
  RoleSource,
9
8
  } from "./principal-store.ts";
9
+ import type { Tier } from "./speakers.ts";
10
10
 
11
11
  /** How long a read of the store is reused; a change another process makes is seen after it. */
12
12
  export const CACHE_MS = 30_000;
@@ -1,5 +1,5 @@
1
1
  import { ConfigError } from "../domain/errors.ts";
2
- import type { Logger } from "../log.ts";
2
+ import type { Logger } from "../kernel/log.ts";
3
3
  import type { AccessOwner } from "./access-policy.ts";
4
4
  import { identityOf } from "./actor-facts.ts";
5
5
  import type { DeclaredIdentity } from "./plugin-identities.ts";
@@ -1,6 +1,6 @@
1
- import type { ChannelKey } from "../sessions.ts";
2
- import type { Speaker } from "../speakers.ts";
1
+ import type { ChannelKey } from "../domain/sessions.ts";
3
2
  import type { ActorFacts } from "./actor-facts.ts";
3
+ import type { Speaker } from "./speakers.ts";
4
4
 
5
5
  /**
6
6
  * A person a surface reports, assessed before any claim takes their message: who they would be,
@@ -1,6 +1,6 @@
1
1
  import { IdentityError } from "../domain/errors.ts";
2
- import { freeze } from "../freeze.ts";
3
- import type { Logger } from "../log.ts";
2
+ import { freeze } from "../kernel/freeze.ts";
3
+ import type { Logger } from "../kernel/log.ts";
4
4
  import type { SelfLinkRules } from "./access-policy.ts";
5
5
  import { identityOf, parseIdentity } from "./actor-facts.ts";
6
6
  import {
@@ -1,7 +1,7 @@
1
- import type { ChannelKey } from "../sessions.ts";
2
- import type { Speaker, Tier } from "../speakers.ts";
1
+ import type { ChannelKey } from "../domain/sessions.ts";
3
2
  import type { ActorFacts } from "./actor-facts.ts";
4
3
  import type { IdentityLink, Principal, RoleGrant } from "./principal-store.ts";
4
+ import type { Speaker, Tier } from "./speakers.ts";
5
5
 
6
6
  /**
7
7
  * Who the host serves: its principals, their identities, and their roles, read-only. Provided as
@@ -1,6 +1,5 @@
1
1
  import type { SQL } from "bun";
2
2
  import type { Migration } from "../db/migrations.ts";
3
- import { type Tier, tierAtLeast } from "../speakers.ts";
4
3
  import type { AccessRules, AccessTier } from "./access-policy.ts";
5
4
  import { parseIdentity } from "./actor-facts.ts";
6
5
  import {
@@ -15,6 +14,7 @@ import {
15
14
  PRINCIPAL_TABLES,
16
15
  PRINCIPALS_CLAIMABLE,
17
16
  } from "./principal-tables.ts";
17
+ import { type Tier, tierAtLeast } from "./speakers.ts";
18
18
 
19
19
  /** Where the backfill finds the ids of people 0.8 stored: the configured owners, then four tables. */
20
20
  export type BackfillSource =
@@ -1,7 +1,6 @@
1
1
  import { ConfigError, IdentityError } from "../domain/errors.ts";
2
- import type { Logger } from "../log.ts";
3
- import type { ChannelKey } from "../sessions.ts";
4
- import { type Speaker, type Tier, tierAtLeast } from "../speakers.ts";
2
+ import type { ChannelKey } from "../domain/sessions.ts";
3
+ import type { Logger } from "../kernel/log.ts";
5
4
  import {
6
5
  type AccessRules,
7
6
  checkAccessRules,
@@ -34,6 +33,7 @@ import {
34
33
  SYSTEM_PRINCIPAL,
35
34
  } from "./principal-store.ts";
36
35
  import { SeenThrottle } from "./seen-throttle.ts";
36
+ import { type Speaker, type Tier, tierAtLeast } from "./speakers.ts";
37
37
  import { isPrincipalId, newPrincipalId } from "./ulid.ts";
38
38
 
39
39
  export type { IdentityService } from "./identity-port.ts";
@@ -1,4 +1,4 @@
1
- import { freeze } from "../freeze.ts";
1
+ import { freeze } from "../kernel/freeze.ts";
2
2
  import type { ContactAssessor } from "./contact.ts";
3
3
  import type { IdentityService } from "./identity-service.ts";
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Pronouns } from "./config/config.ts";
1
+ import type { Pronouns } from "../config/config.ts";
2
2
 
3
3
  /** Who the agents work for, as prompts and tool descriptions name them. */
4
4
  export interface OwnerIdentity {
@@ -1,6 +1,6 @@
1
1
  import type { SQL } from "bun";
2
2
  import { IdentityError } from "../domain/errors.ts";
3
- import type { Logger } from "../log.ts";
3
+ import type { Logger } from "../kernel/log.ts";
4
4
  import { ProfileChoices } from "./profile-choices.ts";
5
5
  import { cleanName, ExpiringMap } from "./profile-memory.ts";
6
6
  import {
@@ -1,6 +1,6 @@
1
1
  import { ConfigError } from "../domain/errors.ts";
2
- import type { Logger } from "../log.ts";
3
- import type { PluginIdentity, RoundtablePlugin } from "../plugin.ts";
2
+ import type { Logger } from "../kernel/log.ts";
3
+ import type { PluginIdentity, RoundtablePlugin } from "../plugin-api/plugin.ts";
4
4
  import { identityOf, parseIdentity } from "./actor-facts.ts";
5
5
  import { type PrincipalStore, SYSTEM_PRINCIPAL } from "./principal-store.ts";
6
6
 
@@ -1,6 +1,6 @@
1
- import { type Speaker, type Tier, tierAtLeast } from "../speakers.ts";
2
1
  import { type ActorFacts, identityOf } from "./actor-facts.ts";
3
2
  import type { Principal, PrincipalRecord } from "./principal-store.ts";
3
+ import { type Speaker, type Tier, tierAtLeast } from "./speakers.ts";
4
4
 
5
5
  /** The speaker of a contact: the id the surface knows them by, their 0.8 id where they have one. */
6
6
  export const speakerOf = (
@@ -1,6 +1,5 @@
1
1
  import type { SQL } from "bun";
2
2
  import { IdentityError } from "../domain/errors.ts";
3
- import type { Tier } from "../speakers.ts";
4
3
  import type {
5
4
  IdentityLink,
6
5
  IdentityRef,
@@ -13,6 +12,7 @@ import type {
13
12
  RoleHolder,
14
13
  RoleSource,
15
14
  } from "./principal-types.ts";
15
+ import type { Tier } from "./speakers.ts";
16
16
  import { isPrincipalId, newPrincipalId } from "./ulid.ts";
17
17
 
18
18
  export type {
@@ -1,5 +1,5 @@
1
1
  import type { Pronouns } from "../config/config.ts";
2
- import type { Tier } from "../speakers.ts";
2
+ import type { Tier } from "./speakers.ts";
3
3
 
4
4
  export type { Pronouns };
5
5
 
@@ -1,4 +1,4 @@
1
- import type { Tier } from "../speakers.ts";
1
+ import type { Tier } from "./speakers.ts";
2
2
 
3
3
  /** How often being seen is written for one principal, unless the tier changes. */
4
4
  const TOUCH_MS = 5 * 60_000;
@@ -1,9 +1,6 @@
1
- import { freeze } from "./freeze.ts";
2
- import {
3
- rulesOfSpeakerMap,
4
- speakerPolicyOf,
5
- } from "./identity/access-policy.ts";
6
- import type { OwnerIdentity } from "./identity.ts";
1
+ import { freeze } from "../kernel/freeze.ts";
2
+ import { rulesOfSpeakerMap, speakerPolicyOf } from "./access-policy.ts";
3
+ import type { OwnerIdentity } from "./owner-identity.ts";
7
4
 
8
5
  /** How much a speaker may do: `owner` above `admin` above `member`. */
9
6
  export const TIERS = Object.freeze(["member", "admin", "owner"] as const);
@@ -1,8 +1,8 @@
1
1
  // The codex-images plugin: fills the images slot with drawCodexImage.
2
2
 
3
- import { definePlugin } from "../define.ts";
4
- import { PluginError } from "../errors.ts";
5
- import type { RoundtablePlugin } from "../plugin.ts";
3
+ import { PluginError } from "../kernel/errors.ts";
4
+ import { definePlugin } from "../plugin-api/define.ts";
5
+ import type { RoundtablePlugin } from "../plugin-api/plugin.ts";
6
6
  import {
7
7
  CODEX_IMAGE_MODEL,
8
8
  CODEX_IMAGES_PROVIDER,
@@ -1,6 +1,6 @@
1
1
  import type { ConversationVisibility } from "../conversations/conversation-registry.ts";
2
2
  import type { TurnRequest } from "../domain/ports.ts";
3
- import type { Speaker, Tier } from "../speakers.ts";
3
+ import type { Speaker, Tier } from "../identity/speakers.ts";
4
4
  import type {
5
5
  AskSupport,
6
6
  OwnerAnswer,
@@ -1,6 +1,6 @@
1
1
  import type { Judge } from "../contract/providers.ts";
2
2
  import type { PendingConfirmation } from "../domain/conversation.ts";
3
- import type { Logger } from "../log.ts";
3
+ import type { Logger } from "../kernel/log.ts";
4
4
 
5
5
  export interface ConfirmationJudgeOptions {
6
6
  judge: Judge;
@@ -1,6 +1,6 @@
1
1
  import type { Judge } from "../contract/providers.ts";
2
- import type { Logger } from "../log.ts";
3
- import type { ThinkingLevel } from "../models.ts";
2
+ import type { ThinkingLevel } from "../domain/models.ts";
3
+ import type { Logger } from "../kernel/log.ts";
4
4
 
5
5
  /** The levels the judge chooses between, lowest first; criterion i of a brief asks for level i. */
6
6
  export type EffortLevel = "low" | "medium" | "high" | "xhigh";
@@ -11,7 +11,7 @@ import type {
11
11
  ScoreQuestion,
12
12
  YesNoQuestion,
13
13
  } from "../contract/providers.ts";
14
- import { JudgeError } from "../errors.ts";
14
+ import { JudgeError } from "../kernel/errors.ts";
15
15
 
16
16
  /** One completion: a system prompt and a user message in, the model's text out. */
17
17
  export type JudgeModel = (system: string, prompt: string) => Promise<string>;
@@ -1,10 +1,10 @@
1
1
  import type { SQL } from "bun";
2
2
  import type { Migration } from "../db/migrations.ts";
3
- import { PluginError } from "../errors.ts";
3
+ import type { ChannelKey } from "../domain/sessions.ts";
4
4
  import { SYSTEM_PRINCIPAL } from "../identity/principal-store.ts";
5
- import type { Logger } from "../log.ts";
6
- import type { ChannelKey } from "../sessions.ts";
7
- import type { Speaker } from "../speakers.ts";
5
+ import type { Speaker } from "../identity/speakers.ts";
6
+ import { PluginError } from "../kernel/errors.ts";
7
+ import type { Logger } from "../kernel/log.ts";
8
8
  import {
9
9
  followersOf,
10
10
  type ModeOrigins,
@@ -1,4 +1,4 @@
1
- import type { ChannelKey } from "../sessions.ts";
1
+ import type { ChannelKey } from "../domain/sessions.ts";
2
2
  import type { ConversationMode } from "./conversation-modes.ts";
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
- import type { RoundtablePlugin } from "../plugin.ts";
2
- import { MODES } from "../services.ts";
1
+ import type { RoundtablePlugin } from "../plugin-api/plugin.ts";
2
+ import { MODES } from "../plugin-api/services.ts";
3
3
  import { PgConversationModes } from "./conversation-modes.ts";
4
4
 
5
5
  /** The name of the modes' plugin, as the migration ledger names it. */
@@ -5,10 +5,11 @@ import type {
5
5
  ScheduledOutcome,
6
6
  } from "../../contract/channels.ts";
7
7
  import type { ChannelKey } from "../../domain/conversation.ts";
8
- import type { Logger } from "../../log.ts";
8
+ import type { Logger } from "../../kernel/log.ts";
9
+ import { zonedStamp } from "../../kernel/time.ts";
10
+ import type { BackgroundTurns } from "../../plugin-api/services.ts";
9
11
  import { systemTurn } from "../../routing/system-turns.ts";
10
- import type { BackgroundTurns } from "../../services.ts";
11
- import { zonedStamp } from "../../time.ts";
12
+ import { PERSONAL_TARGET } from "../../shared/personal-target.ts";
12
13
  import {
13
14
  type DelegationJob,
14
15
  type DelegationOutcome,
@@ -17,7 +18,6 @@ import {
17
18
  import type { PrecheckFinding } from "../schedules/prechecks.ts";
18
19
  import type { Schedule } from "../schedules/schedule-store.ts";
19
20
  import { scheduledTurnText } from "../schedules/schedule-tools.ts";
20
- import { PERSONAL_TARGET } from "./personal-target.ts";
21
21
 
22
22
  export interface BackgroundTurnsOptions {
23
23
  conversations: Pick<ConversationPort, "background" | "runsAs">;
@@ -2,11 +2,11 @@ import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
2
  import type { ChannelKey } from "../../domain/conversation.ts";
3
3
  import { DelegationError } from "../../domain/errors.ts";
4
4
  import { SYSTEM_PRINCIPAL } from "../../identity/principal-store.ts";
5
+ import type { Speaker } from "../../identity/speakers.ts";
6
+ import type { Delegator } from "../../plugin-api/services.ts";
5
7
  import { textToolsExtension } from "../../runtime/text-tools.ts";
6
- import type { Delegator } from "../../services.ts";
7
8
  import { DELEGATE_TOOL_SPEC } from "../../shared/delegate-tool.ts";
8
- import type { Speaker } from "../../speakers.ts";
9
- import { PERSONAL_TARGET } from "../background/personal-target.ts";
9
+ import { PERSONAL_TARGET } from "../../shared/personal-target.ts";
10
10
 
11
11
  export interface OwnerDelegation {
12
12
  delegator: Pick<Delegator, "start">;
@@ -2,14 +2,14 @@ import type { BackgroundTarget } from "../../contract/channels.ts";
2
2
  import type { ChannelKey } from "../../domain/conversation.ts";
3
3
  import { DelegationError } from "../../domain/errors.ts";
4
4
  import { messages } from "../../i18n/index.ts";
5
- import type { Logger } from "../../log.ts";
6
- import type { Delegator } from "../../services.ts";
7
- import type { Tier } from "../../speakers.ts";
5
+ import type { Tier } from "../../identity/speakers.ts";
6
+ import type { Logger } from "../../kernel/log.ts";
7
+ import { timeZone } from "../../kernel/time.ts";
8
+ import type { Delegator } from "../../plugin-api/services.ts";
8
9
  import type {
9
10
  DispatchThread,
10
11
  DispatchThreads,
11
12
  } from "../../threads/dispatch-threads.ts";
12
- import { timeZone } from "../../time.ts";
13
13
 
14
14
  export interface DelegationJob {
15
15
  id: number;
@@ -1,10 +1,10 @@
1
1
  import type { ModelRuntime } from "@earendil-works/pi-coding-agent";
2
- import { PluginError } from "../../errors.ts";
3
2
  import {
4
3
  formatModelRef,
5
4
  type ModelRef,
6
5
  type ThinkingLevel,
7
- } from "../../models.ts";
6
+ } from "../../domain/models.ts";
7
+ import { PluginError } from "../../kernel/errors.ts";
8
8
  import { packageDir } from "../../shared/package-dir.ts";
9
9
  import { runWorkerSession } from "./worker-session.ts";
10
10
 
@@ -7,9 +7,12 @@ import {
7
7
  SessionManager,
8
8
  SettingsManager,
9
9
  } from "@earendil-works/pi-coding-agent";
10
- import type { ThinkingLevel } from "../../models.ts";
10
+ import type { ThinkingLevel } from "../../domain/models.ts";
11
+ import type {
12
+ WorkerSessionRequest,
13
+ WorkerSessions,
14
+ } from "../../plugin-api/services.ts";
11
15
  import { runWorkerTask } from "../../runtime/worker-task.ts";
12
- import type { WorkerSessionRequest, WorkerSessions } from "../../services.ts";
13
16
  import { activeToolsExtension } from "../../shared/active-tools.ts";
14
17
 
15
18
  export interface WorkerSessionOptions {
@@ -11,7 +11,7 @@ import {
11
11
  type OwnerIdentity,
12
12
  type OwnerWords,
13
13
  ownerWords,
14
- } from "../../identity.ts";
14
+ } from "../../identity/owner-identity.ts";
15
15
  import { textToolsExtension } from "../../runtime/text-tools.ts";
16
16
  import type { WorkspaceRoots } from "../../shared/workspace-files.ts";
17
17
 
@@ -1,5 +1,5 @@
1
1
  import { basename } from "node:path";
2
- import type { HoldContext, HoldRule } from "../../holds.ts";
2
+ import type { HoldContext, HoldRule } from "../../plugin-api/holds.ts";
3
3
  import { COMMAND_PREFIX_WORDS, EXPANDED, lexShell } from "./shell-lexer.ts";
4
4
  import {
5
5
  bindingCounts,
@@ -1,7 +1,7 @@
1
1
  import type { SQL } from "bun";
2
2
  import type { Migration } from "../../db/migrations.ts";
3
3
  import { MemoryError } from "../../domain/errors.ts";
4
- import type { MemoryStore, SpeakerMemory } from "../../services.ts";
4
+ import type { MemoryStore, SpeakerMemory } from "../../plugin-api/services.ts";
5
5
 
6
6
  /** The kinds of memory: a core fact shown every turn, a searchable note, a dated event. */
7
7
  export const MEMORY_KINDS = Object.freeze(["core", "note", "event"] as const);
@@ -1,10 +1,13 @@
1
1
  import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
2
  import { Type } from "typebox";
3
3
  import { messages } from "../../i18n/index.ts";
4
- import { addresseeWords, type OwnerIdentity } from "../../identity.ts";
5
- import type { MemoryStore } from "../../services.ts";
4
+ import {
5
+ addresseeWords,
6
+ type OwnerIdentity,
7
+ } from "../../identity/owner-identity.ts";
8
+ import { timeZone, zonedToday } from "../../kernel/time.ts";
9
+ import type { MemoryStore } from "../../plugin-api/services.ts";
6
10
  import { toolError, toolText } from "../../shared/tool-result.ts";
7
- import { timeZone, zonedToday } from "../../time.ts";
8
11
  import type { Memory, PromptMemory } from "./owner-memory-store.ts";
9
12
 
10
13
  function line(memory: Memory): string {
@@ -1,7 +1,10 @@
1
1
  import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
2
  import { Type } from "typebox";
3
3
  import type { Notifier } from "../../domain/ports.ts";
4
- import { addresseeWords, type OwnerIdentity } from "../../identity.ts";
4
+ import {
5
+ addresseeWords,
6
+ type OwnerIdentity,
7
+ } from "../../identity/owner-identity.ts";
5
8
  import { toolError, toolText } from "../../shared/tool-result.ts";
6
9
 
7
10
  /** What notify needs in one session. */
@@ -1,14 +1,14 @@
1
1
  import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
2
  import type { ChannelKey } from "../../domain/conversation.ts";
3
+ import type { SessionContext } from "../../domain/sessions.ts";
4
+ import type { OwnerIdentity } from "../../identity/owner-identity.ts";
3
5
  import { SYSTEM_PRINCIPAL } from "../../identity/principal-store.ts";
4
- import type { OwnerIdentity } from "../../identity.ts";
5
- import type { Logger } from "../../log.ts";
6
+ import type { Logger } from "../../kernel/log.ts";
6
7
  import { providerSurface, surfaceOf } from "../../presence/delivery-router.ts";
7
8
  import type {
8
9
  DirectChannelProvider,
9
10
  DirectChannels,
10
11
  } from "../../presence/direct-channels.ts";
11
- import type { SessionContext } from "../../sessions.ts";
12
12
  import { notifyExtension } from "./notify.ts";
13
13
 
14
14
  export interface SessionNotifyDeps {
@@ -2,7 +2,7 @@ import type { SQL } from "bun";
2
2
  import { isCheckDatabase } from "../../db/check-database.ts";
3
3
  import type { Migration } from "../../db/migrations.ts";
4
4
  import { AgentError } from "../../domain/errors.ts";
5
- import { type Logger, silentLogger } from "../../log.ts";
5
+ import { type Logger, silentLogger } from "../../kernel/log.ts";
6
6
  import {
7
7
  PromptHistory,
8
8
  type PromptVersion,