@ai-setting/roy-agent-core 1.5.83 → 1.5.84

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.
Files changed (26) hide show
  1. package/dist/env/event-source/index.js +2 -2
  2. package/dist/env/index.js +7 -6
  3. package/dist/env/prompt/index.js +1 -1
  4. package/dist/env/task/plugins/index.js +1 -1
  5. package/dist/env/workflow/index.js +4 -3
  6. package/dist/env/workflow/service/index.js +8 -2
  7. package/dist/env/workflow/storage/index.js +11 -6
  8. package/dist/env/workflow/tools/index.js +15 -1
  9. package/dist/index.js +10 -8
  10. package/dist/shared/@ai-setting/{roy-agent-core-68sef3es.js → roy-agent-core-29fh9mxg.js} +1 -1
  11. package/dist/shared/@ai-setting/roy-agent-core-3sv590cv.js +132 -0
  12. package/dist/shared/@ai-setting/{roy-agent-core-78yzt2bq.js → roy-agent-core-7fdzfsm6.js} +2 -2
  13. package/dist/shared/@ai-setting/{roy-agent-core-am646wfz.js → roy-agent-core-86d4exyf.js} +5 -2
  14. package/dist/shared/@ai-setting/{roy-agent-core-vcvgq9hy.js → roy-agent-core-akepggsr.js} +102 -5
  15. package/dist/shared/@ai-setting/{roy-agent-core-v3t28k5n.js → roy-agent-core-bt7wezvg.js} +19 -10
  16. package/dist/shared/@ai-setting/roy-agent-core-c67wr8sp.js +11 -0
  17. package/dist/shared/@ai-setting/{roy-agent-core-496zzm5a.js → roy-agent-core-h4h55x4h.js} +183 -3
  18. package/dist/shared/@ai-setting/roy-agent-core-hhrg314p.js +34 -0
  19. package/dist/shared/@ai-setting/roy-agent-core-r5axf0ad.js +751 -0
  20. package/dist/shared/@ai-setting/{roy-agent-core-74cp3zp1.js → roy-agent-core-taxvytzz.js} +4 -1
  21. package/dist/shared/@ai-setting/roy-agent-core-tq9528d3.js +336 -0
  22. package/dist/shared/@ai-setting/{roy-agent-core-67yzhmg2.js → roy-agent-core-ya1ayt1k.js} +1 -1
  23. package/package.json +1 -1
  24. package/dist/shared/@ai-setting/roy-agent-core-4t40mkpv.js +0 -206
  25. package/dist/shared/@ai-setting/roy-agent-core-6b57g1zk.js +0 -103
  26. package/dist/shared/@ai-setting/roy-agent-core-a6j7g1qe.js +0 -428
@@ -4,7 +4,7 @@ import {
4
4
  builtInHandlers,
5
5
  getBuiltInHandler,
6
6
  larkCliHandler
7
- } from "../../shared/@ai-setting/roy-agent-core-67yzhmg2.js";
7
+ } from "../../shared/@ai-setting/roy-agent-core-ya1ayt1k.js";
8
8
  import {
9
9
  BUILT_IN_EVENT_SOURCE_TYPES,
10
10
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -15,7 +15,7 @@ import {
15
15
  validateEventSourceConfig
16
16
  } from "../../shared/@ai-setting/roy-agent-core-xb4hvk1m.js";
17
17
  import"../../shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
18
- import"../../shared/@ai-setting/roy-agent-core-78yzt2bq.js";
18
+ import"../../shared/@ai-setting/roy-agent-core-7fdzfsm6.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
package/dist/env/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  BaseEnvironment
3
- } from "../shared/@ai-setting/roy-agent-core-68sef3es.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-29fh9mxg.js";
4
4
  import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-67yzhmg2.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-ya1ayt1k.js";
9
9
  import {
10
10
  EventSourceInitHooks,
11
11
  getDefaultConfigForType,
@@ -17,11 +17,11 @@ import"../shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
17
17
  import {
18
18
  PluginComponent
19
19
  } from "../shared/@ai-setting/roy-agent-core-t1ef8hf2.js";
20
- import"../shared/@ai-setting/roy-agent-core-78yzt2bq.js";
20
+ import"../shared/@ai-setting/roy-agent-core-7fdzfsm6.js";
21
21
  import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
22
22
  import {
23
23
  WorkflowComponent
24
- } from "../shared/@ai-setting/roy-agent-core-v3t28k5n.js";
24
+ } from "../shared/@ai-setting/roy-agent-core-bt7wezvg.js";
25
25
  import"../shared/@ai-setting/roy-agent-core-fjexv5nm.js";
26
26
  import"../shared/@ai-setting/roy-agent-core-6b0r2e7j.js";
27
27
  import"../shared/@ai-setting/roy-agent-core-m4qjnhz6.js";
@@ -29,11 +29,12 @@ import"../shared/@ai-setting/roy-agent-core-7z8fzxck.js";
29
29
  import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
30
30
  import"../shared/@ai-setting/roy-agent-core-gb9gbkc3.js";
31
31
  import"../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
32
- import"../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
32
+ import"../shared/@ai-setting/roy-agent-core-hhrg314p.js";
33
33
  import"../shared/@ai-setting/roy-agent-core-j754zgb4.js";
34
34
  import"../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
35
- import"../shared/@ai-setting/roy-agent-core-a6j7g1qe.js";
35
+ import"../shared/@ai-setting/roy-agent-core-r5axf0ad.js";
36
36
  import"../shared/@ai-setting/roy-agent-core-whw7jap0.js";
37
+ import"../shared/@ai-setting/roy-agent-core-tq9528d3.js";
37
38
  import"../shared/@ai-setting/roy-agent-core-h0x19xgn.js";
38
39
  import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
39
40
  import {
@@ -3,7 +3,7 @@ import {
3
3
  PromptConfigSchema,
4
4
  PromptPathSchema,
5
5
  PromptRenderer
6
- } from "../../shared/@ai-setting/roy-agent-core-vcvgq9hy.js";
6
+ } from "../../shared/@ai-setting/roy-agent-core-akepggsr.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
@@ -9,7 +9,7 @@ import {
9
9
  formatExtractorInput,
10
10
  formatExtractorInputFromDescription,
11
11
  parseExtractorOutput
12
- } from "../../../shared/@ai-setting/roy-agent-core-78yzt2bq.js";
12
+ } from "../../../shared/@ai-setting/roy-agent-core-7fdzfsm6.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
15
15
  import"../../../shared/@ai-setting/roy-agent-core-qg4rma4c.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WorkflowComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-v3t28k5n.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-bt7wezvg.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-fjexv5nm.js";
5
5
  import"../../shared/@ai-setting/roy-agent-core-6b0r2e7j.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-m4qjnhz6.js";
@@ -8,7 +8,7 @@ import"../../shared/@ai-setting/roy-agent-core-7z8fzxck.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-gb9gbkc3.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
11
- import"../../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
11
+ import"../../shared/@ai-setting/roy-agent-core-hhrg314p.js";
12
12
  import"../../shared/@ai-setting/roy-agent-core-j754zgb4.js";
13
13
  import {
14
14
  BaseEventSchema,
@@ -61,8 +61,9 @@ import {
61
61
  pathNotFound,
62
62
  unresolvedVariable
63
63
  } from "../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
64
- import"../../shared/@ai-setting/roy-agent-core-a6j7g1qe.js";
64
+ import"../../shared/@ai-setting/roy-agent-core-r5axf0ad.js";
65
65
  import"../../shared/@ai-setting/roy-agent-core-whw7jap0.js";
66
+ import"../../shared/@ai-setting/roy-agent-core-tq9528d3.js";
66
67
  import {
67
68
  Edge,
68
69
  NodeAs,
@@ -1,9 +1,15 @@
1
1
  import {
2
- WorkflowService,
3
2
  WorkflowServiceRegistry,
4
3
  getWorkflowService,
5
4
  registerWorkflowService
6
- } from "../../../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
5
+ } from "../../../shared/@ai-setting/roy-agent-core-hhrg314p.js";
6
+ import {
7
+ WorkflowService
8
+ } from "../../../shared/@ai-setting/roy-agent-core-tq9528d3.js";
9
+ import"../../../shared/@ai-setting/roy-agent-core-k05v31rc.js";
10
+ import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
11
+ import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
12
+ import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
7
13
  import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
8
14
  export {
9
15
  registerWorkflowService,
@@ -1,16 +1,19 @@
1
1
  import {
2
2
  WorkflowRepository,
3
- rowToWorkflow
4
- } from "../../../shared/@ai-setting/roy-agent-core-496zzm5a.js";
5
- import {
6
3
  closeDatabase,
7
4
  getDatabase,
8
5
  getDatabasePath,
9
6
  initDatabase,
10
7
  initializeTables,
11
- resetDatabase
12
- } from "../../../shared/@ai-setting/roy-agent-core-6b57g1zk.js";
8
+ migrateEmptyTagsToDefault,
9
+ resetDatabase,
10
+ rowToWorkflow
11
+ } from "../../../shared/@ai-setting/roy-agent-core-h4h55x4h.js";
12
+ import {
13
+ TagRepository
14
+ } from "../../../shared/@ai-setting/roy-agent-core-3sv590cv.js";
13
15
  import"../../../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
16
+ import"../../../shared/@ai-setting/roy-agent-core-k05v31rc.js";
14
17
  import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
15
18
  import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
16
19
  import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
@@ -18,10 +21,12 @@ import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
18
21
  export {
19
22
  rowToWorkflow,
20
23
  resetDatabase,
24
+ migrateEmptyTagsToDefault,
21
25
  initializeTables,
22
26
  initDatabase,
23
27
  getDatabasePath,
24
28
  getDatabase,
25
29
  closeDatabase,
26
- WorkflowRepository
30
+ WorkflowRepository,
31
+ TagRepository
27
32
  };
@@ -1,22 +1,28 @@
1
1
  import {
2
2
  AskUserInputSchema,
3
3
  RunWorkflowInputSchema,
4
+ WorkflowAddInputSchema,
4
5
  WorkflowGetInputSchema,
5
6
  WorkflowListInputSchema,
6
7
  WorkflowRunStatusInputSchema,
7
8
  WorkflowRunStopInputSchema,
9
+ WorkflowSearchInputSchema,
10
+ WorkflowTagListInputSchema,
8
11
  askUserTool,
9
12
  askUserToolInstance,
10
13
  createLegacyRunWorkflowTool,
11
14
  createRunWorkflowTool,
15
+ createWorkflowAddTool,
12
16
  createWorkflowGetTool,
13
17
  createWorkflowListTool,
14
18
  createWorkflowRunStatusTool,
15
19
  createWorkflowRunStopTool,
20
+ createWorkflowSearchTool,
21
+ createWorkflowTagListTool,
16
22
  getRunWorkflowTool,
17
23
  initRunWorkflowTool,
18
24
  resetRunWorkflowTool
19
- } from "../../../shared/@ai-setting/roy-agent-core-a6j7g1qe.js";
25
+ } from "../../../shared/@ai-setting/roy-agent-core-r5axf0ad.js";
20
26
  import {
21
27
  WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
22
28
  WorkflowJsonOutputMarker,
@@ -24,7 +30,9 @@ import {
24
30
  init_submit_json_output_tool,
25
31
  parseWorkflowJsonOutput
26
32
  } from "../../../shared/@ai-setting/roy-agent-core-whw7jap0.js";
33
+ import"../../../shared/@ai-setting/roy-agent-core-tq9528d3.js";
27
34
  import"../../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
35
+ import"../../../shared/@ai-setting/roy-agent-core-k05v31rc.js";
28
36
  import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
29
37
  import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
30
38
  import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
@@ -37,20 +45,26 @@ export {
37
45
  parseWorkflowJsonOutput,
38
46
  initRunWorkflowTool,
39
47
  getRunWorkflowTool,
48
+ createWorkflowTagListTool,
49
+ createWorkflowSearchTool,
40
50
  createWorkflowRunStopTool,
41
51
  createWorkflowRunStatusTool,
42
52
  createWorkflowListTool,
43
53
  createWorkflowGetTool,
54
+ createWorkflowAddTool,
44
55
  createSubmitJsonOutputTool,
45
56
  createRunWorkflowTool,
46
57
  createLegacyRunWorkflowTool,
47
58
  askUserToolInstance,
48
59
  askUserTool,
60
+ WorkflowTagListInputSchema,
61
+ WorkflowSearchInputSchema,
49
62
  WorkflowRunStopInputSchema,
50
63
  WorkflowRunStatusInputSchema,
51
64
  WorkflowListInputSchema,
52
65
  WorkflowJsonOutputMarker,
53
66
  WorkflowGetInputSchema,
67
+ WorkflowAddInputSchema,
54
68
  WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
55
69
  RunWorkflowInputSchema,
56
70
  AskUserInputSchema
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  PromptStore,
4
4
  getBuiltInPrompt,
5
5
  getBuiltInPromptNames
6
- } from "./shared/@ai-setting/roy-agent-core-vcvgq9hy.js";
6
+ } from "./shared/@ai-setting/roy-agent-core-akepggsr.js";
7
7
  import {
8
8
  LLMComponent,
9
9
  LLMConfigSchema,
@@ -35,7 +35,8 @@ import {
35
35
  } from "./shared/@ai-setting/roy-agent-core-8pk6a00t.js";
36
36
  import {
37
37
  closeDatabase
38
- } from "./shared/@ai-setting/roy-agent-core-6b57g1zk.js";
38
+ } from "./shared/@ai-setting/roy-agent-core-h4h55x4h.js";
39
+ import"./shared/@ai-setting/roy-agent-core-3sv590cv.js";
39
40
  import"./shared/@ai-setting/roy-agent-core-2grcjaad.js";
40
41
  import {
41
42
  MemoryComponent
@@ -57,13 +58,13 @@ import {
57
58
  BaseEnvironment,
58
59
  generateDescendingId,
59
60
  generateId
60
- } from "./shared/@ai-setting/roy-agent-core-68sef3es.js";
61
+ } from "./shared/@ai-setting/roy-agent-core-29fh9mxg.js";
61
62
  import {
62
63
  EventSourceComponent,
63
64
  builtInHandlers,
64
65
  getBuiltInHandler,
65
66
  larkCliHandler
66
- } from "./shared/@ai-setting/roy-agent-core-67yzhmg2.js";
67
+ } from "./shared/@ai-setting/roy-agent-core-ya1ayt1k.js";
67
68
  import {
68
69
  BUILT_IN_EVENT_SOURCE_TYPES,
69
70
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -83,13 +84,13 @@ import {
83
84
  import {
84
85
  TaskTagPlugin,
85
86
  createAutoTaskPlugin
86
- } from "./shared/@ai-setting/roy-agent-core-78yzt2bq.js";
87
+ } from "./shared/@ai-setting/roy-agent-core-7fdzfsm6.js";
87
88
  import {
88
89
  BasePlugin
89
90
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
90
91
  import {
91
92
  WorkflowComponent
92
- } from "./shared/@ai-setting/roy-agent-core-v3t28k5n.js";
93
+ } from "./shared/@ai-setting/roy-agent-core-bt7wezvg.js";
93
94
  import {
94
95
  init_node_registry_helper,
95
96
  registerDecoratorNodeType
@@ -100,11 +101,12 @@ import"./shared/@ai-setting/roy-agent-core-7z8fzxck.js";
100
101
  import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
101
102
  import"./shared/@ai-setting/roy-agent-core-gb9gbkc3.js";
102
103
  import"./shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
103
- import"./shared/@ai-setting/roy-agent-core-4t40mkpv.js";
104
+ import"./shared/@ai-setting/roy-agent-core-hhrg314p.js";
104
105
  import"./shared/@ai-setting/roy-agent-core-j754zgb4.js";
105
106
  import"./shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
106
- import"./shared/@ai-setting/roy-agent-core-a6j7g1qe.js";
107
+ import"./shared/@ai-setting/roy-agent-core-r5axf0ad.js";
107
108
  import"./shared/@ai-setting/roy-agent-core-whw7jap0.js";
109
+ import"./shared/@ai-setting/roy-agent-core-tq9528d3.js";
108
110
  import {
109
111
  Edge,
110
112
  NodeAs,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAutoTaskPlugin
3
- } from "./roy-agent-core-78yzt2bq.js";
3
+ } from "./roy-agent-core-7fdzfsm6.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -0,0 +1,132 @@
1
+ import {
2
+ TracedAs,
3
+ init_decorator
4
+ } from "./roy-agent-core-k05v31rc.js";
5
+ import {
6
+ __legacyDecorateClassTS
7
+ } from "./roy-agent-core-fs0mn2jk.js";
8
+
9
+ // src/env/workflow/storage/tag-repo.ts
10
+ init_decorator();
11
+ class TagRepository {
12
+ db;
13
+ constructor(db) {
14
+ this.db = db;
15
+ }
16
+ static createTable(db) {
17
+ db.exec(`
18
+ CREATE TABLE IF NOT EXISTS workflow_tags (
19
+ name TEXT PRIMARY KEY,
20
+ usage_count INTEGER NOT NULL DEFAULT 0,
21
+ created_at TEXT NOT NULL,
22
+ updated_at TEXT NOT NULL
23
+ );
24
+ `);
25
+ db.exec(`
26
+ CREATE INDEX IF NOT EXISTS idx_workflow_tags_usage
27
+ ON workflow_tags(usage_count DESC);
28
+ `);
29
+ }
30
+ upsertMany(names) {
31
+ if (!names || names.length === 0)
32
+ return;
33
+ const insertStmt = this.db.prepare(`
34
+ INSERT INTO workflow_tags (name, usage_count, created_at, updated_at)
35
+ VALUES (?, 1, ?, ?)
36
+ ON CONFLICT(name) DO UPDATE SET
37
+ usage_count = usage_count + 1,
38
+ updated_at = excluded.updated_at
39
+ `);
40
+ const now = new Date().toISOString();
41
+ for (const name of names) {
42
+ const trimmed = (name ?? "").trim();
43
+ if (!trimmed)
44
+ continue;
45
+ insertStmt.run(trimmed, now, now);
46
+ }
47
+ }
48
+ decrementMany(names) {
49
+ if (!names || names.length === 0)
50
+ return;
51
+ const updateStmt = this.db.prepare(`
52
+ UPDATE workflow_tags
53
+ SET usage_count = MAX(0, usage_count - 1),
54
+ updated_at = ?
55
+ WHERE name = ?
56
+ `);
57
+ const now = new Date().toISOString();
58
+ for (const name of names) {
59
+ const trimmed = (name ?? "").trim();
60
+ if (!trimmed)
61
+ continue;
62
+ updateStmt.run(now, trimmed);
63
+ }
64
+ }
65
+ list(options = {}) {
66
+ const sortBy = options.sortBy ?? "usage_count";
67
+ const order = (options.order ?? "desc").toUpperCase();
68
+ const limit = options.limit ?? undefined;
69
+ let sortColumn;
70
+ switch (sortBy) {
71
+ case "name":
72
+ sortColumn = "name";
73
+ break;
74
+ case "created_at":
75
+ sortColumn = "created_at";
76
+ break;
77
+ case "usage_count":
78
+ default:
79
+ sortColumn = "usage_count";
80
+ break;
81
+ }
82
+ let sql = `SELECT name, usage_count, created_at, updated_at
83
+ FROM workflow_tags
84
+ ORDER BY ${sortColumn} ${order}, name ASC`;
85
+ if (typeof limit === "number" && limit > 0) {
86
+ sql += ` LIMIT ${Math.floor(limit)}`;
87
+ }
88
+ const rows = this.db.prepare(sql).all();
89
+ return rows.map((r) => ({
90
+ name: r.name,
91
+ usage_count: r.usage_count,
92
+ created_at: r.created_at,
93
+ updated_at: r.updated_at
94
+ }));
95
+ }
96
+ get(name) {
97
+ const row = this.db.prepare(`SELECT name, usage_count, created_at, updated_at
98
+ FROM workflow_tags
99
+ WHERE name = ?`).get(name);
100
+ if (!row)
101
+ return;
102
+ return {
103
+ name: row.name,
104
+ usage_count: row.usage_count,
105
+ created_at: row.created_at,
106
+ updated_at: row.updated_at
107
+ };
108
+ }
109
+ }
110
+ __legacyDecorateClassTS([
111
+ TracedAs("workflow.tag_repo.upsertMany", {
112
+ recordParams: true,
113
+ recordResult: false,
114
+ log: false
115
+ })
116
+ ], TagRepository.prototype, "upsertMany", null);
117
+ __legacyDecorateClassTS([
118
+ TracedAs("workflow.tag_repo.decrementMany", {
119
+ recordParams: true,
120
+ recordResult: false,
121
+ log: false
122
+ })
123
+ ], TagRepository.prototype, "decrementMany", null);
124
+ __legacyDecorateClassTS([
125
+ TracedAs("workflow.tag_repo.list", {
126
+ recordParams: true,
127
+ recordResult: true,
128
+ log: false
129
+ })
130
+ ], TagRepository.prototype, "list", null);
131
+
132
+ export { TagRepository };
@@ -369,11 +369,11 @@ ${prompt}`;
369
369
  }
370
370
  if (!this._workflowRepo) {
371
371
  try {
372
- const sqlite = await import("./roy-agent-core-74cp3zp1.js");
372
+ const sqlite = await import("./roy-agent-core-taxvytzz.js");
373
373
  this.ensureDataDir();
374
374
  const db = sqlite.getDatabase();
375
375
  sqlite.initializeTables();
376
- const { WorkflowRepository } = await import("./roy-agent-core-am646wfz.js");
376
+ const { WorkflowRepository } = await import("./roy-agent-core-86d4exyf.js");
377
377
  this._workflowRepo = new WorkflowRepository(db);
378
378
  return this._workflowRepo;
379
379
  } catch {
@@ -1,14 +1,17 @@
1
1
  import {
2
2
  WorkflowRepository,
3
+ migrateEmptyTagsToDefault,
3
4
  rowToWorkflow
4
- } from "./roy-agent-core-496zzm5a.js";
5
- import"./roy-agent-core-6b57g1zk.js";
5
+ } from "./roy-agent-core-h4h55x4h.js";
6
+ import"./roy-agent-core-3sv590cv.js";
6
7
  import"./roy-agent-core-rvxg1wps.js";
8
+ import"./roy-agent-core-k05v31rc.js";
7
9
  import"./roy-agent-core-shme7set.js";
8
10
  import"./roy-agent-core-7z9b1fm8.js";
9
11
  import"./roy-agent-core-c6592r3c.js";
10
12
  import"./roy-agent-core-fs0mn2jk.js";
11
13
  export {
12
14
  rowToWorkflow,
15
+ migrateEmptyTagsToDefault,
13
16
  WorkflowRepository
14
17
  };
@@ -136,7 +136,8 @@ var builtInPrompts = {
136
136
  - **文件浏览 / 读取**:\`ls -la\`、\`cat file.txt\`、\`head -n 20 file.txt\`、\`tail -n 50 log.txt\`、\`grep "pattern" file.txt\`、\`find . -name "*.ts"\`
137
137
  - **状态查询**:\`pwd\`、\`date\`、\`whoami\`、\`which node\`、\`git status\`、\`git log -5\`、\`git diff\`
138
138
  - **简单测试 / 工具调用**:\`echo "hello"\`、\`node --version\`、\`bun --version\`
139
- - **调用一行 \`roy-agent\` 命令**(如 \`bun packages/cli/dist/bin/roy-agent.js tasks list\`)
139
+ - **调用一行 \`roy-agent\` 命令**(如 \`bun packages/cli/dist/bin/roy-agent.js tasks list\`、\`roy-agent workflow list\`、\`roy-agent workflow tag list\`、\`roy-agent workflow search --keyword xxx\`)
140
+ - workflow 创建流程:\`roy-agent workflow add --name <name> --file <yaml> --tags "tag1,tag2"\`,创建前可用 \`roy-agent workflow validate --file <yaml>\` 验证 YAML 语法
140
141
 
141
142
  **\`bash\` 适合 vs 需要委托的边界:**
142
143
  - ✅ \`ls -la\`、\`cat file.txt\`、\`grep "TODO" src/*.ts\`、\`git status\`、\`find . -name "*.ts"\` — **直接用 \`bash\` 执行**
@@ -245,6 +246,21 @@ delegate_task(
245
246
  4. **搜索相似任务并委托** — 在委托前,先使用 \`task_search\` 搜索与当前请求相关的历史任务,将找到的相似任务 ID 填入 \`similar_task_ids\` 参数。在给子智能体的提示词中,始终包含简要指令,要求将工作视为任务一等公民:创建任务(\`task_create\`)、跟踪进度并完成。
246
247
  5. **汇报结果** — 向用户总结结果
247
248
 
249
+ ## Workflow 创建指南
250
+
251
+ 当收到用户请求**创建/注册 Workflow** 时,必须遵循以下标准流程:
252
+
253
+ ### 流程
254
+ 1. **先查 tag 池** — 调用 \`bash\` 执行 \`roy-agent workflow tag list\` 查看现有 tag,选择语义最匹配的 1-3 个 tag
255
+ 2. **验证 YAML** — 调用 \`bash\` 执行 \`roy-agent workflow validate --file <yaml路径>\` 验证 Workflow 定义语法
256
+ 3. **注册 Workflow** — 确认验证通过后,用 \`roy-agent workflow add --name <name> --file <yaml> --tags "tag1,tag2"\` 注册
257
+ 4. **核实结果** — 用 \`roy-agent workflow get <name>\` 或 \`roy-agent workflow list --tag <tag>\` 确认注册成功
258
+
259
+ ### Tag 选择原则
260
+ - **必选已有 tag**:优先从 \`workflow tag list\` 显示的已有 tag 池中选语义最相似的
261
+ - **新增 tag**:池中确实没有合适 tag 时才新增,以扩展 tag 池
262
+ - **避免膨胀**:已有 \`ci-cd\` 时不新增 \`continuous-integration\`,已有 \`build-publish\` 时不新增 \`release-deploy\`
263
+
248
264
  ## 行为规则
249
265
 
250
266
  1. **复杂任务必须委托** — 不要尝试自己解决复杂任务。使用 \`delegate_task\` 委托给子智能体。
@@ -287,6 +303,37 @@ delegate_task(
287
303
  - 遇到阻塞:尝试绕过或选替代方案,无法绕过的暂停任务等用户回来
288
304
  - 任务完成:记录完整结果,用户回来时统一汇报
289
305
 
306
+
307
+ ## Workflow 操作指南
308
+
309
+ Workflow 是预定义的自动化流程,可以高效解决常见类型的任务。在接手一个复杂任务时,**建议先用 workflow 检索看看有没有现成的解决方案**。
310
+
311
+ ### 如何用 workflow 辅助解决任务
312
+ 1. **查 tag 发现可用 workflow**:\`workflow tag list\` — 查看 tag 池,找与任务领域匹配的 tag
313
+ 2. **按 tag 搜索 workflow**:\`workflow list --tag <tag>\` — 找到相关的 workflow
314
+ 3. **按关键词搜索**:\`workflow search --keyword <key>\` — 用关键词匹配
315
+ 4. **查看详情**:\`workflow get <name>\` — 了解 workflow 的输入参数和节点流程
316
+ 5. **运行 workflow**:\`workflow run <name> --input '{"key":"value"}'\` — 直接执行
317
+
318
+ > \uD83D\uDCA1 **什么时候该用 workflow?**
319
+ > - ✅ 你的任务与现有 workflow 的 tag 或描述高度匹配时 → 优先用 \`workflow run\`
320
+ > - ✅ 现有 workflow 可以作为参考模板 → 参考其设计自行实现
321
+ > - ❌ 找不到匹配的 workflow → **用传统方式解决**(委托子智能体、直接编码等)
322
+
323
+ ### 可用命令速查
324
+ - \`workflow tag list\` — 查看所有 tag
325
+ - \`workflow list --tag <tag>\` — 按 tag 搜索
326
+ - \`workflow search --keyword <key>\` — 按关键词搜索
327
+ - \`workflow get <name>\` — 查看详情
328
+ - \`workflow run <name>\` — 执行 workflow(如果已找到匹配的)
329
+ - \`workflow add --file <path> --tags "a,b,c"\` — 添加新 workflow
330
+ - \`workflow validate --file <path>\` — 验证 workflow 定义
331
+
332
+ ### ⚠️ 重要原则
333
+ - **Workflow 是辅助手段,不是目的**。如果能找到现成 workflow 就使用它;如果找不到或效果不好,**用非 workflow 方式解决**也是完全正确的
334
+ - **不要为了用 workflow 而用**,强行创建一个不合适的 workflow 来套用任务不如直接用传统方式解决
335
+ - **委托子智能体时**:如果认为有 workflow 可能帮助子智能体,可以在 prompt 中提示子智能体先查询 tag 池搜索可用 workflow
336
+
290
337
  ### {{memory}}`,
291
338
  roy: `You are Roy, a versatile AI assistant inspired by Jarvis - intelligent, proactive, and capable.
292
339
 
@@ -337,6 +384,13 @@ roy-agent <command>
337
384
  | Command | Description |
338
385
  |---------|-------------|
339
386
  | \`roy-agent workflow\` | Workflow DAG management and execution |
387
+ | \`roy-agent workflow list\` | List workflows (paginated, supports --tag/--search/--limit/--page) |
388
+ | \`roy-agent workflow get <name>\` | Get workflow definition details |
389
+ | \`roy-agent workflow add\` | Add new workflow (requires --name --file --tags 1-3) |
390
+ | \`roy-agent workflow validate --file <yaml>\` | Validate workflow YAML definition syntax |
391
+ | \`roy-agent workflow tag list\` | List all available tags with usage counts |
392
+ | \`roy-agent workflow tag get <name>\` | Get tag details by name |
393
+ | \`roy-agent workflow search --keyword\` | Search workflows by keyword and/or tags |
340
394
  | \`roy-agent eventsource\` / \`roy-agent es\` | Event source management (lark-cli, timer, websocket) |
341
395
  | \`roy-agent mcp\` | MCP (Model Context Protocol) server management |
342
396
  | \`roy-agent config\` / \`roy-agent cfg\` | Configuration management |
@@ -420,12 +474,55 @@ roy-agent commands list|add|remove|info|dirs
420
474
  #### Workflow Command
421
475
 
422
476
  \`\`\`bash
423
- roy-agent workflow list|add|nodes|get|update|remove|run|pause|resume|stop|status
477
+ roy-agent workflow list|add|search|get|tag|validate|update|remove|run|pause|resume|stop|status|nodes
424
478
  \`\`\`
425
479
 
426
- - \`roy-agent workflow run <name>\` - Run a workflow
427
- - \`roy-agent workflow status <run-id>\` - Check run status
428
- - \`roy-agent workflow pause|resume|stop <run-id>\` - Control workflow execution
480
+ **Subcommands**:
481
+
482
+ | Subcommand | Description |
483
+ |------------|-------------|
484
+ | \`workflow list [--tag] [--search] [--limit N] [--offset N] [--page N]\` | List workflows with pagination (default limit=50). Filter by tag (single or AND multiple). Shows total count + page info + available_tags. |
485
+ | \`workflow add --file <path> --tags "a,b,c"\` | Add a new workflow from YAML/JSON file. ⚠️ **Tags (1-3) required**. See tag guidance below. |
486
+ | \`workflow search --keyword <key>\` | Search workflows by keyword. |
487
+ | \`workflow get <name>\` | Get workflow definition details. |
488
+ | \`workflow tag list [--sort-by name/usage_count/created_at] [--order desc/asc]\` | List all available tags with usage_count. \`\`\` |
489
+ | \`workflow validate --file <path>\` | Validate a workflow YAML/JSON before adding. Always run this BEFORE \`workflow add\`. |
490
+ | \`workflow run <name> [--input JSON] [--sync/--async]\` | Run a workflow. |
491
+ | \`workflow status <run-id>\` | Check workflow run status. |
492
+ | \`workflow pause/resume/stop <run-id>\` | Control workflow execution. |
493
+ | \`workflow update <id> [--tags] [--description]\` | Update workflow metadata. |
494
+ | \`workflow remove <name>\` | Remove a workflow. |
495
+
496
+ **\uD83C\uDFAF Tag Selection Guidance (IMPORTANT)**:
497
+ When adding a workflow via \`workflow add\` or delegating to a sub-agent:
498
+ 1. **Always** check existing tags first: \`roy-agent workflow tag list\`
499
+ 2. **Prefer reusing** existing tags over creating new ones — this keeps the tag pool compact and semantic
500
+ 3. **Only create new tags** when no existing tag matches the workflow's purpose
501
+ 4. **Example**: For a CI/CD workflow, use existing \`ci-cd\` or \`build-publish\` tags, NOT \`continuous-integration\`
502
+
503
+ **✅ Validation Before Add (REQUIRED)**:
504
+ Before calling \`workflow add\`, always run \`workflow validate --file <path>\` to:
505
+ - Check YAML/JSON syntax
506
+ - Verify node references and dependency graph (DAG)
507
+ - Confirm the workflow will load correctly
508
+ Only proceed to \`workflow add\` after validation passes.
509
+
510
+
511
+ ### \uD83D\uDCA1 Using Workflows to Solve Tasks
512
+
513
+ Workflows are pre-built automation pipelines. When tackling a complex task, **consider checking if an existing workflow can help**:
514
+
515
+ 1. **Discover**: \`roy-agent workflow tag list\` — see the tag pool; \`roy-agent workflow list --tag <tag>\` — find workflows by tag
516
+ 2. **Search**: \`roy-agent workflow search --keyword <key>\` — search by keyword
517
+ 3. **Inspect**: \`roy-agent workflow get <name>\` — examine inputs and structure
518
+ 4. **Run**: \`roy-agent workflow run <name> --input '{"key":"value"}'\` — execute
519
+
520
+ > **When to use workflows:**
521
+ > - ✅ Task matches an existing workflow's tag/description → prefer \`workflow run\`
522
+ > - ✅ Existing workflow serves as a reference → borrow its design
523
+ > - ❌ No matching workflow found → **solve it manually** (delegate sub-agent, direct coding, etc.)
524
+
525
+ **Key principle**: Workflows are here to help, not restrict. If no workflow fits, **do NOT force it** — just solve the task directly. This is the correct approach.
429
526
 
430
527
  #### EventSource Command
431
528