apps 0.0.1-beta.1 → 0.0.1-beta.11

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 (118) hide show
  1. package/README.md +65 -43
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
  5. package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
  6. package/js/{chunk-2HHMABB6.js → chunk-5T57N25Q.js} +61 -13
  7. package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
  8. package/js/{chunk-X7SFGU4Q.js → chunk-EFAPIRVB.js} +28 -9
  9. package/js/chunk-GPFVWWDZ.js +209 -0
  10. package/js/{chunk-OHRT55C4.js → chunk-IJX4CYZO.js} +3 -6
  11. package/js/{chunk-ZTFQHGEB.js → chunk-IPI4MFSN.js} +3 -5
  12. package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
  13. package/js/{chunk-IHQ4ML7K.js → chunk-KRSCJDTW.js} +586 -111
  14. package/js/chunk-KUMBKVJD.js +39 -0
  15. package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
  16. package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
  17. package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
  18. package/js/chunk-NKLWZJLE.js +172 -0
  19. package/js/{chunk-ZCAMUXSG.js → chunk-ODEIDRGW.js} +3 -4
  20. package/js/{chunk-M6ZRRIBI.js → chunk-PJJ24GU7.js} +1 -1
  21. package/js/{chunk-FZJOYIZO.js → chunk-PZB6T6KU.js} +1 -1
  22. package/js/chunk-R3EV5FTO.js +97 -0
  23. package/js/{chunk-KOXMLKTM.js → chunk-RELFXUOO.js} +308 -316
  24. package/js/{chunk-6YBRWRK3.js → chunk-RFVIONFX.js} +43 -14
  25. package/js/{chunk-RBAC33PQ.js → chunk-TYVDBQSI.js} +58 -83
  26. package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
  27. package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
  28. package/js/{chunk-4LPG6RCH.js → chunk-VFZKSM3T.js} +5 -25
  29. package/js/{chunk-6IIO4NPI.js → chunk-WVVV4TX2.js} +21 -9
  30. package/js/{chunk-G7IE6BKC.js → chunk-YBRC463S.js} +8 -8
  31. package/js/chunk-Z2QY3YTF.js +507 -0
  32. package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
  33. package/js/client.js +10 -26
  34. package/js/contracts.js +70 -15
  35. package/js/effect.js +19 -19
  36. package/js/es-APDZKREY.js +40968 -0
  37. package/js/graphql.js +34 -39
  38. package/js/host.js +23 -23
  39. package/js/index.js +199 -195
  40. package/js/mcp/effect.js +21 -21
  41. package/js/mcp/stdio.js +25 -25
  42. package/js/mcp.js +60 -44
  43. package/js/openapi.js +826 -41682
  44. package/js/react.js +3 -3
  45. package/js/skills/effect.js +3 -4
  46. package/js/skills.js +53 -17
  47. package/js/storage/facet.js +4 -4
  48. package/js/ui/auth/contracts.js +8 -9
  49. package/js/ui/auth.js +16 -14
  50. package/js/ui/contracts.js +4 -4
  51. package/js/ui/serving.js +9 -8
  52. package/package.json +1 -1
  53. package/runtime.json +1 -1
  54. package/types/app-cache/src/contracts/cache.d.ts +42 -2
  55. package/types/app-cache/src/index.d.ts +59 -1
  56. package/types/app-data/src/contracts/database.d.ts +33 -6
  57. package/types/app-data/src/implementation/schema.d.ts +2 -17
  58. package/types/apps/src/contracts/app.d.ts +7 -6
  59. package/types/apps/src/contracts/cache.d.ts +4 -1
  60. package/types/apps/src/contracts/failure.d.ts +25 -0
  61. package/types/apps/src/contracts/host.d.ts +34 -679
  62. package/types/apps/src/contracts/mcp.d.ts +16 -0
  63. package/types/apps/src/contracts/openapi.d.ts +11 -1
  64. package/types/apps/src/contracts/operations.d.ts +0 -5
  65. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  66. package/types/apps/src/contracts/protocols/1.d.ts +1589 -0
  67. package/types/apps/src/contracts/protocols/2.d.ts +668 -0
  68. package/types/apps/src/contracts/protocols/3.d.ts +676 -0
  69. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  70. package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
  71. package/types/apps/src/contracts/provider.d.ts +56 -5
  72. package/types/apps/src/contracts/router.d.ts +59 -0
  73. package/types/apps/src/contracts/skills.d.ts +17 -8
  74. package/types/apps/src/contracts/storage.d.ts +3 -3
  75. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  76. package/types/apps/src/contracts/workflows.d.ts +34 -3
  77. package/types/apps/src/graphql.d.ts +1 -3
  78. package/types/apps/src/implementation/account-router.d.ts +12 -0
  79. package/types/apps/src/implementation/app.d.ts +5 -4
  80. package/types/apps/src/implementation/cache.d.ts +3 -1
  81. package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
  82. package/types/apps/src/implementation/elicitation.d.ts +1 -1
  83. package/types/apps/src/implementation/failure-detail.d.ts +25 -0
  84. package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
  85. package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
  86. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  87. package/types/apps/src/implementation/mcp.d.ts +35 -19
  88. package/types/apps/src/implementation/openapi-compile.d.ts +3 -2
  89. package/types/apps/src/implementation/openapi-document.d.ts +0 -2
  90. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  91. package/types/apps/src/implementation/openapi-request.d.ts +0 -1
  92. package/types/apps/src/implementation/openapi-source.d.ts +7 -7
  93. package/types/apps/src/implementation/operations.d.ts +26 -3
  94. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  95. package/types/apps/src/implementation/provider.d.ts +9 -4
  96. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  97. package/types/apps/src/implementation/router.d.ts +59 -0
  98. package/types/apps/src/implementation/schema.d.ts +5 -6
  99. package/types/apps/src/implementation/storage.d.ts +5 -3
  100. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  101. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  102. package/types/apps/src/implementation/ui-serving.d.ts +4 -2
  103. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  104. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  105. package/types/apps/src/index.d.ts +21 -6
  106. package/types/apps/src/mcp-stdio.d.ts +2 -5
  107. package/types/apps/src/mcp.d.ts +5 -4
  108. package/types/apps/src/openapi.d.ts +6 -6
  109. package/types/apps/src/skills.d.ts +6 -3
  110. package/types/apps/src/ui-auth.d.ts +2 -2
  111. package/types/telemetry/src/browser-operations.d.ts +5 -2
  112. package/js/chunk-PZ36XMXW.js +0 -93
  113. package/js/chunk-SWPD52J7.js +0 -35
  114. package/js/chunk-TE4KO4HI.js +0 -47
  115. package/js/chunk-W7D7WVSY.js +0 -18
  116. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  117. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  118. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -8,16 +8,17 @@ export { CacheError } from "../../app-cache/src/contracts/cache.js";
8
8
  import { type Schema as EffectSchema } from "effect";
9
9
  import type { WebhookContext } from "./contracts/context.js";
10
10
  import { type JsonResponse as NativeResponse } from "./contracts/http.js";
11
- import { type OAuth2Config, type OAuth2Method as NativeOAuth2Method, type SecretsMethod as NativeSecretsMethod } from "./contracts/provider.js";
11
+ import { type OAuth2Config as NativeOAuth2Config, type OAuth2Method as NativeOAuth2Method, type ReservedAuthorizationParam, type SecretsMethod as NativeSecretsMethod } from "./contracts/provider.js";
12
12
  import type { Webhook as NativeWebhook } from "./contracts/webhooks.js";
13
13
  import { type PromiseMethods } from "./implementation/authoring.js";
14
14
  import { type Fields, type Infer, type ObjectSchema, type Schema } from "./implementation/schema.js";
15
15
  export { type JsonObject, type JsonValue, ValidationError } from "./contracts/schema.js";
16
16
  export { type Fields, type Infer, type ObjectSchema, type ObjectValue, type Schema, array, boolean, json, jsonSchema, literal, number, object, record, string, } from "./implementation/schema.js";
17
- export { type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type OAuth2Config, type Provider, } from "./contracts/provider.js";
18
- export { defineProvider } from "./implementation/provider.js";
19
- export { accountOperations } from "./implementation/account-operations.js";
20
- export { dynamicTools } from "./implementation/dynamic-tools.js";
17
+ export { type AccountCheckContext, type AccountCheckResult, type AccountInfo, type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type Provider, type ReservedAuthorizationParam, } from "./contracts/provider.js";
18
+ export { defineProvider, type ProviderOptions } from "./implementation/provider.js";
19
+ export { accountRouter } from "./implementation/account-router.js";
20
+ export { router, dynamicRouter, type RouterDeclaration, type RouterChild, type RouterOptions, } from "./implementation/router.js";
21
+ export type { RouterIcon } from "./contracts/router.js";
21
22
  export { dynamicSkills } from "./implementation/dynamic-skills.js";
22
23
  export type { HostedTool as OperationDescription } from "./contracts/host.js";
23
24
  /** A secrets declaration inferred from an author schema. */
@@ -28,12 +29,26 @@ export type OAuth2Method<Response extends Schema<unknown, boolean>> = NativeOAut
28
29
  export declare const OAuth2AccessToken: Schema<{
29
30
  readonly access_token: string;
30
31
  }, false>;
32
+ /**
33
+ * OAuth options as authors write them. `authorizationParams` naming a host-owned protocol
34
+ * parameter such as `state` or `scope` is a type error as well as a declaration failure.
35
+ */
36
+ export type OAuth2Config = WithoutReservedParams<NativeOAuth2Config>;
37
+ type WithoutReservedParams<Config> = Config extends unknown ? "authorizationParams" extends keyof Config ? Config & {
38
+ readonly authorizationParams?: {
39
+ readonly [Key in ReservedAuthorizationParam]?: never;
40
+ };
41
+ } : Config : never;
31
42
  /** Declare a secrets method without requiring an Effect schema from the author. */
32
43
  export declare const secrets: <const F extends Fields>(options: {
33
44
  readonly label: string;
34
45
  readonly fields: ObjectSchema<F>;
35
46
  }) => SecretsMethod<ObjectSchema<F>>;
36
- /** Declare OAuth discovery/endpoints and an optional app-visible response projection. */
47
+ /**
48
+ * Declare OAuth discovery/endpoints and an optional app-visible response projection.
49
+ * `authorizationParams` adds service-defined sign-in parameters; a declared `authorizationUrl`
50
+ * keeps its own query. Neither can set host-owned parameters, and each parameter appears once.
51
+ */
37
52
  export declare function oauth2(options: OAuth2Config): OAuth2Method<typeof OAuth2AccessToken>;
38
53
  export declare function oauth2<Response extends Schema<unknown, boolean>>(options: OAuth2Config & {
39
54
  readonly response: Response;
@@ -1,8 +1,5 @@
1
1
  import type { ProcessConfig } from "./contracts/mcp.js";
2
2
  import { type OperationKinds } from "./implementation/protocol-operations.js";
3
3
  export { McpError, type McpToolContext, type ProcessConfig } from "./contracts/mcp.js";
4
- /** Discover an account's tools; each discovery and call owns and closes its subprocess. */
5
- export declare const stdioOperations: (config: ProcessConfig, signal?: AbortSignal, kinds?: OperationKinds) => Promise<{
6
- queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
7
- mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
8
- }>;
4
+ /** Discover an account's tools as a router; each discovery and call owns and closes its subprocess. */
5
+ export declare const stdioRouter: (config: ProcessConfig, signal?: AbortSignal, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
@@ -3,8 +3,9 @@ import type { OperationKinds } from "./implementation/protocol-operations.js";
3
3
  import { type McpCatalogOptions } from "./implementation/mcp-catalog.js";
4
4
  export type { McpCatalogOptions } from "./implementation/mcp-catalog.js";
5
5
  export { McpError, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
6
- /** Discover operations for the selected account. Kinds override uncertain upstream read-only hints. */
7
- export declare const mcpOperations: (options: McpCatalogOptions, kinds?: OperationKinds) => Promise<{
8
- dynamicTools: import("./contracts/dynamic-tools.js").DynamicTools;
9
- }>;
6
+ /**
7
+ * A router over a server's tools for the selected account. Its title, description and
8
+ * instructions come from the server. Kinds override uncertain upstream read-only hints.
9
+ */
10
+ export declare const mcpRouter: (options: McpCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
10
11
  export type { OperationKinds } from "./implementation/protocol-operations.js";
@@ -2,11 +2,11 @@
2
2
  import { type OperationKinds } from "./implementation/protocol-operations.js";
3
3
  import type { OpenapiToolsOptions } from "./contracts/openapi.js";
4
4
  export { OpenapiError, isOpenapiTextMedia, openapiBinaryResultSchema, OpenapiErrorResponse, type OpenapiToolsOptions, type OpenapiOperation, type CredentialBinding, OpenapiParameter, OpenapiRequestBody, openapiMediaKind, } from "./contracts/openapi.js";
5
- /** Discover operations for the selected account. Kinds override uncertain upstream read-only hints. */
6
- export declare const openapiOperations: (options: OpenapiToolsOptions, 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>>;
9
- }>;
5
+ /**
6
+ * Discover a document's operations as a router for the selected account. Kinds override uncertain
7
+ * upstream read-only hints. Mount it under a key, or override its metadata with `router(...)`.
8
+ */
9
+ export declare const openapiRouter: (options: OpenapiToolsOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
10
10
  export type { OperationKinds } from "./implementation/protocol-operations.js";
11
11
  export * from "./contracts/openapi-compile.js";
12
- export { liveOpenapiOperations, type OpenapiSourceOptions, } from "./implementation/openapi-source.js";
12
+ export { liveOpenapiRouter, type OpenapiSourceOptions } from "./implementation/openapi-source.js";
@@ -1,6 +1,9 @@
1
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 WellKnownSkillsOptions, } from "./contracts/skills.js";
3
- /** Fetch a public GitHub skill collection from one resolved commit. Mutable refs refresh on each call. */
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
+ */
4
7
  export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<readonly {
5
8
  readonly name: string;
6
9
  readonly description: string;
@@ -15,7 +18,7 @@ export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<rea
15
18
  };
16
19
  readonly "allowed-tools"?: string;
17
20
  }[]>;
18
- /** Fetch a published skill index and its text files, with no persistent cache. */
21
+ /** Fetch a published skill index and its text files. Pass `cache: ctx.cache` to reuse the catalog. */
19
22
  export declare const wellKnownSkills: (options: WellKnownSkillsOptions) => Promise<readonly {
20
23
  readonly name: string;
21
24
  readonly description: string;
@@ -1,3 +1,3 @@
1
- /** Host-only app authentication protocol and bootstrap; products supply identity and session lifecycle. */
1
+ /** Host-only app authentication protocol; products supply identity and session lifecycle. */
2
2
  export * from "./contracts/ui-auth.js";
3
- export { appPrivateHeaders, appSignInPage, appSignInScript } from "./implementation/ui-auth.js";
3
+ export { appPrivateHeaders, appRedirect, appSignInCallback, appSignInFailed, } from "./implementation/ui-auth.js";
@@ -1,8 +1,11 @@
1
1
  /** Correlate transport and decoded outcomes without exporting response bodies or errors. */
2
2
  import { Effect, Schema, Tracer } from "effect";
3
3
  import { HttpClient, HttpClientError } from "effect/unstable/http";
4
- /** A random document identity. It is never an authentication or user identifier. */
5
- export declare const browserPageId: () => string;
4
+ /**
5
+ * A random identity for the current browser document. It is never an authentication or user
6
+ * identifier. Server renders have no document, so they get none instead of sharing one per isolate.
7
+ */
8
+ export declare const browserPageId: () => string | undefined;
6
9
  /** Safe event shared with the host's error reporter and product analytics. */
7
10
  export declare const BrowserOperationFailure: Schema.Struct<{
8
11
  readonly error_type: Schema.Literals<readonly ["BrowserDecodeFailed", "BrowserTransportFailed", "BrowserOperationFailed"]>;
@@ -1,93 +0,0 @@
1
- import {
2
- decoderOf
3
- } from "./chunk-2HHMABB6.js";
4
- import {
5
- Effect_exports
6
- } from "./chunk-FW5HBOIK.js";
7
-
8
- // src/implementation/authoring.ts
9
- var NativeCallback = /* @__PURE__ */ Symbol("apps.NativeCallback");
10
- var fromPromise = (callback) => (...args) => {
11
- if (NativeCallback in callback) {
12
- const native = callback[NativeCallback];
13
- return native(...args);
14
- }
15
- return Effect_exports.tryPromise({ try: () => callback(...args), catch: (error) => error });
16
- };
17
- var toPromise = (operation, signal) => {
18
- const native = (...args) => Effect_exports.suspend(() => {
19
- if (signal === void 0) return operation(...args);
20
- if (signal.aborted) return Effect_exports.interrupt;
21
- const cancelled = Effect_exports.callback((resume) => {
22
- if (signal.aborted) {
23
- resume(Effect_exports.interrupt);
24
- return;
25
- }
26
- const abort = () => resume(Effect_exports.interrupt);
27
- signal.addEventListener("abort", abort, { once: true });
28
- return Effect_exports.sync(() => signal.removeEventListener("abort", abort));
29
- });
30
- return Effect_exports.raceFirst(
31
- cancelled,
32
- Effect_exports.suspend(() => operation(...args))
33
- );
34
- });
35
- return Object.assign((...args) => Effect_exports.runPromise(native(...args)), {
36
- [NativeCallback]: native
37
- });
38
- };
39
-
40
- // src/implementation/operations.ts
41
- var NativeOperation = /* @__PURE__ */ Symbol("apps.Operation");
42
- var operationDeclaration = (operation) => ({
43
- kind: operation.kind,
44
- [NativeOperation]: operation
45
- });
46
- var nativeOperation = (value) => {
47
- if (typeof value !== "object" || value === null || !(NativeOperation in value)) return void 0;
48
- return value[NativeOperation];
49
- };
50
- var operationOptions = (options) => {
51
- const approval = options.approval;
52
- return {
53
- ...options.description === void 0 ? {} : { description: options.description },
54
- ...options.title === void 0 ? {} : { title: options.title },
55
- ...options.annotations === void 0 ? {} : { annotations: options.annotations },
56
- ...options._meta === void 0 ? {} : { _meta: options._meta },
57
- input: decoderOf(options.input),
58
- ...approval === void 0 ? {} : {
59
- approval: (context) => Effect_exports.tryPromise({ try: async () => approval(context), catch: (error) => error })
60
- }
61
- };
62
- };
63
- var withApproval = (operation, approval) => ({
64
- ...operation,
65
- [NativeOperation]: {
66
- ...operation[NativeOperation],
67
- approval: (context) => Effect_exports.tryPromise({ try: async () => approval(context), catch: (error) => error })
68
- }
69
- });
70
- var make = (kind, options, run) => operationDeclaration({
71
- ...operationOptions(options),
72
- kind,
73
- // The host always validates JSON serialization, even without a stronger output declaration.
74
- ...options.output === void 0 ? {} : { output: decoderOf(options.output) },
75
- run: (context, input) => Effect_exports.tryPromise({
76
- // SAFETY: defineApp checks the handler context against its requirements.
77
- // The host validates account bindings and creates the matching storage facade.
78
- try: () => run(context, input),
79
- catch: (error) => error
80
- })
81
- });
82
- var query = (options, run) => make("query", options, run);
83
- var mutation = (options, run) => make("mutation", options, run);
84
-
85
- export {
86
- fromPromise,
87
- toPromise,
88
- operationDeclaration,
89
- nativeOperation,
90
- withApproval,
91
- query,
92
- mutation
93
- };
@@ -1,35 +0,0 @@
1
- import {
2
- Schema_exports
3
- } from "./chunk-FW5HBOIK.js";
4
-
5
- // src/contracts/api-response-error.ts
6
- var ApiErrorRecovery = Schema_exports.Struct({
7
- action: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(1024)),
8
- instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096))
9
- });
10
- var ApiErrorResponse = Schema_exports.Struct({
11
- code: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)),
12
- status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 400, maximum: 599 })),
13
- message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096)),
14
- recovery: Schema_exports.optionalKey(ApiErrorRecovery)
15
- });
16
- var OpenapiResponseError = class extends Schema_exports.TaggedError()(
17
- "OpenapiResponseError",
18
- ApiErrorResponse.fields
19
- ) {
20
- };
21
- var OpenapiErrorLimits = Schema_exports.Struct({
22
- maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
23
- readTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
24
- });
25
- var defaultOpenapiErrorLimits = OpenapiErrorLimits.make({
26
- maxBodyBytes: 65536,
27
- readTimeoutMs: 2e3
28
- });
29
-
30
- export {
31
- ApiErrorRecovery,
32
- ApiErrorResponse,
33
- OpenapiResponseError,
34
- defaultOpenapiErrorLimits
35
- };
@@ -1,47 +0,0 @@
1
- import {
2
- HttpServerResponse_exports
3
- } from "./chunk-QKHR7BMF.js";
4
-
5
- // src/implementation/ui-auth.ts
6
- var appPrivateHeaders = {
7
- "cache-control": "no-store",
8
- "referrer-policy": "no-referrer",
9
- "x-content-type-options": "nosniff",
10
- "content-security-policy": "frame-ancestors 'none'"
11
- };
12
- var appSignInPage = () => HttpServerResponse_exports.text(
13
- `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Opening app</title></head><body><p>Opening app\u2026</p><a href="/" hidden>Try again</a><script src="/_executor/auth/browser.js"></script></body></html>`,
14
- {
15
- contentType: "text/html",
16
- headers: {
17
- ...appPrivateHeaders,
18
- "content-security-policy": "default-src 'none'; script-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'"
19
- }
20
- }
21
- );
22
- var appSignInScript = () => HttpServerResponse_exports.text(
23
- `
24
- const callback = location.pathname === "/_executor/auth/callback";
25
- const parameters = new URLSearchParams(location.hash.slice(1));
26
- const body = callback
27
- ? {request: parameters.get("request"), code: parameters.get("code")}
28
- : {returnTo: location.pathname + location.search + location.hash};
29
- if (callback) history.replaceState(null, "", location.pathname);
30
- fetch(callback ? "/_executor/auth/complete" : "/_executor/auth/start", {
31
- method: "POST", headers: {"content-type":"application/json"}, body: JSON.stringify(body)
32
- }).then(async response => {
33
- if (!response.ok) throw new Error();
34
- const result = await response.json();
35
- location.replace(callback ? result.returnTo : result.url);
36
- }).catch(() => {
37
- document.querySelector("p").textContent = "Could not sign in to this app. Try opening it again.";
38
- document.querySelector("a").hidden = false;
39
- });`,
40
- { contentType: "text/javascript", headers: appPrivateHeaders }
41
- );
42
-
43
- export {
44
- appPrivateHeaders,
45
- appSignInPage,
46
- appSignInScript
47
- };
@@ -1,18 +0,0 @@
1
- import {
2
- AccountId
3
- } from "./chunk-SATWJKN6.js";
4
- import {
5
- Schema_exports
6
- } from "./chunk-FW5HBOIK.js";
7
-
8
- // src/contracts/provider-error.ts
9
- var ProviderError = class extends Schema_exports.TaggedError()("ProviderError", {
10
- reason: Schema_exports.Literals(["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]),
11
- status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
12
- accountId: Schema_exports.optional(AccountId)
13
- }) {
14
- };
15
-
16
- export {
17
- ProviderError
18
- };
@@ -1,13 +0,0 @@
1
- /** Lazy operation discovery and resolution. Executables remain invocation-owned. */
2
- import type { Effect } from "effect";
3
- import type { HostedTool, HostedToolSummary } from "./host.js";
4
- import type { AppOperation } from "./operations.js";
5
- /** Tool names include their queries./mutations. prefix. Resolution never requires listing. */
6
- export interface DynamicTools {
7
- readonly list: () => Effect.Effect<readonly HostedTool[], unknown>;
8
- readonly resolve: (name: string) => Effect.Effect<AppOperation | undefined, unknown>;
9
- /** Names and descriptions without schemas. Omitted sources reduce list(). */
10
- readonly summaries?: () => Effect.Effect<readonly HostedToolSummary[], unknown>;
11
- /** One tool's full metadata without listing. Omitted sources search list(). */
12
- readonly describe?: (name: string) => Effect.Effect<HostedTool | undefined, unknown>;
13
- }
@@ -1,151 +0,0 @@
1
- /** Combine account-bound protocol operations without changing their upstream inputs. */
2
- import { Effect, Schema } from "effect";
3
- import type { DynamicTools } from "../contracts/dynamic-tools.js";
4
- import type { AppOperation, OperationContext } from "../contracts/operations.js";
5
- import { type JsonValue } from "../contracts/schema.js";
6
- import { type Operation } from "./operations.js";
7
- type Operations = {
8
- readonly queries?: Readonly<Record<string, Operation<JsonValue, unknown, "query", OperationContext>>>;
9
- readonly dynamicTools?: DynamicTools;
10
- readonly mutations?: Readonly<Record<string, Operation<JsonValue, unknown, "mutation", OperationContext>>>;
11
- };
12
- /**
13
- * Discover each selected account's protocol operations and combine matching names.
14
- * Calls take { accountId, input }; each branch retains its account's input schema,
15
- * credentials, approval and output validation. Empty selections expose no operations.
16
- * Discovery is sequential and cancellation follows the caller's signal.
17
- */
18
- export declare const accountOperations: <Account extends {
19
- readonly id: string;
20
- }>(accounts: readonly Account[], discover: (account: Account) => Promise<Operations>, options: {
21
- readonly signal: AbortSignal;
22
- }) => Promise<{
23
- queries: {
24
- [k: string]: Operation<{
25
- readonly accountId: string;
26
- readonly input: unknown;
27
- }, unknown, "query", import("../index.js").AppContext>;
28
- };
29
- mutations: {
30
- [k: string]: Operation<{
31
- readonly accountId: string;
32
- readonly input: unknown;
33
- }, unknown, "mutation", import("../index.js").AppContext>;
34
- };
35
- } | {
36
- dynamicTools: {
37
- list: () => Effect.Effect<{
38
- readonly name: string;
39
- readonly description: string;
40
- readonly inputSchema: {
41
- readonly [x: string]: Schema.Json;
42
- };
43
- readonly _meta?: {
44
- readonly [x: string]: Schema.Json;
45
- };
46
- readonly title?: string;
47
- readonly outputSchema?: {
48
- readonly [x: string]: Schema.Json;
49
- };
50
- readonly annotations?: {
51
- readonly title?: string;
52
- readonly readOnlyHint?: boolean;
53
- readonly destructiveHint?: boolean;
54
- readonly idempotentHint?: boolean;
55
- readonly openWorldHint?: boolean;
56
- };
57
- readonly schedules?: readonly {
58
- readonly name: string;
59
- readonly timing: {
60
- readonly kind: "interval";
61
- readonly milliseconds: number;
62
- } | {
63
- readonly kind: "cron";
64
- readonly calendar: {
65
- readonly expression: string;
66
- readonly timezone: string;
67
- };
68
- };
69
- readonly input: Schema.Json;
70
- }[];
71
- readonly readOnly?: boolean;
72
- }[], unknown, never>;
73
- summaries: () => Effect.Effect<{
74
- readonly name: string;
75
- readonly description: string;
76
- readonly title?: string;
77
- readonly annotations?: {
78
- readonly title?: string;
79
- readonly readOnlyHint?: boolean;
80
- readonly destructiveHint?: boolean;
81
- readonly idempotentHint?: boolean;
82
- readonly openWorldHint?: boolean;
83
- };
84
- readonly schedules?: readonly {
85
- readonly name: string;
86
- readonly timing: {
87
- readonly kind: "interval";
88
- readonly milliseconds: number;
89
- } | {
90
- readonly kind: "cron";
91
- readonly calendar: {
92
- readonly expression: string;
93
- readonly timezone: string;
94
- };
95
- };
96
- readonly input: Schema.Json;
97
- }[];
98
- readonly readOnly?: boolean;
99
- }[], unknown, never>;
100
- describe: (name: string) => Effect.Effect<{
101
- readonly name: string;
102
- readonly description: string;
103
- readonly inputSchema: {
104
- readonly [x: string]: Schema.Json;
105
- };
106
- readonly _meta?: {
107
- readonly [x: string]: Schema.Json;
108
- };
109
- readonly title?: string;
110
- readonly outputSchema?: {
111
- readonly [x: string]: Schema.Json;
112
- };
113
- readonly annotations?: {
114
- readonly title?: string;
115
- readonly readOnlyHint?: boolean;
116
- readonly destructiveHint?: boolean;
117
- readonly idempotentHint?: boolean;
118
- readonly openWorldHint?: boolean;
119
- };
120
- readonly schedules?: readonly {
121
- readonly name: string;
122
- readonly timing: {
123
- readonly kind: "interval";
124
- readonly milliseconds: number;
125
- } | {
126
- readonly kind: "cron";
127
- readonly calendar: {
128
- readonly expression: string;
129
- readonly timezone: string;
130
- };
131
- };
132
- readonly input: Schema.Json;
133
- }[];
134
- readonly readOnly?: boolean;
135
- } | undefined, unknown, never>;
136
- resolve: (name: string) => Effect.Effect<AppOperation<unknown, unknown> | undefined, unknown, never>;
137
- };
138
- queries: {
139
- [k: string]: Operation<{
140
- readonly accountId: string;
141
- readonly input: unknown;
142
- }, unknown, "query", import("../index.js").AppContext>;
143
- };
144
- mutations: {
145
- [k: string]: Operation<{
146
- readonly accountId: string;
147
- readonly input: unknown;
148
- }, unknown, "mutation", import("../index.js").AppContext>;
149
- };
150
- }>;
151
- export {};
@@ -1,8 +0,0 @@
1
- import { HostedTool } from "../contracts/host.js";
2
- import type { DynamicTools } from "../contracts/dynamic-tools.js";
3
- import { type OperationDeclaration } from "./operations.js";
4
- /** Declare metadata discovery separately from executable resolution. Names are fully qualified. */
5
- export declare const dynamicTools: (source: {
6
- readonly list: () => Promise<readonly HostedTool[]>;
7
- readonly resolve: (name: string) => Promise<OperationDeclaration<"query" | "mutation"> | undefined>;
8
- }) => DynamicTools;