@ai-setting/roy-agent-core 1.7.85 → 1.7.89
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/agent-component.d.ts +1 -1
- package/dist/env/agent/agent-component.js +13 -12
- package/dist/env/agent/index.js +13 -12
- package/dist/env/agent/types.d.ts +14 -0
- 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/error-reply.js +1 -1
- package/dist/env/event-source/event-source-handlers.d.ts +18 -2
- package/dist/env/event-source/event-source-handlers.js +26 -21
- package/dist/env/event-source/event-store.js +2 -2
- package/dist/env/event-source/index.js +25 -22
- package/dist/env/event-source/timer-handler.d.ts +98 -0
- package/dist/env/event-source/types.d.ts +53 -1
- package/dist/env/event-source/wecom-card-action-handler.d.ts +235 -3
- package/dist/env/event-source/wecom-card-builder.d.ts +207 -1
- package/dist/env/event-source/wecom-cli-handler.d.ts +25 -0
- package/dist/{shared/@ai-setting/roy-agent-core-vyr6svt6.js → env/event-source/wecom-respond-registry.js} +8 -6
- package/dist/env/event-source/wecom-session-card-sender.d.ts +135 -0
- package/dist/env/event-source/wecom-session-card-sender.js +153 -0
- package/dist/env/hook/index.js +5 -5
- package/dist/env/index.js +50 -45
- package/dist/env/llm/index.js +9 -8
- package/dist/env/log-trace/index.js +7 -7
- package/dist/env/log-trace/trace-filters.d.ts +6 -1
- 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 +8 -8
- package/dist/env/prompt/prompts-index.d.ts +1 -1
- package/dist/env/session/group-session-link.d.ts +99 -0
- package/dist/env/session/index.js +11 -10
- package/dist/env/session/session-component.d.ts +89 -0
- package/dist/env/session/storage/index.js +5 -4
- package/dist/env/session/types.d.ts +10 -0
- package/dist/env/skill/index.js +7 -7
- package/dist/env/task/backend/index.d.ts +3 -0
- package/dist/env/task/backend/index.js +151 -3
- package/dist/env/task/backend/remote-task-port.d.ts +85 -0
- package/dist/env/task/backend/types.d.ts +5 -0
- package/dist/env/task/delegate/delegate-channel-hint.d.ts +39 -0
- package/dist/env/task/delegate/delegate-tool.d.ts +71 -6
- package/dist/env/task/delegate/delegate-tool.js +11 -9
- package/dist/env/task/delegate/index.js +8 -8
- package/dist/env/task/index.d.ts +1 -1
- package/dist/env/task/index.js +34 -18
- package/dist/env/task/mcp/index.js +4 -4
- package/dist/env/task/plugins/card-subject.d.ts +117 -0
- package/dist/env/task/plugins/index.js +19 -17
- package/dist/env/task/plugins/lark-card-action-handler.d.ts +261 -6
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +501 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.js +12 -2
- package/dist/env/task/plugins/lark-card-state-store.d.ts +60 -0
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +45 -0
- package/dist/env/task/plugins/sub-session-activity.d.ts +415 -0
- package/dist/env/task/plugins/wecom-session-card-store.d.ts +134 -0
- package/dist/env/task/plugins/wecom-session-card-store.js +23 -0
- package/dist/env/task/plugins/wecom-task-notify-plugin.d.ts +40 -0
- package/dist/env/task/storage/index.d.ts +1 -0
- package/dist/env/task/storage/index.js +24 -4
- package/dist/env/task/storage/migrations/006_add_task_owner.d.ts +24 -0
- package/dist/env/task/storage/remote-task-store.d.ts +186 -0
- package/dist/env/task/task-component.d.ts +7 -0
- package/dist/env/task/tools/index.js +4 -4
- package/dist/env/task/tools/task-types.d.ts +7 -0
- package/dist/env/task/types.d.ts +17 -0
- package/dist/env/tool/built-in/index.js +6 -4
- package/dist/env/tool/index.js +14 -10
- package/dist/env/tool/types.d.ts +25 -0
- package/dist/env/tool/validator.d.ts +8 -0
- package/dist/env/workflow/engine/index.js +12 -12
- package/dist/env/workflow/hooks/index.js +7 -7
- package/dist/env/workflow/index.js +24 -23
- package/dist/env/workflow/nodes/index.js +2 -2
- package/dist/env/workflow/plugins/index.js +10 -8
- 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 +16 -15
- package/dist/env/workflow/utils/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +71 -60
- package/dist/shared/@ai-setting/{roy-agent-core-q813vafd.js → roy-agent-core-05z35shp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dc9zq75z.js → roy-agent-core-0crmsc12.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-7dd0s3xb.js → roy-agent-core-0n1wwndq.js} +1027 -14
- package/dist/shared/@ai-setting/{roy-agent-core-cha0jc7n.js → roy-agent-core-0sbmdz8d.js} +137 -16
- package/dist/shared/@ai-setting/{roy-agent-core-87942bw4.js → roy-agent-core-1mhyh4c5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-v6vr6za7.js → roy-agent-core-1vv4fx15.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-nwbfepba.js → roy-agent-core-3e040tc5.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-418zc9ha.js +288 -0
- package/dist/shared/@ai-setting/{roy-agent-core-qk9hd89p.js → roy-agent-core-49qcpqwg.js} +54 -19
- package/dist/shared/@ai-setting/{roy-agent-core-xf6z96qy.js → roy-agent-core-4b38m749.js} +818 -346
- package/dist/shared/@ai-setting/{roy-agent-core-r5wt1h3c.js → roy-agent-core-4fkxy2gv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-na18zwj0.js → roy-agent-core-4t3yskp8.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-d1n4jbza.js → roy-agent-core-5dhvfgaw.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-5pr4zp88.js → roy-agent-core-5kzhaap1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qq96p0tj.js → roy-agent-core-5s2t8z00.js} +22 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6rh8k6ba.js → roy-agent-core-6gj1hc5z.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-g8htfwxj.js → roy-agent-core-7f10p7m2.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-h21gngxf.js → roy-agent-core-7yh5wps0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-efkjyh69.js → roy-agent-core-9710zwwz.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-rykf7c04.js → roy-agent-core-9c565frx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vffccgf6.js → roy-agent-core-9cen1jvg.js} +18 -7
- package/dist/shared/@ai-setting/{roy-agent-core-fghc2m8z.js → roy-agent-core-aa8kv18f.js} +34 -2
- package/dist/shared/@ai-setting/roy-agent-core-age3qseb.js +177 -0
- package/dist/shared/@ai-setting/{roy-agent-core-7bpj859q.js → roy-agent-core-azyz78ky.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-264qexac.js → roy-agent-core-b7h39vrc.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-dqxec05w.js → roy-agent-core-bjtc9d35.js} +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-c4ec7k0p.js +426 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ddyk1rc0.js → roy-agent-core-cre2y2ct.js} +160 -4
- package/dist/shared/@ai-setting/{roy-agent-core-tr3ep81v.js → roy-agent-core-d6zdbgtc.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0qyrk5k0.js → roy-agent-core-ds6qzmf8.js} +14 -5
- package/dist/shared/@ai-setting/{roy-agent-core-p6ks90tb.js → roy-agent-core-dvec4nn2.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-cgtq6427.js → roy-agent-core-e08bvpaq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-12n08pg5.js → roy-agent-core-e69qxdyy.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-xcp8vwax.js → roy-agent-core-fepm835e.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-6j02sbee.js → roy-agent-core-fhg03v43.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dvtg4sn0.js → roy-agent-core-g8yr733d.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-m3vjepzz.js → roy-agent-core-h1e1fm9b.js} +38 -202
- package/dist/shared/@ai-setting/{roy-agent-core-c2gbt68e.js → roy-agent-core-h83zdsrq.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-tk98f92b.js → roy-agent-core-k3gcvybs.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-b31v3qpv.js → roy-agent-core-k3h8t4q1.js} +992 -212
- package/dist/shared/@ai-setting/{roy-agent-core-pgvcf91v.js → roy-agent-core-m39v7qpx.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-ezvpreqz.js → roy-agent-core-m66ysky0.js} +54 -6
- package/dist/shared/@ai-setting/{roy-agent-core-begm7ytz.js → roy-agent-core-m7d1t3db.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-tm1mxttk.js → roy-agent-core-mf5p38yf.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-83bewqx8.js → roy-agent-core-mvh0td7p.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-ze5cqpf2.js → roy-agent-core-mx855td4.js} +17 -38
- package/dist/shared/@ai-setting/{roy-agent-core-0dh8npnz.js → roy-agent-core-n197medr.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-cmprygrp.js → roy-agent-core-nqkfkpf4.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-7cbpmk4q.js → roy-agent-core-p31ftgq9.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-1v4g0d4x.js → roy-agent-core-rm7seqwb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ax9e9szb.js → roy-agent-core-smf94h73.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-acj8ag08.js → roy-agent-core-tjnabyvq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qqaak24r.js → roy-agent-core-tkpp1ba0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dkrvmjsh.js → roy-agent-core-tpm1dd1g.js} +23 -15
- package/dist/shared/@ai-setting/{roy-agent-core-ed233k5z.js → roy-agent-core-v1n0106v.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zxz5fkwj.js → roy-agent-core-v6yshv0z.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-mcy5apay.js → roy-agent-core-vf9sp6s3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-xvt7kf7p.js → roy-agent-core-w9ryeg2p.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-es203w7p.js → roy-agent-core-wqs6yypq.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-wxrkcb17.js +56 -0
- package/dist/shared/@ai-setting/{roy-agent-core-0snm5hc5.js → roy-agent-core-y6shd91r.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9vxh6f8h.js → roy-agent-core-y7fqtzk2.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-cpcd24n2.js → roy-agent-core-yet36q5k.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-3fh1f7s7.js → roy-agent-core-yfpnkc4z.js} +5 -5
- package/dist/shared/@ai-setting/roy-agent-core-zhwcje5a.js +352 -0
- package/package.json +9 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LarkCardPatchNotifier,
|
|
3
3
|
formatDurationMs
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-0n1wwndq.js";
|
|
5
5
|
import {
|
|
6
6
|
WorkflowHookPoints,
|
|
7
7
|
init_workflow_hook_points
|
|
8
|
-
} from "./roy-agent-core-
|
|
8
|
+
} from "./roy-agent-core-h83zdsrq.js";
|
|
9
9
|
import {
|
|
10
10
|
init_context
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-tkpp1ba0.js";
|
|
12
12
|
import {
|
|
13
13
|
getEnvContextOrEmpty
|
|
14
|
-
} from "./roy-agent-core-
|
|
14
|
+
} from "./roy-agent-core-p31ftgq9.js";
|
|
15
15
|
import {
|
|
16
16
|
TracedAs,
|
|
17
17
|
init_decorator
|
|
18
|
-
} from "./roy-agent-core-
|
|
18
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
19
19
|
import {
|
|
20
20
|
createLogger,
|
|
21
21
|
init_logger
|
|
@@ -60,6 +60,24 @@ function safeJsonLen(value) {
|
|
|
60
60
|
return 0;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
function extractToolNames(tools) {
|
|
64
|
+
if (!Array.isArray(tools))
|
|
65
|
+
return { toolNames: [], toolNamesTruncated: false };
|
|
66
|
+
const names = [];
|
|
67
|
+
let chars = 0;
|
|
68
|
+
for (const t of tools) {
|
|
69
|
+
const raw = t?.name;
|
|
70
|
+
if (typeof raw !== "string" || raw.length === 0)
|
|
71
|
+
continue;
|
|
72
|
+
const name = raw.length > TOOL_NAME_MAX_CHARS ? `${raw.slice(0, TOOL_NAME_MAX_CHARS)}…` : raw;
|
|
73
|
+
if (names.length >= TOOL_NAMES_COUNT_CAP || chars + name.length > TOOL_NAMES_CHAR_BUDGET) {
|
|
74
|
+
return { toolNames: names, toolNamesTruncated: true };
|
|
75
|
+
}
|
|
76
|
+
names.push(name);
|
|
77
|
+
chars += name.length;
|
|
78
|
+
}
|
|
79
|
+
return { toolNames: names, toolNamesTruncated: false };
|
|
80
|
+
}
|
|
63
81
|
function llmInvokeParamFilter(args) {
|
|
64
82
|
if (isTraceFullMode()) {
|
|
65
83
|
return { args };
|
|
@@ -67,6 +85,7 @@ function llmInvokeParamFilter(args) {
|
|
|
67
85
|
const p = (args ?? [])[0];
|
|
68
86
|
const ctx = p?.context ?? p?.ctx ?? null;
|
|
69
87
|
const msgs = Array.isArray(p?.messages) ? p.messages : [];
|
|
88
|
+
const { toolNames, toolNamesTruncated } = extractToolNames(p?.tools);
|
|
70
89
|
return {
|
|
71
90
|
model: p?.model ?? p?.modelId ?? ctx?.model ?? null,
|
|
72
91
|
provider: p?.provider ?? p?.providerId ?? null,
|
|
@@ -74,6 +93,8 @@ function llmInvokeParamFilter(args) {
|
|
|
74
93
|
messageCount: msgs.length,
|
|
75
94
|
totalChars: totalMessageChars(msgs),
|
|
76
95
|
tools: Array.isArray(p?.tools) ? p.tools.length : 0,
|
|
96
|
+
toolNames,
|
|
97
|
+
...toolNamesTruncated ? { toolNamesTruncated } : {},
|
|
77
98
|
maxTokens: p?.maxTokens ?? null,
|
|
78
99
|
temperature: p?.temperature ?? null
|
|
79
100
|
};
|
|
@@ -292,7 +313,7 @@ function recordSessionMessagesParamFilter(args) {
|
|
|
292
313
|
totalChars: chars
|
|
293
314
|
};
|
|
294
315
|
}
|
|
295
|
-
var traceFullModeCache, MAX_COMMAND_CHARS = 2000;
|
|
316
|
+
var traceFullModeCache, TOOL_NAMES_COUNT_CAP = 100, TOOL_NAMES_CHAR_BUDGET = 1024, TOOL_NAME_MAX_CHARS = 120, MAX_COMMAND_CHARS = 2000;
|
|
296
317
|
var init_trace_filters = () => {};
|
|
297
318
|
|
|
298
319
|
// src/env/log-trace/decorator.ts
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AgentComponentAdapter,
|
|
9
9
|
init_agent_component_adapter
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-bjtc9d35.js";
|
|
11
11
|
import {
|
|
12
12
|
PythonCallNode,
|
|
13
13
|
SkillNode,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
init_skill_node,
|
|
18
18
|
init_tool_node,
|
|
19
19
|
init_workflow_node
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-9710zwwz.js";
|
|
21
21
|
import {
|
|
22
22
|
WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
|
|
23
23
|
init_json_schema_to_zod,
|
|
@@ -28,20 +28,20 @@ import {
|
|
|
28
28
|
} from "./roy-agent-core-1db4vpc6.js";
|
|
29
29
|
import {
|
|
30
30
|
init_hooks
|
|
31
|
-
} from "./roy-agent-core-
|
|
31
|
+
} from "./roy-agent-core-g8yr733d.js";
|
|
32
32
|
import {
|
|
33
33
|
WorkflowHookPoints,
|
|
34
34
|
emitWorkflowNodeHook,
|
|
35
35
|
emitWorkflowRunHook
|
|
36
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-h83zdsrq.js";
|
|
37
37
|
import {
|
|
38
38
|
TemplateResolver,
|
|
39
39
|
init_template_resolver
|
|
40
|
-
} from "./roy-agent-core-
|
|
40
|
+
} from "./roy-agent-core-tjnabyvq.js";
|
|
41
41
|
import {
|
|
42
42
|
DAGManager,
|
|
43
43
|
init_dag_manager
|
|
44
|
-
} from "./roy-agent-core-
|
|
44
|
+
} from "./roy-agent-core-e08bvpaq.js";
|
|
45
45
|
import {
|
|
46
46
|
WorkflowError,
|
|
47
47
|
createWorkflowEvent,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
import {
|
|
58
58
|
TracedAs,
|
|
59
59
|
init_decorator
|
|
60
|
-
} from "./roy-agent-core-
|
|
60
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
61
61
|
import {
|
|
62
62
|
createLogger,
|
|
63
63
|
init_logger
|
|
@@ -511,7 +511,7 @@ async function spawnWecomReply(options) {
|
|
|
511
511
|
throw new Error("No chatId specified for wecom failure reply");
|
|
512
512
|
}
|
|
513
513
|
try {
|
|
514
|
-
const { sendWecomReply } = await import("
|
|
514
|
+
const { sendWecomReply } = await import("../../env/event-source/wecom-respond-registry.js");
|
|
515
515
|
const result = await sendWecomReply({
|
|
516
516
|
sourceId: typeof params?.sourceId === "string" && params.sourceId || "unknown",
|
|
517
517
|
rawChatId: chatId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NEW_TASK_ID_HASH_PLACEHOLDER,
|
|
3
3
|
NEW_TASK_ID_PLACEHOLDER
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-d6zdbgtc.js";
|
|
5
5
|
import {
|
|
6
6
|
TASK_DISCIPLINE_GOALS
|
|
7
7
|
} from "./roy-agent-core-m46fe3x4.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
getEnvContextOrEmpty,
|
|
18
18
|
init_env_context,
|
|
19
19
|
setCurrentTaskId
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-p31ftgq9.js";
|
|
21
21
|
import {
|
|
22
22
|
createLogger,
|
|
23
23
|
init_logger
|
|
@@ -62,7 +62,8 @@ var CreateTaskToolSchema = z.object({
|
|
|
62
62
|
` + ` C. 新建根任务 → 省略 parent_task_id(让树根 ≤10)
|
|
63
63
|
` + `如何找到 parent_task_id:使用 task_tree(depth=2) 获取的树形结构,
|
|
64
64
|
` + "根据节点 id 选择合适的父任务 ID(来自 tree 输出,**不要硬编码**数字)。"),
|
|
65
|
-
context: z.string().default('{"type":"unknown"}').describe("JSON string with time-space positioning information for task continuity. " + "This field is crucial for Agent task handoff. " + "Core fields: worktree_path (git worktree path), branch (current branch), type (feature/bug/refactor/chore). " + 'Example for coding: {"worktree_path": "/path/worktree", "branch": "feature/xyz", "type": "feature"}. ' + 'Example for other: {"type": "general"}. ' + `If unknown, use '{}' or '{"type":"unknown"}'. ` + "IMPORTANT: Must be a valid JSON string! " + "**Task #4467 — similar_task_ids (REQUIRED)**: array of existing task ids that " + "cover the same ground as this request, used by the task:before.create decision " + "check to suggest reusing/reopening instead of creating a duplicate. " + "Search first (task_search / task_get), then pass the ids. " + "It may be an empty array [] if you searched and found nothing related — " + "but the field itself must be present. " + 'Example: {"type":"feature", "similar_task_ids": [4433, 4445]}')
|
|
65
|
+
context: z.string().default('{"type":"unknown"}').describe("JSON string with time-space positioning information for task continuity. " + "This field is crucial for Agent task handoff. " + "Core fields: worktree_path (git worktree path), branch (current branch), type (feature/bug/refactor/chore). " + 'Example for coding: {"worktree_path": "/path/worktree", "branch": "feature/xyz", "type": "feature"}. ' + 'Example for other: {"type": "general"}. ' + `If unknown, use '{}' or '{"type":"unknown"}'. ` + "IMPORTANT: Must be a valid JSON string! " + "**Task #4467 — similar_task_ids (REQUIRED)**: array of existing task ids that " + "cover the same ground as this request, used by the task:before.create decision " + "check to suggest reusing/reopening instead of creating a duplicate. " + "Search first (task_search / task_get), then pass the ids. " + "It may be an empty array [] if you searched and found nothing related — " + "but the field itself must be present. " + 'Example: {"type":"feature", "similar_task_ids": [4433, 4445]}'),
|
|
66
|
+
owner: z.union([z.string(), z.null()]).optional().describe("负责人(owner):这个任务由**谁**负责推进,可空(不传 / 传 null 即未指派)。" + "取值为自由字符串(open_id / 用户名 / 邮箱均可,core 不解释格式);" + "多人协作场景下用它区分负责人,与 sessionId(谁在操作)、project_path(哪个项目)正交。" + "向后兼容:省略该字段时任务以 owner=null 创建。")
|
|
66
67
|
});
|
|
67
68
|
var GetTaskToolSchema = withLegacyTaskId({
|
|
68
69
|
include_operations: z.boolean().optional().default(true).describe("Include operation records (milestones / process log) with the task. " + "Defaults to true — the task's operation history is part of its detail. " + "Pass false for a lean task-only response.")
|
|
@@ -100,7 +101,8 @@ var UpdateTaskToolSchema = withLegacyTaskId({
|
|
|
100
101
|
tags: z.array(z.string()).optional(),
|
|
101
102
|
project_path: z.string().optional().describe("Project path, identifies which project this task belongs to"),
|
|
102
103
|
context: z.string().optional().describe("Task context information for storing additional context"),
|
|
103
|
-
parent_task_id: z.union([z.number(), z.null()]).optional().describe("Parent task ID (set to null to make it a root task)")
|
|
104
|
+
parent_task_id: z.union([z.number(), z.null()]).optional().describe("Parent task ID (set to null to make it a root task)"),
|
|
105
|
+
owner: z.union([z.string(), z.null()]).optional().describe("负责人(owner):可空。传字符串 = 指派/改派该负责人;传 null 或空字符串 = 清空(未指派);" + "**省略该字段** = 不改动(与 status / progress 等字段语义一致)。" + "用于多人协作场景标注任务负责人。")
|
|
104
106
|
});
|
|
105
107
|
var DeleteTaskToolSchema = z.object({
|
|
106
108
|
task_id: z.number().describe("Task ID")
|
|
@@ -138,6 +140,12 @@ import { execSync } from "child_process";
|
|
|
138
140
|
init_logger();
|
|
139
141
|
var logger = createLogger("task-child-context");
|
|
140
142
|
var STRIPPED_KEYS = ["commit", "token", "secret", "password", "api_key"];
|
|
143
|
+
var ONE_SHOT_HINT_KEYS = [
|
|
144
|
+
"decision_hint",
|
|
145
|
+
"decision_hint_delivered_at",
|
|
146
|
+
"decision_hint_digest",
|
|
147
|
+
"completion_hint"
|
|
148
|
+
];
|
|
141
149
|
function stripSensitiveKeys(obj) {
|
|
142
150
|
if (obj === null || obj === undefined)
|
|
143
151
|
return obj;
|
|
@@ -203,7 +211,8 @@ function inheritChildContext(args) {
|
|
|
203
211
|
"parent_branch",
|
|
204
212
|
"type",
|
|
205
213
|
"prior_context",
|
|
206
|
-
"created_at"
|
|
214
|
+
"created_at",
|
|
215
|
+
...ONE_SHOT_HINT_KEYS
|
|
207
216
|
]);
|
|
208
217
|
for (const [k, v] of Object.entries(parentCtx)) {
|
|
209
218
|
if (reserved.has(k))
|
|
@@ -511,7 +520,8 @@ function createTaskTool(taskComponent) {
|
|
|
511
520
|
tags: inheritedTags,
|
|
512
521
|
sessionId,
|
|
513
522
|
project_path: inheritedProjectPath ?? (callerProjectPathIsExplicit ? callerProjectPath : UNKNOWN_PROJECT_PATH),
|
|
514
|
-
context: enrichedContext
|
|
523
|
+
context: enrichedContext,
|
|
524
|
+
owner: params.owner ?? null
|
|
515
525
|
});
|
|
516
526
|
setCurrentTaskId(task.id);
|
|
517
527
|
logger2.info(`[createTask] Trace: Task #${task.id} created, currentTaskId=${task.id} set in EnvContext`);
|
|
@@ -870,7 +880,8 @@ function updateTaskTool(taskComponent) {
|
|
|
870
880
|
tags: params.tags,
|
|
871
881
|
project_path: params.project_path,
|
|
872
882
|
context: params.context,
|
|
873
|
-
parent_task_id: params.parent_task_id
|
|
883
|
+
parent_task_id: params.parent_task_id,
|
|
884
|
+
owner: params.owner
|
|
874
885
|
});
|
|
875
886
|
if (!task) {
|
|
876
887
|
return {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isToolReasonRequired
|
|
3
|
+
} from "./roy-agent-core-wxrkcb17.js";
|
|
1
4
|
import {
|
|
2
5
|
sniffImageMime
|
|
3
6
|
} from "./roy-agent-core-zjdzk1gg.js";
|
|
@@ -11,7 +14,7 @@ import {
|
|
|
11
14
|
embedResultFilter,
|
|
12
15
|
init_decorator,
|
|
13
16
|
init_trace_filters
|
|
14
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
15
18
|
import {
|
|
16
19
|
createLogger,
|
|
17
20
|
init_logger
|
|
@@ -309,7 +312,20 @@ function toolParametersToJsonSchema(parameters) {
|
|
|
309
312
|
if (deref["properties"] && typeof deref["properties"] === "object") {
|
|
310
313
|
deref["type"] = "object";
|
|
311
314
|
} else {
|
|
312
|
-
|
|
315
|
+
const emptyWithReason = {
|
|
316
|
+
type: "object",
|
|
317
|
+
properties: {}
|
|
318
|
+
};
|
|
319
|
+
if (isToolReasonRequired()) {
|
|
320
|
+
emptyWithReason["properties"] = {
|
|
321
|
+
reason: {
|
|
322
|
+
type: "string",
|
|
323
|
+
description: "一句话说明为什么调用此工具(将随调用记录存入会话,便于事后追溯)"
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
emptyWithReason["required"] = ["reason"];
|
|
327
|
+
}
|
|
328
|
+
return emptyWithReason;
|
|
313
329
|
}
|
|
314
330
|
}
|
|
315
331
|
if (!deref["properties"] || typeof deref["properties"] !== "object") {
|
|
@@ -318,6 +334,22 @@ function toolParametersToJsonSchema(parameters) {
|
|
|
318
334
|
delete deref["definitions"];
|
|
319
335
|
delete deref["$defs"];
|
|
320
336
|
delete deref["$schema"];
|
|
337
|
+
if (isToolReasonRequired()) {
|
|
338
|
+
const props = deref["properties"];
|
|
339
|
+
if (!props["reason"]) {
|
|
340
|
+
props["reason"] = {
|
|
341
|
+
type: "string",
|
|
342
|
+
description: "一句话说明为什么调用此工具(将随调用记录存入会话,便于事后追溯)"
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
const required = deref["required"];
|
|
346
|
+
if (Array.isArray(required)) {
|
|
347
|
+
if (!required.includes("reason"))
|
|
348
|
+
required.push("reason");
|
|
349
|
+
} else {
|
|
350
|
+
deref["required"] = ["reason"];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
321
353
|
return deref;
|
|
322
354
|
}
|
|
323
355
|
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCompatibleDatabase,
|
|
3
|
+
init_sqlite_task_store
|
|
4
|
+
} from "./roy-agent-core-m66ysky0.js";
|
|
5
|
+
import {
|
|
6
|
+
createLogger,
|
|
7
|
+
init_logger
|
|
8
|
+
} from "./roy-agent-core-7f7t9wwp.js";
|
|
9
|
+
|
|
10
|
+
// src/env/task/plugins/wecom-session-card-store.ts
|
|
11
|
+
init_logger();
|
|
12
|
+
init_sqlite_task_store();
|
|
13
|
+
import { join } from "path";
|
|
14
|
+
var logger = createLogger("wecom:session-card-state");
|
|
15
|
+
|
|
16
|
+
class MemoryWecomSessionCardStore {
|
|
17
|
+
records = new Map;
|
|
18
|
+
upsert(state) {
|
|
19
|
+
this.records.set(state.sessionId, { ...state });
|
|
20
|
+
}
|
|
21
|
+
get(sessionId) {
|
|
22
|
+
const r = this.records.get(sessionId);
|
|
23
|
+
return r ? { ...r } : undefined;
|
|
24
|
+
}
|
|
25
|
+
list() {
|
|
26
|
+
return [...this.records.values()].map((r) => ({ ...r }));
|
|
27
|
+
}
|
|
28
|
+
markClosed(sessionId) {
|
|
29
|
+
const r = this.records.get(sessionId);
|
|
30
|
+
if (!r)
|
|
31
|
+
return;
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
r.lifecycle = r.lifecycle === "running" ? "completed" : r.lifecycle;
|
|
34
|
+
r.closedAt = now;
|
|
35
|
+
r.updatedAt = now;
|
|
36
|
+
}
|
|
37
|
+
delete(sessionId) {
|
|
38
|
+
this.records.delete(sessionId);
|
|
39
|
+
}
|
|
40
|
+
close() {
|
|
41
|
+
this.records.clear();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function createMemoryWecomSessionCardStore() {
|
|
45
|
+
return new MemoryWecomSessionCardStore;
|
|
46
|
+
}
|
|
47
|
+
function rowToSessionState(row) {
|
|
48
|
+
const state = {
|
|
49
|
+
sessionId: row.session_id,
|
|
50
|
+
chatId: row.chat_id,
|
|
51
|
+
chatType: row.chat_type === "group" ? "group" : "single",
|
|
52
|
+
cardTaskId: row.card_task_id,
|
|
53
|
+
lifecycle: row.lifecycle ?? "running",
|
|
54
|
+
createdAt: row.created_at,
|
|
55
|
+
updatedAt: row.updated_at
|
|
56
|
+
};
|
|
57
|
+
if (row.source_id)
|
|
58
|
+
state.sourceId = row.source_id;
|
|
59
|
+
if (row.title)
|
|
60
|
+
state.title = row.title;
|
|
61
|
+
if (row.agent_type)
|
|
62
|
+
state.agentType = row.agent_type;
|
|
63
|
+
if (row.started_at)
|
|
64
|
+
state.startedAt = row.started_at;
|
|
65
|
+
if (row.associated_task_id !== null && row.associated_task_id !== undefined) {
|
|
66
|
+
state.associatedTaskId = row.associated_task_id;
|
|
67
|
+
}
|
|
68
|
+
if (row.milestones)
|
|
69
|
+
state.milestones = row.milestones;
|
|
70
|
+
if (row.closed_at !== null && row.closed_at !== undefined) {
|
|
71
|
+
state.closedAt = row.closed_at;
|
|
72
|
+
}
|
|
73
|
+
return state;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
class SqliteWecomSessionCardStore {
|
|
77
|
+
db;
|
|
78
|
+
constructor(dbPath) {
|
|
79
|
+
this.db = createCompatibleDatabase(dbPath);
|
|
80
|
+
try {
|
|
81
|
+
this.db.run("PRAGMA journal_mode = WAL");
|
|
82
|
+
this.db.run("PRAGMA busy_timeout = 5000");
|
|
83
|
+
this.db.run("PRAGMA synchronous = NORMAL");
|
|
84
|
+
} catch {}
|
|
85
|
+
this.db.run(`
|
|
86
|
+
CREATE TABLE IF NOT EXISTS wecom_session_card (
|
|
87
|
+
session_id TEXT PRIMARY KEY,
|
|
88
|
+
chat_id TEXT NOT NULL,
|
|
89
|
+
chat_type TEXT NOT NULL DEFAULT 'single',
|
|
90
|
+
source_id TEXT,
|
|
91
|
+
card_task_id TEXT NOT NULL,
|
|
92
|
+
lifecycle TEXT NOT NULL DEFAULT 'running',
|
|
93
|
+
title TEXT,
|
|
94
|
+
agent_type TEXT,
|
|
95
|
+
started_at TEXT,
|
|
96
|
+
associated_task_id INTEGER,
|
|
97
|
+
milestones TEXT,
|
|
98
|
+
created_at INTEGER NOT NULL,
|
|
99
|
+
updated_at INTEGER NOT NULL,
|
|
100
|
+
closed_at INTEGER
|
|
101
|
+
)
|
|
102
|
+
`);
|
|
103
|
+
this.db.run("CREATE INDEX IF NOT EXISTS idx_wecom_session_card_lifecycle " + "ON wecom_session_card(lifecycle)");
|
|
104
|
+
}
|
|
105
|
+
upsert(state) {
|
|
106
|
+
this.db.prepare(`INSERT INTO wecom_session_card
|
|
107
|
+
(session_id, chat_id, chat_type, source_id, card_task_id, lifecycle,
|
|
108
|
+
title, agent_type, started_at, associated_task_id, milestones,
|
|
109
|
+
created_at, updated_at, closed_at)
|
|
110
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
111
|
+
ON CONFLICT(session_id) DO UPDATE SET
|
|
112
|
+
chat_id = excluded.chat_id,
|
|
113
|
+
chat_type = excluded.chat_type,
|
|
114
|
+
source_id = excluded.source_id,
|
|
115
|
+
card_task_id = excluded.card_task_id,
|
|
116
|
+
lifecycle = excluded.lifecycle,
|
|
117
|
+
title = excluded.title,
|
|
118
|
+
agent_type = excluded.agent_type,
|
|
119
|
+
started_at = excluded.started_at,
|
|
120
|
+
associated_task_id = excluded.associated_task_id,
|
|
121
|
+
milestones = excluded.milestones,
|
|
122
|
+
updated_at = excluded.updated_at,
|
|
123
|
+
closed_at = excluded.closed_at`).run(state.sessionId, state.chatId, state.chatType, state.sourceId ?? null, state.cardTaskId, state.lifecycle, state.title ?? null, state.agentType ?? null, state.startedAt ?? null, state.associatedTaskId ?? null, state.milestones ?? null, state.createdAt, state.updatedAt, state.closedAt ?? null);
|
|
124
|
+
}
|
|
125
|
+
get(sessionId) {
|
|
126
|
+
const row = this.db.prepare("SELECT * FROM wecom_session_card WHERE session_id = ?").get(sessionId);
|
|
127
|
+
return row ? rowToSessionState(row) : undefined;
|
|
128
|
+
}
|
|
129
|
+
list() {
|
|
130
|
+
const rows = this.db.prepare("SELECT * FROM wecom_session_card ORDER BY created_at ASC").all();
|
|
131
|
+
return rows.map(rowToSessionState);
|
|
132
|
+
}
|
|
133
|
+
markClosed(sessionId) {
|
|
134
|
+
const now = Date.now();
|
|
135
|
+
this.db.prepare("UPDATE wecom_session_card SET closed_at = ?, updated_at = ? " + "WHERE session_id = ?").run(now, now, sessionId);
|
|
136
|
+
}
|
|
137
|
+
delete(sessionId) {
|
|
138
|
+
this.db.prepare("DELETE FROM wecom_session_card WHERE session_id = ?").run(sessionId);
|
|
139
|
+
}
|
|
140
|
+
close() {
|
|
141
|
+
try {
|
|
142
|
+
this.db.close?.();
|
|
143
|
+
} catch {}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function getDefaultWecomSessionCardDbPath() {
|
|
147
|
+
const home = process.env.HOME || process.env.USERPROFILE || "/tmp";
|
|
148
|
+
return join(home, ".local", "share", "roy-agent", "wecom-session-cards.db");
|
|
149
|
+
}
|
|
150
|
+
function createWecomSessionCardStore(dbPath) {
|
|
151
|
+
const isTestEnv = "BUN_TEST_WORKER_ID" in process.env;
|
|
152
|
+
if (!dbPath && !process.env.ROY_AGENT_WECOM_SESSION_CARD_DB && isTestEnv) {
|
|
153
|
+
return new MemoryWecomSessionCardStore;
|
|
154
|
+
}
|
|
155
|
+
const path = dbPath ?? process.env.ROY_AGENT_WECOM_SESSION_CARD_DB ?? getDefaultWecomSessionCardDbPath();
|
|
156
|
+
try {
|
|
157
|
+
return new SqliteWecomSessionCardStore(path);
|
|
158
|
+
} catch (err) {
|
|
159
|
+
logger.warn(`WecomSessionCardStore: sqlite unavailable at ${path} ` + `(${err.message}) —— 降级为内存实现`);
|
|
160
|
+
return new MemoryWecomSessionCardStore;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
var sharedStore = null;
|
|
164
|
+
function getSharedWecomSessionCardStore() {
|
|
165
|
+
if (!sharedStore) {
|
|
166
|
+
sharedStore = createWecomSessionCardStore();
|
|
167
|
+
}
|
|
168
|
+
return sharedStore;
|
|
169
|
+
}
|
|
170
|
+
function __resetSharedWecomSessionCardStoreForTest() {
|
|
171
|
+
try {
|
|
172
|
+
sharedStore?.close?.();
|
|
173
|
+
} catch {}
|
|
174
|
+
sharedStore = null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export { MemoryWecomSessionCardStore, createMemoryWecomSessionCardStore, SqliteWecomSessionCardStore, getDefaultWecomSessionCardDbPath, createWecomSessionCardStore, getSharedWecomSessionCardStore, __resetSharedWecomSessionCardStoreForTest };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isValidSessionId
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-cre2y2ct.js";
|
|
4
4
|
import {
|
|
5
5
|
TAG_MAX_COUNT,
|
|
6
6
|
TAG_MIN_COUNT
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-e69qxdyy.js";
|
|
8
8
|
import {
|
|
9
9
|
deliverAskUserMessage
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-9c565frx.js";
|
|
11
11
|
import {
|
|
12
12
|
validateWorkflowDefinition
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-rm7seqwb.js";
|
|
14
14
|
import {
|
|
15
15
|
getCurrentBgTaskId
|
|
16
16
|
} from "./roy-agent-core-c1v263jn.js";
|
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
} from "./roy-agent-core-mkc3zshb.js";
|
|
21
21
|
import {
|
|
22
22
|
init_context
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-tkpp1ba0.js";
|
|
24
24
|
import {
|
|
25
25
|
getEnvContext
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-p31ftgq9.js";
|
|
27
27
|
import {
|
|
28
28
|
TracedAs,
|
|
29
29
|
init_decorator
|
|
30
|
-
} from "./roy-agent-core-
|
|
30
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
31
31
|
import {
|
|
32
32
|
createLogger,
|
|
33
33
|
init_logger
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
PiAiAdapter,
|
|
7
7
|
invoke,
|
|
8
8
|
invokeNonStream
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-aa8kv18f.js";
|
|
10
10
|
import {
|
|
11
11
|
ContextError,
|
|
12
12
|
ErrorCodes
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
18
18
|
import {
|
|
19
19
|
BaseComponent
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-m39v7qpx.js";
|
|
21
21
|
import {
|
|
22
22
|
LLMHookPoints,
|
|
23
23
|
globalHookManager,
|
|
24
24
|
init_global_hook_manager
|
|
25
|
-
} from "./roy-agent-core-
|
|
25
|
+
} from "./roy-agent-core-yet36q5k.js";
|
|
26
26
|
import {
|
|
27
27
|
TracedAs,
|
|
28
28
|
embedParamFilter,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
llmInvokeParamFilter,
|
|
33
33
|
llmInvokeResultFilter,
|
|
34
34
|
wrapFunction
|
|
35
|
-
} from "./roy-agent-core-
|
|
35
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
36
36
|
import {
|
|
37
37
|
createLogger,
|
|
38
38
|
init_logger
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
globalHookManager,
|
|
11
11
|
init_global_hook_manager
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-yet36q5k.js";
|
|
13
13
|
import {
|
|
14
14
|
TracedAs,
|
|
15
15
|
init_decorator,
|
|
16
16
|
wrapFunction
|
|
17
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
18
18
|
import {
|
|
19
19
|
createLogger,
|
|
20
20
|
init_logger
|