@useago/sdk 0.3.0 → 0.3.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 (80) hide show
  1. package/README.md +2 -0
  2. package/dist/AgoClient-DPZdN5n2.js +905 -0
  3. package/dist/AgoClient-DPZdN5n2.js.map +1 -0
  4. package/dist/AgoClient-wMVUQqCD.cjs +976 -0
  5. package/dist/AgoClient-wMVUQqCD.cjs.map +1 -0
  6. package/dist/angular.cjs +138 -100
  7. package/dist/angular.cjs.map +1 -1
  8. package/dist/angular.d.ts +1 -0
  9. package/dist/angular.js +139 -103
  10. package/dist/angular.js.map +1 -1
  11. package/dist/client/AgoClient.d.ts +56 -0
  12. package/dist/client/types.d.ts +5 -1
  13. package/dist/createMockClient-Ci_N2tH8.cjs +104 -0
  14. package/dist/createMockClient-Ci_N2tH8.cjs.map +1 -0
  15. package/dist/createMockClient-U0ae_AYy.js +99 -0
  16. package/dist/createMockClient-U0ae_AYy.js.map +1 -0
  17. package/dist/devtools/index.d.ts +2 -0
  18. package/dist/devtools/initDevPanel.d.ts +15 -0
  19. package/dist/devtools.cjs +182 -0
  20. package/dist/devtools.cjs.map +1 -0
  21. package/dist/devtools.d.ts +2 -0
  22. package/dist/devtools.js +181 -0
  23. package/dist/devtools.js.map +1 -0
  24. package/dist/functions--c6lx3ic.cjs +480 -0
  25. package/dist/functions--c6lx3ic.cjs.map +1 -0
  26. package/dist/functions-C9F1dnmh.js +398 -0
  27. package/dist/functions-C9F1dnmh.js.map +1 -0
  28. package/dist/helpers/factory.d.ts +20 -0
  29. package/dist/helpers.cjs +14 -305
  30. package/dist/helpers.d.ts +1 -0
  31. package/dist/helpers.js +2 -306
  32. package/dist/index.cjs +316 -151
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.ts +14 -9
  35. package/dist/index.js +289 -163
  36. package/dist/index.js.map +1 -1
  37. package/dist/react/components/ChatWidget.d.ts +2 -0
  38. package/dist/react/components/Markdown.d.ts +12 -0
  39. package/dist/react/components/Message.d.ts +2 -0
  40. package/dist/react/components/index.d.ts +2 -0
  41. package/dist/react/context/AgoContext.d.ts +29 -3
  42. package/dist/react/context/index.d.ts +1 -1
  43. package/dist/react/hooks/index.d.ts +1 -0
  44. package/dist/react/hooks/useAgoContext.d.ts +40 -0
  45. package/dist/react/hooks/useAgoFunction.d.ts +14 -2
  46. package/dist/react/hooks/useAgoStore.d.ts +17 -0
  47. package/dist/react/index.d.ts +5 -1
  48. package/dist/react.cjs +22130 -10274
  49. package/dist/react.cjs.map +1 -1
  50. package/dist/react.d.ts +1 -0
  51. package/dist/react.js +22128 -10289
  52. package/dist/react.js.map +1 -1
  53. package/dist/rolldown-runtime-BqCkTl7Q.cjs +50 -0
  54. package/dist/rolldown-runtime-CNZpIYwj.js +33 -0
  55. package/dist/state/ClientContextRegistry.d.ts +64 -0
  56. package/dist/state/createStore.d.ts +30 -0
  57. package/dist/vue/composables/useAgoStore.d.ts +18 -0
  58. package/dist/vue/index.d.ts +1 -0
  59. package/dist/vue.cjs +312 -208
  60. package/dist/vue.cjs.map +1 -1
  61. package/dist/vue.d.ts +1 -0
  62. package/dist/vue.js +311 -218
  63. package/dist/vue.js.map +1 -1
  64. package/dist/widget/types.d.ts +1 -0
  65. package/dist/widget.cjs +0 -2
  66. package/dist/widget.d.ts +1 -0
  67. package/dist/widget.js +0 -2
  68. package/package.json +6 -1
  69. package/dist/AgoClient-B-SONi_K.js +0 -861
  70. package/dist/AgoClient-B-SONi_K.js.map +0 -1
  71. package/dist/AgoClient-xTWfMWKh.cjs +0 -860
  72. package/dist/AgoClient-xTWfMWKh.cjs.map +0 -1
  73. package/dist/createMockClient-B1DcBiIK.js +0 -94
  74. package/dist/createMockClient-B1DcBiIK.js.map +0 -1
  75. package/dist/createMockClient-BqNSJUu4.cjs +0 -93
  76. package/dist/createMockClient-BqNSJUu4.cjs.map +0 -1
  77. package/dist/helpers.cjs.map +0 -1
  78. package/dist/helpers.js.map +0 -1
  79. package/dist/widget.cjs.map +0 -1
  80. package/dist/widget.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ return target;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ key = keys[i];
21
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
+ get: ((k) => from[k]).bind(null, key),
23
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
+ });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+ //#endregion
33
+ Object.defineProperty(exports, "__commonJSMin", {
34
+ enumerable: true,
35
+ get: function() {
36
+ return __commonJSMin;
37
+ }
38
+ });
39
+ Object.defineProperty(exports, "__exportAll", {
40
+ enumerable: true,
41
+ get: function() {
42
+ return __exportAll;
43
+ }
44
+ });
45
+ Object.defineProperty(exports, "__toESM", {
46
+ enumerable: true,
47
+ get: function() {
48
+ return __toESM;
49
+ }
50
+ });
@@ -0,0 +1,33 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ return target;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ key = keys[i];
21
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
+ get: ((k) => from[k]).bind(null, key),
23
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
+ });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+ //#endregion
33
+ export { __exportAll as n, __toESM as r, __commonJSMin as t };
@@ -0,0 +1,64 @@
1
+ /**
2
+ * A single piece of context the client wants the LLM to know about.
3
+ */
4
+ export interface ContextEntry {
5
+ /** Human-readable label (e.g. "Order detail", "Current user") */
6
+ name?: string;
7
+ /** Short description of what this context represents */
8
+ description?: string;
9
+ /** Arbitrary structured data the AI should know about */
10
+ data?: Record<string, unknown>;
11
+ }
12
+ /**
13
+ * Serialised client context sent with each message.
14
+ */
15
+ export interface ContextSnapshot {
16
+ /** All active context entries keyed by their registration key */
17
+ entries: Record<string, ContextEntry>;
18
+ }
19
+ /**
20
+ * A function that returns a fresh context entry on demand.
21
+ * Evaluated every time a message is sent — use it to pull data from stores,
22
+ * refs, or any source that isn't captured by React state.
23
+ */
24
+ export type DynamicContextProvider = () => ContextEntry | null | undefined;
25
+ /**
26
+ * Registry that collects client-side context from across the component tree.
27
+ *
28
+ * Components register/unregister context slices via unique keys.
29
+ * When a message is sent the registry produces a single snapshot.
30
+ */
31
+ export declare class ClientContextRegistry {
32
+ private entries;
33
+ private dynamicProviders;
34
+ /**
35
+ * Register or update a static context entry.
36
+ */
37
+ set(key: string, entry: ContextEntry): void;
38
+ /**
39
+ * Remove a static context entry (typically on component unmount).
40
+ */
41
+ remove(key: string): boolean;
42
+ /**
43
+ * Register a dynamic context provider. The function is called every time
44
+ * a message is sent, so it always returns the freshest data.
45
+ *
46
+ * Use this for context that lives outside React state — global stores,
47
+ * refs, or computed values that shouldn't trigger re-renders.
48
+ */
49
+ addDynamicProvider(key: string, provider: DynamicContextProvider): void;
50
+ /**
51
+ * Remove a dynamic context provider.
52
+ */
53
+ removeDynamicProvider(key: string): boolean;
54
+ /**
55
+ * Build a snapshot of the current client context.
56
+ * Evaluates every registered dynamic provider. Returns `null` when there is
57
+ * nothing to report.
58
+ */
59
+ getSnapshot(): ContextSnapshot | null;
60
+ /**
61
+ * Remove all entries and dynamic providers.
62
+ */
63
+ clear(): void;
64
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A minimal observable store: one value, synchronous subscriptions, and
3
+ * optional persistence via {@link PersistOptions} (localStorage by default).
4
+ *
5
+ * ```ts
6
+ * const store = createStore({ count: 0 });
7
+ * store.subscribe((state) => save(state));
8
+ * store.set({ count: 1 }); // listeners fire synchronously
9
+ *
10
+ * const cart = createStore({ items: [] }, { key: "cart" }); // persisted
11
+ * ```
12
+ */
13
+ export interface Store<T> {
14
+ /** Current state. */
15
+ get(): T;
16
+ /** Replace the state and notify subscribers synchronously. */
17
+ set(next: T): void;
18
+ /** Register a listener; returns a function that removes it. */
19
+ subscribe(listener: (state: T) => void): () => void;
20
+ }
21
+ /** The slice of the Web Storage API that {@link createStore} relies on. */
22
+ type StorageLike = Pick<Storage, "getItem" | "setItem">;
23
+ export interface PersistOptions {
24
+ /** Key under which the state is JSON-serialized. */
25
+ key: string;
26
+ /** Storage backend; defaults to `globalThis.localStorage`. */
27
+ storage?: StorageLike;
28
+ }
29
+ export declare function createStore<T>(initial: T, persist?: PersistOptions): Store<T>;
30
+ export {};
@@ -0,0 +1,18 @@
1
+ import { type ShallowRef } from "vue";
2
+ import type { Store } from "../../state/createStore";
3
+ /**
4
+ * Read a framework-agnostic AGO store (`createStore`) as a reactive Vue ref.
5
+ *
6
+ * The ref's `.value` updates on every `store.set(...)`. Mutate through the store,
7
+ * not the ref. A `shallowRef` is used because the store replaces its value
8
+ * wholesale, so deep reactivity would be wasted work.
9
+ *
10
+ * ```ts
11
+ * const cart = createStore({ items: [] as string[] });
12
+ *
13
+ * // in setup():
14
+ * const state = useAgoStore(cart);
15
+ * // template: {{ state.items.length }}
16
+ * ```
17
+ */
18
+ export declare function useAgoStore<T>(store: Store<T>): ShallowRef<T>;
@@ -6,5 +6,6 @@ export { useMessages } from "./composables/useMessages";
6
6
  export { useConversation } from "./composables/useConversation";
7
7
  export { useAgoFunction, useAgoNavigation } from "./composables/useAgoFunction";
8
8
  export { useAgoEvents } from "./composables/useAgoEvents";
9
+ export { useAgoStore } from "./composables/useAgoStore";
9
10
  export { AGO_CLIENT_KEY } from "./symbols";
10
11
  export type { AgoConfig, AgoMessage, Conversation, AgoAgent, AgoSource, ToolCallData, } from "../client/types";