@umituz/web-ai 1.2.0 → 1.4.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 +6 -0
- package/dist/core/index.cjs +110 -13
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +51 -2
- package/dist/core/index.d.ts +51 -2
- package/dist/core/index.js +103 -14
- package/dist/core/index.js.map +1 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +119 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +111 -14
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +13 -0
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +6 -1
- package/dist/providers/index.d.ts +6 -1
- package/dist/providers/index.js +13 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/{remote-chat-client-LrNlew4n.d.cts → remote-chat-client-DnmLTBUA.d.cts} +11 -1
- package/dist/{remote-chat-client-LrNlew4n.d.ts → remote-chat-client-DnmLTBUA.d.ts} +11 -1
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ export { T as TEXT_TIERS, c as TierModelMap, U as USER_FRIENDLY_ERROR_MESSAGES,
|
|
|
5
5
|
import { a as AiErrorCode, g as RetryManager, h as RetryOptions, f as RequestQueue, R as RequestDeduplicator } from '../context-manager-CuZz0vnC.cjs';
|
|
6
6
|
export { A as AiError, b as AssistantToolCall, C as CODE_MESSAGES, c as ContextBudget, d as ContextMessage, e as ContextRole, P as ProviderErrorShape, Q as QueueOptions, S as STATUS_TO_CODE, T as ToolCallAccumulator, W as WireToolCallDelta, i as aiErrorMessage, j as buildContext, k as errorFromStatus, l as errorFromUnknown, m as estimateMessageTokens, n as estimateTokens, r as requestDeduplicator, o as requestQueue, p as retryManager, w as withRetry } from '../context-manager-CuZz0vnC.cjs';
|
|
7
7
|
export { C as CacheManager, a as CacheOptions, b as CacheStats, c as cacheManager } from '../cache-manager-Df9LLYGA.cjs';
|
|
8
|
-
export { P as ParsedSseEvent, R as RemoteChatClient, a as RemoteChatClientOptions, b as RemoteChatStreamBody, c as RemoteChatUrls, d as RemoteStreamHandle, S as StreamCallbacks, e as createRemoteChatClient, p as parseSseEvent, r as readSseResponse } from '../remote-chat-client-
|
|
8
|
+
export { P as ParsedSseEvent, R as RemoteChatClient, a as RemoteChatClientOptions, b as RemoteChatStreamBody, c as RemoteChatUrls, d as RemoteStreamHandle, S as StreamCallbacks, e as createRemoteChatClient, i as iterateSseData, f as iterateSseJson, p as parseSseEvent, r as readSseResponse } from '../remote-chat-client-DnmLTBUA.cjs';
|
|
9
9
|
|
|
10
10
|
type GroqErrorMetadata = AIErrorMetadata;
|
|
11
11
|
|
|
@@ -81,6 +81,13 @@ declare const AI_ERROR_STATUS: {
|
|
|
81
81
|
* have the code, not an AiError instance. */
|
|
82
82
|
declare function aiErrorStatus(code: AiErrorCode): number;
|
|
83
83
|
|
|
84
|
+
interface AiFailure {
|
|
85
|
+
readonly code: AiErrorCode;
|
|
86
|
+
readonly status: number;
|
|
87
|
+
readonly message: string;
|
|
88
|
+
}
|
|
89
|
+
declare function aiFailureOf(error: unknown): AiFailure;
|
|
90
|
+
|
|
84
91
|
interface IRequestExecutor<TArgs extends unknown[], TResult> {
|
|
85
92
|
execute(fn: (...args: TArgs) => Promise<TResult>, ...args: TArgs): Promise<TResult>;
|
|
86
93
|
}
|
|
@@ -188,6 +195,29 @@ interface ModelWithProvider {
|
|
|
188
195
|
}
|
|
189
196
|
declare function failoverCandidate<T extends ModelWithProvider>(primary: T, fallback: T | null): T | null;
|
|
190
197
|
|
|
198
|
+
interface DeriveTitleOptions {
|
|
199
|
+
/** Returned when the content yields no usable text. Defaults to "". */
|
|
200
|
+
readonly fallback?: string;
|
|
201
|
+
/** Maximum title length before truncation. Defaults to 60. */
|
|
202
|
+
readonly maxChars?: number;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Derive a human conversation title from the first user message: takes the
|
|
206
|
+
* first non-empty line, strips Markdown list/heading prefixes, collapses
|
|
207
|
+
* whitespace and truncates with an ellipsis.
|
|
208
|
+
*/
|
|
209
|
+
declare function deriveConversationTitle(content: string, options?: DeriveTitleOptions): string;
|
|
210
|
+
|
|
211
|
+
interface AllowanceWindowOptions {
|
|
212
|
+
readonly limit: number;
|
|
213
|
+
readonly windowMs?: number;
|
|
214
|
+
}
|
|
215
|
+
interface AllowanceWindow {
|
|
216
|
+
allow(key: string, now?: number): boolean;
|
|
217
|
+
}
|
|
218
|
+
declare const DEFAULT_ALLOWANCE_WINDOW_MS = 3600000;
|
|
219
|
+
declare function createAllowanceWindow(options: AllowanceWindowOptions): AllowanceWindow;
|
|
220
|
+
|
|
191
221
|
declare function isSseDataLine(line: string): boolean;
|
|
192
222
|
declare function extractSseDataPayload(line: string): string;
|
|
193
223
|
declare function isSseDoneMarker(payload: string): boolean;
|
|
@@ -334,6 +364,25 @@ declare function planTaskFailure(task: {
|
|
|
334
364
|
attempts: number;
|
|
335
365
|
maxAttempts: number;
|
|
336
366
|
}, errorDetail: string, backoffBaseMs: number, now?: Date): TaskPlan;
|
|
367
|
+
/** A task found in `running` is considered stuck after this long. */
|
|
368
|
+
declare const STUCK_TASK_THRESHOLD_MS: number;
|
|
369
|
+
interface StuckTaskState {
|
|
370
|
+
readonly attempts: number;
|
|
371
|
+
readonly maxAttempts: number;
|
|
372
|
+
readonly updatedAt: Date;
|
|
373
|
+
}
|
|
374
|
+
type StuckTaskPlan = {
|
|
375
|
+
readonly action: 'requeue';
|
|
376
|
+
} | {
|
|
377
|
+
readonly action: 'fail';
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Pure recovery decision for a task found in `running`: null means it is
|
|
381
|
+
* fresh, leave it alone. Stale with attempts left → requeue; stale and
|
|
382
|
+
* exhausted → fail (avoids endless requeue loops). The claiming worker may
|
|
383
|
+
* be gone (ephemeral isolates), so nothing else would ever finish it.
|
|
384
|
+
*/
|
|
385
|
+
declare function planStuckRecovery(task: StuckTaskState, now?: Date, thresholdMs?: number): StuckTaskPlan | null;
|
|
337
386
|
|
|
338
387
|
declare const SSE_BRIDGE_EVENTS: {
|
|
339
388
|
readonly delta: "delta";
|
|
@@ -631,4 +680,4 @@ declare const DEFAULT_RETRY_MAX_DELAY_MS = 10000;
|
|
|
631
680
|
declare const DEFAULT_RETRY_BACKOFF_MULTIPLIER = 2;
|
|
632
681
|
declare const DEFAULT_RETRY_JITTER_FACTOR = 0.1;
|
|
633
682
|
|
|
634
|
-
export { AIError, type AIErrorBody, AIErrorMetadata, AIErrorType, AI_ERROR_STATUS, type AccessCounted, type AccessTimestamped, type AgentContext, AiErrorCode, type ApiKeyValidationRule, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, ChatMessage, type ChunkOptions, CompositeExecutor, 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 ProjectContext, 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, SYSTEM_PROMPT_VERSION, type SearchTopic, type SseDeltaExtractor, type SseResponseOptions, 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 UsageSeriesDayRow, type UsageSeriesMessageRow, type UsageSeriesPoint, type UsageTrendPoint, type UsageWindowTotals, type VectorCandidate, type VectorMatch, type WebSearchInput, type WebSearchResponse, type WebSearchResult, type ZodLikeIssue, type ZodLikeSchema, accumulateReport, aiErrorStatus, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageDailySeries, buildUsageData, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chunkText, clampScore, classifyHttpStatus, computeCostMicros, cosineSimilarity, countChanges, createSseResponse, debounce, debounceManager, defaultSseDeltaExtractor, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorRatePct, 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, planTaskFailure, repairCommonJsonDefects, replayFirst, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, throttle, throttleManager, usageTrendOf, usageWindowTotals, validateApiKey, validateToolArgs };
|
|
683
|
+
export { AIError, type AIErrorBody, AIErrorMetadata, AIErrorType, AI_ERROR_STATUS, type AccessCounted, type AccessTimestamped, type AgentContext, AiErrorCode, type AiFailure, type AllowanceWindow, type AllowanceWindowOptions, type ApiKeyValidationRule, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, ChatMessage, type ChunkOptions, CompositeExecutor, DEFAULT_AI_IDENTITY, DEFAULT_ALLOWANCE_WINDOW_MS, 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 DeriveTitleOptions, 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 ProjectContext, 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, STUCK_TASK_THRESHOLD_MS, SYSTEM_PROMPT_VERSION, type SearchTopic, type SseDeltaExtractor, type SseResponseOptions, type StreamEvent, type StreamingParserCallbacks, StreamingResponseParser, StructuredPromptBuilder, type StuckTaskPlan, type StuckTaskState, 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 UsageSeriesDayRow, type UsageSeriesMessageRow, type UsageSeriesPoint, type UsageTrendPoint, type UsageWindowTotals, type VectorCandidate, type VectorMatch, type WebSearchInput, type WebSearchResponse, type WebSearchResult, type ZodLikeIssue, type ZodLikeSchema, accumulateReport, aiErrorStatus, aiFailureOf, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageDailySeries, buildUsageData, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chunkText, clampScore, classifyHttpStatus, computeCostMicros, cosineSimilarity, countChanges, createAllowanceWindow, createSseResponse, debounce, debounceManager, defaultSseDeltaExtractor, deriveConversationTitle, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorRatePct, 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, planStuckRecovery, planTaskFailure, repairCommonJsonDefects, replayFirst, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, throttle, throttleManager, usageTrendOf, usageWindowTotals, validateApiKey, validateToolArgs };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { T as TEXT_TIERS, c as TierModelMap, U as USER_FRIENDLY_ERROR_MESSAGES,
|
|
|
5
5
|
import { a as AiErrorCode, g as RetryManager, h as RetryOptions, f as RequestQueue, R as RequestDeduplicator } from '../context-manager-CuZz0vnC.js';
|
|
6
6
|
export { A as AiError, b as AssistantToolCall, C as CODE_MESSAGES, c as ContextBudget, d as ContextMessage, e as ContextRole, P as ProviderErrorShape, Q as QueueOptions, S as STATUS_TO_CODE, T as ToolCallAccumulator, W as WireToolCallDelta, i as aiErrorMessage, j as buildContext, k as errorFromStatus, l as errorFromUnknown, m as estimateMessageTokens, n as estimateTokens, r as requestDeduplicator, o as requestQueue, p as retryManager, w as withRetry } from '../context-manager-CuZz0vnC.js';
|
|
7
7
|
export { C as CacheManager, a as CacheOptions, b as CacheStats, c as cacheManager } from '../cache-manager-Df9LLYGA.js';
|
|
8
|
-
export { P as ParsedSseEvent, R as RemoteChatClient, a as RemoteChatClientOptions, b as RemoteChatStreamBody, c as RemoteChatUrls, d as RemoteStreamHandle, S as StreamCallbacks, e as createRemoteChatClient, p as parseSseEvent, r as readSseResponse } from '../remote-chat-client-
|
|
8
|
+
export { P as ParsedSseEvent, R as RemoteChatClient, a as RemoteChatClientOptions, b as RemoteChatStreamBody, c as RemoteChatUrls, d as RemoteStreamHandle, S as StreamCallbacks, e as createRemoteChatClient, i as iterateSseData, f as iterateSseJson, p as parseSseEvent, r as readSseResponse } from '../remote-chat-client-DnmLTBUA.js';
|
|
9
9
|
|
|
10
10
|
type GroqErrorMetadata = AIErrorMetadata;
|
|
11
11
|
|
|
@@ -81,6 +81,13 @@ declare const AI_ERROR_STATUS: {
|
|
|
81
81
|
* have the code, not an AiError instance. */
|
|
82
82
|
declare function aiErrorStatus(code: AiErrorCode): number;
|
|
83
83
|
|
|
84
|
+
interface AiFailure {
|
|
85
|
+
readonly code: AiErrorCode;
|
|
86
|
+
readonly status: number;
|
|
87
|
+
readonly message: string;
|
|
88
|
+
}
|
|
89
|
+
declare function aiFailureOf(error: unknown): AiFailure;
|
|
90
|
+
|
|
84
91
|
interface IRequestExecutor<TArgs extends unknown[], TResult> {
|
|
85
92
|
execute(fn: (...args: TArgs) => Promise<TResult>, ...args: TArgs): Promise<TResult>;
|
|
86
93
|
}
|
|
@@ -188,6 +195,29 @@ interface ModelWithProvider {
|
|
|
188
195
|
}
|
|
189
196
|
declare function failoverCandidate<T extends ModelWithProvider>(primary: T, fallback: T | null): T | null;
|
|
190
197
|
|
|
198
|
+
interface DeriveTitleOptions {
|
|
199
|
+
/** Returned when the content yields no usable text. Defaults to "". */
|
|
200
|
+
readonly fallback?: string;
|
|
201
|
+
/** Maximum title length before truncation. Defaults to 60. */
|
|
202
|
+
readonly maxChars?: number;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Derive a human conversation title from the first user message: takes the
|
|
206
|
+
* first non-empty line, strips Markdown list/heading prefixes, collapses
|
|
207
|
+
* whitespace and truncates with an ellipsis.
|
|
208
|
+
*/
|
|
209
|
+
declare function deriveConversationTitle(content: string, options?: DeriveTitleOptions): string;
|
|
210
|
+
|
|
211
|
+
interface AllowanceWindowOptions {
|
|
212
|
+
readonly limit: number;
|
|
213
|
+
readonly windowMs?: number;
|
|
214
|
+
}
|
|
215
|
+
interface AllowanceWindow {
|
|
216
|
+
allow(key: string, now?: number): boolean;
|
|
217
|
+
}
|
|
218
|
+
declare const DEFAULT_ALLOWANCE_WINDOW_MS = 3600000;
|
|
219
|
+
declare function createAllowanceWindow(options: AllowanceWindowOptions): AllowanceWindow;
|
|
220
|
+
|
|
191
221
|
declare function isSseDataLine(line: string): boolean;
|
|
192
222
|
declare function extractSseDataPayload(line: string): string;
|
|
193
223
|
declare function isSseDoneMarker(payload: string): boolean;
|
|
@@ -334,6 +364,25 @@ declare function planTaskFailure(task: {
|
|
|
334
364
|
attempts: number;
|
|
335
365
|
maxAttempts: number;
|
|
336
366
|
}, errorDetail: string, backoffBaseMs: number, now?: Date): TaskPlan;
|
|
367
|
+
/** A task found in `running` is considered stuck after this long. */
|
|
368
|
+
declare const STUCK_TASK_THRESHOLD_MS: number;
|
|
369
|
+
interface StuckTaskState {
|
|
370
|
+
readonly attempts: number;
|
|
371
|
+
readonly maxAttempts: number;
|
|
372
|
+
readonly updatedAt: Date;
|
|
373
|
+
}
|
|
374
|
+
type StuckTaskPlan = {
|
|
375
|
+
readonly action: 'requeue';
|
|
376
|
+
} | {
|
|
377
|
+
readonly action: 'fail';
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Pure recovery decision for a task found in `running`: null means it is
|
|
381
|
+
* fresh, leave it alone. Stale with attempts left → requeue; stale and
|
|
382
|
+
* exhausted → fail (avoids endless requeue loops). The claiming worker may
|
|
383
|
+
* be gone (ephemeral isolates), so nothing else would ever finish it.
|
|
384
|
+
*/
|
|
385
|
+
declare function planStuckRecovery(task: StuckTaskState, now?: Date, thresholdMs?: number): StuckTaskPlan | null;
|
|
337
386
|
|
|
338
387
|
declare const SSE_BRIDGE_EVENTS: {
|
|
339
388
|
readonly delta: "delta";
|
|
@@ -631,4 +680,4 @@ declare const DEFAULT_RETRY_MAX_DELAY_MS = 10000;
|
|
|
631
680
|
declare const DEFAULT_RETRY_BACKOFF_MULTIPLIER = 2;
|
|
632
681
|
declare const DEFAULT_RETRY_JITTER_FACTOR = 0.1;
|
|
633
682
|
|
|
634
|
-
export { AIError, type AIErrorBody, AIErrorMetadata, AIErrorType, AI_ERROR_STATUS, type AccessCounted, type AccessTimestamped, type AgentContext, AiErrorCode, type ApiKeyValidationRule, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, ChatMessage, type ChunkOptions, CompositeExecutor, 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 ProjectContext, 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, SYSTEM_PROMPT_VERSION, type SearchTopic, type SseDeltaExtractor, type SseResponseOptions, 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 UsageSeriesDayRow, type UsageSeriesMessageRow, type UsageSeriesPoint, type UsageTrendPoint, type UsageWindowTotals, type VectorCandidate, type VectorMatch, type WebSearchInput, type WebSearchResponse, type WebSearchResult, type ZodLikeIssue, type ZodLikeSchema, accumulateReport, aiErrorStatus, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageDailySeries, buildUsageData, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chunkText, clampScore, classifyHttpStatus, computeCostMicros, cosineSimilarity, countChanges, createSseResponse, debounce, debounceManager, defaultSseDeltaExtractor, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorRatePct, 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, planTaskFailure, repairCommonJsonDefects, replayFirst, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, throttle, throttleManager, usageTrendOf, usageWindowTotals, validateApiKey, validateToolArgs };
|
|
683
|
+
export { AIError, type AIErrorBody, AIErrorMetadata, AIErrorType, AI_ERROR_STATUS, type AccessCounted, type AccessTimestamped, type AgentContext, AiErrorCode, type AiFailure, type AllowanceWindow, type AllowanceWindowOptions, type ApiKeyValidationRule, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, ChatMessage, type ChunkOptions, CompositeExecutor, DEFAULT_AI_IDENTITY, DEFAULT_ALLOWANCE_WINDOW_MS, 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 DeriveTitleOptions, 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 ProjectContext, 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, STUCK_TASK_THRESHOLD_MS, SYSTEM_PROMPT_VERSION, type SearchTopic, type SseDeltaExtractor, type SseResponseOptions, type StreamEvent, type StreamingParserCallbacks, StreamingResponseParser, StructuredPromptBuilder, type StuckTaskPlan, type StuckTaskState, 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 UsageSeriesDayRow, type UsageSeriesMessageRow, type UsageSeriesPoint, type UsageTrendPoint, type UsageWindowTotals, type VectorCandidate, type VectorMatch, type WebSearchInput, type WebSearchResponse, type WebSearchResult, type ZodLikeIssue, type ZodLikeSchema, accumulateReport, aiErrorStatus, aiFailureOf, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageDailySeries, buildUsageData, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chunkText, clampScore, classifyHttpStatus, computeCostMicros, cosineSimilarity, countChanges, createAllowanceWindow, createSseResponse, debounce, debounceManager, defaultSseDeltaExtractor, deriveConversationTitle, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorRatePct, 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, planStuckRecovery, planTaskFailure, repairCommonJsonDefects, replayFirst, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, throttle, throttleManager, usageTrendOf, usageWindowTotals, validateApiKey, validateToolArgs };
|
package/dist/core/index.js
CHANGED
|
@@ -320,6 +320,31 @@ function aiErrorStatus(code) {
|
|
|
320
320
|
return AI_ERROR_STATUS[code];
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
// src/core/errors/ai-failure.ts
|
|
324
|
+
var TYPE_TO_CODE = {
|
|
325
|
+
["INVALID_API_KEY" /* INVALID_API_KEY */]: "invalid_key",
|
|
326
|
+
["MISSING_CONFIG" /* MISSING_CONFIG */]: "missing_key",
|
|
327
|
+
["NETWORK_ERROR" /* NETWORK_ERROR */]: "network",
|
|
328
|
+
["ABORT_ERROR" /* ABORT_ERROR */]: "timeout",
|
|
329
|
+
["RATE_LIMIT_ERROR" /* RATE_LIMIT_ERROR */]: "rate_limited",
|
|
330
|
+
["SERVER_ERROR" /* SERVER_ERROR */]: "upstream_error",
|
|
331
|
+
["CLIENT_ERROR" /* CLIENT_ERROR */]: "invalid_request",
|
|
332
|
+
["UNKNOWN_ERROR" /* UNKNOWN_ERROR */]: "upstream_error"
|
|
333
|
+
};
|
|
334
|
+
function aiFailureOf(error) {
|
|
335
|
+
if (error instanceof AiError) {
|
|
336
|
+
return { code: error.code, status: AI_ERROR_STATUS[error.code], message: error.userMessage };
|
|
337
|
+
}
|
|
338
|
+
if (error instanceof AIError) {
|
|
339
|
+
const code = TYPE_TO_CODE[error.type];
|
|
340
|
+
return { code, status: AI_ERROR_STATUS[code], message: CODE_MESSAGES[code] };
|
|
341
|
+
}
|
|
342
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
343
|
+
return { code: "timeout", status: AI_ERROR_STATUS.timeout, message: CODE_MESSAGES.timeout };
|
|
344
|
+
}
|
|
345
|
+
return { code: "upstream_error", status: AI_ERROR_STATUS.upstream_error, message: CODE_MESSAGES.upstream_error };
|
|
346
|
+
}
|
|
347
|
+
|
|
323
348
|
// src/core/executor/retry-executor.strategy.ts
|
|
324
349
|
var RetryExecutor = class {
|
|
325
350
|
constructor(retryManager2, options) {
|
|
@@ -923,6 +948,34 @@ function failoverCandidate(primary, fallback) {
|
|
|
923
948
|
return fallback;
|
|
924
949
|
}
|
|
925
950
|
|
|
951
|
+
// src/core/utils/title.ts
|
|
952
|
+
function deriveConversationTitle(content, options = {}) {
|
|
953
|
+
const fallback = options.fallback ?? "";
|
|
954
|
+
const maxChars = options.maxChars ?? 60;
|
|
955
|
+
const firstLine = content.split("\n").map((line) => line.trim()).find((line) => line.length > 0);
|
|
956
|
+
const cleaned = (firstLine ?? fallback).replace(/^#{1,6}\s+/, "").replace(/^[>*-]\s+/, "").replace(/\s+/g, " ");
|
|
957
|
+
if (cleaned.length === 0) return fallback;
|
|
958
|
+
return cleaned.length > maxChars ? `${cleaned.slice(0, maxChars).trimEnd()}\u2026` : cleaned;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
// src/core/utils/allowance-window.ts
|
|
962
|
+
var DEFAULT_ALLOWANCE_WINDOW_MS = 36e5;
|
|
963
|
+
function createAllowanceWindow(options) {
|
|
964
|
+
const windowMs = options.windowMs ?? DEFAULT_ALLOWANCE_WINDOW_MS;
|
|
965
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
966
|
+
return {
|
|
967
|
+
allow(key, now = Date.now()) {
|
|
968
|
+
const bucket = buckets.get(key);
|
|
969
|
+
if (bucket === void 0 || now - bucket.windowStart >= windowMs) {
|
|
970
|
+
buckets.set(key, { windowStart: now, count: 1 });
|
|
971
|
+
return true;
|
|
972
|
+
}
|
|
973
|
+
bucket.count += 1;
|
|
974
|
+
return bucket.count <= options.limit;
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
|
|
926
979
|
// src/core/constants/protocol.constants.ts
|
|
927
980
|
var SSE_PREFIX = "data: ";
|
|
928
981
|
var SSE_DONE_MARKER = "[DONE]";
|
|
@@ -1302,6 +1355,11 @@ function planTaskFailure(task, errorDetail, backoffBaseMs, now = /* @__PURE__ */
|
|
|
1302
1355
|
}
|
|
1303
1356
|
};
|
|
1304
1357
|
}
|
|
1358
|
+
var STUCK_TASK_THRESHOLD_MS = 15 * 60 * 1e3;
|
|
1359
|
+
function planStuckRecovery(task, now = /* @__PURE__ */ new Date(), thresholdMs = STUCK_TASK_THRESHOLD_MS) {
|
|
1360
|
+
if (now.getTime() - task.updatedAt.getTime() < thresholdMs) return null;
|
|
1361
|
+
return task.attempts >= task.maxAttempts ? { action: "fail" } : { action: "requeue" };
|
|
1362
|
+
}
|
|
1305
1363
|
|
|
1306
1364
|
// src/core/sse/sse-response.service.ts
|
|
1307
1365
|
var SSE_BRIDGE_EVENTS = {
|
|
@@ -1901,21 +1959,52 @@ async function readSseResponse(response, callbacks) {
|
|
|
1901
1959
|
callbacks.onError?.("request_failed", "The server returned an empty stream.");
|
|
1902
1960
|
return;
|
|
1903
1961
|
}
|
|
1904
|
-
const
|
|
1962
|
+
for await (const event of iterateSseJson(response)) {
|
|
1963
|
+
if (event) dispatchSseEvent(event, callbacks);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
function dataPayloadOf(frame) {
|
|
1967
|
+
let data = null;
|
|
1968
|
+
for (const line of frame.split("\n")) {
|
|
1969
|
+
if (line.startsWith("data:")) {
|
|
1970
|
+
const payload = line.slice(5).trim();
|
|
1971
|
+
data = data === null ? payload : `${data}
|
|
1972
|
+
${payload}`;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
return data !== null && data.length > 0 ? data : null;
|
|
1976
|
+
}
|
|
1977
|
+
async function* iterateSseData(source) {
|
|
1978
|
+
const body = source instanceof Response ? source.body : source;
|
|
1979
|
+
if (!body) {
|
|
1980
|
+
throw new Error("iterateSseData: the response has no body to read");
|
|
1981
|
+
}
|
|
1982
|
+
const reader = body.getReader();
|
|
1905
1983
|
const decoder = new TextDecoder();
|
|
1906
1984
|
let buffer = "";
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1985
|
+
try {
|
|
1986
|
+
while (true) {
|
|
1987
|
+
const { done, value } = await reader.read();
|
|
1988
|
+
if (done) break;
|
|
1989
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1990
|
+
let boundary = buffer.indexOf("\n\n");
|
|
1991
|
+
while (boundary !== -1) {
|
|
1992
|
+
const frame = buffer.slice(0, boundary);
|
|
1993
|
+
buffer = buffer.slice(boundary + 2);
|
|
1994
|
+
boundary = buffer.indexOf("\n\n");
|
|
1995
|
+
const data = dataPayloadOf(frame);
|
|
1996
|
+
if (data) yield data;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
} finally {
|
|
2000
|
+
await reader.cancel().catch(() => void 0);
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
async function* iterateSseJson(source) {
|
|
2004
|
+
for await (const data of iterateSseData(source)) {
|
|
2005
|
+
try {
|
|
2006
|
+
yield JSON.parse(data);
|
|
2007
|
+
} catch {
|
|
1919
2008
|
}
|
|
1920
2009
|
}
|
|
1921
2010
|
}
|
|
@@ -2049,6 +2138,6 @@ function createRemoteChatClient(options) {
|
|
|
2049
2138
|
};
|
|
2050
2139
|
}
|
|
2051
2140
|
|
|
2052
|
-
export { AIError, AIErrorType, AI_ERROR_STATUS, AiError, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, CacheManager, CompositeExecutor, 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, DedupeExecutor, GENERATION_BOUNDS, GroqError, AIErrorType as GroqErrorType, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, RequestDeduplicator, RequestQueue, RetryExecutor, RetryManager, SEARCH_MAX_RESULTS, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, SYSTEM_PROMPT_VERSION, StreamingResponseParser, StructuredPromptBuilder, TEXT_EXTRACT_PER_FILE_LIMIT, TEXT_EXTRACT_TOTAL_LIMIT, TEXT_TIERS, TRANSIENT_ERROR_CODES, ThrottleManager, ToolCallAccumulator, USER_FRIENDLY_ERROR_MESSAGES, accumulateReport, aiErrorMessage, aiErrorStatus, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildContext, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageDailySeries, buildUsageData, cacheManager, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chunkText, clampScore, classifyHttpStatus, computeCostMicros, cosineSimilarity, countChanges, createRemoteChatClient, createSseResponse, debounce, debounceManager, defaultSseDeltaExtractor, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorFromStatus, errorFromUnknown, errorRatePct, estimateMessageTokens, estimateTokens, extractErrorMessageFromJsonBody, extractErrorMessageFromResponse, extractJsonArray, extractJsonCandidate, extractJsonFromCodeFence, extractJsonObject, extractSseDataPayload, extractText, failoverCandidate, findTopKSimilar, formatCost, formatErrorForLogging, formatSseEvent, generateRandomBase36Suffix, isAuthErrorType, isRetryableErrorType, isSseDataLine, isSseDoneMarker, isTextLike, isTextTier, isTransientError, isValidApiKey, isWithinWindow, magnitude, mergeTierOverrides, nextAttemptDelayMs, normalizeGenerationSettings, normalizeSources, normalizeSseChunk, oneOfCatalog, parseSseEvent, planTaskFailure, readSseResponse, repairCommonJsonDefects, replayFirst, requestDeduplicator, requestQueue, resolveModel, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, retryManager, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, throttle, throttleManager, usageTrendOf, usageWindowTotals, validateApiKey, validateToolArgs, withRetry };
|
|
2141
|
+
export { AIError, AIErrorType, AI_ERROR_STATUS, AiError, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, CacheManager, CompositeExecutor, DEFAULT_AI_IDENTITY, DEFAULT_ALLOWANCE_WINDOW_MS, 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, DedupeExecutor, GENERATION_BOUNDS, GroqError, AIErrorType as GroqErrorType, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, RequestDeduplicator, RequestQueue, RetryExecutor, RetryManager, SEARCH_MAX_RESULTS, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, STUCK_TASK_THRESHOLD_MS, SYSTEM_PROMPT_VERSION, StreamingResponseParser, StructuredPromptBuilder, TEXT_EXTRACT_PER_FILE_LIMIT, TEXT_EXTRACT_TOTAL_LIMIT, TEXT_TIERS, TRANSIENT_ERROR_CODES, ThrottleManager, ToolCallAccumulator, USER_FRIENDLY_ERROR_MESSAGES, accumulateReport, aiErrorMessage, aiErrorStatus, aiFailureOf, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildContext, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageDailySeries, buildUsageData, cacheManager, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chunkText, clampScore, classifyHttpStatus, computeCostMicros, cosineSimilarity, countChanges, createAllowanceWindow, createRemoteChatClient, createSseResponse, debounce, debounceManager, defaultSseDeltaExtractor, deriveConversationTitle, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorFromStatus, errorFromUnknown, errorRatePct, estimateMessageTokens, estimateTokens, extractErrorMessageFromJsonBody, extractErrorMessageFromResponse, extractJsonArray, extractJsonCandidate, extractJsonFromCodeFence, extractJsonObject, extractSseDataPayload, extractText, failoverCandidate, findTopKSimilar, formatCost, formatErrorForLogging, formatSseEvent, generateRandomBase36Suffix, isAuthErrorType, isRetryableErrorType, isSseDataLine, isSseDoneMarker, isTextLike, isTextTier, isTransientError, isValidApiKey, isWithinWindow, iterateSseData, iterateSseJson, magnitude, mergeTierOverrides, nextAttemptDelayMs, normalizeGenerationSettings, normalizeSources, normalizeSseChunk, oneOfCatalog, parseSseEvent, planStuckRecovery, planTaskFailure, readSseResponse, repairCommonJsonDefects, replayFirst, requestDeduplicator, requestQueue, resolveModel, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, retryManager, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, throttle, throttleManager, usageTrendOf, usageWindowTotals, validateApiKey, validateToolArgs, withRetry };
|
|
2053
2142
|
//# sourceMappingURL=index.js.map
|
|
2054
2143
|
//# sourceMappingURL=index.js.map
|