@agentbean/daemon 0.1.27 → 0.1.28
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/agent-instance.js +4 -1
- package/dist/connection.js +4 -1
- package/dist/post-process.js +1 -1
- package/package.json +1 -1
package/dist/agent-instance.js
CHANGED
|
@@ -51,6 +51,9 @@ function promptWithAttachments(prompt, attachments) {
|
|
|
51
51
|
.join('\n');
|
|
52
52
|
return `${prompt}\n\n用户随消息附加了以下本地文件,请在需要时读取并使用:\n${list}`;
|
|
53
53
|
}
|
|
54
|
+
function promptWithWorkspaceOutput(prompt, outputDir) {
|
|
55
|
+
return `${prompt}\n\n如果本次任务会生成图片、文档、数据或其他文件,请把最终产物保存到这个 AgentBean 输出目录:\n${outputDir}\n保存后在回复中说明文件名即可,系统会自动同步并在聊天中展示预览。`;
|
|
56
|
+
}
|
|
54
57
|
export class AgentInstance {
|
|
55
58
|
config;
|
|
56
59
|
adapter;
|
|
@@ -96,7 +99,7 @@ export class AgentInstance {
|
|
|
96
99
|
let archivedFiles = [];
|
|
97
100
|
try {
|
|
98
101
|
const downloadedAttachments = await downloadAttachments({ serverUrl, token, run, attachments: req.attachments });
|
|
99
|
-
const prompt = promptWithAttachments(req.prompt, downloadedAttachments);
|
|
102
|
+
const prompt = promptWithWorkspaceOutput(promptWithAttachments(req.prompt, downloadedAttachments), run.outputDir);
|
|
100
103
|
const rawBody = await this.adapter.ask({
|
|
101
104
|
prompt,
|
|
102
105
|
history: req.history ?? [],
|
package/dist/connection.js
CHANGED
|
@@ -50,6 +50,9 @@ function promptWithAttachments(prompt, attachments) {
|
|
|
50
50
|
.join('\n');
|
|
51
51
|
return `${prompt}\n\n用户随消息附加了以下本地文件,请在需要时读取并使用:\n${list}`;
|
|
52
52
|
}
|
|
53
|
+
function promptWithWorkspaceOutput(prompt, outputDir) {
|
|
54
|
+
return `${prompt}\n\n如果本次任务会生成图片、文档、数据或其他文件,请把最终产物保存到这个 AgentBean 输出目录:\n${outputDir}\n保存后在回复中说明文件名即可,系统会自动同步并在聊天中展示预览。`;
|
|
55
|
+
}
|
|
53
56
|
export function createConnection(cfg, adapter) {
|
|
54
57
|
let socket = null;
|
|
55
58
|
let heartbeatTimer = null;
|
|
@@ -112,7 +115,7 @@ export function createConnection(cfg, adapter) {
|
|
|
112
115
|
run,
|
|
113
116
|
attachments: req.attachments,
|
|
114
117
|
});
|
|
115
|
-
const prompt = promptWithAttachments(req.prompt, downloadedAttachments);
|
|
118
|
+
const prompt = promptWithWorkspaceOutput(promptWithAttachments(req.prompt, downloadedAttachments), run.outputDir);
|
|
116
119
|
const rawBody = await adapter.ask({
|
|
117
120
|
prompt,
|
|
118
121
|
history: req.history ?? [],
|
package/dist/post-process.js
CHANGED
|
@@ -51,7 +51,7 @@ function normalizeCandidatePath(raw) {
|
|
|
51
51
|
function extractMentionedFiles(reply, workspace, dispatchStart) {
|
|
52
52
|
const candidates = new Set();
|
|
53
53
|
const markdownLinkRe = /!?\[[^\]]*]\(([^)\s]+)\)/g;
|
|
54
|
-
const plainPathRe = /(?:^|[\s"'`(
|
|
54
|
+
const plainPathRe = /(?:^|[\s"'`(<::])((?:~?\/|\.{1,2}\/)?[\w@%+=:,./-]+\.(?:png|jpe?g|gif|webp|svg|pdf|txt|csv|json|md|mp4|mov|zip))(?:$|[\s"'`)>.,;::])/gim;
|
|
55
55
|
let match;
|
|
56
56
|
while ((match = markdownLinkRe.exec(reply)) !== null) {
|
|
57
57
|
const normalized = normalizeCandidatePath(match[1]);
|