@vibe-agent-toolkit/vat-example-cat-agents 0.1.2-rc.4
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/README.md +697 -0
- package/dist/conversational-assistant/breed-advisor.d.ts +24 -0
- package/dist/conversational-assistant/breed-advisor.d.ts.map +1 -0
- package/dist/conversational-assistant/breed-advisor.js +390 -0
- package/dist/conversational-assistant/breed-advisor.js.map +1 -0
- package/dist/conversational-assistant/breed-knowledge.d.ts +42 -0
- package/dist/conversational-assistant/breed-knowledge.d.ts.map +1 -0
- package/dist/conversational-assistant/breed-knowledge.js +335 -0
- package/dist/conversational-assistant/breed-knowledge.js.map +1 -0
- package/dist/external-event-integrator/human-approval.d.ts +207 -0
- package/dist/external-event-integrator/human-approval.d.ts.map +1 -0
- package/dist/external-event-integrator/human-approval.js +387 -0
- package/dist/external-event-integrator/human-approval.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-collections.d.ts +30 -0
- package/dist/mcp-collections.d.ts.map +1 -0
- package/dist/mcp-collections.js +58 -0
- package/dist/mcp-collections.js.map +1 -0
- package/dist/one-shot-llm-analyzer/description-parser.d.ts +55 -0
- package/dist/one-shot-llm-analyzer/description-parser.d.ts.map +1 -0
- package/dist/one-shot-llm-analyzer/description-parser.js +349 -0
- package/dist/one-shot-llm-analyzer/description-parser.js.map +1 -0
- package/dist/one-shot-llm-analyzer/haiku-generator.d.ts +157 -0
- package/dist/one-shot-llm-analyzer/haiku-generator.d.ts.map +1 -0
- package/dist/one-shot-llm-analyzer/haiku-generator.js +66 -0
- package/dist/one-shot-llm-analyzer/haiku-generator.js.map +1 -0
- package/dist/one-shot-llm-analyzer/name-generator.d.ts +157 -0
- package/dist/one-shot-llm-analyzer/name-generator.d.ts.map +1 -0
- package/dist/one-shot-llm-analyzer/name-generator.js +121 -0
- package/dist/one-shot-llm-analyzer/name-generator.js.map +1 -0
- package/dist/one-shot-llm-analyzer/photo-analyzer.d.ts +57 -0
- package/dist/one-shot-llm-analyzer/photo-analyzer.d.ts.map +1 -0
- package/dist/one-shot-llm-analyzer/photo-analyzer.js +288 -0
- package/dist/one-shot-llm-analyzer/photo-analyzer.js.map +1 -0
- package/dist/pure-function-tool/haiku-validator.d.ts +27 -0
- package/dist/pure-function-tool/haiku-validator.d.ts.map +1 -0
- package/dist/pure-function-tool/haiku-validator.js +148 -0
- package/dist/pure-function-tool/haiku-validator.js.map +1 -0
- package/dist/pure-function-tool/name-validator.d.ts +203 -0
- package/dist/pure-function-tool/name-validator.d.ts.map +1 -0
- package/dist/pure-function-tool/name-validator.js +244 -0
- package/dist/pure-function-tool/name-validator.js.map +1 -0
- package/dist/types/schemas.d.ts +612 -0
- package/dist/types/schemas.d.ts.map +1 -0
- package/dist/types/schemas.js +127 -0
- package/dist/types/schemas.js.map +1 -0
- package/dist/utils/color-extraction.d.ts +14 -0
- package/dist/utils/color-extraction.d.ts.map +1 -0
- package/dist/utils/color-extraction.js +45 -0
- package/dist/utils/color-extraction.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import * as readline from 'node:readline';
|
|
2
|
+
import { executeExternalEvent, validateAgentInput } from '@vibe-agent-toolkit/agent-runtime';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/**
|
|
5
|
+
* Constants for duplicated strings
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
const EVENT_INVALID_RESPONSE = 'event-invalid-response';
|
|
9
|
+
const AUTO_APPROVED_MESSAGE = 'Auto-approved (test mode)';
|
|
10
|
+
const AUTO_REJECTED_MESSAGE = 'Auto-rejected (test mode)';
|
|
11
|
+
const AUTO_SELECTED_MESSAGE = 'Auto-selected (test mode)';
|
|
12
|
+
const APPROVAL_REQUEST_CONTEXT = 'Approval request';
|
|
13
|
+
const CHOICE_REQUEST_CONTEXT = 'Choice request';
|
|
14
|
+
const CUSTOM_APPROVAL_REQUEST_CONTEXT = 'Custom approval request';
|
|
15
|
+
const EXTERNAL_EVENT_INTEGRATOR_ARCHETYPE = 'external-event-integrator';
|
|
16
|
+
const TIMEOUT_MS_DESCRIPTION = 'Timeout in milliseconds';
|
|
17
|
+
/**
|
|
18
|
+
* Input schema for approval requests
|
|
19
|
+
*/
|
|
20
|
+
export const ApprovalRequestInputSchema = z.object({
|
|
21
|
+
prompt: z.string().describe('The question to ask the human'),
|
|
22
|
+
context: z.record(z.unknown()).optional().describe('Additional context to display'),
|
|
23
|
+
autoResponse: z.union([z.literal('approve'), z.literal('reject')]).optional().describe('Auto-response for testing'),
|
|
24
|
+
timeoutMs: z.number().optional().describe(TIMEOUT_MS_DESCRIPTION),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Output schema for approval results
|
|
28
|
+
*/
|
|
29
|
+
export const ApprovalResultSchema = z.object({
|
|
30
|
+
approved: z.boolean().describe('Whether the request was approved'),
|
|
31
|
+
reason: z.string().optional().describe('Reason for the decision'),
|
|
32
|
+
timedOut: z.boolean().optional().describe('Whether the request timed out'),
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Input schema for choice requests
|
|
36
|
+
*/
|
|
37
|
+
export const ChoiceRequestInputSchema = z.object({
|
|
38
|
+
prompt: z.string().describe('The question to ask'),
|
|
39
|
+
options: z.array(z.string()).describe('Array of options to choose from'),
|
|
40
|
+
autoResponse: z.string().optional().describe('Auto-response for testing (option value)'),
|
|
41
|
+
timeoutMs: z.number().optional().describe(TIMEOUT_MS_DESCRIPTION),
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Output schema for choice results
|
|
45
|
+
*/
|
|
46
|
+
export const ChoiceResultSchema = z.object({
|
|
47
|
+
approved: z.boolean().describe('Whether a choice was made'),
|
|
48
|
+
choice: z.string().optional().describe('The selected option'),
|
|
49
|
+
reason: z.string().describe('Reason for result'),
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Input schema for custom approval requests
|
|
53
|
+
*/
|
|
54
|
+
export const CustomApprovalRequestInputSchema = z.object({
|
|
55
|
+
prompt: z.string().describe('The question to ask'),
|
|
56
|
+
autoResponse: z.string().optional().describe('Auto-response for testing'),
|
|
57
|
+
timeoutMs: z.number().optional().describe(TIMEOUT_MS_DESCRIPTION),
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Output schema for custom approval results
|
|
61
|
+
*/
|
|
62
|
+
export const CustomApprovalResultSchema = z.object({
|
|
63
|
+
approved: z.boolean().describe('Whether the input was valid'),
|
|
64
|
+
value: z.unknown().optional().describe('The validated value'),
|
|
65
|
+
reason: z.string().describe('Reason for result'),
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Requests human approval for a decision.
|
|
69
|
+
*
|
|
70
|
+
* Archetype: External Event Integrator
|
|
71
|
+
*
|
|
72
|
+
* This agent integrates with an external system (human input via CLI).
|
|
73
|
+
* In production, this could be:
|
|
74
|
+
* - A web UI approval workflow
|
|
75
|
+
* - A Slack approval bot
|
|
76
|
+
* - An email-based approval system
|
|
77
|
+
* - A ticketing system integration
|
|
78
|
+
*
|
|
79
|
+
* For now, it prompts via CLI.
|
|
80
|
+
*
|
|
81
|
+
* @param prompt - The question to ask the human
|
|
82
|
+
* @param context - Additional context to display (optional)
|
|
83
|
+
* @param options - Configuration options
|
|
84
|
+
* @returns Approval result
|
|
85
|
+
*/
|
|
86
|
+
export async function requestApproval(prompt, context, options = {}) {
|
|
87
|
+
const { timeoutMs = 0, onTimeout = 'reject', autoResponse } = options;
|
|
88
|
+
// Auto-response for testing
|
|
89
|
+
if (autoResponse) {
|
|
90
|
+
return {
|
|
91
|
+
approved: autoResponse === 'approve',
|
|
92
|
+
reason: autoResponse === 'approve' ? AUTO_APPROVED_MESSAGE : AUTO_REJECTED_MESSAGE,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Display context if provided
|
|
96
|
+
if (context) {
|
|
97
|
+
console.log('\n=== Approval Request Context ===');
|
|
98
|
+
for (const [key, value] of Object.entries(context)) {
|
|
99
|
+
console.log(`${key}: ${JSON.stringify(value, null, 2)}`);
|
|
100
|
+
}
|
|
101
|
+
console.log('================================\n');
|
|
102
|
+
}
|
|
103
|
+
// Create readline interface
|
|
104
|
+
const rl = readline.createInterface({
|
|
105
|
+
input: process.stdin,
|
|
106
|
+
output: process.stdout,
|
|
107
|
+
});
|
|
108
|
+
// Wrap in promise with optional timeout
|
|
109
|
+
const result = await new Promise((resolve) => {
|
|
110
|
+
let timeoutHandle;
|
|
111
|
+
// Set up timeout if specified
|
|
112
|
+
if (timeoutMs > 0) {
|
|
113
|
+
timeoutHandle = setTimeout(() => {
|
|
114
|
+
rl.close();
|
|
115
|
+
resolve({
|
|
116
|
+
approved: onTimeout === 'approve',
|
|
117
|
+
reason: `Timed out after ${timeoutMs}ms`,
|
|
118
|
+
timedOut: true,
|
|
119
|
+
});
|
|
120
|
+
}, timeoutMs);
|
|
121
|
+
}
|
|
122
|
+
// Ask the question
|
|
123
|
+
rl.question(`${prompt} (yes/no): `, (answer) => {
|
|
124
|
+
if (timeoutHandle) {
|
|
125
|
+
clearTimeout(timeoutHandle);
|
|
126
|
+
}
|
|
127
|
+
rl.close();
|
|
128
|
+
const normalized = answer.trim().toLowerCase();
|
|
129
|
+
const approved = normalized === 'yes' || normalized === 'y';
|
|
130
|
+
resolve({
|
|
131
|
+
approved,
|
|
132
|
+
reason: approved ? 'Approved by user' : 'Rejected by user',
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Requests approval with custom validation logic.
|
|
140
|
+
*
|
|
141
|
+
* This variant allows for more complex approval flows where the human
|
|
142
|
+
* can provide additional input beyond just yes/no.
|
|
143
|
+
*
|
|
144
|
+
* @param prompt - The question to ask
|
|
145
|
+
* @param validator - Function to validate the response
|
|
146
|
+
* @param options - Configuration options
|
|
147
|
+
* @returns Validation result
|
|
148
|
+
*/
|
|
149
|
+
export async function requestCustomApproval(prompt, validator, options = {}) {
|
|
150
|
+
const { timeoutMs = 0, autoResponse } = options;
|
|
151
|
+
// Auto-response for testing
|
|
152
|
+
if (autoResponse) {
|
|
153
|
+
const validation = validator(autoResponse);
|
|
154
|
+
return {
|
|
155
|
+
approved: validation.valid,
|
|
156
|
+
...(validation.value !== undefined && { value: validation.value }),
|
|
157
|
+
reason: validation.valid ? AUTO_APPROVED_MESSAGE : validation.error ?? AUTO_REJECTED_MESSAGE,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// Create readline interface
|
|
161
|
+
const rl = readline.createInterface({
|
|
162
|
+
input: process.stdin,
|
|
163
|
+
output: process.stdout,
|
|
164
|
+
});
|
|
165
|
+
const result = await new Promise((resolve) => {
|
|
166
|
+
let timeoutHandle;
|
|
167
|
+
if (timeoutMs > 0) {
|
|
168
|
+
timeoutHandle = setTimeout(() => {
|
|
169
|
+
rl.close();
|
|
170
|
+
resolve({
|
|
171
|
+
approved: false,
|
|
172
|
+
reason: `Timed out after ${timeoutMs}ms`,
|
|
173
|
+
});
|
|
174
|
+
}, timeoutMs);
|
|
175
|
+
}
|
|
176
|
+
rl.question(`${prompt}: `, (answer) => {
|
|
177
|
+
if (timeoutHandle) {
|
|
178
|
+
clearTimeout(timeoutHandle);
|
|
179
|
+
}
|
|
180
|
+
rl.close();
|
|
181
|
+
const validation = validator(answer.trim());
|
|
182
|
+
resolve({
|
|
183
|
+
approved: validation.valid,
|
|
184
|
+
...(validation.value !== undefined && { value: validation.value }),
|
|
185
|
+
reason: validation.valid
|
|
186
|
+
? 'Approved by user'
|
|
187
|
+
: validation.error ?? 'Invalid response',
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
return result;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Presents multiple options and asks human to choose one.
|
|
195
|
+
*
|
|
196
|
+
* @param prompt - The question to ask
|
|
197
|
+
* @param options - Array of options to choose from
|
|
198
|
+
* @param config - Configuration options
|
|
199
|
+
* @returns Selected option (or undefined if rejected/timed out)
|
|
200
|
+
*/
|
|
201
|
+
export async function requestChoice(prompt, options, config = {}) {
|
|
202
|
+
const { timeoutMs = 0, autoResponse } = config;
|
|
203
|
+
// Auto-response for testing
|
|
204
|
+
if (autoResponse) {
|
|
205
|
+
// Check for exact match first (case-sensitive)
|
|
206
|
+
if (options.includes(autoResponse)) {
|
|
207
|
+
return {
|
|
208
|
+
approved: true,
|
|
209
|
+
choice: autoResponse,
|
|
210
|
+
reason: AUTO_SELECTED_MESSAGE,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
// Try case-insensitive match
|
|
214
|
+
const match = options.find((opt) => opt.toLowerCase() === autoResponse.toLowerCase());
|
|
215
|
+
if (match) {
|
|
216
|
+
return {
|
|
217
|
+
approved: true,
|
|
218
|
+
choice: match,
|
|
219
|
+
reason: AUTO_SELECTED_MESSAGE,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
// No match found
|
|
223
|
+
return {
|
|
224
|
+
approved: false,
|
|
225
|
+
reason: `Invalid auto-response: ${autoResponse}`,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
// Display options
|
|
229
|
+
console.log(`\n${prompt}`);
|
|
230
|
+
for (const [index, option] of options.entries()) {
|
|
231
|
+
console.log(` ${index + 1}. ${option}`);
|
|
232
|
+
}
|
|
233
|
+
return requestCustomApproval('Enter your choice (number or text)', (response) => {
|
|
234
|
+
// Try to parse as number
|
|
235
|
+
const num = Number.parseInt(response, 10);
|
|
236
|
+
if (!Number.isNaN(num) && num >= 1 && num <= options.length) {
|
|
237
|
+
const option = options[num - 1];
|
|
238
|
+
if (option !== undefined) {
|
|
239
|
+
return { valid: true, value: option };
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// Try to match text
|
|
243
|
+
const match = options.find((opt) => opt.toLowerCase() === response.toLowerCase());
|
|
244
|
+
if (match !== undefined) {
|
|
245
|
+
return { valid: true, value: match };
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
valid: false,
|
|
249
|
+
error: 'Invalid choice. Please enter a number or option text.',
|
|
250
|
+
};
|
|
251
|
+
}, { timeoutMs });
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Request approval agent
|
|
255
|
+
*
|
|
256
|
+
* Integrates with external human approval system (CLI in this implementation).
|
|
257
|
+
* In production, this could integrate with Slack, email, web UI, or ticketing systems.
|
|
258
|
+
*/
|
|
259
|
+
export const requestApprovalAgent = {
|
|
260
|
+
name: 'request-approval',
|
|
261
|
+
manifest: {
|
|
262
|
+
name: 'request-approval',
|
|
263
|
+
version: '1.0.0',
|
|
264
|
+
description: 'Requests human approval for a yes/no decision',
|
|
265
|
+
archetype: EXTERNAL_EVENT_INTEGRATOR_ARCHETYPE,
|
|
266
|
+
metadata: {
|
|
267
|
+
integrationTypes: ['CLI', 'Slack', 'Email', 'Web UI'],
|
|
268
|
+
blocking: true,
|
|
269
|
+
timeoutMs: 60000,
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
execute: async (input) => {
|
|
273
|
+
const validatedOrError = validateAgentInput(input, ApprovalRequestInputSchema, EVENT_INVALID_RESPONSE);
|
|
274
|
+
if ('result' in validatedOrError) {
|
|
275
|
+
return validatedOrError;
|
|
276
|
+
}
|
|
277
|
+
const { prompt, context, autoResponse, timeoutMs = 60000 } = validatedOrError;
|
|
278
|
+
// Convert autoResponse to ApprovalResult for executeExternalEvent
|
|
279
|
+
const autoResponseData = autoResponse
|
|
280
|
+
? {
|
|
281
|
+
approved: autoResponse === 'approve',
|
|
282
|
+
reason: autoResponse === 'approve' ? AUTO_APPROVED_MESSAGE : AUTO_REJECTED_MESSAGE,
|
|
283
|
+
}
|
|
284
|
+
: {}; // Placeholder, will be handled by executeExternalEvent
|
|
285
|
+
return executeExternalEvent({
|
|
286
|
+
...(autoResponse && { autoResponse: autoResponseData }),
|
|
287
|
+
handler: async () => requestApproval(prompt, context, autoResponse ? { autoResponse } : { timeoutMs }),
|
|
288
|
+
timeoutMs,
|
|
289
|
+
errorContext: APPROVAL_REQUEST_CONTEXT,
|
|
290
|
+
});
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Request choice agent
|
|
295
|
+
*
|
|
296
|
+
* Presents multiple options and asks human to choose one.
|
|
297
|
+
*/
|
|
298
|
+
export const requestChoiceAgent = {
|
|
299
|
+
name: 'request-choice',
|
|
300
|
+
manifest: {
|
|
301
|
+
name: 'request-choice',
|
|
302
|
+
version: '1.0.0',
|
|
303
|
+
description: 'Presents multiple options and asks human to choose one',
|
|
304
|
+
archetype: EXTERNAL_EVENT_INTEGRATOR_ARCHETYPE,
|
|
305
|
+
metadata: {
|
|
306
|
+
integrationTypes: ['CLI', 'Slack', 'Email', 'Web UI'],
|
|
307
|
+
blocking: true,
|
|
308
|
+
timeoutMs: 60000,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
execute: async (input) => {
|
|
312
|
+
const validatedOrError = validateAgentInput(input, ChoiceRequestInputSchema, EVENT_INVALID_RESPONSE);
|
|
313
|
+
if ('result' in validatedOrError) {
|
|
314
|
+
return validatedOrError;
|
|
315
|
+
}
|
|
316
|
+
const { prompt, options, autoResponse, timeoutMs = 60000 } = validatedOrError;
|
|
317
|
+
// Convert autoResponse to ChoiceResult for executeExternalEvent
|
|
318
|
+
const autoResponseData = autoResponse
|
|
319
|
+
? {
|
|
320
|
+
approved: options.includes(autoResponse),
|
|
321
|
+
choice: autoResponse,
|
|
322
|
+
reason: options.includes(autoResponse)
|
|
323
|
+
? AUTO_SELECTED_MESSAGE
|
|
324
|
+
: `Invalid auto-response: ${autoResponse}`,
|
|
325
|
+
}
|
|
326
|
+
: {}; // Placeholder, will be handled by executeExternalEvent
|
|
327
|
+
return executeExternalEvent({
|
|
328
|
+
...(autoResponse && { autoResponse: autoResponseData }),
|
|
329
|
+
handler: async () => requestChoice(prompt, options, autoResponse ? { autoResponse } : { timeoutMs }),
|
|
330
|
+
timeoutMs,
|
|
331
|
+
errorContext: CHOICE_REQUEST_CONTEXT,
|
|
332
|
+
});
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* Request custom approval agent
|
|
337
|
+
*
|
|
338
|
+
* Requests approval with custom validation logic.
|
|
339
|
+
* Note: This is a simplified version - full implementation would need validator function.
|
|
340
|
+
*/
|
|
341
|
+
export const requestCustomApprovalAgent = {
|
|
342
|
+
name: 'request-custom-approval',
|
|
343
|
+
manifest: {
|
|
344
|
+
name: 'request-custom-approval',
|
|
345
|
+
version: '1.0.0',
|
|
346
|
+
description: 'Requests approval with custom validation logic',
|
|
347
|
+
archetype: EXTERNAL_EVENT_INTEGRATOR_ARCHETYPE,
|
|
348
|
+
metadata: {
|
|
349
|
+
integrationTypes: ['CLI', 'Slack', 'Email', 'Web UI'],
|
|
350
|
+
blocking: true,
|
|
351
|
+
requiresValidator: true,
|
|
352
|
+
timeoutMs: 60000,
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
execute: async (input) => {
|
|
356
|
+
const validatedOrError = validateAgentInput(input, CustomApprovalRequestInputSchema, EVENT_INVALID_RESPONSE);
|
|
357
|
+
if ('result' in validatedOrError) {
|
|
358
|
+
return validatedOrError;
|
|
359
|
+
}
|
|
360
|
+
const { prompt, autoResponse, timeoutMs = 60000 } = validatedOrError;
|
|
361
|
+
// Simplified implementation - just do yes/no approval
|
|
362
|
+
// Full implementation would need validator function passed through context
|
|
363
|
+
const autoResponseData = autoResponse
|
|
364
|
+
? {
|
|
365
|
+
approved: autoResponse.toLowerCase() === 'yes' || autoResponse.toLowerCase() === 'y',
|
|
366
|
+
value: autoResponse,
|
|
367
|
+
reason: autoResponse.toLowerCase() === 'yes' || autoResponse.toLowerCase() === 'y'
|
|
368
|
+
? AUTO_APPROVED_MESSAGE
|
|
369
|
+
: AUTO_REJECTED_MESSAGE,
|
|
370
|
+
}
|
|
371
|
+
: {}; // Placeholder
|
|
372
|
+
return executeExternalEvent({
|
|
373
|
+
...(autoResponse && { autoResponse: autoResponseData }),
|
|
374
|
+
handler: async () => {
|
|
375
|
+
const result = await requestApproval(prompt, undefined, autoResponse ? { autoResponse: autoResponse } : { timeoutMs });
|
|
376
|
+
return {
|
|
377
|
+
approved: result.approved,
|
|
378
|
+
reason: result.reason ?? 'No reason provided',
|
|
379
|
+
value: result.approved ? 'approved' : undefined,
|
|
380
|
+
};
|
|
381
|
+
},
|
|
382
|
+
timeoutMs,
|
|
383
|
+
errorContext: CUSTOM_APPROVAL_REQUEST_CONTEXT,
|
|
384
|
+
});
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
//# sourceMappingURL=human-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"human-approval.js","sourceRoot":"","sources":["../../src/external-event-integrator/human-approval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAM7F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,sBAAsB,GAAuB,wBAAwB,CAAC;AAC5E,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AACpD,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AAChD,MAAM,+BAA+B,GAAG,yBAAyB,CAAC;AAClE,MAAM,mCAAmC,GAAG,2BAA2B,CAAC;AACxE,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAEzD;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,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C;YACJ,CAAC;YACD,SAAS;YACT,YAAY,EAAE,+BAA+B;SAC9C,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types/schemas.js';
|
|
2
|
+
export * from './pure-function-tool/haiku-validator.js';
|
|
3
|
+
export * from './pure-function-tool/name-validator.js';
|
|
4
|
+
export * from './one-shot-llm-analyzer/photo-analyzer.js';
|
|
5
|
+
export * from './one-shot-llm-analyzer/description-parser.js';
|
|
6
|
+
export * from './one-shot-llm-analyzer/name-generator.js';
|
|
7
|
+
export * from './one-shot-llm-analyzer/haiku-generator.js';
|
|
8
|
+
export * from './conversational-assistant/breed-advisor.js';
|
|
9
|
+
export * from './conversational-assistant/breed-knowledge.js';
|
|
10
|
+
export * from './external-event-integrator/human-approval.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AAGnC,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AAGvD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAG3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAG9D,cAAc,+CAA+C,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Schemas and types
|
|
2
|
+
export * from './types/schemas.js';
|
|
3
|
+
// Pure Function Tools (Archetype 1)
|
|
4
|
+
export * from './pure-function-tool/haiku-validator.js';
|
|
5
|
+
export * from './pure-function-tool/name-validator.js';
|
|
6
|
+
// One-Shot LLM Analyzers (Archetype 2)
|
|
7
|
+
export * from './one-shot-llm-analyzer/photo-analyzer.js';
|
|
8
|
+
export * from './one-shot-llm-analyzer/description-parser.js';
|
|
9
|
+
export * from './one-shot-llm-analyzer/name-generator.js';
|
|
10
|
+
export * from './one-shot-llm-analyzer/haiku-generator.js';
|
|
11
|
+
// Conversational Assistants (Archetype 3)
|
|
12
|
+
export * from './conversational-assistant/breed-advisor.js';
|
|
13
|
+
export * from './conversational-assistant/breed-knowledge.js';
|
|
14
|
+
// External Event Integrators (Archetype 9)
|
|
15
|
+
export * from './external-event-integrator/human-approval.js';
|
|
16
|
+
// Function Workflow Orchestrators (Archetype 5)
|
|
17
|
+
// NOTE: Orchestrator examples were removed during AI SDK v6 migration due to mock code cleanup.
|
|
18
|
+
// Future: Add orchestrator example that works with real LLM agents.
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc,oBAAoB,CAAC;AAEnC,oCAAoC;AACpC,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AAEvD,uCAAuC;AACvC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAE3D,0CAA0C;AAC1C,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAE9D,2CAA2C;AAC3C,cAAc,+CAA+C,CAAC;AAE9D,gDAAgD;AAChD,gGAAgG;AAChG,oEAAoE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Collections for vat-example-cat-agents
|
|
3
|
+
*
|
|
4
|
+
* Exports agent collections that can be exposed via MCP Gateway.
|
|
5
|
+
* Discoverable by: vat mcp serve @vibe-agent-toolkit/vat-example-cat-agents
|
|
6
|
+
*/
|
|
7
|
+
import type { Agent, OneShotAgentOutput } from '@vibe-agent-toolkit/agent-schema';
|
|
8
|
+
export interface MCPAgentRegistration {
|
|
9
|
+
name: string;
|
|
10
|
+
agent: Agent<unknown, OneShotAgentOutput<unknown, string>>;
|
|
11
|
+
description: string;
|
|
12
|
+
}
|
|
13
|
+
export interface MCPCollection {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
agents: MCPAgentRegistration[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Cat agents collection
|
|
20
|
+
*/
|
|
21
|
+
export declare const catAgents: MCPCollection;
|
|
22
|
+
/**
|
|
23
|
+
* All MCP collections exported by this package
|
|
24
|
+
*/
|
|
25
|
+
export declare const collections: Record<string, MCPCollection>;
|
|
26
|
+
/**
|
|
27
|
+
* Default collection (when package is used without :collection suffix)
|
|
28
|
+
*/
|
|
29
|
+
export declare const defaultCollection: MCPCollection;
|
|
30
|
+
//# sourceMappingURL=mcp-collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-collections.d.ts","sourceRoot":"","sources":["../src/mcp-collections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAMlF,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAwBD;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,aAevB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAErD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAAY,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Collections for vat-example-cat-agents
|
|
3
|
+
*
|
|
4
|
+
* Exports agent collections that can be exposed via MCP Gateway.
|
|
5
|
+
* Discoverable by: vat mcp serve @vibe-agent-toolkit/vat-example-cat-agents
|
|
6
|
+
*/
|
|
7
|
+
import { createSuccess } from '@vibe-agent-toolkit/agent-schema';
|
|
8
|
+
import { photoAnalyzerAgent } from './one-shot-llm-analyzer/photo-analyzer.js';
|
|
9
|
+
import { haikuValidatorAgent } from './pure-function-tool/haiku-validator.js';
|
|
10
|
+
/**
|
|
11
|
+
* Wraps stateless agents to return OneShotAgentOutput envelope
|
|
12
|
+
*
|
|
13
|
+
* Gateway expects: { result: AgentResult<TData, TError>, metadata?: ... }
|
|
14
|
+
* Stateless agents return: TData directly
|
|
15
|
+
*/
|
|
16
|
+
function wrapStatelessAgent(agent) {
|
|
17
|
+
return {
|
|
18
|
+
name: agent.name,
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Accept any manifest structure from different agent types
|
|
20
|
+
manifest: agent.manifest,
|
|
21
|
+
execute: async (input) => {
|
|
22
|
+
const data = await Promise.resolve(agent.execute(input));
|
|
23
|
+
return {
|
|
24
|
+
result: createSuccess(data),
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Cat agents collection
|
|
31
|
+
*/
|
|
32
|
+
export const catAgents = {
|
|
33
|
+
name: 'cat-agents',
|
|
34
|
+
description: 'Example cat breeding agents (haiku validator, photo analyzer)',
|
|
35
|
+
agents: [
|
|
36
|
+
{
|
|
37
|
+
name: 'haiku-validator',
|
|
38
|
+
agent: wrapStatelessAgent(haikuValidatorAgent),
|
|
39
|
+
description: 'Validates 5-7-5 haiku syllable structure',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'photo-analyzer',
|
|
43
|
+
agent: wrapStatelessAgent(photoAnalyzerAgent),
|
|
44
|
+
description: 'Analyzes cat photos (mock mode)',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* All MCP collections exported by this package
|
|
50
|
+
*/
|
|
51
|
+
export const collections = {
|
|
52
|
+
'cat-agents': catAgents,
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Default collection (when package is used without :collection suffix)
|
|
56
|
+
*/
|
|
57
|
+
export const defaultCollection = catAgents;
|
|
58
|
+
//# sourceMappingURL=mcp-collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-collections.js","sourceRoot":"","sources":["../src/mcp-collections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAc9E;;;;;GAKG;AACH,SAAS,kBAAkB,CACzB,KAAkG;IAElG,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,0HAA0H;QAC1H,QAAQ,EAAE,KAAK,CAAC,QAAe;QAC/B,OAAO,EAAE,KAAK,EAAE,KAAa,EAAE,EAAE;YAC/B,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YACzD,OAAO;gBACL,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC;aAC5B,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,+DAA+D;IAC5E,MAAM,EAAE;QACN;YACE,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,kBAAkB,CAAC,mBAAmB,CAAC;YAC9C,WAAW,EAAE,0CAA0C;SACxD;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,kBAAkB,CAAC,kBAAkB,CAAC;YAC7C,WAAW,EAAE,iCAAiC;SAC/C;KACF;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAkC;IACxD,YAAY,EAAE,SAAS;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Agent, LLMError, OneShotAgentOutput } from '@vibe-agent-toolkit/agent-schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { type CatCharacteristics } from '../types/schemas.js';
|
|
4
|
+
/**
|
|
5
|
+
* Input schema for description parsing
|
|
6
|
+
*/
|
|
7
|
+
export declare const DescriptionParserInputSchema: z.ZodObject<{
|
|
8
|
+
description: z.ZodString;
|
|
9
|
+
mockable: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
description: string;
|
|
12
|
+
mockable?: boolean | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
description: string;
|
|
15
|
+
mockable?: boolean | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type DescriptionParserInput = z.infer<typeof DescriptionParserInputSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for description parser behavior
|
|
20
|
+
*/
|
|
21
|
+
export interface DescriptionParserOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Whether to use real LLM or mock data
|
|
24
|
+
* @default true (mock mode for now)
|
|
25
|
+
*/
|
|
26
|
+
mockable?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parses a text description of a cat and extracts characteristics.
|
|
30
|
+
*
|
|
31
|
+
* Archetype: One-Shot LLM Analyzer
|
|
32
|
+
*
|
|
33
|
+
* This would typically call an LLM to parse unstructured text.
|
|
34
|
+
* For now, it generates mock data based on keyword extraction.
|
|
35
|
+
*
|
|
36
|
+
* Handles both structured descriptions and "word vomit":
|
|
37
|
+
* - "Orange tabby, playful, loves boxes"
|
|
38
|
+
* - "So there's this cat right and he's like super orange and has stripes and he knocks stuff off tables"
|
|
39
|
+
*
|
|
40
|
+
* @param description - Text description of the cat (structured or unstructured)
|
|
41
|
+
* @param options - Configuration options
|
|
42
|
+
* @returns Cat characteristics extracted from the description
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseDescription(description: string, options?: DescriptionParserOptions): Promise<CatCharacteristics>;
|
|
45
|
+
/**
|
|
46
|
+
* Description parser agent
|
|
47
|
+
*
|
|
48
|
+
* Captain Obvious is a cat who states the obvious and extracts characteristics literally.
|
|
49
|
+
* He has an uncanny ability to parse both structured descriptions and complete "word vomit",
|
|
50
|
+
* extracting every detail with earnest precision.
|
|
51
|
+
*
|
|
52
|
+
* In mock mode, uses keyword extraction. In real mode, uses LLM to parse natural language.
|
|
53
|
+
*/
|
|
54
|
+
export declare const descriptionParserAgent: Agent<DescriptionParserInput, OneShotAgentOutput<CatCharacteristics, LLMError>>;
|
|
55
|
+
//# sourceMappingURL=description-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-parser.d.ts","sourceRoot":"","sources":["../../src/one-shot-llm-analyzer/description-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE5F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAIxF;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;EAGvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,kBAAkB,CAAC,CAQ7B;AA6SD;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CACxC,sBAAsB,EACtB,kBAAkB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAuCjD,CAAC"}
|