@cubos/agent-sdk 0.0.1136563
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/README.md +446 -0
- package/dist/admin/agents.d.ts +191 -0
- package/dist/admin/ai-providers.d.ts +122 -0
- package/dist/admin/channels.d.ts +261 -0
- package/dist/admin/client-tools.d.ts +74 -0
- package/dist/admin/component-libraries.d.ts +63 -0
- package/dist/admin/conversations.d.ts +434 -0
- package/dist/admin/global.d.ts +137 -0
- package/dist/admin/index.d.ts +67 -0
- package/dist/admin/knowledge-bases.d.ts +142 -0
- package/dist/admin/mcps.d.ts +134 -0
- package/dist/admin/paths.d.ts +9 -0
- package/dist/admin/skills.d.ts +43 -0
- package/dist/admin/task-templates.d.ts +185 -0
- package/dist/admin/users.d.ts +208 -0
- package/dist/cache.d.ts +68 -0
- package/dist/client-tools.d.ts +96 -0
- package/dist/client.d.ts +427 -0
- package/dist/errors.d.ts +52 -0
- package/dist/generated/schema.d.ts +13564 -0
- package/dist/http.d.ts +42 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1826 -0
- package/dist/index.js.map +30 -0
- package/dist/mapping.d.ts +170 -0
- package/dist/schemas.d.ts +2 -0
- package/dist/sse.d.ts +48 -0
- package/dist/sse.js +209 -0
- package/dist/sse.js.map +11 -0
- package/dist/types.d.ts +263 -0
- package/package.json +51 -0
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { FetchLike } from "./sse.js";
|
|
2
|
+
/** Called before every request. Cache inside your own implementation if the
|
|
3
|
+
* token is expensive to mint; the SDK calls this freely. `forceRefresh` is set
|
|
4
|
+
* on the retry after a 401 — return a newly minted token, not the cached one. */
|
|
5
|
+
export type TokenSource = (opts: {
|
|
6
|
+
forceRefresh: boolean;
|
|
7
|
+
}) => Promise<string> | string;
|
|
8
|
+
/**
|
|
9
|
+
* A long-lived api_key, or a short-lived end-user token fetched on demand.
|
|
10
|
+
*
|
|
11
|
+
* The distinction is not cosmetic: an api_key is tenant-wide and must never
|
|
12
|
+
* reach a browser, while a user token is scoped to one user and expires. The
|
|
13
|
+
* two client constructors keep them apart at the type level.
|
|
14
|
+
*/
|
|
15
|
+
export type Auth = {
|
|
16
|
+
apiKey: string | (() => string | Promise<string>);
|
|
17
|
+
} | {
|
|
18
|
+
getToken: TokenSource;
|
|
19
|
+
};
|
|
20
|
+
interface RequestOptions {
|
|
21
|
+
body?: unknown;
|
|
22
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
/** Skip JSON parsing; used by endpoints that answer 204 or raw bytes. */
|
|
25
|
+
raw?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface Transport {
|
|
28
|
+
request<T>(method: string, path: string, opts?: RequestOptions): Promise<T>;
|
|
29
|
+
fetchRaw(method: string, path: string, opts?: RequestOptions): Promise<Response>;
|
|
30
|
+
/** Headers for a stream connect, refreshed per (re)connect attempt. */
|
|
31
|
+
streamHeaders(): Promise<Record<string, string>>;
|
|
32
|
+
url(path: string, query?: RequestOptions["query"]): string;
|
|
33
|
+
fetchImpl: FetchLike;
|
|
34
|
+
}
|
|
35
|
+
/** Long enough for a slow upload on a bad connection, short enough that a hung
|
|
36
|
+
* server surfaces as an error instead of a spinner that never resolves. */
|
|
37
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
38
|
+
/** How many times a 429 is retried before giving up. Two covers a burst that
|
|
39
|
+
* briefly outran the budget; more would just delay an error the caller needs. */
|
|
40
|
+
export declare const DEFAULT_MAX_RETRIES = 2;
|
|
41
|
+
export declare function createTransport(baseUrl: string, auth: Auth, fetchImpl?: FetchLike, timeoutMs?: number, maxRetries?: number): Transport;
|
|
42
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { AdminClient, AdminClientOptions, TenantScope } from "./admin/index.js";
|
|
2
|
+
export { createAdminClient } from "./admin/index.js";
|
|
3
|
+
export type { CachedConversation, ConversationCache, MemoryConversationCacheOptions, } from "./cache.js";
|
|
4
|
+
export { MemoryConversationCache } from "./cache.js";
|
|
5
|
+
export type { ClientOptions, ClientOptions as UserClientOptions, ConversationHandlers, ConversationSubscription, HistoryStart, ListHandlers, UserCredential, } from "./client.js";
|
|
6
|
+
export { AgentClient, createUserClient } from "./client.js";
|
|
7
|
+
export type { ClientTool, ClientToolContext, ClientToolsSession, ServeClientToolsOptions, } from "./client-tools.js";
|
|
8
|
+
export { serveClientTools } from "./client-tools.js";
|
|
9
|
+
export { AgentApiError, AgentConfigError, AgentError, AgentNetworkError } from "./errors.js";
|
|
10
|
+
export type { Auth, TokenSource, Transport } from "./http.js";
|
|
11
|
+
export { DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS } from "./http.js";
|
|
12
|
+
export { mergeToolActivities, mergeVoiceMessages } from "./mapping.js";
|
|
13
|
+
export type { Schemas } from "./schemas.js";
|
|
14
|
+
export type { FetchLike } from "./sse.js";
|
|
15
|
+
export { readSse } from "./sse.js";
|
|
16
|
+
export type { Activity, Attachment, AttachmentKind, Block, ClientToolCall, Conversation, ConversationEvent, CreateConversationOptions, EnabledComponents, EventPage, Identity, ListConversationsOptions, Message, MessagePage, MessageRole, Page, PlanSnapshot, Todo, TodoStatus, ToolActivity, WorkspaceDir, WorkspaceEntry, } from "./types.js";
|