@chozzz/vargos 2.0.14 → 2.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/.templates/vargos/agents/subagent.md +36 -0
- package/dist/cli/channels.d.ts +26 -0
- package/dist/cli/channels.d.ts.map +1 -0
- package/dist/cli/channels.js +116 -0
- package/dist/cli/channels.js.map +1 -0
- package/dist/cli/onboard.d.ts.map +1 -1
- package/dist/cli/onboard.js +181 -109
- package/dist/cli/onboard.js.map +1 -1
- package/dist/cli.js +89 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/subagent.d.ts +10 -3
- package/dist/lib/subagent.d.ts.map +1 -1
- package/dist/lib/subagent.js +20 -1
- package/dist/lib/subagent.js.map +1 -1
- package/dist/services/agent/index.d.ts +10 -5
- package/dist/services/agent/index.d.ts.map +1 -1
- package/dist/services/agent/index.js +28 -20
- package/dist/services/agent/index.js.map +1 -1
- package/dist/services/agent/persona.d.ts +6 -0
- package/dist/services/agent/persona.d.ts.map +1 -1
- package/dist/services/agent/persona.js +19 -0
- package/dist/services/agent/persona.js.map +1 -1
- package/dist/services/agent/tools.d.ts +11 -4
- package/dist/services/agent/tools.d.ts.map +1 -1
- package/dist/services/agent/tools.js +24 -7
- package/dist/services/agent/tools.js.map +1 -1
- package/dist/services/channels/index.d.ts.map +1 -1
- package/dist/services/channels/index.js +5 -9
- package/dist/services/channels/index.js.map +1 -1
- package/dist/services/channels/pipeline.js +2 -2
- package/dist/services/channels/pipeline.js.map +1 -1
- package/dist/services/channels/providers/telegram/normalizer.d.ts.map +1 -1
- package/dist/services/channels/providers/telegram/normalizer.js +9 -3
- package/dist/services/channels/providers/telegram/normalizer.js.map +1 -1
- package/dist/services/channels/providers/whatsapp/adapter.d.ts +0 -4
- package/dist/services/channels/providers/whatsapp/adapter.d.ts.map +1 -1
- package/dist/services/channels/providers/whatsapp/adapter.js +10 -33
- package/dist/services/channels/providers/whatsapp/adapter.js.map +1 -1
- package/dist/services/channels/providers/whatsapp/normalizer.d.ts.map +1 -1
- package/dist/services/channels/providers/whatsapp/normalizer.js +8 -9
- package/dist/services/channels/providers/whatsapp/normalizer.js.map +1 -1
- package/dist/services/channels/providers/whatsapp/session.d.ts.map +1 -1
- package/dist/services/channels/providers/whatsapp/session.js +13 -7
- package/dist/services/channels/providers/whatsapp/session.js.map +1 -1
- package/dist/services/config/index.d.ts +3 -3
- package/dist/services/config/schemas/auth.d.ts +2 -2
- package/dist/services/cron/index.d.ts.map +1 -1
- package/dist/services/cron/index.js +7 -1
- package/dist/services/cron/index.js.map +1 -1
- package/package.json +15 -15
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Glob whitelist of bus tools the subagent can call.
|
|
3
|
+
# agent.execute and channel.send/channel.sendMedia are intentionally excluded:
|
|
4
|
+
# - No recursive delegation (1-depth max)
|
|
5
|
+
# - No direct user messaging (all communication flows through parent)
|
|
6
|
+
allowedTools:
|
|
7
|
+
- memory.*
|
|
8
|
+
- web.*
|
|
9
|
+
- cron.*
|
|
10
|
+
- bus.*
|
|
11
|
+
- log.*
|
|
12
|
+
- mcp.*
|
|
13
|
+
- agent.status
|
|
14
|
+
- agent.appendMessage
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
You are a subagent — a focused worker delegated a specific task by the parent agent.
|
|
18
|
+
|
|
19
|
+
Rules:
|
|
20
|
+
- Execute the task thoroughly and return all findings.
|
|
21
|
+
- Use tools to inspect and act — do not guess or fabricate.
|
|
22
|
+
- Do not delegate to other subagents.
|
|
23
|
+
- Do not message users directly.
|
|
24
|
+
- If blocked, report what you tried and why.
|
|
25
|
+
|
|
26
|
+
Return your results as structured markdown:
|
|
27
|
+
## Findings
|
|
28
|
+
[what you found or accomplished]
|
|
29
|
+
## Files Changed
|
|
30
|
+
[list any files modified, if applicable]
|
|
31
|
+
## Commands Run
|
|
32
|
+
[list commands executed, if applicable]
|
|
33
|
+
## Confidence
|
|
34
|
+
[high/medium/low — brief reasoning]
|
|
35
|
+
## Blockers
|
|
36
|
+
[any issues encountered, or "None"]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel management — shared CRUD used by onboard wizard and vargos channels CLI.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* listChannels() → array of { id, type, botToken? }
|
|
6
|
+
* registerChannel() → add to config.json
|
|
7
|
+
* deregisterChannel() → remove from config.json
|
|
8
|
+
* pairWhatsApp() → standalone QR pairing (stops after connected)
|
|
9
|
+
*/
|
|
10
|
+
export interface ChannelInfo {
|
|
11
|
+
id: string;
|
|
12
|
+
type: 'telegram' | 'whatsapp';
|
|
13
|
+
botToken?: string;
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
registered?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface RegisterChannelParams {
|
|
18
|
+
id: string;
|
|
19
|
+
type: 'telegram' | 'whatsapp';
|
|
20
|
+
botToken?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function listChannels(): ChannelInfo[];
|
|
23
|
+
export declare function registerChannel(params: RegisterChannelParams): void;
|
|
24
|
+
export declare function deregisterChannel(id: string): void;
|
|
25
|
+
export declare function pairWhatsApp(id: string): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../cli/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA6BD,wBAAgB,YAAY,IAAI,WAAW,EAAE,CAmB5C;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAmBnE;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAQlD;AAID,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC5D"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel management — shared CRUD used by onboard wizard and vargos channels CLI.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* listChannels() → array of { id, type, botToken? }
|
|
6
|
+
* registerChannel() → add to config.json
|
|
7
|
+
* deregisterChannel() → remove from config.json
|
|
8
|
+
* pairWhatsApp() → standalone QR pairing (stops after connected)
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { getDataPaths } from '../lib/paths.js';
|
|
13
|
+
function readConfig() {
|
|
14
|
+
const { configFile } = getDataPaths();
|
|
15
|
+
if (!existsSync(configFile))
|
|
16
|
+
return {};
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(readFileSync(configFile, 'utf-8'));
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function writeConfig(config) {
|
|
25
|
+
const { configFile } = getDataPaths();
|
|
26
|
+
if (!existsSync(path.dirname(configFile))) {
|
|
27
|
+
mkdirSync(path.dirname(configFile), { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
writeFileSync(configFile, JSON.stringify(config, null, 2), { mode: 0o600 });
|
|
30
|
+
}
|
|
31
|
+
// ── Public API ────────────────────────────────────────────────────────────────
|
|
32
|
+
export function listChannels() {
|
|
33
|
+
const config = readConfig();
|
|
34
|
+
const channels = (config.channels ?? []);
|
|
35
|
+
return channels.map((ch) => {
|
|
36
|
+
const info = {
|
|
37
|
+
id: String(ch.id ?? ''),
|
|
38
|
+
type: ch.type ?? 'whatsapp',
|
|
39
|
+
enabled: ch.enabled !== false,
|
|
40
|
+
};
|
|
41
|
+
if (ch.botToken != null)
|
|
42
|
+
info['botToken'] = String(ch.botToken);
|
|
43
|
+
// WhatsApp: check if paired (creds.json exists)
|
|
44
|
+
if (info.type === 'whatsapp') {
|
|
45
|
+
const authDir = path.join(getDataPaths().channelsDir, info.id);
|
|
46
|
+
info.registered = existsSync(path.join(authDir, 'creds.json'));
|
|
47
|
+
}
|
|
48
|
+
return info;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export function registerChannel(params) {
|
|
52
|
+
const config = readConfig();
|
|
53
|
+
const channels = (config.channels ?? []);
|
|
54
|
+
// Check for duplicate id
|
|
55
|
+
if (channels.some((c) => c.id === params.id)) {
|
|
56
|
+
throw new Error(`Channel "${params.id}" already exists. Use deregister first.`);
|
|
57
|
+
}
|
|
58
|
+
const entry = {
|
|
59
|
+
id: params.id,
|
|
60
|
+
type: params.type,
|
|
61
|
+
enabled: true,
|
|
62
|
+
};
|
|
63
|
+
if (params.botToken)
|
|
64
|
+
entry['botToken'] = params.botToken;
|
|
65
|
+
channels.push(entry);
|
|
66
|
+
config.channels = channels;
|
|
67
|
+
writeConfig(config);
|
|
68
|
+
}
|
|
69
|
+
export function deregisterChannel(id) {
|
|
70
|
+
const config = readConfig();
|
|
71
|
+
const channels = (config.channels ?? []);
|
|
72
|
+
const idx = channels.findIndex((c) => c.id === id);
|
|
73
|
+
if (idx === -1)
|
|
74
|
+
throw new Error(`Channel "${id}" not found.`);
|
|
75
|
+
channels.splice(idx, 1);
|
|
76
|
+
config.channels = channels;
|
|
77
|
+
writeConfig(config);
|
|
78
|
+
}
|
|
79
|
+
// ── WhatsApp standalone pairing ───────────────────────────────────────────────
|
|
80
|
+
export async function pairWhatsApp(id) {
|
|
81
|
+
const authDir = path.join(getDataPaths().channelsDir, id);
|
|
82
|
+
// Dynamic import — only loads Baileys when this function is called
|
|
83
|
+
const { createWhatsAppSocket } = await import('../services/channels/providers/whatsapp/session.js');
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
createWhatsAppSocket(authDir, {
|
|
86
|
+
onQR: () => {
|
|
87
|
+
// QR printed automatically by qrcode-terminal inside session.ts
|
|
88
|
+
},
|
|
89
|
+
onConnected: (name) => {
|
|
90
|
+
console.log(`\n✅ Connected as ${name}`);
|
|
91
|
+
console.log(` Credentials saved to ${authDir}/creds.json\n`);
|
|
92
|
+
resolve();
|
|
93
|
+
},
|
|
94
|
+
onDisconnected: (reason) => {
|
|
95
|
+
if (reason === 'logged_out') {
|
|
96
|
+
reject(new Error('Pairing failed — device logged out. Try again.'));
|
|
97
|
+
}
|
|
98
|
+
else if (reason === 'forbidden') {
|
|
99
|
+
reject(new Error('Pairing failed — access forbidden.'));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Connection closed for other reasons — may still have succeeded
|
|
103
|
+
console.log(`\n⚠ Connection closed (${reason}). If you scanned the QR, pairing may have succeeded.`);
|
|
104
|
+
resolve();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
onMessage: () => {
|
|
108
|
+
// Ignore messages during pairing
|
|
109
|
+
},
|
|
110
|
+
}).then((sock) => {
|
|
111
|
+
// Socket created, wait for onConnected to resolve
|
|
112
|
+
// If the process exits before onConnected, the promise rejects via onDisconnected
|
|
113
|
+
}).catch(reject);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=channels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../cli/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAE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AO,EAAE,CAAC;YACZ,CAAC;YACD,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE;gBACzB,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;oBAC5B,MAAM,CAAC,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;gBACtE,CAAC;qBAAM,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;oBAClC,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;gBAC1D,CAAC;qBAAM,CAAC;oBACN,iEAAiE;oBACjE,OAAO,CAAC,GAAG,CAAC,0BAA0B,MAAM,uDAAuD,CAAC,CAAC;oBACrG,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC;YACD,SAAS,EAAE,GAAG,EAAE;gBACd,iCAAiC;YACnC,CAAC;SACF,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACf,kDAAkD;YAClD,kFAAkF;QACpF,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboard.d.ts","sourceRoot":"","sources":["../../cli/onboard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"onboard.d.ts","sourceRoot":"","sources":["../../cli/onboard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2FH,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CA6R7C"}
|
package/dist/cli/onboard.js
CHANGED
|
@@ -10,6 +10,7 @@ import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
import * as p from '@clack/prompts';
|
|
12
12
|
import { getDataPaths } from '../lib/paths.js';
|
|
13
|
+
import { registerChannel } from './channels.js';
|
|
13
14
|
const PROVIDERS = {
|
|
14
15
|
anthropic: {
|
|
15
16
|
baseUrl: 'https://api.anthropic.com/v1',
|
|
@@ -84,113 +85,187 @@ function writeJson(filePath, data) {
|
|
|
84
85
|
export async function onboard() {
|
|
85
86
|
const { dataDir, configFile } = getDataPaths();
|
|
86
87
|
const agentDir = `${dataDir}/agent`;
|
|
88
|
+
const hasConfig = existsSync(configFile);
|
|
87
89
|
p.intro('⚡ Vargos — Setup Wizard');
|
|
88
|
-
// ── Step 1: Provider
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (p.isCancel(providerKey)) {
|
|
97
|
-
p.cancel('Setup cancelled. Run vargos onboard to try again.');
|
|
98
|
-
process.exit(0);
|
|
99
|
-
}
|
|
100
|
-
const preset = PROVIDERS[providerKey];
|
|
101
|
-
// ── Step 2: API Key ──────────────────────────────────────────────────────
|
|
102
|
-
let apiKey;
|
|
103
|
-
if (preset.envKey) {
|
|
104
|
-
const envVal = process.env[preset.envKey];
|
|
105
|
-
if (envVal) {
|
|
106
|
-
p.note(`Found ${preset.envKey} in environment — using it.`, 'API Key');
|
|
107
|
-
apiKey = envVal;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (!apiKey && preset.envKey) {
|
|
111
|
-
const input = (await p.password({
|
|
112
|
-
message: `Enter your ${providerKey} API key:`,
|
|
113
|
-
validate(value) {
|
|
114
|
-
if (!value)
|
|
115
|
-
return 'API key is required';
|
|
116
|
-
return;
|
|
117
|
-
},
|
|
90
|
+
// ── Step 1: Provider (skip if already configured) ────────────────────────
|
|
91
|
+
if (!hasConfig) {
|
|
92
|
+
const providerKey = (await p.select({
|
|
93
|
+
message: 'Choose your LLM provider:',
|
|
94
|
+
options: Object.entries(PROVIDERS).map(([key, preset]) => {
|
|
95
|
+
const local = key === 'ollama' ? ' (local)' : '';
|
|
96
|
+
return { value: key, label: `${key}${local}`, hint: preset.baseUrl };
|
|
97
|
+
}),
|
|
118
98
|
}));
|
|
119
|
-
if (p.isCancel(
|
|
120
|
-
p.cancel('Setup cancelled.');
|
|
99
|
+
if (p.isCancel(providerKey)) {
|
|
100
|
+
p.cancel('Setup cancelled. Run vargos onboard to try again.');
|
|
121
101
|
process.exit(0);
|
|
122
102
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const customUrl = (await p.text({
|
|
133
|
-
message: `Ollama base URL:`,
|
|
134
|
-
placeholder: preset.baseUrl,
|
|
135
|
-
defaultValue: preset.baseUrl,
|
|
136
|
-
}));
|
|
137
|
-
if (p.isCancel(customUrl)) {
|
|
138
|
-
p.cancel('Setup cancelled.');
|
|
139
|
-
process.exit(0);
|
|
103
|
+
const preset = PROVIDERS[providerKey];
|
|
104
|
+
// ── Step 2: API Key ────────────────────────────────────────────────────
|
|
105
|
+
let apiKey;
|
|
106
|
+
if (preset.envKey) {
|
|
107
|
+
const envVal = process.env[preset.envKey];
|
|
108
|
+
if (envVal) {
|
|
109
|
+
p.note(`Found ${preset.envKey} in environment — using it.`, 'API Key');
|
|
110
|
+
apiKey = envVal;
|
|
111
|
+
}
|
|
140
112
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
113
|
+
if (!apiKey && preset.envKey) {
|
|
114
|
+
const input = (await p.password({
|
|
115
|
+
message: `Enter your ${providerKey} API key:`,
|
|
116
|
+
validate(value) {
|
|
117
|
+
if (!value)
|
|
118
|
+
return 'API key is required';
|
|
119
|
+
return;
|
|
120
|
+
},
|
|
121
|
+
}));
|
|
122
|
+
if (p.isCancel(input)) {
|
|
123
|
+
p.cancel('Setup cancelled.');
|
|
124
|
+
process.exit(0);
|
|
125
|
+
}
|
|
126
|
+
apiKey = input;
|
|
153
127
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const customModel = (await p.text({
|
|
158
|
-
message: 'Enter model ID:',
|
|
159
|
-
placeholder: 'e.g. gpt-4o, claude-sonnet-4-20250514',
|
|
160
|
-
}));
|
|
161
|
-
if (p.isCancel(customModel)) {
|
|
162
|
-
p.cancel('Setup cancelled.');
|
|
163
|
-
process.exit(0);
|
|
128
|
+
// Local providers don't need an API key
|
|
129
|
+
if (providerKey === 'ollama' && !apiKey) {
|
|
130
|
+
apiKey = 'ollama';
|
|
164
131
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
132
|
+
// ── Step 3: Base URL (for custom/local) ────────────────────────────────
|
|
133
|
+
let baseUrl = preset.baseUrl;
|
|
134
|
+
if (providerKey === 'ollama') {
|
|
135
|
+
const customUrl = (await p.text({
|
|
136
|
+
message: `Ollama base URL:`,
|
|
137
|
+
placeholder: preset.baseUrl,
|
|
138
|
+
defaultValue: preset.baseUrl,
|
|
139
|
+
}));
|
|
140
|
+
if (p.isCancel(customUrl)) {
|
|
141
|
+
p.cancel('Setup cancelled.');
|
|
142
|
+
process.exit(0);
|
|
143
|
+
}
|
|
144
|
+
baseUrl = customUrl || preset.baseUrl;
|
|
145
|
+
}
|
|
146
|
+
// ── Step 4: Model ──────────────────────────────────────────────────────
|
|
147
|
+
let model = preset.models?.[0]?.id ?? '';
|
|
148
|
+
if (preset.models && preset.models.length > 0) {
|
|
149
|
+
const selected = (await p.select({
|
|
150
|
+
message: 'Default model:',
|
|
151
|
+
options: preset.models.map(m => ({ value: m.id, label: m.name })),
|
|
152
|
+
}));
|
|
153
|
+
if (p.isCancel(selected)) {
|
|
154
|
+
p.cancel('Setup cancelled.');
|
|
155
|
+
process.exit(0);
|
|
156
|
+
}
|
|
157
|
+
model = selected;
|
|
158
|
+
}
|
|
159
|
+
if (!model && !preset.models) {
|
|
160
|
+
const customModel = (await p.text({
|
|
161
|
+
message: 'Enter model ID:',
|
|
162
|
+
placeholder: 'e.g. gpt-4o, claude-sonnet-4-20250514',
|
|
163
|
+
}));
|
|
164
|
+
if (p.isCancel(customModel)) {
|
|
165
|
+
p.cancel('Setup cancelled.');
|
|
166
|
+
process.exit(0);
|
|
167
|
+
}
|
|
168
|
+
model = customModel || '';
|
|
169
|
+
}
|
|
170
|
+
// ── Write config files ─────────────────────────────────────────────────
|
|
171
|
+
const spinner = p.spinner();
|
|
172
|
+
spinner.start('Writing configuration…');
|
|
173
|
+
// config.json — minimal app config
|
|
174
|
+
writeJson(configFile, { gateway: {} });
|
|
175
|
+
// agent/models.json — provider registry
|
|
176
|
+
writeJson(`${agentDir}/models.json`, {
|
|
177
|
+
providers: {
|
|
178
|
+
[providerKey]: {
|
|
179
|
+
baseUrl,
|
|
180
|
+
api: preset.api,
|
|
181
|
+
...(preset.models ? { models: preset.models } : {}),
|
|
182
|
+
},
|
|
179
183
|
},
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
// agent/auth.json — API key
|
|
183
|
-
if (apiKey) {
|
|
184
|
-
writeJson(`${agentDir}/auth.json`, {
|
|
185
|
-
[providerKey]: { type: 'api_key', key: apiKey },
|
|
186
184
|
});
|
|
185
|
+
// agent/auth.json — API key
|
|
186
|
+
if (apiKey) {
|
|
187
|
+
writeJson(`${agentDir}/auth.json`, {
|
|
188
|
+
[providerKey]: { type: 'api_key', key: apiKey },
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
// agent/settings.json — Pi SDK settings (default model + provider)
|
|
192
|
+
writeJson(`${agentDir}/settings.json`, {
|
|
193
|
+
defaultModel: model,
|
|
194
|
+
defaultProvider: providerKey,
|
|
195
|
+
});
|
|
196
|
+
spinner.stop('Configuration saved.');
|
|
197
|
+
}
|
|
198
|
+
// ── Channels Setup ───────────────────────────────────────────────────────────
|
|
199
|
+
p.note('Vargos can connect to Telegram and WhatsApp so you can talk to your agent\n' +
|
|
200
|
+
'from your phone. You can skip this and set up channels later.', 'Communication');
|
|
201
|
+
const addChannel = (await p.confirm({
|
|
202
|
+
message: 'Set up a messaging channel now?',
|
|
203
|
+
initialValue: true,
|
|
204
|
+
}));
|
|
205
|
+
if (!p.isCancel(addChannel) && addChannel) {
|
|
206
|
+
const channelType = (await p.select({
|
|
207
|
+
message: 'Which channel?',
|
|
208
|
+
options: [
|
|
209
|
+
{ value: 'telegram', label: 'Telegram', hint: 'Bot API token required' },
|
|
210
|
+
{ value: 'whatsapp', label: 'WhatsApp', hint: 'QR code pairing' },
|
|
211
|
+
],
|
|
212
|
+
}));
|
|
213
|
+
if (!p.isCancel(channelType)) {
|
|
214
|
+
const channelId = (await p.text({
|
|
215
|
+
message: 'Channel ID (a short name for this connection):',
|
|
216
|
+
placeholder: channelType === 'telegram' ? 'telegram-bot' : 'whatsapp-personal',
|
|
217
|
+
validate(value) {
|
|
218
|
+
if (!value)
|
|
219
|
+
return 'Channel ID is required';
|
|
220
|
+
if (!/^[a-z0-9_-]+$/.test(value))
|
|
221
|
+
return 'Use lowercase letters, numbers, hyphens, underscores';
|
|
222
|
+
return;
|
|
223
|
+
},
|
|
224
|
+
}));
|
|
225
|
+
if (!p.isCancel(channelId)) {
|
|
226
|
+
try {
|
|
227
|
+
if (channelType === 'telegram') {
|
|
228
|
+
const tgBotKey = (await p.password({
|
|
229
|
+
message: 'Telegram Bot Token (from @BotFather):',
|
|
230
|
+
validate(value) {
|
|
231
|
+
if (!value)
|
|
232
|
+
return 'Bot token is required';
|
|
233
|
+
return;
|
|
234
|
+
},
|
|
235
|
+
}));
|
|
236
|
+
if (!p.isCancel(tgBotKey)) {
|
|
237
|
+
registerChannel({ id: channelId, type: 'telegram', botToken: tgBotKey });
|
|
238
|
+
p.note(`Channel "${channelId}" registered.\nRun vargos start to bring it online.`, 'Telegram');
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
// WhatsApp
|
|
243
|
+
registerChannel({ id: channelId, type: 'whatsapp' });
|
|
244
|
+
const pairNow = (await p.confirm({
|
|
245
|
+
message: 'Pair WhatsApp now? (QR code will appear in terminal)',
|
|
246
|
+
initialValue: true,
|
|
247
|
+
}));
|
|
248
|
+
if (!p.isCancel(pairNow) && pairNow) {
|
|
249
|
+
console.log('\n Scan the QR code with WhatsApp → Linked Devices\n');
|
|
250
|
+
try {
|
|
251
|
+
const { pairWhatsApp } = await import('./channels.js');
|
|
252
|
+
await pairWhatsApp(channelId);
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
p.note(`Pairing failed: ${err instanceof Error ? err.message : err}\nRun "vargos channels pair whatsapp ${channelId}" to try again.`, 'WhatsApp');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
p.note(`Channel "${channelId}" registered.\nRun "vargos channels pair whatsapp ${channelId}" to pair.`, 'WhatsApp');
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
catch (err) {
|
|
264
|
+
p.note(`Failed: ${err instanceof Error ? err.message : err}`, 'Error');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
187
268
|
}
|
|
188
|
-
// agent/settings.json — Pi SDK settings (default model + provider)
|
|
189
|
-
writeJson(`${agentDir}/settings.json`, {
|
|
190
|
-
defaultModel: model,
|
|
191
|
-
defaultProvider: providerKey,
|
|
192
|
-
});
|
|
193
|
-
spinner.stop('Configuration saved.');
|
|
194
269
|
// ── MCP Adapter Setup ────────────────────────────────────────────────────────
|
|
195
270
|
const enableMcp = (await p.confirm({
|
|
196
271
|
message: 'Enable MCP (Model Context Protocol) support for accessing tools in chat?',
|
|
@@ -224,17 +299,14 @@ export async function onboard() {
|
|
|
224
299
|
}
|
|
225
300
|
}
|
|
226
301
|
// ── Done ─────────────────────────────────────────────────────────────────
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
.filter(Boolean)
|
|
237
|
-
.join('\n'), 'Files written');
|
|
238
|
-
p.outro('Ready. Run vargos start to boot the server.');
|
|
302
|
+
if (!hasConfig) {
|
|
303
|
+
p.note([
|
|
304
|
+
`Config: ${configFile}`,
|
|
305
|
+
`Models: ${agentDir}/models.json`,
|
|
306
|
+
`Auth: ${agentDir}/auth.json`,
|
|
307
|
+
`Settings: ${agentDir}/settings.json`,
|
|
308
|
+
].join('\n'), 'Files written');
|
|
309
|
+
}
|
|
310
|
+
p.outro('Ready. Run vargos start to boot the server.\n Use vargos channels to manage messaging connections.');
|
|
239
311
|
}
|
|
240
312
|
//# sourceMappingURL=onboard.js.map
|
package/dist/cli/onboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboard.js","sourceRoot":"","sources":["../../cli/onboard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"onboard.js","sourceRoot":"","sources":["../../cli/onboard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eA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