mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-28 08:06:16 +00:00
* feat: app conversations through the memory_id query parameter, chat-mode flows included Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: regenerate the mcp session instructions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: type backendAsync's memoryId option in the eval diagnostics Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: pin git-sync hub scripts to windmill-cli 1.849.0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: memoryId option on the sync backend call too Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bump the ui builder artifact for the memoryId option Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: shared-utils 1.0.14 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: cli takes shared-utils 1.0.14 for the memoryId option Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: pin the app conversation scoping and the memoryId signatures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: assert the ownership refusal, not any refusal Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: match the memoryId option in the cli wmill.ts signature tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: file an app's turns as the deployed flow's conversation, preview included Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import { turnRunningError } from './api'
|
|
import type { ChatOptions } from './types'
|
|
|
|
/**
|
|
* `run` and `follow` over a raw app's chat runnable (a saved AI agent, or a flow in chat mode),
|
|
* behind the `runnable` option. The conversation id goes as `memoryId`, the run's `memory_id`
|
|
* query parameter, which keys the conversation and its memory.
|
|
*/
|
|
export function rawAppRunnable(
|
|
// The generated signature is the runnable's own.
|
|
start: (args: any, opts: { memoryId: string }) => Promise<string>,
|
|
streamJob: (jobId: string, onUpdate?: (update: { new_result_stream?: string }) => void) => Promise<unknown>
|
|
): Required<Pick<ChatOptions, 'run' | 'follow'>> {
|
|
return {
|
|
run: async (args, { conversationId }) => {
|
|
try {
|
|
return String(await start(args, { memoryId: conversationId }))
|
|
} catch (e) {
|
|
// The host relays the server's refusal as the error's text, possibly behind a stack.
|
|
const text = e instanceof Error ? e.message : String(e)
|
|
throw turnRunningError(text.slice(text.indexOf('{'), text.lastIndexOf('}') + 1)) ?? e
|
|
}
|
|
},
|
|
follow: (jobId, onStream) =>
|
|
streamJob(jobId, (update) => {
|
|
if (update.new_result_stream) onStream(update.new_result_stream)
|
|
})
|
|
}
|
|
}
|