@dudko.dev/agent-web 0.0.46 → 0.0.48

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.
Files changed (42) hide show
  1. package/README.md +12 -2
  2. package/dist/agent-web.js +124 -124
  3. package/dist/agent-web.js.map +1 -1
  4. package/dist/{chunk-Y6CD3WOK.js → chunk-6D4RB3H5.js} +11 -213
  5. package/dist/chunk-6D4RB3H5.js.map +1 -0
  6. package/dist/{chunk-PTJA7V23.js → chunk-6XHCPSZE.js} +5 -3
  7. package/dist/{chunk-PTJA7V23.js.map → chunk-6XHCPSZE.js.map} +1 -1
  8. package/dist/{chunk-Y4MIIBPB.js → chunk-7D2CJQB2.js} +1 -100
  9. package/dist/chunk-7D2CJQB2.js.map +1 -0
  10. package/dist/chunk-7Y5UC6L7.js +52 -0
  11. package/dist/chunk-7Y5UC6L7.js.map +1 -0
  12. package/dist/chunk-IT77BVAD.js +99 -0
  13. package/dist/chunk-IT77BVAD.js.map +1 -0
  14. package/dist/chunk-JTZEUPIG.js +217 -0
  15. package/dist/chunk-JTZEUPIG.js.map +1 -0
  16. package/dist/index.cjs +45 -26
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +25 -74
  19. package/dist/index.d.ts +25 -74
  20. package/dist/index.js +47 -70
  21. package/dist/index.js.map +1 -1
  22. package/dist/mcp.cjs +28 -20
  23. package/dist/mcp.cjs.map +1 -1
  24. package/dist/mcp.d.cts +4 -3
  25. package/dist/mcp.d.ts +4 -3
  26. package/dist/mcp.js +9 -5
  27. package/dist/mcp.js.map +1 -1
  28. package/dist/{sandbox-ZXWD5IWZ.js → sandbox-IGTCMOOX.js} +4 -3
  29. package/dist/{sandbox-ZXWD5IWZ.js.map → sandbox-IGTCMOOX.js.map} +1 -1
  30. package/dist/secrets.cjs +329 -0
  31. package/dist/secrets.cjs.map +1 -0
  32. package/dist/secrets.d.cts +63 -0
  33. package/dist/secrets.d.ts +63 -0
  34. package/dist/secrets.js +20 -0
  35. package/dist/secrets.js.map +1 -0
  36. package/dist/{vault-Mar2CY0J.d.ts → skills-ufoyTJ-B.d.cts} +2 -36
  37. package/dist/{vault-Mar2CY0J.d.cts → skills-ufoyTJ-B.d.ts} +2 -36
  38. package/dist/vault-BBGybouF.d.cts +35 -0
  39. package/dist/vault-BBGybouF.d.ts +35 -0
  40. package/package.json +11 -1
  41. package/dist/chunk-Y4MIIBPB.js.map +0 -1
  42. package/dist/chunk-Y6CD3WOK.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,11 +1,14 @@
1
1
  import { LanguageModel, Experimental_DecisionModel, Tool, ToolSet, FilePart, ImageModel, SpeechModel, TranscriptionModel, SystemModelMessage, ModelMessage, generateText, streamText } from 'ai';
2
- import { M as McpSkillConsentView, a as McpElicitationSchema, b as McpElicitationReason, c as McpAppToolResult, V as VaultOptions, d as McpSkillSource, e as McpSkillConsent, f as McpSkillGrants, g as McpSkillRunConsent, h as McpSkillSnapshotMemory } from './vault-Mar2CY0J.cjs';
3
- export { I as IndexedDBVault, i as MCP_APPS_EXTENSION, j as MCP_APP_MAX_HTML_CHARS, k as MCP_APP_MAX_RESULT_CHARS, l as MCP_APP_MIME_TYPE, m as MCP_SKILLS_EXTENSION, n as MCP_SKILLS_MAX_PER_SERVER, o as MCP_SKILLS_MAX_TOTAL, p as MCP_SKILL_BODY_MAX_CHARS, q as MCP_SKILL_CONSENTS, r as MCP_SKILL_CONSENT_DEFAULT, s as MCP_SKILL_DESCRIPTION_MAX_CHARS, t as MCP_SKILL_DIRECTORY_ENTRIES_MAX, u as MCP_SKILL_FILE_MAX_CHARS, v as MCP_SKILL_MAX_RESOURCES, w as MCP_SKILL_MAX_TOTAL_BYTES, x as MCP_SKILL_SNAPSHOTS_MAX_BYTES, y as MCP_SKILL_SNAPSHOT_MAX_DEPTH, z as MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES, A as MCP_SKILL_URI_MAX_CHARS, B as McpAppCsp, C as McpAppPermissions, D as McpAppResource, E as McpAppVisibility, F as McpElicitationFieldSchema, G as McpSkillsOptions, H as McpSkillsSetting, S as SkillDirectoryListing, J as mcpAppOrigin, K as mcpSkillEntryRefusal, L as mcpSkillPreamble, N as mcpSkillUriRefusal } from './vault-Mar2CY0J.cjs';
2
+ import { P as McpSkillConsentView, B as McpElicitationSchema, y as McpElicitationReason, e as McpAppToolResult, Q as McpSkillSource, R as McpSkillConsent, S as McpSkillGrants, T as McpSkillRunConsent, U as McpSkillSnapshotMemory } from './skills-ufoyTJ-B.cjs';
3
+ export { g as MCP_APPS_EXTENSION, k as MCP_APP_MAX_HTML_CHARS, l as MCP_APP_MAX_RESULT_CHARS, m as MCP_APP_MIME_TYPE, V as MCP_SKILLS_EXTENSION, W as MCP_SKILLS_MAX_PER_SERVER, X as MCP_SKILLS_MAX_TOTAL, Y as MCP_SKILL_BODY_MAX_CHARS, Z as MCP_SKILL_CONSENTS, _ as MCP_SKILL_CONSENT_DEFAULT, $ as MCP_SKILL_DESCRIPTION_MAX_CHARS, a0 as MCP_SKILL_DIRECTORY_ENTRIES_MAX, a1 as MCP_SKILL_FILE_MAX_CHARS, a2 as MCP_SKILL_MAX_RESOURCES, a3 as MCP_SKILL_MAX_TOTAL_BYTES, a4 as MCP_SKILL_SNAPSHOTS_MAX_BYTES, a5 as MCP_SKILL_SNAPSHOT_MAX_DEPTH, a6 as MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES, a7 as MCP_SKILL_URI_MAX_CHARS, q as McpAppCsp, r as McpAppPermissions, b as McpAppResource, c as McpAppVisibility, x as McpElicitationFieldSchema, a8 as McpSkillsOptions, f as McpSkillsSetting, a9 as SkillDirectoryListing, G as mcpAppOrigin, aa as mcpSkillEntryRefusal, ab as mcpSkillPreamble, ac as mcpSkillUriRefusal } from './skills-ufoyTJ-B.cjs';
4
4
  import { PipelineEvent, PipelineNode, PipelineDefinition, PipelineResult, PipelineNodeRunner } from './pipeline-engine.cjs';
5
5
  export { PIPELINE_LIMITS, PIPELINE_ROUTER_SYSTEM, PipelineAbortBehaviour, PipelineCondition, PipelineEdge, PipelineGraphRunOptions, PipelineIssue, PipelineNodeContext, PipelineNodeError, PipelineNodeEvent, PipelineNodeInput, PipelineNodeOutput, PipelineNodeSource, PipelinePlan, PipelineRoute, PipelineStop, PipelineTraceEntry, PipelineUsage, PipelineValidation, PipelineValidationError, matchPipelineRoute, normalizePipeline, preparePipeline, renderPipelineNodeInput, renderPipelineRoutePrompt, runPipelineGraph, testPipelineCondition, validatePipeline } from './pipeline-engine.cjs';
6
+ import { CredentialStore } from './secrets.cjs';
7
+ export { EncryptedBlob, MemoryCredentialStore, VaultCredentialStore, decryptJSON, encryptJSON, getOrCreateVaultKey } from './secrets.cjs';
6
8
  import { A as AgentToolSet, a as AgentTool } from './types-DwSMj_Xs.cjs';
7
9
  export { p as promptHintOf } from './types-DwSMj_Xs.cjs';
8
10
  import { z, ZodType } from 'zod';
11
+ export { I as IndexedDBVault, V as VaultOptions } from './vault-BBGybouF.cjs';
9
12
  import { IDBPDatabase } from 'idb';
10
13
 
11
14
  /** Executor models by strength (`config.executorTiers`), weakest first. */
@@ -1688,40 +1691,6 @@ declare const defaultPrompts: Prompts;
1688
1691
  /** Prepend a host-supplied systemPrompt to a phase system prompt, if present. */
1689
1692
  declare const withSystem: (base: string, extra?: string) => string;
1690
1693
 
1691
- /**
1692
- * The seam the provider registry uses to fetch API keys at model-build time.
1693
- * Swap in any backend: the encrypted vault (default), an in-memory map (tests /
1694
- * SSR), or a `fetch` to your own short-lived-token endpoint.
1695
- */
1696
- interface CredentialStore {
1697
- getApiKey(ref: string): Promise<string | undefined>;
1698
- setApiKey(ref: string, key: string): Promise<void>;
1699
- deleteApiKey(ref: string): Promise<void>;
1700
- }
1701
- /**
1702
- * Default CredentialStore: encrypted, IndexedDB-backed (see IndexedDBVault). Every tab of the
1703
- * origin shares it: a key stored or removed tells the other tabs that SOMETHING changed (a
1704
- * `credentials` notice: no ref, never a key - see `onStorageChange`).
1705
- */
1706
- declare class VaultCredentialStore implements CredentialStore {
1707
- /** The database the vault lives in, and the name its change notices go out under. */
1708
- readonly dbName: string;
1709
- private readonly vault;
1710
- private readonly tab;
1711
- constructor(opts?: VaultOptions);
1712
- getApiKey(ref: string): Promise<string | undefined>;
1713
- setApiKey(ref: string, key: string): Promise<void>;
1714
- deleteApiKey(ref: string): Promise<void>;
1715
- }
1716
- /** Non-persistent CredentialStore for tests / SSR / ephemeral sessions. */
1717
- declare class MemoryCredentialStore implements CredentialStore {
1718
- private readonly map;
1719
- constructor(initial?: Record<string, string>);
1720
- getApiKey(ref: string): Promise<string | undefined>;
1721
- setApiKey(ref: string, key: string): Promise<void>;
1722
- deleteApiKey(ref: string): Promise<void>;
1723
- }
1724
-
1725
1694
  /**
1726
1695
  * A small virtual file system for the browser — the agent's (and the user's)
1727
1696
  * workspace: attachments the user drops in, reports the agent writes, images
@@ -2662,14 +2631,6 @@ declare const decisionEgressPolicy: (spec: IDecisionModelSpec) => IEgressPolicy;
2662
2631
  */
2663
2632
  declare const resolveDecisionModel: (input: IDecisionModel | IDecisionModelSpec | undefined, credentials?: CredentialStore) => Promise<IDecisionModel | undefined>;
2664
2633
 
2665
- /**
2666
- * `config.askUser`: the `ask_user` tool, with which the MODEL asks the person one closed question
2667
- * with 2-6 options (the rules and the bounds are `ask-user-shared.ts`, the same file as the Node
2668
- * package's). This file is the browser's wiring: the tool reads its run through `agentRun`
2669
- * (`ToolRunContext.askUser`), a helper the model started asks through its caller's channel
2670
- * (`SpawnSeed.askUser`), and a subagent the HOST defined (`createSubagentTool`, in-process) asks
2671
- * through the run that called it (`routeAskUser`).
2672
- */
2673
2634
  /** What `onQuestion` is given: the model's question and options, cleaned (see the shared file). */
2674
2635
  type AskUserRequest = AskUserRequest$1<IPlanStep>;
2675
2636
  /**
@@ -4441,29 +4402,6 @@ declare const supportsImages: (model: unknown) => boolean | undefined;
4441
4402
  */
4442
4403
  declare const supportsPdf: (model: unknown) => boolean | undefined;
4443
4404
 
4444
- /**
4445
- * Fetch (or lazily create) the vault's AES-GCM key. The key is generated
4446
- * NON-EXTRACTABLE and stored as a live `CryptoKey` in IndexedDB — a CryptoKey
4447
- * is structured-cloneable, so it persists across reloads WITHOUT its raw bytes
4448
- * ever being exposed to JavaScript. Not even in-page script can read it out; it
4449
- * can only be used to encrypt / decrypt. That is what makes at-rest storage of
4450
- * the secrets meaningful (see IndexedDBVault's threat model).
4451
- *
4452
- * Concurrent callers share one in-flight promise per DB, and creation is
4453
- * double-checked in a single IDB transaction, so two racing writers can never
4454
- * end up encrypting under different keys.
4455
- */
4456
- declare const getOrCreateVaultKey: (dbName?: string) => Promise<CryptoKey>;
4457
- interface EncryptedBlob {
4458
- /** 96-bit random IV, fresh per write. */
4459
- iv: Uint8Array;
4460
- ciphertext: ArrayBuffer;
4461
- }
4462
- /** Encrypt a JSON-serialisable value with a fresh 96-bit IV (AES-GCM). */
4463
- declare const encryptJSON: (key: CryptoKey, value: unknown) => Promise<EncryptedBlob>;
4464
- /** Decrypt a blob produced by encryptJSON. Throws if the key or blob don't match. */
4465
- declare const decryptJSON: <T = unknown>(key: CryptoKey, blob: EncryptedBlob) => Promise<T>;
4466
-
4467
4405
  interface AgentWebDBOptions {
4468
4406
  /** Database name (default 'agent-web'). Use a distinct name to isolate apps. */
4469
4407
  dbName?: string;
@@ -4479,6 +4417,16 @@ declare const RUNS_STORE = "runs";
4479
4417
  * lives under ONE database name + version. Centralising `openDB` here prevents
4480
4418
  * the classic bug where two modules open the same DB name with different store
4481
4419
  * sets and the second call throws a VersionError.
4420
+ *
4421
+ * One connection per name, shared by every store of the page - and never in another tab's way:
4422
+ * when another connection asks to delete or upgrade the database (`versionchange`: another tab's
4423
+ * `indexedDB.deleteDatabase`, or a newer copy of this package), this one is closed at once, so
4424
+ * that request goes ahead instead of waiting (blocked) for this tab to close. The browser lets the
4425
+ * transactions already under way finish first. A connection the browser closed by itself (site
4426
+ * data cleared, storage gone) is let go too. Either way the next use opens the database again:
4427
+ * after a deletion that is a NEW, EMPTY database at this version (every store of this package
4428
+ * starts from nothing - no key, no secret, no session, no file); after an upgrade by a newer copy,
4429
+ * the open fails with a `VersionError` until the page is reloaded with that copy.
4482
4430
  */
4483
4431
  declare const openAgentWebDB: (opts?: AgentWebDBOptions) => Promise<IDBPDatabase>;
4484
4432
 
@@ -4982,8 +4930,10 @@ declare class IndexedDBRunStore implements RunPersistence {
4982
4930
  * - `skills` - `VfsSkillStore` (the agent's lessons): `key` = the lesson's name, `namespace` =
4983
4931
  * the store's folder.
4984
4932
  * - `chats` - the React package's `ChatHistoryStore`: `key` = the chat id.
4933
+ * - `host` - a store of the host's own that is none of the above (`postStorageChange`): `key` =
4934
+ * which record, `namespace` = which of the host's stores - names the host chose, never a value.
4985
4935
  */
4986
- type StorageChangeKind = 'credentials' | 'oauth' | 'files' | 'session' | 'runs' | 'skills' | 'chats';
4936
+ type StorageChangeKind = 'credentials' | 'oauth' | 'files' | 'session' | 'runs' | 'skills' | 'chats' | 'host';
4987
4937
  /** `put` = written (created or replaced), `delete` = one removed, `clear` = all of them removed. */
4988
4938
  type StorageChangeOp = 'put' | 'delete' | 'clear';
4989
4939
  interface StorageChange {
@@ -4991,15 +4941,16 @@ interface StorageChange {
4991
4941
  op: StorageChangeOp;
4992
4942
  /** Which one (see `StorageChangeKind`); absent for `clear` and for the kinds that carry none. */
4993
4943
  key?: string;
4994
- /** `files`: the file system's namespace; `skills`: the store's folder. */
4944
+ /** `files`: the file system's namespace; `skills`: the store's folder; `host`: which store. */
4995
4945
  namespace?: string;
4996
4946
  }
4997
4947
  declare const STORAGE_CHANGE_KINDS: readonly StorageChangeKind[];
4998
4948
  /**
4999
4949
  * Tell the other tabs that a store in database `dbName` changed - for a store of your own on
5000
- * IndexedDB (the built-in ones post their own). Call it AFTER the write committed. Never put a
5001
- * value in it: a notice says which, not what. A no-op without `dbName` or BroadcastChannel; a
5002
- * notice of the wrong shape is dropped.
4950
+ * IndexedDB (the built-in ones post their own): one of the built-in kinds when it keeps that kind
4951
+ * of thing, `host` for anything else (`namespace` names which of your stores, `key` which record).
4952
+ * Call it AFTER the write committed. Never put a value in it: a notice says which, not what. A
4953
+ * no-op without `dbName` or BroadcastChannel; a notice of the wrong shape is dropped.
5003
4954
  */
5004
4955
  declare const postStorageChange: (dbName: string | undefined, change: StorageChange) => void;
5005
4956
  /**
@@ -5010,5 +4961,5 @@ declare const postStorageChange: (dbName: string | undefined, change: StorageCha
5010
4961
  */
5011
4962
  declare const onStorageChange: (dbName: string | undefined, listener: (change: StorageChange) => void) => (() => void);
5012
4963
 
5013
- export { APP_SAMPLING_MAX_IMAGES, APP_SAMPLING_MAX_IMAGE_BYTES, APP_SAMPLING_MAX_INPUT_CHARS, APP_SAMPLING_MAX_MESSAGES, APP_SAMPLING_MAX_SYSTEM_CHARS, APP_SAMPLING_MAX_TOKENS, APP_SAMPLING_PER_APP, APP_SAMPLING_PER_MINUTE, APP_SAMPLING_REASONING_TOKENS, APP_SAMPLING_RPC_CODES, ASK_USER_DESCRIPTION_MAX_CHARS, ASK_USER_LABEL_MAX_CHARS, ASK_USER_MAX_OPTIONS, ASK_USER_MAX_PER_RUN, ASK_USER_MIN_OPTIONS, ASK_USER_OTHER_MAX_CHARS, ASK_USER_QUESTION_MAX_CHARS, ASK_USER_TIMEOUT_MAX_MS, ASK_USER_TIMEOUT_MS, ASK_USER_TOOL, AgentTool, AgentToolSet, AppSamplingError, AskUserInputError, AttachmentsNotSupportedError, ContextWindowExceededError, DECISION_PROVIDERS, DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, EgressError, FILES_STORE, FIND_TOOLS_NAME, FORGET_SKILL_TOOL, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, ImagesNotSupportedError, IndexedDBRunStore, IndexedDBStore, KEYS_STORE, MEDIA_AUDIO_TYPES, MEDIA_DEFAULT_MAX_CALLS, MEDIA_FOLDER, MEDIA_IMAGE_TYPES, MEDIA_MAX_ATTACHED_AUDIO, MEDIA_MAX_AUDIO_INPUT_BYTES, MEDIA_MAX_IMAGE_BYTES, MEDIA_MAX_PROMPT_CHARS, MEDIA_MAX_SPEECH_BYTES, MEDIA_MAX_SPEECH_CHARS, MEDIA_MAX_TRANSCRIPT_CHARS, MEDIA_TIMEOUT_MS, MODEL_TIERS, McpAppToolResult, McpElicitationReason, McpElicitationSchema, McpSkillConsent, McpSkillConsentView, MediaBudgetError, MediaError, MemoryCredentialStore, MemoryRunStore, MemorySkillStore, MemoryStore, NO_ATTACHMENT_NOTE, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, PlanSchema, PlanStepSchema, RELAY_MAX_REPLAYS_PER_SECOND, RELAY_MAX_SENDS, RELAY_MAX_SEND_CHARS, RELAY_MAX_STRING, REPLAY_NOTE, RUNS_STORE, ReplanSchema, SAVE_SKILL_TOOL, SEARCH_API_BASE_URL, SEARCH_DEFAULT_MAX_RESULTS, SEARCH_GOOGLE_DEFAULT_MODEL, SEARCH_GOOGLE_NOTE, SEARCH_MAX_QUERY_CHARS, SEARCH_MAX_RESULTS, SEARCH_MAX_SNIPPET_CHARS, SEARCH_MAX_SUMMARY_CHARS, SEARCH_MAX_TITLE_CHARS, SEARCH_MAX_TOTAL_CHARS, SEARCH_MAX_URL_CHARS, SEARCH_PROVIDERS, SECRETS_STORE, SESSIONS_STORE, SESSION_LOCK_MODES, SKILL_TOOL_NAMES, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, STORAGE_CHANGE_KINDS, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SessionBusyError, SubagentSpawnError, TOOL_APPROVAL_MODES, TOOL_APPROVAL_TIMEOUT_MS, TOOL_SEARCH_WINDOW_SHARE, TRANSCRIBE_AUDIO_TOOL, TieredPlanSchema, TieredPlanStepSchema, ToolBudgetError, ToolDeniedError, VaultCredentialStore, VaultOptions, VfsSkillStore, VirtualFileSystem, WEBLLM_DEFAULT_CONTEXT_WINDOW, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, adoptSubagentEvent, appSamplingRequestOf, appSamplingText, askDecisionModel, attachmentKind, buildMediaModelFromSpec, buildModelFromStage, buildSearchRequest, bytesToBase64, checkAskUserAnswer, checkAskUserInput, checkEgressUrl, checkLimits, classifyAddress, cleanAskUserText, compactHistory, compactSteps, compressHistory, contextOverflowOf, contextWindowOf, createAgent, createAppSamplingLimiter, createEgressTools, createFileTools, createFindToolsTool, createGuardedFetch, createLearning, createLogger, createMedia, createPipeline, createPlan, createRunControl, createSearchTools, createSkillTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebLLMModel, createWebSearchTool, decideReplan, decideToolPermission, decisionEgressPolicy, decisionModelFromAiSdk, decryptJSON, defaultPrompts, defineSkill, defineTool, directBrowserOk, dispatch, encryptJSON, escalationReasonOf, messageTokens as estimateMessagesTokens, estimateTokens, executeStep, fileToolBindingOf, findSecret, fitCompactionToWindow, generate, generateStructured, getOrCreateVaultKey, hostMatches, htmlToText, isAttachmentRefusal, isCodeExecutionTool, isDirectModel, isEscalatableError, isImageRefusal, isProviderSpec, isReadOnlyTool, isReplayedToolOutput, isTextMime, isWebGPUAvailable, learnedPreamble, limitModelOutput, loadSkillFromUrl, looksLikeJson, markCodeExecution, markReadOnly, matchRule, mediaTypeOf, mediaUsageOf, mergeProviderOptions, mimeFromPath, nextStrongerTier, nodeResolver, normalizePath, normalizeSkillName, normalizeSteps, normalizeUsage, onStorageChange, openAgentWebDB, outputCapNotice, parseExecutorResponse, parsePlainText, parsePlannerResponse, parseReplannerResponse, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, pickTier, postStorageChange, preloadWebLLMModel, renderActiveSkills, renderCatalog, renderSearchCatalog, renderSkillIndex, replanWanted, resolveAppSampling, resolveBudgets, resolveCaching, resolveCompaction, resolveConfig, resolveDecisionModel, resolveDynamicSubagents, resolveEgressPolicy, resolveEscalation, resolveModel, resolveResume, resolveStage, resolveThinking, runToolLoop, sanitizeSearchResults, schemaHintOf, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, selectToolMode, serveSubagentWorker, shouldReplan, skillPreamble, sniffMediaType, splitBlocker, stageOutputCap, stageReasons, stream, supportsImages, supportsNativeTools, supportsPdf, supportsStructuredOutput, synthesizeAnswer, thinkingFor, toFilePart, toImagePart, tokenize, toolCatalogOf, toolDefinitionTokens, toolRunContextOf, unloadWebLLMModel, watchSession, webLLMContextWindow, withRollingBreakpoint, withSystem, withWebLLMContextWindow, wrapTranscript };
5014
- export type { Agent, AgentContext, AgentEvent, AgentEventHandler, AgentLogger, AgentLoggerSink, AgentWebDBOptions, AppSamplingErrorCode, AppSamplingImage, AppSamplingMessage, AppSamplingOptions, AppSamplingRequest, AppSamplingResult, AppSamplingSettings, AppSamplingView, AppToolCallRequest, AskUserAction, AskUserAnswer, AskUserCheckedAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserQuestion, AskUserReason, AskUserRequest, AttachmentKind, BrowserAgentConfig, ClearedInfo, CompactOptions, CompactResult, CompactionConfig, CompressOptions, ContextStore, CredentialStore, DecisionFallbackReason, DecisionPoint, EffectiveToolStrategy, EgressErrorCode, EncryptedBlob, EscalationConfig, EscalationReason, ExecutorPromptContext, ExecutorResult, FileToolBinding, FileToolsOptions, GenerateOptions, GuardedFetch, IAiSdkDecisionOptions, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionModelSpec, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaOptions, IMediaRun, IMediaUsage, IPlan, IPlanStep, IResolvedDynamicSubagents, IResolvedEgressPolicy, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchUsage, IStepEscalation, IStepResult, ISubagentsConfig, IToolCall, ITranscription, IUsage, IWebFetchOptions, IWebSearchOptions, IndexedDBRunStoreOptions, IndexedDBStoreOptions, Learning, LearningConfig, LimitBreach, LimitKind, LoadSkillOptions, LogLevel, McpSkillOrigin, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, MessageEndpoint, ModelInput, ModelTier, NodeResolverOptions, OutputCap, ParentToWorker, Phase, PhaseBudgets, Pipeline, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PlanShape, PlannerPromptContext, PlannerResult, PromptCachingSetting, PromptParts, Prompts, ProviderModelSpec, ProviderOptionsMap, ProviderType, ProxiedToolSpec, RawAction, ReplanDecision, ReplanMode, ReplanShape, ReplanTrigger, ReplannerPromptContext, ReplannerResult, ResolvedCaching, ResolvedCompaction, ResolvedConfig, ResolvedStage, ResolvedThinking, RunControl, RunFile, RunImage, RunOptions, RunPersistence, RunResult, RunSnapshot, RunStatus, RunStoreOptions, SandboxConfig, SandboxWorkerLike, SaveSkillInput, SearchEngine, SearchFreshness, SearchProvider, SearchToolsOptions, ServeSubagentOptions, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillOrigin, SkillStore, StageInput, StageOverride, StepComplexity, StorageChange, StorageChangeKind, StorageChangeOp, StoredMessage, StructuredResult, SubagentDefaultTools, SubagentInfo, SubagentProfile, SubagentToolOptions, SubagentWorkerConfig, SynthesizerPromptContext, ThinkingConfig, ThinkingLevel, ThinkingSetting, ThinkingStage, TierReason, TokenLimits, ToolApprovalApp, ToolApprovalConfig, ToolApprovalContext, ToolApprovalDecision, ToolApprovalMode, ToolApprovalRequest, ToolCallMode, ToolCatalogEntry, ToolLoopCallbacks, ToolLoopOptions, ToolLoopResult, ToolMode, ToolPermission, ToolResultClearing, ToolRunContext, ToolSelectionStrategy, UsagePhase, VfsListener, VirtualFile, VirtualFileInfo, VirtualFileSystemOptions, WatchSessionOptions, WebLLMAppConfigLike, WebLLMModelOptions, WorkerLike, WorkerToParent };
4964
+ export { APP_SAMPLING_MAX_IMAGES, APP_SAMPLING_MAX_IMAGE_BYTES, APP_SAMPLING_MAX_INPUT_CHARS, APP_SAMPLING_MAX_MESSAGES, APP_SAMPLING_MAX_SYSTEM_CHARS, APP_SAMPLING_MAX_TOKENS, APP_SAMPLING_PER_APP, APP_SAMPLING_PER_MINUTE, APP_SAMPLING_REASONING_TOKENS, APP_SAMPLING_RPC_CODES, ASK_USER_DESCRIPTION_MAX_CHARS, ASK_USER_LABEL_MAX_CHARS, ASK_USER_MAX_OPTIONS, ASK_USER_MAX_PER_RUN, ASK_USER_MIN_OPTIONS, ASK_USER_OTHER_MAX_CHARS, ASK_USER_QUESTION_MAX_CHARS, ASK_USER_TIMEOUT_MAX_MS, ASK_USER_TIMEOUT_MS, ASK_USER_TOOL, AgentTool, AgentToolSet, AppSamplingError, AskUserInputError, AttachmentsNotSupportedError, ContextWindowExceededError, CredentialStore, DECISION_PROVIDERS, DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, EgressError, FILES_STORE, FIND_TOOLS_NAME, FORGET_SKILL_TOOL, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, ImagesNotSupportedError, IndexedDBRunStore, IndexedDBStore, KEYS_STORE, MEDIA_AUDIO_TYPES, MEDIA_DEFAULT_MAX_CALLS, MEDIA_FOLDER, MEDIA_IMAGE_TYPES, MEDIA_MAX_ATTACHED_AUDIO, MEDIA_MAX_AUDIO_INPUT_BYTES, MEDIA_MAX_IMAGE_BYTES, MEDIA_MAX_PROMPT_CHARS, MEDIA_MAX_SPEECH_BYTES, MEDIA_MAX_SPEECH_CHARS, MEDIA_MAX_TRANSCRIPT_CHARS, MEDIA_TIMEOUT_MS, MODEL_TIERS, McpAppToolResult, McpElicitationReason, McpElicitationSchema, McpSkillConsent, McpSkillConsentView, MediaBudgetError, MediaError, MemoryRunStore, MemorySkillStore, MemoryStore, NO_ATTACHMENT_NOTE, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, PlanSchema, PlanStepSchema, RELAY_MAX_REPLAYS_PER_SECOND, RELAY_MAX_SENDS, RELAY_MAX_SEND_CHARS, RELAY_MAX_STRING, REPLAY_NOTE, RUNS_STORE, ReplanSchema, SAVE_SKILL_TOOL, SEARCH_API_BASE_URL, SEARCH_DEFAULT_MAX_RESULTS, SEARCH_GOOGLE_DEFAULT_MODEL, SEARCH_GOOGLE_NOTE, SEARCH_MAX_QUERY_CHARS, SEARCH_MAX_RESULTS, SEARCH_MAX_SNIPPET_CHARS, SEARCH_MAX_SUMMARY_CHARS, SEARCH_MAX_TITLE_CHARS, SEARCH_MAX_TOTAL_CHARS, SEARCH_MAX_URL_CHARS, SEARCH_PROVIDERS, SECRETS_STORE, SESSIONS_STORE, SESSION_LOCK_MODES, SKILL_TOOL_NAMES, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, STORAGE_CHANGE_KINDS, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SessionBusyError, SubagentSpawnError, TOOL_APPROVAL_MODES, TOOL_APPROVAL_TIMEOUT_MS, TOOL_SEARCH_WINDOW_SHARE, TRANSCRIBE_AUDIO_TOOL, TieredPlanSchema, TieredPlanStepSchema, ToolBudgetError, ToolDeniedError, VfsSkillStore, VirtualFileSystem, WEBLLM_DEFAULT_CONTEXT_WINDOW, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, adoptSubagentEvent, appSamplingRequestOf, appSamplingText, askDecisionModel, attachmentKind, buildMediaModelFromSpec, buildModelFromStage, buildSearchRequest, bytesToBase64, checkAskUserAnswer, checkAskUserInput, checkEgressUrl, checkLimits, classifyAddress, cleanAskUserText, compactHistory, compactSteps, compressHistory, contextOverflowOf, contextWindowOf, createAgent, createAppSamplingLimiter, createEgressTools, createFileTools, createFindToolsTool, createGuardedFetch, createLearning, createLogger, createMedia, createPipeline, createPlan, createRunControl, createSearchTools, createSkillTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebLLMModel, createWebSearchTool, decideReplan, decideToolPermission, decisionEgressPolicy, decisionModelFromAiSdk, defaultPrompts, defineSkill, defineTool, directBrowserOk, dispatch, escalationReasonOf, messageTokens as estimateMessagesTokens, estimateTokens, executeStep, fileToolBindingOf, findSecret, fitCompactionToWindow, generate, generateStructured, hostMatches, htmlToText, isAttachmentRefusal, isCodeExecutionTool, isDirectModel, isEscalatableError, isImageRefusal, isProviderSpec, isReadOnlyTool, isReplayedToolOutput, isTextMime, isWebGPUAvailable, learnedPreamble, limitModelOutput, loadSkillFromUrl, looksLikeJson, markCodeExecution, markReadOnly, matchRule, mediaTypeOf, mediaUsageOf, mergeProviderOptions, mimeFromPath, nextStrongerTier, nodeResolver, normalizePath, normalizeSkillName, normalizeSteps, normalizeUsage, onStorageChange, openAgentWebDB, outputCapNotice, parseExecutorResponse, parsePlainText, parsePlannerResponse, parseReplannerResponse, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, pickTier, postStorageChange, preloadWebLLMModel, renderActiveSkills, renderCatalog, renderSearchCatalog, renderSkillIndex, replanWanted, resolveAppSampling, resolveBudgets, resolveCaching, resolveCompaction, resolveConfig, resolveDecisionModel, resolveDynamicSubagents, resolveEgressPolicy, resolveEscalation, resolveModel, resolveResume, resolveStage, resolveThinking, runToolLoop, sanitizeSearchResults, schemaHintOf, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, selectToolMode, serveSubagentWorker, shouldReplan, skillPreamble, sniffMediaType, splitBlocker, stageOutputCap, stageReasons, stream, supportsImages, supportsNativeTools, supportsPdf, supportsStructuredOutput, synthesizeAnswer, thinkingFor, toFilePart, toImagePart, tokenize, toolCatalogOf, toolDefinitionTokens, toolRunContextOf, unloadWebLLMModel, watchSession, webLLMContextWindow, withRollingBreakpoint, withSystem, withWebLLMContextWindow, wrapTranscript };
4965
+ export type { Agent, AgentContext, AgentEvent, AgentEventHandler, AgentLogger, AgentLoggerSink, AgentWebDBOptions, AppSamplingErrorCode, AppSamplingImage, AppSamplingMessage, AppSamplingOptions, AppSamplingRequest, AppSamplingResult, AppSamplingSettings, AppSamplingView, AppToolCallRequest, AskUserAction, AskUserAnswer, AskUserCheckedAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserQuestion, AskUserReason, AskUserRequest, AttachmentKind, BrowserAgentConfig, ClearedInfo, CompactOptions, CompactResult, CompactionConfig, CompressOptions, ContextStore, DecisionFallbackReason, DecisionPoint, EffectiveToolStrategy, EgressErrorCode, EscalationConfig, EscalationReason, ExecutorPromptContext, ExecutorResult, FileToolBinding, FileToolsOptions, GenerateOptions, GuardedFetch, IAiSdkDecisionOptions, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionModelSpec, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaOptions, IMediaRun, IMediaUsage, IPlan, IPlanStep, IResolvedDynamicSubagents, IResolvedEgressPolicy, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchUsage, IStepEscalation, IStepResult, ISubagentsConfig, IToolCall, ITranscription, IUsage, IWebFetchOptions, IWebSearchOptions, IndexedDBRunStoreOptions, IndexedDBStoreOptions, Learning, LearningConfig, LimitBreach, LimitKind, LoadSkillOptions, LogLevel, McpSkillOrigin, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, MessageEndpoint, ModelInput, ModelTier, NodeResolverOptions, OutputCap, ParentToWorker, Phase, PhaseBudgets, Pipeline, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PlanShape, PlannerPromptContext, PlannerResult, PromptCachingSetting, PromptParts, Prompts, ProviderModelSpec, ProviderOptionsMap, ProviderType, ProxiedToolSpec, RawAction, ReplanDecision, ReplanMode, ReplanShape, ReplanTrigger, ReplannerPromptContext, ReplannerResult, ResolvedCaching, ResolvedCompaction, ResolvedConfig, ResolvedStage, ResolvedThinking, RunControl, RunFile, RunImage, RunOptions, RunPersistence, RunResult, RunSnapshot, RunStatus, RunStoreOptions, SandboxConfig, SandboxWorkerLike, SaveSkillInput, SearchEngine, SearchFreshness, SearchProvider, SearchToolsOptions, ServeSubagentOptions, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillOrigin, SkillStore, StageInput, StageOverride, StepComplexity, StorageChange, StorageChangeKind, StorageChangeOp, StoredMessage, StructuredResult, SubagentDefaultTools, SubagentInfo, SubagentProfile, SubagentToolOptions, SubagentWorkerConfig, SynthesizerPromptContext, ThinkingConfig, ThinkingLevel, ThinkingSetting, ThinkingStage, TierReason, TokenLimits, ToolApprovalApp, ToolApprovalConfig, ToolApprovalContext, ToolApprovalDecision, ToolApprovalMode, ToolApprovalRequest, ToolCallMode, ToolCatalogEntry, ToolLoopCallbacks, ToolLoopOptions, ToolLoopResult, ToolMode, ToolPermission, ToolResultClearing, ToolRunContext, ToolSelectionStrategy, UsagePhase, VfsListener, VirtualFile, VirtualFileInfo, VirtualFileSystemOptions, WatchSessionOptions, WebLLMAppConfigLike, WebLLMModelOptions, WorkerLike, WorkerToParent };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import { LanguageModel, Experimental_DecisionModel, Tool, ToolSet, FilePart, ImageModel, SpeechModel, TranscriptionModel, SystemModelMessage, ModelMessage, generateText, streamText } from 'ai';
2
- import { M as McpSkillConsentView, a as McpElicitationSchema, b as McpElicitationReason, c as McpAppToolResult, V as VaultOptions, d as McpSkillSource, e as McpSkillConsent, f as McpSkillGrants, g as McpSkillRunConsent, h as McpSkillSnapshotMemory } from './vault-Mar2CY0J.js';
3
- export { I as IndexedDBVault, i as MCP_APPS_EXTENSION, j as MCP_APP_MAX_HTML_CHARS, k as MCP_APP_MAX_RESULT_CHARS, l as MCP_APP_MIME_TYPE, m as MCP_SKILLS_EXTENSION, n as MCP_SKILLS_MAX_PER_SERVER, o as MCP_SKILLS_MAX_TOTAL, p as MCP_SKILL_BODY_MAX_CHARS, q as MCP_SKILL_CONSENTS, r as MCP_SKILL_CONSENT_DEFAULT, s as MCP_SKILL_DESCRIPTION_MAX_CHARS, t as MCP_SKILL_DIRECTORY_ENTRIES_MAX, u as MCP_SKILL_FILE_MAX_CHARS, v as MCP_SKILL_MAX_RESOURCES, w as MCP_SKILL_MAX_TOTAL_BYTES, x as MCP_SKILL_SNAPSHOTS_MAX_BYTES, y as MCP_SKILL_SNAPSHOT_MAX_DEPTH, z as MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES, A as MCP_SKILL_URI_MAX_CHARS, B as McpAppCsp, C as McpAppPermissions, D as McpAppResource, E as McpAppVisibility, F as McpElicitationFieldSchema, G as McpSkillsOptions, H as McpSkillsSetting, S as SkillDirectoryListing, J as mcpAppOrigin, K as mcpSkillEntryRefusal, L as mcpSkillPreamble, N as mcpSkillUriRefusal } from './vault-Mar2CY0J.js';
2
+ import { P as McpSkillConsentView, B as McpElicitationSchema, y as McpElicitationReason, e as McpAppToolResult, Q as McpSkillSource, R as McpSkillConsent, S as McpSkillGrants, T as McpSkillRunConsent, U as McpSkillSnapshotMemory } from './skills-ufoyTJ-B.js';
3
+ export { g as MCP_APPS_EXTENSION, k as MCP_APP_MAX_HTML_CHARS, l as MCP_APP_MAX_RESULT_CHARS, m as MCP_APP_MIME_TYPE, V as MCP_SKILLS_EXTENSION, W as MCP_SKILLS_MAX_PER_SERVER, X as MCP_SKILLS_MAX_TOTAL, Y as MCP_SKILL_BODY_MAX_CHARS, Z as MCP_SKILL_CONSENTS, _ as MCP_SKILL_CONSENT_DEFAULT, $ as MCP_SKILL_DESCRIPTION_MAX_CHARS, a0 as MCP_SKILL_DIRECTORY_ENTRIES_MAX, a1 as MCP_SKILL_FILE_MAX_CHARS, a2 as MCP_SKILL_MAX_RESOURCES, a3 as MCP_SKILL_MAX_TOTAL_BYTES, a4 as MCP_SKILL_SNAPSHOTS_MAX_BYTES, a5 as MCP_SKILL_SNAPSHOT_MAX_DEPTH, a6 as MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES, a7 as MCP_SKILL_URI_MAX_CHARS, q as McpAppCsp, r as McpAppPermissions, b as McpAppResource, c as McpAppVisibility, x as McpElicitationFieldSchema, a8 as McpSkillsOptions, f as McpSkillsSetting, a9 as SkillDirectoryListing, G as mcpAppOrigin, aa as mcpSkillEntryRefusal, ab as mcpSkillPreamble, ac as mcpSkillUriRefusal } from './skills-ufoyTJ-B.js';
4
4
  import { PipelineEvent, PipelineNode, PipelineDefinition, PipelineResult, PipelineNodeRunner } from './pipeline-engine.js';
5
5
  export { PIPELINE_LIMITS, PIPELINE_ROUTER_SYSTEM, PipelineAbortBehaviour, PipelineCondition, PipelineEdge, PipelineGraphRunOptions, PipelineIssue, PipelineNodeContext, PipelineNodeError, PipelineNodeEvent, PipelineNodeInput, PipelineNodeOutput, PipelineNodeSource, PipelinePlan, PipelineRoute, PipelineStop, PipelineTraceEntry, PipelineUsage, PipelineValidation, PipelineValidationError, matchPipelineRoute, normalizePipeline, preparePipeline, renderPipelineNodeInput, renderPipelineRoutePrompt, runPipelineGraph, testPipelineCondition, validatePipeline } from './pipeline-engine.js';
6
+ import { CredentialStore } from './secrets.js';
7
+ export { EncryptedBlob, MemoryCredentialStore, VaultCredentialStore, decryptJSON, encryptJSON, getOrCreateVaultKey } from './secrets.js';
6
8
  import { A as AgentToolSet, a as AgentTool } from './types-DwSMj_Xs.js';
7
9
  export { p as promptHintOf } from './types-DwSMj_Xs.js';
8
10
  import { z, ZodType } from 'zod';
11
+ export { I as IndexedDBVault, V as VaultOptions } from './vault-BBGybouF.js';
9
12
  import { IDBPDatabase } from 'idb';
10
13
 
11
14
  /** Executor models by strength (`config.executorTiers`), weakest first. */
@@ -1688,40 +1691,6 @@ declare const defaultPrompts: Prompts;
1688
1691
  /** Prepend a host-supplied systemPrompt to a phase system prompt, if present. */
1689
1692
  declare const withSystem: (base: string, extra?: string) => string;
1690
1693
 
1691
- /**
1692
- * The seam the provider registry uses to fetch API keys at model-build time.
1693
- * Swap in any backend: the encrypted vault (default), an in-memory map (tests /
1694
- * SSR), or a `fetch` to your own short-lived-token endpoint.
1695
- */
1696
- interface CredentialStore {
1697
- getApiKey(ref: string): Promise<string | undefined>;
1698
- setApiKey(ref: string, key: string): Promise<void>;
1699
- deleteApiKey(ref: string): Promise<void>;
1700
- }
1701
- /**
1702
- * Default CredentialStore: encrypted, IndexedDB-backed (see IndexedDBVault). Every tab of the
1703
- * origin shares it: a key stored or removed tells the other tabs that SOMETHING changed (a
1704
- * `credentials` notice: no ref, never a key - see `onStorageChange`).
1705
- */
1706
- declare class VaultCredentialStore implements CredentialStore {
1707
- /** The database the vault lives in, and the name its change notices go out under. */
1708
- readonly dbName: string;
1709
- private readonly vault;
1710
- private readonly tab;
1711
- constructor(opts?: VaultOptions);
1712
- getApiKey(ref: string): Promise<string | undefined>;
1713
- setApiKey(ref: string, key: string): Promise<void>;
1714
- deleteApiKey(ref: string): Promise<void>;
1715
- }
1716
- /** Non-persistent CredentialStore for tests / SSR / ephemeral sessions. */
1717
- declare class MemoryCredentialStore implements CredentialStore {
1718
- private readonly map;
1719
- constructor(initial?: Record<string, string>);
1720
- getApiKey(ref: string): Promise<string | undefined>;
1721
- setApiKey(ref: string, key: string): Promise<void>;
1722
- deleteApiKey(ref: string): Promise<void>;
1723
- }
1724
-
1725
1694
  /**
1726
1695
  * A small virtual file system for the browser — the agent's (and the user's)
1727
1696
  * workspace: attachments the user drops in, reports the agent writes, images
@@ -2662,14 +2631,6 @@ declare const decisionEgressPolicy: (spec: IDecisionModelSpec) => IEgressPolicy;
2662
2631
  */
2663
2632
  declare const resolveDecisionModel: (input: IDecisionModel | IDecisionModelSpec | undefined, credentials?: CredentialStore) => Promise<IDecisionModel | undefined>;
2664
2633
 
2665
- /**
2666
- * `config.askUser`: the `ask_user` tool, with which the MODEL asks the person one closed question
2667
- * with 2-6 options (the rules and the bounds are `ask-user-shared.ts`, the same file as the Node
2668
- * package's). This file is the browser's wiring: the tool reads its run through `agentRun`
2669
- * (`ToolRunContext.askUser`), a helper the model started asks through its caller's channel
2670
- * (`SpawnSeed.askUser`), and a subagent the HOST defined (`createSubagentTool`, in-process) asks
2671
- * through the run that called it (`routeAskUser`).
2672
- */
2673
2634
  /** What `onQuestion` is given: the model's question and options, cleaned (see the shared file). */
2674
2635
  type AskUserRequest = AskUserRequest$1<IPlanStep>;
2675
2636
  /**
@@ -4441,29 +4402,6 @@ declare const supportsImages: (model: unknown) => boolean | undefined;
4441
4402
  */
4442
4403
  declare const supportsPdf: (model: unknown) => boolean | undefined;
4443
4404
 
4444
- /**
4445
- * Fetch (or lazily create) the vault's AES-GCM key. The key is generated
4446
- * NON-EXTRACTABLE and stored as a live `CryptoKey` in IndexedDB — a CryptoKey
4447
- * is structured-cloneable, so it persists across reloads WITHOUT its raw bytes
4448
- * ever being exposed to JavaScript. Not even in-page script can read it out; it
4449
- * can only be used to encrypt / decrypt. That is what makes at-rest storage of
4450
- * the secrets meaningful (see IndexedDBVault's threat model).
4451
- *
4452
- * Concurrent callers share one in-flight promise per DB, and creation is
4453
- * double-checked in a single IDB transaction, so two racing writers can never
4454
- * end up encrypting under different keys.
4455
- */
4456
- declare const getOrCreateVaultKey: (dbName?: string) => Promise<CryptoKey>;
4457
- interface EncryptedBlob {
4458
- /** 96-bit random IV, fresh per write. */
4459
- iv: Uint8Array;
4460
- ciphertext: ArrayBuffer;
4461
- }
4462
- /** Encrypt a JSON-serialisable value with a fresh 96-bit IV (AES-GCM). */
4463
- declare const encryptJSON: (key: CryptoKey, value: unknown) => Promise<EncryptedBlob>;
4464
- /** Decrypt a blob produced by encryptJSON. Throws if the key or blob don't match. */
4465
- declare const decryptJSON: <T = unknown>(key: CryptoKey, blob: EncryptedBlob) => Promise<T>;
4466
-
4467
4405
  interface AgentWebDBOptions {
4468
4406
  /** Database name (default 'agent-web'). Use a distinct name to isolate apps. */
4469
4407
  dbName?: string;
@@ -4479,6 +4417,16 @@ declare const RUNS_STORE = "runs";
4479
4417
  * lives under ONE database name + version. Centralising `openDB` here prevents
4480
4418
  * the classic bug where two modules open the same DB name with different store
4481
4419
  * sets and the second call throws a VersionError.
4420
+ *
4421
+ * One connection per name, shared by every store of the page - and never in another tab's way:
4422
+ * when another connection asks to delete or upgrade the database (`versionchange`: another tab's
4423
+ * `indexedDB.deleteDatabase`, or a newer copy of this package), this one is closed at once, so
4424
+ * that request goes ahead instead of waiting (blocked) for this tab to close. The browser lets the
4425
+ * transactions already under way finish first. A connection the browser closed by itself (site
4426
+ * data cleared, storage gone) is let go too. Either way the next use opens the database again:
4427
+ * after a deletion that is a NEW, EMPTY database at this version (every store of this package
4428
+ * starts from nothing - no key, no secret, no session, no file); after an upgrade by a newer copy,
4429
+ * the open fails with a `VersionError` until the page is reloaded with that copy.
4482
4430
  */
4483
4431
  declare const openAgentWebDB: (opts?: AgentWebDBOptions) => Promise<IDBPDatabase>;
4484
4432
 
@@ -4982,8 +4930,10 @@ declare class IndexedDBRunStore implements RunPersistence {
4982
4930
  * - `skills` - `VfsSkillStore` (the agent's lessons): `key` = the lesson's name, `namespace` =
4983
4931
  * the store's folder.
4984
4932
  * - `chats` - the React package's `ChatHistoryStore`: `key` = the chat id.
4933
+ * - `host` - a store of the host's own that is none of the above (`postStorageChange`): `key` =
4934
+ * which record, `namespace` = which of the host's stores - names the host chose, never a value.
4985
4935
  */
4986
- type StorageChangeKind = 'credentials' | 'oauth' | 'files' | 'session' | 'runs' | 'skills' | 'chats';
4936
+ type StorageChangeKind = 'credentials' | 'oauth' | 'files' | 'session' | 'runs' | 'skills' | 'chats' | 'host';
4987
4937
  /** `put` = written (created or replaced), `delete` = one removed, `clear` = all of them removed. */
4988
4938
  type StorageChangeOp = 'put' | 'delete' | 'clear';
4989
4939
  interface StorageChange {
@@ -4991,15 +4941,16 @@ interface StorageChange {
4991
4941
  op: StorageChangeOp;
4992
4942
  /** Which one (see `StorageChangeKind`); absent for `clear` and for the kinds that carry none. */
4993
4943
  key?: string;
4994
- /** `files`: the file system's namespace; `skills`: the store's folder. */
4944
+ /** `files`: the file system's namespace; `skills`: the store's folder; `host`: which store. */
4995
4945
  namespace?: string;
4996
4946
  }
4997
4947
  declare const STORAGE_CHANGE_KINDS: readonly StorageChangeKind[];
4998
4948
  /**
4999
4949
  * Tell the other tabs that a store in database `dbName` changed - for a store of your own on
5000
- * IndexedDB (the built-in ones post their own). Call it AFTER the write committed. Never put a
5001
- * value in it: a notice says which, not what. A no-op without `dbName` or BroadcastChannel; a
5002
- * notice of the wrong shape is dropped.
4950
+ * IndexedDB (the built-in ones post their own): one of the built-in kinds when it keeps that kind
4951
+ * of thing, `host` for anything else (`namespace` names which of your stores, `key` which record).
4952
+ * Call it AFTER the write committed. Never put a value in it: a notice says which, not what. A
4953
+ * no-op without `dbName` or BroadcastChannel; a notice of the wrong shape is dropped.
5003
4954
  */
5004
4955
  declare const postStorageChange: (dbName: string | undefined, change: StorageChange) => void;
5005
4956
  /**
@@ -5010,5 +4961,5 @@ declare const postStorageChange: (dbName: string | undefined, change: StorageCha
5010
4961
  */
5011
4962
  declare const onStorageChange: (dbName: string | undefined, listener: (change: StorageChange) => void) => (() => void);
5012
4963
 
5013
- export { APP_SAMPLING_MAX_IMAGES, APP_SAMPLING_MAX_IMAGE_BYTES, APP_SAMPLING_MAX_INPUT_CHARS, APP_SAMPLING_MAX_MESSAGES, APP_SAMPLING_MAX_SYSTEM_CHARS, APP_SAMPLING_MAX_TOKENS, APP_SAMPLING_PER_APP, APP_SAMPLING_PER_MINUTE, APP_SAMPLING_REASONING_TOKENS, APP_SAMPLING_RPC_CODES, ASK_USER_DESCRIPTION_MAX_CHARS, ASK_USER_LABEL_MAX_CHARS, ASK_USER_MAX_OPTIONS, ASK_USER_MAX_PER_RUN, ASK_USER_MIN_OPTIONS, ASK_USER_OTHER_MAX_CHARS, ASK_USER_QUESTION_MAX_CHARS, ASK_USER_TIMEOUT_MAX_MS, ASK_USER_TIMEOUT_MS, ASK_USER_TOOL, AgentTool, AgentToolSet, AppSamplingError, AskUserInputError, AttachmentsNotSupportedError, ContextWindowExceededError, DECISION_PROVIDERS, DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, EgressError, FILES_STORE, FIND_TOOLS_NAME, FORGET_SKILL_TOOL, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, ImagesNotSupportedError, IndexedDBRunStore, IndexedDBStore, KEYS_STORE, MEDIA_AUDIO_TYPES, MEDIA_DEFAULT_MAX_CALLS, MEDIA_FOLDER, MEDIA_IMAGE_TYPES, MEDIA_MAX_ATTACHED_AUDIO, MEDIA_MAX_AUDIO_INPUT_BYTES, MEDIA_MAX_IMAGE_BYTES, MEDIA_MAX_PROMPT_CHARS, MEDIA_MAX_SPEECH_BYTES, MEDIA_MAX_SPEECH_CHARS, MEDIA_MAX_TRANSCRIPT_CHARS, MEDIA_TIMEOUT_MS, MODEL_TIERS, McpAppToolResult, McpElicitationReason, McpElicitationSchema, McpSkillConsent, McpSkillConsentView, MediaBudgetError, MediaError, MemoryCredentialStore, MemoryRunStore, MemorySkillStore, MemoryStore, NO_ATTACHMENT_NOTE, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, PlanSchema, PlanStepSchema, RELAY_MAX_REPLAYS_PER_SECOND, RELAY_MAX_SENDS, RELAY_MAX_SEND_CHARS, RELAY_MAX_STRING, REPLAY_NOTE, RUNS_STORE, ReplanSchema, SAVE_SKILL_TOOL, SEARCH_API_BASE_URL, SEARCH_DEFAULT_MAX_RESULTS, SEARCH_GOOGLE_DEFAULT_MODEL, SEARCH_GOOGLE_NOTE, SEARCH_MAX_QUERY_CHARS, SEARCH_MAX_RESULTS, SEARCH_MAX_SNIPPET_CHARS, SEARCH_MAX_SUMMARY_CHARS, SEARCH_MAX_TITLE_CHARS, SEARCH_MAX_TOTAL_CHARS, SEARCH_MAX_URL_CHARS, SEARCH_PROVIDERS, SECRETS_STORE, SESSIONS_STORE, SESSION_LOCK_MODES, SKILL_TOOL_NAMES, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, STORAGE_CHANGE_KINDS, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SessionBusyError, SubagentSpawnError, TOOL_APPROVAL_MODES, TOOL_APPROVAL_TIMEOUT_MS, TOOL_SEARCH_WINDOW_SHARE, TRANSCRIBE_AUDIO_TOOL, TieredPlanSchema, TieredPlanStepSchema, ToolBudgetError, ToolDeniedError, VaultCredentialStore, VaultOptions, VfsSkillStore, VirtualFileSystem, WEBLLM_DEFAULT_CONTEXT_WINDOW, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, adoptSubagentEvent, appSamplingRequestOf, appSamplingText, askDecisionModel, attachmentKind, buildMediaModelFromSpec, buildModelFromStage, buildSearchRequest, bytesToBase64, checkAskUserAnswer, checkAskUserInput, checkEgressUrl, checkLimits, classifyAddress, cleanAskUserText, compactHistory, compactSteps, compressHistory, contextOverflowOf, contextWindowOf, createAgent, createAppSamplingLimiter, createEgressTools, createFileTools, createFindToolsTool, createGuardedFetch, createLearning, createLogger, createMedia, createPipeline, createPlan, createRunControl, createSearchTools, createSkillTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebLLMModel, createWebSearchTool, decideReplan, decideToolPermission, decisionEgressPolicy, decisionModelFromAiSdk, decryptJSON, defaultPrompts, defineSkill, defineTool, directBrowserOk, dispatch, encryptJSON, escalationReasonOf, messageTokens as estimateMessagesTokens, estimateTokens, executeStep, fileToolBindingOf, findSecret, fitCompactionToWindow, generate, generateStructured, getOrCreateVaultKey, hostMatches, htmlToText, isAttachmentRefusal, isCodeExecutionTool, isDirectModel, isEscalatableError, isImageRefusal, isProviderSpec, isReadOnlyTool, isReplayedToolOutput, isTextMime, isWebGPUAvailable, learnedPreamble, limitModelOutput, loadSkillFromUrl, looksLikeJson, markCodeExecution, markReadOnly, matchRule, mediaTypeOf, mediaUsageOf, mergeProviderOptions, mimeFromPath, nextStrongerTier, nodeResolver, normalizePath, normalizeSkillName, normalizeSteps, normalizeUsage, onStorageChange, openAgentWebDB, outputCapNotice, parseExecutorResponse, parsePlainText, parsePlannerResponse, parseReplannerResponse, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, pickTier, postStorageChange, preloadWebLLMModel, renderActiveSkills, renderCatalog, renderSearchCatalog, renderSkillIndex, replanWanted, resolveAppSampling, resolveBudgets, resolveCaching, resolveCompaction, resolveConfig, resolveDecisionModel, resolveDynamicSubagents, resolveEgressPolicy, resolveEscalation, resolveModel, resolveResume, resolveStage, resolveThinking, runToolLoop, sanitizeSearchResults, schemaHintOf, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, selectToolMode, serveSubagentWorker, shouldReplan, skillPreamble, sniffMediaType, splitBlocker, stageOutputCap, stageReasons, stream, supportsImages, supportsNativeTools, supportsPdf, supportsStructuredOutput, synthesizeAnswer, thinkingFor, toFilePart, toImagePart, tokenize, toolCatalogOf, toolDefinitionTokens, toolRunContextOf, unloadWebLLMModel, watchSession, webLLMContextWindow, withRollingBreakpoint, withSystem, withWebLLMContextWindow, wrapTranscript };
5014
- export type { Agent, AgentContext, AgentEvent, AgentEventHandler, AgentLogger, AgentLoggerSink, AgentWebDBOptions, AppSamplingErrorCode, AppSamplingImage, AppSamplingMessage, AppSamplingOptions, AppSamplingRequest, AppSamplingResult, AppSamplingSettings, AppSamplingView, AppToolCallRequest, AskUserAction, AskUserAnswer, AskUserCheckedAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserQuestion, AskUserReason, AskUserRequest, AttachmentKind, BrowserAgentConfig, ClearedInfo, CompactOptions, CompactResult, CompactionConfig, CompressOptions, ContextStore, CredentialStore, DecisionFallbackReason, DecisionPoint, EffectiveToolStrategy, EgressErrorCode, EncryptedBlob, EscalationConfig, EscalationReason, ExecutorPromptContext, ExecutorResult, FileToolBinding, FileToolsOptions, GenerateOptions, GuardedFetch, IAiSdkDecisionOptions, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionModelSpec, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaOptions, IMediaRun, IMediaUsage, IPlan, IPlanStep, IResolvedDynamicSubagents, IResolvedEgressPolicy, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchUsage, IStepEscalation, IStepResult, ISubagentsConfig, IToolCall, ITranscription, IUsage, IWebFetchOptions, IWebSearchOptions, IndexedDBRunStoreOptions, IndexedDBStoreOptions, Learning, LearningConfig, LimitBreach, LimitKind, LoadSkillOptions, LogLevel, McpSkillOrigin, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, MessageEndpoint, ModelInput, ModelTier, NodeResolverOptions, OutputCap, ParentToWorker, Phase, PhaseBudgets, Pipeline, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PlanShape, PlannerPromptContext, PlannerResult, PromptCachingSetting, PromptParts, Prompts, ProviderModelSpec, ProviderOptionsMap, ProviderType, ProxiedToolSpec, RawAction, ReplanDecision, ReplanMode, ReplanShape, ReplanTrigger, ReplannerPromptContext, ReplannerResult, ResolvedCaching, ResolvedCompaction, ResolvedConfig, ResolvedStage, ResolvedThinking, RunControl, RunFile, RunImage, RunOptions, RunPersistence, RunResult, RunSnapshot, RunStatus, RunStoreOptions, SandboxConfig, SandboxWorkerLike, SaveSkillInput, SearchEngine, SearchFreshness, SearchProvider, SearchToolsOptions, ServeSubagentOptions, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillOrigin, SkillStore, StageInput, StageOverride, StepComplexity, StorageChange, StorageChangeKind, StorageChangeOp, StoredMessage, StructuredResult, SubagentDefaultTools, SubagentInfo, SubagentProfile, SubagentToolOptions, SubagentWorkerConfig, SynthesizerPromptContext, ThinkingConfig, ThinkingLevel, ThinkingSetting, ThinkingStage, TierReason, TokenLimits, ToolApprovalApp, ToolApprovalConfig, ToolApprovalContext, ToolApprovalDecision, ToolApprovalMode, ToolApprovalRequest, ToolCallMode, ToolCatalogEntry, ToolLoopCallbacks, ToolLoopOptions, ToolLoopResult, ToolMode, ToolPermission, ToolResultClearing, ToolRunContext, ToolSelectionStrategy, UsagePhase, VfsListener, VirtualFile, VirtualFileInfo, VirtualFileSystemOptions, WatchSessionOptions, WebLLMAppConfigLike, WebLLMModelOptions, WorkerLike, WorkerToParent };
4964
+ export { APP_SAMPLING_MAX_IMAGES, APP_SAMPLING_MAX_IMAGE_BYTES, APP_SAMPLING_MAX_INPUT_CHARS, APP_SAMPLING_MAX_MESSAGES, APP_SAMPLING_MAX_SYSTEM_CHARS, APP_SAMPLING_MAX_TOKENS, APP_SAMPLING_PER_APP, APP_SAMPLING_PER_MINUTE, APP_SAMPLING_REASONING_TOKENS, APP_SAMPLING_RPC_CODES, ASK_USER_DESCRIPTION_MAX_CHARS, ASK_USER_LABEL_MAX_CHARS, ASK_USER_MAX_OPTIONS, ASK_USER_MAX_PER_RUN, ASK_USER_MIN_OPTIONS, ASK_USER_OTHER_MAX_CHARS, ASK_USER_QUESTION_MAX_CHARS, ASK_USER_TIMEOUT_MAX_MS, ASK_USER_TIMEOUT_MS, ASK_USER_TOOL, AgentTool, AgentToolSet, AppSamplingError, AskUserInputError, AttachmentsNotSupportedError, ContextWindowExceededError, CredentialStore, DECISION_PROVIDERS, DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, EgressError, FILES_STORE, FIND_TOOLS_NAME, FORGET_SKILL_TOOL, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, ImagesNotSupportedError, IndexedDBRunStore, IndexedDBStore, KEYS_STORE, MEDIA_AUDIO_TYPES, MEDIA_DEFAULT_MAX_CALLS, MEDIA_FOLDER, MEDIA_IMAGE_TYPES, MEDIA_MAX_ATTACHED_AUDIO, MEDIA_MAX_AUDIO_INPUT_BYTES, MEDIA_MAX_IMAGE_BYTES, MEDIA_MAX_PROMPT_CHARS, MEDIA_MAX_SPEECH_BYTES, MEDIA_MAX_SPEECH_CHARS, MEDIA_MAX_TRANSCRIPT_CHARS, MEDIA_TIMEOUT_MS, MODEL_TIERS, McpAppToolResult, McpElicitationReason, McpElicitationSchema, McpSkillConsent, McpSkillConsentView, MediaBudgetError, MediaError, MemoryRunStore, MemorySkillStore, MemoryStore, NO_ATTACHMENT_NOTE, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, PlanSchema, PlanStepSchema, RELAY_MAX_REPLAYS_PER_SECOND, RELAY_MAX_SENDS, RELAY_MAX_SEND_CHARS, RELAY_MAX_STRING, REPLAY_NOTE, RUNS_STORE, ReplanSchema, SAVE_SKILL_TOOL, SEARCH_API_BASE_URL, SEARCH_DEFAULT_MAX_RESULTS, SEARCH_GOOGLE_DEFAULT_MODEL, SEARCH_GOOGLE_NOTE, SEARCH_MAX_QUERY_CHARS, SEARCH_MAX_RESULTS, SEARCH_MAX_SNIPPET_CHARS, SEARCH_MAX_SUMMARY_CHARS, SEARCH_MAX_TITLE_CHARS, SEARCH_MAX_TOTAL_CHARS, SEARCH_MAX_URL_CHARS, SEARCH_PROVIDERS, SECRETS_STORE, SESSIONS_STORE, SESSION_LOCK_MODES, SKILL_TOOL_NAMES, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, STORAGE_CHANGE_KINDS, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SessionBusyError, SubagentSpawnError, TOOL_APPROVAL_MODES, TOOL_APPROVAL_TIMEOUT_MS, TOOL_SEARCH_WINDOW_SHARE, TRANSCRIBE_AUDIO_TOOL, TieredPlanSchema, TieredPlanStepSchema, ToolBudgetError, ToolDeniedError, VfsSkillStore, VirtualFileSystem, WEBLLM_DEFAULT_CONTEXT_WINDOW, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, adoptSubagentEvent, appSamplingRequestOf, appSamplingText, askDecisionModel, attachmentKind, buildMediaModelFromSpec, buildModelFromStage, buildSearchRequest, bytesToBase64, checkAskUserAnswer, checkAskUserInput, checkEgressUrl, checkLimits, classifyAddress, cleanAskUserText, compactHistory, compactSteps, compressHistory, contextOverflowOf, contextWindowOf, createAgent, createAppSamplingLimiter, createEgressTools, createFileTools, createFindToolsTool, createGuardedFetch, createLearning, createLogger, createMedia, createPipeline, createPlan, createRunControl, createSearchTools, createSkillTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebLLMModel, createWebSearchTool, decideReplan, decideToolPermission, decisionEgressPolicy, decisionModelFromAiSdk, defaultPrompts, defineSkill, defineTool, directBrowserOk, dispatch, escalationReasonOf, messageTokens as estimateMessagesTokens, estimateTokens, executeStep, fileToolBindingOf, findSecret, fitCompactionToWindow, generate, generateStructured, hostMatches, htmlToText, isAttachmentRefusal, isCodeExecutionTool, isDirectModel, isEscalatableError, isImageRefusal, isProviderSpec, isReadOnlyTool, isReplayedToolOutput, isTextMime, isWebGPUAvailable, learnedPreamble, limitModelOutput, loadSkillFromUrl, looksLikeJson, markCodeExecution, markReadOnly, matchRule, mediaTypeOf, mediaUsageOf, mergeProviderOptions, mimeFromPath, nextStrongerTier, nodeResolver, normalizePath, normalizeSkillName, normalizeSteps, normalizeUsage, onStorageChange, openAgentWebDB, outputCapNotice, parseExecutorResponse, parsePlainText, parsePlannerResponse, parseReplannerResponse, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, pickTier, postStorageChange, preloadWebLLMModel, renderActiveSkills, renderCatalog, renderSearchCatalog, renderSkillIndex, replanWanted, resolveAppSampling, resolveBudgets, resolveCaching, resolveCompaction, resolveConfig, resolveDecisionModel, resolveDynamicSubagents, resolveEgressPolicy, resolveEscalation, resolveModel, resolveResume, resolveStage, resolveThinking, runToolLoop, sanitizeSearchResults, schemaHintOf, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, selectToolMode, serveSubagentWorker, shouldReplan, skillPreamble, sniffMediaType, splitBlocker, stageOutputCap, stageReasons, stream, supportsImages, supportsNativeTools, supportsPdf, supportsStructuredOutput, synthesizeAnswer, thinkingFor, toFilePart, toImagePart, tokenize, toolCatalogOf, toolDefinitionTokens, toolRunContextOf, unloadWebLLMModel, watchSession, webLLMContextWindow, withRollingBreakpoint, withSystem, withWebLLMContextWindow, wrapTranscript };
4965
+ export type { Agent, AgentContext, AgentEvent, AgentEventHandler, AgentLogger, AgentLoggerSink, AgentWebDBOptions, AppSamplingErrorCode, AppSamplingImage, AppSamplingMessage, AppSamplingOptions, AppSamplingRequest, AppSamplingResult, AppSamplingSettings, AppSamplingView, AppToolCallRequest, AskUserAction, AskUserAnswer, AskUserCheckedAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserQuestion, AskUserReason, AskUserRequest, AttachmentKind, BrowserAgentConfig, ClearedInfo, CompactOptions, CompactResult, CompactionConfig, CompressOptions, ContextStore, DecisionFallbackReason, DecisionPoint, EffectiveToolStrategy, EgressErrorCode, EscalationConfig, EscalationReason, ExecutorPromptContext, ExecutorResult, FileToolBinding, FileToolsOptions, GenerateOptions, GuardedFetch, IAiSdkDecisionOptions, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionModelSpec, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaOptions, IMediaRun, IMediaUsage, IPlan, IPlanStep, IResolvedDynamicSubagents, IResolvedEgressPolicy, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchUsage, IStepEscalation, IStepResult, ISubagentsConfig, IToolCall, ITranscription, IUsage, IWebFetchOptions, IWebSearchOptions, IndexedDBRunStoreOptions, IndexedDBStoreOptions, Learning, LearningConfig, LimitBreach, LimitKind, LoadSkillOptions, LogLevel, McpSkillOrigin, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, MessageEndpoint, ModelInput, ModelTier, NodeResolverOptions, OutputCap, ParentToWorker, Phase, PhaseBudgets, Pipeline, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PlanShape, PlannerPromptContext, PlannerResult, PromptCachingSetting, PromptParts, Prompts, ProviderModelSpec, ProviderOptionsMap, ProviderType, ProxiedToolSpec, RawAction, ReplanDecision, ReplanMode, ReplanShape, ReplanTrigger, ReplannerPromptContext, ReplannerResult, ResolvedCaching, ResolvedCompaction, ResolvedConfig, ResolvedStage, ResolvedThinking, RunControl, RunFile, RunImage, RunOptions, RunPersistence, RunResult, RunSnapshot, RunStatus, RunStoreOptions, SandboxConfig, SandboxWorkerLike, SaveSkillInput, SearchEngine, SearchFreshness, SearchProvider, SearchToolsOptions, ServeSubagentOptions, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillOrigin, SkillStore, StageInput, StageOverride, StepComplexity, StorageChange, StorageChangeKind, StorageChangeOp, StoredMessage, StructuredResult, SubagentDefaultTools, SubagentInfo, SubagentProfile, SubagentToolOptions, SubagentWorkerConfig, SynthesizerPromptContext, ThinkingConfig, ThinkingLevel, ThinkingSetting, ThinkingStage, TierReason, TokenLimits, ToolApprovalApp, ToolApprovalConfig, ToolApprovalContext, ToolApprovalDecision, ToolApprovalMode, ToolApprovalRequest, ToolCallMode, ToolCatalogEntry, ToolLoopCallbacks, ToolLoopOptions, ToolLoopResult, ToolMode, ToolPermission, ToolResultClearing, ToolRunContext, ToolSelectionStrategy, UsagePhase, VfsListener, VirtualFile, VirtualFileInfo, VirtualFileSystemOptions, WatchSessionOptions, WebLLMAppConfigLike, WebLLMModelOptions, WorkerLike, WorkerToParent };
package/dist/index.js CHANGED
@@ -1,17 +1,23 @@
1
1
  import {
2
- IndexedDBVault,
3
2
  MCP_APPS_EXTENSION,
4
3
  MCP_APP_MAX_HTML_CHARS,
5
4
  MCP_APP_MAX_RESULT_CHARS,
6
5
  MCP_APP_MIME_TYPE,
7
6
  collectMcpInstructions,
8
7
  createLogger,
9
- decryptJSON,
10
- encryptJSON,
11
- getOrCreateVaultKey,
12
8
  mcpAppOrigin,
13
9
  renderMcpInstructions
14
- } from "./chunk-Y4MIIBPB.js";
10
+ } from "./chunk-7D2CJQB2.js";
11
+ import {
12
+ MemoryCredentialStore,
13
+ VaultCredentialStore
14
+ } from "./chunk-7Y5UC6L7.js";
15
+ import {
16
+ IndexedDBVault,
17
+ decryptJSON,
18
+ encryptJSON,
19
+ getOrCreateVaultKey
20
+ } from "./chunk-IT77BVAD.js";
15
21
  import {
16
22
  AttachmentsNotSupportedError,
17
23
  ContextWindowExceededError,
@@ -95,10 +101,8 @@ import {
95
101
  toolRunContextOf,
96
102
  withDeadline,
97
103
  wrapToolsForRun
98
- } from "./chunk-PTJA7V23.js";
104
+ } from "./chunk-6XHCPSZE.js";
99
105
  import {
100
- FILES_STORE,
101
- KEYS_STORE,
102
106
  MCP_SKILLS_EXTENSION,
103
107
  MCP_SKILLS_MAX_PER_SERVER,
104
108
  MCP_SKILLS_MAX_TOTAL,
@@ -114,24 +118,13 @@ import {
114
118
  MCP_SKILL_SNAPSHOT_MAX_DEPTH,
115
119
  MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES,
116
120
  MCP_SKILL_URI_MAX_CHARS,
117
- RUNS_STORE,
118
- SECRETS_STORE,
119
- SESSIONS_STORE,
120
- STORAGE_CHANGE_KINDS,
121
- SYNC_ID_RE,
122
- SYNC_VERSION,
123
121
  assignAddedMcpSkillName,
124
122
  assignMcpSkillNames,
125
123
  collectMcpSkillSources,
126
124
  createMcpSkillRunConsent,
127
125
  createMcpSkillSnapshotMemory,
128
- currentTab,
129
126
  decideMcpSkillConsent,
130
- heldExclusively,
131
- hubOf,
132
127
  isMcpSkillName,
133
- isRecord,
134
- lockManager,
135
128
  mcpSkillBodyText,
136
129
  mcpSkillConsentOf,
137
130
  mcpSkillConsentView,
@@ -145,20 +138,35 @@ import {
145
138
  mcpSkillPreamble,
146
139
  mcpSkillRoomRefusal,
147
140
  mcpSkillUriRefusal,
148
- newSyncId,
149
- onStorageChange,
150
- openAgentWebDB,
151
- postStorageChange,
152
- postStorageChangeFrom,
153
141
  recordMcpSkillConsent,
154
142
  resolveMcpSkillConsent,
155
143
  resolveMcpSkillPath,
156
144
  resolveMcpSkillServer,
157
- scopeOf,
158
145
  selectMcpSkills,
159
146
  skillDirectoryListing,
160
147
  skillDirectoryOf
161
- } from "./chunk-Y6CD3WOK.js";
148
+ } from "./chunk-6D4RB3H5.js";
149
+ import {
150
+ FILES_STORE,
151
+ KEYS_STORE,
152
+ RUNS_STORE,
153
+ SECRETS_STORE,
154
+ SESSIONS_STORE,
155
+ STORAGE_CHANGE_KINDS,
156
+ SYNC_ID_RE,
157
+ SYNC_VERSION,
158
+ currentTab,
159
+ heldExclusively,
160
+ hubOf,
161
+ isRecord,
162
+ lockManager,
163
+ newSyncId,
164
+ onStorageChange,
165
+ openAgentWebDB,
166
+ postStorageChange,
167
+ postStorageChangeFrom,
168
+ scopeOf
169
+ } from "./chunk-JTZEUPIG.js";
162
170
 
163
171
  // src/caching.ts
164
172
  var resolveCaching = (s) => {
@@ -4017,6 +4025,7 @@ var askTheUser = async (deps, call, raw) => {
4017
4025
  };
4018
4026
 
4019
4027
  // src/tools/ask-user.ts
4028
+ var toolResultForLog = (name, output) => name === ASK_USER_TOOL ? "[the answer to the question is not logged]" : output;
4020
4029
  var routes = /* @__PURE__ */ new WeakMap();
4021
4030
  var routeAskUser = (config, channel, subagent) => {
4022
4031
  routes.set(config, { ...channel, subagent });
@@ -5024,7 +5033,10 @@ ${renderEarlierAttempts(attempt.earlier)}` : parts.prompt;
5024
5033
  if (attempt.calls) inFlight.push({ name, input });
5025
5034
  },
5026
5035
  onToolResult: (name, output, ok) => {
5027
- ctx.log.debug(`tool result: ${name} ${ok ? "ok" : "FAILED"}`, output);
5036
+ ctx.log.debug(
5037
+ `tool result: ${name} ${ok ? "ok" : "FAILED"}`,
5038
+ toolResultForLog(name, output)
5039
+ );
5028
5040
  ctx.emit({ type: "step.tool-result", step, name, output, ok });
5029
5041
  if (attempt.calls) {
5030
5042
  const at = inFlight.findIndex((c) => c.name === name);
@@ -6728,7 +6740,7 @@ var createAgent = async (config) => {
6728
6740
  config.availableTools,
6729
6741
  config.excludedTools
6730
6742
  );
6731
- const sandbox = config.sandbox ? (await import("./sandbox-ZXWD5IWZ.js")).createSandbox(
6743
+ const sandbox = config.sandbox ? (await import("./sandbox-IGTCMOOX.js")).createSandbox(
6732
6744
  config.sandbox === true ? {} : config.sandbox,
6733
6745
  hostTools,
6734
6746
  (m) => log.warn(m)
@@ -7527,7 +7539,13 @@ ${renderActiveSkills(active)}`
7527
7539
  log.warn(`step ${stepNo} made no tool calls \u2014 nothing changed in this step`);
7528
7540
  }
7529
7541
  stepResult.toolCalls.filter((c) => !c.ok).forEach((c) => log.warn(`tool ${c.name} failed:`, c.output));
7530
- log.debug(`step ${stepNo} detail:`, stepResult);
7542
+ log.debug(`step ${stepNo} detail:`, {
7543
+ ...stepResult,
7544
+ toolCalls: stepResult.toolCalls.map((c) => ({
7545
+ ...c,
7546
+ output: toolResultForLog(c.name, c.output)
7547
+ }))
7548
+ });
7531
7549
  emit({ type: "step.complete", step, result: stepResult });
7532
7550
  const counts = stepResult.toolCalls.length ? ` [${applied} tool call(s) ok${failed ? `, ${failed} failed` : ""}]` : "";
7533
7551
  done.push(
@@ -9556,47 +9574,6 @@ ${profileNames.map((n) => `- ${n}: ${profiles[n].description}`).join("\n")}` : o
9556
9574
 
9557
9575
  // src/subagent/worker.ts
9558
9576
  import { dynamicTool, jsonSchema as jsonSchema6 } from "ai";
9559
-
9560
- // src/secrets/store.ts
9561
- var VaultCredentialStore = class {
9562
- /** The database the vault lives in, and the name its change notices go out under. */
9563
- dbName;
9564
- vault;
9565
- tab;
9566
- constructor(opts = {}) {
9567
- this.dbName = opts.dbName ?? "agent-web";
9568
- this.vault = new IndexedDBVault({ ...opts, dbName: this.dbName });
9569
- this.tab = currentTab();
9570
- }
9571
- getApiKey(ref) {
9572
- return this.vault.getSecret(ref);
9573
- }
9574
- async setApiKey(ref, key) {
9575
- await this.vault.setSecret(ref, key);
9576
- postStorageChangeFrom(this.tab, this.dbName, { kind: "credentials", op: "put" });
9577
- }
9578
- async deleteApiKey(ref) {
9579
- await this.vault.deleteSecret(ref);
9580
- postStorageChangeFrom(this.tab, this.dbName, { kind: "credentials", op: "delete" });
9581
- }
9582
- };
9583
- var MemoryCredentialStore = class {
9584
- map = /* @__PURE__ */ new Map();
9585
- constructor(initial) {
9586
- if (initial) for (const [k, v] of Object.entries(initial)) this.map.set(k, v);
9587
- }
9588
- async getApiKey(ref) {
9589
- return this.map.get(ref);
9590
- }
9591
- async setApiKey(ref, key) {
9592
- this.map.set(ref, key);
9593
- }
9594
- async deleteApiKey(ref) {
9595
- this.map.delete(ref);
9596
- }
9597
- };
9598
-
9599
- // src/subagent/worker.ts
9600
9577
  var SUBAGENT_REF = "__subagent__";
9601
9578
  var defaultResolveModel = (spec) => {
9602
9579
  const { apiKey, ...rest } = spec;