@objectstack/objectql 4.0.1 → 4.0.3

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,22 +1,22 @@
1
1
 
2
- > @objectstack/objectql@4.0.1 build /home/runner/work/spec/spec/packages/objectql
2
+ > @objectstack/objectql@4.0.3 build /home/runner/work/framework/framework/packages/objectql
3
3
  > tsup --config ../../tsup.config.ts
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.1
8
- CLI Using tsup config: /home/runner/work/spec/spec/tsup.config.ts
8
+ CLI Using tsup config: /home/runner/work/framework/framework/tsup.config.ts
9
9
  CLI Target: es2020
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.mjs 102.95 KB
14
- ESM dist/index.mjs.map 211.04 KB
15
- ESM ⚡️ Build success in 203ms
16
- CJS dist/index.js 104.68 KB
17
- CJS dist/index.js.map 212.34 KB
18
- CJS ⚡️ Build success in 209ms
13
+ ESM dist/index.mjs 112.91 KB
14
+ ESM dist/index.mjs.map 230.31 KB
15
+ ESM ⚡️ Build success in 125ms
16
+ CJS dist/index.js 114.81 KB
17
+ CJS dist/index.js.map 231.61 KB
18
+ CJS ⚡️ Build success in 160ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 25148ms
21
- DTS dist/index.d.mts 79.12 KB
22
- DTS dist/index.d.ts 79.12 KB
20
+ DTS ⚡️ Build success in 21312ms
21
+ DTS dist/index.d.mts 78.76 KB
22
+ DTS dist/index.d.ts 78.76 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @objectstack/objectql
2
2
 
3
+ ## 4.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - @objectstack/spec@4.0.3
8
+ - @objectstack/core@4.0.3
9
+ - @objectstack/types@4.0.3
10
+
11
+ ## 4.0.3
12
+
13
+ ### Patch Changes
14
+
15
+ - fix: ObjectQL.init() now tracks and warns about failed driver connections instead of silently swallowing errors, improving debuggability for cold-start and serverless issues.
16
+
17
+ ## 4.0.2
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [5f659e9]
22
+ - @objectstack/spec@4.0.2
23
+ - @objectstack/core@4.0.2
24
+ - @objectstack/types@4.0.2
25
+
3
26
  ## 4.0.0
4
27
 
5
28
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ import { ObjectOwnership, ServiceObject, QueryAST, HookContext, EngineQueryOptio
4
4
  import { ObjectStackManifest, InstalledPackage, ExecutionContext } from '@objectstack/spec/kernel';
5
5
  import { ObjectStackProtocol, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, UpdateManyDataRequest, DeleteManyDataRequest } from '@objectstack/spec/api';
6
6
  import { IDataEngine, DriverInterface, Logger, Plugin, PluginContext, ObjectKernel } from '@objectstack/core';
7
- import { IFeedService } from '@objectstack/spec/contracts';
7
+ import { IFeedService, IRealtimeService } from '@objectstack/spec/contracts';
8
8
 
9
9
  /**
10
10
  * XState-inspired State Machine Protocol
@@ -130,15 +130,13 @@ declare class SchemaRegistry {
130
130
  private static objectContributors;
131
131
  /** FQN → Merged ServiceObject (cached, invalidated on changes) */
132
132
  private static mergedObjectCache;
133
- /** Namespace → PackageId (ensures namespace uniqueness) */
133
+ /** Namespace → Set<PackageId> (multiple packages can share a namespace) */
134
134
  private static namespaceRegistry;
135
135
  /** Type → Name/ID → MetadataItem */
136
136
  private static metadata;
137
137
  /**
138
138
  * Register a namespace for a package.
139
- * Enforces namespace uniqueness within the instance.
140
- *
141
- * @throws Error if namespace is already registered to a different package
139
+ * Multiple packages can share the same namespace (e.g. 'sys').
142
140
  */
143
141
  static registerNamespace(namespace: string, packageId: string): void;
144
142
  /**
@@ -146,9 +144,13 @@ declare class SchemaRegistry {
146
144
  */
147
145
  static unregisterNamespace(namespace: string, packageId: string): void;
148
146
  /**
149
- * Get the package that owns a namespace.
147
+ * Get the packages that use a namespace.
150
148
  */
151
149
  static getNamespaceOwner(namespace: string): string | undefined;
150
+ /**
151
+ * Get all packages that share a namespace.
152
+ */
153
+ static getNamespaceOwners(namespace: string): string[];
152
154
  /**
153
155
  * Register an object with ownership semantics.
154
156
  *
@@ -471,12 +473,8 @@ declare class SchemaRegistry {
471
473
  keyPrefix?: string | undefined;
472
474
  actions?: {
473
475
  name: string;
474
- label: string | {
475
- key: string;
476
- defaultValue?: string | undefined;
477
- params?: Record<string, string | number | boolean> | undefined;
478
- };
479
- type: "url" | "script" | "modal" | "flow" | "api";
476
+ label: string;
477
+ type: "url" | "flow" | "api" | "script" | "modal";
480
478
  refreshAfter: boolean;
481
479
  objectName?: string | undefined;
482
480
  icon?: string | undefined;
@@ -486,63 +484,35 @@ declare class SchemaRegistry {
486
484
  execute?: string | undefined;
487
485
  params?: {
488
486
  name: string;
489
- label: string | {
490
- key: string;
491
- defaultValue?: string | undefined;
492
- params?: Record<string, string | number | boolean> | undefined;
493
- };
487
+ label: string;
494
488
  type: "number" | "boolean" | "date" | "lookup" | "file" | "url" | "json" | "text" | "textarea" | "email" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "image" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "location" | "address" | "code" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "tags" | "vector";
495
489
  required: boolean;
496
490
  options?: {
497
- label: string | {
498
- key: string;
499
- defaultValue?: string | undefined;
500
- params?: Record<string, string | number | boolean> | undefined;
501
- };
491
+ label: string;
502
492
  value: string;
503
493
  }[] | undefined;
504
494
  }[] | undefined;
505
495
  variant?: "link" | "primary" | "secondary" | "danger" | "ghost" | undefined;
506
- confirmText?: string | {
507
- key: string;
508
- defaultValue?: string | undefined;
509
- params?: Record<string, string | number | boolean> | undefined;
510
- } | undefined;
511
- successMessage?: string | {
512
- key: string;
513
- defaultValue?: string | undefined;
514
- params?: Record<string, string | number | boolean> | undefined;
515
- } | undefined;
496
+ confirmText?: string | undefined;
497
+ successMessage?: string | undefined;
516
498
  visible?: string | undefined;
517
499
  disabled?: string | boolean | undefined;
518
500
  shortcut?: string | undefined;
519
501
  bulkEnabled?: boolean | undefined;
520
502
  timeout?: number | undefined;
521
503
  aria?: {
522
- ariaLabel?: string | {
523
- key: string;
524
- defaultValue?: string | undefined;
525
- params?: Record<string, string | number | boolean> | undefined;
526
- } | undefined;
504
+ ariaLabel?: string | undefined;
527
505
  ariaDescribedBy?: string | undefined;
528
506
  role?: string | undefined;
529
507
  } | undefined;
530
508
  }[] | undefined;
531
509
  } | {
532
510
  name: string;
533
- label: string | {
534
- key: string;
535
- defaultValue?: string | undefined;
536
- params?: Record<string, string | number | boolean> | undefined;
537
- };
511
+ label: string;
538
512
  active: boolean;
539
513
  isDefault: boolean;
540
514
  version?: string | undefined;
541
- description?: string | {
542
- key: string;
543
- defaultValue?: string | undefined;
544
- params?: Record<string, string | number | boolean> | undefined;
545
- } | undefined;
515
+ description?: string | undefined;
546
516
  icon?: string | undefined;
547
517
  branding?: {
548
518
  primaryColor?: string | undefined;
@@ -552,19 +522,11 @@ declare class SchemaRegistry {
552
522
  navigation?: any[] | undefined;
553
523
  areas?: {
554
524
  id: string;
555
- label: string | {
556
- key: string;
557
- defaultValue?: string | undefined;
558
- params?: Record<string, string | number | boolean> | undefined;
559
- };
525
+ label: string;
560
526
  navigation: any[];
561
527
  icon?: string | undefined;
562
528
  order?: number | undefined;
563
- description?: string | {
564
- key: string;
565
- defaultValue?: string | undefined;
566
- params?: Record<string, string | number | boolean> | undefined;
567
- } | undefined;
529
+ description?: string | undefined;
568
530
  visible?: string | undefined;
569
531
  requiredPermissions?: string[] | undefined;
570
532
  }[] | undefined;
@@ -594,11 +556,7 @@ declare class SchemaRegistry {
594
556
  bottomNavItems?: string[] | undefined;
595
557
  } | undefined;
596
558
  aria?: {
597
- ariaLabel?: string | {
598
- key: string;
599
- defaultValue?: string | undefined;
600
- params?: Record<string, string | number | boolean> | undefined;
601
- } | undefined;
559
+ ariaLabel?: string | undefined;
602
560
  ariaDescribedBy?: string | undefined;
603
561
  role?: string | undefined;
604
562
  } | undefined;
@@ -606,7 +564,7 @@ declare class SchemaRegistry {
606
564
  manifest: {
607
565
  id: string;
608
566
  version: string;
609
- type: "theme" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
567
+ type: "theme" | "app" | "agent" | "driver" | "server" | "ui" | "module" | "objectql" | "plugin" | "gateway" | "adapter";
610
568
  name: string;
611
569
  namespace?: string | undefined;
612
570
  description?: string | undefined;
@@ -751,7 +709,7 @@ declare class SchemaRegistry {
751
709
  extensionPoints?: {
752
710
  id: string;
753
711
  name: string;
754
- type: "provider" | "action" | "widget" | "hook" | "transformer" | "validator" | "decorator";
712
+ type: "provider" | "action" | "hook" | "widget" | "transformer" | "validator" | "decorator";
755
713
  cardinality: "multiple" | "single";
756
714
  description?: string | undefined;
757
715
  contract?: {
@@ -931,7 +889,7 @@ declare class SchemaRegistry {
931
889
  } | {
932
890
  id: string;
933
891
  version: string;
934
- type: "theme" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
892
+ type: "theme" | "app" | "agent" | "driver" | "server" | "ui" | "module" | "objectql" | "plugin" | "gateway" | "adapter";
935
893
  name: string;
936
894
  namespace?: string | undefined;
937
895
  description?: string | undefined;
@@ -1076,7 +1034,7 @@ declare class SchemaRegistry {
1076
1034
  extensionPoints?: {
1077
1035
  id: string;
1078
1036
  name: string;
1079
- type: "provider" | "action" | "widget" | "hook" | "transformer" | "validator" | "decorator";
1037
+ type: "provider" | "action" | "hook" | "widget" | "transformer" | "validator" | "decorator";
1080
1038
  cardinality: "multiple" | "single";
1081
1039
  description?: string | undefined;
1082
1040
  contract?: {
@@ -1306,7 +1264,8 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1306
1264
  };
1307
1265
  services: Record<string, {
1308
1266
  enabled: boolean;
1309
- status: "degraded" | "stub" | "available" | "unavailable";
1267
+ status: "degraded" | "stub" | "available" | "registered" | "unavailable";
1268
+ handlerReady?: boolean | undefined;
1310
1269
  route?: string | undefined;
1311
1270
  provider?: string | undefined;
1312
1271
  version?: string | undefined;
@@ -1328,6 +1287,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1328
1287
  }>;
1329
1288
  getMetaItems(request: {
1330
1289
  type: string;
1290
+ packageId?: string;
1331
1291
  }): Promise<{
1332
1292
  type: string;
1333
1293
  items: unknown[];
@@ -1335,6 +1295,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1335
1295
  getMetaItem(request: {
1336
1296
  type: string;
1337
1297
  name: string;
1298
+ packageId?: string;
1338
1299
  }): Promise<{
1339
1300
  type: string;
1340
1301
  name: string;
@@ -1384,7 +1345,6 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1384
1345
  query?: any;
1385
1346
  }): Promise<{
1386
1347
  object: string;
1387
- value: any[];
1388
1348
  records: any[];
1389
1349
  total: number;
1390
1350
  hasMore: boolean;
@@ -1531,6 +1491,7 @@ declare class ObjectQL implements IDataEngine {
1531
1491
  private middlewares;
1532
1492
  private actions;
1533
1493
  private hostContext;
1494
+ private realtimeService?;
1534
1495
  constructor(hostContext?: Record<string, any>);
1535
1496
  /**
1536
1497
  * Service Status Report
@@ -1624,6 +1585,13 @@ declare class ObjectQL implements IDataEngine {
1624
1585
  * Register a new storage driver
1625
1586
  */
1626
1587
  registerDriver(driver: DriverInterface, isDefault?: boolean): void;
1588
+ /**
1589
+ * Set the realtime service for publishing data change events.
1590
+ * Should be called after kernel resolves the realtime service.
1591
+ *
1592
+ * @param service - An IRealtimeService instance for event publishing
1593
+ */
1594
+ setRealtimeService(service: IRealtimeService): void;
1627
1595
  /**
1628
1596
  * Helper to get object definition
1629
1597
  */
@@ -1919,6 +1887,30 @@ declare class ObjectQLPlugin implements Plugin {
1919
1887
  * Drivers that do not implement `syncSchema` are silently skipped.
1920
1888
  */
1921
1889
  private syncRegisteredSchemas;
1890
+ /**
1891
+ * Restore persisted metadata from the database (sys_metadata) on startup.
1892
+ *
1893
+ * Calls `protocol.loadMetaFromDb()` to bulk-load all active metadata
1894
+ * records (objects, views, apps, etc.) into the in-memory SchemaRegistry.
1895
+ * This closes the persistence loop so that user-created schemas survive
1896
+ * kernel cold starts and redeployments.
1897
+ *
1898
+ * Gracefully degrades when:
1899
+ * - The protocol service is unavailable (e.g., in-memory-only mode).
1900
+ * - `loadMetaFromDb` is not implemented by the protocol shim.
1901
+ * - The underlying driver/table does not exist yet (first-run scenario).
1902
+ */
1903
+ private restoreMetadataFromDb;
1904
+ /**
1905
+ * Bridge all SchemaRegistry objects to the metadata service.
1906
+ *
1907
+ * This ensures objects registered by plugins and loaded from sys_metadata
1908
+ * are visible to AI tools and other consumers that query IMetadataService.
1909
+ *
1910
+ * Runs after both restoreMetadataFromDb() and syncRegisteredSchemas() to
1911
+ * catch all objects in the SchemaRegistry regardless of their source.
1912
+ */
1913
+ private bridgeObjectsToMetadataService;
1922
1914
  /**
1923
1915
  * Load metadata from external metadata service into ObjectQL registry
1924
1916
  * This enables ObjectQL to use file-based or remote metadata
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { ObjectOwnership, ServiceObject, QueryAST, HookContext, EngineQueryOptio
4
4
  import { ObjectStackManifest, InstalledPackage, ExecutionContext } from '@objectstack/spec/kernel';
5
5
  import { ObjectStackProtocol, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, UpdateManyDataRequest, DeleteManyDataRequest } from '@objectstack/spec/api';
6
6
  import { IDataEngine, DriverInterface, Logger, Plugin, PluginContext, ObjectKernel } from '@objectstack/core';
7
- import { IFeedService } from '@objectstack/spec/contracts';
7
+ import { IFeedService, IRealtimeService } from '@objectstack/spec/contracts';
8
8
 
9
9
  /**
10
10
  * XState-inspired State Machine Protocol
@@ -130,15 +130,13 @@ declare class SchemaRegistry {
130
130
  private static objectContributors;
131
131
  /** FQN → Merged ServiceObject (cached, invalidated on changes) */
132
132
  private static mergedObjectCache;
133
- /** Namespace → PackageId (ensures namespace uniqueness) */
133
+ /** Namespace → Set<PackageId> (multiple packages can share a namespace) */
134
134
  private static namespaceRegistry;
135
135
  /** Type → Name/ID → MetadataItem */
136
136
  private static metadata;
137
137
  /**
138
138
  * Register a namespace for a package.
139
- * Enforces namespace uniqueness within the instance.
140
- *
141
- * @throws Error if namespace is already registered to a different package
139
+ * Multiple packages can share the same namespace (e.g. 'sys').
142
140
  */
143
141
  static registerNamespace(namespace: string, packageId: string): void;
144
142
  /**
@@ -146,9 +144,13 @@ declare class SchemaRegistry {
146
144
  */
147
145
  static unregisterNamespace(namespace: string, packageId: string): void;
148
146
  /**
149
- * Get the package that owns a namespace.
147
+ * Get the packages that use a namespace.
150
148
  */
151
149
  static getNamespaceOwner(namespace: string): string | undefined;
150
+ /**
151
+ * Get all packages that share a namespace.
152
+ */
153
+ static getNamespaceOwners(namespace: string): string[];
152
154
  /**
153
155
  * Register an object with ownership semantics.
154
156
  *
@@ -471,12 +473,8 @@ declare class SchemaRegistry {
471
473
  keyPrefix?: string | undefined;
472
474
  actions?: {
473
475
  name: string;
474
- label: string | {
475
- key: string;
476
- defaultValue?: string | undefined;
477
- params?: Record<string, string | number | boolean> | undefined;
478
- };
479
- type: "url" | "script" | "modal" | "flow" | "api";
476
+ label: string;
477
+ type: "url" | "flow" | "api" | "script" | "modal";
480
478
  refreshAfter: boolean;
481
479
  objectName?: string | undefined;
482
480
  icon?: string | undefined;
@@ -486,63 +484,35 @@ declare class SchemaRegistry {
486
484
  execute?: string | undefined;
487
485
  params?: {
488
486
  name: string;
489
- label: string | {
490
- key: string;
491
- defaultValue?: string | undefined;
492
- params?: Record<string, string | number | boolean> | undefined;
493
- };
487
+ label: string;
494
488
  type: "number" | "boolean" | "date" | "lookup" | "file" | "url" | "json" | "text" | "textarea" | "email" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "image" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "location" | "address" | "code" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "tags" | "vector";
495
489
  required: boolean;
496
490
  options?: {
497
- label: string | {
498
- key: string;
499
- defaultValue?: string | undefined;
500
- params?: Record<string, string | number | boolean> | undefined;
501
- };
491
+ label: string;
502
492
  value: string;
503
493
  }[] | undefined;
504
494
  }[] | undefined;
505
495
  variant?: "link" | "primary" | "secondary" | "danger" | "ghost" | undefined;
506
- confirmText?: string | {
507
- key: string;
508
- defaultValue?: string | undefined;
509
- params?: Record<string, string | number | boolean> | undefined;
510
- } | undefined;
511
- successMessage?: string | {
512
- key: string;
513
- defaultValue?: string | undefined;
514
- params?: Record<string, string | number | boolean> | undefined;
515
- } | undefined;
496
+ confirmText?: string | undefined;
497
+ successMessage?: string | undefined;
516
498
  visible?: string | undefined;
517
499
  disabled?: string | boolean | undefined;
518
500
  shortcut?: string | undefined;
519
501
  bulkEnabled?: boolean | undefined;
520
502
  timeout?: number | undefined;
521
503
  aria?: {
522
- ariaLabel?: string | {
523
- key: string;
524
- defaultValue?: string | undefined;
525
- params?: Record<string, string | number | boolean> | undefined;
526
- } | undefined;
504
+ ariaLabel?: string | undefined;
527
505
  ariaDescribedBy?: string | undefined;
528
506
  role?: string | undefined;
529
507
  } | undefined;
530
508
  }[] | undefined;
531
509
  } | {
532
510
  name: string;
533
- label: string | {
534
- key: string;
535
- defaultValue?: string | undefined;
536
- params?: Record<string, string | number | boolean> | undefined;
537
- };
511
+ label: string;
538
512
  active: boolean;
539
513
  isDefault: boolean;
540
514
  version?: string | undefined;
541
- description?: string | {
542
- key: string;
543
- defaultValue?: string | undefined;
544
- params?: Record<string, string | number | boolean> | undefined;
545
- } | undefined;
515
+ description?: string | undefined;
546
516
  icon?: string | undefined;
547
517
  branding?: {
548
518
  primaryColor?: string | undefined;
@@ -552,19 +522,11 @@ declare class SchemaRegistry {
552
522
  navigation?: any[] | undefined;
553
523
  areas?: {
554
524
  id: string;
555
- label: string | {
556
- key: string;
557
- defaultValue?: string | undefined;
558
- params?: Record<string, string | number | boolean> | undefined;
559
- };
525
+ label: string;
560
526
  navigation: any[];
561
527
  icon?: string | undefined;
562
528
  order?: number | undefined;
563
- description?: string | {
564
- key: string;
565
- defaultValue?: string | undefined;
566
- params?: Record<string, string | number | boolean> | undefined;
567
- } | undefined;
529
+ description?: string | undefined;
568
530
  visible?: string | undefined;
569
531
  requiredPermissions?: string[] | undefined;
570
532
  }[] | undefined;
@@ -594,11 +556,7 @@ declare class SchemaRegistry {
594
556
  bottomNavItems?: string[] | undefined;
595
557
  } | undefined;
596
558
  aria?: {
597
- ariaLabel?: string | {
598
- key: string;
599
- defaultValue?: string | undefined;
600
- params?: Record<string, string | number | boolean> | undefined;
601
- } | undefined;
559
+ ariaLabel?: string | undefined;
602
560
  ariaDescribedBy?: string | undefined;
603
561
  role?: string | undefined;
604
562
  } | undefined;
@@ -606,7 +564,7 @@ declare class SchemaRegistry {
606
564
  manifest: {
607
565
  id: string;
608
566
  version: string;
609
- type: "theme" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
567
+ type: "theme" | "app" | "agent" | "driver" | "server" | "ui" | "module" | "objectql" | "plugin" | "gateway" | "adapter";
610
568
  name: string;
611
569
  namespace?: string | undefined;
612
570
  description?: string | undefined;
@@ -751,7 +709,7 @@ declare class SchemaRegistry {
751
709
  extensionPoints?: {
752
710
  id: string;
753
711
  name: string;
754
- type: "provider" | "action" | "widget" | "hook" | "transformer" | "validator" | "decorator";
712
+ type: "provider" | "action" | "hook" | "widget" | "transformer" | "validator" | "decorator";
755
713
  cardinality: "multiple" | "single";
756
714
  description?: string | undefined;
757
715
  contract?: {
@@ -931,7 +889,7 @@ declare class SchemaRegistry {
931
889
  } | {
932
890
  id: string;
933
891
  version: string;
934
- type: "theme" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
892
+ type: "theme" | "app" | "agent" | "driver" | "server" | "ui" | "module" | "objectql" | "plugin" | "gateway" | "adapter";
935
893
  name: string;
936
894
  namespace?: string | undefined;
937
895
  description?: string | undefined;
@@ -1076,7 +1034,7 @@ declare class SchemaRegistry {
1076
1034
  extensionPoints?: {
1077
1035
  id: string;
1078
1036
  name: string;
1079
- type: "provider" | "action" | "widget" | "hook" | "transformer" | "validator" | "decorator";
1037
+ type: "provider" | "action" | "hook" | "widget" | "transformer" | "validator" | "decorator";
1080
1038
  cardinality: "multiple" | "single";
1081
1039
  description?: string | undefined;
1082
1040
  contract?: {
@@ -1306,7 +1264,8 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1306
1264
  };
1307
1265
  services: Record<string, {
1308
1266
  enabled: boolean;
1309
- status: "degraded" | "stub" | "available" | "unavailable";
1267
+ status: "degraded" | "stub" | "available" | "registered" | "unavailable";
1268
+ handlerReady?: boolean | undefined;
1310
1269
  route?: string | undefined;
1311
1270
  provider?: string | undefined;
1312
1271
  version?: string | undefined;
@@ -1328,6 +1287,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1328
1287
  }>;
1329
1288
  getMetaItems(request: {
1330
1289
  type: string;
1290
+ packageId?: string;
1331
1291
  }): Promise<{
1332
1292
  type: string;
1333
1293
  items: unknown[];
@@ -1335,6 +1295,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1335
1295
  getMetaItem(request: {
1336
1296
  type: string;
1337
1297
  name: string;
1298
+ packageId?: string;
1338
1299
  }): Promise<{
1339
1300
  type: string;
1340
1301
  name: string;
@@ -1384,7 +1345,6 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1384
1345
  query?: any;
1385
1346
  }): Promise<{
1386
1347
  object: string;
1387
- value: any[];
1388
1348
  records: any[];
1389
1349
  total: number;
1390
1350
  hasMore: boolean;
@@ -1531,6 +1491,7 @@ declare class ObjectQL implements IDataEngine {
1531
1491
  private middlewares;
1532
1492
  private actions;
1533
1493
  private hostContext;
1494
+ private realtimeService?;
1534
1495
  constructor(hostContext?: Record<string, any>);
1535
1496
  /**
1536
1497
  * Service Status Report
@@ -1624,6 +1585,13 @@ declare class ObjectQL implements IDataEngine {
1624
1585
  * Register a new storage driver
1625
1586
  */
1626
1587
  registerDriver(driver: DriverInterface, isDefault?: boolean): void;
1588
+ /**
1589
+ * Set the realtime service for publishing data change events.
1590
+ * Should be called after kernel resolves the realtime service.
1591
+ *
1592
+ * @param service - An IRealtimeService instance for event publishing
1593
+ */
1594
+ setRealtimeService(service: IRealtimeService): void;
1627
1595
  /**
1628
1596
  * Helper to get object definition
1629
1597
  */
@@ -1919,6 +1887,30 @@ declare class ObjectQLPlugin implements Plugin {
1919
1887
  * Drivers that do not implement `syncSchema` are silently skipped.
1920
1888
  */
1921
1889
  private syncRegisteredSchemas;
1890
+ /**
1891
+ * Restore persisted metadata from the database (sys_metadata) on startup.
1892
+ *
1893
+ * Calls `protocol.loadMetaFromDb()` to bulk-load all active metadata
1894
+ * records (objects, views, apps, etc.) into the in-memory SchemaRegistry.
1895
+ * This closes the persistence loop so that user-created schemas survive
1896
+ * kernel cold starts and redeployments.
1897
+ *
1898
+ * Gracefully degrades when:
1899
+ * - The protocol service is unavailable (e.g., in-memory-only mode).
1900
+ * - `loadMetaFromDb` is not implemented by the protocol shim.
1901
+ * - The underlying driver/table does not exist yet (first-run scenario).
1902
+ */
1903
+ private restoreMetadataFromDb;
1904
+ /**
1905
+ * Bridge all SchemaRegistry objects to the metadata service.
1906
+ *
1907
+ * This ensures objects registered by plugins and loaded from sys_metadata
1908
+ * are visible to AI tools and other consumers that query IMetadataService.
1909
+ *
1910
+ * Runs after both restoreMetadataFromDb() and syncRegisteredSchemas() to
1911
+ * catch all objects in the SchemaRegistry regardless of their source.
1912
+ */
1913
+ private bridgeObjectsToMetadataService;
1922
1914
  /**
1923
1915
  * Load metadata from external metadata service into ObjectQL registry
1924
1916
  * This enables ObjectQL to use file-based or remote metadata