From a3114bf84060ae1e71a262db35c929cd83693887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Fri, 22 May 2026 02:06:05 +0000 Subject: [PATCH] chore: apply biome formatting across codebase --- .../__tests__/agent.test.ts | 2 +- .../__tests__/runner.test.ts | 15 ++++-- .../workflow-agent-docx-diff/package.json | 6 ++- .../workflow-agent-docx-diff/src/agent.ts | 19 ++++--- .../workflow-agent-docx-diff/src/runner.ts | 5 +- .../__tests__/agent.test.ts | 2 +- .../__tests__/runner.test.ts | 16 ++++-- .../workflow-agent-office/package.json | 6 ++- .../workflow-agent-office/src/agent.ts | 20 ++++++-- .../workflow-agent-office/src/runner.ts | 5 +- legacy-packages/workflow-dashboard/index.html | 2 +- .../plugins/vite-limit-line-plugin.ts | 30 +++++++---- .../src/components/ui/resizable-panel.tsx | 5 +- .../__tests__/document-template.test.ts | 16 ++++-- .../workflow-template-document/package.json | 6 ++- packages/cli-workflow/src/commands/cas.ts | 28 +++-------- packages/cli-workflow/src/commands/setup.ts | 50 +++++++++++++------ packages/cli-workflow/src/schemas.ts | 6 +-- packages/workflow-agent-hermes/src/hermes.ts | 7 ++- .../__tests__/frontmatter-fast-path.test.ts | 6 +-- packages/workflow-agent-kit/src/context.ts | 19 ++----- .../workflow-agent-kit/src/frontmatter.ts | 2 +- packages/workflow-agent-kit/src/index.ts | 4 +- packages/workflow-agent-kit/src/run.ts | 3 +- packages/workflow-moderator/src/evaluate.ts | 5 +- packages/workflow-util/src/index.ts | 10 ++-- 26 files changed, 167 insertions(+), 128 deletions(-) diff --git a/legacy-packages/workflow-agent-docx-diff/__tests__/agent.test.ts b/legacy-packages/workflow-agent-docx-diff/__tests__/agent.test.ts index c201f83..8986c48 100644 --- a/legacy-packages/workflow-agent-docx-diff/__tests__/agent.test.ts +++ b/legacy-packages/workflow-agent-docx-diff/__tests__/agent.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; -import { packageDescriptor } from "../src/package-descriptor.js"; import { createDocxDiffAgent } from "../src/agent.js"; +import { packageDescriptor } from "../src/package-descriptor.js"; describe("createDocxDiffAgent", () => { test("returns an AdapterFn (function)", () => { diff --git a/legacy-packages/workflow-agent-docx-diff/__tests__/runner.test.ts b/legacy-packages/workflow-agent-docx-diff/__tests__/runner.test.ts index 3d7d2e0..47ba217 100644 --- a/legacy-packages/workflow-agent-docx-diff/__tests__/runner.test.ts +++ b/legacy-packages/workflow-agent-docx-diff/__tests__/runner.test.ts @@ -1,8 +1,8 @@ -import { mkdirSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; -import { tmpdir } from "node:os"; import { describe, expect, mock, test } from "bun:test"; -import { ok, err } from "@uncaged/workflow-util"; +import { mkdirSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { err, ok } from "@uncaged/workflow-util"; import type { SpawnCliConfig } from "@uncaged/workflow-util-agent"; import { runDocxDiff } from "../src/runner.js"; @@ -74,7 +74,12 @@ describe("runDocxDiff", () => { test("exit 2: throws error", async () => { const dir = tempDir(); const spawnFn = makeSpawn( - err({ kind: "non_zero_exit", exitCode: 2, stdout: "", stderr: "fatal error" }) as MockSpawnResult, + err({ + kind: "non_zero_exit", + exitCode: 2, + stdout: "", + stderr: "fatal error", + }) as MockSpawnResult, ); await expect( diff --git a/legacy-packages/workflow-agent-docx-diff/package.json b/legacy-packages/workflow-agent-docx-diff/package.json index 1cbbf33..fd28635 100644 --- a/legacy-packages/workflow-agent-docx-diff/package.json +++ b/legacy-packages/workflow-agent-docx-diff/package.json @@ -1,7 +1,11 @@ { "name": "@uncaged/workflow-agent-docx-diff", "version": "0.1.0", - "files": ["src", "dist", "package.json"], + "files": [ + "src", + "dist", + "package.json" + ], "type": "module", "types": "src/index.ts", "exports": { diff --git a/legacy-packages/workflow-agent-docx-diff/src/agent.ts b/legacy-packages/workflow-agent-docx-diff/src/agent.ts index 4c9ea87..49d1300 100644 --- a/legacy-packages/workflow-agent-docx-diff/src/agent.ts +++ b/legacy-packages/workflow-agent-docx-diff/src/agent.ts @@ -1,7 +1,12 @@ -import * as z from "zod/v4"; import { dirname, join } from "node:path"; -import type { AdapterFn, RoleResult, ThreadContext, WorkflowRuntime } from "@uncaged/workflow-runtime"; +import type { + AdapterFn, + RoleResult, + ThreadContext, + WorkflowRuntime, +} from "@uncaged/workflow-runtime"; import type { WriterMeta } from "@uncaged/workflow-template-document"; +import type * as z from "zod/v4"; import { runDocxDiff } from "./runner.js"; import type { DocxDiffAgentConfig } from "./types.js"; @@ -12,16 +17,10 @@ export function createDocxDiffAgent(config: DocxDiffAgentConfig): AdapterFn { if (writerStep === undefined) throw new Error("differ: no writer step found"); const writerMeta = writerStep.meta as WriterMeta; - if (writerMeta.mode !== "edit") - throw new Error("differ: writer did not run in edit mode"); + if (writerMeta.mode !== "edit") throw new Error("differ: writer did not run in edit mode"); const diffDocx = join(dirname(writerMeta.outputDocx), "diff.docx"); - const raw = await runDocxDiff( - config, - writerMeta.sourceDocx, - writerMeta.outputDocx, - diffDocx, - ); + const raw = await runDocxDiff(config, writerMeta.sourceDocx, writerMeta.outputDocx, diffDocx); const meta = schema.parse(JSON.parse(raw)) as T; return { meta, childThread: null }; diff --git a/legacy-packages/workflow-agent-docx-diff/src/runner.ts b/legacy-packages/workflow-agent-docx-diff/src/runner.ts index f29f5e4..05eb230 100644 --- a/legacy-packages/workflow-agent-docx-diff/src/runner.ts +++ b/legacy-packages/workflow-agent-docx-diff/src/runner.ts @@ -1,6 +1,6 @@ import { stat } from "node:fs/promises"; -import { spawnCli } from "@uncaged/workflow-util-agent"; import type { SpawnCliError } from "@uncaged/workflow-util-agent"; +import { spawnCli } from "@uncaged/workflow-util-agent"; import type { DocxDiffAgentConfig } from "./types.js"; type SpawnCliFn = typeof spawnCli; @@ -8,8 +8,7 @@ type SpawnCliFn = typeof spawnCli; function throwSpawnError(e: SpawnCliError): never { if (e.kind === "non_zero_exit") throw new Error(`docx-diff failed (exit ${e.exitCode}): ${e.stderr}`); - if (e.kind === "timeout") - throw new Error("docx-diff: timed out"); + if (e.kind === "timeout") throw new Error("docx-diff: timed out"); throw new Error(`docx-diff: spawn failed: ${e.message}`); } diff --git a/legacy-packages/workflow-agent-office/__tests__/agent.test.ts b/legacy-packages/workflow-agent-office/__tests__/agent.test.ts index 01bb3c4..89a8238 100644 --- a/legacy-packages/workflow-agent-office/__tests__/agent.test.ts +++ b/legacy-packages/workflow-agent-office/__tests__/agent.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; -import { packageDescriptor } from "../src/package-descriptor.js"; import { createOfficeAgent } from "../src/agent.js"; +import { packageDescriptor } from "../src/package-descriptor.js"; describe("createOfficeAgent", () => { test("returns an AdapterFn (function)", () => { diff --git a/legacy-packages/workflow-agent-office/__tests__/runner.test.ts b/legacy-packages/workflow-agent-office/__tests__/runner.test.ts index 2fb8098..c691454 100644 --- a/legacy-packages/workflow-agent-office/__tests__/runner.test.ts +++ b/legacy-packages/workflow-agent-office/__tests__/runner.test.ts @@ -1,8 +1,8 @@ -import { mkdirSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; -import { tmpdir } from "node:os"; import { describe, expect, mock, test } from "bun:test"; -import { ok, err } from "@uncaged/workflow-util"; +import { mkdirSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { err, ok } from "@uncaged/workflow-util"; import type { SpawnCliConfig } from "@uncaged/workflow-util-agent"; import { editDocument, generateDocument } from "../src/runner.js"; @@ -123,7 +123,13 @@ describe("editDocument", () => { ); await expect( - editDocument({ outputDir: base, command: null, timeout: null }, "te2", "edit", inputFile, spawnFn), + editDocument( + { outputDir: base, command: null, timeout: null }, + "te2", + "edit", + inputFile, + spawnFn, + ), ).rejects.toThrow("spawn failed"); }); }); diff --git a/legacy-packages/workflow-agent-office/package.json b/legacy-packages/workflow-agent-office/package.json index 8686c44..970e70c 100644 --- a/legacy-packages/workflow-agent-office/package.json +++ b/legacy-packages/workflow-agent-office/package.json @@ -1,7 +1,11 @@ { "name": "@uncaged/workflow-agent-office", "version": "0.1.0", - "files": ["src", "dist", "package.json"], + "files": [ + "src", + "dist", + "package.json" + ], "type": "module", "types": "src/index.ts", "exports": { diff --git a/legacy-packages/workflow-agent-office/src/agent.ts b/legacy-packages/workflow-agent-office/src/agent.ts index 2c5fae8..a55e5d9 100644 --- a/legacy-packages/workflow-agent-office/src/agent.ts +++ b/legacy-packages/workflow-agent-office/src/agent.ts @@ -1,6 +1,11 @@ -import * as z from "zod/v4"; -import type { AdapterFn, RoleResult, ThreadContext, WorkflowRuntime } from "@uncaged/workflow-runtime"; +import type { + AdapterFn, + RoleResult, + ThreadContext, + WorkflowRuntime, +} from "@uncaged/workflow-runtime"; import { createLogger } from "@uncaged/workflow-util"; +import type * as z from "zod/v4"; import { editDocument, generateDocument } from "./runner.js"; import type { OfficeAgentConfig } from "./types.js"; @@ -27,7 +32,10 @@ export function createOfficeAgent(config: OfficeAgentConfig): AdapterFn { return (_systemPrompt: string, schema: z.ZodType) => async (ctx: ThreadContext, _runtime: WorkflowRuntime): Promise> => { const { prompt, inputDocx } = parseStartInput(ctx.start.content); - log("8FQKP3NV", `office-agent: mode=${inputDocx === null ? "generate" : "edit"} thread=${ctx.threadId}`); + log( + "8FQKP3NV", + `office-agent: mode=${inputDocx === null ? "generate" : "edit"} thread=${ctx.threadId}`, + ); let raw: string; if (inputDocx === null) { @@ -35,7 +43,11 @@ export function createOfficeAgent(config: OfficeAgentConfig): AdapterFn { raw = JSON.stringify({ mode: "generate", outputDocx: result.outputDocx, sourceDocx: null }); } else { const result = await editDocument(config, ctx.threadId, prompt, inputDocx); - raw = JSON.stringify({ mode: "edit", outputDocx: result.outputDocx, sourceDocx: result.sourceDocx }); + raw = JSON.stringify({ + mode: "edit", + outputDocx: result.outputDocx, + sourceDocx: result.sourceDocx, + }); } const meta = schema.parse(JSON.parse(raw)) as T; diff --git a/legacy-packages/workflow-agent-office/src/runner.ts b/legacy-packages/workflow-agent-office/src/runner.ts index e001043..d50891f 100644 --- a/legacy-packages/workflow-agent-office/src/runner.ts +++ b/legacy-packages/workflow-agent-office/src/runner.ts @@ -1,7 +1,7 @@ import { copyFile, mkdir, stat } from "node:fs/promises"; import { join } from "node:path"; -import { spawnCli } from "@uncaged/workflow-util-agent"; import type { SpawnCliError } from "@uncaged/workflow-util-agent"; +import { spawnCli } from "@uncaged/workflow-util-agent"; import type { OfficeAgentConfig } from "./types.js"; type SpawnCliFn = typeof spawnCli; @@ -9,8 +9,7 @@ type SpawnCliFn = typeof spawnCli; function throwSpawnError(e: SpawnCliError): never { if (e.kind === "non_zero_exit") throw new Error(`office-agent failed (exit ${e.exitCode}): ${e.stderr}`); - if (e.kind === "timeout") - throw new Error("office-agent: timed out"); + if (e.kind === "timeout") throw new Error("office-agent: timed out"); throw new Error(`office-agent: spawn failed: ${e.message}`); } diff --git a/legacy-packages/workflow-dashboard/index.html b/legacy-packages/workflow-dashboard/index.html index da26862..3ae7430 100644 --- a/legacy-packages/workflow-dashboard/index.html +++ b/legacy-packages/workflow-dashboard/index.html @@ -5,7 +5,7 @@ Workflow Dashboard