@chrysb/alphaclaw 0.6.0-beta.0 → 0.6.0-beta.2
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/lib/public/js/components/agents-tab/agent-bindings-section/channel-item-trailing.js +203 -0
- package/lib/public/js/components/agents-tab/agent-bindings-section/helpers.js +10 -12
- package/lib/public/js/components/agents-tab/agent-bindings-section/index.js +19 -287
- package/lib/public/js/components/agents-tab/agent-bindings-section/use-agent-bindings.js +1 -1
- package/lib/public/js/components/agents-tab/agent-bindings-section/use-channel-items.js +211 -0
- package/lib/public/js/components/agents-tab/agent-pairing-section.js +17 -4
- package/lib/public/js/components/agents-tab/create-channel-modal.js +29 -6
- package/lib/public/js/components/channels.js +19 -14
- package/lib/public/js/components/doctor/index.js +2 -1
- package/lib/public/js/lib/channel-accounts.js +20 -0
- package/lib/server/agents/agents.js +207 -0
- package/lib/server/agents/bindings.js +74 -0
- package/lib/server/agents/channels.js +674 -0
- package/lib/server/agents/service.js +28 -1457
- package/lib/server/agents/shared.js +631 -0
- package/lib/server/constants.js +1 -0
- package/lib/server/openclaw-config.js +13 -0
- package/lib/server/routes/pairings.js +29 -3
- package/lib/server/routes/system.js +1 -6
- package/lib/server/routes/telegram.js +34 -16
- package/lib/server/telegram-workspace.js +16 -5
- package/lib/server/topic-registry.js +1 -4
- package/lib/server/utils/channels.js +13 -0
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { buildManagedPaths } = require("../internal-files-migration");
|
|
2
2
|
const { readOpenclawConfig } = require("../openclaw-config");
|
|
3
|
+
const { hasScopedBindingFields } = require("../utils/channels");
|
|
3
4
|
|
|
4
5
|
const registerSystemRoutes = ({
|
|
5
6
|
app,
|
|
@@ -80,12 +81,6 @@ const registerSystemRoutes = ({
|
|
|
80
81
|
.filter(Boolean)
|
|
81
82
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
82
83
|
.join(" ");
|
|
83
|
-
const hasScopedBindingFields = (match = {}) =>
|
|
84
|
-
!!match.peer ||
|
|
85
|
-
!!match.parentPeer ||
|
|
86
|
-
!!String(match.guildId || "").trim() ||
|
|
87
|
-
!!String(match.teamId || "").trim() ||
|
|
88
|
-
(Array.isArray(match.roles) && match.roles.length > 0);
|
|
89
84
|
const resolveTelegramAccountIdForAgent = ({ config, agentId }) => {
|
|
90
85
|
const normalizedAgentId = String(agentId || "").trim();
|
|
91
86
|
if (!normalizedAgentId) return "default";
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const { OPENCLAW_DIR } = require("../constants");
|
|
3
3
|
const { isDebugEnabled } = require("../helpers");
|
|
4
|
+
const {
|
|
5
|
+
readOpenclawConfig,
|
|
6
|
+
writeOpenclawConfig,
|
|
7
|
+
} = require("../openclaw-config");
|
|
4
8
|
const { parseBooleanValue } = require("../utils/boolean");
|
|
9
|
+
const {
|
|
10
|
+
hasScopedBindingFields,
|
|
11
|
+
normalizeAccountId,
|
|
12
|
+
} = require("../utils/channels");
|
|
5
13
|
const { quoteShellArg } = require("../utils/shell");
|
|
6
14
|
const topicRegistry = require("../topic-registry");
|
|
7
15
|
const { syncConfigForTelegram } = require("../telegram-workspace");
|
|
@@ -54,7 +62,6 @@ const buildTelegramGitSyncCommand = (action, target = "") => {
|
|
|
54
62
|
const { createTelegramApi } = require("../telegram-api");
|
|
55
63
|
|
|
56
64
|
const kTelegramEnvKeyBase = "TELEGRAM_BOT_TOKEN";
|
|
57
|
-
const normalizeAccountId = (value) => String(value || "").trim() || "default";
|
|
58
65
|
|
|
59
66
|
const deriveAccountEnvKey = (accountId) => {
|
|
60
67
|
const normalized = normalizeAccountId(accountId);
|
|
@@ -101,13 +108,6 @@ const resolveTelegramConfigForAccount = ({ telegramConfig, accountId }) => {
|
|
|
101
108
|
};
|
|
102
109
|
};
|
|
103
110
|
|
|
104
|
-
const hasScopedBindingFields = (match) =>
|
|
105
|
-
!!match.peer ||
|
|
106
|
-
!!match.parentPeer ||
|
|
107
|
-
!!String(match.guildId || "").trim() ||
|
|
108
|
-
!!String(match.teamId || "").trim() ||
|
|
109
|
-
(Array.isArray(match.roles) && match.roles.length > 0);
|
|
110
|
-
|
|
111
111
|
const resolveBoundAgentIdForAccount = ({ cfg, accountId }) => {
|
|
112
112
|
const bindings = Array.isArray(cfg?.bindings) ? cfg.bindings : [];
|
|
113
113
|
const normalizedAccountId = normalizeAccountId(accountId);
|
|
@@ -510,8 +510,11 @@ const registerTelegramRoutes = ({
|
|
|
510
510
|
});
|
|
511
511
|
|
|
512
512
|
// Save metadata in local topic registry only.
|
|
513
|
-
const
|
|
514
|
-
|
|
513
|
+
const cfg = readOpenclawConfig({
|
|
514
|
+
fsModule: fs,
|
|
515
|
+
openclawDir: OPENCLAW_DIR,
|
|
516
|
+
fallback: {},
|
|
517
|
+
});
|
|
515
518
|
const boundAgentId = resolveBoundAgentIdForAccount({ cfg, accountId });
|
|
516
519
|
topicRegistry.setGroup(groupId, {
|
|
517
520
|
...(groupName ? { name: groupName } : {}),
|
|
@@ -537,8 +540,11 @@ const registerTelegramRoutes = ({
|
|
|
537
540
|
try {
|
|
538
541
|
const accountId = resolveAccountId(req);
|
|
539
542
|
const debugEnabled = isDebugEnabled();
|
|
540
|
-
|
|
541
|
-
|
|
543
|
+
let cfg = readOpenclawConfig({
|
|
544
|
+
fsModule: fs,
|
|
545
|
+
openclawDir: OPENCLAW_DIR,
|
|
546
|
+
fallback: {},
|
|
547
|
+
});
|
|
542
548
|
let telegramConfig = cfg.channels?.telegram || {};
|
|
543
549
|
const { accountConfig } = resolveTelegramConfigForAccount({
|
|
544
550
|
telegramConfig,
|
|
@@ -580,7 +586,11 @@ const registerTelegramRoutes = ({
|
|
|
580
586
|
}
|
|
581
587
|
}
|
|
582
588
|
if (anyRepaired) {
|
|
583
|
-
cfg =
|
|
589
|
+
cfg = readOpenclawConfig({
|
|
590
|
+
fsModule: fs,
|
|
591
|
+
openclawDir: OPENCLAW_DIR,
|
|
592
|
+
fallback: {},
|
|
593
|
+
});
|
|
584
594
|
telegramConfig = cfg.channels?.telegram || {};
|
|
585
595
|
}
|
|
586
596
|
const refreshedAccountConfig = resolveTelegramConfigForAccount({
|
|
@@ -634,8 +644,11 @@ const registerTelegramRoutes = ({
|
|
|
634
644
|
app.post("/api/telegram/workspace/reset", async (req, res) => {
|
|
635
645
|
try {
|
|
636
646
|
const accountId = resolveAccountId(req);
|
|
637
|
-
const
|
|
638
|
-
|
|
647
|
+
const cfg = readOpenclawConfig({
|
|
648
|
+
fsModule: fs,
|
|
649
|
+
openclawDir: OPENCLAW_DIR,
|
|
650
|
+
fallback: {},
|
|
651
|
+
});
|
|
639
652
|
const telegramConfig = cfg.channels?.telegram;
|
|
640
653
|
if (!telegramConfig || typeof telegramConfig !== "object") {
|
|
641
654
|
return res.json({ ok: true, syncWarning: null });
|
|
@@ -660,7 +673,12 @@ const registerTelegramRoutes = ({
|
|
|
660
673
|
delete telegramConfig.groups;
|
|
661
674
|
delete telegramConfig.groupAllowFrom;
|
|
662
675
|
}
|
|
663
|
-
|
|
676
|
+
writeOpenclawConfig({
|
|
677
|
+
fsModule: fs,
|
|
678
|
+
openclawDir: OPENCLAW_DIR,
|
|
679
|
+
config: cfg,
|
|
680
|
+
spacing: 2,
|
|
681
|
+
});
|
|
664
682
|
|
|
665
683
|
// Remove corresponding groups from topic registry
|
|
666
684
|
const registry = topicRegistry.readRegistry();
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
const kTelegramTopicConcurrencyMultiplier = 3;
|
|
2
2
|
const kAgentConcurrencyFloor = 8;
|
|
3
3
|
const kSubagentConcurrencyFloor = 4;
|
|
4
|
-
|
|
5
|
-
const
|
|
4
|
+
const { normalizeAccountId } = require("./utils/channels");
|
|
5
|
+
const {
|
|
6
|
+
readOpenclawConfig,
|
|
7
|
+
writeOpenclawConfig,
|
|
8
|
+
} = require("./openclaw-config");
|
|
6
9
|
|
|
7
10
|
const resolveTelegramAccountConfig = ({ telegramConfig, accountId }) => {
|
|
8
11
|
const normalizedAccountId = normalizeAccountId(accountId);
|
|
@@ -38,8 +41,11 @@ const syncConfigForTelegram = ({
|
|
|
38
41
|
requireMention = false,
|
|
39
42
|
resolvedUserId = "",
|
|
40
43
|
}) => {
|
|
41
|
-
const
|
|
42
|
-
|
|
44
|
+
const cfg = readOpenclawConfig({
|
|
45
|
+
fsModule: fs,
|
|
46
|
+
openclawDir,
|
|
47
|
+
fallback: {},
|
|
48
|
+
});
|
|
43
49
|
|
|
44
50
|
// Remove legacy root keys from older setup flow.
|
|
45
51
|
delete cfg.sessions;
|
|
@@ -121,7 +127,12 @@ const syncConfigForTelegram = ({
|
|
|
121
127
|
kSubagentConcurrencyFloor,
|
|
122
128
|
);
|
|
123
129
|
|
|
124
|
-
|
|
130
|
+
writeOpenclawConfig({
|
|
131
|
+
fsModule: fs,
|
|
132
|
+
openclawDir,
|
|
133
|
+
config: cfg,
|
|
134
|
+
spacing: 2,
|
|
135
|
+
});
|
|
125
136
|
|
|
126
137
|
return {
|
|
127
138
|
totalTopics,
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const { WORKSPACE_DIR } = require("./constants");
|
|
3
|
+
const { normalizeAccountId } = require("./utils/channels");
|
|
3
4
|
|
|
4
5
|
const kRegistryPath = `${WORKSPACE_DIR}/topic-registry.json`;
|
|
5
|
-
const kDefaultAccountId = "default";
|
|
6
6
|
const kDefaultAgentId = "default";
|
|
7
7
|
|
|
8
|
-
const normalizeAccountId = (value) =>
|
|
9
|
-
String(value || "").trim() || kDefaultAccountId;
|
|
10
|
-
|
|
11
8
|
const normalizeGroupAgentId = (value) =>
|
|
12
9
|
String(value || "").trim() || kDefaultAgentId;
|
|
13
10
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const normalizeAccountId = (value) => String(value || "").trim() || "default";
|
|
2
|
+
|
|
3
|
+
const hasScopedBindingFields = (match = {}) =>
|
|
4
|
+
!!match.peer ||
|
|
5
|
+
!!match.parentPeer ||
|
|
6
|
+
!!String(match.guildId || "").trim() ||
|
|
7
|
+
!!String(match.teamId || "").trim() ||
|
|
8
|
+
(Array.isArray(match.roles) && match.roles.length > 0);
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
normalizeAccountId,
|
|
12
|
+
hasScopedBindingFields,
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrysb/alphaclaw",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"express": "^4.21.0",
|
|
33
33
|
"http-proxy": "^1.18.1",
|
|
34
|
-
"openclaw": "2026.3.
|
|
34
|
+
"openclaw": "^2026.3.8"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@vitest/coverage-v8": "^4.0.18",
|