feat: FlowPilot migration — Phase 1-9 + Phase 9 bug fixes + QA fixture harness #147
@@ -7,9 +7,21 @@ import type {
|
||||
} from '@/types'
|
||||
import type { ScriptTemplateDetail } from '@/types'
|
||||
|
||||
export interface CreateSessionOptions {
|
||||
origin?: 'standalone' | 'pilot_inline'
|
||||
aiSessionId?: string
|
||||
}
|
||||
|
||||
export const scriptBuilderApi = {
|
||||
async createSession(language: string): Promise<ScriptBuilderSessionDetail> {
|
||||
const { data } = await apiClient.post('/scripts/builder/sessions', { language })
|
||||
async createSession(
|
||||
language: string,
|
||||
options?: CreateSessionOptions,
|
||||
): Promise<ScriptBuilderSessionDetail> {
|
||||
const { data } = await apiClient.post('/scripts/builder/sessions', {
|
||||
language,
|
||||
origin: options?.origin,
|
||||
ai_session_id: options?.aiSessionId,
|
||||
})
|
||||
return data
|
||||
},
|
||||
|
||||
|
||||
@@ -197,6 +197,28 @@ export const sessionSuggestedFixesApi = {
|
||||
return r.data
|
||||
},
|
||||
|
||||
/**
|
||||
* Attach an engineer-drafted script to a suggested fix (inline Script
|
||||
* Builder Submit path). Does NOT stamp applied_at — the server treats
|
||||
* a draft as non-terminal progress. Bumps state_version so the
|
||||
* Resolve/Escalate preview regenerates.
|
||||
*/
|
||||
async patchScript(
|
||||
sessionId: string,
|
||||
fixId: string,
|
||||
aiDraftedScript: string,
|
||||
aiDraftedParameters?: Record<string, unknown>,
|
||||
): Promise<SessionSuggestedFix> {
|
||||
const r = await apiClient.patch<SessionSuggestedFix>(
|
||||
`/ai-sessions/${sessionId}/suggested-fixes/${fixId}/script`,
|
||||
{
|
||||
ai_drafted_script: aiDraftedScript,
|
||||
ai_drafted_parameters: aiDraftedParameters,
|
||||
},
|
||||
)
|
||||
return r.data
|
||||
},
|
||||
|
||||
/**
|
||||
* Explicitly dismiss the AI-proposed outcome banner ("Not yet").
|
||||
* Clears ai_outcome_proposal on the server without touching status or
|
||||
|
||||
Reference in New Issue
Block a user