(params: {
trigger: AutonomyTriggerKind
basePrompt: string
rootDir?: string
currentDir?: string
sourceId?: string
sourceLabel?: string
ownerKey?: string
workload?: string
priority?: 'now' | 'next' | 'later'
shouldCreate?: () => boolean
flow?: AutonomyRunFlowRef
})
| 870 | } |
| 871 | |
| 872 | export async function createAutonomyQueuedPrompt(params: { |
| 873 | trigger: AutonomyTriggerKind |
| 874 | basePrompt: string |
| 875 | rootDir?: string |
| 876 | currentDir?: string |
| 877 | sourceId?: string |
| 878 | sourceLabel?: string |
| 879 | ownerKey?: string |
| 880 | workload?: string |
| 881 | priority?: 'now' | 'next' | 'later' |
| 882 | shouldCreate?: () => boolean |
| 883 | flow?: AutonomyRunFlowRef |
| 884 | }): Promise<QueuedCommand | null> { |
| 885 | const rootDir = resolve(params.rootDir ?? getProjectRoot()) |
| 886 | const currentDir = resolve(params.currentDir ?? getCwd()) |
| 887 | const prepared = await prepareAutonomyTurnPrompt({ |
| 888 | basePrompt: params.basePrompt, |
| 889 | trigger: params.trigger, |
| 890 | rootDir, |
| 891 | currentDir, |
| 892 | }) |
| 893 | if (params.shouldCreate && !params.shouldCreate()) { |
| 894 | return null |
| 895 | } |
| 896 | return commitAutonomyQueuedPrompt({ |
| 897 | prepared, |
| 898 | rootDir, |
| 899 | currentDir, |
| 900 | sourceId: params.sourceId, |
| 901 | sourceLabel: params.sourceLabel, |
| 902 | ownerKey: params.ownerKey, |
| 903 | workload: params.workload, |
| 904 | priority: params.priority, |
| 905 | flow: params.flow, |
| 906 | }) |
| 907 | } |
| 908 | |
| 909 | export async function createAutonomyQueuedPromptIfNoActiveSource(params: { |
| 910 | trigger: AutonomyTriggerKind |
no test coverage detected