@almadar/std 6.4.0 → 6.5.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 (40) hide show
  1. package/behaviors/registry/atoms/std-search.orb +2 -2
  2. package/behaviors/registry/atoms/std-selection.orb +2 -2
  3. package/behaviors/registry/atoms/std-sort.orb +2 -2
  4. package/behaviors/registry/atoms/std-sprite.orb +2 -2
  5. package/dist/behaviors/registry/atoms/std-search.orb +2 -2
  6. package/dist/behaviors/registry/atoms/std-selection.orb +2 -2
  7. package/dist/behaviors/registry/atoms/std-sort.orb +2 -2
  8. package/dist/behaviors/registry/atoms/std-sprite.orb +2 -2
  9. package/dist/index.d.ts +4 -3
  10. package/dist/index.js +559 -2
  11. package/dist/index.js.map +1 -1
  12. package/dist/modules/agent.d.ts +1 -1
  13. package/dist/modules/array.d.ts +1 -1
  14. package/dist/modules/async.d.ts +1 -1
  15. package/dist/modules/composition.d.ts +1 -1
  16. package/dist/modules/contract.d.ts +1 -1
  17. package/dist/modules/core.d.ts +27 -0
  18. package/dist/modules/core.js +486 -0
  19. package/dist/modules/core.js.map +1 -0
  20. package/dist/modules/data.d.ts +1 -1
  21. package/dist/modules/format.d.ts +1 -1
  22. package/dist/modules/graph.d.ts +1 -1
  23. package/dist/modules/index.d.ts +2 -1
  24. package/dist/modules/index.js +484 -1
  25. package/dist/modules/index.js.map +1 -1
  26. package/dist/modules/math.d.ts +1 -1
  27. package/dist/modules/nn.d.ts +1 -1
  28. package/dist/modules/object.d.ts +1 -1
  29. package/dist/modules/os.d.ts +1 -1
  30. package/dist/modules/prob.d.ts +1 -1
  31. package/dist/modules/str.d.ts +1 -1
  32. package/dist/modules/tensor.d.ts +1 -1
  33. package/dist/modules/time.d.ts +1 -1
  34. package/dist/modules/train.d.ts +1 -1
  35. package/dist/modules/validate.d.ts +1 -1
  36. package/dist/registry.d.ts +7 -3
  37. package/dist/registry.js +485 -1
  38. package/dist/registry.js.map +1 -1
  39. package/dist/{types-hu1LavLs.d.ts → types-DUr71Cgy.d.ts} +62 -3
  40. package/package.json +2 -3
@@ -11,6 +11,10 @@
11
11
  */
12
12
  declare const OPERATOR_CATEGORIES: readonly ["arithmetic", "comparison", "logic", "control", "effect", "collection", "std-math", "std-str", "std-array", "std-object", "std-validate", "std-time", "std-format", "std-async", "std-nn", "std-tensor", "std-train", "std-prob", "std-os", "std-agent", "std-composition", "ml-arch", "ml-effect", "ml-tensor", "ml-graph", "ml-contract", "ml-data"];
13
13
  type OperatorCategory = (typeof OPERATOR_CATEGORIES)[number];
14
+ /**
15
+ * Basic return types for core operators.
16
+ */
17
+ type BasicReturnType = 'number' | 'boolean' | 'string' | 'any' | 'void' | 'array';
14
18
  /**
15
19
  * Base metadata for an operator.
16
20
  */
@@ -33,7 +37,7 @@ interface OperatorMeta {
33
37
  * Each module provides a set of operators prefixed with the module name.
34
38
  * E.g., 'math' provides 'math/abs', 'math/clamp', etc.
35
39
  */
36
- declare const STD_MODULES: readonly ["math", "str", "array", "object", "time", "validate", "format", "async", "nn", "tensor", "train", "prob", "os", "agent", "graph", "contract", "data", "composition"];
40
+ declare const STD_MODULES: readonly ["core", "math", "str", "array", "object", "time", "validate", "format", "async", "nn", "tensor", "train", "prob", "os", "agent", "graph", "contract", "data", "composition"];
37
41
  type StdModule = (typeof STD_MODULES)[number];
38
42
  /**
39
43
  * Standard library operator categories.
@@ -41,6 +45,59 @@ type StdModule = (typeof STD_MODULES)[number];
41
45
  */
42
46
  declare const STD_OPERATOR_CATEGORIES: readonly ["std-math", "std-str", "std-array", "std-object", "std-time", "std-validate", "std-format", "std-async", "std-nn", "std-tensor", "std-train", "std-prob", "std-os", "std-agent", "std-composition", "ml-arch", "ml-effect", "ml-tensor", "ml-graph", "ml-contract", "ml-data"];
43
47
  type StdOperatorCategory = (typeof STD_OPERATOR_CATEGORIES)[number];
48
+ /**
49
+ * Structured parameter type reference (Schema v2).
50
+ *
51
+ * A plain string (e.g. `'number'`, `'string'`) is still accepted for
52
+ * backward compatibility with simple primitives. Richer shapes let effect
53
+ * operators declare literal unions, UI slots, event keys, and entity refs
54
+ * so compilers, LLM prompt generators, and validators can reason about the
55
+ * argument shape without string heuristics.
56
+ */
57
+ type OperatorTypeRef = string | {
58
+ kind: 'union';
59
+ of: OperatorTypeRef[];
60
+ } | {
61
+ kind: 'literal';
62
+ value: string | number | boolean;
63
+ } | {
64
+ kind: 'array';
65
+ of: OperatorTypeRef;
66
+ } | {
67
+ kind: 'object';
68
+ fields: Record<string, OperatorTypeRef>;
69
+ open?: boolean;
70
+ } | {
71
+ kind: 'entity';
72
+ collection?: string;
73
+ } | {
74
+ kind: 'entityRef';
75
+ } | {
76
+ kind: 'eventKey';
77
+ scope?: 'internal' | 'external';
78
+ } | {
79
+ kind: 'uiSlot';
80
+ } | {
81
+ kind: 'patternType';
82
+ } | {
83
+ kind: 'binding';
84
+ shape?: OperatorTypeRef;
85
+ } | {
86
+ kind: 'sexpr';
87
+ };
88
+ /**
89
+ * Effect-specific metadata (Schema v2).
90
+ * Populated only when `hasSideEffects: true`. Describes what the effect
91
+ * produces back onto the runtime bus or state tree so consumers (Rust
92
+ * validator, LLM skill gen, verify) can trace downstream reactions.
93
+ */
94
+ interface OperatorEffectMeta {
95
+ kind: 'emit' | 'persist' | 'fetch' | 'render-ui' | 'navigate' | 'notify' | 'spawn' | 'despawn' | 'set' | 'call-service' | 'log' | 'custom';
96
+ /** What the effect puts onto the bus / state when it resolves. */
97
+ produces?: OperatorTypeRef;
98
+ /** Effect-specific config keys and their declared types. */
99
+ config?: Record<string, OperatorTypeRef>;
100
+ }
44
101
  /**
45
102
  * Extended operator metadata for std library operators.
46
103
  * Adds parameter descriptions and examples.
@@ -51,7 +108,7 @@ interface StdOperatorMeta extends OperatorMeta {
51
108
  /** Parameter names and descriptions */
52
109
  params?: {
53
110
  name: string;
54
- type: string;
111
+ type: OperatorTypeRef;
55
112
  description: string;
56
113
  optional?: boolean;
57
114
  defaultValue?: unknown;
@@ -64,6 +121,8 @@ interface StdOperatorMeta extends OperatorMeta {
64
121
  lambdaArgPosition?: number;
65
122
  /** Compile-time operator (resolved during .lolo lowering, not at runtime) */
66
123
  compileTime?: boolean;
124
+ /** Schema v2: structured metadata for effect operators */
125
+ effect?: OperatorEffectMeta;
67
126
  }
68
127
  /**
69
128
  * Type guard to check if an operator category is a std category.
@@ -90,4 +149,4 @@ declare function isStdOperator(operator: string): boolean;
90
149
  */
91
150
  declare function makeStdOperator(module: StdModule, fn: string): string;
92
151
 
93
- export { type StdOperatorMeta as S, type StdModule as a, STD_MODULES as b, STD_OPERATOR_CATEGORIES as c, type StdOperatorCategory as d, getModuleFromOperator as e, isStdOperator as f, getFunctionFromOperator as g, isStdCategory as i, makeStdOperator as m };
152
+ export { type BasicReturnType as B, type OperatorMeta as O, type StdOperatorMeta as S, type StdModule as a, OPERATOR_CATEGORIES as b, type OperatorCategory as c, type OperatorEffectMeta as d, type OperatorTypeRef as e, STD_MODULES as f, STD_OPERATOR_CATEGORIES as g, type StdOperatorCategory as h, getFunctionFromOperator as i, getModuleFromOperator as j, isStdCategory as k, isStdOperator as l, makeStdOperator as m };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/std",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "description": "Standard library operators for Almadar (math, string, array, etc.)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -41,8 +41,7 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@almadar/core": ">=4.7.0",
45
- "@almadar/operators": ">=2.1.3"
44
+ "@almadar/core": ">=4.8.2"
46
45
  },
47
46
  "devDependencies": {
48
47
  "@almadar/eslint-plugin": ">=2.3.0",