@lichao0223/lobehub-cli 0.0.87 → 0.0.89
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/acceptance-report.html +260 -260
- package/dist/index.js +136 -60
- package/man/man1/lh.1 +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { Buffer as Buffer$1 } from "node:buffer";
|
|
|
15
15
|
import * as net$1 from "node:net";
|
|
16
16
|
import net, { BlockList, connect, createServer, isIP } from "node:net";
|
|
17
17
|
import { scheduler, setImmediate as setImmediate$1, setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
18
|
-
import
|
|
18
|
+
import process$1, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
|
|
19
19
|
import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
20
20
|
import { finished, pipeline } from "node:stream/promises";
|
|
21
21
|
import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark, pipeline as pipeline$1 } from "node:stream";
|
|
@@ -21925,7 +21925,7 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
|
|
|
21925
21925
|
const childProcess$2 = __require("node:child_process");
|
|
21926
21926
|
const path$16 = __require("node:path");
|
|
21927
21927
|
const fs$17 = __require("node:fs");
|
|
21928
|
-
const process$
|
|
21928
|
+
const process$3 = __require("node:process");
|
|
21929
21929
|
const { Argument, humanReadableArgName } = require_argument();
|
|
21930
21930
|
const { CommanderError } = require_error$1();
|
|
21931
21931
|
const { Help, stripColor } = require_help();
|
|
@@ -21977,13 +21977,13 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
|
|
|
21977
21977
|
this._showSuggestionAfterError = true;
|
|
21978
21978
|
this._savedState = null;
|
|
21979
21979
|
this._outputConfiguration = {
|
|
21980
|
-
writeOut: (str) => process$
|
|
21981
|
-
writeErr: (str) => process$
|
|
21980
|
+
writeOut: (str) => process$3.stdout.write(str),
|
|
21981
|
+
writeErr: (str) => process$3.stderr.write(str),
|
|
21982
21982
|
outputError: (str, write) => write(str),
|
|
21983
|
-
getOutHelpWidth: () => process$
|
|
21984
|
-
getErrHelpWidth: () => process$
|
|
21985
|
-
getOutHasColors: () => useColor() ?? (process$
|
|
21986
|
-
getErrHasColors: () => useColor() ?? (process$
|
|
21983
|
+
getOutHelpWidth: () => process$3.stdout.isTTY ? process$3.stdout.columns : void 0,
|
|
21984
|
+
getErrHelpWidth: () => process$3.stderr.isTTY ? process$3.stderr.columns : void 0,
|
|
21985
|
+
getOutHasColors: () => useColor() ?? (process$3.stdout.isTTY && process$3.stdout.hasColors?.()),
|
|
21986
|
+
getErrHasColors: () => useColor() ?? (process$3.stderr.isTTY && process$3.stderr.hasColors?.()),
|
|
21987
21987
|
stripColor: (str) => stripColor(str)
|
|
21988
21988
|
};
|
|
21989
21989
|
this._hidden = false;
|
|
@@ -22341,7 +22341,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
22341
22341
|
*/
|
|
22342
22342
|
_exit(exitCode, code, message) {
|
|
22343
22343
|
if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
|
|
22344
|
-
process$
|
|
22344
|
+
process$3.exit(exitCode);
|
|
22345
22345
|
}
|
|
22346
22346
|
/**
|
|
22347
22347
|
* Register callback `fn` for the command.
|
|
@@ -22680,11 +22680,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
22680
22680
|
if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
|
|
22681
22681
|
parseOptions = parseOptions || {};
|
|
22682
22682
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
22683
|
-
if (process$
|
|
22684
|
-
const execArgv = process$
|
|
22683
|
+
if (process$3.versions?.electron) parseOptions.from = "electron";
|
|
22684
|
+
const execArgv = process$3.execArgv ?? [];
|
|
22685
22685
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
|
|
22686
22686
|
}
|
|
22687
|
-
if (argv === void 0) argv = process$
|
|
22687
|
+
if (argv === void 0) argv = process$3.argv;
|
|
22688
22688
|
this.rawArgs = argv.slice();
|
|
22689
22689
|
let userArgs;
|
|
22690
22690
|
switch (parseOptions.from) {
|
|
@@ -22694,7 +22694,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
22694
22694
|
userArgs = argv.slice(2);
|
|
22695
22695
|
break;
|
|
22696
22696
|
case "electron":
|
|
22697
|
-
if (process$
|
|
22697
|
+
if (process$3.defaultApp) {
|
|
22698
22698
|
this._scriptPath = argv[1];
|
|
22699
22699
|
userArgs = argv.slice(2);
|
|
22700
22700
|
} else userArgs = argv.slice(1);
|
|
@@ -22859,16 +22859,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
22859
22859
|
}
|
|
22860
22860
|
launchWithNode = sourceExt.includes(path$16.extname(executableFile));
|
|
22861
22861
|
let proc;
|
|
22862
|
-
if (process$
|
|
22862
|
+
if (process$3.platform !== "win32") if (launchWithNode) {
|
|
22863
22863
|
args.unshift(executableFile);
|
|
22864
|
-
args = incrementNodeInspectorPort(process$
|
|
22865
|
-
proc = childProcess$2.spawn(process$
|
|
22864
|
+
args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
|
|
22865
|
+
proc = childProcess$2.spawn(process$3.argv[0], args, { stdio: "inherit" });
|
|
22866
22866
|
} else proc = childProcess$2.spawn(executableFile, args, { stdio: "inherit" });
|
|
22867
22867
|
else {
|
|
22868
22868
|
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
22869
22869
|
args.unshift(executableFile);
|
|
22870
|
-
args = incrementNodeInspectorPort(process$
|
|
22871
|
-
proc = childProcess$2.spawn(process$
|
|
22870
|
+
args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
|
|
22871
|
+
proc = childProcess$2.spawn(process$3.execPath, args, { stdio: "inherit" });
|
|
22872
22872
|
}
|
|
22873
22873
|
if (!proc.killed) [
|
|
22874
22874
|
"SIGUSR1",
|
|
@@ -22877,20 +22877,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
22877
22877
|
"SIGINT",
|
|
22878
22878
|
"SIGHUP"
|
|
22879
22879
|
].forEach((signal) => {
|
|
22880
|
-
process$
|
|
22880
|
+
process$3.on(signal, () => {
|
|
22881
22881
|
if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
|
|
22882
22882
|
});
|
|
22883
22883
|
});
|
|
22884
22884
|
const exitCallback = this._exitCallback;
|
|
22885
22885
|
proc.on("close", (code) => {
|
|
22886
22886
|
code = code ?? 1;
|
|
22887
|
-
if (!exitCallback) process$
|
|
22887
|
+
if (!exitCallback) process$3.exit(code);
|
|
22888
22888
|
else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
|
|
22889
22889
|
});
|
|
22890
22890
|
proc.on("error", (err) => {
|
|
22891
22891
|
if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
22892
22892
|
else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
|
|
22893
|
-
if (!exitCallback) process$
|
|
22893
|
+
if (!exitCallback) process$3.exit(1);
|
|
22894
22894
|
else {
|
|
22895
22895
|
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
|
|
22896
22896
|
wrappedError.nestedError = err;
|
|
@@ -23299,13 +23299,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
23299
23299
|
*/
|
|
23300
23300
|
_parseOptionsEnv() {
|
|
23301
23301
|
this.options.forEach((option) => {
|
|
23302
|
-
if (option.envVar && option.envVar in process$
|
|
23302
|
+
if (option.envVar && option.envVar in process$3.env) {
|
|
23303
23303
|
const optionKey = option.attributeName();
|
|
23304
23304
|
if (this.getOptionValue(optionKey) === void 0 || [
|
|
23305
23305
|
"default",
|
|
23306
23306
|
"config",
|
|
23307
23307
|
"env"
|
|
23308
|
-
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$
|
|
23308
|
+
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$3.env[option.envVar]);
|
|
23309
23309
|
else this.emit(`optionEnv:${option.name()}`);
|
|
23310
23310
|
}
|
|
23311
23311
|
});
|
|
@@ -23722,7 +23722,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
23722
23722
|
*/
|
|
23723
23723
|
help(contextOptions) {
|
|
23724
23724
|
this.outputHelp(contextOptions);
|
|
23725
|
-
let exitCode = Number(process$
|
|
23725
|
+
let exitCode = Number(process$3.exitCode ?? 0);
|
|
23726
23726
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
|
|
23727
23727
|
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
23728
23728
|
}
|
|
@@ -23812,8 +23812,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
23812
23812
|
* @package
|
|
23813
23813
|
*/
|
|
23814
23814
|
function useColor() {
|
|
23815
|
-
if (process$
|
|
23816
|
-
if (process$
|
|
23815
|
+
if (process$3.env.NO_COLOR || process$3.env.FORCE_COLOR === "0" || process$3.env.FORCE_COLOR === "false") return false;
|
|
23816
|
+
if (process$3.env.FORCE_COLOR || process$3.env.CLICOLOR_FORCE !== void 0) return true;
|
|
23817
23817
|
}
|
|
23818
23818
|
exports.Command = Command;
|
|
23819
23819
|
exports.useColor = useColor;
|
|
@@ -60746,7 +60746,7 @@ const lobeHubCliGuideBody = [
|
|
|
60746
60746
|
"- **When to use it:** only when the user asks for something that lives in LobeHub rather than in this working directory — saving a document, recalling an earlier conversation, generating an image, or changing your own agent configuration. A request about local files, code or another tool does not need `lh`. Say what you did and where it landed.",
|
|
60747
60747
|
"- **You already know where you are.** `LOBEHUB_TOPIC_ID` (this conversation) and `LOBEHUB_OPERATION_ID` (this run) are in your environment, and `LOBEHUB_AGENT_ID` (you) and `LOBEHUB_WORKSPACE_ID` (the workspace this conversation belongs to, which scopes every `lh` call) are too whenever the run carries them. They are ordinary environment variables, so every sub-shell, script or tool you spawn inherits them. Pass them straight to commands rather than listing agents or topics to find yourself; if the one you need is empty, say so instead of guessing an id. LobeHub topic ids start with `tpc_` — an id in the user's message without that prefix belongs to something else.",
|
|
60748
60748
|
"- **Earlier conversations:** read one with `lh topic view <id>`. This run can always read its own conversation and the ones the user names in it (a `tpc_…` id or a `<refer_topic>` tag); for any other, ask the user to name it here.",
|
|
60749
|
-
"- **Talking to another conversation:** `lh topic send <tpc_id> -c \"…\"` delivers a message to that conversation and has its agent act on it (queued behind its current turn if it is busy). To hand work to a fresh conversation instead, `lh topic send --new -c \"…\"` opens one for you (or `--agent-id` another agent), optionally on a given machine with `--device <id|local>` and named with `--title`; `lh message send -c \"…\"` is the same thing spelled message-first: without `--topic-id` it opens a new conversation, with `--topic-id <tpc_id>` it sends to that one. Prefer these over `lh agent run` for handing off work. `lh message create` only writes a row — nobody sees or answers it. A message another agent sent you starts with an `<agent_sender>` header; answer it with `lh message reply <message_id> -c \"…\"`, which wakes the sender's conversation. Your ordinary response is not delivered to that agent.",
|
|
60749
|
+
"- **Talking to another conversation:** `lh topic send <tpc_id> -c \"…\"` delivers a message to that conversation and has its agent act on it (queued behind its current turn if it is busy). To hand work to a fresh conversation instead, `lh topic send --new -c \"…\"` opens one for you (or `--agent-id` another agent), optionally on a given machine with `--device <id|local>` and named with `--title`; it is linked to this conversation as its parent (`--parent-topic-id <tpc_id>` names another, `--detach` links none), and `lh topic list --opened-by-me` lists the ones you opened; `lh topic stop <tpc_id>` stops a topic's running turn and `lh topic archive <tpc_id>` archives it; `lh message send -c \"…\"` is the same thing spelled message-first: without `--topic-id` it opens a new conversation, with `--topic-id <tpc_id>` it sends to that one. Prefer these over `lh agent run` for handing off work. `lh message create` only writes a row — nobody sees or answers it. A message another agent sent you starts with an `<agent_sender>` header; answer it with `lh message reply <message_id> -c \"…\"`, which wakes the sender's conversation. Your ordinary response is not delivered to that agent.",
|
|
60750
60750
|
"- **If `lh` is too old** — `lh man` lacks a command you expect, or `lh` reports an unknown command or option — the shell may have found a stale global install first. When `LOBEHUB_CLI` is set it is the path of the CLI this app ships — run that path instead of `lh` for the rest of the session. Otherwise, or if that one is too old as well, run the latest CLI once without installing it: `pnpm --package @lichao0223/lobehub-cli@latest dlx lh …` (or `npx -y -p @lichao0223/lobehub-cli@latest lh …`). It reads the same environment and saved login as `lh`. If the user asks you to run `lh` this way, do so.",
|
|
60751
60751
|
"- **Look commands up, do not guess them.** `lh man` lists every command, and `lh man <command>` (e.g. `lh man doc create`) prints the manual for the CLI actually installed here, including exactly which flags that command takes. Many commands offer `--json` for structured output, but not all of them — the manual is what says so, and an invented flag just fails the call.",
|
|
60752
60752
|
"- **What it reaches:** `lh kb` knowledge bases · `lh doc` documents · `lh file` files · `lh artifact` artifacts · `lh topic` / `lh message` past conversations · `lh agent` agents · `lh task` / `lh project` work · `lh widget` / `lh dashboard` monitoring widgets and dashboards · `lh search` local resources and the web · `lh recall` past messages, topics, goals and pages in a time window · `lh gen` text/image/video/TTS/ASR generation · `lh memory` user memory · `lh notify` notifications to the user · `lh model` / `lh provider` / `lh legacy-plugin` / `lh skill` platform configuration · `lh bot` chat-platform bots.",
|
|
@@ -266786,12 +266786,12 @@ const summarizeListeners = (entries, options) => {
|
|
|
266786
266786
|
};
|
|
266787
266787
|
}).sort((a, b) => Number(b.inProject) - Number(a.inProject) || a.port - b.port).slice(0, MAX_PORTS);
|
|
266788
266788
|
};
|
|
266789
|
-
const run$
|
|
266789
|
+
const run$2 = async (file, args) => (await execFileAsync$3(file, args, {
|
|
266790
266790
|
maxBuffer: 4 * 1024 * 1024,
|
|
266791
266791
|
timeout: COMMAND_TIMEOUT_MS
|
|
266792
266792
|
})).stdout;
|
|
266793
266793
|
const collectDarwin = async () => {
|
|
266794
|
-
const entries = parseLsofListen(await run$
|
|
266794
|
+
const entries = parseLsofListen(await run$2("lsof", [
|
|
266795
266795
|
"-nP",
|
|
266796
266796
|
"-iTCP",
|
|
266797
266797
|
"-sTCP:LISTEN",
|
|
@@ -266803,7 +266803,7 @@ const collectDarwin = async () => {
|
|
|
266803
266803
|
}));
|
|
266804
266804
|
const pids = [...new Set(entries.map((e) => e.pid).filter((p) => !!p))];
|
|
266805
266805
|
return {
|
|
266806
|
-
cwds: pids.length ? parseLsofCwd(await run$
|
|
266806
|
+
cwds: pids.length ? parseLsofCwd(await run$2("lsof", [
|
|
266807
266807
|
"-a",
|
|
266808
266808
|
"-p",
|
|
266809
266809
|
pids.join(","),
|
|
@@ -266852,17 +266852,17 @@ const collectLinux = async () => {
|
|
|
266852
266852
|
};
|
|
266853
266853
|
const collectWindows = async () => {
|
|
266854
266854
|
const [v4, v6, tasks] = await Promise.all([
|
|
266855
|
-
run$
|
|
266855
|
+
run$2("netstat", [
|
|
266856
266856
|
"-ano",
|
|
266857
266857
|
"-p",
|
|
266858
266858
|
"TCP"
|
|
266859
266859
|
]),
|
|
266860
|
-
run$
|
|
266860
|
+
run$2("netstat", [
|
|
266861
266861
|
"-ano",
|
|
266862
266862
|
"-p",
|
|
266863
266863
|
"TCPv6"
|
|
266864
266864
|
]),
|
|
266865
|
-
run$
|
|
266865
|
+
run$2("tasklist", [
|
|
266866
266866
|
"/FO",
|
|
266867
266867
|
"CSV",
|
|
266868
266868
|
"/NH"
|
|
@@ -307094,7 +307094,7 @@ async function writeMaintenanceState(file, operation) {
|
|
|
307094
307094
|
await writeFile(temporary, JSON.stringify(operation), { mode: 384 });
|
|
307095
307095
|
await rename(temporary, file);
|
|
307096
307096
|
}
|
|
307097
|
-
async function run(command, args, timeout) {
|
|
307097
|
+
async function run$1(command, args, timeout) {
|
|
307098
307098
|
await new Promise((resolve, reject) => {
|
|
307099
307099
|
const child = spawn(command, args, {
|
|
307100
307100
|
stdio: "inherit",
|
|
@@ -307115,7 +307115,7 @@ async function runMaintenanceWorker(config, ready) {
|
|
|
307115
307115
|
await writeMaintenanceState(statePath, operation);
|
|
307116
307116
|
};
|
|
307117
307117
|
try {
|
|
307118
|
-
if (config.install) await run(config.install.command, config.install.args, 18e4);
|
|
307118
|
+
if (config.install) await run$1(config.install.command, config.install.args, 18e4);
|
|
307119
307119
|
const { stdout } = await promisify(execFile)(executable, [entry, "--version"], { timeout: 3e4 });
|
|
307120
307120
|
if (stdout.trim() !== operation.targetVersion) throw new Error("Installed CLI version did not match the requested version. The existing connection was kept.");
|
|
307121
307121
|
operation.stage = "restarting";
|
|
@@ -307133,7 +307133,7 @@ async function runMaintenanceWorker(config, ready) {
|
|
|
307133
307133
|
await setTimeout$1(100);
|
|
307134
307134
|
}
|
|
307135
307135
|
if (!config.restartArgs) return;
|
|
307136
|
-
await run(executable, [
|
|
307136
|
+
await run$1(executable, [
|
|
307137
307137
|
entry,
|
|
307138
307138
|
...config.restartArgs,
|
|
307139
307139
|
"--daemon"
|
|
@@ -332559,7 +332559,7 @@ var stdio_exports = /* @__PURE__ */ __exportAll$2({
|
|
|
332559
332559
|
function getDefaultEnvironment() {
|
|
332560
332560
|
const env = {};
|
|
332561
332561
|
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
332562
|
-
const value =
|
|
332562
|
+
const value = process$1.env[key];
|
|
332563
332563
|
if (value === void 0) continue;
|
|
332564
332564
|
if (value.startsWith("()")) continue;
|
|
332565
332565
|
env[key] = value;
|
|
@@ -332570,7 +332570,7 @@ var import_cross_spawn$1, DEFAULT_INHERITED_ENV_VARS, StdioClientTransport;
|
|
|
332570
332570
|
var init_stdio = __esmMin((() => {
|
|
332571
332571
|
init_src_CeKsbNLO();
|
|
332572
332572
|
import_cross_spawn$1 = /* @__PURE__ */ __toESM$2(require_cross_spawn(), 1);
|
|
332573
|
-
DEFAULT_INHERITED_ENV_VARS =
|
|
332573
|
+
DEFAULT_INHERITED_ENV_VARS = process$1.platform === "win32" ? [
|
|
332574
332574
|
"APPDATA",
|
|
332575
332575
|
"COMSPEC",
|
|
332576
332576
|
"HOMEDRIVE",
|
|
@@ -332627,7 +332627,7 @@ var init_stdio = __esmMin((() => {
|
|
|
332627
332627
|
this._serverParams.stderr ?? "inherit"
|
|
332628
332628
|
],
|
|
332629
332629
|
shell: false,
|
|
332630
|
-
windowsHide:
|
|
332630
|
+
windowsHide: process$1.platform === "win32",
|
|
332631
332631
|
cwd: this._serverParams.cwd
|
|
332632
332632
|
});
|
|
332633
332633
|
this._process.on("error", (error) => {
|
|
@@ -335661,9 +335661,9 @@ const getSubprocessResult = ({ stdout }) => {
|
|
|
335661
335661
|
//#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/standard-stream.js
|
|
335662
335662
|
const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
|
|
335663
335663
|
const STANDARD_STREAMS = [
|
|
335664
|
-
|
|
335665
|
-
|
|
335666
|
-
|
|
335664
|
+
process$1.stdin,
|
|
335665
|
+
process$1.stdout,
|
|
335666
|
+
process$1.stderr
|
|
335667
335667
|
];
|
|
335668
335668
|
const STANDARD_STREAMS_ALIASES = [
|
|
335669
335669
|
"stdin",
|
|
@@ -335788,9 +335788,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
|
|
|
335788
335788
|
//#endregion
|
|
335789
335789
|
//#region node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
335790
335790
|
function isUnicodeSupported() {
|
|
335791
|
-
const { env } =
|
|
335791
|
+
const { env } = process$1;
|
|
335792
335792
|
const { TERM, TERM_PROGRAM } = env;
|
|
335793
|
-
if (
|
|
335793
|
+
if (process$1.platform !== "win32") return TERM !== "linux";
|
|
335794
335794
|
return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
335795
335795
|
}
|
|
335796
335796
|
|
|
@@ -336325,7 +336325,7 @@ function traversePathUp(startPath) {
|
|
|
336325
336325
|
|
|
336326
336326
|
//#endregion
|
|
336327
336327
|
//#region node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
336328
|
-
const npmRunPath = ({ cwd =
|
|
336328
|
+
const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
|
|
336329
336329
|
const cwdPath = path.resolve(toPath(cwd));
|
|
336330
336330
|
const result = [];
|
|
336331
336331
|
const pathParts = pathOption.split(path.delimiter);
|
|
@@ -336343,7 +336343,7 @@ const applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
|
336343
336343
|
const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
|
|
336344
336344
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
336345
336345
|
};
|
|
336346
|
-
const npmRunPathEnv = ({ env =
|
|
336346
|
+
const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
|
|
336347
336347
|
env = { ...env };
|
|
336348
336348
|
const pathName = pathKey({ env });
|
|
336349
336349
|
options.path = env[pathName];
|
|
@@ -337478,7 +337478,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
|
337478
337478
|
};
|
|
337479
337479
|
const getDefaultCwd = () => {
|
|
337480
337480
|
try {
|
|
337481
|
-
return
|
|
337481
|
+
return process$1.cwd();
|
|
337482
337482
|
} catch (error) {
|
|
337483
337483
|
error.message = `The current directory does not exist.\n${error.message}`;
|
|
337484
337484
|
throw error;
|
|
@@ -337514,7 +337514,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
337514
337514
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
337515
337515
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
337516
337516
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
337517
|
-
if (
|
|
337517
|
+
if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
337518
337518
|
return {
|
|
337519
337519
|
file,
|
|
337520
337520
|
commandArguments,
|
|
@@ -337541,7 +337541,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
|
|
|
337541
337541
|
});
|
|
337542
337542
|
const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
|
|
337543
337543
|
const env = extendEnv ? {
|
|
337544
|
-
...
|
|
337544
|
+
...process$1.env,
|
|
337545
337545
|
...envOption
|
|
337546
337546
|
} : envOption;
|
|
337547
337547
|
if (preferLocal || node) return npmRunPathEnv({
|
|
@@ -338543,12 +338543,12 @@ const guessStreamDirection = {
|
|
|
338543
338543
|
}
|
|
338544
338544
|
};
|
|
338545
338545
|
const getStandardStreamDirection = (value) => {
|
|
338546
|
-
if ([0,
|
|
338546
|
+
if ([0, process$1.stdin].includes(value)) return "input";
|
|
338547
338547
|
if ([
|
|
338548
338548
|
1,
|
|
338549
338549
|
2,
|
|
338550
|
-
|
|
338551
|
-
|
|
338550
|
+
process$1.stdout,
|
|
338551
|
+
process$1.stderr
|
|
338552
338552
|
].includes(value)) return "output";
|
|
338553
338553
|
};
|
|
338554
338554
|
const DEFAULT_DIRECTION = "output";
|
|
@@ -339612,9 +339612,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
|
|
|
339612
339612
|
Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
|
|
339613
339613
|
};
|
|
339614
339614
|
const getIpcExport = () => {
|
|
339615
|
-
const anyProcess =
|
|
339615
|
+
const anyProcess = process$1;
|
|
339616
339616
|
const isSubprocess = true;
|
|
339617
|
-
const ipc =
|
|
339617
|
+
const ipc = process$1.channel !== void 0;
|
|
339618
339618
|
return {
|
|
339619
339619
|
...getIpcMethods(anyProcess, isSubprocess, ipc),
|
|
339620
339620
|
getCancelSignal: getCancelSignal$1.bind(void 0, {
|
|
@@ -340091,7 +340091,7 @@ var SignalExitFallback = class extends SignalExitBase {
|
|
|
340091
340091
|
};
|
|
340092
340092
|
var SignalExit = class extends SignalExitBase {
|
|
340093
340093
|
/* c8 ignore start */
|
|
340094
|
-
#hupSig = process$
|
|
340094
|
+
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
340095
340095
|
/* c8 ignore stop */
|
|
340096
340096
|
#emitter = new Emitter();
|
|
340097
340097
|
#process;
|
|
@@ -340186,8 +340186,8 @@ var SignalExit = class extends SignalExitBase {
|
|
|
340186
340186
|
} else return og.call(this.#process, ev, ...args);
|
|
340187
340187
|
}
|
|
340188
340188
|
};
|
|
340189
|
-
const process$
|
|
340190
|
-
const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$
|
|
340189
|
+
const process$2 = globalThis.process;
|
|
340190
|
+
const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
340191
340191
|
|
|
340192
340192
|
//#endregion
|
|
340193
340193
|
//#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/cleanup.js
|
|
@@ -584889,6 +584889,8 @@ const resolveTargetDevice = async (client, device) => {
|
|
|
584889
584889
|
*/
|
|
584890
584890
|
const sendToNewConversation = async (client, params) => {
|
|
584891
584891
|
const agentId = params.agentId ?? process.env.LOBEHUB_AGENT_ID;
|
|
584892
|
+
if (params.detach && params.parentTopicId) throw new Error("Pass either --parent-topic-id or --detach, not both.");
|
|
584893
|
+
const parentTopicId = params.detach ? void 0 : params.parentTopicId || process.env.LOBEHUB_TOPIC_ID || void 0;
|
|
584892
584894
|
if (!agentId) throw new Error("No agent to start the new conversation with: pass --agent-id (LOBEHUB_AGENT_ID is not set).");
|
|
584893
584895
|
const request = {
|
|
584894
584896
|
agentId,
|
|
@@ -584901,6 +584903,7 @@ const sendToNewConversation = async (client, params) => {
|
|
|
584901
584903
|
request.requireDevice = true;
|
|
584902
584904
|
}
|
|
584903
584905
|
if (params.title) request.title = params.title;
|
|
584906
|
+
if (parentTopicId) request.openedByTopicId = parentTopicId;
|
|
584904
584907
|
const sourceOperationId = process.env.LOBEHUB_OPERATION_ID;
|
|
584905
584908
|
if (sourceOperationId) request.sourceOperationId = sourceOperationId;
|
|
584906
584909
|
const started = await client.aiAgent.execAgent.mutate(request);
|
|
@@ -584935,10 +584938,15 @@ const reportConversationSend = async (send, options) => {
|
|
|
584935
584938
|
console.log(import_picocolors.default.dim("The answer arrives in that conversation. If it replies to you, the reply wakes this one."));
|
|
584936
584939
|
};
|
|
584937
584940
|
function registerTopicSendCommand(topic) {
|
|
584938
|
-
topic.command("send [topicId]").description("Send a message to another conversation and have its agent act on it (queued if it is busy), or with --new hand it to a new conversation. Unlike 'lh message create', this wakes the agent").requiredOption("-c, --content <content>", "Message content").option("--new", "Open a new conversation for the message instead of sending to <topicId>").option("--agent-id <id>", `With --new: ${NEW_CONVERSATION_OPTIONS_HELP.agentId}`).option("--device <target>", `With --new: ${NEW_CONVERSATION_OPTIONS_HELP.device}`).option("--title <title>", `With --new: ${NEW_CONVERSATION_OPTIONS_HELP.title}`).option("--workspace <id|slug>", "The workspace the topic lives in (overrides LOBEHUB_WORKSPACE_ID and 'workspace use')").option("--json", "Output JSON").addHelpText("after", `
|
|
584941
|
+
topic.command("send [topicId]").description("Send a message to another conversation and have its agent act on it (queued if it is busy), or with --new hand it to a new conversation. Unlike 'lh message create', this wakes the agent").requiredOption("-c, --content <content>", "Message content").option("--new", "Open a new conversation for the message instead of sending to <topicId>").option("--agent-id <id>", `With --new: ${NEW_CONVERSATION_OPTIONS_HELP.agentId}`).option("--device <target>", `With --new: ${NEW_CONVERSATION_OPTIONS_HELP.device}`).option("--title <title>", `With --new: ${NEW_CONVERSATION_OPTIONS_HELP.title}`).option("--parent-topic-id <tpc_id>", "With --new: the parent topic the new one lists under (default: the conversation running this command, LOBEHUB_TOPIC_ID)").option("--detach", "With --new: link the new topic to no parent, even from inside a conversation").option("--workspace <id|slug>", "The workspace the topic lives in (overrides LOBEHUB_WORKSPACE_ID and 'workspace use')").option("--json", "Output JSON").addHelpText("after", `
|
|
584939
584942
|
Examples:
|
|
584940
584943
|
lh topic send tpc_xxx -c "Iterate the verifier with these notes"
|
|
584941
584944
|
lh topic send --new -c "Draft the release notes" --device local --title "Release notes"
|
|
584945
|
+
lh topic send --new -c "Check the flaky test" --parent-topic-id tpc_xxx
|
|
584946
|
+
|
|
584947
|
+
Run from inside a conversation, --new opens a topic linked to it as its parent
|
|
584948
|
+
('lh topic list --parent-topic-id <id>' lists them); --detach opens one that
|
|
584949
|
+
stands on its own.
|
|
584942
584950
|
|
|
584943
584951
|
Run by an agent, the message is shown as written by that agent, and the
|
|
584944
584952
|
receiving agent can answer it with 'lh message reply <messageId>', which wakes
|
|
@@ -584951,7 +584959,7 @@ after a few rounds, so a person can step in.`).action(async (topicId, options) =
|
|
|
584951
584959
|
return sendToNewConversation(client, { ...options });
|
|
584952
584960
|
}
|
|
584953
584961
|
if (!topicId) throw new Error("Pass the <topicId> to send to, or --new to open a new conversation.");
|
|
584954
|
-
if (options.agentId || options.device || options.title) throw new Error("--agent-id, --device and --
|
|
584962
|
+
if (options.agentId || options.device || options.title || options.parentTopicId || options.detach) throw new Error("--agent-id, --device, --title, --parent-topic-id and --detach only apply with --new; an existing conversation keeps its own.");
|
|
584955
584963
|
return sendToConversation(client, {
|
|
584956
584964
|
content: options.content,
|
|
584957
584965
|
topicId
|
|
@@ -590171,6 +590179,52 @@ function registerTopicExportCommand(topic) {
|
|
|
590171
590179
|
});
|
|
590172
590180
|
}
|
|
590173
590181
|
|
|
590182
|
+
//#endregion
|
|
590183
|
+
//#region src/commands/topic/lifecycle.ts
|
|
590184
|
+
/** Print a refusal and exit 1 instead of a stack trace. */
|
|
590185
|
+
const run = async (fn) => {
|
|
590186
|
+
try {
|
|
590187
|
+
await fn();
|
|
590188
|
+
} catch (error) {
|
|
590189
|
+
log$15.error(error.message);
|
|
590190
|
+
process.exit(1);
|
|
590191
|
+
}
|
|
590192
|
+
};
|
|
590193
|
+
const WORKSPACE_OPTION_HELP = "Workspace (overrides LOBEHUB_WORKSPACE_ID and 'workspace use')";
|
|
590194
|
+
/**
|
|
590195
|
+
* A topic's lifecycle from the CLI: stop its running turn, archive it, or bring
|
|
590196
|
+
* it back — through the same entries the app's own buttons use
|
|
590197
|
+
* (`aiAgent.interruptTask`, `topic.updateTopic`).
|
|
590198
|
+
*/
|
|
590199
|
+
function registerTopicLifecycleCommands(topic) {
|
|
590200
|
+
topic.command("stop <topicId>").description("Stop the topic's running turn (the ones you started)").option("--workspace <id|slug>", WORKSPACE_OPTION_HELP).option("--json", "Output JSON").action((topicId, options) => run(async () => {
|
|
590201
|
+
const result = await (await getTrpcClient(await resolveWorkspaceRef(options.workspace))).aiAgent.interruptTask.mutate({ topicId });
|
|
590202
|
+
if (options.json) return outputJson(result);
|
|
590203
|
+
if (!result.success) throw new Error(`${topicId}: ${(result.running ?? 0) - (result.stopped ?? 0)} run(s) could not be confirmed stopped (a device may still be running them). Try again once the device is reachable.`);
|
|
590204
|
+
console.log(result.stopped ? `${import_picocolors.default.green("✓")} Stopped ${topicId}.` : `${topicId} was not running.`);
|
|
590205
|
+
}));
|
|
590206
|
+
topic.command("archive <topicId>").description("Archive a topic: it leaves the agent list, and its auto-created worktree is cleaned up").option("--workspace <id|slug>", WORKSPACE_OPTION_HELP).action((topicId, options) => run(async () => {
|
|
590207
|
+
await (await getTrpcClient(await resolveWorkspaceRef(options.workspace))).topic.updateTopic.mutate({
|
|
590208
|
+
id: topicId,
|
|
590209
|
+
value: {
|
|
590210
|
+
completedAt: /* @__PURE__ */ new Date(),
|
|
590211
|
+
status: "completed"
|
|
590212
|
+
}
|
|
590213
|
+
});
|
|
590214
|
+
console.log(`${import_picocolors.default.green("✓")} Archived ${topicId}.`);
|
|
590215
|
+
}));
|
|
590216
|
+
topic.command("unarchive <topicId>").description("Bring an archived topic back to the agent list").option("--workspace <id|slug>", WORKSPACE_OPTION_HELP).action((topicId, options) => run(async () => {
|
|
590217
|
+
await (await getTrpcClient(await resolveWorkspaceRef(options.workspace))).topic.updateTopic.mutate({
|
|
590218
|
+
id: topicId,
|
|
590219
|
+
value: {
|
|
590220
|
+
completedAt: null,
|
|
590221
|
+
status: "active"
|
|
590222
|
+
}
|
|
590223
|
+
});
|
|
590224
|
+
console.log(`${import_picocolors.default.green("✓")} Unarchived ${topicId}.`);
|
|
590225
|
+
}));
|
|
590226
|
+
}
|
|
590227
|
+
|
|
590174
590228
|
//#endregion
|
|
590175
590229
|
//#region src/commands/topic/readTranscript.ts
|
|
590176
590230
|
/** A server that predates the operation route answers this for the unknown path. */
|
|
@@ -590380,10 +590434,17 @@ function registerTopicViewCommand(topic) {
|
|
|
590380
590434
|
//#region src/commands/topic.ts
|
|
590381
590435
|
function registerTopicCommand(program) {
|
|
590382
590436
|
const topic = program.command("topic").description("Manage conversation topics");
|
|
590383
|
-
topic.command("list").description("List topics").option("--agent-id <id>", "Filter by agent ID").option("-L, --limit <n>", "Page size", "30").option("-P, --page <n>", "Page number", "1").option("--json [fields]", "Output JSON, optionally specify fields (comma-separated)").action(async (options) => {
|
|
590437
|
+
topic.command("list").description("List topics").option("--agent-id <id>", "Filter by agent ID").option("--parent-topic-id <tpc_id>", "Only the topics opened from this one (its child topics), whatever their agent").option("--opened-by-me", "Only the topics this conversation opened (--parent-topic-id from LOBEHUB_TOPIC_ID)").option("-L, --limit <n>", "Page size", "30").option("-P, --page <n>", "Page number", "1").option("--json [fields]", "Output JSON, optionally specify fields (comma-separated)").action(async (options) => {
|
|
590438
|
+
const parentTopicId = options.parentTopicId ?? (options.openedByMe ? process.env.LOBEHUB_TOPIC_ID : void 0);
|
|
590439
|
+
if (options.openedByMe && !parentTopicId) {
|
|
590440
|
+
log$15.error("--opened-by-me needs LOBEHUB_TOPIC_ID; pass --parent-topic-id instead.");
|
|
590441
|
+
process.exit(1);
|
|
590442
|
+
return;
|
|
590443
|
+
}
|
|
590384
590444
|
const client = await getTrpcClient();
|
|
590385
590445
|
const input = {};
|
|
590386
590446
|
if (options.agentId) input.agentId = options.agentId;
|
|
590447
|
+
if (parentTopicId) input.openedByTopicId = parentTopicId;
|
|
590387
590448
|
if (options.limit) input.pageSize = Number.parseInt(options.limit, 10);
|
|
590388
590449
|
const page = options.page ? Number.parseInt(options.page, 10) : void 0;
|
|
590389
590450
|
if (page !== void 0 && page > 1) input.current = page - 1;
|
|
@@ -590401,6 +590462,20 @@ function registerTopicCommand(program) {
|
|
|
590401
590462
|
console.log("No topics found.");
|
|
590402
590463
|
return;
|
|
590403
590464
|
}
|
|
590465
|
+
if (parentTopicId) {
|
|
590466
|
+
printTable(items.map((t) => [
|
|
590467
|
+
t.id || "",
|
|
590468
|
+
truncate$2(t.title || "Untitled", 50),
|
|
590469
|
+
t.agentId || "",
|
|
590470
|
+
t.updatedAt ? timeAgo(t.updatedAt) : ""
|
|
590471
|
+
]), [
|
|
590472
|
+
"ID",
|
|
590473
|
+
"TITLE",
|
|
590474
|
+
"AGENT",
|
|
590475
|
+
"UPDATED"
|
|
590476
|
+
]);
|
|
590477
|
+
return;
|
|
590478
|
+
}
|
|
590404
590479
|
printTable(items.map((t) => [
|
|
590405
590480
|
t.id || "",
|
|
590406
590481
|
truncate$2(t.title || "Untitled", 50),
|
|
@@ -590568,6 +590643,7 @@ function registerTopicCommand(program) {
|
|
|
590568
590643
|
registerTopicExportCommand(topic);
|
|
590569
590644
|
registerTopicViewCommand(topic);
|
|
590570
590645
|
registerTopicSendCommand(topic);
|
|
590646
|
+
registerTopicLifecycleCommands(topic);
|
|
590571
590647
|
}
|
|
590572
590648
|
|
|
590573
590649
|
//#endregion
|
package/man/man1/lh.1
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.\" Code generated by `npm run man:generate`; DO NOT EDIT.
|
|
2
2
|
.\" Manual command details come from the Commander command tree.
|
|
3
|
-
.TH LH 1 "" "@lichao0223/lobehub\-cli 0.0.
|
|
3
|
+
.TH LH 1 "" "@lichao0223/lobehub\-cli 0.0.89" "User Commands"
|
|
4
4
|
.SH NAME
|
|
5
5
|
lh \- LobeHub CLI \- manage and connect to LobeHub services
|
|
6
6
|
.SH SYNOPSIS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lichao0223/lobehub-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.89",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/lichao0223/lobehub",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"access": "public",
|
|
84
84
|
"registry": "https://registry.npmjs.org"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "bf1ec8368ec4b47d1908117ba723fc7f28cbc662"
|
|
87
87
|
}
|