@ai-setting/roy-agent-core 1.7.37 → 1.7.38
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 +7 -7
- package/dist/env/agent/index.js +10 -10
- package/dist/env/commands/index.js +7 -7
- package/dist/env/context/index.js +3 -3
- package/dist/env/debug/index.js +7 -7
- package/dist/env/event-source/index.js +24 -14
- package/dist/env/hook/index.js +5 -5
- package/dist/env/index.js +33 -32
- package/dist/env/llm/index.js +7 -7
- package/dist/env/log-trace/index.js +7 -7
- package/dist/env/mcp/index.js +7 -7
- package/dist/env/memory/index.js +7 -7
- package/dist/env/plugin/index.js +7 -7
- package/dist/env/prompt/index.js +7 -7
- package/dist/env/session/index.js +7 -7
- package/dist/env/skill/index.js +7 -7
- package/dist/env/task/delegate/index.js +7 -6
- package/dist/env/task/index.js +12 -11
- package/dist/env/task/plugins/index.js +7 -7
- package/dist/env/task/storage/index.js +2 -2
- package/dist/env/task/tools/index.js +3 -3
- package/dist/env/tool/built-in/index.js +2 -2
- package/dist/env/tool/index.js +8 -8
- package/dist/env/workflow/engine/index.js +9 -9
- package/dist/env/workflow/index.js +17 -17
- package/dist/env/workflow/nodes/index.js +2 -2
- package/dist/env/workflow/service/index.js +2 -2
- package/dist/env/workflow/storage/index.js +3 -3
- package/dist/env/workflow/tools/index.js +11 -11
- package/dist/env/workflow/utils/index.js +4 -4
- package/dist/index.js +53 -43
- package/dist/shared/@ai-setting/{roy-agent-core-yf0ex8y1.js → roy-agent-core-333apxaa.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-mdaew65f.js → roy-agent-core-3m7j2wcb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9drbkjfr.js → roy-agent-core-4cj6hram.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zda3rfr3.js → roy-agent-core-4kbvfnn1.js} +54 -5
- package/dist/shared/@ai-setting/{roy-agent-core-88tfzaxg.js → roy-agent-core-5gpf5j51.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jq7g5nxz.js → roy-agent-core-5j4awbgc.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-wgttzq8e.js → roy-agent-core-6vbgswjw.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pxyyrxnn.js → roy-agent-core-83j0v0hs.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-j9ejsmsj.js → roy-agent-core-8nv07zgr.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-a8zf7ts4.js → roy-agent-core-970btnjh.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-yw07bvqz.js → roy-agent-core-9cqpdrnk.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-q3zvkbj6.js → roy-agent-core-9qn92jhf.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-462v5d24.js → roy-agent-core-9wsy4yfv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qhjm0bxm.js → roy-agent-core-a9pbda78.js} +23 -13
- package/dist/shared/@ai-setting/{roy-agent-core-mxwaq8ey.js → roy-agent-core-cd9h49ng.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-ds5f75pg.js → roy-agent-core-ck60j1q9.js} +19 -1
- package/dist/shared/@ai-setting/{roy-agent-core-2qke91fm.js → roy-agent-core-dfnyvxr9.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-zekkw27m.js → roy-agent-core-e02f0ywc.js} +69 -24
- package/dist/shared/@ai-setting/{roy-agent-core-e4v61k3j.js → roy-agent-core-e5pnnzdm.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-1btakphh.js → roy-agent-core-e8rxb9a6.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-whta3f53.js → roy-agent-core-ff2ssff5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-s53yya0w.js → roy-agent-core-gh6szaj5.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-em8618g6.js → roy-agent-core-gpf33hn9.js} +214 -13
- package/dist/shared/@ai-setting/{roy-agent-core-qhtejtpc.js → roy-agent-core-hfmpmt0k.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qz9jb9sp.js → roy-agent-core-hkj5v9xq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-fytqnxrd.js → roy-agent-core-mzyzdf33.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-1vj7dd14.js → roy-agent-core-nz4n1w28.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-q8vew3zh.js → roy-agent-core-p0c98phj.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-dfay0w56.js → roy-agent-core-p2ham63a.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-d5gwqrr5.js → roy-agent-core-pd0exvnq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-x4wev4rn.js → roy-agent-core-q3vbxprp.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-e3qjt852.js → roy-agent-core-rgpkygbc.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-2wbdfrtg.js → roy-agent-core-rhfywyz1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-k5csz66y.js → roy-agent-core-tm57tmds.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-bb57xjfh.js → roy-agent-core-vh10qamt.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-1q6gjxba.js → roy-agent-core-vn6f4nxv.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-1nvqn17p.js → roy-agent-core-wacnvjaq.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-dzfyjzgw.js → roy-agent-core-wb1b61f8.js} +20 -2
- package/dist/shared/@ai-setting/{roy-agent-core-mwaesrpc.js → roy-agent-core-wfpzny0h.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-ddq5hcp5.js → roy-agent-core-x6c45yqd.js} +3 -1
- package/dist/shared/@ai-setting/roy-agent-core-xyys5m1a.js +159 -0
- package/dist/shared/@ai-setting/{roy-agent-core-wphva2vs.js → roy-agent-core-y1n63tse.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-w457586k.js → roy-agent-core-y7atw1kw.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jcdsghyr.js → roy-agent-core-yjjqm4ww.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-fym6zz5a.js → roy-agent-core-yjyvwxs4.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-rx8whb18.js → roy-agent-core-ym1hwrcm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-m7dppx2p.js → roy-agent-core-yv4anf1c.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-n82acszf.js → roy-agent-core-z4486eek.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-n3pwkwjh.js → roy-agent-core-za09t5g3.js} +1 -1
- package/package.json +1 -1
- /package/dist/shared/@ai-setting/{roy-agent-core-k5hxvaf0.js → roy-agent-core-3ztzc83c.js} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TracedAs,
|
|
3
|
+
init_decorator
|
|
4
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
5
|
+
import {
|
|
6
|
+
__legacyDecorateClassTS,
|
|
7
|
+
__require
|
|
8
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
9
|
+
|
|
10
|
+
// src/env/event-source/event-store.ts
|
|
11
|
+
init_decorator();
|
|
12
|
+
import { randomUUID } from "node:crypto";
|
|
13
|
+
function getDatabaseClass() {
|
|
14
|
+
if (typeof Bun !== "undefined") {
|
|
15
|
+
const { Database } = __require("bun:sqlite");
|
|
16
|
+
return Database;
|
|
17
|
+
} else {
|
|
18
|
+
return __require("better-sqlite3");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function createCompatibleDatabase(path) {
|
|
22
|
+
const Database = getDatabaseClass();
|
|
23
|
+
const db = new Database(path);
|
|
24
|
+
if (typeof db.run !== "function") {
|
|
25
|
+
db.run = function(sql, ...params) {
|
|
26
|
+
if (params.length > 0) {
|
|
27
|
+
return this.prepare(sql).run(...params);
|
|
28
|
+
} else {
|
|
29
|
+
return this.exec(sql);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return db;
|
|
34
|
+
}
|
|
35
|
+
class EventStoreImpl {
|
|
36
|
+
db;
|
|
37
|
+
insertStmt;
|
|
38
|
+
getByIdStmt;
|
|
39
|
+
recentStmt;
|
|
40
|
+
constructor(options) {
|
|
41
|
+
this.db = createCompatibleDatabase(options.dbPath);
|
|
42
|
+
try {
|
|
43
|
+
this.db.exec("PRAGMA journal_mode=WAL");
|
|
44
|
+
this.db.exec("PRAGMA synchronous=NORMAL");
|
|
45
|
+
this.db.exec("PRAGMA busy_timeout=5000");
|
|
46
|
+
} catch {}
|
|
47
|
+
this.db.exec(`CREATE TABLE IF NOT EXISTS event_store (
|
|
48
|
+
event_id TEXT PRIMARY KEY,
|
|
49
|
+
es_type TEXT NOT NULL,
|
|
50
|
+
sender_id TEXT NOT NULL,
|
|
51
|
+
text TEXT,
|
|
52
|
+
metadata TEXT NOT NULL,
|
|
53
|
+
raw_event TEXT,
|
|
54
|
+
created_at INTEGER NOT NULL
|
|
55
|
+
);`);
|
|
56
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_es_sender_time
|
|
57
|
+
ON event_store (es_type, sender_id, created_at DESC);`);
|
|
58
|
+
this.insertStmt = this.db.prepare(`INSERT INTO event_store (event_id, es_type, sender_id, text, metadata, raw_event, created_at)
|
|
59
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`);
|
|
60
|
+
this.getByIdStmt = this.db.prepare(`SELECT event_id, es_type, sender_id, text, metadata, raw_event, created_at
|
|
61
|
+
FROM event_store WHERE event_id = ?`);
|
|
62
|
+
this.recentStmt = this.db.prepare(`SELECT event_id, es_type, sender_id, text, metadata, raw_event, created_at
|
|
63
|
+
FROM event_store
|
|
64
|
+
WHERE es_type = ? AND sender_id = ?
|
|
65
|
+
ORDER BY created_at DESC
|
|
66
|
+
LIMIT ?`);
|
|
67
|
+
}
|
|
68
|
+
async insertTriggerEvent(input, esType) {
|
|
69
|
+
const eventId = `evt_${Date.now()}_${randomUUID()}`;
|
|
70
|
+
const createdAt = Date.now();
|
|
71
|
+
const metadataJson = JSON.stringify(input.metadata ?? {});
|
|
72
|
+
const rawEventJson = input.rawEvent === undefined ? null : safeStringify(input.rawEvent);
|
|
73
|
+
this.insertStmt.run(eventId, esType, input.senderId, input.text ?? null, metadataJson, rawEventJson, createdAt);
|
|
74
|
+
return eventId;
|
|
75
|
+
}
|
|
76
|
+
async getEventById(eventId) {
|
|
77
|
+
const row = this.getByIdStmt.get(eventId);
|
|
78
|
+
if (!row)
|
|
79
|
+
return null;
|
|
80
|
+
return rowToPersistedEvent(row);
|
|
81
|
+
}
|
|
82
|
+
async getRecentEvents(esType, senderId, limit) {
|
|
83
|
+
const rows = this.recentStmt.all(esType, senderId, limit);
|
|
84
|
+
return rows.map((r) => rowToPersistedEvent(r));
|
|
85
|
+
}
|
|
86
|
+
close() {
|
|
87
|
+
this.db.close();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
__legacyDecorateClassTS([
|
|
91
|
+
TracedAs("event_store.insert_trigger", { recordParams: true, recordResult: true })
|
|
92
|
+
], EventStoreImpl.prototype, "insertTriggerEvent", null);
|
|
93
|
+
__legacyDecorateClassTS([
|
|
94
|
+
TracedAs("event_store.query_by_id", { recordParams: true, recordResult: false })
|
|
95
|
+
], EventStoreImpl.prototype, "getEventById", null);
|
|
96
|
+
function rowToPersistedEvent(row) {
|
|
97
|
+
let metadata;
|
|
98
|
+
try {
|
|
99
|
+
metadata = row.metadata ? JSON.parse(row.metadata) : {};
|
|
100
|
+
} catch {
|
|
101
|
+
metadata = {};
|
|
102
|
+
}
|
|
103
|
+
let rawEvent;
|
|
104
|
+
if (row.raw_event) {
|
|
105
|
+
try {
|
|
106
|
+
rawEvent = JSON.parse(row.raw_event);
|
|
107
|
+
} catch {
|
|
108
|
+
rawEvent = null;
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
rawEvent = null;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
eventId: row.event_id,
|
|
115
|
+
esType: row.es_type,
|
|
116
|
+
senderId: row.sender_id,
|
|
117
|
+
text: row.text ?? null,
|
|
118
|
+
metadata,
|
|
119
|
+
rawEvent,
|
|
120
|
+
createdAt: typeof row.created_at === "bigint" ? Number(row.created_at) : row.created_at
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function safeStringify(obj) {
|
|
124
|
+
const seen = new WeakSet;
|
|
125
|
+
try {
|
|
126
|
+
return JSON.stringify(obj, (_key, value) => {
|
|
127
|
+
if (typeof value === "function")
|
|
128
|
+
return "[Function]";
|
|
129
|
+
if (value === undefined)
|
|
130
|
+
return "[undefined]";
|
|
131
|
+
if (value === null)
|
|
132
|
+
return null;
|
|
133
|
+
if (value instanceof Error)
|
|
134
|
+
return `${value.name}: ${value.message}`;
|
|
135
|
+
if (typeof value === "object") {
|
|
136
|
+
if (seen.has(value))
|
|
137
|
+
return "[Circular]";
|
|
138
|
+
seen.add(value);
|
|
139
|
+
}
|
|
140
|
+
if (typeof value === "bigint")
|
|
141
|
+
return value.toString();
|
|
142
|
+
return value;
|
|
143
|
+
});
|
|
144
|
+
} catch {
|
|
145
|
+
return "{}";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
var sharedEventStore = null;
|
|
149
|
+
function setSharedEventStore(store) {
|
|
150
|
+
sharedEventStore = store;
|
|
151
|
+
}
|
|
152
|
+
function getSharedEventStore() {
|
|
153
|
+
return sharedEventStore;
|
|
154
|
+
}
|
|
155
|
+
function resetSharedEventStore() {
|
|
156
|
+
sharedEventStore = null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { EventStoreImpl, setSharedEventStore, getSharedEventStore, resetSharedEventStore };
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
hasDecoratorNodes,
|
|
4
4
|
init_node_registry_helper,
|
|
5
5
|
registerDecoratorNodeType
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-hkj5v9xq.js";
|
|
7
7
|
import"./roy-agent-core-1ce3fqrk.js";
|
|
8
8
|
import"./roy-agent-core-ddwa0n6h.js";
|
|
9
|
-
import"./roy-agent-core-
|
|
9
|
+
import"./roy-agent-core-a9pbda78.js";
|
|
10
10
|
import"./roy-agent-core-8seq65bp.js";
|
|
11
11
|
import"./roy-agent-core-jnszp0jq.js";
|
|
12
12
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_context
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-ff2ssff5.js";
|
|
4
4
|
import {
|
|
5
5
|
getEnvContext
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-z4486eek.js";
|
|
7
7
|
import {
|
|
8
8
|
__esm
|
|
9
9
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
13
13
|
import {
|
|
14
14
|
BaseComponent
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-yv4anf1c.js";
|
|
16
16
|
import {
|
|
17
17
|
TracedAs,
|
|
18
18
|
init_decorator
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
20
20
|
import {
|
|
21
21
|
createLogger,
|
|
22
22
|
init_logger
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createHook
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-y7atw1kw.js";
|
|
4
4
|
import {
|
|
5
5
|
HookManager
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-yjyvwxs4.js";
|
|
7
7
|
|
|
8
8
|
// src/env/component.ts
|
|
9
9
|
class BaseComponent {
|
package/package.json
CHANGED
|
File without changes
|