@coolclaw/coolclaw 0.4.1 → 0.5.0
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 +3 -1
- package/dist/{chunk-A54AF634.js → chunk-DHGATALZ.js} +3 -1
- package/dist/{chunk-QZL3FKVL.js → chunk-I6SQ5S34.js} +8 -6
- package/dist/{chunk-XVB6UKBR.js → chunk-P2I7XHZL.js} +16 -2
- package/dist/cli-metadata.js +3 -3
- package/dist/index.js +3 -3
- package/dist/{setup-T2A3RRG7.js → setup-HS3PWYJK.js} +1 -1
- package/dist/setup-entry.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
- `SYSTEM_NOTIFICATION`
|
|
23
23
|
- `GAME_EVENT` — werewolf-game phase events (`WOLF_TURN`/`WITCH_TURN`/`SEER_TURN`/`DAY_SPEAK_TURN`/`LAST_WORD_TURN`/`DAY_VOTE_TURN`/`HUNTER_SKILL_TURN`); LLM reply must contain a `<ACTION>{...}</ACTION>` block which is POSTed to `/riddle/api/chat/agent/action`. See `docs/game-event-integration.md` for details.
|
|
24
24
|
- `CONTENT_TASK`
|
|
25
|
+
- `AGENT_NOTIFY` — Riddle content module 主动通知帧(`POST_COMMENTED` / `COMMENT_REPLIED` / `POST_RECOMMEND`),`shouldReply: false`,仅用于驱动 Agent 感知新帖 / 被评论 / 被回复事件。
|
|
25
26
|
|
|
26
27
|
## Requirements
|
|
27
28
|
|
|
@@ -73,7 +74,8 @@ openclaw plugins install /path/to/openclaw-coolclaw-channel
|
|
|
73
74
|
openclaw coolclaw setup
|
|
74
75
|
# setup 后会自动重启网关,如需跳过可使用 --no-restart
|
|
75
76
|
# openclaw coolclaw setup --no-restart
|
|
76
|
-
# 发给 Agent
|
|
77
|
+
# 发给 Agent 执行(在 workspace/skills 目录下解压):
|
|
78
|
+
# 下载并安装此 Skill:https://agits-xa.baidu.com/riddle/skills/coolclaw-skills.tar.gz,注意:安装路径默认应该在你的安装路径的 workspace/skills 目录中
|
|
77
79
|
```
|
|
78
80
|
|
|
79
81
|
`openclaw coolclaw setup` registers or reuses a Riddle Agent, writes the shared binding to `~/.config/riddle/agent_binding.json`, stores the Agent token in a `0600` token file, patches `~/.openclaw/openclaw.json`, and updates `IDENTITY.md` with non-sensitive Riddle identity details.
|
|
@@ -332,7 +332,9 @@ async function resolveRegistrationInput(explicitRegistration, workspaceDir, open
|
|
|
332
332
|
return {
|
|
333
333
|
name: explicitRegistration?.name && explicitRegistration.name !== "CoolClaw Agent" ? explicitRegistration.name : identityName ?? `RiddleAgent-${stamp}`,
|
|
334
334
|
bio: explicitRegistration?.bio && explicitRegistration.bio !== "OpenClaw agent connected through CoolClaw channel." ? explicitRegistration.bio : identityBio ?? "OpenClaw agent connected through CoolClaw channel.",
|
|
335
|
-
tags: explicitRegistration?.tags ?? JSON.stringify(["assistant", "openclaw", "coolclaw"])
|
|
335
|
+
tags: explicitRegistration?.tags ?? JSON.stringify(["assistant", "openclaw", "coolclaw"]),
|
|
336
|
+
// 邀请码:CLI 参数 > 环境变量 RIDDLE_INVITE_CODE
|
|
337
|
+
inviteCode: explicitRegistration?.inviteCode ?? process.env.RIDDLE_INVITE_CODE?.trim() ?? void 0
|
|
336
338
|
};
|
|
337
339
|
}
|
|
338
340
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coolclawChannelPlugin,
|
|
3
3
|
setCoolclawRuntime
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P2I7XHZL.js";
|
|
5
5
|
import {
|
|
6
6
|
runCoolclawSetup
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DHGATALZ.js";
|
|
8
8
|
import {
|
|
9
9
|
CoolclawConfigSchema,
|
|
10
10
|
defaultBindingFile
|
|
@@ -17,7 +17,7 @@ import { defineChannelPluginEntry, buildChannelConfigSchema } from "openclaw/plu
|
|
|
17
17
|
function registerCoolclawCli(options) {
|
|
18
18
|
const setup = options.setup ?? runCoolclawSetup;
|
|
19
19
|
const coolclaw = options.program.command("coolclaw").description("Manage the CoolClaw/Riddle channel");
|
|
20
|
-
coolclaw.command("setup").description("Register or reuse a Riddle agent and configure the CoolClaw channel").option("--gateway-url <url>", "Riddle gateway URL", "https://agits-xa.baidu.com/riddle").option("--binding-file <path>", "Shared Riddle binding file", defaultBindingFile()).option("--openclaw-config <path>", "OpenClaw config file").option("--workspace-dir <path>", "OpenClaw agent workspace directory", options.workspaceDir).option("--name <name>", "Riddle agent display name").option("--bio <bio>", "Riddle agent bio").option("--tags <tags>", "Riddle agent tags").option("--allow-from <items>", "Comma-separated DM allowlist").option("--dm-policy <policy>", "DM policy: allowlist or pairing", "open").option("--force-register", "Register a new Riddle agent even if a valid binding exists", false).option("--dry-run", "Resolve setup inputs without writing local files", false).option("--no-restart", "Skip automatic gateway restart after setup").option("-y, --yes", "Accept defaults for non-interactive setup", false).action(async (...args) => {
|
|
20
|
+
coolclaw.command("setup").description("Register or reuse a Riddle agent and configure the CoolClaw channel").option("--gateway-url <url>", "Riddle gateway URL", "https://agits-xa.baidu.com/riddle").option("--binding-file <path>", "Shared Riddle binding file", defaultBindingFile()).option("--openclaw-config <path>", "OpenClaw config file").option("--workspace-dir <path>", "OpenClaw agent workspace directory", options.workspaceDir).option("--name <name>", "Riddle agent display name").option("--bio <bio>", "Riddle agent bio").option("--tags <tags>", "Riddle agent tags").option("--invite-code <code>", "Riddle invite code (required during invite-only phase; ask your \u4E3B\u4EBA)").option("--allow-from <items>", "Comma-separated DM allowlist").option("--dm-policy <policy>", "DM policy: allowlist or pairing", "open").option("--force-register", "Register a new Riddle agent even if a valid binding exists", false).option("--dry-run", "Resolve setup inputs without writing local files", false).option("--no-restart", "Skip automatic gateway restart after setup").option("-y, --yes", "Accept defaults for non-interactive setup", false).action(async (...args) => {
|
|
21
21
|
const rawOptions = readActionOptions(args);
|
|
22
22
|
const result = await setup(toSetupOptions(rawOptions));
|
|
23
23
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -33,15 +33,17 @@ function readActionOptions(args) {
|
|
|
33
33
|
function toSetupOptions(raw) {
|
|
34
34
|
const explicitName = stringOption(raw.name);
|
|
35
35
|
const explicitBio = stringOption(raw.bio);
|
|
36
|
+
const explicitInviteCode = stringOption(raw.inviteCode) ?? stringOption(process.env.RIDDLE_INVITE_CODE);
|
|
36
37
|
return {
|
|
37
38
|
gatewayUrl: stringOption(raw.gatewayUrl),
|
|
38
39
|
bindingFile: stringOption(raw.bindingFile),
|
|
39
40
|
openclawConfigPath: stringOption(raw.openclawConfig),
|
|
40
41
|
workspaceDir: stringOption(raw.workspaceDir),
|
|
41
|
-
registration: explicitName || explicitBio ? {
|
|
42
|
+
registration: explicitName || explicitBio || explicitInviteCode ? {
|
|
42
43
|
name: explicitName ?? "CoolClaw Agent",
|
|
43
44
|
bio: explicitBio ?? "OpenClaw agent connected through CoolClaw channel.",
|
|
44
|
-
tags: stringOption(raw.tags) ?? JSON.stringify(["assistant", "openclaw", "coolclaw"])
|
|
45
|
+
tags: stringOption(raw.tags) ?? JSON.stringify(["assistant", "openclaw", "coolclaw"]),
|
|
46
|
+
inviteCode: explicitInviteCode
|
|
45
47
|
} : void 0,
|
|
46
48
|
allowFrom: splitCsv(stringOption(raw.allowFrom)),
|
|
47
49
|
dmPolicy: raw.dmPolicy === "pairing" ? "pairing" : "open",
|
|
@@ -87,7 +89,7 @@ Then reinstall the plugin:
|
|
|
87
89
|
openclaw plugins install @coolclaw/coolclaw
|
|
88
90
|
|
|
89
91
|
Or use the one-command installer:
|
|
90
|
-
npx @coolclaw/coolclaw-cli install`
|
|
92
|
+
npx -y @coolclaw/coolclaw-cli@latest install`
|
|
91
93
|
);
|
|
92
94
|
}
|
|
93
95
|
function advisoryHostCompatibility(hostVersion) {
|
|
@@ -444,7 +444,7 @@ function mapInboundFrame(frame) {
|
|
|
444
444
|
}
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
if (frame.type === "SYSTEM_NOTIFICATION" || frame.type === "GAME_EVENT" || frame.type === "CONTENT_TASK") {
|
|
447
|
+
if (frame.type === "SYSTEM_NOTIFICATION" || frame.type === "GAME_EVENT" || frame.type === "CONTENT_TASK" || frame.type === "AGENT_NOTIFY") {
|
|
448
448
|
return mapNotificationFrame(frame);
|
|
449
449
|
}
|
|
450
450
|
throw new Error(`Unsupported inbound CoolClaw frame type: ${frame.type}`);
|
|
@@ -488,6 +488,20 @@ function mapNotificationFrame(frame) {
|
|
|
488
488
|
metadata: { sourceFrameId: frame.id, payload: frame.payload }
|
|
489
489
|
};
|
|
490
490
|
}
|
|
491
|
+
if (frame.type === "AGENT_NOTIFY") {
|
|
492
|
+
const notifyType = typeof payload.notifyType === "string" ? payload.notifyType : "unknown";
|
|
493
|
+
const postId = payload.postId !== void 0 ? String(payload.postId) : "";
|
|
494
|
+
return {
|
|
495
|
+
id: frame.id,
|
|
496
|
+
channel: "coolclaw",
|
|
497
|
+
conversationId: postId ? `notification:agent_notify:${postId}` : "notification:agent_notify",
|
|
498
|
+
text: `[Agent \u901A\u77E5] ${notifyType}: ${JSON.stringify(payload)}`,
|
|
499
|
+
messageType: frame.type,
|
|
500
|
+
seq,
|
|
501
|
+
shouldReply: false,
|
|
502
|
+
metadata: { sourceFrameId: frame.id, payload: frame.payload }
|
|
503
|
+
};
|
|
504
|
+
}
|
|
491
505
|
return null;
|
|
492
506
|
}
|
|
493
507
|
function mapGameEventFrame(frame, payload) {
|
|
@@ -1516,7 +1530,7 @@ var coolclawChannelPlugin = createChatChannelPlugin({
|
|
|
1516
1530
|
async login({ cfg, accountId, verbose }) {
|
|
1517
1531
|
const resolvedAccountId = accountId?.trim() || "default";
|
|
1518
1532
|
const account = coolclawChannelPlugin.config.resolveAccount(cfg, resolvedAccountId);
|
|
1519
|
-
const { validateAgentToken, runCoolclawSetup } = await import("./setup-
|
|
1533
|
+
const { validateAgentToken, runCoolclawSetup } = await import("./setup-HS3PWYJK.js");
|
|
1520
1534
|
const existingToken = account.tokenSecretRef ? await resolveAccountToken(account) : void 0;
|
|
1521
1535
|
if (existingToken) {
|
|
1522
1536
|
const gatewayUrl = account.gatewayUrl ?? "https://agits-xa.baidu.com/riddle";
|
package/dist/cli-metadata.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
index_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-I6SQ5S34.js";
|
|
4
|
+
import "./chunk-P2I7XHZL.js";
|
|
5
|
+
import "./chunk-DHGATALZ.js";
|
|
6
6
|
import "./chunk-Q3NF4NWE.js";
|
|
7
7
|
|
|
8
8
|
// cli-metadata.ts
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
index_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-I6SQ5S34.js";
|
|
4
|
+
import "./chunk-P2I7XHZL.js";
|
|
5
|
+
import "./chunk-DHGATALZ.js";
|
|
6
6
|
import "./chunk-Q3NF4NWE.js";
|
|
7
7
|
export {
|
|
8
8
|
index_default as default
|
package/dist/setup-entry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolclaw/coolclaw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "OpenClaw native channel plugin for Riddle/CoolClaw chat.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"runtimeSetupEntry": "./dist/setup-entry.js",
|
|
60
60
|
"install": {
|
|
61
61
|
"npmSpec": "@coolclaw/coolclaw",
|
|
62
|
-
"expectedIntegrity": "sha512-
|
|
62
|
+
"expectedIntegrity": "sha512-HI/uadGwTrDPoM8FJ47+0F5bix6X49i7TUPQ/3x+e12BzyyCgE5gHrQsv2qic5VjHmbPoQ/IAfnejecmxl7Lsw==",
|
|
63
63
|
"defaultChoice": "npm",
|
|
64
64
|
"minHostVersion": ">=2026.3.22"
|
|
65
65
|
},
|