@posiwise/shared-components 0.0.189 → 0.0.192

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": "@posiwise/shared-components",
3
- "version": "0.0.189",
3
+ "version": "0.0.192",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.2.6",
6
6
  "@angular/core": "^21.2.6",
@@ -1,19 +1,19 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { TemplateRef, ElementRef, EventEmitter, Injector, ChangeDetectorRef, OnInit, OnDestroy, AfterViewInit, OnChanges, SimpleChanges, Type, ViewContainerRef, AfterContentInit, PipeTransform } from '@angular/core';
3
- import * as i32 from '@ng-bootstrap/ng-bootstrap';
3
+ import * as i33 from '@ng-bootstrap/ng-bootstrap';
4
4
  import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
5
5
  import { AppBaseComponent } from '@posiwise/app-base-component';
6
6
  import { MenuItem } from 'primeng/api';
7
7
  import moment from 'moment';
8
- import * as i42 from 'ngx-daterangepicker-material';
8
+ import * as i44 from 'ngx-daterangepicker-material';
9
9
  import { DaterangepickerDirective } from 'ngx-daterangepicker-material';
10
10
  import { SafeHtml, DomSanitizer } from '@angular/platform-browser';
11
11
  import { AdminService } from '@posiwise/admin-module-utils';
12
12
  import { User, Subscription } from '@posiwise/common-utilities';
13
- import * as i31 from '@angular/router';
13
+ import * as i32 from '@angular/router';
14
14
  import { Router } from '@angular/router';
15
15
  import { AppConfigService } from '@posiwise/app-config-service';
16
- import { AuthService, MCPFieldDiff, MCPOrchestratorService, LocalStorage, BrainSocketService, GroupService, SubscriptionService, DataService, NumberPickerService, FeatureFlagService, UserService, PermissionService, MainApiHttpService } from '@posiwise/common-services';
16
+ import { AuthService, MCPFieldDiff, BrainVoiceService, VoiceChatService, MCPOrchestratorService, LocalStorage, BrainSocketService, GroupService, SubscriptionService, DataService, NumberPickerService, FeatureFlagService, UserService, PermissionService, MainApiHttpService } from '@posiwise/common-services';
17
17
  import * as rxjs from 'rxjs';
18
18
  import { Observable } from 'rxjs';
19
19
  import { AppState } from '@posiwise/app-store';
@@ -23,19 +23,19 @@ import { UntypedFormGroup, UntypedFormBuilder, AbstractControl, ControlContainer
23
23
  import * as i7 from '@posiwise/app-loader';
24
24
  import * as i9 from '@posiwise/directives';
25
25
  import * as i8 from '@posiwise/core-transloco';
26
- import * as i33 from 'primeng/table';
27
- import * as i34 from 'primeng/tabs';
26
+ import * as i12 from 'primeng/tooltip';
27
+ import * as i35 from 'primeng/table';
28
+ import * as i36 from 'primeng/tabs';
28
29
  import * as i10 from 'primeng/button';
29
- import * as i36 from 'primeng/select';
30
- import * as i37 from 'primeng/multiselect';
30
+ import * as i38 from 'primeng/select';
31
+ import * as i39 from 'primeng/multiselect';
31
32
  import * as i13 from 'primeng/progressspinner';
32
33
  import * as i14 from 'primeng/autocomplete';
33
- import * as i40 from 'ngx-image-cropper';
34
- import * as i41 from 'ngx-ui-switch';
35
- import * as i43 from '@posiwise/pipes';
36
- import * as i44 from '@angular/common';
34
+ import * as i42 from 'ngx-image-cropper';
35
+ import * as i43 from 'ngx-ui-switch';
36
+ import * as i45 from '@posiwise/pipes';
37
+ import * as i46 from '@angular/common';
37
38
  import * as i16 from '@posiwise/utils';
38
- import * as i12 from 'primeng/tooltip';
39
39
  import * as i15 from '@angular/cdk/drag-drop';
40
40
 
41
41
  type ConfirmDialogTone = 'destructive' | 'neutral' | 'info';
@@ -537,6 +537,45 @@ interface ChatMessage {
537
537
  markdownEnabled?: boolean;
538
538
  }
539
539
 
540
+ /**
541
+ * Drives mic dictation for the Brain chat composer (#22).
542
+ *
543
+ * Toggles recording, folds the partial/final transcripts brain-api relays from
544
+ * Amazon Transcribe into the chat draft — preserving any text the user already
545
+ * typed — and surfaces a friendly status (listening / processing / error) so
546
+ * the user always knows what's happening. Lives outside the component to
547
+ * respect the helper-delegation pattern the chat component already uses
548
+ * (persistence, navigation, diff, etc.) and to keep that component small.
549
+ */
550
+ type DictationPhase = 'idle' | 'listening' | 'processing';
551
+ declare class BrainChatDictation {
552
+ private readonly voice;
553
+ private readonly getDraft;
554
+ private readonly setDraft;
555
+ private readonly changed;
556
+ phase: DictationPhase;
557
+ error: string | null;
558
+ private sub?;
559
+ /** Draft text captured at record-start + each finalized phrase, so live
560
+ * partials update without clobbering what the user already typed. */
561
+ private base;
562
+ constructor(voice: BrainVoiceService | undefined, getDraft: () => string, setDraft: (text: string) => void, changed: () => void);
563
+ /** Convenience for the template — kept for the pulsing-button class. */
564
+ get isRecording(): boolean;
565
+ /** Status text shown next to the mic; `null` when nothing to say. */
566
+ get statusMessage(): string | null;
567
+ /** Mic button handler: start if idle, stop if recording. While
568
+ * "processing" we ignore clicks until the server's final transcript
569
+ * lands. */
570
+ toggle(loading: boolean): void;
571
+ stop(): void;
572
+ /** Tear down with the host component (called from ngOnDestroy). */
573
+ dispose(): void;
574
+ private start;
575
+ private apply;
576
+ private fail;
577
+ }
578
+
540
579
  interface DiffRow {
541
580
  field: string;
542
581
  before: string;
@@ -544,6 +583,51 @@ interface DiffRow {
544
583
  }
545
584
  declare function diffRowsFrom(diff?: MCPFieldDiff | null): DiffRow[];
546
585
 
586
+ /**
587
+ * Voice Chat controller for the Brain chat composer (#58) — an explicit state
588
+ * machine over the WS relay so the user always sees the stage, including the
589
+ * 3–9s brain round-trip (`fetchingData`) that previously showed no feedback.
590
+ * Each state maps to a real signal: listening (start) → thinking (`text`
591
+ * role=user) → fetchingData (`tool_use`) → speaking (`speaking_changed`) →
592
+ * listening. `processingSpeech` awaits the relay's end-of-user-turn frame.
593
+ */
594
+ type VoiceChatState = 'idle' | 'listening' | 'processingSpeech' | 'thinking' | 'fetchingData' | 'speaking' | 'completed' | 'error';
595
+ /** Visual treatment hint for the template — keeps animation choice out of HTML. */
596
+ type VoiceChatVisual = 'idle' | 'pulse' | 'loader' | 'wave' | 'error';
597
+ declare class BrainChatVoiceChat {
598
+ private readonly voice;
599
+ private readonly changed;
600
+ state: VoiceChatState;
601
+ error: string | null;
602
+ available: boolean;
603
+ /** Latest user transcript (Sonic ASR) — enriches the `fetchingData` copy. */
604
+ transcript: string;
605
+ private sub?;
606
+ constructor(voice: VoiceChatService | undefined, changed: () => void);
607
+ get isActive(): boolean;
608
+ /** Back-compat for callers that only care whether audio is playing. */
609
+ get speaking(): boolean;
610
+ /** Animation family the template renders for the current state. */
611
+ get visual(): VoiceChatVisual;
612
+ /** Status text next to the button; `null` when there's nothing to say. */
613
+ get statusMessage(): string | null;
614
+ /** Resolve once on init so the button shows only when voice-api is reachable. */
615
+ resolveAvailability(): Promise<void>;
616
+ /** Voice Chat button handler: start if idle, stop if active. */
617
+ toggle(loading: boolean): void;
618
+ stop(): void;
619
+ /** Tear down with the host component (called from ngOnDestroy). */
620
+ dispose(): void;
621
+ private start;
622
+ private apply;
623
+ private onText;
624
+ private onSpeakingChanged;
625
+ /** Move forward only while a session is live (ignore stray events post-stop). */
626
+ private advanceTo;
627
+ private fail;
628
+ private setState;
629
+ }
630
+
547
631
  declare class PwBrainChatComponent implements OnInit, OnDestroy {
548
632
  private readonly orchestrator;
549
633
  private readonly localStorage;
@@ -553,6 +637,8 @@ declare class PwBrainChatComponent implements OnInit, OnDestroy {
553
637
  private readonly dynamicPageCtx;
554
638
  private readonly appConfigService?;
555
639
  private readonly brainSocket?;
640
+ private readonly brainVoice?;
641
+ private readonly voiceChatService?;
556
642
  messages: ChatMessage[];
557
643
  draft: string;
558
644
  loading: boolean;
@@ -572,8 +658,12 @@ declare class PwBrainChatComponent implements OnInit, OnDestroy {
572
658
  private streamSub?;
573
659
  private readonly destroy$;
574
660
  readonly diffRows: typeof diffRowsFrom;
661
+ /** Mic-to-text dictation controller (#22) — see template mic button. */
662
+ readonly dictation: BrainChatDictation;
663
+ /** Full-duplex Voice Chat controller (#58) — see template voice button. */
664
+ readonly voiceChat: BrainChatVoiceChat;
575
665
  private readonly threadRef?;
576
- constructor(orchestrator: MCPOrchestratorService, localStorage: LocalStorage, router: Router, cdr: ChangeDetectorRef, store: Store<AppState>, dynamicPageCtx: DynamicPageContextService, appConfigService?: AppConfigService, brainSocket?: BrainSocketService);
666
+ constructor(orchestrator: MCPOrchestratorService, localStorage: LocalStorage, router: Router, cdr: ChangeDetectorRef, store: Store<AppState>, dynamicPageCtx: DynamicPageContextService, appConfigService?: AppConfigService, brainSocket?: BrainSocketService, brainVoice?: BrainVoiceService, voiceChatService?: VoiceChatService);
577
667
  ngOnInit(): void;
578
668
  /**
579
669
  * Subscribe to brain-api's server→client push channel (#45). Each pushed
@@ -595,10 +685,27 @@ declare class PwBrainChatComponent implements OnInit, OnDestroy {
595
685
  private persistConversationId;
596
686
  private pushAssistant;
597
687
  private stick;
598
- static ɵfac: i0.ɵɵFactoryDeclaration<PwBrainChatComponent, [null, null, null, null, null, null, { optional: true; }, { optional: true; }]>;
688
+ static ɵfac: i0.ɵɵFactoryDeclaration<PwBrainChatComponent, [null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
599
689
  static ɵcmp: i0.ɵɵComponentDeclaration<PwBrainChatComponent, "pw-brain-chat", never, {}, {}, never, never, false, never>;
600
690
  }
601
691
 
692
+ /**
693
+ * Pending-action confirmation panel for the Brain chat bubble — risk badge,
694
+ * target tool, field-level diff, and Approve/Cancel controls. Extracted from
695
+ * the parent component template so `pw-brain-chat.component.html` stays under
696
+ * the C1 200-line cap. Emits back to the parent, which owns the /confirm call
697
+ * and message mutation (approve/cancel).
698
+ */
699
+ declare class PwBrainChatConfirmComponent {
700
+ pending: PendingConfirmation;
701
+ loading: boolean;
702
+ approveEvent: EventEmitter<void>;
703
+ cancelEvent: EventEmitter<void>;
704
+ readonly diffRows: typeof diffRowsFrom;
705
+ static ɵfac: i0.ɵɵFactoryDeclaration<PwBrainChatConfirmComponent, never>;
706
+ static ɵcmp: i0.ɵɵComponentDeclaration<PwBrainChatConfirmComponent, "pw-brain-chat-confirm", never, { "pending": { "alias": "pending"; "required": true; }; "loading": { "alias": "loading"; "required": false; }; }, { "approveEvent": "approveEvent"; "cancelEvent": "cancelEvent"; }, never, never, false, never>;
707
+ }
708
+
602
709
  declare class EntityGroupComponent extends AppBaseComponent implements OnInit, OnDestroy {
603
710
  private readonly groupService;
604
711
  private readonly subscriptionService;
@@ -1100,7 +1207,7 @@ declare class RecordsSummaryComponent {
1100
1207
 
1101
1208
  declare class ResourceSharedComponentsModule {
1102
1209
  static ɵfac: i0.ɵɵFactoryDeclaration<ResourceSharedComponentsModule, never>;
1103
- static ɵmod: i0.ɵɵNgModuleDeclaration<ResourceSharedComponentsModule, [typeof NoDataComponent, typeof InputContainerComponent, typeof CompletionBarComponent, typeof RecordsSummaryComponent], [typeof i44.CommonModule, typeof i6.FormsModule, typeof i6.ReactiveFormsModule, typeof i7.AppLoaderModule, typeof i8.CoreTranslocoModule, typeof i9.DirectivesModule, typeof i10.ButtonModule, typeof i32.NgbTooltipModule, typeof i12.TooltipModule, typeof i13.ProgressSpinnerModule, typeof i14.AutoCompleteModule, typeof i15.DragDropModule, typeof i16.FieldErrorDisplayModule, typeof i16.ProfileImageCropperModule, typeof i16.ResourceHeaderModule], [typeof i16.ProfileImageCropperModule, typeof i16.ResourceHeaderModule, typeof InputContainerComponent, typeof NoDataComponent, typeof CompletionBarComponent, typeof RecordsSummaryComponent, typeof i10.ButtonModule, typeof i15.DragDropModule, typeof i13.ProgressSpinnerModule, typeof i14.AutoCompleteModule, typeof i12.TooltipModule, typeof i16.FieldErrorDisplayModule]>;
1210
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ResourceSharedComponentsModule, [typeof NoDataComponent, typeof InputContainerComponent, typeof CompletionBarComponent, typeof RecordsSummaryComponent], [typeof i46.CommonModule, typeof i6.FormsModule, typeof i6.ReactiveFormsModule, typeof i7.AppLoaderModule, typeof i8.CoreTranslocoModule, typeof i9.DirectivesModule, typeof i10.ButtonModule, typeof i33.NgbTooltipModule, typeof i12.TooltipModule, typeof i13.ProgressSpinnerModule, typeof i14.AutoCompleteModule, typeof i15.DragDropModule, typeof i16.FieldErrorDisplayModule, typeof i16.ProfileImageCropperModule, typeof i16.ResourceHeaderModule], [typeof i16.ProfileImageCropperModule, typeof i16.ResourceHeaderModule, typeof InputContainerComponent, typeof NoDataComponent, typeof CompletionBarComponent, typeof RecordsSummaryComponent, typeof i10.ButtonModule, typeof i15.DragDropModule, typeof i13.ProgressSpinnerModule, typeof i14.AutoCompleteModule, typeof i12.TooltipModule, typeof i16.FieldErrorDisplayModule]>;
1104
1211
  static ɵinj: i0.ɵɵInjectorDeclaration<ResourceSharedComponentsModule>;
1105
1212
  }
1106
1213
 
@@ -1199,7 +1306,7 @@ declare class PwBrainChatThreadDirective {
1199
1306
 
1200
1307
  declare class SharedComponentsModule {
1201
1308
  static ɵfac: i0.ɵɵFactoryDeclaration<SharedComponentsModule, never>;
1202
- static ɵmod: i0.ɵɵNgModuleDeclaration<SharedComponentsModule, [typeof ConfirmDialogComponent, typeof PasswordValidationComponent, typeof PwTabsComponent, typeof DateRangePickerComponent, typeof PermissionTreeComponent, typeof PrivacyAndTosComponent, typeof PrivacyPolicyComponent, typeof TermsConditionsComponent, typeof SplashComponent, typeof AuthenticatorComponent, typeof ClearBitIconComponent, typeof ComingSoonComponent, typeof CollapsibleSidebarComponent, typeof PwBrainChatComponent, typeof EntityGroupComponent, typeof GroupsComponent, typeof GroupDefinitionComponent, typeof NumberPickerComponent, typeof HeaderComponent, typeof LandingPageFooterBComponent, typeof PwDynamicPageComponent, typeof SectionHeadingBlockComponent, typeof DividerBlockComponent, typeof StatCardBlockComponent, typeof DataTableBlockComponent, typeof ChartBlockComponent], [typeof i6.FormsModule, typeof i7.AppLoaderModule, typeof i6.ReactiveFormsModule, typeof i9.DirectivesModule, typeof i8.CoreTranslocoModule, typeof i31.RouterModule, typeof i32.NgbTooltipModule, typeof i32.NgbNavModule, typeof i32.NgbModalModule, typeof i33.TableModule, typeof i34.TabsModule, typeof i10.ButtonModule, typeof i36.SelectModule, typeof i37.MultiSelectModule, typeof i13.ProgressSpinnerModule, typeof i14.AutoCompleteModule, typeof i40.ImageCropperModule, typeof i41.UiSwitchModule, typeof i42.NgxDaterangepickerMd, typeof i43.PipesModule, typeof i44.CommonModule, typeof i44.NgIf, typeof i16.FieldErrorDisplayModule, typeof ResourceSharedComponentsModule, typeof CollapsibleSidebarTriggerDirective, typeof PwCookieBannerComponent, typeof SafeMarkdownPipe, typeof PwBrainChatThreadDirective], [typeof ConfirmDialogComponent, typeof PwCookieBannerComponent, typeof PasswordValidationComponent, typeof PwTabsComponent, typeof DateRangePickerComponent, typeof i32.NgbTooltipModule, typeof i32.NgbNavModule, typeof i32.NgbModalModule, typeof i33.TableModule, typeof i34.TabsModule, typeof i10.ButtonModule, typeof i36.SelectModule, typeof i37.MultiSelectModule, typeof i13.ProgressSpinnerModule, typeof i14.AutoCompleteModule, typeof i40.ImageCropperModule, typeof i41.UiSwitchModule, typeof i42.NgxDaterangepickerMd, typeof PermissionTreeComponent, typeof PrivacyAndTosComponent, typeof PrivacyPolicyComponent, typeof TermsConditionsComponent, typeof SplashComponent, typeof AuthenticatorComponent, typeof ClearBitIconComponent, typeof ComingSoonComponent, typeof CollapsibleSidebarComponent, typeof CollapsibleSidebarTriggerDirective, typeof PwBrainChatComponent, typeof EntityGroupComponent, typeof GroupsComponent, typeof GroupDefinitionComponent, typeof NumberPickerComponent, typeof HeaderComponent, typeof LandingPageFooterBComponent, typeof PwDynamicPageComponent, typeof i16.FieldErrorDisplayModule, typeof ResourceSharedComponentsModule]>;
1309
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SharedComponentsModule, [typeof ConfirmDialogComponent, typeof PasswordValidationComponent, typeof PwTabsComponent, typeof DateRangePickerComponent, typeof PermissionTreeComponent, typeof PrivacyAndTosComponent, typeof PrivacyPolicyComponent, typeof TermsConditionsComponent, typeof SplashComponent, typeof AuthenticatorComponent, typeof ClearBitIconComponent, typeof ComingSoonComponent, typeof CollapsibleSidebarComponent, typeof PwBrainChatComponent, typeof PwBrainChatConfirmComponent, typeof EntityGroupComponent, typeof GroupsComponent, typeof GroupDefinitionComponent, typeof NumberPickerComponent, typeof HeaderComponent, typeof LandingPageFooterBComponent, typeof PwDynamicPageComponent, typeof SectionHeadingBlockComponent, typeof DividerBlockComponent, typeof StatCardBlockComponent, typeof DataTableBlockComponent, typeof ChartBlockComponent], [typeof i6.FormsModule, typeof i7.AppLoaderModule, typeof i6.ReactiveFormsModule, typeof i9.DirectivesModule, typeof i8.CoreTranslocoModule, typeof i32.RouterModule, typeof i33.NgbTooltipModule, typeof i12.TooltipModule, typeof i33.NgbNavModule, typeof i33.NgbModalModule, typeof i35.TableModule, typeof i36.TabsModule, typeof i10.ButtonModule, typeof i38.SelectModule, typeof i39.MultiSelectModule, typeof i13.ProgressSpinnerModule, typeof i14.AutoCompleteModule, typeof i42.ImageCropperModule, typeof i43.UiSwitchModule, typeof i44.NgxDaterangepickerMd, typeof i45.PipesModule, typeof i46.CommonModule, typeof i46.NgIf, typeof i16.FieldErrorDisplayModule, typeof ResourceSharedComponentsModule, typeof CollapsibleSidebarTriggerDirective, typeof PwCookieBannerComponent, typeof SafeMarkdownPipe, typeof PwBrainChatThreadDirective], [typeof ConfirmDialogComponent, typeof PwCookieBannerComponent, typeof PasswordValidationComponent, typeof PwTabsComponent, typeof DateRangePickerComponent, typeof i33.NgbTooltipModule, typeof i12.TooltipModule, typeof i33.NgbNavModule, typeof i33.NgbModalModule, typeof i35.TableModule, typeof i36.TabsModule, typeof i10.ButtonModule, typeof i38.SelectModule, typeof i39.MultiSelectModule, typeof i13.ProgressSpinnerModule, typeof i14.AutoCompleteModule, typeof i42.ImageCropperModule, typeof i43.UiSwitchModule, typeof i44.NgxDaterangepickerMd, typeof PermissionTreeComponent, typeof PrivacyAndTosComponent, typeof PrivacyPolicyComponent, typeof TermsConditionsComponent, typeof SplashComponent, typeof AuthenticatorComponent, typeof ClearBitIconComponent, typeof ComingSoonComponent, typeof CollapsibleSidebarComponent, typeof CollapsibleSidebarTriggerDirective, typeof PwBrainChatComponent, typeof EntityGroupComponent, typeof GroupsComponent, typeof GroupDefinitionComponent, typeof NumberPickerComponent, typeof HeaderComponent, typeof LandingPageFooterBComponent, typeof PwDynamicPageComponent, typeof i16.FieldErrorDisplayModule, typeof ResourceSharedComponentsModule]>;
1203
1310
  static ɵinj: i0.ɵɵInjectorDeclaration<SharedComponentsModule>;
1204
1311
  }
1205
1312