@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.
@@ -0,0 +1,31 @@
1
+ type SceneElement = {
2
+ id: string;
3
+ type: string;
4
+ x?: number;
5
+ y?: number;
6
+ frameId?: string | null;
7
+ containerId?: string | null;
8
+ boundElements?: readonly {
9
+ id: string;
10
+ type: string;
11
+ }[] | null;
12
+ startBinding?: {
13
+ elementId?: string;
14
+ } | null;
15
+ endBinding?: {
16
+ elementId?: string;
17
+ } | null;
18
+ };
19
+ export declare const BUNDLE_MIME = "application/vnd.circuitry.bundle+json";
20
+ export type CircuitryBundle = {
21
+ version: 1;
22
+ createdAt: string;
23
+ elements: SceneElement[];
24
+ };
25
+ export declare const createBundleFromSelection: (elements: readonly SceneElement[], selectedIds: Readonly<Record<string, true>>) => CircuitryBundle | null;
26
+ export declare const parseBundleText: (text: string) => CircuitryBundle;
27
+ export declare const importBundleElements: (bundle: CircuitryBundle, opts?: {
28
+ offsetX?: number;
29
+ offsetY?: number;
30
+ }) => SceneElement[];
31
+ export {};
@@ -0,0 +1,221 @@
1
+ export declare const CIRCUITRY_SPEC_VERSION: "0.2";
2
+ export declare const CIRCUITRY_SPEC_VERSION_LEGACY: "0.1";
3
+ export type CircuitrySpecVersion = typeof CIRCUITRY_SPEC_VERSION | typeof CIRCUITRY_SPEC_VERSION_LEGACY;
4
+ export type CircuitryNodeKind = "agent" | "input" | "tool" | "output" | string;
5
+ export type CircuitryEdgeKind = "context" | "dependency" | "message" | "control" | string;
6
+ export type CircuitryInputKind = "text" | "file" | "url" | "image" | "uri" | "canvas" | "mcp" | string;
7
+ export type CircuitryAgent = {
8
+ uses?: string;
9
+ model?: string;
10
+ tools?: string[];
11
+ thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
12
+ identity?: string;
13
+ personality?: string;
14
+ instructions?: string;
15
+ context?: string;
16
+ };
17
+ export type CircuitryInput = {
18
+ id: string;
19
+ type: CircuitryInputKind;
20
+ label?: string;
21
+ value?: string;
22
+ uri?: string;
23
+ mimeType?: string;
24
+ data?: Record<string, unknown>;
25
+ };
26
+ export type CircuitryNode = {
27
+ id: string;
28
+ kind: CircuitryNodeKind;
29
+ label: string;
30
+ agent?: CircuitryAgent;
31
+ input?: Omit<CircuitryInput, "id">;
32
+ skills?: string[];
33
+ expect?: CircuitryExpectSchema;
34
+ data?: Record<string, unknown>;
35
+ view?: {
36
+ adapter?: "excalidraw" | string;
37
+ x?: number;
38
+ y?: number;
39
+ width?: number;
40
+ height?: number;
41
+ color?: string;
42
+ };
43
+ };
44
+ export type CircuitryEdge = {
45
+ id?: string;
46
+ from: string;
47
+ to: string;
48
+ kind?: CircuitryEdgeKind;
49
+ label?: string;
50
+ data?: Record<string, unknown>;
51
+ };
52
+ export type CircuitryExpectFieldType = "str" | "int" | "float" | "bool" | "list" | "dict" | (string & {});
53
+ export type CircuitryExpectField = {
54
+ type: CircuitryExpectFieldType;
55
+ /** Optional substring that must appear in the string value. */
56
+ contains?: string;
57
+ /** For list fields: shape of each item. */
58
+ items?: CircuitryExpectSchema | CircuitryExpectFieldType;
59
+ optional?: boolean;
60
+ };
61
+ export interface CircuitryExpectSchema {
62
+ [key: string]: CircuitryExpectField | CircuitryExpectFieldType | CircuitryExpectSchema;
63
+ }
64
+ export type CircuitryResourceText = {
65
+ type: "text";
66
+ value: string;
67
+ label?: string;
68
+ };
69
+ export type CircuitryResourceAgent = {
70
+ type: "agent";
71
+ identity?: string;
72
+ label?: string;
73
+ model?: string;
74
+ thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
75
+ /** References to other resource ids that feed this agent. */
76
+ inputs?: string[];
77
+ /** Per-resource tool whitelist. */
78
+ tools?: string[];
79
+ /** Per-resource skill whitelist. */
80
+ skills?: string[];
81
+ /** Expected output schema — stored as metadata, used for optional validation. */
82
+ expect?: CircuitryExpectSchema;
83
+ instructions?: string;
84
+ personality?: string;
85
+ context?: string;
86
+ };
87
+ export type CircuitryResourceTool = {
88
+ type: "tool";
89
+ label?: string;
90
+ inputs?: string[];
91
+ instructions?: string;
92
+ };
93
+ export type CircuitryResourceEntry = CircuitryResourceText | CircuitryResourceAgent | CircuitryResourceTool;
94
+ export type CircuitrySandboxProvider = "local" | "docker" | "e2b" | "daytona" | "cloudflare" | "modal" | "openai" | (string & {});
95
+ export type CircuitrySandboxClient = {
96
+ provider: CircuitrySandboxProvider;
97
+ image?: string;
98
+ cwd?: string;
99
+ command?: string[];
100
+ env?: Record<string, string>;
101
+ secrets?: Record<string, string>;
102
+ timeoutMs?: number;
103
+ resources?: {
104
+ cpu?: number;
105
+ memoryMb?: number;
106
+ diskMb?: number;
107
+ gpu?: boolean | string;
108
+ };
109
+ providerOptions?: Record<string, unknown>;
110
+ };
111
+ export type CircuitryRuntimeProvider = "pi" | "claude-code" | "codex" | "opencode" | (string & {});
112
+ export type CircuitryRuntimeClient = {
113
+ type?: "sdk" | "cli" | "mcp" | "http" | (string & {});
114
+ command?: string;
115
+ args?: string[];
116
+ cwd?: string;
117
+ env?: Record<string, string>;
118
+ config?: string;
119
+ agent?: string;
120
+ providerOptions?: Record<string, unknown>;
121
+ };
122
+ export type CircuitryRuntime = {
123
+ provider?: CircuitryRuntimeProvider;
124
+ model?: string;
125
+ client?: CircuitryRuntimeClient;
126
+ sandbox?: CircuitrySandboxClient;
127
+ permissions?: Record<string, unknown>;
128
+ };
129
+ export type CircuitryBuiltInValidationRule = "no-self-loops" | "no-unknown-edge-endpoints" | "require-executable-inputs" | "no-cycles";
130
+ export type CircuitryStringValidationMatch = {
131
+ field: string;
132
+ value: string;
133
+ nodeKinds?: string[];
134
+ edgeKinds?: string[];
135
+ };
136
+ export type CircuitryAdditionalValidationRule = {
137
+ rule: "require-graph-field";
138
+ field: string;
139
+ } | {
140
+ rule: "require-node-field";
141
+ field: string;
142
+ nodeKinds?: string[];
143
+ } | {
144
+ rule: "require-edge-field";
145
+ field: string;
146
+ edgeKinds?: string[];
147
+ } | {
148
+ rule: "require-string";
149
+ graph?: CircuitryStringValidationMatch[];
150
+ nodes?: CircuitryStringValidationMatch[];
151
+ edges?: CircuitryStringValidationMatch[];
152
+ } | {
153
+ rule: "reject-string";
154
+ graph?: CircuitryStringValidationMatch[];
155
+ nodes?: CircuitryStringValidationMatch[];
156
+ edges?: CircuitryStringValidationMatch[];
157
+ };
158
+ export type CircuitryValidationRuleEntry = CircuitryBuiltInValidationRule | {
159
+ rule: CircuitryBuiltInValidationRule;
160
+ executableKinds?: string[];
161
+ } | CircuitryAdditionalValidationRule;
162
+ export type CircuitryGraphValidation = {
163
+ rules?: CircuitryValidationRuleEntry[];
164
+ };
165
+ export type CircuitryGraph = {
166
+ /** Spec version. Use "0.2" for new graphs. */
167
+ circuitry: CircuitrySpecVersion | string;
168
+ id?: string;
169
+ title?: string;
170
+ description?: string;
171
+ resources?: Record<string, CircuitryResourceEntry>;
172
+ agents?: Record<string, Omit<CircuitryNode, "id" | "kind"> & {
173
+ kind?: "agent";
174
+ }>;
175
+ inputs?: Record<string, Omit<CircuitryInput, "id">>;
176
+ nodes?: CircuitryNode[];
177
+ edges?: CircuitryEdge[];
178
+ runtime?: CircuitryRuntime;
179
+ validation?: CircuitryGraphValidation;
180
+ metadata?: Record<string, unknown>;
181
+ };
182
+ export type CircuitryAgentPreset = {
183
+ name: string;
184
+ description?: string;
185
+ model?: string;
186
+ personality?: string;
187
+ instructions: string;
188
+ metadata?: Record<string, unknown>;
189
+ };
190
+ export type CircuitryValidationStandard = {
191
+ version?: CircuitrySpecVersion | string;
192
+ requireSpecVersion?: boolean;
193
+ rules?: CircuitryValidationRuleEntry[];
194
+ executableKinds?: string[];
195
+ };
196
+ export type CircuitryValidationIssue = {
197
+ code: string;
198
+ message: string;
199
+ path?: Array<string | number>;
200
+ };
201
+ export type CircuitryValidationResult = {
202
+ ok: boolean;
203
+ errors: CircuitryValidationIssue[];
204
+ standard: Required<CircuitryValidationStandard>;
205
+ };
206
+ export declare const DEFAULT_CIRCUITRY_VALIDATION_RULES: CircuitryValidationRuleEntry[];
207
+ export declare const DEFAULT_CIRCUITRY_VALIDATION_STANDARD: {
208
+ readonly version: "0.2";
209
+ readonly requireSpecVersion: true;
210
+ readonly rules: CircuitryValidationRuleEntry[];
211
+ readonly executableKinds: ["agent", "tool", "output"];
212
+ };
213
+ export declare const createCircuitryValidationStandard: (standard?: CircuitryValidationStandard, graph?: CircuitryGraph) => Required<CircuitryValidationStandard>;
214
+ export declare const normalizeCircuitryGraph: (graph: CircuitryGraph) => CircuitryGraph;
215
+ export declare const validateCircuitryGraphWithStandard: (graph: unknown, standard?: CircuitryValidationStandard) => CircuitryValidationResult;
216
+ export declare const validateCircuitryGraph: (graph: unknown, standard?: CircuitryValidationStandard) => string[];
217
+ export declare const parseCircuitryJson: (text: string, standard?: CircuitryValidationStandard, options?: {
218
+ validate?: boolean;
219
+ }) => CircuitryGraph;
220
+ export declare const stringifyCircuitryJson: (graph: CircuitryGraph) => string;
221
+ export declare const isUriInput: (input: CircuitryInput | Omit<CircuitryInput, "id">) => boolean;
package/dist/host.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import type { CircuitryGraph, CircuitryValidationResult, CircuitryValidationStandard } from "./graph";
2
+ import type { SimulationRunItem } from "./simulation";
3
+ export interface CircuitryHost {
4
+ readGraph(input: {
5
+ filename?: string;
6
+ }): Promise<{
7
+ filename: string;
8
+ graph: CircuitryGraph;
9
+ text: string;
10
+ lastRun?: any;
11
+ }>;
12
+ validateGraph(input: {
13
+ text?: string;
14
+ filename?: string;
15
+ graph?: CircuitryGraph;
16
+ standard?: CircuitryValidationStandard;
17
+ }): Promise<CircuitryValidationResult>;
18
+ writeGraph(input: {
19
+ text?: string;
20
+ filename?: string;
21
+ graph?: CircuitryGraph;
22
+ mode?: "replace";
23
+ standard?: CircuitryValidationStandard;
24
+ }): Promise<{
25
+ filename: string;
26
+ graph: CircuitryGraph;
27
+ mode: "replace";
28
+ }>;
29
+ runGraph(input: {
30
+ source?: "current" | "text";
31
+ text?: string;
32
+ filename?: string;
33
+ selectedNodeId?: string;
34
+ standard?: CircuitryValidationStandard;
35
+ hostModel?: string;
36
+ }): Promise<{
37
+ completedAt: string;
38
+ runItems: SimulationRunItem[];
39
+ }>;
40
+ }
@@ -0,0 +1,11 @@
1
+ export * from "./types";
2
+ export * from "./graph";
3
+ export * from "./yaml";
4
+ export * from "./presets";
5
+ export * from "./scheduler";
6
+ export * from "./simulation";
7
+ export * from "./bundle";
8
+ export * from "./runtime";
9
+ export * from "./host";
10
+ export * from "./tools";
11
+ export * from "./node";