@aippy/runtime 0.2.7-dev.5 → 0.2.7-dev.7

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.
Files changed (41) hide show
  1. package/dist/ai/config/index.d.ts +1 -1
  2. package/dist/ai/config/parser.d.ts +5 -12
  3. package/dist/ai/errors.d.ts +1 -0
  4. package/dist/ai/index.d.ts +1 -1
  5. package/dist/ai/index.js +15 -16
  6. package/dist/ai/shared/fetch.d.ts +0 -4
  7. package/dist/ai/shared/index.d.ts +1 -1
  8. package/dist/app-version-checker-B1UXEcy9.js +240 -0
  9. package/dist/bridge-BQQ3PfSO.js +237 -0
  10. package/dist/config-B0A7gHQM.js +28 -0
  11. package/dist/container-message-YB3cWpWj.js +56 -0
  12. package/dist/core/errors.d.ts +22 -3
  13. package/dist/core/headers.d.ts +31 -0
  14. package/dist/core/index.d.ts +1 -0
  15. package/dist/core/index.js +22 -50
  16. package/dist/device/index.js +194 -194
  17. package/dist/errors-B3bDbQbD.js +40 -0
  18. package/dist/helper-BjRhidue.js +238 -0
  19. package/dist/hooks-C7VP176R.js +98 -0
  20. package/dist/index/index.js +89 -80
  21. package/dist/pwa-C5nXU0DN.js +250 -0
  22. package/dist/tweaks/index.js +1 -1
  23. package/dist/url-c26cuIpu.js +7 -0
  24. package/dist/{useTweaks-QxMRmg7i.js → useTweaks-B7Muzo78.js} +10 -9
  25. package/dist/user/hooks.d.ts +6 -2
  26. package/dist/user/index.d.ts +1 -0
  27. package/dist/user/index.js +3 -3
  28. package/dist/utils/app-version-checker.d.ts +62 -0
  29. package/dist/utils/app-version-requirements.json.d.ts +13 -0
  30. package/dist/utils/index.d.ts +2 -0
  31. package/dist/utils/index.js +17 -11
  32. package/dist/utils/ui.d.ts +3 -1
  33. package/dist/utils/url.d.ts +7 -0
  34. package/package.json +1 -1
  35. package/dist/bridge-Ca3H2iN1.js +0 -197
  36. package/dist/container-message-DGrno17o.js +0 -31
  37. package/dist/errors-CDEBaBxB.js +0 -26
  38. package/dist/helper-BENVYOU-.js +0 -247
  39. package/dist/hooks-CE9cjXHP.js +0 -46
  40. package/dist/pwa-CilSlaik.js +0 -249
  41. package/dist/ui-y5N62DqC.js +0 -175
@@ -0,0 +1,56 @@
1
+ import "react";
2
+ import { getAuthTokenAsync as a } from "./bridge-BQQ3PfSO.js";
3
+ const r = "0.2.7-dev.7", i = {
4
+ version: r
5
+ }, o = i.version, c = "@aippy/runtime";
6
+ function w() {
7
+ return {
8
+ name: c,
9
+ version: o,
10
+ buildTime: (/* @__PURE__ */ new Date()).toISOString()
11
+ };
12
+ }
13
+ function p(n) {
14
+ const { token: t, existingHeaders: e } = n, s = new Headers(e);
15
+ return s.set("Aippy-Runtime-Authorization", `Bearer ${t}`), s.set("Aippy-Runtime-SDK-Version", o), typeof navigator < "u" && navigator.userAgent && s.set("Aippy-Runtime-UA", navigator.userAgent), s;
16
+ }
17
+ async function m(n) {
18
+ const t = await a();
19
+ return p({ token: t, existingHeaders: n });
20
+ }
21
+ function u(n) {
22
+ if (!(typeof window > "u"))
23
+ try {
24
+ const t = window.webkit?.messageHandlers?.aippyListener;
25
+ if (t)
26
+ try {
27
+ const e = {
28
+ command: "container.message",
29
+ parameters: n
30
+ };
31
+ t.postMessage(e), console.log("📤 [Container Message] Sent message to iOS app container:", n);
32
+ } catch (e) {
33
+ console.warn("❌ [Container Message] Failed to send message to iOS app:", e);
34
+ }
35
+ if (window.parent && window.parent !== window)
36
+ try {
37
+ const e = {
38
+ type: "container.message",
39
+ data: n
40
+ };
41
+ window.parent.postMessage(e, "*"), console.log("📤 [Container Message] Sent message to parent window:", n);
42
+ } catch (e) {
43
+ console.warn("❌ [Container Message] Failed to send message to parent window:", e);
44
+ }
45
+ } catch (t) {
46
+ console.warn("⚠️ [Container Message] Failed to send message:", t);
47
+ }
48
+ }
49
+ export {
50
+ c as S,
51
+ o as V,
52
+ m as a,
53
+ p as c,
54
+ w as g,
55
+ u as s
56
+ };
@@ -1,11 +1,22 @@
1
1
  import { AippyError } from './types';
2
2
  /**
3
- * Custom error class
3
+ * Error prefix constants
4
+ * - RUNTIME: SDK internal errors (network, auth, permissions), NOT reported to LLM
5
+ * - CODE: Code-related errors (config validation, type errors), WILL be reported to LLM
6
+ */
7
+ export declare const ERROR_PREFIX: {
8
+ readonly RUNTIME: "[Aippy Runtime]";
9
+ readonly CODE: "[Aippy Error]";
10
+ };
11
+ export type ErrorPrefix = typeof ERROR_PREFIX[keyof typeof ERROR_PREFIX];
12
+ /**
13
+ * Custom error class for Aippy Runtime SDK
4
14
  */
5
15
  export declare class AippyRuntimeError extends Error implements AippyError {
6
16
  readonly code: string;
7
17
  readonly context?: Record<string, unknown>;
8
- constructor(message: string, code?: string, context?: Record<string, unknown>);
18
+ readonly prefix: ErrorPrefix;
19
+ constructor(message: string, code?: string, context?: Record<string, unknown>, prefix?: ErrorPrefix);
9
20
  }
10
21
  /**
11
22
  * Common error codes
@@ -15,9 +26,17 @@ export declare const ERROR_CODES: {
15
26
  readonly PERMISSION_DENIED: "PERMISSION_DENIED";
16
27
  readonly INVALID_CONFIG: "INVALID_CONFIG";
17
28
  readonly NETWORK_ERROR: "NETWORK_ERROR";
29
+ readonly TIMEOUT: "TIMEOUT";
30
+ readonly OPERATION_FAILED: "OPERATION_FAILED";
18
31
  readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
19
32
  };
20
33
  /**
21
- * Create a standardized error
34
+ * Create a runtime error (NOT reported to LLM)
35
+ * Use for: network errors, auth errors, permission denied, API not supported
22
36
  */
23
37
  export declare function createError(message: string, code?: keyof typeof ERROR_CODES, context?: Record<string, unknown>): AippyRuntimeError;
38
+ /**
39
+ * Create a code-related error (WILL be reported to LLM)
40
+ * Use for: config validation errors, type errors, missing keys
41
+ */
42
+ export declare function createCodeError(message: string, code?: keyof typeof ERROR_CODES, context?: Record<string, unknown>): AippyRuntimeError;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Aippy Runtime Headers utilities.
3
+ * Shared header generation for all SDK modules.
4
+ */
5
+ export interface CreateAippyHeadersOptions {
6
+ /** Auth token for Authorization header */
7
+ token: string;
8
+ /** Optional existing headers to extend */
9
+ existingHeaders?: HeadersInit;
10
+ }
11
+ /**
12
+ * Creates Aippy runtime headers with authentication and metadata.
13
+ * Can be used by any module to create consistent headers.
14
+ *
15
+ * Headers set:
16
+ * - Aippy-Runtime-Authorization: Bearer token for authentication
17
+ * - Aippy-Runtime-SDK-Version: SDK version number
18
+ * - Aippy-Runtime-UA: User agent from the shell app
19
+ *
20
+ * @param options - Options for creating headers
21
+ * @returns Headers object with Aippy runtime headers
22
+ */
23
+ export declare function createAippyHeaders(options: CreateAippyHeadersOptions): Headers;
24
+ /**
25
+ * Async version that automatically gets the auth token.
26
+ * Convenient for most use cases.
27
+ *
28
+ * @param existingHeaders - Optional existing headers to extend
29
+ * @returns Promise resolving to Headers object with Aippy runtime headers
30
+ */
31
+ export declare function createAippyHeadersAsync(existingHeaders?: HeadersInit): Promise<Headers>;
@@ -2,5 +2,6 @@ export * from './types';
2
2
  export * from './config';
3
3
  export * from './errors';
4
4
  export * from './version';
5
+ export * from './headers';
5
6
  export * from './container-message';
6
7
  export * from './runtime';
@@ -1,53 +1,25 @@
1
- import { A as d, E as v, c as m } from "../errors-CDEBaBxB.js";
2
- import { s as A } from "../container-message-DGrno17o.js";
3
- import { A as g, C as R, R as I, a as P, p as l } from "../runtime-CmoG3v2m.js";
4
- const s = {
5
- mode: "development",
6
- debug: !1,
7
- apiBaseUrl: void 0,
8
- headers: {}
9
- };
10
- function o() {
11
- const e = {};
12
- return typeof process < "u" && process.env && (process.env.NODE_ENV && (e.mode = process.env.NODE_ENV), process.env.AIPPY_DEBUG && (e.debug = process.env.AIPPY_DEBUG === "true"), process.env.AIPPY_API_BASE_URL && (e.apiBaseUrl = process.env.AIPPY_API_BASE_URL)), e;
13
- }
14
- function p(e) {
15
- const n = o();
16
- return {
17
- ...s,
18
- ...n,
19
- ...e,
20
- headers: {
21
- ...s.headers,
22
- ...n.headers,
23
- ...e?.headers
24
- }
25
- };
26
- }
27
- const r = "0.2.7-dev.5", a = {
28
- version: r
29
- }, t = a.version, i = "@aippy/runtime";
30
- function c() {
31
- return {
32
- name: i,
33
- version: t,
34
- buildTime: (/* @__PURE__ */ new Date()).toISOString()
35
- };
36
- }
1
+ import { D as s, g as r, m as o } from "../config-B0A7gHQM.js";
2
+ import { A as p, a as t, E as i, b as R, c as E } from "../errors-B3bDbQbD.js";
3
+ import { S as m, V as A, c as C, a as g, g as f, s as y } from "../container-message-YB3cWpWj.js";
4
+ import { A as O, C as d, R as l, a as x, p as F } from "../runtime-CmoG3v2m.js";
37
5
  export {
38
- g as AippyRuntime,
39
- d as AippyRuntimeError,
40
- R as Cancellable,
6
+ O as AippyRuntime,
7
+ p as AippyRuntimeError,
8
+ d as Cancellable,
41
9
  s as DEFAULT_CONFIG,
42
- v as ERROR_CODES,
43
- I as ReceiveChannel,
44
- i as SDK_NAME,
45
- t as VERSION,
46
- P as aippyRuntime,
47
- m as createError,
48
- o as getConfigFromEnv,
49
- c as getVersionInfo,
50
- p as mergeConfig,
51
- l as processMotionData,
52
- A as sendMessageToContainer
10
+ t as ERROR_CODES,
11
+ i as ERROR_PREFIX,
12
+ l as ReceiveChannel,
13
+ m as SDK_NAME,
14
+ A as VERSION,
15
+ x as aippyRuntime,
16
+ C as createAippyHeaders,
17
+ g as createAippyHeadersAsync,
18
+ R as createCodeError,
19
+ E as createError,
20
+ r as getConfigFromEnv,
21
+ f as getVersionInfo,
22
+ o as mergeConfig,
23
+ F as processMotionData,
24
+ y as sendMessageToContainer
53
25
  };