@posiwise/shared-components 0.0.202 → 0.0.204
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,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Type, OnInit, AfterViewInit, OnDestroy, ChangeDetectorRef, TemplateRef, ElementRef, EventEmitter, Injector, OnChanges, SimpleChanges, ViewContainerRef, AfterContentInit, PipeTransform } from '@angular/core';
|
|
2
|
+
import { Type, OnInit, AfterViewInit, OnDestroy, ChangeDetectorRef, TemplateRef, ElementRef, EventEmitter, Injector, OnChanges, SimpleChanges, ViewContainerRef, AfterContentInit, PipeTransform, InjectionToken } from '@angular/core';
|
|
3
3
|
import * as i35 from '@angular/router';
|
|
4
4
|
import { Router } from '@angular/router';
|
|
5
5
|
import { AppConfigService } from '@posiwise/app-config-service';
|
|
6
|
-
import { NavEntry, NavigationIndexService, DashboardService, RecentPagesService, CustomToastService, AuthService, MCPFieldDiff, BrainVoiceService, VoiceChatService, MCPOrchestratorService, LocalStorage, BrainSocketService, GroupService, SubscriptionService, DataService, NumberPickerService, FeatureFlagService, UserService, PermissionService, MainApiHttpService } from '@posiwise/common-services';
|
|
6
|
+
import { NavEntry, NavigationIndexService, DashboardService, RecentPagesService, CustomToastService, AuthService, MCPFieldDiff, DirectUploadService, BaseHttpService, MCPUploadCapability, BrainVoiceService, VoiceChatService, MCPOrchestratorService, LocalStorage, BrainSocketService, GroupService, SubscriptionService, DataService, NumberPickerService, FeatureFlagService, UserService, PermissionService, MainApiHttpService } from '@posiwise/common-services';
|
|
7
7
|
export { NavEntry } from '@posiwise/common-services';
|
|
8
8
|
import { TranslocoService } from '@jsverse/transloco';
|
|
9
9
|
import * as rxjs from 'rxjs';
|
|
10
|
-
import { Observable } from 'rxjs';
|
|
10
|
+
import { Observable, Subject } from 'rxjs';
|
|
11
11
|
import * as i36 from '@ng-bootstrap/ng-bootstrap';
|
|
12
12
|
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
13
13
|
import { AppBaseComponent } from '@posiwise/app-base-component';
|
|
@@ -721,6 +721,82 @@ interface ChatMessage {
|
|
|
721
721
|
* renders a "Documented on: {sourcePage}" provenance chip. Absent → no chip. */
|
|
722
722
|
sourcePage?: string | null;
|
|
723
723
|
}
|
|
724
|
+
/** Lifecycle of a file the user dropped on the composer. */
|
|
725
|
+
/** `choosing`: several upload tools accept this file — held until the user picks one. */
|
|
726
|
+
type ChatAttachmentStatus = 'choosing' | 'uploading' | 'ready' | 'error';
|
|
727
|
+
/**
|
|
728
|
+
* A file staged for the next message. The bytes are POSTed straight to S3 by
|
|
729
|
+
* `DirectUploadService`; what survives here is the opaque `key` the server
|
|
730
|
+
* hands back, which is all that ever reaches the chat request.
|
|
731
|
+
*/
|
|
732
|
+
interface ChatAttachment {
|
|
733
|
+
name: string;
|
|
734
|
+
size: number;
|
|
735
|
+
status: ChatAttachmentStatus;
|
|
736
|
+
/** 0-100 while uploading; 100 once staged. */
|
|
737
|
+
percent: number;
|
|
738
|
+
/** Opaque staging key. Absent until the upload lands. */
|
|
739
|
+
key?: string;
|
|
740
|
+
/** Namespaced tool that consumes this file, from its advertised capability. */
|
|
741
|
+
tool?: string;
|
|
742
|
+
/** That tool's advertised title, e.g. "Set Your Profile Picture". */
|
|
743
|
+
title?: string;
|
|
744
|
+
/** Human-readable failure, shown on the chip. */
|
|
745
|
+
error?: string;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Owns the composer's file attachment: drag state, the upload, and the single
|
|
750
|
+
* staged file. Split out of the component the same way BrainChatDictation and
|
|
751
|
+
* BrainChatVoiceChat are, so the panel stays composable and this is testable
|
|
752
|
+
* without a TestBed.
|
|
753
|
+
*
|
|
754
|
+
* What it may accept is DISCOVERED, not configured: brain-api reports the
|
|
755
|
+
* upload-capable tools this caller can reach, each carrying its own purpose,
|
|
756
|
+
* extensions and size cap. So a product gains a drop affordance by shipping a
|
|
757
|
+
* tool that advertises one — with no change here and none in the host app
|
|
758
|
+
* beyond naming its API.
|
|
759
|
+
*/
|
|
760
|
+
declare class BrainChatAttachment {
|
|
761
|
+
private readonly uploads;
|
|
762
|
+
private readonly apis;
|
|
763
|
+
private readonly subscriptionId;
|
|
764
|
+
private readonly onChange;
|
|
765
|
+
current: ChatAttachment | null;
|
|
766
|
+
private readonly drag;
|
|
767
|
+
private capabilities;
|
|
768
|
+
private readonly choice;
|
|
769
|
+
constructor(uploads: DirectUploadService | null, apis: Record<string, BaseHttpService> | null, subscriptionId: () => number | null, onChange: () => void);
|
|
770
|
+
discover(source: Observable<{
|
|
771
|
+
uploads: MCPUploadCapability[];
|
|
772
|
+
}>, destroy$: Subject<void>): void;
|
|
773
|
+
get enabled(): boolean;
|
|
774
|
+
get busy(): boolean;
|
|
775
|
+
/** Several tools accept the file; nothing is uploaded until one is picked. */
|
|
776
|
+
get choosing(): boolean;
|
|
777
|
+
get choices(): MCPUploadCapability[];
|
|
778
|
+
choiceLabel(capability: MCPUploadCapability): string;
|
|
779
|
+
get ready(): boolean;
|
|
780
|
+
get context(): Record<string, unknown> | null;
|
|
781
|
+
get label(): string;
|
|
782
|
+
get hint(): string;
|
|
783
|
+
get acceptAttr(): string;
|
|
784
|
+
get dragActive(): boolean;
|
|
785
|
+
dragEnter(event: DragEvent): void;
|
|
786
|
+
dragOver(event: DragEvent): void;
|
|
787
|
+
dragLeave(event: DragEvent): void;
|
|
788
|
+
drop(event: DragEvent): void;
|
|
789
|
+
/** Shared by the drop target and the paperclip file input. */
|
|
790
|
+
accept(file: File): void;
|
|
791
|
+
/** The user picked which tool this file is for — only now is it uploaded. */
|
|
792
|
+
choose(capability: MCPUploadCapability): void;
|
|
793
|
+
remove(): void;
|
|
794
|
+
/** Cleared after a send so the file travels with exactly one message. */
|
|
795
|
+
clearAfterSend(): void;
|
|
796
|
+
meta(): string;
|
|
797
|
+
icon(): string;
|
|
798
|
+
private upload;
|
|
799
|
+
}
|
|
724
800
|
|
|
725
801
|
/**
|
|
726
802
|
* Drives mic dictation for the Brain chat composer (#22).
|
|
@@ -837,6 +913,8 @@ declare class PwBrainChatComponent implements OnInit, OnDestroy {
|
|
|
837
913
|
private readonly brainSocket?;
|
|
838
914
|
private readonly brainVoice?;
|
|
839
915
|
private readonly voiceChatService?;
|
|
916
|
+
private readonly directUpload?;
|
|
917
|
+
private readonly uploadApis?;
|
|
840
918
|
messages: ChatMessage[];
|
|
841
919
|
draft: string;
|
|
842
920
|
loading: boolean;
|
|
@@ -853,11 +931,18 @@ declare class PwBrainChatComponent implements OnInit, OnDestroy {
|
|
|
853
931
|
readonly diffRows: typeof diffRowsFrom;
|
|
854
932
|
readonly dictation: BrainChatDictation;
|
|
855
933
|
readonly voiceChat: BrainChatVoiceChat;
|
|
934
|
+
readonly attachment: BrainChatAttachment;
|
|
856
935
|
private readonly threadRef?;
|
|
857
|
-
constructor(orchestrator: MCPOrchestratorService, localStorage: LocalStorage, router: Router, cdr: ChangeDetectorRef, store: Store<AppState>, dynamicPageCtx: DynamicPageContextService, appConfigService?: AppConfigService, brainSocket?: BrainSocketService, brainVoice?: BrainVoiceService, voiceChatService?: VoiceChatService);
|
|
936
|
+
constructor(orchestrator: MCPOrchestratorService, localStorage: LocalStorage, router: Router, cdr: ChangeDetectorRef, store: Store<AppState>, dynamicPageCtx: DynamicPageContextService, appConfigService?: AppConfigService, brainSocket?: BrainSocketService, brainVoice?: BrainVoiceService, voiceChatService?: VoiceChatService, directUpload?: DirectUploadService, uploadApis?: Record<string, BaseHttpService>);
|
|
858
937
|
ngOnInit(): void;
|
|
859
938
|
private subscribeToServerPush;
|
|
860
939
|
ngOnDestroy(): void;
|
|
940
|
+
/**
|
|
941
|
+
* Paperclip path. The input is reset after every pick so choosing the same
|
|
942
|
+
* file twice in a row still fires `change` (the browser suppresses it
|
|
943
|
+
* otherwise, and "nothing happened" is a maddening bug to hit).
|
|
944
|
+
*/
|
|
945
|
+
pickFile(input: HTMLInputElement): void;
|
|
861
946
|
send(): void;
|
|
862
947
|
approve(message: ChatMessage): void;
|
|
863
948
|
cancel(message: ChatMessage): void;
|
|
@@ -874,7 +959,7 @@ declare class PwBrainChatComponent implements OnInit, OnDestroy {
|
|
|
874
959
|
* so the conversation survives the overlay (plain text: it was speech). */
|
|
875
960
|
private recordVoiceTurn;
|
|
876
961
|
private stick;
|
|
877
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PwBrainChatComponent, [null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
|
|
962
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PwBrainChatComponent, [null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
|
|
878
963
|
static ɵcmp: i0.ɵɵComponentDeclaration<PwBrainChatComponent, "pw-brain-chat", never, {}, {}, never, never, false, never>;
|
|
879
964
|
}
|
|
880
965
|
|
|
@@ -1645,5 +1730,22 @@ declare const COMPONENT_REGISTRY: Readonly<Record<string, Type<unknown>>>;
|
|
|
1645
1730
|
declare function registeredType(type: string): Type<unknown> | null;
|
|
1646
1731
|
declare function registeredTypeNames(): string[];
|
|
1647
1732
|
|
|
1648
|
-
|
|
1733
|
+
/**
|
|
1734
|
+
* Which product API to POST bytes to, keyed by the service name the tool
|
|
1735
|
+
* catalog reports (e.g. `'cloudolive-api'`, `'main-api'`).
|
|
1736
|
+
*
|
|
1737
|
+
* This is the ONE thing discovery cannot supply. Everything else about an
|
|
1738
|
+
* upload — the purpose, the accepted extensions, the size cap, which tool
|
|
1739
|
+
* consumes it — is advertised by the tool itself via `posiwise.upload` and
|
|
1740
|
+
* fetched from brain-api, so no frontend restates limits the owning service
|
|
1741
|
+
* already enforces. But the file goes STRAIGHT to the owning service rather
|
|
1742
|
+
* than through brain-api (bytes must never transit the chat pipeline), and
|
|
1743
|
+
* only the host app knows how to reach its own APIs.
|
|
1744
|
+
*
|
|
1745
|
+
* A service the map doesn't cover is simply not offered: the affordance is
|
|
1746
|
+
* hidden rather than advertised-then-broken.
|
|
1747
|
+
*/
|
|
1748
|
+
declare const BRAIN_CHAT_UPLOAD_APIS: InjectionToken<Record<string, BaseHttpService>>;
|
|
1749
|
+
|
|
1750
|
+
export { AuthenticatorComponent, BRAIN_CHAT_UPLOAD_APIS, COMPONENT_REGISTRY, ClearBitIconComponent, CollapsibleSidebarComponent, CollapsibleSidebarKeyboardShortcutDirective, CollapsibleSidebarService, CollapsibleSidebarSuperAdminGuard, CollapsibleSidebarTriggerDirective, ComingSoonComponent, CommandPaletteComponent, CommandPaletteService, CompletionBarComponent, ConfirmDialogComponent, ConfirmDialogService, DateRangePickerComponent, DynamicPageContextService, EntityGroupComponent, GroupDefinitionComponent, GroupsComponent, HeaderComponent, InputContainerComponent, LandingPageFooterBComponent, NoDataComponent, NumberPickerComponent, PasswordValidationComponent, PermissionTreeComponent, PrivacyAndTosComponent, PrivacyPolicyComponent, PwBrainChatComponent, PwCookieBannerComponent, PwDynamicPageComponent, PwTabsComponent, RecordsSummaryComponent, ResourceSharedComponentsModule, SharedComponentsModule, SplashComponent, TermsConditionsComponent, UI_BUILDER_FLAG, UiLayoutService, registeredType, registeredTypeNames };
|
|
1649
1751
|
export type { ChatMessage, ChatMessageRole, CompletionTier, ConfirmDeleteOptions, ConfirmDialogConfig, ConfirmDialogTone, DynamicPageContext, PaletteActionId, PaletteGroup, PaletteItem, PaletteItemKind, PalettePerson, PendingConfirmation, ResolvedBinding, SidebarContent, SidebarHeaderAction, UiBinding, UiBlock, UiGrid, UiLayoutConfig, UiLayoutResponse };
|