@kevinwang15/byok-ai 0.1.0 → 0.1.2

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 (48) hide show
  1. package/README.md +21 -2
  2. package/dist/lib/AskAI.js +383 -0
  3. package/dist/lib/AskAIHistory.js +120 -0
  4. package/dist/lib/AskAIProvider.js +255 -0
  5. package/dist/lib/Markdown.js +111 -0
  6. package/dist/lib/PageElements.js +127 -0
  7. package/dist/lib/agent.js +223 -0
  8. package/dist/lib/answer-components.js +49 -0
  9. package/dist/lib/connection.d.ts +15 -0
  10. package/dist/lib/connection.js +32 -0
  11. package/dist/lib/context.js +9 -0
  12. package/dist/lib/conversation-files.js +164 -0
  13. package/dist/lib/entries/agent.d.ts +9 -0
  14. package/dist/lib/entries/agent.js +5 -0
  15. package/dist/lib/entries/connection.d.ts +2 -0
  16. package/dist/lib/entries/connection.js +1 -0
  17. package/dist/lib/entries/script-engine.d.ts +3 -0
  18. package/dist/lib/entries/script-engine.js +5 -0
  19. package/dist/lib/history.js +16 -0
  20. package/dist/lib/images.js +79 -0
  21. package/dist/lib/index.d.ts +6 -2
  22. package/dist/lib/index.js +18 -2326
  23. package/dist/lib/local-storage.d.ts +8 -0
  24. package/dist/lib/local-storage.js +23 -0
  25. package/dist/lib/mcp-result.d.ts +4 -1
  26. package/dist/lib/mcp-result.js +18 -0
  27. package/dist/lib/mount.js +9 -0
  28. package/dist/lib/node_modules/@jitl/quickjs-ffi-types/dist/index.js +46 -0
  29. package/dist/lib/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.browser.js +330 -0
  30. package/dist/lib/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.js +76 -0
  31. package/dist/lib/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.js +7 -0
  32. package/dist/lib/node_modules/quickjs-emscripten-core/dist/chunk-V2S4ZYJR.js +1142 -0
  33. package/dist/lib/node_modules/quickjs-emscripten-core/dist/index.js +21 -0
  34. package/dist/lib/node_modules/quickjs-emscripten-core/dist/module-ES6BEMUI.js +1 -0
  35. package/dist/lib/page-context.js +185 -0
  36. package/dist/lib/page-picker.js +119 -0
  37. package/dist/lib/providers.js +84 -0
  38. package/dist/lib/rendering-context.js +4 -0
  39. package/dist/lib/sandbox.js +102 -0
  40. package/dist/lib/script-runner.js +26 -0
  41. package/dist/lib/script.js +9 -0
  42. package/dist/lib/storage.d.ts +0 -13
  43. package/dist/lib/storage.js +67 -0
  44. package/dist/lib/useAskAIImage.js +26 -0
  45. package/dist/lib/usePanelLayout.js +168 -0
  46. package/dist/lib/workspace-tools.js +182 -0
  47. package/package.json +14 -1
  48. /package/dist/lib/{sandbox-worker-BdFlhTIS.js → sandbox-worker.js} +0 -0
@@ -0,0 +1,8 @@
1
+ export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
2
+ /** The key's value as JSON (null when unset); `error` when storage can't be read or holds no JSON. */
3
+ export declare function readStored(key: string): {
4
+ value: unknown;
5
+ error: boolean;
6
+ };
7
+ /** Saves the value as JSON, or removes the key when it is undefined. Whether that worked. */
8
+ export declare function writeStored(key: string, value: unknown): boolean;
@@ -0,0 +1,23 @@
1
+ // frontend/byok/local-storage.ts
2
+ var e = (e) => typeof e == "object" && !!e && !Array.isArray(e);
3
+ function t(e) {
4
+ try {
5
+ return {
6
+ value: JSON.parse(localStorage.getItem(e) ?? "null"),
7
+ error: !1
8
+ };
9
+ } catch {
10
+ return {
11
+ value: null,
12
+ error: !0
13
+ };
14
+ }
15
+ }
16
+ function n(e, t) {
17
+ try {
18
+ return t === void 0 ? localStorage.removeItem(e) : localStorage.setItem(e, JSON.stringify(t)), !0;
19
+ } catch {
20
+ return !1;
21
+ }
22
+ }
23
+ export { e as isRecord, t as readStored, n as writeStored };
@@ -2,5 +2,8 @@
2
2
  export declare const mcpText: (content: unknown) => string;
3
3
  /** The error an MCP result reports, or undefined when it reports none. */
4
4
  export declare function mcpError(result: unknown): string | undefined;
5
- /** An MCP result as a value: its structured content when it has some, else its text. Throws the error it reports. */
5
+ /**
6
+ * An MCP result as a value: its structured content when it has some, else its text, read as JSON
7
+ * when it is JSON (tools often return JSON as text). Throws the error it reports.
8
+ */
6
9
  export declare function mcpValue(result: unknown): unknown;
@@ -0,0 +1,18 @@
1
+ // frontend/byok/mcp-result.ts
2
+ var e = (e) => typeof e == "object" && !!e && !Array.isArray(e), t = (e) => Array.isArray(e) ? e.map((e) => e?.type === "text" && typeof e.text == "string" ? e.text : JSON.stringify(e)).join("\n") : JSON.stringify(e) ?? "";
3
+ function n(n) {
4
+ if (e(n) && n.isError) return "The tool reported an error: " + t(n.content).slice(0, 2e3);
5
+ }
6
+ function r(r) {
7
+ let i = n(r);
8
+ if (i) throw Error(i);
9
+ if (!e(r)) return r;
10
+ if (r.structuredContent !== void 0) return r.structuredContent;
11
+ let a = t(r.content);
12
+ try {
13
+ return JSON.parse(a);
14
+ } catch {
15
+ return a;
16
+ }
17
+ }
18
+ export { n as mcpError, t as mcpText, r as mcpValue };
@@ -0,0 +1,9 @@
1
+ import { AskAI as e } from "./AskAI.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { createRoot as n } from "react-dom/client";
4
+ // frontend/byok/mount.tsx
5
+ function r(r, i = {}) {
6
+ let a = n(r);
7
+ return a.render(/* @__PURE__ */ t(e, { ...i })), { unmount: () => a.unmount() };
8
+ }
9
+ export { r as mountAskAI };
@@ -0,0 +1,46 @@
1
+ // node_modules/@jitl/quickjs-ffi-types/dist/index.mjs
2
+ var e = {
3
+ JS_EVAL_TYPE_GLOBAL: 0,
4
+ JS_EVAL_TYPE_MODULE: 1,
5
+ JS_EVAL_TYPE_DIRECT: 2,
6
+ JS_EVAL_TYPE_INDIRECT: 3,
7
+ JS_EVAL_TYPE_MASK: 3,
8
+ JS_EVAL_FLAG_STRICT: 8,
9
+ JS_EVAL_FLAG_STRIP: 16,
10
+ JS_EVAL_FLAG_COMPILE_ONLY: 32,
11
+ JS_EVAL_FLAG_BACKTRACE_BARRIER: 64
12
+ }, t = {
13
+ BaseObjects: 1,
14
+ Date: 2,
15
+ Eval: 4,
16
+ StringNormalize: 8,
17
+ RegExp: 16,
18
+ RegExpCompiler: 32,
19
+ JSON: 64,
20
+ Proxy: 128,
21
+ MapSet: 256,
22
+ TypedArrays: 512,
23
+ Promise: 1024,
24
+ BigInt: 2048,
25
+ BigFloat: 4096,
26
+ BigDecimal: 8192,
27
+ OperatorOverloading: 16384,
28
+ BignumExt: 32768
29
+ }, n = {
30
+ Pending: 0,
31
+ Fulfilled: 1,
32
+ Rejected: 2
33
+ }, r = {
34
+ JS_GPN_STRING_MASK: 1,
35
+ JS_GPN_SYMBOL_MASK: 2,
36
+ JS_GPN_PRIVATE_MASK: 4,
37
+ JS_GPN_ENUM_ONLY: 16,
38
+ JS_GPN_SET_ENUM: 32,
39
+ QTS_GPN_NUMBER_MASK: 64,
40
+ QTS_STANDARD_COMPLIANT_NUMBER: 128
41
+ }, i = {
42
+ IsStrictlyEqual: 0,
43
+ IsSameValue: 1,
44
+ IsSameValueZero: 2
45
+ };
46
+ export { e as EvalFlags, r as GetOwnPropertyNamesFlags, t as IntrinsicsFlags, i as IsEqualOp, n as JSPromiseStateEnum };