@ai-setting/roy-agent-cli 1.5.87 → 1.5.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/bin/roy-agent.js +92 -86
- package/dist/index.js +92 -86
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +5 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -7320,7 +7320,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7320
7320
|
var require_package = __commonJS((exports, module) => {
|
|
7321
7321
|
module.exports = {
|
|
7322
7322
|
name: "@ai-setting/roy-agent-cli",
|
|
7323
|
-
version: "1.5.
|
|
7323
|
+
version: "1.5.89",
|
|
7324
7324
|
type: "module",
|
|
7325
7325
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7326
7326
|
main: "./dist/index.js",
|
|
@@ -7343,6 +7343,8 @@ var require_package = __commonJS((exports, module) => {
|
|
|
7343
7343
|
scripts: {
|
|
7344
7344
|
build: "bunup",
|
|
7345
7345
|
clean: "rm -rf dist",
|
|
7346
|
+
lint: "eslint --max-warnings 0 src/",
|
|
7347
|
+
"lint:fix": "eslint --fix src/",
|
|
7346
7348
|
typecheck: "npx tsc --noEmit --skipLibCheck"
|
|
7347
7349
|
},
|
|
7348
7350
|
dependencies: {
|
|
@@ -7363,7 +7365,9 @@ var require_package = __commonJS((exports, module) => {
|
|
|
7363
7365
|
devDependencies: {
|
|
7364
7366
|
"@types/node": "^20.10.0",
|
|
7365
7367
|
"@types/yargs": "^17.0.32",
|
|
7368
|
+
"@typescript-eslint/parser": "^8.62.1",
|
|
7366
7369
|
bunup: "^0.16.0",
|
|
7370
|
+
eslint: "^10.6.0",
|
|
7367
7371
|
typescript: "^5.3.0"
|
|
7368
7372
|
},
|
|
7369
7373
|
engines: {
|
|
@@ -10316,6 +10320,8 @@ var ListCommand = {
|
|
|
10316
10320
|
const activeSessionId = sessionComponent.getActiveSessionId();
|
|
10317
10321
|
if (args.json) {
|
|
10318
10322
|
output.json({
|
|
10323
|
+
total: sessions.length,
|
|
10324
|
+
totalCount,
|
|
10319
10325
|
sessions: sessions.map((s) => {
|
|
10320
10326
|
const workflowMeta = s.metadata?.type === "workflow" ? s.metadata : null;
|
|
10321
10327
|
return {
|
|
@@ -10332,9 +10338,7 @@ var ListCommand = {
|
|
|
10332
10338
|
updatedAt: new Date(s.updatedAt).toISOString(),
|
|
10333
10339
|
isActive: s.id === activeSessionId
|
|
10334
10340
|
};
|
|
10335
|
-
})
|
|
10336
|
-
total: sessions.length,
|
|
10337
|
-
totalCount
|
|
10341
|
+
})
|
|
10338
10342
|
});
|
|
10339
10343
|
} else if (args.quiet || args.id) {
|
|
10340
10344
|
sessions.forEach((s) => output.log(s.id));
|
|
@@ -10845,7 +10849,13 @@ var MessagesCommand = {
|
|
|
10845
10849
|
}
|
|
10846
10850
|
if (a.json) {
|
|
10847
10851
|
output.json({
|
|
10852
|
+
total: totalMessages,
|
|
10848
10853
|
sessionId: a.sessionId,
|
|
10854
|
+
pagination: {
|
|
10855
|
+
offset: a.offset,
|
|
10856
|
+
limit: a.limit,
|
|
10857
|
+
hasMore: a.offset + a.limit < totalMessages
|
|
10858
|
+
},
|
|
10849
10859
|
messages: messages.map((m) => ({
|
|
10850
10860
|
id: m.id,
|
|
10851
10861
|
role: m.role,
|
|
@@ -10853,13 +10863,7 @@ var MessagesCommand = {
|
|
|
10853
10863
|
parts: m.parts,
|
|
10854
10864
|
timestamp: new Date(m.timestamp).toISOString(),
|
|
10855
10865
|
isCheckpoint: m.metadata?.isCheckpoint
|
|
10856
|
-
}))
|
|
10857
|
-
total: totalMessages,
|
|
10858
|
-
pagination: {
|
|
10859
|
-
offset: a.offset,
|
|
10860
|
-
limit: a.limit,
|
|
10861
|
-
hasMore: a.offset + a.limit < totalMessages
|
|
10862
|
-
}
|
|
10866
|
+
}))
|
|
10863
10867
|
});
|
|
10864
10868
|
} else {
|
|
10865
10869
|
const checkpointStyle = (content) => {
|
|
@@ -11847,6 +11851,35 @@ var SessionsCommand = {
|
|
|
11847
11851
|
|
|
11848
11852
|
// src/commands/tasks/list.ts
|
|
11849
11853
|
import chalk16 from "chalk";
|
|
11854
|
+
|
|
11855
|
+
// src/commands/tasks/_build-list-json.ts
|
|
11856
|
+
function buildListTasksJson(tasks, total, args, extras) {
|
|
11857
|
+
const projected = tasks.map((t) => ({
|
|
11858
|
+
id: t.id,
|
|
11859
|
+
title: t.title,
|
|
11860
|
+
status: t.status,
|
|
11861
|
+
priority: t.priority,
|
|
11862
|
+
type: t.type,
|
|
11863
|
+
progress: t.progress,
|
|
11864
|
+
current_status: t.current_status,
|
|
11865
|
+
project_path: t.project_path,
|
|
11866
|
+
context: t.context,
|
|
11867
|
+
createdAt: t.createdAt,
|
|
11868
|
+
updatedAt: t.updatedAt
|
|
11869
|
+
}));
|
|
11870
|
+
return {
|
|
11871
|
+
total,
|
|
11872
|
+
count: tasks.length,
|
|
11873
|
+
truncated: total > tasks.length,
|
|
11874
|
+
limit: args.limit,
|
|
11875
|
+
offset: args.offset,
|
|
11876
|
+
depth: args.depth,
|
|
11877
|
+
...extras ?? {},
|
|
11878
|
+
tasks: projected
|
|
11879
|
+
};
|
|
11880
|
+
}
|
|
11881
|
+
|
|
11882
|
+
// src/commands/tasks/list.ts
|
|
11850
11883
|
var ListCommand2 = {
|
|
11851
11884
|
command: "list",
|
|
11852
11885
|
aliases: ["ls"],
|
|
@@ -11901,25 +11934,7 @@ var ListCommand2 = {
|
|
|
11901
11934
|
const tasks = listResult.tasks;
|
|
11902
11935
|
const total = listResult.total;
|
|
11903
11936
|
if (args.json) {
|
|
11904
|
-
output.json(
|
|
11905
|
-
tasks: tasks.map((t) => ({
|
|
11906
|
-
id: t.id,
|
|
11907
|
-
title: t.title,
|
|
11908
|
-
status: t.status,
|
|
11909
|
-
priority: t.priority,
|
|
11910
|
-
type: t.type,
|
|
11911
|
-
progress: t.progress,
|
|
11912
|
-
current_status: t.current_status,
|
|
11913
|
-
project_path: t.project_path,
|
|
11914
|
-
context: t.context,
|
|
11915
|
-
createdAt: t.createdAt,
|
|
11916
|
-
updatedAt: t.updatedAt
|
|
11917
|
-
})),
|
|
11918
|
-
total,
|
|
11919
|
-
count: tasks.length,
|
|
11920
|
-
limit: args.limit,
|
|
11921
|
-
offset: args.offset
|
|
11922
|
-
});
|
|
11937
|
+
output.json(buildListTasksJson(tasks, total, args));
|
|
11923
11938
|
} else if (args.quiet) {
|
|
11924
11939
|
tasks.forEach((t) => output.log(t.id.toString()));
|
|
11925
11940
|
} else {
|
|
@@ -12104,8 +12119,7 @@ var CreateCommand = {
|
|
|
12104
12119
|
description: "项目路径"
|
|
12105
12120
|
}).option("parent-id", {
|
|
12106
12121
|
type: "number",
|
|
12107
|
-
description: "父任务 ID
|
|
12108
|
-
demandOption: true
|
|
12122
|
+
description: "父任务 ID(可选)。不传则创建根任务(root task)。使用 task_list(depth=0) 查看已有根任务列表。"
|
|
12109
12123
|
}).option("context", {
|
|
12110
12124
|
type: "string",
|
|
12111
12125
|
description: "任务上下文 (JSON 字符串)"
|
|
@@ -12422,9 +12436,9 @@ var OperationsCommand = {
|
|
|
12422
12436
|
const operations = await taskComponent.listOperations(listOptions);
|
|
12423
12437
|
if (a.json) {
|
|
12424
12438
|
output.json({
|
|
12439
|
+
count: operations.length,
|
|
12425
12440
|
task: { id: task.id, title: task.title },
|
|
12426
|
-
operations
|
|
12427
|
-
count: operations.length
|
|
12441
|
+
operations
|
|
12428
12442
|
});
|
|
12429
12443
|
} else {
|
|
12430
12444
|
output.log(chalk22.bold(`
|
|
@@ -12671,25 +12685,7 @@ var SearchCommand = {
|
|
|
12671
12685
|
const tasks = result.tasks;
|
|
12672
12686
|
const total = result.total;
|
|
12673
12687
|
if (args.json) {
|
|
12674
|
-
output.json({
|
|
12675
|
-
keywords: args.keywords,
|
|
12676
|
-
tasks: tasks.map((t) => ({
|
|
12677
|
-
id: t.id,
|
|
12678
|
-
title: t.title,
|
|
12679
|
-
status: t.status,
|
|
12680
|
-
priority: t.priority,
|
|
12681
|
-
type: t.type,
|
|
12682
|
-
progress: t.progress,
|
|
12683
|
-
parent_task_id: t.parent_task_id,
|
|
12684
|
-
project_path: t.project_path,
|
|
12685
|
-
createdAt: t.createdAt,
|
|
12686
|
-
updatedAt: t.updatedAt
|
|
12687
|
-
})),
|
|
12688
|
-
total,
|
|
12689
|
-
count: tasks.length,
|
|
12690
|
-
limit: args.limit,
|
|
12691
|
-
offset: args.offset
|
|
12692
|
-
});
|
|
12688
|
+
output.json(buildListTasksJson(tasks, total, { limit: args.limit, offset: args.offset }, { keywords: args.keywords }));
|
|
12693
12689
|
} else if (args.quiet) {
|
|
12694
12690
|
tasks.forEach((t) => output.log(t.id.toString()));
|
|
12695
12691
|
} else {
|
|
@@ -13015,12 +13011,12 @@ var ListCommand3 = {
|
|
|
13015
13011
|
const filtered = a.source && a.source !== "all" ? skills.filter((s) => s.source === a.source) : skills;
|
|
13016
13012
|
if (a.json) {
|
|
13017
13013
|
output.json({
|
|
13014
|
+
count: filtered.length,
|
|
13018
13015
|
skills: filtered.map((s) => ({
|
|
13019
13016
|
name: s.name,
|
|
13020
13017
|
description: s.description,
|
|
13021
13018
|
source: s.source
|
|
13022
|
-
}))
|
|
13023
|
-
count: filtered.length
|
|
13019
|
+
}))
|
|
13024
13020
|
});
|
|
13025
13021
|
} else if (a.quiet) {
|
|
13026
13022
|
filtered.forEach((s) => output.log(s.name));
|
|
@@ -13179,14 +13175,14 @@ var SearchCommand2 = {
|
|
|
13179
13175
|
}
|
|
13180
13176
|
if (args.json) {
|
|
13181
13177
|
output.json({
|
|
13178
|
+
count: results.length,
|
|
13179
|
+
term: args.term,
|
|
13182
13180
|
results: results.map((s) => ({
|
|
13183
13181
|
name: s.name,
|
|
13184
13182
|
description: s.description,
|
|
13185
13183
|
source: s.source,
|
|
13186
13184
|
matchedIn: s.name.toLowerCase().includes(term) ? "name" : "description"
|
|
13187
|
-
}))
|
|
13188
|
-
count: results.length,
|
|
13189
|
-
term: args.term
|
|
13185
|
+
}))
|
|
13190
13186
|
});
|
|
13191
13187
|
} else if (args.quiet) {
|
|
13192
13188
|
results.forEach((s) => output.log(s.name));
|
|
@@ -13393,6 +13389,7 @@ var ListCommand4 = {
|
|
|
13393
13389
|
}
|
|
13394
13390
|
if (args.json) {
|
|
13395
13391
|
output.json({
|
|
13392
|
+
count: agents.length,
|
|
13396
13393
|
agents: agents.map((a) => ({
|
|
13397
13394
|
name: a.name,
|
|
13398
13395
|
type: a.type,
|
|
@@ -13401,8 +13398,7 @@ var ListCommand4 = {
|
|
|
13401
13398
|
model: a.model,
|
|
13402
13399
|
systemPromptRef: a.systemPromptRef,
|
|
13403
13400
|
hasInlinePrompt: !!a.systemPrompt
|
|
13404
|
-
}))
|
|
13405
|
-
count: agents.length
|
|
13401
|
+
}))
|
|
13406
13402
|
});
|
|
13407
13403
|
} else if (args.quiet) {
|
|
13408
13404
|
agents.forEach((a) => output.log(a.name));
|
|
@@ -15340,13 +15336,13 @@ var ToolsCommand = {
|
|
|
15340
15336
|
}
|
|
15341
15337
|
if (args.json) {
|
|
15342
15338
|
output.json({
|
|
15339
|
+
count: tools.length,
|
|
15343
15340
|
tools: tools.map((t) => ({
|
|
15344
15341
|
name: t.name,
|
|
15345
15342
|
description: t.description,
|
|
15346
15343
|
category: t.metadata?.category,
|
|
15347
15344
|
tags: t.metadata?.tags
|
|
15348
|
-
}))
|
|
15349
|
-
count: tools.length
|
|
15345
|
+
}))
|
|
15350
15346
|
});
|
|
15351
15347
|
} else if (args.quiet) {
|
|
15352
15348
|
tools.forEach((t) => output.log(t.name));
|
|
@@ -15473,12 +15469,12 @@ var ListCommand7 = {
|
|
|
15473
15469
|
const tools = toolComponent.listTools();
|
|
15474
15470
|
if (args.json) {
|
|
15475
15471
|
output.json({
|
|
15472
|
+
count: tools.length,
|
|
15476
15473
|
tools: tools.map((t) => ({
|
|
15477
15474
|
name: t.name,
|
|
15478
15475
|
description: t.description,
|
|
15479
15476
|
category: t.metadata?.category
|
|
15480
|
-
}))
|
|
15481
|
-
count: tools.length
|
|
15477
|
+
}))
|
|
15482
15478
|
});
|
|
15483
15479
|
} else if (args.quiet) {
|
|
15484
15480
|
tools.forEach((t) => output.log(t.name));
|
|
@@ -17009,6 +17005,7 @@ function statusColor(status) {
|
|
|
17009
17005
|
function renderWorkflowList(workflows, options) {
|
|
17010
17006
|
if (options?.json) {
|
|
17011
17007
|
return JSON.stringify({
|
|
17008
|
+
total: workflows.length,
|
|
17012
17009
|
workflows: workflows.map((w) => ({
|
|
17013
17010
|
id: w.id,
|
|
17014
17011
|
name: w.name,
|
|
@@ -17017,8 +17014,7 @@ function renderWorkflowList(workflows, options) {
|
|
|
17017
17014
|
tags: w.tags,
|
|
17018
17015
|
createdAt: w.createdAt.toISOString(),
|
|
17019
17016
|
updatedAt: w.updatedAt.toISOString()
|
|
17020
|
-
}))
|
|
17021
|
-
total: workflows.length
|
|
17017
|
+
}))
|
|
17022
17018
|
}, null, 2);
|
|
17023
17019
|
}
|
|
17024
17020
|
if (workflows.length === 0) {
|
|
@@ -17096,6 +17092,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
17096
17092
|
function renderRunsList(runs, options) {
|
|
17097
17093
|
if (options?.json) {
|
|
17098
17094
|
return JSON.stringify({
|
|
17095
|
+
total: runs.length,
|
|
17099
17096
|
runs: runs.map((r) => ({
|
|
17100
17097
|
id: r.id,
|
|
17101
17098
|
workflowId: r.workflowId,
|
|
@@ -17104,8 +17101,7 @@ function renderRunsList(runs, options) {
|
|
|
17104
17101
|
completedAt: r.completedAt?.toISOString(),
|
|
17105
17102
|
durationMs: r.durationMs,
|
|
17106
17103
|
error: r.error
|
|
17107
|
-
}))
|
|
17108
|
-
total: runs.length
|
|
17104
|
+
}))
|
|
17109
17105
|
}, null, 2);
|
|
17110
17106
|
}
|
|
17111
17107
|
if (runs.length === 0) {
|
|
@@ -17248,6 +17244,19 @@ function renderNodesList(nodes) {
|
|
|
17248
17244
|
// src/commands/workflow/commands/list.ts
|
|
17249
17245
|
import chalk62 from "chalk";
|
|
17250
17246
|
import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
17247
|
+
function buildListWorkflowsJson(workflows, total, args, availableTags) {
|
|
17248
|
+
const output = {
|
|
17249
|
+
total,
|
|
17250
|
+
count: workflows.length,
|
|
17251
|
+
truncated: total > workflows.length,
|
|
17252
|
+
limit: args.limit,
|
|
17253
|
+
offset: args.offset,
|
|
17254
|
+
page: args.page,
|
|
17255
|
+
...availableTags.length > 0 ? { available_tags: availableTags } : {},
|
|
17256
|
+
workflows
|
|
17257
|
+
};
|
|
17258
|
+
return output;
|
|
17259
|
+
}
|
|
17251
17260
|
var WorkflowListCommand = {
|
|
17252
17261
|
command: "list",
|
|
17253
17262
|
describe: "列出所有已注册的 Workflow",
|
|
@@ -17352,22 +17361,19 @@ var WorkflowListCommand = {
|
|
|
17352
17361
|
const availableTags = data.available_tags || [];
|
|
17353
17362
|
const total = typeof data.total === "number" ? data.total : workflows.length;
|
|
17354
17363
|
if (args.json) {
|
|
17355
|
-
|
|
17356
|
-
|
|
17357
|
-
|
|
17358
|
-
|
|
17359
|
-
|
|
17360
|
-
|
|
17361
|
-
|
|
17362
|
-
|
|
17363
|
-
|
|
17364
|
-
available_tags: availableTags,
|
|
17365
|
-
total,
|
|
17366
|
-
count: workflows.length,
|
|
17364
|
+
const projected = workflows.map((w) => ({
|
|
17365
|
+
name: w.name,
|
|
17366
|
+
version: w.version,
|
|
17367
|
+
description: w.description,
|
|
17368
|
+
tags: w.tags,
|
|
17369
|
+
createdAt: w.created_at,
|
|
17370
|
+
updatedAt: w.created_at
|
|
17371
|
+
}));
|
|
17372
|
+
output.json(buildListWorkflowsJson(projected, total, {
|
|
17367
17373
|
limit: pageSize,
|
|
17368
17374
|
offset: finalOffset,
|
|
17369
17375
|
page: page > 1 ? page : Math.floor(finalOffset / pageSize) + 1
|
|
17370
|
-
});
|
|
17376
|
+
}, availableTags));
|
|
17371
17377
|
} else {
|
|
17372
17378
|
const renderWorkflows = workflows.map((w) => ({
|
|
17373
17379
|
id: w.name,
|
|
@@ -19595,6 +19601,9 @@ var _runWorkflowSearchImpl = async function(opts) {
|
|
|
19595
19601
|
const availableTags = result.available_tags ?? [];
|
|
19596
19602
|
if (asJson) {
|
|
19597
19603
|
output.json({
|
|
19604
|
+
total: workflows.length,
|
|
19605
|
+
available_tags: availableTags,
|
|
19606
|
+
keyword,
|
|
19598
19607
|
workflows: workflows.map((w) => ({
|
|
19599
19608
|
name: w.name,
|
|
19600
19609
|
version: w.version,
|
|
@@ -19603,9 +19612,6 @@ var _runWorkflowSearchImpl = async function(opts) {
|
|
|
19603
19612
|
createdAt: w.createdAt,
|
|
19604
19613
|
updatedAt: w.updatedAt
|
|
19605
19614
|
})),
|
|
19606
|
-
available_tags: availableTags,
|
|
19607
|
-
total: workflows.length,
|
|
19608
|
-
keyword,
|
|
19609
19615
|
tags
|
|
19610
19616
|
});
|
|
19611
19617
|
return;
|
|
@@ -19780,8 +19786,8 @@ var _runWorkflowTagListImpl = async function(opts) {
|
|
|
19780
19786
|
});
|
|
19781
19787
|
if (opts.asJson) {
|
|
19782
19788
|
output.json({
|
|
19783
|
-
|
|
19784
|
-
|
|
19789
|
+
total: result.total,
|
|
19790
|
+
tags: result.tags
|
|
19785
19791
|
});
|
|
19786
19792
|
return;
|
|
19787
19793
|
}
|
package/dist/index.js
CHANGED
|
@@ -7319,7 +7319,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7319
7319
|
var require_package = __commonJS((exports, module) => {
|
|
7320
7320
|
module.exports = {
|
|
7321
7321
|
name: "@ai-setting/roy-agent-cli",
|
|
7322
|
-
version: "1.5.
|
|
7322
|
+
version: "1.5.89",
|
|
7323
7323
|
type: "module",
|
|
7324
7324
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7325
7325
|
main: "./dist/index.js",
|
|
@@ -7342,6 +7342,8 @@ var require_package = __commonJS((exports, module) => {
|
|
|
7342
7342
|
scripts: {
|
|
7343
7343
|
build: "bunup",
|
|
7344
7344
|
clean: "rm -rf dist",
|
|
7345
|
+
lint: "eslint --max-warnings 0 src/",
|
|
7346
|
+
"lint:fix": "eslint --fix src/",
|
|
7345
7347
|
typecheck: "npx tsc --noEmit --skipLibCheck"
|
|
7346
7348
|
},
|
|
7347
7349
|
dependencies: {
|
|
@@ -7362,7 +7364,9 @@ var require_package = __commonJS((exports, module) => {
|
|
|
7362
7364
|
devDependencies: {
|
|
7363
7365
|
"@types/node": "^20.10.0",
|
|
7364
7366
|
"@types/yargs": "^17.0.32",
|
|
7367
|
+
"@typescript-eslint/parser": "^8.62.1",
|
|
7365
7368
|
bunup: "^0.16.0",
|
|
7369
|
+
eslint: "^10.6.0",
|
|
7366
7370
|
typescript: "^5.3.0"
|
|
7367
7371
|
},
|
|
7368
7372
|
engines: {
|
|
@@ -10315,6 +10319,8 @@ var ListCommand = {
|
|
|
10315
10319
|
const activeSessionId = sessionComponent.getActiveSessionId();
|
|
10316
10320
|
if (args.json) {
|
|
10317
10321
|
output.json({
|
|
10322
|
+
total: sessions.length,
|
|
10323
|
+
totalCount,
|
|
10318
10324
|
sessions: sessions.map((s) => {
|
|
10319
10325
|
const workflowMeta = s.metadata?.type === "workflow" ? s.metadata : null;
|
|
10320
10326
|
return {
|
|
@@ -10331,9 +10337,7 @@ var ListCommand = {
|
|
|
10331
10337
|
updatedAt: new Date(s.updatedAt).toISOString(),
|
|
10332
10338
|
isActive: s.id === activeSessionId
|
|
10333
10339
|
};
|
|
10334
|
-
})
|
|
10335
|
-
total: sessions.length,
|
|
10336
|
-
totalCount
|
|
10340
|
+
})
|
|
10337
10341
|
});
|
|
10338
10342
|
} else if (args.quiet || args.id) {
|
|
10339
10343
|
sessions.forEach((s) => output.log(s.id));
|
|
@@ -10844,7 +10848,13 @@ var MessagesCommand = {
|
|
|
10844
10848
|
}
|
|
10845
10849
|
if (a.json) {
|
|
10846
10850
|
output.json({
|
|
10851
|
+
total: totalMessages,
|
|
10847
10852
|
sessionId: a.sessionId,
|
|
10853
|
+
pagination: {
|
|
10854
|
+
offset: a.offset,
|
|
10855
|
+
limit: a.limit,
|
|
10856
|
+
hasMore: a.offset + a.limit < totalMessages
|
|
10857
|
+
},
|
|
10848
10858
|
messages: messages.map((m) => ({
|
|
10849
10859
|
id: m.id,
|
|
10850
10860
|
role: m.role,
|
|
@@ -10852,13 +10862,7 @@ var MessagesCommand = {
|
|
|
10852
10862
|
parts: m.parts,
|
|
10853
10863
|
timestamp: new Date(m.timestamp).toISOString(),
|
|
10854
10864
|
isCheckpoint: m.metadata?.isCheckpoint
|
|
10855
|
-
}))
|
|
10856
|
-
total: totalMessages,
|
|
10857
|
-
pagination: {
|
|
10858
|
-
offset: a.offset,
|
|
10859
|
-
limit: a.limit,
|
|
10860
|
-
hasMore: a.offset + a.limit < totalMessages
|
|
10861
|
-
}
|
|
10865
|
+
}))
|
|
10862
10866
|
});
|
|
10863
10867
|
} else {
|
|
10864
10868
|
const checkpointStyle = (content) => {
|
|
@@ -11846,6 +11850,35 @@ var SessionsCommand = {
|
|
|
11846
11850
|
|
|
11847
11851
|
// src/commands/tasks/list.ts
|
|
11848
11852
|
import chalk16 from "chalk";
|
|
11853
|
+
|
|
11854
|
+
// src/commands/tasks/_build-list-json.ts
|
|
11855
|
+
function buildListTasksJson(tasks, total, args, extras) {
|
|
11856
|
+
const projected = tasks.map((t) => ({
|
|
11857
|
+
id: t.id,
|
|
11858
|
+
title: t.title,
|
|
11859
|
+
status: t.status,
|
|
11860
|
+
priority: t.priority,
|
|
11861
|
+
type: t.type,
|
|
11862
|
+
progress: t.progress,
|
|
11863
|
+
current_status: t.current_status,
|
|
11864
|
+
project_path: t.project_path,
|
|
11865
|
+
context: t.context,
|
|
11866
|
+
createdAt: t.createdAt,
|
|
11867
|
+
updatedAt: t.updatedAt
|
|
11868
|
+
}));
|
|
11869
|
+
return {
|
|
11870
|
+
total,
|
|
11871
|
+
count: tasks.length,
|
|
11872
|
+
truncated: total > tasks.length,
|
|
11873
|
+
limit: args.limit,
|
|
11874
|
+
offset: args.offset,
|
|
11875
|
+
depth: args.depth,
|
|
11876
|
+
...extras ?? {},
|
|
11877
|
+
tasks: projected
|
|
11878
|
+
};
|
|
11879
|
+
}
|
|
11880
|
+
|
|
11881
|
+
// src/commands/tasks/list.ts
|
|
11849
11882
|
var ListCommand2 = {
|
|
11850
11883
|
command: "list",
|
|
11851
11884
|
aliases: ["ls"],
|
|
@@ -11900,25 +11933,7 @@ var ListCommand2 = {
|
|
|
11900
11933
|
const tasks = listResult.tasks;
|
|
11901
11934
|
const total = listResult.total;
|
|
11902
11935
|
if (args.json) {
|
|
11903
|
-
output.json(
|
|
11904
|
-
tasks: tasks.map((t) => ({
|
|
11905
|
-
id: t.id,
|
|
11906
|
-
title: t.title,
|
|
11907
|
-
status: t.status,
|
|
11908
|
-
priority: t.priority,
|
|
11909
|
-
type: t.type,
|
|
11910
|
-
progress: t.progress,
|
|
11911
|
-
current_status: t.current_status,
|
|
11912
|
-
project_path: t.project_path,
|
|
11913
|
-
context: t.context,
|
|
11914
|
-
createdAt: t.createdAt,
|
|
11915
|
-
updatedAt: t.updatedAt
|
|
11916
|
-
})),
|
|
11917
|
-
total,
|
|
11918
|
-
count: tasks.length,
|
|
11919
|
-
limit: args.limit,
|
|
11920
|
-
offset: args.offset
|
|
11921
|
-
});
|
|
11936
|
+
output.json(buildListTasksJson(tasks, total, args));
|
|
11922
11937
|
} else if (args.quiet) {
|
|
11923
11938
|
tasks.forEach((t) => output.log(t.id.toString()));
|
|
11924
11939
|
} else {
|
|
@@ -12103,8 +12118,7 @@ var CreateCommand = {
|
|
|
12103
12118
|
description: "项目路径"
|
|
12104
12119
|
}).option("parent-id", {
|
|
12105
12120
|
type: "number",
|
|
12106
|
-
description: "父任务 ID
|
|
12107
|
-
demandOption: true
|
|
12121
|
+
description: "父任务 ID(可选)。不传则创建根任务(root task)。使用 task_list(depth=0) 查看已有根任务列表。"
|
|
12108
12122
|
}).option("context", {
|
|
12109
12123
|
type: "string",
|
|
12110
12124
|
description: "任务上下文 (JSON 字符串)"
|
|
@@ -12421,9 +12435,9 @@ var OperationsCommand = {
|
|
|
12421
12435
|
const operations = await taskComponent.listOperations(listOptions);
|
|
12422
12436
|
if (a.json) {
|
|
12423
12437
|
output.json({
|
|
12438
|
+
count: operations.length,
|
|
12424
12439
|
task: { id: task.id, title: task.title },
|
|
12425
|
-
operations
|
|
12426
|
-
count: operations.length
|
|
12440
|
+
operations
|
|
12427
12441
|
});
|
|
12428
12442
|
} else {
|
|
12429
12443
|
output.log(chalk22.bold(`
|
|
@@ -12670,25 +12684,7 @@ var SearchCommand = {
|
|
|
12670
12684
|
const tasks = result.tasks;
|
|
12671
12685
|
const total = result.total;
|
|
12672
12686
|
if (args.json) {
|
|
12673
|
-
output.json({
|
|
12674
|
-
keywords: args.keywords,
|
|
12675
|
-
tasks: tasks.map((t) => ({
|
|
12676
|
-
id: t.id,
|
|
12677
|
-
title: t.title,
|
|
12678
|
-
status: t.status,
|
|
12679
|
-
priority: t.priority,
|
|
12680
|
-
type: t.type,
|
|
12681
|
-
progress: t.progress,
|
|
12682
|
-
parent_task_id: t.parent_task_id,
|
|
12683
|
-
project_path: t.project_path,
|
|
12684
|
-
createdAt: t.createdAt,
|
|
12685
|
-
updatedAt: t.updatedAt
|
|
12686
|
-
})),
|
|
12687
|
-
total,
|
|
12688
|
-
count: tasks.length,
|
|
12689
|
-
limit: args.limit,
|
|
12690
|
-
offset: args.offset
|
|
12691
|
-
});
|
|
12687
|
+
output.json(buildListTasksJson(tasks, total, { limit: args.limit, offset: args.offset }, { keywords: args.keywords }));
|
|
12692
12688
|
} else if (args.quiet) {
|
|
12693
12689
|
tasks.forEach((t) => output.log(t.id.toString()));
|
|
12694
12690
|
} else {
|
|
@@ -13014,12 +13010,12 @@ var ListCommand3 = {
|
|
|
13014
13010
|
const filtered = a.source && a.source !== "all" ? skills.filter((s) => s.source === a.source) : skills;
|
|
13015
13011
|
if (a.json) {
|
|
13016
13012
|
output.json({
|
|
13013
|
+
count: filtered.length,
|
|
13017
13014
|
skills: filtered.map((s) => ({
|
|
13018
13015
|
name: s.name,
|
|
13019
13016
|
description: s.description,
|
|
13020
13017
|
source: s.source
|
|
13021
|
-
}))
|
|
13022
|
-
count: filtered.length
|
|
13018
|
+
}))
|
|
13023
13019
|
});
|
|
13024
13020
|
} else if (a.quiet) {
|
|
13025
13021
|
filtered.forEach((s) => output.log(s.name));
|
|
@@ -13178,14 +13174,14 @@ var SearchCommand2 = {
|
|
|
13178
13174
|
}
|
|
13179
13175
|
if (args.json) {
|
|
13180
13176
|
output.json({
|
|
13177
|
+
count: results.length,
|
|
13178
|
+
term: args.term,
|
|
13181
13179
|
results: results.map((s) => ({
|
|
13182
13180
|
name: s.name,
|
|
13183
13181
|
description: s.description,
|
|
13184
13182
|
source: s.source,
|
|
13185
13183
|
matchedIn: s.name.toLowerCase().includes(term) ? "name" : "description"
|
|
13186
|
-
}))
|
|
13187
|
-
count: results.length,
|
|
13188
|
-
term: args.term
|
|
13184
|
+
}))
|
|
13189
13185
|
});
|
|
13190
13186
|
} else if (args.quiet) {
|
|
13191
13187
|
results.forEach((s) => output.log(s.name));
|
|
@@ -13392,6 +13388,7 @@ var ListCommand4 = {
|
|
|
13392
13388
|
}
|
|
13393
13389
|
if (args.json) {
|
|
13394
13390
|
output.json({
|
|
13391
|
+
count: agents.length,
|
|
13395
13392
|
agents: agents.map((a) => ({
|
|
13396
13393
|
name: a.name,
|
|
13397
13394
|
type: a.type,
|
|
@@ -13400,8 +13397,7 @@ var ListCommand4 = {
|
|
|
13400
13397
|
model: a.model,
|
|
13401
13398
|
systemPromptRef: a.systemPromptRef,
|
|
13402
13399
|
hasInlinePrompt: !!a.systemPrompt
|
|
13403
|
-
}))
|
|
13404
|
-
count: agents.length
|
|
13400
|
+
}))
|
|
13405
13401
|
});
|
|
13406
13402
|
} else if (args.quiet) {
|
|
13407
13403
|
agents.forEach((a) => output.log(a.name));
|
|
@@ -15339,13 +15335,13 @@ var ToolsCommand = {
|
|
|
15339
15335
|
}
|
|
15340
15336
|
if (args.json) {
|
|
15341
15337
|
output.json({
|
|
15338
|
+
count: tools.length,
|
|
15342
15339
|
tools: tools.map((t) => ({
|
|
15343
15340
|
name: t.name,
|
|
15344
15341
|
description: t.description,
|
|
15345
15342
|
category: t.metadata?.category,
|
|
15346
15343
|
tags: t.metadata?.tags
|
|
15347
|
-
}))
|
|
15348
|
-
count: tools.length
|
|
15344
|
+
}))
|
|
15349
15345
|
});
|
|
15350
15346
|
} else if (args.quiet) {
|
|
15351
15347
|
tools.forEach((t) => output.log(t.name));
|
|
@@ -15472,12 +15468,12 @@ var ListCommand7 = {
|
|
|
15472
15468
|
const tools = toolComponent.listTools();
|
|
15473
15469
|
if (args.json) {
|
|
15474
15470
|
output.json({
|
|
15471
|
+
count: tools.length,
|
|
15475
15472
|
tools: tools.map((t) => ({
|
|
15476
15473
|
name: t.name,
|
|
15477
15474
|
description: t.description,
|
|
15478
15475
|
category: t.metadata?.category
|
|
15479
|
-
}))
|
|
15480
|
-
count: tools.length
|
|
15476
|
+
}))
|
|
15481
15477
|
});
|
|
15482
15478
|
} else if (args.quiet) {
|
|
15483
15479
|
tools.forEach((t) => output.log(t.name));
|
|
@@ -17008,6 +17004,7 @@ function statusColor(status) {
|
|
|
17008
17004
|
function renderWorkflowList(workflows, options) {
|
|
17009
17005
|
if (options?.json) {
|
|
17010
17006
|
return JSON.stringify({
|
|
17007
|
+
total: workflows.length,
|
|
17011
17008
|
workflows: workflows.map((w) => ({
|
|
17012
17009
|
id: w.id,
|
|
17013
17010
|
name: w.name,
|
|
@@ -17016,8 +17013,7 @@ function renderWorkflowList(workflows, options) {
|
|
|
17016
17013
|
tags: w.tags,
|
|
17017
17014
|
createdAt: w.createdAt.toISOString(),
|
|
17018
17015
|
updatedAt: w.updatedAt.toISOString()
|
|
17019
|
-
}))
|
|
17020
|
-
total: workflows.length
|
|
17016
|
+
}))
|
|
17021
17017
|
}, null, 2);
|
|
17022
17018
|
}
|
|
17023
17019
|
if (workflows.length === 0) {
|
|
@@ -17095,6 +17091,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
17095
17091
|
function renderRunsList(runs, options) {
|
|
17096
17092
|
if (options?.json) {
|
|
17097
17093
|
return JSON.stringify({
|
|
17094
|
+
total: runs.length,
|
|
17098
17095
|
runs: runs.map((r) => ({
|
|
17099
17096
|
id: r.id,
|
|
17100
17097
|
workflowId: r.workflowId,
|
|
@@ -17103,8 +17100,7 @@ function renderRunsList(runs, options) {
|
|
|
17103
17100
|
completedAt: r.completedAt?.toISOString(),
|
|
17104
17101
|
durationMs: r.durationMs,
|
|
17105
17102
|
error: r.error
|
|
17106
|
-
}))
|
|
17107
|
-
total: runs.length
|
|
17103
|
+
}))
|
|
17108
17104
|
}, null, 2);
|
|
17109
17105
|
}
|
|
17110
17106
|
if (runs.length === 0) {
|
|
@@ -17247,6 +17243,19 @@ function renderNodesList(nodes) {
|
|
|
17247
17243
|
// src/commands/workflow/commands/list.ts
|
|
17248
17244
|
import chalk62 from "chalk";
|
|
17249
17245
|
import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
17246
|
+
function buildListWorkflowsJson(workflows, total, args, availableTags) {
|
|
17247
|
+
const output = {
|
|
17248
|
+
total,
|
|
17249
|
+
count: workflows.length,
|
|
17250
|
+
truncated: total > workflows.length,
|
|
17251
|
+
limit: args.limit,
|
|
17252
|
+
offset: args.offset,
|
|
17253
|
+
page: args.page,
|
|
17254
|
+
...availableTags.length > 0 ? { available_tags: availableTags } : {},
|
|
17255
|
+
workflows
|
|
17256
|
+
};
|
|
17257
|
+
return output;
|
|
17258
|
+
}
|
|
17250
17259
|
var WorkflowListCommand = {
|
|
17251
17260
|
command: "list",
|
|
17252
17261
|
describe: "列出所有已注册的 Workflow",
|
|
@@ -17351,22 +17360,19 @@ var WorkflowListCommand = {
|
|
|
17351
17360
|
const availableTags = data.available_tags || [];
|
|
17352
17361
|
const total = typeof data.total === "number" ? data.total : workflows.length;
|
|
17353
17362
|
if (args.json) {
|
|
17354
|
-
|
|
17355
|
-
|
|
17356
|
-
|
|
17357
|
-
|
|
17358
|
-
|
|
17359
|
-
|
|
17360
|
-
|
|
17361
|
-
|
|
17362
|
-
|
|
17363
|
-
available_tags: availableTags,
|
|
17364
|
-
total,
|
|
17365
|
-
count: workflows.length,
|
|
17363
|
+
const projected = workflows.map((w) => ({
|
|
17364
|
+
name: w.name,
|
|
17365
|
+
version: w.version,
|
|
17366
|
+
description: w.description,
|
|
17367
|
+
tags: w.tags,
|
|
17368
|
+
createdAt: w.created_at,
|
|
17369
|
+
updatedAt: w.created_at
|
|
17370
|
+
}));
|
|
17371
|
+
output.json(buildListWorkflowsJson(projected, total, {
|
|
17366
17372
|
limit: pageSize,
|
|
17367
17373
|
offset: finalOffset,
|
|
17368
17374
|
page: page > 1 ? page : Math.floor(finalOffset / pageSize) + 1
|
|
17369
|
-
});
|
|
17375
|
+
}, availableTags));
|
|
17370
17376
|
} else {
|
|
17371
17377
|
const renderWorkflows = workflows.map((w) => ({
|
|
17372
17378
|
id: w.name,
|
|
@@ -19594,6 +19600,9 @@ var _runWorkflowSearchImpl = async function(opts) {
|
|
|
19594
19600
|
const availableTags = result.available_tags ?? [];
|
|
19595
19601
|
if (asJson) {
|
|
19596
19602
|
output.json({
|
|
19603
|
+
total: workflows.length,
|
|
19604
|
+
available_tags: availableTags,
|
|
19605
|
+
keyword,
|
|
19597
19606
|
workflows: workflows.map((w) => ({
|
|
19598
19607
|
name: w.name,
|
|
19599
19608
|
version: w.version,
|
|
@@ -19602,9 +19611,6 @@ var _runWorkflowSearchImpl = async function(opts) {
|
|
|
19602
19611
|
createdAt: w.createdAt,
|
|
19603
19612
|
updatedAt: w.updatedAt
|
|
19604
19613
|
})),
|
|
19605
|
-
available_tags: availableTags,
|
|
19606
|
-
total: workflows.length,
|
|
19607
|
-
keyword,
|
|
19608
19614
|
tags
|
|
19609
19615
|
});
|
|
19610
19616
|
return;
|
|
@@ -19779,8 +19785,8 @@ var _runWorkflowTagListImpl = async function(opts) {
|
|
|
19779
19785
|
});
|
|
19780
19786
|
if (opts.asJson) {
|
|
19781
19787
|
output.json({
|
|
19782
|
-
|
|
19783
|
-
|
|
19788
|
+
total: result.total,
|
|
19789
|
+
tags: result.tags
|
|
19784
19790
|
});
|
|
19785
19791
|
return;
|
|
19786
19792
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-setting/roy-agent-cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.89",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI for roy-agent - Non-interactive command execution",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "bunup",
|
|
25
25
|
"clean": "rm -rf dist",
|
|
26
|
+
"lint": "eslint --max-warnings 0 src/",
|
|
27
|
+
"lint:fix": "eslint --fix src/",
|
|
26
28
|
"typecheck": "npx tsc --noEmit --skipLibCheck"
|
|
27
29
|
},
|
|
28
30
|
"dependencies": {
|
|
@@ -43,7 +45,9 @@
|
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@types/node": "^20.10.0",
|
|
45
47
|
"@types/yargs": "^17.0.32",
|
|
48
|
+
"@typescript-eslint/parser": "^8.62.1",
|
|
46
49
|
"bunup": "^0.16.0",
|
|
50
|
+
"eslint": "^10.6.0",
|
|
47
51
|
"typescript": "^5.3.0"
|
|
48
52
|
},
|
|
49
53
|
"engines": {
|