apps 0.0.1-beta.3 → 0.0.1-beta.31

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 (140) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-RN2MXB4R.js → chunk-3FJYVAE4.js} +128 -24
  4. package/js/chunk-4OKYLVU4.js +118 -0
  5. package/js/{chunk-LGIYBDWA.js → chunk-5DLG2FVN.js} +65 -1
  6. package/js/{chunk-PLCMJREA.js → chunk-5JVNM3CQ.js} +60 -20
  7. package/js/chunk-5XJR4XGW.js +254 -0
  8. package/js/{chunk-FZJOYIZO.js → chunk-6KG4DZD7.js} +1 -1
  9. package/js/{chunk-EVJUVWN2.js → chunk-6ZJ2H6P4.js} +2 -2
  10. package/js/{chunk-NQ3OMCA5.js → chunk-AUFVX4KM.js} +2 -2
  11. package/js/{chunk-D47C7KG5.js → chunk-AYM2FUI5.js} +2 -2
  12. package/js/{chunk-5MQZEB6Y.js → chunk-BGALSHLT.js} +37 -12
  13. package/js/{chunk-QKHR7BMF.js → chunk-CJY5X26R.js} +3 -3
  14. package/js/{chunk-M6ZRRIBI.js → chunk-DASNNAP4.js} +1 -1
  15. package/js/{chunk-ZCAMUXSG.js → chunk-ETLILMHY.js} +3 -4
  16. package/js/{chunk-FW5HBOIK.js → chunk-EXGKN554.js} +2005 -1710
  17. package/js/{chunk-SATWJKN6.js → chunk-FBBXFFFJ.js} +1 -1
  18. package/js/{chunk-JN55AYQH.js → chunk-FULRJSWU.js} +61 -32
  19. package/js/{chunk-HDTGZWP2.js → chunk-GG566OOE.js} +139 -32
  20. package/js/chunk-GZ4UHXRT.js +92 -0
  21. package/js/{chunk-YEJOQEII.js → chunk-HW3DPBZR.js} +45 -7
  22. package/js/{chunk-HDJH3RPR.js → chunk-MFHUR5SB.js} +2 -2
  23. package/js/{chunk-MYYEW3RA.js → chunk-N72RKJ5E.js} +984 -61
  24. package/js/{chunk-WFSQXYUT.js → chunk-NPGRURDG.js} +390 -18
  25. package/js/chunk-OD3KFKZD.js +1617 -0
  26. package/js/{chunk-FDNTX5QJ.js → chunk-OX233L7N.js} +2 -2
  27. package/js/{chunk-G7ZIRKMK.js → chunk-QYM4STZW.js} +118 -197
  28. package/js/chunk-RULZPNGP.js +801 -0
  29. package/js/{chunk-BMOIAIVR.js → chunk-UMCMZFXW.js} +49 -1
  30. package/js/{chunk-J7O55ZV7.js → chunk-W7F23NQ2.js} +419 -191
  31. package/js/chunk-WG5DFZFT.js +42 -0
  32. package/js/{chunk-T2LAZCAD.js → chunk-ZOY7PDMI.js} +1 -1
  33. package/js/client.js +120 -84
  34. package/js/contracts.js +110 -16
  35. package/js/effect.js +20 -20
  36. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  37. package/js/graphql.js +58 -54
  38. package/js/host.js +20 -20
  39. package/js/index.js +247 -204
  40. package/js/mcp/effect.js +24 -22
  41. package/js/mcp/stdio.js +35 -30
  42. package/js/mcp.js +105 -68
  43. package/js/openapi.js +4087 -1503
  44. package/js/react.js +3 -3
  45. package/js/skills/effect.js +5 -3
  46. package/js/skills.js +15 -15
  47. package/js/storage/facet.js +4 -4
  48. package/js/ui/auth/contracts.js +2 -2
  49. package/js/ui/auth.js +5 -5
  50. package/js/ui/contracts.js +5 -4
  51. package/js/ui/serving.js +8516 -214
  52. package/package.json +1 -1
  53. package/runtime.json +1 -1
  54. package/types/app-data/src/contracts/database.d.ts +33 -6
  55. package/types/app-data/src/implementation/schema.d.ts +2 -17
  56. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  57. package/types/apps/src/contracts/app.d.ts +7 -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 +34 -11
  61. package/types/apps/src/contracts/mcp.d.ts +91 -10
  62. package/types/apps/src/contracts/network.d.ts +84 -0
  63. package/types/apps/src/contracts/openapi-compile.d.ts +31 -3
  64. package/types/apps/src/contracts/openapi.d.ts +45 -9
  65. package/types/apps/src/contracts/operations.d.ts +5 -6
  66. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  67. package/types/apps/src/contracts/protocols/1.d.ts +251 -69
  68. package/types/apps/src/contracts/protocols/2.d.ts +710 -0
  69. package/types/apps/src/contracts/protocols/3.d.ts +716 -0
  70. package/types/apps/src/contracts/protocols/4.d.ts +1298 -0
  71. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  72. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  73. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  74. package/types/apps/src/contracts/protocols/8.d.ts +1119 -0
  75. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  76. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  77. package/types/apps/src/contracts/provider.d.ts +115 -10
  78. package/types/apps/src/contracts/router.d.ts +59 -0
  79. package/types/apps/src/contracts/skills.d.ts +18 -5
  80. package/types/apps/src/contracts/storage.d.ts +3 -3
  81. package/types/apps/src/contracts/ui.d.ts +18 -0
  82. package/types/apps/src/contracts/workflows.d.ts +34 -3
  83. package/types/apps/src/graphql.d.ts +1 -3
  84. package/types/apps/src/implementation/account-router.d.ts +12 -0
  85. package/types/apps/src/implementation/app.d.ts +5 -4
  86. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  87. package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
  88. package/types/apps/src/implementation/elicitation.d.ts +9 -9
  89. package/types/apps/src/implementation/failure-detail.d.ts +46 -0
  90. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  91. package/types/apps/src/implementation/graphql.d.ts +4 -3
  92. package/types/apps/src/implementation/input-problems.d.ts +4 -1
  93. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  94. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  95. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  96. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  97. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  98. package/types/apps/src/implementation/mcp.d.ts +52 -25
  99. package/types/apps/src/implementation/network.d.ts +16 -0
  100. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  101. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  102. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  103. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  104. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  105. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  106. package/types/apps/src/implementation/operations.d.ts +36 -3
  107. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  108. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  109. package/types/apps/src/implementation/provider.d.ts +19 -5
  110. package/types/apps/src/implementation/router-catalog.d.ts +224 -0
  111. package/types/apps/src/implementation/router.d.ts +68 -0
  112. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  113. package/types/apps/src/implementation/schema.d.ts +80 -1
  114. package/types/apps/src/implementation/skills.d.ts +2 -2
  115. package/types/apps/src/implementation/storage.d.ts +5 -3
  116. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  117. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  118. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  119. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  120. package/types/apps/src/implementation/ui-serving.d.ts +10 -4
  121. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  122. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  123. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  124. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  125. package/types/apps/src/index.d.ts +29 -11
  126. package/types/apps/src/mcp-stdio.d.ts +2 -5
  127. package/types/apps/src/mcp.d.ts +25 -5
  128. package/types/apps/src/openapi.d.ts +6 -6
  129. package/types/apps/src/skills.d.ts +4 -4
  130. package/types/telemetry/src/browser-operations.d.ts +5 -2
  131. package/types/telemetry/src/config.d.ts +2 -2
  132. package/types/utils/src/api-error.d.ts +48 -0
  133. package/js/chunk-PYUYJRSK.js +0 -93
  134. package/js/chunk-SWPD52J7.js +0 -35
  135. package/js/chunk-W7D7WVSY.js +0 -18
  136. package/js/chunk-Z5NMEGJN.js +0 -29
  137. package/js/chunk-ZJWDMTE3.js +0 -63
  138. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  139. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  140. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -1,7 +1,8 @@
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";
3
+ import { JsonObject, ValidationError } from "../contracts/schema.js";
4
4
  import type { Field } from "../../../app-data/src/contracts/database.js";
5
+ import type { FieldExposure } from "../contracts/provider.js";
5
6
  declare const StorageField: unique symbol;
6
7
  declare const Decoder: unique symbol;
7
8
  /** An author-facing value schema. Effect is never required in author code. */
@@ -59,6 +60,44 @@ export declare function literal<const T extends string | number | boolean | null
59
60
  export declare const array: <T>(item: Schema<T, boolean>) => Schema<readonly T[]>;
60
61
  /** Parse declared fields and omit undeclared fields. */
61
62
  export declare function object<const F extends Fields>(fields: F): ObjectSchema<F>;
63
+ declare const Exposure: unique symbol;
64
+ /** A schema marked with how app code sees the field in a provider that declares hosts. */
65
+ export type Exposed<S, E extends FieldExposure = FieldExposure> = S & {
66
+ readonly [Exposure]: E;
67
+ };
68
+ /** The marking of one account field, if any. */
69
+ export declare const exposureOf: (schema: Schema<unknown, boolean>) => FieldExposure | undefined;
70
+ /**
71
+ * A field that is not secret, such as a subdomain or region. App code reads its real value and
72
+ * the connect form shows it.
73
+ */
74
+ export declare const plain: <S extends Schema<unknown, boolean>>(schema: S) => Exposed<S, "plain">;
75
+ /**
76
+ * A secret field that app code reads as its real value, for request signing and similar uses.
77
+ * The connect form warns that the app can read it. Prefer an unmarked field, which app code
78
+ * receives as a handle that only reaches the provider's declared hosts.
79
+ */
80
+ export declare const raw: <S extends Schema<unknown, boolean>>(schema: S) => Exposed<S, "raw">;
81
+ /** Marked fields of an account object, by name. */
82
+ export declare const fieldExposure: (fields: Fields) => Readonly<Record<string, FieldExposure>>;
83
+ declare const Secret: unique symbol;
84
+ /**
85
+ * A secret account value. In a provider that declares hosts it is a handle, which the host's
86
+ * outbound network replaces with the real value only on requests to those hosts. Pass it to
87
+ * clients and headers as an ordinary string; do not decode or transform it.
88
+ */
89
+ export type SecretString = string & {
90
+ readonly [Secret]: true;
91
+ };
92
+ type Sealed<T> = T extends string ? SecretString : T;
93
+ /** Account fields as app code receives them: unmarked string fields are secret. */
94
+ export type SecretFields<F extends Fields> = {
95
+ 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];
96
+ };
97
+ /** An account object without declared fields, such as a default OAuth projection. */
98
+ export type SecretObject<T> = {
99
+ readonly [Key in keyof T]: Sealed<T[Key]>;
100
+ };
62
101
  declare const ImportedJsonSchema: unique symbol;
63
102
  /** Read the original document for an imported decoder without a lossy schema round trip. */
64
103
  export declare const importedJsonSchema: (decoder: EffectSchema.Decoder<unknown>) => unknown | undefined;
@@ -72,8 +111,36 @@ export declare const withLazyJsonSchemaDocument: <S extends EffectSchema.Decoder
72
111
  * Relocate a self-contained JSON Schema under a document pointer. Resolve references
73
112
  * before nesting so account schemas can reuse definition names, IDs and anchors.
74
113
  * Only schema nodes are rewritten; examples and ordinary property values stay intact.
114
+ * A `$recursiveRef` becomes the pointer to its static target, such as the relocated root. The
115
+ * patched validator applies it like `"#"` was: the recursive anchor in scope, else that target.
75
116
  */
76
117
  export declare const nestJsonSchema: (input: JsonObject, pointer: string) => JsonObject;
118
+ /**
119
+ * Whether an input key may be named in a validation problem. Other keys can carry supplied data,
120
+ * so problems locate them without echoing them.
121
+ */
122
+ export declare const echoableKey: (key: string) => boolean;
123
+ /**
124
+ * The keys an object accepts, as `object {name, optional?}`. `...` marks an object that also
125
+ * accepts other keys. Names come from the schema, never from supplied input.
126
+ */
127
+ export declare const objectShape: (keys: readonly {
128
+ readonly name: string;
129
+ readonly optional: boolean;
130
+ }[], open: boolean, limit?: number) => string;
131
+ /**
132
+ * The values a schema fixes, as `"v1"` or `one of "a", "b" and 3 more`. Agents already read
133
+ * these values in the tool's signature, so problems list them, up to {@link maxListedValues}
134
+ * values and {@link maxValuesText} characters. They come from the schema, never from input.
135
+ */
136
+ export declare const allowedValues: (values: readonly unknown[]) => string;
137
+ /** Keys listed for each union alternative, so several alternatives fit in one problem. */
138
+ export declare const maxAlternativeKeys = 8;
139
+ /**
140
+ * The alternatives a union accepts, as `string or object {id}`, and the key whose value tells
141
+ * them apart. Shapes, values and the key come from the schema, never from supplied input.
142
+ */
143
+ export declare const unionShape: (alternatives: readonly string[], selector: string | undefined) => string;
77
144
  /** Prepare an interpreted validator. No eval or generated JavaScript runs in any host. */
78
145
  export declare const compileJsonSchemaDecoder: (document: JsonObject) => Effect.Effect<EffectSchema.Codec<EffectSchema.Json, EffectSchema.Json, never, never> & {
79
146
  [ImportedJsonSchema]: {
@@ -81,6 +148,14 @@ export declare const compileJsonSchemaDecoder: (document: JsonObject) => Effect.
81
148
  };
82
149
  }, ValidationError, never>;
83
150
  export declare const lazyJsonSchemaDecoder: (document: () => JsonObject) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, never, never>;
151
+ /**
152
+ * A lazy decoder and the compilation it decodes with. Running `compile` first lets a caller
153
+ * reject an unsupported schema before a side effect whose result the decoder will check.
154
+ */
155
+ export declare const preparedJsonSchemaDecoder: (document: JsonObject) => {
156
+ decoder: EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>;
157
+ compile: Effect.Effect<EffectSchema.Decoder<EffectSchema.Json, never>, ValidationError, never>;
158
+ };
84
159
  /** Preserve the JSON document; compile its validator only when a value is first decoded. */
85
160
  export declare const jsonSchemaDecoder: (input: unknown) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, ValidationError, never>;
86
161
  /** Import JSON metadata now; unsupported schemas and invalid values fail when parsed. */
@@ -91,4 +166,8 @@ export declare const storageFieldOf: (schema: Schema<unknown, boolean>) => Field
91
166
  export declare const id: (table: string) => Schema<string>;
92
167
  /** A host user identifier, stored as a string without imposing a product auth model. */
93
168
  export declare const userId: () => Schema<string>;
169
+ /** Render a decoder as a JSON Schema document, keeping an imported upstream document as-is. */
170
+ export declare const jsonSchemaDocument: (decoder: EffectSchema.Decoder<unknown>) => Effect.Effect<{
171
+ readonly [x: string]: EffectSchema.Json;
172
+ }, EffectSchema.SchemaError, never>;
94
173
  export {};
@@ -13,8 +13,8 @@ export declare const reader: (transport: SkillTransport) => Effect.Effect<{
13
13
  json: (url: string) => Effect.Effect<unknown, SkillLoadFailed, never>;
14
14
  }, never, never>;
15
15
  export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effect.Effect<readonly {
16
- readonly name: string;
17
16
  readonly description: string;
17
+ readonly name: string;
18
18
  readonly files: readonly {
19
19
  readonly path: string;
20
20
  readonly content: string;
@@ -28,8 +28,8 @@ export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effec
28
28
  }[], SkillLoadFailed, never>;
29
29
  /** Fetch all indexed files and reject a publication whose index changes during the read. */
30
30
  export declare const wellKnownSkillsEffect: (options: WellKnownSkillsOptions) => Effect.Effect<readonly {
31
- readonly name: string;
32
31
  readonly description: string;
32
+ readonly name: string;
33
33
  readonly files: readonly {
34
34
  readonly path: string;
35
35
  readonly content: string;
@@ -1,10 +1,12 @@
1
- import { type DatabaseSession } from "../../../app-data/src/index.js";
1
+ import { type DatabaseSession, type reservedFieldNames } from "../../../app-data/src/index.js";
2
+ type ReservedFieldName = (typeof reservedFieldNames)[number];
2
3
  import { type AppStorage } from "../contracts/storage.js";
3
4
  import type { DatabaseDefinition, Database, Table, Tables } from "../contracts/storage.js";
4
5
  import { type Fields } from "./schema.js";
5
6
  export type { DatabaseDefinition, Database, DatabaseReader, Table, Tables, RowOf, } from "../contracts/storage.js";
6
- /** Declare scalar columns using the same schemas as operation inputs. */
7
- export declare const table: <const F extends Fields>(fields: F) => Table<F>;
7
+ /** Declare scalar columns using the same schemas as operation inputs. The host adds `id`,
8
+ * `createdAt` and `updatedAt` to every row, so tables cannot declare those names. */
9
+ export declare const table: <const F extends Fields & { readonly [K in ReservedFieldName]?: never; }>(fields: F) => Table<F>;
8
10
  /** Build a fresh Promise database facade for one authorized invocation. */
9
11
  export declare const authorDatabase: <T extends Tables>(tables: T, session: DatabaseSession, signal: AbortSignal, writable: boolean) => Database<T>;
10
12
  /** Declare storage independently of handlers; the host binds each invocation's database. */
@@ -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,4 +1,4 @@
1
- import { Atom } from "effect/unstable/reactivity";
1
+ import { AsyncResult, Atom } from "effect/unstable/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>";
@@ -1,16 +1,22 @@
1
1
  import { Effect } from "effect";
2
2
  import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
3
- import { UiForbidden, type AppUiAsset } from "../contracts/ui.js";
4
- /** Render an authorized deployment with a host-owned deployment watcher. */
3
+ import { UiForbidden, type AppUiAsset, type UiAccountNotice } from "../contracts/ui.js";
4
+ /**
5
+ * Render an authorized deployment with a host-owned deployment watcher. Account problems that stop
6
+ * the app replace its document with a page that links to their fix; others add a dismissible card.
7
+ */
5
8
  export declare const appDocument: <E, R>(options: {
6
9
  readonly deployment: string;
7
10
  readonly profile?: string | undefined;
8
11
  readonly expectedProfileRevision?: number | undefined;
9
12
  readonly origin: string;
13
+ readonly accounts?: UiAccountNotice | undefined;
10
14
  readonly asset: (path: string) => Effect.Effect<AppUiAsset | undefined, E, R>;
11
15
  }) => Effect.Effect<HttpServerResponse.HttpServerResponse, UiForbidden | E, HttpServerRequest.HttpServerRequest | R>;
12
- /** Revalidate immutable assets only after the host has checked current access and file existence.
13
- * Browsers may retain bytes, but neither browsers nor shared proxies may reuse them without authorization.
16
+ /** Serve an asset only after the host has checked current access and file existence.
17
+ * Asset URLs name their deployment, so their bytes never change: the browser keeps them for a year
18
+ * and does not ask again. Shared proxies never store them. Revoking access stops every new request
19
+ * and all app data, while bytes a browser already downloaded stay in its cache.
14
20
  * HTML remains an uncached host-rendered entry point.
15
21
  */
16
22
  export declare const appAsset: (asset: AppUiAsset | undefined, build: string, path: string) => Effect.Effect<HttpServerResponse.HttpServerResponse, never, HttpServerRequest.HttpServerRequest>;
@@ -1,2 +1,2 @@
1
1
  /** Dependency-free browser source served by each host after app authorization. */
2
- export declare const appWatchScript: string;
2
+ export declare const appWatchScript = "\"use strict\";(()=>{var s=()=>{let i=document.getElementById(\"executor-context\")?.textContent;if(!i)return;let n=JSON.parse(i);if(typeof n!=\"object\"||n===null||!(\"deployment\"in n))return;let r=n.deployment;if(typeof r!=\"string\"||r.length===0)return;let t=new EventSource(\"/_executor/version\"),l=!1,o=()=>{l||(l=!0,t.close(),location.reload())};t.addEventListener(\"version\",d=>{let e=JSON.parse(d.data);typeof e==\"object\"&&e!==null&&\"deployment\"in e&&(e.deployment===null||typeof e.deployment==\"string\")&&e.deployment!==r&&o()}),t.addEventListener(\"revoked\",o),window.addEventListener(\"executor:deployment-changed\",o),window.addEventListener(\"pagehide\",()=>t.close(),{once:!0}),window.addEventListener(\"pageshow\",d=>{d.persisted&&o()})};s();})();";
@@ -0,0 +1,7 @@
1
+ import { UpstreamError } from "../contracts/failure.js";
2
+ /** Whether `bounded` shortened this message, so it may end partway through a secret. */
3
+ export declare const isShortenedUpstream: (message: string) => boolean;
4
+ /** The error a JSON error body states, if it uses JSON-RPC's or OAuth's error format. */
5
+ export declare const bodyUpstreamError: (json: unknown) => UpstreamError | undefined;
6
+ /** The `error` and `error_description` of a Bearer challenge (RFC 6750, section 3). */
7
+ export declare const challengeUpstreamError: (header: string | undefined) => UpstreamError | undefined;
@@ -26,4 +26,4 @@ export declare const dispatchWebhook: <Context extends {
26
26
  readonly [x: string]: string;
27
27
  };
28
28
  readonly body: string;
29
- }, HostDeclarationInvalid | HostOperationNotFound | HostOperationFailed | HostInputInvalid | HostOutputInvalid, never>;
29
+ }, HostOperationNotFound | HostInputInvalid | HostOutputInvalid | HostDeclarationInvalid | HostOperationFailed, never>;
@@ -2,7 +2,15 @@
2
2
  import { Effect } from "effect";
3
3
  import type { AppDefinition } from "../contracts/app.js";
4
4
  import { WorkflowFailure, type WorkflowContext, type WorkflowExecution, type WorkflowStepContext } from "../contracts/workflows.js";
5
- /** Preserve typed failures and cancellation; authored exception text never leaves the app. */
6
- export declare const workflowSafe: <A>(work: Effect.Effect<A, unknown>) => Effect.Effect<A, WorkflowFailure>;
5
+ /**
6
+ * Preserve typed failures and cancellation. Other errors keep their name and bounded message,
7
+ * with the given account secrets replaced.
8
+ */
9
+ export declare const workflowSafe: <A>(work: Effect.Effect<A, unknown>, secrets: readonly string[]) => Effect.Effect<A, WorkflowFailure>;
7
10
  /** Construct one replay's Promise context. Step callbacks acquire fresh capabilities per actual attempt. */
8
- export declare const makeWorkflowContext: (execution: WorkflowExecution, definition: Pick<AppDefinition<never>, "queries" | "mutations">, fresh: (stepId: string, signal: AbortSignal) => Effect.Effect<WorkflowStepContext, WorkflowFailure>, signal: AbortSignal) => Effect.Effect<WorkflowContext>;
11
+ export declare const makeWorkflowContext: (execution: WorkflowExecution, definition: Pick<AppDefinition<never>, "tools">,
12
+ /** A step attempt's context, and the raw account secrets its failures must not reveal. */
13
+ fresh: (stepId: string, signal: AbortSignal) => Effect.Effect<{
14
+ readonly context: WorkflowStepContext;
15
+ readonly secrets: readonly string[];
16
+ }, WorkflowFailure>, signal: AbortSignal) => Effect.Effect<WorkflowContext>;
@@ -1,4 +1,5 @@
1
1
  export { ProviderError } from "./contracts/provider-error.js";
2
+ export { FetchOptionUnsupported, NetworkRefused } from "./contracts/network.js";
2
3
  export type { AppCache, CacheLoadContext, CacheGetOptions } from "./contracts/cache.js";
3
4
  export { CacheError } from "../../app-cache/src/contracts/cache.js";
4
5
  /**
@@ -8,32 +9,49 @@ export { CacheError } from "../../app-cache/src/contracts/cache.js";
8
9
  import { type Schema as EffectSchema } from "effect";
9
10
  import type { WebhookContext } from "./contracts/context.js";
10
11
  import { type JsonResponse as NativeResponse } from "./contracts/http.js";
11
- import { type OAuth2Config, type OAuth2Method as NativeOAuth2Method, type SecretsMethod as NativeSecretsMethod } from "./contracts/provider.js";
12
+ import { type OAuth2Config as NativeOAuth2Config, type OAuth2Method as NativeOAuth2Method, type ReservedAuthorizationParam, type SecretsMethod as NativeSecretsMethod } from "./contracts/provider.js";
12
13
  import type { Webhook as NativeWebhook } from "./contracts/webhooks.js";
13
14
  import { type PromiseMethods } from "./implementation/authoring.js";
14
- import { type Fields, type Infer, type ObjectSchema, type Schema } from "./implementation/schema.js";
15
+ import { type Fields, type Infer, type ObjectSchema, type Schema, type SecretFields, type SecretObject } from "./implementation/schema.js";
15
16
  export { type JsonObject, type JsonValue, ValidationError } from "./contracts/schema.js";
16
- export { type Fields, type Infer, type ObjectSchema, type ObjectValue, type Schema, array, boolean, json, jsonSchema, literal, number, object, record, string, } from "./implementation/schema.js";
17
- export { type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type OAuth2Config, type Provider, } from "./contracts/provider.js";
18
- export { defineProvider } from "./implementation/provider.js";
19
- export { accountOperations } from "./implementation/account-operations.js";
20
- export { dynamicTools } from "./implementation/dynamic-tools.js";
17
+ export { type Fields, type Infer, type ObjectSchema, type ObjectValue, type Schema, array, boolean, json, jsonSchema, literal, number, object, record, string, plain, raw, type SecretString, } from "./implementation/schema.js";
18
+ export { type AccountCheckContext, type AccountCheckResult, type AccountInfo, type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type Provider, type ReservedAuthorizationParam, } from "./contracts/provider.js";
19
+ export { defineProvider, type ProviderOptions } from "./implementation/provider.js";
20
+ export { accountRouter } from "./implementation/account-router.js";
21
+ export { router, dynamicRouter, withApprovals, type RouterDeclaration, type RouterChild, type RouterOptions, } from "./implementation/router.js";
22
+ export type { RouterIcon } from "./contracts/router.js";
21
23
  export { dynamicSkills } from "./implementation/dynamic-skills.js";
22
24
  export type { HostedTool as OperationDescription } from "./contracts/host.js";
25
+ /** Account fields as app code receives them from a method declared with this schema. */
26
+ type AccountFields<S> = S extends ObjectSchema<infer F> ? SecretFields<F> : SecretObject<Infer<S>>;
23
27
  /** A secrets declaration inferred from an author schema. */
24
- export type SecretsMethod<Shape extends ObjectSchema<Fields>> = NativeSecretsMethod<EffectSchema.Decoder<Infer<Shape>>>;
28
+ export type SecretsMethod<Shape extends ObjectSchema<Fields>> = NativeSecretsMethod<EffectSchema.Decoder<AccountFields<Shape>>>;
25
29
  /** An OAuth declaration inferred from its author-facing response schema. */
26
- export type OAuth2Method<Response extends Schema<unknown, boolean>> = NativeOAuth2Method<EffectSchema.Decoder<Infer<Response>>>;
30
+ export type OAuth2Method<Response extends Schema<unknown, boolean>> = NativeOAuth2Method<EffectSchema.Decoder<AccountFields<Response>>>;
27
31
  /** Default OAuth fields visible to app code. Host-only grants and clients stay private. */
28
32
  export declare const OAuth2AccessToken: Schema<{
29
33
  readonly access_token: string;
30
34
  }, false>;
35
+ /**
36
+ * OAuth options as authors write them. `authorizationParams` naming a host-owned protocol
37
+ * parameter such as `state` or `scope` is a type error as well as a declaration failure.
38
+ */
39
+ export type OAuth2Config = WithoutReservedParams<NativeOAuth2Config>;
40
+ type WithoutReservedParams<Config> = Config extends unknown ? "authorizationParams" extends keyof Config ? Config & {
41
+ readonly authorizationParams?: {
42
+ readonly [Key in ReservedAuthorizationParam]?: never;
43
+ };
44
+ } : Config : never;
31
45
  /** Declare a secrets method without requiring an Effect schema from the author. */
32
46
  export declare const secrets: <const F extends Fields>(options: {
33
47
  readonly label: string;
34
48
  readonly fields: ObjectSchema<F>;
35
49
  }) => SecretsMethod<ObjectSchema<F>>;
36
- /** Declare OAuth discovery/endpoints and an optional app-visible response projection. */
50
+ /**
51
+ * Declare OAuth discovery/endpoints and an optional app-visible response projection.
52
+ * `authorizationParams` adds service-defined sign-in parameters; a declared `authorizationUrl`
53
+ * keeps its own query. Neither can set host-owned parameters, and each parameter appears once.
54
+ */
37
55
  export declare function oauth2(options: OAuth2Config): OAuth2Method<typeof OAuth2AccessToken>;
38
56
  export declare function oauth2<Response extends Schema<unknown, boolean>>(options: OAuth2Config & {
39
57
  readonly response: Response;
@@ -57,7 +75,7 @@ export { NotImplemented } from "./contracts/app.js";
57
75
  export { ElicitationFailed, type FormElicitation, type ElicitationResponse, type Elicit, } from "./contracts/elicitation.js";
58
76
  export { table, defineDatabase, type Table, type DatabaseReader, type Database, type DatabaseDefinition, } from "./implementation/storage.js";
59
77
  export { id, userId } from "./implementation/schema.js";
60
- export { query, mutation, withApproval, type Operation, type OperationOptions, } from "./implementation/operations.js";
78
+ export { query, mutation, withApproval, toolAnnotations, type Operation, type OperationOptions, } from "./implementation/operations.js";
61
79
  export type { OperationContext } from "./contracts/operations.js";
62
80
  export { workflow, type Workflow, type WorkflowDeclaration } from "./implementation/workflows.js";
63
81
  export { NonRetryableError, WorkflowFailure, type WorkflowContext, type WorkflowStepContext, type WorkflowStep, type WorkflowStepOptions, type WorkflowDuration, type WorkflowReads, type WorkflowControls, } from "./contracts/workflows.js";
@@ -1,8 +1,5 @@
1
1
  import type { ProcessConfig } from "./contracts/mcp.js";
2
2
  import { type OperationKinds } from "./implementation/protocol-operations.js";
3
3
  export { McpError, type McpToolContext, type ProcessConfig } from "./contracts/mcp.js";
4
- /** Discover an account's tools; each discovery and call owns and closes its subprocess. */
5
- export declare const stdioOperations: (config: ProcessConfig, signal?: AbortSignal, kinds?: OperationKinds) => Promise<{
6
- queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
7
- mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
8
- }>;
4
+ /** Discover an account's tools as a router; each discovery and call owns and closes its subprocess. */
5
+ export declare const stdioRouter: (config: ProcessConfig, signal?: AbortSignal, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
@@ -1,10 +1,30 @@
1
1
  /** HTTP MCP helpers. Requires the optional @modelcontextprotocol/sdk peer. */
2
2
  import type { OperationKinds } from "./implementation/protocol-operations.js";
3
+ import type { McpHealthOptions } from "./contracts/mcp.js";
4
+ import type { AccountCheckContext, AuthMethods } from "./contracts/provider.js";
3
5
  import { type McpCatalogOptions } from "./implementation/mcp-catalog.js";
4
6
  export type { McpCatalogOptions } from "./implementation/mcp-catalog.js";
5
- export { McpError, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
6
- /** Discover operations for the selected account. Kinds override uncertain upstream read-only hints. */
7
- export declare const mcpOperations: (options: McpCatalogOptions, kinds?: OperationKinds) => Promise<{
8
- dynamicTools: import("./contracts/dynamic-tools.js").DynamicTools;
9
- }>;
7
+ export { McpCredentialsUnverified, McpError, type McpHealthOptions, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
8
+ /**
9
+ * A router over a server's tools for the selected account. Its title, description and
10
+ * instructions come from the server. Kinds override uncertain upstream read-only hints.
11
+ */
12
+ export declare const mcpRouter: (options: McpCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
13
+ /**
14
+ * A provider `health` check for an MCP server. Pass the check context `health` receives, then the
15
+ * server's `url` and the `headers` that send the account's credentials:
16
+ * `health: (check) => mcpHealth(check, { url, headers: headers(check.account) })`.
17
+ *
18
+ * It connects with those headers, initializes, and reads the first page of tools, then does the
19
+ * same without any headers. No tool runs. The check passes only when the server accepts the account
20
+ * and refuses the attempt without credentials. A refused account throws `ProviderError`, as HTTP
21
+ * helpers do. An unreachable or unusable server throws `McpError`, and a request Executor's network
22
+ * refuses throws `NetworkRefused`. A server that also answers without credentials, or whose answer
23
+ * to that attempt is not a refusal, throws `McpCredentialsUnverified`. Each of these errors means
24
+ * the check could not verify the account, and the account form explains why. Send credentials only
25
+ * in `headers`; the attempt without them uses the same `url`. The check context's `signal` cancels
26
+ * both attempts, and they share one budget that ends early enough before its `deadline` to report a
27
+ * server that did not answer in time. `timeoutMs` can only shorten that budget.
28
+ */
29
+ export declare const mcpHealth: <Auth extends AuthMethods>(check: AccountCheckContext<Auth>, options: McpHealthOptions) => Promise<void>;
10
30
  export type { OperationKinds } from "./implementation/protocol-operations.js";
@@ -2,11 +2,11 @@
2
2
  import { type OperationKinds } from "./implementation/protocol-operations.js";
3
3
  import type { OpenapiToolsOptions } from "./contracts/openapi.js";
4
4
  export { OpenapiError, isOpenapiTextMedia, openapiBinaryResultSchema, OpenapiErrorResponse, type OpenapiToolsOptions, type OpenapiOperation, type CredentialBinding, OpenapiParameter, OpenapiRequestBody, openapiMediaKind, } from "./contracts/openapi.js";
5
- /** Discover operations for the selected account. Kinds override uncertain upstream read-only hints. */
6
- export declare const openapiOperations: (options: OpenapiToolsOptions, kinds?: OperationKinds) => Promise<{
7
- queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
8
- mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
9
- }>;
5
+ /**
6
+ * Discover a document's operations as a router for the selected account. Kinds override uncertain
7
+ * upstream read-only hints. Mount it under a key, or override its metadata with `router(...)`.
8
+ */
9
+ export declare const openapiRouter: (options: OpenapiToolsOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
10
10
  export type { OperationKinds } from "./implementation/protocol-operations.js";
11
11
  export * from "./contracts/openapi-compile.js";
12
- export { liveOpenapiOperations, type OpenapiSourceOptions, } from "./implementation/openapi-source.js";
12
+ export { liveOpenapiRouter, type OpenapiSourceOptions } from "./implementation/openapi-source.js";
@@ -5,8 +5,8 @@ export { SkillLoadFailed, SkillDefinitionInvalid, SkillServiceName, type SkillRe
5
5
  * the catalog; without it, mutable refs resolve again on each call.
6
6
  */
7
7
  export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<readonly {
8
- readonly name: string;
9
8
  readonly description: string;
9
+ readonly name: string;
10
10
  readonly files: readonly {
11
11
  readonly path: string;
12
12
  readonly content: string;
@@ -20,8 +20,8 @@ export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<rea
20
20
  }[]>;
21
21
  /** Fetch a published skill index and its text files. Pass `cache: ctx.cache` to reuse the catalog. */
22
22
  export declare const wellKnownSkills: (options: WellKnownSkillsOptions) => Promise<readonly {
23
- readonly name: string;
24
23
  readonly description: string;
24
+ readonly name: string;
25
25
  readonly files: readonly {
26
26
  readonly path: string;
27
27
  readonly content: string;
@@ -35,8 +35,8 @@ export declare const wellKnownSkills: (options: WellKnownSkillsOptions) => Promi
35
35
  }[]>;
36
36
  /** Parse a bundled standard skill directory into an app capability. */
37
37
  export declare const fileSkill: (files: readonly SkillFile[]) => Promise<{
38
- readonly name: string;
39
38
  readonly description: string;
39
+ readonly name: string;
40
40
  readonly files: readonly {
41
41
  readonly path: string;
42
42
  readonly content: string;
@@ -50,8 +50,8 @@ export declare const fileSkill: (files: readonly SkillFile[]) => Promise<{
50
50
  }>;
51
51
  /** Read skill directories from ctx.files. Omitted path selects skills/; missing folders return []. */
52
52
  export declare const folderSkills: (options: FolderSkillsOptions) => Promise<readonly {
53
- readonly name: string;
54
53
  readonly description: string;
54
+ readonly name: string;
55
55
  readonly files: readonly {
56
56
  readonly path: string;
57
57
  readonly content: string;
@@ -1,8 +1,11 @@
1
1
  /** Correlate transport and decoded outcomes without exporting response bodies or errors. */
2
2
  import { Effect, Schema, Tracer } from "effect";
3
3
  import { HttpClient, HttpClientError } from "effect/unstable/http";
4
- /** A random document identity. It is never an authentication or user identifier. */
5
- export declare const browserPageId: () => string;
4
+ /**
5
+ * A random identity for the current browser document. It is never an authentication or user
6
+ * identifier. Server renders have no document, so they get none instead of sharing one per isolate.
7
+ */
8
+ export declare const browserPageId: () => string | undefined;
6
9
  /** Safe event shared with the host's error reporter and product analytics. */
7
10
  export declare const BrowserOperationFailure: Schema.Struct<{
8
11
  readonly error_type: Schema.Literals<readonly ["BrowserDecodeFailed", "BrowserTransportFailed", "BrowserOperationFailed"]>;
@@ -33,8 +33,8 @@ export declare const TelemetryConfig: Schema.Struct<{
33
33
  export type TelemetryConfig = typeof TelemetryConfig.Type;
34
34
  /** Host-only destinations; never copied into an app's invocation telemetry capability. */
35
35
  export declare const CurrentTelemetryConfig: Context.Reference<{
36
- readonly version: string;
37
36
  readonly service: string;
37
+ readonly version: string;
38
38
  readonly environment: string;
39
39
  readonly clock?: "system" | "cloudflare-io" | undefined;
40
40
  readonly traces?: {
@@ -59,8 +59,8 @@ export declare const CurrentTelemetryConfig: Context.Reference<{
59
59
  } | undefined>;
60
60
  /** Read OTLP endpoints uniformly for all signals; development chooses which signals to configure. */
61
61
  export declare const telemetryConfig: (service: string) => Effect.Effect<{
62
- readonly version: string;
63
62
  readonly service: string;
63
+ readonly version: string;
64
64
  readonly environment: string;
65
65
  readonly clock?: "system" | "cloudflare-io" | undefined;
66
66
  readonly traces?: {
@@ -0,0 +1,48 @@
1
+ import { Schema, type Cause } from "effect";
2
+ import "effect/unstable/httpapi";
3
+ /**
4
+ * Encode the class's `message` getter as a required wire string. Decoding validates the field,
5
+ * then omits it, so the class derives its own message from the parsed payload and a supplied
6
+ * value never replaces it.
7
+ */
8
+ export declare const MessageField: Schema.decodeTo<Schema.optionalKey<Schema.String>, Schema.String, never, never>;
9
+ /** An expected API error whose response states its cause in a `message` derived from its fields. */
10
+ export interface ApiError extends Cause.YieldableError {
11
+ readonly _tag: string;
12
+ }
13
+ type Header<Tag extends string> = {
14
+ readonly tag: Tag;
15
+ readonly status: number;
16
+ };
17
+ type Definition<Tag extends string, Fields extends Schema.Struct.Fields> = Header<Tag> & {
18
+ readonly fields: Fields & {
19
+ readonly [Key in "_tag" | "message"]?: never;
20
+ };
21
+ /**
22
+ * The cause, stated for API and agent callers. It is also the error's `message`, which traces
23
+ * record, so it never includes credentials, upstream response text or submitted values.
24
+ */
25
+ readonly message: string | ((fields: Schema.Struct.Type<Fields>) => string);
26
+ };
27
+ type ErrorFields<Tag extends string, Fields extends Schema.Struct.Fields> = Omit<Schema.TaggedStruct<Tag, Fields & {
28
+ readonly message: typeof MessageField;
29
+ }>, "~type.make.in"> & {
30
+ readonly "~type.make.in": Schema.TaggedStruct<Tag, Fields>["~type.make.in"];
31
+ };
32
+ type ErrorClass<Tag extends string, Fields extends Schema.Struct.Fields> = Schema.Class<Schema.Struct.Type<Fields> & ApiError & {
33
+ readonly _tag: Tag;
34
+ }, ErrorFields<Tag, Fields>, ApiError>;
35
+ /** Define an error with no payload and a fixed message. Its tag is its public error code. */
36
+ declare function define<const Tag extends string>(definition: Header<Tag> & {
37
+ readonly message: string;
38
+ }): ErrorClass<Tag, {}>;
39
+ /** Define an error whose message can depend on its parsed fields. */
40
+ declare function define<const Tag extends string, const Fields extends Schema.Struct.Fields>(definition: Definition<Tag, Fields>): ErrorClass<Tag, Fields>;
41
+ /**
42
+ * Define the schema, constructor and API message of an expected error together. Errors that need
43
+ * a user-facing title and recovery use `UserFacingError`, which carries the same message field.
44
+ */
45
+ export declare const ApiError: {
46
+ define: typeof define;
47
+ };
48
+ export {};