@mercury-fw/plugin-web-search 0.1.0 → 0.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mercury-fw/plugin-web-search
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 4431285: - plugin-web-search README: the minimum core (0.53), the Italian labels the person reads, where a person's list lives and how to edit it, and a config example matching the app `mfw create` writes.
8
+ - channel-google-chat README: the confirmation card has a button per choice, and a choice whose result goes back to the model runs the turn again.
9
+
3
10
  ## 0.1.0
4
11
 
5
12
  ### Minor Changes
package/README.md CHANGED
@@ -13,7 +13,7 @@ import { searxngBackend } from "@mercury-fw/web-search-searxng";
13
13
  export default defineMercuryConfig({
14
14
  plugins: [
15
15
  webSearchPlugin({
16
- backend: searxngBackend({ url: process.env.SEARXNG_URL! }),
16
+ backend: searxngBackend({ url: process.env.SEARXNG_URL || "http://searxng:8080" }),
17
17
  allowedHosts: ["bun.sh", "developer.mozilla.org"],
18
18
  }),
19
19
  ],
@@ -22,7 +22,9 @@ export default defineMercuryConfig({
22
22
 
23
23
  The model gets two tools. `web_search` returns title, URL and snippet of each result, and `web_fetch` reads a page and returns its title and text (the main content, found by Readability; menus, footers and scripts are left out). An answer built on pages ends with a `Fonti:` list of what was read, written by the plugin and not by the model, so it can't be left out or made up (a title is the site's text, so it shows up cut at 120 characters and stripped of links and formatting).
24
24
 
25
- The plugin acts as no one (`actsAs: "anyone"`): there's no login, everyone gets it, and `access.plugins` in the config restricts it to some roles like any other plugin.
25
+ The plugin acts as no one (`actsAs: "anyone"`): there's no login, everyone gets it, and `access.plugins` in the config restricts it to some roles like any other plugin. That needs `@mercury-fw/core` 0.53 or later: an older core doesn't know `"anyone"`, reads it as `"mercury"`, and offers the plugin only to whoever holds `mercury.act-as-self`.
26
+
27
+ What the person reads in its own words is fixed Italian text, whatever language the assistant speaks: the two choices ("Solo questa volta", "Sempre per \<host\>"), the `Fonti:` heading and the status lines while a tool runs ("Cerco sul web", "Leggo \<host\>").
26
28
 
27
29
  ## Which pages it reads
28
30
 
@@ -35,6 +37,8 @@ For any other host the plugin asks the person, through the same confirmation Mer
35
37
 
36
38
  Either way the page goes back to the model, which answers on it in the same conversation. A person's list is theirs alone (nobody else's reads change), and it lives in the plugin's folder on the vault's volume, so it survives a restart; with a core that gives the plugin no folder, only the first choice is offered.
37
39
 
40
+ The list is one JSON file per person, `<vault>/.mercury/plugins/web-search/allowlist/<user key>.json`, the user key URL-encoded (`google-chat:users/42` becomes `google-chat%3Ausers%2F42.json`), holding `{ "hosts": [...] }`. No command lists or edits it yet ([#259](https://github.com/lucabro81/mercury-fw/issues/259)): to take a host back, open a shell in the container (`mfw shell`) and edit the file, whose folder is under `WIKI_VAULT_PATH`. A file the plugin can't read as a list is copied aside (`<file>.corrupt-<time>-<id>`) before the next host replaces it, so a hand edit gone wrong loses nothing.
41
+
38
42
  Why not let the model read anything it finds? Because Mercury also reads private data (Jira, the wiki), and a page can carry instructions for the model: an open `web_fetch` would let a hostile page make it send that data out inside a URL. Asking the person for every new host closes that, and the allowlist keeps it from getting in the way on the sites a team actually uses.
39
43
 
40
44
  A host nobody allowed isn't even looked up in DNS before the person answers: a host name can carry data, and its DNS server would hear it. Some addresses are never read, allowlist or not: anything that isn't http or https, a URL with credentials in it, and every host that resolves to a loopback, private, link-local or otherwise internal address (the app's own Qdrant, the model's endpoint, a cloud's metadata address). The check runs on the first URL and again on every redirect, and a redirect to a host that isn't allowed stops the read. It can't catch a host that resolves to a public address at the check and to an internal one a moment later, when the page downloads (DNS rebinding), since Bun's `fetch` takes no resolved address. A proxy set for the container (`HTTP_PROXY`, `HTTPS_PROXY`) resolves names itself, past this check, so don't give the app one unless it enforces the same rules. Allowing a host, even for one page, means trusting whoever runs it: when the app's network holds something that must stay unreachable whatever happens, block the container's outgoing traffic to it at the network level as well.
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * for the person's permission, given once or for good (see `tools.ts`).
8
8
  *
9
9
  * ```ts
10
- * webSearchPlugin({ backend: searxngBackend({ url: process.env.SEARXNG_URL! }), allowedHosts: ["bun.sh"] })
10
+ * webSearchPlugin({ backend: searxngBackend({ url: process.env.SEARXNG_URL || "http://searxng:8080" }), allowedHosts: ["bun.sh"] })
11
11
  * ```
12
12
  */
13
13
  import { type Plugin } from "@mercury-fw/plugin-types";
package/index.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * for the person's permission, given once or for good (see `tools.ts`).
8
8
  *
9
9
  * ```ts
10
- * webSearchPlugin({ backend: searxngBackend({ url: process.env.SEARXNG_URL! }), allowedHosts: ["bun.sh"] })
10
+ * webSearchPlugin({ backend: searxngBackend({ url: process.env.SEARXNG_URL || "http://searxng:8080" }), allowedHosts: ["bun.sh"] })
11
11
  * ```
12
12
  */
13
13
  import { PLUGIN_API_VERSION, type Plugin } from "@mercury-fw/plugin-types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercury-fw/plugin-web-search",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",