@ai-setting/roy-agent-core 1.7.76 → 1.7.77
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/env/agent/agent-component.js +2 -2
- package/dist/env/agent/index.js +2 -2
- package/dist/env/event-source/event-source-handlers.js +6 -6
- package/dist/env/event-source/index.js +7 -7
- package/dist/env/index.js +11 -11
- package/dist/env/task/backend/index.js +37 -1
- package/dist/env/task/backend/task-store-backend.d.ts +12 -0
- package/dist/env/task/backend/types.d.ts +19 -0
- package/dist/env/task/index.js +3 -3
- package/dist/env/task/mcp/index.js +3 -0
- package/dist/env/task/mcp/task-mcp-server.d.ts +1 -1
- package/dist/env/task/plugins/fake-user-message-helper.d.ts +10 -2
- package/dist/env/task/plugins/index.d.ts +1 -0
- package/dist/env/task/plugins/index.js +15 -4
- package/dist/env/task/plugins/lark-card-patch-notifier.js +1 -1
- package/dist/env/task/plugins/task-op-watermark-plugin.d.ts +112 -0
- package/dist/env/task/storage/index.js +2 -2
- package/dist/env/task/storage/sqlite-task-store.d.ts +54 -0
- package/dist/env/task/task-component.d.ts +16 -0
- package/dist/env/task/tools/operation/operation-types.d.ts +13 -13
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/types/event.d.ts +4 -4
- package/dist/index.js +11 -11
- package/dist/shared/@ai-setting/{roy-agent-core-cxy143m4.js → roy-agent-core-0v27y99n.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-t3rrb959.js → roy-agent-core-3gpygqcx.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-q5r75vev.js → roy-agent-core-9vhq7fvv.js} +5 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zycadbpx.js → roy-agent-core-ew6qb5yx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-abqhkbn3.js → roy-agent-core-ezvpreqz.js} +23 -0
- package/dist/shared/@ai-setting/roy-agent-core-h21gngxf.js +247 -0
- package/dist/shared/@ai-setting/{roy-agent-core-p3zv1mx5.js → roy-agent-core-hd3n57zs.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ntq0gz7q.js → roy-agent-core-q813vafd.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-z43aj03k.js → roy-agent-core-rhtdspx6.js} +20 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ghnagzrh.js → roy-agent-core-rsn44n9y.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-nmx9934r.js → roy-agent-core-w0qjeq2v.js} +1 -1
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-f77k3gqt.js +0 -71
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
import {
|
|
38
38
|
SQLiteTaskStore,
|
|
39
39
|
getDefaultTaskDbPath
|
|
40
|
-
} from "./roy-agent-core-
|
|
40
|
+
} from "./roy-agent-core-ezvpreqz.js";
|
|
41
41
|
import {
|
|
42
42
|
TaskHookPoints
|
|
43
43
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -471,6 +471,15 @@ class TaskComponent extends BaseComponent {
|
|
|
471
471
|
async getTaskIdBySessionId(sessionId) {
|
|
472
472
|
return this.store.getTaskIdBySessionId(sessionId);
|
|
473
473
|
}
|
|
474
|
+
async getTaskIdsBySessionId(sessionId) {
|
|
475
|
+
const store = this.store;
|
|
476
|
+
if (typeof store.getTaskIdsBySessionId === "function") {
|
|
477
|
+
const ids = await store.getTaskIdsBySessionId(sessionId);
|
|
478
|
+
return Array.isArray(ids) ? ids : [];
|
|
479
|
+
}
|
|
480
|
+
const first = await this.store.getTaskIdBySessionId(sessionId);
|
|
481
|
+
return typeof first === "number" ? [first] : [];
|
|
482
|
+
}
|
|
474
483
|
async getTaskWithOperations(id) {
|
|
475
484
|
const task = await this.store.getTask(id);
|
|
476
485
|
if (!task)
|
|
@@ -676,6 +685,16 @@ class TaskComponent extends BaseComponent {
|
|
|
676
685
|
async listOperations(options) {
|
|
677
686
|
return this.store.listOperations(options);
|
|
678
687
|
}
|
|
688
|
+
async listOperationsFresh(options) {
|
|
689
|
+
const store = this.store;
|
|
690
|
+
if (typeof store.listOperationsFresh === "function") {
|
|
691
|
+
return await store.listOperationsFresh(options);
|
|
692
|
+
}
|
|
693
|
+
if (typeof store.invalidateOperationsCache === "function") {
|
|
694
|
+
store.invalidateOperationsCache(options.taskId);
|
|
695
|
+
}
|
|
696
|
+
return await this.store.listOperations(options);
|
|
697
|
+
}
|
|
679
698
|
getTagService() {
|
|
680
699
|
return this.tagService;
|
|
681
700
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
createCompatibleDatabase,
|
|
9
9
|
init_sqlite_task_store
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-ezvpreqz.js";
|
|
11
11
|
import {
|
|
12
12
|
TaskHookPoints
|
|
13
13
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -24,13 +24,13 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
LarkCardPatchNotifier,
|
|
26
26
|
humanizeValue
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-w0qjeq2v.js";
|
|
28
28
|
import {
|
|
29
29
|
validateWorkflowDefinition
|
|
30
30
|
} from "./roy-agent-core-1v4g0d4x.js";
|
|
31
31
|
import {
|
|
32
32
|
enqueueToAddFakeUserMessage
|
|
33
|
-
} from "./roy-agent-core-
|
|
33
|
+
} from "./roy-agent-core-h21gngxf.js";
|
|
34
34
|
import {
|
|
35
35
|
BasePlugin
|
|
36
36
|
} from "./roy-agent-core-az13yzmc.js";
|
|
@@ -60,7 +60,7 @@ function sanitizeInlineText(text, maxLen = 300) {
|
|
|
60
60
|
if (!text)
|
|
61
61
|
return "";
|
|
62
62
|
const flat = text.replace(/\r\n?/g, `
|
|
63
|
-
`).replace(/^#{1,6}\s+/gm, "").replace(/^\s*[-*+]\s+/gm, "· ").replace(/^\s*\d+\.\s+/gm, "· ").replace(/\*\*/g, "").replace(/`/g, "").replace(/\n+/g, " · ").replace(/\s{2,}/g, " ").replace(/(?:\s*·\s*){2,}/g, " · ").replace(/^(\s*·\s*)+/, "").replace(/(\s*·\s*)+$/, "").trim();
|
|
63
|
+
`).replace(/^#{1,6}\s+/gm, "").replace(/!\[([^\]]*)\]\([^)]*\)/g, (_m, alt) => alt.trim() ? `${alt.trim()}[图片]` : "[图片]").replace(/^\s*[-*+]\s+/gm, "· ").replace(/^\s*\d+\.\s+/gm, "· ").replace(/\*\*/g, "").replace(/`/g, "").replace(/\n+/g, " · ").replace(/\s{2,}/g, " ").replace(/(?:\s*·\s*){2,}/g, " · ").replace(/^(\s*·\s*)+/, "").replace(/(\s*·\s*)+$/, "").trim();
|
|
64
64
|
return flat.length <= maxLen ? flat : `${flat.slice(0, maxLen)}…`;
|
|
65
65
|
}
|
|
66
66
|
var HEAD_TITLE_MAX_WIDTH = 40;
|
package/package.json
CHANGED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_decorator,
|
|
3
|
-
wrapFunction
|
|
4
|
-
} from "./roy-agent-core-qq96p0tj.js";
|
|
5
|
-
|
|
6
|
-
// src/env/task/plugins/fake-user-message-helper.ts
|
|
7
|
-
init_decorator();
|
|
8
|
-
var KIND_FIELD = "__fakeUserMessageKind";
|
|
9
|
-
function ensureMetadata(toolResult) {
|
|
10
|
-
if (!toolResult)
|
|
11
|
-
return;
|
|
12
|
-
if (!toolResult.result)
|
|
13
|
-
toolResult.result = {};
|
|
14
|
-
if (!toolResult.result.metadata)
|
|
15
|
-
toolResult.result.metadata = {};
|
|
16
|
-
return toolResult.result.metadata;
|
|
17
|
-
}
|
|
18
|
-
function stringContent(msg) {
|
|
19
|
-
const c = msg?.content;
|
|
20
|
-
return typeof c === "string" ? c : JSON.stringify(c);
|
|
21
|
-
}
|
|
22
|
-
function enqueueToAddFakeUserMessageImpl(toolResult, newMsg, newKind) {
|
|
23
|
-
const meta = ensureMetadata(toolResult);
|
|
24
|
-
if (!meta)
|
|
25
|
-
return { willMerge: false, finalKind: newKind };
|
|
26
|
-
const existing = meta.toAddFakeUserMessage;
|
|
27
|
-
const existingKind = meta[KIND_FIELD];
|
|
28
|
-
if (!existing) {
|
|
29
|
-
meta.toAddFakeUserMessage = newMsg;
|
|
30
|
-
meta[KIND_FIELD] = newKind;
|
|
31
|
-
return { willMerge: false, finalKind: newKind };
|
|
32
|
-
}
|
|
33
|
-
let merged;
|
|
34
|
-
if (newKind === "max-iter") {
|
|
35
|
-
merged = {
|
|
36
|
-
role: "user",
|
|
37
|
-
content: `${stringContent(existing)}
|
|
38
|
-
|
|
39
|
-
${stringContent(newMsg)}`
|
|
40
|
-
};
|
|
41
|
-
} else if (newKind === "delegate" && existingKind === "max-iter") {
|
|
42
|
-
merged = {
|
|
43
|
-
role: "user",
|
|
44
|
-
content: `${stringContent(newMsg)}
|
|
45
|
-
|
|
46
|
-
${stringContent(existing)}`
|
|
47
|
-
};
|
|
48
|
-
} else {
|
|
49
|
-
merged = {
|
|
50
|
-
role: "user",
|
|
51
|
-
content: `${stringContent(existing)}
|
|
52
|
-
|
|
53
|
-
${stringContent(newMsg)}`
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
meta.toAddFakeUserMessage = merged;
|
|
57
|
-
const finalKind = newKind === "max-iter" || existingKind === "max-iter" ? "max-iter" : newKind;
|
|
58
|
-
meta[KIND_FIELD] = finalKind;
|
|
59
|
-
return { willMerge: true, finalKind };
|
|
60
|
-
}
|
|
61
|
-
var enqueueToAddFakeUserMessage = wrapFunction(enqueueToAddFakeUserMessageImpl, "plugin.fake-user-message.enqueue", {
|
|
62
|
-
recordParams: false,
|
|
63
|
-
recordResult: false,
|
|
64
|
-
log: true,
|
|
65
|
-
resultFilter: (result) => ({
|
|
66
|
-
"fake-user-message.will_merge": result.willMerge,
|
|
67
|
-
"fake-user-message.final_kind": result.finalKind
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export { enqueueToAddFakeUserMessage };
|