@almadar/std 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +72 -0
  2. package/dist/behaviors/action-affinity.d.ts +88 -0
  3. package/dist/behaviors/action-affinity.js +290 -0
  4. package/dist/behaviors/action-affinity.js.map +1 -0
  5. package/dist/behaviors/async.d.ts +20 -0
  6. package/dist/behaviors/async.js +542 -0
  7. package/dist/behaviors/async.js.map +1 -0
  8. package/dist/behaviors/data-management.d.ts +40 -0
  9. package/dist/behaviors/data-management.js +495 -0
  10. package/dist/behaviors/data-management.js.map +1 -0
  11. package/dist/behaviors/feedback.d.ts +18 -0
  12. package/dist/behaviors/feedback.js +307 -0
  13. package/dist/behaviors/feedback.js.map +1 -0
  14. package/dist/behaviors/game-core.d.ts +40 -0
  15. package/dist/behaviors/game-core.js +443 -0
  16. package/dist/behaviors/game-core.js.map +1 -0
  17. package/dist/behaviors/game-entity.d.ts +39 -0
  18. package/dist/behaviors/game-entity.js +643 -0
  19. package/dist/behaviors/game-entity.js.map +1 -0
  20. package/dist/behaviors/game-ui.d.ts +29 -0
  21. package/dist/behaviors/game-ui.js +493 -0
  22. package/dist/behaviors/game-ui.js.map +1 -0
  23. package/dist/behaviors/index.d.ts +11 -0
  24. package/dist/behaviors/index.js +4539 -0
  25. package/dist/behaviors/index.js.map +1 -0
  26. package/dist/behaviors/registry.d.ts +103 -0
  27. package/dist/behaviors/registry.js +4166 -0
  28. package/dist/behaviors/registry.js.map +1 -0
  29. package/dist/behaviors/types.d.ts +179 -0
  30. package/dist/behaviors/types.js +111 -0
  31. package/dist/behaviors/types.js.map +1 -0
  32. package/dist/behaviors/ui-interaction.d.ts +36 -0
  33. package/dist/behaviors/ui-interaction.js +1104 -0
  34. package/dist/behaviors/ui-interaction.js.map +1 -0
  35. package/dist/index.d.ts +195 -0
  36. package/dist/index.js +8209 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/modules/array.d.ts +28 -0
  39. package/dist/modules/array.js +556 -0
  40. package/dist/modules/array.js.map +1 -0
  41. package/dist/modules/async.d.ts +22 -0
  42. package/dist/modules/async.js +112 -0
  43. package/dist/modules/async.js.map +1 -0
  44. package/dist/modules/format.d.ts +21 -0
  45. package/dist/modules/format.js +129 -0
  46. package/dist/modules/format.js.map +1 -0
  47. package/dist/modules/index.d.ts +12 -0
  48. package/dist/modules/index.js +3131 -0
  49. package/dist/modules/index.js.map +1 -0
  50. package/dist/modules/math.d.ts +22 -0
  51. package/dist/modules/math.js +215 -0
  52. package/dist/modules/math.js.map +1 -0
  53. package/dist/modules/nn.d.ts +23 -0
  54. package/dist/modules/nn.js +189 -0
  55. package/dist/modules/nn.js.map +1 -0
  56. package/dist/modules/object.d.ts +22 -0
  57. package/dist/modules/object.js +257 -0
  58. package/dist/modules/object.js.map +1 -0
  59. package/dist/modules/str.d.ts +21 -0
  60. package/dist/modules/str.js +344 -0
  61. package/dist/modules/str.js.map +1 -0
  62. package/dist/modules/tensor.d.ts +23 -0
  63. package/dist/modules/tensor.js +427 -0
  64. package/dist/modules/tensor.js.map +1 -0
  65. package/dist/modules/time.d.ts +24 -0
  66. package/dist/modules/time.js +323 -0
  67. package/dist/modules/time.js.map +1 -0
  68. package/dist/modules/train.d.ts +23 -0
  69. package/dist/modules/train.js +308 -0
  70. package/dist/modules/train.js.map +1 -0
  71. package/dist/modules/validate.d.ts +23 -0
  72. package/dist/modules/validate.js +301 -0
  73. package/dist/modules/validate.js.map +1 -0
  74. package/dist/registry.d.ts +140 -0
  75. package/dist/registry.js +3240 -0
  76. package/dist/registry.js.map +1 -0
  77. package/dist/types-I95R8_FN.d.ts +91 -0
  78. package/package.json +59 -0
@@ -0,0 +1,215 @@
1
+ // modules/math.ts
2
+ var MATH_OPERATORS = {
3
+ "math/abs": {
4
+ module: "math",
5
+ category: "std-math",
6
+ minArity: 1,
7
+ maxArity: 1,
8
+ description: "Absolute value",
9
+ hasSideEffects: false,
10
+ returnType: "number",
11
+ params: [{ name: "n", type: "number", description: "The number" }],
12
+ example: '["math/abs", -5] // => 5'
13
+ },
14
+ "math/min": {
15
+ module: "math",
16
+ category: "std-math",
17
+ minArity: 2,
18
+ maxArity: null,
19
+ description: "Minimum of values",
20
+ hasSideEffects: false,
21
+ returnType: "number",
22
+ params: [{ name: "...nums", type: "number[]", description: "Numbers to compare" }],
23
+ example: '["math/min", 3, 1, 4] // => 1'
24
+ },
25
+ "math/max": {
26
+ module: "math",
27
+ category: "std-math",
28
+ minArity: 2,
29
+ maxArity: null,
30
+ description: "Maximum of values",
31
+ hasSideEffects: false,
32
+ returnType: "number",
33
+ params: [{ name: "...nums", type: "number[]", description: "Numbers to compare" }],
34
+ example: '["math/max", 3, 1, 4] // => 4'
35
+ },
36
+ "math/clamp": {
37
+ module: "math",
38
+ category: "std-math",
39
+ minArity: 3,
40
+ maxArity: 3,
41
+ description: "Constrain value to range [min, max]",
42
+ hasSideEffects: false,
43
+ returnType: "number",
44
+ params: [
45
+ { name: "n", type: "number", description: "The value to clamp" },
46
+ { name: "min", type: "number", description: "Minimum bound" },
47
+ { name: "max", type: "number", description: "Maximum bound" }
48
+ ],
49
+ example: '["math/clamp", 150, 0, 100] // => 100'
50
+ },
51
+ "math/floor": {
52
+ module: "math",
53
+ category: "std-math",
54
+ minArity: 1,
55
+ maxArity: 1,
56
+ description: "Round down to integer",
57
+ hasSideEffects: false,
58
+ returnType: "number",
59
+ params: [{ name: "n", type: "number", description: "The number" }],
60
+ example: '["math/floor", 3.7] // => 3'
61
+ },
62
+ "math/ceil": {
63
+ module: "math",
64
+ category: "std-math",
65
+ minArity: 1,
66
+ maxArity: 1,
67
+ description: "Round up to integer",
68
+ hasSideEffects: false,
69
+ returnType: "number",
70
+ params: [{ name: "n", type: "number", description: "The number" }],
71
+ example: '["math/ceil", 3.2] // => 4'
72
+ },
73
+ "math/round": {
74
+ module: "math",
75
+ category: "std-math",
76
+ minArity: 1,
77
+ maxArity: 2,
78
+ description: "Round to nearest integer or specified decimals",
79
+ hasSideEffects: false,
80
+ returnType: "number",
81
+ params: [
82
+ { name: "n", type: "number", description: "The number" },
83
+ { name: "decimals", type: "number", description: "Decimal places", optional: true, defaultValue: 0 }
84
+ ],
85
+ example: '["math/round", 3.456, 2] // => 3.46'
86
+ },
87
+ "math/pow": {
88
+ module: "math",
89
+ category: "std-math",
90
+ minArity: 2,
91
+ maxArity: 2,
92
+ description: "Exponentiation (base^exp)",
93
+ hasSideEffects: false,
94
+ returnType: "number",
95
+ params: [
96
+ { name: "base", type: "number", description: "The base" },
97
+ { name: "exp", type: "number", description: "The exponent" }
98
+ ],
99
+ example: '["math/pow", 2, 8] // => 256'
100
+ },
101
+ "math/sqrt": {
102
+ module: "math",
103
+ category: "std-math",
104
+ minArity: 1,
105
+ maxArity: 1,
106
+ description: "Square root",
107
+ hasSideEffects: false,
108
+ returnType: "number",
109
+ params: [{ name: "n", type: "number", description: "The number" }],
110
+ example: '["math/sqrt", 16] // => 4'
111
+ },
112
+ "math/mod": {
113
+ module: "math",
114
+ category: "std-math",
115
+ minArity: 2,
116
+ maxArity: 2,
117
+ description: "Modulo (remainder)",
118
+ hasSideEffects: false,
119
+ returnType: "number",
120
+ params: [
121
+ { name: "a", type: "number", description: "Dividend" },
122
+ { name: "b", type: "number", description: "Divisor" }
123
+ ],
124
+ example: '["math/mod", 7, 3] // => 1'
125
+ },
126
+ "math/sign": {
127
+ module: "math",
128
+ category: "std-math",
129
+ minArity: 1,
130
+ maxArity: 1,
131
+ description: "Returns -1, 0, or 1 indicating sign",
132
+ hasSideEffects: false,
133
+ returnType: "number",
134
+ params: [{ name: "n", type: "number", description: "The number" }],
135
+ example: '["math/sign", -42] // => -1'
136
+ },
137
+ "math/lerp": {
138
+ module: "math",
139
+ category: "std-math",
140
+ minArity: 3,
141
+ maxArity: 3,
142
+ description: "Linear interpolation between a and b by factor t",
143
+ hasSideEffects: false,
144
+ returnType: "number",
145
+ params: [
146
+ { name: "a", type: "number", description: "Start value" },
147
+ { name: "b", type: "number", description: "End value" },
148
+ { name: "t", type: "number", description: "Interpolation factor (0-1)" }
149
+ ],
150
+ example: '["math/lerp", 0, 100, 0.5] // => 50'
151
+ },
152
+ "math/map": {
153
+ module: "math",
154
+ category: "std-math",
155
+ minArity: 5,
156
+ maxArity: 5,
157
+ description: "Map value from one range to another",
158
+ hasSideEffects: false,
159
+ returnType: "number",
160
+ params: [
161
+ { name: "n", type: "number", description: "The value" },
162
+ { name: "inMin", type: "number", description: "Input range minimum" },
163
+ { name: "inMax", type: "number", description: "Input range maximum" },
164
+ { name: "outMin", type: "number", description: "Output range minimum" },
165
+ { name: "outMax", type: "number", description: "Output range maximum" }
166
+ ],
167
+ example: '["math/map", 5, 0, 10, 0, 100] // => 50'
168
+ },
169
+ "math/random": {
170
+ module: "math",
171
+ category: "std-math",
172
+ minArity: 0,
173
+ maxArity: 0,
174
+ description: "Random number between 0 (inclusive) and 1 (exclusive)",
175
+ hasSideEffects: false,
176
+ returnType: "number",
177
+ params: [],
178
+ example: '["math/random"] // => 0.7234...'
179
+ },
180
+ "math/randomInt": {
181
+ module: "math",
182
+ category: "std-math",
183
+ minArity: 2,
184
+ maxArity: 2,
185
+ description: "Random integer in range [min, max] (inclusive)",
186
+ hasSideEffects: false,
187
+ returnType: "number",
188
+ params: [
189
+ { name: "min", type: "number", description: "Minimum (inclusive)" },
190
+ { name: "max", type: "number", description: "Maximum (inclusive)" }
191
+ ],
192
+ example: '["math/randomInt", 1, 6] // => 4'
193
+ },
194
+ "math/default": {
195
+ module: "math",
196
+ category: "std-math",
197
+ minArity: 2,
198
+ maxArity: 2,
199
+ description: "Return default if value is null, undefined, or NaN",
200
+ hasSideEffects: false,
201
+ returnType: "number",
202
+ params: [
203
+ { name: "n", type: "number | null", description: "The value" },
204
+ { name: "default", type: "number", description: "Default value" }
205
+ ],
206
+ example: '["math/default", null, 0] // => 0'
207
+ }
208
+ };
209
+ function getMathOperators() {
210
+ return Object.keys(MATH_OPERATORS);
211
+ }
212
+
213
+ export { MATH_OPERATORS, getMathOperators };
214
+ //# sourceMappingURL=math.js.map
215
+ //# sourceMappingURL=math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../modules/math.ts"],"names":[],"mappings":";AAeO,IAAM,cAAA,GAAkD;AAAA,EAC7D,UAAA,EAAY;AAAA,IACV,MAAA,EAAQ,MAAA;AAAA,IACR,QAAA,EAAU,UAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,gBAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,KAAK,IAAA,EAAM,QAAA,EAAU,WAAA,EAAa,YAAA,EAAc,CAAA;AAAA,IACjE,OAAA,EAAS;AAAA,GACX;AAAA,EACA,UAAA,EAAY;AAAA,IACV,MAAA,EAAQ,MAAA;AAAA,IACR,QAAA,EAAU,UAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,IAAA;AAAA,IACV,WAAA,EAAa,mBAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,WAAW,IAAA,EAAM,UAAA,EAAY,WAAA,EAAa,oBAAA,EAAsB,CAAA;AAAA,IACjF,OAAA,EAAS;AAAA,GACX;AAAA,EACA,UAAA,EAAY;AAAA,IACV,MAAA,EAAQ,MAAA;AAAA,IACR,QAAA,EAAU,UAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,IAAA;AAAA,IACV,WAAA,EAAa,mBAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,WAAW,IAAA,EA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"math.js","sourcesContent":["/**\n * Math Module - Numeric Operations\n *\n * Provides higher-level numeric operations beyond basic arithmetic.\n * Basic arithmetic (+, -, *, /, %) is provided by language primitives.\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * Math module operators.\n * All operators return numbers and have no side effects.\n */\nexport const MATH_OPERATORS: Record<string, StdOperatorMeta> = {\n 'math/abs': {\n module: 'math',\n category: 'std-math',\n minArity: 1,\n maxArity: 1,\n description: 'Absolute value',\n hasSideEffects: false,\n returnType: 'number',\n params: [{ name: 'n', type: 'number', description: 'The number' }],\n example: '[\"math/abs\", -5] // => 5',\n },\n 'math/min': {\n module: 'math',\n category: 'std-math',\n minArity: 2,\n maxArity: null,\n description: 'Minimum of values',\n hasSideEffects: false,\n returnType: 'number',\n params: [{ name: '...nums', type: 'number[]', description: 'Numbers to compare' }],\n example: '[\"math/min\", 3, 1, 4] // => 1',\n },\n 'math/max': {\n module: 'math',\n category: 'std-math',\n minArity: 2,\n maxArity: null,\n description: 'Maximum of values',\n hasSideEffects: false,\n returnType: 'number',\n params: [{ name: '...nums', type: 'number[]', description: 'Numbers to compare' }],\n example: '[\"math/max\", 3, 1, 4] // => 4',\n },\n 'math/clamp': {\n module: 'math',\n category: 'std-math',\n minArity: 3,\n maxArity: 3,\n description: 'Constrain value to range [min, max]',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'n', type: 'number', description: 'The value to clamp' },\n { name: 'min', type: 'number', description: 'Minimum bound' },\n { name: 'max', type: 'number', description: 'Maximum bound' },\n ],\n example: '[\"math/clamp\", 150, 0, 100] // => 100',\n },\n 'math/floor': {\n module: 'math',\n category: 'std-math',\n minArity: 1,\n maxArity: 1,\n description: 'Round down to integer',\n hasSideEffects: false,\n returnType: 'number',\n params: [{ name: 'n', type: 'number', description: 'The number' }],\n example: '[\"math/floor\", 3.7] // => 3',\n },\n 'math/ceil': {\n module: 'math',\n category: 'std-math',\n minArity: 1,\n maxArity: 1,\n description: 'Round up to integer',\n hasSideEffects: false,\n returnType: 'number',\n params: [{ name: 'n', type: 'number', description: 'The number' }],\n example: '[\"math/ceil\", 3.2] // => 4',\n },\n 'math/round': {\n module: 'math',\n category: 'std-math',\n minArity: 1,\n maxArity: 2,\n description: 'Round to nearest integer or specified decimals',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'n', type: 'number', description: 'The number' },\n { name: 'decimals', type: 'number', description: 'Decimal places', optional: true, defaultValue: 0 },\n ],\n example: '[\"math/round\", 3.456, 2] // => 3.46',\n },\n 'math/pow': {\n module: 'math',\n category: 'std-math',\n minArity: 2,\n maxArity: 2,\n description: 'Exponentiation (base^exp)',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'base', type: 'number', description: 'The base' },\n { name: 'exp', type: 'number', description: 'The exponent' },\n ],\n example: '[\"math/pow\", 2, 8] // => 256',\n },\n 'math/sqrt': {\n module: 'math',\n category: 'std-math',\n minArity: 1,\n maxArity: 1,\n description: 'Square root',\n hasSideEffects: false,\n returnType: 'number',\n params: [{ name: 'n', type: 'number', description: 'The number' }],\n example: '[\"math/sqrt\", 16] // => 4',\n },\n 'math/mod': {\n module: 'math',\n category: 'std-math',\n minArity: 2,\n maxArity: 2,\n description: 'Modulo (remainder)',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'a', type: 'number', description: 'Dividend' },\n { name: 'b', type: 'number', description: 'Divisor' },\n ],\n example: '[\"math/mod\", 7, 3] // => 1',\n },\n 'math/sign': {\n module: 'math',\n category: 'std-math',\n minArity: 1,\n maxArity: 1,\n description: 'Returns -1, 0, or 1 indicating sign',\n hasSideEffects: false,\n returnType: 'number',\n params: [{ name: 'n', type: 'number', description: 'The number' }],\n example: '[\"math/sign\", -42] // => -1',\n },\n 'math/lerp': {\n module: 'math',\n category: 'std-math',\n minArity: 3,\n maxArity: 3,\n description: 'Linear interpolation between a and b by factor t',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'a', type: 'number', description: 'Start value' },\n { name: 'b', type: 'number', description: 'End value' },\n { name: 't', type: 'number', description: 'Interpolation factor (0-1)' },\n ],\n example: '[\"math/lerp\", 0, 100, 0.5] // => 50',\n },\n 'math/map': {\n module: 'math',\n category: 'std-math',\n minArity: 5,\n maxArity: 5,\n description: 'Map value from one range to another',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'n', type: 'number', description: 'The value' },\n { name: 'inMin', type: 'number', description: 'Input range minimum' },\n { name: 'inMax', type: 'number', description: 'Input range maximum' },\n { name: 'outMin', type: 'number', description: 'Output range minimum' },\n { name: 'outMax', type: 'number', description: 'Output range maximum' },\n ],\n example: '[\"math/map\", 5, 0, 10, 0, 100] // => 50',\n },\n 'math/random': {\n module: 'math',\n category: 'std-math',\n minArity: 0,\n maxArity: 0,\n description: 'Random number between 0 (inclusive) and 1 (exclusive)',\n hasSideEffects: false,\n returnType: 'number',\n params: [],\n example: '[\"math/random\"] // => 0.7234...',\n },\n 'math/randomInt': {\n module: 'math',\n category: 'std-math',\n minArity: 2,\n maxArity: 2,\n description: 'Random integer in range [min, max] (inclusive)',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'min', type: 'number', description: 'Minimum (inclusive)' },\n { name: 'max', type: 'number', description: 'Maximum (inclusive)' },\n ],\n example: '[\"math/randomInt\", 1, 6] // => 4',\n },\n 'math/default': {\n module: 'math',\n category: 'std-math',\n minArity: 2,\n maxArity: 2,\n description: 'Return default if value is null, undefined, or NaN',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'n', type: 'number | null', description: 'The value' },\n { name: 'default', type: 'number', description: 'Default value' },\n ],\n example: '[\"math/default\", null, 0] // => 0',\n },\n};\n\n/**\n * Get all math operator names.\n */\nexport function getMathOperators(): string[] {\n return Object.keys(MATH_OPERATORS);\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import { a as StdOperatorMeta } from '../types-I95R8_FN.js';
2
+
3
+ /**
4
+ * Neural Network Module - Neural Network Operations
5
+ *
6
+ * Provides operators for defining and executing neural networks.
7
+ * Networks are defined as S-expressions and compiled to native code
8
+ * by the Rust compiler for each target backend (PyTorch, TensorFlow, etc.).
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+
13
+ /**
14
+ * Neural network module operators.
15
+ * These operators define network architecture and forward passes.
16
+ */
17
+ declare const NN_OPERATORS: Record<string, StdOperatorMeta>;
18
+ /**
19
+ * Get all nn operator names.
20
+ */
21
+ declare function getNnOperators(): string[];
22
+
23
+ export { NN_OPERATORS, getNnOperators };
@@ -0,0 +1,189 @@
1
+ // modules/nn.ts
2
+ var NN_OPERATORS = {
3
+ "nn/sequential": {
4
+ module: "nn",
5
+ category: "std-nn",
6
+ minArity: 1,
7
+ maxArity: null,
8
+ description: "Create a sequential neural network from layers",
9
+ hasSideEffects: false,
10
+ returnType: "nn/module",
11
+ params: [
12
+ { name: "...layers", type: "nn/layer[]", description: "Layers to stack sequentially" }
13
+ ],
14
+ example: '["nn/sequential", ["nn/linear", 16, 64], ["nn/relu"], ["nn/linear", 64, 4]]'
15
+ },
16
+ "nn/linear": {
17
+ module: "nn",
18
+ category: "std-nn",
19
+ minArity: 2,
20
+ maxArity: 2,
21
+ description: "Fully connected linear layer (output = input * weights + bias)",
22
+ hasSideEffects: false,
23
+ returnType: "nn/layer",
24
+ params: [
25
+ { name: "inFeatures", type: "number", description: "Input dimension" },
26
+ { name: "outFeatures", type: "number", description: "Output dimension" }
27
+ ],
28
+ example: '["nn/linear", 16, 64] // 16 inputs -> 64 outputs'
29
+ },
30
+ "nn/relu": {
31
+ module: "nn",
32
+ category: "std-nn",
33
+ minArity: 0,
34
+ maxArity: 0,
35
+ description: "ReLU activation function: max(0, x)",
36
+ hasSideEffects: false,
37
+ returnType: "nn/layer",
38
+ params: [],
39
+ example: '["nn/relu"]'
40
+ },
41
+ "nn/tanh": {
42
+ module: "nn",
43
+ category: "std-nn",
44
+ minArity: 0,
45
+ maxArity: 0,
46
+ description: "Tanh activation function: (e^x - e^-x) / (e^x + e^-x)",
47
+ hasSideEffects: false,
48
+ returnType: "nn/layer",
49
+ params: [],
50
+ example: '["nn/tanh"]'
51
+ },
52
+ "nn/sigmoid": {
53
+ module: "nn",
54
+ category: "std-nn",
55
+ minArity: 0,
56
+ maxArity: 0,
57
+ description: "Sigmoid activation function: 1 / (1 + e^-x)",
58
+ hasSideEffects: false,
59
+ returnType: "nn/layer",
60
+ params: [],
61
+ example: '["nn/sigmoid"]'
62
+ },
63
+ "nn/softmax": {
64
+ module: "nn",
65
+ category: "std-nn",
66
+ minArity: 0,
67
+ maxArity: 1,
68
+ description: "Softmax activation function (normalizes to probability distribution)",
69
+ hasSideEffects: false,
70
+ returnType: "nn/layer",
71
+ params: [
72
+ { name: "dim", type: "number", description: "Dimension to apply softmax", optional: true, defaultValue: -1 }
73
+ ],
74
+ example: '["nn/softmax"]'
75
+ },
76
+ "nn/dropout": {
77
+ module: "nn",
78
+ category: "std-nn",
79
+ minArity: 0,
80
+ maxArity: 1,
81
+ description: "Dropout layer for regularization (randomly zeros elements during training)",
82
+ hasSideEffects: false,
83
+ returnType: "nn/layer",
84
+ params: [
85
+ { name: "p", type: "number", description: "Dropout probability", optional: true, defaultValue: 0.5 }
86
+ ],
87
+ example: '["nn/dropout", 0.3] // 30% dropout'
88
+ },
89
+ "nn/batchnorm": {
90
+ module: "nn",
91
+ category: "std-nn",
92
+ minArity: 1,
93
+ maxArity: 1,
94
+ description: "Batch normalization layer",
95
+ hasSideEffects: false,
96
+ returnType: "nn/layer",
97
+ params: [
98
+ { name: "numFeatures", type: "number", description: "Number of features to normalize" }
99
+ ],
100
+ example: '["nn/batchnorm", 64]'
101
+ },
102
+ "nn/layernorm": {
103
+ module: "nn",
104
+ category: "std-nn",
105
+ minArity: 1,
106
+ maxArity: 1,
107
+ description: "Layer normalization",
108
+ hasSideEffects: false,
109
+ returnType: "nn/layer",
110
+ params: [
111
+ { name: "normalizedShape", type: "number | number[]", description: "Shape to normalize over" }
112
+ ],
113
+ example: '["nn/layernorm", 64]'
114
+ },
115
+ "nn/forward": {
116
+ module: "nn",
117
+ category: "std-nn",
118
+ minArity: 2,
119
+ maxArity: 2,
120
+ description: "Execute forward pass through network",
121
+ hasSideEffects: false,
122
+ returnType: "tensor",
123
+ params: [
124
+ { name: "module", type: "nn/module", description: "The neural network module" },
125
+ { name: "input", type: "tensor", description: "Input tensor" }
126
+ ],
127
+ example: '["nn/forward", "@entity.architecture", "@entity.sensors"]'
128
+ },
129
+ "nn/getWeights": {
130
+ module: "nn",
131
+ category: "std-nn",
132
+ minArity: 1,
133
+ maxArity: 1,
134
+ description: "Get network weights as a flat tensor",
135
+ hasSideEffects: false,
136
+ returnType: "tensor",
137
+ params: [
138
+ { name: "module", type: "nn/module", description: "The neural network module" }
139
+ ],
140
+ example: '["nn/getWeights", "@entity.architecture"]'
141
+ },
142
+ "nn/setWeights": {
143
+ module: "nn",
144
+ category: "std-nn",
145
+ minArity: 2,
146
+ maxArity: 2,
147
+ description: "Set network weights from a flat tensor",
148
+ hasSideEffects: true,
149
+ returnType: "nn/module",
150
+ params: [
151
+ { name: "module", type: "nn/module", description: "The neural network module" },
152
+ { name: "weights", type: "tensor", description: "New weights as flat tensor" }
153
+ ],
154
+ example: '["nn/setWeights", "@entity.architecture", "@payload.newWeights"]'
155
+ },
156
+ "nn/paramCount": {
157
+ module: "nn",
158
+ category: "std-nn",
159
+ minArity: 1,
160
+ maxArity: 1,
161
+ description: "Get total number of trainable parameters",
162
+ hasSideEffects: false,
163
+ returnType: "number",
164
+ params: [
165
+ { name: "module", type: "nn/module", description: "The neural network module" }
166
+ ],
167
+ example: '["nn/paramCount", "@entity.architecture"] // => 3300'
168
+ },
169
+ "nn/clone": {
170
+ module: "nn",
171
+ category: "std-nn",
172
+ minArity: 1,
173
+ maxArity: 1,
174
+ description: "Create a deep copy of the network with same weights",
175
+ hasSideEffects: false,
176
+ returnType: "nn/module",
177
+ params: [
178
+ { name: "module", type: "nn/module", description: "The neural network module to clone" }
179
+ ],
180
+ example: '["nn/clone", "@entity.architecture"]'
181
+ }
182
+ };
183
+ function getNnOperators() {
184
+ return Object.keys(NN_OPERATORS);
185
+ }
186
+
187
+ export { NN_OPERATORS, getNnOperators };
188
+ //# sourceMappingURL=nn.js.map
189
+ //# sourceMappingURL=nn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../modules/nn.ts"],"names":[],"mappings":";AAgBO,IAAM,YAAA,GAAgD;AAAA,EAC3D,eAAA,EAAiB;AAAA,IACf,MAAA,EAAQ,IAAA;AAAA,IACR,QAAA,EAAU,QAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,IAAA;AAAA,IACV,WAAA,EAAa,gDAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,WAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,WAAA,EAAa,IAAA,EAAM,YAAA,EAAc,aAAa,8BAAA;AAA+B,KACvF;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,WAAA,EAAa;AAAA,IACX,MAAA,EAAQ,IAAA;AAAA,IACR,QAAA,EAAU,QAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,gEAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,UAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,YAAA,EAAc,IAAA,EAAM,QAAA,EAAU,aAAa,iBAAA,EAAkB;AAAA,MACrE,EAAE,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,QAAA,EAAU,aAAa,kBAAA;AAAmB,KACzE;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAA,EAAW;AAAA,IACT,MAAA,EAAQ,IAAA;AAAA,IACR,QAAA,EAAU,QAAA;AAAA,IACV,QAAA,EAAU,C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AS;AAAA,GACX;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,MAAA,EAAQ,IAAA;AAAA,IACR,QAAA,EAAU,QAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,0CAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,WAAA,EAAa,aAAa,2BAAA;AAA4B,KAChF;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,UAAA,EAAY;AAAA,IACV,MAAA,EAAQ,IAAA;AAAA,IACR,QAAA,EAAU,QAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,qDAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,WAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,WAAA,EAAa,aAAa,oCAAA;AAAqC,KACzF;AAAA,IACA,OAAA,EAAS;AAAA;AAEb;AAKO,SAAS,cAAA,GAA2B;AACzC,EAAA,OAAO,MAAA,CAAO,KAAK,YAAY,CAAA;AACjC","file":"nn.js","sourcesContent":["/**\n * Neural Network Module - Neural Network Operations\n *\n * Provides operators for defining and executing neural networks.\n * Networks are defined as S-expressions and compiled to native code\n * by the Rust compiler for each target backend (PyTorch, TensorFlow, etc.).\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * Neural network module operators.\n * These operators define network architecture and forward passes.\n */\nexport const NN_OPERATORS: Record<string, StdOperatorMeta> = {\n 'nn/sequential': {\n module: 'nn',\n category: 'std-nn',\n minArity: 1,\n maxArity: null,\n description: 'Create a sequential neural network from layers',\n hasSideEffects: false,\n returnType: 'nn/module',\n params: [\n { name: '...layers', type: 'nn/layer[]', description: 'Layers to stack sequentially' },\n ],\n example: '[\"nn/sequential\", [\"nn/linear\", 16, 64], [\"nn/relu\"], [\"nn/linear\", 64, 4]]',\n },\n 'nn/linear': {\n module: 'nn',\n category: 'std-nn',\n minArity: 2,\n maxArity: 2,\n description: 'Fully connected linear layer (output = input * weights + bias)',\n hasSideEffects: false,\n returnType: 'nn/layer',\n params: [\n { name: 'inFeatures', type: 'number', description: 'Input dimension' },\n { name: 'outFeatures', type: 'number', description: 'Output dimension' },\n ],\n example: '[\"nn/linear\", 16, 64] // 16 inputs -> 64 outputs',\n },\n 'nn/relu': {\n module: 'nn',\n category: 'std-nn',\n minArity: 0,\n maxArity: 0,\n description: 'ReLU activation function: max(0, x)',\n hasSideEffects: false,\n returnType: 'nn/layer',\n params: [],\n example: '[\"nn/relu\"]',\n },\n 'nn/tanh': {\n module: 'nn',\n category: 'std-nn',\n minArity: 0,\n maxArity: 0,\n description: 'Tanh activation function: (e^x - e^-x) / (e^x + e^-x)',\n hasSideEffects: false,\n returnType: 'nn/layer',\n params: [],\n example: '[\"nn/tanh\"]',\n },\n 'nn/sigmoid': {\n module: 'nn',\n category: 'std-nn',\n minArity: 0,\n maxArity: 0,\n description: 'Sigmoid activation function: 1 / (1 + e^-x)',\n hasSideEffects: false,\n returnType: 'nn/layer',\n params: [],\n example: '[\"nn/sigmoid\"]',\n },\n 'nn/softmax': {\n module: 'nn',\n category: 'std-nn',\n minArity: 0,\n maxArity: 1,\n description: 'Softmax activation function (normalizes to probability distribution)',\n hasSideEffects: false,\n returnType: 'nn/layer',\n params: [\n { name: 'dim', type: 'number', description: 'Dimension to apply softmax', optional: true, defaultValue: -1 },\n ],\n example: '[\"nn/softmax\"]',\n },\n 'nn/dropout': {\n module: 'nn',\n category: 'std-nn',\n minArity: 0,\n maxArity: 1,\n description: 'Dropout layer for regularization (randomly zeros elements during training)',\n hasSideEffects: false,\n returnType: 'nn/layer',\n params: [\n { name: 'p', type: 'number', description: 'Dropout probability', optional: true, defaultValue: 0.5 },\n ],\n example: '[\"nn/dropout\", 0.3] // 30% dropout',\n },\n 'nn/batchnorm': {\n module: 'nn',\n category: 'std-nn',\n minArity: 1,\n maxArity: 1,\n description: 'Batch normalization layer',\n hasSideEffects: false,\n returnType: 'nn/layer',\n params: [\n { name: 'numFeatures', type: 'number', description: 'Number of features to normalize' },\n ],\n example: '[\"nn/batchnorm\", 64]',\n },\n 'nn/layernorm': {\n module: 'nn',\n category: 'std-nn',\n minArity: 1,\n maxArity: 1,\n description: 'Layer normalization',\n hasSideEffects: false,\n returnType: 'nn/layer',\n params: [\n { name: 'normalizedShape', type: 'number | number[]', description: 'Shape to normalize over' },\n ],\n example: '[\"nn/layernorm\", 64]',\n },\n 'nn/forward': {\n module: 'nn',\n category: 'std-nn',\n minArity: 2,\n maxArity: 2,\n description: 'Execute forward pass through network',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network module' },\n { name: 'input', type: 'tensor', description: 'Input tensor' },\n ],\n example: '[\"nn/forward\", \"@entity.architecture\", \"@entity.sensors\"]',\n },\n 'nn/getWeights': {\n module: 'nn',\n category: 'std-nn',\n minArity: 1,\n maxArity: 1,\n description: 'Get network weights as a flat tensor',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network module' },\n ],\n example: '[\"nn/getWeights\", \"@entity.architecture\"]',\n },\n 'nn/setWeights': {\n module: 'nn',\n category: 'std-nn',\n minArity: 2,\n maxArity: 2,\n description: 'Set network weights from a flat tensor',\n hasSideEffects: true,\n returnType: 'nn/module',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network module' },\n { name: 'weights', type: 'tensor', description: 'New weights as flat tensor' },\n ],\n example: '[\"nn/setWeights\", \"@entity.architecture\", \"@payload.newWeights\"]',\n },\n 'nn/paramCount': {\n module: 'nn',\n category: 'std-nn',\n minArity: 1,\n maxArity: 1,\n description: 'Get total number of trainable parameters',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network module' },\n ],\n example: '[\"nn/paramCount\", \"@entity.architecture\"] // => 3300',\n },\n 'nn/clone': {\n module: 'nn',\n category: 'std-nn',\n minArity: 1,\n maxArity: 1,\n description: 'Create a deep copy of the network with same weights',\n hasSideEffects: false,\n returnType: 'nn/module',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network module to clone' },\n ],\n example: '[\"nn/clone\", \"@entity.architecture\"]',\n },\n};\n\n/**\n * Get all nn operator names.\n */\nexport function getNnOperators(): string[] {\n return Object.keys(NN_OPERATORS);\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { a as StdOperatorMeta } from '../types-I95R8_FN.js';
2
+
3
+ /**
4
+ * Object Module - Object Operations
5
+ *
6
+ * Provides object manipulation and transformation functions.
7
+ * All operations are immutable (return new objects).
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+
12
+ /**
13
+ * Object module operators.
14
+ * All operators return objects or other values and have no side effects.
15
+ */
16
+ declare const OBJECT_OPERATORS: Record<string, StdOperatorMeta>;
17
+ /**
18
+ * Get all object operator names.
19
+ */
20
+ declare function getObjectOperators(): string[];
21
+
22
+ export { OBJECT_OPERATORS, getObjectOperators };