@dudko.dev/agent-web 0.0.47 → 0.0.49

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 +13 -3
  2. package/dist/agent-web.js +137 -137
  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 +79 -27
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +72 -75
  19. package/dist/index.d.ts +72 -75
  20. package/dist/index.js +78 -71
  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/README.md CHANGED
@@ -107,7 +107,8 @@ import {
107
107
  } from '@dudko.dev/agent-web'
108
108
  import { z } from 'zod'
109
109
 
110
- // 1. Store the user's key once (e.g. from a settings form). Encrypted at rest.
110
+ // 1. Store the user's key once (e.g. from a settings form). Encrypted at rest. (A settings page
111
+ // that only stores keys can import it from '@dudko.dev/agent-web/secrets': no agent loaded.)
111
112
  const credentials = new VaultCredentialStore()
112
113
  await credentials.setApiKey('openai', userProvidedKey)
113
114
 
@@ -995,7 +996,8 @@ await watch.stop()
995
996
  - **Change notices** (`credentials`, `oauth`, `files`, `session`, `runs`, `skills`, and the React
996
997
  package's `chats`): one channel per database name, sent after the transaction completed, never for
997
998
  a failed write, never heard by the tab that wrote. A store of your own posts with
998
- `postStorageChange`. `agent.reloadLearnedSkills()` re-reads the notebook after a `skills` notice.
999
+ `postStorageChange` (kind `host` for one that keeps none of those: which store, which record -
1000
+ names only). `agent.reloadLearnedSkills()` re-reads the notebook after a `skills` notice.
999
1001
  - **`sessionLock`** (`'wait'` default, `'fail'`, `'off'`): the session's Web Lock for the run's whole
1000
1002
  duration, released however it ends (and by the browser when the tab closes). Subagents that share
1001
1003
  the session run under the parent's hold; helpers and pipeline nodes have sessions of their own.
@@ -1009,6 +1011,14 @@ await watch.stop()
1009
1011
  - **`watchSession`**: the run's events (clipped), its state (`running`, `ended: 'done' | 'stopped' |
1010
1012
  'gone'`), a replay for a tab that joins late, `send` and `stop`. Tool approvals never cross: they
1011
1013
  are answered in the tab that runs the tool.
1014
+ - **A deletion or an upgrade in another tab is never held up**: the one connection per database
1015
+ closes on `versionchange`; the next use opens a new, empty database after a deletion (the vault
1016
+ makes a new key there), and fails with a `VersionError` after an upgrade by a newer copy, until a
1017
+ reload.
1018
+ - **The vault without the agent**: `@dudko.dev/agent-web/secrets` (`IndexedDBVault`,
1019
+ `VaultCredentialStore`, `MemoryCredentialStore`, `getOrCreateVaultKey`, `encryptJSON`,
1020
+ `decryptJSON`) loads `idb` and the vault only - for a page that stores or lists keys before (or
1021
+ without) the agent. The same objects as the main entry's.
1012
1022
 
1013
1023
  Details: [Several tabs](docs/capabilities.md#several-tabs) ·
1014
1024
  [what crosses, and who can post](docs/security.md#several-tabs-what-crosses-and-who-can-post) ·
@@ -1032,7 +1042,7 @@ Details: [Several tabs](docs/capabilities.md#several-tabs) ·
1032
1042
  | `skills` | — | SKILL.md bundles (`defineSkill` / `parseSkillMarkdown` / `loadSkillFromUrl`). An MCP server's skills come with its tools (`skills: true` or `{ consent, dynamic }` on the server of `connectMcpHttp`, experimental; `dynamic: true` also takes its generated skills, each read whole into a snapshot before anyone is asked) and join them as `<server>/<skill>` - see [MCP skills](#mcp-skills-experimental-a-servers-instructions-as-skills) |
1033
1043
  | `mcpSkills` | `{ consent: 'once-per-skill' }` | experimental: when a person is asked (`toolApproval.onRequest`, a request with `skill`) before an MCP server's skill enters the model's context, for servers whose `skills: { consent }` does not say - `'once-per-skill'`, `'ask'` (every run) or `'never'` - see [MCP skills](#mcp-skills-experimental-a-servers-instructions-as-skills) |
1034
1044
  | `egress` | off | what the **model** may fetch (`web_fetch`): `true` = any public host over https, or `{ allow, deny, protocols, allowPrivateNetwork, fetch, ... }`; a browser can't pin DNS, so prefer an `allow` list — see [Egress](docs/capabilities.md#egress-what-the-model-may-fetch) |
1035
- | `search` | off | the model may **search the web** (`web_search`: a short list of title / url / snippet): `{ engine: fn }` - a search engine of yours, any API - or `{ provider: 'google', credentialRef, model, baseURL, maxResults, allowPrivateNetwork, readOnly, fetch }` - Google Search through Gemini grounding: one extra `generateContent` call per search on a Gemini key (default model `gemini-2.5-flash-lite`), which **spends model tokens** (`usage` phase `'search'`) and returns **Google redirect links**, not the pages' URLs. No key ships with the library and none is written in the config (`credentialRef` names it in `credentials`); the request reaches only that API; with `egress`, results the model could not fetch are left out. Recipes for Tavily / Brave / SearXNG as an `engine`, the free-tier models and what the redirect links mean — see [Search](docs/capabilities.md#search-finding-the-page-to-fetch) |
1045
+ | `search` | off | the model may **search the web** (`web_search`: a short list of title / url / snippet): `{ engine: fn }` - a search engine of yours, any API (it may answer `{ results, usage }`: a search through a model is charged as phase `'search'`) - or `{ provider: 'google', credentialRef, model, baseURL, maxResults, allowPrivateNetwork, readOnly, fetch }` - Google Search through Gemini grounding: one extra `generateContent` call per search on a Gemini key (default model `gemini-2.5-flash-lite`), which **spends model tokens** (`usage` phase `'search'`) and returns **Google redirect links**, not the pages' URLs. No key ships with the library and none is written in the config (`credentialRef` names it in `credentials`); the request reaches only that API; with `egress`, results the model could not fetch are left out. Recipes for Tavily / Brave / SearXNG as an `engine`, the free-tier models and what the redirect links mean — see [Search](docs/capabilities.md#search-finding-the-page-to-fetch) |
1036
1046
  | `media` | off | image generation, speech and transcription as tools, each mounted only when its model is set: `{ imageModel, speechModel, transcriptionModel, maxCalls, timeoutMs, files, folder, voice, speechFormat, transcribeAttachments }`. A model is an AI SDK image / speech / transcription model object or a `ProviderModelSpec` (key by `credentialRef`). Generated files go to the virtual file system and the model gets a path, never the bytes; attached audio is transcribed to text; calls are counted in `usage.mediaCalls` (and the other media fields) and capped per run — see [Media](docs/capabilities.md#media-images-speech-and-transcription) |
1037
1047
  | `decisionModel` | off | a **decision model** - answers a closed question with one option and a probability instead of writing text: `{ providerType: 'google', model: 'gemini-decision-1', credentialRef }` (the key stays in `credentials`; the request reaches only that API) or an object with `decide(question, { abortSignal })`. Where it is confident it replaces the replanner's continue / finish call and a pipeline node's route call; never consulted for tool approval or egress — see [Decision models](docs/capabilities.md#decision-models) |
1038
1048
  | `decision` | `{}` | `{ confidenceThreshold, timeoutMs, replan, route }` (defaults 0.8, 5000 ms, on, on): below the threshold, on an error, a timeout or an answer that is not an option, the ordinary model call runs unchanged |