@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.
- package/dist/ai/config/index.d.ts +1 -1
- package/dist/ai/config/parser.d.ts +5 -12
- package/dist/ai/errors.d.ts +1 -0
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +15 -16
- package/dist/ai/shared/fetch.d.ts +0 -4
- package/dist/ai/shared/index.d.ts +1 -1
- package/dist/app-version-checker-B1UXEcy9.js +240 -0
- package/dist/bridge-BQQ3PfSO.js +237 -0
- package/dist/config-B0A7gHQM.js +28 -0
- package/dist/container-message-YB3cWpWj.js +56 -0
- package/dist/core/errors.d.ts +22 -3
- package/dist/core/headers.d.ts +31 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +22 -50
- package/dist/device/index.js +194 -194
- package/dist/errors-B3bDbQbD.js +40 -0
- package/dist/helper-BjRhidue.js +238 -0
- package/dist/hooks-C7VP176R.js +98 -0
- package/dist/index/index.js +89 -80
- package/dist/pwa-C5nXU0DN.js +250 -0
- package/dist/tweaks/index.js +1 -1
- package/dist/url-c26cuIpu.js +7 -0
- package/dist/{useTweaks-QxMRmg7i.js → useTweaks-B7Muzo78.js} +10 -9
- package/dist/user/hooks.d.ts +6 -2
- package/dist/user/index.d.ts +1 -0
- package/dist/user/index.js +3 -3
- package/dist/utils/app-version-checker.d.ts +62 -0
- package/dist/utils/app-version-requirements.json.d.ts +13 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +17 -11
- package/dist/utils/ui.d.ts +3 -1
- package/dist/utils/url.d.ts +7 -0
- package/package.json +1 -1
- package/dist/bridge-Ca3H2iN1.js +0 -197
- package/dist/container-message-DGrno17o.js +0 -31
- package/dist/errors-CDEBaBxB.js +0 -26
- package/dist/helper-BENVYOU-.js +0 -247
- package/dist/hooks-CE9cjXHP.js +0 -46
- package/dist/pwa-CilSlaik.js +0 -249
- 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
|
+
};
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { AippyError } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
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
|
-
|
|
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
|
|
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>;
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
|
@@ -1,53 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
6
|
+
O as AippyRuntime,
|
|
7
|
+
p as AippyRuntimeError,
|
|
8
|
+
d as Cancellable,
|
|
41
9
|
s as DEFAULT_CONFIG,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
};
|