@darkhorseprojects/circuitry 0.4.1 → 0.4.3

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 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAsD,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAS3H,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY;IACnD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,QAAgB;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,gBAAgB,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,sBAAsB,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7G,MAAM,UAAU,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAClD,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAA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,CAAC;QACjF,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5D,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC;IAC1D,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,SAA4C,EAAE,EAAU;IAC/E,IAAI,SAAS,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;AACrE,CAAC"}
package/dist/yaml.d.ts CHANGED
@@ -1,11 +1,2 @@
1
- import { type CircuitryGraph, type CircuitryValidationStandard } from "./graph";
2
- export declare const parseYamlData: (text: string) => unknown;
3
- export declare const stringifyYamlData: (value: unknown) => string;
4
- export declare const parseCircuitryYaml: (text: string, standard?: CircuitryValidationStandard, options?: {
5
- validate?: boolean;
6
- }) => CircuitryGraph;
7
- export declare const stringifyCircuitryYaml: (graph: CircuitryGraph) => string;
8
- export declare const parseCircuitryText: (text: string, standard?: CircuitryValidationStandard, options?: {
9
- validate?: boolean;
10
- }) => CircuitryGraph;
11
- export declare const stringifyCircuitryText: (graph: CircuitryGraph) => string;
1
+ export declare function parseYamlData(text: string): unknown;
2
+ export declare function stringifyYamlData(value: unknown): string;
package/dist/yaml.js ADDED
@@ -0,0 +1,8 @@
1
+ import { parse, stringify } from "yaml";
2
+ export function parseYamlData(text) {
3
+ return parse(text);
4
+ }
5
+ export function stringifyYamlData(value) {
6
+ return stringify(value);
7
+ }
8
+ //# sourceMappingURL=yaml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml.js","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAExC,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,24 +1,27 @@
1
1
  circuitry: "0.4"
2
- title: Agent with prompt input
2
+ title: Research assistant
3
3
  inputs:
4
- user_turn:
4
+ question:
5
5
  type: text
6
6
  required: true
7
7
  entry: assistant
8
8
  resources:
9
- user_turn:
9
+ question:
10
10
  type: input
11
- from: user_turn
12
- guide:
11
+ from: question
12
+ system:
13
13
  type: text
14
- value: Be direct, accurate, and natural.
14
+ value: |
15
+ You are a careful research assistant.
15
16
  assistant:
16
17
  type: agent
17
- inputs: [guide, user_turn]
18
- tools: [read, write, bash, run_graph]
19
- instructions: Use the guide and answer the user.
18
+ identity: Researcher
19
+ inputs: [system, question]
20
+ tools: [read, search]
21
+ instructions: |
22
+ Answer with the smallest sufficient explanation.
20
23
  expect:
21
- response: str
24
+ answer: str
22
25
  outputs:
23
- response:
24
- from: assistant.response
26
+ answer:
27
+ from: assistant.answer
@@ -0,0 +1,22 @@
1
+ circuitry: "0.4"
2
+ title: Context recovery
3
+ inputs:
4
+ question:
5
+ type: text
6
+ required: true
7
+ entry: recover
8
+ resources:
9
+ question:
10
+ type: input
11
+ from: question
12
+ recover:
13
+ type: agent
14
+ identity: Context recovery
15
+ inputs: [question]
16
+ instructions: |
17
+ Return only context relevant to the question.
18
+ expect:
19
+ context: str
20
+ outputs:
21
+ context:
22
+ from: recover.context
@@ -1,13 +1,10 @@
1
1
  circuitry: "0.4"
2
- title: Imports and entries
2
+ title: Imports
3
3
  imports:
4
- - path: ./agent.circuitry.yaml
4
+ - path: ./shared.circuitry.yaml
5
5
  resources: "*"
6
- prefix: imported_
7
- entry: imported_assistant
8
- entries:
9
- default: imported_assistant
10
- resources:
11
- local_note:
12
- type: text
13
- value: Local resource.
6
+ entry: system
7
+ resources: {}
8
+ outputs:
9
+ system:
10
+ from: system
@@ -1,20 +1,10 @@
1
1
  circuitry: "0.4"
2
2
  title: Minimal
3
- inputs:
4
- user_turn:
5
- type: text
6
- required: true
7
- entry: assistant
3
+ entry: message
8
4
  resources:
9
- user_turn:
10
- type: input
11
- from: user_turn
12
- assistant:
13
- type: agent
14
- inputs: [user_turn]
15
- instructions: Answer the user.
16
- expect:
17
- response: str
5
+ message:
6
+ type: text
7
+ value: Hello from Circuitry.
18
8
  outputs:
19
- response:
20
- from: assistant.response
9
+ message:
10
+ from: message
@@ -0,0 +1,26 @@
1
+ circuitry: "0.4"
2
+ title: Assistant with graph run
3
+ inputs:
4
+ question:
5
+ type: text
6
+ required: true
7
+ entry: assistant
8
+ resources:
9
+ question:
10
+ type: input
11
+ from: question
12
+ recovered_context:
13
+ type: run
14
+ graph: ./context.circuitry.yaml
15
+ entry: recover
16
+ inputs:
17
+ question: question
18
+ assistant:
19
+ type: agent
20
+ identity: Researcher
21
+ inputs: [question, recovered_context]
22
+ expect:
23
+ answer: str
24
+ outputs:
25
+ answer:
26
+ from: assistant.answer
@@ -0,0 +1,6 @@
1
+ circuitry: "0.4"
2
+ title: Shared resources
3
+ resources:
4
+ system:
5
+ type: text
6
+ value: You are concise and careful.
package/package.json CHANGED
@@ -1,46 +1,43 @@
1
1
  {
2
2
  "name": "@darkhorseprojects/circuitry",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
+ "description": "A tiny file format and CLI for executable resource graphs.",
4
5
  "type": "module",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
6
+ "bin": {
7
+ "circuitry": "./dist/cli.js"
8
+ },
7
9
  "exports": {
8
10
  ".": {
9
11
  "types": "./dist/index.d.ts",
10
12
  "import": "./dist/index.js"
11
- },
12
- "./resolve": {
13
- "types": "./dist/resolve.d.ts",
14
- "import": "./dist/resolve.js"
15
13
  }
16
14
  },
17
- "bin": {
18
- "circuitry": "./dist/cli.js"
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/darkhorseprojects/circuitry"
19
18
  },
20
- "license": "MPL-2.0",
21
19
  "files": [
22
20
  "dist",
21
+ "README.md",
23
22
  "SPEC.md",
24
23
  "schema.json",
25
- "examples",
26
- "LICENSE"
24
+ "examples"
27
25
  ],
28
26
  "scripts": {
29
- "build": "node build.mjs",
30
- "prepublishOnly": "npm run build"
31
- },
32
- "publishConfig": {
33
- "access": "public"
27
+ "build": "tsc -p tsconfig.json",
28
+ "test": "vitest run",
29
+ "check": "tsc -p tsconfig.json --noEmit && vitest run"
34
30
  },
35
- "repository": {
36
- "type": "git",
37
- "url": "git+https://github.com/darkhorseprojects/circuitry.git"
31
+ "dependencies": {
32
+ "yaml": "^2.9.0"
38
33
  },
39
- "dependencies": {},
40
34
  "devDependencies": {
41
- "@types/node": "^20.11.0",
42
- "typescript": "^5.3.3",
43
- "yaml": "^2.8.4",
44
- "zod": "^3.25.76"
45
- }
35
+ "@types/node": "^22.15.30",
36
+ "typescript": "^5.8.3",
37
+ "vitest": "^3.1.4"
38
+ },
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "license": "MPL-2.0"
46
43
  }
package/schema.json CHANGED
@@ -1,31 +1,54 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://darkhorseprojects.github.io/circuitry/schema/0.4/schema.json",
3
+ "$id": "https://darkhorseprojects.github.io/circuitry/schema.json",
4
4
  "title": "Circuitry 0.4",
5
5
  "type": "object",
6
6
  "required": ["circuitry", "resources"],
7
+ "additionalProperties": true,
7
8
  "properties": {
8
9
  "circuitry": { "const": "0.4" },
9
10
  "title": { "type": "string" },
10
11
  "description": { "type": "string" },
11
- "imports": { "type": "array" },
12
- "inputs": { "type": "object" },
12
+ "imports": { "type": "array", "items": { "$ref": "#/$defs/import" } },
13
+ "inputs": { "type": "object", "additionalProperties": { "$ref": "#/$defs/input" } },
13
14
  "entry": { "type": "string" },
14
15
  "entries": { "type": "object", "additionalProperties": { "type": "string" } },
15
- "resources": {
16
+ "resources": { "type": "object", "additionalProperties": { "$ref": "#/$defs/resource" } },
17
+ "outputs": { "type": "object", "additionalProperties": { "$ref": "#/$defs/output" } }
18
+ },
19
+ "$defs": {
20
+ "import": {
16
21
  "type": "object",
17
- "additionalProperties": { "$ref": "#/$defs/resource" }
22
+ "required": ["path"],
23
+ "additionalProperties": false,
24
+ "properties": {
25
+ "path": { "type": "string" },
26
+ "resources": {
27
+ "oneOf": [
28
+ { "const": "*" },
29
+ { "type": "array", "items": { "type": "string" } },
30
+ { "type": "object", "additionalProperties": { "type": "string" } }
31
+ ]
32
+ },
33
+ "prefix": { "type": "string" }
34
+ }
18
35
  },
19
- "outputs": {
36
+ "input": {
20
37
  "type": "object",
21
- "additionalProperties": { "$ref": "#/$defs/output" }
22
- }
23
- },
24
- "additionalProperties": true,
25
- "$defs": {
38
+ "additionalProperties": true,
39
+ "properties": {
40
+ "type": { "type": "string" },
41
+ "required": { "type": "boolean" },
42
+ "default": {},
43
+ "label": { "type": "string" },
44
+ "description": { "type": "string" },
45
+ "mime": { "type": "string" }
46
+ }
47
+ },
26
48
  "resource": {
27
49
  "type": "object",
28
50
  "required": ["type"],
51
+ "additionalProperties": true,
29
52
  "properties": {
30
53
  "type": { "type": "string" },
31
54
  "label": { "type": "string" },
@@ -37,7 +60,7 @@
37
60
  ]
38
61
  },
39
62
  "from": { "type": "string" },
40
- "value": true,
63
+ "value": {},
41
64
  "path": { "type": "string" },
42
65
  "uri": { "type": "string" },
43
66
  "mime": { "type": "string" },
@@ -46,20 +69,19 @@
46
69
  "tools": { "type": "array", "items": { "type": "string" } },
47
70
  "graph": { "type": "string" },
48
71
  "entry": { "type": "string" },
49
- "expect": true
50
- },
51
- "additionalProperties": true
72
+ "expect": {}
73
+ }
52
74
  },
53
75
  "output": {
54
76
  "type": "object",
55
77
  "required": ["from"],
78
+ "additionalProperties": true,
56
79
  "properties": {
57
80
  "from": { "type": "string" },
81
+ "schema": {},
58
82
  "type": { "type": "string" },
59
- "mime": { "type": "string" },
60
- "schema": true
61
- },
62
- "additionalProperties": true
83
+ "mime": { "type": "string" }
84
+ }
63
85
  }
64
86
  }
65
87
  }
@@ -1,24 +0,0 @@
1
- circuitry: "0.4"
2
- title: Run resource
3
- inputs:
4
- user_turn:
5
- type: text
6
- required: true
7
- entry: assistant
8
- resources:
9
- user_turn:
10
- type: input
11
- from: user_turn
12
- recovered_context:
13
- type: run
14
- graph: ./context-recovery.circuitry.yaml
15
- entry: recovery
16
- inputs:
17
- user_turn: user_turn
18
- assistant:
19
- type: agent
20
- inputs: [user_turn, recovered_context]
21
- instructions: Answer with recovered context when useful.
22
- outputs:
23
- response:
24
- from: assistant