eric-sdk 0.0.2 โ 0.0.4
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 +5 -3
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/src/client.ts +6 -6
package/README.md
CHANGED
|
@@ -14,10 +14,10 @@ Used in **Ingomu**, **EventInterface**, and early enterprise pilots.
|
|
|
14
14
|
* ๐ฏ Restricted auto-routing with `allowedFlows`
|
|
15
15
|
* ๐ง Direct flow execution with `eric.call()`
|
|
16
16
|
* ๐ Public vs Private API key security model
|
|
17
|
-
* ๐ง
|
|
17
|
+
* ๐ง Domain-aware tone and behavior (events, wellness, business)
|
|
18
18
|
* ๐ก๏ธ Domain whitelisting + rate limiting (public keys)
|
|
19
19
|
* ๐งฑ Strong TypeScript typing
|
|
20
|
-
* ๐งฐ Production-ready SDK backed by Cloud Functions
|
|
20
|
+
* ๐งฐ Production-ready SDK backed by Firebase Cloud Functions
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -281,6 +281,9 @@ new EricSDK({
|
|
|
281
281
|
});
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
+
> **Note:**
|
|
285
|
+
> Domain context (events, wellness, business) is derived server-side from the client identity and is not required in the SDK configuration.
|
|
286
|
+
|
|
284
287
|
---
|
|
285
288
|
|
|
286
289
|
## ๐งช Local Development
|
|
@@ -296,4 +299,3 @@ npm link eric-sdk
|
|
|
296
299
|
## ๐ License
|
|
297
300
|
|
|
298
301
|
MIT ยฉ 2025
|
|
299
|
-
|
package/dist/index.cjs
CHANGED
|
@@ -60,7 +60,6 @@ var EricSDK = class {
|
|
|
60
60
|
constructor(options) {
|
|
61
61
|
this.apiKey = options.apiKey;
|
|
62
62
|
this.client = options.client;
|
|
63
|
-
this.appId = options.appId;
|
|
64
63
|
this.baseUrl = options.baseUrl ?? "https://us-central1-eric-ai-prod.cloudfunctions.net/runFlow";
|
|
65
64
|
}
|
|
66
65
|
/* -------------------------------------------------------------
|
|
@@ -71,8 +70,7 @@ var EricSDK = class {
|
|
|
71
70
|
flow: flowName,
|
|
72
71
|
data: {
|
|
73
72
|
...data,
|
|
74
|
-
client: this.client
|
|
75
|
-
appId: this.appId
|
|
73
|
+
client: this.client
|
|
76
74
|
}
|
|
77
75
|
};
|
|
78
76
|
const res = await import_axios.default.post(this.baseUrl, payload, {
|
|
@@ -88,15 +86,17 @@ var EricSDK = class {
|
|
|
88
86
|
* 2) DECIDE โ agentic routing with optional allowedFlows
|
|
89
87
|
* ------------------------------------------------------------- */
|
|
90
88
|
async decide(data) {
|
|
91
|
-
const { allowedFlows, ...rest } = data;
|
|
89
|
+
const { allowedFlows, requestType, ...rest } = data;
|
|
92
90
|
const payload = {
|
|
93
91
|
flow: "decisionRouter",
|
|
94
92
|
data: {
|
|
95
93
|
...rest,
|
|
96
|
-
client: this.client
|
|
97
|
-
appId: this.appId
|
|
94
|
+
client: this.client
|
|
98
95
|
}
|
|
99
96
|
};
|
|
97
|
+
if (requestType) {
|
|
98
|
+
payload.data.requestType = requestType;
|
|
99
|
+
}
|
|
100
100
|
if (allowedFlows) {
|
|
101
101
|
payload.data.allowedFlows = allowedFlows;
|
|
102
102
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
interface EricClientOptions {
|
|
2
2
|
apiKey: string;
|
|
3
3
|
client: string;
|
|
4
|
-
appId: "wellness" | "events" | "business";
|
|
5
4
|
baseUrl?: string;
|
|
6
5
|
}
|
|
7
6
|
interface EricResponse {
|
|
@@ -12,13 +11,13 @@ interface EricResponse {
|
|
|
12
11
|
declare class EricSDK {
|
|
13
12
|
private apiKey;
|
|
14
13
|
private client;
|
|
15
|
-
private appId;
|
|
16
14
|
private baseUrl;
|
|
17
15
|
constructor(options: EricClientOptions);
|
|
18
16
|
call(flowName: string, data: any): Promise<EricResponse>;
|
|
19
17
|
decide(data: {
|
|
20
18
|
text: string;
|
|
21
19
|
topic?: string;
|
|
20
|
+
requestType?: string;
|
|
22
21
|
userState?: any;
|
|
23
22
|
allowedFlows?: string[];
|
|
24
23
|
}): Promise<EricResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
interface EricClientOptions {
|
|
2
2
|
apiKey: string;
|
|
3
3
|
client: string;
|
|
4
|
-
appId: "wellness" | "events" | "business";
|
|
5
4
|
baseUrl?: string;
|
|
6
5
|
}
|
|
7
6
|
interface EricResponse {
|
|
@@ -12,13 +11,13 @@ interface EricResponse {
|
|
|
12
11
|
declare class EricSDK {
|
|
13
12
|
private apiKey;
|
|
14
13
|
private client;
|
|
15
|
-
private appId;
|
|
16
14
|
private baseUrl;
|
|
17
15
|
constructor(options: EricClientOptions);
|
|
18
16
|
call(flowName: string, data: any): Promise<EricResponse>;
|
|
19
17
|
decide(data: {
|
|
20
18
|
text: string;
|
|
21
19
|
topic?: string;
|
|
20
|
+
requestType?: string;
|
|
22
21
|
userState?: any;
|
|
23
22
|
allowedFlows?: string[];
|
|
24
23
|
}): Promise<EricResponse>;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ var EricSDK = class {
|
|
|
4
4
|
constructor(options) {
|
|
5
5
|
this.apiKey = options.apiKey;
|
|
6
6
|
this.client = options.client;
|
|
7
|
-
this.appId = options.appId;
|
|
8
7
|
this.baseUrl = options.baseUrl ?? "https://us-central1-eric-ai-prod.cloudfunctions.net/runFlow";
|
|
9
8
|
}
|
|
10
9
|
/* -------------------------------------------------------------
|
|
@@ -15,8 +14,7 @@ var EricSDK = class {
|
|
|
15
14
|
flow: flowName,
|
|
16
15
|
data: {
|
|
17
16
|
...data,
|
|
18
|
-
client: this.client
|
|
19
|
-
appId: this.appId
|
|
17
|
+
client: this.client
|
|
20
18
|
}
|
|
21
19
|
};
|
|
22
20
|
const res = await axios.post(this.baseUrl, payload, {
|
|
@@ -32,15 +30,17 @@ var EricSDK = class {
|
|
|
32
30
|
* 2) DECIDE โ agentic routing with optional allowedFlows
|
|
33
31
|
* ------------------------------------------------------------- */
|
|
34
32
|
async decide(data) {
|
|
35
|
-
const { allowedFlows, ...rest } = data;
|
|
33
|
+
const { allowedFlows, requestType, ...rest } = data;
|
|
36
34
|
const payload = {
|
|
37
35
|
flow: "decisionRouter",
|
|
38
36
|
data: {
|
|
39
37
|
...rest,
|
|
40
|
-
client: this.client
|
|
41
|
-
appId: this.appId
|
|
38
|
+
client: this.client
|
|
42
39
|
}
|
|
43
40
|
};
|
|
41
|
+
if (requestType) {
|
|
42
|
+
payload.data.requestType = requestType;
|
|
43
|
+
}
|
|
44
44
|
if (allowedFlows) {
|
|
45
45
|
payload.data.allowedFlows = allowedFlows;
|
|
46
46
|
}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -3,7 +3,6 @@ import axios from "axios";
|
|
|
3
3
|
export interface EricClientOptions {
|
|
4
4
|
apiKey: string;
|
|
5
5
|
client: string; // ingomu, eventinterface, etc.
|
|
6
|
-
appId: "wellness" | "events" | "business"; // REQUIRED for policy engine
|
|
7
6
|
baseUrl?: string;
|
|
8
7
|
}
|
|
9
8
|
|
|
@@ -16,13 +15,11 @@ export interface EricResponse {
|
|
|
16
15
|
export class EricSDK {
|
|
17
16
|
private apiKey: string;
|
|
18
17
|
private client: string;
|
|
19
|
-
private appId: string;
|
|
20
18
|
private baseUrl: string;
|
|
21
19
|
|
|
22
20
|
constructor(options: EricClientOptions) {
|
|
23
21
|
this.apiKey = options.apiKey;
|
|
24
22
|
this.client = options.client;
|
|
25
|
-
this.appId = options.appId; // <-- FIXED: needed for policy input
|
|
26
23
|
this.baseUrl =
|
|
27
24
|
options.baseUrl ??
|
|
28
25
|
"https://us-central1-eric-ai-prod.cloudfunctions.net/runFlow";
|
|
@@ -37,7 +34,6 @@ export class EricSDK {
|
|
|
37
34
|
data: {
|
|
38
35
|
...data,
|
|
39
36
|
client: this.client,
|
|
40
|
-
appId: this.appId
|
|
41
37
|
}
|
|
42
38
|
};
|
|
43
39
|
|
|
@@ -58,20 +54,24 @@ export class EricSDK {
|
|
|
58
54
|
async decide(data: {
|
|
59
55
|
text: string;
|
|
60
56
|
topic?: string;
|
|
57
|
+
requestType?: string;
|
|
61
58
|
userState?: any;
|
|
62
59
|
allowedFlows?: string[];
|
|
63
60
|
}): Promise<EricResponse> {
|
|
64
|
-
const { allowedFlows, ...rest } = data;
|
|
61
|
+
const { allowedFlows, requestType, ...rest } = data;
|
|
65
62
|
|
|
66
63
|
const payload: any = {
|
|
67
64
|
flow: "decisionRouter",
|
|
68
65
|
data: {
|
|
69
66
|
...rest,
|
|
70
67
|
client: this.client,
|
|
71
|
-
appId: this.appId
|
|
72
68
|
}
|
|
73
69
|
};
|
|
74
70
|
|
|
71
|
+
if (requestType) {
|
|
72
|
+
payload.data.requestType = requestType;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
75
|
if (allowedFlows) {
|
|
76
76
|
payload.data.allowedFlows = allowedFlows;
|
|
77
77
|
}
|