()
| 26 | const multiselectHelper = `${dimItalic(`(optional)`)} \n${dimItalic(`${lineItem} Press ${cyan(`space`)} to select, ${cyan(`enter`)} to submit or skip`)}`; |
| 27 | |
| 28 | export async function createPipe() { |
| 29 | const tools = await getAvailableTools(); |
| 30 | const memories = await getAvailableMemories(); |
| 31 | const hasTools = tools.length > 0; |
| 32 | const hasMemories = memories.length > 0; |
| 33 | |
| 34 | p.intro(heading({ text: 'PIPE', sub: 'Create a new agent pipe' })); |
| 35 | |
| 36 | const pipeInfo = await p.group( |
| 37 | { |
| 38 | name: () => |
| 39 | p.text({ |
| 40 | message: 'Name of the pipe', |
| 41 | placeholder: 'ai-agent-pipe', |
| 42 | validate: value => { |
| 43 | const result = pipeNameSchema.safeParse(value); |
| 44 | if (!result.success) { |
| 45 | return result.error.issues[0].message; |
| 46 | } |
| 47 | return; |
| 48 | } |
| 49 | }), |
| 50 | description: () => |
| 51 | p.text({ |
| 52 | message: 'Description of the pipe', |
| 53 | placeholder: 'This is a test pipe' |
| 54 | }), |
| 55 | status: () => |
| 56 | p.select({ |
| 57 | message: 'Status of the pipe', |
| 58 | options: [ |
| 59 | { value: 'public', label: 'Public' }, |
| 60 | { value: 'private', label: 'Private' } |
| 61 | ] |
| 62 | }) as Promise<PipeStatus>, |
| 63 | systemPrompt: () => |
| 64 | p.text({ |
| 65 | message: 'System prompt', |
| 66 | placeholder: 'You are a helpful AI assistant.', |
| 67 | initialValue: 'You are a helpful AI assistant.' |
| 68 | }), |
| 69 | ...(hasMemories && { |
| 70 | memory: async () => |
| 71 | p.multiselect({ |
| 72 | message: `Select memory for this pipe ${multiselectHelper}`, |
| 73 | options: memories.map(memoryName => ({ |
| 74 | value: memoryName, |
| 75 | label: memoryName |
| 76 | })), |
| 77 | required: false |
| 78 | }) |
| 79 | }), |
| 80 | ...(hasTools && { |
| 81 | tools: async () => |
| 82 | p.multiselect({ |
| 83 | message: `Select tools for this pipe ${multiselectHelper}`, |
| 84 | options: tools.map(tool => ({ |
| 85 | value: tool, |
no test coverage detected