va-claw 0.2.0 → 0.2.3
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 +13 -2
- package/README.zh-CN.md +13 -2
- package/dist/va-claw-bundle.mjs +212 -77
- package/package.json +5 -1
- package/packages/channels/discord/dist/.tsbuildinfo +1 -1
- package/packages/channels/discord/dist/runtime.test.js +9 -9
- package/packages/channels/discord/dist/runtime.test.js.map +1 -1
- package/packages/channels/dist/.tsbuildinfo +1 -1
- package/packages/channels/dist/index.d.ts +4 -2
- package/packages/channels/dist/index.d.ts.map +1 -1
- package/packages/channels/dist/index.js +6 -1
- package/packages/channels/dist/index.js.map +1 -1
- package/packages/channels/dist/lark.d.ts +3 -0
- package/packages/channels/dist/lark.d.ts.map +1 -0
- package/packages/channels/dist/lark.js +2 -0
- package/packages/channels/dist/lark.js.map +1 -0
- package/packages/channels/lark/dist/.tsbuildinfo +1 -0
- package/packages/channels/lark/dist/cli.d.ts +15 -0
- package/packages/channels/lark/dist/cli.d.ts.map +1 -0
- package/packages/channels/lark/dist/cli.js +61 -0
- package/packages/channels/lark/dist/cli.js.map +1 -0
- package/packages/channels/lark/dist/cli.test.d.ts +2 -0
- package/packages/channels/lark/dist/cli.test.d.ts.map +1 -0
- package/packages/channels/lark/dist/cli.test.js +21 -0
- package/packages/channels/lark/dist/cli.test.js.map +1 -0
- package/packages/channels/lark/dist/index.d.ts +14 -0
- package/packages/channels/lark/dist/index.d.ts.map +1 -0
- package/packages/channels/lark/dist/index.js +41 -0
- package/packages/channels/lark/dist/index.js.map +1 -0
- package/packages/channels/lark/dist/lark-client.d.ts +76 -0
- package/packages/channels/lark/dist/lark-client.d.ts.map +1 -0
- package/packages/channels/lark/dist/lark-client.js +167 -0
- package/packages/channels/lark/dist/lark-client.js.map +1 -0
- package/packages/channels/lark/dist/lark.test.d.ts +2 -0
- package/packages/channels/lark/dist/lark.test.d.ts.map +1 -0
- package/packages/channels/lark/dist/lark.test.js +196 -0
- package/packages/channels/lark/dist/lark.test.js.map +1 -0
- package/packages/channels/lark/dist/message.d.ts +15 -0
- package/packages/channels/lark/dist/message.d.ts.map +1 -0
- package/packages/channels/lark/dist/message.js +108 -0
- package/packages/channels/lark/dist/message.js.map +1 -0
- package/packages/channels/lark/dist/types.d.ts +39 -0
- package/packages/channels/lark/dist/types.d.ts.map +1 -0
- package/packages/channels/lark/dist/types.js +2 -0
- package/packages/channels/lark/dist/types.js.map +1 -0
- package/packages/channels/lark/package.json +21 -0
- package/packages/channels/package.json +6 -1
- package/packages/channels/slack/dist/.tsbuildinfo +1 -1
- package/packages/channels/slack/dist/slack.test.js +6 -7
- package/packages/channels/slack/dist/slack.test.js.map +1 -1
- package/packages/channels/telegram/dist/.tsbuildinfo +1 -1
- package/packages/channels/telegram/dist/cli.test.js.map +1 -1
- package/packages/channels/telegram/dist/telegram.test.js +6 -7
- package/packages/channels/telegram/dist/telegram.test.js.map +1 -1
- package/packages/cli/dist/.tsbuildinfo +1 -1
- package/packages/cli/dist/channel-handlers.js +115 -66
- package/packages/cli/dist/deps.js +106 -71
- package/packages/cli/dist/index.js +100 -9
- package/packages/cli/dist/program.js +119 -151
- package/packages/cli/dist/test-helpers.js +104 -87
- package/packages/cli/dist/types.js +0 -2
- package/packages/daemon/dist/.tsbuildinfo +1 -1
- package/packages/daemon/dist/runner.d.ts.map +1 -1
- package/packages/daemon/dist/runner.js +15 -1
- package/packages/daemon/dist/runner.js.map +1 -1
- package/packages/daemon/dist/runtime.d.ts +6 -2
- package/packages/daemon/dist/runtime.d.ts.map +1 -1
- package/packages/daemon/dist/runtime.js +2 -2
- package/packages/daemon/dist/runtime.js.map +1 -1
- package/packages/daemon/dist/wake-cycle.d.ts +1 -0
- package/packages/daemon/dist/wake-cycle.d.ts.map +1 -1
- package/packages/daemon/dist/wake-cycle.js +7 -0
- package/packages/daemon/dist/wake-cycle.js.map +1 -1
- package/packages/daemon/package.json +1 -0
- package/packages/identity/dist/.tsbuildinfo +1 -1
- package/packages/identity/dist/defaults.d.ts.map +1 -1
- package/packages/identity/dist/defaults.js +13 -0
- package/packages/identity/dist/defaults.js.map +1 -1
- package/packages/identity/dist/types.d.ts +7 -0
- package/packages/identity/dist/types.d.ts.map +1 -1
- package/packages/identity/test/storage.test.mjs +10 -0
- package/packages/memory/dist/.tsbuildinfo +1 -1
- package/packages/memory/dist/embedding.d.ts +11 -1
- package/packages/memory/dist/embedding.d.ts.map +1 -1
- package/packages/memory/dist/embedding.js +44 -15
- package/packages/memory/dist/embedding.js.map +1 -1
- package/packages/memory/dist/memory-store.d.ts +3 -0
- package/packages/memory/dist/memory-store.d.ts.map +1 -1
- package/packages/memory/dist/memory-store.js +58 -18
- package/packages/memory/dist/memory-store.js.map +1 -1
- package/packages/memory/dist/sqlite.js.map +1 -1
- package/packages/memory/package.json +3 -0
- package/packages/skills/dist/.tsbuildinfo +1 -1
- package/skills/install-va-claw.md +12 -0
|
@@ -1,82 +1,117 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { createInterface } from "node:readline/promises";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_CONFIG_PATH,
|
|
6
|
+
getDaemonStatus,
|
|
7
|
+
installDaemonService,
|
|
8
|
+
loadIdentity,
|
|
9
|
+
runInstallWizard,
|
|
10
|
+
saveIdentity,
|
|
11
|
+
startDaemon,
|
|
12
|
+
stopDaemon,
|
|
13
|
+
toClaudeMdSnippet,
|
|
14
|
+
toCodexSystemPrompt,
|
|
15
|
+
uninstallDaemonService
|
|
16
|
+
} from "./deps-exports.js";
|
|
17
|
+
import {
|
|
18
|
+
clear,
|
|
19
|
+
consolidate,
|
|
20
|
+
count,
|
|
21
|
+
get,
|
|
22
|
+
list,
|
|
23
|
+
memorize,
|
|
24
|
+
recall,
|
|
25
|
+
reflect,
|
|
26
|
+
search,
|
|
27
|
+
update,
|
|
28
|
+
forget
|
|
29
|
+
} from "@va-claw/memory";
|
|
6
30
|
import { installSkill, listSkills, loadSkill, removeSkill } from "../../skills/dist/index.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
31
|
+
import {
|
|
32
|
+
fileExists,
|
|
33
|
+
resolveClaudeMdPath,
|
|
34
|
+
resolveCodexInstructionsPath,
|
|
35
|
+
resolveClawRegistryPath,
|
|
36
|
+
resolveMemoryDbPath,
|
|
37
|
+
upsertManagedBlock,
|
|
38
|
+
removeManagedBlock,
|
|
39
|
+
wrapCodexPrompt
|
|
40
|
+
} from "./install-files.js";
|
|
41
|
+
function createDefaultCliDeps() {
|
|
42
|
+
return {
|
|
43
|
+
claudePath: resolveClaudeMdPath(),
|
|
44
|
+
codexPath: resolveCodexInstructionsPath(),
|
|
45
|
+
configPath: DEFAULT_CONFIG_PATH,
|
|
46
|
+
memoryDbPath: resolveMemoryDbPath(),
|
|
47
|
+
clawRegistryPath: resolveClawRegistryPath(),
|
|
48
|
+
platform: process.platform,
|
|
49
|
+
spawnSync,
|
|
50
|
+
stdout: process.stdout,
|
|
51
|
+
stderr: process.stderr,
|
|
52
|
+
fileExists,
|
|
53
|
+
readTextFile: (path) => readFile(path, "utf8"),
|
|
54
|
+
upsertManagedBlock,
|
|
55
|
+
removeManagedBlock,
|
|
56
|
+
wrapCodexPrompt,
|
|
57
|
+
loadIdentity: () => loadIdentity(),
|
|
58
|
+
saveIdentity: (config) => saveIdentity(config),
|
|
59
|
+
runInstallWizard,
|
|
60
|
+
toClaudeMdSnippet,
|
|
61
|
+
toCodexSystemPrompt,
|
|
62
|
+
installDaemonService,
|
|
63
|
+
uninstallDaemonService,
|
|
64
|
+
startDaemon,
|
|
65
|
+
stopDaemon,
|
|
66
|
+
getDaemonStatus,
|
|
67
|
+
memoryMemorize: (key, essence, options) => memorize(key, essence, options),
|
|
68
|
+
memoryGet: (key) => get(key),
|
|
69
|
+
memoryUpdate: (key, changes) => update(key, changes),
|
|
70
|
+
memoryForget: (key) => forget(key),
|
|
71
|
+
memoryRecall: (query, limit) => recall(query, limit),
|
|
72
|
+
memoryConsolidate: () => consolidate(),
|
|
73
|
+
memoryReflect: () => reflect(),
|
|
74
|
+
memoryCount: () => count(),
|
|
75
|
+
memorySearch: (query, limit) => search(query, limit),
|
|
76
|
+
memoryList: (limit) => list(limit),
|
|
77
|
+
memoryClear: () => clear(),
|
|
78
|
+
startTelegramChannel: (config) => loadChannelsModule().then((module) => module.startTelegramChannel(config)),
|
|
79
|
+
stopTelegramChannel: (channel) => loadChannelsModule().then((module) => module.stopTelegramChannel(channel)),
|
|
80
|
+
startLarkChannel: (config) => loadChannelsModule().then((module) => module.startLarkChannel(config)),
|
|
81
|
+
stopLarkChannel: (channel) => loadChannelsModule().then((module) => module.stopLarkChannel(channel)),
|
|
82
|
+
startSlackChannel: (config) => loadChannelsModule().then((module) => module.startSlackChannel(config)),
|
|
83
|
+
stopSlackChannel: (channel) => loadChannelsModule().then((module) => module.stopSlackChannel(channel)),
|
|
84
|
+
skillInstall: (content, name) => installSkill(content, name),
|
|
85
|
+
skillList: (dir) => listSkills(dir),
|
|
86
|
+
skillLoad: (nameOrPath) => loadSkill(nameOrPath),
|
|
87
|
+
skillRemove: (name) => removeSkill(name),
|
|
88
|
+
confirm: (message) => askForConfirmation(message),
|
|
89
|
+
prompt: (message, initialValue) => askForValue(message, initialValue)
|
|
90
|
+
};
|
|
56
91
|
}
|
|
57
92
|
async function askForConfirmation(message) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
93
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
94
|
+
try {
|
|
95
|
+
const value = await rl.question(`${message} [y/N] `);
|
|
96
|
+
return ["y", "yes"].includes(value.trim().toLowerCase());
|
|
97
|
+
} finally {
|
|
98
|
+
rl.close();
|
|
99
|
+
}
|
|
66
100
|
}
|
|
67
101
|
async function askForValue(message, initialValue = "") {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
102
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
103
|
+
const suffix = initialValue.trim() === "" ? "" : ` [${initialValue}]`;
|
|
104
|
+
try {
|
|
105
|
+
const value = await rl.question(`${message}${suffix} `);
|
|
106
|
+
return value.trim() === "" ? initialValue : value.trim();
|
|
107
|
+
} finally {
|
|
108
|
+
rl.close();
|
|
109
|
+
}
|
|
77
110
|
}
|
|
78
111
|
async function loadChannelsModule() {
|
|
79
|
-
|
|
80
|
-
|
|
112
|
+
const moduleUrl = new URL("../../channels/dist/index.js", import.meta.url);
|
|
113
|
+
return import(moduleUrl.href);
|
|
81
114
|
}
|
|
82
|
-
|
|
115
|
+
export {
|
|
116
|
+
createDefaultCliDeps
|
|
117
|
+
};
|
|
@@ -1,9 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { createDefaultCliDeps } from "./deps.js";
|
|
2
|
+
import {
|
|
3
|
+
runLarkChannelSetup,
|
|
4
|
+
runLarkChannelStart,
|
|
5
|
+
runLarkChannelStatus,
|
|
6
|
+
runSlackChannelSetup,
|
|
7
|
+
runSlackChannelStart,
|
|
8
|
+
runSlackChannelStatus,
|
|
9
|
+
runTelegramChannelSetup,
|
|
10
|
+
runTelegramChannelStart,
|
|
11
|
+
runTelegramChannelStatus
|
|
12
|
+
} from "./channel-handlers.js";
|
|
13
|
+
import {
|
|
14
|
+
runInstall,
|
|
15
|
+
runMemoryClear,
|
|
16
|
+
runMemoryList,
|
|
17
|
+
runMemorySearch,
|
|
18
|
+
runClawAdd,
|
|
19
|
+
runClawHeartbeat,
|
|
20
|
+
runClawList,
|
|
21
|
+
runClawRemove,
|
|
22
|
+
runClawStatus,
|
|
23
|
+
runClawUpdate,
|
|
24
|
+
runProtocol,
|
|
25
|
+
runSkillAdd,
|
|
26
|
+
runSkillList,
|
|
27
|
+
runSkillRemove,
|
|
28
|
+
runSkillShow,
|
|
29
|
+
runStart,
|
|
30
|
+
runStatus,
|
|
31
|
+
runStop,
|
|
32
|
+
runUninstall
|
|
33
|
+
} from "./handlers.js";
|
|
34
|
+
import {
|
|
35
|
+
CODEX_MARKERS,
|
|
36
|
+
CLAUDE_MARKERS,
|
|
37
|
+
fileExists,
|
|
38
|
+
resolveClawRegistryPath,
|
|
39
|
+
resolveClaudeMdPath,
|
|
40
|
+
resolveCodexInstructionsPath,
|
|
41
|
+
resolveMemoryDbPath,
|
|
42
|
+
removeManagedBlock,
|
|
43
|
+
upsertManagedBlock,
|
|
44
|
+
wrapCodexPrompt
|
|
45
|
+
} from "./install-files.js";
|
|
46
|
+
import { countMemoryEntries, findLastWakeAt } from "./memory-status.js";
|
|
47
|
+
import { formatMemoryEntries, formatSkills, writeLine } from "./output.js";
|
|
48
|
+
import { detectServiceType, probeServiceRunning, stopInstalledService } from "./platform.js";
|
|
49
|
+
import { createCliProgram, runCli } from "./program.js";
|
|
50
|
+
export {
|
|
51
|
+
CLAUDE_MARKERS,
|
|
52
|
+
CODEX_MARKERS,
|
|
53
|
+
countMemoryEntries,
|
|
54
|
+
createCliProgram,
|
|
55
|
+
createDefaultCliDeps,
|
|
56
|
+
detectServiceType,
|
|
57
|
+
fileExists,
|
|
58
|
+
findLastWakeAt,
|
|
59
|
+
formatMemoryEntries,
|
|
60
|
+
formatSkills,
|
|
61
|
+
probeServiceRunning,
|
|
62
|
+
removeManagedBlock,
|
|
63
|
+
resolveClaudeMdPath,
|
|
64
|
+
resolveClawRegistryPath,
|
|
65
|
+
resolveCodexInstructionsPath,
|
|
66
|
+
resolveMemoryDbPath,
|
|
67
|
+
runClawAdd,
|
|
68
|
+
runClawHeartbeat,
|
|
69
|
+
runClawList,
|
|
70
|
+
runClawRemove,
|
|
71
|
+
runClawStatus,
|
|
72
|
+
runClawUpdate,
|
|
73
|
+
runCli,
|
|
74
|
+
runInstall,
|
|
75
|
+
runLarkChannelSetup,
|
|
76
|
+
runLarkChannelStart,
|
|
77
|
+
runLarkChannelStatus,
|
|
78
|
+
runMemoryClear,
|
|
79
|
+
runMemoryList,
|
|
80
|
+
runMemorySearch,
|
|
81
|
+
runProtocol,
|
|
82
|
+
runSkillAdd,
|
|
83
|
+
runSkillList,
|
|
84
|
+
runSkillRemove,
|
|
85
|
+
runSkillShow,
|
|
86
|
+
runSlackChannelSetup,
|
|
87
|
+
runSlackChannelStart,
|
|
88
|
+
runSlackChannelStatus,
|
|
89
|
+
runStart,
|
|
90
|
+
runStatus,
|
|
91
|
+
runStop,
|
|
92
|
+
runTelegramChannelSetup,
|
|
93
|
+
runTelegramChannelStart,
|
|
94
|
+
runTelegramChannelStatus,
|
|
95
|
+
runUninstall,
|
|
96
|
+
stopInstalledService,
|
|
97
|
+
upsertManagedBlock,
|
|
98
|
+
wrapCodexPrompt,
|
|
99
|
+
writeLine
|
|
100
|
+
};
|
|
@@ -1,155 +1,123 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { createDefaultCliDeps } from "./deps.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const claw = program.command("claw").description("Long-running claw operations.");
|
|
109
|
-
claw.command("status").description("Show claw status and daemon summary.").action(async () => runClawStatus(deps));
|
|
110
|
-
claw.command("list").description("List all registered claws.").action(async () => runClawList(deps));
|
|
111
|
-
claw
|
|
112
|
-
.command("add")
|
|
113
|
-
.description("Register a long-running claw.")
|
|
114
|
-
.argument("<name>")
|
|
115
|
-
.option("--goal <goal>", "Describe what this claw is responsible for.")
|
|
116
|
-
.option("--status <status>", "running | working | idle | waiting | error | offline | stopped.")
|
|
117
|
-
.option("--cli-command <command>", "Command to execute this claw's actions (default: va-claw).")
|
|
118
|
-
.option("--note <note>", "Single-line note for this claw.")
|
|
119
|
-
.option("--tags <tags>", "Comma-separated tags.")
|
|
120
|
-
.action((name, options) => runClawAdd(name, options, deps));
|
|
121
|
-
claw
|
|
122
|
-
.command("set")
|
|
123
|
-
.description("Update a claw's state.")
|
|
124
|
-
.argument("<name>")
|
|
125
|
-
.option("--goal <goal>", "New goal for this claw.")
|
|
126
|
-
.option("--status <status>", "running | working | idle | waiting | error | offline | stopped.")
|
|
127
|
-
.option("--cli-command <command>", "Update command used for this claw.")
|
|
128
|
-
.option("--note <note>", "Update note.")
|
|
129
|
-
.option("--tags <tags>", "Replace tags, comma-separated.")
|
|
130
|
-
.option("--seen", "Mark claw as alive now.")
|
|
131
|
-
.action((name, options) => runClawUpdate(name, { ...options, seen: options.seen ? "true" : undefined }, deps));
|
|
132
|
-
claw
|
|
133
|
-
.command("heartbeat")
|
|
134
|
-
.description("Mark a claw as active and update lastSeenAt.")
|
|
135
|
-
.argument("<name>")
|
|
136
|
-
.action((name) => runClawHeartbeat(name, deps));
|
|
137
|
-
claw
|
|
138
|
-
.command("remove")
|
|
139
|
-
.description("Unregister a claw.")
|
|
140
|
-
.argument("<name>")
|
|
141
|
-
.action((name) => runClawRemove(name, deps));
|
|
142
|
-
return program;
|
|
3
|
+
import {
|
|
4
|
+
runInstall,
|
|
5
|
+
runDiscordSetup,
|
|
6
|
+
runDiscordStart,
|
|
7
|
+
runDiscordStatus,
|
|
8
|
+
runMemoryClear,
|
|
9
|
+
runMemoryConsolidate,
|
|
10
|
+
runMemoryList,
|
|
11
|
+
runMemoryReflect,
|
|
12
|
+
runMemoryGet,
|
|
13
|
+
runMemoryForget,
|
|
14
|
+
runMemorySearch,
|
|
15
|
+
runMemoryMemorize,
|
|
16
|
+
runMemoryRecall,
|
|
17
|
+
runMemoryUpdate,
|
|
18
|
+
runProtocol,
|
|
19
|
+
runSkillAdd,
|
|
20
|
+
runSkillList,
|
|
21
|
+
runSkillRemove,
|
|
22
|
+
runSkillShow,
|
|
23
|
+
runStart,
|
|
24
|
+
runClawAdd,
|
|
25
|
+
runClawHeartbeat,
|
|
26
|
+
runClawList,
|
|
27
|
+
runClawRemove,
|
|
28
|
+
runClawStatus,
|
|
29
|
+
runClawUpdate,
|
|
30
|
+
runStatus,
|
|
31
|
+
runStop,
|
|
32
|
+
runUninstall
|
|
33
|
+
} from "./handlers.js";
|
|
34
|
+
import {
|
|
35
|
+
runLarkChannelSetup as runLarkSetup,
|
|
36
|
+
runLarkChannelStart as runLarkStart,
|
|
37
|
+
runLarkChannelStatus as runLarkStatus,
|
|
38
|
+
runSlackChannelSetup as runSlackSetup,
|
|
39
|
+
runSlackChannelStart as runSlackStart,
|
|
40
|
+
runSlackChannelStatus as runSlackStatus,
|
|
41
|
+
runTelegramChannelSetup as runTelegramSetup,
|
|
42
|
+
runTelegramChannelStart as runTelegramStart,
|
|
43
|
+
runTelegramChannelStatus as runTelegramStatus
|
|
44
|
+
} from "./channel-handlers.js";
|
|
45
|
+
function createCliProgram(deps = createDefaultCliDeps()) {
|
|
46
|
+
const program = new Command("va-claw");
|
|
47
|
+
program.description("va-claw CLI");
|
|
48
|
+
program.showHelpAfterError();
|
|
49
|
+
program.command("install").description("Install va-claw config, prompt injections, and daemon service.").option("--for <target>", "claude-code | codex | all", "all").action(async (options) => runInstall(options.for ?? "all", deps));
|
|
50
|
+
program.command("start").description("Start the daemon in the foreground.").action(async () => runStart(deps));
|
|
51
|
+
program.command("stop").description("Stop the daemon.").action(async () => runStop(deps));
|
|
52
|
+
program.command("status").description("Show daemon and memory status.").action(async () => runStatus(deps));
|
|
53
|
+
program.command("uninstall").description("Remove daemon service and injected prompts.").action(async () => runUninstall(deps));
|
|
54
|
+
program.command("protocol").description("Emit a machine-readable protocol summary for agent-facing integrations.").option("--text", "Print a human-readable protocol summary instead of JSON.").action(async (options) => runProtocol(deps, Boolean(options.text)));
|
|
55
|
+
const memory = program.command("memory").description("Memory operations.");
|
|
56
|
+
memory.command("search").description("Search memory.").argument("<query>").action(async (query) => runMemorySearch(query, deps));
|
|
57
|
+
memory.command("memorize").description("Store or update a memory entry by key.").argument("<key>").argument("<essence>").option("--tags <tags>", "Comma-separated tags.").option("--details <details>", "Details text.").option("--importance <importance>", "Importance from 0 to 1.").action(
|
|
58
|
+
(key, essence, options) => runMemoryMemorize(key, essence, options, deps)
|
|
59
|
+
);
|
|
60
|
+
memory.command("get").description("Get a memory entry by key.").argument("<key>").action(async (key) => runMemoryGet(key, deps));
|
|
61
|
+
memory.command("update").description("Update a memory entry by key.").argument("<key>").option("--essence <essence>", "Replace essence text.").option("--tags <tags>", "Comma-separated tags.").option("--importance <importance>", "Importance from 0 to 1.").option("--details <details>", "Replace details text.").action(
|
|
62
|
+
(key, options) => runMemoryUpdate(key, options, deps)
|
|
63
|
+
);
|
|
64
|
+
memory.command("list").description("List recent memory entries.").action(async () => runMemoryList(deps));
|
|
65
|
+
memory.command("forget").description("Forget a memory by key.").argument("<key>").action(async (key) => runMemoryForget(key, deps));
|
|
66
|
+
memory.command("recall").description("Recall memories by query.").argument("<query>").option("--limit <limit>", "Max results.").action(
|
|
67
|
+
(query, options) => runMemoryRecall(query, options.limit ? Number(options.limit) : 5, deps)
|
|
68
|
+
);
|
|
69
|
+
memory.command("consolidate").description("Consolidate memory store.").action(async () => runMemoryConsolidate(deps));
|
|
70
|
+
memory.command("reflect").description("Reflect memory map grouped by tags.").action(async () => runMemoryReflect(deps));
|
|
71
|
+
memory.command("clear").description("Clear all memory entries.").action(async () => runMemoryClear(deps));
|
|
72
|
+
const skill = program.command("skill").description("Skill operations.");
|
|
73
|
+
skill.command("list").description("List installed and project skills.").action(async () => runSkillList(deps));
|
|
74
|
+
skill.command("add").description("Install a skill from a local Markdown file or URL.\n\nTip: vet unknown skills first \u2014 va-claw skill add https://clawhub.ai/spclaudehome/Skill-vetter").argument("<path-or-url>").action(async (pathOrUrl) => runSkillAdd(pathOrUrl, deps));
|
|
75
|
+
skill.command("remove").description("Remove an installed skill by name.").argument("<name>").action(async (name) => runSkillRemove(name, deps));
|
|
76
|
+
skill.command("show").description("Show the raw Markdown content for a skill.").argument("<name>").action(async (name) => runSkillShow(name, deps));
|
|
77
|
+
const channel = program.command("channel").description("Channel operations.");
|
|
78
|
+
const discord = channel.command("discord").description("Discord channel operations.");
|
|
79
|
+
discord.command("setup").description("Configure Discord bot credentials.").action(async () => runDiscordSetup(deps));
|
|
80
|
+
discord.command("start").description("Start the Discord channel in the foreground.").action(async () => runDiscordStart(deps));
|
|
81
|
+
discord.command("status").description("Show Discord channel status.").action(async () => runDiscordStatus(deps));
|
|
82
|
+
const telegram = channel.command("telegram").description("Telegram channel operations.");
|
|
83
|
+
telegram.command("setup").description("Configure Telegram bot credentials.").option("--token <token>", "Telegram bot token").option("--cli-command <command>", "CLI command to invoke for each message").action(
|
|
84
|
+
async (options) => runTelegramSetup(options.token, options.cliCommand, deps)
|
|
85
|
+
);
|
|
86
|
+
telegram.command("start").description("Start the Telegram channel in the foreground.").action(async () => runTelegramStart(deps));
|
|
87
|
+
telegram.command("status").description("Show Telegram channel status.").action(async () => runTelegramStatus(deps));
|
|
88
|
+
const lark = channel.command("lark").description("Lark (Feishu) channel operations.");
|
|
89
|
+
lark.command("setup").description("Configure Lark (Feishu) bot credentials.").option("--app-id <id>", "Lark app ID").option("--app-secret <secret>", "Lark app secret").option("--cli-command <command>", "CLI command to invoke for each message").action(
|
|
90
|
+
async (options) => runLarkSetup(options.appId, options.appSecret, options.cliCommand, deps)
|
|
91
|
+
);
|
|
92
|
+
lark.command("start").description("Start the Lark channel in the foreground.").action(async () => runLarkStart(deps));
|
|
93
|
+
lark.command("status").description("Show Lark channel status.").action(async () => runLarkStatus(deps));
|
|
94
|
+
const slack = channel.command("slack").description("Slack channel operations.");
|
|
95
|
+
slack.command("setup").description("Configure Slack bot credentials.").option("--bot-token <token>", "Slack bot token").option("--app-token <token>", "Slack app token").option("--cli-command <command>", "CLI command to invoke for each message").action(
|
|
96
|
+
async (options) => runSlackSetup(options.botToken, options.appToken, options.cliCommand, deps)
|
|
97
|
+
);
|
|
98
|
+
slack.command("start").description("Start the Slack channel in the foreground.").action(async () => runSlackStart(deps));
|
|
99
|
+
slack.command("status").description("Show Slack channel status.").action(async () => runSlackStatus(deps));
|
|
100
|
+
const claw = program.command("claw").description("Long-running claw operations.");
|
|
101
|
+
claw.command("status").description("Show claw status and daemon summary.").action(async () => runClawStatus(deps));
|
|
102
|
+
claw.command("list").description("List all registered claws.").action(async () => runClawList(deps));
|
|
103
|
+
claw.command("add").description("Register a long-running claw.").argument("<name>").option("--goal <goal>", "Describe what this claw is responsible for.").option("--status <status>", "running | working | idle | waiting | error | offline | stopped.").option("--cli-command <command>", "Command to execute this claw's actions (default: va-claw).").option("--note <note>", "Single-line note for this claw.").option("--tags <tags>", "Comma-separated tags.").action((name, options) => runClawAdd(name, options, deps));
|
|
104
|
+
claw.command("set").description("Update a claw's state.").argument("<name>").option("--goal <goal>", "New goal for this claw.").option("--status <status>", "running | working | idle | waiting | error | offline | stopped.").option("--cli-command <command>", "Update command used for this claw.").option("--note <note>", "Update note.").option("--tags <tags>", "Replace tags, comma-separated.").option("--seen", "Mark claw as alive now.").action((name, options) => runClawUpdate(name, { ...options, seen: options.seen ? "true" : void 0 }, deps));
|
|
105
|
+
claw.command("heartbeat").description("Mark a claw as active and update lastSeenAt.").argument("<name>").action((name) => runClawHeartbeat(name, deps));
|
|
106
|
+
claw.command("remove").description("Unregister a claw.").argument("<name>").action((name) => runClawRemove(name, deps));
|
|
107
|
+
return program;
|
|
143
108
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
109
|
+
async function runCli(argv = process.argv, deps) {
|
|
110
|
+
const program = createCliProgram(deps ?? createDefaultCliDeps());
|
|
111
|
+
try {
|
|
112
|
+
await program.parseAsync(argv);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
115
|
+
(deps ?? createDefaultCliDeps()).stderr.write(`${message}
|
|
116
|
+
`);
|
|
117
|
+
process.exitCode = 1;
|
|
118
|
+
}
|
|
154
119
|
}
|
|
155
|
-
|
|
120
|
+
export {
|
|
121
|
+
createCliProgram,
|
|
122
|
+
runCli
|
|
123
|
+
};
|