amiril 0.0.0.dev0__py3-none-any.whl
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.
- amiril/__init__.py +51 -0
- amiril/_adapters.py +399 -0
- amiril/_engine/__init__.py +1 -0
- amiril/_engine/engine.py +113 -0
- amiril/_engine/expr.py +653 -0
- amiril/_engine/numbers.py +111 -0
- amiril/_engine/regex.py +262 -0
- amiril/_engine/rules.py +192 -0
- amiril/_engine/sentence.py +251 -0
- amiril/_engine/timeparse.py +72 -0
- amiril/_engine/validate.py +863 -0
- amiril/_engine/values.py +273 -0
- amiril/_kernel/__init__.py +1 -0
- amiril/_kernel/bundle.py +245 -0
- amiril/_kernel/coerce.py +103 -0
- amiril/_kernel/events.py +87 -0
- amiril/_kernel/guard.py +1196 -0
- amiril/_kernel/ids.py +66 -0
- amiril/_kernel/messages.py +30 -0
- amiril/_kernel/normalise.py +165 -0
- amiril/_kernel/records.py +131 -0
- amiril/_kernel/store.py +661 -0
- amiril/_runtime.py +617 -0
- amiril/adk.py +577 -0
- amiril/control/__init__.py +25 -0
- amiril/control/_delivery.py +567 -0
- amiril/control/_disk.py +418 -0
- amiril/control/_holds.py +252 -0
- amiril/control/_jsonschema.py +265 -0
- amiril/control/_pathc.py +85 -0
- amiril/control/_records.py +293 -0
- amiril/control/_redact.py +79 -0
- amiril/control/_transport.py +184 -0
- amiril/control/_wire.py +73 -0
- amiril/control/client.py +1313 -0
- amiril/control/config.py +204 -0
- amiril/control/schemas/bundle.response.schema.json +22 -0
- amiril/control/schemas/common.schema.json +593 -0
- amiril/control/schemas/decisions.request.schema.json +558 -0
- amiril/control/schemas/decisions.response.schema.json +23 -0
- amiril/control/schemas/error.response.schema.json +54 -0
- amiril/control/schemas/heartbeat.request.schema.json +305 -0
- amiril/control/schemas/heartbeat.response.schema.json +34 -0
- amiril/control/schemas/hold-create.request.schema.json +138 -0
- amiril/control/schemas/hold.response.schema.json +226 -0
- amiril/control/schemas/installation-register.request.schema.json +492 -0
- amiril/control/schemas/installation-register.response.schema.json +85 -0
- amiril/core.py +89 -0
- amiril/docs/README.md +14 -0
- amiril/docs/durability/langgraph.md +292 -0
- amiril/docs/frameworks/adk.md +141 -0
- amiril/docs/frameworks/langgraph.md +154 -0
- amiril/docs/frameworks/no-framework.md +238 -0
- amiril/docs/frameworks/write-an-adapter.md +203 -0
- amiril/durable.py +342 -0
- amiril/langgraph.py +746 -0
- amiril/plain.py +454 -0
- amiril/py.typed +0 -0
- amiril/seams.py +357 -0
- amiril/testing.py +21 -0
- amiril-0.0.0.dev0.dist-info/METADATA +114 -0
- amiril-0.0.0.dev0.dist-info/RECORD +64 -0
- amiril-0.0.0.dev0.dist-info/WHEEL +4 -0
- amiril-0.0.0.dev0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://amiril.ai/spec/protocol/1/installation-register.request.schema.json",
|
|
4
|
+
"title": "POST /v1/installations request",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"protocol": {
|
|
8
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/protocol"
|
|
9
|
+
},
|
|
10
|
+
"sdk": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"language": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
16
|
+
"maxLength": 64
|
|
17
|
+
},
|
|
18
|
+
"version": {
|
|
19
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
20
|
+
},
|
|
21
|
+
"rule_schemas": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"minItems": 1,
|
|
24
|
+
"items": {
|
|
25
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
26
|
+
},
|
|
27
|
+
"description": "Rule-document schema ids this core accepts, e.g. amiril.rules/1."
|
|
28
|
+
},
|
|
29
|
+
"capabilities": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"maxItems": 256,
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)*$",
|
|
35
|
+
"maxLength": 64
|
|
36
|
+
},
|
|
37
|
+
"description": "What this core reads beyond the frozen rule document, one name per addition. Absent means none."
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"required": [
|
|
41
|
+
"language",
|
|
42
|
+
"version",
|
|
43
|
+
"rule_schemas"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"framework": {
|
|
47
|
+
"oneOf": [
|
|
48
|
+
{
|
|
49
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/name_version"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "null"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"adapter": {
|
|
57
|
+
"oneOf": [
|
|
58
|
+
{
|
|
59
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/name_version"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "null"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"deployment": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"description": "Deployment identity (spec/protocol.md, Deployment identity).",
|
|
69
|
+
"properties": {
|
|
70
|
+
"service": {
|
|
71
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
72
|
+
},
|
|
73
|
+
"version": {
|
|
74
|
+
"oneOf": [
|
|
75
|
+
{
|
|
76
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"type": "null"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"environment": {
|
|
84
|
+
"oneOf": [
|
|
85
|
+
{
|
|
86
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"type": "null"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"source": {
|
|
94
|
+
"enum": [
|
|
95
|
+
"env",
|
|
96
|
+
"otel",
|
|
97
|
+
"cloud_run",
|
|
98
|
+
"lambda",
|
|
99
|
+
"host"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"commit": {
|
|
103
|
+
"description": "The source revision the process was built from, as the host names it. Absent when the host gives none.",
|
|
104
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"required": [
|
|
108
|
+
"service",
|
|
109
|
+
"version",
|
|
110
|
+
"environment",
|
|
111
|
+
"source"
|
|
112
|
+
],
|
|
113
|
+
"allOf": [
|
|
114
|
+
{
|
|
115
|
+
"if": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"properties": {
|
|
118
|
+
"source": {
|
|
119
|
+
"const": "host"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": [
|
|
123
|
+
"source"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"then": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"properties": {
|
|
129
|
+
"version": {
|
|
130
|
+
"type": "null"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"process": {
|
|
138
|
+
"allOf": [
|
|
139
|
+
{
|
|
140
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/process"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "object",
|
|
144
|
+
"properties": {
|
|
145
|
+
"runtime": {
|
|
146
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/name_version"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"required": [
|
|
150
|
+
"runtime"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"bundle": {
|
|
156
|
+
"oneOf": [
|
|
157
|
+
{
|
|
158
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/bundle_ref"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"type": "null"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
"coverage": {
|
|
166
|
+
"type": "object",
|
|
167
|
+
"description": "Install-time coverage report (spec/protocol.md, Coverage report).",
|
|
168
|
+
"properties": {
|
|
169
|
+
"generated_at": {
|
|
170
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/timestamp"
|
|
171
|
+
},
|
|
172
|
+
"agents": {
|
|
173
|
+
"type": "array",
|
|
174
|
+
"maxItems": 500,
|
|
175
|
+
"items": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"properties": {
|
|
178
|
+
"name": {
|
|
179
|
+
"description": "The framework's own agent name, NFC-normalised, trimmed and cut at 256 code points; null for an agent with no name (spec/protocol.md, Coverage report).",
|
|
180
|
+
"oneOf": [
|
|
181
|
+
{
|
|
182
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"type": "null"
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
"root": {
|
|
190
|
+
"type": "boolean"
|
|
191
|
+
},
|
|
192
|
+
"declared_id": {
|
|
193
|
+
"oneOf": [
|
|
194
|
+
{
|
|
195
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"type": "null"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
"register_as": {
|
|
203
|
+
"description": "Optional: the display name of the registered agent this name belongs to, from init(names=...), normalised like name.",
|
|
204
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
205
|
+
},
|
|
206
|
+
"tools": {
|
|
207
|
+
"type": "array",
|
|
208
|
+
"items": {
|
|
209
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"required": [
|
|
214
|
+
"name",
|
|
215
|
+
"root",
|
|
216
|
+
"declared_id",
|
|
217
|
+
"tools"
|
|
218
|
+
],
|
|
219
|
+
"allOf": [
|
|
220
|
+
{
|
|
221
|
+
"if": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"properties": {
|
|
224
|
+
"name": {
|
|
225
|
+
"type": "null"
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"required": [
|
|
229
|
+
"name"
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
"then": {
|
|
233
|
+
"type": "object",
|
|
234
|
+
"not": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"required": [
|
|
237
|
+
"register_as"
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"tools": {
|
|
246
|
+
"type": "array",
|
|
247
|
+
"maxItems": 2000,
|
|
248
|
+
"items": {
|
|
249
|
+
"type": "object",
|
|
250
|
+
"properties": {
|
|
251
|
+
"name": {
|
|
252
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
253
|
+
},
|
|
254
|
+
"declared_id": {
|
|
255
|
+
"oneOf": [
|
|
256
|
+
{
|
|
257
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"type": "null"
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
"agent": {
|
|
265
|
+
"oneOf": [
|
|
266
|
+
{
|
|
267
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"type": "null"
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
"description": {
|
|
275
|
+
"oneOf": [
|
|
276
|
+
{
|
|
277
|
+
"type": "string",
|
|
278
|
+
"maxLength": 4096
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"type": "null"
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
"schema": {
|
|
286
|
+
"oneOf": [
|
|
287
|
+
{
|
|
288
|
+
"type": "object"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"type": "null"
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
},
|
|
295
|
+
"schema_omitted": {
|
|
296
|
+
"enum": [
|
|
297
|
+
"unavailable",
|
|
298
|
+
"too_large",
|
|
299
|
+
"redacted"
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"required": [
|
|
304
|
+
"name",
|
|
305
|
+
"declared_id",
|
|
306
|
+
"agent",
|
|
307
|
+
"description",
|
|
308
|
+
"schema"
|
|
309
|
+
],
|
|
310
|
+
"allOf": [
|
|
311
|
+
{
|
|
312
|
+
"if": {
|
|
313
|
+
"type": "object",
|
|
314
|
+
"properties": {
|
|
315
|
+
"schema": {
|
|
316
|
+
"type": "null"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"required": [
|
|
320
|
+
"schema"
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
"then": {
|
|
324
|
+
"type": "object",
|
|
325
|
+
"properties": {
|
|
326
|
+
"schema_omitted": {
|
|
327
|
+
"enum": [
|
|
328
|
+
"unavailable",
|
|
329
|
+
"too_large",
|
|
330
|
+
"redacted"
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
"required": [
|
|
335
|
+
"schema_omitted"
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
"else": {
|
|
339
|
+
"type": "object",
|
|
340
|
+
"not": {
|
|
341
|
+
"type": "object",
|
|
342
|
+
"properties": {
|
|
343
|
+
"schema_omitted": {
|
|
344
|
+
"enum": [
|
|
345
|
+
"unavailable",
|
|
346
|
+
"too_large",
|
|
347
|
+
"redacted"
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"required": [
|
|
352
|
+
"schema_omitted"
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
"uncovered": {
|
|
361
|
+
"type": "array",
|
|
362
|
+
"maxItems": 2500,
|
|
363
|
+
"items": {
|
|
364
|
+
"type": "object",
|
|
365
|
+
"properties": {
|
|
366
|
+
"kind": {
|
|
367
|
+
"enum": [
|
|
368
|
+
"agent",
|
|
369
|
+
"tool"
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
"name": {
|
|
373
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
374
|
+
},
|
|
375
|
+
"agent": {
|
|
376
|
+
"oneOf": [
|
|
377
|
+
{
|
|
378
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/short_string"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"type": "null"
|
|
382
|
+
}
|
|
383
|
+
]
|
|
384
|
+
},
|
|
385
|
+
"reason": {
|
|
386
|
+
"type": "string",
|
|
387
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
388
|
+
"maxLength": 64,
|
|
389
|
+
"description": "One of no_blocking_hook, built_after_install, copied_object, mcp_tool_without_definition, provider_builtin_tool, direct_invoke, hook_order, other. Open set, lower-case identifier."
|
|
390
|
+
},
|
|
391
|
+
"text": {
|
|
392
|
+
"type": "string",
|
|
393
|
+
"minLength": 1,
|
|
394
|
+
"maxLength": 1024
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
"required": [
|
|
398
|
+
"kind",
|
|
399
|
+
"name",
|
|
400
|
+
"reason",
|
|
401
|
+
"text"
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
"truncated": {
|
|
406
|
+
"type": "boolean"
|
|
407
|
+
},
|
|
408
|
+
"redaction_failed": {
|
|
409
|
+
"type": "boolean"
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"required": [
|
|
413
|
+
"generated_at",
|
|
414
|
+
"agents",
|
|
415
|
+
"tools",
|
|
416
|
+
"uncovered",
|
|
417
|
+
"truncated",
|
|
418
|
+
"redaction_failed"
|
|
419
|
+
],
|
|
420
|
+
"allOf": [
|
|
421
|
+
{
|
|
422
|
+
"if": {
|
|
423
|
+
"type": "object",
|
|
424
|
+
"properties": {
|
|
425
|
+
"redaction_failed": {
|
|
426
|
+
"const": true
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
"required": [
|
|
430
|
+
"redaction_failed"
|
|
431
|
+
]
|
|
432
|
+
},
|
|
433
|
+
"then": {
|
|
434
|
+
"type": "object",
|
|
435
|
+
"properties": {
|
|
436
|
+
"tools": {
|
|
437
|
+
"type": "array",
|
|
438
|
+
"items": {
|
|
439
|
+
"type": "object",
|
|
440
|
+
"properties": {
|
|
441
|
+
"description": {
|
|
442
|
+
"type": "null"
|
|
443
|
+
},
|
|
444
|
+
"schema": {
|
|
445
|
+
"type": "null"
|
|
446
|
+
},
|
|
447
|
+
"schema_omitted": {
|
|
448
|
+
"const": "redacted"
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
"required": [
|
|
460
|
+
"protocol",
|
|
461
|
+
"sdk",
|
|
462
|
+
"framework",
|
|
463
|
+
"adapter",
|
|
464
|
+
"deployment",
|
|
465
|
+
"process",
|
|
466
|
+
"bundle",
|
|
467
|
+
"coverage"
|
|
468
|
+
],
|
|
469
|
+
"allOf": [
|
|
470
|
+
{
|
|
471
|
+
"if": {
|
|
472
|
+
"type": "object",
|
|
473
|
+
"properties": {
|
|
474
|
+
"framework": {
|
|
475
|
+
"type": "null"
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
"required": [
|
|
479
|
+
"framework"
|
|
480
|
+
]
|
|
481
|
+
},
|
|
482
|
+
"then": {
|
|
483
|
+
"type": "object",
|
|
484
|
+
"properties": {
|
|
485
|
+
"adapter": {
|
|
486
|
+
"type": "null"
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://amiril.ai/spec/protocol/1/installation-register.response.schema.json",
|
|
4
|
+
"title": "POST /v1/installations response (200)",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"protocol": {
|
|
8
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/protocol"
|
|
9
|
+
},
|
|
10
|
+
"installation_id": {
|
|
11
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/opaque_id"
|
|
12
|
+
},
|
|
13
|
+
"server_time": {
|
|
14
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/timestamp"
|
|
15
|
+
},
|
|
16
|
+
"heartbeat_interval_ms": {
|
|
17
|
+
"type": "integer",
|
|
18
|
+
"minimum": 1
|
|
19
|
+
},
|
|
20
|
+
"limits": {
|
|
21
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/limits"
|
|
22
|
+
},
|
|
23
|
+
"sync": {
|
|
24
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/sync_guidance"
|
|
25
|
+
},
|
|
26
|
+
"bundle_status": {
|
|
27
|
+
"enum": [
|
|
28
|
+
"current",
|
|
29
|
+
"none_published",
|
|
30
|
+
"forbidden"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"bundle": {
|
|
34
|
+
"oneOf": [
|
|
35
|
+
{
|
|
36
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/bundle"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "null"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": [
|
|
45
|
+
"protocol",
|
|
46
|
+
"installation_id",
|
|
47
|
+
"server_time",
|
|
48
|
+
"heartbeat_interval_ms",
|
|
49
|
+
"limits",
|
|
50
|
+
"sync",
|
|
51
|
+
"bundle_status",
|
|
52
|
+
"bundle"
|
|
53
|
+
],
|
|
54
|
+
"allOf": [
|
|
55
|
+
{
|
|
56
|
+
"if": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"properties": {
|
|
59
|
+
"bundle_status": {
|
|
60
|
+
"const": "current"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"required": [
|
|
64
|
+
"bundle_status"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"then": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"properties": {
|
|
70
|
+
"bundle": {
|
|
71
|
+
"$ref": "https://amiril.ai/spec/protocol/1/common.schema.json#/$defs/bundle"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"else": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"bundle": {
|
|
79
|
+
"type": "null"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
amiril/core.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""The Amiril core: the rule engine and the kernel, as the public surface
|
|
2
|
+
framework adapters and the control-plane client import. Nothing here imports
|
|
3
|
+
a framework. Behaviour is `spec/edoc.md`, `spec/kernel.md` and
|
|
4
|
+
`spec/decision-line.md`; conformance is `conformance/`.
|
|
5
|
+
|
|
6
|
+
Engine: `Engine`, `load_document` (validate, raising `DocumentError` with the
|
|
7
|
+
`{path, code, message}` problems), `validate_document`, `render_sentence`,
|
|
8
|
+
`customer_view`, `Decision`, `EvalError`.
|
|
9
|
+
|
|
10
|
+
Kernel: `Guard` (`before_call`, `abefore_call`, `after_call`, `end_run`,
|
|
11
|
+
`end_session`, `swap`, `history_report`, `drain_counts`, `record_fault`),
|
|
12
|
+
`RunContext`, `CallRecord`, `Outcome`, `Snapshot`, `DecisionEvent`,
|
|
13
|
+
`decision_line`, `coerce_args`, `normalise_result`, `to_json`,
|
|
14
|
+
`canonical_json`, `mint_call_id`, `CallIdMinter`, `BatchTracker`,
|
|
15
|
+
`prepare_bundle`, `encode_nonfinite`.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from collections.abc import Callable, Mapping
|
|
21
|
+
from typing import Any
|
|
22
|
+
|
|
23
|
+
from ._engine.engine import EMPTY_DOCUMENT, Engine, LoadedDocument, load_document_file
|
|
24
|
+
from ._engine.numbers import decode_nonfinite, dumps_line, encode_nonfinite, fmt_number
|
|
25
|
+
from ._engine.rules import DEFAULT_HOLD_TIMEOUT_MS, Decision
|
|
26
|
+
from ._engine.sentence import customer_view, render_sentence
|
|
27
|
+
from ._engine.validate import SCHEMA_ID, DocumentError, validate_document
|
|
28
|
+
from ._engine.values import ABSENT, MISSING, EvalError
|
|
29
|
+
from ._kernel.bundle import BundleError, PreparedBundle, is_bundle, prepare_bundle
|
|
30
|
+
from ._kernel.coerce import coerce_args
|
|
31
|
+
from ._kernel.events import DecisionEvent, decision_line, serialise_line
|
|
32
|
+
from ._kernel.guard import HOLD_OUTCOMES, KERNEL_MODES, UNKNOWN_TOOL_RULE, Guard, LoadedState
|
|
33
|
+
from ._kernel.ids import BatchTracker, CallIdMinter, mint_call_id
|
|
34
|
+
from ._kernel.normalise import canonical_json, normalise_result, to_json
|
|
35
|
+
from ._kernel.records import CallRecord, Outcome, RunContext, Snapshot
|
|
36
|
+
from ._kernel.store import HistoryStore
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def load_document(document: dict, predicates: Mapping[str, Callable[..., Any]] | None = None) -> LoadedDocument:
|
|
40
|
+
"""Validate a rule document (edoc.md 12) and compile it. Raises
|
|
41
|
+
`DocumentError` carrying every `{path, code, message}` problem."""
|
|
42
|
+
return LoadedDocument(document, dict(predicates or {}))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
__all__ = [
|
|
46
|
+
"ABSENT",
|
|
47
|
+
"BatchTracker",
|
|
48
|
+
"BundleError",
|
|
49
|
+
"CallIdMinter",
|
|
50
|
+
"CallRecord",
|
|
51
|
+
"DEFAULT_HOLD_TIMEOUT_MS",
|
|
52
|
+
"Decision",
|
|
53
|
+
"DecisionEvent",
|
|
54
|
+
"DocumentError",
|
|
55
|
+
"EMPTY_DOCUMENT",
|
|
56
|
+
"Engine",
|
|
57
|
+
"EvalError",
|
|
58
|
+
"Guard",
|
|
59
|
+
"HOLD_OUTCOMES",
|
|
60
|
+
"HistoryStore",
|
|
61
|
+
"KERNEL_MODES",
|
|
62
|
+
"LoadedDocument",
|
|
63
|
+
"LoadedState",
|
|
64
|
+
"MISSING",
|
|
65
|
+
"Outcome",
|
|
66
|
+
"PreparedBundle",
|
|
67
|
+
"RunContext",
|
|
68
|
+
"SCHEMA_ID",
|
|
69
|
+
"Snapshot",
|
|
70
|
+
"UNKNOWN_TOOL_RULE",
|
|
71
|
+
"canonical_json",
|
|
72
|
+
"coerce_args",
|
|
73
|
+
"customer_view",
|
|
74
|
+
"decision_line",
|
|
75
|
+
"decode_nonfinite",
|
|
76
|
+
"dumps_line",
|
|
77
|
+
"encode_nonfinite",
|
|
78
|
+
"fmt_number",
|
|
79
|
+
"is_bundle",
|
|
80
|
+
"load_document",
|
|
81
|
+
"load_document_file",
|
|
82
|
+
"mint_call_id",
|
|
83
|
+
"normalise_result",
|
|
84
|
+
"prepare_bundle",
|
|
85
|
+
"render_sentence",
|
|
86
|
+
"serialise_line",
|
|
87
|
+
"to_json",
|
|
88
|
+
"validate_document",
|
|
89
|
+
]
|
amiril/docs/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# amiril 0.0.0.dev0: docs
|
|
2
|
+
|
|
3
|
+
These pages describe amiril 0.0.0.dev0, the version installed beside this
|
|
4
|
+
file. They were copied from the Amiril SDK repository when the package was
|
|
5
|
+
built, so they match the code you have. Where a page shows Python and
|
|
6
|
+
TypeScript side by side, this package is the Python one.
|
|
7
|
+
|
|
8
|
+
- [frameworks/adk.md](frameworks/adk.md): Get started with Amiril on Google ADK
|
|
9
|
+
- [frameworks/langgraph.md](frameworks/langgraph.md): Get started with Amiril on LangGraph
|
|
10
|
+
- [frameworks/no-framework.md](frameworks/no-framework.md): Use Amiril without a framework
|
|
11
|
+
- [frameworks/write-an-adapter.md](frameworks/write-an-adapter.md): Write an adapter for your framework
|
|
12
|
+
- [durability/langgraph.md](durability/langgraph.md): Durability on LangGraph: the restart spike
|
|
13
|
+
|
|
14
|
+
Fuller docs, for every package and the Amiril control plane: https://docs.amiril.ai/llms.txt
|