@farmslot/protocol 0.11.1 → 0.12.0

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,441 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://farmslot.io/schemas/action-manifest-v1.schema.json",
4
+ "title": "Farmslot Recipe Action Manifest v1",
5
+ "description": "Declares the actions a Recipe Protocol v1 runner can execute.",
6
+ "type": "object",
7
+ "required": ["$schema", "actions"],
8
+ "properties": {
9
+ "$schema": {
10
+ "const": "https://farmslot.io/schemas/action-manifest-v1.schema.json",
11
+ "description": "Canonical Action Manifest v1 schema URL used by editors and validators."
12
+ },
13
+ "actions": {
14
+ "type": "object",
15
+ "minProperties": 1,
16
+ "propertyNames": {
17
+ "anyOf": [
18
+ {
19
+ "enum": [
20
+ "command",
21
+ "wait",
22
+ "assert_file",
23
+ "assert_json",
24
+ "assert_exit_code",
25
+ "assert_output",
26
+ "state_read",
27
+ "watch_logs",
28
+ "index_artifacts",
29
+ "call",
30
+ "switch",
31
+ "manual",
32
+ "end",
33
+ "ui.navigate",
34
+ "ui.press",
35
+ "ui.key_press",
36
+ "ui.set_input",
37
+ "ui.scroll",
38
+ "ui.gesture",
39
+ "ui.wait_for",
40
+ "ui.screenshot",
41
+ "app.status",
42
+ "app.lifecycle",
43
+ "app.hud",
44
+ "app.trace",
45
+ "cdp.target",
46
+ "cdp.storage",
47
+ "cdp.network",
48
+ "cdp.emulation",
49
+ "cdp.metrics",
50
+ "cdp.trace"
51
+ ]
52
+ },
53
+ {
54
+ "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)+$"
55
+ }
56
+ ]
57
+ },
58
+ "properties": {
59
+ "command": { "$ref": "#/$defs/actionWithSchema" },
60
+ "wait": { "$ref": "#/$defs/actionWithSchema" },
61
+ "assert_file": { "$ref": "#/$defs/actionWithSchema" },
62
+ "assert_json": { "$ref": "#/$defs/actionWithSchema" },
63
+ "assert_exit_code": { "$ref": "#/$defs/actionWithSchema" },
64
+ "assert_output": { "$ref": "#/$defs/actionWithSchema" },
65
+ "state_read": { "$ref": "#/$defs/actionWithSchema" },
66
+ "watch_logs": { "$ref": "#/$defs/actionWithSchema" },
67
+ "index_artifacts": { "$ref": "#/$defs/actionWithSchema" },
68
+ "call": { "$ref": "#/$defs/action" },
69
+ "switch": { "$ref": "#/$defs/actionWithSchema" },
70
+ "manual": { "$ref": "#/$defs/actionWithSchema" },
71
+ "end": { "$ref": "#/$defs/action" },
72
+ "ui.navigate": { "$ref": "#/$defs/actionWithSchema" },
73
+ "ui.press": { "$ref": "#/$defs/actionWithSchema" },
74
+ "ui.key_press": { "$ref": "#/$defs/actionWithSchema" },
75
+ "ui.set_input": { "$ref": "#/$defs/actionWithSchema" },
76
+ "ui.scroll": { "$ref": "#/$defs/actionWithSchema" },
77
+ "ui.gesture": { "$ref": "#/$defs/actionWithSchema" },
78
+ "ui.wait_for": { "$ref": "#/$defs/actionWithSchema" },
79
+ "ui.screenshot": { "$ref": "#/$defs/actionWithSchema" },
80
+ "app.status": { "$ref": "#/$defs/actionWithSchema" },
81
+ "app.lifecycle": { "$ref": "#/$defs/actionWithSchema" },
82
+ "app.hud": { "$ref": "#/$defs/actionWithSchema" },
83
+ "app.trace": { "$ref": "#/$defs/actionWithSchema" },
84
+ "cdp.target": { "$ref": "#/$defs/actionWithSchema" },
85
+ "cdp.storage": { "$ref": "#/$defs/actionWithSchema" },
86
+ "cdp.network": { "$ref": "#/$defs/actionWithSchema" },
87
+ "cdp.emulation": { "$ref": "#/$defs/actionWithSchema" },
88
+ "cdp.metrics": { "$ref": "#/$defs/actionWithSchema" },
89
+ "cdp.trace": { "$ref": "#/$defs/actionWithSchema" }
90
+ },
91
+ "additionalProperties": {
92
+ "$ref": "#/$defs/customAction"
93
+ },
94
+ "description": "Actions keyed by their official or namespaced custom action name."
95
+ },
96
+ "observers": {
97
+ "type": "array",
98
+ "items": {
99
+ "$ref": "#/$defs/observer"
100
+ },
101
+ "description": "Optional passive observers automatically applied after selected actions."
102
+ }
103
+ },
104
+ "additionalProperties": false,
105
+ "$defs": {
106
+ "actionWithSchema": {
107
+ "allOf": [
108
+ {
109
+ "$ref": "#/$defs/action"
110
+ },
111
+ {
112
+ "required": ["schema"]
113
+ }
114
+ ],
115
+ "description": "Official adapter action with an explicit parameter schema."
116
+ },
117
+ "customAction": {
118
+ "allOf": [
119
+ {
120
+ "$ref": "#/$defs/action"
121
+ },
122
+ {
123
+ "required": ["schema", "execution_capabilities"]
124
+ }
125
+ ],
126
+ "description": "Namespaced custom action with explicit parameters and enforced execution effects."
127
+ },
128
+ "action": {
129
+ "type": "object",
130
+ "required": ["description", "examples"],
131
+ "properties": {
132
+ "description": {
133
+ "type": "string",
134
+ "minLength": 1,
135
+ "description": "Concise purpose shown by action discovery."
136
+ },
137
+ "schema": {
138
+ "$ref": "#/$defs/paramsSchema",
139
+ "description": "Strict JSON Schema for action-specific node parameters. The runtime additionally validates cross-field relationships such as required names and enum/default value types."
140
+ },
141
+ "result_cases": {
142
+ "type": "array",
143
+ "minItems": 1,
144
+ "uniqueItems": true,
145
+ "items": {
146
+ "type": "string",
147
+ "minLength": 1
148
+ },
149
+ "description": "Finite result cases available to recipe graph routing."
150
+ },
151
+ "examples": {
152
+ "type": "array",
153
+ "minItems": 1,
154
+ "items": {
155
+ "$ref": "#/$defs/example"
156
+ },
157
+ "description": "Copyable Recipe v1 action nodes with a human-facing intent."
158
+ },
159
+ "execution_capabilities": {
160
+ "type": "array",
161
+ "uniqueItems": true,
162
+ "items": {
163
+ "enum": [
164
+ "host-exec",
165
+ "host-read-export",
166
+ "app-mutation",
167
+ "external-mutation",
168
+ "arbitrary-code"
169
+ ]
170
+ },
171
+ "description": "Security-relevant effects enforced by the runner trust plan. Custom actions must declare this field, including an empty array for read-only actions."
172
+ }
173
+ },
174
+ "additionalProperties": false
175
+ },
176
+ "paramsSchema": {
177
+ "type": "object",
178
+ "required": ["type", "additionalProperties"],
179
+ "properties": {
180
+ "type": {
181
+ "const": "object",
182
+ "description": "Action parameters are always represented by one object."
183
+ },
184
+ "additionalProperties": {
185
+ "const": false,
186
+ "description": "Unknown action parameters are rejected."
187
+ },
188
+ "required": {
189
+ "$ref": "#/$defs/requiredProperties"
190
+ },
191
+ "properties": {
192
+ "$ref": "#/$defs/parameterProperties"
193
+ }
194
+ },
195
+ "additionalProperties": false,
196
+ "description": "Closed action-parameter schema supported by Recipe Protocol v1."
197
+ },
198
+ "parameterProperties": {
199
+ "type": "object",
200
+ "propertyNames": {
201
+ "pattern": "^[A-Za-z0-9_-]+$"
202
+ },
203
+ "additionalProperties": {
204
+ "$ref": "#/$defs/parameterSchema"
205
+ }
206
+ },
207
+ "requiredProperties": {
208
+ "type": "array",
209
+ "uniqueItems": true,
210
+ "items": {
211
+ "type": "string",
212
+ "minLength": 1
213
+ }
214
+ },
215
+ "parameterType": {
216
+ "anyOf": [
217
+ {
218
+ "enum": ["string", "number", "integer", "boolean", "object", "array"]
219
+ },
220
+ {
221
+ "type": "array",
222
+ "minItems": 1,
223
+ "uniqueItems": true,
224
+ "items": {
225
+ "enum": ["string", "number", "integer", "boolean", "object", "array"]
226
+ }
227
+ }
228
+ ]
229
+ },
230
+ "parameterSchema": {
231
+ "type": "object",
232
+ "required": ["type"],
233
+ "properties": {
234
+ "type": {
235
+ "$ref": "#/$defs/parameterType"
236
+ },
237
+ "description": {
238
+ "type": "string",
239
+ "description": "Human-readable purpose of this parameter."
240
+ },
241
+ "default": {
242
+ "description": "Optional default value applied when the parameter is omitted."
243
+ },
244
+ "enum": {
245
+ "type": "array",
246
+ "minItems": 1,
247
+ "uniqueItems": true,
248
+ "description": "Optional finite set of accepted parameter values."
249
+ },
250
+ "additionalProperties": {
251
+ "type": "boolean",
252
+ "description": "Whether an object parameter accepts undeclared nested properties."
253
+ },
254
+ "required": {
255
+ "$ref": "#/$defs/requiredProperties"
256
+ },
257
+ "properties": {
258
+ "$ref": "#/$defs/parameterProperties"
259
+ },
260
+ "items": {
261
+ "$ref": "#/$defs/parameterSchema"
262
+ }
263
+ },
264
+ "additionalProperties": false,
265
+ "allOf": [
266
+ {
267
+ "if": {
268
+ "properties": {
269
+ "type": {
270
+ "anyOf": [
271
+ {
272
+ "const": "array"
273
+ },
274
+ {
275
+ "type": "array",
276
+ "contains": {
277
+ "const": "array"
278
+ }
279
+ }
280
+ ]
281
+ }
282
+ },
283
+ "required": ["type"]
284
+ },
285
+ "then": {
286
+ "required": ["items"]
287
+ }
288
+ }
289
+ ],
290
+ "description": "Supported schema for one action parameter."
291
+ },
292
+ "example": {
293
+ "oneOf": [
294
+ {
295
+ "type": "object",
296
+ "required": ["action", "status"],
297
+ "properties": {
298
+ "action": {
299
+ "const": "end",
300
+ "description": "Terminal examples use the Recipe v1 end action."
301
+ },
302
+ "status": {
303
+ "enum": ["pass", "fail", "unknown"],
304
+ "description": "Terminal verdict returned by the example."
305
+ }
306
+ },
307
+ "additionalProperties": false
308
+ },
309
+ {
310
+ "type": "object",
311
+ "required": ["action", "intent", "ref", "next"],
312
+ "properties": {
313
+ "action": {
314
+ "const": "call",
315
+ "description": "Call examples compose another named recipe."
316
+ },
317
+ "intent": {
318
+ "type": "string",
319
+ "minLength": 1,
320
+ "description": "Concise human-facing reason for executing the example node."
321
+ },
322
+ "ref": {
323
+ "type": "string",
324
+ "minLength": 1,
325
+ "not": { "pattern": "\\{\\{(?:params|outputs)\\.[A-Za-z0-9_.-]+\\}\\}" },
326
+ "description": "Recipe id to compose."
327
+ },
328
+ "params": {
329
+ "type": "object",
330
+ "description": "Parameters forwarded to the called recipe."
331
+ },
332
+ "proves": {
333
+ "type": "array",
334
+ "uniqueItems": true,
335
+ "items": {
336
+ "type": "string",
337
+ "minLength": 1
338
+ },
339
+ "description": "Proof target ids covered by this node."
340
+ },
341
+ "next": {
342
+ "type": "string",
343
+ "minLength": 1,
344
+ "description": "Next node id."
345
+ }
346
+ },
347
+ "additionalProperties": false
348
+ },
349
+ {
350
+ "type": "object",
351
+ "required": ["action", "intent"],
352
+ "properties": {
353
+ "action": {
354
+ "type": "string",
355
+ "minLength": 1,
356
+ "not": { "enum": ["call", "end"] },
357
+ "description": "Action name matching the containing actions key."
358
+ },
359
+ "intent": {
360
+ "type": "string",
361
+ "minLength": 1,
362
+ "description": "Concise human-facing reason for executing the example node."
363
+ },
364
+ "proves": {
365
+ "type": "array",
366
+ "uniqueItems": true,
367
+ "items": {
368
+ "type": "string",
369
+ "minLength": 1
370
+ },
371
+ "description": "Proof target ids covered by this node."
372
+ },
373
+ "next": {
374
+ "type": "string",
375
+ "minLength": 1,
376
+ "description": "Next node id."
377
+ },
378
+ "cases": {
379
+ "type": "object",
380
+ "minProperties": 1,
381
+ "additionalProperties": {
382
+ "type": "string",
383
+ "minLength": 1
384
+ },
385
+ "description": "Result case names mapped to next node ids."
386
+ },
387
+ "default": {
388
+ "type": "string",
389
+ "minLength": 1,
390
+ "description": "Fallback node id when no result case matches."
391
+ }
392
+ },
393
+ "oneOf": [
394
+ {
395
+ "required": ["next"],
396
+ "not": {
397
+ "anyOf": [{ "required": ["cases"] }, { "required": ["default"] }]
398
+ }
399
+ },
400
+ {
401
+ "required": ["cases", "default"],
402
+ "not": { "required": ["next"] }
403
+ }
404
+ ],
405
+ "additionalProperties": true
406
+ }
407
+ ]
408
+ },
409
+ "observer": {
410
+ "type": "object",
411
+ "required": ["ref", "default_for"],
412
+ "properties": {
413
+ "ref": {
414
+ "type": "string",
415
+ "minLength": 1,
416
+ "anyOf": [
417
+ {
418
+ "enum": ["ui.screen", "ui.visible"]
419
+ },
420
+ {
421
+ "pattern": "\\."
422
+ }
423
+ ],
424
+ "description": "Built-in or namespaced passive observer reference."
425
+ },
426
+ "default_for": {
427
+ "type": "array",
428
+ "minItems": 1,
429
+ "uniqueItems": true,
430
+ "items": {
431
+ "type": "string",
432
+ "minLength": 1,
433
+ "not": { "enum": ["call", "end"] }
434
+ },
435
+ "description": "Declared actions after which this observer runs."
436
+ }
437
+ },
438
+ "additionalProperties": false
439
+ }
440
+ }
441
+ }