@umituz/web-ai 1.0.8 → 1.0.9
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/core/index.cjs +84 -6
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +8 -2
- package/dist/core/index.d.ts +8 -2
- package/dist/core/index.js +80 -7
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +86 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +82 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { C as ChatMessage, F as FinishReason, G as GenerationResult, P as ProviderHealth, S as StructuredGeneration, a as StructuredTextRequest, T as TextRequest, b as TextTier, c as TokenUsage } from './index-DDzvTDg0.cjs';
|
|
2
2
|
export { A as AIError, a as AIErrorMetadata, b as AIErrorType, b as GroqErrorType, T as TEXT_TIERS, c as TierModelMap, U as USER_FRIENDLY_ERROR_MESSAGES, i as isTextTier, m as mergeTierOverrides, r as resolveModel } from './index-itgxPeLz.cjs';
|
|
3
|
-
export { AIErrorBody, AccessCounted, AccessTimestamped, AgentContext, AiError, AiErrorCode, ApiKeyValidationRule, AssistantToolCall, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, ChunkOptions, CompositeExecutor, ContextBudget, ContextMessage, 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, DebounceOptions, DedupeExecutor, DedupeExecutorOptions, DiffChangeCount, DiffLine, EmbeddingsBatchAdapter, ErrorClassificationRule, ExponentialBackoffParams, FailoverErrorLike, FetchLike, GENERATION_BOUNDS, GenerationSettings, GroqError, GroqErrorMetadata, HttpStatusClassificationRule, IRequestExecutor, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, LeadingEdgeParams, LoggedError, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, MarkdownSegment, MemoryLike, ModelPricing, ModelWithProvider, NormalizedSseChunk, ParsedSseEvent, ProjectContext, ProviderErrorShape, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, ResearchSource, ResearchStreamEvent, RetryExecutor, SEARCH_MAX_RESULTS, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, SYSTEM_PROMPT_VERSION, SearchTopic, SseDeltaExtractor, SseResponseOptions, StreamCallbacks, StreamEvent, StreamingParserCallbacks, StreamingResponseParser, StructuredPromptBuilder, SystemPromptInput, TRANSIENT_ERROR_CODES, TaskPlan, TaskPolicy, TaskState, ThrottleManager, ThrottleOptions, ToolCallAccumulator, ToolSchema, ToolValidationResult, ToolValidatorFunction, TrailingDelayParams, UsageRecordData, UsageRecordInput, VectorCandidate, VectorMatch, WebSearchInput, WebSearchResponse, WebSearchResult, WireToolCallDelta, ZodLikeIssue, ZodLikeSchema, accumulateReport, aiErrorMessage, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildContext, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageData, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, 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, failoverCandidate, findTopKSimilar, formatCost, formatErrorForLogging, formatSseEvent, generateRandomBase36Suffix, isAuthErrorType, isRetryableErrorType, isSseDataLine, isSseDoneMarker, 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 } from './core/index.cjs';
|
|
3
|
+
export { AIErrorBody, AccessCounted, AccessTimestamped, AgentContext, AiError, AiErrorCode, ApiKeyValidationRule, AssistantToolCall, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, ChunkOptions, CompositeExecutor, ContextBudget, ContextMessage, 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, DebounceOptions, DedupeExecutor, DedupeExecutorOptions, DiffChangeCount, DiffLine, EmbeddingsBatchAdapter, ErrorClassificationRule, ExponentialBackoffParams, FailoverErrorLike, FetchLike, GENERATION_BOUNDS, GenerationSettings, GroqError, GroqErrorMetadata, HttpStatusClassificationRule, IRequestExecutor, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, LeadingEdgeParams, LoggedError, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, MarkdownSegment, MemoryLike, ModelPricing, ModelWithProvider, NormalizedSseChunk, ParsedSseEvent, ProjectContext, ProviderErrorShape, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, ResearchSource, ResearchStreamEvent, RetryExecutor, SEARCH_MAX_RESULTS, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, SYSTEM_PROMPT_VERSION, SearchTopic, SseDeltaExtractor, SseResponseOptions, StreamCallbacks, StreamEvent, StreamingParserCallbacks, StreamingResponseParser, StructuredPromptBuilder, SystemPromptInput, TEXT_EXTRACT_PER_FILE_LIMIT, TEXT_EXTRACT_TOTAL_LIMIT, TRANSIENT_ERROR_CODES, TaskPlan, TaskPolicy, TaskState, ThrottleManager, ThrottleOptions, ToolCallAccumulator, ToolSchema, ToolValidationResult, ToolValidatorFunction, TrailingDelayParams, UsageRecordData, UsageRecordInput, VectorCandidate, VectorMatch, WebSearchInput, WebSearchResponse, WebSearchResult, WireToolCallDelta, ZodLikeIssue, 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 } from './core/index.cjs';
|
|
4
4
|
export { C as CacheManager, a as CacheOptions, b as CacheStats, c as cacheManager } from './cache-manager-Df9LLYGA.cjs';
|
|
5
5
|
export { Q as QueueOptions, R as RequestDeduplicator, a as RequestQueue, b as RetryManager, c as RetryOptions, r as requestDeduplicator, d as requestQueue, e as retryManager, w as withRetry } from './request-deduplicator.util-NDo0_n1y.cjs';
|
|
6
6
|
export { A as AnyProvider, C as CostEstimateRequest, I as IAIProvider, a as IMediaProvider, b as IProviderBase, c as ITextGenerator, d as ITextProvider, P as ProviderCapability, e as ProviderFactory, f as ProviderFactoryConfig, T as TextGenerationOptions, g as createProviderFactory, i as isMediaProvider, h as isTextProvider } from './provider.factory-DG2CYFgh.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { C as ChatMessage, F as FinishReason, G as GenerationResult, P as ProviderHealth, S as StructuredGeneration, a as StructuredTextRequest, T as TextRequest, b as TextTier, c as TokenUsage } from './index-DDzvTDg0.js';
|
|
2
2
|
export { A as AIError, a as AIErrorMetadata, b as AIErrorType, b as GroqErrorType, T as TEXT_TIERS, c as TierModelMap, U as USER_FRIENDLY_ERROR_MESSAGES, i as isTextTier, m as mergeTierOverrides, r as resolveModel } from './index-Ca5o4gBK.js';
|
|
3
|
-
export { AIErrorBody, AccessCounted, AccessTimestamped, AgentContext, AiError, AiErrorCode, ApiKeyValidationRule, AssistantToolCall, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, ChunkOptions, CompositeExecutor, ContextBudget, ContextMessage, 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, DebounceOptions, DedupeExecutor, DedupeExecutorOptions, DiffChangeCount, DiffLine, EmbeddingsBatchAdapter, ErrorClassificationRule, ExponentialBackoffParams, FailoverErrorLike, FetchLike, GENERATION_BOUNDS, GenerationSettings, GroqError, GroqErrorMetadata, HttpStatusClassificationRule, IRequestExecutor, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, LeadingEdgeParams, LoggedError, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, MarkdownSegment, MemoryLike, ModelPricing, ModelWithProvider, NormalizedSseChunk, ParsedSseEvent, ProjectContext, ProviderErrorShape, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, ResearchSource, ResearchStreamEvent, RetryExecutor, SEARCH_MAX_RESULTS, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, SYSTEM_PROMPT_VERSION, SearchTopic, SseDeltaExtractor, SseResponseOptions, StreamCallbacks, StreamEvent, StreamingParserCallbacks, StreamingResponseParser, StructuredPromptBuilder, SystemPromptInput, TRANSIENT_ERROR_CODES, TaskPlan, TaskPolicy, TaskState, ThrottleManager, ThrottleOptions, ToolCallAccumulator, ToolSchema, ToolValidationResult, ToolValidatorFunction, TrailingDelayParams, UsageRecordData, UsageRecordInput, VectorCandidate, VectorMatch, WebSearchInput, WebSearchResponse, WebSearchResult, WireToolCallDelta, ZodLikeIssue, ZodLikeSchema, accumulateReport, aiErrorMessage, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, buildCacheKey, buildContext, buildHttpStatusFallback, buildResearchMessages, buildSystemPrompt, buildUsageData, calculateCacheHitRate, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, 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, failoverCandidate, findTopKSimilar, formatCost, formatErrorForLogging, formatSseEvent, generateRandomBase36Suffix, isAuthErrorType, isRetryableErrorType, isSseDataLine, isSseDoneMarker, 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 } from './core/index.js';
|
|
3
|
+
export { AIErrorBody, AccessCounted, AccessTimestamped, AgentContext, AiError, AiErrorCode, ApiKeyValidationRule, AssistantToolCall, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, ChunkOptions, CompositeExecutor, ContextBudget, ContextMessage, 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, DebounceOptions, DedupeExecutor, DedupeExecutorOptions, DiffChangeCount, DiffLine, EmbeddingsBatchAdapter, ErrorClassificationRule, ExponentialBackoffParams, FailoverErrorLike, FetchLike, GENERATION_BOUNDS, GenerationSettings, GroqError, GroqErrorMetadata, HttpStatusClassificationRule, IRequestExecutor, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, LeadingEdgeParams, LoggedError, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, MarkdownSegment, MemoryLike, ModelPricing, ModelWithProvider, NormalizedSseChunk, ParsedSseEvent, ProjectContext, ProviderErrorShape, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, ResearchSource, ResearchStreamEvent, RetryExecutor, SEARCH_MAX_RESULTS, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, SYSTEM_PROMPT_VERSION, SearchTopic, SseDeltaExtractor, SseResponseOptions, StreamCallbacks, StreamEvent, StreamingParserCallbacks, StreamingResponseParser, StructuredPromptBuilder, SystemPromptInput, TEXT_EXTRACT_PER_FILE_LIMIT, TEXT_EXTRACT_TOTAL_LIMIT, TRANSIENT_ERROR_CODES, TaskPlan, TaskPolicy, TaskState, ThrottleManager, ThrottleOptions, ToolCallAccumulator, ToolSchema, ToolValidationResult, ToolValidatorFunction, TrailingDelayParams, UsageRecordData, UsageRecordInput, VectorCandidate, VectorMatch, WebSearchInput, WebSearchResponse, WebSearchResult, WireToolCallDelta, ZodLikeIssue, 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 } from './core/index.js';
|
|
4
4
|
export { C as CacheManager, a as CacheOptions, b as CacheStats, c as cacheManager } from './cache-manager-Df9LLYGA.js';
|
|
5
5
|
export { Q as QueueOptions, R as RequestDeduplicator, a as RequestQueue, b as RetryManager, c as RetryOptions, r as requestDeduplicator, d as requestQueue, e as retryManager, w as withRetry } from './request-deduplicator.util-NDo0_n1y.js';
|
|
6
6
|
export { A as AnyProvider, C as CostEstimateRequest, I as IAIProvider, a as IMediaProvider, b as IProviderBase, c as ITextGenerator, d as ITextProvider, P as ProviderCapability, e as ProviderFactory, f as ProviderFactoryConfig, T as TextGenerationOptions, g as createProviderFactory, i as isMediaProvider, h as isTextProvider } from './provider.factory-CJuI08Xr.js';
|
package/dist/index.js
CHANGED
|
@@ -1139,6 +1139,83 @@ ${paragraph}`;
|
|
|
1139
1139
|
return chunks.map((chunk) => chunk.length > maxChars ? chunk.slice(0, maxChars) : chunk).filter((chunk) => chunk.length > 0);
|
|
1140
1140
|
}
|
|
1141
1141
|
|
|
1142
|
+
// src/core/parsers/text-extract.ts
|
|
1143
|
+
var TEXT_MIME_PREFIX = "text/";
|
|
1144
|
+
var TEXT_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
1145
|
+
"application/json",
|
|
1146
|
+
"application/xml",
|
|
1147
|
+
"application/yaml",
|
|
1148
|
+
"application/x-yaml",
|
|
1149
|
+
"application/javascript",
|
|
1150
|
+
"application/typescript",
|
|
1151
|
+
"application/x-sh",
|
|
1152
|
+
"application/sql",
|
|
1153
|
+
"text/csv"
|
|
1154
|
+
]);
|
|
1155
|
+
var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
1156
|
+
"txt",
|
|
1157
|
+
"md",
|
|
1158
|
+
"markdown",
|
|
1159
|
+
"csv",
|
|
1160
|
+
"tsv",
|
|
1161
|
+
"json",
|
|
1162
|
+
"xml",
|
|
1163
|
+
"yaml",
|
|
1164
|
+
"yml",
|
|
1165
|
+
"toml",
|
|
1166
|
+
"ini",
|
|
1167
|
+
"js",
|
|
1168
|
+
"mjs",
|
|
1169
|
+
"cjs",
|
|
1170
|
+
"ts",
|
|
1171
|
+
"tsx",
|
|
1172
|
+
"jsx",
|
|
1173
|
+
"py",
|
|
1174
|
+
"rb",
|
|
1175
|
+
"go",
|
|
1176
|
+
"rs",
|
|
1177
|
+
"java",
|
|
1178
|
+
"kt",
|
|
1179
|
+
"swift",
|
|
1180
|
+
"c",
|
|
1181
|
+
"h",
|
|
1182
|
+
"cpp",
|
|
1183
|
+
"hpp",
|
|
1184
|
+
"cs",
|
|
1185
|
+
"php",
|
|
1186
|
+
"sh",
|
|
1187
|
+
"bash",
|
|
1188
|
+
"zsh",
|
|
1189
|
+
"sql",
|
|
1190
|
+
"html",
|
|
1191
|
+
"css",
|
|
1192
|
+
"scss",
|
|
1193
|
+
"env"
|
|
1194
|
+
]);
|
|
1195
|
+
var TEXT_EXTRACT_PER_FILE_LIMIT = 24e3;
|
|
1196
|
+
var TEXT_EXTRACT_TOTAL_LIMIT = 48e3;
|
|
1197
|
+
function isTextLike(mimeType, name) {
|
|
1198
|
+
if (mimeType.startsWith(TEXT_MIME_PREFIX) || TEXT_MIME_TYPES.has(mimeType)) return true;
|
|
1199
|
+
const extension = name.split(".").pop()?.toLowerCase() ?? "";
|
|
1200
|
+
return TEXT_EXTENSIONS.has(extension);
|
|
1201
|
+
}
|
|
1202
|
+
function extractText(bytes) {
|
|
1203
|
+
let out = "";
|
|
1204
|
+
const decoder = new TextDecoder("utf-8", { fatal: false });
|
|
1205
|
+
const chunkSize = 65536;
|
|
1206
|
+
for (let offset = 0; offset < bytes.length; offset += chunkSize) {
|
|
1207
|
+
out += decoder.decode(bytes.subarray(offset, Math.min(offset + chunkSize, bytes.length)), {
|
|
1208
|
+
stream: offset + chunkSize < bytes.length
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
return out.split("\0").join("");
|
|
1212
|
+
}
|
|
1213
|
+
function capText(text, limit) {
|
|
1214
|
+
if (text.length <= limit) return text;
|
|
1215
|
+
return `${text.slice(0, limit)}
|
|
1216
|
+
[truncated]`;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1142
1219
|
// src/core/calculations/random-base36-suffix.ts
|
|
1143
1220
|
var BASE_36_RADIX = 36;
|
|
1144
1221
|
var DECIMAL_OFFSET = 2;
|
|
@@ -1586,11 +1663,7 @@ function resolveTimestamp(value) {
|
|
|
1586
1663
|
const parsed = Date.parse(value);
|
|
1587
1664
|
return Number.isNaN(parsed) ? 0 : parsed;
|
|
1588
1665
|
}
|
|
1589
|
-
function
|
|
1590
|
-
if (str.length <= maxLength) return str;
|
|
1591
|
-
return str.slice(0, Math.max(maxLength, 0));
|
|
1592
|
-
}
|
|
1593
|
-
function selectMemories(rows, maxItems = MEMORY_MAX_ITEMS, totalLimit = MEMORY_TOTAL_LIMIT) {
|
|
1666
|
+
function selectMemories(rows, maxItems = MEMORY_MAX_ITEMS, totalLimit = MEMORY_TOTAL_LIMIT, capper = capText) {
|
|
1594
1667
|
const ordered = [...rows].sort((a, b) => {
|
|
1595
1668
|
if (a.pinned !== b.pinned) return a.pinned ? -1 : 1;
|
|
1596
1669
|
return resolveTimestamp(b.updatedAt) - resolveTimestamp(a.updatedAt);
|
|
@@ -1601,7 +1674,7 @@ function selectMemories(rows, maxItems = MEMORY_MAX_ITEMS, totalLimit = MEMORY_T
|
|
|
1601
1674
|
if (out.length >= maxItems || used >= totalLimit) break;
|
|
1602
1675
|
const content = row.content.trim();
|
|
1603
1676
|
if (content.length === 0) continue;
|
|
1604
|
-
const capped =
|
|
1677
|
+
const capped = capper(content, totalLimit - used);
|
|
1605
1678
|
out.push(capped);
|
|
1606
1679
|
used += capped.length;
|
|
1607
1680
|
}
|
|
@@ -2600,7 +2673,7 @@ var AnthropicProvider = class {
|
|
|
2600
2673
|
}
|
|
2601
2674
|
}
|
|
2602
2675
|
toGenerationResult(response, fallbackModel) {
|
|
2603
|
-
const text =
|
|
2676
|
+
const text = extractText2(response.content);
|
|
2604
2677
|
const finishReason = mapAnthropicStopReason(response.stop_reason);
|
|
2605
2678
|
if (text.length === 0) {
|
|
2606
2679
|
if (finishReason === "refusal") {
|
|
@@ -2628,7 +2701,7 @@ var AnthropicProvider = class {
|
|
|
2628
2701
|
};
|
|
2629
2702
|
}
|
|
2630
2703
|
};
|
|
2631
|
-
function
|
|
2704
|
+
function extractText2(blocks) {
|
|
2632
2705
|
return blocks.filter((block) => block.type === "text").map((block) => block.text).join("");
|
|
2633
2706
|
}
|
|
2634
2707
|
function refusalTextFor(finishReason) {
|
|
@@ -7029,6 +7102,6 @@ function buildVideoRequest(data) {
|
|
|
7029
7102
|
}
|
|
7030
7103
|
}
|
|
7031
7104
|
|
|
7032
|
-
export { ABTestService, AIContentService, AIError, AIErrorType, ANTHROPIC_API_VERSION, ANTHROPIC_DEFAULT_MAX_TOKENS, ANTHROPIC_MODELS, ANTHROPIC_TIERS, API_ENDPOINTS, ASPECT_RATIO_OPTIONS, ASPECT_RATIO_VALUES, AiError, AnalysisService, AnthropicHttpTransport, AnthropicProvider, AnthropicRequestBuilder, AuthenticationError, BaseProvider as BaseAIProvider, BaseProvider, BlogService, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, CONTENT_WIZARD_STEPS, CacheManager, CancellationError, ChatIdGenerator, ChatService, CompositeExecutor, ContentCalendarService, DEFAULT_AI_IDENTITY, DEFAULT_API_KEY_RULE, DEFAULT_BASE_URL, DEFAULT_EMBED_BATCH_SIZE, DEFAULT_ERROR_CLASSIFICATION_RULE, DEFAULT_GENERATION, DEFAULT_GENERATION_CONFIG, DEFAULT_HTTP_STATUS_RULE, DEFAULT_MODELS, DEFAULT_PROMPT_STRATEGY, 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, FalProvider, GEMINI_TIERS, GENERATION_BOUNDS, CREDIT_COSTS as GENERATION_COSTS, GROQ_MODELS, GROQ_TIERS, GeminiProvider, GenerationExecutor, GenerationFailedError, GroqChatRequestBuilder, GroqConfigStore, GroqError, AIErrorType as GroqErrorType, GroqHttpClient, GroqHttpTransport, GroqProvider, IMAGE_B64_LIMIT, IMAGE_QUALITIES, IMAGE_QUALITY_OPTIONS, IMAGE_QUALITY_VALUES, IMAGE_SIZES, IMAGE_WIZARD_STEPS, ImagePromptService, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, MOTION_OPTIONS, MediaGenerationService, PromptBuilder, ProviderError, ProviderFactory, ProviderQuotaExhaustedError, ProviderUnavailableError, PrunaProvider, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, RequestDeduplicator, RequestPriority, RequestQueue, RetryExecutor, RetryManager, SEARCH_MAX_RESULTS, SPEECH_INPUT_MAX, SPEECH_VOICES, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, STYLE_PRESETS, SYSTEM_PROMPT_VERSION, SeoService, SocialService, StreamingResponseParser, StructuredPromptBuilder, TEXT_TIERS, TIMEOUTS, TRANSIENT_ERROR_CODES, TextGenerationService, ThrottleManager, TimeoutError, ToolCallAccumulator, USER_FRIENDLY_ERROR_MESSAGES, VIDEO_DURATION_OPTIONS, VIDEO_DURATION_OPTIONS_SECONDS, VIDEO_QUALITY_OPTIONS, VIDEO_QUALITY_VALUES, VIDEO_WIZARD_STEPS, ValidationError2 as ValidationError, VideoScriptService, accumulateReport, aiErrorMessage, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, batchRequest, buildCacheKey, buildContentRequest, buildContext, buildHttpStatusFallback, buildImageRequest, buildResearchMessages, buildSystemPrompt, buildUsageData, buildVideoRequest, cacheManager, calculateCacheHitRate, calculateContentCreditCost as calculateCreditCost, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, chatIdGenerator, chunkText, clampScore, classifyHttpStatus, computeCostMicros, configureProvider, consumeAnthropicStream, consumeGroqStream, cosineSimilarity, countChanges, createAI, createAssistantMessage, createFalProvider, createGeminiProvider, createGroqProvider, createMessage, createOpenAiAudioTranscriptionAdapter, createOpenAiEmbeddingsAdapter, createOpenAiImageAdapter, createOpenAiSpeechAdapter, createProviderFactory, createPrunaProvider, createSseResponse, createSystemMessage, createUserMessage, debounce, debounceManager, defaultEffortForModel, defaultSseDeltaExtractor, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorFromStatus, errorFromUnknown, estimateMessageTokens, estimateTokens, extractContentFromSsePayload, extractErrorMessageFromJsonBody, extractErrorMessageFromResponse, extractJSON, extractJsonArray, extractJsonCandidate, extractJsonFromCodeFence, extractJsonObject, extractSseDataPayload, extractTextFromMessages, extractTokenUsage, failoverCandidate, findTopKSimilar, formatCost, formatErrorForLogging, formatMessagesForDisplay, formatSseEvent, generateImageThenVideo, generate as generatePruna, generateRandomBase36Suffix, generateWithPruna, getDimensionsForAspectRatio, getProvider, getRecommendedQuality, isAuthErrorType, isMediaProvider, isRetryableErrorType, isSseDataLine, isSseDoneMarker, isTextProvider, isTextTier, isTransientError, isValidApiKey, isValidJSON, isWithinWindow, magnitude, mapAnthropicStopReason, mergeTierOverrides, messageFormatter, nextAttemptDelayMs, normalizeGenerationSettings, normalizeSources, normalizeSseChunk, oneOfCatalog, parseAIResponse, parseSseEvent, planTaskFailure, pollForResult, promptToMessages, readSseResponse, repairCommonJsonDefects, replayFirst, requestDeduplicator, requestQueue, requestStructuredJson, resetProvider, resolveModel, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, retryManager, safeJSONParse, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, submitPrediction, throttle, throttleManager, toGroqMessages, uploadImage, validateApiKey, validateToolArgs, withRetry };
|
|
7105
|
+
export { ABTestService, AIContentService, AIError, AIErrorType, ANTHROPIC_API_VERSION, ANTHROPIC_DEFAULT_MAX_TOKENS, ANTHROPIC_MODELS, ANTHROPIC_TIERS, API_ENDPOINTS, ASPECT_RATIO_OPTIONS, ASPECT_RATIO_VALUES, AiError, AnalysisService, AnthropicHttpTransport, AnthropicProvider, AnthropicRequestBuilder, AuthenticationError, BaseProvider as BaseAIProvider, BaseProvider, BlogService, CHUNK_MAX_CHARS, CHUNK_OVERLAP_CHARS, CHUNK_TEXT_LIMIT, CODE_MESSAGES, CONTENT_WIZARD_STEPS, CacheManager, CancellationError, ChatIdGenerator, ChatService, CompositeExecutor, ContentCalendarService, DEFAULT_AI_IDENTITY, DEFAULT_API_KEY_RULE, DEFAULT_BASE_URL, DEFAULT_EMBED_BATCH_SIZE, DEFAULT_ERROR_CLASSIFICATION_RULE, DEFAULT_GENERATION, DEFAULT_GENERATION_CONFIG, DEFAULT_HTTP_STATUS_RULE, DEFAULT_MODELS, DEFAULT_PROMPT_STRATEGY, 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, FalProvider, GEMINI_TIERS, GENERATION_BOUNDS, CREDIT_COSTS as GENERATION_COSTS, GROQ_MODELS, GROQ_TIERS, GeminiProvider, GenerationExecutor, GenerationFailedError, GroqChatRequestBuilder, GroqConfigStore, GroqError, AIErrorType as GroqErrorType, GroqHttpClient, GroqHttpTransport, GroqProvider, IMAGE_B64_LIMIT, IMAGE_QUALITIES, IMAGE_QUALITY_OPTIONS, IMAGE_QUALITY_VALUES, IMAGE_SIZES, IMAGE_WIZARD_STEPS, ImagePromptService, JSON_CODE_BLOCK_PATTERN, JSON_OBJECT_PATTERN, JsonResponseParser, MEMORY_MAX_ITEMS, MEMORY_TOTAL_LIMIT, MICROS_PER_UNIT, MOTION_OPTIONS, MediaGenerationService, PromptBuilder, ProviderError, ProviderFactory, ProviderQuotaExhaustedError, ProviderUnavailableError, PrunaProvider, QueueExecutor, RESEARCH_MAX_OUTPUT_TOKENS, RESEARCH_QUERY_MAX, RESEARCH_QUERY_MIN, RESEARCH_REPORT_MIN_CHARS, RESEARCH_SNIPPET_MAX_CHARS, RESEARCH_TEMPERATURE, RequestDeduplicator, RequestPriority, RequestQueue, RetryExecutor, RetryManager, SEARCH_MAX_RESULTS, SPEECH_INPUT_MAX, SPEECH_VOICES, SSE_BRIDGE_EVENTS, SSE_DONE_MARKER, SSE_PREFIX, STATUS_TO_CODE, STYLE_PRESETS, SYSTEM_PROMPT_VERSION, SeoService, SocialService, StreamingResponseParser, StructuredPromptBuilder, TEXT_EXTRACT_PER_FILE_LIMIT, TEXT_EXTRACT_TOTAL_LIMIT, TEXT_TIERS, TIMEOUTS, TRANSIENT_ERROR_CODES, TextGenerationService, ThrottleManager, TimeoutError, ToolCallAccumulator, USER_FRIENDLY_ERROR_MESSAGES, VIDEO_DURATION_OPTIONS, VIDEO_DURATION_OPTIONS_SECONDS, VIDEO_QUALITY_OPTIONS, VIDEO_QUALITY_VALUES, VIDEO_WIZARD_STEPS, ValidationError2 as ValidationError, VideoScriptService, accumulateReport, aiErrorMessage, asObjectArray, asRecord, asStringArray, asTrimmedOptionalString, batchEmbed, batchRequest, buildCacheKey, buildContentRequest, buildContext, buildHttpStatusFallback, buildImageRequest, buildResearchMessages, buildSystemPrompt, buildUsageData, buildVideoRequest, cacheManager, calculateCacheHitRate, calculateContentCreditCost as calculateCreditCost, calculateExponentialBackoff, calculateTrailingDelay, canFailover, canStartTask, capText, chatIdGenerator, chunkText, clampScore, classifyHttpStatus, computeCostMicros, configureProvider, consumeAnthropicStream, consumeGroqStream, cosineSimilarity, countChanges, createAI, createAssistantMessage, createFalProvider, createGeminiProvider, createGroqProvider, createMessage, createOpenAiAudioTranscriptionAdapter, createOpenAiEmbeddingsAdapter, createOpenAiImageAdapter, createOpenAiSpeechAdapter, createProviderFactory, createPrunaProvider, createSseResponse, createSystemMessage, createUserMessage, debounce, debounceManager, defaultEffortForModel, defaultSseDeltaExtractor, deriveSnippetTitle, describeAIErrorType, diffLines, dotProduct, errorFromStatus, errorFromUnknown, estimateMessageTokens, estimateTokens, extractContentFromSsePayload, extractErrorMessageFromJsonBody, extractErrorMessageFromResponse, extractJSON, extractJsonArray, extractJsonCandidate, extractJsonFromCodeFence, extractJsonObject, extractSseDataPayload, extractText, extractTextFromMessages, extractTokenUsage, failoverCandidate, findTopKSimilar, formatCost, formatErrorForLogging, formatMessagesForDisplay, formatSseEvent, generateImageThenVideo, generate as generatePruna, generateRandomBase36Suffix, generateWithPruna, getDimensionsForAspectRatio, getProvider, getRecommendedQuality, isAuthErrorType, isMediaProvider, isRetryableErrorType, isSseDataLine, isSseDoneMarker, isTextLike, isTextProvider, isTextTier, isTransientError, isValidApiKey, isValidJSON, isWithinWindow, magnitude, mapAnthropicStopReason, mergeTierOverrides, messageFormatter, nextAttemptDelayMs, normalizeGenerationSettings, normalizeSources, normalizeSseChunk, oneOfCatalog, parseAIResponse, parseSseEvent, planTaskFailure, pollForResult, promptToMessages, readSseResponse, repairCommonJsonDefects, replayFirst, requestDeduplicator, requestQueue, requestStructuredJson, resetProvider, resolveModel, resolveUserFriendlyErrorMessage, resolveUserFriendlyMessage, retryManager, safeJSONParse, searchWeb, selectLeastRecentlyUsedKey, selectMemories, shouldCallOnLeadingEdge, splitMarkdown, splitSseLines, sseStreamResponse, submitPrediction, throttle, throttleManager, toGroqMessages, uploadImage, validateApiKey, validateToolArgs, withRetry };
|
|
7033
7106
|
//# sourceMappingURL=index.js.map
|
|
7034
7107
|
//# sourceMappingURL=index.js.map
|