Merge pull request 'fix: remove cas list, add schema titles' (#324) from fix/319-schema-titles into main
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -44,6 +44,7 @@ function isJsonSchema(value: unknown): value is JSONSchema {
|
||||
|
||||
async function resolveOutputSchemaRef(
|
||||
uwf: UwfStore,
|
||||
roleName: string,
|
||||
outputSchema: string | JSONSchema,
|
||||
): Promise<CasRef> {
|
||||
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] = {
|
||||
|
||||
@@ -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