apps 0.0.1-beta.26 → 0.0.1-beta.27

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 (56) hide show
  1. package/README.md +6 -6
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-BTRBOOTD.js → chunk-3TEX4ZND.js} +23 -17
  4. package/js/{chunk-OI7OI2U3.js → chunk-4OD7PHQL.js} +2 -2
  5. package/js/{chunk-AAAMPT6F.js → chunk-65SZ23BK.js} +2 -2
  6. package/js/{chunk-XBG3M64K.js → chunk-6JBTHTI5.js} +1 -1
  7. package/js/{chunk-EXDR4HVM.js → chunk-7AZNPMQH.js} +53 -11
  8. package/js/{chunk-VGEPL4BV.js → chunk-7R5JY5H7.js} +19 -5
  9. package/js/{chunk-4CMJD7AB.js → chunk-AHI26TO6.js} +24 -8
  10. package/js/{chunk-OBXHLFGQ.js → chunk-B5YJQU45.js} +1 -1
  11. package/js/{chunk-T7WRQJUF.js → chunk-BRGF7VFN.js} +2 -2
  12. package/js/{chunk-HQKIPKM5.js → chunk-BTJMXW4I.js} +1 -1
  13. package/js/{chunk-HIYRKEWP.js → chunk-HIJW4LWC.js} +64 -21
  14. package/js/{chunk-DAIW2WM3.js → chunk-KQCMHI3K.js} +3 -3
  15. package/js/{chunk-GH6PY5BQ.js → chunk-M2KEEOIQ.js} +1 -1
  16. package/js/{chunk-TACLXEAE.js → chunk-NSBRV4FJ.js} +1 -1
  17. package/js/{chunk-DM5U7G7V.js → chunk-NXTXZ635.js} +1842 -1840
  18. package/js/{chunk-3YN4UDPB.js → chunk-PTUZSCEV.js} +2 -2
  19. package/js/{chunk-KKGRSXUK.js → chunk-PWF2DRJ3.js} +1 -1
  20. package/js/{chunk-2TP7C25K.js → chunk-SDLIDQXG.js} +3 -3
  21. package/js/{chunk-NXO2GN2T.js → chunk-T2UFJKZR.js} +8 -8
  22. package/js/{chunk-PC5RHPUP.js → chunk-TSLG2WPA.js} +2 -2
  23. package/js/{chunk-WPKXOTKM.js → chunk-TX2XCAL6.js} +3 -3
  24. package/js/{chunk-KNJAOYV4.js → chunk-V2I3MMPM.js} +2 -2
  25. package/js/{chunk-ZVMZWXVF.js → chunk-VUVBMNKC.js} +2 -2
  26. package/js/{chunk-SUY33XAY.js → chunk-WQ5MVBTP.js} +1 -1
  27. package/js/{chunk-LPN4ONWW.js → chunk-XBQTJP76.js} +2 -2
  28. package/js/{chunk-IE6W5RNN.js → chunk-YML53Z7H.js} +2 -2
  29. package/js/{chunk-DUEZ2XCO.js → chunk-YXKXKGN6.js} +3 -3
  30. package/js/{chunk-XIRAIB3P.js → chunk-ZZOCEUTB.js} +4 -4
  31. package/js/client.js +10 -10
  32. package/js/contracts.js +7 -7
  33. package/js/effect.js +19 -19
  34. package/js/graphql.js +21 -21
  35. package/js/host.js +19 -19
  36. package/js/index.js +12 -12
  37. package/js/mcp/effect.js +23 -21
  38. package/js/mcp/stdio.js +21 -21
  39. package/js/mcp.js +29 -24
  40. package/js/openapi.js +15 -15
  41. package/js/react.js +3 -3
  42. package/js/skills/effect.js +3 -3
  43. package/js/skills.js +11 -11
  44. package/js/storage/facet.js +4 -4
  45. package/js/ui/auth/contracts.js +2 -2
  46. package/js/ui/auth.js +5 -5
  47. package/js/ui/contracts.js +4 -4
  48. package/js/ui/serving.js +8 -8
  49. package/package.json +1 -1
  50. package/runtime.json +1 -1
  51. package/types/apps/src/contracts/mcp.d.ts +49 -3
  52. package/types/apps/src/contracts/provider.d.ts +6 -0
  53. package/types/apps/src/implementation/failure-detail.d.ts +3 -2
  54. package/types/apps/src/implementation/mcp-client.d.ts +1 -0
  55. package/types/apps/src/implementation/mcp.d.ts +11 -1
  56. package/types/apps/src/mcp.d.ts +20 -1
@@ -1,7 +1,8 @@
1
- import type { ProviderError } from "./provider-error.js";
1
+ import { ProviderError } from "./provider-error.js";
2
2
  /** MCP protocol data uses Effect Schema; executable tool methods use Effect. */
3
3
  import { type Effect, type Redacted, Schema } from "effect";
4
4
  import type { Elicit, ElicitationFailed } from "./elicitation.js";
5
+ import type { AccountCheckContext, AuthMethods } from "./provider.js";
5
6
  import { type JsonValue } from "./schema.js";
6
7
  /** Upstream MCP resource bounds, independent of the outer codemode execution budget. */
7
8
  export declare const McpClientLimits: Schema.Struct<{
@@ -31,6 +32,37 @@ export declare const McpToolsOptions: Schema.Struct<{
31
32
  readonly timeoutMs: Schema.optional<Schema.Number>;
32
33
  }>;
33
34
  export type McpToolsOptions = typeof McpToolsOptions.Type;
35
+ /**
36
+ * What `mcpHealth` checks, as decoded: its options, with the account's ID, signal and deadline
37
+ * taken from the check context.
38
+ */
39
+ export declare const McpHealthInput: Schema.Struct<{
40
+ readonly headers: Schema.$Record<Schema.String, Schema.String>;
41
+ readonly deadline: Schema.optional<Schema.Finite>;
42
+ readonly url: Schema.String;
43
+ readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
44
+ readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
45
+ readonly timeoutMs: Schema.optional<Schema.Number>;
46
+ }>;
47
+ /**
48
+ * The server a provider check verifies, and the headers that send the checked account's
49
+ * credentials. The account, signal and deadline come from the check context instead. Both attempts
50
+ * share one budget that ends `mcpHealthReserveMs` before the deadline. `timeoutMs` bounds the whole
51
+ * check too; it can shorten the budget, never extend it.
52
+ */
53
+ export type McpHealthOptions = Pick<typeof McpHealthInput.Type, "url" | "headers" | "timeoutMs">;
54
+ /** What `mcpHealth` reads from the check context the host passes to a provider's `health`. */
55
+ export type McpHealthCheck = Pick<AccountCheckContext<AuthMethods>, "signal" | "deadline"> & {
56
+ readonly account: {
57
+ readonly id: string;
58
+ };
59
+ };
60
+ /**
61
+ * How long before an account check's deadline `mcpHealth` stops waiting for the server, so it can
62
+ * still close its session, ending it and then its transport, each within `cleanupTimeoutMs`, and
63
+ * report why before the host stops waiting.
64
+ */
65
+ export declare const mcpHealthReserveMs: number;
34
66
  /** One parsed server and credential snapshot; never shared across account evaluations. */
35
67
  export interface McpConnection {
36
68
  readonly url: URL;
@@ -113,11 +145,25 @@ declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpErro
113
145
  }>>;
114
146
  }>, import("effect/Cause").YieldableError>;
115
147
  /**
116
- * Safe protocol/transport failure; no raw upstream payloads or credentials. `upstream` is the
117
- * JSON-RPC error the server answered with, bounded and with account secrets replaced.
148
+ * Safe protocol/transport failure; no raw upstream payloads or credentials. `status` is the HTTP
149
+ * status a `request` failure was redirected or refused with. Without one, a `request` failure in
150
+ * the `transport` phase never reached the server; in another phase it may be a JSON-RPC error the
151
+ * server answered with. `upstream` is that JSON-RPC error, bounded and with account secrets
152
+ * replaced. A response that is not MCP is `invalid_response`.
118
153
  */
119
154
  export declare class McpError extends McpError_base {
120
155
  }
156
+ declare const McpCredentialsUnverified_base: Schema.Class<McpCredentialsUnverified, Schema.TaggedStruct<"McpCredentialsUnverified", {
157
+ readonly anonymous: Schema.Union<readonly [Schema.Literal<"answered">, typeof McpError, typeof ProviderError]>;
158
+ }>, import("effect/Cause").YieldableError>;
159
+ /**
160
+ * `mcpHealth` could not show that the server needs the account's credentials, although it accepted
161
+ * them. `anonymous` is what the same check without credentials met: `answered` when it succeeded,
162
+ * so a refused key would pass too, or the failure, other than a refusal, that left it undecided.
163
+ * Only app code raises it; the host reports its fixed message, so no host protocol carries it.
164
+ */
165
+ export declare class McpCredentialsUnverified extends McpCredentialsUnverified_base {
166
+ }
121
167
  /** Public process configuration. Credentials arrive through the selected account. */
122
168
  export declare const ProcessConfig: Schema.Struct<{
123
169
  readonly command: Schema.NonEmptyString;
@@ -160,6 +160,12 @@ export interface AccountCheckContext<Auth extends AuthMethods> {
160
160
  readonly account: AccountOfMethods<Auth>;
161
161
  readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
162
162
  readonly signal: AbortSignal;
163
+ /**
164
+ * When the host stops waiting for the check, in milliseconds since the epoch. A check still
165
+ * running then fails without its own message, so a check that gives up must do so before it.
166
+ * Executor always sets it; a host that does not limit the check leaves it out.
167
+ */
168
+ readonly deadline?: number;
163
169
  }
164
170
  /**
165
171
  * A safe authenticated read proving the account works for this app. Returning passes; a thrown
@@ -39,7 +39,8 @@ export declare const parseMcpError: (error: unknown, secrets: readonly string[])
39
39
  export declare const describeFailure: (error: unknown) => string;
40
40
  /**
41
41
  * Describe what an operation raised for the app's own caller. App data failures keep their
42
- * reason as a code, as do app cache failures; any other thrown value is the app's own error, with
43
- * its own code and scalar fields. Account secrets are replaced.
42
+ * reason as a code, as do app cache failures and OpenAPI and MCP service failures, such as an
43
+ * `mcpHealth` check that cannot reach its server or cannot verify the credentials; any other thrown
44
+ * value is the app's own error, with its own code and scalar fields. Account secrets are replaced.
44
45
  */
45
46
  export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
@@ -56,6 +56,7 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
56
56
  readonly websiteUrl?: string;
57
57
  } | {};
58
58
  }, ProviderError | McpError, never>;
59
+ check: Effect.Effect<void, ProviderError | McpError, never>;
59
60
  call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
60
61
  readonly content: readonly {
61
62
  readonly [x: string]: Schema.Json;
@@ -1,6 +1,6 @@
1
1
  import { ProviderError } from "../contracts/provider-error.js";
2
2
  import { Effect, Schema } from "effect";
3
- import { McpError, McpToolsOptions } from "../contracts/mcp.js";
3
+ import { McpCredentialsUnverified, McpError, McpToolsOptions, type McpHealthCheck, type McpHealthOptions } from "../contracts/mcp.js";
4
4
  /** Discover and call with a fresh selected-account transport for each operation. */
5
5
  export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.Effect<void, unknown>) => Effect.Effect<{
6
6
  list: Effect.Effect<{
@@ -40,6 +40,7 @@ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.
40
40
  readonly websiteUrl?: string;
41
41
  } | {};
42
42
  }, ProviderError | McpError, never>;
43
+ check: Effect.Effect<void, ProviderError | McpError, never>;
43
44
  call: (name: string, input: import("../index.js").JsonObject, context: import("../mcp.js").McpToolContext) => Effect.Effect<{
44
45
  readonly content: readonly {
45
46
  readonly [x: string]: Schema.Json;
@@ -53,5 +54,14 @@ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.
53
54
  readonly isError?: boolean;
54
55
  }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
55
56
  }, McpError, never>;
57
+ /**
58
+ * Check one account: initialize and read the first page of tools with the account's headers, then
59
+ * repeat that with no headers on a fresh transport. A refused account fails with its
60
+ * `ProviderError`, and anything else that stops the first check is an `McpError`; the second never
61
+ * runs. The check passes only when the server refuses the second, which shows it checked the
62
+ * credentials. Otherwise it fails with `McpCredentialsUnverified`. Both share one budget, which
63
+ * ends early enough before the check context's deadline to close the session and report why.
64
+ */
65
+ export declare const mcpHealthEffect: (check: McpHealthCheck, options: McpHealthOptions) => Effect.Effect<void, ProviderError | McpError | McpCredentialsUnverified, never>;
56
66
  /** Discover and compile all tools for connection probes and low-level consumers. */
57
67
  export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, ProviderError | McpError, never>;
@@ -1,11 +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";
7
+ export { McpCredentialsUnverified, McpError, type McpHealthOptions, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
6
8
  /**
7
9
  * A router over a server's tools for the selected account. Its title, description and
8
10
  * instructions come from the server. Kinds override uncertain upstream read-only hints.
9
11
  */
10
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`. A server that also answers
22
+ * without credentials, or whose answer to that attempt is not a refusal, throws
23
+ * `McpCredentialsUnverified`. Either error means the check could not verify the account, and the
24
+ * account form explains why. Send credentials only in `headers`; the attempt without them uses the
25
+ * same `url`. The check context's `signal` cancels both attempts, and they share one budget that
26
+ * ends early enough before its `deadline` to report a server that did not answer in time.
27
+ * `timeoutMs` can only shorten that budget.
28
+ */
29
+ export declare const mcpHealth: <Auth extends AuthMethods>(check: AccountCheckContext<Auth>, options: McpHealthOptions) => Promise<void>;
11
30
  export type { OperationKinds } from "./implementation/protocol-operations.js";