@almadar/std 16.213.0 → 16.215.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.
- package/canonical-operators.json +300 -198
- package/dist/behaviors-embeddings.hash.json +1 -1
- package/dist/index.js +222 -215
- package/dist/knob-embeddings.hash.json +1 -1
- package/dist/modules/array.js +22 -22
- package/dist/modules/behavior.js +2 -2
- package/dist/modules/browser.js +1 -1
- package/dist/modules/contract.js +6 -6
- package/dist/modules/core.js +43 -32
- package/dist/modules/data.js +7 -7
- package/dist/modules/graph.js +14 -14
- package/dist/modules/index.js +222 -215
- package/dist/modules/integration.js +1 -1
- package/dist/modules/llm.js +2 -2
- package/dist/modules/nn.js +6 -6
- package/dist/modules/object.js +11 -11
- package/dist/modules/prob.js +4 -4
- package/dist/modules/session.js +4 -4
- package/dist/modules/str.js +1 -1
- package/dist/modules/tensor.js +29 -29
- package/dist/modules/time.js +17 -17
- package/dist/modules/trace.js +1 -1
- package/dist/modules/train.js +23 -23
- package/dist/modules/validate.js +23 -27
- package/dist/modules/workspace.js +5 -5
- package/dist/registry.js +222 -215
- package/package.json +1 -1
package/dist/modules/array.js
CHANGED
|
@@ -186,7 +186,7 @@ var ARRAY_OPERATORS = {
|
|
|
186
186
|
{ name: "key", type: "string", description: "Field to sort by (for objects)", optional: true },
|
|
187
187
|
{ name: "dir", type: "string", description: '"asc" or "desc"', optional: true, defaultValue: "asc" }
|
|
188
188
|
],
|
|
189
|
-
example: '["array/sort", "
|
|
189
|
+
example: '["array/sort", [{"price": 3}, {"price": 9}, {"price": 5}], "price", "desc"]'
|
|
190
190
|
},
|
|
191
191
|
"array/shuffle": {
|
|
192
192
|
module: "array",
|
|
@@ -278,7 +278,7 @@ var ARRAY_OPERATORS = {
|
|
|
278
278
|
{ name: "arr", type: "array", description: "The array" },
|
|
279
279
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
280
280
|
],
|
|
281
|
-
example: '["array/find", "
|
|
281
|
+
example: '["array/find", [{"status": "active"}, {"status": "archived"}], ["fn", "x", ["=", "@x.status", "active"]]]'
|
|
282
282
|
},
|
|
283
283
|
"array/findIndex": {
|
|
284
284
|
module: "array",
|
|
@@ -294,7 +294,7 @@ var ARRAY_OPERATORS = {
|
|
|
294
294
|
{ name: "arr", type: "array", description: "The array" },
|
|
295
295
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
296
296
|
],
|
|
297
|
-
example: '["array/findIndex", "
|
|
297
|
+
example: '["array/findIndex", [{"status": "active"}, {"status": "archived"}], ["fn", "x", ["=", "@x.status", "active"]]]'
|
|
298
298
|
},
|
|
299
299
|
"array/filter": {
|
|
300
300
|
module: "array",
|
|
@@ -311,7 +311,7 @@ var ARRAY_OPERATORS = {
|
|
|
311
311
|
{ name: "arr", type: "array", description: "The array" },
|
|
312
312
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
313
313
|
],
|
|
314
|
-
example: '["array/filter", "
|
|
314
|
+
example: '["array/filter", [{"price": 50}, {"price": 150}], ["fn", "x", [">", "@x.price", 100]]]'
|
|
315
315
|
},
|
|
316
316
|
"array/reject": {
|
|
317
317
|
module: "array",
|
|
@@ -328,7 +328,7 @@ var ARRAY_OPERATORS = {
|
|
|
328
328
|
{ name: "arr", type: "array", description: "The array" },
|
|
329
329
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
330
330
|
],
|
|
331
|
-
example: '["array/reject", "
|
|
331
|
+
example: '["array/reject", [{"status": "active"}, {"status": "deleted"}], ["fn", "x", ["=", "@x.status", "deleted"]]]'
|
|
332
332
|
},
|
|
333
333
|
"array/map": {
|
|
334
334
|
module: "array",
|
|
@@ -345,7 +345,7 @@ var ARRAY_OPERATORS = {
|
|
|
345
345
|
{ name: "arr", type: "array", description: "The array" },
|
|
346
346
|
{ name: "fn", type: "lambda", description: "Transform function" }
|
|
347
347
|
],
|
|
348
|
-
example: '["array/map", "
|
|
348
|
+
example: '["array/map", [{"price": 100}, {"price": 200}], ["fn", "x", ["*", "@x.price", 1.1]]]'
|
|
349
349
|
},
|
|
350
350
|
"array/reduce": {
|
|
351
351
|
module: "array",
|
|
@@ -363,7 +363,7 @@ var ARRAY_OPERATORS = {
|
|
|
363
363
|
{ name: "init", type: "any", description: "Initial accumulator value" },
|
|
364
364
|
{ name: "fn", type: "lambda", description: "Reducer function (acc, item) => newAcc" }
|
|
365
365
|
],
|
|
366
|
-
example: '["array/reduce", "
|
|
366
|
+
example: '["array/reduce", [{"price": 10}, {"price": 25}], 0, ["fn", ["acc", "x"], ["+", "@acc", "@x.price"]]]'
|
|
367
367
|
},
|
|
368
368
|
"array/every": {
|
|
369
369
|
module: "array",
|
|
@@ -379,7 +379,7 @@ var ARRAY_OPERATORS = {
|
|
|
379
379
|
{ name: "arr", type: "array", description: "The array" },
|
|
380
380
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
381
381
|
],
|
|
382
|
-
example: '["array/every", "
|
|
382
|
+
example: '["array/every", [{"price": 5}, {"price": 10}], ["fn", "x", [">", "@x.price", 0]]]'
|
|
383
383
|
},
|
|
384
384
|
"array/some": {
|
|
385
385
|
module: "array",
|
|
@@ -395,7 +395,7 @@ var ARRAY_OPERATORS = {
|
|
|
395
395
|
{ name: "arr", type: "array", description: "The array" },
|
|
396
396
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
397
397
|
],
|
|
398
|
-
example: '["array/some", "
|
|
398
|
+
example: '["array/some", [{"status": "archived"}, {"status": "active"}], ["fn", "x", ["=", "@x.status", "active"]]]'
|
|
399
399
|
},
|
|
400
400
|
"array/count": {
|
|
401
401
|
module: "array",
|
|
@@ -411,7 +411,7 @@ var ARRAY_OPERATORS = {
|
|
|
411
411
|
{ name: "arr", type: "array", description: "The array" },
|
|
412
412
|
{ name: "pred", type: "lambda", description: "Predicate function", optional: true }
|
|
413
413
|
],
|
|
414
|
-
example: '["array/count", "
|
|
414
|
+
example: '["array/count", [{"status": "done"}, {"status": "todo"}], ["fn", "t", ["=", "@t.status", "done"]]]'
|
|
415
415
|
},
|
|
416
416
|
"array/sum": {
|
|
417
417
|
module: "array",
|
|
@@ -425,7 +425,7 @@ var ARRAY_OPERATORS = {
|
|
|
425
425
|
{ name: "arr", type: "array", description: "The array" },
|
|
426
426
|
{ name: "key", type: "string", description: "Field to sum", optional: true }
|
|
427
427
|
],
|
|
428
|
-
example: '["array/sum", "
|
|
428
|
+
example: '["array/sum", [{"price": 10}, {"price": 25}], "price"]'
|
|
429
429
|
},
|
|
430
430
|
"array/avg": {
|
|
431
431
|
module: "array",
|
|
@@ -439,7 +439,7 @@ var ARRAY_OPERATORS = {
|
|
|
439
439
|
{ name: "arr", type: "array", description: "The array" },
|
|
440
440
|
{ name: "key", type: "string", description: "Field to average", optional: true }
|
|
441
441
|
],
|
|
442
|
-
example: '["array/avg", "
|
|
442
|
+
example: '["array/avg", [{"score": 80}, {"score": 90}], "score"]'
|
|
443
443
|
},
|
|
444
444
|
"array/min": {
|
|
445
445
|
module: "array",
|
|
@@ -453,7 +453,7 @@ var ARRAY_OPERATORS = {
|
|
|
453
453
|
{ name: "arr", type: "array", description: "The array" },
|
|
454
454
|
{ name: "key", type: "string", description: "Field to compare", optional: true }
|
|
455
455
|
],
|
|
456
|
-
example: '["array/min", "
|
|
456
|
+
example: '["array/min", [{"price": 3}, {"price": 9}], "price"]'
|
|
457
457
|
},
|
|
458
458
|
"array/max": {
|
|
459
459
|
module: "array",
|
|
@@ -467,7 +467,7 @@ var ARRAY_OPERATORS = {
|
|
|
467
467
|
{ name: "arr", type: "array", description: "The array" },
|
|
468
468
|
{ name: "key", type: "string", description: "Field to compare", optional: true }
|
|
469
469
|
],
|
|
470
|
-
example: '["array/max", "
|
|
470
|
+
example: '["array/max", [{"price": 3}, {"price": 9}], "price"]'
|
|
471
471
|
},
|
|
472
472
|
"array/groupBy": {
|
|
473
473
|
module: "array",
|
|
@@ -481,7 +481,7 @@ var ARRAY_OPERATORS = {
|
|
|
481
481
|
{ name: "arr", type: "array", description: "The array" },
|
|
482
482
|
{ name: "key", type: "string", description: "Field to group by" }
|
|
483
483
|
],
|
|
484
|
-
example: '["array/groupBy", "
|
|
484
|
+
example: '["array/groupBy", [{"status": "new"}, {"status": "done"}], "status"]'
|
|
485
485
|
},
|
|
486
486
|
"array/partition": {
|
|
487
487
|
module: "array",
|
|
@@ -497,7 +497,7 @@ var ARRAY_OPERATORS = {
|
|
|
497
497
|
{ name: "arr", type: "array", description: "The array" },
|
|
498
498
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
499
499
|
],
|
|
500
|
-
example: '["array/partition", "
|
|
500
|
+
example: '["array/partition", [{"price": 30}, {"price": 80}], ["fn", "x", [">", "@x.price", 50]]]'
|
|
501
501
|
},
|
|
502
502
|
"array/take": {
|
|
503
503
|
module: "array",
|
|
@@ -511,7 +511,7 @@ var ARRAY_OPERATORS = {
|
|
|
511
511
|
{ name: "arr", type: "array", description: "The array" },
|
|
512
512
|
{ name: "n", type: "number", description: "Number of elements" }
|
|
513
513
|
],
|
|
514
|
-
example: '["array/take",
|
|
514
|
+
example: '["array/take", [1, 2, 3, 4, 5, 6, 7], 5]'
|
|
515
515
|
},
|
|
516
516
|
"array/drop": {
|
|
517
517
|
module: "array",
|
|
@@ -525,7 +525,7 @@ var ARRAY_OPERATORS = {
|
|
|
525
525
|
{ name: "arr", type: "array", description: "The array" },
|
|
526
526
|
{ name: "n", type: "number", description: "Number of elements to skip" }
|
|
527
527
|
],
|
|
528
|
-
example: '["array/drop",
|
|
528
|
+
example: '["array/drop", [1, 2, 3, 4, 5, 6, 7], 5]'
|
|
529
529
|
},
|
|
530
530
|
"array/takeLast": {
|
|
531
531
|
module: "array",
|
|
@@ -539,7 +539,7 @@ var ARRAY_OPERATORS = {
|
|
|
539
539
|
{ name: "arr", type: "array", description: "The array" },
|
|
540
540
|
{ name: "n", type: "number", description: "Number of elements" }
|
|
541
541
|
],
|
|
542
|
-
example: '["array/takeLast",
|
|
542
|
+
example: '["array/takeLast", [1, 2, 3, 4, 5], 3]'
|
|
543
543
|
},
|
|
544
544
|
"array/dropLast": {
|
|
545
545
|
module: "array",
|
|
@@ -553,7 +553,7 @@ var ARRAY_OPERATORS = {
|
|
|
553
553
|
{ name: "arr", type: "array", description: "The array" },
|
|
554
554
|
{ name: "n", type: "number", description: "Number of elements to skip" }
|
|
555
555
|
],
|
|
556
|
-
example: '["array/dropLast",
|
|
556
|
+
example: '["array/dropLast", [1, 2, 3, 4, 5], 2]'
|
|
557
557
|
},
|
|
558
558
|
"array/cosine": {
|
|
559
559
|
module: "array",
|
|
@@ -567,7 +567,7 @@ var ARRAY_OPERATORS = {
|
|
|
567
567
|
{ name: "a", type: { kind: "array", of: "number" }, description: "First vector" },
|
|
568
568
|
{ name: "b", type: { kind: "array", of: "number" }, description: "Second vector" }
|
|
569
569
|
],
|
|
570
|
-
example: '["array/cosine",
|
|
570
|
+
example: '["array/cosine", [1, 0], [0, 1]]'
|
|
571
571
|
},
|
|
572
572
|
"array/nearest": {
|
|
573
573
|
module: "array",
|
|
@@ -581,7 +581,7 @@ var ARRAY_OPERATORS = {
|
|
|
581
581
|
{ name: "query", type: { kind: "array", of: "number" }, description: "Query vector" },
|
|
582
582
|
{ name: "candidates", type: { kind: "array", of: { kind: "array", of: "number" } }, description: "Candidate vectors to search" }
|
|
583
583
|
],
|
|
584
|
-
example: '["array/nearest",
|
|
584
|
+
example: '["array/nearest", [1, 0], [[1, 0], [0, 1]]]'
|
|
585
585
|
}
|
|
586
586
|
};
|
|
587
587
|
function getArrayOperators() {
|
package/dist/modules/behavior.js
CHANGED
|
@@ -35,7 +35,7 @@ var BEHAVIOR_OPERATORS = {
|
|
|
35
35
|
{ name: "orbitalName", type: "string", description: "Canonical orbital name to instantiate" },
|
|
36
36
|
{ name: "overrides", type: { kind: "object", fields: { linkedEntity: "string", method: "string" }, open: true }, description: "Override surface: linkedEntity, events, config, fields", optional: true }
|
|
37
37
|
],
|
|
38
|
-
example: '["behavior/instantiate", "std-ecommerce", "ProductOrbital", { linkedEntity: "Product" }]'
|
|
38
|
+
example: '["behavior/instantiate", "std-ecommerce", "ProductOrbital", { "linkedEntity": "Product" }]'
|
|
39
39
|
},
|
|
40
40
|
"behavior/call": {
|
|
41
41
|
module: "behavior",
|
|
@@ -65,7 +65,7 @@ var BEHAVIOR_OPERATORS = {
|
|
|
65
65
|
{ name: "palette", type: { kind: "object", fields: { topics: { kind: "array", of: "string" }, hints: { kind: "array", of: "string" } } }, description: "Topic-tree palette + primitive hints" },
|
|
66
66
|
{ name: "deltaPrompt", type: "string", description: "Per-orbital instruction prompt" }
|
|
67
67
|
],
|
|
68
|
-
example: '["lolo/emit-body", "PlayerOrbital", { topics: ["game/2d"] }, "player ship with movement"]'
|
|
68
|
+
example: '["lolo/emit-body", "PlayerOrbital", { "topics": ["game/2d"] }, "player ship with movement"]'
|
|
69
69
|
},
|
|
70
70
|
"validate/validate": {
|
|
71
71
|
module: "behavior",
|
package/dist/modules/browser.js
CHANGED
|
@@ -69,7 +69,7 @@ var BROWSER_OPERATORS = {
|
|
|
69
69
|
kind: "custom",
|
|
70
70
|
produces: "string"
|
|
71
71
|
},
|
|
72
|
-
example: '["browser/clipboard-write", "
|
|
72
|
+
example: '["browser/clipboard-write", "https://example.com/invite/abc", { "emit": { "success": "COPIED", "failure": "COPY_DENIED" } }]'
|
|
73
73
|
},
|
|
74
74
|
"browser/push-subscribe": {
|
|
75
75
|
module: "browser",
|
package/dist/modules/contract.js
CHANGED
|
@@ -15,7 +15,7 @@ var CONTRACT_OPERATORS = {
|
|
|
15
15
|
{ name: "tensor", type: "tensor", description: "Input tensor" },
|
|
16
16
|
{ name: "contract", type: "object", description: "Input contract spec" }
|
|
17
17
|
],
|
|
18
|
-
example: '["contract/validate-input",
|
|
18
|
+
example: '["contract/validate-input", [0.5, 0.7], {"ranges": {"0": {"min": 0, "max": 1}, "1": {"min": 0, "max": 1}}}]'
|
|
19
19
|
},
|
|
20
20
|
"contract/validate-output": {
|
|
21
21
|
module: "contract",
|
|
@@ -29,7 +29,7 @@ var CONTRACT_OPERATORS = {
|
|
|
29
29
|
{ name: "tensor", type: "tensor", description: "Output tensor" },
|
|
30
30
|
{ name: "contract", type: "object", description: "Output contract spec" }
|
|
31
31
|
],
|
|
32
|
-
example: '["contract/validate-output",
|
|
32
|
+
example: '["contract/validate-output", [0.5, 0.7], {"ranges": {"0": {"min": 0, "max": 1}, "1": {"min": 0, "max": 1}}}]'
|
|
33
33
|
},
|
|
34
34
|
"contract/clamp-output": {
|
|
35
35
|
module: "contract",
|
|
@@ -43,7 +43,7 @@ var CONTRACT_OPERATORS = {
|
|
|
43
43
|
{ name: "tensor", type: "tensor", description: "Output tensor" },
|
|
44
44
|
{ name: "contract", type: "object", description: "Output contract spec" }
|
|
45
45
|
],
|
|
46
|
-
example: '["contract/clamp-output",
|
|
46
|
+
example: '["contract/clamp-output", [0.5, 1.7], {"ranges": {"0": {"min": 0, "max": 1}, "1": {"min": 0, "max": 1}}}]'
|
|
47
47
|
},
|
|
48
48
|
"contract/violations": {
|
|
49
49
|
module: "contract",
|
|
@@ -57,7 +57,7 @@ var CONTRACT_OPERATORS = {
|
|
|
57
57
|
{ name: "tensor", type: "tensor", description: "Tensor to check" },
|
|
58
58
|
{ name: "contract", type: "object", description: "Contract spec" }
|
|
59
59
|
],
|
|
60
|
-
example: '["contract/violations",
|
|
60
|
+
example: '["contract/violations", [0.5, 1.7], {"ranges": {"0": {"min": 0, "max": 1}, "1": {"min": 0, "max": 1}}}]'
|
|
61
61
|
},
|
|
62
62
|
// ============================================================================
|
|
63
63
|
// Conversion
|
|
@@ -74,7 +74,7 @@ var CONTRACT_OPERATORS = {
|
|
|
74
74
|
{ name: "entity", type: "object", description: "Entity data" },
|
|
75
75
|
{ name: "contract", type: "object", description: "Input contract mapping fields to dims" }
|
|
76
76
|
],
|
|
77
|
-
example: '["contract/entity-to-tensor", "
|
|
77
|
+
example: '["contract/entity-to-tensor", {"price": 10, "qty": 2}, {"fields": ["price", "qty"]}]'
|
|
78
78
|
},
|
|
79
79
|
"contract/tensor-to-payload": {
|
|
80
80
|
module: "contract",
|
|
@@ -88,7 +88,7 @@ var CONTRACT_OPERATORS = {
|
|
|
88
88
|
{ name: "tensor", type: "tensor", description: "Output tensor" },
|
|
89
89
|
{ name: "contract", type: "object", description: "Output contract mapping dims to fields" }
|
|
90
90
|
],
|
|
91
|
-
example: '["contract/tensor-to-payload",
|
|
91
|
+
example: '["contract/tensor-to-payload", [0.5, 0.7], {"fields": ["price", "qty"]}]'
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
function getContractOperators() {
|
package/dist/modules/core.js
CHANGED
|
@@ -117,7 +117,7 @@ var CORE_OPERATORS = {
|
|
|
117
117
|
{ name: "a", type: ANY, description: "Left operand" },
|
|
118
118
|
{ name: "b", type: ANY, description: "Right operand" }
|
|
119
119
|
],
|
|
120
|
-
example: '["=", "
|
|
120
|
+
example: '["=", "active", "active"]'
|
|
121
121
|
},
|
|
122
122
|
"==": {
|
|
123
123
|
module: "core",
|
|
@@ -131,7 +131,7 @@ var CORE_OPERATORS = {
|
|
|
131
131
|
{ name: "a", type: ANY, description: "Left operand" },
|
|
132
132
|
{ name: "b", type: ANY, description: "Right operand" }
|
|
133
133
|
],
|
|
134
|
-
example: '["==", "
|
|
134
|
+
example: '["==", "active", "active"]'
|
|
135
135
|
},
|
|
136
136
|
"!=": {
|
|
137
137
|
module: "core",
|
|
@@ -145,7 +145,7 @@ var CORE_OPERATORS = {
|
|
|
145
145
|
{ name: "a", type: ANY, description: "Left operand" },
|
|
146
146
|
{ name: "b", type: ANY, description: "Right operand" }
|
|
147
147
|
],
|
|
148
|
-
example: '["!=",
|
|
148
|
+
example: '["!=", 1, null]'
|
|
149
149
|
},
|
|
150
150
|
"<": {
|
|
151
151
|
module: "core",
|
|
@@ -159,7 +159,7 @@ var CORE_OPERATORS = {
|
|
|
159
159
|
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
160
160
|
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
161
161
|
],
|
|
162
|
-
example: '["<",
|
|
162
|
+
example: '["<", 5, 10]'
|
|
163
163
|
},
|
|
164
164
|
">": {
|
|
165
165
|
module: "core",
|
|
@@ -173,7 +173,7 @@ var CORE_OPERATORS = {
|
|
|
173
173
|
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
174
174
|
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
175
175
|
],
|
|
176
|
-
example: '[">",
|
|
176
|
+
example: '[">", 10, 0]'
|
|
177
177
|
},
|
|
178
178
|
"<=": {
|
|
179
179
|
module: "core",
|
|
@@ -187,7 +187,7 @@ var CORE_OPERATORS = {
|
|
|
187
187
|
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
188
188
|
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
189
189
|
],
|
|
190
|
-
example: '["<=",
|
|
190
|
+
example: '["<=", 100, 100]'
|
|
191
191
|
},
|
|
192
192
|
">=": {
|
|
193
193
|
module: "core",
|
|
@@ -201,7 +201,7 @@ var CORE_OPERATORS = {
|
|
|
201
201
|
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
202
202
|
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
203
203
|
],
|
|
204
|
-
example: '[">=",
|
|
204
|
+
example: '[">=", 18, 18]'
|
|
205
205
|
},
|
|
206
206
|
// --- logic ------------------------------------------------------------------
|
|
207
207
|
and: {
|
|
@@ -214,7 +214,7 @@ var CORE_OPERATORS = {
|
|
|
214
214
|
returnType: "boolean",
|
|
215
215
|
returnSemantics: "last-truthy-of-args",
|
|
216
216
|
params: [{ name: "...conds", type: BOOLEAN, description: "Boolean expressions to AND" }],
|
|
217
|
-
example: '["and", ["=", "
|
|
217
|
+
example: '["and", ["=", "active", "active"], [">", 5, 0]]'
|
|
218
218
|
},
|
|
219
219
|
or: {
|
|
220
220
|
module: "core",
|
|
@@ -226,7 +226,7 @@ var CORE_OPERATORS = {
|
|
|
226
226
|
returnType: "boolean",
|
|
227
227
|
returnSemantics: "first-truthy-of-args",
|
|
228
228
|
params: [{ name: "...conds", type: BOOLEAN, description: "Boolean expressions to OR" }],
|
|
229
|
-
example: '["or", ["=", "
|
|
229
|
+
example: '["or", ["=", "admin", "user"], ["=", "admin", "owner"]]'
|
|
230
230
|
},
|
|
231
231
|
not: {
|
|
232
232
|
module: "core",
|
|
@@ -237,7 +237,7 @@ var CORE_OPERATORS = {
|
|
|
237
237
|
hasSideEffects: false,
|
|
238
238
|
returnType: "boolean",
|
|
239
239
|
params: [{ name: "cond", type: BOOLEAN, description: "Boolean to negate" }],
|
|
240
|
-
example: '["not",
|
|
240
|
+
example: '["not", false]'
|
|
241
241
|
},
|
|
242
242
|
if: {
|
|
243
243
|
module: "core",
|
|
@@ -253,7 +253,7 @@ var CORE_OPERATORS = {
|
|
|
253
253
|
{ name: "then", type: ANY, description: "Value or effect if true" },
|
|
254
254
|
{ name: "else", type: ANY, description: "Value or effect if false" }
|
|
255
255
|
],
|
|
256
|
-
example: '["if", [">",
|
|
256
|
+
example: '["if", [">", 5, 0], "alive", "dead"]'
|
|
257
257
|
},
|
|
258
258
|
// --- control ----------------------------------------------------------------
|
|
259
259
|
let: {
|
|
@@ -361,7 +361,7 @@ var CORE_OPERATORS = {
|
|
|
361
361
|
{ name: "event", type: EVENT_KEY, description: "Event key" },
|
|
362
362
|
{ name: "payload", type: ENTITY_REF, description: "Optional payload", optional: true }
|
|
363
363
|
],
|
|
364
|
-
example: '["emit", "PLAYER_DIED", { "playerId": "
|
|
364
|
+
example: '["emit", "PLAYER_DIED", { "playerId": "p1" }]',
|
|
365
365
|
effect: {
|
|
366
366
|
kind: "emit",
|
|
367
367
|
produces: {
|
|
@@ -396,7 +396,7 @@ var CORE_OPERATORS = {
|
|
|
396
396
|
optional: true
|
|
397
397
|
}
|
|
398
398
|
],
|
|
399
|
-
example: '["persist", "create", "Task", { "title": "
|
|
399
|
+
example: '["persist", "create", "Task", { "title": "Buy milk" }, { "emit": { "success": "TASK_CREATED" } }]',
|
|
400
400
|
effect: {
|
|
401
401
|
kind: "persist",
|
|
402
402
|
// Action-discriminated union. The compiler narrows at the call site
|
|
@@ -450,7 +450,7 @@ var CORE_OPERATORS = {
|
|
|
450
450
|
optional: true
|
|
451
451
|
}
|
|
452
452
|
],
|
|
453
|
-
example: '["navigate", "/tasks/:id", { "id": "
|
|
453
|
+
example: '["navigate", "/tasks/:id", { "id": "t1" }]',
|
|
454
454
|
effect: { kind: "navigate" }
|
|
455
455
|
},
|
|
456
456
|
"navigate-back": {
|
|
@@ -507,7 +507,7 @@ var CORE_OPERATORS = {
|
|
|
507
507
|
optional: true
|
|
508
508
|
}
|
|
509
509
|
],
|
|
510
|
-
example: '["spawn", "Bullet", { "x":
|
|
510
|
+
example: '["spawn", "Bullet", { "x": 10, "y": 20 }]',
|
|
511
511
|
effect: { kind: "spawn" }
|
|
512
512
|
},
|
|
513
513
|
despawn: {
|
|
@@ -552,18 +552,22 @@ var CORE_OPERATORS = {
|
|
|
552
552
|
optional: true
|
|
553
553
|
}
|
|
554
554
|
],
|
|
555
|
-
example: '["fetch", "Task", { "id": "
|
|
555
|
+
example: '["fetch", "Task", { "id": "t1", "emit": { "success": "TASK_LOADED" } }]',
|
|
556
556
|
effect: {
|
|
557
557
|
kind: "fetch",
|
|
558
|
-
// Call-site-discriminated union: options.id present -> single entity;
|
|
559
|
-
// otherwise -> array of entity. The compiler narrows at the call site
|
|
560
|
-
// when checking emit.success against the declared event payload.
|
|
561
558
|
produces: {
|
|
562
|
-
kind: "
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
559
|
+
kind: "object",
|
|
560
|
+
fields: {
|
|
561
|
+
data: {
|
|
562
|
+
kind: "union",
|
|
563
|
+
of: [
|
|
564
|
+
{ kind: "entity" },
|
|
565
|
+
{ kind: "array", of: { kind: "entity" } }
|
|
566
|
+
]
|
|
567
|
+
},
|
|
568
|
+
totalCount: "number"
|
|
569
|
+
},
|
|
570
|
+
open: false
|
|
567
571
|
}
|
|
568
572
|
}
|
|
569
573
|
},
|
|
@@ -615,7 +619,7 @@ var CORE_OPERATORS = {
|
|
|
615
619
|
optional: true
|
|
616
620
|
}
|
|
617
621
|
],
|
|
618
|
-
example: '["send-server", "CHAT_MESSAGE", { "text": "
|
|
622
|
+
example: '["send-server", "CHAT_MESSAGE", { "text": "hello" }]',
|
|
619
623
|
effect: { kind: "send-server" }
|
|
620
624
|
},
|
|
621
625
|
ref: {
|
|
@@ -647,14 +651,21 @@ var CORE_OPERATORS = {
|
|
|
647
651
|
example: '["ref", "Task"]',
|
|
648
652
|
effect: {
|
|
649
653
|
kind: "ref",
|
|
650
|
-
// Same
|
|
654
|
+
// Same wrapper fetch emits. Kept for the V2 transition period;
|
|
651
655
|
// scheduled for deprecation in a later phase (see Almadar_Entity_V2_Plan.md).
|
|
652
656
|
produces: {
|
|
653
|
-
kind: "
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
657
|
+
kind: "object",
|
|
658
|
+
fields: {
|
|
659
|
+
data: {
|
|
660
|
+
kind: "union",
|
|
661
|
+
of: [
|
|
662
|
+
{ kind: "entity" },
|
|
663
|
+
{ kind: "array", of: { kind: "entity" } }
|
|
664
|
+
]
|
|
665
|
+
},
|
|
666
|
+
totalCount: "number"
|
|
667
|
+
},
|
|
668
|
+
open: false
|
|
658
669
|
}
|
|
659
670
|
}
|
|
660
671
|
},
|
|
@@ -682,7 +693,7 @@ var CORE_OPERATORS = {
|
|
|
682
693
|
optional: true
|
|
683
694
|
}
|
|
684
695
|
],
|
|
685
|
-
example: '["call-service", "llm", "generate", { "userPrompt": "
|
|
696
|
+
example: '["call-service", "llm", "generate", { "userPrompt": "Hello" }, { "emit": { "success": "LlmCompleted", "failure": "LlmFailed" } }]',
|
|
686
697
|
effect: {
|
|
687
698
|
kind: "call-service",
|
|
688
699
|
// TODO(entity-v2): narrow to the declared service return type once
|
package/dist/modules/data.js
CHANGED
|
@@ -15,7 +15,7 @@ var DATA_OPERATORS = {
|
|
|
15
15
|
{ name: "entities", type: "array", description: "Entity collection" },
|
|
16
16
|
{ name: "contracts", type: "object", description: "Input/output contract pair" }
|
|
17
17
|
],
|
|
18
|
-
example: '["data/dataset", "
|
|
18
|
+
example: '["data/dataset", [{"x": 1, "y": 2}], {"input": {"fields": ["x"]}, "output": {"fields": ["y"]}}]'
|
|
19
19
|
},
|
|
20
20
|
"data/dataloader": {
|
|
21
21
|
module: "data",
|
|
@@ -29,7 +29,7 @@ var DATA_OPERATORS = {
|
|
|
29
29
|
{ name: "dataset", type: "object", description: "Dataset" },
|
|
30
30
|
{ name: "config", type: "object", description: "Config with batch_size, shuffle, etc." }
|
|
31
31
|
],
|
|
32
|
-
example: '["data/dataloader", "
|
|
32
|
+
example: '["data/dataloader", ["data/dataset", [[1, 2], [3, 4], [5, 6]], {}], { "batch-size": 2, "shuffle": true }]'
|
|
33
33
|
},
|
|
34
34
|
"data/split": {
|
|
35
35
|
module: "data",
|
|
@@ -43,7 +43,7 @@ var DATA_OPERATORS = {
|
|
|
43
43
|
{ name: "dataset", type: "object", description: "Dataset" },
|
|
44
44
|
{ name: "config", type: "object", description: "Split config, e.g. { trainRatio: 0.8 }" }
|
|
45
45
|
],
|
|
46
|
-
example: '["data/split", "
|
|
46
|
+
example: '["data/split", ["data/dataset", [1, 2, 3, 4, 5], {}], { "trainRatio": 0.8 }]'
|
|
47
47
|
},
|
|
48
48
|
// ============================================================================
|
|
49
49
|
// Preprocessing
|
|
@@ -60,7 +60,7 @@ var DATA_OPERATORS = {
|
|
|
60
60
|
{ name: "tensor", type: "tensor", description: "Feature tensor" },
|
|
61
61
|
{ name: "config", type: "object", description: "Normalization config (method, per_dim, etc.)" }
|
|
62
62
|
],
|
|
63
|
-
example: '["data/normalize",
|
|
63
|
+
example: '["data/normalize", [[1, 2], [3, 4]], { "method": "standard" }]'
|
|
64
64
|
},
|
|
65
65
|
"data/augment": {
|
|
66
66
|
module: "data",
|
|
@@ -74,7 +74,7 @@ var DATA_OPERATORS = {
|
|
|
74
74
|
{ name: "dataset", type: "object", description: "Dataset" },
|
|
75
75
|
{ name: "config", type: "object", description: "Augmentation config" }
|
|
76
76
|
],
|
|
77
|
-
example: '["data/augment",
|
|
77
|
+
example: '["data/augment", [[1.0, 2.0], [3.0, 4.0]], { "flip": true, "rotate": 15 }]'
|
|
78
78
|
},
|
|
79
79
|
// ============================================================================
|
|
80
80
|
// Tokenization & Padding
|
|
@@ -91,7 +91,7 @@ var DATA_OPERATORS = {
|
|
|
91
91
|
{ name: "text", type: "string", description: "Text to tokenize" },
|
|
92
92
|
{ name: "config", type: "object", description: "Tokenizer config (method, vocab_size, max_length)" }
|
|
93
93
|
],
|
|
94
|
-
example: '["data/tokenize", "
|
|
94
|
+
example: '["data/tokenize", "hello world", { "method": "bpe", "max-length": 512 }]'
|
|
95
95
|
},
|
|
96
96
|
"data/pad": {
|
|
97
97
|
module: "data",
|
|
@@ -105,7 +105,7 @@ var DATA_OPERATORS = {
|
|
|
105
105
|
{ name: "sequences", type: "array", description: "List of token sequences" },
|
|
106
106
|
{ name: "config", type: "object", description: "Padding config (max_length, pad_value)" }
|
|
107
107
|
],
|
|
108
|
-
example: '["data/pad",
|
|
108
|
+
example: '["data/pad", [[1, 2, 3], [4, 5]], { "max-length": 4, "pad-value": 0 }]'
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
function getDataOperators() {
|