@getpaseo/cli 0.3.1 → 0.4.0-beta.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.
Files changed (62) hide show
  1. package/dist/cli.js +0 -5
  2. package/dist/commands/hub/connect.d.ts +1 -1
  3. package/dist/commands/hub/deploy-bundle.d.ts +16 -0
  4. package/dist/commands/hub/deploy-bundle.js +248 -0
  5. package/dist/commands/hub/deploy.d.ts +3 -2
  6. package/dist/commands/hub/deploy.js +17 -10
  7. package/dist/commands/hub/hub-client/index.d.ts +18 -0
  8. package/dist/commands/hub/hub-client/index.js +88 -0
  9. package/dist/commands/hub/{client.d.ts → hub-client/internal/contracts.d.ts} +16 -22
  10. package/dist/commands/hub/hub-client/internal/contracts.js +47 -0
  11. package/dist/commands/hub/hub-client/internal/problem.d.ts +3 -0
  12. package/dist/commands/hub/hub-client/internal/problem.js +72 -0
  13. package/dist/commands/hub/hub-client/internal/transport.d.ts +15 -0
  14. package/dist/commands/hub/hub-client/internal/transport.js +30 -0
  15. package/dist/commands/hub/index.d.ts +1 -1
  16. package/dist/commands/hub/index.js +1 -1
  17. package/dist/commands/hub/login-flow.d.ts +1 -1
  18. package/dist/commands/hub/projects.d.ts +1 -1
  19. package/dist/commands/provider/diagnostic.d.ts +12 -0
  20. package/dist/commands/provider/diagnostic.js +31 -0
  21. package/dist/commands/provider/index.js +5 -0
  22. package/dist/commands/workspace/index.js +10 -0
  23. package/dist/commands/workspace/rename.d.ts +22 -0
  24. package/dist/commands/workspace/rename.js +61 -0
  25. package/package.json +4 -4
  26. package/dist/commands/chat/create.d.ts +0 -9
  27. package/dist/commands/chat/create.js +0 -23
  28. package/dist/commands/chat/delete.d.ts +0 -6
  29. package/dist/commands/chat/delete.js +0 -20
  30. package/dist/commands/chat/index.d.ts +0 -3
  31. package/dist/commands/chat/index.js +0 -47
  32. package/dist/commands/chat/inspect.d.ts +0 -6
  33. package/dist/commands/chat/inspect.js +0 -20
  34. package/dist/commands/chat/ls.d.ts +0 -6
  35. package/dist/commands/chat/ls.js +0 -20
  36. package/dist/commands/chat/post.d.ts +0 -9
  37. package/dist/commands/chat/post.js +0 -28
  38. package/dist/commands/chat/read.d.ts +0 -11
  39. package/dist/commands/chat/read.js +0 -40
  40. package/dist/commands/chat/schema.d.ts +0 -36
  41. package/dist/commands/chat/schema.js +0 -81
  42. package/dist/commands/chat/shared.d.ts +0 -19
  43. package/dist/commands/chat/shared.js +0 -118
  44. package/dist/commands/chat/wait.d.ts +0 -9
  45. package/dist/commands/chat/wait.js +0 -45
  46. package/dist/commands/hub/client.js +0 -234
  47. package/dist/commands/hub/deploy-input.d.ts +0 -17
  48. package/dist/commands/hub/deploy-input.js +0 -264
  49. package/dist/commands/loop/index.d.ts +0 -3
  50. package/dist/commands/loop/index.js +0 -18
  51. package/dist/commands/loop/inspect.d.ts +0 -13
  52. package/dist/commands/loop/inspect.js +0 -100
  53. package/dist/commands/loop/logs.d.ts +0 -8
  54. package/dist/commands/loop/logs.js +0 -69
  55. package/dist/commands/loop/ls.d.ts +0 -18
  56. package/dist/commands/loop/ls.js +0 -62
  57. package/dist/commands/loop/run.d.ts +0 -30
  58. package/dist/commands/loop/run.js +0 -162
  59. package/dist/commands/loop/stop.d.ts +0 -15
  60. package/dist/commands/loop/stop.js +0 -56
  61. package/dist/commands/loop/types.d.ts +0 -138
  62. package/dist/commands/loop/types.js +0 -2
@@ -0,0 +1,72 @@
1
+ import { z } from "zod";
2
+ import { HubCommandError } from "../../error.js";
3
+ const issuePathSchema = z.union([z.string(), z.array(z.union([z.string(), z.number()]))]);
4
+ const fieldIssueSchema = z.object({
5
+ field: z.string().optional(),
6
+ path: issuePathSchema.optional(),
7
+ message: z.string(),
8
+ });
9
+ const problemSchema = z.object({
10
+ type: z.string().optional(),
11
+ title: z.string().optional(),
12
+ status: z.number().int().optional(),
13
+ detail: z.string().optional(),
14
+ instance: z.string().optional(),
15
+ errors: z
16
+ .union([z.array(fieldIssueSchema), z.record(z.string(), z.array(z.string()))])
17
+ .optional(),
18
+ issues: z.array(fieldIssueSchema).optional(),
19
+ });
20
+ export async function hubRequestFailure(response, failureMessage, apiKey) {
21
+ const contentType = response.headers.get("content-type") ?? "";
22
+ if (!contentType.toLowerCase().includes("application/problem+json")) {
23
+ return new HubCommandError("HUB_REQUEST_FAILED", `${failureMessage} with HTTP ${response.status}.`);
24
+ }
25
+ let body;
26
+ try {
27
+ body = await response.json();
28
+ }
29
+ catch {
30
+ return new HubCommandError("HUB_INVALID_RESPONSE", `Hub returned malformed problem details for HTTP ${response.status}.`);
31
+ }
32
+ const parsed = problemSchema.safeParse(body);
33
+ if (!parsed.success ||
34
+ (parsed.data.status !== undefined && parsed.data.status !== response.status)) {
35
+ return new HubCommandError("HUB_INVALID_RESPONSE", `Hub returned nonconforming problem details for HTTP ${response.status}.`);
36
+ }
37
+ const title = parsed.data.title ?? `${failureMessage} with HTTP ${response.status}`;
38
+ const message = parsed.data.detail === undefined ? title : `${title}: ${parsed.data.detail}`;
39
+ const details = formatFieldIssues(parsed.data.errors, parsed.data.issues);
40
+ const code = response.status === 422 ? "HUB_VALIDATION_FAILED" : "HUB_REQUEST_FAILED";
41
+ return new HubCommandError(code, redactSecret(message, apiKey), details === undefined ? undefined : redactSecret(details, apiKey));
42
+ }
43
+ function formatFieldIssues(errors, issues) {
44
+ const fieldIssues = Array.isArray(errors) ? errors : issues;
45
+ if (fieldIssues !== undefined) {
46
+ const lines = fieldIssues.map((issue) => {
47
+ const field = issue.field ?? formatIssuePath(issue.path);
48
+ return field === undefined ? issue.message : `${field}: ${issue.message}`;
49
+ });
50
+ return lines.length === 0 ? undefined : lines.join("\n");
51
+ }
52
+ if (errors === undefined)
53
+ return undefined;
54
+ const lines = Object.entries(errors).flatMap(([field, messages]) => messages.map((message) => `${field}: ${message}`));
55
+ return lines.length === 0 ? undefined : lines.join("\n");
56
+ }
57
+ function formatIssuePath(path) {
58
+ if (path === undefined || typeof path === "string")
59
+ return path;
60
+ let formatted = "";
61
+ for (const segment of path) {
62
+ if (typeof segment === "number")
63
+ formatted += `[${segment}]`;
64
+ else
65
+ formatted += formatted.length === 0 ? segment : `.${segment}`;
66
+ }
67
+ return formatted || undefined;
68
+ }
69
+ function redactSecret(value, secret) {
70
+ return secret === undefined ? value : value.split(secret).join("[redacted]");
71
+ }
72
+ //# sourceMappingURL=problem.js.map
@@ -0,0 +1,15 @@
1
+ import type { z } from "zod";
2
+ interface HubRequest<T> {
3
+ origin: string;
4
+ path: string;
5
+ method: "GET" | "POST";
6
+ apiKey?: string;
7
+ body?: unknown;
8
+ successStatus: number;
9
+ schema: z.ZodType<T>;
10
+ timeoutMilliseconds?: number;
11
+ failureMessage: string;
12
+ }
13
+ export declare function requestHub<T>(input: HubRequest<T>): Promise<T>;
14
+ export {};
15
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { HubCommandError } from "../../error.js";
2
+ import { hubRequestFailure } from "./problem.js";
3
+ export async function requestHub(input) {
4
+ const signal = AbortSignal.timeout(input.timeoutMilliseconds ?? 15000);
5
+ let response;
6
+ try {
7
+ response = await fetch(`${input.origin}${input.path}`, {
8
+ method: input.method,
9
+ headers: {
10
+ ...(input.apiKey === undefined ? {} : { authorization: `Bearer ${input.apiKey}` }),
11
+ ...(input.body === undefined ? {} : { "content-type": "application/json" }),
12
+ },
13
+ ...(input.body === undefined ? {} : { body: JSON.stringify(input.body) }),
14
+ signal,
15
+ });
16
+ }
17
+ catch {
18
+ throw new HubCommandError("HUB_NETWORK_ERROR", `Could not reach Paseo Hub at ${input.origin}. Check the Hub URL and network connection.`);
19
+ }
20
+ if (response.status !== input.successStatus) {
21
+ throw await hubRequestFailure(response, input.failureMessage, input.apiKey);
22
+ }
23
+ try {
24
+ return input.schema.parse(await response.json());
25
+ }
26
+ catch {
27
+ throw new HubCommandError("HUB_INVALID_RESPONSE", "Hub returned a malformed response.");
28
+ }
29
+ }
30
+ //# sourceMappingURL=transport.js.map
@@ -1,5 +1,5 @@
1
1
  import { Command } from "commander";
2
- import { HubHttpClient } from "./client.js";
2
+ import { HubHttpClient } from "./hub-client/index.js";
3
3
  import { type HubCredentialStore } from "./credentials.js";
4
4
  import { type HubDaemonConnection } from "./daemon-client.js";
5
5
  import { type CliLoginFlow } from "./login-flow.js";
@@ -1,7 +1,7 @@
1
1
  import { Command } from "commander";
2
2
  import { withOutput } from "../../output/index.js";
3
3
  import { addJsonAndDaemonHostOptions } from "../../utils/command-options.js";
4
- import { HubHttpClient } from "./client.js";
4
+ import { HubHttpClient } from "./hub-client/index.js";
5
5
  import { addHubConnectCommand } from "./connect.js";
6
6
  import { PrivateHubCredentialStore } from "./credentials.js";
7
7
  import { productionHubDaemonConnection, withHubDaemon, } from "./daemon-client.js";
@@ -1,4 +1,4 @@
1
- import type { HubHttpClient } from "./client.js";
1
+ import type { HubHttpClient } from "./hub-client/index.js";
2
2
  export interface LoginWaiter {
3
3
  wait(milliseconds: number): Promise<void>;
4
4
  now(): number;
@@ -1,6 +1,6 @@
1
1
  import type { Command } from "commander";
2
2
  import { type SingleResult } from "../../output/index.js";
3
- import type { HubHttpClient, HubProject } from "./client.js";
3
+ import type { HubHttpClient, HubProject } from "./hub-client/index.js";
4
4
  import type { HubCredentialStore } from "./credentials.js";
5
5
  import { type HubReporter } from "./reporter.js";
6
6
  interface HubProjectsResult {
@@ -0,0 +1,12 @@
1
+ import type { Command } from "commander";
2
+ import type { CommandOptions, OutputSchema, SingleResult } from "../../output/index.js";
3
+ export interface ProviderDiagnosticResult {
4
+ provider: string;
5
+ diagnostic: string;
6
+ }
7
+ export declare const providerDiagnosticSchema: OutputSchema<ProviderDiagnosticResult>;
8
+ export interface ProviderDiagnosticOptions extends CommandOptions {
9
+ host?: string;
10
+ }
11
+ export declare function runDiagnosticCommand(provider: string, options: ProviderDiagnosticOptions, _command: Command): Promise<SingleResult<ProviderDiagnosticResult>>;
12
+ //# sourceMappingURL=diagnostic.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { connectToDaemon } from "../../utils/client.js";
2
+ export const providerDiagnosticSchema = {
3
+ idField: "provider",
4
+ columns: [
5
+ { header: "PROVIDER", field: "provider" },
6
+ { header: "DIAGNOSTIC", field: "diagnostic" },
7
+ ],
8
+ renderHuman(result) {
9
+ if (result.type === "single")
10
+ return result.data.diagnostic;
11
+ return result.data.map((entry) => entry.diagnostic).join("\n\n");
12
+ },
13
+ };
14
+ export async function runDiagnosticCommand(provider, options, _command) {
15
+ const client = await connectToDaemon({ host: options.host });
16
+ try {
17
+ const result = await client.getProviderDiagnostic(provider.trim().toLowerCase());
18
+ return {
19
+ type: "single",
20
+ data: {
21
+ provider: result.provider,
22
+ diagnostic: result.diagnostic,
23
+ },
24
+ schema: providerDiagnosticSchema,
25
+ };
26
+ }
27
+ finally {
28
+ await client.close();
29
+ }
30
+ }
31
+ //# sourceMappingURL=diagnostic.js.map
@@ -1,6 +1,7 @@
1
1
  import { Command } from "commander";
2
2
  import { runLsCommand } from "./ls.js";
3
3
  import { runModelsCommand } from "./models.js";
4
+ import { runDiagnosticCommand } from "./diagnostic.js";
4
5
  import { withOutput } from "../../output/index.js";
5
6
  import { addJsonAndDaemonHostOptions } from "../../utils/command-options.js";
6
7
  export function createProviderCommand() {
@@ -11,6 +12,10 @@ export function createProviderCommand() {
11
12
  .description("List models for a provider")
12
13
  .argument("<provider>", "Provider name (claude, codex, opencode)")
13
14
  .option("--thinking", "Include thinking option IDs for each model")).action(withOutput(runModelsCommand));
15
+ addJsonAndDaemonHostOptions(provider
16
+ .command("diagnostic")
17
+ .description("Show provider installation, environment, and availability diagnostics")
18
+ .argument("<provider>", "Provider name")).action(withOutput(runDiagnosticCommand));
14
19
  return provider;
15
20
  }
16
21
  //# sourceMappingURL=index.js.map
@@ -4,6 +4,7 @@ import { addJsonAndDaemonHostOptions } from "../../utils/command-options.js";
4
4
  import { runArchiveCommand } from "./archive.js";
5
5
  import { runCreateCommand } from "./create.js";
6
6
  import { runLsCommand } from "./ls.js";
7
+ import { runRenameCommand } from "./rename.js";
7
8
  export function createWorkspaceCommand() {
8
9
  const workspace = new Command("workspace").description("Manage workspaces");
9
10
  addJsonAndDaemonHostOptions(workspace
@@ -21,6 +22,15 @@ export function createWorkspaceCommand() {
21
22
  .option("--pr-number <n>", "Pull request or change request number (--mode checkout-pr)")
22
23
  .option("--forge <forge>", "Forge for --mode checkout-pr (default: source checkout)")).action(withOutput(runCreateCommand));
23
24
  addJsonAndDaemonHostOptions(workspace.command("ls").description("List active workspaces")).action(withOutput(runLsCommand));
25
+ addJsonAndDaemonHostOptions(workspace
26
+ .command("rename")
27
+ .description("Set a workspace's user-visible title")
28
+ .argument("<workspace-id>", "Workspace id")
29
+ .argument("[title]", "New workspace title")
30
+ .option("--reset", "Clear the title and revert to the branch or directory name")
31
+ // Commander 12 accepts excess positionals by default, which would rename to
32
+ // the first word of an unquoted multi-word title and silently drop the rest.
33
+ .allowExcessArguments(false)).action(withOutput(runRenameCommand));
24
34
  addJsonAndDaemonHostOptions(workspace
25
35
  .command("archive")
26
36
  .description("Archive a workspace and everything it owns")
@@ -0,0 +1,22 @@
1
+ import type { Command } from "commander";
2
+ import type { SingleResult } from "../../output/index.js";
3
+ interface WorkspaceRenameResult {
4
+ workspaceId: string;
5
+ /** Raw title override; null once it has been reset to the derived name. */
6
+ title: string | null;
7
+ }
8
+ export interface WorkspaceRenameOptions {
9
+ host?: string;
10
+ reset?: boolean;
11
+ }
12
+ /**
13
+ * Resolve the title to send to the daemon. Null clears the override and
14
+ * reverts the workspace to its branch- or directory-derived name.
15
+ */
16
+ export declare function resolveWorkspaceTitle(input: {
17
+ title?: string;
18
+ reset?: boolean;
19
+ }): string | null;
20
+ export declare function runRenameCommand(workspaceId: string, titleArg: string | undefined, options: WorkspaceRenameOptions, _command: Command): Promise<SingleResult<WorkspaceRenameResult>>;
21
+ export {};
22
+ //# sourceMappingURL=rename.d.ts.map
@@ -0,0 +1,61 @@
1
+ import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
2
+ const workspaceRenameSchema = {
3
+ idField: "workspaceId",
4
+ columns: [
5
+ { header: "WORKSPACE ID", field: "workspaceId", width: 20 },
6
+ { header: "TITLE", field: "title", width: 30 },
7
+ ],
8
+ };
9
+ /**
10
+ * Resolve the title to send to the daemon. Null clears the override and
11
+ * reverts the workspace to its branch- or directory-derived name.
12
+ */
13
+ export function resolveWorkspaceTitle(input) {
14
+ const title = input.title?.trim() ?? "";
15
+ if (input.reset) {
16
+ if (input.title !== undefined) {
17
+ throw {
18
+ code: "INVALID_OPTIONS",
19
+ message: "--reset cannot be combined with a title",
20
+ details: "Pass a title to rename the workspace, or --reset to revert to the derived name",
21
+ };
22
+ }
23
+ return null;
24
+ }
25
+ if (title.length === 0) {
26
+ throw {
27
+ code: "MISSING_TITLE",
28
+ message: "Title cannot be empty",
29
+ details: "Usage: paseo workspace rename <workspace-id> <title> | --reset",
30
+ };
31
+ }
32
+ return title;
33
+ }
34
+ export async function runRenameCommand(workspaceId, titleArg, options, _command) {
35
+ const title = resolveWorkspaceTitle({ title: titleArg, reset: options.reset });
36
+ const host = getDaemonHost({ host: options.host });
37
+ const client = await connectToDaemon({ host: options.host }).catch((error) => {
38
+ const message = error instanceof Error ? error.message : String(error);
39
+ throw {
40
+ code: "DAEMON_NOT_RUNNING",
41
+ message: `Cannot connect to daemon at ${host}: ${message}`,
42
+ details: "Start the daemon with: paseo daemon start",
43
+ };
44
+ });
45
+ try {
46
+ const applied = await client.setWorkspaceTitle(workspaceId, title);
47
+ return {
48
+ type: "single",
49
+ data: { workspaceId, title: applied.title },
50
+ schema: workspaceRenameSchema,
51
+ };
52
+ }
53
+ catch (error) {
54
+ const message = error instanceof Error ? error.message : String(error);
55
+ throw { code: "WORKSPACE_RENAME_FAILED", message };
56
+ }
57
+ finally {
58
+ await client.close().catch(() => undefined);
59
+ }
60
+ }
61
+ //# sourceMappingURL=rename.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/cli",
3
- "version": "0.3.1",
3
+ "version": "0.4.0-beta.2",
4
4
  "description": "Paseo CLI - control your AI coding agents from the command line",
5
5
  "bin": {
6
6
  "paseo": "bin/paseo"
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@clack/prompts": "^1.0.0",
31
- "@getpaseo/client": "0.3.1",
32
- "@getpaseo/protocol": "0.3.1",
33
- "@getpaseo/server": "0.3.1",
31
+ "@getpaseo/client": "0.4.0-beta.2",
32
+ "@getpaseo/protocol": "0.4.0-beta.2",
33
+ "@getpaseo/server": "0.4.0-beta.2",
34
34
  "chalk": "^5.3.0",
35
35
  "commander": "^12.0.0",
36
36
  "mime-types": "^2.1.35",
@@ -1,9 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { SingleResult } from "../../output/index.js";
3
- import { type ChatCommandOptions } from "./shared.js";
4
- import { type ChatRoomRow } from "./schema.js";
5
- export interface ChatCreateOptions extends ChatCommandOptions {
6
- purpose?: string;
7
- }
8
- export declare function runCreateCommand(name: string, options: ChatCreateOptions, _command: Command): Promise<SingleResult<ChatRoomRow>>;
9
- //# sourceMappingURL=create.d.ts.map
@@ -1,23 +0,0 @@
1
- import { connectChatClient, toChatCommandError } from "./shared.js";
2
- import { chatRoomSchema, toChatRoomRow } from "./schema.js";
3
- export async function runCreateCommand(name, options, _command) {
4
- const { client } = await connectChatClient(options.host);
5
- try {
6
- const payload = await client.createChatRoom({
7
- name,
8
- purpose: options.purpose,
9
- });
10
- return {
11
- type: "single",
12
- data: toChatRoomRow(payload.room),
13
- schema: chatRoomSchema,
14
- };
15
- }
16
- catch (err) {
17
- throw toChatCommandError("CHAT_CREATE_FAILED", "create chat room", err);
18
- }
19
- finally {
20
- await client.close().catch(() => { });
21
- }
22
- }
23
- //# sourceMappingURL=create.js.map
@@ -1,6 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { SingleResult } from "../../output/index.js";
3
- import { type ChatCommandOptions } from "./shared.js";
4
- import { type ChatRoomRow } from "./schema.js";
5
- export declare function runDeleteCommand(room: string, options: ChatCommandOptions, _command: Command): Promise<SingleResult<ChatRoomRow>>;
6
- //# sourceMappingURL=delete.d.ts.map
@@ -1,20 +0,0 @@
1
- import { connectChatClient, toChatCommandError } from "./shared.js";
2
- import { chatRoomSchema, toChatRoomRow } from "./schema.js";
3
- export async function runDeleteCommand(room, options, _command) {
4
- const { client } = await connectChatClient(options.host);
5
- try {
6
- const payload = await client.deleteChatRoom({ room });
7
- return {
8
- type: "single",
9
- data: toChatRoomRow(payload.room),
10
- schema: chatRoomSchema,
11
- };
12
- }
13
- catch (err) {
14
- throw toChatCommandError("CHAT_DELETE_FAILED", "delete chat room", err);
15
- }
16
- finally {
17
- await client.close().catch(() => { });
18
- }
19
- }
20
- //# sourceMappingURL=delete.js.map
@@ -1,3 +0,0 @@
1
- import { Command } from "commander";
2
- export declare function createChatCommand(): Command;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,47 +0,0 @@
1
- import { Command } from "commander";
2
- import { withOutput } from "../../output/index.js";
3
- import { addJsonAndDaemonHostOptions } from "../../utils/command-options.js";
4
- import { runCreateCommand } from "./create.js";
5
- import { runLsCommand } from "./ls.js";
6
- import { runInspectCommand } from "./inspect.js";
7
- import { runDeleteCommand } from "./delete.js";
8
- import { runPostCommand } from "./post.js";
9
- import { runReadCommand } from "./read.js";
10
- import { runWaitCommand } from "./wait.js";
11
- export function createChatCommand() {
12
- const chat = new Command("chat").description("Manage chat rooms for agent coordination");
13
- addJsonAndDaemonHostOptions(chat
14
- .command("create")
15
- .description("Create a chat room")
16
- .argument("<name>", "Room name (must be unique)")
17
- .option("--purpose <text>", "Room purpose/description")).action(withOutput(runCreateCommand));
18
- addJsonAndDaemonHostOptions(chat.command("ls").description("List chat rooms")).action(withOutput(runLsCommand));
19
- addJsonAndDaemonHostOptions(chat
20
- .command("inspect")
21
- .description("Inspect a chat room")
22
- .argument("<name-or-id>", "Room name or ID")).action(withOutput(runInspectCommand));
23
- addJsonAndDaemonHostOptions(chat
24
- .command("delete")
25
- .description("Delete a chat room")
26
- .argument("<name-or-id>", "Room name or ID")).action(withOutput(runDeleteCommand));
27
- addJsonAndDaemonHostOptions(chat
28
- .command("post")
29
- .description("Post a chat message")
30
- .argument("<name-or-id>", "Room name or ID")
31
- .argument("<message>", "Message body")
32
- .option("--reply-to <msg-id>", "Reply to a specific message ID")).action(withOutput(runPostCommand));
33
- addJsonAndDaemonHostOptions(chat
34
- .command("read")
35
- .description("Read chat messages")
36
- .argument("<name-or-id>", "Room name or ID")
37
- .option("--limit <n>", "Maximum number of messages to return")
38
- .option("--since <duration-or-timestamp>", "Filter by relative duration or ISO timestamp")
39
- .option("--agent <agent-id>", "Filter by author agent ID")).action(withOutput(runReadCommand));
40
- addJsonAndDaemonHostOptions(chat
41
- .command("wait")
42
- .description("Wait for new chat messages")
43
- .argument("<name-or-id>", "Room name or ID")
44
- .option("--timeout <duration>", "Maximum wait time")).action(withOutput(runWaitCommand));
45
- return chat;
46
- }
47
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { SingleResult } from "../../output/index.js";
3
- import { type ChatCommandOptions } from "./shared.js";
4
- import { type ChatRoomRow } from "./schema.js";
5
- export declare function runInspectCommand(room: string, options: ChatCommandOptions, _command: Command): Promise<SingleResult<ChatRoomRow>>;
6
- //# sourceMappingURL=inspect.d.ts.map
@@ -1,20 +0,0 @@
1
- import { connectChatClient, toChatCommandError } from "./shared.js";
2
- import { chatRoomSchema, toChatRoomRow } from "./schema.js";
3
- export async function runInspectCommand(room, options, _command) {
4
- const { client } = await connectChatClient(options.host);
5
- try {
6
- const payload = await client.inspectChatRoom({ room });
7
- return {
8
- type: "single",
9
- data: toChatRoomRow(payload.room),
10
- schema: chatRoomSchema,
11
- };
12
- }
13
- catch (err) {
14
- throw toChatCommandError("CHAT_INSPECT_FAILED", "inspect chat room", err);
15
- }
16
- finally {
17
- await client.close().catch(() => { });
18
- }
19
- }
20
- //# sourceMappingURL=inspect.js.map
@@ -1,6 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { ListResult } from "../../output/index.js";
3
- import { type ChatCommandOptions } from "./shared.js";
4
- import { type ChatRoomRow } from "./schema.js";
5
- export declare function runLsCommand(options: ChatCommandOptions, _command: Command): Promise<ListResult<ChatRoomRow>>;
6
- //# sourceMappingURL=ls.d.ts.map
@@ -1,20 +0,0 @@
1
- import { connectChatClient, toChatCommandError } from "./shared.js";
2
- import { chatRoomSchema, toChatRoomRow } from "./schema.js";
3
- export async function runLsCommand(options, _command) {
4
- const { client } = await connectChatClient(options.host);
5
- try {
6
- const payload = await client.listChatRooms();
7
- return {
8
- type: "list",
9
- data: payload.rooms.map(toChatRoomRow),
10
- schema: chatRoomSchema,
11
- };
12
- }
13
- catch (err) {
14
- throw toChatCommandError("CHAT_LIST_FAILED", "list chat rooms", err);
15
- }
16
- finally {
17
- await client.close().catch(() => { });
18
- }
19
- }
20
- //# sourceMappingURL=ls.js.map
@@ -1,9 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { SingleResult } from "../../output/index.js";
3
- import { type ChatCommandOptions } from "./shared.js";
4
- import { type ChatMessageRow } from "./schema.js";
5
- export interface ChatPostOptions extends ChatCommandOptions {
6
- replyTo?: string;
7
- }
8
- export declare function runPostCommand(room: string, body: string, options: ChatPostOptions, _command: Command): Promise<SingleResult<ChatMessageRow>>;
9
- //# sourceMappingURL=post.d.ts.map
@@ -1,28 +0,0 @@
1
- import { attachAgentNamesToMessages, connectChatClient, resolveChatAuthorAgentId, toChatCommandError, } from "./shared.js";
2
- import { chatMessageSchema, toChatMessageRow } from "./schema.js";
3
- export async function runPostCommand(room, body, options, _command) {
4
- const { client } = await connectChatClient(options.host);
5
- try {
6
- const payload = await client.postChatMessage({
7
- room,
8
- body,
9
- authorAgentId: resolveChatAuthorAgentId(),
10
- replyToMessageId: options.replyTo,
11
- });
12
- const [message] = await attachAgentNamesToMessages(client, [
13
- toChatMessageRow(payload.message),
14
- ]);
15
- return {
16
- type: "single",
17
- data: message,
18
- schema: chatMessageSchema,
19
- };
20
- }
21
- catch (err) {
22
- throw toChatCommandError("CHAT_POST_FAILED", "post chat message", err);
23
- }
24
- finally {
25
- await client.close().catch(() => { });
26
- }
27
- }
28
- //# sourceMappingURL=post.js.map
@@ -1,11 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { ListResult } from "../../output/index.js";
3
- import { type ChatCommandOptions } from "./shared.js";
4
- import { type ChatMessageRow } from "./schema.js";
5
- export interface ChatReadOptions extends ChatCommandOptions {
6
- limit?: string;
7
- since?: string;
8
- agent?: string;
9
- }
10
- export declare function runReadCommand(room: string, options: ChatReadOptions, _command: Command): Promise<ListResult<ChatMessageRow>>;
11
- //# sourceMappingURL=read.d.ts.map
@@ -1,40 +0,0 @@
1
- import { attachAgentNamesToMessages, connectChatClient, parseSinceValue, toChatCommandError, } from "./shared.js";
2
- import { chatMessageSchema, toChatMessageRow } from "./schema.js";
3
- function parseLimit(value) {
4
- if (!value) {
5
- return undefined;
6
- }
7
- const parsed = Number.parseInt(value, 10);
8
- if (!Number.isInteger(parsed) || parsed < 0) {
9
- throw {
10
- code: "INVALID_LIMIT",
11
- message: "Invalid --limit value",
12
- details: "Use a non-negative integer.",
13
- };
14
- }
15
- return parsed;
16
- }
17
- export async function runReadCommand(room, options, _command) {
18
- const { client } = await connectChatClient(options.host);
19
- try {
20
- const payload = await client.readChatMessages({
21
- room,
22
- limit: parseLimit(options.limit),
23
- since: parseSinceValue(options.since),
24
- authorAgentId: options.agent,
25
- });
26
- const messages = await attachAgentNamesToMessages(client, payload.messages.map(toChatMessageRow));
27
- return {
28
- type: "list",
29
- data: messages,
30
- schema: chatMessageSchema,
31
- };
32
- }
33
- catch (err) {
34
- throw toChatCommandError("CHAT_READ_FAILED", "read chat messages", err);
35
- }
36
- finally {
37
- await client.close().catch(() => { });
38
- }
39
- }
40
- //# sourceMappingURL=read.js.map