mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-06 08:01:35 +00:00
* fix: route legacy AI entry points to sessions instead of the unmounted chat Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: keep createSession's workspace choice and revert pipeline hand-off Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: guard in-session step generation and restore AI action labels Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: keep AI Fix usable in-session and stop silent no-op hand-offs Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: neutral AI form assistant heading to match both branches Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * docs: state the AI form assistant branch rationale once Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat: auto-send AI hand-offs and keep in-session step generation in global mode * fix: name the AI session in the entry point labels * fix: claim auto-send reactively and queue programmatic sends mid-turn * test: pin the auto-send claim going stale * fix: stop the script drawer hand-off from abandoning its unsaved script * fix: keep a stale hand-off prompt and close the pre-loading send window * fix: only blank the composer for an intent this wrapper can claim * fix: report composer edits only, never the mount-time draft --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
143 lines
4.3 KiB
Svelte
143 lines
4.3 KiB
Svelte
<script lang="ts">
|
|
import LogViewer from './LogViewer.svelte'
|
|
import JobProgressBar from '$lib/components/jobs/JobProgressBar.svelte'
|
|
import ScriptFix from './copilot/ScriptFix.svelte'
|
|
import type DiffEditor from './DiffEditor.svelte'
|
|
import type Editor from './Editor.svelte'
|
|
import { type Script, type Job, type FlowModule } from '$lib/gen'
|
|
import OutputPickerInner from '$lib/components/flows/propPicker/OutputPickerInner.svelte'
|
|
import { Pane, Splitpanes } from 'svelte-splitpanes'
|
|
import type { FlowEditorContext, OutputViewerJob } from './flows/types'
|
|
import type { AgentTool } from './flows/agentToolUtils'
|
|
import { getContext } from 'svelte'
|
|
import { getStringError } from './copilot/chat/utils'
|
|
import AiAgentLogViewer from './AIAgentLogViewer.svelte'
|
|
|
|
interface Props {
|
|
lang: Script['language']
|
|
editor: Editor | undefined
|
|
diffEditor: DiffEditor | undefined
|
|
loopStatus?: { type: 'inside' | 'self'; flow: 'forloopflow' | 'whileloopflow' } | undefined
|
|
testJob?: Job & { result_stream?: string }
|
|
scriptProgress?: number | undefined
|
|
mod: FlowModule
|
|
testIsLoading?: boolean
|
|
disableMock?: boolean
|
|
disableHistory?: boolean
|
|
onUpdateMock?: (mock: { enabled: boolean; return_value?: unknown }) => void
|
|
loadingJob?: boolean
|
|
tagLabel?: string
|
|
// A linked agent persists no tools of its own; its resolved resource tools are passed here so
|
|
// the log viewer can label each tool_call with the definition that ran.
|
|
linkedAgentTools?: AgentTool[]
|
|
}
|
|
|
|
let {
|
|
lang,
|
|
editor,
|
|
diffEditor,
|
|
loopStatus = undefined,
|
|
scriptProgress = $bindable(undefined),
|
|
testJob = undefined,
|
|
mod,
|
|
testIsLoading = false,
|
|
disableMock = false,
|
|
disableHistory = false,
|
|
onUpdateMock,
|
|
loadingJob = false,
|
|
tagLabel = undefined,
|
|
linkedAgentTools = undefined
|
|
}: Props = $props()
|
|
|
|
const { stepsInputArgs, flowStateStore } = getContext<FlowEditorContext>('FlowEditorContext')
|
|
|
|
let outputPickerInner: OutputPickerInner | undefined = $state(undefined)
|
|
export function getOutputPickerInner() {
|
|
return outputPickerInner
|
|
}
|
|
|
|
const selectedJob: OutputViewerJob = $derived.by(
|
|
() => outputPickerInner?.getSelectedJob?.() ?? undefined
|
|
)
|
|
const logJob = $derived(testJob ?? selectedJob)
|
|
const preview = $derived.by(() => outputPickerInner?.getPreview?.())
|
|
</script>
|
|
|
|
<Splitpanes horizontal>
|
|
<Pane size={65} minSize={10} class="text-sm text-primary">
|
|
{#if scriptProgress}
|
|
<JobProgressBar job={testJob} {scriptProgress} compact={true} />
|
|
{/if}
|
|
|
|
<OutputPickerInner
|
|
{testJob}
|
|
fullResult
|
|
moduleId={mod.id}
|
|
closeOnOutsideClick={true}
|
|
getLogs
|
|
{onUpdateMock}
|
|
mock={mod.mock}
|
|
isLoading={testIsLoading || loadingJob}
|
|
path={`path` in mod.value ? mod.value.path : ''}
|
|
{loopStatus}
|
|
{disableMock}
|
|
{disableHistory}
|
|
bind:this={outputPickerInner}
|
|
>
|
|
{#snippet copilot_fix()}
|
|
{@const stepError =
|
|
selectedJob?.type === 'CompletedJob' && !selectedJob.success
|
|
? getStringError(selectedJob.result)
|
|
: undefined}
|
|
{#if lang && editor && diffEditor && stepsInputArgs.getStepArgs(mod.id) && stepError}
|
|
<ScriptFix {lang} error={stepError} jobId={selectedJob?.id} moduleId={mod.id} />
|
|
{/if}
|
|
{/snippet}
|
|
</OutputPickerInner>
|
|
</Pane>
|
|
<Pane size={35} minSize={10}>
|
|
{#if (mod.mock?.enabled && preview !== 'job' && testJob?.type !== 'QueuedJob') || preview === 'mock'}
|
|
<LogViewer
|
|
small
|
|
content={undefined}
|
|
isLoading={false}
|
|
tag={undefined}
|
|
customEmptyMessage="Using pinned data"
|
|
{tagLabel}
|
|
/>
|
|
{:else if mod.value.type === 'aiagent' && logJob?.type === 'CompletedJob'}
|
|
<AiAgentLogViewer
|
|
tools={linkedAgentTools ?? mod.value.tools ?? []}
|
|
agentJob={{
|
|
...logJob,
|
|
type: 'CompletedJob'
|
|
}}
|
|
workspaceId={logJob.workspace_id}
|
|
/>
|
|
{:else}
|
|
<LogViewer
|
|
small
|
|
jobId={logJob?.id}
|
|
duration={logJob?.['duration_ms']}
|
|
mem={logJob?.['mem_peak']}
|
|
content={logJob?.['logs']}
|
|
isLoading={(testIsLoading && logJob?.['running'] == false) || loadingJob}
|
|
tag={logJob?.['tag']}
|
|
{tagLabel}
|
|
onLogsResolved={(logs) => {
|
|
if (
|
|
mod.id &&
|
|
flowStateStore?.val[mod.id] &&
|
|
flowStateStore.val[mod.id].previewJobId === logJob?.id
|
|
) {
|
|
flowStateStore.val[mod.id] = {
|
|
...flowStateStore.val[mod.id],
|
|
previewLogs: logs
|
|
}
|
|
}
|
|
}}
|
|
/>
|
|
{/if}
|
|
</Pane>
|
|
</Splitpanes>
|