@almadar/std 6.4.1 → 6.5.1
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/registry/atoms/std-search.orb +2 -2
- package/behaviors/registry/atoms/std-selection.orb +2 -2
- package/behaviors/registry/atoms/std-sort.orb +2 -2
- package/behaviors/registry/atoms/std-sprite.orb +2 -2
- package/dist/behaviors/registry/atoms/std-search.orb +2 -2
- package/dist/behaviors/registry/atoms/std-selection.orb +2 -2
- package/dist/behaviors/registry/atoms/std-sort.orb +2 -2
- package/dist/behaviors/registry/atoms/std-sprite.orb +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +680 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/agent.d.ts +1 -1
- package/dist/modules/array.d.ts +1 -1
- package/dist/modules/async.d.ts +1 -1
- package/dist/modules/composition.d.ts +1 -1
- package/dist/modules/contract.d.ts +1 -1
- package/dist/modules/core.d.ts +27 -0
- package/dist/modules/core.js +607 -0
- package/dist/modules/core.js.map +1 -0
- package/dist/modules/data.d.ts +1 -1
- package/dist/modules/format.d.ts +1 -1
- package/dist/modules/graph.d.ts +1 -1
- package/dist/modules/index.d.ts +2 -1
- package/dist/modules/index.js +605 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/math.d.ts +1 -1
- package/dist/modules/nn.d.ts +1 -1
- package/dist/modules/object.d.ts +1 -1
- package/dist/modules/os.d.ts +1 -1
- package/dist/modules/prob.d.ts +1 -1
- package/dist/modules/str.d.ts +1 -1
- package/dist/modules/tensor.d.ts +1 -1
- package/dist/modules/time.d.ts +1 -1
- package/dist/modules/train.d.ts +1 -1
- package/dist/modules/validate.d.ts +1 -1
- package/dist/registry.d.ts +7 -3
- package/dist/registry.js +606 -1
- package/dist/registry.js.map +1 -1
- package/dist/{types-hu1LavLs.d.ts → types-D7dG8fBF.d.ts} +62 -3
- package/package.json +2 -3
package/dist/registry.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// types.ts
|
|
2
2
|
var STD_MODULES = [
|
|
3
|
+
"core",
|
|
3
4
|
"math",
|
|
4
5
|
"str",
|
|
5
6
|
"array",
|
|
@@ -29,6 +30,607 @@ function isStdOperator(operator) {
|
|
|
29
30
|
return getModuleFromOperator(operator) !== null;
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
// modules/core.ts
|
|
34
|
+
var NUMBER = "number";
|
|
35
|
+
var BOOLEAN = "boolean";
|
|
36
|
+
var STRING = "string";
|
|
37
|
+
var ANY = "any";
|
|
38
|
+
var SEXPR = { kind: "sexpr" };
|
|
39
|
+
var BINDING = { kind: "binding" };
|
|
40
|
+
var ENTITY_REF = { kind: "entityRef" };
|
|
41
|
+
var EVENT_KEY = { kind: "eventKey" };
|
|
42
|
+
var UI_SLOT = { kind: "uiSlot" };
|
|
43
|
+
var PATTERN_TYPE = { kind: "patternType" };
|
|
44
|
+
var PERSIST_ACTION = {
|
|
45
|
+
kind: "union",
|
|
46
|
+
of: [
|
|
47
|
+
{ kind: "literal", value: "create" },
|
|
48
|
+
{ kind: "literal", value: "update" },
|
|
49
|
+
{ kind: "literal", value: "delete" },
|
|
50
|
+
{ kind: "literal", value: "clear" },
|
|
51
|
+
{ kind: "literal", value: "batch" }
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
var SET_OPERATION = {
|
|
55
|
+
kind: "union",
|
|
56
|
+
of: [
|
|
57
|
+
{ kind: "literal", value: "increment" },
|
|
58
|
+
{ kind: "literal", value: "decrement" },
|
|
59
|
+
{ kind: "literal", value: "multiply" },
|
|
60
|
+
{ kind: "literal", value: "append" },
|
|
61
|
+
{ kind: "literal", value: "remove" }
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
var NOTIFY_CHANNEL = {
|
|
65
|
+
kind: "union",
|
|
66
|
+
of: [
|
|
67
|
+
{ kind: "literal", value: "email" },
|
|
68
|
+
{ kind: "literal", value: "push" },
|
|
69
|
+
{ kind: "literal", value: "sms" },
|
|
70
|
+
{ kind: "literal", value: "in_app" }
|
|
71
|
+
]
|
|
72
|
+
};
|
|
73
|
+
var CORE_OPERATORS = {
|
|
74
|
+
// --- arithmetic primitives --------------------------------------------------
|
|
75
|
+
"+": {
|
|
76
|
+
module: "core",
|
|
77
|
+
category: "arithmetic",
|
|
78
|
+
minArity: 2,
|
|
79
|
+
maxArity: null,
|
|
80
|
+
description: "Add numbers",
|
|
81
|
+
hasSideEffects: false,
|
|
82
|
+
returnType: "number",
|
|
83
|
+
params: [{ name: "...nums", type: NUMBER, description: "Numbers to sum" }],
|
|
84
|
+
example: '["+", 1, 2, 3] // => 6'
|
|
85
|
+
},
|
|
86
|
+
"-": {
|
|
87
|
+
module: "core",
|
|
88
|
+
category: "arithmetic",
|
|
89
|
+
minArity: 1,
|
|
90
|
+
maxArity: 2,
|
|
91
|
+
description: "Subtract or negate",
|
|
92
|
+
hasSideEffects: false,
|
|
93
|
+
returnType: "number",
|
|
94
|
+
params: [
|
|
95
|
+
{ name: "a", type: NUMBER, description: "Left operand or value to negate" },
|
|
96
|
+
{ name: "b", type: NUMBER, description: "Right operand", optional: true }
|
|
97
|
+
],
|
|
98
|
+
example: '["-", 5, 2] // => 3; ["-", 5] // => -5'
|
|
99
|
+
},
|
|
100
|
+
"*": {
|
|
101
|
+
module: "core",
|
|
102
|
+
category: "arithmetic",
|
|
103
|
+
minArity: 2,
|
|
104
|
+
maxArity: null,
|
|
105
|
+
description: "Multiply numbers",
|
|
106
|
+
hasSideEffects: false,
|
|
107
|
+
returnType: "number",
|
|
108
|
+
params: [{ name: "...nums", type: NUMBER, description: "Numbers to multiply" }],
|
|
109
|
+
example: '["*", 2, 3, 4] // => 24'
|
|
110
|
+
},
|
|
111
|
+
"/": {
|
|
112
|
+
module: "core",
|
|
113
|
+
category: "arithmetic",
|
|
114
|
+
minArity: 2,
|
|
115
|
+
maxArity: 2,
|
|
116
|
+
description: "Divide numbers",
|
|
117
|
+
hasSideEffects: false,
|
|
118
|
+
returnType: "number",
|
|
119
|
+
params: [
|
|
120
|
+
{ name: "a", type: NUMBER, description: "Numerator" },
|
|
121
|
+
{ name: "b", type: NUMBER, description: "Denominator" }
|
|
122
|
+
],
|
|
123
|
+
example: '["/", 10, 2] // => 5'
|
|
124
|
+
},
|
|
125
|
+
"%": {
|
|
126
|
+
module: "core",
|
|
127
|
+
category: "arithmetic",
|
|
128
|
+
minArity: 2,
|
|
129
|
+
maxArity: 2,
|
|
130
|
+
description: "Modulo (remainder)",
|
|
131
|
+
hasSideEffects: false,
|
|
132
|
+
returnType: "number",
|
|
133
|
+
params: [
|
|
134
|
+
{ name: "a", type: NUMBER, description: "Dividend" },
|
|
135
|
+
{ name: "b", type: NUMBER, description: "Divisor" }
|
|
136
|
+
],
|
|
137
|
+
example: '["%", 10, 3] // => 1'
|
|
138
|
+
},
|
|
139
|
+
// --- comparison -------------------------------------------------------------
|
|
140
|
+
"=": {
|
|
141
|
+
module: "core",
|
|
142
|
+
category: "comparison",
|
|
143
|
+
minArity: 2,
|
|
144
|
+
maxArity: 2,
|
|
145
|
+
description: "Equal to",
|
|
146
|
+
hasSideEffects: false,
|
|
147
|
+
returnType: "boolean",
|
|
148
|
+
params: [
|
|
149
|
+
{ name: "a", type: ANY, description: "Left operand" },
|
|
150
|
+
{ name: "b", type: ANY, description: "Right operand" }
|
|
151
|
+
],
|
|
152
|
+
example: '["=", "@entity.status", "active"]'
|
|
153
|
+
},
|
|
154
|
+
"!=": {
|
|
155
|
+
module: "core",
|
|
156
|
+
category: "comparison",
|
|
157
|
+
minArity: 2,
|
|
158
|
+
maxArity: 2,
|
|
159
|
+
description: "Not equal to",
|
|
160
|
+
hasSideEffects: false,
|
|
161
|
+
returnType: "boolean",
|
|
162
|
+
params: [
|
|
163
|
+
{ name: "a", type: ANY, description: "Left operand" },
|
|
164
|
+
{ name: "b", type: ANY, description: "Right operand" }
|
|
165
|
+
],
|
|
166
|
+
example: '["!=", "@entity.id", null]'
|
|
167
|
+
},
|
|
168
|
+
"<": {
|
|
169
|
+
module: "core",
|
|
170
|
+
category: "comparison",
|
|
171
|
+
minArity: 2,
|
|
172
|
+
maxArity: 2,
|
|
173
|
+
description: "Less than",
|
|
174
|
+
hasSideEffects: false,
|
|
175
|
+
returnType: "boolean",
|
|
176
|
+
params: [
|
|
177
|
+
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
178
|
+
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
179
|
+
],
|
|
180
|
+
example: '["<", "@entity.health", 10]'
|
|
181
|
+
},
|
|
182
|
+
">": {
|
|
183
|
+
module: "core",
|
|
184
|
+
category: "comparison",
|
|
185
|
+
minArity: 2,
|
|
186
|
+
maxArity: 2,
|
|
187
|
+
description: "Greater than",
|
|
188
|
+
hasSideEffects: false,
|
|
189
|
+
returnType: "boolean",
|
|
190
|
+
params: [
|
|
191
|
+
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
192
|
+
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
193
|
+
],
|
|
194
|
+
example: '[">", "@entity.score", 0]'
|
|
195
|
+
},
|
|
196
|
+
"<=": {
|
|
197
|
+
module: "core",
|
|
198
|
+
category: "comparison",
|
|
199
|
+
minArity: 2,
|
|
200
|
+
maxArity: 2,
|
|
201
|
+
description: "Less than or equal",
|
|
202
|
+
hasSideEffects: false,
|
|
203
|
+
returnType: "boolean",
|
|
204
|
+
params: [
|
|
205
|
+
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
206
|
+
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
207
|
+
],
|
|
208
|
+
example: '["<=", "@entity.count", 100]'
|
|
209
|
+
},
|
|
210
|
+
">=": {
|
|
211
|
+
module: "core",
|
|
212
|
+
category: "comparison",
|
|
213
|
+
minArity: 2,
|
|
214
|
+
maxArity: 2,
|
|
215
|
+
description: "Greater than or equal",
|
|
216
|
+
hasSideEffects: false,
|
|
217
|
+
returnType: "boolean",
|
|
218
|
+
params: [
|
|
219
|
+
{ name: "a", type: NUMBER, description: "Left operand" },
|
|
220
|
+
{ name: "b", type: NUMBER, description: "Right operand" }
|
|
221
|
+
],
|
|
222
|
+
example: '[">=", "@entity.age", 18]'
|
|
223
|
+
},
|
|
224
|
+
// --- logic ------------------------------------------------------------------
|
|
225
|
+
and: {
|
|
226
|
+
module: "core",
|
|
227
|
+
category: "logic",
|
|
228
|
+
minArity: 2,
|
|
229
|
+
maxArity: null,
|
|
230
|
+
description: "Logical AND",
|
|
231
|
+
hasSideEffects: false,
|
|
232
|
+
returnType: "boolean",
|
|
233
|
+
params: [{ name: "...conds", type: BOOLEAN, description: "Boolean expressions to AND" }],
|
|
234
|
+
example: '["and", ["=", "@entity.active", true], [">", "@entity.score", 0]]'
|
|
235
|
+
},
|
|
236
|
+
or: {
|
|
237
|
+
module: "core",
|
|
238
|
+
category: "logic",
|
|
239
|
+
minArity: 2,
|
|
240
|
+
maxArity: null,
|
|
241
|
+
description: "Logical OR",
|
|
242
|
+
hasSideEffects: false,
|
|
243
|
+
returnType: "boolean",
|
|
244
|
+
params: [{ name: "...conds", type: BOOLEAN, description: "Boolean expressions to OR" }],
|
|
245
|
+
example: '["or", ["=", "@entity.role", "admin"], ["=", "@entity.role", "owner"]]'
|
|
246
|
+
},
|
|
247
|
+
not: {
|
|
248
|
+
module: "core",
|
|
249
|
+
category: "logic",
|
|
250
|
+
minArity: 1,
|
|
251
|
+
maxArity: 1,
|
|
252
|
+
description: "Logical NOT",
|
|
253
|
+
hasSideEffects: false,
|
|
254
|
+
returnType: "boolean",
|
|
255
|
+
params: [{ name: "cond", type: BOOLEAN, description: "Boolean to negate" }],
|
|
256
|
+
example: '["not", "@entity.disabled"]'
|
|
257
|
+
},
|
|
258
|
+
if: {
|
|
259
|
+
module: "core",
|
|
260
|
+
category: "logic",
|
|
261
|
+
minArity: 3,
|
|
262
|
+
maxArity: 3,
|
|
263
|
+
description: "Conditional expression (ternary)",
|
|
264
|
+
hasSideEffects: false,
|
|
265
|
+
returnType: "any",
|
|
266
|
+
params: [
|
|
267
|
+
{ name: "cond", type: BOOLEAN, description: "Condition to evaluate" },
|
|
268
|
+
{ name: "then", type: ANY, description: "Value or effect if true" },
|
|
269
|
+
{ name: "else", type: ANY, description: "Value or effect if false" }
|
|
270
|
+
],
|
|
271
|
+
example: '["if", [">", "@entity.health", 0], "alive", "dead"]'
|
|
272
|
+
},
|
|
273
|
+
// --- control ----------------------------------------------------------------
|
|
274
|
+
let: {
|
|
275
|
+
module: "core",
|
|
276
|
+
category: "control",
|
|
277
|
+
minArity: 2,
|
|
278
|
+
maxArity: 2,
|
|
279
|
+
description: "Bind local variables for a body expression",
|
|
280
|
+
hasSideEffects: false,
|
|
281
|
+
returnType: "any",
|
|
282
|
+
params: [
|
|
283
|
+
{
|
|
284
|
+
name: "bindings",
|
|
285
|
+
type: { kind: "array", of: { kind: "array", of: ANY } },
|
|
286
|
+
description: "Array of [name, value] pairs"
|
|
287
|
+
},
|
|
288
|
+
{ name: "body", type: SEXPR, description: "Expression or effect list using the bindings" }
|
|
289
|
+
],
|
|
290
|
+
example: '["let", [["x", 10]], ["+", "x", 1]]'
|
|
291
|
+
},
|
|
292
|
+
do: {
|
|
293
|
+
module: "core",
|
|
294
|
+
category: "control",
|
|
295
|
+
minArity: 1,
|
|
296
|
+
maxArity: null,
|
|
297
|
+
description: "Sequential execution of multiple effects/expressions",
|
|
298
|
+
hasSideEffects: false,
|
|
299
|
+
returnType: "any",
|
|
300
|
+
params: [{ name: "...exprs", type: SEXPR, description: "Effects/expressions to run in order" }],
|
|
301
|
+
example: '["do", ["set", "@entity.x", 0], ["set", "@entity.y", 0]]'
|
|
302
|
+
},
|
|
303
|
+
when: {
|
|
304
|
+
module: "core",
|
|
305
|
+
category: "control",
|
|
306
|
+
minArity: 2,
|
|
307
|
+
maxArity: 2,
|
|
308
|
+
description: "Conditional effect without an else branch",
|
|
309
|
+
hasSideEffects: false,
|
|
310
|
+
returnType: "void",
|
|
311
|
+
params: [
|
|
312
|
+
{ name: "cond", type: BOOLEAN, description: "Guard expression" },
|
|
313
|
+
{ name: "effect", type: SEXPR, description: "Effect to run if cond is true" }
|
|
314
|
+
],
|
|
315
|
+
example: '["when", [">", "@entity.health", 0], ["emit", "ALIVE"]]'
|
|
316
|
+
},
|
|
317
|
+
fn: {
|
|
318
|
+
module: "core",
|
|
319
|
+
category: "control",
|
|
320
|
+
minArity: 2,
|
|
321
|
+
maxArity: 2,
|
|
322
|
+
description: "Lambda expression (used for per-item renders and transforms)",
|
|
323
|
+
hasSideEffects: false,
|
|
324
|
+
returnType: "function",
|
|
325
|
+
acceptsLambda: true,
|
|
326
|
+
lambdaArgPosition: 1,
|
|
327
|
+
params: [
|
|
328
|
+
{ name: "paramName", type: STRING, description: "Name of the parameter binding" },
|
|
329
|
+
{ name: "body", type: SEXPR, description: "Expression evaluated per invocation" }
|
|
330
|
+
],
|
|
331
|
+
example: '["fn", "item", { "type": "typography", "content": "@item.title" }]'
|
|
332
|
+
},
|
|
333
|
+
// --- effect -----------------------------------------------------------------
|
|
334
|
+
set: {
|
|
335
|
+
module: "core",
|
|
336
|
+
category: "effect",
|
|
337
|
+
minArity: 2,
|
|
338
|
+
maxArity: 2,
|
|
339
|
+
description: "Set a binding to a value",
|
|
340
|
+
hasSideEffects: true,
|
|
341
|
+
returnType: "void",
|
|
342
|
+
params: [
|
|
343
|
+
{ name: "binding", type: BINDING, description: 'Target binding (e.g. "@entity.field")' },
|
|
344
|
+
{ name: "value", type: ANY, description: "Value to assign (literal or expression)" }
|
|
345
|
+
],
|
|
346
|
+
example: '["set", "@entity.health", 100]',
|
|
347
|
+
effect: {
|
|
348
|
+
kind: "set",
|
|
349
|
+
// success emit carries the written value; the evaluator coerces to the
|
|
350
|
+
// binding's declared type, so 'any' is the general shape. A future pass
|
|
351
|
+
// can narrow per-binding via resolveBinding.
|
|
352
|
+
produces: ANY,
|
|
353
|
+
config: { operation: SET_OPERATION }
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
emit: {
|
|
357
|
+
module: "core",
|
|
358
|
+
category: "effect",
|
|
359
|
+
minArity: 1,
|
|
360
|
+
maxArity: 2,
|
|
361
|
+
description: "Emit an event onto the bus",
|
|
362
|
+
hasSideEffects: true,
|
|
363
|
+
returnType: "void",
|
|
364
|
+
params: [
|
|
365
|
+
{ name: "event", type: EVENT_KEY, description: "Event key" },
|
|
366
|
+
{ name: "payload", type: ENTITY_REF, description: "Optional payload", optional: true }
|
|
367
|
+
],
|
|
368
|
+
example: '["emit", "PLAYER_DIED", { "playerId": "@entity.id" }]',
|
|
369
|
+
effect: {
|
|
370
|
+
kind: "emit",
|
|
371
|
+
produces: {
|
|
372
|
+
kind: "object",
|
|
373
|
+
fields: { event: EVENT_KEY, payload: ANY },
|
|
374
|
+
open: true
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
persist: {
|
|
379
|
+
module: "core",
|
|
380
|
+
category: "effect",
|
|
381
|
+
minArity: 2,
|
|
382
|
+
maxArity: 3,
|
|
383
|
+
description: "Create, update, delete, clear, or batch entity records",
|
|
384
|
+
hasSideEffects: true,
|
|
385
|
+
returnType: "void",
|
|
386
|
+
params: [
|
|
387
|
+
{ name: "action", type: PERSIST_ACTION, description: "Persist action" },
|
|
388
|
+
{ name: "entity", type: { kind: "entity" }, description: "Target entity name" },
|
|
389
|
+
{ name: "data", type: ENTITY_REF, description: "Payload (create/update) or entity id (delete)", optional: true }
|
|
390
|
+
],
|
|
391
|
+
example: '["persist", "create", "Task", { "title": "@payload.title" }]',
|
|
392
|
+
effect: {
|
|
393
|
+
kind: "persist",
|
|
394
|
+
// Action-discriminated union. The compiler narrows at the call site
|
|
395
|
+
// based on the action arg literal to pick the right branch when
|
|
396
|
+
// checking the emit.success event's declared payload.
|
|
397
|
+
// create/update -> the resulting entity record
|
|
398
|
+
// delete/clear -> { id, deleted }
|
|
399
|
+
// batch -> summary of operations
|
|
400
|
+
produces: {
|
|
401
|
+
kind: "union",
|
|
402
|
+
of: [
|
|
403
|
+
{ kind: "entity" },
|
|
404
|
+
{
|
|
405
|
+
kind: "object",
|
|
406
|
+
fields: { id: STRING, deleted: BOOLEAN },
|
|
407
|
+
open: false
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
kind: "object",
|
|
411
|
+
fields: {
|
|
412
|
+
operations: { kind: "array", of: ANY },
|
|
413
|
+
completedCount: NUMBER,
|
|
414
|
+
totalCount: NUMBER
|
|
415
|
+
},
|
|
416
|
+
open: false
|
|
417
|
+
}
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
navigate: {
|
|
423
|
+
module: "core",
|
|
424
|
+
category: "effect",
|
|
425
|
+
minArity: 1,
|
|
426
|
+
maxArity: 2,
|
|
427
|
+
description: "Navigate to a route",
|
|
428
|
+
hasSideEffects: true,
|
|
429
|
+
returnType: "void",
|
|
430
|
+
params: [
|
|
431
|
+
{ name: "path", type: STRING, description: "Route path (supports :param placeholders)" },
|
|
432
|
+
{
|
|
433
|
+
name: "params",
|
|
434
|
+
type: { kind: "object", fields: {}, open: true },
|
|
435
|
+
description: "Optional route params",
|
|
436
|
+
optional: true
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
example: '["navigate", "/tasks/:id", { "id": "@entity.id" }]',
|
|
440
|
+
effect: { kind: "navigate" }
|
|
441
|
+
},
|
|
442
|
+
notify: {
|
|
443
|
+
module: "core",
|
|
444
|
+
category: "effect",
|
|
445
|
+
minArity: 1,
|
|
446
|
+
maxArity: 2,
|
|
447
|
+
description: "Show a notification (in-app, email, push, sms)",
|
|
448
|
+
hasSideEffects: true,
|
|
449
|
+
returnType: "void",
|
|
450
|
+
params: [
|
|
451
|
+
{ name: "channel", type: NOTIFY_CHANNEL, description: "Delivery channel" },
|
|
452
|
+
{ name: "message", type: STRING, description: "Message body", optional: true }
|
|
453
|
+
],
|
|
454
|
+
example: '["notify", "in_app", "Task created successfully"]',
|
|
455
|
+
effect: { kind: "notify" }
|
|
456
|
+
},
|
|
457
|
+
spawn: {
|
|
458
|
+
module: "core",
|
|
459
|
+
category: "effect",
|
|
460
|
+
minArity: 1,
|
|
461
|
+
maxArity: 2,
|
|
462
|
+
description: "Spawn a new entity instance (games)",
|
|
463
|
+
hasSideEffects: true,
|
|
464
|
+
returnType: "void",
|
|
465
|
+
params: [
|
|
466
|
+
{ name: "entity", type: { kind: "entity" }, description: "Entity name to spawn" },
|
|
467
|
+
{
|
|
468
|
+
name: "initialState",
|
|
469
|
+
type: { kind: "object", fields: {}, open: true },
|
|
470
|
+
description: "Initial field values",
|
|
471
|
+
optional: true
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
example: '["spawn", "Bullet", { "x": "@entity.x", "y": "@entity.y" }]',
|
|
475
|
+
effect: { kind: "spawn" }
|
|
476
|
+
},
|
|
477
|
+
despawn: {
|
|
478
|
+
module: "core",
|
|
479
|
+
category: "effect",
|
|
480
|
+
minArity: 0,
|
|
481
|
+
maxArity: 1,
|
|
482
|
+
description: "Despawn an entity instance (games)",
|
|
483
|
+
hasSideEffects: true,
|
|
484
|
+
returnType: "void",
|
|
485
|
+
params: [
|
|
486
|
+
{ name: "entityId", type: STRING, description: "Target entity id (defaults to @entity.id)", optional: true }
|
|
487
|
+
],
|
|
488
|
+
example: '["despawn", "@entity.id"]',
|
|
489
|
+
effect: { kind: "despawn" }
|
|
490
|
+
},
|
|
491
|
+
fetch: {
|
|
492
|
+
module: "core",
|
|
493
|
+
category: "effect",
|
|
494
|
+
minArity: 1,
|
|
495
|
+
maxArity: 2,
|
|
496
|
+
description: "Fetch an entity (by id) or a collection (by filter) from persistence",
|
|
497
|
+
hasSideEffects: true,
|
|
498
|
+
returnType: "void",
|
|
499
|
+
params: [
|
|
500
|
+
{ name: "entity", type: { kind: "entity" }, description: "Target entity name" },
|
|
501
|
+
{
|
|
502
|
+
name: "options",
|
|
503
|
+
type: {
|
|
504
|
+
kind: "object",
|
|
505
|
+
fields: {
|
|
506
|
+
id: STRING,
|
|
507
|
+
filter: ANY,
|
|
508
|
+
limit: NUMBER,
|
|
509
|
+
offset: NUMBER,
|
|
510
|
+
include: { kind: "array", of: STRING },
|
|
511
|
+
emit: { kind: "object", fields: {}, open: true }
|
|
512
|
+
},
|
|
513
|
+
open: true
|
|
514
|
+
},
|
|
515
|
+
description: "Fetch options: id | filter | limit | offset | include | emit",
|
|
516
|
+
optional: true
|
|
517
|
+
}
|
|
518
|
+
],
|
|
519
|
+
example: '["fetch", "Task", { "id": "@payload.taskId", "emit": { "success": "TASK_LOADED" } }]',
|
|
520
|
+
effect: {
|
|
521
|
+
kind: "fetch",
|
|
522
|
+
// Call-site-discriminated union: options.id present -> single entity;
|
|
523
|
+
// otherwise -> array of entity. The compiler narrows at the call site
|
|
524
|
+
// when checking emit.success against the declared event payload.
|
|
525
|
+
produces: {
|
|
526
|
+
kind: "union",
|
|
527
|
+
of: [
|
|
528
|
+
{ kind: "entity" },
|
|
529
|
+
{ kind: "array", of: { kind: "entity" } }
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
ref: {
|
|
535
|
+
module: "core",
|
|
536
|
+
category: "effect",
|
|
537
|
+
minArity: 1,
|
|
538
|
+
maxArity: 2,
|
|
539
|
+
description: "Reactive entity reference (deprecated, use fetch with listens in V2)",
|
|
540
|
+
hasSideEffects: true,
|
|
541
|
+
returnType: "void",
|
|
542
|
+
params: [
|
|
543
|
+
{ name: "entity", type: { kind: "entity" }, description: "Target entity name" },
|
|
544
|
+
{
|
|
545
|
+
name: "options",
|
|
546
|
+
type: {
|
|
547
|
+
kind: "object",
|
|
548
|
+
fields: {
|
|
549
|
+
id: STRING,
|
|
550
|
+
filter: ANY,
|
|
551
|
+
include: { kind: "array", of: STRING },
|
|
552
|
+
emit: { kind: "object", fields: {}, open: true }
|
|
553
|
+
},
|
|
554
|
+
open: true
|
|
555
|
+
},
|
|
556
|
+
description: "Ref options: id | filter | include | emit",
|
|
557
|
+
optional: true
|
|
558
|
+
}
|
|
559
|
+
],
|
|
560
|
+
example: '["ref", "Task"]',
|
|
561
|
+
effect: {
|
|
562
|
+
kind: "ref",
|
|
563
|
+
// Same call-site shape as fetch. Kept for the V2 transition period;
|
|
564
|
+
// scheduled for deprecation in a later phase (see Almadar_Entity_V2_Plan.md).
|
|
565
|
+
produces: {
|
|
566
|
+
kind: "union",
|
|
567
|
+
of: [
|
|
568
|
+
{ kind: "entity" },
|
|
569
|
+
{ kind: "array", of: { kind: "entity" } }
|
|
570
|
+
]
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
"call-service": {
|
|
575
|
+
module: "core",
|
|
576
|
+
category: "effect",
|
|
577
|
+
minArity: 2,
|
|
578
|
+
maxArity: 3,
|
|
579
|
+
description: "Invoke an external service action",
|
|
580
|
+
hasSideEffects: true,
|
|
581
|
+
returnType: "void",
|
|
582
|
+
params: [
|
|
583
|
+
{ name: "service", type: STRING, description: 'Service name (e.g. "llm", "stripe")' },
|
|
584
|
+
{ name: "action", type: STRING, description: 'Service action (e.g. "generate", "charge")' },
|
|
585
|
+
{
|
|
586
|
+
name: "params",
|
|
587
|
+
type: { kind: "object", fields: {}, open: true },
|
|
588
|
+
description: "Service-specific params",
|
|
589
|
+
optional: true
|
|
590
|
+
}
|
|
591
|
+
],
|
|
592
|
+
example: '["call-service", "llm", "generate", { "userPrompt": "@entity.inputText" }]',
|
|
593
|
+
effect: {
|
|
594
|
+
kind: "call-service",
|
|
595
|
+
// TODO(entity-v2): narrow to the declared service return type once
|
|
596
|
+
// per-service return shapes live on the orbital services block.
|
|
597
|
+
// Today the emit.success payload is whatever the service adapter returns.
|
|
598
|
+
produces: ANY
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
"render-ui": {
|
|
602
|
+
module: "core",
|
|
603
|
+
category: "effect",
|
|
604
|
+
minArity: 2,
|
|
605
|
+
maxArity: 3,
|
|
606
|
+
description: "Render a pattern into a UI slot",
|
|
607
|
+
hasSideEffects: true,
|
|
608
|
+
returnType: "void",
|
|
609
|
+
params: [
|
|
610
|
+
{ name: "slot", type: UI_SLOT, description: "Target UI slot (main, sidebar, modal, hud, ...)" },
|
|
611
|
+
{
|
|
612
|
+
name: "pattern",
|
|
613
|
+
type: {
|
|
614
|
+
kind: "union",
|
|
615
|
+
of: [
|
|
616
|
+
{ kind: "object", fields: { patternType: PATTERN_TYPE }, open: true },
|
|
617
|
+
{ kind: "literal", value: null }
|
|
618
|
+
]
|
|
619
|
+
},
|
|
620
|
+
description: "Pattern config (or null to clear the slot)"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
name: "props",
|
|
624
|
+
type: { kind: "object", fields: {}, open: true },
|
|
625
|
+
description: "Extra props forwarded to the pattern",
|
|
626
|
+
optional: true
|
|
627
|
+
}
|
|
628
|
+
],
|
|
629
|
+
example: '["render-ui", "main", { "patternType": "entity-table", "columns": ["name"] }]',
|
|
630
|
+
effect: { kind: "render-ui" }
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
|
|
32
634
|
// modules/math.ts
|
|
33
635
|
var MATH_OPERATORS = {
|
|
34
636
|
"math/abs": {
|
|
@@ -3895,6 +4497,7 @@ var COMPOSITION_OPERATORS = {
|
|
|
3895
4497
|
|
|
3896
4498
|
// registry.ts
|
|
3897
4499
|
var STD_OPERATORS = {
|
|
4500
|
+
...CORE_OPERATORS,
|
|
3898
4501
|
...MATH_OPERATORS,
|
|
3899
4502
|
...STR_OPERATORS,
|
|
3900
4503
|
...ARRAY_OPERATORS,
|
|
@@ -3911,7 +4514,9 @@ var STD_OPERATORS = {
|
|
|
3911
4514
|
...AGENT_OPERATORS,
|
|
3912
4515
|
...COMPOSITION_OPERATORS
|
|
3913
4516
|
};
|
|
4517
|
+
var OPERATOR_NAMES = Object.keys(STD_OPERATORS);
|
|
3914
4518
|
var STD_OPERATORS_BY_MODULE = {
|
|
4519
|
+
core: CORE_OPERATORS,
|
|
3915
4520
|
math: MATH_OPERATORS,
|
|
3916
4521
|
str: STR_OPERATORS,
|
|
3917
4522
|
array: ARRAY_OPERATORS,
|
|
@@ -4022,6 +4627,6 @@ function getStdLibStats() {
|
|
|
4022
4627
|
};
|
|
4023
4628
|
}
|
|
4024
4629
|
|
|
4025
|
-
export { STD_OPERATORS, STD_OPERATORS_BY_MODULE, getAllStdOperators, getLambdaOperators, getModuleOperators, getOperatorMetaExtended, getStdEffectOperators, getStdLibStats, getStdOperatorMeta, getStdOperatorsByModule, getStdPureOperators, isEffectOperatorExtended, isKnownOperatorExtended, isKnownStdOperator, isStdEffectOperator, isStdGuardOperator, validateOperatorArityExtended, validateStdOperatorArity };
|
|
4630
|
+
export { OPERATOR_NAMES, STD_OPERATORS, STD_OPERATORS_BY_MODULE, getAllStdOperators, getLambdaOperators, getModuleOperators, getOperatorMetaExtended, getStdEffectOperators, getStdLibStats, getStdOperatorMeta, getStdOperatorsByModule, getStdPureOperators, isEffectOperatorExtended, isKnownOperatorExtended, isKnownStdOperator, isStdEffectOperator, isStdGuardOperator, validateOperatorArityExtended, validateStdOperatorArity };
|
|
4026
4631
|
//# sourceMappingURL=registry.js.map
|
|
4027
4632
|
//# sourceMappingURL=registry.js.map
|