mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 00:02:19 +00:00
b883f9a9d2
* feat: add ai chat schedule and trigger tools * refactor: use zod for ai chat workspace tools * refactor: let ai provide runnable target fields * refactor: generate ai chat workspace tool schemas * fix: add object type to composed tool schemas * fix: avoid top-level trigger schema unions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: block undeployed workspace ai tools Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: inject ai workspace tool target Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test: add ai evals for workspace tools Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test: make workspace tool eval prompts realistic Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: surface workspace tool errors * fix: show workspace tool success details * fix: describe workspace tool path format * fix: clarify workspace path examples * fix: tighten workspace tool validation * fix: align workspace tool prompts * chore: mark generated chat schemas * chore: mark generated cli skills --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
import type { FlowModule } from "../../frontend/src/lib/gen";
|
|
import type { FlowFixture } from "../adapters/frontend/core/flow/flowEvalRunner";
|
|
import type { FlowWorkspaceFixtures } from "../adapters/frontend/core/flow/fileHelpers";
|
|
import type { FlowState } from "../core/validators";
|
|
|
|
export interface FlowInitialFixture {
|
|
flowFixture?: FlowFixture;
|
|
flowState?: FlowState;
|
|
workspace?: FlowWorkspaceFixtures;
|
|
}
|
|
|
|
export function normalizeFlowInitialFixture(value: unknown): FlowInitialFixture {
|
|
if (isObject(value) && ("flow" in value || "workspace" in value)) {
|
|
const fixture = value as {
|
|
flow?: unknown;
|
|
workspace?: FlowWorkspaceFixtures;
|
|
};
|
|
const flowState = fixture.flow ? normalizeFlowStateFixture(fixture.flow) : undefined;
|
|
return {
|
|
flowState,
|
|
flowFixture: flowState ? normalizeFlowFixture(flowState) : undefined,
|
|
workspace: fixture.workspace,
|
|
};
|
|
}
|
|
|
|
const flowState = normalizeFlowStateFixture(value);
|
|
return {
|
|
flowState,
|
|
flowFixture: normalizeFlowFixture(flowState),
|
|
};
|
|
}
|
|
|
|
export function normalizeFlowStateFixture(value: unknown): FlowState {
|
|
if (!isObject(value)) {
|
|
return {};
|
|
}
|
|
if ("flow" in value && isObject((value as { flow?: unknown }).flow)) {
|
|
return (value as { flow: FlowState }).flow;
|
|
}
|
|
return value as FlowState;
|
|
}
|
|
|
|
export function normalizeFlowFixture(value: FlowState): FlowFixture {
|
|
return {
|
|
path: value.path,
|
|
schema: value.schema,
|
|
value: value.value
|
|
? {
|
|
modules: value.value.modules as FlowModule[] | undefined,
|
|
preprocessor_module: value.value.preprocessor_module as FlowModule | undefined,
|
|
failure_module: value.value.failure_module as FlowModule | undefined,
|
|
}
|
|
: undefined,
|
|
};
|
|
}
|
|
|
|
function isObject(value: unknown): value is Record<string, unknown> {
|
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
}
|