feat: add chat and website updates

This commit is contained in:
Mohamed Boudra
2026-03-29 12:49:05 +07:00
parent 147482d6ed
commit 094864d779
26 changed files with 677 additions and 126 deletions
+41
View File
@@ -29,6 +29,17 @@ interface Agent {
provider: string;
}
interface ChatMessage {
id: string;
author: string;
authorName: string | null;
createdAt: string;
replyTo: string;
mentionAgentIds: string[];
mentionLabels: string[];
body: string;
}
// Schema for agents
const agentSchema: OutputSchema<Agent> = {
idField: "id",
@@ -211,6 +222,36 @@ test("render uses table format by default", () => {
assert.ok(output.includes("ID"), "Should use table format with headers");
});
test("render uses custom human renderer when provided", () => {
const chatSchema: OutputSchema<ChatMessage> = {
idField: "id",
columns: [{ header: "ID", field: "id" }],
renderHuman: (result) => {
const data = result.type === "list" ? result.data : [result.data];
return data.map((message) => `msg ${message.id}: ${message.body}`).join("\n");
},
};
const chatResult: ListResult<ChatMessage> = {
type: "list",
data: [
{
id: "m1",
author: "agent-1",
authorName: "Planner",
createdAt: "2026-03-29T10:00:00Z",
replyTo: "-",
mentionAgentIds: [],
mentionLabels: [],
body: "hello",
},
],
schema: chatSchema,
};
const output = render(chatResult, { noColor: true });
assert.strictEqual(output, "msg m1: hello", "Should use custom human renderer");
});
test("render uses json format when specified", () => {
const output = render(listResult, { format: "json" });
const parsed = JSON.parse(output);
+10 -1
View File
@@ -32,13 +32,22 @@ try {
"post",
"coord-room",
"first message for @agent-1",
]);
], {
env: { PASEO_AGENT_ID: "00000000-0000-4000-8000-000000000111" },
});
assert.strictEqual(posted.exitCode, 0, posted.stderr);
assert(posted.stdout.includes("first message"), posted.stdout);
assert(posted.stdout.includes("00000000-0000-4000-8000-000000000111"), posted.stdout);
const read = await ctx.paseo(["chat", "read", "coord-room", "--limit", "10"]);
assert.strictEqual(read.exitCode, 0, read.stderr);
assert(read.stdout.includes("first message"), read.stdout);
assert(read.stdout.includes("00000000-0000-4000-8000-000000000111"), read.stdout);
const readJson = await ctx.paseo(["chat", "read", "coord-room", "--limit", "10", "--json"]);
assert.strictEqual(readJson.exitCode, 0, readJson.stderr);
const readPayload = JSON.parse(readJson.stdout);
assert.strictEqual(readPayload[0]?.author, "00000000-0000-4000-8000-000000000111");
const waitPromise = ctx.paseo(["chat", "wait", "coord-room", "--timeout", "5s"]);
await new Promise((resolve) => setTimeout(resolve, 250));
+4 -2
View File
@@ -333,6 +333,7 @@ export async function runPaseoCli(
options?: {
timeout?: number;
cwd?: string;
env?: NodeJS.ProcessEnv;
},
): Promise<{ exitCode: number; stdout: string; stderr: string }> {
const timeout = options?.timeout ?? 60000;
@@ -348,6 +349,7 @@ export async function runPaseoCli(
...TEST_DAEMON_ENV_DEFAULTS,
PASEO_HOST: `${TEST_DAEMON_HOST}:${ctx.port}`,
PASEO_HOME: ctx.paseoHome,
...options?.env,
},
cwd,
stdio: ["ignore", "pipe", "pipe"],
@@ -399,7 +401,7 @@ export async function createE2ETestContext(options?: { timeout?: number }): Prom
/** Run a paseo CLI command against this daemon */
paseo: (
args: string[],
opts?: { timeout?: number; cwd?: string },
opts?: { timeout?: number; cwd?: string; env?: NodeJS.ProcessEnv },
) => Promise<{
exitCode: number;
stdout: string;
@@ -409,7 +411,7 @@ export async function createE2ETestContext(options?: { timeout?: number }): Prom
> {
const ctx = await startTestDaemon({ timeout: options?.timeout });
const paseo = (args: string[], opts?: { timeout?: number; cwd?: string }) =>
const paseo = (args: string[], opts?: { timeout?: number; cwd?: string; env?: NodeJS.ProcessEnv }) =>
runPaseoCli(ctx, args, opts);
return {