@ai-setting/roy-agent-core 1.5.13-test → 1.5.15-test
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/package.json +1 -1
- package/dist/config/index.d.ts +0 -1250
- package/dist/config/index.js +0 -32
- package/dist/env/agent/index.d.ts +0 -2279
- package/dist/env/agent/index.js +0 -24
- package/dist/env/commands/index.d.ts +0 -1131
- package/dist/env/commands/index.js +0 -14
- package/dist/env/debug/formatters/index.d.ts +0 -236
- package/dist/env/debug/formatters/index.js +0 -11
- package/dist/env/debug/index.d.ts +0 -1652
- package/dist/env/debug/index.js +0 -26
- package/dist/env/hook/index.d.ts +0 -279
- package/dist/env/hook/index.js +0 -29
- package/dist/env/index.d.ts +0 -3481
- package/dist/env/index.js +0 -82
- package/dist/env/llm/index.d.ts +0 -1760
- package/dist/env/llm/index.js +0 -40
- package/dist/env/log-trace/index.d.ts +0 -1574
- package/dist/env/log-trace/index.js +0 -83
- package/dist/env/mcp/index.d.ts +0 -1331
- package/dist/env/mcp/index.js +0 -39
- package/dist/env/mcp/tool/index.d.ts +0 -183
- package/dist/env/mcp/tool/index.js +0 -14
- package/dist/env/memory/built-in/index.d.ts +0 -232
- package/dist/env/memory/built-in/index.js +0 -11
- package/dist/env/memory/index.d.ts +0 -1799
- package/dist/env/memory/index.js +0 -56
- package/dist/env/memory/plugin/index.d.ts +0 -747
- package/dist/env/memory/plugin/index.js +0 -36
- package/dist/env/prompt/index.d.ts +0 -1164
- package/dist/env/prompt/index.js +0 -20
- package/dist/env/session/index.d.ts +0 -1908
- package/dist/env/session/index.js +0 -25
- package/dist/env/session/storage/index.d.ts +0 -564
- package/dist/env/session/storage/index.js +0 -18
- package/dist/env/skill/index.d.ts +0 -1266
- package/dist/env/skill/index.js +0 -34
- package/dist/env/skill/tool/index.d.ts +0 -193
- package/dist/env/skill/tool/index.js +0 -9
- package/dist/env/task/delegate/index.d.ts +0 -1612
- package/dist/env/task/delegate/index.js +0 -18
- package/dist/env/task/events/index.d.ts +0 -171
- package/dist/env/task/events/index.js +0 -7
- package/dist/env/task/hooks/index.d.ts +0 -624
- package/dist/env/task/hooks/index.js +0 -7
- package/dist/env/task/index.d.ts +0 -1553
- package/dist/env/task/index.js +0 -34
- package/dist/env/task/plugins/index.d.ts +0 -466
- package/dist/env/task/plugins/index.js +0 -23
- package/dist/env/task/storage/index.d.ts +0 -241
- package/dist/env/task/storage/index.js +0 -14
- package/dist/env/task/tools/index.d.ts +0 -1485
- package/dist/env/task/tools/index.js +0 -17
- package/dist/env/task/tools/operation/index.d.ts +0 -1484
- package/dist/env/task/tools/operation/index.js +0 -15
- package/dist/env/tool/built-in/index.d.ts +0 -218
- package/dist/env/tool/built-in/index.js +0 -25
- package/dist/env/tool/index.d.ts +0 -1396
- package/dist/env/tool/index.js +0 -39
- package/dist/env/workflow/decorators/index.d.ts +0 -2161
- package/dist/env/workflow/decorators/index.js +0 -27
- package/dist/env/workflow/engine/index.d.ts +0 -3453
- package/dist/env/workflow/engine/index.js +0 -28
- package/dist/env/workflow/index.d.ts +0 -3546
- package/dist/env/workflow/index.js +0 -136
- package/dist/env/workflow/nodes/index.d.ts +0 -2092
- package/dist/env/workflow/nodes/index.js +0 -19
- package/dist/env/workflow/service/index.d.ts +0 -227
- package/dist/env/workflow/service/index.js +0 -13
- package/dist/env/workflow/storage/index.d.ts +0 -165
- package/dist/env/workflow/storage/index.js +0 -27
- package/dist/env/workflow/tools/index.d.ts +0 -416
- package/dist/env/workflow/tools/index.js +0 -159
- package/dist/env/workflow/types/index.d.ts +0 -2255
- package/dist/env/workflow/types/index.js +0 -98
- package/dist/env/workflow/utils/index.d.ts +0 -2031
- package/dist/env/workflow/utils/index.js +0 -637
- package/dist/index.d.ts +0 -7858
- package/dist/index.js +0 -399
- package/dist/shared/@ai-setting/roy-agent-core-0rtxwr28.js +0 -258
- package/dist/shared/@ai-setting/roy-agent-core-0vbdz0x7.js +0 -36
- package/dist/shared/@ai-setting/roy-agent-core-1akcqxj9.js +0 -349
- package/dist/shared/@ai-setting/roy-agent-core-1ce3fqrk.js +0 -117
- package/dist/shared/@ai-setting/roy-agent-core-2dhd60aw.js +0 -11
- package/dist/shared/@ai-setting/roy-agent-core-3jywqmdd.js +0 -393
- package/dist/shared/@ai-setting/roy-agent-core-3rr5k71j.js +0 -200
- package/dist/shared/@ai-setting/roy-agent-core-44hnfb02.js +0 -299
- package/dist/shared/@ai-setting/roy-agent-core-4t40mkpv.js +0 -206
- package/dist/shared/@ai-setting/roy-agent-core-4txzpsbt.js +0 -393
- package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +0 -350
- package/dist/shared/@ai-setting/roy-agent-core-69jskqjg.js +0 -180
- package/dist/shared/@ai-setting/roy-agent-core-6kvtahqv.js +0 -408
- package/dist/shared/@ai-setting/roy-agent-core-7fgf85wc.js +0 -284
- package/dist/shared/@ai-setting/roy-agent-core-81w1963m.js +0 -762
- package/dist/shared/@ai-setting/roy-agent-core-8gxth0eh.js +0 -10
- package/dist/shared/@ai-setting/roy-agent-core-92z6t4he.js +0 -14
- package/dist/shared/@ai-setting/roy-agent-core-93zfb3r1.js +0 -922
- package/dist/shared/@ai-setting/roy-agent-core-9yxb3ty9.js +0 -15
- package/dist/shared/@ai-setting/roy-agent-core-b0x5dda6.js +0 -1130
- package/dist/shared/@ai-setting/roy-agent-core-bcbqy27c.js +0 -14
- package/dist/shared/@ai-setting/roy-agent-core-bvr1761x.js +0 -653
- package/dist/shared/@ai-setting/roy-agent-core-ctdhjv68.js +0 -93
- package/dist/shared/@ai-setting/roy-agent-core-d7cyjkf7.js +0 -872
- package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +0 -11
- package/dist/shared/@ai-setting/roy-agent-core-e25xkv53.js +0 -64
- package/dist/shared/@ai-setting/roy-agent-core-eajcvp4e.js +0 -378
- package/dist/shared/@ai-setting/roy-agent-core-f7q2x5z6.js +0 -492
- package/dist/shared/@ai-setting/roy-agent-core-fs0mn2jk.js +0 -52
- package/dist/shared/@ai-setting/roy-agent-core-g1s2h0e5.js +0 -171
- package/dist/shared/@ai-setting/roy-agent-core-g99pxzn5.js +0 -862
- package/dist/shared/@ai-setting/roy-agent-core-gbqcyegm.js +0 -1387
- package/dist/shared/@ai-setting/roy-agent-core-gjq1yk68.js +0 -208
- package/dist/shared/@ai-setting/roy-agent-core-gq20wsgv.js +0 -139
- package/dist/shared/@ai-setting/roy-agent-core-gwc4h96n.js +0 -534
- package/dist/shared/@ai-setting/roy-agent-core-jfh9q2qh.js +0 -204
- package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +0 -603
- package/dist/shared/@ai-setting/roy-agent-core-kkbwepqb.js +0 -97
- package/dist/shared/@ai-setting/roy-agent-core-pjr12nnd.js +0 -587
- package/dist/shared/@ai-setting/roy-agent-core-psv4v63c.js +0 -176
- package/dist/shared/@ai-setting/roy-agent-core-psvxt4c9.js +0 -60
- package/dist/shared/@ai-setting/roy-agent-core-qqceba6k.js +0 -442
- package/dist/shared/@ai-setting/roy-agent-core-qxhq8ven.js +0 -57
- package/dist/shared/@ai-setting/roy-agent-core-qxnbvgwe.js +0 -66
- package/dist/shared/@ai-setting/roy-agent-core-r9ezzemr.js +0 -10
- package/dist/shared/@ai-setting/roy-agent-core-rhmtwnw1.js +0 -267
- package/dist/shared/@ai-setting/roy-agent-core-rvv6ydff.js +0 -584
- package/dist/shared/@ai-setting/roy-agent-core-rvxg1wps.js +0 -102
- package/dist/shared/@ai-setting/roy-agent-core-satmq6sh.js +0 -549
- package/dist/shared/@ai-setting/roy-agent-core-sx7wsvnn.js +0 -15
- package/dist/shared/@ai-setting/roy-agent-core-t94ktchq.js +0 -213
- package/dist/shared/@ai-setting/roy-agent-core-vf215qfv.js +0 -812
- package/dist/shared/@ai-setting/roy-agent-core-vkz81f7v.js +0 -1316
- package/dist/shared/@ai-setting/roy-agent-core-vn2bc59q.js +0 -1205
- package/dist/shared/@ai-setting/roy-agent-core-wa1kzqky.js +0 -328
- package/dist/shared/@ai-setting/roy-agent-core-wft9ra24.js +0 -20
- package/dist/shared/@ai-setting/roy-agent-core-wrcy0h6z.js +0 -2098
- package/dist/shared/@ai-setting/roy-agent-core-xq8hhqb8.js +0 -419
- package/dist/shared/@ai-setting/roy-agent-core-xs5rsgat.js +0 -368
- package/dist/shared/@ai-setting/roy-agent-core-zbkpc41z.js +0 -377
- package/dist/shared/@ai-setting/roy-agent-core-zgypchmt.js +0 -172
- package/dist/shared/@ai-setting/roy-agent-core-zpn0bqa8.js +0 -103
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TracedAs,
|
|
3
|
-
init_decorator
|
|
4
|
-
} from "./roy-agent-core-zgypchmt.js";
|
|
5
|
-
import {
|
|
6
|
-
__legacyDecorateClassTS
|
|
7
|
-
} from "./roy-agent-core-fs0mn2jk.js";
|
|
8
|
-
|
|
9
|
-
// src/env/session/session-message-converter.ts
|
|
10
|
-
init_decorator();
|
|
11
|
-
import { randomUUID } from "crypto";
|
|
12
|
-
var DEFAULT_REASONING_BUDGET_TOKENS = 1e4;
|
|
13
|
-
|
|
14
|
-
class SessionMessageConverter {
|
|
15
|
-
toModelMessage(msg) {
|
|
16
|
-
if (msg.role === "assistant") {
|
|
17
|
-
const content = [];
|
|
18
|
-
for (const part of msg.parts || []) {
|
|
19
|
-
if (part.type === "text") {
|
|
20
|
-
const textPart = part;
|
|
21
|
-
content.push({
|
|
22
|
-
type: "text",
|
|
23
|
-
text: textPart.content,
|
|
24
|
-
...textPart.synthetic !== undefined && { synthetic: textPart.synthetic }
|
|
25
|
-
});
|
|
26
|
-
} else if (part.type === "reasoning") {
|
|
27
|
-
const reasoningPart = part;
|
|
28
|
-
content.push({
|
|
29
|
-
type: "reasoning",
|
|
30
|
-
text: reasoningPart.content,
|
|
31
|
-
reasoningType: reasoningPart.reasoningType
|
|
32
|
-
});
|
|
33
|
-
} else if (part.type === "tool-call") {
|
|
34
|
-
const toolPart = part;
|
|
35
|
-
let parsedArgs = {};
|
|
36
|
-
if (typeof toolPart.arguments === "string") {
|
|
37
|
-
try {
|
|
38
|
-
parsedArgs = JSON.parse(toolPart.arguments);
|
|
39
|
-
} catch {
|
|
40
|
-
parsedArgs = { _raw: toolPart.arguments };
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
parsedArgs = toolPart.arguments;
|
|
44
|
-
}
|
|
45
|
-
content.push({
|
|
46
|
-
type: "tool-call",
|
|
47
|
-
toolCallId: toolPart.toolCallId,
|
|
48
|
-
toolName: toolPart.toolName,
|
|
49
|
-
input: parsedArgs
|
|
50
|
-
});
|
|
51
|
-
} else if (part.type === "file") {
|
|
52
|
-
const filePart = part;
|
|
53
|
-
content.push({
|
|
54
|
-
type: "file",
|
|
55
|
-
url: filePart.url,
|
|
56
|
-
mimeType: filePart.mime,
|
|
57
|
-
filename: filePart.filename
|
|
58
|
-
});
|
|
59
|
-
} else if (part.type === "tool-result" || part.type === "checkpoint") {} else {
|
|
60
|
-
console.debug(`[session-message-converter] Skipping unsupported part type in assistant: ${part.type}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (content.length === 0 && msg.content) {
|
|
64
|
-
return { role: "assistant", content: msg.content };
|
|
65
|
-
}
|
|
66
|
-
return { role: "assistant", content };
|
|
67
|
-
}
|
|
68
|
-
if (msg.role === "tool") {
|
|
69
|
-
const toolPart = msg.parts?.find((p) => p.type === "tool-result");
|
|
70
|
-
return {
|
|
71
|
-
role: "tool",
|
|
72
|
-
content: [{
|
|
73
|
-
type: "tool-result",
|
|
74
|
-
toolCallId: toolPart?.toolCallId || "",
|
|
75
|
-
toolName: toolPart?.toolName || "",
|
|
76
|
-
output: toolPart?.output || msg.content || ""
|
|
77
|
-
}]
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
role: msg.role,
|
|
82
|
-
content: msg.content || ""
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
fromModelMessage(aiMsg, options) {
|
|
86
|
-
const parts = [];
|
|
87
|
-
const content = typeof aiMsg.content === "string" || Array.isArray(aiMsg.content) ? aiMsg.content : "";
|
|
88
|
-
let hasToolCallPart = false;
|
|
89
|
-
let hasToolResultPart = false;
|
|
90
|
-
if (typeof content === "string") {
|
|
91
|
-
parts.push({ type: "text", content });
|
|
92
|
-
} else if (Array.isArray(content)) {
|
|
93
|
-
for (const part of content) {
|
|
94
|
-
const p = part;
|
|
95
|
-
if (p.type === "text") {
|
|
96
|
-
parts.push({ type: "text", content: p.text || "" });
|
|
97
|
-
} else if (p.type === "reasoning") {
|
|
98
|
-
parts.push({
|
|
99
|
-
type: "reasoning",
|
|
100
|
-
content: p.text || "",
|
|
101
|
-
reasoningType: p.reasoningType,
|
|
102
|
-
state: "completed"
|
|
103
|
-
});
|
|
104
|
-
} else if (p.type === "tool-call") {
|
|
105
|
-
hasToolCallPart = true;
|
|
106
|
-
parts.push({
|
|
107
|
-
type: "tool-call",
|
|
108
|
-
toolCallId: p.toolCallId,
|
|
109
|
-
toolName: p.toolName,
|
|
110
|
-
arguments: p.input,
|
|
111
|
-
state: "pending"
|
|
112
|
-
});
|
|
113
|
-
} else if (p.type === "tool-result") {
|
|
114
|
-
hasToolResultPart = true;
|
|
115
|
-
parts.push({
|
|
116
|
-
type: "tool-result",
|
|
117
|
-
toolCallId: p.toolCallId,
|
|
118
|
-
toolName: p.toolName,
|
|
119
|
-
output: typeof p.output === "string" ? p.output : JSON.stringify(p.output),
|
|
120
|
-
state: "completed"
|
|
121
|
-
});
|
|
122
|
-
} else if (p.type === "file") {
|
|
123
|
-
parts.push({
|
|
124
|
-
type: "file",
|
|
125
|
-
mime: p.mimeType || "application/octet-stream",
|
|
126
|
-
url: p.url,
|
|
127
|
-
filename: p.filename
|
|
128
|
-
});
|
|
129
|
-
} else {
|
|
130
|
-
console.debug(`[session-message-converter] Unknown part type: ${p.type}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
let metadataType;
|
|
135
|
-
if (aiMsg.role === "assistant" && hasToolCallPart) {
|
|
136
|
-
metadataType = "tool_call";
|
|
137
|
-
} else if (aiMsg.role === "tool") {
|
|
138
|
-
metadataType = "tool_result";
|
|
139
|
-
}
|
|
140
|
-
const result = {
|
|
141
|
-
id: options?.messageID || `msg_${randomUUID()}`,
|
|
142
|
-
sessionID: options?.sessionID || "",
|
|
143
|
-
role: aiMsg.role,
|
|
144
|
-
timestamp: Date.now(),
|
|
145
|
-
parts,
|
|
146
|
-
content: typeof content === "string" ? content : ""
|
|
147
|
-
};
|
|
148
|
-
if (metadataType) {
|
|
149
|
-
result.metadata = { type: metadataType };
|
|
150
|
-
}
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
sessionToHistory(messages) {
|
|
154
|
-
return messages.filter((msg) => !msg.metadata?.isArchived && !msg.isArchived).map((msg) => this.toModelMessage(msg));
|
|
155
|
-
}
|
|
156
|
-
extractProviderOptions(msg) {
|
|
157
|
-
const options = {};
|
|
158
|
-
const reasoningParts = msg.parts?.filter((p) => p.type === "reasoning");
|
|
159
|
-
if (reasoningParts && reasoningParts.length > 0) {
|
|
160
|
-
const firstReasoning = reasoningParts[0];
|
|
161
|
-
if (firstReasoning.reasoningType) {
|
|
162
|
-
options.openai = {
|
|
163
|
-
thinking: {
|
|
164
|
-
type: firstReasoning.reasoningType === "effort" ? "extended" : "core"
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
if (firstReasoning.reasoningType === "effort") {
|
|
168
|
-
const budgetTokens = firstReasoning.metadata?.tokenCount || DEFAULT_REASONING_BUDGET_TOKENS;
|
|
169
|
-
options.anthropic = {
|
|
170
|
-
thinking: {
|
|
171
|
-
type: "enabled",
|
|
172
|
-
budgetTokens
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return options;
|
|
179
|
-
}
|
|
180
|
-
migrateMessage(oldMsg) {
|
|
181
|
-
if (oldMsg.parts && oldMsg.parts.length > 0) {
|
|
182
|
-
const firstPart = oldMsg.parts[0];
|
|
183
|
-
if (firstPart && typeof firstPart.type === "string" && firstPart.type.length > 0) {
|
|
184
|
-
return {
|
|
185
|
-
...oldMsg,
|
|
186
|
-
content: oldMsg.content || ""
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return {
|
|
191
|
-
...oldMsg,
|
|
192
|
-
content: oldMsg.content || "",
|
|
193
|
-
parts: oldMsg.content ? [{ type: "text", content: oldMsg.content }] : []
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
__legacyDecorateClassTS([
|
|
198
|
-
TracedAs("session-message-converter.toModelMessage", { recordParams: true, recordResult: true, log: true })
|
|
199
|
-
], SessionMessageConverter.prototype, "toModelMessage", null);
|
|
200
|
-
__legacyDecorateClassTS([
|
|
201
|
-
TracedAs("session-message-converter.fromModelMessage", { recordParams: true, recordResult: true, log: true })
|
|
202
|
-
], SessionMessageConverter.prototype, "fromModelMessage", null);
|
|
203
|
-
|
|
204
|
-
export { SessionMessageConverter };
|