Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17103c1ee1 | |||
| c8a39be9bd | |||
| b304f65876 | |||
| c9010a024f | |||
| 3434e2b2be |
@@ -15,7 +15,6 @@ import {
|
||||
cmdCasCat,
|
||||
cmdCasGet,
|
||||
cmdCasHas,
|
||||
cmdCasList,
|
||||
cmdCasPut,
|
||||
cmdCasRefs,
|
||||
cmdCasSchemaGet,
|
||||
@@ -222,14 +221,6 @@ cas
|
||||
runAction(() => cmdCasHas(storageRoot, hash));
|
||||
});
|
||||
|
||||
cas
|
||||
.command("list")
|
||||
.description("List all CAS hashes")
|
||||
.action(() => {
|
||||
const storageRoot = resolveStorageRoot();
|
||||
runAction(() => cmdCasList(storageRoot));
|
||||
});
|
||||
|
||||
cas
|
||||
.command("refs")
|
||||
.description("List direct CAS references from a node")
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
saveWorkflowRegistry,
|
||||
type UwfStore,
|
||||
} from "../store.js";
|
||||
import { isCasRef, parseWorkflowPayload } from "../validate.js";
|
||||
import { parseWorkflowPayload } from "../validate.js";
|
||||
|
||||
export type WorkflowListEntry = {
|
||||
name: string;
|
||||
@@ -44,21 +44,16 @@ function isJsonSchema(value: unknown): value is JSONSchema {
|
||||
|
||||
async function resolveOutputSchemaRef(
|
||||
uwf: UwfStore,
|
||||
outputSchema: string | JSONSchema,
|
||||
roleName: string,
|
||||
outputSchema: unknown,
|
||||
): Promise<CasRef> {
|
||||
if (typeof outputSchema === "string") {
|
||||
if (!isCasRef(outputSchema)) {
|
||||
fail(`invalid outputSchema cas_ref: ${outputSchema}`);
|
||||
}
|
||||
if (!uwf.store.has(outputSchema)) {
|
||||
fail(`outputSchema not found in CAS: ${outputSchema}`);
|
||||
}
|
||||
return outputSchema;
|
||||
}
|
||||
if (!isJsonSchema(outputSchema)) {
|
||||
fail("outputSchema must be a cas_ref string or JSON Schema object");
|
||||
fail(`role "${roleName}": outputSchema must be a JSON Schema object`);
|
||||
}
|
||||
return putSchema(uwf.store, outputSchema);
|
||||
const schema: JSONSchema = outputSchema.title === undefined
|
||||
? { ...outputSchema, title: roleName }
|
||||
: outputSchema;
|
||||
return putSchema(uwf.store, schema);
|
||||
}
|
||||
|
||||
async function materializeWorkflowPayload(
|
||||
@@ -69,7 +64,8 @@ async function materializeWorkflowPayload(
|
||||
for (const [roleName, role] of Object.entries(raw.roles)) {
|
||||
const outputSchema = await resolveOutputSchemaRef(
|
||||
uwf,
|
||||
role.outputSchema as string | JSONSchema,
|
||||
`${raw.name}.${roleName}`,
|
||||
role.outputSchema,
|
||||
);
|
||||
roles[roleName] = {
|
||||
description: role.description,
|
||||
|
||||
@@ -15,9 +15,7 @@ function isRoleDefinition(value: unknown): boolean {
|
||||
return false;
|
||||
}
|
||||
const outputSchema = value.outputSchema;
|
||||
const schemaOk =
|
||||
typeof outputSchema === "string" ||
|
||||
(isRecord(outputSchema) && typeof outputSchema.type === "string");
|
||||
const schemaOk = isRecord(outputSchema) && typeof outputSchema.type === "string";
|
||||
return (
|
||||
typeof value.description === "string" && typeof value.systemPrompt === "string" && schemaOk
|
||||
);
|
||||
|
||||
@@ -32,6 +32,7 @@ const TRANSITION: JSONSchema = {
|
||||
};
|
||||
|
||||
export const WORKFLOW_SCHEMA: JSONSchema = {
|
||||
title: "Workflow",
|
||||
type: "object",
|
||||
required: ["name", "description", "roles", "conditions", "graph"],
|
||||
properties: {
|
||||
@@ -57,6 +58,7 @@ export const WORKFLOW_SCHEMA: JSONSchema = {
|
||||
};
|
||||
|
||||
export const START_NODE_SCHEMA: JSONSchema = {
|
||||
title: "StartNode",
|
||||
type: "object",
|
||||
required: ["workflow", "prompt"],
|
||||
properties: {
|
||||
@@ -67,6 +69,7 @@ export const START_NODE_SCHEMA: JSONSchema = {
|
||||
};
|
||||
|
||||
export const STEP_NODE_SCHEMA: JSONSchema = {
|
||||
title: "StepNode",
|
||||
type: "object",
|
||||
required: ["start", "prev", "role", "output", "detail", "agent"],
|
||||
properties: {
|
||||
|
||||
Reference in New Issue
Block a user