@posiwise/common-services 0.2.24 → 0.2.25
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
|
@@ -590,6 +590,13 @@ declare class AuthService {
|
|
|
590
590
|
storeToken(token: string): rxjs.Observable<boolean>;
|
|
591
591
|
storePlatform(plat: string): rxjs.Observable<void>;
|
|
592
592
|
logout(): rxjs.Observable<any>;
|
|
593
|
+
/**
|
|
594
|
+
* Wipe every `pw-brain.*` localStorage key on logout so the next user
|
|
595
|
+
* on a shared browser doesn't inherit the previous user's chat thread
|
|
596
|
+
* (ticket #4167). Best-effort: private-browsing / quota throws are
|
|
597
|
+
* swallowed so logout never breaks.
|
|
598
|
+
*/
|
|
599
|
+
private clearBrainChatStorage;
|
|
593
600
|
/**
|
|
594
601
|
* Clear all authentication tokens
|
|
595
602
|
*/
|
|
@@ -738,7 +745,7 @@ declare class SubscriptionService {
|
|
|
738
745
|
getEnrolledSubscription(id: number, paging?: Paging): rxjs.Observable<any>;
|
|
739
746
|
removeEnrolledSubscription(id: number, user_id: number): rxjs.Observable<any>;
|
|
740
747
|
toggleAdmin(id: number, data: any): rxjs.Observable<any>;
|
|
741
|
-
updateSubscriptionAPIKey(id: number): rxjs.Observable<any>;
|
|
748
|
+
updateSubscriptionAPIKey(id: number, productId: number): rxjs.Observable<any>;
|
|
742
749
|
refreshApiTokens(id: number): rxjs.Observable<any>;
|
|
743
750
|
addFullLogo(id: number, data: any): rxjs.Observable<any>;
|
|
744
751
|
addSquaredLogo(id: number, data: any): rxjs.Observable<any>;
|
|
@@ -1027,6 +1034,116 @@ declare class McpJsonRpcService {
|
|
|
1027
1034
|
static ɵprov: i0.ɵɵInjectableDeclaration<McpJsonRpcService>;
|
|
1028
1035
|
}
|
|
1029
1036
|
|
|
1037
|
+
/**
|
|
1038
|
+
* Posiwise Brain MCP orchestrator client (ticket #36).
|
|
1039
|
+
*
|
|
1040
|
+
* Wraps `POST /brain-api/v1/mcp/{execute,interpret,confirm}`. Frees the chat
|
|
1041
|
+
* UI from JSON-RPC plumbing and the `McpJsonRpcService` direct-to-main-api
|
|
1042
|
+
* pattern, which bypasses Bedrock interpretation + the per-user allowlist.
|
|
1043
|
+
*
|
|
1044
|
+
* Auth: the orchestrator authenticates user requests by calling main-api's
|
|
1045
|
+
* `/api/auth/token` from server side. The frontend MUST forward the three
|
|
1046
|
+
* user-token headers (`x-api-user-token`, `x-api-user-id`, `x-api-client-id`)
|
|
1047
|
+
* so the orchestrator can identify the caller. The platform's
|
|
1048
|
+
* `CustomAuthInterceptor` does NOT set these — it sets `Authorization:
|
|
1049
|
+
* pw-gateway` + `x-auth-token` — so we attach them explicitly per request,
|
|
1050
|
+
* mirroring `McpJsonRpcService.pickApiCredentials`.
|
|
1051
|
+
*
|
|
1052
|
+
* Conversation continuity: every response echoes a `conversation_id`. The
|
|
1053
|
+
* UI persists it in localStorage and replays it on subsequent calls so
|
|
1054
|
+
* Bedrock keeps chat context across the three endpoints.
|
|
1055
|
+
*/
|
|
1056
|
+
interface MCPExecuteRequest {
|
|
1057
|
+
message: string;
|
|
1058
|
+
workspace_context?: Record<string, unknown>;
|
|
1059
|
+
conversation_id?: string;
|
|
1060
|
+
}
|
|
1061
|
+
type MCPInterpretRequest = MCPExecuteRequest;
|
|
1062
|
+
interface MCPConfirmRequest {
|
|
1063
|
+
confirmation_token: string;
|
|
1064
|
+
idempotency_key?: string;
|
|
1065
|
+
tool_arguments?: Record<string, unknown>;
|
|
1066
|
+
conversation_id?: string;
|
|
1067
|
+
}
|
|
1068
|
+
type MCPRiskLevel = 'low' | 'medium' | 'high' | 'critical';
|
|
1069
|
+
type MCPResultStatus = 'success' | 'error' | 'blocked';
|
|
1070
|
+
interface MCPActionPlan {
|
|
1071
|
+
intent: string;
|
|
1072
|
+
target_service: string;
|
|
1073
|
+
target_tool: string;
|
|
1074
|
+
tool_arguments: Record<string, unknown>;
|
|
1075
|
+
risk_level: MCPRiskLevel;
|
|
1076
|
+
needs_confirmation: boolean;
|
|
1077
|
+
summary?: string | null;
|
|
1078
|
+
}
|
|
1079
|
+
interface MCPFieldDiff {
|
|
1080
|
+
[field: string]: {
|
|
1081
|
+
before: unknown;
|
|
1082
|
+
after: unknown;
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
interface MCPExecuteResponse {
|
|
1086
|
+
request_id: string;
|
|
1087
|
+
result_status: MCPResultStatus;
|
|
1088
|
+
needs_confirmation: boolean;
|
|
1089
|
+
confirmation_token?: string | null;
|
|
1090
|
+
risk_level?: MCPRiskLevel | null;
|
|
1091
|
+
summary?: string | null;
|
|
1092
|
+
response?: string | null;
|
|
1093
|
+
tool_result?: Record<string, unknown> | null;
|
|
1094
|
+
interpreted_intent?: string | null;
|
|
1095
|
+
target_service?: string | null;
|
|
1096
|
+
target_tool?: string | null;
|
|
1097
|
+
reason?: string | null;
|
|
1098
|
+
conversation_id?: string | null;
|
|
1099
|
+
diff?: MCPFieldDiff | null;
|
|
1100
|
+
}
|
|
1101
|
+
interface MCPInterpretResponse {
|
|
1102
|
+
request_id: string;
|
|
1103
|
+
plan: MCPActionPlan | null;
|
|
1104
|
+
allowlist_match: boolean;
|
|
1105
|
+
reason_blocked?: string | null;
|
|
1106
|
+
conversation_id?: string | null;
|
|
1107
|
+
}
|
|
1108
|
+
declare class MCPOrchestratorService {
|
|
1109
|
+
private readonly http;
|
|
1110
|
+
private readonly appConfigService;
|
|
1111
|
+
private readonly store;
|
|
1112
|
+
/**
|
|
1113
|
+
* Dev base — `BRAIN_API_PREFIX` = '/brain-api/v1/'. In prod the
|
|
1114
|
+
* orchestrator is reached via the API-gateway public hostname; we read
|
|
1115
|
+
* it from `links.brain_api` in app config (same convention as
|
|
1116
|
+
* `BrainApiHttpService`).
|
|
1117
|
+
*/
|
|
1118
|
+
constructor(http: HttpClient, appConfigService: AppConfigService, store: Store<AppState>);
|
|
1119
|
+
execute(body: MCPExecuteRequest): Observable<MCPExecuteResponse>;
|
|
1120
|
+
interpret(body: MCPInterpretRequest): Observable<MCPInterpretResponse>;
|
|
1121
|
+
confirm(body: MCPConfirmRequest): Observable<MCPExecuteResponse>;
|
|
1122
|
+
private post;
|
|
1123
|
+
/**
|
|
1124
|
+
* Pull `(token, userId, clientId?)` for the active session.
|
|
1125
|
+
*
|
|
1126
|
+
* `clientId` comes from `PermissionService.selectedSubscription` — the
|
|
1127
|
+
* canonical "currently-active subscription" on this frontend, set when
|
|
1128
|
+
* the user picks/lands on a subscription. Every other place in the
|
|
1129
|
+
* codebase that needs subscription context (mailbox, chatbox, search,
|
|
1130
|
+
* dashboard, admin lists) reads from the same static. Without it,
|
|
1131
|
+
* downstream MCP tools that require subscription scope (e.g.
|
|
1132
|
+
* `cloudolive-api.count_reconciled_account_inputs`) reject the call
|
|
1133
|
+
* with `McpError: This tool requires subscription context. Please
|
|
1134
|
+
* provide api_client_id parameter`.
|
|
1135
|
+
*
|
|
1136
|
+
* `api_client_id` does NOT live on the `User` interface — it's a
|
|
1137
|
+
* property of `Subscription` (`subscription.interface.ts`). Reading
|
|
1138
|
+
* from the user object would always return `undefined` and silently
|
|
1139
|
+
* drop the header.
|
|
1140
|
+
*/
|
|
1141
|
+
private pickApiCredentials;
|
|
1142
|
+
private buildHeaders;
|
|
1143
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MCPOrchestratorService, never>;
|
|
1144
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MCPOrchestratorService>;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1030
1147
|
declare class WebsocketService {
|
|
1031
1148
|
private readonly appConfigService;
|
|
1032
1149
|
private readonly authService;
|
|
@@ -1217,5 +1334,5 @@ declare class BrainApiService {
|
|
|
1217
1334
|
static ɵprov: i0.ɵɵInjectableDeclaration<BrainApiService>;
|
|
1218
1335
|
}
|
|
1219
1336
|
|
|
1220
|
-
export { AbTestService, AhoyService, AuthService, BaseHttpService, BrainApiHttpService, BrainApiService, CommonService, CommonServicesModule, CustomPreloadingStrategy, CustomToastService, DashboardService, DataService, FeatureFlagService, FormHelperService, GeoService, GoogleAnalyticsService, GroupService, HopscotchService, IntegrationsApiHttpService, LinkService, LocalStorage, LogoCacheService, MailBoxService, MainApiHttpService, McpJsonRpcService, NgbDateCustomParserFormatter, NotificationService, NumberPickerService, PermissionService, PrimeNgHelper, ProductService, ProfileService, QualificationService, ScriptLoaderService, SecureTokenStorageService, SentryErrorHandler, SeoService, SubscriptionService, TagService, TipsService, UserEffects, UserService, ValidationService, WebsocketService, WindowService };
|
|
1221
|
-
export type { McpJsonRpcError, McpJsonRpcRequest, McpJsonRpcResponse, McpToolDefinition, McpToolsListResult };
|
|
1337
|
+
export { AbTestService, AhoyService, AuthService, BaseHttpService, BrainApiHttpService, BrainApiService, CommonService, CommonServicesModule, CustomPreloadingStrategy, CustomToastService, DashboardService, DataService, FeatureFlagService, FormHelperService, GeoService, GoogleAnalyticsService, GroupService, HopscotchService, IntegrationsApiHttpService, LinkService, LocalStorage, LogoCacheService, MCPOrchestratorService, MailBoxService, MainApiHttpService, McpJsonRpcService, NgbDateCustomParserFormatter, NotificationService, NumberPickerService, PermissionService, PrimeNgHelper, ProductService, ProfileService, QualificationService, ScriptLoaderService, SecureTokenStorageService, SentryErrorHandler, SeoService, SubscriptionService, TagService, TipsService, UserEffects, UserService, ValidationService, WebsocketService, WindowService };
|
|
1338
|
+
export type { MCPActionPlan, MCPConfirmRequest, MCPExecuteRequest, MCPExecuteResponse, MCPFieldDiff, MCPInterpretRequest, MCPInterpretResponse, MCPResultStatus, MCPRiskLevel, McpJsonRpcError, McpJsonRpcRequest, McpJsonRpcResponse, McpToolDefinition, McpToolsListResult };
|