Files
boocode/packages/ion/src/schema/node-output.ts
indifferentketchup 02063072ab chore: add ion package, codesight wiki, work plans, ascli config
New @boocode/ion package (v0.0.1) for inference optimization network.
.codesight/ wiki artifacts for codebase documentation.
.omo/ work plans for openspec cleanup and enhanced file panel.
2026-06-07 22:16:45 +00:00

46 lines
1.3 KiB
TypeScript

import { z } from 'zod';
/**
* Output produced by a single DAG node after execution.
*
* Captures the result text, structured fields, and execution metadata
* so downstream nodes can reference outputs via `$nodeId.output` syntax.
*/
export const nodeOutputSchema = z.object({
/** The node id that produced this output. */
nodeId: z.string(),
/** Current state of the node execution. */
state: z.enum(['pending', 'running', 'completed', 'failed', 'skipped']),
/** The raw text output from the node (alias for text for backward compat). */
output: z.string().default(''),
/** The raw text output from the node. */
text: z.string().optional(),
/** Structured output fields (when output_format is defined). */
fields: z.record(z.unknown()).optional(),
/** Error message if the node failed. */
error: z.string().optional(),
/** Token usage or cost metadata. */
costUsd: z.number().optional(),
});
export type NodeOutput = z.infer<typeof nodeOutputSchema>;
/**
* Result of executing a single node within the DAG.
*
* Internal to the engine — not persisted directly but used to build
* the nodeOutputs map that flows between layers.
*/
export interface NodeExecutionResult {
state: 'completed' | 'failed' | 'skipped';
output?: string;
fields?: Record<string, unknown>;
error?: string;
costUsd?: number;
}