apps 0.0.1-beta.19 → 0.0.1-beta.20

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.
@@ -2,7 +2,7 @@ import { Duration, Effect, Schema } from "effect";
2
2
  import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
3
3
  import { JsonObject, type JsonValue } from "../contracts/schema.js";
4
4
  export interface CatalogCacheOptions {
5
- /** App/build scope, optionally narrowed to the current account. */
5
+ /** The app's cache. An account's catalog is kept in that account's scope. */
6
6
  readonly cache?: AppCache;
7
7
  /** Reuse metadata for this duration. Defaults to five minutes. */
8
8
  readonly freshFor?: Duration.Input;
@@ -11,6 +11,27 @@ export interface CatalogCacheOptions {
11
11
  /** Await a fresh revision at an explicit logical connection or refresh boundary. */
12
12
  readonly revalidate?: boolean;
13
13
  }
14
+ /**
15
+ * Whose catalog a remote router reads. A public server takes neither field. Credential headers
16
+ * come only with the account they belong to, so an authenticated catalog always has its account.
17
+ */
18
+ export type CatalogAccount = {
19
+ readonly account?: undefined;
20
+ readonly headers?: undefined;
21
+ } | {
22
+ /** The selected account, as `accounts.<slot>` provides it. */
23
+ readonly account: {
24
+ readonly id: string;
25
+ };
26
+ /** Headers for this account's requests, such as its credentials. */
27
+ readonly headers?: Readonly<Record<string, string>>;
28
+ };
29
+ /**
30
+ * The cache an account's catalog lives in: the account's own scope, which token renewals keep.
31
+ * Credentials never enter a key. Headers without an account, or an account the app was not
32
+ * given, fail with `invalid`.
33
+ */
34
+ export declare const catalogScope: <E>(options: CatalogCacheOptions & CatalogAccount, invalid: () => E) => Effect.Effect<AppCache | undefined, E>;
14
35
  /** One load: the tools, and optionally a record describing the whole catalog. */
15
36
  export interface CatalogLoad<A> {
16
37
  readonly tools: readonly A[];
@@ -18,7 +39,9 @@ export interface CatalogLoad<A> {
18
39
  }
19
40
  export declare const catalogCache: <A extends {
20
41
  readonly name: string;
21
- }, S>(options: CatalogCacheOptions & {
42
+ }, S>(options: Omit<CatalogCacheOptions, "cache"> & {
43
+ /** The scope from `catalogScope`; undefined keeps discovery invocation-local. */
44
+ readonly cache: AppCache | undefined;
22
45
  readonly prefix: readonly JsonValue[];
23
46
  readonly schema: Schema.Decoder<A>;
24
47
  /** Schema-free projection stored beside the full pages, so browsing never reads schemas. */
@@ -1,7 +1,7 @@
1
1
  import { Effect } from "effect";
2
2
  import { GraphqlToolsOptions } from "../contracts/graphql.js";
3
- import { type CatalogCacheOptions } from "./catalog-cache.js";
3
+ import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
4
4
  import { type OperationKinds } from "./protocol-operations.js";
5
- export interface GraphqlCatalogOptions extends GraphqlToolsOptions, CatalogCacheOptions {
6
- }
5
+ /** An endpoint, the account whose schema it is, and the metadata policy. */
6
+ export type GraphqlCatalogOptions = Omit<GraphqlToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
7
7
  export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
@@ -1,9 +1,11 @@
1
1
  import { Effect } from "effect";
2
2
  import { McpToolsOptions } from "../contracts/mcp.js";
3
- import { type CatalogCacheOptions } from "./catalog-cache.js";
3
+ import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
4
4
  import { type OperationKinds } from "./protocol-operations.js";
5
- /** Metadata policy for HTTP/SSE sources. A missing cache keeps discovery invocation-local. */
6
- export interface McpCatalogOptions extends McpToolsOptions, CatalogCacheOptions {
7
- }
5
+ /**
6
+ * A server, the account whose catalog it is, and the metadata policy for HTTP/SSE sources. A
7
+ * missing cache keeps discovery invocation-local.
8
+ */
9
+ export type McpCatalogOptions = Omit<McpToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
8
10
  /** Construction opens no transport unless explicit revalidation is requested. */
9
11
  export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;