@botiverse/porthole 0.14.8 → 0.14.10

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 (60) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/annotate/types.d.ts +33 -2
  3. package/dist/annotate/validate.d.ts +6 -1
  4. package/dist/annotate/validate.js +31 -3
  5. package/dist/bridge/bridge.d.ts +6 -0
  6. package/dist/bridge/bridge.js +5 -0
  7. package/dist/check/page-source.js +1 -1
  8. package/dist/config/capabilities.d.ts +16 -2
  9. package/dist/config/capabilities.js +8 -0
  10. package/dist/conformance/harness-source.js +1 -1
  11. package/dist/find/types.d.ts +83 -0
  12. package/dist/find/types.js +29 -0
  13. package/dist/find/validate.d.ts +17 -0
  14. package/dist/find/validate.js +82 -0
  15. package/dist/guide/guide.js +2 -1
  16. package/dist/host/create-host.js +219 -3
  17. package/dist/host/pass-on.js +3 -2
  18. package/dist/host/types.d.ts +54 -1
  19. package/dist/index.d.ts +5 -3
  20. package/dist/index.js +4 -1
  21. package/dist/react/frame.d.ts +45 -1
  22. package/dist/react/frame.js +107 -3
  23. package/dist/react/view.js +2 -0
  24. package/dist/runtime/contract.d.ts +1 -1
  25. package/dist/runtime/contract.js +1 -1
  26. package/dist/shell/annotate.d.ts +5 -1
  27. package/dist/shell/annotate.js +41 -107
  28. package/dist/shell/document.d.ts +3 -3
  29. package/dist/shell/document.js +5 -3
  30. package/dist/shell/find.d.ts +82 -0
  31. package/dist/shell/find.js +725 -0
  32. package/dist/shell/runtime.js +4 -1
  33. package/dist/shell/text.d.ts +17 -0
  34. package/dist/shell/text.js +140 -0
  35. package/docs/ADOPTING.md +112 -0
  36. package/docs/ARCHITECTURE.md +10 -3
  37. package/docs/DECISIONS.md +284 -1
  38. package/docs/DESIGN.md +48 -2
  39. package/docs/THREAT_MODEL.md +61 -5
  40. package/docs/insertion-entry-points.md +17 -0
  41. package/package.json +1 -1
  42. package/src/annotate/types.ts +43 -4
  43. package/src/annotate/validate.ts +34 -3
  44. package/src/bridge/bridge.ts +7 -0
  45. package/src/config/capabilities.ts +13 -1
  46. package/src/find/types.ts +86 -0
  47. package/src/find/validate.ts +101 -0
  48. package/src/guide/guide.ts +3 -1
  49. package/src/host/create-host.ts +235 -3
  50. package/src/host/pass-on.ts +3 -2
  51. package/src/host/types.ts +55 -1
  52. package/src/index.ts +14 -1
  53. package/src/react/frame.tsx +162 -2
  54. package/src/react/view.tsx +3 -0
  55. package/src/runtime/contract.ts +1 -1
  56. package/src/shell/annotate.ts +42 -107
  57. package/src/shell/document.ts +5 -3
  58. package/src/shell/find.ts +731 -0
  59. package/src/shell/runtime.ts +4 -1
  60. package/src/shell/text.ts +140 -0
@@ -1,4 +1,5 @@
1
1
  import type { AnnotationReport } from "../annotate/types.ts";
2
+ import type { FindReport } from "../find/types.ts";
2
3
  import type { DbRequest, DbResult } from "../runtime/db.ts";
3
4
  import type { ArtifactInfo, ArtifactRequest, AssetInfo, AssetRequest, CommentRequest, PublishedVersion, UserInfo } from "../runtime/requests.ts";
4
5
  /**
@@ -10,7 +11,7 @@ import type { ArtifactInfo, ArtifactRequest, AssetInfo, AssetRequest, CommentReq
10
11
  * are on by default), and is served either by a handler the host passes or as an event the
11
12
  * framework emits.
12
13
  */
13
- export declare const CAPABILITY_NAMES: readonly ["sendPrompt", "openLink", "downloadFile", "callTool", "readData", "subscribeData", "setModelContext", "reportError", "resize", "copyText", "annotate", "user", "comments", "artifact", "assets", "db"];
14
+ export declare const CAPABILITY_NAMES: readonly ["sendPrompt", "openLink", "downloadFile", "callTool", "readData", "subscribeData", "setModelContext", "reportError", "resize", "copyText", "annotate", "find", "user", "comments", "artifact", "assets", "db"];
14
15
  export type CapabilityName = (typeof CAPABILITY_NAMES)[number];
15
16
  /**
16
17
  * What must hold before a call reaches the host's handler. A capability's gates all apply.
@@ -52,7 +53,7 @@ export interface CapabilitySpec {
52
53
  /**
53
54
  * How content reaches it without the shell's global: the MCP Apps request (or Porthole's own,
54
55
  * `porthole/…`, where the standard has none), and the official App SDK's method for it, if any.
55
- * Absent for what the shell does by itself (sizes, errors, annotations).
56
+ * Absent for what the shell does by itself (sizes, errors, annotations, find).
56
57
  */
57
58
  readonly request?: {
58
59
  readonly method: string;
@@ -171,6 +172,16 @@ export declare const CAPABILITIES: {
171
172
  readonly defaultGates: readonly [Gate];
172
173
  readonly served: "event";
173
174
  };
175
+ /**
176
+ * Find in page (P131): the host's find bar asks the shell to find the person's words in the
177
+ * content and highlight them; the shell answers how many and which is current, and says when
178
+ * the person pressed the find shortcut in the frame. The query goes into the content's realm,
179
+ * which can read it; what the frame says back is the content's word: a find bar's numbers.
180
+ */
181
+ readonly find: {
182
+ readonly defaultGates: readonly [Gate];
183
+ readonly served: "event";
184
+ };
174
185
  /** Who is viewing (P087): answered from the viewer the host gave the display. */
175
186
  readonly user: {
176
187
  readonly defaultGates: readonly [Gate];
@@ -263,6 +274,8 @@ export interface CapabilityArgs {
263
274
  };
264
275
  /** What the frame reported, once checked (`AnnotationReport`). */
265
276
  readonly annotate: AnnotationReport;
277
+ /** What the frame said unasked, once checked (`FindReport`): the shortcut, a changed count. */
278
+ readonly find: FindReport;
266
279
  readonly user: Readonly<Record<string, never>>;
267
280
  readonly comments: CommentRequest;
268
281
  readonly artifact: ArtifactRequest;
@@ -288,6 +301,7 @@ export interface CapabilityResults {
288
301
  /** Whether the text was copied. */
289
302
  readonly copyText: boolean;
290
303
  readonly annotate: undefined;
304
+ readonly find: undefined;
291
305
  readonly user: UserInfo;
292
306
  /** Whether the composer opened. Never a thread: content doesn't read comments (P090). */
293
307
  readonly comments: boolean;
@@ -19,6 +19,7 @@ export const CAPABILITY_NAMES = [
19
19
  "resize",
20
20
  "copyText",
21
21
  "annotate",
22
+ "find",
22
23
  // The capability runtime's own (P085, `config.runtime`): reached through `porthole.use`.
23
24
  "user",
24
25
  "comments",
@@ -102,6 +103,13 @@ export const CAPABILITIES = {
102
103
  * (it shares the realm): UI hints for the host, never permissions.
103
104
  */
104
105
  annotate: { defaultGates: [rate(120)], served: "event" },
106
+ /**
107
+ * Find in page (P131): the host's find bar asks the shell to find the person's words in the
108
+ * content and highlight them; the shell answers how many and which is current, and says when
109
+ * the person pressed the find shortcut in the frame. The query goes into the content's realm,
110
+ * which can read it; what the frame says back is the content's word: a find bar's numbers.
111
+ */
112
+ find: { defaultGates: [rate(120)], served: "event" },
105
113
  /** Who is viewing (P087): answered from the viewer the host gave the display. */
106
114
  user: { defaultGates: [rate(60)], served: "viewer", request: { method: "porthole/call" } },
107
115
  /** Opens the host's comment composer at the page's anchor (P090): write-only. */