@ai-setting/roy-agent-core 1.6.14 → 1.6.15
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 +10 -10
- package/dist/env/agent/index.js +16 -16
- package/dist/env/commands/index.js +10 -10
- package/dist/env/context/index.js +27 -7
- package/dist/env/debug/index.js +10 -10
- package/dist/env/event-source/index.js +16 -14
- package/dist/env/hook/index.js +8 -8
- package/dist/env/index.js +40 -40
- package/dist/env/llm/index.js +12 -12
- package/dist/env/log-trace/index.js +10 -10
- package/dist/env/mcp/index.js +11 -11
- package/dist/env/mcp/tool/index.js +4 -4
- package/dist/env/memory/index.js +11 -11
- package/dist/env/memory/plugin/index.js +4 -4
- package/dist/env/plugin/index.js +10 -10
- package/dist/env/prompt/index.js +10 -10
- package/dist/env/session/index.js +13 -13
- package/dist/env/session/storage/index.js +6 -6
- package/dist/env/skill/index.js +10 -10
- package/dist/env/task/delegate/index.js +10 -10
- package/dist/env/task/index.js +15 -15
- package/dist/env/task/plugins/index.js +9 -9
- package/dist/env/task/storage/index.js +5 -5
- package/dist/env/task/tools/index.js +6 -6
- package/dist/env/tool/built-in/index.js +6 -6
- package/dist/env/tool/index.js +13 -13
- package/dist/env/workflow/engine/index.js +12 -12
- package/dist/env/workflow/index.js +23 -23
- package/dist/env/workflow/nodes/index.js +5 -5
- package/dist/env/workflow/service/index.js +5 -5
- package/dist/env/workflow/storage/index.js +6 -6
- package/dist/env/workflow/tools/index.js +17 -17
- package/dist/env/workflow/utils/index.js +7 -7
- package/dist/index.js +53 -51
- package/dist/shared/@ai-setting/{roy-agent-core-r74v00c7.js → roy-agent-core-02aw62bv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6qbyfzsw.js → roy-agent-core-0rwymn7m.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-wpw37qqf.js → roy-agent-core-1380b0re.js} +29 -8
- package/dist/shared/@ai-setting/{roy-agent-core-m0cnmg7b.js → roy-agent-core-1ecgh5ya.js} +81 -13
- package/dist/shared/@ai-setting/{roy-agent-core-80e4a3g5.js → roy-agent-core-1mrc9a1r.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-xxgazz27.js → roy-agent-core-1qjgwjjs.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-rga3f0hm.js → roy-agent-core-2b0mw2h3.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-ck0m8754.js → roy-agent-core-416rpxkp.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-c6592r3c.js → roy-agent-core-4an1p9a1.js} +31 -2
- package/dist/shared/@ai-setting/{roy-agent-core-r53regz9.js → roy-agent-core-4z7dzcgb.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-txsswwhm.js → roy-agent-core-5pzegp1x.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-htjag2nr.js → roy-agent-core-77wfej1h.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-resnbd2j.js → roy-agent-core-7kw06e4b.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-yfhgxh5a.js → roy-agent-core-7r72622v.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dcd1s7ct.js → roy-agent-core-8n0e62y4.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fdm579b1.js → roy-agent-core-96mj6gvc.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fwxqevpf.js → roy-agent-core-9jsfqc1m.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-1mq9erp8.js → roy-agent-core-ajp566yv.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-j62bjagf.js → roy-agent-core-akb8mb9v.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-5h49ct1a.js → roy-agent-core-ataagh3a.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-606z25nw.js → roy-agent-core-atpchjdz.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9nhwdq9r.js → roy-agent-core-b8wn8yhk.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-mmb9484f.js → roy-agent-core-bq1gskrf.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nw39k111.js → roy-agent-core-bqe4c9f2.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-1gsnq4p2.js → roy-agent-core-dh9rajdh.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-dtkbj8fk.js +206 -0
- package/dist/shared/@ai-setting/{roy-agent-core-8x4ngxcy.js → roy-agent-core-e0kaxcy1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nv4yfy3m.js → roy-agent-core-eaj0b1hm.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-3kbf53sh.js → roy-agent-core-ehpnd2be.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-psfkwe4g.js → roy-agent-core-ez91vxas.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jw0hbacv.js → roy-agent-core-fxembepv.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-80bdhnwk.js → roy-agent-core-gc75v3px.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-24rmf17n.js → roy-agent-core-gmnex23m.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-atjd1tpt.js → roy-agent-core-keb51jag.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-7z9b1fm8.js → roy-agent-core-m00kamqp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4w6rgxs4.js → roy-agent-core-mdp8y7ky.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-v5nknfh0.js → roy-agent-core-mmnac1s6.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-vyygk314.js → roy-agent-core-nna4s0qs.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-f79ee0aw.js → roy-agent-core-p4z6nxgz.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-qbm5zy6s.js → roy-agent-core-pr4jekyy.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-rpq0mcvv.js → roy-agent-core-r0t34bbh.js} +79 -4
- package/dist/shared/@ai-setting/{roy-agent-core-ywtmc0bh.js → roy-agent-core-r15sn7ve.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fvkyv5j6.js → roy-agent-core-rmesvpff.js} +12 -12
- package/dist/shared/@ai-setting/{roy-agent-core-9hqqhye6.js → roy-agent-core-sqt96sam.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-2yavqjsh.js → roy-agent-core-v20nxrs1.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-dbkkjmqz.js → roy-agent-core-vc7p80sd.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-x7fgze6s.js → roy-agent-core-vkesx61c.js} +4 -4
- package/dist/shared/@ai-setting/roy-agent-core-w6kj6nmj.js +11 -0
- package/dist/shared/@ai-setting/{roy-agent-core-px8ghk4g.js → roy-agent-core-wq98qf5y.js} +28 -13
- package/dist/shared/@ai-setting/{roy-agent-core-wtbyj0q1.js → roy-agent-core-wr3pk3h3.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-wsqnf2za.js +19 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ra4y7e4p.js → roy-agent-core-x36fsm47.js} +14 -14
- package/dist/shared/@ai-setting/{roy-agent-core-st9y9z07.js → roy-agent-core-x7sc21ek.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-w6wagmhw.js → roy-agent-core-xzc53mnk.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-nhncpbzz.js → roy-agent-core-yr3fp8tv.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-m0wp34r4.js → roy-agent-core-z1hm09xp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9abv4ewh.js → roy-agent-core-zdzkzx5g.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-95bbd2jv.js → roy-agent-core-zs4f0tcy.js} +2 -2
- package/dist/utils/temp-file-manager/index.js +4 -4
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-6jqpdjr4.js +0 -19
- package/dist/shared/@ai-setting/roy-agent-core-endah27g.js +0 -81
- package/dist/shared/@ai-setting/roy-agent-core-qfdj8872.js +0 -11
|
@@ -3,27 +3,27 @@ import {
|
|
|
3
3
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseComponent
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
7
7
|
import {
|
|
8
8
|
init_decorator
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
10
10
|
import {
|
|
11
11
|
createLogger,
|
|
12
12
|
init_logger,
|
|
13
13
|
setConfigComponent,
|
|
14
14
|
setQuietMode
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
16
16
|
import {
|
|
17
17
|
getTracerProvider,
|
|
18
18
|
init_propagation,
|
|
19
19
|
init_tracer_provider,
|
|
20
20
|
init_types,
|
|
21
21
|
propagation
|
|
22
|
-
} from "./roy-agent-core-
|
|
22
|
+
} from "./roy-agent-core-m00kamqp.js";
|
|
23
23
|
import {
|
|
24
24
|
SQLiteSpanStorage,
|
|
25
25
|
init_span_storage
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-4an1p9a1.js";
|
|
27
27
|
import {
|
|
28
28
|
__require
|
|
29
29
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -8,17 +8,17 @@ import {
|
|
|
8
8
|
} from "./roy-agent-core-fnv3ev18.js";
|
|
9
9
|
import {
|
|
10
10
|
adaptMcpTool
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-mdp8y7ky.js";
|
|
12
12
|
import {
|
|
13
13
|
toEnvKey
|
|
14
14
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
15
15
|
import {
|
|
16
16
|
BaseComponent
|
|
17
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
18
18
|
import {
|
|
19
19
|
createLogger,
|
|
20
20
|
init_logger
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
22
22
|
|
|
23
23
|
// src/env/mcp/types.ts
|
|
24
24
|
import { z } from "zod";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./roy-agent-core-y3g3ar7a.js";
|
|
4
4
|
import {
|
|
5
5
|
invoke
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-8n0e62y4.js";
|
|
7
7
|
import {
|
|
8
8
|
ContextError,
|
|
9
9
|
ErrorCodes
|
|
@@ -14,20 +14,20 @@ import {
|
|
|
14
14
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
15
15
|
import {
|
|
16
16
|
BaseComponent
|
|
17
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
18
18
|
import {
|
|
19
19
|
LLMHookPoints,
|
|
20
20
|
globalHookManager,
|
|
21
21
|
init_global_hook_manager
|
|
22
|
-
} from "./roy-agent-core-
|
|
22
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
23
23
|
import {
|
|
24
24
|
TracedAs,
|
|
25
25
|
init_decorator
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
27
27
|
import {
|
|
28
28
|
createLogger,
|
|
29
29
|
init_logger
|
|
30
|
-
} from "./roy-agent-core-
|
|
30
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
31
31
|
import {
|
|
32
32
|
__legacyDecorateClassTS
|
|
33
33
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -7,6 +7,35 @@ import {
|
|
|
7
7
|
function isSpanStorageDebugEnabled() {
|
|
8
8
|
return process.env.ROY_TRACE_DEBUG_STORAGE === "1" || process.env.ROY_TRACE_DEBUG === "1";
|
|
9
9
|
}
|
|
10
|
+
function safeStringify(obj) {
|
|
11
|
+
const seen = new WeakSet;
|
|
12
|
+
try {
|
|
13
|
+
return JSON.stringify(obj, (_key, value) => {
|
|
14
|
+
if (typeof value === "function")
|
|
15
|
+
return "[Function]";
|
|
16
|
+
if (value === undefined)
|
|
17
|
+
return "[undefined]";
|
|
18
|
+
if (value === null)
|
|
19
|
+
return null;
|
|
20
|
+
if (value instanceof Error) {
|
|
21
|
+
return `${value.name}: ${value.message}`;
|
|
22
|
+
}
|
|
23
|
+
if (typeof value === "object") {
|
|
24
|
+
if ("$typeof" in value || "type" in value && "props" in value && "key" in value) {
|
|
25
|
+
return "[ReactElement]";
|
|
26
|
+
}
|
|
27
|
+
if (seen.has(value))
|
|
28
|
+
return "[Circular]";
|
|
29
|
+
seen.add(value);
|
|
30
|
+
}
|
|
31
|
+
if (typeof value === "bigint")
|
|
32
|
+
return value.toString();
|
|
33
|
+
return value;
|
|
34
|
+
});
|
|
35
|
+
} catch (err) {
|
|
36
|
+
return `[Unserializable: ${err instanceof Error ? err.message : String(err)}]`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
10
39
|
function getDatabaseClass() {
|
|
11
40
|
if (typeof Bun !== "undefined") {
|
|
12
41
|
const { Database } = __require("bun:sqlite");
|
|
@@ -88,12 +117,12 @@ class SQLiteSpanStorage {
|
|
|
88
117
|
(span_id, trace_id, parent_span_id, name, kind, status, start_time, end_time, attributes, result, error, time_created)
|
|
89
118
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
90
119
|
`);
|
|
91
|
-
const resultValue = span.result !== undefined && span.result !== null ? typeof span.result === "string" ? span.result :
|
|
120
|
+
const resultValue = span.result !== undefined && span.result !== null ? typeof span.result === "string" ? span.result : safeStringify(span.result) : null;
|
|
92
121
|
if (isSpanStorageDebugEnabled()) {
|
|
93
122
|
console.log(`[SpanStorage] Saving to "${this.dbPath}": name="${span.name}" traceId=${span.traceId} spanId=${span.spanId} status=${span.status}`);
|
|
94
123
|
}
|
|
95
124
|
try {
|
|
96
|
-
const result = stmt.run(span.spanId, span.traceId, span.parentSpanId || null, span.name, span.kind, span.status, span.startTime, span.endTime || null,
|
|
125
|
+
const result = stmt.run(span.spanId, span.traceId, span.parentSpanId || null, span.name, span.kind, span.status, span.startTime, span.endTime || null, safeStringify(span.attributes), resultValue, span.error || null, Date.now());
|
|
97
126
|
if (isSpanStorageDebugEnabled()) {
|
|
98
127
|
console.log(`[SpanStorage] Save result: changes=${result?.changes}, lastInsertRowid=${result?.lastInsertRowid}`);
|
|
99
128
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TAG_MAX_COUNT,
|
|
3
3
|
TAG_MIN_COUNT
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-r15sn7ve.js";
|
|
5
5
|
import {
|
|
6
6
|
validateWorkflowDefinition
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-1mrc9a1r.js";
|
|
8
8
|
import {
|
|
9
9
|
AskUserError,
|
|
10
10
|
init_workflow_hil
|
|
@@ -14,15 +14,15 @@ import {
|
|
|
14
14
|
} from "./roy-agent-core-c1v263jn.js";
|
|
15
15
|
import {
|
|
16
16
|
isValidSessionId
|
|
17
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-bqe4c9f2.js";
|
|
18
18
|
import {
|
|
19
19
|
TracedAs,
|
|
20
20
|
init_decorator
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
22
22
|
import {
|
|
23
23
|
createLogger,
|
|
24
24
|
init_logger
|
|
25
|
-
} from "./roy-agent-core-
|
|
25
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
26
26
|
import {
|
|
27
27
|
__legacyDecorateClassTS
|
|
28
28
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
7
7
|
import {
|
|
8
8
|
BaseComponent
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
10
10
|
import {
|
|
11
11
|
createLogger,
|
|
12
12
|
init_logger
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
14
14
|
|
|
15
15
|
// src/env/skill/skill-component.ts
|
|
16
16
|
init_logger();
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
TracedAs,
|
|
11
11
|
init_decorator
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
13
13
|
import {
|
|
14
14
|
createLogger,
|
|
15
15
|
init_logger
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
17
17
|
import {
|
|
18
18
|
__esm,
|
|
19
19
|
__export,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
safeParseToolArgs
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-e0kaxcy1.js";
|
|
4
4
|
import {
|
|
5
5
|
createLogger,
|
|
6
6
|
init_logger
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
8
8
|
import {
|
|
9
9
|
__require
|
|
10
10
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
getMaxOutput,
|
|
4
4
|
init_logger,
|
|
5
5
|
simplifyFilePath
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
7
7
|
import {
|
|
8
8
|
getTracerProvider,
|
|
9
9
|
init_tracer_provider
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-m00kamqp.js";
|
|
11
11
|
import {
|
|
12
12
|
__esm
|
|
13
13
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
BackgroundTaskManager,
|
|
9
9
|
createDelegateTool,
|
|
10
10
|
createStopTool
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-1380b0re.js";
|
|
12
12
|
import {
|
|
13
13
|
SQLiteTaskStore,
|
|
14
14
|
getDefaultTaskDbPath
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-zdzkzx5g.js";
|
|
16
16
|
import {
|
|
17
17
|
batchArchiveTaskTool,
|
|
18
18
|
batchDeleteTaskTool,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
searchTasksTool,
|
|
25
25
|
treeTasksTool,
|
|
26
26
|
updateTaskTool
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-r0t34bbh.js";
|
|
28
28
|
import {
|
|
29
29
|
createOperationTool,
|
|
30
30
|
deleteOperationTool,
|
|
@@ -40,23 +40,23 @@ import {
|
|
|
40
40
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
41
41
|
import {
|
|
42
42
|
BaseComponent
|
|
43
|
-
} from "./roy-agent-core-
|
|
43
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
44
44
|
import {
|
|
45
45
|
globalHookManager,
|
|
46
46
|
init_global_hook_manager
|
|
47
|
-
} from "./roy-agent-core-
|
|
47
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
48
48
|
import {
|
|
49
49
|
getEnvContextOrEmpty,
|
|
50
50
|
init_env_context
|
|
51
|
-
} from "./roy-agent-core-
|
|
51
|
+
} from "./roy-agent-core-dtkbj8fk.js";
|
|
52
52
|
import {
|
|
53
53
|
TracedAs,
|
|
54
54
|
init_decorator
|
|
55
|
-
} from "./roy-agent-core-
|
|
55
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
56
56
|
import {
|
|
57
57
|
createLogger,
|
|
58
58
|
init_logger
|
|
59
|
-
} from "./roy-agent-core-
|
|
59
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
60
60
|
import {
|
|
61
61
|
__legacyDecorateClassTS
|
|
62
62
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TagRepository
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-atpchjdz.js";
|
|
4
4
|
import {
|
|
5
5
|
exports_search_query_parser,
|
|
6
6
|
init_search_query_parser
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
12
12
|
import {
|
|
13
13
|
__require,
|
|
14
14
|
__toCommonJS
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createHook
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-02aw62bv.js";
|
|
4
4
|
import {
|
|
5
5
|
HookManager
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
7
7
|
|
|
8
8
|
// src/env/component.ts
|
|
9
9
|
class BaseComponent {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TempFileManager
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-ataagh3a.js";
|
|
4
4
|
import {
|
|
5
5
|
AskUserError,
|
|
6
6
|
init_workflow_hil
|
|
@@ -11,24 +11,24 @@ import {
|
|
|
11
11
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
12
12
|
import {
|
|
13
13
|
BaseComponent
|
|
14
|
-
} from "./roy-agent-core-
|
|
14
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
15
15
|
import {
|
|
16
16
|
ToolHookPoints,
|
|
17
17
|
globalHookManager,
|
|
18
18
|
init_global_hook_manager
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
20
20
|
import {
|
|
21
21
|
getCurrentTaskId,
|
|
22
22
|
init_env_context
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-dtkbj8fk.js";
|
|
24
24
|
import {
|
|
25
25
|
TracedAs,
|
|
26
26
|
init_decorator
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
28
28
|
import {
|
|
29
29
|
createLogger,
|
|
30
30
|
init_logger
|
|
31
|
-
} from "./roy-agent-core-
|
|
31
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
32
32
|
import {
|
|
33
33
|
__legacyDecorateClassTS,
|
|
34
34
|
__require
|
|
@@ -6,21 +6,21 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
MemorySessionStore,
|
|
8
8
|
SQLiteSessionStore
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-zs4f0tcy.js";
|
|
10
10
|
import {
|
|
11
11
|
envKeyToConfigKey
|
|
12
12
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
13
13
|
import {
|
|
14
14
|
BaseComponent
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
16
16
|
import {
|
|
17
17
|
TracedAs,
|
|
18
18
|
init_decorator
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
20
20
|
import {
|
|
21
21
|
createLogger,
|
|
22
22
|
init_logger
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
24
24
|
import {
|
|
25
25
|
__legacyDecorateClassTS
|
|
26
26
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_decorator,
|
|
3
|
+
wrapFunction
|
|
4
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
5
|
+
import {
|
|
6
|
+
createLogger,
|
|
7
|
+
init_logger
|
|
8
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
9
|
+
import {
|
|
10
|
+
__esm
|
|
11
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
12
|
+
|
|
13
|
+
// src/env/context/env-event.ts
|
|
14
|
+
function isLarkEvent(event) {
|
|
15
|
+
return event?.source === "lark";
|
|
16
|
+
}
|
|
17
|
+
function isGithubEvent(event) {
|
|
18
|
+
return event?.source === "github";
|
|
19
|
+
}
|
|
20
|
+
function isJiraEvent(event) {
|
|
21
|
+
return event?.source === "jira";
|
|
22
|
+
}
|
|
23
|
+
function getLarkMessageId(event) {
|
|
24
|
+
if (!isLarkEvent(event))
|
|
25
|
+
return;
|
|
26
|
+
if (event.id)
|
|
27
|
+
return event.id;
|
|
28
|
+
const payload = event.payload;
|
|
29
|
+
return payload?.message?.message_id ?? payload?.message_id;
|
|
30
|
+
}
|
|
31
|
+
function getLarkChatId(event) {
|
|
32
|
+
if (!isLarkEvent(event))
|
|
33
|
+
return;
|
|
34
|
+
const payload = event.payload;
|
|
35
|
+
return payload?.chat_id ?? payload?.message?.chat_id;
|
|
36
|
+
}
|
|
37
|
+
function getLarkUserId(event) {
|
|
38
|
+
if (!isLarkEvent(event))
|
|
39
|
+
return;
|
|
40
|
+
const payload = event.payload;
|
|
41
|
+
const senderId = payload?.event?.sender?.sender_id ?? payload?.sender?.sender_id ?? undefined;
|
|
42
|
+
return senderId?.open_id ?? senderId?.user_id;
|
|
43
|
+
}
|
|
44
|
+
function serializeEventToEnv(event) {
|
|
45
|
+
if (!event)
|
|
46
|
+
return {};
|
|
47
|
+
const env = {
|
|
48
|
+
[`${EVENT_ENV_PREFIX}SOURCE`]: event.source,
|
|
49
|
+
[`${EVENT_ENV_PREFIX}ID`]: event.id,
|
|
50
|
+
[`${EVENT_ENV_PREFIX}RECEIVED_AT`]: event.receivedAt
|
|
51
|
+
};
|
|
52
|
+
if (event.payload !== undefined) {
|
|
53
|
+
env[`${EVENT_ENV_PREFIX}PAYLOAD`] = JSON.stringify(event.payload);
|
|
54
|
+
}
|
|
55
|
+
if (event.metadata !== undefined) {
|
|
56
|
+
env[`${EVENT_ENV_PREFIX}METADATA`] = JSON.stringify(event.metadata);
|
|
57
|
+
}
|
|
58
|
+
return env;
|
|
59
|
+
}
|
|
60
|
+
function restoreEventFromEnv(env = process.env) {
|
|
61
|
+
const source = env[`${EVENT_ENV_PREFIX}SOURCE`];
|
|
62
|
+
const id = env[`${EVENT_ENV_PREFIX}ID`];
|
|
63
|
+
if (!source || !id)
|
|
64
|
+
return;
|
|
65
|
+
const payloadStr = env[`${EVENT_ENV_PREFIX}PAYLOAD`];
|
|
66
|
+
const metadataStr = env[`${EVENT_ENV_PREFIX}METADATA`];
|
|
67
|
+
let payload;
|
|
68
|
+
let metadata;
|
|
69
|
+
try {
|
|
70
|
+
if (payloadStr)
|
|
71
|
+
payload = JSON.parse(payloadStr);
|
|
72
|
+
} catch {}
|
|
73
|
+
try {
|
|
74
|
+
if (metadataStr)
|
|
75
|
+
metadata = JSON.parse(metadataStr);
|
|
76
|
+
} catch {}
|
|
77
|
+
return {
|
|
78
|
+
source,
|
|
79
|
+
id,
|
|
80
|
+
receivedAt: env[`${EVENT_ENV_PREFIX}RECEIVED_AT`] ?? new Date().toISOString(),
|
|
81
|
+
payload,
|
|
82
|
+
metadata
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
var EVENT_ENV_PREFIX = "ROY_EVENT_";
|
|
86
|
+
var init_env_event = () => {};
|
|
87
|
+
|
|
88
|
+
// src/env/context/env-context.ts
|
|
89
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
90
|
+
function getEnvContext() {
|
|
91
|
+
return envContextStorage.getStore();
|
|
92
|
+
}
|
|
93
|
+
function getEnvContextOrEmpty() {
|
|
94
|
+
return envContextStorage.getStore() || {};
|
|
95
|
+
}
|
|
96
|
+
function hasEnvContext() {
|
|
97
|
+
return envContextStorage.getStore() !== undefined;
|
|
98
|
+
}
|
|
99
|
+
function getCurrentTaskId() {
|
|
100
|
+
return envContextStorage.getStore()?.agentContext?.currentTaskId;
|
|
101
|
+
}
|
|
102
|
+
function runWithEnvContext(context, fn) {
|
|
103
|
+
if (context) {
|
|
104
|
+
return envContextStorage.run(context, fn);
|
|
105
|
+
}
|
|
106
|
+
return fn();
|
|
107
|
+
}
|
|
108
|
+
async function runWithEnvContextAsync(context, fn) {
|
|
109
|
+
if (context) {
|
|
110
|
+
return envContextStorage.run(context, fn);
|
|
111
|
+
}
|
|
112
|
+
return fn();
|
|
113
|
+
}
|
|
114
|
+
function createEnvContext(options) {
|
|
115
|
+
let replyChannel = options.replyChannel;
|
|
116
|
+
if (replyChannel && options.messageId && !replyChannel.messageId) {
|
|
117
|
+
replyChannel = { ...replyChannel, messageId: options.messageId };
|
|
118
|
+
}
|
|
119
|
+
let event = options.event;
|
|
120
|
+
if (!event && options.messageId) {
|
|
121
|
+
event = {
|
|
122
|
+
source: "lark",
|
|
123
|
+
id: options.messageId,
|
|
124
|
+
receivedAt: new Date().toISOString(),
|
|
125
|
+
payload: undefined,
|
|
126
|
+
metadata: {
|
|
127
|
+
chatId: replyChannel?.chatId,
|
|
128
|
+
userId: replyChannel?.userId,
|
|
129
|
+
profile: replyChannel?.profile
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
envEvent: options.envEvent,
|
|
135
|
+
sourceId: options.sourceId,
|
|
136
|
+
userId: options.userId,
|
|
137
|
+
messageId: options.messageId ?? (event?.source === "lark" ? event.id : undefined) ?? replyChannel?.messageId,
|
|
138
|
+
event,
|
|
139
|
+
traceId: options.traceId ?? crypto.randomUUID(),
|
|
140
|
+
requestId: options.requestId ?? crypto.randomUUID(),
|
|
141
|
+
replyChannel,
|
|
142
|
+
pluginEnabled: options.pluginEnabled,
|
|
143
|
+
plugins: options.plugins,
|
|
144
|
+
timestamp: options.timestamp ?? Date.now()
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function mergeEnvContext(partial) {
|
|
148
|
+
const current = envContextStorage.getStore();
|
|
149
|
+
if (current) {
|
|
150
|
+
if (partial.agentContext && current.agentContext) {
|
|
151
|
+
Object.assign(current.agentContext, partial.agentContext);
|
|
152
|
+
delete partial.agentContext;
|
|
153
|
+
}
|
|
154
|
+
Object.assign(current, partial);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function getEventFromEnvContext(ctx) {
|
|
158
|
+
if (!ctx)
|
|
159
|
+
return;
|
|
160
|
+
if (ctx.event)
|
|
161
|
+
return ctx.event;
|
|
162
|
+
const replyMessageId = ctx.replyChannel?.messageId;
|
|
163
|
+
if (replyMessageId) {
|
|
164
|
+
return {
|
|
165
|
+
source: "lark",
|
|
166
|
+
id: replyMessageId,
|
|
167
|
+
receivedAt: new Date().toISOString(),
|
|
168
|
+
payload: undefined,
|
|
169
|
+
metadata: {
|
|
170
|
+
chatId: ctx.replyChannel?.chatId,
|
|
171
|
+
userId: ctx.replyChannel?.userId,
|
|
172
|
+
profile: ctx.replyChannel?.profile
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (ctx.messageId) {
|
|
177
|
+
return {
|
|
178
|
+
source: "lark",
|
|
179
|
+
id: ctx.messageId,
|
|
180
|
+
receivedAt: new Date().toISOString(),
|
|
181
|
+
payload: undefined
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
var logger, envContextStorage, setCurrentTaskId;
|
|
187
|
+
var init_env_context = __esm(() => {
|
|
188
|
+
init_logger();
|
|
189
|
+
init_decorator();
|
|
190
|
+
init_env_event();
|
|
191
|
+
logger = createLogger("env:context:env-context");
|
|
192
|
+
envContextStorage = new AsyncLocalStorage;
|
|
193
|
+
setCurrentTaskId = wrapFunction(function _setCurrentTaskId(taskId) {
|
|
194
|
+
const prev = getCurrentTaskId();
|
|
195
|
+
const ctx = envContextStorage.getStore();
|
|
196
|
+
if (ctx) {
|
|
197
|
+
if (!ctx.agentContext) {
|
|
198
|
+
ctx.agentContext = {};
|
|
199
|
+
}
|
|
200
|
+
ctx.agentContext.currentTaskId = taskId;
|
|
201
|
+
}
|
|
202
|
+
logger.info(`[setCurrentTaskId] taskId=${taskId ?? "undefined"} (was: ${prev ?? "undefined"})`);
|
|
203
|
+
}, "env-context.setCurrentTaskId", { recordParams: true, recordResult: false, log: true });
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
export { isLarkEvent, isGithubEvent, isJiraEvent, getLarkMessageId, getLarkChatId, getLarkUserId, EVENT_ENV_PREFIX, serializeEventToEnv, restoreEventFromEnv, init_env_event, envContextStorage, getEnvContext, getEnvContextOrEmpty, hasEnvContext, getCurrentTaskId, runWithEnvContext, runWithEnvContextAsync, createEnvContext, mergeEnvContext, setCurrentTaskId, getEventFromEnvContext, init_env_context };
|