apps 0.0.1-beta.4 → 0.0.1-beta.41

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 (171) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-QKHR7BMF.js → chunk-3MMG2H6M.js} +89 -53
  4. package/js/{chunk-EQB7JMAL.js → chunk-6XGB4BAL.js} +146 -31
  5. package/js/chunk-ADD6H64X.js +729 -0
  6. package/js/{chunk-6VRYO2BG.js → chunk-AHGGO2VY.js} +837 -254
  7. package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
  8. package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
  9. package/js/chunk-EM4UL26F.js +118 -0
  10. package/js/{chunk-2VPJHFOU.js → chunk-FXWRE655.js} +128 -24
  11. package/js/{chunk-5MQZEB6Y.js → chunk-JI3EP2GL.js} +40 -12
  12. package/js/chunk-JJSLEJ6T.js +156 -0
  13. package/js/chunk-KAQD3DTI.js +16 -0
  14. package/js/chunk-KIM5HXNK.js +49 -0
  15. package/js/chunk-MJZYV7IO.js +255 -0
  16. package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
  17. package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
  18. package/js/chunk-OD3KFKZD.js +1617 -0
  19. package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
  20. package/js/chunk-P7MGDPFD.js +240 -0
  21. package/js/{chunk-ZCAMUXSG.js → chunk-PNVCCB4L.js} +432 -79
  22. package/js/{chunk-D47C7KG5.js → chunk-RIXVGVA6.js} +2 -2
  23. package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
  24. package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
  25. package/js/chunk-UTJIGUSS.js +42 -0
  26. package/js/{chunk-G7ZIRKMK.js → chunk-VIU2XXA7.js} +228 -264
  27. package/js/{chunk-HDJH3RPR.js → chunk-VJQXXOQ3.js} +4 -4
  28. package/js/{chunk-WFSQXYUT.js → chunk-WPBR4AWB.js} +523 -63
  29. package/js/{chunk-SATWJKN6.js → chunk-YQ35E7KS.js} +2 -2
  30. package/js/chunk-ZUKBIHMK.js +92 -0
  31. package/js/client.js +122 -88
  32. package/js/contracts.js +116 -25
  33. package/js/effect.js +19 -20
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +57 -55
  36. package/js/host.js +19 -20
  37. package/js/index.js +245 -212
  38. package/js/mcp/effect.js +23 -22
  39. package/js/mcp/stdio.js +34 -30
  40. package/js/mcp.js +104 -68
  41. package/js/openapi.js +4087 -1503
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +147 -65
  45. package/js/storage/facet.js +1 -540
  46. package/js/ui/auth/contracts.js +2 -2
  47. package/js/ui/auth.js +5 -5
  48. package/js/ui/contracts.js +5 -4
  49. package/js/ui/serving.js +8517 -214
  50. package/package.json +2 -3
  51. package/runtime.json +1 -1
  52. package/types/app-data/src/contracts/database.d.ts +33 -6
  53. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  54. package/types/apps/src/contracts/app.d.ts +7 -8
  55. package/types/apps/src/contracts/cache.d.ts +14 -0
  56. package/types/apps/src/contracts/context.d.ts +12 -11
  57. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  58. package/types/apps/src/contracts/failure.d.ts +54 -0
  59. package/types/apps/src/contracts/graphql.d.ts +2 -1
  60. package/types/apps/src/contracts/host.d.ts +44 -17
  61. package/types/apps/src/contracts/live.d.ts +2 -0
  62. package/types/apps/src/contracts/mcp.d.ts +96 -10
  63. package/types/apps/src/contracts/network.d.ts +84 -0
  64. package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
  65. package/types/apps/src/contracts/openapi.d.ts +45 -9
  66. package/types/apps/src/contracts/operations.d.ts +8 -9
  67. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  68. package/types/apps/src/contracts/protocols/1.d.ts +263 -74
  69. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  70. package/types/apps/src/contracts/protocols/2.d.ts +66 -24
  71. package/types/apps/src/contracts/protocols/3.d.ts +715 -0
  72. package/types/apps/src/contracts/protocols/4.d.ts +1297 -0
  73. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  74. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  75. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  76. package/types/apps/src/contracts/protocols/8.d.ts +1130 -0
  77. package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
  78. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  79. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  80. package/types/apps/src/contracts/provider.d.ts +115 -10
  81. package/types/apps/src/contracts/router.d.ts +59 -0
  82. package/types/apps/src/contracts/skills.d.ts +39 -9
  83. package/types/apps/src/contracts/sql.d.ts +58 -0
  84. package/types/apps/src/contracts/ui.d.ts +19 -1
  85. package/types/apps/src/contracts/workflows.d.ts +40 -3
  86. package/types/apps/src/facet.d.ts +4 -5
  87. package/types/apps/src/graphql.d.ts +1 -3
  88. package/types/apps/src/implementation/account-router.d.ts +12 -0
  89. package/types/apps/src/implementation/app.d.ts +5 -4
  90. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  91. package/types/apps/src/implementation/catalog-cache.d.ts +32 -5
  92. package/types/apps/src/implementation/elicitation.d.ts +12 -12
  93. package/types/apps/src/implementation/failure-detail.d.ts +47 -0
  94. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  95. package/types/apps/src/implementation/graphql.d.ts +4 -3
  96. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  97. package/types/apps/src/implementation/live.d.ts +2 -2
  98. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  99. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  100. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  101. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  102. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  103. package/types/apps/src/implementation/mcp.d.ts +52 -25
  104. package/types/apps/src/implementation/network.d.ts +16 -0
  105. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  106. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  107. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  108. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  109. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  110. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  111. package/types/apps/src/implementation/operations.d.ts +36 -3
  112. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  113. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  114. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  115. package/types/apps/src/implementation/provider.d.ts +19 -5
  116. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  117. package/types/apps/src/implementation/router-catalog.d.ts +223 -0
  118. package/types/apps/src/implementation/router.d.ts +68 -0
  119. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  120. package/types/apps/src/implementation/schema.d.ts +95 -11
  121. package/types/apps/src/implementation/skills.d.ts +18 -24
  122. package/types/apps/src/implementation/sql.d.ts +66 -0
  123. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  124. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  125. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  126. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  127. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  128. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  129. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  130. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  131. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  132. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  133. package/types/apps/src/index.d.ts +30 -13
  134. package/types/apps/src/mcp-stdio.d.ts +2 -5
  135. package/types/apps/src/mcp.d.ts +25 -5
  136. package/types/apps/src/openapi.d.ts +6 -6
  137. package/types/apps/src/react.d.ts +1 -1
  138. package/types/apps/src/skills.d.ts +10 -8
  139. package/types/telemetry/src/app-records.d.ts +42 -0
  140. package/types/telemetry/src/browser-operations.d.ts +6 -3
  141. package/types/telemetry/src/browser.d.ts +2 -2
  142. package/types/telemetry/src/config.d.ts +2 -2
  143. package/types/telemetry/src/layer.d.ts +2 -2
  144. package/types/telemetry/src/recorded-failure.d.ts +20 -0
  145. package/types/telemetry/src/relay.d.ts +2 -2
  146. package/types/telemetry/src/transport.d.ts +8 -1
  147. package/types/utils/src/api-error.d.ts +53 -0
  148. package/types/utils/src/recorded-message.d.ts +15 -0
  149. package/js/chunk-BMOIAIVR.js +0 -138
  150. package/js/chunk-DHUDODG5.js +0 -213
  151. package/js/chunk-FZJOYIZO.js +0 -19
  152. package/js/chunk-LGIYBDWA.js +0 -85
  153. package/js/chunk-M6ZRRIBI.js +0 -877
  154. package/js/chunk-PLCMJREA.js +0 -590
  155. package/js/chunk-PYUYJRSK.js +0 -93
  156. package/js/chunk-SWPD52J7.js +0 -35
  157. package/js/chunk-W7D7WVSY.js +0 -18
  158. package/js/chunk-Z5NMEGJN.js +0 -29
  159. package/js/chunk-ZJWDMTE3.js +0 -63
  160. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  161. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  162. package/types/app-data/src/implementation/promise.d.ts +0 -68
  163. package/types/app-data/src/implementation/range.d.ts +0 -8
  164. package/types/app-data/src/implementation/schema.d.ts +0 -33
  165. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  166. package/types/app-data/src/index.d.ts +0 -4
  167. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  168. package/types/apps/src/contracts/storage.d.ts +0 -68
  169. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  170. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  171. package/types/apps/src/implementation/storage.d.ts +0 -13
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Read a live router tree into tools, routers and router skills. A nested dynamic router that fails
3
+ * is reported on its own entry; the root failing fails the read, as a single-source app would.
4
+ */
5
+ import { Effect, Schema } from "effect";
6
+ import { HostDeclarationInvalid, HostEvaluationFailed, type HostRouterError } from "../contracts/host.js";
7
+ import type { AppOperation } from "../contracts/operations.js";
8
+ import type { AppRouter, DynamicRouter, RouterMeta } from "../contracts/router.js";
9
+ import type { OperationSchedule } from "../contracts/schedules.js";
10
+ /**
11
+ * Keep only a failure's safe fields. Anything unrecognized becomes an evaluation failure with the
12
+ * error's name and bounded message, with the given account secrets replaced.
13
+ */
14
+ export declare const safeFailure: (error: unknown, secrets: readonly string[]) => HostRouterError;
15
+ /**
16
+ * Router skills are named `tools` for the root and `tools-<path>` below it, so a router's
17
+ * instructions never take an authored skill's name by accident.
18
+ */
19
+ export declare const routerSkillPrefix = "tools";
20
+ /**
21
+ * The skill name for a router path. A path of lowercase letters and digits is spelled out:
22
+ * `issues.open` is `tools-issues-open`. Any other path, or one too long, is a readable slug
23
+ * followed by a hash of the exact path, such as `tools-issues-list-0123456789`. Plain segments
24
+ * start with a letter and a hash is all digits, so the two forms never meet, and paths that slug
25
+ * alike, such as `issues_list` and `issues.list`, get different names.
26
+ */
27
+ export declare const routerSkillName: (path: string) => string;
28
+ /** A declared operation's catalog entry without schemas. `router` is its owning router's path. */
29
+ export declare const operationSummary: (name: string, router: string, operation: AppOperation, schedules?: readonly OperationSchedule[]) => Effect.Effect<{
30
+ readonly description: string;
31
+ readonly name: string;
32
+ readonly title?: string;
33
+ readonly annotations?: {
34
+ readonly title?: string;
35
+ readonly readOnlyHint?: boolean;
36
+ readonly destructiveHint?: boolean;
37
+ readonly idempotentHint?: boolean;
38
+ readonly openWorldHint?: boolean;
39
+ };
40
+ readonly schedules?: readonly {
41
+ readonly name: string;
42
+ readonly timing: {
43
+ readonly kind: "interval";
44
+ readonly milliseconds: number;
45
+ } | {
46
+ readonly kind: "cron";
47
+ readonly calendar: {
48
+ readonly expression: string;
49
+ readonly timezone: string;
50
+ };
51
+ };
52
+ readonly input: Schema.Json;
53
+ }[];
54
+ readonly readOnly?: boolean;
55
+ readonly router?: string;
56
+ readonly tags?: readonly string[];
57
+ }, HostDeclarationInvalid, never>;
58
+ /** A declared operation's full description, including rendered schemas. */
59
+ export declare const operationDescription: (name: string, router: string, operation: AppOperation, schedules?: readonly OperationSchedule[]) => Effect.Effect<{
60
+ readonly description: string;
61
+ readonly name: string;
62
+ readonly inputSchema: {
63
+ readonly [x: string]: Schema.Json;
64
+ };
65
+ readonly _meta?: {
66
+ readonly [x: string]: Schema.Json;
67
+ };
68
+ readonly title?: string;
69
+ readonly annotations?: {
70
+ readonly title?: string;
71
+ readonly readOnlyHint?: boolean;
72
+ readonly destructiveHint?: boolean;
73
+ readonly idempotentHint?: boolean;
74
+ readonly openWorldHint?: boolean;
75
+ };
76
+ readonly outputSchema?: {
77
+ readonly [x: string]: Schema.Json;
78
+ };
79
+ readonly schedules?: readonly {
80
+ readonly name: string;
81
+ readonly timing: {
82
+ readonly kind: "interval";
83
+ readonly milliseconds: number;
84
+ } | {
85
+ readonly kind: "cron";
86
+ readonly calendar: {
87
+ readonly expression: string;
88
+ readonly timezone: string;
89
+ };
90
+ };
91
+ readonly input: Schema.Json;
92
+ }[];
93
+ readonly readOnly?: boolean;
94
+ readonly router?: string;
95
+ readonly tags?: readonly string[];
96
+ }, HostDeclarationInvalid, never>;
97
+ /**
98
+ * A dynamic router over operations already discovered, such as an eager OpenAPI document or a
99
+ * stdio server. Upstream names can contain dots, which static router keys cannot.
100
+ */
101
+ export declare const fixedRouter: (operations: Readonly<Record<string, AppOperation>>, meta?: RouterMeta) => DynamicRouter;
102
+ export interface CatalogOptions {
103
+ /** Omit schemas. */
104
+ readonly summary: boolean;
105
+ /** Account secrets that a failure's message must not reveal. */
106
+ readonly secrets: readonly string[];
107
+ /** Only these full tool names. Routers with none of them are not read. */
108
+ readonly wanted?: ReadonlySet<string>;
109
+ /** Schedules that target a declared operation, by full name. */
110
+ readonly schedules: (name: string) => readonly OperationSchedule[];
111
+ /**
112
+ * Only declared operations that have schedules. Schedules never target dynamic routers, and
113
+ * their catalogs can be expensive to discover, so none is read.
114
+ */
115
+ readonly scheduled?: true;
116
+ }
117
+ /**
118
+ * Read a router tree. Every nested router is listed, for grouping; the root only when it has
119
+ * metadata. A nested dynamic source that fails is reported on its router's entry.
120
+ */
121
+ export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined, options: CatalogOptions) => Effect.Effect<{
122
+ tools: ({
123
+ readonly description: string;
124
+ readonly name: string;
125
+ readonly inputSchema: {
126
+ readonly [x: string]: Schema.Json;
127
+ };
128
+ readonly _meta?: {
129
+ readonly [x: string]: Schema.Json;
130
+ };
131
+ readonly title?: string;
132
+ readonly annotations?: {
133
+ readonly title?: string;
134
+ readonly readOnlyHint?: boolean;
135
+ readonly destructiveHint?: boolean;
136
+ readonly idempotentHint?: boolean;
137
+ readonly openWorldHint?: boolean;
138
+ };
139
+ readonly outputSchema?: {
140
+ readonly [x: string]: Schema.Json;
141
+ };
142
+ readonly schedules?: readonly {
143
+ readonly name: string;
144
+ readonly timing: {
145
+ readonly kind: "interval";
146
+ readonly milliseconds: number;
147
+ } | {
148
+ readonly kind: "cron";
149
+ readonly calendar: {
150
+ readonly expression: string;
151
+ readonly timezone: string;
152
+ };
153
+ };
154
+ readonly input: Schema.Json;
155
+ }[];
156
+ readonly readOnly?: boolean;
157
+ readonly router?: string;
158
+ readonly tags?: readonly string[];
159
+ } | {
160
+ readonly description: string;
161
+ readonly name: string;
162
+ readonly title?: string;
163
+ readonly annotations?: {
164
+ readonly title?: string;
165
+ readonly readOnlyHint?: boolean;
166
+ readonly destructiveHint?: boolean;
167
+ readonly idempotentHint?: boolean;
168
+ readonly openWorldHint?: boolean;
169
+ };
170
+ readonly schedules?: readonly {
171
+ readonly name: string;
172
+ readonly timing: {
173
+ readonly kind: "interval";
174
+ readonly milliseconds: number;
175
+ } | {
176
+ readonly kind: "cron";
177
+ readonly calendar: {
178
+ readonly expression: string;
179
+ readonly timezone: string;
180
+ };
181
+ };
182
+ readonly input: Schema.Json;
183
+ }[];
184
+ readonly readOnly?: boolean;
185
+ readonly router?: string;
186
+ readonly tags?: readonly string[];
187
+ })[];
188
+ routers: {
189
+ readonly path: string;
190
+ readonly description?: string;
191
+ readonly error?: import("../index.js").ProviderError | HostDeclarationInvalid | HostEvaluationFailed | import("../contracts/host.js").McpError | import("../contracts/host.js").SkillLoadFailed;
192
+ readonly title?: string;
193
+ readonly tags?: {
194
+ readonly [x: string]: string;
195
+ };
196
+ readonly icons?: readonly {
197
+ readonly src: string;
198
+ readonly mimeType?: string;
199
+ readonly sizes?: readonly string[];
200
+ readonly theme?: "light" | "dark";
201
+ }[];
202
+ readonly skill?: string;
203
+ }[];
204
+ }, import("../index.js").ProviderError | HostDeclarationInvalid | HostEvaluationFailed | import("../contracts/host.js").McpError | import("../contracts/host.js").SkillLoadFailed, never>;
205
+ /**
206
+ * One skill for each router with instructions. Skills and tools fail independently: a dynamic
207
+ * router whose metadata cannot be read, including the root, contributes no skill and does not
208
+ * fail the others. Metadata comes through each source's catalog cache, like a tool listing.
209
+ */
210
+ export declare const routerSkills: (root: AppRouter | DynamicRouter | undefined) => Effect.Effect<{
211
+ readonly description: string;
212
+ readonly name: string;
213
+ readonly files: readonly {
214
+ readonly path: string;
215
+ readonly content: string;
216
+ }[];
217
+ readonly license?: string;
218
+ readonly compatibility?: string;
219
+ readonly metadata?: {
220
+ readonly [x: string]: string;
221
+ };
222
+ readonly "allowed-tools"?: string;
223
+ }[], never, never>;
@@ -0,0 +1,68 @@
1
+ import { HostedTool } from "../contracts/host.js";
2
+ import type { AppOperation } from "../contracts/operations.js";
3
+ import { RouterMeta, type AppRouter, type DynamicRouter, type RouterIcon } from "../contracts/router.js";
4
+ import type { Approval } from "../approval.js";
5
+ import { type OperationDeclaration, type RouterChild, type RouterDeclaration } from "./operations.js";
6
+ export type { RouterChild, RouterDeclaration } from "./operations.js";
7
+ /** Author metadata for a router. Instructions become a skill named after the router's path. */
8
+ export interface RouterOptions {
9
+ readonly title?: string;
10
+ readonly description?: string;
11
+ readonly instructions?: string;
12
+ readonly icons?: readonly RouterIcon[];
13
+ readonly tags?: Readonly<Record<string, string>>;
14
+ }
15
+ /** Wrap a native router. Protocol helpers use this for the routers they build. */
16
+ export declare const routerDeclaration: (node: AppRouter | DynamicRouter) => RouterDeclaration;
17
+ /** Accept only framework-created routers. */
18
+ export declare const nativeRouter: (value: unknown) => AppRouter | DynamicRouter | undefined;
19
+ /** Author fields win; a field the author omits keeps the source's value. */
20
+ export declare const mergeMeta: (base: RouterMeta | undefined, override: RouterMeta | undefined) => RouterMeta | undefined;
21
+ /**
22
+ * Group operations and routers under path keys, like tRPC's nested routers, with metadata an
23
+ * agent can read. Passing an existing router instead of children overrides its metadata:
24
+ * `router(mcpRouter(options), { description: "..." })`.
25
+ */
26
+ export declare function router<Query = unknown, Mutation = unknown>(children: Readonly<Record<string, RouterChild<Query, Mutation>>>, options?: RouterOptions): RouterDeclaration<Query, Mutation>;
27
+ export declare function router<Query, Mutation>(source: RouterDeclaration<Query, Mutation>, options: RouterOptions): RouterDeclaration<Query, Mutation>;
28
+ /**
29
+ * Declare a router whose tools are discovered when read. `list` returns tools with names relative
30
+ * to this router; mark queries with `readOnly: true`. `resolve` receives one of those names.
31
+ */
32
+ export declare const dynamicRouter: (source: {
33
+ readonly meta?: () => RouterOptions | Promise<RouterOptions>;
34
+ readonly list: () => readonly HostedTool[] | Promise<readonly HostedTool[]>;
35
+ readonly resolve: (name: string) => OperationDeclaration<"query" | "mutation", unknown> | undefined | Promise<OperationDeclaration<"query" | "mutation", unknown> | undefined>;
36
+ }) => RouterDeclaration;
37
+ /** Join a router path and a relative name. The root router's path is "". */
38
+ export declare const joinPath: (path: string, name: string) => string;
39
+ /** Where a full tool name points: a declared operation, or a name inside a dynamic router. */
40
+ export type Location = {
41
+ readonly kind: "operation";
42
+ readonly operation: AppOperation;
43
+ readonly router: string;
44
+ } | {
45
+ readonly kind: "dynamic";
46
+ readonly source: DynamicRouter;
47
+ readonly router: string;
48
+ readonly name: string;
49
+ };
50
+ /**
51
+ * Walk static keys until the name ends at an operation or enters a dynamic router, which receives
52
+ * the rest of the name. Static keys contain no dots, so every name has at most one location.
53
+ */
54
+ export declare const locate: (root: AppRouter | DynamicRouter | undefined, name: string) => Location | undefined;
55
+ /** Every declared operation with its full name and owning router. Dynamic routers are not listed. */
56
+ export declare const declaredOperations: (root: AppRouter | undefined, path?: string) => Array<{
57
+ readonly name: string;
58
+ readonly router: string;
59
+ readonly operation: AppOperation;
60
+ }>;
61
+ /**
62
+ * Choose an approval for each operation a router contains, including tools a dynamic router
63
+ * resolves later. `policy` receives the operation and its name relative to this router; returning
64
+ * undefined keeps the operation's own approval. Read hints with `toolAnnotations(operation)`.
65
+ * Apply it to each account's router before `accountRouter` combines them, so every account keeps
66
+ * its own tools' hints.
67
+ */
68
+ export declare const withApprovals: <Query, Mutation>(source: RouterDeclaration<Query, Mutation>, policy: (operation: OperationDeclaration<"query" | "mutation", never>, name: string) => Approval | undefined) => RouterDeclaration<Query, Mutation>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Let the runtime run its own tasks between long synchronous steps. In a Worker, a large OpenAPI
3
+ * compilation that never yields leaves the garbage collector only long, full pauses; yielding
4
+ * between steps measurably shortens it. A timer is used because a resolved promise would continue
5
+ * without leaving the current task.
6
+ */
7
+ export declare const yieldToRuntime: () => Promise<void>;
@@ -1,12 +1,10 @@
1
1
  /** Author schema facade. Internals use the native decoder retained by each value. */
2
2
  import { Effect, Schema as EffectSchema } from "effect";
3
- import { ValidationError, type JsonObject } from "../contracts/schema.js";
4
- import type { Field } from "../../../app-data/src/contracts/database.js";
5
- declare const StorageField: unique symbol;
3
+ import { JsonObject, ValidationError } from "../contracts/schema.js";
4
+ import type { FieldExposure } from "../contracts/provider.js";
6
5
  declare const Decoder: unique symbol;
7
6
  /** An author-facing value schema. Effect is never required in author code. */
8
7
  export interface Schema<T, Optional extends boolean = false> {
9
- readonly [StorageField]?: Field;
10
8
  readonly [Decoder]: EffectSchema.Decoder<T>;
11
9
  readonly optionalValue: Optional;
12
10
  /** Parse an unknown value; invalid input throws a safe ValidationError. */
@@ -37,10 +35,15 @@ export interface ObjectSchema<F extends Fields> extends Schema<ObjectValue<F>> {
37
35
  export declare const decoderOf: <T>(schema: Schema<T, boolean>) => EffectSchema.Decoder<T>;
38
36
  /** Recognize schemas made by this author facade when adapting a definition. */
39
37
  export declare const isSchema: (value: unknown) => value is Schema<unknown, boolean>;
38
+ /**
39
+ * Source that skipped type checking can pass any value where a schema belongs, such as `string`
40
+ * for `string()`. Name the argument and the mistake before a native constructor reads it.
41
+ */
42
+ export declare const schemaArgument: <S extends Schema<unknown, boolean>>(value: S, role: string) => S;
40
43
  /** Decode within an Effect program. Invalid input is omitted from the failure. */
41
44
  export declare const parse: <T>(decoder: EffectSchema.Decoder<T>, input: unknown) => Effect.Effect<T, ValidationError>;
42
45
  /** Present a native decoder through the synchronous author API. */
43
- export declare function wrap<T, Optional extends boolean>(decoder: EffectSchema.Decoder<T>, optionalValue: Optional, field?: Field): Schema<T, Optional>;
46
+ export declare function wrap<T, Optional extends boolean>(decoder: EffectSchema.Decoder<T>, optionalValue: Optional): Schema<T, Optional>;
44
47
  /** A string, optionally with a minimum length. No coercion. */
45
48
  export declare function string(options?: {
46
49
  readonly minLength?: number;
@@ -59,6 +62,44 @@ export declare function literal<const T extends string | number | boolean | null
59
62
  export declare const array: <T>(item: Schema<T, boolean>) => Schema<readonly T[]>;
60
63
  /** Parse declared fields and omit undeclared fields. */
61
64
  export declare function object<const F extends Fields>(fields: F): ObjectSchema<F>;
65
+ declare const Exposure: unique symbol;
66
+ /** A schema marked with how app code sees the field in a provider that declares hosts. */
67
+ export type Exposed<S, E extends FieldExposure = FieldExposure> = S & {
68
+ readonly [Exposure]: E;
69
+ };
70
+ /** The marking of one account field, if any. */
71
+ export declare const exposureOf: (schema: Schema<unknown, boolean>) => FieldExposure | undefined;
72
+ /**
73
+ * A field that is not secret, such as a subdomain or region. App code reads its real value and
74
+ * the connect form shows it.
75
+ */
76
+ export declare const plain: <S extends Schema<unknown, boolean>>(schema: S) => Exposed<S, "plain">;
77
+ /**
78
+ * A secret field that app code reads as its real value, for request signing and similar uses.
79
+ * The connect form warns that the app can read it. Prefer an unmarked field, which app code
80
+ * receives as a handle that only reaches the provider's declared hosts.
81
+ */
82
+ export declare const raw: <S extends Schema<unknown, boolean>>(schema: S) => Exposed<S, "raw">;
83
+ /** Marked fields of an account object, by name. */
84
+ export declare const fieldExposure: (fields: Fields) => Readonly<Record<string, FieldExposure>>;
85
+ declare const Secret: unique symbol;
86
+ /**
87
+ * A secret account value. In a provider that declares hosts it is a handle, which the host's
88
+ * outbound network replaces with the real value only on requests to those hosts. Pass it to
89
+ * clients and headers as an ordinary string; do not decode or transform it.
90
+ */
91
+ export type SecretString = string & {
92
+ readonly [Secret]: true;
93
+ };
94
+ type Sealed<T> = T extends string ? SecretString : T;
95
+ /** Account fields as app code receives them: unmarked string fields are secret. */
96
+ export type SecretFields<F extends Fields> = {
97
+ readonly [Key in keyof ObjectValue<F>]: Key extends keyof F ? F[Key] extends Exposed<unknown> ? ObjectValue<F>[Key] : Sealed<ObjectValue<F>[Key]> : ObjectValue<F>[Key];
98
+ };
99
+ /** An account object without declared fields, such as a default OAuth projection. */
100
+ export type SecretObject<T> = {
101
+ readonly [Key in keyof T]: Sealed<T[Key]>;
102
+ };
62
103
  declare const ImportedJsonSchema: unique symbol;
63
104
  /** Read the original document for an imported decoder without a lossy schema round trip. */
64
105
  export declare const importedJsonSchema: (decoder: EffectSchema.Decoder<unknown>) => unknown | undefined;
@@ -72,8 +113,45 @@ export declare const withLazyJsonSchemaDocument: <S extends EffectSchema.Decoder
72
113
  * Relocate a self-contained JSON Schema under a document pointer. Resolve references
73
114
  * before nesting so account schemas can reuse definition names, IDs and anchors.
74
115
  * Only schema nodes are rewritten; examples and ordinary property values stay intact.
116
+ * A `$recursiveRef` becomes the pointer to its static target, such as the relocated root. The
117
+ * patched validator applies it like `"#"` was: the recursive anchor in scope, else that target.
75
118
  */
76
119
  export declare const nestJsonSchema: (input: JsonObject, pointer: string) => JsonObject;
120
+ /**
121
+ * Whether an input key may be named in a validation problem. Other keys can carry supplied data,
122
+ * so problems locate them without echoing them.
123
+ */
124
+ export declare const echoableKey: (key: string) => boolean;
125
+ /**
126
+ * The keys an object accepts, as `object {name, optional?}`. `...` marks an object that also
127
+ * accepts other keys. Names come from the schema, never from supplied input.
128
+ */
129
+ export declare const objectShape: (keys: readonly {
130
+ readonly name: string;
131
+ readonly optional: boolean;
132
+ }[], open: boolean, limit?: number) => string;
133
+ /**
134
+ * The values a schema fixes, as `"v1"` or `one of "a", "b" and 3 more`. Agents already read
135
+ * these values in the tool's signature, so problems list them, up to {@link maxListedValues}
136
+ * values and {@link maxValuesText} characters. They come from the schema, never from input.
137
+ */
138
+ export declare const allowedValues: (values: readonly unknown[]) => string;
139
+ /** Keys listed for each union alternative, so several alternatives fit in one problem. */
140
+ export declare const maxAlternativeKeys = 8;
141
+ /**
142
+ * The alternatives a union accepts, as `string or object {id}`, and the key whose value tells
143
+ * them apart. Shapes, values and the key come from the schema, never from supplied input.
144
+ */
145
+ export declare const unionShape: (alternatives: readonly string[], selector: string | undefined) => string;
146
+ /** The problem for a required key the input omits, with what its schema expects when stated. */
147
+ export declare const missingKey: (expected: string | undefined) => string;
148
+ /** The text every missing-key problem starts with, so the caller can add where the input has it. */
149
+ export declare const missingKeyText = "Missing key";
150
+ /**
151
+ * Whether the imported schema whose check failed may accept a key as an object's own key, for a
152
+ * failure's check; undefined when the check is not an imported schema's.
153
+ */
154
+ export declare const importedSchemaKeys: (check: object) => ((key: string) => boolean) | undefined;
77
155
  /** Prepare an interpreted validator. No eval or generated JavaScript runs in any host. */
78
156
  export declare const compileJsonSchemaDecoder: (document: JsonObject) => Effect.Effect<EffectSchema.Codec<EffectSchema.Json, EffectSchema.Json, never, never> & {
79
157
  [ImportedJsonSchema]: {
@@ -81,14 +159,20 @@ export declare const compileJsonSchemaDecoder: (document: JsonObject) => Effect.
81
159
  };
82
160
  }, ValidationError, never>;
83
161
  export declare const lazyJsonSchemaDecoder: (document: () => JsonObject) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, never, never>;
162
+ /**
163
+ * A lazy decoder and the compilation it decodes with. Running `compile` first lets a caller
164
+ * reject an unsupported schema before a side effect whose result the decoder will check.
165
+ */
166
+ export declare const preparedJsonSchemaDecoder: (document: JsonObject) => {
167
+ decoder: EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>;
168
+ compile: Effect.Effect<EffectSchema.Decoder<EffectSchema.Json, never>, ValidationError, never>;
169
+ };
84
170
  /** Preserve the JSON document; compile its validator only when a value is first decoded. */
85
171
  export declare const jsonSchemaDecoder: (input: unknown) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, ValidationError, never>;
86
172
  /** Import JSON metadata now; unsupported schemas and invalid values fail when parsed. */
87
173
  export declare const jsonSchema: (input: unknown) => Schema<EffectSchema.Json>;
88
- /** Database declaration retained by primitive constructors; nested payload schemas are not database fields. */
89
- export declare const storageFieldOf: (schema: Schema<unknown, boolean>) => Field | undefined;
90
- /** A row reference records the target table; existence is not a foreign-key constraint. */
91
- export declare const id: (table: string) => Schema<string>;
92
- /** A host user identifier, stored as a string without imposing a product auth model. */
93
- export declare const userId: () => Schema<string>;
174
+ /** Render a decoder as a JSON Schema document, keeping an imported upstream document as-is. */
175
+ export declare const jsonSchemaDocument: (decoder: EffectSchema.Decoder<unknown>) => Effect.Effect<{
176
+ readonly [x: string]: EffectSchema.Json;
177
+ }, EffectSchema.SchemaError, never>;
94
178
  export {};
@@ -1,35 +1,28 @@
1
1
  /** Remote skill readers return complete portable bundles, never installed host files. */
2
2
  import { Effect } from "effect";
3
- import { SkillLoadFailed, type GitHubSkillsOptions, type WellKnownSkillsOptions, type SkillTransport } from "../contracts/skills.js";
3
+ import { NetworkRefused } from "../contracts/network.js";
4
+ import { ProviderError } from "../contracts/provider-error.js";
5
+ import { AppSkills, SkillLoadFailed, type GitHubSkillsOptions, type WellKnownSkillsOptions, type SkillTransport } from "../contracts/skills.js";
4
6
  /** Give every failure without a message one that names the service. */
5
- export declare const withService: (service: string | undefined) => <A, R>(effect: Effect.Effect<A, SkillLoadFailed, R>) => Effect.Effect<A, SkillLoadFailed, R>;
7
+ export declare const withService: (service: string | undefined) => <A, R>(effect: Effect.Effect<A, SkillLoadFailed | NetworkRefused, R>) => Effect.Effect<A, NetworkRefused | SkillLoadFailed, R>;
8
+ interface ReadRequest {
9
+ readonly headers?: Readonly<Record<string, string>>;
10
+ /** Describe a refusal by Executor's app network; defaults to the refusal itself. */
11
+ readonly refused?: (refused: NetworkRefused) => SkillLoadFailed | NetworkRefused;
12
+ }
6
13
  /** One loader invocation owns its byte budget and all of its network requests. */
7
14
  export declare const reader: (transport: SkillTransport) => Effect.Effect<{
8
- fetchBytes: (url: string, post?: {
9
- readonly body: Uint8Array;
10
- readonly headers: Record<string, string>;
11
- }) => Effect.Effect<Uint8Array<ArrayBuffer>, SkillLoadFailed, never>;
12
- read: (url: string) => Effect.Effect<string, SkillLoadFailed, never>;
13
- json: (url: string) => Effect.Effect<unknown, SkillLoadFailed, never>;
15
+ fetchBytes: (url: string, request?: ReadRequest & {
16
+ readonly body?: Uint8Array;
17
+ }) => Effect.Effect<Uint8Array<ArrayBuffer>, NetworkRefused | SkillLoadFailed, never>;
18
+ read: (url: string, request?: ReadRequest) => Effect.Effect<string, NetworkRefused | SkillLoadFailed, never>;
19
+ json: (url: string) => Effect.Effect<unknown, NetworkRefused | SkillLoadFailed, never>;
14
20
  }, never, never>;
15
- export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effect.Effect<readonly {
16
- readonly name: string;
17
- readonly description: string;
18
- readonly files: readonly {
19
- readonly path: string;
20
- readonly content: string;
21
- }[];
22
- readonly license?: string;
23
- readonly compatibility?: string;
24
- readonly metadata?: {
25
- readonly [x: string]: string;
26
- };
27
- readonly "allowed-tools"?: string;
28
- }[], SkillLoadFailed, never>;
21
+ export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effect.Effect<typeof AppSkills.Type, SkillLoadFailed | NetworkRefused | ProviderError>;
29
22
  /** Fetch all indexed files and reject a publication whose index changes during the read. */
30
23
  export declare const wellKnownSkillsEffect: (options: WellKnownSkillsOptions) => Effect.Effect<readonly {
31
- readonly name: string;
32
24
  readonly description: string;
25
+ readonly name: string;
33
26
  readonly files: readonly {
34
27
  readonly path: string;
35
28
  readonly content: string;
@@ -40,4 +33,5 @@ export declare const wellKnownSkillsEffect: (options: WellKnownSkillsOptions) =>
40
33
  readonly [x: string]: string;
41
34
  };
42
35
  readonly "allowed-tools"?: string;
43
- }[], SkillLoadFailed, never>;
36
+ }[], NetworkRefused | SkillLoadFailed, never>;
37
+ export {};
@@ -0,0 +1,66 @@
1
+ /**
2
+ * `ctx.sql` over a data facet's SQLite storage, and the deploy-time migrator.
3
+ *
4
+ * Every statement runs inside a synchronous SQLite transaction: alone, or inside the author's
5
+ * `transaction`. Nothing here can wait on another call, so no lock or transaction outlives the
6
+ * statement that needs it. What a statement may do is decided by SQLite, not by reading the SQL:
7
+ * a query runs in a transaction that is always rolled back.
8
+ */
9
+ import { Effect, Schema } from "effect";
10
+ import { type AppSqlStorage, type Sql, type SqlReader } from "../contracts/sql.js";
11
+ import type { SkillFile } from "../contracts/skills.js";
12
+ export declare const noDatabase: Sql;
13
+ /** A workflow step mutation's identity, from the host's replay record. */
14
+ export interface StepReplay {
15
+ readonly key: string;
16
+ readonly fingerprint: string;
17
+ }
18
+ /**
19
+ * One invocation's SQL. Once the invocation ends or `signal` aborts, every statement is refused, so
20
+ * code still running after a timeout or cancellation cannot write late.
21
+ */
22
+ export declare const authorSql: (storage: AppSqlStorage, options: {
23
+ readonly signal: AbortSignal;
24
+ readonly step?: StepReplay;
25
+ }) => {
26
+ reader: SqlReader;
27
+ writer: Sql;
28
+ close: () => void;
29
+ };
30
+ declare const MigrationFileInvalid_base: Schema.Class<MigrationFileInvalid, Schema.TaggedStruct<"MigrationFileInvalid", {
31
+ readonly path: Schema.String;
32
+ readonly reason: Schema.String;
33
+ }>, import("effect/Cause").YieldableError>;
34
+ /** A file in `migrations/` that is not a migration the host can order. */
35
+ export declare class MigrationFileInvalid extends MigrationFileInvalid_base {
36
+ get message(): string;
37
+ }
38
+ declare const MigrationHistoryChanged_base: Schema.Class<MigrationHistoryChanged, Schema.TaggedStruct<"MigrationHistoryChanged", {
39
+ readonly reason: Schema.String;
40
+ }>, import("effect/Cause").YieldableError>;
41
+ /** The build's migrations no longer start with the ones already applied to the database. */
42
+ export declare class MigrationHistoryChanged extends MigrationHistoryChanged_base {
43
+ get message(): string;
44
+ }
45
+ declare const MigrationFailed_base: Schema.Class<MigrationFailed, Schema.TaggedStruct<"MigrationFailed", {
46
+ readonly path: Schema.String;
47
+ readonly reason: Schema.String;
48
+ }>, import("effect/Cause").YieldableError>;
49
+ /** SQLite rejected a migration. Every migration of the deploy rolled back. */
50
+ export declare class MigrationFailed extends MigrationFailed_base {
51
+ get message(): string;
52
+ }
53
+ /** Whether a build's files give the app a database: any `.sql` file in `migrations/`. */
54
+ export declare const hasMigrations: (files: readonly {
55
+ readonly path: string;
56
+ }[]) => boolean;
57
+ /**
58
+ * Apply the build's pending migrations and report which ran. Every pending migration runs in one
59
+ * transaction, so a failing one leaves the database exactly as the active deployment knows it. The
60
+ * migrations already applied must still be the build's first ones, byte for byte.
61
+ */
62
+ export declare const migrate: (storage: AppSqlStorage, files: readonly SkillFile[]) => Effect.Effect<{
63
+ readonly id: number;
64
+ readonly name: string;
65
+ }[], MigrationFileInvalid | MigrationHistoryChanged | MigrationFailed, never>;
66
+ export {};
@@ -0,0 +1,9 @@
1
+ /** Host-rendered account notices; no authored app code or provider responses enter them. */
2
+ import type { UiAccountNotice, UiAccountProblem } from "../contracts/ui.js";
3
+ /** Missing, removed, incompatible, or rejected accounts stop the app; other failed checks are advisory. */
4
+ export declare const accountProblemBlocks: (problem: UiAccountProblem) => boolean;
5
+ export declare const accountProblemText: (problem: UiAccountProblem) => string;
6
+ /** Full page shown instead of the app while an account problem stops it from working. */
7
+ export declare const accountBlockedPage: (notice: UiAccountNotice) => string;
8
+ /** Inline card for advisory problems; the app still loads underneath. */
9
+ export declare const accountNoticeBootstrap: (notice: UiAccountNotice) => string;
@@ -1,5 +1,5 @@
1
1
  /** Host responses around app sign-in. They carry no script and never contain product credentials. */
2
- import { HttpServerResponse } from "effect/unstable/http";
2
+ import { HttpServerResponse } from "effect/http";
3
3
  import { type AppSignInId } from "../contracts/ui-auth.js";
4
4
  /** Private app responses must not leak authentication URLs through caches or referrers. */
5
5
  export declare const appPrivateHeaders: {
@@ -1,4 +1,4 @@
1
- import { Atom } from "effect/unstable/reactivity";
1
+ import { AsyncResult, Atom } from "effect/reactivity";
2
2
  import { type OperationReference } from "../contracts/live.js";
3
3
  import { type Schema } from "./schema.js";
4
4
  /** A scoped page client. Host-injected context carries only the deployment, never credentials. */
@@ -12,5 +12,5 @@ export declare const createAppClient: () => {
12
12
  /** Create a callable mutation with optional withOptimisticUpdate projections over mounted queries. */
13
13
  mutation: <Input, Output>(reference: OperationReference<Input, Output, "mutation">, output: Schema<NoInfer<Output>, boolean>) => import("../client.js").AppMutation<Input, Output>;
14
14
  /** Share a live query across mounts and reconcile optimistic changes against fresh server reads. */
15
- queryAtom: <Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>, output: Schema<NoInfer<Output>, boolean>) => Atom.Atom<import("effect/unstable/reactivity/AsyncResult").AsyncResult<Output, unknown>>;
15
+ queryAtom: <Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>, output: Schema<NoInfer<Output>, boolean>) => Atom.Atom<AsyncResult.AsyncResult<Output, unknown>>;
16
16
  };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Retained files sit at the deployment's asset root. Resolving path-relative resource URLs there,
3
+ * instead of with `<base>`, leaves the document base as the page URL for links, history and forms.
4
+ */
5
+ export declare const deploymentDocument: (html: string, deployment: string) => string;
@@ -1,2 +1,2 @@
1
1
  /** Inline host script: no app dependencies, credentials, or authored HTML enter its source. */
2
- export declare const appFailureBootstrap: string;
2
+ export declare const appFailureBootstrap = "<script>\"use strict\";(()=>{var D=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,A=/^(?:chrome|moz|safari-web)-extension:/,R=new Set([\"Error\",\"TypeError\",\"ReferenceError\",\"SyntaxError\",\"RangeError\",\"URIError\",\"EvalError\",\"AggregateError\"]),x=(e,t=0,i=0)=>{let r=[];if(!URL.canParse(e))return r;let a=new URL(e);return a.origin!==location.origin||!a.pathname.startsWith(\"/_executor/assets/\")||!a.pathname.endsWith(\".js\")||(r.push({key:\"code.file.path\",value:{stringValue:a.pathname}}),Number.isSafeInteger(t)&&t>0&&r.push({key:\"code.line.number\",value:{intValue:String(t)}}),Number.isSafeInteger(i)&&i>0&&r.push({key:\"code.column.number\",value:{intValue:String(i)}})),r},E=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,b=f.get(a);if(b!==void 0&&r-b<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:\"executor.ui.failure.suppressed\",value:{intValue:String(g)}}),g=0;let h=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,\"0\")).join(\"\"),S=`${Date.now()}000000`,n,u=\"Sending error report\\u2026\",k=()=>{if(d?.open)return;let s=document.createElement(\"div\"),V=s.attachShadow({mode:\"open\"}),o=document.createElement(\"dialog\");d=o,o.setAttribute(\"aria-labelledby\",\"executor-failure-title\");let y=document.createElement(\"h2\");y.id=\"executor-failure-title\",y.textContent=e===\"script\"?\"This app could not load\":\"This app stopped working\";let C=document.createElement(\"p\");C.textContent=e===\"script\"?\"A file needed by this page did not load. Reload the page to try again.\":\"The app encountered an unexpected error. Reload the page to try again.\";let L=document.createElement(\"p\");L.textContent=\"Copy any unsaved work before reloading.\";let T=document.createElement(\"details\"),v=document.createElement(\"summary\");v.textContent=\"Error details\";let c=document.createElement(\"textarea\");c.readOnly=!0,c.rows=10,c.cols=36,c.setAttribute(\"aria-label\",\"Error details\"),c.value=`${t.slice(0,12e3)}\n\nDiagnostic ID: ${h}`,T.append(v,c),n=document.createElement(\"p\"),n.setAttribute(\"role\",\"status\"),n.textContent=u;let l=document.createElement(\"button\");l.type=\"button\",l.textContent=\"Reload page\",l.addEventListener(\"click\",()=>location.reload());let p=document.createElement(\"button\");p.type=\"button\",p.textContent=\"Close\",p.addEventListener(\"click\",()=>o.close()),o.addEventListener(\"close\",()=>{d===o&&(d=void 0),s.remove()}),o.append(y,C,L,T,n,l,p),V.append(o),document.documentElement.append(s),o.showModal()};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",k,{once:!0}):k(),fetch(\"/_executor/api/telemetry/traces\",{method:\"POST\",headers:{\"content-type\":\"application/json\"},credentials:\"same-origin\",keepalive:!0,body:JSON.stringify({resourceSpans:[{scopeSpans:[{spans:[{traceId:h,spanId:h.slice(0,16),name:\"ui.app.failure\",kind:1,startTimeUnixNano:S,endTimeUnixNano:S,status:{code:2},attributes:[{key:\"executor.ui.failure.kind\",value:{stringValue:e}},...i]}]}]}]})}).then(s=>{u=s.ok?\"Error report sent.\":\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=u)},()=>{u=\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=u)})};window.addEventListener(\"error\",e=>{if(e instanceof ErrorEvent){if(A.test(e.filename))return;let t=x(e.filename,e.lineno,e.colno);e.error instanceof Error&&R.has(e.error.name)&&t.push({key:\"exception.type\",value:{stringValue:e.error.name}}),E(\"runtime\",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&E(\"script\",`Could not load script: ${e.target.src}`,x(e.target.src))},!0),window.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;E(\"rejection\",t instanceof Error?t.stack??t.message:\"An app operation failed without handling its error.\")})};D();})();</script>";