@darkhorseprojects/circuitry 0.2.6 → 0.2.7
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/host.d.ts +40 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +310 -10
- package/dist/node.d.ts +48 -0
- package/dist/tools.d.ts +547 -0
- package/package.json +4 -2
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
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -176,7 +176,7 @@ var validateCircuitryGraphWithStandard = (graph, standard = {}) => {
|
|
|
176
176
|
graph && typeof graph === "object" && !Array.isArray(graph) ? graph : void 0
|
|
177
177
|
);
|
|
178
178
|
const errors = [];
|
|
179
|
-
const addError = (code, message,
|
|
179
|
+
const addError = (code, message, path3) => errors.push({ code, message, ...path3 ? { path: path3 } : {} });
|
|
180
180
|
if (!graph || typeof graph !== "object" || Array.isArray(graph)) {
|
|
181
181
|
addError("invalid_graph", "Circuitry graph must be an object");
|
|
182
182
|
return { ok: false, errors, standard: resolvedStandard };
|
|
@@ -253,19 +253,19 @@ var validateCircuitryGraphWithStandard = (graph, standard = {}) => {
|
|
|
253
253
|
}
|
|
254
254
|
const visiting = /* @__PURE__ */ new Set();
|
|
255
255
|
const visited = /* @__PURE__ */ new Set();
|
|
256
|
-
const
|
|
256
|
+
const path2 = [];
|
|
257
257
|
let cycleMessage = "";
|
|
258
258
|
const visit = (id) => {
|
|
259
259
|
if (cycleMessage) return;
|
|
260
260
|
if (visiting.has(id)) {
|
|
261
|
-
cycleMessage = [...
|
|
261
|
+
cycleMessage = [...path2.slice(path2.indexOf(id)), id].join(" -> ");
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
264
|
if (visited.has(id)) return;
|
|
265
265
|
visiting.add(id);
|
|
266
|
-
|
|
266
|
+
path2.push(id);
|
|
267
267
|
for (const next of adjacency.get(id) || []) visit(next);
|
|
268
|
-
|
|
268
|
+
path2.pop();
|
|
269
269
|
visiting.delete(id);
|
|
270
270
|
visited.add(id);
|
|
271
271
|
};
|
|
@@ -315,15 +315,15 @@ var validateCircuitryGraphWithStandard = (graph, standard = {}) => {
|
|
|
315
315
|
}
|
|
316
316
|
continue;
|
|
317
317
|
}
|
|
318
|
-
const checkString = (target, subject, id, match,
|
|
318
|
+
const checkString = (target, subject, id, match, path3) => {
|
|
319
319
|
const value = getField(subject, match.field);
|
|
320
320
|
const text = typeof value === "string" ? value : "";
|
|
321
321
|
const includes = text.includes(match.value);
|
|
322
322
|
if (rule.rule === "require-string" && !includes) {
|
|
323
|
-
addError("missing_required_string", `${target} ${id} field ${match.field} must include string: ${match.value}`,
|
|
323
|
+
addError("missing_required_string", `${target} ${id} field ${match.field} must include string: ${match.value}`, path3);
|
|
324
324
|
}
|
|
325
325
|
if (rule.rule === "reject-string" && includes) {
|
|
326
|
-
addError("rejected_string", `${target} ${id} field ${match.field} must not include string: ${match.value}`,
|
|
326
|
+
addError("rejected_string", `${target} ${id} field ${match.field} must not include string: ${match.value}`, path3);
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
329
|
for (const match of rule.graph || []) checkString("graph", normalized, "<root>", match, fieldPath(match.field));
|
|
@@ -572,7 +572,7 @@ var executeCircuitryNode = async ({
|
|
|
572
572
|
try {
|
|
573
573
|
const result = await executeNode({
|
|
574
574
|
nodeId: item.id,
|
|
575
|
-
model: agent.model || defaultModel || "",
|
|
575
|
+
model: (agent.model === "inherit" ? void 0 : agent.model) || (defaultModel === "inherit" ? void 0 : defaultModel) || "inherit",
|
|
576
576
|
tools: agent.tools || [],
|
|
577
577
|
thinkingLevel: agent.thinkingLevel || "off",
|
|
578
578
|
personality: agent.personality || "",
|
|
@@ -796,7 +796,7 @@ var executeSimulationNode = async ({
|
|
|
796
796
|
try {
|
|
797
797
|
const result = await executeNode({
|
|
798
798
|
nodeId: node.id,
|
|
799
|
-
model: node.data.model,
|
|
799
|
+
model: node.data.model === "inherit" ? "inherit" : node.data.model || "inherit",
|
|
800
800
|
tools: node.data.tools || [],
|
|
801
801
|
thinkingLevel: node.data.thinkingLevel || "off",
|
|
802
802
|
personality: node.data.personality,
|
|
@@ -1025,6 +1025,298 @@ var createUnsupportedRuntimeAdapter = (id) => ({
|
|
|
1025
1025
|
throw new Error(`Circuitry runtime adapter is not configured: ${String(id)}`);
|
|
1026
1026
|
}
|
|
1027
1027
|
});
|
|
1028
|
+
|
|
1029
|
+
// src/tools.ts
|
|
1030
|
+
import { z } from "zod";
|
|
1031
|
+
var standardSchema = z.object({
|
|
1032
|
+
version: z.string().optional(),
|
|
1033
|
+
requireSpecVersion: z.boolean().optional(),
|
|
1034
|
+
executableKinds: z.array(z.string()).optional(),
|
|
1035
|
+
rules: z.array(
|
|
1036
|
+
z.union([z.string(), z.object({ rule: z.string() }).passthrough()])
|
|
1037
|
+
).optional()
|
|
1038
|
+
}).passthrough().optional();
|
|
1039
|
+
var createCircuitryReadGraphTool = (host) => ({
|
|
1040
|
+
name: "circuitry_read_graph",
|
|
1041
|
+
description: "Read the current Circuitry graph. In the App this reads the canvas and includes latest node run outputs.",
|
|
1042
|
+
parameters: z.object({
|
|
1043
|
+
filename: z.string().optional().describe("Optional filename when in standalone mode.")
|
|
1044
|
+
}),
|
|
1045
|
+
execute: (input) => host.readGraph(input)
|
|
1046
|
+
});
|
|
1047
|
+
var createCircuitryWriteGraphTool = (host) => ({
|
|
1048
|
+
name: "circuitry_write_graph",
|
|
1049
|
+
description: "Replace a Circuitry graph. In the App this applies the graph to the canvas; standalone writes a file.",
|
|
1050
|
+
parameters: z.object({
|
|
1051
|
+
text: z.string().optional().describe("YAML graph text."),
|
|
1052
|
+
filename: z.string().optional().describe("Optional filename."),
|
|
1053
|
+
graph: z.any().optional().describe("Parsed graph object."),
|
|
1054
|
+
standard: standardSchema
|
|
1055
|
+
}),
|
|
1056
|
+
execute: (input) => host.writeGraph(input)
|
|
1057
|
+
});
|
|
1058
|
+
var createCircuitryRunGraphTool = (host) => ({
|
|
1059
|
+
name: "circuitry_run_graph",
|
|
1060
|
+
description: "Run the current Circuitry graph. After running, call circuitry_read_graph to inspect updated per-node outputs and errors.",
|
|
1061
|
+
parameters: z.object({
|
|
1062
|
+
source: z.enum(["current", "text"]).optional().describe(
|
|
1063
|
+
"Whether to run the 'current' canvas/file or provided 'text'."
|
|
1064
|
+
),
|
|
1065
|
+
text: z.string().optional().describe("YAML graph text if source is 'text'."),
|
|
1066
|
+
filename: z.string().optional().describe("Optional filename."),
|
|
1067
|
+
selectedNodeId: z.string().optional().describe("Optional specific node to run."),
|
|
1068
|
+
standard: standardSchema,
|
|
1069
|
+
hostModel: z.string().optional().describe("Optional model to use when a node is set to 'inherit'.")
|
|
1070
|
+
}),
|
|
1071
|
+
execute: (input) => host.runGraph(input)
|
|
1072
|
+
});
|
|
1073
|
+
var createCircuitryValidateGraphTool = (host) => ({
|
|
1074
|
+
name: "circuitry_validate_graph",
|
|
1075
|
+
description: "Validate Circuitry YAML or JSON graph text. Returns structured validation issues.",
|
|
1076
|
+
parameters: z.object({
|
|
1077
|
+
text: z.string().describe("YAML or JSON graph text to validate."),
|
|
1078
|
+
filename: z.string().optional().describe("Optional filename context."),
|
|
1079
|
+
standard: standardSchema
|
|
1080
|
+
}),
|
|
1081
|
+
execute: (input) => host.validateGraph(input)
|
|
1082
|
+
});
|
|
1083
|
+
var createCircuitryTools = (host) => [
|
|
1084
|
+
createCircuitryReadGraphTool(host),
|
|
1085
|
+
createCircuitryWriteGraphTool(host),
|
|
1086
|
+
createCircuitryRunGraphTool(host),
|
|
1087
|
+
createCircuitryValidateGraphTool(host)
|
|
1088
|
+
];
|
|
1089
|
+
|
|
1090
|
+
// src/node.ts
|
|
1091
|
+
import { access, readFile, writeFile } from "node:fs/promises";
|
|
1092
|
+
import fs from "node:fs";
|
|
1093
|
+
import path from "node:path";
|
|
1094
|
+
import os from "node:os";
|
|
1095
|
+
var loadPiSDK = async () => {
|
|
1096
|
+
const possiblePaths = [
|
|
1097
|
+
path.join(process.cwd(), "node_modules/@earendil-works/pi-coding-agent/dist/index.js"),
|
|
1098
|
+
path.join(os.homedir(), ".npm-global/lib/node_modules/@earendil-works/pi-coding-agent/dist/index.js")
|
|
1099
|
+
];
|
|
1100
|
+
for (const modulePath of possiblePaths) {
|
|
1101
|
+
if (fs.existsSync(modulePath)) {
|
|
1102
|
+
return await import(modulePath);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
return await import("@earendil-works/pi-coding-agent");
|
|
1106
|
+
};
|
|
1107
|
+
var extractAssistantText = (message) => {
|
|
1108
|
+
if (!message || message.role !== "assistant") return "";
|
|
1109
|
+
if (typeof message.content === "string") return message.content;
|
|
1110
|
+
if (!Array.isArray(message.content)) return "";
|
|
1111
|
+
return message.content.filter((part) => part?.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
|
|
1112
|
+
};
|
|
1113
|
+
var withTimeout = async (promise, timeoutMs) => {
|
|
1114
|
+
let timeout;
|
|
1115
|
+
try {
|
|
1116
|
+
return await Promise.race([
|
|
1117
|
+
promise,
|
|
1118
|
+
new Promise((_, reject) => {
|
|
1119
|
+
timeout = setTimeout(
|
|
1120
|
+
() => reject(new Error(`Pi SDK request timed out after ${timeoutMs}ms`)),
|
|
1121
|
+
timeoutMs
|
|
1122
|
+
);
|
|
1123
|
+
})
|
|
1124
|
+
]);
|
|
1125
|
+
} finally {
|
|
1126
|
+
clearTimeout(timeout);
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
var runNodeWithPiSDK = async ({
|
|
1130
|
+
model,
|
|
1131
|
+
prompt,
|
|
1132
|
+
images = [],
|
|
1133
|
+
tools = [],
|
|
1134
|
+
thinkingLevel = "off"
|
|
1135
|
+
}) => {
|
|
1136
|
+
let sdk;
|
|
1137
|
+
try {
|
|
1138
|
+
sdk = await loadPiSDK();
|
|
1139
|
+
} catch (error) {
|
|
1140
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1141
|
+
throw new Error(
|
|
1142
|
+
[
|
|
1143
|
+
"Circuitry could not load the Pi SDK package for execution.",
|
|
1144
|
+
"Ensure @earendil-works/pi-coding-agent is installed.",
|
|
1145
|
+
message
|
|
1146
|
+
].join("\n")
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
const { AuthStorage, ModelRegistry, SessionManager, createAgentSession } = sdk;
|
|
1150
|
+
const authStorage = AuthStorage.create();
|
|
1151
|
+
const modelRegistry = ModelRegistry.create(authStorage);
|
|
1152
|
+
const [provider, ...modelParts] = String(model || "").split("/");
|
|
1153
|
+
const modelId = modelParts.join("/");
|
|
1154
|
+
const available = await modelRegistry.getAvailable();
|
|
1155
|
+
const selectedModel = (provider && modelId ? modelRegistry.find(provider, modelId) : void 0) || available.find((entry) => {
|
|
1156
|
+
if (!modelId) return false;
|
|
1157
|
+
return `${entry.provider}/${entry.id}` === `${provider}/${modelId}` || entry.id === modelId;
|
|
1158
|
+
}) || available[0];
|
|
1159
|
+
if (!selectedModel) {
|
|
1160
|
+
throw new Error("No Pi SDK models are available. Configure ~/.pi/agent/auth.json");
|
|
1161
|
+
}
|
|
1162
|
+
const { session } = await createAgentSession({
|
|
1163
|
+
model: selectedModel,
|
|
1164
|
+
thinkingLevel,
|
|
1165
|
+
sessionManager: SessionManager.inMemory(),
|
|
1166
|
+
authStorage,
|
|
1167
|
+
modelRegistry
|
|
1168
|
+
});
|
|
1169
|
+
session.setActiveToolsByName(Array.isArray(tools) ? tools.map((tool) => String(tool)) : []);
|
|
1170
|
+
let output = "";
|
|
1171
|
+
const unsubscribe = session.subscribe((event) => {
|
|
1172
|
+
if ((event.type === "message_update" || event.type === "message_end") && event.message?.role === "assistant") {
|
|
1173
|
+
output = extractAssistantText(event.message);
|
|
1174
|
+
}
|
|
1175
|
+
if (event.type === "agent_end" && Array.isArray(event.messages)) {
|
|
1176
|
+
const assistantMessage = [...event.messages].reverse().find((message) => message.role === "assistant");
|
|
1177
|
+
output = extractAssistantText(assistantMessage);
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
try {
|
|
1181
|
+
const promptImages = images.filter((image) => image?.mediaType && image?.data).map((image) => ({
|
|
1182
|
+
type: "image",
|
|
1183
|
+
source: { type: "base64", mediaType: image.mediaType, data: image.data }
|
|
1184
|
+
}));
|
|
1185
|
+
await withTimeout(session.prompt(prompt, { images: promptImages }), 18e4);
|
|
1186
|
+
return { output: output.trim() };
|
|
1187
|
+
} finally {
|
|
1188
|
+
unsubscribe();
|
|
1189
|
+
session.dispose();
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
var defaultFilename = "graph.circuitry.yaml";
|
|
1193
|
+
var NodeCircuitryHost = class {
|
|
1194
|
+
resolveGraphFile(filename) {
|
|
1195
|
+
return path.resolve(
|
|
1196
|
+
process.cwd(),
|
|
1197
|
+
filename || process.env.CIRCUITRY_GRAPH || defaultFilename
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
runFileFor(filename) {
|
|
1201
|
+
return `${filename}.run.json`;
|
|
1202
|
+
}
|
|
1203
|
+
async exists(filename) {
|
|
1204
|
+
try {
|
|
1205
|
+
await access(filename);
|
|
1206
|
+
return true;
|
|
1207
|
+
} catch {
|
|
1208
|
+
return false;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
parseIssue(error, filename) {
|
|
1212
|
+
return {
|
|
1213
|
+
code: "parse_error",
|
|
1214
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1215
|
+
path: [filename]
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
parseGraphForValidation(text, filename, standard) {
|
|
1219
|
+
try {
|
|
1220
|
+
return {
|
|
1221
|
+
graph: parseCircuitryText(text || "", filename, standard, {
|
|
1222
|
+
validate: false
|
|
1223
|
+
})
|
|
1224
|
+
};
|
|
1225
|
+
} catch (error) {
|
|
1226
|
+
return { error: this.parseIssue(error, filename) };
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
async readGraphFile(filename) {
|
|
1230
|
+
const graphFile = this.resolveGraphFile(filename);
|
|
1231
|
+
const text = await readFile(graphFile, "utf8");
|
|
1232
|
+
const graph = parseCircuitryText(text, graphFile);
|
|
1233
|
+
return { graphFile, text, graph };
|
|
1234
|
+
}
|
|
1235
|
+
async readGraph(input = {}) {
|
|
1236
|
+
const { graphFile, text, graph } = await this.readGraphFile(input.filename);
|
|
1237
|
+
const lastRunFile = this.runFileFor(graphFile);
|
|
1238
|
+
const lastRun = await this.exists(lastRunFile) ? JSON.parse(await readFile(lastRunFile, "utf8")) : void 0;
|
|
1239
|
+
return { filename: graphFile, graph, text, lastRun };
|
|
1240
|
+
}
|
|
1241
|
+
async validateGraph(input) {
|
|
1242
|
+
if (input.graph)
|
|
1243
|
+
return validateCircuitryGraphWithStandard(input.graph, input.standard);
|
|
1244
|
+
const filename = input.filename || defaultFilename;
|
|
1245
|
+
const parsed = this.parseGraphForValidation(input.text, filename, input.standard);
|
|
1246
|
+
if (parsed.error) {
|
|
1247
|
+
return {
|
|
1248
|
+
ok: false,
|
|
1249
|
+
errors: [parsed.error],
|
|
1250
|
+
standard: validateCircuitryGraphWithStandard({}, input.standard).standard
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
return validateCircuitryGraphWithStandard(parsed.graph, input.standard);
|
|
1254
|
+
}
|
|
1255
|
+
async writeGraph(input) {
|
|
1256
|
+
const graphFile = this.resolveGraphFile(input.filename);
|
|
1257
|
+
const parsed = input.graph ? { graph: input.graph } : this.parseGraphForValidation(
|
|
1258
|
+
input.text,
|
|
1259
|
+
input.filename || graphFile,
|
|
1260
|
+
input.standard
|
|
1261
|
+
);
|
|
1262
|
+
if (!parsed.graph)
|
|
1263
|
+
throw new Error(`Invalid Circuitry graph:
|
|
1264
|
+
${parsed.error?.message}`);
|
|
1265
|
+
const validation = await this.validateGraph({
|
|
1266
|
+
graph: parsed.graph,
|
|
1267
|
+
standard: input.standard
|
|
1268
|
+
});
|
|
1269
|
+
if (validation.errors.length)
|
|
1270
|
+
throw new Error(
|
|
1271
|
+
`Invalid Circuitry graph:
|
|
1272
|
+
${validation.errors.map((e) => e.message).join("\n")}`
|
|
1273
|
+
);
|
|
1274
|
+
await writeFile(
|
|
1275
|
+
graphFile,
|
|
1276
|
+
stringifyCircuitryText(parsed.graph, graphFile),
|
|
1277
|
+
"utf8"
|
|
1278
|
+
);
|
|
1279
|
+
return {
|
|
1280
|
+
filename: graphFile,
|
|
1281
|
+
graph: parsed.graph,
|
|
1282
|
+
mode: "replace"
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
async runGraph(input = {}) {
|
|
1286
|
+
const source = input.source || (input.text ? "text" : "current");
|
|
1287
|
+
const graphFile = this.resolveGraphFile(input.filename);
|
|
1288
|
+
const parsed = source === "text" ? this.parseGraphForValidation(
|
|
1289
|
+
input.text,
|
|
1290
|
+
input.filename || graphFile,
|
|
1291
|
+
input.standard
|
|
1292
|
+
) : { graph: (await this.readGraphFile(input.filename)).graph };
|
|
1293
|
+
if (!parsed.graph)
|
|
1294
|
+
throw new Error(`Invalid Circuitry graph:
|
|
1295
|
+
${parsed.error?.message}`);
|
|
1296
|
+
const validation = await this.validateGraph({
|
|
1297
|
+
graph: parsed.graph,
|
|
1298
|
+
standard: input.standard
|
|
1299
|
+
});
|
|
1300
|
+
if (validation.errors.length)
|
|
1301
|
+
throw new Error(
|
|
1302
|
+
`Invalid Circuitry graph:
|
|
1303
|
+
${validation.errors.map((e) => e.message).join("\n")}`
|
|
1304
|
+
);
|
|
1305
|
+
const runItems = await runCircuitryGraphExecution({
|
|
1306
|
+
graph: parsed.graph,
|
|
1307
|
+
selectedNodeId: input.selectedNodeId,
|
|
1308
|
+
executeNode: (req) => runNodeWithPiSDK(req)
|
|
1309
|
+
});
|
|
1310
|
+
const result = { completedAt: (/* @__PURE__ */ new Date()).toISOString(), runItems };
|
|
1311
|
+
if (source !== "text")
|
|
1312
|
+
await writeFile(
|
|
1313
|
+
this.runFileFor(graphFile),
|
|
1314
|
+
JSON.stringify(result, null, 2),
|
|
1315
|
+
"utf8"
|
|
1316
|
+
);
|
|
1317
|
+
return result;
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1028
1320
|
export {
|
|
1029
1321
|
BUNDLE_MIME,
|
|
1030
1322
|
CIRCUITRY_AGENT_PRESET_DIRS,
|
|
@@ -1035,11 +1327,17 @@ export {
|
|
|
1035
1327
|
DEFAULT_CIRCUITRY_VALIDATION_RULES,
|
|
1036
1328
|
DEFAULT_CIRCUITRY_VALIDATION_STANDARD,
|
|
1037
1329
|
DEFAULT_MAX_PARALLEL_RUNS,
|
|
1330
|
+
NodeCircuitryHost,
|
|
1038
1331
|
applyAgentPresets,
|
|
1039
1332
|
buildCircuitryExecutionGraph,
|
|
1040
1333
|
buildSimulationGraph,
|
|
1041
1334
|
createBundleFromSelection,
|
|
1335
|
+
createCircuitryReadGraphTool,
|
|
1336
|
+
createCircuitryRunGraphTool,
|
|
1337
|
+
createCircuitryTools,
|
|
1338
|
+
createCircuitryValidateGraphTool,
|
|
1042
1339
|
createCircuitryValidationStandard,
|
|
1340
|
+
createCircuitryWriteGraphTool,
|
|
1043
1341
|
createDefaultNodeData,
|
|
1044
1342
|
createUnsupportedRuntimeAdapter,
|
|
1045
1343
|
hasCircuitryNodeData,
|
|
@@ -1055,6 +1353,8 @@ export {
|
|
|
1055
1353
|
runCircuitryGraphExecution,
|
|
1056
1354
|
runDependencySimulation,
|
|
1057
1355
|
runGraphExecution,
|
|
1356
|
+
runNodeWithPiSDK,
|
|
1357
|
+
standardSchema,
|
|
1058
1358
|
stringifyCircuitryJson,
|
|
1059
1359
|
stringifyCircuitryText,
|
|
1060
1360
|
stringifyCircuitryYaml,
|
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
|
+
}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CircuitryHost } from "./host";
|
|
3
|
+
export declare const standardSchema: z.ZodOptional<z.ZodObject<{
|
|
4
|
+
version: z.ZodOptional<z.ZodString>;
|
|
5
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
8
|
+
rule: z.ZodString;
|
|
9
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
10
|
+
rule: z.ZodString;
|
|
11
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
12
|
+
rule: z.ZodString;
|
|
13
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
14
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
15
|
+
version: z.ZodOptional<z.ZodString>;
|
|
16
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
18
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
19
|
+
rule: z.ZodString;
|
|
20
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
21
|
+
rule: z.ZodString;
|
|
22
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
23
|
+
rule: z.ZodString;
|
|
24
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
25
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
26
|
+
version: z.ZodOptional<z.ZodString>;
|
|
27
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
29
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
30
|
+
rule: z.ZodString;
|
|
31
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
32
|
+
rule: z.ZodString;
|
|
33
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
34
|
+
rule: z.ZodString;
|
|
35
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
36
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
37
|
+
export declare const createCircuitryReadGraphTool: (host: CircuitryHost) => {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
parameters: z.ZodObject<{
|
|
41
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
filename?: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
filename?: string | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
execute: (input: {
|
|
48
|
+
filename?: string;
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
filename: string;
|
|
51
|
+
graph: import("./graph").CircuitryGraph;
|
|
52
|
+
text: string;
|
|
53
|
+
lastRun?: any;
|
|
54
|
+
}>;
|
|
55
|
+
};
|
|
56
|
+
export declare const createCircuitryWriteGraphTool: (host: CircuitryHost) => {
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
parameters: z.ZodObject<{
|
|
60
|
+
text: z.ZodOptional<z.ZodString>;
|
|
61
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
62
|
+
graph: z.ZodOptional<z.ZodAny>;
|
|
63
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
version: z.ZodOptional<z.ZodString>;
|
|
65
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
67
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
68
|
+
rule: z.ZodString;
|
|
69
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
70
|
+
rule: z.ZodString;
|
|
71
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
72
|
+
rule: z.ZodString;
|
|
73
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
74
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
75
|
+
version: z.ZodOptional<z.ZodString>;
|
|
76
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
78
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
79
|
+
rule: z.ZodString;
|
|
80
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
81
|
+
rule: z.ZodString;
|
|
82
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
83
|
+
rule: z.ZodString;
|
|
84
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
85
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
86
|
+
version: z.ZodOptional<z.ZodString>;
|
|
87
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
89
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
90
|
+
rule: z.ZodString;
|
|
91
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
92
|
+
rule: z.ZodString;
|
|
93
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
94
|
+
rule: z.ZodString;
|
|
95
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
96
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
text?: string | undefined;
|
|
99
|
+
graph?: any;
|
|
100
|
+
filename?: string | undefined;
|
|
101
|
+
standard?: z.objectOutputType<{
|
|
102
|
+
version: z.ZodOptional<z.ZodString>;
|
|
103
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
105
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
106
|
+
rule: z.ZodString;
|
|
107
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
108
|
+
rule: z.ZodString;
|
|
109
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
110
|
+
rule: z.ZodString;
|
|
111
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
112
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
113
|
+
}, {
|
|
114
|
+
text?: string | undefined;
|
|
115
|
+
graph?: any;
|
|
116
|
+
filename?: string | undefined;
|
|
117
|
+
standard?: z.objectInputType<{
|
|
118
|
+
version: z.ZodOptional<z.ZodString>;
|
|
119
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
121
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
122
|
+
rule: z.ZodString;
|
|
123
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
124
|
+
rule: z.ZodString;
|
|
125
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
126
|
+
rule: z.ZodString;
|
|
127
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
128
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
129
|
+
}>;
|
|
130
|
+
execute: (input: any) => Promise<{
|
|
131
|
+
filename: string;
|
|
132
|
+
graph: import("./graph").CircuitryGraph;
|
|
133
|
+
mode: "replace";
|
|
134
|
+
}>;
|
|
135
|
+
};
|
|
136
|
+
export declare const createCircuitryRunGraphTool: (host: CircuitryHost) => {
|
|
137
|
+
name: string;
|
|
138
|
+
description: string;
|
|
139
|
+
parameters: z.ZodObject<{
|
|
140
|
+
source: z.ZodOptional<z.ZodEnum<["current", "text"]>>;
|
|
141
|
+
text: z.ZodOptional<z.ZodString>;
|
|
142
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
143
|
+
selectedNodeId: z.ZodOptional<z.ZodString>;
|
|
144
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
version: z.ZodOptional<z.ZodString>;
|
|
146
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
148
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
149
|
+
rule: z.ZodString;
|
|
150
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
151
|
+
rule: z.ZodString;
|
|
152
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
153
|
+
rule: z.ZodString;
|
|
154
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
155
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
156
|
+
version: z.ZodOptional<z.ZodString>;
|
|
157
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
158
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
159
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
160
|
+
rule: z.ZodString;
|
|
161
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
162
|
+
rule: z.ZodString;
|
|
163
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
164
|
+
rule: z.ZodString;
|
|
165
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
166
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
167
|
+
version: z.ZodOptional<z.ZodString>;
|
|
168
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
169
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
170
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
171
|
+
rule: z.ZodString;
|
|
172
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
173
|
+
rule: z.ZodString;
|
|
174
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
175
|
+
rule: z.ZodString;
|
|
176
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
177
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
178
|
+
hostModel: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
text?: string | undefined;
|
|
181
|
+
selectedNodeId?: string | undefined;
|
|
182
|
+
filename?: string | undefined;
|
|
183
|
+
standard?: z.objectOutputType<{
|
|
184
|
+
version: z.ZodOptional<z.ZodString>;
|
|
185
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
187
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
188
|
+
rule: z.ZodString;
|
|
189
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
190
|
+
rule: z.ZodString;
|
|
191
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
192
|
+
rule: z.ZodString;
|
|
193
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
194
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
195
|
+
source?: "text" | "current" | undefined;
|
|
196
|
+
hostModel?: string | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
text?: string | undefined;
|
|
199
|
+
selectedNodeId?: string | undefined;
|
|
200
|
+
filename?: string | undefined;
|
|
201
|
+
standard?: z.objectInputType<{
|
|
202
|
+
version: z.ZodOptional<z.ZodString>;
|
|
203
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
204
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
205
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
206
|
+
rule: z.ZodString;
|
|
207
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
208
|
+
rule: z.ZodString;
|
|
209
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
210
|
+
rule: z.ZodString;
|
|
211
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
212
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
213
|
+
source?: "text" | "current" | undefined;
|
|
214
|
+
hostModel?: string | undefined;
|
|
215
|
+
}>;
|
|
216
|
+
execute: (input: any) => Promise<{
|
|
217
|
+
completedAt: string;
|
|
218
|
+
runItems: import("./simulation").SimulationRunItem[];
|
|
219
|
+
}>;
|
|
220
|
+
};
|
|
221
|
+
export declare const createCircuitryValidateGraphTool: (host: CircuitryHost) => {
|
|
222
|
+
name: string;
|
|
223
|
+
description: string;
|
|
224
|
+
parameters: z.ZodObject<{
|
|
225
|
+
text: z.ZodString;
|
|
226
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
227
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
228
|
+
version: z.ZodOptional<z.ZodString>;
|
|
229
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
230
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
231
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
232
|
+
rule: z.ZodString;
|
|
233
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
234
|
+
rule: z.ZodString;
|
|
235
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
236
|
+
rule: z.ZodString;
|
|
237
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
238
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
239
|
+
version: z.ZodOptional<z.ZodString>;
|
|
240
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
241
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
242
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
243
|
+
rule: z.ZodString;
|
|
244
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
245
|
+
rule: z.ZodString;
|
|
246
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
247
|
+
rule: z.ZodString;
|
|
248
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
249
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
250
|
+
version: z.ZodOptional<z.ZodString>;
|
|
251
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
253
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
254
|
+
rule: z.ZodString;
|
|
255
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
256
|
+
rule: z.ZodString;
|
|
257
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
258
|
+
rule: z.ZodString;
|
|
259
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
260
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
text: string;
|
|
263
|
+
filename?: string | undefined;
|
|
264
|
+
standard?: z.objectOutputType<{
|
|
265
|
+
version: z.ZodOptional<z.ZodString>;
|
|
266
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
267
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
268
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
269
|
+
rule: z.ZodString;
|
|
270
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
271
|
+
rule: z.ZodString;
|
|
272
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
273
|
+
rule: z.ZodString;
|
|
274
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
275
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
276
|
+
}, {
|
|
277
|
+
text: string;
|
|
278
|
+
filename?: string | undefined;
|
|
279
|
+
standard?: z.objectInputType<{
|
|
280
|
+
version: z.ZodOptional<z.ZodString>;
|
|
281
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
282
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
283
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
284
|
+
rule: z.ZodString;
|
|
285
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
286
|
+
rule: z.ZodString;
|
|
287
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
288
|
+
rule: z.ZodString;
|
|
289
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
290
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
291
|
+
}>;
|
|
292
|
+
execute: (input: any) => Promise<import("./graph").CircuitryValidationResult>;
|
|
293
|
+
};
|
|
294
|
+
export declare const createCircuitryTools: (host: CircuitryHost) => ({
|
|
295
|
+
name: string;
|
|
296
|
+
description: string;
|
|
297
|
+
parameters: z.ZodObject<{
|
|
298
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
299
|
+
}, "strip", z.ZodTypeAny, {
|
|
300
|
+
filename?: string | undefined;
|
|
301
|
+
}, {
|
|
302
|
+
filename?: string | undefined;
|
|
303
|
+
}>;
|
|
304
|
+
execute: (input: {
|
|
305
|
+
filename?: string;
|
|
306
|
+
}) => Promise<{
|
|
307
|
+
filename: string;
|
|
308
|
+
graph: import("./graph").CircuitryGraph;
|
|
309
|
+
text: string;
|
|
310
|
+
lastRun?: any;
|
|
311
|
+
}>;
|
|
312
|
+
} | {
|
|
313
|
+
name: string;
|
|
314
|
+
description: string;
|
|
315
|
+
parameters: z.ZodObject<{
|
|
316
|
+
text: z.ZodOptional<z.ZodString>;
|
|
317
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
318
|
+
graph: z.ZodOptional<z.ZodAny>;
|
|
319
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
320
|
+
version: z.ZodOptional<z.ZodString>;
|
|
321
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
322
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
323
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
324
|
+
rule: z.ZodString;
|
|
325
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
326
|
+
rule: z.ZodString;
|
|
327
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
328
|
+
rule: z.ZodString;
|
|
329
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
330
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
331
|
+
version: z.ZodOptional<z.ZodString>;
|
|
332
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
333
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
334
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
335
|
+
rule: z.ZodString;
|
|
336
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
337
|
+
rule: z.ZodString;
|
|
338
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
339
|
+
rule: z.ZodString;
|
|
340
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
341
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
342
|
+
version: z.ZodOptional<z.ZodString>;
|
|
343
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
344
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
345
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
346
|
+
rule: z.ZodString;
|
|
347
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
348
|
+
rule: z.ZodString;
|
|
349
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
350
|
+
rule: z.ZodString;
|
|
351
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
352
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
353
|
+
}, "strip", z.ZodTypeAny, {
|
|
354
|
+
text?: string | undefined;
|
|
355
|
+
graph?: any;
|
|
356
|
+
filename?: string | undefined;
|
|
357
|
+
standard?: z.objectOutputType<{
|
|
358
|
+
version: z.ZodOptional<z.ZodString>;
|
|
359
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
360
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
361
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
362
|
+
rule: z.ZodString;
|
|
363
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
364
|
+
rule: z.ZodString;
|
|
365
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
366
|
+
rule: z.ZodString;
|
|
367
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
368
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
text?: string | undefined;
|
|
371
|
+
graph?: any;
|
|
372
|
+
filename?: string | undefined;
|
|
373
|
+
standard?: z.objectInputType<{
|
|
374
|
+
version: z.ZodOptional<z.ZodString>;
|
|
375
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
376
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
377
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
378
|
+
rule: z.ZodString;
|
|
379
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
380
|
+
rule: z.ZodString;
|
|
381
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
382
|
+
rule: z.ZodString;
|
|
383
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
384
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
385
|
+
}>;
|
|
386
|
+
execute: (input: any) => Promise<{
|
|
387
|
+
filename: string;
|
|
388
|
+
graph: import("./graph").CircuitryGraph;
|
|
389
|
+
mode: "replace";
|
|
390
|
+
}>;
|
|
391
|
+
} | {
|
|
392
|
+
name: string;
|
|
393
|
+
description: string;
|
|
394
|
+
parameters: z.ZodObject<{
|
|
395
|
+
source: z.ZodOptional<z.ZodEnum<["current", "text"]>>;
|
|
396
|
+
text: z.ZodOptional<z.ZodString>;
|
|
397
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
398
|
+
selectedNodeId: z.ZodOptional<z.ZodString>;
|
|
399
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
400
|
+
version: z.ZodOptional<z.ZodString>;
|
|
401
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
402
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
403
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
404
|
+
rule: z.ZodString;
|
|
405
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
406
|
+
rule: z.ZodString;
|
|
407
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
408
|
+
rule: z.ZodString;
|
|
409
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
410
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
411
|
+
version: z.ZodOptional<z.ZodString>;
|
|
412
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
413
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
414
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
415
|
+
rule: z.ZodString;
|
|
416
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
417
|
+
rule: z.ZodString;
|
|
418
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
419
|
+
rule: z.ZodString;
|
|
420
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
421
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
422
|
+
version: z.ZodOptional<z.ZodString>;
|
|
423
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
424
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
425
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
426
|
+
rule: z.ZodString;
|
|
427
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
428
|
+
rule: z.ZodString;
|
|
429
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
430
|
+
rule: z.ZodString;
|
|
431
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
432
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
433
|
+
hostModel: z.ZodOptional<z.ZodString>;
|
|
434
|
+
}, "strip", z.ZodTypeAny, {
|
|
435
|
+
text?: string | undefined;
|
|
436
|
+
selectedNodeId?: string | undefined;
|
|
437
|
+
filename?: string | undefined;
|
|
438
|
+
standard?: z.objectOutputType<{
|
|
439
|
+
version: z.ZodOptional<z.ZodString>;
|
|
440
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
441
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
442
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
443
|
+
rule: z.ZodString;
|
|
444
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
445
|
+
rule: z.ZodString;
|
|
446
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
447
|
+
rule: z.ZodString;
|
|
448
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
449
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
450
|
+
source?: "text" | "current" | undefined;
|
|
451
|
+
hostModel?: string | undefined;
|
|
452
|
+
}, {
|
|
453
|
+
text?: string | undefined;
|
|
454
|
+
selectedNodeId?: string | undefined;
|
|
455
|
+
filename?: string | undefined;
|
|
456
|
+
standard?: z.objectInputType<{
|
|
457
|
+
version: z.ZodOptional<z.ZodString>;
|
|
458
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
459
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
460
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
461
|
+
rule: z.ZodString;
|
|
462
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
463
|
+
rule: z.ZodString;
|
|
464
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
465
|
+
rule: z.ZodString;
|
|
466
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
467
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
468
|
+
source?: "text" | "current" | undefined;
|
|
469
|
+
hostModel?: string | undefined;
|
|
470
|
+
}>;
|
|
471
|
+
execute: (input: any) => Promise<{
|
|
472
|
+
completedAt: string;
|
|
473
|
+
runItems: import("./simulation").SimulationRunItem[];
|
|
474
|
+
}>;
|
|
475
|
+
} | {
|
|
476
|
+
name: string;
|
|
477
|
+
description: string;
|
|
478
|
+
parameters: z.ZodObject<{
|
|
479
|
+
text: z.ZodString;
|
|
480
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
481
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
482
|
+
version: z.ZodOptional<z.ZodString>;
|
|
483
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
484
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
485
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
486
|
+
rule: z.ZodString;
|
|
487
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
488
|
+
rule: z.ZodString;
|
|
489
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
490
|
+
rule: z.ZodString;
|
|
491
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
492
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
493
|
+
version: z.ZodOptional<z.ZodString>;
|
|
494
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
495
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
496
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
497
|
+
rule: z.ZodString;
|
|
498
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
499
|
+
rule: z.ZodString;
|
|
500
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
501
|
+
rule: z.ZodString;
|
|
502
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
503
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
504
|
+
version: z.ZodOptional<z.ZodString>;
|
|
505
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
506
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
507
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
508
|
+
rule: z.ZodString;
|
|
509
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
510
|
+
rule: z.ZodString;
|
|
511
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
512
|
+
rule: z.ZodString;
|
|
513
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
514
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
515
|
+
}, "strip", z.ZodTypeAny, {
|
|
516
|
+
text: string;
|
|
517
|
+
filename?: string | undefined;
|
|
518
|
+
standard?: z.objectOutputType<{
|
|
519
|
+
version: z.ZodOptional<z.ZodString>;
|
|
520
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
521
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
522
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
523
|
+
rule: z.ZodString;
|
|
524
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
525
|
+
rule: z.ZodString;
|
|
526
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
527
|
+
rule: z.ZodString;
|
|
528
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
529
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
530
|
+
}, {
|
|
531
|
+
text: string;
|
|
532
|
+
filename?: string | undefined;
|
|
533
|
+
standard?: z.objectInputType<{
|
|
534
|
+
version: z.ZodOptional<z.ZodString>;
|
|
535
|
+
requireSpecVersion: z.ZodOptional<z.ZodBoolean>;
|
|
536
|
+
executableKinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
537
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
538
|
+
rule: z.ZodString;
|
|
539
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
540
|
+
rule: z.ZodString;
|
|
541
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
542
|
+
rule: z.ZodString;
|
|
543
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
544
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
545
|
+
}>;
|
|
546
|
+
execute: (input: any) => Promise<import("./graph").CircuitryValidationResult>;
|
|
547
|
+
})[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkhorseprojects/circuitry",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"url": "git+https://github.com/darkhorseprojects/circuitry.git"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"yaml": "^2.8.4"
|
|
24
|
+
"yaml": "^2.8.4",
|
|
25
|
+
"zod": "^3.25.76",
|
|
26
|
+
"@earendil-works/pi-coding-agent": "latest"
|
|
25
27
|
}
|
|
26
28
|
}
|