@darkhorseprojects/circuitry 0.4.2 → 0.4.4

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/SPEC.md CHANGED
@@ -1,15 +1,14 @@
1
- # Circuitry 0.4
1
+ # Circuitry 0.4 Specification
2
2
 
3
- Circuitry is a resource-native source format for executable graphs.
3
+ Circuitry is a source format for executable resource graphs.
4
4
 
5
- A Circuitry file describes named resources and the dependencies between them. Running a graph means resolving an entry resource. Runtimes decide how to execute supported resource types.
6
-
7
- ## Top-level shape
5
+ ## Shape
8
6
 
9
7
  ```yaml
10
8
  circuitry: "0.4"
11
9
  title: string
12
10
  description: string
11
+
13
12
  imports: []
14
13
  inputs: {}
15
14
  entry: resource_id
@@ -18,9 +17,20 @@ resources: {}
18
17
  outputs: {}
19
18
  ```
20
19
 
21
- ## Resources
20
+ Only `circuitry` and `resources` are required.
21
+
22
+ ## Concepts
22
23
 
23
- Resources are the graph. A resource is identified by its key under `resources`.
24
+ - A **resource** is a named part of the graph.
25
+ - A top-level **input** is a graph invocation input/argument.
26
+ - `resources.*.inputs` are resource dependencies.
27
+ - An **entry** is the default resource a runtime resolves when the graph is run.
28
+ - `resources.*.output` is the resource's output schema/contract.
29
+ - Top-level **outputs** are named graph-level exported outputs.
30
+ - A **tool** is a graph-declared runtime function name. Circuitry does not implement tools.
31
+ - A **prompt** is ordinary text/input. Circuitry has no special prompt primitive.
32
+
33
+ ## Resource fields
24
34
 
25
35
  ```yaml
26
36
  resources:
@@ -28,69 +38,211 @@ resources:
28
38
  type: string
29
39
  label: string
30
40
  description: string
31
- inputs: []
41
+
42
+ inputs: [] | {}
43
+
32
44
  from: string
33
45
  value: any
34
46
  path: string
35
47
  uri: string
36
48
  mime: string
49
+
37
50
  identity: string
38
51
  instructions: string
39
52
  tools: []
53
+
40
54
  graph: string
41
55
  entry: string
42
- expect: {}
56
+
57
+ output: {}
58
+
59
+ x-runtime-name: any
43
60
  ```
44
61
 
45
- `inputs` may be a list of resource ids or a map of local input names to resource ids.
62
+ Unknown resource `type` values are allowed so runtimes can extend behavior.
63
+
64
+ Unknown fields are preserved. Runtime-specific fields should generally use `x-*`. Portable tooling preserves `x-*` fields and does not interpret them.
65
+
66
+ Circuitry stays small by defining stable graph primitives instead of encoding every workflow feature a runtime might provide.
46
67
 
47
68
  ## Inputs
48
69
 
49
- Top-level `inputs` declare runtime inputs. Resolvers may inject matching `type: input` resources when absent.
70
+ Top-level `inputs` declare caller-provided values.
50
71
 
51
72
  ```yaml
52
73
  inputs:
53
- user_turn:
74
+ question:
54
75
  type: text
55
76
  required: true
56
77
  ```
57
78
 
58
- ## Entry points
79
+ An input resource binds a top-level input into the graph.
80
+
81
+ ```yaml
82
+ resources:
83
+ question:
84
+ type: input
85
+ from: question
86
+ ```
87
+
88
+ ## Text and data
89
+
90
+ A value resource may use exactly one of `value`, `path`, or `uri`.
91
+
92
+ - `value`: inline value
93
+ - `path`: file path relative to the graph file
94
+ - `uri`: runtime-resolved URI
95
+
96
+ Circuitry preserves `uri` strings. Runtimes resolve URI schemes.
97
+
98
+ ## Agents
99
+
100
+ `type: agent` is a portable resource type for model-backed execution.
101
+
102
+ ```yaml
103
+ assistant:
104
+ type: agent
105
+ identity: Researcher
106
+ inputs: [system, question]
107
+ tools: [read, search]
108
+ instructions: |
109
+ Answer carefully.
110
+ output:
111
+ answer: str
112
+ ```
113
+
114
+ Circuitry does not call a model. A runtime resolves the agent resource.
115
+
116
+ `output` describes the expected schema of the agent resource's materialized result. It does not define graph exports.
117
+
118
+ ## Runs
119
+
120
+ `type: run` composes graphs.
121
+
122
+ ```yaml
123
+ recovered_context:
124
+ type: run
125
+ graph: ./context.circuitry.yaml
126
+ entry: recover
127
+ inputs:
128
+ question: question
129
+ ```
130
+
131
+ A run resource asks the runtime to resolve another Circuitry graph. `inputs` maps child input names to resources in the current graph.
132
+
133
+ For `type: run`, `output` describes the expected schema of the child graph run result.
134
+
135
+ ## Entries
59
136
 
60
- `entry` is the default resource to resolve. `entries` optionally names multiple run surfaces.
137
+ `entry` is the default resource to run.
61
138
 
62
139
  ```yaml
63
140
  entry: assistant
141
+ ```
142
+
143
+ `entries` optionally gives named entry aliases.
144
+
145
+ ```yaml
64
146
  entries:
147
+ chat: assistant
65
148
  recover: recovered_context
66
149
  ```
67
150
 
68
- ## Run resources
151
+ Runtimes may run a graph from any explicit entry, alias, or resource they support. This lets one graph expose multiple useful executable entrypoints without changing the resource graph.
69
152
 
70
- `type: run` represents declarative graph execution as a resource.
153
+ ## Outputs
154
+
155
+ Top-level `outputs` define named exports from the graph. Each output points to a resource or to a field/path inside a resource's materialized value.
71
156
 
72
157
  ```yaml
73
158
  resources:
74
- recovered_context:
75
- type: run
76
- graph: ./context.circuitry.yaml
77
- entry: recovery
78
- inputs:
79
- user_turn: user_turn
159
+ assistant:
160
+ type: agent
161
+ output:
162
+ answer: str
163
+
164
+ outputs:
165
+ final:
166
+ from: assistant.answer
80
167
  ```
81
168
 
82
- A runtime tool such as `run_graph` is dynamic capability. A `type: run` resource is declarative topology.
169
+ `assistant.output` declares the schema of the assistant resource's materialized value. `outputs.final` exports `assistant.answer` as a named graph output.
83
170
 
84
- ## Outputs
171
+ `outputs` is separate from `output`. `output` is schema-only and never defines graph exports.
172
+
173
+ Output paths are intentionally simple: in `from: assistant.answer`, `assistant` is the resource id before the first dot. The remaining `answer` path selects a field/path within that resource's materialized value. If no dot is present, the whole materialized resource value is referenced.
174
+
175
+ ## Imports
176
+
177
+ Imports copy selected resources from another graph into the current graph.
85
178
 
86
179
  ```yaml
87
- outputs:
88
- response:
89
- from: assistant.response
90
- schema:
91
- response: str
180
+ imports:
181
+ - path: ./shared.circuitry.yaml
182
+ resources: "*"
92
183
  ```
93
184
 
94
- ## Extensions
185
+ ```yaml
186
+ imports:
187
+ - path: ./shared.circuitry.yaml
188
+ resources:
189
+ system: base_system
190
+ ```
191
+
192
+ Import renaming is assignment-style:
193
+
194
+ ```txt
195
+ local_name = imported.imported_name
196
+ system = imported.base_system
197
+ ```
198
+
199
+ This imports `base_system` from the imported graph and binds it locally as `system`. The current graph should reference `system`.
200
+
201
+ Imports do not merge top-level inputs, entries, outputs, or extension fields.
202
+
203
+ ## Resolution
204
+
205
+ Running a graph means resolving its entry resource.
206
+
207
+ Resource resolution semantics:
208
+
209
+ - `input`: returns caller input named by `from`.
210
+ - `text`/`data`: returns `value`, file contents from `path`, or runtime-resolved `uri` contents.
211
+ - `agent`: resolves listed inputs, then asks the runtime to execute an agent resource.
212
+ - `run`: resolves mapped inputs, then asks the runtime to run another Circuitry graph.
213
+ - unknown `type`: runtime-defined.
214
+
215
+ For static resources, `output` describes the resolved/materialized value. For executable resources, `output` describes the produced result.
216
+
217
+ ## Tools
218
+
219
+ Tools are an explicit graph-declared tool surface.
220
+
221
+ ```yaml
222
+ resources:
223
+ assistant:
224
+ type: agent
225
+ tools: [read, write, bash]
226
+ ```
227
+
228
+ A runtime must not expose undeclared tools to that resource. Circuitry only declares tool names. The runtime defines what each tool means and how it executes. Zinc implements tools such as `read`, `write`, `edit`, `bash`, and `run_graph`.
229
+
230
+ Circuitry tooling validates graph shape and resolves imports. It does not execute runtime behavior.
231
+
232
+ ## Validation
233
+
234
+ A valid 0.4 graph:
95
235
 
96
- Fields beginning with `x-` are preserved for runtimes and ecosystems.
236
+ - is an object
237
+ - has `circuitry: "0.4"`
238
+ - has `resources`
239
+ - does not contain `nodes` or `edges`
240
+ - has an existing `entry`, if set
241
+ - has `entries` targets that exist
242
+ - has `type` on every resource
243
+ - has resource inputs pointing to existing resources
244
+ - has no cycles in resource dependencies
245
+ - has `type: input` resources with valid `from`
246
+ - has `type: run` resources with `graph`
247
+ - has outputs with valid `from` roots
248
+ - only uses supported resource fields
package/dist/cli.d.ts CHANGED
@@ -1 +1,2 @@
1
+ #!/usr/bin/env node
1
2
  export {};