@darkhorseprojects/circuitry 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import type { CircuitryHost } from "./host";
2
+ import type { CircuitryGraph, CircuitryValidationStandard } from "./graph";
3
+ import type { NodeExecutionRequest, NodeExecutionResult, SimulationRunItem } from "./simulation";
4
+ export declare const runNodeWithPiSDK: ({ model, prompt, images, tools, thinkingLevel, }: NodeExecutionRequest) => Promise<NodeExecutionResult>;
5
+ export declare class NodeCircuitryHost implements CircuitryHost {
6
+ private resolveGraphFile;
7
+ private runFileFor;
8
+ private exists;
9
+ private parseIssue;
10
+ private parseGraphForValidation;
11
+ private readGraphFile;
12
+ readGraph(input?: {
13
+ filename?: string;
14
+ }): Promise<{
15
+ filename: string;
16
+ graph: CircuitryGraph;
17
+ text: string;
18
+ lastRun: any;
19
+ }>;
20
+ validateGraph(input: {
21
+ text?: string;
22
+ filename?: string;
23
+ graph?: CircuitryGraph;
24
+ standard?: CircuitryValidationStandard;
25
+ }): Promise<import("./graph").CircuitryValidationResult>;
26
+ writeGraph(input: {
27
+ text?: string;
28
+ filename?: string;
29
+ graph?: CircuitryGraph;
30
+ mode?: "replace";
31
+ standard?: CircuitryValidationStandard;
32
+ }): Promise<{
33
+ filename: string;
34
+ graph: CircuitryGraph;
35
+ mode: "replace";
36
+ }>;
37
+ runGraph(input?: {
38
+ source?: "current" | "text";
39
+ text?: string;
40
+ filename?: string;
41
+ selectedNodeId?: string;
42
+ standard?: CircuitryValidationStandard;
43
+ hostModel?: string;
44
+ }): Promise<{
45
+ completedAt: string;
46
+ runItems: SimulationRunItem[];
47
+ }>;
48
+ }
@@ -0,0 +1,4 @@
1
+ import type { CircuitryAgentPreset, CircuitryGraph } from "./graph";
2
+ export declare const CIRCUITRY_AGENT_PRESET_DIRS: readonly [".agents/agents", ".circuitry/agents", "~/.agents/agents", "~/.circuitry/agents"];
3
+ export declare const parseAgentPresetMarkdown: (text: string, fallbackName: string) => CircuitryAgentPreset;
4
+ export declare const applyAgentPresets: (graph: CircuitryGraph, presets: Record<string, CircuitryAgentPreset>) => CircuitryGraph;
@@ -0,0 +1,16 @@
1
+ import type { CircuitryGraph, CircuitryRuntimeProvider } from "./graph";
2
+ import type { NodeExecutionRequest, NodeExecutionResult, SimulationRunItem } from "./simulation";
3
+ export type CircuitryRuntimeModel = {
4
+ id: string;
5
+ label?: string;
6
+ };
7
+ export type CircuitryRuntimeAdapter = {
8
+ id: CircuitryRuntimeProvider;
9
+ label: string;
10
+ listModels?: () => Promise<CircuitryRuntimeModel[]> | CircuitryRuntimeModel[];
11
+ runNode: (request: NodeExecutionRequest) => Promise<NodeExecutionResult>;
12
+ runGraph?: (graph: CircuitryGraph) => Promise<{
13
+ runItems: SimulationRunItem[];
14
+ }>;
15
+ };
16
+ export declare const createUnsupportedRuntimeAdapter: (id: CircuitryRuntimeProvider) => CircuitryRuntimeAdapter;
@@ -0,0 +1,30 @@
1
+ import { type CircuitryGraph, type CircuitryNode } from "./graph";
2
+ import type { NodeContextInput, NodeExecutionRequest, NodeExecutionResult, SimulationRunItem } from "./simulation";
3
+ export type CircuitryExecutionNode = {
4
+ id: string;
5
+ node: CircuitryNode;
6
+ inputNodeIds: string[];
7
+ outputNodeIds: string[];
8
+ output?: string;
9
+ completed?: boolean;
10
+ };
11
+ export type CircuitryExecutionGraph = {
12
+ nodes: Map<string, CircuitryExecutionNode>;
13
+ };
14
+ export declare const buildCircuitryExecutionGraph: (graph: CircuitryGraph) => CircuitryExecutionGraph;
15
+ export declare const runCircuitryGraphExecution: ({ graph, selectedNodeId, executeNode, resolveContextInputs, onNodeStart, onNodeComplete, maxParallelRuns, }: {
16
+ graph: CircuitryGraph;
17
+ selectedNodeId?: string;
18
+ executeNode: (request: NodeExecutionRequest) => Promise<NodeExecutionResult>;
19
+ resolveContextInputs?: (args: {
20
+ nodeId: string;
21
+ inputNodeIds: Set<string>;
22
+ graph: CircuitryGraph;
23
+ }) => Promise<NodeContextInput[]> | NodeContextInput[];
24
+ onNodeStart?: (nodeId: string, fallbackCycle: boolean) => void;
25
+ onNodeComplete?: (nodeId: string, result: {
26
+ output?: string;
27
+ error?: string;
28
+ }) => void;
29
+ maxParallelRuns?: number;
30
+ }) => Promise<SimulationRunItem[]>;
@@ -0,0 +1,90 @@
1
+ import { type CircuitryNodeData } from "./types";
2
+ type SceneElement = {
3
+ id: string;
4
+ type: string;
5
+ customData?: Record<string, unknown> | {
6
+ circuitry?: CircuitryNodeData;
7
+ };
8
+ };
9
+ export type SimulationNode = {
10
+ id: string;
11
+ element: SceneElement;
12
+ data: CircuitryNodeData;
13
+ inputNodeIds: string[];
14
+ outputNodeIds: string[];
15
+ incomingSourceIds: string[];
16
+ };
17
+ export type SimulationRunItem = {
18
+ nodeId: string;
19
+ fallbackCycle: boolean;
20
+ inputNodeIds: string[];
21
+ output: string;
22
+ error?: string;
23
+ };
24
+ export type NodeContextInput = {
25
+ sourceId: string;
26
+ kind: "text" | "image" | "element";
27
+ text?: string;
28
+ elementType?: string;
29
+ image?: {
30
+ mediaType: string;
31
+ data: string;
32
+ };
33
+ };
34
+ export type NodeExecutionRequest = {
35
+ nodeId: string;
36
+ model: string;
37
+ tools: string[];
38
+ thinkingLevel: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
39
+ prompt: string;
40
+ personality: string;
41
+ instructions: string;
42
+ context: string;
43
+ inputs: Array<{
44
+ nodeId: string;
45
+ output: string;
46
+ }>;
47
+ contextInputs: NodeContextInput[];
48
+ images: Array<{
49
+ mediaType: string;
50
+ data: string;
51
+ }>;
52
+ };
53
+ export type NodeExecutionResult = {
54
+ output: string;
55
+ };
56
+ export type SimulationGraph = {
57
+ nodes: Map<string, SimulationNode>;
58
+ };
59
+ export type GraphRunMode = "dependency" | "single";
60
+ export declare const DEFAULT_MAX_PARALLEL_RUNS = 4;
61
+ export declare const buildSimulationGraph: (elements: readonly SceneElement[]) => SimulationGraph;
62
+ export declare const runGraphExecution: ({ elements, mode, selectedNodeId, executeNode, resolveContextInputs, onNodeStart, onNodeComplete, maxParallelRuns, }: {
63
+ elements: readonly SceneElement[];
64
+ mode: GraphRunMode;
65
+ selectedNodeId?: string;
66
+ executeNode: (request: NodeExecutionRequest) => Promise<NodeExecutionResult>;
67
+ resolveContextInputs?: (args: {
68
+ nodeId: string;
69
+ inputNodeIds: Set<string>;
70
+ incomingSourceIds: string[];
71
+ elements: readonly SceneElement[];
72
+ }) => Promise<NodeContextInput[]> | NodeContextInput[];
73
+ onNodeStart?: (nodeId: string, fallbackCycle: boolean) => void;
74
+ onNodeComplete?: (nodeId: string, result: {
75
+ output?: string;
76
+ error?: string;
77
+ }) => void;
78
+ maxParallelRuns?: number;
79
+ }) => Promise<SimulationRunItem[]>;
80
+ export declare const runDependencySimulation: ({ elements, executeNode, onNodeStart, onNodeComplete, maxParallelRuns, }: {
81
+ elements: readonly SceneElement[];
82
+ executeNode: (request: NodeExecutionRequest) => Promise<NodeExecutionResult>;
83
+ onNodeStart?: (nodeId: string, fallbackCycle: boolean) => void;
84
+ onNodeComplete?: (nodeId: string, result: {
85
+ output?: string;
86
+ error?: string;
87
+ }) => void;
88
+ maxParallelRuns?: number;
89
+ }) => Promise<SimulationRunItem[]>;
90
+ export {};