@almadar/std 16.144.0 → 16.145.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.
Files changed (91) hide show
  1. package/behaviors/lolo/ml/atoms/std-ml-classify.lolo +121 -0
  2. package/behaviors/lolo/ml/atoms/std-ml-exact-check.lolo +90 -0
  3. package/behaviors/lolo/ml/atoms/std-ml-infer.lolo +141 -0
  4. package/behaviors/lolo/ml/atoms/std-ml-label-capture.lolo +75 -0
  5. package/behaviors/lolo/ml/atoms/std-ml-lookup.lolo +83 -0
  6. package/behaviors/lolo/ml/atoms/std-ml-posterior.lolo +104 -0
  7. package/behaviors/lolo/ml/atoms/std-ml-similarity.lolo +154 -0
  8. package/behaviors/lolo/ml/molecules/std-escalating-decision.lolo +271 -0
  9. package/behaviors/lolo/ml/molecules/std-knowledge-tracing.lolo +115 -0
  10. package/behaviors/lolo/ui/core/atoms/std-board.lolo +20 -6
  11. package/behaviors/lolo/ui/core/atoms/std-browse.lolo +23 -6
  12. package/behaviors/lolo/ui/core/atoms/std-calendar.lolo +80 -2
  13. package/behaviors/lolo/ui/core/atoms/ui-typography.lolo +1 -1
  14. package/behaviors/lolo/ui/core/molecules/ui-calendar-grid.lolo +18 -0
  15. package/behaviors/lolo/ui/core/molecules/ui-data-grid.lolo +2 -0
  16. package/behaviors/lolo/ui/core/molecules/ui-data-list.lolo +3 -2
  17. package/behaviors/lolo/ui/core/molecules/ui-filter-group.lolo +20 -0
  18. package/behaviors/lolo/ui/core/molecules/ui-search-input.lolo +7 -2
  19. package/behaviors/lolo/ui/core/molecules/ui-table-view.lolo +3 -2
  20. package/behaviors/lolo/ui/core/organisms/ui-entity-cards.lolo +2 -0
  21. package/behaviors/lolo/ui/core/organisms/ui-entity-list.lolo +2 -0
  22. package/behaviors/lolo/ui/core/organisms/ui-entity-table.lolo +2 -0
  23. package/behaviors/lolo/ui/core/organisms/ui-timeline.lolo +2 -0
  24. package/behaviors/registry/factory-signatures.json +5018 -824
  25. package/behaviors/registry/ml/atoms/std-ml-classify.orb +622 -0
  26. package/behaviors/registry/ml/atoms/std-ml-exact-check.orb +505 -0
  27. package/behaviors/registry/ml/atoms/std-ml-infer.orb +770 -0
  28. package/behaviors/registry/ml/atoms/std-ml-label-capture.orb +367 -0
  29. package/behaviors/registry/ml/atoms/std-ml-lookup.orb +473 -0
  30. package/behaviors/registry/ml/atoms/std-ml-posterior.orb +669 -0
  31. package/behaviors/registry/ml/atoms/std-ml-similarity.orb +862 -0
  32. package/behaviors/registry/ml/molecules/std-escalating-decision.orb +1553 -0
  33. package/behaviors/registry/ml/molecules/std-knowledge-tracing.orb +577 -0
  34. package/behaviors/registry/ui/core/atoms/std-board.orb +64 -20
  35. package/behaviors/registry/ui/core/atoms/std-browse.orb +83 -48
  36. package/behaviors/registry/ui/core/atoms/std-calendar.orb +213 -3
  37. package/behaviors/registry/ui/core/atoms/ui-typography.orb +1 -1
  38. package/behaviors/registry/ui/core/molecules/ui-calendar-grid.orb +27 -0
  39. package/behaviors/registry/ui/core/molecules/ui-data-grid.orb +25 -12
  40. package/behaviors/registry/ui/core/molecules/ui-data-list.orb +26 -13
  41. package/behaviors/registry/ui/core/molecules/ui-filter-group.orb +86 -0
  42. package/behaviors/registry/ui/core/molecules/ui-search-input.orb +37 -1
  43. package/behaviors/registry/ui/core/molecules/ui-table-view.orb +25 -12
  44. package/behaviors/registry/ui/core/organisms/ui-entity-cards.orb +13 -0
  45. package/behaviors/registry/ui/core/organisms/ui-entity-list.orb +21 -8
  46. package/behaviors/registry/ui/core/organisms/ui-entity-table.orb +13 -0
  47. package/behaviors/registry/ui/core/organisms/ui-timeline.orb +13 -0
  48. package/canonical-operators.json +30 -6
  49. package/dist/behaviors/behaviors-embeddings.json +134 -134
  50. package/dist/behaviors/exports-reader.js +2462 -2080
  51. package/dist/behaviors/functions/index.d.ts +725 -1
  52. package/dist/behaviors/functions/index.js +2437 -2081
  53. package/dist/behaviors/index.d.ts +1 -1
  54. package/dist/behaviors/index.js +2463 -2081
  55. package/dist/behaviors/knob-embeddings.json +1 -1
  56. package/dist/behaviors/query.js +2462 -2080
  57. package/dist/behaviors/registry/factory-signatures.json +5018 -824
  58. package/dist/behaviors/registry/ml/atoms/std-ml-classify.orb +622 -0
  59. package/dist/behaviors/registry/ml/atoms/std-ml-exact-check.orb +505 -0
  60. package/dist/behaviors/registry/ml/atoms/std-ml-infer.orb +770 -0
  61. package/dist/behaviors/registry/ml/atoms/std-ml-label-capture.orb +367 -0
  62. package/dist/behaviors/registry/ml/atoms/std-ml-lookup.orb +473 -0
  63. package/dist/behaviors/registry/ml/atoms/std-ml-posterior.orb +669 -0
  64. package/dist/behaviors/registry/ml/atoms/std-ml-similarity.orb +862 -0
  65. package/dist/behaviors/registry/ml/molecules/std-escalating-decision.orb +1553 -0
  66. package/dist/behaviors/registry/ml/molecules/std-knowledge-tracing.orb +577 -0
  67. package/dist/behaviors/registry/ui/core/atoms/std-board.orb +64 -20
  68. package/dist/behaviors/registry/ui/core/atoms/std-browse.orb +83 -48
  69. package/dist/behaviors/registry/ui/core/atoms/std-calendar.orb +213 -3
  70. package/dist/behaviors/registry/ui/core/atoms/ui-typography.orb +1 -1
  71. package/dist/behaviors/registry/ui/core/molecules/ui-calendar-grid.orb +27 -0
  72. package/dist/behaviors/registry/ui/core/molecules/ui-data-grid.orb +25 -12
  73. package/dist/behaviors/registry/ui/core/molecules/ui-data-list.orb +26 -13
  74. package/dist/behaviors/registry/ui/core/molecules/ui-filter-group.orb +86 -0
  75. package/dist/behaviors/registry/ui/core/molecules/ui-search-input.orb +37 -1
  76. package/dist/behaviors/registry/ui/core/molecules/ui-table-view.orb +25 -12
  77. package/dist/behaviors/registry/ui/core/organisms/ui-entity-cards.orb +13 -0
  78. package/dist/behaviors/registry/ui/core/organisms/ui-entity-list.orb +21 -8
  79. package/dist/behaviors/registry/ui/core/organisms/ui-entity-table.orb +13 -0
  80. package/dist/behaviors/registry/ui/core/organisms/ui-timeline.orb +13 -0
  81. package/dist/behaviors-embeddings.json +134 -134
  82. package/dist/index.d.ts +1 -1
  83. package/dist/index.js +2498 -2088
  84. package/dist/knob-embeddings.json +1 -1
  85. package/dist/modules/array.js +28 -0
  86. package/dist/modules/contract.js +4 -4
  87. package/dist/modules/data.js +3 -3
  88. package/dist/modules/index.js +35 -7
  89. package/dist/registry/factory-signatures.json +5018 -824
  90. package/dist/registry.js +35 -7
  91. package/package.json +3 -3
@@ -0,0 +1,862 @@
1
+ {
2
+ "description": "Retrieval rung (R3) — embed a candidate against references and gate on cosine floor + margin; abstains when not confident.",
3
+ "ledger": {
4
+ "entries": {
5
+ "ent_01KYBN0QT9997QBWPF6WFF1CMM": {
6
+ "bakedName": "SimilarityComparison",
7
+ "curName": "SimilarityComparison",
8
+ "id": "ent_01KYBN0QT9997QBWPF6WFF1CMM",
9
+ "kind": "entity",
10
+ "owner": "workspace",
11
+ "renames": []
12
+ },
13
+ "evt_01KYBN0QT9A6WZFFTCVGBHF2BT": {
14
+ "bakedName": "RESET",
15
+ "curName": "RESET",
16
+ "id": "evt_01KYBN0QT9A6WZFFTCVGBHF2BT",
17
+ "kind": "event",
18
+ "owner": "workspace",
19
+ "parent": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
20
+ "renames": []
21
+ },
22
+ "evt_01KYBN0QT9ACZNZH01MYKGTXYX": {
23
+ "bakedName": "EMBED_FAILED",
24
+ "curName": "EMBED_FAILED",
25
+ "id": "evt_01KYBN0QT9ACZNZH01MYKGTXYX",
26
+ "kind": "event",
27
+ "owner": "workspace",
28
+ "parent": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
29
+ "renames": []
30
+ },
31
+ "evt_01KYBN0QT9FX93HBXP52KRNVX6": {
32
+ "bakedName": "COMPARE",
33
+ "curName": "COMPARE",
34
+ "id": "evt_01KYBN0QT9FX93HBXP52KRNVX6",
35
+ "kind": "event",
36
+ "owner": "workspace",
37
+ "parent": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
38
+ "renames": []
39
+ },
40
+ "evt_01KYBN0QT9K8NXCX7AMQ2VTNWX": {
41
+ "bakedName": "SIMILARITY_ABSTAINED",
42
+ "curName": "SIMILARITY_ABSTAINED",
43
+ "id": "evt_01KYBN0QT9K8NXCX7AMQ2VTNWX",
44
+ "kind": "event",
45
+ "owner": "workspace",
46
+ "parent": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
47
+ "renames": []
48
+ },
49
+ "evt_01KYBN0QT9KC3AMM14E9M55ACF": {
50
+ "bakedName": "SIMILARITY_MATCHED",
51
+ "curName": "SIMILARITY_MATCHED",
52
+ "id": "evt_01KYBN0QT9KC3AMM14E9M55ACF",
53
+ "kind": "event",
54
+ "owner": "workspace",
55
+ "parent": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
56
+ "renames": []
57
+ },
58
+ "evt_01KYBN0QT9WZDN3FMC3T36ACHS": {
59
+ "bakedName": "EMBEDDED",
60
+ "curName": "EMBEDDED",
61
+ "id": "evt_01KYBN0QT9WZDN3FMC3T36ACHS",
62
+ "kind": "event",
63
+ "owner": "workspace",
64
+ "parent": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
65
+ "renames": []
66
+ },
67
+ "evt_01KYBN0QT9ZTTW50RCT84MH8H1": {
68
+ "bakedName": "INIT",
69
+ "curName": "INIT",
70
+ "id": "evt_01KYBN0QT9ZTTW50RCT84MH8H1",
71
+ "kind": "event",
72
+ "owner": "workspace",
73
+ "parent": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
74
+ "renames": []
75
+ },
76
+ "orb_01KYBN0QT97QXM5727TNZZSS1B": {
77
+ "bakedName": "MlSimilarityOrbital",
78
+ "curName": "MlSimilarityOrbital",
79
+ "id": "orb_01KYBN0QT97QXM5727TNZZSS1B",
80
+ "kind": "orbital",
81
+ "owner": "workspace",
82
+ "renames": []
83
+ },
84
+ "pag_01KYBN0QT9YB0Q6ZEZWC560YEN": {
85
+ "bakedName": "MlSimilarityPage",
86
+ "curName": "MlSimilarityPage",
87
+ "id": "pag_01KYBN0QT9YB0Q6ZEZWC560YEN",
88
+ "kind": "page",
89
+ "owner": "workspace",
90
+ "renames": []
91
+ },
92
+ "trt_01KYBN0QT9C1SZTVGAG9X3YA5X": {
93
+ "bakedName": "SimilarityRun",
94
+ "curName": "SimilarityRun",
95
+ "id": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
96
+ "kind": "trait",
97
+ "owner": "workspace",
98
+ "renames": []
99
+ }
100
+ },
101
+ "schemaVersion": 1
102
+ },
103
+ "name": "std-ml-similarity",
104
+ "orbitals": [
105
+ {
106
+ "entity": {
107
+ "fields": [
108
+ {
109
+ "default": "",
110
+ "name": "query",
111
+ "type": "string"
112
+ },
113
+ {
114
+ "default": [],
115
+ "items": {
116
+ "type": "string"
117
+ },
118
+ "name": "candidates",
119
+ "type": "array"
120
+ },
121
+ {
122
+ "default": [],
123
+ "items": {
124
+ "items": {
125
+ "type": "number"
126
+ },
127
+ "type": "array"
128
+ },
129
+ "name": "embeddings",
130
+ "type": "array"
131
+ },
132
+ {
133
+ "default": [],
134
+ "items": {
135
+ "type": "number"
136
+ },
137
+ "name": "queryVector",
138
+ "type": "array"
139
+ },
140
+ {
141
+ "default": [],
142
+ "items": {
143
+ "items": {
144
+ "type": "number"
145
+ },
146
+ "type": "array"
147
+ },
148
+ "name": "candidateVectors",
149
+ "type": "array"
150
+ },
151
+ {
152
+ "default": 0.0,
153
+ "name": "matchIndex",
154
+ "type": "number"
155
+ },
156
+ {
157
+ "default": 0.0,
158
+ "name": "matchScore",
159
+ "type": "number"
160
+ },
161
+ {
162
+ "default": 0.0,
163
+ "name": "matchMargin",
164
+ "type": "number"
165
+ },
166
+ {
167
+ "default": "",
168
+ "name": "reason",
169
+ "type": "string"
170
+ },
171
+ {
172
+ "default": {},
173
+ "name": "request",
174
+ "type": "object"
175
+ },
176
+ {
177
+ "default": "idle",
178
+ "name": "status",
179
+ "type": "string",
180
+ "values": [
181
+ "idle",
182
+ "embedding",
183
+ "resolved"
184
+ ]
185
+ }
186
+ ],
187
+ "id": "ent_01KYBN0QT9997QBWPF6WFF1CMM",
188
+ "name": "SimilarityComparison",
189
+ "persistence": "runtime"
190
+ },
191
+ "id": "orb_01KYBN0QT97QXM5727TNZZSS1B",
192
+ "name": "MlSimilarityOrbital",
193
+ "pages": [
194
+ {
195
+ "id": "pag_01KYBN0QT9YB0Q6ZEZWC560YEN",
196
+ "name": "MlSimilarityPage",
197
+ "path": "/ml-similarity",
198
+ "traits": [
199
+ {
200
+ "ref": "SimilarityRun",
201
+ "refId": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X"
202
+ }
203
+ ]
204
+ }
205
+ ],
206
+ "traits": [
207
+ {
208
+ "category": "lifecycle",
209
+ "config": {
210
+ "embedModel": {
211
+ "default": "",
212
+ "description": "Reserved for embedding-model selection; llm/embed takes only a texts array today, so this knob is not yet wired into the call",
213
+ "label": "Embedding model",
214
+ "tier": "infra",
215
+ "type": "string"
216
+ },
217
+ "floor": {
218
+ "default": 0.82,
219
+ "description": "Minimum cosine score for a confident match",
220
+ "label": "Match floor",
221
+ "tier": "policy",
222
+ "type": "float"
223
+ },
224
+ "margin": {
225
+ "default": 0.05,
226
+ "description": "Minimum gap between the best and second-best score required to trust the match",
227
+ "label": "Match margin",
228
+ "tier": "policy",
229
+ "type": "float"
230
+ }
231
+ },
232
+ "emits": [
233
+ {
234
+ "description": "Raw embeddings from llm/embed — query vector at index 0, candidate vectors following in input order",
235
+ "event": "EMBEDDED",
236
+ "eventId": "evt_01KYBN0QT9WZDN3FMC3T36ACHS",
237
+ "payloadSchema": [
238
+ {
239
+ "name": "result",
240
+ "required": true,
241
+ "type": "[[float]]"
242
+ }
243
+ ],
244
+ "tier": "secondary"
245
+ },
246
+ {
247
+ "description": "Candidate matched with high confidence — score at or above floor, with a clear margin over the runner-up",
248
+ "event": "SIMILARITY_MATCHED",
249
+ "eventId": "evt_01KYBN0QT9KC3AMM14E9M55ACF",
250
+ "payloadSchema": [
251
+ {
252
+ "name": "index",
253
+ "required": true,
254
+ "type": "int"
255
+ },
256
+ {
257
+ "name": "score",
258
+ "required": true,
259
+ "type": "float"
260
+ }
261
+ ],
262
+ "scope": "external",
263
+ "tier": "primary"
264
+ },
265
+ {
266
+ "description": "No confident match — reason is one of: empty candidate list, below floor, thin margin, embedding unavailable. request echoes the originating request untouched so the next rung can project its own inputs out of it",
267
+ "event": "SIMILARITY_ABSTAINED",
268
+ "eventId": "evt_01KYBN0QT9K8NXCX7AMQ2VTNWX",
269
+ "payloadSchema": [
270
+ {
271
+ "name": "reason",
272
+ "required": true,
273
+ "type": "string"
274
+ },
275
+ {
276
+ "name": "request",
277
+ "type": "object"
278
+ }
279
+ ],
280
+ "scope": "external",
281
+ "tier": "primary"
282
+ }
283
+ ],
284
+ "entityRefIds": {
285
+ "SimilarityComparison": "ent_01KYBN0QT9997QBWPF6WFF1CMM"
286
+ },
287
+ "id": "trt_01KYBN0QT9C1SZTVGAG9X3YA5X",
288
+ "linkedEntity": "SimilarityComparison",
289
+ "linkedEntityId": "ent_01KYBN0QT9997QBWPF6WFF1CMM",
290
+ "name": "SimilarityRun",
291
+ "scope": "instance",
292
+ "stateMachine": {
293
+ "events": [
294
+ {
295
+ "id": "evt_01KYBN0QT9ZTTW50RCT84MH8H1",
296
+ "key": "INIT",
297
+ "name": "Initialize"
298
+ },
299
+ {
300
+ "id": "evt_01KYBN0QT9FX93HBXP52KRNVX6",
301
+ "key": "COMPARE",
302
+ "name": "Compare",
303
+ "payloadSchema": [
304
+ {
305
+ "name": "query",
306
+ "required": true,
307
+ "type": "string"
308
+ },
309
+ {
310
+ "name": "candidates",
311
+ "required": true,
312
+ "type": "[string]"
313
+ },
314
+ {
315
+ "name": "request",
316
+ "type": "object"
317
+ }
318
+ ]
319
+ },
320
+ {
321
+ "description": "Raw embeddings from llm/embed — query vector at index 0, candidate vectors following in input order",
322
+ "id": "evt_01KYBN0QT9WZDN3FMC3T36ACHS",
323
+ "key": "EMBEDDED",
324
+ "name": "Embedded",
325
+ "payloadSchema": [
326
+ {
327
+ "name": "result",
328
+ "required": true,
329
+ "type": "[[float]]"
330
+ }
331
+ ],
332
+ "tier": "secondary"
333
+ },
334
+ {
335
+ "id": "evt_01KYBN0QT9ACZNZH01MYKGTXYX",
336
+ "key": "EMBED_FAILED",
337
+ "name": "Embed Failed"
338
+ },
339
+ {
340
+ "id": "evt_01KYBN0QT9A6WZFFTCVGBHF2BT",
341
+ "key": "RESET",
342
+ "name": "Reset"
343
+ },
344
+ {
345
+ "description": "Candidate matched with high confidence — score at or above floor, with a clear margin over the runner-up",
346
+ "id": "evt_01KYBN0QT9KC3AMM14E9M55ACF",
347
+ "key": "SIMILARITY_MATCHED",
348
+ "name": "Similarity Matched",
349
+ "payloadSchema": [
350
+ {
351
+ "name": "index",
352
+ "required": true,
353
+ "type": "int"
354
+ },
355
+ {
356
+ "name": "score",
357
+ "required": true,
358
+ "type": "float"
359
+ }
360
+ ],
361
+ "tier": "primary"
362
+ },
363
+ {
364
+ "description": "No confident match — reason is one of: empty candidate list, below floor, thin margin, embedding unavailable. request echoes the originating request untouched so the next rung can project its own inputs out of it",
365
+ "id": "evt_01KYBN0QT9K8NXCX7AMQ2VTNWX",
366
+ "key": "SIMILARITY_ABSTAINED",
367
+ "name": "Similarity Abstained",
368
+ "payloadSchema": [
369
+ {
370
+ "name": "reason",
371
+ "required": true,
372
+ "type": "string"
373
+ },
374
+ {
375
+ "name": "request",
376
+ "type": "object"
377
+ }
378
+ ],
379
+ "tier": "primary"
380
+ }
381
+ ],
382
+ "states": [
383
+ {
384
+ "isInitial": true,
385
+ "name": "idle"
386
+ },
387
+ {
388
+ "name": "embedding"
389
+ },
390
+ {
391
+ "name": "resolved"
392
+ }
393
+ ],
394
+ "transitions": [
395
+ {
396
+ "effects": [
397
+ [
398
+ "set",
399
+ "@entity.query",
400
+ ""
401
+ ],
402
+ [
403
+ "set",
404
+ "@entity.candidates",
405
+ []
406
+ ],
407
+ [
408
+ "set",
409
+ "@entity.embeddings",
410
+ []
411
+ ],
412
+ [
413
+ "set",
414
+ "@entity.queryVector",
415
+ []
416
+ ],
417
+ [
418
+ "set",
419
+ "@entity.candidateVectors",
420
+ []
421
+ ],
422
+ [
423
+ "set",
424
+ "@entity.matchIndex",
425
+ 0.0
426
+ ],
427
+ [
428
+ "set",
429
+ "@entity.matchScore",
430
+ 0.0
431
+ ],
432
+ [
433
+ "set",
434
+ "@entity.matchMargin",
435
+ 0.0
436
+ ],
437
+ [
438
+ "set",
439
+ "@entity.reason",
440
+ ""
441
+ ],
442
+ [
443
+ "set",
444
+ "@entity.request",
445
+ {}
446
+ ],
447
+ [
448
+ "set",
449
+ "@entity.status",
450
+ "idle"
451
+ ]
452
+ ],
453
+ "event": "INIT",
454
+ "eventId": "evt_01KYBN0QT9ZTTW50RCT84MH8H1",
455
+ "from": "idle",
456
+ "to": "idle"
457
+ },
458
+ {
459
+ "effects": [
460
+ [
461
+ "set",
462
+ "@entity.query",
463
+ "@payload.query"
464
+ ],
465
+ [
466
+ "set",
467
+ "@entity.candidates",
468
+ "@payload.candidates"
469
+ ],
470
+ [
471
+ "set",
472
+ "@entity.request",
473
+ "@payload.request"
474
+ ],
475
+ [
476
+ "set",
477
+ "@entity.status",
478
+ "embedding"
479
+ ],
480
+ [
481
+ "llm/embed",
482
+ [
483
+ "array/prepend",
484
+ "@payload.candidates",
485
+ "@payload.query"
486
+ ],
487
+ {
488
+ "emit": {
489
+ "failure": "EMBED_FAILED",
490
+ "success": "EMBEDDED"
491
+ }
492
+ }
493
+ ]
494
+ ],
495
+ "event": "COMPARE",
496
+ "eventId": "evt_01KYBN0QT9FX93HBXP52KRNVX6",
497
+ "from": "idle",
498
+ "guard": [
499
+ ">",
500
+ [
501
+ "array/len",
502
+ "@payload.candidates"
503
+ ],
504
+ 0.0
505
+ ],
506
+ "to": "embedding"
507
+ },
508
+ {
509
+ "effects": [
510
+ [
511
+ "set",
512
+ "@entity.query",
513
+ "@payload.query"
514
+ ],
515
+ [
516
+ "set",
517
+ "@entity.candidates",
518
+ []
519
+ ],
520
+ [
521
+ "set",
522
+ "@entity.embeddings",
523
+ []
524
+ ],
525
+ [
526
+ "set",
527
+ "@entity.queryVector",
528
+ []
529
+ ],
530
+ [
531
+ "set",
532
+ "@entity.candidateVectors",
533
+ []
534
+ ],
535
+ [
536
+ "set",
537
+ "@entity.matchIndex",
538
+ 0.0
539
+ ],
540
+ [
541
+ "set",
542
+ "@entity.matchScore",
543
+ 0.0
544
+ ],
545
+ [
546
+ "set",
547
+ "@entity.matchMargin",
548
+ 0.0
549
+ ],
550
+ [
551
+ "set",
552
+ "@entity.reason",
553
+ "empty candidate list"
554
+ ],
555
+ [
556
+ "set",
557
+ "@entity.request",
558
+ "@payload.request"
559
+ ],
560
+ [
561
+ "set",
562
+ "@entity.status",
563
+ "resolved"
564
+ ],
565
+ [
566
+ "emit",
567
+ "SIMILARITY_ABSTAINED",
568
+ {
569
+ "reason": "empty candidate list",
570
+ "request": "@entity.request"
571
+ }
572
+ ]
573
+ ],
574
+ "event": "COMPARE",
575
+ "eventId": "evt_01KYBN0QT9FX93HBXP52KRNVX6",
576
+ "from": "idle",
577
+ "guard": [
578
+ "==",
579
+ [
580
+ "array/len",
581
+ "@payload.candidates"
582
+ ],
583
+ 0.0
584
+ ],
585
+ "to": "resolved"
586
+ },
587
+ {
588
+ "effects": [
589
+ [
590
+ "set",
591
+ "@entity.embeddings",
592
+ "@payload.result"
593
+ ],
594
+ [
595
+ "set",
596
+ "@entity.queryVector",
597
+ [
598
+ "array/first",
599
+ "@entity.embeddings"
600
+ ]
601
+ ],
602
+ [
603
+ "set",
604
+ "@entity.candidateVectors",
605
+ [
606
+ "array/drop",
607
+ "@entity.embeddings",
608
+ 1.0
609
+ ]
610
+ ],
611
+ [
612
+ "set",
613
+ "@entity.status",
614
+ "resolved"
615
+ ],
616
+ [
617
+ "let",
618
+ [
619
+ [
620
+ "nearest",
621
+ [
622
+ "array/nearest",
623
+ "@entity.queryVector",
624
+ "@entity.candidateVectors"
625
+ ]
626
+ ]
627
+ ],
628
+ [
629
+ "do",
630
+ [
631
+ "set",
632
+ "@entity.matchIndex",
633
+ [
634
+ "object/get",
635
+ "@nearest",
636
+ "index"
637
+ ]
638
+ ],
639
+ [
640
+ "set",
641
+ "@entity.matchScore",
642
+ [
643
+ "object/get",
644
+ "@nearest",
645
+ "score"
646
+ ]
647
+ ],
648
+ [
649
+ "set",
650
+ "@entity.matchMargin",
651
+ [
652
+ "object/get",
653
+ "@nearest",
654
+ "margin"
655
+ ]
656
+ ],
657
+ [
658
+ "if",
659
+ [
660
+ "and",
661
+ [
662
+ ">=",
663
+ "@entity.matchScore",
664
+ "@config.floor"
665
+ ],
666
+ [
667
+ ">=",
668
+ "@entity.matchMargin",
669
+ "@config.margin"
670
+ ]
671
+ ],
672
+ [
673
+ "do",
674
+ [
675
+ "set",
676
+ "@entity.reason",
677
+ ""
678
+ ],
679
+ [
680
+ "emit",
681
+ "SIMILARITY_MATCHED",
682
+ {
683
+ "index": "@entity.matchIndex",
684
+ "score": "@entity.matchScore"
685
+ }
686
+ ]
687
+ ],
688
+ [
689
+ "do",
690
+ [
691
+ "set",
692
+ "@entity.reason",
693
+ [
694
+ "if",
695
+ [
696
+ "<",
697
+ "@entity.matchScore",
698
+ "@config.floor"
699
+ ],
700
+ "below floor",
701
+ "thin margin"
702
+ ]
703
+ ],
704
+ [
705
+ "emit",
706
+ "SIMILARITY_ABSTAINED",
707
+ {
708
+ "reason": "@entity.reason",
709
+ "request": "@entity.request"
710
+ }
711
+ ]
712
+ ]
713
+ ]
714
+ ]
715
+ ]
716
+ ],
717
+ "event": "EMBEDDED",
718
+ "eventId": "evt_01KYBN0QT9WZDN3FMC3T36ACHS",
719
+ "from": "embedding",
720
+ "to": "resolved"
721
+ },
722
+ {
723
+ "effects": [
724
+ [
725
+ "set",
726
+ "@entity.embeddings",
727
+ []
728
+ ],
729
+ [
730
+ "set",
731
+ "@entity.queryVector",
732
+ []
733
+ ],
734
+ [
735
+ "set",
736
+ "@entity.candidateVectors",
737
+ []
738
+ ],
739
+ [
740
+ "set",
741
+ "@entity.matchIndex",
742
+ 0.0
743
+ ],
744
+ [
745
+ "set",
746
+ "@entity.matchScore",
747
+ 0.0
748
+ ],
749
+ [
750
+ "set",
751
+ "@entity.matchMargin",
752
+ 0.0
753
+ ],
754
+ [
755
+ "set",
756
+ "@entity.reason",
757
+ "embedding unavailable"
758
+ ],
759
+ [
760
+ "set",
761
+ "@entity.status",
762
+ "resolved"
763
+ ],
764
+ [
765
+ "emit",
766
+ "SIMILARITY_ABSTAINED",
767
+ {
768
+ "reason": "embedding unavailable",
769
+ "request": "@entity.request"
770
+ }
771
+ ]
772
+ ],
773
+ "event": "EMBED_FAILED",
774
+ "eventId": "evt_01KYBN0QT9ACZNZH01MYKGTXYX",
775
+ "from": "embedding",
776
+ "to": "resolved"
777
+ },
778
+ {
779
+ "effects": [
780
+ [
781
+ "set",
782
+ "@entity.status",
783
+ "resolved"
784
+ ]
785
+ ],
786
+ "event": "INIT",
787
+ "eventId": "evt_01KYBN0QT9ZTTW50RCT84MH8H1",
788
+ "from": "resolved",
789
+ "to": "resolved"
790
+ },
791
+ {
792
+ "effects": [
793
+ [
794
+ "set",
795
+ "@entity.query",
796
+ ""
797
+ ],
798
+ [
799
+ "set",
800
+ "@entity.candidates",
801
+ []
802
+ ],
803
+ [
804
+ "set",
805
+ "@entity.embeddings",
806
+ []
807
+ ],
808
+ [
809
+ "set",
810
+ "@entity.queryVector",
811
+ []
812
+ ],
813
+ [
814
+ "set",
815
+ "@entity.candidateVectors",
816
+ []
817
+ ],
818
+ [
819
+ "set",
820
+ "@entity.matchIndex",
821
+ 0.0
822
+ ],
823
+ [
824
+ "set",
825
+ "@entity.matchScore",
826
+ 0.0
827
+ ],
828
+ [
829
+ "set",
830
+ "@entity.matchMargin",
831
+ 0.0
832
+ ],
833
+ [
834
+ "set",
835
+ "@entity.reason",
836
+ ""
837
+ ],
838
+ [
839
+ "set",
840
+ "@entity.request",
841
+ {}
842
+ ],
843
+ [
844
+ "set",
845
+ "@entity.status",
846
+ "idle"
847
+ ]
848
+ ],
849
+ "event": "RESET",
850
+ "eventId": "evt_01KYBN0QT9A6WZFFTCVGBHF2BT",
851
+ "from": "resolved",
852
+ "to": "idle"
853
+ }
854
+ ]
855
+ }
856
+ }
857
+ ]
858
+ }
859
+ ],
860
+ "schemaVersion": 1,
861
+ "version": "1.0.0"
862
+ }