@almadar/std 16.144.0 → 16.146.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 (124) hide show
  1. package/behaviors/lolo/ml/atoms/std-ml-classify.lolo +121 -0
  2. package/behaviors/lolo/ml/atoms/std-ml-exact-check.lolo +90 -0
  3. package/behaviors/lolo/ml/atoms/std-ml-infer.lolo +141 -0
  4. package/behaviors/lolo/ml/atoms/std-ml-label-capture.lolo +75 -0
  5. package/behaviors/lolo/ml/atoms/std-ml-lookup.lolo +83 -0
  6. package/behaviors/lolo/ml/atoms/std-ml-posterior.lolo +104 -0
  7. package/behaviors/lolo/ml/atoms/std-ml-similarity.lolo +166 -0
  8. package/behaviors/lolo/ml/molecules/std-escalating-decision.lolo +271 -0
  9. package/behaviors/lolo/ml/molecules/std-knowledge-tracing.lolo +115 -0
  10. package/behaviors/lolo/ui/core/atoms/std-app-layout.lolo +14 -0
  11. package/behaviors/lolo/ui/core/atoms/std-board.lolo +20 -6
  12. package/behaviors/lolo/ui/core/atoms/std-browse.lolo +23 -6
  13. package/behaviors/lolo/ui/core/atoms/std-calendar.lolo +80 -2
  14. package/behaviors/lolo/ui/core/atoms/std-stats.lolo +1 -1
  15. package/behaviors/lolo/ui/core/atoms/std-tag-taxonomy.lolo +3 -3
  16. package/behaviors/lolo/ui/core/atoms/ui-typography.lolo +1 -1
  17. package/behaviors/lolo/ui/core/molecules/ui-calendar-grid.lolo +18 -0
  18. package/behaviors/lolo/ui/core/molecules/ui-data-grid.lolo +2 -0
  19. package/behaviors/lolo/ui/core/molecules/ui-data-list.lolo +3 -2
  20. package/behaviors/lolo/ui/core/molecules/ui-filter-group.lolo +20 -0
  21. package/behaviors/lolo/ui/core/molecules/ui-search-input.lolo +7 -2
  22. package/behaviors/lolo/ui/core/molecules/ui-table-view.lolo +3 -2
  23. package/behaviors/lolo/ui/core/organisms/ui-entity-cards.lolo +2 -0
  24. package/behaviors/lolo/ui/core/organisms/ui-entity-list.lolo +2 -0
  25. package/behaviors/lolo/ui/core/organisms/ui-entity-table.lolo +2 -0
  26. package/behaviors/lolo/ui/core/organisms/ui-timeline.lolo +2 -0
  27. package/behaviors/lolo/ui/game/atoms/std-dungeon-combat.lolo +2 -2
  28. package/behaviors/lolo/ui/game/molecules/std-worldmap-board-2d.lolo +1 -1
  29. package/behaviors/lolo/ui/game/organisms/ui-boardgame-board.lolo +2 -2
  30. package/behaviors/lolo/ui/game/organisms/ui-builder-board.lolo +2 -2
  31. package/behaviors/lolo/ui/game/organisms/ui-debugger-board.lolo +3 -3
  32. package/behaviors/lolo/ui/game/organisms/ui-physics-sandbox-board.lolo +3 -3
  33. package/behaviors/lolo/ui/game/organisms/ui-roguelike-board.lolo +1 -1
  34. package/behaviors/lolo/ui/game/organisms/ui-sequencer-board.lolo +1 -1
  35. package/behaviors/lolo/ui/learning/atoms/std-algo-heapsort.lolo +2 -2
  36. package/behaviors/lolo/ui/learning/atoms/std-algo-mst.lolo +3 -3
  37. package/behaviors/registry/factory-signatures.json +5018 -824
  38. package/behaviors/registry/ml/atoms/std-ml-classify.orb +622 -0
  39. package/behaviors/registry/ml/atoms/std-ml-exact-check.orb +505 -0
  40. package/behaviors/registry/ml/atoms/std-ml-infer.orb +770 -0
  41. package/behaviors/registry/ml/atoms/std-ml-label-capture.orb +367 -0
  42. package/behaviors/registry/ml/atoms/std-ml-lookup.orb +473 -0
  43. package/behaviors/registry/ml/atoms/std-ml-posterior.orb +669 -0
  44. package/behaviors/registry/ml/atoms/std-ml-similarity.orb +917 -0
  45. package/behaviors/registry/ml/molecules/std-escalating-decision.orb +1553 -0
  46. package/behaviors/registry/ml/molecules/std-knowledge-tracing.orb +577 -0
  47. package/behaviors/registry/ui/core/atoms/std-app-layout.orb +33 -1
  48. package/behaviors/registry/ui/core/atoms/std-board.orb +64 -20
  49. package/behaviors/registry/ui/core/atoms/std-browse.orb +83 -48
  50. package/behaviors/registry/ui/core/atoms/std-calendar.orb +213 -3
  51. package/behaviors/registry/ui/core/atoms/ui-typography.orb +1 -1
  52. package/behaviors/registry/ui/core/molecules/ui-calendar-grid.orb +27 -0
  53. package/behaviors/registry/ui/core/molecules/ui-data-grid.orb +25 -12
  54. package/behaviors/registry/ui/core/molecules/ui-data-list.orb +26 -13
  55. package/behaviors/registry/ui/core/molecules/ui-filter-group.orb +86 -0
  56. package/behaviors/registry/ui/core/molecules/ui-search-input.orb +37 -1
  57. package/behaviors/registry/ui/core/molecules/ui-table-view.orb +25 -12
  58. package/behaviors/registry/ui/core/organisms/ui-entity-cards.orb +13 -0
  59. package/behaviors/registry/ui/core/organisms/ui-entity-list.orb +21 -8
  60. package/behaviors/registry/ui/core/organisms/ui-entity-table.orb +13 -0
  61. package/behaviors/registry/ui/core/organisms/ui-timeline.orb +13 -0
  62. package/behaviors/registry/ui/game/atoms/std-dungeon-combat.orb +4 -4
  63. package/behaviors/registry/ui/game/molecules/std-worldmap-board-2d.orb +6 -9
  64. package/behaviors/registry/ui/game/organisms/ui-boardgame-board.orb +4 -4
  65. package/behaviors/registry/ui/game/organisms/ui-builder-board.orb +4 -4
  66. package/behaviors/registry/ui/game/organisms/ui-debugger-board.orb +12 -12
  67. package/behaviors/registry/ui/game/organisms/ui-physics-sandbox-board.orb +19 -19
  68. package/behaviors/registry/ui/game/organisms/ui-roguelike-board.orb +1 -1
  69. package/behaviors/registry/ui/game/organisms/ui-sequencer-board.orb +2 -2
  70. package/behaviors/registry/ui/learning/atoms/std-algo-heapsort.orb +8 -8
  71. package/canonical-operators.json +30 -6
  72. package/dist/behaviors/behaviors-embeddings.json +267 -267
  73. package/dist/behaviors/exports-reader.js +2462 -2080
  74. package/dist/behaviors/functions/index.d.ts +725 -1
  75. package/dist/behaviors/functions/index.js +2437 -2081
  76. package/dist/behaviors/index.d.ts +1 -1
  77. package/dist/behaviors/index.js +2463 -2081
  78. package/dist/behaviors/knob-embeddings.json +1 -1
  79. package/dist/behaviors/query.js +2462 -2080
  80. package/dist/behaviors/registry/factory-signatures.json +5018 -824
  81. package/dist/behaviors/registry/ml/atoms/std-ml-classify.orb +622 -0
  82. package/dist/behaviors/registry/ml/atoms/std-ml-exact-check.orb +505 -0
  83. package/dist/behaviors/registry/ml/atoms/std-ml-infer.orb +770 -0
  84. package/dist/behaviors/registry/ml/atoms/std-ml-label-capture.orb +367 -0
  85. package/dist/behaviors/registry/ml/atoms/std-ml-lookup.orb +473 -0
  86. package/dist/behaviors/registry/ml/atoms/std-ml-posterior.orb +669 -0
  87. package/dist/behaviors/registry/ml/atoms/std-ml-similarity.orb +917 -0
  88. package/dist/behaviors/registry/ml/molecules/std-escalating-decision.orb +1553 -0
  89. package/dist/behaviors/registry/ml/molecules/std-knowledge-tracing.orb +577 -0
  90. package/dist/behaviors/registry/ui/core/atoms/std-app-layout.orb +33 -1
  91. package/dist/behaviors/registry/ui/core/atoms/std-board.orb +64 -20
  92. package/dist/behaviors/registry/ui/core/atoms/std-browse.orb +83 -48
  93. package/dist/behaviors/registry/ui/core/atoms/std-calendar.orb +213 -3
  94. package/dist/behaviors/registry/ui/core/atoms/ui-typography.orb +1 -1
  95. package/dist/behaviors/registry/ui/core/molecules/ui-calendar-grid.orb +27 -0
  96. package/dist/behaviors/registry/ui/core/molecules/ui-data-grid.orb +25 -12
  97. package/dist/behaviors/registry/ui/core/molecules/ui-data-list.orb +26 -13
  98. package/dist/behaviors/registry/ui/core/molecules/ui-filter-group.orb +86 -0
  99. package/dist/behaviors/registry/ui/core/molecules/ui-search-input.orb +37 -1
  100. package/dist/behaviors/registry/ui/core/molecules/ui-table-view.orb +25 -12
  101. package/dist/behaviors/registry/ui/core/organisms/ui-entity-cards.orb +13 -0
  102. package/dist/behaviors/registry/ui/core/organisms/ui-entity-list.orb +21 -8
  103. package/dist/behaviors/registry/ui/core/organisms/ui-entity-table.orb +13 -0
  104. package/dist/behaviors/registry/ui/core/organisms/ui-timeline.orb +13 -0
  105. package/dist/behaviors/registry/ui/game/atoms/std-dungeon-combat.orb +4 -4
  106. package/dist/behaviors/registry/ui/game/molecules/std-worldmap-board-2d.orb +6 -9
  107. package/dist/behaviors/registry/ui/game/organisms/ui-boardgame-board.orb +4 -4
  108. package/dist/behaviors/registry/ui/game/organisms/ui-builder-board.orb +4 -4
  109. package/dist/behaviors/registry/ui/game/organisms/ui-debugger-board.orb +12 -12
  110. package/dist/behaviors/registry/ui/game/organisms/ui-physics-sandbox-board.orb +19 -19
  111. package/dist/behaviors/registry/ui/game/organisms/ui-roguelike-board.orb +1 -1
  112. package/dist/behaviors/registry/ui/game/organisms/ui-sequencer-board.orb +2 -2
  113. package/dist/behaviors/registry/ui/learning/atoms/std-algo-heapsort.orb +8 -8
  114. package/dist/behaviors-embeddings.json +267 -267
  115. package/dist/index.d.ts +1 -1
  116. package/dist/index.js +2498 -2088
  117. package/dist/knob-embeddings.json +1 -1
  118. package/dist/modules/array.js +28 -0
  119. package/dist/modules/contract.js +4 -4
  120. package/dist/modules/data.js +3 -3
  121. package/dist/modules/index.js +35 -7
  122. package/dist/registry/factory-signatures.json +5018 -824
  123. package/dist/registry.js +35 -7
  124. package/package.json +3 -3
package/dist/registry.js CHANGED
@@ -2026,6 +2026,34 @@ var ARRAY_OPERATORS = {
2026
2026
  { name: "n", type: "number", description: "Number of elements to skip" }
2027
2027
  ],
2028
2028
  example: '["array/dropLast", "@items", 2]'
2029
+ },
2030
+ "array/cosine": {
2031
+ module: "array",
2032
+ category: "std-array",
2033
+ minArity: 2,
2034
+ maxArity: 2,
2035
+ description: 'Cosine similarity between two numeric vectors, in [-1, 1] (1 = identical direction). The building block for "is this answer semantically the reference answer" checks over embeddings. Pure math \u2014 usable in guards and value position, unlike the async llm/* substrate operators.',
2036
+ hasSideEffects: false,
2037
+ returnType: "number",
2038
+ params: [
2039
+ { name: "a", type: { kind: "array", of: "number" }, description: "First vector" },
2040
+ { name: "b", type: { kind: "array", of: "number" }, description: "Second vector" }
2041
+ ],
2042
+ example: '["array/cosine", "@entity.answerEmbedding", "@entity.referenceEmbedding"]'
2043
+ },
2044
+ "array/nearest": {
2045
+ module: "array",
2046
+ category: "std-array",
2047
+ minArity: 2,
2048
+ maxArity: 2,
2049
+ description: "Find the candidate vector nearest a query vector by cosine similarity. Returns { index, score, margin } \u2014 index/score of the best match, and margin (best score minus second-best), which is what makes an abstaining gate possible: a small margin means the top match is not confidently distinguished from the runner-up.",
2050
+ hasSideEffects: false,
2051
+ returnType: "object",
2052
+ params: [
2053
+ { name: "query", type: { kind: "array", of: "number" }, description: "Query vector" },
2054
+ { name: "candidates", type: { kind: "array", of: { kind: "array", of: "number" } }, description: "Candidate vectors to search" }
2055
+ ],
2056
+ example: '["array/nearest", "@entity.queryEmbedding", "@entity.candidateEmbeddings"]'
2029
2057
  }
2030
2058
  };
2031
2059
 
@@ -4408,9 +4436,9 @@ var CONTRACT_OPERATORS = {
4408
4436
  category: "ml-contract",
4409
4437
  minArity: 2,
4410
4438
  maxArity: 2,
4411
- description: "Validate tensor against input contract",
4439
+ description: "Validate tensor against input contract. Returns { valid, violations } \u2014 guard on `valid`, or read `violations` for the detail.",
4412
4440
  hasSideEffects: false,
4413
- returnType: "boolean",
4441
+ returnType: "object",
4414
4442
  params: [
4415
4443
  { name: "tensor", type: "tensor", description: "Input tensor" },
4416
4444
  { name: "contract", type: "object", description: "Input contract spec" }
@@ -4422,9 +4450,9 @@ var CONTRACT_OPERATORS = {
4422
4450
  category: "ml-contract",
4423
4451
  minArity: 2,
4424
4452
  maxArity: 2,
4425
- description: "Validate tensor against output contract",
4453
+ description: "Validate tensor against output contract. Returns { valid, violations } \u2014 guard on `valid`, or read `violations` for the detail.",
4426
4454
  hasSideEffects: false,
4427
- returnType: "boolean",
4455
+ returnType: "object",
4428
4456
  params: [
4429
4457
  { name: "tensor", type: "tensor", description: "Output tensor" },
4430
4458
  { name: "contract", type: "object", description: "Output contract spec" }
@@ -4530,14 +4558,14 @@ var DATA_OPERATORS = {
4530
4558
  category: "ml-data",
4531
4559
  minArity: 2,
4532
4560
  maxArity: 2,
4533
- description: "Train/val/test split",
4561
+ description: "Train/validation split. Config carries `trainRatio` (default 0.8); the remainder is the validation split.",
4534
4562
  hasSideEffects: false,
4535
4563
  returnType: "array",
4536
4564
  params: [
4537
4565
  { name: "dataset", type: "object", description: "Dataset" },
4538
- { name: "ratios", type: "array", description: "Split ratios e.g. [0.8, 0.1, 0.1]" }
4566
+ { name: "config", type: "object", description: "Split config, e.g. { trainRatio: 0.8 }" }
4539
4567
  ],
4540
- example: '["data/split", "@entity.dataset", [0.8, 0.1, 0.1]]'
4568
+ example: '["data/split", "@entity.dataset", { "trainRatio": 0.8 }]'
4541
4569
  },
4542
4570
  // ============================================================================
4543
4571
  // Preprocessing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/std",
3
- "version": "16.144.0",
3
+ "version": "16.146.0",
4
4
  "description": "Standard library operators for Almadar (math, string, array, etc.)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,11 +49,11 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@almadar/core": "^10.34.0"
52
+ "@almadar/core": "^10.36.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@almadar/eslint-plugin": "^2.15.0",
56
- "@almadar/llm": "^2.36.0",
56
+ "@almadar/llm": "^2.37.0",
57
57
  "@types/node": "^20.0.0",
58
58
  "@typescript-eslint/parser": "8.56.0",
59
59
  "eslint": "10.0.0",