@useago/sdk 0.3.2 → 0.3.4
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/AgoClient-DF7M2WAz.js +575 -0
- package/dist/AgoClient-bjN-z2ZQ.cjs +6 -0
- package/dist/angular.cjs +1 -143
- package/dist/angular.d.cts +530 -0
- package/dist/angular.d.ts +530 -2
- package/dist/angular.js +71 -139
- package/dist/createFormCollector-ClzHfaBd.js +185 -0
- package/dist/createFormCollector-H4Me_2uj.cjs +1 -0
- package/dist/createMockClient-C50gjV0b.js +71 -0
- package/dist/createMockClient-DQvFFWnc.cjs +1 -0
- package/dist/devtools.cjs +26 -100
- package/dist/devtools.d.cts +443 -0
- package/dist/devtools.d.ts +443 -2
- package/dist/devtools.js +68 -93
- package/dist/functions-BH1X5kas.cjs +1 -0
- package/dist/functions-CWSRi3xv.js +312 -0
- package/dist/helpers.cjs +1 -15
- package/dist/{helpers/functions.d.ts → helpers.d.cts} +121 -62
- package/dist/helpers.d.ts +121 -2
- package/dist/helpers.js +16 -2
- package/dist/index.cjs +1 -347
- package/dist/index.d.cts +1150 -0
- package/dist/index.d.ts +1150 -20
- package/dist/index.js +129 -298
- package/dist/react.cjs +31 -22438
- package/dist/react.d.cts +999 -0
- package/dist/react.d.ts +999 -2
- package/dist/react.js +8416 -22376
- package/dist/rolldown-runtime-CaekUdDJ.cjs +1 -0
- package/dist/rolldown-runtime-DxmricAu.js +25 -0
- package/dist/vue.cjs +1 -336
- package/dist/vue.d.cts +1063 -0
- package/dist/vue.d.ts +1063 -2
- package/dist/vue.js +174 -316
- package/dist/widget.cjs +1 -0
- package/dist/widget.d.cts +577 -0
- package/dist/widget.d.ts +577 -2
- package/dist/widget.js +398 -0
- package/package.json +35 -24
- package/dist/AgoClient-DPZdN5n2.js +0 -905
- package/dist/AgoClient-DPZdN5n2.js.map +0 -1
- package/dist/AgoClient-wMVUQqCD.cjs +0 -976
- package/dist/AgoClient-wMVUQqCD.cjs.map +0 -1
- package/dist/angular/ago.service.d.ts +0 -98
- package/dist/angular/index.d.ts +0 -4
- package/dist/angular/provide.d.ts +0 -27
- package/dist/angular.cjs.map +0 -1
- package/dist/angular.js.map +0 -1
- package/dist/api/HttpClient.d.ts +0 -31
- package/dist/api/index.d.ts +0 -1
- package/dist/auto/createAgo.d.ts +0 -39
- package/dist/auto/index.d.ts +0 -1
- package/dist/client/AgoClient.d.ts +0 -169
- package/dist/client/errors.d.ts +0 -48
- package/dist/client/index.d.ts +0 -3
- package/dist/client/types.d.ts +0 -205
- package/dist/createMockClient-Ci_N2tH8.cjs +0 -104
- package/dist/createMockClient-Ci_N2tH8.cjs.map +0 -1
- package/dist/createMockClient-U0ae_AYy.js +0 -99
- package/dist/createMockClient-U0ae_AYy.js.map +0 -1
- package/dist/devtools/index.d.ts +0 -2
- package/dist/devtools/initDevPanel.d.ts +0 -15
- package/dist/devtools.cjs.map +0 -1
- package/dist/devtools.js.map +0 -1
- package/dist/functions/FunctionRegistry.d.ts +0 -41
- package/dist/functions/defineFunction.d.ts +0 -22
- package/dist/functions/index.d.ts +0 -2
- package/dist/functions/types.d.ts +0 -50
- package/dist/functions--c6lx3ic.cjs +0 -480
- package/dist/functions--c6lx3ic.cjs.map +0 -1
- package/dist/functions-C9F1dnmh.js +0 -398
- package/dist/functions-C9F1dnmh.js.map +0 -1
- package/dist/helpers/factory.d.ts +0 -20
- package/dist/helpers/index.d.ts +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react/components/ChatInput.d.ts +0 -12
- package/dist/react/components/ChatWidget.d.ts +0 -35
- package/dist/react/components/Markdown.d.ts +0 -12
- package/dist/react/components/Message.d.ts +0 -9
- package/dist/react/components/index.d.ts +0 -8
- package/dist/react/context/AgoContext.d.ts +0 -62
- package/dist/react/context/index.d.ts +0 -2
- package/dist/react/hooks/index.d.ts +0 -7
- package/dist/react/hooks/useAgo.d.ts +0 -14
- package/dist/react/hooks/useAgoContext.d.ts +0 -40
- package/dist/react/hooks/useAgoFunction.d.ts +0 -58
- package/dist/react/hooks/useAgoStore.d.ts +0 -17
- package/dist/react/hooks/useChat.d.ts +0 -45
- package/dist/react/hooks/useConversation.d.ts +0 -28
- package/dist/react/hooks/useMessages.d.ts +0 -26
- package/dist/react/index.d.ts +0 -24
- package/dist/react/testing.d.ts +0 -2
- package/dist/react.cjs.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/rolldown-runtime-BqCkTl7Q.cjs +0 -50
- package/dist/rolldown-runtime-CNZpIYwj.js +0 -33
- package/dist/state/ClientContextRegistry.d.ts +0 -64
- package/dist/state/createStore.d.ts +0 -30
- package/dist/streaming/SSEHandler.d.ts +0 -46
- package/dist/streaming/helpers.d.ts +0 -67
- package/dist/streaming/index.d.ts +0 -2
- package/dist/testing/createMockClient.d.ts +0 -42
- package/dist/testing/index.d.ts +0 -2
- package/dist/utils/eventEmitter.d.ts +0 -23
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/logger.d.ts +0 -14
- package/dist/vue/composables/useAgo.d.ts +0 -17
- package/dist/vue/composables/useAgoEvents.d.ts +0 -11
- package/dist/vue/composables/useAgoFunction.d.ts +0 -34
- package/dist/vue/composables/useAgoStore.d.ts +0 -18
- package/dist/vue/composables/useChat.d.ts +0 -251
- package/dist/vue/composables/useConversation.d.ts +0 -178
- package/dist/vue/composables/useMessages.d.ts +0 -89
- package/dist/vue/index.d.ts +0 -11
- package/dist/vue/plugin.d.ts +0 -16
- package/dist/vue/symbols.d.ts +0 -3
- package/dist/vue.cjs.map +0 -1
- package/dist/vue.js.map +0 -1
- package/dist/widget/index.d.ts +0 -1
- package/dist/widget/types.d.ts +0 -43
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
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 };
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { AgoMessage, ToolCallData } from "../client/types";
|
|
2
|
-
export interface SSEHandlerCallbacks {
|
|
3
|
-
onStart?: (data: {
|
|
4
|
-
conversationId: string;
|
|
5
|
-
messageId: string;
|
|
6
|
-
}) => void;
|
|
7
|
-
onChunk?: (data: {
|
|
8
|
-
content: string;
|
|
9
|
-
conversationId: string;
|
|
10
|
-
messageId: string;
|
|
11
|
-
}) => void;
|
|
12
|
-
onToolCall?: (toolCall: ToolCallData) => void;
|
|
13
|
-
onClientFunction?: (data: {
|
|
14
|
-
invocationId: string;
|
|
15
|
-
functionName: string;
|
|
16
|
-
arguments: Record<string, unknown>;
|
|
17
|
-
conversationId: string;
|
|
18
|
-
}) => void;
|
|
19
|
-
onComplete?: (message: AgoMessage) => void;
|
|
20
|
-
onError?: (error: Error) => void;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Handles SSE streaming responses from AGO backend
|
|
24
|
-
*/
|
|
25
|
-
export declare class SSEHandler {
|
|
26
|
-
private callbacks;
|
|
27
|
-
private buffer;
|
|
28
|
-
private message;
|
|
29
|
-
private toolCalls;
|
|
30
|
-
private sources;
|
|
31
|
-
private followUpReplies;
|
|
32
|
-
private isFirstChunk;
|
|
33
|
-
constructor(callbacks: SSEHandlerCallbacks);
|
|
34
|
-
/**
|
|
35
|
-
* Process a streaming response
|
|
36
|
-
*/
|
|
37
|
-
processStream(response: Response): Promise<AgoMessage>;
|
|
38
|
-
private processBuffer;
|
|
39
|
-
private handleChunk;
|
|
40
|
-
private parseToolCall;
|
|
41
|
-
private buildFinalMessage;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Check if an error is a network error that should trigger polling fallback
|
|
45
|
-
*/
|
|
46
|
-
export declare function isStreamNetworkError(error: Error): boolean;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { AgoClient } from "../client/AgoClient";
|
|
2
|
-
import type { AgoMessage, AgoClientEvents, ToolCallData, ClientFunctionInvocation } from "../client/types";
|
|
3
|
-
/**
|
|
4
|
-
* Subscribe to complete messages with a simple callback. Returns an unsubscribe function.
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* const unsub = onMessage(client, (msg) => console.log(msg.content));
|
|
8
|
-
* // later: unsub();
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare function onMessage(client: AgoClient, callback: (message: AgoMessage) => void): () => void;
|
|
12
|
-
/**
|
|
13
|
-
* Subscribe to streaming text chunks.
|
|
14
|
-
*
|
|
15
|
-
* ```ts
|
|
16
|
-
* onMessageChunk(client, ({ content }) => {
|
|
17
|
-
* outputEl.textContent += content;
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function onMessageChunk(client: AgoClient, callback: (data: AgoClientEvents["message:chunk"]) => void): () => void;
|
|
22
|
-
/**
|
|
23
|
-
* Subscribe to message start events.
|
|
24
|
-
*/
|
|
25
|
-
export declare function onMessageStart(client: AgoClient, callback: (data: AgoClientEvents["message:start"]) => void): () => void;
|
|
26
|
-
/**
|
|
27
|
-
* Subscribe to message errors.
|
|
28
|
-
*/
|
|
29
|
-
export declare function onMessageError(client: AgoClient, callback: (data: AgoClientEvents["message:error"]) => void): () => void;
|
|
30
|
-
/**
|
|
31
|
-
* Subscribe to tool call events.
|
|
32
|
-
*/
|
|
33
|
-
export declare function onToolCall(client: AgoClient, callback: (toolCall: ToolCallData) => void): () => void;
|
|
34
|
-
/**
|
|
35
|
-
* Subscribe to client function invocations.
|
|
36
|
-
*/
|
|
37
|
-
export declare function onFunctionInvoke(client: AgoClient, callback: (data: ClientFunctionInvocation) => void): () => void;
|
|
38
|
-
/**
|
|
39
|
-
* Send a message and iterate over chunks as an async generator.
|
|
40
|
-
* Gives you full control over how you process the stream.
|
|
41
|
-
*
|
|
42
|
-
* ```ts
|
|
43
|
-
* for await (const chunk of createMessageStream(client, "Hello!")) {
|
|
44
|
-
* console.log(chunk.type, chunk.data);
|
|
45
|
-
* }
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export declare function createMessageStream(client: AgoClient, content: string, options?: {
|
|
49
|
-
conversationId?: string;
|
|
50
|
-
agentId?: string;
|
|
51
|
-
files?: File[];
|
|
52
|
-
}): AsyncGenerator<{
|
|
53
|
-
type: "start";
|
|
54
|
-
data: AgoClientEvents["message:start"];
|
|
55
|
-
} | {
|
|
56
|
-
type: "chunk";
|
|
57
|
-
data: AgoClientEvents["message:chunk"];
|
|
58
|
-
} | {
|
|
59
|
-
type: "complete";
|
|
60
|
-
data: AgoMessage;
|
|
61
|
-
} | {
|
|
62
|
-
type: "error";
|
|
63
|
-
data: AgoClientEvents["message:error"];
|
|
64
|
-
} | {
|
|
65
|
-
type: "toolCall";
|
|
66
|
-
data: ToolCallData;
|
|
67
|
-
}>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { AgoClient } from "../client/AgoClient";
|
|
2
|
-
import type { AgoClientEvents, AgoEventName } from "../client/types";
|
|
3
|
-
type MockFn = (...args: any[]) => any;
|
|
4
|
-
export interface MockAgoClientOptions {
|
|
5
|
-
overrides?: Partial<Record<string, MockFn>>;
|
|
6
|
-
}
|
|
7
|
-
export interface MockAgoClient extends AgoClient {
|
|
8
|
-
/**
|
|
9
|
-
* Simulate a server-pushed event.
|
|
10
|
-
* ```ts
|
|
11
|
-
* mock.__emitEvent("message:complete", { id: "1", content: "hi", ... });
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
__emitEvent<K extends AgoEventName>(event: K, data: AgoClientEvents[K]): void;
|
|
15
|
-
/**
|
|
16
|
-
* All recorded method calls: `[methodName, ...args][]`
|
|
17
|
-
*/
|
|
18
|
-
__calls: Array<{
|
|
19
|
-
method: string;
|
|
20
|
-
args: unknown[];
|
|
21
|
-
}>;
|
|
22
|
-
/**
|
|
23
|
-
* Get calls for a specific method.
|
|
24
|
-
*/
|
|
25
|
-
__callsFor(method: string): Array<{
|
|
26
|
-
method: string;
|
|
27
|
-
args: unknown[];
|
|
28
|
-
}>;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Create a mock AgoClient for testing. Works with any framework.
|
|
32
|
-
*
|
|
33
|
-
* ```ts
|
|
34
|
-
* import { createMockClient } from "@useago/sdk/testing";
|
|
35
|
-
*
|
|
36
|
-
* const mock = createMockClient();
|
|
37
|
-
* mock.__emitEvent("message:complete", someMessage);
|
|
38
|
-
* expect(mock.__callsFor("sendMessage")).toHaveLength(1);
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare function createMockClient(options?: MockAgoClientOptions): MockAgoClient;
|
|
42
|
-
export {};
|
package/dist/testing/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type EventHandler<T = unknown> = (data: T) => void;
|
|
2
|
-
/**
|
|
3
|
-
* Simple typed event emitter
|
|
4
|
-
*/
|
|
5
|
-
export declare class EventEmitter<Events extends Record<string, any> = Record<string, unknown>> {
|
|
6
|
-
private handlers;
|
|
7
|
-
on<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): void;
|
|
8
|
-
off<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): void;
|
|
9
|
-
emit<K extends keyof Events>(event: K, data: Events[K]): void;
|
|
10
|
-
/**
|
|
11
|
-
* Subscribe to an event and auto-unsubscribe after the first call.
|
|
12
|
-
*/
|
|
13
|
-
once<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): void;
|
|
14
|
-
/**
|
|
15
|
-
* Returns a Promise that resolves the next time `event` fires.
|
|
16
|
-
* Rejects if `timeout` (ms) is reached first.
|
|
17
|
-
*/
|
|
18
|
-
waitFor<K extends keyof Events>(event: K, options?: {
|
|
19
|
-
timeout?: number;
|
|
20
|
-
}): Promise<Events[K]>;
|
|
21
|
-
removeAllListeners(event?: keyof Events): void;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
package/dist/utils/index.d.ts
DELETED
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debug logger for SDK
|
|
3
|
-
*/
|
|
4
|
-
export declare class Logger {
|
|
5
|
-
private enabled;
|
|
6
|
-
constructor(enabled?: boolean);
|
|
7
|
-
enable(): void;
|
|
8
|
-
disable(): void;
|
|
9
|
-
log(...args: unknown[]): void;
|
|
10
|
-
warn(...args: unknown[]): void;
|
|
11
|
-
error(...args: unknown[]): void;
|
|
12
|
-
debug(...args: unknown[]): void;
|
|
13
|
-
}
|
|
14
|
-
export declare const logger: Logger;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AgoClient } from "../../client/AgoClient";
|
|
2
|
-
import type { AgoConfig } from "../../client/types";
|
|
3
|
-
/**
|
|
4
|
-
* Get or create an AgoClient.
|
|
5
|
-
*
|
|
6
|
-
* - Without args: returns the client from `AgoPlugin` (throws if none).
|
|
7
|
-
* - With config: creates a new client instance.
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* // From plugin
|
|
11
|
-
* const client = useAgo();
|
|
12
|
-
*
|
|
13
|
-
* // Standalone
|
|
14
|
-
* const client = useAgo({ baseUrl: "https://YOUR-DOMAIN.useago.com" });
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function useAgo(config?: AgoConfig): AgoClient;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AgoClientEvents, AgoEventName } from "../../client/types";
|
|
2
|
-
/**
|
|
3
|
-
* Subscribe to AGO client events with auto-cleanup on unmount.
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* useAgoEvents("message:complete", (msg) => {
|
|
7
|
-
* console.log("Got message:", msg.content);
|
|
8
|
-
* });
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare function useAgoEvents<K extends AgoEventName>(event: K, handler: (data: AgoClientEvents[K]) => void): void;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ClientFunctionHandler, ClientFunctionSchema } from "../../functions/types";
|
|
2
|
-
/**
|
|
3
|
-
* Register a client-side function with auto-cleanup on unmount.
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* useAgoFunction("showToast", {
|
|
7
|
-
* description: "Show a toast",
|
|
8
|
-
* parameters: { type: "object", properties: { message: { type: "string" } } },
|
|
9
|
-
* handler: async (args) => { toast(args.message); return { shown: true }; },
|
|
10
|
-
* });
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function useAgoFunction(name: string, options: {
|
|
14
|
-
description: string;
|
|
15
|
-
parameters: ClientFunctionSchema["parameters"];
|
|
16
|
-
handler: ClientFunctionHandler;
|
|
17
|
-
}): void;
|
|
18
|
-
export interface AgoRoute {
|
|
19
|
-
name: string;
|
|
20
|
-
path: string;
|
|
21
|
-
description: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Register navigation routes with auto-cleanup on unmount.
|
|
25
|
-
* Works with vue-router's `useRouter().push`.
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* const router = useRouter();
|
|
29
|
-
* useAgoNavigation((path) => router.push(path), [
|
|
30
|
-
* { name: "dashboard", path: "/dashboard", description: "Main dashboard" },
|
|
31
|
-
* ]);
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function useAgoNavigation(navigate: (path: string) => void, routes: AgoRoute[]): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
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>;
|