@dudko.dev/agent-web-react 0.0.36 → 0.0.38
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 +13 -7
- package/dist/{elicitation-xMLll5W9.d.cts → elicitation-BgSf-xzh.d.cts} +25 -1
- package/dist/{elicitation-xMLll5W9.d.ts → elicitation-BgSf-xzh.d.ts} +25 -1
- package/dist/index.cjs +251 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -6
- package/dist/index.d.ts +130 -6
- package/dist/index.js +246 -36
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.cts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/styles.css +30 -0
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
|
|
3
3
|
import { AskUserRequest, AskUserContext, AskUserAnswer, AskUserConfig, AskUserHandler, AgentEvent, RunFile, RunResult, Agent, ToolApprovalMode, AppToolCallRequest, AppSamplingRequest, AppSamplingView, AppSamplingResult, CompactResult, IUsage, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, ModelTier, TierReason, EscalationReason, DecisionFallbackReason, Skill, IPlan, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
|
|
4
4
|
export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AppToolCallRequest, AskUserAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserRequest, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, McpAppCsp, McpAppResource, McpAppToolResult, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, SessionBusyError, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillStore, StorageChange, StorageChangeKind, StorageChangeOp, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalContext, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, WatchSessionOptions, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, onStorageChange, parseSkillMarkdown, postStorageChange, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel, watchSession } from '@dudko.dev/agent-web';
|
|
5
|
-
import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, Q as QuestionView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-
|
|
6
|
-
export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, V as ElicitationOption, X as FetchView, Y as MCP_APP_DISPLAY_MODES, Z as MCP_APP_MAX_ARGS_CHARS, _ as MCP_APP_MAX_DOWNLOAD_BYTES, $ as MCP_APP_MAX_FILE_NAME_CHARS, a0 as MCP_APP_MAX_IN_FLIGHT, a1 as MCP_APP_MAX_MESSAGE_CHARS, a2 as MCP_APP_MAX_URL_CHARS, a3 as MCP_APP_NOTIFICATIONS, a4 as MCP_APP_OPTIONAL_REQUESTS, a5 as MCP_APP_PROTOCOL_VERSION, a6 as MCP_APP_REFUSED, a7 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a8 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a9 as MCP_APP_RELAY, aa as MCP_APP_REQUESTS, ab as MCP_APP_SANDBOX_FRAME_TOKENS, ac as MCP_APP_SANDBOX_GRACE_MS, ad as MCP_APP_SANDBOX_SERVER, ae as MCP_APP_SANDBOX_TIMEOUT_MS, af as McpAppBridge, ag as McpAppBridgeHandlers, ah as McpAppBridgeOptions, ai as McpAppDisplayMode, aj as McpAppRpcError, ak as McpAppRpcMessage, al as McpAppSandboxInput, am as McpAppSandboxLink, an as McpAppSandboxLinkOptions, ao as McpAppSandboxTarget, ap as McpElicitationFieldSchema, aq as McpElicitationRequest, ar as McpElicitationSchema, as as QueuedMessageView, at as ReplanState, au as SkillConsentView, av as StepEscalationView, aw as UseMcpAppHostOptions, ax as appDisplayModeAllowed, ay as appDownloadOf, az as appDownloadRefusal, aA as appFileExtensionOf, aB as appFileNameOf, aC as appGestureOf, aD as appLinkOf, aE as appMessageTextOf, aF as appMimeTypeOf, aG as appSamplingErrorOf, aH as buildMcpAppDocument, aI as buildMcpAppSandboxShell, aJ as clampAppHeight, aK as elicitationFields, aL as elicitationFormAnswer, aM as elicitationInitialDraft, aN as elicitationLink, aO as formatCountdown, aP as grantedAppCsp, aQ as mcpAppCsp, aR as mcpAppHostCapabilities, aS as mcpAppSandboxProxyUrl, aT as mcpAppSandboxShellCsp, aU as mcpAppSandboxTarget, aV as resolveAppDownload, aW as saveAppFile, aX as useMcpAppHost } from './elicitation-
|
|
5
|
+
import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, Q as QuestionView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-BgSf-xzh.cjs';
|
|
6
|
+
export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, V as ElicitationOption, X as FetchView, Y as MCP_APP_DISPLAY_MODES, Z as MCP_APP_MAX_ARGS_CHARS, _ as MCP_APP_MAX_DOWNLOAD_BYTES, $ as MCP_APP_MAX_FILE_NAME_CHARS, a0 as MCP_APP_MAX_IN_FLIGHT, a1 as MCP_APP_MAX_MESSAGE_CHARS, a2 as MCP_APP_MAX_URL_CHARS, a3 as MCP_APP_NOTIFICATIONS, a4 as MCP_APP_OPTIONAL_REQUESTS, a5 as MCP_APP_PROTOCOL_VERSION, a6 as MCP_APP_REFUSED, a7 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a8 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a9 as MCP_APP_RELAY, aa as MCP_APP_REQUESTS, ab as MCP_APP_SANDBOX_FRAME_TOKENS, ac as MCP_APP_SANDBOX_GRACE_MS, ad as MCP_APP_SANDBOX_SERVER, ae as MCP_APP_SANDBOX_TIMEOUT_MS, af as McpAppBridge, ag as McpAppBridgeHandlers, ah as McpAppBridgeOptions, ai as McpAppDisplayMode, aj as McpAppRpcError, ak as McpAppRpcMessage, al as McpAppSandboxInput, am as McpAppSandboxLink, an as McpAppSandboxLinkOptions, ao as McpAppSandboxTarget, ap as McpElicitationFieldSchema, aq as McpElicitationRequest, ar as McpElicitationSchema, as as QueuedMessageView, at as ReplanState, au as SkillConsentView, av as StepEscalationView, aw as UseMcpAppHostOptions, ax as appDisplayModeAllowed, ay as appDownloadOf, az as appDownloadRefusal, aA as appFileExtensionOf, aB as appFileNameOf, aC as appGestureOf, aD as appLinkOf, aE as appMessageTextOf, aF as appMimeTypeOf, aG as appSamplingErrorOf, aH as buildMcpAppDocument, aI as buildMcpAppSandboxShell, aJ as clampAppHeight, aK as elicitationFields, aL as elicitationFormAnswer, aM as elicitationInitialDraft, aN as elicitationLink, aO as formatCountdown, aP as grantedAppCsp, aQ as mcpAppCsp, aR as mcpAppHostCapabilities, aS as mcpAppSandboxProxyUrl, aT as mcpAppSandboxShellCsp, aU as mcpAppSandboxTarget, aV as resolveAppDownload, aW as saveAppFile, aX as useMcpAppHost } from './elicitation-BgSf-xzh.cjs';
|
|
7
7
|
export { M as MCP_APP_POLICY_TOKEN_MAX_CHARS, a as MCP_APP_SANDBOX_PROXY_READY, b as MCP_APP_SANDBOX_RESOURCE_READY, i as isMcpAppSandboxMessage, m as mcpAppPolicyToken } from './mcp-app-policy-DIUmGPJP.cjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -330,6 +330,15 @@ declare class ChatHistoryStore {
|
|
|
330
330
|
private readonly memory?;
|
|
331
331
|
private db?;
|
|
332
332
|
constructor(opts?: ChatHistoryStoreOptions);
|
|
333
|
+
/**
|
|
334
|
+
* The store's connection, opened on first use. Never in another tab's way: when another
|
|
335
|
+
* connection asks to delete or upgrade the database (`versionchange` - another tab's
|
|
336
|
+
* `indexedDB.deleteDatabase`, a newer copy of this package), it is closed at once, so that
|
|
337
|
+
* request goes ahead instead of waiting for this tab to close; one the browser closed by itself
|
|
338
|
+
* (site data cleared) is let go too. The next use opens the database again - after a deletion a
|
|
339
|
+
* new, empty one (no chats: `list()` is empty, a save starts it again); after an upgrade by a
|
|
340
|
+
* newer copy, the open fails until the page is reloaded with that copy.
|
|
341
|
+
*/
|
|
333
342
|
private open;
|
|
334
343
|
private tx;
|
|
335
344
|
/** One write in its own transaction, resolved once it committed - then the notice. */
|
|
@@ -761,9 +770,69 @@ interface ComposerAttachment {
|
|
|
761
770
|
declare const attachmentKindOf: (mediaType: string, name: string) => ComposerAttachment["kind"];
|
|
762
771
|
/**
|
|
763
772
|
* The goal the agent receives: the typed text followed by each attached TEXT
|
|
764
|
-
* file in a fenced block. Binary attachments travel as file parts instead
|
|
773
|
+
* file in a fenced block. Binary attachments travel as file parts instead; the
|
|
774
|
+
* ones saved in the workspace (`path`) are named with it, so a tool can take
|
|
775
|
+
* the file itself (`generate_image`'s reference pictures).
|
|
765
776
|
*/
|
|
766
777
|
declare const withAttachments: (text: string, files: ComposerAttachment[]) => string;
|
|
778
|
+
/**
|
|
779
|
+
* The size bounds of an attachment (`<AgentComposer attachments={…}>`; these are the defaults).
|
|
780
|
+
* - `maxBytes`: what is SENT. A file that goes as it is, by its size; one the composer transforms
|
|
781
|
+
* first, by the result - an image it downscales (a 13 MB photo goes as a few hundred KB), a
|
|
782
|
+
* file the host's `convertFile` turns into text (a 30 MB PDF goes as its Markdown).
|
|
783
|
+
* - `maxSourceBytes`: the ORIGINAL of one it transforms, judged before it is read or decoded.
|
|
784
|
+
* - `imageMaxSourcePixels`: the original of an image it downscales, by the pixels its header
|
|
785
|
+
* declares (`imageSizeOf`) - a decoded picture takes ~4 bytes a pixel. A format whose header is
|
|
786
|
+
* not read is held to the bytes only.
|
|
787
|
+
* - `maxImages` / `maxTotalBytes`: ONE message - its pictures, and what all its attachments carry
|
|
788
|
+
* together (`messageOverLimit`), so a batch never meets the provider's request-size error.
|
|
789
|
+
*/
|
|
790
|
+
interface AttachmentBounds {
|
|
791
|
+
maxBytes: number;
|
|
792
|
+
maxSourceBytes: number;
|
|
793
|
+
imageMaxSourcePixels: number;
|
|
794
|
+
maxImages: number;
|
|
795
|
+
maxTotalBytes: number;
|
|
796
|
+
}
|
|
797
|
+
declare const ATTACHMENT_BOUNDS: AttachmentBounds;
|
|
798
|
+
/**
|
|
799
|
+
* How an attachment goes to the model: `'convert'` - as the text the host's `convertFile` makes
|
|
800
|
+
* of it (`converts`: the composer will call it for this file); `'downscale'` - an image of a type
|
|
801
|
+
* the composer draws smaller (not GIF - animated - or SVG - drawn at any size), while
|
|
802
|
+
* `imageMaxDimension` is not false; `'none'` - as it is.
|
|
803
|
+
*/
|
|
804
|
+
type AttachmentTransform = 'none' | 'downscale' | 'convert';
|
|
805
|
+
declare const attachmentTransformOf: (input: {
|
|
806
|
+
kind: ComposerAttachment["kind"];
|
|
807
|
+
mediaType: string;
|
|
808
|
+
imageMaxDimension: number | false;
|
|
809
|
+
converts: boolean;
|
|
810
|
+
}) => AttachmentTransform;
|
|
811
|
+
/** The bound an attachment is over, and its value (bytes or pixels). */
|
|
812
|
+
type AttachmentOverLimit = {
|
|
813
|
+
bound: 'bytes' | 'pixels';
|
|
814
|
+
limit: number;
|
|
815
|
+
};
|
|
816
|
+
/**
|
|
817
|
+
* Which bound an attachment is over, or undefined. `stage` is when it is judged: `'original'` -
|
|
818
|
+
* the file as picked (and, for an image to downscale, its pixels when known); `'sent'` - what
|
|
819
|
+
* goes to the model (the downscaled image, the converted text, or the file as it is). The
|
|
820
|
+
* original of one the composer transforms is held to `maxSourceBytes` - never below `maxBytes`,
|
|
821
|
+
* so nothing that passed before is refused for its size - and an image's to
|
|
822
|
+
* `imageMaxSourcePixels`; what is sent, to `maxBytes`. One it does not transform: `maxBytes` on
|
|
823
|
+
* the original, as it is.
|
|
824
|
+
*/
|
|
825
|
+
declare const attachmentOverLimit: (file: {
|
|
826
|
+
bytes: number;
|
|
827
|
+
pixels?: number;
|
|
828
|
+
}, stage: "original" | "sent", transform: AttachmentTransform, bounds: AttachmentBounds) => AttachmentOverLimit | undefined;
|
|
829
|
+
/**
|
|
830
|
+
* Which limit of ONE message adding `next` to the attachments already in it would break:
|
|
831
|
+
* `'images'` - it is a picture and `maxImages` are there; `'bytes'` - what they would carry
|
|
832
|
+
* together is over `maxTotalBytes`. Each counts as it goes (`bytes`): a picture as downscaled, a
|
|
833
|
+
* converted file as its text, a text file as itself. undefined: it fits.
|
|
834
|
+
*/
|
|
835
|
+
declare const messageOverLimit: (inMessage: readonly Pick<ComposerAttachment, "kind" | "bytes">[], next: Pick<ComposerAttachment, "kind" | "bytes">, bounds: Pick<AttachmentBounds, "maxImages" | "maxTotalBytes">) => "images" | "bytes" | undefined;
|
|
767
836
|
/**
|
|
768
837
|
* Can the current model take this attachment? Returns the reason it can't
|
|
769
838
|
* (an actionable sentence), or undefined. `caps` is the core agent's
|
|
@@ -853,6 +922,8 @@ interface AgentLabels {
|
|
|
853
922
|
/** Why a web request was refused. */
|
|
854
923
|
fetchRefused: (reason: string) => string;
|
|
855
924
|
answerThoughts: string;
|
|
925
|
+
/** In place of the answer of a run that was stopped before it wrote any (`ChatMessage.stopped`). */
|
|
926
|
+
answerStopped: string;
|
|
856
927
|
stepThoughts: string;
|
|
857
928
|
usageTitle: string;
|
|
858
929
|
attachments: string;
|
|
@@ -896,7 +967,17 @@ interface AgentLabels {
|
|
|
896
967
|
attachmentsOnly: string;
|
|
897
968
|
seeAttachments: string;
|
|
898
969
|
tooLarge: (name: string, mb: number) => string;
|
|
970
|
+
/** A picture with more pixels than `attachments.imageMaxSourcePixels` (in millions). */
|
|
971
|
+
tooManyPixels: (name: string, megapixels: number) => string;
|
|
899
972
|
binaryText: (name: string) => string;
|
|
973
|
+
/** An attachment's note: an image sent smaller (`size` is `bytes` of the original). */
|
|
974
|
+
downscaledFrom: (size: string) => string;
|
|
975
|
+
/** An attachment's note: a file sent as the text `convertFile` made of it. */
|
|
976
|
+
convertedFrom: (name: string) => string;
|
|
977
|
+
/** Files left out: the message has `attachments.maxImages` pictures (`names`: up to three). */
|
|
978
|
+
tooManyImages: (names: string, max: number) => string;
|
|
979
|
+
/** Files left out: the message would carry more than `attachments.maxTotalBytes` (in MB). */
|
|
980
|
+
messageTooLarge: (names: string, mb: number) => string;
|
|
900
981
|
commandGroups: {
|
|
901
982
|
commands: string;
|
|
902
983
|
consent: string;
|
|
@@ -946,6 +1027,11 @@ interface AgentLabels {
|
|
|
946
1027
|
noAttachmentsWhileBusy: string;
|
|
947
1028
|
/** A message waiting to reach the agent. */
|
|
948
1029
|
queuedWaiting: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* What the user sent, waiting with a run of this tab's that waits for the conversation's other
|
|
1032
|
+
* run (`sessionBusy`) - in another tab, or in this one - to finish. Shown only while that lasts.
|
|
1033
|
+
*/
|
|
1034
|
+
queuedForSession: (heldBy: 'another-tab' | 'this-tab') => string;
|
|
949
1035
|
/** Where a note landed: between tool calls / after a step / before the answer. */
|
|
950
1036
|
noteAt: Record<'round' | 'step' | 'final', string>;
|
|
951
1037
|
/** Messages the run ended without delivering, offered for sending. */
|
|
@@ -1010,6 +1096,10 @@ interface AgentLabels {
|
|
|
1010
1096
|
mediaAudio: (path: string) => string;
|
|
1011
1097
|
/** A generated file that cannot be shown here (no workspace, the file is gone, an unknown type). */
|
|
1012
1098
|
mediaFile: (path: string) => string;
|
|
1099
|
+
/** Under a generated picture made with reference pictures: their names ("me.jpg, dog.png"). */
|
|
1100
|
+
mediaReferences: (names: string) => string;
|
|
1101
|
+
/** ...and when the image model took none: the picture was made from the text alone. */
|
|
1102
|
+
mediaReferencesUnused: (names: string) => string;
|
|
1013
1103
|
/** The summary of a transcript block. */
|
|
1014
1104
|
transcriptOf: (name: string) => string;
|
|
1015
1105
|
/** Says whose words a transcript is: the content of the user's file, not the agent's. */
|
|
@@ -1312,6 +1402,18 @@ interface DownscaleOptions {
|
|
|
1312
1402
|
/** JPEG/WebP quality 0..1 (default 0.9). */
|
|
1313
1403
|
quality?: number;
|
|
1314
1404
|
}
|
|
1405
|
+
/** A picture's size in pixels, as its file declares it. */
|
|
1406
|
+
interface ImageSize {
|
|
1407
|
+
width: number;
|
|
1408
|
+
height: number;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* A picture's size in pixels read from its file's header - a few small reads, nothing decoded -
|
|
1412
|
+
* for PNG, JPEG and WebP (by their bytes, whatever the file's type says). undefined for any
|
|
1413
|
+
* other format, a header that does not add up, or a file that cannot be read: the caller then
|
|
1414
|
+
* goes by the bytes alone. Never throws.
|
|
1415
|
+
*/
|
|
1416
|
+
declare const imageSizeOf: (file: Blob) => Promise<ImageSize | undefined>;
|
|
1315
1417
|
/** The image, smaller when it is larger than the limits; the original otherwise. */
|
|
1316
1418
|
declare const downscaleImage: (file: Blob, opts?: DownscaleOptions) => Promise<Blob>;
|
|
1317
1419
|
|
|
@@ -1497,7 +1599,11 @@ interface AgentComposerProps {
|
|
|
1497
1599
|
attachments?: boolean | {
|
|
1498
1600
|
/** The file picker's `accept`. */
|
|
1499
1601
|
accept?: string;
|
|
1500
|
-
/**
|
|
1602
|
+
/**
|
|
1603
|
+
* Refuse larger files (default 20 MB) - judged on what is SENT: an image the composer
|
|
1604
|
+
* downscales by the result (a 13 MB photo goes as a few hundred KB), a file `convertFile`
|
|
1605
|
+
* turns into text by the text.
|
|
1606
|
+
*/
|
|
1501
1607
|
maxBytes?: number;
|
|
1502
1608
|
/**
|
|
1503
1609
|
* Downscale images to this longest edge before sending (default 1568 —
|
|
@@ -1506,6 +1612,24 @@ interface AgentComposerProps {
|
|
|
1506
1612
|
imageMaxDimension?: number | false;
|
|
1507
1613
|
/** …and to this many pixels (default 1 150 000). */
|
|
1508
1614
|
imageMaxPixels?: number;
|
|
1615
|
+
/**
|
|
1616
|
+
* The original of a file it downscales or converts may be this large (default 50 MB;
|
|
1617
|
+
* never below `maxBytes`): a larger one is refused before it is read.
|
|
1618
|
+
*/
|
|
1619
|
+
maxSourceBytes?: number;
|
|
1620
|
+
/**
|
|
1621
|
+
* The original of an image it downscales may have this many pixels, read from its header
|
|
1622
|
+
* before it is decoded (default 200 000 000 - a decoded picture takes ~4 bytes a pixel).
|
|
1623
|
+
* Formats whose header is not read: the bytes only.
|
|
1624
|
+
*/
|
|
1625
|
+
imageMaxSourcePixels?: number;
|
|
1626
|
+
/** Pictures in one message, those already attached included (default 20). */
|
|
1627
|
+
maxImages?: number;
|
|
1628
|
+
/**
|
|
1629
|
+
* What one message's attachments carry together (default 20 MB): a picture as downscaled,
|
|
1630
|
+
* a converted file as its text. A file that would go over it is not added.
|
|
1631
|
+
*/
|
|
1632
|
+
maxTotalBytes?: number;
|
|
1509
1633
|
};
|
|
1510
1634
|
/**
|
|
1511
1635
|
* Turn a file into text — e.g. PDF → Markdown with `@dudko.dev/pdf-to-md-core`.
|
|
@@ -2826,5 +2950,5 @@ interface AppRequestPromptProps {
|
|
|
2826
2950
|
*/
|
|
2827
2951
|
declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
|
|
2828
2952
|
|
|
2829
|
-
export { ASK_USER_TOOL_NAME, AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createQuestionQueue, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, lessonsOf, linkedFilesOf, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, newChatId, noticesOf, parseSlash, pendingApprovalsOf, questionChoiceOf, questionOtherOf, questionTimeoutOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords };
|
|
2830
|
-
export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MenuSection, MessageListProps, ModelLoadBarProps, NoticeTexts, PendingQuestion, PlanViewProps, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
|
|
2953
|
+
export { ASK_USER_TOOL_NAME, ATTACHMENT_BOUNDS, AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentKindOf, attachmentOverLimit, attachmentRefusal, attachmentTransformOf, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createQuestionQueue, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, imageSizeOf, lessonsOf, linkedFilesOf, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, messageOverLimit, newChatId, noticesOf, parseSlash, pendingApprovalsOf, questionChoiceOf, questionOtherOf, questionTimeoutOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords };
|
|
2954
|
+
export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, AttachmentBounds, AttachmentOverLimit, AttachmentTransform, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageSize, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MenuSection, MessageListProps, ModelLoadBarProps, NoticeTexts, PendingQuestion, PlanViewProps, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
|
|
3
3
|
import { AskUserRequest, AskUserContext, AskUserAnswer, AskUserConfig, AskUserHandler, AgentEvent, RunFile, RunResult, Agent, ToolApprovalMode, AppToolCallRequest, AppSamplingRequest, AppSamplingView, AppSamplingResult, CompactResult, IUsage, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, ModelTier, TierReason, EscalationReason, DecisionFallbackReason, Skill, IPlan, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
|
|
4
4
|
export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AppToolCallRequest, AskUserAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserRequest, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, McpAppCsp, McpAppResource, McpAppToolResult, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, SessionBusyError, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillStore, StorageChange, StorageChangeKind, StorageChangeOp, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalContext, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, WatchSessionOptions, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, onStorageChange, parseSkillMarkdown, postStorageChange, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel, watchSession } from '@dudko.dev/agent-web';
|
|
5
|
-
import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, Q as QuestionView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-
|
|
6
|
-
export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, V as ElicitationOption, X as FetchView, Y as MCP_APP_DISPLAY_MODES, Z as MCP_APP_MAX_ARGS_CHARS, _ as MCP_APP_MAX_DOWNLOAD_BYTES, $ as MCP_APP_MAX_FILE_NAME_CHARS, a0 as MCP_APP_MAX_IN_FLIGHT, a1 as MCP_APP_MAX_MESSAGE_CHARS, a2 as MCP_APP_MAX_URL_CHARS, a3 as MCP_APP_NOTIFICATIONS, a4 as MCP_APP_OPTIONAL_REQUESTS, a5 as MCP_APP_PROTOCOL_VERSION, a6 as MCP_APP_REFUSED, a7 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a8 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a9 as MCP_APP_RELAY, aa as MCP_APP_REQUESTS, ab as MCP_APP_SANDBOX_FRAME_TOKENS, ac as MCP_APP_SANDBOX_GRACE_MS, ad as MCP_APP_SANDBOX_SERVER, ae as MCP_APP_SANDBOX_TIMEOUT_MS, af as McpAppBridge, ag as McpAppBridgeHandlers, ah as McpAppBridgeOptions, ai as McpAppDisplayMode, aj as McpAppRpcError, ak as McpAppRpcMessage, al as McpAppSandboxInput, am as McpAppSandboxLink, an as McpAppSandboxLinkOptions, ao as McpAppSandboxTarget, ap as McpElicitationFieldSchema, aq as McpElicitationRequest, ar as McpElicitationSchema, as as QueuedMessageView, at as ReplanState, au as SkillConsentView, av as StepEscalationView, aw as UseMcpAppHostOptions, ax as appDisplayModeAllowed, ay as appDownloadOf, az as appDownloadRefusal, aA as appFileExtensionOf, aB as appFileNameOf, aC as appGestureOf, aD as appLinkOf, aE as appMessageTextOf, aF as appMimeTypeOf, aG as appSamplingErrorOf, aH as buildMcpAppDocument, aI as buildMcpAppSandboxShell, aJ as clampAppHeight, aK as elicitationFields, aL as elicitationFormAnswer, aM as elicitationInitialDraft, aN as elicitationLink, aO as formatCountdown, aP as grantedAppCsp, aQ as mcpAppCsp, aR as mcpAppHostCapabilities, aS as mcpAppSandboxProxyUrl, aT as mcpAppSandboxShellCsp, aU as mcpAppSandboxTarget, aV as resolveAppDownload, aW as saveAppFile, aX as useMcpAppHost } from './elicitation-
|
|
5
|
+
import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, Q as QuestionView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-BgSf-xzh.js';
|
|
6
|
+
export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, V as ElicitationOption, X as FetchView, Y as MCP_APP_DISPLAY_MODES, Z as MCP_APP_MAX_ARGS_CHARS, _ as MCP_APP_MAX_DOWNLOAD_BYTES, $ as MCP_APP_MAX_FILE_NAME_CHARS, a0 as MCP_APP_MAX_IN_FLIGHT, a1 as MCP_APP_MAX_MESSAGE_CHARS, a2 as MCP_APP_MAX_URL_CHARS, a3 as MCP_APP_NOTIFICATIONS, a4 as MCP_APP_OPTIONAL_REQUESTS, a5 as MCP_APP_PROTOCOL_VERSION, a6 as MCP_APP_REFUSED, a7 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a8 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a9 as MCP_APP_RELAY, aa as MCP_APP_REQUESTS, ab as MCP_APP_SANDBOX_FRAME_TOKENS, ac as MCP_APP_SANDBOX_GRACE_MS, ad as MCP_APP_SANDBOX_SERVER, ae as MCP_APP_SANDBOX_TIMEOUT_MS, af as McpAppBridge, ag as McpAppBridgeHandlers, ah as McpAppBridgeOptions, ai as McpAppDisplayMode, aj as McpAppRpcError, ak as McpAppRpcMessage, al as McpAppSandboxInput, am as McpAppSandboxLink, an as McpAppSandboxLinkOptions, ao as McpAppSandboxTarget, ap as McpElicitationFieldSchema, aq as McpElicitationRequest, ar as McpElicitationSchema, as as QueuedMessageView, at as ReplanState, au as SkillConsentView, av as StepEscalationView, aw as UseMcpAppHostOptions, ax as appDisplayModeAllowed, ay as appDownloadOf, az as appDownloadRefusal, aA as appFileExtensionOf, aB as appFileNameOf, aC as appGestureOf, aD as appLinkOf, aE as appMessageTextOf, aF as appMimeTypeOf, aG as appSamplingErrorOf, aH as buildMcpAppDocument, aI as buildMcpAppSandboxShell, aJ as clampAppHeight, aK as elicitationFields, aL as elicitationFormAnswer, aM as elicitationInitialDraft, aN as elicitationLink, aO as formatCountdown, aP as grantedAppCsp, aQ as mcpAppCsp, aR as mcpAppHostCapabilities, aS as mcpAppSandboxProxyUrl, aT as mcpAppSandboxShellCsp, aU as mcpAppSandboxTarget, aV as resolveAppDownload, aW as saveAppFile, aX as useMcpAppHost } from './elicitation-BgSf-xzh.js';
|
|
7
7
|
export { M as MCP_APP_POLICY_TOKEN_MAX_CHARS, a as MCP_APP_SANDBOX_PROXY_READY, b as MCP_APP_SANDBOX_RESOURCE_READY, i as isMcpAppSandboxMessage, m as mcpAppPolicyToken } from './mcp-app-policy-DIUmGPJP.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -330,6 +330,15 @@ declare class ChatHistoryStore {
|
|
|
330
330
|
private readonly memory?;
|
|
331
331
|
private db?;
|
|
332
332
|
constructor(opts?: ChatHistoryStoreOptions);
|
|
333
|
+
/**
|
|
334
|
+
* The store's connection, opened on first use. Never in another tab's way: when another
|
|
335
|
+
* connection asks to delete or upgrade the database (`versionchange` - another tab's
|
|
336
|
+
* `indexedDB.deleteDatabase`, a newer copy of this package), it is closed at once, so that
|
|
337
|
+
* request goes ahead instead of waiting for this tab to close; one the browser closed by itself
|
|
338
|
+
* (site data cleared) is let go too. The next use opens the database again - after a deletion a
|
|
339
|
+
* new, empty one (no chats: `list()` is empty, a save starts it again); after an upgrade by a
|
|
340
|
+
* newer copy, the open fails until the page is reloaded with that copy.
|
|
341
|
+
*/
|
|
333
342
|
private open;
|
|
334
343
|
private tx;
|
|
335
344
|
/** One write in its own transaction, resolved once it committed - then the notice. */
|
|
@@ -761,9 +770,69 @@ interface ComposerAttachment {
|
|
|
761
770
|
declare const attachmentKindOf: (mediaType: string, name: string) => ComposerAttachment["kind"];
|
|
762
771
|
/**
|
|
763
772
|
* The goal the agent receives: the typed text followed by each attached TEXT
|
|
764
|
-
* file in a fenced block. Binary attachments travel as file parts instead
|
|
773
|
+
* file in a fenced block. Binary attachments travel as file parts instead; the
|
|
774
|
+
* ones saved in the workspace (`path`) are named with it, so a tool can take
|
|
775
|
+
* the file itself (`generate_image`'s reference pictures).
|
|
765
776
|
*/
|
|
766
777
|
declare const withAttachments: (text: string, files: ComposerAttachment[]) => string;
|
|
778
|
+
/**
|
|
779
|
+
* The size bounds of an attachment (`<AgentComposer attachments={…}>`; these are the defaults).
|
|
780
|
+
* - `maxBytes`: what is SENT. A file that goes as it is, by its size; one the composer transforms
|
|
781
|
+
* first, by the result - an image it downscales (a 13 MB photo goes as a few hundred KB), a
|
|
782
|
+
* file the host's `convertFile` turns into text (a 30 MB PDF goes as its Markdown).
|
|
783
|
+
* - `maxSourceBytes`: the ORIGINAL of one it transforms, judged before it is read or decoded.
|
|
784
|
+
* - `imageMaxSourcePixels`: the original of an image it downscales, by the pixels its header
|
|
785
|
+
* declares (`imageSizeOf`) - a decoded picture takes ~4 bytes a pixel. A format whose header is
|
|
786
|
+
* not read is held to the bytes only.
|
|
787
|
+
* - `maxImages` / `maxTotalBytes`: ONE message - its pictures, and what all its attachments carry
|
|
788
|
+
* together (`messageOverLimit`), so a batch never meets the provider's request-size error.
|
|
789
|
+
*/
|
|
790
|
+
interface AttachmentBounds {
|
|
791
|
+
maxBytes: number;
|
|
792
|
+
maxSourceBytes: number;
|
|
793
|
+
imageMaxSourcePixels: number;
|
|
794
|
+
maxImages: number;
|
|
795
|
+
maxTotalBytes: number;
|
|
796
|
+
}
|
|
797
|
+
declare const ATTACHMENT_BOUNDS: AttachmentBounds;
|
|
798
|
+
/**
|
|
799
|
+
* How an attachment goes to the model: `'convert'` - as the text the host's `convertFile` makes
|
|
800
|
+
* of it (`converts`: the composer will call it for this file); `'downscale'` - an image of a type
|
|
801
|
+
* the composer draws smaller (not GIF - animated - or SVG - drawn at any size), while
|
|
802
|
+
* `imageMaxDimension` is not false; `'none'` - as it is.
|
|
803
|
+
*/
|
|
804
|
+
type AttachmentTransform = 'none' | 'downscale' | 'convert';
|
|
805
|
+
declare const attachmentTransformOf: (input: {
|
|
806
|
+
kind: ComposerAttachment["kind"];
|
|
807
|
+
mediaType: string;
|
|
808
|
+
imageMaxDimension: number | false;
|
|
809
|
+
converts: boolean;
|
|
810
|
+
}) => AttachmentTransform;
|
|
811
|
+
/** The bound an attachment is over, and its value (bytes or pixels). */
|
|
812
|
+
type AttachmentOverLimit = {
|
|
813
|
+
bound: 'bytes' | 'pixels';
|
|
814
|
+
limit: number;
|
|
815
|
+
};
|
|
816
|
+
/**
|
|
817
|
+
* Which bound an attachment is over, or undefined. `stage` is when it is judged: `'original'` -
|
|
818
|
+
* the file as picked (and, for an image to downscale, its pixels when known); `'sent'` - what
|
|
819
|
+
* goes to the model (the downscaled image, the converted text, or the file as it is). The
|
|
820
|
+
* original of one the composer transforms is held to `maxSourceBytes` - never below `maxBytes`,
|
|
821
|
+
* so nothing that passed before is refused for its size - and an image's to
|
|
822
|
+
* `imageMaxSourcePixels`; what is sent, to `maxBytes`. One it does not transform: `maxBytes` on
|
|
823
|
+
* the original, as it is.
|
|
824
|
+
*/
|
|
825
|
+
declare const attachmentOverLimit: (file: {
|
|
826
|
+
bytes: number;
|
|
827
|
+
pixels?: number;
|
|
828
|
+
}, stage: "original" | "sent", transform: AttachmentTransform, bounds: AttachmentBounds) => AttachmentOverLimit | undefined;
|
|
829
|
+
/**
|
|
830
|
+
* Which limit of ONE message adding `next` to the attachments already in it would break:
|
|
831
|
+
* `'images'` - it is a picture and `maxImages` are there; `'bytes'` - what they would carry
|
|
832
|
+
* together is over `maxTotalBytes`. Each counts as it goes (`bytes`): a picture as downscaled, a
|
|
833
|
+
* converted file as its text, a text file as itself. undefined: it fits.
|
|
834
|
+
*/
|
|
835
|
+
declare const messageOverLimit: (inMessage: readonly Pick<ComposerAttachment, "kind" | "bytes">[], next: Pick<ComposerAttachment, "kind" | "bytes">, bounds: Pick<AttachmentBounds, "maxImages" | "maxTotalBytes">) => "images" | "bytes" | undefined;
|
|
767
836
|
/**
|
|
768
837
|
* Can the current model take this attachment? Returns the reason it can't
|
|
769
838
|
* (an actionable sentence), or undefined. `caps` is the core agent's
|
|
@@ -853,6 +922,8 @@ interface AgentLabels {
|
|
|
853
922
|
/** Why a web request was refused. */
|
|
854
923
|
fetchRefused: (reason: string) => string;
|
|
855
924
|
answerThoughts: string;
|
|
925
|
+
/** In place of the answer of a run that was stopped before it wrote any (`ChatMessage.stopped`). */
|
|
926
|
+
answerStopped: string;
|
|
856
927
|
stepThoughts: string;
|
|
857
928
|
usageTitle: string;
|
|
858
929
|
attachments: string;
|
|
@@ -896,7 +967,17 @@ interface AgentLabels {
|
|
|
896
967
|
attachmentsOnly: string;
|
|
897
968
|
seeAttachments: string;
|
|
898
969
|
tooLarge: (name: string, mb: number) => string;
|
|
970
|
+
/** A picture with more pixels than `attachments.imageMaxSourcePixels` (in millions). */
|
|
971
|
+
tooManyPixels: (name: string, megapixels: number) => string;
|
|
899
972
|
binaryText: (name: string) => string;
|
|
973
|
+
/** An attachment's note: an image sent smaller (`size` is `bytes` of the original). */
|
|
974
|
+
downscaledFrom: (size: string) => string;
|
|
975
|
+
/** An attachment's note: a file sent as the text `convertFile` made of it. */
|
|
976
|
+
convertedFrom: (name: string) => string;
|
|
977
|
+
/** Files left out: the message has `attachments.maxImages` pictures (`names`: up to three). */
|
|
978
|
+
tooManyImages: (names: string, max: number) => string;
|
|
979
|
+
/** Files left out: the message would carry more than `attachments.maxTotalBytes` (in MB). */
|
|
980
|
+
messageTooLarge: (names: string, mb: number) => string;
|
|
900
981
|
commandGroups: {
|
|
901
982
|
commands: string;
|
|
902
983
|
consent: string;
|
|
@@ -946,6 +1027,11 @@ interface AgentLabels {
|
|
|
946
1027
|
noAttachmentsWhileBusy: string;
|
|
947
1028
|
/** A message waiting to reach the agent. */
|
|
948
1029
|
queuedWaiting: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* What the user sent, waiting with a run of this tab's that waits for the conversation's other
|
|
1032
|
+
* run (`sessionBusy`) - in another tab, or in this one - to finish. Shown only while that lasts.
|
|
1033
|
+
*/
|
|
1034
|
+
queuedForSession: (heldBy: 'another-tab' | 'this-tab') => string;
|
|
949
1035
|
/** Where a note landed: between tool calls / after a step / before the answer. */
|
|
950
1036
|
noteAt: Record<'round' | 'step' | 'final', string>;
|
|
951
1037
|
/** Messages the run ended without delivering, offered for sending. */
|
|
@@ -1010,6 +1096,10 @@ interface AgentLabels {
|
|
|
1010
1096
|
mediaAudio: (path: string) => string;
|
|
1011
1097
|
/** A generated file that cannot be shown here (no workspace, the file is gone, an unknown type). */
|
|
1012
1098
|
mediaFile: (path: string) => string;
|
|
1099
|
+
/** Under a generated picture made with reference pictures: their names ("me.jpg, dog.png"). */
|
|
1100
|
+
mediaReferences: (names: string) => string;
|
|
1101
|
+
/** ...and when the image model took none: the picture was made from the text alone. */
|
|
1102
|
+
mediaReferencesUnused: (names: string) => string;
|
|
1013
1103
|
/** The summary of a transcript block. */
|
|
1014
1104
|
transcriptOf: (name: string) => string;
|
|
1015
1105
|
/** Says whose words a transcript is: the content of the user's file, not the agent's. */
|
|
@@ -1312,6 +1402,18 @@ interface DownscaleOptions {
|
|
|
1312
1402
|
/** JPEG/WebP quality 0..1 (default 0.9). */
|
|
1313
1403
|
quality?: number;
|
|
1314
1404
|
}
|
|
1405
|
+
/** A picture's size in pixels, as its file declares it. */
|
|
1406
|
+
interface ImageSize {
|
|
1407
|
+
width: number;
|
|
1408
|
+
height: number;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* A picture's size in pixels read from its file's header - a few small reads, nothing decoded -
|
|
1412
|
+
* for PNG, JPEG and WebP (by their bytes, whatever the file's type says). undefined for any
|
|
1413
|
+
* other format, a header that does not add up, or a file that cannot be read: the caller then
|
|
1414
|
+
* goes by the bytes alone. Never throws.
|
|
1415
|
+
*/
|
|
1416
|
+
declare const imageSizeOf: (file: Blob) => Promise<ImageSize | undefined>;
|
|
1315
1417
|
/** The image, smaller when it is larger than the limits; the original otherwise. */
|
|
1316
1418
|
declare const downscaleImage: (file: Blob, opts?: DownscaleOptions) => Promise<Blob>;
|
|
1317
1419
|
|
|
@@ -1497,7 +1599,11 @@ interface AgentComposerProps {
|
|
|
1497
1599
|
attachments?: boolean | {
|
|
1498
1600
|
/** The file picker's `accept`. */
|
|
1499
1601
|
accept?: string;
|
|
1500
|
-
/**
|
|
1602
|
+
/**
|
|
1603
|
+
* Refuse larger files (default 20 MB) - judged on what is SENT: an image the composer
|
|
1604
|
+
* downscales by the result (a 13 MB photo goes as a few hundred KB), a file `convertFile`
|
|
1605
|
+
* turns into text by the text.
|
|
1606
|
+
*/
|
|
1501
1607
|
maxBytes?: number;
|
|
1502
1608
|
/**
|
|
1503
1609
|
* Downscale images to this longest edge before sending (default 1568 —
|
|
@@ -1506,6 +1612,24 @@ interface AgentComposerProps {
|
|
|
1506
1612
|
imageMaxDimension?: number | false;
|
|
1507
1613
|
/** …and to this many pixels (default 1 150 000). */
|
|
1508
1614
|
imageMaxPixels?: number;
|
|
1615
|
+
/**
|
|
1616
|
+
* The original of a file it downscales or converts may be this large (default 50 MB;
|
|
1617
|
+
* never below `maxBytes`): a larger one is refused before it is read.
|
|
1618
|
+
*/
|
|
1619
|
+
maxSourceBytes?: number;
|
|
1620
|
+
/**
|
|
1621
|
+
* The original of an image it downscales may have this many pixels, read from its header
|
|
1622
|
+
* before it is decoded (default 200 000 000 - a decoded picture takes ~4 bytes a pixel).
|
|
1623
|
+
* Formats whose header is not read: the bytes only.
|
|
1624
|
+
*/
|
|
1625
|
+
imageMaxSourcePixels?: number;
|
|
1626
|
+
/** Pictures in one message, those already attached included (default 20). */
|
|
1627
|
+
maxImages?: number;
|
|
1628
|
+
/**
|
|
1629
|
+
* What one message's attachments carry together (default 20 MB): a picture as downscaled,
|
|
1630
|
+
* a converted file as its text. A file that would go over it is not added.
|
|
1631
|
+
*/
|
|
1632
|
+
maxTotalBytes?: number;
|
|
1509
1633
|
};
|
|
1510
1634
|
/**
|
|
1511
1635
|
* Turn a file into text — e.g. PDF → Markdown with `@dudko.dev/pdf-to-md-core`.
|
|
@@ -2826,5 +2950,5 @@ interface AppRequestPromptProps {
|
|
|
2826
2950
|
*/
|
|
2827
2951
|
declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
|
|
2828
2952
|
|
|
2829
|
-
export { ASK_USER_TOOL_NAME, AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createQuestionQueue, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, lessonsOf, linkedFilesOf, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, newChatId, noticesOf, parseSlash, pendingApprovalsOf, questionChoiceOf, questionOtherOf, questionTimeoutOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords };
|
|
2830
|
-
export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MenuSection, MessageListProps, ModelLoadBarProps, NoticeTexts, PendingQuestion, PlanViewProps, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
|
|
2953
|
+
export { ASK_USER_TOOL_NAME, ATTACHMENT_BOUNDS, AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentKindOf, attachmentOverLimit, attachmentRefusal, attachmentTransformOf, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createQuestionQueue, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, imageSizeOf, lessonsOf, linkedFilesOf, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, messageOverLimit, newChatId, noticesOf, parseSlash, pendingApprovalsOf, questionChoiceOf, questionOtherOf, questionTimeoutOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords };
|
|
2954
|
+
export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, AttachmentBounds, AttachmentOverLimit, AttachmentTransform, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageSize, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MenuSection, MessageListProps, ModelLoadBarProps, NoticeTexts, PendingQuestion, PlanViewProps, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
|