@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/LICENSE +2 -371
- package/README.md +170 -0
- package/SPEC.md +138 -31
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +42 -7600
- package/dist/cli.js.map +1 -0
- package/dist/graph.d.ts +30 -165
- package/dist/graph.js +193 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -7629
- package/dist/index.js.map +1 -0
- package/dist/resolve.d.ts +12 -4
- package/dist/resolve.js +90 -7542
- package/dist/resolve.js.map +1 -0
- package/dist/yaml.d.ts +2 -11
- package/dist/yaml.js +8 -0
- package/dist/yaml.js.map +1 -0
- package/examples/agent.circuitry.yaml +15 -12
- package/examples/context.circuitry.yaml +22 -0
- package/examples/imports.circuitry.yaml +7 -10
- package/examples/minimal.circuitry.yaml +6 -16
- package/examples/run.circuitry.yaml +26 -0
- package/examples/shared.circuitry.yaml +6 -0
- package/package.json +23 -26
- package/schema.json +41 -19
- package/examples/run-resource.circuitry.yaml +0 -24
package/SPEC.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
# Circuitry 0.4
|
|
1
|
+
# Circuitry 0.4 Specification
|
|
2
2
|
|
|
3
|
-
Circuitry is a
|
|
3
|
+
Circuitry is a source format for executable resource graphs.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
66
|
+
Top-level `inputs` declare caller-provided values.
|
|
50
67
|
|
|
51
68
|
```yaml
|
|
52
69
|
inputs:
|
|
53
|
-
|
|
70
|
+
question:
|
|
54
71
|
type: text
|
|
55
72
|
required: true
|
|
56
73
|
```
|
|
57
74
|
|
|
58
|
-
|
|
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.
|
|
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
|
-
##
|
|
143
|
+
## Outputs
|
|
69
144
|
|
|
70
|
-
|
|
145
|
+
Top-level outputs describe graph return values.
|
|
71
146
|
|
|
72
147
|
```yaml
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
153
|
+
`expect` describes a resource result. `outputs` describes graph boundary values.
|
|
83
154
|
|
|
84
|
-
##
|
|
155
|
+
## Imports
|
|
156
|
+
|
|
157
|
+
Imports copy selected resources from another graph into the current graph.
|
|
85
158
|
|
|
86
159
|
```yaml
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
schema:
|
|
91
|
-
response: str
|
|
160
|
+
imports:
|
|
161
|
+
- path: ./shared.circuitry.yaml
|
|
162
|
+
resources: "*"
|
|
92
163
|
```
|
|
93
164
|
|
|
94
|
-
|
|
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
|
-
|
|
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