@eazo/sdk 0.7.0 → 0.8.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/dist/index.d.ts CHANGED
@@ -2,8 +2,10 @@ export { auth } from "./internal/capabilities/auth";
2
2
  export { device } from "./internal/capabilities/device";
3
3
  export { storage } from "./internal/capabilities/storage";
4
4
  export { ai } from "./internal/capabilities/ai";
5
+ export { memory } from "./internal/capabilities/memory";
5
6
  export type { LoginOptions } from "./internal/capabilities/auth";
6
7
  export type { StorageCredentials, UploadResult } from "./internal/capabilities/storage";
8
+ export type { MemoryActionParams } from "./internal/capabilities/memory";
7
9
  export type { ChatCompletion, ChatCompletionChunk, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, } from "./internal/capabilities/ai";
8
10
  export type { User, DeviceContext, AuthState, EazoState } from "./types";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAEhD,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACxF,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,sCAAsC,EACtC,mCAAmC,GACpC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAExD,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACxF,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,sCAAsC,EACtC,mCAAmC,GACpC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ai = exports.storage = exports.device = exports.auth = void 0;
3
+ exports.memory = exports.ai = exports.storage = exports.device = exports.auth = void 0;
4
4
  var auth_1 = require("./internal/capabilities/auth");
5
5
  Object.defineProperty(exports, "auth", { enumerable: true, get: function () { return auth_1.auth; } });
6
6
  var device_1 = require("./internal/capabilities/device");
@@ -9,4 +9,6 @@ var storage_1 = require("./internal/capabilities/storage");
9
9
  Object.defineProperty(exports, "storage", { enumerable: true, get: function () { return storage_1.storage; } });
10
10
  var ai_1 = require("./internal/capabilities/ai");
11
11
  Object.defineProperty(exports, "ai", { enumerable: true, get: function () { return ai_1.ai; } });
12
+ var memory_1 = require("./internal/capabilities/memory");
13
+ Object.defineProperty(exports, "memory", { enumerable: true, get: function () { return memory_1.memory; } });
12
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAA3C,4FAAA,IAAI,OAAA;AACb,yDAAwD;AAA/C,gGAAA,MAAM,OAAA;AACf,2DAA0D;AAAjD,kGAAA,OAAO,OAAA;AAChB,iDAAgD;AAAvC,wFAAA,EAAE,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAA3C,4FAAA,IAAI,OAAA;AACb,yDAAwD;AAA/C,gGAAA,MAAM,OAAA;AACf,2DAA0D;AAAjD,kGAAA,OAAO,OAAA;AAChB,iDAAgD;AAAvC,wFAAA,EAAE,OAAA;AACX,yDAAwD;AAA/C,gGAAA,MAAM,OAAA"}
@@ -0,0 +1,45 @@
1
+ export interface MemoryActionParams {
2
+ /** Readable description of the user action, e.g. "User clicked the publish button on the app editor page" */
3
+ content: string;
4
+ /** ISO 8601 timestamp. Defaults to now when omitted. */
5
+ timestamp?: string;
6
+ /** Associate this action with a Gum session ID */
7
+ session_id?: string;
8
+ /** Action category, e.g. "click", "search", "page_view" */
9
+ event_type?: string;
10
+ /** Page identifier where the action occurred, e.g. "app_editor" */
11
+ page?: string;
12
+ /** Business ID anchors for retrieval, e.g. { app_id: "app_123" } */
13
+ anchors?: Record<string, string>;
14
+ /** Additional metadata */
15
+ metadata?: Record<string, unknown>;
16
+ /** Entity tags associated with this action */
17
+ entities?: string[];
18
+ /** Device identifier */
19
+ device_id?: string;
20
+ /** App identifier */
21
+ app?: string;
22
+ /** Platform, e.g. "web", "ios", "android" */
23
+ platform?: string;
24
+ }
25
+ export declare const memory: {
26
+ /**
27
+ * Report a user action event to Gum memory service.
28
+ *
29
+ * Requires the user to be authenticated — the current session is forwarded
30
+ * automatically via `x-eazo-session`. The developer public key is read from
31
+ * `NEXT_PUBLIC_EAZO_PUBLIC_KEY` or set via `auth.configure({ publicKey })`.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * await memory.reportAction({
36
+ * content: "User clicked the publish button on the app editor page",
37
+ * event_type: "click",
38
+ * page: "app_editor",
39
+ * anchors: { app_id: "app_123" },
40
+ * });
41
+ * ```
42
+ */
43
+ reportAction(params: MemoryActionParams): Promise<void>;
44
+ };
45
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/internal/capabilities/memory.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,6GAA6G;IAC7G,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,eAAO,MAAM,MAAM;IACjB;;;;;;;;;;;;;;;;OAgBG;yBACwB,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkC9D,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.memory = void 0;
4
+ const config_1 = require("../config");
5
+ const auth_1 = require("./auth");
6
+ // ---------------------------------------------------------------------------
7
+ // Public API
8
+ // ---------------------------------------------------------------------------
9
+ exports.memory = {
10
+ /**
11
+ * Report a user action event to Gum memory service.
12
+ *
13
+ * Requires the user to be authenticated — the current session is forwarded
14
+ * automatically via `x-eazo-session`. The developer public key is read from
15
+ * `NEXT_PUBLIC_EAZO_PUBLIC_KEY` or set via `auth.configure({ publicKey })`.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * await memory.reportAction({
20
+ * content: "User clicked the publish button on the app editor page",
21
+ * event_type: "click",
22
+ * page: "app_editor",
23
+ * anchors: { app_id: "app_123" },
24
+ * });
25
+ * ```
26
+ */
27
+ async reportAction(params) {
28
+ const publicKey = (0, config_1.getPublicKey)();
29
+ if (!publicKey) {
30
+ throw new Error("@eazo/sdk: missing public key. Set NEXT_PUBLIC_EAZO_PUBLIC_KEY or call auth.configure({ publicKey }).");
31
+ }
32
+ const session = await auth_1.auth.getSessionHeader();
33
+ if (!session) {
34
+ throw new Error("@eazo/sdk: user is not authenticated. Call auth.login() before reporting memory actions.");
35
+ }
36
+ const res = await fetch(`${(0, config_1.getApiBase)()}/api/open/gum/action`, {
37
+ method: "POST",
38
+ headers: {
39
+ "Content-Type": "application/json",
40
+ "x-eazo-publickey": publicKey,
41
+ "x-eazo-session": session,
42
+ },
43
+ body: JSON.stringify(params),
44
+ });
45
+ if (!res.ok) {
46
+ let message = `Failed to report memory action: ${res.status}`;
47
+ try {
48
+ const body = await res.json();
49
+ if (body?.message)
50
+ message = body.message;
51
+ }
52
+ catch { /* ignore */ }
53
+ throw new Error(message);
54
+ }
55
+ },
56
+ };
57
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/internal/capabilities/memory.ts"],"names":[],"mappings":";;;AAAA,sCAAqD;AACrD,iCAA8B;AA+B9B,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAEjE,QAAA,MAAM,GAAG;IACpB;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,MAAM,SAAS,GAAG,IAAA,qBAAY,GAAE,CAAC;QACjC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,uGAAuG,CACxG,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,WAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAA,mBAAU,GAAE,sBAAsB,EAAE;YAC7D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,kBAAkB,EAAE,SAAS;gBAC7B,gBAAgB,EAAE,OAAO;aAC1B;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;SAC7B,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,IAAI,OAAO,GAAG,mCAAmC,GAAG,CAAC,MAAM,EAAE,CAAC;YAC9D,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAA0B,CAAC;gBACtD,IAAI,IAAI,EAAE,OAAO;oBAAE,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5C,CAAC;YAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eazo/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Eazo platform SDK — capability-first API for web apps that run on Eazo Mobile and the web browser",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",