@umituz/web-ai 1.0.9 → 1.0.10
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/{AIErrors-CSk4nvN1.d.ts → AIErrors-TuSFl--T.d.ts} +1 -1
- package/dist/{AIErrors-Dq9o95R_.d.cts → AIErrors-_IyXRWj1.d.cts} +1 -1
- package/dist/{cancellation-error-CpkPd67D.d.cts → cancellation-error-_39nYWwz.d.cts} +3 -3
- package/dist/{cancellation-error-Ci8fQhNF.d.ts → cancellation-error-hYcE9AS9.d.ts} +3 -3
- package/dist/chat/index.d.cts +4 -4
- package/dist/chat/index.d.ts +4 -4
- package/dist/{chat.service-BRtiA7H9.d.cts → chat.service-8MaW9pum.d.cts} +2 -2
- package/dist/{chat.service-Cqga2h1e.d.ts → chat.service-B4Isrckn.d.ts} +2 -2
- package/dist/content/index.d.cts +7 -7
- package/dist/content/index.d.ts +7 -7
- package/dist/core/index.cjs +6 -4
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +7 -26
- package/dist/core/index.d.ts +7 -26
- package/dist/core/index.js +6 -4
- package/dist/core/index.js.map +1 -1
- package/dist/{create-ai-DW7eHMBF.d.ts → create-ai-D-oEWzf9.d.ts} +3 -3
- package/dist/{create-ai-DeOpUgZ-.d.cts → create-ai-DRysRImc.d.cts} +3 -3
- package/dist/hooks/index.d.cts +9 -9
- package/dist/hooks/index.d.ts +9 -9
- package/dist/{index-Ca5o4gBK.d.ts → index-1e91KRYU.d.ts} +1 -1
- package/dist/{index-itgxPeLz.d.cts → index-Dv8gRzAu.d.cts} +1 -1
- package/dist/{index-DDzvTDg0.d.ts → index-OhvYUTXf.d.cts} +1 -2
- package/dist/{index-DDzvTDg0.d.cts → index-OhvYUTXf.d.ts} +1 -2
- package/dist/index.cjs +305 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +304 -5
- package/dist/index.js.map +1 -1
- package/dist/{provider.factory-CJuI08Xr.d.ts → provider.factory-B9RNUTYj.d.ts} +1 -1
- package/dist/{provider.factory-DG2CYFgh.d.cts → provider.factory-Ce6Een1G.d.cts} +1 -1
- package/dist/providers/index.cjs +381 -0
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +61 -11
- package/dist/providers/index.d.ts +61 -11
- package/dist/providers/index.js +380 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/{requestQueue-D-RCbxuR.d.ts → requestQueue-AP6n_bRH.d.ts} +4 -4
- package/dist/{requestQueue-O6f8VBl5.d.cts → requestQueue-D89wx91Q.d.cts} +4 -4
- package/dist/{request-deduplicator.util-NDo0_n1y.d.cts → tool-call-accumulator-C7KhaXZA.d.cts} +20 -1
- package/dist/{request-deduplicator.util-NDo0_n1y.d.ts → tool-call-accumulator-C7KhaXZA.d.ts} +20 -1
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as TokenUsage, C as ChatMessage } from '../index-
|
|
2
|
-
export { F as FinishReason, G as GenerationResult, P as ProviderHealth, S as StructuredGeneration, a as StructuredTextRequest, T as TextRequest, b as TextTier } from '../index-
|
|
3
|
-
import { A as AIError, b as AIErrorType, a as AIErrorMetadata } from '../index-
|
|
4
|
-
export { T as TEXT_TIERS, c as TierModelMap, U as USER_FRIENDLY_ERROR_MESSAGES, i as isTextTier, m as mergeTierOverrides, r as resolveModel } from '../index-
|
|
5
|
-
import { b as RetryManager, c as RetryOptions, a as RequestQueue, R as RequestDeduplicator } from '../
|
|
6
|
-
export { Q as QueueOptions, r as requestDeduplicator, d as requestQueue, e as retryManager, w as withRetry } from '../
|
|
1
|
+
import { c as TokenUsage, C as ChatMessage } from '../index-OhvYUTXf.cjs';
|
|
2
|
+
export { F as FinishReason, G as GenerationResult, P as ProviderHealth, S as StructuredGeneration, a as StructuredTextRequest, T as TextRequest, b as TextTier } from '../index-OhvYUTXf.cjs';
|
|
3
|
+
import { A as AIError, b as AIErrorType, a as AIErrorMetadata } from '../index-Dv8gRzAu.cjs';
|
|
4
|
+
export { T as TEXT_TIERS, c as TierModelMap, U as USER_FRIENDLY_ERROR_MESSAGES, i as isTextTier, m as mergeTierOverrides, r as resolveModel } from '../index-Dv8gRzAu.cjs';
|
|
5
|
+
import { b as RetryManager, c as RetryOptions, a as RequestQueue, R as RequestDeduplicator } from '../tool-call-accumulator-C7KhaXZA.cjs';
|
|
6
|
+
export { A as AssistantToolCall, Q as QueueOptions, T as ToolCallAccumulator, W as WireToolCallDelta, r as requestDeduplicator, d as requestQueue, e as retryManager, w as withRetry } from '../tool-call-accumulator-C7KhaXZA.cjs';
|
|
7
7
|
export { C as CacheManager, a as CacheOptions, b as CacheStats, c as cacheManager } from '../cache-manager-Df9LLYGA.cjs';
|
|
8
8
|
|
|
9
9
|
type GroqErrorMetadata = AIErrorMetadata;
|
|
@@ -340,25 +340,6 @@ interface SseResponseOptions {
|
|
|
340
340
|
declare function defaultSseDeltaExtractor(payload: string): string | null;
|
|
341
341
|
declare function createSseResponse(openUpstream: () => Promise<ReadableStream<Uint8Array>>, options: SseResponseOptions): Response;
|
|
342
342
|
|
|
343
|
-
interface WireToolCallDelta {
|
|
344
|
-
readonly index?: number;
|
|
345
|
-
readonly id?: string;
|
|
346
|
-
readonly function?: {
|
|
347
|
-
readonly name?: string;
|
|
348
|
-
readonly arguments?: string;
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
interface AssistantToolCall {
|
|
352
|
-
readonly id: string;
|
|
353
|
-
readonly name: string;
|
|
354
|
-
readonly arguments: string;
|
|
355
|
-
}
|
|
356
|
-
declare class ToolCallAccumulator {
|
|
357
|
-
private readonly slots;
|
|
358
|
-
push(delta: WireToolCallDelta): void;
|
|
359
|
-
finish(): AssistantToolCall[];
|
|
360
|
-
}
|
|
361
|
-
|
|
362
343
|
type ContextRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
363
344
|
interface ContextMessage {
|
|
364
345
|
readonly role: ContextRole;
|
|
@@ -632,4 +613,4 @@ declare const DEFAULT_RETRY_MAX_DELAY_MS = 10000;
|
|
|
632
613
|
declare const DEFAULT_RETRY_BACKOFF_MULTIPLIER = 2;
|
|
633
614
|
declare const DEFAULT_RETRY_JITTER_FACTOR = 0.1;
|
|
634
615
|
|
|
635
|
-
export { AIError, type AIErrorBody, AIErrorMetadata, AIErrorType, type AccessCounted, type AccessTimestamped, type AgentContext, AiError, type AiErrorCode, type ApiKeyValidationRule,
|
|
616
|
+
export { AIError, type AIErrorBody, AIErrorMetadata, AIErrorType, type AccessCounted, type AccessTimestamped, type AgentContext, AiError, type AiErrorCode, type ApiKeyValidationRule, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, ChatMessage, type ChunkOptions, CompositeExecutor, type ContextBudget, type ContextMessage, type ContextRole, DEFAULT_AI_IDENTITY, DEFAULT_API_KEY_RULE, DEFAULT_EMBED_BATCH_SIZE, DEFAULT_ERROR_CLASSIFICATION_RULE, DEFAULT_GENERATION, DEFAULT_HTTP_STATUS_RULE, DEFAULT_RETRY_BACKOFF_MULTIPLIER, DEFAULT_RETRY_INITIAL_DELAY_MS, DEFAULT_RETRY_JITTER_FACTOR, DEFAULT_RETRY_MAX_ATTEMPTS, DEFAULT_RETRY_MAX_DELAY_MS, DEFAULT_TASK_POLICIES, DebounceManager, type DebounceOptions, DedupeExecutor, type DedupeExecutorOptions, type DiffChangeCount, type DiffLine, type EmbeddingsBatchAdapter, type ErrorClassificationRule, type ExponentialBackoffParams, type FailoverErrorLike, type FetchLike, GENERATION_BOUNDS, type GenerationSettings, GroqError, type GroqErrorMetadata, AIErrorType as GroqErrorType, type HttpStatusClassificationRule, type IRequestExecutor, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, type LeadingEdgeParams, type LoggedError, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, type MarkdownSegment, type MemoryLike, type ModelPricing, type ModelWithProvider, type NormalizedSseChunk, type ParsedSseEvent, type ProjectContext, type ProviderErrorShape, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, RequestDeduplicator, RequestQueue, type ResearchSource, type ResearchStreamEvent, RetryExecutor, RetryManager, RetryOptions, SEARCH_MAX_RESULTS, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, SYSTEM_PROMPT_VERSION, type SearchTopic, type SseDeltaExtractor, type SseResponseOptions, type StreamCallbacks, type StreamEvent, type StreamingParserCallbacks, StreamingResponseParser, StructuredPromptBuilder, type SystemPromptInput, TEXT_EXTRACT_PER_FILE_LIMIT, TEXT_EXTRACT_TOTAL_LIMIT, TRANSIENT_ERROR_CODES, type TaskPlan, type TaskPolicy, type TaskState, ThrottleManager, type ThrottleOptions, TokenUsage, type ToolSchema, type ToolValidationResult, type ToolValidatorFunction, type TrailingDelayParams, type UsageRecordData, type UsageRecordInput, type VectorCandidate, type VectorMatch, type WebSearchInput, type WebSearchResponse, type WebSearchResult, type ZodLikeIssue, type ZodLikeSchema, accumulateReport, aiErrorMessage, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildContext, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageData, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chunkText, clampScore, classifyHttpStatus, computeCostMicros, cosineSimilarity, countChanges, createSseResponse, debounce, debounceManager, defaultSseDeltaExtractor, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorFromStatus, errorFromUnknown, estimateMessageTokens, estimateTokens, extractErrorMessageFromJsonBody, extractErrorMessageFromResponse, extractJsonArray, extractJsonCandidate, extractJsonFromCodeFence, extractJsonObject, extractSseDataPayload, extractText, failoverCandidate, findTopKSimilar, formatCost, formatErrorForLogging, formatSseEvent, generateRandomBase36Suffix, isAuthErrorType, isRetryableErrorType, isSseDataLine, isSseDoneMarker, isTextLike, isTransientError, isValidApiKey, isWithinWindow, magnitude, nextAttemptDelayMs, normalizeGenerationSettings, normalizeSources, normalizeSseChunk, oneOfCatalog, parseSseEvent, planTaskFailure, readSseResponse, repairCommonJsonDefects, replayFirst, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, throttle, throttleManager, validateApiKey, validateToolArgs };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as TokenUsage, C as ChatMessage } from '../index-
|
|
2
|
-
export { F as FinishReason, G as GenerationResult, P as ProviderHealth, S as StructuredGeneration, a as StructuredTextRequest, T as TextRequest, b as TextTier } from '../index-
|
|
3
|
-
import { A as AIError, b as AIErrorType, a as AIErrorMetadata } from '../index-
|
|
4
|
-
export { T as TEXT_TIERS, c as TierModelMap, U as USER_FRIENDLY_ERROR_MESSAGES, i as isTextTier, m as mergeTierOverrides, r as resolveModel } from '../index-
|
|
5
|
-
import { b as RetryManager, c as RetryOptions, a as RequestQueue, R as RequestDeduplicator } from '../
|
|
6
|
-
export { Q as QueueOptions, r as requestDeduplicator, d as requestQueue, e as retryManager, w as withRetry } from '../
|
|
1
|
+
import { c as TokenUsage, C as ChatMessage } from '../index-OhvYUTXf.js';
|
|
2
|
+
export { F as FinishReason, G as GenerationResult, P as ProviderHealth, S as StructuredGeneration, a as StructuredTextRequest, T as TextRequest, b as TextTier } from '../index-OhvYUTXf.js';
|
|
3
|
+
import { A as AIError, b as AIErrorType, a as AIErrorMetadata } from '../index-1e91KRYU.js';
|
|
4
|
+
export { T as TEXT_TIERS, c as TierModelMap, U as USER_FRIENDLY_ERROR_MESSAGES, i as isTextTier, m as mergeTierOverrides, r as resolveModel } from '../index-1e91KRYU.js';
|
|
5
|
+
import { b as RetryManager, c as RetryOptions, a as RequestQueue, R as RequestDeduplicator } from '../tool-call-accumulator-C7KhaXZA.js';
|
|
6
|
+
export { A as AssistantToolCall, Q as QueueOptions, T as ToolCallAccumulator, W as WireToolCallDelta, r as requestDeduplicator, d as requestQueue, e as retryManager, w as withRetry } from '../tool-call-accumulator-C7KhaXZA.js';
|
|
7
7
|
export { C as CacheManager, a as CacheOptions, b as CacheStats, c as cacheManager } from '../cache-manager-Df9LLYGA.js';
|
|
8
8
|
|
|
9
9
|
type GroqErrorMetadata = AIErrorMetadata;
|
|
@@ -340,25 +340,6 @@ interface SseResponseOptions {
|
|
|
340
340
|
declare function defaultSseDeltaExtractor(payload: string): string | null;
|
|
341
341
|
declare function createSseResponse(openUpstream: () => Promise<ReadableStream<Uint8Array>>, options: SseResponseOptions): Response;
|
|
342
342
|
|
|
343
|
-
interface WireToolCallDelta {
|
|
344
|
-
readonly index?: number;
|
|
345
|
-
readonly id?: string;
|
|
346
|
-
readonly function?: {
|
|
347
|
-
readonly name?: string;
|
|
348
|
-
readonly arguments?: string;
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
interface AssistantToolCall {
|
|
352
|
-
readonly id: string;
|
|
353
|
-
readonly name: string;
|
|
354
|
-
readonly arguments: string;
|
|
355
|
-
}
|
|
356
|
-
declare class ToolCallAccumulator {
|
|
357
|
-
private readonly slots;
|
|
358
|
-
push(delta: WireToolCallDelta): void;
|
|
359
|
-
finish(): AssistantToolCall[];
|
|
360
|
-
}
|
|
361
|
-
|
|
362
343
|
type ContextRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
363
344
|
interface ContextMessage {
|
|
364
345
|
readonly role: ContextRole;
|
|
@@ -632,4 +613,4 @@ declare const DEFAULT_RETRY_MAX_DELAY_MS = 10000;
|
|
|
632
613
|
declare const DEFAULT_RETRY_BACKOFF_MULTIPLIER = 2;
|
|
633
614
|
declare const DEFAULT_RETRY_JITTER_FACTOR = 0.1;
|
|
634
615
|
|
|
635
|
-
export { AIError, type AIErrorBody, AIErrorMetadata, AIErrorType, type AccessCounted, type AccessTimestamped, type AgentContext, AiError, type AiErrorCode, type ApiKeyValidationRule,
|
|
616
|
+
export { AIError, type AIErrorBody, AIErrorMetadata, AIErrorType, type AccessCounted, type AccessTimestamped, type AgentContext, AiError, type AiErrorCode, type ApiKeyValidationRule, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, ChatMessage, type ChunkOptions, CompositeExecutor, type ContextBudget, type ContextMessage, type ContextRole, DEFAULT_AI_IDENTITY, DEFAULT_API_KEY_RULE, DEFAULT_EMBED_BATCH_SIZE, DEFAULT_ERROR_CLASSIFICATION_RULE, DEFAULT_GENERATION, DEFAULT_HTTP_STATUS_RULE, DEFAULT_RETRY_BACKOFF_MULTIPLIER, DEFAULT_RETRY_INITIAL_DELAY_MS, DEFAULT_RETRY_JITTER_FACTOR, DEFAULT_RETRY_MAX_ATTEMPTS, DEFAULT_RETRY_MAX_DELAY_MS, DEFAULT_TASK_POLICIES, DebounceManager, type DebounceOptions, DedupeExecutor, type DedupeExecutorOptions, type DiffChangeCount, type DiffLine, type EmbeddingsBatchAdapter, type ErrorClassificationRule, type ExponentialBackoffParams, type FailoverErrorLike, type FetchLike, GENERATION_BOUNDS, type GenerationSettings, GroqError, type GroqErrorMetadata, AIErrorType as GroqErrorType, type HttpStatusClassificationRule, type IRequestExecutor, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, type LeadingEdgeParams, type LoggedError, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, type MarkdownSegment, type MemoryLike, type ModelPricing, type ModelWithProvider, type NormalizedSseChunk, type ParsedSseEvent, type ProjectContext, type ProviderErrorShape, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, RequestDeduplicator, RequestQueue, type ResearchSource, type ResearchStreamEvent, RetryExecutor, RetryManager, RetryOptions, SEARCH_MAX_RESULTS, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, SYSTEM_PROMPT_VERSION, type SearchTopic, type SseDeltaExtractor, type SseResponseOptions, type StreamCallbacks, type StreamEvent, type StreamingParserCallbacks, StreamingResponseParser, StructuredPromptBuilder, type SystemPromptInput, TEXT_EXTRACT_PER_FILE_LIMIT, TEXT_EXTRACT_TOTAL_LIMIT, TRANSIENT_ERROR_CODES, type TaskPlan, type TaskPolicy, type TaskState, ThrottleManager, type ThrottleOptions, TokenUsage, type ToolSchema, type ToolValidationResult, type ToolValidatorFunction, type TrailingDelayParams, type UsageRecordData, type UsageRecordInput, type VectorCandidate, type VectorMatch, type WebSearchInput, type WebSearchResponse, type WebSearchResult, type ZodLikeIssue, type ZodLikeSchema, accumulateReport, aiErrorMessage, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildContext, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageData, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chunkText, clampScore, classifyHttpStatus, computeCostMicros, cosineSimilarity, countChanges, createSseResponse, debounce, debounceManager, defaultSseDeltaExtractor, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorFromStatus, errorFromUnknown, estimateMessageTokens, estimateTokens, extractErrorMessageFromJsonBody, extractErrorMessageFromResponse, extractJsonArray, extractJsonCandidate, extractJsonFromCodeFence, extractJsonObject, extractSseDataPayload, extractText, failoverCandidate, findTopKSimilar, formatCost, formatErrorForLogging, formatSseEvent, generateRandomBase36Suffix, isAuthErrorType, isRetryableErrorType, isSseDataLine, isSseDoneMarker, isTextLike, isTransientError, isValidApiKey, isWithinWindow, magnitude, nextAttemptDelayMs, normalizeGenerationSettings, normalizeSources, normalizeSseChunk, oneOfCatalog, parseSseEvent, planTaskFailure, readSseResponse, repairCommonJsonDefects, replayFirst, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, throttle, throttleManager, validateApiKey, validateToolArgs };
|
package/dist/core/index.js
CHANGED
|
@@ -1444,17 +1444,19 @@ function buildSystemPrompt(input = {}) {
|
|
|
1444
1444
|
const now = input.now ?? /* @__PURE__ */ new Date();
|
|
1445
1445
|
const identity = input.identity ?? DEFAULT_AI_IDENTITY;
|
|
1446
1446
|
const parts = [identity, `Current date: ${now.toISOString().slice(0, 10)}.`];
|
|
1447
|
+
const projectName = input.project?.name;
|
|
1447
1448
|
const projectInstructions = input.project?.instructions?.trim();
|
|
1448
|
-
if (projectInstructions) {
|
|
1449
|
+
if (projectName && projectInstructions) {
|
|
1449
1450
|
parts.push(
|
|
1450
|
-
`The user is working inside the project "${
|
|
1451
|
+
`The user is working inside the project "${projectName}". Follow these project instructions:
|
|
1451
1452
|
${projectInstructions}`
|
|
1452
1453
|
);
|
|
1453
1454
|
}
|
|
1455
|
+
const agentName = input.agent?.name;
|
|
1454
1456
|
const agentInstructions = input.agent?.instructions?.trim();
|
|
1455
|
-
if (agentInstructions) {
|
|
1457
|
+
if (agentName && agentInstructions) {
|
|
1456
1458
|
parts.push(
|
|
1457
|
-
`You are operating as the agent "${
|
|
1459
|
+
`You are operating as the agent "${agentName}". Follow these agent instructions:
|
|
1458
1460
|
${agentInstructions}`
|
|
1459
1461
|
);
|
|
1460
1462
|
}
|