@ai-setting/roy-agent-core 1.7.59 → 1.7.61
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/config/index.js +8 -8
- package/dist/env/agent/index.js +14 -14
- package/dist/env/commands/index.js +8 -8
- package/dist/env/context/index.js +4 -4
- package/dist/env/debug/index.js +8 -8
- package/dist/env/event-source/cli-command-handler.d.ts +90 -0
- package/dist/env/event-source/event-source-handlers.d.ts +1 -0
- package/dist/env/event-source/index.d.ts +3 -1
- package/dist/env/event-source/index.js +30 -20
- package/dist/env/event-source/types.d.ts +21 -1
- package/dist/env/hook/index.js +6 -6
- package/dist/env/index.js +46 -46
- package/dist/env/llm/index.js +9 -9
- package/dist/env/log-trace/index.d.ts +1 -1
- package/dist/env/log-trace/index.js +12 -8
- package/dist/env/log-trace/logger.d.ts +2 -0
- package/dist/env/mcp/index.js +9 -9
- package/dist/env/mcp/tool/index.js +2 -2
- package/dist/env/memory/index.js +9 -9
- package/dist/env/memory/plugin/index.js +2 -2
- package/dist/env/plugin/index.js +8 -8
- package/dist/env/prompt/index.js +8 -8
- package/dist/env/session/index.js +11 -11
- package/dist/env/session/storage/index.js +5 -5
- package/dist/env/skill/index.js +8 -8
- package/dist/env/task/delegate/index.js +9 -9
- package/dist/env/task/index.js +16 -16
- package/dist/env/task/mcp/index.d.ts +16 -0
- package/dist/env/task/mcp/index.js +222 -0
- package/dist/env/task/mcp/task-mcp-server.d.ts +142 -0
- package/dist/env/task/plugins/index.d.ts +1 -0
- package/dist/env/task/plugins/index.js +47 -12
- package/dist/env/task/storage/index.js +4 -4
- package/dist/env/task/storage/migrations/log-migration.d.ts +19 -0
- package/dist/env/task/storage/sqlite-task-store.d.ts +29 -0
- package/dist/env/task/task-component.d.ts +48 -3
- package/dist/env/task/tools/index.js +4 -4
- package/dist/env/task/tools/task-types.d.ts +60 -11
- package/dist/env/tool/built-in/index.js +4 -4
- package/dist/env/tool/index.js +11 -11
- package/dist/env/workflow/engine/index.js +13 -13
- package/dist/env/workflow/hooks/index.js +8 -8
- package/dist/env/workflow/index.js +23 -23
- package/dist/env/workflow/nodes/index.js +3 -3
- package/dist/env/workflow/plugins/index.js +9 -9
- package/dist/env/workflow/service/index.js +3 -3
- package/dist/env/workflow/storage/index.js +4 -4
- package/dist/env/workflow/tools/index.js +15 -15
- package/dist/env/workflow/tools/run-workflow.d.ts +30 -0
- package/dist/env/workflow/utils/index.js +5 -5
- package/dist/env/workflow/utils/session-recovery.d.ts +27 -0
- package/dist/index.js +81 -71
- package/dist/shared/@ai-setting/{roy-agent-core-tze5596n.js → roy-agent-core-0f989bnp.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-e250355z.js → roy-agent-core-22r4zmkw.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-8p63s836.js → roy-agent-core-2qkrpc7m.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-47s81t6g.js → roy-agent-core-3bpntd80.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-rcgvmtms.js → roy-agent-core-3p59ap0x.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-en2xqxs9.js → roy-agent-core-4m5spt7m.js} +39 -14
- package/dist/shared/@ai-setting/{roy-agent-core-5f7myqnb.js → roy-agent-core-5565cvw8.js} +11 -5
- package/dist/shared/@ai-setting/{roy-agent-core-2fk8c9ax.js → roy-agent-core-5knpegzr.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-08njdcpj.js → roy-agent-core-60p2380d.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0yn7a78e.js → roy-agent-core-6cyjps72.js} +14 -14
- package/dist/shared/@ai-setting/{roy-agent-core-89sxsrc7.js → roy-agent-core-8fy467qs.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-x6c45yqd.js → roy-agent-core-99nwgj84.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-20m8je6e.js → roy-agent-core-9k8ms63r.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0kn3zt1t.js → roy-agent-core-9s3payp1.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-hefarcp0.js → roy-agent-core-a5nh5q6v.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hs41gx9w.js → roy-agent-core-aa514zm8.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-yphwdm9x.js → roy-agent-core-ajmgyawx.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-caevk7xd.js → roy-agent-core-arx535cs.js} +30 -8
- package/dist/shared/@ai-setting/{roy-agent-core-vath15kt.js → roy-agent-core-bc3v8pw4.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-m97jn2ra.js → roy-agent-core-bdzdw1g3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ck60j1q9.js → roy-agent-core-bxkjk7zx.js} +2 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6bradb0j.js → roy-agent-core-cndvj1hv.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-d75t8gea.js → roy-agent-core-dg286rpd.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-q4gdfypk.js → roy-agent-core-dp1hp24k.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-ygn5tzt1.js → roy-agent-core-dythsgkn.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-em4hks9t.js → roy-agent-core-e6k448ka.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-ytd5eztz.js → roy-agent-core-expvav8a.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vgdhxbx3.js → roy-agent-core-g44nbgtt.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-14bq77wr.js → roy-agent-core-g5sw19fa.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-991pk4ss.js → roy-agent-core-gtb4fj8j.js} +16 -16
- package/dist/shared/@ai-setting/{roy-agent-core-gksw1gjb.js → roy-agent-core-hf0t8agb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-txwptxk1.js → roy-agent-core-j0x9yf96.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-84rs0c8d.js → roy-agent-core-jrksyqb6.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-ge87xbas.js → roy-agent-core-jsdqzfbj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-m68z3pw1.js → roy-agent-core-jsn21cb9.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-n0p0hwgd.js → roy-agent-core-kfmrfaft.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7q4wdze2.js → roy-agent-core-khc23qs1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-e1w17tht.js → roy-agent-core-m2tv4pj0.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-4096f575.js → roy-agent-core-mhppywse.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-t64nmayv.js → roy-agent-core-mw0bc9g6.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-8bngppw0.js → roy-agent-core-n1ck0x1r.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-w93z6a42.js → roy-agent-core-nd5171pv.js} +12 -12
- package/dist/shared/@ai-setting/{roy-agent-core-geh6j7bw.js → roy-agent-core-p2dpcyrz.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fw6k4w1h.js → roy-agent-core-pj5tfmn5.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-029r8kdw.js → roy-agent-core-q212q0w1.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-psg6f1v6.js → roy-agent-core-qgapy83x.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-jjxdmedn.js → roy-agent-core-qpqqx1wd.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-syyw58p9.js → roy-agent-core-qrjs2500.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-84xtww7d.js → roy-agent-core-qw5fpa24.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-kq9pz2a7.js → roy-agent-core-rnzm0tpf.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-7nb23tdd.js → roy-agent-core-s7w47mnn.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-t4x089js.js → roy-agent-core-sf9tsj0g.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jjhw9am6.js → roy-agent-core-tn96n4wz.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-c7w2h47a.js → roy-agent-core-vmfk4m1v.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-cyefe8z5.js → roy-agent-core-x1m0gs0q.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-baaa4wtp.js → roy-agent-core-xc0es9zc.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fbjd7bt6.js → roy-agent-core-xeqp659x.js} +64 -29
- package/dist/shared/@ai-setting/{roy-agent-core-rt115qfc.js → roy-agent-core-y0k9kaxz.js} +14 -4
- package/dist/shared/@ai-setting/{roy-agent-core-c36335nw.js → roy-agent-core-yd85623y.js} +15 -3
- package/dist/shared/@ai-setting/{roy-agent-core-9zhkdg6w.js → roy-agent-core-ygfjgk9b.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-vh0qzb24.js → roy-agent-core-ymcvsdzn.js} +36 -15
- package/dist/shared/@ai-setting/{roy-agent-core-eanq305k.js → roy-agent-core-yr5eqyhz.js} +11 -11
- package/dist/shared/@ai-setting/{roy-agent-core-6q5m1qk5.js → roy-agent-core-ytnedzks.js} +239 -90
- package/dist/shared/@ai-setting/{roy-agent-core-2ctyjy62.js → roy-agent-core-z51jktet.js} +1 -1
- package/dist/utils/temp-file-manager/index.js +2 -2
- package/package.json +16 -1
- /package/dist/shared/@ai-setting/{roy-agent-core-3ztzc83c.js → roy-agent-core-5enxfga2.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TracedAs,
|
|
3
3
|
init_decorator
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-2qkrpc7m.js";
|
|
5
5
|
import {
|
|
6
6
|
createLogger,
|
|
7
7
|
init_logger
|
|
8
|
-
} from "./roy-agent-core-
|
|
8
|
+
} from "./roy-agent-core-y0k9kaxz.js";
|
|
9
9
|
import {
|
|
10
10
|
__esm,
|
|
11
11
|
__export,
|
|
@@ -14,42 +14,50 @@ import {
|
|
|
14
14
|
__toCommonJS
|
|
15
15
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
16
16
|
|
|
17
|
+
// src/env/task/storage/migrations/log-migration.ts
|
|
18
|
+
function logMigration(message) {
|
|
19
|
+
process.stderr.write(`${message}
|
|
20
|
+
`);
|
|
21
|
+
}
|
|
22
|
+
var init_log_migration = () => {};
|
|
23
|
+
|
|
17
24
|
// src/env/task/storage/migrations/001_add_project_path_context.ts
|
|
18
25
|
var exports_001_add_project_path_context = {};
|
|
19
26
|
__export(exports_001_add_project_path_context, {
|
|
20
27
|
runMigration: () => runMigration
|
|
21
28
|
});
|
|
22
29
|
function runMigration(dbPath) {
|
|
23
|
-
|
|
30
|
+
logMigration(`[Migration 001] Starting migration for: ${dbPath}`);
|
|
24
31
|
const db = createCompatibleDatabase(dbPath);
|
|
25
32
|
try {
|
|
26
33
|
try {
|
|
27
34
|
db.run(`ALTER TABLE task ADD COLUMN project_path TEXT`);
|
|
28
|
-
|
|
35
|
+
logMigration(`[Migration 001] Added project_path column`);
|
|
29
36
|
} catch (e) {
|
|
30
37
|
if (e.message?.includes("duplicate column name")) {
|
|
31
|
-
|
|
38
|
+
logMigration(`[Migration 001] project_path column already exists, skipping`);
|
|
32
39
|
} else {
|
|
33
40
|
throw e;
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
43
|
try {
|
|
37
44
|
db.run(`ALTER TABLE task ADD COLUMN context TEXT`);
|
|
38
|
-
|
|
45
|
+
logMigration(`[Migration 001] Added context column`);
|
|
39
46
|
} catch (e) {
|
|
40
47
|
if (e.message?.includes("duplicate column name")) {
|
|
41
|
-
|
|
48
|
+
logMigration(`[Migration 001] context column already exists, skipping`);
|
|
42
49
|
} else {
|
|
43
50
|
throw e;
|
|
44
51
|
}
|
|
45
52
|
}
|
|
46
|
-
|
|
53
|
+
logMigration(`[Migration 001] Migration completed successfully`);
|
|
47
54
|
} finally {
|
|
48
55
|
db.close();
|
|
49
56
|
}
|
|
50
57
|
}
|
|
51
58
|
var init_001_add_project_path_context = __esm(() => {
|
|
52
59
|
init_sqlite_task_store();
|
|
60
|
+
init_log_migration();
|
|
53
61
|
if (false) {}
|
|
54
62
|
});
|
|
55
63
|
|
|
@@ -59,26 +67,27 @@ __export(exports_002_add_task_type, {
|
|
|
59
67
|
runMigration: () => runMigration2
|
|
60
68
|
});
|
|
61
69
|
function runMigration2(dbPath) {
|
|
62
|
-
|
|
70
|
+
logMigration(`[Migration 002] Starting migration for: ${dbPath}`);
|
|
63
71
|
const db = createCompatibleDatabase(dbPath);
|
|
64
72
|
try {
|
|
65
73
|
try {
|
|
66
74
|
db.run(`ALTER TABLE task ADD COLUMN type TEXT NOT NULL DEFAULT 'normal'`);
|
|
67
|
-
|
|
75
|
+
logMigration(`[Migration 002] Added type column`);
|
|
68
76
|
} catch (e) {
|
|
69
77
|
if (e.message?.includes("duplicate column name")) {
|
|
70
|
-
|
|
78
|
+
logMigration(`[Migration 002] type column already exists, skipping`);
|
|
71
79
|
} else {
|
|
72
80
|
throw e;
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
|
-
|
|
83
|
+
logMigration(`[Migration 002] Migration completed successfully`);
|
|
76
84
|
} finally {
|
|
77
85
|
db.close();
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
var init_002_add_task_type = __esm(() => {
|
|
81
89
|
init_sqlite_task_store();
|
|
90
|
+
init_log_migration();
|
|
82
91
|
if (false) {}
|
|
83
92
|
});
|
|
84
93
|
|
|
@@ -88,26 +97,27 @@ __export(exports_003_add_process_description, {
|
|
|
88
97
|
runMigration: () => runMigration3
|
|
89
98
|
});
|
|
90
99
|
function runMigration3(dbPath) {
|
|
91
|
-
|
|
100
|
+
logMigration(`[Migration 003] Starting migration for: ${dbPath}`);
|
|
92
101
|
const db = createCompatibleDatabase(dbPath);
|
|
93
102
|
try {
|
|
94
103
|
try {
|
|
95
104
|
db.run(`ALTER TABLE task_operation ADD COLUMN process_description TEXT NOT NULL DEFAULT ''`);
|
|
96
|
-
|
|
105
|
+
logMigration(`[Migration 003] Added process_description column`);
|
|
97
106
|
} catch (e) {
|
|
98
107
|
if (e.message?.includes("duplicate column name")) {
|
|
99
|
-
|
|
108
|
+
logMigration(`[Migration 003] process_description column already exists, skipping`);
|
|
100
109
|
} else {
|
|
101
110
|
throw e;
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
|
-
|
|
113
|
+
logMigration(`[Migration 003] Migration completed successfully`);
|
|
105
114
|
} finally {
|
|
106
115
|
db.close();
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
118
|
var init_003_add_process_description = __esm(() => {
|
|
110
119
|
init_sqlite_task_store();
|
|
120
|
+
init_log_migration();
|
|
111
121
|
if (false) {}
|
|
112
122
|
});
|
|
113
123
|
|
|
@@ -117,7 +127,7 @@ __export(exports_004_rename_action_to_milestone, {
|
|
|
117
127
|
runMigration: () => runMigration4
|
|
118
128
|
});
|
|
119
129
|
function runMigration4(dbPath) {
|
|
120
|
-
|
|
130
|
+
logMigration(`[Migration 004] Starting migration for: ${dbPath}`);
|
|
121
131
|
const db = createCompatibleDatabase(dbPath);
|
|
122
132
|
try {
|
|
123
133
|
const existingColumns = new Set;
|
|
@@ -129,14 +139,14 @@ function runMigration4(dbPath) {
|
|
|
129
139
|
const hasNew = existingColumns.has(newName);
|
|
130
140
|
if (hasOld && !hasNew) {
|
|
131
141
|
db.run(`ALTER TABLE task_operation RENAME COLUMN ${oldName} TO ${newName}`);
|
|
132
|
-
|
|
142
|
+
logMigration(`[Migration 004] Renamed ${oldName} -> ${newName}`);
|
|
133
143
|
} else if (hasNew) {
|
|
134
|
-
|
|
144
|
+
logMigration(`[Migration 004] ${newName} already exists, skipping rename of ${oldName}`);
|
|
135
145
|
} else {
|
|
136
|
-
|
|
146
|
+
logMigration(`[Migration 004] ${oldName} not present, skipping rename to ${newName}`);
|
|
137
147
|
}
|
|
138
148
|
}
|
|
139
|
-
|
|
149
|
+
logMigration(`[Migration 004] Migration completed successfully`);
|
|
140
150
|
} finally {
|
|
141
151
|
db.close();
|
|
142
152
|
}
|
|
@@ -144,6 +154,7 @@ function runMigration4(dbPath) {
|
|
|
144
154
|
var RENAME_MAP;
|
|
145
155
|
var init_004_rename_action_to_milestone = __esm(() => {
|
|
146
156
|
init_sqlite_task_store();
|
|
157
|
+
init_log_migration();
|
|
147
158
|
RENAME_MAP = [
|
|
148
159
|
{ oldName: "action_type", newName: "milestone_type" },
|
|
149
160
|
{ oldName: "action_title", newName: "milestone_title" },
|
|
@@ -158,7 +169,7 @@ __export(exports_005_convert_blob_description_to_text, {
|
|
|
158
169
|
runMigration: () => runMigration5
|
|
159
170
|
});
|
|
160
171
|
function runMigration5(dbPath) {
|
|
161
|
-
|
|
172
|
+
logMigration(`[Migration 005] Starting migration for: ${dbPath}`);
|
|
162
173
|
const db = createCompatibleDatabase(dbPath);
|
|
163
174
|
const result = {
|
|
164
175
|
blobCountBefore: 0,
|
|
@@ -168,21 +179,21 @@ function runMigration5(dbPath) {
|
|
|
168
179
|
try {
|
|
169
180
|
const tableCheck = db.query("SELECT name FROM sqlite_master WHERE type='table' AND name='task'").all();
|
|
170
181
|
if (tableCheck.length === 0) {
|
|
171
|
-
|
|
182
|
+
logMigration(`[Migration 005] task table does not exist, skipping`);
|
|
172
183
|
return result;
|
|
173
184
|
}
|
|
174
185
|
const beforeRows = db.query("SELECT COUNT(*) as cnt FROM task WHERE typeof(description) = 'blob'").all();
|
|
175
186
|
result.blobCountBefore = beforeRows[0]?.cnt ?? 0;
|
|
176
187
|
if (result.blobCountBefore === 0) {
|
|
177
|
-
|
|
188
|
+
logMigration(`[Migration 005] No BLOB descriptions found, no action needed`);
|
|
178
189
|
return result;
|
|
179
190
|
}
|
|
180
191
|
db.run("UPDATE task SET description = CAST(description AS TEXT) WHERE typeof(description) = 'blob'");
|
|
181
192
|
result.ran = true;
|
|
182
193
|
const afterRows = db.query("SELECT COUNT(*) as cnt FROM task WHERE typeof(description) = 'blob'").all();
|
|
183
194
|
result.blobCountAfter = afterRows[0]?.cnt ?? 0;
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
logMigration(`[Migration 005] Converted ${result.blobCountBefore - result.blobCountAfter} BLOB description(s) to TEXT`);
|
|
196
|
+
logMigration(`[Migration 005] Migration completed successfully`);
|
|
186
197
|
} finally {
|
|
187
198
|
db.close();
|
|
188
199
|
}
|
|
@@ -190,6 +201,7 @@ function runMigration5(dbPath) {
|
|
|
190
201
|
}
|
|
191
202
|
var init_005_convert_blob_description_to_text = __esm(() => {
|
|
192
203
|
init_sqlite_task_store();
|
|
204
|
+
init_log_migration();
|
|
193
205
|
if (false) {}
|
|
194
206
|
});
|
|
195
207
|
|
|
@@ -199,13 +211,20 @@ function getDatabaseClass() {
|
|
|
199
211
|
if (typeof Bun !== "undefined") {
|
|
200
212
|
const { Database } = __require("bun:sqlite");
|
|
201
213
|
return Database;
|
|
202
|
-
} else {
|
|
203
|
-
return __require("better-sqlite3");
|
|
204
214
|
}
|
|
215
|
+
try {
|
|
216
|
+
const { DatabaseSync } = __require("node:sqlite");
|
|
217
|
+
if (typeof DatabaseSync === "function") {
|
|
218
|
+
return DatabaseSync;
|
|
219
|
+
}
|
|
220
|
+
} catch {}
|
|
221
|
+
return __require("better-sqlite3");
|
|
205
222
|
}
|
|
206
223
|
function createCompatibleDatabase(path) {
|
|
207
224
|
const Database = getDatabaseClass();
|
|
208
|
-
|
|
225
|
+
return createCompatibleDatabaseFrom(new Database(path));
|
|
226
|
+
}
|
|
227
|
+
function createCompatibleDatabaseFrom(db) {
|
|
209
228
|
if (typeof db.run !== "function") {
|
|
210
229
|
db.run = function(sql, ...params) {
|
|
211
230
|
if (params.length > 0) {
|
|
@@ -215,6 +234,22 @@ function createCompatibleDatabase(path) {
|
|
|
215
234
|
}
|
|
216
235
|
};
|
|
217
236
|
}
|
|
237
|
+
db.query = function(sql, ...params) {
|
|
238
|
+
if (params.length === 0) {
|
|
239
|
+
const stmt2 = this.prepare(sql);
|
|
240
|
+
return {
|
|
241
|
+
all: () => stmt2.all(),
|
|
242
|
+
get: () => stmt2.get(),
|
|
243
|
+
run: () => stmt2.run()
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const stmt = this.prepare(sql);
|
|
247
|
+
return {
|
|
248
|
+
all: (...extra) => stmt.all(...params, ...extra),
|
|
249
|
+
get: (...extra) => stmt.get(...params, ...extra),
|
|
250
|
+
run: (...extra) => stmt.run(...params, ...extra)
|
|
251
|
+
};
|
|
252
|
+
};
|
|
218
253
|
return db;
|
|
219
254
|
}
|
|
220
255
|
function getDefaultDataDir() {
|
|
@@ -139,6 +139,12 @@ function isQuietMode() {
|
|
|
139
139
|
function setQuietMode(enabled) {
|
|
140
140
|
quietMode = enabled;
|
|
141
141
|
}
|
|
142
|
+
function isStdoutStrictMode() {
|
|
143
|
+
return stdoutStrictMode;
|
|
144
|
+
}
|
|
145
|
+
function setStdoutStrictMode(enabled) {
|
|
146
|
+
stdoutStrictMode = enabled;
|
|
147
|
+
}
|
|
142
148
|
function setConfigComponent(component) {
|
|
143
149
|
configComponentInstance = component;
|
|
144
150
|
}
|
|
@@ -339,8 +345,12 @@ class Logger {
|
|
|
339
345
|
const formatted = this.formatMessage(level, message, data);
|
|
340
346
|
this.writeToFile(formatted);
|
|
341
347
|
if (!isQuietMode()) {
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
if (stdoutStrictMode) {
|
|
349
|
+
console.error(formatted);
|
|
350
|
+
} else {
|
|
351
|
+
const consoleMethod = level === "error" ? console.error : level === "warn" ? console.warn : level === "info" ? console.log : console.debug;
|
|
352
|
+
consoleMethod(formatted);
|
|
353
|
+
}
|
|
344
354
|
}
|
|
345
355
|
}
|
|
346
356
|
debug(message, data) {
|
|
@@ -365,7 +375,7 @@ function createLogger(prefix) {
|
|
|
365
375
|
function getLogLevels() {
|
|
366
376
|
return ["debug", "info", "warn", "error"];
|
|
367
377
|
}
|
|
368
|
-
var configComponentInstance = null, quietMode = false, logDirOverride, levelPriority, loggerCache;
|
|
378
|
+
var configComponentInstance = null, quietMode = false, stdoutStrictMode = false, logDirOverride, levelPriority, loggerCache;
|
|
369
379
|
var init_logger = __esm(() => {
|
|
370
380
|
init_tracer_provider();
|
|
371
381
|
levelPriority = {
|
|
@@ -806,4 +816,4 @@ var init_tracer_provider = __esm(() => {
|
|
|
806
816
|
init_logger();
|
|
807
817
|
});
|
|
808
818
|
|
|
809
|
-
export { serialize, parse, propagation, init_propagation, SpanKind, SpanStatus, init_types, OTelTracerProvider, getTracerProvider, resetTracerProvider, setTracerProvider, exports_tracer_provider, init_tracer_provider, simplifyFilePath, isQuietMode, setQuietMode, setConfigComponent, getLogLevel, getLogFile, getLogDir, getMaxOutput, setLogDirOverride, getLogDirOverride, createLogger, getLogLevels, init_logger };
|
|
819
|
+
export { serialize, parse, propagation, init_propagation, SpanKind, SpanStatus, init_types, OTelTracerProvider, getTracerProvider, resetTracerProvider, setTracerProvider, exports_tracer_provider, init_tracer_provider, simplifyFilePath, isQuietMode, setQuietMode, isStdoutStrictMode, setStdoutStrictMode, setConfigComponent, getLogLevel, getLogFile, getLogDir, getMaxOutput, setLogDirOverride, getLogDirOverride, createLogger, getLogLevels, init_logger };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TracedAs,
|
|
3
3
|
init_decorator
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-2qkrpc7m.js";
|
|
5
5
|
import {
|
|
6
6
|
createLogger,
|
|
7
7
|
init_logger
|
|
8
|
-
} from "./roy-agent-core-
|
|
8
|
+
} from "./roy-agent-core-y0k9kaxz.js";
|
|
9
9
|
import {
|
|
10
10
|
__legacyDecorateClassTS
|
|
11
11
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -88,6 +88,18 @@ function renderProgressBar(progress) {
|
|
|
88
88
|
const bar = "▓".repeat(filled) + "░".repeat(PROGRESS_BAR_CELLS - filled);
|
|
89
89
|
return `${bar} ${Math.round(clamped)}%`;
|
|
90
90
|
}
|
|
91
|
+
function resolveTaskTitleForDisplay(opts) {
|
|
92
|
+
if (opts.taskTitle && opts.taskTitle.trim().length > 0) {
|
|
93
|
+
return opts.taskTitle;
|
|
94
|
+
}
|
|
95
|
+
if (opts.taskId !== undefined && opts.title) {
|
|
96
|
+
return `#${opts.taskId} ${opts.title}`;
|
|
97
|
+
}
|
|
98
|
+
if (opts.taskId !== undefined) {
|
|
99
|
+
return `#${opts.taskId}`;
|
|
100
|
+
}
|
|
101
|
+
return "Task";
|
|
102
|
+
}
|
|
91
103
|
function humanizeValue(value, maxLen = 200) {
|
|
92
104
|
const truncate = (t) => t.length <= maxLen ? t : `${t.slice(0, maxLen)}…`;
|
|
93
105
|
if (value === null || value === undefined)
|
|
@@ -1155,4 +1167,4 @@ function sanitize(text) {
|
|
|
1155
1167
|
return `${trimmed.slice(0, 500)}…`;
|
|
1156
1168
|
}
|
|
1157
1169
|
|
|
1158
|
-
export { humanizeValue, buildTaskCard, formatDurationMs, LarkCardPatchNotifier };
|
|
1170
|
+
export { formatTimestampForDisplay, sanitizeInlineText, formatDateTimeForDisplay, renderProgressBar, resolveTaskTitleForDisplay, humanizeValue, renderTaskInfoLines, renderContextAsLines, renderMilestones, renderProcessSteps, buildTaskCard, buildChatAppLink, DEFAULT_APP_LINK_BASE, formatDurationMs, renderWorkflowInfoLines, buildWorkflowCard, LarkCardPatchNotifier };
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
TracedAs,
|
|
6
6
|
init_decorator
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-2qkrpc7m.js";
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-y0k9kaxz.js";
|
|
12
12
|
import {
|
|
13
13
|
__legacyDecorateClassTS
|
|
14
14
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -2,14 +2,33 @@ import {
|
|
|
2
2
|
getEnvContextOrEmpty,
|
|
3
3
|
init_env_context,
|
|
4
4
|
setCurrentTaskId
|
|
5
|
-
} from "./roy-agent-core-
|
|
5
|
+
} from "./roy-agent-core-qrjs2500.js";
|
|
6
6
|
import {
|
|
7
7
|
createLogger,
|
|
8
8
|
init_logger
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-y0k9kaxz.js";
|
|
10
10
|
|
|
11
11
|
// src/env/task/tools/task-types.ts
|
|
12
12
|
import { z } from "zod";
|
|
13
|
+
var UNKNOWN_PROJECT_PATH = "unknown";
|
|
14
|
+
var UNKNOWN_TASK_CONTEXT = '{"type":"unknown"}';
|
|
15
|
+
function taskIdShape() {
|
|
16
|
+
return {
|
|
17
|
+
task_id: z.number().describe("Task ID")
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function normaliseLegacyTaskId(raw) {
|
|
21
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
22
|
+
return raw;
|
|
23
|
+
const obj = raw;
|
|
24
|
+
if (obj.task_id === undefined && obj.id !== undefined) {
|
|
25
|
+
return { ...obj, task_id: obj.id };
|
|
26
|
+
}
|
|
27
|
+
return obj;
|
|
28
|
+
}
|
|
29
|
+
function withLegacyTaskId(shape) {
|
|
30
|
+
return z.preprocess(normaliseLegacyTaskId, z.object({ ...taskIdShape(), ...shape }));
|
|
31
|
+
}
|
|
13
32
|
var CreateTaskToolSchema = z.object({
|
|
14
33
|
title: z.string().describe("Task title"),
|
|
15
34
|
description: z.string().optional().describe("Task description"),
|
|
@@ -18,7 +37,7 @@ var CreateTaskToolSchema = z.object({
|
|
|
18
37
|
goals_and_expected_deliverables: z.string().optional().describe("Goals and expected deliverables"),
|
|
19
38
|
due_date: z.string().optional().describe("Due date (ISO format)"),
|
|
20
39
|
tags: z.array(z.string()).optional().describe("Task tags (for search, stored in task.tags JSON field)"),
|
|
21
|
-
project_path: z.string().describe("Project root path for task positioning. " + "Used to locate the project space for this task. " + "Use 'unknown' if unknown."),
|
|
40
|
+
project_path: z.string().default("unknown").describe("Project root path for task positioning. " + "Used to locate the project space for this task. " + "Use 'unknown' if unknown. (Defaults to 'unknown'.)"),
|
|
22
41
|
parent_task_id: z.union([z.number(), z.null()]).optional().describe(`父任务 ID(可选)。不传或传 null 时,创建根任务(root task)。
|
|
23
42
|
` + `如需将任务挂载到某个父任务下,传入对应父任务 ID。
|
|
24
43
|
` + `**调用前必须先调用 task_tree(depth=2)** 查看现有任务树结构,避免重复创建根任务、避免孤儿任务。
|
|
@@ -28,11 +47,10 @@ var CreateTaskToolSchema = z.object({
|
|
|
28
47
|
` + ` C. 新建根任务 → 省略 parent_task_id(让树根 ≤10)
|
|
29
48
|
` + `如何找到 parent_task_id:使用 task_tree(depth=2) 获取的树形结构,
|
|
30
49
|
` + "根据节点 id 选择合适的父任务 ID(来自 tree 输出,**不要硬编码**数字)。"),
|
|
31
|
-
context: z.string().describe("JSON string with time-space positioning information for task continuity. " + "This field is crucial for Agent task handoff. " + "Core fields: worktree_path (git worktree path), branch (current branch), type (feature/bug/refactor/chore). " + 'Example for coding: {"worktree_path": "/path/worktree", "branch": "feature/xyz", "type": "feature"}. ' + 'Example for other: {"type": "general"}. ' + `If unknown, use '{}' or '{"type":"unknown"}'. ` + "IMPORTANT: Must be a valid JSON string!")
|
|
50
|
+
context: z.string().default('{"type":"unknown"}').describe("JSON string with time-space positioning information for task continuity. " + "This field is crucial for Agent task handoff. " + "Core fields: worktree_path (git worktree path), branch (current branch), type (feature/bug/refactor/chore). " + 'Example for coding: {"worktree_path": "/path/worktree", "branch": "feature/xyz", "type": "feature"}. ' + 'Example for other: {"type": "general"}. ' + `If unknown, use '{}' or '{"type":"unknown"}'. ` + "IMPORTANT: Must be a valid JSON string!")
|
|
32
51
|
});
|
|
33
|
-
var GetTaskToolSchema =
|
|
34
|
-
|
|
35
|
-
include_operations: z.boolean().optional().default(false).describe("Include operation records")
|
|
52
|
+
var GetTaskToolSchema = withLegacyTaskId({
|
|
53
|
+
include_operations: z.boolean().optional().default(true).describe("Include operation records (milestones / process log) with the task. " + "Defaults to true — the task's operation history is part of its detail. " + "Pass false for a lean task-only response.")
|
|
36
54
|
});
|
|
37
55
|
var ListTasksToolSchema = z.object({
|
|
38
56
|
status: z.enum(["todo", "active", "completed", "paused", "cancelled", "archived"]).optional(),
|
|
@@ -54,8 +72,7 @@ var SearchTasksToolSchema = z.object({
|
|
|
54
72
|
depth: z.number().optional().describe("检索层级深度:0=只根任务,1=根+一层子任务,2=根+二层子任务,-1 或忽略=全部"),
|
|
55
73
|
include_archived: z.boolean().optional().default(false).describe("是否包含已归档任务(status=archived 的任务默认被排除)")
|
|
56
74
|
});
|
|
57
|
-
var UpdateTaskToolSchema =
|
|
58
|
-
task_id: z.number().describe("Task ID"),
|
|
75
|
+
var UpdateTaskToolSchema = withLegacyTaskId({
|
|
59
76
|
title: z.string().optional(),
|
|
60
77
|
description: z.string().optional(),
|
|
61
78
|
status: z.enum(["todo", "active", "completed", "paused", "cancelled", "archived"]).optional(),
|
|
@@ -73,8 +90,7 @@ var UpdateTaskToolSchema = z.object({
|
|
|
73
90
|
var DeleteTaskToolSchema = z.object({
|
|
74
91
|
task_id: z.number().describe("Task ID")
|
|
75
92
|
});
|
|
76
|
-
var CompleteTaskToolSchema =
|
|
77
|
-
task_id: z.number().describe("Task ID"),
|
|
93
|
+
var CompleteTaskToolSchema = withLegacyTaskId({
|
|
78
94
|
deliverable_storage_path: z.string().optional().describe("交付物的寻址地址(路径 / URL / 分支名等)。" + "调用本工具前,请先读取任务的 goal(description)和 delivery(goals_and_expected_deliverables)栏位," + "建议验证目标和交付物是否符合预期,然后将实际交付物的寻址地址填入此参数。")
|
|
79
95
|
});
|
|
80
96
|
var BatchArchiveToolSchema = z.object({
|
|
@@ -362,7 +378,9 @@ function createTaskTool(taskComponent) {
|
|
|
362
378
|
let enrichedContext = params.context;
|
|
363
379
|
const envParentTaskId = getEnvContextOrEmpty().parentTaskId;
|
|
364
380
|
const effectiveParentTaskId = params.parent_task_id !== undefined && params.parent_task_id !== null ? params.parent_task_id : envParentTaskId !== undefined && envParentTaskId !== null && Number.isInteger(envParentTaskId) && envParentTaskId > 0 ? envParentTaskId : undefined;
|
|
365
|
-
|
|
381
|
+
const callerProjectPath = params.project_path && params.project_path.trim() !== "" ? params.project_path : undefined;
|
|
382
|
+
const callerProjectPathIsExplicit = callerProjectPath !== undefined && callerProjectPath !== UNKNOWN_PROJECT_PATH;
|
|
383
|
+
let inheritedProjectPath = callerProjectPathIsExplicit ? callerProjectPath : undefined;
|
|
366
384
|
let inheritedTags = params.tags;
|
|
367
385
|
let inheritedContext;
|
|
368
386
|
if (effectiveParentTaskId !== undefined) {
|
|
@@ -396,7 +414,8 @@ function createTaskTool(taskComponent) {
|
|
|
396
414
|
}
|
|
397
415
|
}
|
|
398
416
|
try {
|
|
399
|
-
const
|
|
417
|
+
const rawContext = params.context === UNKNOWN_TASK_CONTEXT ? undefined : params.context;
|
|
418
|
+
const ctxObj = rawContext ? JSON.parse(rawContext) : {};
|
|
400
419
|
const obj = typeof ctxObj === "object" && ctxObj !== null && !Array.isArray(ctxObj) ? ctxObj : {};
|
|
401
420
|
if (inheritedContext) {
|
|
402
421
|
try {
|
|
@@ -430,7 +449,7 @@ function createTaskTool(taskComponent) {
|
|
|
430
449
|
due_date: params.due_date,
|
|
431
450
|
tags: inheritedTags,
|
|
432
451
|
sessionId,
|
|
433
|
-
project_path: inheritedProjectPath ??
|
|
452
|
+
project_path: inheritedProjectPath ?? (callerProjectPathIsExplicit ? callerProjectPath : UNKNOWN_PROJECT_PATH),
|
|
434
453
|
context: enrichedContext
|
|
435
454
|
});
|
|
436
455
|
setCurrentTaskId(task.id);
|
|
@@ -475,9 +494,11 @@ function getTaskTool(taskComponent) {
|
|
|
475
494
|
metadata: { execution_time_ms: 0 }
|
|
476
495
|
};
|
|
477
496
|
}
|
|
497
|
+
const nested = result.task;
|
|
498
|
+
const flat = nested && typeof nested === "object" ? { ...nested, operations: result.operations } : result;
|
|
478
499
|
return {
|
|
479
500
|
success: true,
|
|
480
|
-
output: JSON.stringify(
|
|
501
|
+
output: JSON.stringify(flat, null, 2),
|
|
481
502
|
metadata: { execution_time_ms: 0 }
|
|
482
503
|
};
|
|
483
504
|
} else {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isToolUnavailableError,
|
|
3
3
|
truncateOutputInline
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-pj5tfmn5.js";
|
|
5
5
|
import {
|
|
6
6
|
AgentRegistry
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-dythsgkn.js";
|
|
8
8
|
import {
|
|
9
9
|
enqueueToAddFakeUserMessage
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-hf0t8agb.js";
|
|
11
11
|
import {
|
|
12
12
|
SessionMessageConverter
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-jsdqzfbj.js";
|
|
14
14
|
import {
|
|
15
15
|
parseToolArgsStrict,
|
|
16
16
|
safeParseToolArgs,
|
|
17
17
|
withTimeout
|
|
18
|
-
} from "./roy-agent-core-
|
|
18
|
+
} from "./roy-agent-core-m2tv4pj0.js";
|
|
19
19
|
import {
|
|
20
20
|
getCurrentBgTaskId
|
|
21
21
|
} from "./roy-agent-core-c1v263jn.js";
|
|
@@ -31,20 +31,20 @@ import {
|
|
|
31
31
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
32
32
|
import {
|
|
33
33
|
BaseComponent
|
|
34
|
-
} from "./roy-agent-core-
|
|
34
|
+
} from "./roy-agent-core-9s3payp1.js";
|
|
35
35
|
import {
|
|
36
36
|
globalHookManager,
|
|
37
37
|
init_global_hook_manager
|
|
38
|
-
} from "./roy-agent-core-
|
|
38
|
+
} from "./roy-agent-core-ajmgyawx.js";
|
|
39
39
|
import {
|
|
40
40
|
init_context
|
|
41
|
-
} from "./roy-agent-core-
|
|
41
|
+
} from "./roy-agent-core-bdzdw1g3.js";
|
|
42
42
|
import {
|
|
43
43
|
getCurrentTaskId,
|
|
44
44
|
getEnvContext,
|
|
45
45
|
resolveEnvParentTaskId,
|
|
46
46
|
runWithEnvContextAsync
|
|
47
|
-
} from "./roy-agent-core-
|
|
47
|
+
} from "./roy-agent-core-qrjs2500.js";
|
|
48
48
|
import {
|
|
49
49
|
TracedAs,
|
|
50
50
|
agentRunParamFilter,
|
|
@@ -56,11 +56,11 @@ import {
|
|
|
56
56
|
recordSessionMessagesParamFilter,
|
|
57
57
|
toolExecParamFilter,
|
|
58
58
|
toolExecResultFilter
|
|
59
|
-
} from "./roy-agent-core-
|
|
59
|
+
} from "./roy-agent-core-2qkrpc7m.js";
|
|
60
60
|
import {
|
|
61
61
|
createLogger,
|
|
62
62
|
init_logger
|
|
63
|
-
} from "./roy-agent-core-
|
|
63
|
+
} from "./roy-agent-core-y0k9kaxz.js";
|
|
64
64
|
import {
|
|
65
65
|
__legacyDecorateClassTS,
|
|
66
66
|
__require
|