pablo-openclaw-tensparrows 0.1.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/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +90 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +231 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +99 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/log.d.ts +7 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +8 -0
- package/dist/log.js.map +1 -0
- package/dist/openclaw-config.d.ts +5 -0
- package/dist/openclaw-config.d.ts.map +1 -0
- package/dist/openclaw-config.js +134 -0
- package/dist/openclaw-config.js.map +1 -0
- package/dist/setup.d.ts +10 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +92 -0
- package/dist/setup.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +44 -0
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command, Option } from "commander";
|
|
3
|
+
import { decodeConfigB64, buildPresetFromFlags, } from "./config.js";
|
|
4
|
+
import { buildOpenclawConfig, redactConfig } from "./openclaw-config.js";
|
|
5
|
+
import { runSetup } from "./setup.js";
|
|
6
|
+
import { VERSION } from "./version.js";
|
|
7
|
+
import { log } from "./log.js";
|
|
8
|
+
const program = new Command();
|
|
9
|
+
program
|
|
10
|
+
.name("pablo-openclaw")
|
|
11
|
+
.description("Headless OpenClaw installer — applies a preset and brings up the gateway.")
|
|
12
|
+
.version(VERSION);
|
|
13
|
+
// Shared input flags. Either --config-b64 (dashboard path) or the individual
|
|
14
|
+
// flag set (human/script path) must produce a complete preset.
|
|
15
|
+
function addPresetFlags(cmd) {
|
|
16
|
+
return cmd
|
|
17
|
+
.option("--config-b64 <b64>", "base64-encoded JSON preset (pablo-compatible). Mutually exclusive with the individual --provider/--tg-* flags.")
|
|
18
|
+
.addOption(new Option("--provider <type>", "LLM provider (alternative to --config-b64)").choices(["anthropic", "openai", "openrouter"]))
|
|
19
|
+
.option("--api-key <key>", "provider API key. Falls back to $ANTHROPIC_API_KEY / $OPENAI_API_KEY / $OPENROUTER_API_KEY.")
|
|
20
|
+
.option("--model <model>", "model id (optional; provider-specific default applied)")
|
|
21
|
+
.option("--tg-bot-token <token>", "Telegram bot token (from BotFather). Falls back to $TELEGRAM_BOT_TOKEN.")
|
|
22
|
+
.option("--tg-allow <id>", "allowed Telegram user ID. Repeatable; comma-separated values also accepted.", collectId, [])
|
|
23
|
+
.option("--agent-name <name>", "agent name", "Pablo")
|
|
24
|
+
.option("--system-prompt <prompt>", "agent system prompt", "You are Pablo, a helpful personal assistant.");
|
|
25
|
+
}
|
|
26
|
+
function collectId(value, prev) {
|
|
27
|
+
return [...prev, value];
|
|
28
|
+
}
|
|
29
|
+
// Resolve a PresetConfig from whichever input path the user used. Errors are
|
|
30
|
+
// thrown so the action handler can format them uniformly.
|
|
31
|
+
function resolvePreset(opts) {
|
|
32
|
+
const usedFlags = !!opts.provider ||
|
|
33
|
+
!!opts.apiKey ||
|
|
34
|
+
!!opts.tgBotToken ||
|
|
35
|
+
(opts.tgAllow?.length ?? 0) > 0;
|
|
36
|
+
if (opts.configB64 && usedFlags) {
|
|
37
|
+
throw new Error("pick one input path: --config-b64 OR the individual --provider/--tg-* flags, not both");
|
|
38
|
+
}
|
|
39
|
+
if (opts.configB64) {
|
|
40
|
+
return decodeConfigB64(opts.configB64);
|
|
41
|
+
}
|
|
42
|
+
if (!usedFlags) {
|
|
43
|
+
throw new Error("no input provided. Either pass --config-b64 <base64> or the flag set " +
|
|
44
|
+
"(--provider, --api-key, --tg-bot-token, --tg-allow). Run with --help for details.");
|
|
45
|
+
}
|
|
46
|
+
return buildPresetFromFlags(opts);
|
|
47
|
+
}
|
|
48
|
+
addPresetFlags(program
|
|
49
|
+
.command("setup")
|
|
50
|
+
.description("Install openclaw (if missing), write ~/.openclaw/openclaw.json from a preset, and start the gateway."))
|
|
51
|
+
.option("--openclaw-version <version>", "openclaw npm version/tag", "latest")
|
|
52
|
+
.option("--no-start", "install + write config but don't start the gateway")
|
|
53
|
+
.option("--reinstall", "force `npm install -g openclaw` even if already on PATH", false)
|
|
54
|
+
.option("--config-path <path>", "override target openclaw.json path (default: ~/.openclaw/openclaw.json)")
|
|
55
|
+
.action(async (opts) => {
|
|
56
|
+
try {
|
|
57
|
+
const preset = resolvePreset(opts);
|
|
58
|
+
await runSetup({
|
|
59
|
+
preset,
|
|
60
|
+
openclawVersion: opts.openclawVersion,
|
|
61
|
+
start: opts.start,
|
|
62
|
+
reinstall: opts.reinstall,
|
|
63
|
+
configPath: opts.configPath,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
log.err(err instanceof Error ? err.message : String(err));
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
addPresetFlags(program
|
|
72
|
+
.command("config:check")
|
|
73
|
+
.description("Resolve a preset (from --config-b64 or the flag set), translate to openclaw.json, " +
|
|
74
|
+
"and print it with secrets redacted."))
|
|
75
|
+
.action((opts) => {
|
|
76
|
+
try {
|
|
77
|
+
const preset = resolvePreset(opts);
|
|
78
|
+
const built = buildOpenclawConfig(preset);
|
|
79
|
+
process.stdout.write(JSON.stringify(redactConfig(built), null, 2) + "\n");
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
log.err(err instanceof Error ? err.message : String(err));
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
program.parseAsync(process.argv).catch((err) => {
|
|
87
|
+
log.err(err instanceof Error ? err.message : String(err));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,oBAAoB,GAGrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,gBAAgB,CAAC;KACtB,WAAW,CAAC,2EAA2E,CAAC;KACxF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,6EAA6E;AAC7E,+DAA+D;AAC/D,SAAS,cAAc,CAAC,GAAY;IAClC,OAAO,GAAG;SACP,MAAM,CACL,oBAAoB,EACpB,gHAAgH,CACjH;SACA,SAAS,CACR,IAAI,MAAM,CACR,mBAAmB,EACnB,4CAA4C,CAC7C,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CACjD;SACA,MAAM,CACL,iBAAiB,EACjB,6FAA6F,CAC9F;SACA,MAAM,CAAC,iBAAiB,EAAE,wDAAwD,CAAC;SACnF,MAAM,CACL,wBAAwB,EACxB,yEAAyE,CAC1E;SACA,MAAM,CACL,iBAAiB,E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AAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC7C,GAAG,CAAC,GAAG,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ProviderConfig: z.ZodObject<{
|
|
3
|
+
type: z.ZodEnum<["anthropic", "openai", "openrouter"]>;
|
|
4
|
+
apiKey: z.ZodString;
|
|
5
|
+
model: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
8
|
+
apiKey: string;
|
|
9
|
+
model?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
12
|
+
apiKey: string;
|
|
13
|
+
model?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const TelegramChannelConfig: z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"telegram">;
|
|
17
|
+
botToken: z.ZodString;
|
|
18
|
+
allowedUserIds: z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString]>, "many">;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
type: "telegram";
|
|
21
|
+
botToken: string;
|
|
22
|
+
allowedUserIds: (string | number)[];
|
|
23
|
+
}, {
|
|
24
|
+
type: "telegram";
|
|
25
|
+
botToken: string;
|
|
26
|
+
allowedUserIds: (string | number)[];
|
|
27
|
+
}>;
|
|
28
|
+
export declare const ChannelConfig: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
29
|
+
type: z.ZodLiteral<"telegram">;
|
|
30
|
+
botToken: z.ZodString;
|
|
31
|
+
allowedUserIds: z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString]>, "many">;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
type: "telegram";
|
|
34
|
+
botToken: string;
|
|
35
|
+
allowedUserIds: (string | number)[];
|
|
36
|
+
}, {
|
|
37
|
+
type: "telegram";
|
|
38
|
+
botToken: string;
|
|
39
|
+
allowedUserIds: (string | number)[];
|
|
40
|
+
}>]>;
|
|
41
|
+
export declare const AgentConfig: z.ZodObject<{
|
|
42
|
+
name: z.ZodDefault<z.ZodString>;
|
|
43
|
+
systemPrompt: z.ZodDefault<z.ZodString>;
|
|
44
|
+
provider: z.ZodObject<{
|
|
45
|
+
type: z.ZodEnum<["anthropic", "openai", "openrouter"]>;
|
|
46
|
+
apiKey: z.ZodString;
|
|
47
|
+
model: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
50
|
+
apiKey: string;
|
|
51
|
+
model?: string | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
54
|
+
apiKey: string;
|
|
55
|
+
model?: string | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
name: string;
|
|
59
|
+
systemPrompt: string;
|
|
60
|
+
provider: {
|
|
61
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
62
|
+
apiKey: string;
|
|
63
|
+
model?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
}, {
|
|
66
|
+
provider: {
|
|
67
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
68
|
+
apiKey: string;
|
|
69
|
+
model?: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
name?: string | undefined;
|
|
72
|
+
systemPrompt?: string | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
export declare const PresetConfig: z.ZodObject<{
|
|
75
|
+
agent: z.ZodObject<{
|
|
76
|
+
name: z.ZodDefault<z.ZodString>;
|
|
77
|
+
systemPrompt: z.ZodDefault<z.ZodString>;
|
|
78
|
+
provider: z.ZodObject<{
|
|
79
|
+
type: z.ZodEnum<["anthropic", "openai", "openrouter"]>;
|
|
80
|
+
apiKey: z.ZodString;
|
|
81
|
+
model: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
84
|
+
apiKey: string;
|
|
85
|
+
model?: string | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
88
|
+
apiKey: string;
|
|
89
|
+
model?: string | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
name: string;
|
|
93
|
+
systemPrompt: string;
|
|
94
|
+
provider: {
|
|
95
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
96
|
+
apiKey: string;
|
|
97
|
+
model?: string | undefined;
|
|
98
|
+
};
|
|
99
|
+
}, {
|
|
100
|
+
provider: {
|
|
101
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
102
|
+
apiKey: string;
|
|
103
|
+
model?: string | undefined;
|
|
104
|
+
};
|
|
105
|
+
name?: string | undefined;
|
|
106
|
+
systemPrompt?: string | undefined;
|
|
107
|
+
}>;
|
|
108
|
+
channels: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"telegram">;
|
|
110
|
+
botToken: z.ZodString;
|
|
111
|
+
allowedUserIds: z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString]>, "many">;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
type: "telegram";
|
|
114
|
+
botToken: string;
|
|
115
|
+
allowedUserIds: (string | number)[];
|
|
116
|
+
}, {
|
|
117
|
+
type: "telegram";
|
|
118
|
+
botToken: string;
|
|
119
|
+
allowedUserIds: (string | number)[];
|
|
120
|
+
}>]>, "many">;
|
|
121
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
122
|
+
agent: z.ZodObject<{
|
|
123
|
+
name: z.ZodDefault<z.ZodString>;
|
|
124
|
+
systemPrompt: z.ZodDefault<z.ZodString>;
|
|
125
|
+
provider: z.ZodObject<{
|
|
126
|
+
type: z.ZodEnum<["anthropic", "openai", "openrouter"]>;
|
|
127
|
+
apiKey: z.ZodString;
|
|
128
|
+
model: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
131
|
+
apiKey: string;
|
|
132
|
+
model?: string | undefined;
|
|
133
|
+
}, {
|
|
134
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
135
|
+
apiKey: string;
|
|
136
|
+
model?: string | undefined;
|
|
137
|
+
}>;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
name: string;
|
|
140
|
+
systemPrompt: string;
|
|
141
|
+
provider: {
|
|
142
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
143
|
+
apiKey: string;
|
|
144
|
+
model?: string | undefined;
|
|
145
|
+
};
|
|
146
|
+
}, {
|
|
147
|
+
provider: {
|
|
148
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
149
|
+
apiKey: string;
|
|
150
|
+
model?: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
name?: string | undefined;
|
|
153
|
+
systemPrompt?: string | undefined;
|
|
154
|
+
}>;
|
|
155
|
+
channels: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"telegram">;
|
|
157
|
+
botToken: z.ZodString;
|
|
158
|
+
allowedUserIds: z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString]>, "many">;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
type: "telegram";
|
|
161
|
+
botToken: string;
|
|
162
|
+
allowedUserIds: (string | number)[];
|
|
163
|
+
}, {
|
|
164
|
+
type: "telegram";
|
|
165
|
+
botToken: string;
|
|
166
|
+
allowedUserIds: (string | number)[];
|
|
167
|
+
}>]>, "many">;
|
|
168
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
169
|
+
agent: z.ZodObject<{
|
|
170
|
+
name: z.ZodDefault<z.ZodString>;
|
|
171
|
+
systemPrompt: z.ZodDefault<z.ZodString>;
|
|
172
|
+
provider: z.ZodObject<{
|
|
173
|
+
type: z.ZodEnum<["anthropic", "openai", "openrouter"]>;
|
|
174
|
+
apiKey: z.ZodString;
|
|
175
|
+
model: z.ZodOptional<z.ZodString>;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
178
|
+
apiKey: string;
|
|
179
|
+
model?: string | undefined;
|
|
180
|
+
}, {
|
|
181
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
182
|
+
apiKey: string;
|
|
183
|
+
model?: string | undefined;
|
|
184
|
+
}>;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
name: string;
|
|
187
|
+
systemPrompt: string;
|
|
188
|
+
provider: {
|
|
189
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
190
|
+
apiKey: string;
|
|
191
|
+
model?: string | undefined;
|
|
192
|
+
};
|
|
193
|
+
}, {
|
|
194
|
+
provider: {
|
|
195
|
+
type: "anthropic" | "openai" | "openrouter";
|
|
196
|
+
apiKey: string;
|
|
197
|
+
model?: string | undefined;
|
|
198
|
+
};
|
|
199
|
+
name?: string | undefined;
|
|
200
|
+
systemPrompt?: string | undefined;
|
|
201
|
+
}>;
|
|
202
|
+
channels: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
203
|
+
type: z.ZodLiteral<"telegram">;
|
|
204
|
+
botToken: z.ZodString;
|
|
205
|
+
allowedUserIds: z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString]>, "many">;
|
|
206
|
+
}, "strip", z.ZodTypeAny, {
|
|
207
|
+
type: "telegram";
|
|
208
|
+
botToken: string;
|
|
209
|
+
allowedUserIds: (string | number)[];
|
|
210
|
+
}, {
|
|
211
|
+
type: "telegram";
|
|
212
|
+
botToken: string;
|
|
213
|
+
allowedUserIds: (string | number)[];
|
|
214
|
+
}>]>, "many">;
|
|
215
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
216
|
+
export type PresetConfig = z.infer<typeof PresetConfig>;
|
|
217
|
+
export type ProviderConfig = z.infer<typeof ProviderConfig>;
|
|
218
|
+
export type TelegramChannelConfig = z.infer<typeof TelegramChannelConfig>;
|
|
219
|
+
export declare function parsePreset(raw: unknown): PresetConfig;
|
|
220
|
+
export declare function decodeConfigB64(b64: string): PresetConfig;
|
|
221
|
+
export interface PresetFlags {
|
|
222
|
+
provider?: string;
|
|
223
|
+
apiKey?: string;
|
|
224
|
+
model?: string;
|
|
225
|
+
tgBotToken?: string;
|
|
226
|
+
tgAllow?: string[];
|
|
227
|
+
agentName?: string;
|
|
228
|
+
systemPrompt?: string;
|
|
229
|
+
}
|
|
230
|
+
export declare function buildPresetFromFlags(flags: PresetFlags): PresetConfig;
|
|
231
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,cAAc;;;;;;;;;;;;EAMzB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAMhC,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;IAAwD,CAAC;AAEnF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAItB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAOT,CAAC;AAEjB,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAEtD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAIzD;AAKD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAQD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CA8CrE"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Preset config the MDC dashboard hands to the wrapper.
|
|
3
|
+
// Modeled on pablo's config so the same dashboard form can target
|
|
4
|
+
// either pablo (npm: pablo-tensparrows) or this wrapper.
|
|
5
|
+
// Only the fields openclaw actually needs are read; extras are tolerated.
|
|
6
|
+
export const ProviderConfig = z.object({
|
|
7
|
+
// openclaw supports anthropic/openai natively; openrouter is treated as
|
|
8
|
+
// an openai-compatible custom endpoint.
|
|
9
|
+
type: z.enum(["anthropic", "openai", "openrouter"]),
|
|
10
|
+
apiKey: z.string().min(10),
|
|
11
|
+
model: z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
export const TelegramChannelConfig = z.object({
|
|
14
|
+
type: z.literal("telegram"),
|
|
15
|
+
botToken: z.string().min(10),
|
|
16
|
+
// pablo uses number[]; openclaw wants string[]. Accept either,
|
|
17
|
+
// normalize to string[] at translation time.
|
|
18
|
+
allowedUserIds: z.array(z.union([z.number().int().positive(), z.string().min(1)])).min(1),
|
|
19
|
+
});
|
|
20
|
+
export const ChannelConfig = z.discriminatedUnion("type", [TelegramChannelConfig]);
|
|
21
|
+
export const AgentConfig = z.object({
|
|
22
|
+
name: z.string().min(1).default("Pablo"),
|
|
23
|
+
systemPrompt: z.string().default("You are Pablo, a helpful personal assistant."),
|
|
24
|
+
provider: ProviderConfig,
|
|
25
|
+
});
|
|
26
|
+
export const PresetConfig = z
|
|
27
|
+
.object({
|
|
28
|
+
agent: AgentConfig,
|
|
29
|
+
channels: z.array(ChannelConfig).min(1),
|
|
30
|
+
})
|
|
31
|
+
// pablo configs carry extra blocks (tools, database, scheduler, health) that
|
|
32
|
+
// openclaw doesn't consume. Don't reject them.
|
|
33
|
+
.passthrough();
|
|
34
|
+
export function parsePreset(raw) {
|
|
35
|
+
return PresetConfig.parse(raw);
|
|
36
|
+
}
|
|
37
|
+
export function decodeConfigB64(b64) {
|
|
38
|
+
const json = Buffer.from(b64, "base64").toString("utf8");
|
|
39
|
+
const parsed = JSON.parse(json);
|
|
40
|
+
return parsePreset(parsed);
|
|
41
|
+
}
|
|
42
|
+
const PROVIDER_KEY_ENV = {
|
|
43
|
+
anthropic: "ANTHROPIC_API_KEY",
|
|
44
|
+
openai: "OPENAI_API_KEY",
|
|
45
|
+
openrouter: "OPENROUTER_API_KEY",
|
|
46
|
+
};
|
|
47
|
+
export function buildPresetFromFlags(flags) {
|
|
48
|
+
if (!flags.provider) {
|
|
49
|
+
throw new Error("--provider is required (one of: anthropic, openai, openrouter)");
|
|
50
|
+
}
|
|
51
|
+
const providerType = flags.provider.toLowerCase();
|
|
52
|
+
if (!["anthropic", "openai", "openrouter"].includes(providerType)) {
|
|
53
|
+
throw new Error(`--provider must be one of: anthropic, openai, openrouter (got "${flags.provider}")`);
|
|
54
|
+
}
|
|
55
|
+
const apiKey = flags.apiKey ?? process.env[PROVIDER_KEY_ENV[providerType]];
|
|
56
|
+
if (!apiKey) {
|
|
57
|
+
throw new Error(`--api-key is required (or set $${PROVIDER_KEY_ENV[providerType]} in your environment)`);
|
|
58
|
+
}
|
|
59
|
+
const botToken = flags.tgBotToken ?? process.env.TELEGRAM_BOT_TOKEN;
|
|
60
|
+
if (!botToken) {
|
|
61
|
+
throw new Error("--tg-bot-token is required (or set $TELEGRAM_BOT_TOKEN in your environment)");
|
|
62
|
+
}
|
|
63
|
+
const allowedUserIds = normalizeAllowedFlags(flags.tgAllow ?? []);
|
|
64
|
+
if (allowedUserIds.length === 0) {
|
|
65
|
+
throw new Error("--tg-allow is required (at least one numeric Telegram user ID)");
|
|
66
|
+
}
|
|
67
|
+
const raw = {
|
|
68
|
+
agent: {
|
|
69
|
+
name: flags.agentName ?? "Pablo",
|
|
70
|
+
systemPrompt: flags.systemPrompt ?? "You are Pablo, a helpful personal assistant.",
|
|
71
|
+
provider: {
|
|
72
|
+
type: providerType,
|
|
73
|
+
apiKey,
|
|
74
|
+
...(flags.model ? { model: flags.model } : {}),
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
channels: [
|
|
78
|
+
{
|
|
79
|
+
type: "telegram",
|
|
80
|
+
botToken,
|
|
81
|
+
allowedUserIds,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
return parsePreset(raw);
|
|
86
|
+
}
|
|
87
|
+
// Accepts repeated --tg-allow flags AND comma-separated values inside each.
|
|
88
|
+
function normalizeAllowedFlags(raw) {
|
|
89
|
+
const out = [];
|
|
90
|
+
for (const entry of raw) {
|
|
91
|
+
for (const part of entry.split(",")) {
|
|
92
|
+
const trimmed = part.trim();
|
|
93
|
+
if (trimmed)
|
|
94
|
+
out.push(trimmed);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wDAAwD;AACxD,kEAAkE;AAClE,yDAAyD;AACzD,0EAA0E;AAE1E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,wEAAwE;IACxE,wCAAwC;IACxC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IACnD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IAC5B,+DAA+D;IAC/D,6CAA6C;IAC7C,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,C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,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC/C;SACF;QACD,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,UAAU;gBAChB,QAAQ;gBACR,cAAc;aACf;SACF;KACF,CAAC;IAEF,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,4EAA4E;AAC5E,SAAS,qBAAqB,CAAC,GAAa;IAC1C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACxB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,OAAO;gBAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { PresetConfig, parsePreset, decodeConfigB64, buildPresetFromFlags, PresetFlags, } from "./config.js";
|
|
2
|
+
export { buildOpenclawConfig, envForProvider, redactConfig } from "./openclaw-config.js";
|
|
3
|
+
export { runSetup } from "./setup.js";
|
|
4
|
+
export { VERSION } from "./version.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { PresetConfig, parsePreset, decodeConfigB64, buildPresetFromFlags, } from "./config.js";
|
|
2
|
+
export { buildOpenclawConfig, envForProvider, redactConfig } from "./openclaw-config.js";
|
|
3
|
+
export { runSetup } from "./setup.js";
|
|
4
|
+
export { VERSION } from "./version.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EACf,oBAAoB,GAErB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG;gBACF,MAAM;cACR,MAAM;gBACJ,MAAM;eACP,MAAM;CAClB,CAAC"}
|
package/dist/log.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
export const log = {
|
|
3
|
+
info: (msg) => process.stdout.write(chalk.gray("[pablo-openclaw] ") + msg + "\n"),
|
|
4
|
+
ok: (msg) => process.stdout.write(chalk.green("✓ ") + msg + "\n"),
|
|
5
|
+
warn: (msg) => process.stderr.write(chalk.yellow("! ") + msg + "\n"),
|
|
6
|
+
err: (msg) => process.stderr.write(chalk.red("✗ ") + msg + "\n"),
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=log.js.map
|
package/dist/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IACzF,EAAE,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IACzE,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IAC5E,GAAG,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;CACzE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PresetConfig, ProviderConfig } from "./config.js";
|
|
2
|
+
export declare function buildOpenclawConfig(preset: PresetConfig): Record<string, unknown>;
|
|
3
|
+
export declare function envForProvider(provider: ProviderConfig): Record<string, string>;
|
|
4
|
+
export declare function redactConfig(cfg: Record<string, unknown>): Record<string, unknown>;
|
|
5
|
+
//# sourceMappingURL=openclaw-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw-config.d.ts","sourceRoot":"","sources":["../src/openclaw-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA+EhE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoCjF;AAKD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS/E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWlF"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Translate the dashboard preset into the openclaw.json shape that
|
|
2
|
+
// `openclaw gateway` reads from ~/.openclaw/openclaw.json.
|
|
3
|
+
//
|
|
4
|
+
// Reference: docs/channels/telegram.md and docs/install/fly.md in the
|
|
5
|
+
// published `openclaw` npm tarball (2026.5.7).
|
|
6
|
+
const DEFAULT_MODELS = {
|
|
7
|
+
anthropic: "anthropic/claude-sonnet-4-6",
|
|
8
|
+
openai: "openai/gpt-5.4",
|
|
9
|
+
// No first-class openrouter provider id in openclaw; use a custom
|
|
10
|
+
// openai-compatible endpoint and pin a sensible default model id.
|
|
11
|
+
openrouter: "custom/openrouter-default",
|
|
12
|
+
};
|
|
13
|
+
function normalizeAllowedIds(ids) {
|
|
14
|
+
return ids.map((id) => String(id).replace(/^(telegram:|tg:)/, "").trim()).filter(Boolean);
|
|
15
|
+
}
|
|
16
|
+
function telegramChannel(preset) {
|
|
17
|
+
const tg = preset.channels.find((c) => c.type === "telegram");
|
|
18
|
+
if (!tg) {
|
|
19
|
+
throw new Error("preset has no telegram channel");
|
|
20
|
+
}
|
|
21
|
+
const allowFrom = normalizeAllowedIds(tg.allowedUserIds);
|
|
22
|
+
return {
|
|
23
|
+
enabled: true,
|
|
24
|
+
botToken: tg.botToken,
|
|
25
|
+
dmPolicy: "allowlist",
|
|
26
|
+
allowFrom,
|
|
27
|
+
groupPolicy: "allowlist",
|
|
28
|
+
groupAllowFrom: allowFrom,
|
|
29
|
+
groups: { "*": { requireMention: true } },
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function modelsBlock(provider) {
|
|
33
|
+
// openclaw's preferred path is env-var API keys; we still emit a `models`
|
|
34
|
+
// block so the gateway has explicit provider config on disk. The api key
|
|
35
|
+
// is also written here for headless first-boot — env wins at runtime if
|
|
36
|
+
// both are set.
|
|
37
|
+
switch (provider.type) {
|
|
38
|
+
case "anthropic":
|
|
39
|
+
return {
|
|
40
|
+
providers: {
|
|
41
|
+
"anthropic:default": { apiKey: provider.apiKey },
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
case "openai":
|
|
45
|
+
return {
|
|
46
|
+
providers: {
|
|
47
|
+
"openai:default": { apiKey: provider.apiKey },
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
case "openrouter":
|
|
51
|
+
return {
|
|
52
|
+
providers: {
|
|
53
|
+
"custom:openrouter": {
|
|
54
|
+
apiKey: provider.apiKey,
|
|
55
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
56
|
+
compatibility: "openai",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function authProfiles(provider) {
|
|
63
|
+
switch (provider.type) {
|
|
64
|
+
case "anthropic":
|
|
65
|
+
return { "anthropic:default": { mode: "token", provider: "anthropic" } };
|
|
66
|
+
case "openai":
|
|
67
|
+
return { "openai:default": { mode: "token", provider: "openai" } };
|
|
68
|
+
case "openrouter":
|
|
69
|
+
return { "custom:openrouter": { mode: "token", provider: "custom" } };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function buildOpenclawConfig(preset) {
|
|
73
|
+
const { agent } = preset;
|
|
74
|
+
const provider = agent.provider;
|
|
75
|
+
const model = provider.model ?? DEFAULT_MODELS[provider.type];
|
|
76
|
+
return {
|
|
77
|
+
gateway: {
|
|
78
|
+
mode: "local",
|
|
79
|
+
bind: "loopback",
|
|
80
|
+
},
|
|
81
|
+
agents: {
|
|
82
|
+
defaults: {
|
|
83
|
+
model: { primary: model },
|
|
84
|
+
maxConcurrent: 2,
|
|
85
|
+
},
|
|
86
|
+
list: [
|
|
87
|
+
{
|
|
88
|
+
id: "main",
|
|
89
|
+
default: true,
|
|
90
|
+
identity: { name: agent.name },
|
|
91
|
+
systemPrompt: agent.systemPrompt,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
auth: {
|
|
96
|
+
profiles: authProfiles(provider),
|
|
97
|
+
},
|
|
98
|
+
models: modelsBlock(provider),
|
|
99
|
+
channels: {
|
|
100
|
+
telegram: telegramChannel(preset),
|
|
101
|
+
},
|
|
102
|
+
bindings: [{ agentId: "main", match: { channel: "telegram" } }],
|
|
103
|
+
meta: {
|
|
104
|
+
generatedBy: "pablo-openclaw-tensparrows",
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// Env vars the spawned `openclaw gateway` process should see. Putting the
|
|
109
|
+
// API key here in addition to the config file matches openclaw's own
|
|
110
|
+
// recommendation ("prefer env vars over config file for tokens").
|
|
111
|
+
export function envForProvider(provider) {
|
|
112
|
+
switch (provider.type) {
|
|
113
|
+
case "anthropic":
|
|
114
|
+
return { ANTHROPIC_API_KEY: provider.apiKey };
|
|
115
|
+
case "openai":
|
|
116
|
+
return { OPENAI_API_KEY: provider.apiKey };
|
|
117
|
+
case "openrouter":
|
|
118
|
+
return { OPENROUTER_API_KEY: provider.apiKey, CUSTOM_API_KEY: provider.apiKey };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export function redactConfig(cfg) {
|
|
122
|
+
// structuredClone preserves nested objects without aliasing.
|
|
123
|
+
const copy = structuredClone(cfg);
|
|
124
|
+
const providers = copy.models?.providers ?? {};
|
|
125
|
+
for (const key of Object.keys(providers)) {
|
|
126
|
+
if (providers[key]?.apiKey)
|
|
127
|
+
providers[key].apiKey = "***";
|
|
128
|
+
}
|
|
129
|
+
if (copy.channels?.telegram?.botToken) {
|
|
130
|
+
copy.channels.telegram.botToken = "***";
|
|
131
|
+
}
|
|
132
|
+
return copy;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=openclaw-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw-config.js","sourceRoot":"","sources":["../src/openclaw-config.ts"],"names":[],"mappings":"AAEA,mEAAmE;AACnE,2DAA2D;AAC3D,EAAE;AACF,sEAAsE;AACtE,+CAA+C;AAE/C,MAAM,cAAc,GAA2C;IAC7D,SAAS,EAAE,6BAA6B;IACxC,MAAM,EAAE,gBAAgB;IACxB,kEAAkE;IAClE,kEAAkE;IAClE,UAAU,EAAE,2BAA2B;CACxC,CAAC;AAEF,SAAS,mBAAmB,CAAC,GAA2B;IACtD,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC5F,CAAC;AAED,SAAS,eAAe,CAAC,MAAoB;IAC3C,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAC9D,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,SAAS,GAAG,mBAAmB,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC;IACzD,OAAO;QACL,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,EAAE,CAAC,QAAQ;QACrB,QAAQ,EAAE,WAAoB;QAC9B,SAAS;QACT,WAAW,EAAE,WAAoB;QACjC,cAAc,EAAE,SAAS;QACzB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,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACpF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAA4B;IACvD,6DAA6D;IAC7D,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAwB,CAAC;IACzD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC;IAC/C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM;YAAE,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;IAC5D,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PresetConfig } from "./config.js";
|
|
2
|
+
export interface SetupOptions {
|
|
3
|
+
preset: PresetConfig;
|
|
4
|
+
openclawVersion: string;
|
|
5
|
+
start: boolean;
|
|
6
|
+
configPath?: string;
|
|
7
|
+
reinstall: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function runSetup(opts: SetupOptions): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AAKD,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BhE"}
|
package/dist/setup.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
+
import { mkdirSync, writeFileSync, chmodSync, existsSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { log } from "./log.js";
|
|
6
|
+
import { buildOpenclawConfig, envForProvider } from "./openclaw-config.js";
|
|
7
|
+
const DEFAULT_OPENCLAW_HOME = join(homedir(), ".openclaw");
|
|
8
|
+
const DEFAULT_CONFIG_FILE = join(DEFAULT_OPENCLAW_HOME, "openclaw.json");
|
|
9
|
+
export async function runSetup(opts) {
|
|
10
|
+
const configPath = opts.configPath ?? DEFAULT_CONFIG_FILE;
|
|
11
|
+
// 1. Ensure openclaw is installed.
|
|
12
|
+
const openclawBin = ensureOpenclaw(opts.openclawVersion, opts.reinstall);
|
|
13
|
+
log.ok(`openclaw binary: ${openclawBin}`);
|
|
14
|
+
// 2. Build + write openclaw.json.
|
|
15
|
+
const openclawConfig = buildOpenclawConfig(opts.preset);
|
|
16
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
17
|
+
writeFileSync(configPath, JSON.stringify(openclawConfig, null, 2), { mode: 0o600 });
|
|
18
|
+
try {
|
|
19
|
+
chmodSync(configPath, 0o600);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// best-effort; the writeFileSync mode already covers POSIX.
|
|
23
|
+
}
|
|
24
|
+
log.ok(`wrote ${configPath}`);
|
|
25
|
+
// 3. Optionally start the gateway.
|
|
26
|
+
if (!opts.start) {
|
|
27
|
+
log.info("setup complete (start skipped). next step:");
|
|
28
|
+
process.stdout.write(` openclaw gateway\n`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await startGatewayForeground(openclawBin, opts.preset);
|
|
32
|
+
}
|
|
33
|
+
function ensureOpenclaw(version, reinstall) {
|
|
34
|
+
const existing = which("openclaw");
|
|
35
|
+
if (existing && !reinstall) {
|
|
36
|
+
log.info(`found existing openclaw at ${existing}`);
|
|
37
|
+
return existing;
|
|
38
|
+
}
|
|
39
|
+
log.info(`installing openclaw@${version} (npm install -g) ...`);
|
|
40
|
+
const res = spawnSync("npm", ["install", "-g", `openclaw@${version}`], {
|
|
41
|
+
stdio: "inherit",
|
|
42
|
+
});
|
|
43
|
+
if (res.status !== 0) {
|
|
44
|
+
throw new Error(`npm install -g openclaw@${version} exited with code ${res.status}. ` +
|
|
45
|
+
`if this is a permission error, your Node prefix probably needs sudo — ` +
|
|
46
|
+
`see https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally.`);
|
|
47
|
+
}
|
|
48
|
+
const installed = which("openclaw");
|
|
49
|
+
if (!installed) {
|
|
50
|
+
throw new Error("npm install succeeded but `openclaw` is not on PATH. " +
|
|
51
|
+
"check `npm bin -g` and make sure it's in your PATH.");
|
|
52
|
+
}
|
|
53
|
+
return installed;
|
|
54
|
+
}
|
|
55
|
+
function which(cmd) {
|
|
56
|
+
const res = spawnSync("which", [cmd], { encoding: "utf8" });
|
|
57
|
+
const out = res.stdout?.trim();
|
|
58
|
+
return out && existsSync(out) ? out : null;
|
|
59
|
+
}
|
|
60
|
+
async function startGatewayForeground(openclawBin, preset) {
|
|
61
|
+
const env = {
|
|
62
|
+
...process.env,
|
|
63
|
+
...envForProvider(preset.agent.provider),
|
|
64
|
+
};
|
|
65
|
+
log.info("starting gateway (Ctrl-C to stop) ...");
|
|
66
|
+
const child = spawn(openclawBin, ["gateway"], {
|
|
67
|
+
stdio: "inherit",
|
|
68
|
+
env,
|
|
69
|
+
});
|
|
70
|
+
const forward = (sig) => () => {
|
|
71
|
+
if (!child.killed)
|
|
72
|
+
child.kill(sig);
|
|
73
|
+
};
|
|
74
|
+
process.on("SIGINT", forward("SIGINT"));
|
|
75
|
+
process.on("SIGTERM", forward("SIGTERM"));
|
|
76
|
+
await new Promise((resolve, reject) => {
|
|
77
|
+
child.on("exit", (code, signal) => {
|
|
78
|
+
if (signal) {
|
|
79
|
+
log.warn(`openclaw gateway terminated by ${signal}`);
|
|
80
|
+
resolve();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (code === 0) {
|
|
84
|
+
resolve();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
reject(new Error(`openclaw gateway exited with code ${code}`));
|
|
88
|
+
});
|
|
89
|
+
child.on("error", reject);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAU3E,MAAM,qBAAqB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAC3D,MAAM,mBAAmB,GAAG,IAAI,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAC;AAEzE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAkB;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,mBAAmB,CAA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AC,CAAC;IAEH,MAAM,OAAO,GAAG,CAAC,GAAmB,EAAE,EAAE,CAAC,GAAG,EAAE;QAC5C,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAE1C,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YAChC,IAAI,MAAM,EAAE,CAAC;gBACX,GAAG,CAAC,IAAI,CAAC,kCAAkC,MAAM,EAAE,CAAC,CAAC;gBACrD,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YACD,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YACD,MAAM,CAAC,IAAI,KAAK,CAAC,qCAAqC,IAAI,EAAE,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pablo-openclaw-tensparrows",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Pablo — headless OpenClaw installer. Takes a preset config and brings up an OpenClaw gateway connected to Telegram.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"pablo-openclaw": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"postbuild": "chmod +x dist/cli.js",
|
|
17
|
+
"dev": "tsx src/cli.ts",
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"clean": "rm -rf dist",
|
|
20
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"openclaw",
|
|
24
|
+
"pablo",
|
|
25
|
+
"telegram",
|
|
26
|
+
"mdc",
|
|
27
|
+
"wrapper",
|
|
28
|
+
"ai-agent"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=22.12"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"chalk": "^5.3.0",
|
|
35
|
+
"commander": "^12.1.0",
|
|
36
|
+
"zod": "^3.23.8"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^22.0.0",
|
|
40
|
+
"tsx": "^4.19.0",
|
|
41
|
+
"typescript": "^5.6.0"
|
|
42
|
+
},
|
|
43
|
+
"license": "MIT"
|
|
44
|
+
}
|