@infernetprotocol/liquid-agent 0.0.0-stage → 0.1.66

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.
Files changed (58) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +15 -2
  3. package/fixtures/contract.json +6 -0
  4. package/fixtures/invalid/episode-extra-field.json +275 -0
  5. package/fixtures/invalid/episode-no-capture.json +265 -0
  6. package/fixtures/invalid/episode-unknown-action.json +274 -0
  7. package/fixtures/invalid/model-manifest-bad-hash.json +92 -0
  8. package/fixtures/invalid/predict-negative-seq.json +48 -0
  9. package/fixtures/invalid/proposal-bad-abstain.json +31 -0
  10. package/fixtures/invalid/proposal-confidence-range.json +31 -0
  11. package/fixtures/invalid/session-bad-seq.json +17 -0
  12. package/fixtures/invalid/train-job-bad-family.json +44 -0
  13. package/fixtures/invalid/train-job-zero-lr.json +44 -0
  14. package/fixtures/valid/action-proposal.json +27 -0
  15. package/fixtures/valid/dataset-bundle.json +3747 -0
  16. package/fixtures/valid/dataset-manifest.json +126 -0
  17. package/fixtures/valid/episode.json +270 -0
  18. package/fixtures/valid/inference-session.json +13 -0
  19. package/fixtures/valid/model-manifest.json +88 -0
  20. package/fixtures/valid/predict-request.json +44 -0
  21. package/fixtures/valid/train-job.json +40 -0
  22. package/package.json +28 -3
  23. package/runtime/infernet_liquid/__init__.py +6 -0
  24. package/runtime/infernet_liquid/__main__.py +95 -0
  25. package/runtime/infernet_liquid/bench.py +125 -0
  26. package/runtime/infernet_liquid/bundle.py +63 -0
  27. package/runtime/infernet_liquid/canonical.py +75 -0
  28. package/runtime/infernet_liquid/data.py +121 -0
  29. package/runtime/infernet_liquid/errors.py +13 -0
  30. package/runtime/infernet_liquid/evaluate.py +145 -0
  31. package/runtime/infernet_liquid/export.py +136 -0
  32. package/runtime/infernet_liquid/features.py +105 -0
  33. package/runtime/infernet_liquid/models.py +63 -0
  34. package/runtime/infernet_liquid/schema.py +155 -0
  35. package/runtime/infernet_liquid/secretscan.py +64 -0
  36. package/runtime/infernet_liquid/server.py +251 -0
  37. package/runtime/infernet_liquid/sessions.py +279 -0
  38. package/runtime/infernet_liquid/synth.py +194 -0
  39. package/runtime/infernet_liquid/train.py +136 -0
  40. package/runtime/pyproject.toml +14 -0
  41. package/runtime/requirements-cuda.lock +461 -0
  42. package/runtime/requirements.lock +344 -0
  43. package/schemas/action-proposal.schema.json +40 -0
  44. package/schemas/common.schema.json +88 -0
  45. package/schemas/dataset-bundle.schema.json +15 -0
  46. package/schemas/dataset-manifest.schema.json +100 -0
  47. package/schemas/episode.schema.json +71 -0
  48. package/schemas/inference-session.schema.json +23 -0
  49. package/schemas/model-manifest.schema.json +103 -0
  50. package/schemas/predict-request.schema.json +20 -0
  51. package/schemas/train-job.schema.json +75 -0
  52. package/src/canonical.js +49 -0
  53. package/src/contract.js +62 -0
  54. package/src/dataset.js +133 -0
  55. package/src/index.js +13 -0
  56. package/src/runtime.js +206 -0
  57. package/src/secrets.js +79 -0
  58. package/src/validate.js +161 -0
@@ -0,0 +1,274 @@
1
+ {
2
+ "kind": "episode",
3
+ "value": {
4
+ "capture": {
5
+ "app_scope": [
6
+ "mail"
7
+ ],
8
+ "consent_id": "synthetic",
9
+ "device_local": true,
10
+ "redaction_profile": "strict",
11
+ "source": "synthetic"
12
+ },
13
+ "content_hash": "sha256:252f9609047a61f694e0bba93740e561277ed10a59372fb7a6f8f7dc8a118e13",
14
+ "created_at": "2026-10-25T12:00:00Z",
15
+ "episode_id": "ep_syn_email_3_0000",
16
+ "kind": "episode",
17
+ "labels": {
18
+ "goal": "Reply to the unread message and save the reply as a draft",
19
+ "reviewed": true,
20
+ "risk": "low",
21
+ "success": true
22
+ },
23
+ "schema_version": "liquid-agent/v1",
24
+ "split_group": "email-s0",
25
+ "steps": [
26
+ {
27
+ "action": {
28
+ "target": {
29
+ "name": "Inbox",
30
+ "role": "link"
31
+ },
32
+ "type": "teleport"
33
+ },
34
+ "observation": {
35
+ "app": "mail",
36
+ "elements": [
37
+ {
38
+ "name": "Calendar",
39
+ "role": "link"
40
+ },
41
+ {
42
+ "name": "Drafts",
43
+ "role": "link"
44
+ },
45
+ {
46
+ "name": "Spam",
47
+ "role": "link"
48
+ },
49
+ {
50
+ "name": "Settings",
51
+ "role": "link"
52
+ },
53
+ {
54
+ "name": "Sent",
55
+ "role": "link"
56
+ },
57
+ {
58
+ "name": "Compose",
59
+ "role": "button"
60
+ },
61
+ {
62
+ "name": "Inbox",
63
+ "role": "link"
64
+ }
65
+ ],
66
+ "url_pattern": "mail://home"
67
+ },
68
+ "result": {
69
+ "status": "ok"
70
+ },
71
+ "t_ms": 0
72
+ },
73
+ {
74
+ "action": {
75
+ "target": {
76
+ "name": "Unread · From Ari: Contract draft",
77
+ "role": "row"
78
+ },
79
+ "type": "click"
80
+ },
81
+ "observation": {
82
+ "app": "mail",
83
+ "elements": [
84
+ {
85
+ "name": "From Jo: Lunch?",
86
+ "role": "row"
87
+ },
88
+ {
89
+ "name": "From Dana: Re: roadmap",
90
+ "role": "row"
91
+ },
92
+ {
93
+ "name": "Unread · From Ari: Contract draft",
94
+ "role": "row"
95
+ },
96
+ {
97
+ "name": "From Noor: Team offsite",
98
+ "role": "row"
99
+ },
100
+ {
101
+ "name": "Compose",
102
+ "role": "button"
103
+ },
104
+ {
105
+ "name": "Inbox",
106
+ "role": "link"
107
+ }
108
+ ],
109
+ "url_pattern": "mail://inbox"
110
+ },
111
+ "result": {
112
+ "status": "ok"
113
+ },
114
+ "t_ms": 664
115
+ },
116
+ {
117
+ "action": {
118
+ "target": {
119
+ "name": "Reply",
120
+ "role": "button"
121
+ },
122
+ "type": "click"
123
+ },
124
+ "observation": {
125
+ "app": "mail",
126
+ "elements": [
127
+ {
128
+ "name": "Delete",
129
+ "role": "button"
130
+ },
131
+ {
132
+ "name": "Mark unread",
133
+ "role": "button"
134
+ },
135
+ {
136
+ "name": "Reply",
137
+ "role": "button"
138
+ },
139
+ {
140
+ "name": "Forward",
141
+ "role": "button"
142
+ },
143
+ {
144
+ "name": "Archive",
145
+ "role": "button"
146
+ },
147
+ {
148
+ "name": "From Ari",
149
+ "role": "text"
150
+ }
151
+ ],
152
+ "url_pattern": "mail://message"
153
+ },
154
+ "result": {
155
+ "status": "ok"
156
+ },
157
+ "t_ms": 1878
158
+ },
159
+ {
160
+ "action": {
161
+ "target": {
162
+ "name": "Message body",
163
+ "role": "textbox"
164
+ },
165
+ "text_redacted": true,
166
+ "type": "type"
167
+ },
168
+ "observation": {
169
+ "app": "mail",
170
+ "elements": [
171
+ {
172
+ "name": "Save draft",
173
+ "role": "button"
174
+ },
175
+ {
176
+ "name": "Message body",
177
+ "role": "textbox"
178
+ },
179
+ {
180
+ "name": "Send",
181
+ "role": "button"
182
+ },
183
+ {
184
+ "name": "Discard",
185
+ "role": "button"
186
+ },
187
+ {
188
+ "name": "Attach",
189
+ "role": "button"
190
+ }
191
+ ],
192
+ "focus": {
193
+ "name": "Message body",
194
+ "role": "textbox"
195
+ },
196
+ "url_pattern": "mail://compose"
197
+ },
198
+ "result": {
199
+ "status": "ok"
200
+ },
201
+ "t_ms": 2516
202
+ },
203
+ {
204
+ "action": {
205
+ "target": {
206
+ "name": "Save draft",
207
+ "role": "button"
208
+ },
209
+ "type": "click"
210
+ },
211
+ "observation": {
212
+ "app": "mail",
213
+ "elements": [
214
+ {
215
+ "name": "Save draft",
216
+ "role": "button"
217
+ },
218
+ {
219
+ "name": "Message body",
220
+ "role": "textbox"
221
+ },
222
+ {
223
+ "name": "Send",
224
+ "role": "button"
225
+ },
226
+ {
227
+ "name": "Discard",
228
+ "role": "button"
229
+ },
230
+ {
231
+ "name": "Attach",
232
+ "role": "button"
233
+ }
234
+ ],
235
+ "focus": {
236
+ "name": "Message body",
237
+ "role": "textbox"
238
+ },
239
+ "url_pattern": "mail://compose"
240
+ },
241
+ "result": {
242
+ "status": "ok"
243
+ },
244
+ "t_ms": 8648
245
+ },
246
+ {
247
+ "action": {
248
+ "type": "done"
249
+ },
250
+ "observation": {
251
+ "app": "mail",
252
+ "elements": [
253
+ {
254
+ "name": "Draft saved",
255
+ "role": "text"
256
+ },
257
+ {
258
+ "name": "Inbox",
259
+ "role": "link"
260
+ }
261
+ ],
262
+ "url_pattern": "mail://compose"
263
+ },
264
+ "result": {
265
+ "status": "ok"
266
+ },
267
+ "t_ms": 9161
268
+ }
269
+ ],
270
+ "task": "email.reply_draft",
271
+ "variant": "v0"
272
+ },
273
+ "why": "action type outside the enum"
274
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "kind": "model_manifest",
3
+ "value": {
4
+ "architecture": {
5
+ "backbone_units": 64,
6
+ "family": "cfc",
7
+ "feature_dim": 64,
8
+ "hidden_units": 16,
9
+ "params": 16095,
10
+ "research": false
11
+ },
12
+ "created_at": "2026-10-26T07:22:09.542Z",
13
+ "eval": {
14
+ "episodes": 4,
15
+ "metrics": {
16
+ "action_accuracy": 0.375,
17
+ "episode_success": 0.0,
18
+ "episodes": 4,
19
+ "external_write_recall": 1.0,
20
+ "latency_ms_p50": 0.0744,
21
+ "latency_ms_p95": 0.1179,
22
+ "step_accuracy": 0.125,
23
+ "steps": 24,
24
+ "target_accuracy": 0.25
25
+ },
26
+ "split": "validation"
27
+ },
28
+ "input_schema": {
29
+ "encoding": "hashed-bag/v1",
30
+ "feature_dim": 64,
31
+ "tasks": [
32
+ "email.reply_draft",
33
+ "linkedin.notifications_review",
34
+ "reddit.post_compose"
35
+ ],
36
+ "time_delta": "log1p_seconds"
37
+ },
38
+ "kind": "model_manifest",
39
+ "license": "UNLICENSED-private",
40
+ "manifest_hash": "sha256:69709bf527cc061bd780ea428d571f1f140d573999fca3bb2a7e77338e3bd6f9",
41
+ "model_id": "lm_f4daee3297421b91",
42
+ "output_schema": {
43
+ "action_types": [
44
+ "click",
45
+ "double_click",
46
+ "type",
47
+ "key",
48
+ "scroll",
49
+ "navigate",
50
+ "select",
51
+ "focus",
52
+ "wait",
53
+ "submit",
54
+ "send",
55
+ "post",
56
+ "publish",
57
+ "delete",
58
+ "done"
59
+ ],
60
+ "targets": [
61
+ "pointer:visible-elements"
62
+ ]
63
+ },
64
+ "runtime": {
65
+ "lock_hash": "sha256:682b7a9c048b1e899e82eac2b5cb0437607ea6bce8528eb330a72b96aa936b96",
66
+ "name": "infernet-liquid",
67
+ "ncps": "1.0.1",
68
+ "python": "3.12.13",
69
+ "torch": "2.14.1+cpu",
70
+ "version": "0.1.0"
71
+ },
72
+ "schema_version": "liquid-agent/v1",
73
+ "training": {
74
+ "dataset_hash": "sha256:dce2e7d70920e254b3b04e633dd2ad1383f41d592e2d79506fb42e0c9336c6ec",
75
+ "device": "cpu",
76
+ "epochs": 2,
77
+ "finished_at": "2026-10-26T07:22:09.535Z",
78
+ "learning_rate": 0.005,
79
+ "seed": 0,
80
+ "started_at": "2026-10-26T07:22:09.509Z",
81
+ "train_job_id": "tj_fixture_0001",
82
+ "train_seconds": 0.026
83
+ },
84
+ "weights": {
85
+ "file": "model.safetensors",
86
+ "format": "safetensors",
87
+ "size_bytes": 65836,
88
+ "weights_hash": "md5:abc"
89
+ }
90
+ },
91
+ "why": "weights_hash must be sha256:<64 hex>"
92
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "kind": "predict_request",
3
+ "value": {
4
+ "dt_ms": 0,
5
+ "kind": "predict_request",
6
+ "model_hash": "sha256:f4daee3297421b9155d7cb0e198c10f21911cfe38d10f4ff3adec9a401d5ba6d",
7
+ "observation": {
8
+ "app": "mail",
9
+ "elements": [
10
+ {
11
+ "name": "Calendar",
12
+ "role": "link"
13
+ },
14
+ {
15
+ "name": "Drafts",
16
+ "role": "link"
17
+ },
18
+ {
19
+ "name": "Spam",
20
+ "role": "link"
21
+ },
22
+ {
23
+ "name": "Settings",
24
+ "role": "link"
25
+ },
26
+ {
27
+ "name": "Sent",
28
+ "role": "link"
29
+ },
30
+ {
31
+ "name": "Compose",
32
+ "role": "button"
33
+ },
34
+ {
35
+ "name": "Inbox",
36
+ "role": "link"
37
+ }
38
+ ],
39
+ "url_pattern": "mail://home"
40
+ },
41
+ "prev_action": null,
42
+ "schema_version": "liquid-agent/v1",
43
+ "sequence_index": -1,
44
+ "session_id": "sess-fixture-1",
45
+ "task": "email.reply_draft"
46
+ },
47
+ "why": "request sequence_index minimum 0"
48
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "kind": "action_proposal",
3
+ "value": {
4
+ "abstain_reason": "felt_like_it",
5
+ "action": {
6
+ "target": {
7
+ "name": "Post",
8
+ "role": "button"
9
+ },
10
+ "type": "post"
11
+ },
12
+ "alternatives": [
13
+ {
14
+ "action": {
15
+ "type": "wait"
16
+ },
17
+ "p": 0.05
18
+ }
19
+ ],
20
+ "confidence": 0.91,
21
+ "kind": "action_proposal",
22
+ "latency_ms": 0.2,
23
+ "model_hash": "sha256:f4daee3297421b9155d7cb0e198c10f21911cfe38d10f4ff3adec9a401d5ba6d",
24
+ "requires_approval": true,
25
+ "schema_version": "liquid-agent/v1",
26
+ "sequence_index": 3,
27
+ "session_id": "sess-fixture-1",
28
+ "uncertainty": 0.12
29
+ },
30
+ "why": "abstain_reason enum"
31
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "kind": "action_proposal",
3
+ "value": {
4
+ "abstain_reason": null,
5
+ "action": {
6
+ "target": {
7
+ "name": "Post",
8
+ "role": "button"
9
+ },
10
+ "type": "post"
11
+ },
12
+ "alternatives": [
13
+ {
14
+ "action": {
15
+ "type": "wait"
16
+ },
17
+ "p": 0.05
18
+ }
19
+ ],
20
+ "confidence": 1.5,
21
+ "kind": "action_proposal",
22
+ "latency_ms": 0.2,
23
+ "model_hash": "sha256:f4daee3297421b9155d7cb0e198c10f21911cfe38d10f4ff3adec9a401d5ba6d",
24
+ "requires_approval": true,
25
+ "schema_version": "liquid-agent/v1",
26
+ "sequence_index": 3,
27
+ "session_id": "sess-fixture-1",
28
+ "uncertainty": 0.12
29
+ },
30
+ "why": "confidence maximum 1"
31
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "kind": "inference_session",
3
+ "value": {
4
+ "checkpoint_ref": null,
5
+ "created_at": "2026-10-25T12:00:00.000Z",
6
+ "expires_at": "2026-10-25T12:10:00.000Z",
7
+ "kind": "inference_session",
8
+ "model_hash": "sha256:f4daee3297421b9155d7cb0e198c10f21911cfe38d10f4ff3adec9a401d5ba6d",
9
+ "schema_version": "liquid-agent/v1",
10
+ "sequence_index": -2,
11
+ "session_id": "sess-fixture-1",
12
+ "state": "active",
13
+ "ttl_s": 600,
14
+ "worker": "local"
15
+ },
16
+ "why": "sequence_index minimum -1"
17
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "kind": "train_job",
3
+ "value": {
4
+ "baselines": [
5
+ "gru"
6
+ ],
7
+ "created_at": "2026-10-25T12:00:00Z",
8
+ "dataset_hash": "sha256:dce2e7d70920e254b3b04e633dd2ad1383f41d592e2d79506fb42e0c9336c6ec",
9
+ "dataset_ref": "dataset-bundle.json",
10
+ "hyperparameters": {
11
+ "batch_size": 8,
12
+ "epochs": 2,
13
+ "feature_dim": 64,
14
+ "hidden_units": 16,
15
+ "learning_rate": 0.005,
16
+ "seed": 0
17
+ },
18
+ "idempotency_key": "fixture-0001-idem",
19
+ "job_id": "tj_fixture_0001",
20
+ "kind": "train_job",
21
+ "limits": {
22
+ "max_budget_usd": 0,
23
+ "max_retries": 1,
24
+ "timeout_s": 600
25
+ },
26
+ "model_type": "transformer",
27
+ "privacy": {
28
+ "mode": "local_only",
29
+ "upload_approved": false
30
+ },
31
+ "resources": {
32
+ "device": "cpu",
33
+ "gpu_required": false,
34
+ "max_threads": 2,
35
+ "min_ram_mb": 512
36
+ },
37
+ "retention": {
38
+ "artifact_days": 30,
39
+ "delete_dataset_after": true
40
+ },
41
+ "schema_version": "liquid-agent/v1"
42
+ },
43
+ "why": "model_type must be cfc, ltc or gru"
44
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "kind": "train_job",
3
+ "value": {
4
+ "baselines": [
5
+ "gru"
6
+ ],
7
+ "created_at": "2026-10-25T12:00:00Z",
8
+ "dataset_hash": "sha256:dce2e7d70920e254b3b04e633dd2ad1383f41d592e2d79506fb42e0c9336c6ec",
9
+ "dataset_ref": "dataset-bundle.json",
10
+ "hyperparameters": {
11
+ "batch_size": 8,
12
+ "epochs": 2,
13
+ "feature_dim": 64,
14
+ "hidden_units": 16,
15
+ "learning_rate": 0,
16
+ "seed": 0
17
+ },
18
+ "idempotency_key": "fixture-0001-idem",
19
+ "job_id": "tj_fixture_0001",
20
+ "kind": "train_job",
21
+ "limits": {
22
+ "max_budget_usd": 0,
23
+ "max_retries": 1,
24
+ "timeout_s": 600
25
+ },
26
+ "model_type": "cfc",
27
+ "privacy": {
28
+ "mode": "local_only",
29
+ "upload_approved": false
30
+ },
31
+ "resources": {
32
+ "device": "cpu",
33
+ "gpu_required": false,
34
+ "max_threads": 2,
35
+ "min_ram_mb": 512
36
+ },
37
+ "retention": {
38
+ "artifact_days": 30,
39
+ "delete_dataset_after": true
40
+ },
41
+ "schema_version": "liquid-agent/v1"
42
+ },
43
+ "why": "learning_rate exclusiveMinimum 0"
44
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "abstain_reason": null,
3
+ "action": {
4
+ "target": {
5
+ "name": "Post",
6
+ "role": "button"
7
+ },
8
+ "type": "post"
9
+ },
10
+ "alternatives": [
11
+ {
12
+ "action": {
13
+ "type": "wait"
14
+ },
15
+ "p": 0.05
16
+ }
17
+ ],
18
+ "confidence": 0.91,
19
+ "kind": "action_proposal",
20
+ "latency_ms": 0.2,
21
+ "model_hash": "sha256:f4daee3297421b9155d7cb0e198c10f21911cfe38d10f4ff3adec9a401d5ba6d",
22
+ "requires_approval": true,
23
+ "schema_version": "liquid-agent/v1",
24
+ "sequence_index": 3,
25
+ "session_id": "sess-fixture-1",
26
+ "uncertainty": 0.12
27
+ }