UNPKG

@agentled/cli

Version:

CLI for Agentled — manage workflows, apps, and knowledge from the command line. Zero context-window cost for AI agents.

108 lines 5.15 kB
/** * Context / input-page field schema catalog. * * Canonical source: `ExecutionInputFieldType` enum + `ExecutionInputField` * interface in `shared/types/pipeline/PipelineTypes.ts`. This file is the * CLI-distributable mirror — drift is guarded by * `agentled-mcp-server/__tests__/context-field-types.test.ts`. * * Why a mirror and not an import: the CLI is published to npm and can't * pull in the whole frontend build graph at install time. The drift test * fails CI if this file disagrees with the enum, so it cannot rot silently. */ /** * Base keys every field supports regardless of `type`. */ export const BASE_FIELD_KEYS = [ 'name', 'label', 'type', 'description', 'placeholder', 'required', 'defaultValue', 'suggestions', 'addSeparatorAfter', ]; export const CONTEXT_FIELD_TYPES = [ { value: 'text', description: 'Single-line text input.' }, { value: 'textarea', description: 'Multi-line plain-text input.' }, { value: 'html', description: 'Rich-text / HTML editor.' }, { value: 'email', description: 'Email-formatted text input (validation on blur).' }, { value: 'url', description: 'URL-formatted text input.' }, { value: 'numeric', description: 'Numeric field — text input that coerces to number on blur.' }, { value: 'boolean', description: 'Checkbox / toggle.' }, { value: 'date', description: 'Date picker.' }, { value: 'datetime', description: 'Date + time picker.' }, { value: 'time', description: 'Time-of-day picker.' }, { value: 'color_picker', description: 'Color picker (hex/rgb).' }, { value: 'select', description: 'Single-choice dropdown.', extraKeys: ['options', 'allowCustomValues'], example: { options: [{ label: 'Hot', value: 'hot' }, { label: 'Cold', value: 'cold' }] }, }, { value: 'multiselect', description: 'Multi-choice dropdown.', extraKeys: ['options', 'allowCustomValues'], example: { options: [{ label: 'US', value: 'us' }, { label: 'EU', value: 'eu' }] }, }, { value: 'country_select', description: 'Country picker (ISO codes).' }, { value: 'file', description: 'Single public/manual file upload. Supports `accept`, such as `[\".pdf\"]`.' }, { value: 'single_file_upload', description: 'Single file upload.' }, { value: 'multiple_file_upload', description: 'Multi-file upload.' }, { value: 'google_drive_file_selector_single', description: 'Google Drive Picker for one selected Drive/Docs/Sheets file.' }, { value: 'google_drive_file_selector_multiple', description: 'Google Drive Picker for multiple selected Drive/Docs/Sheets files.' }, { value: 'list', description: 'Repeatable sub-form — user adds/removes rows of sub-fields.', extraKeys: ['itemFields'], example: { itemFields: [{ name: 'email', label: 'Email', type: 'email' }] }, }, { value: 'connected_emails_selector_single', description: 'Picker of one email account the user has connected (Gmail / Outlook / …).', }, { value: 'connected_emails_selector_multiple', description: 'Picker of multiple connected email accounts — used in `outreachProfile` input pages.', }, { value: 'json', description: 'JSON data (object/array or JSON string). Use instead of legacy `object` type.' }, ]; export const VALID_CONTEXT_FIELD_TYPE_VALUES = new Set(CONTEXT_FIELD_TYPES.map(t => t.value)); /** * Aliases the runtime accepts but the canonical name should be used going forward. * Keyed by the alias, value is the canonical name. */ export const CONTEXT_FIELD_TYPE_ALIASES = {}; /** * Heuristic "did you mean" for the most common invented / typo'd field types. */ export function suggestContextFieldTypeFix(invalid) { const v = invalid.toLowerCase(); const exactAlias = CONTEXT_FIELD_TYPE_ALIASES[v]; if (exactAlias) return `Use \`${exactAlias}\` (the canonical name — \`${invalid}\` is a legacy alias and won't receive new features).`; const heuristics = { 'multi-select': 'Use `multiselect` (no hyphen).', 'multi_select': 'Use `multiselect` (no underscore).', 'dropdown': 'Use `select` (single choice) or `multiselect` (multiple choices).', 'number': 'Use `numeric`.', 'numeric': 'Use `numeric`.', 'emails': 'Use `connected_emails_selector_multiple` (if picking from connected accounts) or `list` with `itemFields: [{ type: "email" }]`.', 'email_list': 'Use `connected_emails_selector_multiple` or `list` with `itemFields: [{ type: "email" }]`.', 'checkbox': 'Use `boolean`.', 'toggle': 'Use `boolean`.', 'rich_text': 'Use `html`.', 'rich-text': 'Use `html`.', 'long_text': 'Use `textarea`.', 'long-text': 'Use `textarea`.', 'country': 'Use `country_select`.', 'color': 'Use `color_picker`.', 'files': 'Use `multiple_file_upload`.', 'object': 'Use `json` (preferred) — legacy `object` type is being phased out.', }; return heuristics[v]; } //# sourceMappingURL=context-schema.js.map