@meltingspot/core 1.0.0 → 1.1.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/CHANGELOG.md +12 -0
- package/index.mjs +950 -922
- package/index.umd.js +8 -8
- package/package.json +1 -1
- package/services/api/spotMember/spotMember.api.service.d.ts +6 -0
- package/services/configuration.service.d.ts +2 -0
- package/services/http.service.d.ts +1 -0
- package/types/conversation/conversationMessage.d.ts +4 -0
- package/types/conversation/conversationSseEvent.d.ts +9 -1
- package/types/conversation/getConversationMessagesResponse.d.ts +4 -0
- package/types/conversation/index.d.ts +1 -0
- package/types/conversation/meltyHandoffReason.d.ts +6 -0
- package/types/widget/spotWidgetContentType.d.ts +1 -0
- package/utils/playbook/testUrlMatching.d.ts +8 -0
package/package.json
CHANGED
|
@@ -9,4 +9,10 @@ export declare class SpotMemberApiService {
|
|
|
9
9
|
* Get the current user's SpotMember.
|
|
10
10
|
*/
|
|
11
11
|
getSpotMemberForMe(): Promise<Result<SpotMemberOutput, Error>>;
|
|
12
|
+
/**
|
|
13
|
+
* Join and validate the current user on the spot from an SSO token.
|
|
14
|
+
* Authenticated call — the server re-validates the token and sources the
|
|
15
|
+
* signed claims. Returns the resulting SpotMember (created or existing).
|
|
16
|
+
*/
|
|
17
|
+
joinFromSso(ssoToken: string): Promise<Result<SpotMemberOutput, Error>>;
|
|
12
18
|
}
|
|
@@ -12,6 +12,7 @@ export declare enum HttpMethods {
|
|
|
12
12
|
export interface HttpInput {
|
|
13
13
|
url: string;
|
|
14
14
|
headers?: Record<string, string>;
|
|
15
|
+
signal?: AbortSignal;
|
|
15
16
|
}
|
|
16
17
|
export type QueryType = string | Record<string, string | number | boolean | string[] | number[] | boolean[]>;
|
|
17
18
|
export interface HttpGetInput extends HttpInput {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { MeltyHandoffReason } from './meltyHandoffReason';
|
|
1
2
|
import { RenderableWidgetAction } from './renderableWidgetAction';
|
|
2
3
|
export interface ConversationMessage {
|
|
3
4
|
id: string;
|
|
4
5
|
role: ConversationMessageRole;
|
|
5
6
|
content: string[];
|
|
6
7
|
widgetActions: RenderableWidgetAction[];
|
|
8
|
+
handoff?: {
|
|
9
|
+
reason: MeltyHandoffReason;
|
|
10
|
+
};
|
|
7
11
|
createdAt: string;
|
|
8
12
|
}
|
|
9
13
|
export declare enum ConversationMessageRole {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { MeltyHandoffReason } from './meltyHandoffReason';
|
|
1
2
|
import { MeltyWidgetAction } from './meltyWidgetAction';
|
|
2
3
|
export declare enum ConversationSseEventType {
|
|
3
4
|
Metadata = "metadata",
|
|
4
5
|
Token = "token",
|
|
5
6
|
Action = "action",
|
|
6
7
|
Bubble = "bubble",
|
|
8
|
+
Handoff = "handoff",
|
|
7
9
|
Done = "done",
|
|
8
10
|
Error = "error"
|
|
9
11
|
}
|
|
@@ -28,6 +30,12 @@ export interface ConversationSseBubbleEvent {
|
|
|
28
30
|
type: ConversationSseEventType.Bubble;
|
|
29
31
|
data: Record<string, never>;
|
|
30
32
|
}
|
|
33
|
+
export interface ConversationSseHandoffEvent {
|
|
34
|
+
type: ConversationSseEventType.Handoff;
|
|
35
|
+
data: {
|
|
36
|
+
reason: MeltyHandoffReason;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
31
39
|
export interface ConversationSseDoneEvent {
|
|
32
40
|
type: ConversationSseEventType.Done;
|
|
33
41
|
data: {
|
|
@@ -41,4 +49,4 @@ export interface ConversationSseErrorEvent {
|
|
|
41
49
|
code: string;
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
|
-
export type ConversationSseEvent = ConversationSseMetadataEvent | ConversationSseTokenEvent | ConversationSseActionEvent | ConversationSseBubbleEvent | ConversationSseDoneEvent | ConversationSseErrorEvent;
|
|
52
|
+
export type ConversationSseEvent = ConversationSseMetadataEvent | ConversationSseTokenEvent | ConversationSseActionEvent | ConversationSseBubbleEvent | ConversationSseHandoffEvent | ConversationSseDoneEvent | ConversationSseErrorEvent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Nullable } from '../nullable';
|
|
2
2
|
import { ConversationStatus } from './conversation';
|
|
3
3
|
import { ConversationMessageRole } from './conversationMessage';
|
|
4
|
+
import { MeltyHandoffReason } from './meltyHandoffReason';
|
|
4
5
|
import { MeltyWidgetAction } from './meltyWidgetAction';
|
|
5
6
|
/**
|
|
6
7
|
* Raw payload of GET /melty/conversations/:id/messages. It differs from the SDK
|
|
@@ -14,6 +15,9 @@ export interface GetConversationMessageResponse {
|
|
|
14
15
|
content: string[];
|
|
15
16
|
metadata: Nullable<{
|
|
16
17
|
actions?: MeltyWidgetAction[];
|
|
18
|
+
handoff?: {
|
|
19
|
+
reason: MeltyHandoffReason;
|
|
20
|
+
};
|
|
17
21
|
}>;
|
|
18
22
|
createdAt: string;
|
|
19
23
|
}
|
|
@@ -5,6 +5,7 @@ export * from './conversationStreamResponse';
|
|
|
5
5
|
export * from './createConversationResponse';
|
|
6
6
|
export * from './getConversationMessagesResponse';
|
|
7
7
|
export * from './listConversationsResponse';
|
|
8
|
+
export * from './meltyHandoffReason';
|
|
8
9
|
export * from './meltyWidgetAction';
|
|
9
10
|
export * from './renderableWidgetAction';
|
|
10
11
|
export * from './proactiveCheckResponse';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare enum MeltyHandoffReason {
|
|
2
|
+
NoSource = "NoSource",// no retrieved RAG source relevant enough to answer
|
|
3
|
+
LowConfidence = "LowConfidence",// not confident in the answer
|
|
4
|
+
HumanRequest = "HumanRequest",// explicit human request from the user
|
|
5
|
+
OutOfScope = "OutOfScope"
|
|
6
|
+
}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { PlaybookMatchingRulesData } from '../../types/widget/playbook/playbookMatchingRules';
|
|
2
2
|
export declare const testUrlMatching: (url: string, matchingRules: PlaybookMatchingRulesData) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Domain-scoped URL match: true when the URL's hostname equals `domain` or is a
|
|
5
|
+
* subdomain of it (`host === domain || host.endsWith('.' + domain)`). Mirrors
|
|
6
|
+
* the shared `util-widget` helper of the same name, duplicated here so the SDK
|
|
7
|
+
* bundle owns its playbook matching and stays self-contained. Returns false for
|
|
8
|
+
* non-parseable URLs.
|
|
9
|
+
*/
|
|
10
|
+
export declare const matchesDomain: (url: string, domain: string) => boolean;
|