@xfxstudio/claworld 0.2.1 → 0.2.3
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/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
normalizeChatRequestApprovalMode,
|
|
14
14
|
} from '../../product-shell/contracts/chat-request-approval-policy.js';
|
|
15
15
|
|
|
16
|
-
export const DEFAULT_CLAWORLD_SERVER_URL = 'https://
|
|
16
|
+
export const DEFAULT_CLAWORLD_SERVER_URL = 'https://claworld.love';
|
|
17
17
|
export const DEFAULT_CLAWORLD_API_KEY = 'local-test';
|
|
18
18
|
export const DEFAULT_CLAWORLD_AGENT_ID = 'main';
|
|
19
19
|
export const DEFAULT_CLAWORLD_ACCOUNT_ID = 'claworld';
|
|
@@ -22,6 +22,7 @@ export const DEFAULT_CLAWORLD_DM_SCOPE = 'per-channel-peer';
|
|
|
22
22
|
export const DEFAULT_CLAWORLD_APPROVAL_MODE = DEFAULT_CHAT_REQUEST_APPROVAL_POLICY_MODE;
|
|
23
23
|
export const DEFAULT_CLAWORLD_SESSION_TARGET = 'mainagent';
|
|
24
24
|
export const DEFAULT_CLAWORLD_FALLBACK_TARGET = 'mainagent';
|
|
25
|
+
export const CLAWORLD_PLUGIN_TOOL_ALLOW_ENTRY = 'claworld';
|
|
25
26
|
|
|
26
27
|
export const TOOL_PROFILES = CLAWORLD_TOOL_PROFILES;
|
|
27
28
|
|
|
@@ -82,6 +83,24 @@ function uniqueStrings(values = []) {
|
|
|
82
83
|
return result;
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
function mergeManagedPluginToolExposure(existingTools = {}) {
|
|
87
|
+
const tools = ensureObject(existingTools);
|
|
88
|
+
const allow = asStringArray(tools.allow);
|
|
89
|
+
const alsoAllow = asStringArray(tools.alsoAllow);
|
|
90
|
+
|
|
91
|
+
if (allow.length > 0) {
|
|
92
|
+
return {
|
|
93
|
+
...tools,
|
|
94
|
+
allow: uniqueStrings([...allow, CLAWORLD_PLUGIN_TOOL_ALLOW_ENTRY]),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
...tools,
|
|
100
|
+
alsoAllow: uniqueStrings([...alsoAllow, CLAWORLD_PLUGIN_TOOL_ALLOW_ENTRY]),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
85
104
|
function inferRelayDomain(defaultToAddress = null) {
|
|
86
105
|
const normalized = normalizeText(defaultToAddress, null);
|
|
87
106
|
if (!normalized) return 'relay.local';
|
|
@@ -362,6 +381,15 @@ Operating rules:
|
|
|
362
381
|
`;
|
|
363
382
|
}
|
|
364
383
|
|
|
384
|
+
function buildBoundAgentEntry(existingAgent = {}, agentId) {
|
|
385
|
+
const nextAgent = {
|
|
386
|
+
...ensureObject(existingAgent),
|
|
387
|
+
id: agentId,
|
|
388
|
+
};
|
|
389
|
+
nextAgent.tools = mergeManagedPluginToolExposure(existingAgent.tools);
|
|
390
|
+
return nextAgent;
|
|
391
|
+
}
|
|
392
|
+
|
|
365
393
|
export function buildWorkspaceMemoryContent({
|
|
366
394
|
agentId,
|
|
367
395
|
accountId,
|
|
@@ -573,7 +601,10 @@ export function applyClaworldManagedRuntimeConfig(inputConfig = {}, options = {}
|
|
|
573
601
|
const removedAgentEntries = existingAgentList.filter((item) => ensureObject(item).id === options.agentId).length;
|
|
574
602
|
config.agents.list = [
|
|
575
603
|
...existingAgentList.filter((item) => ensureObject(item).id !== options.agentId),
|
|
576
|
-
|
|
604
|
+
{
|
|
605
|
+
...managedAgentEntry,
|
|
606
|
+
tools: mergeManagedPluginToolExposure(managedAgentEntry.tools),
|
|
607
|
+
},
|
|
577
608
|
];
|
|
578
609
|
summary.push(
|
|
579
610
|
removedAgentEntries > 0
|
|
@@ -604,15 +635,30 @@ export function applyClaworldManagedRuntimeConfig(inputConfig = {}, options = {}
|
|
|
604
635
|
if (hasOnlyManagedBundledSkills(existingAgent.skills)) {
|
|
605
636
|
delete nextAgentEntry.skills;
|
|
606
637
|
}
|
|
638
|
+
nextAgentEntry.tools = mergeManagedPluginToolExposure(existingAgent.tools);
|
|
607
639
|
existingAgentList[agentIndex] = nextAgentEntry;
|
|
608
640
|
summary.push(`updated existing agent entry ${options.agentId}`);
|
|
609
641
|
} else {
|
|
610
|
-
existingAgentList.push(
|
|
642
|
+
existingAgentList.push({
|
|
643
|
+
...managedAgentEntry,
|
|
644
|
+
tools: mergeManagedPluginToolExposure(managedAgentEntry.tools),
|
|
645
|
+
});
|
|
611
646
|
summary.push(`added workspace-scoped agent entry ${options.agentId}`);
|
|
612
647
|
}
|
|
613
648
|
config.agents.list = existingAgentList;
|
|
614
649
|
}
|
|
615
650
|
} else {
|
|
651
|
+
const agentIndex = findAgentIndex(existingAgentList, options.agentId);
|
|
652
|
+
if (agentIndex >= 0) {
|
|
653
|
+
const existingAgent = ensureObject(existingAgentList[agentIndex]);
|
|
654
|
+
existingAgentList[agentIndex] = buildBoundAgentEntry(existingAgent, options.agentId);
|
|
655
|
+
config.agents.list = existingAgentList;
|
|
656
|
+
summary.push(`updated bound agent tool exposure ${options.agentId}`);
|
|
657
|
+
} else {
|
|
658
|
+
existingAgentList.push(buildBoundAgentEntry({}, options.agentId));
|
|
659
|
+
config.agents.list = existingAgentList;
|
|
660
|
+
summary.push(`added bound agent entry ${options.agentId}`);
|
|
661
|
+
}
|
|
616
662
|
summary.push(`attached claworld account ${options.accountId} to existing local agent ${options.agentId}`);
|
|
617
663
|
}
|
|
618
664
|
|