apps 0.0.1-beta.4 → 0.0.1-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-QKHR7BMF.js → chunk-3MMG2H6M.js} +89 -53
  4. package/js/chunk-4TLZGG4B.js +729 -0
  5. package/js/chunk-6KABJTDO.js +255 -0
  6. package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
  7. package/js/{chunk-EQB7JMAL.js → chunk-DHX2OI2X.js} +146 -31
  8. package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
  9. package/js/chunk-EM4UL26F.js +118 -0
  10. package/js/{chunk-WFSQXYUT.js → chunk-GHXRRFZA.js} +418 -52
  11. package/js/{chunk-5MQZEB6Y.js → chunk-KANDIVIH.js} +40 -12
  12. package/js/chunk-KAQD3DTI.js +16 -0
  13. package/js/chunk-KIM5HXNK.js +49 -0
  14. package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
  15. package/js/{chunk-2VPJHFOU.js → chunk-MYF7KWUB.js} +128 -24
  16. package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
  17. package/js/chunk-OD3KFKZD.js +1617 -0
  18. package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
  19. package/js/chunk-P7MGDPFD.js +240 -0
  20. package/js/chunk-PDS2E2OZ.js +42 -0
  21. package/js/{chunk-ZCAMUXSG.js → chunk-PNVCCB4L.js} +432 -79
  22. package/js/{chunk-D47C7KG5.js → chunk-RIXVGVA6.js} +2 -2
  23. package/js/{chunk-6VRYO2BG.js → chunk-SALJXSS3.js} +779 -251
  24. package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
  25. package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
  26. package/js/{chunk-G7ZIRKMK.js → chunk-VIU2XXA7.js} +228 -264
  27. package/js/{chunk-HDJH3RPR.js → chunk-VJQXXOQ3.js} +4 -4
  28. package/js/chunk-XDGUGB2A.js +156 -0
  29. package/js/{chunk-SATWJKN6.js → chunk-YQ35E7KS.js} +2 -2
  30. package/js/chunk-ZUKBIHMK.js +92 -0
  31. package/js/client.js +122 -88
  32. package/js/contracts.js +116 -25
  33. package/js/effect.js +19 -20
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +57 -55
  36. package/js/host.js +19 -20
  37. package/js/index.js +245 -212
  38. package/js/mcp/effect.js +23 -22
  39. package/js/mcp/stdio.js +34 -30
  40. package/js/mcp.js +104 -68
  41. package/js/openapi.js +4087 -1503
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +147 -65
  45. package/js/storage/facet.js +1 -540
  46. package/js/ui/auth/contracts.js +2 -2
  47. package/js/ui/auth.js +5 -5
  48. package/js/ui/contracts.js +5 -4
  49. package/js/ui/serving.js +8517 -214
  50. package/package.json +2 -3
  51. package/runtime.json +1 -1
  52. package/types/app-data/src/contracts/database.d.ts +33 -6
  53. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  54. package/types/apps/src/contracts/app.d.ts +7 -8
  55. package/types/apps/src/contracts/cache.d.ts +14 -0
  56. package/types/apps/src/contracts/context.d.ts +12 -11
  57. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  58. package/types/apps/src/contracts/failure.d.ts +54 -0
  59. package/types/apps/src/contracts/graphql.d.ts +2 -1
  60. package/types/apps/src/contracts/host.d.ts +44 -17
  61. package/types/apps/src/contracts/live.d.ts +2 -0
  62. package/types/apps/src/contracts/mcp.d.ts +96 -10
  63. package/types/apps/src/contracts/network.d.ts +84 -0
  64. package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
  65. package/types/apps/src/contracts/openapi.d.ts +45 -9
  66. package/types/apps/src/contracts/operations.d.ts +8 -9
  67. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  68. package/types/apps/src/contracts/protocols/1.d.ts +263 -74
  69. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  70. package/types/apps/src/contracts/protocols/2.d.ts +66 -24
  71. package/types/apps/src/contracts/protocols/3.d.ts +715 -0
  72. package/types/apps/src/contracts/protocols/4.d.ts +1297 -0
  73. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  74. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  75. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  76. package/types/apps/src/contracts/protocols/8.d.ts +1130 -0
  77. package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
  78. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  79. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  80. package/types/apps/src/contracts/provider.d.ts +115 -10
  81. package/types/apps/src/contracts/router.d.ts +59 -0
  82. package/types/apps/src/contracts/skills.d.ts +39 -9
  83. package/types/apps/src/contracts/sql.d.ts +58 -0
  84. package/types/apps/src/contracts/ui.d.ts +19 -1
  85. package/types/apps/src/contracts/workflows.d.ts +40 -3
  86. package/types/apps/src/facet.d.ts +4 -5
  87. package/types/apps/src/graphql.d.ts +1 -3
  88. package/types/apps/src/implementation/account-router.d.ts +12 -0
  89. package/types/apps/src/implementation/app.d.ts +5 -4
  90. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  91. package/types/apps/src/implementation/catalog-cache.d.ts +32 -5
  92. package/types/apps/src/implementation/elicitation.d.ts +9 -9
  93. package/types/apps/src/implementation/failure-detail.d.ts +47 -0
  94. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  95. package/types/apps/src/implementation/graphql.d.ts +4 -3
  96. package/types/apps/src/implementation/input-problems.d.ts +4 -1
  97. package/types/apps/src/implementation/live.d.ts +2 -2
  98. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  99. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  100. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  101. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  102. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  103. package/types/apps/src/implementation/mcp.d.ts +52 -25
  104. package/types/apps/src/implementation/network.d.ts +16 -0
  105. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  106. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  107. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  108. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  109. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  110. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  111. package/types/apps/src/implementation/operations.d.ts +36 -3
  112. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  113. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  114. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  115. package/types/apps/src/implementation/provider.d.ts +19 -5
  116. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  117. package/types/apps/src/implementation/router-catalog.d.ts +223 -0
  118. package/types/apps/src/implementation/router.d.ts +68 -0
  119. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  120. package/types/apps/src/implementation/schema.d.ts +86 -11
  121. package/types/apps/src/implementation/skills.d.ts +18 -24
  122. package/types/apps/src/implementation/sql.d.ts +66 -0
  123. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  124. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  125. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  126. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  127. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  128. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  129. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  130. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  131. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  132. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  133. package/types/apps/src/index.d.ts +30 -13
  134. package/types/apps/src/mcp-stdio.d.ts +2 -5
  135. package/types/apps/src/mcp.d.ts +25 -5
  136. package/types/apps/src/openapi.d.ts +6 -6
  137. package/types/apps/src/react.d.ts +1 -1
  138. package/types/apps/src/skills.d.ts +10 -8
  139. package/types/telemetry/src/app-records.d.ts +42 -0
  140. package/types/telemetry/src/browser-operations.d.ts +6 -3
  141. package/types/telemetry/src/browser.d.ts +2 -2
  142. package/types/telemetry/src/config.d.ts +2 -2
  143. package/types/telemetry/src/layer.d.ts +2 -2
  144. package/types/telemetry/src/recorded-failure.d.ts +20 -0
  145. package/types/telemetry/src/relay.d.ts +2 -2
  146. package/types/telemetry/src/transport.d.ts +8 -1
  147. package/types/utils/src/api-error.d.ts +53 -0
  148. package/types/utils/src/recorded-message.d.ts +15 -0
  149. package/js/chunk-BMOIAIVR.js +0 -138
  150. package/js/chunk-DHUDODG5.js +0 -213
  151. package/js/chunk-FZJOYIZO.js +0 -19
  152. package/js/chunk-LGIYBDWA.js +0 -85
  153. package/js/chunk-M6ZRRIBI.js +0 -877
  154. package/js/chunk-PLCMJREA.js +0 -590
  155. package/js/chunk-PYUYJRSK.js +0 -93
  156. package/js/chunk-SWPD52J7.js +0 -35
  157. package/js/chunk-W7D7WVSY.js +0 -18
  158. package/js/chunk-Z5NMEGJN.js +0 -29
  159. package/js/chunk-ZJWDMTE3.js +0 -63
  160. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  161. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  162. package/types/app-data/src/implementation/promise.d.ts +0 -68
  163. package/types/app-data/src/implementation/range.d.ts +0 -8
  164. package/types/app-data/src/implementation/schema.d.ts +0 -33
  165. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  166. package/types/app-data/src/index.d.ts +0 -4
  167. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  168. package/types/apps/src/contracts/storage.d.ts +0 -68
  169. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  170. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  171. package/types/apps/src/implementation/storage.d.ts +0 -13
@@ -1,16 +1,22 @@
1
1
  import { Effect } from "effect";
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. */
2
+ import { HttpServerRequest, HttpServerResponse } from "effect/http";
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;
@@ -55,9 +73,8 @@ export type JsonResponse = PromiseMethods<NativeResponse>;
55
73
  export declare const decodeJson: <T>(response: JsonResponse, schema: Schema<T, boolean>) => Promise<T>;
56
74
  export { NotImplemented } from "./contracts/app.js";
57
75
  export { ElicitationFailed, type FormElicitation, type ElicitationResponse, type Elicit, } from "./contracts/elicitation.js";
58
- export { table, defineDatabase, type Table, type DatabaseReader, type Database, type DatabaseDefinition, } from "./implementation/storage.js";
59
- export { id, userId } from "./implementation/schema.js";
60
- export { query, mutation, withApproval, type Operation, type OperationOptions, } from "./implementation/operations.js";
76
+ export type { Sql, SqlCursor, SqlReader, SqlRow, SqlTransaction, SqlValue, } from "./contracts/sql.js";
77
+ export { query, mutation, withApproval, toolAnnotations, type Operation, type OperationOptions, } from "./implementation/operations.js";
61
78
  export type { OperationContext } from "./contracts/operations.js";
62
79
  export { workflow, type Workflow, type WorkflowDeclaration } from "./implementation/workflows.js";
63
80
  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";
@@ -1,4 +1,4 @@
1
- import { AsyncResult, type Atom } from "effect/unstable/reactivity";
1
+ import { AsyncResult, type Atom } from "effect/reactivity";
2
2
  /** Subscribe for the component lifetime. Each mount owns and disposes its registry, including StrictMode remounts. */
3
3
  export declare const useAppQuery: <A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>) => {
4
4
  data: A | undefined;
@@ -1,12 +1,13 @@
1
1
  import { type FolderSkillsOptions, type GitHubSkillsOptions, type SkillReaderOptions, type WellKnownSkillsOptions, type SkillFile } from "./contracts/skills.js";
2
- export { SkillLoadFailed, SkillDefinitionInvalid, SkillServiceName, type SkillReaderOptions, type FolderSkillsOptions, type AppSkillSource as Skill, type SkillFile, type GitHubSkillsOptions, type SkillCacheOptions, type WellKnownSkillsOptions, } from "./contracts/skills.js";
2
+ export { SkillLoadFailed, SkillDefinitionInvalid, SkillServiceName, type SkillReaderOptions, type FolderSkillsOptions, type AppSkillSource as Skill, type SkillFile, type GitHubSkillsAccount, type GitHubSkillsOptions, type SkillCacheOptions, type WellKnownSkillsOptions, } from "./contracts/skills.js";
3
3
  /**
4
- * Fetch a public GitHub skill collection from one resolved commit. Pass `cache: ctx.cache` to reuse
5
- * the catalog; without it, mutable refs resolve again on each call.
4
+ * Fetch a GitHub skill collection from one resolved commit. A private repository takes `account`
5
+ * and its `token`. Pass `cache: ctx.cache` to reuse the catalog; without it, mutable refs resolve
6
+ * again on each call.
6
7
  */
7
8
  export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<readonly {
8
- readonly name: string;
9
9
  readonly description: string;
10
+ readonly name: string;
10
11
  readonly files: readonly {
11
12
  readonly path: string;
12
13
  readonly content: string;
@@ -20,8 +21,8 @@ export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<rea
20
21
  }[]>;
21
22
  /** Fetch a published skill index and its text files. Pass `cache: ctx.cache` to reuse the catalog. */
22
23
  export declare const wellKnownSkills: (options: WellKnownSkillsOptions) => Promise<readonly {
23
- readonly name: string;
24
24
  readonly description: string;
25
+ readonly name: string;
25
26
  readonly files: readonly {
26
27
  readonly path: string;
27
28
  readonly content: string;
@@ -35,8 +36,8 @@ export declare const wellKnownSkills: (options: WellKnownSkillsOptions) => Promi
35
36
  }[]>;
36
37
  /** Parse a bundled standard skill directory into an app capability. */
37
38
  export declare const fileSkill: (files: readonly SkillFile[]) => Promise<{
38
- readonly name: string;
39
39
  readonly description: string;
40
+ readonly name: string;
40
41
  readonly files: readonly {
41
42
  readonly path: string;
42
43
  readonly content: string;
@@ -50,8 +51,8 @@ export declare const fileSkill: (files: readonly SkillFile[]) => Promise<{
50
51
  }>;
51
52
  /** Read skill directories from ctx.files. Omitted path selects skills/; missing folders return []. */
52
53
  export declare const folderSkills: (options: FolderSkillsOptions) => Promise<readonly {
53
- readonly name: string;
54
54
  readonly description: string;
55
+ readonly name: string;
55
56
  readonly files: readonly {
56
57
  readonly path: string;
57
58
  readonly content: string;
@@ -65,7 +66,8 @@ export declare const folderSkills: (options: FolderSkillsOptions) => Promise<rea
65
66
  }[]>;
66
67
  /**
67
68
  * Read files for a custom remote skill loader, such as one for GitLab. Reads share one byte
68
- * budget and reject with the same safe SkillLoadFailed errors as githubSkills, naming `service`.
69
+ * budget and reject with the same safe SkillLoadFailed errors as githubSkills, naming `service`,
70
+ * or with `NetworkRefused` when Executor's network refuses a request.
69
71
  */
70
72
  export declare const skillReader: (options: SkillReaderOptions) => {
71
73
  /** Fetch one UTF-8 text file. */
@@ -0,0 +1,42 @@
1
+ /**
2
+ * What the host keeps of the spans and logs an app isolate returns.
3
+ *
4
+ * Those records come from whatever framework the app's build bundles, and the app's own code runs
5
+ * in the same isolate: it can throw any text, name its errors and codes, and rewrite every record
6
+ * before the isolate returns it. So the host does not filter the records it receives. It builds
7
+ * new ones from a closed vocabulary: the framework's span names, attributes whose values are
8
+ * closed sets, counts and status codes, and each exception's kind. Ids, parents and timings are
9
+ * kept. Everything else, including events other than exceptions, links, status and exception
10
+ * messages, stacks and log bodies, is dropped or replaced with a fixed sentence.
11
+ *
12
+ * The vocabulary is the framework's (`packages/apps`, `app-cache`, `app-data`): host request
13
+ * operations, failure sources and reasons, MCP and cache attributes. A name or value outside it is
14
+ * recorded as `unrecognized` or not at all. `bun run check` (`scripts/check-app-telemetry.ts`)
15
+ * fails when the framework names a span or sets an attribute key this vocabulary does not know.
16
+ */
17
+ import type { Schema } from "effect";
18
+ type Json = Schema.Json;
19
+ type JsonObject = {
20
+ readonly [key: string]: Json;
21
+ };
22
+ /** What an exception message, stack or log body from an app isolate records instead. */
23
+ export declare const appText = "Text from the app is not recorded";
24
+ /** The framework's span names, and the libraries' spans it runs. */
25
+ export declare const appSpanNames: ReadonlySet<string>;
26
+ export declare const appSpanAttributeKeys: ReadonlySet<string>;
27
+ /**
28
+ * Attributes the framework sets whose values the app chooses, such as its tool names, so the host
29
+ * drops them. `scripts/check-app-telemetry.ts` fails on a framework attribute in neither set.
30
+ */
31
+ export declare const droppedAppAttributeKeys: ReadonlySet<string>;
32
+ /** The span the host records for one an app isolate returned, or nothing without its timings. */
33
+ export declare const appSpan: (span: JsonObject & {
34
+ readonly traceId: string;
35
+ readonly spanId: string;
36
+ }) => JsonObject | undefined;
37
+ /** The log record the host records for one an app isolate returned. */
38
+ export declare const appLog: (log: JsonObject & {
39
+ readonly traceId?: string | undefined;
40
+ readonly spanId?: string | undefined;
41
+ }) => JsonObject;
42
+ export {};
@@ -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
- 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;
3
+ import { HttpClient, HttpClientError } from "effect/http";
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"]>;
@@ -1,7 +1,7 @@
1
1
  /** Browser-owned Effect telemetry, shared by Promise calls and Atom runtimes. */
2
2
  import { Context, Effect, Layer, ManagedRuntime } from "effect";
3
- import { OtlpExporter } from "effect/unstable/observability";
4
- import { Atom } from "effect/unstable/reactivity";
3
+ import { OtlpExporter } from "effect/observability";
4
+ import { Atom } from "effect/reactivity";
5
5
  import type { TelemetryConfig } from "./config.js";
6
6
  declare const BrowserTelemetry_base: Context.ServiceClass<BrowserTelemetry, "executor/BrowserTelemetry", {
7
7
  readonly navigation: (event: {
@@ -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?: {
@@ -2,6 +2,6 @@
2
2
  import { Layer, Logger } from "effect";
3
3
  import { type TelemetryConfig } from "./config.js";
4
4
  /** Build one tracer per runtime. Event mode defers export until Worker scope finalization. */
5
- export declare const telemetryLayer: (config: TelemetryConfig, lifetime?: "process" | "event", logger?: Logger.Logger<unknown, void>) => Layer.Layer<import("effect/unstable/observability/OtlpExporter").Flusher, never, never>;
5
+ export declare const telemetryLayer: (config: TelemetryConfig, lifetime?: "process" | "event", logger?: Logger.Logger<unknown, void>) => Layer.Layer<import("effect/observability/OtlpExporter").Flusher, never, never>;
6
6
  /** Node/local entry points resolve telemetry once and share it for their process lifetime. */
7
- export declare const telemetryFromConfig: (service: string) => Layer.Layer<import("effect/unstable/observability/OtlpExporter").Flusher, import("effect/Schema").SchemaError | import("effect/Config").ConfigError, never>;
7
+ export declare const telemetryFromConfig: (service: string) => Layer.Layer<import("effect/observability/OtlpExporter").Flusher, import("effect/Schema").SchemaError | import("effect/Config").ConfigError, never>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Failures as Executor's telemetry records them. An error whose message can carry an app's own
3
+ * text declares a fixed sentence instead (see `RecordedMessage`); traces and error reports record
4
+ * that sentence with the error's name. The error itself, and what its caller receives, are
5
+ * unchanged.
6
+ */
7
+ import { Cause } from "effect";
8
+ /**
9
+ * The error a trace or error report records in place of `error`. Its stack is generated here and
10
+ * names no frames: the error's own stack begins with its message, which can span lines that look
11
+ * like frames, so none of its text is kept. Traces still show where it failed through the
12
+ * operation's own spans, which Effect appends to a recorded stack.
13
+ */
14
+ export declare const recordedError: (error: unknown) => unknown;
15
+ /**
16
+ * A failure's cause as traces record it. A defect is recorded the same way when it is an error that
17
+ * declares a recorded message, such as a workflow failure a host turned into a defect; other
18
+ * defects and interruptions are unchanged. Each reason keeps its annotations, which locate it.
19
+ */
20
+ export declare const recordedCause: <E>(cause: Cause.Cause<E>) => Cause.Cause<unknown>;
@@ -23,6 +23,6 @@ export declare const collectTelemetry: <A, E, R>(effect: Effect.Effect<A, E, R>)
23
23
  logs: string[];
24
24
  dropped: number;
25
25
  };
26
- }, E, Exclude<Exclude<R, import("effect/unstable/observability/OtlpExporter").Flusher>, never>>;
26
+ }, E, Exclude<Exclude<R, import("effect/observability/OtlpExporter").Flusher>, never>>;
27
27
  /** Validate isolated records and export only this call's trace, using parent-owned credentials/identity. */
28
- export declare const forwardTelemetry: (batch: TelemetryBatch, traceId: string | undefined, build: string | undefined, service?: "executor-app" | "executor-web") => Effect.Effect<void, Schema.SchemaError | import("effect/unstable/http/HttpClientError").HttpClientError | import("effect/Cause").TimeoutError, never>;
28
+ export declare const forwardTelemetry: (batch: TelemetryBatch, traceId: string | undefined, build: string | undefined, service?: "executor-app" | "executor-web") => Effect.Effect<void, Schema.SchemaError | import("effect/http/HttpClientError").HttpClientError | import("effect/Cause").TimeoutError, never>;
@@ -1,6 +1,13 @@
1
1
  import { Context, Layer } from "effect";
2
- import { HttpClient } from "effect/unstable/http";
2
+ import { HttpClient, HttpClientError } from "effect/http";
3
3
  /** Local collector discovery can resolve its destination when an export runs. */
4
4
  export declare const CurrentTelemetryClient: Context.Reference<HttpClient.HttpClient | undefined>;
5
5
  /** Telemetry consumers inspect status and headers; release response I/O inside each export scope. */
6
6
  export declare const telemetryHttpClient: Layer.Layer<HttpClient.HttpClient, never, never>;
7
+ /**
8
+ * Resend an export the collector refused for now, as OTLP requires and Effect's own
9
+ * exporters do: lost connections, 429 and 5xx overload, at most three more times. A
10
+ * collector shedding load answers 429 or 503 with Retry-After, which sets the wait. A
11
+ * wait longer than the caller's budget ends with the budget, without sending again.
12
+ */
13
+ export declare const retryTelemetryExport: (client: HttpClient.HttpClient) => HttpClient.HttpClient.With<HttpClientError.HttpClientError, never>;
@@ -0,0 +1,53 @@
1
+ import { Schema, type Cause } from "effect";
2
+ import "effect/http-api";
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
+ * What traces and error reports record instead of `message`, when the message quotes an app's
28
+ * own error or a service's stated error for its caller. Only fixed text and typed fields.
29
+ */
30
+ readonly recorded?: (fields: Schema.Struct.Type<Fields>) => string;
31
+ };
32
+ type ErrorFields<Tag extends string, Fields extends Schema.Struct.Fields> = Omit<Schema.TaggedStruct<Tag, Fields & {
33
+ readonly message: typeof MessageField;
34
+ }>, "~type.make.in"> & {
35
+ readonly "~type.make.in": Schema.TaggedStruct<Tag, Fields>["~type.make.in"];
36
+ };
37
+ type ErrorClass<Tag extends string, Fields extends Schema.Struct.Fields> = Schema.Class<Schema.Struct.Type<Fields> & ApiError & {
38
+ readonly _tag: Tag;
39
+ }, ErrorFields<Tag, Fields>, ApiError>;
40
+ /** Define an error with no payload and a fixed message. Its tag is its public error code. */
41
+ declare function define<const Tag extends string>(definition: Header<Tag> & {
42
+ readonly message: string;
43
+ }): ErrorClass<Tag, {}>;
44
+ /** Define an error whose message can depend on its parsed fields. */
45
+ declare function define<const Tag extends string, const Fields extends Schema.Struct.Fields>(definition: Definition<Tag, Fields>): ErrorClass<Tag, Fields>;
46
+ /**
47
+ * Define the schema, constructor and API message of an expected error together. Errors that need
48
+ * a user-facing title and recovery use `UserFacingError`, which carries the same message field.
49
+ */
50
+ export declare const ApiError: {
51
+ define: typeof define;
52
+ };
53
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * What traces and error reports record for an error in place of its message. An error declares
3
+ * one when its message can carry text from outside Executor: an app's own error or output, or an
4
+ * error a service stated through an app. That text still reaches the caller the error is for;
5
+ * Executor's telemetry records only this fixed sentence, beside the error's name.
6
+ */
7
+ export declare const RecordedMessage: unique symbol;
8
+ /** The fixed sentence an error declares for telemetry, if it declares one. */
9
+ export declare const recordedMessage: (error: unknown) => string | undefined;
10
+ /**
11
+ * Declare a recorded message on one error that Executor did not define the text of, such as an
12
+ * error decoded from an app's reply. An error class's own declaration is kept. The error's fields
13
+ * and wire encoding are unchanged.
14
+ */
15
+ export declare const recordAs: <E>(error: E, message: string) => E;