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
@@ -0,0 +1,43 @@
1
+ /** Remote skill readers return complete portable bundles, never installed host files. */
2
+ import { Effect } from "effect";
3
+ import { SkillLoadFailed, type GitHubSkillsOptions, type WellKnownSkillsOptions, type SkillTransport } from "../contracts/skills.js";
4
+ /** Give every failure without a message one that names the service. */
5
+ export declare const withService: (service: string | undefined) => <A, R>(effect: Effect.Effect<A, SkillLoadFailed, R>) => Effect.Effect<A, SkillLoadFailed, R>;
6
+ /** One loader invocation owns its byte budget and all of its network requests. */
7
+ export declare const reader: (transport: SkillTransport) => Effect.Effect<{
8
+ fetchBytes: (url: string, post?: {
9
+ readonly body: Uint8Array;
10
+ readonly headers: Record<string, string>;
11
+ }) => Effect.Effect<Uint8Array<ArrayBuffer>, SkillLoadFailed, never>;
12
+ read: (url: string) => Effect.Effect<string, SkillLoadFailed, never>;
13
+ json: (url: string) => Effect.Effect<unknown, SkillLoadFailed, never>;
14
+ }, never, never>;
15
+ export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effect.Effect<readonly {
16
+ readonly name: string;
17
+ readonly description: string;
18
+ readonly files: readonly {
19
+ readonly path: string;
20
+ readonly content: string;
21
+ }[];
22
+ readonly license?: string;
23
+ readonly compatibility?: string;
24
+ readonly metadata?: {
25
+ readonly [x: string]: string;
26
+ };
27
+ readonly "allowed-tools"?: string;
28
+ }[], SkillLoadFailed, never>;
29
+ /** Fetch all indexed files and reject a publication whose index changes during the read. */
30
+ export declare const wellKnownSkillsEffect: (options: WellKnownSkillsOptions) => Effect.Effect<readonly {
31
+ readonly name: string;
32
+ readonly description: string;
33
+ readonly files: readonly {
34
+ readonly path: string;
35
+ readonly content: string;
36
+ }[];
37
+ readonly license?: string;
38
+ readonly compatibility?: string;
39
+ readonly metadata?: {
40
+ readonly [x: string]: string;
41
+ };
42
+ readonly "allowed-tools"?: string;
43
+ }[], SkillLoadFailed, never>;
@@ -0,0 +1,28 @@
1
+ /** Swagger is most of the OpenAPI module's code. Discovery from a cached catalog never needs it,
2
+ * so a cold app Worker evaluates it only when it resolves a document or builds a request.
3
+ */
4
+ import "../contracts/swagger-client.ts";
5
+ export type SwaggerClient = typeof import("swagger-client").default;
6
+ export declare const loadSwaggerClient: () => Promise<{
7
+ buildRequest(options: {
8
+ spec: unknown;
9
+ operationId?: string;
10
+ pathName?: string;
11
+ method?: string;
12
+ parameters?: Readonly<Record<string, unknown>>;
13
+ requestBody?: unknown;
14
+ requestContentType?: string;
15
+ securities?: {
16
+ authorized: Readonly<Record<string, unknown>>;
17
+ };
18
+ }): unknown;
19
+ resolve(options: {
20
+ spec: unknown;
21
+ skipNormalization: boolean;
22
+ useCircularStructures: boolean;
23
+ requestInterceptor: () => never;
24
+ }): Promise<{
25
+ spec: unknown;
26
+ errors: readonly unknown[];
27
+ }>;
28
+ }>;
@@ -1,3 +1,6 @@
1
+ export { ProviderError } from "./contracts/provider-error.js";
2
+ export type { AppCache, CacheLoadContext, CacheGetOptions } from "./contracts/cache.js";
3
+ export { CacheError } from "../../app-cache/src/contracts/cache.js";
1
4
  /**
2
5
  * Public author API. Native contracts live in contracts/; this boundary
3
6
  * exposes ordinary declarations, schema helpers and Promise operations.
@@ -14,6 +17,9 @@ export { type Fields, type Infer, type ObjectSchema, type ObjectValue, type Sche
14
17
  export { type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type OAuth2Config, type Provider, } from "./contracts/provider.js";
15
18
  export { defineProvider } from "./implementation/provider.js";
16
19
  export { accountOperations } from "./implementation/account-operations.js";
20
+ export { dynamicTools } from "./implementation/dynamic-tools.js";
21
+ export { dynamicSkills } from "./implementation/dynamic-skills.js";
22
+ export type { HostedTool as OperationDescription } from "./contracts/host.js";
17
23
  /** A secrets declaration inferred from an author schema. */
18
24
  export type SecretsMethod<Shape extends ObjectSchema<Fields>> = NativeSecretsMethod<EffectSchema.Decoder<Infer<Shape>>>;
19
25
  /** An OAuth declaration inferred from its author-facing response schema. */
@@ -56,3 +62,4 @@ export type { OperationContext } from "./contracts/operations.js";
56
62
  export { workflow, type Workflow, type WorkflowDeclaration } from "./implementation/workflows.js";
57
63
  export { NonRetryableError, WorkflowFailure, type WorkflowContext, type WorkflowStepContext, type WorkflowStep, type WorkflowStepOptions, type WorkflowDuration, type WorkflowReads, type WorkflowControls, } from "./contracts/workflows.js";
58
64
  export { interval, cron, type ScheduleDeclaration } from "./implementation/schedules.js";
65
+ export type { AppSkillSource as Skill, SkillFile } from "./contracts/skills.js";
@@ -1,10 +1,10 @@
1
1
  /** HTTP MCP helpers. Requires the optional @modelcontextprotocol/sdk peer. */
2
- import { type OperationKinds } from "./implementation/protocol-operations.js";
3
- import type { McpToolsOptions } from "./contracts/mcp.js";
2
+ import type { OperationKinds } from "./implementation/protocol-operations.js";
3
+ import { type McpCatalogOptions } from "./implementation/mcp-catalog.js";
4
+ export type { McpCatalogOptions } from "./implementation/mcp-catalog.js";
4
5
  export { McpError, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
5
6
  /** Discover operations for the selected account. Kinds override uncertain upstream read-only hints. */
6
- export declare const mcpOperations: (options: McpToolsOptions, kinds?: OperationKinds) => Promise<{
7
- queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
8
- mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
7
+ export declare const mcpOperations: (options: McpCatalogOptions, kinds?: OperationKinds) => Promise<{
8
+ dynamicTools: import("./contracts/dynamic-tools.js").DynamicTools;
9
9
  }>;
10
10
  export type { OperationKinds } from "./implementation/protocol-operations.js";
@@ -1,10 +1,12 @@
1
1
  /** OpenAPI helpers over normalized operation metadata; no optional dependency is needed. */
2
2
  import { type OperationKinds } from "./implementation/protocol-operations.js";
3
3
  import type { OpenapiToolsOptions } from "./contracts/openapi.js";
4
- export { OpenapiError, type OpenapiToolsOptions, type OpenapiOperation, type CredentialBinding, type RequestParameter, } from "./contracts/openapi.js";
4
+ export { OpenapiError, isOpenapiTextMedia, openapiBinaryResultSchema, OpenapiErrorResponse, type OpenapiToolsOptions, type OpenapiOperation, type CredentialBinding, OpenapiParameter, OpenapiRequestBody, openapiMediaKind, } from "./contracts/openapi.js";
5
5
  /** Discover operations for the selected account. Kinds override uncertain upstream read-only hints. */
6
6
  export declare const openapiOperations: (options: OpenapiToolsOptions, kinds?: OperationKinds) => Promise<{
7
7
  queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
8
8
  mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
9
9
  }>;
10
10
  export type { OperationKinds } from "./implementation/protocol-operations.js";
11
+ export * from "./contracts/openapi-compile.js";
12
+ export { liveOpenapiOperations, type OpenapiSourceOptions, } from "./implementation/openapi-source.js";
@@ -0,0 +1,75 @@
1
+ import { type FolderSkillsOptions, type GitHubSkillsOptions, type SkillReaderOptions, type WellKnownSkillsOptions, type SkillFile } from "./contracts/skills.js";
2
+ export { SkillLoadFailed, SkillDefinitionInvalid, SkillServiceName, type SkillReaderOptions, type FolderSkillsOptions, type AppSkillSource as Skill, type SkillFile, type GitHubSkillsOptions, type SkillCacheOptions, type WellKnownSkillsOptions, } from "./contracts/skills.js";
3
+ /**
4
+ * Fetch a public GitHub skill collection from one resolved commit. Pass `cache: ctx.cache` to reuse
5
+ * the catalog; without it, mutable refs resolve again on each call.
6
+ */
7
+ export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<readonly {
8
+ readonly name: string;
9
+ readonly description: string;
10
+ readonly files: readonly {
11
+ readonly path: string;
12
+ readonly content: string;
13
+ }[];
14
+ readonly license?: string;
15
+ readonly compatibility?: string;
16
+ readonly metadata?: {
17
+ readonly [x: string]: string;
18
+ };
19
+ readonly "allowed-tools"?: string;
20
+ }[]>;
21
+ /** Fetch a published skill index and its text files. Pass `cache: ctx.cache` to reuse the catalog. */
22
+ export declare const wellKnownSkills: (options: WellKnownSkillsOptions) => Promise<readonly {
23
+ readonly name: string;
24
+ readonly description: string;
25
+ readonly files: readonly {
26
+ readonly path: string;
27
+ readonly content: string;
28
+ }[];
29
+ readonly license?: string;
30
+ readonly compatibility?: string;
31
+ readonly metadata?: {
32
+ readonly [x: string]: string;
33
+ };
34
+ readonly "allowed-tools"?: string;
35
+ }[]>;
36
+ /** Parse a bundled standard skill directory into an app capability. */
37
+ export declare const fileSkill: (files: readonly SkillFile[]) => Promise<{
38
+ readonly name: string;
39
+ readonly description: string;
40
+ readonly files: readonly {
41
+ readonly path: string;
42
+ readonly content: string;
43
+ }[];
44
+ readonly license?: string;
45
+ readonly compatibility?: string;
46
+ readonly metadata?: {
47
+ readonly [x: string]: string;
48
+ };
49
+ readonly "allowed-tools"?: string;
50
+ }>;
51
+ /** Read skill directories from ctx.files. Omitted path selects skills/; missing folders return []. */
52
+ export declare const folderSkills: (options: FolderSkillsOptions) => Promise<readonly {
53
+ readonly name: string;
54
+ readonly description: string;
55
+ readonly files: readonly {
56
+ readonly path: string;
57
+ readonly content: string;
58
+ }[];
59
+ readonly license?: string;
60
+ readonly compatibility?: string;
61
+ readonly metadata?: {
62
+ readonly [x: string]: string;
63
+ };
64
+ readonly "allowed-tools"?: string;
65
+ }[]>;
66
+ /**
67
+ * Read files for a custom remote skill loader, such as one for GitLab. Reads share one byte
68
+ * budget and reject with the same safe SkillLoadFailed errors as githubSkills, naming `service`.
69
+ */
70
+ export declare const skillReader: (options: SkillReaderOptions) => {
71
+ /** Fetch one UTF-8 text file. */
72
+ text: (url: string) => Promise<string>;
73
+ /** Fetch and parse one JSON document. */
74
+ json: (url: string) => Promise<unknown>;
75
+ };
@@ -1,5 +1,7 @@
1
1
  /** Telemetry configuration is parsed at composition roots; headers remain redacted. */
2
2
  import { Config, Context, Effect, Schema } from "effect";
3
+ /** Bound each collector request, including its acknowledgement; exporter retries retain the batch. */
4
+ export declare const telemetryRequestTimeout: "5 seconds";
3
5
  /** One private exporter target. Endpoints are complete signal URLs. */
4
6
  export declare const TelemetryTarget: Schema.Struct<{
5
7
  readonly url: Schema.String;
@@ -1,389 +0,0 @@
1
- import {
2
- ApprovalElicitation,
3
- ElicitationFailed,
4
- OAuth2Config,
5
- OperationSchedule,
6
- WorkflowCommand,
7
- WorkflowFailure
8
- } from "./chunk-HP7E42X6.js";
9
- import {
10
- DatabaseSchema
11
- } from "./chunk-7JXHF5IF.js";
12
- import {
13
- AccountId,
14
- HttpUrl,
15
- JsonObject,
16
- JsonValue
17
- } from "./chunk-36DNRFZQ.js";
18
- import {
19
- Context_exports,
20
- Schema_exports
21
- } from "./chunk-2OTCEKL2.js";
22
-
23
- // src/contracts/tools.ts
24
- var ToolAnnotations = Schema_exports.Struct({
25
- title: Schema_exports.optionalKey(Schema_exports.String),
26
- readOnlyHint: Schema_exports.optionalKey(Schema_exports.Boolean),
27
- destructiveHint: Schema_exports.optionalKey(Schema_exports.Boolean),
28
- idempotentHint: Schema_exports.optionalKey(Schema_exports.Boolean),
29
- openWorldHint: Schema_exports.optionalKey(Schema_exports.Boolean)
30
- });
31
-
32
- // src/contracts/mcp.ts
33
- var McpClientLimits = Schema_exports.Struct({
34
- timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
35
- maxTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
36
- maxTools: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
37
- maxPaginationCursors: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
38
- cleanupTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
39
- });
40
- var defaultMcpClientLimits = McpClientLimits.make({
41
- timeoutMs: 3e4,
42
- maxTimeoutMs: 3e5,
43
- maxTools: 5e4,
44
- maxPaginationCursors: 1e3,
45
- cleanupTimeoutMs: 1e3
46
- });
47
- var mcpSdkTimerCeilingMs = 2147483647;
48
- var McpToolsOptions = Schema_exports.Struct({
49
- url: HttpUrl,
50
- headers: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
51
- signal: Schema_exports.optional(Schema_exports.instanceOf(AbortSignal)),
52
- timeoutMs: Schema_exports.optional(
53
- Schema_exports.Number.check(
54
- Schema_exports.isInt(),
55
- Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
56
- )
57
- )
58
- });
59
- var McpToolResult = Schema_exports.Struct({
60
- content: Schema_exports.Array(JsonObject),
61
- structuredContent: Schema_exports.optional(JsonObject),
62
- isError: Schema_exports.optional(Schema_exports.Boolean),
63
- _meta: Schema_exports.optional(JsonObject)
64
- });
65
- var McpToolMetadata = Schema_exports.Struct({
66
- name: Schema_exports.String,
67
- title: Schema_exports.optional(Schema_exports.String),
68
- description: Schema_exports.optional(Schema_exports.String),
69
- inputSchema: JsonObject,
70
- outputSchema: Schema_exports.optional(JsonObject),
71
- annotations: Schema_exports.optional(ToolAnnotations),
72
- _meta: Schema_exports.optional(JsonObject)
73
- });
74
- var McpError = class extends Schema_exports.TaggedError()("McpError", {
75
- phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
76
- reason: Schema_exports.Literals([
77
- "request",
78
- "unauthorized",
79
- "invalid_response",
80
- "timeout",
81
- "invalid_input"
82
- ]),
83
- status: Schema_exports.optional(Schema_exports.Number)
84
- }) {
85
- };
86
- var ProcessConfig = Schema_exports.Struct({
87
- command: Schema_exports.NonEmptyString,
88
- args: Schema_exports.Array(Schema_exports.String),
89
- cwd: Schema_exports.optional(Schema_exports.String),
90
- env: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
91
- timeoutMs: Schema_exports.Int.check(
92
- Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
93
- )
94
- });
95
-
96
- // src/contracts/webhook-protocol.ts
97
- var WebhookTransportLimits = Schema_exports.Struct({
98
- maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
99
- });
100
- var defaultWebhookTransportLimits = WebhookTransportLimits.make({
101
- maxBodyBytes: 1024 * 1024
102
- });
103
- var encodedBodyChars = 4 * Math.ceil(defaultWebhookTransportLimits.maxBodyBytes / 3);
104
- var WebhookRequestData = Schema_exports.Struct({
105
- url: HttpUrl,
106
- method: Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]),
107
- headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
108
- body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
109
- });
110
- var WebhookResponseData = Schema_exports.Struct({
111
- status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 200, maximum: 599 })),
112
- headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
113
- body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
114
- });
115
- var ManualWebhookSetup = Schema_exports.Struct({
116
- instructions: Schema_exports.NonEmptyString,
117
- signingSecret: Schema_exports.Literals(["executor", "provider"])
118
- });
119
- var ManualWebhookDescriptor = Schema_exports.Struct({
120
- ...ManualWebhookSetup.fields,
121
- stateSchema: JsonObject
122
- });
123
- var HostedWebhook = Schema_exports.Struct({
124
- name: Schema_exports.NonEmptyString,
125
- account: Schema_exports.NonEmptyString,
126
- configSchema: JsonObject,
127
- setup: Schema_exports.optionalKey(ManualWebhookDescriptor)
128
- });
129
- var identity = {
130
- name: Schema_exports.NonEmptyString,
131
- subscriptionId: Schema_exports.NonEmptyString,
132
- sourceAccount: AccountId,
133
- callbackUrl: HttpUrl,
134
- secret: Schema_exports.String,
135
- config: JsonValue
136
- };
137
- var WebhookCommand = Schema_exports.Union([
138
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhooks") }),
139
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-validate"), ...identity }),
140
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-complete"), ...identity, state: JsonValue }),
141
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-register"), ...identity }),
142
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-unregister"), ...identity, state: JsonValue }),
143
- Schema_exports.Struct({
144
- operation: Schema_exports.Literal("webhook-handle"),
145
- ...identity,
146
- state: JsonValue,
147
- request: WebhookRequestData
148
- })
149
- ]);
150
-
151
- // src/contracts/operations.ts
152
- var OperationToolPrefixes = { query: "queries.", mutate: "mutations." };
153
-
154
- // src/contracts/host.ts
155
- var DeclaredAuthMethod = Schema_exports.Union([
156
- Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject }),
157
- Schema_exports.Struct({
158
- type: Schema_exports.Literal("oauth2"),
159
- ...OAuth2Config.members[0].fields,
160
- response: JsonObject
161
- }),
162
- Schema_exports.Struct({
163
- type: Schema_exports.Literal("oauth2"),
164
- ...OAuth2Config.members[1].fields,
165
- response: JsonObject
166
- }),
167
- Schema_exports.Struct({
168
- type: Schema_exports.Literal("oauth2"),
169
- ...OAuth2Config.members[2].fields,
170
- response: JsonObject
171
- }),
172
- Schema_exports.Struct({
173
- type: Schema_exports.Literal("oauth2"),
174
- ...OAuth2Config.members[3].fields,
175
- response: JsonObject
176
- })
177
- ]);
178
- var DeclaredProvider = Schema_exports.Struct({
179
- name: Schema_exports.NonEmptyString,
180
- auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod)
181
- });
182
- var DeclaredRequirements = Schema_exports.Struct({
183
- database: Schema_exports.optionalKey(DatabaseSchema),
184
- accounts: Schema_exports.Record(
185
- Schema_exports.NonEmptyString,
186
- Schema_exports.Struct({
187
- definition: DeclaredProvider,
188
- cardinality: Schema_exports.Literals(["one", "many"])
189
- })
190
- )
191
- });
192
- var ResolvedAccount = Schema_exports.Struct({
193
- id: AccountId,
194
- provider: DeclaredProvider,
195
- method: Schema_exports.NonEmptyString,
196
- fields: JsonObject
197
- });
198
- var ResolvedAccounts = Schema_exports.Record(
199
- Schema_exports.NonEmptyString,
200
- Schema_exports.Union([ResolvedAccount, Schema_exports.Array(ResolvedAccount)])
201
- );
202
- var TrustedToolApproval = Schema_exports.Struct({ tool: Schema_exports.NonEmptyString, input: JsonValue });
203
- var HostedTool = Schema_exports.Struct({
204
- schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
205
- name: Schema_exports.NonEmptyString,
206
- description: Schema_exports.String,
207
- inputSchema: JsonObject,
208
- readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
209
- title: Schema_exports.optionalKey(Schema_exports.String),
210
- outputSchema: Schema_exports.optionalKey(JsonObject),
211
- annotations: Schema_exports.optionalKey(ToolAnnotations),
212
- _meta: Schema_exports.optionalKey(JsonObject)
213
- });
214
- var HostRequest = Schema_exports.Union([
215
- WorkflowCommand,
216
- WebhookCommand,
217
- Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
218
- Schema_exports.Struct({ operation: Schema_exports.Literal("inspect") }),
219
- Schema_exports.Struct({
220
- operation: Schema_exports.Literal("query"),
221
- name: Schema_exports.NonEmptyString,
222
- input: JsonValue
223
- }),
224
- Schema_exports.Struct({
225
- operation: Schema_exports.Literal("mutate"),
226
- name: Schema_exports.NonEmptyString,
227
- input: JsonValue
228
- }),
229
- Schema_exports.Struct({
230
- operation: Schema_exports.Literal("call"),
231
- tool: Schema_exports.NonEmptyString,
232
- input: JsonValue
233
- })
234
- ]);
235
- var HostRequestInvalid = class extends Schema_exports.TaggedError()(
236
- "HostRequestInvalid",
237
- {}
238
- ) {
239
- };
240
- var HostAccountsInvalid = class extends Schema_exports.TaggedError()(
241
- "HostAccountsInvalid",
242
- {}
243
- ) {
244
- };
245
- var HostDeclarationInvalid = class extends Schema_exports.TaggedError()(
246
- "HostDeclarationInvalid",
247
- {}
248
- ) {
249
- };
250
- var HostEvaluationFailed = class extends Schema_exports.TaggedError()(
251
- "HostEvaluationFailed",
252
- {}
253
- ) {
254
- };
255
- var HostOperationNotFound = class extends Schema_exports.TaggedError()(
256
- "HostOperationNotFound",
257
- {}
258
- ) {
259
- };
260
- var HostOperationFailed = class extends Schema_exports.TaggedError()(
261
- "HostOperationFailed",
262
- {}
263
- ) {
264
- };
265
- var HostToolNotFound = class extends Schema_exports.TaggedError()(
266
- "HostToolNotFound",
267
- {}
268
- ) {
269
- };
270
- var HostInputInvalid = class extends Schema_exports.TaggedError()(
271
- "HostInputInvalid",
272
- {}
273
- ) {
274
- };
275
- var HostToolBlocked = class extends Schema_exports.TaggedError()("HostToolBlocked", {}) {
276
- };
277
- var HostToolApprovalRequired = class extends Schema_exports.TaggedError()(
278
- "HostToolApprovalRequired",
279
- { input: JsonValue, elicitation: ApprovalElicitation }
280
- ) {
281
- };
282
- var HostToolPolicyFailed = class extends Schema_exports.TaggedError()(
283
- "HostToolPolicyFailed",
284
- {}
285
- ) {
286
- };
287
- var HostOutputInvalid = class extends Schema_exports.TaggedError()(
288
- "HostOutputInvalid",
289
- {}
290
- ) {
291
- };
292
- var HostRequirementsError = Schema_exports.Union([HostRequestInvalid, HostDeclarationInvalid]);
293
- var HostInspectError = Schema_exports.Union([
294
- HostRequestInvalid,
295
- HostDeclarationInvalid,
296
- HostAccountsInvalid,
297
- HostEvaluationFailed
298
- ]);
299
- var HostCallError = Schema_exports.Union([
300
- WorkflowFailure,
301
- HostInspectError,
302
- HostToolNotFound,
303
- HostOperationNotFound,
304
- HostOperationFailed,
305
- HostInputInvalid,
306
- HostOutputInvalid,
307
- HostToolBlocked,
308
- HostToolApprovalRequired,
309
- HostToolPolicyFailed,
310
- ElicitationFailed
311
- ]);
312
- var HostDataError = HostCallError;
313
- var HostError = Schema_exports.Union([
314
- WorkflowFailure,
315
- HostRequestInvalid,
316
- HostAccountsInvalid,
317
- HostDeclarationInvalid,
318
- HostEvaluationFailed,
319
- HostOperationNotFound,
320
- HostOperationFailed,
321
- HostToolNotFound,
322
- HostInputInvalid,
323
- HostOutputInvalid,
324
- HostToolBlocked,
325
- HostToolApprovalRequired,
326
- HostToolPolicyFailed,
327
- ElicitationFailed
328
- ]);
329
- var ToolResultObservation = Context_exports.Reference(
330
- "apps/ToolResultObservation",
331
- { defaultValue: () => ({ failed: () => {
332
- } }) }
333
- );
334
- var HostResponse = Schema_exports.Union([
335
- Schema_exports.Struct({
336
- ok: Schema_exports.Literal(true),
337
- value: JsonValue,
338
- toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
339
- }),
340
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError })
341
- ]);
342
-
343
- export {
344
- ToolAnnotations,
345
- McpClientLimits,
346
- defaultMcpClientLimits,
347
- mcpSdkTimerCeilingMs,
348
- McpToolsOptions,
349
- McpToolResult,
350
- McpToolMetadata,
351
- McpError,
352
- ProcessConfig,
353
- WebhookTransportLimits,
354
- defaultWebhookTransportLimits,
355
- WebhookRequestData,
356
- WebhookResponseData,
357
- ManualWebhookSetup,
358
- ManualWebhookDescriptor,
359
- HostedWebhook,
360
- WebhookCommand,
361
- OperationToolPrefixes,
362
- DeclaredAuthMethod,
363
- DeclaredProvider,
364
- DeclaredRequirements,
365
- ResolvedAccount,
366
- ResolvedAccounts,
367
- TrustedToolApproval,
368
- HostedTool,
369
- HostRequest,
370
- HostRequestInvalid,
371
- HostAccountsInvalid,
372
- HostDeclarationInvalid,
373
- HostEvaluationFailed,
374
- HostOperationNotFound,
375
- HostOperationFailed,
376
- HostToolNotFound,
377
- HostInputInvalid,
378
- HostToolBlocked,
379
- HostToolApprovalRequired,
380
- HostToolPolicyFailed,
381
- HostOutputInvalid,
382
- HostRequirementsError,
383
- HostInspectError,
384
- HostCallError,
385
- HostDataError,
386
- HostError,
387
- ToolResultObservation,
388
- HostResponse
389
- };
@@ -1,9 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export {
8
- __export
9
- };