apps 0.0.1-beta.8 → 0.0.1-beta.81

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 (180) hide show
  1. package/README.md +25 -22
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-72JNVHPK.js → chunk-4NFSABEA.js} +4 -3
  4. package/js/chunk-5FHWNLCI.js +88 -0
  5. package/js/chunk-5WGONRKQ.js +426 -0
  6. package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
  7. package/js/chunk-CDXQDN7W.js +92 -0
  8. package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
  9. package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
  10. package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
  11. package/js/{chunk-FL2QR3XW.js → chunk-HJG4RBYM.js} +333 -69
  12. package/js/chunk-I6Q7ZPKJ.js +49 -0
  13. package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
  14. package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
  15. package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
  16. package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
  17. package/js/{chunk-WLE7WX2U.js → chunk-NG56RPCA.js} +2348 -472
  18. package/js/chunk-OD3KFKZD.js +1617 -0
  19. package/js/{chunk-Z5M2LQOZ.js → chunk-OY47QPQY.js} +67 -55
  20. package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
  21. package/js/chunk-PL5KOEZD.js +334 -0
  22. package/js/chunk-Q4IZAUIF.js +285 -0
  23. package/js/{chunk-RJDDBDSN.js → chunk-QWQM3CLH.js} +795 -177
  24. package/js/{chunk-RFVIONFX.js → chunk-TE25A7D6.js} +123 -44
  25. package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
  26. package/js/chunk-W6XCQAXP.js +171 -0
  27. package/js/chunk-WCGAO3X5.js +348 -0
  28. package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
  29. package/js/{chunk-CMYUWAX7.js → chunk-YQUG4CES.js} +126 -31
  30. package/js/{chunk-UESPOTUI.js → chunk-Z2SWTZCF.js} +861 -231
  31. package/js/client.js +142 -94
  32. package/js/contracts.js +127 -26
  33. package/js/effect.js +19 -19
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +50 -40
  36. package/js/host.js +83 -58
  37. package/js/index.js +131 -46
  38. package/js/mcp/effect.js +23 -21
  39. package/js/mcp/stdio.js +44 -34
  40. package/js/mcp.js +76 -53
  41. package/js/openapi.js +4071 -1357
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +208 -81
  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 +8604 -223
  50. package/package.json +3 -4
  51. package/runtime.json +1 -1
  52. package/types/app-cache/src/contracts/cache.d.ts +18 -0
  53. package/types/app-cache/src/index.d.ts +34 -2
  54. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  55. package/types/apps/src/contracts/app.d.ts +7 -3
  56. package/types/apps/src/contracts/cache.d.ts +20 -0
  57. package/types/apps/src/contracts/context.d.ts +19 -11
  58. package/types/apps/src/contracts/elicitation.d.ts +23 -7
  59. package/types/apps/src/contracts/events.d.ts +93 -0
  60. package/types/apps/src/contracts/failure.d.ts +30 -1
  61. package/types/apps/src/contracts/graphql.d.ts +2 -1
  62. package/types/apps/src/contracts/host.d.ts +649 -17
  63. package/types/apps/src/contracts/live.d.ts +2 -0
  64. package/types/apps/src/contracts/mcp.d.ts +80 -10
  65. package/types/apps/src/contracts/network.d.ts +120 -0
  66. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  67. package/types/apps/src/contracts/openapi.d.ts +41 -9
  68. package/types/apps/src/contracts/operations.d.ts +8 -4
  69. package/types/apps/src/contracts/placement.d.ts +102 -0
  70. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  71. package/types/apps/src/contracts/protocols/1.d.ts +733 -81
  72. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  73. package/types/apps/src/contracts/protocols/2.d.ts +69 -26
  74. package/types/apps/src/contracts/protocols/3.d.ts +133 -33
  75. package/types/apps/src/contracts/protocols/4.d.ts +122 -45
  76. package/types/apps/src/contracts/protocols/5.d.ts +157 -47
  77. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  78. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  79. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  80. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  81. package/types/apps/src/contracts/protocols/current.d.ts +3843 -0
  82. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  83. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  84. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  85. package/types/apps/src/contracts/provider.d.ts +90 -6
  86. package/types/apps/src/contracts/skills.d.ts +50 -13
  87. package/types/apps/src/contracts/sql.d.ts +63 -0
  88. package/types/apps/src/contracts/ui.d.ts +37 -3
  89. package/types/apps/src/contracts/workflows.d.ts +6 -0
  90. package/types/apps/src/facet.d.ts +4 -5
  91. package/types/apps/src/host.d.ts +5 -0
  92. package/types/apps/src/implementation/account-router.d.ts +4 -3
  93. package/types/apps/src/implementation/authoring.d.ts +25 -5
  94. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  95. package/types/apps/src/implementation/cache.d.ts +28 -1
  96. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  97. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  98. package/types/apps/src/implementation/events.d.ts +59 -0
  99. package/types/apps/src/implementation/failure-detail.d.ts +25 -3
  100. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  101. package/types/apps/src/implementation/graphql.d.ts +4 -3
  102. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  103. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  104. package/types/apps/src/implementation/live.d.ts +2 -2
  105. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  106. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  107. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  108. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  109. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  110. package/types/apps/src/implementation/mcp.d.ts +20 -9
  111. package/types/apps/src/implementation/network.d.ts +16 -0
  112. package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
  113. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  114. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  115. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  116. package/types/apps/src/implementation/openapi-source.d.ts +18 -0
  117. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  118. package/types/apps/src/implementation/operations.d.ts +17 -2
  119. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  120. package/types/apps/src/implementation/placement.d.ts +60 -0
  121. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  122. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  123. package/types/apps/src/implementation/provider.d.ts +18 -3
  124. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  125. package/types/apps/src/implementation/router-catalog.d.ts +11 -13
  126. package/types/apps/src/implementation/router.d.ts +16 -5
  127. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  128. package/types/apps/src/implementation/schema.d.ts +90 -10
  129. package/types/apps/src/implementation/skills.d.ts +18 -24
  130. package/types/apps/src/implementation/sql.d.ts +71 -0
  131. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  132. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  133. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  134. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  135. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  136. package/types/apps/src/implementation/ui-serving.d.ts +28 -9
  137. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  138. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  139. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  140. package/types/apps/src/implementation/workflows.d.ts +1 -1
  141. package/types/apps/src/index.d.ts +55 -13
  142. package/types/apps/src/mcp.d.ts +20 -1
  143. package/types/apps/src/openapi.d.ts +1 -1
  144. package/types/apps/src/react.d.ts +1 -1
  145. package/types/apps/src/skills.d.ts +10 -8
  146. package/types/apps/src/ui-serving.d.ts +1 -1
  147. package/types/telemetry/src/app-records.d.ts +42 -0
  148. package/types/telemetry/src/browser-operations.d.ts +2 -2
  149. package/types/telemetry/src/browser.d.ts +8 -3
  150. package/types/telemetry/src/config.d.ts +2 -2
  151. package/types/telemetry/src/index.d.ts +2 -1
  152. package/types/telemetry/src/layer.d.ts +10 -4
  153. package/types/telemetry/src/measurements.d.ts +1 -1
  154. package/types/telemetry/src/ownership.d.ts +60 -0
  155. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  156. package/types/telemetry/src/relay.d.ts +16 -6
  157. package/types/telemetry/src/span-attributes.d.ts +17 -1
  158. package/types/telemetry/src/transport.d.ts +8 -1
  159. package/types/utils/src/api-error.d.ts +55 -0
  160. package/types/utils/src/connection-failure.d.ts +33 -0
  161. package/types/utils/src/recorded-message.d.ts +18 -0
  162. package/types/utils/src/user-facing-error.d.ts +83 -0
  163. package/js/chunk-MKWZPDR6.js +0 -63
  164. package/js/chunk-N7YDVXYJ.js +0 -186
  165. package/js/chunk-NKLWZJLE.js +0 -172
  166. package/js/chunk-OCYUEU47.js +0 -224
  167. package/js/chunk-PJJ24GU7.js +0 -877
  168. package/js/chunk-PZB6T6KU.js +0 -19
  169. package/js/chunk-R3EV5FTO.js +0 -97
  170. package/js/chunk-YXQHV65J.js +0 -242
  171. package/js/chunk-ZQINWV4W.js +0 -630
  172. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  173. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  174. package/types/app-data/src/implementation/promise.d.ts +0 -68
  175. package/types/app-data/src/implementation/range.d.ts +0 -8
  176. package/types/app-data/src/implementation/schema.d.ts +0 -18
  177. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  178. package/types/app-data/src/index.d.ts +0 -4
  179. package/types/apps/src/contracts/storage.d.ts +0 -68
  180. package/types/apps/src/implementation/storage.d.ts +0 -15
@@ -1,17 +1,51 @@
1
1
  /** Browser-to-host operations bind identity and authentication outside authored app code. */
2
- import { Schema } from "effect";
3
- import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
2
+ import { Schema, type Effect, type Stream } from "effect";
3
+ import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
4
4
  /** Non-secret page context injected by the serving host. */
5
5
  export declare const UiContext: Schema.Struct<{
6
6
  readonly deployment: Schema.NonEmptyString;
7
7
  readonly profile: Schema.optional<Schema.NonEmptyString>;
8
8
  readonly expectedProfileRevision: Schema.optional<Schema.Int>;
9
9
  }>;
10
+ /** A problem with one of the page profile's accounts, from stored state. Labels are the owner's own names. */
11
+ export type UiAccountProblem = {
12
+ readonly provider: string;
13
+ readonly reason: "missing" | "removed" | "incompatible";
14
+ } | {
15
+ readonly provider: string;
16
+ readonly account: string;
17
+ readonly reason: "credentials_rejected" | "forbidden" | "upstream_unavailable" | "check_failed";
18
+ };
19
+ /** Account problems found when the page opened, with dashboard links that resolve them. */
20
+ export interface UiAccountNotice {
21
+ readonly app: string;
22
+ readonly problems: readonly UiAccountProblem[];
23
+ /** The profile's accounts in the dashboard. */
24
+ readonly fix: string;
25
+ /** The dashboard chooser, returning to this page. */
26
+ readonly choose: string;
27
+ }
10
28
  /** Retained browser bytes. Hosts authorize access before reading or rendering them. */
11
- export interface AppUiAsset {
29
+ export interface AppUiFile {
12
30
  readonly body: Uint8Array;
13
31
  readonly contentType: string;
14
32
  }
33
+ /** One byte range of a stored file, already within its size. */
34
+ export interface AppUiRange {
35
+ readonly offset: number;
36
+ readonly length: number;
37
+ }
38
+ /**
39
+ * A public file the deployment's source served from `ui/public/`, which the host copied to its
40
+ * own store. `etag` names its exact bytes. Hosts authorize access before reading it.
41
+ */
42
+ export interface AppUiStoredFile {
43
+ readonly contentType: string;
44
+ readonly size: number;
45
+ readonly etag: string;
46
+ readonly read: (range: AppUiRange | undefined) => Effect.Effect<Stream.Stream<Uint8Array, UiFailed>, UiFailed>;
47
+ }
48
+ export type AppUiAsset = AppUiFile | AppUiStoredFile;
15
49
  /** Requests name an operation on this app and the page's deployment, never another app or account. */
16
50
  export declare const UiOperation: Schema.Struct<{
17
51
  readonly name: Schema.NonEmptyString;
@@ -1,5 +1,6 @@
1
1
  /** Portable workflow declarations, run views and durable execution capabilities. */
2
2
  import { Schema, type Effect } from "effect";
3
+ import { RecordedMessage } from "../../../utils/src/recorded-message.js";
3
4
  import { JsonValue } from "./schema.js";
4
5
  import type { AppContext, AppRequirements, QueryContext, MutationContext } from "./context.js";
5
6
  import type { Operation } from "../implementation/operations.js";
@@ -49,6 +50,11 @@ declare const WorkflowFailure_base: Schema.Class<WorkflowFailure, Schema.TaggedS
49
50
  }>, import("effect/Cause").YieldableError>;
50
51
  /** Failures cross host boundaries as reason codes plus the app's own bounded error detail. */
51
52
  export declare class WorkflowFailure extends WorkflowFailure_base {
53
+ /**
54
+ * The step name and error detail are the app's. Its run's owner reads them; telemetry records
55
+ * only the reason, however the failure was built or decoded.
56
+ */
57
+ get [RecordedMessage](): string | undefined;
52
58
  }
53
59
  /** Explicitly stop retrying an authored step. Its message is reported like any step error. */
54
60
  export declare class NonRetryableError extends Error {
@@ -1,5 +1,4 @@
1
- /** Native workerd SQLite capability; used only by the generated data facet, never browser bundles. */
2
- import * as Sqlite from "@effect/sql-sqlite-do/SqliteClient";
3
- import type { AppStorage } from "./contracts/storage.js";
4
- /** Bind one facet's raw storage at the runtime edge. Each operation owns its native SQL scope. */
5
- export declare const facetStorage: (storage: NonNullable<Sqlite.SqliteClientConfig["storage"]>) => AppStorage;
1
+ /** The data facet's storage capability; used only by the generated data facet, never browser bundles. */
2
+ import type { AppSqlStorage } from "./contracts/sql.js";
3
+ /** Bind one facet's storage at the runtime edge. App code receives `ctx.sql` over it, never the storage. */
4
+ export declare const facetStorage: (storage: AppSqlStorage) => AppSqlStorage;
@@ -6,6 +6,11 @@ export { isolatedCacheSession } from "./implementation/cache-session.js";
6
6
  export declare const hostContext: (accounts: ResolvedAccountsInput, approval?: unknown) => HostContext;
7
7
  /** Portable Promise handler. Invoke only after the host has authorized and resolved accounts. */
8
8
  export declare const createAppHandler: (app: unknown) => ((request: Request, context: HostContext) => Promise<Response>);
9
+ /**
10
+ * The clock this framework's spans read, in nanoseconds. The runtime's bridge times the isolate's
11
+ * whole dispatch with it, so that time and the invocation's own timing share one clock.
12
+ */
13
+ export declare const isolatedClock: () => bigint;
9
14
  /** Isolates return bounded, telemetry beside the protocol result; no exporter secret enters app code. */
10
15
  export declare const createIsolatedAppHandler: (app: unknown) => (request: Request, context: HostContext) => Promise<Response>;
11
16
  /**
@@ -3,10 +3,11 @@ import { type RouterDeclaration } from "./router.js";
3
3
  * Discover each selected account's router and combine matching names.
4
4
  * Calls take { accountId, input }; each branch retains its account's input schema,
5
5
  * credentials, approval and output validation. Empty selections expose no operations.
6
- * Discovery is sequential and cancellation follows the caller's signal.
6
+ * Discovery is sequential and cancellation follows the caller's signal. `discover` may return the
7
+ * router or a Promise of it, and the combined router keeps its operations' handler contexts.
7
8
  */
8
9
  export declare const accountRouter: <Account extends {
9
10
  readonly id: string;
10
- }>(accounts: readonly Account[], discover: (account: Account) => Promise<RouterDeclaration>, options: {
11
+ }, Query = unknown, Mutation = unknown>(accounts: readonly Account[], discover: (account: Account) => RouterDeclaration<Query, Mutation> | Promise<RouterDeclaration<Query, Mutation>>, options: {
11
12
  readonly signal: AbortSignal;
12
- }) => Promise<RouterDeclaration>;
13
+ }) => Promise<RouterDeclaration<Query, Mutation>>;
@@ -1,12 +1,32 @@
1
1
  /** Small, explicit adapters between authored callbacks and native Effect operations. */
2
- import { Effect } from "effect";
2
+ import { Effect, type Context } from "effect";
3
3
  /** Project one Effect operation into its author-facing Promise signature. */
4
4
  export type PromiseMethod<Method> = Method extends (...args: infer Args) => Effect.Effect<infer A, infer _E> ? (...args: Args) => Promise<A> : Method;
5
5
  /** Project only an object's methods; data and schema types are not recursively rewritten. */
6
6
  export type PromiseMethods<T> = {
7
7
  readonly [Key in keyof T]: PromiseMethod<T[Key]>;
8
8
  };
9
- /** Reuse a framework callback's cancellation-bound Effect, or adapt an ordinary async callback. */
10
- export declare const fromPromise: <Args extends readonly unknown[], A>(callback: (...args: Args) => Promise<A>) => ((...args: Args) => Effect.Effect<A, unknown>);
11
- /** Bind cancellation once so Promise callers and native framework callers run the same operation. */
12
- export declare const toPromise: <Args extends readonly unknown[], A, E>(operation: (...args: Args) => Effect.Effect<A, E>, signal?: AbortSignal) => ((...args: Args) => Promise<A>);
9
+ /** Which of the app's callbacks runs, recorded on the `app.code` span around it. */
10
+ export type AppCode = "factory" | "router" | "approval" | "handler" | "loader" | "cache" | "webhook" | "check" | "skills" | "elicitation" | "workflow" | "step";
11
+ /**
12
+ * Run `effect` as the app's own code. Its time is the app's, except for work it starts for
13
+ * Executor, an upstream or a person, which opens its own boundary inside.
14
+ */
15
+ export declare const appCode: (code: AppCode) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, import("effect/Tracer").ParentSpan>>;
16
+ /**
17
+ * Reuse a framework callback's cancellation-bound Effect, or run an ordinary async callback as the
18
+ * app's code. Every callback an app supplies enters the framework here, so its time is the app's.
19
+ */
20
+ export declare const fromPromise: <Args extends readonly unknown[], A>(callback: (...args: Args) => Promise<A>, code: AppCode) => ((...args: Args) => Effect.Effect<A, unknown>);
21
+ /**
22
+ * `target[key]`, called on `target`. A method read off its object as a bare value loses its
23
+ * receiver, so an app's method, such as one of its cache's, enters `fromPromise` through this.
24
+ */
25
+ export declare const method: <K extends PropertyKey, T extends { readonly [P in K]: (...args: never) => unknown; }>(target: T, key: K) => T[K];
26
+ /**
27
+ * Bind cancellation once so Promise callers and native framework callers run the same operation.
28
+ * `signalOf` is the signal, or reads it from each call's arguments, such as a loader's `context.signal`.
29
+ */
30
+ export declare const toPromise: <Args extends readonly unknown[], A, E>(operation: (...args: Args) => Effect.Effect<A, E>, signalOf?: AbortSignal | ((...args: Args) => AbortSignal),
31
+ /** Services a Promise call runs with, such as its invocation's telemetry. */
32
+ services?: Context.Context<never>) => ((...args: Args) => Promise<A>);
@@ -0,0 +1,6 @@
1
+ /** Compiled from src/browser/app-watch.ts. */
2
+ export declare const appWatchSource = "\"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();})();";
3
+ /** Compiled from src/browser/app-failure.ts. */
4
+ export declare const appFailureSource = "\"use strict\";(()=>{var M=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,v=/^(?:chrome|moz|safari-web)-extension:/,A=new Set([\"ResizeObserver loop completed with undelivered notifications.\",\"ResizeObserver loop limit exceeded\"]),V=new Set([\"Error\",\"TypeError\",\"ReferenceError\",\"SyntaxError\",\"RangeError\",\"URIError\",\"EvalError\",\"AggregateError\"]),b=(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},h=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,x=f.get(a);if(x!==void 0&&r-x<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:\"executor.ui.failure.suppressed\",value:{intValue:String(g)}}),g=0;let E=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,\"0\")).join(\"\"),S=`${Date.now()}000000`,n,l=\"Sending error report\\u2026\",k=()=>{if(d?.open)return;let s=document.createElement(\"div\"),D=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 R=document.createElement(\"details\"),T=document.createElement(\"summary\");T.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: ${E}`,R.append(T,c),n=document.createElement(\"p\"),n.setAttribute(\"role\",\"status\"),n.textContent=l;let u=document.createElement(\"button\");u.type=\"button\",u.textContent=\"Reload page\",u.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,R,n,u,p),D.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:E,spanId:E.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=>{l=s.ok?\"Error report sent.\":\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=l)},()=>{l=\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=l)})};window.addEventListener(\"error\",e=>{if(e instanceof ErrorEvent){if(v.test(e.filename)||e.error===null&&e.lineno===0&&A.has(e.message))return;let t=b(e.filename,e.lineno,e.colno);e.error instanceof Error&&V.has(e.error.name)&&t.push({key:\"exception.type\",value:{stringValue:e.error.name}}),h(\"runtime\",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&h(\"script\",`Could not load script: ${e.target.src}`,b(e.target.src))},!0),window.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;h(\"rejection\",t instanceof Error?t.stack??t.message:\"An app operation failed without handling its error.\")})};M();})();";
5
+ /** Compiled from src/browser/account-notice.ts. */
6
+ export declare const accountNoticeSource = "\"use strict\";(()=>{var g=()=>{let r=document.getElementById(\"executor-account-notice\")?.textContent;if(!r)return;let t=JSON.parse(r);if(typeof t!=\"object\"||t===null||!(\"items\"in t)||!(\"fix\"in t))return;let c=t.items,s=t.fix;if(!Array.isArray(c)||typeof s!=\"string\")return;let a=()=>{let i=document.createElement(\"div\"),x=i.attachShadow({mode:\"open\"}),d=document.createElement(\"style\");d.textContent=\"aside{position:fixed;right:16px;bottom:16px;z-index:2147483647;max-width:360px;box-sizing:border-box;padding:14px 16px;border-radius:10px;border:1px solid #fcd34d;background:#fffbeb;color:#451a03;font:14px/1.45 ui-sans-serif,system-ui,sans-serif;box-shadow:0 8px 24px rgb(0 0 0/.12)}strong{display:block;margin-bottom:4px}ul{margin:0 0 10px;padding-left:18px}div{display:flex;gap:12px;align-items:center}a{color:inherit;font-weight:600}button{margin-left:auto;font:inherit;background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}\";let e=document.createElement(\"aside\");e.setAttribute(\"role\",\"status\"),e.setAttribute(\"aria-label\",\"Account warning\");let l=document.createElement(\"strong\");l.textContent=\"Some things might not work\";let m=document.createElement(\"ul\");for(let f of c){let p=document.createElement(\"li\");p.textContent=String(f),m.append(p)}let u=document.createElement(\"div\"),n=document.createElement(\"a\");n.href=s,n.target=\"_top\",n.textContent=\"Review accounts\";let o=document.createElement(\"button\");o.type=\"button\",o.textContent=\"Dismiss\",o.addEventListener(\"click\",()=>i.remove()),u.append(n,o),e.append(l,m,u),x.append(d,e),document.documentElement.append(i)};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",a,{once:!0}):a()};g();})();";
@@ -1,8 +1,35 @@
1
- import type { AppCache, HostCache } from "../contracts/cache.js";
1
+ /** Bind the portable Effect cache to an app invocation's author API. */
2
+ import { type Context } from "effect";
3
+ import type { AppCache, CacheGetOptions, HostCache } from "../contracts/cache.js";
2
4
  import type { ResolvedAccounts } from "../contracts/host.js";
5
+ import type { JsonValue } from "../contracts/schema.js";
6
+ /**
7
+ * Framework-only: `get` that also reads other keys of the same scope in its round trip to the
8
+ * store. Authored code never sees it; framework helpers use it when a cache provides it.
9
+ */
10
+ export declare const getWithReads: unique symbol;
11
+ /**
12
+ * A `get` value, the store key it was read under, and the stored values of the other keys when
13
+ * the value was read from the store. The values are not decoded: the caller decodes only those it
14
+ * uses. A key with no value reads `undefined`.
15
+ */
16
+ export interface GetWithReads<A> {
17
+ readonly value: A;
18
+ /** The entry's store key, unique to the cache's scope and the key. */
19
+ readonly key: string;
20
+ /** Undefined when the value was loaded or the store did not read them: read them separately. */
21
+ readonly reads: readonly unknown[] | undefined;
22
+ }
23
+ /** The framework-only `get` an app's cache provides beside the author API. */
24
+ export type CacheWithReads = AppCache & {
25
+ /** `keys` gets the entry's store key and names the other keys to read with it. */
26
+ readonly [getWithReads]?: <A>(options: CacheGetOptions<A>, keys: (key: string) => readonly JsonValue[]) => Promise<GetWithReads<A>>;
27
+ };
3
28
  /** Missing host support is explicit on use; ordinary apps do not need cache support. */
4
29
  export declare const unavailableCache: HostCache;
5
30
  /** Account scopes are derived from trusted current bindings. Loaders get a fresh owned HTTP signal. */
6
31
  export declare const authorCache: (host: HostCache, accounts: ResolvedAccounts, signal: AbortSignal,
32
+ /** The invocation's telemetry, which Promise calls from authored code run in. */
33
+ telemetry: Context.Context<never>,
7
34
  /** The invocation's trusted deadline. Waiting on another caller's load never runs past it. */
8
35
  deadline?: number) => AppCache;
@@ -1,8 +1,8 @@
1
1
  import { Duration, Effect, Schema } from "effect";
2
- import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
2
+ import type { AccountCredential, AppCache, CacheLoadContext } from "../contracts/cache.js";
3
3
  import { JsonObject, type JsonValue } from "../contracts/schema.js";
4
4
  export interface CatalogCacheOptions {
5
- /** App/build scope, optionally narrowed to the current account. */
5
+ /** The app's cache. An account's catalog is kept in that account's scope. */
6
6
  readonly cache?: AppCache;
7
7
  /** Reuse metadata for this duration. Defaults to five minutes. */
8
8
  readonly freshFor?: Duration.Input;
@@ -11,14 +11,39 @@ export interface CatalogCacheOptions {
11
11
  /** Await a fresh revision at an explicit logical connection or refresh boundary. */
12
12
  readonly revalidate?: boolean;
13
13
  }
14
+ /** Whose catalog a remote router reads, and the headers, such as credentials, it sends. */
15
+ export type CatalogAccount = AccountCredential<{
16
+ /** Headers for this account's requests, such as its credentials. */
17
+ readonly headers?: Readonly<Record<string, string>>;
18
+ }>;
19
+ /** Why a read cannot use its account's scope. */
20
+ export type CatalogScopeProblem = "missing-account" | "unselected-account";
21
+ /**
22
+ * The cache an account's catalog lives in: the account's own scope, which token renewals keep.
23
+ * `credential` is what the read sends, such as headers or a token; it never enters a key. A
24
+ * credential without an account, or an account the app was not given, fails with `invalid`.
25
+ */
26
+ export declare const catalogScope: <E>(options: {
27
+ readonly cache?: AppCache | undefined;
28
+ readonly account?: {
29
+ readonly id: string;
30
+ } | undefined;
31
+ }, credential: unknown, invalid: (problem: CatalogScopeProblem) => E) => Effect.Effect<AppCache | undefined, E>;
14
32
  /** One load: the tools, and optionally a record describing the whole catalog. */
15
33
  export interface CatalogLoad<A> {
16
34
  readonly tools: readonly A[];
17
35
  readonly header?: JsonObject;
18
36
  }
37
+ /** The catalog a refresh replaces, read only when its loader asks for it. */
38
+ export interface KeptCatalog<A> {
39
+ readonly header: JsonObject | undefined;
40
+ readonly tools: Effect.Effect<readonly A[], unknown>;
41
+ }
19
42
  export declare const catalogCache: <A extends {
20
43
  readonly name: string;
21
- }, S>(options: CatalogCacheOptions & {
44
+ }, S>(options: Omit<CatalogCacheOptions, "cache"> & {
45
+ /** The scope from `catalogScope`; undefined keeps discovery invocation-local. */
46
+ readonly cache: AppCache | undefined;
22
47
  readonly prefix: readonly JsonValue[];
23
48
  readonly schema: Schema.Decoder<A>;
24
49
  /** Schema-free projection stored beside the full pages, so browsing never reads schemas. */
@@ -26,7 +51,13 @@ export declare const catalogCache: <A extends {
26
51
  readonly schema: Schema.Decoder<S>;
27
52
  readonly of: (tool: A) => S;
28
53
  };
29
- readonly load: (context?: CacheLoadContext) => Effect.Effect<CatalogLoad<A>, unknown>;
54
+ /** Past `freshFor`, serve the kept catalog while refreshing, or refresh first. */
55
+ readonly stale?: "serve" | "revalidate";
56
+ /**
57
+ * Load the catalog. A refresh also gets the catalog it replaces, if one is kept, so a source
58
+ * that can confirm it is unchanged need not load it again.
59
+ */
60
+ readonly load: (context?: CacheLoadContext, kept?: Effect.Effect<KeptCatalog<A> | undefined, unknown>) => Effect.Effect<CatalogLoad<A>, unknown>;
30
61
  }) => Effect.Effect<{
31
62
  list: () => Effect.Effect<readonly A[], unknown, never>;
32
63
  /** The record stored with the current revision, if the source supplied one. */
@@ -1,5 +1,5 @@
1
1
  /** Validate both sides of a tool's form and bind delivery to its invocation lifetime. */
2
- import { Effect, Schema } from "effect";
2
+ import { Effect, Schema, type Context } from "effect";
3
3
  import { ElicitationFailed, type ElicitationHandler, type Elicit } from "../contracts/elicitation.js";
4
4
  /** Parse a form and retain its response parser, so invalid answers can be rejected before consuming a host continuation. */
5
5
  export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
@@ -12,15 +12,15 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
12
12
  readonly [x: string]: {
13
13
  readonly type: "string";
14
14
  readonly enum: readonly string[];
15
- readonly default?: string;
16
15
  readonly description?: string;
16
+ readonly default?: string;
17
17
  readonly title?: string;
18
18
  readonly enumNames?: readonly string[];
19
19
  } | {
20
20
  readonly type: "string";
21
21
  readonly enum: readonly string[];
22
- readonly default?: string;
23
22
  readonly description?: string;
23
+ readonly default?: string;
24
24
  readonly title?: string;
25
25
  } | {
26
26
  readonly type: "string";
@@ -28,8 +28,8 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
28
28
  readonly const: string;
29
29
  readonly title: string;
30
30
  }[];
31
- readonly default?: string;
32
31
  readonly description?: string;
32
+ readonly default?: string;
33
33
  readonly title?: string;
34
34
  } | {
35
35
  readonly type: "array";
@@ -37,11 +37,11 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
37
37
  readonly type: "string";
38
38
  readonly enum: readonly string[];
39
39
  };
40
- readonly default?: readonly string[];
41
40
  readonly description?: string;
42
- readonly title?: string;
41
+ readonly default?: readonly string[];
43
42
  readonly minItems?: number;
44
43
  readonly maxItems?: number;
44
+ readonly title?: string;
45
45
  } | {
46
46
  readonly type: "array";
47
47
  readonly items: {
@@ -50,30 +50,30 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
50
50
  readonly title: string;
51
51
  }[];
52
52
  };
53
- readonly default?: readonly string[];
54
53
  readonly description?: string;
55
- readonly title?: string;
54
+ readonly default?: readonly string[];
56
55
  readonly minItems?: number;
57
56
  readonly maxItems?: number;
57
+ readonly title?: string;
58
58
  } | {
59
59
  readonly type: "string";
60
+ readonly description?: string;
60
61
  readonly default?: string;
61
62
  readonly format?: "email" | "uri" | "date" | "date-time";
62
- readonly description?: string;
63
- readonly title?: string;
64
63
  readonly minLength?: number;
65
64
  readonly maxLength?: number;
65
+ readonly title?: string;
66
66
  } | {
67
67
  readonly type: "number" | "integer";
68
+ readonly description?: string;
68
69
  readonly default?: number;
70
+ readonly minimum?: number;
69
71
  readonly maximum?: number;
70
- readonly description?: string;
71
72
  readonly title?: string;
72
- readonly minimum?: number;
73
73
  } | {
74
74
  readonly type: "boolean";
75
- readonly default?: boolean;
76
75
  readonly description?: string;
76
+ readonly default?: boolean;
77
77
  readonly title?: string;
78
78
  };
79
79
  };
@@ -99,5 +99,8 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
99
99
  } | undefined;
100
100
  }, ElicitationFailed, never>;
101
101
  }, ElicitationFailed, never>;
102
- /** Bind a validated interaction to the live invocation; transport adapters share its form parser. */
103
- export declare const makeElicit: (handler: ElicitationHandler | undefined, signal: AbortSignal) => Elicit;
102
+ /**
103
+ * Bind a validated interaction to the live invocation; transport adapters share its form parser.
104
+ * Authored code's Promise calls run in the invocation's telemetry, like framework callers.
105
+ */
106
+ export declare const makeElicit: (handler: ElicitationHandler | undefined, signal: AbortSignal, telemetry: Context.Context<never>) => Elicit;
@@ -0,0 +1,59 @@
1
+ /** Event declarations and the per-invocation emitter. Emitted events leave in the reply. */
2
+ import { Effect, Schema as EffectSchema } from "effect";
3
+ import { EmittedEvent, type AppEvent, type EmitOptions } from "../contracts/events.js";
4
+ import { type Fields, type Infer, type ObjectValue, type Schema } from "./schema.js";
5
+ declare const Native: unique symbol;
6
+ /** An event an app emits. Declare it in `defineApp`'s requirements under `events`. */
7
+ export interface EventDeclaration<F extends Fields, P extends Schema<unknown, boolean>> {
8
+ readonly [Native]: AppEvent;
9
+ readonly description: string;
10
+ readonly filters: F;
11
+ readonly payload: P;
12
+ }
13
+ /** Any declared event, for requirement constraints. */
14
+ export type AnyEventDeclaration = EventDeclaration<Fields, Schema<unknown, boolean>>;
15
+ /**
16
+ * Declare an event. `filters` are scalar fields subscribers can narrow on, such as a repository;
17
+ * every emitted occurrence supplies their values. `payload` describes each occurrence's data.
18
+ */
19
+ export declare const event: <const F extends Fields = {}, P extends Schema<unknown, boolean> = Schema<unknown>>(options: {
20
+ readonly description: string;
21
+ readonly filters?: F;
22
+ readonly payload: P;
23
+ }) => EventDeclaration<F, P>;
24
+ /** The native declaration retained by an author event. */
25
+ export declare const nativeEvent: (declaration: unknown) => AppEvent | undefined;
26
+ /** JSON Schema for each declared event, as the host reads it from requirements. */
27
+ export declare const declaredEvents: (events: Readonly<Record<string, AppEvent>>) => Effect.Effect<{
28
+ readonly [x: string]: {
29
+ readonly description: string;
30
+ readonly filters: {
31
+ readonly [x: string]: EffectSchema.Json;
32
+ };
33
+ readonly payload: {
34
+ readonly [x: string]: EffectSchema.Json;
35
+ };
36
+ };
37
+ }, EffectSchema.SchemaError, never>;
38
+ /** Emit options typed by the event's filters: required exactly when it declares some. */
39
+ type OptionsFor<F extends Fields> = keyof F extends never ? [options?: Omit<EmitOptions<never>, "filters">] : [options: EmitOptions<ObjectValue<F>> & {
40
+ readonly filters: ObjectValue<F>;
41
+ }];
42
+ /** `ctx.events` in mutations and webhook handlers. */
43
+ export interface EventEmitter<Events extends Readonly<Record<string, AnyEventDeclaration>>> {
44
+ /**
45
+ * Record an occurrence. It is delivered only if this invocation succeeds. Invalid data, filters
46
+ * or options throw here, before anything is recorded.
47
+ */
48
+ readonly emit: <Name extends keyof Events & string>(name: Name, data: Infer<Events[Name]["payload"]>, ...options: OptionsFor<Events[Name]["filters"]>) => void;
49
+ }
50
+ /** One invocation's buffer. The handler reads `emitted` only after the invocation succeeds. */
51
+ export declare const makeEmitter: (input: {
52
+ readonly events: Readonly<Record<string, AppEvent>>;
53
+ /** Every account ID bound to this invocation. */
54
+ readonly accounts: readonly string[];
55
+ /** The webhook's source account, which an emit names by default. */
56
+ readonly sourceAccount?: string;
57
+ readonly emitted: EmittedEvent[];
58
+ }) => EventEmitter<Readonly<Record<string, AnyEventDeclaration>>>;
59
+ export {};
@@ -1,11 +1,14 @@
1
- import { Redacted } from "effect";
2
- import type { ResolvedAccounts } from "../contracts/host.js";
1
+ import { Option, Redacted } from "effect";
2
+ import { McpError as HostMcpError, SkillLoadFailed as HostSkillLoadFailed, type ResolvedAccounts } from "../contracts/host.js";
3
+ import type { ProviderError } from "../contracts/provider-error.js";
4
+ import { type FailureFields, type FailurePhase, type UpstreamError } from "../contracts/failure.js";
3
5
  /** Fields of `FailureDetail` as constructor input. */
4
6
  export interface FailureDetail {
5
7
  readonly source?: "app" | "storage" | "service";
6
8
  readonly errorName?: string;
7
9
  readonly code?: string;
8
10
  readonly message?: string;
11
+ readonly fields?: FailureFields;
9
12
  }
10
13
  /**
11
14
  * Every credential field value of a slot-to-account record, longest first. Accepts both resolved
@@ -16,10 +19,29 @@ export declare const accountFieldSecrets: (accounts: unknown) => string[];
16
19
  export declare const accountSecrets: (accounts: Redacted.Redacted<ResolvedAccounts>) => string[];
17
20
  /** Replace account secrets and bound the message for the runtime boundary. */
18
21
  export declare const boundFailureMessage: (message: string, secrets: readonly string[]) => string;
22
+ /**
23
+ * Replace account secrets in the error a service stated, as it leaves the bundle. A message
24
+ * shortened where it was read can end partway through a secret; that part is replaced too.
25
+ */
26
+ export declare const redactUpstream: (upstream: UpstreamError | undefined, secrets: readonly string[]) => UpstreamError | undefined;
27
+ /**
28
+ * A provider failure as it leaves the bundle: in the phase it happened, unless its raiser named a
29
+ * more precise one, with account secrets replaced in the error the service stated.
30
+ */
31
+ export declare const leavingProviderError: (error: ProviderError, secrets: readonly string[], phase?: FailurePhase) => ProviderError;
32
+ /**
33
+ * Rebuild an MCP failure's allowlisted fields, with account secrets replaced in the server's
34
+ * error. Absent fields have no key, as catalogs cross the boundary as JSON values.
35
+ */
36
+ export declare const parseMcpError: (error: unknown, secrets: readonly string[]) => Option.Option<HostMcpError>;
37
+ /** Rebuild only the allowlisted skill loader fields from an author-visible rejection. */
38
+ export declare const parseSkillLoadFailed: (error: unknown) => Option.Option<HostSkillLoadFailed>;
19
39
  /** `Name: message` for any thrown value, before redaction. */
20
40
  export declare const describeFailure: (error: unknown) => string;
21
41
  /**
22
42
  * Describe what an operation raised for the app's own caller. App data failures keep their
23
- * reason as a code; any other thrown value is the app's own error. Account secrets are replaced.
43
+ * reason as a code, as do app cache failures and OpenAPI and MCP service failures, such as an
44
+ * `mcpHealth` check that cannot reach its server or cannot verify the credentials; any other thrown
45
+ * value is the app's own error, with its own code and scalar fields. Account secrets are replaced.
24
46
  */
25
47
  export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
@@ -1,7 +1,7 @@
1
1
  import { Effect } from "effect";
2
2
  import { GraphqlToolsOptions } from "../contracts/graphql.js";
3
- import { type CatalogCacheOptions } from "./catalog-cache.js";
3
+ import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
4
4
  import { type OperationKinds } from "./protocol-operations.js";
5
- export interface GraphqlCatalogOptions extends GraphqlToolsOptions, CatalogCacheOptions {
6
- }
5
+ /** An endpoint, the account whose schema it is, and the metadata policy. */
6
+ export type GraphqlCatalogOptions = Omit<GraphqlToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
7
7
  export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
@@ -1,4 +1,5 @@
1
1
  import { ProviderError } from "../contracts/provider-error.js";
2
+ import { NetworkRefused } from "../contracts/network.js";
2
3
  /** Discover GraphQL tools live; transport, decoding and cancellation stay in Effect. */
3
4
  import { Effect, Schema } from "effect";
4
5
  import { OperationTypeNode } from "graphql";
@@ -8,7 +9,7 @@ import { JsonObject } from "../effect.js";
8
9
  export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect.Effect<{
9
10
  request: (phase: "discover" | "call", query: string, variables?: JsonObject) => Effect.Effect<{
10
11
  readonly [x: string]: Schema.Json;
11
- }, ProviderError | GraphqlError, never>;
12
+ }, ProviderError | NetworkRefused | GraphqlError, never>;
12
13
  discover: Effect.Effect<{
13
14
  readonly __schema: {
14
15
  readonly queryType: {
@@ -42,7 +43,7 @@ export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect
42
43
  }[] | null;
43
44
  }[];
44
45
  };
45
- }, ProviderError | GraphqlError, never>;
46
+ }, ProviderError | NetworkRefused | GraphqlError, never>;
46
47
  }, GraphqlError, never>;
47
48
  /** Build serializable definitions once per introspection revision, without compiling validators. */
48
49
  export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effect.Effect<{
@@ -80,4 +81,4 @@ export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effe
80
81
  /** Bind only the selected definition to current credentials and compile its input decoder. */
81
82
  export declare const adaptGraphqlTool: (client: Effect.Success<ReturnType<typeof graphqlClientEffect>>, definition: GraphqlToolDefinition) => Effect.Effect<import("../contracts/graphql.js").GraphqlTool, GraphqlError, never>;
82
83
  /** Low-level callers can still request a complete invocation-owned tool map. */
83
- export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError>;
84
+ export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError | NetworkRefused>;
@@ -1,3 +1,7 @@
1
1
  import { HostInputInvalid } from "../contracts/host.js";
2
- /** Failing input paths and expected shapes from a schema decode failure, without supplied values. */
3
- export declare const inputInvalid: (error: unknown) => HostInputInvalid;
2
+ /**
3
+ * Failing input paths and what each expects, from a schema decode failure, without supplied
4
+ * values. An expected object names its keys, so a caller can correct nesting from the problem.
5
+ * A missing key also asks about a place where `input`, the rejected input, may have that key.
6
+ */
7
+ export declare const inputInvalid: (error: unknown, input: unknown) => HostInputInvalid;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Divide a tool invocation's time, on its own isolate's clock, by who the work belonged to:
3
+ * Executor, the app's authored code, upstream providers, a person answering an elicitation, or
4
+ * another call loading a cache entry this one waits for. Background work no caller waits on runs
5
+ * beside the division and is reported apart.
6
+ * Each boundary declares its owner where the work starts (see `owned`); the invocation's own span is
7
+ * Executor's. The host adds the other isolates' parts.
8
+ */
9
+ import { Effect } from "effect";
10
+ /** The span `makeElicit` opens while a person answers. */
11
+ export declare const elicitationWaitSpan = "app.elicitation.wait";
12
+ /** The span around each workflow control an app calls, which Executor answers. */
13
+ export declare const workflowControlSpan = "app.workflow.control";
14
+ /**
15
+ * Run a tool operation in its `app.<operation>` span and time it from the span's own start to its
16
+ * own end. The span records each part, and the isolated handler returns them to the host.
17
+ */
18
+ export declare const timedInvocation: (operation: "call" | "query" | "mutate") => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, import("effect/Tracer").ParentSpan>>;
@@ -1,4 +1,4 @@
1
- import { Atom } from "effect/unstable/reactivity";
1
+ import { Atom } from "effect/reactivity";
2
2
  import { AppQueryFailed, type OperationReference, type QueryTransport } from "../contracts/live.js";
3
3
  import type { Operation } from "./operations.js";
4
4
  import { type Schema } from "./schema.js";
@@ -14,5 +14,5 @@ export declare const mutationReference: <Mutation>(name: Mutation extends Operat
14
14
  export declare const liveQueryAtom: <Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>, options: {
15
15
  readonly output: Schema<NoInfer<Output>, boolean>;
16
16
  readonly transport: QueryTransport;
17
- }) => Atom.Atom<import("effect/unstable/reactivity/AsyncResult").AsyncResult<NoInfer<Output>, import("effect/Cause").NoSuchElementError | AppQueryFailed>>;
17
+ }) => Atom.Atom<import("effect/reactivity/AsyncResult").AsyncResult<NoInfer<Output>, import("effect/Cause").NoSuchElementError | AppQueryFailed>>;
18
18
  export {};
@@ -1,4 +1,5 @@
1
1
  import type { ProviderError } from "../contracts/provider-error.js";
2
+ import type { NetworkRefused } from "../contracts/network.js";
2
3
  /** One upstream call, with form requests forwarded to the invocation's existing elicitation capability. */
3
4
  import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
5
  import { Effect, Schema } from "effect";
@@ -6,15 +7,15 @@ import { ElicitationFailed } from "../contracts/elicitation.js";
6
7
  import { McpError, type McpToolContext } from "../contracts/mcp.js";
7
8
  import type { JsonObject } from "../contracts/schema.js";
8
9
  /** Register prompts only around tools/call, preserve metadata, and close every callback with the call. Never retries. */
9
- export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError) => Effect.Effect<{
10
+ export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError | NetworkRefused) => Effect.Effect<{
10
11
  readonly content: readonly {
11
12
  readonly [x: string]: Schema.Json;
12
13
  }[];
13
14
  readonly _meta?: {
14
15
  readonly [x: string]: Schema.Json;
15
- } | undefined;
16
+ };
16
17
  readonly structuredContent?: {
17
18
  readonly [x: string]: Schema.Json;
18
- } | undefined;
19
- readonly isError?: boolean | undefined;
20
- }, ProviderError | ElicitationFailed | McpError, never>;
19
+ };
20
+ readonly isError?: boolean;
21
+ }, ProviderError | NetworkRefused | ElicitationFailed | McpError, never>;
@@ -1,9 +1,11 @@
1
1
  import { Effect } from "effect";
2
2
  import { McpToolsOptions } from "../contracts/mcp.js";
3
- import { type CatalogCacheOptions } from "./catalog-cache.js";
3
+ import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
4
4
  import { type OperationKinds } from "./protocol-operations.js";
5
- /** Metadata policy for HTTP/SSE sources. A missing cache keeps discovery invocation-local. */
6
- export interface McpCatalogOptions extends McpToolsOptions, CatalogCacheOptions {
7
- }
5
+ /**
6
+ * A server, the account whose catalog it is, and the metadata policy for HTTP/SSE sources. A
7
+ * missing cache keeps discovery invocation-local.
8
+ */
9
+ export type McpCatalogOptions = Omit<McpToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
8
10
  /** Construction opens no transport unless explicit revalidation is requested. */
9
11
  export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;