@darkhorseprojects/circuitry 0.3.0 → 0.3.2
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/bundle.d.ts +2 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +277 -0
- package/dist/graph.d.ts +33 -68
- package/dist/index.js +142 -306
- package/dist/node.d.ts +11 -6
- package/dist/node.js +204 -369
- package/dist/presets.d.ts +1 -1
- package/dist/scheduler.d.ts +1 -1
- package/dist/simulation.d.ts +3 -4
- package/dist/types.d.ts +0 -1
- package/dist/yaml.d.ts +4 -2
- package/package.json +4 -1
package/dist/bundle.d.ts
CHANGED
|
@@ -16,13 +16,14 @@ type SceneElement = {
|
|
|
16
16
|
elementId?: string;
|
|
17
17
|
} | null;
|
|
18
18
|
};
|
|
19
|
-
export declare const BUNDLE_MIME = "application/vnd.circuitry.bundle+
|
|
19
|
+
export declare const BUNDLE_MIME = "application/vnd.circuitry.bundle+yaml";
|
|
20
20
|
export type CircuitryBundle = {
|
|
21
21
|
version: 1;
|
|
22
22
|
createdAt: string;
|
|
23
23
|
elements: SceneElement[];
|
|
24
24
|
};
|
|
25
25
|
export declare const createBundleFromSelection: (elements: readonly SceneElement[], selectedIds: Readonly<Record<string, true>>) => CircuitryBundle | null;
|
|
26
|
+
export declare const stringifyBundle: (bundle: CircuitryBundle) => string;
|
|
26
27
|
export declare const parseBundleText: (text: string) => CircuitryBundle;
|
|
27
28
|
export declare const importBundleElements: (bundle: CircuitryBundle, opts?: {
|
|
28
29
|
offsetX?: number;
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
5
|
+
|
|
6
|
+
// src/node.ts
|
|
7
|
+
import { access, readFile, writeFile } from "node:fs/promises";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
|
|
10
|
+
// src/yaml.ts
|
|
11
|
+
import YAML2 from "yaml";
|
|
12
|
+
|
|
13
|
+
// src/graph.ts
|
|
14
|
+
import YAML from "yaml";
|
|
15
|
+
var CIRCUITRY_SPEC_VERSION = "0.3.2";
|
|
16
|
+
var DEFAULT_CIRCUITRY_VALIDATION_RULES = [
|
|
17
|
+
"no-self-loops",
|
|
18
|
+
"no-unknown-edge-endpoints",
|
|
19
|
+
"require-executable-inputs",
|
|
20
|
+
"no-cycles"
|
|
21
|
+
];
|
|
22
|
+
var DEFAULT_CIRCUITRY_VALIDATION_STANDARD = {
|
|
23
|
+
version: CIRCUITRY_SPEC_VERSION,
|
|
24
|
+
requireSpecVersion: true,
|
|
25
|
+
rules: DEFAULT_CIRCUITRY_VALIDATION_RULES,
|
|
26
|
+
executableKinds: ["agent", "tool", "output"]
|
|
27
|
+
};
|
|
28
|
+
var ruleName = (rule) => typeof rule === "string" ? rule : rule.rule;
|
|
29
|
+
var executableKindsFromRules = (rules) => rules.find((rule) => typeof rule !== "string" && rule.rule === "require-executable-inputs")?.executableKinds;
|
|
30
|
+
var createCircuitryValidationStandard = (standard = {}, graph) => {
|
|
31
|
+
const rules = [...DEFAULT_CIRCUITRY_VALIDATION_RULES, ...graph?.validation?.rules || [], ...standard.rules || []];
|
|
32
|
+
return {
|
|
33
|
+
version: standard.version || DEFAULT_CIRCUITRY_VALIDATION_STANDARD.version,
|
|
34
|
+
requireSpecVersion: standard.requireSpecVersion ?? DEFAULT_CIRCUITRY_VALIDATION_STANDARD.requireSpecVersion,
|
|
35
|
+
rules,
|
|
36
|
+
executableKinds: standard.executableKinds || executableKindsFromRules(rules) || [...DEFAULT_CIRCUITRY_VALIDATION_STANDARD.executableKinds]
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var expandResources = (resources) => {
|
|
40
|
+
const nodes = [];
|
|
41
|
+
const edges = [];
|
|
42
|
+
for (const [id, resource] of Object.entries(resources)) {
|
|
43
|
+
if (resource.type === "text") {
|
|
44
|
+
nodes.push({ id, kind: "input", label: resource.label || id, input: { type: "text", value: resource.value } });
|
|
45
|
+
} else if (resource.type === "agent") {
|
|
46
|
+
const agent = resource;
|
|
47
|
+
nodes.push({
|
|
48
|
+
id,
|
|
49
|
+
kind: "agent",
|
|
50
|
+
label: agent.label || agent.identity || id,
|
|
51
|
+
agent: {
|
|
52
|
+
identity: agent.identity || agent.label || id,
|
|
53
|
+
model: agent.model,
|
|
54
|
+
tools: agent.tools,
|
|
55
|
+
instructions: agent.instructions,
|
|
56
|
+
personality: agent.personality,
|
|
57
|
+
context: agent.context
|
|
58
|
+
},
|
|
59
|
+
skills: agent.skills,
|
|
60
|
+
expect: agent.expect
|
|
61
|
+
});
|
|
62
|
+
for (const input of agent.inputs || []) edges.push({ from: input, to: id, kind: "dependency" });
|
|
63
|
+
} else if (resource.type === "tool") {
|
|
64
|
+
const tool = resource;
|
|
65
|
+
nodes.push({ id, kind: "tool", label: tool.label || id, agent: { instructions: tool.instructions } });
|
|
66
|
+
for (const input of tool.inputs || []) edges.push({ from: input, to: id, kind: "dependency" });
|
|
67
|
+
} else {
|
|
68
|
+
const input = resource;
|
|
69
|
+
nodes.push({ id, kind: "input", label: input.label || id, input: { type: input.type, value: input.value, uri: input.uri || input.path, mimeType: input.mimeType, data: input.data } });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { nodes, edges };
|
|
73
|
+
};
|
|
74
|
+
var normalizeCircuitryGraph = (graph) => {
|
|
75
|
+
if (!graph.resources) return { ...graph };
|
|
76
|
+
return { ...graph, ...expandResources(graph.resources) };
|
|
77
|
+
};
|
|
78
|
+
var validateCircuitryGraphInternal = (graph, standard = {}, source) => {
|
|
79
|
+
const resolved = createCircuitryValidationStandard(standard, graph && typeof graph === "object" && !Array.isArray(graph) ? graph : void 0);
|
|
80
|
+
const errors = [];
|
|
81
|
+
const issue = (code, message = code, path2) => errors.push({ code, message, ...path2 ? { path: path2 } : {} });
|
|
82
|
+
if (!graph || typeof graph !== "object" || Array.isArray(graph)) return { ok: false, errors: [{ code: "invalid_graph", message: "invalid graph" }], standard: resolved };
|
|
83
|
+
const g = graph;
|
|
84
|
+
if (resolved.requireSpecVersion && g.circuitry !== resolved.version) issue("invalid_version", "invalid version", ["circuitry"]);
|
|
85
|
+
if (source) {
|
|
86
|
+
const raw = g;
|
|
87
|
+
if (!g.resources || Object.keys(g.resources).length === 0) issue("missing_resources", "missing resources", ["resources"]);
|
|
88
|
+
if (raw.agents) issue("forbidden_agents", "forbidden agents", ["agents"]);
|
|
89
|
+
if (raw.inputs) issue("forbidden_inputs", "forbidden inputs", ["inputs"]);
|
|
90
|
+
if (g.nodes?.length) issue("forbidden_nodes", "forbidden nodes", ["nodes"]);
|
|
91
|
+
if (g.edges?.length) issue("forbidden_edges", "forbidden edges", ["edges"]);
|
|
92
|
+
if (raw.links) issue("forbidden_links", "forbidden links", ["links"]);
|
|
93
|
+
}
|
|
94
|
+
const rules = new Set(resolved.rules.map(ruleName));
|
|
95
|
+
const normalized = normalizeCircuitryGraph(g);
|
|
96
|
+
const ids = /* @__PURE__ */ new Set();
|
|
97
|
+
for (const [index, node] of (normalized.nodes || []).entries()) {
|
|
98
|
+
if (!node.id) {
|
|
99
|
+
issue("missing_node_id", "missing node id", ["nodes", index, "id"]);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (ids.has(node.id)) issue("duplicate_node_id", "duplicate node id", ["nodes", index, "id"]);
|
|
103
|
+
ids.add(node.id);
|
|
104
|
+
if (!node.kind) issue("missing_node_kind", "missing node kind", ["nodes", index, "kind"]);
|
|
105
|
+
}
|
|
106
|
+
const adjacency = /* @__PURE__ */ new Map();
|
|
107
|
+
const incoming = /* @__PURE__ */ new Map();
|
|
108
|
+
for (const id of ids) {
|
|
109
|
+
adjacency.set(id, []);
|
|
110
|
+
incoming.set(id, 0);
|
|
111
|
+
}
|
|
112
|
+
for (const [index, edge] of (normalized.edges || []).entries()) {
|
|
113
|
+
if (!edge.from || !edge.to) {
|
|
114
|
+
issue("missing_edge_endpoint", "missing edge endpoint", ["edges", index]);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (rules.has("no-self-loops") && edge.from === edge.to) {
|
|
118
|
+
issue("self_loop", "self loop", ["edges", index]);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const ok = ids.has(edge.from) && ids.has(edge.to);
|
|
122
|
+
if (rules.has("no-unknown-edge-endpoints")) {
|
|
123
|
+
if (!ids.has(edge.from)) issue("unknown_edge_source", "unknown edge source", ["edges", index, "from"]);
|
|
124
|
+
if (!ids.has(edge.to)) issue("unknown_edge_target", "unknown edge target", ["edges", index, "to"]);
|
|
125
|
+
}
|
|
126
|
+
if (ok) {
|
|
127
|
+
adjacency.get(edge.from).push(edge.to);
|
|
128
|
+
incoming.set(edge.to, (incoming.get(edge.to) || 0) + 1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (rules.has("require-executable-inputs")) {
|
|
132
|
+
const executable = new Set(resolved.executableKinds);
|
|
133
|
+
for (const [index, node] of (normalized.nodes || []).entries()) {
|
|
134
|
+
if (executable.has(node.kind) && (incoming.get(node.id) || 0) === 0) issue("missing_executable_input", "missing executable input", ["nodes", index]);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (rules.has("no-cycles")) {
|
|
138
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
139
|
+
const visited = /* @__PURE__ */ new Set();
|
|
140
|
+
const visit = (id) => {
|
|
141
|
+
if (visiting.has(id)) return true;
|
|
142
|
+
if (visited.has(id)) return false;
|
|
143
|
+
visiting.add(id);
|
|
144
|
+
for (const next of adjacency.get(id) || []) if (visit(next)) return true;
|
|
145
|
+
visiting.delete(id);
|
|
146
|
+
visited.add(id);
|
|
147
|
+
return false;
|
|
148
|
+
};
|
|
149
|
+
for (const id of ids) if (visit(id)) {
|
|
150
|
+
issue("cycle", "cycle");
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return { ok: errors.length === 0, errors, standard: resolved };
|
|
155
|
+
};
|
|
156
|
+
var validateCircuitryGraphWithStandard = (graph, standard = {}) => validateCircuitryGraphInternal(graph, standard, true);
|
|
157
|
+
var validateCircuitryExecutionGraphWithStandard = (graph, standard = {}) => validateCircuitryGraphInternal(graph, standard, false);
|
|
158
|
+
var validateCircuitryGraph = (graph, standard = {}) => validateCircuitryGraphWithStandard(graph, standard).errors.map((error) => error.message);
|
|
159
|
+
|
|
160
|
+
// src/yaml.ts
|
|
161
|
+
var parseYamlData = (text) => {
|
|
162
|
+
try {
|
|
163
|
+
return YAML2.parse(text);
|
|
164
|
+
} catch (error) {
|
|
165
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
166
|
+
throw new Error(`Could not parse YAML.
|
|
167
|
+
${message}`);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
var stringifyYamlData = (value) => YAML2.stringify(value);
|
|
171
|
+
var parseCircuitryYaml = (text, standard = {}, options = {}) => {
|
|
172
|
+
const graph = parseYamlData(text);
|
|
173
|
+
if (!graph || typeof graph !== "object" || Array.isArray(graph)) {
|
|
174
|
+
throw new Error("Circuitry YAML must be a graph object.");
|
|
175
|
+
}
|
|
176
|
+
if (options.validate !== false) {
|
|
177
|
+
const errors = validateCircuitryGraph(graph, standard);
|
|
178
|
+
if (errors.length) throw new Error(`Invalid Circuitry graph:
|
|
179
|
+
${errors.join("\n")}`);
|
|
180
|
+
}
|
|
181
|
+
return graph;
|
|
182
|
+
};
|
|
183
|
+
var parseCircuitryText = (text, standard = {}, options = {}) => parseCircuitryYaml(text, standard, options);
|
|
184
|
+
|
|
185
|
+
// src/scheduler.ts
|
|
186
|
+
import YAML3 from "yaml";
|
|
187
|
+
|
|
188
|
+
// src/node.ts
|
|
189
|
+
var defaultFilename = "graph.circuitry.yaml";
|
|
190
|
+
var resourceInputs = (resource) => "inputs" in resource && Array.isArray(resource.inputs) ? resource.inputs : [];
|
|
191
|
+
var withResourceInputs = (resource, inputs) => "inputs" in resource ? { ...resource, inputs } : resource;
|
|
192
|
+
var selectedImportResources = (imp, resources) => {
|
|
193
|
+
if (imp.resources === "*") return Object.fromEntries(Object.keys(resources).map((id) => [id, id]));
|
|
194
|
+
if (Array.isArray(imp.resources)) return Object.fromEntries(imp.resources.map((id) => [id, id]));
|
|
195
|
+
return imp.resources;
|
|
196
|
+
};
|
|
197
|
+
var importedId = (localId, prefix) => `${prefix || ""}${localId}`;
|
|
198
|
+
var rewriteResourceInputs = (resource, aliasMap) => {
|
|
199
|
+
const inputs = resourceInputs(resource);
|
|
200
|
+
if (inputs.length === 0) return resource;
|
|
201
|
+
return withResourceInputs(resource, inputs.map((input) => aliasMap[input] || input));
|
|
202
|
+
};
|
|
203
|
+
var resolveCircuitryGraph = async (parsed, graphFile, text, standard, stack = []) => {
|
|
204
|
+
if (stack.includes(graphFile)) {
|
|
205
|
+
throw new Error(`Circuitry graph import cycle: ${[...stack, graphFile].join(" -> ")}`);
|
|
206
|
+
}
|
|
207
|
+
const nextStack = [...stack, graphFile];
|
|
208
|
+
const resources = {};
|
|
209
|
+
const origins = {};
|
|
210
|
+
for (const imp of parsed.imports || []) {
|
|
211
|
+
const linkedFile = path.resolve(path.dirname(graphFile), imp.path);
|
|
212
|
+
const loaded = await loadCircuitryGraphFile(linkedFile, standard, nextStack);
|
|
213
|
+
const available = loaded.graph.resources || {};
|
|
214
|
+
const aliases = selectedImportResources(imp, available);
|
|
215
|
+
const aliasMap = {};
|
|
216
|
+
for (const [sourceId, localId] of Object.entries(aliases)) aliasMap[sourceId] = importedId(localId, imp.prefix);
|
|
217
|
+
for (const [sourceId, localId] of Object.entries(aliases)) {
|
|
218
|
+
const resource = available[sourceId];
|
|
219
|
+
if (!resource) throw new Error(`Imported resource not found: ${sourceId} in ${imp.path}`);
|
|
220
|
+
const nextId = importedId(localId, imp.prefix);
|
|
221
|
+
if (resources[nextId]) throw new Error(`Imported Circuitry resource id collision: ${nextId} from ${imp.path}`);
|
|
222
|
+
resources[nextId] = rewriteResourceInputs(resource, aliasMap);
|
|
223
|
+
origins[nextId] = loaded.origins[sourceId] || linkedFile;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
for (const [id, resource] of Object.entries(parsed.resources || {})) {
|
|
227
|
+
if (resources[id]) throw new Error(`Circuitry resource id collision: ${id} in ${graphFile}`);
|
|
228
|
+
resources[id] = resource;
|
|
229
|
+
origins[id] = graphFile;
|
|
230
|
+
}
|
|
231
|
+
const graph = normalizeCircuitryGraph({ ...parsed, imports: [], resources });
|
|
232
|
+
if (stack.length === 0) {
|
|
233
|
+
const validation = validateCircuitryExecutionGraphWithStandard(graph, standard);
|
|
234
|
+
if (validation.errors.length) {
|
|
235
|
+
throw new Error(`Invalid Circuitry graph:
|
|
236
|
+
${validation.errors.map((e) => e.message).join("\n")}`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return { filename: graphFile, text, graph, origins };
|
|
240
|
+
};
|
|
241
|
+
var loadCircuitryGraphFile = async (filename2 = defaultFilename, standard, stack = []) => {
|
|
242
|
+
const graphFile = path.resolve(process.cwd(), filename2);
|
|
243
|
+
const text = await readFile(graphFile, "utf8");
|
|
244
|
+
const parsed = parseCircuitryText(text, standard, { validate: false });
|
|
245
|
+
return resolveCircuitryGraph(parsed, graphFile, text, standard, stack);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// src/cli.ts
|
|
249
|
+
var [, , command, filename] = process.argv;
|
|
250
|
+
var usage = () => {
|
|
251
|
+
console.error("usage: circuitry <check|normalize|parse> <file.yaml>");
|
|
252
|
+
process.exit(2);
|
|
253
|
+
};
|
|
254
|
+
if (!command || !filename) usage();
|
|
255
|
+
try {
|
|
256
|
+
if (command === "parse") {
|
|
257
|
+
const text = await readFile2(filename, "utf8");
|
|
258
|
+
process.stdout.write(stringifyYamlData(parseYamlData(text)));
|
|
259
|
+
} else {
|
|
260
|
+
const loaded = await loadCircuitryGraphFile(filename);
|
|
261
|
+
if (command === "check") {
|
|
262
|
+
const result = validateCircuitryExecutionGraphWithStandard(loaded.graph);
|
|
263
|
+
if (!result.ok) {
|
|
264
|
+
console.error(result.errors.map((error) => error.message).join("\n"));
|
|
265
|
+
process.exit(1);
|
|
266
|
+
}
|
|
267
|
+
console.log(`ok: ${loaded.filename}`);
|
|
268
|
+
} else if (command === "normalize") {
|
|
269
|
+
process.stdout.write(stringifyYamlData({ circuitryBundle: CIRCUITRY_SPEC_VERSION, graph: loaded.graph, origins: loaded.origins }));
|
|
270
|
+
} else {
|
|
271
|
+
usage();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} catch (error) {
|
|
275
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
276
|
+
process.exit(1);
|
|
277
|
+
}
|
package/dist/graph.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
export declare const CIRCUITRY_SPEC_VERSION: "0.3.
|
|
2
|
-
export type CircuitrySpecVersion = typeof CIRCUITRY_SPEC_VERSION
|
|
1
|
+
export declare const CIRCUITRY_SPEC_VERSION: "0.3.2";
|
|
2
|
+
export type CircuitrySpecVersion = typeof CIRCUITRY_SPEC_VERSION;
|
|
3
3
|
export type CircuitryNodeKind = "agent" | "input" | "tool" | "output" | string;
|
|
4
|
-
export type CircuitryEdgeKind = "
|
|
4
|
+
export type CircuitryEdgeKind = "dependency" | "context" | "message" | "control" | string;
|
|
5
5
|
export type CircuitryInputKind = "text" | "file" | "url" | "image" | "uri" | "canvas" | "mcp" | string;
|
|
6
6
|
export type CircuitryAgent = {
|
|
7
7
|
uses?: string;
|
|
8
8
|
model?: string;
|
|
9
9
|
tools?: string[];
|
|
10
|
-
thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
11
10
|
identity?: string;
|
|
12
11
|
personality?: string;
|
|
13
12
|
instructions?: string;
|
|
@@ -51,9 +50,7 @@ export type CircuitryEdge = {
|
|
|
51
50
|
export type CircuitryExpectFieldType = "str" | "int" | "float" | "bool" | "list" | "dict" | (string & {});
|
|
52
51
|
export type CircuitryExpectField = {
|
|
53
52
|
type: CircuitryExpectFieldType;
|
|
54
|
-
/** Optional substring that must appear in the string value. */
|
|
55
53
|
contains?: string;
|
|
56
|
-
/** For list fields: shape of each item. */
|
|
57
54
|
items?: CircuitryExpectSchema | CircuitryExpectFieldType;
|
|
58
55
|
optional?: boolean;
|
|
59
56
|
};
|
|
@@ -70,14 +67,9 @@ export type CircuitryResourceAgent = {
|
|
|
70
67
|
identity?: string;
|
|
71
68
|
label?: string;
|
|
72
69
|
model?: string;
|
|
73
|
-
thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
74
|
-
/** References to other resource ids that feed this agent. */
|
|
75
70
|
inputs?: string[];
|
|
76
|
-
/** Per-resource tool whitelist. */
|
|
77
71
|
tools?: string[];
|
|
78
|
-
/** Per-resource skill whitelist. */
|
|
79
72
|
skills?: string[];
|
|
80
|
-
/** Expected output schema — stored as metadata, used for optional validation. */
|
|
81
73
|
expect?: CircuitryExpectSchema;
|
|
82
74
|
instructions?: string;
|
|
83
75
|
personality?: string;
|
|
@@ -89,7 +81,16 @@ export type CircuitryResourceTool = {
|
|
|
89
81
|
inputs?: string[];
|
|
90
82
|
instructions?: string;
|
|
91
83
|
};
|
|
92
|
-
export type
|
|
84
|
+
export type CircuitryResourceData = {
|
|
85
|
+
type: CircuitryInputKind;
|
|
86
|
+
value?: string;
|
|
87
|
+
uri?: string;
|
|
88
|
+
path?: string;
|
|
89
|
+
mimeType?: string;
|
|
90
|
+
label?: string;
|
|
91
|
+
data?: Record<string, unknown>;
|
|
92
|
+
};
|
|
93
|
+
export type CircuitryResourceEntry = CircuitryResourceText | CircuitryResourceAgent | CircuitryResourceTool | CircuitryResourceData;
|
|
93
94
|
export type CircuitrySandboxProvider = "local" | "docker" | "e2b" | "daytona" | "cloudflare" | "modal" | "openai" | (string & {});
|
|
94
95
|
export type CircuitrySandboxClient = {
|
|
95
96
|
provider: CircuitrySandboxProvider;
|
|
@@ -126,80 +127,47 @@ export type CircuitryRuntime = {
|
|
|
126
127
|
permissions?: Record<string, unknown>;
|
|
127
128
|
};
|
|
128
129
|
export type CircuitryBuiltInValidationRule = "no-self-loops" | "no-unknown-edge-endpoints" | "require-executable-inputs" | "no-cycles";
|
|
129
|
-
export type CircuitryStringValidationMatch = {
|
|
130
|
-
field: string;
|
|
131
|
-
value: string;
|
|
132
|
-
nodeKinds?: string[];
|
|
133
|
-
edgeKinds?: string[];
|
|
134
|
-
};
|
|
135
|
-
export type CircuitryAdditionalValidationRule = {
|
|
136
|
-
rule: "require-graph-field";
|
|
137
|
-
field: string;
|
|
138
|
-
} | {
|
|
139
|
-
rule: "require-node-field";
|
|
140
|
-
field: string;
|
|
141
|
-
nodeKinds?: string[];
|
|
142
|
-
} | {
|
|
143
|
-
rule: "require-edge-field";
|
|
144
|
-
field: string;
|
|
145
|
-
edgeKinds?: string[];
|
|
146
|
-
} | {
|
|
147
|
-
rule: "require-string";
|
|
148
|
-
graph?: CircuitryStringValidationMatch[];
|
|
149
|
-
nodes?: CircuitryStringValidationMatch[];
|
|
150
|
-
edges?: CircuitryStringValidationMatch[];
|
|
151
|
-
} | {
|
|
152
|
-
rule: "reject-string";
|
|
153
|
-
graph?: CircuitryStringValidationMatch[];
|
|
154
|
-
nodes?: CircuitryStringValidationMatch[];
|
|
155
|
-
edges?: CircuitryStringValidationMatch[];
|
|
156
|
-
};
|
|
157
130
|
export type CircuitryValidationRuleEntry = CircuitryBuiltInValidationRule | {
|
|
158
|
-
rule:
|
|
131
|
+
rule: "require-executable-inputs";
|
|
159
132
|
executableKinds?: string[];
|
|
160
|
-
}
|
|
133
|
+
};
|
|
161
134
|
export type CircuitryGraphValidation = {
|
|
162
135
|
rules?: CircuitryValidationRuleEntry[];
|
|
163
136
|
};
|
|
137
|
+
export type CircuitryGraphArg = {
|
|
138
|
+
type: CircuitryInputKind;
|
|
139
|
+
required?: boolean;
|
|
140
|
+
label?: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
default?: unknown;
|
|
143
|
+
mimeType?: string;
|
|
144
|
+
};
|
|
164
145
|
export type CircuitryRuntimeInputs = Record<string, unknown>;
|
|
165
|
-
/**
|
|
166
|
-
* Return a graph copy with runtime input values applied to existing text inputs.
|
|
167
|
-
*
|
|
168
|
-
* Runtime inputs are execution-time args for graph programs: small overlays on
|
|
169
|
-
* declared text inputs. They must target declared input resources; this keeps
|
|
170
|
-
* graph source stable and catches misspelled input names before execution.
|
|
171
|
-
*/
|
|
172
|
-
export declare const applyCircuitryRuntimeInputs: (graph: CircuitryGraph, inputs?: CircuitryRuntimeInputs) => CircuitryGraph;
|
|
173
|
-
/** Import declaration for bringing resources from another graph file. */
|
|
174
146
|
export type CircuitryImport = {
|
|
175
|
-
/** Path to another .circuitry.yaml/.json file, resolved relative to this file. */
|
|
176
147
|
path: string;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
/** Optional local name (alias) for the imported resource. */
|
|
180
|
-
as?: string;
|
|
148
|
+
resources: "*" | string[] | Record<string, string>;
|
|
149
|
+
prefix?: string;
|
|
181
150
|
};
|
|
182
151
|
export type CircuitryGraph = {
|
|
183
|
-
/** Spec version. Use "0.3.0" for import-based graph files. */
|
|
184
152
|
circuitry: CircuitrySpecVersion | string;
|
|
185
153
|
id?: string;
|
|
186
154
|
title?: string;
|
|
187
155
|
description?: string;
|
|
188
|
-
/** Explicit imports of specific resources from other graph files. */
|
|
189
156
|
imports?: CircuitryImport[];
|
|
157
|
+
args?: Record<string, CircuitryGraphArg>;
|
|
190
158
|
resources?: Record<string, CircuitryResourceEntry>;
|
|
191
|
-
/** Internal normalized execution nodes. Authored graph files must not set this. */
|
|
192
159
|
nodes?: CircuitryNode[];
|
|
193
|
-
/** Internal normalized execution edges. Authored graph files must not set this. */
|
|
194
160
|
edges?: CircuitryEdge[];
|
|
195
|
-
/** Forbidden in authored v0.2 graph files. */
|
|
196
161
|
agents?: never;
|
|
197
|
-
/** Forbidden in authored v0.2 graph files. */
|
|
198
|
-
inputs?: never;
|
|
199
162
|
runtime?: CircuitryRuntime;
|
|
200
163
|
validation?: CircuitryGraphValidation;
|
|
201
164
|
metadata?: Record<string, unknown>;
|
|
202
165
|
};
|
|
166
|
+
export type LoadedCircuitryBundle = {
|
|
167
|
+
circuitryBundle: CircuitrySpecVersion;
|
|
168
|
+
graph: CircuitryGraph;
|
|
169
|
+
origins: Record<string, string>;
|
|
170
|
+
};
|
|
203
171
|
export type CircuitryAgentPreset = {
|
|
204
172
|
name: string;
|
|
205
173
|
description?: string;
|
|
@@ -226,18 +194,15 @@ export type CircuitryValidationResult = {
|
|
|
226
194
|
};
|
|
227
195
|
export declare const DEFAULT_CIRCUITRY_VALIDATION_RULES: CircuitryValidationRuleEntry[];
|
|
228
196
|
export declare const DEFAULT_CIRCUITRY_VALIDATION_STANDARD: {
|
|
229
|
-
readonly version: "0.3.
|
|
197
|
+
readonly version: "0.3.2";
|
|
230
198
|
readonly requireSpecVersion: true;
|
|
231
199
|
readonly rules: CircuitryValidationRuleEntry[];
|
|
232
200
|
readonly executableKinds: ["agent", "tool", "output"];
|
|
233
201
|
};
|
|
202
|
+
export declare const applyCircuitryRuntimeInputs: (graph: CircuitryGraph, inputs?: CircuitryRuntimeInputs) => CircuitryGraph;
|
|
234
203
|
export declare const createCircuitryValidationStandard: (standard?: CircuitryValidationStandard, graph?: CircuitryGraph) => Required<CircuitryValidationStandard>;
|
|
235
204
|
export declare const normalizeCircuitryGraph: (graph: CircuitryGraph) => CircuitryGraph;
|
|
236
205
|
export declare const validateCircuitryGraphWithStandard: (graph: unknown, standard?: CircuitryValidationStandard) => CircuitryValidationResult;
|
|
237
206
|
export declare const validateCircuitryExecutionGraphWithStandard: (graph: unknown, standard?: CircuitryValidationStandard) => CircuitryValidationResult;
|
|
238
207
|
export declare const validateCircuitryGraph: (graph: unknown, standard?: CircuitryValidationStandard) => string[];
|
|
239
|
-
export declare const parseCircuitryJson: (text: string, standard?: CircuitryValidationStandard, options?: {
|
|
240
|
-
validate?: boolean;
|
|
241
|
-
}) => CircuitryGraph;
|
|
242
|
-
export declare const stringifyCircuitryJson: (graph: CircuitryGraph) => string;
|
|
243
208
|
export declare const isUriInput: (input: CircuitryInput | Omit<CircuitryInput, "id">) => boolean;
|