@almadar/core 10.30.0 → 10.31.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.
- package/dist/{builders-C458pIMW.d.ts → builders-DDcCVboe.d.ts} +687 -687
- package/dist/builders.d.ts +3 -3
- package/dist/builders.js +10 -6
- package/dist/builders.js.map +1 -1
- package/dist/factory/index.d.ts +5 -5
- package/dist/factory-runtime/index.d.ts +3 -3
- package/dist/factory-runtime/index.js +10 -6
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/index.d.ts +7 -9
- package/dist/index.js +894 -549
- package/dist/index.js.map +1 -1
- package/dist/{pattern-types-CLcOXOmW.d.ts → pattern-types-VDIr2TkX.d.ts} +104 -37
- package/dist/patterns/component-mapping.json +13 -3
- package/dist/patterns/event-contracts.json +10 -3
- package/dist/patterns/index.d.ts +1971 -870
- package/dist/patterns/index.js +1041 -695
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/patterns-registry.json +917 -593
- package/dist/patterns/registry.json +917 -593
- package/dist/{trait-CwWjkU-1.d.ts → trait-DE6VU4Cd.d.ts} +85 -84
- package/dist/types/index.d.ts +7 -9
- package/dist/types/index.js +21 -17
- package/dist/types/index.js.map +1 -1
- package/dist/{types-yW22YNNt.d.ts → types-DSfz2mr5.d.ts} +2 -3
- package/package.json +1 -1
- package/dist/json-DOTchoRS.d.ts +0 -57
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AnyPatternConfig, b as EntityRow, c as EventId, T as TraitId, O as OrbitalId, d as EntityId, P as PageId, e as Entity, E as EntityField } from './pattern-types-
|
|
1
|
+
import { A as AnyPatternConfig, b as EntityRow, c as EventId, T as TraitId, O as OrbitalId, d as EntityId, P as PageId, e as Entity, E as EntityField } from './pattern-types-VDIr2TkX.js';
|
|
2
2
|
import { S as SExpr, E as EventPayload, a as Expression } from './expression-CB9R3KWk.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
@@ -37,7 +37,7 @@ declare const ServiceTypeSchema: z.ZodEnum<["rest", "socket", "mcp"]>;
|
|
|
37
37
|
* };
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
type RestServiceDef = {
|
|
41
41
|
/** Unique service name (used in call_service effect) */
|
|
42
42
|
name: string;
|
|
43
43
|
/** Service type */
|
|
@@ -52,11 +52,11 @@ interface RestServiceDef {
|
|
|
52
52
|
auth?: RestAuthConfig;
|
|
53
53
|
/** Timeout in milliseconds (default: 30000) */
|
|
54
54
|
timeout?: number;
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
56
|
/**
|
|
57
57
|
* Authentication configuration for REST services.
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
type RestAuthConfig = {
|
|
60
60
|
/** Authentication type */
|
|
61
61
|
type: "api-key" | "bearer" | "basic" | "oauth2";
|
|
62
62
|
/** For api-key: the query parameter or header name */
|
|
@@ -65,7 +65,7 @@ interface RestAuthConfig {
|
|
|
65
65
|
location?: "query" | "header";
|
|
66
66
|
/** Environment variable name containing the secret (for secure storage) */
|
|
67
67
|
secretEnv?: string;
|
|
68
|
-
}
|
|
68
|
+
};
|
|
69
69
|
declare const RestAuthConfigSchema: z.ZodObject<{
|
|
70
70
|
type: z.ZodEnum<["api-key", "bearer", "basic", "oauth2"]>;
|
|
71
71
|
keyName: z.ZodOptional<z.ZodString>;
|
|
@@ -148,7 +148,7 @@ declare const RestServiceDefSchema: z.ZodObject<{
|
|
|
148
148
|
* };
|
|
149
149
|
* ```
|
|
150
150
|
*/
|
|
151
|
-
|
|
151
|
+
type SocketServiceDef = {
|
|
152
152
|
/** Unique service name */
|
|
153
153
|
name: string;
|
|
154
154
|
/** Service type */
|
|
@@ -168,16 +168,16 @@ interface SocketServiceDef {
|
|
|
168
168
|
/** Delay between attempts in ms */
|
|
169
169
|
delayMs?: number;
|
|
170
170
|
};
|
|
171
|
-
}
|
|
171
|
+
};
|
|
172
172
|
/**
|
|
173
173
|
* Socket event definitions.
|
|
174
174
|
*/
|
|
175
|
-
|
|
175
|
+
type SocketEvents = {
|
|
176
176
|
/** Events received from server (maps to orbital events) */
|
|
177
177
|
inbound: string[];
|
|
178
178
|
/** Events sent to server (triggered by effects) */
|
|
179
179
|
outbound: string[];
|
|
180
|
-
}
|
|
180
|
+
};
|
|
181
181
|
declare const SocketEventsSchema: z.ZodObject<{
|
|
182
182
|
inbound: z.ZodArray<z.ZodString, "many">;
|
|
183
183
|
outbound: z.ZodArray<z.ZodString, "many">;
|
|
@@ -258,7 +258,7 @@ declare const SocketServiceDefSchema: z.ZodObject<{
|
|
|
258
258
|
* };
|
|
259
259
|
* ```
|
|
260
260
|
*/
|
|
261
|
-
|
|
261
|
+
type McpServiceDef = {
|
|
262
262
|
/** Unique service name */
|
|
263
263
|
name: string;
|
|
264
264
|
/** Service type */
|
|
@@ -271,7 +271,7 @@ interface McpServiceDef {
|
|
|
271
271
|
capabilities: string[];
|
|
272
272
|
/** Environment variables to pass to the MCP server */
|
|
273
273
|
env?: Record<string, string>;
|
|
274
|
-
}
|
|
274
|
+
};
|
|
275
275
|
declare const McpServiceDefSchema: z.ZodObject<{
|
|
276
276
|
name: z.ZodString;
|
|
277
277
|
type: z.ZodLiteral<"mcp">;
|
|
@@ -450,7 +450,7 @@ type ServiceRef = ServiceDefinition | ServiceRefObject | string;
|
|
|
450
450
|
* };
|
|
451
451
|
* ```
|
|
452
452
|
*/
|
|
453
|
-
|
|
453
|
+
type ServiceRefObject = {
|
|
454
454
|
/** Reference to imported service: "Alias.services.ServiceName" */
|
|
455
455
|
ref: string;
|
|
456
456
|
/** Override the service description */
|
|
@@ -463,7 +463,7 @@ interface ServiceRefObject {
|
|
|
463
463
|
url?: string;
|
|
464
464
|
/** Override the MCP server path */
|
|
465
465
|
serverPath?: string;
|
|
466
|
-
}
|
|
466
|
+
};
|
|
467
467
|
/**
|
|
468
468
|
* Checks if a service reference is a bare string reference.
|
|
469
469
|
*
|
|
@@ -742,9 +742,9 @@ declare function hasService(services: ServiceDefinition[], name: string): boolea
|
|
|
742
742
|
*/
|
|
743
743
|
type ServiceParamsValue = string | number | boolean | Date | null | undefined | ServiceParams | readonly ServiceParamsValue[];
|
|
744
744
|
/** Parameters passed to call-service effects. Recursive for nested request shapes. */
|
|
745
|
-
|
|
745
|
+
type ServiceParams = {
|
|
746
746
|
[key: string]: ServiceParamsValue;
|
|
747
|
-
}
|
|
747
|
+
};
|
|
748
748
|
|
|
749
749
|
/**
|
|
750
750
|
* Effect Types (Self-Contained)
|
|
@@ -765,7 +765,7 @@ declare const UISlotSchema: z.ZodEnum<["main", "sidebar", "modal", "drawer", "ov
|
|
|
765
765
|
/**
|
|
766
766
|
* Configuration extracted from call-service effects
|
|
767
767
|
*/
|
|
768
|
-
|
|
768
|
+
type CallServiceConfig = {
|
|
769
769
|
service: string;
|
|
770
770
|
action: string;
|
|
771
771
|
endpoint?: string;
|
|
@@ -773,7 +773,7 @@ interface CallServiceConfig {
|
|
|
773
773
|
params?: ServiceParams;
|
|
774
774
|
onSuccess?: string;
|
|
775
775
|
onError?: string;
|
|
776
|
-
}
|
|
776
|
+
};
|
|
777
777
|
/**
|
|
778
778
|
* A binding reference to a render tree stored elsewhere — a trait `config`
|
|
779
779
|
* knob or a payload field — e.g. `"@config.bodyContent"`. Resolved to a pattern
|
|
@@ -882,12 +882,12 @@ type SetEffect = ['set', string, unknown] | ['set', string, string, unknown];
|
|
|
882
882
|
* position. See `(persist create Entity @payload.data { emit: { success:
|
|
883
883
|
* "Saved", failure: "SaveFailed" } })` in `.lolo` source.
|
|
884
884
|
*/
|
|
885
|
-
|
|
885
|
+
type PersistEmitConfig = {
|
|
886
886
|
emit?: {
|
|
887
887
|
success?: string;
|
|
888
888
|
failure?: string;
|
|
889
889
|
};
|
|
890
|
-
}
|
|
890
|
+
};
|
|
891
891
|
/**
|
|
892
892
|
* Persist effect data argument: either an entity row literal (field map)
|
|
893
893
|
* or a binding string referencing a row in scope (e.g. `@payload.data`,
|
|
@@ -953,7 +953,7 @@ type NotifyEffect = ['notify', string, string | SExpr] | ['notify', string, stri
|
|
|
953
953
|
* `limit`, `offset`, `include`, plus the trailing `emit:` map for
|
|
954
954
|
* success/failure event names.
|
|
955
955
|
*/
|
|
956
|
-
|
|
956
|
+
type FetchOptions = {
|
|
957
957
|
/** Fetch a single entity by ID */
|
|
958
958
|
id?: string;
|
|
959
959
|
/** Filter expression (S-expression) */
|
|
@@ -969,7 +969,7 @@ interface FetchOptions {
|
|
|
969
969
|
success?: string;
|
|
970
970
|
failure?: string;
|
|
971
971
|
};
|
|
972
|
-
}
|
|
972
|
+
};
|
|
973
973
|
/**
|
|
974
974
|
* Fetch effect - retrieves entity data (server-side).
|
|
975
975
|
* @example ['fetch', 'User'] or ['fetch', 'User', { id: '@payload.userId' }]
|
|
@@ -1042,7 +1042,7 @@ type SwapEffect = ['swap!', string, SExpr];
|
|
|
1042
1042
|
* Options accepted by `watch` effects. Mirrors what the runtime reads when
|
|
1043
1043
|
* registering the change callback: `debounce` and the trailing `emit:` map.
|
|
1044
1044
|
*/
|
|
1045
|
-
|
|
1045
|
+
type WatchOptions = {
|
|
1046
1046
|
/** Debounce duration in milliseconds */
|
|
1047
1047
|
debounce?: number;
|
|
1048
1048
|
/** Lifecycle events to emit on update / failure */
|
|
@@ -1050,7 +1050,7 @@ interface WatchOptions {
|
|
|
1050
1050
|
on_message?: string;
|
|
1051
1051
|
failure?: string;
|
|
1052
1052
|
};
|
|
1053
|
-
}
|
|
1053
|
+
};
|
|
1054
1054
|
/**
|
|
1055
1055
|
* Watch effect - registers a callback for entity changes.
|
|
1056
1056
|
* Emits an event whenever the watched binding changes.
|
|
@@ -1070,48 +1070,48 @@ type AtomicEffect = ['atomic', ...SExpr[]];
|
|
|
1070
1070
|
* lives in `almadar-std/modules/nn`; here we keep the wire shape generic
|
|
1071
1071
|
* enough for the cross-package runtime + Python bridge to round-trip.
|
|
1072
1072
|
*/
|
|
1073
|
-
|
|
1073
|
+
type NnLayer = {
|
|
1074
1074
|
type: string;
|
|
1075
1075
|
[key: string]: string | number | boolean | number[] | string[] | undefined;
|
|
1076
|
-
}
|
|
1076
|
+
};
|
|
1077
1077
|
/**
|
|
1078
1078
|
* Hyperparameters for `train` and `evaluate`. Recursive to allow nested
|
|
1079
1079
|
* optimizer / scheduler config blocks without falling back to `unknown`.
|
|
1080
1080
|
*/
|
|
1081
|
-
|
|
1081
|
+
type NnConfig = {
|
|
1082
1082
|
[key: string]: string | number | boolean | string[] | number[] | NnConfig | undefined;
|
|
1083
|
-
}
|
|
1083
|
+
};
|
|
1084
1084
|
/**
|
|
1085
1085
|
* Forward-pass config: `input` is a binding string (`@payload.input`), and
|
|
1086
1086
|
* `on-complete` names the event to fire when the prediction lands.
|
|
1087
1087
|
*/
|
|
1088
|
-
|
|
1088
|
+
type ForwardConfig = {
|
|
1089
1089
|
architecture: NnLayer[];
|
|
1090
1090
|
input: string;
|
|
1091
1091
|
'on-complete'?: string;
|
|
1092
1092
|
config?: NnConfig;
|
|
1093
|
-
}
|
|
1093
|
+
};
|
|
1094
1094
|
/**
|
|
1095
1095
|
* Training-loop config. `dataset` is a binding string referencing the rows
|
|
1096
1096
|
* to train on. Optimizer / loss / scheduler land inside `config`.
|
|
1097
1097
|
*/
|
|
1098
|
-
|
|
1098
|
+
type TrainConfig = {
|
|
1099
1099
|
architecture: NnLayer[];
|
|
1100
1100
|
dataset: string;
|
|
1101
1101
|
config?: NnConfig;
|
|
1102
1102
|
'on-complete'?: string;
|
|
1103
|
-
}
|
|
1103
|
+
};
|
|
1104
1104
|
/**
|
|
1105
1105
|
* Evaluation config. `metrics` lists named metrics the Python backend
|
|
1106
1106
|
* computes (`accuracy`, `precision`, ...).
|
|
1107
1107
|
*/
|
|
1108
|
-
|
|
1108
|
+
type EvaluateConfig = {
|
|
1109
1109
|
architecture: NnLayer[];
|
|
1110
1110
|
dataset: string;
|
|
1111
1111
|
metrics: string[];
|
|
1112
1112
|
config?: NnConfig;
|
|
1113
1113
|
'on-complete'?: string;
|
|
1114
|
-
}
|
|
1114
|
+
};
|
|
1115
1115
|
/**
|
|
1116
1116
|
* Forward effect - runs a neural network forward pass (Python backend).
|
|
1117
1117
|
* @example ['forward', 'primary', { architecture: [...], input: '@payload.input', 'on-complete': 'PREDICTION_READY' }]
|
|
@@ -1437,9 +1437,9 @@ declare function watch(binding: string, event: string, options: WatchOptions): W
|
|
|
1437
1437
|
*/
|
|
1438
1438
|
declare function atomic(...effects: SExpr[]): AtomicEffect;
|
|
1439
1439
|
/** Resolved pattern props for render-ui effects at runtime. Recursive for nested pattern configs. */
|
|
1440
|
-
|
|
1440
|
+
type ResolvedPatternProps = {
|
|
1441
1441
|
[prop: string]: string | number | boolean | null | undefined | ResolvedPatternProps | ResolvedPatternProps[];
|
|
1442
|
-
}
|
|
1442
|
+
};
|
|
1443
1443
|
/** A node in a render-ui effect tree. */
|
|
1444
1444
|
interface RenderUINode {
|
|
1445
1445
|
type: string;
|
|
@@ -1456,7 +1456,7 @@ interface RenderUINode {
|
|
|
1456
1456
|
/**
|
|
1457
1457
|
* Represents a state in the state machine
|
|
1458
1458
|
*/
|
|
1459
|
-
|
|
1459
|
+
type State = {
|
|
1460
1460
|
/** State name (unique identifier) */
|
|
1461
1461
|
name: string;
|
|
1462
1462
|
/** Whether this is the initial state */
|
|
@@ -1471,7 +1471,7 @@ interface State {
|
|
|
1471
1471
|
onEntry?: string[];
|
|
1472
1472
|
/** Effect names to run on exit */
|
|
1473
1473
|
onExit?: string[];
|
|
1474
|
-
}
|
|
1474
|
+
};
|
|
1475
1475
|
declare const StateSchema: z.ZodObject<{
|
|
1476
1476
|
name: z.ZodString;
|
|
1477
1477
|
isInitial: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1500,7 +1500,7 @@ declare const StateSchema: z.ZodObject<{
|
|
|
1500
1500
|
/**
|
|
1501
1501
|
* Payload field definition for events
|
|
1502
1502
|
*/
|
|
1503
|
-
|
|
1503
|
+
type PayloadField = {
|
|
1504
1504
|
name: string;
|
|
1505
1505
|
/**
|
|
1506
1506
|
* Field type. Mirrors the Rust validator's acceptance: any non-empty
|
|
@@ -1513,12 +1513,12 @@ interface PayloadField {
|
|
|
1513
1513
|
required?: boolean;
|
|
1514
1514
|
/** Structured property schema for object-typed payload fields (recursive). */
|
|
1515
1515
|
properties?: ReadonlyArray<PayloadField>;
|
|
1516
|
-
}
|
|
1516
|
+
};
|
|
1517
1517
|
declare const PayloadFieldSchema: z.ZodType<PayloadField>;
|
|
1518
1518
|
/**
|
|
1519
1519
|
* Represents an event that can trigger transitions
|
|
1520
1520
|
*/
|
|
1521
|
-
|
|
1521
|
+
type Event = {
|
|
1522
1522
|
/** Event key (UPPER_SNAKE_CASE) */
|
|
1523
1523
|
key: string;
|
|
1524
1524
|
/** V4 dual-carry id sibling of `key` — optional until the Phase-7 flip. */
|
|
@@ -1538,7 +1538,7 @@ interface Event {
|
|
|
1538
1538
|
classification?: "domain" | "system";
|
|
1539
1539
|
/** Semantic role of this event (optional, for analysis) */
|
|
1540
1540
|
semanticRole?: string;
|
|
1541
|
-
}
|
|
1541
|
+
};
|
|
1542
1542
|
declare const EventSchema: z.ZodObject<{
|
|
1543
1543
|
key: z.ZodString;
|
|
1544
1544
|
id: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
|
|
@@ -1581,12 +1581,12 @@ declare const EventSchema: z.ZodObject<{
|
|
|
1581
1581
|
* description: "Check if entity has health remaining"
|
|
1582
1582
|
* }
|
|
1583
1583
|
*/
|
|
1584
|
-
|
|
1584
|
+
type Guard = {
|
|
1585
1585
|
name: string;
|
|
1586
1586
|
/** Guard expression - S-expression array only */
|
|
1587
1587
|
expression: Expression;
|
|
1588
1588
|
description?: string;
|
|
1589
|
-
}
|
|
1589
|
+
};
|
|
1590
1590
|
declare const GuardSchema: z.ZodObject<{
|
|
1591
1591
|
name: z.ZodString;
|
|
1592
1592
|
expression: z.ZodType<SExpr, z.ZodTypeDef, SExpr>;
|
|
@@ -1616,7 +1616,7 @@ declare const GuardSchema: z.ZodObject<{
|
|
|
1616
1616
|
* ]
|
|
1617
1617
|
* }
|
|
1618
1618
|
*/
|
|
1619
|
-
|
|
1619
|
+
type Transition = {
|
|
1620
1620
|
/** Source state name */
|
|
1621
1621
|
from: string;
|
|
1622
1622
|
/** Target state name */
|
|
@@ -1631,7 +1631,7 @@ interface Transition {
|
|
|
1631
1631
|
effects?: Effect[];
|
|
1632
1632
|
/** Description */
|
|
1633
1633
|
description?: string | null;
|
|
1634
|
-
}
|
|
1634
|
+
};
|
|
1635
1635
|
declare const TransitionSchema: z.ZodObject<{
|
|
1636
1636
|
from: z.ZodString;
|
|
1637
1637
|
to: z.ZodString;
|
|
@@ -1660,7 +1660,7 @@ declare const TransitionSchema: z.ZodObject<{
|
|
|
1660
1660
|
/**
|
|
1661
1661
|
* Complete state machine definition
|
|
1662
1662
|
*/
|
|
1663
|
-
|
|
1663
|
+
type StateMachine = {
|
|
1664
1664
|
/** All states in the machine */
|
|
1665
1665
|
states: State[];
|
|
1666
1666
|
/** All events that can be triggered */
|
|
@@ -1669,7 +1669,7 @@ interface StateMachine {
|
|
|
1669
1669
|
transitions: Transition[];
|
|
1670
1670
|
/** Named guard definitions */
|
|
1671
1671
|
guards?: Guard[];
|
|
1672
|
-
}
|
|
1672
|
+
};
|
|
1673
1673
|
declare const StateMachineSchema: z.ZodObject<{
|
|
1674
1674
|
states: z.ZodArray<z.ZodObject<{
|
|
1675
1675
|
name: z.ZodString;
|
|
@@ -1865,9 +1865,9 @@ declare function isCircuitEvent(event: string): boolean;
|
|
|
1865
1865
|
* via `@config.<key>` bindings.
|
|
1866
1866
|
*/
|
|
1867
1867
|
type TraitConfigValue = string | number | boolean | null | ReadonlyArray<TraitConfigValue> | TraitConfigObject;
|
|
1868
|
-
|
|
1868
|
+
type TraitConfigObject = {
|
|
1869
1869
|
readonly [key: string]: TraitConfigValue;
|
|
1870
|
-
}
|
|
1870
|
+
};
|
|
1871
1871
|
type TraitConfig = TraitConfigObject;
|
|
1872
1872
|
/** Zod schema for TraitConfig. Recursive via z.lazy to allow nested structures. */
|
|
1873
1873
|
declare const TraitConfigValueSchema: z.ZodType<TraitConfigValue>;
|
|
@@ -1947,7 +1947,7 @@ declare const REFERENCE_CONFIG_TYPES: readonly ["entity", "trait", "event"];
|
|
|
1947
1947
|
type ReferenceConfigType = (typeof REFERENCE_CONFIG_TYPES)[number];
|
|
1948
1948
|
/** True when a config field's `type` marks its value as an entity/trait/event reference. */
|
|
1949
1949
|
declare function isReferenceConfigType(type: string): type is ReferenceConfigType;
|
|
1950
|
-
|
|
1950
|
+
type ConfigFieldDeclaration = {
|
|
1951
1951
|
readonly type: string;
|
|
1952
1952
|
readonly default?: TraitConfigValue;
|
|
1953
1953
|
/**
|
|
@@ -1973,14 +1973,14 @@ interface ConfigFieldDeclaration {
|
|
|
1973
1973
|
readonly items?: ConfigFieldItemsDeclaration;
|
|
1974
1974
|
/** Structured property schema for object-typed config fields (no items wrapper). */
|
|
1975
1975
|
readonly properties?: Readonly<Record<string, TraitEntityField>>;
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1976
|
+
};
|
|
1977
|
+
type ConfigFieldItemsDeclaration = {
|
|
1978
1978
|
readonly type?: string;
|
|
1979
1979
|
/** Absent for arrays of scalars (`items: { type: "string" }`). */
|
|
1980
1980
|
readonly properties?: Readonly<Record<string, TraitEntityField>>;
|
|
1981
1981
|
/** Nested per-item schema for arrays of arrays (recursive). */
|
|
1982
1982
|
readonly items?: ConfigFieldItemsDeclaration;
|
|
1983
|
-
}
|
|
1983
|
+
};
|
|
1984
1984
|
declare const ConfigFieldDeclarationSchema: z.ZodType<ConfigFieldDeclaration>;
|
|
1985
1985
|
/**
|
|
1986
1986
|
* Map of declared config fields keyed by name. Lives on `Trait.config`
|
|
@@ -2001,22 +2001,23 @@ type TraitFieldType = 'string' | 'number' | 'boolean' | 'date' | 'array' | 'obje
|
|
|
2001
2001
|
/**
|
|
2002
2002
|
* Simplified field for trait data entities
|
|
2003
2003
|
*/
|
|
2004
|
-
|
|
2004
|
+
type TraitEntityField = {
|
|
2005
2005
|
name: string;
|
|
2006
2006
|
type: TraitFieldType;
|
|
2007
2007
|
required?: boolean;
|
|
2008
|
-
default
|
|
2008
|
+
/** Field default parsed from `.orb` — always a JSON-shaped value. */
|
|
2009
|
+
default?: TraitConfigValue;
|
|
2009
2010
|
values?: string[];
|
|
2010
2011
|
/** Structured per-item schema for array-of-object fields (recursive). */
|
|
2011
2012
|
items?: ConfigFieldItemsDeclaration;
|
|
2012
2013
|
/** Structured property schema for object-typed entity fields. */
|
|
2013
2014
|
properties?: Readonly<Record<string, TraitEntityField>>;
|
|
2014
|
-
}
|
|
2015
|
+
};
|
|
2015
2016
|
declare const TraitEntityFieldSchema: z.ZodType<TraitEntityField>;
|
|
2016
2017
|
/**
|
|
2017
2018
|
* Simplified data entity for traits
|
|
2018
2019
|
*/
|
|
2019
|
-
|
|
2020
|
+
type TraitDataEntity = {
|
|
2020
2021
|
name: string;
|
|
2021
2022
|
collection?: string;
|
|
2022
2023
|
fields: TraitEntityField[];
|
|
@@ -2025,7 +2026,7 @@ interface TraitDataEntity {
|
|
|
2025
2026
|
runtime?: boolean;
|
|
2026
2027
|
singleton?: boolean;
|
|
2027
2028
|
pages?: string[];
|
|
2028
|
-
}
|
|
2029
|
+
};
|
|
2029
2030
|
declare const TraitDataEntitySchema: z.ZodObject<{
|
|
2030
2031
|
name: z.ZodString;
|
|
2031
2032
|
collection: z.ZodOptional<z.ZodString>;
|
|
@@ -2059,7 +2060,7 @@ declare const TraitDataEntitySchema: z.ZodObject<{
|
|
|
2059
2060
|
* Guards can be legacy strings or S-expressions.
|
|
2060
2061
|
* Effects can be typed Effect objects or S-expressions.
|
|
2061
2062
|
*/
|
|
2062
|
-
|
|
2063
|
+
type TraitTick = {
|
|
2063
2064
|
name: string;
|
|
2064
2065
|
description?: string;
|
|
2065
2066
|
priority?: number;
|
|
@@ -2080,7 +2081,7 @@ interface TraitTick {
|
|
|
2080
2081
|
emits?: string[];
|
|
2081
2082
|
/** V4 dual-carry id sibling of `emits` — optional until the Phase-7 flip. */
|
|
2082
2083
|
emitIds?: EventId[];
|
|
2083
|
-
}
|
|
2084
|
+
};
|
|
2084
2085
|
declare const TraitTickSchema: z.ZodObject<{
|
|
2085
2086
|
name: z.ZodString;
|
|
2086
2087
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -2129,7 +2130,7 @@ declare const EventScopeSchema: z.ZodEnum<["internal", "external"]>;
|
|
|
2129
2130
|
* Payload field definition for events.
|
|
2130
2131
|
* Defines the structure of data carried by events.
|
|
2131
2132
|
*/
|
|
2132
|
-
|
|
2133
|
+
type EventPayloadField = {
|
|
2133
2134
|
/** Field name */
|
|
2134
2135
|
name: string;
|
|
2135
2136
|
/**
|
|
@@ -2152,13 +2153,13 @@ interface EventPayloadField {
|
|
|
2152
2153
|
entityType?: string;
|
|
2153
2154
|
/** Structured property schema for object-typed payload fields (recursive). */
|
|
2154
2155
|
properties?: ReadonlyArray<EventPayloadField>;
|
|
2155
|
-
}
|
|
2156
|
+
};
|
|
2156
2157
|
declare const EventPayloadFieldSchema: z.ZodType<EventPayloadField>;
|
|
2157
2158
|
/**
|
|
2158
2159
|
* Event contract for events a trait emits.
|
|
2159
2160
|
* Declares the event name, scope, and payload schema.
|
|
2160
2161
|
*/
|
|
2161
|
-
|
|
2162
|
+
type TraitEventContract = {
|
|
2162
2163
|
/** Event name (UPPER_SNAKE_CASE) */
|
|
2163
2164
|
event: string;
|
|
2164
2165
|
/** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */
|
|
@@ -2180,7 +2181,7 @@ interface TraitEventContract {
|
|
|
2180
2181
|
* - 'external': Exposed for cross-orbital communication
|
|
2181
2182
|
*/
|
|
2182
2183
|
scope?: EventScope;
|
|
2183
|
-
}
|
|
2184
|
+
};
|
|
2184
2185
|
/**
|
|
2185
2186
|
* `@config.<knob>` is the only legal reference form for an emit/listen
|
|
2186
2187
|
* event name (Option B — the declared event name resolves to a
|
|
@@ -2313,7 +2314,7 @@ declare const ListenSourceSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2313
2314
|
traitId?: string | undefined;
|
|
2314
2315
|
orbitalId?: string | undefined;
|
|
2315
2316
|
}>]>;
|
|
2316
|
-
|
|
2317
|
+
type TraitEventListener = {
|
|
2317
2318
|
/** Event key to listen for (bare event name, no source prefix in the new shape) */
|
|
2318
2319
|
event: string;
|
|
2319
2320
|
/** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */
|
|
@@ -2343,7 +2344,7 @@ interface TraitEventListener {
|
|
|
2343
2344
|
* a local payload declaration rather than a bus subscription.
|
|
2344
2345
|
*/
|
|
2345
2346
|
source?: ListenSource;
|
|
2346
|
-
}
|
|
2347
|
+
};
|
|
2347
2348
|
declare const TraitEventListenerSchema: z.ZodObject<{
|
|
2348
2349
|
event: z.ZodString;
|
|
2349
2350
|
eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
|
|
@@ -2444,11 +2445,11 @@ declare const TraitEventListenerSchema: z.ZodObject<{
|
|
|
2444
2445
|
/**
|
|
2445
2446
|
* Field required by a trait from its linkedEntity
|
|
2446
2447
|
*/
|
|
2447
|
-
|
|
2448
|
+
type RequiredField = {
|
|
2448
2449
|
name: string;
|
|
2449
2450
|
type: 'string' | 'number' | 'boolean' | 'date' | 'array' | 'object' | 'timestamp' | 'datetime' | 'enum';
|
|
2450
2451
|
description?: string;
|
|
2451
|
-
}
|
|
2452
|
+
};
|
|
2452
2453
|
declare const RequiredFieldSchema: z.ZodObject<{
|
|
2453
2454
|
name: z.ZodString;
|
|
2454
2455
|
type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
|
|
@@ -2470,7 +2471,7 @@ declare const RequiredFieldSchema: z.ZodObject<{
|
|
|
2470
2471
|
* identifier-substitution pass uses these arguments to rewrite the
|
|
2471
2472
|
* inlined trait clone before lowering.
|
|
2472
2473
|
*/
|
|
2473
|
-
|
|
2474
|
+
type TraitReference = {
|
|
2474
2475
|
ref: string;
|
|
2475
2476
|
/** V4 dual-carry id sibling of `ref` — optional until the Phase-7 flip. */
|
|
2476
2477
|
refId?: TraitId;
|
|
@@ -2558,8 +2559,8 @@ interface TraitReference {
|
|
|
2558
2559
|
* }
|
|
2559
2560
|
* ```
|
|
2560
2561
|
*/
|
|
2561
|
-
effects?: Record<string,
|
|
2562
|
-
}
|
|
2562
|
+
effects?: Record<string, SExpr[]>;
|
|
2563
|
+
};
|
|
2563
2564
|
declare const TraitReferenceSchema: z.ZodEffects<z.ZodObject<{
|
|
2564
2565
|
ref: z.ZodString;
|
|
2565
2566
|
refId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
|
|
@@ -2575,7 +2576,7 @@ declare const TraitReferenceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2575
2576
|
appliesTo: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2576
2577
|
listens: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
2577
2578
|
emitsScope: z.ZodOptional<z.ZodEnum<["internal", "external"]>>;
|
|
2578
|
-
effects: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.
|
|
2579
|
+
effects: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodType<SExpr, z.ZodTypeDef, SExpr>, "many">>>;
|
|
2579
2580
|
}, "strip", z.ZodTypeAny, {
|
|
2580
2581
|
ref: string;
|
|
2581
2582
|
id?: TraitId | undefined;
|
|
@@ -2584,7 +2585,7 @@ declare const TraitReferenceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2584
2585
|
fields?: Record<string, string> | undefined;
|
|
2585
2586
|
config?: Record<string, TraitConfigValue | ConfigFieldDeclaration> | undefined;
|
|
2586
2587
|
events?: Record<string, string> | undefined;
|
|
2587
|
-
effects?: Record<string,
|
|
2588
|
+
effects?: Record<string, SExpr[]> | undefined;
|
|
2588
2589
|
refId?: TraitId | undefined;
|
|
2589
2590
|
appliesTo?: string[] | undefined;
|
|
2590
2591
|
linkedEntity?: string | undefined;
|
|
@@ -2600,7 +2601,7 @@ declare const TraitReferenceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2600
2601
|
fields?: Record<string, string> | undefined;
|
|
2601
2602
|
config?: Record<string, TraitConfigValue | ConfigFieldDeclaration> | undefined;
|
|
2602
2603
|
events?: Record<string, string> | undefined;
|
|
2603
|
-
effects?: Record<string,
|
|
2604
|
+
effects?: Record<string, SExpr[]> | undefined;
|
|
2604
2605
|
refId?: string | undefined;
|
|
2605
2606
|
appliesTo?: string[] | undefined;
|
|
2606
2607
|
linkedEntity?: string | undefined;
|
|
@@ -2616,7 +2617,7 @@ declare const TraitReferenceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2616
2617
|
fields?: Record<string, string> | undefined;
|
|
2617
2618
|
config?: Record<string, TraitConfigValue | ConfigFieldDeclaration> | undefined;
|
|
2618
2619
|
events?: Record<string, string> | undefined;
|
|
2619
|
-
effects?: Record<string,
|
|
2620
|
+
effects?: Record<string, SExpr[]> | undefined;
|
|
2620
2621
|
refId?: TraitId | undefined;
|
|
2621
2622
|
appliesTo?: string[] | undefined;
|
|
2622
2623
|
linkedEntity?: string | undefined;
|
|
@@ -2632,7 +2633,7 @@ declare const TraitReferenceSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2632
2633
|
fields?: Record<string, string> | undefined;
|
|
2633
2634
|
config?: Record<string, TraitConfigValue | ConfigFieldDeclaration> | undefined;
|
|
2634
2635
|
events?: Record<string, string> | undefined;
|
|
2635
|
-
effects?: Record<string,
|
|
2636
|
+
effects?: Record<string, SExpr[]> | undefined;
|
|
2636
2637
|
refId?: string | undefined;
|
|
2637
2638
|
appliesTo?: string[] | undefined;
|
|
2638
2639
|
linkedEntity?: string | undefined;
|
|
@@ -2658,7 +2659,7 @@ type TraitRef = string | {
|
|
|
2658
2659
|
events?: Record<string, string>;
|
|
2659
2660
|
} | Trait;
|
|
2660
2661
|
type PresentationType = 'modal' | 'drawer' | 'popover' | 'inline' | 'confirm-dialog';
|
|
2661
|
-
|
|
2662
|
+
type TraitUIBinding = {
|
|
2662
2663
|
[stateName: string]: {
|
|
2663
2664
|
presentation: PresentationType;
|
|
2664
2665
|
content: AnyPatternConfig | AnyPatternConfig[];
|
|
@@ -2673,7 +2674,7 @@ interface TraitUIBinding {
|
|
|
2673
2674
|
totalSteps?: number;
|
|
2674
2675
|
};
|
|
2675
2676
|
};
|
|
2676
|
-
}
|
|
2677
|
+
};
|
|
2677
2678
|
/**
|
|
2678
2679
|
* A Trait is a reusable behavioral module with state machine.
|
|
2679
2680
|
*
|
|
@@ -2703,10 +2704,10 @@ type TraitScope = 'instance' | 'collection';
|
|
|
2703
2704
|
* validator enforces it (`ORB_T_REBIND_MISSING_FIELDS`). Mirrors the Rust
|
|
2704
2705
|
* `EntityFieldContract` serde shape exactly.
|
|
2705
2706
|
*/
|
|
2706
|
-
|
|
2707
|
+
type EntityFieldContract = {
|
|
2707
2708
|
requires: string[];
|
|
2708
2709
|
provides: string[];
|
|
2709
|
-
}
|
|
2710
|
+
};
|
|
2710
2711
|
declare const EntityFieldContractSchema: z.ZodObject<{
|
|
2711
2712
|
requires: z.ZodArray<z.ZodString, "many">;
|
|
2712
2713
|
provides: z.ZodArray<z.ZodString, "many">;
|
|
@@ -2717,7 +2718,7 @@ declare const EntityFieldContractSchema: z.ZodObject<{
|
|
|
2717
2718
|
requires: string[];
|
|
2718
2719
|
provides: string[];
|
|
2719
2720
|
}>;
|
|
2720
|
-
|
|
2721
|
+
type Trait = {
|
|
2721
2722
|
/** V4 dual-carry id sibling of `name` — optional until the Phase-7 flip. */
|
|
2722
2723
|
id?: TraitId;
|
|
2723
2724
|
name: string;
|
|
@@ -2824,14 +2825,14 @@ interface Trait {
|
|
|
2824
2825
|
* `linkedEntity` without re-walking the import graph at runtime.
|
|
2825
2826
|
*/
|
|
2826
2827
|
sourceEntityDefinition?: Entity;
|
|
2827
|
-
}
|
|
2828
|
+
};
|
|
2828
2829
|
/**
|
|
2829
2830
|
* Provenance attached to a trait that was cloned from a `uses[]` import
|
|
2830
2831
|
* during the inline phase. The resolved schema carries this so Studio
|
|
2831
2832
|
* can group L2 cards by source behavior and offer an L3 drill into the
|
|
2832
2833
|
* import's own transitions.
|
|
2833
2834
|
*/
|
|
2834
|
-
|
|
2835
|
+
type SourceBehaviorMetadata = {
|
|
2835
2836
|
/** Behavior name (e.g. "std-stat-card") — the resolved `from:` value. */
|
|
2836
2837
|
behavior: string;
|
|
2837
2838
|
/** Alias used at the import site (e.g. "Stat"). Multiple imports of
|
|
@@ -2840,7 +2841,7 @@ interface SourceBehaviorMetadata {
|
|
|
2840
2841
|
/** Original trait name inside the imported behavior, before any
|
|
2841
2842
|
* call-site `name:` rename. */
|
|
2842
2843
|
originalName: string;
|
|
2843
|
-
}
|
|
2844
|
+
};
|
|
2844
2845
|
declare const TraitSchema: z.ZodObject<{
|
|
2845
2846
|
id: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
|
|
2846
2847
|
name: z.ZodString;
|