@actant/cli 0.2.0 → 0.2.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/bin/actant.js +1 -1
- package/dist/{chunk-664FYMDI.js → chunk-6OQTL4PN.js} +224 -135
- package/dist/chunk-6OQTL4PN.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{program-5GYDDKP6.js → program-RB2YXKPH.js} +2 -2
- package/dist/{repl-ZVBJSFT5.js → repl-3E2HUEX6.js} +2 -2
- package/package.json +8 -7
- package/dist/chunk-664FYMDI.js.map +0 -1
- /package/dist/{program-5GYDDKP6.js.map → program-RB2YXKPH.js.map} +0 -0
- /package/dist/{repl-ZVBJSFT5.js.map → repl-3E2HUEX6.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/program.ts
|
|
2
|
-
import { Command as
|
|
2
|
+
import { Command as Command75 } from "commander";
|
|
3
3
|
import { readFileSync as readFileSync4 } from "fs";
|
|
4
4
|
import { join as join7 } from "path";
|
|
5
5
|
import { getDefaultIpcPath as getDefaultIpcPath2 } from "@actant/shared";
|
|
@@ -116,7 +116,7 @@ function formatTemplateList(templates, format) {
|
|
|
116
116
|
t.name,
|
|
117
117
|
t.version,
|
|
118
118
|
t.backend.type,
|
|
119
|
-
t.provider.
|
|
119
|
+
t.provider?.type ?? chalk.dim("(default)"),
|
|
120
120
|
t.description ?? chalk.dim("\u2014")
|
|
121
121
|
]);
|
|
122
122
|
}
|
|
@@ -134,7 +134,7 @@ function formatTemplateDetail(template, format) {
|
|
|
134
134
|
`${chalk.bold("Template:")} ${template.name}`,
|
|
135
135
|
`${chalk.bold("Version:")} ${template.version}`,
|
|
136
136
|
`${chalk.bold("Backend:")} ${template.backend.type}`,
|
|
137
|
-
`${chalk.bold("Provider:")} ${template.provider
|
|
137
|
+
`${chalk.bold("Provider:")} ${template.provider?.type ?? "(default)"}`
|
|
138
138
|
];
|
|
139
139
|
if (template.description) {
|
|
140
140
|
lines.push(`${chalk.bold("Desc:")} ${template.description}`);
|
|
@@ -1089,7 +1089,19 @@ async function runDirectBridgeChat(client, name, opts, printer) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
};
|
|
1091
1091
|
try {
|
|
1092
|
-
|
|
1092
|
+
try {
|
|
1093
|
+
await conn.spawn(resolved.command, resolved.args, resolved.workspaceDir);
|
|
1094
|
+
} catch (spawnErr) {
|
|
1095
|
+
const msg = spawnErr instanceof Error ? spawnErr.message : String(spawnErr);
|
|
1096
|
+
if (/ENOENT|EINVAL|is not recognized|not found/i.test(msg)) {
|
|
1097
|
+
throw new Error(
|
|
1098
|
+
`Cannot start "${resolved.command}". Is it installed?
|
|
1099
|
+
` + (resolved.backendType === "claude-code" ? ` Install with: npm install -g @zed-industries/claude-agent-acp` : ` Ensure the backend CLI is installed and in your PATH.`),
|
|
1100
|
+
{ cause: spawnErr }
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
throw spawnErr;
|
|
1104
|
+
}
|
|
1093
1105
|
await client.call("agent.attach", {
|
|
1094
1106
|
name: resolved.instanceName,
|
|
1095
1107
|
pid: process.pid,
|
|
@@ -1203,6 +1215,8 @@ function createAgentDispatchCommand(client, printer = defaultPrinter) {
|
|
|
1203
1215
|
printer.log("Task queued.");
|
|
1204
1216
|
} else {
|
|
1205
1217
|
printer.dim(`No scheduler for agent "${name}". Task not queued.`);
|
|
1218
|
+
printer.dim(`Hint: use "actant agent run ${name} --prompt <message>" for one-shot execution.`);
|
|
1219
|
+
process.exitCode = 1;
|
|
1206
1220
|
}
|
|
1207
1221
|
} catch (err) {
|
|
1208
1222
|
presentError(err, printer);
|
|
@@ -1292,7 +1306,7 @@ import chalk17 from "chalk";
|
|
|
1292
1306
|
// package.json
|
|
1293
1307
|
var package_default = {
|
|
1294
1308
|
name: "@actant/cli",
|
|
1295
|
-
version: "0.2.
|
|
1309
|
+
version: "0.2.1",
|
|
1296
1310
|
description: "CLI for the Actant AI agent platform \u2014 build, manage, and compose AI agents",
|
|
1297
1311
|
type: "module",
|
|
1298
1312
|
license: "MIT",
|
|
@@ -1323,7 +1337,8 @@ var package_default = {
|
|
|
1323
1337
|
".": {
|
|
1324
1338
|
import: "./dist/index.js",
|
|
1325
1339
|
types: "./dist/index.d.ts"
|
|
1326
|
-
}
|
|
1340
|
+
},
|
|
1341
|
+
"./dist/bin/actant.js": "./dist/bin/actant.js"
|
|
1327
1342
|
},
|
|
1328
1343
|
bin: {
|
|
1329
1344
|
actant: "./dist/bin/actant.js"
|
|
@@ -1883,7 +1898,7 @@ function createPluginCommand(client, printer) {
|
|
|
1883
1898
|
}
|
|
1884
1899
|
|
|
1885
1900
|
// src/commands/source/index.ts
|
|
1886
|
-
import { Command as
|
|
1901
|
+
import { Command as Command61 } from "commander";
|
|
1887
1902
|
|
|
1888
1903
|
// src/commands/source/list.ts
|
|
1889
1904
|
import { Command as Command56 } from "commander";
|
|
@@ -1977,23 +1992,110 @@ function createSourceSyncCommand(client, printer = defaultPrinter) {
|
|
|
1977
1992
|
});
|
|
1978
1993
|
}
|
|
1979
1994
|
|
|
1995
|
+
// src/commands/source/validate.ts
|
|
1996
|
+
import chalk19 from "chalk";
|
|
1997
|
+
import { Command as Command60 } from "commander";
|
|
1998
|
+
function createSourceValidateCommand(client, printer = defaultPrinter) {
|
|
1999
|
+
return new Command60("validate").description("Validate all assets in a component source").argument("[name]", "Registered source name to validate").option("--path <dir>", "Validate a local directory directly (no registration needed)").option("-f, --format <format>", "Output format: table, json", "table").option("--strict", "Treat warnings as errors", false).option("--compat <standard>", "Enable compatibility checks (e.g. agent-skills)").action(async (name, opts) => {
|
|
2000
|
+
try {
|
|
2001
|
+
if (!name && !opts?.path) {
|
|
2002
|
+
printer.error("Provide a source name or --path <dir>");
|
|
2003
|
+
process.exitCode = 1;
|
|
2004
|
+
return;
|
|
2005
|
+
}
|
|
2006
|
+
const result = await client.call("source.validate", {
|
|
2007
|
+
name: name || void 0,
|
|
2008
|
+
path: opts?.path || void 0,
|
|
2009
|
+
strict: opts?.strict || false,
|
|
2010
|
+
compat: opts?.compat || void 0
|
|
2011
|
+
});
|
|
2012
|
+
if (opts?.format === "json") {
|
|
2013
|
+
printer.log(JSON.stringify(result, null, 2));
|
|
2014
|
+
} else {
|
|
2015
|
+
printTableReport(result, printer);
|
|
2016
|
+
}
|
|
2017
|
+
if (!result.valid) {
|
|
2018
|
+
process.exitCode = 1;
|
|
2019
|
+
}
|
|
2020
|
+
} catch (err) {
|
|
2021
|
+
presentError(err, printer);
|
|
2022
|
+
process.exitCode = 1;
|
|
2023
|
+
}
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
function printTableReport(report, printer) {
|
|
2027
|
+
printer.log("");
|
|
2028
|
+
printer.log(`Validating source: ${chalk19.bold(report.sourceName)} (${report.rootDir})`);
|
|
2029
|
+
printer.log("");
|
|
2030
|
+
const grouped = groupByPath(report.issues);
|
|
2031
|
+
const reportedPaths = /* @__PURE__ */ new Set();
|
|
2032
|
+
for (const [path, issues] of grouped) {
|
|
2033
|
+
reportedPaths.add(path);
|
|
2034
|
+
for (const issue of issues) {
|
|
2035
|
+
const tag = severityTag(issue.severity);
|
|
2036
|
+
const comp = issue.component ? ` (${issue.component})` : "";
|
|
2037
|
+
printer.log(` ${tag} ${path}${comp} \u2014 ${issue.message}`);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
if (report.summary.pass > 0) {
|
|
2041
|
+
const passMsg = chalk19.green(`${report.summary.pass} component(s) passed`);
|
|
2042
|
+
const errMsg = report.summary.error > 0 ? chalk19.red(`, ${report.summary.error} error(s)`) : "";
|
|
2043
|
+
const warnMsg = report.summary.warn > 0 ? chalk19.yellow(`, ${report.summary.warn} warning(s)`) : "";
|
|
2044
|
+
printer.log("");
|
|
2045
|
+
printer.log(`Summary: ${passMsg}${warnMsg}${errMsg}`);
|
|
2046
|
+
} else if (report.issues.length === 0) {
|
|
2047
|
+
printer.log(chalk19.dim(" No components found to validate."));
|
|
2048
|
+
}
|
|
2049
|
+
printer.log("");
|
|
2050
|
+
if (report.valid) {
|
|
2051
|
+
printer.log(chalk19.green("Validation passed."));
|
|
2052
|
+
} else {
|
|
2053
|
+
printer.log(chalk19.red("Validation failed."));
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
function severityTag(severity) {
|
|
2057
|
+
switch (severity) {
|
|
2058
|
+
case "error":
|
|
2059
|
+
return chalk19.red("[ERROR]");
|
|
2060
|
+
case "warning":
|
|
2061
|
+
return chalk19.yellow("[WARN] ");
|
|
2062
|
+
case "info":
|
|
2063
|
+
return chalk19.blue("[INFO] ");
|
|
2064
|
+
default:
|
|
2065
|
+
return `[${severity}]`;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
function groupByPath(issues) {
|
|
2069
|
+
const map = /* @__PURE__ */ new Map();
|
|
2070
|
+
for (const issue of issues) {
|
|
2071
|
+
let arr = map.get(issue.path);
|
|
2072
|
+
if (!arr) {
|
|
2073
|
+
arr = [];
|
|
2074
|
+
map.set(issue.path, arr);
|
|
2075
|
+
}
|
|
2076
|
+
arr.push(issue);
|
|
2077
|
+
}
|
|
2078
|
+
return map;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
1980
2081
|
// src/commands/source/index.ts
|
|
1981
2082
|
function createSourceCommand(client, printer) {
|
|
1982
|
-
const cmd = new
|
|
2083
|
+
const cmd = new Command61("source").description("Manage component sources (GitHub repos, local dirs)");
|
|
1983
2084
|
cmd.addCommand(createSourceListCommand(client, printer));
|
|
1984
2085
|
cmd.addCommand(createSourceAddCommand(client, printer));
|
|
1985
2086
|
cmd.addCommand(createSourceRemoveCommand(client, printer));
|
|
1986
2087
|
cmd.addCommand(createSourceSyncCommand(client, printer));
|
|
2088
|
+
cmd.addCommand(createSourceValidateCommand(client, printer));
|
|
1987
2089
|
return cmd;
|
|
1988
2090
|
}
|
|
1989
2091
|
|
|
1990
2092
|
// src/commands/preset/index.ts
|
|
1991
|
-
import { Command as
|
|
2093
|
+
import { Command as Command65 } from "commander";
|
|
1992
2094
|
|
|
1993
2095
|
// src/commands/preset/list.ts
|
|
1994
|
-
import { Command as
|
|
2096
|
+
import { Command as Command62 } from "commander";
|
|
1995
2097
|
function createPresetListCommand(client, printer = defaultPrinter) {
|
|
1996
|
-
return new
|
|
2098
|
+
return new Command62("list").alias("ls").description("List available presets from registered sources").argument("[package]", "Filter by source package name").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (packageName, opts) => {
|
|
1997
2099
|
try {
|
|
1998
2100
|
const presets = await client.call("preset.list", { packageName });
|
|
1999
2101
|
if (opts.format === "json") {
|
|
@@ -2018,9 +2120,9 @@ function createPresetListCommand(client, printer = defaultPrinter) {
|
|
|
2018
2120
|
}
|
|
2019
2121
|
|
|
2020
2122
|
// src/commands/preset/show.ts
|
|
2021
|
-
import { Command as
|
|
2123
|
+
import { Command as Command63 } from "commander";
|
|
2022
2124
|
function createPresetShowCommand(client, printer = defaultPrinter) {
|
|
2023
|
-
return new
|
|
2125
|
+
return new Command63("show").description("Show preset details").argument("<qualified-name>", "Preset qualified name (package@preset)").option("-f, --format <format>", "Output format: table, json", "table").action(async (qualifiedName, opts) => {
|
|
2024
2126
|
try {
|
|
2025
2127
|
const preset = await client.call("preset.show", { qualifiedName });
|
|
2026
2128
|
if (opts.format === "json") {
|
|
@@ -2041,9 +2143,9 @@ function createPresetShowCommand(client, printer = defaultPrinter) {
|
|
|
2041
2143
|
}
|
|
2042
2144
|
|
|
2043
2145
|
// src/commands/preset/apply.ts
|
|
2044
|
-
import { Command as
|
|
2146
|
+
import { Command as Command64 } from "commander";
|
|
2045
2147
|
function createPresetApplyCommand(client, printer = defaultPrinter) {
|
|
2046
|
-
return new
|
|
2148
|
+
return new Command64("apply").description("Apply a preset to a template (adds all preset components)").argument("<qualified-name>", "Preset qualified name (package@preset)").argument("<template>", "Template name to apply to").action(async (qualifiedName, templateName) => {
|
|
2047
2149
|
try {
|
|
2048
2150
|
const result = await client.call("preset.apply", { qualifiedName, templateName });
|
|
2049
2151
|
printer.success(`Preset "${qualifiedName}" applied to template "${result.name}".`);
|
|
@@ -2056,7 +2158,7 @@ function createPresetApplyCommand(client, printer = defaultPrinter) {
|
|
|
2056
2158
|
|
|
2057
2159
|
// src/commands/preset/index.ts
|
|
2058
2160
|
function createPresetCommand(client, printer) {
|
|
2059
|
-
const cmd = new
|
|
2161
|
+
const cmd = new Command65("preset").description("Manage component presets (bundled compositions)");
|
|
2060
2162
|
cmd.addCommand(createPresetListCommand(client, printer));
|
|
2061
2163
|
cmd.addCommand(createPresetShowCommand(client, printer));
|
|
2062
2164
|
cmd.addCommand(createPresetApplyCommand(client, printer));
|
|
@@ -2064,12 +2166,12 @@ function createPresetCommand(client, printer) {
|
|
|
2064
2166
|
}
|
|
2065
2167
|
|
|
2066
2168
|
// src/commands/schedule/index.ts
|
|
2067
|
-
import { Command as
|
|
2169
|
+
import { Command as Command67 } from "commander";
|
|
2068
2170
|
|
|
2069
2171
|
// src/commands/schedule/list.ts
|
|
2070
|
-
import { Command as
|
|
2172
|
+
import { Command as Command66 } from "commander";
|
|
2071
2173
|
function createScheduleListCommand(client, printer = defaultPrinter) {
|
|
2072
|
-
return new
|
|
2174
|
+
return new Command66("list").alias("ls").description("List schedule sources for an agent").argument("<name>", "Agent name").option("-f, --format <format>", "Output format: table, json", "table").action(async (name, opts) => {
|
|
2073
2175
|
try {
|
|
2074
2176
|
const result = await client.call("schedule.list", { name });
|
|
2075
2177
|
if (opts.format === "json") {
|
|
@@ -2077,6 +2179,7 @@ function createScheduleListCommand(client, printer = defaultPrinter) {
|
|
|
2077
2179
|
} else {
|
|
2078
2180
|
if (result.sources.length === 0 && !result.running) {
|
|
2079
2181
|
printer.dim(`No scheduler for agent "${name}".`);
|
|
2182
|
+
process.exitCode = 1;
|
|
2080
2183
|
} else {
|
|
2081
2184
|
printer.log(`Scheduler: ${result.running ? "running" : "stopped"}`);
|
|
2082
2185
|
for (const s of result.sources) {
|
|
@@ -2093,19 +2196,19 @@ function createScheduleListCommand(client, printer = defaultPrinter) {
|
|
|
2093
2196
|
|
|
2094
2197
|
// src/commands/schedule/index.ts
|
|
2095
2198
|
function createScheduleCommand(client, printer) {
|
|
2096
|
-
const cmd = new
|
|
2199
|
+
const cmd = new Command67("schedule").description("Manage agent schedules (heartbeat, cron, hooks)");
|
|
2097
2200
|
cmd.addCommand(createScheduleListCommand(client, printer));
|
|
2098
2201
|
return cmd;
|
|
2099
2202
|
}
|
|
2100
2203
|
|
|
2101
2204
|
// src/commands/daemon/index.ts
|
|
2102
|
-
import { Command as
|
|
2205
|
+
import { Command as Command71 } from "commander";
|
|
2103
2206
|
|
|
2104
2207
|
// src/commands/daemon/start.ts
|
|
2105
|
-
import { Command as
|
|
2208
|
+
import { Command as Command68 } from "commander";
|
|
2106
2209
|
import { join } from "path";
|
|
2107
2210
|
import { fork, spawn as spawn2 } from "child_process";
|
|
2108
|
-
import
|
|
2211
|
+
import chalk20 from "chalk";
|
|
2109
2212
|
import { onShutdownSignal, isWindows, isSingleExecutable } from "@actant/shared";
|
|
2110
2213
|
var SEA_DAEMON_FLAG = "--__actant-daemon";
|
|
2111
2214
|
function spawnDaemonChild() {
|
|
@@ -2128,7 +2231,7 @@ function spawnDaemonChild() {
|
|
|
2128
2231
|
});
|
|
2129
2232
|
}
|
|
2130
2233
|
function createDaemonStartCommand(printer = defaultPrinter) {
|
|
2131
|
-
return new
|
|
2234
|
+
return new Command68("start").description("Start the Actant daemon").option("--foreground", "Run in foreground (don't daemonize)", false).action(async (opts) => {
|
|
2132
2235
|
const client = new RpcClient(defaultSocketPath());
|
|
2133
2236
|
const alive = await client.ping();
|
|
2134
2237
|
if (alive) {
|
|
@@ -2144,7 +2247,7 @@ function createDaemonStartCommand(printer = defaultPrinter) {
|
|
|
2144
2247
|
process.exit(0);
|
|
2145
2248
|
});
|
|
2146
2249
|
await daemon.start();
|
|
2147
|
-
printer.log(`${
|
|
2250
|
+
printer.log(`${chalk20.green("Daemon started (foreground).")} PID: ${process.pid}`);
|
|
2148
2251
|
printer.dim("Press Ctrl+C to stop.");
|
|
2149
2252
|
await new Promise(() => {
|
|
2150
2253
|
});
|
|
@@ -2182,7 +2285,7 @@ function createDaemonStartCommand(printer = defaultPrinter) {
|
|
|
2182
2285
|
if ("connected" in child && child.connected) child.disconnect();
|
|
2183
2286
|
child.unref();
|
|
2184
2287
|
if (healthy) {
|
|
2185
|
-
printer.log(`${
|
|
2288
|
+
printer.log(`${chalk20.green("Daemon started.")} PID: ${child.pid}`);
|
|
2186
2289
|
} else {
|
|
2187
2290
|
const stderr = Buffer.concat(stderrChunks).toString().trim();
|
|
2188
2291
|
printer.error("Daemon process started but is not responding.");
|
|
@@ -2194,9 +2297,9 @@ function createDaemonStartCommand(printer = defaultPrinter) {
|
|
|
2194
2297
|
}
|
|
2195
2298
|
|
|
2196
2299
|
// src/commands/daemon/stop.ts
|
|
2197
|
-
import { Command as
|
|
2300
|
+
import { Command as Command69 } from "commander";
|
|
2198
2301
|
function createDaemonStopCommand(printer = defaultPrinter, client) {
|
|
2199
|
-
return new
|
|
2302
|
+
return new Command69("stop").description("Stop the Actant daemon").action(async () => {
|
|
2200
2303
|
const rpc = client ?? new RpcClient(defaultSocketPath());
|
|
2201
2304
|
try {
|
|
2202
2305
|
await rpc.call("daemon.shutdown", {});
|
|
@@ -2208,10 +2311,10 @@ function createDaemonStopCommand(printer = defaultPrinter, client) {
|
|
|
2208
2311
|
}
|
|
2209
2312
|
|
|
2210
2313
|
// src/commands/daemon/status.ts
|
|
2211
|
-
import { Command as
|
|
2212
|
-
import
|
|
2314
|
+
import { Command as Command70 } from "commander";
|
|
2315
|
+
import chalk21 from "chalk";
|
|
2213
2316
|
function createDaemonStatusCommand(printer = defaultPrinter) {
|
|
2214
|
-
return new
|
|
2317
|
+
return new Command70("status").description("Check if the daemon is running").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (opts) => {
|
|
2215
2318
|
const client = new RpcClient(defaultSocketPath());
|
|
2216
2319
|
try {
|
|
2217
2320
|
const result = await client.call("daemon.ping", {});
|
|
@@ -2231,7 +2334,7 @@ function createDaemonStatusCommand(printer = defaultPrinter) {
|
|
|
2231
2334
|
} else if (opts.format === "quiet") {
|
|
2232
2335
|
printer.log("stopped");
|
|
2233
2336
|
} else {
|
|
2234
|
-
printer.log(
|
|
2337
|
+
printer.log(chalk21.red("Daemon is not running."));
|
|
2235
2338
|
printer.dim("Start with: actant daemon start");
|
|
2236
2339
|
}
|
|
2237
2340
|
process.exitCode = 1;
|
|
@@ -2241,7 +2344,7 @@ function createDaemonStatusCommand(printer = defaultPrinter) {
|
|
|
2241
2344
|
|
|
2242
2345
|
// src/commands/daemon/index.ts
|
|
2243
2346
|
function createDaemonCommand(printer) {
|
|
2244
|
-
const cmd = new
|
|
2347
|
+
const cmd = new Command71("daemon").description("Manage the Actant daemon");
|
|
2245
2348
|
cmd.addCommand(createDaemonStartCommand(printer));
|
|
2246
2349
|
cmd.addCommand(createDaemonStopCommand(printer));
|
|
2247
2350
|
cmd.addCommand(createDaemonStatusCommand(printer));
|
|
@@ -2249,11 +2352,11 @@ function createDaemonCommand(printer) {
|
|
|
2249
2352
|
}
|
|
2250
2353
|
|
|
2251
2354
|
// src/commands/proxy.ts
|
|
2252
|
-
import { Command as
|
|
2355
|
+
import { Command as Command72 } from "commander";
|
|
2253
2356
|
import { spawn as spawn3 } from "child_process";
|
|
2254
2357
|
import { createInterface as createInterface3 } from "readline";
|
|
2255
2358
|
function createProxyCommand(printer = defaultPrinter) {
|
|
2256
|
-
return new
|
|
2359
|
+
return new Command72("proxy").description("Run an ACP proxy for an agent (stdin/stdout ACP protocol)").argument("<name>", "Agent name to proxy").option("--lease", "Use Session Lease mode (requires running agent)", false).option("-t, --template <template>", "Template name (auto-creates instance if not found)").action(async (name, opts) => {
|
|
2257
2360
|
if (opts.lease) {
|
|
2258
2361
|
await runSessionLease(name, printer);
|
|
2259
2362
|
} else {
|
|
@@ -2571,14 +2674,14 @@ function writeAcpError(id, code, message) {
|
|
|
2571
2674
|
}
|
|
2572
2675
|
|
|
2573
2676
|
// src/commands/self-update.ts
|
|
2574
|
-
import { Command as
|
|
2677
|
+
import { Command as Command73 } from "commander";
|
|
2575
2678
|
import { spawn as spawn4 } from "child_process";
|
|
2576
2679
|
import { writeFileSync, mkdirSync, readFileSync, existsSync as existsSync2 } from "fs";
|
|
2577
2680
|
import { join as join2 } from "path";
|
|
2578
2681
|
import { homedir } from "os";
|
|
2579
|
-
import
|
|
2682
|
+
import chalk22 from "chalk";
|
|
2580
2683
|
function createSelfUpdateCommand() {
|
|
2581
|
-
return new
|
|
2684
|
+
return new Command73("self-update").description("Update Actant from local source").option("--source <path>", "Source directory path").option("--check", "Only check for updates, don't apply").option("--force", "Skip active session warnings").option("--dry-run", "Show what would be done without doing it").option("--no-agent", "Skip agent supervisor, run script directly").option("--skip-build", "Skip build step (use pre-built dist)").action(async (opts) => {
|
|
2582
2685
|
const actantHome = process.env.ACTANT_HOME || join2(homedir(), ".actant");
|
|
2583
2686
|
let devSourcePath = opts.source;
|
|
2584
2687
|
if (!devSourcePath) {
|
|
@@ -2591,7 +2694,7 @@ function createSelfUpdateCommand() {
|
|
|
2591
2694
|
}
|
|
2592
2695
|
if (!devSourcePath) {
|
|
2593
2696
|
console.error(
|
|
2594
|
-
|
|
2697
|
+
chalk22.red(
|
|
2595
2698
|
"No source path specified. Use --source <path> or set devSourcePath in ~/.actant/config.json"
|
|
2596
2699
|
)
|
|
2597
2700
|
);
|
|
@@ -2626,37 +2729,37 @@ function createSelfUpdateCommand() {
|
|
|
2626
2729
|
};
|
|
2627
2730
|
mkdirSync(actantHome, { recursive: true });
|
|
2628
2731
|
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
2629
|
-
console.log(
|
|
2732
|
+
console.log(chalk22.cyan("=== Actant Self-Update ==="));
|
|
2630
2733
|
console.log(`Update ID: ${updateId}`);
|
|
2631
2734
|
console.log(`Source: ${devSourcePath}`);
|
|
2632
2735
|
const scriptPath = join2(devSourcePath, "scripts", "self-update.js");
|
|
2633
2736
|
const scriptArgs = ["--manifest", manifestPath];
|
|
2634
2737
|
if (opts.dryRun) scriptArgs.push("--dry-run");
|
|
2635
2738
|
if (opts.skipBuild) scriptArgs.push("--skip-build");
|
|
2636
|
-
console.log(
|
|
2739
|
+
console.log(chalk22.gray(`Spawning: node ${scriptPath} ${scriptArgs.join(" ")}`));
|
|
2637
2740
|
const child = spawn4("node", [scriptPath, ...scriptArgs], {
|
|
2638
2741
|
detached: !opts.noAgent,
|
|
2639
2742
|
stdio: opts.noAgent ? "inherit" : "ignore"
|
|
2640
2743
|
});
|
|
2641
2744
|
if (!opts.noAgent) {
|
|
2642
2745
|
child.unref();
|
|
2643
|
-
console.log(
|
|
2644
|
-
console.log(
|
|
2746
|
+
console.log(chalk22.green("Update script spawned in background. Check logs at:"));
|
|
2747
|
+
console.log(chalk22.gray(` ${join2(actantHome, "logs", `update-${updateId}.log`)}`));
|
|
2645
2748
|
} else {
|
|
2646
2749
|
child.on("exit", (code) => {
|
|
2647
2750
|
if (code === 0) {
|
|
2648
|
-
console.log(
|
|
2751
|
+
console.log(chalk22.green("\nUpdate completed successfully!"));
|
|
2649
2752
|
} else if (code === 1) {
|
|
2650
|
-
console.log(
|
|
2753
|
+
console.log(chalk22.yellow("\nUpdate failed, rolled back to previous version."));
|
|
2651
2754
|
} else {
|
|
2652
|
-
console.log(
|
|
2755
|
+
console.log(chalk22.red("\nSevere failure \u2014 manual intervention may be needed."));
|
|
2653
2756
|
}
|
|
2654
2757
|
});
|
|
2655
2758
|
}
|
|
2656
2759
|
});
|
|
2657
2760
|
}
|
|
2658
2761
|
function showVersionCheck(sourcePath, actantHome) {
|
|
2659
|
-
console.log(
|
|
2762
|
+
console.log(chalk22.cyan("=== Version Check ==="));
|
|
2660
2763
|
try {
|
|
2661
2764
|
const pkg = JSON.parse(readFileSync(join2(sourcePath, "package.json"), "utf-8"));
|
|
2662
2765
|
console.log(`Source version: ${pkg.version || "unknown"}`);
|
|
@@ -2673,8 +2776,8 @@ function showVersionCheck(sourcePath, actantHome) {
|
|
|
2673
2776
|
}
|
|
2674
2777
|
|
|
2675
2778
|
// src/commands/setup/setup.ts
|
|
2676
|
-
import { Command as
|
|
2677
|
-
import
|
|
2779
|
+
import { Command as Command74 } from "commander";
|
|
2780
|
+
import chalk30 from "chalk";
|
|
2678
2781
|
import { getDefaultIpcPath } from "@actant/shared";
|
|
2679
2782
|
|
|
2680
2783
|
// src/commands/setup/steps/choose-home.ts
|
|
@@ -2682,7 +2785,7 @@ import { join as join3 } from "path";
|
|
|
2682
2785
|
import { homedir as homedir2 } from "os";
|
|
2683
2786
|
import { mkdirSync as mkdirSync2, existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
2684
2787
|
import { select, input } from "@inquirer/prompts";
|
|
2685
|
-
import
|
|
2788
|
+
import chalk23 from "chalk";
|
|
2686
2789
|
var DEFAULT_HOME = join3(homedir2(), ".actant");
|
|
2687
2790
|
var SUBDIRS = [
|
|
2688
2791
|
"configs/skills",
|
|
@@ -2698,7 +2801,7 @@ var SUBDIRS = [
|
|
|
2698
2801
|
];
|
|
2699
2802
|
async function chooseHome(printer) {
|
|
2700
2803
|
printer.log(`
|
|
2701
|
-
${
|
|
2804
|
+
${chalk23.cyan("[ Step 1/7 ]")} ${chalk23.bold("\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55")}
|
|
2702
2805
|
`);
|
|
2703
2806
|
const choice = await select({
|
|
2704
2807
|
message: "Actant \u5DE5\u4F5C\u76EE\u5F55 (ACTANT_HOME):",
|
|
@@ -2738,7 +2841,7 @@ ${chalk22.cyan("[ Step 1/7 ]")} ${chalk22.bold("\u9009\u62E9\u5DE5\u4F5C\u76EE\u
|
|
|
2738
2841
|
if (actantHome !== DEFAULT_HOME) {
|
|
2739
2842
|
printer.warn(
|
|
2740
2843
|
` \u8BF7\u5C06\u4EE5\u4E0B\u5185\u5BB9\u6DFB\u52A0\u5230\u4F60\u7684 shell \u914D\u7F6E\u6587\u4EF6 (~/.bashrc, ~/.zshrc, \u6216 $PROFILE):
|
|
2741
|
-
${
|
|
2844
|
+
${chalk23.cyan(`export ACTANT_HOME="${actantHome}"`)}`
|
|
2742
2845
|
);
|
|
2743
2846
|
}
|
|
2744
2847
|
return actantHome;
|
|
@@ -2753,45 +2856,36 @@ function ensureDirectoryStructure(base) {
|
|
|
2753
2856
|
import { join as join4 } from "path";
|
|
2754
2857
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
2755
2858
|
import { select as select2, input as input2, password, confirm } from "@inquirer/prompts";
|
|
2756
|
-
import
|
|
2757
|
-
|
|
2758
|
-
anthropic: { protocol: "http", baseUrl: "https://api.anthropic.com", apiKeyEnv: "ANTHROPIC_API_KEY" },
|
|
2759
|
-
openai: { protocol: "http", baseUrl: "https://api.openai.com/v1", apiKeyEnv: "OPENAI_API_KEY" },
|
|
2760
|
-
"openai-compatible": { protocol: "http", baseUrl: "http://localhost:11434/v1", apiKeyEnv: "LLM_API_KEY" },
|
|
2761
|
-
custom: { protocol: "http", baseUrl: "http://localhost:8080", apiKeyEnv: "LLM_API_KEY" }
|
|
2762
|
-
};
|
|
2859
|
+
import chalk24 from "chalk";
|
|
2860
|
+
import { modelProviderRegistry, registerBuiltinProviders } from "@actant/core";
|
|
2763
2861
|
async function configureProvider(printer, actantHome) {
|
|
2764
2862
|
printer.log(`
|
|
2765
|
-
${
|
|
2863
|
+
${chalk24.cyan("[ Step 2/7 ]")} ${chalk24.bold("\u914D\u7F6E Model Provider")}
|
|
2766
2864
|
`);
|
|
2865
|
+
registerBuiltinProviders();
|
|
2866
|
+
const registeredProviders = modelProviderRegistry.list();
|
|
2867
|
+
const choices = registeredProviders.map((p) => ({
|
|
2868
|
+
name: p.displayName,
|
|
2869
|
+
value: p.type
|
|
2870
|
+
}));
|
|
2767
2871
|
const providerType = await select2({
|
|
2768
2872
|
message: "\u9009\u62E9 Model Provider:",
|
|
2769
2873
|
default: "anthropic",
|
|
2770
|
-
choices
|
|
2771
|
-
{ name: "Anthropic (Claude)", value: "anthropic" },
|
|
2772
|
-
{ name: "OpenAI", value: "openai" },
|
|
2773
|
-
{ name: "OpenAI-Compatible (vLLM / Ollama / LM Studio \u7B49)", value: "openai-compatible" },
|
|
2774
|
-
{ name: "Custom", value: "custom" }
|
|
2775
|
-
]
|
|
2874
|
+
choices
|
|
2776
2875
|
});
|
|
2777
|
-
const
|
|
2778
|
-
protocol: "http",
|
|
2779
|
-
baseUrl: "",
|
|
2780
|
-
apiKeyEnv: "LLM_API_KEY"
|
|
2781
|
-
};
|
|
2782
|
-
const defaults = PROVIDER_DEFAULTS[providerType] ?? fallback;
|
|
2876
|
+
const descriptor = modelProviderRegistry.get(providerType);
|
|
2783
2877
|
const protocol = await select2({
|
|
2784
|
-
message: "\u534F\u8BAE\
|
|
2878
|
+
message: "API \u534F\u8BAE\u683C\u5F0F:",
|
|
2785
2879
|
choices: [
|
|
2786
|
-
{ name: "
|
|
2787
|
-
{ name: "
|
|
2788
|
-
{ name: "
|
|
2880
|
+
{ name: "OpenAI Compatible (Chat Completions API)", value: "openai" },
|
|
2881
|
+
{ name: "Anthropic (Messages API)", value: "anthropic" },
|
|
2882
|
+
{ name: "Custom", value: "custom" }
|
|
2789
2883
|
],
|
|
2790
|
-
default:
|
|
2884
|
+
default: descriptor?.protocol ?? "custom"
|
|
2791
2885
|
});
|
|
2792
2886
|
const baseUrl = await input2({
|
|
2793
2887
|
message: "Base URL:",
|
|
2794
|
-
default:
|
|
2888
|
+
default: descriptor?.defaultBaseUrl ?? "http://localhost:8080",
|
|
2795
2889
|
validate: (val) => {
|
|
2796
2890
|
try {
|
|
2797
2891
|
new URL(val);
|
|
@@ -2801,12 +2895,8 @@ ${chalk23.cyan("[ Step 2/7 ]")} ${chalk23.bold("\u914D\u7F6E Model Provider")}
|
|
|
2801
2895
|
}
|
|
2802
2896
|
}
|
|
2803
2897
|
});
|
|
2804
|
-
const apiKeyEnvName = await input2({
|
|
2805
|
-
message: "API Key \u73AF\u5883\u53D8\u91CF\u540D:",
|
|
2806
|
-
default: defaults.apiKeyEnv
|
|
2807
|
-
});
|
|
2808
2898
|
const apiKey = await password({
|
|
2809
|
-
message:
|
|
2899
|
+
message: "API Key:",
|
|
2810
2900
|
mask: "*"
|
|
2811
2901
|
});
|
|
2812
2902
|
if (apiKey) {
|
|
@@ -2815,27 +2905,26 @@ ${chalk23.cyan("[ Step 2/7 ]")} ${chalk23.bold("\u914D\u7F6E Model Provider")}
|
|
|
2815
2905
|
default: true
|
|
2816
2906
|
});
|
|
2817
2907
|
if (shouldValidate) {
|
|
2818
|
-
printer.log(
|
|
2819
|
-
const ok = await validateConnection(
|
|
2908
|
+
printer.log(chalk24.dim(" \u6B63\u5728\u9A8C\u8BC1\u8FDE\u63A5..."));
|
|
2909
|
+
const ok = await validateConnection(protocol, baseUrl, apiKey);
|
|
2820
2910
|
if (ok) {
|
|
2821
|
-
printer.success(" \
|
|
2911
|
+
printer.success(" \u8FDE\u63A5\u9A8C\u8BC1\u6210\u529F");
|
|
2822
2912
|
} else {
|
|
2823
|
-
printer.warn(" \
|
|
2913
|
+
printer.warn(" \u8FDE\u63A5\u9A8C\u8BC1\u5931\u8D25\uFF0C\u914D\u7F6E\u5DF2\u4FDD\u5B58\u4F46\u53EF\u80FD\u9700\u8981\u68C0\u67E5");
|
|
2824
2914
|
}
|
|
2825
2915
|
}
|
|
2826
|
-
printer.warn(
|
|
2827
|
-
` \u8BF7\u786E\u4FDD\u73AF\u5883\u53D8\u91CF ${chalk23.cyan(apiKeyEnvName)} \u5DF2\u8BBE\u7F6E:
|
|
2828
|
-
${chalk23.dim(`export ${apiKeyEnvName}="${apiKey.slice(0, 8)}..."`)}`
|
|
2829
|
-
);
|
|
2830
2916
|
}
|
|
2831
2917
|
const providerConfig = {
|
|
2832
2918
|
type: providerType,
|
|
2833
2919
|
protocol,
|
|
2834
2920
|
baseUrl,
|
|
2835
|
-
|
|
2921
|
+
...apiKey ? { apiKey } : {}
|
|
2836
2922
|
};
|
|
2837
2923
|
saveProviderConfig(actantHome, providerConfig);
|
|
2838
|
-
printer.success(
|
|
2924
|
+
printer.success(`Model Provider \u5DF2\u914D\u7F6E: ${providerType} (${protocol} protocol) \u2192 ${baseUrl}`);
|
|
2925
|
+
if (apiKey) {
|
|
2926
|
+
printer.success(`API Key \u5DF2\u4FDD\u5B58\u5230 ${chalk24.cyan("~/.actant/config.json")}`);
|
|
2927
|
+
}
|
|
2839
2928
|
}
|
|
2840
2929
|
function saveProviderConfig(actantHome, provider) {
|
|
2841
2930
|
const configFile = join4(actantHome, "config.json");
|
|
@@ -2847,9 +2936,9 @@ function saveProviderConfig(actantHome, provider) {
|
|
|
2847
2936
|
config.provider = provider;
|
|
2848
2937
|
writeFileSync3(configFile, JSON.stringify(config, null, 2) + "\n");
|
|
2849
2938
|
}
|
|
2850
|
-
async function validateConnection(
|
|
2939
|
+
async function validateConnection(protocol, baseUrl, apiKey) {
|
|
2851
2940
|
try {
|
|
2852
|
-
if (
|
|
2941
|
+
if (protocol === "anthropic") {
|
|
2853
2942
|
const res2 = await fetch(`${baseUrl}/v1/messages`, {
|
|
2854
2943
|
method: "POST",
|
|
2855
2944
|
headers: {
|
|
@@ -2866,7 +2955,7 @@ async function validateConnection(type, _protocol, baseUrl, apiKey) {
|
|
|
2866
2955
|
});
|
|
2867
2956
|
return res2.status === 200 || res2.status === 400;
|
|
2868
2957
|
}
|
|
2869
|
-
if (
|
|
2958
|
+
if (protocol === "openai") {
|
|
2870
2959
|
const res2 = await fetch(`${baseUrl}/models`, {
|
|
2871
2960
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
2872
2961
|
signal: AbortSignal.timeout(1e4)
|
|
@@ -2885,12 +2974,12 @@ async function validateConnection(type, _protocol, baseUrl, apiKey) {
|
|
|
2885
2974
|
|
|
2886
2975
|
// src/commands/setup/steps/configure-source.ts
|
|
2887
2976
|
import { confirm as confirm2, input as input3, select as select3 } from "@inquirer/prompts";
|
|
2888
|
-
import
|
|
2977
|
+
import chalk25 from "chalk";
|
|
2889
2978
|
var DEFAULT_SOURCE_NAME = "actant-hub";
|
|
2890
2979
|
var DEFAULT_SOURCE_URL = "https://github.com/blackplume233/actant-hub.git";
|
|
2891
2980
|
async function configureSource(printer, client) {
|
|
2892
2981
|
printer.log(`
|
|
2893
|
-
${
|
|
2982
|
+
${chalk25.cyan("[ Step 3/7 ]")} ${chalk25.bold("\u914D\u7F6E\u7EC4\u4EF6\u6E90 (Source)")}
|
|
2894
2983
|
`);
|
|
2895
2984
|
const addDefault = await confirm2({
|
|
2896
2985
|
message: `\u6DFB\u52A0\u5B98\u65B9\u7EC4\u4EF6\u6E90 ${DEFAULT_SOURCE_NAME}?`,
|
|
@@ -2898,7 +2987,7 @@ ${chalk24.cyan("[ Step 3/7 ]")} ${chalk24.bold("\u914D\u7F6E\u7EC4\u4EF6\u6E90 (
|
|
|
2898
2987
|
});
|
|
2899
2988
|
if (addDefault) {
|
|
2900
2989
|
try {
|
|
2901
|
-
printer.log(
|
|
2990
|
+
printer.log(chalk25.dim(` \u6B63\u5728\u6CE8\u518C ${DEFAULT_SOURCE_NAME}...`));
|
|
2902
2991
|
const result = await client.call("source.add", {
|
|
2903
2992
|
name: DEFAULT_SOURCE_NAME,
|
|
2904
2993
|
config: { type: "github", url: DEFAULT_SOURCE_URL, branch: "main" }
|
|
@@ -2982,10 +3071,10 @@ ${chalk24.cyan("[ Step 3/7 ]")} ${chalk24.bold("\u914D\u7F6E\u7EC4\u4EF6\u6E90 (
|
|
|
2982
3071
|
|
|
2983
3072
|
// src/commands/setup/steps/materialize-agent.ts
|
|
2984
3073
|
import { checkbox, input as input4 } from "@inquirer/prompts";
|
|
2985
|
-
import
|
|
3074
|
+
import chalk26 from "chalk";
|
|
2986
3075
|
async function materializeAgent(printer, client) {
|
|
2987
3076
|
printer.log(`
|
|
2988
|
-
${
|
|
3077
|
+
${chalk26.cyan("[ Step 4/7 ]")} ${chalk26.bold("\u9009\u62E9\u5E76\u521B\u5EFA Agent")}
|
|
2989
3078
|
`);
|
|
2990
3079
|
let templates;
|
|
2991
3080
|
try {
|
|
@@ -3023,7 +3112,7 @@ ${chalk25.cyan("[ Step 4/7 ]")} ${chalk25.bold("\u9009\u62E9\u5E76\u521B\u5EFA A
|
|
|
3023
3112
|
}
|
|
3024
3113
|
});
|
|
3025
3114
|
try {
|
|
3026
|
-
printer.log(
|
|
3115
|
+
printer.log(chalk26.dim(` \u6B63\u5728\u521B\u5EFA ${instanceName.trim()}...`));
|
|
3027
3116
|
await client.call("agent.create", {
|
|
3028
3117
|
name: instanceName.trim(),
|
|
3029
3118
|
template: templateName
|
|
@@ -3046,15 +3135,15 @@ import { writeFileSync as writeFileSync4, mkdirSync as mkdirSync3 } from "fs";
|
|
|
3046
3135
|
import { join as join5 } from "path";
|
|
3047
3136
|
import { homedir as homedir3 } from "os";
|
|
3048
3137
|
import { confirm as confirm3 } from "@inquirer/prompts";
|
|
3049
|
-
import
|
|
3138
|
+
import chalk27 from "chalk";
|
|
3050
3139
|
import { isWindows as isWindows2 } from "@actant/shared";
|
|
3051
3140
|
async function configureAutostart(printer) {
|
|
3052
3141
|
printer.log(`
|
|
3053
|
-
${
|
|
3142
|
+
${chalk27.cyan("[ Step 5/7 ]")} ${chalk27.bold("\u914D\u7F6E\u81EA\u52A8\u542F\u52A8")}
|
|
3054
3143
|
`);
|
|
3055
3144
|
const platform = process.platform;
|
|
3056
3145
|
const platformName = platform === "win32" ? "Windows" : platform === "darwin" ? "macOS" : "Linux";
|
|
3057
|
-
printer.log(` \u68C0\u6D4B\u5230\u5E73\u53F0: ${
|
|
3146
|
+
printer.log(` \u68C0\u6D4B\u5230\u5E73\u53F0: ${chalk27.bold(platformName)}`);
|
|
3058
3147
|
const enable = await confirm3({
|
|
3059
3148
|
message: "\u914D\u7F6E Actant Daemon \u5F00\u673A\u81EA\u542F?",
|
|
3060
3149
|
default: true
|
|
@@ -3078,7 +3167,7 @@ ${chalk26.cyan("[ Step 5/7 ]")} ${chalk26.bold("\u914D\u7F6E\u81EA\u52A8\u542F\u
|
|
|
3078
3167
|
}
|
|
3079
3168
|
}
|
|
3080
3169
|
function configureWindows(printer) {
|
|
3081
|
-
printer.log(
|
|
3170
|
+
printer.log(chalk27.dim(" \u6B63\u5728\u6CE8\u518C Windows Task Scheduler \u4EFB\u52A1..."));
|
|
3082
3171
|
const actantPath = findActantExecutable();
|
|
3083
3172
|
const taskXml = `<?xml version="1.0" encoding="UTF-16"?>
|
|
3084
3173
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
@@ -3112,7 +3201,7 @@ function configureWindows(printer) {
|
|
|
3112
3201
|
printer.dim(" \u5DF2\u6CE8\u518C\u4EFB\u52A1: ActantDaemon (\u767B\u5F55\u65F6\u81EA\u52A8\u542F\u52A8)");
|
|
3113
3202
|
}
|
|
3114
3203
|
function configureMacOS(printer) {
|
|
3115
|
-
printer.log(
|
|
3204
|
+
printer.log(chalk27.dim(" \u6B63\u5728\u751F\u6210 launchd plist..."));
|
|
3116
3205
|
const actantPath = findActantExecutable();
|
|
3117
3206
|
const plistDir = join5(homedir3(), "Library", "LaunchAgents");
|
|
3118
3207
|
mkdirSync3(plistDir, { recursive: true });
|
|
@@ -3145,7 +3234,7 @@ function configureMacOS(printer) {
|
|
|
3145
3234
|
printer.dim(` \u5DF2\u52A0\u8F7D: ${plistPath}`);
|
|
3146
3235
|
}
|
|
3147
3236
|
function configureLinux(printer) {
|
|
3148
|
-
printer.log(
|
|
3237
|
+
printer.log(chalk27.dim(" \u6B63\u5728\u751F\u6210 systemd user service..."));
|
|
3149
3238
|
const actantPath = findActantExecutable();
|
|
3150
3239
|
const serviceDir = join5(homedir3(), ".config", "systemd", "user");
|
|
3151
3240
|
mkdirSync3(serviceDir, { recursive: true });
|
|
@@ -3183,10 +3272,10 @@ function findActantExecutable() {
|
|
|
3183
3272
|
}
|
|
3184
3273
|
|
|
3185
3274
|
// src/commands/setup/steps/hello-world.ts
|
|
3186
|
-
import
|
|
3275
|
+
import chalk28 from "chalk";
|
|
3187
3276
|
async function helloWorld(printer, client, createdAgents) {
|
|
3188
3277
|
printer.log(`
|
|
3189
|
-
${
|
|
3278
|
+
${chalk28.cyan("[ Step 6/7 ]")} ${chalk28.bold("Hello World \u9A8C\u8BC1")}
|
|
3190
3279
|
`);
|
|
3191
3280
|
const alive = await client.ping();
|
|
3192
3281
|
if (!alive) {
|
|
@@ -3205,12 +3294,12 @@ ${chalk27.cyan("[ Step 6/7 ]")} ${chalk27.bold("Hello World \u9A8C\u8BC1")}
|
|
|
3205
3294
|
printer.dim(" \u65E0\u53EF\u7528 Agent\uFF0C\u8DF3\u8FC7\u7AEF\u5230\u7AEF\u9A8C\u8BC1");
|
|
3206
3295
|
return;
|
|
3207
3296
|
}
|
|
3208
|
-
printer.log(
|
|
3297
|
+
printer.log(chalk28.dim(` \u6B63\u5728\u4F7F\u7528 Agent "${testAgent}" \u8FDB\u884C\u9A8C\u8BC1...`));
|
|
3209
3298
|
try {
|
|
3210
3299
|
await client.call("agent.start", { name: testAgent });
|
|
3211
3300
|
printer.success(` \u2713 Agent "${testAgent}" \u5DF2\u542F\u52A8`);
|
|
3212
3301
|
await waitForAgentReady(client, testAgent, 15e3);
|
|
3213
|
-
printer.log(
|
|
3302
|
+
printer.log(chalk28.dim(` \u53D1\u9001\u6D4B\u8BD5\u6D88\u606F: "Hello, World!"`));
|
|
3214
3303
|
const runResult = await client.call("agent.run", {
|
|
3215
3304
|
name: testAgent,
|
|
3216
3305
|
prompt: "Please respond with exactly: Hello from Actant! (keep it short)"
|
|
@@ -3249,7 +3338,7 @@ async function waitForAgentReady(client, name, timeoutMs) {
|
|
|
3249
3338
|
import { join as join6 } from "path";
|
|
3250
3339
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync5, existsSync as existsSync4 } from "fs";
|
|
3251
3340
|
import { confirm as confirm4, input as input5 } from "@inquirer/prompts";
|
|
3252
|
-
import
|
|
3341
|
+
import chalk29 from "chalk";
|
|
3253
3342
|
function detectDevSourcePath() {
|
|
3254
3343
|
const candidates = [
|
|
3255
3344
|
process.cwd(),
|
|
@@ -3264,7 +3353,7 @@ function detectDevSourcePath() {
|
|
|
3264
3353
|
}
|
|
3265
3354
|
async function configureUpdate(printer, actantHome) {
|
|
3266
3355
|
printer.log(`
|
|
3267
|
-
${
|
|
3356
|
+
${chalk29.cyan("[ Step 7/7 ]")} ${chalk29.bold("\u66F4\u65B0\u9009\u9879")}
|
|
3268
3357
|
`);
|
|
3269
3358
|
const wantConfigure = await confirm4({
|
|
3270
3359
|
message: "\u914D\u7F6E\u81EA\u52A8\u66F4\u65B0\u6E90? (\u7528\u4E8E\u4ECE\u672C\u5730\u6E90\u7801\u66F4\u65B0 Actant)",
|
|
@@ -3295,14 +3384,14 @@ ${chalk28.cyan("[ Step 7/7 ]")} ${chalk28.bold("\u66F4\u65B0\u9009\u9879")}
|
|
|
3295
3384
|
function printUpdateHelp(printer) {
|
|
3296
3385
|
printer.log("");
|
|
3297
3386
|
printer.dim(" \u66F4\u65B0\u547D\u4EE4:");
|
|
3298
|
-
printer.dim(` ${
|
|
3299
|
-
printer.dim(` ${
|
|
3300
|
-
printer.dim(` ${
|
|
3387
|
+
printer.dim(` ${chalk29.cyan("actant self-update")} \u4ECE\u6E90\u7801\u6784\u5EFA\u5E76\u66F4\u65B0`);
|
|
3388
|
+
printer.dim(` ${chalk29.cyan("actant self-update --check")} \u68C0\u67E5\u7248\u672C\u5DEE\u5F02`);
|
|
3389
|
+
printer.dim(` ${chalk29.cyan("npm install -g @actant/cli")} \u4ECE npm \u66F4\u65B0`);
|
|
3301
3390
|
}
|
|
3302
3391
|
|
|
3303
3392
|
// src/commands/setup/setup.ts
|
|
3304
3393
|
function createSetupCommand(printer = defaultPrinter) {
|
|
3305
|
-
return new
|
|
3394
|
+
return new Command74("setup").description("Interactive setup wizard \u2014 configure Actant step by step").option("--skip-home", "Skip work directory selection").option("--skip-provider", "Skip model provider configuration").option("--skip-source", "Skip component source configuration").option("--skip-agent", "Skip agent creation").option("--skip-autostart", "Skip auto-start configuration").option("--skip-hello", "Skip hello world verification").option("--skip-update", "Skip update options").action(async (opts) => {
|
|
3306
3395
|
try {
|
|
3307
3396
|
printBanner(printer);
|
|
3308
3397
|
let actantHome;
|
|
@@ -3334,7 +3423,7 @@ function createSetupCommand(printer = defaultPrinter) {
|
|
|
3334
3423
|
client = new RpcClient(socketPath);
|
|
3335
3424
|
const alive = await client.ping();
|
|
3336
3425
|
if (!alive) {
|
|
3337
|
-
printer.log(
|
|
3426
|
+
printer.log(chalk30.dim("\n \u6B63\u5728\u542F\u52A8 Daemon..."));
|
|
3338
3427
|
daemonStartedBySetup = await tryStartDaemon(printer, socketPath);
|
|
3339
3428
|
if (!daemonStartedBySetup) {
|
|
3340
3429
|
printer.warn(" \u26A0 \u65E0\u6CD5\u81EA\u52A8\u542F\u52A8 Daemon\uFF0C\u8DF3\u8FC7\u9700\u8981 Daemon \u7684\u6B65\u9AA4");
|
|
@@ -3364,7 +3453,7 @@ function createSetupCommand(printer = defaultPrinter) {
|
|
|
3364
3453
|
printSummary(printer, actantHome);
|
|
3365
3454
|
} catch (err) {
|
|
3366
3455
|
if (isUserCancellation(err)) {
|
|
3367
|
-
printer.log(
|
|
3456
|
+
printer.log(chalk30.dim("\n \u5DF2\u53D6\u6D88\u8BBE\u7F6E\u5411\u5BFC"));
|
|
3368
3457
|
return;
|
|
3369
3458
|
}
|
|
3370
3459
|
presentError(err, printer);
|
|
@@ -3374,25 +3463,25 @@ function createSetupCommand(printer = defaultPrinter) {
|
|
|
3374
3463
|
}
|
|
3375
3464
|
function printBanner(printer) {
|
|
3376
3465
|
printer.log("");
|
|
3377
|
-
printer.log(
|
|
3378
|
-
printer.log(
|
|
3379
|
-
printer.log(
|
|
3380
|
-
printer.log(
|
|
3466
|
+
printer.log(chalk30.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
3467
|
+
printer.log(chalk30.cyan("\u2551") + chalk30.bold(" Actant Setup Wizard ") + chalk30.cyan("\u2551"));
|
|
3468
|
+
printer.log(chalk30.cyan("\u2551") + chalk30.dim(" Build, manage, and compose AI agents ") + chalk30.cyan("\u2551"));
|
|
3469
|
+
printer.log(chalk30.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
|
|
3381
3470
|
}
|
|
3382
3471
|
function printSummary(printer, actantHome) {
|
|
3383
3472
|
printer.log("");
|
|
3384
|
-
printer.log(
|
|
3385
|
-
printer.log(
|
|
3386
|
-
printer.log(
|
|
3473
|
+
printer.log(chalk30.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
3474
|
+
printer.log(chalk30.green.bold(" Setup Complete!"));
|
|
3475
|
+
printer.log(chalk30.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
3387
3476
|
printer.log("");
|
|
3388
3477
|
printer.dim(` \u5DE5\u4F5C\u76EE\u5F55: ${actantHome}`);
|
|
3389
3478
|
printer.log("");
|
|
3390
3479
|
printer.log(" \u5FEB\u901F\u5F00\u59CB:");
|
|
3391
|
-
printer.log(` ${
|
|
3392
|
-
printer.log(` ${
|
|
3393
|
-
printer.log(` ${
|
|
3394
|
-
printer.log(` ${
|
|
3395
|
-
printer.log(` ${
|
|
3480
|
+
printer.log(` ${chalk30.cyan("actant daemon start")} \u542F\u52A8 Daemon`);
|
|
3481
|
+
printer.log(` ${chalk30.cyan("actant template list")} \u6D4F\u89C8\u6A21\u677F`);
|
|
3482
|
+
printer.log(` ${chalk30.cyan("actant agent list")} \u67E5\u770B Agent`);
|
|
3483
|
+
printer.log(` ${chalk30.cyan("actant agent chat <n>")} \u4E0E Agent \u5BF9\u8BDD`);
|
|
3484
|
+
printer.log(` ${chalk30.cyan("actant setup")} \u91CD\u65B0\u8FD0\u884C\u6B64\u5411\u5BFC`);
|
|
3396
3485
|
printer.log("");
|
|
3397
3486
|
printer.dim(" \u66F4\u591A\u5E2E\u52A9: actant help");
|
|
3398
3487
|
printer.log("");
|
|
@@ -3455,7 +3544,7 @@ function createProgram(socketPath, printer) {
|
|
|
3455
3544
|
const client = new RpcClient(sock);
|
|
3456
3545
|
const pkgPath = join7(import.meta.dirname, "..", "package.json");
|
|
3457
3546
|
const { version } = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
3458
|
-
const program = new
|
|
3547
|
+
const program = new Command75("actant").version(version).description("Actant \u2014 Build, manage, and compose AI agents");
|
|
3459
3548
|
program.addCommand(createTemplateCommand(client, printer));
|
|
3460
3549
|
program.addCommand(createAgentCommand(client, printer));
|
|
3461
3550
|
program.addCommand(createSkillCommand(client, printer));
|
|
@@ -3483,7 +3572,7 @@ async function run(argv) {
|
|
|
3483
3572
|
if (!versionRequested && !helpRequested) {
|
|
3484
3573
|
const sock = defaultSocketPath();
|
|
3485
3574
|
const client = new RpcClient(sock);
|
|
3486
|
-
const { startRepl } = await import("./repl-
|
|
3575
|
+
const { startRepl } = await import("./repl-3E2HUEX6.js");
|
|
3487
3576
|
await startRepl(client, sock);
|
|
3488
3577
|
return;
|
|
3489
3578
|
}
|
|
@@ -3512,4 +3601,4 @@ export {
|
|
|
3512
3601
|
createProgram,
|
|
3513
3602
|
run
|
|
3514
3603
|
};
|
|
3515
|
-
//# sourceMappingURL=chunk-
|
|
3604
|
+
//# sourceMappingURL=chunk-6OQTL4PN.js.map
|