(input: {
ctx: WorkflowContext;
opts: WorkflowCLIOptions;
model: string;
thinkingLevel: ParsedThinkingInput;
})
| 347 | } |
| 348 | |
| 349 | function createWorkflowService(input: { |
| 350 | ctx: WorkflowContext; |
| 351 | opts: WorkflowCLIOptions; |
| 352 | model: string; |
| 353 | thinkingLevel: ParsedThinkingInput; |
| 354 | }): WorkflowService { |
| 355 | const experiments = buildExperimentsObject(input.opts.experiment); |
| 356 | const runtime = createRuntime(input.ctx.runtimeConfig, { |
| 357 | projectPath: input.ctx.projectDir, |
| 358 | workspaceName: input.ctx.workspaceId, |
| 359 | workspacePath: input.ctx.workspacePath, |
| 360 | }); |
| 361 | const workspaceSessionDir = input.ctx.config.getSessionDir(input.ctx.workspaceId); |
| 362 | |
| 363 | return new WorkflowService({ |
| 364 | runStore: new WorkflowRunStore({ sessionDir: workspaceSessionDir }), |
| 365 | runtimeFactory: new QuickJSRuntimeFactory(), |
| 366 | taskAdapterFactory: (runId) => |
| 367 | new WorkflowTaskServiceAdapter({ |
| 368 | taskService: input.ctx.services.taskService, |
| 369 | parentWorkspaceId: input.ctx.workspaceId, |
| 370 | workflowRunId: runId, |
| 371 | defaultAgentId: DEFAULT_WORKFLOW_AGENT_ID, |
| 372 | experiments, |
| 373 | modelString: input.model, |
| 374 | thinkingLevel: input.thinkingLevel, |
| 375 | getProjectTrusted: () => input.ctx.projectTrusted, |
| 376 | patchToolConfig: { |
| 377 | workspaceId: input.ctx.workspaceId, |
| 378 | cwd: input.ctx.workspacePath, |
| 379 | runtime, |
| 380 | runtimeTempDir: runtime.normalizePath(".mux/tmp", input.ctx.workspacePath), |
| 381 | workspaceSessionDir, |
| 382 | trusted: input.ctx.projectTrusted, |
| 383 | }, |
| 384 | }), |
| 385 | resolveWorkflowScript: (scriptPath) => |
| 386 | resolveWorkflowScript({ |
| 387 | scriptPath, |
| 388 | runtime, |
| 389 | workspacePath: input.ctx.workspacePath, |
| 390 | projectTrusted: input.ctx.projectTrusted, |
| 391 | }), |
| 392 | getCurrentProjectTrusted: () => input.ctx.projectTrusted, |
| 393 | runnerId: input.ctx.workspaceId, |
| 394 | }); |
| 395 | } |
| 396 | |
| 397 | async function runWorkflow(scriptPath: string, options: WorkflowCLIOptions): Promise<number> { |
| 398 | const projectDir = await resolveProjectDir({ |
no test coverage detected