apps 0.0.1-beta.3 → 0.0.1-beta.30

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 (139) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-G7ZIRKMK.js → chunk-2D2PKLGQ.js} +118 -197
  4. package/js/chunk-3SPRHIEE.js +42 -0
  5. package/js/{chunk-FDNTX5QJ.js → chunk-4N26L465.js} +2 -2
  6. package/js/chunk-5ZHHO4OM.js +92 -0
  7. package/js/{chunk-EVJUVWN2.js → chunk-65SZ23BK.js} +2 -2
  8. package/js/{chunk-M6ZRRIBI.js → chunk-6JBTHTI5.js} +1 -1
  9. package/js/{chunk-J7O55ZV7.js → chunk-6NK26ONC.js} +332 -187
  10. package/js/chunk-6VWYEQ4X.js +254 -0
  11. package/js/{chunk-RN2MXB4R.js → chunk-AE4FWJQU.js} +128 -24
  12. package/js/{chunk-HDJH3RPR.js → chunk-BBTELEAN.js} +2 -2
  13. package/js/{chunk-LGIYBDWA.js → chunk-BRGF7VFN.js} +65 -1
  14. package/js/{chunk-MYYEW3RA.js → chunk-BSRU52RU.js} +984 -61
  15. package/js/{chunk-FZJOYIZO.js → chunk-BTJMXW4I.js} +1 -1
  16. package/js/{chunk-HDTGZWP2.js → chunk-IMCEF6KE.js} +139 -32
  17. package/js/chunk-KQCMHI3K.js +118 -0
  18. package/js/{chunk-BMOIAIVR.js → chunk-M2KEEOIQ.js} +49 -1
  19. package/js/{chunk-YEJOQEII.js → chunk-MYCVMDWI.js} +45 -7
  20. package/js/{chunk-FW5HBOIK.js → chunk-NXTXZ635.js} +1841 -1701
  21. package/js/chunk-OD3KFKZD.js +1617 -0
  22. package/js/{chunk-JN55AYQH.js → chunk-OI5CKSBU.js} +61 -32
  23. package/js/{chunk-NQ3OMCA5.js → chunk-P46HIAX6.js} +2 -2
  24. package/js/chunk-PUC24GZP.js +801 -0
  25. package/js/{chunk-SATWJKN6.js → chunk-PWF2DRJ3.js} +1 -1
  26. package/js/{chunk-D47C7KG5.js → chunk-VUVBMNKC.js} +2 -2
  27. package/js/{chunk-ZCAMUXSG.js → chunk-WGBI5MVX.js} +3 -4
  28. package/js/{chunk-T2LAZCAD.js → chunk-WQ5MVBTP.js} +1 -1
  29. package/js/{chunk-PLCMJREA.js → chunk-XBQTJP76.js} +60 -20
  30. package/js/{chunk-QKHR7BMF.js → chunk-XGN5IFOZ.js} +3 -3
  31. package/js/{chunk-WFSQXYUT.js → chunk-YML53Z7H.js} +42 -5
  32. package/js/{chunk-5MQZEB6Y.js → chunk-ZZOCEUTB.js} +37 -12
  33. package/js/client.js +120 -84
  34. package/js/contracts.js +110 -16
  35. package/js/effect.js +20 -20
  36. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  37. package/js/graphql.js +58 -54
  38. package/js/host.js +20 -20
  39. package/js/index.js +247 -204
  40. package/js/mcp/effect.js +24 -22
  41. package/js/mcp/stdio.js +35 -30
  42. package/js/mcp.js +105 -68
  43. package/js/openapi.js +4087 -1503
  44. package/js/react.js +3 -3
  45. package/js/skills/effect.js +5 -3
  46. package/js/skills.js +15 -15
  47. package/js/storage/facet.js +4 -4
  48. package/js/ui/auth/contracts.js +2 -2
  49. package/js/ui/auth.js +5 -5
  50. package/js/ui/contracts.js +5 -4
  51. package/js/ui/serving.js +8516 -214
  52. package/package.json +1 -1
  53. package/runtime.json +1 -1
  54. package/types/app-data/src/contracts/database.d.ts +33 -6
  55. package/types/app-data/src/implementation/schema.d.ts +2 -17
  56. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  57. package/types/apps/src/contracts/app.d.ts +7 -6
  58. package/types/apps/src/contracts/failure.d.ts +54 -0
  59. package/types/apps/src/contracts/graphql.d.ts +2 -1
  60. package/types/apps/src/contracts/host.d.ts +34 -11
  61. package/types/apps/src/contracts/mcp.d.ts +91 -10
  62. package/types/apps/src/contracts/network.d.ts +84 -0
  63. package/types/apps/src/contracts/openapi-compile.d.ts +31 -3
  64. package/types/apps/src/contracts/openapi.d.ts +45 -9
  65. package/types/apps/src/contracts/operations.d.ts +5 -6
  66. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  67. package/types/apps/src/contracts/protocols/1.d.ts +251 -69
  68. package/types/apps/src/contracts/protocols/2.d.ts +710 -0
  69. package/types/apps/src/contracts/protocols/3.d.ts +716 -0
  70. package/types/apps/src/contracts/protocols/4.d.ts +1298 -0
  71. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  72. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  73. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  74. package/types/apps/src/contracts/protocols/8.d.ts +1119 -0
  75. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  76. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  77. package/types/apps/src/contracts/provider.d.ts +115 -10
  78. package/types/apps/src/contracts/router.d.ts +59 -0
  79. package/types/apps/src/contracts/skills.d.ts +18 -5
  80. package/types/apps/src/contracts/storage.d.ts +3 -3
  81. package/types/apps/src/contracts/ui.d.ts +18 -0
  82. package/types/apps/src/contracts/workflows.d.ts +34 -3
  83. package/types/apps/src/graphql.d.ts +1 -3
  84. package/types/apps/src/implementation/account-router.d.ts +12 -0
  85. package/types/apps/src/implementation/app.d.ts +5 -4
  86. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  87. package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
  88. package/types/apps/src/implementation/elicitation.d.ts +9 -9
  89. package/types/apps/src/implementation/failure-detail.d.ts +46 -0
  90. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  91. package/types/apps/src/implementation/graphql.d.ts +4 -3
  92. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  93. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  94. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  95. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  96. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  97. package/types/apps/src/implementation/mcp.d.ts +52 -25
  98. package/types/apps/src/implementation/network.d.ts +16 -0
  99. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  100. package/types/apps/src/implementation/openapi-document.d.ts +35 -8
  101. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  102. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  103. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  104. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  105. package/types/apps/src/implementation/operations.d.ts +36 -3
  106. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  107. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  108. package/types/apps/src/implementation/provider.d.ts +19 -5
  109. package/types/apps/src/implementation/router-catalog.d.ts +224 -0
  110. package/types/apps/src/implementation/router.d.ts +68 -0
  111. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  112. package/types/apps/src/implementation/schema.d.ts +52 -1
  113. package/types/apps/src/implementation/skills.d.ts +2 -2
  114. package/types/apps/src/implementation/storage.d.ts +5 -3
  115. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  116. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  117. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  118. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  119. package/types/apps/src/implementation/ui-serving.d.ts +10 -4
  120. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  121. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  122. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  123. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  124. package/types/apps/src/index.d.ts +29 -11
  125. package/types/apps/src/mcp-stdio.d.ts +2 -5
  126. package/types/apps/src/mcp.d.ts +25 -5
  127. package/types/apps/src/openapi.d.ts +6 -6
  128. package/types/apps/src/skills.d.ts +4 -4
  129. package/types/telemetry/src/browser-operations.d.ts +5 -2
  130. package/types/telemetry/src/config.d.ts +2 -2
  131. package/types/utils/src/api-error.d.ts +48 -0
  132. package/js/chunk-PYUYJRSK.js +0 -93
  133. package/js/chunk-SWPD52J7.js +0 -35
  134. package/js/chunk-W7D7WVSY.js +0 -18
  135. package/js/chunk-Z5NMEGJN.js +0 -29
  136. package/js/chunk-ZJWDMTE3.js +0 -63
  137. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  138. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  139. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -157,6 +157,33 @@ export declare const DatabaseLimits: Schema.Struct<{
157
157
  export type DatabaseLimits = typeof DatabaseLimits.Type;
158
158
  /** Current per-invocation budgets, shared by every database adapter. */
159
159
  export declare const defaultDatabaseLimits: DatabaseLimits;
160
+ /**
161
+ * The budget a query or mutation exhausted. `pageSize` bounds one take(n) or paginate call;
162
+ * `valueBytes` bounds one stored row; the rest accumulate across the whole invocation.
163
+ */
164
+ export declare const DatabaseLimit: Schema.Literals<readonly ["scanCalls", "directGets", "rowsRead", "rowsReturned", "pageSize", "bytesRead", "writes", "valueBytes"]>;
165
+ export type DatabaseLimit = typeof DatabaseLimit.Type;
166
+ declare const DatabaseLimitExceeded_base: Schema.Class<DatabaseLimitExceeded, Schema.TaggedStruct<"DatabaseLimitExceeded", {
167
+ readonly limit: Schema.Literals<readonly ["scanCalls", "directGets", "rowsRead", "rowsReturned", "pageSize", "bytesRead", "writes", "valueBytes"]>;
168
+ readonly maximum: Schema.Int;
169
+ readonly requested: Schema.Int;
170
+ }>, import("effect/Cause").YieldableError>;
171
+ /** A query or mutation exceeded one of its database budgets. Nothing it wrote is committed. */
172
+ export declare class DatabaseLimitExceeded extends DatabaseLimitExceeded_base {
173
+ get message(): string;
174
+ }
175
+ /** Host-owned row metadata that authored tables cannot declare. */
176
+ export declare const reservedFieldNames: readonly ["id", "createdAt", "updatedAt"];
177
+ declare const DatabaseFieldReserved_base: Schema.Class<DatabaseFieldReserved, Schema.TaggedStruct<"DatabaseFieldReserved", {
178
+ readonly table: Schema.String;
179
+ readonly field: Schema.Literals<readonly ["id", "createdAt", "updatedAt"]>;
180
+ }>, import("effect/Cause").YieldableError>;
181
+ /** A table declared a field the host adds to every row. */
182
+ export declare class DatabaseFieldReserved extends DatabaseFieldReserved_base {
183
+ get message(): string;
184
+ }
185
+ /** Failures a database session reports to authored code and its host. */
186
+ export type DatabaseError = AppDatabaseError | DatabaseLimitExceeded;
160
187
  /** Host resource bounds outside an individual database transaction. Durations are milliseconds. */
161
188
  export declare const DatabaseRuntimeLimits: Schema.Struct<{
162
189
  readonly maxCursorChars: Schema.Int;
@@ -173,21 +200,21 @@ export declare const defaultDatabaseRuntimeLimits: {
173
200
  /** The host binds one database and read/write authority for the entire invocation. */
174
201
  export interface DatabaseSession {
175
202
  /** Host-only idempotency receipt, committed atomically with the mutation and validated result. */
176
- readonly once: <E, R>(key: string, fingerprint: string, work: () => Effect.Effect<Schema.Json, E, R>) => Effect.Effect<Schema.Json, E | AppDatabaseError, R>;
203
+ readonly once: <E, R>(key: string, fingerprint: string, work: () => Effect.Effect<Schema.Json, E, R>) => Effect.Effect<Schema.Json, E | DatabaseError, R>;
177
204
  readonly readTables: ReadonlySet<string>;
178
205
  readonly changedTables: ReadonlySet<string>;
179
- readonly execute: (operation: DatabaseOperation) => Effect.Effect<OperationResult, AppDatabaseError>;
206
+ readonly execute: (operation: DatabaseOperation) => Effect.Effect<OperationResult, DatabaseError>;
180
207
  }
181
208
  /** Native operation scope owns snapshot consistency, write rollback and commit notifications. */
182
209
  export interface AppDatabase {
183
210
  readonly schema: DatabaseSchema;
184
211
  readonly schemaHash: string;
185
- readonly read: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | AppDatabaseError, R>;
186
- readonly mutate: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | AppDatabaseError, R>;
212
+ readonly read: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | DatabaseError, R>;
213
+ readonly mutate: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | DatabaseError, R>;
187
214
  }
188
215
  /** Product-independent app partitions. A host supplies persistent storage; callers never choose filenames. */
189
216
  export interface AppDatabases {
190
- readonly read: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | AppDatabaseError>;
191
- readonly mutate: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | AppDatabaseError>;
217
+ readonly read: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError>;
218
+ readonly mutate: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError>;
192
219
  }
193
220
  export {};
@@ -1,6 +1,6 @@
1
1
  /** Validate declarations and write values before touching SQLite. */
2
2
  import { Effect } from "effect";
3
- import { AppDatabaseError, DatabaseSchema, RowMetadata, type Field, type Row, type Scalar, type Table } from "../contracts/database.js";
3
+ import { AppDatabaseError, DatabaseFieldReserved, DatabaseSchema, RowMetadata, type Field, type Row, type Scalar, type Table } from "../contracts/database.js";
4
4
  /** Built-in creation ordering and stable tie-breakers apply to every index. */
5
5
  export declare const indexesFor: (table: Table) => {
6
6
  name: string;
@@ -11,22 +11,7 @@ export declare const fieldFor: (table: Table, name: string) => Field | undefined
11
11
  /** Finite numbers and well-formed strings keep JSON and index ordering consistent. */
12
12
  export declare const validScalar: (field: Field, value: unknown) => value is Scalar;
13
13
  /** Parse the whole schema, including references and composite-index definitions. */
14
- export declare const parseDatabaseSchema: (input: unknown) => Effect.Effect<{
15
- readonly [x: string]: {
16
- readonly fields: {
17
- readonly [x: string]: {
18
- readonly kind: "string" | "number" | "boolean" | "id" | "userId";
19
- readonly optional?: boolean | undefined;
20
- readonly default?: string | number | boolean | undefined;
21
- readonly references?: string | undefined;
22
- };
23
- };
24
- readonly indexes: readonly {
25
- readonly name: string;
26
- readonly fields: readonly [string, ...string[]];
27
- }[];
28
- };
29
- }, AppDatabaseError, never>;
14
+ export declare const parseDatabaseSchema: (input: unknown) => Effect.Effect<DatabaseSchema, AppDatabaseError | DatabaseFieldReserved>;
30
15
  /** Canonical ordering for schema fingerprints and query-bound cursors. */
31
16
  export declare const canonicalSchema: (schema: DatabaseSchema) => string;
32
17
  /** Inserts apply declared defaults; updates reject unknown/metadata fields and clear optional values with null. */
@@ -1,4 +1,6 @@
1
1
  import { Schema } from "effect";
2
+ /** Longest agent guidance an API error's recovery carries. */
3
+ export declare const maxApiErrorInstructionsLength = 4096;
2
4
  /** Bounded recovery a declared API error published for its caller: a short next step and agent guidance. */
3
5
  export declare const ApiErrorRecovery: Schema.Struct<{
4
6
  readonly action: Schema.NonEmptyString;
@@ -6,6 +8,8 @@ export declare const ApiErrorRecovery: Schema.Struct<{
6
8
  }>;
7
9
  /** Recovery copied from an error response body; extra keys are dropped on decode. */
8
10
  export type ApiErrorRecovery = typeof ApiErrorRecovery.Type;
11
+ /** Longest message an API error response carries. */
12
+ export declare const maxApiErrorMessageLength = 4096;
9
13
  /** Bounded public fields from a response matching its declared API error schema. */
10
14
  export declare const ApiErrorResponse: Schema.Struct<{
11
15
  readonly code: Schema.NonEmptyString;
@@ -3,7 +3,6 @@ import type { DatabaseDefinition } from "./storage.js";
3
3
  /** Native app contracts; factories and handlers compose in the host's Effect runtime. */
4
4
  import { type Effect, Schema } from "effect";
5
5
  import type { OperationSchedule } from "./schedules.js";
6
- import type { AppOperation } from "./operations.js";
7
6
  import type { AccountOf, AuthMethods, ManyAccounts, Provider } from "./provider.js";
8
7
  import type { AppWorkflow, WorkflowReads } from "./workflows.js";
9
8
  import type { Elicit } from "./elicitation.js";
@@ -11,8 +10,8 @@ import type { Elicit } from "./elicitation.js";
11
10
  type Handler<Context> = (context: Context, input: never) => Effect.Effect<unknown, unknown>;
12
11
  /** App capabilities share one account context. Package metadata belongs in package.json. */
13
12
  export interface AppDefinition<Context> {
14
- /** Optional dynamic tools; resolution does not enumerate the catalog. */
15
- readonly dynamicTools?: import("./dynamic-tools.js").DynamicTools;
13
+ /** The app's root router. Its keys form tool paths such as `issues.list`. */
14
+ readonly tools?: import("./router.js").AppRouter | import("./router.js").DynamicRouter;
16
15
  /** Omission reads packaged skills/. An explicit catalog replaces that default, including []. */
17
16
  readonly skills?: readonly AppSkillSource[];
18
17
  /** Optional lazy skills, added to the static catalog. Only skill reads call them. */
@@ -21,8 +20,6 @@ export interface AppDefinition<Context> {
21
20
  readonly schedules?: Readonly<Record<string, Omit<OperationSchedule, "name"> & {
22
21
  readonly tool: string;
23
22
  }>>;
24
- readonly queries?: Readonly<Record<string, AppOperation>>;
25
- readonly mutations?: Readonly<Record<string, AppOperation>>;
26
23
  readonly webhooks?: Readonly<Record<string, {
27
24
  readonly account: string;
28
25
  readonly config: Schema.Decoder<unknown>;
@@ -46,7 +43,11 @@ export interface BoundContext<Slots extends AccountSlots> {
46
43
  readonly workflows: WorkflowReads;
47
44
  /** Ask for user input during this tool call. Unavailable during discovery and after the invocation closes. */
48
45
  readonly elicit: Elicit;
49
- /** Invocation-owned HTTP requests with trace propagation and host cancellation. */
46
+ /**
47
+ * Invocation-owned HTTP requests with trace propagation and host cancellation. It lasts until the
48
+ * invocation and every app cache refresh it started in the background have ended, so a catalog
49
+ * loader given this fetch can refresh after the reply.
50
+ */
50
51
  readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
51
52
  /** Host cancellation for this invocation. Pass it to fetch and other interruptible APIs. */
52
53
  readonly signal: AbortSignal;
@@ -0,0 +1,54 @@
1
+ /** Failure detail that crosses the runtime boundary to the app's own caller. */
2
+ import { Schema } from "effect";
3
+ /** Longest failure message carried across the runtime boundary. */
4
+ export declare const maxFailureMessageLength = 2048;
5
+ /**
6
+ * `app` for errors thrown by authored code, `storage` for app data failures the host raised, and
7
+ * `service` for an external API the app called through a framework helper.
8
+ */
9
+ export declare const FailureSource: Schema.Literals<readonly ["app", "storage", "service"]>;
10
+ /** The thrown error's name, such as `TypeError`, or the host error's tag. */
11
+ export declare const FailureName: Schema.String;
12
+ /** A stable host failure code, such as an app data reason, or the thrown error's own `code`. */
13
+ export declare const FailureCode: Schema.String;
14
+ /** Bounded, with the invocation's account secrets replaced. */
15
+ export declare const FailureMessage: Schema.String;
16
+ /** Most fields of one thrown error carried across the runtime boundary. */
17
+ export declare const maxFailureFields = 8;
18
+ /** Longest text field value carried across the runtime boundary. */
19
+ export declare const maxFailureFieldLength = 256;
20
+ /** A field name as the error's code spells it, such as `reason` or `pointer`. */
21
+ export declare const FailureFieldName: Schema.String;
22
+ /** Bounded text with account secrets replaced, a finite number, or a boolean. */
23
+ export declare const FailureFieldValue: Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>;
24
+ /**
25
+ * The thrown error's own scalar fields beside its name, code and message, such as the `reason`
26
+ * and `pointer` a spec compiler sets. Nested values, stacks and causes are never carried.
27
+ */
28
+ export declare const FailureFields: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
29
+ export type FailureFields = typeof FailureFields.Type;
30
+ /**
31
+ * The error an app's own code raised, or the specific host failure it hit. Stacks and cause
32
+ * values stay private. Builds from before these fields existed send none.
33
+ */
34
+ export declare const FailureDetail: {
35
+ source: Schema.optionalKey<Schema.Literals<readonly ["app", "storage", "service"]>>;
36
+ errorName: Schema.optionalKey<Schema.String>;
37
+ code: Schema.optionalKey<Schema.String>;
38
+ message: Schema.optionalKey<Schema.String>;
39
+ fields: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>;
40
+ };
41
+ /** Longest error message a service stated, as carried across the runtime boundary. */
42
+ export declare const maxUpstreamMessageLength = 1024;
43
+ /**
44
+ * The error a service stated in its own response: a JSON-RPC error's code and message, or an
45
+ * OAuth Bearer error code and description. Bounded, with the invocation's account secrets replaced.
46
+ */
47
+ export declare const UpstreamError: Schema.Struct<{
48
+ readonly code: Schema.Union<readonly [Schema.Int, Schema.String]>;
49
+ readonly message: Schema.optionalKey<Schema.String>;
50
+ }>;
51
+ export type UpstreamError = typeof UpstreamError.Type;
52
+ /** Where a service failed: setting up a session, listing tools, or running one. */
53
+ export declare const FailurePhase: Schema.Literals<readonly ["connect", "discover", "call"]>;
54
+ export type FailurePhase = typeof FailurePhase.Type;
@@ -1,4 +1,5 @@
1
1
  import type { ProviderError } from "./provider-error.js";
2
+ import type { NetworkRefused } from "./network.js";
2
3
  /** GraphQL discovery contracts. Catalogs are evaluated with the selected account. */
3
4
  import { Schema, type Effect } from "effect";
4
5
  import { type JsonValue } from "./schema.js";
@@ -97,7 +98,7 @@ export interface GraphqlTool {
97
98
  readonly description: string;
98
99
  readonly readOnly: boolean;
99
100
  readonly input: Schema.Decoder<JsonValue>;
100
- readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError>;
101
+ readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError | NetworkRefused>;
101
102
  }
102
103
  /** One tool per root field; subscriptions require a separate long-lived host. */
103
104
  export type GraphqlTools = Readonly<Record<string, GraphqlTool>>;
@@ -3,11 +3,15 @@ import { SkillLoadFailed, type SkillFile } from "./skills.js";
3
3
  import { ProviderError } from "./provider-error.js";
4
4
  import { McpError } from "./mcp.js";
5
5
  import { OpenapiResponseError } from "./api-response-error.js";
6
- export { ApiErrorResponse, OpenapiResponseError } from "./api-response-error.js";
6
+ export { ApiErrorResponse, maxApiErrorInstructionsLength, maxApiErrorMessageLength, OpenapiResponseError, } from "./api-response-error.js";
7
7
  export { ProviderError } from "./provider-error.js";
8
8
  export { McpError } from "./mcp.js";
9
+ export { FetchOptionUnsupported, NetworkRefusal, NetworkRefused, networkRefusalHeader, networkRefusalResponse, networkRefusalStatus, } from "./network.js";
9
10
  import { WorkflowFailure, type WorkflowExecution, type WorkflowReplay, type WorkflowHostControls } from "./workflows.js";
10
11
  export * from "./workflows.js";
12
+ export * from "./failure.js";
13
+ import { DatabaseFieldReserved, DatabaseLimitExceeded } from "../../../app-data/src/contracts/database.js";
14
+ export { DatabaseFieldReserved, DatabaseLimitExceeded } from "../../../app-data/src/contracts/database.js";
11
15
  /** Portable framework dispatch contracts. Requests never carry account bindings. */
12
16
  import { Context, Schema, type Effect, type Redacted } from "effect";
13
17
  import type { AppStorage } from "./storage.js";
@@ -18,15 +22,24 @@ export { ElicitationLimits, defaultElicitationLimits, FormElicitation, Elicitati
18
22
  export { McpClientLimits, defaultMcpClientLimits } from "./mcp.js";
19
23
  export * from "./webhook-protocol.js";
20
24
  export { AccountId, HttpUrl } from "./schema.js";
21
- export { OAuthClientAuth, OAuthSecretClientAuth } from "./provider.js";
25
+ export { OAuthClientAuth, OAuthSecretClientAuth, OAuthTokenRequestFormat, OAuthTokenResponse, } from "./provider.js";
22
26
  /**
23
27
  * The host protocol this framework speaks and its wire schemas. A later protocol replaces this
24
28
  * re-export; released protocol modules stay unchanged for host adapters.
25
29
  */
26
30
  export { frameworkProtocol } from "./protocol-version.js";
27
31
  export { protocol1 } from "./protocols/1.js";
28
- import { HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostInputInvalid, HostOperationFailed, HostOperationNotFound, HostOutputInvalid, HostRequestInvalid, HostToolApprovalRequired, HostToolBlocked, HostToolNotFound, HostToolPolicyFailed, SkillSources, type InvocationDeadline, ResolvedAccounts, type SkillCatalogResponse, type TrustedToolApproval } from "./protocols/1.js";
29
- export { DeclaredAuthMethod, DeclaredProvider, DeclaredRequirements, ResolvedAccount, ResolvedAccounts, TrustedToolApproval, InvocationDeadline, HostedTool, HostedToolSummary, SkillSources, SkillCatalogResponse, HostRequest, HostRequestInvalid, HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostOperationNotFound, HostOperationFailed, HostToolNotFound, InputProblem, maxInputProblems, HostInputInvalid, HostToolBlocked, HostToolApprovalRequired, HostToolPolicyFailed, HostOutputInvalid, HostError, HostResponse, HostInvocation, } from "./protocols/1.js";
32
+ export { protocol2 } from "./protocols/2.js";
33
+ export { protocol3 } from "./protocols/3.js";
34
+ export { protocol4 } from "./protocols/4.js";
35
+ export { protocol5 } from "./protocols/5.js";
36
+ export { protocol6 } from "./protocols/6.js";
37
+ export { protocol7, AccountCheckCommand, CredentialHost } from "./protocols/7.js";
38
+ export { protocol8 } from "./protocols/8.js";
39
+ export { AccountCheckResult, AccountInfo } from "./provider.js";
40
+ import { HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostInputInvalid, HostKindMismatch, HostOperationFailed, HostOperationNotFound, HostOutputInvalid, HostRequestInvalid, HostToolApprovalRequired, HostToolBlocked, HostToolNotFound, HostToolPolicyFailed, SkillSources, type InvocationDeadline, ResolvedAccounts, type SkillCatalogResponse, type TrustedToolApproval } from "./protocols/8.js";
41
+ export { DeclaredRequirements, HostRequest } from "./protocols/8.js";
42
+ export { DeclaredAuthMethod, DeclaredProvider, ResolvedAccount, ResolvedAccounts, TrustedToolApproval, InvocationDeadline, HostedTool, HostedToolSummary, HostRouterError, HostedRouter, HostedCatalog, HostedCatalogSummary, SkillSources, SkillCatalogResponse, HostRequestInvalid, HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostOperationNotFound, HostOperationFailed, HostToolNotFound, HostKindMismatch, InputProblem, maxInputProblems, HostInputInvalid, HostToolBlocked, HostToolApprovalRequired, HostToolPolicyFailed, HostOutputInvalid, HostError, HostResponse, HostInvocation, } from "./protocols/8.js";
30
43
  /** Raw host inputs; the host boundary parses and redacts these immediately. */
31
44
  export type ResolvedAccountsInput = typeof ResolvedAccounts.Encoded;
32
45
  /** Trusted invocation context, supplied separately from the Request. */
@@ -59,6 +72,7 @@ export declare const skillsCommand: (sources: boolean) => {
59
72
  export interface SkillCatalog {
60
73
  readonly skills: SkillSources["skills"];
61
74
  readonly dynamic?: boolean;
75
+ readonly cached?: boolean;
62
76
  }
63
77
  export declare const skillCatalog: (response: typeof SkillCatalogResponse.Type) => SkillCatalog;
64
78
  /**
@@ -76,16 +90,24 @@ export declare const indexCommand: {
76
90
  };
77
91
  /** Keep only the requested tools from an inspection that may have described every tool. */
78
92
  export declare const selectTools: (tools?: readonly string[]) => <A extends {
79
- readonly name: string;
80
- }>(all: readonly A[]) => readonly A[];
81
- /** Declaration reads do not bind accounts or evaluate the app factory. */
82
- export declare const HostRequirementsError: Schema.Union<readonly [typeof HostRequestInvalid, typeof HostDeclarationInvalid]>;
93
+ readonly tools: readonly {
94
+ readonly name: string;
95
+ }[];
96
+ }>(catalog: A) => A;
97
+ /** Declaration reads do not bind accounts or evaluate the app factory. A named declaration
98
+ * problem, such as a reserved database field, is reported so the deploy can explain it. */
99
+ export declare const HostRequirementsError: Schema.Union<readonly [typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof DatabaseFieldReserved]>;
83
100
  /** Inspection can fail while binding accounts or evaluating the live definition. */
84
101
  export declare const HostInspectError: Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>;
85
102
  /** Tool invocation adds lookup, input, execution and output failures to inspection. */
86
- export declare const HostCallError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostOperationFailed, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
103
+ export declare const HostCallError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostKindMismatch, typeof HostOperationFailed, typeof DatabaseLimitExceeded, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
104
+ /**
105
+ * An account check binds one account and runs the provider's check without evaluating the app.
106
+ * Timeouts arrive as WorkflowFailure from the shared deadline guard.
107
+ */
108
+ export declare const HostAccountCheckError: Schema.Union<readonly [typeof ProviderError, typeof WorkflowFailure, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostOperationNotFound, typeof HostOperationFailed, typeof HostOutputInvalid]>;
87
109
  /** Queries, mutations and agent calls use the same operation failures. */
88
- export declare const HostDataError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostOperationFailed, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
110
+ export declare const HostDataError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostKindMismatch, typeof HostOperationFailed, typeof DatabaseLimitExceeded, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
89
111
  /** Invocation-owned outcome sink. Framework adapters report semantic failures
90
112
  * independently of successful JSON transport; customer output is never inspected. */
91
113
  export declare const ToolResultObservation: Context.Reference<{
@@ -93,5 +115,6 @@ export declare const ToolResultObservation: Context.Reference<{
93
115
  }>;
94
116
  /** Native handler; context comes from host authority, never from request content. */
95
117
  export type AppHandler = (request: Request, context: HostContext) => Effect.Effect<Response>;
96
- export { OperationToolPrefixes, type AppOperation, type OperationContext } from "./operations.js";
118
+ export { type AppOperation, type OperationContext } from "./operations.js";
119
+ export { RouterIcon, RouterKey, RouterMeta, type AppNode, type AppRouter, type DynamicRouter, } from "./router.js";
97
120
  export * from "./schedules.js";
@@ -1,7 +1,9 @@
1
- import type { ProviderError } from "./provider-error.js";
1
+ import { ProviderError } from "./provider-error.js";
2
+ import type { NetworkRefused } from "./network.js";
2
3
  /** MCP protocol data uses Effect Schema; executable tool methods use Effect. */
3
4
  import { type Effect, type Redacted, Schema } from "effect";
4
5
  import type { Elicit, ElicitationFailed } from "./elicitation.js";
6
+ import type { AccountCheckContext, AuthMethods } from "./provider.js";
5
7
  import { type JsonValue } from "./schema.js";
6
8
  /** Upstream MCP resource bounds, independent of the outer codemode execution budget. */
7
9
  export declare const McpClientLimits: Schema.Struct<{
@@ -31,6 +33,37 @@ export declare const McpToolsOptions: Schema.Struct<{
31
33
  readonly timeoutMs: Schema.optional<Schema.Number>;
32
34
  }>;
33
35
  export type McpToolsOptions = typeof McpToolsOptions.Type;
36
+ /**
37
+ * What `mcpHealth` checks, as decoded: its options, with the account's ID, signal and deadline
38
+ * taken from the check context.
39
+ */
40
+ export declare const McpHealthInput: Schema.Struct<{
41
+ readonly headers: Schema.$Record<Schema.String, Schema.String>;
42
+ readonly deadline: Schema.optional<Schema.Finite>;
43
+ readonly url: Schema.String;
44
+ readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
45
+ readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
46
+ readonly timeoutMs: Schema.optional<Schema.Number>;
47
+ }>;
48
+ /**
49
+ * The server a provider check verifies, and the headers that send the checked account's
50
+ * credentials. The account, signal and deadline come from the check context instead. Both attempts
51
+ * share one budget that ends `mcpHealthReserveMs` before the deadline. `timeoutMs` bounds the whole
52
+ * check too; it can shorten the budget, never extend it.
53
+ */
54
+ export type McpHealthOptions = Pick<typeof McpHealthInput.Type, "url" | "headers" | "timeoutMs">;
55
+ /** What `mcpHealth` reads from the check context the host passes to a provider's `health`. */
56
+ export type McpHealthCheck = Pick<AccountCheckContext<AuthMethods>, "signal" | "deadline"> & {
57
+ readonly account: {
58
+ readonly id: string;
59
+ };
60
+ };
61
+ /**
62
+ * How long before an account check's deadline `mcpHealth` stops waiting for the server, so it can
63
+ * still close its session, ending it and then its transport, each within `cleanupTimeoutMs`, and
64
+ * report why before the host stops waiting.
65
+ */
66
+ export declare const mcpHealthReserveMs: number;
34
67
  /** One parsed server and credential snapshot; never shared across account evaluations. */
35
68
  export interface McpConnection {
36
69
  readonly url: URL;
@@ -38,15 +71,21 @@ export interface McpConnection {
38
71
  readonly timeoutMs: number;
39
72
  }
40
73
  export { ToolAnnotations as McpToolAnnotations } from "./tools.js";
41
- /** Native MCP result semantics. Protocol/transport failures use the Effect error channel. */
74
+ /**
75
+ * Native MCP result semantics, and the value every MCP tool call returns. A tool's output
76
+ * schema is built from this declaration. Protocol/transport failures use the Effect error channel.
77
+ */
42
78
  export declare const McpToolResult: Schema.Struct<{
43
79
  readonly content: Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
44
- readonly structuredContent: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
45
- readonly isError: Schema.optional<Schema.Boolean>;
46
- readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
80
+ readonly structuredContent: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
81
+ readonly isError: Schema.optionalKey<Schema.Boolean>;
82
+ readonly _meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
47
83
  }>;
48
84
  export type McpToolResult = typeof McpToolResult.Type;
49
- /** Remote metadata. Input/output schemas remain upstream JSON Schema documents. */
85
+ /**
86
+ * Remote metadata. Input/output schemas remain upstream JSON Schema documents; the upstream
87
+ * output schema describes only a result's `structuredContent`.
88
+ */
50
89
  export declare const McpToolMetadata: Schema.Struct<{
51
90
  readonly name: Schema.String;
52
91
  readonly title: Schema.optional<Schema.String>;
@@ -63,16 +102,37 @@ export declare const McpToolMetadata: Schema.Struct<{
63
102
  readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
64
103
  }>;
65
104
  export type McpToolMetadata = typeof McpToolMetadata.Type;
105
+ /** What a server reports about itself when a session initializes. Icons are for display only. */
106
+ export declare const McpServerHeader: Schema.Struct<{
107
+ readonly name: Schema.optionalKey<Schema.String>;
108
+ readonly title: Schema.optionalKey<Schema.String>;
109
+ readonly version: Schema.optionalKey<Schema.String>;
110
+ readonly description: Schema.optionalKey<Schema.String>;
111
+ readonly websiteUrl: Schema.optionalKey<Schema.String>;
112
+ readonly icons: Schema.optionalKey<Schema.$Array<Schema.Struct<{
113
+ readonly src: Schema.NonEmptyString;
114
+ readonly mimeType: Schema.optionalKey<Schema.String>;
115
+ readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
116
+ readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
117
+ }>>>;
118
+ readonly instructions: Schema.optionalKey<Schema.String>;
119
+ }>;
120
+ export type McpServerHeader = typeof McpServerHeader.Type;
66
121
  /** Direct callers can omit interaction capabilities. A server that asks for input then fails explicitly. */
67
122
  export interface McpToolContext {
68
123
  readonly elicit?: Elicit;
69
124
  }
70
- /** A tool bound to one evaluation's account; do not reuse it with another account. */
71
- export interface McpTool extends McpToolMetadata {
125
+ /**
126
+ * A tool bound to one evaluation's account; do not reuse it with another account. `output`
127
+ * decodes and describes the `McpToolResult` that `run` returns, with the upstream output schema
128
+ * under `structuredContent`.
129
+ */
130
+ export interface McpTool extends Omit<McpToolMetadata, "outputSchema"> {
72
131
  readonly description: string;
73
132
  readonly input: Schema.Decoder<JsonValue>;
133
+ readonly output: Schema.Decoder<JsonValue>;
74
134
  readonly readOnly?: boolean;
75
- readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | ElicitationFailed>;
135
+ readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | NetworkRefused | ElicitationFailed>;
76
136
  }
77
137
  /** The discovered catalog keyed by remote tool name. */
78
138
  export type McpTools = Readonly<Record<string, McpTool>>;
@@ -80,10 +140,31 @@ declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpErro
80
140
  readonly phase: Schema.Literals<readonly ["connect", "discover", "call", "schema", "transport"]>;
81
141
  readonly reason: Schema.Literals<readonly ["request", "unauthorized", "invalid_response", "timeout", "invalid_input"]>;
82
142
  readonly status: Schema.optional<Schema.Number>;
143
+ readonly upstream: Schema.optional<Schema.Struct<{
144
+ readonly code: Schema.Union<readonly [Schema.Int, Schema.String]>;
145
+ readonly message: Schema.optionalKey<Schema.String>;
146
+ }>>;
83
147
  }>, import("effect/Cause").YieldableError>;
84
- /** Safe protocol/transport failure; no raw upstream payloads or credentials. */
148
+ /**
149
+ * Safe protocol/transport failure; no raw upstream payloads or credentials. `status` is the HTTP
150
+ * status a `request` failure was redirected or refused with. Without one, a `request` failure in
151
+ * the `transport` phase never reached the server; in another phase it may be a JSON-RPC error the
152
+ * server answered with. `upstream` is that JSON-RPC error, bounded and with account secrets
153
+ * replaced. A response that is not MCP is `invalid_response`.
154
+ */
85
155
  export declare class McpError extends McpError_base {
86
156
  }
157
+ declare const McpCredentialsUnverified_base: Schema.Class<McpCredentialsUnverified, Schema.TaggedStruct<"McpCredentialsUnverified", {
158
+ readonly anonymous: Schema.Union<readonly [Schema.Literal<"answered">, typeof McpError, typeof ProviderError]>;
159
+ }>, import("effect/Cause").YieldableError>;
160
+ /**
161
+ * `mcpHealth` could not show that the server needs the account's credentials, although it accepted
162
+ * them. `anonymous` is what the same check without credentials met: `answered` when it succeeded,
163
+ * so a refused key would pass too, or the failure, other than a refusal, that left it undecided.
164
+ * Only app code raises it; the host reports its fixed message, so no host protocol carries it.
165
+ */
166
+ export declare class McpCredentialsUnverified extends McpCredentialsUnverified_base {
167
+ }
87
168
  /** Public process configuration. Credentials arrive through the selected account. */
88
169
  export declare const ProcessConfig: Schema.Struct<{
89
170
  readonly command: Schema.NonEmptyString;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * What app code sees when Executor's app network refuses a request, and the fetch options the
3
+ * app runtime accepts. A refusal is Executor's decision, not the service's: the request never
4
+ * left Executor. App code runs on workerd, Cloudflare's runtime, on every host.
5
+ */
6
+ import { Schema } from "effect";
7
+ /**
8
+ * Why Executor's app network refused a request.
9
+ * - `private_address`: the destination is a private, loopback or internal address, and this
10
+ * instance lets apps reach only public addresses.
11
+ * - `credential_host`: the request carries a credential handle, and its provider does not allow
12
+ * the destination host.
13
+ * - `credential_app`: the request carries a credential handle that is not valid for this app.
14
+ * - `credential_expired`: the request carries an expired credential handle.
15
+ */
16
+ export declare const NetworkRefusal: Schema.Union<readonly [Schema.Struct<{
17
+ readonly reason: Schema.Literal<"private_address">;
18
+ }>, Schema.Struct<{
19
+ readonly reason: Schema.Literal<"credential_host">;
20
+ /** The provider of the credential handle the request carried. */
21
+ readonly provider: Schema.String;
22
+ /** The hosts that provider's credentials may reach; empty when it declares none. */
23
+ readonly allowedHosts: Schema.$Array<Schema.String>;
24
+ }>, Schema.Struct<{
25
+ readonly reason: Schema.Literal<"credential_app">;
26
+ }>, Schema.Struct<{
27
+ readonly reason: Schema.Literal<"credential_expired">;
28
+ /** The provider of the expired credential handle. */
29
+ readonly provider: Schema.String;
30
+ }>]>;
31
+ export type NetworkRefusal = typeof NetworkRefusal.Type;
32
+ declare const NetworkRefused_base: Schema.Class<NetworkRefused, Schema.TaggedStruct<"NetworkRefused", {
33
+ /** The refused destination, with its port when the URL names one. */
34
+ readonly host: Schema.String;
35
+ readonly refusal: Schema.Union<readonly [Schema.Struct<{
36
+ readonly reason: Schema.Literal<"private_address">;
37
+ }>, Schema.Struct<{
38
+ readonly reason: Schema.Literal<"credential_host">;
39
+ /** The provider of the credential handle the request carried. */
40
+ readonly provider: Schema.String;
41
+ /** The hosts that provider's credentials may reach; empty when it declares none. */
42
+ readonly allowedHosts: Schema.$Array<Schema.String>;
43
+ }>, Schema.Struct<{
44
+ readonly reason: Schema.Literal<"credential_app">;
45
+ }>, Schema.Struct<{
46
+ readonly reason: Schema.Literal<"credential_expired">;
47
+ /** The provider of the expired credential handle. */
48
+ readonly provider: Schema.String;
49
+ }>]>;
50
+ }>, import("effect/Cause").YieldableError>;
51
+ /** Executor's app network refused a request before it reached the service. */
52
+ export declare class NetworkRefused extends NetworkRefused_base {
53
+ get message(): string;
54
+ }
55
+ /**
56
+ * A refusal reaches app code as a response with this status and header. The header holds the
57
+ * encoded `NetworkRefused`, so it survives responses without a body, such as to `HEAD`; the
58
+ * body repeats it as JSON with its message. `ctx.fetch` and the framework's protocol helpers
59
+ * raise it as `NetworkRefused`; the platform's global `fetch` returns the response. Only
60
+ * Executor's app network sets the mark: it removes the header from a service's 421 response.
61
+ */
62
+ export declare const networkRefusalStatus = 421;
63
+ export declare const networkRefusalHeader = "x-executor-refused";
64
+ /** The header's value: the refusal as JSON, URI-encoded so any provider name fits in a header. */
65
+ export declare const NetworkRefusedHeader: Schema.compose<Schema.fromJsonString<typeof NetworkRefused>, Schema.StringFromUriComponent>;
66
+ /** The response Executor's app network returns in place of a request it refused. */
67
+ export declare const networkRefusalResponse: (refused: NetworkRefused) => Response;
68
+ /** RequestInit options the app runtime restricts. */
69
+ export declare const RestrictedFetchOption: Schema.Literals<readonly ["redirect", "cache", "integrity"]>;
70
+ export type RestrictedFetchOption = typeof RestrictedFetchOption.Type;
71
+ /** The values the app runtime accepts for each restricted option. */
72
+ export declare const supportedFetchOptions: Readonly<Record<RestrictedFetchOption, ReadonlyArray<string>>>;
73
+ declare const FetchOptionUnsupported_base: Schema.Class<FetchOptionUnsupported, Schema.TaggedStruct<"FetchOptionUnsupported", {
74
+ readonly option: Schema.Literals<readonly ["redirect", "cache", "integrity"]>;
75
+ readonly value: Schema.String;
76
+ readonly supported: Schema.$Array<Schema.String>;
77
+ }>, import("effect/Cause").YieldableError>;
78
+ /** `ctx.fetch` was given a standard RequestInit value the app runtime does not implement. */
79
+ export declare class FetchOptionUnsupported extends FetchOptionUnsupported_base {
80
+ get message(): string;
81
+ /** What to do instead, when the standard value has an equivalent the runtime supports. */
82
+ private get advice();
83
+ }
84
+ export {};
@@ -1,11 +1,39 @@
1
1
  /** Shared OpenAPI compilation diagnostics. */
2
2
  import { Schema } from "effect";
3
- export declare const OpenapiCompileErrorCode: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
3
+ export declare const OpenapiCompileErrorCode: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
4
+ /** A declared operation the importer left out, and why. */
5
+ export declare const OpenapiSkippedOperation: Schema.Struct<{
6
+ /** The tool name the operation would have; reading that tool reports why it is missing. */
7
+ readonly name: Schema.String;
8
+ /** The HTTP method, such as `GET`. */
9
+ readonly method: Schema.String;
10
+ /** The path as the definition declares it. */
11
+ readonly path: Schema.String;
12
+ readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
13
+ readonly reason: Schema.String;
14
+ }>;
15
+ export type OpenapiSkippedOperation = typeof OpenapiSkippedOperation.Type;
4
16
  declare const OpenapiCompileError_base: Schema.Class<OpenapiCompileError, Schema.TaggedStruct<"OpenapiCompileError", {
5
- readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
17
+ readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
6
18
  readonly reason: Schema.String;
19
+ readonly skipped: Schema.optionalKey<Schema.$Array<Schema.Struct<{
20
+ /** The tool name the operation would have; reading that tool reports why it is missing. */
21
+ readonly name: Schema.String;
22
+ /** The HTTP method, such as `GET`. */
23
+ readonly method: Schema.String;
24
+ /** The path as the definition declares it. */
25
+ readonly path: Schema.String;
26
+ readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
27
+ readonly reason: Schema.String;
28
+ }>>>;
29
+ readonly origins: Schema.optionalKey<Schema.$Array<Schema.String>>;
7
30
  }>, import("effect/Cause").YieldableError>;
8
- /** A safe generation failure, translated into product HTTP errors at the boundary. */
31
+ /**
32
+ * A safe generation failure. `reason` explains the cause; `skipped` lists the declared operations
33
+ * it left out and why, and `origins` the origins operations resolve to when none of them matches
34
+ * the allowed origin. Reading one left-out tool fails with this error for that operation alone.
35
+ */
9
36
  export declare class OpenapiCompileError extends OpenapiCompileError_base {
37
+ get message(): string;
10
38
  }
11
39
  export {};