From b304f65876b698b19b39e9b08623336c5cefc9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Mon, 18 May 2026 13:03:40 +0000 Subject: [PATCH] feat: auto-set outputSchema title from role name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When uwf workflow put processes inline JSON Schema for a role, auto-inject title=roleName if not already set. Makes uwf cas schema list show meaningful names like 'planner', 'coder' instead of (unnamed). 小橘 🍊(NEKO Team) --- packages/cli-uwf/src/commands/workflow.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/cli-uwf/src/commands/workflow.ts b/packages/cli-uwf/src/commands/workflow.ts index 3ebf39b..6dae47d 100644 --- a/packages/cli-uwf/src/commands/workflow.ts +++ b/packages/cli-uwf/src/commands/workflow.ts @@ -44,6 +44,7 @@ function isJsonSchema(value: unknown): value is JSONSchema { async function resolveOutputSchemaRef( uwf: UwfStore, + roleName: string, outputSchema: string | JSONSchema, ): Promise { if (typeof outputSchema === "string") { @@ -58,6 +59,10 @@ async function resolveOutputSchemaRef( if (!isJsonSchema(outputSchema)) { fail("outputSchema must be a cas_ref string or JSON Schema object"); } + // Auto-set title from role name if not already present + if (outputSchema.title === undefined) { + outputSchema = { ...outputSchema, title: roleName }; + } return putSchema(uwf.store, outputSchema); } @@ -69,6 +74,7 @@ async function materializeWorkflowPayload( for (const [roleName, role] of Object.entries(raw.roles)) { const outputSchema = await resolveOutputSchemaRef( uwf, + `${raw.name}.${roleName}`, role.outputSchema as string | JSONSchema, ); roles[roleName] = {