@pellux/goodvibes-agent 0.1.113 → 0.1.114
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/CHANGELOG.md +6 -0
- package/dist/package/main.js +736 -50
- package/package.json +1 -1
- package/src/agent/persona-discovery.ts +117 -0
- package/src/agent/routine-discovery.ts +115 -0
- package/src/cli/help.ts +9 -1
- package/src/cli/local-library-command.ts +81 -1
- package/src/cli/routines-command.ts +156 -1
- package/src/input/agent-workspace-basic-command-editors.ts +90 -0
- package/src/input/agent-workspace-categories.ts +4 -0
- package/src/input/agent-workspace-command-editor.ts +2 -0
- package/src/input/agent-workspace-types.ts +2 -0
- package/src/input/commands/personas-runtime.ts +87 -2
- package/src/input/commands/routines-runtime.ts +87 -2
- package/src/version.ts +1 -1
|
@@ -6,6 +6,8 @@ type AgentWorkspaceFieldReader = (fieldId: string) => string;
|
|
|
6
6
|
export type AgentWorkspaceBasicCommandEditorKind = Extract<
|
|
7
7
|
AgentWorkspaceEditorKind,
|
|
8
8
|
'knowledge-file' | 'knowledge-bookmarks' | 'knowledge-browser-history' | 'knowledge-connector-ingest' | 'tts-prompt' | 'image-input' | 'skill-bundle' | 'skill-discovery-import' | 'profile-template-export' | 'profile-template-import'
|
|
9
|
+
| 'persona-discovery-import'
|
|
10
|
+
| 'routine-discovery-import'
|
|
9
11
|
| 'mcp-server' | 'notify-webhook' | 'notify-webhook-remove' | 'notify-webhook-test'
|
|
10
12
|
>;
|
|
11
13
|
|
|
@@ -39,6 +41,8 @@ export function isAgentWorkspaceBasicCommandEditorKind(kind: AgentWorkspaceEdito
|
|
|
39
41
|
|| kind === 'tts-prompt'
|
|
40
42
|
|| kind === 'image-input'
|
|
41
43
|
|| kind === 'skill-bundle'
|
|
44
|
+
|| kind === 'persona-discovery-import'
|
|
45
|
+
|| kind === 'routine-discovery-import'
|
|
42
46
|
|| kind === 'skill-discovery-import'
|
|
43
47
|
|| kind === 'profile-template-export'
|
|
44
48
|
|| kind === 'profile-template-import'
|
|
@@ -236,6 +240,34 @@ export function createAgentWorkspaceBasicCommandEditor(kind: AgentWorkspaceBasic
|
|
|
236
240
|
],
|
|
237
241
|
};
|
|
238
242
|
}
|
|
243
|
+
if (kind === 'persona-discovery-import') {
|
|
244
|
+
return {
|
|
245
|
+
kind,
|
|
246
|
+
mode: 'create',
|
|
247
|
+
title: 'Import Discovered Persona',
|
|
248
|
+
selectedFieldIndex: 0,
|
|
249
|
+
message: 'Import one discovered persona markdown file into the Agent-local persona registry. Type yes on the final field to confirm.',
|
|
250
|
+
fields: [
|
|
251
|
+
{ id: 'name', label: 'Discovered persona', value: '', required: true, multiline: false, hint: 'Name shown by /personas discover.' },
|
|
252
|
+
{ id: 'use', label: 'Use now', value: 'yes', required: false, multiline: false, hint: 'yes/no.' },
|
|
253
|
+
{ id: 'confirm', label: 'Confirm', value: '', required: true, multiline: false, hint: 'Type yes to run /personas import-discovered with --yes.' },
|
|
254
|
+
],
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
if (kind === 'routine-discovery-import') {
|
|
258
|
+
return {
|
|
259
|
+
kind,
|
|
260
|
+
mode: 'create',
|
|
261
|
+
title: 'Import Discovered Routine',
|
|
262
|
+
selectedFieldIndex: 0,
|
|
263
|
+
message: 'Import one discovered routine markdown file into the Agent-local routine registry. Type yes on the final field to confirm.',
|
|
264
|
+
fields: [
|
|
265
|
+
{ id: 'name', label: 'Discovered routine', value: '', required: true, multiline: false, hint: 'Name shown by /routines discover.' },
|
|
266
|
+
{ id: 'enabled', label: 'Enable now', value: 'yes', required: false, multiline: false, hint: 'yes/no.' },
|
|
267
|
+
{ id: 'confirm', label: 'Confirm', value: '', required: true, multiline: false, hint: 'Type yes to run /routines import-discovered with --yes.' },
|
|
268
|
+
],
|
|
269
|
+
};
|
|
270
|
+
}
|
|
239
271
|
return {
|
|
240
272
|
kind,
|
|
241
273
|
mode: 'create',
|
|
@@ -595,6 +627,64 @@ export function buildAgentWorkspaceBasicCommandEditorSubmission(
|
|
|
595
627
|
},
|
|
596
628
|
};
|
|
597
629
|
}
|
|
630
|
+
if (editor.kind === 'persona-discovery-import') {
|
|
631
|
+
if (!isAffirmative(readField('confirm'))) {
|
|
632
|
+
return {
|
|
633
|
+
kind: 'editor',
|
|
634
|
+
editor: { ...editor, message: 'Discovered persona import not confirmed. Type yes, then press Enter.' },
|
|
635
|
+
status: 'Agent persona import not confirmed.',
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
const parts = [
|
|
639
|
+
'/personas',
|
|
640
|
+
'import-discovered',
|
|
641
|
+
quoteSlashCommandArg(readField('name')),
|
|
642
|
+
];
|
|
643
|
+
if (isAffirmative(readField('use'))) parts.push('--use');
|
|
644
|
+
parts.push('--yes');
|
|
645
|
+
const command = parts.join(' ');
|
|
646
|
+
return {
|
|
647
|
+
kind: 'dispatch',
|
|
648
|
+
command,
|
|
649
|
+
status: 'Opening discovered persona import.',
|
|
650
|
+
actionResult: {
|
|
651
|
+
kind: 'dispatched',
|
|
652
|
+
title: 'Opening discovered persona import',
|
|
653
|
+
detail: 'The workspace handed a confirmed local persona import command to the shell-owned command router.',
|
|
654
|
+
command,
|
|
655
|
+
safety: 'safe',
|
|
656
|
+
},
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
if (editor.kind === 'routine-discovery-import') {
|
|
660
|
+
if (!isAffirmative(readField('confirm'))) {
|
|
661
|
+
return {
|
|
662
|
+
kind: 'editor',
|
|
663
|
+
editor: { ...editor, message: 'Discovered routine import not confirmed. Type yes, then press Enter.' },
|
|
664
|
+
status: 'Agent routine import not confirmed.',
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
const parts = [
|
|
668
|
+
'/routines',
|
|
669
|
+
'import-discovered',
|
|
670
|
+
quoteSlashCommandArg(readField('name')),
|
|
671
|
+
];
|
|
672
|
+
if (isAffirmative(readField('enabled'))) parts.push('--enabled');
|
|
673
|
+
parts.push('--yes');
|
|
674
|
+
const command = parts.join(' ');
|
|
675
|
+
return {
|
|
676
|
+
kind: 'dispatch',
|
|
677
|
+
command,
|
|
678
|
+
status: 'Opening discovered routine import.',
|
|
679
|
+
actionResult: {
|
|
680
|
+
kind: 'dispatched',
|
|
681
|
+
title: 'Opening discovered routine import',
|
|
682
|
+
detail: 'The workspace handed a confirmed local routine import command to the shell-owned command router.',
|
|
683
|
+
command,
|
|
684
|
+
safety: 'safe',
|
|
685
|
+
},
|
|
686
|
+
};
|
|
687
|
+
}
|
|
598
688
|
const commandParts = [
|
|
599
689
|
'/agent-skills bundle create',
|
|
600
690
|
'--name',
|
|
@@ -158,6 +158,8 @@ export const AGENT_WORKSPACE_CATEGORIES: readonly AgentWorkspaceCategory[] = [
|
|
|
158
158
|
actions: [
|
|
159
159
|
{ id: 'personas-list', label: 'List personas', detail: 'Print the full local persona library.', command: '/personas list', kind: 'command', safety: 'read-only' },
|
|
160
160
|
{ id: 'personas-active', label: 'Show active persona', detail: 'Inspect the active local persona applied to new turns.', command: '/personas active', kind: 'command', safety: 'read-only' },
|
|
161
|
+
{ id: 'personas-discover', label: 'Discover persona files', detail: 'Scan project and global Agent persona folders for persona markdown without importing it.', command: '/personas discover', kind: 'command', safety: 'read-only' },
|
|
162
|
+
{ id: 'personas-import-discovered', label: 'Import discovered persona', detail: 'Open an in-workspace form that imports one reviewed persona markdown file into the Agent-local persona registry after typed confirmation.', editorKind: 'persona-discovery-import', kind: 'editor', safety: 'safe' },
|
|
161
163
|
{ id: 'personas-prev', label: 'Previous persona', detail: 'Move the local persona selection up without changing active state.', localKind: 'persona', selectionDelta: -1, kind: 'local-selection', safety: 'safe' },
|
|
162
164
|
{ id: 'personas-next', label: 'Next persona', detail: 'Move the local persona selection down without changing active state.', localKind: 'persona', selectionDelta: 1, kind: 'local-selection', safety: 'safe' },
|
|
163
165
|
{ id: 'personas-create', label: 'Create persona', detail: 'Open an in-workspace form for a local persona that writes Agent-local state only.', editorKind: 'persona', kind: 'editor', safety: 'safe' },
|
|
@@ -200,6 +202,8 @@ export const AGENT_WORKSPACE_CATEGORIES: readonly AgentWorkspaceCategory[] = [
|
|
|
200
202
|
actions: [
|
|
201
203
|
{ id: 'routines-list', label: 'List routines', detail: 'Print the full local Agent routine library.', command: '/routines list', kind: 'command', safety: 'read-only' },
|
|
202
204
|
{ id: 'routines-enabled', label: 'Enabled routines', detail: 'Show routines available for direct use.', command: '/routines enabled', kind: 'command', safety: 'read-only' },
|
|
205
|
+
{ id: 'routines-discover', label: 'Discover routine files', detail: 'Scan project and global Agent routine folders for routine markdown without importing it.', command: '/routines discover', kind: 'command', safety: 'read-only' },
|
|
206
|
+
{ id: 'routines-import-discovered', label: 'Import discovered routine', detail: 'Open an in-workspace form that imports one reviewed routine markdown file into the Agent-local routine registry after typed confirmation.', editorKind: 'routine-discovery-import', kind: 'editor', safety: 'safe' },
|
|
203
207
|
{ id: 'routines-prev', label: 'Previous routine', detail: 'Move the local routine selection up without changing enabled state.', localKind: 'routine', selectionDelta: -1, kind: 'local-selection', safety: 'safe' },
|
|
204
208
|
{ id: 'routines-next', label: 'Next routine', detail: 'Move the local routine selection down without changing enabled state.', localKind: 'routine', selectionDelta: 1, kind: 'local-selection', safety: 'safe' },
|
|
205
209
|
{ id: 'routines-create', label: 'Create routine', detail: 'Open an in-workspace form for a repeatable local workflow that writes Agent-local state only.', editorKind: 'routine', kind: 'editor', safety: 'safe' },
|
|
@@ -24,6 +24,8 @@ type AgentWorkspaceCommandEditorKind = Extract<
|
|
|
24
24
|
| 'tts-prompt'
|
|
25
25
|
| 'image-input'
|
|
26
26
|
| 'skill-bundle'
|
|
27
|
+
| 'persona-discovery-import'
|
|
28
|
+
| 'routine-discovery-import'
|
|
27
29
|
| 'skill-discovery-import'
|
|
28
30
|
| 'profile-template-export'
|
|
29
31
|
| 'profile-template-import'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { discoverPersonas, type DiscoveredPersonaRecord } from '../../agent/persona-discovery.ts';
|
|
1
2
|
import { AgentPersonaRegistry, type AgentPersonaRecord } from '../../agent/persona-registry.ts';
|
|
2
3
|
import type { CommandContext, CommandRegistry } from '../command-registry.ts';
|
|
3
4
|
import { requireShellPaths } from './runtime-services.ts';
|
|
@@ -82,6 +83,82 @@ function renderPersona(persona: AgentPersonaRecord, activePersonaId: string | nu
|
|
|
82
83
|
].filter(Boolean).join('\n');
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
function summarizeDiscoveredPersona(persona: DiscoveredPersonaRecord): string {
|
|
87
|
+
const description = persona.description ? ` - ${persona.description}` : '';
|
|
88
|
+
return ` ${persona.name} ${persona.origin}${description}\n path: ${persona.path}`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function renderDiscoveredPersonas(personas: readonly DiscoveredPersonaRecord[]): string {
|
|
92
|
+
if (personas.length === 0) {
|
|
93
|
+
return [
|
|
94
|
+
'Discovered Agent persona files',
|
|
95
|
+
' No persona markdown files found in project/global Agent persona folders.',
|
|
96
|
+
' Search roots: .goodvibes/personas, .goodvibes/agent/personas, .goodvibes/agents, ~/.goodvibes/personas, ~/.goodvibes/agent/personas, ~/.goodvibes/agents',
|
|
97
|
+
].join('\n');
|
|
98
|
+
}
|
|
99
|
+
return [
|
|
100
|
+
`Discovered Agent persona files (${personas.length})`,
|
|
101
|
+
...personas.map(summarizeDiscoveredPersona),
|
|
102
|
+
'',
|
|
103
|
+
'Import one with: /personas import-discovered <name> --yes',
|
|
104
|
+
].join('\n');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function discoveredPersonaLookupValues(persona: DiscoveredPersonaRecord): readonly string[] {
|
|
108
|
+
const slug = persona.name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
109
|
+
const basename = persona.path.split(/[\\/]/).pop()?.replace(/\.md$/i, '') ?? '';
|
|
110
|
+
return [persona.name, slug, persona.path, basename].map((value) => value.trim().toLowerCase()).filter(Boolean);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function findDiscoveredPersona(personas: readonly DiscoveredPersonaRecord[], idOrName: string): DiscoveredPersonaRecord | null {
|
|
114
|
+
const lookup = idOrName.trim().toLowerCase();
|
|
115
|
+
if (!lookup) return null;
|
|
116
|
+
return personas.find((persona) => discoveredPersonaLookupValues(persona).includes(lookup)) ?? null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function frontmatterList(persona: DiscoveredPersonaRecord, key: string): readonly string[] {
|
|
120
|
+
const value = persona.frontmatter[key];
|
|
121
|
+
if (!value) return [];
|
|
122
|
+
return splitList(value);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function importDiscoveredPersona(args: readonly string[], ctx: CommandContext, personaRegistry: AgentPersonaRegistry): Promise<void> {
|
|
126
|
+
const parsed = parsePersonaArgs(args);
|
|
127
|
+
const name = parsed.rest.join(' ').trim();
|
|
128
|
+
if (!name) {
|
|
129
|
+
ctx.print('Usage: /personas import-discovered <name> [--use] --yes');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const discovered = findDiscoveredPersona(await discoverPersonas(requireShellPaths(ctx)), name);
|
|
133
|
+
if (!discovered) {
|
|
134
|
+
ctx.print(`Unknown discovered Agent persona: ${name}\nRun /personas discover to inspect available persona files.`);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (!parsed.yes) {
|
|
138
|
+
ctx.print([
|
|
139
|
+
'Agent persona import preview',
|
|
140
|
+
` name: ${discovered.name}`,
|
|
141
|
+
` origin: ${discovered.origin}`,
|
|
142
|
+
` path: ${discovered.path}`,
|
|
143
|
+
` description: ${discovered.description || '(none)'}`,
|
|
144
|
+
` body characters: ${discovered.body.length}`,
|
|
145
|
+
' next: rerun with --yes to import into the Agent-local persona registry',
|
|
146
|
+
].join('\n'));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const persona = personaRegistry.create({
|
|
150
|
+
name: discovered.name,
|
|
151
|
+
description: discovered.description || `Imported persona from ${discovered.origin} markdown file.`,
|
|
152
|
+
body: discovered.body,
|
|
153
|
+
tags: frontmatterList(discovered, 'tags'),
|
|
154
|
+
triggers: frontmatterList(discovered, 'triggers'),
|
|
155
|
+
source: 'imported',
|
|
156
|
+
provenance: `discovered:${discovered.origin}:${discovered.path}`,
|
|
157
|
+
});
|
|
158
|
+
if (parsed.flags.get('use') === 'true') personaRegistry.setActive(persona.id);
|
|
159
|
+
ctx.print(`Imported Agent persona ${persona.id}: ${persona.name}${parsed.flags.get('use') === 'true' ? ' (active)' : ''}`);
|
|
160
|
+
}
|
|
161
|
+
|
|
85
162
|
function requiredFlag(flags: ReadonlyMap<string, string>, key: string): string {
|
|
86
163
|
const value = flags.get(key)?.trim();
|
|
87
164
|
if (!value) throw new Error(`Missing --${key}.`);
|
|
@@ -97,7 +174,7 @@ export function registerPersonasRuntimeCommands(registry: CommandRegistry): void
|
|
|
97
174
|
name: 'personas',
|
|
98
175
|
aliases: ['persona'],
|
|
99
176
|
description: 'Manage local GoodVibes Agent personas',
|
|
100
|
-
usage: '[list|search <query>|show <id>|create --name <name> --description <summary> --body <instructions>|update <id> [--name ...] [--description ...] [--body ...]|use <id>|active|clear|review <id>|stale <id> <reason...>|delete <id> --yes]',
|
|
177
|
+
usage: '[list|discover|import-discovered <name> --yes|search <query>|show <id>|create --name <name> --description <summary> --body <instructions>|update <id> [--name ...] [--description ...] [--body ...]|use <id>|active|clear|review <id>|stale <id> <reason...>|delete <id> --yes]',
|
|
101
178
|
async handler(args, ctx) {
|
|
102
179
|
const sub = (args[0] ?? 'list').toLowerCase();
|
|
103
180
|
const registryStore = registryFromContext(ctx);
|
|
@@ -106,6 +183,14 @@ export function registerPersonasRuntimeCommands(registry: CommandRegistry): void
|
|
|
106
183
|
ctx.print(renderList('Agent Personas', registryStore, registryStore.list()));
|
|
107
184
|
return;
|
|
108
185
|
}
|
|
186
|
+
if (sub === 'discover' || sub === 'discovered') {
|
|
187
|
+
ctx.print(renderDiscoveredPersonas(await discoverPersonas(requireShellPaths(ctx))));
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (sub === 'import-discovered' || sub === 'import-persona') {
|
|
191
|
+
await importDiscoveredPersona(args.slice(1), ctx, registryStore);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
109
194
|
if (sub === 'search') {
|
|
110
195
|
const query = args.slice(1).join(' ').trim();
|
|
111
196
|
ctx.print(renderList(query ? `Agent Personas matching "${query}"` : 'Agent Personas', registryStore, registryStore.search(query)));
|
|
@@ -210,7 +295,7 @@ export function registerPersonasRuntimeCommands(registry: CommandRegistry): void
|
|
|
210
295
|
ctx.print(`Deleted Agent persona ${removed.id}: ${removed.name}`);
|
|
211
296
|
return;
|
|
212
297
|
}
|
|
213
|
-
ctx.print('Usage: /personas [list|search <query>|show <id>|create|update|use|active|clear|review|stale|delete]');
|
|
298
|
+
ctx.print('Usage: /personas [list|discover|import-discovered|search <query>|show <id>|create|update|use|active|clear|review|stale|delete]');
|
|
214
299
|
} catch (error) {
|
|
215
300
|
printError(ctx, error);
|
|
216
301
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { discoverRoutines, type DiscoveredRoutineRecord } from '../../agent/routine-discovery.ts';
|
|
1
2
|
import { AgentRoutineRegistry, type AgentRoutineRecord } from '../../agent/routine-registry.ts';
|
|
2
3
|
import {
|
|
3
4
|
buildRoutineSchedulePreview,
|
|
@@ -111,10 +112,86 @@ function renderRoutine(routine: AgentRoutineRecord): string {
|
|
|
111
112
|
].filter(Boolean).join('\n');
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
function summarizeDiscoveredRoutine(routine: DiscoveredRoutineRecord): string {
|
|
116
|
+
const description = routine.description ? ` - ${routine.description}` : '';
|
|
117
|
+
return ` ${routine.name} ${routine.origin}${description}\n path: ${routine.path}`;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function renderDiscoveredRoutines(routines: readonly DiscoveredRoutineRecord[]): string {
|
|
121
|
+
if (routines.length === 0) {
|
|
122
|
+
return [
|
|
123
|
+
'Discovered Agent routine files',
|
|
124
|
+
' No routine markdown files found in project/global Agent routine folders.',
|
|
125
|
+
' Search roots: .goodvibes/routines, .goodvibes/agent/routines, ~/.goodvibes/routines, ~/.goodvibes/agent/routines',
|
|
126
|
+
].join('\n');
|
|
127
|
+
}
|
|
128
|
+
return [
|
|
129
|
+
`Discovered Agent routine files (${routines.length})`,
|
|
130
|
+
...routines.map(summarizeDiscoveredRoutine),
|
|
131
|
+
'',
|
|
132
|
+
'Import one with: /routines import-discovered <name> --yes',
|
|
133
|
+
].join('\n');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function discoveredRoutineLookupValues(routine: DiscoveredRoutineRecord): readonly string[] {
|
|
137
|
+
const slug = routine.name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
138
|
+
const basename = routine.path.split(/[\\/]/).pop()?.replace(/\.md$/i, '') ?? '';
|
|
139
|
+
return [routine.name, slug, routine.path, basename].map((value) => value.trim().toLowerCase()).filter(Boolean);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function findDiscoveredRoutine(routines: readonly DiscoveredRoutineRecord[], idOrName: string): DiscoveredRoutineRecord | null {
|
|
143
|
+
const lookup = idOrName.trim().toLowerCase();
|
|
144
|
+
if (!lookup) return null;
|
|
145
|
+
return routines.find((routine) => discoveredRoutineLookupValues(routine).includes(lookup)) ?? null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function frontmatterList(routine: DiscoveredRoutineRecord, key: string): readonly string[] {
|
|
149
|
+
const value = routine.frontmatter[key];
|
|
150
|
+
if (!value) return [];
|
|
151
|
+
return splitList(value);
|
|
152
|
+
}
|
|
153
|
+
|
|
114
154
|
function printError(ctx: CommandContext, error: unknown): void {
|
|
115
155
|
ctx.print(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
116
156
|
}
|
|
117
157
|
|
|
158
|
+
async function importDiscoveredRoutine(args: readonly string[], ctx: CommandContext, routineRegistry: AgentRoutineRegistry): Promise<void> {
|
|
159
|
+
const parsed = parseRoutineArgs(args);
|
|
160
|
+
const name = parsed.rest.join(' ').trim();
|
|
161
|
+
if (!name) {
|
|
162
|
+
ctx.print('Usage: /routines import-discovered <name> [--enabled] --yes');
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const discovered = findDiscoveredRoutine(await discoverRoutines(requireShellPaths(ctx)), name);
|
|
166
|
+
if (!discovered) {
|
|
167
|
+
ctx.print(`Unknown discovered Agent routine: ${name}\nRun /routines discover to inspect available routine files.`);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (!parsed.yes) {
|
|
171
|
+
ctx.print([
|
|
172
|
+
'Agent routine import preview',
|
|
173
|
+
` name: ${discovered.name}`,
|
|
174
|
+
` origin: ${discovered.origin}`,
|
|
175
|
+
` path: ${discovered.path}`,
|
|
176
|
+
` description: ${discovered.description || '(none)'}`,
|
|
177
|
+
` steps characters: ${discovered.steps.length}`,
|
|
178
|
+
' next: rerun with --yes to import into the Agent-local routine registry',
|
|
179
|
+
].join('\n'));
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const routine = routineRegistry.create({
|
|
183
|
+
name: discovered.name,
|
|
184
|
+
description: discovered.description || `Imported routine from ${discovered.origin} markdown file.`,
|
|
185
|
+
steps: discovered.steps,
|
|
186
|
+
tags: frontmatterList(discovered, 'tags'),
|
|
187
|
+
triggers: frontmatterList(discovered, 'triggers'),
|
|
188
|
+
enabled: parsed.flags.get('enabled') === 'true',
|
|
189
|
+
source: 'imported',
|
|
190
|
+
provenance: `discovered:${discovered.origin}:${discovered.path}`,
|
|
191
|
+
});
|
|
192
|
+
ctx.print(`Imported Agent routine ${routine.id}: ${routine.name}${routine.enabled ? ' (enabled)' : ''}`);
|
|
193
|
+
}
|
|
194
|
+
|
|
118
195
|
async function promoteRoutine(args: readonly string[], routineRegistry: AgentRoutineRegistry, ctx: CommandContext): Promise<void> {
|
|
119
196
|
const parsed = parseRoutineSchedulePromotionArgs(args);
|
|
120
197
|
if (parsed.errors.length > 0) {
|
|
@@ -154,6 +231,14 @@ export async function runRoutinesRuntimeCommand(args: readonly string[], ctx: Co
|
|
|
154
231
|
ctx.print(renderList('Enabled Agent Routines', routineRegistry, snapshot.enabledRoutines));
|
|
155
232
|
return;
|
|
156
233
|
}
|
|
234
|
+
if (sub === 'discover' || sub === 'discovered') {
|
|
235
|
+
ctx.print(renderDiscoveredRoutines(await discoverRoutines(requireShellPaths(ctx))));
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (sub === 'import-discovered' || sub === 'import-routine') {
|
|
239
|
+
await importDiscoveredRoutine(args.slice(1), ctx, routineRegistry);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
157
242
|
if (sub === 'search') {
|
|
158
243
|
const query = args.slice(1).join(' ').trim();
|
|
159
244
|
ctx.print(renderList(query ? `Agent Routines matching "${query}"` : 'Agent Routines', routineRegistry, routineRegistry.search(query)));
|
|
@@ -288,7 +373,7 @@ export async function runRoutinesRuntimeCommand(args: readonly string[], ctx: Co
|
|
|
288
373
|
ctx.print(`Deleted Agent routine ${removed.id}: ${removed.name}`);
|
|
289
374
|
return;
|
|
290
375
|
}
|
|
291
|
-
ctx.print('Usage: /routines [list|enabled|search|show|receipts|reconcile|receipt|create|update|enable|disable|start|review|stale|promote|delete]');
|
|
376
|
+
ctx.print('Usage: /routines [list|enabled|discover|import-discovered|search|show|receipts|reconcile|receipt|create|update|enable|disable|start|review|stale|promote|delete]');
|
|
292
377
|
} catch (error) {
|
|
293
378
|
printError(ctx, error);
|
|
294
379
|
}
|
|
@@ -299,7 +384,7 @@ export function registerRoutinesRuntimeCommands(registry: CommandRegistry): void
|
|
|
299
384
|
name: 'routines',
|
|
300
385
|
aliases: ['routine'],
|
|
301
386
|
description: 'Manage local GoodVibes Agent routines',
|
|
302
|
-
usage: '[list|enabled|search <query>|show <id>|receipts|reconcile|receipt <id>|create --name <name> --description <summary> --steps <steps>|update <id> [--name ...] [--description ...] [--steps ...]|enable <id>|disable <id>|start <id>|review <id>|stale <id> <reason...>|promote <id> --cron <expr> [--delivery-channel slack] --yes|delete <id> --yes]',
|
|
387
|
+
usage: '[list|enabled|discover|import-discovered <name> --yes|search <query>|show <id>|receipts|reconcile|receipt <id>|create --name <name> --description <summary> --steps <steps>|update <id> [--name ...] [--description ...] [--steps ...]|enable <id>|disable <id>|start <id>|review <id>|stale <id> <reason...>|promote <id> --cron <expr> [--delivery-channel slack] --yes|delete <id> --yes]',
|
|
303
388
|
handler: runRoutinesRuntimeCommand,
|
|
304
389
|
});
|
|
305
390
|
}
|
package/src/version.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from 'node:path';
|
|
|
6
6
|
// The prebuild script updates the fallback value before compilation.
|
|
7
7
|
// Uses import.meta.dir (Bun) to locate package.json relative to this file,
|
|
8
8
|
// which is correct regardless of the process working directory.
|
|
9
|
-
let _version = '0.1.
|
|
9
|
+
let _version = '0.1.114';
|
|
10
10
|
let _sdkVersion = '0.33.35';
|
|
11
11
|
try {
|
|
12
12
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf-8')) as {
|