@botiverse/porthole 0.5.0 → 0.5.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.
Files changed (42) hide show
  1. package/dist/bridge/bridge.d.ts +12 -4
  2. package/dist/bridge/bridge.js +58 -26
  3. package/dist/bridge/navigation.d.ts +11 -0
  4. package/dist/bridge/navigation.js +30 -0
  5. package/dist/bridge/refusal.d.ts +53 -0
  6. package/dist/bridge/refusal.js +121 -0
  7. package/dist/bridge/types.d.ts +7 -0
  8. package/dist/check/page-source.js +1 -1
  9. package/dist/check/page.js +5 -0
  10. package/dist/config/capabilities.d.ts +5 -0
  11. package/dist/conformance/harness-source.js +1 -1
  12. package/dist/guide/guide.js +14 -4
  13. package/dist/host/create-host.js +15 -4
  14. package/dist/host/types.d.ts +15 -2
  15. package/dist/index.d.ts +2 -1
  16. package/dist/index.js +3 -1
  17. package/dist/mcp/adapter.js +22 -7
  18. package/dist/protocol/mcp-apps.d.ts +6 -0
  19. package/dist/protocol/mcp-apps.js +6 -0
  20. package/dist/protocol/shell-adapter.js +14 -2
  21. package/dist/react/frame.d.ts +19 -4
  22. package/dist/react/frame.js +37 -9
  23. package/dist/shell/runtime.js +34 -8
  24. package/docs/ADOPTING.md +39 -9
  25. package/docs/DECISIONS.md +92 -0
  26. package/docs/DESIGN.md +12 -7
  27. package/package.json +1 -1
  28. package/src/bridge/bridge.ts +70 -22
  29. package/src/bridge/navigation.ts +34 -0
  30. package/src/bridge/refusal.ts +151 -0
  31. package/src/bridge/types.ts +12 -1
  32. package/src/check/page.ts +7 -0
  33. package/src/config/capabilities.ts +5 -1
  34. package/src/guide/guide.ts +18 -4
  35. package/src/host/create-host.ts +16 -4
  36. package/src/host/types.ts +13 -2
  37. package/src/index.ts +9 -0
  38. package/src/mcp/adapter.ts +26 -6
  39. package/src/protocol/mcp-apps.ts +7 -0
  40. package/src/protocol/shell-adapter.ts +15 -2
  41. package/src/react/frame.tsx +53 -14
  42. package/src/shell/runtime.ts +34 -8
@@ -1,4 +1,5 @@
1
1
  import { capabilitySpec, isCapabilityName, } from "../config/capabilities.js";
2
+ import { addressWithoutQuery } from "../bridge/navigation.js";
2
3
  import { createHost } from "../host/create-host.js";
3
4
  import { webPlatform } from "../platform/web.js";
4
5
  import { contentLine, instrumented, } from "./instrument.js";
@@ -150,6 +151,10 @@ const check = {
150
151
  calls.push({ capability, outcome: refusal });
151
152
  }
152
153
  });
154
+ // A navigation the shell stopped (P080): the content tried to leave its page.
155
+ display.on("navigationBlocked", ({ url }) => {
156
+ run.data.errors.push(`It tried to navigate its frame to ${addressWithoutQuery(url)}, and was stopped: content never leaves its page`);
157
+ });
153
158
  display.on("outcome", (outcome) => {
154
159
  run.data.outcome = outcome.state === "blocked" ? `blocked: ${outcome.reason}` : outcome.state;
155
160
  });
@@ -169,8 +169,13 @@ export interface CapabilityArgs {
169
169
  readonly content?: readonly unknown[];
170
170
  readonly structuredContent?: Readonly<Record<string, unknown>>;
171
171
  };
172
+ /**
173
+ * `navigationBlocked`: the address a navigation of the frame went to when the shell cancelled it
174
+ * (P080), the content's word; `message` is then Porthole's, which names it without its query.
175
+ */
172
176
  readonly reportError: {
173
177
  readonly message: string;
178
+ readonly navigationBlocked?: string;
174
179
  };
175
180
  readonly resize: {
176
181
  readonly height: number;