@darkhorseprojects/circuitry 0.4.2 → 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.
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,18 @@ resources: {}
18
17
  outputs: {}
19
18
  ```
20
19
 
21
- ## Resources
20
+ Only `circuitry` and `resources` are required.
21
+
22
+ ## Concepts
23
+
24
+ - A **resource** is a named part of the graph.
25
+ - An **input** is a caller-supplied value.
26
+ - An **entry** is the resource a runtime resolves when the graph is run.
27
+ - An **output** maps a public graph result to a resource path.
28
+ - A **tool** is a runtime function name. Circuitry does not implement tools.
29
+ - A **prompt** is ordinary text/input. Circuitry has no special prompt primitive.
22
30
 
23
- Resources are the graph. A resource is identified by its key under `resources`.
31
+ ## Resource fields
24
32
 
25
33
  ```yaml
26
34
  resources:
@@ -28,69 +36,168 @@ resources:
28
36
  type: string
29
37
  label: string
30
38
  description: string
31
- inputs: []
39
+
40
+ inputs: [] | {}
41
+
32
42
  from: string
33
43
  value: any
34
44
  path: string
35
45
  uri: string
36
46
  mime: string
47
+
37
48
  identity: string
38
49
  instructions: string
39
50
  tools: []
51
+
40
52
  graph: string
41
53
  entry: string
54
+
42
55
  expect: {}
56
+
57
+ x-runtime-name: any
43
58
  ```
44
59
 
45
- `inputs` may be a list of resource ids or a map of local input names to resource ids.
60
+ Unknown resource `type` values are allowed. Runtimes decide what they support.
61
+
62
+ `x-*` fields are extensions. Portable tooling preserves them and does not interpret them.
46
63
 
47
64
  ## Inputs
48
65
 
49
- Top-level `inputs` declare runtime inputs. Resolvers may inject matching `type: input` resources when absent.
66
+ Top-level `inputs` declare caller-provided values.
50
67
 
51
68
  ```yaml
52
69
  inputs:
53
- user_turn:
70
+ question:
54
71
  type: text
55
72
  required: true
56
73
  ```
57
74
 
58
- ## Entry points
75
+ An input resource binds a top-level input into the graph.
76
+
77
+ ```yaml
78
+ resources:
79
+ question:
80
+ type: input
81
+ from: question
82
+ ```
83
+
84
+ ## Text and data
85
+
86
+ A value resource may use exactly one of `value`, `path`, or `uri`.
87
+
88
+ - `value`: inline value
89
+ - `path`: file path relative to the graph file
90
+ - `uri`: runtime-resolved URI
91
+
92
+ Circuitry preserves `uri` strings. Runtimes resolve URI schemes.
93
+
94
+ ## Agents
95
+
96
+ `type: agent` is a portable resource type for model-backed execution.
97
+
98
+ ```yaml
99
+ assistant:
100
+ type: agent
101
+ identity: Researcher
102
+ inputs: [system, question]
103
+ tools: [read, search]
104
+ instructions: |
105
+ Answer carefully.
106
+ expect:
107
+ answer: str
108
+ ```
109
+
110
+ Circuitry does not call a model. A runtime resolves the agent resource.
111
+
112
+ ## Runs
113
+
114
+ `type: run` composes graphs.
115
+
116
+ ```yaml
117
+ recovered_context:
118
+ type: run
119
+ graph: ./context.circuitry.yaml
120
+ entry: recover
121
+ inputs:
122
+ question: question
123
+ ```
124
+
125
+ A run resource asks the runtime to resolve another Circuitry graph. `inputs` maps child input names to resources in the current graph.
126
+
127
+ ## Entries
59
128
 
60
- `entry` is the default resource to resolve. `entries` optionally names multiple run surfaces.
129
+ `entry` is the default resource to resolve.
61
130
 
62
131
  ```yaml
63
132
  entry: assistant
133
+ ```
134
+
135
+ `entries` optionally gives named entry aliases.
136
+
137
+ ```yaml
64
138
  entries:
139
+ chat: assistant
65
140
  recover: recovered_context
66
141
  ```
67
142
 
68
- ## Run resources
143
+ ## Outputs
69
144
 
70
- `type: run` represents declarative graph execution as a resource.
145
+ Top-level outputs describe graph return values.
71
146
 
72
147
  ```yaml
73
- resources:
74
- recovered_context:
75
- type: run
76
- graph: ./context.circuitry.yaml
77
- entry: recovery
78
- inputs:
79
- user_turn: user_turn
148
+ outputs:
149
+ answer:
150
+ from: assistant.answer
80
151
  ```
81
152
 
82
- A runtime tool such as `run_graph` is dynamic capability. A `type: run` resource is declarative topology.
153
+ `expect` describes a resource result. `outputs` describes graph boundary values.
83
154
 
84
- ## Outputs
155
+ ## Imports
156
+
157
+ Imports copy selected resources from another graph into the current graph.
85
158
 
86
159
  ```yaml
87
- outputs:
88
- response:
89
- from: assistant.response
90
- schema:
91
- response: str
160
+ imports:
161
+ - path: ./shared.circuitry.yaml
162
+ resources: "*"
92
163
  ```
93
164
 
94
- ## Extensions
165
+ ```yaml
166
+ imports:
167
+ - path: ./shared.circuitry.yaml
168
+ resources:
169
+ shared_system: system
170
+ ```
171
+
172
+ Imports do not merge top-level inputs, entries, outputs, or extension fields.
173
+
174
+ ## Resolution
175
+
176
+ Running a graph means resolving its entry resource.
177
+
178
+ Resource resolution semantics:
179
+
180
+ - `input`: returns caller input named by `from`.
181
+ - `text`/`data`: returns `value`, file contents from `path`, or runtime-resolved `uri` contents.
182
+ - `agent`: resolves listed inputs, then asks the runtime to execute an agent resource.
183
+ - `run`: resolves mapped inputs, then asks the runtime to run another Circuitry graph.
184
+ - unknown `type`: runtime-defined.
185
+
186
+ Circuitry tooling validates graph shape and resolves imports. It does not execute runtime behavior.
187
+
188
+ ## Validation
189
+
190
+ A valid 0.4 graph:
95
191
 
96
- Fields beginning with `x-` are preserved for runtimes and ecosystems.
192
+ - is an object
193
+ - has `circuitry: "0.4"`
194
+ - has `resources`
195
+ - does not contain `nodes` or `edges`
196
+ - has an existing `entry`, if set
197
+ - has `entries` targets that exist
198
+ - has `type` on every resource
199
+ - has resource inputs pointing to existing resources
200
+ - has no cycles in resource dependencies
201
+ - has `type: input` resources with valid `from`
202
+ - has `type: run` resources with `graph`
203
+ - has outputs with valid `from` roots
package/dist/cli.d.ts CHANGED
@@ -1 +1,2 @@
1
+ #!/usr/bin/env node
1
2
  export {};