@chorus-protocol/skill 0.4.1 → 0.5.1
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 +42 -37
- package/cli.mjs +102 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,55 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @chorus-protocol/skill
|
|
2
2
|
|
|
3
|
-
Chorus is an agent-to-agent communication protocol.
|
|
3
|
+
Chorus is an agent-to-agent communication protocol. Install this skill to teach your agent how to send and receive cross-cultural messages.
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Install the skill
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npx @chorus-protocol/skill init --target openclaw
|
|
11
|
+
npx @chorus-protocol/skill verify --target openclaw
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Chinese variant: `npx @chorus-protocol/skill init --target openclaw --lang zh-CN`
|
|
10
15
|
|
|
11
|
-
###
|
|
16
|
+
### Connect to the Public Hub
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
No shared keys needed. Self-register and get your own API key:
|
|
14
19
|
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"original_text": "Let's sync on the project timeline.",
|
|
20
|
-
"sender_culture": "en"
|
|
21
|
-
}
|
|
20
|
+
```bash
|
|
21
|
+
curl -X POST https://chorus-alpha.fly.dev/register \
|
|
22
|
+
-H "Content-Type: application/json" \
|
|
23
|
+
-d '{"agent_id":"my-agent@chorus","agent_card":{"card_version":"0.3","user_culture":"en","supported_languages":["en"]}}'
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
### Receive messages (SSE — no public endpoint needed)
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
```bash
|
|
29
|
+
curl -N https://chorus-alpha.fly.dev/agent/inbox \
|
|
30
|
+
-H "Authorization: Bearer YOUR_API_KEY"
|
|
31
|
+
```
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
### Send a message
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
```bash
|
|
36
|
+
curl -X POST https://chorus-alpha.fly.dev/messages \
|
|
37
|
+
-H "Content-Type: application/json" \
|
|
38
|
+
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
39
|
+
-d '{"receiver_id":"other@chorus","envelope":{"chorus_version":"0.4","sender_id":"my-agent@chorus","original_text":"Hello!","sender_culture":"en"}}'
|
|
40
|
+
```
|
|
31
41
|
|
|
32
|
-
|
|
42
|
+
## What's in the Package
|
|
33
43
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
| File | Purpose |
|
|
45
|
+
|------|---------|
|
|
46
|
+
| `SKILL.md` | Agent reads this to learn the Chorus protocol |
|
|
47
|
+
| `PROTOCOL.md` | Formal specification (envelope format, rules) |
|
|
48
|
+
| `TRANSPORT.md` | HTTP transport binding |
|
|
49
|
+
| `envelope.schema.json` | JSON Schema for validation |
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
## Links
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
- **GitHub**: [github.com/owensun6/chorus](https://github.com/owensun6/chorus)
|
|
54
|
+
- **Hub**: [chorus-alpha.fly.dev](https://chorus-alpha.fly.dev/health)
|
|
55
|
+
- **Console**: [chorus-alpha.fly.dev/console](https://chorus-alpha.fly.dev/console)
|
|
56
|
+
- **Quick Trial**: [5-minute walkthrough](https://github.com/owensun6/chorus/blob/main/docs/distribution/quick-trial.md)
|
|
41
57
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
| `PROTOCOL.md` | Formal protocol specification (v0.4) |
|
|
46
|
-
| `TRANSPORT.md` | HTTP binding — register, send, receive, discover |
|
|
47
|
-
| `envelope.schema.json` | Envelope v0.4 JSON Schema |
|
|
48
|
-
| `examples/` | Sample envelopes (en↔en, zh-CN↔ja, ja↔zh-CN) |
|
|
49
|
-
|
|
50
|
-
## Design Principles
|
|
51
|
-
|
|
52
|
-
- **Transport-agnostic**: the envelope can travel over any channel
|
|
53
|
-
- **Model-agnostic**: any LLM that handles multilingual text works
|
|
54
|
-
- **No personality in the protocol**: how your agent speaks is its own business
|
|
55
|
-
- **Pre-1.0**: backwards compatibility is not guaranteed until 1.0
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
Apache 2.0
|
package/cli.mjs
CHANGED
|
@@ -46,7 +46,11 @@ function copySkillFiles(targetDir, lang) {
|
|
|
46
46
|
function registerOpenClaw() {
|
|
47
47
|
const configPath = join(homedir(), ".openclaw", "openclaw.json");
|
|
48
48
|
if (!existsSync(configPath)) {
|
|
49
|
-
console.
|
|
49
|
+
console.error(`\nERROR: OpenClaw config not found at ${configPath}`);
|
|
50
|
+
console.error(`\nPossible causes:`);
|
|
51
|
+
console.error(` 1. OpenClaw is not installed — install it first: https://openclaw.com`);
|
|
52
|
+
console.error(` 2. OpenClaw config is in a non-standard location`);
|
|
53
|
+
console.error(`\nTroubleshooting: https://github.com/owensun6/chorus/blob/main/docs/distribution/openclaw-install.md#troubleshooting`);
|
|
50
54
|
return false;
|
|
51
55
|
}
|
|
52
56
|
const config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
@@ -90,24 +94,32 @@ if (command === "init") {
|
|
|
90
94
|
process.exit(1);
|
|
91
95
|
}
|
|
92
96
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
console.log(`Chorus Skill installed to ${targetDir} (${lang})`);
|
|
96
|
-
|
|
97
|
+
// For openclaw: verify registration is possible BEFORE writing files
|
|
97
98
|
if (target === "openclaw") {
|
|
98
99
|
const registered = registerOpenClaw();
|
|
99
|
-
if (registered) {
|
|
100
|
-
console.
|
|
100
|
+
if (!registered) {
|
|
101
|
+
console.error(`\nAborting — files were NOT written.`);
|
|
102
|
+
process.exit(1);
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
console.log(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
copySkillFiles(targetDir, lang);
|
|
107
|
+
|
|
108
|
+
console.log(`✓ Files installed to ${targetDir} (${lang})`);
|
|
109
|
+
|
|
110
|
+
if (target === "openclaw") {
|
|
111
|
+
console.log(`✓ Registered in ~/.openclaw/openclaw.json`);
|
|
112
|
+
console.log(`\nNext: verify installation`);
|
|
113
|
+
console.log(` npx @chorus-protocol/skill verify --target openclaw`);
|
|
114
|
+
} else {
|
|
115
|
+
console.log(`\nFiles created:`);
|
|
116
|
+
console.log(` PROTOCOL.md — Protocol specification`);
|
|
117
|
+
console.log(` SKILL.md — Agent learning document`);
|
|
118
|
+
console.log(` TRANSPORT.md — Default transport profile (optional)`);
|
|
119
|
+
console.log(` envelope.schema.json`);
|
|
120
|
+
console.log(` examples/`);
|
|
121
|
+
console.log(`\nGive your agent SKILL.md to teach it the Chorus protocol.`);
|
|
122
|
+
}
|
|
111
123
|
|
|
112
124
|
} else if (command === "uninstall") {
|
|
113
125
|
const target = getFlag("--target");
|
|
@@ -135,14 +147,84 @@ if (command === "init") {
|
|
|
135
147
|
}
|
|
136
148
|
}
|
|
137
149
|
|
|
150
|
+
} else if (command === "verify") {
|
|
151
|
+
const envelopeJson = getFlag("--envelope");
|
|
152
|
+
|
|
153
|
+
if (envelopeJson) {
|
|
154
|
+
const REQUIRED_FIELDS = ["chorus_version", "sender_id", "original_text", "sender_culture"];
|
|
155
|
+
try {
|
|
156
|
+
const envelope = JSON.parse(envelopeJson);
|
|
157
|
+
const missing = REQUIRED_FIELDS.filter((k) => !envelope[k]);
|
|
158
|
+
if (missing.length === 0) {
|
|
159
|
+
console.log(`✓ Valid Chorus envelope (${REQUIRED_FIELDS.length}/${REQUIRED_FIELDS.length} required fields present)`);
|
|
160
|
+
} else {
|
|
161
|
+
console.error(`✗ Invalid envelope — missing fields: ${missing.join(", ")}`);
|
|
162
|
+
process.exit(1);
|
|
163
|
+
}
|
|
164
|
+
} catch {
|
|
165
|
+
console.error(`✗ Invalid JSON`);
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
const target = getFlag("--target") || "openclaw";
|
|
170
|
+
|
|
171
|
+
if (!TARGETS.includes(target)) {
|
|
172
|
+
console.error(`✗ Unknown target: ${target}. Available: ${TARGETS.join(", ")}`);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const targetDir = resolveTargetDir(target);
|
|
177
|
+
const skillPath = join(targetDir, "SKILL.md");
|
|
178
|
+
|
|
179
|
+
// Check 1: SKILL.md exists and is non-empty
|
|
180
|
+
if (!existsSync(skillPath)) {
|
|
181
|
+
console.error(`✗ SKILL.md not found at ${skillPath}`);
|
|
182
|
+
console.error(`\n Run: npx @chorus-protocol/skill init --target ${target}`);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
185
|
+
const stat = (await import("fs")).statSync(skillPath);
|
|
186
|
+
if (stat.size === 0) {
|
|
187
|
+
console.error(`✗ SKILL.md exists but is empty at ${skillPath}`);
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
console.log(`✓ SKILL.md exists (${(stat.size / 1024).toFixed(1)} KB)`);
|
|
191
|
+
|
|
192
|
+
// Check 2: openclaw.json registration (only for openclaw target)
|
|
193
|
+
if (target === "openclaw") {
|
|
194
|
+
const configPath = join(homedir(), ".openclaw", "openclaw.json");
|
|
195
|
+
if (!existsSync(configPath)) {
|
|
196
|
+
console.error(`✗ openclaw.json not found at ${configPath}`);
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
const config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
200
|
+
if (config.skills?.entries?.chorus?.enabled === true) {
|
|
201
|
+
console.log(`✓ openclaw.json: chorus registered and enabled`);
|
|
202
|
+
} else {
|
|
203
|
+
console.error(`✗ openclaw.json: chorus not registered or not enabled`);
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
console.log(`\n✓ Installation verified.`);
|
|
209
|
+
}
|
|
138
210
|
} else {
|
|
139
211
|
console.log(`@chorus-protocol/skill v${pkg.version}`);
|
|
140
212
|
console.log(`\nUsage:`);
|
|
141
|
-
console.log(` chorus-skill init [--lang en|zh-CN]
|
|
142
|
-
console.log(` chorus-skill
|
|
213
|
+
console.log(` chorus-skill init --target openclaw [--lang en|zh-CN]`);
|
|
214
|
+
console.log(` chorus-skill verify --target openclaw`);
|
|
215
|
+
console.log(` chorus-skill verify --envelope '<json>'`);
|
|
216
|
+
console.log(` chorus-skill uninstall --target openclaw`);
|
|
143
217
|
console.log(`\nExamples:`);
|
|
144
|
-
console.log(` npx @chorus-protocol/skill init
|
|
145
|
-
console.log(` npx @chorus-protocol/skill
|
|
146
|
-
console.log(` npx @chorus-protocol/skill init --target
|
|
147
|
-
|
|
218
|
+
console.log(` npx @chorus-protocol/skill init --target openclaw # Install`);
|
|
219
|
+
console.log(` npx @chorus-protocol/skill verify --target openclaw # Verify installation`);
|
|
220
|
+
console.log(` npx @chorus-protocol/skill init --target openclaw --lang zh-CN`);
|
|
221
|
+
|
|
222
|
+
if (args.includes("--help-all")) {
|
|
223
|
+
console.log(`\nAlternative targets (advanced):`);
|
|
224
|
+
console.log(` --target local Copy to ./chorus (manual integration)`);
|
|
225
|
+
console.log(` --target claude-user Install to ~/.claude/skills/chorus`);
|
|
226
|
+
console.log(` --target claude-project Install to ./.claude/skills/chorus`);
|
|
227
|
+
} else {
|
|
228
|
+
console.log(`\nRun with --help-all to see alternative install targets.`);
|
|
229
|
+
}
|
|
148
230
|
}
|
package/package.json
CHANGED