@ragable/sdk 0.6.22 → 0.6.24
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/index.d.mts +309 -4
- package/dist/index.d.ts +309 -4
- package/dist/index.js +544 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +534 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -74,10 +74,20 @@ type ColumnValue<D extends RagableDatabase, T extends RagableTableNames<D>, C ex
|
|
|
74
74
|
* or the browser throws **Illegal invocation**. Use this for defaults and for `options.fetch`.
|
|
75
75
|
*/
|
|
76
76
|
declare function bindFetch(custom?: typeof fetch): typeof fetch;
|
|
77
|
-
/**
|
|
77
|
+
/** Default hosted Ragable HTTP API base (`…/api`) when **`baseUrl`** is omitted. */
|
|
78
78
|
declare const DEFAULT_RAGABLE_API_BASE = "https://ragable-341305259977.asia-southeast1.run.app/api";
|
|
79
|
+
/**
|
|
80
|
+
* Normalize the API base (no trailing slash). Use **`DEFAULT_RAGABLE_API_BASE`** when
|
|
81
|
+
* **`explicitBaseUrl`** is missing or blank.
|
|
82
|
+
*/
|
|
83
|
+
declare function resolveRagableApiBase(explicitBaseUrl?: string | null | undefined): string;
|
|
79
84
|
interface RagableClientOptions {
|
|
80
85
|
apiKey: string;
|
|
86
|
+
/**
|
|
87
|
+
* HTTP API root including the **`/api`** segment, e.g. `https://your-host.com/api`.
|
|
88
|
+
* Defaults to {@link DEFAULT_RAGABLE_API_BASE}.
|
|
89
|
+
*/
|
|
90
|
+
baseUrl?: string;
|
|
81
91
|
fetch?: typeof fetch;
|
|
82
92
|
headers?: HeadersInit;
|
|
83
93
|
}
|
|
@@ -234,6 +244,249 @@ declare class ShiftClient {
|
|
|
234
244
|
}>;
|
|
235
245
|
}
|
|
236
246
|
|
|
247
|
+
/**
|
|
248
|
+
* First SSE frame for website project agents (`POST …/agents/:name/chat/stream`).
|
|
249
|
+
*/
|
|
250
|
+
interface AgentStreamAgentInfoEvent {
|
|
251
|
+
type: "agent:info";
|
|
252
|
+
name: string;
|
|
253
|
+
agent_name: string;
|
|
254
|
+
}
|
|
255
|
+
/** Payload on the terminal `done` event (matches backend {@link AgentChatResult} + usage fields). */
|
|
256
|
+
interface AgentChatStreamDonePayload {
|
|
257
|
+
response: string;
|
|
258
|
+
traces: unknown[];
|
|
259
|
+
totalDurationMs: number;
|
|
260
|
+
httpResponse?: unknown;
|
|
261
|
+
inputTokens?: number;
|
|
262
|
+
outputTokens?: number;
|
|
263
|
+
cachedPromptTokens?: number;
|
|
264
|
+
cacheCreationInputTokens?: number;
|
|
265
|
+
completionProviders?: string[];
|
|
266
|
+
creditsCharged?: number;
|
|
267
|
+
agentSteps?: number;
|
|
268
|
+
finishReason?: string | null;
|
|
269
|
+
stopReason?: string | null;
|
|
270
|
+
turnMessages?: unknown;
|
|
271
|
+
promptTokensEstimated?: number;
|
|
272
|
+
contextWindow?: number;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Resolved outcome after the stream finishes. `assistantText` is the concatenation of
|
|
276
|
+
* all `token` deltas; `response` is the server’s final string from `done` (authoritative).
|
|
277
|
+
*/
|
|
278
|
+
interface AgentChatStreamResult extends AgentChatStreamDonePayload {
|
|
279
|
+
assistantText: string;
|
|
280
|
+
reasoningText: string;
|
|
281
|
+
}
|
|
282
|
+
interface AgentChatStreamHandlers {
|
|
283
|
+
/** Every parsed SSE object (including `ping`, `node:*`, etc.). */
|
|
284
|
+
onEvent?: (event: AgentStreamEvent) => void;
|
|
285
|
+
onAgentInfo?: (info: AgentStreamAgentInfoEvent) => void;
|
|
286
|
+
onToken?: (token: string, ctx: {
|
|
287
|
+
nodeId: string;
|
|
288
|
+
}) => void;
|
|
289
|
+
onReasoningToken?: (token: string, ctx: {
|
|
290
|
+
nodeId: string;
|
|
291
|
+
}) => void;
|
|
292
|
+
onToolCall?: (ctx: {
|
|
293
|
+
nodeId: string;
|
|
294
|
+
toolName: string;
|
|
295
|
+
args: unknown;
|
|
296
|
+
}) => void;
|
|
297
|
+
onToolArgsUpdate?: (ctx: {
|
|
298
|
+
nodeId: string;
|
|
299
|
+
args: Record<string, unknown>;
|
|
300
|
+
}) => void;
|
|
301
|
+
onToolResult?: (ctx: {
|
|
302
|
+
nodeId: string;
|
|
303
|
+
toolName: string;
|
|
304
|
+
durationMs: number;
|
|
305
|
+
result?: string;
|
|
306
|
+
}) => void;
|
|
307
|
+
onNodeStart?: (ctx: {
|
|
308
|
+
nodeId: string;
|
|
309
|
+
nodeType: string;
|
|
310
|
+
label: string;
|
|
311
|
+
}) => void;
|
|
312
|
+
onNodeComplete?: (ctx: {
|
|
313
|
+
nodeId: string;
|
|
314
|
+
output: unknown;
|
|
315
|
+
durationMs: number;
|
|
316
|
+
}) => void;
|
|
317
|
+
onNodeError?: (ctx: {
|
|
318
|
+
nodeId: string;
|
|
319
|
+
error: string;
|
|
320
|
+
}) => void;
|
|
321
|
+
/** Backend heartbeat — safe to ignore in UI. */
|
|
322
|
+
onPing?: () => void;
|
|
323
|
+
/** Fired when the server emits `done` (before {@link onComplete}). */
|
|
324
|
+
onDone?: (payload: AgentChatStreamDonePayload) => void;
|
|
325
|
+
/**
|
|
326
|
+
* Always called on successful completion (after `done`). Not called if the stream
|
|
327
|
+
* errors or ends without `done`.
|
|
328
|
+
*/
|
|
329
|
+
onComplete?: (result: AgentChatStreamResult) => void;
|
|
330
|
+
onError?: (error: unknown) => void;
|
|
331
|
+
}
|
|
332
|
+
interface RunAgentChatStreamOptions {
|
|
333
|
+
/**
|
|
334
|
+
* Abort while consuming events (in addition to any `signal` on the HTTP request).
|
|
335
|
+
* Stops reading and throws {@link RagableAbortError}.
|
|
336
|
+
*/
|
|
337
|
+
signal?: AbortSignal;
|
|
338
|
+
}
|
|
339
|
+
/** Narrow `done` events from a loose {@link AgentStreamEvent}. */
|
|
340
|
+
declare function parseAgentStreamDone(e: AgentStreamEvent): AgentChatStreamDonePayload | null;
|
|
341
|
+
/** @public Parse the initial `agent:info` SSE frame (website project agents). */
|
|
342
|
+
declare function parseAgentStreamAgentInfo(e: AgentStreamEvent): AgentStreamAgentInfoEvent | null;
|
|
343
|
+
/**
|
|
344
|
+
* Consume a Ragable agent SSE stream with callbacks and return the final result.
|
|
345
|
+
*
|
|
346
|
+
* For the same segment model as dashboard `AgentChat` (`streamingSegments` /
|
|
347
|
+
* `streamingContent`), use {@link runAgentChatStreamForUi} or
|
|
348
|
+
* `client.agents.runChatUiByName` instead.
|
|
349
|
+
*
|
|
350
|
+
* Typical low-level chat (string accumulation only):
|
|
351
|
+
*
|
|
352
|
+
* ```ts
|
|
353
|
+
* const result = await client.agents.runChatStreamByName("support", {
|
|
354
|
+
* message: input,
|
|
355
|
+
* history,
|
|
356
|
+
* signal: ac.signal,
|
|
357
|
+
* }, {
|
|
358
|
+
* onToken: (t) => setReply((s) => s + t),
|
|
359
|
+
* });
|
|
360
|
+
* ```
|
|
361
|
+
*
|
|
362
|
+
* Lower-level (same client, manual iterator):
|
|
363
|
+
*
|
|
364
|
+
* ```ts
|
|
365
|
+
* const result = await runAgentChatStream(
|
|
366
|
+
* client.agents.chatStreamByName("support", { message, signal }),
|
|
367
|
+
* { onToken: (t) => append(t) },
|
|
368
|
+
* { signal },
|
|
369
|
+
* );
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
declare function runAgentChatStream(source: AsyncIterable<AgentStreamEvent>, handlers?: AgentChatStreamHandlers, options?: RunAgentChatStreamOptions): Promise<AgentChatStreamResult>;
|
|
373
|
+
/**
|
|
374
|
+
* Like {@link runAgentChatStream} but resolves with `null` if the stream ends without `done`
|
|
375
|
+
* instead of throwing. Errors other than incomplete stream are still thrown.
|
|
376
|
+
*/
|
|
377
|
+
declare function runAgentChatStreamLenient(source: AsyncIterable<AgentStreamEvent>, handlers?: AgentChatStreamHandlers, options?: RunAgentChatStreamOptions): Promise<AgentChatStreamResult | null>;
|
|
378
|
+
/** True when {@link runAgentChatStream} stopped because no `done` event arrived. */
|
|
379
|
+
declare function isIncompleteAgentStreamError(e: unknown): boolean;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* UI-oriented agent streaming — folds wire events into the same segment model as
|
|
383
|
+
* `app/web/src/components/AgentChat.tsx` (`StreamSegment`), matching the reducers in
|
|
384
|
+
* `useEngineIDEAgent` / `useIDEAgent` (tool gating, coalesced text/reasoning, etc.).
|
|
385
|
+
*/
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Chat UI segments — structural parity with `StreamSegment` in dashboard `AgentChat`.
|
|
389
|
+
*/
|
|
390
|
+
type AgentChatUiSegment = {
|
|
391
|
+
type: "text";
|
|
392
|
+
content: string;
|
|
393
|
+
} | {
|
|
394
|
+
type: "reasoning";
|
|
395
|
+
content: string;
|
|
396
|
+
} | {
|
|
397
|
+
type: "tool";
|
|
398
|
+
id: string;
|
|
399
|
+
toolName: string;
|
|
400
|
+
status: "started" | "completed";
|
|
401
|
+
durationMs?: number;
|
|
402
|
+
args?: Record<string, unknown>;
|
|
403
|
+
result?: string;
|
|
404
|
+
} | {
|
|
405
|
+
type: "context_summarized";
|
|
406
|
+
step: number;
|
|
407
|
+
mode?: "llm" | "heuristic" | "llm+heuristic" | "aggressive";
|
|
408
|
+
reason?: "soft_limit" | "forced";
|
|
409
|
+
tokensRemovedEstimate?: number;
|
|
410
|
+
estimatedTokensAfter?: number;
|
|
411
|
+
} | {
|
|
412
|
+
type: "llm_step";
|
|
413
|
+
step: number;
|
|
414
|
+
inputTokens: number;
|
|
415
|
+
outputTokens: number;
|
|
416
|
+
cachedPromptTokens?: number;
|
|
417
|
+
cacheCreationInputTokens?: number;
|
|
418
|
+
creditsEstimated: number;
|
|
419
|
+
apiCostUsd?: number;
|
|
420
|
+
provider?: string;
|
|
421
|
+
} | {
|
|
422
|
+
type: "stop_reason";
|
|
423
|
+
content: string;
|
|
424
|
+
finishReason: string;
|
|
425
|
+
};
|
|
426
|
+
/** Assistant row to append to chat history (add your own `id`). */
|
|
427
|
+
interface AgentChatUiAssistantMessage {
|
|
428
|
+
role: "ai";
|
|
429
|
+
content: string;
|
|
430
|
+
segments?: AgentChatUiSegment[];
|
|
431
|
+
usage?: {
|
|
432
|
+
inputTokens: number;
|
|
433
|
+
outputTokens: number;
|
|
434
|
+
creditsCharged: number;
|
|
435
|
+
cachedPromptTokens?: number;
|
|
436
|
+
cacheCreationInputTokens?: number;
|
|
437
|
+
};
|
|
438
|
+
durationMs?: number;
|
|
439
|
+
finishReason?: string | null;
|
|
440
|
+
completionProviders?: string[];
|
|
441
|
+
agentSteps?: number;
|
|
442
|
+
}
|
|
443
|
+
interface AgentChatUiStreamResult {
|
|
444
|
+
/** Segments immediately before `done` (no trailing `stop_reason`). */
|
|
445
|
+
segmentsMidTurn: AgentChatUiSegment[];
|
|
446
|
+
/** Final segments including optional `stop_reason` from `done`. */
|
|
447
|
+
segments: AgentChatUiSegment[];
|
|
448
|
+
/** Persisted assistant message — matches dashboard `ChatMessageData` for `ai` (except `id`). */
|
|
449
|
+
message: AgentChatUiAssistantMessage;
|
|
450
|
+
done: AgentChatStreamDonePayload;
|
|
451
|
+
}
|
|
452
|
+
interface AgentChatStreamUiHandlers {
|
|
453
|
+
/**
|
|
454
|
+
* Live segment list — pass to `AgentChat` as `streamingSegments` (or your own renderer).
|
|
455
|
+
*/
|
|
456
|
+
onSegments?: (segments: AgentChatUiSegment[]) => void;
|
|
457
|
+
/**
|
|
458
|
+
* Plain assistant text — mirrors dashboard `streamingContent` (text channel only).
|
|
459
|
+
*/
|
|
460
|
+
onStreamingText?: (text: string) => void;
|
|
461
|
+
onAgentInfo?: (info: AgentStreamAgentInfoEvent) => void;
|
|
462
|
+
onEvent?: (event: AgentStreamEvent) => void;
|
|
463
|
+
onDone?: (payload: AgentChatStreamDonePayload) => void;
|
|
464
|
+
onComplete?: (result: AgentChatUiStreamResult) => void;
|
|
465
|
+
onError?: (error: unknown) => void;
|
|
466
|
+
}
|
|
467
|
+
/** Concatenate `text` segments (ignores reasoning/tools). */
|
|
468
|
+
declare function collectAssistantTextFromUiSegments(segments: AgentChatUiSegment[]): string;
|
|
469
|
+
/**
|
|
470
|
+
* Pure fold: one SSE event → next segment list. Matches `useEngineIDEAgent` / `useIDEAgent`
|
|
471
|
+
* behavior for token gating while a tool is in the `started` state.
|
|
472
|
+
*/
|
|
473
|
+
declare function foldAgentStreamIntoUiSegments(prev: AgentChatUiSegment[], event: AgentStreamEvent): AgentChatUiSegment[];
|
|
474
|
+
/**
|
|
475
|
+
* Merge live segments with the terminal `done` payload (optional `stop_reason` segment),
|
|
476
|
+
* and build the persisted assistant message — same shape as dashboard `ChatMessageData` for `ai`.
|
|
477
|
+
*/
|
|
478
|
+
declare function finalizeAgentChatUiTurn(segments: AgentChatUiSegment[], done: AgentChatStreamDonePayload): {
|
|
479
|
+
segments: AgentChatUiSegment[];
|
|
480
|
+
message: AgentChatUiAssistantMessage;
|
|
481
|
+
};
|
|
482
|
+
/**
|
|
483
|
+
* Consume a stream and drive dashboard-style UI state: {@link AgentChatStreamUiHandlers.onSegments}
|
|
484
|
+
* / {@link AgentChatStreamUiHandlers.onStreamingText} mirror `AgentChat`’s `streamingSegments` /
|
|
485
|
+
* `streamingContent`; the returned {@link AgentChatUiStreamResult.message} is ready to append
|
|
486
|
+
* to history like `useEngineIDEAgent` does on `done`.
|
|
487
|
+
*/
|
|
488
|
+
declare function runAgentChatStreamForUi(source: AsyncIterable<AgentStreamEvent>, handlers?: AgentChatStreamUiHandlers, options?: RunAgentChatStreamOptions): Promise<AgentChatUiStreamResult>;
|
|
489
|
+
|
|
237
490
|
interface AgentSummary {
|
|
238
491
|
id: string;
|
|
239
492
|
name: string;
|
|
@@ -249,6 +502,8 @@ interface AgentChatMessage {
|
|
|
249
502
|
interface AgentChatParams {
|
|
250
503
|
message: string;
|
|
251
504
|
history?: AgentChatMessage[];
|
|
505
|
+
/** Passed to `fetch` — aborts the HTTP request and SSE body. */
|
|
506
|
+
signal?: AbortSignal;
|
|
252
507
|
}
|
|
253
508
|
/** Mirrors backend ExecutionResult JSON shape (traces are opaque in the SDK). */
|
|
254
509
|
interface AgentChatResult {
|
|
@@ -275,6 +530,16 @@ declare class AgentsClient {
|
|
|
275
530
|
* Stream agent execution as SSE (`data: {json}` lines). Yields parsed JSON objects.
|
|
276
531
|
*/
|
|
277
532
|
chatStream(agentId: string, params: AgentChatParams): AsyncGenerator<AgentStreamEvent, void, undefined>;
|
|
533
|
+
/**
|
|
534
|
+
* Stream an agent turn with callbacks; returns the final `done` payload plus streamed text.
|
|
535
|
+
* Prefer this over manual iteration when building chat UIs against the server API key client.
|
|
536
|
+
*/
|
|
537
|
+
runChatStream(agentId: string, params: AgentChatParams, handlers?: AgentChatStreamHandlers): Promise<AgentChatStreamResult>;
|
|
538
|
+
/**
|
|
539
|
+
* Stream with dashboard-style `AgentChat` ergonomics: {@link AgentChatStreamUiHandlers.onSegments}
|
|
540
|
+
* / `onStreamingText` for live UI; returns a persisted-shaped assistant message on `done`.
|
|
541
|
+
*/
|
|
542
|
+
runChatUi(agentId: string, params: AgentChatParams, handlers?: AgentChatStreamUiHandlers): Promise<AgentChatUiStreamResult>;
|
|
278
543
|
}
|
|
279
544
|
|
|
280
545
|
/** @deprecated Kept for backward compat with `database.query()`. Not used by PostgREST path. */
|
|
@@ -639,6 +904,8 @@ interface AuthOptions {
|
|
|
639
904
|
}
|
|
640
905
|
interface RagableAuthConfig {
|
|
641
906
|
authGroupId: string;
|
|
907
|
+
/** HTTP API root (including `/api`); set from the browser client **`baseUrl`** option. */
|
|
908
|
+
baseUrl?: string;
|
|
642
909
|
fetch?: typeof fetch;
|
|
643
910
|
headers?: HeadersInit;
|
|
644
911
|
auth?: AuthOptions;
|
|
@@ -843,8 +1110,11 @@ declare class Transport {
|
|
|
843
1110
|
}
|
|
844
1111
|
declare function parseTransportResponse<T>(response: Response): Promise<T>;
|
|
845
1112
|
|
|
846
|
-
/**
|
|
847
|
-
|
|
1113
|
+
/**
|
|
1114
|
+
* Resolved API base (`…/api`, no trailing slash). With no argument, uses the same default as
|
|
1115
|
+
* {@link resolveRagableApiBase}.
|
|
1116
|
+
*/
|
|
1117
|
+
declare function normalizeBrowserApiBase(explicitBaseUrl?: string): string;
|
|
848
1118
|
type BrowserDataAuthMode = "user" | "publicAnon" | "admin";
|
|
849
1119
|
/**
|
|
850
1120
|
* Resolves how database requests are authorized. If `dataAuth` is omitted and a
|
|
@@ -856,6 +1126,12 @@ type BrowserDataAuthMode = "user" | "publicAnon" | "admin";
|
|
|
856
1126
|
declare function effectiveDataAuth(options: RagableBrowserClientOptions): BrowserDataAuthMode;
|
|
857
1127
|
interface RagableBrowserClientOptions {
|
|
858
1128
|
organizationId: string;
|
|
1129
|
+
/**
|
|
1130
|
+
* HTTP API root including **`/api`**, e.g. `https://your-host.com/api` or
|
|
1131
|
+
* `import.meta.env.VITE_RAGABLE_API_BASE`. Trailing slashes are stripped.
|
|
1132
|
+
* When omitted, the package default **`DEFAULT_RAGABLE_API_BASE`** is used.
|
|
1133
|
+
*/
|
|
1134
|
+
baseUrl?: string;
|
|
859
1135
|
websiteId?: string;
|
|
860
1136
|
authGroupId?: string;
|
|
861
1137
|
databaseInstanceId?: string;
|
|
@@ -1110,6 +1386,11 @@ declare class BrowserCollectionApi<Row extends Record<string, unknown> = Record<
|
|
|
1110
1386
|
} & Partial<WhereInput<RowD<Row>>>;
|
|
1111
1387
|
}) => Promise<PostgrestResult<BrowserCollectionRecord<RowD<Row>> | null>>;
|
|
1112
1388
|
insert: (data: BrowserCollectionInsertData<Row, Insert>) => Promise<PostgrestResult<BrowserCollectionRecord<RowD<Row>>>>;
|
|
1389
|
+
/**
|
|
1390
|
+
* Insert multiple rows in one request (server multi-value `INSERT`, single transaction).
|
|
1391
|
+
* Empty **`items`** resolves to an empty array. Max batch size is enforced on the server (500).
|
|
1392
|
+
*/
|
|
1393
|
+
insertMany: (items: BrowserCollectionInsertData<Row, Insert>[]) => Promise<PostgrestResult<BrowserCollectionRecord<RowD<Row>>[]>>;
|
|
1113
1394
|
/**
|
|
1114
1395
|
* Update rows matching `where` (JSON fields, plus envelope `id` / `createdAt` / `updatedAt`).
|
|
1115
1396
|
*/
|
|
@@ -1134,6 +1415,18 @@ declare class BrowserCollectionApi<Row extends Record<string, unknown> = Record<
|
|
|
1134
1415
|
deleted: number;
|
|
1135
1416
|
records: BrowserCollectionRecord<RowD<Row>>[];
|
|
1136
1417
|
}>>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Like {@link BrowserCollectionApi.delete} but the success payload includes **`meta.count`**
|
|
1420
|
+
* (number of deleted rows), matching {@link BrowserCollectionApi.updateMany}.
|
|
1421
|
+
*/
|
|
1422
|
+
deleteMany: (where: WhereInput<RowD<Row>>, options?: {
|
|
1423
|
+
limit?: number;
|
|
1424
|
+
}) => Promise<PostgrestResult<{
|
|
1425
|
+
records: BrowserCollectionRecord<RowD<Row>>[];
|
|
1426
|
+
meta: {
|
|
1427
|
+
count: number;
|
|
1428
|
+
};
|
|
1429
|
+
}>>;
|
|
1137
1430
|
}
|
|
1138
1431
|
type BrowserCollections<Database extends RagableDatabase = DefaultRagableDatabase> = [keyof Database["public"]["Tables"]] extends [never] ? Record<string, BrowserCollectionApi<Record<string, unknown>>> : {
|
|
1139
1432
|
readonly [Name in RagableTableNames<Database>]: BrowserCollectionApi<TableRow<Database, Name>, TableInsertRow<Database, Name>, TableUpdatePatch<Database, Name>>;
|
|
@@ -1146,6 +1439,7 @@ declare class RagableBrowserDatabaseClient<Database extends RagableDatabase = De
|
|
|
1146
1439
|
private readonly options;
|
|
1147
1440
|
private readonly ragableAuth;
|
|
1148
1441
|
private readonly fetchImpl;
|
|
1442
|
+
private readonly apiBase;
|
|
1149
1443
|
private _transport;
|
|
1150
1444
|
readonly collections: BrowserCollections<Database>;
|
|
1151
1445
|
readonly collection: BrowserCollectionFactory<Database>;
|
|
@@ -1269,6 +1563,7 @@ interface AgentConversationSubscription {
|
|
|
1269
1563
|
declare class RagableBrowserAgentsClient {
|
|
1270
1564
|
private readonly options;
|
|
1271
1565
|
private readonly fetchImpl;
|
|
1566
|
+
private readonly apiBase;
|
|
1272
1567
|
constructor(options: RagableBrowserClientOptions);
|
|
1273
1568
|
private toUrl;
|
|
1274
1569
|
private requireWebsiteId;
|
|
@@ -1277,6 +1572,16 @@ declare class RagableBrowserAgentsClient {
|
|
|
1277
1572
|
/** @deprecated Prefer `chatStreamByName(agentName, params)` for project-local `/agents/*.json` agents. */
|
|
1278
1573
|
chatStream(agentId: string, params: AgentPublicChatParams): AsyncGenerator<AgentStreamEvent, void, undefined>;
|
|
1279
1574
|
chatStreamByName(agentName: string, params: AgentChatParams): AsyncGenerator<AgentStreamEvent, void, undefined>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Stream a project agent (`/agents/*.json`) with callbacks; returns the final `done` payload
|
|
1577
|
+
* plus streamed assistant text. Prefer this over manual `for await` when building chat UIs.
|
|
1578
|
+
*/
|
|
1579
|
+
runChatStreamByName(agentName: string, params: AgentChatParams, handlers?: AgentChatStreamHandlers): Promise<AgentChatStreamResult>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Same as {@link runChatStreamByName} but folds events into `AgentChat`-style segments
|
|
1582
|
+
* (`onSegments` / `onStreamingText`) and returns a history-ready assistant message.
|
|
1583
|
+
*/
|
|
1584
|
+
runChatUiByName(agentName: string, params: AgentChatParams, handlers?: AgentChatStreamUiHandlers): Promise<AgentChatUiStreamResult>;
|
|
1280
1585
|
createConversation(params: {
|
|
1281
1586
|
agent_name?: string;
|
|
1282
1587
|
agentName?: string;
|
|
@@ -1391,4 +1696,4 @@ declare function createClient(options: RagableClientOptions): Ragable;
|
|
|
1391
1696
|
declare function createClient<Database extends RagableDatabase = DefaultRagableDatabase, AuthUser extends object = DefaultAuthUser>(options: RagableBrowserClientOptions): RagableBrowser<Database, AuthUser>;
|
|
1392
1697
|
declare function createRagableServerClient(options: RagableClientOptions): Ragable;
|
|
1393
1698
|
|
|
1394
|
-
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentConversation, type AgentConversationMessage, type AgentConversationSubscription, type AgentPublicChatParams, type AgentStreamEvent, type AgentSummary, AgentsClient, AuthBroadcastChannel, type AuthBroadcastMessage, type AuthChangeEvent, type AuthOptions, type AuthSession, type AuthSignUpCredentials, type AuthUpdateUserAttributes, type AuthUserMetadata, type BrowserAuthSession, type BrowserAuthTokens, BrowserCollectionApi, type BrowserCollectionDefinition, type BrowserCollectionFactory, type BrowserCollectionFindParams, type BrowserCollectionRecord, type BrowserCollections, type BrowserDataAuthMode, type BrowserRealtimeNotification, type BrowserRealtimeStatus, type BrowserRealtimeSubscribeParams, type BrowserRealtimeSubscription, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, type CollectionReturnMode, type CollectionRowData, type CollectionRowWithMeta, type CollectionWhere, type ColumnName, type ColumnValue, CookieStorageAdapter, DEFAULT_RAGABLE_API_BASE, type DefaultAuthUser, type DefaultRagableDatabase, type FormatContextOptions, type HttpMethod, type Json, LocalStorageAdapter, MemoryStorageAdapter, type PostgRESTFetch, type PostgRESTFetchParams, PostgrestDeleteReturningBuilder, PostgrestDeleteRootBuilder, PostgrestInsertReturningBuilder, PostgrestInsertRootBuilder, PostgrestInsertSdkErrorReturning, PostgrestInsertSdkErrorRoot, type PostgrestResult, PostgrestSelectBuilder, PostgrestTableApi, PostgrestUpdateReturningBuilder, PostgrestUpdateRootBuilder, type PostgrestUpsertOptions, PostgrestUpsertReturningBuilder, PostgrestUpsertRootBuilder, type RagClientForPipeline, type RagPipeline, type RagPipelineOptions, Ragable, RagableAbortError, RagableAuth, type RagableAuthConfig, RagableBrowser, RagableBrowserAgentsClient, RagableBrowserAuthClient, type RagableBrowserClientOptions, RagableBrowserDatabaseClient, type RagableClientOptions, type RagableDatabase, RagableError, RagableNetworkError, RagableRequestClient, type RagableResult, RagableSdkError, type RagableTableDefinition, type RagableTableNames, RagableTimeoutError, type RequestOptions, type RetrieveParams, type RetryOptions, type RunQuery, type SessionStorage, SessionStorageAdapter, type ShiftAddDocumentParams, ShiftClient, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, type SseJsonEvent, type SupabaseCompatSession, type TableInsertRow, type TableRow, type TableUpdatePatch, type Tables, type TablesInsert, type TablesUpdate, Transport, type TransportOptions, type TransportRequest, type WhereInput, type WhereOperatorObject, asPostgrestResponse, assertPostgrestSuccess, bindFetch, collectionRecordToRowWithMeta, collectionRecordsToRowWithMeta, createBrowserClient, createClient, createRagPipeline, createRagableBrowserClient, createRagableServerClient, detectStorage, effectiveDataAuth, extractErrorMessage, formatPostgrestError, formatRetrievalContext, formatSdkError, generateIdempotencyKey, normalizeBrowserApiBase, parseSseDataLine, parseTransportResponse, readSseStream, toRagableResult, unwrapPostgrest };
|
|
1699
|
+
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentChatStreamDonePayload, type AgentChatStreamHandlers, type AgentChatStreamResult, type AgentChatStreamUiHandlers, type AgentChatUiAssistantMessage, type AgentChatUiSegment, type AgentChatUiStreamResult, type AgentConversation, type AgentConversationMessage, type AgentConversationSubscription, type AgentPublicChatParams, type AgentStreamAgentInfoEvent, type AgentStreamEvent, type AgentSummary, AgentsClient, AuthBroadcastChannel, type AuthBroadcastMessage, type AuthChangeEvent, type AuthOptions, type AuthSession, type AuthSignUpCredentials, type AuthUpdateUserAttributes, type AuthUserMetadata, type BrowserAuthSession, type BrowserAuthTokens, BrowserCollectionApi, type BrowserCollectionDefinition, type BrowserCollectionFactory, type BrowserCollectionFindParams, type BrowserCollectionRecord, type BrowserCollections, type BrowserDataAuthMode, type BrowserRealtimeNotification, type BrowserRealtimeStatus, type BrowserRealtimeSubscribeParams, type BrowserRealtimeSubscription, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, type CollectionReturnMode, type CollectionRowData, type CollectionRowWithMeta, type CollectionWhere, type ColumnName, type ColumnValue, CookieStorageAdapter, DEFAULT_RAGABLE_API_BASE, type DefaultAuthUser, type DefaultRagableDatabase, type FormatContextOptions, type HttpMethod, type Json, LocalStorageAdapter, MemoryStorageAdapter, type PostgRESTFetch, type PostgRESTFetchParams, PostgrestDeleteReturningBuilder, PostgrestDeleteRootBuilder, PostgrestInsertReturningBuilder, PostgrestInsertRootBuilder, PostgrestInsertSdkErrorReturning, PostgrestInsertSdkErrorRoot, type PostgrestResult, PostgrestSelectBuilder, PostgrestTableApi, PostgrestUpdateReturningBuilder, PostgrestUpdateRootBuilder, type PostgrestUpsertOptions, PostgrestUpsertReturningBuilder, PostgrestUpsertRootBuilder, type RagClientForPipeline, type RagPipeline, type RagPipelineOptions, Ragable, RagableAbortError, RagableAuth, type RagableAuthConfig, RagableBrowser, RagableBrowserAgentsClient, RagableBrowserAuthClient, type RagableBrowserClientOptions, RagableBrowserDatabaseClient, type RagableClientOptions, type RagableDatabase, RagableError, RagableNetworkError, RagableRequestClient, type RagableResult, RagableSdkError, type RagableTableDefinition, type RagableTableNames, RagableTimeoutError, type RequestOptions, type RetrieveParams, type RetryOptions, type RunAgentChatStreamOptions, type RunQuery, type SessionStorage, SessionStorageAdapter, type ShiftAddDocumentParams, ShiftClient, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, type SseJsonEvent, type SupabaseCompatSession, type TableInsertRow, type TableRow, type TableUpdatePatch, type Tables, type TablesInsert, type TablesUpdate, Transport, type TransportOptions, type TransportRequest, type WhereInput, type WhereOperatorObject, asPostgrestResponse, assertPostgrestSuccess, bindFetch, collectAssistantTextFromUiSegments, collectionRecordToRowWithMeta, collectionRecordsToRowWithMeta, createBrowserClient, createClient, createRagPipeline, createRagableBrowserClient, createRagableServerClient, detectStorage, effectiveDataAuth, extractErrorMessage, finalizeAgentChatUiTurn, foldAgentStreamIntoUiSegments, formatPostgrestError, formatRetrievalContext, formatSdkError, generateIdempotencyKey, isIncompleteAgentStreamError, normalizeBrowserApiBase, parseAgentStreamAgentInfo, parseAgentStreamDone, parseSseDataLine, parseTransportResponse, readSseStream, resolveRagableApiBase, runAgentChatStream, runAgentChatStreamForUi, runAgentChatStreamLenient, toRagableResult, unwrapPostgrest };
|