@getpaseo/cli 0.3.0 → 0.4.0-beta.1

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 (93) hide show
  1. package/dist/cli.js +0 -5
  2. package/dist/commands/hub/authority.d.ts +17 -0
  3. package/dist/commands/hub/authority.js +18 -0
  4. package/dist/commands/hub/connect.d.ts +21 -0
  5. package/dist/commands/hub/connect.js +34 -0
  6. package/dist/commands/hub/credentials.d.ts +21 -0
  7. package/dist/commands/hub/credentials.js +143 -0
  8. package/dist/commands/hub/daemon-client.d.ts +27 -0
  9. package/dist/commands/hub/daemon-client.js +14 -0
  10. package/dist/commands/hub/deploy-bundle.d.ts +16 -0
  11. package/dist/commands/hub/deploy-bundle.js +248 -0
  12. package/dist/commands/hub/deploy.d.ts +25 -4
  13. package/dist/commands/hub/deploy.js +64 -48
  14. package/dist/commands/hub/disconnect.d.ts +16 -0
  15. package/dist/commands/hub/disconnect.js +24 -0
  16. package/dist/commands/hub/error.d.ts +1 -1
  17. package/dist/commands/hub/error.js +2 -2
  18. package/dist/commands/hub/help.d.ts +3 -0
  19. package/dist/commands/hub/help.js +5 -0
  20. package/dist/commands/hub/hub-client/index.d.ts +18 -0
  21. package/dist/commands/hub/hub-client/index.js +88 -0
  22. package/dist/commands/hub/hub-client/internal/contracts.d.ts +65 -0
  23. package/dist/commands/hub/hub-client/internal/contracts.js +47 -0
  24. package/dist/commands/hub/hub-client/internal/problem.d.ts +3 -0
  25. package/dist/commands/hub/hub-client/internal/problem.js +72 -0
  26. package/dist/commands/hub/hub-client/internal/transport.d.ts +15 -0
  27. package/dist/commands/hub/hub-client/internal/transport.js +30 -0
  28. package/dist/commands/hub/index.d.ts +15 -25
  29. package/dist/commands/hub/index.js +64 -74
  30. package/dist/commands/hub/{device-authorization.d.ts → login-flow.d.ts} +12 -15
  31. package/dist/commands/hub/login-flow.js +78 -0
  32. package/dist/commands/hub/login.d.ts +21 -0
  33. package/dist/commands/hub/login.js +34 -0
  34. package/dist/commands/hub/logout.d.ts +31 -0
  35. package/dist/commands/hub/logout.js +65 -0
  36. package/dist/commands/hub/origin.d.ts +2 -0
  37. package/dist/commands/hub/origin.js +27 -0
  38. package/dist/commands/hub/projects.d.ts +24 -0
  39. package/dist/commands/hub/projects.js +49 -0
  40. package/dist/commands/hub/reporter.d.ts +10 -0
  41. package/dist/commands/hub/reporter.js +11 -0
  42. package/dist/commands/hub/status-output.d.ts +13 -0
  43. package/dist/commands/hub/status-output.js +30 -0
  44. package/dist/commands/provider/diagnostic.d.ts +12 -0
  45. package/dist/commands/provider/diagnostic.js +31 -0
  46. package/dist/commands/provider/index.js +5 -0
  47. package/dist/commands/schedule/types.d.ts +1 -4
  48. package/dist/commands/workspace/index.js +10 -0
  49. package/dist/commands/workspace/rename.d.ts +22 -0
  50. package/dist/commands/workspace/rename.js +61 -0
  51. package/dist/output/types.d.ts +1 -1
  52. package/package.json +4 -4
  53. package/dist/commands/chat/create.d.ts +0 -9
  54. package/dist/commands/chat/create.js +0 -23
  55. package/dist/commands/chat/delete.d.ts +0 -6
  56. package/dist/commands/chat/delete.js +0 -20
  57. package/dist/commands/chat/index.d.ts +0 -3
  58. package/dist/commands/chat/index.js +0 -47
  59. package/dist/commands/chat/inspect.d.ts +0 -6
  60. package/dist/commands/chat/inspect.js +0 -20
  61. package/dist/commands/chat/ls.d.ts +0 -6
  62. package/dist/commands/chat/ls.js +0 -20
  63. package/dist/commands/chat/post.d.ts +0 -9
  64. package/dist/commands/chat/post.js +0 -28
  65. package/dist/commands/chat/read.d.ts +0 -11
  66. package/dist/commands/chat/read.js +0 -40
  67. package/dist/commands/chat/schema.d.ts +0 -36
  68. package/dist/commands/chat/schema.js +0 -81
  69. package/dist/commands/chat/shared.d.ts +0 -19
  70. package/dist/commands/chat/shared.js +0 -118
  71. package/dist/commands/chat/wait.d.ts +0 -9
  72. package/dist/commands/chat/wait.js +0 -45
  73. package/dist/commands/hub/client.d.ts +0 -19
  74. package/dist/commands/hub/client.js +0 -114
  75. package/dist/commands/hub/cloud-device-authorization.d.ts +0 -45
  76. package/dist/commands/hub/cloud-device-authorization.js +0 -92
  77. package/dist/commands/hub/deploy-input.d.ts +0 -17
  78. package/dist/commands/hub/deploy-input.js +0 -264
  79. package/dist/commands/hub/device-authorization.js +0 -87
  80. package/dist/commands/loop/index.d.ts +0 -3
  81. package/dist/commands/loop/index.js +0 -18
  82. package/dist/commands/loop/inspect.d.ts +0 -13
  83. package/dist/commands/loop/inspect.js +0 -100
  84. package/dist/commands/loop/logs.d.ts +0 -8
  85. package/dist/commands/loop/logs.js +0 -69
  86. package/dist/commands/loop/ls.d.ts +0 -18
  87. package/dist/commands/loop/ls.js +0 -62
  88. package/dist/commands/loop/run.d.ts +0 -30
  89. package/dist/commands/loop/run.js +0 -162
  90. package/dist/commands/loop/stop.d.ts +0 -15
  91. package/dist/commands/loop/stop.js +0 -56
  92. package/dist/commands/loop/types.d.ts +0 -138
  93. package/dist/commands/loop/types.js +0 -2
@@ -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
@@ -22,10 +22,7 @@ export type ScheduleTarget = {
22
22
  model?: string;
23
23
  thinkingOptionId?: string;
24
24
  title?: string | null;
25
- approvalPolicy?: string;
26
- sandboxMode?: string;
27
- networkAccess?: boolean;
28
- webSearch?: boolean;
25
+ providerOptions?: Record<string, unknown>;
29
26
  };
30
27
  };
31
28
  export interface ScheduleRunRecord {
@@ -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
@@ -58,7 +58,7 @@ export interface ListResult<T> {
58
58
  schema: OutputSchema<T>;
59
59
  }
60
60
  /** Union type for all command results */
61
- export type AnyCommandResult<T> = SingleResult<T> | ListResult<T>;
61
+ export type AnyCommandResult<T> = T extends unknown ? SingleResult<T> | ListResult<T> : never;
62
62
  /** Base interface for command results (deprecated, use SingleResult or ListResult) */
63
63
  export type CommandResult<T> = SingleResult<T> | ListResult<T>;
64
64
  /** Structured error for command failures */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.0-beta.1",
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.0",
32
- "@getpaseo/protocol": "0.3.0",
33
- "@getpaseo/server": "0.3.0",
31
+ "@getpaseo/client": "0.4.0-beta.1",
32
+ "@getpaseo/protocol": "0.4.0-beta.1",
33
+ "@getpaseo/server": "0.4.0-beta.1",
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
@@ -1,36 +0,0 @@
1
- import type { OutputSchema } from "../../output/index.js";
2
- export interface ChatRoomRow {
3
- name: string;
4
- id: string;
5
- purpose: string;
6
- messages: number;
7
- lastMessageAt: string;
8
- }
9
- export interface ChatMessageRow {
10
- id: string;
11
- author: string;
12
- authorName: string | null;
13
- createdAt: string;
14
- replyTo: string;
15
- mentionAgentIds: string[];
16
- mentionLabels: string[];
17
- body: string;
18
- }
19
- export declare const chatRoomSchema: OutputSchema<ChatRoomRow>;
20
- export declare const chatMessageSchema: OutputSchema<ChatMessageRow>;
21
- export declare function toChatRoomRow(room: {
22
- id: string;
23
- name: string;
24
- purpose: string | null;
25
- messageCount: number;
26
- lastMessageAt: string | null;
27
- }): ChatRoomRow;
28
- export declare function toChatMessageRow(message: {
29
- id: string;
30
- authorAgentId: string;
31
- createdAt: string;
32
- replyToMessageId: string | null;
33
- mentionAgentIds: string[];
34
- body: string;
35
- }): ChatMessageRow;
36
- //# sourceMappingURL=schema.d.ts.map
@@ -1,81 +0,0 @@
1
- export const chatRoomSchema = {
2
- idField: "id",
3
- columns: [
4
- { header: "NAME", field: "name", width: 22 },
5
- { header: "ID", field: "id", width: 36 },
6
- { header: "PURPOSE", field: "purpose", width: 30 },
7
- { header: "MESSAGES", field: "messages", width: 10, align: "right" },
8
- { header: "LAST MESSAGE", field: "lastMessageAt", width: 24 },
9
- ],
10
- };
11
- export const chatMessageSchema = {
12
- idField: "id",
13
- columns: [
14
- { header: "ID", field: "id", width: 36 },
15
- { header: "AUTHOR", field: "author", width: 16 },
16
- { header: "AUTHOR NAME", field: (row) => row.authorName ?? "-", width: 20 },
17
- { header: "CREATED", field: "createdAt", width: 24 },
18
- { header: "REPLY TO", field: "replyTo", width: 36 },
19
- { header: "MENTIONS", field: (row) => row.mentionLabels.join(", ") || "-", width: 24 },
20
- { header: "MESSAGE", field: "body", width: 60 },
21
- ],
22
- renderHuman: renderChatTranscript,
23
- };
24
- function renderChatTranscript(result, _options) {
25
- const data = result.type === "list" ? result.data : [result.data];
26
- if (data.length === 0) {
27
- return "";
28
- }
29
- return data.map(renderChatMessageBlock).join("\n\n");
30
- }
31
- function renderChatMessageBlock(message) {
32
- const authorLabel = message.authorName
33
- ? `${message.authorName} (${message.author})`
34
- : message.author;
35
- const lines = [
36
- `┌─ ${authorLabel} ── ${formatTimestamp(message.createdAt)} ── [msg ${message.id}]`,
37
- ];
38
- if (message.replyTo !== "-") {
39
- lines.push(`│ reply-to: msg ${message.replyTo}`);
40
- }
41
- if (message.mentionLabels.length > 0) {
42
- lines.push(`│ mentions: ${message.mentionLabels.join(", ")}`);
43
- }
44
- lines.push("│");
45
- const bodyLines = message.body.split(/\r?\n/);
46
- for (const line of bodyLines) {
47
- lines.push(`│ ${line}`);
48
- }
49
- lines.push("│");
50
- lines.push("└─");
51
- return lines.join("\n");
52
- }
53
- function formatTimestamp(input) {
54
- const date = new Date(input);
55
- if (Number.isNaN(date.getTime())) {
56
- return input;
57
- }
58
- return date.toISOString().replace("T", " ").replace(".000Z", "Z");
59
- }
60
- export function toChatRoomRow(room) {
61
- return {
62
- id: room.id,
63
- name: room.name,
64
- purpose: room.purpose ?? "-",
65
- messages: room.messageCount,
66
- lastMessageAt: room.lastMessageAt ?? "-",
67
- };
68
- }
69
- export function toChatMessageRow(message) {
70
- return {
71
- id: message.id,
72
- author: message.authorAgentId,
73
- authorName: null,
74
- createdAt: message.createdAt,
75
- replyTo: message.replyToMessageId ?? "-",
76
- mentionAgentIds: message.mentionAgentIds,
77
- mentionLabels: message.mentionAgentIds,
78
- body: message.body,
79
- };
80
- }
81
- //# sourceMappingURL=schema.js.map
@@ -1,19 +0,0 @@
1
- import { connectToDaemon } from "../../utils/client.js";
2
- import type { CommandError, CommandOptions } from "../../output/index.js";
3
- import type { ChatMessageRow } from "./schema.js";
4
- export interface ChatCommandOptions extends CommandOptions {
5
- host?: string;
6
- }
7
- export declare function connectChatClient(host?: string): Promise<{
8
- client: import("@getpaseo/client/internal/daemon-client").DaemonClient;
9
- daemonHost: string;
10
- }>;
11
- export declare function attachAgentNamesToMessages(client: Awaited<ReturnType<typeof connectToDaemon>>, messages: ChatMessageRow[], options?: {
12
- timeout?: number;
13
- bestEffort?: boolean;
14
- }): Promise<ChatMessageRow[]>;
15
- export declare function toChatCommandError(code: string, action: string, err: unknown): CommandError;
16
- export declare function parseSinceValue(input?: string): string | undefined;
17
- export declare function parseTimeoutMs(input?: string): number | undefined;
18
- export declare function resolveChatAuthorAgentId(): string;
19
- //# sourceMappingURL=shared.d.ts.map