@contractspec/example.integration-hub 3.5.4 → 3.6.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.
@@ -318,6 +318,38 @@ function useIntegrationData(projectId = "local-project") {
318
318
  };
319
319
  }
320
320
 
321
+ // src/ui/IntegrationHubChat.tsx
322
+ import { ChatWithSidebar } from "@contractspec/module.ai-chat";
323
+ import { jsxDEV } from "react/jsx-dev-runtime";
324
+ "use client";
325
+ var DEFAULT_SUGGESTIONS = [
326
+ "List my integrations",
327
+ "Show sync status",
328
+ "Add a connection"
329
+ ];
330
+ var DEFAULT_SYSTEM_PROMPT = `You are an Integration Hub assistant. Help users manage integrations, connections, and sync configurations. When asked about integrations, connections, or syncs, provide clear, actionable guidance.`;
331
+ function IntegrationHubChat({
332
+ proxyUrl = "/api/chat",
333
+ mcpServers,
334
+ thinkingLevel = "thinking",
335
+ suggestions = DEFAULT_SUGGESTIONS,
336
+ systemPrompt = DEFAULT_SYSTEM_PROMPT,
337
+ className
338
+ }) {
339
+ return /* @__PURE__ */ jsxDEV("div", {
340
+ className: className ?? "flex h-[500px] flex-col",
341
+ children: /* @__PURE__ */ jsxDEV(ChatWithSidebar, {
342
+ className: "flex-1",
343
+ systemPrompt,
344
+ proxyUrl,
345
+ mcpServers,
346
+ thinkingLevel,
347
+ suggestions,
348
+ showSuggestionsWhenEmpty: true
349
+ }, undefined, false, undefined, this)
350
+ }, undefined, false, undefined, this);
351
+ }
352
+
321
353
  // src/ui/IntegrationDashboard.tsx
322
354
  import { useState as useState2 } from "react";
323
355
  import {
@@ -327,7 +359,7 @@ import {
327
359
  StatCard,
328
360
  StatCardGroup
329
361
  } from "@contractspec/lib.design-system";
330
- import { jsxDEV } from "react/jsx-dev-runtime";
362
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
331
363
  "use client";
332
364
  var STATUS_COLORS = {
333
365
  ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
@@ -360,35 +392,36 @@ function IntegrationDashboard() {
360
392
  const tabs = [
361
393
  { id: "integrations", label: "Integrations", icon: "\uD83D\uDD0C" },
362
394
  { id: "connections", label: "Connections", icon: "\uD83D\uDD17" },
363
- { id: "syncs", label: "Sync Configs", icon: "\uD83D\uDD04" }
395
+ { id: "syncs", label: "Sync Configs", icon: "\uD83D\uDD04" },
396
+ { id: "chat", label: "Chat", icon: "\uD83D\uDCAC" }
364
397
  ];
365
398
  if (loading) {
366
- return /* @__PURE__ */ jsxDEV(LoaderBlock, {
399
+ return /* @__PURE__ */ jsxDEV2(LoaderBlock, {
367
400
  label: "Loading Integrations..."
368
401
  }, undefined, false, undefined, this);
369
402
  }
370
403
  if (error) {
371
- return /* @__PURE__ */ jsxDEV(ErrorState, {
404
+ return /* @__PURE__ */ jsxDEV2(ErrorState, {
372
405
  title: "Failed to load Integrations",
373
406
  description: error.message,
374
407
  onRetry: refetch,
375
408
  retryLabel: "Retry"
376
409
  }, undefined, false, undefined, this);
377
410
  }
378
- return /* @__PURE__ */ jsxDEV("div", {
411
+ return /* @__PURE__ */ jsxDEV2("div", {
379
412
  className: "space-y-6",
380
413
  children: [
381
- /* @__PURE__ */ jsxDEV("div", {
414
+ /* @__PURE__ */ jsxDEV2("div", {
382
415
  className: "flex items-center justify-between",
383
416
  children: [
384
- /* @__PURE__ */ jsxDEV("h2", {
417
+ /* @__PURE__ */ jsxDEV2("h2", {
385
418
  className: "text-2xl font-bold",
386
419
  children: "Integration Hub"
387
420
  }, undefined, false, undefined, this),
388
- /* @__PURE__ */ jsxDEV(Button, {
421
+ /* @__PURE__ */ jsxDEV2(Button, {
389
422
  onClick: () => alert("Add integration modal"),
390
423
  children: [
391
- /* @__PURE__ */ jsxDEV("span", {
424
+ /* @__PURE__ */ jsxDEV2("span", {
392
425
  className: "mr-2",
393
426
  children: "+"
394
427
  }, undefined, false, undefined, this),
@@ -397,66 +430,66 @@ function IntegrationDashboard() {
397
430
  }, undefined, true, undefined, this)
398
431
  ]
399
432
  }, undefined, true, undefined, this),
400
- /* @__PURE__ */ jsxDEV(StatCardGroup, {
433
+ /* @__PURE__ */ jsxDEV2(StatCardGroup, {
401
434
  children: [
402
- /* @__PURE__ */ jsxDEV(StatCard, {
435
+ /* @__PURE__ */ jsxDEV2(StatCard, {
403
436
  label: "Integrations",
404
437
  value: stats.totalIntegrations,
405
438
  hint: `${stats.activeIntegrations} active`
406
439
  }, undefined, false, undefined, this),
407
- /* @__PURE__ */ jsxDEV(StatCard, {
440
+ /* @__PURE__ */ jsxDEV2(StatCard, {
408
441
  label: "Connections",
409
442
  value: stats.totalConnections,
410
443
  hint: `${stats.connectedCount} connected`
411
444
  }, undefined, false, undefined, this),
412
- /* @__PURE__ */ jsxDEV(StatCard, {
445
+ /* @__PURE__ */ jsxDEV2(StatCard, {
413
446
  label: "Syncs",
414
447
  value: stats.totalSyncs,
415
448
  hint: `${stats.activeSyncs} active`
416
449
  }, undefined, false, undefined, this)
417
450
  ]
418
451
  }, undefined, true, undefined, this),
419
- /* @__PURE__ */ jsxDEV("nav", {
452
+ /* @__PURE__ */ jsxDEV2("nav", {
420
453
  className: "bg-muted flex gap-1 rounded-lg p-1",
421
454
  role: "tablist",
422
- children: tabs.map((tab) => /* @__PURE__ */ jsxDEV(Button, {
455
+ children: tabs.map((tab) => /* @__PURE__ */ jsxDEV2(Button, {
423
456
  type: "button",
424
457
  role: "tab",
425
458
  "aria-selected": activeTab === tab.id,
426
459
  onClick: () => setActiveTab(tab.id),
427
460
  className: `flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors ${activeTab === tab.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
428
461
  children: [
429
- /* @__PURE__ */ jsxDEV("span", {
462
+ /* @__PURE__ */ jsxDEV2("span", {
430
463
  children: tab.icon
431
464
  }, undefined, false, undefined, this),
432
465
  tab.label
433
466
  ]
434
467
  }, tab.id, true, undefined, this))
435
468
  }, undefined, false, undefined, this),
436
- /* @__PURE__ */ jsxDEV("div", {
469
+ /* @__PURE__ */ jsxDEV2("div", {
437
470
  className: "min-h-[400px]",
438
471
  role: "tabpanel",
439
472
  children: [
440
- activeTab === "integrations" && /* @__PURE__ */ jsxDEV("div", {
473
+ activeTab === "integrations" && /* @__PURE__ */ jsxDEV2("div", {
441
474
  className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
442
475
  children: [
443
- integrations.map((integration) => /* @__PURE__ */ jsxDEV("div", {
476
+ integrations.map((integration) => /* @__PURE__ */ jsxDEV2("div", {
444
477
  className: "border-border bg-card hover:bg-muted/50 cursor-pointer rounded-lg border p-4 transition-colors",
445
478
  children: [
446
- /* @__PURE__ */ jsxDEV("div", {
479
+ /* @__PURE__ */ jsxDEV2("div", {
447
480
  className: "mb-3 flex items-center gap-3",
448
481
  children: [
449
- /* @__PURE__ */ jsxDEV("span", {
482
+ /* @__PURE__ */ jsxDEV2("span", {
450
483
  className: "text-2xl",
451
484
  children: TYPE_ICONS[integration.type] ?? "⚙️"
452
485
  }, undefined, false, undefined, this),
453
- /* @__PURE__ */ jsxDEV("div", {
486
+ /* @__PURE__ */ jsxDEV2("div", {
454
487
  children: [
455
- /* @__PURE__ */ jsxDEV("h3", {
488
+ /* @__PURE__ */ jsxDEV2("h3", {
456
489
  className: "font-medium",
457
490
  children: integration.name
458
491
  }, undefined, false, undefined, this),
459
- /* @__PURE__ */ jsxDEV("p", {
492
+ /* @__PURE__ */ jsxDEV2("p", {
460
493
  className: "text-muted-foreground text-sm",
461
494
  children: integration.type
462
495
  }, undefined, false, undefined, this)
@@ -464,14 +497,14 @@ function IntegrationDashboard() {
464
497
  }, undefined, true, undefined, this)
465
498
  ]
466
499
  }, undefined, true, undefined, this),
467
- /* @__PURE__ */ jsxDEV("div", {
500
+ /* @__PURE__ */ jsxDEV2("div", {
468
501
  className: "flex items-center justify-between",
469
502
  children: [
470
- /* @__PURE__ */ jsxDEV("span", {
503
+ /* @__PURE__ */ jsxDEV2("span", {
471
504
  className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[integration.status] ?? ""}`,
472
505
  children: integration.status
473
506
  }, undefined, false, undefined, this),
474
- /* @__PURE__ */ jsxDEV("span", {
507
+ /* @__PURE__ */ jsxDEV2("span", {
475
508
  className: "text-muted-foreground text-xs",
476
509
  children: integration.createdAt.toLocaleDateString()
477
510
  }, undefined, false, undefined, this)
@@ -479,64 +512,64 @@ function IntegrationDashboard() {
479
512
  }, undefined, true, undefined, this)
480
513
  ]
481
514
  }, integration.id, true, undefined, this)),
482
- integrations.length === 0 && /* @__PURE__ */ jsxDEV("div", {
515
+ integrations.length === 0 && /* @__PURE__ */ jsxDEV2("div", {
483
516
  className: "text-muted-foreground col-span-full flex h-64 items-center justify-center",
484
517
  children: "No integrations configured"
485
518
  }, undefined, false, undefined, this)
486
519
  ]
487
520
  }, undefined, true, undefined, this),
488
- activeTab === "connections" && /* @__PURE__ */ jsxDEV("div", {
521
+ activeTab === "connections" && /* @__PURE__ */ jsxDEV2("div", {
489
522
  className: "border-border rounded-lg border",
490
- children: /* @__PURE__ */ jsxDEV("table", {
523
+ children: /* @__PURE__ */ jsxDEV2("table", {
491
524
  className: "w-full",
492
525
  children: [
493
- /* @__PURE__ */ jsxDEV("thead", {
526
+ /* @__PURE__ */ jsxDEV2("thead", {
494
527
  className: "border-border bg-muted/30 border-b",
495
- children: /* @__PURE__ */ jsxDEV("tr", {
528
+ children: /* @__PURE__ */ jsxDEV2("tr", {
496
529
  children: [
497
- /* @__PURE__ */ jsxDEV("th", {
530
+ /* @__PURE__ */ jsxDEV2("th", {
498
531
  className: "px-4 py-3 text-left text-sm font-medium",
499
532
  children: "Connection"
500
533
  }, undefined, false, undefined, this),
501
- /* @__PURE__ */ jsxDEV("th", {
534
+ /* @__PURE__ */ jsxDEV2("th", {
502
535
  className: "px-4 py-3 text-left text-sm font-medium",
503
536
  children: "Status"
504
537
  }, undefined, false, undefined, this),
505
- /* @__PURE__ */ jsxDEV("th", {
538
+ /* @__PURE__ */ jsxDEV2("th", {
506
539
  className: "px-4 py-3 text-left text-sm font-medium",
507
540
  children: "Last Sync"
508
541
  }, undefined, false, undefined, this)
509
542
  ]
510
543
  }, undefined, true, undefined, this)
511
544
  }, undefined, false, undefined, this),
512
- /* @__PURE__ */ jsxDEV("tbody", {
545
+ /* @__PURE__ */ jsxDEV2("tbody", {
513
546
  className: "divide-border divide-y",
514
547
  children: [
515
- connections.map((conn) => /* @__PURE__ */ jsxDEV("tr", {
548
+ connections.map((conn) => /* @__PURE__ */ jsxDEV2("tr", {
516
549
  className: "hover:bg-muted/50",
517
550
  children: [
518
- /* @__PURE__ */ jsxDEV("td", {
551
+ /* @__PURE__ */ jsxDEV2("td", {
519
552
  className: "px-4 py-3",
520
- children: /* @__PURE__ */ jsxDEV("div", {
553
+ children: /* @__PURE__ */ jsxDEV2("div", {
521
554
  className: "font-medium",
522
555
  children: conn.name
523
556
  }, undefined, false, undefined, this)
524
557
  }, undefined, false, undefined, this),
525
- /* @__PURE__ */ jsxDEV("td", {
558
+ /* @__PURE__ */ jsxDEV2("td", {
526
559
  className: "px-4 py-3",
527
- children: /* @__PURE__ */ jsxDEV("span", {
560
+ children: /* @__PURE__ */ jsxDEV2("span", {
528
561
  className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[conn.status] ?? ""}`,
529
562
  children: conn.status
530
563
  }, undefined, false, undefined, this)
531
564
  }, undefined, false, undefined, this),
532
- /* @__PURE__ */ jsxDEV("td", {
565
+ /* @__PURE__ */ jsxDEV2("td", {
533
566
  className: "text-muted-foreground px-4 py-3 text-sm",
534
567
  children: conn.lastSyncAt?.toLocaleString() ?? "Never"
535
568
  }, undefined, false, undefined, this)
536
569
  ]
537
570
  }, conn.id, true, undefined, this)),
538
- connections.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
539
- children: /* @__PURE__ */ jsxDEV("td", {
571
+ connections.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
572
+ children: /* @__PURE__ */ jsxDEV2("td", {
540
573
  colSpan: 3,
541
574
  className: "text-muted-foreground px-4 py-8 text-center",
542
575
  children: "No connections found"
@@ -547,48 +580,58 @@ function IntegrationDashboard() {
547
580
  ]
548
581
  }, undefined, true, undefined, this)
549
582
  }, undefined, false, undefined, this),
550
- activeTab === "syncs" && /* @__PURE__ */ jsxDEV("div", {
583
+ activeTab === "chat" && /* @__PURE__ */ jsxDEV2(IntegrationHubChat, {
584
+ proxyUrl: "/api/chat",
585
+ thinkingLevel: "thinking",
586
+ suggestions: [
587
+ "List my integrations",
588
+ "Show sync status",
589
+ "Add a connection"
590
+ ],
591
+ className: "min-h-[400px]"
592
+ }, undefined, false, undefined, this),
593
+ activeTab === "syncs" && /* @__PURE__ */ jsxDEV2("div", {
551
594
  className: "border-border rounded-lg border",
552
- children: /* @__PURE__ */ jsxDEV("table", {
595
+ children: /* @__PURE__ */ jsxDEV2("table", {
553
596
  className: "w-full",
554
597
  children: [
555
- /* @__PURE__ */ jsxDEV("thead", {
598
+ /* @__PURE__ */ jsxDEV2("thead", {
556
599
  className: "border-border bg-muted/30 border-b",
557
- children: /* @__PURE__ */ jsxDEV("tr", {
600
+ children: /* @__PURE__ */ jsxDEV2("tr", {
558
601
  children: [
559
- /* @__PURE__ */ jsxDEV("th", {
602
+ /* @__PURE__ */ jsxDEV2("th", {
560
603
  className: "px-4 py-3 text-left text-sm font-medium",
561
604
  children: "Sync Config"
562
605
  }, undefined, false, undefined, this),
563
- /* @__PURE__ */ jsxDEV("th", {
606
+ /* @__PURE__ */ jsxDEV2("th", {
564
607
  className: "px-4 py-3 text-left text-sm font-medium",
565
608
  children: "Frequency"
566
609
  }, undefined, false, undefined, this),
567
- /* @__PURE__ */ jsxDEV("th", {
610
+ /* @__PURE__ */ jsxDEV2("th", {
568
611
  className: "px-4 py-3 text-left text-sm font-medium",
569
612
  children: "Status"
570
613
  }, undefined, false, undefined, this),
571
- /* @__PURE__ */ jsxDEV("th", {
614
+ /* @__PURE__ */ jsxDEV2("th", {
572
615
  className: "px-4 py-3 text-left text-sm font-medium",
573
616
  children: "Records"
574
617
  }, undefined, false, undefined, this)
575
618
  ]
576
619
  }, undefined, true, undefined, this)
577
620
  }, undefined, false, undefined, this),
578
- /* @__PURE__ */ jsxDEV("tbody", {
621
+ /* @__PURE__ */ jsxDEV2("tbody", {
579
622
  className: "divide-border divide-y",
580
623
  children: [
581
- syncConfigs.map((sync) => /* @__PURE__ */ jsxDEV("tr", {
624
+ syncConfigs.map((sync) => /* @__PURE__ */ jsxDEV2("tr", {
582
625
  className: "hover:bg-muted/50",
583
626
  children: [
584
- /* @__PURE__ */ jsxDEV("td", {
627
+ /* @__PURE__ */ jsxDEV2("td", {
585
628
  className: "px-4 py-3",
586
629
  children: [
587
- /* @__PURE__ */ jsxDEV("div", {
630
+ /* @__PURE__ */ jsxDEV2("div", {
588
631
  className: "font-medium",
589
632
  children: sync.name
590
633
  }, undefined, false, undefined, this),
591
- /* @__PURE__ */ jsxDEV("div", {
634
+ /* @__PURE__ */ jsxDEV2("div", {
592
635
  className: "text-muted-foreground text-sm",
593
636
  children: [
594
637
  sync.sourceEntity,
@@ -598,25 +641,25 @@ function IntegrationDashboard() {
598
641
  }, undefined, true, undefined, this)
599
642
  ]
600
643
  }, undefined, true, undefined, this),
601
- /* @__PURE__ */ jsxDEV("td", {
644
+ /* @__PURE__ */ jsxDEV2("td", {
602
645
  className: "px-4 py-3 text-sm",
603
646
  children: sync.frequency
604
647
  }, undefined, false, undefined, this),
605
- /* @__PURE__ */ jsxDEV("td", {
648
+ /* @__PURE__ */ jsxDEV2("td", {
606
649
  className: "px-4 py-3",
607
- children: /* @__PURE__ */ jsxDEV("span", {
650
+ children: /* @__PURE__ */ jsxDEV2("span", {
608
651
  className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[sync.status] ?? ""}`,
609
652
  children: sync.status
610
653
  }, undefined, false, undefined, this)
611
654
  }, undefined, false, undefined, this),
612
- /* @__PURE__ */ jsxDEV("td", {
655
+ /* @__PURE__ */ jsxDEV2("td", {
613
656
  className: "text-muted-foreground px-4 py-3 text-sm",
614
657
  children: sync.recordsSynced.toLocaleString()
615
658
  }, undefined, false, undefined, this)
616
659
  ]
617
660
  }, sync.id, true, undefined, this)),
618
- syncConfigs.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
619
- children: /* @__PURE__ */ jsxDEV("td", {
661
+ syncConfigs.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
662
+ children: /* @__PURE__ */ jsxDEV2("td", {
620
663
  colSpan: 4,
621
664
  className: "text-muted-foreground px-4 py-8 text-center",
622
665
  children: "No sync configurations found"
@@ -640,5 +683,6 @@ export {
640
683
  syncConfigMarkdownRenderer,
641
684
  integrationDashboardMarkdownRenderer,
642
685
  connectionListMarkdownRenderer,
686
+ IntegrationHubChat,
643
687
  IntegrationDashboard
644
688
  };