@lssm/lib.support-bot 0.0.0-canary-20251217054315 → 0.0.0-canary-20251217060804
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/dist/bot/auto-responder.d.ts +25 -0
- package/dist/bot/feedback-loop.d.ts +19 -0
- package/dist/bot/index.d.ts +4 -0
- package/dist/bot/tools.d.ts +14 -0
- package/dist/index.d.ts +11 -0
- package/dist/rag/index.d.ts +2 -0
- package/dist/rag/ticket-resolver.d.ts +24 -0
- package/dist/spec.d.ts +12 -0
- package/dist/tickets/classifier.d.ts +24 -0
- package/dist/tickets/index.d.ts +2 -0
- package/dist/types.d.ts +75 -0
- package/package.json +16 -16
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SupportResolution, SupportResponseDraft, SupportTicket, TicketClassification } from "../types.js";
|
|
2
|
+
import { LLMProvider } from "@lssm/lib.contracts/integrations/providers/llm";
|
|
3
|
+
|
|
4
|
+
//#region src/bot/auto-responder.d.ts
|
|
5
|
+
interface AutoResponderOptions {
|
|
6
|
+
llm?: LLMProvider;
|
|
7
|
+
model?: string;
|
|
8
|
+
tone?: 'friendly' | 'formal';
|
|
9
|
+
closing?: string;
|
|
10
|
+
}
|
|
11
|
+
declare class AutoResponder {
|
|
12
|
+
private readonly llm?;
|
|
13
|
+
private readonly model?;
|
|
14
|
+
private readonly tone;
|
|
15
|
+
private readonly closing;
|
|
16
|
+
constructor(options?: AutoResponderOptions);
|
|
17
|
+
draft(ticket: SupportTicket, resolution: SupportResolution, classification: TicketClassification): Promise<SupportResponseDraft>;
|
|
18
|
+
private generateWithLLM;
|
|
19
|
+
private generateTemplate;
|
|
20
|
+
private buildDraft;
|
|
21
|
+
private renderCategoryIntro;
|
|
22
|
+
private renderCitations;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { AutoResponder, AutoResponderOptions };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ResolutionResultPayload } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/bot/feedback-loop.d.ts
|
|
4
|
+
interface FeedbackMetrics {
|
|
5
|
+
totalTickets: number;
|
|
6
|
+
autoResolved: number;
|
|
7
|
+
escalated: number;
|
|
8
|
+
avgConfidence: number;
|
|
9
|
+
avgResponseTimeMs: number;
|
|
10
|
+
}
|
|
11
|
+
declare class SupportFeedbackLoop {
|
|
12
|
+
private readonly history;
|
|
13
|
+
private readonly responseTimes;
|
|
14
|
+
recordResolution(payload: ResolutionResultPayload, responseTimeMs?: number): void;
|
|
15
|
+
metrics(): FeedbackMetrics;
|
|
16
|
+
feedbackSummary(limit?: number): string;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { FeedbackMetrics, SupportFeedbackLoop };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AutoResponder, AutoResponderOptions } from "./auto-responder.js";
|
|
2
|
+
import { FeedbackMetrics, SupportFeedbackLoop } from "./feedback-loop.js";
|
|
3
|
+
import { SupportToolsetOptions, createSupportTools } from "./tools.js";
|
|
4
|
+
export { AutoResponder, AutoResponderOptions, FeedbackMetrics, SupportFeedbackLoop, SupportToolsetOptions, createSupportTools };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AutoResponder } from "./auto-responder.js";
|
|
2
|
+
import { TicketResolver } from "../rag/ticket-resolver.js";
|
|
3
|
+
import { TicketClassifier } from "../tickets/classifier.js";
|
|
4
|
+
import { Tool } from "@ai-sdk/provider-utils";
|
|
5
|
+
|
|
6
|
+
//#region src/bot/tools.d.ts
|
|
7
|
+
interface SupportToolsetOptions {
|
|
8
|
+
resolver: TicketResolver;
|
|
9
|
+
classifier: TicketClassifier;
|
|
10
|
+
responder: AutoResponder;
|
|
11
|
+
}
|
|
12
|
+
declare function createSupportTools(options: SupportToolsetOptions): Tool[];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SupportToolsetOptions, createSupportTools };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClassificationResultPayload, ResolutionResultPayload, SupportAction, SupportBotSpec, SupportCitation, SupportResolution, SupportResponseDraft, SupportTicket, TicketCategory, TicketChannel, TicketClassification, TicketPriority, TicketSentiment } from "./types.js";
|
|
2
|
+
import { AutoResponder, AutoResponderOptions } from "./bot/auto-responder.js";
|
|
3
|
+
import { FeedbackMetrics, SupportFeedbackLoop } from "./bot/feedback-loop.js";
|
|
4
|
+
import { KnowledgeRetriever, TicketResolver, TicketResolverOptions } from "./rag/ticket-resolver.js";
|
|
5
|
+
import { TicketClassifier, TicketClassifierOptions } from "./tickets/classifier.js";
|
|
6
|
+
import { SupportToolsetOptions, createSupportTools } from "./bot/tools.js";
|
|
7
|
+
import "./bot/index.js";
|
|
8
|
+
import { SupportBotDefinition, defineSupportBot } from "./spec.js";
|
|
9
|
+
import "./rag/index.js";
|
|
10
|
+
import "./tickets/index.js";
|
|
11
|
+
export { AutoResponder, AutoResponderOptions, ClassificationResultPayload, FeedbackMetrics, KnowledgeRetriever, ResolutionResultPayload, SupportAction, SupportBotDefinition, SupportBotSpec, SupportCitation, SupportFeedbackLoop, SupportResolution, SupportResponseDraft, SupportTicket, SupportToolsetOptions, TicketCategory, TicketChannel, TicketClassification, TicketClassifier, TicketClassifierOptions, TicketPriority, TicketResolver, TicketResolverOptions, TicketSentiment, createSupportTools, defineSupportBot };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SupportResolution, SupportTicket } from "../types.js";
|
|
2
|
+
import { KnowledgeAnswer } from "@lssm/lib.knowledge/query/service";
|
|
3
|
+
|
|
4
|
+
//#region src/rag/ticket-resolver.d.ts
|
|
5
|
+
interface KnowledgeRetriever {
|
|
6
|
+
query(question: string): Promise<KnowledgeAnswer>;
|
|
7
|
+
}
|
|
8
|
+
interface TicketResolverOptions {
|
|
9
|
+
knowledge: KnowledgeRetriever;
|
|
10
|
+
minConfidence?: number;
|
|
11
|
+
prependPrompt?: string;
|
|
12
|
+
}
|
|
13
|
+
declare class TicketResolver {
|
|
14
|
+
private readonly knowledge;
|
|
15
|
+
private readonly minConfidence;
|
|
16
|
+
private readonly prependPrompt?;
|
|
17
|
+
constructor(options: TicketResolverOptions);
|
|
18
|
+
resolve(ticket: SupportTicket): Promise<SupportResolution>;
|
|
19
|
+
private buildQuestion;
|
|
20
|
+
private toResolution;
|
|
21
|
+
private deriveConfidence;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { KnowledgeRetriever, TicketResolver, TicketResolverOptions };
|
package/dist/spec.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SupportBotSpec } from "./types.js";
|
|
2
|
+
import { AgentSpec, AgentToolConfig } from "@lssm/lib.ai-agent";
|
|
3
|
+
|
|
4
|
+
//#region src/spec.d.ts
|
|
5
|
+
interface SupportBotDefinition {
|
|
6
|
+
base: AgentSpec;
|
|
7
|
+
tools?: AgentToolConfig[];
|
|
8
|
+
autoEscalateThreshold?: number;
|
|
9
|
+
}
|
|
10
|
+
declare function defineSupportBot(definition: SupportBotDefinition): SupportBotSpec;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { SupportBotDefinition, defineSupportBot };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SupportTicket, TicketCategory, TicketClassification } from "../types.js";
|
|
2
|
+
import { LLMProvider } from "@lssm/lib.contracts/integrations/providers/llm";
|
|
3
|
+
|
|
4
|
+
//#region src/tickets/classifier.d.ts
|
|
5
|
+
interface TicketClassifierOptions {
|
|
6
|
+
keywords?: Partial<Record<TicketCategory, string[]>>;
|
|
7
|
+
llm?: LLMProvider;
|
|
8
|
+
llmModel?: string;
|
|
9
|
+
}
|
|
10
|
+
declare class TicketClassifier {
|
|
11
|
+
private readonly keywords;
|
|
12
|
+
private readonly llm?;
|
|
13
|
+
private readonly llmModel?;
|
|
14
|
+
constructor(options?: TicketClassifierOptions);
|
|
15
|
+
classify(ticket: SupportTicket): Promise<TicketClassification>;
|
|
16
|
+
private heuristicClassification;
|
|
17
|
+
private detectCategory;
|
|
18
|
+
private detectPriority;
|
|
19
|
+
private detectSentiment;
|
|
20
|
+
private extractIntents;
|
|
21
|
+
private estimateConfidence;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { TicketClassifier, TicketClassifierOptions };
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { AgentSpec } from "@lssm/lib.ai-agent";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type TicketPriority = 'low' | 'medium' | 'high' | 'urgent';
|
|
5
|
+
type TicketCategory = 'billing' | 'technical' | 'product' | 'account' | 'compliance' | 'other';
|
|
6
|
+
type TicketChannel = 'email' | 'chat' | 'phone' | 'portal';
|
|
7
|
+
type TicketSentiment = 'positive' | 'neutral' | 'negative' | 'frustrated';
|
|
8
|
+
interface SupportTicket {
|
|
9
|
+
id: string;
|
|
10
|
+
subject: string;
|
|
11
|
+
body: string;
|
|
12
|
+
channel: TicketChannel;
|
|
13
|
+
locale?: string;
|
|
14
|
+
customerEmail?: string;
|
|
15
|
+
customerName?: string;
|
|
16
|
+
metadata?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
interface TicketClassification {
|
|
19
|
+
ticketId: string;
|
|
20
|
+
category: TicketCategory;
|
|
21
|
+
priority: TicketPriority;
|
|
22
|
+
sentiment: TicketSentiment;
|
|
23
|
+
intents: string[];
|
|
24
|
+
tags: string[];
|
|
25
|
+
confidence: number;
|
|
26
|
+
escalationRequired?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface SupportCitation {
|
|
29
|
+
label: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
snippet?: string;
|
|
32
|
+
score?: number;
|
|
33
|
+
}
|
|
34
|
+
interface SupportAction {
|
|
35
|
+
type: 'respond' | 'escalate' | 'refund' | 'manual';
|
|
36
|
+
label: string;
|
|
37
|
+
payload?: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
interface SupportResolution {
|
|
40
|
+
ticketId: string;
|
|
41
|
+
answer: string;
|
|
42
|
+
confidence: number;
|
|
43
|
+
citations: SupportCitation[];
|
|
44
|
+
actions: SupportAction[];
|
|
45
|
+
escalationReason?: string;
|
|
46
|
+
knowledgeUpdates?: string[];
|
|
47
|
+
}
|
|
48
|
+
interface SupportResponseDraft {
|
|
49
|
+
ticketId: string;
|
|
50
|
+
subject: string;
|
|
51
|
+
body: string;
|
|
52
|
+
confidence: number;
|
|
53
|
+
requiresEscalation: boolean;
|
|
54
|
+
citations: SupportCitation[];
|
|
55
|
+
}
|
|
56
|
+
interface SupportBotSpec extends AgentSpec {
|
|
57
|
+
thresholds?: {
|
|
58
|
+
autoResolveMinConfidence?: number;
|
|
59
|
+
maxIterations?: number;
|
|
60
|
+
};
|
|
61
|
+
review?: {
|
|
62
|
+
queueName?: string;
|
|
63
|
+
approvalWorkflow?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
interface ClassificationResultPayload {
|
|
67
|
+
ticket: SupportTicket;
|
|
68
|
+
classification: TicketClassification;
|
|
69
|
+
}
|
|
70
|
+
interface ResolutionResultPayload extends ClassificationResultPayload {
|
|
71
|
+
resolution: SupportResolution;
|
|
72
|
+
draft: SupportResponseDraft;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { ClassificationResultPayload, ResolutionResultPayload, SupportAction, SupportBotSpec, SupportCitation, SupportResolution, SupportResponseDraft, SupportTicket, TicketCategory, TicketChannel, TicketClassification, TicketPriority, TicketSentiment };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/lib.support-bot",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251217060804",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,27 +23,27 @@
|
|
|
23
23
|
"test": "bun run"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lssm/lib.ai-agent": "0.0.0-canary-
|
|
27
|
-
"@lssm/lib.contracts": "0.0.0-canary-
|
|
26
|
+
"@lssm/lib.ai-agent": "0.0.0-canary-20251217060804",
|
|
27
|
+
"@lssm/lib.contracts": "0.0.0-canary-20251217060804"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@lssm/tool.tsdown": "0.0.0-canary-
|
|
31
|
-
"@lssm/tool.typescript": "0.0.0-canary-
|
|
30
|
+
"@lssm/tool.tsdown": "0.0.0-canary-20251217060804",
|
|
31
|
+
"@lssm/tool.typescript": "0.0.0-canary-20251217060804",
|
|
32
32
|
"tsdown": "^0.17.4",
|
|
33
33
|
"typescript": "^5.9.3"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
|
-
".": "./
|
|
37
|
-
"./bot": "./
|
|
38
|
-
"./bot/auto-responder": "./
|
|
39
|
-
"./bot/feedback-loop": "./
|
|
40
|
-
"./bot/tools": "./
|
|
41
|
-
"./rag": "./
|
|
42
|
-
"./rag/ticket-resolver": "./
|
|
43
|
-
"./spec": "./
|
|
44
|
-
"./tickets": "./
|
|
45
|
-
"./tickets/classifier": "./
|
|
46
|
-
"./types": "./
|
|
36
|
+
".": "./dist/index.js",
|
|
37
|
+
"./bot": "./dist/bot/index.js",
|
|
38
|
+
"./bot/auto-responder": "./dist/bot/auto-responder.js",
|
|
39
|
+
"./bot/feedback-loop": "./dist/bot/feedback-loop.js",
|
|
40
|
+
"./bot/tools": "./dist/bot/tools.js",
|
|
41
|
+
"./rag": "./dist/rag/index.js",
|
|
42
|
+
"./rag/ticket-resolver": "./dist/rag/ticket-resolver.js",
|
|
43
|
+
"./spec": "./dist/spec.js",
|
|
44
|
+
"./tickets": "./dist/tickets/index.js",
|
|
45
|
+
"./tickets/classifier": "./dist/tickets/classifier.js",
|
|
46
|
+
"./types": "./dist/types.js",
|
|
47
47
|
"./*": "./*"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|