@almadar/std 6.5.0 → 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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as StdModule, S as StdOperatorMeta } from './types-DUr71Cgy.js';
2
- export { B as BasicReturnType, b as OPERATOR_CATEGORIES, c as OperatorCategory, d as OperatorEffectMeta, O as OperatorMeta, e as OperatorTypeRef, f as STD_MODULES, g as STD_OPERATOR_CATEGORIES, h as StdOperatorCategory, i as getFunctionFromOperator, j as getModuleFromOperator, k as isStdCategory, l as isStdOperator, m as makeStdOperator } from './types-DUr71Cgy.js';
1
+ import { a as StdModule, S as StdOperatorMeta } from './types-D7dG8fBF.js';
2
+ export { B as BasicReturnType, b as OPERATOR_CATEGORIES, c as OperatorCategory, d as OperatorEffectMeta, O as OperatorMeta, e as OperatorTypeRef, f as STD_MODULES, g as STD_OPERATOR_CATEGORIES, h as StdOperatorCategory, i as getFunctionFromOperator, j as getModuleFromOperator, k as isStdCategory, l as isStdOperator, m as makeStdOperator } from './types-D7dG8fBF.js';
3
3
  export { STD_OPERATORS as OPERATORS, OPERATOR_NAMES, STD_OPERATORS, STD_OPERATORS_BY_MODULE, getAllStdOperators as getAllOperatorNames, getAllStdOperators, getLambdaOperators, getModuleOperators, getOperatorMetaExtended, getStdEffectOperators, getStdLibStats, getStdOperatorMeta, getStdOperatorsByModule, getStdPureOperators, isEffectOperatorExtended, isKnownStdOperator as isKnownOperator, isKnownOperatorExtended, isKnownStdOperator, isStdEffectOperator, isStdGuardOperator, validateStdOperatorArity as validateOperatorArity, validateOperatorArityExtended, validateStdOperatorArity } from './registry.js';
4
4
  export { CORE_OPERATORS, getCoreOperators } from './modules/core.js';
5
5
  export { MATH_OPERATORS } from './modules/math.js';
package/dist/index.js CHANGED
@@ -418,6 +418,10 @@ var CORE_OPERATORS = {
418
418
  example: '["set", "@entity.health", 100]',
419
419
  effect: {
420
420
  kind: "set",
421
+ // success emit carries the written value; the evaluator coerces to the
422
+ // binding's declared type, so 'any' is the general shape. A future pass
423
+ // can narrow per-binding via resolveBinding.
424
+ produces: ANY,
421
425
  config: { operation: SET_OPERATION }
422
426
  }
423
427
  },
@@ -457,7 +461,35 @@ var CORE_OPERATORS = {
457
461
  { name: "data", type: ENTITY_REF, description: "Payload (create/update) or entity id (delete)", optional: true }
458
462
  ],
459
463
  example: '["persist", "create", "Task", { "title": "@payload.title" }]',
460
- effect: { kind: "persist" }
464
+ effect: {
465
+ kind: "persist",
466
+ // Action-discriminated union. The compiler narrows at the call site
467
+ // based on the action arg literal to pick the right branch when
468
+ // checking the emit.success event's declared payload.
469
+ // create/update -> the resulting entity record
470
+ // delete/clear -> { id, deleted }
471
+ // batch -> summary of operations
472
+ produces: {
473
+ kind: "union",
474
+ of: [
475
+ { kind: "entity" },
476
+ {
477
+ kind: "object",
478
+ fields: { id: STRING, deleted: BOOLEAN },
479
+ open: false
480
+ },
481
+ {
482
+ kind: "object",
483
+ fields: {
484
+ operations: { kind: "array", of: ANY },
485
+ completedCount: NUMBER,
486
+ totalCount: NUMBER
487
+ },
488
+ open: false
489
+ }
490
+ ]
491
+ }
492
+ }
461
493
  },
462
494
  navigate: {
463
495
  module: "core",
@@ -528,6 +560,89 @@ var CORE_OPERATORS = {
528
560
  example: '["despawn", "@entity.id"]',
529
561
  effect: { kind: "despawn" }
530
562
  },
563
+ fetch: {
564
+ module: "core",
565
+ category: "effect",
566
+ minArity: 1,
567
+ maxArity: 2,
568
+ description: "Fetch an entity (by id) or a collection (by filter) from persistence",
569
+ hasSideEffects: true,
570
+ returnType: "void",
571
+ params: [
572
+ { name: "entity", type: { kind: "entity" }, description: "Target entity name" },
573
+ {
574
+ name: "options",
575
+ type: {
576
+ kind: "object",
577
+ fields: {
578
+ id: STRING,
579
+ filter: ANY,
580
+ limit: NUMBER,
581
+ offset: NUMBER,
582
+ include: { kind: "array", of: STRING },
583
+ emit: { kind: "object", fields: {}, open: true }
584
+ },
585
+ open: true
586
+ },
587
+ description: "Fetch options: id | filter | limit | offset | include | emit",
588
+ optional: true
589
+ }
590
+ ],
591
+ example: '["fetch", "Task", { "id": "@payload.taskId", "emit": { "success": "TASK_LOADED" } }]',
592
+ effect: {
593
+ kind: "fetch",
594
+ // Call-site-discriminated union: options.id present -> single entity;
595
+ // otherwise -> array of entity. The compiler narrows at the call site
596
+ // when checking emit.success against the declared event payload.
597
+ produces: {
598
+ kind: "union",
599
+ of: [
600
+ { kind: "entity" },
601
+ { kind: "array", of: { kind: "entity" } }
602
+ ]
603
+ }
604
+ }
605
+ },
606
+ ref: {
607
+ module: "core",
608
+ category: "effect",
609
+ minArity: 1,
610
+ maxArity: 2,
611
+ description: "Reactive entity reference (deprecated, use fetch with listens in V2)",
612
+ hasSideEffects: true,
613
+ returnType: "void",
614
+ params: [
615
+ { name: "entity", type: { kind: "entity" }, description: "Target entity name" },
616
+ {
617
+ name: "options",
618
+ type: {
619
+ kind: "object",
620
+ fields: {
621
+ id: STRING,
622
+ filter: ANY,
623
+ include: { kind: "array", of: STRING },
624
+ emit: { kind: "object", fields: {}, open: true }
625
+ },
626
+ open: true
627
+ },
628
+ description: "Ref options: id | filter | include | emit",
629
+ optional: true
630
+ }
631
+ ],
632
+ example: '["ref", "Task"]',
633
+ effect: {
634
+ kind: "ref",
635
+ // Same call-site shape as fetch. Kept for the V2 transition period;
636
+ // scheduled for deprecation in a later phase (see Almadar_Entity_V2_Plan.md).
637
+ produces: {
638
+ kind: "union",
639
+ of: [
640
+ { kind: "entity" },
641
+ { kind: "array", of: { kind: "entity" } }
642
+ ]
643
+ }
644
+ }
645
+ },
531
646
  "call-service": {
532
647
  module: "core",
533
648
  category: "effect",
@@ -547,7 +662,13 @@ var CORE_OPERATORS = {
547
662
  }
548
663
  ],
549
664
  example: '["call-service", "llm", "generate", { "userPrompt": "@entity.inputText" }]',
550
- effect: { kind: "call-service" }
665
+ effect: {
666
+ kind: "call-service",
667
+ // TODO(entity-v2): narrow to the declared service return type once
668
+ // per-service return shapes live on the orbital services block.
669
+ // Today the emit.success payload is whatever the service adapter returns.
670
+ produces: ANY
671
+ }
551
672
  },
552
673
  "render-ui": {
553
674
  module: "core",