multiclaws 0.3.0 → 0.3.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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/index.js +2 -73
- package/package.json +1 -1
package/README.md
CHANGED
package/README.zh-CN.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const handlers_1 = require("./gateway/handlers");
|
|
4
4
|
const multiclaws_service_1 = require("./service/multiclaws-service");
|
|
5
|
-
const gateway_client_1 = require("./infra/gateway-client");
|
|
6
5
|
const logger_1 = require("./infra/logger");
|
|
7
6
|
const telemetry_1 = require("./infra/telemetry");
|
|
8
7
|
function readConfig(api) {
|
|
@@ -296,13 +295,12 @@ function createTools(getService) {
|
|
|
296
295
|
const plugin = {
|
|
297
296
|
id: "multiclaws",
|
|
298
297
|
name: "MultiClaws",
|
|
299
|
-
version: "0.3.
|
|
298
|
+
version: "0.3.1",
|
|
300
299
|
register(api) {
|
|
301
300
|
const config = readConfig(api);
|
|
302
301
|
(0, telemetry_1.initializeTelemetry)({ enableConsoleExporter: config.telemetry?.consoleExporter });
|
|
303
302
|
const structured = (0, logger_1.createStructuredLogger)(api.logger, "multiclaws");
|
|
304
303
|
let service = null;
|
|
305
|
-
let bioSpawnAttempted = false;
|
|
306
304
|
// Ensure required tools are in gateway.tools.allow at registration time
|
|
307
305
|
// so the gateway starts with them already present (no restart needed).
|
|
308
306
|
if (api.config) {
|
|
@@ -366,77 +364,8 @@ const plugin = {
|
|
|
366
364
|
}));
|
|
367
365
|
},
|
|
368
366
|
});
|
|
369
|
-
api.on("gateway_start",
|
|
367
|
+
api.on("gateway_start", () => {
|
|
370
368
|
structured.logger.info("[multiclaws] gateway_start observed");
|
|
371
|
-
// On first run: spawn a subagent to generate bio and notify user (once only)
|
|
372
|
-
if (!service || !gatewayConfig || bioSpawnAttempted)
|
|
373
|
-
return;
|
|
374
|
-
try {
|
|
375
|
-
const pending = await service.getPendingProfileReview();
|
|
376
|
-
if (!pending.pending)
|
|
377
|
-
return;
|
|
378
|
-
bioSpawnAttempted = true;
|
|
379
|
-
const profile = pending.profile;
|
|
380
|
-
const ownerName = profile?.ownerName || "unknown";
|
|
381
|
-
const task = [
|
|
382
|
-
`You are initializing a MultiClaws agent profile for "${ownerName}" on first run.`,
|
|
383
|
-
`MultiClaws enables multiple OpenClaw instances to collaborate as a team over A2A protocol.`,
|
|
384
|
-
``,
|
|
385
|
-
`Complete all steps below, then send ONE message to the user.`,
|
|
386
|
-
``,
|
|
387
|
-
`== STEP 1: Generate bio ==`,
|
|
388
|
-
`Inspect the current environment:`,
|
|
389
|
-
`- Available tools and skills (implies capabilities)`,
|
|
390
|
-
`- Connected channels (Telegram, Gmail, Discord, etc.)`,
|
|
391
|
-
`- Workspace contents (git repos, project folders, key files)`,
|
|
392
|
-
`- Installed plugins`,
|
|
393
|
-
`- Timezone and language`,
|
|
394
|
-
``,
|
|
395
|
-
`Generate a bio in markdown — a "skill card" that other AI agents read to decide`,
|
|
396
|
-
`whether to delegate tasks here. Include:`,
|
|
397
|
-
`- One-line role description`,
|
|
398
|
-
`- What this agent can handle`,
|
|
399
|
-
`- What data/systems it has access to`,
|
|
400
|
-
`- Timezone / language`,
|
|
401
|
-
``,
|
|
402
|
-
`Call: multiclaws_profile_set(ownerName="${ownerName}", bio="<generated markdown>")`,
|
|
403
|
-
``,
|
|
404
|
-
`== STEP 2: Check Tailscale ==`,
|
|
405
|
-
`Check if Tailscale is active by looking at network interfaces for a 100.x.x.x IP address.`,
|
|
406
|
-
`- Found 100.x.x.x: cross-network collaboration is ready.`,
|
|
407
|
-
`- Not found: only LAN collaboration available.`,
|
|
408
|
-
``,
|
|
409
|
-
`== STEP 3: Send ONE message to the user ==`,
|
|
410
|
-
``,
|
|
411
|
-
`1. **MultiClaws 已就绪** — 简要介绍插件功能:`,
|
|
412
|
-
` "MultiClaws 让多个 OpenClaw 实例组成团队协作。你可以创建团队、邀请队友加入,然后把任务委派给队友的 AI——它会自动根据每个智能体的档案选择最合适的执行者。"`,
|
|
413
|
-
``,
|
|
414
|
-
`2. **默认名字**: "你的默认名字是 '${ownerName}',需要修改吗?"`,
|
|
415
|
-
``,
|
|
416
|
-
`3. **Bio 预览**: 展示生成的 bio,问"这是根据你的环境自动生成的档案,需要修改吗?"`,
|
|
417
|
-
``,
|
|
418
|
-
`4. **网络状态** (one line based on Step 2):`,
|
|
419
|
-
` - Tailscale active: "Tailscale 已检测到,跨网络协作已就绪。"`,
|
|
420
|
-
` - LAN only: "当前仅支持局域网协作。如需跨网络,安装 Tailscale:https://tailscale.com/download"`,
|
|
421
|
-
``,
|
|
422
|
-
`5. **如何使用**:`,
|
|
423
|
-
` - "说「创建一个叫 xxx 的团队」创建团队,把邀请码分享给队友"`,
|
|
424
|
-
` - "说「用邀请码 mc:xxxx 加入团队」加入队友的团队"`,
|
|
425
|
-
` - "加入后,说「让 Bob 帮我做 xxx」就能把任务委派给队友的 AI"`,
|
|
426
|
-
` - "说「显示所有智能体」查看团队成员及其能力"`,
|
|
427
|
-
``,
|
|
428
|
-
`Keep the message concise.`,
|
|
429
|
-
].join("\n");
|
|
430
|
-
await (0, gateway_client_1.invokeGatewayTool)({
|
|
431
|
-
gateway: gatewayConfig,
|
|
432
|
-
tool: "sessions_spawn",
|
|
433
|
-
args: { task, mode: "run" },
|
|
434
|
-
timeoutMs: 30_000,
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
catch (err) {
|
|
438
|
-
structured.logger.warn(`[multiclaws] bio init task failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
439
|
-
}
|
|
440
369
|
});
|
|
441
370
|
api.on("gateway_stop", () => {
|
|
442
371
|
structured.logger.info("[multiclaws] gateway_stop observed");
|