pi-roundtable 0.9.0 → 0.9.2
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 +20 -0
- package/docs/plugins.md +46 -10
- package/package.json +1 -1
- package/src/core/attachments/attachment-port.ts +34 -0
- package/src/core/attachments/attachment-store.ts +248 -0
- package/src/core/attachments/model-images.ts +39 -0
- package/src/core/attachments/tool-attachment.ts +53 -0
- package/src/core/attachments/turn-attachments.ts +4 -21
- package/src/core/builtin/modules.ts +10 -1
- package/src/core/config/config.ts +9 -0
- package/src/core/contract/attachments.ts +71 -0
- package/src/core/contract/channels.ts +5 -0
- package/src/core/define-roundtable.ts +2 -0
- package/src/core/define.ts +25 -0
- package/src/core/drain.ts +56 -5
- package/src/core/errors.ts +13 -0
- package/src/core/host-background.ts +56 -0
- package/src/core/host.ts +33 -60
- package/src/core/i18n/conversation.ts +2 -0
- package/src/core/modules/schedules/scheduler.ts +13 -2
- package/src/core/plugin.ts +6 -0
- package/src/core/routing/channel-queue.ts +18 -1
- package/src/core/routing/channel-router.ts +59 -7
- package/src/core/routing/conversation-turns.ts +7 -2
- package/src/core/runtime/abort-guard.ts +58 -0
- package/src/core/runtime/conversation-sessions.ts +15 -0
- package/src/core/runtime/pi-agent-runtime.ts +61 -78
- package/src/core/runtime/runtime-plugin.ts +1 -0
- package/src/core/runtime/runtime-types.ts +8 -0
- package/src/core/runtime/session-factory.ts +1 -0
- package/src/core/runtime/steerable-run.ts +12 -3
- package/src/core/runtime/thinking-level.ts +47 -0
- package/src/core/runtime/turn-wrapup.ts +63 -0
- package/src/core/sessions.ts +2 -0
- package/src/index.ts +8 -0
- package/src/testing.ts +9 -1
package/src/core/sessions.ts
CHANGED
|
@@ -83,6 +83,8 @@ export interface SessionContext {
|
|
|
83
83
|
* it reads `"none"` for that turn alone.
|
|
84
84
|
*/
|
|
85
85
|
memory: "speaker" | "none";
|
|
86
|
+
/** Where the session's conversation keeps the files people attached; absent when the session keeps none. */
|
|
87
|
+
attachmentDir?: string;
|
|
86
88
|
/** The person the session's running turn is for; undefined between turns. */
|
|
87
89
|
speaker(): Speaker | undefined;
|
|
88
90
|
/** Runs a task beside this session, under its confirmation gate. */
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export type {
|
|
|
16
16
|
GroupStatus,
|
|
17
17
|
TeamStatus,
|
|
18
18
|
} from "./core/agents/team-status.ts";
|
|
19
|
+
export type { ToolAttachment } from "./core/attachments/tool-attachment.ts";
|
|
19
20
|
export {
|
|
20
21
|
AGENT_SERVER_PLUGIN,
|
|
21
22
|
AGENT_TEAM_SERVICE,
|
|
@@ -33,6 +34,12 @@ export type {
|
|
|
33
34
|
RoundtableConfig,
|
|
34
35
|
TierConfig,
|
|
35
36
|
} from "./core/config/config.ts";
|
|
37
|
+
export type {
|
|
38
|
+
AttachmentPort,
|
|
39
|
+
AttachmentRefusalCode,
|
|
40
|
+
AttachmentUpload,
|
|
41
|
+
} from "./core/contract/attachments.ts";
|
|
42
|
+
export { AttachmentRefusal } from "./core/contract/attachments.ts";
|
|
36
43
|
export type {
|
|
37
44
|
Admission,
|
|
38
45
|
AttachmentRef,
|
|
@@ -113,6 +120,7 @@ export type { TurnConversation, TurnRequest } from "./core/domain/ports.ts";
|
|
|
113
120
|
export type { TurnProgress } from "./core/domain/progress.ts";
|
|
114
121
|
export type { DrainOptions } from "./core/drain.ts";
|
|
115
122
|
export {
|
|
123
|
+
HostStoppingError,
|
|
116
124
|
JudgeError,
|
|
117
125
|
MigrationError,
|
|
118
126
|
NotLinkedError,
|
package/src/testing.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { join } from "node:path";
|
|
|
4
4
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import type { SQL } from "bun";
|
|
6
6
|
import { agentClaim } from "./core/agents/agent-claim.ts";
|
|
7
|
+
import { ownerAttachmentDir } from "./core/attachments/attachment-dir.ts";
|
|
8
|
+
import { attachmentPort } from "./core/attachments/attachment-port.ts";
|
|
7
9
|
import { DISCORD, type DiscordServices } from "./core/builtin/discord.ts";
|
|
8
10
|
import type {
|
|
9
11
|
ConversationPort,
|
|
@@ -486,6 +488,7 @@ export async function testPlugin(
|
|
|
486
488
|
}),
|
|
487
489
|
);
|
|
488
490
|
services.checkRequires();
|
|
491
|
+
const attachmentDir = mkdtempSync(join(tmpdir(), "roundtable-test-plugin-"));
|
|
489
492
|
const context: Omit<PluginContext, "services" | "directChannels"> = {
|
|
490
493
|
logger,
|
|
491
494
|
env,
|
|
@@ -494,6 +497,11 @@ export async function testPlugin(
|
|
|
494
497
|
toolTiers: tiers,
|
|
495
498
|
events: sink,
|
|
496
499
|
conversations,
|
|
500
|
+
attachments: attachmentPort({
|
|
501
|
+
dataDir: attachmentDir,
|
|
502
|
+
registry: () => services.find(CONVERSATIONS),
|
|
503
|
+
logger,
|
|
504
|
+
}),
|
|
497
505
|
surfaces,
|
|
498
506
|
turns,
|
|
499
507
|
database: () => {
|
|
@@ -518,7 +526,6 @@ export async function testPlugin(
|
|
|
518
526
|
// With a team given, the agent server's claim and its target are in the router, as on a host.
|
|
519
527
|
const team = given.get(AGENTS.id)?.given;
|
|
520
528
|
const agentServer = team && "team" in team ? services.get(AGENTS) : undefined;
|
|
521
|
-
const attachmentDir = mkdtempSync(join(tmpdir(), "roundtable-test-plugin-"));
|
|
522
529
|
const identity = services.find(IDENTITY);
|
|
523
530
|
// Who wrote a message, and whom a background turn runs as: by the given IDENTITY, else the owner alone, at the owner tier.
|
|
524
531
|
const people = mapIdentity({ owners: [owner.id] });
|
|
@@ -625,6 +632,7 @@ export async function testPlugin(
|
|
|
625
632
|
conversation: { visibility: "shared" },
|
|
626
633
|
addressee: THE_SPEAKER,
|
|
627
634
|
memory: "speaker",
|
|
635
|
+
attachmentDir: ownerAttachmentDir(attachmentDir, channel),
|
|
628
636
|
speaker: () => runOptions?.speaker,
|
|
629
637
|
runTask: async () => {
|
|
630
638
|
throw new Error("test session cannot run tasks");
|