@ai-setting/roy-agent-cli 1.7.10 → 1.7.12
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/roy-agent.js +39 -13
- package/dist/index.js +39 -13
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -9429,7 +9429,6 @@ var require_dist = __commonJS((exports) => {
|
|
|
9429
9429
|
|
|
9430
9430
|
// src/cli.ts
|
|
9431
9431
|
import yargsLib from "yargs";
|
|
9432
|
-
import { hideBin } from "yargs/helpers";
|
|
9433
9432
|
|
|
9434
9433
|
// src/services/quiet-mode.service.ts
|
|
9435
9434
|
import { setQuietMode as setCoreQuietMode, isQuietMode as isCoreQuietMode } from "@ai-setting/roy-agent-core";
|
|
@@ -9461,7 +9460,7 @@ class CliQuietModeService {
|
|
|
9461
9460
|
// package.json
|
|
9462
9461
|
var package_default = {
|
|
9463
9462
|
name: "@ai-setting/roy-agent-cli",
|
|
9464
|
-
version: "1.7.
|
|
9463
|
+
version: "1.7.12",
|
|
9465
9464
|
type: "module",
|
|
9466
9465
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9467
9466
|
main: "./dist/index.js",
|
|
@@ -21170,7 +21169,7 @@ var EventSourceAddCommand = {
|
|
|
21170
21169
|
type: "string",
|
|
21171
21170
|
demandOption: true
|
|
21172
21171
|
}).positional("type", {
|
|
21173
|
-
describe: "事件源类型(如 lark-cli, timer, websocket 或第三方自定义类型)",
|
|
21172
|
+
describe: "事件源类型(如 lark-cli, bounty-cli, bounty-im, timer, websocket 或第三方自定义类型)",
|
|
21174
21173
|
type: "string",
|
|
21175
21174
|
demandOption: true
|
|
21176
21175
|
}).option("event-types", {
|
|
@@ -21193,7 +21192,7 @@ var EventSourceAddCommand = {
|
|
|
21193
21192
|
describe: "Cron 表达式",
|
|
21194
21193
|
type: "string"
|
|
21195
21194
|
}).option("profile", {
|
|
21196
|
-
describe: "Profile 名称(lark-cli / bounty-im 类型用,从 ~/.config/bounty/profiles/<name>.json 读取配置;多 appId / 多账户场景必要,参考 #1637)",
|
|
21195
|
+
describe: "Profile 名称(lark-cli / bounty-im / bounty-cli 类型用,从 ~/.config/bounty/profiles/<name>.json 读取配置;多 appId / 多账户场景必要,参考 #1637)",
|
|
21197
21196
|
type: "string"
|
|
21198
21197
|
}).option("email", {
|
|
21199
21198
|
describe: "Agent IM 注册邮箱(bounty-im 类型用,v0.14 strict email-only;与 --profile 互斥)",
|
|
@@ -21202,6 +21201,9 @@ var EventSourceAddCommand = {
|
|
|
21202
21201
|
describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
|
|
21203
21202
|
type: "boolean",
|
|
21204
21203
|
default: false
|
|
21204
|
+
}).option("channel", {
|
|
21205
|
+
describe: "Mattermost 频道名(bounty-cli 类型用,启动时执行 `bounty event consume --channel <name>`;与 --command 互斥)",
|
|
21206
|
+
type: "string"
|
|
21205
21207
|
}).option("prompt", {
|
|
21206
21208
|
describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
|
|
21207
21209
|
type: "string"
|
|
@@ -21255,6 +21257,14 @@ var EventSourceAddCommand = {
|
|
|
21255
21257
|
} else {
|
|
21256
21258
|
resolvedServerUrl = resolveServerUrl(undefined, fallback);
|
|
21257
21259
|
}
|
|
21260
|
+
if (a.type === "bounty-cli") {
|
|
21261
|
+
if (!a.channel && !a.command) {
|
|
21262
|
+
output.error(chalk61.red(`
|
|
21263
|
+
✗ bounty-cli 类型需要 --channel <频道名>(或 --command 覆盖默认命令)
|
|
21264
|
+
`));
|
|
21265
|
+
process.exit(1);
|
|
21266
|
+
}
|
|
21267
|
+
}
|
|
21258
21268
|
const config = {
|
|
21259
21269
|
id: uuid(),
|
|
21260
21270
|
name: a.name,
|
|
@@ -21269,6 +21279,7 @@ var EventSourceAddCommand = {
|
|
|
21269
21279
|
email: resolvedEmail,
|
|
21270
21280
|
imServerUrl: resolvedServerUrl,
|
|
21271
21281
|
tlsSkipVerify: a.tlsSkipVerify === true,
|
|
21282
|
+
...a.type === "bounty-cli" && a.channel ? { channel: a.channel } : {},
|
|
21272
21283
|
options: a.prompt ? { prompt: a.prompt } : undefined
|
|
21273
21284
|
};
|
|
21274
21285
|
esComponent.register(config);
|
|
@@ -21303,6 +21314,9 @@ var EventSourceAddCommand = {
|
|
|
21303
21314
|
if (a.prompt) {
|
|
21304
21315
|
output.log(` Prompt: ${chalk61.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
|
|
21305
21316
|
}
|
|
21317
|
+
if (a.channel) {
|
|
21318
|
+
output.log(` Channel: ${chalk61.gray(a.channel)}`);
|
|
21319
|
+
}
|
|
21306
21320
|
output.log("");
|
|
21307
21321
|
output.log(chalk61.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
|
|
21308
21322
|
} finally {
|
|
@@ -25591,11 +25605,6 @@ async function verifyInstalledVersion(packageName, declaredVersion) {
|
|
|
25591
25605
|
if (actual.version !== declaredVersion) {
|
|
25592
25606
|
return { ok: false, reason: "version-mismatch", actualVersion: actual.version };
|
|
25593
25607
|
}
|
|
25594
|
-
try {
|
|
25595
|
-
await import(packageName);
|
|
25596
|
-
} catch (e) {
|
|
25597
|
-
console.warn(`⚠️ verifyInstalledVersion: dynamic import of '${packageName}' failed but version check passed (npm global root may not be in Node module resolution path): ${e.message}`);
|
|
25598
|
-
}
|
|
25599
25608
|
return { ok: true, actualVersion: actual.version };
|
|
25600
25609
|
}
|
|
25601
25610
|
function getPackageManagerCommand() {
|
|
@@ -25755,9 +25764,9 @@ var InstallPackageCommand = {
|
|
|
25755
25764
|
if (verify.ok === false) {
|
|
25756
25765
|
console.warn(`
|
|
25757
25766
|
⚠️ Post-install version drift detected for '${resolvedPackageName}':
|
|
25758
|
-
declared (plugins.json): ${plugin.version}
|
|
25759
|
-
actual (npm global root): ${verify.actualVersion ?? "(unknown)"}
|
|
25760
|
-
reason: ${verify.reason}
|
|
25767
|
+
` + ` declared (plugins.json): ${plugin.version}
|
|
25768
|
+
` + ` actual (npm global root): ${verify.actualVersion ?? "(unknown)"}
|
|
25769
|
+
` + ` reason: ${verify.reason}
|
|
25761
25770
|
` + ` 请检查 ~/.roy-agent/node_modules/${resolvedPackageName}/ 是否残留陈旧 cp 副本
|
|
25762
25771
|
`);
|
|
25763
25772
|
}
|
|
@@ -25890,6 +25899,18 @@ function quietModeMiddleware(argv) {
|
|
|
25890
25899
|
quietService.setQuiet(true);
|
|
25891
25900
|
}
|
|
25892
25901
|
}
|
|
25902
|
+
function rewriteEsFlag(argv) {
|
|
25903
|
+
const esIdx = argv.indexOf("--es");
|
|
25904
|
+
if (esIdx === -1)
|
|
25905
|
+
return argv;
|
|
25906
|
+
const esValue = argv[esIdx + 1];
|
|
25907
|
+
if (!esValue || esValue.startsWith("--")) {
|
|
25908
|
+
return argv;
|
|
25909
|
+
}
|
|
25910
|
+
const before = argv.slice(0, esIdx);
|
|
25911
|
+
const after = argv.slice(esIdx + 2);
|
|
25912
|
+
return [...before, "eventsource", "start", esValue, ...after];
|
|
25913
|
+
}
|
|
25893
25914
|
var PLUGIN_HELP = `
|
|
25894
25915
|
Plugins:
|
|
25895
25916
|
coder-harness LSP plugins:
|
|
@@ -25920,8 +25941,13 @@ Examples:
|
|
|
25920
25941
|
--plugin tslsp code-check Enable multiple plugins`;
|
|
25921
25942
|
async function runCli() {
|
|
25922
25943
|
const version = getPackageVersion();
|
|
25944
|
+
const rewrittenArgv = rewriteEsFlag(process.argv.slice(2));
|
|
25923
25945
|
const yargs = yargsLib;
|
|
25924
|
-
await yargs(
|
|
25946
|
+
await yargs(rewrittenArgv).scriptName("roy-agent").version(version).option("es", {
|
|
25947
|
+
describe: "Start an event source by id/name (alias for `eventsource start <id>`). e.g. --es my-source",
|
|
25948
|
+
type: "string",
|
|
25949
|
+
global: true
|
|
25950
|
+
}).option("quiet", {
|
|
25925
25951
|
describe: "Quiet mode (default: on, use --no-quiet to enable logging)",
|
|
25926
25952
|
type: "boolean",
|
|
25927
25953
|
default: true,
|
package/dist/index.js
CHANGED
|
@@ -9428,7 +9428,6 @@ var require_dist = __commonJS((exports) => {
|
|
|
9428
9428
|
|
|
9429
9429
|
// src/cli.ts
|
|
9430
9430
|
import yargsLib from "yargs";
|
|
9431
|
-
import { hideBin } from "yargs/helpers";
|
|
9432
9431
|
|
|
9433
9432
|
// src/services/quiet-mode.service.ts
|
|
9434
9433
|
import { setQuietMode as setCoreQuietMode, isQuietMode as isCoreQuietMode } from "@ai-setting/roy-agent-core";
|
|
@@ -9460,7 +9459,7 @@ class CliQuietModeService {
|
|
|
9460
9459
|
// package.json
|
|
9461
9460
|
var package_default = {
|
|
9462
9461
|
name: "@ai-setting/roy-agent-cli",
|
|
9463
|
-
version: "1.7.
|
|
9462
|
+
version: "1.7.12",
|
|
9464
9463
|
type: "module",
|
|
9465
9464
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9466
9465
|
main: "./dist/index.js",
|
|
@@ -21169,7 +21168,7 @@ var EventSourceAddCommand = {
|
|
|
21169
21168
|
type: "string",
|
|
21170
21169
|
demandOption: true
|
|
21171
21170
|
}).positional("type", {
|
|
21172
|
-
describe: "事件源类型(如 lark-cli, timer, websocket 或第三方自定义类型)",
|
|
21171
|
+
describe: "事件源类型(如 lark-cli, bounty-cli, bounty-im, timer, websocket 或第三方自定义类型)",
|
|
21173
21172
|
type: "string",
|
|
21174
21173
|
demandOption: true
|
|
21175
21174
|
}).option("event-types", {
|
|
@@ -21192,7 +21191,7 @@ var EventSourceAddCommand = {
|
|
|
21192
21191
|
describe: "Cron 表达式",
|
|
21193
21192
|
type: "string"
|
|
21194
21193
|
}).option("profile", {
|
|
21195
|
-
describe: "Profile 名称(lark-cli / bounty-im 类型用,从 ~/.config/bounty/profiles/<name>.json 读取配置;多 appId / 多账户场景必要,参考 #1637)",
|
|
21194
|
+
describe: "Profile 名称(lark-cli / bounty-im / bounty-cli 类型用,从 ~/.config/bounty/profiles/<name>.json 读取配置;多 appId / 多账户场景必要,参考 #1637)",
|
|
21196
21195
|
type: "string"
|
|
21197
21196
|
}).option("email", {
|
|
21198
21197
|
describe: "Agent IM 注册邮箱(bounty-im 类型用,v0.14 strict email-only;与 --profile 互斥)",
|
|
@@ -21201,6 +21200,9 @@ var EventSourceAddCommand = {
|
|
|
21201
21200
|
describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
|
|
21202
21201
|
type: "boolean",
|
|
21203
21202
|
default: false
|
|
21203
|
+
}).option("channel", {
|
|
21204
|
+
describe: "Mattermost 频道名(bounty-cli 类型用,启动时执行 `bounty event consume --channel <name>`;与 --command 互斥)",
|
|
21205
|
+
type: "string"
|
|
21204
21206
|
}).option("prompt", {
|
|
21205
21207
|
describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
|
|
21206
21208
|
type: "string"
|
|
@@ -21254,6 +21256,14 @@ var EventSourceAddCommand = {
|
|
|
21254
21256
|
} else {
|
|
21255
21257
|
resolvedServerUrl = resolveServerUrl(undefined, fallback);
|
|
21256
21258
|
}
|
|
21259
|
+
if (a.type === "bounty-cli") {
|
|
21260
|
+
if (!a.channel && !a.command) {
|
|
21261
|
+
output.error(chalk61.red(`
|
|
21262
|
+
✗ bounty-cli 类型需要 --channel <频道名>(或 --command 覆盖默认命令)
|
|
21263
|
+
`));
|
|
21264
|
+
process.exit(1);
|
|
21265
|
+
}
|
|
21266
|
+
}
|
|
21257
21267
|
const config = {
|
|
21258
21268
|
id: uuid(),
|
|
21259
21269
|
name: a.name,
|
|
@@ -21268,6 +21278,7 @@ var EventSourceAddCommand = {
|
|
|
21268
21278
|
email: resolvedEmail,
|
|
21269
21279
|
imServerUrl: resolvedServerUrl,
|
|
21270
21280
|
tlsSkipVerify: a.tlsSkipVerify === true,
|
|
21281
|
+
...a.type === "bounty-cli" && a.channel ? { channel: a.channel } : {},
|
|
21271
21282
|
options: a.prompt ? { prompt: a.prompt } : undefined
|
|
21272
21283
|
};
|
|
21273
21284
|
esComponent.register(config);
|
|
@@ -21302,6 +21313,9 @@ var EventSourceAddCommand = {
|
|
|
21302
21313
|
if (a.prompt) {
|
|
21303
21314
|
output.log(` Prompt: ${chalk61.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
|
|
21304
21315
|
}
|
|
21316
|
+
if (a.channel) {
|
|
21317
|
+
output.log(` Channel: ${chalk61.gray(a.channel)}`);
|
|
21318
|
+
}
|
|
21305
21319
|
output.log("");
|
|
21306
21320
|
output.log(chalk61.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
|
|
21307
21321
|
} finally {
|
|
@@ -25590,11 +25604,6 @@ async function verifyInstalledVersion(packageName, declaredVersion) {
|
|
|
25590
25604
|
if (actual.version !== declaredVersion) {
|
|
25591
25605
|
return { ok: false, reason: "version-mismatch", actualVersion: actual.version };
|
|
25592
25606
|
}
|
|
25593
|
-
try {
|
|
25594
|
-
await import(packageName);
|
|
25595
|
-
} catch (e) {
|
|
25596
|
-
console.warn(`⚠️ verifyInstalledVersion: dynamic import of '${packageName}' failed but version check passed (npm global root may not be in Node module resolution path): ${e.message}`);
|
|
25597
|
-
}
|
|
25598
25607
|
return { ok: true, actualVersion: actual.version };
|
|
25599
25608
|
}
|
|
25600
25609
|
function getPackageManagerCommand() {
|
|
@@ -25754,9 +25763,9 @@ var InstallPackageCommand = {
|
|
|
25754
25763
|
if (verify.ok === false) {
|
|
25755
25764
|
console.warn(`
|
|
25756
25765
|
⚠️ Post-install version drift detected for '${resolvedPackageName}':
|
|
25757
|
-
declared (plugins.json): ${plugin.version}
|
|
25758
|
-
actual (npm global root): ${verify.actualVersion ?? "(unknown)"}
|
|
25759
|
-
reason: ${verify.reason}
|
|
25766
|
+
` + ` declared (plugins.json): ${plugin.version}
|
|
25767
|
+
` + ` actual (npm global root): ${verify.actualVersion ?? "(unknown)"}
|
|
25768
|
+
` + ` reason: ${verify.reason}
|
|
25760
25769
|
` + ` 请检查 ~/.roy-agent/node_modules/${resolvedPackageName}/ 是否残留陈旧 cp 副本
|
|
25761
25770
|
`);
|
|
25762
25771
|
}
|
|
@@ -25889,6 +25898,18 @@ function quietModeMiddleware(argv) {
|
|
|
25889
25898
|
quietService.setQuiet(true);
|
|
25890
25899
|
}
|
|
25891
25900
|
}
|
|
25901
|
+
function rewriteEsFlag(argv) {
|
|
25902
|
+
const esIdx = argv.indexOf("--es");
|
|
25903
|
+
if (esIdx === -1)
|
|
25904
|
+
return argv;
|
|
25905
|
+
const esValue = argv[esIdx + 1];
|
|
25906
|
+
if (!esValue || esValue.startsWith("--")) {
|
|
25907
|
+
return argv;
|
|
25908
|
+
}
|
|
25909
|
+
const before = argv.slice(0, esIdx);
|
|
25910
|
+
const after = argv.slice(esIdx + 2);
|
|
25911
|
+
return [...before, "eventsource", "start", esValue, ...after];
|
|
25912
|
+
}
|
|
25892
25913
|
var PLUGIN_HELP = `
|
|
25893
25914
|
Plugins:
|
|
25894
25915
|
coder-harness LSP plugins:
|
|
@@ -25919,8 +25940,13 @@ Examples:
|
|
|
25919
25940
|
--plugin tslsp code-check Enable multiple plugins`;
|
|
25920
25941
|
async function runCli() {
|
|
25921
25942
|
const version = getPackageVersion();
|
|
25943
|
+
const rewrittenArgv = rewriteEsFlag(process.argv.slice(2));
|
|
25922
25944
|
const yargs = yargsLib;
|
|
25923
|
-
await yargs(
|
|
25945
|
+
await yargs(rewrittenArgv).scriptName("roy-agent").version(version).option("es", {
|
|
25946
|
+
describe: "Start an event source by id/name (alias for `eventsource start <id>`). e.g. --es my-source",
|
|
25947
|
+
type: "string",
|
|
25948
|
+
global: true
|
|
25949
|
+
}).option("quiet", {
|
|
25924
25950
|
describe: "Quiet mode (default: on, use --no-quiet to enable logging)",
|
|
25925
25951
|
type: "boolean",
|
|
25926
25952
|
default: true,
|
|
Binary file
|