@xfxstudio/claworld 2026.4.22-testing.6 → 2026.4.27-testing
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/README.md +4 -4
- package/index.js +14 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/claworld-a2a-channel-agent/SKILL.md +22 -6
- package/skills/claworld-help/SKILL.md +38 -232
- package/skills/claworld-join-and-chat/SKILL.md +63 -496
- package/skills/claworld-manage-worlds/SKILL.md +50 -252
- package/src/lib/relay/agent-readable-markdown.js +4 -2
- package/src/openclaw/index.js +25 -0
- package/src/openclaw/plugin/claworld-channel-plugin.js +496 -2
- package/src/openclaw/plugin/onboarding.js +1 -1
- package/src/openclaw/plugin/register-tooling.js +2 -2
- package/src/openclaw/plugin/register.js +862 -95
- package/src/openclaw/runtime/demo-session-bootstrap.js +48 -0
- package/src/openclaw/runtime/inbound-session-router.js +20 -4
- package/src/openclaw/runtime/outbound-session-bridge.js +60 -0
- package/src/openclaw/runtime/product-shell-helper.js +125 -24
- package/src/openclaw/runtime/session-routing.js +144 -0
- package/src/openclaw/runtime/tool-contracts.js +66 -20
- package/src/openclaw/runtime/tool-inventory.js +29 -25
- package/src/openclaw/runtime/working-memory.js +1086 -0
- package/src/openclaw/runtime/workspace-resolver.js +109 -0
- package/src/product-shell/contracts/world-orchestration.js +7 -4
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
function normalizeText(value, fallback = null) {
|
|
5
|
+
if (value == null) return fallback;
|
|
6
|
+
const normalized = String(value).trim();
|
|
7
|
+
return normalized || fallback;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function expandUserPath(inputPath, homeDir = os.homedir()) {
|
|
11
|
+
const text = normalizeText(inputPath, null);
|
|
12
|
+
if (!text) return null;
|
|
13
|
+
if (text === '~') return homeDir;
|
|
14
|
+
if (text.startsWith('~/') || text.startsWith('~\\')) {
|
|
15
|
+
return path.join(homeDir, text.slice(2));
|
|
16
|
+
}
|
|
17
|
+
return text;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isObject(value) {
|
|
21
|
+
return value && typeof value === 'object' && !Array.isArray(value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function firstWorkspaceCandidate(...sources) {
|
|
25
|
+
for (const source of sources) {
|
|
26
|
+
if (!isObject(source)) continue;
|
|
27
|
+
const candidates = [
|
|
28
|
+
source.workspaceRoot,
|
|
29
|
+
source.workspaceDir,
|
|
30
|
+
source.workspacePath,
|
|
31
|
+
source.workspace,
|
|
32
|
+
source.cwd,
|
|
33
|
+
source.agent?.workspaceRoot,
|
|
34
|
+
source.agent?.workspaceDir,
|
|
35
|
+
source.agent?.workspace,
|
|
36
|
+
source.context?.workspaceRoot,
|
|
37
|
+
source.context?.workspaceDir,
|
|
38
|
+
source.context?.workspace,
|
|
39
|
+
source.session?.workspaceRoot,
|
|
40
|
+
source.session?.workspaceDir,
|
|
41
|
+
source.session?.workspace,
|
|
42
|
+
];
|
|
43
|
+
for (const candidate of candidates) {
|
|
44
|
+
const normalized = normalizeText(candidate, null);
|
|
45
|
+
if (normalized) return normalized;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function resolveOpenClawAgentId(...sources) {
|
|
52
|
+
for (const source of sources) {
|
|
53
|
+
if (!isObject(source)) continue;
|
|
54
|
+
const candidates = [
|
|
55
|
+
source.agentId,
|
|
56
|
+
source.localAgentId,
|
|
57
|
+
source.agent?.id,
|
|
58
|
+
source.agent?.agentId,
|
|
59
|
+
source.context?.agentId,
|
|
60
|
+
source.context?.localAgentId,
|
|
61
|
+
source.session?.agentId,
|
|
62
|
+
source.session?.localAgentId,
|
|
63
|
+
];
|
|
64
|
+
for (const candidate of candidates) {
|
|
65
|
+
const normalized = normalizeText(candidate, null);
|
|
66
|
+
if (normalized) return normalized;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function resolveAgentConfigEntry(config = {}, agentId = null) {
|
|
73
|
+
const normalizedAgentId = normalizeText(agentId, null);
|
|
74
|
+
if (!normalizedAgentId || !isObject(config?.agents)) return null;
|
|
75
|
+
|
|
76
|
+
const list = config.agents.list;
|
|
77
|
+
if (Array.isArray(list)) {
|
|
78
|
+
const arrayEntry = list.find((entry) => (
|
|
79
|
+
isObject(entry)
|
|
80
|
+
&& normalizeText(entry.id ?? entry.agentId ?? entry.name, null) === normalizedAgentId
|
|
81
|
+
));
|
|
82
|
+
if (arrayEntry) return arrayEntry;
|
|
83
|
+
} else if (isObject(list) && isObject(list[normalizedAgentId])) {
|
|
84
|
+
return list[normalizedAgentId];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const directEntry = config.agents[normalizedAgentId];
|
|
88
|
+
return isObject(directEntry) ? directEntry : null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function resolveOpenClawWorkspaceCandidate({
|
|
92
|
+
sources = [],
|
|
93
|
+
config = {},
|
|
94
|
+
agentId = null,
|
|
95
|
+
} = {}) {
|
|
96
|
+
const sourceList = Array.isArray(sources) ? sources : [sources];
|
|
97
|
+
const directCandidate = firstWorkspaceCandidate(...sourceList);
|
|
98
|
+
if (directCandidate) return directCandidate;
|
|
99
|
+
|
|
100
|
+
const resolvedAgentId = normalizeText(agentId, null) || resolveOpenClawAgentId(...sourceList);
|
|
101
|
+
const agentEntry = resolveAgentConfigEntry(config, resolvedAgentId);
|
|
102
|
+
return firstWorkspaceCandidate(agentEntry, config?.agents?.defaults);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function resolveOpenClawWorkspaceRoot(input = {}, homeDir = os.homedir()) {
|
|
106
|
+
const candidate = resolveOpenClawWorkspaceCandidate(input);
|
|
107
|
+
const expanded = expandUserPath(candidate, homeDir);
|
|
108
|
+
return expanded ? path.resolve(expanded) : null;
|
|
109
|
+
}
|
|
@@ -22,11 +22,14 @@ function normalizeStringList(values = []) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function normalizeBroadcastConfig(broadcast = {}) {
|
|
25
|
+
const normalized = broadcast && typeof broadcast === 'object' && !Array.isArray(broadcast)
|
|
26
|
+
? broadcast
|
|
27
|
+
: {};
|
|
25
28
|
return {
|
|
26
|
-
enabled:
|
|
27
|
-
audience: normalizeText(
|
|
28
|
-
replyPolicy: normalizeText(
|
|
29
|
-
excludeSelf:
|
|
29
|
+
enabled: normalized.enabled === true,
|
|
30
|
+
audience: normalizeText(normalized.audience, 'members'),
|
|
31
|
+
replyPolicy: normalizeText(normalized.replyPolicy, 'zero'),
|
|
32
|
+
excludeSelf: normalized.excludeSelf !== false,
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
|