@ai-setting/roy-agent-core 1.5.34 → 1.5.36
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 +3 -3
- package/dist/env/agent/index.js +3 -3
- package/dist/env/commands/index.js +3 -3
- package/dist/env/debug/index.js +3 -3
- package/dist/env/event-source/index.js +5 -9
- package/dist/env/hook/index.js +1 -1
- package/dist/env/index.js +11 -15
- package/dist/env/llm/index.js +3 -3
- package/dist/env/log-trace/index.js +3 -3
- package/dist/env/mcp/index.js +3 -3
- package/dist/env/memory/index.js +3 -3
- package/dist/env/prompt/index.js +3 -3
- package/dist/env/session/index.js +3 -3
- package/dist/env/skill/index.js +3 -3
- package/dist/env/task/delegate/index.js +2 -2
- package/dist/env/task/index.js +4 -4
- package/dist/env/tool/built-in/index.js +1 -1
- package/dist/env/tool/index.js +4 -4
- package/dist/env/workflow/index.js +3 -3
- package/dist/index.js +22 -26
- package/dist/shared/@ai-setting/{roy-agent-core-f7q2x5z6.js → roy-agent-core-0wdjp769.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vf215qfv.js → roy-agent-core-3prpabp8.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-gjq1yk68.js → roy-agent-core-86gphny5.js} +7 -0
- package/dist/shared/@ai-setting/{roy-agent-core-zbkpc41z.js → roy-agent-core-97ma0pr5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-8jxva565.js → roy-agent-core-9mj7vzsm.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-81w1963m.js → roy-agent-core-by55z88t.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vkz81f7v.js → roy-agent-core-c0d3dtjd.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-b0x5dda6.js → roy-agent-core-c2wjwx16.js} +9 -1
- package/dist/shared/@ai-setting/{roy-agent-core-kkbwepqb.js → roy-agent-core-cefh9hjv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pw7cv1px.js → roy-agent-core-e2vk2qh7.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-g99pxzn5.js → roy-agent-core-fg1kxf70.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7nwwzxf6.js → roy-agent-core-gf2c2pxr.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vn2bc59q.js → roy-agent-core-hd1z20yq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4wjywp3c.js → roy-agent-core-hkb529dw.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-j1sr5pk9.js → roy-agent-core-j0ke54vy.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-5ex3za0m.js → roy-agent-core-np1w5dpe.js} +145 -287
- package/dist/shared/@ai-setting/{roy-agent-core-4txzpsbt.js → roy-agent-core-qdmt6nz7.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-wzbeqtmc.js → roy-agent-core-qfdp3pvq.js} +129 -155
- package/dist/shared/@ai-setting/{roy-agent-core-c1q5pw77.js → roy-agent-core-vqspcspb.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-mrcxzpbg.js → roy-agent-core-wjd5kars.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-avq1x4t7.js → roy-agent-core-xb4hvk1m.js} +2 -22
- package/dist/shared/@ai-setting/{roy-agent-core-gwc4h96n.js → roy-agent-core-xt3fx7m1.js} +3 -3
- package/package.json +4 -1
|
@@ -11,155 +11,124 @@ import {
|
|
|
11
11
|
// src/env/tool/built-in/bash.ts
|
|
12
12
|
init_propagation();
|
|
13
13
|
import { z } from "zod";
|
|
14
|
+
import { Effect as Effect2 } from "effect";
|
|
15
|
+
|
|
16
|
+
// src/env/tool/built-in/bash-effect.ts
|
|
17
|
+
import { Effect, Context, Layer } from "effect";
|
|
14
18
|
import { spawn } from "child_process";
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
async function killProcessTree(pid) {
|
|
24
|
-
if (isWindows()) {
|
|
25
|
-
await new Promise((resolve) => {
|
|
26
|
-
const killer = spawn("taskkill", ["/pid", String(pid), "/f", "/t"], {
|
|
27
|
-
stdio: "ignore",
|
|
28
|
-
windowsHide: true
|
|
29
|
-
});
|
|
30
|
-
killer.on("exit", () => resolve());
|
|
31
|
-
killer.on("error", () => resolve());
|
|
19
|
+
var BashSpawner = Context.GenericTag("BashSpawner");
|
|
20
|
+
var isWindows = process.platform === "win32";
|
|
21
|
+
var SIGKILL_TIMEOUT_MS = 200;
|
|
22
|
+
var killTree = (proc, signal = "SIGKILL") => {
|
|
23
|
+
if (isWindows) {
|
|
24
|
+
spawn("taskkill", ["/pid", String(proc.pid), "/f", "/t"], {
|
|
25
|
+
stdio: "ignore",
|
|
26
|
+
windowsHide: true
|
|
32
27
|
});
|
|
33
28
|
return;
|
|
34
29
|
}
|
|
30
|
+
const pid = proc.pid;
|
|
31
|
+
if (!pid)
|
|
32
|
+
return;
|
|
35
33
|
try {
|
|
36
34
|
process.kill(-pid, "SIGTERM");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
try {
|
|
37
|
+
process.kill(-pid, 0);
|
|
38
|
+
process.kill(-pid, signal);
|
|
39
|
+
} catch {}
|
|
40
|
+
}, SIGKILL_TIMEOUT_MS);
|
|
43
41
|
} catch {}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
42
|
+
};
|
|
43
|
+
var makeBashSpawner = () => {
|
|
44
|
+
return {
|
|
45
|
+
run: (command, options) => {
|
|
46
|
+
return Effect.gen(function* () {
|
|
47
|
+
const cwd = options?.cwd;
|
|
48
|
+
const timeout = options?.timeout ?? 60000;
|
|
49
|
+
const env = options?.env ?? {};
|
|
50
|
+
let stdout = "";
|
|
51
|
+
let stderr = "";
|
|
52
|
+
let timedOut = false;
|
|
53
|
+
let timer = null;
|
|
54
|
+
let child = null;
|
|
55
|
+
let exitResolve = null;
|
|
56
|
+
let exited = false;
|
|
57
|
+
const spawnOpts = {
|
|
58
|
+
shell: true,
|
|
59
|
+
cwd,
|
|
60
|
+
env: { ...process.env, ...env },
|
|
61
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
62
|
+
};
|
|
63
|
+
child = spawn(command, [], spawnOpts);
|
|
64
|
+
const checkExited = () => exited || !child || !child.pid || child.killed || child.exitCode !== null;
|
|
65
|
+
if (timeout > 0) {
|
|
66
|
+
timer = setTimeout(() => {
|
|
67
|
+
if (!checkExited()) {
|
|
68
|
+
timedOut = true;
|
|
69
|
+
killTree(child, "SIGKILL");
|
|
70
|
+
if (exitResolve) {
|
|
71
|
+
exitResolve(-1);
|
|
72
|
+
exited = true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, timeout);
|
|
76
|
+
}
|
|
77
|
+
yield* Effect.addFinalizer(() => {
|
|
78
|
+
return Effect.sync(() => {
|
|
79
|
+
if (timer)
|
|
80
|
+
clearTimeout(timer);
|
|
81
|
+
if (!checkExited() && child) {
|
|
82
|
+
child.kill("SIGKILL");
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
const stdoutChunks = [];
|
|
87
|
+
const stderrChunks = [];
|
|
88
|
+
child.stdout?.on("data", (data) => {
|
|
89
|
+
stdoutChunks.push(data);
|
|
90
|
+
});
|
|
91
|
+
child.stderr?.on("data", (data) => {
|
|
92
|
+
stderrChunks.push(data);
|
|
93
|
+
});
|
|
94
|
+
const exitCode = yield* Effect.async((resume) => {
|
|
95
|
+
exitResolve = (code) => {
|
|
96
|
+
if (!exited) {
|
|
97
|
+
exited = true;
|
|
98
|
+
resume(Effect.succeed(code));
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
child.on("exit", (code) => {
|
|
102
|
+
if (!exited) {
|
|
103
|
+
exited = true;
|
|
104
|
+
resume(Effect.succeed(code ?? 0));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
child.on("error", () => {
|
|
108
|
+
if (!exited) {
|
|
109
|
+
exited = true;
|
|
110
|
+
resume(Effect.succeed(1));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
71
114
|
if (timer)
|
|
72
115
|
clearTimeout(timer);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
resolved = true;
|
|
77
|
-
cleanup2();
|
|
78
|
-
resolve({
|
|
79
|
-
stdout: stdout.trim(),
|
|
80
|
-
stderr: stderr.trim(),
|
|
81
|
-
exitCode: timedOutFlag ? -1 : exitCode,
|
|
82
|
-
timedOut: timedOutFlag
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
if (options.timeout) {
|
|
87
|
-
timer = setTimeout(async () => {
|
|
88
|
-
timedOut = true;
|
|
89
|
-
if (childPid) {
|
|
90
|
-
await killProcessTree(childPid);
|
|
91
|
-
} else {
|
|
92
|
-
child2.kill("SIGKILL");
|
|
93
|
-
}
|
|
94
|
-
}, options.timeout);
|
|
95
|
-
}
|
|
96
|
-
child2.stdout?.on("data", (data) => {
|
|
97
|
-
stdout += data.toString();
|
|
98
|
-
});
|
|
99
|
-
child2.stderr?.on("data", (data) => {
|
|
100
|
-
stderr += data.toString();
|
|
101
|
-
});
|
|
102
|
-
child2.on("exit", (code) => {
|
|
103
|
-
doResolve2(code ?? 0, timedOut);
|
|
104
|
-
});
|
|
105
|
-
child2.on("error", () => {
|
|
106
|
-
doResolve2(1, false);
|
|
107
|
-
});
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const child = spawn(command, [], {
|
|
111
|
-
shell: true,
|
|
112
|
-
cwd,
|
|
113
|
-
env: options.env,
|
|
114
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
115
|
-
windowsHide: true,
|
|
116
|
-
detached: true
|
|
117
|
-
});
|
|
118
|
-
childPid = child.pid;
|
|
119
|
-
processGroupId = childPid;
|
|
120
|
-
const cleanup = () => {
|
|
121
|
-
if (timer)
|
|
122
|
-
clearTimeout(timer);
|
|
123
|
-
};
|
|
124
|
-
const doResolve = (exitCode, timedOutFlag) => {
|
|
125
|
-
if (!resolved) {
|
|
126
|
-
resolved = true;
|
|
127
|
-
cleanup();
|
|
128
|
-
resolve({
|
|
116
|
+
stdout = Buffer.concat(stdoutChunks).toString("utf-8");
|
|
117
|
+
stderr = Buffer.concat(stderrChunks).toString("utf-8");
|
|
118
|
+
return {
|
|
129
119
|
stdout: stdout.trim(),
|
|
130
120
|
stderr: stderr.trim(),
|
|
131
|
-
exitCode:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (options.timeout) {
|
|
137
|
-
timer = setTimeout(async () => {
|
|
138
|
-
timedOut = true;
|
|
139
|
-
if (processGroupId) {
|
|
140
|
-
await killProcessTree(processGroupId);
|
|
141
|
-
}
|
|
142
|
-
if (childPid) {
|
|
143
|
-
try {
|
|
144
|
-
process.kill(childPid, "SIGKILL");
|
|
145
|
-
} catch {}
|
|
146
|
-
}
|
|
147
|
-
}, options.timeout);
|
|
121
|
+
exitCode: timedOut ? -1 : exitCode,
|
|
122
|
+
success: !timedOut && exitCode === 0,
|
|
123
|
+
timedOut
|
|
124
|
+
};
|
|
125
|
+
});
|
|
148
126
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
child.on("exit", (code, signal) => {
|
|
156
|
-
doResolve(code ?? (signal ? 1 : 0), timedOut);
|
|
157
|
-
});
|
|
158
|
-
child.on("error", () => {
|
|
159
|
-
doResolve(1, false);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
}
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
var BashSpawnerLayer = Layer.succeed(BashSpawner, makeBashSpawner());
|
|
130
|
+
|
|
131
|
+
// src/env/tool/built-in/bash.ts
|
|
163
132
|
function getCurrentSpanContext() {
|
|
164
133
|
try {
|
|
165
134
|
const { getTracerProvider } = (init_tracer_provider(), __toCommonJS(exports_tracer_provider));
|
|
@@ -207,7 +176,7 @@ var bashTool = {
|
|
|
207
176
|
metadata: {
|
|
208
177
|
category: "system",
|
|
209
178
|
tags: ["shell", "command", "terminal", "exec"],
|
|
210
|
-
version: "
|
|
179
|
+
version: "2.0.0"
|
|
211
180
|
},
|
|
212
181
|
execute: async (args, ctx) => {
|
|
213
182
|
const startTime = Date.now();
|
|
@@ -253,11 +222,16 @@ var bashTool = {
|
|
|
253
222
|
} catch {}
|
|
254
223
|
const spanId = otelSpan?.spanContext?.spanId;
|
|
255
224
|
try {
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
225
|
+
const program = Effect2.gen(function* () {
|
|
226
|
+
const spawner = yield* BashSpawner;
|
|
227
|
+
const result2 = yield* spawner.run(command, {
|
|
228
|
+
cwd,
|
|
229
|
+
timeout,
|
|
230
|
+
env: childEnv
|
|
231
|
+
});
|
|
232
|
+
return result2;
|
|
260
233
|
});
|
|
234
|
+
const result = await Effect2.runPromise(program.pipe(Effect2.scoped, Effect2.provide(BashSpawnerLayer)));
|
|
261
235
|
if (otelSpan) {
|
|
262
236
|
if (result.timedOut) {
|
|
263
237
|
const execError = new Error(`Command timed out after ${timeout}ms`);
|
|
@@ -339,7 +313,7 @@ var echoTool = {
|
|
|
339
313
|
import { z as z2 } from "zod";
|
|
340
314
|
import { glob as globAsync } from "glob";
|
|
341
315
|
import { stat } from "fs/promises";
|
|
342
|
-
import
|
|
316
|
+
import path from "path";
|
|
343
317
|
var globTool = {
|
|
344
318
|
name: "glob",
|
|
345
319
|
description: "Search for files matching a glob pattern. Use this to find files by name patterns like **/*.ts or **/*.md.",
|
|
@@ -380,7 +354,7 @@ var globTool = {
|
|
|
380
354
|
};
|
|
381
355
|
}
|
|
382
356
|
try {
|
|
383
|
-
const absolutePattern =
|
|
357
|
+
const absolutePattern = path.isAbsolute(pattern) ? pattern : pattern;
|
|
384
358
|
const files = await globAsync(absolutePattern, {
|
|
385
359
|
cwd: searchDir,
|
|
386
360
|
ignore: ignore || ["**/node_modules/**", "**/.git/**"],
|
|
@@ -391,7 +365,7 @@ var globTool = {
|
|
|
391
365
|
const filesWithMtime = [];
|
|
392
366
|
for (const file of files) {
|
|
393
367
|
try {
|
|
394
|
-
const fullPath =
|
|
368
|
+
const fullPath = path.join(searchDir, file);
|
|
395
369
|
const stats = await stat(fullPath);
|
|
396
370
|
if (stats.isFile()) {
|
|
397
371
|
filesWithMtime.push({
|
|
@@ -443,7 +417,7 @@ var globTool = {
|
|
|
443
417
|
// src/env/tool/built-in/read-file.ts
|
|
444
418
|
import { z as z3 } from "zod";
|
|
445
419
|
import { readFile, stat as stat2 } from "fs/promises";
|
|
446
|
-
import
|
|
420
|
+
import path2 from "path";
|
|
447
421
|
var readFileTool = {
|
|
448
422
|
name: "read_file",
|
|
449
423
|
description: "Read the contents of a file. Use this to read source code, configuration files, or any text files.",
|
|
@@ -480,7 +454,7 @@ var readFileTool = {
|
|
|
480
454
|
metadata: { execution_time_ms: Date.now() - startTime }
|
|
481
455
|
};
|
|
482
456
|
}
|
|
483
|
-
const normalizedPath =
|
|
457
|
+
const normalizedPath = path2.normalize(filePath);
|
|
484
458
|
try {
|
|
485
459
|
const stats = await stat2(normalizedPath);
|
|
486
460
|
if (stats.isDirectory()) {
|
|
@@ -558,7 +532,7 @@ var readFileTool = {
|
|
|
558
532
|
// src/env/tool/built-in/write-file.ts
|
|
559
533
|
import { z as z4 } from "zod";
|
|
560
534
|
import { writeFile, mkdir, stat as stat3 } from "fs/promises";
|
|
561
|
-
import
|
|
535
|
+
import path3 from "path";
|
|
562
536
|
var writeFileTool = {
|
|
563
537
|
name: "write_file",
|
|
564
538
|
description: "Write content to a file. Use this to create new files or overwrite existing ones.",
|
|
@@ -596,7 +570,7 @@ var writeFileTool = {
|
|
|
596
570
|
metadata: { execution_time_ms: Date.now() - startTime }
|
|
597
571
|
};
|
|
598
572
|
}
|
|
599
|
-
const normalizedPath =
|
|
573
|
+
const normalizedPath = path3.normalize(filePath);
|
|
600
574
|
try {
|
|
601
575
|
const stats = await stat3(normalizedPath);
|
|
602
576
|
if (stats.isDirectory()) {
|
|
@@ -619,7 +593,7 @@ var writeFileTool = {
|
|
|
619
593
|
}
|
|
620
594
|
try {
|
|
621
595
|
if (createDirs) {
|
|
622
|
-
await mkdir(
|
|
596
|
+
await mkdir(path3.dirname(normalizedPath), { recursive: true });
|
|
623
597
|
}
|
|
624
598
|
const flags = append ? "a" : "w";
|
|
625
599
|
await writeFile(normalizedPath, content, { flag: flags });
|
|
@@ -648,7 +622,7 @@ var writeFileTool = {
|
|
|
648
622
|
// src/env/tool/built-in/edit-file.ts
|
|
649
623
|
import { z as z5 } from "zod";
|
|
650
624
|
import { readFile as readFile2, writeFile as writeFile2, stat as stat4, unlink } from "fs/promises";
|
|
651
|
-
import
|
|
625
|
+
import path4 from "path";
|
|
652
626
|
import { randomUUID } from "crypto";
|
|
653
627
|
var editFileTool = {
|
|
654
628
|
name: "edit_file",
|
|
@@ -687,7 +661,7 @@ var editFileTool = {
|
|
|
687
661
|
metadata: { execution_time_ms: Date.now() - startTime }
|
|
688
662
|
};
|
|
689
663
|
}
|
|
690
|
-
const normalizedPath =
|
|
664
|
+
const normalizedPath = path4.normalize(filePath);
|
|
691
665
|
try {
|
|
692
666
|
const stats = await stat4(normalizedPath);
|
|
693
667
|
if (stats.isDirectory()) {
|
|
@@ -765,7 +739,7 @@ function escapeRegExp(string) {
|
|
|
765
739
|
import { z as z6 } from "zod";
|
|
766
740
|
import { readFile as readFile3, stat as stat5 } from "fs/promises";
|
|
767
741
|
import { glob as globAsync2 } from "glob";
|
|
768
|
-
import
|
|
742
|
+
import path5 from "path";
|
|
769
743
|
function isBinaryContent(content) {
|
|
770
744
|
for (let i = 0;i < Math.min(content.length, 8192); i++) {
|
|
771
745
|
if (content[i] === 0) {
|
|
@@ -835,7 +809,7 @@ var grepTool = {
|
|
|
835
809
|
maxDepth: 10,
|
|
836
810
|
nodir: true
|
|
837
811
|
});
|
|
838
|
-
files = files.map((f) =>
|
|
812
|
+
files = files.map((f) => path5.join(basePath, f));
|
|
839
813
|
}
|
|
840
814
|
const results = [];
|
|
841
815
|
const regexFlags = caseSensitive ? "" : "i";
|
|
@@ -866,7 +840,7 @@ var grepTool = {
|
|
|
866
840
|
regex.lastIndex = 0;
|
|
867
841
|
if (regex.test(lines[i])) {
|
|
868
842
|
const lineNum = showLineNumbers ? `${i + 1}:` : "";
|
|
869
|
-
const relativePath =
|
|
843
|
+
const relativePath = path5.relative(basePath, file);
|
|
870
844
|
results.push(`${relativePath}:${lineNum}${lines[i]}`);
|
|
871
845
|
if (results.length >= maxResults)
|
|
872
846
|
break;
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
9
9
|
import {
|
|
10
10
|
BaseComponent
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-cefh9hjv.js";
|
|
12
12
|
import {
|
|
13
13
|
ToolHookPoints,
|
|
14
14
|
globalHookManager
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-86gphny5.js";
|
|
16
16
|
import {
|
|
17
17
|
createLogger,
|
|
18
18
|
init_logger
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseComponent
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-cefh9hjv.js";
|
|
8
8
|
import {
|
|
9
9
|
createHook
|
|
10
10
|
} from "./roy-agent-core-2dhd60aw.js";
|
|
11
11
|
import {
|
|
12
12
|
globalHookManager
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-86gphny5.js";
|
|
14
14
|
import {
|
|
15
15
|
createLogger,
|
|
16
16
|
init_logger
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
// src/env/event-source/types.ts
|
|
2
2
|
var BUILT_IN_EVENT_SOURCE_TYPES = {
|
|
3
|
-
LARK_CLI: "lark-cli"
|
|
4
|
-
WEBSOCKET: "websocket",
|
|
5
|
-
TIMER: "timer",
|
|
6
|
-
HTTP_WEBHOOK: "http-webhook",
|
|
7
|
-
FILE_WATCHER: "file-watcher"
|
|
3
|
+
LARK_CLI: "lark-cli"
|
|
8
4
|
};
|
|
9
5
|
var BUILT_IN_EVENT_SOURCE_TYPE_LIST = Object.values(BUILT_IN_EVENT_SOURCE_TYPES);
|
|
10
6
|
|
|
@@ -41,12 +37,8 @@ function isValidEventSourceType(type) {
|
|
|
41
37
|
}
|
|
42
38
|
function getDefaultConfigForType(type) {
|
|
43
39
|
switch (type) {
|
|
44
|
-
case BUILT_IN_EVENT_SOURCE_TYPES.TIMER:
|
|
45
|
-
return { interval: 60000 };
|
|
46
40
|
case BUILT_IN_EVENT_SOURCE_TYPES.LARK_CLI:
|
|
47
|
-
return { command: "lark-cli event
|
|
48
|
-
case BUILT_IN_EVENT_SOURCE_TYPES.WEBSOCKET:
|
|
49
|
-
return {};
|
|
41
|
+
return { command: "lark-cli event consume im.message.receive_v1 --as bot" };
|
|
50
42
|
default:
|
|
51
43
|
return {};
|
|
52
44
|
}
|
|
@@ -65,18 +57,6 @@ function validateEventSourceConfig(config, handler) {
|
|
|
65
57
|
if (handler) {
|
|
66
58
|
const handlerErrors = handler.validateConfig(config);
|
|
67
59
|
errors.push(...handlerErrors);
|
|
68
|
-
} else {
|
|
69
|
-
if (config.type === BUILT_IN_EVENT_SOURCE_TYPES.TIMER) {
|
|
70
|
-
if (!config.interval || config.interval <= 0) {
|
|
71
|
-
errors.push("Timer interval must be a positive number");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (config.type === BUILT_IN_EVENT_SOURCE_TYPES.LARK_CLI && !config.command) {
|
|
75
|
-
errors.push("lark-cli command is required");
|
|
76
|
-
}
|
|
77
|
-
if (config.type === BUILT_IN_EVENT_SOURCE_TYPES.WEBSOCKET && !config.url) {
|
|
78
|
-
errors.push("WebSocket URL is required");
|
|
79
|
-
}
|
|
80
60
|
}
|
|
81
61
|
return errors;
|
|
82
62
|
}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
BackgroundTaskManager,
|
|
3
3
|
createDelegateTool,
|
|
4
4
|
createStopTool
|
|
5
|
-
} from "./roy-agent-core-
|
|
5
|
+
} from "./roy-agent-core-3prpabp8.js";
|
|
6
6
|
import {
|
|
7
7
|
SQLiteTaskStore,
|
|
8
8
|
getDefaultTaskDbPath
|
|
@@ -33,10 +33,10 @@ import {
|
|
|
33
33
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
34
34
|
import {
|
|
35
35
|
BaseComponent
|
|
36
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-cefh9hjv.js";
|
|
37
37
|
import {
|
|
38
38
|
globalHookManager
|
|
39
|
-
} from "./roy-agent-core-
|
|
39
|
+
} from "./roy-agent-core-86gphny5.js";
|
|
40
40
|
import {
|
|
41
41
|
createLogger,
|
|
42
42
|
init_logger
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-setting/roy-agent-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.36",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,9 +38,12 @@
|
|
|
38
38
|
"@ai-sdk/google": "^3.0.0",
|
|
39
39
|
"@ai-sdk/openai": "^3.0.0",
|
|
40
40
|
"@ai-sdk/openai-compatible": "^2.0.0",
|
|
41
|
+
"@effect/platform": "^0.96.1",
|
|
42
|
+
"@effect/platform-node": "^0.106.0",
|
|
41
43
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
42
44
|
"ai": "^6.0.0",
|
|
43
45
|
"better-sqlite3": "^11.10.0",
|
|
46
|
+
"effect": "^3.21.2",
|
|
44
47
|
"glob": "^13.0.6",
|
|
45
48
|
"jsonc-parser": "^3.2.0",
|
|
46
49
|
"reflect-metadata": "^0.2.2",
|