@object-ui/types 3.1.5 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/types",
3
- "version": "3.1.5",
3
+ "version": "3.3.0",
4
4
  "description": "Pure TypeScript type definitions for Object UI - The Protocol Layer",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -76,11 +76,11 @@
76
76
  "directory": "packages/types"
77
77
  },
78
78
  "dependencies": {
79
- "@objectstack/spec": "^3.3.0",
79
+ "@objectstack/spec": "^4.0.3",
80
80
  "zod": "^4.3.6"
81
81
  },
82
82
  "devDependencies": {
83
- "typescript": "^5.9.3"
83
+ "typescript": "^6.0.2"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "tsc",
package/src/app.ts CHANGED
@@ -55,8 +55,8 @@ export interface NavigationItem {
55
55
  /** Navigation item type */
56
56
  type: NavigationItemType;
57
57
 
58
- /** Display label (plain string or I18nLabel object for internationalization) */
59
- label: string | { key: string; defaultValue?: string; params?: Record<string, any> };
58
+ /** Display label (plain string per @objectstack/spec v4 protocol) */
59
+ label: string;
60
60
 
61
61
  /** Icon name (Lucide) */
62
62
  icon?: string;
@@ -129,8 +129,8 @@ export interface NavigationArea {
129
129
  /** Unique identifier */
130
130
  id: string;
131
131
 
132
- /** Display label (plain string or I18nLabel object for internationalization) */
133
- label: string | { key: string; defaultValue?: string; params?: Record<string, any> };
132
+ /** Display label (plain string per @objectstack/spec v4 protocol) */
133
+ label: string;
134
134
 
135
135
  /** Icon name (Lucide) */
136
136
  icon?: string;
package/src/complex.ts CHANGED
@@ -401,7 +401,7 @@ export interface ChatMessage {
401
401
  /**
402
402
  * Message role
403
403
  */
404
- role: 'user' | 'assistant' | 'system';
404
+ role: 'user' | 'assistant' | 'system' | 'tool';
405
405
  /**
406
406
  * Message content
407
407
  */
@@ -414,6 +414,40 @@ export interface ChatMessage {
414
414
  * Message metadata
415
415
  */
416
416
  metadata?: any;
417
+ /**
418
+ * Whether this message is currently being streamed
419
+ */
420
+ streaming?: boolean;
421
+ /**
422
+ * Tool invocations associated with this message (for tool-calling flows)
423
+ */
424
+ toolInvocations?: ChatToolInvocation[];
425
+ }
426
+
427
+ /**
428
+ * Represents a tool invocation from an AI assistant message
429
+ */
430
+ export interface ChatToolInvocation {
431
+ /**
432
+ * Unique tool call identifier
433
+ */
434
+ toolCallId: string;
435
+ /**
436
+ * Name of the tool being invoked
437
+ */
438
+ toolName: string;
439
+ /**
440
+ * Arguments passed to the tool
441
+ */
442
+ args: Record<string, unknown>;
443
+ /**
444
+ * Result of the tool invocation (set when complete)
445
+ */
446
+ result?: unknown;
447
+ /**
448
+ * Tool invocation state
449
+ */
450
+ state: 'partial-call' | 'call' | 'result';
417
451
  }
418
452
 
419
453
  /**
@@ -460,6 +494,106 @@ export interface ChatbotSchema extends BaseSchema {
460
494
  * Chat height
461
495
  */
462
496
  height?: string | number;
497
+
498
+ // --- AI / service-ai integration fields ---
499
+
500
+ /**
501
+ * Backend API endpoint for chat (e.g., '/api/v1/ai/chat').
502
+ * When set, the chatbot uses streaming SSE via the vercel/ai SDK.
503
+ * When not set, the chatbot falls back to local auto-response mode (legacy/demo).
504
+ */
505
+ api?: string;
506
+ /**
507
+ * Conversation ID for multi-turn context.
508
+ * Sent to the backend as an `x-conversation-id` HTTP header.
509
+ */
510
+ conversationId?: string;
511
+ /**
512
+ * System prompt to configure assistant behavior.
513
+ */
514
+ systemPrompt?: string;
515
+ /**
516
+ * AI model identifier (e.g., 'gpt-4o', 'claude-3-opus').
517
+ */
518
+ model?: string;
519
+ /**
520
+ * Whether streaming is enabled for AI responses.
521
+ * @default true
522
+ */
523
+ streamingEnabled?: boolean;
524
+ /**
525
+ * Additional headers to send with API requests (e.g., auth tokens).
526
+ */
527
+ headers?: Record<string, string>;
528
+ /**
529
+ * Additional body parameters to include with each API request.
530
+ */
531
+ requestBody?: Record<string, unknown>;
532
+ /**
533
+ * Maximum number of tool-calling round-trips per user message.
534
+ * @default 5
535
+ */
536
+ maxToolRoundtrips?: number;
537
+ /**
538
+ * Callback when an error occurs during streaming or API calls.
539
+ */
540
+ onError?: (error: Error) => void;
541
+
542
+ // --- Floating / FAB display mode ---
543
+
544
+ /**
545
+ * Display mode for the chatbot.
546
+ * - `'inline'` (default): Embedded in the page flow.
547
+ * - `'floating'`: Rendered as a floating action button (FAB) that opens a panel overlay.
548
+ */
549
+ displayMode?: 'inline' | 'floating';
550
+
551
+ /**
552
+ * Configuration for floating display mode.
553
+ * Only used when `displayMode` is `'floating'`.
554
+ */
555
+ floatingConfig?: FloatingChatbotConfig;
556
+ }
557
+
558
+ /**
559
+ * Configuration for the floating chatbot FAB widget.
560
+ */
561
+ export interface FloatingChatbotConfig {
562
+ /**
563
+ * Position of the FAB trigger button.
564
+ * @default 'bottom-right'
565
+ */
566
+ position?: 'bottom-right' | 'bottom-left';
567
+ /**
568
+ * Whether the panel is open by default on mount.
569
+ * @default false
570
+ */
571
+ defaultOpen?: boolean;
572
+ /**
573
+ * Width of the floating panel.
574
+ * @default 400
575
+ */
576
+ panelWidth?: number;
577
+ /**
578
+ * Height of the floating panel.
579
+ * @default 520
580
+ */
581
+ panelHeight?: number;
582
+ /**
583
+ * Title displayed in the panel header.
584
+ * @default 'Chat'
585
+ */
586
+ title?: string;
587
+ /**
588
+ * Custom icon name for the FAB trigger (Lucide icon name).
589
+ * @default 'MessageCircle'
590
+ */
591
+ triggerIcon?: string;
592
+ /**
593
+ * Custom size for the FAB trigger button in pixels.
594
+ * @default 56
595
+ */
596
+ triggerSize?: number;
463
597
  }
464
598
 
465
599
  /**
package/src/data.ts CHANGED
@@ -322,6 +322,42 @@ export interface DataSource<T = any> {
322
322
  * @returns Promise resolving to aggregated results
323
323
  */
324
324
  aggregate?(resource: string, params: AggregateParams): Promise<AggregateResult[]>;
325
+
326
+ /**
327
+ * Subscribe to mutation events.
328
+ * When implemented, data-bound views (ListView, ObjectView) can auto-refresh
329
+ * after any create/update/delete operation on relevant resources.
330
+ *
331
+ * @param callback - Invoked after each successful mutation
332
+ * @returns Unsubscribe function to remove the listener
333
+ *
334
+ * @example
335
+ * ```typescript
336
+ * const unsub = dataSource.onMutation?.((event) => {
337
+ * if (event.resource === 'contacts') {
338
+ * refreshList();
339
+ * }
340
+ * });
341
+ * // later…
342
+ * unsub?.();
343
+ * ```
344
+ */
345
+ onMutation?(callback: (event: MutationEvent<T>) => void): () => void;
346
+ }
347
+
348
+ /**
349
+ * Describes a mutation that occurred on a DataSource.
350
+ * Emitted by `DataSource.onMutation` subscribers after create/update/delete.
351
+ */
352
+ export interface MutationEvent<T = any> {
353
+ /** The type of mutation that occurred */
354
+ type: 'create' | 'update' | 'delete';
355
+ /** The resource (object) name that was mutated */
356
+ resource: string;
357
+ /** The affected record (present for create/update) */
358
+ record?: T;
359
+ /** The ID of the affected record (present for update/delete) */
360
+ id?: string | number;
325
361
  }
326
362
 
327
363
  /**
package/src/designer.ts CHANGED
@@ -632,6 +632,172 @@ export interface DashboardConfig {
632
632
  [key: string]: any;
633
633
  }
634
634
 
635
+ // ============================================================================
636
+ // Object Manager (Enterprise Metadata Management)
637
+ // ============================================================================
638
+
639
+ /** Object definition for the Object Manager */
640
+ export interface ObjectDefinition {
641
+ /** Unique object identifier */
642
+ id: string;
643
+ /** API name (snake_case) */
644
+ name: string;
645
+ /** Display label */
646
+ label: string;
647
+ /** Plural display label */
648
+ pluralLabel?: string;
649
+ /** Object description */
650
+ description?: string;
651
+ /** Icon name (Lucide icon) */
652
+ icon?: string;
653
+ /** Grouping/category */
654
+ group?: string;
655
+ /** Sort order within group */
656
+ sortOrder?: number;
657
+ /** Whether this is a system object (non-deletable) */
658
+ isSystem?: boolean;
659
+ /** Whether this object is enabled/active */
660
+ enabled?: boolean;
661
+ /** Field count (read-only, for display) */
662
+ fieldCount?: number;
663
+ /** Relationships to other objects */
664
+ relationships?: ObjectDefinitionRelationship[];
665
+ }
666
+
667
+ /** Relationship reference for Object Manager */
668
+ export interface ObjectDefinitionRelationship {
669
+ /** Related object name */
670
+ relatedObject: string;
671
+ /** Relationship type */
672
+ type: 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many';
673
+ /** Relationship label */
674
+ label?: string;
675
+ /** Foreign key field */
676
+ foreignKey?: string;
677
+ }
678
+
679
+ /** Object Manager component schema */
680
+ export interface ObjectManagerSchema extends BaseSchema {
681
+ type: 'object-manager';
682
+ /** List of object definitions */
683
+ objects: ObjectDefinition[];
684
+ /** Read-only mode */
685
+ readOnly?: boolean;
686
+ /** Show system objects */
687
+ showSystemObjects?: boolean;
688
+ }
689
+
690
+ // ============================================================================
691
+ // Field Designer (Field Configuration Wizard)
692
+ // ============================================================================
693
+
694
+ /** Supported field types in the Field Designer */
695
+ export type DesignerFieldType =
696
+ | 'text'
697
+ | 'textarea'
698
+ | 'number'
699
+ | 'boolean'
700
+ | 'date'
701
+ | 'datetime'
702
+ | 'time'
703
+ | 'select'
704
+ | 'email'
705
+ | 'phone'
706
+ | 'url'
707
+ | 'password'
708
+ | 'currency'
709
+ | 'percent'
710
+ | 'lookup'
711
+ | 'formula'
712
+ | 'autonumber'
713
+ | 'file'
714
+ | 'image'
715
+ | 'markdown'
716
+ | 'html'
717
+ | 'color'
718
+ | 'code'
719
+ | 'location'
720
+ | 'address'
721
+ | 'rating'
722
+ | 'slider';
723
+
724
+ /** Select option for field designer */
725
+ export interface DesignerFieldOption {
726
+ /** Option label */
727
+ label: string;
728
+ /** Option value */
729
+ value: string;
730
+ /** Option color (for badge display) */
731
+ color?: string;
732
+ }
733
+
734
+ /** Validation rule for field designer */
735
+ export interface DesignerValidationRule {
736
+ /** Rule type */
737
+ type: 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'custom';
738
+ /** Rule value */
739
+ value: string | number;
740
+ /** Error message */
741
+ message?: string;
742
+ }
743
+
744
+ /** Field definition for the Field Designer */
745
+ export interface DesignerFieldDefinition {
746
+ /** Unique field identifier */
747
+ id: string;
748
+ /** API name (snake_case) */
749
+ name: string;
750
+ /** Display label */
751
+ label: string;
752
+ /** Field type */
753
+ type: DesignerFieldType;
754
+ /** Field group/section */
755
+ group?: string;
756
+ /** Sort order within group */
757
+ sortOrder?: number;
758
+ /** Field description / help text */
759
+ description?: string;
760
+ /** Whether field is required */
761
+ required?: boolean;
762
+ /** Whether field is unique */
763
+ unique?: boolean;
764
+ /** Whether field is read-only */
765
+ readonly?: boolean;
766
+ /** Whether field is hidden */
767
+ hidden?: boolean;
768
+ /** Default value */
769
+ defaultValue?: unknown;
770
+ /** Placeholder text */
771
+ placeholder?: string;
772
+ /** Select options (for select type) */
773
+ options?: DesignerFieldOption[];
774
+ /** Validation rules */
775
+ validationRules?: DesignerValidationRule[];
776
+ /** Whether this is a system field */
777
+ isSystem?: boolean;
778
+ /** External ID flag */
779
+ externalId?: boolean;
780
+ /** Track field history */
781
+ trackHistory?: boolean;
782
+ /** Whether field is indexed */
783
+ indexed?: boolean;
784
+ /** Lookup reference object (for lookup type) */
785
+ referenceTo?: string;
786
+ /** Formula expression (for formula type) */
787
+ formula?: string;
788
+ }
789
+
790
+ /** Field Designer component schema */
791
+ export interface FieldDesignerSchema extends BaseSchema {
792
+ type: 'field-designer';
793
+ /** Object name this field designer belongs to */
794
+ objectName: string;
795
+ /** List of field definitions */
796
+ fields: DesignerFieldDefinition[];
797
+ /** Read-only mode */
798
+ readOnly?: boolean;
799
+ }
800
+
635
801
  // ============================================================================
636
802
  // Multi-User Collaborative Editing
637
803
  // ============================================================================
package/src/index.ts CHANGED
@@ -249,7 +249,9 @@ export type {
249
249
  DashboardWidgetSchema,
250
250
  DashboardSchema,
251
251
  ChatMessage,
252
+ ChatToolInvocation,
252
253
  ChatbotSchema,
254
+ FloatingChatbotConfig,
253
255
  ComplexSchema,
254
256
  } from './complex';
255
257
 
@@ -268,6 +270,7 @@ export type {
268
270
  FileUploadResult,
269
271
  AggregateParams,
270
272
  AggregateResult,
273
+ MutationEvent,
271
274
  } from './data';
272
275
 
273
276
  // ============================================================================
@@ -567,6 +570,14 @@ export type {
567
570
  DashboardWidgetType,
568
571
  DashboardWidgetConfig,
569
572
  DashboardConfig,
573
+ ObjectDefinition,
574
+ ObjectDefinitionRelationship,
575
+ ObjectManagerSchema,
576
+ DesignerFieldType,
577
+ DesignerFieldOption,
578
+ DesignerValidationRule,
579
+ DesignerFieldDefinition,
580
+ FieldDesignerSchema,
570
581
  } from './designer';
571
582
 
572
583
  export {
package/src/objectql.ts CHANGED
@@ -1755,6 +1755,14 @@ export interface ListViewSchema extends BaseSchema {
1755
1755
  * @default false
1756
1756
  */
1757
1757
  allowPrinting?: boolean;
1758
+
1759
+ /**
1760
+ * External refresh trigger.
1761
+ * Increment this value to force the ListView to re-fetch data.
1762
+ * Used by parent components (e.g., ObjectView) to signal that a mutation
1763
+ * (create/update/delete) has occurred and the list should refresh.
1764
+ */
1765
+ refreshTrigger?: number;
1758
1766
  }
1759
1767
  export interface ObjectMapSchema extends BaseSchema {
1760
1768
  type: 'object-map';
@@ -192,12 +192,22 @@ export const CarouselSchema = BaseSchema.extend({
192
192
  /**
193
193
  * Chat Message Schema
194
194
  */
195
+ export const ChatToolInvocationSchema = z.object({
196
+ toolCallId: z.string().describe('Unique tool call identifier'),
197
+ toolName: z.string().describe('Name of the tool'),
198
+ args: z.record(z.string(), z.unknown()).describe('Tool arguments'),
199
+ result: z.unknown().optional().describe('Tool result'),
200
+ state: z.enum(['partial-call', 'call', 'result']).describe('Tool invocation state'),
201
+ });
202
+
195
203
  export const ChatMessageSchema = z.object({
196
204
  id: z.string().describe('Message ID'),
197
- role: z.enum(['user', 'assistant', 'system']).describe('Message role'),
205
+ role: z.enum(['user', 'assistant', 'system', 'tool']).describe('Message role'),
198
206
  content: z.string().describe('Message content'),
199
207
  timestamp: z.union([z.string(), z.date()]).optional().describe('Message timestamp'),
200
208
  metadata: z.record(z.string(), z.any()).optional().describe('Custom metadata'),
209
+ streaming: z.boolean().optional().describe('Whether message is being streamed'),
210
+ toolInvocations: z.array(ChatToolInvocationSchema).optional().describe('Tool invocations'),
201
211
  });
202
212
 
203
213
  /**
@@ -214,6 +224,15 @@ export const ChatbotSchema = BaseSchema.extend({
214
224
  assistantAvatar: z.string().optional().describe('Assistant avatar URL'),
215
225
  markdown: z.boolean().optional().describe('Enable markdown rendering'),
216
226
  height: z.union([z.string(), z.number()]).optional().describe('Chatbot height'),
227
+ api: z.string().optional().describe('Backend API endpoint for streaming chat'),
228
+ conversationId: z.string().optional().describe('Conversation ID for multi-turn context'),
229
+ systemPrompt: z.string().optional().describe('System prompt for assistant behavior'),
230
+ model: z.string().optional().describe('AI model identifier'),
231
+ streamingEnabled: z.boolean().optional().describe('Enable streaming responses'),
232
+ headers: z.record(z.string(), z.string()).optional().describe('Additional API headers'),
233
+ body: z.record(z.string(), z.unknown()).optional().describe('Additional API body params'),
234
+ maxToolRoundtrips: z.number().optional().describe('Max tool-calling round-trips'),
235
+ onError: z.function().optional().describe('Error callback'),
217
236
  });
218
237
 
219
238
  /**
@@ -225,6 +225,7 @@ export {
225
225
  FilterBuilderSchema,
226
226
  CarouselItemSchema,
227
227
  CarouselSchema,
228
+ ChatToolInvocationSchema,
228
229
  ChatMessageSchema,
229
230
  ChatbotSchema,
230
231
  DashboardWidgetLayoutSchema,