@almadar/std 16.212.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/behaviors/lolo/agent/organisms/std-agent-rabit.lolo +1 -0
- package/behaviors/lolo/infra/atoms/std-notification-center.lolo +19 -1
- package/behaviors/lolo/ui/core/atoms/std-rating-review.lolo +214 -3
- package/behaviors/lolo/ui/core/molecules/ui-data-grid.lolo +13 -0
- package/behaviors/lolo/ui/core/molecules/ui-data-list.lolo +13 -0
- package/behaviors/lolo/ui/core/molecules/ui-table-view.lolo +13 -0
- package/behaviors/lolo/ui/core/organisms/ui-entity-table.lolo +13 -0
- package/behaviors/lolo/ui/game/atoms/ui-canvas-2d.lolo +2 -2
- package/behaviors/lolo/ui/game/atoms/ui-canvas.lolo +2 -2
- package/behaviors/lolo/ui/game/atoms/ui-control-grid.lolo +2 -2
- package/behaviors/lolo/ui/learning/atoms/ui-math-canvas.lolo +2 -2
- package/behaviors/registry/agent/organisms/std-agent-rabit.orb +8 -0
- package/behaviors/registry/infra/atoms/std-notification-center.orb +176 -1
- package/behaviors/registry/ui/core/atoms/std-rating-review.orb +443 -2
- package/behaviors/registry/ui/core/molecules/ui-data-grid.orb +58 -0
- package/behaviors/registry/ui/core/molecules/ui-data-list.orb +58 -0
- package/behaviors/registry/ui/core/molecules/ui-table-view.orb +58 -0
- package/behaviors/registry/ui/core/organisms/ui-entity-table.orb +58 -0
- package/behaviors/registry/ui/game/atoms/ui-canvas-2d.orb +2 -2
- package/behaviors/registry/ui/game/atoms/ui-canvas.orb +2 -2
- package/behaviors/registry/ui/game/atoms/ui-control-grid.orb +2 -2
- package/behaviors/registry/ui/learning/atoms/ui-math-canvas.orb +2 -2
- package/canonical-operators.json +322 -234
- package/dist/behaviors/exports-reader.js +626 -6
- package/dist/behaviors/functions/index.d.ts +27 -13
- package/dist/behaviors/functions/index.js +624 -7
- package/dist/behaviors/index.d.ts +1 -1
- package/dist/behaviors/index.js +627 -7
- package/dist/behaviors/query.js +626 -6
- package/dist/behaviors-embeddings.hash.json +3 -3
- package/dist/behaviors-embeddings.json +1 -1
- package/dist/behaviors-registry.json +293 -309
- package/dist/index.d.ts +1 -1
- package/dist/index.js +824 -208
- package/dist/knob-embeddings.hash.json +3 -3
- package/dist/knob-embeddings.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/factory-signatures.json +1 -1
- package/dist/registry.js +197 -201
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ var INTEGRATION_OPERATORS = {
|
|
|
14
14
|
{ name: "responseSchema", type: { kind: "object", fields: {}, open: true }, description: "JSON Schema the response must satisfy" },
|
|
15
15
|
{ name: "body", type: { kind: "object", fields: {}, open: true }, description: "Request body (for POST/PUT)", optional: true }
|
|
16
16
|
],
|
|
17
|
-
example: '["integration/http", "GET", "https://api.github.com/repos/foo/bar", { name: "string", stars: "number" }]'
|
|
17
|
+
example: '["integration/http", "GET", "https://api.github.com/repos/foo/bar", { "name": "string", "stars": "number" }]'
|
|
18
18
|
},
|
|
19
19
|
"integration/github-get-repo": {
|
|
20
20
|
module: "integration",
|
package/dist/modules/llm.js
CHANGED
|
@@ -26,7 +26,7 @@ var LLM_OPERATORS = {
|
|
|
26
26
|
{ name: "messages", type: { kind: "array", of: "LlmMessage" }, description: "Conversation messages" },
|
|
27
27
|
{ name: "tools", type: { kind: "array", of: "LlmToolDef" }, description: "Tool definitions available to the LLM" }
|
|
28
28
|
],
|
|
29
|
-
example: '["llm/call-tools",
|
|
29
|
+
example: '["llm/call-tools", [{"role": "user", "content": "What time is it?"}], [{"name": "getTime", "description": "Get current time", "parameters": {}}]]'
|
|
30
30
|
},
|
|
31
31
|
"llm/embed": {
|
|
32
32
|
module: "llm",
|
|
@@ -50,7 +50,7 @@ var LLM_OPERATORS = {
|
|
|
50
50
|
hasSideEffects: false,
|
|
51
51
|
returnType: "number",
|
|
52
52
|
params: [],
|
|
53
|
-
example: '["llm/token-count"] => 12450'
|
|
53
|
+
example: '["llm/token-count"] // => 12450'
|
|
54
54
|
},
|
|
55
55
|
"llm/switch": {
|
|
56
56
|
module: "llm",
|
package/dist/modules/nn.js
CHANGED
|
@@ -124,7 +124,7 @@ var NN_OPERATORS = {
|
|
|
124
124
|
{ name: "module", type: "nn/module", description: "The neural network module" },
|
|
125
125
|
{ name: "input", type: "tensor", description: "Input tensor" }
|
|
126
126
|
],
|
|
127
|
-
example: '["nn/forward", "
|
|
127
|
+
example: '["nn/forward", {"layers": [{"type": "dense", "units": 2}]}, [0.1, 0.2]]'
|
|
128
128
|
},
|
|
129
129
|
"nn/getWeights": {
|
|
130
130
|
module: "nn",
|
|
@@ -137,7 +137,7 @@ var NN_OPERATORS = {
|
|
|
137
137
|
params: [
|
|
138
138
|
{ name: "module", type: "nn/module", description: "The neural network module" }
|
|
139
139
|
],
|
|
140
|
-
example: '["nn/getWeights", "
|
|
140
|
+
example: '["nn/getWeights", {"layers": [{"type": "dense", "units": 2}]}]'
|
|
141
141
|
},
|
|
142
142
|
"nn/setWeights": {
|
|
143
143
|
module: "nn",
|
|
@@ -151,7 +151,7 @@ var NN_OPERATORS = {
|
|
|
151
151
|
{ name: "module", type: "nn/module", description: "The neural network module" },
|
|
152
152
|
{ name: "weights", type: "tensor", description: "New weights as flat tensor" }
|
|
153
153
|
],
|
|
154
|
-
example: '["nn/setWeights", "
|
|
154
|
+
example: '["nn/setWeights", {"layers": [{"type": "dense", "units": 2}]}, [0.1, 0.2, 0.3]]'
|
|
155
155
|
},
|
|
156
156
|
"nn/paramCount": {
|
|
157
157
|
module: "nn",
|
|
@@ -164,7 +164,7 @@ var NN_OPERATORS = {
|
|
|
164
164
|
params: [
|
|
165
165
|
{ name: "module", type: "nn/module", description: "The neural network module" }
|
|
166
166
|
],
|
|
167
|
-
example: '["nn/paramCount", "
|
|
167
|
+
example: '["nn/paramCount", {"layers": [{"type": "dense", "units": 2}]}]'
|
|
168
168
|
},
|
|
169
169
|
"nn/clone": {
|
|
170
170
|
module: "nn",
|
|
@@ -177,7 +177,7 @@ var NN_OPERATORS = {
|
|
|
177
177
|
params: [
|
|
178
178
|
{ name: "module", type: "nn/module", description: "The neural network module to clone" }
|
|
179
179
|
],
|
|
180
|
-
example: '["nn/clone", "
|
|
180
|
+
example: '["nn/clone", {"layers": [{"type": "dense", "units": 2}]}]'
|
|
181
181
|
},
|
|
182
182
|
// ============================================================================
|
|
183
183
|
// ML lifecycle effect (bare alias invoked by std ML behaviors)
|
|
@@ -194,7 +194,7 @@ var NN_OPERATORS = {
|
|
|
194
194
|
{ name: "model", type: "nn/module", description: "The neural network module" },
|
|
195
195
|
{ name: "input", type: "tensor", description: "Input tensor" }
|
|
196
196
|
],
|
|
197
|
-
example: '["forward", "
|
|
197
|
+
example: '["forward", {"layers": [{"type": "dense", "units": 2}]}, [0.5]]'
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
function getNnOperators() {
|
package/dist/modules/object.js
CHANGED
|
@@ -58,7 +58,7 @@ var OBJECT_OPERATORS = {
|
|
|
58
58
|
{ name: "path", type: "string", description: 'Dot-separated path (e.g., "user.name")' },
|
|
59
59
|
{ name: "default", type: "any", description: "Default if path not found", optional: true }
|
|
60
60
|
],
|
|
61
|
-
example: '["object/get", "
|
|
61
|
+
example: '["object/get", {"profile": {"name": "Ann"}}, "profile.name", "Anonymous"]'
|
|
62
62
|
},
|
|
63
63
|
"object/set": {
|
|
64
64
|
module: "object",
|
|
@@ -73,7 +73,7 @@ var OBJECT_OPERATORS = {
|
|
|
73
73
|
{ name: "path", type: "string", description: "Dot-separated path" },
|
|
74
74
|
{ name: "value", type: "any", description: "Value to set" }
|
|
75
75
|
],
|
|
76
|
-
example: '["object/set", "
|
|
76
|
+
example: '["object/set", {"profile": {"name": "Ann"}}, "profile.name", "John"]'
|
|
77
77
|
},
|
|
78
78
|
"object/has": {
|
|
79
79
|
module: "object",
|
|
@@ -87,7 +87,7 @@ var OBJECT_OPERATORS = {
|
|
|
87
87
|
{ name: "obj", type: "object", description: "The object" },
|
|
88
88
|
{ name: "path", type: "string", description: "Dot-separated path" }
|
|
89
89
|
],
|
|
90
|
-
example: '["object/has", "
|
|
90
|
+
example: '["object/has", {"profile": {"name": "Ann"}}, "profile.name"]'
|
|
91
91
|
},
|
|
92
92
|
"object/merge": {
|
|
93
93
|
module: "object",
|
|
@@ -124,7 +124,7 @@ var OBJECT_OPERATORS = {
|
|
|
124
124
|
{ name: "obj", type: "object", description: "The object" },
|
|
125
125
|
{ name: "keys", type: "array", description: "Keys to keep" }
|
|
126
126
|
],
|
|
127
|
-
example: '["object/pick", "@
|
|
127
|
+
example: '["object/pick", {"name": "Ann", "email": "ann@example.com", "age": 30}, ["name", "email"]]'
|
|
128
128
|
},
|
|
129
129
|
"object/omit": {
|
|
130
130
|
module: "object",
|
|
@@ -138,7 +138,7 @@ var OBJECT_OPERATORS = {
|
|
|
138
138
|
{ name: "obj", type: "object", description: "The object" },
|
|
139
139
|
{ name: "keys", type: "array", description: "Keys to exclude" }
|
|
140
140
|
],
|
|
141
|
-
example: '["object/omit", "
|
|
141
|
+
example: '["object/omit", {"name": "Ann", "password": "x"}, ["password"]]'
|
|
142
142
|
},
|
|
143
143
|
"object/mapValues": {
|
|
144
144
|
module: "object",
|
|
@@ -154,7 +154,7 @@ var OBJECT_OPERATORS = {
|
|
|
154
154
|
{ name: "obj", type: "object", description: "The object" },
|
|
155
155
|
{ name: "fn", type: "lambda", description: "Transform function" }
|
|
156
156
|
],
|
|
157
|
-
example: '["object/mapValues", "
|
|
157
|
+
example: '["object/mapValues", {"a": 0.5, "b": 0.25}, ["fn", "v", ["*", "@v", 100]]]'
|
|
158
158
|
},
|
|
159
159
|
"object/mapKeys": {
|
|
160
160
|
module: "object",
|
|
@@ -170,7 +170,7 @@ var OBJECT_OPERATORS = {
|
|
|
170
170
|
{ name: "obj", type: "object", description: "The object" },
|
|
171
171
|
{ name: "fn", type: "lambda", description: "Transform function" }
|
|
172
172
|
],
|
|
173
|
-
example: '["object/mapKeys", "
|
|
173
|
+
example: '["object/mapKeys", {"a": 1, "b": 2}, ["fn", "k", ["str/upper", "@k"]]]'
|
|
174
174
|
},
|
|
175
175
|
"object/filter": {
|
|
176
176
|
module: "object",
|
|
@@ -186,7 +186,7 @@ var OBJECT_OPERATORS = {
|
|
|
186
186
|
{ name: "obj", type: "object", description: "The object" },
|
|
187
187
|
{ name: "pred", type: "lambda", description: "Predicate (key, value) => boolean" }
|
|
188
188
|
],
|
|
189
|
-
example: '["object/filter", "
|
|
189
|
+
example: '["object/filter", {"a": 1, "b": null}, ["fn", ["k", "v"], ["!=", "@v", null]]]'
|
|
190
190
|
},
|
|
191
191
|
"object/equals": {
|
|
192
192
|
module: "object",
|
|
@@ -211,7 +211,7 @@ var OBJECT_OPERATORS = {
|
|
|
211
211
|
hasSideEffects: false,
|
|
212
212
|
returnType: "any",
|
|
213
213
|
params: [{ name: "obj", type: "object", description: "The object" }],
|
|
214
|
-
example: '["object/clone", "
|
|
214
|
+
example: '["object/clone", {"a": 1, "b": 2}]'
|
|
215
215
|
},
|
|
216
216
|
"object/deepClone": {
|
|
217
217
|
module: "object",
|
|
@@ -222,7 +222,7 @@ var OBJECT_OPERATORS = {
|
|
|
222
222
|
hasSideEffects: false,
|
|
223
223
|
returnType: "any",
|
|
224
224
|
params: [{ name: "obj", type: "object", description: "The object" }],
|
|
225
|
-
example: '["object/deepClone", "
|
|
225
|
+
example: '["object/deepClone", {"a": {"b": 2}}]'
|
|
226
226
|
},
|
|
227
227
|
"path": {
|
|
228
228
|
module: "object",
|
|
@@ -236,7 +236,7 @@ var OBJECT_OPERATORS = {
|
|
|
236
236
|
params: [
|
|
237
237
|
{ name: "...segments", type: "string[]", description: "Path segments to join with dots" }
|
|
238
238
|
],
|
|
239
|
-
example: '["path", "formValues", "
|
|
239
|
+
example: '["path", "formValues", "customerName"] // => "formValues.customerName"'
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
242
|
function getObjectOperators() {
|
package/dist/modules/prob.js
CHANGED
|
@@ -104,7 +104,7 @@ var PROB_OPERATORS = {
|
|
|
104
104
|
hasSideEffects: true,
|
|
105
105
|
returnType: "void",
|
|
106
106
|
params: [{ name: "predicate", type: "boolean", description: "Condition that must hold" }],
|
|
107
|
-
example: '["prob/condition", [">",
|
|
107
|
+
example: '["prob/condition", [">", 5, 0]]'
|
|
108
108
|
},
|
|
109
109
|
"prob/sample": {
|
|
110
110
|
module: "prob",
|
|
@@ -134,7 +134,7 @@ var PROB_OPERATORS = {
|
|
|
134
134
|
{ name: "query", type: "SExpr", description: "Query expression (lazy, value to collect)" },
|
|
135
135
|
{ name: "n", type: "number", description: "Number of samples to attempt" }
|
|
136
136
|
],
|
|
137
|
-
example: '["prob/posterior",
|
|
137
|
+
example: '["prob/posterior", ["prob/gaussian", 0, 1], [0.5], "mu", 5000]'
|
|
138
138
|
},
|
|
139
139
|
"prob/infer": {
|
|
140
140
|
module: "prob",
|
|
@@ -150,7 +150,7 @@ var PROB_OPERATORS = {
|
|
|
150
150
|
{ name: "query", type: "SExpr", description: "Query expression (lazy)" },
|
|
151
151
|
{ name: "n", type: "number", description: "Number of samples to attempt" }
|
|
152
152
|
],
|
|
153
|
-
example: '["prob/infer",
|
|
153
|
+
example: '["prob/infer", ["prob/gaussian", 0, 1], [0.5], "mu", 5000]'
|
|
154
154
|
},
|
|
155
155
|
// ========================================
|
|
156
156
|
// Statistics
|
|
@@ -217,7 +217,7 @@ var PROB_OPERATORS = {
|
|
|
217
217
|
{ name: "samples", type: "number[]", description: "Array of numeric samples" },
|
|
218
218
|
{ name: "alpha", type: "number", description: "Significance level (e.g., 0.05 for 95% interval)" }
|
|
219
219
|
],
|
|
220
|
-
example: '["prob/credible-interval",
|
|
220
|
+
example: '["prob/credible-interval", [1, 2, 3, 4, 5], 0.05] // => [lo, hi]'
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
function getProbOperators() {
|
package/dist/modules/session.js
CHANGED
|
@@ -23,7 +23,7 @@ var SESSION_OPERATORS = {
|
|
|
23
23
|
{ name: "orbitalName", type: "string", description: "Orbital name" },
|
|
24
24
|
{ name: "spec", type: { kind: "object", fields: { orbitalName: "string", organism: "string", method: "string" } }, description: "Orbital spec" }
|
|
25
25
|
],
|
|
26
|
-
example: '["session/write-spec", "ProductOrbital",
|
|
26
|
+
example: '["session/write-spec", "ProductOrbital", {"goal": "manage products"}]'
|
|
27
27
|
},
|
|
28
28
|
"session/read-memory": {
|
|
29
29
|
module: "session",
|
|
@@ -48,7 +48,7 @@ var SESSION_OPERATORS = {
|
|
|
48
48
|
{ name: "orbitalName", type: "string", description: "Orbital name" },
|
|
49
49
|
{ name: "memory", type: { kind: "object", fields: { entityName: "string", notes: { kind: "array", of: "string" } }, open: true }, description: "Orbital memory" }
|
|
50
50
|
],
|
|
51
|
-
example: '["session/write-memory", "ProductOrbital",
|
|
51
|
+
example: '["session/write-memory", "ProductOrbital", {"notes": ["initial draft"]}]'
|
|
52
52
|
},
|
|
53
53
|
"session/read-history": {
|
|
54
54
|
module: "session",
|
|
@@ -73,7 +73,7 @@ var SESSION_OPERATORS = {
|
|
|
73
73
|
{ name: "orbitalName", type: "string", description: "Orbital name" },
|
|
74
74
|
{ name: "entry", type: { kind: "object", fields: { role: "string", content: "string" } }, description: "History entry" }
|
|
75
75
|
],
|
|
76
|
-
example: '["session/append-history", "ProductOrbital", { role: "user", content: "Add a search bar" }]'
|
|
76
|
+
example: '["session/append-history", "ProductOrbital", { "role": "user", "content": "Add a search bar" }]'
|
|
77
77
|
},
|
|
78
78
|
"session/read-errors": {
|
|
79
79
|
module: "session",
|
|
@@ -98,7 +98,7 @@ var SESSION_OPERATORS = {
|
|
|
98
98
|
{ name: "orbitalName", type: "string", description: "Orbital name" },
|
|
99
99
|
{ name: "errors", type: { kind: "array", of: "ValidationError" }, description: "Validation errors" }
|
|
100
100
|
],
|
|
101
|
-
example: '["session/write-errors", "ProductOrbital",
|
|
101
|
+
example: '["session/write-errors", "ProductOrbital", []]'
|
|
102
102
|
},
|
|
103
103
|
"session/read-analysis": {
|
|
104
104
|
module: "session",
|
package/dist/modules/str.js
CHANGED
|
@@ -20,7 +20,7 @@ var STR_OPERATORS = {
|
|
|
20
20
|
hasSideEffects: false,
|
|
21
21
|
returnType: "string",
|
|
22
22
|
params: [{ name: "strings", type: "string", description: "Strings to concatenate" }],
|
|
23
|
-
example: '["str/concat", "/users/", "
|
|
23
|
+
example: '["str/concat", "/users/", "123"] // => "/users/123"'
|
|
24
24
|
},
|
|
25
25
|
"str/upper": {
|
|
26
26
|
module: "str",
|
package/dist/modules/tensor.js
CHANGED
|
@@ -82,7 +82,7 @@ var TENSOR_OPERATORS = {
|
|
|
82
82
|
params: [
|
|
83
83
|
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
84
84
|
],
|
|
85
|
-
example: '["tensor/shape",
|
|
85
|
+
example: '["tensor/shape", [[1, 2], [3, 4]]] // => [2, 2]'
|
|
86
86
|
},
|
|
87
87
|
"tensor/get": {
|
|
88
88
|
module: "tensor",
|
|
@@ -96,7 +96,7 @@ var TENSOR_OPERATORS = {
|
|
|
96
96
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
97
97
|
{ name: "index", type: "number | number[]", description: "Index (single for 1D, array for multi-D)" }
|
|
98
98
|
],
|
|
99
|
-
example: '["tensor/get",
|
|
99
|
+
example: '["tensor/get", [10, 20, 30, 40], 3] // Get 4th element'
|
|
100
100
|
},
|
|
101
101
|
"tensor/slice": {
|
|
102
102
|
module: "tensor",
|
|
@@ -111,7 +111,7 @@ var TENSOR_OPERATORS = {
|
|
|
111
111
|
{ name: "start", type: "number", description: "Start index" },
|
|
112
112
|
{ name: "end", type: "number", description: "End index (exclusive)" }
|
|
113
113
|
],
|
|
114
|
-
example: '["tensor/slice",
|
|
114
|
+
example: '["tensor/slice", [10, 20, 30, 40], 0, 3] // First 3 elements'
|
|
115
115
|
},
|
|
116
116
|
"tensor/reshape": {
|
|
117
117
|
module: "tensor",
|
|
@@ -125,7 +125,7 @@ var TENSOR_OPERATORS = {
|
|
|
125
125
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
126
126
|
{ name: "shape", type: "number[]", description: "New shape" }
|
|
127
127
|
],
|
|
128
|
-
example: '["tensor/reshape",
|
|
128
|
+
example: '["tensor/reshape", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [4, 4]] // Reshape to 4x4'
|
|
129
129
|
},
|
|
130
130
|
"tensor/flatten": {
|
|
131
131
|
module: "tensor",
|
|
@@ -138,7 +138,7 @@ var TENSOR_OPERATORS = {
|
|
|
138
138
|
params: [
|
|
139
139
|
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
140
140
|
],
|
|
141
|
-
example: '["tensor/flatten",
|
|
141
|
+
example: '["tensor/flatten", [[1, 2], [3, 4]]]'
|
|
142
142
|
},
|
|
143
143
|
// ============================================================================
|
|
144
144
|
// Math Operations
|
|
@@ -155,7 +155,7 @@ var TENSOR_OPERATORS = {
|
|
|
155
155
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
156
156
|
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
157
157
|
],
|
|
158
|
-
example: '["tensor/add",
|
|
158
|
+
example: '["tensor/add", [1, 2], [3, 4]]'
|
|
159
159
|
},
|
|
160
160
|
"tensor/sub": {
|
|
161
161
|
module: "tensor",
|
|
@@ -169,7 +169,7 @@ var TENSOR_OPERATORS = {
|
|
|
169
169
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
170
170
|
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
171
171
|
],
|
|
172
|
-
example: '["tensor/sub",
|
|
172
|
+
example: '["tensor/sub", [1, 2], [3, 4]]'
|
|
173
173
|
},
|
|
174
174
|
"tensor/mul": {
|
|
175
175
|
module: "tensor",
|
|
@@ -183,7 +183,7 @@ var TENSOR_OPERATORS = {
|
|
|
183
183
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
184
184
|
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
185
185
|
],
|
|
186
|
-
example: '["tensor/mul",
|
|
186
|
+
example: '["tensor/mul", [0.5, 0.7], 0.99] // Decay weights'
|
|
187
187
|
},
|
|
188
188
|
"tensor/div": {
|
|
189
189
|
module: "tensor",
|
|
@@ -197,7 +197,7 @@ var TENSOR_OPERATORS = {
|
|
|
197
197
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
198
198
|
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
199
199
|
],
|
|
200
|
-
example: '["tensor/div",
|
|
200
|
+
example: '["tensor/div", [10, 20], 2]'
|
|
201
201
|
},
|
|
202
202
|
"tensor/matmul": {
|
|
203
203
|
module: "tensor",
|
|
@@ -211,7 +211,7 @@ var TENSOR_OPERATORS = {
|
|
|
211
211
|
{ name: "a", type: "tensor", description: "First tensor (NxM)" },
|
|
212
212
|
{ name: "b", type: "tensor", description: "Second tensor (MxK)" }
|
|
213
213
|
],
|
|
214
|
-
example: '["tensor/matmul",
|
|
214
|
+
example: '["tensor/matmul", [[1, 2], [3, 4]], [[5, 6], [7, 8]]]'
|
|
215
215
|
},
|
|
216
216
|
"tensor/dot": {
|
|
217
217
|
module: "tensor",
|
|
@@ -225,7 +225,7 @@ var TENSOR_OPERATORS = {
|
|
|
225
225
|
{ name: "a", type: "tensor", description: "First vector" },
|
|
226
226
|
{ name: "b", type: "tensor", description: "Second vector" }
|
|
227
227
|
],
|
|
228
|
-
example: '["tensor/dot",
|
|
228
|
+
example: '["tensor/dot", [1, 2], [3, 4]]'
|
|
229
229
|
},
|
|
230
230
|
// ============================================================================
|
|
231
231
|
// Reductions
|
|
@@ -242,7 +242,7 @@ var TENSOR_OPERATORS = {
|
|
|
242
242
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
243
243
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
244
244
|
],
|
|
245
|
-
example: '["tensor/sum",
|
|
245
|
+
example: '["tensor/sum", [1, 0, 1]] // Total reward'
|
|
246
246
|
},
|
|
247
247
|
"tensor/mean": {
|
|
248
248
|
module: "tensor",
|
|
@@ -256,7 +256,7 @@ var TENSOR_OPERATORS = {
|
|
|
256
256
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
257
257
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
258
258
|
],
|
|
259
|
-
example: '["tensor/mean",
|
|
259
|
+
example: '["tensor/mean", [0.2, 0.4, 0.6]]'
|
|
260
260
|
},
|
|
261
261
|
"tensor/max": {
|
|
262
262
|
module: "tensor",
|
|
@@ -270,7 +270,7 @@ var TENSOR_OPERATORS = {
|
|
|
270
270
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
271
271
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
272
272
|
],
|
|
273
|
-
example: '["tensor/max",
|
|
273
|
+
example: '["tensor/max", [0.1, 0.9, 0.3]]'
|
|
274
274
|
},
|
|
275
275
|
"tensor/min": {
|
|
276
276
|
module: "tensor",
|
|
@@ -284,7 +284,7 @@ var TENSOR_OPERATORS = {
|
|
|
284
284
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
285
285
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
286
286
|
],
|
|
287
|
-
example: '["tensor/min",
|
|
287
|
+
example: '["tensor/min", [3, 1, 2]]'
|
|
288
288
|
},
|
|
289
289
|
"tensor/argmax": {
|
|
290
290
|
module: "tensor",
|
|
@@ -298,7 +298,7 @@ var TENSOR_OPERATORS = {
|
|
|
298
298
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
299
299
|
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
300
300
|
],
|
|
301
|
-
example: '["tensor/argmax",
|
|
301
|
+
example: '["tensor/argmax", [0.1, 0.9, 0.3]] // Best action index'
|
|
302
302
|
},
|
|
303
303
|
"tensor/norm": {
|
|
304
304
|
module: "tensor",
|
|
@@ -312,7 +312,7 @@ var TENSOR_OPERATORS = {
|
|
|
312
312
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
313
313
|
{ name: "p", type: "number", description: "Norm order (default 2)", optional: true, defaultValue: 2 }
|
|
314
314
|
],
|
|
315
|
-
example: '["tensor/norm",
|
|
315
|
+
example: '["tensor/norm", [3, 4]]'
|
|
316
316
|
},
|
|
317
317
|
// ============================================================================
|
|
318
318
|
// Range Validation (for contracts)
|
|
@@ -329,7 +329,7 @@ var TENSOR_OPERATORS = {
|
|
|
329
329
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
330
330
|
{ name: "range", type: "[number, number]", description: "Range as [min, max]" }
|
|
331
331
|
],
|
|
332
|
-
example: '["tensor/allInRange",
|
|
332
|
+
example: '["tensor/allInRange", [0.5, -0.2], [-1.0, 1.0]]'
|
|
333
333
|
},
|
|
334
334
|
"tensor/outOfRangeIndices": {
|
|
335
335
|
module: "tensor",
|
|
@@ -343,7 +343,7 @@ var TENSOR_OPERATORS = {
|
|
|
343
343
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
344
344
|
{ name: "range", type: "[number, number]", description: "Range as [min, max]" }
|
|
345
345
|
],
|
|
346
|
-
example: '["tensor/outOfRangeIndices",
|
|
346
|
+
example: '["tensor/outOfRangeIndices", [0.5, 1.5], [-1.0, 1.0]]'
|
|
347
347
|
},
|
|
348
348
|
"tensor/clamp": {
|
|
349
349
|
module: "tensor",
|
|
@@ -358,7 +358,7 @@ var TENSOR_OPERATORS = {
|
|
|
358
358
|
{ name: "min", type: "number", description: "Minimum value" },
|
|
359
359
|
{ name: "max", type: "number", description: "Maximum value" }
|
|
360
360
|
],
|
|
361
|
-
example: '["tensor/clamp",
|
|
361
|
+
example: '["tensor/clamp", [5, -15, 3], -10.0, 10.0]'
|
|
362
362
|
},
|
|
363
363
|
"tensor/clampPerDim": {
|
|
364
364
|
module: "tensor",
|
|
@@ -372,7 +372,7 @@ var TENSOR_OPERATORS = {
|
|
|
372
372
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
373
373
|
{ name: "ranges", type: "object", description: 'Per-dimension ranges { "0": {min, max}, ... }' }
|
|
374
374
|
],
|
|
375
|
-
example: '["tensor/clampPerDim", "
|
|
375
|
+
example: '["tensor/clampPerDim", [5, -15], {"0": {"min": 0, "max": 10}, "1": {"min": -10, "max": 10}}]'
|
|
376
376
|
},
|
|
377
377
|
"tensor/outOfRangeDims": {
|
|
378
378
|
module: "tensor",
|
|
@@ -386,7 +386,7 @@ var TENSOR_OPERATORS = {
|
|
|
386
386
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
387
387
|
{ name: "ranges", type: "object", description: 'Per-dimension ranges { "0": {min, max}, ... }' }
|
|
388
388
|
],
|
|
389
|
-
example: '["tensor/outOfRangeDims", "
|
|
389
|
+
example: '["tensor/outOfRangeDims", [5, -15], {"0": {"min": 0, "max": 10}, "1": {"min": -10, "max": 10}}]'
|
|
390
390
|
},
|
|
391
391
|
// ============================================================================
|
|
392
392
|
// Conversion
|
|
@@ -402,7 +402,7 @@ var TENSOR_OPERATORS = {
|
|
|
402
402
|
params: [
|
|
403
403
|
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
404
404
|
],
|
|
405
|
-
example: '["tensor/toArray",
|
|
405
|
+
example: '["tensor/toArray", [[1, 2], [3, 4]]]'
|
|
406
406
|
},
|
|
407
407
|
"tensor/toList": {
|
|
408
408
|
module: "tensor",
|
|
@@ -415,7 +415,7 @@ var TENSOR_OPERATORS = {
|
|
|
415
415
|
params: [
|
|
416
416
|
{ name: "tensor", type: "tensor", description: "The tensor (must be 1D)" }
|
|
417
417
|
],
|
|
418
|
-
example: '["tensor/toList",
|
|
418
|
+
example: '["tensor/toList", [1, 2, 3]]'
|
|
419
419
|
},
|
|
420
420
|
// ============================================================================
|
|
421
421
|
// Concatenation / stacking / shape manipulation
|
|
@@ -432,7 +432,7 @@ var TENSOR_OPERATORS = {
|
|
|
432
432
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
433
433
|
{ name: "b", type: "tensor", description: "Second tensor" }
|
|
434
434
|
],
|
|
435
|
-
example: '["tensor/cat",
|
|
435
|
+
example: '["tensor/cat", [1, 2], [3, 4]]'
|
|
436
436
|
},
|
|
437
437
|
"tensor/stack": {
|
|
438
438
|
module: "tensor",
|
|
@@ -446,7 +446,7 @@ var TENSOR_OPERATORS = {
|
|
|
446
446
|
{ name: "a", type: "tensor", description: "First tensor" },
|
|
447
447
|
{ name: "b", type: "tensor", description: "Second tensor" }
|
|
448
448
|
],
|
|
449
|
-
example: '["tensor/stack",
|
|
449
|
+
example: '["tensor/stack", [1, 2], [3, 4]]'
|
|
450
450
|
},
|
|
451
451
|
"tensor/transpose": {
|
|
452
452
|
module: "tensor",
|
|
@@ -461,7 +461,7 @@ var TENSOR_OPERATORS = {
|
|
|
461
461
|
{ name: "dim0", type: "number", description: "First dimension to swap (optional)" },
|
|
462
462
|
{ name: "dim1", type: "number", description: "Second dimension to swap (optional)" }
|
|
463
463
|
],
|
|
464
|
-
example: '["tensor/transpose",
|
|
464
|
+
example: '["tensor/transpose", [[1, 2], [3, 4]], 0, 1]'
|
|
465
465
|
},
|
|
466
466
|
"tensor/unsqueeze": {
|
|
467
467
|
module: "tensor",
|
|
@@ -475,7 +475,7 @@ var TENSOR_OPERATORS = {
|
|
|
475
475
|
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
476
476
|
{ name: "dim", type: "number", description: "Position to insert the new dimension" }
|
|
477
477
|
],
|
|
478
|
-
example: '["tensor/unsqueeze",
|
|
478
|
+
example: '["tensor/unsqueeze", [1, 2, 3], 0]'
|
|
479
479
|
},
|
|
480
480
|
"tensor/squeeze": {
|
|
481
481
|
module: "tensor",
|
|
@@ -488,7 +488,7 @@ var TENSOR_OPERATORS = {
|
|
|
488
488
|
params: [
|
|
489
489
|
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
490
490
|
],
|
|
491
|
-
example: '["tensor/squeeze",
|
|
491
|
+
example: '["tensor/squeeze", [[1, 2, 3]]]'
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
494
|
function getTensorOperators() {
|