@ai-setting/roy-agent-core 1.7.47 → 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-b09eqhhz.js → roy-agent-core-vrj9c5y6.js} +46 -11
- 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,24 +882,50 @@ function buildLarkRecommendedAction(opts) {
|
|
|
882
882
|
`处理飞书 ${scopeWord}消息并以机器人身份回复${profileWarn}。`,
|
|
883
883
|
`scope: ${scopeHint}。`,
|
|
884
884
|
``,
|
|
885
|
-
`## ⭐ 关键
|
|
885
|
+
`## ⭐ 关键 0:整次回复只发一条结构化 post(禁分段)`,
|
|
886
|
+
`> 指令优先级:本 prompt 与 lark-* skill 文档冲突时**以本 prompt 为准**`,
|
|
887
|
+
`> (例:lark-im skill 建议 --markdown / ANSI-C 引号,本项目一律走下面模板)。`,
|
|
888
|
+
``,
|
|
889
|
+
`把全部**正文**写进**同一份** post content 的**单个** md 节点里(超长内容另挂附件区,`,
|
|
890
|
+
`见「关键 2」),写完整条即结束。`,
|
|
891
|
+
``,
|
|
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)`,
|
|
886
910
|
`lark-cli 默认把消息当 plain text;而 @mention 只有在**结构化 at 节点**里才会被`,
|
|
887
911
|
`飞书识别为真实 @。所以回复统一走 post 的 --content JSON:`,
|
|
888
912
|
``,
|
|
889
913
|
` {"zh_cn":{"content":[`,
|
|
890
914
|
` [ {"tag":"at","user_id":"ou_xxx"} ], // @某人:结构化节点(可多个/多段)`,
|
|
891
|
-
` [ {"tag":"md","text":"正文 Markdown
|
|
915
|
+
` [ {"tag":"md","text":"正文 Markdown"} ] // 正文:单个 md 节点(整条回复的正文都放这里)`,
|
|
892
916
|
` ]}}`,
|
|
893
917
|
``,
|
|
894
918
|
`- @mention:用 {"tag":"at","user_id":"ou_xxx"}(user_id 填对方 open_id;@所有人填 "all")`,
|
|
895
919
|
`- 正文:全部放进 {"tag":"md","text":"..."} 这一个节点里`,
|
|
896
920
|
`- 不需要 @ 时,content 里只放 md 节点:{"zh_cn":{"content":[[{"tag":"md","text":"..."}]]}}`,
|
|
921
|
+
`- md 节点支持 CommonMark 0.31 + GFM:ATX 标题(#~######)/ 表格 / 任务列表 / 加粗 / 围栏代码块 / 超链接`,
|
|
922
|
+
`- 表格**前后**、引用块**之后**接其他内容,都**必须空一行**(只写一个换行会被当成表格续行)`,
|
|
897
923
|
`**严禁**: 用 --text(plain text,Markdown 全部失效)`,
|
|
898
924
|
` 用 --markdown(无法携带结构化 at 节点,@ 会退化成普通文本)`,
|
|
899
925
|
` 在正文里写 <at user_id="ou_xxx"/> 或 <at user_id="ou_xxx"></at> 文本标签`,
|
|
900
926
|
` (飞书不识别文本标签,只认结构化 at 节点;写文本标签会显示成原始字符)`,
|
|
901
927
|
``,
|
|
902
|
-
`## 关键 2
|
|
928
|
+
`## ⭐ 关键 2:安全构造 content(照抄,避免 JSON 转义地狱)`,
|
|
903
929
|
`把 Markdown 正文写进临时文件,再用 jq 组装(jq 会自动把换行转义为反斜杠+n):`,
|
|
904
930
|
``,
|
|
905
931
|
` body_file="$(mktemp /tmp/lark-reply.XXXXXX.md)"`,
|
|
@@ -912,6 +938,15 @@ function buildLarkRecommendedAction(opts) {
|
|
|
912
938
|
``,
|
|
913
939
|
`不需要 @ 某人时,把 jq 表达式换成 '{zh_cn:{content:[[{tag:"md",text:$md}]]}}'。`,
|
|
914
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
|
+
``,
|
|
915
950
|
`## 禁止`,
|
|
916
951
|
`- 禁止 --text / --msg-type text(plain text,Markdown 全部失效)`,
|
|
917
952
|
`- 禁止 --markdown(无法携带结构化 at 节点)`,
|
|
@@ -941,7 +976,7 @@ function buildLarkRecommendedAction(opts) {
|
|
|
941
976
|
`- 禁止用 \`python json.load\` / \`python json.tool\` / \`jq\` 解析 lark-cli 发送响应`,
|
|
942
977
|
` - 飞书消息正文里常含裸 \`"\`、\`|\`、Markdown 表格分隔符 → json.load 会报 \`Expecting ',' delimiter\` 假失败`,
|
|
943
978
|
` - 假失败 → 重发 → 形成 3 份相同消息`,
|
|
944
|
-
`- 重试建议:固定 idempotency-key
|
|
979
|
+
`- 重试建议:固定 idempotency-key(飞书层面去重,**最长 50 字符**),不要靠内容 hash 自检`,
|
|
945
980
|
``,
|
|
946
981
|
`## 必须使用 replyTo 里给定的值`,
|
|
947
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 };
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseComponent
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
7
7
|
import {
|
|
8
8
|
init_decorator
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
10
10
|
import {
|
|
11
11
|
createLogger,
|
|
12
12
|
getTracerProvider,
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
11
11
|
import {
|
|
12
12
|
BaseComponent
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
14
14
|
import {
|
|
15
15
|
createHook
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-khx0h4j2.js";
|
|
17
17
|
import {
|
|
18
18
|
globalHookManager,
|
|
19
19
|
init_global_hook_manager
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
21
21
|
import {
|
|
22
22
|
createLogger,
|
|
23
23
|
init_logger
|
|
@@ -432,7 +432,7 @@ class PromptComponent extends BaseComponent {
|
|
|
432
432
|
size() {
|
|
433
433
|
return this.prompts.size;
|
|
434
434
|
}
|
|
435
|
-
async getPrompt(name, variables = {}) {
|
|
435
|
+
async getPrompt(name, variables = {}, context) {
|
|
436
436
|
const defaultName = this.getPromptConfig("defaultName", "default");
|
|
437
437
|
const targetName = this.has(name) ? name : defaultName;
|
|
438
438
|
const entry = this.prompts.get(targetName);
|
|
@@ -440,14 +440,15 @@ class PromptComponent extends BaseComponent {
|
|
|
440
440
|
logger2.warn(`[PromptComponent] Prompt not found: ${name}, using fallback`);
|
|
441
441
|
return "You are a helpful assistant.";
|
|
442
442
|
}
|
|
443
|
-
return this.render(entry.content, variables, { name: targetName });
|
|
443
|
+
return this.render(entry.content, variables, { ...context, name: targetName });
|
|
444
444
|
}
|
|
445
445
|
async render(content, variables = {}, context) {
|
|
446
446
|
const hookContext = {
|
|
447
447
|
name: context?.name || "anonymous",
|
|
448
448
|
originalContent: content,
|
|
449
449
|
renderedContent: content,
|
|
450
|
-
variables
|
|
450
|
+
variables,
|
|
451
|
+
...context?.agentType ? { agentType: context.agentType } : {}
|
|
451
452
|
};
|
|
452
453
|
await globalHookManager.execute(PromptHookPoints.BEFORE_RENDER, hookContext);
|
|
453
454
|
hookContext.renderedContent = this.renderer.render(hookContext.originalContent, variables);
|