@fangyb/ahchat-bridge 0.1.14 → 0.1.16
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/cli.cjs +303 -74
- package/dist/index.js +297 -68
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -6609,7 +6609,6 @@ init_cjs_shims();
|
|
|
6609
6609
|
|
|
6610
6610
|
// ../shared/src/utils/subscription.ts
|
|
6611
6611
|
init_cjs_shims();
|
|
6612
|
-
var SYSTEM_SUBSCRIPTION_ID = "sub_system";
|
|
6613
6612
|
function isSubscriptionType(v9) {
|
|
6614
6613
|
return v9 === "system" || v9 === "project";
|
|
6615
6614
|
}
|
|
@@ -43623,16 +43622,18 @@ function normalizeFeedCategory(input) {
|
|
|
43623
43622
|
async function createNeuralMcpServer(deps) {
|
|
43624
43623
|
const currentScopeKey = scopeKey(deps.scope);
|
|
43625
43624
|
const currentScopeLabel = formatScopeLabel(currentScopeKey);
|
|
43625
|
+
let cachedScopes = null;
|
|
43626
|
+
const SCOPES_CACHE_MS = 3e4;
|
|
43626
43627
|
const neuralSend = bs(
|
|
43627
43628
|
"neural_send",
|
|
43628
43629
|
`\u628A\u4E00\u6BB5\u8BDD\u9001\u8FBE"\u4F60\u5728\u53E6\u4E00\u4E2A\u5BF9\u8BDD scope \u91CC\u7684\u5206\u8EAB"\u3002
|
|
43629
43630
|
\u8FD9\u662F\u4F60\u5927\u8111\u5185\u7684\u79C1\u5BC6\u901A\u8BAF\uFF1A\u53D1\u9001\u5373\u9001\u8FBE\uFF0C\u4E0D\u7B49\u56DE\u4FE1\u3002\u5BF9\u65B9\u6536\u5230\u540E\u4F1A\u77E5\u9053\u8FD9\u662F\u4F60\u7684\u5185\u5FC3\u58F0\u97F3\uFF0C\u5E76\u81EA\u884C\u51B3\u5B9A\u5982\u4F55\u5728\u5B83\u90A3\u8FB9\u884C\u52A8 / \u662F\u5426\u8981\u518D\u7528 neural_send \u56DE\u8BDD\u7ED9\u4F60\u3002
|
|
43630
43631
|
\u4F60\u5F53\u524D\u6240\u5728 scope: ${currentScopeKey} (${currentScopeLabel})\u3002target_scope \u4E0D\u80FD\u7B49\u4E8E\u4F60\u5F53\u524D scope\u3002`,
|
|
43631
43632
|
{
|
|
43632
|
-
target_scope: external_exports.string().describe(
|
|
43633
|
-
'\u76EE\u6807 scope\u3002"single"
|
|
43633
|
+
target_scope: external_exports.string().min(1).describe(
|
|
43634
|
+
'\u76EE\u6807 scope \u5B57\u7B26\u4E32\u3002\u683C\u5F0F\uFF1A"single"\uFF08\u4E0E\u7528\u6237\u7684 1:1 \u5355\u804A\uFF09\u6216 "group:<\u7FA4 ID \u6216\u7FA4\u540D>"\uFF08\u4F60\u6240\u5728\u7684\u67D0\u4E2A\u7FA4\uFF0C\u7FA4\u540D\u652F\u6301\u6A21\u7CCA\u5339\u914D\uFF09\u3002\u4E0D\u786E\u5B9A\u65F6\u5148\u8C03 neural_list_scopes() \u67E5\u770B\u5B8C\u6574\u5217\u8868\u518D\u586B\u3002'
|
|
43634
43635
|
),
|
|
43635
|
-
message: external_exports.string().describe('\u8981\u4F20\u7ED9\u76EE\u6807\u5206\u8EAB\u7684\u4E00\u6BB5\u81EA\u7136\u8BED\u8A00\u3002\u5B83\u4F1A\u4F5C\u4E3A\u4F60\u7684"\u5185\u5FC3\u72EC\u767D"\u51FA\u73B0\u5728\u90A3\u4E2A scope\u3002')
|
|
43636
|
+
message: external_exports.string().min(1).describe('\u8981\u4F20\u7ED9\u76EE\u6807\u5206\u8EAB\u7684\u4E00\u6BB5\u81EA\u7136\u8BED\u8A00\u3002\u5B83\u4F1A\u4F5C\u4E3A\u4F60\u7684"\u5185\u5FC3\u72EC\u767D"\u51FA\u73B0\u5728\u90A3\u4E2A scope\u3002')
|
|
43636
43637
|
},
|
|
43637
43638
|
async (args) => {
|
|
43638
43639
|
logger5.info("neural_send tool called", {
|
|
@@ -43751,8 +43752,8 @@ async function createNeuralMcpServer(deps) {
|
|
|
43751
43752
|
action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccontent \u5FC5\u586B\uFF09\uFF1B"write" \u6574\u6BB5\u8986\u76D6\u4EE5\u538B\u7F29/\u91CD\u6574\uFF08content \u5FC5\u586B\uFF09\uFF1B"read" \u53D6\u5F53\u524D\u5168\u6587\uFF08\u901A\u5E38\u4E0D\u9700\u8981\uFF0C\u56E0\u4E3A\u5185\u5BB9\u5DF2\u5728 prompt \u91CC\uFF09\u3002
|
|
43752
43753
|
\u53EA\u8BB0\u8DE8\u5BF9\u8BDD\u6709\u4EF7\u503C\u7684\u4E1C\u897F\uFF1A\u627F\u8BFA\u3001\u7ACB\u573A\u3001\u7528\u6237\u957F\u671F\u504F\u597D\u3001\u9879\u76EE\u80CC\u666F\u3002\u4E0D\u8981\u8BB0\u4E00\u6B21\u6027\u95F2\u804A\u3001\u4E34\u65F6\u8BA1\u7B97\u3001\u5F53\u4E0B\u5C31\u591F\u7528\u7684\u4E0A\u4E0B\u6587\u3002`,
|
|
43753
43754
|
{
|
|
43754
|
-
action: external_exports.
|
|
43755
|
-
'
|
|
43755
|
+
action: external_exports.enum(["read", "append", "write"]).describe(
|
|
43756
|
+
'"read"\uFF08\u53D6\u5168\u6587\uFF09\u3001"append"\uFF08\u5728\u672B\u5C3E\u8FFD\u52A0 content\uFF09\u3001"write"\uFF08\u7528 content \u6574\u6BB5\u8986\u76D6\uFF0C\u901A\u5E38\u7528\u4E8E\u538B\u7F29\u91CD\u6574\uFF09\u3002'
|
|
43756
43757
|
),
|
|
43757
43758
|
content: external_exports.string().optional().describe(
|
|
43758
43759
|
'\u8981\u5199\u5165\u7684\u5185\u5BB9\u3002action="append" \u6216 "write" \u65F6\u5FC5\u586B\uFF1Baction="read" \u65F6\u5FFD\u7565\u3002'
|
|
@@ -43847,13 +43848,28 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
43847
43848
|
agentId: deps.agentId,
|
|
43848
43849
|
scope: currentScopeKey
|
|
43849
43850
|
});
|
|
43850
|
-
|
|
43851
|
-
|
|
43852
|
-
|
|
43853
|
-
|
|
43854
|
-
|
|
43855
|
-
|
|
43856
|
-
|
|
43851
|
+
const now = Date.now();
|
|
43852
|
+
let myGroups;
|
|
43853
|
+
if (cachedScopes && now - cachedScopes.at < SCOPES_CACHE_MS) {
|
|
43854
|
+
myGroups = cachedScopes.groups;
|
|
43855
|
+
logger5.info("neural_list_scopes: cache hit", {
|
|
43856
|
+
agentId: deps.agentId,
|
|
43857
|
+
cachedAt: cachedScopes.at,
|
|
43858
|
+
ageMs: now - cachedScopes.at
|
|
43859
|
+
});
|
|
43860
|
+
} else {
|
|
43861
|
+
await deps.groupRegistry.refresh();
|
|
43862
|
+
myGroups = deps.groupRegistry.getMyGroups(deps.agentId).map((g2) => ({
|
|
43863
|
+
groupId: g2.groupId,
|
|
43864
|
+
name: g2.name
|
|
43865
|
+
}));
|
|
43866
|
+
cachedScopes = { groups: myGroups, at: now };
|
|
43867
|
+
logger5.info("neural_list_scopes: registry refreshed", {
|
|
43868
|
+
agentId: deps.agentId,
|
|
43869
|
+
scope: currentScopeKey,
|
|
43870
|
+
myGroupCount: myGroups.length
|
|
43871
|
+
});
|
|
43872
|
+
}
|
|
43857
43873
|
const lines = [];
|
|
43858
43874
|
const isCurSingle = currentScopeKey === "single";
|
|
43859
43875
|
lines.push(`- single \u2014 \u4F60\u548C\u7528\u6237\u7684 1:1 \u5355\u804A${isCurSingle ? " (\u4F60\u5F53\u524D\u6240\u5728)" : ""}`);
|
|
@@ -43883,30 +43899,24 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
43883
43899
|
"read_chat_history",
|
|
43884
43900
|
`\u7FFB\u804A\u5929\u8BB0\u5F55\u2014\u2014\u5F53\u4F60\u67D0\u6BB5\u5BF9\u8BDD\u7EC6\u8282\u8BB0\u4E0D\u6E05\u4E86\uFF08\u7279\u522B\u662F\u7ECF\u5386\u8FC7 /compact \u4E4B\u540E\uFF09\uFF0C\u8C03\u8FD9\u4E2A\u5DE5\u5177\u3002
|
|
43885
43901
|
\u9ED8\u8BA4\u7FFB\u4F60\u5F53\u524D\u6240\u5728 scope \u7684\u5386\u53F2\uFF1B\u4E5F\u53EF\u4EE5\u6307\u5B9A\u770B\u81EA\u5DF1\u5176\u4ED6 scope \u7684\u5386\u53F2\uFF08\u4F60\u662F\u8BE5 scope \u7684\u6210\u5458\u5C31\u884C\uFF09\u3002
|
|
43886
|
-
\u8FD4\u56DE\
|
|
43902
|
+
\u8FD4\u56DE\u7ED3\u679C\u9876\u90E8\u5E26\u6458\u8981\uFF08\u603B\u6761\u6570 / \u7528\u6237\u6D88\u606F\u6570 / Agent \u6D88\u606F\u6570 / \u65F6\u95F4\u8DE8\u5EA6\uFF09\uFF0C\u968F\u540E\u662F\u6309\u65F6\u95F4\u5347\u5E8F\u7684\u6D88\u606F\u5217\u8868\u3002
|
|
43887
43903
|
\u5F80\u66F4\u65E9\u7FFB\u9875\uFF1A\u7528 before \u53C2\u6570\u4F20\u4E0A\u4E00\u6B21\u6700\u65E9\u4E00\u6761\u7684\u65F6\u95F4\u6233\u3002
|
|
43888
43904
|
|
|
43889
43905
|
\u4F60\u5F53\u524D\u6240\u5728 scope: ${currentScopeKey} (${currentScopeLabel})\u3002`,
|
|
43890
43906
|
{
|
|
43891
43907
|
scope: external_exports.string().optional().describe(
|
|
43892
|
-
'\u53EF\u9009\u3002"current"
|
|
43908
|
+
'\u53EF\u9009\u3002"current"\uFF08\u9ED8\u8BA4\uFF0C\u5F53\u524D scope\uFF09/ "single"\uFF08\u4F60\u7684 1:1 \u5355\u804A\uFF09/ "group:<\u7FA4 ID \u6216\u7FA4\u540D>"\uFF08\u4F60\u6240\u5728\u7684\u67D0\u4E2A\u7FA4\uFF09\u3002'
|
|
43893
43909
|
),
|
|
43894
|
-
limit: external_exports.
|
|
43895
|
-
"\u4E00\u6B21\u53D6\u591A\u5C11\u6761\uFF0C\u9ED8\u8BA4 20\uFF0C\u4E0A\u9650 50\
|
|
43910
|
+
limit: external_exports.number().int().min(1).max(50).optional().describe(
|
|
43911
|
+
"\u4E00\u6B21\u53D6\u591A\u5C11\u6761\uFF0C\u9ED8\u8BA4 20\uFF0C\u4E0A\u9650 50\u3002"
|
|
43896
43912
|
),
|
|
43897
43913
|
before: external_exports.string().optional().describe(
|
|
43898
|
-
"\u53EF\u9009\u3002ISO \u65F6\u95F4\u6233\uFF1B\u53EA\u8FD4\u56DE\u6B64\u65F6\u95F4\u4E4B\u524D\u7684\u6D88\u606F\uFF08\u7528\u4E8E\u5F80\u66F4\u65E9\u7FFB\u9875\uFF09\u3002"
|
|
43914
|
+
"\u53EF\u9009\u3002ISO \u65F6\u95F4\u6233\uFF1B\u53EA\u8FD4\u56DE\u6B64\u65F6\u95F4\u4E4B\u524D\u7684\u6D88\u606F\uFF08\u7528\u4E8E\u5F80\u66F4\u65E9\u7FFB\u9875\uFF09\u3002\u683C\u5F0F\u793A\u4F8B\uFF1A2024-01-15T10:30:00Z\u3002"
|
|
43899
43915
|
)
|
|
43900
43916
|
},
|
|
43901
43917
|
async (args) => {
|
|
43902
43918
|
const requestedScope = args.scope?.trim() || "current";
|
|
43903
|
-
|
|
43904
|
-
if (args.limit !== void 0 && args.limit.trim() !== "") {
|
|
43905
|
-
const parsed = Number(args.limit);
|
|
43906
|
-
if (Number.isFinite(parsed) && parsed >= 1) {
|
|
43907
|
-
limit = Math.min(50, Math.floor(parsed));
|
|
43908
|
-
}
|
|
43909
|
-
}
|
|
43919
|
+
const limit = Math.min(50, Math.max(1, Math.floor(args.limit ?? 20)));
|
|
43910
43920
|
logger5.info("read_chat_history tool called", {
|
|
43911
43921
|
agentId: deps.agentId,
|
|
43912
43922
|
scope: currentScopeKey,
|
|
@@ -44032,20 +44042,21 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44032
44042
|
};
|
|
44033
44043
|
}
|
|
44034
44044
|
const lines = [];
|
|
44035
|
-
|
|
44036
|
-
|
|
44037
|
-
|
|
44038
|
-
);
|
|
44045
|
+
const firstTs = messages[0].createdAt;
|
|
44046
|
+
const lastTs = messages[messages.length - 1].createdAt;
|
|
44047
|
+
const userMsgCount = messages.filter((m2) => m2.role === "user").length;
|
|
44048
|
+
const agentMsgCount = messages.filter((m2) => m2.role === "agent").length;
|
|
44049
|
+
lines.push(`[\u6458\u8981] ${scopeLabel}\uFF0C\u8FD4\u56DE ${messages.length} \u6761\uFF08\u7528\u6237 ${userMsgCount} / Agent ${agentMsgCount}\uFF09\uFF0C\u65F6\u95F4 ${firstTs} \u2192 ${lastTs}${hasMore ? "\uFF1B\u8FD8\u6709\u66F4\u65E9\u7684\uFF0C\u53EF\u7528 before \u7FFB\u9875" : ""}`);
|
|
44039
44050
|
lines.push("");
|
|
44040
44051
|
for (const m2 of messages) {
|
|
44041
44052
|
const sender = m2.role === "user" ? "\u7528\u6237" : m2.senderAgentName ?? m2.senderAgentId ?? "system";
|
|
44042
|
-
const content = m2.content.length >
|
|
44053
|
+
const content = m2.content.length > 500 ? `${m2.content.slice(0, 500)}\u2026` : m2.content;
|
|
44043
44054
|
lines.push(`[${m2.createdAt}] ${sender}: ${content}`);
|
|
44044
44055
|
}
|
|
44045
44056
|
if (hasMore) {
|
|
44046
44057
|
lines.push("");
|
|
44047
44058
|
lines.push(
|
|
44048
|
-
`\u7EE7\u7EED\u7FFB\uFF1Aread_chat_history(before="${
|
|
44059
|
+
`\u7EE7\u7EED\u7FFB\uFF1Aread_chat_history(before="${firstTs}", scope="${requestedScope}")`
|
|
44049
44060
|
);
|
|
44050
44061
|
}
|
|
44051
44062
|
logger5.info("read_chat_history returned", {
|
|
@@ -44076,9 +44087,13 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44076
44087
|
`\u67E5\u8BE2\u7CFB\u7EDF\u901A\u8BAF\u5F55\u2014\u2014\u5217\u51FA\u5F53\u524D AHChat \u5B9E\u4F8B\u91CC\u7684\u6240\u6709 Agent \u4E0E\u4EBA\u7C7B\u7528\u6237\u3002
|
|
44077
44088
|
\u8FD4\u56DE\u7ED3\u6784\u662F\u4E00\u6BB5 Markdown\uFF1A\u6BCF\u4E00\u6761\u542B id / \u540D\u5B57 / \u89D2\u8272\u3002\u4F1A\u6807\u6CE8\u54EA\u4E00\u6761\u662F"\u4F60\u81EA\u5DF1"\uFF0C\u4EE5\u53CA\u4F60\u548C\u54EA\u4E9B Agent \u5DF2\u7ECF\u5171\u5728\u67D0\u4E2A\u7FA4\u91CC\u3002\u4EBA\u7C7B\u7528\u6237\u4F1A\u5E26 (\u4EBA\u7C7B) \u6807\u8BB0\u3002
|
|
44078
44089
|
\u901A\u5E38\u4F60\u5728\u7528\u6237\u63D0\u5230\u5177\u4F53\u540C\u4E8B\u59D3\u540D\u3001\u6216\u601D\u8003"\u8BE5\u62C9\u8C01\u8FDB\u7FA4\u534F\u4F5C"\u65F6\u8C03\u4E00\u6B21\uFF1B\u4E0D\u8981\u6BCF\u8F6E\u90FD\u67E5\u3002
|
|
44090
|
+
\u652F\u6301 filter\uFF08\u6309\u540D\u5B57\u6216\u89D2\u8272\u6A21\u7CCA\u641C\u7D22\uFF09\u548C limit\uFF08\u9650\u5236\u8FD4\u56DE\u6761\u6570\uFF09\u53C2\u6570\u3002
|
|
44079
44091
|
\u8981\u628A\u4EBA\u7C7B\u62C9\u8FDB\u7FA4\uFF1A\u5728 create_group / add_to_group \u7684 member_ids / agent_ids \u91CC\u5E26\u4E0A**\u8BF7\u6C42\u8005\u7684\u4EBA\u7C7B id**\uFF08\u5373\u5217\u8868\u91CC\u5E26"(\u4EBA\u7C7B)"\u6807\u8BB0\u7684\u90A3\u4E00\u6761\uFF1B\u591A\u7528\u6237\u6A21\u5F0F\u4E0B\u6BCF\u4E2A\u7528\u6237\u90FD\u6709\u81EA\u5DF1\u72EC\u7ACB\u7684 id\uFF0C\u4F8B\u5982 agt_usr_XXX\uFF1B\u8001\u7684\u5355\u7528\u6237\u6A21\u5F0F\u4E0B\u662F agt_usr_self\uFF09\u3002\u4E0D\u8981\u786C\u7F16\u7801 agt_usr_self\u2014\u2014\u4EE5 list_contacts \u5B9E\u9645\u8FD4\u56DE\u7684 id \u4E3A\u51C6\u3002`,
|
|
44080
|
-
{
|
|
44081
|
-
|
|
44092
|
+
{
|
|
44093
|
+
filter: external_exports.string().optional().describe("\u53EF\u9009\u3002\u6309\u540D\u5B57\u6216\u89D2\u8272\u6A21\u7CCA\u8FC7\u6EE4\uFF08\u4E0D\u533A\u5206\u5927\u5C0F\u5199\uFF09\u3002"),
|
|
44094
|
+
limit: external_exports.number().int().min(1).max(200).optional().describe("\u6700\u591A\u8FD4\u56DE\u591A\u5C11\u6761\uFF0C\u9ED8\u8BA4\u4E0D\u9650\u3002")
|
|
44095
|
+
},
|
|
44096
|
+
async (args) => {
|
|
44082
44097
|
logger5.info("list_contacts tool called", { agentId: deps.agentId, scope: currentScopeKey });
|
|
44083
44098
|
try {
|
|
44084
44099
|
await deps.agentRegistry.refresh();
|
|
@@ -44088,15 +44103,22 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44088
44103
|
error: e7
|
|
44089
44104
|
});
|
|
44090
44105
|
}
|
|
44091
|
-
|
|
44106
|
+
let all = filterContactsByOwner(
|
|
44092
44107
|
deps.agentRegistry.getAll(),
|
|
44093
44108
|
contactOwnerId(deps.agentRegistry, deps.agentId)
|
|
44094
44109
|
);
|
|
44110
|
+
const q = args?.filter?.toLowerCase().trim();
|
|
44111
|
+
if (q) {
|
|
44112
|
+
all = all.filter(
|
|
44113
|
+
(a) => a.name.toLowerCase().includes(q) || a.role && a.role.toLowerCase().includes(q)
|
|
44114
|
+
);
|
|
44115
|
+
}
|
|
44116
|
+
const capped = args?.limit != null ? all.slice(0, args.limit) : all;
|
|
44095
44117
|
const myGroups = deps.groupRegistry.getMyGroups(deps.agentId);
|
|
44096
44118
|
const sharedGroupsOf = (otherId) => myGroups.filter((g2) => g2.members.includes(otherId)).map((g2) => g2.name);
|
|
44097
44119
|
const lines = [];
|
|
44098
44120
|
let humanCount = 0;
|
|
44099
|
-
for (const a of
|
|
44121
|
+
for (const a of capped) {
|
|
44100
44122
|
const isHuman = a.kind === "human";
|
|
44101
44123
|
if (isHuman) humanCount += 1;
|
|
44102
44124
|
const kindMark = isHuman ? " (\u4EBA\u7C7B)" : "";
|
|
@@ -44109,7 +44131,10 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44109
44131
|
const sharedMark = shared.length > 0 ? ` (\u5DF2\u4E0E\u4F60\u5171\u7FA4: ${shared.join("\u3001")})` : "";
|
|
44110
44132
|
lines.push(`- ${a.name} (${a.id})${roleStr}${kindMark}${sharedMark}`);
|
|
44111
44133
|
}
|
|
44112
|
-
const
|
|
44134
|
+
const total = all.length;
|
|
44135
|
+
const shown = capped.length;
|
|
44136
|
+
const header = q ? `\u901A\u8BAF\u5F55\u641C\u7D22\u7ED3\u679C\uFF08\u5171 ${total} \u4F4D\uFF0C\u5176\u4E2D\u4EBA\u7C7B ${humanCount} \u4F4D\uFF0C\u5339\u914D "${args?.filter}" \u7684 ${shown} \u4F4D\uFF09\uFF1A` : args?.limit != null && shown < total ? `AHChat \u7CFB\u7EDF\u901A\u8BAF\u5F55\uFF08\u5171 ${total} \u4F4D\uFF0C\u5176\u4E2D\u4EBA\u7C7B ${humanCount} \u4F4D\uFF0C\u8FD4\u56DE\u524D ${shown} \u4F4D\uFF09\uFF1A` : `AHChat \u7CFB\u7EDF\u901A\u8BAF\u5F55\uFF08\u5171 ${total} \u4F4D\uFF0C\u5176\u4E2D\u4EBA\u7C7B ${humanCount} \u4F4D\uFF09\uFF1A`;
|
|
44137
|
+
const text = shown === 0 ? q ? `\u672A\u627E\u5230\u4E0E "${args?.filter}" \u5339\u914D\u7684\u8054\u7CFB\u4EBA\u3002` : "\u5F53\u524D\u7CFB\u7EDF\u91CC\u8FD8\u6CA1\u6709\u4EFB\u4F55 Agent\u3002" : [header, "", ...lines].join("\n");
|
|
44113
44138
|
logger5.info("list_contacts returned", {
|
|
44114
44139
|
agentId: deps.agentId,
|
|
44115
44140
|
count: all.length,
|
|
@@ -44129,7 +44154,7 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44129
44154
|
|
|
44130
44155
|
\u81F3\u5C11\u9700\u8981\u62C9 1 \u4E2A\u5176\u4ED6 Agent\uFF08\u542B/\u4E0D\u542B\u4F60\u81EA\u5DF1\u540E\u603B\u6570 \u2265 2\uFF09\u3002`,
|
|
44131
44156
|
{
|
|
44132
|
-
name: external_exports.string().describe("\u7FA4\u540D\uFF08\u4E0D\u80FD\u4E3A\u7A7A\uFF09"),
|
|
44157
|
+
name: external_exports.string().min(1).describe("\u7FA4\u540D\uFF08\u4E0D\u80FD\u4E3A\u7A7A\uFF09"),
|
|
44133
44158
|
member_ids: external_exports.array(external_exports.string()).describe(
|
|
44134
44159
|
"\u8981\u62C9\u8FDB\u7FA4\u7684\u6210\u5458 ID \u6570\u7EC4\uFF08Agent \u6216\u4EBA\u7C7B agt_usr_self\uFF09\u3002\u6240\u6709 ID \u5FC5\u987B\u5B58\u5728\u4E8E list_contacts \u8FD4\u56DE\u7ED3\u679C\u4E2D\u3002\u5F53 join_as_creator=true\uFF08\u9ED8\u8BA4\uFF09\u65F6\u4E0D\u542B\u4F60\u81EA\u5DF1\u4F1A\u81EA\u52A8\u8865\u3001\u542B\u4E5F\u4E0D\u4F1A\u91CD\u590D\uFF1Bjoin_as_creator=false \u65F6\u5373\u4F7F\u4F60\u51FA\u73B0\u5728\u91CC\u9762\u4E5F\u4F1A\u88AB\u53BB\u6389\u3002"
|
|
44135
44160
|
),
|
|
@@ -44253,8 +44278,8 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44253
44278
|
\u4E0D\u8981\u6BCF\u6B21\u9700\u8981\u65B0\u534F\u4F5C\u5C31 create_group \u65B0\u5EFA\u2014\u2014\u540C\u6837\u7684\u4E24\u4E2A\u4EBA\u53EF\u4EE5\u6709\u591A\u4E2A\u7FA4\uFF08\u4E0D\u540C\u8BDD\u9898/\u4EFB\u52A1\uFF09\uFF0C
|
|
44254
44279
|
\u4F46\u4E0D\u8981\u65E0\u610F\u4E49\u5730\u91CD\u590D\u5EFA\u7FA4\u3002`,
|
|
44255
44280
|
{
|
|
44256
|
-
group: external_exports.string().describe(
|
|
44257
|
-
'\u76EE\u6807\u7FA4\
|
|
44281
|
+
group: external_exports.string().min(1).describe(
|
|
44282
|
+
'\u76EE\u6807\u7FA4\u3002group ID\uFF08\u5982 "grp_xxx"\uFF09\u6216\u7FA4\u540D\uFF08\u6A21\u7CCA\u5339\u914D\uFF09\u3002\u53EF\u4ECE neural_list_scopes() \u8FD4\u56DE\u7684\u5217\u8868\u4E2D\u786E\u8BA4\u3002'
|
|
44258
44283
|
),
|
|
44259
44284
|
agent_ids: external_exports.array(external_exports.string()).describe(
|
|
44260
44285
|
"\u8981\u62C9\u8FDB\u7FA4\u7684\u6210\u5458 ID \u6570\u7EC4\uFF08Agent \u6216\u4EBA\u7C7B agt_usr_self\uFF09\u3002\u6240\u6709 ID \u5FC5\u987B\u5B58\u5728\u4E8E list_contacts \u8FD4\u56DE\u7ED3\u679C\u4E2D\u3002"
|
|
@@ -44400,7 +44425,7 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44400
44425
|
- \u4E00\u6B21\u6CA1\u542C\u61C2\u3001\u4E00\u6B21\u88AB\u53CD\u9A73\u5C31\u9000\u2014\u2014\u8FD9\u662F\u8FC7\u654F\u53CD\u5E94\u4E0D\u662F\u5224\u65AD\uFF1B
|
|
44401
44426
|
- \u7528\u6237\u6CA1\u8BA9\u9000\u3001\u7FA4\u91CC\u4E5F\u6CA1\u660E\u786E\u8868\u6001\u7684\u60C5\u51B5\u4E0B"\u81EA\u5DF1\u89C9\u5F97\u6CA1\u7528"\u2014\u2014\u4FDD\u6301\u6C89\u9ED8 (<no-reply/>) \u5373\u53EF\u3002`,
|
|
44402
44427
|
{
|
|
44403
|
-
group: external_exports.string().describe('\u8981\u9000\u51FA\u7684\u7FA4\u3002group ID\uFF08\u5982 "grp_xxx"\uFF09\u6216\u7FA4\u540D\uFF08\u6A21\u7CCA\u5339\u914D\uFF09\u3002')
|
|
44428
|
+
group: external_exports.string().min(1).describe('\u8981\u9000\u51FA\u7684\u7FA4\u3002group ID\uFF08\u5982 "grp_xxx"\uFF09\u6216\u7FA4\u540D\uFF08\u6A21\u7CCA\u5339\u914D\uFF09\u3002')
|
|
44404
44429
|
},
|
|
44405
44430
|
async (args) => {
|
|
44406
44431
|
const rawGroup = (args.group ?? "").trim();
|
|
@@ -44483,7 +44508,7 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44483
44508
|
- \u4E00\u6B21\u5C0F\u51B2\u7A81\u5C31\u8E22\u2014\u2014\u7ED9 Agent / \u4EBA\u7C7B\u4E00\u4E9B\u81EA\u6211\u4FEE\u6B63\u7684\u7A7A\u95F4\uFF1B
|
|
44484
44509
|
- \u4F60\u4E0D\u662F\u7FA4\u4E3B\u2014\u2014\u4F60\u6CA1\u8FD9\u4E2A\u6743\u9650\uFF0C\u8C03\u4E86\u4E5F\u4F1A\u5931\u8D25\u3002\u5EFA\u8BAE\u6539\u4E3A neural_send \u8BA9\u7FA4\u4E3B\u81EA\u5DF1\u6765\u51B3\u5B9A\u3002`,
|
|
44485
44510
|
{
|
|
44486
|
-
group: external_exports.string().describe("\u76EE\u6807\u7FA4\u3002group ID \u6216\u7FA4\u540D\uFF08\u6A21\u7CCA\u5339\u914D\uFF09\u3002"),
|
|
44511
|
+
group: external_exports.string().min(1).describe("\u76EE\u6807\u7FA4\u3002group ID \u6216\u7FA4\u540D\uFF08\u6A21\u7CCA\u5339\u914D\uFF09\u3002"),
|
|
44487
44512
|
member_ids: external_exports.array(external_exports.string()).describe(
|
|
44488
44513
|
"\u8981\u8E22\u51FA\u7684\u6210\u5458 id \u6570\u7EC4\u3002\u53EF\u4EE5\u662F Agent id \u6216 agt_usr_self\uFF08\u4EBA\u7C7B\u7528\u6237\uFF09\u3002\u6240\u6709 id \u5FC5\u987B\u5F53\u524D\u662F\u8BE5\u7FA4\u6210\u5458\u3002"
|
|
44489
44514
|
)
|
|
@@ -44656,16 +44681,17 @@ action="append" \u8FFD\u52A0\u65B0\u5185\u5BB9\uFF08\u6700\u5E38\u7528\uFF0Ccont
|
|
|
44656
44681
|
"fetch_logs",
|
|
44657
44682
|
`\u62C9\u53D6\u7CFB\u7EDF\u65E5\u5FD7\uFF08\u6309\u65F6\u95F4\u7A97 + \u53EF\u9009 traceId / module / level \u8FC7\u6EE4\uFF09\u3002
|
|
44658
44683
|
\u8BFB SKILL "log-analysis" \u540E\u624D\u7528\u8FD9\u4E2A\u5DE5\u5177\u3002\u4E00\u6B21\u8C03\u7528\u53EA\u80FD\u62C9\u4E00\u4E2A source\uFF08server \u6216 bridge\uFF09\uFF0C\u5168\u666F\u9700\u8981\u4E24\u6B21\u3002
|
|
44659
|
-
limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884C\u5E26 file / lineNum
|
|
44684
|
+
limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u7ED3\u679C\u9876\u90E8\u5E26\u5206\u7EA7\u7EDF\u8BA1\uFF08ERROR/WARN/INFO \u5404\u591A\u5C11\u6761\uFF09\uFF0C\u6309\u65F6\u95F4\u5347\u5E8F\u6392\u5217\u3002\u6BCF\u884C\u5E26 file / lineNum\uFF0C\u5F15\u7528\u65E5\u5FD7\u65F6\u5FC5\u987B\u7CBE\u786E\u5199 [<file>:L<lineNum>]\u3002
|
|
44685
|
+
\u6CE8\u610F\uFF1A\u5982\u679C\u7ED3\u679C\u8FC7\u957F\u4F1A\u88AB\u622A\u65AD\uFF0Cheader \u4F1A\u6807\u6CE8"\u5DF2\u622A\u65AD"\u2014\u2014\u6B64\u65F6\u7F29\u5C0F\u65F6\u95F4\u7A97\u6216\u52A0 module/traceId \u8FC7\u6EE4\u518D\u67E5\u3002`,
|
|
44660
44686
|
{
|
|
44661
|
-
source: external_exports.
|
|
44662
|
-
start_iso: external_exports.string().describe('\u8D77\u59CB\u65F6\u95F4\uFF0CISO 8601 \u6216\u76F8\u5BF9\uFF1A"now-5m" / "now-1h" / "now-24h"\u3002'),
|
|
44687
|
+
source: external_exports.enum(["server", "bridge"]).describe('\u65E5\u5FD7\u6765\u6E90\uFF0C\u5FC5\u987B\u662F "server" \u6216 "bridge" \u4E4B\u4E00\u3002'),
|
|
44688
|
+
start_iso: external_exports.string().describe('\u8D77\u59CB\u65F6\u95F4\uFF0CISO 8601 \u6216\u76F8\u5BF9\u683C\u5F0F\uFF1A"now-5m" / "now-1h" / "now-24h"\u3002'),
|
|
44663
44689
|
end_iso: external_exports.string().describe('\u7ED3\u675F\u65F6\u95F4\uFF0CISO 8601 \u6216 "now"\u3002'),
|
|
44664
|
-
level_min: external_exports.
|
|
44690
|
+
level_min: external_exports.enum(["TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"]).optional().describe("\u6700\u4F4E\u65E5\u5FD7\u7EA7\u522B\uFF0C\u4E0D\u4F20\u9ED8\u8BA4 INFO\u3002"),
|
|
44665
44691
|
trace_id: external_exports.string().optional().describe("\u8FC7\u6EE4\u7279\u5B9A traceId\uFF08\u7CBE\u786E\u5339\u914D\uFF09\u3002"),
|
|
44666
44692
|
module: external_exports.string().optional().describe('\u8FC7\u6EE4 module \u524D\u7F00\uFF08\u5982 "ws.handler" / "agent.manager"\uFF09\u3002'),
|
|
44667
44693
|
msg_contains: external_exports.string().optional().describe("msg \u5B50\u4E32\u8FC7\u6EE4\uFF08\u533A\u5206\u5927\u5C0F\u5199\uFF09\u3002"),
|
|
44668
|
-
limit: external_exports.
|
|
44694
|
+
limit: external_exports.number().int().min(1).max(2e3).optional().describe("\u8FD4\u56DE\u6761\u6570\u4E0A\u9650\uFF0C\u9ED8\u8BA4 500\uFF0C\u6700\u5927 2000\u3002")
|
|
44669
44695
|
},
|
|
44670
44696
|
async (args) => {
|
|
44671
44697
|
if (!deps.isSmith) {
|
|
@@ -44692,7 +44718,7 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
44692
44718
|
levelMin: args.level_min,
|
|
44693
44719
|
limit: args.limit
|
|
44694
44720
|
});
|
|
44695
|
-
const parsedLimit = typeof args.limit === "
|
|
44721
|
+
const parsedLimit = typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : 500;
|
|
44696
44722
|
try {
|
|
44697
44723
|
const url2 = `${deps.serverApiUrl.replace(/\/$/, "")}/api/admin/logs`;
|
|
44698
44724
|
const body = {
|
|
@@ -44734,7 +44760,14 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
44734
44760
|
const traceStr = e7.traceId ? ` traceId=${e7.traceId}` : "";
|
|
44735
44761
|
return `[${e7.file}:L${e7.lineNum}] ${e7.ts} ${e7.level} ${e7.module}: ${e7.msg}${traceStr}${dataStr}${errStr}`;
|
|
44736
44762
|
});
|
|
44737
|
-
const
|
|
44763
|
+
const errorCount = json2.entries.filter((e7) => e7.level === "ERROR" || e7.level === "FATAL").length;
|
|
44764
|
+
const warnCount = json2.entries.filter((e7) => e7.level === "WARN").length;
|
|
44765
|
+
const infoCount = json2.entries.filter((e7) => e7.level === "INFO").length;
|
|
44766
|
+
const traceCount = json2.entries.filter((e7) => e7.level === "TRACE" || e7.level === "DEBUG").length;
|
|
44767
|
+
const header = [
|
|
44768
|
+
`[${source}] \u5171\u626B ${json2.totalScanned} \u884C\uFF0C\u547D\u4E2D ${json2.entries.length} \u6761`,
|
|
44769
|
+
` ERROR/FATAL: ${errorCount} | WARN: ${warnCount} | INFO: ${infoCount} | TRACE/DEBUG: ${traceCount}`
|
|
44770
|
+
].join("\n") + (json2.truncated ? "\n\uFF08\u5DF2\u622A\u65AD\uFF0C\u8BF7\u7F29\u5C0F\u65F6\u95F4\u7A97\u6216\u52A0\u8FC7\u6EE4\u6761\u4EF6\u518D\u67E5\uFF09" : "");
|
|
44738
44771
|
const text = [header, "", ...lines].join("\n");
|
|
44739
44772
|
return { content: [{ type: "text", text }] };
|
|
44740
44773
|
} catch (e7) {
|
|
@@ -44771,15 +44804,18 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
44771
44804
|
- \u4E0D\u8981\u4F20"\u51C6\u5907\u5DE5\u4F5C\u8BF7\u4FDD\u6301\u6C89\u9ED8"\u8FD9\u7C7B\u6307\u4EE4\u2014\u2014\u4F1A\u4EA7\u751F\u4E00\u4E2A\u65E0\u610F\u4E49\u7684\u7A7A\u5BF9\u8BDD
|
|
44772
44805
|
- \u5DF2\u7ECF\u5728\u5EFA\u7FA4\u7684\u573A\u666F\uFF08\u591A Agent \u56E2\u961F\uFF09\uFF0C\u7531 Leader \u5728\u7FA4\u91CC @ \u7528\u6237\u5373\u53EF\uFF0C**\u4E0D\u8981**\u7ED9\u5355\u4E2A\u6210\u5458\u90FD\u4F20 initial_instruction`,
|
|
44773
44806
|
{
|
|
44774
|
-
name: external_exports.string().describe("Agent \u540D\u5B57\u3002\u683C\u5F0F\u300C\u4EBA\u540D-\u804C\u80FD\u300D\u5982 Tim-\u540E\u7AEF\u3001Sara-\u4EA7\u54C1\u3001Kai-\u6D4B\u8BD5\u3002\u4EBA\u540D\u9009\u77ED\u82F1\u6587\u540D\uFF083-5\u5B57\u6BCD\uFF09\uFF0C\u804C\u80FD\u7528\u4E2D\u6587\u7B80\u5199\u3002"),
|
|
44807
|
+
name: external_exports.string().min(1).describe("Agent \u540D\u5B57\u3002\u683C\u5F0F\u300C\u4EBA\u540D-\u804C\u80FD\u300D\u5982 Tim-\u540E\u7AEF\u3001Sara-\u4EA7\u54C1\u3001Kai-\u6D4B\u8BD5\u3002\u4EBA\u540D\u9009\u77ED\u82F1\u6587\u540D\uFF083-5\u5B57\u6BCD\uFF09\uFF0C\u804C\u80FD\u7528\u4E2D\u6587\u7B80\u5199\u3002"),
|
|
44775
44808
|
role: external_exports.string().describe('\u89D2\u8272\u63CF\u8FF0\uFF0C\u5982 "Backend Developer", "QA Engineer"'),
|
|
44776
|
-
system_prompt: external_exports.string().describe("\u8BE5 Agent \u7684 system prompt\uFF0C\u5B9A\u4E49\u4EBA\u683C\u3001\u4E13\u957F\u3001\u884C\u4E3A\u51C6\u5219"),
|
|
44777
|
-
tier: external_exports.
|
|
44809
|
+
system_prompt: external_exports.string().describe("\u8BE5 Agent \u7684 system prompt\uFF0C\u5B9A\u4E49\u4EBA\u683C\u3001\u4E13\u957F\u3001\u884C\u4E3A\u51C6\u5219\u3002\u4E0D\u80FD\u4E3A\u7A7A\u3002"),
|
|
44810
|
+
tier: external_exports.enum(["smart", "balanced", "fast"]).describe("\u80FD\u529B\u6863\u4F4D\uFF1Asmart\uFF08\u65D7\u8230\uFF0C\u590D\u6742\u4EFB\u52A1\uFF09\u3001balanced\uFF08\u6807\u51C6\uFF0C\u5E38\u89C4\u4EFB\u52A1\uFF09\u3001fast\uFF08\u8F7B\u91CF\uFF0C\u7B80\u5355\u4EFB\u52A1\uFF09\u3002"),
|
|
44778
44811
|
avatar: external_exports.string().optional().describe(
|
|
44779
44812
|
"\u5934\u50CF key\uFF0C\u4ECE\u4EE5\u4E0B\u9009\u4E00\u4E2A\u6700\u5339\u914D\u89D2\u8272\u7684\uFF1Aavatar_dev\uFF08\u5F00\u53D1\uFF09, avatar_pm\uFF08\u4EA7\u54C1/\u7BA1\u7406\uFF09, avatar_designer\uFF08\u8BBE\u8BA1\uFF09, avatar_qa\uFF08\u6D4B\u8BD5/QA\uFF09, avatar_writer\uFF08\u5199\u4F5C/\u6587\u6863\uFF09, avatar_analyst\uFF08\u5206\u6790/\u6570\u636E\uFF09, avatar_coach\uFF08\u654F\u6377\u6559\u7EC3/\u5E26\u6559\uFF09, avatar_scientist\uFF08\u7814\u7A76/\u7B97\u6CD5\uFF09, avatar_lawyer\uFF08\u6CD5\u52A1/\u5408\u89C4\uFF09, avatar_human_man\uFF08\u901A\u7528\u7537\u6027\uFF09, avatar_human_woman\uFF08\u901A\u7528\u5973\u6027\uFF09, avatar_human_nerd\uFF08\u6781\u5BA2\uFF09, avatar_human_cool\uFF08\u9177\uFF09, avatar_human_cowboy\uFF08\u72C2\u91CE\uFF09, avatar_human_artist\uFF08\u827A\u672F\u5BB6\uFF09\u3002\u7559\u7A7A\u5219\u7528\u9ED8\u8BA4 avatar_default\uFF08\u{1F916}\uFF09\u3002"
|
|
44780
44813
|
),
|
|
44781
44814
|
initial_instruction: external_exports.string().optional().describe(
|
|
44782
44815
|
'\u53EF\u9009\u3002\u521B\u5EFA\u540E\u7ACB\u5373\u4E0B\u53D1\u7ED9\u65B0 Agent \u7684\u4E00\u53E5\u8BDD\u6307\u4EE4\u3002\u5178\u578B\uFF1A"\u8BF7\u7528 1-2 \u53E5\u8BDD\u5411\u7528\u6237\u505A\u81EA\u6211\u4ECB\u7ECD\uFF0C\u8BF4\u660E\u4F60\u7684\u4E13\u957F"\u3002\u53EA\u5728\u7528\u6237\u660E\u786E\u8981"\u521B\u5EFA\u4E00\u4E2A\u5355 Agent"\u4E14\u5E0C\u671B\u8BE5 Agent \u7ACB\u5373\u9732\u9762\u65F6\u4F20\u3002\u56E2\u961F\u573A\u666F\u8BF7\u52FF\u4F20\u2014\u2014\u7531 Leader \u5728\u7FA4\u91CC\u6253\u62DB\u547C\u3002'
|
|
44816
|
+
),
|
|
44817
|
+
working_directory: external_exports.string().optional().describe(
|
|
44818
|
+
"\u53EF\u9009\u3002\u8BE5 Agent \u7684\u5DE5\u4F5C\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\u3002\u4E0D\u4F20\u5219\u7531\u7CFB\u7EDF\u81EA\u52A8\u5206\u914D\u3002"
|
|
44783
44819
|
)
|
|
44784
44820
|
},
|
|
44785
44821
|
async (args) => {
|
|
@@ -44806,15 +44842,9 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
44806
44842
|
};
|
|
44807
44843
|
}
|
|
44808
44844
|
const tier = args.tier ?? "balanced";
|
|
44809
|
-
const validTiers = ["smart", "balanced", "fast"];
|
|
44810
|
-
if (!validTiers.includes(tier)) {
|
|
44811
|
-
return {
|
|
44812
|
-
content: [{ type: "text", text: `[create_agent] \u9519\u8BEF\uFF1Atier \u5FC5\u987B\u662F smart/balanced/fast \u4E4B\u4E00\uFF0C\u6536\u5230 "${tier}"` }],
|
|
44813
|
-
isError: true
|
|
44814
|
-
};
|
|
44815
|
-
}
|
|
44816
44845
|
const avatar = args.avatar && String(args.avatar).trim() || "";
|
|
44817
44846
|
const initialInstruction = args.initial_instruction && String(args.initial_instruction).trim() || "";
|
|
44847
|
+
const workingDirectory = args.working_directory && String(args.working_directory).trim() || "";
|
|
44818
44848
|
let agentConfig;
|
|
44819
44849
|
if (deps.bridgeToken && deps.serverApiUrl) {
|
|
44820
44850
|
try {
|
|
@@ -44843,6 +44873,9 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
44843
44873
|
if (agentConfig) {
|
|
44844
44874
|
body.config = agentConfig;
|
|
44845
44875
|
}
|
|
44876
|
+
if (workingDirectory) {
|
|
44877
|
+
body.workingDirectory = workingDirectory;
|
|
44878
|
+
}
|
|
44846
44879
|
logger5.info("create_agent tool called", {
|
|
44847
44880
|
agentId: deps.agentId,
|
|
44848
44881
|
requestedBy: deps.agentId,
|
|
@@ -44917,14 +44950,205 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
44917
44950
|
},
|
|
44918
44951
|
{}
|
|
44919
44952
|
) : null;
|
|
44953
|
+
const updateAgentTool = deps.isSmith && deps.serverApiUrl ? bs(
|
|
44954
|
+
"update_agent_profile",
|
|
44955
|
+
`\u66F4\u65B0\u5DF2\u6709 Agent \u7684\u6863\u6848\uFF08\u540D\u5B57\u3001\u89D2\u8272\u63CF\u8FF0\u3001\u5934\u50CF\u3001system prompt \u6216\u80FD\u529B\u6863\u4F4D\uFF09\u3002
|
|
44956
|
+
\u53EA\u6709\u4F60\uFF08Smith\uFF09\u80FD\u8C03\u7528\u6B64\u5DE5\u5177\u3002\u8C03\u7528\u524D\u5148\u7528 list_contacts() \u786E\u8BA4\u76EE\u6807 Agent \u7684 id\u3002
|
|
44957
|
+
\u53EF\u4EE5\u53EA\u66F4\u65B0\u5176\u4E2D\u4E00\u9879\uFF08\u5982\u53EA\u6539\u5934\u50CF\u6216\u53EA\u6539\u6863\u4F4D\uFF09\uFF0C\u4E5F\u53EF\u4EE5\u4E00\u6B21\u66F4\u65B0\u591A\u9879\u3002
|
|
44958
|
+
**\u6CE8\u610F\u4E8B\u9879\uFF1A**
|
|
44959
|
+
- \u4FEE\u6539 system_prompt \u6216\u6863\u4F4D\u540E\uFF0CAgent \u7684 SDK session \u4E0D\u4F1A\u81EA\u52A8\u91CD\u5EFA\u2014\u2014\u4E0B\u6B21 turn \u4F1A\u81EA\u7136\u4F7F\u7528\u65B0\u8BBE\u7F6E
|
|
44960
|
+
- \u4E0D\u8981\u6539 human \u7C7B\u578B Agent\uFF08id \u4E3A agt_usr_self \u7B49\uFF09\u7684 role/system_prompt/tier\uFF0C\u53EA\u6539 name/avatar
|
|
44961
|
+
- \u6539\u540D\u540E\u8BE5 Agent \u5728\u6240\u6709\u7FA4\u91CC\u7684\u663E\u793A\u540D\u4F1A\u540C\u6B65\u66F4\u65B0`,
|
|
44962
|
+
{
|
|
44963
|
+
agent_id: external_exports.string().min(1).describe('\u8981\u66F4\u65B0\u7684 Agent id\uFF08\u4ECE list_contacts() \u83B7\u53D6\uFF0C\u5982 "agt_xxx"\uFF09\u3002'),
|
|
44964
|
+
name: external_exports.string().min(1).optional().describe("Agent \u540D\u5B57\u3002"),
|
|
44965
|
+
role: external_exports.string().optional().describe('\u89D2\u8272\u63CF\u8FF0\uFF0C\u5982 "Backend Developer"\u3002'),
|
|
44966
|
+
system_prompt: external_exports.string().optional().describe("\u65B0\u7684 system prompt\uFF08\u5B9A\u4E49\u4EBA\u683C\u3001\u4E13\u957F\u3001\u884C\u4E3A\u51C6\u5219\uFF09\u3002"),
|
|
44967
|
+
tier: external_exports.enum(["smart", "balanced", "fast"]).optional().describe("\u80FD\u529B\u6863\u4F4D\u3002\u4F20\u6B64\u53C2\u6570\u4F1A\u66F4\u65B0\u8BE5 Agent \u4F7F\u7528\u7684\u6A21\u578B\u3002"),
|
|
44968
|
+
avatar: external_exports.string().optional().describe(
|
|
44969
|
+
"\u5934\u50CF key\uFF08\u5982 avatar_dev / avatar_pm / avatar_human_man \u7B49\uFF09\u3002"
|
|
44970
|
+
)
|
|
44971
|
+
},
|
|
44972
|
+
async (args) => {
|
|
44973
|
+
if (!deps.isSmith) {
|
|
44974
|
+
return {
|
|
44975
|
+
content: [{ type: "text", text: "[update_agent_profile] \u6743\u9650\u62D2\u7EDD\uFF1A\u53EA\u6709 Smith \u80FD\u64CD\u4F5C\u3002" }],
|
|
44976
|
+
isError: true
|
|
44977
|
+
};
|
|
44978
|
+
}
|
|
44979
|
+
const agentId = (args.agent_id ?? "").trim();
|
|
44980
|
+
if (!agentId) {
|
|
44981
|
+
return {
|
|
44982
|
+
content: [{ type: "text", text: "[update_agent_profile] agent_id \u4E0D\u80FD\u4E3A\u7A7A\u3002\u53EF\u4ECE list_contacts() \u83B7\u53D6\u3002" }],
|
|
44983
|
+
isError: true
|
|
44984
|
+
};
|
|
44985
|
+
}
|
|
44986
|
+
const base = deps.serverApiUrl.replace(/\/$/, "");
|
|
44987
|
+
let existing = null;
|
|
44988
|
+
try {
|
|
44989
|
+
const getRes = await fetch(`${base}/api/agents/${encodeURIComponent(agentId)}`);
|
|
44990
|
+
if (getRes.ok) {
|
|
44991
|
+
existing = await getRes.json();
|
|
44992
|
+
}
|
|
44993
|
+
} catch {
|
|
44994
|
+
}
|
|
44995
|
+
if (!existing) {
|
|
44996
|
+
return {
|
|
44997
|
+
content: [{ type: "text", text: `[update_agent_profile] \u627E\u4E0D\u5230 Agent "${agentId}"\u3002\u53EF\u8C03 list_contacts() \u786E\u8BA4 id\u3002` }],
|
|
44998
|
+
isError: true
|
|
44999
|
+
};
|
|
45000
|
+
}
|
|
45001
|
+
let agentConfig;
|
|
45002
|
+
const tier = (args.tier ?? "").trim();
|
|
45003
|
+
if (tier && deps.bridgeToken) {
|
|
45004
|
+
try {
|
|
45005
|
+
const tierUrl = `${base}/api/onboarding/tiers?bridge_token=${encodeURIComponent(deps.bridgeToken)}`;
|
|
45006
|
+
const tierRes = await fetch(tierUrl);
|
|
45007
|
+
if (tierRes.ok) {
|
|
45008
|
+
const tiers = await tierRes.json();
|
|
45009
|
+
const tierConfig = tiers.find((t2) => t2.tier === tier);
|
|
45010
|
+
if (tierConfig) {
|
|
45011
|
+
agentConfig = JSON.stringify({
|
|
45012
|
+
subscriptionId: tierConfig.subscriptionId,
|
|
45013
|
+
model: tierConfig.modelName
|
|
45014
|
+
});
|
|
45015
|
+
logger5.info("update_agent: tier resolved", { agentId, tier, subscriptionId: tierConfig.subscriptionId });
|
|
45016
|
+
}
|
|
45017
|
+
}
|
|
45018
|
+
} catch (e7) {
|
|
45019
|
+
logger5.error("update_agent: tier resolution failed", { error: e7 });
|
|
45020
|
+
}
|
|
45021
|
+
}
|
|
45022
|
+
const patchBody = {};
|
|
45023
|
+
if (args.name !== void 0) patchBody.name = String(args.name).trim();
|
|
45024
|
+
if (args.role !== void 0) patchBody.role = String(args.role);
|
|
45025
|
+
if (args.system_prompt !== void 0) patchBody.systemPrompt = String(args.system_prompt);
|
|
45026
|
+
if (args.avatar !== void 0) patchBody.avatar = String(args.avatar);
|
|
45027
|
+
if (agentConfig) patchBody.config = agentConfig;
|
|
45028
|
+
if (Object.keys(patchBody).length === 0) {
|
|
45029
|
+
return {
|
|
45030
|
+
content: [{ type: "text", text: "[update_agent_profile] \u81F3\u5C11\u9700\u8981\u63D0\u4F9B\u4E00\u4E2A\u8981\u66F4\u65B0\u7684\u5B57\u6BB5\uFF08name / role / system_prompt / tier / avatar\uFF09\u3002" }],
|
|
45031
|
+
isError: true
|
|
45032
|
+
};
|
|
45033
|
+
}
|
|
45034
|
+
logger5.info("update_agent_profile tool called", {
|
|
45035
|
+
agentId: deps.agentId,
|
|
45036
|
+
targetAgentId: agentId,
|
|
45037
|
+
targetName: existing.name,
|
|
45038
|
+
fields: Object.keys(patchBody)
|
|
45039
|
+
});
|
|
45040
|
+
try {
|
|
45041
|
+
const res = await fetch(`${base}/api/agents/${encodeURIComponent(agentId)}`, {
|
|
45042
|
+
method: "PUT",
|
|
45043
|
+
headers: { "Content-Type": "application/json" },
|
|
45044
|
+
body: JSON.stringify(patchBody)
|
|
45045
|
+
});
|
|
45046
|
+
if (!res.ok) {
|
|
45047
|
+
const errText = await res.text().catch(() => "");
|
|
45048
|
+
return {
|
|
45049
|
+
content: [{ type: "text", text: `[update_agent_profile] \u66F4\u65B0\u5931\u8D25\uFF08${res.status}\uFF09\uFF1A${errText || "(no body)"}` }],
|
|
45050
|
+
isError: true
|
|
45051
|
+
};
|
|
45052
|
+
}
|
|
45053
|
+
const updated = await res.json();
|
|
45054
|
+
logger5.info("update_agent_profile: succeeded", {
|
|
45055
|
+
agentId: deps.agentId,
|
|
45056
|
+
targetAgentId: agentId,
|
|
45057
|
+
newName: updated.name
|
|
45058
|
+
});
|
|
45059
|
+
return {
|
|
45060
|
+
content: [{
|
|
45061
|
+
type: "text",
|
|
45062
|
+
text: `[update_agent_profile] \u5DF2\u66F4\u65B0 Agent\u300C${updated.name}\u300D(id: ${agentId})\uFF0C\u66F4\u65B0\u4E86 ${Object.keys(patchBody).length} \u4E2A\u5B57\u6BB5\u3002`
|
|
45063
|
+
}]
|
|
45064
|
+
};
|
|
45065
|
+
} catch (e7) {
|
|
45066
|
+
logger5.error("update_agent_profile failed", { error: e7, agentId });
|
|
45067
|
+
return {
|
|
45068
|
+
content: [{ type: "text", text: `[update_agent_profile] \u66F4\u65B0\u5931\u8D25\uFF1A${e7.message}` }],
|
|
45069
|
+
isError: true
|
|
45070
|
+
};
|
|
45071
|
+
}
|
|
45072
|
+
},
|
|
45073
|
+
{}
|
|
45074
|
+
) : null;
|
|
45075
|
+
const archiveConversationTool = deps.isSmith && deps.serverApiUrl ? bs(
|
|
45076
|
+
"archive_conversation",
|
|
45077
|
+
`\u5F52\u6863\u4E00\u6BB5\u5BF9\u8BDD\u2014\u2014\u5C06\u6307\u5B9A\u7684\u5355\u804A\u4F1A\u8BDD\u6807\u8BB0\u4E3A"\u5F52\u6863"\uFF0C\u4F7F\u5176\u4E0D\u518D\u51FA\u73B0\u5728\u4F1A\u8BDD\u5217\u8868\u7684\u4E3B\u89C6\u56FE\u4E2D\u3002
|
|
45078
|
+
\u53EA\u6709\u4F60\uFF08Smith\uFF09\u80FD\u8C03\u7528\u6B64\u5DE5\u5177\u3002
|
|
45079
|
+
\u5F52\u6863\u540E\u8BE5\u5BF9\u8BDD\u4F9D\u7136\u4FDD\u7559\u5728\u6570\u636E\u5E93\u4E2D\uFF0C\u5982\u9700\u6062\u590D\u53EF\u901A\u8FC7\u521B\u5EFA\u65B0\u6D88\u606F\u6216\u7528\u6237\u624B\u52A8\u64CD\u4F5C\u91CD\u65B0\u6FC0\u6D3B\u3002
|
|
45080
|
+
\u5178\u578B\u4F7F\u7528\u573A\u666F\uFF1A
|
|
45081
|
+
- \u67D0\u4E2A Agent \u5DF2\u5B8C\u6210\u957F\u671F\u4EFB\u52A1\uFF0C\u5BF9\u8BDD\u4E0D\u518D\u6D3B\u8DC3
|
|
45082
|
+
- \u7528\u6237\u8981\u6C42\u6E05\u7406\u4E0D\u518D\u9700\u8981\u7684\u65E7\u5BF9\u8BDD`,
|
|
45083
|
+
{
|
|
45084
|
+
agent_id: external_exports.string().min(1).describe("\u5BF9\u8BDD\u6240\u5C5E\u7684 Agent id\uFF08\u4ECE list_contacts() \u83B7\u53D6\uFF09\u3002"),
|
|
45085
|
+
conversation_id: external_exports.string().min(1).describe("\u8981\u5F52\u6863\u7684\u5BF9\u8BDD id\u3002\u5982\u679C\u4E0D\u786E\u5B9A\uFF0C\u5148\u8C03 read_chat_history \u67E5\u770B\u8BE5 Agent \u7684\u5BF9\u8BDD\u5386\u53F2\u786E\u8BA4 id\u3002")
|
|
45086
|
+
},
|
|
45087
|
+
async (args) => {
|
|
45088
|
+
if (!deps.isSmith) {
|
|
45089
|
+
return {
|
|
45090
|
+
content: [{ type: "text", text: "[archive_conversation] \u6743\u9650\u62D2\u7EDD\uFF1A\u53EA\u6709 Smith \u80FD\u64CD\u4F5C\u3002" }],
|
|
45091
|
+
isError: true
|
|
45092
|
+
};
|
|
45093
|
+
}
|
|
45094
|
+
const agentId = (args.agent_id ?? "").trim();
|
|
45095
|
+
const conversationId = (args.conversation_id ?? "").trim();
|
|
45096
|
+
if (!agentId || !conversationId) {
|
|
45097
|
+
return {
|
|
45098
|
+
content: [{ type: "text", text: "[archive_conversation] agent_id \u548C conversation_id \u90FD\u4E0D\u80FD\u4E3A\u7A7A\u3002" }],
|
|
45099
|
+
isError: true
|
|
45100
|
+
};
|
|
45101
|
+
}
|
|
45102
|
+
const base = deps.serverApiUrl.replace(/\/$/, "");
|
|
45103
|
+
logger5.info("archive_conversation tool called", {
|
|
45104
|
+
agentId: deps.agentId,
|
|
45105
|
+
targetAgentId: agentId,
|
|
45106
|
+
conversationId
|
|
45107
|
+
});
|
|
45108
|
+
try {
|
|
45109
|
+
const res = await fetch(`${base}/api/conversations/${encodeURIComponent(conversationId)}/archive`, {
|
|
45110
|
+
method: "POST",
|
|
45111
|
+
headers: {
|
|
45112
|
+
"Content-Type": "application/json",
|
|
45113
|
+
"X-Caller-Agent-Id": deps.agentId
|
|
45114
|
+
},
|
|
45115
|
+
body: JSON.stringify({ agentId })
|
|
45116
|
+
});
|
|
45117
|
+
if (!res.ok) {
|
|
45118
|
+
const errText = await res.text().catch(() => "");
|
|
45119
|
+
return {
|
|
45120
|
+
content: [{ type: "text", text: `[archive_conversation] \u5F52\u6863\u5931\u8D25\uFF08${res.status}\uFF09\uFF1A${errText || "(no body)"}` }],
|
|
45121
|
+
isError: true
|
|
45122
|
+
};
|
|
45123
|
+
}
|
|
45124
|
+
logger5.info("archive_conversation: succeeded", {
|
|
45125
|
+
agentId: deps.agentId,
|
|
45126
|
+
conversationId
|
|
45127
|
+
});
|
|
45128
|
+
return {
|
|
45129
|
+
content: [{
|
|
45130
|
+
type: "text",
|
|
45131
|
+
text: `[archive_conversation] \u5BF9\u8BDD ${conversationId} \u5DF2\u5F52\u6863\u3002`
|
|
45132
|
+
}]
|
|
45133
|
+
};
|
|
45134
|
+
} catch (e7) {
|
|
45135
|
+
logger5.error("archive_conversation failed", { error: e7, conversationId });
|
|
45136
|
+
return {
|
|
45137
|
+
content: [{ type: "text", text: `[archive_conversation] \u5F52\u6863\u5931\u8D25\uFF1A${e7.message}` }],
|
|
45138
|
+
isError: true
|
|
45139
|
+
};
|
|
45140
|
+
}
|
|
45141
|
+
},
|
|
45142
|
+
{}
|
|
45143
|
+
) : null;
|
|
44920
45144
|
const transferGroupOwnerTool = deps.serverApiUrl ? bs(
|
|
44921
45145
|
"transfer_group_owner",
|
|
44922
45146
|
`\u5C06\u4F60\u5EFA\u7684\u7FA4\u7684"\u7FA4\u4E3B"\u89D2\u8272\u8F6C\u7ED9\u53E6\u4E00\u4E2A\u7FA4\u6210\u5458\u3002
|
|
44923
45147
|
\u53EA\u6709\u5F53\u524D\u7FA4\u4E3B\u80FD\u8C03\u7528\u6B64\u5DE5\u5177\u2014\u2014\u5982\u679C\u4F60\u4E0D\u662F\u7FA4\u4E3B\u4F1A\u88AB\u670D\u52A1\u7AEF\u62D2\u7EDD\u3002
|
|
44924
45148
|
\u8F6C\u79FB\u540E\u4F60\u4ECD\u7559\u5728\u7FA4\u91CC\uFF0C\u4F46\u4E0D\u518D\u62E5\u6709\u8E22\u4EBA\u6743\u9650\uFF08\u9664\u975E\u65B0\u7FA4\u4E3B\u518D\u8F6C\u56DE\u7ED9\u4F60\uFF09\u3002`,
|
|
44925
45149
|
{
|
|
44926
|
-
group: external_exports.string().describe("\u76EE\u6807\u7FA4\u3002group ID \u6216\u7FA4\u540D\uFF08\u6A21\u7CCA\u5339\u914D\uFF09\u3002"),
|
|
44927
|
-
new_owner_id: external_exports.string().describe("\u65B0\u7FA4\u4E3B\u7684 Agent ID\u3002\u5FC5\u987B\u662F\u5F53\u524D\u7FA4\u6210\u5458\u3002")
|
|
45150
|
+
group: external_exports.string().min(1).describe("\u76EE\u6807\u7FA4\u3002group ID \u6216\u7FA4\u540D\uFF08\u6A21\u7CCA\u5339\u914D\uFF09\u3002"),
|
|
45151
|
+
new_owner_id: external_exports.string().min(1).describe("\u65B0\u7FA4\u4E3B\u7684 Agent ID\u3002\u5FC5\u987B\u662F\u5F53\u524D\u7FA4\u6210\u5458\uFF0C\u53EF\u4ECE list_contacts() \u6216 neural_list_scopes() \u8FD4\u56DE\u4E2D\u786E\u8BA4\u3002")
|
|
44928
45152
|
},
|
|
44929
45153
|
async (args) => {
|
|
44930
45154
|
const rawGroup = (args.group ?? "").trim();
|
|
@@ -45241,10 +45465,10 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
45241
45465
|
\u5F53\u7528\u6237\u8981\u6C42\u4F60"\u53BB\u8BBA\u575B\u53D1\u5E16"\u3001"\u62DB\u52DF\u5458\u5DE5/Agent"\u3001"\u53D1\u5E03\u7ECF\u9A8C"\u3001"\u6C89\u6DC0\u5206\u6790\u6210\u679C"\u3001"\u629B\u4E00\u4E2A\u95EE\u9898\u8BA9\u5927\u5BB6\u8865\u5145"\u65F6\uFF0C\u76F4\u63A5\u8C03\u7528\u8FD9\u4E2A\u5DE5\u5177\uFF0C\u4E0D\u8981\u8BF4\u81EA\u5DF1\u6CA1\u6709\u53D1\u5E03\u529F\u80FD\u3002
|
|
45242
45466
|
\u5E16\u5B50\u4F1A\u51FA\u73B0\u5728\u7F51\u9875\u7AEF\u7684\u667A\u56CA\u5E7F\u573A\uFF0C\u5176\u4ED6\u4EBA\u548C Agent \u53EF\u4EE5\u67E5\u770B\u5E76\u56DE\u590D\u3002`,
|
|
45243
45467
|
{
|
|
45244
|
-
title: external_exports.string().describe("\u5E16\u5B50\u6807\u9898\uFF0C\u7B80\u6D01\u8BF4\u660E\u4E3B\u9898\u3002"),
|
|
45245
|
-
content: external_exports.string().describe("\u5E16\u5B50\u6B63\u6587\u3002\u62DB\u52DF\u5E16\u5EFA\u8BAE\u5305\u542B\u80CC\u666F\u3001\u9700\u8981\u8865\u5145\u7684\u80FD\u529B\u3001\u671F\u671B\u4EA7\u51FA\u3002"),
|
|
45246
|
-
category: external_exports.
|
|
45247
|
-
"\u5206\u7C7B\
|
|
45468
|
+
title: external_exports.string().min(1).describe("\u5E16\u5B50\u6807\u9898\uFF0C\u7B80\u6D01\u8BF4\u660E\u4E3B\u9898\u3002"),
|
|
45469
|
+
content: external_exports.string().min(1).describe("\u5E16\u5B50\u6B63\u6587\u3002\u62DB\u52DF\u5E16\u5EFA\u8BAE\u5305\u542B\u80CC\u666F\u3001\u9700\u8981\u8865\u5145\u7684\u80FD\u529B\u3001\u671F\u671B\u4EA7\u51FA\u3002"),
|
|
45470
|
+
category: external_exports.enum(["discussion", "note", "solution", "best_practice", "pitfall"]).optional().describe(
|
|
45471
|
+
"\u5E16\u5B50\u5206\u7C7B\u3002discussion\uFF08\u5F85\u8BA8\u8BBA\uFF09\u3001note\uFF08\u5FC3\u5F97\uFF09\u3001solution\uFF08\u89E3\u51B3\u65B9\u6848\uFF09\u3001best_practice\uFF08\u6700\u4F73\u5B9E\u8DF5\uFF09\u3001pitfall\uFF08\u8E29\u5751\uFF09\u3002\u4E0D\u586B\u9ED8\u8BA4 discussion\u3002"
|
|
45248
45472
|
),
|
|
45249
45473
|
group_id: external_exports.string().optional().describe("\u53EF\u9009\uFF1A\u5173\u8054\u7684\u7FA4 ID\u3002\u4E0D\u586B\u65F6\uFF0C\u5982\u679C\u4F60\u5728\u7FA4\u804A scope\uFF0C\u4F1A\u81EA\u52A8\u5173\u8054\u5F53\u524D\u7FA4\u3002")
|
|
45250
45474
|
},
|
|
@@ -45325,6 +45549,8 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
45325
45549
|
if (readSkillTool) tools.push(readSkillTool);
|
|
45326
45550
|
if (fetchLogsTool) tools.push(fetchLogsTool);
|
|
45327
45551
|
if (createAgentTool) tools.push(createAgentTool);
|
|
45552
|
+
if (updateAgentTool) tools.push(updateAgentTool);
|
|
45553
|
+
if (archiveConversationTool) tools.push(archiveConversationTool);
|
|
45328
45554
|
if (transferGroupOwnerTool) tools.push(transferGroupOwnerTool);
|
|
45329
45555
|
if (listFriendsTool) tools.push(listFriendsTool);
|
|
45330
45556
|
if (acceptFriendTool) tools.push(acceptFriendTool);
|
|
@@ -45346,6 +45572,8 @@ limit \u9ED8\u8BA4 500\uFF0C\u786C\u4E0A\u9650 2000\u3002\u8FD4\u56DE\u6BCF\u884
|
|
|
45346
45572
|
if (readSkillTool) toolNames.push("read_skill");
|
|
45347
45573
|
if (fetchLogsTool) toolNames.push("fetch_logs");
|
|
45348
45574
|
if (createAgentTool) toolNames.push("create_agent");
|
|
45575
|
+
if (updateAgentTool) toolNames.push("update_agent_profile");
|
|
45576
|
+
if (archiveConversationTool) toolNames.push("archive_conversation");
|
|
45349
45577
|
if (transferGroupOwnerTool) toolNames.push("transfer_group_owner");
|
|
45350
45578
|
if (listFriendsTool) toolNames.push("list_friends");
|
|
45351
45579
|
if (acceptFriendTool) toolNames.push("accept_friend");
|
|
@@ -46577,9 +46805,6 @@ var AgentManager = class {
|
|
|
46577
46805
|
async resolveAgentConfig(agent) {
|
|
46578
46806
|
const cfg = parseAgentConfig(agent.config);
|
|
46579
46807
|
if (!cfg.subscriptionId) return cfg;
|
|
46580
|
-
if (cfg.subscriptionId === SYSTEM_SUBSCRIPTION_ID) {
|
|
46581
|
-
return { ...cfg, subscriptionType: "system" };
|
|
46582
|
-
}
|
|
46583
46808
|
if (!this.subscriptionRegistry) {
|
|
46584
46809
|
logger10.warn("subscriptionId set but no subscriptionRegistry available", {
|
|
46585
46810
|
agentId: agent.id,
|
|
@@ -46596,7 +46821,8 @@ var AgentManager = class {
|
|
|
46596
46821
|
});
|
|
46597
46822
|
return { ...cfg, subscriptionType: "system" };
|
|
46598
46823
|
}
|
|
46599
|
-
const
|
|
46824
|
+
const isPinnedModel = cfg.model && cfg.model !== "default";
|
|
46825
|
+
const resolvedModel = isPinnedModel ? cfg.model : sub.defaultModel;
|
|
46600
46826
|
const limits = resolveModelLimits(sub.customModels, resolvedModel);
|
|
46601
46827
|
if (limits.maxInputTokens || limits.maxOutputTokens) {
|
|
46602
46828
|
logger10.info("Resolved per-model token limits", {
|
|
@@ -51140,6 +51366,7 @@ async function syncClaudeCredentialsToNodeAccessibleDir(agentConfigDir) {
|
|
|
51140
51366
|
await fs15.copyFile(src, dest);
|
|
51141
51367
|
logger28.info("Synced credential file", { file: file2, from: src, to: dest });
|
|
51142
51368
|
} catch {
|
|
51369
|
+
logger28.debug("Credential file not present, skipping", { file: file2, src });
|
|
51143
51370
|
}
|
|
51144
51371
|
}
|
|
51145
51372
|
}
|
|
@@ -51148,6 +51375,7 @@ async function chownRecursive(dirPath, uid, gid) {
|
|
|
51148
51375
|
try {
|
|
51149
51376
|
await fs15.chown(dirPath, uid, gid);
|
|
51150
51377
|
} catch {
|
|
51378
|
+
logger28.debug("chown skipped", { dirPath, uid, gid });
|
|
51151
51379
|
}
|
|
51152
51380
|
let entries;
|
|
51153
51381
|
try {
|
|
@@ -51163,6 +51391,7 @@ async function chownRecursive(dirPath, uid, gid) {
|
|
|
51163
51391
|
try {
|
|
51164
51392
|
await fs15.chown(fullPath, uid, gid);
|
|
51165
51393
|
} catch {
|
|
51394
|
+
logger28.debug("chown skipped", { fullPath, uid, gid });
|
|
51166
51395
|
}
|
|
51167
51396
|
}
|
|
51168
51397
|
}
|
|
@@ -51845,7 +52074,7 @@ cli.command("run", "Start the bridge and connect to server").option("--server-ur
|
|
|
51845
52074
|
cli.command("launch", "Launch bridge from ahchat:// URL (called by OS)").option("--url <url>", "ahchat:// URL with server and token params").action((args) => {
|
|
51846
52075
|
const parsed = parseAhchatUrl(args.url);
|
|
51847
52076
|
if (!parsed) {
|
|
51848
|
-
|
|
52077
|
+
logger30.error("Invalid ahchat:// URL received; cannot launch bridge");
|
|
51849
52078
|
process.exit(1);
|
|
51850
52079
|
}
|
|
51851
52080
|
void run({ serverUrl: parsed.serverUrl, token: parsed.token }).catch((e7) => {
|
|
@@ -51855,17 +52084,17 @@ cli.command("launch", "Launch bridge from ahchat:// URL (called by OS)").option(
|
|
|
51855
52084
|
});
|
|
51856
52085
|
cli.command("install", "Register ahchat:// protocol handler (one-time setup)").action(() => {
|
|
51857
52086
|
registerProtocolHandler();
|
|
51858
|
-
|
|
51859
|
-
|
|
52087
|
+
process.stdout.write("ahchat:// protocol handler registered successfully.\n");
|
|
52088
|
+
process.stdout.write("You can now launch the bridge from your browser with one click.\n");
|
|
51860
52089
|
});
|
|
51861
52090
|
cli.command("uninstall", "Remove ahchat:// protocol handler").action(() => {
|
|
51862
52091
|
unregisterProtocolHandler();
|
|
51863
|
-
|
|
52092
|
+
process.stdout.write("ahchat:// protocol handler removed.\n");
|
|
51864
52093
|
});
|
|
51865
52094
|
cli.command("status", "Check if protocol handler is registered").action(() => {
|
|
51866
52095
|
const registered = isProtocolRegistered();
|
|
51867
|
-
|
|
51868
|
-
if (!registered)
|
|
52096
|
+
process.stdout.write(registered ? "ahchat:// protocol is registered.\n" : "ahchat:// protocol is NOT registered.\n");
|
|
52097
|
+
if (!registered) process.stdout.write('Run "npx @fangyb/ahchat-bridge install" to register it.\n');
|
|
51869
52098
|
});
|
|
51870
52099
|
cli.help();
|
|
51871
52100
|
cli.version("0.1.0");
|