ovr 7.0.0-next.17 → 7.0.0-next.18

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,11 @@
1
1
  # ovr
2
2
 
3
+ ## 7.0.0-next.18
4
+
5
+ ### Minor Changes
6
+
7
+ - d47e587: An agent's tool call that writes and redirects to a page is answered with one line, such as `Done. Redirected to /recipes`, where before it got the whole page it redirected to. A read still follows its redirect. An agent that needs the page reads it, so put what it needs after a write, such as a new record's ID, in the address.
8
+
3
9
  ## 7.0.0-next.17
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,EAAU,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,KAAK,OAAO,EAAS,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,KAAK,EAAuB,MAAM,mBAAmB,CAAC;AA2C/D,yBAAiB,GAAG,CAAC;IACpB;;;;OAIG;IACH,KAAY,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;QAChD;;;;WAIG;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAEvB,gDAAgD;QAChD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAE/B;;;;WAIG;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE9B;;;;WAIG;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC;KACzB,CAAC;IAEF,gEAAgE;IAChE,UAAiB,IAAI;QACpB,qEAAqE;QACrE,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE;YAClB,yCAAyC;YACzC,QAAQ,CAAC,MAAM,EAAE,M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,CAAC;QAE9B;;;;WAIG;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC;KACzB,CAAC;IAEF,gEAAgE;IAChE,UAAiB,IAAI;QACpB,qEAAqE;QACrE,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE;YAClB,yCAAyC;YACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;YAExB;;;;eAIG;YACH,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;YAEpE;;;;eAIG;YACH,KAAK,CACJ,GAAG,EAAE,GAAG,CAAC,KAAK,EACd,QAAQ,EAAE,MAAM,GACd,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;SACzC,CAAC;KACF;CACD;AAED;;;;;;;GAOG;AACH,qBAAa,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;;IA8CzC,wCAAwC;IACxC,YAAY,OAAO,GAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAM,EAEvC;IAED;;;;;OAKG;IACH,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAgD7D;CAsrCD"}
package/dist/mcp/index.js CHANGED
@@ -1021,9 +1021,11 @@ export class Mcp {
1021
1021
  await res.body?.cancel();
1022
1022
  const next = new URL(location, url);
1023
1023
  const readable = this.#readable(c, next);
1024
- if (readable && i < Mcp.#redirects) {
1024
+ // a read follows it, as a browser does. A write that redirects is
1025
+ // done, and the agent is told where: the page it goes to, such as a
1026
+ // whole list after deleting one item, is its to read if it wants
1027
+ if (readable && i < Mcp.#redirects && !wrote) {
1025
1028
  url = redirected = next;
1026
- init = undefined;
1027
1029
  continue;
1028
1030
  }
1029
1031
  // another site is where the app sends the user, such as a checkout,
@@ -1032,15 +1034,10 @@ export class Mcp {
1032
1034
  return Mcp.#result(next.origin !== c.url.origin
1033
1035
  ? `Redirected to ${next.href}`
1034
1036
  : readable
1035
- ? redirect(next)
1036
- : "Redirected");
1037
- }
1038
- // the route answered a write by redirecting, so the write is done. A
1039
- // page it sends to that then fails, such as on a rate limit, must not
1040
- // read as the write failing, or an agent would make it again
1041
- if (redirected && wrote && !res.ok) {
1042
- await res.body?.cancel();
1043
- return Mcp.#result(`${redirect(redirected)}, which could not be read: ${Mcp.#status(res)}`);
1037
+ ? `${wrote ? "Done. " : ""}${redirect(next)}`
1038
+ : wrote
1039
+ ? "Done"
1040
+ : "Redirected");
1044
1041
  }
1045
1042
  if (res.status >= 500)
1046
1043
  throw await Mcp.#failed(res);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ovr",
3
3
  "description": "Web apps anyone can use. Each route serves people a page and agents Markdown and MCP tools, with forms, Postgres, and passkey sign-in built in.",
4
- "version": "7.0.0-next.17",
4
+ "version": "7.0.0-next.18",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/src/mcp/index.ts CHANGED
@@ -1310,9 +1310,11 @@ export class Mcp<P extends string = string> {
1310
1310
  const next = new URL(location, url);
1311
1311
  const readable = this.#readable(c, next);
1312
1312
 
1313
- if (readable && i < Mcp.#redirects) {
1313
+ // a read follows it, as a browser does. A write that redirects is
1314
+ // done, and the agent is told where: the page it goes to, such as a
1315
+ // whole list after deleting one item, is its to read if it wants
1316
+ if (readable && i < Mcp.#redirects && !wrote) {
1314
1317
  url = redirected = next;
1315
- init = undefined;
1316
1318
  continue;
1317
1319
  }
1318
1320
 
@@ -1323,18 +1325,10 @@ export class Mcp<P extends string = string> {
1323
1325
  next.origin !== c.url.origin
1324
1326
  ? `Redirected to ${next.href}`
1325
1327
  : readable
1326
- ? redirect(next)
1327
- : "Redirected",
1328
- );
1329
- }
1330
-
1331
- // the route answered a write by redirecting, so the write is done. A
1332
- // page it sends to that then fails, such as on a rate limit, must not
1333
- // read as the write failing, or an agent would make it again
1334
- if (redirected && wrote && !res.ok) {
1335
- await res.body?.cancel();
1336
- return Mcp.#result(
1337
- `${redirect(redirected)}, which could not be read: ${Mcp.#status(res)}`,
1328
+ ? `${wrote ? "Done. " : ""}${redirect(next)}`
1329
+ : wrote
1330
+ ? "Done"
1331
+ : "Redirected",
1338
1332
  );
1339
1333
  }
1340
1334