@lobehub/cli 0.0.151 → 0.0.153
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 +242 -242
- package/dist/index.js +149 -57
- package/man/man1/lh.1 +2 -2
- 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 _w, { 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";
|
|
@@ -8887,6 +8887,22 @@ var init_params$1 = __esmMin((() => {
|
|
|
8887
8887
|
});
|
|
8888
8888
|
}));
|
|
8889
8889
|
|
|
8890
|
+
//#endregion
|
|
8891
|
+
//#region ../../packages/types/src/tool/builtinWork.ts
|
|
8892
|
+
var PluginApiWorkConfigSchema;
|
|
8893
|
+
var init_builtinWork = __esmMin((() => {
|
|
8894
|
+
init_zod$1();
|
|
8895
|
+
PluginApiWorkConfigSchema = object$1({
|
|
8896
|
+
action: _enum([
|
|
8897
|
+
"create",
|
|
8898
|
+
"update",
|
|
8899
|
+
"delete"
|
|
8900
|
+
]),
|
|
8901
|
+
agentEditable: boolean().optional(),
|
|
8902
|
+
resourceType: _enum(["document", "task"])
|
|
8903
|
+
});
|
|
8904
|
+
}));
|
|
8905
|
+
|
|
8890
8906
|
//#endregion
|
|
8891
8907
|
//#region ../../packages/types/src/tool/intervention.ts
|
|
8892
8908
|
var HumanInterventionPolicySchema, ArgumentMatcherSchema, HumanInterventionRuleSchema, HumanInterventionConfigSchema, HumanInterventionResponseSchema, UserInterventionConfigSchema, SecurityBlacklistRuleSchema, SecurityBlacklistConfigSchema, ShouldInterveneParamsSchema;
|
|
@@ -8952,11 +8968,13 @@ var init_builtinIntervention = __esmMin((() => {}));
|
|
|
8952
8968
|
|
|
8953
8969
|
//#endregion
|
|
8954
8970
|
//#region ../../packages/types/src/tool/builtin.ts
|
|
8955
|
-
var MetaSchema, RenderDisplayControlSchema, DynamicInterventionConfigSchema, ExtendedHumanInterventionConfigSchema,
|
|
8971
|
+
var MetaSchema, RenderDisplayControlSchema, DynamicInterventionConfigSchema, ExtendedHumanInterventionConfigSchema, LobeChatPluginApiSchema, BuiltinToolManifestSchema, LobeBuiltinToolSchema;
|
|
8956
8972
|
var init_builtin = __esmMin((() => {
|
|
8957
8973
|
init_zod$1();
|
|
8974
|
+
init_builtinWork();
|
|
8958
8975
|
init_intervention();
|
|
8959
8976
|
init_builtinIntervention();
|
|
8977
|
+
init_builtinWork();
|
|
8960
8978
|
MetaSchema = object$1({
|
|
8961
8979
|
avatar: string().optional(),
|
|
8962
8980
|
description: string().optional(),
|
|
@@ -8975,14 +8993,6 @@ var init_builtin = __esmMin((() => {
|
|
|
8975
8993
|
type: string()
|
|
8976
8994
|
});
|
|
8977
8995
|
ExtendedHumanInterventionConfigSchema = union([HumanInterventionConfigSchema, object$1({ dynamic: DynamicInterventionConfigSchema })]);
|
|
8978
|
-
PluginApiWorkConfigSchema = object$1({
|
|
8979
|
-
action: _enum([
|
|
8980
|
-
"create",
|
|
8981
|
-
"update",
|
|
8982
|
-
"delete"
|
|
8983
|
-
]),
|
|
8984
|
-
resourceType: _enum(["document", "task"])
|
|
8985
|
-
});
|
|
8986
8996
|
LobeChatPluginApiSchema = object$1({
|
|
8987
8997
|
defaultTimeoutMs: number$1().int().positive().optional(),
|
|
8988
8998
|
description: string(),
|
|
@@ -22205,7 +22215,7 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
|
|
|
22205
22215
|
const childProcess$2 = __require("node:child_process");
|
|
22206
22216
|
const path$16 = __require("node:path");
|
|
22207
22217
|
const fs$17 = __require("node:fs");
|
|
22208
|
-
const process$
|
|
22218
|
+
const process$2 = __require("node:process");
|
|
22209
22219
|
const { Argument, humanReadableArgName } = require_argument();
|
|
22210
22220
|
const { CommanderError } = require_error$1();
|
|
22211
22221
|
const { Help, stripColor } = require_help();
|
|
@@ -22257,13 +22267,13 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
|
|
|
22257
22267
|
this._showSuggestionAfterError = true;
|
|
22258
22268
|
this._savedState = null;
|
|
22259
22269
|
this._outputConfiguration = {
|
|
22260
|
-
writeOut: (str) => process$
|
|
22261
|
-
writeErr: (str) => process$
|
|
22270
|
+
writeOut: (str) => process$2.stdout.write(str),
|
|
22271
|
+
writeErr: (str) => process$2.stderr.write(str),
|
|
22262
22272
|
outputError: (str, write) => write(str),
|
|
22263
|
-
getOutHelpWidth: () => process$
|
|
22264
|
-
getErrHelpWidth: () => process$
|
|
22265
|
-
getOutHasColors: () => useColor() ?? (process$
|
|
22266
|
-
getErrHasColors: () => useColor() ?? (process$
|
|
22273
|
+
getOutHelpWidth: () => process$2.stdout.isTTY ? process$2.stdout.columns : void 0,
|
|
22274
|
+
getErrHelpWidth: () => process$2.stderr.isTTY ? process$2.stderr.columns : void 0,
|
|
22275
|
+
getOutHasColors: () => useColor() ?? (process$2.stdout.isTTY && process$2.stdout.hasColors?.()),
|
|
22276
|
+
getErrHasColors: () => useColor() ?? (process$2.stderr.isTTY && process$2.stderr.hasColors?.()),
|
|
22267
22277
|
stripColor: (str) => stripColor(str)
|
|
22268
22278
|
};
|
|
22269
22279
|
this._hidden = false;
|
|
@@ -22621,7 +22631,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
22621
22631
|
*/
|
|
22622
22632
|
_exit(exitCode, code, message) {
|
|
22623
22633
|
if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
|
|
22624
|
-
process$
|
|
22634
|
+
process$2.exit(exitCode);
|
|
22625
22635
|
}
|
|
22626
22636
|
/**
|
|
22627
22637
|
* Register callback `fn` for the command.
|
|
@@ -22960,11 +22970,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
22960
22970
|
if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
|
|
22961
22971
|
parseOptions = parseOptions || {};
|
|
22962
22972
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
22963
|
-
if (process$
|
|
22964
|
-
const execArgv = process$
|
|
22973
|
+
if (process$2.versions?.electron) parseOptions.from = "electron";
|
|
22974
|
+
const execArgv = process$2.execArgv ?? [];
|
|
22965
22975
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
|
|
22966
22976
|
}
|
|
22967
|
-
if (argv === void 0) argv = process$
|
|
22977
|
+
if (argv === void 0) argv = process$2.argv;
|
|
22968
22978
|
this.rawArgs = argv.slice();
|
|
22969
22979
|
let userArgs;
|
|
22970
22980
|
switch (parseOptions.from) {
|
|
@@ -22974,7 +22984,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
22974
22984
|
userArgs = argv.slice(2);
|
|
22975
22985
|
break;
|
|
22976
22986
|
case "electron":
|
|
22977
|
-
if (process$
|
|
22987
|
+
if (process$2.defaultApp) {
|
|
22978
22988
|
this._scriptPath = argv[1];
|
|
22979
22989
|
userArgs = argv.slice(2);
|
|
22980
22990
|
} else userArgs = argv.slice(1);
|
|
@@ -23139,16 +23149,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
23139
23149
|
}
|
|
23140
23150
|
launchWithNode = sourceExt.includes(path$16.extname(executableFile));
|
|
23141
23151
|
let proc;
|
|
23142
|
-
if (process$
|
|
23152
|
+
if (process$2.platform !== "win32") if (launchWithNode) {
|
|
23143
23153
|
args.unshift(executableFile);
|
|
23144
|
-
args = incrementNodeInspectorPort(process$
|
|
23145
|
-
proc = childProcess$2.spawn(process$
|
|
23154
|
+
args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
|
|
23155
|
+
proc = childProcess$2.spawn(process$2.argv[0], args, { stdio: "inherit" });
|
|
23146
23156
|
} else proc = childProcess$2.spawn(executableFile, args, { stdio: "inherit" });
|
|
23147
23157
|
else {
|
|
23148
23158
|
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
23149
23159
|
args.unshift(executableFile);
|
|
23150
|
-
args = incrementNodeInspectorPort(process$
|
|
23151
|
-
proc = childProcess$2.spawn(process$
|
|
23160
|
+
args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
|
|
23161
|
+
proc = childProcess$2.spawn(process$2.execPath, args, { stdio: "inherit" });
|
|
23152
23162
|
}
|
|
23153
23163
|
if (!proc.killed) [
|
|
23154
23164
|
"SIGUSR1",
|
|
@@ -23157,20 +23167,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
23157
23167
|
"SIGINT",
|
|
23158
23168
|
"SIGHUP"
|
|
23159
23169
|
].forEach((signal) => {
|
|
23160
|
-
process$
|
|
23170
|
+
process$2.on(signal, () => {
|
|
23161
23171
|
if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
|
|
23162
23172
|
});
|
|
23163
23173
|
});
|
|
23164
23174
|
const exitCallback = this._exitCallback;
|
|
23165
23175
|
proc.on("close", (code) => {
|
|
23166
23176
|
code = code ?? 1;
|
|
23167
|
-
if (!exitCallback) process$
|
|
23177
|
+
if (!exitCallback) process$2.exit(code);
|
|
23168
23178
|
else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
|
|
23169
23179
|
});
|
|
23170
23180
|
proc.on("error", (err) => {
|
|
23171
23181
|
if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
23172
23182
|
else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
|
|
23173
|
-
if (!exitCallback) process$
|
|
23183
|
+
if (!exitCallback) process$2.exit(1);
|
|
23174
23184
|
else {
|
|
23175
23185
|
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
|
|
23176
23186
|
wrappedError.nestedError = err;
|
|
@@ -23579,13 +23589,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
23579
23589
|
*/
|
|
23580
23590
|
_parseOptionsEnv() {
|
|
23581
23591
|
this.options.forEach((option) => {
|
|
23582
|
-
if (option.envVar && option.envVar in process$
|
|
23592
|
+
if (option.envVar && option.envVar in process$2.env) {
|
|
23583
23593
|
const optionKey = option.attributeName();
|
|
23584
23594
|
if (this.getOptionValue(optionKey) === void 0 || [
|
|
23585
23595
|
"default",
|
|
23586
23596
|
"config",
|
|
23587
23597
|
"env"
|
|
23588
|
-
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$
|
|
23598
|
+
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$2.env[option.envVar]);
|
|
23589
23599
|
else this.emit(`optionEnv:${option.name()}`);
|
|
23590
23600
|
}
|
|
23591
23601
|
});
|
|
@@ -24002,7 +24012,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
24002
24012
|
*/
|
|
24003
24013
|
help(contextOptions) {
|
|
24004
24014
|
this.outputHelp(contextOptions);
|
|
24005
|
-
let exitCode = Number(process$
|
|
24015
|
+
let exitCode = Number(process$2.exitCode ?? 0);
|
|
24006
24016
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
|
|
24007
24017
|
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
24008
24018
|
}
|
|
@@ -24092,8 +24102,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
24092
24102
|
* @package
|
|
24093
24103
|
*/
|
|
24094
24104
|
function useColor() {
|
|
24095
|
-
if (process$
|
|
24096
|
-
if (process$
|
|
24105
|
+
if (process$2.env.NO_COLOR || process$2.env.FORCE_COLOR === "0" || process$2.env.FORCE_COLOR === "false") return false;
|
|
24106
|
+
if (process$2.env.FORCE_COLOR || process$2.env.CLICOLOR_FORCE !== void 0) return true;
|
|
24097
24107
|
}
|
|
24098
24108
|
exports.Command = Command;
|
|
24099
24109
|
exports.useColor = useColor;
|
|
@@ -37830,6 +37840,7 @@ const uploadFileBuffer = async (client, { buffer, fileName, fileType }, options
|
|
|
37830
37840
|
name: fileName,
|
|
37831
37841
|
parentId: options.parentId,
|
|
37832
37842
|
size: buffer.length,
|
|
37843
|
+
source: options.source,
|
|
37833
37844
|
url: pathname
|
|
37834
37845
|
});
|
|
37835
37846
|
} catch (error) {
|
|
@@ -333899,7 +333910,7 @@ var stdio_exports = /* @__PURE__ */ __exportAll$2({
|
|
|
333899
333910
|
function getDefaultEnvironment() {
|
|
333900
333911
|
const env = {};
|
|
333901
333912
|
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
333902
|
-
const value =
|
|
333913
|
+
const value = _w.env[key];
|
|
333903
333914
|
if (value === void 0) continue;
|
|
333904
333915
|
if (value.startsWith("()")) continue;
|
|
333905
333916
|
env[key] = value;
|
|
@@ -333910,7 +333921,7 @@ var import_cross_spawn$1, DEFAULT_INHERITED_ENV_VARS, StdioClientTransport;
|
|
|
333910
333921
|
var init_stdio = __esmMin((() => {
|
|
333911
333922
|
init_src_CeKsbNLO();
|
|
333912
333923
|
import_cross_spawn$1 = /* @__PURE__ */ __toESM$2(require_cross_spawn(), 1);
|
|
333913
|
-
DEFAULT_INHERITED_ENV_VARS =
|
|
333924
|
+
DEFAULT_INHERITED_ENV_VARS = _w.platform === "win32" ? [
|
|
333914
333925
|
"APPDATA",
|
|
333915
333926
|
"COMSPEC",
|
|
333916
333927
|
"HOMEDRIVE",
|
|
@@ -333967,7 +333978,7 @@ var init_stdio = __esmMin((() => {
|
|
|
333967
333978
|
this._serverParams.stderr ?? "inherit"
|
|
333968
333979
|
],
|
|
333969
333980
|
shell: false,
|
|
333970
|
-
windowsHide:
|
|
333981
|
+
windowsHide: _w.platform === "win32",
|
|
333971
333982
|
cwd: this._serverParams.cwd
|
|
333972
333983
|
});
|
|
333973
333984
|
this._process.on("error", (error) => {
|
|
@@ -337001,9 +337012,9 @@ const getSubprocessResult = ({ stdout }) => {
|
|
|
337001
337012
|
//#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/standard-stream.js
|
|
337002
337013
|
const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
|
|
337003
337014
|
const STANDARD_STREAMS = [
|
|
337004
|
-
|
|
337005
|
-
|
|
337006
|
-
|
|
337015
|
+
_w.stdin,
|
|
337016
|
+
_w.stdout,
|
|
337017
|
+
_w.stderr
|
|
337007
337018
|
];
|
|
337008
337019
|
const STANDARD_STREAMS_ALIASES = [
|
|
337009
337020
|
"stdin",
|
|
@@ -337128,9 +337139,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
|
|
|
337128
337139
|
//#endregion
|
|
337129
337140
|
//#region node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
337130
337141
|
function isUnicodeSupported() {
|
|
337131
|
-
const { env } =
|
|
337142
|
+
const { env } = _w;
|
|
337132
337143
|
const { TERM, TERM_PROGRAM } = env;
|
|
337133
|
-
if (
|
|
337144
|
+
if (_w.platform !== "win32") return TERM !== "linux";
|
|
337134
337145
|
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";
|
|
337135
337146
|
}
|
|
337136
337147
|
|
|
@@ -337665,7 +337676,7 @@ function traversePathUp(startPath) {
|
|
|
337665
337676
|
|
|
337666
337677
|
//#endregion
|
|
337667
337678
|
//#region node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
337668
|
-
const npmRunPath = ({ cwd =
|
|
337679
|
+
const npmRunPath = ({ cwd = _w.cwd(), path: pathOption = _w.env[pathKey()], preferLocal = true, execPath = _w.execPath, addExecPath = true } = {}) => {
|
|
337669
337680
|
const cwdPath = path.resolve(toPath(cwd));
|
|
337670
337681
|
const result = [];
|
|
337671
337682
|
const pathParts = pathOption.split(path.delimiter);
|
|
@@ -337683,7 +337694,7 @@ const applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
|
337683
337694
|
const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
|
|
337684
337695
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
337685
337696
|
};
|
|
337686
|
-
const npmRunPathEnv = ({ env =
|
|
337697
|
+
const npmRunPathEnv = ({ env = _w.env, ...options } = {}) => {
|
|
337687
337698
|
env = { ...env };
|
|
337688
337699
|
const pathName = pathKey({ env });
|
|
337689
337700
|
options.path = env[pathName];
|
|
@@ -338818,7 +338829,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
|
338818
338829
|
};
|
|
338819
338830
|
const getDefaultCwd = () => {
|
|
338820
338831
|
try {
|
|
338821
|
-
return
|
|
338832
|
+
return _w.cwd();
|
|
338822
338833
|
} catch (error) {
|
|
338823
338834
|
error.message = `The current directory does not exist.\n${error.message}`;
|
|
338824
338835
|
throw error;
|
|
@@ -338854,7 +338865,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
338854
338865
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
338855
338866
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
338856
338867
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
338857
|
-
if (
|
|
338868
|
+
if (_w.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
338858
338869
|
return {
|
|
338859
338870
|
file,
|
|
338860
338871
|
commandArguments,
|
|
@@ -338881,7 +338892,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
|
|
|
338881
338892
|
});
|
|
338882
338893
|
const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
|
|
338883
338894
|
const env = extendEnv ? {
|
|
338884
|
-
...
|
|
338895
|
+
..._w.env,
|
|
338885
338896
|
...envOption
|
|
338886
338897
|
} : envOption;
|
|
338887
338898
|
if (preferLocal || node) return npmRunPathEnv({
|
|
@@ -339883,12 +339894,12 @@ const guessStreamDirection = {
|
|
|
339883
339894
|
}
|
|
339884
339895
|
};
|
|
339885
339896
|
const getStandardStreamDirection = (value) => {
|
|
339886
|
-
if ([0,
|
|
339897
|
+
if ([0, _w.stdin].includes(value)) return "input";
|
|
339887
339898
|
if ([
|
|
339888
339899
|
1,
|
|
339889
339900
|
2,
|
|
339890
|
-
|
|
339891
|
-
|
|
339901
|
+
_w.stdout,
|
|
339902
|
+
_w.stderr
|
|
339892
339903
|
].includes(value)) return "output";
|
|
339893
339904
|
};
|
|
339894
339905
|
const DEFAULT_DIRECTION = "output";
|
|
@@ -340952,9 +340963,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
|
|
|
340952
340963
|
Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
|
|
340953
340964
|
};
|
|
340954
340965
|
const getIpcExport = () => {
|
|
340955
|
-
const anyProcess =
|
|
340966
|
+
const anyProcess = _w;
|
|
340956
340967
|
const isSubprocess = true;
|
|
340957
|
-
const ipc =
|
|
340968
|
+
const ipc = _w.channel !== void 0;
|
|
340958
340969
|
return {
|
|
340959
340970
|
...getIpcMethods(anyProcess, isSubprocess, ipc),
|
|
340960
340971
|
getCancelSignal: getCancelSignal$1.bind(void 0, {
|
|
@@ -341431,7 +341442,7 @@ var SignalExitFallback = class extends SignalExitBase {
|
|
|
341431
341442
|
};
|
|
341432
341443
|
var SignalExit = class extends SignalExitBase {
|
|
341433
341444
|
/* c8 ignore start */
|
|
341434
|
-
#hupSig = process$
|
|
341445
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
341435
341446
|
/* c8 ignore stop */
|
|
341436
341447
|
#emitter = new Emitter();
|
|
341437
341448
|
#process;
|
|
@@ -341526,8 +341537,8 @@ var SignalExit = class extends SignalExitBase {
|
|
|
341526
341537
|
} else return og.call(this.#process, ev, ...args);
|
|
341527
341538
|
}
|
|
341528
341539
|
};
|
|
341529
|
-
const process$
|
|
341530
|
-
const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$
|
|
341540
|
+
const process$1 = globalThis.process;
|
|
341541
|
+
const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
341531
341542
|
|
|
341532
341543
|
//#endregion
|
|
341533
341544
|
//#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/cleanup.js
|
|
@@ -593187,8 +593198,89 @@ function registerWidgetCommand(program) {
|
|
|
593187
593198
|
|
|
593188
593199
|
//#endregion
|
|
593189
593200
|
//#region src/commands/work.ts
|
|
593201
|
+
const requireOperationId = (options) => {
|
|
593202
|
+
const operationId = options.operation ?? process.env.LOBEHUB_OPERATION_ID;
|
|
593203
|
+
if (!operationId) throw new Error("lh work registers Works of a running agent: pass --operation or run it inside an agent run (LOBEHUB_OPERATION_ID)");
|
|
593204
|
+
return operationId;
|
|
593205
|
+
};
|
|
593206
|
+
/**
|
|
593207
|
+
* Upload a produced file as the run's own output. The `tool-result` source
|
|
593208
|
+
* keeps it out of the resource library, and is the source an operation token
|
|
593209
|
+
* may write.
|
|
593210
|
+
*/
|
|
593211
|
+
const uploadWorkFile = async (client, filePath) => {
|
|
593212
|
+
const absolutePath = path.resolve(filePath);
|
|
593213
|
+
return {
|
|
593214
|
+
absolutePath,
|
|
593215
|
+
fileId: (await uploadLocalFile(client, absolutePath, { source: "tool-result" })).id
|
|
593216
|
+
};
|
|
593217
|
+
};
|
|
593218
|
+
const printWork = (work, options, verb) => {
|
|
593219
|
+
if (options.json) outputJson(work);
|
|
593220
|
+
else console.log(`${verb} Work ${work.id}: ${work.title}`);
|
|
593221
|
+
};
|
|
593190
593222
|
function registerWorkCommand(program) {
|
|
593191
|
-
|
|
593223
|
+
const work = program.command("work").description("Register the files and links this agent produced as Works, or look them up");
|
|
593224
|
+
work.command("create").description([
|
|
593225
|
+
"Register a file or link this agent produced as a Work card under its reply.",
|
|
593226
|
+
"Pass exactly one of --file or --url. Creating the same file path or link again in",
|
|
593227
|
+
"this conversation adds a new version. GitHub and Linear links are registered",
|
|
593228
|
+
"automatically when you create or edit them; do not pass them here."
|
|
593229
|
+
].join("\n")).option("--file <path>", "Local file to upload and register").option("--url <url>", "http(s) link to register; requires --title").option("--title <title>", "Card title (defaults to the file name for --file)").option("--description <text>", "Card description").option("--operation <id>", "Defaults to LOBEHUB_OPERATION_ID").option("--json", "Output JSON").action(async (options) => {
|
|
593230
|
+
if (Boolean(options.file) === Boolean(options.url)) throw new Error("Pass exactly one of --file or --url");
|
|
593231
|
+
if (options.url && !options.title) throw new Error("--title is required with --url");
|
|
593232
|
+
const operationId = requireOperationId(options);
|
|
593233
|
+
const client = await getTrpcClient();
|
|
593234
|
+
const text = {
|
|
593235
|
+
description: options.description,
|
|
593236
|
+
operationId,
|
|
593237
|
+
title: options.title
|
|
593238
|
+
};
|
|
593239
|
+
let created;
|
|
593240
|
+
if (options.url) created = await client.work.createAgentWork.mutate({
|
|
593241
|
+
...text,
|
|
593242
|
+
title: options.title,
|
|
593243
|
+
type: "link",
|
|
593244
|
+
url: options.url
|
|
593245
|
+
});
|
|
593246
|
+
else {
|
|
593247
|
+
const { absolutePath, fileId } = await uploadWorkFile(client, options.file);
|
|
593248
|
+
created = await client.work.createAgentWork.mutate({
|
|
593249
|
+
...text,
|
|
593250
|
+
fileId,
|
|
593251
|
+
filePath: absolutePath,
|
|
593252
|
+
type: "file"
|
|
593253
|
+
});
|
|
593254
|
+
}
|
|
593255
|
+
printWork(created, options, "Created");
|
|
593256
|
+
});
|
|
593257
|
+
work.command("update").argument("<work-id>", "Id of a Work this agent created with lh work create").description([
|
|
593258
|
+
"Add a version to a Work this agent created. Options left out keep their values.",
|
|
593259
|
+
"A link Work keeps its URL; register a new link with lh work create --url.",
|
|
593260
|
+
"Works registered automatically (GitHub, Linear, scanned files) cannot be updated."
|
|
593261
|
+
].join("\n")).option("--file <path>", "New content for a file Work").option("--title <title>", "New card title").option("--description <text>", "New card description").option("--operation <id>", "Defaults to LOBEHUB_OPERATION_ID").option("--json", "Output JSON").action(async (workId, options) => {
|
|
593262
|
+
if (!options.file && !options.title && options.description === void 0) throw new Error("Pass at least one of --file, --title or --description");
|
|
593263
|
+
const operationId = requireOperationId(options);
|
|
593264
|
+
const client = await getTrpcClient();
|
|
593265
|
+
const fileId = options.file ? (await uploadWorkFile(client, options.file)).fileId : void 0;
|
|
593266
|
+
printWork(await client.work.updateAgentWork.mutate({
|
|
593267
|
+
description: options.description,
|
|
593268
|
+
fileId,
|
|
593269
|
+
operationId,
|
|
593270
|
+
title: options.title,
|
|
593271
|
+
workId
|
|
593272
|
+
}), options, "Updated");
|
|
593273
|
+
});
|
|
593274
|
+
work.command("delete").argument("<work-id>", "Id of a Work this agent created with lh work create").description(["Delete a Work this agent created by mistake: its card and versions are removed,", "uploaded files stay. Works registered automatically cannot be deleted."].join("\n")).option("--operation <id>", "Defaults to LOBEHUB_OPERATION_ID").option("--json", "Output JSON").action(async (workId, options) => {
|
|
593275
|
+
const operationId = requireOperationId(options);
|
|
593276
|
+
const deleted = await (await getTrpcClient()).work.deleteAgentWork.mutate({
|
|
593277
|
+
operationId,
|
|
593278
|
+
workId
|
|
593279
|
+
});
|
|
593280
|
+
if (options.json) outputJson(deleted);
|
|
593281
|
+
else console.log(`Deleted Work ${deleted.id}${deleted.title ? `: ${deleted.title}` : ""}`);
|
|
593282
|
+
});
|
|
593283
|
+
work.command("lookup").argument("<github-pr-url>", "GitHub pull request URL").description("Find all conversations linked to a GitHub pull request in the current workspace").option("--json", "Output JSON").action(async (url, options) => {
|
|
593192
593284
|
const client = await getTrpcClient();
|
|
593193
593285
|
const { data } = await client.work.lookupPullRequest.query({ url });
|
|
593194
593286
|
if (data.length === 0) {
|
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 "" "@lobehub/cli 0.0.
|
|
3
|
+
.TH LH 1 "" "@lobehub/cli 0.0.153" "User Commands"
|
|
4
4
|
.SH NAME
|
|
5
5
|
lh \- LobeHub CLI \- manage and connect to LobeHub services
|
|
6
6
|
.SH SYNOPSIS
|
|
@@ -129,7 +129,7 @@ Manage message threads
|
|
|
129
129
|
Manage conversation topics
|
|
130
130
|
.TP
|
|
131
131
|
.B work
|
|
132
|
-
|
|
132
|
+
Register the files and links this agent produced as Works, or look them up
|
|
133
133
|
.TP
|
|
134
134
|
.B trace
|
|
135
135
|
Inspect and replay recorded agent execution traces
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.153",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/lobehub/lobehub",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"access": "public",
|
|
84
84
|
"registry": "https://registry.npmjs.org"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "f69ecef284048bac77e1ba18935a6f9800553c04"
|
|
87
87
|
}
|