nextclaw 0.1.0 → 0.2.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/bridge/src/brand.ts +7 -0
- package/bridge/src/index.ts +4 -18
- package/bridge/src/whatsapp.ts +2 -1
- package/dist/chunk-X77K7Y4T.js +2316 -0
- package/dist/cli/index.js +40 -15
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
APP_NAME,
|
|
4
|
+
APP_REPLY_SUBJECT,
|
|
5
|
+
APP_TAGLINE,
|
|
6
|
+
APP_TITLE,
|
|
3
7
|
AgentLoop,
|
|
4
8
|
ConfigSchema,
|
|
5
9
|
LiteLLMProvider,
|
|
@@ -14,7 +18,7 @@ import {
|
|
|
14
18
|
getWorkspacePath,
|
|
15
19
|
loadConfig,
|
|
16
20
|
saveConfig
|
|
17
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-X77K7Y4T.js";
|
|
18
22
|
|
|
19
23
|
// src/cli/index.ts
|
|
20
24
|
import { Command } from "commander";
|
|
@@ -205,14 +209,20 @@ var TelegramChannel = class extends BaseChannel {
|
|
|
205
209
|
this.bot.onText(/^\/start$/, async (msg) => {
|
|
206
210
|
await this.bot?.sendMessage(
|
|
207
211
|
msg.chat.id,
|
|
208
|
-
`\u{1F44B} Hi ${msg.from?.first_name ?? ""}! I'm
|
|
212
|
+
`\u{1F44B} Hi ${msg.from?.first_name ?? ""}! I'm ${APP_NAME}.
|
|
209
213
|
|
|
210
214
|
Send me a message and I'll respond!
|
|
211
215
|
Type /help to see available commands.`
|
|
212
216
|
);
|
|
213
217
|
});
|
|
214
218
|
this.bot.onText(/^\/help$/, async (msg) => {
|
|
215
|
-
const helpText =
|
|
219
|
+
const helpText = `\u{1F916} <b>${APP_NAME} commands</b>
|
|
220
|
+
|
|
221
|
+
/start \u2014 Start the bot
|
|
222
|
+
/reset \u2014 Reset conversation history
|
|
223
|
+
/help \u2014 Show this help message
|
|
224
|
+
|
|
225
|
+
Just send me a text message to chat!`;
|
|
216
226
|
await this.bot?.sendMessage(msg.chat.id, helpText, { parse_mode: "HTML" });
|
|
217
227
|
});
|
|
218
228
|
this.bot.onText(/^\/reset$/, async (msg) => {
|
|
@@ -1844,7 +1854,7 @@ var DingTalkChannel = class extends BaseChannel {
|
|
|
1844
1854
|
msgKey: "sampleMarkdown",
|
|
1845
1855
|
msgParam: JSON.stringify({
|
|
1846
1856
|
text: msg.content,
|
|
1847
|
-
title:
|
|
1857
|
+
title: `${APP_TITLE} Reply`
|
|
1848
1858
|
})
|
|
1849
1859
|
};
|
|
1850
1860
|
const response = await fetch4(url, {
|
|
@@ -1985,7 +1995,7 @@ var EmailChannel = class extends BaseChannel {
|
|
|
1985
1995
|
if (!toAddr) {
|
|
1986
1996
|
return;
|
|
1987
1997
|
}
|
|
1988
|
-
const baseSubject = this.lastSubjectByChat.get(toAddr) ??
|
|
1998
|
+
const baseSubject = this.lastSubjectByChat.get(toAddr) ?? APP_REPLY_SUBJECT;
|
|
1989
1999
|
const subject = msg.metadata?.subject?.trim() || this.replySubject(baseSubject);
|
|
1990
2000
|
const transporter = nodemailer.createTransport({
|
|
1991
2001
|
host: this.config.smtpHost,
|
|
@@ -2761,8 +2771,8 @@ var LOGO = "\u{1F916}";
|
|
|
2761
2771
|
var EXIT_COMMANDS = /* @__PURE__ */ new Set(["exit", "quit", "/exit", "/quit", ":q"]);
|
|
2762
2772
|
var VERSION = getPackageVersion();
|
|
2763
2773
|
var program = new Command();
|
|
2764
|
-
program.name(
|
|
2765
|
-
program.command("onboard").description(
|
|
2774
|
+
program.name(APP_NAME).description(`${LOGO} ${APP_NAME} - ${APP_TAGLINE}`).version(VERSION, "-v, --version", "show version");
|
|
2775
|
+
program.command("onboard").description(`Initialize ${APP_NAME} configuration and workspace`).action(() => {
|
|
2766
2776
|
const configPath = getConfigPath();
|
|
2767
2777
|
if (existsSync5(configPath)) {
|
|
2768
2778
|
console.log(`Config already exists at ${configPath}`);
|
|
@@ -2774,12 +2784,12 @@ program.command("onboard").description("Initialize nextclaw configuration and wo
|
|
|
2774
2784
|
console.log(`\u2713 Created workspace at ${workspace}`);
|
|
2775
2785
|
createWorkspaceTemplates(workspace);
|
|
2776
2786
|
console.log(`
|
|
2777
|
-
${LOGO}
|
|
2787
|
+
${LOGO} ${APP_NAME} is ready!`);
|
|
2778
2788
|
console.log("\nNext steps:");
|
|
2779
2789
|
console.log(` 1. Add your API key to ${configPath}`);
|
|
2780
|
-
console.log(
|
|
2790
|
+
console.log(` 2. Chat: ${APP_NAME} agent -m "Hello!"`);
|
|
2781
2791
|
});
|
|
2782
|
-
program.command("gateway").description(
|
|
2792
|
+
program.command("gateway").description(`Start the ${APP_NAME} gateway`).option("-p, --port <port>", "Gateway port", "18790").option("-v, --verbose", "Verbose output", false).action(async (_opts) => {
|
|
2783
2793
|
const config = loadConfig();
|
|
2784
2794
|
const bus = new MessageBus();
|
|
2785
2795
|
const provider = makeProvider(config);
|
|
@@ -2979,11 +2989,11 @@ cron.command("run <jobId>").option("-f, --force", "Run even if disabled").action
|
|
|
2979
2989
|
const ok = await service.runJob(jobId, Boolean(opts.force));
|
|
2980
2990
|
console.log(ok ? "\u2713 Job executed" : `Failed to run job ${jobId}`);
|
|
2981
2991
|
});
|
|
2982
|
-
program.command("status").description(
|
|
2992
|
+
program.command("status").description(`Show ${APP_NAME} status`).action(() => {
|
|
2983
2993
|
const configPath = getConfigPath();
|
|
2984
2994
|
const config = loadConfig();
|
|
2985
2995
|
const workspace = getWorkspacePath(config.agents.defaults.workspace);
|
|
2986
|
-
console.log(`${LOGO}
|
|
2996
|
+
console.log(`${LOGO} ${APP_NAME} Status
|
|
2987
2997
|
`);
|
|
2988
2998
|
console.log(`Config: ${configPath} ${existsSync5(configPath) ? "\u2713" : "\u2717"}`);
|
|
2989
2999
|
console.log(`Workspace: ${workspace} ${existsSync5(workspace) ? "\u2713" : "\u2717"}`);
|
|
@@ -3006,7 +3016,7 @@ function makeProvider(config) {
|
|
|
3006
3016
|
const model = config.agents.defaults.model;
|
|
3007
3017
|
if (!provider?.apiKey && !model.startsWith("bedrock/")) {
|
|
3008
3018
|
console.error("Error: No API key configured.");
|
|
3009
|
-
console.error(
|
|
3019
|
+
console.error(`Set one in ${getConfigPath()} under providers section`);
|
|
3010
3020
|
process.exit(1);
|
|
3011
3021
|
}
|
|
3012
3022
|
return new LiteLLMProvider({
|
|
@@ -3020,7 +3030,22 @@ function makeProvider(config) {
|
|
|
3020
3030
|
function createWorkspaceTemplates(workspace) {
|
|
3021
3031
|
const templates = {
|
|
3022
3032
|
"AGENTS.md": "# Agent Instructions\n\nYou are a helpful AI assistant. Be concise, accurate, and friendly.\n\n## Guidelines\n\n- Always explain what you're doing before taking actions\n- Ask for clarification when the request is ambiguous\n- Use tools to help accomplish tasks\n- Remember important information in your memory files\n",
|
|
3023
|
-
"SOUL.md":
|
|
3033
|
+
"SOUL.md": `# Soul
|
|
3034
|
+
|
|
3035
|
+
I am ${APP_NAME}, a lightweight AI assistant.
|
|
3036
|
+
|
|
3037
|
+
## Personality
|
|
3038
|
+
|
|
3039
|
+
- Helpful and friendly
|
|
3040
|
+
- Concise and to the point
|
|
3041
|
+
- Curious and eager to learn
|
|
3042
|
+
|
|
3043
|
+
## Values
|
|
3044
|
+
|
|
3045
|
+
- Accuracy over speed
|
|
3046
|
+
- User privacy and safety
|
|
3047
|
+
- Transparency in actions
|
|
3048
|
+
`,
|
|
3024
3049
|
"USER.md": "# User\n\nInformation about the user goes here.\n\n## Preferences\n\n- Communication style: (casual/formal)\n- Timezone: (your timezone)\n- Language: (your preferred language)\n"
|
|
3025
3050
|
};
|
|
3026
3051
|
for (const [filename, content] of Object.entries(templates)) {
|
|
@@ -3071,7 +3096,7 @@ function getBridgeDir() {
|
|
|
3071
3096
|
source = srcBridge;
|
|
3072
3097
|
}
|
|
3073
3098
|
if (!source) {
|
|
3074
|
-
console.error(
|
|
3099
|
+
console.error(`Bridge source not found. Try reinstalling ${APP_NAME}.`);
|
|
3075
3100
|
process.exit(1);
|
|
3076
3101
|
}
|
|
3077
3102
|
console.log(`${LOGO} Setting up bridge...`);
|
package/dist/index.js
CHANGED