@ai-setting/roy-agent-core 1.7.48 → 1.7.49
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 +13 -13
- 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 +8 -7
- package/dist/env/skill/index.js +7 -7
- package/dist/env/task/delegate/index.js +7 -7
- package/dist/env/task/index.js +12 -12
- package/dist/env/task/plugins/index.js +8 -8
- 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 +10 -9
- package/dist/env/workflow/index.js +18 -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 +12 -11
- package/dist/env/workflow/utils/index.js +4 -4
- package/dist/index.js +43 -42
- package/dist/shared/@ai-setting/{roy-agent-core-dabnevwe.js → roy-agent-core-1pjct4nj.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-qvaqmj3f.js → roy-agent-core-2bbj3jqd.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0r90298w.js → roy-agent-core-3ajh3cdj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-v5vs1jby.js → roy-agent-core-48f17g3x.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hxazjj4p.js → roy-agent-core-56j2q0w6.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4cj6hram.js → roy-agent-core-5hjtbvxf.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4m02hnqf.js → roy-agent-core-5ja22qkf.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ajtsk20z.js → roy-agent-core-5vf48m39.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-4kbvfnn1.js → roy-agent-core-8pqq9yjt.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6vbgswjw.js → roy-agent-core-98wwn2px.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vsrfzaze.js → roy-agent-core-azdsyhvx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-a9pbda78.js → roy-agent-core-bt6h398s.js} +18 -3
- package/dist/shared/@ai-setting/{roy-agent-core-yjjqm4ww.js → roy-agent-core-c0mnxxck.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-y1n63tse.js → roy-agent-core-cnsjr3ws.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-9qn92jhf.js → roy-agent-core-e2569ptp.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-9cqpdrnk.js → roy-agent-core-e302nvzt.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-ygnva439.js → roy-agent-core-ecb8am8s.js} +6 -5
- package/dist/shared/@ai-setting/{roy-agent-core-za09t5g3.js → roy-agent-core-ed4tbkyj.js} +6 -4
- package/dist/shared/@ai-setting/{roy-agent-core-wn59p0zw.js → roy-agent-core-emjpkx9s.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-1rm32m5t.js → roy-agent-core-f51kwn6m.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-zbb3sk72.js → roy-agent-core-fm77q3tn.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-yjqj3taz.js → roy-agent-core-hqtp5m8v.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-pd0exvnq.js → roy-agent-core-j783tcqb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-amp8qckb.js → roy-agent-core-k0mx0tkh.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nvcqp6p9.js → roy-agent-core-k0sy76cw.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-zrgaemma.js → roy-agent-core-kazn764f.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-54wzmvnb.js → roy-agent-core-khx0h4j2.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-gy1zfe0d.js → roy-agent-core-m9drr1fd.js} +76 -13
- package/dist/shared/@ai-setting/{roy-agent-core-3j4by8rj.js → roy-agent-core-mqaht7mm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-rgpkygbc.js → roy-agent-core-ncaqkyfj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-p1p9mr8f.js → roy-agent-core-rqyxdrxg.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7p5zf8ay.js → roy-agent-core-sea232w4.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-5j4awbgc.js → roy-agent-core-trd6my5j.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-tm57tmds.js → roy-agent-core-v2d0bt7e.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-bjrtwfta.js → roy-agent-core-v6zdngr7.js} +27 -11
- package/dist/shared/@ai-setting/{roy-agent-core-3b2ceffs.js → roy-agent-core-vrj9c5y6.js} +44 -76
- package/dist/shared/@ai-setting/{roy-agent-core-8nv07zgr.js → roy-agent-core-wt37tszm.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-83mk8wrn.js → roy-agent-core-x8ebdrtn.js} +8 -6
- package/dist/shared/@ai-setting/{roy-agent-core-jfptxs4f.js → roy-agent-core-xmfyt3dg.js} +6 -2
- package/dist/shared/@ai-setting/{roy-agent-core-ead21w5c.js → roy-agent-core-xn12d221.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-y1fp2mgf.js → roy-agent-core-xvf97xs4.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-55hkeft7.js → roy-agent-core-ydwtpzyf.js} +26 -6
- package/dist/shared/@ai-setting/{roy-agent-core-333apxaa.js → roy-agent-core-yes3mr8n.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hkj5v9xq.js → roy-agent-core-yge38dkn.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4nnv0dze.js → roy-agent-core-yq45m8mm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-d94ddn0r.js → roy-agent-core-zc9k2n3c.js} +7 -6
- package/dist/shared/@ai-setting/roy-agent-core-ze068vc9.js +37 -0
- package/dist/shared/@ai-setting/{roy-agent-core-xyys5m1a.js → roy-agent-core-zff8vvs5.js} +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_context
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-emjpkx9s.js";
|
|
4
4
|
import {
|
|
5
5
|
getEnvContext
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
7
7
|
import {
|
|
8
8
|
__esm
|
|
9
9
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
exports_node_registry_helper,
|
|
3
3
|
init_node_registry_helper
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-yge38dkn.js";
|
|
5
5
|
import {
|
|
6
6
|
askUserTool,
|
|
7
7
|
createRunWorkflowTool,
|
|
@@ -13,18 +13,18 @@ import {
|
|
|
13
13
|
createWorkflowSearchTool,
|
|
14
14
|
createWorkflowTagListTool,
|
|
15
15
|
createWorkflowValidateTool
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-kazn764f.js";
|
|
17
17
|
import {
|
|
18
18
|
WorkflowService
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-wt37tszm.js";
|
|
20
20
|
import {
|
|
21
21
|
WorkflowEngine,
|
|
22
22
|
exports_engine,
|
|
23
23
|
init_engine
|
|
24
|
-
} from "./roy-agent-core-
|
|
24
|
+
} from "./roy-agent-core-1pjct4nj.js";
|
|
25
25
|
import {
|
|
26
26
|
BaseComponent
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
28
28
|
import {
|
|
29
29
|
createLogger,
|
|
30
30
|
init_logger
|
|
@@ -104,7 +104,7 @@ class WorkflowComponent extends BaseComponent {
|
|
|
104
104
|
return;
|
|
105
105
|
try {
|
|
106
106
|
const { NodeRegistry } = await import("../../env/workflow/engine/index.js");
|
|
107
|
-
const { registerDecoratorNodeType: registerDecoratorNodeType2 } = await import("./roy-agent-core-
|
|
107
|
+
const { registerDecoratorNodeType: registerDecoratorNodeType2 } = await import("./roy-agent-core-cnsjr3ws.js");
|
|
108
108
|
this.nodeRegistry = new NodeRegistry;
|
|
109
109
|
registerDecoratorNodeType2(this.nodeRegistry);
|
|
110
110
|
this.decoratorsRegistered = true;
|
|
@@ -134,14 +134,14 @@ class WorkflowComponent extends BaseComponent {
|
|
|
134
134
|
}
|
|
135
135
|
async runWorkflow(definition, input, options) {
|
|
136
136
|
const { NodeRegistry } = await import("../../env/workflow/engine/index.js");
|
|
137
|
-
const { registerDecoratorNodeType: registerDecoratorNodeType2 } = await import("./roy-agent-core-
|
|
137
|
+
const { registerDecoratorNodeType: registerDecoratorNodeType2 } = await import("./roy-agent-core-cnsjr3ws.js");
|
|
138
138
|
const toolComponent = this.toolComponent || this._workflowEnv?.getComponent("tool");
|
|
139
139
|
const skillComponent = this._workflowEnv?.getComponent("skill");
|
|
140
140
|
let agentRunner = this.agentRunner;
|
|
141
141
|
if (!agentRunner && this._workflowEnv) {
|
|
142
142
|
const agentComponent = this._workflowEnv.getComponent("agent");
|
|
143
143
|
if (agentComponent) {
|
|
144
|
-
const { AgentComponentAdapter } = await import("./roy-agent-core-
|
|
144
|
+
const { AgentComponentAdapter } = await import("./roy-agent-core-ecb8am8s.js");
|
|
145
145
|
agentRunner = new AgentComponentAdapter(agentComponent, {}, this.sessionComponent);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -163,7 +163,7 @@ class WorkflowComponent extends BaseComponent {
|
|
|
163
163
|
if (this.workflowService) {
|
|
164
164
|
this.workflowService = null;
|
|
165
165
|
try {
|
|
166
|
-
const { closeDatabase } = await import("./roy-agent-core-
|
|
166
|
+
const { closeDatabase } = await import("./roy-agent-core-e302nvzt.js");
|
|
167
167
|
closeDatabase();
|
|
168
168
|
componentLogger.info("[WorkflowComponent] SQLite database closed");
|
|
169
169
|
} catch (error) {
|
|
@@ -241,9 +241,9 @@ class WorkflowComponent extends BaseComponent {
|
|
|
241
241
|
}
|
|
242
242
|
async initSqliteService() {
|
|
243
243
|
try {
|
|
244
|
-
const { getDatabase, initializeTables } = await import("./roy-agent-core-
|
|
245
|
-
const { WorkflowRepository } = await import("./roy-agent-core-
|
|
246
|
-
const { TagRepository } = await import("./roy-agent-core-
|
|
244
|
+
const { getDatabase, initializeTables } = await import("./roy-agent-core-e302nvzt.js");
|
|
245
|
+
const { WorkflowRepository } = await import("./roy-agent-core-trd6my5j.js");
|
|
246
|
+
const { TagRepository } = await import("./roy-agent-core-e2569ptp.js");
|
|
247
247
|
const db = getDatabase();
|
|
248
248
|
initializeTables();
|
|
249
249
|
const workflowRepository = new WorkflowRepository(db);
|
|
@@ -309,7 +309,7 @@ class WorkflowComponent extends BaseComponent {
|
|
|
309
309
|
this.workflowService = null;
|
|
310
310
|
this.nodeRegistry = null;
|
|
311
311
|
try {
|
|
312
|
-
const { closeDatabase } = await import("./roy-agent-core-
|
|
312
|
+
const { closeDatabase } = await import("./roy-agent-core-e302nvzt.js");
|
|
313
313
|
closeDatabase();
|
|
314
314
|
} catch {}
|
|
315
315
|
this._status = "stopped";
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
WorkflowRepository,
|
|
3
3
|
migrateEmptyTagsToDefault,
|
|
4
4
|
rowToWorkflow
|
|
5
|
-
} from "./roy-agent-core-
|
|
6
|
-
import"./roy-agent-core-
|
|
5
|
+
} from "./roy-agent-core-8pqq9yjt.js";
|
|
6
|
+
import"./roy-agent-core-j783tcqb.js";
|
|
7
7
|
import"./roy-agent-core-rvxg1wps.js";
|
|
8
|
-
import"./roy-agent-core-
|
|
8
|
+
import"./roy-agent-core-bt6h398s.js";
|
|
9
9
|
import"./roy-agent-core-8seq65bp.js";
|
|
10
10
|
import"./roy-agent-core-jnszp0jq.js";
|
|
11
11
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
+
isToolUnavailableError,
|
|
2
3
|
truncateOutputInline
|
|
3
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-ydwtpzyf.js";
|
|
4
5
|
import {
|
|
5
6
|
AgentRegistry
|
|
6
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-ed4tbkyj.js";
|
|
7
8
|
import {
|
|
8
9
|
enqueueToAddFakeUserMessage
|
|
9
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-5hjtbvxf.js";
|
|
10
11
|
import {
|
|
11
12
|
SessionMessageConverter
|
|
12
13
|
} from "./roy-agent-core-pk1b3kvf.js";
|
|
@@ -30,24 +31,24 @@ import {
|
|
|
30
31
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
31
32
|
import {
|
|
32
33
|
BaseComponent
|
|
33
|
-
} from "./roy-agent-core-
|
|
34
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
34
35
|
import {
|
|
35
36
|
globalHookManager,
|
|
36
37
|
init_global_hook_manager
|
|
37
|
-
} from "./roy-agent-core-
|
|
38
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
38
39
|
import {
|
|
39
40
|
init_context
|
|
40
|
-
} from "./roy-agent-core-
|
|
41
|
+
} from "./roy-agent-core-emjpkx9s.js";
|
|
41
42
|
import {
|
|
42
43
|
getCurrentTaskId,
|
|
43
44
|
getEnvContext,
|
|
44
45
|
resolveEnvParentTaskId,
|
|
45
46
|
runWithEnvContextAsync
|
|
46
|
-
} from "./roy-agent-core-
|
|
47
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
47
48
|
import {
|
|
48
49
|
TracedAs,
|
|
49
50
|
init_decorator
|
|
50
|
-
} from "./roy-agent-core-
|
|
51
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
51
52
|
import {
|
|
52
53
|
createLogger,
|
|
53
54
|
init_logger
|
|
@@ -857,7 +858,8 @@ class AgentComponent extends BaseComponent {
|
|
|
857
858
|
resolvedSystemPrompt = eventSourceSystemPrompt;
|
|
858
859
|
}
|
|
859
860
|
}
|
|
860
|
-
const
|
|
861
|
+
const useCacheSnapshot = agent.config.type === "primary";
|
|
862
|
+
const { snapshot: cacheSnapshot, systemPromptOverride } = useCacheSnapshot ? await this._loadOrCreateCacheSnapshot(effectiveContext.sessionId, effectiveContext, resolvedSystemPrompt, agent.config.systemPrompt) : { snapshot: null, systemPromptOverride: undefined };
|
|
861
863
|
if (systemPromptOverride !== undefined) {
|
|
862
864
|
resolvedSystemPrompt = systemPromptOverride;
|
|
863
865
|
} else if (resolvedSystemPrompt) {
|
|
@@ -1535,11 +1537,14 @@ class AgentComponent extends BaseComponent {
|
|
|
1535
1537
|
logger2.debug(`[executeTool] Available tools: [${ctx.tools.map((t) => t.name).join(", ")}]`);
|
|
1536
1538
|
const tool = ctx.tools.find((t) => t.name === toolName);
|
|
1537
1539
|
if (!tool) {
|
|
1540
|
+
logger2.error(`[executeTool] Tool not found: "${toolName}" — agent="${ctx.agent?.name}" (type=${ctx.agent?.config?.type}). Available tools (${ctx.tools.length}): [${ctx.tools.map((t) => t.name).join(", ")}]`);
|
|
1538
1541
|
this.pushEnvEvent({
|
|
1539
1542
|
type: "tool.error",
|
|
1540
1543
|
payload: {
|
|
1541
1544
|
error: `Tool not found: ${toolName}`,
|
|
1542
|
-
toolName
|
|
1545
|
+
toolName,
|
|
1546
|
+
availableTools: ctx.tools.map((t) => t.name),
|
|
1547
|
+
agentName: ctx.agent?.name
|
|
1543
1548
|
}
|
|
1544
1549
|
});
|
|
1545
1550
|
return {
|
|
@@ -1848,7 +1853,18 @@ __legacyDecorateClassTS([
|
|
|
1848
1853
|
})
|
|
1849
1854
|
], AgentComponent.prototype, "parseToolCallArguments", null);
|
|
1850
1855
|
__legacyDecorateClassTS([
|
|
1851
|
-
TracedAs("agent.component.executeTool", {
|
|
1856
|
+
TracedAs("agent.component.executeTool", {
|
|
1857
|
+
recordParams: true,
|
|
1858
|
+
recordResult: true,
|
|
1859
|
+
log: true,
|
|
1860
|
+
errorIf: (result) => {
|
|
1861
|
+
const err = result?.result?.error;
|
|
1862
|
+
if (result?.success === false && isToolUnavailableError(err)) {
|
|
1863
|
+
return new Error(String(err));
|
|
1864
|
+
}
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
})
|
|
1852
1868
|
], AgentComponent.prototype, "executeTool", null);
|
|
1853
1869
|
__legacyDecorateClassTS([
|
|
1854
1870
|
TracedAs("agent.component.recordSessionMessages", { recordParams: true, recordResult: true, log: true })
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
createLarkCliTaskNotifyHook,
|
|
7
7
|
createPerTaskGroupChatPlugin,
|
|
8
8
|
mergeChatOwnership
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-5vf48m39.js";
|
|
10
10
|
import {
|
|
11
11
|
getSharedEventStore
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-zff8vvs5.js";
|
|
13
13
|
import {
|
|
14
14
|
normalizeLarkAtMentions
|
|
15
15
|
} from "./roy-agent-core-64f22h1g.js";
|
|
@@ -18,24 +18,24 @@ import {
|
|
|
18
18
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
19
19
|
import {
|
|
20
20
|
BaseComponent
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
22
22
|
import {
|
|
23
23
|
globalHookManager,
|
|
24
24
|
init_global_hook_manager
|
|
25
|
-
} from "./roy-agent-core-
|
|
25
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
26
26
|
import {
|
|
27
27
|
init_context
|
|
28
|
-
} from "./roy-agent-core-
|
|
28
|
+
} from "./roy-agent-core-emjpkx9s.js";
|
|
29
29
|
import {
|
|
30
30
|
createEnvContext,
|
|
31
31
|
normalizeParentTaskId,
|
|
32
32
|
runWithEnvContext
|
|
33
|
-
} from "./roy-agent-core-
|
|
33
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
34
34
|
import {
|
|
35
35
|
TracedAs,
|
|
36
36
|
init_decorator,
|
|
37
37
|
wrapFunction
|
|
38
|
-
} from "./roy-agent-core-
|
|
38
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
39
39
|
import {
|
|
40
40
|
createLogger,
|
|
41
41
|
getTracerProvider,
|
|
@@ -882,41 +882,50 @@ function buildLarkRecommendedAction(opts) {
|
|
|
882
882
|
`处理飞书 ${scopeWord}消息并以机器人身份回复${profileWarn}。`,
|
|
883
883
|
`scope: ${scopeHint}。`,
|
|
884
884
|
``,
|
|
885
|
-
`## ⭐ 关键 0
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
`**禁止分段**——不要把回复拆成多条消息循环 send(不要分 2 条 / 3 条 / 5 条 / 若干条、`,
|
|
889
|
-
`不要 for 循环多次 send、不要每次只发一部分"待续")。`,
|
|
890
|
-
`**禁止拆成多次 send**——单条回复就**只调一次**\`lark-cli ... +messages-send\` / `,
|
|
891
|
-
`\`+messages-reply\`,发完即结束。`,
|
|
885
|
+
`## ⭐ 关键 0:整次回复只发一条结构化 post(禁分段)`,
|
|
886
|
+
`> 指令优先级:本 prompt 与 lark-* skill 文档冲突时**以本 prompt 为准**`,
|
|
887
|
+
`> (例:lark-im skill 建议 --markdown / ANSI-C 引号,本项目一律走下面模板)。`,
|
|
892
888
|
``,
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
` 仍算"只 send 一次"(飞书层面幂等去重),不是分段、不是拆段`,
|
|
896
|
-
`- 单条 post 内容上限 4096 字符(指单条消息),内容超长就压缩正文、不要拆段`,
|
|
897
|
-
`- 不需要"先把单条回复切成若干段 ≤4096 字符分别 send"——这条路径是**禁用模式**`,
|
|
898
|
-
` - 拆段发送会导致:① webhook 重复通知(#4137)② msg 进 thread 折叠丢失(#4171)`,
|
|
899
|
-
` ③ review 暴露多个 sub-agent 自行拼接 flag 的偏移指令语义(#4241)`,
|
|
900
|
-
` - 触发根因:sub-agent 自行循环 send + 各自拼 flag,与主会话不一致`,
|
|
889
|
+
`把全部**正文**写进**同一份** post content 的**单个** md 节点里(超长内容另挂附件区,`,
|
|
890
|
+
`见「关键 2」),写完整条即结束。`,
|
|
901
891
|
``,
|
|
902
|
-
|
|
892
|
+
`- **发送动作只调一次**:整次回复只调一次「发送类」命令(+messages-reply / +messages-send)`,
|
|
893
|
+
` - 上传 / 查询等**非发送类**命令不受此限`,
|
|
894
|
+
` (例:先 \`im files create\` 拿 file_key,再发一条带附件的 post,发送仍然只有一次)`,
|
|
895
|
+
`- "只 send 一次" = 只 send **一条回复内容**;失败时用同一 idempotency-key 重发同一内容`,
|
|
896
|
+
` 仍算"只 send 一次"(飞书层面幂等去重,key 最长 50 字符),不是分段、不是拆段`,
|
|
897
|
+
`- **禁止分段**:不要把回复拆成多条消息循环 send(2 / 3 / 5 / 若干条都不行),`,
|
|
898
|
+
` 禁止在 for / while 循环里多次调发送命令,禁止每条只发一部分"待续"`,
|
|
899
|
+
`- **禁止"陆续更新"**:子任务结束后不要再补发第 2 条更新;禁止先发占位帖再发完整版`,
|
|
900
|
+
` - 违规识别口径:同一 sub-agent 在群里连续刷 5 条以上消息,即为违规`,
|
|
901
|
+
`- 单条上限是飞书的**远端硬限制**:post 请求体 ≤ **30 KB**(UTF-8 字节,含 JSON 转义开销,`,
|
|
902
|
+
` 量级参考:约 1 万汉字)。**它不是你的分段阈值**——不要为了"卡上限"去数字数/算字节,`,
|
|
903
|
+
` 正常回复远低于它;真触发会报 **230025**(消息体长度超出限制,别当成路径错去换 flag),`,
|
|
904
|
+
` 处理方式是**压缩正文**或改用附件区(见「关键 2」)——**绝不拆成多条**`,
|
|
905
|
+
`- 拆段循环 send 的代价(历史故障,不要重演):webhook 重复通知(#4137)/`,
|
|
906
|
+
` 消息进 thread 后主聊天流丢失(#4171)/sub-agent 自拼 flag 偏移(#4241)`,
|
|
907
|
+
`- **绝不能加 --reply-in-thread**:会被路由进 thread,主聊天流看不到(#4171)`,
|
|
908
|
+
``,
|
|
909
|
+
`## ⭐ 关键 1:飞书回复必须用结构化 post content(--msg-type post --content)`,
|
|
903
910
|
`lark-cli 默认把消息当 plain text;而 @mention 只有在**结构化 at 节点**里才会被`,
|
|
904
911
|
`飞书识别为真实 @。所以回复统一走 post 的 --content JSON:`,
|
|
905
912
|
``,
|
|
906
913
|
` {"zh_cn":{"content":[`,
|
|
907
914
|
` [ {"tag":"at","user_id":"ou_xxx"} ], // @某人:结构化节点(可多个/多段)`,
|
|
908
|
-
` [ {"tag":"md","text":"正文 Markdown
|
|
915
|
+
` [ {"tag":"md","text":"正文 Markdown"} ] // 正文:单个 md 节点(整条回复的正文都放这里)`,
|
|
909
916
|
` ]}}`,
|
|
910
917
|
``,
|
|
911
918
|
`- @mention:用 {"tag":"at","user_id":"ou_xxx"}(user_id 填对方 open_id;@所有人填 "all")`,
|
|
912
919
|
`- 正文:全部放进 {"tag":"md","text":"..."} 这一个节点里`,
|
|
913
920
|
`- 不需要 @ 时,content 里只放 md 节点:{"zh_cn":{"content":[[{"tag":"md","text":"..."}]]}}`,
|
|
921
|
+
`- md 节点支持 CommonMark 0.31 + GFM:ATX 标题(#~######)/ 表格 / 任务列表 / 加粗 / 围栏代码块 / 超链接`,
|
|
922
|
+
`- 表格**前后**、引用块**之后**接其他内容,都**必须空一行**(只写一个换行会被当成表格续行)`,
|
|
914
923
|
`**严禁**: 用 --text(plain text,Markdown 全部失效)`,
|
|
915
924
|
` 用 --markdown(无法携带结构化 at 节点,@ 会退化成普通文本)`,
|
|
916
925
|
` 在正文里写 <at user_id="ou_xxx"/> 或 <at user_id="ou_xxx"></at> 文本标签`,
|
|
917
926
|
` (飞书不识别文本标签,只认结构化 at 节点;写文本标签会显示成原始字符)`,
|
|
918
927
|
``,
|
|
919
|
-
`## 关键 2
|
|
928
|
+
`## ⭐ 关键 2:安全构造 content(照抄,避免 JSON 转义地狱)`,
|
|
920
929
|
`把 Markdown 正文写进临时文件,再用 jq 组装(jq 会自动把换行转义为反斜杠+n):`,
|
|
921
930
|
``,
|
|
922
931
|
` body_file="$(mktemp /tmp/lark-reply.XXXXXX.md)"`,
|
|
@@ -929,6 +938,15 @@ function buildLarkRecommendedAction(opts) {
|
|
|
929
938
|
``,
|
|
930
939
|
`不需要 @ 某人时,把 jq 表达式换成 '{zh_cn:{content:[[{tag:"md",text:$md}]]}}'。`,
|
|
931
940
|
``,
|
|
941
|
+
`**长内容怎么放(仍然是单条消息)**:`,
|
|
942
|
+
`- 首选压缩正文;上限见「关键 0」(30 KB 请求体 = 单条消息,不是分段总和)`,
|
|
943
|
+
`- 要带完整日志 / trace 时用 post 的**附件区**(发送仍然只有一次):`,
|
|
944
|
+
` lark-cli ${profileFlag}im files create --file <path> --as bot --data '{"file_name":"<报告名>.md","file_type":"stream"}'`,
|
|
945
|
+
` 拿到 file_key 后在发送命令末尾加 --attachment <file_key>(.md/.log/.txt 用 file_type=stream)`,
|
|
946
|
+
`- \`--attachment\` 不能与已含 files 数组的 --content 同用(附件区只能声明一次)`,
|
|
947
|
+
`- 不要用 HTML 折叠标签往单条里"塞"长内容:飞书 post 的 md 节点**不支持** raw HTML,`,
|
|
948
|
+
` 写了只会让用户看到原始标签`,
|
|
949
|
+
``,
|
|
932
950
|
`## 禁止`,
|
|
933
951
|
`- 禁止 --text / --msg-type text(plain text,Markdown 全部失效)`,
|
|
934
952
|
`- 禁止 --markdown(无法携带结构化 at 节点)`,
|
|
@@ -936,11 +954,6 @@ function buildLarkRecommendedAction(opts) {
|
|
|
936
954
|
`- 禁止把多行 Markdown 直接拼进 --content 参数(必须走上面的 jq --rawfile)`,
|
|
937
955
|
`- 禁止字面反斜杠+n(即 \\n 两个字符,不是 0x0A 控制字符)`,
|
|
938
956
|
`- 禁止 bash ANSI-C 引号语法(dollar 符号紧跟单引号)`,
|
|
939
|
-
`- 禁止分段发送:禁止把单条回复拆成多条 ≤4096 字符的子段循环 send,`,
|
|
940
|
-
` 禁止用 for / while 循环多次调 lark-cli 拼多 send,`,
|
|
941
|
-
` 禁止每次只发一部分"待续"。整次响应只调一次 lark-cli 命令(只 send 一次 / 只发一条 / 单次调用)。`,
|
|
942
|
-
`- 禁止 --reply-in-thread(消息会路由进 thread,主聊天流折叠预览看不到后续消息,`,
|
|
943
|
-
` 实测导致 msg-5/6/7 丢失,详见 #4171)`,
|
|
944
957
|
``,
|
|
945
958
|
`## ⭐ 关键 3:出站必须显式 --as bot,禁止走 api POST`,
|
|
946
959
|
`所有出站命令**照抄下面模板**(--as bot 已写死在命令里,不要自己重写、不要省 flag):`,
|
|
@@ -963,52 +976,7 @@ function buildLarkRecommendedAction(opts) {
|
|
|
963
976
|
`- 禁止用 \`python json.load\` / \`python json.tool\` / \`jq\` 解析 lark-cli 发送响应`,
|
|
964
977
|
` - 飞书消息正文里常含裸 \`"\`、\`|\`、Markdown 表格分隔符 → json.load 会报 \`Expecting ',' delimiter\` 假失败`,
|
|
965
978
|
` - 假失败 → 重发 → 形成 3 份相同消息`,
|
|
966
|
-
`- 重试建议:固定 idempotency-key
|
|
967
|
-
``,
|
|
968
|
-
`## ⭐ 关键 4:禁止分段响应——单条结构化消息足够`,
|
|
969
|
-
`飞书单条消息支持最长 **4096 字符**,足够放下任何调研/修复/长报告。`,
|
|
970
|
-
`把全部内容写进一条 post 里一次性发完;不要再用多条 send/reply 拼成分段响应。`,
|
|
971
|
-
``,
|
|
972
|
-
`**绝对禁止(sub-agent 自己拼 bash 做 send 循环的 4 类陷阱)**:`,
|
|
973
|
-
`- **禁止用多个 \`im +messages-send\` / \`im +messages-reply\` 拼接成 5-10 条分段响应**`,
|
|
974
|
-
` - 群里如果出现 7-13 条由同一 sub-agent 发出的"陆续更新",就是这条违规`,
|
|
975
|
-
`- **禁止把一份长报告拆成 N 条"陆续发"**(哪怕每条都未超限)`,
|
|
976
|
-
` - 用户体验混乱:消息流被淹没,跟读成本指数级上升`,
|
|
977
|
-
` - 部分消息还会被折叠/丢失(thread、超长截断、幂等 hash)`,
|
|
978
|
-
`- **禁止在子任务结束后再发第 2 条 "更新"**(一条就够了,不要"补一句")`,
|
|
979
|
-
`- **禁止在写到一半时先发一条占位回复,再发完整版**(直接发完整版)`,
|
|
980
|
-
``,
|
|
981
|
-
`**正确做法——一次性写进一条结构化 post JSON**:`,
|
|
982
|
-
` body_file="$(mktemp /tmp/lark-reply.XXXXXX.md)"`,
|
|
983
|
-
` trap 'rm -f "$body_file"' EXIT`,
|
|
984
|
-
` cat > "$body_file" <<'LARK_REPLY_EOF'`,
|
|
985
|
-
`# 任务报告标题`,
|
|
986
|
-
``,
|
|
987
|
-
`## 关键发现`,
|
|
988
|
-
`- 要点 1(含图表、表格、代码块、引用都可放)`,
|
|
989
|
-
`- 要点 2`,
|
|
990
|
-
``,
|
|
991
|
-
`## 操作步骤`,
|
|
992
|
-
`1. 步骤一`,
|
|
993
|
-
`2. 步骤二`,
|
|
994
|
-
``,
|
|
995
|
-
`<!-- 极长内容用 Markdown 折叠让用户自己展开 --> `,
|
|
996
|
-
`<details>`,
|
|
997
|
-
`<summary>展开完整日志/trace/参考链接</summary>`,
|
|
998
|
-
``,
|
|
999
|
-
`很长的内容放这里(单条最多接近 4096 字符),用户需要时点 summary 展开`,
|
|
1000
|
-
``,
|
|
1001
|
-
`</details>`,
|
|
1002
|
-
`LARK_REPLY_EOF`,
|
|
1003
|
-
` content="$(jq -nc --rawfile md "$body_file" '{zh_cn:{content:[[{tag:"md",text:$md}]]}}')"`,
|
|
1004
|
-
` lark-cli ${profileFlag}im +messages-send --chat-id <取自 replyTo.chatId> --as bot --msg-type post --content "$content"`,
|
|
1005
|
-
``,
|
|
1006
|
-
`要点:`,
|
|
1007
|
-
`- **一条 post 消息** = 一个 mktemp + 一个 jq 组装 + **一个** lark-cli send 调用`,
|
|
1008
|
-
`- 长内容用 Markdown \`<details>/<summary>\` 折叠(飞书 md 节点支持)`,
|
|
1009
|
-
`- 表格/列表/代码块/标题在单条 md 节点里全部可用,不需要分条`,
|
|
1010
|
-
`- **绝不能加 \`--reply-in-thread\`**(会把消息路由进 thread,主聊天流看不到——见 #4171 教训)`,
|
|
1011
|
-
`- 如果你觉得自己想发第 2 条 "更新",停下来:第 1 条已经够了,再发就是违规`,
|
|
979
|
+
`- 重试建议:固定 idempotency-key(飞书层面去重,**最长 50 字符**),不要靠内容 hash 自检`,
|
|
1012
980
|
``,
|
|
1013
981
|
`## 必须使用 replyTo 里给定的值`,
|
|
1014
982
|
`profile / chatId / messageId / --as bot 必须原样取自 recommendedAction.replyTo;不要凭印象自己拼接。`
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAutoTaskPlugin
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-5vf48m39.js";
|
|
4
4
|
import {
|
|
5
5
|
ContextError,
|
|
6
6
|
ErrorCodes
|
|
7
7
|
} from "./roy-agent-core-ctdhjv68.js";
|
|
8
8
|
import {
|
|
9
9
|
BaseComponent
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
11
11
|
import {
|
|
12
12
|
init_context
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-emjpkx9s.js";
|
|
14
14
|
import {
|
|
15
15
|
getEnvContext,
|
|
16
16
|
init_env_context,
|
|
17
17
|
runWithEnvContextAsync
|
|
18
|
-
} from "./roy-agent-core-
|
|
18
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
19
19
|
import {
|
|
20
20
|
TracedAs,
|
|
21
21
|
init_decorator
|
|
22
|
-
} from "./roy-agent-core-
|
|
22
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
23
23
|
import {
|
|
24
24
|
createLogger,
|
|
25
25
|
init_logger
|
|
@@ -124,7 +124,9 @@ class BaseEnvironment extends BaseComponent {
|
|
|
124
124
|
try {
|
|
125
125
|
const promptComponent = this.getComponent("prompt");
|
|
126
126
|
if (promptComponent) {
|
|
127
|
-
const loadedPrompt = await promptComponent.getPrompt("default"
|
|
127
|
+
const loadedPrompt = await promptComponent.getPrompt("default", {}, {
|
|
128
|
+
agentType: "primary"
|
|
129
|
+
});
|
|
128
130
|
if (loadedPrompt) {
|
|
129
131
|
systemPrompt = loadedPrompt;
|
|
130
132
|
promptSource = "PromptComponent";
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
createSubmitJsonOutputTool,
|
|
3
3
|
init_submit_json_output_tool
|
|
4
4
|
} from "./roy-agent-core-1db4vpc6.js";
|
|
5
|
+
import {
|
|
6
|
+
init_loose_json
|
|
7
|
+
} from "./roy-agent-core-ze068vc9.js";
|
|
5
8
|
import {
|
|
6
9
|
AskUserError,
|
|
7
10
|
init_workflow_hil
|
|
@@ -9,12 +12,12 @@ import {
|
|
|
9
12
|
import {
|
|
10
13
|
globalHookManager,
|
|
11
14
|
init_global_hook_manager
|
|
12
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
13
16
|
import {
|
|
14
17
|
TracedAs,
|
|
15
18
|
init_decorator,
|
|
16
19
|
wrapFunction
|
|
17
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
18
21
|
import {
|
|
19
22
|
createLogger,
|
|
20
23
|
init_logger
|
|
@@ -183,6 +186,7 @@ var init_workflow_json_output_plugin = __esm(() => {
|
|
|
183
186
|
init_submit_json_output_tool();
|
|
184
187
|
init_logger();
|
|
185
188
|
init_decorator();
|
|
189
|
+
init_loose_json();
|
|
186
190
|
logger = createLogger("WorkflowJsonOutputPlugin");
|
|
187
191
|
WORKFLOW_JSON_OUTPUT_PLUGIN_KEY = `${WORKFLOW_JSON_OUTPUT_SOURCE_ID}:${WORKFLOW_JSON_OUTPUT_PLUGIN_NAME}`;
|
|
188
192
|
HOOK_NAME = `${WORKFLOW_JSON_OUTPUT_PLUGIN_NAME}:${HOOK_POINT}`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createHook
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-khx0h4j2.js";
|
|
4
4
|
import {
|
|
5
5
|
HookManager
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
7
7
|
|
|
8
8
|
// src/env/component.ts
|
|
9
9
|
class BaseComponent {
|
|
@@ -21,17 +21,17 @@ import {
|
|
|
21
21
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
22
22
|
import {
|
|
23
23
|
BaseComponent
|
|
24
|
-
} from "./roy-agent-core-
|
|
24
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
25
25
|
import {
|
|
26
26
|
LLMHookPoints,
|
|
27
27
|
globalHookManager,
|
|
28
28
|
init_global_hook_manager
|
|
29
|
-
} from "./roy-agent-core-
|
|
29
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
30
30
|
import {
|
|
31
31
|
TracedAs,
|
|
32
32
|
init_decorator,
|
|
33
33
|
wrapFunction
|
|
34
|
-
} from "./roy-agent-core-
|
|
34
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
35
35
|
import {
|
|
36
36
|
createLogger,
|
|
37
37
|
init_logger
|
|
@@ -11,20 +11,20 @@ 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-xn12d221.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-mqaht7mm.js";
|
|
20
20
|
import {
|
|
21
21
|
getCurrentTaskId,
|
|
22
22
|
init_env_context
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
24
24
|
import {
|
|
25
25
|
TracedAs,
|
|
26
26
|
init_decorator
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
28
28
|
import {
|
|
29
29
|
createLogger,
|
|
30
30
|
init_logger
|
|
@@ -194,6 +194,14 @@ var TOOL_CONFIG_REGISTRATION = {
|
|
|
194
194
|
|
|
195
195
|
// src/env/tool/tool-component.ts
|
|
196
196
|
init_workflow_hil();
|
|
197
|
+
|
|
198
|
+
// src/env/constants.ts
|
|
199
|
+
var TOOL_UNAVAILABLE_ERROR_RE = /^Tool (?:not found|disabled):/;
|
|
200
|
+
function isToolUnavailableError(message) {
|
|
201
|
+
return typeof message === "string" && TOOL_UNAVAILABLE_ERROR_RE.test(message);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// src/env/tool/tool-component.ts
|
|
197
205
|
init_env_context();
|
|
198
206
|
var logger = createLogger("tool");
|
|
199
207
|
var configComponentInstance = null;
|
|
@@ -447,6 +455,7 @@ class ToolComponent extends BaseComponent {
|
|
|
447
455
|
const { name, args, context, skipHooks } = request;
|
|
448
456
|
const registration = this.registry.getTool(name);
|
|
449
457
|
if (!registration) {
|
|
458
|
+
logger.error(`[ToolComponent] Tool not found: "${name}" — ` + `registered tools: [${this.registry.listTools().map((t) => t.name).join(", ")}]`);
|
|
450
459
|
return {
|
|
451
460
|
success: false,
|
|
452
461
|
output: "",
|
|
@@ -571,7 +580,18 @@ class ToolComponent extends BaseComponent {
|
|
|
571
580
|
}
|
|
572
581
|
}
|
|
573
582
|
__legacyDecorateClassTS([
|
|
574
|
-
TracedAs("tool.component.execute", {
|
|
583
|
+
TracedAs("tool.component.execute", {
|
|
584
|
+
recordParams: true,
|
|
585
|
+
recordResult: true,
|
|
586
|
+
log: true,
|
|
587
|
+
errorIf: (result) => {
|
|
588
|
+
const err = result?.error;
|
|
589
|
+
if (result?.success === false && isToolUnavailableError(err)) {
|
|
590
|
+
return new Error(String(err));
|
|
591
|
+
}
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
})
|
|
575
595
|
], ToolComponent.prototype, "execute", null);
|
|
576
596
|
var ToolComponentConfigSchema = z.object({
|
|
577
597
|
toolsDir: z.string().optional(),
|
|
@@ -591,4 +611,4 @@ var ToolComponentConfigSchema = z.object({
|
|
|
591
611
|
}).default({})
|
|
592
612
|
});
|
|
593
613
|
|
|
594
|
-
export { ToolRegistry, ToolValidator, setToolConfigComponent, getMaxOutputSize, truncateOutputInline, ToolComponent };
|
|
614
|
+
export { ToolRegistry, ToolValidator, isToolUnavailableError, setToolConfigComponent, getMaxOutputSize, truncateOutputInline, ToolComponent };
|