@getpaseo/cli 0.7.1 → 0.8.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.
- package/dist/cli.js +4 -3
- package/dist/commands/agent/index.js +3 -3
- package/dist/commands/agent/run.js +2 -0
- package/dist/commands/plugin/index.d.ts +1 -1
- package/dist/commands/plugin/index.js +21 -27
- package/dist/commands/plugin/scaffold.js +93 -373
- package/dist/commands/schedule/shared.js +2 -2
- package/dist/commands/terminal/capture.js +3 -3
- package/dist/commands/terminal/create.d.ts +1 -0
- package/dist/commands/terminal/create.js +13 -22
- package/dist/commands/terminal/index.js +9 -7
- package/dist/commands/terminal/kill.js +5 -5
- package/dist/commands/terminal/ls.d.ts +1 -0
- package/dist/commands/terminal/ls.js +6 -6
- package/dist/commands/terminal/schema.d.ts +2 -10
- package/dist/commands/terminal/schema.js +1 -7
- package/dist/commands/terminal/send-keys.js +5 -36
- package/dist/commands/terminal/shared.d.ts +3 -3
- package/dist/commands/terminal/shared.js +4 -3
- package/dist/commands/workspace/index.js +5 -0
- package/dist/commands/workspace/setup.d.ts +11 -0
- package/dist/commands/workspace/setup.js +41 -0
- package/dist/output/render.js +2 -1
- package/dist/output/with-output.js +4 -6
- package/dist/utils/client.d.ts +1 -0
- package/dist/utils/client.js +6 -2
- package/dist/utils/command-options.d.ts +1 -0
- package/dist/utils/command-options.js +8 -0
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -32,7 +32,7 @@ import { addImportOptions, runImportCommand } from "./commands/agent/import.js";
|
|
|
32
32
|
import { withOutput } from "./output/index.js";
|
|
33
33
|
import { runCloneCommand } from "./commands/clone.js";
|
|
34
34
|
import { onboardCommand } from "./commands/onboard.js";
|
|
35
|
-
import { addDaemonHostOption, addJsonAndDaemonHostOptions, addJsonOption, } from "./utils/command-options.js";
|
|
35
|
+
import { addDaemonHostOption, addJsonAndDaemonHostOptions, addJsonOption, withGlobalOptions, } from "./utils/command-options.js";
|
|
36
36
|
import { resolveCliVersion } from "./version.js";
|
|
37
37
|
const VERSION = resolveCliVersion();
|
|
38
38
|
function resolveHostnamesOption(hostnames, allowedHosts) {
|
|
@@ -54,6 +54,7 @@ export function createCli() {
|
|
|
54
54
|
.option("-q, --quiet", "minimal output (IDs only)")
|
|
55
55
|
.option("--no-headers", "omit table headers")
|
|
56
56
|
.option("--no-color", "disable colored output");
|
|
57
|
+
addDaemonHostOption(program);
|
|
57
58
|
// Primary agent commands (top-level)
|
|
58
59
|
addJsonAndDaemonHostOptions(addLsOptions(program.command("ls"))).action(withOutput(runLsCommand));
|
|
59
60
|
addJsonAndDaemonHostOptions(addRunOptions(program.command("run"))).action(withOutput(runRunCommand));
|
|
@@ -65,8 +66,8 @@ export function createCli() {
|
|
|
65
66
|
.requiredOption("--dir <path>", "Parent directory to clone into (for example: ~/workspace)"))
|
|
66
67
|
.addOption(new Option("--protocol <protocol>", "Protocol for owner/repo shorthand repositories").choices(["https", "ssh"]))
|
|
67
68
|
.action(withOutput(runCloneCommand));
|
|
68
|
-
addDaemonHostOption(addAttachOptions(program.command("attach"))).action(runAttachCommand);
|
|
69
|
-
addDaemonHostOption(addLogsOptions(program.command("logs"))).action(runLogsCommand);
|
|
69
|
+
addDaemonHostOption(addAttachOptions(program.command("attach"))).action(withGlobalOptions(runAttachCommand));
|
|
70
|
+
addDaemonHostOption(addLogsOptions(program.command("logs"))).action(withGlobalOptions(runLogsCommand));
|
|
70
71
|
addJsonAndDaemonHostOptions(addStopOptions(program.command("stop"))).action(withOutput(runStopCommand));
|
|
71
72
|
addJsonAndDaemonHostOptions(addDeleteOptions(program.command("delete"))).action(withOutput(runDeleteCommand));
|
|
72
73
|
addJsonAndDaemonHostOptions(addSendOptions(program.command("send"))).action(withOutput(runSendCommand));
|
|
@@ -16,15 +16,15 @@ import { runUpdateCommand } from "./update.js";
|
|
|
16
16
|
import { runDetachCommand } from "./detach.js";
|
|
17
17
|
import { addOpenOptions, runOpenCommand } from "./open.js";
|
|
18
18
|
import { withOutput } from "../../output/index.js";
|
|
19
|
-
import { addDaemonHostOption, addJsonAndDaemonHostOptions, collectMultiple, } from "../../utils/command-options.js";
|
|
19
|
+
import { addDaemonHostOption, addJsonAndDaemonHostOptions, collectMultiple, withGlobalOptions, } from "../../utils/command-options.js";
|
|
20
20
|
export function createAgentCommand() {
|
|
21
21
|
const agent = new Command("agent").description("Manage agents (advanced operations)");
|
|
22
22
|
// Primary agent commands (same as top-level)
|
|
23
23
|
addJsonAndDaemonHostOptions(addLsOptions(agent.command("ls"))).action(withOutput(runLsCommand));
|
|
24
24
|
addJsonAndDaemonHostOptions(addRunOptions(agent.command("run"))).action(withOutput(runRunCommand));
|
|
25
25
|
addJsonAndDaemonHostOptions(addImportOptions(agent.command("import"))).action(withOutput(runImportCommand));
|
|
26
|
-
addDaemonHostOption(addAttachOptions(agent.command("attach"))).action(runAttachCommand);
|
|
27
|
-
addDaemonHostOption(addLogsOptions(agent.command("logs"))).action(runLogsCommand);
|
|
26
|
+
addDaemonHostOption(addAttachOptions(agent.command("attach"))).action(withGlobalOptions(runAttachCommand));
|
|
27
|
+
addDaemonHostOption(addLogsOptions(agent.command("logs"))).action(withGlobalOptions(runLogsCommand));
|
|
28
28
|
addJsonAndDaemonHostOptions(addOpenOptions(agent.command("open"))).action(withOutput(runOpenCommand));
|
|
29
29
|
addJsonAndDaemonHostOptions(addStopOptions(agent.command("stop"))).action(withOutput(runStopCommand));
|
|
30
30
|
addJsonAndDaemonHostOptions(addDeleteOptions(agent.command("delete"))).action(withOutput(runDeleteCommand));
|
|
@@ -410,6 +410,8 @@ async function resolveRunWorkspace(client, options, cwd) {
|
|
|
410
410
|
const branch = result.workspace.gitRuntime?.currentBranch;
|
|
411
411
|
const label = branch ? `${result.workspace.name} (${branch})` : result.workspace.name;
|
|
412
412
|
console.error(`Created workspace ${result.workspace.id} - ${label}`);
|
|
413
|
+
if (result.setupSkippedReason)
|
|
414
|
+
console.error(result.setupSkippedReason);
|
|
413
415
|
console.error("Tip: pass --workspace <id> (or set PASEO_WORKSPACE_ID) to run in an existing workspace.");
|
|
414
416
|
return { id: result.workspace.id, cwd: result.workspace.workspaceDirectory ?? cwd };
|
|
415
417
|
}
|
|
@@ -10,7 +10,7 @@ interface PluginOptions extends CommandOptions {
|
|
|
10
10
|
all?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare function runPluginInitCommand(directory: string, options: PluginOptions, _command: Command): Promise<SingleResult<PluginScaffold>>;
|
|
13
|
-
export declare function runPluginListCommand(options: PluginOptions, _command: Command): Promise<ListResult<PluginListItem>>;
|
|
13
|
+
export declare function runPluginListCommand(pluginId: string | undefined, options: PluginOptions, _command: Command): Promise<ListResult<PluginListItem>>;
|
|
14
14
|
export declare function runPluginLogsCommand(pluginId: string, options: PluginOptions, _command: Command): Promise<ListResult<PluginLogEntry>>;
|
|
15
15
|
export declare function createPluginCommand(): Command;
|
|
16
16
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { formatPluginSourceReference, parsePluginSourceReference, } from "@getpaseo/protocol/plugin-source-reference";
|
|
3
4
|
import { withOutput } from "../../output/index.js";
|
|
4
5
|
import { addJsonAndDaemonHostOptions, addJsonOption } from "../../utils/command-options.js";
|
|
5
6
|
import { scaffoldPluginDirectory } from "./scaffold.js";
|
|
@@ -10,6 +11,9 @@ const pluginSchema = {
|
|
|
10
11
|
{ header: "PLUGIN", field: "id", width: 20 },
|
|
11
12
|
{ header: "STATUS", field: "status", width: 10 },
|
|
12
13
|
{ header: "ENABLED", field: (plugin) => (plugin.enabled ? "yes" : "no"), width: 8 },
|
|
14
|
+
{ header: "SOURCE", field: (plugin) => plugin.source ?? "directory", width: 10 },
|
|
15
|
+
{ header: "COMMIT", field: (plugin) => shortCommit(plugin.commit), width: 14 },
|
|
16
|
+
{ header: "REF", field: (plugin) => plugin.ref ?? "-", width: 24 },
|
|
13
17
|
{ header: "DIRECTORY", field: "path", width: 40 },
|
|
14
18
|
{ header: "ERROR", field: (plugin) => plugin.error ?? "", width: 40 },
|
|
15
19
|
],
|
|
@@ -32,17 +36,6 @@ const pluginLogsSchema = {
|
|
|
32
36
|
function shortCommit(commit) {
|
|
33
37
|
return commit?.slice(0, 12) ?? "-";
|
|
34
38
|
}
|
|
35
|
-
const pluginStatusSchema = {
|
|
36
|
-
idField: "id",
|
|
37
|
-
columns: [
|
|
38
|
-
{ header: "PLUGIN", field: "id", width: 20 },
|
|
39
|
-
{ header: "SOURCE", field: "source", width: 10 },
|
|
40
|
-
{ header: "CURRENT", field: (plugin) => shortCommit(plugin.currentCommit), width: 14 },
|
|
41
|
-
{ header: "LATEST", field: (plugin) => shortCommit(plugin.latestCommit), width: 14 },
|
|
42
|
-
{ header: "COMMITS", field: (plugin) => String(plugin.commitsBehind ?? 0), width: 8 },
|
|
43
|
-
{ header: "REF", field: (plugin) => plugin.ref ?? "-", width: 24 },
|
|
44
|
-
],
|
|
45
|
-
};
|
|
46
39
|
const pluginUpdateSchema = {
|
|
47
40
|
idField: "id",
|
|
48
41
|
columns: [
|
|
@@ -60,8 +53,11 @@ export async function runPluginInitCommand(directory, options, _command) {
|
|
|
60
53
|
schema: scaffoldSchema,
|
|
61
54
|
};
|
|
62
55
|
}
|
|
63
|
-
export async function runPluginListCommand(options, _command) {
|
|
64
|
-
const
|
|
56
|
+
export async function runPluginListCommand(pluginId, options, _command) {
|
|
57
|
+
const plugins = await withPluginManagementClient(options.host, (client) => client.listPlugins());
|
|
58
|
+
const data = pluginId ? plugins.filter((plugin) => plugin.id === pluginId) : plugins;
|
|
59
|
+
if (pluginId && data.length === 0)
|
|
60
|
+
throw new Error(`Plugin is not configured: ${pluginId}`);
|
|
65
61
|
return { type: "list", data, schema: pluginSchema };
|
|
66
62
|
}
|
|
67
63
|
export async function runPluginLogsCommand(pluginId, options, _command) {
|
|
@@ -69,6 +65,7 @@ export async function runPluginLogsCommand(pluginId, options, _command) {
|
|
|
69
65
|
return { type: "list", data, schema: pluginLogsSchema };
|
|
70
66
|
}
|
|
71
67
|
async function install(source, options, _command) {
|
|
68
|
+
process.stderr.write("Trusting plugin code: server code and Git build commands run unsandboxed on the daemon host; client code runs inside Paseo. Dependencies and future updates are part of the codebase you trust.\n");
|
|
72
69
|
const isExplicitPath = path.isAbsolute(source) ||
|
|
73
70
|
source === "." ||
|
|
74
71
|
source === ".." ||
|
|
@@ -76,21 +73,18 @@ async function install(source, options, _command) {
|
|
|
76
73
|
source.startsWith("../") ||
|
|
77
74
|
source.startsWith(".\\") ||
|
|
78
75
|
source.startsWith("..\\");
|
|
79
|
-
const
|
|
76
|
+
const hasPluginPathSuffix = parsePluginSourceReference(source).pluginPath !== undefined;
|
|
77
|
+
const canUseLegacyDirectoryInstall = isExplicitPath && !hasPluginPathSuffix && !options.ref && !options.path;
|
|
78
|
+
const sourceReference = formatPluginSourceReference(source, options.path);
|
|
80
79
|
const data = canUseLegacyDirectoryInstall
|
|
81
80
|
? await withPluginManagementClient(options.host, (client) => client.installDirectoryPlugin(source, options.id))
|
|
82
81
|
: await withPluginSourceClient(options.host, (client) => client.installPluginSource({
|
|
83
|
-
source,
|
|
82
|
+
source: sourceReference,
|
|
84
83
|
...(options.id ? { id: options.id } : {}),
|
|
85
84
|
...(options.ref ? { ref: options.ref } : {}),
|
|
86
|
-
...(options.path ? { pluginPath: options.path } : {}),
|
|
87
85
|
}));
|
|
88
86
|
return { type: "single", data, schema: pluginSchema };
|
|
89
87
|
}
|
|
90
|
-
async function status(pluginId, options, _command) {
|
|
91
|
-
const data = await withPluginSourceClient(options.host, (client) => client.getPluginSourceStatus(pluginId));
|
|
92
|
-
return { type: "list", data, schema: pluginStatusSchema };
|
|
93
|
-
}
|
|
94
88
|
async function update(pluginId, options, _command) {
|
|
95
89
|
if ((pluginId === undefined) === (options.all !== true)) {
|
|
96
90
|
throw new Error("Choose one plugin ID or pass --all");
|
|
@@ -113,26 +107,26 @@ async function remove(pluginId, options, _command) {
|
|
|
113
107
|
return { type: "single", data, schema: pluginSchema };
|
|
114
108
|
}
|
|
115
109
|
export function createPluginCommand() {
|
|
116
|
-
const plugin = new Command("plugin").description("Manage trusted plugins");
|
|
110
|
+
const plugin = new Command("plugin").description("Manage trusted, unsandboxed plugins");
|
|
117
111
|
addJsonOption(plugin
|
|
118
112
|
.command("init")
|
|
119
113
|
.description("Create a typecheckable local plugin")
|
|
120
114
|
.argument("<directory>")
|
|
121
115
|
.option("--id <id>", "Manifest plugin ID (defaults to the directory name)")).action(withOutput(runPluginInitCommand));
|
|
122
|
-
addJsonAndDaemonHostOptions(plugin.command("ls").description("List configured plugins")).action(withOutput(runPluginListCommand));
|
|
116
|
+
addJsonAndDaemonHostOptions(plugin.command("ls").description("List configured plugins").argument("[id]")).action(withOutput(runPluginListCommand));
|
|
117
|
+
addJsonAndDaemonHostOptions(plugin.command("status", { hidden: true }).argument("[id]")).action(withOutput(runPluginListCommand));
|
|
123
118
|
addJsonAndDaemonHostOptions(plugin.command("logs").description("Show recent plugin output").argument("<id>")).action(withOutput(runPluginLogsCommand));
|
|
124
119
|
addJsonAndDaemonHostOptions(plugin
|
|
125
120
|
.command("install")
|
|
126
121
|
.alias("add")
|
|
127
|
-
.description("
|
|
128
|
-
.argument("<source>", "Host directory,
|
|
122
|
+
.description("Trust and install a plugin from a directory or Git repository")
|
|
123
|
+
.argument("<source>", "Host directory, Git source, or Git source:plugin/path")
|
|
129
124
|
.option("--id <id>", "Runtime plugin ID (defaults to paseo-plugin.json id)")
|
|
130
125
|
.option("--ref <ref>", "Git branch, tag, or commit")
|
|
131
|
-
.option("--path <path>", "
|
|
132
|
-
addJsonAndDaemonHostOptions(plugin.command("status").description("Check plugin source updates").argument("[id]")).action(withOutput(status));
|
|
126
|
+
.option("--path <path>", "Legacy form of the :plugin/path source suffix")).action(withOutput(install));
|
|
133
127
|
addJsonAndDaemonHostOptions(plugin
|
|
134
128
|
.command("update")
|
|
135
|
-
.description("
|
|
129
|
+
.description("Fetch and install Git-managed plugin updates")
|
|
136
130
|
.argument("[id]")
|
|
137
131
|
.option("--all", "Update every Git-managed plugin")).action(withOutput(update));
|
|
138
132
|
for (const action of ["reload", "enable", "disable"]) {
|
|
@@ -1,369 +1,14 @@
|
|
|
1
1
|
import { mkdir, readdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { PluginIdSchema } from "@getpaseo/protocol/messages";
|
|
4
|
-
|
|
5
|
-
import type { PaseoApi } from "@getpaseo/client";
|
|
6
|
-
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
7
|
-
|
|
8
|
-
export interface PluginRpcContract<
|
|
9
|
-
InputSchema extends ZodType = ZodType,
|
|
10
|
-
OutputSchema extends ZodType = ZodType,
|
|
11
|
-
> {
|
|
12
|
-
name: string;
|
|
13
|
-
input: InputSchema;
|
|
14
|
-
output: OutputSchema;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface PluginAttachmentItem {
|
|
18
|
-
id: string;
|
|
19
|
-
identifier: string;
|
|
20
|
-
title: string;
|
|
21
|
-
subtitle?: string;
|
|
22
|
-
url: string;
|
|
23
|
-
text: string;
|
|
24
|
-
resourceType: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface PluginAttachmentSearchPayload {
|
|
28
|
-
items: PluginAttachmentItem[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface PluginAttachmentSourceContribution {
|
|
32
|
-
id: string;
|
|
33
|
-
title: string;
|
|
34
|
-
icon: string;
|
|
35
|
-
pickerTitle: string;
|
|
36
|
-
searchPlaceholder: string;
|
|
37
|
-
search: PluginRpcContract;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface PluginHandlerContext {
|
|
41
|
-
paseo: PaseoApi;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function defineRpc<InputSchema extends ZodType, OutputSchema extends ZodType>(definition: {
|
|
45
|
-
name: string;
|
|
46
|
-
input: InputSchema;
|
|
47
|
-
output: OutputSchema;
|
|
48
|
-
}): PluginRpcContract<InputSchema, OutputSchema>;
|
|
49
|
-
|
|
50
|
-
export function defineAttachmentSource<Definition extends PluginAttachmentSourceContribution>(
|
|
51
|
-
definition: Definition,
|
|
52
|
-
): Definition;
|
|
53
|
-
|
|
54
|
-
export const PluginAttachmentItemSchema: import("zod").ZodType<PluginAttachmentItem>;
|
|
55
|
-
export const PluginAttachmentSearchPayloadSchema: import("zod").ZodType<PluginAttachmentSearchPayload>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
declare module "@getpaseo/plugin/react-native" {
|
|
59
|
-
import type { ComponentType, FunctionComponent, ReactNode } from "react";
|
|
60
|
-
|
|
61
|
-
export interface PluginIconProps {
|
|
62
|
-
name: string;
|
|
63
|
-
size?: number;
|
|
64
|
-
color?: string;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface ModalProps {
|
|
68
|
-
title: string;
|
|
69
|
-
icon?: ReactNode;
|
|
70
|
-
open: boolean;
|
|
71
|
-
onOpenChange(open: boolean): void;
|
|
72
|
-
children: ReactNode;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface ModalContentProps {
|
|
76
|
-
children: ReactNode;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface ModalComponent extends FunctionComponent<ModalProps> {
|
|
80
|
-
Content: ComponentType<ModalContentProps>;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export type ToastVariant = "default" | "info" | "success" | "warning" | "error";
|
|
84
|
-
export interface ToastOptions {
|
|
85
|
-
variant?: ToastVariant;
|
|
86
|
-
durationMs?: number;
|
|
87
|
-
}
|
|
88
|
-
export interface ToastApi {
|
|
89
|
-
show(message: string, options?: ToastOptions): void;
|
|
90
|
-
error(message: string): void;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export const Icon: ComponentType<PluginIconProps>;
|
|
94
|
-
export const Modal: ModalComponent;
|
|
95
|
-
export function useToast(): ToastApi;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
declare module "@getpaseo/plugin" {
|
|
99
|
-
import type { ComponentType } from "react";
|
|
100
|
-
import type { PaseoApi } from "@getpaseo/client";
|
|
101
|
-
import type { AgentTimelineItem } from "@getpaseo/protocol/agent-types";
|
|
102
|
-
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
103
|
-
import type {
|
|
104
|
-
PluginAttachmentSourceContribution,
|
|
105
|
-
PluginHandlerContext,
|
|
106
|
-
PluginRpcContract,
|
|
107
|
-
} from "@getpaseo/plugin/server";
|
|
108
|
-
|
|
109
|
-
export {
|
|
110
|
-
PluginAttachmentItemSchema,
|
|
111
|
-
PluginAttachmentSearchPayloadSchema,
|
|
112
|
-
defineAttachmentSource,
|
|
113
|
-
defineRpc,
|
|
114
|
-
type PluginAttachmentItem,
|
|
115
|
-
type PluginAttachmentSearchPayload,
|
|
116
|
-
type PluginAttachmentSourceContribution,
|
|
117
|
-
type PluginHandlerContext,
|
|
118
|
-
type PluginRpcContract,
|
|
119
|
-
} from "@getpaseo/plugin/server";
|
|
120
|
-
|
|
121
|
-
export interface PluginTheme {
|
|
122
|
-
readonly colors: {
|
|
123
|
-
readonly surface0: string;
|
|
124
|
-
readonly surface1: string;
|
|
125
|
-
readonly surface2: string;
|
|
126
|
-
readonly border: string;
|
|
127
|
-
readonly foreground: string;
|
|
128
|
-
readonly foregroundMuted: string;
|
|
129
|
-
readonly accent: string;
|
|
130
|
-
readonly accentForeground: string;
|
|
131
|
-
readonly statusSuccess: string;
|
|
132
|
-
readonly statusWarning: string;
|
|
133
|
-
readonly statusDanger: string;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface PluginHostProps {
|
|
138
|
-
theme: PluginTheme;
|
|
139
|
-
host: { id: string; label: string };
|
|
140
|
-
layout: { compact: boolean; platform: "ios" | "android" | "web" };
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
interface PluginNavigableHostProps extends PluginHostProps {
|
|
144
|
-
/** Client-owned navigation. Undefined on older hosts; hide dependent affordances when absent. */
|
|
145
|
-
readonly navigation?: {
|
|
146
|
-
readonly openAgent: (input: { readonly agentId: string }) => void;
|
|
147
|
-
readonly openWorkspace: (input: { readonly workspaceId: string }) => void;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface PluginSurfaceProps extends PluginNavigableHostProps {}
|
|
152
|
-
|
|
153
|
-
export interface PluginIconProps {
|
|
154
|
-
name: string;
|
|
155
|
-
size?: number;
|
|
156
|
-
color?: string;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export interface PluginWorkspaceSnapshot {
|
|
160
|
-
readonly id: string;
|
|
161
|
-
readonly projectId: string;
|
|
162
|
-
readonly projectDisplayName: string;
|
|
163
|
-
readonly projectRootPath: string;
|
|
164
|
-
readonly directory: string;
|
|
165
|
-
readonly projectKind: "git" | "non_git" | "directory";
|
|
166
|
-
readonly kind: "directory" | "local_checkout" | "checkout" | "worktree";
|
|
167
|
-
readonly name: string;
|
|
168
|
-
readonly title: string | null;
|
|
169
|
-
readonly status: "needs_input" | "failed" | "running" | "attention" | "done";
|
|
170
|
-
readonly statusEnteredAt: string | null;
|
|
171
|
-
readonly archivingAt: string | null;
|
|
172
|
-
readonly diffStat: { readonly additions: number; readonly deletions: number } | null;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export interface PluginAgentSnapshot {
|
|
176
|
-
readonly id: string;
|
|
177
|
-
readonly workspaceId: string;
|
|
178
|
-
readonly provider: string;
|
|
179
|
-
readonly status: "initializing" | "idle" | "running" | "error" | "closed";
|
|
180
|
-
readonly createdAt: string;
|
|
181
|
-
readonly updatedAt: string;
|
|
182
|
-
readonly lastActivityAt: string;
|
|
183
|
-
readonly title: string | null;
|
|
184
|
-
readonly cwd: string;
|
|
185
|
-
readonly model: string | null;
|
|
186
|
-
readonly currentModeId: string | null;
|
|
187
|
-
readonly thinkingOptionId: string | null;
|
|
188
|
-
readonly requiresAttention: boolean;
|
|
189
|
-
readonly attentionReason: "finished" | "error" | "permission" | null;
|
|
190
|
-
readonly parentAgentId: string | null;
|
|
191
|
-
readonly labels: Readonly<Record<string, string>>;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export interface PluginWorkspacePanelProps extends PluginNavigableHostProps {
|
|
195
|
-
context: "workspace";
|
|
196
|
-
workspaceId: string;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export interface PluginAgentPanelProps extends PluginNavigableHostProps {
|
|
200
|
-
context: "agent";
|
|
201
|
-
workspaceId: string;
|
|
202
|
-
agentId: string;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface PluginComposerPillProps extends PluginHostProps {
|
|
206
|
-
workspaceId: string;
|
|
207
|
-
agentId: string;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export interface PluginComposerPillContribution {
|
|
211
|
-
id: string;
|
|
212
|
-
title: string;
|
|
213
|
-
workspaceId: string;
|
|
214
|
-
agentId: string;
|
|
215
|
-
Component: ComponentType<PluginComposerPillProps>;
|
|
216
|
-
onPress(): void | Promise<void>;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export type PluginPanelLocation = "workspace" | "explorer";
|
|
220
|
-
export interface PluginOpenPanelOptions { location?: PluginPanelLocation; }
|
|
221
|
-
export interface PluginClientOpenPanelOptions extends PluginOpenPanelOptions {
|
|
222
|
-
workspaceId: string;
|
|
223
|
-
agentId?: string;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export type PluginWorkspacePanelContribution =
|
|
227
|
-
| { id: string; title: string; icon: string; locations?: readonly PluginPanelLocation[]; context: "workspace"; Component: ComponentType<PluginWorkspacePanelProps> }
|
|
228
|
-
| { id: string; title: string; icon: string; locations?: readonly PluginPanelLocation[]; context: "agent"; Component: ComponentType<PluginAgentPanelProps> };
|
|
229
|
-
|
|
230
|
-
export interface PluginSidebarContribution {
|
|
231
|
-
id: string;
|
|
232
|
-
title: string;
|
|
233
|
-
icon: string;
|
|
234
|
-
surface: string;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export interface PluginThemeColors {
|
|
238
|
-
background: string;
|
|
239
|
-
foreground: string;
|
|
240
|
-
raised: string;
|
|
241
|
-
control: string;
|
|
242
|
-
border: string;
|
|
243
|
-
accent?: string;
|
|
244
|
-
mutedForeground: string;
|
|
245
|
-
ring: string;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export interface PluginThemeContribution {
|
|
249
|
-
id: string;
|
|
250
|
-
name: string;
|
|
251
|
-
appearance: "light" | "dark";
|
|
252
|
-
colors: PluginThemeColors;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export interface PluginSurfaceContribution {
|
|
256
|
-
id: string;
|
|
257
|
-
Component: ComponentType<PluginSurfaceProps>;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export type PluginTimelineData = null | boolean | number | string | PluginTimelineData[] | { [key: string]: PluginTimelineData };
|
|
261
|
-
export interface PluginTimelineItem { type: "plugin"; kind: string; version: number; data: PluginTimelineData; }
|
|
262
|
-
export interface PluginTimelineTransformResult { items: PluginTimelineItem[]; }
|
|
263
|
-
export type PluginTimelineTransformerContribution<ItemType extends AgentTimelineItem["type"] = AgentTimelineItem["type"]> =
|
|
264
|
-
ItemType extends AgentTimelineItem["type"]
|
|
265
|
-
? {
|
|
266
|
-
id: string;
|
|
267
|
-
query: { itemType: ItemType };
|
|
268
|
-
transform(input: { item: Extract<AgentTimelineItem, { type: ItemType }> }): PluginTimelineTransformResult | undefined;
|
|
269
|
-
}
|
|
270
|
-
: never;
|
|
271
|
-
export interface PluginTimelineItemProps<Data = unknown> extends PluginHostProps {
|
|
272
|
-
agentId: string;
|
|
273
|
-
item: { type: "plugin"; kind: string; version: number; data: Data };
|
|
274
|
-
timestamp: Date;
|
|
275
|
-
}
|
|
276
|
-
export interface PluginTimelineRendererContribution<Schema extends ZodType = ZodType> {
|
|
277
|
-
kind: string;
|
|
278
|
-
version: number;
|
|
279
|
-
schema: Schema;
|
|
280
|
-
Component: ComponentType<PluginTimelineItemProps<ZodOutput<Schema>>>;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export interface PluginCommandCapabilities {
|
|
284
|
-
paseo: PaseoApi;
|
|
285
|
-
rpc<InputSchema extends ZodType, OutputSchema extends ZodType>(
|
|
286
|
-
contract: PluginRpcContract<InputSchema, OutputSchema>,
|
|
287
|
-
input: ZodInput<InputSchema>,
|
|
288
|
-
): Promise<ZodOutput<OutputSchema>>;
|
|
289
|
-
openSurface(id: string): void;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export interface PluginGlobalCommandContext extends PluginCommandCapabilities {
|
|
293
|
-
context: "global";
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
export interface PluginWorkspaceCommandContext extends PluginCommandCapabilities {
|
|
297
|
-
context: "workspace";
|
|
298
|
-
workspace: PluginWorkspaceSnapshot;
|
|
299
|
-
openPanel(id: string, options?: PluginOpenPanelOptions): void;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export interface PluginAgentCommandContext extends PluginCommandCapabilities {
|
|
303
|
-
context: "agent";
|
|
304
|
-
workspace: PluginWorkspaceSnapshot;
|
|
305
|
-
agent: PluginAgentSnapshot;
|
|
306
|
-
openPanel(id: string, options?: PluginOpenPanelOptions): void;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export interface PluginClientContext extends PluginCommandCapabilities {
|
|
310
|
-
addComposerPill(contribution: PluginComposerPillContribution): PluginCleanup;
|
|
311
|
-
openPanel(id: string, options: PluginClientOpenPanelOptions): void;
|
|
312
|
-
}
|
|
313
|
-
export type PluginClientContribution = (client: PluginClientContext) => PluginCleanup;
|
|
314
|
-
|
|
315
|
-
export type PluginCommandCenterItemContribution =
|
|
316
|
-
| { id: string; title: string; icon: string; keywords?: readonly string[]; context: "global"; onSelect(context: PluginGlobalCommandContext): void | Promise<void> }
|
|
317
|
-
| { id: string; title: string; icon: string; keywords?: readonly string[]; context: "workspace"; onSelect(context: PluginWorkspaceCommandContext): void | Promise<void> }
|
|
318
|
-
| { id: string; title: string; icon: string; keywords?: readonly string[]; context: "agent"; onSelect(context: PluginAgentCommandContext): void | Promise<void> };
|
|
319
|
-
|
|
320
|
-
export interface PluginContext {
|
|
321
|
-
handle<InputSchema extends ZodType, OutputSchema extends ZodType>(
|
|
322
|
-
contract: PluginRpcContract<InputSchema, OutputSchema>,
|
|
323
|
-
handler: (
|
|
324
|
-
input: ZodOutput<InputSchema>,
|
|
325
|
-
context: PluginHandlerContext,
|
|
326
|
-
) => ZodInput<OutputSchema> | Promise<ZodInput<OutputSchema>>,
|
|
327
|
-
): void;
|
|
328
|
-
addSurface(id: string, Component: ComponentType<PluginSurfaceProps>): void;
|
|
329
|
-
addSidebarItem(contribution: PluginSidebarContribution): void;
|
|
330
|
-
addWorkspacePanel(contribution: PluginWorkspacePanelContribution): void;
|
|
331
|
-
addCommandCenterItem(contribution: PluginCommandCenterItemContribution): void;
|
|
332
|
-
addClientSide(contribution: PluginClientContribution): void;
|
|
333
|
-
addAttachmentSource(contribution: PluginAttachmentSourceContribution): void;
|
|
334
|
-
addTheme(contribution: PluginThemeContribution): void;
|
|
335
|
-
addTimelineTransformer<ItemType extends AgentTimelineItem["type"]>(contribution: PluginTimelineTransformerContribution<ItemType>): void;
|
|
336
|
-
addTimelineRenderer<Schema extends ZodType>(contribution: PluginTimelineRendererContribution<Schema>): void;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export type PluginCleanup = () => void | Promise<void>;
|
|
340
|
-
export type PluginContribution = (plugin: PluginContext) => PluginCleanup;
|
|
341
|
-
|
|
342
|
-
export const Icon: ComponentType<PluginIconProps>;
|
|
343
|
-
|
|
344
|
-
export function useRpc<InputSchema extends ZodType, OutputSchema extends ZodType>(
|
|
345
|
-
contract: PluginRpcContract<InputSchema, OutputSchema>,
|
|
346
|
-
): (input: ZodInput<InputSchema>) => Promise<ZodOutput<OutputSchema>>;
|
|
347
|
-
|
|
348
|
-
export function usePaseo(): PaseoApi;
|
|
349
|
-
|
|
350
|
-
export function useWorkspace<Selection>(
|
|
351
|
-
workspaceId: string,
|
|
352
|
-
selector: (workspace: PluginWorkspaceSnapshot) => Selection,
|
|
353
|
-
): Selection | null;
|
|
354
|
-
|
|
355
|
-
export function useAgent<Selection>(
|
|
356
|
-
agentId: string,
|
|
357
|
-
selector: (agent: PluginAgentSnapshot) => Selection,
|
|
358
|
-
): Selection | null;
|
|
359
|
-
}
|
|
360
|
-
`;
|
|
4
|
+
import { resolveCliVersion } from "../../version.js";
|
|
361
5
|
const TSCONFIG = {
|
|
362
6
|
compilerOptions: {
|
|
363
7
|
target: "ES2020",
|
|
364
8
|
module: "ESNext",
|
|
365
9
|
moduleResolution: "Bundler",
|
|
366
|
-
lib: ["ES2023"
|
|
10
|
+
lib: ["ES2023"],
|
|
11
|
+
types: ["react"],
|
|
367
12
|
jsx: "react-jsx",
|
|
368
13
|
strict: true,
|
|
369
14
|
skipLibCheck: true,
|
|
@@ -373,19 +18,56 @@ const TSCONFIG = {
|
|
|
373
18
|
},
|
|
374
19
|
include: ["**/*.ts", "**/*.tsx"],
|
|
375
20
|
};
|
|
376
|
-
const
|
|
377
|
-
import {
|
|
21
|
+
const CLIENT_ENTRY = `import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
22
|
+
import { GreetingSurface } from "./client/greeting";
|
|
23
|
+
|
|
24
|
+
export default function contribute(client: PluginClientContext) {
|
|
25
|
+
client.addSurface("greeting", GreetingSurface);
|
|
26
|
+
client.addSidebarItem({
|
|
27
|
+
id: "greeting",
|
|
28
|
+
title: "Greeting",
|
|
29
|
+
icon: "MessageCircle",
|
|
30
|
+
surface: "greeting",
|
|
31
|
+
});
|
|
32
|
+
return () => {};
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const SERVER_ENTRY = `import type { PluginServerContext } from "@getpaseo/plugin/server";
|
|
36
|
+
import { createGreeting } from "./server/greeting";
|
|
37
|
+
import { greetingRpc } from "./shared/greeting";
|
|
378
38
|
|
|
379
|
-
export default function contribute(
|
|
380
|
-
|
|
39
|
+
export default function contribute(server: PluginServerContext) {
|
|
40
|
+
server.handle(greetingRpc, createGreeting);
|
|
381
41
|
return () => {};
|
|
382
42
|
}
|
|
383
43
|
`;
|
|
384
|
-
const
|
|
385
|
-
import
|
|
386
|
-
|
|
44
|
+
const SHARED_GREETING = `import { defineRpc } from "@getpaseo/plugin";
|
|
45
|
+
import { z } from "zod";
|
|
46
|
+
|
|
47
|
+
export const greetingRpc = defineRpc({
|
|
48
|
+
name: "greeting.create",
|
|
49
|
+
input: z.object({ name: z.string() }),
|
|
50
|
+
output: z.object({ message: z.string() }),
|
|
51
|
+
});
|
|
52
|
+
`;
|
|
53
|
+
const SERVER_GREETING = `import type { RpcInput } from "@getpaseo/plugin";
|
|
54
|
+
import { greetingRpc } from "../shared/greeting";
|
|
387
55
|
|
|
388
|
-
export function
|
|
56
|
+
export function createGreeting({ name }: RpcInput<typeof greetingRpc>) {
|
|
57
|
+
return { message: "Hello, " + name + "!" };
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
const CLIENT_GREETING = `import type { PluginSurfaceProps } from "@getpaseo/plugin/client";
|
|
61
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
62
|
+
import { useMutation } from "@tanstack/react-query";
|
|
63
|
+
import { useMemo } from "react";
|
|
64
|
+
import { Pressable, Text, View } from "react-native";
|
|
65
|
+
import { greetingRpc } from "../shared/greeting";
|
|
66
|
+
import { openExternal } from "./web";
|
|
67
|
+
|
|
68
|
+
export function GreetingSurface({ theme, layout }: PluginSurfaceProps) {
|
|
69
|
+
const createGreeting = useRpc(greetingRpc);
|
|
70
|
+
const greeting = useMutation({ mutationFn: createGreeting });
|
|
389
71
|
const styles = useMemo(
|
|
390
72
|
() => ({
|
|
391
73
|
screen: {
|
|
@@ -394,16 +76,47 @@ export function MainSurface({ theme, layout }: PluginSurfaceProps) {
|
|
|
394
76
|
backgroundColor: theme.colors.surface0,
|
|
395
77
|
},
|
|
396
78
|
text: { color: theme.colors.foreground },
|
|
79
|
+
button: { padding: 12, backgroundColor: theme.colors.accent },
|
|
80
|
+
buttonText: { color: theme.colors.accentForeground },
|
|
397
81
|
}),
|
|
398
82
|
[theme, layout.compact],
|
|
399
83
|
);
|
|
400
84
|
return (
|
|
401
85
|
<View style={styles.screen}>
|
|
402
|
-
<Text style={styles.text}>
|
|
86
|
+
<Text style={styles.text}>{greeting.data?.message ?? "Ask the daemon for a greeting."}</Text>
|
|
87
|
+
<Pressable
|
|
88
|
+
accessibilityRole="button"
|
|
89
|
+
accessibilityLabel="Create greeting"
|
|
90
|
+
style={styles.button}
|
|
91
|
+
onPress={() => greeting.mutate({ name: "Paseo" })}
|
|
92
|
+
>
|
|
93
|
+
<Text style={styles.buttonText}>Create greeting</Text>
|
|
94
|
+
</Pressable>
|
|
95
|
+
<Pressable
|
|
96
|
+
accessibilityRole="link"
|
|
97
|
+
accessibilityLabel="Open the Paseo website"
|
|
98
|
+
style={styles.button}
|
|
99
|
+
onPress={() => openExternal("https://paseo.sh")}
|
|
100
|
+
>
|
|
101
|
+
<Text style={styles.buttonText}>Open paseo.sh</Text>
|
|
102
|
+
</Pressable>
|
|
403
103
|
</View>
|
|
404
104
|
);
|
|
405
105
|
}
|
|
406
106
|
`;
|
|
107
|
+
const CLIENT_WEB = `import { Linking, Platform } from "react-native";
|
|
108
|
+
|
|
109
|
+
// This plugin typechecks without the DOM library. Declare only what this module uses.
|
|
110
|
+
declare const window: { open(url: string, target: string, features: string): unknown };
|
|
111
|
+
|
|
112
|
+
export async function openExternal(url: string): Promise<void> {
|
|
113
|
+
if (Platform.OS === "web") {
|
|
114
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
await Linking.openURL(url);
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
407
120
|
export async function scaffoldPluginDirectory(targetDirectory, requestedId) {
|
|
408
121
|
const directory = path.resolve(targetDirectory);
|
|
409
122
|
const id = PluginIdSchema.parse(requestedId ?? path.basename(directory));
|
|
@@ -412,14 +125,14 @@ export async function scaffoldPluginDirectory(targetDirectory, requestedId) {
|
|
|
412
125
|
if (existing.length > 0) {
|
|
413
126
|
throw new Error(`Plugin directory must be empty: ${directory}`);
|
|
414
127
|
}
|
|
128
|
+
const version = resolveCliVersion();
|
|
415
129
|
const packageJson = {
|
|
416
130
|
name: id,
|
|
417
131
|
private: true,
|
|
418
132
|
version: "0.0.0",
|
|
419
133
|
scripts: { typecheck: "tsc --noEmit" },
|
|
420
134
|
devDependencies: {
|
|
421
|
-
"@getpaseo/
|
|
422
|
-
"@getpaseo/protocol": "^0.6.1",
|
|
135
|
+
"@getpaseo/plugin": version,
|
|
423
136
|
"@tanstack/react-query": "^5.90.11",
|
|
424
137
|
"@types/react": "~19.2.0",
|
|
425
138
|
react: "19.1.0",
|
|
@@ -429,13 +142,20 @@ export async function scaffoldPluginDirectory(targetDirectory, requestedId) {
|
|
|
429
142
|
},
|
|
430
143
|
};
|
|
431
144
|
const files = new Map([
|
|
432
|
-
[
|
|
145
|
+
[
|
|
146
|
+
"paseo-plugin.json",
|
|
147
|
+
`${JSON.stringify({ id, requirements: { paseo: `>=${version}` } }, null, 2)}\n`,
|
|
148
|
+
],
|
|
433
149
|
["package.json", `${JSON.stringify(packageJson, null, 2)}\n`],
|
|
434
150
|
["tsconfig.json", `${JSON.stringify(TSCONFIG, null, 2)}\n`],
|
|
435
|
-
["
|
|
436
|
-
["index.ts",
|
|
437
|
-
["
|
|
151
|
+
["index.client.tsx", CLIENT_ENTRY],
|
|
152
|
+
["index.server.ts", SERVER_ENTRY],
|
|
153
|
+
["shared/greeting.ts", SHARED_GREETING],
|
|
154
|
+
["server/greeting.ts", SERVER_GREETING],
|
|
155
|
+
["client/greeting.tsx", CLIENT_GREETING],
|
|
156
|
+
["client/web.ts", CLIENT_WEB],
|
|
438
157
|
]);
|
|
158
|
+
await Promise.all(["shared", "server", "client"].map((name) => mkdir(path.join(directory, name))));
|
|
439
159
|
await Promise.all([...files].map(([filename, contents]) => writeFile(path.join(directory, filename), contents, { flag: "wx" })));
|
|
440
160
|
return { id, directory };
|
|
441
161
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
1
|
+
import { connectToDaemon, getDaemonHost, getExplicitDaemonHost } from "../../utils/client.js";
|
|
2
2
|
import { parseDuration } from "../../utils/duration.js";
|
|
3
3
|
import { resolveProviderAndModel } from "../../utils/provider-model.js";
|
|
4
4
|
import { everyMsToFiveFieldCron } from "@getpaseo/protocol/schedule/cadence";
|
|
@@ -116,7 +116,7 @@ export function parseScheduleCreateInput(options) {
|
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
const cwdInput = options.cwd?.trim();
|
|
119
|
-
if (options.host !== undefined && !cwdInput) {
|
|
119
|
+
if (getExplicitDaemonHost(options.host) !== undefined && !cwdInput) {
|
|
120
120
|
throw {
|
|
121
121
|
code: "MISSING_CWD",
|
|
122
122
|
message: "--cwd is required when --host is specified (the local working directory will not exist on the remote daemon)",
|
|
@@ -26,7 +26,7 @@ export async function runCaptureCommand(terminalId, _options, command) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
async function executeCaptureCommand(terminalId, options) {
|
|
29
|
-
const { client } = await connectTerminalClient(options.host);
|
|
29
|
+
const { client, close } = await connectTerminalClient(options.host);
|
|
30
30
|
try {
|
|
31
31
|
const resolvedId = await resolveTerminalId(client, terminalId);
|
|
32
32
|
if (!resolvedId) {
|
|
@@ -38,7 +38,7 @@ async function executeCaptureCommand(terminalId, options) {
|
|
|
38
38
|
}
|
|
39
39
|
const start = options.scrollback ? 0 : parseLineNumber("--start", options.start);
|
|
40
40
|
const end = parseLineNumber("--end", options.end);
|
|
41
|
-
return await client.
|
|
41
|
+
return await client.terminals.ref(resolvedId).capture({
|
|
42
42
|
...(start === undefined ? {} : { start }),
|
|
43
43
|
...(end === undefined ? {} : { end }),
|
|
44
44
|
stripAnsi: !options.ansi,
|
|
@@ -48,7 +48,7 @@ async function executeCaptureCommand(terminalId, options) {
|
|
|
48
48
|
throw toTerminalCommandError("TERMINAL_CAPTURE_FAILED", "capture terminal output", err);
|
|
49
49
|
}
|
|
50
50
|
finally {
|
|
51
|
-
await
|
|
51
|
+
await close().catch(() => { });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
function parseLineNumber(flag, value) {
|
|
@@ -3,6 +3,7 @@ import type { SingleResult } from "../../output/index.js";
|
|
|
3
3
|
import { type TerminalCommandOptions } from "./shared.js";
|
|
4
4
|
import { type TerminalRow } from "./schema.js";
|
|
5
5
|
export interface TerminalCreateOptions extends TerminalCommandOptions {
|
|
6
|
+
workspace?: string;
|
|
6
7
|
cwd?: string;
|
|
7
8
|
name?: string;
|
|
8
9
|
}
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import { connectTerminalClient, toTerminalCommandError, } from "./shared.js";
|
|
2
|
-
import { terminalSchema
|
|
2
|
+
import { terminalSchema } from "./schema.js";
|
|
3
3
|
export async function runCreateCommand(options, _command) {
|
|
4
|
-
const { client } = await connectTerminalClient(options.host);
|
|
5
|
-
const cwd = options.cwd ?? process.cwd();
|
|
4
|
+
const { client, close } = await connectTerminalClient(options.host);
|
|
6
5
|
try {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
throw error;
|
|
14
|
-
}
|
|
15
|
-
const payload = await client.createTerminal(cwd, options.name, undefined, {
|
|
16
|
-
workspaceId: opened.workspace.id,
|
|
6
|
+
const cwd = options.cwd ?? (options.workspace ? undefined : process.cwd());
|
|
7
|
+
const workspaceId = options.workspace ?? (await client.workspaces.open(options.cwd ?? process.cwd())).id;
|
|
8
|
+
const terminal = await client.terminals.create({
|
|
9
|
+
workspaceId,
|
|
10
|
+
cwd,
|
|
11
|
+
name: options.name,
|
|
17
12
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
message: payload.error ?? "Failed to create terminal",
|
|
22
|
-
};
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
13
|
+
const snapshot = terminal.current();
|
|
14
|
+
if (!snapshot)
|
|
15
|
+
throw new Error("The daemon did not create a terminal");
|
|
25
16
|
return {
|
|
26
17
|
type: "single",
|
|
27
|
-
data:
|
|
18
|
+
data: snapshot,
|
|
28
19
|
schema: terminalSchema,
|
|
29
20
|
};
|
|
30
21
|
}
|
|
@@ -32,7 +23,7 @@ export async function runCreateCommand(options, _command) {
|
|
|
32
23
|
throw toTerminalCommandError("TERMINAL_CREATE_FAILED", "create terminal", err);
|
|
33
24
|
}
|
|
34
25
|
finally {
|
|
35
|
-
await
|
|
26
|
+
await close().catch(() => { });
|
|
36
27
|
}
|
|
37
28
|
}
|
|
38
29
|
//# sourceMappingURL=create.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
1
|
+
import { Command, Option } from "commander";
|
|
2
2
|
import { withOutput } from "../../output/index.js";
|
|
3
|
-
import { addDaemonHostOption, addJsonAndDaemonHostOptions } from "../../utils/command-options.js";
|
|
3
|
+
import { addDaemonHostOption, addJsonAndDaemonHostOptions, withGlobalOptions, } from "../../utils/command-options.js";
|
|
4
4
|
import { runCaptureCommand } from "./capture.js";
|
|
5
5
|
import { runCreateCommand } from "./create.js";
|
|
6
6
|
import { runKillCommand } from "./kill.js";
|
|
@@ -11,12 +11,14 @@ export function createTerminalCommand() {
|
|
|
11
11
|
addJsonAndDaemonHostOptions(terminal
|
|
12
12
|
.command("ls")
|
|
13
13
|
.description("List terminals")
|
|
14
|
-
.
|
|
15
|
-
.option("--
|
|
14
|
+
.addOption(new Option("--all", "List terminals across all workspaces").conflicts(["cwd", "workspace"]))
|
|
15
|
+
.option("--workspace <id>", "Workspace ID")
|
|
16
|
+
.option("--cwd <path>", "Working directory")).action(withOutput(runLsCommand));
|
|
16
17
|
addJsonAndDaemonHostOptions(terminal
|
|
17
18
|
.command("create")
|
|
18
19
|
.description("Create a terminal")
|
|
19
|
-
.option("--
|
|
20
|
+
.option("--workspace <id>", "Workspace ID")
|
|
21
|
+
.option("--cwd <path>", "Working directory")
|
|
20
22
|
.option("--name <name>", "Terminal name")).action(withOutput(runCreateCommand));
|
|
21
23
|
addJsonAndDaemonHostOptions(terminal
|
|
22
24
|
.command("kill")
|
|
@@ -30,14 +32,14 @@ export function createTerminalCommand() {
|
|
|
30
32
|
.option("--end <n>", "Capture end line")
|
|
31
33
|
.option("-S, --scrollback", "Capture from the beginning of scrollback")
|
|
32
34
|
.option("--ansi", "Preserve ANSI escape codes")
|
|
33
|
-
.option("--json", "Output in JSON format")).action(runCaptureCommand);
|
|
35
|
+
.option("--json", "Output in JSON format")).action(withGlobalOptions(runCaptureCommand));
|
|
34
36
|
addDaemonHostOption(terminal
|
|
35
37
|
.command("send-keys")
|
|
36
38
|
.description("Send keys to a terminal")
|
|
37
39
|
.argument("<terminal-id>", "Terminal ID, ID prefix, or name")
|
|
38
40
|
.argument("<keys...>", "Keys to send")
|
|
39
41
|
.option("-l, --literal", "Send raw keys without interpreting special tokens")
|
|
40
|
-
.option("--json", "Output in JSON format")).action(runSendKeysCommand);
|
|
42
|
+
.option("--json", "Output in JSON format")).action(withGlobalOptions(runSendKeysCommand));
|
|
41
43
|
return terminal;
|
|
42
44
|
}
|
|
43
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { connectTerminalClient, resolveTerminalId, toTerminalCommandError, } from "./shared.js";
|
|
2
2
|
import { terminalKillSchema } from "./schema.js";
|
|
3
3
|
export async function runKillCommand(terminalId, options, _command) {
|
|
4
|
-
const { client } = await connectTerminalClient(options.host);
|
|
4
|
+
const { client, close } = await connectTerminalClient(options.host);
|
|
5
5
|
try {
|
|
6
6
|
const resolvedId = await requireTerminalId(client, terminalId);
|
|
7
|
-
|
|
7
|
+
await client.terminals.ref(resolvedId).kill();
|
|
8
8
|
return {
|
|
9
9
|
type: "single",
|
|
10
10
|
data: {
|
|
11
|
-
terminalId:
|
|
12
|
-
success:
|
|
11
|
+
terminalId: resolvedId,
|
|
12
|
+
success: true,
|
|
13
13
|
},
|
|
14
14
|
schema: terminalKillSchema,
|
|
15
15
|
};
|
|
@@ -18,7 +18,7 @@ export async function runKillCommand(terminalId, options, _command) {
|
|
|
18
18
|
throw toTerminalCommandError("TERMINAL_KILL_FAILED", "kill terminal", err);
|
|
19
19
|
}
|
|
20
20
|
finally {
|
|
21
|
-
await
|
|
21
|
+
await close().catch(() => { });
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
async function requireTerminalId(client, terminalId) {
|
|
@@ -3,6 +3,7 @@ import type { ListResult } from "../../output/index.js";
|
|
|
3
3
|
import { type TerminalCommandOptions } from "./shared.js";
|
|
4
4
|
import { type TerminalRow } from "./schema.js";
|
|
5
5
|
export interface TerminalLsOptions extends TerminalCommandOptions {
|
|
6
|
+
workspace?: string;
|
|
6
7
|
all?: boolean;
|
|
7
8
|
cwd?: string;
|
|
8
9
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { connectTerminalClient, toTerminalCommandError, } from "./shared.js";
|
|
2
|
-
import { terminalSchema
|
|
2
|
+
import { terminalSchema } from "./schema.js";
|
|
3
3
|
export async function runLsCommand(options, _command) {
|
|
4
|
-
const { client } = await connectTerminalClient(options.host);
|
|
5
|
-
const cwd = options.all ? undefined : (options.cwd ?? process.cwd());
|
|
4
|
+
const { client, close } = await connectTerminalClient(options.host);
|
|
5
|
+
const cwd = options.all || options.workspace ? undefined : (options.cwd ?? process.cwd());
|
|
6
6
|
try {
|
|
7
|
-
const payload =
|
|
7
|
+
const payload = await client.terminals.list({ cwd, workspaceId: options.workspace });
|
|
8
8
|
return {
|
|
9
9
|
type: "list",
|
|
10
|
-
data: payload.
|
|
10
|
+
data: payload.entries,
|
|
11
11
|
schema: terminalSchema,
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -15,7 +15,7 @@ export async function runLsCommand(options, _command) {
|
|
|
15
15
|
throw toTerminalCommandError("TERMINAL_LIST_FAILED", "list terminals", err);
|
|
16
16
|
}
|
|
17
17
|
finally {
|
|
18
|
-
await
|
|
18
|
+
await close().catch(() => { });
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=ls.js.map
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
+
import type { PaseoTerminal } from "@getpaseo/client";
|
|
1
2
|
import type { OutputSchema } from "../../output/index.js";
|
|
2
|
-
export
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
cwd: string;
|
|
6
|
-
}
|
|
3
|
+
export type TerminalRow = PaseoTerminal;
|
|
7
4
|
export interface TerminalKillRow {
|
|
8
5
|
terminalId: string;
|
|
9
6
|
success: boolean;
|
|
10
7
|
}
|
|
11
8
|
export declare const terminalSchema: OutputSchema<TerminalRow>;
|
|
12
9
|
export declare const terminalKillSchema: OutputSchema<TerminalKillRow>;
|
|
13
|
-
export declare function toTerminalRow(terminal: {
|
|
14
|
-
id: string;
|
|
15
|
-
name: string;
|
|
16
|
-
cwd?: string;
|
|
17
|
-
}, cwd?: string): TerminalRow;
|
|
18
10
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -4,6 +4,7 @@ export const terminalSchema = {
|
|
|
4
4
|
{ header: "ID", field: (row) => row.id.slice(0, 8), width: 8 },
|
|
5
5
|
{ header: "NAME", field: "name", width: 24 },
|
|
6
6
|
{ header: "CWD", field: "cwd", width: 48 },
|
|
7
|
+
{ header: "WORKSPACE", field: "workspaceId", width: 24 },
|
|
7
8
|
],
|
|
8
9
|
};
|
|
9
10
|
export const terminalKillSchema = {
|
|
@@ -13,11 +14,4 @@ export const terminalKillSchema = {
|
|
|
13
14
|
{ header: "SUCCESS", field: "success", width: 8 },
|
|
14
15
|
],
|
|
15
16
|
};
|
|
16
|
-
export function toTerminalRow(terminal, cwd) {
|
|
17
|
-
return {
|
|
18
|
-
id: terminal.id,
|
|
19
|
-
name: terminal.name,
|
|
20
|
-
cwd: terminal.cwd ?? cwd ?? "-",
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
17
|
//# sourceMappingURL=schema.js.map
|
|
@@ -18,7 +18,7 @@ export async function runSendKeysCommand(terminalId, keys, _options, command) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
async function executeSendKeysCommand(terminalId, keys, options) {
|
|
21
|
-
const { client } = await connectTerminalClient(options.host);
|
|
21
|
+
const { client, close } = await connectTerminalClient(options.host);
|
|
22
22
|
try {
|
|
23
23
|
const resolvedId = await resolveTerminalId(client, terminalId);
|
|
24
24
|
if (!resolvedId) {
|
|
@@ -28,49 +28,18 @@ async function executeSendKeysCommand(terminalId, keys, options) {
|
|
|
28
28
|
details: "Use `paseo terminal ls --all` to list available terminals.",
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const terminal = client.terminals.ref(resolvedId);
|
|
32
|
+
const keysSent = options.literal ? terminal.write(keys.join("")) : terminal.sendKeys(keys);
|
|
33
33
|
return {
|
|
34
34
|
terminalId: resolvedId,
|
|
35
|
-
keysSent
|
|
35
|
+
keysSent,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
catch (err) {
|
|
39
39
|
throw toTerminalCommandError("TERMINAL_SEND_KEYS_FAILED", "send terminal keys", err);
|
|
40
40
|
}
|
|
41
41
|
finally {
|
|
42
|
-
await
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function resolveKeyToken(key, literal) {
|
|
46
|
-
if (literal) {
|
|
47
|
-
return key;
|
|
48
|
-
}
|
|
49
|
-
switch (key) {
|
|
50
|
-
case "Enter":
|
|
51
|
-
return "\r";
|
|
52
|
-
case "Tab":
|
|
53
|
-
return "\t";
|
|
54
|
-
case "Escape":
|
|
55
|
-
return "\u001b";
|
|
56
|
-
case "Space":
|
|
57
|
-
return " ";
|
|
58
|
-
case "BSpace":
|
|
59
|
-
return "\u007f";
|
|
60
|
-
case "C-c":
|
|
61
|
-
return "\u0003";
|
|
62
|
-
case "C-d":
|
|
63
|
-
return "\u0004";
|
|
64
|
-
case "C-z":
|
|
65
|
-
return "\u001a";
|
|
66
|
-
case "C-l":
|
|
67
|
-
return "\u000c";
|
|
68
|
-
case "C-a":
|
|
69
|
-
return "\u0001";
|
|
70
|
-
case "C-e":
|
|
71
|
-
return "\u0005";
|
|
72
|
-
default:
|
|
73
|
-
return key;
|
|
42
|
+
await close().catch(() => { });
|
|
74
43
|
}
|
|
75
44
|
}
|
|
76
45
|
//# sourceMappingURL=send-keys.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { connectToDaemon } from "../../utils/client.js";
|
|
2
1
|
import type { CommandError, CommandOptions } from "../../output/index.js";
|
|
3
2
|
export interface TerminalCommandOptions extends CommandOptions {
|
|
4
3
|
host?: string;
|
|
5
4
|
}
|
|
6
5
|
export declare function connectTerminalClient(host?: string): Promise<{
|
|
7
|
-
client: import("@getpaseo/client
|
|
6
|
+
client: import("@getpaseo/client").PaseoApi;
|
|
8
7
|
daemonHost: string;
|
|
8
|
+
close: () => Promise<void>;
|
|
9
9
|
}>;
|
|
10
10
|
export declare function toTerminalCommandError(code: string, action: string, err: unknown): CommandError;
|
|
11
|
-
export declare function resolveTerminalId(client: Awaited<ReturnType<typeof
|
|
11
|
+
export declare function resolveTerminalId(client: Awaited<ReturnType<typeof connectTerminalClient>>["client"], idOrName: string): Promise<string | null>;
|
|
12
12
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { createPaseoApi } from "@getpaseo/client";
|
|
1
2
|
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
2
3
|
export async function connectTerminalClient(host) {
|
|
3
4
|
const daemonHost = getDaemonHost({ host });
|
|
4
5
|
try {
|
|
5
6
|
const client = await connectToDaemon({ host });
|
|
6
|
-
return { client, daemonHost };
|
|
7
|
+
return { client: createPaseoApi(client), daemonHost, close: () => client.close() };
|
|
7
8
|
}
|
|
8
9
|
catch (err) {
|
|
9
10
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -29,8 +30,8 @@ export function toTerminalCommandError(code, action, err) {
|
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
export async function resolveTerminalId(client, idOrName) {
|
|
32
|
-
const payload = await client.
|
|
33
|
-
return resolveTerminalIdentifier(idOrName, payload.
|
|
33
|
+
const payload = await client.terminals.list();
|
|
34
|
+
return resolveTerminalIdentifier(idOrName, payload.entries);
|
|
34
35
|
}
|
|
35
36
|
function resolveTerminalIdentifier(idOrName, terminals) {
|
|
36
37
|
if (!idOrName || terminals.length === 0) {
|
|
@@ -5,8 +5,13 @@ import { runArchiveCommand } from "./archive.js";
|
|
|
5
5
|
import { runCreateCommand } from "./create.js";
|
|
6
6
|
import { runLsCommand } from "./ls.js";
|
|
7
7
|
import { runRenameCommand } from "./rename.js";
|
|
8
|
+
import { runSetupCommand } from "./setup.js";
|
|
8
9
|
export function createWorkspaceCommand() {
|
|
9
10
|
const workspace = new Command("workspace").description("Manage workspaces");
|
|
11
|
+
addJsonAndDaemonHostOptions(workspace
|
|
12
|
+
.command("setup")
|
|
13
|
+
.description("Allow and run setup for a workspace")
|
|
14
|
+
.argument("<workspace-id>", "Workspace id")).action(withOutput(runSetupCommand));
|
|
10
15
|
addJsonAndDaemonHostOptions(workspace
|
|
11
16
|
.command("create")
|
|
12
17
|
.description("Create a workspace")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { SingleResult } from "../../output/index.js";
|
|
3
|
+
interface WorkspaceSetupResult {
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
status: "started" | "already_allowed";
|
|
6
|
+
}
|
|
7
|
+
export declare function runSetupCommand(workspaceId: string, options: {
|
|
8
|
+
host?: string;
|
|
9
|
+
}, _command: Command): Promise<SingleResult<WorkspaceSetupResult>>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
2
|
+
const workspaceSetupSchema = {
|
|
3
|
+
idField: "workspaceId",
|
|
4
|
+
columns: [
|
|
5
|
+
{ header: "WORKSPACE ID", field: "workspaceId", width: 20 },
|
|
6
|
+
{ header: "STATUS", field: "status", width: 18 },
|
|
7
|
+
],
|
|
8
|
+
};
|
|
9
|
+
export async function runSetupCommand(workspaceId, options, _command) {
|
|
10
|
+
const host = getDaemonHost({ host: options.host });
|
|
11
|
+
const client = await connectToDaemon({ host: options.host }).catch((error) => {
|
|
12
|
+
throw {
|
|
13
|
+
code: "DAEMON_NOT_RUNNING",
|
|
14
|
+
message: `Cannot connect to daemon at ${host}: ${error instanceof Error ? error.message : String(error)}`,
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
try {
|
|
18
|
+
// COMPAT(workspaceSetupRun): added in v0.7.3, remove gate after 2027-09-02.
|
|
19
|
+
if (!client.getLastServerInfoMessage()?.features?.workspaceSetupRun) {
|
|
20
|
+
throw { code: "DAEMON_UPDATE_REQUIRED", message: "Update the host to run workspace setup." };
|
|
21
|
+
}
|
|
22
|
+
const payload = await client.runWorkspaceSetup(workspaceId);
|
|
23
|
+
if (payload.error)
|
|
24
|
+
throw new Error(payload.error);
|
|
25
|
+
return {
|
|
26
|
+
type: "single",
|
|
27
|
+
data: { workspaceId, status: payload.started ? "started" : "already_allowed" },
|
|
28
|
+
schema: workspaceSetupSchema,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error && typeof error === "object" && "code" in error)
|
|
33
|
+
throw error;
|
|
34
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
35
|
+
throw { code: "WORKSPACE_SETUP_FAILED", message };
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
await client.close().catch(() => undefined);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=setup.js.map
|
package/dist/output/render.js
CHANGED
|
@@ -40,7 +40,8 @@ export function render(result, options = {}) {
|
|
|
40
40
|
/** Convert an unknown error to a CommandError */
|
|
41
41
|
export function toCommandError(error) {
|
|
42
42
|
if (isCommandError(error)) {
|
|
43
|
-
|
|
43
|
+
// Error.message and class getters are not enumerable; materialize the output contract.
|
|
44
|
+
return { ...error, code: error.code, message: error.message, details: error.details };
|
|
44
45
|
}
|
|
45
46
|
if (error instanceof Error) {
|
|
46
47
|
return {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Wraps command handlers to automatically render results and handle errors.
|
|
5
5
|
*/
|
|
6
6
|
import { render, renderError, toCommandError, defaultOutputOptions } from "./render.js";
|
|
7
|
+
import { withGlobalOptions } from "../utils/command-options.js";
|
|
7
8
|
function normalizeFormat(raw) {
|
|
8
9
|
const value = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
9
10
|
// Common user expectation: "cli" means "table/human"
|
|
@@ -56,11 +57,8 @@ function extractOutputOptions(options) {
|
|
|
56
57
|
* ```
|
|
57
58
|
*/
|
|
58
59
|
export function withOutput(handler) {
|
|
59
|
-
return async (...args) => {
|
|
60
|
-
|
|
61
|
-
const command = args[args.length - 1];
|
|
62
|
-
// Use optsWithGlobals() to get both local and global options
|
|
63
|
-
const options = command.optsWithGlobals();
|
|
60
|
+
return withGlobalOptions(async (...args) => {
|
|
61
|
+
const options = args[args.length - 2];
|
|
64
62
|
const outputOptions = extractOutputOptions(options);
|
|
65
63
|
try {
|
|
66
64
|
const result = await handler(...args);
|
|
@@ -75,7 +73,7 @@ export function withOutput(handler) {
|
|
|
75
73
|
process.stderr.write(errorOutput + "\n");
|
|
76
74
|
process.exit(1);
|
|
77
75
|
}
|
|
78
|
-
};
|
|
76
|
+
});
|
|
79
77
|
}
|
|
80
78
|
/**
|
|
81
79
|
* Helper to create output options from partial input.
|
package/dist/utils/client.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare function buildDaemonConnectionCommandError(options: {
|
|
|
27
27
|
export declare function normalizeDaemonHost(raw: string): string | null;
|
|
28
28
|
export declare function resolveDefaultDaemonHost(env?: NodeJS.ProcessEnv): string;
|
|
29
29
|
export declare function resolveDefaultDaemonHosts(env?: NodeJS.ProcessEnv): string[];
|
|
30
|
+
export declare function getExplicitDaemonHost(host: string | undefined, env?: NodeJS.ProcessEnv): string | undefined;
|
|
30
31
|
export declare function resolveDaemonTarget(host: string): DaemonTarget;
|
|
31
32
|
export declare function resolveDaemonPassword(host: string): string | undefined;
|
|
32
33
|
export declare function connectToDaemon(options?: ConnectOptions): Promise<DaemonClient>;
|
package/dist/utils/client.js
CHANGED
|
@@ -131,12 +131,16 @@ export function resolveDefaultDaemonHosts(env = process.env) {
|
|
|
131
131
|
return Array.from(new Set(candidates));
|
|
132
132
|
}
|
|
133
133
|
function resolveDaemonHostCandidates(options) {
|
|
134
|
-
const explicitHost = options?.host
|
|
134
|
+
const explicitHost = getExplicitDaemonHost(options?.host);
|
|
135
135
|
if (explicitHost) {
|
|
136
136
|
return [explicitHost];
|
|
137
137
|
}
|
|
138
138
|
return resolveDefaultDaemonHosts();
|
|
139
139
|
}
|
|
140
|
+
export function getExplicitDaemonHost(host, env = process.env) {
|
|
141
|
+
const explicitHost = host ?? env.PASEO_HOST;
|
|
142
|
+
return explicitHost?.trim() ? explicitHost : undefined;
|
|
143
|
+
}
|
|
140
144
|
function stripIpcPrefix(trimmed) {
|
|
141
145
|
if (trimmed.startsWith("unix://"))
|
|
142
146
|
return trimmed.slice("unix://".length).trim();
|
|
@@ -269,7 +273,7 @@ export async function connectToDaemon(options) {
|
|
|
269
273
|
const timeout = options?.timeout ?? DEFAULT_TIMEOUT;
|
|
270
274
|
const clientId = await getOrCreateCliClientId();
|
|
271
275
|
const nodeWebSocketFactory = createNodeWebSocketFactory();
|
|
272
|
-
const explicitHost = options?.host
|
|
276
|
+
const explicitHost = getExplicitDaemonHost(options?.host);
|
|
273
277
|
if (explicitHost?.trim().startsWith("ssh://")) {
|
|
274
278
|
const target = parseSshTransportUri(explicitHost.trim());
|
|
275
279
|
const tunnel = await createSshTunnel(target);
|
|
@@ -3,4 +3,5 @@ export declare function collectMultiple(value: string, previous: string[]): stri
|
|
|
3
3
|
export declare function addJsonOption<T extends Command>(command: T): T;
|
|
4
4
|
export declare function addDaemonHostOption<T extends Command>(command: T): T;
|
|
5
5
|
export declare function addJsonAndDaemonHostOptions<T extends Command>(command: T): T;
|
|
6
|
+
export declare function withGlobalOptions<Args extends unknown[], Result>(handler: (...args: Args) => Result): (...args: Args) => Result;
|
|
6
7
|
//# sourceMappingURL=command-options.d.ts.map
|
|
@@ -14,4 +14,12 @@ export function addDaemonHostOption(command) {
|
|
|
14
14
|
export function addJsonAndDaemonHostOptions(command) {
|
|
15
15
|
return addDaemonHostOption(addJsonOption(command));
|
|
16
16
|
}
|
|
17
|
+
export function withGlobalOptions(handler) {
|
|
18
|
+
return (...args) => {
|
|
19
|
+
const command = args.at(-1);
|
|
20
|
+
const mergedArgs = [...args];
|
|
21
|
+
mergedArgs[mergedArgs.length - 2] = command.optsWithGlobals();
|
|
22
|
+
return handler(...mergedArgs);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
17
25
|
//# sourceMappingURL=command-options.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpaseo/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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.
|
|
32
|
-
"@getpaseo/protocol": "0.
|
|
33
|
-
"@getpaseo/server": "0.
|
|
31
|
+
"@getpaseo/client": "0.8.0-beta.1",
|
|
32
|
+
"@getpaseo/protocol": "0.8.0-beta.1",
|
|
33
|
+
"@getpaseo/server": "0.8.0-beta.1",
|
|
34
34
|
"chalk": "^5.3.0",
|
|
35
35
|
"commander": "^12.0.0",
|
|
36
36
|
"mime-types": "^2.1.35",
|