@camerontaylor/paseo-cli 0.8.0-fork.1 → 0.8.0-fork.3
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 +25 -37
- package/dist/commands/agent/archive.js +2 -15
- package/dist/commands/agent/attach.d.ts +1 -0
- package/dist/commands/agent/attach.js +8 -12
- package/dist/commands/agent/delete.js +4 -15
- package/dist/commands/agent/detach.js +2 -13
- package/dist/commands/agent/import.js +2 -16
- package/dist/commands/agent/inspect.js +2 -15
- package/dist/commands/agent/logs.js +12 -12
- package/dist/commands/agent/ls.js +2 -23
- package/dist/commands/agent/mode.js +2 -2
- package/dist/commands/agent/open.js +2 -8
- package/dist/commands/agent/reload.js +2 -15
- package/dist/commands/agent/run.js +11 -16
- package/dist/commands/agent/send.js +6 -15
- package/dist/commands/agent/stop.js +2 -15
- package/dist/commands/agent/update.js +2 -15
- package/dist/commands/agent/wait.js +4 -15
- package/dist/commands/clone.js +2 -8
- package/dist/commands/daemon/config.d.ts +3 -0
- package/dist/commands/daemon/config.js +102 -0
- package/dist/commands/daemon/index.js +20 -52
- package/dist/commands/daemon/local-daemon.d.ts +10 -75
- package/dist/commands/daemon/local-daemon.js +61 -503
- package/dist/commands/daemon/pair.d.ts +3 -8
- package/dist/commands/daemon/pair.js +31 -61
- package/dist/commands/daemon/reload.d.ts +3 -1
- package/dist/commands/daemon/reload.js +10 -2
- package/dist/commands/daemon/restart.d.ts +19 -11
- package/dist/commands/daemon/restart.js +102 -88
- package/dist/commands/daemon/set-password.js +6 -7
- package/dist/commands/daemon/start.d.ts +17 -3
- package/dist/commands/daemon/start.js +47 -52
- package/dist/commands/daemon/status.d.ts +12 -20
- package/dist/commands/daemon/status.js +90 -342
- package/dist/commands/daemon/stop.d.ts +19 -14
- package/dist/commands/daemon/stop.js +53 -55
- package/dist/commands/heartbeat/index.js +3 -3
- package/dist/commands/hub/connect.d.ts +1 -0
- package/dist/commands/hub/connect.js +1 -1
- package/dist/commands/hub/daemon-client.d.ts +3 -2
- package/dist/commands/hub/daemon-client.js +3 -3
- package/dist/commands/hub/disconnect.d.ts +1 -0
- package/dist/commands/hub/disconnect.js +1 -1
- package/dist/commands/hub/index.js +2 -2
- package/dist/commands/hub/init.d.ts +3 -1
- package/dist/commands/hub/init.js +13 -12
- package/dist/commands/hub/login.d.ts +4 -4
- package/dist/commands/hub/login.js +1 -1
- package/dist/commands/hub/logout.d.ts +1 -0
- package/dist/commands/hub/logout.js +2 -2
- package/dist/commands/hub/permissions.d.ts +1 -0
- package/dist/commands/hub/permissions.js +2 -2
- package/dist/commands/onboard.d.ts +7 -2
- package/dist/commands/onboard.js +58 -210
- package/dist/commands/open.js +2 -0
- package/dist/commands/permit/allow.js +2 -15
- package/dist/commands/permit/deny.js +2 -15
- package/dist/commands/permit/ls.js +2 -15
- package/dist/commands/plugin/index.js +7 -7
- package/dist/commands/plugin/shared.d.ts +4 -3
- package/dist/commands/plugin/shared.js +8 -8
- package/dist/commands/project/create.js +5 -3
- package/dist/commands/project/delete.js +4 -2
- package/dist/commands/project/ls.js +2 -2
- package/dist/commands/project/rename.js +4 -2
- package/dist/commands/provider/add.js +2 -2
- package/dist/commands/provider/diagnostic.js +1 -1
- package/dist/commands/provider/ls.js +2 -30
- package/dist/commands/provider/models.js +1 -1
- package/dist/commands/provider/rm.js +2 -2
- package/dist/commands/schedule/create.js +2 -2
- package/dist/commands/schedule/delete.js +1 -1
- package/dist/commands/schedule/inspect.js +1 -1
- package/dist/commands/schedule/logs.js +1 -1
- package/dist/commands/schedule/ls.js +1 -1
- package/dist/commands/schedule/pause.js +1 -1
- package/dist/commands/schedule/resume.js +1 -1
- package/dist/commands/schedule/run-once.js +1 -1
- package/dist/commands/schedule/shared.d.ts +3 -1
- package/dist/commands/schedule/shared.js +7 -5
- package/dist/commands/schedule/update.js +1 -1
- package/dist/commands/script/ls.js +1 -1
- package/dist/commands/script/shared.d.ts +2 -1
- package/dist/commands/script/shared.js +3 -3
- package/dist/commands/script/start.js +1 -1
- package/dist/commands/script/stop.js +1 -1
- package/dist/commands/terminal/capture.d.ts +1 -1
- package/dist/commands/terminal/capture.js +2 -3
- package/dist/commands/terminal/create.js +1 -1
- package/dist/commands/terminal/kill.js +1 -1
- package/dist/commands/terminal/ls.js +1 -1
- package/dist/commands/terminal/send-keys.d.ts +1 -1
- package/dist/commands/terminal/send-keys.js +2 -3
- package/dist/commands/terminal/shared.d.ts +2 -1
- package/dist/commands/terminal/shared.js +5 -3
- package/dist/commands/workspace/archive.d.ts +1 -0
- package/dist/commands/workspace/archive.js +4 -2
- package/dist/commands/workspace/create.js +4 -2
- package/dist/commands/workspace/ls.d.ts +1 -0
- package/dist/commands/workspace/ls.js +2 -2
- package/dist/commands/workspace/rename.d.ts +1 -0
- package/dist/commands/workspace/rename.js +4 -2
- package/dist/commands/workspace/setup.d.ts +1 -0
- package/dist/commands/workspace/setup.js +2 -2
- package/dist/commands/worktree/archive.js +4 -2
- package/dist/commands/worktree/create.js +2 -10
- package/dist/commands/worktree/ls.d.ts +0 -2
- package/dist/commands/worktree/ls.js +4 -30
- package/dist/output/with-output.d.ts +2 -0
- package/dist/run.js +11 -1
- package/dist/utils/client-id.d.ts +1 -1
- package/dist/utils/client-id.js +8 -14
- package/dist/utils/client.d.ts +16 -21
- package/dist/utils/client.js +57 -109
- package/dist/utils/command-options.d.ts +1 -0
- package/dist/utils/command-options.js +24 -2
- package/dist/utils/daemon-target.d.ts +13 -0
- package/dist/utils/daemon-target.js +51 -0
- package/package.json +8 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { connectToDaemon
|
|
1
|
+
import { connectToDaemon } from "../../utils/client.js";
|
|
2
2
|
/** Schema for permit allow/deny output */
|
|
3
3
|
export const permitResponseSchema = {
|
|
4
4
|
idField: "requestId",
|
|
@@ -21,7 +21,6 @@ export const permitResponseSchema = {
|
|
|
21
21
|
],
|
|
22
22
|
};
|
|
23
23
|
export async function runAllowCommand(agentIdOrPrefix, reqId, options, _command) {
|
|
24
|
-
const host = getDaemonHost({ host: options.host });
|
|
25
24
|
// No validation needed - if no reqId provided, allow all by default
|
|
26
25
|
// Parse input JSON if provided
|
|
27
26
|
let updatedInput;
|
|
@@ -38,19 +37,7 @@ export async function runAllowCommand(agentIdOrPrefix, reqId, options, _command)
|
|
|
38
37
|
throw error;
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
client = await connectToDaemon({ host: options.host });
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
47
|
-
const error = {
|
|
48
|
-
code: "DAEMON_NOT_RUNNING",
|
|
49
|
-
message: `Cannot connect to daemon at ${host}: ${message}`,
|
|
50
|
-
details: "Start the daemon with: paseo daemon start",
|
|
51
|
-
};
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
40
|
+
const client = await connectToDaemon({ target: options.daemonTarget });
|
|
54
41
|
try {
|
|
55
42
|
const fetchResult = await client.fetchAgent({ agentId: agentIdOrPrefix });
|
|
56
43
|
if (!fetchResult) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { connectToDaemon
|
|
1
|
+
import { connectToDaemon } from "../../utils/client.js";
|
|
2
2
|
import { permitResponseSchema } from "./allow.js";
|
|
3
3
|
export async function runDenyCommand(agentIdOrPrefix, reqId, options, _command) {
|
|
4
|
-
const host = getDaemonHost({ host: options.host });
|
|
5
4
|
// Validate arguments
|
|
6
5
|
if (!options.all && !reqId) {
|
|
7
6
|
const error = {
|
|
@@ -11,19 +10,7 @@ export async function runDenyCommand(agentIdOrPrefix, reqId, options, _command)
|
|
|
11
10
|
};
|
|
12
11
|
throw error;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
client = await connectToDaemon({ host: options.host });
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
20
|
-
const error = {
|
|
21
|
-
code: "DAEMON_NOT_RUNNING",
|
|
22
|
-
message: `Cannot connect to daemon at ${host}: ${message}`,
|
|
23
|
-
details: "Start the daemon with: paseo daemon start",
|
|
24
|
-
};
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
13
|
+
const client = await connectToDaemon({ target: options.daemonTarget });
|
|
27
14
|
try {
|
|
28
15
|
const fetchResult = await client.fetchAgent({ agentId: agentIdOrPrefix });
|
|
29
16
|
if (!fetchResult) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { connectToDaemon
|
|
1
|
+
import { connectToDaemon } from "../../utils/client.js";
|
|
2
2
|
/** Schema for permit ls output */
|
|
3
3
|
export const permitLsSchema = {
|
|
4
4
|
idField: "id",
|
|
@@ -20,20 +20,7 @@ function toListItem(agent, permission) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
export async function runLsCommand(options, _command) {
|
|
23
|
-
const
|
|
24
|
-
let client;
|
|
25
|
-
try {
|
|
26
|
-
client = await connectToDaemon({ host: options.host });
|
|
27
|
-
}
|
|
28
|
-
catch (err) {
|
|
29
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
30
|
-
const error = {
|
|
31
|
-
code: "DAEMON_NOT_RUNNING",
|
|
32
|
-
message: `Cannot connect to daemon at ${host}: ${message}`,
|
|
33
|
-
details: "Start the daemon with: paseo daemon start",
|
|
34
|
-
};
|
|
35
|
-
throw error;
|
|
36
|
-
}
|
|
23
|
+
const client = await connectToDaemon({ target: options.daemonTarget });
|
|
37
24
|
try {
|
|
38
25
|
const agentsPayload = await client.fetchAgents({ filter: { includeArchived: true } });
|
|
39
26
|
const agents = agentsPayload.entries.map((entry) => entry.agent);
|
|
@@ -54,14 +54,14 @@ export async function runPluginInitCommand(directory, options, _command) {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
export async function runPluginListCommand(pluginId, options, _command) {
|
|
57
|
-
const plugins = await withPluginManagementClient(options.
|
|
57
|
+
const plugins = await withPluginManagementClient(options.daemonTarget, (client) => client.listPlugins());
|
|
58
58
|
const data = pluginId ? plugins.filter((plugin) => plugin.id === pluginId) : plugins;
|
|
59
59
|
if (pluginId && data.length === 0)
|
|
60
60
|
throw new Error(`Plugin is not configured: ${pluginId}`);
|
|
61
61
|
return { type: "list", data, schema: pluginSchema };
|
|
62
62
|
}
|
|
63
63
|
export async function runPluginLogsCommand(pluginId, options, _command) {
|
|
64
|
-
const data = await withPluginLogsClient(options.
|
|
64
|
+
const data = await withPluginLogsClient(options.daemonTarget, (client) => client.getPluginLogs(pluginId));
|
|
65
65
|
return { type: "list", data, schema: pluginLogsSchema };
|
|
66
66
|
}
|
|
67
67
|
async function install(source, options, _command) {
|
|
@@ -77,8 +77,8 @@ async function install(source, options, _command) {
|
|
|
77
77
|
const canUseLegacyDirectoryInstall = isExplicitPath && !hasPluginPathSuffix && !options.ref && !options.path;
|
|
78
78
|
const sourceReference = formatPluginSourceReference(source, options.path);
|
|
79
79
|
const data = canUseLegacyDirectoryInstall
|
|
80
|
-
? await withPluginManagementClient(options.
|
|
81
|
-
: await withPluginSourceClient(options.
|
|
80
|
+
? await withPluginManagementClient(options.daemonTarget, (client) => client.installDirectoryPlugin(source, options.id))
|
|
81
|
+
: await withPluginSourceClient(options.daemonTarget, (client) => client.installPluginSource({
|
|
82
82
|
source: sourceReference,
|
|
83
83
|
...(options.id ? { id: options.id } : {}),
|
|
84
84
|
...(options.ref ? { ref: options.ref } : {}),
|
|
@@ -89,15 +89,15 @@ async function update(pluginId, options, _command) {
|
|
|
89
89
|
if ((pluginId === undefined) === (options.all !== true)) {
|
|
90
90
|
throw new Error("Choose one plugin ID or pass --all");
|
|
91
91
|
}
|
|
92
|
-
const data = await withPluginSourceClient(options.
|
|
92
|
+
const data = await withPluginSourceClient(options.daemonTarget, (client) => client.updatePluginSources(pluginId));
|
|
93
93
|
return { type: "list", data, schema: pluginUpdateSchema };
|
|
94
94
|
}
|
|
95
95
|
async function act(action, pluginId, options) {
|
|
96
|
-
const data = await withPluginManagementClient(options.
|
|
96
|
+
const data = await withPluginManagementClient(options.daemonTarget, (client) => client[`${action}Plugin`](pluginId));
|
|
97
97
|
return { type: "single", data, schema: pluginSchema };
|
|
98
98
|
}
|
|
99
99
|
async function remove(pluginId, options, _command) {
|
|
100
|
-
const data = await withPluginManagementClient(options.
|
|
100
|
+
const data = await withPluginManagementClient(options.daemonTarget, async (client) => {
|
|
101
101
|
const current = (await client.listPlugins()).find((plugin) => plugin.id === pluginId);
|
|
102
102
|
if (!current)
|
|
103
103
|
throw new Error(`Plugin is not configured: ${pluginId}`);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { DaemonTarget } from "../../utils/daemon-target.js";
|
|
1
2
|
import type { DaemonClient } from "@camerontaylor/paseo-client/internal/daemon-client";
|
|
2
|
-
export declare function withPluginManagementClient<T>(
|
|
3
|
-
export declare function withPluginLogsClient<T>(
|
|
4
|
-
export declare function withPluginSourceClient<T>(
|
|
3
|
+
export declare function withPluginManagementClient<T>(target: DaemonTarget, run: (client: DaemonClient) => Promise<T>): Promise<T>;
|
|
4
|
+
export declare function withPluginLogsClient<T>(target: DaemonTarget, run: (client: DaemonClient) => Promise<T>): Promise<T>;
|
|
5
|
+
export declare function withPluginSourceClient<T>(target: DaemonTarget, run: (client: DaemonClient) => Promise<T>): Promise<T>;
|
|
5
6
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connectToDaemon } from "../../utils/client.js";
|
|
2
|
-
async function withPluginClient(
|
|
3
|
-
const client = await connectToDaemon({
|
|
2
|
+
async function withPluginClient(target, feature, updateMessage, run) {
|
|
3
|
+
const client = await connectToDaemon({ target });
|
|
4
4
|
if (client.getLastServerInfoMessage()?.features?.[feature] !== true) {
|
|
5
5
|
await client.close().catch(() => undefined);
|
|
6
6
|
throw {
|
|
@@ -15,16 +15,16 @@ async function withPluginClient(host, feature, updateMessage, run) {
|
|
|
15
15
|
await client.close().catch(() => undefined);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
export async function withPluginManagementClient(
|
|
18
|
+
export async function withPluginManagementClient(target, run) {
|
|
19
19
|
// COMPAT(pluginManagement): added in v0.3.1, remove gate after 2027-08-14.
|
|
20
|
-
return withPluginClient(
|
|
20
|
+
return withPluginClient(target, "pluginManagement", "Update the host to use plugin management.", run);
|
|
21
21
|
}
|
|
22
|
-
export async function withPluginLogsClient(
|
|
22
|
+
export async function withPluginLogsClient(target, run) {
|
|
23
23
|
// COMPAT(pluginLogs): added in v0.4.0, remove gate after 2027-08-16.
|
|
24
|
-
return withPluginClient(
|
|
24
|
+
return withPluginClient(target, "pluginLogs", "Update the host to view plugin logs.", run);
|
|
25
25
|
}
|
|
26
|
-
export async function withPluginSourceClient(
|
|
26
|
+
export async function withPluginSourceClient(target, run) {
|
|
27
27
|
// COMPAT(pluginGitManagement): added in v0.7.0, remove gate after 2027-08-26.
|
|
28
|
-
return withPluginClient(
|
|
28
|
+
return withPluginClient(target, "pluginGitManagement", "Update the host to install and update Git plugins.", run);
|
|
29
29
|
}
|
|
30
30
|
//# sourceMappingURL=shared.js.map
|
|
@@ -18,10 +18,10 @@ export async function runCreateCommand(pathArg, options, _command) {
|
|
|
18
18
|
const projectPath = resolveProjectPath({
|
|
19
19
|
pathArg,
|
|
20
20
|
cwd: process.cwd(),
|
|
21
|
-
daemonTarget: options.
|
|
21
|
+
daemonTarget: options.daemonTarget.kind === "endpoint" ? options.daemonTarget.host : undefined,
|
|
22
22
|
});
|
|
23
|
-
const client = await connectToDaemon({
|
|
24
|
-
throw buildDaemonConnectionCommandError({
|
|
23
|
+
const client = await connectToDaemon({ target: options.daemonTarget }).catch((error) => {
|
|
24
|
+
throw buildDaemonConnectionCommandError({ target: options.daemonTarget, error });
|
|
25
25
|
});
|
|
26
26
|
try {
|
|
27
27
|
const payload = await client.addProject(projectPath);
|
|
@@ -31,6 +31,8 @@ export async function runCreateCommand(pathArg, options, _command) {
|
|
|
31
31
|
return { type: "single", data: toProjectRow(payload.project), schema: projectSchema };
|
|
32
32
|
}
|
|
33
33
|
catch (error) {
|
|
34
|
+
if (error && typeof error === "object" && "code" in error)
|
|
35
|
+
throw error;
|
|
34
36
|
const message = error instanceof Error ? error.message : String(error);
|
|
35
37
|
throw { code: "PROJECT_CREATE_FAILED", message };
|
|
36
38
|
}
|
|
@@ -11,8 +11,8 @@ const projectDeleteSchema = {
|
|
|
11
11
|
],
|
|
12
12
|
};
|
|
13
13
|
export async function runDeleteCommand(projectId, options, _command) {
|
|
14
|
-
const client = await connectToDaemon({
|
|
15
|
-
throw buildDaemonConnectionCommandError({
|
|
14
|
+
const client = await connectToDaemon({ target: options.daemonTarget }).catch((error) => {
|
|
15
|
+
throw buildDaemonConnectionCommandError({ target: options.daemonTarget, error });
|
|
16
16
|
});
|
|
17
17
|
try {
|
|
18
18
|
const result = await client.removeProject(projectId);
|
|
@@ -23,6 +23,8 @@ export async function runDeleteCommand(projectId, options, _command) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
catch (error) {
|
|
26
|
+
if (error && typeof error === "object" && "code" in error)
|
|
27
|
+
throw error;
|
|
26
28
|
const message = error instanceof Error ? error.message : String(error);
|
|
27
29
|
throw { code: "PROJECT_DELETE_FAILED", message };
|
|
28
30
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildDaemonConnectionCommandError, connectToDaemon } from "../../utils/client.js";
|
|
2
2
|
import { projectSchema, toProjectRow } from "./shared.js";
|
|
3
3
|
export async function runLsCommand(options, _command) {
|
|
4
|
-
const client = await connectToDaemon({
|
|
5
|
-
throw buildDaemonConnectionCommandError({
|
|
4
|
+
const client = await connectToDaemon({ target: options.daemonTarget }).catch((error) => {
|
|
5
|
+
throw buildDaemonConnectionCommandError({ target: options.daemonTarget, error });
|
|
6
6
|
});
|
|
7
7
|
try {
|
|
8
8
|
const payload = await client.listProjects();
|
|
@@ -28,8 +28,8 @@ export function resolveProjectName(input) {
|
|
|
28
28
|
}
|
|
29
29
|
export async function runRenameCommand(projectId, nameArg, options, _command) {
|
|
30
30
|
const name = resolveProjectName({ name: nameArg, reset: options.reset });
|
|
31
|
-
const client = await connectToDaemon({
|
|
32
|
-
throw buildDaemonConnectionCommandError({
|
|
31
|
+
const client = await connectToDaemon({ target: options.daemonTarget }).catch((error) => {
|
|
32
|
+
throw buildDaemonConnectionCommandError({ target: options.daemonTarget, error });
|
|
33
33
|
});
|
|
34
34
|
try {
|
|
35
35
|
const applied = await client.renameProject(projectId, name);
|
|
@@ -40,6 +40,8 @@ export async function runRenameCommand(projectId, nameArg, options, _command) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
catch (error) {
|
|
43
|
+
if (error && typeof error === "object" && "code" in error)
|
|
44
|
+
throw error;
|
|
43
45
|
const message = error instanceof Error ? error.message : String(error);
|
|
44
46
|
throw { code: "PROJECT_RENAME_FAILED", message };
|
|
45
47
|
}
|
|
@@ -96,8 +96,8 @@ export async function runAddCommand(id, options, _command) {
|
|
|
96
96
|
message: error instanceof Error ? error.message : String(error),
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
const host = getDaemonHost({
|
|
100
|
-
const client = await connectToDaemon({
|
|
99
|
+
const host = getDaemonHost({ target: options.daemonTarget });
|
|
100
|
+
const client = await connectToDaemon({ target: options.daemonTarget }).catch((error) => {
|
|
101
101
|
const message = error instanceof Error ? error.message : String(error);
|
|
102
102
|
throw {
|
|
103
103
|
code: "DAEMON_NOT_RUNNING",
|
|
@@ -12,7 +12,7 @@ export const providerDiagnosticSchema = {
|
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
14
|
export async function runDiagnosticCommand(provider, options, _command) {
|
|
15
|
-
const client = await connectToDaemon({
|
|
15
|
+
const client = await connectToDaemon({ target: options.daemonTarget });
|
|
16
16
|
try {
|
|
17
17
|
const result = await client.getProviderDiagnostic(provider.trim().toLowerCase());
|
|
18
18
|
return {
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { tryConnectToDaemon } from "../../utils/client.js";
|
|
3
|
-
/** Derive provider list from the manifest — single source of truth */
|
|
4
|
-
const PROVIDERS = AGENT_PROVIDER_DEFINITIONS.map((def) => ({
|
|
5
|
-
provider: def.id,
|
|
6
|
-
label: def.label,
|
|
7
|
-
source: "builtin",
|
|
8
|
-
status: "available",
|
|
9
|
-
enabled: def.enabledByDefault === false ? "Disabled" : "Enabled",
|
|
10
|
-
defaultMode: def.defaultModeId ?? "-",
|
|
11
|
-
modes: def.modes.length > 0 ? def.modes.map((m) => m.label).join(", ") : "-",
|
|
12
|
-
}));
|
|
13
|
-
function getStaticProviders() {
|
|
14
|
-
return PROVIDERS;
|
|
15
|
-
}
|
|
1
|
+
import { connectToDaemon } from "../../utils/client.js";
|
|
16
2
|
/** Schema for provider ls output */
|
|
17
3
|
export const providerLsSchema = {
|
|
18
4
|
idField: "provider",
|
|
@@ -38,14 +24,7 @@ export const providerLsSchema = {
|
|
|
38
24
|
],
|
|
39
25
|
};
|
|
40
26
|
export async function runLsCommand(options, _command) {
|
|
41
|
-
const client = await
|
|
42
|
-
if (!client) {
|
|
43
|
-
return {
|
|
44
|
-
type: "list",
|
|
45
|
-
data: getStaticProviders(),
|
|
46
|
-
schema: providerLsSchema,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
27
|
+
const client = await connectToDaemon({ target: options.daemonTarget });
|
|
49
28
|
try {
|
|
50
29
|
const snapshot = await client.getProvidersSnapshot();
|
|
51
30
|
return {
|
|
@@ -62,13 +41,6 @@ export async function runLsCommand(options, _command) {
|
|
|
62
41
|
schema: providerLsSchema,
|
|
63
42
|
};
|
|
64
43
|
}
|
|
65
|
-
catch {
|
|
66
|
-
return {
|
|
67
|
-
type: "list",
|
|
68
|
-
data: getStaticProviders(),
|
|
69
|
-
schema: providerLsSchema,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
44
|
finally {
|
|
73
45
|
await client.close().catch(() => { });
|
|
74
46
|
}
|
|
@@ -23,7 +23,7 @@ const providerModelsWithThinkingSchema = {
|
|
|
23
23
|
};
|
|
24
24
|
export async function runModelsCommand(provider, options, _command) {
|
|
25
25
|
const normalizedProvider = provider.toLowerCase();
|
|
26
|
-
const client = await connectToDaemon({
|
|
26
|
+
const client = await connectToDaemon({ target: options.daemonTarget });
|
|
27
27
|
try {
|
|
28
28
|
const result = await client.listProviderModels(normalizedProvider);
|
|
29
29
|
if (result.error) {
|
|
@@ -14,8 +14,8 @@ export async function runRmCommand(id, options, _command) {
|
|
|
14
14
|
message: `"${id}" is a built-in provider and cannot be removed.`,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
const host = getDaemonHost({
|
|
18
|
-
const client = await connectToDaemon({
|
|
17
|
+
const host = getDaemonHost({ target: options.daemonTarget });
|
|
18
|
+
const client = await connectToDaemon({ target: options.daemonTarget }).catch((error) => {
|
|
19
19
|
const message = error instanceof Error ? error.message : String(error);
|
|
20
20
|
throw {
|
|
21
21
|
code: "DAEMON_NOT_RUNNING",
|
|
@@ -14,12 +14,12 @@ export async function runCreateCommand(prompt, options, command) {
|
|
|
14
14
|
mode: options.mode,
|
|
15
15
|
thinking: options.thinking,
|
|
16
16
|
cwd: options.cwd,
|
|
17
|
-
|
|
17
|
+
daemonTarget: options.daemonTarget,
|
|
18
18
|
maxRuns: options.maxRuns,
|
|
19
19
|
expiresIn: options.expiresIn,
|
|
20
20
|
runNow,
|
|
21
21
|
});
|
|
22
|
-
const { client } = await connectScheduleClient(options.
|
|
22
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
23
23
|
try {
|
|
24
24
|
const payload = await client.scheduleCreate(input);
|
|
25
25
|
if (payload.error || !payload.schedule) {
|
|
@@ -7,7 +7,7 @@ const scheduleDeleteSchema = {
|
|
|
7
7
|
],
|
|
8
8
|
};
|
|
9
9
|
export async function runDeleteCommand(id, options, _command) {
|
|
10
|
-
const { client } = await connectScheduleClient(options.
|
|
10
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
11
11
|
try {
|
|
12
12
|
const payload = await client.scheduleDelete({ id });
|
|
13
13
|
if (payload.error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createScheduleInspectRows, createScheduleInspectSchema, } from "./schema.js";
|
|
2
2
|
import { connectScheduleClient, toScheduleCommandError, } from "./shared.js";
|
|
3
3
|
export async function runInspectCommand(id, options, _command) {
|
|
4
|
-
const { client } = await connectScheduleClient(options.
|
|
4
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
const payload = await client.scheduleInspect({ id });
|
|
7
7
|
if (payload.error || !payload.schedule) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { scheduleLogSchema, toScheduleLogRow } from "./schema.js";
|
|
2
2
|
import { connectScheduleClient, requireNewAgentSchedule, toScheduleCommandError, } from "./shared.js";
|
|
3
3
|
export async function runLogsCommand(id, options, _command) {
|
|
4
|
-
const { client } = await connectScheduleClient(options.
|
|
4
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
await requireNewAgentSchedule(client, id);
|
|
7
7
|
const payload = await client.scheduleLogs({ id });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { scheduleSchema } from "./schema.js";
|
|
2
2
|
import { connectScheduleClient, toScheduleCommandError, toScheduleRow, } from "./shared.js";
|
|
3
3
|
export async function runLsCommand(options, _command) {
|
|
4
|
-
const { client } = await connectScheduleClient(options.
|
|
4
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
const payload = await client.scheduleList();
|
|
7
7
|
if (payload.error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { scheduleSchema } from "./schema.js";
|
|
2
2
|
import { connectScheduleClient, requireNewAgentSchedule, toScheduleCommandError, toScheduleRow, } from "./shared.js";
|
|
3
3
|
export async function runPauseCommand(id, options, _command) {
|
|
4
|
-
const { client } = await connectScheduleClient(options.
|
|
4
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
await requireNewAgentSchedule(client, id);
|
|
7
7
|
const payload = await client.schedulePause({ id });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { scheduleSchema } from "./schema.js";
|
|
2
2
|
import { connectScheduleClient, requireNewAgentSchedule, toScheduleCommandError, toScheduleRow, } from "./shared.js";
|
|
3
3
|
export async function runResumeCommand(id, options, _command) {
|
|
4
|
-
const { client } = await connectScheduleClient(options.
|
|
4
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
await requireNewAgentSchedule(client, id);
|
|
7
7
|
const payload = await client.scheduleResume({ id });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { scheduleSchema } from "./schema.js";
|
|
2
2
|
import { connectScheduleClient, requireNewAgentSchedule, toScheduleCommandError, toScheduleRow, } from "./shared.js";
|
|
3
3
|
export async function runRunOnceCommand(id, options, _command) {
|
|
4
|
-
const { client } = await connectScheduleClient(options.
|
|
4
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
await requireNewAgentSchedule(client, id);
|
|
7
7
|
const payload = await client.scheduleRunOnce({ id });
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { DaemonTarget } from "../../utils/daemon-target.js";
|
|
1
2
|
import type { CommandError, CommandOptions } from "../../output/index.js";
|
|
2
3
|
import type { CreateScheduleInput, ScheduleCadence, ScheduleDaemonClient, ScheduleListItem, ScheduleRecord, ScheduleTarget, UpdateScheduleInput } from "./types.js";
|
|
3
4
|
export interface ScheduleCommandOptions extends CommandOptions {
|
|
4
5
|
host?: string;
|
|
5
6
|
}
|
|
6
|
-
export declare function connectScheduleClient(
|
|
7
|
+
export declare function connectScheduleClient(target: DaemonTarget): Promise<{
|
|
7
8
|
client: ScheduleDaemonClient;
|
|
8
9
|
host: string;
|
|
9
10
|
}>;
|
|
@@ -24,6 +25,7 @@ export declare function parseScheduleCreateInput(options: {
|
|
|
24
25
|
thinking?: string;
|
|
25
26
|
cwd?: string;
|
|
26
27
|
host?: string;
|
|
28
|
+
daemonTarget: import("../../utils/daemon-target.js").DaemonTarget;
|
|
27
29
|
maxRuns?: string;
|
|
28
30
|
expiresIn?: string;
|
|
29
31
|
runNow?: boolean;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { connectToDaemon, getDaemonHost
|
|
1
|
+
import { connectToDaemon, getDaemonHost } 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 "@camerontaylor/paseo-protocol/schedule/cadence";
|
|
5
|
-
export async function connectScheduleClient(
|
|
6
|
-
const resolvedHost = getDaemonHost({
|
|
5
|
+
export async function connectScheduleClient(target) {
|
|
6
|
+
const resolvedHost = getDaemonHost({ target });
|
|
7
7
|
try {
|
|
8
8
|
const client = (await connectToDaemon({
|
|
9
|
-
|
|
9
|
+
target,
|
|
10
10
|
}));
|
|
11
11
|
return { client, host: resolvedHost };
|
|
12
12
|
}
|
|
13
13
|
catch (error) {
|
|
14
|
+
if (error && typeof error === "object" && "code" in error)
|
|
15
|
+
throw error;
|
|
14
16
|
const message = error instanceof Error ? error.message : String(error);
|
|
15
17
|
throw {
|
|
16
18
|
code: "DAEMON_NOT_RUNNING",
|
|
@@ -116,7 +118,7 @@ export function parseScheduleCreateInput(options) {
|
|
|
116
118
|
};
|
|
117
119
|
}
|
|
118
120
|
const cwdInput = options.cwd?.trim();
|
|
119
|
-
if (
|
|
121
|
+
if (options.daemonTarget.kind === "endpoint" && !cwdInput) {
|
|
120
122
|
throw {
|
|
121
123
|
code: "MISSING_CWD",
|
|
122
124
|
message: "--cwd is required when --host is specified (the local working directory will not exist on the remote daemon)",
|
|
@@ -17,7 +17,7 @@ export async function runUpdateCommand(id, options, _command) {
|
|
|
17
17
|
clearMaxRuns: options.noMaxRuns,
|
|
18
18
|
clearExpires: options.noExpiresIn,
|
|
19
19
|
});
|
|
20
|
-
const { client } = await connectScheduleClient(options.
|
|
20
|
+
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
21
21
|
try {
|
|
22
22
|
await requireNewAgentSchedule(client, id);
|
|
23
23
|
const payload = await client.scheduleUpdate(input);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { connectWorkspaceScriptClient, resolveWorkspaceScriptWorkspaceId, toWorkspaceScriptCommandError, } from "./shared.js";
|
|
2
2
|
import { workspaceScriptSchema } from "./schema.js";
|
|
3
3
|
export async function runLsCommand(options, _command) {
|
|
4
|
-
const client = await connectWorkspaceScriptClient(options.
|
|
4
|
+
const client = await connectWorkspaceScriptClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
const workspaceId = await resolveWorkspaceScriptWorkspaceId(client, options);
|
|
7
7
|
const payload = await client.listWorkspaceScripts(workspaceId);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DaemonTarget } from "../../utils/daemon-target.js";
|
|
1
2
|
import type { DaemonClient } from "@camerontaylor/paseo-client/internal/daemon-client";
|
|
2
3
|
import type { CommandError, CommandOptions } from "../../output/index.js";
|
|
3
4
|
export interface WorkspaceScriptCommandOptions extends CommandOptions {
|
|
@@ -5,7 +6,7 @@ export interface WorkspaceScriptCommandOptions extends CommandOptions {
|
|
|
5
6
|
cwd?: string;
|
|
6
7
|
workspace?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function connectWorkspaceScriptClient(
|
|
9
|
+
export declare function connectWorkspaceScriptClient(target: DaemonTarget): Promise<DaemonClient>;
|
|
9
10
|
export declare function resolveWorkspaceScriptWorkspaceId(client: DaemonClient, options: WorkspaceScriptCommandOptions): Promise<string>;
|
|
10
11
|
export declare function toWorkspaceScriptCommandError(code: string, action: string, error: unknown): CommandError;
|
|
11
12
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
3
|
-
export async function connectWorkspaceScriptClient(
|
|
4
|
-
const daemonHost = getDaemonHost({
|
|
3
|
+
export async function connectWorkspaceScriptClient(target) {
|
|
4
|
+
const daemonHost = getDaemonHost({ target });
|
|
5
5
|
try {
|
|
6
|
-
const client = await connectToDaemon({
|
|
6
|
+
const client = await connectToDaemon({ target });
|
|
7
7
|
// COMPAT(workspaceScriptManagement): added in v0.1.105, remove gate after 2027-01-10.
|
|
8
8
|
if (!client.getLastServerInfoMessage()?.features?.workspaceScriptManagement) {
|
|
9
9
|
await client.close().catch(() => { });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { connectWorkspaceScriptClient, resolveWorkspaceScriptWorkspaceId, toWorkspaceScriptCommandError, } from "./shared.js";
|
|
2
2
|
import { workspaceScriptSchema } from "./schema.js";
|
|
3
3
|
export async function runStartCommand(scriptName, options, _command) {
|
|
4
|
-
const client = await connectWorkspaceScriptClient(options.
|
|
4
|
+
const client = await connectWorkspaceScriptClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
const workspaceId = await resolveWorkspaceScriptWorkspaceId(client, options);
|
|
7
7
|
const payload = await client.startWorkspaceScriptWithStatus(workspaceId, scriptName);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { connectWorkspaceScriptClient, resolveWorkspaceScriptWorkspaceId, toWorkspaceScriptCommandError, } from "./shared.js";
|
|
2
2
|
import { workspaceScriptSchema } from "./schema.js";
|
|
3
3
|
export async function runStopCommand(scriptName, options, _command) {
|
|
4
|
-
const client = await connectWorkspaceScriptClient(options.
|
|
4
|
+
const client = await connectWorkspaceScriptClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
const workspaceId = await resolveWorkspaceScriptWorkspaceId(client, options);
|
|
7
7
|
const payload = await client.stopWorkspaceScript(workspaceId, scriptName);
|
|
@@ -6,5 +6,5 @@ export interface TerminalCaptureOptions extends TerminalCommandOptions {
|
|
|
6
6
|
scrollback?: boolean;
|
|
7
7
|
ansi?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare function runCaptureCommand(terminalId: string,
|
|
9
|
+
export declare function runCaptureCommand(terminalId: string, options: TerminalCaptureOptions, _command: Command): Promise<void>;
|
|
10
10
|
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { renderError, toCommandError } from "../../output/render.js";
|
|
2
2
|
import { connectTerminalClient, resolveTerminalId, toTerminalCommandError, } from "./shared.js";
|
|
3
|
-
export async function runCaptureCommand(terminalId,
|
|
4
|
-
const options = command.optsWithGlobals();
|
|
3
|
+
export async function runCaptureCommand(terminalId, options, _command) {
|
|
5
4
|
try {
|
|
6
5
|
const payload = await executeCaptureCommand(terminalId, options);
|
|
7
6
|
if (options.json) {
|
|
@@ -26,7 +25,7 @@ export async function runCaptureCommand(terminalId, _options, command) {
|
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
async function executeCaptureCommand(terminalId, options) {
|
|
29
|
-
const { client, close } = await connectTerminalClient(options.
|
|
28
|
+
const { client, close } = await connectTerminalClient(options.daemonTarget);
|
|
30
29
|
try {
|
|
31
30
|
const resolvedId = await resolveTerminalId(client, terminalId);
|
|
32
31
|
if (!resolvedId) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { connectTerminalClient, toTerminalCommandError, } from "./shared.js";
|
|
2
2
|
import { terminalSchema } from "./schema.js";
|
|
3
3
|
export async function runCreateCommand(options, _command) {
|
|
4
|
-
const { client, close } = await connectTerminalClient(options.
|
|
4
|
+
const { client, close } = await connectTerminalClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
const cwd = options.cwd ?? (options.workspace ? undefined : process.cwd());
|
|
7
7
|
const workspaceId = options.workspace ?? (await client.workspaces.open(options.cwd ?? process.cwd())).id;
|
|
@@ -1,7 +1,7 @@
|
|
|
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, close } = await connectTerminalClient(options.
|
|
4
|
+
const { client, close } = await connectTerminalClient(options.daemonTarget);
|
|
5
5
|
try {
|
|
6
6
|
const resolvedId = await requireTerminalId(client, terminalId);
|
|
7
7
|
await client.terminals.ref(resolvedId).kill();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { connectTerminalClient, toTerminalCommandError, } from "./shared.js";
|
|
2
2
|
import { terminalSchema } from "./schema.js";
|
|
3
3
|
export async function runLsCommand(options, _command) {
|
|
4
|
-
const { client, close } = await connectTerminalClient(options.
|
|
4
|
+
const { client, close } = await connectTerminalClient(options.daemonTarget);
|
|
5
5
|
const cwd = options.all || options.workspace ? undefined : (options.cwd ?? process.cwd());
|
|
6
6
|
try {
|
|
7
7
|
const payload = await client.terminals.list({ cwd, workspaceId: options.workspace });
|