feat: add four-phase role description (identity/prepare/execute/report)

- Extend RoleDefinition with identity, prepare, execute, report fields
- Make systemPrompt optional (nullable) for four-phase workflows
- Update ROLE_DEFINITION JSON Schema (all new fields optional)
- Update validate.ts to accept new fields
- Update workflow.ts to strip null fields before CAS storage
- Update thread read to prefer identity over systemPrompt
- Add --version flag to uwf CLI
- Bump all packages to 0.5.0

Refs #359
This commit is contained in:
2026-05-21 01:41:20 +00:00
parent f9979c3c89
commit fc7d482b4f
12 changed files with 45 additions and 15 deletions
+11 -3
View File
@@ -16,9 +16,17 @@ function isRoleDefinition(value: unknown): boolean {
}
const outputSchema = value.outputSchema;
const schemaOk = isRecord(outputSchema) && typeof outputSchema.type === "string";
return (
typeof value.description === "string" && typeof value.systemPrompt === "string" && schemaOk
);
const hasSystemPrompt =
value.systemPrompt === undefined || value.systemPrompt === null || typeof value.systemPrompt === "string";
const hasIdentity =
value.identity === undefined || value.identity === null || typeof value.identity === "string";
const hasPrepare =
value.prepare === undefined || value.prepare === null || typeof value.prepare === "string";
const hasExecute =
value.execute === undefined || value.execute === null || typeof value.execute === "string";
const hasReport =
value.report === undefined || value.report === null || typeof value.report === "string";
return typeof value.description === "string" && hasSystemPrompt && hasIdentity && hasPrepare && hasExecute && hasReport && schemaOk;
}
function isConditionDefinition(value: unknown): boolean {