@almadar/std 16.213.0 → 16.214.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 +322 -234
- package/dist/behaviors-embeddings.hash.json +1 -1
- package/dist/index.js +197 -201
- 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 +18 -18
- package/dist/modules/data.js +7 -7
- package/dist/modules/graph.js +14 -14
- package/dist/modules/index.js +197 -201
- 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 +197 -201
- package/package.json +1 -1
package/dist/registry.js
CHANGED
|
@@ -164,7 +164,7 @@ var CORE_OPERATORS = {
|
|
|
164
164
|
{ name: "a", type: ANY, description: "Left operand" },
|
|
165
165
|
{ name: "b", type: ANY, description: "Right operand" }
|
|
166
166
|
],
|
|
167
|
-
example: '["=", "
|
|
167
|
+
example: '["=", "active", "active"]'
|
|
168
168
|
},
|
|
169
169
|
"==": {
|
|
170
170
|
module: "core",
|
|
@@ -178,7 +178,7 @@ var CORE_OPERATORS = {
|
|
|
178
178
|
{ name: "a", type: ANY, description: "Left operand" },
|
|
179
179
|
{ name: "b", type: ANY, description: "Right operand" }
|
|
180
180
|
],
|
|
181
|
-
example: '["==", "
|
|
181
|
+
example: '["==", "active", "active"]'
|
|
182
182
|
},
|
|
183
183
|
"!=": {
|
|
184
184
|
module: "core",
|
|
@@ -192,7 +192,7 @@ var CORE_OPERATORS = {
|
|
|
192
192
|
{ name: "a", type: ANY, description: "Left operand" },
|
|
193
193
|
{ name: "b", type: ANY, description: "Right operand" }
|
|
194
194
|
],
|
|
195
|
-
example: '["!=",
|
|
195
|
+
example: '["!=", 1, null]'
|
|
196
196
|
},
|
|
197
197
|
"<": {
|
|
198
198
|
module: "core",
|
|
@@ -206,7 +206,7 @@ var CORE_OPERATORS = {
|
|
|
206
206
|
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
207
207
|
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
208
208
|
],
|
|
209
|
-
example: '["<",
|
|
209
|
+
example: '["<", 5, 10]'
|
|
210
210
|
},
|
|
211
211
|
">": {
|
|
212
212
|
module: "core",
|
|
@@ -220,7 +220,7 @@ var CORE_OPERATORS = {
|
|
|
220
220
|
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
221
221
|
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
222
222
|
],
|
|
223
|
-
example: '[">",
|
|
223
|
+
example: '[">", 10, 0]'
|
|
224
224
|
},
|
|
225
225
|
"<=": {
|
|
226
226
|
module: "core",
|
|
@@ -234,7 +234,7 @@ var CORE_OPERATORS = {
|
|
|
234
234
|
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
235
235
|
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
236
236
|
],
|
|
237
|
-
example: '["<=",
|
|
237
|
+
example: '["<=", 100, 100]'
|
|
238
238
|
},
|
|
239
239
|
">=": {
|
|
240
240
|
module: "core",
|
|
@@ -248,7 +248,7 @@ var CORE_OPERATORS = {
|
|
|
248
248
|
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
249
249
|
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
250
250
|
],
|
|
251
|
-
example: '[">=",
|
|
251
|
+
example: '[">=", 18, 18]'
|
|
252
252
|
},
|
|
253
253
|
// --- logic ------------------------------------------------------------------
|
|
254
254
|
and: {
|
|
@@ -261,7 +261,7 @@ var CORE_OPERATORS = {
|
|
|
261
261
|
returnType: "boolean",
|
|
262
262
|
returnSemantics: "last-truthy-of-args",
|
|
263
263
|
params: [{ name: "...conds", type: BOOLEAN, description: "Boolean expressions to AND" }],
|
|
264
|
-
example: '["and", ["=", "
|
|
264
|
+
example: '["and", ["=", "active", "active"], [">", 5, 0]]'
|
|
265
265
|
},
|
|
266
266
|
or: {
|
|
267
267
|
module: "core",
|
|
@@ -273,7 +273,7 @@ var CORE_OPERATORS = {
|
|
|
273
273
|
returnType: "boolean",
|
|
274
274
|
returnSemantics: "first-truthy-of-args",
|
|
275
275
|
params: [{ name: "...conds", type: BOOLEAN, description: "Boolean expressions to OR" }],
|
|
276
|
-
example: '["or", ["=", "
|
|
276
|
+
example: '["or", ["=", "admin", "user"], ["=", "admin", "owner"]]'
|
|
277
277
|
},
|
|
278
278
|
not: {
|
|
279
279
|
module: "core",
|
|
@@ -284,7 +284,7 @@ var CORE_OPERATORS = {
|
|
|
284
284
|
hasSideEffects: false,
|
|
285
285
|
returnType: "boolean",
|
|
286
286
|
params: [{ name: "cond", type: BOOLEAN, description: "Boolean to negate" }],
|
|
287
|
-
example: '["not",
|
|
287
|
+
example: '["not", false]'
|
|
288
288
|
},
|
|
289
289
|
if: {
|
|
290
290
|
module: "core",
|
|
@@ -300,7 +300,7 @@ var CORE_OPERATORS = {
|
|
|
300
300
|
{ name: "then", type: ANY, description: "Value or effect if true" },
|
|
301
301
|
{ name: "else", type: ANY, description: "Value or effect if false" }
|
|
302
302
|
],
|
|
303
|
-
example: '["if", [">",
|
|
303
|
+
example: '["if", [">", 5, 0], "alive", "dead"]'
|
|
304
304
|
},
|
|
305
305
|
// --- control ----------------------------------------------------------------
|
|
306
306
|
let: {
|
|
@@ -408,7 +408,7 @@ var CORE_OPERATORS = {
|
|
|
408
408
|
{ name: "event", type: EVENT_KEY, description: "Event key" },
|
|
409
409
|
{ name: "payload", type: ENTITY_REF, description: "Optional payload", optional: true }
|
|
410
410
|
],
|
|
411
|
-
example: '["emit", "PLAYER_DIED", { "playerId": "
|
|
411
|
+
example: '["emit", "PLAYER_DIED", { "playerId": "p1" }]',
|
|
412
412
|
effect: {
|
|
413
413
|
kind: "emit",
|
|
414
414
|
produces: {
|
|
@@ -443,7 +443,7 @@ var CORE_OPERATORS = {
|
|
|
443
443
|
optional: true
|
|
444
444
|
}
|
|
445
445
|
],
|
|
446
|
-
example: '["persist", "create", "Task", { "title": "
|
|
446
|
+
example: '["persist", "create", "Task", { "title": "Buy milk" }, { "emit": { "success": "TASK_CREATED" } }]',
|
|
447
447
|
effect: {
|
|
448
448
|
kind: "persist",
|
|
449
449
|
// Action-discriminated union. The compiler narrows at the call site
|
|
@@ -497,7 +497,7 @@ var CORE_OPERATORS = {
|
|
|
497
497
|
optional: true
|
|
498
498
|
}
|
|
499
499
|
],
|
|
500
|
-
example: '["navigate", "/tasks/:id", { "id": "
|
|
500
|
+
example: '["navigate", "/tasks/:id", { "id": "t1" }]',
|
|
501
501
|
effect: { kind: "navigate" }
|
|
502
502
|
},
|
|
503
503
|
"navigate-back": {
|
|
@@ -554,7 +554,7 @@ var CORE_OPERATORS = {
|
|
|
554
554
|
optional: true
|
|
555
555
|
}
|
|
556
556
|
],
|
|
557
|
-
example: '["spawn", "Bullet", { "x":
|
|
557
|
+
example: '["spawn", "Bullet", { "x": 10, "y": 20 }]',
|
|
558
558
|
effect: { kind: "spawn" }
|
|
559
559
|
},
|
|
560
560
|
despawn: {
|
|
@@ -599,7 +599,7 @@ var CORE_OPERATORS = {
|
|
|
599
599
|
optional: true
|
|
600
600
|
}
|
|
601
601
|
],
|
|
602
|
-
example: '["fetch", "Task", { "id": "
|
|
602
|
+
example: '["fetch", "Task", { "id": "t1", "emit": { "success": "TASK_LOADED" } }]',
|
|
603
603
|
effect: {
|
|
604
604
|
kind: "fetch",
|
|
605
605
|
// Call-site-discriminated union: options.id present -> single entity;
|
|
@@ -662,7 +662,7 @@ var CORE_OPERATORS = {
|
|
|
662
662
|
optional: true
|
|
663
663
|
}
|
|
664
664
|
],
|
|
665
|
-
example: '["send-server", "CHAT_MESSAGE", { "text": "
|
|
665
|
+
example: '["send-server", "CHAT_MESSAGE", { "text": "hello" }]',
|
|
666
666
|
effect: { kind: "send-server" }
|
|
667
667
|
},
|
|
668
668
|
ref: {
|
|
@@ -729,7 +729,7 @@ var CORE_OPERATORS = {
|
|
|
729
729
|
optional: true
|
|
730
730
|
}
|
|
731
731
|
],
|
|
732
|
-
example: '["call-service", "llm", "generate", { "userPrompt": "
|
|
732
|
+
example: '["call-service", "llm", "generate", { "userPrompt": "Hello" }, { "emit": { "success": "LlmCompleted", "failure": "LlmFailed" } }]',
|
|
733
733
|
effect: {
|
|
734
734
|
kind: "call-service",
|
|
735
735
|
// TODO(entity-v2): narrow to the declared service return type once
|
|
@@ -1148,7 +1148,7 @@ var STR_OPERATORS = {
|
|
|
1148
1148
|
hasSideEffects: false,
|
|
1149
1149
|
returnType: "string",
|
|
1150
1150
|
params: [{ name: "strings", type: "string", description: "Strings to concatenate" }],
|
|
1151
|
-
example: '["str/concat", "/users/", "
|
|
1151
|
+
example: '["str/concat", "/users/", "123"] // => "/users/123"'
|
|
1152
1152
|
},
|
|
1153
1153
|
"str/upper": {
|
|
1154
1154
|
module: "str",
|
|
@@ -1663,7 +1663,7 @@ var ARRAY_OPERATORS = {
|
|
|
1663
1663
|
{ name: "key", type: "string", description: "Field to sort by (for objects)", optional: true },
|
|
1664
1664
|
{ name: "dir", type: "string", description: '"asc" or "desc"', optional: true, defaultValue: "asc" }
|
|
1665
1665
|
],
|
|
1666
|
-
example: '["array/sort", "
|
|
1666
|
+
example: '["array/sort", [{"price": 3}, {"price": 9}, {"price": 5}], "price", "desc"]'
|
|
1667
1667
|
},
|
|
1668
1668
|
"array/shuffle": {
|
|
1669
1669
|
module: "array",
|
|
@@ -1755,7 +1755,7 @@ var ARRAY_OPERATORS = {
|
|
|
1755
1755
|
{ name: "arr", type: "array", description: "The array" },
|
|
1756
1756
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
1757
1757
|
],
|
|
1758
|
-
example: '["array/find", "
|
|
1758
|
+
example: '["array/find", [{"status": "active"}, {"status": "archived"}], ["fn", "x", ["=", "@x.status", "active"]]]'
|
|
1759
1759
|
},
|
|
1760
1760
|
"array/findIndex": {
|
|
1761
1761
|
module: "array",
|
|
@@ -1771,7 +1771,7 @@ var ARRAY_OPERATORS = {
|
|
|
1771
1771
|
{ name: "arr", type: "array", description: "The array" },
|
|
1772
1772
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
1773
1773
|
],
|
|
1774
|
-
example: '["array/findIndex", "
|
|
1774
|
+
example: '["array/findIndex", [{"status": "active"}, {"status": "archived"}], ["fn", "x", ["=", "@x.status", "active"]]]'
|
|
1775
1775
|
},
|
|
1776
1776
|
"array/filter": {
|
|
1777
1777
|
module: "array",
|
|
@@ -1788,7 +1788,7 @@ var ARRAY_OPERATORS = {
|
|
|
1788
1788
|
{ name: "arr", type: "array", description: "The array" },
|
|
1789
1789
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
1790
1790
|
],
|
|
1791
|
-
example: '["array/filter", "
|
|
1791
|
+
example: '["array/filter", [{"price": 50}, {"price": 150}], ["fn", "x", [">", "@x.price", 100]]]'
|
|
1792
1792
|
},
|
|
1793
1793
|
"array/reject": {
|
|
1794
1794
|
module: "array",
|
|
@@ -1805,7 +1805,7 @@ var ARRAY_OPERATORS = {
|
|
|
1805
1805
|
{ name: "arr", type: "array", description: "The array" },
|
|
1806
1806
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
1807
1807
|
],
|
|
1808
|
-
example: '["array/reject", "
|
|
1808
|
+
example: '["array/reject", [{"status": "active"}, {"status": "deleted"}], ["fn", "x", ["=", "@x.status", "deleted"]]]'
|
|
1809
1809
|
},
|
|
1810
1810
|
"array/map": {
|
|
1811
1811
|
module: "array",
|
|
@@ -1822,7 +1822,7 @@ var ARRAY_OPERATORS = {
|
|
|
1822
1822
|
{ name: "arr", type: "array", description: "The array" },
|
|
1823
1823
|
{ name: "fn", type: "lambda", description: "Transform function" }
|
|
1824
1824
|
],
|
|
1825
|
-
example: '["array/map", "
|
|
1825
|
+
example: '["array/map", [{"price": 100}, {"price": 200}], ["fn", "x", ["*", "@x.price", 1.1]]]'
|
|
1826
1826
|
},
|
|
1827
1827
|
"array/reduce": {
|
|
1828
1828
|
module: "array",
|
|
@@ -1840,7 +1840,7 @@ var ARRAY_OPERATORS = {
|
|
|
1840
1840
|
{ name: "init", type: "any", description: "Initial accumulator value" },
|
|
1841
1841
|
{ name: "fn", type: "lambda", description: "Reducer function (acc, item) => newAcc" }
|
|
1842
1842
|
],
|
|
1843
|
-
example: '["array/reduce", "
|
|
1843
|
+
example: '["array/reduce", [{"price": 10}, {"price": 25}], 0, ["fn", ["acc", "x"], ["+", "@acc", "@x.price"]]]'
|
|
1844
1844
|
},
|
|
1845
1845
|
"array/every": {
|
|
1846
1846
|
module: "array",
|
|
@@ -1856,7 +1856,7 @@ var ARRAY_OPERATORS = {
|
|
|
1856
1856
|
{ name: "arr", type: "array", description: "The array" },
|
|
1857
1857
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
1858
1858
|
],
|
|
1859
|
-
example: '["array/every", "
|
|
1859
|
+
example: '["array/every", [{"price": 5}, {"price": 10}], ["fn", "x", [">", "@x.price", 0]]]'
|
|
1860
1860
|
},
|
|
1861
1861
|
"array/some": {
|
|
1862
1862
|
module: "array",
|
|
@@ -1872,7 +1872,7 @@ var ARRAY_OPERATORS = {
|
|
|
1872
1872
|
{ name: "arr", type: "array", description: "The array" },
|
|
1873
1873
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
1874
1874
|
],
|
|
1875
|
-
example: '["array/some", "
|
|
1875
|
+
example: '["array/some", [{"status": "archived"}, {"status": "active"}], ["fn", "x", ["=", "@x.status", "active"]]]'
|
|
1876
1876
|
},
|
|
1877
1877
|
"array/count": {
|
|
1878
1878
|
module: "array",
|
|
@@ -1888,7 +1888,7 @@ var ARRAY_OPERATORS = {
|
|
|
1888
1888
|
{ name: "arr", type: "array", description: "The array" },
|
|
1889
1889
|
{ name: "pred", type: "lambda", description: "Predicate function", optional: true }
|
|
1890
1890
|
],
|
|
1891
|
-
example: '["array/count", "
|
|
1891
|
+
example: '["array/count", [{"status": "done"}, {"status": "todo"}], ["fn", "t", ["=", "@t.status", "done"]]]'
|
|
1892
1892
|
},
|
|
1893
1893
|
"array/sum": {
|
|
1894
1894
|
module: "array",
|
|
@@ -1902,7 +1902,7 @@ var ARRAY_OPERATORS = {
|
|
|
1902
1902
|
{ name: "arr", type: "array", description: "The array" },
|
|
1903
1903
|
{ name: "key", type: "string", description: "Field to sum", optional: true }
|
|
1904
1904
|
],
|
|
1905
|
-
example: '["array/sum", "
|
|
1905
|
+
example: '["array/sum", [{"price": 10}, {"price": 25}], "price"]'
|
|
1906
1906
|
},
|
|
1907
1907
|
"array/avg": {
|
|
1908
1908
|
module: "array",
|
|
@@ -1916,7 +1916,7 @@ var ARRAY_OPERATORS = {
|
|
|
1916
1916
|
{ name: "arr", type: "array", description: "The array" },
|
|
1917
1917
|
{ name: "key", type: "string", description: "Field to average", optional: true }
|
|
1918
1918
|
],
|
|
1919
|
-
example: '["array/avg", "
|
|
1919
|
+
example: '["array/avg", [{"score": 80}, {"score": 90}], "score"]'
|
|
1920
1920
|
},
|
|
1921
1921
|
"array/min": {
|
|
1922
1922
|
module: "array",
|
|
@@ -1930,7 +1930,7 @@ var ARRAY_OPERATORS = {
|
|
|
1930
1930
|
{ name: "arr", type: "array", description: "The array" },
|
|
1931
1931
|
{ name: "key", type: "string", description: "Field to compare", optional: true }
|
|
1932
1932
|
],
|
|
1933
|
-
example: '["array/min", "
|
|
1933
|
+
example: '["array/min", [{"price": 3}, {"price": 9}], "price"]'
|
|
1934
1934
|
},
|
|
1935
1935
|
"array/max": {
|
|
1936
1936
|
module: "array",
|
|
@@ -1944,7 +1944,7 @@ var ARRAY_OPERATORS = {
|
|
|
1944
1944
|
{ name: "arr", type: "array", description: "The array" },
|
|
1945
1945
|
{ name: "key", type: "string", description: "Field to compare", optional: true }
|
|
1946
1946
|
],
|
|
1947
|
-
example: '["array/max", "
|
|
1947
|
+
example: '["array/max", [{"price": 3}, {"price": 9}], "price"]'
|
|
1948
1948
|
},
|
|
1949
1949
|
"array/groupBy": {
|
|
1950
1950
|
module: "array",
|
|
@@ -1958,7 +1958,7 @@ var ARRAY_OPERATORS = {
|
|
|
1958
1958
|
{ name: "arr", type: "array", description: "The array" },
|
|
1959
1959
|
{ name: "key", type: "string", description: "Field to group by" }
|
|
1960
1960
|
],
|
|
1961
|
-
example: '["array/groupBy", "
|
|
1961
|
+
example: '["array/groupBy", [{"status": "new"}, {"status": "done"}], "status"]'
|
|
1962
1962
|
},
|
|
1963
1963
|
"array/partition": {
|
|
1964
1964
|
module: "array",
|
|
@@ -1974,7 +1974,7 @@ var ARRAY_OPERATORS = {
|
|
|
1974
1974
|
{ name: "arr", type: "array", description: "The array" },
|
|
1975
1975
|
{ name: "pred", type: "lambda", description: "Predicate function" }
|
|
1976
1976
|
],
|
|
1977
|
-
example: '["array/partition", "
|
|
1977
|
+
example: '["array/partition", [{"price": 30}, {"price": 80}], ["fn", "x", [">", "@x.price", 50]]]'
|
|
1978
1978
|
},
|
|
1979
1979
|
"array/take": {
|
|
1980
1980
|
module: "array",
|
|
@@ -1988,7 +1988,7 @@ var ARRAY_OPERATORS = {
|
|
|
1988
1988
|
{ name: "arr", type: "array", description: "The array" },
|
|
1989
1989
|
{ name: "n", type: "number", description: "Number of elements" }
|
|
1990
1990
|
],
|
|
1991
|
-
example: '["array/take",
|
|
1991
|
+
example: '["array/take", [1, 2, 3, 4, 5, 6, 7], 5]'
|
|
1992
1992
|
},
|
|
1993
1993
|
"array/drop": {
|
|
1994
1994
|
module: "array",
|
|
@@ -2002,7 +2002,7 @@ var ARRAY_OPERATORS = {
|
|
|
2002
2002
|
{ name: "arr", type: "array", description: "The array" },
|
|
2003
2003
|
{ name: "n", type: "number", description: "Number of elements to skip" }
|
|
2004
2004
|
],
|
|
2005
|
-
example: '["array/drop",
|
|
2005
|
+
example: '["array/drop", [1, 2, 3, 4, 5, 6, 7], 5]'
|
|
2006
2006
|
},
|
|
2007
2007
|
"array/takeLast": {
|
|
2008
2008
|
module: "array",
|
|
@@ -2016,7 +2016,7 @@ var ARRAY_OPERATORS = {
|
|
|
2016
2016
|
{ name: "arr", type: "array", description: "The array" },
|
|
2017
2017
|
{ name: "n", type: "number", description: "Number of elements" }
|
|
2018
2018
|
],
|
|
2019
|
-
example: '["array/takeLast",
|
|
2019
|
+
example: '["array/takeLast", [1, 2, 3, 4, 5], 3]'
|
|
2020
2020
|
},
|
|
2021
2021
|
"array/dropLast": {
|
|
2022
2022
|
module: "array",
|
|
@@ -2030,7 +2030,7 @@ var ARRAY_OPERATORS = {
|
|
|
2030
2030
|
{ name: "arr", type: "array", description: "The array" },
|
|
2031
2031
|
{ name: "n", type: "number", description: "Number of elements to skip" }
|
|
2032
2032
|
],
|
|
2033
|
-
example: '["array/dropLast",
|
|
2033
|
+
example: '["array/dropLast", [1, 2, 3, 4, 5], 2]'
|
|
2034
2034
|
},
|
|
2035
2035
|
"array/cosine": {
|
|
2036
2036
|
module: "array",
|
|
@@ -2044,7 +2044,7 @@ var ARRAY_OPERATORS = {
|
|
|
2044
2044
|
{ name: "a", type: { kind: "array", of: "number" }, description: "First vector" },
|
|
2045
2045
|
{ name: "b", type: { kind: "array", of: "number" }, description: "Second vector" }
|
|
2046
2046
|
],
|
|
2047
|
-
example: '["array/cosine",
|
|
2047
|
+
example: '["array/cosine", [1, 0], [0, 1]]'
|
|
2048
2048
|
},
|
|
2049
2049
|
"array/nearest": {
|
|
2050
2050
|
module: "array",
|
|
@@ -2058,7 +2058,7 @@ var ARRAY_OPERATORS = {
|
|
|
2058
2058
|
{ name: "query", type: { kind: "array", of: "number" }, description: "Query vector" },
|
|
2059
2059
|
{ name: "candidates", type: { kind: "array", of: { kind: "array", of: "number" } }, description: "Candidate vectors to search" }
|
|
2060
2060
|
],
|
|
2061
|
-
example: '["array/nearest",
|
|
2061
|
+
example: '["array/nearest", [1, 0], [[1, 0], [0, 1]]]'
|
|
2062
2062
|
}
|
|
2063
2063
|
};
|
|
2064
2064
|
|
|
@@ -2122,7 +2122,7 @@ var OBJECT_OPERATORS = {
|
|
|
2122
2122
|
{ name: "path", type: "string", description: 'Dot-separated path (e.g., "user.name")' },
|
|
2123
2123
|
{ name: "default", type: "any", description: "Default if path not found", optional: true }
|
|
2124
2124
|
],
|
|
2125
|
-
example: '["object/get", "
|
|
2125
|
+
example: '["object/get", {"profile": {"name": "Ann"}}, "profile.name", "Anonymous"]'
|
|
2126
2126
|
},
|
|
2127
2127
|
"object/set": {
|
|
2128
2128
|
module: "object",
|
|
@@ -2137,7 +2137,7 @@ var OBJECT_OPERATORS = {
|
|
|
2137
2137
|
{ name: "path", type: "string", description: "Dot-separated path" },
|
|
2138
2138
|
{ name: "value", type: "any", description: "Value to set" }
|
|
2139
2139
|
],
|
|
2140
|
-
example: '["object/set", "
|
|
2140
|
+
example: '["object/set", {"profile": {"name": "Ann"}}, "profile.name", "John"]'
|
|
2141
2141
|
},
|
|
2142
2142
|
"object/has": {
|
|
2143
2143
|
module: "object",
|
|
@@ -2151,7 +2151,7 @@ var OBJECT_OPERATORS = {
|
|
|
2151
2151
|
{ name: "obj", type: "object", description: "The object" },
|
|
2152
2152
|
{ name: "path", type: "string", description: "Dot-separated path" }
|
|
2153
2153
|
],
|
|
2154
|
-
example: '["object/has", "
|
|
2154
|
+
example: '["object/has", {"profile": {"name": "Ann"}}, "profile.name"]'
|
|
2155
2155
|
},
|
|
2156
2156
|
"object/merge": {
|
|
2157
2157
|
module: "object",
|
|
@@ -2188,7 +2188,7 @@ var OBJECT_OPERATORS = {
|
|
|
2188
2188
|
{ name: "obj", type: "object", description: "The object" },
|
|
2189
2189
|
{ name: "keys", type: "array", description: "Keys to keep" }
|
|
2190
2190
|
],
|
|
2191
|
-
example: '["object/pick", "@
|
|
2191
|
+
example: '["object/pick", {"name": "Ann", "email": "ann@example.com", "age": 30}, ["name", "email"]]'
|
|
2192
2192
|
},
|
|
2193
2193
|
"object/omit": {
|
|
2194
2194
|
module: "object",
|
|
@@ -2202,7 +2202,7 @@ var OBJECT_OPERATORS = {
|
|
|
2202
2202
|
{ name: "obj", type: "object", description: "The object" },
|
|
2203
2203
|
{ name: "keys", type: "array", description: "Keys to exclude" }
|
|
2204
2204
|
],
|
|
2205
|
-
example: '["object/omit", "
|
|
2205
|
+
example: '["object/omit", {"name": "Ann", "password": "x"}, ["password"]]'
|
|
2206
2206
|
},
|
|
2207
2207
|
"object/mapValues": {
|
|
2208
2208
|
module: "object",
|
|
@@ -2218,7 +2218,7 @@ var OBJECT_OPERATORS = {
|
|
|
2218
2218
|
{ name: "obj", type: "object", description: "The object" },
|
|
2219
2219
|
{ name: "fn", type: "lambda", description: "Transform function" }
|
|
2220
2220
|
],
|
|
2221
|
-
example: '["object/mapValues", "
|
|
2221
|
+
example: '["object/mapValues", {"a": 0.5, "b": 0.25}, ["fn", "v", ["*", "@v", 100]]]'
|
|
2222
2222
|
},
|
|
2223
2223
|
"object/mapKeys": {
|
|
2224
2224
|
module: "object",
|
|
@@ -2234,7 +2234,7 @@ var OBJECT_OPERATORS = {
|
|
|
2234
2234
|
{ name: "obj", type: "object", description: "The object" },
|
|
2235
2235
|
{ name: "fn", type: "lambda", description: "Transform function" }
|
|
2236
2236
|
],
|
|
2237
|
-
example: '["object/mapKeys", "
|
|
2237
|
+
example: '["object/mapKeys", {"a": 1, "b": 2}, ["fn", "k", ["str/upper", "@k"]]]'
|
|
2238
2238
|
},
|
|
2239
2239
|
"object/filter": {
|
|
2240
2240
|
module: "object",
|
|
@@ -2250,7 +2250,7 @@ var OBJECT_OPERATORS = {
|
|
|
2250
2250
|
{ name: "obj", type: "object", description: "The object" },
|
|
2251
2251
|
{ name: "pred", type: "lambda", description: "Predicate (key, value) => boolean" }
|
|
2252
2252
|
],
|
|
2253
|
-
example: '["object/filter", "
|
|
2253
|
+
example: '["object/filter", {"a": 1, "b": null}, ["fn", ["k", "v"], ["!=", "@v", null]]]'
|
|
2254
2254
|
},
|
|
2255
2255
|
"object/equals": {
|
|
2256
2256
|
module: "object",
|
|
@@ -2275,7 +2275,7 @@ var OBJECT_OPERATORS = {
|
|
|
2275
2275
|
hasSideEffects: false,
|
|
2276
2276
|
returnType: "any",
|
|
2277
2277
|
params: [{ name: "obj", type: "object", description: "The object" }],
|
|
2278
|
-
example: '["object/clone", "
|
|
2278
|
+
example: '["object/clone", {"a": 1, "b": 2}]'
|
|
2279
2279
|
},
|
|
2280
2280
|
"object/deepClone": {
|
|
2281
2281
|
module: "object",
|
|
@@ -2286,7 +2286,7 @@ var OBJECT_OPERATORS = {
|
|
|
2286
2286
|
hasSideEffects: false,
|
|
2287
2287
|
returnType: "any",
|
|
2288
2288
|
params: [{ name: "obj", type: "object", description: "The object" }],
|
|
2289
|
-
example: '["object/deepClone", "
|
|
2289
|
+
example: '["object/deepClone", {"a": {"b": 2}}]'
|
|
2290
2290
|
},
|
|
2291
2291
|
"path": {
|
|
2292
2292
|
module: "object",
|
|
@@ -2300,7 +2300,7 @@ var OBJECT_OPERATORS = {
|
|
|
2300
2300
|
params: [
|
|
2301
2301
|
{ name: "...segments", type: "string[]", description: "Path segments to join with dots" }
|
|
2302
2302
|
],
|
|
2303
|
-
example: '["path", "formValues", "
|
|
2303
|
+
example: '["path", "formValues", "customerName"] // => "formValues.customerName"'
|
|
2304
2304
|
}
|
|
2305
2305
|
};
|
|
2306
2306
|
|
|
@@ -2354,7 +2354,7 @@ var TIME_OPERATORS = {
|
|
|
2354
2354
|
{ name: "date", type: "number", description: "Timestamp" },
|
|
2355
2355
|
{ name: "format", type: "string", description: "Format pattern" }
|
|
2356
2356
|
],
|
|
2357
|
-
example: '["time/format",
|
|
2357
|
+
example: '["time/format", 1700000000000, "MMM DD, YYYY"]'
|
|
2358
2358
|
},
|
|
2359
2359
|
"time/year": {
|
|
2360
2360
|
module: "time",
|
|
@@ -2365,7 +2365,7 @@ var TIME_OPERATORS = {
|
|
|
2365
2365
|
hasSideEffects: false,
|
|
2366
2366
|
returnType: "number",
|
|
2367
2367
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2368
|
-
example: '["time/year",
|
|
2368
|
+
example: '["time/year", 1700000000000] // => 2023'
|
|
2369
2369
|
},
|
|
2370
2370
|
"time/month": {
|
|
2371
2371
|
module: "time",
|
|
@@ -2376,7 +2376,7 @@ var TIME_OPERATORS = {
|
|
|
2376
2376
|
hasSideEffects: false,
|
|
2377
2377
|
returnType: "number",
|
|
2378
2378
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2379
|
-
example: '["time/month",
|
|
2379
|
+
example: '["time/month", 1700000000000] // => 11'
|
|
2380
2380
|
},
|
|
2381
2381
|
"time/day": {
|
|
2382
2382
|
module: "time",
|
|
@@ -2387,7 +2387,7 @@ var TIME_OPERATORS = {
|
|
|
2387
2387
|
hasSideEffects: false,
|
|
2388
2388
|
returnType: "number",
|
|
2389
2389
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2390
|
-
example: '["time/day",
|
|
2390
|
+
example: '["time/day", 1700000000000] // => 14'
|
|
2391
2391
|
},
|
|
2392
2392
|
"time/weekday": {
|
|
2393
2393
|
module: "time",
|
|
@@ -2398,7 +2398,7 @@ var TIME_OPERATORS = {
|
|
|
2398
2398
|
hasSideEffects: false,
|
|
2399
2399
|
returnType: "number",
|
|
2400
2400
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2401
|
-
example: '["time/weekday",
|
|
2401
|
+
example: '["time/weekday", 1700000000000] // => 2 (Tuesday)'
|
|
2402
2402
|
},
|
|
2403
2403
|
"time/hour": {
|
|
2404
2404
|
module: "time",
|
|
@@ -2409,7 +2409,7 @@ var TIME_OPERATORS = {
|
|
|
2409
2409
|
hasSideEffects: false,
|
|
2410
2410
|
returnType: "number",
|
|
2411
2411
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2412
|
-
example: '["time/hour",
|
|
2412
|
+
example: '["time/hour", 1700000000000]'
|
|
2413
2413
|
},
|
|
2414
2414
|
"time/minute": {
|
|
2415
2415
|
module: "time",
|
|
@@ -2420,7 +2420,7 @@ var TIME_OPERATORS = {
|
|
|
2420
2420
|
hasSideEffects: false,
|
|
2421
2421
|
returnType: "number",
|
|
2422
2422
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2423
|
-
example: '["time/minute",
|
|
2423
|
+
example: '["time/minute", 1700000000000]'
|
|
2424
2424
|
},
|
|
2425
2425
|
"time/second": {
|
|
2426
2426
|
module: "time",
|
|
@@ -2431,7 +2431,7 @@ var TIME_OPERATORS = {
|
|
|
2431
2431
|
hasSideEffects: false,
|
|
2432
2432
|
returnType: "number",
|
|
2433
2433
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2434
|
-
example: '["time/second",
|
|
2434
|
+
example: '["time/second", 1700000000000]'
|
|
2435
2435
|
},
|
|
2436
2436
|
"time/add": {
|
|
2437
2437
|
module: "time",
|
|
@@ -2476,7 +2476,7 @@ var TIME_OPERATORS = {
|
|
|
2476
2476
|
{ name: "b", type: "number", description: "Second timestamp" },
|
|
2477
2477
|
{ name: "unit", type: "string", description: "Result unit", optional: true, defaultValue: "ms" }
|
|
2478
2478
|
],
|
|
2479
|
-
example: '["time/diff",
|
|
2479
|
+
example: '["time/diff", 1700000000000, ["time/now"], "year"]'
|
|
2480
2480
|
},
|
|
2481
2481
|
"time/startOf": {
|
|
2482
2482
|
module: "time",
|
|
@@ -2518,7 +2518,7 @@ var TIME_OPERATORS = {
|
|
|
2518
2518
|
{ name: "a", type: "number", description: "First timestamp" },
|
|
2519
2519
|
{ name: "b", type: "number", description: "Second timestamp" }
|
|
2520
2520
|
],
|
|
2521
|
-
example: '["time/isBefore",
|
|
2521
|
+
example: '["time/isBefore", 1700000000000, 1700086400000]'
|
|
2522
2522
|
},
|
|
2523
2523
|
"time/isAfter": {
|
|
2524
2524
|
module: "time",
|
|
@@ -2532,7 +2532,7 @@ var TIME_OPERATORS = {
|
|
|
2532
2532
|
{ name: "a", type: "number", description: "First timestamp" },
|
|
2533
2533
|
{ name: "b", type: "number", description: "Second timestamp" }
|
|
2534
2534
|
],
|
|
2535
|
-
example: '["time/isAfter", ["time/now"],
|
|
2535
|
+
example: '["time/isAfter", ["time/now"], 1700000000000]'
|
|
2536
2536
|
},
|
|
2537
2537
|
"time/isBetween": {
|
|
2538
2538
|
module: "time",
|
|
@@ -2547,7 +2547,7 @@ var TIME_OPERATORS = {
|
|
|
2547
2547
|
{ name: "start", type: "number", description: "Range start" },
|
|
2548
2548
|
{ name: "end", type: "number", description: "Range end" }
|
|
2549
2549
|
],
|
|
2550
|
-
example: '["time/isBetween", ["time/now"],
|
|
2550
|
+
example: '["time/isBetween", ["time/now"], 1700000000000, 2000000000000]'
|
|
2551
2551
|
},
|
|
2552
2552
|
"time/isSame": {
|
|
2553
2553
|
module: "time",
|
|
@@ -2562,7 +2562,7 @@ var TIME_OPERATORS = {
|
|
|
2562
2562
|
{ name: "b", type: "number", description: "Second timestamp" },
|
|
2563
2563
|
{ name: "unit", type: "string", description: "Comparison unit", optional: true }
|
|
2564
2564
|
],
|
|
2565
|
-
example: '["time/isSame",
|
|
2565
|
+
example: '["time/isSame", 1700000000000, 1700001000000, "day"]'
|
|
2566
2566
|
},
|
|
2567
2567
|
"time/isPast": {
|
|
2568
2568
|
module: "time",
|
|
@@ -2573,7 +2573,7 @@ var TIME_OPERATORS = {
|
|
|
2573
2573
|
hasSideEffects: false,
|
|
2574
2574
|
returnType: "boolean",
|
|
2575
2575
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2576
|
-
example: '["time/isPast",
|
|
2576
|
+
example: '["time/isPast", 1700000000000]'
|
|
2577
2577
|
},
|
|
2578
2578
|
"time/isFuture": {
|
|
2579
2579
|
module: "time",
|
|
@@ -2584,7 +2584,7 @@ var TIME_OPERATORS = {
|
|
|
2584
2584
|
hasSideEffects: false,
|
|
2585
2585
|
returnType: "boolean",
|
|
2586
2586
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2587
|
-
example: '["time/isFuture",
|
|
2587
|
+
example: '["time/isFuture", 2000000000000]'
|
|
2588
2588
|
},
|
|
2589
2589
|
"time/isToday": {
|
|
2590
2590
|
module: "time",
|
|
@@ -2595,7 +2595,7 @@ var TIME_OPERATORS = {
|
|
|
2595
2595
|
hasSideEffects: false,
|
|
2596
2596
|
returnType: "boolean",
|
|
2597
2597
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2598
|
-
example: '["time/isToday", "
|
|
2598
|
+
example: '["time/isToday", ["time/now"]]'
|
|
2599
2599
|
},
|
|
2600
2600
|
"time/relative": {
|
|
2601
2601
|
module: "time",
|
|
@@ -2606,7 +2606,7 @@ var TIME_OPERATORS = {
|
|
|
2606
2606
|
hasSideEffects: false,
|
|
2607
2607
|
returnType: "string",
|
|
2608
2608
|
params: [{ name: "date", type: "number", description: "Timestamp" }],
|
|
2609
|
-
example: '["time/relative",
|
|
2609
|
+
example: '["time/relative", 1700000000000] // => "2 years ago"'
|
|
2610
2610
|
},
|
|
2611
2611
|
"time/duration": {
|
|
2612
2612
|
module: "time",
|
|
@@ -2632,7 +2632,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2632
2632
|
hasSideEffects: false,
|
|
2633
2633
|
returnType: "boolean",
|
|
2634
2634
|
params: [{ name: "value", type: "any", description: "Value to check" }],
|
|
2635
|
-
example: '["validate/required", "
|
|
2635
|
+
example: '["validate/required", "Ann"]'
|
|
2636
2636
|
},
|
|
2637
2637
|
"validate/string": {
|
|
2638
2638
|
module: "validate",
|
|
@@ -2643,7 +2643,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2643
2643
|
hasSideEffects: false,
|
|
2644
2644
|
returnType: "boolean",
|
|
2645
2645
|
params: [{ name: "value", type: "any", description: "Value to check" }],
|
|
2646
|
-
example: '["validate/string", "
|
|
2646
|
+
example: '["validate/string", "Ann"]'
|
|
2647
2647
|
},
|
|
2648
2648
|
"validate/number": {
|
|
2649
2649
|
module: "validate",
|
|
@@ -2654,7 +2654,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2654
2654
|
hasSideEffects: false,
|
|
2655
2655
|
returnType: "boolean",
|
|
2656
2656
|
params: [{ name: "value", type: "any", description: "Value to check" }],
|
|
2657
|
-
example: '["validate/number",
|
|
2657
|
+
example: '["validate/number", 42]'
|
|
2658
2658
|
},
|
|
2659
2659
|
"validate/boolean": {
|
|
2660
2660
|
module: "validate",
|
|
@@ -2665,7 +2665,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2665
2665
|
hasSideEffects: false,
|
|
2666
2666
|
returnType: "boolean",
|
|
2667
2667
|
params: [{ name: "value", type: "any", description: "Value to check" }],
|
|
2668
|
-
example: '["validate/boolean",
|
|
2668
|
+
example: '["validate/boolean", true]'
|
|
2669
2669
|
},
|
|
2670
2670
|
"validate/array": {
|
|
2671
2671
|
module: "validate",
|
|
@@ -2676,7 +2676,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2676
2676
|
hasSideEffects: false,
|
|
2677
2677
|
returnType: "boolean",
|
|
2678
2678
|
params: [{ name: "value", type: "any", description: "Value to check" }],
|
|
2679
|
-
example: '["validate/array",
|
|
2679
|
+
example: '["validate/array", [1, 2]]'
|
|
2680
2680
|
},
|
|
2681
2681
|
"validate/object": {
|
|
2682
2682
|
module: "validate",
|
|
@@ -2687,7 +2687,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2687
2687
|
hasSideEffects: false,
|
|
2688
2688
|
returnType: "boolean",
|
|
2689
2689
|
params: [{ name: "value", type: "any", description: "Value to check" }],
|
|
2690
|
-
example: '["validate/object", "
|
|
2690
|
+
example: '["validate/object", {"a": 1}]'
|
|
2691
2691
|
},
|
|
2692
2692
|
"validate/email": {
|
|
2693
2693
|
module: "validate",
|
|
@@ -2698,7 +2698,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2698
2698
|
hasSideEffects: false,
|
|
2699
2699
|
returnType: "boolean",
|
|
2700
2700
|
params: [{ name: "value", type: "string", description: "Email to validate" }],
|
|
2701
|
-
example: '["validate/email", "@
|
|
2701
|
+
example: '["validate/email", "ann@example.com"]'
|
|
2702
2702
|
},
|
|
2703
2703
|
"validate/url": {
|
|
2704
2704
|
module: "validate",
|
|
@@ -2709,7 +2709,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2709
2709
|
hasSideEffects: false,
|
|
2710
2710
|
returnType: "boolean",
|
|
2711
2711
|
params: [{ name: "value", type: "string", description: "URL to validate" }],
|
|
2712
|
-
example: '["validate/url", "
|
|
2712
|
+
example: '["validate/url", "https://example.com"]'
|
|
2713
2713
|
},
|
|
2714
2714
|
"validate/uuid": {
|
|
2715
2715
|
module: "validate",
|
|
@@ -2720,7 +2720,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2720
2720
|
hasSideEffects: false,
|
|
2721
2721
|
returnType: "boolean",
|
|
2722
2722
|
params: [{ name: "value", type: "string", description: "UUID to validate" }],
|
|
2723
|
-
example: '["validate/uuid", "
|
|
2723
|
+
example: '["validate/uuid", "550e8400-e29b-41d4-a716-446655440000"]'
|
|
2724
2724
|
},
|
|
2725
2725
|
"validate/phone": {
|
|
2726
2726
|
module: "validate",
|
|
@@ -2731,7 +2731,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2731
2731
|
hasSideEffects: false,
|
|
2732
2732
|
returnType: "boolean",
|
|
2733
2733
|
params: [{ name: "value", type: "string", description: "Phone number to validate" }],
|
|
2734
|
-
example: '["validate/phone", "
|
|
2734
|
+
example: '["validate/phone", "+15551234567"]'
|
|
2735
2735
|
},
|
|
2736
2736
|
"validate/creditCard": {
|
|
2737
2737
|
module: "validate",
|
|
@@ -2742,7 +2742,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2742
2742
|
hasSideEffects: false,
|
|
2743
2743
|
returnType: "boolean",
|
|
2744
2744
|
params: [{ name: "value", type: "string", description: "Card number to validate" }],
|
|
2745
|
-
example: '["validate/creditCard", "
|
|
2745
|
+
example: '["validate/creditCard", "4111111111111111"]'
|
|
2746
2746
|
},
|
|
2747
2747
|
"validate/date": {
|
|
2748
2748
|
module: "validate",
|
|
@@ -2753,7 +2753,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2753
2753
|
hasSideEffects: false,
|
|
2754
2754
|
returnType: "boolean",
|
|
2755
2755
|
params: [{ name: "value", type: "any", description: "Value to check" }],
|
|
2756
|
-
example: '["validate/date", "
|
|
2756
|
+
example: '["validate/date", "2024-01-18"]'
|
|
2757
2757
|
},
|
|
2758
2758
|
"validate/minLength": {
|
|
2759
2759
|
module: "validate",
|
|
@@ -2767,7 +2767,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2767
2767
|
{ name: "value", type: "string | array", description: "Value to check" },
|
|
2768
2768
|
{ name: "min", type: "number", description: "Minimum length" }
|
|
2769
2769
|
],
|
|
2770
|
-
example: '["validate/minLength", "
|
|
2770
|
+
example: '["validate/minLength", "password123", 8]'
|
|
2771
2771
|
},
|
|
2772
2772
|
"validate/maxLength": {
|
|
2773
2773
|
module: "validate",
|
|
@@ -2781,7 +2781,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2781
2781
|
{ name: "value", type: "string | array", description: "Value to check" },
|
|
2782
2782
|
{ name: "max", type: "number", description: "Maximum length" }
|
|
2783
2783
|
],
|
|
2784
|
-
example: '["validate/maxLength", "
|
|
2784
|
+
example: '["validate/maxLength", "Ann", 50]'
|
|
2785
2785
|
},
|
|
2786
2786
|
"validate/length": {
|
|
2787
2787
|
module: "validate",
|
|
@@ -2795,7 +2795,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2795
2795
|
{ name: "value", type: "string | array", description: "Value to check" },
|
|
2796
2796
|
{ name: "exact", type: "number", description: "Required length" }
|
|
2797
2797
|
],
|
|
2798
|
-
example: '["validate/length", "
|
|
2798
|
+
example: '["validate/length", "ABC123", 6]'
|
|
2799
2799
|
},
|
|
2800
2800
|
"validate/min": {
|
|
2801
2801
|
module: "validate",
|
|
@@ -2809,7 +2809,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2809
2809
|
{ name: "value", type: "number", description: "Number to check" },
|
|
2810
2810
|
{ name: "min", type: "number", description: "Minimum value" }
|
|
2811
2811
|
],
|
|
2812
|
-
example: '["validate/min",
|
|
2812
|
+
example: '["validate/min", 21, 18]'
|
|
2813
2813
|
},
|
|
2814
2814
|
"validate/max": {
|
|
2815
2815
|
module: "validate",
|
|
@@ -2823,7 +2823,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2823
2823
|
{ name: "value", type: "number", description: "Number to check" },
|
|
2824
2824
|
{ name: "max", type: "number", description: "Maximum value" }
|
|
2825
2825
|
],
|
|
2826
|
-
example: '["validate/max",
|
|
2826
|
+
example: '["validate/max", 50, 100]'
|
|
2827
2827
|
},
|
|
2828
2828
|
"validate/range": {
|
|
2829
2829
|
module: "validate",
|
|
@@ -2838,7 +2838,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2838
2838
|
{ name: "min", type: "number", description: "Minimum value" },
|
|
2839
2839
|
{ name: "max", type: "number", description: "Maximum value" }
|
|
2840
2840
|
],
|
|
2841
|
-
example: '["validate/range",
|
|
2841
|
+
example: '["validate/range", 4, 1, 5]'
|
|
2842
2842
|
},
|
|
2843
2843
|
"validate/pattern": {
|
|
2844
2844
|
module: "validate",
|
|
@@ -2852,7 +2852,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2852
2852
|
{ name: "value", type: "string", description: "String to check" },
|
|
2853
2853
|
{ name: "regex", type: "string", description: "Regex pattern" }
|
|
2854
2854
|
],
|
|
2855
|
-
example: '["validate/pattern", "
|
|
2855
|
+
example: '["validate/pattern", "ABC123", "^[A-Z]{3}[0-9]{3}$"]'
|
|
2856
2856
|
},
|
|
2857
2857
|
"validate/oneOf": {
|
|
2858
2858
|
module: "validate",
|
|
@@ -2866,7 +2866,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2866
2866
|
{ name: "value", type: "any", description: "Value to check" },
|
|
2867
2867
|
{ name: "options", type: "array", description: "Allowed values" }
|
|
2868
2868
|
],
|
|
2869
|
-
example: '["validate/oneOf", "
|
|
2869
|
+
example: '["validate/oneOf", "admin", ["admin", "user", "guest"]]'
|
|
2870
2870
|
},
|
|
2871
2871
|
"validate/noneOf": {
|
|
2872
2872
|
module: "validate",
|
|
@@ -2880,7 +2880,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2880
2880
|
{ name: "value", type: "any", description: "Value to check" },
|
|
2881
2881
|
{ name: "options", type: "array", description: "Disallowed values" }
|
|
2882
2882
|
],
|
|
2883
|
-
example: '["validate/noneOf", "
|
|
2883
|
+
example: '["validate/noneOf", "alice", ["admin", "root", "system"]]'
|
|
2884
2884
|
},
|
|
2885
2885
|
"validate/equals": {
|
|
2886
2886
|
module: "validate",
|
|
@@ -2894,7 +2894,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2894
2894
|
{ name: "a", type: "any", description: "First value" },
|
|
2895
2895
|
{ name: "b", type: "any", description: "Second value" }
|
|
2896
2896
|
],
|
|
2897
|
-
example: '["validate/equals", "
|
|
2897
|
+
example: '["validate/equals", "secret", "secret"]'
|
|
2898
2898
|
},
|
|
2899
2899
|
"validate/check": {
|
|
2900
2900
|
module: "validate",
|
|
@@ -2908,11 +2908,7 @@ var VALIDATE_OPERATORS = {
|
|
|
2908
2908
|
{ name: "value", type: "any", description: "Value or object to validate" },
|
|
2909
2909
|
{ name: "rules", type: "object", description: "Validation rules by field" }
|
|
2910
2910
|
],
|
|
2911
|
-
example:
|
|
2912
|
-
"name": [["required"], ["minLength", 2], ["maxLength", 50]],
|
|
2913
|
-
"email": [["required"], ["email"]],
|
|
2914
|
-
"age": [["number"], ["min", 18]]
|
|
2915
|
-
}]`
|
|
2911
|
+
example: '["validate/check", {"name": "Ann", "email": "ann@example.com", "age": 20}, {"name": [["required"], ["minLength", 2], ["maxLength", 50]], "email": [["required"], ["email"]], "age": [["number"]]}]'
|
|
2916
2912
|
}
|
|
2917
2913
|
};
|
|
2918
2914
|
|
|
@@ -3288,7 +3284,7 @@ var NN_OPERATORS = {
|
|
|
3288
3284
|
{ name: "module", type: "nn/module", description: "The neural network module" },
|
|
3289
3285
|
{ name: "input", type: "tensor", description: "Input tensor" }
|
|
3290
3286
|
],
|
|
3291
|
-
example: '["nn/forward", "
|
|
3287
|
+
example: '["nn/forward", {"layers": [{"type": "dense", "units": 2}]}, [0.1, 0.2]]'
|
|
3292
3288
|
},
|
|
3293
3289
|
"nn/getWeights": {
|
|
3294
3290
|
module: "nn",
|
|
@@ -3301,7 +3297,7 @@ var NN_OPERATORS = {
|
|
|
3301
3297
|
params: [
|
|
3302
3298
|
{ name: "module", type: "nn/module", description: "The neural network module" }
|
|
3303
3299
|
],
|
|
3304
|
-
example: '["nn/getWeights", "
|
|
3300
|
+
example: '["nn/getWeights", {"layers": [{"type": "dense", "units": 2}]}]'
|
|
3305
3301
|
},
|
|
3306
3302
|
"nn/setWeights": {
|
|
3307
3303
|
module: "nn",
|
|
@@ -3315,7 +3311,7 @@ var NN_OPERATORS = {
|
|
|
3315
3311
|
{ name: "module", type: "nn/module", description: "The neural network module" },
|
|
3316
3312
|
{ name: "weights", type: "tensor", description: "New weights as flat tensor" }
|
|
3317
3313
|
],
|
|
3318
|
-
example: '["nn/setWeights", "
|
|
3314
|
+
example: '["nn/setWeights", {"layers": [{"type": "dense", "units": 2}]}, [0.1, 0.2, 0.3]]'
|
|
3319
3315
|
},
|
|
3320
3316
|
"nn/paramCount": {
|
|
3321
3317
|
module: "nn",
|
|
@@ -3328,7 +3324,7 @@ var NN_OPERATORS = {
|
|
|
3328
3324
|
params: [
|
|
3329
3325
|
{ name: "module", type: "nn/module", description: "The neural network module" }
|
|
3330
3326
|
],
|
|
3331
|
-
example: '["nn/paramCount", "
|
|
3327
|
+
example: '["nn/paramCount", {"layers": [{"type": "dense", "units": 2}]}]'
|
|
3332
3328
|
},
|
|
3333
3329
|
"nn/clone": {
|
|
3334
3330
|
module: "nn",
|
|
@@ -3341,7 +3337,7 @@ var NN_OPERATORS = {
|
|
|
3341
3337
|
params: [
|
|
3342
3338
|
{ name: "module", type: "nn/module", description: "The neural network module to clone" }
|
|
3343
3339
|
],
|
|
3344
|
-
example: '["nn/clone", "
|
|
3340
|
+
example: '["nn/clone", {"layers": [{"type": "dense", "units": 2}]}]'
|
|
3345
3341
|
},
|
|
3346
3342
|
// ============================================================================
|
|
3347
3343
|
// ML lifecycle effect (bare alias invoked by std ML behaviors)
|
|
@@ -3358,7 +3354,7 @@ var NN_OPERATORS = {
|
|
|
3358
3354
|
{ name: "model", type: "nn/module", description: "The neural network module" },
|
|
3359
3355
|
{ name: "input", type: "tensor", description: "Input tensor" }
|
|
3360
3356
|
],
|
|
3361
|
-
example: '["forward", "
|
|
3357
|
+
example: '["forward", {"layers": [{"type": "dense", "units": 2}]}, [0.5]]'
|
|
3362
3358
|
}
|
|
3363
3359
|
};
|
|
3364
3360
|
|
|
@@ -3446,7 +3442,7 @@ var TENSOR_OPERATORS = {
|
|
|
3446
3442
|
params: [
|
|
3447
3443
|
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
3448
3444
|
],
|
|
3449
|
-
example: '["tensor/shape",
|
|
3445
|
+
example: '["tensor/shape", [[1, 2], [3, 4]]] // => [2, 2]'
|
|
3450
3446
|
},
|
|
3451
3447
|
"tensor/get": {
|
|
3452
3448
|
module: "tensor",
|
|
@@ -3460,7 +3456,7 @@ var TENSOR_OPERATORS = {
|
|
|
3460
3456
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3461
3457
|
{ name: "index", type: "number | number[]", description: "Index (single for 1D, array for multi-D)" }
|
|
3462
3458
|
],
|
|
3463
|
-
example: '["tensor/get",
|
|
3459
|
+
example: '["tensor/get", [10, 20, 30, 40], 3] // Get 4th element'
|
|
3464
3460
|
},
|
|
3465
3461
|
"tensor/slice": {
|
|
3466
3462
|
module: "tensor",
|
|
@@ -3475,7 +3471,7 @@ var TENSOR_OPERATORS = {
|
|
|
3475
3471
|
{ name: "start", type: "number", description: "Start index" },
|
|
3476
3472
|
{ name: "end", type: "number", description: "End index (exclusive)" }
|
|
3477
3473
|
],
|
|
3478
|
-
example: '["tensor/slice",
|
|
3474
|
+
example: '["tensor/slice", [10, 20, 30, 40], 0, 3] // First 3 elements'
|
|
3479
3475
|
},
|
|
3480
3476
|
"tensor/reshape": {
|
|
3481
3477
|
module: "tensor",
|
|
@@ -3489,7 +3485,7 @@ var TENSOR_OPERATORS = {
|
|
|
3489
3485
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3490
3486
|
{ name: "shape", type: "number[]", description: "New shape" }
|
|
3491
3487
|
],
|
|
3492
|
-
example: '["tensor/reshape",
|
|
3488
|
+
example: '["tensor/reshape", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [4, 4]] // Reshape to 4x4'
|
|
3493
3489
|
},
|
|
3494
3490
|
"tensor/flatten": {
|
|
3495
3491
|
module: "tensor",
|
|
@@ -3502,7 +3498,7 @@ var TENSOR_OPERATORS = {
|
|
|
3502
3498
|
params: [
|
|
3503
3499
|
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
3504
3500
|
],
|
|
3505
|
-
example: '["tensor/flatten",
|
|
3501
|
+
example: '["tensor/flatten", [[1, 2], [3, 4]]]'
|
|
3506
3502
|
},
|
|
3507
3503
|
// ============================================================================
|
|
3508
3504
|
// Math Operations
|
|
@@ -3519,7 +3515,7 @@ var TENSOR_OPERATORS = {
|
|
|
3519
3515
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
3520
3516
|
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
3521
3517
|
],
|
|
3522
|
-
example: '["tensor/add",
|
|
3518
|
+
example: '["tensor/add", [1, 2], [3, 4]]'
|
|
3523
3519
|
},
|
|
3524
3520
|
"tensor/sub": {
|
|
3525
3521
|
module: "tensor",
|
|
@@ -3533,7 +3529,7 @@ var TENSOR_OPERATORS = {
|
|
|
3533
3529
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
3534
3530
|
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
3535
3531
|
],
|
|
3536
|
-
example: '["tensor/sub",
|
|
3532
|
+
example: '["tensor/sub", [1, 2], [3, 4]]'
|
|
3537
3533
|
},
|
|
3538
3534
|
"tensor/mul": {
|
|
3539
3535
|
module: "tensor",
|
|
@@ -3547,7 +3543,7 @@ var TENSOR_OPERATORS = {
|
|
|
3547
3543
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
3548
3544
|
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
3549
3545
|
],
|
|
3550
|
-
example: '["tensor/mul",
|
|
3546
|
+
example: '["tensor/mul", [0.5, 0.7], 0.99] // Decay weights'
|
|
3551
3547
|
},
|
|
3552
3548
|
"tensor/div": {
|
|
3553
3549
|
module: "tensor",
|
|
@@ -3561,7 +3557,7 @@ var TENSOR_OPERATORS = {
|
|
|
3561
3557
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
3562
3558
|
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
3563
3559
|
],
|
|
3564
|
-
example: '["tensor/div",
|
|
3560
|
+
example: '["tensor/div", [10, 20], 2]'
|
|
3565
3561
|
},
|
|
3566
3562
|
"tensor/matmul": {
|
|
3567
3563
|
module: "tensor",
|
|
@@ -3575,7 +3571,7 @@ var TENSOR_OPERATORS = {
|
|
|
3575
3571
|
{ name: "a", type: "tensor", description: "First tensor (NxM)" },
|
|
3576
3572
|
{ name: "b", type: "tensor", description: "Second tensor (MxK)" }
|
|
3577
3573
|
],
|
|
3578
|
-
example: '["tensor/matmul",
|
|
3574
|
+
example: '["tensor/matmul", [[1, 2], [3, 4]], [[5, 6], [7, 8]]]'
|
|
3579
3575
|
},
|
|
3580
3576
|
"tensor/dot": {
|
|
3581
3577
|
module: "tensor",
|
|
@@ -3589,7 +3585,7 @@ var TENSOR_OPERATORS = {
|
|
|
3589
3585
|
{ name: "a", type: "tensor", description: "First vector" },
|
|
3590
3586
|
{ name: "b", type: "tensor", description: "Second vector" }
|
|
3591
3587
|
],
|
|
3592
|
-
example: '["tensor/dot",
|
|
3588
|
+
example: '["tensor/dot", [1, 2], [3, 4]]'
|
|
3593
3589
|
},
|
|
3594
3590
|
// ============================================================================
|
|
3595
3591
|
// Reductions
|
|
@@ -3606,7 +3602,7 @@ var TENSOR_OPERATORS = {
|
|
|
3606
3602
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3607
3603
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
3608
3604
|
],
|
|
3609
|
-
example: '["tensor/sum",
|
|
3605
|
+
example: '["tensor/sum", [1, 0, 1]] // Total reward'
|
|
3610
3606
|
},
|
|
3611
3607
|
"tensor/mean": {
|
|
3612
3608
|
module: "tensor",
|
|
@@ -3620,7 +3616,7 @@ var TENSOR_OPERATORS = {
|
|
|
3620
3616
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3621
3617
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
3622
3618
|
],
|
|
3623
|
-
example: '["tensor/mean",
|
|
3619
|
+
example: '["tensor/mean", [0.2, 0.4, 0.6]]'
|
|
3624
3620
|
},
|
|
3625
3621
|
"tensor/max": {
|
|
3626
3622
|
module: "tensor",
|
|
@@ -3634,7 +3630,7 @@ var TENSOR_OPERATORS = {
|
|
|
3634
3630
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3635
3631
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
3636
3632
|
],
|
|
3637
|
-
example: '["tensor/max",
|
|
3633
|
+
example: '["tensor/max", [0.1, 0.9, 0.3]]'
|
|
3638
3634
|
},
|
|
3639
3635
|
"tensor/min": {
|
|
3640
3636
|
module: "tensor",
|
|
@@ -3648,7 +3644,7 @@ var TENSOR_OPERATORS = {
|
|
|
3648
3644
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3649
3645
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
3650
3646
|
],
|
|
3651
|
-
example: '["tensor/min",
|
|
3647
|
+
example: '["tensor/min", [3, 1, 2]]'
|
|
3652
3648
|
},
|
|
3653
3649
|
"tensor/argmax": {
|
|
3654
3650
|
module: "tensor",
|
|
@@ -3662,7 +3658,7 @@ var TENSOR_OPERATORS = {
|
|
|
3662
3658
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3663
3659
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
3664
3660
|
],
|
|
3665
|
-
example: '["tensor/argmax",
|
|
3661
|
+
example: '["tensor/argmax", [0.1, 0.9, 0.3]] // Best action index'
|
|
3666
3662
|
},
|
|
3667
3663
|
"tensor/norm": {
|
|
3668
3664
|
module: "tensor",
|
|
@@ -3676,7 +3672,7 @@ var TENSOR_OPERATORS = {
|
|
|
3676
3672
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3677
3673
|
{ name: "p", type: "number", description: "Norm order (default 2)", optional: true, defaultValue: 2 }
|
|
3678
3674
|
],
|
|
3679
|
-
example: '["tensor/norm",
|
|
3675
|
+
example: '["tensor/norm", [3, 4]]'
|
|
3680
3676
|
},
|
|
3681
3677
|
// ============================================================================
|
|
3682
3678
|
// Range Validation (for contracts)
|
|
@@ -3693,7 +3689,7 @@ var TENSOR_OPERATORS = {
|
|
|
3693
3689
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3694
3690
|
{ name: "range", type: "[number, number]", description: "Range as [min, max]" }
|
|
3695
3691
|
],
|
|
3696
|
-
example: '["tensor/allInRange",
|
|
3692
|
+
example: '["tensor/allInRange", [0.5, -0.2], [-1.0, 1.0]]'
|
|
3697
3693
|
},
|
|
3698
3694
|
"tensor/outOfRangeIndices": {
|
|
3699
3695
|
module: "tensor",
|
|
@@ -3707,7 +3703,7 @@ var TENSOR_OPERATORS = {
|
|
|
3707
3703
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3708
3704
|
{ name: "range", type: "[number, number]", description: "Range as [min, max]" }
|
|
3709
3705
|
],
|
|
3710
|
-
example: '["tensor/outOfRangeIndices",
|
|
3706
|
+
example: '["tensor/outOfRangeIndices", [0.5, 1.5], [-1.0, 1.0]]'
|
|
3711
3707
|
},
|
|
3712
3708
|
"tensor/clamp": {
|
|
3713
3709
|
module: "tensor",
|
|
@@ -3722,7 +3718,7 @@ var TENSOR_OPERATORS = {
|
|
|
3722
3718
|
{ name: "min", type: "number", description: "Minimum value" },
|
|
3723
3719
|
{ name: "max", type: "number", description: "Maximum value" }
|
|
3724
3720
|
],
|
|
3725
|
-
example: '["tensor/clamp",
|
|
3721
|
+
example: '["tensor/clamp", [5, -15, 3], -10.0, 10.0]'
|
|
3726
3722
|
},
|
|
3727
3723
|
"tensor/clampPerDim": {
|
|
3728
3724
|
module: "tensor",
|
|
@@ -3736,7 +3732,7 @@ var TENSOR_OPERATORS = {
|
|
|
3736
3732
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3737
3733
|
{ name: "ranges", type: "object", description: 'Per-dimension ranges { "0": {min, max}, ... }' }
|
|
3738
3734
|
],
|
|
3739
|
-
example: '["tensor/clampPerDim", "
|
|
3735
|
+
example: '["tensor/clampPerDim", [5, -15], {"0": {"min": 0, "max": 10}, "1": {"min": -10, "max": 10}}]'
|
|
3740
3736
|
},
|
|
3741
3737
|
"tensor/outOfRangeDims": {
|
|
3742
3738
|
module: "tensor",
|
|
@@ -3750,7 +3746,7 @@ var TENSOR_OPERATORS = {
|
|
|
3750
3746
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3751
3747
|
{ name: "ranges", type: "object", description: 'Per-dimension ranges { "0": {min, max}, ... }' }
|
|
3752
3748
|
],
|
|
3753
|
-
example: '["tensor/outOfRangeDims", "
|
|
3749
|
+
example: '["tensor/outOfRangeDims", [5, -15], {"0": {"min": 0, "max": 10}, "1": {"min": -10, "max": 10}}]'
|
|
3754
3750
|
},
|
|
3755
3751
|
// ============================================================================
|
|
3756
3752
|
// Conversion
|
|
@@ -3766,7 +3762,7 @@ var TENSOR_OPERATORS = {
|
|
|
3766
3762
|
params: [
|
|
3767
3763
|
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
3768
3764
|
],
|
|
3769
|
-
example: '["tensor/toArray",
|
|
3765
|
+
example: '["tensor/toArray", [[1, 2], [3, 4]]]'
|
|
3770
3766
|
},
|
|
3771
3767
|
"tensor/toList": {
|
|
3772
3768
|
module: "tensor",
|
|
@@ -3779,7 +3775,7 @@ var TENSOR_OPERATORS = {
|
|
|
3779
3775
|
params: [
|
|
3780
3776
|
{ name: "tensor", type: "tensor", description: "The tensor (must be 1D)" }
|
|
3781
3777
|
],
|
|
3782
|
-
example: '["tensor/toList",
|
|
3778
|
+
example: '["tensor/toList", [1, 2, 3]]'
|
|
3783
3779
|
},
|
|
3784
3780
|
// ============================================================================
|
|
3785
3781
|
// Concatenation / stacking / shape manipulation
|
|
@@ -3796,7 +3792,7 @@ var TENSOR_OPERATORS = {
|
|
|
3796
3792
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
3797
3793
|
{ name: "b", type: "tensor", description: "Second tensor" }
|
|
3798
3794
|
],
|
|
3799
|
-
example: '["tensor/cat",
|
|
3795
|
+
example: '["tensor/cat", [1, 2], [3, 4]]'
|
|
3800
3796
|
},
|
|
3801
3797
|
"tensor/stack": {
|
|
3802
3798
|
module: "tensor",
|
|
@@ -3810,7 +3806,7 @@ var TENSOR_OPERATORS = {
|
|
|
3810
3806
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
3811
3807
|
{ name: "b", type: "tensor", description: "Second tensor" }
|
|
3812
3808
|
],
|
|
3813
|
-
example: '["tensor/stack",
|
|
3809
|
+
example: '["tensor/stack", [1, 2], [3, 4]]'
|
|
3814
3810
|
},
|
|
3815
3811
|
"tensor/transpose": {
|
|
3816
3812
|
module: "tensor",
|
|
@@ -3825,7 +3821,7 @@ var TENSOR_OPERATORS = {
|
|
|
3825
3821
|
{ name: "dim0", type: "number", description: "First dimension to swap (optional)" },
|
|
3826
3822
|
{ name: "dim1", type: "number", description: "Second dimension to swap (optional)" }
|
|
3827
3823
|
],
|
|
3828
|
-
example: '["tensor/transpose",
|
|
3824
|
+
example: '["tensor/transpose", [[1, 2], [3, 4]], 0, 1]'
|
|
3829
3825
|
},
|
|
3830
3826
|
"tensor/unsqueeze": {
|
|
3831
3827
|
module: "tensor",
|
|
@@ -3839,7 +3835,7 @@ var TENSOR_OPERATORS = {
|
|
|
3839
3835
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
3840
3836
|
{ name: "dim", type: "number", description: "Position to insert the new dimension" }
|
|
3841
3837
|
],
|
|
3842
|
-
example: '["tensor/unsqueeze",
|
|
3838
|
+
example: '["tensor/unsqueeze", [1, 2, 3], 0]'
|
|
3843
3839
|
},
|
|
3844
3840
|
"tensor/squeeze": {
|
|
3845
3841
|
module: "tensor",
|
|
@@ -3852,7 +3848,7 @@ var TENSOR_OPERATORS = {
|
|
|
3852
3848
|
params: [
|
|
3853
3849
|
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
3854
3850
|
],
|
|
3855
|
-
example: '["tensor/squeeze",
|
|
3851
|
+
example: '["tensor/squeeze", [[1, 2, 3]]]'
|
|
3856
3852
|
}
|
|
3857
3853
|
};
|
|
3858
3854
|
|
|
@@ -3874,7 +3870,7 @@ var TRAIN_OPERATORS = {
|
|
|
3874
3870
|
{ name: "data", type: "array", description: "Training data (array of {input, target} or experiences)" },
|
|
3875
3871
|
{ name: "config", type: "train/config", description: "Training configuration with constraints" }
|
|
3876
3872
|
],
|
|
3877
|
-
example: '["train/loop", "
|
|
3873
|
+
example: '["train/loop", {"layers": [{"type": "dense", "units": 2}]}, [{"state": [0], "action": 1, "reward": 1}], {"epochs": 10}]'
|
|
3878
3874
|
},
|
|
3879
3875
|
"train/step": {
|
|
3880
3876
|
module: "train",
|
|
@@ -3890,7 +3886,7 @@ var TRAIN_OPERATORS = {
|
|
|
3890
3886
|
{ name: "target", type: "tensor", description: "Target tensor" },
|
|
3891
3887
|
{ name: "config", type: "train/config", description: "Training configuration" }
|
|
3892
3888
|
],
|
|
3893
|
-
example: '["train/step", "
|
|
3889
|
+
example: '["train/step", {"layers": [{"type": "dense", "units": 2}]}, [0.1, 0.2], [1], {"lr": 0.01}]'
|
|
3894
3890
|
},
|
|
3895
3891
|
// ============================================================================
|
|
3896
3892
|
// Validation
|
|
@@ -3907,7 +3903,7 @@ var TRAIN_OPERATORS = {
|
|
|
3907
3903
|
{ name: "module", type: "nn/module", description: "The neural network" },
|
|
3908
3904
|
{ name: "testCases", type: "array", description: "Array of {input, expected, tolerance?}" }
|
|
3909
3905
|
],
|
|
3910
|
-
example: '["train/validate", "
|
|
3906
|
+
example: '["train/validate", {"layers": [{"type": "dense", "units": 2}]}, [{"input": [0], "expected": [1]}]]'
|
|
3911
3907
|
},
|
|
3912
3908
|
"train/checkRegression": {
|
|
3913
3909
|
module: "train",
|
|
@@ -3922,7 +3918,7 @@ var TRAIN_OPERATORS = {
|
|
|
3922
3918
|
{ name: "oldModule", type: "nn/module", description: "Previous network" },
|
|
3923
3919
|
{ name: "invariants", type: "array", description: "Test cases that must not regress" }
|
|
3924
3920
|
],
|
|
3925
|
-
example: '["train/checkRegression",
|
|
3921
|
+
example: '["train/checkRegression", [0.1, 0.2], {"layers": [{"type": "dense", "units": 2}]}, [{"input": [0], "expected": [1]}]]'
|
|
3926
3922
|
},
|
|
3927
3923
|
// ============================================================================
|
|
3928
3924
|
// Constraint Checking
|
|
@@ -3939,7 +3935,7 @@ var TRAIN_OPERATORS = {
|
|
|
3939
3935
|
{ name: "module", type: "nn/module", description: "The neural network" },
|
|
3940
3936
|
{ name: "constraints", type: "train/constraints", description: "Constraint specification" }
|
|
3941
3937
|
],
|
|
3942
|
-
example: '["train/checkConstraints",
|
|
3938
|
+
example: '["train/checkConstraints", [0.1, 0.2], {"maxMagnitude": 10}]'
|
|
3943
3939
|
},
|
|
3944
3940
|
"train/checkWeightMagnitude": {
|
|
3945
3941
|
module: "train",
|
|
@@ -3953,7 +3949,7 @@ var TRAIN_OPERATORS = {
|
|
|
3953
3949
|
{ name: "module", type: "nn/module", description: "The neural network" },
|
|
3954
3950
|
{ name: "maxMagnitude", type: "number", description: "Maximum allowed weight magnitude" }
|
|
3955
3951
|
],
|
|
3956
|
-
example: '["train/checkWeightMagnitude", "
|
|
3952
|
+
example: '["train/checkWeightMagnitude", {"layers": [{"type": "dense", "units": 2}]}, 10.0]'
|
|
3957
3953
|
},
|
|
3958
3954
|
"train/checkForbiddenOutputs": {
|
|
3959
3955
|
module: "train",
|
|
@@ -3968,7 +3964,7 @@ var TRAIN_OPERATORS = {
|
|
|
3968
3964
|
{ name: "testInputs", type: "array", description: "Inputs to test" },
|
|
3969
3965
|
{ name: "forbiddenRegions", type: "array", description: "Forbidden output regions" }
|
|
3970
3966
|
],
|
|
3971
|
-
example: '["train/checkForbiddenOutputs", "
|
|
3967
|
+
example: '["train/checkForbiddenOutputs", {"layers": [{"type": "dense", "units": 2}]}, [[0], [1]], {"0": {"min": 100, "max": 200}}]'
|
|
3972
3968
|
},
|
|
3973
3969
|
// ============================================================================
|
|
3974
3970
|
// Gradient Operations
|
|
@@ -3985,7 +3981,7 @@ var TRAIN_OPERATORS = {
|
|
|
3985
3981
|
{ name: "module", type: "nn/module", description: "The neural network" },
|
|
3986
3982
|
{ name: "maxNorm", type: "number", description: "Maximum gradient norm" }
|
|
3987
3983
|
],
|
|
3988
|
-
example: '["train/clipGradients", "
|
|
3984
|
+
example: '["train/clipGradients", {"layers": [{"type": "dense", "units": 2}]}, 1.0]'
|
|
3989
3985
|
},
|
|
3990
3986
|
"train/getGradientNorm": {
|
|
3991
3987
|
module: "train",
|
|
@@ -3998,7 +3994,7 @@ var TRAIN_OPERATORS = {
|
|
|
3998
3994
|
params: [
|
|
3999
3995
|
{ name: "module", type: "nn/module", description: "The neural network" }
|
|
4000
3996
|
],
|
|
4001
|
-
example: '["train/getGradientNorm", "
|
|
3997
|
+
example: '["train/getGradientNorm", {"layers": [{"type": "dense", "units": 2}]}]'
|
|
4002
3998
|
},
|
|
4003
3999
|
// ============================================================================
|
|
4004
4000
|
// Weight Operations
|
|
@@ -4015,7 +4011,7 @@ var TRAIN_OPERATORS = {
|
|
|
4015
4011
|
{ name: "module", type: "nn/module", description: "The neural network" },
|
|
4016
4012
|
{ name: "maxMagnitude", type: "number", description: "Maximum weight magnitude" }
|
|
4017
4013
|
],
|
|
4018
|
-
example: '["train/clipWeights", "
|
|
4014
|
+
example: '["train/clipWeights", {"layers": [{"type": "dense", "units": 2}]}, 10.0]'
|
|
4019
4015
|
},
|
|
4020
4016
|
"train/getMaxWeightMagnitude": {
|
|
4021
4017
|
module: "train",
|
|
@@ -4028,7 +4024,7 @@ var TRAIN_OPERATORS = {
|
|
|
4028
4024
|
params: [
|
|
4029
4025
|
{ name: "module", type: "nn/module", description: "The neural network" }
|
|
4030
4026
|
],
|
|
4031
|
-
example: '["train/getMaxWeightMagnitude", "
|
|
4027
|
+
example: '["train/getMaxWeightMagnitude", {"layers": [{"type": "dense", "units": 2}]}]'
|
|
4032
4028
|
},
|
|
4033
4029
|
// ============================================================================
|
|
4034
4030
|
// Loss Functions
|
|
@@ -4045,7 +4041,7 @@ var TRAIN_OPERATORS = {
|
|
|
4045
4041
|
{ name: "predicted", type: "tensor", description: "Predicted values" },
|
|
4046
4042
|
{ name: "target", type: "tensor", description: "Target values" }
|
|
4047
4043
|
],
|
|
4048
|
-
example: '["train/mse",
|
|
4044
|
+
example: '["train/mse", [0.5, 0.7], [1, 0]]'
|
|
4049
4045
|
},
|
|
4050
4046
|
"train/crossEntropy": {
|
|
4051
4047
|
module: "train",
|
|
@@ -4059,7 +4055,7 @@ var TRAIN_OPERATORS = {
|
|
|
4059
4055
|
{ name: "logits", type: "tensor", description: "Raw model outputs (logits)" },
|
|
4060
4056
|
{ name: "labels", type: "tensor", description: "Target class labels" }
|
|
4061
4057
|
],
|
|
4062
|
-
example: '["train/crossEntropy",
|
|
4058
|
+
example: '["train/crossEntropy", [2.0, 0.5], [1, 0]]'
|
|
4063
4059
|
},
|
|
4064
4060
|
"train/huber": {
|
|
4065
4061
|
module: "train",
|
|
@@ -4074,7 +4070,7 @@ var TRAIN_OPERATORS = {
|
|
|
4074
4070
|
{ name: "target", type: "tensor", description: "Target values" },
|
|
4075
4071
|
{ name: "delta", type: "number", description: "Threshold for quadratic vs linear", optional: true, defaultValue: 1 }
|
|
4076
4072
|
],
|
|
4077
|
-
example: '["train/huber",
|
|
4073
|
+
example: '["train/huber", [0.5, 1.2], [1, 0], 1.0]'
|
|
4078
4074
|
},
|
|
4079
4075
|
// ============================================================================
|
|
4080
4076
|
// Optimizers
|
|
@@ -4092,7 +4088,7 @@ var TRAIN_OPERATORS = {
|
|
|
4092
4088
|
{ name: "lr", type: "number", description: "Learning rate" },
|
|
4093
4089
|
{ name: "momentum", type: "number", description: "Momentum factor", optional: true, defaultValue: 0 }
|
|
4094
4090
|
],
|
|
4095
|
-
example: '["train/sgd", "
|
|
4091
|
+
example: '["train/sgd", {"layers": [{"type": "dense", "units": 2}]}, 0.01, 0.9]'
|
|
4096
4092
|
},
|
|
4097
4093
|
"train/adam": {
|
|
4098
4094
|
module: "train",
|
|
@@ -4108,7 +4104,7 @@ var TRAIN_OPERATORS = {
|
|
|
4108
4104
|
{ name: "beta1", type: "number", description: "First moment decay", optional: true, defaultValue: 0.9 },
|
|
4109
4105
|
{ name: "beta2", type: "number", description: "Second moment decay", optional: true, defaultValue: 0.999 }
|
|
4110
4106
|
],
|
|
4111
|
-
example: '["train/adam", "
|
|
4107
|
+
example: '["train/adam", {"layers": [{"type": "dense", "units": 2}]}, 0.001]'
|
|
4112
4108
|
},
|
|
4113
4109
|
// ============================================================================
|
|
4114
4110
|
// Experience Replay (for RL)
|
|
@@ -4125,7 +4121,7 @@ var TRAIN_OPERATORS = {
|
|
|
4125
4121
|
{ name: "buffer", type: "array", description: "Experience buffer" },
|
|
4126
4122
|
{ name: "batchSize", type: "number", description: "Number of samples" }
|
|
4127
4123
|
],
|
|
4128
|
-
example: '["train/sampleBatch", "
|
|
4124
|
+
example: '["train/sampleBatch", [{"state": [0], "reward": 1}, {"state": [1], "reward": 0}], 2]'
|
|
4129
4125
|
},
|
|
4130
4126
|
"train/computeReturns": {
|
|
4131
4127
|
module: "train",
|
|
@@ -4139,7 +4135,7 @@ var TRAIN_OPERATORS = {
|
|
|
4139
4135
|
{ name: "rewards", type: "array", description: "Array of rewards" },
|
|
4140
4136
|
{ name: "gamma", type: "number", description: "Discount factor" }
|
|
4141
4137
|
],
|
|
4142
|
-
example: '["train/computeReturns",
|
|
4138
|
+
example: '["train/computeReturns", [1, 0, 1], 0.99]'
|
|
4143
4139
|
},
|
|
4144
4140
|
"train/computeAdvantages": {
|
|
4145
4141
|
module: "train",
|
|
@@ -4154,7 +4150,7 @@ var TRAIN_OPERATORS = {
|
|
|
4154
4150
|
{ name: "values", type: "tensor", description: "Value estimates" },
|
|
4155
4151
|
{ name: "config", type: "object", description: "Config with gamma, lambda" }
|
|
4156
4152
|
],
|
|
4157
|
-
example: '["train/computeAdvantages",
|
|
4153
|
+
example: '["train/computeAdvantages", [1, 0, 1], [0.5, 0.4, 0.3], { "gamma": 0.99, "lambda": 0.95 }]'
|
|
4158
4154
|
},
|
|
4159
4155
|
// ============================================================================
|
|
4160
4156
|
// ML lifecycle effects (bare aliases invoked by std ML behaviors)
|
|
@@ -4172,7 +4168,7 @@ var TRAIN_OPERATORS = {
|
|
|
4172
4168
|
{ name: "data", type: "array", description: "Training data (optional)" },
|
|
4173
4169
|
{ name: "config", type: "object", description: "Training config (optional)" }
|
|
4174
4170
|
],
|
|
4175
|
-
example: '["train", "
|
|
4171
|
+
example: '["train", {"layers": [{"type": "dense", "units": 2}]}, [[0, 1], [1, 0]], { "epochs": 100 }]'
|
|
4176
4172
|
},
|
|
4177
4173
|
"evaluate": {
|
|
4178
4174
|
module: "train",
|
|
@@ -4186,7 +4182,7 @@ var TRAIN_OPERATORS = {
|
|
|
4186
4182
|
{ name: "model", type: "nn/module", description: "The neural network module" },
|
|
4187
4183
|
{ name: "testCases", type: "array", description: "Test cases (optional)" }
|
|
4188
4184
|
],
|
|
4189
|
-
example: '["evaluate", "
|
|
4185
|
+
example: '["evaluate", {"layers": [{"type": "dense", "units": 2}]}, [{"input": [0], "expected": [1]}]]'
|
|
4190
4186
|
},
|
|
4191
4187
|
"checkpoint/save": {
|
|
4192
4188
|
module: "train",
|
|
@@ -4200,7 +4196,7 @@ var TRAIN_OPERATORS = {
|
|
|
4200
4196
|
{ name: "model", type: "nn/module", description: "The neural network module" },
|
|
4201
4197
|
{ name: "key", type: "string", description: "Checkpoint identifier" }
|
|
4202
4198
|
],
|
|
4203
|
-
example: '["checkpoint/save", "
|
|
4199
|
+
example: '["checkpoint/save", {"layers": [{"type": "dense", "units": 2}]}, "ckpt-1"]'
|
|
4204
4200
|
},
|
|
4205
4201
|
"checkpoint/load": {
|
|
4206
4202
|
module: "train",
|
|
@@ -4213,7 +4209,7 @@ var TRAIN_OPERATORS = {
|
|
|
4213
4209
|
params: [
|
|
4214
4210
|
{ name: "key", type: "string", description: "Checkpoint identifier" }
|
|
4215
4211
|
],
|
|
4216
|
-
example: '["checkpoint/load", "
|
|
4212
|
+
example: '["checkpoint/load", "ckpt-1"]'
|
|
4217
4213
|
}
|
|
4218
4214
|
};
|
|
4219
4215
|
|
|
@@ -4233,7 +4229,7 @@ var GRAPH_OPERATORS = {
|
|
|
4233
4229
|
params: [
|
|
4234
4230
|
{ name: "config", type: "object", description: "Graph construction config (nodes, edges, node-features, edge-features, directed)" }
|
|
4235
4231
|
],
|
|
4236
|
-
example: '["graph/from-entities", { "
|
|
4232
|
+
example: '["graph/from-entities", [{ "age": 30, "score": 0.5 }, { "age": 25, "score": 0.7 }]]'
|
|
4237
4233
|
},
|
|
4238
4234
|
"graph/from-adjacency": {
|
|
4239
4235
|
module: "graph",
|
|
@@ -4247,7 +4243,7 @@ var GRAPH_OPERATORS = {
|
|
|
4247
4243
|
{ name: "adjacency", type: "tensor", description: "Adjacency matrix" },
|
|
4248
4244
|
{ name: "features", type: "tensor", description: "Node feature matrix" }
|
|
4249
4245
|
],
|
|
4250
|
-
example: '["graph/from-adjacency",
|
|
4246
|
+
example: '["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]'
|
|
4251
4247
|
},
|
|
4252
4248
|
"graph/from-edge-list": {
|
|
4253
4249
|
module: "graph",
|
|
@@ -4261,7 +4257,7 @@ var GRAPH_OPERATORS = {
|
|
|
4261
4257
|
{ name: "edges", type: "tensor", description: "Edge index tensor [2, num_edges]" },
|
|
4262
4258
|
{ name: "features", type: "tensor", description: "Node feature matrix" }
|
|
4263
4259
|
],
|
|
4264
|
-
example: '["graph/from-edge-list",
|
|
4260
|
+
example: '["graph/from-edge-list", [[0, 1]], [[1.0], [2.0]]]'
|
|
4265
4261
|
},
|
|
4266
4262
|
// ============================================================================
|
|
4267
4263
|
// Transforms
|
|
@@ -4277,7 +4273,7 @@ var GRAPH_OPERATORS = {
|
|
|
4277
4273
|
params: [
|
|
4278
4274
|
{ name: "graph", type: "graph", description: "Input graph" }
|
|
4279
4275
|
],
|
|
4280
|
-
example: '["graph/add-self-loops", "
|
|
4276
|
+
example: '["graph/add-self-loops", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]'
|
|
4281
4277
|
},
|
|
4282
4278
|
"graph/to-undirected": {
|
|
4283
4279
|
module: "graph",
|
|
@@ -4290,7 +4286,7 @@ var GRAPH_OPERATORS = {
|
|
|
4290
4286
|
params: [
|
|
4291
4287
|
{ name: "graph", type: "graph", description: "Input graph" }
|
|
4292
4288
|
],
|
|
4293
|
-
example: '["graph/to-undirected", "
|
|
4289
|
+
example: '["graph/to-undirected", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]'
|
|
4294
4290
|
},
|
|
4295
4291
|
"graph/subgraph": {
|
|
4296
4292
|
module: "graph",
|
|
@@ -4304,7 +4300,7 @@ var GRAPH_OPERATORS = {
|
|
|
4304
4300
|
{ name: "graph", type: "graph", description: "Input graph" },
|
|
4305
4301
|
{ name: "mask", type: "tensor", description: "Boolean node mask" }
|
|
4306
4302
|
],
|
|
4307
|
-
example: '["graph/subgraph", "
|
|
4303
|
+
example: '["graph/subgraph", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]], [true, false]]'
|
|
4308
4304
|
},
|
|
4309
4305
|
"graph/k-hop": {
|
|
4310
4306
|
module: "graph",
|
|
@@ -4319,7 +4315,7 @@ var GRAPH_OPERATORS = {
|
|
|
4319
4315
|
{ name: "node", type: "number", description: "Center node index" },
|
|
4320
4316
|
{ name: "k", type: "number", description: "Number of hops" }
|
|
4321
4317
|
],
|
|
4322
|
-
example: '["graph/k-hop", "
|
|
4318
|
+
example: '["graph/k-hop", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]], 0, 2]'
|
|
4323
4319
|
},
|
|
4324
4320
|
// ============================================================================
|
|
4325
4321
|
// Accessors
|
|
@@ -4335,7 +4331,7 @@ var GRAPH_OPERATORS = {
|
|
|
4335
4331
|
params: [
|
|
4336
4332
|
{ name: "graph", type: "graph", description: "Input graph" }
|
|
4337
4333
|
],
|
|
4338
|
-
example: '["graph/node-features", "
|
|
4334
|
+
example: '["graph/node-features", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]'
|
|
4339
4335
|
},
|
|
4340
4336
|
"graph/edge-index": {
|
|
4341
4337
|
module: "graph",
|
|
@@ -4348,7 +4344,7 @@ var GRAPH_OPERATORS = {
|
|
|
4348
4344
|
params: [
|
|
4349
4345
|
{ name: "graph", type: "graph", description: "Input graph" }
|
|
4350
4346
|
],
|
|
4351
|
-
example: '["graph/edge-index", "
|
|
4347
|
+
example: '["graph/edge-index", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]'
|
|
4352
4348
|
},
|
|
4353
4349
|
"graph/edge-features": {
|
|
4354
4350
|
module: "graph",
|
|
@@ -4361,7 +4357,7 @@ var GRAPH_OPERATORS = {
|
|
|
4361
4357
|
params: [
|
|
4362
4358
|
{ name: "graph", type: "graph", description: "Input graph" }
|
|
4363
4359
|
],
|
|
4364
|
-
example: '["graph/edge-features", "
|
|
4360
|
+
example: '["graph/edge-features", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]'
|
|
4365
4361
|
},
|
|
4366
4362
|
"graph/num-nodes": {
|
|
4367
4363
|
module: "graph",
|
|
@@ -4374,7 +4370,7 @@ var GRAPH_OPERATORS = {
|
|
|
4374
4370
|
params: [
|
|
4375
4371
|
{ name: "graph", type: "graph", description: "Input graph" }
|
|
4376
4372
|
],
|
|
4377
|
-
example: '["graph/num-nodes", "
|
|
4373
|
+
example: '["graph/num-nodes", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]'
|
|
4378
4374
|
},
|
|
4379
4375
|
"graph/num-edges": {
|
|
4380
4376
|
module: "graph",
|
|
@@ -4387,7 +4383,7 @@ var GRAPH_OPERATORS = {
|
|
|
4387
4383
|
params: [
|
|
4388
4384
|
{ name: "graph", type: "graph", description: "Input graph" }
|
|
4389
4385
|
],
|
|
4390
|
-
example: '["graph/num-edges", "
|
|
4386
|
+
example: '["graph/num-edges", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]'
|
|
4391
4387
|
},
|
|
4392
4388
|
"graph/degree": {
|
|
4393
4389
|
module: "graph",
|
|
@@ -4400,7 +4396,7 @@ var GRAPH_OPERATORS = {
|
|
|
4400
4396
|
params: [
|
|
4401
4397
|
{ name: "graph", type: "graph", description: "Input graph" }
|
|
4402
4398
|
],
|
|
4403
|
-
example: '["graph/degree", "
|
|
4399
|
+
example: '["graph/degree", ["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]'
|
|
4404
4400
|
},
|
|
4405
4401
|
// ============================================================================
|
|
4406
4402
|
// Batching
|
|
@@ -4416,7 +4412,7 @@ var GRAPH_OPERATORS = {
|
|
|
4416
4412
|
params: [
|
|
4417
4413
|
{ name: "graphs", type: "array", description: "List of graphs" }
|
|
4418
4414
|
],
|
|
4419
|
-
example: '["graph/batch", "
|
|
4415
|
+
example: '["graph/batch", [["graph/from-adjacency", [[0, 1], [1, 0]], [[1.0], [2.0]]]]]'
|
|
4420
4416
|
}
|
|
4421
4417
|
};
|
|
4422
4418
|
|
|
@@ -4437,7 +4433,7 @@ var CONTRACT_OPERATORS = {
|
|
|
4437
4433
|
{ name: "tensor", type: "tensor", description: "Input tensor" },
|
|
4438
4434
|
{ name: "contract", type: "object", description: "Input contract spec" }
|
|
4439
4435
|
],
|
|
4440
|
-
example: '["contract/validate-input",
|
|
4436
|
+
example: '["contract/validate-input", [0.5, 0.7], {"ranges": {"0": {"min": 0, "max": 1}, "1": {"min": 0, "max": 1}}}]'
|
|
4441
4437
|
},
|
|
4442
4438
|
"contract/validate-output": {
|
|
4443
4439
|
module: "contract",
|
|
@@ -4451,7 +4447,7 @@ var CONTRACT_OPERATORS = {
|
|
|
4451
4447
|
{ name: "tensor", type: "tensor", description: "Output tensor" },
|
|
4452
4448
|
{ name: "contract", type: "object", description: "Output contract spec" }
|
|
4453
4449
|
],
|
|
4454
|
-
example: '["contract/validate-output",
|
|
4450
|
+
example: '["contract/validate-output", [0.5, 0.7], {"ranges": {"0": {"min": 0, "max": 1}, "1": {"min": 0, "max": 1}}}]'
|
|
4455
4451
|
},
|
|
4456
4452
|
"contract/clamp-output": {
|
|
4457
4453
|
module: "contract",
|
|
@@ -4465,7 +4461,7 @@ var CONTRACT_OPERATORS = {
|
|
|
4465
4461
|
{ name: "tensor", type: "tensor", description: "Output tensor" },
|
|
4466
4462
|
{ name: "contract", type: "object", description: "Output contract spec" }
|
|
4467
4463
|
],
|
|
4468
|
-
example: '["contract/clamp-output",
|
|
4464
|
+
example: '["contract/clamp-output", [0.5, 1.7], {"ranges": {"0": {"min": 0, "max": 1}, "1": {"min": 0, "max": 1}}}]'
|
|
4469
4465
|
},
|
|
4470
4466
|
"contract/violations": {
|
|
4471
4467
|
module: "contract",
|
|
@@ -4479,7 +4475,7 @@ var CONTRACT_OPERATORS = {
|
|
|
4479
4475
|
{ name: "tensor", type: "tensor", description: "Tensor to check" },
|
|
4480
4476
|
{ name: "contract", type: "object", description: "Contract spec" }
|
|
4481
4477
|
],
|
|
4482
|
-
example: '["contract/violations",
|
|
4478
|
+
example: '["contract/violations", [0.5, 1.7], {"ranges": {"0": {"min": 0, "max": 1}, "1": {"min": 0, "max": 1}}}]'
|
|
4483
4479
|
},
|
|
4484
4480
|
// ============================================================================
|
|
4485
4481
|
// Conversion
|
|
@@ -4496,7 +4492,7 @@ var CONTRACT_OPERATORS = {
|
|
|
4496
4492
|
{ name: "entity", type: "object", description: "Entity data" },
|
|
4497
4493
|
{ name: "contract", type: "object", description: "Input contract mapping fields to dims" }
|
|
4498
4494
|
],
|
|
4499
|
-
example: '["contract/entity-to-tensor", "
|
|
4495
|
+
example: '["contract/entity-to-tensor", {"price": 10, "qty": 2}, {"fields": ["price", "qty"]}]'
|
|
4500
4496
|
},
|
|
4501
4497
|
"contract/tensor-to-payload": {
|
|
4502
4498
|
module: "contract",
|
|
@@ -4510,7 +4506,7 @@ var CONTRACT_OPERATORS = {
|
|
|
4510
4506
|
{ name: "tensor", type: "tensor", description: "Output tensor" },
|
|
4511
4507
|
{ name: "contract", type: "object", description: "Output contract mapping dims to fields" }
|
|
4512
4508
|
],
|
|
4513
|
-
example: '["contract/tensor-to-payload",
|
|
4509
|
+
example: '["contract/tensor-to-payload", [0.5, 0.7], {"fields": ["price", "qty"]}]'
|
|
4514
4510
|
}
|
|
4515
4511
|
};
|
|
4516
4512
|
|
|
@@ -4531,7 +4527,7 @@ var DATA_OPERATORS = {
|
|
|
4531
4527
|
{ name: "entities", type: "array", description: "Entity collection" },
|
|
4532
4528
|
{ name: "contracts", type: "object", description: "Input/output contract pair" }
|
|
4533
4529
|
],
|
|
4534
|
-
example: '["data/dataset", "
|
|
4530
|
+
example: '["data/dataset", [{"x": 1, "y": 2}], {"input": {"fields": ["x"]}, "output": {"fields": ["y"]}}]'
|
|
4535
4531
|
},
|
|
4536
4532
|
"data/dataloader": {
|
|
4537
4533
|
module: "data",
|
|
@@ -4545,7 +4541,7 @@ var DATA_OPERATORS = {
|
|
|
4545
4541
|
{ name: "dataset", type: "object", description: "Dataset" },
|
|
4546
4542
|
{ name: "config", type: "object", description: "Config with batch_size, shuffle, etc." }
|
|
4547
4543
|
],
|
|
4548
|
-
example: '["data/dataloader", "
|
|
4544
|
+
example: '["data/dataloader", ["data/dataset", [[1, 2], [3, 4], [5, 6]], {}], { "batch-size": 2, "shuffle": true }]'
|
|
4549
4545
|
},
|
|
4550
4546
|
"data/split": {
|
|
4551
4547
|
module: "data",
|
|
@@ -4559,7 +4555,7 @@ var DATA_OPERATORS = {
|
|
|
4559
4555
|
{ name: "dataset", type: "object", description: "Dataset" },
|
|
4560
4556
|
{ name: "config", type: "object", description: "Split config, e.g. { trainRatio: 0.8 }" }
|
|
4561
4557
|
],
|
|
4562
|
-
example: '["data/split", "
|
|
4558
|
+
example: '["data/split", ["data/dataset", [1, 2, 3, 4, 5], {}], { "trainRatio": 0.8 }]'
|
|
4563
4559
|
},
|
|
4564
4560
|
// ============================================================================
|
|
4565
4561
|
// Preprocessing
|
|
@@ -4576,7 +4572,7 @@ var DATA_OPERATORS = {
|
|
|
4576
4572
|
{ name: "tensor", type: "tensor", description: "Feature tensor" },
|
|
4577
4573
|
{ name: "config", type: "object", description: "Normalization config (method, per_dim, etc.)" }
|
|
4578
4574
|
],
|
|
4579
|
-
example: '["data/normalize",
|
|
4575
|
+
example: '["data/normalize", [[1, 2], [3, 4]], { "method": "standard" }]'
|
|
4580
4576
|
},
|
|
4581
4577
|
"data/augment": {
|
|
4582
4578
|
module: "data",
|
|
@@ -4590,7 +4586,7 @@ var DATA_OPERATORS = {
|
|
|
4590
4586
|
{ name: "dataset", type: "object", description: "Dataset" },
|
|
4591
4587
|
{ name: "config", type: "object", description: "Augmentation config" }
|
|
4592
4588
|
],
|
|
4593
|
-
example: '["data/augment",
|
|
4589
|
+
example: '["data/augment", [[1.0, 2.0], [3.0, 4.0]], { "flip": true, "rotate": 15 }]'
|
|
4594
4590
|
},
|
|
4595
4591
|
// ============================================================================
|
|
4596
4592
|
// Tokenization & Padding
|
|
@@ -4607,7 +4603,7 @@ var DATA_OPERATORS = {
|
|
|
4607
4603
|
{ name: "text", type: "string", description: "Text to tokenize" },
|
|
4608
4604
|
{ name: "config", type: "object", description: "Tokenizer config (method, vocab_size, max_length)" }
|
|
4609
4605
|
],
|
|
4610
|
-
example: '["data/tokenize", "
|
|
4606
|
+
example: '["data/tokenize", "hello world", { "method": "bpe", "max-length": 512 }]'
|
|
4611
4607
|
},
|
|
4612
4608
|
"data/pad": {
|
|
4613
4609
|
module: "data",
|
|
@@ -4621,7 +4617,7 @@ var DATA_OPERATORS = {
|
|
|
4621
4617
|
{ name: "sequences", type: "array", description: "List of token sequences" },
|
|
4622
4618
|
{ name: "config", type: "object", description: "Padding config (max_length, pad_value)" }
|
|
4623
4619
|
],
|
|
4624
|
-
example: '["data/pad",
|
|
4620
|
+
example: '["data/pad", [[1, 2, 3], [4, 5]], { "max-length": 4, "pad-value": 0 }]'
|
|
4625
4621
|
}
|
|
4626
4622
|
};
|
|
4627
4623
|
|
|
@@ -4731,7 +4727,7 @@ var PROB_OPERATORS = {
|
|
|
4731
4727
|
hasSideEffects: true,
|
|
4732
4728
|
returnType: "void",
|
|
4733
4729
|
params: [{ name: "predicate", type: "boolean", description: "Condition that must hold" }],
|
|
4734
|
-
example: '["prob/condition", [">",
|
|
4730
|
+
example: '["prob/condition", [">", 5, 0]]'
|
|
4735
4731
|
},
|
|
4736
4732
|
"prob/sample": {
|
|
4737
4733
|
module: "prob",
|
|
@@ -4761,7 +4757,7 @@ var PROB_OPERATORS = {
|
|
|
4761
4757
|
{ name: "query", type: "SExpr", description: "Query expression (lazy, value to collect)" },
|
|
4762
4758
|
{ name: "n", type: "number", description: "Number of samples to attempt" }
|
|
4763
4759
|
],
|
|
4764
|
-
example: '["prob/posterior",
|
|
4760
|
+
example: '["prob/posterior", ["prob/gaussian", 0, 1], [0.5], "mu", 5000]'
|
|
4765
4761
|
},
|
|
4766
4762
|
"prob/infer": {
|
|
4767
4763
|
module: "prob",
|
|
@@ -4777,7 +4773,7 @@ var PROB_OPERATORS = {
|
|
|
4777
4773
|
{ name: "query", type: "SExpr", description: "Query expression (lazy)" },
|
|
4778
4774
|
{ name: "n", type: "number", description: "Number of samples to attempt" }
|
|
4779
4775
|
],
|
|
4780
|
-
example: '["prob/infer",
|
|
4776
|
+
example: '["prob/infer", ["prob/gaussian", 0, 1], [0.5], "mu", 5000]'
|
|
4781
4777
|
},
|
|
4782
4778
|
// ========================================
|
|
4783
4779
|
// Statistics
|
|
@@ -4844,7 +4840,7 @@ var PROB_OPERATORS = {
|
|
|
4844
4840
|
{ name: "samples", type: "number[]", description: "Array of numeric samples" },
|
|
4845
4841
|
{ name: "alpha", type: "number", description: "Significance level (e.g., 0.05 for 95% interval)" }
|
|
4846
4842
|
],
|
|
4847
|
-
example: '["prob/credible-interval",
|
|
4843
|
+
example: '["prob/credible-interval", [1, 2, 3, 4, 5], 0.05] // => [lo, hi]'
|
|
4848
4844
|
}
|
|
4849
4845
|
};
|
|
4850
4846
|
|
|
@@ -5032,7 +5028,7 @@ var BROWSER_OPERATORS = {
|
|
|
5032
5028
|
kind: "custom",
|
|
5033
5029
|
produces: "string"
|
|
5034
5030
|
},
|
|
5035
|
-
example: '["browser/clipboard-write", "
|
|
5031
|
+
example: '["browser/clipboard-write", "https://example.com/invite/abc", { "emit": { "success": "COPIED", "failure": "COPY_DENIED" } }]'
|
|
5036
5032
|
},
|
|
5037
5033
|
"browser/push-subscribe": {
|
|
5038
5034
|
module: "browser",
|
|
@@ -5829,7 +5825,7 @@ var LLM_OPERATORS = {
|
|
|
5829
5825
|
{ name: "messages", type: { kind: "array", of: "LlmMessage" }, description: "Conversation messages" },
|
|
5830
5826
|
{ name: "tools", type: { kind: "array", of: "LlmToolDef" }, description: "Tool definitions available to the LLM" }
|
|
5831
5827
|
],
|
|
5832
|
-
example: '["llm/call-tools",
|
|
5828
|
+
example: '["llm/call-tools", [{"role": "user", "content": "What time is it?"}], [{"name": "getTime", "description": "Get current time", "parameters": {}}]]'
|
|
5833
5829
|
},
|
|
5834
5830
|
"llm/embed": {
|
|
5835
5831
|
module: "llm",
|
|
@@ -5853,7 +5849,7 @@ var LLM_OPERATORS = {
|
|
|
5853
5849
|
hasSideEffects: false,
|
|
5854
5850
|
returnType: "number",
|
|
5855
5851
|
params: [],
|
|
5856
|
-
example: '["llm/token-count"] => 12450'
|
|
5852
|
+
example: '["llm/token-count"] // => 12450'
|
|
5857
5853
|
},
|
|
5858
5854
|
"llm/switch": {
|
|
5859
5855
|
module: "llm",
|
|
@@ -5909,7 +5905,7 @@ var WORKSPACE_OPERATORS = {
|
|
|
5909
5905
|
{ name: "name", type: "string", description: "Orbital name" },
|
|
5910
5906
|
{ name: "def", type: { kind: "entityRef" }, description: "Orbital definition to write" }
|
|
5911
5907
|
],
|
|
5912
|
-
example: '["workspace/write-orbital", "ProductOrbital",
|
|
5908
|
+
example: '["workspace/write-orbital", "ProductOrbital", {"name": "ProductOrbital"}]'
|
|
5913
5909
|
},
|
|
5914
5910
|
"workspace/read-file": {
|
|
5915
5911
|
module: "workspace",
|
|
@@ -5934,7 +5930,7 @@ var WORKSPACE_OPERATORS = {
|
|
|
5934
5930
|
{ name: "path", type: "string", description: "File path relative to workspace root" },
|
|
5935
5931
|
{ name: "content", type: "string", description: "File content" }
|
|
5936
5932
|
],
|
|
5937
|
-
example: '["workspace/write-file", "orbitals/Product.orb",
|
|
5933
|
+
example: '["workspace/write-file", "orbitals/Product.orb", {"orbitals": []}]'
|
|
5938
5934
|
},
|
|
5939
5935
|
"workspace/exists": {
|
|
5940
5936
|
module: "workspace",
|
|
@@ -5956,7 +5952,7 @@ var WORKSPACE_OPERATORS = {
|
|
|
5956
5952
|
hasSideEffects: false,
|
|
5957
5953
|
returnType: "array",
|
|
5958
5954
|
params: [],
|
|
5959
|
-
example: '["workspace/list-orbitals"] => ["ProductOrbital", "CartOrbital"]'
|
|
5955
|
+
example: '["workspace/list-orbitals"] // => ["ProductOrbital", "CartOrbital"]'
|
|
5960
5956
|
},
|
|
5961
5957
|
"workspace/read-schema": {
|
|
5962
5958
|
module: "workspace",
|
|
@@ -5978,7 +5974,7 @@ var WORKSPACE_OPERATORS = {
|
|
|
5978
5974
|
hasSideEffects: true,
|
|
5979
5975
|
returnType: "void",
|
|
5980
5976
|
params: [{ name: "schema", type: { kind: "entityRef" }, description: "Composed schema" }],
|
|
5981
|
-
example: '["workspace/write-schema",
|
|
5977
|
+
example: '["workspace/write-schema", {"orbitals": [{"name": "ProductOrbital"}]}]'
|
|
5982
5978
|
},
|
|
5983
5979
|
"workspace/read-plan": {
|
|
5984
5980
|
module: "workspace",
|
|
@@ -6000,7 +5996,7 @@ var WORKSPACE_OPERATORS = {
|
|
|
6000
5996
|
hasSideEffects: true,
|
|
6001
5997
|
returnType: "void",
|
|
6002
5998
|
params: [{ name: "snapshot", type: { kind: "object", fields: { id: "string", status: "string" } }, description: "Plan snapshot" }],
|
|
6003
|
-
example: '["workspace/write-plan",
|
|
5999
|
+
example: '["workspace/write-plan", ["create entity", "add list page"]]'
|
|
6004
6000
|
},
|
|
6005
6001
|
"workspace/archive-orbital": {
|
|
6006
6002
|
module: "workspace",
|
|
@@ -6040,7 +6036,7 @@ var SESSION_OPERATORS = {
|
|
|
6040
6036
|
{ name: "orbitalName", type: "string", description: "Orbital name" },
|
|
6041
6037
|
{ name: "spec", type: { kind: "object", fields: { orbitalName: "string", organism: "string", method: "string" } }, description: "Orbital spec" }
|
|
6042
6038
|
],
|
|
6043
|
-
example: '["session/write-spec", "ProductOrbital",
|
|
6039
|
+
example: '["session/write-spec", "ProductOrbital", {"goal": "manage products"}]'
|
|
6044
6040
|
},
|
|
6045
6041
|
"session/read-memory": {
|
|
6046
6042
|
module: "session",
|
|
@@ -6065,7 +6061,7 @@ var SESSION_OPERATORS = {
|
|
|
6065
6061
|
{ name: "orbitalName", type: "string", description: "Orbital name" },
|
|
6066
6062
|
{ name: "memory", type: { kind: "object", fields: { entityName: "string", notes: { kind: "array", of: "string" } }, open: true }, description: "Orbital memory" }
|
|
6067
6063
|
],
|
|
6068
|
-
example: '["session/write-memory", "ProductOrbital",
|
|
6064
|
+
example: '["session/write-memory", "ProductOrbital", {"notes": ["initial draft"]}]'
|
|
6069
6065
|
},
|
|
6070
6066
|
"session/read-history": {
|
|
6071
6067
|
module: "session",
|
|
@@ -6090,7 +6086,7 @@ var SESSION_OPERATORS = {
|
|
|
6090
6086
|
{ name: "orbitalName", type: "string", description: "Orbital name" },
|
|
6091
6087
|
{ name: "entry", type: { kind: "object", fields: { role: "string", content: "string" } }, description: "History entry" }
|
|
6092
6088
|
],
|
|
6093
|
-
example: '["session/append-history", "ProductOrbital", { role: "user", content: "Add a search bar" }]'
|
|
6089
|
+
example: '["session/append-history", "ProductOrbital", { "role": "user", "content": "Add a search bar" }]'
|
|
6094
6090
|
},
|
|
6095
6091
|
"session/read-errors": {
|
|
6096
6092
|
module: "session",
|
|
@@ -6115,7 +6111,7 @@ var SESSION_OPERATORS = {
|
|
|
6115
6111
|
{ name: "orbitalName", type: "string", description: "Orbital name" },
|
|
6116
6112
|
{ name: "errors", type: { kind: "array", of: "ValidationError" }, description: "Validation errors" }
|
|
6117
6113
|
],
|
|
6118
|
-
example: '["session/write-errors", "ProductOrbital",
|
|
6114
|
+
example: '["session/write-errors", "ProductOrbital", []]'
|
|
6119
6115
|
},
|
|
6120
6116
|
"session/read-analysis": {
|
|
6121
6117
|
module: "session",
|
|
@@ -6190,7 +6186,7 @@ var TRACE_OPERATORS = {
|
|
|
6190
6186
|
{ name: "event", type: "string", description: "Event type name" },
|
|
6191
6187
|
{ name: "payload", type: { kind: "object", fields: {}, open: true }, description: "Event payload", optional: true }
|
|
6192
6188
|
],
|
|
6193
|
-
example: '["trace/emit", "coordinator_state_changed", {
|
|
6189
|
+
example: '["trace/emit", "coordinator_state_changed", {"phase": "planning"}]'
|
|
6194
6190
|
},
|
|
6195
6191
|
"trace/log": {
|
|
6196
6192
|
module: "trace",
|
|
@@ -6245,7 +6241,7 @@ var BEHAVIOR_OPERATORS = {
|
|
|
6245
6241
|
{ name: "orbitalName", type: "string", description: "Canonical orbital name to instantiate" },
|
|
6246
6242
|
{ name: "overrides", type: { kind: "object", fields: { linkedEntity: "string", method: "string" }, open: true }, description: "Override surface: linkedEntity, events, config, fields", optional: true }
|
|
6247
6243
|
],
|
|
6248
|
-
example: '["behavior/instantiate", "std-ecommerce", "ProductOrbital", { linkedEntity: "Product" }]'
|
|
6244
|
+
example: '["behavior/instantiate", "std-ecommerce", "ProductOrbital", { "linkedEntity": "Product" }]'
|
|
6249
6245
|
},
|
|
6250
6246
|
"behavior/call": {
|
|
6251
6247
|
module: "behavior",
|
|
@@ -6275,7 +6271,7 @@ var BEHAVIOR_OPERATORS = {
|
|
|
6275
6271
|
{ name: "palette", type: { kind: "object", fields: { topics: { kind: "array", of: "string" }, hints: { kind: "array", of: "string" } } }, description: "Topic-tree palette + primitive hints" },
|
|
6276
6272
|
{ name: "deltaPrompt", type: "string", description: "Per-orbital instruction prompt" }
|
|
6277
6273
|
],
|
|
6278
|
-
example: '["lolo/emit-body", "PlayerOrbital", { topics: ["game/2d"] }, "player ship with movement"]'
|
|
6274
|
+
example: '["lolo/emit-body", "PlayerOrbital", { "topics": ["game/2d"] }, "player ship with movement"]'
|
|
6279
6275
|
},
|
|
6280
6276
|
"validate/validate": {
|
|
6281
6277
|
module: "behavior",
|
|
@@ -6309,7 +6305,7 @@ var INTEGRATION_OPERATORS = {
|
|
|
6309
6305
|
{ name: "responseSchema", type: { kind: "object", fields: {}, open: true }, description: "JSON Schema the response must satisfy" },
|
|
6310
6306
|
{ name: "body", type: { kind: "object", fields: {}, open: true }, description: "Request body (for POST/PUT)", optional: true }
|
|
6311
6307
|
],
|
|
6312
|
-
example: '["integration/http", "GET", "https://api.github.com/repos/foo/bar", { name: "string", stars: "number" }]'
|
|
6308
|
+
example: '["integration/http", "GET", "https://api.github.com/repos/foo/bar", { "name": "string", "stars": "number" }]'
|
|
6313
6309
|
},
|
|
6314
6310
|
"integration/github-get-repo": {
|
|
6315
6311
|
module: "integration",
|