@almadar/std 6.5.0 → 6.5.2

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.
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Math Module - Numeric Operations
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Neural Network Module - Neural Network Operations
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Object Module - Object Operations
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * OS Module - Operating System Event Watchers
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Prob Module - Probabilistic Programming Operators
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * String Module - String Operations
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Tensor Module - Tensor Operations
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Time Module - Date and Time Operations
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Training Module - Neural Network Training Operations
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta } from '../types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta } from '../types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Validate Module - Input Validation
@@ -1,4 +1,4 @@
1
- import { S as StdOperatorMeta, a as StdModule, O as OperatorMeta } from './types-DUr71Cgy.js';
1
+ import { S as StdOperatorMeta, a as StdModule, O as OperatorMeta } from './types-D7dG8fBF.js';
2
2
 
3
3
  /**
4
4
  * Standard Library Registry
package/dist/registry.js CHANGED
@@ -346,6 +346,10 @@ var CORE_OPERATORS = {
346
346
  example: '["set", "@entity.health", 100]',
347
347
  effect: {
348
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,
349
353
  config: { operation: SET_OPERATION }
350
354
  }
351
355
  },
@@ -385,7 +389,35 @@ var CORE_OPERATORS = {
385
389
  { name: "data", type: ENTITY_REF, description: "Payload (create/update) or entity id (delete)", optional: true }
386
390
  ],
387
391
  example: '["persist", "create", "Task", { "title": "@payload.title" }]',
388
- effect: { kind: "persist" }
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
+ }
389
421
  },
390
422
  navigate: {
391
423
  module: "core",
@@ -456,6 +488,89 @@ var CORE_OPERATORS = {
456
488
  example: '["despawn", "@entity.id"]',
457
489
  effect: { kind: "despawn" }
458
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
+ },
459
574
  "call-service": {
460
575
  module: "core",
461
576
  category: "effect",
@@ -475,7 +590,13 @@ var CORE_OPERATORS = {
475
590
  }
476
591
  ],
477
592
  example: '["call-service", "llm", "generate", { "userPrompt": "@entity.inputText" }]',
478
- effect: { kind: "call-service" }
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
+ }
479
600
  },
480
601
  "render-ui": {
481
602
  module: "core",