@almadar/core 10.30.0 → 10.32.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.
@@ -1,5 +1,749 @@
1
1
  import { z } from 'zod';
2
- import { S as SExpr } from './expression-CB9R3KWk.js';
2
+ import { S as SExpr, c as EventPayload, E as Expression } from './expression-BlFrxmNB.js';
3
+
4
+ /**
5
+ * Service Types for Orbital Schema
6
+ *
7
+ * Defines external service integrations (REST APIs, WebSockets, MCP servers)
8
+ * that can be used by orbital units via the `call_service` effect.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+
13
+ /**
14
+ * Types of external services that can be integrated.
15
+ */
16
+ declare const SERVICE_TYPES: readonly ["rest", "socket", "mcp"];
17
+ type ServiceType = (typeof SERVICE_TYPES)[number];
18
+ declare const ServiceTypeSchema: z.ZodEnum<["rest", "socket", "mcp"]>;
19
+ /**
20
+ * Configuration for a REST API service.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const weatherService: RestServiceDef = {
25
+ * name: 'WeatherAPI',
26
+ * type: 'rest',
27
+ * baseUrl: 'https://api.openweathermap.org/data/2.5',
28
+ * headers: {
29
+ * 'Content-Type': 'application/json',
30
+ * },
31
+ * auth: {
32
+ * type: 'api-key',
33
+ * keyName: 'appid',
34
+ * location: 'query',
35
+ * },
36
+ * };
37
+ * ```
38
+ */
39
+ type RestServiceDef = {
40
+ /** Unique service name (used in call_service effect) */
41
+ name: string;
42
+ /** Service type */
43
+ type: "rest";
44
+ /** Optional description */
45
+ description?: string;
46
+ /** Base URL for the API */
47
+ baseUrl: string;
48
+ /** Default headers to include in all requests */
49
+ headers?: Record<string, string>;
50
+ /** Authentication configuration */
51
+ auth?: RestAuthConfig;
52
+ /** Timeout in milliseconds (default: 30000) */
53
+ timeout?: number;
54
+ };
55
+ /**
56
+ * Authentication configuration for REST services.
57
+ */
58
+ type RestAuthConfig = {
59
+ /** Authentication type */
60
+ type: "api-key" | "bearer" | "basic" | "oauth2";
61
+ /** For api-key: the query parameter or header name */
62
+ keyName?: string;
63
+ /** For api-key: where to place the key */
64
+ location?: "query" | "header";
65
+ /** Environment variable name containing the secret (for secure storage) */
66
+ secretEnv?: string;
67
+ };
68
+ declare const RestAuthConfigSchema: z.ZodObject<{
69
+ type: z.ZodEnum<["api-key", "bearer", "basic", "oauth2"]>;
70
+ keyName: z.ZodOptional<z.ZodString>;
71
+ location: z.ZodOptional<z.ZodEnum<["query", "header"]>>;
72
+ secretEnv: z.ZodOptional<z.ZodString>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ type: "api-key" | "bearer" | "basic" | "oauth2";
75
+ keyName?: string | undefined;
76
+ location?: "query" | "header" | undefined;
77
+ secretEnv?: string | undefined;
78
+ }, {
79
+ type: "api-key" | "bearer" | "basic" | "oauth2";
80
+ keyName?: string | undefined;
81
+ location?: "query" | "header" | undefined;
82
+ secretEnv?: string | undefined;
83
+ }>;
84
+ declare const RestServiceDefSchema: z.ZodObject<{
85
+ name: z.ZodString;
86
+ type: z.ZodLiteral<"rest">;
87
+ description: z.ZodOptional<z.ZodString>;
88
+ baseUrl: z.ZodString;
89
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
90
+ auth: z.ZodOptional<z.ZodObject<{
91
+ type: z.ZodEnum<["api-key", "bearer", "basic", "oauth2"]>;
92
+ keyName: z.ZodOptional<z.ZodString>;
93
+ location: z.ZodOptional<z.ZodEnum<["query", "header"]>>;
94
+ secretEnv: z.ZodOptional<z.ZodString>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ type: "api-key" | "bearer" | "basic" | "oauth2";
97
+ keyName?: string | undefined;
98
+ location?: "query" | "header" | undefined;
99
+ secretEnv?: string | undefined;
100
+ }, {
101
+ type: "api-key" | "bearer" | "basic" | "oauth2";
102
+ keyName?: string | undefined;
103
+ location?: "query" | "header" | undefined;
104
+ secretEnv?: string | undefined;
105
+ }>>;
106
+ timeout: z.ZodOptional<z.ZodNumber>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ type: "rest";
109
+ name: string;
110
+ baseUrl: string;
111
+ description?: string | undefined;
112
+ headers?: Record<string, string> | undefined;
113
+ auth?: {
114
+ type: "api-key" | "bearer" | "basic" | "oauth2";
115
+ keyName?: string | undefined;
116
+ location?: "query" | "header" | undefined;
117
+ secretEnv?: string | undefined;
118
+ } | undefined;
119
+ timeout?: number | undefined;
120
+ }, {
121
+ type: "rest";
122
+ name: string;
123
+ baseUrl: string;
124
+ description?: string | undefined;
125
+ headers?: Record<string, string> | undefined;
126
+ auth?: {
127
+ type: "api-key" | "bearer" | "basic" | "oauth2";
128
+ keyName?: string | undefined;
129
+ location?: "query" | "header" | undefined;
130
+ secretEnv?: string | undefined;
131
+ } | undefined;
132
+ timeout?: number | undefined;
133
+ }>;
134
+ /**
135
+ * Configuration for a WebSocket service.
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * const chatService: SocketServiceDef = {
140
+ * name: 'ChatSocket',
141
+ * type: 'socket',
142
+ * url: 'wss://chat.example.com',
143
+ * events: {
144
+ * inbound: ['message_received', 'user_joined', 'user_left'],
145
+ * outbound: ['send_message', 'join_room', 'leave_room'],
146
+ * },
147
+ * };
148
+ * ```
149
+ */
150
+ type SocketServiceDef = {
151
+ /** Unique service name */
152
+ name: string;
153
+ /** Service type */
154
+ type: "socket";
155
+ /** Optional description */
156
+ description?: string;
157
+ /** WebSocket URL */
158
+ url: string;
159
+ /** Event definitions */
160
+ events: SocketEvents;
161
+ /** Reconnection configuration */
162
+ reconnect?: {
163
+ /** Enable automatic reconnection */
164
+ enabled: boolean;
165
+ /** Maximum reconnection attempts */
166
+ maxAttempts?: number;
167
+ /** Delay between attempts in ms */
168
+ delayMs?: number;
169
+ };
170
+ };
171
+ /**
172
+ * Socket event definitions.
173
+ */
174
+ type SocketEvents = {
175
+ /** Events received from server (maps to orbital events) */
176
+ inbound: string[];
177
+ /** Events sent to server (triggered by effects) */
178
+ outbound: string[];
179
+ };
180
+ declare const SocketEventsSchema: z.ZodObject<{
181
+ inbound: z.ZodArray<z.ZodString, "many">;
182
+ outbound: z.ZodArray<z.ZodString, "many">;
183
+ }, "strip", z.ZodTypeAny, {
184
+ inbound: string[];
185
+ outbound: string[];
186
+ }, {
187
+ inbound: string[];
188
+ outbound: string[];
189
+ }>;
190
+ declare const SocketServiceDefSchema: z.ZodObject<{
191
+ name: z.ZodString;
192
+ type: z.ZodLiteral<"socket">;
193
+ description: z.ZodOptional<z.ZodString>;
194
+ url: z.ZodString;
195
+ events: z.ZodObject<{
196
+ inbound: z.ZodArray<z.ZodString, "many">;
197
+ outbound: z.ZodArray<z.ZodString, "many">;
198
+ }, "strip", z.ZodTypeAny, {
199
+ inbound: string[];
200
+ outbound: string[];
201
+ }, {
202
+ inbound: string[];
203
+ outbound: string[];
204
+ }>;
205
+ reconnect: z.ZodOptional<z.ZodObject<{
206
+ enabled: z.ZodBoolean;
207
+ maxAttempts: z.ZodOptional<z.ZodNumber>;
208
+ delayMs: z.ZodOptional<z.ZodNumber>;
209
+ }, "strip", z.ZodTypeAny, {
210
+ enabled: boolean;
211
+ maxAttempts?: number | undefined;
212
+ delayMs?: number | undefined;
213
+ }, {
214
+ enabled: boolean;
215
+ maxAttempts?: number | undefined;
216
+ delayMs?: number | undefined;
217
+ }>>;
218
+ }, "strip", z.ZodTypeAny, {
219
+ type: "socket";
220
+ url: string;
221
+ name: string;
222
+ events: {
223
+ inbound: string[];
224
+ outbound: string[];
225
+ };
226
+ description?: string | undefined;
227
+ reconnect?: {
228
+ enabled: boolean;
229
+ maxAttempts?: number | undefined;
230
+ delayMs?: number | undefined;
231
+ } | undefined;
232
+ }, {
233
+ type: "socket";
234
+ url: string;
235
+ name: string;
236
+ events: {
237
+ inbound: string[];
238
+ outbound: string[];
239
+ };
240
+ description?: string | undefined;
241
+ reconnect?: {
242
+ enabled: boolean;
243
+ maxAttempts?: number | undefined;
244
+ delayMs?: number | undefined;
245
+ } | undefined;
246
+ }>;
247
+ /**
248
+ * Configuration for an MCP (Model Context Protocol) server.
249
+ *
250
+ * @example
251
+ * ```typescript
252
+ * const mcpService: McpServiceDef = {
253
+ * name: 'DatabaseMCP',
254
+ * type: 'mcp',
255
+ * serverPath: './mcp-servers/database',
256
+ * capabilities: ['query', 'insert', 'update'],
257
+ * };
258
+ * ```
259
+ */
260
+ type McpServiceDef = {
261
+ /** Unique service name */
262
+ name: string;
263
+ /** Service type */
264
+ type: "mcp";
265
+ /** Optional description */
266
+ description?: string;
267
+ /** Path to MCP server executable or module */
268
+ serverPath: string;
269
+ /** List of capabilities/tools exposed by the MCP server */
270
+ capabilities: string[];
271
+ /** Environment variables to pass to the MCP server */
272
+ env?: Record<string, string>;
273
+ };
274
+ declare const McpServiceDefSchema: z.ZodObject<{
275
+ name: z.ZodString;
276
+ type: z.ZodLiteral<"mcp">;
277
+ description: z.ZodOptional<z.ZodString>;
278
+ serverPath: z.ZodString;
279
+ capabilities: z.ZodArray<z.ZodString, "many">;
280
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
281
+ }, "strip", z.ZodTypeAny, {
282
+ type: "mcp";
283
+ name: string;
284
+ serverPath: string;
285
+ capabilities: string[];
286
+ description?: string | undefined;
287
+ env?: Record<string, string> | undefined;
288
+ }, {
289
+ type: "mcp";
290
+ name: string;
291
+ serverPath: string;
292
+ capabilities: string[];
293
+ description?: string | undefined;
294
+ env?: Record<string, string> | undefined;
295
+ }>;
296
+ /**
297
+ * Union type for all service definitions.
298
+ */
299
+ type ServiceDefinition = RestServiceDef | SocketServiceDef | McpServiceDef;
300
+ declare const ServiceDefinitionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
301
+ name: z.ZodString;
302
+ type: z.ZodLiteral<"rest">;
303
+ description: z.ZodOptional<z.ZodString>;
304
+ baseUrl: z.ZodString;
305
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
306
+ auth: z.ZodOptional<z.ZodObject<{
307
+ type: z.ZodEnum<["api-key", "bearer", "basic", "oauth2"]>;
308
+ keyName: z.ZodOptional<z.ZodString>;
309
+ location: z.ZodOptional<z.ZodEnum<["query", "header"]>>;
310
+ secretEnv: z.ZodOptional<z.ZodString>;
311
+ }, "strip", z.ZodTypeAny, {
312
+ type: "api-key" | "bearer" | "basic" | "oauth2";
313
+ keyName?: string | undefined;
314
+ location?: "query" | "header" | undefined;
315
+ secretEnv?: string | undefined;
316
+ }, {
317
+ type: "api-key" | "bearer" | "basic" | "oauth2";
318
+ keyName?: string | undefined;
319
+ location?: "query" | "header" | undefined;
320
+ secretEnv?: string | undefined;
321
+ }>>;
322
+ timeout: z.ZodOptional<z.ZodNumber>;
323
+ }, "strip", z.ZodTypeAny, {
324
+ type: "rest";
325
+ name: string;
326
+ baseUrl: string;
327
+ description?: string | undefined;
328
+ headers?: Record<string, string> | undefined;
329
+ auth?: {
330
+ type: "api-key" | "bearer" | "basic" | "oauth2";
331
+ keyName?: string | undefined;
332
+ location?: "query" | "header" | undefined;
333
+ secretEnv?: string | undefined;
334
+ } | undefined;
335
+ timeout?: number | undefined;
336
+ }, {
337
+ type: "rest";
338
+ name: string;
339
+ baseUrl: string;
340
+ description?: string | undefined;
341
+ headers?: Record<string, string> | undefined;
342
+ auth?: {
343
+ type: "api-key" | "bearer" | "basic" | "oauth2";
344
+ keyName?: string | undefined;
345
+ location?: "query" | "header" | undefined;
346
+ secretEnv?: string | undefined;
347
+ } | undefined;
348
+ timeout?: number | undefined;
349
+ }>, z.ZodObject<{
350
+ name: z.ZodString;
351
+ type: z.ZodLiteral<"socket">;
352
+ description: z.ZodOptional<z.ZodString>;
353
+ url: z.ZodString;
354
+ events: z.ZodObject<{
355
+ inbound: z.ZodArray<z.ZodString, "many">;
356
+ outbound: z.ZodArray<z.ZodString, "many">;
357
+ }, "strip", z.ZodTypeAny, {
358
+ inbound: string[];
359
+ outbound: string[];
360
+ }, {
361
+ inbound: string[];
362
+ outbound: string[];
363
+ }>;
364
+ reconnect: z.ZodOptional<z.ZodObject<{
365
+ enabled: z.ZodBoolean;
366
+ maxAttempts: z.ZodOptional<z.ZodNumber>;
367
+ delayMs: z.ZodOptional<z.ZodNumber>;
368
+ }, "strip", z.ZodTypeAny, {
369
+ enabled: boolean;
370
+ maxAttempts?: number | undefined;
371
+ delayMs?: number | undefined;
372
+ }, {
373
+ enabled: boolean;
374
+ maxAttempts?: number | undefined;
375
+ delayMs?: number | undefined;
376
+ }>>;
377
+ }, "strip", z.ZodTypeAny, {
378
+ type: "socket";
379
+ url: string;
380
+ name: string;
381
+ events: {
382
+ inbound: string[];
383
+ outbound: string[];
384
+ };
385
+ description?: string | undefined;
386
+ reconnect?: {
387
+ enabled: boolean;
388
+ maxAttempts?: number | undefined;
389
+ delayMs?: number | undefined;
390
+ } | undefined;
391
+ }, {
392
+ type: "socket";
393
+ url: string;
394
+ name: string;
395
+ events: {
396
+ inbound: string[];
397
+ outbound: string[];
398
+ };
399
+ description?: string | undefined;
400
+ reconnect?: {
401
+ enabled: boolean;
402
+ maxAttempts?: number | undefined;
403
+ delayMs?: number | undefined;
404
+ } | undefined;
405
+ }>, z.ZodObject<{
406
+ name: z.ZodString;
407
+ type: z.ZodLiteral<"mcp">;
408
+ description: z.ZodOptional<z.ZodString>;
409
+ serverPath: z.ZodString;
410
+ capabilities: z.ZodArray<z.ZodString, "many">;
411
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
412
+ }, "strip", z.ZodTypeAny, {
413
+ type: "mcp";
414
+ name: string;
415
+ serverPath: string;
416
+ capabilities: string[];
417
+ description?: string | undefined;
418
+ env?: Record<string, string> | undefined;
419
+ }, {
420
+ type: "mcp";
421
+ name: string;
422
+ serverPath: string;
423
+ capabilities: string[];
424
+ description?: string | undefined;
425
+ env?: Record<string, string> | undefined;
426
+ }>]>;
427
+ /**
428
+ * ServiceRef - Service can be inline definition, reference object with overrides,
429
+ * or bare string reference to an imported service.
430
+ *
431
+ * Reference format: "Alias.services.ServiceName"
432
+ */
433
+ type ServiceRef = ServiceDefinition | ServiceRefObject | string;
434
+ /**
435
+ * Phase F: Service reference object with override fields.
436
+ *
437
+ * Mirrors the Rust `ServiceRefObject` at
438
+ * `orbital-rust/crates/orbital-core/src/schema/types.rs:353-375`. A caller
439
+ * imports a service via `uses[]`, references it by `ref`, and supplies
440
+ * any subset of these fields to override the imported service's defaults
441
+ * during inlining.
442
+ *
443
+ * @example
444
+ * ```typescript
445
+ * const ref: ServiceRefObject = {
446
+ * ref: "Weather.services.openweather",
447
+ * baseUrl: "https://staging.weather.example.com",
448
+ * headers: { "X-Tenant": "acme" },
449
+ * };
450
+ * ```
451
+ */
452
+ type ServiceRefObject = {
453
+ /** Reference to imported service: "Alias.services.ServiceName" */
454
+ ref: string;
455
+ /** Override the service description */
456
+ description?: string;
457
+ /** Override the REST baseUrl */
458
+ baseUrl?: string;
459
+ /** Override or merge default headers (caller wins on key collision) */
460
+ headers?: Record<string, string>;
461
+ /** Override the WebSocket url */
462
+ url?: string;
463
+ /** Override the MCP server path */
464
+ serverPath?: string;
465
+ };
466
+ /**
467
+ * Checks if a service reference is a bare string reference.
468
+ *
469
+ * Type guard to determine if a service reference is a string reference
470
+ * (format: "Alias.services.ServiceName") rather than an inline service
471
+ * definition or a reference object.
472
+ *
473
+ * @param {ServiceRef} service - Service reference to check
474
+ * @returns {boolean} True if service is a string reference, false otherwise
475
+ *
476
+ * @example
477
+ * isServiceReference("Weather.services.openweather"); // returns true
478
+ * isServiceReference({ name: "weather", type: "rest" }); // returns false
479
+ * isServiceReference({ ref: "Weather.services.openweather" }); // returns false
480
+ */
481
+ declare function isServiceReference(service: ServiceRef): service is string;
482
+ /**
483
+ * Phase F: Type guard for `ServiceRefObject` (the override-carrying form).
484
+ *
485
+ * @param {ServiceRef} service - Service reference to check
486
+ * @returns {boolean} True if service is a ServiceRefObject
487
+ */
488
+ declare function isServiceReferenceObject(service: ServiceRef): service is ServiceRefObject;
489
+ /**
490
+ * Validate service reference format: "Alias.services.ServiceName"
491
+ */
492
+ declare const ServiceRefStringSchema: z.ZodString;
493
+ declare const ServiceRefObjectSchema: z.ZodObject<{
494
+ ref: z.ZodString;
495
+ description: z.ZodOptional<z.ZodString>;
496
+ baseUrl: z.ZodOptional<z.ZodString>;
497
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
498
+ url: z.ZodOptional<z.ZodString>;
499
+ serverPath: z.ZodOptional<z.ZodString>;
500
+ }, "strip", z.ZodTypeAny, {
501
+ ref: string;
502
+ url?: string | undefined;
503
+ description?: string | undefined;
504
+ baseUrl?: string | undefined;
505
+ headers?: Record<string, string> | undefined;
506
+ serverPath?: string | undefined;
507
+ }, {
508
+ ref: string;
509
+ url?: string | undefined;
510
+ description?: string | undefined;
511
+ baseUrl?: string | undefined;
512
+ headers?: Record<string, string> | undefined;
513
+ serverPath?: string | undefined;
514
+ }>;
515
+ declare const ServiceRefSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
516
+ name: z.ZodString;
517
+ type: z.ZodLiteral<"rest">;
518
+ description: z.ZodOptional<z.ZodString>;
519
+ baseUrl: z.ZodString;
520
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
521
+ auth: z.ZodOptional<z.ZodObject<{
522
+ type: z.ZodEnum<["api-key", "bearer", "basic", "oauth2"]>;
523
+ keyName: z.ZodOptional<z.ZodString>;
524
+ location: z.ZodOptional<z.ZodEnum<["query", "header"]>>;
525
+ secretEnv: z.ZodOptional<z.ZodString>;
526
+ }, "strip", z.ZodTypeAny, {
527
+ type: "api-key" | "bearer" | "basic" | "oauth2";
528
+ keyName?: string | undefined;
529
+ location?: "query" | "header" | undefined;
530
+ secretEnv?: string | undefined;
531
+ }, {
532
+ type: "api-key" | "bearer" | "basic" | "oauth2";
533
+ keyName?: string | undefined;
534
+ location?: "query" | "header" | undefined;
535
+ secretEnv?: string | undefined;
536
+ }>>;
537
+ timeout: z.ZodOptional<z.ZodNumber>;
538
+ }, "strip", z.ZodTypeAny, {
539
+ type: "rest";
540
+ name: string;
541
+ baseUrl: string;
542
+ description?: string | undefined;
543
+ headers?: Record<string, string> | undefined;
544
+ auth?: {
545
+ type: "api-key" | "bearer" | "basic" | "oauth2";
546
+ keyName?: string | undefined;
547
+ location?: "query" | "header" | undefined;
548
+ secretEnv?: string | undefined;
549
+ } | undefined;
550
+ timeout?: number | undefined;
551
+ }, {
552
+ type: "rest";
553
+ name: string;
554
+ baseUrl: string;
555
+ description?: string | undefined;
556
+ headers?: Record<string, string> | undefined;
557
+ auth?: {
558
+ type: "api-key" | "bearer" | "basic" | "oauth2";
559
+ keyName?: string | undefined;
560
+ location?: "query" | "header" | undefined;
561
+ secretEnv?: string | undefined;
562
+ } | undefined;
563
+ timeout?: number | undefined;
564
+ }>, z.ZodObject<{
565
+ name: z.ZodString;
566
+ type: z.ZodLiteral<"socket">;
567
+ description: z.ZodOptional<z.ZodString>;
568
+ url: z.ZodString;
569
+ events: z.ZodObject<{
570
+ inbound: z.ZodArray<z.ZodString, "many">;
571
+ outbound: z.ZodArray<z.ZodString, "many">;
572
+ }, "strip", z.ZodTypeAny, {
573
+ inbound: string[];
574
+ outbound: string[];
575
+ }, {
576
+ inbound: string[];
577
+ outbound: string[];
578
+ }>;
579
+ reconnect: z.ZodOptional<z.ZodObject<{
580
+ enabled: z.ZodBoolean;
581
+ maxAttempts: z.ZodOptional<z.ZodNumber>;
582
+ delayMs: z.ZodOptional<z.ZodNumber>;
583
+ }, "strip", z.ZodTypeAny, {
584
+ enabled: boolean;
585
+ maxAttempts?: number | undefined;
586
+ delayMs?: number | undefined;
587
+ }, {
588
+ enabled: boolean;
589
+ maxAttempts?: number | undefined;
590
+ delayMs?: number | undefined;
591
+ }>>;
592
+ }, "strip", z.ZodTypeAny, {
593
+ type: "socket";
594
+ url: string;
595
+ name: string;
596
+ events: {
597
+ inbound: string[];
598
+ outbound: string[];
599
+ };
600
+ description?: string | undefined;
601
+ reconnect?: {
602
+ enabled: boolean;
603
+ maxAttempts?: number | undefined;
604
+ delayMs?: number | undefined;
605
+ } | undefined;
606
+ }, {
607
+ type: "socket";
608
+ url: string;
609
+ name: string;
610
+ events: {
611
+ inbound: string[];
612
+ outbound: string[];
613
+ };
614
+ description?: string | undefined;
615
+ reconnect?: {
616
+ enabled: boolean;
617
+ maxAttempts?: number | undefined;
618
+ delayMs?: number | undefined;
619
+ } | undefined;
620
+ }>, z.ZodObject<{
621
+ name: z.ZodString;
622
+ type: z.ZodLiteral<"mcp">;
623
+ description: z.ZodOptional<z.ZodString>;
624
+ serverPath: z.ZodString;
625
+ capabilities: z.ZodArray<z.ZodString, "many">;
626
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
627
+ }, "strip", z.ZodTypeAny, {
628
+ type: "mcp";
629
+ name: string;
630
+ serverPath: string;
631
+ capabilities: string[];
632
+ description?: string | undefined;
633
+ env?: Record<string, string> | undefined;
634
+ }, {
635
+ type: "mcp";
636
+ name: string;
637
+ serverPath: string;
638
+ capabilities: string[];
639
+ description?: string | undefined;
640
+ env?: Record<string, string> | undefined;
641
+ }>]>, z.ZodObject<{
642
+ ref: z.ZodString;
643
+ description: z.ZodOptional<z.ZodString>;
644
+ baseUrl: z.ZodOptional<z.ZodString>;
645
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
646
+ url: z.ZodOptional<z.ZodString>;
647
+ serverPath: z.ZodOptional<z.ZodString>;
648
+ }, "strip", z.ZodTypeAny, {
649
+ ref: string;
650
+ url?: string | undefined;
651
+ description?: string | undefined;
652
+ baseUrl?: string | undefined;
653
+ headers?: Record<string, string> | undefined;
654
+ serverPath?: string | undefined;
655
+ }, {
656
+ ref: string;
657
+ url?: string | undefined;
658
+ description?: string | undefined;
659
+ baseUrl?: string | undefined;
660
+ headers?: Record<string, string> | undefined;
661
+ serverPath?: string | undefined;
662
+ }>, z.ZodString]>;
663
+ /**
664
+ * Parses a service reference into its components.
665
+ *
666
+ * Extracts the alias and service name from a service reference string
667
+ * in format "Alias.services.ServiceName". Returns null if not a valid reference.
668
+ *
669
+ * @param {string} ref - Service reference string
670
+ * @returns {{ alias: string; serviceName: string } | null} Parsed components or null
671
+ *
672
+ * @example
673
+ * parseServiceRef("Weather.services.openweather"); // returns { alias: "Weather", serviceName: "openweather" }
674
+ * parseServiceRef("invalid"); // returns null
675
+ */
676
+ declare function parseServiceRef(ref: string): {
677
+ alias: string;
678
+ serviceName: string;
679
+ } | null;
680
+ /**
681
+ * Checks if a service definition is a REST service.
682
+ *
683
+ * Type guard to determine if a service definition represents a REST API service.
684
+ * Used for service type discrimination and validation.
685
+ *
686
+ * @param {ServiceDefinition} service - Service definition to check
687
+ * @returns {boolean} True if service is a REST service, false otherwise
688
+ *
689
+ * @example
690
+ * isRestService({ name: "weather", type: "rest", baseUrl: "..." }); // returns true
691
+ * isRestService({ name: "chat", type: "socket" }); // returns false
692
+ */
693
+ declare function isRestService(service: ServiceDefinition): service is RestServiceDef;
694
+ /**
695
+ * Checks if a service definition is a Socket service.
696
+ *
697
+ * Type guard to determine if a service definition represents a WebSocket service.
698
+ * Used for service type discrimination and validation.
699
+ *
700
+ * @param {ServiceDefinition} service - Service definition to check
701
+ * @returns {boolean} True if service is a Socket service, false otherwise
702
+ *
703
+ * @example
704
+ * isSocketService({ name: "chat", type: "socket", url: "wss://..." }); // returns true
705
+ * isSocketService({ name: "weather", type: "rest" }); // returns false
706
+ */
707
+ declare function isSocketService(service: ServiceDefinition): service is SocketServiceDef;
708
+ /**
709
+ * Checks if a service definition is an MCP service.
710
+ *
711
+ * Type guard to determine if a service definition represents an MCP
712
+ * (Multiplayer Control Protocol) service. Used for service type discrimination.
713
+ *
714
+ * @param {ServiceDefinition} service - Service definition to check
715
+ * @returns {boolean} True if service is an MCP service, false otherwise
716
+ *
717
+ * @example
718
+ * isMcpService({ name: "game", type: "mcp", serverUrl: "..." }); // returns true
719
+ * isMcpService({ name: "chat", type: "socket" }); // returns false
720
+ */
721
+ declare function isMcpService(service: ServiceDefinition): service is McpServiceDef;
722
+ /**
723
+ * Get all service names from a list of services.
724
+ */
725
+ declare function getServiceNames(services: ServiceDefinition[]): string[];
726
+ /**
727
+ * Find a service by name.
728
+ */
729
+ declare function findService(services: ServiceDefinition[], name: string): ServiceDefinition | undefined;
730
+ /**
731
+ * Check if a service name exists (case-insensitive).
732
+ */
733
+ declare function hasService(services: ServiceDefinition[], name: string): boolean;
734
+ /**
735
+ * Allowed leaf value for `ServiceParams`. Mirrors `EventPayloadValue`'s
736
+ * recursive-array shape so integration call signatures can express the
737
+ * nested structures real services need (port mappings, volume mounts,
738
+ * pagination cursors), and so a value satisfying `EventPayloadValue`
739
+ * also satisfies `ServiceParamsValue` without a cast — the same data
740
+ * flows through `call-service` and `emit` without boundary widening.
741
+ */
742
+ type ServiceParamsValue = string | number | boolean | Date | null | undefined | ServiceParams | readonly ServiceParamsValue[];
743
+ /** Parameters passed to call-service effects. Recursive for nested request shapes. */
744
+ type ServiceParams = {
745
+ [key: string]: ServiceParamsValue;
746
+ };
3
747
 
4
748
  /**
5
749
  * Identity model (Almadar Rabit V4, Phase 1 — types only).
@@ -250,6 +994,63 @@ declare const IdentityLedgerSchema: z.ZodObject<{
250
994
  schemaVersion: 1;
251
995
  }>;
252
996
 
997
+ /**
998
+ * JSON primitives — the universal "data crossed a boundary" type.
999
+ *
1000
+ * Every value that arrives over the wire from an LLM (tool-call args),
1001
+ * from disk (workspace files), or from an HTTP body before
1002
+ * domain-specific validation is a `JsonValue`. Narrow with a typed
1003
+ * predicate (`is`-guard) at the boundary; don't widen back to `unknown`.
1004
+ *
1005
+ * `JsonObject` and `ToolArgs` are aliases for the common
1006
+ * `Record<string, JsonValue>` shape. `ToolArgs` is the name the
1007
+ * agent surface uses for LLM-emitted tool-call arguments; `JsonObject`
1008
+ * is the general-purpose alias. They are the same type — the alias
1009
+ * exists so call sites read at the right semantic level.
1010
+ *
1011
+ * Why not `Record<string, unknown>`? Two reasons. (1) `unknown` widens
1012
+ * back to anything, which defeats the purpose of typing the boundary.
1013
+ * (2) The `@almadar/eslint-plugin/no-record-string-unknown` rule blocks
1014
+ * the wider form — `JsonValue`-based records are the typed answer.
1015
+ *
1016
+ * @packageDocumentation
1017
+ */
1018
+
1019
+ /**
1020
+ * Recursive JSON value union — every shape JSON can carry.
1021
+ */
1022
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
1023
+ [key: string]: JsonValue;
1024
+ };
1025
+ /**
1026
+ * JSON object — keyed string→JsonValue. The wire form of arbitrary
1027
+ * structured data. Replaces `Record<string, unknown>` at typed
1028
+ * boundaries (LLM emits, file reads, HTTP bodies).
1029
+ */
1030
+ type JsonObject = {
1031
+ [key: string]: JsonValue;
1032
+ };
1033
+ /**
1034
+ * LLM tool-call arguments — same shape as `JsonObject`, named for the
1035
+ * agent-surface call site. Each tool's `execute(args: ToolArgs)`
1036
+ * receives this and narrows via an `is`-guard predicate before any
1037
+ * field access.
1038
+ */
1039
+ type ToolArgs = JsonObject;
1040
+ /**
1041
+ * Type guard: is the given value a JSON primitive (non-array,
1042
+ * non-object)? Used by walkers that decide whether to recurse.
1043
+ */
1044
+ declare function isJsonPrimitive(value: JsonValue): value is string | number | boolean | null;
1045
+ /**
1046
+ * Type guard: is the given value a JSON object (non-array, non-null)?
1047
+ */
1048
+ declare function isJsonObject(value: JsonValue): value is JsonObject;
1049
+ /**
1050
+ * Type guard: is the given value a JSON array?
1051
+ */
1052
+ declare function isJsonArray(value: JsonValue): value is JsonValue[];
1053
+
253
1054
  /**
254
1055
  * Field Types for Orbital Units
255
1056
  *
@@ -277,7 +1078,7 @@ type RelationCardinality = 'one' | 'many' | 'one-to-many' | 'many-to-one' | 'man
277
1078
  * Configuration for relation fields (foreign keys).
278
1079
  * Matches Rust compiler's RelationDefinition format.
279
1080
  */
280
- interface RelationConfig {
1081
+ type RelationConfig = {
281
1082
  /** Target entity name (e.g., 'User', 'Task') - matches Rust's `entity` field */
282
1083
  entity: string;
283
1084
  /** V4 dual-carry id sibling of `entity` — optional until the Phase-7 flip. */
@@ -306,7 +1107,7 @@ interface RelationConfig {
306
1107
  * @deprecated Use cardinality instead
307
1108
  */
308
1109
  type?: RelationCardinality;
309
- }
1110
+ };
310
1111
  declare const RelationConfigSchema: z.ZodEffects<z.ZodObject<{
311
1112
  entity: z.ZodString;
312
1113
  entityId: z.ZodOptional<z.ZodEffects<z.ZodString, EntityId, string>>;
@@ -363,7 +1164,7 @@ declare const FieldFormatSchema: z.ZodEnum<["email", "url", "phone", "date", "da
363
1164
  */
364
1165
  type ScalarFieldType = 'string' | 'number' | 'boolean' | 'date' | 'timestamp' | 'datetime' | 'trait' | 'slot' | 'pattern';
365
1166
  /** Fields shared across every variant. */
366
- interface EntityFieldBase {
1167
+ type EntityFieldBase = {
367
1168
  /**
368
1169
  * Field name (camelCase). Optional for nested item/property descriptors
369
1170
  * where the name is implied by the parent (`items`, `properties[k]`).
@@ -372,8 +1173,8 @@ interface EntityFieldBase {
372
1173
  name?: string;
373
1174
  /** Whether the field is required */
374
1175
  required?: boolean;
375
- /** Default value */
376
- default?: unknown;
1176
+ /** Default value — parsed from `.orb`, always JSON-shaped. */
1177
+ default?: JsonValue;
377
1178
  /** Validation format */
378
1179
  format?: FieldFormat;
379
1180
  /** Minimum value (for number) or length (for string) */
@@ -396,51 +1197,51 @@ interface EntityFieldBase {
396
1197
  /** User-vocabulary synonyms (authored `@synonyms "..."` in `.lolo`).
397
1198
  * Free text feeding catalog search / curation field-matching. */
398
1199
  synonyms?: string;
399
- }
1200
+ };
400
1201
  /**
401
1202
  * Scalar / structural fields — no type-dependent payload required.
402
1203
  * `values?` is permitted as an OPTIONAL UI/validation hint (e.g. lolo's
403
1204
  * `'a' | 'b' | 'c'` string-union sugar lowers to `type: 'string', values:
404
1205
  * [...]`). Only `EnumEntityField` MANDATES values.
405
1206
  */
406
- interface ScalarEntityField extends EntityFieldBase {
1207
+ type ScalarEntityField = EntityFieldBase & {
407
1208
  type: ScalarFieldType;
408
1209
  /** Optional vocabulary hint for scalar fields (e.g. string unions
409
1210
  * authored as `'a'|'b'|'c'` in lolo). Not required at this variant. */
410
1211
  values?: string[];
411
- }
1212
+ };
412
1213
  /** `type: 'enum'` REQUIRES the closed vocabulary in `values`. */
413
- interface EnumEntityField extends EntityFieldBase {
1214
+ type EnumEntityField = EntityFieldBase & {
414
1215
  type: 'enum';
415
1216
  /** Closed string vocabulary the field accepts. */
416
1217
  values: string[];
417
- }
1218
+ };
418
1219
  /** `type: 'relation'` REQUIRES the relation target binding. */
419
- interface RelationEntityField extends EntityFieldBase {
1220
+ type RelationEntityField = EntityFieldBase & {
420
1221
  type: 'relation';
421
1222
  /** Relation target binding (entity + cardinality). */
422
1223
  relation: RelationConfig;
423
- }
1224
+ };
424
1225
  /** `type: 'array'` — element schema in `items` strongly preferred but
425
1226
  * optional for legacy compatibility with codegen-emitted scalar-array
426
1227
  * fields (e.g. `{type: 'array', default: []}`). The lolo lowerer + Rust
427
1228
  * validator catch typed-element-required cases downstream. */
428
- interface ArrayEntityField extends EntityFieldBase {
1229
+ type ArrayEntityField = EntityFieldBase & {
429
1230
  type: 'array';
430
1231
  /** Element schema for the array. */
431
1232
  items?: EntityField;
432
- }
1233
+ };
433
1234
  /**
434
1235
  * `type: 'object'` — a fixed-key struct (fields in `properties`) OR a
435
1236
  * dynamic-key map (`Map K V` in `.lolo`; the uniform value schema lives in
436
1237
  * `items`, mirroring an array's element schema). A distinct variant so `items`
437
1238
  * is statically allowed only on object/array fields, never on scalars.
438
1239
  */
439
- interface ObjectEntityField extends EntityFieldBase {
1240
+ type ObjectEntityField = EntityFieldBase & {
440
1241
  type: 'object';
441
1242
  /** Uniform value schema for a dynamic-key map (`Map K V`). */
442
1243
  items?: EntityField;
443
- }
1244
+ };
444
1245
  /**
445
1246
  * Entity field definition — discriminated union by `type`. Each variant
446
1247
  * statically enforces its dependent payload (`values` for enum,
@@ -807,7 +1608,7 @@ declare const TilesheetSchema: z.ZodObject<{
807
1608
  * Semantic reference to an asset (not a hardcoded path).
808
1609
  * Resolved to actual paths at compile time via asset maps.
809
1610
  */
810
- interface SemanticAssetRef {
1611
+ type SemanticAssetRef = {
811
1612
  /**
812
1613
  * Entity role — a free string. Core no longer constrains the vocabulary to
813
1614
  * `EntityRole` (that enum stays an exported shared reference for the asset
@@ -826,7 +1627,7 @@ interface SemanticAssetRef {
826
1627
  dimension?: AssetDimension;
827
1628
  /** Rendering aspect ratio (square sprite/portrait/tile, 16:9 backdrop, 5:7 card, 8:1 fx-strip). */
828
1629
  aspect?: AssetAspect;
829
- }
1630
+ };
830
1631
  declare const SemanticAssetRefSchema: z.ZodObject<{
831
1632
  role: z.ZodString;
832
1633
  category: z.ZodString;
@@ -1207,7 +2008,7 @@ declare const EntityPersistenceSchema: z.ZodEnum<["persistent", "runtime"]>;
1207
2008
  * This is a simplified entity definition optimized for orbital composition.
1208
2009
  * Collection names are derived automatically from persistence type if not provided.
1209
2010
  */
1210
- interface OrbitalEntity {
2011
+ type OrbitalEntity = {
1211
2012
  /** V4 dual-carry id sibling of `name` — optional until the Phase-7 flip. */
1212
2013
  id?: EntityId;
1213
2014
  /** Entity name (PascalCase, e.g., "Task", "User") */
@@ -1232,7 +2033,7 @@ interface OrbitalEntity {
1232
2033
  visual_prompt?: string;
1233
2034
  /** Semantic asset reference for visual representation (games) */
1234
2035
  assetRef?: SemanticAssetRef;
1235
- }
2036
+ };
1236
2037
  declare const OrbitalEntitySchema: z.ZodObject<{
1237
2038
  name: z.ZodString;
1238
2039
  persistence: z.ZodDefault<z.ZodEnum<["persistent", "runtime"]>>;
@@ -1506,8 +2307,8 @@ type EntityData = Record<string, EntityRow[]>;
1506
2307
  *
1507
2308
  * DO NOT EDIT MANUALLY — regenerated by almadar-pattern-sync `patterns` command.
1508
2309
  *
1509
- * Generated: 2026-07-16T19:33:38.346Z
1510
- * Pattern count: 261
2310
+ * Generated: 2026-07-23T14:32:35.967Z
2311
+ * Pattern count: 263
1511
2312
  */
1512
2313
 
1513
2314
  /**
@@ -1519,7 +2320,7 @@ type PatternPropValue = Record<string, FieldValue | undefined>;
1519
2320
  * All valid pattern type names from @almadar/core/patterns registry.
1520
2321
  * Use this type in render-ui effects for compile-time validation.
1521
2322
  */
1522
- type PatternType = 'about-page-template' | 'accordion' | 'action-palette' | 'action-tile' | 'activation-block' | 'alert' | 'algorithm-canvas' | 'animated-counter' | 'animated-graphic' | 'animated-reveal' | 'article-section' | 'aside' | 'atlas-image' | 'atlas-panel' | 'auth-layout' | 'avatar' | 'badge' | 'behavior-view' | 'biology-canvas' | 'bloom-quiz-block' | 'book-chapter-view' | 'book-cover-page' | 'book-nav-bar' | 'book-table-of-contents' | 'book-viewer' | 'box' | 'branching-logic-builder' | 'breadcrumb' | 'button' | 'calendar-grid' | 'canvas' | 'canvas-2d' | 'card' | 'carousel' | 'case-study-card' | 'case-study-organism' | 'center' | 'chart' | 'chart-legend' | 'chat-bar' | 'checkbox' | 'chemistry-canvas' | 'choice-button' | 'code-block' | 'code-runner-panel' | 'community-links' | 'conditional-wrapper' | 'confetti-effect' | 'confirm-dialog' | 'connection-block' | 'container' | 'content-renderer' | 'content-section' | 'control-button' | 'control-grid' | 'counter-template' | 'cta-banner' | 'dashboard-grid' | 'dashboard-layout' | 'data-grid' | 'data-list' | 'date-range-picker' | 'date-range-selector' | 'day-cell' | 'detail-panel' | 'dialog' | 'dialogue-bubble' | 'divider' | 'doc-breadcrumb' | 'doc-pagination' | 'doc-search' | 'doc-sidebar' | 'doc-toc' | 'document-viewer' | 'draw-shape' | 'draw-shape-layer' | 'draw-sprite' | 'draw-sprite-layer' | 'draw-text' | 'draw-text-layer' | 'drawer' | 'drawer-slot' | 'edge-decoration' | 'empty-state' | 'entity-cards' | 'entity-list' | 'entity-table' | 'error-boundary' | 'error-state' | 'feature-card' | 'feature-detail-page-template' | 'feature-grid' | 'feature-grid-organism' | 'file-tree' | 'filter-group' | 'filter-pill' | 'flex' | 'flip-card' | 'flip-container' | 'floating-action-button' | 'form' | 'form-actions' | 'form-field' | 'form-layout' | 'form-section' | 'form-section-header' | 'game-audio-toggle' | 'game-hud' | 'game-icon' | 'game-menu' | 'game-shell' | 'generic-app-template' | 'geometric-pattern' | 'gradient-divider' | 'graph-canvas' | 'graph-view' | 'grid' | 'header' | 'health-bar' | 'hero-organism' | 'hero-section' | 'hstack' | 'icon' | 'infinite-scroll-sentinel' | 'input' | 'input-group' | 'install-box' | 'jazari-state-machine' | 'label' | 'landing-page-template' | 'law-reference-tooltip' | 'learning-canvas' | 'lightbox' | 'likert-scale' | 'line-chart' | 'loading-state' | 'map-view' | 'markdown-content' | 'marketing-footer' | 'marketing-stat-card' | 'master-detail' | 'master-detail-layout' | 'math-canvas' | 'matrix-question' | 'media-gallery' | 'menu' | 'meter' | 'modal' | 'modal-slot' | 'module-card' | 'navigation' | 'notification' | 'number-stepper' | 'option-constraint-group' | 'orbital-visualization' | 'overlay' | 'page-header' | 'pagination' | 'pattern-tile' | 'physics-canvas' | 'popover' | 'positioned-canvas' | 'pricing-card' | 'pricing-grid' | 'pricing-organism' | 'pricing-page-template' | 'progress-bar' | 'progress-dots' | 'pull-quote' | 'pull-to-refresh' | 'qr-scanner' | 'quiz-block' | 'radio' | 'range-slider' | 'reflection-block' | 'relation-select' | 'repeatable-form-section' | 'reply-tree' | 'rich-block-editor' | 'runtime-debugger' | 'scaled-diagram' | 'score-display' | 'search-input' | 'section' | 'section-header' | 'segment-renderer' | 'select' | 'sequence-bar' | 'service-catalog' | 'showcase-card' | 'showcase-organism' | 'side-panel' | 'sidebar' | 'signature-pad' | 'simple-grid' | 'skeleton' | 'social-proof' | 'sortable-list' | 'spacer' | 'sparkline' | 'spinner' | 'split' | 'split-pane' | 'split-section' | 'stack' | 'star-rating' | 'stat-badge' | 'stat-card' | 'stat-display' | 'state-graph' | 'state-json-view' | 'state-machine-view' | 'stats-grid' | 'stats-organism' | 'status-dot' | 'step-flow' | 'step-flow-organism' | 'subagent-trace-panel' | 'svg-branch' | 'svg-connection' | 'svg-flow' | 'svg-grid' | 'svg-lobe' | 'svg-mesh' | 'svg-morph' | 'svg-node' | 'svg-pulse' | 'svg-ring' | 'svg-shield' | 'svg-stack' | 'swipeable-row' | 'switch' | 'tabbed-container' | 'table-view' | 'tabs' | 'tag-cloud' | 'tag-input' | 'team-card' | 'team-organism' | 'text-highlight' | 'textarea' | 'theme-toggle' | 'time-slot-cell' | 'timeline' | 'timer-display' | 'toast-slot' | 'tooltip' | 'trait-frame' | 'trait-slot' | 'trend-indicator' | 'typewriter-text' | 'typography' | 'ui-slot-renderer' | 'upload-drop-zone' | 'version-diff' | 'violation-alert' | 'vote-stack' | 'vstack' | 'wizard-container' | 'wizard-navigation' | 'wizard-progress';
2323
+ type PatternType = 'about-page-template' | 'accordion' | 'action-palette' | 'action-tile' | 'activation-block' | 'alert' | 'algorithm-canvas' | 'animated-counter' | 'animated-graphic' | 'animated-reveal' | 'article-section' | 'aside' | 'atlas-image' | 'atlas-panel' | 'auth-layout' | 'avatar' | 'badge' | 'behavior-view' | 'biology-canvas' | 'bloom-quiz-block' | 'book-chapter-view' | 'book-cover-page' | 'book-nav-bar' | 'book-table-of-contents' | 'book-viewer' | 'box' | 'branching-logic-builder' | 'breadcrumb' | 'button' | 'calendar-grid' | 'canvas' | 'canvas-2d' | 'card' | 'carousel' | 'case-study-card' | 'case-study-organism' | 'center' | 'chart' | 'chart-legend' | 'chat-bar' | 'checkbox' | 'chemistry-canvas' | 'choice-button' | 'code-block' | 'code-runner-panel' | 'community-links' | 'conditional-wrapper' | 'confetti-effect' | 'confirm-dialog' | 'connection-block' | 'container' | 'content-renderer' | 'content-section' | 'control-button' | 'control-grid' | 'counter-template' | 'cta-banner' | 'dashboard-grid' | 'dashboard-layout' | 'data-grid' | 'data-list' | 'date-range-picker' | 'date-range-selector' | 'day-cell' | 'detail-panel' | 'dialog' | 'dialogue-bubble' | 'divider' | 'doc-breadcrumb' | 'doc-pagination' | 'doc-search' | 'doc-sidebar' | 'doc-toc' | 'document-viewer' | 'draw-shape' | 'draw-shape-layer' | 'draw-sprite' | 'draw-sprite-layer' | 'draw-text' | 'draw-text-layer' | 'drawer' | 'drawer-slot' | 'edge-decoration' | 'empty-state' | 'entity-cards' | 'entity-list' | 'entity-table' | 'error-boundary' | 'error-state' | 'feature-card' | 'feature-detail-page-template' | 'feature-grid' | 'feature-grid-organism' | 'file-tree' | 'filter-group' | 'filter-pill' | 'flex' | 'flip-card' | 'flip-container' | 'floating-action-button' | 'form' | 'form-actions' | 'form-field' | 'form-layout' | 'form-section' | 'form-section-header' | 'game-audio-toggle' | 'game-hud' | 'game-icon' | 'game-menu' | 'game-shell' | 'generic-app-template' | 'geometric-pattern' | 'gradient-divider' | 'graph-canvas' | 'graph-view' | 'grid' | 'header' | 'health-bar' | 'hero-organism' | 'hero-section' | 'hstack' | 'icon' | 'infinite-scroll-sentinel' | 'input' | 'input-group' | 'install-box' | 'jazari-state-machine' | 'label' | 'landing-page-template' | 'law-reference-tooltip' | 'learning-canvas' | 'lightbox' | 'likert-scale' | 'line-chart' | 'loading-state' | 'map-view' | 'markdown-content' | 'marketing-footer' | 'marketing-stat-card' | 'master-detail' | 'master-detail-layout' | 'math-canvas' | 'matrix-question' | 'media-gallery' | 'menu' | 'meter' | 'modal' | 'modal-slot' | 'module-card' | 'navigation' | 'notification' | 'number-stepper' | 'option-constraint-group' | 'orbital-visualization' | 'overlay' | 'page-header' | 'page-transition' | 'pagination' | 'pattern-tile' | 'physics-canvas' | 'popover' | 'positioned-canvas' | 'presence' | 'pricing-card' | 'pricing-grid' | 'pricing-organism' | 'pricing-page-template' | 'progress-bar' | 'progress-dots' | 'pull-quote' | 'pull-to-refresh' | 'qr-scanner' | 'quiz-block' | 'radio' | 'range-slider' | 'reflection-block' | 'relation-select' | 'repeatable-form-section' | 'reply-tree' | 'rich-block-editor' | 'runtime-debugger' | 'scaled-diagram' | 'score-display' | 'search-input' | 'section' | 'section-header' | 'segment-renderer' | 'select' | 'sequence-bar' | 'service-catalog' | 'showcase-card' | 'showcase-organism' | 'side-panel' | 'sidebar' | 'signature-pad' | 'simple-grid' | 'skeleton' | 'social-proof' | 'sortable-list' | 'spacer' | 'sparkline' | 'spinner' | 'split' | 'split-pane' | 'split-section' | 'stack' | 'star-rating' | 'stat-badge' | 'stat-card' | 'stat-display' | 'state-graph' | 'state-json-view' | 'state-machine-view' | 'stats-grid' | 'stats-organism' | 'status-dot' | 'step-flow' | 'step-flow-organism' | 'subagent-trace-panel' | 'svg-branch' | 'svg-connection' | 'svg-flow' | 'svg-grid' | 'svg-lobe' | 'svg-mesh' | 'svg-morph' | 'svg-node' | 'svg-pulse' | 'svg-ring' | 'svg-shield' | 'svg-stack' | 'swipeable-row' | 'switch' | 'tabbed-container' | 'table-view' | 'tabs' | 'tag-cloud' | 'tag-input' | 'team-card' | 'team-organism' | 'text-highlight' | 'textarea' | 'theme-toggle' | 'time-slot-cell' | 'timeline' | 'timer-display' | 'toast-slot' | 'tooltip' | 'trait-frame' | 'trait-slot' | 'trend-indicator' | 'typewriter-text' | 'typography' | 'ui-slot-renderer' | 'upload-drop-zone' | 'version-diff' | 'violation-alert' | 'vote-stack' | 'vstack' | 'wizard-container' | 'wizard-navigation' | 'wizard-progress';
1523
2324
  /**
1524
2325
  * Pattern props map — each pattern type maps to its valid props interface.
1525
2326
  */
@@ -2539,7 +3340,7 @@ interface PatternPropsMap {
2539
3340
  type: 'drawer';
2540
3341
  isOpen?: boolean | string | SExpr;
2541
3342
  onClose?: ((...args: unknown[]) => unknown) | string | SExpr;
2542
- title?: string | SExpr;
3343
+ title?: unknown | string | SExpr;
2543
3344
  children?: unknown | string | SExpr;
2544
3345
  footer?: unknown | string | SExpr;
2545
3346
  position?: string | SExpr;
@@ -2746,6 +3547,8 @@ interface PatternPropsMap {
2746
3547
  query?: string | SExpr;
2747
3548
  isLoading?: boolean | string | SExpr;
2748
3549
  look?: string | SExpr;
3550
+ event?: string | SExpr;
3551
+ clearEvent?: string | SExpr;
2749
3552
  };
2750
3553
  'filter-pill': {
2751
3554
  type: 'filter-pill';
@@ -2837,20 +3640,15 @@ interface PatternPropsMap {
2837
3640
  };
2838
3641
  'form-actions': {
2839
3642
  type: 'form-actions';
3643
+ children?: unknown | string | SExpr;
3644
+ primary?: PatternPropValue | string | SExpr;
3645
+ secondary?: unknown[] | string | SExpr;
3646
+ variant?: string | SExpr;
3647
+ orientation?: string | SExpr;
2840
3648
  className?: string | SExpr;
2841
- isLoading?: boolean | string | SExpr;
2842
- error?: PatternPropValue | string | SExpr;
2843
- sortBy?: string | SExpr;
2844
- sortDirection?: string | SExpr;
2845
- searchValue?: string | SExpr;
2846
- page?: number | string | SExpr;
2847
- pageSize?: number | string | SExpr;
2848
- totalCount?: number | string | SExpr;
2849
- activeFilters?: PatternPropValue | string | SExpr;
2850
- selectedIds?: unknown[] | string | SExpr;
2851
- children: unknown | string | SExpr;
2852
- sticky?: boolean | string | SExpr;
2853
- align?: string | SExpr;
3649
+ entity?: string | SExpr;
3650
+ filters?: unknown[] | string | SExpr;
3651
+ look?: string | SExpr;
2854
3652
  };
2855
3653
  'form-field': {
2856
3654
  type: 'form-field';
@@ -2973,6 +3771,7 @@ interface PatternPropsMap {
2973
3771
  backgroundAsset?: PatternPropValue | string | SExpr;
2974
3772
  hudBackgroundAsset?: PatternPropValue | string | SExpr;
2975
3773
  fontFamily?: string | SExpr;
3774
+ 'data-theme'?: string | SExpr;
2976
3775
  };
2977
3776
  'generic-app-template': {
2978
3777
  type: 'generic-app-template';
@@ -3297,6 +4096,7 @@ interface PatternPropsMap {
3297
4096
  title?: string | SExpr;
3298
4097
  message?: string | SExpr;
3299
4098
  className?: string | SExpr;
4099
+ fullPage?: boolean | string | SExpr;
3300
4100
  };
3301
4101
  'map-view': {
3302
4102
  type: 'map-view';
@@ -3452,6 +4252,7 @@ interface PatternPropsMap {
3452
4252
  type: 'modal';
3453
4253
  isOpen?: boolean | string | SExpr;
3454
4254
  onClose?: ((...args: unknown[]) => unknown) | string | SExpr;
4255
+ onExited?: ((...args: unknown[]) => unknown) | string | SExpr;
3455
4256
  title?: string | SExpr;
3456
4257
  children?: unknown | string | SExpr;
3457
4258
  footer?: unknown | string | SExpr;
@@ -3566,6 +4367,12 @@ interface PatternPropsMap {
3566
4367
  children?: unknown | string | SExpr;
3567
4368
  className?: string | SExpr;
3568
4369
  };
4370
+ 'page-transition': {
4371
+ type: 'page-transition';
4372
+ locationKey: string | SExpr;
4373
+ children: unknown | string | SExpr;
4374
+ className?: string | SExpr;
4375
+ };
3569
4376
  'pagination': {
3570
4377
  type: 'pagination';
3571
4378
  currentPage: number | string | SExpr;
@@ -3633,6 +4440,12 @@ interface PatternPropsMap {
3633
4440
  moveEvent?: string | SExpr;
3634
4441
  className?: string | SExpr;
3635
4442
  };
4443
+ 'presence': {
4444
+ type: 'presence';
4445
+ show: boolean | string | SExpr;
4446
+ className?: string | SExpr;
4447
+ children: unknown | string | SExpr;
4448
+ };
3636
4449
  'pricing-card': {
3637
4450
  type: 'pricing-card';
3638
4451
  name: string | SExpr;
@@ -4892,4 +5705,711 @@ declare const PATTERN_TYPES: PatternType[];
4892
5705
  */
4893
5706
  declare function isValidPatternType(type: string): type is PatternType;
4894
5707
 
4895
- export { FieldSchema as $, type AnyPatternConfig as A, type Camera as B, CAMERA_MODES as C, type CameraMode as D, type EntityField as E, type FieldValue as F, CameraModeSchema as G, CameraSchema as H, ENTITY_ROLES as I, type EntityData as J, type EntityFieldInput as K, EntityFieldSchema as L, EntityIdSchema as M, EntityPersistenceSchema as N, type OrbitalId as O, type PageId as P, type EntityRole as Q, type RelationConfig as R, EntityRoleSchema as S, type TraitId as T, EntitySchema as U, type EntityWith as V, type EnumEntityField as W, EventIdSchema as X, type Field as Y, type FieldFormat as Z, FieldFormatSchema as _, type EntityPersistence as a, isEntityId as a$, type FieldType as a0, FieldTypeSchema as a1, type IdForKind as a2, type IdKind as a3, type IdentityLedger as a4, IdentityLedgerSchema as a5, type LedgerEntry as a6, LedgerEntrySchema as a7, type LedgerKind as a8, LedgerKindSchema as a9, type SpriteSheetAtlasInput as aA, SpriteSheetAtlasSchema as aB, type SubTexture as aC, SubTextureSchema as aD, type TextureAtlas as aE, TextureAtlasSchema as aF, type ThemeId as aG, ThemeIdSchema as aH, type Tilesheet as aI, TilesheetSchema as aJ, TraitIdSchema as aK, VISUAL_STYLES as aL, type VisualStyle as aM, VisualStyleSchema as aN, asEntityId as aO, asEventId as aP, asOrbitalId as aQ, asPageId as aR, asPaletteEntryId as aS, asServiceId as aT, asThemeId as aU, asTraitId as aV, createAssetKey as aW, deriveCollection as aX, getDefaultAnimationsForRole as aY, idKindOf as aZ, idPrefix as a_, type OrbitalEntity as aa, type OrbitalEntityInput as ab, OrbitalEntitySchema as ac, OrbitalIdSchema as ad, PATTERN_TYPES as ae, PageIdSchema as af, type PaletteEntryId as ag, PaletteEntryIdSchema as ah, type PatternConfig as ai, type PatternProps as aj, type PatternPropsMap as ak, type PatternType as al, RelationConfigSchema as am, type RelationEntityField as an, SPRITE_DIRECTIONS as ao, type ScalarEntityField as ap, type ScenePos as aq, ScenePosSchema as ar, type SemanticAssetRef as as, type SemanticAssetRefInput as at, SemanticAssetRefSchema as au, type ServiceId as av, ServiceIdSchema as aw, type SpriteDirection as ax, SpriteDirectionSchema as ay, type SpriteSheetAtlas as az, type EntityRow as b, isEventId as b0, isFieldValue as b1, isOrbitalId as b2, isPageId as b3, isPaletteEntryId as b4, isRuntimeEntity as b5, isServiceId as b6, isThemeId as b7, isTraitId as b8, isValidPatternType as b9, ledgerCurName as ba, ledgerRename as bb, ledgerResolveName as bc, mintId as bd, parseAssetKey as be, persistenceModeAllowsOverrides as bf, validateAssetAnimations as bg, type EventId as c, type EntityId as d, type Entity as e, ANIMATION_NAMES as f, ASSET_ASPECTS as g, ASSET_DIMENSIONS as h, type AnimationDef as i, type AnimationDefInput as j, AnimationDefSchema as k, type AnimationName as l, AnimationNameSchema as m, type ArrayEntityField as n, type Asset as o, type AssetAspect as p, AssetAspectSchema as q, type AssetCatalog as r, type AssetCatalogEntry as s, type AssetCatalogEntryInput as t, AssetCatalogEntrySchema as u, AssetCatalogSchema as v, type AssetDimension as w, AssetDimensionSchema as x, AssetSchema as y, type AssetUrl as z };
5708
+ /**
5709
+ * Effect Types (Self-Contained)
5710
+ *
5711
+ * Defines effect types for trait transitions and ticks.
5712
+ * Effects are S-expressions (arrays) that describe actions to perform.
5713
+ *
5714
+ * @packageDocumentation
5715
+ */
5716
+
5717
+ /**
5718
+ * Known UI slots where content can be rendered
5719
+ */
5720
+ declare const UI_SLOTS: readonly ["main", "sidebar", "modal", "drawer", "overlay", "center", "toast", "floating", "system", "content", "screen", "hud", "hud-top", "hud-bottom", "hud.health", "hud.score", "hud.inventory", "hud.stamina", "overlay.inventory", "overlay.dialogue", "overlay.menu", "overlay.pause"];
5721
+ type UISlot = (typeof UI_SLOTS)[number];
5722
+ declare const UISlotSchema: z.ZodEnum<["main", "sidebar", "modal", "drawer", "overlay", "center", "toast", "floating", "system", "content", "screen", "hud", "hud-top", "hud-bottom", "hud.health", "hud.score", "hud.inventory", "hud.stamina", "overlay.inventory", "overlay.dialogue", "overlay.menu", "overlay.pause"]>;
5723
+
5724
+ /**
5725
+ * Configuration extracted from call-service effects
5726
+ */
5727
+ type CallServiceConfig = {
5728
+ service: string;
5729
+ action: string;
5730
+ endpoint?: string;
5731
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
5732
+ params?: ServiceParams;
5733
+ onSuccess?: string;
5734
+ onError?: string;
5735
+ };
5736
+ /**
5737
+ * A binding reference to a render tree stored elsewhere — a trait `config`
5738
+ * knob or a payload field — e.g. `"@config.bodyContent"`. Resolved to a pattern
5739
+ * node at render time. This is how an atom renders a tree that contains data
5740
+ * bindings (`entity: "@payload.data"`, `fields: "@config.fields"`): the tree is
5741
+ * a permissive `TraitConfigValue` stored in `config` (a binding string is not a
5742
+ * valid `AnyPatternConfig` prop value), and the render-ui effect points at it.
5743
+ * Worked example: `std-browse`'s loaded transition is `['render-ui', 'main',
5744
+ * '@config.bodyContent']`. The Rust validator accepts this form; this variant
5745
+ * lets the TS effect type express it.
5746
+ */
5747
+ type RenderBinding = `@${string}`;
5748
+ /**
5749
+ * Render UI effect - displays a pattern in a UI slot.
5750
+ * @example ['render-ui', 'main', { patternType: 'entity-table', columns: ['name'] }]
5751
+ * @example ['render-ui', 'main', '@config.bodyContent'] // a {@link RenderBinding} target
5752
+ */
5753
+ type RenderUIEffect = ['render-ui', UISlot, AnyPatternConfig] | ['render-ui', UISlot, AnyPatternConfig, ResolvedPatternProps] | ['render-ui', UISlot, RenderBinding] | ['render-ui', UISlot, null];
5754
+ /**
5755
+ * Lambda expression for per-item rendering in data-grid/data-list.
5756
+ * The compiler generates: {(paramName: Record<string, unknown>) => (<>JSX</>)}
5757
+ * where @{paramName}.field bindings reference the current iteration item.
5758
+ *
5759
+ * @example ["fn", "item", { "type": "stack", "children": [{ "type": "typography", "content": "@item.title" }] }]
5760
+ */
5761
+ type RenderItemLambda = ['fn', string, AnyPatternConfig];
5762
+ /**
5763
+ * Dynamic-collection children entry: renders one child per item of a collection
5764
+ * expression, authored inline in a `children:` position and kept verbatim as IR
5765
+ * (no new node kind). The collection expression is an {@link SExpr} evaluated at
5766
+ * render time; the {@link RenderItemLambda} body is instantiated per item with
5767
+ * the lambda param bound as an `@item`-scope binding. Both execution paths lower
5768
+ * onto the one lambda + `@item` + splice machinery.
5769
+ *
5770
+ * @example ["array/map", "@entity.tasks", ["fn", "item", { "type": "typography", "content": "@item.title" }]]
5771
+ */
5772
+ type RenderChildrenMap = ['array/map', SExpr, RenderItemLambda];
5773
+ /**
5774
+ * Navigate effect - navigates to an internal page path or an external URL.
5775
+ * @example ['navigate', '/tasks'] or ['navigate', '/tasks/:id', { id: '123' }]
5776
+ * @example ['navigate', 'https://example.com']
5777
+ */
5778
+ type NavigateEffect = ['navigate', string | SExpr] | ['navigate', string | SExpr, Record<string, string>];
5779
+ /**
5780
+ * Emit effect - emits an event, optionally with payload.
5781
+ * @example ['emit', 'SAVE'] or ['emit', 'PLAYER_DIED', { playerId: '@entity.id' }]
5782
+ * @example ['emit', 'FILTER_CHANGED', '@entity.filters']
5783
+ */
5784
+ type EmitEffect = ['emit', string] | ['emit', string, EventPayload | string];
5785
+ /**
5786
+ * `emit:` config block attached to async / reactive data operators.
5787
+ *
5788
+ * Each key names an event the runtime should fire on the bus when the
5789
+ * effect reaches the corresponding lifecycle point. The set of keys an
5790
+ * operator actually supports is enforced by the compiler validator:
5791
+ *
5792
+ * | Operator | Supported keys |
5793
+ * |------------------|---------------------------|
5794
+ * | `fetch` | `success`, `failure` |
5795
+ * | `persist` | `success`, `failure` |
5796
+ * | `call-service` | `success`, `failure` |
5797
+ * | `set` | `success` |
5798
+ * | `ref` | `on_change`, `failure` |
5799
+ * | `os/watch-*` | `on_message`, `failure` |
5800
+ *
5801
+ * Payload convention:
5802
+ * - `success` / `on_change` → the effect's result (fetched entity, new value)
5803
+ * - `failure` → `{ error: string, code?: string }`
5804
+ * - `on_message` → the incoming message (os/watch-* streams)
5805
+ *
5806
+ * See `docs/Almadar_Std_Gaps.md` §3.1 for the close-the-circuit design.
5807
+ */
5808
+ interface EmitConfig {
5809
+ /** Fires after a one-shot async effect resolves successfully. */
5810
+ success?: string;
5811
+ /** Fires when the effect throws; payload is `{ error: string }`. */
5812
+ failure?: string;
5813
+ /** Reactive-subscription event (per update for `ref`). */
5814
+ on_change?: string;
5815
+ /** Per-event fire for `os/watch-*` streams. */
5816
+ on_message?: string;
5817
+ }
5818
+ /**
5819
+ * Set effect - sets a binding to a value.
5820
+ *
5821
+ * Two forms are supported to match the runtime's `set` handler signature
5822
+ * `(targetId, field, value)`:
5823
+ *
5824
+ * - 3-element binding form (legacy / std behaviors): ['set', '@entity.field', value]
5825
+ * - 4-element target form (canonical runtime): ['set', entityId, fieldName, value]
5826
+ *
5827
+ * The 4-element form is what `OrbitalServerRuntime`'s set handler
5828
+ * dispatches directly (`update(entityType, targetId, { field: value })`).
5829
+ * Prefer the 4-element form when authoring schemas in TypeScript that
5830
+ * load directly into the runtime.
5831
+ *
5832
+ * @example ['set', '@entity.health', 100] // 3-element
5833
+ * @example ['set', '@entity.id', 'health', 100] // 4-element
5834
+ * @example ['set', '@entity.id', 'count', ['+', '@entity.count', 1]]
5835
+ */
5836
+ type SetEffect = ['set', string, unknown] | ['set', string, string, unknown];
5837
+ /**
5838
+ * Trailing config object on persist effects. When present, it carries the
5839
+ * `emit` map specifying which events to fire on persist success/failure.
5840
+ * Mirrors what the runtime's `EffectExecutor` reads at the 5th tuple
5841
+ * position. See `(persist create Entity @payload.data { emit: { success:
5842
+ * "Saved", failure: "SaveFailed" } })` in `.lolo` source.
5843
+ */
5844
+ type PersistEmitConfig = {
5845
+ emit?: {
5846
+ success?: string;
5847
+ failure?: string;
5848
+ };
5849
+ };
5850
+ /**
5851
+ * Persist effect data argument: either an entity row literal (field map)
5852
+ * or a binding string referencing a row in scope (e.g. `@payload.data`,
5853
+ * `@entity`). At runtime, binding strings resolve to `EntityRow` values
5854
+ * before the persist op runs.
5855
+ */
5856
+ type PersistData = EntityRow | string;
5857
+ /**
5858
+ * Persist effect - creates, updates, deletes, or clears entities.
5859
+ *
5860
+ * Each operation accepts an optional trailing `PersistEmitConfig` so the
5861
+ * runtime can fire success / failure events when the operation completes.
5862
+ *
5863
+ * @example ['persist', 'create', 'Task', { title: '@payload.title' }]
5864
+ * @example ['persist', 'update', '@entity.entityType', '@payload.data']
5865
+ * @example ['persist', 'create', 'Task', '@payload.data', { emit: { success: 'TaskCreated' } }]
5866
+ */
5867
+ type PersistEffect = ['persist', 'create', string, PersistData] | ['persist', 'create', string, PersistData, PersistEmitConfig] | ['persist', 'update', string, PersistData] | ['persist', 'update', string, PersistData, PersistEmitConfig] | ['persist', 'delete', string] | ['persist', 'delete', string, PersistData] | ['persist', 'delete', string, PersistData, PersistEmitConfig] | ['persist', 'clear', string] | ['persist', 'clear', string, PersistData] | ['persist', 'clear', string, PersistData, PersistEmitConfig];
5868
+ /**
5869
+ * Call service effect - invokes an external service.
5870
+ *
5871
+ * Two shapes are accepted:
5872
+ *
5873
+ * 1. Flat form (what the runtime reads and every .orb file uses):
5874
+ * `['call-service', serviceName, action, params?]` — args[0]=service,
5875
+ * args[1]=action, args[2]=params. This is the canonical form; the
5876
+ * runtime's EffectExecutor decodes exactly these positions.
5877
+ *
5878
+ * 2. Legacy config-object form (kept for the `callService()` helper):
5879
+ * `['call-service', serviceName, CallServiceConfig]` — retained so
5880
+ * older call sites using the builder helper continue to typecheck.
5881
+ *
5882
+ * @example ['call-service', 'llm', 'generate', { userPrompt: '@entity.inputText' }]
5883
+ * @example ['call-service', 'llm', 'generate', { userPrompt: '...' }, { emit: { success: 'OK', failure: 'ERR' } }]
5884
+ * @example ['call-service', 'WeatherAPI', { service: 'weather', action: 'get', onSuccess: 'OK' }]
5885
+ */
5886
+ type CallServiceEffect = ['call-service', string, string] | ['call-service', string, string, ServiceParams] | ['call-service', string, string, ServiceParams, PersistEmitConfig] | ['call-service', string, CallServiceConfig];
5887
+ /**
5888
+ * Spawn effect - creates a new entity instance (games).
5889
+ * @example ['spawn', 'Bullet', { x: '@entity.x', y: '@entity.y' }]
5890
+ */
5891
+ type SpawnEffect = ['spawn', string] | ['spawn', string, EntityRow];
5892
+ /**
5893
+ * Despawn effect - removes an entity instance (games).
5894
+ * @example ['despawn', '@entity.id']
5895
+ */
5896
+ type DespawnEffect = ['despawn', string];
5897
+ /**
5898
+ * Do effect - executes multiple effects in sequence.
5899
+ * Uses SExpr to allow deeply nested conditionals.
5900
+ * @example ['do', ['set', '@entity.x', 0], ['set', '@entity.y', 0]]
5901
+ */
5902
+ type DoEffect = ['do', ...SExpr[]];
5903
+ /**
5904
+ * Notify effect - sends a notification.
5905
+ * @example ['notify', 'in_app', 'Task created successfully']
5906
+ * @example ['notify', 'in_app', ['str/concat', 'Item: ', '@entity.name']]
5907
+ */
5908
+ type NotifyEffect = ['notify', string, string | SExpr] | ['notify', string, string | SExpr, string];
5909
+ /**
5910
+ * Options accepted by `fetch` / `ref` / `deref` effects. Mirrors what
5911
+ * `OrbitalServerRuntime`'s fetch handler reads at runtime: `id`, `filter`,
5912
+ * `limit`, `offset`, `include`, plus the trailing `emit:` map for
5913
+ * success/failure event names.
5914
+ */
5915
+ type FetchOptions = {
5916
+ /** Fetch a single entity by ID */
5917
+ id?: string;
5918
+ /** Filter expression (S-expression) */
5919
+ filter?: SExpr;
5920
+ /** Maximum number of entities to return */
5921
+ limit?: number;
5922
+ /** Number of entities to skip */
5923
+ offset?: number;
5924
+ /** Relations to populate (entity field names) */
5925
+ include?: string[];
5926
+ /** Lifecycle events to emit on resolve / reject */
5927
+ emit?: {
5928
+ success?: string;
5929
+ failure?: string;
5930
+ };
5931
+ };
5932
+ /**
5933
+ * Fetch effect - retrieves entity data (server-side).
5934
+ * @example ['fetch', 'User'] or ['fetch', 'User', { id: '@payload.userId' }]
5935
+ */
5936
+ type FetchEffect = ['fetch', string] | ['fetch', string, FetchOptions];
5937
+ /**
5938
+ * Result returned by a fetch / ref / deref handler.
5939
+ *
5940
+ * `rows` carries the entity (or entities) that survived `filter` AND
5941
+ * pagination (`offset`/`limit`). `total` is the count of rows that
5942
+ * matched the filter BEFORE pagination, so paginating consumers can
5943
+ * compute `totalPages = ceil(total / pageSize)` without a second
5944
+ * round-trip. Single-entity fetches by id return `total: 1` (or `0`
5945
+ * if not found, in which case the handler returns `null` instead).
5946
+ */
5947
+ interface FetchResult {
5948
+ rows: EntityRow | EntityRow[];
5949
+ total: number;
5950
+ }
5951
+ /**
5952
+ * If effect - conditional effect execution.
5953
+ * Uses SExpr to allow deeply nested conditionals.
5954
+ * @example ['if', ['>', '@entity.health', 0], ['emit', 'ALIVE'], ['emit', 'DEAD']]
5955
+ */
5956
+ type IfEffect = ['if', Expression, SExpr] | ['if', Expression, SExpr, SExpr];
5957
+ /**
5958
+ * When effect - conditional effect similar to if but without else.
5959
+ * Uses SExpr to allow deeply nested conditionals.
5960
+ * @example ['when', ['>', '@entity.health', 0], ['emit', 'ALIVE']]
5961
+ */
5962
+ type WhenEffect = ['when', Expression, SExpr];
5963
+ /**
5964
+ * Let effect - creates local bindings for effects.
5965
+ * Uses SExpr to allow deeply nested conditionals.
5966
+ * @example ['let', ['temp', ['get', '@payload.value']], ['set', '@entity.value', 'temp']]
5967
+ */
5968
+ type LetEffect = ['let', [string, unknown][], ...SExpr[]];
5969
+ /**
5970
+ * Log effect - logs a message for debugging.
5971
+ * @example ['log', 'User created:', '@entity.name']
5972
+ */
5973
+ type LogEffect = ['log', ...unknown[]];
5974
+ /**
5975
+ * Wait effect - delays execution.
5976
+ * @example ['wait', 1000] - wait 1 second
5977
+ */
5978
+ type WaitEffect = ['wait', number];
5979
+ /**
5980
+ * Ref effect - creates a reactive entity subscription.
5981
+ * Returns a reactive reference that auto-updates when the entity changes.
5982
+ * @example ['ref', '@entity.health'] - reactive subscription to health
5983
+ * @example ['ref', 'User', { id: '@payload.userId' }] - reactive ref to specific user
5984
+ */
5985
+ type RefEffect = ['ref', string] | ['ref', string, FetchOptions];
5986
+ /**
5987
+ * Deref effect - snapshot read of an entity value.
5988
+ * Returns the current value without subscribing to changes.
5989
+ * @example ['deref', '@entity.health'] - read current health value
5990
+ * @example ['deref', 'User', { id: '@payload.userId' }] - read specific user snapshot
5991
+ */
5992
+ type DerefEffect = ['deref', string] | ['deref', string, FetchOptions];
5993
+ /**
5994
+ * Swap! effect - atomic compare-and-swap on an entity field.
5995
+ * Only updates if the current value matches the expected value.
5996
+ * @example ['swap!', '@entity.health', ['fn', ['old'], ['-', 'old', '@payload.damage']]]
5997
+ * @example ['swap!', '@entity.counter', ['+', '@entity.counter', 1]]
5998
+ */
5999
+ type SwapEffect = ['swap!', string, SExpr];
6000
+ /**
6001
+ * Options accepted by `watch` effects. Mirrors what the runtime reads when
6002
+ * registering the change callback: `debounce` and the trailing `emit:` map.
6003
+ */
6004
+ type WatchOptions = {
6005
+ /** Debounce duration in milliseconds */
6006
+ debounce?: number;
6007
+ /** Lifecycle events to emit on update / failure */
6008
+ emit?: {
6009
+ on_message?: string;
6010
+ failure?: string;
6011
+ };
6012
+ };
6013
+ /**
6014
+ * Watch effect - registers a callback for entity changes.
6015
+ * Emits an event whenever the watched binding changes.
6016
+ * @example ['watch', '@entity.health', 'HEALTH_CHANGED']
6017
+ * @example ['watch', '@entity.status', 'STATUS_UPDATED', { debounce: 100 }]
6018
+ */
6019
+ type WatchEffect = ['watch', string, string] | ['watch', string, string, WatchOptions];
6020
+ /**
6021
+ * Atomic effect - groups multiple effects into an atomic transaction.
6022
+ * All effects either succeed together or are rolled back.
6023
+ * @example ['atomic', ['set', '@entity.x', 10], ['set', '@entity.y', 20]]
6024
+ * @example ['atomic', ['persist', 'update', 'User', { balance: 100 }], ['emit', 'BALANCE_UPDATED']]
6025
+ */
6026
+ type AtomicEffect = ['atomic', ...SExpr[]];
6027
+ /**
6028
+ * One layer in an NN architecture description. The set of valid layer kinds
6029
+ * lives in `almadar-std/modules/nn`; here we keep the wire shape generic
6030
+ * enough for the cross-package runtime + Python bridge to round-trip.
6031
+ */
6032
+ type NnLayer = {
6033
+ type: string;
6034
+ [key: string]: string | number | boolean | number[] | string[] | undefined;
6035
+ };
6036
+ /**
6037
+ * Hyperparameters for `train` and `evaluate`. Recursive to allow nested
6038
+ * optimizer / scheduler config blocks without falling back to `unknown`.
6039
+ */
6040
+ type NnConfig = {
6041
+ [key: string]: string | number | boolean | string[] | number[] | NnConfig | undefined;
6042
+ };
6043
+ /**
6044
+ * Forward-pass config: `input` is a binding string (`@payload.input`), and
6045
+ * `on-complete` names the event to fire when the prediction lands.
6046
+ */
6047
+ type ForwardConfig = {
6048
+ architecture: NnLayer[];
6049
+ input: string;
6050
+ 'on-complete'?: string;
6051
+ config?: NnConfig;
6052
+ };
6053
+ /**
6054
+ * Training-loop config. `dataset` is a binding string referencing the rows
6055
+ * to train on. Optimizer / loss / scheduler land inside `config`.
6056
+ */
6057
+ type TrainConfig = {
6058
+ architecture: NnLayer[];
6059
+ dataset: string;
6060
+ config?: NnConfig;
6061
+ 'on-complete'?: string;
6062
+ };
6063
+ /**
6064
+ * Evaluation config. `metrics` lists named metrics the Python backend
6065
+ * computes (`accuracy`, `precision`, ...).
6066
+ */
6067
+ type EvaluateConfig = {
6068
+ architecture: NnLayer[];
6069
+ dataset: string;
6070
+ metrics: string[];
6071
+ config?: NnConfig;
6072
+ 'on-complete'?: string;
6073
+ };
6074
+ /**
6075
+ * Forward effect - runs a neural network forward pass (Python backend).
6076
+ * @example ['forward', 'primary', { architecture: [...], input: '@payload.input', 'on-complete': 'PREDICTION_READY' }]
6077
+ */
6078
+ type ForwardEffect = ['forward', string, ForwardConfig];
6079
+ /**
6080
+ * Train effect - runs a training loop (Python backend).
6081
+ * @example ['train', { architecture: [...], dataset: '@entity.data', config: { epochs: 10 }, 'on-complete': 'TRAINING_DONE' }]
6082
+ */
6083
+ type TrainEffect = ['train', TrainConfig];
6084
+ /**
6085
+ * Evaluate effect - runs model evaluation (Python backend).
6086
+ * @example ['evaluate', { architecture: [...], dataset: '@entity.testData', metrics: ['accuracy'], 'on-complete': 'EVAL_DONE' }]
6087
+ */
6088
+ type EvaluateEffect = ['evaluate', EvaluateConfig];
6089
+ /**
6090
+ * Checkpoint save effect - saves model weights.
6091
+ * @example ['checkpoint/save', '/path/to/model.pt', '@entity.weights']
6092
+ */
6093
+ type CheckpointSaveEffect = ['checkpoint/save', string, unknown];
6094
+ /**
6095
+ * Checkpoint load effect - loads model weights.
6096
+ * @example ['checkpoint/load', '/path/to/model.pt']
6097
+ */
6098
+ type CheckpointLoadEffect = ['checkpoint/load', string];
6099
+ /**
6100
+ * Agent effect - invokes an agent/* operator.
6101
+ * Covers all 22 operators in the std-agent category.
6102
+ * @example ['agent/memorize', 'use data-grid for tables', 'preference']
6103
+ * @example ['agent/recall', 'user preferences']
6104
+ * @example ['agent/generate', 'Summarize this schema']
6105
+ */
6106
+ type AgentEffect = [`agent/${string}`, ...SExpr[]];
6107
+ /**
6108
+ * OS effect - invokes an os/* operator.
6109
+ *
6110
+ * Covers reactive subscriptions to OS / network resources:
6111
+ * - `os/watch-http`, `os/watch-ws`, `os/watch-sse` — long-lived streams
6112
+ * that fire `on_message` / `failure` events through a trailing
6113
+ * `EmitConfig` block (see `EmitConfig` for the supported keys).
6114
+ * - `os/read-file`, `os/exec`, etc. — one-shot OS operations.
6115
+ *
6116
+ * @example ['os/watch-http', 'wss://push.example.com', { emit: { on_message: 'PUSH_RECEIVED', failure: 'PUSH_DISCONNECTED' } }]
6117
+ * @example ['os/read-file', '/etc/hosts']
6118
+ */
6119
+ type OsEffect = [`os/${string}`, ...SExpr[]];
6120
+ /**
6121
+ * Browser effect - invokes a browser/* device operator (client host path).
6122
+ * User-initiated, async, resolves via the standard trailing emit envelope.
6123
+ * Concrete operators (browser/open-file-picker, browser/clipboard-read,
6124
+ * browser/clipboard-write, browser/geolocation-current) and their arity /
6125
+ * payload shapes live in @almadar/std BROWSER_OPERATORS.
6126
+ * @example ['browser/open-file-picker', { multiple: false }, { emit: { success: 'FILES_PICKED', failure: 'PICK_CANCELLED' } }]
6127
+ */
6128
+ type BrowserEffect = [`browser/${string}`, ...SExpr[]];
6129
+ /**
6130
+ * LLM effect - invokes an llm/* operator (agent path).
6131
+ * @example ['llm/generate', '@entity.request', { emit: { success: 'PLANNED', failure: 'PLAN_FAILED' } }]
6132
+ */
6133
+ type LlmEffect = [`llm/${string}`, ...SExpr[]];
6134
+ /**
6135
+ * Behavior effect - invokes a behavior/* operator (agent path).
6136
+ * @example ['behavior/instantiate', '@entity.plan', { emit: { failure: 'BUILD_FAILED' } }]
6137
+ */
6138
+ type BehaviorEffect = [`behavior/${string}`, ...SExpr[]];
6139
+ /**
6140
+ * Validate effect - invokes a validate/* operator (agent path).
6141
+ * @example ['validate/validate', '@entity.schema', { emit: { failure: 'INVALID' } }]
6142
+ */
6143
+ type ValidateEffect = [`validate/${string}`, ...SExpr[]];
6144
+ /**
6145
+ * Remaining agent-path operator effects: session/* (workspace session ops),
6146
+ * compose/* (schema composition), trace/* (trace emission), memory/*
6147
+ * (agent memory), application/* (app lifecycle). Expression-only namespaces
6148
+ * (array/, math/, object/, str/, …) are deliberately NOT effect heads.
6149
+ * @example ['session/write-spec', '@entity.spec']
6150
+ * @example ['compose/compose-all', { emit: { failure: 'COMPOSE_FAILED' } }]
6151
+ */
6152
+ type SessionEffect = [`session/${string}`, ...SExpr[]];
6153
+ type ComposeEffect = [`compose/${string}`, ...SExpr[]];
6154
+ type TraceEffect = [`trace/${string}`, ...SExpr[]];
6155
+ type MemoryEffect = [`memory/${string}`, ...SExpr[]];
6156
+ type ApplicationEffect = [`application/${string}`, ...SExpr[]];
6157
+ /**
6158
+ * Async delay effect - wait then execute effects.
6159
+ * @example ['async/delay', 2000, ['emit', 'TIMEOUT']]
6160
+ */
6161
+ type AsyncDelayEffect = ['async/delay', number | string, ...Effect[]];
6162
+ /**
6163
+ * Async debounce effect - debounce then execute effect.
6164
+ * @example ['async/debounce', 300, ['emit', 'SEARCH_COMPLETE']]
6165
+ * @example ['async/debounce', '@entity.debounceMs', ['emit', 'SEARCH_COMPLETE']]
6166
+ */
6167
+ type AsyncDebounceEffect = ['async/debounce', number | string, SExpr];
6168
+ /**
6169
+ * Async throttle effect - throttle then execute effect.
6170
+ * @example ['async/throttle', 100, ['emit', 'SCROLL_HANDLED']]
6171
+ * @example ['async/throttle', '@entity.throttleMs', ['emit', 'SCROLL_HANDLED']]
6172
+ */
6173
+ type AsyncThrottleEffect = ['async/throttle', number | string, SExpr];
6174
+ /**
6175
+ * Async interval effect - execute effect at intervals.
6176
+ * @example ['async/interval', 1000, ['emit', 'TICK']]
6177
+ * @example ['async/interval', '@entity.intervalMs', ['emit', 'POLL_TICK']]
6178
+ */
6179
+ type AsyncIntervalEffect = ['async/interval', number | string, SExpr];
6180
+ /**
6181
+ * Async race effect - first effect to complete wins.
6182
+ * @example ['async/race', ['call', 'api1'], ['call', 'api2']]
6183
+ */
6184
+ type AsyncRaceEffect = ['async/race', ...Effect[]];
6185
+ /**
6186
+ * Async all effect - wait for all effects to complete.
6187
+ * @example ['async/all', ['call', 'api1'], ['call', 'api2']]
6188
+ */
6189
+ type AsyncAllEffect = ['async/all', ...Effect[]];
6190
+ /**
6191
+ * Async sequence effect - execute effects in sequence.
6192
+ * @example ['async/sequence', ['call', 'validate'], ['call', 'save']]
6193
+ */
6194
+ type AsyncSequenceEffect = ['async/sequence', ...Effect[]];
6195
+ /**
6196
+ * Union of all typed effects.
6197
+ * Provides compile-time validation for common effect types.
6198
+ */
6199
+ type TypedEffect = RenderUIEffect | NavigateEffect | EmitEffect | SetEffect | PersistEffect | CallServiceEffect | SpawnEffect | DespawnEffect | DoEffect | NotifyEffect | FetchEffect | IfEffect | WhenEffect | LetEffect | LogEffect | WaitEffect | RefEffect | DerefEffect | SwapEffect | WatchEffect | AtomicEffect | AsyncDelayEffect | AsyncDebounceEffect | AsyncThrottleEffect | AsyncIntervalEffect | AsyncRaceEffect | AsyncAllEffect | AsyncSequenceEffect | ForwardEffect | TrainEffect | EvaluateEffect | CheckpointSaveEffect | CheckpointLoadEffect | AgentEffect | OsEffect | BrowserEffect | LlmEffect | BehaviorEffect | ValidateEffect | SessionEffect | ComposeEffect | TraceEffect | MemoryEffect | ApplicationEffect;
6200
+ /**
6201
+ * Effect type - typed S-expression format.
6202
+ *
6203
+ * Effects are strongly typed tuples that enforce:
6204
+ * - Valid effect operators (render-ui, emit, set, persist, navigate, call-service)
6205
+ * - Valid UISlots for render-ui
6206
+ * - Valid PatternTypes and props for render-ui
6207
+ * - Correct argument types for each effect
6208
+ *
6209
+ * Available typed effects:
6210
+ * - RenderUIEffect: ['render-ui', UISlot, PatternConfig]
6211
+ * - NavigateEffect: ['navigate', path] or ['navigate', path, params]
6212
+ * - EmitEffect: ['emit', eventName] or ['emit', eventName, payload]
6213
+ * - SetEffect: ['set', binding, value]
6214
+ * - PersistEffect: ['persist', operation, entity, data?]
6215
+ * - CallServiceEffect: ['call-service', serviceName, config]
6216
+ *
6217
+ * @example
6218
+ * ["set", "@entity.health", 100]
6219
+ * ["emit", "PLAYER_DIED", { "playerId": "@entity.id" }]
6220
+ * ["render-ui", "main", { "patternType": "entity-table", "columns": ["name"] }]
6221
+ * ["call-service", "WeatherAPI", { "action": "getWeather", "onSuccess": "OK" }]
6222
+ * ["navigate", "/tasks"]
6223
+ * ["persist", "create", "Task", { "title": "@payload.title" }]
6224
+ */
6225
+ type Effect = TypedEffect;
6226
+ /**
6227
+ * Schema for Effect - validates S-expression format
6228
+ */
6229
+ declare const EffectSchema: z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>;
6230
+ type EffectInput = z.input<typeof EffectSchema>;
6231
+ /**
6232
+ * Type guard to check if a value is a valid Effect (S-expression).
6233
+ *
6234
+ * Validates that a value conforms to the Effect structure. Effects are
6235
+ * represented as arrays where the first element is a string (effect type)
6236
+ * and subsequent elements are parameters. Used for runtime validation
6237
+ * of effect structures.
6238
+ *
6239
+ * @param {unknown} value - Value to check
6240
+ * @returns {boolean} True if value is a valid Effect, false otherwise
6241
+ *
6242
+ * @example
6243
+ * isEffect(['set', '@entity.health', 100]); // returns true
6244
+ * isEffect('not-an-effect'); // returns false
6245
+ * isEffect([]); // returns false
6246
+ */
6247
+ declare function isEffect(value: unknown): value is Effect;
6248
+ /**
6249
+ * Alias for isEffect (for clarity when working with S-expressions)
6250
+ */
6251
+ declare const isSExprEffect: typeof isEffect;
6252
+ /**
6253
+ * Creates a set effect for state updates.
6254
+ *
6255
+ * Generates an effect that sets a binding to a value. Used in state
6256
+ * machine transitions to update entity fields, UI state, or other
6257
+ * mutable data.
6258
+ *
6259
+ * @param {string} binding - Target binding (e.g., '@entity.health')
6260
+ * @param {SExpr} value - Value to set (can be literal or expression)
6261
+ * @returns {Effect} Set effect array
6262
+ *
6263
+ * @example
6264
+ * set('@entity.health', 100); // returns ["set", "@entity.health", 100]
6265
+ * set('@state.loading', false); // returns ["set", "@state.loading", false]
6266
+ */
6267
+ declare function set(binding: string, value: SExpr): Effect;
6268
+ /**
6269
+ * Creates an emit effect for event dispatching.
6270
+ *
6271
+ * Generates an effect that emits an event with optional payload.
6272
+ * Used in state machine transitions to trigger events that can be
6273
+ * handled by other traits, services, or external systems.
6274
+ *
6275
+ * @param {string} event - Event name to emit
6276
+ * @param {EventPayload} [payload] - Optional event payload
6277
+ * @returns {Effect} Emit effect array
6278
+ *
6279
+ * @example
6280
+ * emit('PLAYER_DIED', { playerId: '@entity.id' }); // returns ["emit", "PLAYER_DIED", { playerId: "@entity.id" }]
6281
+ * emit('GAME_STARTED'); // returns ["emit", "GAME_STARTED"]
6282
+ */
6283
+ declare function emit(event: string, payload?: EventPayload): Effect;
6284
+ /**
6285
+ * Creates a navigation effect for page routing.
6286
+ *
6287
+ * Generates an effect that navigates to a specified path with optional
6288
+ * parameters. Used in state machine transitions to change pages or
6289
+ * update URL parameters.
6290
+ *
6291
+ * @param {string} path - Target path (e.g., '/tasks')
6292
+ * @param {Record<string, string>} [params] - Optional URL parameters
6293
+ * @returns {NavigateEffect} Navigation effect array
6294
+ *
6295
+ * @example
6296
+ * navigate('/tasks'); // returns ["navigate", "/tasks"]
6297
+ * navigate('/user', { id: '123' }); // returns ["navigate", "/user", { id: "123" }]
6298
+ */
6299
+ declare function navigate(path: string): NavigateEffect;
6300
+ declare function navigate(path: string, params: Record<string, string>): NavigateEffect;
6301
+ /**
6302
+ * Create a render-ui effect
6303
+ * @example ["render-ui", "main", { "patternType": "entity-table", "columns": ["name"] }]
6304
+ */
6305
+ declare function renderUI(target: UISlot, pattern: AnyPatternConfig): RenderUIEffect;
6306
+ declare function renderUI(target: UISlot, pattern: AnyPatternConfig, props: ResolvedPatternProps): RenderUIEffect;
6307
+ /**
6308
+ * Create a persist effect
6309
+ * @example ["persist", "create", "Task", { "title": "@payload.title" }]
6310
+ */
6311
+ declare function persist(action: 'create' | 'update', entity: string, data: PersistData): PersistEffect;
6312
+ declare function persist(action: 'delete' | 'clear', entity: string, data?: PersistData): PersistEffect;
6313
+ /**
6314
+ * Create a call-service effect
6315
+ * @example ["call-service", "stripe", { "service": "stripe", "action": "charge", "onSuccess": "OK", "onError": "ERR" }]
6316
+ */
6317
+ declare function callService(serviceName: string, config: CallServiceConfig): CallServiceEffect;
6318
+ /**
6319
+ * Create a spawn effect (games)
6320
+ * @example ["spawn", "Bullet", { "x": "@entity.x", "y": "@entity.y" }]
6321
+ */
6322
+ declare function spawn(entity: string): SpawnEffect;
6323
+ declare function spawn(entity: string, initialState: EntityRow): SpawnEffect;
6324
+ /**
6325
+ * Create a despawn effect (games)
6326
+ * @example ["despawn", "@entity.id"]
6327
+ */
6328
+ declare function despawn(entityId: string): DespawnEffect;
6329
+ /**
6330
+ * Create a do effect (multiple effects)
6331
+ * @example ["do", ["set", "@entity.x", 0], ["set", "@entity.y", 0]]
6332
+ */
6333
+ declare function doEffects(...effects: SExpr[]): DoEffect;
6334
+ /**
6335
+ * Create a notify effect
6336
+ * @example ["notify", "in_app", "Task created successfully"]
6337
+ */
6338
+ declare function notify(channel: 'email' | 'push' | 'sms' | 'in_app', message: string): NotifyEffect;
6339
+ declare function notify(channel: 'email' | 'push' | 'sms' | 'in_app', message: string, recipient: string): NotifyEffect;
6340
+ /**
6341
+ * Create a ref effect (reactive entity subscription).
6342
+ *
6343
+ * @param {string} binding - Binding or entity name to subscribe to
6344
+ * @param {FetchOptions} [selector] - Optional selector for specific entity
6345
+ * @returns {RefEffect} Ref effect array
6346
+ *
6347
+ * @example
6348
+ * ref('@entity.health'); // returns ["ref", "@entity.health"]
6349
+ * ref('User', { id: '@payload.userId' }); // returns ["ref", "User", { id: "@payload.userId" }]
6350
+ */
6351
+ declare function ref(binding: string): RefEffect;
6352
+ declare function ref(binding: string, selector: FetchOptions): RefEffect;
6353
+ /**
6354
+ * Create a deref effect (snapshot read).
6355
+ *
6356
+ * @param {string} binding - Binding or entity name to read
6357
+ * @param {FetchOptions} [selector] - Optional selector for specific entity
6358
+ * @returns {DerefEffect} Deref effect array
6359
+ *
6360
+ * @example
6361
+ * deref('@entity.health'); // returns ["deref", "@entity.health"]
6362
+ * deref('User', { id: '@payload.userId' }); // returns ["deref", "User", { id: "@payload.userId" }]
6363
+ */
6364
+ declare function deref(binding: string): DerefEffect;
6365
+ declare function deref(binding: string, selector: FetchOptions): DerefEffect;
6366
+ /**
6367
+ * Create a swap! effect (atomic compare-and-swap).
6368
+ *
6369
+ * @param {string} binding - Binding to atomically update
6370
+ * @param {SExpr} transform - Transformation expression applied to the current value
6371
+ * @returns {SwapEffect} Swap effect array
6372
+ *
6373
+ * @example
6374
+ * swap('@entity.counter', ['+', '@entity.counter', 1]);
6375
+ * // returns ["swap!", "@entity.counter", ["+", "@entity.counter", 1]]
6376
+ */
6377
+ declare function swap(binding: string, transform: SExpr): SwapEffect;
6378
+ /**
6379
+ * Create a watch effect (entity change callback).
6380
+ *
6381
+ * @example
6382
+ * watch('@entity.health', 'HEALTH_CHANGED');
6383
+ * watch('@entity.status', 'STATUS_UPDATED', { debounce: 100 });
6384
+ */
6385
+ declare function watch(binding: string, event: string): WatchEffect;
6386
+ declare function watch(binding: string, event: string, options: WatchOptions): WatchEffect;
6387
+ /**
6388
+ * Create an atomic effect (transaction group).
6389
+ *
6390
+ * @param {...SExpr[]} effects - Effects to execute atomically
6391
+ * @returns {AtomicEffect} Atomic effect array
6392
+ *
6393
+ * @example
6394
+ * atomic(['set', '@entity.x', 10], ['set', '@entity.y', 20]);
6395
+ * // returns ["atomic", ["set", "@entity.x", 10], ["set", "@entity.y", 20]]
6396
+ */
6397
+ declare function atomic(...effects: SExpr[]): AtomicEffect;
6398
+ /** Resolved pattern props for render-ui effects at runtime. Recursive for nested pattern configs. */
6399
+ type ResolvedPatternProps = {
6400
+ [prop: string]: string | number | boolean | null | undefined | ResolvedPatternProps | ResolvedPatternProps[];
6401
+ };
6402
+ /** A node in a render-ui effect tree. */
6403
+ interface RenderUINode {
6404
+ type: string;
6405
+ props?: ResolvedPatternProps;
6406
+ /** Static child nodes and/or dynamic-collection map entries. A
6407
+ * {@link RenderChildrenMap} entry expands at render time into resolved
6408
+ * `RenderUINode`s, so components always receive a flat, fully-resolved list. */
6409
+ children?: Array<RenderUINode | RenderChildrenMap>;
6410
+ content?: string;
6411
+ entity?: string;
6412
+ renderItem?: RenderUINode;
6413
+ }
6414
+
6415
+ export { ENTITY_ROLES as $, type AnyPatternConfig as A, type AssetDimension as B, AssetDimensionSchema as C, AssetSchema as D, type EntityField as E, type FieldValue as F, type AssetUrl as G, type AtomicEffect as H, type BehaviorEffect as I, type JsonValue as J, CAMERA_MODES as K, type CallServiceConfig as L, type CallServiceEffect as M, type Camera as N, type OrbitalId as O, type PageId as P, type CameraMode as Q, type RelationConfig as R, CameraModeSchema as S, type TraitId as T, CameraSchema as U, type CheckpointLoadEffect as V, type CheckpointSaveEffect as W, type ComposeEffect as X, type DerefEffect as Y, type DespawnEffect as Z, type DoEffect as _, type EntityPersistence as a, RelationConfigSchema as a$, type EffectInput as a0, EffectSchema as a1, type EmitConfig as a2, type EmitEffect as a3, type EntityData as a4, type EntityFieldInput as a5, EntityFieldSchema as a6, EntityIdSchema as a7, EntityPersistenceSchema as a8, type EntityRole as a9, LedgerKindSchema as aA, type LlmEffect as aB, type LogEffect as aC, type McpServiceDef as aD, McpServiceDefSchema as aE, type MemoryEffect as aF, type NavigateEffect as aG, type NnConfig as aH, type NnLayer as aI, type NotifyEffect as aJ, type OrbitalEntity as aK, type OrbitalEntityInput as aL, OrbitalEntitySchema as aM, OrbitalIdSchema as aN, type OsEffect as aO, PATTERN_TYPES as aP, PageIdSchema as aQ, type PaletteEntryId as aR, PaletteEntryIdSchema as aS, type PatternConfig as aT, type PatternProps as aU, type PatternPropsMap as aV, type PatternType as aW, type PersistData as aX, type PersistEffect as aY, type PersistEmitConfig as aZ, type RefEffect as a_, EntityRoleSchema as aa, EntitySchema as ab, type EntityWith as ac, type EnumEntityField as ad, type EvaluateConfig as ae, type EvaluateEffect as af, EventIdSchema as ag, type FetchEffect as ah, type FetchOptions as ai, type FetchResult as aj, type Field as ak, type FieldFormat as al, FieldFormatSchema as am, FieldSchema as an, type FieldType as ao, FieldTypeSchema as ap, type ForwardConfig as aq, type ForwardEffect as ar, type IdForKind as as, type IdKind as at, type IdentityLedger as au, IdentityLedgerSchema as av, type JsonObject as aw, type LedgerEntry as ax, LedgerEntrySchema as ay, type LedgerKind as az, type EventId as b, type VisualStyle as b$, type RelationEntityField as b0, type RenderBinding as b1, type RenderChildrenMap as b2, type RenderItemLambda as b3, type RenderUIEffect as b4, type RenderUINode as b5, type ResolvedPatternProps as b6, type RestAuthConfig as b7, RestAuthConfigSchema as b8, type RestServiceDef as b9, type SocketServiceDef as bA, SocketServiceDefSchema as bB, type SpawnEffect as bC, type SpriteDirection as bD, SpriteDirectionSchema as bE, type SpriteSheetAtlas as bF, type SpriteSheetAtlasInput as bG, SpriteSheetAtlasSchema as bH, type SubTexture as bI, SubTextureSchema as bJ, type SwapEffect as bK, type TextureAtlas as bL, TextureAtlasSchema as bM, type ThemeId as bN, ThemeIdSchema as bO, type Tilesheet as bP, TilesheetSchema as bQ, type TraceEffect as bR, type TrainConfig as bS, type TrainEffect as bT, TraitIdSchema as bU, type TypedEffect as bV, type UISlot as bW, UISlotSchema as bX, UI_SLOTS as bY, VISUAL_STYLES as bZ, type ValidateEffect as b_, RestServiceDefSchema as ba, SERVICE_TYPES as bb, SPRITE_DIRECTIONS as bc, type ScalarEntityField as bd, type ScenePos as be, ScenePosSchema as bf, type SemanticAssetRef as bg, type SemanticAssetRefInput as bh, SemanticAssetRefSchema as bi, type ServiceDefinition as bj, ServiceDefinitionSchema as bk, type ServiceId as bl, ServiceIdSchema as bm, type ServiceParams as bn, type ServiceParamsValue as bo, type ServiceRef as bp, type ServiceRefObject as bq, ServiceRefObjectSchema as br, ServiceRefSchema as bs, ServiceRefStringSchema as bt, type ServiceType as bu, ServiceTypeSchema as bv, type SessionEffect as bw, type SetEffect as bx, type SocketEvents as by, SocketEventsSchema as bz, type Effect as c, VisualStyleSchema as c0, type WatchEffect as c1, type WatchOptions as c2, asEntityId as c3, asEventId as c4, asOrbitalId as c5, asPageId as c6, asPaletteEntryId as c7, asServiceId as c8, asThemeId as c9, isRestService as cA, isRuntimeEntity as cB, isSExprEffect as cC, isServiceId as cD, isServiceReference as cE, isServiceReferenceObject as cF, isSocketService as cG, isThemeId as cH, isTraitId as cI, isValidPatternType as cJ, ledgerCurName as cK, ledgerRename as cL, ledgerResolveName as cM, mintId as cN, navigate as cO, notify as cP, parseAssetKey as cQ, parseServiceRef as cR, persist as cS, persistenceModeAllowsOverrides as cT, ref as cU, renderUI as cV, set as cW, spawn as cX, swap as cY, validateAssetAnimations as cZ, watch as c_, asTraitId as ca, atomic as cb, callService as cc, createAssetKey as cd, deref as ce, deriveCollection as cf, despawn as cg, doEffects as ch, emit as ci, findService as cj, getDefaultAnimationsForRole as ck, getServiceNames as cl, hasService as cm, idKindOf as cn, idPrefix as co, isEffect as cp, isEntityId as cq, isEventId as cr, isFieldValue as cs, isJsonArray as ct, isJsonObject as cu, isJsonPrimitive as cv, isMcpService as cw, isOrbitalId as cx, isPageId as cy, isPaletteEntryId as cz, type EntityId as d, type Entity as e, type ToolArgs as f, type EntityRow as g, ANIMATION_NAMES as h, ASSET_ASPECTS as i, ASSET_DIMENSIONS as j, type AgentEffect as k, type AnimationDef as l, type AnimationDefInput as m, AnimationDefSchema as n, type AnimationName as o, AnimationNameSchema as p, type ApplicationEffect as q, type ArrayEntityField as r, type Asset as s, type AssetAspect as t, AssetAspectSchema as u, type AssetCatalog as v, type AssetCatalogEntry as w, type AssetCatalogEntryInput as x, AssetCatalogEntrySchema as y, AssetCatalogSchema as z };