apps 0.0.1-beta.0 → 0.0.1-beta.2

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 (114) hide show
  1. package/README.md +97 -4
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/{chunk-SBKHUC5L.js → chunk-4LPG6RCH.js} +2 -2
  5. package/js/chunk-5MQZEB6Y.js +172 -0
  6. package/js/{chunk-7JXHF5IF.js → chunk-BMOIAIVR.js} +1 -1
  7. package/js/chunk-CZ7CSFO4.js +39 -0
  8. package/js/chunk-D47C7KG5.js +172 -0
  9. package/js/{chunk-YDR4CPJA.js → chunk-EVJUVWN2.js} +8 -8
  10. package/js/chunk-FDNTX5QJ.js +78 -0
  11. package/js/{chunk-2OTCEKL2.js → chunk-FW5HBOIK.js} +2352 -1493
  12. package/js/{chunk-EP6AEUZO.js → chunk-FZJOYIZO.js} +1 -1
  13. package/js/{chunk-VFUZI3NY.js → chunk-HDJH3RPR.js} +4 -4
  14. package/js/{chunk-WIDTG42X.js → chunk-HDTGZWP2.js} +79 -26
  15. package/js/{chunk-Q2FD5IBM.js → chunk-J7O55ZV7.js} +298 -37
  16. package/js/{chunk-X3YBZCJW.js → chunk-JN55AYQH.js} +8 -41
  17. package/js/chunk-LGIYBDWA.js +85 -0
  18. package/js/{chunk-D6BKYP2L.js → chunk-M6ZRRIBI.js} +4 -4
  19. package/js/{chunk-HP7E42X6.js → chunk-MYYEW3RA.js} +767 -249
  20. package/js/{chunk-3ANFZFCV.js → chunk-OHRT55C4.js} +15 -15
  21. package/js/{chunk-R6JMJSVT.js → chunk-PLCMJREA.js} +2 -2
  22. package/js/{chunk-C24KEZXR.js → chunk-PYUYJRSK.js} +36 -2
  23. package/js/{chunk-W7Q5EOTS.js → chunk-QKHR7BMF.js} +32 -32
  24. package/js/{chunk-KWTCHVLT.js → chunk-RN2MXB4R.js} +47 -51
  25. package/js/{chunk-36DNRFZQ.js → chunk-SATWJKN6.js} +1 -1
  26. package/js/chunk-SWPD52J7.js +35 -0
  27. package/js/{chunk-BKVL7XAJ.js → chunk-TE4KO4HI.js} +1 -1
  28. package/js/chunk-UVL56Z6E.js +6641 -0
  29. package/js/chunk-W7D7WVSY.js +18 -0
  30. package/js/{chunk-BPEFS4YF.js → chunk-WFSQXYUT.js} +109 -17
  31. package/js/chunk-YEJOQEII.js +104 -0
  32. package/js/{chunk-LOKGDT6B.js → chunk-Z5NMEGJN.js} +5 -4
  33. package/js/{chunk-OWD2YICM.js → chunk-ZCAMUXSG.js} +116 -87
  34. package/js/chunk-ZJWDMTE3.js +63 -0
  35. package/js/client.js +11 -11
  36. package/js/contracts.js +88 -25
  37. package/js/effect.js +21 -15
  38. package/js/es-APDZKREY.js +40968 -0
  39. package/js/graphql.js +224 -121
  40. package/js/host.js +76 -19
  41. package/js/index.js +193 -51
  42. package/js/mcp/effect.js +25 -17
  43. package/js/mcp/stdio.js +23 -17
  44. package/js/mcp.js +110 -24
  45. package/js/openapi.js +3045 -105
  46. package/js/operations/approval.js +1 -1
  47. package/js/react.js +4 -4
  48. package/js/skills/effect.js +11 -0
  49. package/js/skills.js +894 -0
  50. package/js/storage/facet.js +7 -7
  51. package/js/ui/auth/contracts.js +6 -6
  52. package/js/ui/auth.js +8 -8
  53. package/js/ui/contracts.js +5 -5
  54. package/js/ui/serving.js +12 -12
  55. package/package.json +9 -1
  56. package/runtime.json +1 -1
  57. package/types/app-cache/src/contracts/cache.d.ts +119 -0
  58. package/types/app-cache/src/index.d.ts +93 -0
  59. package/types/apps/src/contracts/api-response-error.d.ts +43 -0
  60. package/types/apps/src/contracts/app.d.ts +11 -0
  61. package/types/apps/src/contracts/cache.d.ts +44 -0
  62. package/types/apps/src/contracts/dynamic-skills.d.ts +10 -0
  63. package/types/apps/src/contracts/dynamic-tools.d.ts +13 -0
  64. package/types/apps/src/contracts/graphql.d.ts +18 -1
  65. package/types/apps/src/contracts/host.d.ts +54 -525
  66. package/types/apps/src/contracts/mcp.d.ts +3 -1
  67. package/types/apps/src/contracts/openapi-compile.d.ts +11 -0
  68. package/types/apps/src/contracts/openapi-document.d.ts +53 -0
  69. package/types/apps/src/contracts/openapi.d.ts +156 -30
  70. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  71. package/types/apps/src/contracts/protocols/1.d.ts +1575 -0
  72. package/types/apps/src/contracts/provider-error.d.ts +15 -0
  73. package/types/apps/src/contracts/provider.d.ts +18 -1
  74. package/types/apps/src/contracts/skills.d.ts +122 -0
  75. package/types/apps/src/contracts/swagger-client.d.ts +29 -0
  76. package/types/apps/src/graphql.d.ts +6 -6
  77. package/types/apps/src/host.d.ts +1 -0
  78. package/types/apps/src/implementation/account-operations.d.ts +122 -3
  79. package/types/apps/src/implementation/app.d.ts +1 -1
  80. package/types/apps/src/implementation/cache-session.d.ts +7 -0
  81. package/types/apps/src/implementation/cache.d.ts +8 -0
  82. package/types/apps/src/implementation/catalog-cache.d.ts +29 -0
  83. package/types/apps/src/implementation/dynamic-skills.d.ts +7 -0
  84. package/types/apps/src/implementation/dynamic-tools.d.ts +8 -0
  85. package/types/apps/src/implementation/elicitation.d.ts +12 -12
  86. package/types/apps/src/implementation/git.d.ts +25 -0
  87. package/types/apps/src/implementation/graphql-catalog.d.ts +10 -0
  88. package/types/apps/src/implementation/graphql.d.ts +81 -3
  89. package/types/apps/src/implementation/inflate.d.ts +16 -0
  90. package/types/apps/src/implementation/input-problems.d.ts +3 -0
  91. package/types/apps/src/implementation/mcp-call.d.ts +3 -2
  92. package/types/apps/src/implementation/mcp-catalog.d.ts +12 -0
  93. package/types/apps/src/implementation/mcp-client.d.ts +9 -8
  94. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  95. package/types/apps/src/implementation/mcp-tools.d.ts +6 -3
  96. package/types/apps/src/implementation/mcp.d.ts +39 -2
  97. package/types/apps/src/implementation/openapi-compile.d.ts +119 -0
  98. package/types/apps/src/implementation/openapi-document.d.ts +51 -0
  99. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  100. package/types/apps/src/implementation/openapi-request.d.ts +10 -4
  101. package/types/apps/src/implementation/openapi-source.d.ts +40 -0
  102. package/types/apps/src/implementation/openapi.d.ts +39 -3
  103. package/types/apps/src/implementation/provider-error.d.ts +10 -0
  104. package/types/apps/src/implementation/schema.d.ts +6 -5
  105. package/types/apps/src/implementation/skill-files.d.ts +10 -0
  106. package/types/apps/src/implementation/skills.d.ts +43 -0
  107. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  108. package/types/apps/src/index.d.ts +7 -0
  109. package/types/apps/src/mcp.d.ts +5 -5
  110. package/types/apps/src/openapi.d.ts +3 -1
  111. package/types/apps/src/skills.d.ts +75 -0
  112. package/types/telemetry/src/config.d.ts +2 -0
  113. package/js/chunk-22WRQZT7.js +0 -389
  114. package/js/chunk-MLKGABMK.js +0 -9
@@ -1,5 +1,83 @@
1
+ import { ProviderError } from "../contracts/provider-error.js";
1
2
  /** Discover GraphQL tools live; transport, decoding and cancellation stay in Effect. */
2
- import { Effect } from "effect";
3
- import { GraphqlError, GraphqlToolsOptions, type GraphqlTools } from "../contracts/graphql.js";
3
+ import { Effect, Schema } from "effect";
4
+ import { OperationTypeNode } from "graphql";
5
+ import { GraphqlError, GraphqlIntrospection, GraphqlToolsOptions, type GraphqlToolDefinition, type GraphqlTools, type GraphqlTypeRef } from "../contracts/graphql.js";
6
+ import { JsonObject } from "../effect.js";
4
7
  /** Resolve schema and calls per account evaluation; never cache credentials or tools globally. */
5
- export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError>;
8
+ export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect.Effect<{
9
+ request: (phase: "discover" | "call", query: string, variables?: JsonObject) => Effect.Effect<{
10
+ readonly [x: string]: Schema.Json;
11
+ }, ProviderError | GraphqlError, never>;
12
+ discover: Effect.Effect<{
13
+ readonly __schema: {
14
+ readonly queryType: {
15
+ readonly name: string;
16
+ } | null;
17
+ readonly mutationType: {
18
+ readonly name: string;
19
+ } | null;
20
+ readonly types: readonly {
21
+ readonly kind: "SCALAR" | "OBJECT" | "INTERFACE" | "UNION" | "ENUM" | "INPUT_OBJECT" | "LIST" | "NON_NULL";
22
+ readonly name: string;
23
+ readonly fields: readonly {
24
+ readonly name: string;
25
+ readonly description: string | null;
26
+ readonly args: readonly {
27
+ readonly name: string;
28
+ readonly description: string | null;
29
+ readonly type: GraphqlTypeRef;
30
+ readonly defaultValue: string | null;
31
+ }[];
32
+ readonly type: GraphqlTypeRef;
33
+ }[] | null;
34
+ readonly inputFields: readonly {
35
+ readonly name: string;
36
+ readonly description: string | null;
37
+ readonly type: GraphqlTypeRef;
38
+ readonly defaultValue: string | null;
39
+ }[] | null;
40
+ readonly enumValues: readonly {
41
+ readonly name: string;
42
+ }[] | null;
43
+ }[];
44
+ };
45
+ }, ProviderError | GraphqlError, never>;
46
+ }, GraphqlError, never>;
47
+ /** Build serializable definitions once per introspection revision, without compiling validators. */
48
+ export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effect.Effect<{
49
+ name: string;
50
+ kind: OperationTypeNode.QUERY | OperationTypeNode.MUTATION;
51
+ field: string;
52
+ description: string;
53
+ arguments: {
54
+ name: string;
55
+ type: string;
56
+ }[];
57
+ inputSchema: {
58
+ type: string;
59
+ additionalProperties: boolean;
60
+ properties: {
61
+ select?: {
62
+ type: string;
63
+ minLength: number;
64
+ description: string;
65
+ };
66
+ arguments: {
67
+ readonly [x: string]: Schema.Json;
68
+ };
69
+ };
70
+ required: string[];
71
+ $defs: {
72
+ [k: string]: {
73
+ readonly [x: string]: Schema.Json;
74
+ };
75
+ };
76
+ };
77
+ composite: boolean;
78
+ selection: string;
79
+ }[], GraphqlError, never>;
80
+ /** Bind only the selected definition to current credentials and compile its input decoder. */
81
+ export declare const adaptGraphqlTool: (client: Effect.Success<ReturnType<typeof graphqlClientEffect>>, definition: GraphqlToolDefinition) => Effect.Effect<import("../contracts/graphql.js").GraphqlTool, GraphqlError, never>;
82
+ /** Low-level callers can still request a complete invocation-owned tool map. */
83
+ export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Minimal zlib (RFC 1950) and DEFLATE (RFC 1951) decoder. Git packfiles concatenate zlib streams
3
+ * without lengths, so readers must know where each stream ends. Platform decompression streams do
4
+ * not report that, so this decoder returns the offset after the stream's Adler-32 checksum.
5
+ */
6
+ /** The stream is malformed. */
7
+ export declare class InflateError extends Error {
8
+ }
9
+ /** The decoded stream would exceed the caller's limit. */
10
+ export declare class InflateLimitExceeded extends Error {
11
+ }
12
+ /** Decode one zlib stream starting at `start`, returning its bytes and the offset after it. */
13
+ export declare const inflateZlib: (input: Uint8Array, start: number, limit: number) => {
14
+ readonly data: Uint8Array;
15
+ readonly end: number;
16
+ };
@@ -0,0 +1,3 @@
1
+ import { HostInputInvalid } from "../contracts/host.js";
2
+ /** Failing input paths and expected shapes from a schema decode failure, without supplied values. */
3
+ export declare const inputInvalid: (error: unknown) => HostInputInvalid;
@@ -1,3 +1,4 @@
1
+ import type { ProviderError } from "../contracts/provider-error.js";
1
2
  /** One upstream call, with form requests forwarded to the invocation's existing elicitation capability. */
2
3
  import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
3
4
  import { Effect, Schema } from "effect";
@@ -5,7 +6,7 @@ import { ElicitationFailed } from "../contracts/elicitation.js";
5
6
  import { McpError, type McpToolContext } from "../contracts/mcp.js";
6
7
  import type { JsonObject } from "../contracts/schema.js";
7
8
  /** Register prompts only around tools/call, preserve metadata, and close every callback with the call. Never retries. */
8
- export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError) => Effect.Effect<{
9
+ export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError) => Effect.Effect<{
9
10
  readonly content: readonly {
10
11
  readonly [x: string]: Schema.Json;
11
12
  }[];
@@ -16,4 +17,4 @@ export declare const mcpCall: (client: Client, name: string, input: JsonObject,
16
17
  readonly [x: string]: Schema.Json;
17
18
  } | undefined;
18
19
  readonly isError?: boolean | undefined;
19
- }, ElicitationFailed | McpError, never>;
20
+ }, ProviderError | ElicitationFailed | McpError, never>;
@@ -0,0 +1,12 @@
1
+ import { Effect } from "effect";
2
+ import type { DynamicTools } from "../contracts/dynamic-tools.js";
3
+ import { McpToolsOptions } from "../contracts/mcp.js";
4
+ import { type CatalogCacheOptions } from "./catalog-cache.js";
5
+ import { type OperationKinds } from "./protocol-operations.js";
6
+ /** Metadata policy for HTTP/SSE sources. A missing cache keeps discovery invocation-local. */
7
+ export interface McpCatalogOptions extends McpToolsOptions, CatalogCacheOptions {
8
+ }
9
+ /** Construction opens no transport unless explicit revalidation is requested. */
10
+ export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<{
11
+ dynamicTools: DynamicTools;
12
+ }, unknown, never>;
@@ -1,3 +1,4 @@
1
+ import type { ProviderError } from "../contracts/provider-error.js";
1
2
  /** Shared MCP pagination, wire parsing and calls. Transport owns connection lifetime. */
2
3
  import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
3
4
  import type { jsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/types.js";
@@ -8,20 +9,23 @@ import type { JsonObject } from "../effect.js";
8
9
  export declare const mcpJsonSchemaValidator: jsonSchemaValidator;
9
10
  /** An operation owns its connection; it must close even when interrupted. */
10
11
  export interface WithMcpClient {
11
- <A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError>;
12
+ <A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError | ProviderError>;
12
13
  }
13
14
  /** Shared client operations never cache catalogs or account credentials. */
14
- export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError): {
15
+ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError): {
15
16
  list: Effect.Effect<{
16
17
  readonly name: string;
17
18
  readonly inputSchema: {
18
19
  readonly [x: string]: Schema.Json;
19
20
  };
21
+ readonly description?: string | undefined;
20
22
  readonly _meta?: {
21
23
  readonly [x: string]: Schema.Json;
22
24
  } | undefined;
23
25
  readonly title?: string | undefined;
24
- readonly description?: string | undefined;
26
+ readonly outputSchema?: {
27
+ readonly [x: string]: Schema.Json;
28
+ } | undefined;
25
29
  readonly annotations?: {
26
30
  readonly title?: string;
27
31
  readonly readOnlyHint?: boolean;
@@ -29,10 +33,7 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
29
33
  readonly idempotentHint?: boolean;
30
34
  readonly openWorldHint?: boolean;
31
35
  } | undefined;
32
- readonly outputSchema?: {
33
- readonly [x: string]: Schema.Json;
34
- } | undefined;
35
- }[], McpError, never>;
36
+ }[], ProviderError | McpError, never>;
36
37
  call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
37
38
  readonly content: readonly {
38
39
  readonly [x: string]: Schema.Json;
@@ -44,7 +45,7 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
44
45
  readonly [x: string]: Schema.Json;
45
46
  } | undefined;
46
47
  readonly isError?: boolean | undefined;
47
- }, import("../index.js").ElicitationFailed | McpError, never>;
48
+ }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
48
49
  };
49
50
  /** Transport-independent operations consumed by the app tool adapter. */
50
51
  export type McpClient = ReturnType<typeof mcpClient>;
@@ -1,4 +1,4 @@
1
1
  import { Effect } from "effect";
2
2
  import { McpError, ProcessConfig } from "../contracts/mcp.js";
3
3
  /** Each discovery/call owns and closes its subprocess. Deployment never starts it. */
4
- export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, McpError, never>;
4
+ export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, import("../index.js").ProviderError | McpError, never>;
@@ -1,6 +1,9 @@
1
+ import type { ProviderError } from "../contracts/provider-error.js";
1
2
  /** Adapt any MCP transport into ordinary tools with shared validation behavior. */
2
3
  import { Effect } from "effect";
3
- import { McpError, type McpTools } from "../contracts/mcp.js";
4
+ import { McpError, type McpTools, type McpToolMetadata } from "../contracts/mcp.js";
4
5
  import type { McpClient } from "./mcp-client.js";
5
- /** Evaluate fresh metadata for the account bound to this client. */
6
- export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError>;
6
+ /** Compile only the selected tool and bind its executable to the current invocation. */
7
+ export declare const adaptMcpTool: (client: McpClient, tool: McpToolMetadata) => Effect.Effect<import("../contracts/mcp.js").McpTool, McpError, never>;
8
+ /** Discover a complete catalog for probes and uncached low-level callers. */
9
+ export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError | ProviderError>;
@@ -1,4 +1,41 @@
1
- import { Effect } from "effect";
1
+ import { ProviderError } from "../contracts/provider-error.js";
2
+ import { Effect, Schema } from "effect";
2
3
  import { McpError, McpToolsOptions } from "../contracts/mcp.js";
3
4
  /** Discover and call with a fresh selected-account transport for each operation. */
4
- export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, McpError, never>;
5
+ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.Effect<void, unknown>) => Effect.Effect<{
6
+ list: Effect.Effect<{
7
+ readonly name: string;
8
+ readonly inputSchema: {
9
+ readonly [x: string]: Schema.Json;
10
+ };
11
+ readonly description?: string | undefined;
12
+ readonly _meta?: {
13
+ readonly [x: string]: Schema.Json;
14
+ } | undefined;
15
+ readonly title?: string | undefined;
16
+ readonly outputSchema?: {
17
+ readonly [x: string]: Schema.Json;
18
+ } | undefined;
19
+ readonly annotations?: {
20
+ readonly title?: string;
21
+ readonly readOnlyHint?: boolean;
22
+ readonly destructiveHint?: boolean;
23
+ readonly idempotentHint?: boolean;
24
+ readonly openWorldHint?: boolean;
25
+ } | undefined;
26
+ }[], ProviderError | McpError, never>;
27
+ call: (name: string, input: import("../index.js").JsonObject, context: import("../mcp.js").McpToolContext) => Effect.Effect<{
28
+ readonly content: readonly {
29
+ readonly [x: string]: Schema.Json;
30
+ }[];
31
+ readonly _meta?: {
32
+ readonly [x: string]: Schema.Json;
33
+ } | undefined;
34
+ readonly structuredContent?: {
35
+ readonly [x: string]: Schema.Json;
36
+ } | undefined;
37
+ readonly isError?: boolean | undefined;
38
+ }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
39
+ }, McpError, never>;
40
+ /** Discover and compile all tools for connection probes and low-level consumers. */
41
+ export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, ProviderError | McpError, never>;
@@ -0,0 +1,119 @@
1
+ /** Compile an OpenAPI document into tool declarations inside the app runtime, never a second execution engine. */
2
+ import { Effect, Schema } from "effect";
3
+ import { JsonObject } from "../contracts/schema.js";
4
+ import { OpenapiCompileError as TemplateError } from "../contracts/openapi-compile.js";
5
+ import type { OpenApiImport } from "../contracts/openapi-document.js";
6
+ import { type GeneratedOperation, type GeneratedSecrets } from "../contracts/openapi-document.js";
7
+ /** Compile a revision of a live OpenAPI source into tool declarations for the app runtime. */
8
+ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocument: unknown, options?: {
9
+ readonly baseUrl?: string;
10
+ readonly allowedOrigin?: string;
11
+ readonly securitySchemes?: Readonly<Record<string, JsonObject>>;
12
+ readonly fallbackSecurity?: GeneratedOperation["request"]["security"];
13
+ }) => Effect.Effect<{
14
+ operations: {
15
+ readonly name: string;
16
+ readonly path: string;
17
+ readonly description: string;
18
+ readonly request: {
19
+ readonly parameters: readonly {
20
+ readonly name: string;
21
+ readonly in: "query" | "path" | "header" | "cookie";
22
+ readonly required?: boolean;
23
+ readonly schema?: {
24
+ readonly [x: string]: Schema.Json;
25
+ };
26
+ readonly content?: {
27
+ readonly [x: string]: Schema.Json;
28
+ };
29
+ readonly style?: string;
30
+ readonly explode?: boolean;
31
+ readonly allowReserved?: boolean;
32
+ readonly allowEmptyValue?: boolean;
33
+ }[];
34
+ readonly security: readonly {
35
+ readonly [x: string]: readonly string[];
36
+ }[];
37
+ readonly responses: {
38
+ readonly [x: string]: {
39
+ readonly [x: string]: Schema.Json;
40
+ };
41
+ };
42
+ readonly requestBody?: {
43
+ readonly content: {
44
+ readonly [x: string]: {
45
+ readonly schema?: {
46
+ readonly [x: string]: Schema.Json;
47
+ };
48
+ readonly encoding?: {
49
+ readonly [x: string]: Schema.Json;
50
+ };
51
+ };
52
+ };
53
+ readonly required?: boolean;
54
+ };
55
+ };
56
+ readonly input: {
57
+ readonly [x: string]: Schema.Json;
58
+ };
59
+ readonly method: "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
60
+ readonly securitySchemes: {
61
+ readonly [x: string]: {
62
+ readonly [x: string]: Schema.Json;
63
+ };
64
+ };
65
+ readonly baseUrl: string;
66
+ readonly openapi: string;
67
+ readonly outputSchema?: {
68
+ readonly [x: string]: Schema.Json;
69
+ };
70
+ readonly operationId?: string;
71
+ readonly streaming?: true;
72
+ readonly errorResponses?: readonly {
73
+ readonly code: string;
74
+ readonly status: number;
75
+ readonly message: {
76
+ readonly source: "body";
77
+ } | {
78
+ readonly source: "schema";
79
+ readonly value: string;
80
+ };
81
+ readonly schema: {
82
+ readonly [x: string]: Schema.Json;
83
+ };
84
+ }[];
85
+ }[];
86
+ definitions: {
87
+ [k: string]: {
88
+ readonly [x: string]: Schema.Json;
89
+ };
90
+ };
91
+ methods: {
92
+ [k: string]: readonly {
93
+ readonly scheme: string;
94
+ readonly field: string;
95
+ readonly part: "value" | "username" | "password";
96
+ readonly prefix: string;
97
+ }[];
98
+ };
99
+ secrets: GeneratedSecrets[];
100
+ oauth: {
101
+ name: string;
102
+ config: {
103
+ discover: string;
104
+ } | {
105
+ authorizationUrl: string;
106
+ tokenUrl: string;
107
+ scopes: readonly string[];
108
+ };
109
+ }[];
110
+ schemes: {
111
+ [x: string]: {
112
+ readonly [x: string]: Schema.Json;
113
+ };
114
+ };
115
+ pinnedOrigin: string | undefined;
116
+ fallback: readonly {
117
+ readonly [x: string]: readonly string[];
118
+ }[] | undefined;
119
+ }, TemplateError, never>;
@@ -0,0 +1,51 @@
1
+ import { Schema } from "effect";
2
+ import { JsonObject } from "../contracts/schema.js";
3
+ /** Resolve OpenAPI objects once with Swagger; schemas retain their original recursive references.
4
+ * Scalar first upgrades Swagger 2.0 and OpenAPI 3.0 to 3.1, so the importer has one dialect and
5
+ * 3.1 keywords that appear in 3.0 documents keep their meaning.
6
+ * Unsupported versions, references and conversions throw TemplateError at the import boundary.
7
+ */
8
+ export declare function openApiDocument(input: unknown): Promise<{
9
+ spec: {
10
+ readonly openapi: string;
11
+ readonly paths: {
12
+ readonly [x: string]: {
13
+ readonly [x: string]: Schema.Json;
14
+ };
15
+ };
16
+ readonly security?: readonly {
17
+ readonly [x: string]: readonly string[];
18
+ }[];
19
+ readonly servers?: readonly {
20
+ readonly url: string;
21
+ readonly variables?: {
22
+ readonly [x: string]: Schema.Json;
23
+ };
24
+ }[];
25
+ readonly components?: {
26
+ readonly securitySchemes?: {
27
+ readonly [x: string]: {
28
+ readonly [x: string]: Schema.Json;
29
+ };
30
+ };
31
+ readonly schemas?: {
32
+ readonly [x: string]: {
33
+ readonly [x: string]: Schema.Json;
34
+ };
35
+ };
36
+ };
37
+ };
38
+ definitions: Map<string, {
39
+ readonly [x: string]: Schema.Json;
40
+ }>;
41
+ /** Inspect a component schema without expanding its children. OpenAPI object refs must already be resolved by Swagger. */
42
+ resolve(value: JsonObject): JsonObject;
43
+ /** Compose a Draft 2020-12 schema around API Schema Objects. Only values passed to
44
+ * `api` use the document's OpenAPI dialect; Executor-authored wrappers are already
45
+ * Draft 2020-12 and must not be reinterpreted. Reached components are converted once into
46
+ * the shared `definitions` and stay references here; nothing is inlined or copied per operation.
47
+ */
48
+ schema(build: (api: (input: Schema.Json) => JsonObject) => JsonObject): JsonObject;
49
+ }>;
50
+ /** A parsed document with one reference scope and one schema dialect. */
51
+ export type OpenApiDocument = Awaited<ReturnType<typeof openApiDocument>>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Group generated OpenAPI tool names as `<group>.<leaf>`, ported from Executor v1's tool paths.
3
+ * The group is the first tag, or the first meaningful path segment. The leaf is the operationId
4
+ * without a repeated group prefix, or a method-and-path name when there is no operationId.
5
+ */
6
+ export interface OperationNameInput {
7
+ readonly operationId: string | undefined;
8
+ /** The first non-empty tag. */
9
+ readonly tag: string | undefined;
10
+ readonly method: string;
11
+ readonly path: string;
12
+ }
13
+ /**
14
+ * Plan one name per input, in input order. Names that collide are refined together: first by
15
+ * the path's version segment, then by the HTTP method, then by a stable hash. Refinement only
16
+ * touches the colliding names, so adding an operation never renames an unrelated one.
17
+ */
18
+ export declare const planOperationNames: (inputs: readonly OperationNameInput[]) => string[];
@@ -1,11 +1,17 @@
1
- /** HTTP serialization for normalized OpenAPI operations. */
1
+ import { ProviderError } from "../contracts/provider-error.js";
2
+ /** Swagger constructs requests; Effect owns HTTP policy and bounded results. */
2
3
  import { Effect, Schema } from "effect";
3
- import { OpenapiError, type CredentialBinding, type OpenapiOperation, type OpenapiAccount } from "../contracts/openapi.js";
4
+ import { OpenapiResponseError } from "../contracts/api-response-error.js";
5
+ import { OpenapiError, type CredentialBinding, type OpenapiOperation, type OpenapiAccount, type OpenapiErrorResponse } from "../contracts/openapi.js";
6
+ type DeclaredError = OpenapiErrorResponse & {
7
+ readonly decoder: Schema.Decoder<Schema.Json>;
8
+ };
4
9
  /** Create request helpers from credential-free generated authentication metadata. */
5
10
  export declare function createRequest(config: {
6
11
  readonly methods: Readonly<Record<string, readonly CredentialBinding[]>>;
7
12
  readonly oauth: readonly string[];
8
13
  }): {
9
- available: (op: OpenapiOperation, method: string | undefined) => boolean;
10
- call: (op: OpenapiOperation, input: unknown, account: OpenapiAccount | undefined) => Effect.Effect<Schema.Json, OpenapiError, never>;
14
+ available: (op: OpenapiOperation, account: OpenapiAccount | undefined) => boolean;
15
+ call: (op: OpenapiOperation, input: unknown, account: OpenapiAccount | undefined, errors: readonly DeclaredError[]) => Effect.Effect<Schema.Json, ProviderError | OpenapiResponseError | OpenapiError, never>;
11
16
  };
17
+ export {};
@@ -0,0 +1,40 @@
1
+ /** Revisioned OpenAPI sources. Calls read a manifest, one operation and only its schema dependencies. */
2
+ import { Duration } from "effect";
3
+ import type { AppCache } from "../contracts/cache.js";
4
+ import { OpenapiOperation, type OpenapiToolsOptions } from "../contracts/openapi.js";
5
+ import { JsonObject, JsonValue } from "../contracts/schema.js";
6
+ import type { DynamicTools } from "../contracts/dynamic-tools.js";
7
+ import { type OperationKinds } from "./protocol-operations.js";
8
+ /** Static credential placement and destination are reviewed when the app is authored/imported. */
9
+ export interface OpenapiSourceOptions extends Omit<OpenapiToolsOptions, "operations" | "definitions"> {
10
+ readonly cache: AppCache;
11
+ readonly source: {
12
+ readonly url: string;
13
+ } | {
14
+ readonly document: JsonObject;
15
+ };
16
+ readonly allowedOrigin: string;
17
+ readonly securitySchemes: Readonly<Record<string, JsonObject>>;
18
+ readonly baseUrl?: string;
19
+ readonly freshFor?: Duration.Input;
20
+ readonly staleFor?: Duration.Input;
21
+ /**
22
+ * Query or mutation overrides keyed by the document's operationId. An operation without an
23
+ * operationId is keyed by its generated name without the kind, such as `users.getUsers`.
24
+ */
25
+ readonly kinds?: OperationKinds;
26
+ readonly fallbackSecurity?: OpenapiOperation["request"]["security"];
27
+ readonly patches?: readonly {
28
+ readonly op: "add" | "remove" | "replace";
29
+ readonly path: string;
30
+ readonly value?: JsonValue;
31
+ }[];
32
+ }
33
+ /** JSON-object patches are static app configuration and are reapplied to every revision. */
34
+ export declare function patchOpenapi(root: JsonObject, patches: OpenapiSourceOptions["patches"]): JsonObject;
35
+ /** No I/O during app construction. All accounts share credential-free compilation. */
36
+ export declare const liveOpenapiOperations: (options: OpenapiSourceOptions) => {
37
+ readonly queries: {};
38
+ readonly mutations: {};
39
+ readonly dynamicTools: DynamicTools;
40
+ };
@@ -1,5 +1,41 @@
1
1
  /** Evaluate normalized metadata into ordinary tools, with account-specific security filtering. */
2
- import { Effect } from "effect";
3
- import { OpenapiError, OpenapiToolsOptions, type OpenapiTools } from "../contracts/openapi.js";
2
+ import { Effect, Schema } from "effect";
3
+ import { OpenapiError, OpenapiToolsOptions, type OpenapiTools, type OpenapiOperation, type OpenapiParameterDefaults } from "../contracts/openapi.js";
4
+ import type { JsonObject, JsonValue } from "../contracts/schema.js";
5
+ /** Names of shared definitions a JSON value references directly as `#/$defs/<name>`. */
6
+ export declare function references(value: JsonValue, found?: Set<string>): Set<string>;
7
+ /**
8
+ * Make a schema self-contained with only the shared definitions it reaches. Cycles stay
9
+ * references to the same definition. A missing definition stays unresolved and fails when
10
+ * the schema compiles. The schema's own `$defs` keep precedence.
11
+ */
12
+ export declare const bundler: (definitions: Readonly<Record<string, JsonObject>>) => (schema: JsonObject) => JsonObject;
13
+ /**
14
+ * Make account-bound parameters optional. Validators omit the values so they stay account-free;
15
+ * the published schema includes them as `default` so callers can see what an omission sends.
16
+ */
17
+ export declare const parameterDefaultsInput: (op: OpenapiOperation, defaults: OpenapiParameterDefaults | undefined, publish: boolean) => JsonObject;
18
+ /** Account-free validators can be reused inside a Worker for one immutable revision. */
19
+ export declare const prepareOpenapiOperation: (op: OpenapiOperation, definitions: Readonly<Record<string, JsonObject>>, defaults?: OpenapiParameterDefaults) => Effect.Effect<{
20
+ input: Schema.declareConstructor<Schema.Json, Schema.Json, readonly [], Schema.Json>;
21
+ errors: {
22
+ decoder: Schema.declareConstructor<Schema.Json, Schema.Json, readonly [], Schema.Json>;
23
+ code: string;
24
+ status: number;
25
+ message: {
26
+ readonly source: "body";
27
+ } | {
28
+ readonly source: "schema";
29
+ readonly value: string;
30
+ };
31
+ schema: {
32
+ readonly [x: string]: Schema.Json;
33
+ };
34
+ }[];
35
+ output: () => {
36
+ readonly [x: string]: Schema.Json;
37
+ } | undefined;
38
+ }, never, never>;
39
+ export type PreparedOpenapiOperation = Effect.Success<ReturnType<typeof prepareOpenapiOperation>>;
4
40
  /** Decode retained metadata and expose only operations supported by the selected account. */
5
- export declare const openapiToolsEffect: (options: OpenapiToolsOptions) => Effect.Effect<OpenapiTools, OpenapiError>;
41
+ export declare const openapiToolsEffect: (options: OpenapiToolsOptions, prepared?: ReadonlyMap<string, PreparedOpenapiOperation>) => Effect.Effect<OpenapiTools, OpenapiError>;
@@ -0,0 +1,10 @@
1
+ import { Option } from "effect";
2
+ import { ProviderError } from "../contracts/provider-error.js";
3
+ /** Parse and rebuild the allowlisted fields, including when the input is already an Error instance. */
4
+ export declare function parseProviderError(error: unknown): Option.Option<ProviderError>;
5
+ /** Classify only explicit HTTP evidence. Raw provider content never enters the error. */
6
+ export declare function httpProviderError(status: number, headers?: Readonly<Record<string, string>>): ProviderError | undefined;
7
+ /** Attach the account used by the enclosing operation, without preserving arbitrary thrown fields. */
8
+ export declare function accountProviderError<E>(error: E, accountId: string): E | ProviderError;
9
+ /** GraphQL has no standard auth code; recognize these documented codes without guessing from prose. */
10
+ export declare function graphqlProviderError(errors: readonly unknown[], status: number): ProviderError | undefined;
@@ -64,6 +64,10 @@ declare const ImportedJsonSchema: unique symbol;
64
64
  export declare const importedJsonSchema: (decoder: EffectSchema.Decoder<unknown>) => unknown | undefined;
65
65
  /** Attach a composed discovery document without replacing its authoritative native decoder. */
66
66
  export declare const withJsonSchemaDocument: <S extends EffectSchema.Decoder<unknown>>(decoder: S, document: JsonObject) => S;
67
+ /** Compute a value on first use and reuse it. */
68
+ export declare const once: <A>(compute: () => A) => (() => A);
69
+ /** Attach a discovery document that is built only when it is first read. */
70
+ export declare const withLazyJsonSchemaDocument: <S extends EffectSchema.Decoder<unknown>>(decoder: S, document: () => JsonObject) => S;
67
71
  /**
68
72
  * Relocate a self-contained JSON Schema under a document pointer. Resolve references
69
73
  * before nesting so account schemas can reuse definition names, IDs and anchors.
@@ -76,12 +80,9 @@ export declare const compileJsonSchemaDecoder: (document: JsonObject) => Effect.
76
80
  readonly [x: string]: EffectSchema.Json;
77
81
  };
78
82
  }, ValidationError, never>;
83
+ export declare const lazyJsonSchemaDecoder: (document: () => JsonObject) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, never, never>;
79
84
  /** Preserve the JSON document; compile its validator only when a value is first decoded. */
80
- export declare const jsonSchemaDecoder: (input: unknown) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json> & {
81
- [ImportedJsonSchema]: {
82
- readonly [x: string]: EffectSchema.Json;
83
- };
84
- }, ValidationError, never>;
85
+ export declare const jsonSchemaDecoder: (input: unknown) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, ValidationError, never>;
85
86
  /** Import JSON metadata now; unsupported schemas and invalid values fail when parsed. */
86
87
  export declare const jsonSchema: (input: unknown) => Schema<EffectSchema.Json>;
87
88
  /** Database declaration retained by primitive constructors; nested payload schemas are not database fields. */
@@ -0,0 +1,10 @@
1
+ /** One parser for packaged, GitHub and well-known skill files. */
2
+ import { Effect } from "effect";
3
+ import { AppSkillSource, SkillDefinitionInvalid, SkillFile, type FolderSkillsOptions } from "../contracts/skills.js";
4
+ /** Parse one skill directory, retaining its full document and validating an optional source name. */
5
+ export declare const skillFromFiles: (input: readonly SkillFile[], source?: {
6
+ readonly directory?: string;
7
+ readonly name?: string;
8
+ }) => Effect.Effect<AppSkillSource, SkillDefinitionInvalid>;
9
+ /** Select immediate skill directories from packaged text files. Never accesses the host filesystem. */
10
+ export declare const folderSkillsEffect: (options: FolderSkillsOptions) => Effect.Effect<readonly AppSkillSource[], SkillDefinitionInvalid>;