volute 0.8.3 → 0.10.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.
Files changed (45) hide show
  1. package/dist/{agent-YORVRB6I.js → agent-ECRX44DB.js} +10 -10
  2. package/dist/{agent-manager-CMMH5KQQ.js → agent-manager-MRHHKAB6.js} +2 -2
  3. package/dist/api-client-YPKOZP2O.js +10 -0
  4. package/dist/{channel-RDGHBFSI.js → channel-2WHBRDTD.js} +66 -81
  5. package/dist/chunk-4RQBJWQX.js +17 -0
  6. package/dist/{chunk-YNNK4QN2.js → chunk-FYQGANL6.js} +40 -2
  7. package/dist/chunk-R3VB7NF5.js +205 -0
  8. package/dist/{chunk-23L3MKEV.js → chunk-STOEJOJO.js} +18 -4
  9. package/dist/cli.js +14 -14
  10. package/dist/{connector-ZP6MEFF4.js → connector-L2HBLZBW.js} +37 -20
  11. package/dist/create-VBZZNJOG.js +38 -0
  12. package/dist/{daemon-client-54J3EIZD.js → daemon-client-P44NU3KU.js} +1 -1
  13. package/dist/daemon-restart-QCLR6ZZV.js +61 -0
  14. package/dist/daemon.js +1732 -214
  15. package/dist/delete-BOTVU4YO.js +35 -0
  16. package/dist/{down-4DGRZRJU.js → down-4LIQG3CE.js} +3 -1
  17. package/dist/{env-KMNYGVZ2.js → env-CGORIKVF.js} +86 -37
  18. package/dist/{history-PXJVYLVY.js → history-NI5QP27M.js} +11 -8
  19. package/dist/import-2BZUWT23.js +21 -0
  20. package/dist/logs-APWVWGNX.js +77 -0
  21. package/dist/{package-2S7APQBC.js → package-ERGXEDAF.js} +1 -1
  22. package/dist/{restart-KVH3TK5N.js → restart-CCYM3MEC.js} +10 -4
  23. package/dist/{schedule-HCUCBNQI.js → schedule-E4MFGYSA.js} +24 -8
  24. package/dist/{send-BNC2S5BY.js → send-X6OQGSD6.js} +36 -28
  25. package/dist/{start-QU73YTJW.js → start-6YRS6FF6.js} +7 -2
  26. package/dist/{status-Q6ZQJXNI.js → status-SIMKH3ZE.js} +8 -3
  27. package/dist/{stop-N7U5N6A7.js → stop-UQSNF4CG.js} +7 -2
  28. package/dist/{up-RZJMSVQS.js → up-MNNPCMFF.js} +1 -1
  29. package/dist/upgrade-RSE4CZNE.js +55 -0
  30. package/dist/variant-7IZF6OWO.js +215 -0
  31. package/package.json +1 -1
  32. package/dist/chunk-ECPQXRLB.js +0 -264
  33. package/dist/chunk-NETNFBA5.js +0 -28
  34. package/dist/chunk-XUA3JUFK.js +0 -121
  35. package/dist/create-HGJHLABX.js +0 -96
  36. package/dist/daemon-restart-IMNCBWFV.js +0 -28
  37. package/dist/delete-45TGQC4N.js +0 -67
  38. package/dist/import-CNEDF3TD.js +0 -532
  39. package/dist/logs-TZB3MTLZ.js +0 -37
  40. package/dist/upgrade-CZF6PN7Y.js +0 -224
  41. package/dist/variant-RKXPN5DH.js +0 -476
  42. package/dist/{chunk-6RDCTVQK.js → chunk-4NAGJV3I.js} +0 -0
  43. package/dist/{chunk-W6TMWYU3.js → chunk-WV4W7BAT.js} +3 -3
  44. package/dist/{service-56CY4S6Z.js → service-OW35VZ5G.js} +3 -3
  45. package/dist/{setup-7SPMWF2O.js → setup-ABMZK6LS.js} +3 -3
@@ -1,532 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- readVoluteConfig,
4
- writeVoluteConfig
5
- } from "./chunk-NETNFBA5.js";
6
- import {
7
- agentEnvPath,
8
- readEnv,
9
- writeEnv
10
- } from "./chunk-QF22MYDJ.js";
11
- import {
12
- composeTemplate,
13
- copyTemplateToDir,
14
- findTemplatesRoot
15
- } from "./chunk-XUA3JUFK.js";
16
- import {
17
- parseArgs
18
- } from "./chunk-D424ZQGI.js";
19
- import {
20
- exec,
21
- execInherit
22
- } from "./chunk-5C5JWR2L.js";
23
- import {
24
- addAgent,
25
- agentDir,
26
- ensureVoluteHome,
27
- nextPort
28
- } from "./chunk-DP2DX4WV.js";
29
- import "./chunk-K3NQKI34.js";
30
-
31
- // src/commands/import.ts
32
- import {
33
- cpSync,
34
- existsSync,
35
- mkdirSync as mkdirSync2,
36
- readdirSync as readdirSync2,
37
- readFileSync as readFileSync3,
38
- rmSync,
39
- statSync,
40
- writeFileSync as writeFileSync3
41
- } from "fs";
42
- import { homedir as homedir2 } from "os";
43
- import { basename, resolve as resolve3 } from "path";
44
-
45
- // src/lib/consolidate.ts
46
- import { readdirSync, readFileSync, writeFileSync } from "fs";
47
- import { resolve } from "path";
48
- async function consolidateMemory(agentDir2) {
49
- const soulPath = resolve(agentDir2, "home/SOUL.md");
50
- const memoryPath = resolve(agentDir2, "home/MEMORY.md");
51
- const memoryDir = resolve(agentDir2, "home/memory");
52
- const soul = readFileSync(soulPath, "utf-8");
53
- const logs = [];
54
- try {
55
- const files = readdirSync(memoryDir).filter((f) => /^\d{4}-\d{2}-\d{2}\.md$/.test(f)).sort();
56
- for (const filename of files) {
57
- const date = filename.replace(".md", "");
58
- const content2 = readFileSync(resolve(memoryDir, filename), "utf-8").trim();
59
- if (content2) {
60
- logs.push(`### ${date}
61
-
62
- ${content2}`);
63
- }
64
- }
65
- } catch {
66
- }
67
- if (logs.length === 0) {
68
- console.log("No daily logs found.");
69
- return;
70
- }
71
- const apiKey = process.env.ANTHROPIC_API_KEY;
72
- if (!apiKey) {
73
- console.error("ANTHROPIC_API_KEY not set, skipping memory consolidation.");
74
- return;
75
- }
76
- console.log("Consolidating memory from daily logs...");
77
- const userMessage = [
78
- "You have daily logs from a previous environment but no long-term memory file yet.",
79
- "Please review the daily logs below and produce consolidated MEMORY.md content.",
80
- "Keep it concise and organized by topic. Output ONLY the markdown content for MEMORY.md, nothing else.",
81
- "",
82
- "## Daily logs",
83
- "",
84
- logs.join("\n\n")
85
- ].join("\n");
86
- const res = await fetch("https://api.anthropic.com/v1/messages", {
87
- method: "POST",
88
- headers: {
89
- "Content-Type": "application/json",
90
- "x-api-key": apiKey,
91
- "anthropic-version": "2023-06-01"
92
- },
93
- body: JSON.stringify({
94
- model: "claude-sonnet-4-20250514",
95
- max_tokens: 4096,
96
- system: soul,
97
- messages: [{ role: "user", content: userMessage }]
98
- })
99
- });
100
- if (!res.ok) {
101
- const body = await res.text();
102
- console.error(`Anthropic API error (${res.status}): ${body}`);
103
- return;
104
- }
105
- const data = await res.json();
106
- const content = data.content.filter((b) => b.type === "text" && b.text).map((b) => b.text).join("").trim();
107
- if (content) {
108
- writeFileSync(memoryPath, `${content}
109
- `);
110
- console.log("MEMORY.md created successfully.");
111
- } else {
112
- console.warn("Warning: No content produced.");
113
- }
114
- }
115
-
116
- // src/lib/convert-session.ts
117
- import { randomUUID } from "crypto";
118
- import { mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
119
- import { homedir } from "os";
120
- import { resolve as resolve2 } from "path";
121
- function convertSession(opts) {
122
- const lines = readFileSync2(opts.sessionPath, "utf-8").trim().split("\n");
123
- const sessionId = randomUUID();
124
- const idMap = /* @__PURE__ */ new Map();
125
- const messages = [];
126
- for (const line of lines) {
127
- const event = JSON.parse(line);
128
- if (event.type === "message" && event.message) {
129
- messages.push(event);
130
- }
131
- }
132
- const sdkEvents = [];
133
- let lastSdkUuid = null;
134
- for (let i = 0; i < messages.length; i++) {
135
- const event = messages[i];
136
- const msg = event.message;
137
- if (msg.role === "user") {
138
- const uuid = randomUUID();
139
- idMap.set(event.id, uuid);
140
- const parentUuid = event.parentId ? idMap.get(event.parentId) ?? null : null;
141
- const sdkEvent = {
142
- uuid,
143
- parentUuid,
144
- sessionId,
145
- timestamp: event.timestamp,
146
- cwd: opts.projectDir,
147
- version: "0.1.0",
148
- gitBranch: "main",
149
- isSidechain: false,
150
- userType: "external",
151
- type: "user",
152
- message: {
153
- role: "user",
154
- content: msg.content
155
- }
156
- };
157
- sdkEvents.push(JSON.stringify(sdkEvent));
158
- lastSdkUuid = uuid;
159
- } else if (msg.role === "assistant") {
160
- const content = convertAssistantContent(msg.content);
161
- if (content.length === 0) continue;
162
- const uuid = randomUUID();
163
- idMap.set(event.id, uuid);
164
- const parentUuid = event.parentId ? idMap.get(event.parentId) ?? null : null;
165
- const stopReason = mapStopReason(msg.stopReason);
166
- const sdkEvent = {
167
- uuid,
168
- parentUuid,
169
- sessionId,
170
- timestamp: event.timestamp,
171
- cwd: opts.projectDir,
172
- version: "0.1.0",
173
- gitBranch: "main",
174
- isSidechain: false,
175
- userType: "external",
176
- type: "assistant",
177
- requestId: `req_imported_${randomUUID()}`,
178
- message: {
179
- role: "assistant",
180
- content,
181
- type: "message",
182
- id: `msg_imported_${randomUUID()}`,
183
- model: mapModel(msg.model),
184
- stop_reason: stopReason,
185
- stop_sequence: null,
186
- usage: mapUsage(msg.usage)
187
- }
188
- };
189
- sdkEvents.push(JSON.stringify(sdkEvent));
190
- lastSdkUuid = uuid;
191
- } else if (msg.role === "toolResult") {
192
- const toolResults = [];
193
- let lastToolResultId = event.id;
194
- let lastTimestamp = event.timestamp;
195
- let j = i;
196
- while (j < messages.length && messages[j].message.role === "toolResult") {
197
- const tr = messages[j];
198
- const trMsg = tr.message;
199
- lastToolResultId = tr.id;
200
- lastTimestamp = tr.timestamp;
201
- toolResults.push({
202
- type: "tool_result",
203
- tool_use_id: trMsg.toolCallId,
204
- content: trMsg.content,
205
- ...trMsg.isError ? { is_error: true } : {}
206
- });
207
- j++;
208
- }
209
- i = j - 1;
210
- const uuid = randomUUID();
211
- idMap.set(lastToolResultId, uuid);
212
- const parentUuid = event.parentId ? idMap.get(event.parentId) ?? null : lastSdkUuid;
213
- const sdkEvent = {
214
- uuid,
215
- parentUuid,
216
- sessionId,
217
- timestamp: lastTimestamp,
218
- cwd: opts.projectDir,
219
- version: "0.1.0",
220
- gitBranch: "main",
221
- isSidechain: false,
222
- userType: "external",
223
- type: "user",
224
- sourceToolAssistantUUID: lastSdkUuid ?? void 0,
225
- toolUseResult: "imported",
226
- message: {
227
- role: "user",
228
- content: toolResults
229
- }
230
- };
231
- sdkEvents.push(JSON.stringify(sdkEvent));
232
- lastSdkUuid = uuid;
233
- }
234
- }
235
- const projectId = opts.projectDir.replace(/\//g, "-");
236
- const sdkDir = resolve2(homedir(), ".claude", "projects", projectId);
237
- mkdirSync(sdkDir, { recursive: true });
238
- const sdkPath = resolve2(sdkDir, `${sessionId}.jsonl`);
239
- writeFileSync2(sdkPath, `${sdkEvents.join("\n")}
240
- `);
241
- console.log(`Converted ${sdkEvents.length} messages \u2192 ${sdkPath}`);
242
- return sessionId;
243
- }
244
- var MODEL_MAP = {
245
- "claude-opus-4-5": "claude-opus-4-5-20251101",
246
- "claude-sonnet-4": "claude-sonnet-4-20250514"
247
- };
248
- function mapModel(model) {
249
- if (!model) return "claude-opus-4-5-20251101";
250
- return MODEL_MAP[model] ?? model;
251
- }
252
- function mapStopReason(stopReason) {
253
- if (!stopReason) return "end_turn";
254
- const map = {
255
- toolUse: "tool_use",
256
- endTurn: "end_turn",
257
- stop: "end_turn",
258
- maxTokens: "max_tokens"
259
- };
260
- return map[stopReason] ?? stopReason;
261
- }
262
- function mapUsage(usage) {
263
- if (!usage) return { input_tokens: 0, output_tokens: 0 };
264
- return {
265
- input_tokens: usage.input ?? usage.input_tokens ?? 0,
266
- output_tokens: usage.output ?? usage.output_tokens ?? 0,
267
- cache_read_input_tokens: usage.cacheRead ?? usage.cache_read_input_tokens ?? 0,
268
- cache_creation_input_tokens: usage.cacheWrite ?? usage.cache_creation_input_tokens ?? 0
269
- };
270
- }
271
- function convertAssistantContent(content) {
272
- const result = [];
273
- for (const block of content) {
274
- if (block.type === "thinking") {
275
- } else if (block.type === "toolCall") {
276
- result.push({
277
- type: "tool_use",
278
- id: block.id,
279
- name: block.name,
280
- input: block.arguments ?? block.input ?? {},
281
- caller: { type: "direct" }
282
- });
283
- } else {
284
- result.push(block);
285
- }
286
- }
287
- return result;
288
- }
289
-
290
- // src/commands/import.ts
291
- async function run(args) {
292
- const { positional, flags } = parseArgs(args, {
293
- name: { type: "string" },
294
- session: { type: "string" },
295
- template: { type: "string" }
296
- });
297
- const wsDir = resolveWorkspace(positional[0]);
298
- const soul = readFileSync3(resolve3(wsDir, "SOUL.md"), "utf-8");
299
- const identity = readFileSync3(resolve3(wsDir, "IDENTITY.md"), "utf-8");
300
- const userPath = resolve3(wsDir, "USER.md");
301
- const user = existsSync(userPath) ? readFileSync3(userPath, "utf-8") : "";
302
- const name = flags.name ?? parseNameFromIdentity(identity) ?? "imported-agent";
303
- const mergedSoul = `${soul.trimEnd()}
304
-
305
- ---
306
-
307
- ${identity.trimEnd()}
308
- `;
309
- const mergedMemoryExtra = user ? `
310
-
311
- ---
312
-
313
- ${user.trimEnd()}
314
- ` : "";
315
- ensureVoluteHome();
316
- const dest = agentDir(name);
317
- if (existsSync(dest)) {
318
- console.error(`Agent already exists: ${name}`);
319
- process.exit(1);
320
- }
321
- const template = flags.template ?? "agent-sdk";
322
- const templatesRoot = findTemplatesRoot();
323
- const { composedDir, manifest } = composeTemplate(templatesRoot, template);
324
- try {
325
- console.log(`Creating project: ${name}`);
326
- copyTemplateToDir(composedDir, dest, name, manifest);
327
- } finally {
328
- rmSync(composedDir, { recursive: true, force: true });
329
- }
330
- const initDir = resolve3(dest, ".init");
331
- if (existsSync(initDir)) {
332
- cpSync(initDir, resolve3(dest, "home"), { recursive: true });
333
- rmSync(initDir, { recursive: true, force: true });
334
- }
335
- writeFileSync3(resolve3(dest, "home/SOUL.md"), mergedSoul);
336
- console.log("Wrote SOUL.md (merged with IDENTITY.md)");
337
- const wsMemoryPath = resolve3(wsDir, "MEMORY.md");
338
- const hasMemory = existsSync(wsMemoryPath);
339
- if (hasMemory) {
340
- const existingMemory = readFileSync3(wsMemoryPath, "utf-8");
341
- writeFileSync3(
342
- resolve3(dest, "home/MEMORY.md"),
343
- `${existingMemory.trimEnd()}${mergedMemoryExtra}`
344
- );
345
- console.log(user ? "Wrote MEMORY.md (merged with USER.md)" : "Copied MEMORY.md");
346
- } else if (user) {
347
- writeFileSync3(resolve3(dest, "home/MEMORY.md"), `${user.trimEnd()}
348
- `);
349
- console.log("Wrote MEMORY.md (from USER.md)");
350
- }
351
- const wsMemoryDir = resolve3(wsDir, "memory");
352
- let dailyLogCount = 0;
353
- if (existsSync(wsMemoryDir)) {
354
- const destMemoryDir = resolve3(dest, "home/memory");
355
- const files = readdirSync2(wsMemoryDir).filter((f) => f.endsWith(".md"));
356
- for (const file of files) {
357
- cpSync(resolve3(wsMemoryDir, file), resolve3(destMemoryDir, file));
358
- }
359
- dailyLogCount = files.length;
360
- if (dailyLogCount > 0) {
361
- console.log(`Copied ${dailyLogCount} daily log(s)`);
362
- }
363
- }
364
- const port = nextPort();
365
- addAgent(name, port);
366
- console.log("Installing dependencies...");
367
- await execInherit("npm", ["install"], { cwd: dest });
368
- if (!hasMemory && dailyLogCount > 0) {
369
- console.log("No MEMORY.md \u2014 running memory consolidation...");
370
- await consolidateMemory(dest);
371
- }
372
- await exec("git", ["init"], { cwd: dest });
373
- await exec("git", ["add", "-A"], { cwd: dest });
374
- await exec("git", ["commit", "-m", "import from OpenClaw"], { cwd: dest });
375
- const sessionFile = flags.session ? resolve3(flags.session) : findOpenClawSession(wsDir);
376
- if (sessionFile) {
377
- if (!existsSync(sessionFile)) {
378
- console.error(`Session file not found: ${sessionFile}`);
379
- process.exit(1);
380
- }
381
- if (template === "pi") {
382
- importPiSession(sessionFile, dest);
383
- } else if (template === "agent-sdk") {
384
- console.log("Converting session...");
385
- const sessionId = convertSession({ sessionPath: sessionFile, projectDir: dest });
386
- const voluteDir = resolve3(dest, ".volute");
387
- mkdirSync2(voluteDir, { recursive: true });
388
- writeFileSync3(resolve3(voluteDir, "session.json"), JSON.stringify({ sessionId }));
389
- } else {
390
- console.warn(`Session import not supported for template: ${template}`);
391
- }
392
- }
393
- importOpenClawConnectors(name, dest);
394
- console.log(`
395
- Imported agent: ${name} (port ${port})`);
396
- console.log(`
397
- volute agent start ${name}`);
398
- }
399
- function resolveWorkspace(explicitPath) {
400
- if (explicitPath) {
401
- const wsDir = resolve3(explicitPath);
402
- if (!existsSync(resolve3(wsDir, "SOUL.md")) || !existsSync(resolve3(wsDir, "IDENTITY.md"))) {
403
- console.error("Not a valid OpenClaw workspace: missing SOUL.md or IDENTITY.md");
404
- process.exit(1);
405
- }
406
- return wsDir;
407
- }
408
- const cwd = process.cwd();
409
- if (existsSync(resolve3(cwd, "SOUL.md")) && existsSync(resolve3(cwd, "IDENTITY.md"))) {
410
- console.log(`Using workspace: ${cwd}`);
411
- return cwd;
412
- }
413
- const openclawWs = resolve3(homedir2(), ".openclaw/workspace");
414
- if (existsSync(resolve3(openclawWs, "SOUL.md")) && existsSync(resolve3(openclawWs, "IDENTITY.md"))) {
415
- console.log(`Using workspace: ${openclawWs}`);
416
- return openclawWs;
417
- }
418
- console.error(
419
- "Usage: volute agent import [<workspace-path>] [--name <name>] [--session <path>] [--template <name>]\n\nNo OpenClaw workspace found. Provide a path, run from a workspace, or ensure ~/.openclaw/workspace exists."
420
- );
421
- process.exit(1);
422
- }
423
- function findOpenClawSession(workspaceDir) {
424
- const agentsDir = resolve3(homedir2(), ".openclaw/agents");
425
- if (!existsSync(agentsDir)) return void 0;
426
- const matches = [];
427
- try {
428
- for (const agent of readdirSync2(agentsDir)) {
429
- const sessionsDir = resolve3(agentsDir, agent, "sessions");
430
- if (!existsSync(sessionsDir)) continue;
431
- for (const file of readdirSync2(sessionsDir)) {
432
- if (!file.endsWith(".jsonl")) continue;
433
- const fullPath = resolve3(sessionsDir, file);
434
- if (sessionMatchesWorkspace(fullPath, workspaceDir)) {
435
- matches.push({ path: fullPath, mtime: statSync(fullPath).mtimeMs });
436
- }
437
- }
438
- }
439
- } catch (err) {
440
- console.warn("Warning: error scanning OpenClaw sessions:", err);
441
- return void 0;
442
- }
443
- if (matches.length === 0) return void 0;
444
- matches.sort((a, b) => b.mtime - a.mtime);
445
- console.log(`Found session: ${matches[0].path}`);
446
- return matches[0].path;
447
- }
448
- function sessionMatchesWorkspace(sessionPath, workspaceDir) {
449
- try {
450
- const fd = readFileSync3(sessionPath, "utf-8");
451
- const firstLine = fd.slice(0, fd.indexOf("\n"));
452
- const header = JSON.parse(firstLine);
453
- return header.type === "session" && resolve3(header.cwd) === resolve3(workspaceDir);
454
- } catch {
455
- return false;
456
- }
457
- }
458
- function importPiSession(sessionFile, agentDirPath) {
459
- const homeDir = resolve3(agentDirPath, "home");
460
- const piSessionDir = resolve3(agentDirPath, ".volute/pi-sessions/main");
461
- mkdirSync2(piSessionDir, { recursive: true });
462
- const content = readFileSync3(sessionFile, "utf-8");
463
- const lines = content.trim().split("\n");
464
- try {
465
- const header = JSON.parse(lines[0]);
466
- if (header.type === "session") {
467
- header.cwd = homeDir;
468
- lines[0] = JSON.stringify(header);
469
- }
470
- } catch {
471
- }
472
- const filename = basename(sessionFile);
473
- const destPath = resolve3(piSessionDir, filename);
474
- writeFileSync3(destPath, `${lines.join("\n")}
475
- `);
476
- console.log(`Imported session (${lines.length} entries)`);
477
- }
478
- function importOpenClawConnectors(agentName, agentDirPath) {
479
- const configPath = resolve3(homedir2(), ".openclaw/openclaw.json");
480
- if (!existsSync(configPath)) return;
481
- let config;
482
- try {
483
- config = JSON.parse(readFileSync3(configPath, "utf-8"));
484
- } catch (err) {
485
- console.warn("Warning: failed to parse openclaw.json:", err);
486
- return;
487
- }
488
- const discord = config.channels?.discord;
489
- if (!discord?.enabled || !discord.token) return;
490
- const envPath = agentEnvPath(agentName);
491
- const env = readEnv(envPath);
492
- env.DISCORD_TOKEN = discord.token;
493
- writeEnv(envPath, env);
494
- const channelNames = /* @__PURE__ */ new Set();
495
- if (discord.guilds) {
496
- for (const guild of Object.values(discord.guilds)) {
497
- if (!guild.channels) continue;
498
- for (const [name, ch] of Object.entries(guild.channels)) {
499
- if (ch.allow) channelNames.add(name);
500
- }
501
- }
502
- }
503
- const voluteConfig = readVoluteConfig(agentDirPath) ?? {};
504
- const connectors = new Set(voluteConfig.connectors ?? []);
505
- connectors.add("discord");
506
- voluteConfig.connectors = [...connectors];
507
- if (channelNames.size > 0) {
508
- voluteConfig.discord = { channels: [...channelNames] };
509
- }
510
- writeVoluteConfig(agentDirPath, voluteConfig);
511
- console.log("Imported Discord connector config");
512
- if (channelNames.size > 0) {
513
- console.log(`Imported followed channels: ${[...channelNames].join(", ")}`);
514
- }
515
- }
516
- function parseNameFromIdentity(identity) {
517
- const match = identity.match(/\*\*Name:\*\*\s*(.+)/);
518
- if (match) {
519
- const raw = match[1].trim();
520
- if (!raw || raw.startsWith("*") || raw.startsWith("(")) return void 0;
521
- return raw.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9.-]/g, "");
522
- }
523
- return void 0;
524
- }
525
- export {
526
- findOpenClawSession,
527
- importOpenClawConnectors,
528
- importPiSession,
529
- parseNameFromIdentity,
530
- run,
531
- sessionMatchesWorkspace
532
- };
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- resolveAgentName
4
- } from "./chunk-AZEL2IEK.js";
5
- import {
6
- parseArgs
7
- } from "./chunk-D424ZQGI.js";
8
- import {
9
- resolveAgent,
10
- stateDir
11
- } from "./chunk-DP2DX4WV.js";
12
- import "./chunk-K3NQKI34.js";
13
-
14
- // src/commands/logs.ts
15
- import { spawn } from "child_process";
16
- import { existsSync } from "fs";
17
- import { resolve } from "path";
18
- async function run(args) {
19
- const { flags } = parseArgs(args, {
20
- agent: { type: "string" },
21
- follow: { type: "boolean" },
22
- n: { type: "number" }
23
- });
24
- const name = resolveAgentName(flags);
25
- resolveAgent(name);
26
- const logFile = resolve(stateDir(name), "logs", "agent.log");
27
- if (!existsSync(logFile)) {
28
- console.error(`No log file found. Has ${name} been started?`);
29
- process.exit(1);
30
- }
31
- const tailArgs = [`-n`, String(flags.n ?? 50), ...flags.follow ? ["-f"] : [], logFile];
32
- const child = spawn("tail", tailArgs, { stdio: "inherit" });
33
- child.on("exit", (code) => process.exit(code ?? 0));
34
- }
35
- export {
36
- run
37
- };