eric-sdk 0.0.1
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/README.md +235 -0
- package/dist/index.cjs +198 -0
- package/dist/index.d.cts +199 -0
- package/dist/index.d.ts +199 -0
- package/dist/index.js +141 -0
- package/package.json +37 -0
- package/src/client.ts +89 -0
- package/src/flows/helper.ts +110 -0
- package/src/index.ts +3 -0
- package/src/types/flow.ts +139 -0
- package/tsconfig.json +13 -0
package/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
📘 Eric SDK (JavaScript + TypeScript)
|
|
2
|
+
|
|
3
|
+
Official SDK for interacting with the Eric AI Policy Engine.
|
|
4
|
+
Eric routes user input to the correct AI flow (or a restricted subset of flows) and returns structured, domain-aware results.
|
|
5
|
+
|
|
6
|
+
🚀 Features
|
|
7
|
+
|
|
8
|
+
Agentic routing with eric.decide()
|
|
9
|
+
|
|
10
|
+
Manual flow calls with eric.call(flowName, data)
|
|
11
|
+
|
|
12
|
+
Restricted routing with allowedFlows
|
|
13
|
+
|
|
14
|
+
Flow-specific structured responses
|
|
15
|
+
|
|
16
|
+
Domain-aware behavior (wellness, events, workplace)
|
|
17
|
+
|
|
18
|
+
Full TypeScript typing
|
|
19
|
+
|
|
20
|
+
Production-ready — used in Ingomu, EventInterface, and enterprise pilots
|
|
21
|
+
|
|
22
|
+
📦 Installation
|
|
23
|
+
npm install eric-sdk
|
|
24
|
+
|
|
25
|
+
🔑 Quick Start — Automatic Flow Selection
|
|
26
|
+
import { EricSDK } from "eric-sdk";
|
|
27
|
+
|
|
28
|
+
const eric = new EricSDK({
|
|
29
|
+
apiKey: process.env.ERIC_API_KEY!,
|
|
30
|
+
client: "eventinterface",
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const result = await eric.decide({
|
|
34
|
+
text: "I'm overwhelmed today.",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
Example output:
|
|
38
|
+
|
|
39
|
+
{
|
|
40
|
+
"flow": "dailyNudgeGenerator",
|
|
41
|
+
"type": "structured",
|
|
42
|
+
"data": {
|
|
43
|
+
"nudge": "You're building momentum — take a breath and trust your progress."
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
🎯 Auto-Routing (Advanced)
|
|
48
|
+
🔹 Decide automatically
|
|
49
|
+
const result = await eric.decide({
|
|
50
|
+
text: "Can you rewrite this announcement?",
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Eric chooses the correct flow (announcementRewriter, shortTextSummary, etc.)
|
|
55
|
+
|
|
56
|
+
🔒 Restricting Auto-Routing (allowedFlows)
|
|
57
|
+
|
|
58
|
+
You can force Eric to only pick from certain flows.
|
|
59
|
+
|
|
60
|
+
Example: only allow announcement rewriting:
|
|
61
|
+
|
|
62
|
+
const result = await eric.decide({
|
|
63
|
+
text: this.form.body,
|
|
64
|
+
allowedFlows: ["announcementRewriter"],
|
|
65
|
+
userState: {
|
|
66
|
+
tone: "energetic",
|
|
67
|
+
length: 150
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
This guarantees:
|
|
73
|
+
|
|
74
|
+
Eric does not pick shortTextSummary
|
|
75
|
+
|
|
76
|
+
Eric must choose announcementRewriter
|
|
77
|
+
|
|
78
|
+
If allowedFlows has only one item, it will always choose that one
|
|
79
|
+
|
|
80
|
+
Example output:
|
|
81
|
+
|
|
82
|
+
{
|
|
83
|
+
"flow": "announcementRewriter",
|
|
84
|
+
"type": "structured",
|
|
85
|
+
"data": {
|
|
86
|
+
"rewritten": "Heads up! The pool party is now at the yacht club...",
|
|
87
|
+
"toneUsed": "energetic"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
🔧 Manual Flow Execution
|
|
92
|
+
|
|
93
|
+
Use .call() to skip routing and directly invoke any flow:
|
|
94
|
+
|
|
95
|
+
const result = await eric.call("announcementRewriter", {
|
|
96
|
+
announcement: "We moved the meeting.",
|
|
97
|
+
tone: "friendly",
|
|
98
|
+
length: 200
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
Useful for admin panels, batch processing, and scheduled tasks.
|
|
103
|
+
|
|
104
|
+
🧠 When to Use What
|
|
105
|
+
Method Use When
|
|
106
|
+
eric.decide() You want Eric to choose the correct flow automatically
|
|
107
|
+
eric.decide({ allowedFlows: [...] }) You want Eric to choose, but only within a safe controlled list
|
|
108
|
+
eric.call() You already know which flow to use (like admin tools, backend tasks)
|
|
109
|
+
🧱 Full SDK API
|
|
110
|
+
eric.decide(options)
|
|
111
|
+
eric.decide({
|
|
112
|
+
text?: string;
|
|
113
|
+
userState?: Record<string, any>;
|
|
114
|
+
topic?: string;
|
|
115
|
+
allowedFlows?: string[];
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
|
|
121
|
+
{
|
|
122
|
+
flow: string;
|
|
123
|
+
type: "structured" | "text";
|
|
124
|
+
data: any;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
eric.call(flowName, data)
|
|
128
|
+
const out = await eric.call("shortTextSummary", {
|
|
129
|
+
text: "Make this clearer."
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
Equivalent to:
|
|
134
|
+
|
|
135
|
+
eric.runFlow({ flow: "shortTextSummary", data: {...} })
|
|
136
|
+
|
|
137
|
+
💬 Examples
|
|
138
|
+
Example 1 — Clean up an announcement (EventInterface admin)
|
|
139
|
+
const result = await eric.decide({
|
|
140
|
+
text: this.form.body,
|
|
141
|
+
allowedFlows: ["announcementRewriter"],
|
|
142
|
+
userState: {
|
|
143
|
+
tone: "energetic",
|
|
144
|
+
length: 150,
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
this.aiSummary = result.data.rewritten;
|
|
149
|
+
|
|
150
|
+
Example 2 — Generate a summary (default)
|
|
151
|
+
const result = await eric.decide({
|
|
152
|
+
text: "Here is a long announcement, please make it shorter."
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
May produce:
|
|
157
|
+
|
|
158
|
+
shortTextSummary
|
|
159
|
+
|
|
160
|
+
announcementRewriter
|
|
161
|
+
(depends on the text)
|
|
162
|
+
|
|
163
|
+
Example 3 — Force a specific flow
|
|
164
|
+
await eric.call("speakerPerformanceAnalyzer", {
|
|
165
|
+
speakerName: "Jane Doe",
|
|
166
|
+
feedbackComments: ["Loved the energy!", "Slides were unclear"]
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
🧩 Supported Flows
|
|
170
|
+
Common
|
|
171
|
+
|
|
172
|
+
shortTextSummary
|
|
173
|
+
|
|
174
|
+
questionAnswerHelper
|
|
175
|
+
|
|
176
|
+
dailyNudgeGenerator
|
|
177
|
+
|
|
178
|
+
Wellness
|
|
179
|
+
|
|
180
|
+
aiCoachFeedback
|
|
181
|
+
|
|
182
|
+
personalizedSessionRecommender
|
|
183
|
+
|
|
184
|
+
wellnessProgressReporter
|
|
185
|
+
|
|
186
|
+
trendInsightReporter
|
|
187
|
+
|
|
188
|
+
Events
|
|
189
|
+
|
|
190
|
+
eventSummaryDigest
|
|
191
|
+
|
|
192
|
+
speakerPerformanceAnalyzer
|
|
193
|
+
|
|
194
|
+
networkingMatchmaker
|
|
195
|
+
|
|
196
|
+
attendeeEngagementReporter
|
|
197
|
+
|
|
198
|
+
eventPulseReport
|
|
199
|
+
|
|
200
|
+
sessionRecapGenerator
|
|
201
|
+
|
|
202
|
+
sponsorValueSummary
|
|
203
|
+
|
|
204
|
+
announcementRewriter
|
|
205
|
+
|
|
206
|
+
Business / Workplace
|
|
207
|
+
|
|
208
|
+
leadershipInsight
|
|
209
|
+
|
|
210
|
+
feedbackInsightAnalyzer
|
|
211
|
+
|
|
212
|
+
performanceReviewAssistant
|
|
213
|
+
|
|
214
|
+
teamDynamicsAnalyzer
|
|
215
|
+
|
|
216
|
+
productivityCoach
|
|
217
|
+
|
|
218
|
+
🌐 Configuration
|
|
219
|
+
new EricSDK({
|
|
220
|
+
apiKey: "YOUR_API_KEY",
|
|
221
|
+
client: "your-client-id",
|
|
222
|
+
baseUrl: "https://us-central1-eric-ai-prod.cloudfunctions.net/runFlow"
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
🔧 Local Development
|
|
226
|
+
npm link
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
In your other project:
|
|
230
|
+
|
|
231
|
+
npm link eric-sdk
|
|
232
|
+
|
|
233
|
+
📄 License
|
|
234
|
+
|
|
235
|
+
MIT © 2025
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
EricSDK: () => EricSDK,
|
|
34
|
+
isAICoachFeedback: () => isAICoachFeedback,
|
|
35
|
+
isAnnouncementRewrite: () => isAnnouncementRewrite,
|
|
36
|
+
isAttendeeEngagement: () => isAttendeeEngagement,
|
|
37
|
+
isEventPulse: () => isEventPulse,
|
|
38
|
+
isEventSummary: () => isEventSummary,
|
|
39
|
+
isFeedbackInsight: () => isFeedbackInsight,
|
|
40
|
+
isLeadershipInsight: () => isLeadershipInsight,
|
|
41
|
+
isNetworkingMatches: () => isNetworkingMatches,
|
|
42
|
+
isNudge: () => isNudge,
|
|
43
|
+
isPerformanceReview: () => isPerformanceReview,
|
|
44
|
+
isProductivityInsight: () => isProductivityInsight,
|
|
45
|
+
isQA: () => isQA,
|
|
46
|
+
isRecommendation: () => isRecommendation,
|
|
47
|
+
isSessionRecap: () => isSessionRecap,
|
|
48
|
+
isSpeakerPerformance: () => isSpeakerPerformance,
|
|
49
|
+
isSponsorSummary: () => isSponsorSummary,
|
|
50
|
+
isSummary: () => isSummary,
|
|
51
|
+
isTeamDynamics: () => isTeamDynamics,
|
|
52
|
+
isTrendInsight: () => isTrendInsight,
|
|
53
|
+
isWellnessProgress: () => isWellnessProgress
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(index_exports);
|
|
56
|
+
|
|
57
|
+
// src/client.ts
|
|
58
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
59
|
+
var EricSDK = class {
|
|
60
|
+
constructor(options) {
|
|
61
|
+
this.apiKey = options.apiKey;
|
|
62
|
+
this.client = options.client;
|
|
63
|
+
this.appId = options.appId;
|
|
64
|
+
this.baseUrl = options.baseUrl ?? "https://us-central1-eric-ai-prod.cloudfunctions.net/runFlow";
|
|
65
|
+
}
|
|
66
|
+
/* -------------------------------------------------------------
|
|
67
|
+
* 1) DIRECT CALL — developer explicitly chooses the flow
|
|
68
|
+
* ------------------------------------------------------------- */
|
|
69
|
+
async call(flowName, data) {
|
|
70
|
+
const payload = {
|
|
71
|
+
flow: flowName,
|
|
72
|
+
data: {
|
|
73
|
+
...data,
|
|
74
|
+
client: this.client,
|
|
75
|
+
appId: this.appId
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const res = await import_axios.default.post(this.baseUrl, payload, {
|
|
79
|
+
headers: {
|
|
80
|
+
"x-api-key": this.apiKey,
|
|
81
|
+
"x-api-client": this.client,
|
|
82
|
+
"Content-Type": "application/json"
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return res.data.output;
|
|
86
|
+
}
|
|
87
|
+
/* -------------------------------------------------------------
|
|
88
|
+
* 2) DECIDE — agentic routing with optional allowedFlows
|
|
89
|
+
* ------------------------------------------------------------- */
|
|
90
|
+
async decide(data) {
|
|
91
|
+
const { allowedFlows, ...rest } = data;
|
|
92
|
+
const payload = {
|
|
93
|
+
flow: "policyDecisionMaker",
|
|
94
|
+
data: {
|
|
95
|
+
...rest,
|
|
96
|
+
client: this.client,
|
|
97
|
+
appId: this.appId
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
if (allowedFlows) {
|
|
101
|
+
payload.data.allowedFlows = allowedFlows;
|
|
102
|
+
}
|
|
103
|
+
const res = await import_axios.default.post(this.baseUrl, payload, {
|
|
104
|
+
headers: {
|
|
105
|
+
"x-api-key": this.apiKey,
|
|
106
|
+
"x-api-client": this.client,
|
|
107
|
+
"Content-Type": "application/json"
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return res.data.output;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// src/flows/helper.ts
|
|
115
|
+
function isSummary(result) {
|
|
116
|
+
return result.flow === "shortTextSummary";
|
|
117
|
+
}
|
|
118
|
+
function isQA(result) {
|
|
119
|
+
return result.flow === "questionAnswerHelper";
|
|
120
|
+
}
|
|
121
|
+
function isNudge(result) {
|
|
122
|
+
return result.flow === "dailyNudgeGenerator";
|
|
123
|
+
}
|
|
124
|
+
function isRecommendation(result) {
|
|
125
|
+
return result.flow === "personalizedSessionRecommender";
|
|
126
|
+
}
|
|
127
|
+
function isAICoachFeedback(result) {
|
|
128
|
+
return result.flow === "aiCoachFeedback";
|
|
129
|
+
}
|
|
130
|
+
function isWellnessProgress(result) {
|
|
131
|
+
return result.flow === "wellnessProgressReporter";
|
|
132
|
+
}
|
|
133
|
+
function isTrendInsight(result) {
|
|
134
|
+
return result.flow === "trendInsightReporter";
|
|
135
|
+
}
|
|
136
|
+
function isEventSummary(result) {
|
|
137
|
+
return result.flow === "eventSummaryDigest";
|
|
138
|
+
}
|
|
139
|
+
function isSpeakerPerformance(result) {
|
|
140
|
+
return result.flow === "speakerPerformanceAnalyzer";
|
|
141
|
+
}
|
|
142
|
+
function isNetworkingMatches(result) {
|
|
143
|
+
return result.flow === "networkingMatchmaker";
|
|
144
|
+
}
|
|
145
|
+
function isAttendeeEngagement(result) {
|
|
146
|
+
return result.flow === "attendeeEngagementReporter";
|
|
147
|
+
}
|
|
148
|
+
function isEventPulse(result) {
|
|
149
|
+
return result.flow === "eventPulseReport";
|
|
150
|
+
}
|
|
151
|
+
function isSessionRecap(result) {
|
|
152
|
+
return result.flow === "sessionRecapGenerator";
|
|
153
|
+
}
|
|
154
|
+
function isSponsorSummary(result) {
|
|
155
|
+
return result.flow === "sponsorValueSummary";
|
|
156
|
+
}
|
|
157
|
+
function isAnnouncementRewrite(result) {
|
|
158
|
+
return result.flow === "announcementRewriter";
|
|
159
|
+
}
|
|
160
|
+
function isLeadershipInsight(result) {
|
|
161
|
+
return result.flow === "leadershipInsight";
|
|
162
|
+
}
|
|
163
|
+
function isFeedbackInsight(result) {
|
|
164
|
+
return result.flow === "feedbackInsightAnalyzer";
|
|
165
|
+
}
|
|
166
|
+
function isProductivityInsight(result) {
|
|
167
|
+
return result.flow === "productivityCoach";
|
|
168
|
+
}
|
|
169
|
+
function isTeamDynamics(result) {
|
|
170
|
+
return result.flow === "teamDynamicsAnalyzer";
|
|
171
|
+
}
|
|
172
|
+
function isPerformanceReview(result) {
|
|
173
|
+
return result.flow === "performanceReviewAssistant";
|
|
174
|
+
}
|
|
175
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
176
|
+
0 && (module.exports = {
|
|
177
|
+
EricSDK,
|
|
178
|
+
isAICoachFeedback,
|
|
179
|
+
isAnnouncementRewrite,
|
|
180
|
+
isAttendeeEngagement,
|
|
181
|
+
isEventPulse,
|
|
182
|
+
isEventSummary,
|
|
183
|
+
isFeedbackInsight,
|
|
184
|
+
isLeadershipInsight,
|
|
185
|
+
isNetworkingMatches,
|
|
186
|
+
isNudge,
|
|
187
|
+
isPerformanceReview,
|
|
188
|
+
isProductivityInsight,
|
|
189
|
+
isQA,
|
|
190
|
+
isRecommendation,
|
|
191
|
+
isSessionRecap,
|
|
192
|
+
isSpeakerPerformance,
|
|
193
|
+
isSponsorSummary,
|
|
194
|
+
isSummary,
|
|
195
|
+
isTeamDynamics,
|
|
196
|
+
isTrendInsight,
|
|
197
|
+
isWellnessProgress
|
|
198
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
interface EricClientOptions {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
client: string;
|
|
4
|
+
appId: "wellness" | "events" | "business";
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
interface EricResponse {
|
|
8
|
+
flow: string;
|
|
9
|
+
type: string;
|
|
10
|
+
data: any;
|
|
11
|
+
}
|
|
12
|
+
declare class EricSDK {
|
|
13
|
+
private apiKey;
|
|
14
|
+
private client;
|
|
15
|
+
private appId;
|
|
16
|
+
private baseUrl;
|
|
17
|
+
constructor(options: EricClientOptions);
|
|
18
|
+
call(flowName: string, data: any): Promise<EricResponse>;
|
|
19
|
+
decide(data: {
|
|
20
|
+
text: string;
|
|
21
|
+
topic?: string;
|
|
22
|
+
userState?: any;
|
|
23
|
+
allowedFlows?: string[];
|
|
24
|
+
}): Promise<EricResponse>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ShortTextSummary {
|
|
28
|
+
summary: string;
|
|
29
|
+
}
|
|
30
|
+
interface QAItem {
|
|
31
|
+
question: string;
|
|
32
|
+
answer: string;
|
|
33
|
+
}
|
|
34
|
+
interface QuestionAnswerSummary {
|
|
35
|
+
summary: string;
|
|
36
|
+
questions: QAItem[];
|
|
37
|
+
}
|
|
38
|
+
interface DailyNudge {
|
|
39
|
+
nudge: string;
|
|
40
|
+
}
|
|
41
|
+
interface RecommendationItem {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
reason: string;
|
|
45
|
+
}
|
|
46
|
+
interface SessionRecommendation {
|
|
47
|
+
recommendations: RecommendationItem[];
|
|
48
|
+
rationale: string;
|
|
49
|
+
}
|
|
50
|
+
interface AICoachFeedback {
|
|
51
|
+
summary: string;
|
|
52
|
+
encouragement: string;
|
|
53
|
+
suggestedNextFocus: string;
|
|
54
|
+
tone: string;
|
|
55
|
+
}
|
|
56
|
+
interface WellnessProgress {
|
|
57
|
+
summary: string;
|
|
58
|
+
encouragement: string;
|
|
59
|
+
tone: string;
|
|
60
|
+
}
|
|
61
|
+
interface TrendInsight {
|
|
62
|
+
trendSummary: string;
|
|
63
|
+
emotionalPattern: string;
|
|
64
|
+
recommendation: string;
|
|
65
|
+
tone: string;
|
|
66
|
+
}
|
|
67
|
+
interface EventSummaryDigest {
|
|
68
|
+
summary: string;
|
|
69
|
+
highlights: string[];
|
|
70
|
+
tone: string;
|
|
71
|
+
}
|
|
72
|
+
interface SpeakerPerformance {
|
|
73
|
+
overview: string;
|
|
74
|
+
strengths: string[];
|
|
75
|
+
areasForImprovement: string[];
|
|
76
|
+
tone: string;
|
|
77
|
+
}
|
|
78
|
+
interface NetworkingMatches {
|
|
79
|
+
matches: string[];
|
|
80
|
+
rationale: string;
|
|
81
|
+
}
|
|
82
|
+
interface AttendeeEngagement {
|
|
83
|
+
overview: string;
|
|
84
|
+
topSessions: string[];
|
|
85
|
+
recommendations: string[];
|
|
86
|
+
tone: string;
|
|
87
|
+
}
|
|
88
|
+
interface EventPulse {
|
|
89
|
+
trendSummary: string;
|
|
90
|
+
sentimentOverview: string;
|
|
91
|
+
engagementInsights: string;
|
|
92
|
+
recommendation: string;
|
|
93
|
+
tone: string;
|
|
94
|
+
}
|
|
95
|
+
interface SessionRecap {
|
|
96
|
+
recap: string;
|
|
97
|
+
takeaways: string[];
|
|
98
|
+
tone: string;
|
|
99
|
+
}
|
|
100
|
+
interface SponsorValueSummary {
|
|
101
|
+
overview: string;
|
|
102
|
+
highlights: string[];
|
|
103
|
+
tone: string;
|
|
104
|
+
}
|
|
105
|
+
interface AnnouncementRewrite {
|
|
106
|
+
rewritten: string;
|
|
107
|
+
toneUsed: string;
|
|
108
|
+
}
|
|
109
|
+
interface LeadershipInsight {
|
|
110
|
+
insight: string;
|
|
111
|
+
rootCause: string;
|
|
112
|
+
practicalSteps: string[];
|
|
113
|
+
tone: string;
|
|
114
|
+
}
|
|
115
|
+
interface FeedbackInsight {
|
|
116
|
+
sentiment: string;
|
|
117
|
+
summary: string;
|
|
118
|
+
highlights: string[];
|
|
119
|
+
}
|
|
120
|
+
interface PerformanceReview {
|
|
121
|
+
summaryParagraph: string;
|
|
122
|
+
strengthsSection: string[];
|
|
123
|
+
growthSection: string[];
|
|
124
|
+
tone: string;
|
|
125
|
+
}
|
|
126
|
+
interface TeamDynamics {
|
|
127
|
+
diagnosis: string;
|
|
128
|
+
risks: string[];
|
|
129
|
+
suggestedMoves: string[];
|
|
130
|
+
tone: string;
|
|
131
|
+
}
|
|
132
|
+
interface ProductivityInsight {
|
|
133
|
+
insight: string;
|
|
134
|
+
suggestions: string[];
|
|
135
|
+
tone: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
declare function isSummary(result: any): result is {
|
|
139
|
+
data: ShortTextSummary;
|
|
140
|
+
};
|
|
141
|
+
declare function isQA(result: any): result is {
|
|
142
|
+
data: QuestionAnswerSummary;
|
|
143
|
+
};
|
|
144
|
+
declare function isNudge(result: any): result is {
|
|
145
|
+
data: DailyNudge;
|
|
146
|
+
};
|
|
147
|
+
declare function isRecommendation(result: any): result is {
|
|
148
|
+
data: SessionRecommendation;
|
|
149
|
+
};
|
|
150
|
+
declare function isAICoachFeedback(result: any): result is {
|
|
151
|
+
data: AICoachFeedback;
|
|
152
|
+
};
|
|
153
|
+
declare function isWellnessProgress(result: any): result is {
|
|
154
|
+
data: WellnessProgress;
|
|
155
|
+
};
|
|
156
|
+
declare function isTrendInsight(result: any): result is {
|
|
157
|
+
data: TrendInsight;
|
|
158
|
+
};
|
|
159
|
+
declare function isEventSummary(result: any): result is {
|
|
160
|
+
data: EventSummaryDigest;
|
|
161
|
+
};
|
|
162
|
+
declare function isSpeakerPerformance(result: any): result is {
|
|
163
|
+
data: SpeakerPerformance;
|
|
164
|
+
};
|
|
165
|
+
declare function isNetworkingMatches(result: any): result is {
|
|
166
|
+
data: NetworkingMatches;
|
|
167
|
+
};
|
|
168
|
+
declare function isAttendeeEngagement(result: any): result is {
|
|
169
|
+
data: AttendeeEngagement;
|
|
170
|
+
};
|
|
171
|
+
declare function isEventPulse(result: any): result is {
|
|
172
|
+
data: EventPulse;
|
|
173
|
+
};
|
|
174
|
+
declare function isSessionRecap(result: any): result is {
|
|
175
|
+
data: SessionRecap;
|
|
176
|
+
};
|
|
177
|
+
declare function isSponsorSummary(result: any): result is {
|
|
178
|
+
data: SponsorValueSummary;
|
|
179
|
+
};
|
|
180
|
+
declare function isAnnouncementRewrite(result: any): result is {
|
|
181
|
+
data: AnnouncementRewrite;
|
|
182
|
+
};
|
|
183
|
+
declare function isLeadershipInsight(result: any): result is {
|
|
184
|
+
data: LeadershipInsight;
|
|
185
|
+
};
|
|
186
|
+
declare function isFeedbackInsight(result: any): result is {
|
|
187
|
+
data: FeedbackInsight;
|
|
188
|
+
};
|
|
189
|
+
declare function isProductivityInsight(result: any): result is {
|
|
190
|
+
data: ProductivityInsight;
|
|
191
|
+
};
|
|
192
|
+
declare function isTeamDynamics(result: any): result is {
|
|
193
|
+
data: TeamDynamics;
|
|
194
|
+
};
|
|
195
|
+
declare function isPerformanceReview(result: any): result is {
|
|
196
|
+
data: PerformanceReview;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export { type AICoachFeedback, type AnnouncementRewrite, type AttendeeEngagement, type DailyNudge, type EricClientOptions, type EricResponse, EricSDK, type EventPulse, type EventSummaryDigest, type FeedbackInsight, type LeadershipInsight, type NetworkingMatches, type PerformanceReview, type ProductivityInsight, type QAItem, type QuestionAnswerSummary, type RecommendationItem, type SessionRecap, type SessionRecommendation, type ShortTextSummary, type SpeakerPerformance, type SponsorValueSummary, type TeamDynamics, type TrendInsight, type WellnessProgress, isAICoachFeedback, isAnnouncementRewrite, isAttendeeEngagement, isEventPulse, isEventSummary, isFeedbackInsight, isLeadershipInsight, isNetworkingMatches, isNudge, isPerformanceReview, isProductivityInsight, isQA, isRecommendation, isSessionRecap, isSpeakerPerformance, isSponsorSummary, isSummary, isTeamDynamics, isTrendInsight, isWellnessProgress };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
interface EricClientOptions {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
client: string;
|
|
4
|
+
appId: "wellness" | "events" | "business";
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
interface EricResponse {
|
|
8
|
+
flow: string;
|
|
9
|
+
type: string;
|
|
10
|
+
data: any;
|
|
11
|
+
}
|
|
12
|
+
declare class EricSDK {
|
|
13
|
+
private apiKey;
|
|
14
|
+
private client;
|
|
15
|
+
private appId;
|
|
16
|
+
private baseUrl;
|
|
17
|
+
constructor(options: EricClientOptions);
|
|
18
|
+
call(flowName: string, data: any): Promise<EricResponse>;
|
|
19
|
+
decide(data: {
|
|
20
|
+
text: string;
|
|
21
|
+
topic?: string;
|
|
22
|
+
userState?: any;
|
|
23
|
+
allowedFlows?: string[];
|
|
24
|
+
}): Promise<EricResponse>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ShortTextSummary {
|
|
28
|
+
summary: string;
|
|
29
|
+
}
|
|
30
|
+
interface QAItem {
|
|
31
|
+
question: string;
|
|
32
|
+
answer: string;
|
|
33
|
+
}
|
|
34
|
+
interface QuestionAnswerSummary {
|
|
35
|
+
summary: string;
|
|
36
|
+
questions: QAItem[];
|
|
37
|
+
}
|
|
38
|
+
interface DailyNudge {
|
|
39
|
+
nudge: string;
|
|
40
|
+
}
|
|
41
|
+
interface RecommendationItem {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
reason: string;
|
|
45
|
+
}
|
|
46
|
+
interface SessionRecommendation {
|
|
47
|
+
recommendations: RecommendationItem[];
|
|
48
|
+
rationale: string;
|
|
49
|
+
}
|
|
50
|
+
interface AICoachFeedback {
|
|
51
|
+
summary: string;
|
|
52
|
+
encouragement: string;
|
|
53
|
+
suggestedNextFocus: string;
|
|
54
|
+
tone: string;
|
|
55
|
+
}
|
|
56
|
+
interface WellnessProgress {
|
|
57
|
+
summary: string;
|
|
58
|
+
encouragement: string;
|
|
59
|
+
tone: string;
|
|
60
|
+
}
|
|
61
|
+
interface TrendInsight {
|
|
62
|
+
trendSummary: string;
|
|
63
|
+
emotionalPattern: string;
|
|
64
|
+
recommendation: string;
|
|
65
|
+
tone: string;
|
|
66
|
+
}
|
|
67
|
+
interface EventSummaryDigest {
|
|
68
|
+
summary: string;
|
|
69
|
+
highlights: string[];
|
|
70
|
+
tone: string;
|
|
71
|
+
}
|
|
72
|
+
interface SpeakerPerformance {
|
|
73
|
+
overview: string;
|
|
74
|
+
strengths: string[];
|
|
75
|
+
areasForImprovement: string[];
|
|
76
|
+
tone: string;
|
|
77
|
+
}
|
|
78
|
+
interface NetworkingMatches {
|
|
79
|
+
matches: string[];
|
|
80
|
+
rationale: string;
|
|
81
|
+
}
|
|
82
|
+
interface AttendeeEngagement {
|
|
83
|
+
overview: string;
|
|
84
|
+
topSessions: string[];
|
|
85
|
+
recommendations: string[];
|
|
86
|
+
tone: string;
|
|
87
|
+
}
|
|
88
|
+
interface EventPulse {
|
|
89
|
+
trendSummary: string;
|
|
90
|
+
sentimentOverview: string;
|
|
91
|
+
engagementInsights: string;
|
|
92
|
+
recommendation: string;
|
|
93
|
+
tone: string;
|
|
94
|
+
}
|
|
95
|
+
interface SessionRecap {
|
|
96
|
+
recap: string;
|
|
97
|
+
takeaways: string[];
|
|
98
|
+
tone: string;
|
|
99
|
+
}
|
|
100
|
+
interface SponsorValueSummary {
|
|
101
|
+
overview: string;
|
|
102
|
+
highlights: string[];
|
|
103
|
+
tone: string;
|
|
104
|
+
}
|
|
105
|
+
interface AnnouncementRewrite {
|
|
106
|
+
rewritten: string;
|
|
107
|
+
toneUsed: string;
|
|
108
|
+
}
|
|
109
|
+
interface LeadershipInsight {
|
|
110
|
+
insight: string;
|
|
111
|
+
rootCause: string;
|
|
112
|
+
practicalSteps: string[];
|
|
113
|
+
tone: string;
|
|
114
|
+
}
|
|
115
|
+
interface FeedbackInsight {
|
|
116
|
+
sentiment: string;
|
|
117
|
+
summary: string;
|
|
118
|
+
highlights: string[];
|
|
119
|
+
}
|
|
120
|
+
interface PerformanceReview {
|
|
121
|
+
summaryParagraph: string;
|
|
122
|
+
strengthsSection: string[];
|
|
123
|
+
growthSection: string[];
|
|
124
|
+
tone: string;
|
|
125
|
+
}
|
|
126
|
+
interface TeamDynamics {
|
|
127
|
+
diagnosis: string;
|
|
128
|
+
risks: string[];
|
|
129
|
+
suggestedMoves: string[];
|
|
130
|
+
tone: string;
|
|
131
|
+
}
|
|
132
|
+
interface ProductivityInsight {
|
|
133
|
+
insight: string;
|
|
134
|
+
suggestions: string[];
|
|
135
|
+
tone: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
declare function isSummary(result: any): result is {
|
|
139
|
+
data: ShortTextSummary;
|
|
140
|
+
};
|
|
141
|
+
declare function isQA(result: any): result is {
|
|
142
|
+
data: QuestionAnswerSummary;
|
|
143
|
+
};
|
|
144
|
+
declare function isNudge(result: any): result is {
|
|
145
|
+
data: DailyNudge;
|
|
146
|
+
};
|
|
147
|
+
declare function isRecommendation(result: any): result is {
|
|
148
|
+
data: SessionRecommendation;
|
|
149
|
+
};
|
|
150
|
+
declare function isAICoachFeedback(result: any): result is {
|
|
151
|
+
data: AICoachFeedback;
|
|
152
|
+
};
|
|
153
|
+
declare function isWellnessProgress(result: any): result is {
|
|
154
|
+
data: WellnessProgress;
|
|
155
|
+
};
|
|
156
|
+
declare function isTrendInsight(result: any): result is {
|
|
157
|
+
data: TrendInsight;
|
|
158
|
+
};
|
|
159
|
+
declare function isEventSummary(result: any): result is {
|
|
160
|
+
data: EventSummaryDigest;
|
|
161
|
+
};
|
|
162
|
+
declare function isSpeakerPerformance(result: any): result is {
|
|
163
|
+
data: SpeakerPerformance;
|
|
164
|
+
};
|
|
165
|
+
declare function isNetworkingMatches(result: any): result is {
|
|
166
|
+
data: NetworkingMatches;
|
|
167
|
+
};
|
|
168
|
+
declare function isAttendeeEngagement(result: any): result is {
|
|
169
|
+
data: AttendeeEngagement;
|
|
170
|
+
};
|
|
171
|
+
declare function isEventPulse(result: any): result is {
|
|
172
|
+
data: EventPulse;
|
|
173
|
+
};
|
|
174
|
+
declare function isSessionRecap(result: any): result is {
|
|
175
|
+
data: SessionRecap;
|
|
176
|
+
};
|
|
177
|
+
declare function isSponsorSummary(result: any): result is {
|
|
178
|
+
data: SponsorValueSummary;
|
|
179
|
+
};
|
|
180
|
+
declare function isAnnouncementRewrite(result: any): result is {
|
|
181
|
+
data: AnnouncementRewrite;
|
|
182
|
+
};
|
|
183
|
+
declare function isLeadershipInsight(result: any): result is {
|
|
184
|
+
data: LeadershipInsight;
|
|
185
|
+
};
|
|
186
|
+
declare function isFeedbackInsight(result: any): result is {
|
|
187
|
+
data: FeedbackInsight;
|
|
188
|
+
};
|
|
189
|
+
declare function isProductivityInsight(result: any): result is {
|
|
190
|
+
data: ProductivityInsight;
|
|
191
|
+
};
|
|
192
|
+
declare function isTeamDynamics(result: any): result is {
|
|
193
|
+
data: TeamDynamics;
|
|
194
|
+
};
|
|
195
|
+
declare function isPerformanceReview(result: any): result is {
|
|
196
|
+
data: PerformanceReview;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export { type AICoachFeedback, type AnnouncementRewrite, type AttendeeEngagement, type DailyNudge, type EricClientOptions, type EricResponse, EricSDK, type EventPulse, type EventSummaryDigest, type FeedbackInsight, type LeadershipInsight, type NetworkingMatches, type PerformanceReview, type ProductivityInsight, type QAItem, type QuestionAnswerSummary, type RecommendationItem, type SessionRecap, type SessionRecommendation, type ShortTextSummary, type SpeakerPerformance, type SponsorValueSummary, type TeamDynamics, type TrendInsight, type WellnessProgress, isAICoachFeedback, isAnnouncementRewrite, isAttendeeEngagement, isEventPulse, isEventSummary, isFeedbackInsight, isLeadershipInsight, isNetworkingMatches, isNudge, isPerformanceReview, isProductivityInsight, isQA, isRecommendation, isSessionRecap, isSpeakerPerformance, isSponsorSummary, isSummary, isTeamDynamics, isTrendInsight, isWellnessProgress };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
var EricSDK = class {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this.apiKey = options.apiKey;
|
|
6
|
+
this.client = options.client;
|
|
7
|
+
this.appId = options.appId;
|
|
8
|
+
this.baseUrl = options.baseUrl ?? "https://us-central1-eric-ai-prod.cloudfunctions.net/runFlow";
|
|
9
|
+
}
|
|
10
|
+
/* -------------------------------------------------------------
|
|
11
|
+
* 1) DIRECT CALL — developer explicitly chooses the flow
|
|
12
|
+
* ------------------------------------------------------------- */
|
|
13
|
+
async call(flowName, data) {
|
|
14
|
+
const payload = {
|
|
15
|
+
flow: flowName,
|
|
16
|
+
data: {
|
|
17
|
+
...data,
|
|
18
|
+
client: this.client,
|
|
19
|
+
appId: this.appId
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const res = await axios.post(this.baseUrl, payload, {
|
|
23
|
+
headers: {
|
|
24
|
+
"x-api-key": this.apiKey,
|
|
25
|
+
"x-api-client": this.client,
|
|
26
|
+
"Content-Type": "application/json"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return res.data.output;
|
|
30
|
+
}
|
|
31
|
+
/* -------------------------------------------------------------
|
|
32
|
+
* 2) DECIDE — agentic routing with optional allowedFlows
|
|
33
|
+
* ------------------------------------------------------------- */
|
|
34
|
+
async decide(data) {
|
|
35
|
+
const { allowedFlows, ...rest } = data;
|
|
36
|
+
const payload = {
|
|
37
|
+
flow: "policyDecisionMaker",
|
|
38
|
+
data: {
|
|
39
|
+
...rest,
|
|
40
|
+
client: this.client,
|
|
41
|
+
appId: this.appId
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
if (allowedFlows) {
|
|
45
|
+
payload.data.allowedFlows = allowedFlows;
|
|
46
|
+
}
|
|
47
|
+
const res = await axios.post(this.baseUrl, payload, {
|
|
48
|
+
headers: {
|
|
49
|
+
"x-api-key": this.apiKey,
|
|
50
|
+
"x-api-client": this.client,
|
|
51
|
+
"Content-Type": "application/json"
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return res.data.output;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/flows/helper.ts
|
|
59
|
+
function isSummary(result) {
|
|
60
|
+
return result.flow === "shortTextSummary";
|
|
61
|
+
}
|
|
62
|
+
function isQA(result) {
|
|
63
|
+
return result.flow === "questionAnswerHelper";
|
|
64
|
+
}
|
|
65
|
+
function isNudge(result) {
|
|
66
|
+
return result.flow === "dailyNudgeGenerator";
|
|
67
|
+
}
|
|
68
|
+
function isRecommendation(result) {
|
|
69
|
+
return result.flow === "personalizedSessionRecommender";
|
|
70
|
+
}
|
|
71
|
+
function isAICoachFeedback(result) {
|
|
72
|
+
return result.flow === "aiCoachFeedback";
|
|
73
|
+
}
|
|
74
|
+
function isWellnessProgress(result) {
|
|
75
|
+
return result.flow === "wellnessProgressReporter";
|
|
76
|
+
}
|
|
77
|
+
function isTrendInsight(result) {
|
|
78
|
+
return result.flow === "trendInsightReporter";
|
|
79
|
+
}
|
|
80
|
+
function isEventSummary(result) {
|
|
81
|
+
return result.flow === "eventSummaryDigest";
|
|
82
|
+
}
|
|
83
|
+
function isSpeakerPerformance(result) {
|
|
84
|
+
return result.flow === "speakerPerformanceAnalyzer";
|
|
85
|
+
}
|
|
86
|
+
function isNetworkingMatches(result) {
|
|
87
|
+
return result.flow === "networkingMatchmaker";
|
|
88
|
+
}
|
|
89
|
+
function isAttendeeEngagement(result) {
|
|
90
|
+
return result.flow === "attendeeEngagementReporter";
|
|
91
|
+
}
|
|
92
|
+
function isEventPulse(result) {
|
|
93
|
+
return result.flow === "eventPulseReport";
|
|
94
|
+
}
|
|
95
|
+
function isSessionRecap(result) {
|
|
96
|
+
return result.flow === "sessionRecapGenerator";
|
|
97
|
+
}
|
|
98
|
+
function isSponsorSummary(result) {
|
|
99
|
+
return result.flow === "sponsorValueSummary";
|
|
100
|
+
}
|
|
101
|
+
function isAnnouncementRewrite(result) {
|
|
102
|
+
return result.flow === "announcementRewriter";
|
|
103
|
+
}
|
|
104
|
+
function isLeadershipInsight(result) {
|
|
105
|
+
return result.flow === "leadershipInsight";
|
|
106
|
+
}
|
|
107
|
+
function isFeedbackInsight(result) {
|
|
108
|
+
return result.flow === "feedbackInsightAnalyzer";
|
|
109
|
+
}
|
|
110
|
+
function isProductivityInsight(result) {
|
|
111
|
+
return result.flow === "productivityCoach";
|
|
112
|
+
}
|
|
113
|
+
function isTeamDynamics(result) {
|
|
114
|
+
return result.flow === "teamDynamicsAnalyzer";
|
|
115
|
+
}
|
|
116
|
+
function isPerformanceReview(result) {
|
|
117
|
+
return result.flow === "performanceReviewAssistant";
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
EricSDK,
|
|
121
|
+
isAICoachFeedback,
|
|
122
|
+
isAnnouncementRewrite,
|
|
123
|
+
isAttendeeEngagement,
|
|
124
|
+
isEventPulse,
|
|
125
|
+
isEventSummary,
|
|
126
|
+
isFeedbackInsight,
|
|
127
|
+
isLeadershipInsight,
|
|
128
|
+
isNetworkingMatches,
|
|
129
|
+
isNudge,
|
|
130
|
+
isPerformanceReview,
|
|
131
|
+
isProductivityInsight,
|
|
132
|
+
isQA,
|
|
133
|
+
isRecommendation,
|
|
134
|
+
isSessionRecap,
|
|
135
|
+
isSpeakerPerformance,
|
|
136
|
+
isSponsorSummary,
|
|
137
|
+
isSummary,
|
|
138
|
+
isTeamDynamics,
|
|
139
|
+
isTrendInsight,
|
|
140
|
+
isWellnessProgress
|
|
141
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eric-sdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Official SDK for interacting with the Eric AI Policy Engine",
|
|
5
|
+
"author": "Rod Bridges",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
|
|
8
|
+
"type": "module",
|
|
9
|
+
|
|
10
|
+
"main": "./dist/index.cjs",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"require": "./dist/index.cjs",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
24
|
+
"prepare": "npm run build",
|
|
25
|
+
"test": "echo \"No tests yet\""
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"axios": "^1.13.2",
|
|
30
|
+
"zod": "^4.1.13"
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"tsup": "^8.5.1",
|
|
35
|
+
"typescript": "^5.9.3"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
export interface EricClientOptions {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
client: string; // ingomu, eventinterface, etc.
|
|
6
|
+
appId: "wellness" | "events" | "business"; // REQUIRED for policy engine
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface EricResponse {
|
|
11
|
+
flow: string;
|
|
12
|
+
type: string;
|
|
13
|
+
data: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class EricSDK {
|
|
17
|
+
private apiKey: string;
|
|
18
|
+
private client: string;
|
|
19
|
+
private appId: string;
|
|
20
|
+
private baseUrl: string;
|
|
21
|
+
|
|
22
|
+
constructor(options: EricClientOptions) {
|
|
23
|
+
this.apiKey = options.apiKey;
|
|
24
|
+
this.client = options.client;
|
|
25
|
+
this.appId = options.appId; // <-- FIXED: needed for policy input
|
|
26
|
+
this.baseUrl =
|
|
27
|
+
options.baseUrl ??
|
|
28
|
+
"https://us-central1-eric-ai-prod.cloudfunctions.net/runFlow";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* -------------------------------------------------------------
|
|
32
|
+
* 1) DIRECT CALL — developer explicitly chooses the flow
|
|
33
|
+
* ------------------------------------------------------------- */
|
|
34
|
+
async call(flowName: string, data: any): Promise<EricResponse> {
|
|
35
|
+
const payload = {
|
|
36
|
+
flow: flowName,
|
|
37
|
+
data: {
|
|
38
|
+
...data,
|
|
39
|
+
client: this.client,
|
|
40
|
+
appId: this.appId
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const res = await axios.post(this.baseUrl, payload, {
|
|
45
|
+
headers: {
|
|
46
|
+
"x-api-key": this.apiKey,
|
|
47
|
+
"x-api-client": this.client,
|
|
48
|
+
"Content-Type": "application/json",
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return res.data.output;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* -------------------------------------------------------------
|
|
56
|
+
* 2) DECIDE — agentic routing with optional allowedFlows
|
|
57
|
+
* ------------------------------------------------------------- */
|
|
58
|
+
async decide(data: {
|
|
59
|
+
text: string;
|
|
60
|
+
topic?: string;
|
|
61
|
+
userState?: any;
|
|
62
|
+
allowedFlows?: string[];
|
|
63
|
+
}): Promise<EricResponse> {
|
|
64
|
+
const { allowedFlows, ...rest } = data;
|
|
65
|
+
|
|
66
|
+
const payload: any = {
|
|
67
|
+
flow: "policyDecisionMaker",
|
|
68
|
+
data: {
|
|
69
|
+
...rest,
|
|
70
|
+
client: this.client,
|
|
71
|
+
appId: this.appId
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
if (allowedFlows) {
|
|
76
|
+
payload.data.allowedFlows = allowedFlows;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const res = await axios.post(this.baseUrl, payload, {
|
|
80
|
+
headers: {
|
|
81
|
+
"x-api-key": this.apiKey,
|
|
82
|
+
"x-api-client": this.client,
|
|
83
|
+
"Content-Type": "application/json",
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return res.data.output;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShortTextSummary,
|
|
3
|
+
QuestionAnswerSummary,
|
|
4
|
+
DailyNudge,
|
|
5
|
+
SessionRecommendation,
|
|
6
|
+
AICoachFeedback,
|
|
7
|
+
WellnessProgress,
|
|
8
|
+
TrendInsight,
|
|
9
|
+
EventSummaryDigest,
|
|
10
|
+
SpeakerPerformance,
|
|
11
|
+
NetworkingMatches,
|
|
12
|
+
AttendeeEngagement,
|
|
13
|
+
EventPulse,
|
|
14
|
+
SessionRecap,
|
|
15
|
+
SponsorValueSummary,
|
|
16
|
+
AnnouncementRewrite,
|
|
17
|
+
LeadershipInsight,
|
|
18
|
+
FeedbackInsight,
|
|
19
|
+
PerformanceReview,
|
|
20
|
+
TeamDynamics,
|
|
21
|
+
ProductivityInsight
|
|
22
|
+
} from "../types/flow";
|
|
23
|
+
|
|
24
|
+
// COMMON ---------------------------------------------------
|
|
25
|
+
|
|
26
|
+
export function isSummary(result: any): result is { data: ShortTextSummary } {
|
|
27
|
+
return result.flow === "shortTextSummary";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function isQA(result: any): result is { data: QuestionAnswerSummary } {
|
|
31
|
+
return result.flow === "questionAnswerHelper";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isNudge(result: any): result is { data: DailyNudge } {
|
|
35
|
+
return result.flow === "dailyNudgeGenerator";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// WELLNESS --------------------------------------------------
|
|
39
|
+
|
|
40
|
+
export function isRecommendation(result: any): result is { data: SessionRecommendation } {
|
|
41
|
+
return result.flow === "personalizedSessionRecommender";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function isAICoachFeedback(result: any): result is { data: AICoachFeedback } {
|
|
45
|
+
return result.flow === "aiCoachFeedback";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function isWellnessProgress(result: any): result is { data: WellnessProgress } {
|
|
49
|
+
return result.flow === "wellnessProgressReporter";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function isTrendInsight(result: any): result is { data: TrendInsight } {
|
|
53
|
+
return result.flow === "trendInsightReporter";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// EVENTS ----------------------------------------------------
|
|
57
|
+
|
|
58
|
+
export function isEventSummary(result: any): result is { data: EventSummaryDigest } {
|
|
59
|
+
return result.flow === "eventSummaryDigest";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function isSpeakerPerformance(result: any): result is { data: SpeakerPerformance } {
|
|
63
|
+
return result.flow === "speakerPerformanceAnalyzer";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function isNetworkingMatches(result: any): result is { data: NetworkingMatches } {
|
|
67
|
+
return result.flow === "networkingMatchmaker";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function isAttendeeEngagement(result: any): result is { data: AttendeeEngagement } {
|
|
71
|
+
return result.flow === "attendeeEngagementReporter";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function isEventPulse(result: any): result is { data: EventPulse } {
|
|
75
|
+
return result.flow === "eventPulseReport";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function isSessionRecap(result: any): result is { data: SessionRecap } {
|
|
79
|
+
return result.flow === "sessionRecapGenerator";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function isSponsorSummary(result: any): result is { data: SponsorValueSummary } {
|
|
83
|
+
return result.flow === "sponsorValueSummary";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function isAnnouncementRewrite(result: any): result is { data: AnnouncementRewrite } {
|
|
87
|
+
return result.flow === "announcementRewriter";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// BUSINESS --------------------------------------------------
|
|
91
|
+
|
|
92
|
+
export function isLeadershipInsight(result: any): result is { data: LeadershipInsight } {
|
|
93
|
+
return result.flow === "leadershipInsight";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function isFeedbackInsight(result: any): result is { data: FeedbackInsight } {
|
|
97
|
+
return result.flow === "feedbackInsightAnalyzer";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function isProductivityInsight(result: any): result is { data: ProductivityInsight } {
|
|
101
|
+
return result.flow === "productivityCoach";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function isTeamDynamics(result: any): result is { data: TeamDynamics } {
|
|
105
|
+
return result.flow === "teamDynamicsAnalyzer";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function isPerformanceReview(result: any): result is { data: PerformanceReview } {
|
|
109
|
+
return result.flow === "performanceReviewAssistant";
|
|
110
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// COMMON --------------------------------------------------
|
|
2
|
+
|
|
3
|
+
export interface ShortTextSummary {
|
|
4
|
+
summary: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface QAItem {
|
|
8
|
+
question: string;
|
|
9
|
+
answer: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface QuestionAnswerSummary {
|
|
13
|
+
summary: string;
|
|
14
|
+
questions: QAItem[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DailyNudge {
|
|
18
|
+
nudge: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// WELLNESS --------------------------------------------------
|
|
22
|
+
|
|
23
|
+
export interface RecommendationItem {
|
|
24
|
+
id: string;
|
|
25
|
+
title: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface SessionRecommendation {
|
|
30
|
+
recommendations: RecommendationItem[];
|
|
31
|
+
rationale: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AICoachFeedback {
|
|
35
|
+
summary: string;
|
|
36
|
+
encouragement: string;
|
|
37
|
+
suggestedNextFocus: string;
|
|
38
|
+
tone: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface WellnessProgress {
|
|
42
|
+
summary: string;
|
|
43
|
+
encouragement: string;
|
|
44
|
+
tone: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface TrendInsight {
|
|
48
|
+
trendSummary: string;
|
|
49
|
+
emotionalPattern: string;
|
|
50
|
+
recommendation: string;
|
|
51
|
+
tone: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// EVENTS ----------------------------------------------------
|
|
55
|
+
|
|
56
|
+
export interface EventSummaryDigest {
|
|
57
|
+
summary: string;
|
|
58
|
+
highlights: string[];
|
|
59
|
+
tone: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface SpeakerPerformance {
|
|
63
|
+
overview: string;
|
|
64
|
+
strengths: string[];
|
|
65
|
+
areasForImprovement: string[];
|
|
66
|
+
tone: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface NetworkingMatches {
|
|
70
|
+
matches: string[];
|
|
71
|
+
rationale: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface AttendeeEngagement {
|
|
75
|
+
overview: string;
|
|
76
|
+
topSessions: string[];
|
|
77
|
+
recommendations: string[];
|
|
78
|
+
tone: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface EventPulse {
|
|
82
|
+
trendSummary: string;
|
|
83
|
+
sentimentOverview: string;
|
|
84
|
+
engagementInsights: string;
|
|
85
|
+
recommendation: string;
|
|
86
|
+
tone: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface SessionRecap {
|
|
90
|
+
recap: string;
|
|
91
|
+
takeaways: string[];
|
|
92
|
+
tone: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface SponsorValueSummary {
|
|
96
|
+
overview: string;
|
|
97
|
+
highlights: string[];
|
|
98
|
+
tone: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface AnnouncementRewrite {
|
|
102
|
+
rewritten: string;
|
|
103
|
+
toneUsed: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// BUSINESS --------------------------------------------------
|
|
107
|
+
|
|
108
|
+
export interface LeadershipInsight {
|
|
109
|
+
insight: string;
|
|
110
|
+
rootCause: string;
|
|
111
|
+
practicalSteps: string[];
|
|
112
|
+
tone: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface FeedbackInsight {
|
|
116
|
+
sentiment: string;
|
|
117
|
+
summary: string;
|
|
118
|
+
highlights: string[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface PerformanceReview {
|
|
122
|
+
summaryParagraph: string;
|
|
123
|
+
strengthsSection: string[];
|
|
124
|
+
growthSection: string[];
|
|
125
|
+
tone: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface TeamDynamics {
|
|
129
|
+
diagnosis: string;
|
|
130
|
+
risks: string[];
|
|
131
|
+
suggestedMoves: string[];
|
|
132
|
+
tone: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ProductivityInsight {
|
|
136
|
+
insight: string;
|
|
137
|
+
suggestions: string[];
|
|
138
|
+
tone: string;
|
|
139
|
+
}
|
package/tsconfig.json
ADDED