@soleri/cli 8.1.1 → 9.0.1
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/commands/create.js +17 -4
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/telegram.js +0 -1
- package/dist/commands/telegram.js.map +1 -1
- package/dist/main.js +0 -2
- package/dist/main.js.map +1 -1
- package/dist/prompts/create-wizard.d.ts +2 -2
- package/dist/prompts/create-wizard.js +78 -430
- package/dist/prompts/create-wizard.js.map +1 -1
- package/package.json +3 -3
- package/src/commands/create.ts +20 -4
- package/src/commands/telegram.ts +0 -1
- package/src/main.ts +0 -3
- package/src/prompts/create-wizard.ts +78 -490
- package/src/commands/cognee.ts +0 -419
package/src/main.ts
CHANGED
|
@@ -20,7 +20,6 @@ import { registerPack } from './commands/pack.js';
|
|
|
20
20
|
import { registerSkills } from './commands/skills.js';
|
|
21
21
|
import { registerAgent } from './commands/agent.js';
|
|
22
22
|
import { registerTelegram } from './commands/telegram.js';
|
|
23
|
-
import { registerCognee } from './commands/cognee.js';
|
|
24
23
|
|
|
25
24
|
const require = createRequire(import.meta.url);
|
|
26
25
|
const { version } = require('../package.json');
|
|
@@ -81,6 +80,4 @@ registerPack(program);
|
|
|
81
80
|
registerSkills(program);
|
|
82
81
|
registerAgent(program);
|
|
83
82
|
registerTelegram(program);
|
|
84
|
-
registerCognee(program);
|
|
85
|
-
|
|
86
83
|
program.parse();
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Simplified create wizard — name + optional persona description.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The agent starts as a universal second brain with the Italian Craftsperson
|
|
5
|
+
* default persona. Everything else (domains, principles, skills) is discovered
|
|
6
|
+
* from usage, not configured upfront.
|
|
7
7
|
*/
|
|
8
8
|
import * as p from '@clack/prompts';
|
|
9
9
|
import type { AgentConfigInput } from '@soleri/forge/lib';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
DOMAIN_OPTIONS,
|
|
13
|
-
CUSTOM_DOMAIN_GUIDANCE,
|
|
14
|
-
PRINCIPLE_CATEGORIES,
|
|
15
|
-
CUSTOM_PRINCIPLE_GUIDANCE,
|
|
16
|
-
SKILL_CATEGORIES,
|
|
17
|
-
CORE_SKILLS,
|
|
18
|
-
ALL_OPTIONAL_SKILLS,
|
|
19
|
-
TONE_OPTIONS,
|
|
20
|
-
CUSTOM_ROLE_GUIDANCE,
|
|
21
|
-
CUSTOM_DESCRIPTION_GUIDANCE,
|
|
22
|
-
CUSTOM_GREETING_GUIDANCE,
|
|
23
|
-
} from './playbook.js';
|
|
10
|
+
import { ITALIAN_CRAFTSPERSON } from '@soleri/core';
|
|
24
11
|
|
|
25
12
|
/** Slugify a display name into a kebab-case ID. */
|
|
26
13
|
function slugify(name: string): string {
|
|
@@ -31,517 +18,118 @@ function slugify(name: string): string {
|
|
|
31
18
|
}
|
|
32
19
|
|
|
33
20
|
/**
|
|
34
|
-
* Run the
|
|
35
|
-
* Returns
|
|
21
|
+
* Run the simplified create wizard.
|
|
22
|
+
* Returns an AgentConfigInput or null if cancelled.
|
|
36
23
|
*/
|
|
37
24
|
export async function runCreateWizard(initialName?: string): Promise<AgentConfigInput | null> {
|
|
38
25
|
p.intro('Create a new Soleri agent');
|
|
39
26
|
|
|
40
|
-
// ─── Step 1:
|
|
41
|
-
const archetypeChoices = [
|
|
42
|
-
...ARCHETYPES.map((a) => ({
|
|
43
|
-
value: a.value,
|
|
44
|
-
label: a.label,
|
|
45
|
-
hint: a.hint,
|
|
46
|
-
})),
|
|
47
|
-
{
|
|
48
|
-
value: '_custom',
|
|
49
|
-
label: '\u2726 Create Custom',
|
|
50
|
-
hint: "I'll guide you through defining your own agent type",
|
|
51
|
-
},
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
const archetypeValues = await p.multiselect({
|
|
55
|
-
message: 'What kind of agent are you building? (select one or more)',
|
|
56
|
-
options: archetypeChoices,
|
|
57
|
-
required: false,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
if (p.isCancel(archetypeValues)) return null;
|
|
61
|
-
|
|
62
|
-
const selectedValues = archetypeValues as string[];
|
|
63
|
-
const isCustom = selectedValues.includes('_custom') || selectedValues.length === 0;
|
|
64
|
-
const selectedArchetypes = ARCHETYPES.filter((a) => selectedValues.includes(a.value));
|
|
65
|
-
|
|
66
|
-
// Merge defaults from all selected archetypes
|
|
67
|
-
function mergeDefaults(archetypes: Archetype[]) {
|
|
68
|
-
if (archetypes.length === 0) return null;
|
|
69
|
-
const domains = [...new Set(archetypes.flatMap((a) => a.defaults.domains))];
|
|
70
|
-
const principles = [...new Set(archetypes.flatMap((a) => a.defaults.principles))];
|
|
71
|
-
const skills = [...new Set(archetypes.flatMap((a) => a.defaults.skills))];
|
|
72
|
-
const tones = [...new Set(archetypes.map((a) => a.defaults.tone))];
|
|
73
|
-
return { domains, principles, skills, tones };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const merged = mergeDefaults(selectedArchetypes);
|
|
77
|
-
|
|
78
|
-
// ─── Step 2: Display name ─────────────────────────────────
|
|
79
|
-
const nameDefault =
|
|
80
|
-
selectedArchetypes.length === 1
|
|
81
|
-
? selectedArchetypes[0].label
|
|
82
|
-
: selectedArchetypes.length > 1
|
|
83
|
-
? selectedArchetypes.map((a) => a.label).join(' + ')
|
|
84
|
-
: undefined;
|
|
85
|
-
|
|
27
|
+
// ─── Step 1: Name ───────────────────────────────────────────
|
|
86
28
|
const name = (await p.text({
|
|
87
|
-
message: '
|
|
88
|
-
placeholder:
|
|
89
|
-
initialValue: initialName
|
|
29
|
+
message: 'What should your agent be called?',
|
|
30
|
+
placeholder: 'Ernesto',
|
|
31
|
+
initialValue: initialName,
|
|
90
32
|
validate: (v) => {
|
|
91
|
-
if (!v || v.length
|
|
33
|
+
if (!v || v.trim().length === 0) return 'Name is required';
|
|
34
|
+
if (v.length > 50) return 'Max 50 characters';
|
|
92
35
|
},
|
|
93
36
|
})) as string;
|
|
94
37
|
|
|
95
38
|
if (p.isCancel(name)) return null;
|
|
96
39
|
|
|
97
|
-
// ─── Step 3: Agent ID (auto-derived from name) ─────────────
|
|
98
40
|
const id = slugify(name);
|
|
99
41
|
|
|
100
|
-
// ─── Step
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (isCustom || selectedArchetypes.length > 1) {
|
|
104
|
-
if (isCustom) {
|
|
105
|
-
p.note(
|
|
106
|
-
[
|
|
107
|
-
CUSTOM_ROLE_GUIDANCE.instruction,
|
|
108
|
-
'',
|
|
109
|
-
'Examples:',
|
|
110
|
-
...CUSTOM_ROLE_GUIDANCE.examples.map((e) => ` "${e}"`),
|
|
111
|
-
].join('\n'),
|
|
112
|
-
'\u2726 Custom Agent Playbook',
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const rolePrompt = (await p.text({
|
|
117
|
-
message:
|
|
118
|
-
selectedArchetypes.length > 1
|
|
119
|
-
? 'Combined role (describe what this multi-purpose agent does)'
|
|
120
|
-
: 'What does your agent do? (one sentence)',
|
|
121
|
-
placeholder: 'Validates GraphQL schemas against federation rules',
|
|
122
|
-
validate: (v) => {
|
|
123
|
-
if (!v || v.length > 100) return 'Required (max 100 chars)';
|
|
124
|
-
},
|
|
125
|
-
})) as string;
|
|
126
|
-
|
|
127
|
-
if (p.isCancel(rolePrompt)) return null;
|
|
128
|
-
role = rolePrompt;
|
|
129
|
-
} else {
|
|
130
|
-
const prefilledRole = selectedArchetypes[0].defaults.role;
|
|
131
|
-
const editedRole = (await p.text({
|
|
132
|
-
message: 'Role (pre-filled, press Enter to accept)',
|
|
133
|
-
initialValue: prefilledRole,
|
|
134
|
-
validate: (v) => {
|
|
135
|
-
if (!v || v.length > 100) return 'Required (max 100 chars)';
|
|
136
|
-
},
|
|
137
|
-
})) as string;
|
|
138
|
-
|
|
139
|
-
if (p.isCancel(editedRole)) return null;
|
|
140
|
-
role = editedRole;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// ─── Step 5: Description ──────────────────────────────────
|
|
144
|
-
let description: string;
|
|
145
|
-
|
|
146
|
-
if (isCustom || selectedArchetypes.length > 1) {
|
|
147
|
-
if (isCustom) {
|
|
148
|
-
p.note(
|
|
149
|
-
[
|
|
150
|
-
CUSTOM_DESCRIPTION_GUIDANCE.instruction,
|
|
151
|
-
'',
|
|
152
|
-
'Example:',
|
|
153
|
-
...CUSTOM_DESCRIPTION_GUIDANCE.examples.map((e) => ` "${e}"`),
|
|
154
|
-
].join('\n'),
|
|
155
|
-
'\u2726 Description',
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const descPrompt = (await p.text({
|
|
160
|
-
message:
|
|
161
|
-
selectedArchetypes.length > 1
|
|
162
|
-
? 'Combined description (what does this multi-purpose agent do?)'
|
|
163
|
-
: 'Describe your agent in detail',
|
|
164
|
-
placeholder: 'This agent helps developers with...',
|
|
165
|
-
validate: (v) => {
|
|
166
|
-
if (!v || v.length < 10 || v.length > 500) return 'Required (10-500 chars)';
|
|
167
|
-
},
|
|
168
|
-
})) as string;
|
|
169
|
-
|
|
170
|
-
if (p.isCancel(descPrompt)) return null;
|
|
171
|
-
description = descPrompt;
|
|
172
|
-
} else {
|
|
173
|
-
const prefilledDesc = selectedArchetypes[0].defaults.description;
|
|
174
|
-
const editedDesc = (await p.text({
|
|
175
|
-
message: 'Description (pre-filled, press Enter to accept)',
|
|
176
|
-
initialValue: prefilledDesc,
|
|
177
|
-
validate: (v) => {
|
|
178
|
-
if (!v || v.length < 10 || v.length > 500) return 'Required (10-500 chars)';
|
|
179
|
-
},
|
|
180
|
-
})) as string;
|
|
181
|
-
|
|
182
|
-
if (p.isCancel(editedDesc)) return null;
|
|
183
|
-
description = editedDesc;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// ─── Step 6: Domains (multiselect) ────────────────────────
|
|
187
|
-
const preselectedDomains = new Set(merged?.domains ?? []);
|
|
188
|
-
|
|
189
|
-
const domainChoices = [
|
|
190
|
-
...DOMAIN_OPTIONS.map((d) => ({
|
|
191
|
-
value: d.value,
|
|
192
|
-
label: d.label,
|
|
193
|
-
hint: d.hint,
|
|
194
|
-
})),
|
|
195
|
-
{
|
|
196
|
-
value: '_custom',
|
|
197
|
-
label: '\u2726 Add custom domain...',
|
|
198
|
-
hint: 'Define your own domain with playbook guidance',
|
|
199
|
-
},
|
|
200
|
-
];
|
|
201
|
-
|
|
202
|
-
// Pre-select archetype domains via initialValues
|
|
203
|
-
const domainSelection = await p.multiselect({
|
|
204
|
-
message: 'Select domains (areas of expertise)',
|
|
205
|
-
options: domainChoices,
|
|
206
|
-
initialValues: [...preselectedDomains],
|
|
207
|
-
required: true,
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
if (p.isCancel(domainSelection)) return null;
|
|
211
|
-
|
|
212
|
-
const domains = (domainSelection as string[]).filter((d) => d !== '_custom');
|
|
213
|
-
const wantsCustomDomain = (domainSelection as string[]).includes('_custom');
|
|
214
|
-
|
|
215
|
-
if (wantsCustomDomain) {
|
|
216
|
-
p.note(
|
|
217
|
-
[
|
|
218
|
-
CUSTOM_DOMAIN_GUIDANCE.instruction,
|
|
219
|
-
'',
|
|
220
|
-
'Examples:',
|
|
221
|
-
...CUSTOM_DOMAIN_GUIDANCE.examples.map((e) => ` ${e}`),
|
|
222
|
-
'',
|
|
223
|
-
'Avoid:',
|
|
224
|
-
...CUSTOM_DOMAIN_GUIDANCE.antiExamples.map((e) => ` \u2717 ${e}`),
|
|
225
|
-
].join('\n'),
|
|
226
|
-
'\u2726 Custom Domain',
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
const customDomain = (await p.text({
|
|
230
|
-
message: 'Custom domain name (kebab-case)',
|
|
231
|
-
placeholder: 'graphql-federation',
|
|
232
|
-
validate: (v = '') => {
|
|
233
|
-
if (!/^[a-z][a-z0-9-]*$/.test(v)) return 'Must be kebab-case';
|
|
234
|
-
if (domains.includes(v)) return 'Already selected';
|
|
235
|
-
},
|
|
236
|
-
})) as string;
|
|
237
|
-
|
|
238
|
-
if (!p.isCancel(customDomain)) {
|
|
239
|
-
domains.push(customDomain);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (domains.length === 0) {
|
|
244
|
-
p.log.error('At least one domain is required');
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// ─── Step 7: Principles (multiselect) ─────────────────────
|
|
249
|
-
const preselectedPrinciples = new Set(merged?.principles ?? []);
|
|
250
|
-
|
|
251
|
-
// Flatten categories into a single options list with group labels
|
|
252
|
-
const principleChoices = PRINCIPLE_CATEGORIES.flatMap((cat) =>
|
|
253
|
-
cat.options.map((o) => ({
|
|
254
|
-
value: o.value,
|
|
255
|
-
label: o.label,
|
|
256
|
-
hint: cat.label,
|
|
257
|
-
})),
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
principleChoices.push({
|
|
261
|
-
value: '_custom',
|
|
262
|
-
label: '\u2726 Add custom principle...',
|
|
263
|
-
hint: 'Write your own guiding principle',
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
const principleSelection = await p.multiselect({
|
|
267
|
-
message: 'Select guiding principles',
|
|
268
|
-
options: principleChoices,
|
|
269
|
-
initialValues: [...preselectedPrinciples],
|
|
270
|
-
required: true,
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
if (p.isCancel(principleSelection)) return null;
|
|
274
|
-
|
|
275
|
-
const principles = (principleSelection as string[]).filter((p) => p !== '_custom');
|
|
276
|
-
const wantsCustomPrinciple = (principleSelection as string[]).includes('_custom');
|
|
277
|
-
|
|
278
|
-
if (wantsCustomPrinciple) {
|
|
279
|
-
p.note(
|
|
280
|
-
[
|
|
281
|
-
CUSTOM_PRINCIPLE_GUIDANCE.instruction,
|
|
282
|
-
'',
|
|
283
|
-
'Good principles are specific and actionable:',
|
|
284
|
-
...CUSTOM_PRINCIPLE_GUIDANCE.examples.map((e) => ` \u2713 "${e}"`),
|
|
285
|
-
'',
|
|
286
|
-
'Avoid vague principles:',
|
|
287
|
-
...CUSTOM_PRINCIPLE_GUIDANCE.antiExamples.map((e) => ` \u2717 ${e}`),
|
|
288
|
-
].join('\n'),
|
|
289
|
-
'\u2726 Custom Principle',
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
const customPrinciple = (await p.text({
|
|
293
|
-
message: 'Your custom principle',
|
|
294
|
-
placeholder: 'Every public API must have a deprecation path',
|
|
295
|
-
validate: (v) => {
|
|
296
|
-
if (!v) return 'Required';
|
|
297
|
-
if (v.length > 100) return 'Max 100 chars';
|
|
298
|
-
},
|
|
299
|
-
})) as string;
|
|
300
|
-
|
|
301
|
-
if (!p.isCancel(customPrinciple)) {
|
|
302
|
-
principles.push(customPrinciple);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
if (principles.length === 0) {
|
|
307
|
-
p.log.error('At least one principle is required');
|
|
308
|
-
return null;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// ─── Step 8: Communication tone ───────────────────────────
|
|
312
|
-
let defaultTone: 'precise' | 'mentor' | 'pragmatic';
|
|
313
|
-
|
|
314
|
-
if (merged && merged.tones.length === 1) {
|
|
315
|
-
defaultTone = merged.tones[0];
|
|
316
|
-
} else if (merged && merged.tones.length > 1) {
|
|
317
|
-
p.note(`Selected archetypes use different tones: ${merged.tones.join(', ')}`, 'Tone Conflict');
|
|
318
|
-
defaultTone = 'pragmatic';
|
|
319
|
-
} else {
|
|
320
|
-
defaultTone = 'pragmatic';
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const tone = await p.select({
|
|
324
|
-
message: 'Communication tone',
|
|
325
|
-
options: TONE_OPTIONS.map((t) => ({
|
|
326
|
-
value: t.value,
|
|
327
|
-
label: t.label,
|
|
328
|
-
hint: t.hint,
|
|
329
|
-
})),
|
|
330
|
-
initialValue: defaultTone,
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
if (p.isCancel(tone)) return null;
|
|
334
|
-
|
|
335
|
-
// ─── Step 9: Skills (multiselect) ─────────────────────────
|
|
336
|
-
const preselectedSkills = new Set(merged?.skills ?? []);
|
|
337
|
-
|
|
338
|
-
p.note(`Always included: ${CORE_SKILLS.join(', ')}`, 'Core Skills');
|
|
339
|
-
|
|
340
|
-
const skillChoices = SKILL_CATEGORIES.flatMap((cat) =>
|
|
341
|
-
cat.options.map((o) => ({
|
|
342
|
-
value: o.value,
|
|
343
|
-
label: o.label,
|
|
344
|
-
hint: `${o.hint} (${cat.label})`,
|
|
345
|
-
})),
|
|
346
|
-
);
|
|
347
|
-
|
|
348
|
-
const skillSelection = await p.multiselect({
|
|
349
|
-
message: 'Select additional skills',
|
|
350
|
-
options: skillChoices,
|
|
351
|
-
initialValues: [...preselectedSkills].filter((s) => ALL_OPTIONAL_SKILLS.includes(s)),
|
|
352
|
-
required: false,
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
if (p.isCancel(skillSelection)) return null;
|
|
356
|
-
|
|
357
|
-
const selectedSkills = [...CORE_SKILLS, ...(skillSelection as string[])];
|
|
358
|
-
|
|
359
|
-
// ─── Step 10: Greeting (auto or custom) ───────────────────
|
|
360
|
-
const autoGreeting =
|
|
361
|
-
selectedArchetypes.length === 1
|
|
362
|
-
? selectedArchetypes[0].defaults.greetingTemplate(name)
|
|
363
|
-
: `Hello! I'm ${name}. I ${role[0].toLowerCase()}${role.slice(1)}.`;
|
|
364
|
-
|
|
365
|
-
const greetingChoice = await p.select({
|
|
366
|
-
message: 'Greeting message',
|
|
42
|
+
// ─── Step 2: Optional persona description ───────────────────
|
|
43
|
+
const personaChoice = await p.select({
|
|
44
|
+
message: 'Persona',
|
|
367
45
|
options: [
|
|
368
46
|
{
|
|
369
|
-
value: '
|
|
370
|
-
label: `
|
|
371
|
-
hint: '
|
|
47
|
+
value: 'default',
|
|
48
|
+
label: `Italian Craftsperson (default)`,
|
|
49
|
+
hint: 'Warm, opinionated about quality, sprinkles Italian expressions — perfetto!',
|
|
372
50
|
},
|
|
373
51
|
{
|
|
374
52
|
value: 'custom',
|
|
375
|
-
label: '
|
|
376
|
-
hint: '
|
|
53
|
+
label: 'Describe your own persona',
|
|
54
|
+
hint: 'Tell me who your agent should be',
|
|
377
55
|
},
|
|
378
56
|
],
|
|
379
|
-
initialValue: 'auto',
|
|
380
57
|
});
|
|
381
58
|
|
|
382
|
-
if (p.isCancel(
|
|
383
|
-
|
|
384
|
-
let greeting: string;
|
|
59
|
+
if (p.isCancel(personaChoice)) return null;
|
|
385
60
|
|
|
386
|
-
|
|
387
|
-
p.note(
|
|
388
|
-
[
|
|
389
|
-
CUSTOM_GREETING_GUIDANCE.instruction,
|
|
390
|
-
'',
|
|
391
|
-
'Examples:',
|
|
392
|
-
...CUSTOM_GREETING_GUIDANCE.examples.map((e) => ` "${e}"`),
|
|
393
|
-
].join('\n'),
|
|
394
|
-
'\u2726 Custom Greeting',
|
|
395
|
-
);
|
|
61
|
+
let personaDescription: string | undefined;
|
|
396
62
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
63
|
+
if (personaChoice === 'custom') {
|
|
64
|
+
const desc = (await p.text({
|
|
65
|
+
message: "Describe your agent's personality (we'll generate the persona from this)",
|
|
66
|
+
placeholder: 'A calm Japanese sensei who speaks in zen metaphors and values harmony in code',
|
|
400
67
|
validate: (v) => {
|
|
401
|
-
if (!v || v.length < 10
|
|
68
|
+
if (!v || v.trim().length < 10) return 'Give at least a brief description (10+ chars)';
|
|
69
|
+
if (v.length > 500) return 'Max 500 characters';
|
|
402
70
|
},
|
|
403
71
|
})) as string;
|
|
404
72
|
|
|
405
|
-
if (p.isCancel(
|
|
406
|
-
|
|
407
|
-
} else {
|
|
408
|
-
greeting = autoGreeting;
|
|
73
|
+
if (p.isCancel(desc)) return null;
|
|
74
|
+
personaDescription = desc;
|
|
409
75
|
}
|
|
410
76
|
|
|
411
|
-
// ───
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
{
|
|
438
|
-
value: 'codex',
|
|
439
|
-
label: 'Codex',
|
|
440
|
-
hint: 'Codex integrations',
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
value: 'all',
|
|
444
|
-
label: 'All',
|
|
445
|
-
hint: 'OpenCode + Claude Code + Codex',
|
|
446
|
-
},
|
|
447
|
-
],
|
|
448
|
-
initialValue: 'opencode',
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
if (p.isCancel(setupTarget)) return null;
|
|
452
|
-
|
|
453
|
-
// ─── Step 13: Model selection ────────────────────────────
|
|
77
|
+
// ─── Build config ───────────────────────────────────────────
|
|
78
|
+
const persona = personaDescription
|
|
79
|
+
? {
|
|
80
|
+
template: 'custom',
|
|
81
|
+
name: name.trim(),
|
|
82
|
+
voice: personaDescription,
|
|
83
|
+
// Custom personas start with minimal config — the LLM enriches from the voice description
|
|
84
|
+
inspiration: '',
|
|
85
|
+
culture: '',
|
|
86
|
+
metaphors: [] as string[],
|
|
87
|
+
traits: [] as string[],
|
|
88
|
+
quirks: [] as string[],
|
|
89
|
+
opinions: [] as string[],
|
|
90
|
+
greetings: [`Hello! I'm ${name.trim()}. What are we working on?`],
|
|
91
|
+
signoffs: ['Until next time!'],
|
|
92
|
+
languageRule: "Speak the user's language naturally.",
|
|
93
|
+
nameRule: 'Adapt to name changes but keep character intact.',
|
|
94
|
+
}
|
|
95
|
+
: {
|
|
96
|
+
...ITALIAN_CRAFTSPERSON,
|
|
97
|
+
name: name.trim(),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const greeting = persona.greetings[0] ?? `Ciao! I'm ${name.trim()}. What are we working on?`;
|
|
101
|
+
|
|
102
|
+
// Summary
|
|
454
103
|
p.note(
|
|
455
104
|
[
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
105
|
+
`Name: ${name.trim()}`,
|
|
106
|
+
`ID: ${id}`,
|
|
107
|
+
`Persona: ${personaChoice === 'default' ? 'Italian Craftsperson' : 'Custom'}`,
|
|
108
|
+
'',
|
|
109
|
+
`Your agent starts as a universal second brain.`,
|
|
110
|
+
`It learns what it needs from your projects and conversations.`,
|
|
459
111
|
].join('\n'),
|
|
460
|
-
'
|
|
112
|
+
'Agent Summary',
|
|
461
113
|
);
|
|
462
114
|
|
|
463
|
-
const
|
|
464
|
-
message: '
|
|
465
|
-
|
|
466
|
-
// ── Free with Claude Max ──
|
|
467
|
-
{
|
|
468
|
-
value: 'claude-code-sonnet-4',
|
|
469
|
-
label: 'Claude 4 Sonnet (Max)',
|
|
470
|
-
hint: 'Free — balanced speed + quality (default)',
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
value: 'claude-code-opus-4',
|
|
474
|
-
label: 'Claude 4 Opus (Max)',
|
|
475
|
-
hint: 'Free — most capable, slower',
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
value: 'claude-code-3.5-haiku',
|
|
479
|
-
label: 'Claude 3.5 Haiku (Max)',
|
|
480
|
-
hint: 'Free — fastest Claude model',
|
|
481
|
-
},
|
|
482
|
-
// ── Anthropic API ──
|
|
483
|
-
{
|
|
484
|
-
value: 'claude-4-sonnet',
|
|
485
|
-
label: 'Claude 4 Sonnet (API)',
|
|
486
|
-
hint: 'Anthropic API key required',
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
value: 'claude-4-opus',
|
|
490
|
-
label: 'Claude 4 Opus (API)',
|
|
491
|
-
hint: 'Anthropic API key required',
|
|
492
|
-
},
|
|
493
|
-
// ── OpenAI ──
|
|
494
|
-
{
|
|
495
|
-
value: 'gpt-4.1',
|
|
496
|
-
label: 'GPT 4.1',
|
|
497
|
-
hint: 'OpenAI API key required',
|
|
498
|
-
},
|
|
499
|
-
{
|
|
500
|
-
value: 'o4-mini',
|
|
501
|
-
label: 'o4-mini',
|
|
502
|
-
hint: 'OpenAI API key — reasoning model',
|
|
503
|
-
},
|
|
504
|
-
// ── Google ──
|
|
505
|
-
{
|
|
506
|
-
value: 'gemini-2.5',
|
|
507
|
-
label: 'Gemini 2.5 Pro',
|
|
508
|
-
hint: 'Google API key required',
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
value: 'gemini-2.5-flash',
|
|
512
|
-
label: 'Gemini 2.5 Flash',
|
|
513
|
-
hint: 'Google API key — fast + cheap',
|
|
514
|
-
},
|
|
515
|
-
// ── Groq ──
|
|
516
|
-
{
|
|
517
|
-
value: 'llama-3.3-70b-versatile',
|
|
518
|
-
label: 'Llama 3.3 70B (Groq)',
|
|
519
|
-
hint: 'Groq API key — open source, fast',
|
|
520
|
-
},
|
|
521
|
-
// ── xAI ──
|
|
522
|
-
{
|
|
523
|
-
value: 'grok-3-beta',
|
|
524
|
-
label: 'Grok 3',
|
|
525
|
-
hint: 'xAI API key required',
|
|
526
|
-
},
|
|
527
|
-
],
|
|
528
|
-
initialValue: 'claude-code-sonnet-4',
|
|
115
|
+
const confirm = await p.confirm({
|
|
116
|
+
message: 'Create this agent?',
|
|
117
|
+
initialValue: true,
|
|
529
118
|
});
|
|
530
119
|
|
|
531
|
-
if (p.isCancel(
|
|
120
|
+
if (p.isCancel(confirm) || !confirm) return null;
|
|
532
121
|
|
|
533
122
|
return {
|
|
534
123
|
id,
|
|
535
|
-
name,
|
|
536
|
-
role,
|
|
537
|
-
description
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
124
|
+
name: name.trim(),
|
|
125
|
+
role: 'Your universal second brain — learns, remembers, improves',
|
|
126
|
+
description:
|
|
127
|
+
'A universal assistant that learns from your projects, captures knowledge, and gets smarter with every session.',
|
|
128
|
+
domains: [],
|
|
129
|
+
principles: [],
|
|
130
|
+
skills: [],
|
|
131
|
+
tone: 'mentor',
|
|
541
132
|
greeting,
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
model: model as string,
|
|
545
|
-
setupTarget: setupTarget as 'claude' | 'codex' | 'opencode' | 'all',
|
|
546
|
-
};
|
|
133
|
+
persona,
|
|
134
|
+
} as AgentConfigInput;
|
|
547
135
|
}
|