@umituz/web-ai 1.1.0 → 1.2.0
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 +29 -3
- package/dist/{cancellation-error-_39nYWwz.d.cts → cancellation-error-BWb59Wkj.d.cts} +1 -1
- package/dist/{cancellation-error-hYcE9AS9.d.ts → cancellation-error-D9LETLCD.d.ts} +1 -1
- package/dist/chat/index.cjs +1 -0
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.js +1 -0
- package/dist/chat/index.js.map +1 -1
- package/dist/content/index.cjs +622 -8
- package/dist/content/index.cjs.map +1 -1
- package/dist/content/index.d.cts +2 -2
- package/dist/content/index.d.ts +2 -2
- package/dist/content/index.js +622 -8
- package/dist/content/index.js.map +1 -1
- package/dist/context-manager-CuZz0vnC.d.cts +104 -0
- package/dist/context-manager-CuZz0vnC.d.ts +104 -0
- package/dist/core/index.cjs +147 -10
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +91 -73
- package/dist/core/index.d.ts +91 -73
- package/dist/core/index.js +141 -11
- package/dist/core/index.js.map +1 -1
- package/dist/{create-ai-D-oEWzf9.d.ts → create-ai-Cq3HkJxd.d.ts} +61 -1
- package/dist/{create-ai-DRysRImc.d.cts → create-ai-DDyTVzef.d.cts} +61 -1
- package/dist/hooks/index.cjs +747 -15
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +57 -4
- package/dist/hooks/index.d.ts +57 -4
- package/dist/hooks/index.js +746 -16
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +1180 -242
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +1140 -243
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +1212 -362
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +422 -10
- package/dist/providers/index.d.ts +422 -10
- package/dist/providers/index.js +1179 -363
- package/dist/providers/index.js.map +1 -1
- package/dist/remote-chat-client-LrNlew4n.d.cts +70 -0
- package/dist/remote-chat-client-LrNlew4n.d.ts +70 -0
- package/dist/{requestQueue-D89wx91Q.d.cts → requestQueue--h2uZ-Q3.d.cts} +1 -1
- package/dist/{requestQueue-AP6n_bRH.d.ts → requestQueue-BGeCy4Fd.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/tool-call-accumulator-C7KhaXZA.d.cts +0 -69
- package/dist/tool-call-accumulator-C7KhaXZA.d.ts +0 -69
package/dist/hooks/index.d.cts
CHANGED
|
@@ -3,12 +3,14 @@ import { d as AIErrorCode, t as SentimentAnalysisResult, C as ContentAnalysisReq
|
|
|
3
3
|
export { f as AspectRatio, h as CreditCost, i as GENERATION_COSTS, j as GenerationMetadata, x as calculateCreditCost } from '../AIErrors-_IyXRWj1.cjs';
|
|
4
4
|
import { d as ProviderConfig, I as ImageGenerationRequest, G as GeneratedContent, V as VideoGenerationRequest, a as ImageToVideoRequest, b as VideoToVideoRequest } from '../ProviderConfig-DIFa9nmG.cjs';
|
|
5
5
|
import { c as ITextGenerator, d as ITextProvider, e as ProviderFactory } from '../provider.factory-Ce6Een1G.cjs';
|
|
6
|
-
import { A as AIProviderConfig, q as GroqGenerationConfig } from '../create-ai-
|
|
6
|
+
import { A as AIProviderConfig, q as GroqGenerationConfig } from '../create-ai-DDyTVzef.cjs';
|
|
7
7
|
import { b as TextTier } from '../index-OhvYUTXf.cjs';
|
|
8
8
|
import { C as CacheManager, b as CacheStats } from '../cache-manager-Df9LLYGA.cjs';
|
|
9
9
|
import { d as ChatService, U as UseChatOptions, k as UseChatReturn } from '../chat.service-8MaW9pum.cjs';
|
|
10
|
-
import { T as TextGenerationService, j as PrunaResult, G as GenerateOptions, e as PrunaInput, a as GenerationStage } from '../cancellation-error-
|
|
11
|
-
export { C as CancellationError } from '../cancellation-error-
|
|
10
|
+
import { T as TextGenerationService, j as PrunaResult, G as GenerateOptions, e as PrunaInput, a as GenerationStage } from '../cancellation-error-BWb59Wkj.cjs';
|
|
11
|
+
export { C as CancellationError } from '../cancellation-error-BWb59Wkj.cjs';
|
|
12
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
13
|
+
import { R as RemoteChatClient, b as RemoteChatStreamBody } from '../remote-chat-client-LrNlew4n.cjs';
|
|
12
14
|
import '../index-Dv8gRzAu.cjs';
|
|
13
15
|
|
|
14
16
|
/** Provider config for the underlying AIContentService — new AIProviderConfig,
|
|
@@ -244,6 +246,57 @@ interface UseGroqDeps {
|
|
|
244
246
|
}
|
|
245
247
|
declare function useGroq(options?: UseGroqOptions, deps?: UseGroqDeps): UseGroqReturn;
|
|
246
248
|
|
|
249
|
+
type RemoteChatMessageStatus = "pending" | "streaming" | "complete" | "stopped" | "error";
|
|
250
|
+
interface RemoteChatUsage {
|
|
251
|
+
readonly inputTokens: number;
|
|
252
|
+
readonly outputTokens: number;
|
|
253
|
+
readonly reasoningTokens?: number;
|
|
254
|
+
}
|
|
255
|
+
interface RemoteChatMessage {
|
|
256
|
+
readonly id: string;
|
|
257
|
+
readonly role: "user" | "assistant";
|
|
258
|
+
readonly content: string;
|
|
259
|
+
readonly reasoning: string;
|
|
260
|
+
readonly status: RemoteChatMessageStatus;
|
|
261
|
+
readonly error: {
|
|
262
|
+
readonly code: string;
|
|
263
|
+
readonly message: string;
|
|
264
|
+
} | null;
|
|
265
|
+
readonly usage: RemoteChatUsage | null;
|
|
266
|
+
}
|
|
267
|
+
/** Placeholder id for the assistant message while it streams; replaced by
|
|
268
|
+
* the persisted id on `done`. */
|
|
269
|
+
declare const REMOTE_CHAT_STREAMING_ID = "streaming";
|
|
270
|
+
interface UseRemoteChatOptions<TToolCall = unknown> {
|
|
271
|
+
readonly client: RemoteChatClient;
|
|
272
|
+
/** Called for every `tool_call` event (pending approval, etc.). */
|
|
273
|
+
readonly onToolCall?: (toolCall: TToolCall) => void;
|
|
274
|
+
/** Called once per finished stream (success, error, or abort). */
|
|
275
|
+
readonly onStreamEnd?: (info: {
|
|
276
|
+
readonly conversationId: string;
|
|
277
|
+
readonly stopped: boolean;
|
|
278
|
+
}) => void | Promise<void>;
|
|
279
|
+
/** Id factory for the optimistic user echo. */
|
|
280
|
+
readonly localUserId?: () => string;
|
|
281
|
+
}
|
|
282
|
+
interface UseRemoteChatReturn {
|
|
283
|
+
readonly messages: ReadonlyArray<RemoteChatMessage>;
|
|
284
|
+
setMessages: Dispatch<SetStateAction<RemoteChatMessage[]>>;
|
|
285
|
+
readonly isStreaming: boolean;
|
|
286
|
+
readonly isResolving: boolean;
|
|
287
|
+
/** Start a stream; `localUserContent` echoes the user message optimistically. */
|
|
288
|
+
stream(conversationId: string, body: RemoteChatStreamBody, opts?: {
|
|
289
|
+
readonly localUserContent?: string;
|
|
290
|
+
}): Promise<void>;
|
|
291
|
+
/** Approve/reject a tool call and consume the continuation stream. */
|
|
292
|
+
resolveToolCall(conversationId: string, toolCallId: string, approved: boolean): Promise<boolean>;
|
|
293
|
+
/** Abort the active stream; the next `onStreamEnd` reports `stopped: true`. */
|
|
294
|
+
abort(): void;
|
|
295
|
+
/** Patch the last message (status/id/usage updates). */
|
|
296
|
+
patchLast(patch: Partial<RemoteChatMessage>): void;
|
|
297
|
+
}
|
|
298
|
+
declare function useRemoteChat<TToolCall = unknown>(options: UseRemoteChatOptions<TToolCall>): UseRemoteChatReturn;
|
|
299
|
+
|
|
247
300
|
interface AsyncActionState<TResult> {
|
|
248
301
|
result: TResult | null;
|
|
249
302
|
isLoading: boolean;
|
|
@@ -279,4 +332,4 @@ interface UsePrunaProxyOptions {
|
|
|
279
332
|
type UsePrunaProxyReturn = AsyncActionApi<PrunaResult, PrunaInput>;
|
|
280
333
|
declare function usePrunaProxy(options: UsePrunaProxyOptions): UsePrunaProxyReturn;
|
|
281
334
|
|
|
282
|
-
export { type AsyncActionApi, type AsyncActionExecutor, type AsyncActionState, type ContentWizardRequest, type CreditCheckFunction, GenerationProgress, GenerationResult, GenerationStatus, GenerationType, ImageGenerationInput, ImageQuality, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseAsyncActionOptions, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseGroqDeps, type UseGroqOptions, type UseGroqReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UsePrunaGenerationOptions, type UsePrunaGenerationReturn, type UsePrunaProxyOptions, type UsePrunaProxyReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, VideoGenerationInput, VideoQuality, type VideoWizardRequest, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useSocialContentGenerator, useText, useVideoWizard };
|
|
335
|
+
export { type AsyncActionApi, type AsyncActionExecutor, type AsyncActionState, type ContentWizardRequest, type CreditCheckFunction, GenerationProgress, GenerationResult, GenerationStatus, GenerationType, ImageGenerationInput, ImageQuality, REMOTE_CHAT_STREAMING_ID, type RemoteChatMessage, type RemoteChatMessageStatus, type RemoteChatUsage, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseAsyncActionOptions, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseGroqDeps, type UseGroqOptions, type UseGroqReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UsePrunaGenerationOptions, type UsePrunaGenerationReturn, type UsePrunaProxyOptions, type UsePrunaProxyReturn, type UseRemoteChatOptions, type UseRemoteChatReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, VideoGenerationInput, VideoQuality, type VideoWizardRequest, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useRemoteChat, useSocialContentGenerator, useText, useVideoWizard };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,12 +3,14 @@ import { d as AIErrorCode, t as SentimentAnalysisResult, C as ContentAnalysisReq
|
|
|
3
3
|
export { f as AspectRatio, h as CreditCost, i as GENERATION_COSTS, j as GenerationMetadata, x as calculateCreditCost } from '../AIErrors-TuSFl--T.js';
|
|
4
4
|
import { d as ProviderConfig, I as ImageGenerationRequest, G as GeneratedContent, V as VideoGenerationRequest, a as ImageToVideoRequest, b as VideoToVideoRequest } from '../ProviderConfig-DIFa9nmG.js';
|
|
5
5
|
import { c as ITextGenerator, d as ITextProvider, e as ProviderFactory } from '../provider.factory-B9RNUTYj.js';
|
|
6
|
-
import { A as AIProviderConfig, q as GroqGenerationConfig } from '../create-ai-
|
|
6
|
+
import { A as AIProviderConfig, q as GroqGenerationConfig } from '../create-ai-Cq3HkJxd.js';
|
|
7
7
|
import { b as TextTier } from '../index-OhvYUTXf.js';
|
|
8
8
|
import { C as CacheManager, b as CacheStats } from '../cache-manager-Df9LLYGA.js';
|
|
9
9
|
import { d as ChatService, U as UseChatOptions, k as UseChatReturn } from '../chat.service-B4Isrckn.js';
|
|
10
|
-
import { T as TextGenerationService, j as PrunaResult, G as GenerateOptions, e as PrunaInput, a as GenerationStage } from '../cancellation-error-
|
|
11
|
-
export { C as CancellationError } from '../cancellation-error-
|
|
10
|
+
import { T as TextGenerationService, j as PrunaResult, G as GenerateOptions, e as PrunaInput, a as GenerationStage } from '../cancellation-error-D9LETLCD.js';
|
|
11
|
+
export { C as CancellationError } from '../cancellation-error-D9LETLCD.js';
|
|
12
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
13
|
+
import { R as RemoteChatClient, b as RemoteChatStreamBody } from '../remote-chat-client-LrNlew4n.js';
|
|
12
14
|
import '../index-1e91KRYU.js';
|
|
13
15
|
|
|
14
16
|
/** Provider config for the underlying AIContentService — new AIProviderConfig,
|
|
@@ -244,6 +246,57 @@ interface UseGroqDeps {
|
|
|
244
246
|
}
|
|
245
247
|
declare function useGroq(options?: UseGroqOptions, deps?: UseGroqDeps): UseGroqReturn;
|
|
246
248
|
|
|
249
|
+
type RemoteChatMessageStatus = "pending" | "streaming" | "complete" | "stopped" | "error";
|
|
250
|
+
interface RemoteChatUsage {
|
|
251
|
+
readonly inputTokens: number;
|
|
252
|
+
readonly outputTokens: number;
|
|
253
|
+
readonly reasoningTokens?: number;
|
|
254
|
+
}
|
|
255
|
+
interface RemoteChatMessage {
|
|
256
|
+
readonly id: string;
|
|
257
|
+
readonly role: "user" | "assistant";
|
|
258
|
+
readonly content: string;
|
|
259
|
+
readonly reasoning: string;
|
|
260
|
+
readonly status: RemoteChatMessageStatus;
|
|
261
|
+
readonly error: {
|
|
262
|
+
readonly code: string;
|
|
263
|
+
readonly message: string;
|
|
264
|
+
} | null;
|
|
265
|
+
readonly usage: RemoteChatUsage | null;
|
|
266
|
+
}
|
|
267
|
+
/** Placeholder id for the assistant message while it streams; replaced by
|
|
268
|
+
* the persisted id on `done`. */
|
|
269
|
+
declare const REMOTE_CHAT_STREAMING_ID = "streaming";
|
|
270
|
+
interface UseRemoteChatOptions<TToolCall = unknown> {
|
|
271
|
+
readonly client: RemoteChatClient;
|
|
272
|
+
/** Called for every `tool_call` event (pending approval, etc.). */
|
|
273
|
+
readonly onToolCall?: (toolCall: TToolCall) => void;
|
|
274
|
+
/** Called once per finished stream (success, error, or abort). */
|
|
275
|
+
readonly onStreamEnd?: (info: {
|
|
276
|
+
readonly conversationId: string;
|
|
277
|
+
readonly stopped: boolean;
|
|
278
|
+
}) => void | Promise<void>;
|
|
279
|
+
/** Id factory for the optimistic user echo. */
|
|
280
|
+
readonly localUserId?: () => string;
|
|
281
|
+
}
|
|
282
|
+
interface UseRemoteChatReturn {
|
|
283
|
+
readonly messages: ReadonlyArray<RemoteChatMessage>;
|
|
284
|
+
setMessages: Dispatch<SetStateAction<RemoteChatMessage[]>>;
|
|
285
|
+
readonly isStreaming: boolean;
|
|
286
|
+
readonly isResolving: boolean;
|
|
287
|
+
/** Start a stream; `localUserContent` echoes the user message optimistically. */
|
|
288
|
+
stream(conversationId: string, body: RemoteChatStreamBody, opts?: {
|
|
289
|
+
readonly localUserContent?: string;
|
|
290
|
+
}): Promise<void>;
|
|
291
|
+
/** Approve/reject a tool call and consume the continuation stream. */
|
|
292
|
+
resolveToolCall(conversationId: string, toolCallId: string, approved: boolean): Promise<boolean>;
|
|
293
|
+
/** Abort the active stream; the next `onStreamEnd` reports `stopped: true`. */
|
|
294
|
+
abort(): void;
|
|
295
|
+
/** Patch the last message (status/id/usage updates). */
|
|
296
|
+
patchLast(patch: Partial<RemoteChatMessage>): void;
|
|
297
|
+
}
|
|
298
|
+
declare function useRemoteChat<TToolCall = unknown>(options: UseRemoteChatOptions<TToolCall>): UseRemoteChatReturn;
|
|
299
|
+
|
|
247
300
|
interface AsyncActionState<TResult> {
|
|
248
301
|
result: TResult | null;
|
|
249
302
|
isLoading: boolean;
|
|
@@ -279,4 +332,4 @@ interface UsePrunaProxyOptions {
|
|
|
279
332
|
type UsePrunaProxyReturn = AsyncActionApi<PrunaResult, PrunaInput>;
|
|
280
333
|
declare function usePrunaProxy(options: UsePrunaProxyOptions): UsePrunaProxyReturn;
|
|
281
334
|
|
|
282
|
-
export { type AsyncActionApi, type AsyncActionExecutor, type AsyncActionState, type ContentWizardRequest, type CreditCheckFunction, GenerationProgress, GenerationResult, GenerationStatus, GenerationType, ImageGenerationInput, ImageQuality, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseAsyncActionOptions, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseGroqDeps, type UseGroqOptions, type UseGroqReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UsePrunaGenerationOptions, type UsePrunaGenerationReturn, type UsePrunaProxyOptions, type UsePrunaProxyReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, VideoGenerationInput, VideoQuality, type VideoWizardRequest, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useSocialContentGenerator, useText, useVideoWizard };
|
|
335
|
+
export { type AsyncActionApi, type AsyncActionExecutor, type AsyncActionState, type ContentWizardRequest, type CreditCheckFunction, GenerationProgress, GenerationResult, GenerationStatus, GenerationType, ImageGenerationInput, ImageQuality, REMOTE_CHAT_STREAMING_ID, type RemoteChatMessage, type RemoteChatMessageStatus, type RemoteChatUsage, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseAsyncActionOptions, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseGroqDeps, type UseGroqOptions, type UseGroqReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UsePrunaGenerationOptions, type UsePrunaGenerationReturn, type UsePrunaProxyOptions, type UsePrunaProxyReturn, type UseRemoteChatOptions, type UseRemoteChatReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, VideoGenerationInput, VideoQuality, type VideoWizardRequest, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useRemoteChat, useSocialContentGenerator, useText, useVideoWizard };
|