@dudko.dev/agent-web-ui 0.0.1 → 0.0.2

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 (234) hide show
  1. package/README.md +66 -1
  2. package/dist/{chunk-4EHUITGU.js → chunk-SVYHDLAZ.js} +7 -1
  3. package/dist/{chunk-4EHUITGU.js.map → chunk-SVYHDLAZ.js.map} +1 -1
  4. package/dist/{chunk-A55Q377T.js → chunk-VCR7LU7J.js} +7 -1
  5. package/dist/{chunk-A55Q377T.js.map → chunk-VCR7LU7J.js.map} +1 -1
  6. package/dist/{chunk-P2F2P3JC.js → chunk-WFM6B7CL.js} +7 -1
  7. package/dist/{chunk-P2F2P3JC.js.map → chunk-WFM6B7CL.js.map} +1 -1
  8. package/dist/{chunk-TPK25QGK.js → chunk-WZ7K7JIP.js} +7 -1
  9. package/dist/{chunk-TPK25QGK.js.map → chunk-WZ7K7JIP.js.map} +1 -1
  10. package/dist/chunk-ZBHESK6V.js +1440 -0
  11. package/dist/chunk-ZBHESK6V.js.map +1 -0
  12. package/dist/controller.cjs +1891 -0
  13. package/dist/controller.cjs.map +1 -0
  14. package/dist/controller.d.cts +253 -0
  15. package/dist/controller.d.ts +253 -0
  16. package/dist/controller.js +482 -0
  17. package/dist/controller.js.map +1 -0
  18. package/dist/{en-CcNUz2tN.d.cts → en-Dg2MtzcJ.d.cts} +6 -0
  19. package/dist/{en-CcNUz2tN.d.ts → en-Dg2MtzcJ.d.ts} +6 -0
  20. package/dist/index.cjs +133 -0
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +82 -4
  23. package/dist/index.d.ts +82 -4
  24. package/dist/index.js +142 -1419
  25. package/dist/index.js.map +1 -1
  26. package/dist/{labels-UuWI7wPo.d.ts → labels-CmiTBLWD.d.cts} +68 -100
  27. package/dist/{labels-D5BrHct4.d.cts → labels-DH1ESUtm.d.ts} +68 -100
  28. package/dist/locales/be.cjs +12 -0
  29. package/dist/locales/be.cjs.map +1 -1
  30. package/dist/locales/be.d.cts +4 -2
  31. package/dist/locales/be.d.ts +4 -2
  32. package/dist/locales/be.js +7 -1
  33. package/dist/locales/be.js.map +1 -1
  34. package/dist/locales/bg.cjs +12 -0
  35. package/dist/locales/bg.cjs.map +1 -1
  36. package/dist/locales/bg.d.cts +4 -2
  37. package/dist/locales/bg.d.ts +4 -2
  38. package/dist/locales/bg.js +7 -1
  39. package/dist/locales/bg.js.map +1 -1
  40. package/dist/locales/ca.cjs +12 -0
  41. package/dist/locales/ca.cjs.map +1 -1
  42. package/dist/locales/ca.d.cts +4 -2
  43. package/dist/locales/ca.d.ts +4 -2
  44. package/dist/locales/ca.js +7 -1
  45. package/dist/locales/ca.js.map +1 -1
  46. package/dist/locales/cs.cjs +12 -0
  47. package/dist/locales/cs.cjs.map +1 -1
  48. package/dist/locales/cs.d.cts +4 -2
  49. package/dist/locales/cs.d.ts +4 -2
  50. package/dist/locales/cs.js +7 -1
  51. package/dist/locales/cs.js.map +1 -1
  52. package/dist/locales/da.cjs +12 -0
  53. package/dist/locales/da.cjs.map +1 -1
  54. package/dist/locales/da.d.cts +4 -2
  55. package/dist/locales/da.d.ts +4 -2
  56. package/dist/locales/da.js +7 -1
  57. package/dist/locales/da.js.map +1 -1
  58. package/dist/locales/de.cjs +12 -0
  59. package/dist/locales/de.cjs.map +1 -1
  60. package/dist/locales/de.d.cts +4 -2
  61. package/dist/locales/de.d.ts +4 -2
  62. package/dist/locales/de.js +7 -1
  63. package/dist/locales/de.js.map +1 -1
  64. package/dist/locales/el.cjs +12 -0
  65. package/dist/locales/el.cjs.map +1 -1
  66. package/dist/locales/el.d.cts +4 -2
  67. package/dist/locales/el.d.ts +4 -2
  68. package/dist/locales/el.js +7 -1
  69. package/dist/locales/el.js.map +1 -1
  70. package/dist/locales/en.cjs +12 -0
  71. package/dist/locales/en.cjs.map +1 -1
  72. package/dist/locales/en.d.cts +4 -2
  73. package/dist/locales/en.d.ts +4 -2
  74. package/dist/locales/en.js +7 -1
  75. package/dist/locales/en.js.map +1 -1
  76. package/dist/locales/es-419.cjs +16 -1
  77. package/dist/locales/es-419.cjs.map +1 -1
  78. package/dist/locales/es-419.d.cts +4 -2
  79. package/dist/locales/es-419.d.ts +4 -2
  80. package/dist/locales/es-419.js +6 -3
  81. package/dist/locales/es-419.js.map +1 -1
  82. package/dist/locales/es.cjs +12 -0
  83. package/dist/locales/es.cjs.map +1 -1
  84. package/dist/locales/es.d.cts +4 -2
  85. package/dist/locales/es.d.ts +4 -2
  86. package/dist/locales/es.js +2 -2
  87. package/dist/locales/fi.cjs +12 -0
  88. package/dist/locales/fi.cjs.map +1 -1
  89. package/dist/locales/fi.d.cts +4 -2
  90. package/dist/locales/fi.d.ts +4 -2
  91. package/dist/locales/fi.js +7 -1
  92. package/dist/locales/fi.js.map +1 -1
  93. package/dist/locales/fr-CA.cjs +12 -0
  94. package/dist/locales/fr-CA.cjs.map +1 -1
  95. package/dist/locales/fr-CA.d.cts +4 -2
  96. package/dist/locales/fr-CA.d.ts +4 -2
  97. package/dist/locales/fr-CA.js +2 -2
  98. package/dist/locales/fr.cjs +12 -0
  99. package/dist/locales/fr.cjs.map +1 -1
  100. package/dist/locales/fr.d.cts +4 -2
  101. package/dist/locales/fr.d.ts +4 -2
  102. package/dist/locales/fr.js +2 -2
  103. package/dist/locales/gn.cjs +12 -0
  104. package/dist/locales/gn.cjs.map +1 -1
  105. package/dist/locales/gn.d.cts +4 -2
  106. package/dist/locales/gn.d.ts +4 -2
  107. package/dist/locales/gn.js +7 -1
  108. package/dist/locales/gn.js.map +1 -1
  109. package/dist/locales/hr.cjs +12 -0
  110. package/dist/locales/hr.cjs.map +1 -1
  111. package/dist/locales/hr.d.cts +4 -2
  112. package/dist/locales/hr.d.ts +4 -2
  113. package/dist/locales/hr.js +7 -1
  114. package/dist/locales/hr.js.map +1 -1
  115. package/dist/locales/ht.cjs +12 -0
  116. package/dist/locales/ht.cjs.map +1 -1
  117. package/dist/locales/ht.d.cts +4 -2
  118. package/dist/locales/ht.d.ts +4 -2
  119. package/dist/locales/ht.js +7 -1
  120. package/dist/locales/ht.js.map +1 -1
  121. package/dist/locales/hu.cjs +12 -0
  122. package/dist/locales/hu.cjs.map +1 -1
  123. package/dist/locales/hu.d.cts +4 -2
  124. package/dist/locales/hu.d.ts +4 -2
  125. package/dist/locales/hu.js +7 -1
  126. package/dist/locales/hu.js.map +1 -1
  127. package/dist/locales/index.cjs +6 -0
  128. package/dist/locales/index.cjs.map +1 -1
  129. package/dist/locales/index.d.cts +6 -4
  130. package/dist/locales/index.d.ts +6 -4
  131. package/dist/locales/index.js +1 -1
  132. package/dist/locales/it.cjs +12 -0
  133. package/dist/locales/it.cjs.map +1 -1
  134. package/dist/locales/it.d.cts +4 -2
  135. package/dist/locales/it.d.ts +4 -2
  136. package/dist/locales/it.js +7 -1
  137. package/dist/locales/it.js.map +1 -1
  138. package/dist/locales/nb.cjs +12 -0
  139. package/dist/locales/nb.cjs.map +1 -1
  140. package/dist/locales/nb.d.cts +4 -2
  141. package/dist/locales/nb.d.ts +4 -2
  142. package/dist/locales/nb.js +7 -1
  143. package/dist/locales/nb.js.map +1 -1
  144. package/dist/locales/nl.cjs +12 -0
  145. package/dist/locales/nl.cjs.map +1 -1
  146. package/dist/locales/nl.d.cts +4 -2
  147. package/dist/locales/nl.d.ts +4 -2
  148. package/dist/locales/nl.js +7 -1
  149. package/dist/locales/nl.js.map +1 -1
  150. package/dist/locales/pl.cjs +12 -0
  151. package/dist/locales/pl.cjs.map +1 -1
  152. package/dist/locales/pl.d.cts +4 -2
  153. package/dist/locales/pl.d.ts +4 -2
  154. package/dist/locales/pl.js +7 -1
  155. package/dist/locales/pl.js.map +1 -1
  156. package/dist/locales/pt-BR.cjs +12 -0
  157. package/dist/locales/pt-BR.cjs.map +1 -1
  158. package/dist/locales/pt-BR.d.cts +4 -2
  159. package/dist/locales/pt-BR.d.ts +4 -2
  160. package/dist/locales/pt-BR.js +7 -1
  161. package/dist/locales/pt-BR.js.map +1 -1
  162. package/dist/locales/pt.cjs +12 -0
  163. package/dist/locales/pt.cjs.map +1 -1
  164. package/dist/locales/pt.d.cts +4 -2
  165. package/dist/locales/pt.d.ts +4 -2
  166. package/dist/locales/pt.js +7 -1
  167. package/dist/locales/pt.js.map +1 -1
  168. package/dist/locales/qu.cjs +12 -0
  169. package/dist/locales/qu.cjs.map +1 -1
  170. package/dist/locales/qu.d.cts +4 -2
  171. package/dist/locales/qu.d.ts +4 -2
  172. package/dist/locales/qu.js +7 -1
  173. package/dist/locales/qu.js.map +1 -1
  174. package/dist/locales/ro.cjs +12 -0
  175. package/dist/locales/ro.cjs.map +1 -1
  176. package/dist/locales/ro.d.cts +4 -2
  177. package/dist/locales/ro.d.ts +4 -2
  178. package/dist/locales/ro.js +7 -1
  179. package/dist/locales/ro.js.map +1 -1
  180. package/dist/locales/ru.cjs +12 -0
  181. package/dist/locales/ru.cjs.map +1 -1
  182. package/dist/locales/ru.d.cts +4 -2
  183. package/dist/locales/ru.d.ts +4 -2
  184. package/dist/locales/ru.js +7 -1
  185. package/dist/locales/ru.js.map +1 -1
  186. package/dist/locales/sk.cjs +12 -0
  187. package/dist/locales/sk.cjs.map +1 -1
  188. package/dist/locales/sk.d.cts +4 -2
  189. package/dist/locales/sk.d.ts +4 -2
  190. package/dist/locales/sk.js +7 -1
  191. package/dist/locales/sk.js.map +1 -1
  192. package/dist/locales/sq.cjs +12 -0
  193. package/dist/locales/sq.cjs.map +1 -1
  194. package/dist/locales/sq.d.cts +4 -2
  195. package/dist/locales/sq.d.ts +4 -2
  196. package/dist/locales/sq.js +7 -1
  197. package/dist/locales/sq.js.map +1 -1
  198. package/dist/locales/sr-Latn.cjs +12 -0
  199. package/dist/locales/sr-Latn.cjs.map +1 -1
  200. package/dist/locales/sr-Latn.d.cts +4 -2
  201. package/dist/locales/sr-Latn.d.ts +4 -2
  202. package/dist/locales/sr-Latn.js +2 -2
  203. package/dist/locales/sr.cjs +12 -0
  204. package/dist/locales/sr.cjs.map +1 -1
  205. package/dist/locales/sr.d.cts +4 -2
  206. package/dist/locales/sr.d.ts +4 -2
  207. package/dist/locales/sr.js +2 -2
  208. package/dist/locales/sv.cjs +12 -0
  209. package/dist/locales/sv.cjs.map +1 -1
  210. package/dist/locales/sv.d.cts +4 -2
  211. package/dist/locales/sv.d.ts +4 -2
  212. package/dist/locales/sv.js +7 -1
  213. package/dist/locales/sv.js.map +1 -1
  214. package/dist/locales/tr.cjs +12 -0
  215. package/dist/locales/tr.cjs.map +1 -1
  216. package/dist/locales/tr.d.cts +4 -2
  217. package/dist/locales/tr.d.ts +4 -2
  218. package/dist/locales/tr.js +7 -1
  219. package/dist/locales/tr.js.map +1 -1
  220. package/dist/locales/uk.cjs +12 -0
  221. package/dist/locales/uk.cjs.map +1 -1
  222. package/dist/locales/uk.d.cts +4 -2
  223. package/dist/locales/uk.d.ts +4 -2
  224. package/dist/locales/uk.js +7 -1
  225. package/dist/locales/uk.js.map +1 -1
  226. package/dist/mcp-app.d.cts +491 -3
  227. package/dist/mcp-app.d.ts +491 -3
  228. package/dist/questions-Dw--IEjT.d.cts +100 -0
  229. package/dist/questions-Dw--IEjT.d.ts +100 -0
  230. package/dist/{types-BmvgYUzF.d.cts → types-CQquuZpl.d.cts} +1 -1
  231. package/dist/{types-Cr5gmUts.d.ts → types-CXZfZVP5.d.ts} +1 -1
  232. package/dist/{mcp-app-entry-BA-Ca39z.d.ts → types-DnBCok3z.d.cts} +2 -488
  233. package/dist/{mcp-app-entry-tybABaHg.d.cts → types-DnBCok3z.d.ts} +2 -488
  234. package/package.json +13 -3
@@ -0,0 +1,100 @@
1
+ import { AskUserRequest, AskUserContext, AskUserAnswer, AskUserConfig, AskUserHandler, AgentEvent } from '@dudko.dev/agent-web';
2
+
3
+ /**
4
+ * The model asks the person ONE closed question (the core's `ask_user`, `config.askUser`): the
5
+ * part of it that is not React - the queue the hook hands the core as `askUser.onQuestion`, the
6
+ * answer a prompt builds, and what of a question's tool result may be kept.
7
+ *
8
+ * Pure: no React, no clock of its own (the queue takes `now`), no import of the core at run time
9
+ * (types only), so the main entry still loads next to an older core.
10
+ *
11
+ * Nothing here keeps, logs or returns what the person typed (`{ other }`) except to the one caller
12
+ * that hands it to the core: the queue passes an answer straight to the core's resolver, and
13
+ * {@link withoutOwnWords} takes the person's words out of the events before a view keeps them.
14
+ */
15
+ /** The core's tool name (`ASK_USER_TOOL`). */
16
+ declare const ASK_USER_TOOL_NAME = "ask_user";
17
+ /** The core's default for `askUser.timeoutMs` (`ASK_USER_TIMEOUT_MS`). */
18
+ declare const QUESTION_TIMEOUT_MS = 300000;
19
+ /**
20
+ * A question waiting for the person: the core's request (the question and every option are the
21
+ * MODEL's text, cleaned - show them as plain text), and when the core stops waiting for it.
22
+ */
23
+ interface PendingQuestion extends AskUserRequest {
24
+ /** Epoch ms after which the core answers it by itself ("did not answer in time"); absent: no limit. */
25
+ expiresAt?: number;
26
+ }
27
+ /**
28
+ * How long the core waits for an answer with this `askUser`; `undefined` = no limit of its own
29
+ * (`0`, `Infinity`, more than a timer holds - the core's own rules).
30
+ */
31
+ declare const questionTimeoutOf: (askUser: boolean | AskUserConfig | undefined) => number | undefined;
32
+ /**
33
+ * `config.askUser` as `useAgent` builds the agent with it: on without a handler of its own
34
+ * (`true`, `{ timeoutMs, maxPerRun }`) it gets `handler`; a host's own `onQuestion` wins, and off
35
+ * (absent, `false`) stays off - nothing is added, so the core mounts no tool.
36
+ */
37
+ declare const askUserWith: (askUser: boolean | AskUserConfig | undefined, handler: AskUserHandler) => boolean | AskUserConfig | undefined;
38
+ interface QuestionQueueOptions {
39
+ /**
40
+ * How long the core waits (ms), for `expiresAt`; `undefined` = no limit. A function is read when
41
+ * a question arrives (the settings of the agent that asks).
42
+ */
43
+ timeoutMs?: number | (() => number | undefined);
44
+ /** Called whenever the list of waiting questions changed. */
45
+ onChange?: (pending: PendingQuestion[]) => void;
46
+ /** The clock (tests). */
47
+ now?: () => number;
48
+ }
49
+ interface QuestionQueue {
50
+ /** The core's `askUser.onQuestion`: resolves when the person answers, or as `{ declined: true }`. */
51
+ handler: (request: AskUserRequest, ctx?: AskUserContext) => Promise<AskUserAnswer>;
52
+ /** The questions waiting, oldest first. */
53
+ pending: () => PendingQuestion[];
54
+ /** Answer one. False when no such question is waiting (answered, expired, cancelled). */
55
+ answer: (id: string, answer: AskUserAnswer) => boolean;
56
+ /**
57
+ * Take the waiting questions down - all of them, or those `match` picks - as declined (the run
58
+ * ended, it was stopped). The core has usually stopped waiting already; this only makes sure no
59
+ * resolver is left.
60
+ */
61
+ cancel: (match?: (question: PendingQuestion) => boolean) => void;
62
+ /** Cancel everything and stop reporting: the owner is gone. A later question is declined at once. */
63
+ dispose: () => void;
64
+ }
65
+ /**
66
+ * The questions the model is waiting on: `request.id → resolver`. A question leaves the queue
67
+ * exactly once - answered by the person, dropped because the core no longer wants the answer
68
+ * (`ctx.signal`: its time ran out, the run stopped), or cancelled by its owner (the run ended, an
69
+ * unmount) - and the queue never holds an answer: `answer` passes it straight to the resolver.
70
+ */
71
+ declare const createQuestionQueue: (options?: QuestionQueueOptions) => QuestionQueue;
72
+ /**
73
+ * Why a question ended without the person deciding: the core's `AskUserReason`
74
+ * (`handler-error`, `invalid-answer`, `cannot-park`), or its action (`timeout`, `stopped`).
75
+ */
76
+ type QuestionOutcomeReason = 'timeout' | 'stopped' | 'handler-error' | 'invalid-answer' | 'cannot-park';
77
+ /**
78
+ * The person's picks as the core's answer: the labels that were offered, in the order they were
79
+ * offered, each once - and one only unless the question allows several. `undefined` when nothing
80
+ * that was offered is picked (Send stays off).
81
+ */
82
+ declare const questionChoiceOf: (question: Pick<AskUserRequest, "options" | "multiple">, picked: readonly string[]) => AskUserAnswer | undefined;
83
+ /**
84
+ * The person's own words as the core's answer, when the question allows them and there is
85
+ * anything but spaces; `undefined` otherwise (Send stays off). The text goes to the caller only.
86
+ */
87
+ declare const questionOtherOf: (question: Pick<AskUserRequest, "allowOther">, text: string) => AskUserAnswer | undefined;
88
+ /** Whether an `ask_user` result may be kept by a view: it holds no word the person typed. */
89
+ declare const askUserOutputKept: (output: unknown, ok: boolean) => boolean;
90
+ /**
91
+ * The event with the person's own words taken out: the result of an `ask_user` call that is not
92
+ * known to hold labels only (an answer in their own words) loses its `output` - in
93
+ * `step.tool-result`, in `step.complete`'s tool calls, and in a subagent's events at any depth.
94
+ * Everything else comes back as it was (the same object). The model was given the words; the
95
+ * view, the saved chat and the event log are not.
96
+ */
97
+ declare const withoutOwnWords: (event: AgentEvent) => AgentEvent;
98
+
99
+ export { ASK_USER_TOOL_NAME as A, QUESTION_TIMEOUT_MS as a, askUserOutputKept as d, askUserWith as e, createQuestionQueue as f, questionOtherOf as g, questionTimeoutOf as h, questionChoiceOf as q, withoutOwnWords as w };
100
+ export type { PendingQuestion as P, QuestionOutcomeReason as Q, QuestionQueue as b, QuestionQueueOptions as c };
@@ -1,4 +1,4 @@
1
- import { c as catalog } from './en-CcNUz2tN.cjs';
1
+ import { c as catalog } from './en-Dg2MtzcJ.cjs';
2
2
 
3
3
  /** The plural categories of `Intl.PluralRules`. */
4
4
  type AgentLabelPluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
@@ -1,4 +1,4 @@
1
- import { c as catalog } from './en-CcNUz2tN.js';
1
+ import { c as catalog } from './en-Dg2MtzcJ.js';
2
2
 
3
3
  /** The plural categories of `Intl.PluralRules`. */
4
4
  type AgentLabelPluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
@@ -1,5 +1,4 @@
1
- import { AgentToolSet, McpAppResource, McpAppToolResult, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, SessionHolder, ReplanMode, AgentEvent, McpAppCsp } from '@dudko.dev/agent-web';
2
- import { a as McpAppColorScheme } from './mcp-app-policy-DXKQ2jjM.js';
1
+ import { AgentToolSet, McpAppResource, McpAppToolResult, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, IPlan, AskUserOption, AskUserAction, SessionHolder, ReplanMode, AgentEvent } from '@dudko.dev/agent-web';
3
2
 
4
3
  /**
5
4
  * Structural types for the core's OPTIONAL `@dudko.dev/agent-web/mcp` subpath.
@@ -992,489 +991,4 @@ interface RemoteRunView {
992
991
  ended?: 'done' | 'stopped' | 'gone';
993
992
  }
994
993
 
995
- /**
996
- * MCP Apps, the host's side: the security core of `<McpAppFrame>`, as pure code - no React, no
997
- * DOM - so every guard is unit-tested (`tests/apps.test.ts`) and proved in a real browser
998
- * (`e2e/apps.spec.ts`).
999
- *
1000
- * The frame: an app is third-party HTML WITH scripts that must talk to the page, so it gets the
1001
- * HTML preview's boundary (`html-preview.ts`) and one addition, a relay:
1002
- *
1003
- * 1. The outer `<iframe sandbox="allow-scripts">` (never `allow-same-origin`): an opaque origin,
1004
- * no access to the page's DOM, storage, IndexedDB (the key vault) or cookies; no top
1005
- * navigation, popups, forms, modals, downloads. No `allow` attribute: no camera, microphone,
1006
- * geolocation or clipboard, whatever the app asked for.
1007
- * 2. It holds a SHELL of ours (`buildMcpAppDocument`): the policy built from the resource's
1008
- * declared origins and nothing else (`mcpAppCsp`), one inner frame - the app, also
1009
- * `sandbox="allow-scripts"`, with the same policy first in its own document - and a relay
1010
- * script. The shell's `frame-src 'none'` is what stops the app navigating itself (a frame
1011
- * may always navigate itself; only the EMBEDDING document's policy decides where to).
1012
- * 3. The relay forwards messages between the page and the app, and nothing else: from the
1013
- * app's window to the page, from the page to the app's window, never the
1014
- * `ui/notifications/sandbox-*` messages the specification reserves. The app talks to
1015
- * `window.parent` as the extension's SDK does; the page accepts messages only from the outer
1016
- * frame (`event.source`), so the app writing to `window.top` directly is ignored.
1017
- * 4. The bridge (`McpAppBridge`) answers the app: a method allow-list, checked parameters, a
1018
- * cap on requests in flight, and every request that DOES something (a tool call, a link, a
1019
- * message) handed to the host, which asks the user.
1020
- *
1021
- * That is the default. Opt-in, the app runs on an origin of its own instead, behind a sandbox
1022
- * page the host serves on another origin (the specification's "sandbox proxy"): 1 - 3 change
1023
- * (see "An app on an origin of its own" below and `mcp-app-policy.ts`), 4 does not.
1024
- */
1025
- /** The revision of the extension this host speaks. */
1026
- declare const MCP_APP_PROTOCOL_VERSION = "2026-01-26";
1027
- /** An app's frame height, before it says how tall it is. */
1028
- declare const APP_DEFAULT_HEIGHT = 360;
1029
- /**
1030
- * The frame's height is the host's: the app's wish, clamped to `APP_MIN_HEIGHT` .. the cap. The
1031
- * cap is `appHeightCap` of the chat's visible height - a few screens, never less than
1032
- * `APP_MAX_HEIGHT` - so an app as tall as its content has no scroller of its own inside the
1033
- * transcript (one scroller: the chat's), and an app that grows forever stops there.
1034
- */
1035
- declare const APP_MIN_HEIGHT = 120;
1036
- /** The least the cap is (and the cap where nothing says how tall the chat is). */
1037
- declare const APP_MAX_HEIGHT = 800;
1038
- /** The cap is this many of the chat's visible heights. */
1039
- declare const APP_HEIGHT_SCREENS = 3;
1040
- /** ... and never more than this, whatever the screen. */
1041
- declare const APP_HEIGHT_CEILING = 6000;
1042
- /**
1043
- * The tallest an inline app's frame is drawn, for a chat body (or viewport) `viewHeight` px tall:
1044
- * `APP_HEIGHT_SCREENS` of it, rounded down to 100 px (the app is told it in
1045
- * `containerDimensions.maxHeight`, and a resize of a few pixels must not tell it again), at least
1046
- * `APP_MAX_HEIGHT`, at most `APP_HEIGHT_CEILING`.
1047
- */
1048
- declare const appHeightCap: (viewHeight: number | undefined) => number;
1049
- /**
1050
- * The cap of a frame that is already drawn, when the chat's height changes: `appHeightCap` of the
1051
- * new height, but never less than the cap the frame had (`current`) - a rotation, a keyboard
1052
- * resizing the page or a relayout for a touch screen must not give an app that was drawn whole a
1053
- * scroller of its own. The cap only grows while the frame is shown (at most
1054
- * `APP_HEIGHT_CEILING`); a new frame starts from the cap of its moment.
1055
- */
1056
- declare const nextAppHeightCap: (current: number, viewHeight: number | undefined) => number;
1057
- /** At most this many requests of one app wait at once (tool calls, links, messages). */
1058
- declare const MCP_APP_MAX_IN_FLIGHT = 3;
1059
- /** A message an app puts in the chat: at most this many characters. */
1060
- declare const MCP_APP_MAX_MESSAGE_CHARS = 4000;
1061
- /** A link an app asks to open: at most this many characters. */
1062
- declare const MCP_APP_MAX_URL_CHARS = 2048;
1063
- /** The arguments of a tool call an app makes: at most this many characters as JSON. */
1064
- declare const MCP_APP_MAX_ARGS_CHARS = 64000;
1065
- /** An app's wish for a height, as the frame draws it: within `APP_MIN_HEIGHT` .. `max` (the cap). */
1066
- declare const clampAppHeight: (height: number, max?: number) => number;
1067
- /**
1068
- * The policy of an app's document: scripts and styles inline, `data:` / `blob:` media, and the
1069
- * network ONLY where the resource declared it - `connectDomains` for `fetch` / XHR / WebSocket,
1070
- * `resourceDomains` for scripts, styles, images, fonts and media. Nothing declared, nothing
1071
- * reached. Nested frames, workers, plugins, forms and `<base>` are refused whatever was declared
1072
- * (`frameDomains` / `baseUriDomains` are not granted: a frame the app may embed would also be a
1073
- * place it may navigate itself to). Each entry is checked again with the core's `mcpAppOrigin`.
1074
- */
1075
- declare const mcpAppCsp: (csp?: Partial<McpAppCsp>) => string;
1076
- /** The origins the policy actually grants: what the app is told in `hostCapabilities.sandbox`. */
1077
- declare const grantedAppCsp: (csp?: Partial<McpAppCsp>) => {
1078
- connectDomains: string[];
1079
- resourceDomains: string[];
1080
- };
1081
- /**
1082
- * The relay of the shell: the app's messages to the page, the page's to the app - matched by
1083
- * `event.source`, never by anything the message says - and not the reserved
1084
- * `ui/notifications/sandbox-*` ones. It reads nothing else and runs nothing it is sent.
1085
- */
1086
- declare const MCP_APP_RELAY: string;
1087
- /**
1088
- * What goes into the OUTER frame's `srcdoc`: the shell (the app's policy first, one inner frame
1089
- * that fills it, the relay) carrying the app, escaped, as the inner frame's `srcdoc` - with the
1090
- * same policy first in it. Give the outer `<iframe>` `sandbox="allow-scripts"` and nothing else.
1091
- * `scheme` (the theme the app is told) is declared by the shell and its inner frame; give the
1092
- * outer `<iframe>` the same `color-scheme`. Only `light` / `dark` are declared.
1093
- */
1094
- declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp>, scheme?: McpAppColorScheme) => string;
1095
- /** A link an app asks to open, taken apart for the prompt: the host is what the user checks. */
1096
- interface AppLink {
1097
- /** The normalised URL (what is opened). */
1098
- href: string;
1099
- /** `https://` */
1100
- scheme: string;
1101
- /** The host (and port), as the browser will go there - an internationalised name in punycode. */
1102
- host: string;
1103
- /** Everything after the host. */
1104
- rest: string;
1105
- }
1106
- /** An `http(s)` URL with a host and no credentials, at most `MCP_APP_MAX_URL_CHARS`; else none. */
1107
- declare const appLinkOf: (value: unknown) => AppLink | undefined;
1108
- /**
1109
- * The text of a `ui/message` an app sends: text blocks only (one, or a list of at most 20),
1110
- * joined, without invisible characters, at most `MCP_APP_MAX_MESSAGE_CHARS`. Anything else -
1111
- * an image, a resource, an empty or a longer text - is refused (`undefined`).
1112
- */
1113
- declare const appMessageTextOf: (content: unknown) => string | undefined;
1114
- /** A JSON-RPC message as the bridge sends it. */
1115
- type McpAppRpcMessage = {
1116
- jsonrpc: '2.0';
1117
- id: string | number;
1118
- method: string;
1119
- params?: unknown;
1120
- } | {
1121
- jsonrpc: '2.0';
1122
- method: string;
1123
- params?: unknown;
1124
- } | {
1125
- jsonrpc: '2.0';
1126
- id: string | number;
1127
- result: unknown;
1128
- } | {
1129
- jsonrpc: '2.0';
1130
- id: string | number;
1131
- error: {
1132
- code: number;
1133
- message: string;
1134
- };
1135
- };
1136
- /** The requests an app may make of this host. Any other is answered "method not found". */
1137
- declare const MCP_APP_REQUESTS: readonly ["ui/initialize", "ping", "tools/call", "ui/open-link", "ui/message", "ui/request-display-mode"];
1138
- /**
1139
- * Requests answered only when the host turned the feature on (`downloadFile` / `sampling` in
1140
- * `hostCapabilities`, a handler given to the bridge); otherwise "method not found", as before.
1141
- */
1142
- declare const MCP_APP_OPTIONAL_REQUESTS: readonly ["ui/download-file", "sampling/createMessage"];
1143
- /** The notifications this host reads. Any other is dropped. */
1144
- declare const MCP_APP_NOTIFICATIONS: readonly ["ui/notifications/initialized", "ui/notifications/size-changed"];
1145
- /** An error the bridge answers with: a JSON-RPC code and a message for the app. */
1146
- declare class McpAppRpcError extends Error {
1147
- readonly code: number;
1148
- constructor(code: number, message: string);
1149
- }
1150
- /** The host refused: the user said no, too many requests, not initialized. */
1151
- declare const MCP_APP_REFUSED = -32000;
1152
- /** How an app is shown (`hostContext.displayMode`). This host offers `inline` and `fullscreen`. */
1153
- type McpAppDisplayMode = 'inline' | 'fullscreen' | 'pip';
1154
- /** The modes the extension names (a request for any other is invalid). */
1155
- declare const MCP_APP_DISPLAY_MODES: readonly McpAppDisplayMode[];
1156
- /** A file an app asks the host to save (`ui/download-file`), as checked by `appDownloadOf`. */
1157
- type AppDownload = {
1158
- kind: 'embedded';
1159
- /** The file name, sanitized (`appFileNameOf`): what it is saved as. */
1160
- name: string;
1161
- /** The type the app declared, if it is a MIME type at all. */
1162
- mimeType?: string;
1163
- bytes: Uint8Array;
1164
- } | {
1165
- /** A `resource_link`: read with `resources/read` on the app's own server, never fetched. */
1166
- kind: 'link';
1167
- uri: string;
1168
- name: string;
1169
- mimeType?: string;
1170
- };
1171
- /** What the host does for an app (the user is asked inside these, never by the bridge). */
1172
- interface McpAppBridgeHandlers {
1173
- /** A `tools/call`: resolves with the result the app is given; throws when refused. */
1174
- callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
1175
- /** A link (already checked): resolves true when it was opened, false when the user said no. */
1176
- openLink: (link: AppLink) => Promise<boolean>;
1177
- /** A message (already cleaned): resolves true when it was accepted, false when not. */
1178
- message: (text: string) => Promise<boolean>;
1179
- /** The app's wish for a height (the caller clamps it). */
1180
- resize: (height: number) => void;
1181
- /**
1182
- * `ui/request-display-mode` for a mode the host offers and the app declared (or `inline`):
1183
- * the mode the app is in afterwards - the host may say no and answer the current one.
1184
- * Without it, an app stays where it is.
1185
- */
1186
- displayMode?: (mode: McpAppDisplayMode) => McpAppDisplayMode | Promise<McpAppDisplayMode>;
1187
- /**
1188
- * `ui/download-file` (already checked): true once the file was saved, false when the user said
1189
- * no. Without it the method is not offered (`hostCapabilities.downloadFile` absent).
1190
- */
1191
- downloadFile?: (file: AppDownload) => Promise<boolean>;
1192
- /**
1193
- * `sampling/createMessage`: the result for the app; throws (an `McpAppRpcError`) when refused.
1194
- * Without it the method is not offered (`hostCapabilities.sampling` absent).
1195
- */
1196
- sample?: (params: Record<string, unknown>) => Promise<unknown>;
1197
- }
1198
- interface McpAppBridgeOptions {
1199
- /** Send a message to the app (the page posts it to the outer frame). */
1200
- post: (message: McpAppRpcMessage) => void;
1201
- handlers: McpAppBridgeHandlers;
1202
- hostInfo: {
1203
- name: string;
1204
- version: string;
1205
- };
1206
- hostCapabilities: Record<string, unknown>;
1207
- hostContext: Record<string, unknown>;
1208
- /** The tool call's arguments: sent once the app says it is initialized. */
1209
- toolInput: Record<string, unknown>;
1210
- /** Its result; `undefined` = the app is told the call was cancelled (`reason`). */
1211
- toolResult?: unknown;
1212
- cancelledReason?: string;
1213
- maxInFlight?: number;
1214
- }
1215
- /**
1216
- * One app's conversation with the host (the extension's JSON-RPC over `postMessage`). It never
1217
- * touches the DOM: `receive` is given what arrived - from the right frame, the caller checked
1218
- * `event.source` - and `post` sends. Requests outside the allow-list get "method not found";
1219
- * before `ui/initialize`, only `ping` is answered; parameters are checked before a handler sees
1220
- * them; at most `maxInFlight` requests run at once. The tool's input and result are sent once,
1221
- * after the app's `ui/notifications/initialized`, as the specification requires.
1222
- */
1223
- declare class McpAppBridge {
1224
- private readonly o;
1225
- private initializeSeen;
1226
- private delivered;
1227
- private inFlight;
1228
- private closed;
1229
- private seq;
1230
- private appModes;
1231
- constructor(options: McpAppBridgeOptions);
1232
- /** The app said it is ready, and was given the tool's input and result. */
1233
- get initialized(): boolean;
1234
- /** Stop answering: the frame is gone or was reloaded. */
1235
- close(): void;
1236
- /** Tell the app it is being torn down (not waited for: the frame goes anyway). */
1237
- teardown(reason: string): void;
1238
- /** The display modes the app declared at `ui/initialize` (undefined: none, or not yet). */
1239
- get appDisplayModes(): readonly McpAppDisplayMode[] | undefined;
1240
- /** How the app is shown now (`hostContext.displayMode`). */
1241
- get displayMode(): McpAppDisplayMode;
1242
- /** Tell an initialized app that part of the host context changed (the theme). */
1243
- updateContext(patch: Record<string, unknown>): void;
1244
- /** One message from the app's frame. */
1245
- receive(data: unknown): void;
1246
- private send;
1247
- private error;
1248
- private notification;
1249
- private request;
1250
- }
1251
- /**
1252
- * What this host tells an app it can do (`hostCapabilities` of `ui/initialize`): only what it
1253
- * does. `downloadFile` and `sampling` (never `sampling.tools`) only when the host turned them on.
1254
- */
1255
- declare const mcpAppHostCapabilities: (csp?: Partial<McpAppCsp>, features?: {
1256
- downloadFile?: boolean;
1257
- sampling?: boolean;
1258
- }) => Record<string, unknown>;
1259
- /**
1260
- * Whether a display mode an app asks for may be given: `inline` always (the way back needs no
1261
- * permission); any other only when the host offers it AND the app declared it in
1262
- * `appCapabilities.availableDisplayModes` - an app that declared nothing stays inline (the
1263
- * specification lets a host decline it).
1264
- */
1265
- declare const appDisplayModeAllowed: (o: {
1266
- requested: McpAppDisplayMode;
1267
- current: McpAppDisplayMode;
1268
- host: readonly McpAppDisplayMode[];
1269
- app: readonly McpAppDisplayMode[] | undefined;
1270
- }) => boolean;
1271
- /**
1272
- * Whether the user just acted INSIDE the app's frame: the page's frame element has the focus
1273
- * (a click or a key in a frame focuses it) and the page has transient user activation (an
1274
- * activation in a frame reaches every page above it, for a few seconds). Where the browser has
1275
- * no `navigator.userActivation`, the focus alone.
1276
- */
1277
- declare const appGestureOf: (o: {
1278
- focused: boolean;
1279
- activation: boolean | undefined;
1280
- }) => boolean;
1281
- /** A file an app asks to save: at most this many bytes. */
1282
- declare const MCP_APP_MAX_DOWNLOAD_BYTES: number;
1283
- /** A saved file's name: at most this many characters (the extension kept). */
1284
- declare const MCP_APP_MAX_FILE_NAME_CHARS = 100;
1285
- /**
1286
- * Extensions this host never saves: programs, scripts, installers, shortcuts, disk images - and
1287
- * documents a browser runs scripts in when they are opened (HTML, SVG, XML).
1288
- */
1289
- declare const MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS: readonly string[];
1290
- /** Types this host never saves (the same kinds), and any `…+xml`. */
1291
- declare const MCP_APP_REFUSED_DOWNLOAD_TYPES: readonly string[];
1292
- /** A declared type as a bare MIME type (`text/plain`), or undefined when it is not one. */
1293
- declare const appMimeTypeOf: (value: unknown) => string | undefined;
1294
- /**
1295
- * The name a file is saved under: the last segment of a path or URI (`file:///x/report.json` →
1296
- * `report.json`; percent-encoding decoded, and split again), without what cannot be seen or
1297
- * reserved characters (`<>:"/\|?*`, controls), no leading dots (a hidden file) or trailing dots
1298
- * and spaces, not a Windows device name, at most `MCP_APP_MAX_FILE_NAME_CHARS` with the extension
1299
- * kept; `download` when nothing is left.
1300
- */
1301
- declare const appFileNameOf: (value: unknown) => string;
1302
- /** The extension of a (sanitized) file name, lowercased, without the dot; '' when none. */
1303
- declare const appFileExtensionOf: (name: string) => string;
1304
- /**
1305
- * Why a file may not be saved, or undefined when it may: an extension or a type of the refused
1306
- * lists (a program, a script, a page a browser would run), checked on the sanitized name and
1307
- * the declared type both.
1308
- */
1309
- declare const appDownloadRefusal: (name: string, mimeType?: string) => string | undefined;
1310
- /**
1311
- * What `ui/download-file` asks for, checked - or why not (a message for the app): ONE item of
1312
- * `contents` (one file per request, one prompt); an `EmbeddedResource` (`resource.uri` names
1313
- * it, `text` as UTF-8 or base64 `blob`, at most `maxBytes`) or a `ResourceLink` (a one-line URI,
1314
- * read later from the app's own server: the name is its last segment, else its `name`); the
1315
- * name sanitized and the name and type not refused (`appDownloadRefusal`).
1316
- */
1317
- declare const appDownloadOf: (params: unknown, maxBytes?: number) => AppDownload | string;
1318
- /** A file ready to be put to the user: its name, type, bytes, and where the bytes came from. */
1319
- interface AppReadyDownload {
1320
- name: string;
1321
- mimeType?: string;
1322
- bytes: Uint8Array;
1323
- source: 'embedded' | 'link';
1324
- }
1325
- /** How a linked file is read: `resources/read` on the app's OWN server (the connection's). */
1326
- type AppResourceReader = (server: string, uri: string, options: {
1327
- signal?: AbortSignal;
1328
- maxBytes: number;
1329
- }) => Promise<{
1330
- mimeType?: string;
1331
- bytes: Uint8Array;
1332
- }>;
1333
- /**
1334
- * The bytes of a checked file: an embedded one as it came; a linked one read from `server` -
1335
- * the app's own - through `read` (never a fetch of its URI), at most `maxBytes`, and the type the
1336
- * SERVER gives it judged again (an app cannot pass a page off as a text file through a link).
1337
- * Throws an `McpAppRpcError` for the app: no reader, a failed read, a refused type, too large.
1338
- */
1339
- declare const resolveAppDownload: (file: AppDownload, server: string, read: AppResourceReader | undefined, signal?: AbortSignal, maxBytes?: number) => Promise<AppReadyDownload>;
1340
- /**
1341
- * The error an app is told when the agent did not answer its sampling request: the core's
1342
- * `AppSamplingError` carries its JSON-RPC code (`-1`: the user said no, `-32602`: not a request
1343
- * this host takes, `-32000`: too many); anything else is a refusal.
1344
- */
1345
- declare const appSamplingErrorOf: (err: unknown) => McpAppRpcError;
1346
- /** What `saveAppFile` uses of the page (passed in: this module touches no DOM by itself). */
1347
- interface AppFileSaverEnv {
1348
- document: {
1349
- createElement: (tag: 'a') => HTMLAnchorElement;
1350
- body: {
1351
- append: (n: Node) => void;
1352
- };
1353
- };
1354
- URL: {
1355
- createObjectURL: (blob: Blob) => string;
1356
- revokeObjectURL: (url: string) => void;
1357
- };
1358
- setTimeout: (fn: () => void, ms: number) => unknown;
1359
- }
1360
- /**
1361
- * Save a checked file the user agreed to: a `Blob` of type `application/octet-stream` (the
1362
- * browser never renders or sniffs it as a page), a `blob:` URL of THIS page, an `<a download>`
1363
- * made here and clicked once. No navigation, no `data:` or `javascript:` URL, nothing of the app
1364
- * in the page; the URL is revoked a minute later.
1365
- */
1366
- declare const saveAppFile: (file: {
1367
- name: string;
1368
- bytes: Uint8Array;
1369
- }, env: AppFileSaverEnv) => void;
1370
- /** `<AgentChat appSandbox>` / `useMcpAppHost({ sandbox })`. */
1371
- interface McpAppSandboxOptions {
1372
- /**
1373
- * The sandbox page's base URL on another origin you serve (`mcpAppSandboxResponse` of the
1374
- * `./mcp-app-sandbox` entry), e.g. `https://apps.example.com/sandbox/v1`; an app's frame loads
1375
- * `<url>/<policy>`. `{server}` in the host name gives each server an origin of its own
1376
- * (`https://{server}.apps.example.com/sandbox/v1`; the server's name must be a DNS label - it
1377
- * needs a wildcard certificate). `https://` only; `http://` on `localhost` / `127.0.0.1`.
1378
- */
1379
- url: string;
1380
- /** How long a frame waits for the page's handshake before it falls back (default 5000 ms). */
1381
- timeoutMs?: number;
1382
- }
1383
- /** Why an app runs in the opaque frame although a sandbox URL is set. */
1384
- type McpAppSandboxReason = 'invalid' | 'insecure' | 'same-origin' | 'no-page-origin' | 'server-name' | 'too-many-origins' | 'no-answer';
1385
- type McpAppSandboxTarget = {
1386
- ok: true;
1387
- origin: string;
1388
- base: string;
1389
- } | {
1390
- ok: false;
1391
- reason: McpAppSandboxReason;
1392
- };
1393
- /** The placeholder for the server's name in `McpAppSandboxOptions.url`. */
1394
- declare const MCP_APP_SANDBOX_SERVER = "{server}";
1395
- declare const MCP_APP_SANDBOX_TIMEOUT_MS = 5000;
1396
- /** After the shell has loaded (the proxy loaded or failed), the handshake gets this much longer. */
1397
- declare const MCP_APP_SANDBOX_GRACE_MS = 1000;
1398
- /**
1399
- * The sandbox flags of the shell's frame and of the proxy's: scripts and an origin - the shell
1400
- * must keep YOUR origin (else the proxy below it would get an opaque one) and runs no script; the
1401
- * proxy is on the sandbox origin. Nothing else: no navigation, popup, form, modal, download.
1402
- */
1403
- declare const MCP_APP_SANDBOX_FRAME_TOKENS = "allow-scripts allow-same-origin";
1404
- /**
1405
- * Where an app of `server` runs, for a page on `pageOrigin`: the sandbox's origin and base URL,
1406
- * or why not. Refused: not a URL; credentials, a query or a fragment; not `https://` (`http://`
1407
- * only on `localhost` / `127.0.0.1`); a path a policy cannot name; `{server}` anywhere but the
1408
- * host name, more than once, or a server name that is not a lowercase DNS label; a page without
1409
- * an origin; and the sandbox on the PAGE'S OWN origin - `allow-same-origin` there would hand the
1410
- * app your storage and the key vault.
1411
- */
1412
- declare const mcpAppSandboxTarget: (options: McpAppSandboxOptions | undefined, server: string, pageOrigin: string | undefined) => McpAppSandboxTarget;
1413
- /** The proxy page's URL for an app's declared origins (`<base>/<policy>`), or none if too long. */
1414
- declare const mcpAppSandboxProxyUrl: (base: string, csp?: Partial<McpAppCsp>) => string | undefined;
1415
- /**
1416
- * The policy of the shell: no script at all, and frames from the proxy's exact URL only - a
1417
- * `frame-src` with a path matches that path and nothing else (the query is not part of the
1418
- * match), so the proxy's frame can never be navigated anywhere else.
1419
- */
1420
- declare const mcpAppSandboxShellCsp: (proxyUrl: string) => string;
1421
- /**
1422
- * What goes into the OUTER frame's `srcdoc` in sandbox mode: the shell - its policy first, one
1423
- * frame of the proxy page, no script, nothing of the app. Give the outer `<iframe>`
1424
- * `sandbox={MCP_APP_SANDBOX_FRAME_TOKENS}` and nothing else. Throws on a URL that is not a proxy
1425
- * URL this package builds (`mcpAppSandboxProxyUrl`). `scheme` is declared by the shell and its
1426
- * frame, and handed to the proxy page as `?scheme=` on its frame's `src` ONLY: the shell's
1427
- * `frame-src` stays the path (a source expression carries no query, and a path source ignores
1428
- * one), so the pin is the same with or without it.
1429
- */
1430
- declare const buildMcpAppSandboxShell: (proxyUrl: string, scheme?: McpAppColorScheme) => string;
1431
- /** What one message from the proxy's frame is, for the page (`McpAppSandboxLink.receive`). */
1432
- type McpAppSandboxInput = 'drop' | 'ready' | 'broken' | 'app';
1433
- interface McpAppSandboxLinkOptions {
1434
- /** The sandbox origin (`mcpAppSandboxTarget(…).origin`). */
1435
- origin: string;
1436
- /** The app, as read from its server: sent once, on the proxy's first ready. */
1437
- html: string;
1438
- csp?: Partial<McpAppCsp>;
1439
- /** Post to the proxy's window. Always called with the sandbox origin as the target - never `*`. */
1440
- post: (message: unknown, targetOrigin: string) => void;
1441
- }
1442
- /**
1443
- * The page's side of the sandbox proxy, without the DOM: which messages are the proxy's, the
1444
- * handshake, and every post to the sandbox origin. A message is the proxy's only when it comes
1445
- * from the proxy's window (`event.source`) AND from the sandbox origin (`event.origin`). The
1446
- * first `sandbox-proxy-ready` is answered with the app (`sandbox-resource-ready`); another one
1447
- * means the proxy page was loaded again - by the app - and the link breaks (`'broken'`: stop the
1448
- * app). Every other `ui/notifications/sandbox-*` message is dropped; nothing reaches the bridge
1449
- * (`'app'`) before the app was handed over.
1450
- */
1451
- declare class McpAppSandboxLink {
1452
- private readonly o;
1453
- private state;
1454
- constructor(options: McpAppSandboxLinkOptions);
1455
- /** The proxy answered and was given the app. */
1456
- get ready(): boolean;
1457
- /** The proxy page was loaded a second time: the app must be stopped. */
1458
- get broken(): boolean;
1459
- /** Whether a message event is the proxy's: its window, and the sandbox origin. */
1460
- accepts(event: {
1461
- source: unknown;
1462
- origin: string;
1463
- }, proxy: unknown): boolean;
1464
- receive(event: {
1465
- source: unknown;
1466
- origin: string;
1467
- data: unknown;
1468
- }, proxy: unknown): McpAppSandboxInput;
1469
- /** Send a message to the app, through the proxy, to the sandbox origin. Nothing once broken. */
1470
- post(message: unknown): void;
1471
- close(): void;
1472
- }
1473
- /**
1474
- * A pending consent request of THIS frame (`ApprovalView.app.frame`, set by `useAgent`); for a
1475
- * request that names no frame (a host's own gate), one of this app's server and resource.
1476
- */
1477
- declare const isApprovalOfApp: (approval: ApprovalView, app: AppView) => boolean;
1478
-
1479
- export { APP_DEFAULT_HEIGHT as V, APP_HEIGHT_CEILING as X, APP_HEIGHT_SCREENS as Y, APP_MAX_HEIGHT as Z, APP_MIN_HEIGHT as _, MCP_APP_DISPLAY_MODES as a4, MCP_APP_MAX_ARGS_CHARS as a5, MCP_APP_MAX_DOWNLOAD_BYTES as a6, MCP_APP_MAX_FILE_NAME_CHARS as a7, MCP_APP_MAX_IN_FLIGHT as a8, MCP_APP_MAX_MESSAGE_CHARS as a9, appDownloadRefusal as aA, appFileExtensionOf as aB, appFileNameOf as aC, appGestureOf as aD, appHeightCap as aE, appLinkOf as aF, appMessageTextOf as aG, appMimeTypeOf as aH, appSamplingErrorOf as aI, buildMcpAppDocument as aJ, buildMcpAppSandboxShell as aK, clampAppHeight as aL, grantedAppCsp as aM, isApprovalOfApp as aN, mcpAppCsp as aO, mcpAppHostCapabilities as aP, mcpAppSandboxProxyUrl as aQ, mcpAppSandboxShellCsp as aR, mcpAppSandboxTarget as aS, nextAppHeightCap as aT, resolveAppDownload as aU, saveAppFile as aV, MCP_APP_MAX_URL_CHARS as aa, MCP_APP_NOTIFICATIONS as ab, MCP_APP_OPTIONAL_REQUESTS as ac, MCP_APP_PROTOCOL_VERSION as ad, MCP_APP_REFUSED as ae, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as af, MCP_APP_REFUSED_DOWNLOAD_TYPES as ag, MCP_APP_RELAY as ah, MCP_APP_REQUESTS as ai, MCP_APP_SANDBOX_FRAME_TOKENS as aj, MCP_APP_SANDBOX_GRACE_MS as ak, MCP_APP_SANDBOX_SERVER as al, MCP_APP_SANDBOX_TIMEOUT_MS as am, McpAppBridge as an, McpAppRpcError as ar, McpAppSandboxLink as au, appDisplayModeAllowed as ay, appDownloadOf as az };
1480
- export type { AppDownload as $, AgentUiState as A, BrowserOAuthProvider as B, ChatAttachment as C, DecisionView as D, ElicitationView as E, FetchView as F, MediaView as G, ModelLoadState as H, QueuedMessageView as I, ReplanState as J, SkillConsentView as K, LessonView as L, McpElicitationFieldSchema as M, StepEscalationView as N, StepView as O, TranscriptView as P, QuestionView as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, WrittenFileView as W, McpElicitationHandler as a, AppFileSaverEnv as a0, AppLink as a1, AppReadyDownload as a2, AppResourceReader as a3, McpAppBridgeHandlers as ao, McpAppBridgeOptions as ap, McpAppDisplayMode as aq, McpAppRpcMessage as as, McpAppSandboxInput as at, McpAppSandboxLinkOptions as av, McpAppSandboxOptions as aw, McpAppSandboxTarget as ax, McpElicitationRequest as b, McpElicitationResult as c, McpElicitationOptions as d, McpElicitationSchema as e, AgentStatus as f, McpAppSandboxReason as g, ChatMessage as h, ApprovalView as i, SubagentNode as j, AppView as k, BrowserOAuthProviderOptions as l, BudgetView as m, CompactionView as n, ConnectedMcp as o, McpAppsConnectionLike as p, McpCatalogEntry as q, McpHttpServerConfig as r, McpModule as s, McpOAuthCallback as t, McpOAuthRegistration as u, McpOAuthRegistrationKind as v, McpProtocolMode as w, McpServerInstructions as x, McpServerProtocol as y, McpServerResult as z };
994
+ export type { AgentUiState as A, BrowserOAuthProvider as B, ChatAttachment as C, DecisionView as D, ElicitationView as E, FetchView as F, ModelLoadState as G, QueuedMessageView as H, ReplanState as I, SkillConsentView as J, StepEscalationView as K, LessonView as L, McpElicitationFieldSchema as M, StepView as N, TranscriptView as O, QuestionView as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, WrittenFileView as W, ChatMessage as a, ApprovalView as b, McpElicitationHandler as c, McpElicitationRequest as d, McpElicitationResult as e, McpElicitationOptions as f, McpElicitationSchema as g, AgentStatus as h, SubagentNode as i, AppView as j, BrowserOAuthProviderOptions as k, BudgetView as l, CompactionView as m, ConnectedMcp as n, McpAppsConnectionLike as o, McpCatalogEntry as p, McpHttpServerConfig as q, McpModule as r, McpOAuthCallback as s, McpOAuthRegistration as t, McpOAuthRegistrationKind as u, McpProtocolMode as v, McpServerInstructions as w, McpServerProtocol as x, McpServerResult as y, MediaView as z };